@tanstack/svelte-table 8.7.6 → 8.7.8

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.
@@ -13,7 +13,7 @@ export * from '@tanstack/table-core';
13
13
  import { SvelteComponent, init, safe_not_equal, text, claim_text, insert_hydration, set_data, noop, detach, create_ssr_component, escape, validate_component, create_component, claim_component, mount_component, transition_in, transition_out, destroy_component } from 'svelte/internal';
14
14
  import { readable, get, writable, derived } from 'svelte/store';
15
15
 
16
- /* packages/svelte-table/src/placeholder.svelte generated by Svelte v3.55.0 */
16
+ /* packages/svelte-table/src/placeholder.svelte generated by Svelte v3.55.1 */
17
17
 
18
18
  function create_fragment$1(ctx) {
19
19
  let t;
@@ -13,7 +13,7 @@ export * from '@tanstack/table-core';
13
13
  import { SvelteComponent, init, safe_not_equal, text, claim_text, insert_hydration, set_data, noop, detach, create_ssr_component, escape, validate_component, create_component, claim_component, mount_component, transition_in, transition_out, destroy_component } from 'svelte/internal';
14
14
  import { readable, get, writable, derived } from 'svelte/store';
15
15
 
16
- /* packages/svelte-table/src/placeholder.svelte generated by Svelte v3.55.0 */
16
+ /* packages/svelte-table/src/placeholder.svelte generated by Svelte v3.55.1 */
17
17
 
18
18
  function create_fragment$1(ctx) {
19
19
  let t;
@@ -14,7 +14,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
14
14
 
15
15
  var internal = require('svelte/internal');
16
16
 
17
- /* packages/svelte-table/src/placeholder.svelte generated by Svelte v3.55.0 */
17
+ /* packages/svelte-table/src/placeholder.svelte generated by Svelte v3.55.1 */
18
18
 
19
19
  function create_fragment(ctx) {
20
20
  let t;
@@ -119,9 +119,10 @@
119
119
  accessorFn = originalRow => {
120
120
  let result = originalRow;
121
121
  for (const key of accessorKey.split('.')) {
122
- result = result[key];
122
+ var _result;
123
+ result = (_result = result) == null ? void 0 : _result[key];
123
124
  if (result === undefined) {
124
- throw new Error(`"${key}" in deeply nested key "${accessorKey}" returned undefined.`);
125
+ console.warn(`"${key}" in deeply nested key "${accessorKey}" returned undefined.`);
125
126
  }
126
127
  }
127
128
  return result;
@@ -613,9 +614,9 @@
613
614
  },
614
615
  getResizeHandler: () => {
615
616
  const column = table.getColumn(header.column.id);
616
- const canResize = column.getCanResize();
617
+ const canResize = column == null ? void 0 : column.getCanResize();
617
618
  return e => {
618
- if (!canResize) {
619
+ if (!column || !canResize) {
619
620
  return;
620
621
  }
621
622
  e.persist == null ? void 0 : e.persist();
@@ -2791,10 +2792,7 @@
2791
2792
  getColumn: columnId => {
2792
2793
  const column = table._getAllFlatColumnsById()[columnId];
2793
2794
  if (!column) {
2794
- {
2795
- console.warn(`[Table] Column with id ${columnId} does not exist.`);
2796
- }
2797
- throw new Error();
2795
+ console.error(`[Table] Column with id '${columnId}' does not exist.`);
2798
2796
  }
2799
2797
  return column;
2800
2798
  }
@@ -2848,7 +2846,7 @@
2848
2846
  return row._valuesCache[columnId];
2849
2847
  }
2850
2848
  const column = table.getColumn(columnId);
2851
- if (!column.accessorFn) {
2849
+ if (!(column != null && column.accessorFn)) {
2852
2850
  return undefined;
2853
2851
  }
2854
2852
  row._valuesCache[columnId] = column.accessorFn(row.original, rowIndex);
@@ -2859,7 +2857,7 @@
2859
2857
  return row._uniqueValuesCache[columnId];
2860
2858
  }
2861
2859
  const column = table.getColumn(columnId);
2862
- if (!column.accessorFn) {
2860
+ if (!(column != null && column.accessorFn)) {
2863
2861
  return undefined;
2864
2862
  }
2865
2863
  if (!column.columnDef.getUniqueValues) {
@@ -3130,9 +3128,7 @@
3130
3128
  var _filterFn$resolveFilt;
3131
3129
  const column = table.getColumn(d.id);
3132
3130
  if (!column) {
3133
- {
3134
- console.warn(`Table: Could not find a column to filter with columnId: ${d.id}`);
3135
- }
3131
+ return;
3136
3132
  }
3137
3133
  const filterFn = column.getFilterFn();
3138
3134
  if (!filterFn) {
@@ -3247,7 +3243,11 @@
3247
3243
  }
3248
3244
 
3249
3245
  function getFacetedUniqueValues() {
3250
- return (table, columnId) => memo(() => [table.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3246
+ return (table, columnId) => memo(() => {
3247
+ var _table$getColumn;
3248
+ return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()];
3249
+ }, facetedRowModel => {
3250
+ if (!facetedRowModel) return new Map();
3251
3251
  let facetedUniqueValues = new Map();
3252
3252
  for (let i = 0; i < facetedRowModel.flatRows.length; i++) {
3253
3253
  const values = facetedRowModel.flatRows[i].getUniqueValues(columnId);
@@ -3273,8 +3273,12 @@
3273
3273
  }
3274
3274
 
3275
3275
  function getFacetedMinMaxValues() {
3276
- return (table, columnId) => memo(() => [table.getColumn(columnId).getFacetedRowModel()], facetedRowModel => {
3276
+ return (table, columnId) => memo(() => {
3277
+ var _table$getColumn;
3278
+ return [(_table$getColumn = table.getColumn(columnId)) == null ? void 0 : _table$getColumn.getFacetedRowModel()];
3279
+ }, facetedRowModel => {
3277
3280
  var _facetedRowModel$flat;
3281
+ if (!facetedRowModel) return undefined;
3278
3282
  const firstValue = (_facetedRowModel$flat = facetedRowModel.flatRows[0]) == null ? void 0 : _facetedRowModel$flat.getUniqueValues(columnId);
3279
3283
  if (typeof firstValue === 'undefined') {
3280
3284
  return undefined;
@@ -3311,10 +3315,14 @@
3311
3315
  const sortedFlatRows = [];
3312
3316
 
3313
3317
  // Filter out sortings that correspond to non existing columns
3314
- const availableSorting = sortingState.filter(sort => table.getColumn(sort.id).getCanSort());
3318
+ const availableSorting = sortingState.filter(sort => {
3319
+ var _table$getColumn;
3320
+ return (_table$getColumn = table.getColumn(sort.id)) == null ? void 0 : _table$getColumn.getCanSort();
3321
+ });
3315
3322
  const columnInfoById = {};
3316
3323
  availableSorting.forEach(sortEntry => {
3317
3324
  const column = table.getColumn(sortEntry.id);
3325
+ if (!column) return;
3318
3326
  columnInfoById[sortEntry.id] = {
3319
3327
  sortUndefined: column.columnDef.sortUndefined,
3320
3328
  invertSorting: column.columnDef.invertSorting,
@@ -3456,7 +3464,7 @@
3456
3464
 
3457
3465
  // Aggregate the values
3458
3466
  const column = table.getColumn(columnId);
3459
- const aggregateFn = column.getAggregationFn();
3467
+ const aggregateFn = column == null ? void 0 : column.getAggregationFn();
3460
3468
  if (aggregateFn) {
3461
3469
  row._groupingValuesCache[columnId] = aggregateFn(columnId, leafRows, groupedRows);
3462
3470
  return row._groupingValuesCache[columnId];
@@ -3609,7 +3617,7 @@
3609
3617
  });
3610
3618
  }
3611
3619
 
3612
- /* packages/svelte-table/src/placeholder.svelte generated by Svelte v3.55.0 */
3620
+ /* packages/svelte-table/src/placeholder.svelte generated by Svelte v3.55.1 */
3613
3621
 
3614
3622
  function create_fragment$1(ctx) {
3615
3623
  let t;