@descope/web-components-ui 1.0.362 → 1.0.364
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +21 -10
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +21 -28
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/descope-grid-index-js.js +1 -1
- package/dist/umd/descope-passcode-descope-passcode-internal-index-js.js +1 -1
- package/dist/umd/descope-passcode-index-js.js +1 -1
- package/package.json +1 -1
- package/src/components/descope-grid/GridClass.js +2 -2
- package/src/components/descope-grid/helpers.js +19 -8
- package/src/components/descope-passcode/descope-passcode-internal/PasscodeInternal.js +0 -18
package/dist/index.esm.js
CHANGED
@@ -3071,18 +3071,9 @@ class PasscodeInternal extends BaseInputClass$7 {
|
|
3071
3071
|
}
|
3072
3072
|
|
3073
3073
|
initInputs() {
|
3074
|
-
let currentInput;
|
3075
|
-
|
3076
3074
|
this.inputs.forEach((input) => {
|
3077
3075
|
input.shadowRoot.appendChild(createInputMaskStyle());
|
3078
3076
|
|
3079
|
-
input.addEventListener('change', (e) => {
|
3080
|
-
if (currentInput !== e.target) {
|
3081
|
-
this.parseInputValue(input, input.value);
|
3082
|
-
this.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
|
3083
|
-
}
|
3084
|
-
});
|
3085
|
-
|
3086
3077
|
const handleParseInput = (val) => {
|
3087
3078
|
this.parseInputValue(input, val);
|
3088
3079
|
toggleMaskVisibility(input);
|
@@ -3098,16 +3089,7 @@ class PasscodeInternal extends BaseInputClass$7 {
|
|
3098
3089
|
toggleMaskVisibility(input, input.value[0]);
|
3099
3090
|
}
|
3100
3091
|
|
3101
|
-
// when using iPhone's code autofill we get only `change` events.
|
3102
|
-
// In other scenarios we get `input` AND `change` events.
|
3103
|
-
// In order to be parse the digits properly in iPhone, we need to listen to `change` event
|
3104
|
-
// and validate it was not preceeded by an `input` event.
|
3105
|
-
// To do so, we're keeping a reference to the input element in `input` events,
|
3106
|
-
// and only if there the reference is null, then we're assuming no `input` event was preceeding,
|
3107
|
-
// and we're parsing the digits.
|
3108
|
-
currentInput = e.target;
|
3109
3092
|
setTimeout(() => {
|
3110
|
-
currentInput = null;
|
3111
3093
|
if (e?.inputType === 'deleteContentBackward') {
|
3112
3094
|
focusElement(this.getPrevInput(input));
|
3113
3095
|
}
|
@@ -8783,33 +8765,44 @@ const isValidDataType = (data) => {
|
|
8783
8765
|
|
8784
8766
|
const isPlainObject = (value) => value?.constructor === Object;
|
8785
8767
|
|
8768
|
+
const isXml = (str) => /^\s*<[\s\S]*>/.test(str);
|
8769
|
+
|
8770
|
+
const escapeXML = (s) => {
|
8771
|
+
const dom = document.createElement('div');
|
8772
|
+
dom.textContent = s;
|
8773
|
+
return dom.innerHTML;
|
8774
|
+
};
|
8775
|
+
|
8786
8776
|
const getValueType = (value) => {
|
8787
8777
|
if (isPlainObject(value)) return 'object';
|
8788
8778
|
if (Array.isArray(value)) return 'array';
|
8779
|
+
if (isXml(value)) return 'xml';
|
8789
8780
|
|
8790
8781
|
return 'text';
|
8791
8782
|
};
|
8792
8783
|
|
8793
|
-
const renderCodeSnippet = (value) =>
|
8794
|
-
`<descope-code-snippet lang="
|
8795
|
-
value,
|
8796
|
-
null,
|
8797
|
-
2
|
8798
|
-
)}</descope-code-snippet>`;
|
8784
|
+
const renderCodeSnippet = (value, lang) =>
|
8785
|
+
`<descope-code-snippet lang="${lang}" class="row-details__value code">${value}</descope-code-snippet>`;
|
8799
8786
|
|
8800
8787
|
const renderText = (text) =>
|
8801
8788
|
`<div class="row-details__value text" title="${text}">${text}</div>`;
|
8789
|
+
const renderJson = (value) => renderCodeSnippet(JSON.stringify(value, null, 2), 'json');
|
8790
|
+
const renderXml = (value) => renderCodeSnippet(escapeXML(value), 'xml');
|
8802
8791
|
|
8803
8792
|
const defaultRowDetailsValueRenderer = (value) => {
|
8804
8793
|
const valueType = getValueType(value);
|
8805
8794
|
|
8806
8795
|
if (valueType === 'object') {
|
8807
|
-
return
|
8796
|
+
return renderJson(value);
|
8797
|
+
}
|
8798
|
+
|
8799
|
+
if (valueType === 'xml') {
|
8800
|
+
return renderXml(value);
|
8808
8801
|
}
|
8809
8802
|
|
8810
8803
|
if (valueType === 'array') {
|
8811
8804
|
if (value.some((v) => getValueType(v) === 'object')) {
|
8812
|
-
return
|
8805
|
+
return renderJson(value);
|
8813
8806
|
}
|
8814
8807
|
return renderText(value.join(',\n'));
|
8815
8808
|
}
|
@@ -9166,7 +9159,7 @@ const GridClass = compose(
|
|
9166
9159
|
grid-template-columns: repeat(auto-fit, minmax(max(200px, calc(100%/4 - var(${GridClass.cssVarList.detailsPanelItemsGap}))), 1fr));
|
9167
9160
|
width: 100%;
|
9168
9161
|
}
|
9169
|
-
vaadin-grid .row-details__item:has(.row-details__value.
|
9162
|
+
vaadin-grid .row-details__item:has(.row-details__value.code) {
|
9170
9163
|
grid-column: 1 / -1;
|
9171
9164
|
order: 2;
|
9172
9165
|
}
|
@@ -9175,7 +9168,7 @@ const GridClass = compose(
|
|
9175
9168
|
text-overflow: ellipsis;
|
9176
9169
|
white-space: pre;
|
9177
9170
|
}
|
9178
|
-
vaadin-grid .row-details__value.
|
9171
|
+
vaadin-grid .row-details__value.code {
|
9179
9172
|
margin-top: 5px;
|
9180
9173
|
max-height: 120px;
|
9181
9174
|
overflow: scroll;
|