@descope/web-components-ui 1.0.361 → 1.0.363

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.
@@ -3923,7 +3923,8 @@ const customMixin$8 = (superclass) =>
3923
3923
  init() {
3924
3924
  super.init?.();
3925
3925
 
3926
- this.setAttribute('pattern', defaultPattern);
3926
+ // we need to set the pattern on the base element because vaadin-email-field is overriding it
3927
+ this.baseElement.setAttribute('pattern', defaultPattern);
3927
3928
 
3928
3929
  if (!this.getAttribute('autocomplete')) {
3929
3930
  this.setAttribute('autocomplete', defaultAutocomplete);
@@ -9882,33 +9883,44 @@ const isValidDataType = (data) => {
9882
9883
 
9883
9884
  const isPlainObject = (value) => value?.constructor === Object;
9884
9885
 
9886
+ const isXml = (str) => /^\s*<[\s\S]*>/.test(str);
9887
+
9888
+ const escapeXML = (s) => {
9889
+ const dom = document.createElement('div');
9890
+ dom.textContent = s;
9891
+ return dom.innerHTML;
9892
+ };
9893
+
9885
9894
  const getValueType = (value) => {
9886
9895
  if (isPlainObject(value)) return 'object';
9887
9896
  if (Array.isArray(value)) return 'array';
9897
+ if (isXml(value)) return 'xml';
9888
9898
 
9889
9899
  return 'text';
9890
9900
  };
9891
9901
 
9892
- const renderCodeSnippet = (value) =>
9893
- `<descope-code-snippet lang="json" class="row-details__value json">${JSON.stringify(
9894
- value,
9895
- null,
9896
- 2
9897
- )}</descope-code-snippet>`;
9902
+ const renderCodeSnippet = (value, lang) =>
9903
+ `<descope-code-snippet lang="${lang}" class="row-details__value code">${value}</descope-code-snippet>`;
9898
9904
 
9899
9905
  const renderText = (text) =>
9900
9906
  `<div class="row-details__value text" title="${text}">${text}</div>`;
9907
+ const renderJson = (value) => renderCodeSnippet(JSON.stringify(value, null, 2), 'json');
9908
+ const renderXml = (value) => renderCodeSnippet(escapeXML(value), 'xml');
9901
9909
 
9902
9910
  const defaultRowDetailsValueRenderer = (value) => {
9903
9911
  const valueType = getValueType(value);
9904
9912
 
9905
9913
  if (valueType === 'object') {
9906
- return renderCodeSnippet(value);
9914
+ return renderJson(value);
9915
+ }
9916
+
9917
+ if (valueType === 'xml') {
9918
+ return renderXml(value);
9907
9919
  }
9908
9920
 
9909
9921
  if (valueType === 'array') {
9910
9922
  if (value.some((v) => getValueType(v) === 'object')) {
9911
- return renderCodeSnippet(value);
9923
+ return renderJson(value);
9912
9924
  }
9913
9925
  return renderText(value.join(',\n'));
9914
9926
  }
@@ -10265,7 +10277,7 @@ const GridClass = compose(
10265
10277
  grid-template-columns: repeat(auto-fit, minmax(max(200px, calc(100%/4 - var(${GridClass.cssVarList.detailsPanelItemsGap}))), 1fr));
10266
10278
  width: 100%;
10267
10279
  }
10268
- vaadin-grid .row-details__item:has(.row-details__value.json) {
10280
+ vaadin-grid .row-details__item:has(.row-details__value.code) {
10269
10281
  grid-column: 1 / -1;
10270
10282
  order: 2;
10271
10283
  }
@@ -10274,7 +10286,7 @@ const GridClass = compose(
10274
10286
  text-overflow: ellipsis;
10275
10287
  white-space: pre;
10276
10288
  }
10277
- vaadin-grid .row-details__value.json {
10289
+ vaadin-grid .row-details__value.code {
10278
10290
  margin-top: 5px;
10279
10291
  max-height: 120px;
10280
10292
  overflow: scroll;