@descope/web-components-ui 1.0.256 → 1.0.257
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs.js +29 -2
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +29 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/descope-multi-select-combo-box-index-js.js +1 -1
- package/package.json +1 -1
- package/src/components/descope-multi-select-combo-box/MultiSelectComboBoxClass.js +29 -2
package/dist/index.esm.js
CHANGED
@@ -7535,7 +7535,7 @@ const multiSelectComboBoxMixin = (superclass) =>
|
|
7535
7535
|
}
|
7536
7536
|
}
|
7537
7537
|
|
7538
|
-
get
|
7538
|
+
get allowCustomValues() {
|
7539
7539
|
return this.getAttribute('allow-custom-value') === 'true';
|
7540
7540
|
}
|
7541
7541
|
|
@@ -7674,7 +7674,7 @@ const multiSelectComboBoxMixin = (superclass) =>
|
|
7674
7674
|
}
|
7675
7675
|
|
7676
7676
|
#handleCustomValues() {
|
7677
|
-
if (this.
|
7677
|
+
if (this.allowCustomValues) {
|
7678
7678
|
this.baseElement.addEventListener('custom-value-set', (e) => {
|
7679
7679
|
const newItemHtml = this.#renderItem({
|
7680
7680
|
label: e.detail,
|
@@ -7782,6 +7782,33 @@ const multiSelectComboBoxMixin = (superclass) =>
|
|
7782
7782
|
const selectedChildren = this.baseElement.items?.filter((item) =>
|
7783
7783
|
vals.includes(item['data-id'])
|
7784
7784
|
);
|
7785
|
+
|
7786
|
+
// If the component allows custom values, we need to add the values that are not present in the children
|
7787
|
+
if (this.allowCustomValues) {
|
7788
|
+
const existingValues =
|
7789
|
+
selectedChildren?.map((child) => child.getAttribute('data-id')) || [];
|
7790
|
+
const missingValues = vals.filter((val) => !existingValues.includes(val));
|
7791
|
+
|
7792
|
+
if (missingValues.length) {
|
7793
|
+
const newItemsHtml = missingValues.reduce((acc, val) => {
|
7794
|
+
const newItemHtml = this.#renderItem({
|
7795
|
+
label: val,
|
7796
|
+
displayName: val,
|
7797
|
+
value: val,
|
7798
|
+
});
|
7799
|
+
return acc + newItemHtml;
|
7800
|
+
}, '');
|
7801
|
+
this.innerHTML += newItemsHtml;
|
7802
|
+
|
7803
|
+
// The value needs to be set with a timeout because it needs to execute after
|
7804
|
+
// the custom values are added to the items by the children change observer
|
7805
|
+
setTimeout(() => {
|
7806
|
+
this.value = vals;
|
7807
|
+
}, 0);
|
7808
|
+
return;
|
7809
|
+
}
|
7810
|
+
}
|
7811
|
+
|
7785
7812
|
const newSelectedValues =
|
7786
7813
|
selectedChildren?.map((child) => child.getAttribute('data-id')) || [];
|
7787
7814
|
if (!compareArraysUnordered(this.#value, newSelectedValues)) {
|