2021-07-14 00:22:39 +08:00
|
|
|
import { computed } from "@ember/object";
|
2021-07-08 15:46:21 +08:00
|
|
|
import ComboBoxComponent from "select-kit/components/combo-box";
|
|
|
|
|
|
|
|
export default ComboBoxComponent.extend({
|
|
|
|
pluginApiIdentifiers: ["flair-chooser"],
|
|
|
|
classNames: ["flair-chooser"],
|
|
|
|
|
|
|
|
selectKitOptions: {
|
|
|
|
selectedNameComponent: "selected-flair",
|
|
|
|
},
|
|
|
|
|
|
|
|
modifyComponentForRow() {
|
|
|
|
return "flair-row";
|
|
|
|
},
|
2021-07-14 00:22:39 +08:00
|
|
|
|
|
|
|
selectedContent: computed(
|
|
|
|
"value",
|
|
|
|
"content.[]",
|
|
|
|
"selectKit.noneItem",
|
|
|
|
function () {
|
|
|
|
const content = (this.content || []).findBy(
|
|
|
|
this.selectKit.valueProperty,
|
|
|
|
this.value
|
|
|
|
);
|
|
|
|
|
|
|
|
if (content) {
|
|
|
|
return this.selectKit.modifySelection(content);
|
|
|
|
} else {
|
|
|
|
return this.selectKit.noneItem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
),
|
2021-07-08 15:46:21 +08:00
|
|
|
});
|