@descope/web-components-ui 1.0.260 → 1.0.262
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +14 -3
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +14 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/1000.js +1 -1
- package/dist/umd/descope-grid-index-js.js +1 -1
- package/dist/umd/descope-multi-select-combo-box-index-js.js +1 -1
- package/package.json +1 -1
- package/src/components/descope-grid/GridClass.js +1 -0
- package/src/components/descope-multi-select-combo-box/MultiSelectComboBoxClass.js +11 -2
- package/src/mixins/createProxy.js +2 -1
package/dist/index.esm.js
CHANGED
@@ -701,6 +701,7 @@ const createProxy = ({
|
|
701
701
|
excludeAttrsSync = [],
|
702
702
|
includeAttrsSync = [],
|
703
703
|
includeForwardProps = [],
|
704
|
+
delegatesFocus = true,
|
704
705
|
}) => {
|
705
706
|
class ProxyClass extends createBaseClass({ componentName, baseSelector: wrappedEleName }) {
|
706
707
|
#dispatchBlur = createDispatchEvent.bind(this, 'blur');
|
@@ -708,7 +709,7 @@ const createProxy = ({
|
|
708
709
|
#dispatchFocus = createDispatchEvent.bind(this, 'focus');
|
709
710
|
|
710
711
|
constructor() {
|
711
|
-
super().attachShadow({ mode: 'open', delegatesFocus
|
712
|
+
super().attachShadow({ mode: 'open', delegatesFocus }).innerHTML = `
|
712
713
|
<style id="create-proxy">${isFunction(style) ? style() : style}</style>
|
713
714
|
<${wrappedEleName}>
|
714
715
|
${slots
|
@@ -7458,6 +7459,7 @@ const GridClass = compose(
|
|
7458
7459
|
GridMixin
|
7459
7460
|
)(
|
7460
7461
|
createProxy({
|
7462
|
+
delegatesFocus: false,
|
7461
7463
|
slots: [''],
|
7462
7464
|
wrappedEleName: 'vaadin-grid',
|
7463
7465
|
style: () => `
|
@@ -7627,17 +7629,26 @@ const multiSelectComboBoxMixin = (superclass) =>
|
|
7627
7629
|
});
|
7628
7630
|
}
|
7629
7631
|
|
7632
|
+
// To prevent duplicate items for the multi select options, we dedup them based on the "data-id" attribute
|
7633
|
+
// eslint-disable-next-line class-methods-use-this
|
7634
|
+
#dedupItems(items) {
|
7635
|
+
return Array.from(
|
7636
|
+
new Map(items.map((item) => [item.getAttribute('data-id'), item])).values()
|
7637
|
+
);
|
7638
|
+
}
|
7639
|
+
|
7630
7640
|
// vaadin api is to set props on their combo box node,
|
7631
7641
|
// in order to avoid it, we are passing the children of this component
|
7632
7642
|
// to the items & renderer props, so it will be used as the combo box items
|
7633
7643
|
#onChildrenChange() {
|
7634
7644
|
const items = Array.from(this.children);
|
7645
|
+
const dedupItems = this.#dedupItems(items);
|
7635
7646
|
|
7636
7647
|
// we want the data-name attribute to be accessible as an object attribute
|
7637
7648
|
if (items.length) {
|
7638
7649
|
this.removeAttribute('has-no-options');
|
7639
7650
|
|
7640
|
-
|
7651
|
+
dedupItems.forEach((node) => {
|
7641
7652
|
Object.defineProperty(node, 'data-name', {
|
7642
7653
|
value: node.getAttribute('data-name'),
|
7643
7654
|
configurable: true,
|
@@ -7650,7 +7661,7 @@ const multiSelectComboBoxMixin = (superclass) =>
|
|
7650
7661
|
});
|
7651
7662
|
});
|
7652
7663
|
|
7653
|
-
this.baseElement.items =
|
7664
|
+
this.baseElement.items = dedupItems;
|
7654
7665
|
|
7655
7666
|
setTimeout(() => {
|
7656
7667
|
// set timeout to ensure this runs after customValueTransformFn had the chance to be overriden
|