@descope/web-components-ui 1.0.255 → 1.0.257
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +30 -3
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +30 -3
- 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/src/theme/components/modal.js +1 -1
package/dist/cjs/index.cjs.js
CHANGED
@@ -8505,7 +8505,7 @@ const compVars = ModalClass.cssVarList;
|
|
8505
8505
|
|
8506
8506
|
const modal = {
|
8507
8507
|
[compVars.overlayBackgroundColor]: globalRefs$4.colors.surface.light,
|
8508
|
-
[compVars.overlayShadow]: '
|
8508
|
+
[compVars.overlayShadow]: globalRefs$4.shadow.wide['2xl'],
|
8509
8509
|
[compVars.overlayWidth]: '700px',
|
8510
8510
|
};
|
8511
8511
|
|
@@ -9039,7 +9039,7 @@ const multiSelectComboBoxMixin = (superclass) =>
|
|
9039
9039
|
}
|
9040
9040
|
}
|
9041
9041
|
|
9042
|
-
get
|
9042
|
+
get allowCustomValues() {
|
9043
9043
|
return this.getAttribute('allow-custom-value') === 'true';
|
9044
9044
|
}
|
9045
9045
|
|
@@ -9178,7 +9178,7 @@ const multiSelectComboBoxMixin = (superclass) =>
|
|
9178
9178
|
}
|
9179
9179
|
|
9180
9180
|
#handleCustomValues() {
|
9181
|
-
if (this.
|
9181
|
+
if (this.allowCustomValues) {
|
9182
9182
|
this.baseElement.addEventListener('custom-value-set', (e) => {
|
9183
9183
|
const newItemHtml = this.#renderItem({
|
9184
9184
|
label: e.detail,
|
@@ -9286,6 +9286,33 @@ const multiSelectComboBoxMixin = (superclass) =>
|
|
9286
9286
|
const selectedChildren = this.baseElement.items?.filter((item) =>
|
9287
9287
|
vals.includes(item['data-id'])
|
9288
9288
|
);
|
9289
|
+
|
9290
|
+
// If the component allows custom values, we need to add the values that are not present in the children
|
9291
|
+
if (this.allowCustomValues) {
|
9292
|
+
const existingValues =
|
9293
|
+
selectedChildren?.map((child) => child.getAttribute('data-id')) || [];
|
9294
|
+
const missingValues = vals.filter((val) => !existingValues.includes(val));
|
9295
|
+
|
9296
|
+
if (missingValues.length) {
|
9297
|
+
const newItemsHtml = missingValues.reduce((acc, val) => {
|
9298
|
+
const newItemHtml = this.#renderItem({
|
9299
|
+
label: val,
|
9300
|
+
displayName: val,
|
9301
|
+
value: val,
|
9302
|
+
});
|
9303
|
+
return acc + newItemHtml;
|
9304
|
+
}, '');
|
9305
|
+
this.innerHTML += newItemsHtml;
|
9306
|
+
|
9307
|
+
// The value needs to be set with a timeout because it needs to execute after
|
9308
|
+
// the custom values are added to the items by the children change observer
|
9309
|
+
setTimeout(() => {
|
9310
|
+
this.value = vals;
|
9311
|
+
}, 0);
|
9312
|
+
return;
|
9313
|
+
}
|
9314
|
+
}
|
9315
|
+
|
9289
9316
|
const newSelectedValues =
|
9290
9317
|
selectedChildren?.map((child) => child.getAttribute('data-id')) || [];
|
9291
9318
|
if (!compareArraysUnordered(this.#value, newSelectedValues)) {
|