@tanstack/vue-table 8.5.0 → 8.5.3
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/build/cjs/table-core/build/esm/index.js +23 -7
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/cjs/vue-table/src/index.js +12 -12
- package/build/cjs/vue-table/src/index.js.map +1 -1
- package/build/esm/index.js +35 -19
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +27 -27
- package/build/types/index.d.ts +8 -3
- package/build/umd/index.development.js +35 -19
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +14 -15
|
@@ -16,15 +16,18 @@ var index = require('../../table-core/build/esm/index.js');
|
|
|
16
16
|
var vue = require('vue');
|
|
17
17
|
var mergeProxy = require('./merge-proxy.js');
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const FlexRender = {
|
|
20
|
+
props: ['render', 'props'],
|
|
21
|
+
setup: props => {
|
|
22
|
+
return () => {
|
|
23
|
+
if (typeof props.render === 'function' || typeof props.render === 'object') {
|
|
24
|
+
return vue.h(props.render, props.props);
|
|
25
|
+
}
|
|
21
26
|
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
return props.render;
|
|
28
|
+
};
|
|
24
29
|
}
|
|
25
|
-
|
|
26
|
-
return Comp;
|
|
27
|
-
}
|
|
30
|
+
};
|
|
28
31
|
function useVueTable(options) {
|
|
29
32
|
const resolvedOptions = mergeProxy.mergeProxy({
|
|
30
33
|
state: {},
|
|
@@ -66,10 +69,7 @@ function useVueTable(options) {
|
|
|
66
69
|
}
|
|
67
70
|
});
|
|
68
71
|
});
|
|
69
|
-
});
|
|
70
|
-
// table.willUpdate()
|
|
71
|
-
// })
|
|
72
|
-
|
|
72
|
+
});
|
|
73
73
|
return table;
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -117,6 +117,6 @@ exports.reSplitAlphaNumeric = index.reSplitAlphaNumeric;
|
|
|
117
117
|
exports.selectRowsFn = index.selectRowsFn;
|
|
118
118
|
exports.shouldAutoRemoveFilter = index.shouldAutoRemoveFilter;
|
|
119
119
|
exports.sortingFns = index.sortingFns;
|
|
120
|
-
exports.
|
|
120
|
+
exports.FlexRender = FlexRender;
|
|
121
121
|
exports.useVueTable = useVueTable;
|
|
122
122
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/index.ts"],"sourcesContent":["import {\n TableOptions,\n createTable,\n TableOptionsResolved,\n RowData,\n} from '@tanstack/table-core'\nimport { h, watchEffect, ref
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/index.ts"],"sourcesContent":["import {\n TableOptions,\n createTable,\n TableOptionsResolved,\n RowData,\n} from '@tanstack/table-core'\nimport { h, watchEffect, ref } from 'vue'\nimport { mergeProxy } from './merge-proxy'\n\nexport * from '@tanstack/table-core'\n\nexport const FlexRender = {\n props: ['render', 'props'],\n setup: (props: { render: any; props: any }) => {\n return () => {\n if (\n typeof props.render === 'function' ||\n typeof props.render === 'object'\n ) {\n return h(props.render, props.props)\n }\n\n return props.render\n }\n },\n}\n\nexport function useVueTable<TData extends RowData>(\n options: TableOptions<TData>\n) {\n const resolvedOptions: TableOptionsResolved<TData> = mergeProxy(\n {\n state: {}, // Dummy state\n onStateChange: () => {}, // noop\n renderFallbackValue: null,\n mergeOptions(\n defaultOptions: TableOptions<TData>,\n options: TableOptions<TData>\n ) {\n return mergeProxy(defaultOptions, options)\n },\n },\n options\n )\n\n const table = createTable<TData>(resolvedOptions)\n // can't use `reactive` because update needs to be immutable\n const state = ref(table.initialState)\n\n watchEffect(() => {\n table.setOptions(prev => {\n const stateProxy = new Proxy({} as typeof state.value, {\n get: (_, prop) => state.value[prop as keyof typeof state.value],\n })\n\n return mergeProxy(prev, options, {\n // merge the initialState and `options.state`\n // create a new proxy on each `setOptions` call\n // and get the value from state on each property access\n state: mergeProxy(stateProxy, options.state ?? {}),\n // Similarly, we'll maintain both our internal state and any user-provided\n // state.\n onStateChange: (updater: any) => {\n if (updater instanceof Function) {\n state.value = updater(state.value)\n } else {\n state.value = updater\n }\n\n options.onStateChange?.(updater)\n },\n })\n })\n })\n\n return table\n}\n"],"names":["FlexRender","props","setup","render","h","useVueTable","options","resolvedOptions","mergeProxy","state","onStateChange","renderFallbackValue","mergeOptions","defaultOptions","table","createTable","ref","initialState","watchEffect","setOptions","prev","stateProxy","Proxy","get","_","prop","value","updater","Function"],"mappings":";;;;;;;;;;;;;;;;;;AAWO,MAAMA,UAAU,GAAG;AACxBC,EAAAA,KAAK,EAAE,CAAC,QAAD,EAAW,OAAX,CADiB;EAExBC,KAAK,EAAGD,KAAD,IAAwC;AAC7C,IAAA,OAAO,MAAM;AACX,MAAA,IACE,OAAOA,KAAK,CAACE,MAAb,KAAwB,UAAxB,IACA,OAAOF,KAAK,CAACE,MAAb,KAAwB,QAF1B,EAGE;QACA,OAAOC,KAAC,CAACH,KAAK,CAACE,MAAP,EAAeF,KAAK,CAACA,KAArB,CAAR,CAAA;AACD,OAAA;;MAED,OAAOA,KAAK,CAACE,MAAb,CAAA;KARF,CAAA;AAUD,GAAA;AAbuB,EAAnB;AAgBA,SAASE,WAAT,CACLC,OADK,EAEL;EACA,MAAMC,eAA4C,GAAGC,qBAAU,CAC7D;AACEC,IAAAA,KAAK,EAAE,EADT;AACa;IACXC,aAAa,EAAE,MAAM,EAFvB;AAE2B;AACzBC,IAAAA,mBAAmB,EAAE,IAHvB;;AAIEC,IAAAA,YAAY,CACVC,cADU,EAEVP,OAFU,EAGV;AACA,MAAA,OAAOE,qBAAU,CAACK,cAAD,EAAiBP,OAAjB,CAAjB,CAAA;AACD,KAAA;;GAV0D,EAY7DA,OAZ6D,CAA/D,CAAA;AAeA,EAAA,MAAMQ,KAAK,GAAGC,iBAAW,CAAQ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ultState ? [] : (_table$initialState$c = (_table$initialState = table.initialState) == null ? void 0 : _table$initialState.columnFilters) != null ? _table$initialState$c : []);
|
|
1301
1301
|
},
|
|
1302
1302
|
getPreFilteredRowModel: () => table.getCoreRowModel(),
|
|
1303
|
-
_getFilteredRowModel: table.options.getFilteredRowModel && table.options.getFilteredRowModel(table),
|
|
1304
1303
|
getFilteredRowModel: () => {
|
|
1304
|
+
if (!table._getFilteredRowModel && table.options.getFilteredRowModel) {
|
|
1305
|
+
table._getFilteredRowModel = table.options.getFilteredRowModel(table);
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1305
1308
|
if (table.options.manualFiltering || !table._getFilteredRowModel) {
|
|
1306
1309
|
return table.getPreFilteredRowModel();
|
|
1307
1310
|
}
|
|
@@ -2155,14 +2158,14 @@ const RowSelection = {
|
|
|
2155
2158
|
// return table.options.enableGroupingRowSelection ?? false
|
|
2156
2159
|
// },
|
|
2157
2160
|
getIsAllRowsSelected: () => {
|
|
2158
|
-
const
|
|
2161
|
+
const preGroupedFlatRows = table.getPreGroupedRowModel().flatRows;
|
|
2159
2162
|
const {
|
|
2160
2163
|
rowSelection
|
|
2161
2164
|
} = table.getState();
|
|
2162
|
-
let isAllRowsSelected = Boolean(
|
|
2165
|
+
let isAllRowsSelected = Boolean(preGroupedFlatRows.length && Object.keys(rowSelection).length);
|
|
2163
2166
|
|
|
2164
2167
|
if (isAllRowsSelected) {
|
|
2165
|
-
if (
|
|
2168
|
+
if (preGroupedFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) {
|
|
2166
2169
|
isAllRowsSelected = false;
|
|
2167
2170
|
}
|
|
2168
2171
|
}
|
|
@@ -2932,8 +2935,20 @@ function createTable(options) {
|
|
|
2932
2935
|
|
|
2933
2936
|
defaultColumn = (_defaultColumn = defaultColumn) != null ? _defaultColumn : {};
|
|
2934
2937
|
return {
|
|
2935
|
-
header: props =>
|
|
2936
|
-
|
|
2938
|
+
header: props => {
|
|
2939
|
+
const resolvedColumnDef = props.header.column.columnDef;
|
|
2940
|
+
|
|
2941
|
+
if (resolvedColumnDef.accessorKey) {
|
|
2942
|
+
return resolvedColumnDef.accessorKey;
|
|
2943
|
+
}
|
|
2944
|
+
|
|
2945
|
+
if (resolvedColumnDef.accessorFn) {
|
|
2946
|
+
return resolvedColumnDef.id;
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
return null;
|
|
2950
|
+
},
|
|
2951
|
+
// footer: props => props.header.column.id,
|
|
2937
2952
|
cell: props => {
|
|
2938
2953
|
var _props$renderValue$to, _props$renderValue;
|
|
2939
2954
|
|
|
@@ -2961,7 +2976,8 @@ function createTable(options) {
|
|
|
2961
2976
|
|
|
2962
2977
|
return columnDefs.map(columnDef => {
|
|
2963
2978
|
const column = createColumn(table, columnDef, depth, parent);
|
|
2964
|
-
|
|
2979
|
+
const groupingColumnDef = columnDef;
|
|
2980
|
+
column.columns = groupingColumnDef.columns ? recurseColumns(groupingColumnDef.columns, column, depth + 1) : [];
|
|
2965
2981
|
return column;
|
|
2966
2982
|
});
|
|
2967
2983
|
};
|
|
@@ -3945,15 +3961,18 @@ function mergeProxy() {
|
|
|
3945
3961
|
}, propTraps);
|
|
3946
3962
|
}
|
|
3947
3963
|
|
|
3948
|
-
|
|
3949
|
-
|
|
3964
|
+
const FlexRender = {
|
|
3965
|
+
props: ['render', 'props'],
|
|
3966
|
+
setup: props => {
|
|
3967
|
+
return () => {
|
|
3968
|
+
if (typeof props.render === 'function' || typeof props.render === 'object') {
|
|
3969
|
+
return h(props.render, props.props);
|
|
3970
|
+
}
|
|
3950
3971
|
|
|
3951
|
-
|
|
3952
|
-
|
|
3972
|
+
return props.render;
|
|
3973
|
+
};
|
|
3953
3974
|
}
|
|
3954
|
-
|
|
3955
|
-
return Comp;
|
|
3956
|
-
}
|
|
3975
|
+
};
|
|
3957
3976
|
function useVueTable(options) {
|
|
3958
3977
|
const resolvedOptions = mergeProxy({
|
|
3959
3978
|
state: {},
|
|
@@ -3995,12 +4014,9 @@ function useVueTable(options) {
|
|
|
3995
4014
|
}
|
|
3996
4015
|
});
|
|
3997
4016
|
});
|
|
3998
|
-
});
|
|
3999
|
-
// table.willUpdate()
|
|
4000
|
-
// })
|
|
4001
|
-
|
|
4017
|
+
});
|
|
4002
4018
|
return table;
|
|
4003
4019
|
}
|
|
4004
4020
|
|
|
4005
|
-
export { ColumnSizing, Expanding, Filters, Grouping, Headers, Ordering, Pagination, Pinning, RowSelection, Sorting, Visibility, aggregationFns, buildHeaderGroups, createCell, createColumn, createColumnHelper, createRow, createTable, defaultColumnSizing, expandRows, filterFns, flattenBy,
|
|
4021
|
+
export { ColumnSizing, Expanding, Filters, FlexRender, Grouping, Headers, Ordering, Pagination, Pinning, RowSelection, Sorting, Visibility, aggregationFns, buildHeaderGroups, createCell, createColumn, createColumnHelper, createRow, createTable, defaultColumnSizing, expandRows, filterFns, flattenBy, functionalUpdate, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel, isFunction, isRowSelected, isSubRowSelected, makeStateUpdater, memo, noop, orderColumns, passiveEventSupported, reSplitAlphaNumeric, selectRowsFn, shouldAutoRemoveFilter, sortingFns, useVueTable };
|
|
4006
4022
|
//# sourceMappingURL=index.js.map
|