@descope/web-components-ui 1.0.245 → 1.0.246
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +27 -16
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +27 -16
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/1000.js +1 -1
- package/package.json +1 -1
- package/src/components/descope-multi-select-combo-box/MultiSelectComboBoxClass.js +2 -2
- package/src/mixins/portalMixin.js +26 -15
package/dist/cjs/index.cjs.js
CHANGED
@@ -2188,10 +2188,11 @@ const DISPLAY_NAME_SEPARATOR = '_';
|
|
2188
2188
|
|
2189
2189
|
const sanitizeSelector = (selector) => selector.replace(/[^\w\s]/gi, '');
|
2190
2190
|
|
2191
|
-
const withWaitForShadowRoot = (getRootElementFn) => (that) =>
|
2192
|
-
|
2191
|
+
const withWaitForShadowRoot = (getRootElementFn) => async (that) => {
|
2192
|
+
const ele = await getRootElementFn(that);
|
2193
|
+
|
2194
|
+
return new Promise((res) => {
|
2193
2195
|
const MAX_RETRIES = 20;
|
2194
|
-
const ele = getRootElementFn(that);
|
2195
2196
|
let counter = 0;
|
2196
2197
|
|
2197
2198
|
const check = () => {
|
@@ -2204,11 +2205,12 @@ const withWaitForShadowRoot = (getRootElementFn) => (that) =>
|
|
2204
2205
|
|
2205
2206
|
counter++;
|
2206
2207
|
|
2207
|
-
if (!ele
|
2208
|
+
if (!ele?.shadowRoot) setTimeout(check);
|
2208
2209
|
else res(ele.shadowRoot);
|
2209
2210
|
};
|
2210
2211
|
check();
|
2211
2212
|
});
|
2213
|
+
};
|
2212
2214
|
|
2213
2215
|
const portalMixin =
|
2214
2216
|
({ name, selector, mappings = {}, forward: { attributes = [], include = true } = {} }) =>
|
@@ -2234,35 +2236,44 @@ const portalMixin =
|
|
2234
2236
|
|
2235
2237
|
constructor() {
|
2236
2238
|
// we cannot use "this" before calling "super"
|
2237
|
-
const getRootElement = (that) => {
|
2239
|
+
const getRootElement = async (that) => {
|
2238
2240
|
const baseEle = that.shadowRoot.querySelector(that.baseSelector);
|
2239
|
-
|
2241
|
+
if (!selector) {
|
2242
|
+
return baseEle;
|
2243
|
+
}
|
2240
2244
|
|
2241
|
-
|
2245
|
+
// in case we have a selector, we should first wait for the base element shadow root
|
2246
|
+
// and then look for the internal element
|
2247
|
+
const baseEleShadowRoot = await withWaitForShadowRoot(() => baseEle)(that);
|
2248
|
+
return baseEleShadowRoot.querySelector(selector);
|
2242
2249
|
};
|
2243
2250
|
|
2251
|
+
const getPortalElement = withWaitForShadowRoot(getRootElement);
|
2252
|
+
|
2244
2253
|
super({
|
2245
|
-
getRootElement:
|
2254
|
+
getRootElement: getPortalElement,
|
2246
2255
|
componentNameSuffix: DISPLAY_NAME_SEPARATOR + eleDisplayName,
|
2247
2256
|
themeSection: PORTAL_THEME_PREFIX + eleDisplayName,
|
2248
2257
|
baseSelector: ':host',
|
2249
2258
|
});
|
2250
2259
|
|
2251
|
-
this.#portalEle =
|
2260
|
+
this.#portalEle = getPortalElement(this).then((ele) => ele.host);
|
2252
2261
|
}
|
2253
2262
|
|
2254
|
-
#handleHoverAttribute() {
|
2255
|
-
|
2263
|
+
async #handleHoverAttribute() {
|
2264
|
+
const portalEle = await this.#portalEle;
|
2265
|
+
portalEle.onmouseenter = (e) => {
|
2256
2266
|
e.target.setAttribute('hover', 'true');
|
2257
2267
|
};
|
2258
|
-
|
2268
|
+
portalEle.onmouseleave = (e) => {
|
2259
2269
|
e.target.removeAttribute('hover');
|
2260
2270
|
};
|
2261
2271
|
}
|
2262
2272
|
|
2263
|
-
init() {
|
2273
|
+
async init() {
|
2264
2274
|
super.init?.();
|
2265
|
-
|
2275
|
+
const portalEle = await this.#portalEle;
|
2276
|
+
forwardAttrs(this, portalEle, {
|
2266
2277
|
[include ? 'includeAttrs' : 'excludeAttrs']: attributes,
|
2267
2278
|
});
|
2268
2279
|
|
@@ -8678,7 +8689,7 @@ var notificationCard = /*#__PURE__*/Object.freeze({
|
|
8678
8689
|
|
8679
8690
|
const componentName$3 = getComponentName('multi-select-combo-box');
|
8680
8691
|
|
8681
|
-
const
|
8692
|
+
const multiSelectComboBoxMixin = (superclass) =>
|
8682
8693
|
class MultiSelectComboBoxMixinClass extends superclass {
|
8683
8694
|
// eslint-disable-next-line class-methods-use-this
|
8684
8695
|
#renderItem = ({ displayName, value, label }) => {
|
@@ -9101,7 +9112,7 @@ const MultiSelectComboBoxClass = compose(
|
|
9101
9112
|
}),
|
9102
9113
|
composedProxyInputMixin({ proxyProps: ['selectionStart'], inputEvent: 'selected-items-changed' }),
|
9103
9114
|
componentNameValidationMixin,
|
9104
|
-
|
9115
|
+
multiSelectComboBoxMixin
|
9105
9116
|
)(
|
9106
9117
|
createProxy({
|
9107
9118
|
slots: ['', 'prefix'],
|