@economic/taco 2.43.0 → 2.44.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. package/dist/components/Report/Report.d.ts +1 -1
  2. package/dist/components/Table3/features/useTableEditing.d.ts +8 -8
  3. package/dist/esm/index.css +44 -22
  4. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +7 -1
  5. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
  6. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js +3 -2
  7. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
  8. package/dist/esm/packages/taco/src/components/Select2/Select2.js +1 -1
  9. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  10. package/dist/esm/packages/taco/src/components/Table3/Table3.js +2 -2
  11. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  12. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +6 -1
  13. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  14. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/util.js +4 -3
  15. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/util.js.map +1 -1
  16. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js +17 -3
  17. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js.map +1 -1
  18. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +1 -11
  19. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  20. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js +1 -1
  21. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js.map +1 -1
  22. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js +7 -5
  23. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js.map +1 -1
  24. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +36 -47
  25. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  26. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js +9 -0
  27. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js.map +1 -1
  28. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +1 -1
  29. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
  30. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +3 -1
  31. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
  32. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js +0 -3
  33. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js.map +1 -1
  34. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +1 -8
  35. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
  36. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js +85 -109
  37. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
  38. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  39. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js +4 -9
  40. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js.map +1 -1
  41. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js +12 -1
  42. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -1
  43. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js +1 -7
  44. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js.map +1 -1
  45. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js +17 -10
  46. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js.map +1 -1
  47. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +4 -6
  48. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  49. package/dist/index.css +44 -22
  50. package/dist/primitives/Table/Core/components/Columns/Internal/Actions.d.ts +1 -2
  51. package/dist/primitives/Table/types.d.ts +0 -1
  52. package/dist/primitives/Table/useTableManager/util/columns.d.ts +1 -1
  53. package/dist/primitives/Table/useTableManager/util/search.d.ts +2 -2
  54. package/dist/taco.cjs.development.js +219 -228
  55. package/dist/taco.cjs.development.js.map +1 -1
  56. package/dist/taco.cjs.production.min.js +1 -1
  57. package/dist/taco.cjs.production.min.js.map +1 -1
  58. package/package.json +2 -2
@@ -100,14 +100,13 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
100
100
  }
101
101
  if (rowError || cellErrors) {
102
102
  setPendingChanges(currentChanges => {
103
- var _nextChanges$rowId$_m, _nextChanges$rowId$_m2;
104
103
  const nextChanges = {
105
104
  ...currentChanges
106
105
  };
107
106
  nextChanges[rowId]._meta.errors = {
108
107
  row: rowError,
109
108
  cells: cellErrors,
110
- hasShownErrorAlert: (_nextChanges$rowId$_m = (_nextChanges$rowId$_m2 = nextChanges[rowId]._meta.errors) === null || _nextChanges$rowId$_m2 === void 0 ? void 0 : _nextChanges$rowId$_m2.hasShownErrorAlert) !== null && _nextChanges$rowId$_m !== void 0 ? _nextChanges$rowId$_m : false
109
+ shouldShowErrorAlert: true
111
110
  };
112
111
  return nextChanges;
113
112
  });
@@ -142,7 +141,7 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
142
141
  errors: {
143
142
  ...nextChanges[cell.row.id]._meta.errors,
144
143
  cells: errors,
145
- hasShownErrorAlert: Object.keys(errors).length && !nextChanges[cell.row.id]._meta.errors.hasShownErrorAlert ? false : nextChanges[cell.row.id]._meta.errors.hasShownErrorAlert
144
+ shouldShowErrorAlert: !Object.keys(errors).length ? false : nextChanges[cell.row.id]._meta.errors.shouldShowErrorAlert
146
145
  }
147
146
  };
148
147
  return nextChanges;
@@ -230,22 +229,18 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
230
229
  if (!isEnabled) {
231
230
  return false;
232
231
  }
233
- return hasRowErrors(rowId) && !!((_pendingChanges$rowId6 = pendingChanges[rowId]._meta.errors) !== null && _pendingChanges$rowId6 !== void 0 && _pendingChanges$rowId6.hasShownErrorAlert);
232
+ return hasRowErrors(rowId) && !!((_pendingChanges$rowId6 = pendingChanges[rowId]._meta.errors) !== null && _pendingChanges$rowId6 !== void 0 && _pendingChanges$rowId6.shouldShowErrorAlert);
234
233
  }
235
- function setRowErrorsSeen(rowId) {
236
- var _pendingChanges$rowId7;
237
- if (((_pendingChanges$rowId7 = pendingChanges[rowId]._meta.errors) === null || _pendingChanges$rowId7 === void 0 ? void 0 : _pendingChanges$rowId7.hasShownErrorAlert) === false) {
238
- setPendingChanges(currentChanges => {
239
- const nextChanges = {
240
- ...currentChanges
241
- };
242
- nextChanges[rowId]._meta.errors = {
243
- ...nextChanges[rowId]._meta.errors,
244
- hasShownErrorAlert: true
245
- };
246
- return nextChanges;
247
- });
234
+ function getRowPendingChange(rowId) {
235
+ const rowPendingChanges = pendingChanges[rowId];
236
+ if (rowPendingChanges) {
237
+ const {
238
+ _meta,
239
+ ...pendingChange
240
+ } = rowPendingChanges;
241
+ return pendingChange;
248
242
  }
243
+ return undefined;
249
244
  }
250
245
  function getRowSaveStatus(rowId) {
251
246
  if (!isEnabled) {
@@ -267,8 +262,8 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
267
262
  });
268
263
  }
269
264
  function getRowMoveReason(rowId) {
270
- var _pendingChanges$rowId8;
271
- return (_pendingChanges$rowId8 = pendingChanges[rowId]) !== null && _pendingChanges$rowId8 !== void 0 && _pendingChanges$rowId8._meta.moveReason ? Object.values(pendingChanges[rowId]._meta.moveReason)[0] : undefined;
265
+ var _pendingChanges$rowId7;
266
+ return (_pendingChanges$rowId7 = pendingChanges[rowId]) !== null && _pendingChanges$rowId7 !== void 0 && _pendingChanges$rowId7._meta.moveReason ? Object.values(pendingChanges[rowId]._meta.moveReason)[0] : undefined;
272
267
  }
273
268
  function hasChanges(rowId) {
274
269
  if (!isEnabled) {
@@ -276,28 +271,14 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
276
271
  }
277
272
  return rowId ? !!pendingChanges[rowId] : !!Object.keys(pendingChanges).length;
278
273
  }
279
- function hasErrors(table, tableRef) {
280
- var _tableRef$current;
274
+ function hasAlertErrors() {
281
275
  if (!isEnabled) {
282
276
  return false;
283
277
  }
284
- const tableMeta = table.options.meta;
285
- const focusIsInsideTable = (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.contains(document.activeElement);
286
- let activeRow;
287
- if (tableMeta.rowActive.rowActiveIndex !== undefined) {
288
- activeRow = table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex];
289
- }
290
- return Object.keys(getErrors().filter(error => {
291
- var _activeRow;
292
- if ((_activeRow = activeRow) !== null && _activeRow !== void 0 && _activeRow.id && focusIsInsideTable) {
293
- var _activeRow2, _error$pendingChange$;
294
- return error.rowId === ((_activeRow2 = activeRow) === null || _activeRow2 === void 0 ? void 0 : _activeRow2.id) ? (_error$pendingChange$ = error.pendingChange._meta.errors) === null || _error$pendingChange$ === void 0 ? void 0 : _error$pendingChange$.hasShownErrorAlert : true;
295
- }
296
- return true;
297
- })).length;
278
+ return !!getAlertErrors().length;
298
279
  }
299
- function getErrors() {
300
- return Object.keys(pendingChanges).filter(hasRowErrors).map(rowId => ({
280
+ function getAlertErrors() {
281
+ return Object.keys(pendingChanges).filter(hasRowErrorsSeen).map(rowId => ({
301
282
  rowId,
302
283
  pendingChange: pendingChanges[rowId]
303
284
  }));
@@ -311,6 +292,9 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
311
292
  return nextChanges;
312
293
  });
313
294
  }
295
+ function getCompletedRowsCount() {
296
+ return Object.values(saveStates).filter(value => value === 'complete').length;
297
+ }
314
298
  return {
315
299
  getCellValue,
316
300
  getCellError,
@@ -318,16 +302,17 @@ function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
318
302
  validateCell,
319
303
  addCreatedRowChangeset,
320
304
  hasChanges,
321
- hasErrors,
322
- getErrors,
305
+ hasAlertErrors,
306
+ getAlertErrors,
323
307
  saveChanges,
324
308
  resetChanges,
325
309
  hasRowErrors,
326
310
  hasRowErrorsSeen,
327
- setRowErrorsSeen,
311
+ getRowPendingChange,
328
312
  getRowSaveStatus,
329
313
  setRowSaveStatus,
330
- getRowMoveReason
314
+ getRowMoveReason,
315
+ getCompletedRowsCount
331
316
  };
332
317
  }
333
318
  function useLastFocusedCellIndex() {
@@ -399,12 +384,16 @@ function createPendingChangesSetter(currentChanges, row, rowIndex, changes, loca
399
384
  // otherwise remove any change - no point saving the same value
400
385
  if (change !== row.original[accessor]) {
401
386
  rowChanges[accessor] = change;
402
- // determine if the row will move position based on this change, and save why it will move
403
- const reason = willRowMove(cells[accessor], change, rowIndex, localization);
404
- if (reason) {
405
- rowChanges._meta.moveReason[accessor] = reason;
406
- } else {
407
- delete rowChanges._meta.moveReason[accessor];
387
+ // consumers sometimes include properties in onEditingChange that aren't rendered as columns, we need to guard against that.
388
+ // eslint-disable-next-line no-prototype-builtins
389
+ if (cells.hasOwnProperty(accessor)) {
390
+ // determine if the row will move position based on this change, and save why it will move
391
+ const reason = willRowMove(cells[accessor], change, rowIndex, localization);
392
+ if (reason) {
393
+ rowChanges._meta.moveReason[accessor] = reason;
394
+ } else {
395
+ delete rowChanges._meta.moveReason[accessor];
396
+ }
408
397
  }
409
398
  } else {
410
399
  delete rowChanges[accessor];
@@ -1 +1 @@
1
- {"version":3,"file":"useTableEditing.js","sources":["../../../../../../../../src/components/Table3/features/useTableEditing.ts"],"sourcesContent":["import React from 'react';\nimport {\n Cell as ReactTableCell,\n Row as ReactTableRow,\n Table as ReactTable,\n TableMeta as ReactTableMeta,\n} from '@tanstack/react-table';\nimport { Table3EditingChangeHandler, Table3EditingSaveHandler, Table3EditingValidatorFn } from '../types';\nimport { useGlobalKeyDown } from '../../../hooks/useGlobalKeyDown';\nimport { willRowMove } from '../util/editing';\nimport { TableRef } from '../../../primitives/Table/types';\nimport { debounce } from 'lodash';\nimport { Localization, useLocalization } from '../../Provider/Localization';\n\nexport function useTableEditing<TType = unknown>(\n isEnabled = false,\n handleSave: Table3EditingSaveHandler<TType> | undefined,\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n validator: Table3EditingValidatorFn<TType> | undefined\n) {\n // used to switch the table into editing mode\n const [isEditing, toggleEditing] = React.useState(false);\n\n // used to switch the editing between \"detailed\" mode\n const [isDetailedMode, toggleDetailedMode] = React.useState(false);\n\n // store the last focused cell, so that up/down arrow key navigation remains in the same column\n const [lastFocusedCellIndex, setLastFocusedCellIndex] = useLastFocusedCellIndex();\n\n // store pending changes for each row\n // changes are saved as soon as the active row changes, so in most cases this will only contain the active row's changes\n // but not always - if validation or server requests fail when saving, those rows remain until the failure is resolved\n const pendingChangesFns = usePendingChanges<TType>(isEnabled, handleSave, handleChange, validator);\n\n useGlobalKeyDown(isEnabled && isEditing ? { key: 's', meta: true, shift: false } : undefined, event => {\n event.preventDefault();\n pendingChangesFns.saveChanges();\n });\n\n return {\n isEnabled,\n isEditing,\n isDetailedMode,\n toggleDetailedMode: isEnabled ? toggleDetailedMode : () => undefined,\n toggleEditing: isEnabled ? toggleEditing : () => undefined,\n lastFocusedCellIndex,\n setLastFocusedCellIndex,\n ...pendingChangesFns,\n };\n}\n\ntype SaveState = 'pending' | 'complete';\ntype PendingChange<TType = unknown> = Partial<TType> & {\n _meta: {\n original: TType;\n moveReason: Record<string, 'search' | 'sorting' | 'filter'>;\n errors: {\n row: string;\n cells: Record<string, string>;\n hasShownErrorAlert: boolean;\n };\n status?: SaveState;\n };\n};\n\ntype PendingChanges<TType = unknown> = Record<string, PendingChange<TType>>;\nfunction usePendingChanges<TType = unknown>(\n isEnabled: boolean,\n handleSave: Table3EditingSaveHandler<TType> | undefined,\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n validator: Table3EditingValidatorFn<TType> | undefined\n) {\n const localization = useLocalization();\n const [pendingChanges, setPendingChanges] = React.useState<PendingChanges<TType>>({});\n // we maintain save status as separate state because 'complete' needs to briefly show after pendingChanges are deleted\n const [saveStates, setSaveState] = React.useState<Record<string, SaveState>>({});\n\n function getCellValue<T extends TType>(cell: ReactTableCell<T, unknown>): unknown | undefined {\n return pendingChanges[cell.row.id]?.[cell.column.id];\n }\n\n function getCellError<T extends TType>(cell: ReactTableCell<T, unknown>): string | undefined {\n return pendingChanges[cell.row.id]?._meta.errors?.cells?.[cell.column.id];\n }\n\n async function addCreatedRowChangeset(row) {\n const cells = row.getAllCells();\n\n setPendingChanges(currentChanges => {\n return cells.reduce((changes, cell) => {\n if (cell.getValue()) {\n return {\n ...changes,\n [cell.row.id]: {\n ...changes[cell.row.id],\n [cell.column.id]: cell.getValue(),\n _meta: {\n ...currentChanges[cell.row.id]?._meta,\n original: cell.row.original,\n moveReason: {\n ...currentChanges[cell.row.id]?._meta.moveReason,\n },\n errors: {\n ...currentChanges[cell.row.id]?._meta.errors,\n },\n },\n },\n };\n } else {\n return changes;\n }\n }, currentChanges);\n });\n }\n const pendingChangesUpdater = usePendingChangesUpdater(handleChange, setPendingChanges);\n\n async function setCellValue<T extends TType>(cell: ReactTableCell<T, unknown>, change: unknown, rowIndex: number) {\n const changes = {\n [cell.column.id]: change,\n } as Partial<T>;\n\n setPendingChanges(currentChanges => {\n const nextChanges = createPendingChangesSetter<T>(\n currentChanges as PendingChanges<T>,\n cell.row,\n rowIndex,\n changes,\n localization\n );\n pendingChangesUpdater.syncCellChanges(nextChanges);\n return nextChanges;\n });\n pendingChangesUpdater.runCellUpdates<T>(changes, cell, rowIndex);\n }\n\n async function validateCell<T extends TType>(cell: ReactTableCell<T, unknown>) {\n if (!validator || !isEnabled) {\n return;\n }\n\n const changeSet = getChangesetFromChanges(pendingChanges[cell.row.id]);\n\n // only validate if the cell being blurred actually has any changes\n if (cell.column.id in changeSet) {\n const errors = ((await validator(changeSet)) ?? {}) as Record<string, string>;\n\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n nextChanges[cell.row.id]._meta = {\n ...nextChanges[cell.row.id]._meta,\n errors: {\n ...nextChanges[cell.row.id]._meta.errors,\n cells: errors,\n hasShownErrorAlert:\n Object.keys(errors).length && !nextChanges[cell.row.id]._meta.errors.hasShownErrorAlert\n ? false\n : nextChanges[cell.row.id]._meta.errors.hasShownErrorAlert,\n },\n };\n return nextChanges;\n });\n }\n }\n\n function hasRowErrors(rowId: string) {\n if (!isEnabled) {\n return false;\n }\n\n return (\n !!pendingChanges[rowId]?._meta.errors?.row || !!Object.keys(pendingChanges[rowId]?._meta.errors?.cells ?? {}).length\n );\n }\n\n function hasRowErrorsSeen(rowId: string) {\n if (!isEnabled) {\n return false;\n }\n\n return hasRowErrors(rowId) && !!pendingChanges[rowId]._meta.errors?.hasShownErrorAlert;\n }\n\n function setRowErrorsSeen(rowId: string) {\n if (pendingChanges[rowId]._meta.errors?.hasShownErrorAlert === false) {\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n nextChanges[rowId]._meta.errors = {\n ...nextChanges[rowId]._meta.errors,\n hasShownErrorAlert: true,\n };\n return nextChanges;\n });\n }\n }\n\n function getRowSaveStatus(rowId: string) {\n if (!isEnabled) {\n return false;\n }\n\n return saveStates[rowId];\n }\n\n function setRowSaveStatus(rowId: string, status: 'pending' | 'complete' | undefined) {\n setSaveState(currentStates => {\n const nextStates = { ...currentStates };\n\n if (status) {\n nextStates[rowId] = status;\n } else {\n delete nextStates[rowId];\n }\n\n return nextStates;\n });\n }\n\n function getRowMoveReason(rowId: string) {\n return pendingChanges[rowId]?._meta.moveReason ? Object.values(pendingChanges[rowId]._meta.moveReason)[0] : undefined;\n }\n\n function hasChanges(rowId?: string) {\n if (!isEnabled) {\n return false;\n }\n\n return rowId ? !!pendingChanges[rowId] : !!Object.keys(pendingChanges).length;\n }\n\n function hasErrors<T extends TType>(table: ReactTable<T>, tableRef: React.RefObject<TableRef>) {\n if (!isEnabled) {\n return false;\n }\n\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const focusIsInsideTable = tableRef.current?.contains(document.activeElement);\n\n let activeRow;\n\n if (tableMeta.rowActive.rowActiveIndex !== undefined) {\n activeRow = table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex];\n }\n\n return Object.keys(\n getErrors().filter(error => {\n if (activeRow?.id && focusIsInsideTable) {\n return error.rowId === activeRow?.id ? error.pendingChange._meta.errors?.hasShownErrorAlert : true;\n }\n\n return true;\n })\n ).length;\n }\n\n function getErrors<T extends TType>() {\n return Object.keys(pendingChanges)\n .filter(hasRowErrors)\n .map(rowId => ({ rowId, pendingChange: pendingChanges[rowId] as PendingChange<T> }));\n }\n\n function resetChanges(rowId: string) {\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n delete nextChanges[rowId];\n return nextChanges;\n });\n }\n\n async function saveChanges(rowId: string | undefined = undefined) {\n if (!handleSave) {\n console.warn('Tried to save, but Table has no onEditingSave handler');\n return;\n }\n\n // we save back to pendingChanges, so make a copy of it's state when save was triggered\n const changesToSave = rowId ? { [rowId]: pendingChanges[rowId] } : { ...pendingChanges };\n const changes = Object.keys(changesToSave);\n\n if (changes.length) {\n for (const rowId of changes) {\n const pendingChange = changesToSave[rowId];\n\n const changeSet = getChangesetFromChanges(pendingChange);\n try {\n if (getRowSaveStatus(rowId) === 'pending') return;\n\n // set saving = true\n setRowSaveStatus(rowId, 'pending');\n\n // re-run validation, maybe a cell is already invalid but has never been blurred\n if (validator) {\n const errors = await validator(changeSet);\n\n if (errors && Object.keys(errors).length) {\n throw errors;\n }\n }\n // send new data to the server\n await handleSave(changeSet);\n\n // cleanup changes, we don't need them after saving\n resetChanges(rowId);\n setRowSaveStatus(rowId, 'complete');\n } catch (error) {\n // the onEditingSave handler should throw errors when something fails, e.g. validation, network errors etc\n // this code handles those errors and maps them either to row errors or cell specific errors\n let rowError;\n let cellErrors;\n\n if (typeof error === 'string') {\n rowError = error;\n } else if (error instanceof Error) {\n rowError = error.message;\n\n // most of our apis return error objects within this shape\n if (typeof (error as any).response?.data === 'object') {\n cellErrors = (error as any).response?.data;\n }\n } else if (typeof error === 'object') {\n cellErrors = error;\n }\n\n if (rowError || cellErrors) {\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n nextChanges[rowId]._meta.errors = {\n row: rowError,\n cells: cellErrors,\n hasShownErrorAlert: nextChanges[rowId]._meta.errors?.hasShownErrorAlert ?? false,\n };\n return nextChanges;\n });\n }\n\n setRowSaveStatus(rowId, undefined);\n }\n }\n }\n }\n\n return {\n getCellValue,\n getCellError,\n setCellValue,\n validateCell,\n addCreatedRowChangeset,\n hasChanges,\n hasErrors,\n getErrors,\n saveChanges,\n resetChanges,\n hasRowErrors,\n hasRowErrorsSeen,\n setRowErrorsSeen,\n getRowSaveStatus,\n setRowSaveStatus,\n getRowMoveReason,\n };\n}\n\nfunction useLastFocusedCellIndex(): [number | undefined, (index: number | undefined) => void] {\n // store the last focused cell, so that up/down arrow key navigation remains in the same column\n const lastFocusedCellIndexRef = React.useRef<number | undefined>(undefined);\n const setLastFocusedCellIndex = React.useCallback((index: number | undefined) => {\n lastFocusedCellIndexRef.current = index;\n }, []);\n\n return [lastFocusedCellIndexRef.current, setLastFocusedCellIndex];\n}\n\nfunction usePendingChangesUpdater<TType = unknown>(\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n setPendingChanges: React.Dispatch<React.SetStateAction<PendingChanges<TType>>>\n) {\n const localization = useLocalization();\n const updatersRef = React.useRef<PendingChanges<TType>>({});\n\n const runCellUpdates = React.useCallback(\n debounce(async function <T extends TType>(changes: Partial<T>, cell: ReactTableCell<T, unknown>, rowIndex: number) {\n if (typeof handleChange === 'function') {\n const previousValues = {\n ...cell.row.original,\n ...getChangesetFromChanges(updatersRef.current[cell.row.id]),\n };\n const nextValues = {\n ...previousValues,\n ...changes,\n };\n const updates = await handleChange(cell.column.id, changes[cell.column.id], nextValues, previousValues);\n\n if (updates && Object.keys(updates).length) {\n setPendingChanges(currentChanges =>\n createPendingChangesSetter(currentChanges, cell.row, rowIndex, updates, localization)\n );\n }\n }\n }, 250),\n []\n ) as unknown as <T extends TType>(changes: Partial<T>, cell: ReactTableCell<T, unknown>, rowIndex: number) => Promise<void>;\n\n function syncCellChanges<T extends TType>(changes: PendingChanges<T>) {\n updatersRef.current = changes;\n }\n\n return {\n syncCellChanges,\n runCellUpdates,\n };\n}\n\nfunction createPendingChangesSetter<TType = unknown>(\n currentChanges: PendingChanges<TType>,\n row: ReactTableRow<TType>,\n rowIndex: number,\n changes: Partial<TType>,\n localization: Localization\n) {\n // prepare\n const nextChanges: PendingChanges<TType> = { ...currentChanges };\n const rowChanges = {\n ...currentChanges[row.id],\n _meta: {\n ...currentChanges[row.id]?._meta,\n original: row.original,\n moveReason: {\n ...currentChanges[row.id]?._meta.moveReason,\n },\n errors: {\n ...currentChanges[row.id]?._meta.errors,\n },\n },\n } as PendingChange<TType>;\n\n // run changes\n const cells = row._getAllCellsByColumnId();\n\n for (const [accessor, change] of Object.entries(changes)) {\n // update if the change is different to the original (saved) value,\n // otherwise remove any change - no point saving the same value\n if (change !== row.original[accessor]) {\n rowChanges[accessor] = change;\n\n // determine if the row will move position based on this change, and save why it will move\n const reason = willRowMove(cells[accessor], change, rowIndex, localization);\n\n if (reason) {\n rowChanges._meta.moveReason[accessor] = reason;\n } else {\n delete rowChanges._meta.moveReason[accessor];\n }\n } else {\n delete rowChanges[accessor];\n delete rowChanges._meta.moveReason[accessor];\n }\n }\n\n // set changes\n // or delete if there are no changes left, so that we don't store changes with unchanged data\n if (Object.keys(rowChanges).filter(k => k !== '_meta').length) {\n nextChanges[row.id] = rowChanges;\n } else {\n delete nextChanges[row.id];\n }\n\n return nextChanges;\n}\n\nfunction getChangesetFromChanges<TType = unknown>(changes: PendingChange<TType>): TType {\n // extract the original data from the row changes\n const { _meta, ...changeset } = changes ?? {};\n // and mix them in with the changes, ready to send to the server\n return { ..._meta?.original, ...changeset };\n}\n"],"names":["useTableEditing","isEnabled","handleSave","handleChange","validator","isEditing","toggleEditing","React","useState","isDetailedMode","toggleDetailedMode","lastFocusedCellIndex","setLastFocusedCellIndex","useLastFocusedCellIndex","pendingChangesFns","usePendingChanges","useGlobalKeyDown","key","meta","shift","undefined","event","preventDefault","saveChanges","rowId","console","warn","Promise","resolve","changesToSave","pendingChanges","changes","Object","keys","length","_forOf","pendingChange","changeSet","getChangesetFromChanges","_catch","_temp3","_result","_exit","then","resetChanges","setRowSaveStatus","getRowSaveStatus","_temp2","errors","error","rowError","cellErrors","Error","_error$response","message","response","data","_error$response2","setPendingChanges","currentChanges","nextChanges","_meta","row","cells","hasShownErrorAlert","_nextChanges$rowId$_m","_nextChanges$rowId$_m2","e","reject","validateCell","cell","id","_temp","column","setCellValue","change","rowIndex","createPendingChangesSetter","localization","pendingChangesUpdater","syncCellChanges","runCellUpdates","addCreatedRowChangeset","getAllCells","reduce","getValue","_currentChanges$cell$","_currentChanges$cell$2","_currentChanges$cell$3","original","moveReason","useLocalization","saveStates","setSaveState","getCellValue","_pendingChanges$cell$","getCellError","_pendingChanges$cell$2","_pendingChanges$cell$3","_pendingChanges$cell$4","usePendingChangesUpdater","hasRowErrors","_pendingChanges$rowId","_pendingChanges$rowId2","_pendingChanges$rowId3","_pendingChanges$rowId4","_pendingChanges$rowId5","hasRowErrorsSeen","_pendingChanges$rowId6","setRowErrorsSeen","_pendingChanges$rowId7","status","currentStates","nextStates","getRowMoveReason","_pendingChanges$rowId8","values","hasChanges","hasErrors","table","tableRef","tableMeta","options","focusIsInsideTable","_tableRef$current","current","contains","document","activeElement","activeRow","rowActive","rowActiveIndex","getRowModel","rows","getErrors","filter","_activeRow","_activeRow2","_error$pendingChange$","map","lastFocusedCellIndexRef","useRef","useCallback","index","updatersRef","debounce","previousValues","nextValues","updates","_temp4","rowChanges","_currentChanges$row$i","_currentChanges$row$i2","_currentChanges$row$i3","_getAllCellsByColumnId","accessor","entries","reason","willRowMove","k","changeset"],"mappings":";;;;;;;SAcgBA,eAAeA,CAC3BC,SAAS,GAAG,KAAK,EACjBC,UAAuD,EACvDC,YAA2D,EAC3DC,SAAsD;;EAGtD,MAAM,CAACC,SAAS,EAAEC,aAAa,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;;EAGxD,MAAM,CAACC,cAAc,EAAEC,kBAAkB,CAAC,GAAGH,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;;EAGlE,MAAM,CAACG,oBAAoB,EAAEC,uBAAuB,CAAC,GAAGC,uBAAuB,EAAE;;;;EAKjF,MAAMC,iBAAiB,GAAGC,iBAAiB,CAAQd,SAAS,EAAEC,UAAU,EAAEC,YAAY,EAAEC,SAAS,CAAC;EAElGY,gBAAgB,CAACf,SAAS,IAAII,SAAS,GAAG;IAAEY,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE,IAAI;IAAEC,KAAK,EAAE;GAAO,GAAGC,SAAS,EAAEC,KAAK;IAC/FA,KAAK,CAACC,cAAc,EAAE;IACtBR,iBAAiB,CAACS,WAAW,EAAE;GAClC,CAAC;EAEF,OAAO;IACHtB,SAAS;IACTI,SAAS;IACTI,cAAc;IACdC,kBAAkB,EAAET,SAAS,GAAGS,kBAAkB,GAAG,MAAMU,SAAS;IACpEd,aAAa,EAAEL,SAAS,GAAGK,aAAa,GAAG,MAAMc,SAAS;IAC1DT,oBAAoB;IACpBC,uBAAuB;IACvB,GAAGE;GACN;AACL;AAiBA,SAASC,iBAAiBA,CACtBd,SAAkB,EAClBC,UAAuD,EACvDC,YAA2D,EAC3DC,SAAsD;QAsMvCmB,WAAW,aAACC,QAA4B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KAAK;IAAE,GAAGmG;GAAW,GAAGjI,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAI,EAAE;;EAE7C,OAAO;IAAE,IAAG8B,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAE4B,QAAQ;IAAE,GAAGuE;GAAW;AAC/C;;;;"}
1
+ {"version":3,"file":"useTableEditing.js","sources":["../../../../../../../../src/components/Table3/features/useTableEditing.ts"],"sourcesContent":["import React from 'react';\nimport { Cell as ReactTableCell, Row as ReactTableRow } from '@tanstack/react-table';\nimport { Table3EditingChangeHandler, Table3EditingSaveHandler, Table3EditingValidatorFn } from '../types';\nimport { useGlobalKeyDown } from '../../../hooks/useGlobalKeyDown';\nimport { willRowMove } from '../util/editing';\nimport { debounce } from 'lodash';\nimport { Localization, useLocalization } from '../../Provider/Localization';\n\nexport function useTableEditing<TType = unknown>(\n isEnabled = false,\n handleSave: Table3EditingSaveHandler<TType> | undefined,\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n validator: Table3EditingValidatorFn<TType> | undefined\n) {\n // used to switch the table into editing mode\n const [isEditing, toggleEditing] = React.useState(false);\n\n // used to switch the editing between \"detailed\" mode\n const [isDetailedMode, toggleDetailedMode] = React.useState(false);\n\n // store the last focused cell, so that up/down arrow key navigation remains in the same column\n const [lastFocusedCellIndex, setLastFocusedCellIndex] = useLastFocusedCellIndex();\n\n // store pending changes for each row\n // changes are saved as soon as the active row changes, so in most cases this will only contain the active row's changes\n // but not always - if validation or server requests fail when saving, those rows remain until the failure is resolved\n const pendingChangesFns = usePendingChanges<TType>(isEnabled, handleSave, handleChange, validator);\n\n useGlobalKeyDown(isEnabled && isEditing ? { key: 's', meta: true, shift: false } : undefined, event => {\n event.preventDefault();\n pendingChangesFns.saveChanges();\n });\n\n return {\n isEnabled,\n isEditing,\n isDetailedMode,\n toggleDetailedMode: isEnabled ? toggleDetailedMode : () => undefined,\n toggleEditing: isEnabled ? toggleEditing : () => undefined,\n lastFocusedCellIndex,\n setLastFocusedCellIndex,\n ...pendingChangesFns,\n };\n}\n\ntype SaveState = 'pending' | 'complete';\nexport type PendingChange<TType = unknown> = Partial<TType> & {\n _meta: {\n original: TType;\n moveReason: Record<string, 'search' | 'sorting' | 'filter'>;\n errors: {\n row: string;\n cells: Record<string, string>;\n shouldShowErrorAlert: boolean;\n };\n status?: SaveState;\n };\n};\n\ntype PendingChanges<TType = unknown> = Record<string, PendingChange<TType>>;\nfunction usePendingChanges<TType = unknown>(\n isEnabled: boolean,\n handleSave: Table3EditingSaveHandler<TType> | undefined,\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n validator: Table3EditingValidatorFn<TType> | undefined\n) {\n const localization = useLocalization();\n const [pendingChanges, setPendingChanges] = React.useState<PendingChanges<TType>>({});\n // we maintain save status as separate state because 'complete' needs to briefly show after pendingChanges are deleted\n const [saveStates, setSaveState] = React.useState<Record<string, SaveState>>({});\n\n function getCellValue<T extends TType>(cell: ReactTableCell<T, unknown>): unknown | undefined {\n return pendingChanges[cell.row.id]?.[cell.column.id];\n }\n\n function getCellError<T extends TType>(cell: ReactTableCell<T, unknown>): string | undefined {\n return pendingChanges[cell.row.id]?._meta.errors?.cells?.[cell.column.id];\n }\n\n async function addCreatedRowChangeset(row) {\n const cells = row.getAllCells();\n\n setPendingChanges(currentChanges => {\n return cells.reduce((changes, cell) => {\n if (cell.getValue()) {\n return {\n ...changes,\n [cell.row.id]: {\n ...changes[cell.row.id],\n [cell.column.id]: cell.getValue(),\n _meta: {\n ...currentChanges[cell.row.id]?._meta,\n original: cell.row.original,\n moveReason: {\n ...currentChanges[cell.row.id]?._meta.moveReason,\n },\n errors: {\n ...currentChanges[cell.row.id]?._meta.errors,\n },\n },\n },\n };\n } else {\n return changes;\n }\n }, currentChanges);\n });\n }\n const pendingChangesUpdater = usePendingChangesUpdater(handleChange, setPendingChanges);\n\n async function setCellValue<T extends TType>(cell: ReactTableCell<T, unknown>, change: unknown, rowIndex: number) {\n const changes = {\n [cell.column.id]: change,\n } as Partial<T>;\n\n setPendingChanges(currentChanges => {\n const nextChanges = createPendingChangesSetter<T>(\n currentChanges as PendingChanges<T>,\n cell.row,\n rowIndex,\n changes,\n localization\n );\n pendingChangesUpdater.syncCellChanges(nextChanges);\n return nextChanges;\n });\n pendingChangesUpdater.runCellUpdates<T>(changes, cell, rowIndex);\n }\n\n async function validateCell<T extends TType>(cell: ReactTableCell<T, unknown>) {\n if (!validator || !isEnabled) {\n return;\n }\n\n const changeSet = getChangesetFromChanges(pendingChanges[cell.row.id]);\n\n // only validate if the cell being blurred actually has any changes\n if (cell.column.id in changeSet) {\n const errors = ((await validator(changeSet)) ?? {}) as Record<string, string>;\n\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n nextChanges[cell.row.id]._meta = {\n ...nextChanges[cell.row.id]._meta,\n errors: {\n ...nextChanges[cell.row.id]._meta.errors,\n cells: errors,\n shouldShowErrorAlert: !Object.keys(errors).length\n ? false\n : nextChanges[cell.row.id]._meta.errors.shouldShowErrorAlert,\n },\n };\n return nextChanges;\n });\n }\n }\n\n function hasRowErrors(rowId: string) {\n if (!isEnabled) {\n return false;\n }\n\n return (\n !!pendingChanges[rowId]?._meta.errors?.row || !!Object.keys(pendingChanges[rowId]?._meta.errors?.cells ?? {}).length\n );\n }\n\n function hasRowErrorsSeen(rowId: string) {\n if (!isEnabled) {\n return false;\n }\n\n return hasRowErrors(rowId) && !!pendingChanges[rowId]._meta.errors?.shouldShowErrorAlert;\n }\n function getRowPendingChange(rowId: string) {\n const rowPendingChanges = pendingChanges[rowId];\n\n if (rowPendingChanges) {\n const { _meta, ...pendingChange } = rowPendingChanges;\n\n return pendingChange;\n }\n\n return undefined;\n }\n\n function getRowSaveStatus(rowId: string) {\n if (!isEnabled) {\n return false;\n }\n\n return saveStates[rowId];\n }\n\n function setRowSaveStatus(rowId: string, status: 'pending' | 'complete' | undefined) {\n setSaveState(currentStates => {\n const nextStates = { ...currentStates };\n\n if (status) {\n nextStates[rowId] = status;\n } else {\n delete nextStates[rowId];\n }\n\n return nextStates;\n });\n }\n\n function getRowMoveReason(rowId: string) {\n return pendingChanges[rowId]?._meta.moveReason ? Object.values(pendingChanges[rowId]._meta.moveReason)[0] : undefined;\n }\n\n function hasChanges(rowId?: string) {\n if (!isEnabled) {\n return false;\n }\n\n return rowId ? !!pendingChanges[rowId] : !!Object.keys(pendingChanges).length;\n }\n\n function hasAlertErrors() {\n if (!isEnabled) {\n return false;\n }\n return !!getAlertErrors().length;\n }\n\n function getAlertErrors<T extends TType>() {\n return Object.keys(pendingChanges)\n .filter(hasRowErrorsSeen)\n .map(rowId => ({ rowId, pendingChange: pendingChanges[rowId] as PendingChange<T> }));\n }\n\n function resetChanges(rowId: string) {\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n delete nextChanges[rowId];\n return nextChanges;\n });\n }\n\n async function saveChanges(rowId: string | undefined = undefined) {\n if (!handleSave) {\n console.warn('Tried to save, but Table has no onEditingSave handler');\n return;\n }\n\n // we save back to pendingChanges, so make a copy of it's state when save was triggered\n const changesToSave = rowId ? { [rowId]: pendingChanges[rowId] } : { ...pendingChanges };\n const changes = Object.keys(changesToSave);\n\n if (changes.length) {\n for (const rowId of changes) {\n const pendingChange = changesToSave[rowId];\n\n const changeSet = getChangesetFromChanges(pendingChange);\n try {\n if (getRowSaveStatus(rowId) === 'pending') return;\n\n // set saving = true\n setRowSaveStatus(rowId, 'pending');\n\n // re-run validation, maybe a cell is already invalid but has never been blurred\n if (validator) {\n const errors = await validator(changeSet);\n\n if (errors && Object.keys(errors).length) {\n throw errors;\n }\n }\n // send new data to the server\n await handleSave(changeSet);\n\n // cleanup changes, we don't need them after saving\n resetChanges(rowId);\n setRowSaveStatus(rowId, 'complete');\n } catch (error) {\n // the onEditingSave handler should throw errors when something fails, e.g. validation, network errors etc\n // this code handles those errors and maps them either to row errors or cell specific errors\n let rowError;\n let cellErrors;\n\n if (typeof error === 'string') {\n rowError = error;\n } else if (error instanceof Error) {\n rowError = error.message;\n\n // most of our apis return error objects within this shape\n if (typeof (error as any).response?.data === 'object') {\n cellErrors = (error as any).response?.data;\n }\n } else if (typeof error === 'object') {\n cellErrors = error;\n }\n\n if (rowError || cellErrors) {\n setPendingChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n nextChanges[rowId]._meta.errors = {\n row: rowError,\n cells: cellErrors,\n shouldShowErrorAlert: true,\n };\n return nextChanges;\n });\n }\n\n setRowSaveStatus(rowId, undefined);\n }\n }\n }\n }\n\n function getCompletedRowsCount() {\n return Object.values(saveStates).filter(value => value === 'complete').length;\n }\n\n return {\n getCellValue,\n getCellError,\n setCellValue,\n validateCell,\n addCreatedRowChangeset,\n hasChanges,\n hasAlertErrors,\n getAlertErrors,\n saveChanges,\n resetChanges,\n hasRowErrors,\n hasRowErrorsSeen,\n getRowPendingChange,\n getRowSaveStatus,\n setRowSaveStatus,\n getRowMoveReason,\n getCompletedRowsCount,\n };\n}\n\nfunction useLastFocusedCellIndex(): [number | undefined, (index: number | undefined) => void] {\n // store the last focused cell, so that up/down arrow key navigation remains in the same column\n const lastFocusedCellIndexRef = React.useRef<number | undefined>(undefined);\n const setLastFocusedCellIndex = React.useCallback((index: number | undefined) => {\n lastFocusedCellIndexRef.current = index;\n }, []);\n\n return [lastFocusedCellIndexRef.current, setLastFocusedCellIndex];\n}\n\nfunction usePendingChangesUpdater<TType = unknown>(\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n setPendingChanges: React.Dispatch<React.SetStateAction<PendingChanges<TType>>>\n) {\n const localization = useLocalization();\n const updatersRef = React.useRef<PendingChanges<TType>>({});\n\n const runCellUpdates = React.useCallback(\n debounce(async function <T extends TType>(changes: Partial<T>, cell: ReactTableCell<T, unknown>, rowIndex: number) {\n if (typeof handleChange === 'function') {\n const previousValues = {\n ...cell.row.original,\n ...getChangesetFromChanges(updatersRef.current[cell.row.id]),\n };\n const nextValues = {\n ...previousValues,\n ...changes,\n };\n const updates = await handleChange(cell.column.id, changes[cell.column.id], nextValues, previousValues);\n\n if (updates && Object.keys(updates).length) {\n setPendingChanges(currentChanges =>\n createPendingChangesSetter(currentChanges, cell.row, rowIndex, updates, localization)\n );\n }\n }\n }, 250),\n []\n ) as unknown as <T extends TType>(changes: Partial<T>, cell: ReactTableCell<T, unknown>, rowIndex: number) => Promise<void>;\n\n function syncCellChanges<T extends TType>(changes: PendingChanges<T>) {\n updatersRef.current = changes;\n }\n\n return {\n syncCellChanges,\n runCellUpdates,\n };\n}\n\nfunction createPendingChangesSetter<TType = unknown>(\n currentChanges: PendingChanges<TType>,\n row: ReactTableRow<TType>,\n rowIndex: number,\n changes: Partial<TType>,\n localization: Localization\n) {\n // prepare\n const nextChanges: PendingChanges<TType> = { ...currentChanges };\n const rowChanges = {\n ...currentChanges[row.id],\n _meta: {\n ...currentChanges[row.id]?._meta,\n original: row.original,\n moveReason: {\n ...currentChanges[row.id]?._meta.moveReason,\n },\n errors: {\n ...currentChanges[row.id]?._meta.errors,\n },\n },\n } as PendingChange<TType>;\n\n // run changes\n const cells = row._getAllCellsByColumnId();\n\n for (const [accessor, change] of Object.entries(changes)) {\n // update if the change is different to the original (saved) value,\n // otherwise remove any change - no point saving the same value\n if (change !== row.original[accessor]) {\n rowChanges[accessor] = change;\n\n // consumers sometimes include properties in onEditingChange that aren't rendered as columns, we need to guard against that.\n // eslint-disable-next-line no-prototype-builtins\n if (cells.hasOwnProperty(accessor)) {\n // determine if the row will move position based on this change, and save why it will move\n const reason = willRowMove(cells[accessor], change, rowIndex, localization);\n\n if (reason) {\n rowChanges._meta.moveReason[accessor] = reason;\n } else {\n delete rowChanges._meta.moveReason[accessor];\n }\n }\n } else {\n delete rowChanges[accessor];\n delete rowChanges._meta.moveReason[accessor];\n }\n }\n\n // set changes\n // or delete if there are no changes left, so that we don't store changes with unchanged data\n if (Object.keys(rowChanges).filter(k => k !== '_meta').length) {\n nextChanges[row.id] = rowChanges;\n } else {\n delete nextChanges[row.id];\n }\n\n return nextChanges;\n}\n\nfunction getChangesetFromChanges<TType = unknown>(changes: PendingChange<TType>): TType {\n // extract the original data from the row changes\n const { _meta, ...changeset } = changes ?? {};\n // and mix them in with the changes, ready to send to the server\n return { ..._meta?.original, ...changeset };\n}\n"],"names":["useTableEditing","isEnabled","handleSave","handleChange","validator","isEditing","toggleEditing","React","useState","isDetailedMode","toggleDetailedMode","lastFocusedCellIndex","setLastFocusedCellIndex","useLastFocusedCellIndex","pendingChangesFns","usePendingChanges","useGlobalKeyDown","key","meta","shift","undefined","event","preventDefault","saveChanges","rowId","console","warn","Promise","resolve","changesToSave","pendingChanges","changes","Object","keys","length","_forOf","pendingChange","changeSet","getChangesetFromChanges","_catch","_temp3","_result","_exit","then","resetChanges","setRowSaveStatus","getRowSaveStatus","_temp2","errors","error","rowError","cellErrors","Error","_error$response","message","response","data","_error$response2","setPendingChanges","currentChanges","nextChanges","_meta","row","cells","shouldShowErrorAlert","e","reject","validateCell","cell","id","_temp","column","setCellValue","change","rowIndex","createPendingChangesSetter","localization","pendingChangesUpdater","syncCellChanges","runCellUpdates","addCreatedRowChangeset","getAllCells","reduce","getValue","_currentChanges$cell$","_currentChanges$cell$2","_currentChanges$cell$3","original","moveReason","useLocalization","saveStates","setSaveState","getCellValue","_pendingChanges$cell$","getCellError","_pendingChanges$cell$2","_pendingChanges$cell$3","_pendingChanges$cell$4","usePendingChangesUpdater","hasRowErrors","_pendingChanges$rowId","_pendingChanges$rowId2","_pendingChanges$rowId3","_pendingChanges$rowId4","_pendingChanges$rowId5","hasRowErrorsSeen","_pendingChanges$rowId6","getRowPendingChange","rowPendingChanges","status","currentStates","nextStates","getRowMoveReason","_pendingChanges$rowId7","values","hasChanges","hasAlertErrors","getAlertErrors","filter","map","getCompletedRowsCount","value","lastFocusedCellIndexRef","useRef","useCallback","index","current","updatersRef","debounce","previousValues","nextValues","updates","_temp4","rowChanges","_currentChanges$row$i","_currentChanges$row$i2","_currentChanges$row$i3","_getAllCellsByColumnId","accessor","entries","hasOwnProperty","reason","willRowMove","k","changeset"],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KAAK,aAALA,KAAK,uBAALA,KAAK,CAAE0B,QAAQ;IAAE,GAAGyD;GAAW;AAC/C;;;;"}
@@ -1,9 +1,13 @@
1
1
  import React__default from 'react';
2
2
  import { isElementInsideOrTriggeredFromContainer } from '../../../utils/dom.js';
3
+ import { useLocalization } from '../../Provider/Localization.js';
4
+ import { resetHighlightedColumnIndexes } from '../../../primitives/Table/useTableManager/util/search.js';
3
5
  import { useLazyEffect } from '../../../hooks/useLazyEffect.js';
4
6
 
5
7
  function useTableEditingListener(table, tableRef) {
6
8
  const tableMeta = table.options.meta;
9
+ const completedRowsCount = tableMeta.editing.getCompletedRowsCount();
10
+ const localization = useLocalization();
7
11
  const saveChanges = () => {
8
12
  requestAnimationFrame(() => {
9
13
  tableMeta.editing.saveChanges();
@@ -44,6 +48,11 @@ function useTableEditingListener(table, tableRef) {
44
48
  window.removeEventListener('beforeunload', showUnsavedChangesWarning);
45
49
  };
46
50
  }, [tableMeta.editing.isEditing, hasChanges]);
51
+ React__default.useEffect(() => {
52
+ if (completedRowsCount > 0) {
53
+ resetHighlightedColumnIndexes(table.getState().globalFilter, table, localization);
54
+ }
55
+ }, [completedRowsCount]);
47
56
  React__default.useEffect(() => {
48
57
  const onClickOutside = event => {
49
58
  if (tableMeta.editing.isEditing) {
@@ -1 +1 @@
1
- {"version":3,"file":"useTableEditingListener.js","sources":["../../../../../../../../src/components/Table3/listeners/useTableEditingListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useLazyEffect } from '../../../hooks/useLazyEffect';\nimport { isElementInsideOrTriggeredFromContainer } from '../../../utils/dom';\nimport { TableRef } from '../../../primitives/Table/types';\n\nexport function useTableEditingListener<TType = unknown>(table: ReactTable<TType>, tableRef: React.RefObject<TableRef>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const saveChanges = () => {\n requestAnimationFrame(() => {\n tableMeta.editing.saveChanges();\n });\n };\n\n // save when the row changes\n useLazyEffect(() => {\n if (tableMeta.editing.isEditing) {\n saveChanges();\n }\n }, [tableMeta.rowActive.rowActiveIndex]);\n\n useLazyEffect(() => {\n if (tableMeta.editing.isEditing) {\n if (tableMeta.rowActive.rowActiveIndex === undefined) {\n tableMeta.rowActive.setRowActiveIndex(0);\n }\n } else {\n // save\n saveChanges();\n // reset detailed mode\n tableMeta.editing.toggleDetailedMode(false);\n // reset the last index back to the first focusable element, when editing gets turned off\n tableMeta.editing.setLastFocusedCellIndex(undefined);\n }\n }, [tableMeta.editing.isEditing]);\n\n // show a warning if the user navigates away without triggering save, such as using the browser back/forward button\n const hasChanges = tableMeta.editing.hasChanges();\n\n React.useEffect(() => {\n function showUnsavedChangesWarning(event: BeforeUnloadEvent) {\n if (tableMeta.editing.isEditing && hasChanges) {\n event.returnValue = true;\n return true;\n }\n\n return false;\n }\n\n window.addEventListener('beforeunload', showUnsavedChangesWarning);\n\n return () => {\n window.removeEventListener('beforeunload', showUnsavedChangesWarning);\n };\n }, [tableMeta.editing.isEditing, hasChanges]);\n\n React.useEffect(() => {\n const onClickOutside = (event: MouseEvent) => {\n if (tableMeta.editing.isEditing) {\n const element = (event.target as Element)?.getAttribute('data-taco') ?? '';\n\n const insideTable =\n isElementInsideOrTriggeredFromContainer(event.target as Element, tableRef.current) || element === 'backdrop';\n\n if (!insideTable) {\n saveChanges();\n }\n }\n };\n\n document.addEventListener('click', onClickOutside);\n\n return () => document.removeEventListener('click', onClickOutside);\n }, [saveChanges, tableMeta.editing.isEditing]);\n}\n"],"names":["useTableEditingListener","table","tableRef","tableMeta","options","meta","saveChanges","requestAnimationFrame","editing","useLazyEffect","isEditing","rowActive","rowActiveIndex","undefined","setRowActiveIndex","toggleDetailedMode","setLastFocusedCellIndex","hasChanges","React","useEffect","showUnsavedChangesWarning","event","returnValue","window","addEventListener","removeEventListener","onClickOutside","_event$target$getAttr","_event$target","element","target","getAttribute","insideTable","isElementInsideOrTriggeredFromContainer","current","document"],"mappings":";;;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O,CAACE,SAAS,EAAEO,UAAU,CAAC,CAAC;EAE7CC,cAAK,CAACC,SAAS,CAAC;IACZ,MAAMO,cAAc,GAAIL,KAAiB;MACrC,IAAIlB,SAAS,CAACK,OAAO,CAACE,SAAS,EAAE;QAAA,IAAAiB,qBAAA,EAAAC,aAAA;QAC7B,MAAMC,OAAO,IAAAF,qBAAA,IAAAC,aAAA,GAAIP,KAAK,CAACS,MAAkB,cAAAF,aAAA,uBAAxBA,aAAA,CAA0BG,YAAY,CAAC,WAAW,CAAC,cAAAJ,qBAAA,cAAAA,qBAAA,GAAI,EAAE;QAE1E,MAAMK,WAAW,GACbC,uCAAuC,CAACZ,KAAK,CAACS,MAAiB,EAAE5B,QAAQ,CAACgC,OAAO,CAAC,IAAIL,OAAO,KAAK,UAAU;QAEhH,IAAI,CAACG,WAAW,EAAE;UACd1B,WAAW,EAAE;;;KAGxB;IAED6B,QAAQ,CAACX,gBAAgB,CAAC,OAAO,EAAEE,cAAc,CAAC;IAElD,OAAO,MAAMS,QAAQ,CAACV,mBAAmB,CAAC,OAAO,EAAEC,cAAc,CAAC;GACrE,EAAE,CAACpB,WAAW,EAAEH,SAAS,CAACK,OAAO,CAACE,SAAS,CAAC,CAAC;AAClD;;;;"}
1
+ {"version":3,"file":"useTableEditingListener.js","sources":["../../../../../../../../src/components/Table3/listeners/useTableEditingListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useLazyEffect } from '../../../hooks/useLazyEffect';\nimport { isElementInsideOrTriggeredFromContainer } from '../../../utils/dom';\nimport { TableRef } from '../../../primitives/Table/types';\nimport { resetHighlightedColumnIndexes } from '../../../primitives/Table/useTableManager/util/search';\nimport { useLocalization } from '../../Provider/Localization';\n\nexport function useTableEditingListener<TType = unknown>(table: ReactTable<TType>, tableRef: React.RefObject<TableRef>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const completedRowsCount = tableMeta.editing.getCompletedRowsCount();\n const localization = useLocalization();\n\n const saveChanges = () => {\n requestAnimationFrame(() => {\n tableMeta.editing.saveChanges();\n });\n };\n\n // save when the row changes\n useLazyEffect(() => {\n if (tableMeta.editing.isEditing) {\n saveChanges();\n }\n }, [tableMeta.rowActive.rowActiveIndex]);\n\n useLazyEffect(() => {\n if (tableMeta.editing.isEditing) {\n if (tableMeta.rowActive.rowActiveIndex === undefined) {\n tableMeta.rowActive.setRowActiveIndex(0);\n }\n } else {\n // save\n saveChanges();\n // reset detailed mode\n tableMeta.editing.toggleDetailedMode(false);\n // reset the last index back to the first focusable element, when editing gets turned off\n tableMeta.editing.setLastFocusedCellIndex(undefined);\n }\n }, [tableMeta.editing.isEditing]);\n\n // show a warning if the user navigates away without triggering save, such as using the browser back/forward button\n const hasChanges = tableMeta.editing.hasChanges();\n\n React.useEffect(() => {\n function showUnsavedChangesWarning(event: BeforeUnloadEvent) {\n if (tableMeta.editing.isEditing && hasChanges) {\n event.returnValue = true;\n return true;\n }\n\n return false;\n }\n\n window.addEventListener('beforeunload', showUnsavedChangesWarning);\n\n return () => {\n window.removeEventListener('beforeunload', showUnsavedChangesWarning);\n };\n }, [tableMeta.editing.isEditing, hasChanges]);\n\n React.useEffect(() => {\n if (completedRowsCount > 0) {\n resetHighlightedColumnIndexes(table.getState().globalFilter, table, localization);\n }\n }, [completedRowsCount]);\n\n React.useEffect(() => {\n const onClickOutside = (event: MouseEvent) => {\n if (tableMeta.editing.isEditing) {\n const element = (event.target as Element)?.getAttribute('data-taco') ?? '';\n\n const insideTable =\n isElementInsideOrTriggeredFromContainer(event.target as Element, tableRef.current) || element === 'backdrop';\n\n if (!insideTable) {\n saveChanges();\n }\n }\n };\n\n document.addEventListener('click', onClickOutside);\n\n return () => document.removeEventListener('click', onClickOutside);\n }, [saveChanges, tableMeta.editing.isEditing]);\n}\n"],"names":["useTableEditingListener","table","tableRef","tableMeta","options","meta","completedRowsCount","editing","getCompletedRowsCount","localization","useLocalization","saveChanges","requestAnimationFrame","useLazyEffect","isEditing","rowActive","rowActiveIndex","undefined","setRowActiveIndex","toggleDetailedMode","setLastFocusedCellIndex","hasChanges","React","useEffect","showUnsavedChangesWarning","event","returnValue","window","addEventListener","removeEventListener","resetHighlightedColumnIndexes","getState","globalFilter","onClickOutside","_event$target$getAttr","_event$target","element","target","getAttribute","insideTable","isElementInsideOrTriggeredFromContainer","current","document"],"mappings":";;;;;;SAQgBA,uBAAuBA,CAAkBC,KAAwB,EAAEC,QAAmC;EAClH,MAAMC,SAAS,GAAGF,KAAK,CAACG,OAAO,CAACC,IAA6B;EAC7D,MAAMC,kBAAkB,GAAGH,SAAS,CAACI,OAAO,CAACC,qBAAqB,EAAE;EACpE,MAAMC,YAAY,GAAGC,eAAe,EAAE;EAEtC,MAAMC,WAAW,GAAGA;IAChBC,qBAAqB,CAAC;MAClBT,SAAS,CAACI,OAAO,CAACI,WAAW,EAAE;KAClC,CAAC;GACL;;EAGDE,aAAa,CAAC;IACV,IAAIV,SAAS,CAACI,OAAO,CAACO,SAAS,EAAE;MAC7BH,WAAW,EAAE;;GAEpB,EAAE,CAACR,SAAS,CAACY,SAAS,CAACC,cAAc,CAAC,CAAC;EAExCH,aAAa,CAAC;IACV,IAAIV,SAAS,CAACI,OAAO,CAACO,SAAS,EAAE;MAC7B,IAAIX,SAAS,CAACY,SAAS,CAACC,cAAc,KAAKC,SAAS,EAAE;QAClDd,SAAS,CAACY,SAAS,CAACG,iBAAiB,CAAC,CAAC,CAAC;;KAE/C,MAAM;;MAEHP,WAAW,EAAE;;MAEbR,SAAS,CAACI,OAAO,CAACY,kBAAkB,CAAC,KAAK,CAAC;;MAE3ChB,SAAS,CAACI,OAAO,CAACa,uBAAuB,CAACH,SAAS,CAAC;;GAE3D,EAAE,CAACd,SAAS,CAACI,OAAO,CAACO,SAAS,CAAC,CAAC;;EAGjC,MAAMO,UAAU,GAAGlB,SAAS,CAACI,OAAO,CAACc,UAAU,EAAE;EAEjDC,cAAK,CAACC,SAAS,CAA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EI,cAAc,CAAC;GACrE,EAAE,CAACtB,WAAW,EAAER,SAAS,CAACI,OAAO,CAACO,SAAS,CAAC,CAAC;AAClD;;;;"}
@@ -10,7 +10,7 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
10
10
  hide = false,
11
11
  ...otherProps
12
12
  } = props;
13
- const className = cn(otherProps.className);
13
+ const className = cn('break-words', otherProps.className);
14
14
  if (hide) {
15
15
  return children;
16
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":["../../../../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\nimport cn from 'clsx';\n\nexport type TooltipProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> & {\n /** The element which activates the tooltip when hovered. Should be a single React/HTML element */\n children: React.ReactElement | any;\n /** Use this value to hide tooltip conditionally */\n hide?: boolean;\n /** Text displayed in the tooltip */\n title: string | JSX.Element;\n /**\n * Placement of the tooltip relative to the reference element. Placement will be reversed if a collision occurs\n * @defaultValue bottom\n */\n placement?: 'top' | 'right' | 'bottom' | 'left';\n};\n\nexport const Tooltip = React.forwardRef(function Tooltip(props: TooltipProps, ref: React.Ref<HTMLElement>) {\n const { title, children, placement, hide = false, ...otherProps } = props;\n const className = cn(otherProps.className);\n\n if (hide) {\n return children;\n }\n\n return (\n <TooltipPrimitive.Root delayDuration={250}>\n <TooltipPrimitive.Trigger asChild ref={ref as any}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content {...otherProps} asChild className={className} side={placement} sideOffset={3}>\n <div\n className=\"xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded-sm bg-blue-900 px-2 py-1 text-xs font-bold text-white print:hidden\"\n data-taco=\"tooltip\"\n style={{\n transformOrigin: 'var(--radix-tooltip-content-transform-origin)',\n }}>\n <TooltipPrimitive.Arrow className=\"-mt-px fill-blue-900/90 stroke-blue-900/90\" />\n {title}\n </div>\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n </TooltipPrimitive.Root>\n );\n});\n"],"names":["Tooltip","React","props","ref","title","children","placement","hide","otherProps","className","cn","TooltipPrimitive","delayDuration","asChild","side","sideOffset","style","transformOrigin"],"mappings":";;;;MAkBaA,OAAO,gBAAGC,UAAgB,CAAC,SAASD,OAAOA,CAACE,KAAmB,EAAEC,GAA2B;EACrG,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAEC,SAAS;IAAEC,IAAI,GAAG,KAAK;IAAE,GAAGC;GAAY,GAAGN,KAAK;EACzE,MAAMO,SAAS,GAAGC,EAAE,CAACF,UAAU,CAACC,SAAS,CAAC;EAE1C,IAAIF,IAAI,EAAE;IACN,OAAOF,QAAQ;;EAGnB,oBACIJ,cAACU,IAAqB;IAACC,aAAa,EAAE;kBAClCX,cAACU,OAAwB;IAACE,OAAO;IAACV,GAAG,EAAEA;KAClCE,QAAQ,CACc,eAC3BJ,cAACU,MAAuB,qBACpBV,cAACU,OAAwB,oBAAKH,UAAU;IAAEK,OAAO;IAACJ,SAAS,EAAEA,SAAS;IAAEK,IAAI,EAAER,SAAS;IAAES,UAAU,EAAE;mBACjGd;IACIQ,SAAS,EAAC,2JAA2J;iBAC3J,SAAS;IACnBO,KAAK,EAAE;MACHC,eAAe,EAAE;;kBAErBhB,cAACU,KAAsB;IAACF,SAAS,EAAC;IAA+C,EAChFL,KAAK,CACJ,CACiB,CACL,CACN;AAEhC,CAAC;;;;"}
1
+ {"version":3,"file":"Tooltip.js","sources":["../../../../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\nimport cn from 'clsx';\n\nexport type TooltipProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> & {\n /** The element which activates the tooltip when hovered. Should be a single React/HTML element */\n children: React.ReactElement | any;\n /** Use this value to hide tooltip conditionally */\n hide?: boolean;\n /** Text displayed in the tooltip */\n title: string | JSX.Element;\n /**\n * Placement of the tooltip relative to the reference element. Placement will be reversed if a collision occurs\n * @defaultValue bottom\n */\n placement?: 'top' | 'right' | 'bottom' | 'left';\n};\n\nexport const Tooltip = React.forwardRef(function Tooltip(props: TooltipProps, ref: React.Ref<HTMLElement>) {\n const { title, children, placement, hide = false, ...otherProps } = props;\n const className = cn('break-words', otherProps.className);\n\n if (hide) {\n return children;\n }\n\n return (\n <TooltipPrimitive.Root delayDuration={250}>\n <TooltipPrimitive.Trigger asChild ref={ref as any}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content {...otherProps} asChild className={className} side={placement} sideOffset={3}>\n <div\n className=\"xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded-sm bg-blue-900 px-2 py-1 text-xs font-bold text-white print:hidden\"\n data-taco=\"tooltip\"\n style={{\n transformOrigin: 'var(--radix-tooltip-content-transform-origin)',\n }}>\n <TooltipPrimitive.Arrow className=\"-mt-px fill-blue-900/90 stroke-blue-900/90\" />\n {title}\n </div>\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n </TooltipPrimitive.Root>\n );\n});\n"],"names":["Tooltip","React","props","ref","title","children","placement","hide","otherProps","className","cn","TooltipPrimitive","delayDuration","asChild","side","sideOffset","style","transformOrigin"],"mappings":";;;;MAkBaA,OAAO,gBAAGC,UAAgB,CAAC,SAASD,OAAOA,CAACE,KAAmB,EAAEC,GAA2B;EACrG,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAEC,SAAS;IAAEC,IAAI,GAAG,KAAK;IAAE,GAAGC;GAAY,GAAGN,KAAK;EACzE,MAAMO,SAAS,GAAGC,EAAE,CAAC,aAAa,EAAEF,UAAU,CAACC,SAAS,CAAC;EAEzD,IAAIF,IAAI,EAAE;IACN,OAAOF,QAAQ;;EAGnB,oBACIJ,cAACU,IAAqB;IAACC,aAAa,EAAE;kBAClCX,cAACU,OAAwB;IAACE,OAAO;IAACV,GAAG,EAAEA;KAClCE,QAAQ,CACc,eAC3BJ,cAACU,MAAuB,qBACpBV,cAACU,OAAwB,oBAAKH,UAAU;IAAEK,OAAO;IAACJ,SAAS,EAAEA,SAAS;IAAEK,IAAI,EAAER,SAAS;IAAES,UAAU,EAAE;mBACjGd;IACIQ,SAAS,EAAC,2JAA2J;iBAC3J,SAAS;IACnBO,KAAK,EAAE;MACHC,eAAe,EAAE;;kBAErBhB,cAACU,KAAsB;IAACF,SAAS,EAAC;IAA+C,EAChFL,KAAK,CACJ,CACiB,CACL,CACN;AAEhC,CAAC;;;;"}
@@ -36,6 +36,8 @@ function TableGrid(props) {
36
36
  table.meta.rowActive.handleFocus(event, table.meta.length, table.renderer.scrollToIndex);
37
37
  } : undefined;
38
38
  const filterReason = getFilterReason(table);
39
+ const searchNotApplied = !table.state.globalFilter || table.state.globalFilter === '';
40
+ const filtersNotApplied = !table.state.columnFilters || table.state.columnFilters.length === 0;
39
41
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("style", null, table.stylesheet), /*#__PURE__*/React__default.createElement(FocusScope, null, /*#__PURE__*/React__default.createElement("table", Object.assign({}, attributes, {
40
42
  id: table.id,
41
43
  "data-table-font-size": table.meta.fontSize.size,
@@ -68,7 +70,7 @@ function TableGrid(props) {
68
70
  ...table.renderer.style,
69
71
  height: table.renderer.style.height + ROW_HEIGHT_ESTIMATES[table.meta.rowHeight.height]
70
72
  } : table.renderer.style
71
- }, table.renderer.rows, props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
73
+ }, table.renderer.rows, searchNotApplied && filtersNotApplied && props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
72
74
  table: table.instance
73
75
  }) : null)))));
74
76
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Table.js","sources":["../../../../../../../../src/primitives/Table/Core/Table.tsx"],"sourcesContent":["import React from 'react';\nimport { FocusScope } from '@react-aria/focus';\nimport { Header } from './components/Header/Header';\nimport { Body } from './components/Body/Body';\nimport { Foot } from './components/Footer/Footer';\nimport { EmptyStateBody } from './components/Body/EmptyStateBody';\nimport { useTableReturnValue } from './useTable';\nimport { TableToolbar } from './components/Toolbar/Toolbar';\nimport './style.css';\nimport { TableEmptyStateReason } from '../types';\nimport { ROW_HEIGHT_ESTIMATES } from './util/rows';\n\ntype TableProps = {\n children: JSX.Element | Array<JSX.Element | null>;\n};\n\nexport function Table(props: TableProps) {\n return <>{props.children}</>;\n}\nTable.Toolbar = TableToolbar;\nTable.Grid = TableGrid;\n\nexport type TableGridProps<TType = unknown> = React.TableHTMLAttributes<HTMLTableElement> & {\n 'data-taco': string;\n enableHorizontalArrowKeyNavigation?: boolean;\n table: useTableReturnValue<TType>;\n};\n\nfunction getFilterReason<TType = unknown>(table: useTableReturnValue<TType>): TableEmptyStateReason | null {\n if (table.instance.getFilteredRowModel().rows.length === 0 && table.instance.getCoreRowModel().rows.length !== 0) {\n const state = table.instance.getState();\n\n if (table.meta.search.enableGlobalFilter && !!state.globalFilter) {\n return 'searching';\n }\n\n return 'filtering';\n }\n if (table.instance.getCoreRowModel().rows.length === 0) {\n return 'empty';\n }\n\n return null;\n}\n\nexport function TableGrid<TType = unknown>(props: TableGridProps<TType>) {\n const { enableHorizontalArrowKeyNavigation, table, ...attributes } = props;\n const handleFocus =\n table.meta.rowActive.rowActiveIndex === undefined\n ? (event: React.FocusEvent) => {\n table.meta.rowActive.handleFocus(event, table.meta.length, table.renderer.scrollToIndex);\n }\n : undefined;\n const filterReason = getFilterReason(table);\n\n return (\n <>\n <style>{table.stylesheet}</style>\n <FocusScope>\n <table\n {...attributes}\n id={table.id}\n data-table-font-size={table.meta.fontSize.size}\n data-table-grouped={!!table.state.grouping?.length}\n data-table-horizontally-scrolled={table.meta.columnFreezing.isHorizontallyScrolled ? true : undefined}\n data-table-status={table.meta.server.isEnabled ? (table.meta.server.isReady ? 'ready' : undefined) : 'ready'}\n data-table-pause-hover={table.meta.rowActive.isHoverStatePaused ? true : undefined}\n data-table-resizing={table.state.columnSizingInfo.isResizingColumn ? true : undefined}\n data-table-row-height={table.meta.rowHeight.height}\n onFocus={handleFocus}\n onScroll={table.meta.columnFreezing.handleScroll}\n ref={table.ref}\n style={table.style}\n tabIndex={-1}>\n <thead>\n {table.instance.getHeaderGroups().map(headerGroup => (\n <tr key={headerGroup.id}>\n {headerGroup.headers.map(props => (\n <Header key={props.id} header={props} scrollToIndex={table.renderer.scrollToIndex} />\n ))}\n </tr>\n ))}\n </thead>\n {filterReason ? (\n <EmptyStateBody emptyState={props.table.props.emptyState} reason={filterReason} />\n ) : (\n <>\n <Body\n enableHorizontalArrowKeyNavigation={enableHorizontalArrowKeyNavigation}\n table={table.instance}\n tableElement={table.ref.current}\n scrollToIndex={table.renderer.scrollToIndex}\n style={\n props.children\n ? {\n ...table.renderer.style,\n height:\n (table.renderer.style.height as number) +\n ROW_HEIGHT_ESTIMATES[table.meta.rowHeight.height],\n }\n : table.renderer.style\n }>\n {table.renderer.rows}\n {props.children}\n </Body>\n {table.meta.footer.isEnabled ? <Foot table={table.instance} /> : null}\n </>\n )}\n </table>\n </FocusScope>\n </>\n );\n}\n"],"names":["Table","props","React","children","Toolbar","TableToolbar","Grid","TableGrid","getFilterReason","table","instance","getFilteredRowModel","rows","length","getCoreRowModel","state","getState","meta","search","enableGlobalFilter","globalFilter","enableHorizontalArrowKeyNavigation","attributes","handleFocus","rowActive","rowActiveIndex","undefined","event","renderer","scrollToIndex","filterReason","stylesheet","FocusScope","id","fontSize","size","_table$state$grouping","grouping","columnFreezing","isHorizontallyScrolled","server","isEnabled","isReady","isHoverStatePaused","columnSizingInfo","isResizingColumn","rowHeight","height","onFocus","onScroll","handleScroll","ref","style","tabIndex","getHeaderGroups","map","headerGroup","key","headers","Header","header","EmptyStateBody","emptyState","reason","Body","tableElement","current","ROW_H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QAAQ,CAACC;IAAiB,CACxF,CAAC,CACD,CACR,CAAC,CACE,EACPC,YAAY,iBACT5B,6BAAC2D,cAAc;IAACC,UAAU,EAAE7D,KAAK,CAACQ,KAAK,CAACR,KAAK,CAAC6D,UAAU;IAAEC,MAAM,EAAEjC;IAAgB,kBAElF5B,yEACIA,6BAAC8D,IAAI;IACD3C,kCAAkC,EAAEA,kCAAkC;IACtEZ,KAAK,EAAEA,KAAK,CAACC,QAAQ;IACrBuD,YAAY,EAAExD,KAAK,CAAC0C,GAAG,CAACe,OAAO;IAC/BrC,aAAa,EAAEpB,KAAK,CAACmB,QAAQ,CAACC,aAAa;IAC3CuB,KAAK,EACDnD,KAAK,CAACE,QAAQ,GACR;MACI,GAAGM,KAAK,CAACmB,QAAQ,CAACwB,KAAK;MACvBL,MAAM,EACDtC,KAAK,CAACmB,QAAQ,CAACwB,KAAK,CAACL,MAAiB,GACvCoB,oBAAoB,CAAC1D,KAAK,CAACQ,IAAI,CAAC6B,SAAS,CAACC,MAAM;KACvD,GACDtC,KAAK,CAACmB,QAAQ,CAACwB;KAExB3C,KAAK,CAACmB,QAAQ,CAAChB,IAAI,EACnBX,KAAK,CAACE,QAAQ,CACZ,EACNM,KAAK,CAACQ,IAAI,CAACmD,MAAM,CAAC3B,SAAS,gBAAGvC,6BAACmE,IAAI;IAAC5D,KAAK,EAAEA,KAAK,CAACC;IAAY,GAAG,IAAI,CACtE,CACN,CACG,CACC,CACd;AAEX;;;;"}
1
+ {"version":3,"file":"Table.js","sources":["../../../../../../../../src/primitives/Table/Core/Table.tsx"],"sourcesContent":["import React from 'react';\nimport { FocusScope } from '@react-aria/focus';\nimport { Header } from './components/Header/Header';\nimport { Body } from './components/Body/Body';\nimport { Foot } from './components/Footer/Footer';\nimport { EmptyStateBody } from './components/Body/EmptyStateBody';\nimport { useTableReturnValue } from './useTable';\nimport { TableToolbar } from './components/Toolbar/Toolbar';\nimport './style.css';\nimport { TableEmptyStateReason } from '../types';\nimport { ROW_HEIGHT_ESTIMATES } from './util/rows';\n\ntype TableProps = {\n children: JSX.Element | Array<JSX.Element | null>;\n};\n\nexport function Table(props: TableProps) {\n return <>{props.children}</>;\n}\nTable.Toolbar = TableToolbar;\nTable.Grid = TableGrid;\n\nexport type TableGridProps<TType = unknown> = React.TableHTMLAttributes<HTMLTableElement> & {\n 'data-taco': string;\n enableHorizontalArrowKeyNavigation?: boolean;\n table: useTableReturnValue<TType>;\n};\n\nfunction getFilterReason<TType = unknown>(table: useTableReturnValue<TType>): TableEmptyStateReason | null {\n if (table.instance.getFilteredRowModel().rows.length === 0 && table.instance.getCoreRowModel().rows.length !== 0) {\n const state = table.instance.getState();\n\n if (table.meta.search.enableGlobalFilter && !!state.globalFilter) {\n return 'searching';\n }\n\n return 'filtering';\n }\n if (table.instance.getCoreRowModel().rows.length === 0) {\n return 'empty';\n }\n\n return null;\n}\n\nexport function TableGrid<TType = unknown>(props: TableGridProps<TType>) {\n const { enableHorizontalArrowKeyNavigation, table, ...attributes } = props;\n const handleFocus =\n table.meta.rowActive.rowActiveIndex === undefined\n ? (event: React.FocusEvent) => {\n table.meta.rowActive.handleFocus(event, table.meta.length, table.renderer.scrollToIndex);\n }\n : undefined;\n const filterReason = getFilterReason(table);\n\n const searchNotApplied = !table.state.globalFilter || table.state.globalFilter === '';\n const filtersNotApplied = !table.state.columnFilters || table.state.columnFilters.length === 0;\n\n return (\n <>\n <style>{table.stylesheet}</style>\n <FocusScope>\n <table\n {...attributes}\n id={table.id}\n data-table-font-size={table.meta.fontSize.size}\n data-table-grouped={!!table.state.grouping?.length}\n data-table-horizontally-scrolled={table.meta.columnFreezing.isHorizontallyScrolled ? true : undefined}\n data-table-status={table.meta.server.isEnabled ? (table.meta.server.isReady ? 'ready' : undefined) : 'ready'}\n data-table-pause-hover={table.meta.rowActive.isHoverStatePaused ? true : undefined}\n data-table-resizing={table.state.columnSizingInfo.isResizingColumn ? true : undefined}\n data-table-row-height={table.meta.rowHeight.height}\n onFocus={handleFocus}\n onScroll={table.meta.columnFreezing.handleScroll}\n ref={table.ref}\n style={table.style}\n tabIndex={-1}>\n <thead>\n {table.instance.getHeaderGroups().map(headerGroup => (\n <tr key={headerGroup.id}>\n {headerGroup.headers.map(props => (\n <Header key={props.id} header={props} scrollToIndex={table.renderer.scrollToIndex} />\n ))}\n </tr>\n ))}\n </thead>\n {filterReason ? (\n <EmptyStateBody emptyState={props.table.props.emptyState} reason={filterReason} />\n ) : (\n <>\n <Body\n enableHorizontalArrowKeyNavigation={enableHorizontalArrowKeyNavigation}\n table={table.instance}\n tableElement={table.ref.current}\n scrollToIndex={table.renderer.scrollToIndex}\n style={\n props.children\n ? {\n ...table.renderer.style,\n height:\n (table.renderer.style.height as number) +\n ROW_HEIGHT_ESTIMATES[table.meta.rowHeight.height],\n }\n : table.renderer.style\n }>\n {table.renderer.rows}\n {searchNotApplied && filtersNotApplied && props.children}\n </Body>\n {table.meta.footer.isEnabled ? <Foot table={table.instance} /> : null}\n </>\n )}\n </table>\n </FocusScope>\n </>\n );\n}\n"],"names":["Table","props","React","children","Toolbar","TableToolbar","Grid","TableGrid","getFilterReason","table","instance","getFilteredRowModel","rows","length","getCoreRowModel","state","getState","meta","search","enableGlobalFilter","globalFilter","enableHorizontalArrowKeyNavigation","attributes","handleFocus","rowActive","rowActiveIndex","undefined","event","renderer","scrollToIndex","filterReason","searchNotApplied","filtersNotApplied","columnFilters","stylesheet","FocusScope","id","fontSize","size","_table$state$grouping","grouping","columnFreezing","isHorizontallyScrolled","server","isEnabled","isReady","isHoverStatePaused","columnSizingInfo","isResizingColumn","rowHeight","height","onFocus","onScroll","handleScroll","ref","style","tabIndex","getHeaderGroups","map","headerGroup","key","headers","Header","header","EmptyStateBody","emptyState","reason","Body","tableElement","current","ROW_HEIGHT_ESTIMATES","footer","Foot"],"mappings":";;;;;;;;;SAgBgBA,KAAKA,CAACC,KAAiB;EACnC,oBAAOC,4DAAGD,KAAK,CAACE,QAAQ,CAAI;AAChC;AACAH,KAAK,C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MAAM;IAACF,GAAG,EAAE3D,KAAK,CAACmC,EAAE;IAAE2B,MAAM,EAAE9D,KAAK;IAAE4B,aAAa,EAAEpB,KAAK,CAACmB,QAAQ,CAACC;IAAiB,CACxF,CAAC,CACD,CACR,CAAC,CACE,EACPC,YAAY,iBACT5B,6BAAC8D,cAAc;IAACC,UAAU,EAAEhE,KAAK,CAACQ,KAAK,CAACR,KAAK,CAACgE,UAAU;IAAEC,MAAM,EAAEpC;IAAgB,kBAElF5B,yEACIA,6BAACiE,IAAI;IACD9C,kCAAkC,EAAEA,kCAAkC;IACtEZ,KAAK,EAAEA,KAAK,CAACC,QAAQ;IACrB0D,YAAY,EAAE3D,KAAK,CAAC6C,GAAG,CAACe,OAAO;IAC/BxC,aAAa,EAAEpB,KAAK,CAACmB,QAAQ,CAACC,aAAa;IAC3C0B,KAAK,EACDtD,KAAK,CAACE,QAAQ,GACR;MACI,GAAGM,KAAK,CAACmB,QAAQ,CAAC2B,KAAK;MACvBL,MAAM,EACDzC,KAAK,CAACmB,QAAQ,CAAC2B,KAAK,CAACL,MAAiB,GACvCoB,oBAAoB,CAAC7D,KAAK,CAACQ,IAAI,CAACgC,SAAS,CAACC,MAAM;KACvD,GACDzC,KAAK,CAACmB,QAAQ,CAAC2B;KAExB9C,KAAK,CAACmB,QAAQ,CAAChB,IAAI,EACnBmB,gBAAgB,IAAIC,iBAAiB,IAAI/B,KAAK,CAACE,QAAQ,CACrD,EACNM,KAAK,CAACQ,IAAI,CAACsD,MAAM,CAAC3B,SAAS,gBAAG1C,6BAACsE,IAAI;IAAC/D,KAAK,EAAEA,KAAK,CAACC;IAAY,GAAG,IAAI,CACtE,CACN,CACG,CACC,CACd;AAEX;;;;"}
@@ -28,7 +28,6 @@ function GroupedCell(props) {
28
28
  canShowActions: canShowActions,
29
29
  cellRef: cellRef,
30
30
  colSpan: colSpan,
31
- fontSize: tableMeta.fontSize.size,
32
31
  rowActions: tableMeta.rowGroups.rowActionsForGroup,
33
32
  rowId: cell.row.id,
34
33
  subRows: subRows
@@ -40,7 +39,6 @@ const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupe
40
39
  cellRef,
41
40
  children,
42
41
  colSpan,
43
- fontSize,
44
42
  rowActions,
45
43
  rowId,
46
44
  subRows,
@@ -57,7 +55,6 @@ const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupe
57
55
  actions: rowActions,
58
56
  actionsLength: 4,
59
57
  data: subRows,
60
- fontSize: fontSize,
61
58
  isActiveRow: true,
62
59
  rowId: rowId
63
60
  })) : null);
@@ -1 +1 @@
1
- {"version":3,"file":"GroupedCell.js","sources":["../../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta, ColumnMeta as ReactTableColumnMeta } from '@tanstack/react-table';\nimport { getCellAttributes } from '../util';\nimport { Actions as RowGroupActions } from '../../Internal/Actions';\nimport { isInternalColumn } from '../../../../../useTableManager/util/columns';\nimport { RowContext } from '../../../Row/RowContext';\nimport { TableFontSize, TableRowActionGroupRenderer } from '../../../../../types';\nimport { TableCellRendererProps } from '../../../../types';\n\nexport function GroupedCell<TType = unknown>(props: TableCellRendererProps<TType>) {\n const { cell, cellRef, index, isHighlighted } = props;\n const tableMeta = cell.getContext().table.options.meta as ReactTableMeta<TType>;\n const columnMeta = cell.column.columnDef.meta as ReactTableColumnMeta<TType, unknown>;\n const attributes = getCellAttributes(cell, index, isHighlighted);\n\n const { isHovered, rowIndex } = React.useContext(RowContext);\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;\n const canShowActions = isActiveRow || (isHovered && !tableMeta.rowActive.isHoverStatePaused);\n\n const colSpan = cell.row.getVisibleCells().filter(c => !isInternalColumn(c.column.id)).length - 1;\n const content = columnMeta.renderer?.(cell.getValue<TType>(), cell.row.original) ?? cell.getValue() ?? null;\n const subRows = cell.getContext().row.subRows.map(row => row.original);\n\n return (\n <MemoedGroupedCell<TType>\n {...attributes}\n canShowActions={canShowActions}\n cellRef={cellRef}\n colSpan={colSpan}\n fontSize={tableMeta.fontSize.size}\n rowActions={tableMeta.rowGroups.rowActionsForGroup}\n rowId={cell.row.id}\n subRows={subRows}>\n {content}\n </MemoedGroupedCell>\n );\n}\n\ntype MemoedGroupedCellProps<TType = unknown> = React.TdHTMLAttributes<HTMLTableCellElement> & {\n canShowActions: boolean;\n cellRef: React.RefObject<HTMLTableCellElement>;\n colSpan: number;\n fontSize: TableFontSize;\n rowActions?: TableRowActionGroupRenderer<TType>[];\n rowId: string;\n subRows: TType[];\n};\n\nconst MemoedGroupedCell = React.memo(function MemoedGroupedCell<TType = unknown>(props: MemoedGroupedCellProps<TType>) {\n const { canShowActions, cellRef, children, colSpan, fontSize, rowActions, rowId, subRows, ...attributes } = props;\n\n return (\n <td {...attributes} ref={cellRef} style={{ gridColumn: `span ${colSpan} / span ${colSpan}` }}>\n <span className=\"grow\">{children}</span>\n {rowActions?.length && canShowActions ? (\n <RowGroupActions\n actions={rowActions}\n actionsLength={4}\n data={subRows}\n fontSize={fontSize}\n isActiveRow\n rowId={rowId}\n />\n ) : null}\n </td>\n );\n}) as <TType = unknown>(props: MemoedGroupedCellProps<TType>) => JSX.Element;\n"],"names":["GroupedCell","props","cell","cellRef","index","isHighlighted","tableMeta","getContext","table","options","meta","columnMeta","column","columnDef","attributes","getCellAttributes","isHovered","rowIndex","React","useContext","RowContext","isActiveRow","rowActive","rowActiveIndex","canShowActions","isHoverStatePaused","colSpan","row","getVisibleCells","filter","c","isInternalColumn","id","length","content","_ref","_columnMeta$renderer","_columnMeta$renderer2","renderer","call","getValue","original","subRows","map","MemoedGroupedCell","fontSize","size","rowActions","rowGroups","rowActionsForGroup","rowId","memo","children","ref","style","gridColumn","className","RowGroupActions","actions","actionsLength","data"],"mappings":";;;;;;SASgBA,WAAWA,CAAkBC,KAAoC;;EAC7E,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAEC,K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c,EAAEA,cAAc;IAC9BrB,OAAO,EAAEA,OAAO;IAChBuB,OAAO,EAAEA,OAAO;IAChBmB,QAAQ,EAAEvC,SAAS,CAACuC,QAAQ,CAACC,IAAI;IACjCC,UAAU,EAAEzC,SAAS,CAAC0C,SAAS,CAACC,kBAAkB;IAClDC,KAAK,EAAEhD,IAAI,CAACyB,GAAG,CAACK,EAAE;IAClBU,OAAO,EAAEA;MACRR,OAAO,CACQ;AAE5B;AAYA,MAAMU,iBAAiB,gBAAG1B,cAAK,CAACiC,IAAI,CAAC,SAASP,iBAAiBA,CAAkB3C,KAAoC;EACjH,MAAM;IAAEuB,cAAc;IAAErB,OAAO;IAAEiD,QAAQ;IAAE1B,OAAO;IAAEmB,QAAQ;IAAEE,UAAU;IAAEG,KAAK;IAAER,OAAO;IAAE,GAAG5B;GAAY,GAAGb,KAAK;EAEjH,oBACIiB,qDAAQJ,UAAU;IAAEuC,GAAG,EAAElD,OAAO;IAAEmD,KAAK,EAAE;MAAEC,UAAU,EAAE,QAAQ7B,OAAO,WAAWA,OAAO;;mBACpFR;IAAMsC,SAAS,EAAC;KAAQJ,QAAQ,CAAQ,EACvCL,UAAU,aAAVA,UAAU,eAAVA,UAAU,CAAEd,MAAM,IAAIT,cAAc,iBACjCN,6BAACuC,OAAe;IACZC,OAAO,EAAEX,UAAU;IACnBY,aAAa,EAAE,CAAC;IAChBC,IAAI,EAAElB,OAAO;IACbG,QAAQ,EAAEA,QAAQ;IAClBxB,WAAW;IACX6B,KAAK,EAAEA;IACT,IACF,IAAI,CACP;AAEb,CAAC,CAA2E;;;;"}
1
+ {"version":3,"file":"GroupedCell.js","sources":["../../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta, ColumnMeta as ReactTableColumnMeta } from '@tanstack/react-table';\nimport { getCellAttributes } from '../util';\nimport { Actions as RowGroupActions } from '../../Internal/Actions';\nimport { isInternalColumn } from '../../../../../useTableManager/util/columns';\nimport { RowContext } from '../../../Row/RowContext';\nimport { TableRowActionGroupRenderer } from '../../../../../types';\nimport { TableCellRendererProps } from '../../../../types';\n\nexport function GroupedCell<TType = unknown>(props: TableCellRendererProps<TType>) {\n const { cell, cellRef, index, isHighlighted } = props;\n const tableMeta = cell.getContext().table.options.meta as ReactTableMeta<TType>;\n const columnMeta = cell.column.columnDef.meta as ReactTableColumnMeta<TType, unknown>;\n const attributes = getCellAttributes(cell, index, isHighlighted);\n\n const { isHovered, rowIndex } = React.useContext(RowContext);\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;\n const canShowActions = isActiveRow || (isHovered && !tableMeta.rowActive.isHoverStatePaused);\n\n const colSpan = cell.row.getVisibleCells().filter(c => !isInternalColumn(c.column.id)).length - 1;\n const content = columnMeta.renderer?.(cell.getValue<TType>(), cell.row.original) ?? cell.getValue() ?? null;\n const subRows = cell.getContext().row.subRows.map(row => row.original);\n\n return (\n <MemoedGroupedCell<TType>\n {...attributes}\n canShowActions={canShowActions}\n cellRef={cellRef}\n colSpan={colSpan}\n rowActions={tableMeta.rowGroups.rowActionsForGroup}\n rowId={cell.row.id}\n subRows={subRows}>\n {content}\n </MemoedGroupedCell>\n );\n}\n\ntype MemoedGroupedCellProps<TType = unknown> = React.TdHTMLAttributes<HTMLTableCellElement> & {\n canShowActions: boolean;\n cellRef: React.RefObject<HTMLTableCellElement>;\n colSpan: number;\n rowActions?: TableRowActionGroupRenderer<TType>[];\n rowId: string;\n subRows: TType[];\n};\n\nconst MemoedGroupedCell = React.memo(function MemoedGroupedCell<TType = unknown>(props: MemoedGroupedCellProps<TType>) {\n const { canShowActions, cellRef, children, colSpan, rowActions, rowId, subRows, ...attributes } = props;\n\n return (\n <td {...attributes} ref={cellRef} style={{ gridColumn: `span ${colSpan} / span ${colSpan}` }}>\n <span className=\"grow\">{children}</span>\n {rowActions?.length && canShowActions ? (\n <RowGroupActions actions={rowActions} actionsLength={4} data={subRows} isActiveRow rowId={rowId} />\n ) : null}\n </td>\n );\n}) as <TType = unknown>(props: MemoedGroupedCellProps<TType>) => JSX.Element;\n"],"names":["GroupedCell","props","cell","cellRef","index","isHighlighted","tableMeta","getContext","table","options","meta","columnMeta","column","columnDef","attributes","getCellAttributes","isHovered","rowIndex","React","useContext","RowContext","isActiveRow","rowActive","rowActiveIndex","canShowActions","isHoverStatePaused","colSpan","row","getVisibleCells","filter","c","isInternalColumn","id","length","content","_ref","_columnMeta$renderer","_columnMeta$renderer2","renderer","call","getValue","original","subRows","map","MemoedGroupedCell","rowActions","rowGroups","rowActionsForGroup","rowId","memo","children","ref","style","gridColumn","className","RowGroupActions","actions","actionsLength","data"],"mappings":";;;;;;SASgBA,WAAWA,CAAkBC,KAAoC;;EAC7E,MAAM;IAAEC,IAAI;IAAEC,OAAO;IAAEC,KAAK;IAAEC;GAAe,GAAGJ,KAAK;EACrD,MAAMK,SAAS,GAAGJ,IAAI,CAACK,UAAU,EAAE,CAACC,KAAK,CAACC,OAAO,CAACC,IAA6B;EAC/E,MAAMC,UAAU,GAAGT,IAAI,CAACU,MAAM,CAACC,SAAS,CAACH,IAA4C;EACrF,MAAMI,UAAU,GAAGC,iBAAiB,CAACb,IAAI,EAAEE,KAAK,EAAEC,aAAa,CAAC;EAEhE,MAAM;IAAEW,SAAS;IAAEC;GAAU,GAAGC,cAAK,CAACC,UAAU,CAACC,UAAU,CAAC;EAC5D,MAAMC,WAAW,GAAGf,SAAS,CAACgB,SAAS,CAACC,cAAc,KAAKN,QAAQ;EACnE,MAAMO,cAAc,GAAGH,WAAW,IAAKL,SAAS,IAAI,CAACV,SAAS,CAACgB,SAAS,CAACG,kBAAmB;EAE5F,MAAMC,OAAO,GAAGxB,IAAI,CAACyB,GAAG,CAACC,eAAe,EAAE,CAACC,MAAM,CAACC,CAAC,IAAI,CAACC,gBAAgB,CAACD,CAAC,CAAClB,MAAM,CAACoB,EAAE,CAAC,CAAC,CAACC,MAAM,GAAG,CAAC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cAAc,iBACjCN,6BAACqC,OAAe;IAACC,OAAO,EAAEX,UAAU;IAAEY,aAAa,EAAE,CAAC;IAAEC,IAAI,EAAEhB,OAAO;IAAErB,WAAW;IAAC2B,KAAK,EAAEA;IAAS,IACnG,IAAI,CACP;AAEb,CAAC,CAA2E;;;;"}
@@ -4,7 +4,6 @@ import { IconButton } from '../../../../../../components/IconButton/IconButton.j
4
4
  import { useLocalization } from '../../../../../../components/Provider/Localization.js';
5
5
  import { Shortcut } from '../../../../../../components/Shortcut/Shortcut.js';
6
6
  import { Menu } from '../../../../../../components/Menu/Menu.js';
7
- import { FontSizes } from '../../../../../../types.js';
8
7
  import { RowContext } from '../../Row/RowContext.js';
9
8
 
10
9
  function Actions(props) {
@@ -12,7 +11,6 @@ function Actions(props) {
12
11
  actions,
13
12
  actionsLength,
14
13
  data,
15
- fontSize,
16
14
  isActiveRow,
17
15
  rowId
18
16
  } = props;
@@ -22,11 +20,7 @@ function Actions(props) {
22
20
  const visibleActions = actions.map(action => action(data, rowId)).filter(action => !!action);
23
21
  const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);
24
22
  const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
25
- const className = cn('-mb-2 flex justify-end text-right bg-[inherit] shadow-[-6px_0px_6px_var(--table-row-actions-shadow)] print:hidden', {
26
- // Adjust negative margin on row actions cell to ensure that the cell aligns vertically.
27
- '-mt-2': fontSize === FontSizes.small,
28
- '-mt-1.5': fontSize !== FontSizes.small
29
- });
23
+ const className = cn('flex justify-end text-right bg-[inherit] shadow-[-6px_0px_6px_var(--table-row-actions-shadow)] print:hidden');
30
24
  return /*#__PURE__*/React__default.createElement("span", {
31
25
  className: className
32
26
  }, actionsOnRow.map((button, index) => {
@@ -78,7 +72,6 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
78
72
  actions: actions,
79
73
  actionsLength: actionsLength,
80
74
  data: row.original,
81
- fontSize: tableMeta.fontSize.size,
82
75
  isActiveRow: isActiveRow,
83
76
  rowId: row.id
84
77
  });