@descope/web-components-ui 1.0.361 → 1.0.363

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.esm.js CHANGED
@@ -2634,7 +2634,8 @@ const customMixin$a = (superclass) =>
2634
2634
  init() {
2635
2635
  super.init?.();
2636
2636
 
2637
- this.setAttribute('pattern', defaultPattern);
2637
+ // we need to set the pattern on the base element because vaadin-email-field is overriding it
2638
+ this.baseElement.setAttribute('pattern', defaultPattern);
2638
2639
 
2639
2640
  if (!this.getAttribute('autocomplete')) {
2640
2641
  this.setAttribute('autocomplete', defaultAutocomplete);
@@ -8782,33 +8783,44 @@ const isValidDataType = (data) => {
8782
8783
 
8783
8784
  const isPlainObject = (value) => value?.constructor === Object;
8784
8785
 
8786
+ const isXml = (str) => /^\s*<[\s\S]*>/.test(str);
8787
+
8788
+ const escapeXML = (s) => {
8789
+ const dom = document.createElement('div');
8790
+ dom.textContent = s;
8791
+ return dom.innerHTML;
8792
+ };
8793
+
8785
8794
  const getValueType = (value) => {
8786
8795
  if (isPlainObject(value)) return 'object';
8787
8796
  if (Array.isArray(value)) return 'array';
8797
+ if (isXml(value)) return 'xml';
8788
8798
 
8789
8799
  return 'text';
8790
8800
  };
8791
8801
 
8792
- const renderCodeSnippet = (value) =>
8793
- `<descope-code-snippet lang="json" class="row-details__value json">${JSON.stringify(
8794
- value,
8795
- null,
8796
- 2
8797
- )}</descope-code-snippet>`;
8802
+ const renderCodeSnippet = (value, lang) =>
8803
+ `<descope-code-snippet lang="${lang}" class="row-details__value code">${value}</descope-code-snippet>`;
8798
8804
 
8799
8805
  const renderText = (text) =>
8800
8806
  `<div class="row-details__value text" title="${text}">${text}</div>`;
8807
+ const renderJson = (value) => renderCodeSnippet(JSON.stringify(value, null, 2), 'json');
8808
+ const renderXml = (value) => renderCodeSnippet(escapeXML(value), 'xml');
8801
8809
 
8802
8810
  const defaultRowDetailsValueRenderer = (value) => {
8803
8811
  const valueType = getValueType(value);
8804
8812
 
8805
8813
  if (valueType === 'object') {
8806
- return renderCodeSnippet(value);
8814
+ return renderJson(value);
8815
+ }
8816
+
8817
+ if (valueType === 'xml') {
8818
+ return renderXml(value);
8807
8819
  }
8808
8820
 
8809
8821
  if (valueType === 'array') {
8810
8822
  if (value.some((v) => getValueType(v) === 'object')) {
8811
- return renderCodeSnippet(value);
8823
+ return renderJson(value);
8812
8824
  }
8813
8825
  return renderText(value.join(',\n'));
8814
8826
  }
@@ -9165,7 +9177,7 @@ const GridClass = compose(
9165
9177
  grid-template-columns: repeat(auto-fit, minmax(max(200px, calc(100%/4 - var(${GridClass.cssVarList.detailsPanelItemsGap}))), 1fr));
9166
9178
  width: 100%;
9167
9179
  }
9168
- vaadin-grid .row-details__item:has(.row-details__value.json) {
9180
+ vaadin-grid .row-details__item:has(.row-details__value.code) {
9169
9181
  grid-column: 1 / -1;
9170
9182
  order: 2;
9171
9183
  }
@@ -9174,7 +9186,7 @@ const GridClass = compose(
9174
9186
  text-overflow: ellipsis;
9175
9187
  white-space: pre;
9176
9188
  }
9177
- vaadin-grid .row-details__value.json {
9189
+ vaadin-grid .row-details__value.code {
9178
9190
  margin-top: 5px;
9179
9191
  max-height: 120px;
9180
9192
  overflow: scroll;