FIX: ensures minimum tags logic is correct and shared (#14723)

Also fixes a bug where select-kit was not updating noneItem in multi-selects.
This commit is contained in:
Joffrey JAFFEUX
2021-11-12 14:04:48 +01:00
committed by GitHub
parent 362c47ce6a
commit 904d509cce
12 changed files with 124 additions and 87 deletions

View File

@@ -124,35 +124,40 @@ export default SelectKitComponent.extend({
}
},
selectedContent: computed("value.[]", "content.[]", function () {
const value = makeArray(this.value).map((v) =>
this.selectKit.options.castInteger && this._isNumeric(v) ? Number(v) : v
);
selectedContent: computed(
"value.[]",
"content.[]",
"selectKit.noneItem",
function () {
const value = makeArray(this.value).map((v) =>
this.selectKit.options.castInteger && this._isNumeric(v) ? Number(v) : v
);
if (value.length) {
let content = [];
if (value.length) {
let content = [];
value.forEach((v) => {
if (this.selectKit.valueProperty) {
const c = makeArray(this.content).findBy(
this.selectKit.valueProperty,
v
);
if (c) {
content.push(c);
value.forEach((v) => {
if (this.selectKit.valueProperty) {
const c = makeArray(this.content).findBy(
this.selectKit.valueProperty,
v
);
if (c) {
content.push(c);
}
} else {
if (makeArray(this.content).includes(v)) {
content.push(v);
}
}
} else {
if (makeArray(this.content).includes(v)) {
content.push(v);
}
}
});
});
return this.selectKit.modifySelection(content);
return this.selectKit.modifySelection(content);
}
return this.selectKit.noneItem;
}
return null;
}),
),
_onKeydown(event) {
if (