mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: select-kit api to modify collection header
This commit is contained in:
@@ -46,6 +46,7 @@ export default SelectKitComponent.extend({
|
||||
values = this.computeValues(values);
|
||||
values = this._beforeDidComputeValues(values);
|
||||
this._setHeaderComputedContent();
|
||||
this._setCollectionHeaderComputedContent();
|
||||
this.didComputeContent(content);
|
||||
this.didComputeValues(values);
|
||||
this.didComputeAttributes();
|
||||
@@ -85,6 +86,7 @@ export default SelectKitComponent.extend({
|
||||
Ember.run.next(() => {
|
||||
this.mutateContent(this.get("computedContent"));
|
||||
this.mutateValues(this.get("computedValues"));
|
||||
this._setCollectionHeaderComputedContent();
|
||||
this._setHeaderComputedContent();
|
||||
});
|
||||
},
|
||||
|
||||
@@ -7,7 +7,8 @@ import PluginApiMixin from "select-kit/mixins/plugin-api";
|
||||
import {
|
||||
applyContentPluginApiCallbacks,
|
||||
applyHeaderContentPluginApiCallbacks,
|
||||
applyOnSelectPluginApiCallbacks
|
||||
applyOnSelectPluginApiCallbacks,
|
||||
applyCollectionHeaderCallbacks
|
||||
} from "select-kit/mixins/plugin-api";
|
||||
|
||||
export default Ember.Component.extend(UtilsMixin, PluginApiMixin, DomHelpersMixin, EventsMixin, {
|
||||
@@ -51,6 +52,7 @@ export default Ember.Component.extend(UtilsMixin, PluginApiMixin, DomHelpersMixi
|
||||
headerComponent: "select-kit/select-kit-header",
|
||||
headerComponentOptions: null,
|
||||
headerComputedContent: null,
|
||||
collectionHeaderComputedContent: null,
|
||||
collectionComponent: "select-kit/select-kit-collection",
|
||||
collectionHeight: 200,
|
||||
verticalOffset: 0,
|
||||
@@ -237,6 +239,15 @@ export default Ember.Component.extend(UtilsMixin, PluginApiMixin, DomHelpersMixi
|
||||
this.setProperties({ filter: "" });
|
||||
},
|
||||
|
||||
_setCollectionHeaderComputedContent() {
|
||||
const collectionHeaderComputedContent = applyCollectionHeaderCallbacks(
|
||||
this.get("pluginApiIdentifiers"),
|
||||
this.get("collectionHeader"),
|
||||
this
|
||||
);
|
||||
this.set("collectionHeaderComputedContent", collectionHeaderComputedContent);
|
||||
},
|
||||
|
||||
_setHeaderComputedContent() {
|
||||
const headerComputedContent = applyHeaderContentPluginApiCallbacks(
|
||||
this.get("pluginApiIdentifiers"),
|
||||
|
||||
@@ -26,6 +26,7 @@ export default SelectKitComponent.extend({
|
||||
|
||||
if (this.get("allowInitialValueMutation")) this.mutateAttributes();
|
||||
|
||||
this._setCollectionHeaderComputedContent();
|
||||
this._setHeaderComputedContent();
|
||||
});
|
||||
},
|
||||
@@ -36,6 +37,7 @@ export default SelectKitComponent.extend({
|
||||
run.next(() => {
|
||||
this.mutateContent(this.get("computedContent"));
|
||||
this.mutateValue(this.get("computedValue"));
|
||||
this._setCollectionHeaderComputedContent();
|
||||
this._setHeaderComputedContent();
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user