@descope/web-components-ui 1.0.260 → 1.0.261
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +11 -2
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +11 -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 +11 -2
package/dist/index.esm.js
CHANGED
@@ -7627,17 +7627,26 @@ const multiSelectComboBoxMixin = (superclass) =>
|
|
7627
7627
|
});
|
7628
7628
|
}
|
7629
7629
|
|
7630
|
+
// To prevent duplicate items for the multi select options, we dedup them based on the "data-id" attribute
|
7631
|
+
// eslint-disable-next-line class-methods-use-this
|
7632
|
+
#dedupItems(items) {
|
7633
|
+
return Array.from(
|
7634
|
+
new Map(items.map((item) => [item.getAttribute('data-id'), item])).values()
|
7635
|
+
);
|
7636
|
+
}
|
7637
|
+
|
7630
7638
|
// vaadin api is to set props on their combo box node,
|
7631
7639
|
// in order to avoid it, we are passing the children of this component
|
7632
7640
|
// to the items & renderer props, so it will be used as the combo box items
|
7633
7641
|
#onChildrenChange() {
|
7634
7642
|
const items = Array.from(this.children);
|
7643
|
+
const dedupItems = this.#dedupItems(items);
|
7635
7644
|
|
7636
7645
|
// we want the data-name attribute to be accessible as an object attribute
|
7637
7646
|
if (items.length) {
|
7638
7647
|
this.removeAttribute('has-no-options');
|
7639
7648
|
|
7640
|
-
|
7649
|
+
dedupItems.forEach((node) => {
|
7641
7650
|
Object.defineProperty(node, 'data-name', {
|
7642
7651
|
value: node.getAttribute('data-name'),
|
7643
7652
|
configurable: true,
|
@@ -7650,7 +7659,7 @@ const multiSelectComboBoxMixin = (superclass) =>
|
|
7650
7659
|
});
|
7651
7660
|
});
|
7652
7661
|
|
7653
|
-
this.baseElement.items =
|
7662
|
+
this.baseElement.items = dedupItems;
|
7654
7663
|
|
7655
7664
|
setTimeout(() => {
|
7656
7665
|
// set timeout to ensure this runs after customValueTransformFn had the chance to be overriden
|