@tanstack/svelte-table 8.2.6 → 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 +67 -3
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +68 -5
- 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 +67 -3
- 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) {
|
|
@@ -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
|