@mantine-vue/table 2.2.1 → 2.2.2
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/cjs/index.cjs +33 -5
- package/cjs/index.cjs.map +1 -1
- package/esm/index.mjs +33 -5
- package/esm/index.mjs.map +1 -1
- package/package.json +4 -4
package/esm/index.mjs
CHANGED
|
@@ -1458,6 +1458,16 @@ var useMVT_TableOptions = (rawOptions) => {
|
|
|
1458
1458
|
enumerable: true,
|
|
1459
1459
|
get: () => rawOptions.columns
|
|
1460
1460
|
});
|
|
1461
|
+
Object.defineProperty(definedOptions, "state", {
|
|
1462
|
+
configurable: true,
|
|
1463
|
+
enumerable: true,
|
|
1464
|
+
get: () => rawOptions.state
|
|
1465
|
+
});
|
|
1466
|
+
Object.defineProperty(definedOptions, "rowCount", {
|
|
1467
|
+
configurable: true,
|
|
1468
|
+
enumerable: true,
|
|
1469
|
+
get: () => rawOptions.rowCount
|
|
1470
|
+
});
|
|
1461
1471
|
return definedOptions;
|
|
1462
1472
|
};
|
|
1463
1473
|
//#endregion
|
|
@@ -1593,10 +1603,20 @@ var useMVT_TableInstance = (definedTableOptions) => {
|
|
|
1593
1603
|
const showColumnFilters = ref(initialState?.showColumnFilters ?? false);
|
|
1594
1604
|
const showGlobalFilter = ref(initialState?.showGlobalFilter ?? false);
|
|
1595
1605
|
const showToolbarDropZone = ref(initialState?.showToolbarDropZone ?? false);
|
|
1596
|
-
const
|
|
1597
|
-
const
|
|
1606
|
+
const stateDescriptor = Object.getOwnPropertyDescriptor(definedTableOptions, "state");
|
|
1607
|
+
const readUserState = () => (stateDescriptor?.get ? stateDescriptor.get.call(definedTableOptions) : stateDescriptor?.value) ?? {};
|
|
1608
|
+
const userStateKeys = new Set(Object.keys(readUserState()));
|
|
1609
|
+
const state = {};
|
|
1610
|
+
userStateKeys.forEach((key) => {
|
|
1611
|
+
Object.defineProperty(state, key, {
|
|
1612
|
+
configurable: true,
|
|
1613
|
+
enumerable: true,
|
|
1614
|
+
get: () => readUserState()[key]
|
|
1615
|
+
});
|
|
1616
|
+
});
|
|
1598
1617
|
const defineState = (key, getter) => {
|
|
1599
|
-
if (!(key
|
|
1618
|
+
if (!userStateKeys.has(key)) Object.defineProperty(state, key, {
|
|
1619
|
+
configurable: true,
|
|
1600
1620
|
enumerable: true,
|
|
1601
1621
|
get: getter
|
|
1602
1622
|
});
|
|
@@ -1620,7 +1640,12 @@ var useMVT_TableInstance = (definedTableOptions) => {
|
|
|
1620
1640
|
defineState("showColumnFilters", () => showColumnFilters.value);
|
|
1621
1641
|
defineState("showGlobalFilter", () => showGlobalFilter.value);
|
|
1622
1642
|
defineState("showToolbarDropZone", () => showToolbarDropZone.value);
|
|
1623
|
-
definedTableOptions
|
|
1643
|
+
Object.defineProperty(definedTableOptions, "state", {
|
|
1644
|
+
configurable: true,
|
|
1645
|
+
enumerable: true,
|
|
1646
|
+
writable: true,
|
|
1647
|
+
value: state
|
|
1648
|
+
});
|
|
1624
1649
|
const statefulTableOptions = definedTableOptions;
|
|
1625
1650
|
let columnDefsCache = [];
|
|
1626
1651
|
const columns = computed(() => {
|
|
@@ -1647,7 +1672,7 @@ var useMVT_TableInstance = (definedTableOptions) => {
|
|
|
1647
1672
|
const s = statefulTableOptions.state;
|
|
1648
1673
|
return (s.isLoading || s.showSkeletons) && !definedTableOptions.data.length ? [...Array(Math.min(s.pagination.pageSize, 20)).fill(null)].map(() => Object.assign({}, ...getAllLeafColumnDefs(columns.value).map((col) => ({ [getColumnId(col)]: null })))) : definedTableOptions.data;
|
|
1649
1674
|
});
|
|
1650
|
-
const { columns: _columns, data: _data, ...restOptions } = statefulTableOptions;
|
|
1675
|
+
const { columns: _columns, data: _data, rowCount: _rowCount, ...restOptions } = statefulTableOptions;
|
|
1651
1676
|
const table = useVueTable({
|
|
1652
1677
|
onColumnOrderChange: (updater) => applyUpdater(columnOrder, updater),
|
|
1653
1678
|
onColumnSizingInfoChange: (updater) => applyUpdater(columnSizingInfo, updater),
|
|
@@ -1660,6 +1685,9 @@ var useMVT_TableInstance = (definedTableOptions) => {
|
|
|
1660
1685
|
get data() {
|
|
1661
1686
|
return data.value;
|
|
1662
1687
|
},
|
|
1688
|
+
get rowCount() {
|
|
1689
|
+
return definedTableOptions.rowCount;
|
|
1690
|
+
},
|
|
1663
1691
|
globalFilterFn: statefulTableOptions.filterFns?.[globalFilterFn.value ?? "fuzzy"]
|
|
1664
1692
|
});
|
|
1665
1693
|
table.refs = {
|