2017-11-21 18:53:09 +08:00
|
|
|
import SelectKitHeaderComponent from "select-kit/components/select-kit/select-kit-header";
|
2020-02-03 21:22:14 +08:00
|
|
|
import { computed } from "@ember/object";
|
2020-02-19 07:57:58 +08:00
|
|
|
import { makeArray } from "discourse-common/lib/helpers";
|
2017-10-20 03:51:08 +08:00
|
|
|
|
2017-11-21 18:53:09 +08:00
|
|
|
export default SelectKitHeaderComponent.extend({
|
2020-02-03 21:22:14 +08:00
|
|
|
classNames: ["multi-select-header"],
|
2017-11-21 18:53:09 +08:00
|
|
|
layoutName:
|
|
|
|
"select-kit/templates/components/multi-select/multi-select-header",
|
2017-10-20 03:51:08 +08:00
|
|
|
|
2020-02-03 21:22:14 +08:00
|
|
|
selectedNames: computed("selectedContent", function() {
|
2020-02-19 07:57:58 +08:00
|
|
|
return makeArray(this.selectedContent).map(c => this.getName(c));
|
2020-02-03 21:22:14 +08:00
|
|
|
}),
|
|
|
|
|
|
|
|
selectedValue: computed("selectedContent", function() {
|
2020-02-19 07:57:58 +08:00
|
|
|
return makeArray(this.selectedContent)
|
2020-02-03 21:22:14 +08:00
|
|
|
.map(c => {
|
|
|
|
if (this.getName(c) !== this.getName(this.selectKit.noneItem)) {
|
|
|
|
return this.getValue(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
})
|
|
|
|
.filter(Boolean);
|
|
|
|
})
|
2017-10-20 03:51:08 +08:00
|
|
|
});
|