@tanstack/svelte-table 8.2.1 → 8.2.4
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 +62 -33
- package/build/cjs/table-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +62 -33
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +47 -47
- package/build/umd/index.development.js +62 -33
- 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/stats-html.html
CHANGED
|
@@ -2669,7 +2669,7 @@ var drawChart = (function (exports) {
|
|
|
2669
2669
|
</script>
|
|
2670
2670
|
<script>
|
|
2671
2671
|
/*<!--*/
|
|
2672
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"packages","children":[{"name":"table-core/build/esm/index.js","uid":"
|
|
2672
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"packages","children":[{"name":"table-core/build/esm/index.js","uid":"cc9e-159"},{"name":"svelte-table/src","children":[{"uid":"cc9e-161","name":"placeholder.svelte"},{"uid":"cc9e-163","name":"placeholder.ts"},{"uid":"cc9e-165","name":"render-component.ts"},{"uid":"cc9e-167","name":"index.ts"}]}]}]}],"isRoot":true},"nodeParts":{"cc9e-159":{"renderedLength":135089,"gzipLength":23288,"brotliLength":0,"mainUid":"cc9e-158"},"cc9e-161":{"renderedLength":927,"gzipLength":445,"brotliLength":0,"mainUid":"cc9e-160"},"cc9e-163":{"renderedLength":246,"gzipLength":184,"brotliLength":0,"mainUid":"cc9e-162"},"cc9e-165":{"renderedLength":1458,"gzipLength":539,"brotliLength":0,"mainUid":"cc9e-164"},"cc9e-167":{"renderedLength":2915,"gzipLength":958,"brotliLength":0,"mainUid":"cc9e-166"}},"nodeMetas":{"cc9e-158":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"cc9e-159"},"imported":[],"importedBy":[{"uid":"cc9e-166"}]},"cc9e-160":{"id":"/packages/svelte-table/src/placeholder.svelte","moduleParts":{"index.production.js":"cc9e-161"},"imported":[{"uid":"cc9e-168"}],"importedBy":[{"uid":"cc9e-162"}]},"cc9e-162":{"id":"/packages/svelte-table/src/placeholder.ts","moduleParts":{"index.production.js":"cc9e-163"},"imported":[{"uid":"cc9e-168"},{"uid":"cc9e-160"}],"importedBy":[{"uid":"cc9e-166"}]},"cc9e-164":{"id":"/packages/svelte-table/src/render-component.ts","moduleParts":{"index.production.js":"cc9e-165"},"imported":[{"uid":"cc9e-168"}],"importedBy":[{"uid":"cc9e-166"}]},"cc9e-166":{"id":"/packages/svelte-table/src/index.ts","moduleParts":{"index.production.js":"cc9e-167"},"imported":[{"uid":"cc9e-158"},{"uid":"cc9e-162"},{"uid":"cc9e-168"},{"uid":"cc9e-169"},{"uid":"cc9e-164"}],"importedBy":[],"isEntry":true},"cc9e-168":{"id":"svelte/internal","moduleParts":{},"imported":[],"importedBy":[{"uid":"cc9e-166"},{"uid":"cc9e-162"},{"uid":"cc9e-164"},{"uid":"cc9e-160"}],"isExternal":true},"cc9e-169":{"id":"svelte/store","moduleParts":{},"imported":[],"importedBy":[{"uid":"cc9e-166"}],"isExternal":true}},"env":{"rollup":"2.76.0"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
2673
2673
|
|
|
2674
2674
|
const run = () => {
|
|
2675
2675
|
const width = window.innerWidth;
|
package/build/stats-react.json
CHANGED
|
@@ -11,25 +11,25 @@
|
|
|
11
11
|
"children": [
|
|
12
12
|
{
|
|
13
13
|
"name": "table-core/build/esm/index.js",
|
|
14
|
-
"uid": "
|
|
14
|
+
"uid": "cc9e-171"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"name": "svelte-table/src",
|
|
18
18
|
"children": [
|
|
19
19
|
{
|
|
20
|
-
"uid": "
|
|
20
|
+
"uid": "cc9e-173",
|
|
21
21
|
"name": "placeholder.svelte"
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
"uid": "
|
|
24
|
+
"uid": "cc9e-175",
|
|
25
25
|
"name": "placeholder.ts"
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
|
-
"uid": "
|
|
28
|
+
"uid": "cc9e-177",
|
|
29
29
|
"name": "render-component.ts"
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
|
-
"uid": "
|
|
32
|
+
"uid": "cc9e-179",
|
|
33
33
|
"name": "index.ts"
|
|
34
34
|
}
|
|
35
35
|
]
|
|
@@ -42,153 +42,153 @@
|
|
|
42
42
|
"isRoot": true
|
|
43
43
|
},
|
|
44
44
|
"nodeParts": {
|
|
45
|
-
"
|
|
46
|
-
"renderedLength":
|
|
47
|
-
"gzipLength":
|
|
45
|
+
"cc9e-171": {
|
|
46
|
+
"renderedLength": 135089,
|
|
47
|
+
"gzipLength": 23288,
|
|
48
48
|
"brotliLength": 0,
|
|
49
|
-
"mainUid": "
|
|
49
|
+
"mainUid": "cc9e-170"
|
|
50
50
|
},
|
|
51
|
-
"
|
|
51
|
+
"cc9e-173": {
|
|
52
52
|
"renderedLength": 927,
|
|
53
53
|
"gzipLength": 445,
|
|
54
54
|
"brotliLength": 0,
|
|
55
|
-
"mainUid": "
|
|
55
|
+
"mainUid": "cc9e-172"
|
|
56
56
|
},
|
|
57
|
-
"
|
|
57
|
+
"cc9e-175": {
|
|
58
58
|
"renderedLength": 246,
|
|
59
59
|
"gzipLength": 184,
|
|
60
60
|
"brotliLength": 0,
|
|
61
|
-
"mainUid": "
|
|
61
|
+
"mainUid": "cc9e-174"
|
|
62
62
|
},
|
|
63
|
-
"
|
|
63
|
+
"cc9e-177": {
|
|
64
64
|
"renderedLength": 1458,
|
|
65
65
|
"gzipLength": 539,
|
|
66
66
|
"brotliLength": 0,
|
|
67
|
-
"mainUid": "
|
|
67
|
+
"mainUid": "cc9e-176"
|
|
68
68
|
},
|
|
69
|
-
"
|
|
69
|
+
"cc9e-179": {
|
|
70
70
|
"renderedLength": 2915,
|
|
71
71
|
"gzipLength": 958,
|
|
72
72
|
"brotliLength": 0,
|
|
73
|
-
"mainUid": "
|
|
73
|
+
"mainUid": "cc9e-178"
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
"nodeMetas": {
|
|
77
|
-
"
|
|
77
|
+
"cc9e-170": {
|
|
78
78
|
"id": "/packages/table-core/build/esm/index.js",
|
|
79
79
|
"moduleParts": {
|
|
80
|
-
"index.production.js": "
|
|
80
|
+
"index.production.js": "cc9e-171"
|
|
81
81
|
},
|
|
82
82
|
"imported": [],
|
|
83
83
|
"importedBy": [
|
|
84
84
|
{
|
|
85
|
-
"uid": "
|
|
85
|
+
"uid": "cc9e-178"
|
|
86
86
|
}
|
|
87
87
|
]
|
|
88
88
|
},
|
|
89
|
-
"
|
|
89
|
+
"cc9e-172": {
|
|
90
90
|
"id": "/packages/svelte-table/src/placeholder.svelte",
|
|
91
91
|
"moduleParts": {
|
|
92
|
-
"index.production.js": "
|
|
92
|
+
"index.production.js": "cc9e-173"
|
|
93
93
|
},
|
|
94
94
|
"imported": [
|
|
95
95
|
{
|
|
96
|
-
"uid": "
|
|
96
|
+
"uid": "cc9e-180"
|
|
97
97
|
}
|
|
98
98
|
],
|
|
99
99
|
"importedBy": [
|
|
100
100
|
{
|
|
101
|
-
"uid": "
|
|
101
|
+
"uid": "cc9e-174"
|
|
102
102
|
}
|
|
103
103
|
]
|
|
104
104
|
},
|
|
105
|
-
"
|
|
105
|
+
"cc9e-174": {
|
|
106
106
|
"id": "/packages/svelte-table/src/placeholder.ts",
|
|
107
107
|
"moduleParts": {
|
|
108
|
-
"index.production.js": "
|
|
108
|
+
"index.production.js": "cc9e-175"
|
|
109
109
|
},
|
|
110
110
|
"imported": [
|
|
111
111
|
{
|
|
112
|
-
"uid": "
|
|
112
|
+
"uid": "cc9e-180"
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
|
-
"uid": "
|
|
115
|
+
"uid": "cc9e-172"
|
|
116
116
|
}
|
|
117
117
|
],
|
|
118
118
|
"importedBy": [
|
|
119
119
|
{
|
|
120
|
-
"uid": "
|
|
120
|
+
"uid": "cc9e-178"
|
|
121
121
|
}
|
|
122
122
|
]
|
|
123
123
|
},
|
|
124
|
-
"
|
|
124
|
+
"cc9e-176": {
|
|
125
125
|
"id": "/packages/svelte-table/src/render-component.ts",
|
|
126
126
|
"moduleParts": {
|
|
127
|
-
"index.production.js": "
|
|
127
|
+
"index.production.js": "cc9e-177"
|
|
128
128
|
},
|
|
129
129
|
"imported": [
|
|
130
130
|
{
|
|
131
|
-
"uid": "
|
|
131
|
+
"uid": "cc9e-180"
|
|
132
132
|
}
|
|
133
133
|
],
|
|
134
134
|
"importedBy": [
|
|
135
135
|
{
|
|
136
|
-
"uid": "
|
|
136
|
+
"uid": "cc9e-178"
|
|
137
137
|
}
|
|
138
138
|
]
|
|
139
139
|
},
|
|
140
|
-
"
|
|
140
|
+
"cc9e-178": {
|
|
141
141
|
"id": "/packages/svelte-table/src/index.ts",
|
|
142
142
|
"moduleParts": {
|
|
143
|
-
"index.production.js": "
|
|
143
|
+
"index.production.js": "cc9e-179"
|
|
144
144
|
},
|
|
145
145
|
"imported": [
|
|
146
146
|
{
|
|
147
|
-
"uid": "
|
|
147
|
+
"uid": "cc9e-170"
|
|
148
148
|
},
|
|
149
149
|
{
|
|
150
|
-
"uid": "
|
|
150
|
+
"uid": "cc9e-174"
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
|
-
"uid": "
|
|
153
|
+
"uid": "cc9e-180"
|
|
154
154
|
},
|
|
155
155
|
{
|
|
156
|
-
"uid": "
|
|
156
|
+
"uid": "cc9e-181"
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
|
-
"uid": "
|
|
159
|
+
"uid": "cc9e-176"
|
|
160
160
|
}
|
|
161
161
|
],
|
|
162
162
|
"importedBy": [],
|
|
163
163
|
"isEntry": true
|
|
164
164
|
},
|
|
165
|
-
"
|
|
165
|
+
"cc9e-180": {
|
|
166
166
|
"id": "svelte/internal",
|
|
167
167
|
"moduleParts": {},
|
|
168
168
|
"imported": [],
|
|
169
169
|
"importedBy": [
|
|
170
170
|
{
|
|
171
|
-
"uid": "
|
|
171
|
+
"uid": "cc9e-178"
|
|
172
172
|
},
|
|
173
173
|
{
|
|
174
|
-
"uid": "
|
|
174
|
+
"uid": "cc9e-174"
|
|
175
175
|
},
|
|
176
176
|
{
|
|
177
|
-
"uid": "
|
|
177
|
+
"uid": "cc9e-176"
|
|
178
178
|
},
|
|
179
179
|
{
|
|
180
|
-
"uid": "
|
|
180
|
+
"uid": "cc9e-172"
|
|
181
181
|
}
|
|
182
182
|
],
|
|
183
183
|
"isExternal": true
|
|
184
184
|
},
|
|
185
|
-
"
|
|
185
|
+
"cc9e-181": {
|
|
186
186
|
"id": "svelte/store",
|
|
187
187
|
"moduleParts": {},
|
|
188
188
|
"imported": [],
|
|
189
189
|
"importedBy": [
|
|
190
190
|
{
|
|
191
|
-
"uid": "
|
|
191
|
+
"uid": "cc9e-178"
|
|
192
192
|
}
|
|
193
193
|
],
|
|
194
194
|
"isExternal": true
|
|
@@ -1993,6 +1993,10 @@
|
|
|
1993
1993
|
|
|
1994
1994
|
if (value) {
|
|
1995
1995
|
preGroupedFlatRows.forEach(row => {
|
|
1996
|
+
if (!row.getCanSelect()) {
|
|
1997
|
+
return;
|
|
1998
|
+
}
|
|
1999
|
+
|
|
1996
2000
|
rowSelection[row.id] = true;
|
|
1997
2001
|
});
|
|
1998
2002
|
} else {
|
|
@@ -2256,8 +2260,8 @@
|
|
|
2256
2260
|
const mutateRowIsSelected = (selectedRowIds, id, value, table) => {
|
|
2257
2261
|
var _row$subRows;
|
|
2258
2262
|
|
|
2259
|
-
const row = table.getRow(id);
|
|
2260
|
-
|
|
2263
|
+
const row = table.getRow(id); // const isGrouped = row.getIsGrouped()
|
|
2264
|
+
// if ( // TODO: enforce grouping row selection rules
|
|
2261
2265
|
// !isGrouped ||
|
|
2262
2266
|
// (isGrouped && table.options.enableGroupingRowSelection)
|
|
2263
2267
|
// ) {
|
|
@@ -2267,7 +2271,9 @@
|
|
|
2267
2271
|
Object.keys(selectedRowIds).forEach(key => delete selectedRowIds[key]);
|
|
2268
2272
|
}
|
|
2269
2273
|
|
|
2270
|
-
|
|
2274
|
+
if (row.getCanSelect()) {
|
|
2275
|
+
selectedRowIds[id] = true;
|
|
2276
|
+
}
|
|
2271
2277
|
} else {
|
|
2272
2278
|
delete selectedRowIds[id];
|
|
2273
2279
|
} // }
|
|
@@ -2363,7 +2369,12 @@
|
|
|
2363
2369
|
};
|
|
2364
2370
|
|
|
2365
2371
|
const datetime = (rowA, rowB, columnId) => {
|
|
2366
|
-
|
|
2372
|
+
const a = rowA.getValue(columnId);
|
|
2373
|
+
const b = rowB.getValue(columnId); // Can handle nullish values
|
|
2374
|
+
// Use > and < because == (and ===) doesn't work with
|
|
2375
|
+
// Date objects (would require calling getTime()).
|
|
2376
|
+
|
|
2377
|
+
return a > b ? 1 : a < b ? -1 : 0;
|
|
2367
2378
|
};
|
|
2368
2379
|
|
|
2369
2380
|
const basic = (rowA, rowB, columnId) => {
|
|
@@ -2524,18 +2535,17 @@
|
|
|
2524
2535
|
// }
|
|
2525
2536
|
// this needs to be outside of table.setSorting to be in sync with rerender
|
|
2526
2537
|
const nextSortingOrder = column.getNextSortingOrder();
|
|
2538
|
+
const hasManualValue = typeof desc !== 'undefined' && desc !== null;
|
|
2527
2539
|
table.setSorting(old => {
|
|
2528
|
-
var _table$options$enable, _table$options$enable2;
|
|
2529
|
-
|
|
2530
2540
|
// Find any existing sorting for this column
|
|
2531
2541
|
const existingSorting = old == null ? void 0 : old.find(d => d.id === column.id);
|
|
2532
2542
|
const existingIndex = old == null ? void 0 : old.findIndex(d => d.id === column.id);
|
|
2533
|
-
const hasDescDefined = typeof desc !== 'undefined' && desc !== null;
|
|
2534
2543
|
let newSorting = []; // What should we do with this sort action?
|
|
2535
2544
|
|
|
2536
2545
|
let sortAction;
|
|
2546
|
+
let nextDesc = hasManualValue ? desc : nextSortingOrder === 'desc'; // Multi-mode
|
|
2537
2547
|
|
|
2538
|
-
if (column.getCanMultiSort() && multi) {
|
|
2548
|
+
if (old != null && old.length && column.getCanMultiSort() && multi) {
|
|
2539
2549
|
if (existingSorting) {
|
|
2540
2550
|
sortAction = 'toggle';
|
|
2541
2551
|
} else {
|
|
@@ -2553,63 +2563,71 @@
|
|
|
2553
2563
|
} // Handle toggle states that will remove the sorting
|
|
2554
2564
|
|
|
2555
2565
|
|
|
2556
|
-
if (sortAction === 'toggle'
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2566
|
+
if (sortAction === 'toggle') {
|
|
2567
|
+
// If we are "actually" toggling (not a manual set value), should we remove the sorting?
|
|
2568
|
+
if (!hasManualValue) {
|
|
2569
|
+
// Is our intention to remove?
|
|
2570
|
+
if (!nextSortingOrder) {
|
|
2571
|
+
sortAction = 'remove';
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
2563
2574
|
}
|
|
2564
2575
|
|
|
2565
|
-
if (sortAction === '
|
|
2566
|
-
newSorting = [{
|
|
2567
|
-
id: column.id,
|
|
2568
|
-
desc: hasDescDefined ? desc : nextSortingOrder === 'desc'
|
|
2569
|
-
}];
|
|
2570
|
-
} else if (sortAction === 'add' && old != null && old.length) {
|
|
2576
|
+
if (sortAction === 'add') {
|
|
2571
2577
|
var _table$options$maxMul;
|
|
2572
2578
|
|
|
2573
2579
|
newSorting = [...old, {
|
|
2574
2580
|
id: column.id,
|
|
2575
|
-
desc:
|
|
2581
|
+
desc: nextDesc
|
|
2576
2582
|
}]; // Take latest n columns
|
|
2577
2583
|
|
|
2578
2584
|
newSorting.splice(0, newSorting.length - ((_table$options$maxMul = table.options.maxMultiSortColCount) != null ? _table$options$maxMul : Number.MAX_SAFE_INTEGER));
|
|
2579
|
-
} else if (sortAction === 'toggle'
|
|
2585
|
+
} else if (sortAction === 'toggle') {
|
|
2580
2586
|
// This flips (or sets) the
|
|
2581
2587
|
newSorting = old.map(d => {
|
|
2582
2588
|
if (d.id === column.id) {
|
|
2583
2589
|
return { ...d,
|
|
2584
|
-
desc:
|
|
2590
|
+
desc: nextDesc
|
|
2585
2591
|
};
|
|
2586
2592
|
}
|
|
2587
2593
|
|
|
2588
2594
|
return d;
|
|
2589
2595
|
});
|
|
2590
|
-
} else if (sortAction === 'remove'
|
|
2596
|
+
} else if (sortAction === 'remove') {
|
|
2591
2597
|
newSorting = old.filter(d => d.id !== column.id);
|
|
2598
|
+
} else {
|
|
2599
|
+
newSorting = [{
|
|
2600
|
+
id: column.id,
|
|
2601
|
+
desc: nextDesc
|
|
2602
|
+
}];
|
|
2592
2603
|
}
|
|
2593
2604
|
|
|
2594
2605
|
return newSorting;
|
|
2595
2606
|
});
|
|
2596
2607
|
},
|
|
2597
|
-
|
|
2608
|
+
getFirstSortDir: () => {
|
|
2598
2609
|
var _ref, _column$columnDef$sor;
|
|
2599
2610
|
|
|
2600
2611
|
const sortDescFirst = (_ref = (_column$columnDef$sor = column.columnDef.sortDescFirst) != null ? _column$columnDef$sor : table.options.sortDescFirst) != null ? _ref : column.getAutoSortDir() === 'desc';
|
|
2601
|
-
|
|
2612
|
+
return sortDescFirst ? 'desc' : 'asc';
|
|
2613
|
+
},
|
|
2614
|
+
getNextSortingOrder: multi => {
|
|
2615
|
+
var _table$options$enable, _table$options$enable2;
|
|
2616
|
+
|
|
2617
|
+
const firstSortDirection = column.getFirstSortDir();
|
|
2602
2618
|
const isSorted = column.getIsSorted();
|
|
2603
2619
|
|
|
2604
2620
|
if (!isSorted) {
|
|
2605
2621
|
return firstSortDirection;
|
|
2606
2622
|
}
|
|
2607
2623
|
|
|
2608
|
-
if (isSorted
|
|
2609
|
-
|
|
2610
|
-
|
|
2624
|
+
if (isSorted !== firstSortDirection && ((_table$options$enable = table.options.enableSortingRemoval) != null ? _table$options$enable : true) && ( // If enableSortRemove, enable in general
|
|
2625
|
+
multi ? (_table$options$enable2 = table.options.enableMultiRemove) != null ? _table$options$enable2 : true : true) // If multi, don't allow if enableMultiRemove))
|
|
2626
|
+
) {
|
|
2611
2627
|
return false;
|
|
2612
2628
|
}
|
|
2629
|
+
|
|
2630
|
+
return isSorted === 'desc' ? 'asc' : 'desc';
|
|
2613
2631
|
},
|
|
2614
2632
|
getCanSort: () => {
|
|
2615
2633
|
var _column$columnDef$ena, _table$options$enable3;
|
|
@@ -3556,9 +3574,20 @@
|
|
|
3556
3574
|
depth = 0;
|
|
3557
3575
|
}
|
|
3558
3576
|
|
|
3559
|
-
//
|
|
3560
|
-
|
|
3561
|
-
|
|
3577
|
+
// Grouping depth has been been met
|
|
3578
|
+
// Stop grouping and simply rewrite thd depth and row relationships
|
|
3579
|
+
if (depth >= existingGrouping.length) {
|
|
3580
|
+
return rows.map(row => {
|
|
3581
|
+
row.depth = depth;
|
|
3582
|
+
groupedFlatRows.push(row);
|
|
3583
|
+
groupedRowsById[row.id] = row;
|
|
3584
|
+
|
|
3585
|
+
if (row.subRows) {
|
|
3586
|
+
row.subRows = groupUpRecursively(row.subRows, depth + 1);
|
|
3587
|
+
}
|
|
3588
|
+
|
|
3589
|
+
return row;
|
|
3590
|
+
});
|
|
3562
3591
|
}
|
|
3563
3592
|
|
|
3564
3593
|
const columnId = existingGrouping[depth]; // Group the rows together for this level
|