@fluid-topics/ft-filterable-table 0.3.50 → 0.3.52
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
|
}
|
|
@@ -353,7 +353,8 @@ const H=Symbol.for(""),W=t=>{if((null==t?void 0:t.r)===H)return null==t?void 0:t
|
|
|
353
353
|
:host, i.ft-icon {
|
|
354
354
|
display: inline-flex;
|
|
355
355
|
align-items: center;
|
|
356
|
-
|
|
356
|
+
flex-shrink: 0;
|
|
357
|
+
flex-grow: 0;
|
|
357
358
|
}
|
|
358
359
|
|
|
359
360
|
:host {
|
|
@@ -385,6 +386,7 @@ const H=Symbol.for(""),W=t=>{if((null==t?void 0:t.r)===H)return null==t?void 0:t
|
|
|
385
386
|
font-size: calc(0.9 * ${ve.size});
|
|
386
387
|
position: relative;
|
|
387
388
|
top: -5%;
|
|
389
|
+
justify-content: center;
|
|
388
390
|
}
|
|
389
391
|
|
|
390
392
|
.ft-icon--file-format {
|
|
@@ -1101,6 +1103,7 @@ const Ee={fontSize:e.FtCssVariableFactory.create("--ft-text-field-font-size","SI
|
|
|
1101
1103
|
<ft-ripple part="ripple" ?disabled=${this.isDisabled()}></ft-ripple>
|
|
1102
1104
|
<ft-typography part="label"
|
|
1103
1105
|
variant="button"
|
|
1106
|
+
element="span"
|
|
1104
1107
|
class="ft-button--label"
|
|
1105
1108
|
?hidden=${!this.hasTextContent()}>
|
|
1106
1109
|
<slot @slotchange=${this.onSlotchange}></slot>
|
|
@@ -1242,7 +1245,7 @@ const Ee={fontSize:e.FtCssVariableFactory.create("--ft-text-field-font-size","SI
|
|
|
1242
1245
|
</div>
|
|
1243
1246
|
`))}
|
|
1244
1247
|
</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
|
|
1248
|
+
`}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
1249
|
<div class="${l.classMap(o)}"
|
|
1247
1250
|
part="${this.columnPart("header-cell",e)}">
|
|
1248
1251
|
<div class="column-title-container">
|
|
@@ -76,7 +76,7 @@ var ut,vt;class xt extends R{constructor(){super(...arguments),this.renderOption
|
|
|
76
76
|
<style>${t}</style>
|
|
77
77
|
`))}
|
|
78
78
|
${this.getTemplate()}
|
|
79
|
-
`}updated(t){super.updated(t),setTimeout((()=>{this.contentAvailableCallback(t),this.scheduleExportpartsUpdate()}),0)}contentAvailableCallback(t){}scheduleExportpartsUpdate(){this.exportpartsDebouncer.run((()=>{var t;(null===(t=this.exportpartsPrefix)||void 0===t?void 0:t.trim())?this.setExportpartsAttribute([this.exportpartsPrefix]):null!=this.exportpartsPrefixes&&this.exportpartsPrefixes.length>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)}))}setExportpartsAttribute(t){var e,i,o,n,s,r;const l=t=>null!=t&&t.trim().length>0,a=t.filter(l).map((t=>t.trim()));if(0===a.length)return void this.removeAttribute("exportparts");const p=new Set;for(let t of null!==(i=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll("[part],[exportparts]"))&&void 0!==i?i:[]){const e=null!==(n=null===(o=t.getAttribute("part"))||void 0===o?void 0:o.split(" "))&&void 0!==n?n:[],i=null!==(r=null===(s=t.getAttribute("exportparts"))||void 0===s?void 0:s.split(",").map((t=>t.split(":")[1])))&&void 0!==r?r:[];new Array(...e,...i).filter(l).map((t=>t.trim())).forEach((t=>p.add(t)))}if(0===p.size)return void this.removeAttribute("exportparts");const c=[...p.values()].flatMap((t=>a.map((e=>`${t}:${e}--${t}`))));this.setAttribute("exportparts",[...this.part,...c].join(", "))}}$t([o()],wt.prototype,"exportpartsPrefix",void 0),$t([function(t,e){const i=()=>JSON.parse(JSON.stringify(t));return o({type:Object,converter:{fromAttribute:t=>{if(null==t)return i();try{return JSON.parse(t)}catch{return i()}},toAttribute:t=>JSON.stringify(t)},...null!=e?e:{}})}([])],wt.prototype,"exportpartsPrefixes",void 0);const Ot=y`
|
|
79
|
+
`}updated(t){super.updated(t),setTimeout((()=>{this.contentAvailableCallback(t),this.scheduleExportpartsUpdate()}),0)}contentAvailableCallback(t){var e,i;if((null!==(i=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll(".ft-lit-element--custom-stylesheet"))&&void 0!==i?i:[]).forEach((t=>t.remove())),this.customStylesheet){const t=document.createElement("style");t.classList.add("ft-lit-element--custom-stylesheet"),t.innerHTML=this.customStylesheet,this.shadowRoot.append(t)}}scheduleExportpartsUpdate(){this.exportpartsDebouncer.run((()=>{var t;(null===(t=this.exportpartsPrefix)||void 0===t?void 0:t.trim())?this.setExportpartsAttribute([this.exportpartsPrefix]):null!=this.exportpartsPrefixes&&this.exportpartsPrefixes.length>0&&this.setExportpartsAttribute(this.exportpartsPrefixes)}))}setExportpartsAttribute(t){var e,i,o,n,s,r;const l=t=>null!=t&&t.trim().length>0,a=t.filter(l).map((t=>t.trim()));if(0===a.length)return void this.removeAttribute("exportparts");const p=new Set;for(let t of null!==(i=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelectorAll("[part],[exportparts]"))&&void 0!==i?i:[]){const e=null!==(n=null===(o=t.getAttribute("part"))||void 0===o?void 0:o.split(" "))&&void 0!==n?n:[],i=null!==(r=null===(s=t.getAttribute("exportparts"))||void 0===s?void 0:s.split(",").map((t=>t.split(":")[1])))&&void 0!==r?r:[];new Array(...e,...i).filter(l).map((t=>t.trim())).forEach((t=>p.add(t)))}if(0===p.size)return void this.removeAttribute("exportparts");const c=[...p.values()].flatMap((t=>a.map((e=>`${t}:${e}--${t}`))));this.setAttribute("exportparts",[...this.part,...c].join(", "))}}$t([o()],wt.prototype,"exportpartsPrefix",void 0),$t([function(t,e){const i=()=>JSON.parse(JSON.stringify(t));return o({type:Object,converter:{fromAttribute:t=>{if(null==t)return i();try{return JSON.parse(t)}catch{return i()}},toAttribute:t=>JSON.stringify(t)},...null!=e?e:{}})}([])],wt.prototype,"exportpartsPrefixes",void 0),$t([o()],wt.prototype,"customStylesheet",void 0);const Ot=y`
|
|
80
80
|
.ft-no-text-select {
|
|
81
81
|
-webkit-touch-callout: none;
|
|
82
82
|
-webkit-user-select: none;
|
|
@@ -466,7 +466,8 @@ class Lt extends Mt{constructor(t){if(super(t),this.it=G,t.type!==zt)throw Error
|
|
|
466
466
|
:host, i.ft-icon {
|
|
467
467
|
display: inline-flex;
|
|
468
468
|
align-items: center;
|
|
469
|
-
|
|
469
|
+
flex-shrink: 0;
|
|
470
|
+
flex-grow: 0;
|
|
470
471
|
}
|
|
471
472
|
|
|
472
473
|
:host {
|
|
@@ -498,6 +499,7 @@ class Lt extends Mt{constructor(t){if(super(t),this.it=G,t.type!==zt)throw Error
|
|
|
498
499
|
font-size: calc(0.9 * ${yi.size});
|
|
499
500
|
position: relative;
|
|
500
501
|
top: -5%;
|
|
502
|
+
justify-content: center;
|
|
501
503
|
}
|
|
502
504
|
|
|
503
505
|
.ft-icon--file-format {
|
|
@@ -1214,6 +1216,7 @@ const zi={fontSize:gt.create("--ft-text-field-font-size","SIZE","14px"),labelSiz
|
|
|
1214
1216
|
<ft-ripple part="ripple" ?disabled=${this.isDisabled()}></ft-ripple>
|
|
1215
1217
|
<ft-typography part="label"
|
|
1216
1218
|
variant="button"
|
|
1219
|
+
element="span"
|
|
1217
1220
|
class="ft-button--label"
|
|
1218
1221
|
?hidden=${!this.hasTextContent()}>
|
|
1219
1222
|
<slot @slotchange=${this.onSlotchange}></slot>
|
|
@@ -1355,7 +1358,7 @@ const zi={fontSize:gt.create("--ft-text-field-font-size","SIZE","14px"),labelSiz
|
|
|
1355
1358
|
</div>
|
|
1356
1359
|
`))}
|
|
1357
1360
|
</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
|
|
1361
|
+
`}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
1362
|
<div class="${_t(i)}"
|
|
1360
1363
|
part="${this.columnPart("header-cell",e)}">
|
|
1361
1364
|
<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.
|
|
3
|
+
"version": "0.3.52",
|
|
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.
|
|
26
|
-
"@fluid-topics/ft-select": "0.3.
|
|
27
|
-
"@fluid-topics/ft-text-field": "0.3.
|
|
28
|
-
"@fluid-topics/ft-wc-utils": "0.3.
|
|
25
|
+
"@fluid-topics/ft-button": "0.3.52",
|
|
26
|
+
"@fluid-topics/ft-select": "0.3.52",
|
|
27
|
+
"@fluid-topics/ft-text-field": "0.3.52",
|
|
28
|
+
"@fluid-topics/ft-wc-utils": "0.3.52",
|
|
29
29
|
"lit": "2.2.8"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "746cdd6b34c2fa25220ed735914fb1dff9c0fde7"
|
|
32
32
|
}
|