@tanstack/vue-table 8.2.6 → 8.3.2

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.
@@ -11,17 +11,17 @@
11
11
  "children": [
12
12
  {
13
13
  "name": "table-core/build/esm/index.js",
14
- "uid": "4039-152"
14
+ "uid": "4d15-156"
15
15
  },
16
16
  {
17
17
  "name": "vue-table/src",
18
18
  "children": [
19
19
  {
20
- "uid": "4039-154",
20
+ "uid": "4d15-158",
21
21
  "name": "merge-proxy.ts"
22
22
  },
23
23
  {
24
- "uid": "4039-156",
24
+ "uid": "4d15-160",
25
25
  "name": "index.ts"
26
26
  }
27
27
  ]
@@ -34,83 +34,83 @@
34
34
  "isRoot": true
35
35
  },
36
36
  "nodeParts": {
37
- "4039-152": {
38
- "renderedLength": 135108,
39
- "gzipLength": 23292,
37
+ "4d15-156": {
38
+ "renderedLength": 136731,
39
+ "gzipLength": 23744,
40
40
  "brotliLength": 0,
41
- "mainUid": "4039-151"
41
+ "mainUid": "4d15-155"
42
42
  },
43
- "4039-154": {
43
+ "4d15-158": {
44
44
  "renderedLength": 1622,
45
45
  "gzipLength": 660,
46
46
  "brotliLength": 0,
47
- "mainUid": "4039-153"
47
+ "mainUid": "4d15-157"
48
48
  },
49
- "4039-156": {
49
+ "4d15-160": {
50
50
  "renderedLength": 1683,
51
51
  "gzipLength": 677,
52
52
  "brotliLength": 0,
53
- "mainUid": "4039-155"
53
+ "mainUid": "4d15-159"
54
54
  }
55
55
  },
56
56
  "nodeMetas": {
57
- "4039-151": {
57
+ "4d15-155": {
58
58
  "id": "/packages/table-core/build/esm/index.js",
59
59
  "moduleParts": {
60
- "index.production.js": "4039-152"
60
+ "index.production.js": "4d15-156"
61
61
  },
62
62
  "imported": [],
63
63
  "importedBy": [
64
64
  {
65
- "uid": "4039-155"
65
+ "uid": "4d15-159"
66
66
  }
67
67
  ]
68
68
  },
69
- "4039-153": {
69
+ "4d15-157": {
70
70
  "id": "/packages/vue-table/src/merge-proxy.ts",
71
71
  "moduleParts": {
72
- "index.production.js": "4039-154"
72
+ "index.production.js": "4d15-158"
73
73
  },
74
74
  "imported": [],
75
75
  "importedBy": [
76
76
  {
77
- "uid": "4039-155"
77
+ "uid": "4d15-159"
78
78
  }
79
79
  ]
80
80
  },
81
- "4039-155": {
81
+ "4d15-159": {
82
82
  "id": "/packages/vue-table/src/index.ts",
83
83
  "moduleParts": {
84
- "index.production.js": "4039-156"
84
+ "index.production.js": "4d15-160"
85
85
  },
86
86
  "imported": [
87
87
  {
88
- "uid": "4039-151"
88
+ "uid": "4d15-155"
89
89
  },
90
90
  {
91
- "uid": "4039-157"
91
+ "uid": "4d15-161"
92
92
  },
93
93
  {
94
- "uid": "4039-153"
94
+ "uid": "4d15-157"
95
95
  }
96
96
  ],
97
97
  "importedBy": [],
98
98
  "isEntry": true
99
99
  },
100
- "4039-157": {
100
+ "4d15-161": {
101
101
  "id": "vue",
102
102
  "moduleParts": {},
103
103
  "imported": [],
104
104
  "importedBy": [
105
105
  {
106
- "uid": "4039-155"
106
+ "uid": "4d15-159"
107
107
  }
108
108
  ],
109
109
  "isExternal": true
110
110
  }
111
111
  },
112
112
  "env": {
113
- "rollup": "2.76.0"
113
+ "rollup": "2.77.0"
114
114
  },
115
115
  "options": {
116
116
  "gzip": true,
@@ -24,6 +24,9 @@
24
24
  *
25
25
  * @license MIT
26
26
  */
27
+ // Is this type a tuple?
28
+ // If this type is a tuple, what indices are allowed?
29
+ ///
27
30
  function functionalUpdate(updater, input) {
28
31
  return typeof updater === 'function' ? updater(input) : updater;
29
32
  }
@@ -109,13 +112,27 @@
109
112
  const resolvedColumnDef = { ...defaultColumn,
110
113
  ...columnDef
111
114
  };
112
- let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : resolvedColumnDef.accessorKey) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined;
115
+ const accessorKey = resolvedColumnDef.accessorKey;
116
+ let id = (_ref = (_resolvedColumnDef$id = resolvedColumnDef.id) != null ? _resolvedColumnDef$id : accessorKey ? accessorKey.replace('.', '_') : undefined) != null ? _ref : typeof resolvedColumnDef.header === 'string' ? resolvedColumnDef.header : undefined;
113
117
  let accessorFn;
114
118
 
115
119
  if (resolvedColumnDef.accessorFn) {
116
120
  accessorFn = resolvedColumnDef.accessorFn;
117
- } else if (resolvedColumnDef.accessorKey) {
118
- accessorFn = originalRow => originalRow[resolvedColumnDef.accessorKey];
121
+ } else if (accessorKey) {
122
+ // Support deep accessor keys
123
+ if (accessorKey.includes('.')) {
124
+ accessorFn = originalRow => {
125
+ let result = originalRow;
126
+
127
+ for (const key of accessorKey.split('.')) {
128
+ result = result[key];
129
+ }
130
+
131
+ return result;
132
+ };
133
+ } else {
134
+ accessorFn = originalRow => originalRow[resolvedColumnDef.accessorKey];
135
+ }
119
136
  }
120
137
 
121
138
  if (!id) {
@@ -2141,7 +2158,7 @@
2141
2158
  let isAllRowsSelected = Boolean(preFilteredFlatRows.length && Object.keys(rowSelection).length);
2142
2159
 
2143
2160
  if (isAllRowsSelected) {
2144
- if (preFilteredFlatRows.some(row => !rowSelection[row.id])) {
2161
+ if (preFilteredFlatRows.some(row => row.getCanSelect() && !rowSelection[row.id])) {
2145
2162
  isAllRowsSelected = false;
2146
2163
  }
2147
2164
  }
@@ -2164,7 +2181,8 @@
2164
2181
  getIsSomeRowsSelected: () => {
2165
2182
  var _table$getState$rowSe;
2166
2183
 
2167
- return !table.getIsAllRowsSelected() && !!Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length;
2184
+ const totalSelected = Object.keys((_table$getState$rowSe = table.getState().rowSelection) != null ? _table$getState$rowSe : {}).length;
2185
+ return totalSelected < table.getCoreRowModel().flatRows.length;
2168
2186
  },
2169
2187
  getIsSomePageRowsSelected: () => {
2170
2188
  const paginationFlatRows = table.getPaginationRowModel().flatRows;
@@ -3101,6 +3119,52 @@
3101
3119
  return row;
3102
3120
  };
3103
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
+
3104
3168
  function getCoreRowModel() {
3105
3169
  return table => memo(() => [table.options.data], data => {
3106
3170
  const rowModel = {
@@ -3942,6 +4006,7 @@
3942
4006
  exports.aggregationFns = aggregationFns;
3943
4007
  exports.buildHeaderGroups = buildHeaderGroups;
3944
4008
  exports.createColumn = createColumn;
4009
+ exports.createColumnHelper = createColumnHelper;
3945
4010
  exports.createRow = createRow;
3946
4011
  exports.createTable = createTable;
3947
4012
  exports.defaultColumnSizing = defaultColumnSizing;