@tanstack/svelte-table 8.5.17 → 8.5.18

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.
@@ -4024,7 +4024,7 @@ var drawChart = (function (exports) {
4024
4024
  </script>
4025
4025
  <script>
4026
4026
  /*<!--*/
4027
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"packages","children":[{"name":"table-core/build/esm/index.js","uid":"1d0e-163"},{"name":"svelte-table/src","children":[{"uid":"1d0e-165","name":"placeholder.svelte"},{"uid":"1d0e-167","name":"placeholder.ts"},{"uid":"1d0e-169","name":"render-component.ts"},{"uid":"1d0e-171","name":"index.ts"}]}]}]}],"isRoot":true},"nodeParts":{"1d0e-163":{"renderedLength":125390,"gzipLength":22307,"brotliLength":0,"mainUid":"1d0e-162"},"1d0e-165":{"renderedLength":927,"gzipLength":445,"brotliLength":0,"mainUid":"1d0e-164"},"1d0e-167":{"renderedLength":246,"gzipLength":186,"brotliLength":0,"mainUid":"1d0e-166"},"1d0e-169":{"renderedLength":1447,"gzipLength":537,"brotliLength":0,"mainUid":"1d0e-168"},"1d0e-171":{"renderedLength":2930,"gzipLength":948,"brotliLength":0,"mainUid":"1d0e-170"}},"nodeMetas":{"1d0e-162":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"1d0e-163"},"imported":[],"importedBy":[{"uid":"1d0e-170"}]},"1d0e-164":{"id":"/packages/svelte-table/src/placeholder.svelte","moduleParts":{"index.production.js":"1d0e-165"},"imported":[{"uid":"1d0e-172"}],"importedBy":[{"uid":"1d0e-166"}]},"1d0e-166":{"id":"/packages/svelte-table/src/placeholder.ts","moduleParts":{"index.production.js":"1d0e-167"},"imported":[{"uid":"1d0e-172"},{"uid":"1d0e-164"}],"importedBy":[{"uid":"1d0e-170"}]},"1d0e-168":{"id":"/packages/svelte-table/src/render-component.ts","moduleParts":{"index.production.js":"1d0e-169"},"imported":[{"uid":"1d0e-172"}],"importedBy":[{"uid":"1d0e-170"}]},"1d0e-170":{"id":"/packages/svelte-table/src/index.ts","moduleParts":{"index.production.js":"1d0e-171"},"imported":[{"uid":"1d0e-162"},{"uid":"1d0e-166"},{"uid":"1d0e-172"},{"uid":"1d0e-173"},{"uid":"1d0e-168"}],"importedBy":[],"isEntry":true},"1d0e-172":{"id":"svelte/internal","moduleParts":{},"imported":[],"importedBy":[{"uid":"1d0e-170"},{"uid":"1d0e-166"},{"uid":"1d0e-168"},{"uid":"1d0e-164"}],"isExternal":true},"1d0e-173":{"id":"svelte/store","moduleParts":{},"imported":[],"importedBy":[{"uid":"1d0e-170"}],"isExternal":true}},"env":{"rollup":"2.79.1"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4027
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.production.js","children":[{"name":"packages","children":[{"name":"table-core/build/esm/index.js","uid":"0c68-163"},{"name":"svelte-table/src","children":[{"uid":"0c68-165","name":"placeholder.svelte"},{"uid":"0c68-167","name":"placeholder.ts"},{"uid":"0c68-169","name":"render-component.ts"},{"uid":"0c68-171","name":"index.ts"}]}]}]}],"isRoot":true},"nodeParts":{"0c68-163":{"renderedLength":126174,"gzipLength":22385,"brotliLength":0,"mainUid":"0c68-162"},"0c68-165":{"renderedLength":927,"gzipLength":445,"brotliLength":0,"mainUid":"0c68-164"},"0c68-167":{"renderedLength":246,"gzipLength":186,"brotliLength":0,"mainUid":"0c68-166"},"0c68-169":{"renderedLength":1447,"gzipLength":537,"brotliLength":0,"mainUid":"0c68-168"},"0c68-171":{"renderedLength":2930,"gzipLength":948,"brotliLength":0,"mainUid":"0c68-170"}},"nodeMetas":{"0c68-162":{"id":"/packages/table-core/build/esm/index.js","moduleParts":{"index.production.js":"0c68-163"},"imported":[],"importedBy":[{"uid":"0c68-170"}]},"0c68-164":{"id":"/packages/svelte-table/src/placeholder.svelte","moduleParts":{"index.production.js":"0c68-165"},"imported":[{"uid":"0c68-172"}],"importedBy":[{"uid":"0c68-166"}]},"0c68-166":{"id":"/packages/svelte-table/src/placeholder.ts","moduleParts":{"index.production.js":"0c68-167"},"imported":[{"uid":"0c68-172"},{"uid":"0c68-164"}],"importedBy":[{"uid":"0c68-170"}]},"0c68-168":{"id":"/packages/svelte-table/src/render-component.ts","moduleParts":{"index.production.js":"0c68-169"},"imported":[{"uid":"0c68-172"}],"importedBy":[{"uid":"0c68-170"}]},"0c68-170":{"id":"/packages/svelte-table/src/index.ts","moduleParts":{"index.production.js":"0c68-171"},"imported":[{"uid":"0c68-162"},{"uid":"0c68-166"},{"uid":"0c68-172"},{"uid":"0c68-173"},{"uid":"0c68-168"}],"importedBy":[],"isEntry":true},"0c68-172":{"id":"svelte/internal","moduleParts":{},"imported":[],"importedBy":[{"uid":"0c68-170"},{"uid":"0c68-166"},{"uid":"0c68-168"},{"uid":"0c68-164"}],"isExternal":true},"0c68-173":{"id":"svelte/store","moduleParts":{},"imported":[],"importedBy":[{"uid":"0c68-170"}],"isExternal":true}},"env":{"rollup":"2.79.1"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
4028
4028
 
4029
4029
  const run = () => {
4030
4030
  const width = window.innerWidth;
@@ -11,25 +11,25 @@
11
11
  "children": [
12
12
  {
13
13
  "name": "table-core/build/esm/index.js",
14
- "uid": "1d0e-175"
14
+ "uid": "0c68-175"
15
15
  },
16
16
  {
17
17
  "name": "svelte-table/src",
18
18
  "children": [
19
19
  {
20
- "uid": "1d0e-177",
20
+ "uid": "0c68-177",
21
21
  "name": "placeholder.svelte"
22
22
  },
23
23
  {
24
- "uid": "1d0e-179",
24
+ "uid": "0c68-179",
25
25
  "name": "placeholder.ts"
26
26
  },
27
27
  {
28
- "uid": "1d0e-181",
28
+ "uid": "0c68-181",
29
29
  "name": "render-component.ts"
30
30
  },
31
31
  {
32
- "uid": "1d0e-183",
32
+ "uid": "0c68-183",
33
33
  "name": "index.ts"
34
34
  }
35
35
  ]
@@ -42,153 +42,153 @@
42
42
  "isRoot": true
43
43
  },
44
44
  "nodeParts": {
45
- "1d0e-175": {
46
- "renderedLength": 125390,
47
- "gzipLength": 22307,
45
+ "0c68-175": {
46
+ "renderedLength": 126174,
47
+ "gzipLength": 22385,
48
48
  "brotliLength": 0,
49
- "mainUid": "1d0e-174"
49
+ "mainUid": "0c68-174"
50
50
  },
51
- "1d0e-177": {
51
+ "0c68-177": {
52
52
  "renderedLength": 927,
53
53
  "gzipLength": 445,
54
54
  "brotliLength": 0,
55
- "mainUid": "1d0e-176"
55
+ "mainUid": "0c68-176"
56
56
  },
57
- "1d0e-179": {
57
+ "0c68-179": {
58
58
  "renderedLength": 246,
59
59
  "gzipLength": 186,
60
60
  "brotliLength": 0,
61
- "mainUid": "1d0e-178"
61
+ "mainUid": "0c68-178"
62
62
  },
63
- "1d0e-181": {
63
+ "0c68-181": {
64
64
  "renderedLength": 1447,
65
65
  "gzipLength": 537,
66
66
  "brotliLength": 0,
67
- "mainUid": "1d0e-180"
67
+ "mainUid": "0c68-180"
68
68
  },
69
- "1d0e-183": {
69
+ "0c68-183": {
70
70
  "renderedLength": 2930,
71
71
  "gzipLength": 948,
72
72
  "brotliLength": 0,
73
- "mainUid": "1d0e-182"
73
+ "mainUid": "0c68-182"
74
74
  }
75
75
  },
76
76
  "nodeMetas": {
77
- "1d0e-174": {
77
+ "0c68-174": {
78
78
  "id": "/packages/table-core/build/esm/index.js",
79
79
  "moduleParts": {
80
- "index.production.js": "1d0e-175"
80
+ "index.production.js": "0c68-175"
81
81
  },
82
82
  "imported": [],
83
83
  "importedBy": [
84
84
  {
85
- "uid": "1d0e-182"
85
+ "uid": "0c68-182"
86
86
  }
87
87
  ]
88
88
  },
89
- "1d0e-176": {
89
+ "0c68-176": {
90
90
  "id": "/packages/svelte-table/src/placeholder.svelte",
91
91
  "moduleParts": {
92
- "index.production.js": "1d0e-177"
92
+ "index.production.js": "0c68-177"
93
93
  },
94
94
  "imported": [
95
95
  {
96
- "uid": "1d0e-184"
96
+ "uid": "0c68-184"
97
97
  }
98
98
  ],
99
99
  "importedBy": [
100
100
  {
101
- "uid": "1d0e-178"
101
+ "uid": "0c68-178"
102
102
  }
103
103
  ]
104
104
  },
105
- "1d0e-178": {
105
+ "0c68-178": {
106
106
  "id": "/packages/svelte-table/src/placeholder.ts",
107
107
  "moduleParts": {
108
- "index.production.js": "1d0e-179"
108
+ "index.production.js": "0c68-179"
109
109
  },
110
110
  "imported": [
111
111
  {
112
- "uid": "1d0e-184"
112
+ "uid": "0c68-184"
113
113
  },
114
114
  {
115
- "uid": "1d0e-176"
115
+ "uid": "0c68-176"
116
116
  }
117
117
  ],
118
118
  "importedBy": [
119
119
  {
120
- "uid": "1d0e-182"
120
+ "uid": "0c68-182"
121
121
  }
122
122
  ]
123
123
  },
124
- "1d0e-180": {
124
+ "0c68-180": {
125
125
  "id": "/packages/svelte-table/src/render-component.ts",
126
126
  "moduleParts": {
127
- "index.production.js": "1d0e-181"
127
+ "index.production.js": "0c68-181"
128
128
  },
129
129
  "imported": [
130
130
  {
131
- "uid": "1d0e-184"
131
+ "uid": "0c68-184"
132
132
  }
133
133
  ],
134
134
  "importedBy": [
135
135
  {
136
- "uid": "1d0e-182"
136
+ "uid": "0c68-182"
137
137
  }
138
138
  ]
139
139
  },
140
- "1d0e-182": {
140
+ "0c68-182": {
141
141
  "id": "/packages/svelte-table/src/index.ts",
142
142
  "moduleParts": {
143
- "index.production.js": "1d0e-183"
143
+ "index.production.js": "0c68-183"
144
144
  },
145
145
  "imported": [
146
146
  {
147
- "uid": "1d0e-174"
147
+ "uid": "0c68-174"
148
148
  },
149
149
  {
150
- "uid": "1d0e-178"
150
+ "uid": "0c68-178"
151
151
  },
152
152
  {
153
- "uid": "1d0e-184"
153
+ "uid": "0c68-184"
154
154
  },
155
155
  {
156
- "uid": "1d0e-185"
156
+ "uid": "0c68-185"
157
157
  },
158
158
  {
159
- "uid": "1d0e-180"
159
+ "uid": "0c68-180"
160
160
  }
161
161
  ],
162
162
  "importedBy": [],
163
163
  "isEntry": true
164
164
  },
165
- "1d0e-184": {
165
+ "0c68-184": {
166
166
  "id": "svelte/internal",
167
167
  "moduleParts": {},
168
168
  "imported": [],
169
169
  "importedBy": [
170
170
  {
171
- "uid": "1d0e-182"
171
+ "uid": "0c68-182"
172
172
  },
173
173
  {
174
- "uid": "1d0e-178"
174
+ "uid": "0c68-178"
175
175
  },
176
176
  {
177
- "uid": "1d0e-180"
177
+ "uid": "0c68-180"
178
178
  },
179
179
  {
180
- "uid": "1d0e-176"
180
+ "uid": "0c68-176"
181
181
  }
182
182
  ],
183
183
  "isExternal": true
184
184
  },
185
- "1d0e-185": {
185
+ "0c68-185": {
186
186
  "id": "svelte/store",
187
187
  "moduleParts": {},
188
188
  "imported": [],
189
189
  "importedBy": [
190
190
  {
191
- "uid": "1d0e-182"
191
+ "uid": "0c68-182"
192
192
  }
193
193
  ],
194
194
  "isExternal": true
@@ -2674,6 +2674,7 @@
2674
2674
  original,
2675
2675
  depth,
2676
2676
  _valuesCache: {},
2677
+ _uniqueValuesCache: {},
2677
2678
  getValue: columnId => {
2678
2679
  if (row._valuesCache.hasOwnProperty(columnId)) {
2679
2680
  return row._valuesCache[columnId];
@@ -2685,6 +2686,21 @@
2685
2686
  row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
2686
2687
  return row._valuesCache[columnId];
2687
2688
  },
2689
+ getUniqueValues: columnId => {
2690
+ if (row._uniqueValuesCache.hasOwnProperty(columnId)) {
2691
+ return row._uniqueValuesCache[columnId];
2692
+ }
2693
+ const column = table.getColumn(columnId);
2694
+ if (!column.accessorFn) {
2695
+ return undefined;
2696
+ }
2697
+ if (!column.columnDef.getUniqueValues) {
2698
+ row._uniqueValuesCache[columnId] = [row.getValue(columnId)];
2699
+ return row._uniqueValuesCache[columnId];
2700
+ }
2701
+ row._uniqueValuesCache[columnId] = column.columnDef.getUniqueValues(row.original, rowIndex);
2702
+ return row._uniqueValuesCache[columnId];
2703
+ },
2688
2704
  renderValue: columnId => row.getValue(columnId) ?? table.options.renderFallbackValue,
2689
2705
  subRows: subRows ?? [],
2690
2706
  getLeafRows: () => flattenBy(row.subRows, d => d.subRows),
@@ -3025,12 +3041,14 @@
3025
3041
  return (table, columnId) => memo(() => [table.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3026
3042
  let facetedUniqueValues = new Map();
3027
3043
  for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
3028
- var _facetedRowModel$flat;
3029
- const value = (_facetedRowModel$flat = facetedRowModel.flatRows[i]) == null ? void 0 : _facetedRowModel$flat.getValue(columnId);
3030
- if (facetedUniqueValues.has(value)) {
3031
- facetedUniqueValues.set(value, (facetedUniqueValues.get(value) ?? 0) + 1);
3032
- } else {
3033
- facetedUniqueValues.set(value, 1);
3044
+ const values = facetedRowModel.flatRows[i].getUniqueValues(columnId);
3045
+ for (let j = 0; j < values.length; j++) {
3046
+ const value = values[j];
3047
+ if (facetedUniqueValues.has(value)) {
3048
+ facetedUniqueValues.set(value, (facetedUniqueValues.get(value) ?? 0) + 1);
3049
+ } else {
3050
+ facetedUniqueValues.set(value, 1);
3051
+ }
3034
3052
  }
3035
3053
  }
3036
3054
  return facetedUniqueValues;
@@ -3044,17 +3062,20 @@
3044
3062
  function getFacetedMinMaxValues() {
3045
3063
  return (table, columnId) => memo(() => [table.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3046
3064
  var _facetedRowModel$flat;
3047
- const firstValue = (_facetedRowModel$flat = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat.getValue(columnId);
3065
+ const firstValue = (_facetedRowModel$flat = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat.getUniqueValues(columnId);
3048
3066
  if (typeof firstValue === 'undefined') {
3049
3067
  return undefined;
3050
3068
  }
3051
3069
  let facetedMinMaxValues = [firstValue, firstValue];
3052
3070
  for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
3053
- const value = facetedRowModel.flatRows[i].getValue(columnId);
3054
- if (value < facetedMinMaxValues[0]) {
3055
- facetedMinMaxValues[0] = value;
3056
- } else if (value > facetedMinMaxValues[1]) {
3057
- facetedMinMaxValues[1] = value;
3071
+ const values = facetedRowModel.flatRows[i].getUniqueValues(columnId);
3072
+ for (let j = 0; j < values.length; j++) {
3073
+ const value = values[j];
3074
+ if (value < facetedMinMaxValues[0]) {
3075
+ facetedMinMaxValues[0] = value;
3076
+ } else if (value > facetedMinMaxValues[1]) {
3077
+ facetedMinMaxValues[1] = value;
3078
+ }
3058
3079
  }
3059
3080
  }
3060
3081
  return facetedMinMaxValues;