@fluid-topics/ft-filterable-table 0.3.50 → 0.3.51

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.
@@ -76,7 +76,7 @@ export class FtFilterableTable extends FtLitElement {
76
76
  const column = this.columns[this.currentSort.column];
77
77
  const ascComparator = (_a = column.comparator) !== null && _a !== void 0 ? _a : DEFAULT_COMPARATOR;
78
78
  const comparator = this.currentSort.order === "asc" ? ascComparator : ((a, b) => -ascComparator(a, b));
79
- return data.sort((a, b) => comparator(this.getValue(column, a), this.getValue(column, b)));
79
+ return [...data].sort((a, b) => comparator(this.getValue(column, a), this.getValue(column, b)));
80
80
  }
81
81
  return data;
82
82
  }
@@ -1101,6 +1101,7 @@ const Ee={fontSize:e.FtCssVariableFactory.create("--ft-text-field-font-size","SI
1101
1101
  <ft-ripple part="ripple" ?disabled=${this.isDisabled()}></ft-ripple>
1102
1102
  <ft-typography part="label"
1103
1103
  variant="button"
1104
+ element="span"
1104
1105
  class="ft-button--label"
1105
1106
  ?hidden=${!this.hasTextContent()}>
1106
1107
  <slot @slotchange=${this.onSlotchange}></slot>
@@ -1242,7 +1243,7 @@ const Ee={fontSize:e.FtCssVariableFactory.create("--ft-text-field-font-size","SI
1242
1243
  </div>
1243
1244
  `))}
1244
1245
  </div>
1245
- `}filterData(){return this.filters.reduce(((t,e,i)=>{var o;const s=this.columns[i];if(e&&e.value)switch(null!==(o=s.filter)&&void 0!==o?o:"text"){case"text":return t.filter((t=>this.getValueAsString(s,t,i).toLowerCase().includes(e.value.toLowerCase())));case"select":return t.filter((t=>this.getValueAsString(s,t,i)===e.value))}return t}),this.data)}sortData(t){var e;if(this.currentSort){const i=this.columns[this.currentSort.column],o=null!==(e=i.comparator)&&void 0!==e?e:ri,s="asc"===this.currentSort.order?o:(t,e)=>-o(t,e);return t.sort(((t,e)=>s(this.getValue(i,t),this.getValue(i,e))))}return t}update(t){super.update(t),t.has("sort")&&(this.currentSort=this.sort),(t.has("data")||t.has("columns"))&&this.updateSelectData()}updateSelectData(){this.selectData=[];const t=this.data,e=this.columns;for(let i in e){const o=e[i];"select"===o.filter&&(this.selectData[i]=[...new Set(t.map(((t,e)=>this.getValueAsString(o,t,e))))].sort(((t,e)=>t.localeCompare(e))))}this.requestUpdate()}renderHeader(t,e){const o={"header-cell":!0,"header-cell--sticky":this.stickyHeaders};return i.html`
1246
+ `}filterData(){return this.filters.reduce(((t,e,i)=>{var o;const s=this.columns[i];if(e&&e.value)switch(null!==(o=s.filter)&&void 0!==o?o:"text"){case"text":return t.filter((t=>this.getValueAsString(s,t,i).toLowerCase().includes(e.value.toLowerCase())));case"select":return t.filter((t=>this.getValueAsString(s,t,i)===e.value))}return t}),this.data)}sortData(t){var e;if(this.currentSort){const i=this.columns[this.currentSort.column],o=null!==(e=i.comparator)&&void 0!==e?e:ri,s="asc"===this.currentSort.order?o:(t,e)=>-o(t,e);return[...t].sort(((t,e)=>s(this.getValue(i,t),this.getValue(i,e))))}return t}update(t){super.update(t),t.has("sort")&&(this.currentSort=this.sort),(t.has("data")||t.has("columns"))&&this.updateSelectData()}updateSelectData(){this.selectData=[];const t=this.data,e=this.columns;for(let i in e){const o=e[i];"select"===o.filter&&(this.selectData[i]=[...new Set(t.map(((t,e)=>this.getValueAsString(o,t,e))))].sort(((t,e)=>t.localeCompare(e))))}this.requestUpdate()}renderHeader(t,e){const o={"header-cell":!0,"header-cell--sticky":this.stickyHeaders};return i.html`
1246
1247
  <div class="${l.classMap(o)}"
1247
1248
  part="${this.columnPart("header-cell",e)}">
1248
1249
  <div class="column-title-container">
@@ -1214,6 +1214,7 @@ const zi={fontSize:gt.create("--ft-text-field-font-size","SIZE","14px"),labelSiz
1214
1214
  <ft-ripple part="ripple" ?disabled=${this.isDisabled()}></ft-ripple>
1215
1215
  <ft-typography part="label"
1216
1216
  variant="button"
1217
+ element="span"
1217
1218
  class="ft-button--label"
1218
1219
  ?hidden=${!this.hasTextContent()}>
1219
1220
  <slot @slotchange=${this.onSlotchange}></slot>
@@ -1355,7 +1356,7 @@ const zi={fontSize:gt.create("--ft-text-field-font-size","SIZE","14px"),labelSiz
1355
1356
  </div>
1356
1357
  `))}
1357
1358
  </div>
1358
- `}filterData(){return this.filters.reduce(((t,e,i)=>{var o;const n=this.columns[i];if(e&&e.value)switch(null!==(o=n.filter)&&void 0!==o?o:"text"){case"text":return t.filter((t=>this.getValueAsString(n,t,i).toLowerCase().includes(e.value.toLowerCase())));case"select":return t.filter((t=>this.getValueAsString(n,t,i)===e.value))}return t}),this.data)}sortData(t){var e;if(this.currentSort){const i=this.columns[this.currentSort.column],o=null!==(e=i.comparator)&&void 0!==e?e:ao,n="asc"===this.currentSort.order?o:(t,e)=>-o(t,e);return t.sort(((t,e)=>n(this.getValue(i,t),this.getValue(i,e))))}return t}update(t){super.update(t),t.has("sort")&&(this.currentSort=this.sort),(t.has("data")||t.has("columns"))&&this.updateSelectData()}updateSelectData(){this.selectData=[];const t=this.data,e=this.columns;for(let i in e){const o=e[i];"select"===o.filter&&(this.selectData[i]=[...new Set(t.map(((t,e)=>this.getValueAsString(o,t,e))))].sort(((t,e)=>t.localeCompare(e))))}this.requestUpdate()}renderHeader(t,e){const i={"header-cell":!0,"header-cell--sticky":this.stickyHeaders};return X`
1359
+ `}filterData(){return this.filters.reduce(((t,e,i)=>{var o;const n=this.columns[i];if(e&&e.value)switch(null!==(o=n.filter)&&void 0!==o?o:"text"){case"text":return t.filter((t=>this.getValueAsString(n,t,i).toLowerCase().includes(e.value.toLowerCase())));case"select":return t.filter((t=>this.getValueAsString(n,t,i)===e.value))}return t}),this.data)}sortData(t){var e;if(this.currentSort){const i=this.columns[this.currentSort.column],o=null!==(e=i.comparator)&&void 0!==e?e:ao,n="asc"===this.currentSort.order?o:(t,e)=>-o(t,e);return[...t].sort(((t,e)=>n(this.getValue(i,t),this.getValue(i,e))))}return t}update(t){super.update(t),t.has("sort")&&(this.currentSort=this.sort),(t.has("data")||t.has("columns"))&&this.updateSelectData()}updateSelectData(){this.selectData=[];const t=this.data,e=this.columns;for(let i in e){const o=e[i];"select"===o.filter&&(this.selectData[i]=[...new Set(t.map(((t,e)=>this.getValueAsString(o,t,e))))].sort(((t,e)=>t.localeCompare(e))))}this.requestUpdate()}renderHeader(t,e){const i={"header-cell":!0,"header-cell--sticky":this.stickyHeaders};return X`
1359
1360
  <div class="${_t(i)}"
1360
1361
  part="${this.columnPart("header-cell",e)}">
1361
1362
  <div class="column-title-container">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-filterable-table",
3
- "version": "0.3.50",
3
+ "version": "0.3.51",
4
4
  "description": "A dynamic table with filters",
5
5
  "keywords": [
6
6
  "Lit"
@@ -22,11 +22,11 @@
22
22
  "test": "echo \"Error: run tests from root\" && exit 1"
23
23
  },
24
24
  "dependencies": {
25
- "@fluid-topics/ft-button": "0.3.50",
26
- "@fluid-topics/ft-select": "0.3.50",
27
- "@fluid-topics/ft-text-field": "0.3.50",
28
- "@fluid-topics/ft-wc-utils": "0.3.50",
25
+ "@fluid-topics/ft-button": "0.3.51",
26
+ "@fluid-topics/ft-select": "0.3.51",
27
+ "@fluid-topics/ft-text-field": "0.3.51",
28
+ "@fluid-topics/ft-wc-utils": "0.3.51",
29
29
  "lit": "2.2.8"
30
30
  },
31
- "gitHead": "ed73266ceb5360df2eefd4cbb314c1b9b2e811dc"
31
+ "gitHead": "6396591dbb377dbb8b05e6328135168279c99417"
32
32
  }