@masterteam/components 0.0.274 → 0.0.276
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.
- package/assets/common.css +1 -1
- package/fesm2022/masterteam-components-entities.mjs +19 -7
- package/fesm2022/masterteam-components-entities.mjs.map +1 -1
- package/fesm2022/masterteam-components-table.mjs +18 -2
- package/fesm2022/masterteam-components-table.mjs.map +1 -1
- package/package.json +1 -1
- package/types/masterteam-components-entities.d.ts +13 -3
- package/types/masterteam-components-table.d.ts +19 -0
|
@@ -291,6 +291,20 @@ class TableValueResolver {
|
|
|
291
291
|
return 'text';
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* Whether the filter UI should offer a control for this column.
|
|
296
|
+
*
|
|
297
|
+
* Deliberately separate from {@link getColumnFilterType}, which also drives
|
|
298
|
+
* export, sort and grouping resolution — opting a column out of the filter
|
|
299
|
+
* panel must not change how its value is exported. Hosts opt out with
|
|
300
|
+
* `filterable: false`, most usefully on lazy tables: those never filter
|
|
301
|
+
* locally, so a filter the host cannot map onto a backend query parameter
|
|
302
|
+
* would render a control that does nothing at all.
|
|
303
|
+
*/
|
|
304
|
+
static isColumnFilterable(column, row) {
|
|
305
|
+
return (column.filterable !== false &&
|
|
306
|
+
TableValueResolver.getColumnFilterType(column, row) !== null);
|
|
307
|
+
}
|
|
294
308
|
/**
|
|
295
309
|
* Returns a column with its filterConfig normalized for rendering:
|
|
296
310
|
* - `type` is resolved via `getColumnFilterType`
|
|
@@ -1063,7 +1077,7 @@ class TableFilter {
|
|
|
1063
1077
|
: '';
|
|
1064
1078
|
}, ...(ngDevMode ? [{ debugName: "filterSummary" }] : /* istanbul ignore next */ []));
|
|
1065
1079
|
filterableColumns = computed(() => this.columns()
|
|
1066
|
-
.filter((col) => TableValueResolver.
|
|
1080
|
+
.filter((col) => TableValueResolver.isColumnFilterable(col, this.data()[0]))
|
|
1067
1081
|
.map((col) => TableValueResolver.buildFilterableColumn(col, this.data())), ...(ngDevMode ? [{ debugName: "filterableColumns" }] : /* istanbul ignore next */ []));
|
|
1068
1082
|
activeFilterCount = computed(() => Object.entries(this.appliedFilters()).filter(([key, value]) =>
|
|
1069
1083
|
// `generalSearch` is the table's global search term, not a column
|
|
@@ -1998,7 +2012,7 @@ class Table {
|
|
|
1998
2012
|
const data = this.data();
|
|
1999
2013
|
const map = new Map();
|
|
2000
2014
|
this.columns().forEach((col) => {
|
|
2001
|
-
if (TableValueResolver.
|
|
2015
|
+
if (!TableValueResolver.isColumnFilterable(col, data[0])) {
|
|
2002
2016
|
return;
|
|
2003
2017
|
}
|
|
2004
2018
|
map.set(col.key, TableValueResolver.buildFilterableColumn(col, data));
|
|
@@ -2658,6 +2672,8 @@ class Table {
|
|
|
2658
2672
|
isCellClickFilterable(column, row) {
|
|
2659
2673
|
if (!this.cellClickFilter())
|
|
2660
2674
|
return false;
|
|
2675
|
+
if (column.filterable === false)
|
|
2676
|
+
return false;
|
|
2661
2677
|
if (column.type === 'boolean') {
|
|
2662
2678
|
// Editable booleans keep the toggle interaction; only readonly ones filter.
|
|
2663
2679
|
return column.readonly === true;
|