@descope/web-components-ui 1.0.236 → 1.0.237

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.esm.js CHANGED
@@ -6797,37 +6797,63 @@ const ButtonSelectionGroupItemClass = compose(
6797
6797
 
6798
6798
  customElements.define(componentName$8, ButtonSelectionGroupItemClass);
6799
6799
 
6800
- const componentName$7 = getComponentName('grid-text-column');
6800
+ class GridTextColumnClass extends GridSortColumn {
6801
+ get sortable() {
6802
+ return this.getAttribute('sortable') === 'true';
6803
+ }
6804
+
6805
+ _defaultHeaderRenderer(root, _column) {
6806
+ if (this.sortable) {
6807
+ super._defaultHeaderRenderer(root, _column);
6808
+
6809
+ return;
6810
+ }
6801
6811
 
6802
- class GridTextColumnClass extends GridSortColumn {}
6812
+ // eslint-disable-next-line no-param-reassign
6813
+ root.innerHTML = this.__getHeader(this.header, this.path);
6814
+ }
6815
+ }
6816
+
6817
+ const componentName$7 = getComponentName('grid-text-column');
6803
6818
 
6804
6819
  customElements.define(componentName$7, GridTextColumnClass);
6805
6820
 
6806
6821
  /* eslint-disable no-param-reassign */
6807
6822
 
6808
- const componentName$6 = getComponentName('grid-status-column');
6809
- class GridStatusColumnClass extends GridSortColumn {
6823
+ class GridCustomColumnClass extends GridTextColumnClass {
6810
6824
  _defaultRenderer(cell, _col, model) {
6811
- const contentAttr = this.getAttribute('status');
6812
- if (!contentAttr) {
6825
+ const content = model.item[this.path];
6826
+
6827
+ // we get a list of elements that can be used to render the content
6828
+ // each element can have a "pattern" attribute which contains regex expression
6829
+ // we are going over the elements, and when finding an element which is pattern matches the data,
6830
+ // we are cloning this element, and injecting the data as its child
6831
+ const contentEle = Array.from(this.children).find((child) => {
6832
+ const pattern = child.getAttribute('pattern');
6833
+ if (!pattern) return true;
6834
+
6835
+ const regEx = new RegExp(pattern);
6836
+ return regEx.test(content);
6837
+ });
6838
+
6839
+ if (!contentEle) {
6813
6840
  cell.innerHTML = model.item[this.path];
6841
+
6814
6842
  return;
6815
6843
  }
6816
6844
 
6817
- const [active, inactive] = contentAttr.split(',');
6818
- const label = model.item[this.path] ? active : inactive;
6819
-
6820
- cell.innerHTML = `<div style="padding:0 0.25em; border-radius:4px; background:${
6821
- model.item[this.path] ? 'lightgreen' : 'pink'
6822
- };">${label}</div>`;
6845
+ const newEle = contentEle.cloneNode(true);
6846
+ newEle.innerHTML = content;
6847
+ cell.innerHTML = '';
6848
+ cell.append(newEle);
6823
6849
  }
6824
6850
  }
6825
6851
 
6826
- customElements.define(componentName$6, GridStatusColumnClass);
6852
+ /* eslint-disable no-param-reassign */
6827
6853
 
6828
- /* eslint-disable class-methods-use-this */
6854
+ const componentName$6 = getComponentName('grid-custom-column');
6829
6855
 
6830
- const componentName$5 = getComponentName('grid-selection-column');
6856
+ customElements.define(componentName$6, GridCustomColumnClass);
6831
6857
 
6832
6858
  const createCheckboxEle = () => {
6833
6859
  const checkbox = document.createElement('descope-checkbox');
@@ -6841,8 +6867,10 @@ const createCheckboxEle = () => {
6841
6867
  const getIsAllItemsSelected = (grid) => grid.selectedItems.length === grid.items?.length;
6842
6868
 
6843
6869
  class GridSelectionColumnClass extends GridSelectionColumn {
6870
+ // eslint-disable-next-line class-methods-use-this
6844
6871
  _onHeaderRendererOrBindingChanged() {}
6845
6872
 
6873
+ // eslint-disable-next-line class-methods-use-this
6846
6874
  _headerRenderer(cell) {
6847
6875
  const grid = cell.parentNode;
6848
6876
 
@@ -6865,6 +6893,7 @@ class GridSelectionColumnClass extends GridSelectionColumn {
6865
6893
  checkbox.setAttribute('checked', getIsAllItemsSelected(grid));
6866
6894
  }
6867
6895
 
6896
+ // eslint-disable-next-line class-methods-use-this
6868
6897
  _defaultRenderer(cell, col, model) {
6869
6898
  const grid = cell.parentNode;
6870
6899
 
@@ -6882,6 +6911,8 @@ class GridSelectionColumnClass extends GridSelectionColumn {
6882
6911
  }
6883
6912
  }
6884
6913
 
6914
+ const componentName$5 = getComponentName('grid-selection-column');
6915
+
6885
6916
  customElements.define(componentName$5, GridSelectionColumnClass);
6886
6917
 
6887
6918
  const isValidDataType = (data) => {
@@ -9010,7 +9041,7 @@ const BadgeClass = compose(
9010
9041
  fontFamily: {},
9011
9042
  fontSize: {},
9012
9043
  fontWeight: {},
9013
-
9044
+ textTransform: {},
9014
9045
  verticalPadding: [{ property: 'padding-top' }, { property: 'padding-bottom' }],
9015
9046
  horizontalPadding: [{ property: 'padding-left' }, { property: 'padding-right' }],
9016
9047