@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/cjs/index.cjs
CHANGED
|
@@ -1482,6 +1482,16 @@ var useMVT_TableOptions = (rawOptions) => {
|
|
|
1482
1482
|
enumerable: true,
|
|
1483
1483
|
get: () => rawOptions.columns
|
|
1484
1484
|
});
|
|
1485
|
+
Object.defineProperty(definedOptions, "state", {
|
|
1486
|
+
configurable: true,
|
|
1487
|
+
enumerable: true,
|
|
1488
|
+
get: () => rawOptions.state
|
|
1489
|
+
});
|
|
1490
|
+
Object.defineProperty(definedOptions, "rowCount", {
|
|
1491
|
+
configurable: true,
|
|
1492
|
+
enumerable: true,
|
|
1493
|
+
get: () => rawOptions.rowCount
|
|
1494
|
+
});
|
|
1485
1495
|
return definedOptions;
|
|
1486
1496
|
};
|
|
1487
1497
|
//#endregion
|
|
@@ -1617,10 +1627,20 @@ var useMVT_TableInstance = (definedTableOptions) => {
|
|
|
1617
1627
|
const showColumnFilters = (0, vue.ref)(initialState?.showColumnFilters ?? false);
|
|
1618
1628
|
const showGlobalFilter = (0, vue.ref)(initialState?.showGlobalFilter ?? false);
|
|
1619
1629
|
const showToolbarDropZone = (0, vue.ref)(initialState?.showToolbarDropZone ?? false);
|
|
1620
|
-
const
|
|
1621
|
-
const
|
|
1630
|
+
const stateDescriptor = Object.getOwnPropertyDescriptor(definedTableOptions, "state");
|
|
1631
|
+
const readUserState = () => (stateDescriptor?.get ? stateDescriptor.get.call(definedTableOptions) : stateDescriptor?.value) ?? {};
|
|
1632
|
+
const userStateKeys = new Set(Object.keys(readUserState()));
|
|
1633
|
+
const state = {};
|
|
1634
|
+
userStateKeys.forEach((key) => {
|
|
1635
|
+
Object.defineProperty(state, key, {
|
|
1636
|
+
configurable: true,
|
|
1637
|
+
enumerable: true,
|
|
1638
|
+
get: () => readUserState()[key]
|
|
1639
|
+
});
|
|
1640
|
+
});
|
|
1622
1641
|
const defineState = (key, getter) => {
|
|
1623
|
-
if (!(key
|
|
1642
|
+
if (!userStateKeys.has(key)) Object.defineProperty(state, key, {
|
|
1643
|
+
configurable: true,
|
|
1624
1644
|
enumerable: true,
|
|
1625
1645
|
get: getter
|
|
1626
1646
|
});
|
|
@@ -1644,7 +1664,12 @@ var useMVT_TableInstance = (definedTableOptions) => {
|
|
|
1644
1664
|
defineState("showColumnFilters", () => showColumnFilters.value);
|
|
1645
1665
|
defineState("showGlobalFilter", () => showGlobalFilter.value);
|
|
1646
1666
|
defineState("showToolbarDropZone", () => showToolbarDropZone.value);
|
|
1647
|
-
definedTableOptions
|
|
1667
|
+
Object.defineProperty(definedTableOptions, "state", {
|
|
1668
|
+
configurable: true,
|
|
1669
|
+
enumerable: true,
|
|
1670
|
+
writable: true,
|
|
1671
|
+
value: state
|
|
1672
|
+
});
|
|
1648
1673
|
const statefulTableOptions = definedTableOptions;
|
|
1649
1674
|
let columnDefsCache = [];
|
|
1650
1675
|
const columns = (0, vue.computed)(() => {
|
|
@@ -1671,7 +1696,7 @@ var useMVT_TableInstance = (definedTableOptions) => {
|
|
|
1671
1696
|
const s = statefulTableOptions.state;
|
|
1672
1697
|
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;
|
|
1673
1698
|
});
|
|
1674
|
-
const { columns: _columns, data: _data, ...restOptions } = statefulTableOptions;
|
|
1699
|
+
const { columns: _columns, data: _data, rowCount: _rowCount, ...restOptions } = statefulTableOptions;
|
|
1675
1700
|
const table = (0, _tanstack_vue_table.useVueTable)({
|
|
1676
1701
|
onColumnOrderChange: (updater) => applyUpdater(columnOrder, updater),
|
|
1677
1702
|
onColumnSizingInfoChange: (updater) => applyUpdater(columnSizingInfo, updater),
|
|
@@ -1684,6 +1709,9 @@ var useMVT_TableInstance = (definedTableOptions) => {
|
|
|
1684
1709
|
get data() {
|
|
1685
1710
|
return data.value;
|
|
1686
1711
|
},
|
|
1712
|
+
get rowCount() {
|
|
1713
|
+
return definedTableOptions.rowCount;
|
|
1714
|
+
},
|
|
1687
1715
|
globalFilterFn: statefulTableOptions.filterFns?.[globalFilterFn.value ?? "fuzzy"]
|
|
1688
1716
|
});
|
|
1689
1717
|
table.refs = {
|