2021-08-23 16:44:19 +08:00
|
|
|
import Component from "@ember/component";
|
|
|
|
import { computed } from "@ember/object";
|
2023-10-11 02:38:59 +08:00
|
|
|
import { guidFor } from "@ember/object/internals";
|
2021-08-23 16:44:19 +08:00
|
|
|
import UtilsMixin from "select-kit/mixins/utils";
|
|
|
|
|
|
|
|
export default Component.extend(UtilsMixin, {
|
|
|
|
tagName: "",
|
|
|
|
item: null,
|
|
|
|
selectKit: null,
|
|
|
|
extraClass: null,
|
|
|
|
id: null,
|
|
|
|
|
|
|
|
init() {
|
|
|
|
this._super(...arguments);
|
|
|
|
|
|
|
|
this.set("id", guidFor(this));
|
|
|
|
},
|
|
|
|
|
|
|
|
itemValue: computed("item", function () {
|
|
|
|
return this.getValue(this.item);
|
|
|
|
}),
|
|
|
|
|
|
|
|
itemName: computed("item", function () {
|
|
|
|
return this.getName(this.item);
|
|
|
|
}),
|
2024-04-18 06:53:52 +08:00
|
|
|
|
|
|
|
mandatoryValuesArray: computed("item", function () {
|
|
|
|
return this.get("mandatoryValues")?.split("|") || [];
|
|
|
|
}),
|
|
|
|
|
|
|
|
readOnly: computed("item", function () {
|
|
|
|
return this.mandatoryValuesArray.includes(this.item.id);
|
|
|
|
}),
|
2021-08-23 16:44:19 +08:00
|
|
|
});
|