@tanstack/svelte-table 8.2.4 → 8.3.0
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/svelte-table/src/index.js +1 -0
- package/build/cjs/svelte-table/src/index.js.map +1 -1
- package/build/cjs/table-core/build/esm/index.js +69 -5
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +70 -7
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1451 -106
- package/build/stats-react.json +48 -48
- package/build/umd/index.development.js +69 -5
- 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/build/esm/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import { SvelteComponent, init, safe_not_equal, text as text$1, claim_text, insert_hydration, set_data, noop as noop$1, detach, create_ssr_component, escape, create_component, claim_component, mount_component, transition_in, transition_out, destroy_component
|
|
11
|
+
import { SvelteComponent, init, safe_not_equal, text as text$1, claim_text, insert_hydration, set_data, noop as noop$1, detach, create_ssr_component, escape, validate_component, create_component, claim_component, mount_component, transition_in, transition_out, destroy_component } from 'svelte/internal';
|
|
12
12
|
import { readable, get, writable, derived } from 'svelte/store';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -21,6 +21,9 @@ import { readable, get, writable, derived } from 'svelte/store';
|
|
|
21
21
|
*
|
|
22
22
|
* @license MIT
|
|
23
23
|
*/
|
|
24
|
+
// Is this type a tuple?
|
|
25
|
+
// If this type is a tuple, what indices are allowed?
|
|
26
|
+
///
|
|
24
27
|
function functionalUpdate(updater, input) {
|
|
25
28
|
return typeof updater === 'function' ? updater(input) : updater;
|
|
26
29
|
}
|
|
@@ -106,13 +109,27 @@ function createColumn(table, columnDef, depth, parent) {
|
|
|
106
109
|
const resolvedColumnDef = { ...defaultColumn,
|
|
107
110
|
...columnDef
|
|
108
111
|
};
|
|
109
|
-
|
|
112
|
+
const accessorKey = resolvedColumnDef.accessorKey;
|
|
113
|
+
let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : accessorKey ? accessorKey.replace('.', '_') : undefined) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined;
|
|
110
114
|
let accessorFn;
|
|
111
115
|
|
|
112
116
|
if (resolvedColumnDef.accessorFn) {
|
|
113
117
|
accessorFn = resolvedColumnDef.accessorFn;
|
|
114
|
-
} else if (
|
|
115
|
-
|
|
118
|
+
} else if (accessorKey) {
|
|
119
|
+
// Support deep accessor keys
|
|
120
|
+
if (accessorKey.includes('.')) {
|
|
121
|
+
accessorFn = originalRow => {
|
|
122
|
+
let result = originalRow;
|
|
123
|
+
|
|
124
|
+
for (const key of accessorKey.split('.')) {
|
|
125
|
+
result = result[key];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return result;
|
|
129
|
+
};
|
|
130
|
+
} else {
|
|
131
|
+
accessorFn = originalRow => originalRow[resolvedColumnDef.accessorKey];
|
|
132
|
+
}
|
|
116
133
|
}
|
|
117
134
|
|
|
118
135
|
if (!id) {
|
|
@@ -962,7 +979,7 @@ const Expanding = {
|
|
|
962
979
|
getCanExpand: () => {
|
|
963
980
|
var _table$options$getRow, _table$options$enable, _row$subRows;
|
|
964
981
|
|
|
965
|
-
return (
|
|
982
|
+
return (_table$options$getRow = table.options.getRowCanExpand == null ? void 0 : table.options.getRowCanExpand(row)) != null ? _table$options$getRow : ((_table$options$enable = table.options.enableExpanding) != null ? _table$options$enable : true) && !!((_row$subRows = row.subRows) != null && _row$subRows.length);
|
|
966
983
|
},
|
|
967
984
|
getToggleExpandedHandler: () => {
|
|
968
985
|
const canExpand = row.getCanExpand();
|
|
@@ -1108,7 +1125,7 @@ const Filters = {
|
|
|
1108
1125
|
var _table$getCoreRowMode, _table$getCoreRowMode2;
|
|
1109
1126
|
|
|
1110
1127
|
const value = (_table$getCoreRowMode = table.getCoreRowModel().flatRows[0]) == null ? void 0 : (_table$getCoreRowMode2 = _table$getCoreRowMode._getAllCellsByColumnId()[column.id]) == null ? void 0 : _table$getCoreRowMode2.getValue();
|
|
1111
|
-
return typeof value === 'string';
|
|
1128
|
+
return typeof value === 'string' || typeof value === 'number';
|
|
1112
1129
|
}
|
|
1113
1130
|
};
|
|
1114
1131
|
},
|
|
@@ -3102,6 +3119,52 @@ const createRow = (table, id, original, rowIndex, depth, subRows) => {
|
|
|
3102
3119
|
return row;
|
|
3103
3120
|
};
|
|
3104
3121
|
|
|
3122
|
+
// type Person = {
|
|
3123
|
+
// firstName: string
|
|
3124
|
+
// lastName: string
|
|
3125
|
+
// age: number
|
|
3126
|
+
// visits: number
|
|
3127
|
+
// status: string
|
|
3128
|
+
// progress: number
|
|
3129
|
+
// nested: {
|
|
3130
|
+
// foo: [
|
|
3131
|
+
// {
|
|
3132
|
+
// bar: 'bar'
|
|
3133
|
+
// }
|
|
3134
|
+
// ]
|
|
3135
|
+
// bar: { subBar: boolean }[]
|
|
3136
|
+
// baz: {
|
|
3137
|
+
// foo: 'foo'
|
|
3138
|
+
// bar: {
|
|
3139
|
+
// baz: 'baz'
|
|
3140
|
+
// }
|
|
3141
|
+
// }
|
|
3142
|
+
// }
|
|
3143
|
+
// }
|
|
3144
|
+
// const test: DeepKeys<Person> = 'nested.foo.0.bar'
|
|
3145
|
+
// const test2: DeepKeys<Person> = 'nested.bar'
|
|
3146
|
+
// const helper = createColumnHelper<Person>()
|
|
3147
|
+
// helper.accessor('nested.foo', {
|
|
3148
|
+
// cell: info => info.getValue(),
|
|
3149
|
+
// })
|
|
3150
|
+
// helper.accessor('nested.foo.0.bar', {
|
|
3151
|
+
// cell: info => info.getValue(),
|
|
3152
|
+
// })
|
|
3153
|
+
// helper.accessor('nested.bar', {
|
|
3154
|
+
// cell: info => info.getValue(),
|
|
3155
|
+
// })
|
|
3156
|
+
function createColumnHelper() {
|
|
3157
|
+
return {
|
|
3158
|
+
accessor: (accessor, column) => {
|
|
3159
|
+
return typeof accessor === 'function' ? { ...column,
|
|
3160
|
+
accessorFn: accessor
|
|
3161
|
+
} : { ...column,
|
|
3162
|
+
accessorKey: accessor
|
|
3163
|
+
};
|
|
3164
|
+
}
|
|
3165
|
+
};
|
|
3166
|
+
}
|
|
3167
|
+
|
|
3105
3168
|
function getCoreRowModel() {
|
|
3106
3169
|
return table => memo(() => [table.options.data], data => {
|
|
3107
3170
|
const rowModel = {
|
|
@@ -4005,5 +4068,5 @@ function createSvelteTable(options) {
|
|
|
4005
4068
|
return tableReadable;
|
|
4006
4069
|
}
|
|
4007
4070
|
|
|
4008
|
-
export { ColumnSizing, Expanding, Filters, Grouping, Headers, Ordering, Pagination, Pinning, RowSelection, Sorting, Visibility, aggregationFns, buildHeaderGroups, createColumn, createRow, createSvelteTable, createTable, defaultColumnSizing, expandRows, filterFns, flattenBy, flexRender, functionalUpdate, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel, isFunction, isRowSelected, isSubRowSelected, makeStateUpdater, memo, noop, orderColumns, passiveEventSupported, reSplitAlphaNumeric, renderComponent, selectRowsFn, shouldAutoRemoveFilter, sortingFns };
|
|
4071
|
+
export { ColumnSizing, Expanding, Filters, Grouping, Headers, Ordering, Pagination, Pinning, RowSelection, Sorting, Visibility, aggregationFns, buildHeaderGroups, createColumn, createColumnHelper, createRow, createSvelteTable, createTable, defaultColumnSizing, expandRows, filterFns, flattenBy, flexRender, functionalUpdate, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel, isFunction, isRowSelected, isSubRowSelected, makeStateUpdater, memo, noop, orderColumns, passiveEventSupported, reSplitAlphaNumeric, renderComponent, selectRowsFn, shouldAutoRemoveFilter, sortingFns };
|
|
4009
4072
|
//# sourceMappingURL=index.js.map
|