@tanstack/table-core 8.9.7 → 8.9.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.
- package/build/lib/core/cell.js +1 -1
- package/build/lib/core/cell.js.map +1 -1
- package/build/lib/core/column.js +3 -3
- package/build/lib/core/column.js.map +1 -1
- package/build/lib/core/headers.js +182 -181
- package/build/lib/core/headers.js.map +1 -1
- package/build/lib/core/row.js +1 -1
- package/build/lib/core/row.js.map +1 -1
- package/build/lib/core/table.js +4 -3
- package/build/lib/core/table.js.map +1 -1
- package/build/lib/features/ColumnSizing.js +173 -179
- package/build/lib/features/ColumnSizing.js.map +1 -1
- package/build/lib/features/Expanding.js +119 -123
- package/build/lib/features/Expanding.js.map +1 -1
- package/build/lib/features/Filters.js +157 -165
- package/build/lib/features/Filters.js.map +1 -1
- package/build/lib/features/Grouping.js +71 -79
- package/build/lib/features/Grouping.js.map +1 -1
- package/build/lib/features/Ordering.js +32 -34
- package/build/lib/features/Ordering.js.map +1 -1
- package/build/lib/features/Pagination.js +112 -114
- package/build/lib/features/Pagination.js.map +1 -1
- package/build/lib/features/Pinning.js +120 -126
- package/build/lib/features/Pinning.js.map +1 -1
- package/build/lib/features/RowSelection.js +245 -247
- package/build/lib/features/RowSelection.js.map +1 -1
- package/build/lib/features/Sorting.js +163 -167
- package/build/lib/features/Sorting.js.map +1 -1
- package/build/lib/features/Visibility.js +60 -66
- package/build/lib/features/Visibility.js.map +1 -1
- package/build/lib/index.esm.js +1469 -1515
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.mjs +1469 -1515
- package/build/lib/index.mjs.map +1 -1
- package/build/umd/index.development.js +1469 -1515
- 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 +1 -1
- package/src/core/cell.ts +5 -8
- package/src/core/column.ts +3 -3
- package/src/core/headers.ts +264 -280
- package/src/core/row.ts +1 -1
- package/src/core/table.ts +4 -3
- package/src/features/ColumnSizing.ts +220 -231
- package/src/features/Expanding.ts +132 -140
- package/src/features/Filters.ts +193 -206
- package/src/features/Grouping.ts +94 -110
- package/src/features/Ordering.ts +48 -51
- package/src/features/Pagination.ts +150 -154
- package/src/features/Pinning.ts +158 -178
- package/src/features/RowSelection.ts +280 -286
- package/src/features/Sorting.ts +196 -206
- package/src/features/Visibility.ts +98 -107
|
@@ -76,70 +76,63 @@ export const Visibility: TableFeature = {
|
|
|
76
76
|
createColumn: <TData extends RowData, TValue>(
|
|
77
77
|
column: Column<TData, TValue>,
|
|
78
78
|
table: Table<TData>
|
|
79
|
-
):
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
},
|
|
79
|
+
): void => {
|
|
80
|
+
column.toggleVisibility = value => {
|
|
81
|
+
if (column.getCanHide()) {
|
|
82
|
+
table.setColumnVisibility(old => ({
|
|
83
|
+
...old,
|
|
84
|
+
[column.id]: value ?? !column.getIsVisible(),
|
|
85
|
+
}))
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
column.getIsVisible = () => {
|
|
89
|
+
return table.getState().columnVisibility?.[column.id] ?? true
|
|
90
|
+
}
|
|
92
91
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
column.getCanHide = () => {
|
|
93
|
+
return (
|
|
94
|
+
(column.columnDef.enableHiding ?? true) &&
|
|
95
|
+
(table.options.enableHiding ?? true)
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
column.getToggleVisibilityHandler = () => {
|
|
99
|
+
return (e: unknown) => {
|
|
100
|
+
column.toggleVisibility?.(
|
|
101
|
+
((e as MouseEvent).target as HTMLInputElement).checked
|
|
97
102
|
)
|
|
98
|
-
}
|
|
99
|
-
getToggleVisibilityHandler: () => {
|
|
100
|
-
return (e: unknown) => {
|
|
101
|
-
column.toggleVisibility?.(
|
|
102
|
-
((e as MouseEvent).target as HTMLInputElement).checked
|
|
103
|
-
)
|
|
104
|
-
}
|
|
105
|
-
},
|
|
103
|
+
}
|
|
106
104
|
}
|
|
107
105
|
},
|
|
108
106
|
|
|
109
107
|
createRow: <TData extends RowData>(
|
|
110
108
|
row: Row<TData>,
|
|
111
109
|
table: Table<TData>
|
|
112
|
-
):
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
cells =>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
()
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
),
|
|
137
|
-
}
|
|
110
|
+
): void => {
|
|
111
|
+
row._getAllVisibleCells = memo(
|
|
112
|
+
() => [row.getAllCells(), table.getState().columnVisibility],
|
|
113
|
+
cells => {
|
|
114
|
+
return cells.filter(cell => cell.column.getIsVisible())
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
key: process.env.NODE_ENV === 'production' && 'row._getAllVisibleCells',
|
|
118
|
+
debug: () => table.options.debugAll ?? table.options.debugRows,
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
row.getVisibleCells = memo(
|
|
122
|
+
() => [
|
|
123
|
+
row.getLeftVisibleCells(),
|
|
124
|
+
row.getCenterVisibleCells(),
|
|
125
|
+
row.getRightVisibleCells(),
|
|
126
|
+
],
|
|
127
|
+
(left, center, right) => [...left, ...center, ...right],
|
|
128
|
+
{
|
|
129
|
+
key: process.env.NODE_ENV === 'development' && 'row.getVisibleCells',
|
|
130
|
+
debug: () => table.options.debugAll ?? table.options.debugRows,
|
|
131
|
+
}
|
|
132
|
+
)
|
|
138
133
|
},
|
|
139
134
|
|
|
140
|
-
createTable: <TData extends RowData>(
|
|
141
|
-
table: Table<TData>
|
|
142
|
-
): VisibilityInstance<TData> => {
|
|
135
|
+
createTable: <TData extends RowData>(table: Table<TData>): void => {
|
|
143
136
|
const makeVisibleColumnsMethod = (
|
|
144
137
|
key: string,
|
|
145
138
|
getColumns: () => Column<TData, unknown>[]
|
|
@@ -162,64 +155,62 @@ export const Visibility: TableFeature = {
|
|
|
162
155
|
)
|
|
163
156
|
}
|
|
164
157
|
|
|
165
|
-
|
|
166
|
-
getVisibleFlatColumns
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
getVisibleLeafColumns
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
getLeftVisibleLeafColumns
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
getRightVisibleLeafColumns
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
getCenterVisibleLeafColumns
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
table.
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
158
|
+
table.getVisibleFlatColumns = makeVisibleColumnsMethod(
|
|
159
|
+
'getVisibleFlatColumns',
|
|
160
|
+
() => table.getAllFlatColumns()
|
|
161
|
+
)
|
|
162
|
+
table.getVisibleLeafColumns = makeVisibleColumnsMethod(
|
|
163
|
+
'getVisibleLeafColumns',
|
|
164
|
+
() => table.getAllLeafColumns()
|
|
165
|
+
)
|
|
166
|
+
table.getLeftVisibleLeafColumns = makeVisibleColumnsMethod(
|
|
167
|
+
'getLeftVisibleLeafColumns',
|
|
168
|
+
() => table.getLeftLeafColumns()
|
|
169
|
+
)
|
|
170
|
+
table.getRightVisibleLeafColumns = makeVisibleColumnsMethod(
|
|
171
|
+
'getRightVisibleLeafColumns',
|
|
172
|
+
() => table.getRightLeafColumns()
|
|
173
|
+
)
|
|
174
|
+
table.getCenterVisibleLeafColumns = makeVisibleColumnsMethod(
|
|
175
|
+
'getCenterVisibleLeafColumns',
|
|
176
|
+
() => table.getCenterLeafColumns()
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
table.setColumnVisibility = updater =>
|
|
180
|
+
table.options.onColumnVisibilityChange?.(updater)
|
|
181
|
+
|
|
182
|
+
table.resetColumnVisibility = defaultState => {
|
|
183
|
+
table.setColumnVisibility(
|
|
184
|
+
defaultState ? {} : table.initialState.columnVisibility ?? {}
|
|
185
|
+
)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
table.toggleAllColumnsVisible = value => {
|
|
189
|
+
value = value ?? !table.getIsAllColumnsVisible()
|
|
195
190
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
[column.id]: !value ? !column.getCanHide?.() : value,
|
|
204
|
-
}),
|
|
205
|
-
{}
|
|
206
|
-
)
|
|
191
|
+
table.setColumnVisibility(
|
|
192
|
+
table.getAllLeafColumns().reduce(
|
|
193
|
+
(obj, column) => ({
|
|
194
|
+
...obj,
|
|
195
|
+
[column.id]: !value ? !column.getCanHide?.() : value,
|
|
196
|
+
}),
|
|
197
|
+
{}
|
|
207
198
|
)
|
|
208
|
-
|
|
199
|
+
)
|
|
200
|
+
}
|
|
209
201
|
|
|
210
|
-
|
|
211
|
-
|
|
202
|
+
table.getIsAllColumnsVisible = () =>
|
|
203
|
+
!table.getAllLeafColumns().some(column => !column.getIsVisible?.())
|
|
212
204
|
|
|
213
|
-
|
|
214
|
-
|
|
205
|
+
table.getIsSomeColumnsVisible = () =>
|
|
206
|
+
table.getAllLeafColumns().some(column => column.getIsVisible?.())
|
|
215
207
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
},
|
|
208
|
+
table.getToggleAllColumnsVisibilityHandler = () => {
|
|
209
|
+
return (e: unknown) => {
|
|
210
|
+
table.toggleAllColumnsVisible(
|
|
211
|
+
((e as MouseEvent).target as HTMLInputElement)?.checked
|
|
212
|
+
)
|
|
213
|
+
}
|
|
223
214
|
}
|
|
224
215
|
},
|
|
225
216
|
}
|