@descope/web-components-ui 1.0.369 → 1.0.370
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 +61 -9
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +61 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/7856.js +2 -0
- package/dist/umd/7856.js.LICENSE.txt +1 -0
- package/dist/umd/DescopeDev.js +2 -1
- package/dist/umd/DescopeDev.js.LICENSE.txt +1 -0
- package/dist/umd/button-selection-group-fields-descope-button-multi-selection-group-index-js.js +1 -1
- package/dist/umd/button-selection-group-fields-descope-button-selection-group-index-js.js +1 -1
- package/dist/umd/button-selection-group-fields-descope-button-selection-group-item-index-js.js +1 -1
- package/dist/umd/descope-apps-list-index-js.js +1 -1
- package/dist/umd/descope-button-index-js.js +1 -1
- package/dist/umd/descope-icon-index-js.js +1 -1
- package/dist/umd/descope-list-index-js.js +1 -1
- package/dist/umd/descope-upload-file-index-js.js +1 -1
- package/dist/umd/descope-user-attribute-index-js.js +1 -1
- package/dist/umd/descope-user-auth-method-index-js.js +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
- package/package.json +2 -1
- package/src/components/descope-apps-list/AppsListClass.js +5 -6
- package/src/components/descope-icon/helpers.js +6 -1
- package/src/components/descope-list/ListClass.js +15 -1
- package/src/mixins/createDynamicDataMixin.js +36 -1
package/dist/index.esm.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import '@vaadin/button';
|
2
2
|
import 'element-internals-polyfill';
|
3
|
+
import DOMPurify from 'dompurify';
|
3
4
|
import '@vaadin/checkbox';
|
4
5
|
import '@vaadin/text-field';
|
5
6
|
import '@vaadin/email-field';
|
@@ -1412,8 +1413,11 @@ const createImgEle = (src) => {
|
|
1412
1413
|
};
|
1413
1414
|
|
1414
1415
|
const createSvgEle = (text) => {
|
1416
|
+
// we want to purify the SVG to avoid XSS attacks
|
1417
|
+
const clean = DOMPurify.sanitize(text, { USE_PROFILES: { svg: true, svgFilters: true } });
|
1418
|
+
|
1415
1419
|
const parser = new DOMParser();
|
1416
|
-
const ele = parser.parseFromString(
|
1420
|
+
const ele = parser.parseFromString(clean, 'image/svg+xml').querySelector('svg');
|
1417
1421
|
return ele;
|
1418
1422
|
};
|
1419
1423
|
|
@@ -11954,7 +11958,7 @@ const componentName$2 = getComponentName('list');
|
|
11954
11958
|
|
11955
11959
|
class RawList extends createBaseClass({ componentName: componentName$2, baseSelector: '.wrapper' }) {
|
11956
11960
|
static get observedAttributes() {
|
11957
|
-
return ['variant'];
|
11961
|
+
return ['variant', 'readonly'];
|
11958
11962
|
}
|
11959
11963
|
|
11960
11964
|
constructor() {
|
@@ -12037,6 +12041,18 @@ class RawList extends createBaseClass({ componentName: componentName$2, baseSele
|
|
12037
12041
|
observeChildren(this, () => {
|
12038
12042
|
this.#handleEmptyState();
|
12039
12043
|
this.#handleItemsVariant();
|
12044
|
+
this.#handleReadOnly();
|
12045
|
+
});
|
12046
|
+
}
|
12047
|
+
|
12048
|
+
get isReadOnly() {
|
12049
|
+
return this.getAttribute('readonly') === 'true';
|
12050
|
+
}
|
12051
|
+
|
12052
|
+
#handleReadOnly() {
|
12053
|
+
this.items.forEach((item) => {
|
12054
|
+
if (this.isReadOnly) item.setAttribute('inert', '');
|
12055
|
+
else item.removeAttribute('inert');
|
12040
12056
|
});
|
12041
12057
|
}
|
12042
12058
|
|
@@ -12047,6 +12063,8 @@ class RawList extends createBaseClass({ componentName: componentName$2, baseSele
|
|
12047
12063
|
|
12048
12064
|
if (name === 'variant') {
|
12049
12065
|
this.#handleItemsVariant();
|
12066
|
+
} else if (name === 'readonly') {
|
12067
|
+
this.#handleReadOnly();
|
12050
12068
|
}
|
12051
12069
|
}
|
12052
12070
|
}
|
@@ -12164,16 +12182,51 @@ const createDynamicDataMixin =
|
|
12164
12182
|
super.init?.();
|
12165
12183
|
|
12166
12184
|
if (rerenderAttrsList.length) {
|
12167
|
-
observeAttributes(
|
12185
|
+
observeAttributes(
|
12186
|
+
this,
|
12187
|
+
(attrs) => {
|
12188
|
+
if (attrs.includes('data')) this.#handleDataAttr();
|
12189
|
+
if (attrs.some((attr) => attr !== 'data')) this.#renderItems();
|
12190
|
+
},
|
12191
|
+
{ includeAttrs: [...rerenderAttrsList, 'data'] }
|
12192
|
+
);
|
12168
12193
|
} else {
|
12169
12194
|
this.#renderItems();
|
12170
12195
|
}
|
12171
12196
|
}
|
12197
|
+
|
12198
|
+
#handleDataAttr() {
|
12199
|
+
const dataAttr = this.getAttribute('data');
|
12200
|
+
|
12201
|
+
if (!dataAttr) return;
|
12202
|
+
|
12203
|
+
try {
|
12204
|
+
this.#data = JSON.parse(dataAttr);
|
12205
|
+
} catch (e) {
|
12206
|
+
// eslint-disable-next-line no-console
|
12207
|
+
console.warn('Invalid JSON data', dataAttr);
|
12208
|
+
}
|
12209
|
+
}
|
12210
|
+
|
12211
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
12212
|
+
super.attributeChangedCallback?.(name, oldValue, newValue);
|
12213
|
+
|
12214
|
+
if (newValue === oldValue) return;
|
12215
|
+
|
12216
|
+
if (name === 'data') {
|
12217
|
+
try {
|
12218
|
+
this.data = JSON.parse(newValue);
|
12219
|
+
} catch (e) {
|
12220
|
+
// eslint-disable-next-line no-console
|
12221
|
+
console.warn('Invalid JSON data', newValue);
|
12222
|
+
}
|
12223
|
+
}
|
12224
|
+
}
|
12172
12225
|
};
|
12173
12226
|
|
12174
12227
|
const componentName$1 = getComponentName('apps-list');
|
12175
12228
|
|
12176
|
-
const limitAbbreviation = (str, limit =
|
12229
|
+
const limitAbbreviation = (str, limit = 2) =>
|
12177
12230
|
str
|
12178
12231
|
.trim()
|
12179
12232
|
.split(' ')
|
@@ -12182,12 +12235,11 @@ const limitAbbreviation = (str, limit = 3) =>
|
|
12182
12235
|
.join('');
|
12183
12236
|
|
12184
12237
|
const itemRenderer = ({ name, icon, url }, _, ref) => `
|
12185
|
-
<a href="${url}"
|
12238
|
+
<a ${url ? `href="${url}" title="${url}"` : ''} target="_blank">
|
12186
12239
|
<descope-list-item>
|
12187
12240
|
<descope-avatar
|
12188
|
-
img="${icon}"
|
12189
|
-
display-name="${name}"
|
12190
|
-
abbr=${limitAbbreviation(name)}
|
12241
|
+
${icon ? `img="${icon}"` : ''}
|
12242
|
+
${name ? `display-name="${name}" abbr=${limitAbbreviation(name)}` : ''}
|
12191
12243
|
size=${ref.size}
|
12192
12244
|
></descope-avatar>
|
12193
12245
|
<descope-text
|
@@ -12233,7 +12285,7 @@ const AppsListClass = compose(
|
|
12233
12285
|
createProxy({
|
12234
12286
|
slots: ['empty-state'],
|
12235
12287
|
wrappedEleName: 'descope-list',
|
12236
|
-
excludeAttrsSync: ['tabindex', 'class'],
|
12288
|
+
excludeAttrsSync: ['tabindex', 'class', 'empty'],
|
12237
12289
|
componentName: componentName$1,
|
12238
12290
|
style: () => `
|
12239
12291
|
:host {
|