@orfium/ictinus 5.43.3 → 5.43.5

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.
@@ -21,8 +21,8 @@ export type DataTableBodyProps = BoxProps<
21
21
  }
22
22
  >;
23
23
 
24
- const COL_VIRTUALIZATION_THRESHOLD = 20;
25
- const ROW_VIRTUALIZATION_THRESHOLD = 20;
24
+ const COL_VIRTUALIZATION_THRESHOLD = 25;
25
+ const ROW_VIRTUALIZATION_THRESHOLD = 25;
26
26
 
27
27
  export const DataTableBody = forwardRef<HTMLDivElement, DataTableBodyProps>(
28
28
  (
@@ -174,104 +174,117 @@ export const DataTableBody = forwardRef<HTMLDivElement, DataTableBodyProps>(
174
174
  virtualRow,
175
175
  }))
176
176
  : rows.map((row) => ({ row, virtualRow: undefined }))
177
- ).map(({ row, virtualRow }, index) => (
178
- <DataTableRow
179
- data-index={virtualRow?.index}
180
- display="flex"
181
- key={row.id}
182
- index={virtualRow?.index ?? index}
183
- row={row}
184
- ref={virtualRow ? rowVirtualizer.measureElement : undefined}
185
- style={
186
- virtualRow
187
- ? {
188
- position: 'absolute',
189
- transform: `translateY(${virtualRow.start}px)`,
190
- }
191
- : undefined
192
- }
193
- >
194
- {row.getLeftVisibleCells().map((cell) => (
195
- <TableCell
196
- bordered={bordered}
197
- size={size}
198
- justifyContent={cell.column.columnDef.meta?.align}
199
- key={cell.id}
200
- pinned
201
- style={{
202
- ...assignInlineVars({
203
- [styles.cellOffsetVar]: `${cell.column.getStart('left')}px`,
204
- [styles.cellSizeVar]: `${cell.column.getSize()}`,
205
- }),
206
- }}
207
- className={cn(
208
- styles.cell({
209
- pinned: 'left',
210
- resizable: cell.column.getCanResize(),
211
- })
212
- )}
213
- >
214
- {flexRender(cell.column.columnDef.cell, cell.getContext())}
215
- </TableCell>
216
- ))}
177
+ ).map(({ row, virtualRow }, index) => {
178
+ const cellProps = table.options.meta?.getCellProps?.(row);
217
179
 
218
- {columnVirtualizer.options.enabled && virtualColumnsOffset > 0 && (
219
- <TableCell style={{ width: virtualColumnsOffset }} />
220
- )}
180
+ return (
181
+ <DataTableRow
182
+ data-index={virtualRow?.index}
183
+ display="flex"
184
+ key={row.id}
185
+ index={virtualRow?.index ?? index}
186
+ row={row}
187
+ ref={virtualRow ? rowVirtualizer.measureElement : undefined}
188
+ style={
189
+ virtualRow
190
+ ? {
191
+ position: 'absolute',
192
+ transform: `translateY(${virtualRow.start}px)`,
193
+ }
194
+ : undefined
195
+ }
196
+ >
197
+ {row.getLeftVisibleCells().map((cell) => (
198
+ <TableCell
199
+ bordered={bordered}
200
+ size={size}
201
+ justifyContent={cell.column.columnDef.meta?.align}
202
+ key={cell.id}
203
+ pinned
204
+ {...cellProps}
205
+ style={{
206
+ ...assignInlineVars({
207
+ [styles.cellOffsetVar]: `${cell.column.getStart('left')}px`,
208
+ [styles.cellSizeVar]: `${cell.column.getSize()}`,
209
+ }),
210
+ ...cellProps?.style,
211
+ }}
212
+ className={cn(
213
+ styles.cell({
214
+ pinned: 'left',
215
+ resizable: cell.column.getCanResize(),
216
+ }),
217
+ cellProps?.className
218
+ )}
219
+ >
220
+ {flexRender(cell.column.columnDef.cell, cell.getContext())}
221
+ </TableCell>
222
+ ))}
221
223
 
222
- {(columnVirtualizer.options.enabled
223
- ? virtualColumns.map((virtualCell) => {
224
- const cells = row.getCenterVisibleCells();
224
+ {columnVirtualizer.options.enabled && virtualColumnsOffset > 0 && (
225
+ <TableCell style={{ width: virtualColumnsOffset }} />
226
+ )}
225
227
 
226
- return cells[virtualCell.index];
227
- })
228
- : row.getCenterVisibleCells()
229
- ).map((cell) => (
230
- <TableCell
231
- key={cell.id}
232
- size={size}
233
- bordered={bordered}
234
- justifyContent={cell.column.columnDef.meta?.align}
235
- style={{
236
- ...assignInlineVars({
237
- [styles.cellSizeVar]: `${cell.column.getSize()}`,
238
- }),
239
- }}
240
- className={cn(
241
- styles.cell({
242
- resizable: cell.column.getCanResize(),
243
- })
244
- )}
245
- >
246
- {flexRender(cell.column.columnDef.cell, cell.getContext())}
247
- </TableCell>
248
- ))}
228
+ {(columnVirtualizer.options.enabled
229
+ ? virtualColumns.map((virtualCell) => {
230
+ const cells = row.getCenterVisibleCells();
249
231
 
250
- {row.getRightVisibleCells().map((cell) => (
251
- <TableCell
252
- key={cell.id}
253
- size={size}
254
- bordered={bordered}
255
- justifyContent={cell.column.columnDef.meta?.align}
256
- pinned
257
- style={{
258
- ...assignInlineVars({
259
- [styles.cellOffsetVar]: `${cell.column.getStart('right')}px`,
260
- [styles.cellSizeVar]: `${cell.column.getSize()}`,
261
- }),
262
- }}
263
- className={cn(
264
- styles.cell({
265
- pinned: 'right',
266
- resizable: cell.column.getCanResize(),
232
+ return cells[virtualCell.index];
267
233
  })
268
- )}
269
- >
270
- {flexRender(cell.column.columnDef.cell, cell.getContext())}
271
- </TableCell>
272
- ))}
273
- </DataTableRow>
274
- ))}
234
+ : row.getCenterVisibleCells()
235
+ ).map((cell) => (
236
+ <TableCell
237
+ key={cell.id}
238
+ size={size}
239
+ bordered={bordered}
240
+ justifyContent={cell.column.columnDef.meta?.align}
241
+ {...cellProps}
242
+ style={{
243
+ ...assignInlineVars({
244
+ [styles.cellSizeVar]: `${cell.column.getSize()}`,
245
+ }),
246
+ ...cellProps?.style,
247
+ }}
248
+ className={cn(
249
+ styles.cell({
250
+ resizable: cell.column.getCanResize(),
251
+ }),
252
+ cellProps?.className
253
+ )}
254
+ >
255
+ {flexRender(cell.column.columnDef.cell, cell.getContext())}
256
+ </TableCell>
257
+ ))}
258
+
259
+ {row.getRightVisibleCells().map((cell) => (
260
+ <TableCell
261
+ key={cell.id}
262
+ size={size}
263
+ bordered={bordered}
264
+ justifyContent={cell.column.columnDef.meta?.align}
265
+ pinned
266
+ {...cellProps}
267
+ style={{
268
+ ...assignInlineVars({
269
+ [styles.cellOffsetVar]: `${cell.column.getStart('right')}px`,
270
+ [styles.cellSizeVar]: `${cell.column.getSize()}`,
271
+ }),
272
+ ...cellProps?.style,
273
+ }}
274
+ className={cn(
275
+ styles.cell({
276
+ pinned: 'right',
277
+ resizable: cell.column.getCanResize(),
278
+ }),
279
+ cellProps?.className
280
+ )}
281
+ >
282
+ {flexRender(cell.column.columnDef.cell, cell.getContext())}
283
+ </TableCell>
284
+ ))}
285
+ </DataTableRow>
286
+ );
287
+ })}
275
288
  </TableBody>
276
289
  </Table>
277
290
  </Box>
package/src/index.ts CHANGED
@@ -93,6 +93,8 @@ export type {
93
93
  // Token utility types
94
94
  export type { DotKeys, Token, TokensObject } from '@orfium/tokens';
95
95
 
96
+ export { vars } from '@orfium/tokens';
97
+
96
98
  // Hook types
97
99
  export type { OnCheckHandler } from './hooks/useCheck';
98
100
 
@@ -1,12 +0,0 @@
1
- import '@tanstack/react-table';
2
-
3
- declare module '@tanstack/react-table' {
4
- // eslint-disable-next-line no-undef, @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
5
- interface ColumnMeta<TData extends RowData, TValue> {
6
- align?: 'flex-start' | 'center' | 'flex-end';
7
- label?: string;
8
- tooltip?: string;
9
- // backward compatibility with old v5 table
10
- contentAlign?: 'left' | 'center' | 'right';
11
- }
12
- }