@economic/taco 2.46.9 → 2.47.0-server-2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. package/dist/components/Report/Report.d.ts +1 -1
  2. package/dist/components/SearchInput2/SearchInput2.d.ts +2 -0
  3. package/dist/components/Table3/components/Row/Editing/CreateNewRow.d.ts +1 -2
  4. package/dist/components/Table3/components/Row/Editing/TemporaryRow.d.ts +1 -0
  5. package/dist/components/Table3/features/useEditingState.d.ts +11 -11
  6. package/dist/components/Table3/features/useTableEditing.d.ts +13 -13
  7. package/dist/components/Table3/util/editing.d.ts +3 -0
  8. package/dist/esm/index.css +2 -2
  9. package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js +17 -17
  10. package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js.map +1 -1
  11. package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js +1 -0
  12. package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js.map +1 -1
  13. package/dist/esm/packages/taco/src/charts/components/Legend.js +1 -0
  14. package/dist/esm/packages/taco/src/charts/components/Legend.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +6 -3
  16. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +1 -1
  18. package/dist/esm/packages/taco/src/components/Table3/Table3.js +14 -4
  19. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  20. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +1 -1
  21. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  22. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +14 -9
  23. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  24. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js +2 -4
  25. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -1
  26. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js +5 -4
  27. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js.map +1 -1
  28. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js +32 -51
  29. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +5 -3
  31. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js +15 -12
  33. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +9 -1
  35. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  36. package/dist/esm/packages/taco/src/index.js +1 -0
  37. package/dist/esm/packages/taco/src/index.js.map +1 -1
  38. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +2 -1
  39. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
  40. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js +4 -0
  41. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js.map +1 -1
  42. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js +7 -4
  43. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
  44. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +7 -2
  45. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
  46. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Summary.js +7 -5
  47. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Summary.js.map +1 -1
  48. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js +24 -22
  49. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js.map +1 -1
  50. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js +41 -4
  51. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js.map +1 -1
  52. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js +3 -1
  53. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
  54. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js +26 -3
  55. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js.map +1 -1
  56. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableGlobalShortcuts.js +1 -1
  57. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableGlobalShortcuts.js.map +1 -1
  58. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +36 -9
  59. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  60. package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js +1 -1
  61. package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js.map +1 -1
  62. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  63. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +5 -7
  64. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
  65. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader2.js +249 -0
  66. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader2.js.map +1 -0
  67. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js +1 -1
  68. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js.map +1 -1
  69. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js +2 -1
  70. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js.map +1 -1
  71. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js +3 -2
  72. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js.map +1 -1
  73. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js +4 -2
  74. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js.map +1 -1
  75. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFilterListener.js +3 -1
  76. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFilterListener.js.map +1 -1
  77. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js +4 -4
  78. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js.map +1 -1
  79. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js +14 -13
  80. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -1
  81. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js +7 -3
  82. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js.map +1 -1
  83. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +4 -4
  84. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  85. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js +4 -1
  86. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js.map +1 -1
  87. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js +7 -1
  88. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js.map +1 -1
  89. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +6 -0
  90. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  91. package/dist/hooks/useLazyDebouncedEffect.d.ts +2 -0
  92. package/dist/index.css +2 -2
  93. package/dist/index.d.ts +1 -0
  94. package/dist/primitives/Table/Core/Table.d.ts +1 -0
  95. package/dist/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.d.ts +2 -2
  96. package/dist/primitives/Table/Core/components/Row/Row.d.ts +2 -0
  97. package/dist/primitives/Table/Core/features/useTableRenderer.d.ts +1 -1
  98. package/dist/primitives/Table/types.d.ts +11 -6
  99. package/dist/primitives/Table/useTableDataLoader2.d.ts +23 -0
  100. package/dist/primitives/Table/useTableManager/features/useTableRowExpansion.d.ts +2 -1
  101. package/dist/primitives/Table/useTableManager/features/useTableSearch.d.ts +4 -2
  102. package/dist/primitives/Table/useTableManager/features/useTableServerLoading.d.ts +3 -1
  103. package/dist/primitives/Table/useTableManager/listeners/useTableSearchListener.d.ts +1 -2
  104. package/dist/primitives/Table/useTableManager/util/columns.d.ts +2 -1
  105. package/dist/taco.cjs.development.js +607 -229
  106. package/dist/taco.cjs.development.js.map +1 -1
  107. package/dist/taco.cjs.production.min.js +1 -1
  108. package/dist/taco.cjs.production.min.js.map +1 -1
  109. package/package.json +2 -3
@@ -1 +1 @@
1
- {"version":3,"file":"editing.js","sources":["../../../../../../../../src/components/Table3/util/editing.ts"],"sourcesContent":["import { Cell as ReactTableCell, Row as ReactTableRow, Table as ReactTable } from '@tanstack/react-table';\nimport { TableFilterValue } from '../../../primitives/Table/types';\nimport { columnFilterFn } from '../../../primitives/Table/useTableManager/util/filtering';\nimport { globalFilterFn } from '../../../primitives/Table/useTableManager/util/search';\nimport { Localization } from '../../Provider/Localization';\n\nexport function willRowMove<TType = unknown>(\n cell: ReactTableCell<TType, unknown>,\n change: unknown,\n rowIndex: number,\n localization: Localization\n) {\n const { table } = cell.getContext();\n\n if (willRowMoveAfterSearch<TType>(cell, change, table, localization)) {\n return 'search';\n } else if (willRowMoveAfterFilter<TType>(cell, change)) {\n return 'filter';\n } else if (willRowMoveAfterSorting<TType>(cell, change, rowIndex)) {\n return 'sorting';\n }\n\n return undefined;\n}\n\nfunction willRowMoveAfterSearch<TType = unknown>(\n cell: ReactTableCell<TType, unknown>,\n change: unknown,\n table: ReactTable<TType>,\n localization: Localization\n) {\n const searchQuery = table.getState().globalFilter;\n\n if (!table.options.enableGlobalFilter || !searchQuery) {\n return false;\n }\n\n const rowWithChange = { ...cell.row, original: { ...cell.row.original, [cell.column.id]: change } };\n return !globalFilterFn(rowWithChange, cell.column.id, searchQuery, localization);\n}\n\nfunction willRowMoveAfterFilter<TType = unknown>(cell: ReactTableCell<TType, unknown>, change: unknown) {\n if (!cell.column.getIsFiltered()) {\n return false;\n }\n\n return !columnFilterFn(change, cell.column.getFilterValue() as TableFilterValue);\n}\n\nfunction willRowMoveAfterSorting<TType = unknown>(cell: ReactTableCell<TType, unknown>, change: unknown, rowIndex: number) {\n if (!cell.column.getIsSorted()) {\n return false;\n }\n\n const { table } = cell.getContext();\n const rows = table.getRowModel().rows;\n\n const miniSortRows: ReactTableRow<TType>[] = [\n {\n ...cell.row,\n original: {\n ...cell.row.original,\n [cell.column.id]: change,\n },\n getValue: () => change as any,\n },\n ];\n\n let index = 0;\n\n if (rowIndex > 0) {\n miniSortRows.unshift(rows[rowIndex - 1]);\n index = 1;\n }\n\n if (rowIndex < rows.length - 1) {\n miniSortRows.push(rows[rowIndex + 1]);\n }\n\n const resortedRows = [...miniSortRows].sort((rowA, rowB) => {\n const sortFn = cell.column.getSortingFn();\n const sortUndefined = cell.column.columnDef.sortUndefined;\n\n if (!table.options.manualSorting && sortUndefined) {\n const aValue = rowA.getValue(cell.column.id);\n const bValue = rowB.getValue(cell.column.id);\n\n const aUndefined = aValue === undefined;\n const bUndefined = bValue === undefined;\n\n if (aUndefined || bUndefined) {\n if (sortUndefined === 'first') return aUndefined ? -1 : 1;\n if (sortUndefined === 'last') return aUndefined ? 1 : -1;\n\n return aUndefined && bUndefined ? 0 : aUndefined ? sortUndefined : -sortUndefined;\n }\n }\n\n return sortFn(rowA, rowB, cell.column.id);\n });\n\n if (cell.column.getIsSorted() === 'desc') {\n resortedRows.reverse();\n }\n\n return resortedRows[index]?.id !== cell.row.id;\n}\n\nexport const TEMPORARY_ROW_ID_PREFIX = 'temp-';\n\nexport function isTemporaryRow(rowId: string) {\n if (rowId === undefined) {\n return false;\n }\n\n return String(rowId).startsWith(TEMPORARY_ROW_ID_PREFIX);\n}\n\nexport const shortcut = { key: 'e', meta: true, shift: false };\n"],"names":["willRowMove","cell","change","rowIndex","localization","table","getContext","willRowMoveAfterSearch","willRowMoveAfterFilter","willRowMoveAfterSorting","undefined","searchQuery","getState","globalFilter","options","enableGlobalFilter","rowWithChange","row","original","column","id","globalFilterFn","getIsFiltered","columnFilterFn","getFilterValue","getIsSorted","rows","getRowModel","miniSortRows","getValue","index","unshift","length","push","resortedRows","sort","rowA","rowB","sortFn","getSortingFn","sortUndefined","columnDef","manualSorting","aValue","bValue","aUndefined","bUndefined","reverse","_resortedRows$index","TEMPORARY_ROW_ID_PREFIX","isTemporaryRow","rowId","String","startsWith","shortcut","key","meta","shift"],"mappings":";;;SAMgBA,WAAWA,CACvBC,IAAoC,EACpCC,MAAe,EACfC,QAAgB,EAChBC,YAA0B;EAE1B,MAAM;IAAEC;GAAO,GAAGJ,IAAI,CAACK,UAAU,EAAE;EAEnC,IAAIC,sBAAsB,CAAQN,IAAI,EAAEC,MAAM,EAAEG,KAAK,EAAED,YAAY,CAAC,EAAE;IAClE,OAAO,QAAQ;GAClB,MAAM,IAAII,sBAAsB,CAAQP,IAAI,EAAEC,MAAM,CAAC,EAAE;IACpD,OAAO,QAAQ;GAClB,MAAM,IAAIO,uBAAuB,CAAQR,IAAI,EAAEC,MAAM,EAAEC,QAAQ,CAAC,EAAE;IAC/D,OAAO,SAAS;;EAGpB,OAAOO,SAAS;AACpB;AAEA,SAASH,sBAAsBA,CAC3BN,IAAoC,EACpCC,MAA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C,IAAI,EAAEpC,IAAI,CAACkB,MAAM,CAACC,EAAE,CAAC;GAC5C,CAAC;EAEF,IAAInB,IAAI,CAACkB,MAAM,CAACM,WAAW,EAAE,KAAK,MAAM,EAAE;IACtCS,YAAY,CAACa,OAAO,EAAE;;EAG1B,OAAO,EAAAC,mBAAA,GAAAd,YAAY,CAACJ,KAAK,CAAC,cAAAkB,mBAAA,uBAAnBA,mBAAA,CAAqB5B,EAAE,MAAKnB,IAAI,CAACgB,GAAG,CAACG,EAAE;AAClD;MAEa6B,uBAAuB,GAAG;SAEvBC,cAAcA,CAACC,KAAa;EACxC,IAAIA,KAAK,KAAKzC,SAAS,EAAE;IACrB,OAAO,KAAK;;EAGhB,OAAO0C,MAAM,CAACD,KAAK,CAAC,CAACE,UAAU,CAACJ,uBAAuB,CAAC;AAC5D;MAEaK,QAAQ,GAAG;EAAEC,GAAG,EAAE,GAAG;EAAEC,IAAI,EAAE,IAAI;EAAEC,KAAK,EAAE;;;;;"}
1
+ {"version":3,"file":"editing.js","sources":["../../../../../../../../src/components/Table3/util/editing.ts"],"sourcesContent":["import React from 'react';\nimport { Cell as ReactTableCell, Row as ReactTableRow, Table as ReactTable } from '@tanstack/react-table';\nimport { TableFilterValue, TableRef } from '../../../primitives/Table/types';\nimport { columnFilterFn } from '../../../primitives/Table/useTableManager/util/filtering';\nimport { globalFilterFn } from '../../../primitives/Table/useTableManager/util/search';\nimport { Localization } from '../../Provider/Localization';\n\nexport function willRowMove<TType = unknown>(\n cell: ReactTableCell<TType, unknown>,\n change: unknown,\n rowIndex: number,\n localization: Localization\n) {\n const { table } = cell.getContext();\n\n if (willRowMoveAfterSearch<TType>(cell, change, table, localization)) {\n return 'search';\n } else if (willRowMoveAfterFilter<TType>(cell, change)) {\n return 'filter';\n } else if (willRowMoveAfterSorting<TType>(cell, change, rowIndex)) {\n return 'sorting';\n }\n\n return undefined;\n}\n\nfunction willRowMoveAfterSearch<TType = unknown>(\n cell: ReactTableCell<TType, unknown>,\n change: unknown,\n table: ReactTable<TType>,\n localization: Localization\n) {\n const searchQuery = table.getState().globalFilter;\n\n if (!table.options.enableGlobalFilter || !searchQuery) {\n return false;\n }\n\n const rowWithChange = { ...cell.row, original: { ...cell.row.original, [cell.column.id]: change } };\n return !globalFilterFn(rowWithChange, cell.column.id, searchQuery, localization);\n}\n\nfunction willRowMoveAfterFilter<TType = unknown>(cell: ReactTableCell<TType, unknown>, change: unknown) {\n if (!cell.column.getIsFiltered()) {\n return false;\n }\n\n return !columnFilterFn(change, cell.column.getFilterValue() as TableFilterValue);\n}\n\nfunction willRowMoveAfterSorting<TType = unknown>(cell: ReactTableCell<TType, unknown>, change: unknown, rowIndex: number) {\n if (!cell.column.getIsSorted()) {\n return false;\n }\n\n const { table } = cell.getContext();\n const rows = table.getRowModel().rows;\n\n const miniSortRows: ReactTableRow<TType>[] = [\n {\n ...cell.row,\n original: {\n ...cell.row.original,\n [cell.column.id]: change,\n },\n getValue: () => change as any,\n },\n ];\n\n let index = 0;\n\n if (rowIndex > 0) {\n miniSortRows.unshift(rows[rowIndex - 1]);\n index = 1;\n }\n\n if (rowIndex < rows.length - 1) {\n miniSortRows.push(rows[rowIndex + 1]);\n }\n\n const resortedRows = [...miniSortRows].sort((rowA, rowB) => {\n const sortFn = cell.column.getSortingFn();\n const sortUndefined = cell.column.columnDef.sortUndefined;\n\n if (!table.options.manualSorting && sortUndefined) {\n const aValue = rowA.getValue(cell.column.id);\n const bValue = rowB.getValue(cell.column.id);\n\n const aUndefined = aValue === undefined;\n const bUndefined = bValue === undefined;\n\n if (aUndefined || bUndefined) {\n if (sortUndefined === 'first') return aUndefined ? -1 : 1;\n if (sortUndefined === 'last') return aUndefined ? 1 : -1;\n\n return aUndefined && bUndefined ? 0 : aUndefined ? sortUndefined : -sortUndefined;\n }\n }\n\n return sortFn(rowA, rowB, cell.column.id);\n });\n\n if (cell.column.getIsSorted() === 'desc') {\n resortedRows.reverse();\n }\n\n return resortedRows[index]?.id !== cell.row.id;\n}\n\nexport const TEMPORARY_ROW_ID_PREFIX = 'temp-';\n\nexport function isTemporaryRow(rowId: string) {\n if (rowId === undefined) {\n return false;\n }\n\n return String(rowId).startsWith(TEMPORARY_ROW_ID_PREFIX);\n}\n\nexport const shortcut = { key: 'e', meta: true, shift: false };\n\nexport function isTableScrolled(ref: React.RefObject<TableRef>) {\n if (ref.current) {\n const height =\n parseFloat(ref.current?.querySelector('tbody')?.style.height || '0') +\n parseFloat(ref.current?.querySelector('tbody')?.style.paddingBottom || '0');\n\n return height > ref.current.scrollHeight;\n }\n\n return false;\n}\n"],"names":["willRowMove","cell","change","rowIndex","localization","table","getContext","willRowMoveAfterSearch","willRowMoveAfterFilter","willRowMoveAfterSorting","undefined","searchQuery","getState","globalFilter","options","enableGlobalFilter","rowWithChange","row","original","column","id","globalFilterFn","getIsFiltered","columnFilterFn","getFilterValue","getIsSorted","rows","getRowModel","miniSortRows","getValue","index","unshift","length","push","resortedRows","sort","rowA","rowB","sortFn","getSortingFn","sortUndefined","columnDef","manualSorting","aValue","bValue","aUndefined","bUndefined","reverse","_resortedRows$index","TEMPORARY_ROW_ID_PREFIX","isTemporaryRow","rowId","String","startsWith","shortcut","key","meta","shift","isTableScrolled","ref","current","_ref$current","_ref$current$querySel","_ref$current2","_ref$current2$querySe","height","parseFloat","querySelector","style","paddingBottom","scrollHeight"],"mappings":";;;SAOgBA,WAAWA,CACvBC,IAAoC,EACpCC,MAAe,EACfC,QAAgB,EAChBC,YAA0B;EAE1B,MAAM;IAAEC;GAAO,GAAGJ,IAAI,CAACK,UAAU,EAAE;EAEnC,IAAIC,sBAAsB,CAAQN,IAAI,EAAEC,MAAM,EAAEG,KAAK,EAAED,YAAY,CAAC,EAAE;IAClE,OAAO,QAAQ;GAClB,MAAM,IAAII,sBAAsB,CAAQP,IAAI,EAAEC,MAAM,CAAC,EAAE;IACpD,OAAO,QAAQ;GAClB,MAAM,IAAIO,uBAAuB,CAAQR,IAAI,EAAEC,MAAM,EAAEC,QAAQ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qCI,KAAK,CAACC,aAAa,KAAI,GAAG,CAAC;IAE/E,OAAOJ,MAAM,GAAGN,GAAG,CAACC,OAAO,CAACU,YAAY;;EAG5C,OAAO,KAAK;AAChB;;;;"}
@@ -82,6 +82,7 @@ export { Header } from './components/Header/Header.js';
82
82
  export { Layout } from './components/Layout/Layout.js';
83
83
  export { getNavigationLinkClasses } from './components/Navigation2/components/Link.js';
84
84
  export { Navigation2 } from './components/Navigation2/Navigation2.js';
85
+ export { useTableDataLoader2 } from './primitives/Table/useTableDataLoader2.js';
85
86
  export { useBoundaryOverflowDetection } from './hooks/useBoundaryOverflowDetection.js';
86
87
  export { useOnClickOutside } from './utils/hooks/useOnClickOutside.js';
87
88
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -29,6 +29,7 @@ function TableGrid(props) {
29
29
  var _table$state$grouping;
30
30
  const {
31
31
  enableHorizontalArrowKeyNavigation,
32
+ footerRows,
32
33
  table,
33
34
  ...attributes
34
35
  } = props;
@@ -71,7 +72,7 @@ function TableGrid(props) {
71
72
  } : table.renderer.style
72
73
  }, table.renderer.rows, props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
73
74
  table: table.instance
74
- }) : null)))));
75
+ }, footerRows) : null)))));
75
76
  }
76
77
 
77
78
  export { Table, TableGrid };
@@ -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 { TableEmptyStateReason } from '../types';\nimport { ROW_HEIGHT_ESTIMATES } from './util/rows';\nimport './style.css';\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 getEmptyStateReason<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 emptyStateReason = getEmptyStateReason(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 {emptyStateReason ? (\n <EmptyStateBody\n emptyState={props.table.props.emptyState}\n isReady={table.meta.server.isEnabled ? table.meta.server.isReady : true}\n reason={emptyStateReason}\n />\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","getEmptyStateReason","table","instance","getFilteredRowModel","rows","length","getCoreRowModel","state","getState","meta","search","enableGlobalFilter","globalFilter","enableHorizontalArrowKeyNavigation","attributes","handleFocus","rowActive","rowActiveIndex","undefined","event","renderer","scrollToIndex","emptyStateReason","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","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IAAE4B,aAAa,EAAEpB,KAAK,CAACmB,QAAQ,CAACC;IAAiB,CACxF,CAAC,CACD,CACR,CAAC,CACE,EACPC,gBAAgB,iBACb5B,6BAAC2D,cAAc;IACXC,UAAU,EAAE7D,KAAK,CAACQ,KAAK,CAACR,KAAK,CAAC6D,UAAU;IACxCpB,OAAO,EAAEjC,KAAK,CAACQ,IAAI,CAACuB,MAAM,CAACC,SAAS,GAAGhC,KAAK,CAACQ,IAAI,CAACuB,MAAM,CAACE,OAAO,GAAG,IAAI;IACvEqB,MAAM,EAAEjC;IACV,kBAEF5B,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 { TableEmptyStateReason } from '../types';\nimport { ROW_HEIGHT_ESTIMATES } from './util/rows';\nimport './style.css';\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 footerRows?: null | JSX.Element | JSX.Element[];\n table: useTableReturnValue<TType>;\n};\n\nfunction getEmptyStateReason<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, footerRows, 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 emptyStateReason = getEmptyStateReason(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 {emptyStateReason ? (\n <EmptyStateBody\n emptyState={props.table.props.emptyState}\n isReady={table.meta.server.isEnabled ? table.meta.server.isReady : true}\n reason={emptyStateReason}\n />\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}>{footerRows}</Foot> : null}\n </>\n )}\n </table>\n </FocusScope>\n </>\n );\n}\n"],"names":["Table","props","React","children","Toolbar","TableToolbar","Grid","TableGrid","getEmptyStateReason","table","instance","getFilteredRowModel","rows","length","getCoreRowModel","state","getState","meta","search","enableGlobalFilter","globalFilter","enableHorizontalArrowKeyNavigation","footerRows","attributes","handleFocus","rowActive","rowActiveIndex","undefined","event","renderer","scrollToIndex","emptyStateReason","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","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5D,KAAK;IAAE6B,aAAa,EAAErB,KAAK,CAACoB,QAAQ,CAACC;IAAiB,CACxF,CAAC,CACD,CACR,CAAC,CACE,EACPC,gBAAgB,iBACb7B,6BAAC4D,cAAc;IACXC,UAAU,EAAE9D,KAAK,CAACQ,KAAK,CAACR,KAAK,CAAC8D,UAAU;IACxCpB,OAAO,EAAElC,KAAK,CAACQ,IAAI,CAACwB,MAAM,CAACC,SAAS,GAAGjC,KAAK,CAACQ,IAAI,CAACwB,MAAM,CAACE,OAAO,GAAG,IAAI;IACvEqB,MAAM,EAAEjC;IACV,kBAEF7B,yEACIA,6BAAC+D,IAAI;IACD5C,kCAAkC,EAAEA,kCAAkC;IACtEZ,KAAK,EAAEA,KAAK,CAACC,QAAQ;IACrBwD,YAAY,EAAEzD,KAAK,CAAC2C,GAAG,CAACe,OAAO;IAC/BrC,aAAa,EAAErB,KAAK,CAACoB,QAAQ,CAACC,aAAa;IAC3CuB,KAAK,EACDpD,KAAK,CAACE,QAAQ,GACR;MACI,GAAGM,KAAK,CAACoB,QAAQ,CAACwB,KAAK;MACvBL,MAAM,EACDvC,KAAK,CAACoB,QAAQ,CAACwB,KAAK,CAACL,MAAiB,GACvCoB,oBAAoB,CAAC3D,KAAK,CAACQ,IAAI,CAAC8B,SAAS,CAACC,MAAM;KACvD,GACDvC,KAAK,CAACoB,QAAQ,CAACwB;KAExB5C,KAAK,CAACoB,QAAQ,CAACjB,IAAI,EACnBX,KAAK,CAACE,QAAQ,CACZ,EACNM,KAAK,CAACQ,IAAI,CAACoD,MAAM,CAAC3B,SAAS,gBAAGxC,6BAACoE,IAAI;IAAC7D,KAAK,EAAEA,KAAK,CAACC;KAAWY,UAAU,CAAQ,GAAG,IAAI,CACvF,CACN,CACG,CACC,CACd;AAEX;;;;"}
@@ -11,6 +11,10 @@ function Header(context) {
11
11
  const {
12
12
  table
13
13
  } = context;
14
+ const tableMeta = table.options.meta;
15
+ if (!tableMeta.rowExpansion.canExpandAll) {
16
+ return null;
17
+ }
14
18
  const isSomeRowsExpanded = table.getIsSomeRowsExpanded();
15
19
  const handleClick = event => {
16
20
  event.stopPropagation();
@@ -1 +1 @@
1
- {"version":3,"file":"Expansion.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Expansion.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n} from '@tanstack/react-table';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { Tooltip } from '../../../../../../components/Tooltip/Tooltip';\nimport { IconButton } from '../../../../../../components/IconButton/IconButton';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\nimport { RowContext } from '../../Row/RowContext';\n\nfunction Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n\n const isSomeRowsExpanded = table.getIsSomeRowsExpanded();\n\n const handleClick = event => {\n event.stopPropagation();\n table.toggleAllRowsExpanded(!isSomeRowsExpanded);\n };\n\n const title = isSomeRowsExpanded ? texts.table.columns.expansion.collapseAll : texts.table.columns.expansion.expandAll;\n\n return (\n <Tooltip title={title}>\n <IconButton\n appearance=\"transparent\"\n icon={isSomeRowsExpanded ? 'chevron-down-double' : 'chevron-right-double'}\n onClick={handleClick}\n tabIndex={-1}\n title={title}\n />\n </Tooltip>\n );\n}\n\nfunction Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { hideInternalColumns } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as ReactTableMeta<TType>;\n\n if (hideInternalColumns) {\n return null;\n }\n\n const hasExpandedRow = tableMeta.rowExpansion.rowExpansionRenderer?.(context.row.original);\n\n if (hasExpandedRow) {\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === context.row.index;\n const isExpanded = context.row.getIsExpanded();\n\n const handleClick = event => {\n event.stopPropagation();\n context.row.toggleExpanded();\n };\n\n const title = isExpanded ? texts.table.columns.expansion.collapse : texts.table.columns.expansion.expand;\n const tabIndex = isActiveRow ? 0 : -1;\n\n return (\n <Tooltip title={title}>\n <IconButton\n appearance=\"discrete\"\n icon={isExpanded ? 'chevron-down' : 'chevron-right'}\n onClick={handleClick}\n tabIndex={tabIndex}\n title={title}\n />\n </Tooltip>\n );\n }\n\n return null;\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 40,\n meta: {\n align: 'center',\n // TODO: remove when table3 is migrated, this satisfies the legacy table3 type\n enableSearch: false,\n header: '',\n headerClassName: '!p-0',\n },\n};\n"],"names":["Header","context","texts","useLocalization","table","isSomeRowsExpanded","getIsSomeRowsExpanded","handleClick","event","stopPropagation","toggleAllRowsExpanded","title","columns","expansion","collapseAll","expandAll","React","Tooltip","IconButton","appearance","icon","onClick","tabIndex","Cell","hideInternalColumns","useContext","RowContext","tableMeta","options","meta","hasExpandedRow","_tableMeta$rowExpansi","_tableMeta$rowExpansi2","rowExpansion","rowExpansionRenderer","call","row","original","isActiveRow","rowActive","rowActiveIndex","index","isExpanded","getIsExpanded","toggleExpanded","collapse","expand","renderer","header","size","align","enableSearch","headerClassName"],"mappings":";;;;;;AAYA,SAASA,MAAMA,CAAkBC,OAAgD;EAC7E,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAO,GAAGH,OAAO;EAEzB,MAAMI,kBAAkB,GAAGD,KAAK,CAACE,qBAAqB,EAAE;EAExD,MAAMC,WAAW,GAAGC,KAAK;IACrBA,KAAK,CAACC,eAAe,EAAE;IACvBL,KAAK,CAACM,qBAAqB,CAAC,CAACL,kBAAkB,CAAC;GACnD;EAED,MAAMM,KAAK,GAAGN,kBAAkB,GAAGH,KAAK,CAACE,KAAK,CAACQ,OAAO,CAACC,SAAS,CAACC,WAAW,GAAGZ,KAAK,CAACE,KAAK,CAACQ,OAAO,CAACC,SAAS,CAACE,SAAS;EAEtH,oBACIC,6BAACC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CAAC;IAErC,oBACItB,6BAACC,OAAO;MAACN,KAAK,EAAEA;oBACZK,6BAACE,UAAU;MACPC,UAAU,EAAC,UAAU;MACrBC,IAAI,EAAEsB,UAAU,GAAG,cAAc,GAAG,eAAe;MACnDrB,OAAO,EAAEd,WAAW;MACpBe,QAAQ,EAAEA,QAAQ;MAClBX,KAAK,EAAEA;MACT,CACI;;EAIlB,OAAO,IAAI;AACf;MAEaoC,QAAQ,GAAkC;EACnDC,MAAM,EAAEhD,MAAM;EACd+C,QAAQ,EAAExB,IAAI;EACd0B,IAAI,EAAE,EAAE;EACRpB,IAAI,EAAE;IACFqB,KAAK,EAAE,QAAQ;;IAEfC,YAAY,EAAE,KAAK;IACnBH,MAAM,EAAE,EAAE;IACVI,eAAe,EAAE;;;;;;"}
1
+ {"version":3,"file":"Expansion.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Expansion.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n} from '@tanstack/react-table';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { Tooltip } from '../../../../../../components/Tooltip/Tooltip';\nimport { IconButton } from '../../../../../../components/IconButton/IconButton';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\nimport { RowContext } from '../../Row/RowContext';\n\nfunction Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (!tableMeta.rowExpansion.canExpandAll) {\n return null;\n }\n\n const isSomeRowsExpanded = table.getIsSomeRowsExpanded();\n\n const handleClick = event => {\n event.stopPropagation();\n table.toggleAllRowsExpanded(!isSomeRowsExpanded);\n };\n\n const title = isSomeRowsExpanded ? texts.table.columns.expansion.collapseAll : texts.table.columns.expansion.expandAll;\n\n return (\n <Tooltip title={title}>\n <IconButton\n appearance=\"transparent\"\n icon={isSomeRowsExpanded ? 'chevron-down-double' : 'chevron-right-double'}\n onClick={handleClick}\n tabIndex={-1}\n title={title}\n />\n </Tooltip>\n );\n}\n\nfunction Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { hideInternalColumns } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as ReactTableMeta<TType>;\n\n if (hideInternalColumns) {\n return null;\n }\n\n const hasExpandedRow = tableMeta.rowExpansion.rowExpansionRenderer?.(context.row.original);\n\n if (hasExpandedRow) {\n const isActiveRow = tableMeta.rowActive.rowActiveIndex === context.row.index;\n const isExpanded = context.row.getIsExpanded();\n\n const handleClick = event => {\n event.stopPropagation();\n context.row.toggleExpanded();\n };\n\n const title = isExpanded ? texts.table.columns.expansion.collapse : texts.table.columns.expansion.expand;\n const tabIndex = isActiveRow ? 0 : -1;\n\n return (\n <Tooltip title={title}>\n <IconButton\n appearance=\"discrete\"\n icon={isExpanded ? 'chevron-down' : 'chevron-right'}\n onClick={handleClick}\n tabIndex={tabIndex}\n title={title}\n />\n </Tooltip>\n );\n }\n\n return null;\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 40,\n meta: {\n align: 'center',\n // TODO: remove when table3 is migrated, this satisfies the legacy table3 type\n enableSearch: false,\n header: '',\n headerClassName: '!p-0',\n },\n};\n"],"names":["Header","context","texts","useLocalization","table","tableMeta","options","meta","rowExpansion","canExpandAll","isSomeRowsExpanded","getIsSomeRowsExpanded","handleClick","event","stopPropagation","toggleAllRowsExpanded","title","columns","expansion","collapseAll","expandAll","React","Tooltip","IconButton","appearance","icon","onClick","tabIndex","Cell","hideInternalColumns","useContext","RowContext","hasExpandedRow","_tableMeta$rowExpansi","_tableMeta$rowExpansi2","rowExpansionRenderer","call","row","original","isActiveRow","rowActive","rowActiveIndex","index","isExpanded","getIsExpanded","toggleExpanded","collapse","expand","renderer","header","size","align","enableSearch","headerClassName"],"mappings":";;;;;;AA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,CAAAG,IAAA,CAAAF,sBAAA,EAA8CjC,OAAO,CAACoC,GAAG,CAACC,QAAQ,CAAC;EAE1F,IAAIN,cAAc,EAAE;IAChB,MAAMO,WAAW,GAAGlC,SAAS,CAACmC,SAAS,CAACC,cAAc,KAAKxC,OAAO,CAACoC,GAAG,CAACK,KAAK;IAC5E,MAAMC,UAAU,GAAG1C,OAAO,CAACoC,GAAG,CAACO,aAAa,EAAE;IAE9C,MAAMhC,WAAW,GAAGC,KAAK;MACrBA,KAAK,CAACC,eAAe,EAAE;MACvBb,OAAO,CAACoC,GAAG,CAACQ,cAAc,EAAE;KAC/B;IAED,MAAM7B,KAAK,GAAG2B,UAAU,GAAGzC,KAAK,CAACE,KAAK,CAACa,OAAO,CAACC,SAAS,CAAC4B,QAAQ,GAAG5C,KAAK,CAACE,KAAK,CAACa,OAAO,CAACC,SAAS,CAAC6B,MAAM;IACxG,MAAMpB,QAAQ,GAAGY,WAAW,GAAG,CAAC,GAAG,CAAC,CAAC;IAErC,oBACIlB,6BAACC,OAAO;MAACN,KAAK,EAAEA;oBACZK,6BAACE,UAAU;MACPC,UAAU,EAAC,UAAU;MACrBC,IAAI,EAAEkB,UAAU,GAAG,cAAc,GAAG,eAAe;MACnDjB,OAAO,EAAEd,WAAW;MACpBe,QAAQ,EAAEA,QAAQ;MAClBX,KAAK,EAAEA;MACT,CACI;;EAIlB,OAAO,IAAI;AACf;MAEagC,QAAQ,GAAkC;EACnDC,MAAM,EAAEjD,MAAM;EACdgD,QAAQ,EAAEpB,IAAI;EACdsB,IAAI,EAAE,EAAE;EACR3C,IAAI,EAAE;IACF4C,KAAK,EAAE,QAAQ;;IAEfC,YAAY,EAAE,KAAK;IACnBH,MAAM,EAAE,EAAE;IACVI,eAAe,EAAE;;;;;;"}
@@ -4,6 +4,7 @@ import { useLocalization } from '../../../../../../components/Provider/Localizat
4
4
  import { Checkbox } from '../../../../../../components/Checkbox/Checkbox.js';
5
5
  import { Shortcut } from '../../../../../../components/Shortcut/Shortcut.js';
6
6
  import { TableServerLoadAllState } from '../../../../types.js';
7
+ import { getHiddenColumns } from '../../../../useTableManager/util/columns.js';
7
8
  import { RowContext } from '../../Row/RowContext.js';
8
9
 
9
10
  function Header(context) {
@@ -24,8 +25,9 @@ function Header(context) {
24
25
  }
25
26
  const _temp = function () {
26
27
  if (tableMeta.server.loadAllIfNeeded) {
28
+ const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
27
29
  // don't pass the search query because we need all data - not filtered data
28
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
30
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined, hiddenColumns)).then(function () {});
29
31
  }
30
32
  }();
31
33
  // load all data if that is possible
@@ -84,6 +86,7 @@ function Cell(context) {
84
86
  if (event.shiftKey) {
85
87
  var _tableMeta$rowSelecti;
86
88
  function _temp4() {
89
+ const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);
87
90
  table.setRowSelection(currentRowSelection => ({
88
91
  ...currentRowSelection,
89
92
  ...selectedRows.filter(row => row.getCanSelect()).reduce((state, row) => ({
@@ -93,11 +96,11 @@ function Cell(context) {
93
96
  }));
94
97
  }
95
98
  const [fromIndex, toIndex] = toggleBetween((_tableMeta$rowSelecti = tableMeta.rowSelection.lastSelectedRowIndex.current) !== null && _tableMeta$rowSelecti !== void 0 ? _tableMeta$rowSelecti : 0, rowIndex);
96
- const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);
97
99
  const _temp3 = function () {
98
- if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {
100
+ if (tableMeta.server.loadAllIfNeeded) {
101
+ const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
99
102
  // don't pass the search query because we need all data - not filtered data
100
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
103
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined, hiddenColumns)).then(function () {});
101
104
  }
102
105
  }();
103
106
  return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
@@ -1 +1 @@
1
- {"version":3,"file":"Selection.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n RowSelectionState,\n} from '@tanstack/react-table';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { Tooltip } from '../../../../../../components/Tooltip/Tooltip';\nimport { Checkbox } from '../../../../../../components/Checkbox/Checkbox';\nimport { Shortcut } from '../../../../../../components/Shortcut/Shortcut';\nimport { TableServerLoadAllState } from '../../../../types';\nimport { RowContext } from '../../Row/RowContext';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\n\nfunction Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const isAllRowsSelected = table.getIsAllRowsSelected();\n const isSomeRowsSelected = table.getIsSomeRowsSelected();\n const title = isAllRowsSelected ? texts.table.columns.select.deselectAll : texts.table.columns.select.selectAll;\n\n const handleChange = async (checked: boolean) => {\n // load all data if that is possible\n if (tableMeta.server.loadAllIfNeeded) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters);\n }\n\n table.toggleAllRowsSelected(checked);\n };\n\n return (\n <Tooltip title={title}>\n <Checkbox\n aria-label={title}\n className=\"hover:border-blue !-mt-px\"\n checked={isAllRowsSelected}\n indeterminate={isSomeRowsSelected && !isAllRowsSelected}\n loading={tableMeta.server.loadAllStatus === TableServerLoadAllState.Loading}\n onChange={handleChange}\n />\n </Tooltip>\n );\n}\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\nfunction Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { row, table } = context;\n const { hideInternalColumns, rowIndex } = React.useContext(RowContext);\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (hideInternalColumns || (table.options.enableGrouping && table.getState().grouping?.length && !row.getIsGrouped())) {\n return null;\n }\n\n const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();\n const canSelect = row.getCanSelect();\n const title = isSelected ? texts.table.columns.select.deselect : texts.table.columns.select.select;\n\n const handleClick = async (event: React.MouseEvent) => {\n event.stopPropagation();\n\n if (row.getIsGrouped()) {\n row.subRows.forEach(row => row.toggleSelected());\n } else if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0, rowIndex);\n const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);\n\n if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters);\n }\n\n table.setRowSelection((currentRowSelection: RowSelectionState) => ({\n ...currentRowSelection,\n ...selectedRows.filter(row => row.getCanSelect()).reduce((state, row) => ({ ...state, [row.id]: true }), {}),\n }));\n } else {\n row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\n <Tooltip\n hidden={!canSelect}\n title={\n <>\n {title}\n <Shortcut className=\"ml-2\" keys=\"Space\" />\n </>\n }>\n <Checkbox\n aria-label={title}\n className=\"!mt-0\"\n checked={isSelected}\n onClick={handleClick}\n disabled={!canSelect}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n />\n </Tooltip>\n );\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 40,\n meta: {\n align: 'center',\n className: '!px-1',\n // TODO: remove when table3 is migrated, this satisfies the legacy table3 type\n enableSearch: false,\n header: '',\n headerClassName: '!px-1',\n },\n};\n"],"names":["Header","context","texts","useLocalization","table","tableMeta","options","meta","isAllRowsSelected","getIsAllRowsSelected","isSomeRowsSelected","getIsSomeRowsSelected","title","columns","select","deselectAll","selectAll","handleChange","checked","toggleAllRowsSelected","_temp","server","loadAllIfNeeded","Promise","resolve","getState","sorting","columnFilters","then","_temp2","e","reject","React","Tooltip","Checkbox","className","indeterminate","loading","loadAllStatus","TableServerLoadAllState","Loading","onChange","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","row","hideInternalColumns","rowIndex","useContext","RowContext","enableGrouping","_table$getState$group","grouping","length","getIsGrouped","isSelected","getIsAllSubRowsSelected","getIsSelected","canSelect","getCanSelect","deselect","handleClick","event","rowSelection","lastSelectedRowIndex","current","index","stopPropagation","_temp6","subRows","forEach","toggleSelected","_temp5","shiftKey","_tableMeta$rowSelecti","_temp4","setRowSelection","currentRowSelection","selectedRows","filter","reduce","state","id","getRowModel","rows","slice","_temp3","some","original","undefined","_temp7","hidden","Shortcut","keys","onClick","disabled","renderer","header","size","align","enableSearch","headerClassName"],"mappings":";;;;;;;;AAeA,SAASA,MAAMA,CAAkBC,OAAgD;EAC7E,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAO,GAAGH,OAAO;EACzB,MAAMI,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAE7D,MAAMC,iBAAiB,GAAGJ,KAAK,CAACK,oBAAoB,EAAE;EACtD,MAAMC,kBAAkB,GAAGN,KAAK,CAACO,qB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C,MAAA,IAAAA,MAAA,CAAA/C,IAAA,SAAA+C,MAAA,CAAA/C,IAAA;;;MAAA,OAAAL,OAAA,CAAAC,OAAA,CAAA+C,MAAA,IAAAA,MAAA,CAAA3C,IAAA,GAAA2C,MAAA,CAAA3C,IAAA,CAAAiE,MAAA,IAAAA,MAAA,CAAAtB,MAAA;KAI5B,QAAAzC,CAAA;MAAA,OAAAP,OAAA,CAAAQ,MAAA,CAAAD,CAAA;;;EAED,oBACIE,6BAACC,OAAO;IACJ6D,MAAM,EAAE,CAACjC,SAAS;IAClBjD,KAAK,eACDoB,4DACKpB,KAAK,eACNoB,6BAAC+D,QAAQ;MAAC5D,SAAS,EAAC,MAAM;MAAC6D,IAAI,EAAC;MAAU;kBAGlDhE,6BAACE,QAAQ;kBACOtB,KAAK;IACjBuB,SAAS,EAAC,OAAO;IACjBjB,OAAO,EAAEwC,UAAU;IACnBuC,OAAO,EAAEjC,WAAW;IACpBkC,QAAQ,EAAE,CAACrC,SAAS;;IAEpBpB,QAAQ,EAAEA,MAAM;IAClB,CACI;AAElB;MAEa0D,QAAQ,GAAkC;EACnDC,MAAM,EAAEpG,MAAM;EACdmG,QAAQ,EAAEpD,IAAI;EACdsD,IAAI,EAAE,EAAE;EACR9F,IAAI,EAAE;IACF+F,KAAK,EAAE,QAAQ;IACfnE,SAAS,EAAE,OAAO;;IAElBoE,YAAY,EAAE,KAAK;IACnBH,MAAM,EAAE,EAAE;IACVI,eAAe,EAAE;;;;;;"}
1
+ {"version":3,"file":"Selection.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Columns/Internal/Selection.tsx"],"sourcesContent":["import React from 'react';\nimport {\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n TableMeta as ReactTableMeta,\n RowSelectionState,\n} from '@tanstack/react-table';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { Tooltip } from '../../../../../../components/Tooltip/Tooltip';\nimport { Checkbox } from '../../../../../../components/Checkbox/Checkbox';\nimport { Shortcut } from '../../../../../../components/Shortcut/Shortcut';\nimport { TableServerLoadAllState } from '../../../../types';\nimport { RowContext } from '../../Row/RowContext';\nimport { useTableManagerInternalColumn } from '../../../../useTableManager/types';\nimport { getHiddenColumns } from '../../../../useTableManager/util/columns';\n\nfunction Header<TType = unknown>(context: ReactTableHeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { table } = context;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const isAllRowsSelected = table.getIsAllRowsSelected();\n const isSomeRowsSelected = table.getIsSomeRowsSelected();\n const title = isAllRowsSelected ? texts.table.columns.select.deselectAll : texts.table.columns.select.selectAll;\n\n const handleChange = async (checked: boolean) => {\n // load all data if that is possible\n if (tableMeta.server.loadAllIfNeeded) {\n const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);\n\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(\n table.getState().sorting,\n table.getState().columnFilters,\n tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined,\n hiddenColumns\n );\n }\n\n table.toggleAllRowsSelected(checked);\n };\n\n return (\n <Tooltip title={title}>\n <Checkbox\n aria-label={title}\n className=\"hover:border-blue !-mt-px\"\n checked={isAllRowsSelected}\n indeterminate={isSomeRowsSelected && !isAllRowsSelected}\n loading={tableMeta.server.loadAllStatus === TableServerLoadAllState.Loading}\n onChange={handleChange}\n />\n </Tooltip>\n );\n}\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\nfunction Cell<TType = unknown>(context: ReactTableCellContext<TType, unknown>) {\n const { texts } = useLocalization();\n const { row, table } = context;\n const { hideInternalColumns, rowIndex } = React.useContext(RowContext);\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (hideInternalColumns || (table.options.enableGrouping && table.getState().grouping?.length && !row.getIsGrouped())) {\n return null;\n }\n\n const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();\n const canSelect = row.getCanSelect();\n const title = isSelected ? texts.table.columns.select.deselect : texts.table.columns.select.select;\n\n const handleClick = async (event: React.MouseEvent) => {\n event.stopPropagation();\n\n if (row.getIsGrouped()) {\n row.subRows.forEach(row => row.toggleSelected());\n } else if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(tableMeta.rowSelection.lastSelectedRowIndex.current ?? 0, rowIndex);\n\n if (tableMeta.server.loadAllIfNeeded) {\n const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);\n\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAllIfNeeded(\n table.getState().sorting,\n table.getState().columnFilters,\n tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined,\n hiddenColumns\n );\n }\n\n const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);\n table.setRowSelection((currentRowSelection: RowSelectionState) => ({\n ...currentRowSelection,\n ...selectedRows.filter(row => row.getCanSelect()).reduce((state, row) => ({ ...state, [row.id]: true }), {}),\n }));\n } else {\n row.toggleSelected();\n }\n\n tableMeta.rowSelection.lastSelectedRowIndex.current = row.index;\n };\n\n return (\n <Tooltip\n hidden={!canSelect}\n title={\n <>\n {title}\n <Shortcut className=\"ml-2\" keys=\"Space\" />\n </>\n }>\n <Checkbox\n aria-label={title}\n className=\"!mt-0\"\n checked={isSelected}\n onClick={handleClick}\n disabled={!canSelect}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n />\n </Tooltip>\n );\n}\n\nexport const renderer: useTableManagerInternalColumn = {\n header: Header,\n renderer: Cell,\n size: 40,\n meta: {\n align: 'center',\n className: '!px-1',\n // TODO: remove when table3 is migrated, this satisfies the legacy table3 type\n enableSearch: false,\n header: '',\n headerClassName: '!px-1',\n },\n};\n"],"names":["Header","context","texts","useLocalization","table","tableMeta","options","meta","isAllRowsSelected","getIsAllRowsSelected","isSomeRowsSelected","getIsSomeRowsSelected","title","columns","select","deselectAll","selectAll","handleChange","checked","toggleAllRowsSelected","_temp","server","loadAllIfNeeded","hiddenColumns","getHiddenColumns","getState","columnVisibility","Promise","resolve","sorting","columnFilters","search","enableGlobalFilter","globalFilter","undefined","then","_temp2","e","reject","React","Tooltip","Checkbox","className","indeterminate","loading","loadAllStatus","TableServerLoadAllState","Loading","onChange","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","Cell","row","hideInternalColumns","rowIndex","useContext","RowContext","enableGrouping","_table$getState$group","grouping","length","getIsGrouped","isSelected","getIsAllSubRowsSelected","getIsSelected","canSelect","getCanSelect","deselect","handleClick","event","rowSelection","lastSelectedRowIndex","current","index","stopPropagation","_temp6","subRows","forEach","toggleSelected","_temp5","shiftKey","_tableMeta$rowSelecti","_temp4","selectedRows","getRowModel","rows","slice","setRowSelection","currentRowSelection","filter","reduce","state","id","_temp3","_temp7","hidden","Shortcut","keys","onClick","disabled","renderer","header","size","align","enableSearch","headerClassName"],"mappings":";;;;;;;;;AAgBA,SAASA,MAAMA,CAAkBC,OAAgD;EAC7E,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC;GAAO,GAAGH,OAAO;EACzB,MAAMI,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAE7D,MAAMC,iBAAiB,GAAGJ,KAAK,CAACK,oBAAoB,EAAE;EACtD,MAAMC,kBAAkB,GAAGN,KAAK,CAACO,qBAAqB,EAAE;EACxD,MAAMC,KAAK,GAAGJ,iBAAiB,GAAGN,KAAK,CAACE,KAAK,CAACS,OAAO,CAACC,MAAM,CAACC,WAAW,GAAGb,KAAK,CAACE,KAAK,CAACS,OAAO,CAACC,MAAM,CAACE,SAAS;EAE/G,MAAMC,YAAY,aAAUC,OAAgB;IAAA;;QAcxCd,KAAK,CAACe,qBAAqB,CAACD,OAAO,CAAC;;MAAC,MAAA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AAW,MAAA;;cASLzC,GAAG,CAAC0B,cAAc,EAAE;;;UAAC,IAAAC,MAAA,IAAAA,MAAA,CAAA/C,IAAA,SAAA+C,MAAA,CAAA/C,IAAA;;;MAAA,OAAAR,OAAA,CAAAC,OAAA,CAAAkD,MAAA,IAAAA,MAAA,CAAA3C,IAAA,GAAA2C,MAAA,CAAA3C,IAAA,CAAA8D,MAAA,IAAAA,MAAA,CAAAnB,MAAA;KAI5B,QAAAzC,CAAA;MAAA,OAAAV,OAAA,CAAAW,MAAA,CAAAD,CAAA;;;EAED,oBACIE,6BAACC,OAAO;IACJ0D,MAAM,EAAE,CAAC9B,SAAS;IAClBxD,KAAK,eACD2B,4DACK3B,KAAK,eACN2B,6BAAC4D,QAAQ;MAACzD,SAAS,EAAC,MAAM;MAAC0D,IAAI,EAAC;MAAU;kBAGlD7D,6BAACE,QAAQ;kBACO7B,KAAK;IACjB8B,SAAS,EAAC,OAAO;IACjBxB,OAAO,EAAE+C,UAAU;IACnBoC,OAAO,EAAE9B,WAAW;IACpB+B,QAAQ,EAAE,CAAClC,SAAS;;IAEpBpB,QAAQ,EAAEA,MAAM;IAClB,CACI;AAElB;MAEauD,QAAQ,GAAkC;EACnDC,MAAM,EAAExG,MAAM;EACduG,QAAQ,EAAEjD,IAAI;EACdmD,IAAI,EAAE,EAAE;EACRlG,IAAI,EAAE;IACFmG,KAAK,EAAE,QAAQ;IACfhE,SAAS,EAAE,OAAO;;IAElBiE,YAAY,EAAE,KAAK;IACnBH,MAAM,EAAE,EAAE;IACVI,eAAe,EAAE;;;;;;"}
@@ -3,8 +3,13 @@ import { flexRender } from '@tanstack/react-table';
3
3
  import { Summary } from './Summary.js';
4
4
 
5
5
  function Foot(props) {
6
- const nonGroupedHeaders = props.table.getFooterGroups()[0].headers.filter(header => !header.column.getIsGrouped());
7
- return /*#__PURE__*/React__default.createElement("tfoot", null, /*#__PURE__*/React__default.createElement("tr", null, nonGroupedHeaders.map((header, index) => (/*#__PURE__*/React__default.createElement(Footer, {
6
+ const {
7
+ children,
8
+ table,
9
+ ...attributes
10
+ } = props;
11
+ const nonGroupedHeaders = table.getFooterGroups()[0].headers.filter(header => !header.column.getIsGrouped());
12
+ return /*#__PURE__*/React__default.createElement("tfoot", Object.assign({}, attributes), children, /*#__PURE__*/React__default.createElement("tr", null, nonGroupedHeaders.map((header, index) => (/*#__PURE__*/React__default.createElement(Footer, {
8
13
  key: header.id,
9
14
  header: header,
10
15
  index: index
@@ -1 +1 @@
1
- {"version":3,"file":"Footer.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Footer/Footer.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Header as ReactTableHeader,\n ColumnMeta as ReactTableColumnMeta,\n flexRender,\n Table as ReactTable,\n} from '@tanstack/react-table';\nimport { Summary } from './Summary';\n\nexport type FootProps<TType = unknown> = React.HTMLAttributes<HTMLTableSectionElement> & {\n table: ReactTable<TType>;\n};\nexport function Foot<TType = unknown>(props: FootProps<TType>) {\n const nonGroupedHeaders = props.table.getFooterGroups()[0].headers.filter(header => !header.column.getIsGrouped());\n return (\n <tfoot>\n <tr>\n {nonGroupedHeaders.map((header, index) => (\n <Footer key={header.id} header={header} index={index} />\n ))}\n </tr>\n </tfoot>\n );\n}\n\nexport type FooterProps<TType = unknown> = {\n header: ReactTableHeader<TType, unknown>;\n index: number;\n};\nexport function Footer<TType = unknown>(props: FooterProps<TType>) {\n return <MemoedFooter footer={props.header} index={props.index} />;\n}\n\nexport type MemoedFooterProps<TType = unknown> = {\n footer: ReactTableHeader<TType, unknown>;\n index: number;\n};\nconst MemoedFooter = React.memo(function MemoedFooter<TType = unknown>(props: MemoedFooterProps<TType>) {\n const { footer, index } = props;\n const columnMeta = footer.column.columnDef.meta as ReactTableColumnMeta<TType, unknown>;\n\n // getIsPinned returns true for split header groups, even if the split group has no pinned sub headers\n const isHeaderGroup = !!footer.subHeaders?.length;\n const isPinned = isHeaderGroup\n ? footer.subHeaders.find(x => x.column.getIsPinned())?.column.getIsPinned()\n : footer.column.getIsPinned();\n\n const style: React.CSSProperties = {};\n\n if (isPinned) {\n // pinned columns should be offset from either the left or right\n style[isPinned] = `${footer.column.getStart(isPinned)}px`;\n }\n\n let content;\n let align;\n\n if (index === 0) {\n align = 'left';\n content = <Summary table={footer.getContext().table} />;\n } else {\n align = columnMeta.align;\n content = footer.isPlaceholder ? null : flexRender(footer.column.columnDef.footer, footer.getContext());\n }\n\n return (\n <td\n key={footer.id}\n data-cell-align={align}\n data-cell-id={footer.id}\n data-cell-pinned={isPinned ? isPinned : undefined}\n style={style}>\n {content}\n </td>\n );\n}) as <TType = unknown>(props: MemoedFooterProps<TType>) => JSX.Element;\n"],"names":["Foot","props","nonGroupedHeaders","table","getFooterGroups","headers","filter","header","column","getIsGrouped","React","map","index","Footer","key","id","MemoedFooter","footer","memo","columnMeta","columnDef","meta","isHeaderGroup","_footer$subHeaders","subHeaders","length","isPinned","_footer$subHeaders$fi","find","x","getIsPinned","style","getStart","content","align","Summary","getContext","isPlaceholder","flexRender","undefined"],"mappings":";;;;SAYgBA,IAAIA,CAAkBC,KAAuB;EACzD,MAAMC,iBAAiB,GAAGD,KAAK,CAACE,KAAK,CAACC,eAAe,EAAE,CAAC,CAAC,CAAC,CAACC,OAAO,CAACC,MAAM,CAACC,MAAM,IAAI,CAACA,MAAM,CAACC,MAAM,CAACC,YAAY,EAAE,CAAC;EAClH,oBACIC,yDACIA,yCACKR,iBAAiB,CAACS,GAAG,CAAC,CAACJ,MAAM,EAAEK,KAAK,mBACjCF,6BAACG,MAAM;IAACC,GAAG,EAAEP,MAAM,CAACQ,EAAE;IAAER,MAAM,EAAEA,MAAM;IAAEK,KAAK,EAAEA;IAAS,CAC3D,CAAC,CACD,CACD;AAEhB;SAMgBC,MAAMA,CAAkBZ,KAAyB;EAC7D,oBAAOS,6BAACM,YAAY;IAACC,MAAM,EAAEhB,KAAK,CAACM,MAAM;IAAEK,KAAK,EAAEX,KAAK,CAACW;IAAS;AACrE;AAMA,MA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EAAE;wBACLW,QAAQ,GAAGA,QAAQ,GAAGa,SAAS;IACjDR,KAAK,EAAEA;KACNE,OAAO,CACP;AAEb,CAAC,CAAsE;;;;"}
1
+ {"version":3,"file":"Footer.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Footer/Footer.tsx"],"sourcesContent":["import React from 'react';\nimport {\n Header as ReactTableHeader,\n ColumnMeta as ReactTableColumnMeta,\n flexRender,\n Table as ReactTable,\n} from '@tanstack/react-table';\nimport { Summary } from './Summary';\n\nexport type FootProps<TType = unknown> = React.HTMLAttributes<HTMLTableSectionElement> & {\n table: ReactTable<TType>;\n};\nexport function Foot<TType = unknown>(props: FootProps<TType>) {\n const { children, table, ...attributes } = props;\n const nonGroupedHeaders = table.getFooterGroups()[0].headers.filter(header => !header.column.getIsGrouped());\n return (\n <tfoot {...attributes}>\n {children}\n <tr>\n {nonGroupedHeaders.map((header, index) => (\n <Footer key={header.id} header={header} index={index} />\n ))}\n </tr>\n </tfoot>\n );\n}\n\nexport type FooterProps<TType = unknown> = {\n header: ReactTableHeader<TType, unknown>;\n index: number;\n};\nexport function Footer<TType = unknown>(props: FooterProps<TType>) {\n return <MemoedFooter footer={props.header} index={props.index} />;\n}\n\nexport type MemoedFooterProps<TType = unknown> = {\n footer: ReactTableHeader<TType, unknown>;\n index: number;\n};\nconst MemoedFooter = React.memo(function MemoedFooter<TType = unknown>(props: MemoedFooterProps<TType>) {\n const { footer, index } = props;\n const columnMeta = footer.column.columnDef.meta as ReactTableColumnMeta<TType, unknown>;\n\n // getIsPinned returns true for split header groups, even if the split group has no pinned sub headers\n const isHeaderGroup = !!footer.subHeaders?.length;\n const isPinned = isHeaderGroup\n ? footer.subHeaders.find(x => x.column.getIsPinned())?.column.getIsPinned()\n : footer.column.getIsPinned();\n\n const style: React.CSSProperties = {};\n\n if (isPinned) {\n // pinned columns should be offset from either the left or right\n style[isPinned] = `${footer.column.getStart(isPinned)}px`;\n }\n\n let content;\n let align;\n\n if (index === 0) {\n align = 'left';\n content = <Summary table={footer.getContext().table} />;\n } else {\n align = columnMeta.align;\n content = footer.isPlaceholder ? null : flexRender(footer.column.columnDef.footer, footer.getContext());\n }\n\n return (\n <td\n key={footer.id}\n data-cell-align={align}\n data-cell-id={footer.id}\n data-cell-pinned={isPinned ? isPinned : undefined}\n style={style}>\n {content}\n </td>\n );\n}) as <TType = unknown>(props: MemoedFooterProps<TType>) => JSX.Element;\n"],"names":["Foot","props","children","table","attributes","nonGroupedHeaders","getFooterGroups","headers","filter","header","column","getIsGrouped","React","map","index","Footer","key","id","MemoedFooter","footer","memo","columnMeta","columnDef","meta","isHeaderGroup","_footer$subHeaders","subHeaders","length","isPinned","_footer$subHeaders$fi","find","x","getIsPinned","style","getStart","content","align","Summary","getContext","isPlaceholder","flexRender","undefined"],"mappings":";;;;SAYgBA,IAAIA,CAAkBC,KAAuB;EACzD,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGH,KAAK;EAChD,MAAMI,iBAAiB,GAAGF,KAAK,CAACG,eAAe,EAAE,CAAC,CAAC,CAAC,CAACC,OAAO,CAACC,MAAM,CAACC,MAAM,IAAI,CAACA,MAAM,CAACC,MAAM,CAACC,YAAY,EAAE,CAAC;EAC5G,oBACIC,wDAAWR,UAAU,GAChBF,QAAQ,eACTU,yCACKP,iBAAiB,CAACQ,GAAG,CAAC,CAACJ,MAAM,EAAEK,KAAK,mBACjCF,6BAACG,MAAM;IAACC,GAAG,EAAEP,MAAM,CAACQ,EAAE;IAAER,MAAM,EAAEA,MAAM;IAAEK,KAAK,EAAEA;IAAS,CAC3D,CAAC,CACD,CACD;AAEhB;SAMgBC,MAAMA,CAAkBd,KAAyB;EAC7D,oBAAOW,6BAACM,YAAY;IAACC,MAAM,EAAElB,KAAK,CAACQ,MAAM;IAAEK,KAAK,EAAEb,KAAK,CAACa;IAAS;AACrE;AAMA,MAAMI,YAAY,gBAAGN,cAAK,CAACQ,IAAI,CAAC,SAASF,YAAYA,CA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AK,EAAEA;KACNE,OAAO,CACP;AAEb,CAAC,CAAsE;;;;"}
@@ -10,21 +10,23 @@ function Summary(props) {
10
10
  locale,
11
11
  texts
12
12
  } = useLocalization();
13
- const length = table.options.meta.length;
13
+ const tableMeta = table.options.meta;
14
+ const length = tableMeta.length;
14
15
  const currentLength = table.getRowModel().rows.length;
15
16
  let label;
16
17
  let count;
17
18
  // row selection
18
- const rowsSelectedLength = table.getSelectedRowModel().rows.length;
19
+ // use table state and not the selected row model because of the way server loading works
20
+ const rowsSelectedLength = Object.keys(table.getState().rowSelection).length;
19
21
  if (rowsSelectedLength > 0) {
20
22
  label = texts.table.footer.summary.selected;
21
23
  count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(rowsSelectedLength)), "\u00A0", texts.table.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
22
- } else if ((_table$getState$colum = table.getState().columnFilters) !== null && _table$getState$colum !== void 0 && _table$getState$colum.length ||
24
+ } else if (!tableMeta.server.isEnabled && ((_table$getState$colum = table.getState().columnFilters) !== null && _table$getState$colum !== void 0 && _table$getState$colum.length ||
23
25
  // filtered data
24
- !!table.getState().globalFilter && table.options.enableGlobalFilter // search with hide enabled
26
+ !!table.getState().globalFilter && table.options.enableGlobalFilter) // search with hide enabled
25
27
  ) {
26
28
  label = texts.table.footer.summary.records;
27
- count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, currentLength), "\u00A0", texts.table.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
29
+ count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(currentLength)), "\u00A0", texts.table.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
28
30
  } else {
29
31
  label = texts.table.footer.summary.records;
30
32
  count = /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length));
@@ -1 +1 @@
1
- {"version":3,"file":"Summary.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Footer/Summary.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useLocalization } from '../../../../../components/Provider/Localization';\n\nexport type FooterSummaryProps<TType = unknown> = {\n table: ReactTable<TType>;\n};\n\nexport function Summary<TType = unknown>(props: FooterSummaryProps<TType>) {\n const { table } = props;\n const { locale, texts } = useLocalization();\n const length = (table.options.meta as ReactTableMeta<TType>).length;\n const currentLength = table.getRowModel().rows.length;\n\n let label;\n let count;\n\n // row selection\n const rowsSelectedLength = table.getSelectedRowModel().rows.length;\n\n if (rowsSelectedLength > 0) {\n label = texts.table.footer.summary.selected;\n count = (\n <>\n <strong>{new Intl.NumberFormat(locale).format(rowsSelectedLength)}</strong>&nbsp;\n {texts.table.footer.summary.count}&nbsp;\n <strong>{new Intl.NumberFormat(locale).format(length)}</strong>\n </>\n );\n } else if (\n table.getState().columnFilters?.length || // filtered data\n (!!table.getState().globalFilter && table.options.enableGlobalFilter) // search with hide enabled\n ) {\n label = texts.table.footer.summary.records;\n count = (\n <>\n <strong>{currentLength}</strong>&nbsp;\n {texts.table.footer.summary.count}&nbsp;\n <strong>{new Intl.NumberFormat(locale).format(length)}</strong>\n </>\n );\n } else {\n label = texts.table.footer.summary.records;\n count = <strong>{new Intl.NumberFormat(locale).format(length)}</strong>;\n }\n\n return (\n <div\n className=\"sticky left-0 z-20 flex h-full w-fit items-center whitespace-nowrap bg-white pr-1 shadow-[12px_0px_6px_white]\"\n data-taco=\"table-footer-summary\">\n {label}&nbsp;{count}\n </div>\n );\n}\n"],"names":["Summary","props","table","locale","texts","useLocalization","length","options","meta","currentLength","getRowModel","rows","label","count","rowsSelectedLength","getSelectedRowModel","footer","summary","selected","React","Intl","NumberFormat","format","_table$getState$colum","getState","columnFilters","globalFilter","enableGlobalFilter","records","className"],"mappings":";;;SAQgBA,OAAOA,CAAkBC,KAAgC;;EACrE,MAAM;IAAEC;GAAO,GAAGD,KAAK;EACvB,MAAM;IAAEE,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAC3C,MAAMC,MAAM,GAAIJ,KAAK,CAACK,OAAO,CAACC,IAA8B,CAACF,MAAM;EACnE,MAAMG,aAAa,GAAGP,KAAK,CAACQ,WAAW,EAAE,CAACC,IAAI,CAACL,MAAM;EAErD,IAAIM,KAAK;EACT,IAAIC,KAAK;;EAGT,MAAMC,kBAAkB,GAAGZ,KAAK,CAACa,mBAAmB,EAAE,CAACJ,IAAI,CAACL,MAAM;EAElE,IAAIQ,kBAAkB,GAAG,CAAC,EAAE;IACxBF,KAAK,GAAGR,KAAK,CAACF,KAAK,CAACc,MAAM,CAACC,OAAO,CAACC,QAAQ;IAC3CL,KAAK,gBACDM,yEACIA,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAAClB,MAAM,CAAC,CAACmB,MAAM,CAACR,kBAAkB,CAAC,CAAU,YAC1EV,KAAK,CAACF,KAAK,CAACc,MAAM,CAACC,OAAO,CAACJ,KAAK,yBACjCM,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAAClB,MAAM,CAAC,CAACmB,MAAM,CAAChB,MAAM,CAAC,CAAU,CAEtE;GACJ,MAAM,IACH,CAAAiB,qBAAA,GAAArB,KAAK,CAACsB,QAAQ,EAAE,CAACC,aAAa,cAAAF,qBAAA,eAA9BA,qBAAA,CAAgCjB,MAAM;;EACrC,CAAC,CAACJ,KAAK,CAACsB,QAAQ,EAAE,CAACE,YAAY,IAAIxB,KAAK,CAACK,OAAO,CAACoB,kBAAmB;IACvE;IACEf,KAAK,GAAGR,KAAK,CAACF,KAAK,CAACc,MAAM,CAACC,OAAO,CAACW,OAAO;IAC1Cf,KAAK,gBACDM,yEACIA,6CAASV,aAAa,CAAU,YAC/BL,KAAK,CAACF,KAAK,CAACc,MAAM,CAACC,OAAO,CAACJ,KAAK,yBACjCM,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAAClB,MAAM,CAAC,CAACmB,MAAM,CAAChB,MAAM,CAAC,CAAU,CAEtE;GACJ,MAAM;IACHM,KAAK,GAAGR,KAAK,CAACF,KAAK,CAACc,MAAM,CAACC,OAAO,CAACW,OAAO;IAC1Cf,KAAK,gBAAGM,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAAClB,MAAM,CAAC,CAACmB,MAAM,CAAChB,MAAM,CAAC,CAAU;;EAG3E,oBACIa;IACIU,SAAS,EAAC,+GAA+G;iBAC/G;KACTjB,KAAK,YAAQC,KAAK,CACjB;AAEd;;;;"}
1
+ {"version":3,"file":"Summary.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Footer/Summary.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useLocalization } from '../../../../../components/Provider/Localization';\n\nexport type FooterSummaryProps<TType = unknown> = {\n table: ReactTable<TType>;\n};\n\nexport function Summary<TType = unknown>(props: FooterSummaryProps<TType>) {\n const { table } = props;\n const { locale, texts } = useLocalization();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const length = tableMeta.length;\n const currentLength = table.getRowModel().rows.length;\n\n let label;\n let count;\n\n // row selection\n // use table state and not the selected row model because of the way server loading works\n const rowsSelectedLength = Object.keys(table.getState().rowSelection).length;\n\n if (rowsSelectedLength > 0) {\n label = texts.table.footer.summary.selected;\n count = (\n <>\n <strong>{new Intl.NumberFormat(locale).format(rowsSelectedLength)}</strong>&nbsp;\n {texts.table.footer.summary.count}&nbsp;\n <strong>{new Intl.NumberFormat(locale).format(length)}</strong>\n </>\n );\n } else if (\n !tableMeta.server.isEnabled &&\n (table.getState().columnFilters?.length || // filtered data\n (!!table.getState().globalFilter && table.options.enableGlobalFilter)) // search with hide enabled\n ) {\n label = texts.table.footer.summary.records;\n count = (\n <>\n <strong>{new Intl.NumberFormat(locale).format(currentLength)}</strong>&nbsp;\n {texts.table.footer.summary.count}&nbsp;\n <strong>{new Intl.NumberFormat(locale).format(length)}</strong>\n </>\n );\n } else {\n label = texts.table.footer.summary.records;\n count = <strong>{new Intl.NumberFormat(locale).format(length)}</strong>;\n }\n\n return (\n <div\n className=\"sticky left-0 z-20 flex h-full w-fit items-center whitespace-nowrap bg-white pr-1 shadow-[12px_0px_6px_white]\"\n data-taco=\"table-footer-summary\">\n {label}&nbsp;{count}\n </div>\n );\n}\n"],"names":["Summary","props","table","locale","texts","useLocalization","tableMeta","options","meta","length","currentLength","getRowModel","rows","label","count","rowsSelectedLength","Object","keys","getState","rowSelection","footer","summary","selected","React","Intl","NumberFormat","format","server","isEnabled","_table$getState$colum","columnFilters","globalFilter","enableGlobalFilter","records","className"],"mappings":";;;SAQgBA,OAAOA,CAAkBC,KAAgC;;EACrE,MAAM;IAAEC;GAAO,GAAGD,KAAK;EACvB,MAAM;IAAEE,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAC3C,MAAMC,SAAS,GAAGJ,KAAK,CAACK,OAAO,CAACC,IAA6B;EAC7D,MAAMC,MAAM,GAAGH,SAAS,CAACG,MAAM;EAC/B,MAAMC,aAAa,GAAGR,KAAK,CAACS,WAAW,EAAE,CAACC,IAAI,CAACH,MAAM;EAErD,IAAII,KAAK;EACT,IAAIC,KAAK;;;EAIT,MAAMC,kBAAkB,GAAGC,MAAM,CAACC,IAAI,CAACf,KAAK,CAACgB,QAAQ,EAAE,CAACC,YAAY,CAAC,CAACV,MAAM;EAE5E,IAAIM,kBAAkB,GAAG,CAAC,EAAE;IACxBF,KAAK,GAAGT,KAAK,CAACF,KAAK,CAACkB,MAAM,CAACC,OAAO,CAACC,QAAQ;IAC3CR,KAAK,gBACDS,yEACIA,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAACtB,MAAM,CAAC,CAACuB,MAAM,CAACX,kBAAkB,CAAC,CAAU,YAC1EX,KAAK,CAACF,KAAK,CAACkB,MAAM,CAACC,OAAO,CAACP,KAAK,yBACjCS,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAACtB,MAAM,CAAC,CAACuB,MAAM,CAACjB,MAAM,CAAC,CAAU,CAEtE;GACJ,MAAM,IACH,CAACH,SAAS,CAACqB,MAAM,CAACC,SAAS,KAC1B,CAAAC,qBAAA,GAAA3B,KAAK,CAACgB,QAAQ,EAAE,CAACY,aAAa,cAAAD,qBAAA,eAA9BA,qBAAA,CAAgCpB,MAAM;;EAClC,CAAC,CAACP,KAAK,CAACgB,QAAQ,EAAE,CAACa,YAAY,IAAI7B,KAAK,CAACK,OAAO,CAACyB,kBAAmB,CAAC;IAC5E;IACEnB,KAAK,GAAGT,KAAK,CAACF,KAAK,CAACkB,MAAM,CAACC,OAAO,CAACY,OAAO;IAC1CnB,KAAK,gBACDS,yEACIA,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAACtB,MAAM,CAAC,CAACuB,MAAM,CAAChB,aAAa,CAAC,CAAU,YACrEN,KAAK,CAACF,KAAK,CAACkB,MAAM,CAACC,OAAO,CAACP,KAAK,yBACjCS,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAACtB,MAAM,CAAC,CAACuB,MAAM,CAACjB,MAAM,CAAC,CAAU,CAEtE;GACJ,MAAM;IACHI,KAAK,GAAGT,KAAK,CAACF,KAAK,CAACkB,MAAM,CAACC,OAAO,CAACY,OAAO;IAC1CnB,KAAK,gBAAGS,6CAAS,IAAIC,IAAI,CAACC,YAAY,CAACtB,MAAM,CAAC,CAACuB,MAAM,CAACjB,MAAM,CAAC,CAAU;;EAG3E,oBACIc;IACIW,SAAS,EAAC,+GAA+G;iBAC/G;KACTrB,KAAK,YAAQC,KAAK,CACjB;AAEd;;;;"}
@@ -1,57 +1,59 @@
1
1
  import React__default from 'react';
2
- import { useInView } from 'react-intersection-observer';
2
+ import { getHiddenColumns } from '../../../../useTableManager/util/columns.js';
3
3
 
4
+ const DELAY_BEFORE_LOAD_MS = 150;
4
5
  function SkeletonRow(props) {
5
6
  const {
6
7
  index,
7
- row,
8
8
  table
9
9
  } = props;
10
10
  const tableMeta = table.options.meta;
11
11
  if (tableMeta.server.isEnabled) {
12
- return /*#__PURE__*/React__default.createElement(RowWithServerLoading, Object.assign({}, props, {
13
- index: index
14
- }));
12
+ return /*#__PURE__*/React__default.createElement(RowWithServerLoading, Object.assign({}, props));
15
13
  }
16
14
  return /*#__PURE__*/React__default.createElement(Skeleton, {
17
- cellsCount: row.getVisibleCells().length
15
+ cellsCount: table.getVisibleFlatColumns().length,
16
+ index: index
18
17
  });
19
18
  }
20
19
  function RowWithServerLoading(props) {
21
20
  var _table$getState$group, _table$getState;
22
21
  const {
23
22
  index,
24
- row,
25
23
  table
26
24
  } = props;
27
25
  const tableMeta = table.options.meta;
28
26
  const pageIndex = Math.floor(index / tableMeta.server.pageSize) * tableMeta.server.pageSize / tableMeta.server.pageSize;
29
- const {
30
- ref,
31
- inView
32
- } = useInView({
33
- threshold: 0,
34
- triggerOnce: true,
35
- initialInView: pageIndex === 0
36
- });
37
27
  React__default.useEffect(() => {
38
- if (inView) {
39
- var _tableMeta$server$loa, _tableMeta$server;
40
- (_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, pageIndex, table.getState().sorting, table.getState().columnFilters);
28
+ let timeout;
29
+ if (tableMeta.server.isEnabled) {
30
+ const sorting = props.table.getState().sorting;
31
+ const filters = props.table.getState().columnFilters;
32
+ const search = props.table.getState().globalFilter;
33
+ const hiddenColumns = getHiddenColumns(props.table.getState().columnVisibility);
34
+ timeout = setTimeout(() => {
35
+ var _tableMeta$server$loa, _tableMeta$server;
36
+ (_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, pageIndex, sorting, filters, tableMeta.search.enableGlobalFilter ? search : undefined, hiddenColumns);
37
+ }, DELAY_BEFORE_LOAD_MS);
41
38
  }
42
- }, [inView]);
39
+ return () => {
40
+ clearTimeout(timeout);
41
+ };
42
+ }, []);
43
43
  const groupedCellCount = (_table$getState$group = (_table$getState = table.getState()) === null || _table$getState === void 0 ? void 0 : _table$getState.grouping.length) !== null && _table$getState$group !== void 0 ? _table$getState$group : 0;
44
- const ungroupedCellCount = row.getVisibleCells().length - groupedCellCount;
44
+ const ungroupedCellCount = table.getVisibleFlatColumns().length - groupedCellCount;
45
45
  return /*#__PURE__*/React__default.createElement(Skeleton, {
46
46
  cellsCount: ungroupedCellCount,
47
- ref: ref
47
+ index: index
48
48
  });
49
49
  }
50
50
  const Skeleton = /*#__PURE__*/React__default.forwardRef(function Skeleton(props, ref) {
51
51
  const {
52
- cellsCount
52
+ cellsCount,
53
+ index
53
54
  } = props;
54
55
  return /*#__PURE__*/React__default.createElement("tr", {
56
+ "data-row-index": index,
55
57
  ref: ref
56
58
  }, Array(cellsCount).fill(null).map((_, index) => (/*#__PURE__*/React__default.createElement("td", {
57
59
  key: index
@@ -1 +1 @@
1
- {"version":3,"file":"SkeletonRow.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta, Row as ReactTableRow } from '@tanstack/react-table';\nimport { useInView } from 'react-intersection-observer';\n\nexport type RowProps<TType = unknown> = {\n index: number;\n row: ReactTableRow<TType>;\n table: ReactTable<TType>;\n};\n\nexport function SkeletonRow<TType = unknown>(props: RowProps<TType>) {\n const { index, row, table } = props;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (tableMeta.server.isEnabled) {\n return <RowWithServerLoading {...props} index={index} />;\n }\n\n return <Skeleton cellsCount={row.getVisibleCells().length} />;\n}\n\nfunction RowWithServerLoading<TType = unknown>(props: RowProps<TType>) {\n const { index, row, table } = props;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const pageIndex = (Math.floor(index / tableMeta.server.pageSize) * tableMeta.server.pageSize) / tableMeta.server.pageSize;\n\n const { ref, inView } = useInView({\n threshold: 0,\n triggerOnce: true,\n initialInView: pageIndex === 0,\n });\n\n React.useEffect(() => {\n if (inView) {\n tableMeta.server.loadPage?.(pageIndex, table.getState().sorting, table.getState().columnFilters);\n }\n }, [inView]);\n\n const groupedCellCount = table.getState()?.grouping.length ?? 0;\n const ungroupedCellCount = row.getVisibleCells().length - groupedCellCount;\n\n return <Skeleton cellsCount={ungroupedCellCount} ref={ref} />;\n}\n\nconst Skeleton = React.forwardRef(function Skeleton(props: { cellsCount: number }, ref: React.Ref<HTMLTableRowElement>) {\n const { cellsCount } = props;\n\n return (\n <tr ref={ref}>\n {Array(cellsCount)\n .fill(null)\n .map((_, index) => (\n <td key={index}>\n <span className=\"bg-grey-100 text-grey-700 h-4 w-full text-center text-xs\" />\n </td>\n ))}\n </tr>\n );\n});\n"],"names":["SkeletonRow","props","index","row","table","tableMeta","options","meta","server","isEnabled","React","RowWithServerLoading","Skeleton","cellsCount","getVisibleCells","length","pageIndex","Math","floor","pageSize","ref","inView","useInView","threshold","triggerOnce","initialInView","useEffect","_tableMeta$server$loa","_tableMeta$server","loadPage","call","getState","sorting","columnFilters","groupedCellCount","_table$getState$group","_table$getState","grouping","ungroupedCellCount","forwardRef","Array","fill","map","_","key","className"],"mappings":";;;SAUgBA,WAAWA,CAAkBC,KAAsB;EAC/D,MAAM;IAAEC,KAAK;IAAEC,GAAG;IAAEC;GAAO,GAAGH,KAAK;EACnC,MAAMI,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAE7D,IAAIF,SAAS,CAACG,MAAM,CAACC,SAAS,EAAE;IAC5B,oBAAOC,6BAACC,oBAAoB,oBAAKV,KAAK;MAAEC,KAAK,EAAEA;OAAS;;EAG5D,oBAAOQ,6B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BAAOxB,6BAACE,QAAQ;IAACC,UAAU,EAAEyB,kBAAkB;IAAElB,GAAG,EAAEA;IAAO;AACjE;AAEA,MAAMR,QAAQ,gBAAGF,cAAK,CAAC6B,UAAU,CAAC,SAAS3B,QAAQA,CAACX,KAA6B,EAAEmB,GAAmC;EAClH,MAAM;IAAEP;GAAY,GAAGZ,KAAK;EAE5B,oBACIS;IAAIU,GAAG,EAAEA;KACJoB,KAAK,CAAC3B,UAAU,CAAC,CACb4B,IAAI,CAAC,IAAI,CAAC,CACVC,GAAG,CAAC,CAACC,CAAC,EAAEzC,KAAK,mBACVQ;IAAIkC,GAAG,EAAE1C;kBACLQ;IAAMmC,SAAS,EAAC;IAA6D,CAC5E,CACR,CAAC,CACL;AAEb,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"SkeletonRow.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { getHiddenColumns } from '../../../../useTableManager/util/columns';\n\nconst DELAY_BEFORE_LOAD_MS = 150;\n\nexport type RowProps<TType = unknown> = {\n index: number;\n scrollDirection: 'forward' | 'backward' | undefined;\n table: ReactTable<TType>;\n};\n\nexport function SkeletonRow<TType = unknown>(props: RowProps<TType>) {\n const { index, table } = props;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (tableMeta.server.isEnabled) {\n return <RowWithServerLoading {...props} />;\n }\n\n return <Skeleton cellsCount={table.getVisibleFlatColumns().length} index={index} />;\n}\n\nfunction RowWithServerLoading<TType = unknown>(props: RowProps<TType>) {\n const { index, table } = props;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const pageIndex = (Math.floor(index / tableMeta.server.pageSize) * tableMeta.server.pageSize) / tableMeta.server.pageSize;\n\n React.useEffect(() => {\n let timeout;\n\n if (tableMeta.server.isEnabled) {\n const sorting = props.table.getState().sorting;\n const filters = props.table.getState().columnFilters;\n const search = props.table.getState().globalFilter;\n const hiddenColumns = getHiddenColumns(props.table.getState().columnVisibility);\n\n timeout = setTimeout(() => {\n tableMeta.server.loadPage?.(\n pageIndex,\n sorting,\n filters,\n tableMeta.search.enableGlobalFilter ? search : undefined,\n hiddenColumns\n );\n }, DELAY_BEFORE_LOAD_MS);\n }\n\n return () => {\n clearTimeout(timeout);\n };\n }, []);\n\n const groupedCellCount = table.getState()?.grouping.length ?? 0;\n const ungroupedCellCount = table.getVisibleFlatColumns().length - groupedCellCount;\n\n return <Skeleton cellsCount={ungroupedCellCount} index={index} />;\n}\n\nconst Skeleton = React.forwardRef(function Skeleton(\n props: { cellsCount: number; index: number },\n ref: React.Ref<HTMLTableRowElement>\n) {\n const { cellsCount, index } = props;\n\n return (\n <tr data-row-index={index} ref={ref}>\n {Array(cellsCount)\n .fill(null)\n .map((_, index) => (\n <td key={index}>\n <span className=\"bg-grey-100 text-grey-700 h-4 w-full text-center text-xs\" />\n </td>\n ))}\n </tr>\n );\n});\n"],"names":["DELAY_BEFORE_LOAD_MS","SkeletonRow","props","index","table","tableMeta","options","meta","server","isEnabled","React","RowWithServerLoading","Skeleton","cellsCount","getVisibleFlatColumns","length","pageIndex","Math","floor","pageSize","useEffect","timeout","sorting","getState","filters","columnFilters","search","globalFilter","hiddenColumns","getHiddenColumns","columnVisibility","setTimeout","_tableMeta$server$loa","_tableMeta$server","loadPage","call","enableGlobalFilter","undefined","clearTimeout","groupedCellCount","_table$getState$group","_table$getState","grouping","ungroupedCellCount","forwardRef","ref","Array","fill","map","_","key","className"],"mappings":";;;AAIA,MAAMA,oBAAoB,GAAG,GAAG;SAQhBC,WAAWA,CAAkBC,KAAsB;EAC/D,MAAM;IAAEC,KAAK;IAAEC;GAAO,GAAGF,KAAK;EAC9B,MAAMG,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAE7D,IAAIF,SAAS,CAACG,MAAM,CAACC,SAAS,EAAE;IAC5B,oBA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,EAAE5B,oBAAoB,CAAC;;IAG5B,OAAO;MACHsC,YAAY,CAACjB,OAAO,CAAC;KACxB;GACJ,EAAE,EAAE,CAAC;EAEN,MAAMkB,gBAAgB,IAAAC,qBAAA,IAAAC,eAAA,GAAGrC,KAAK,CAACmB,QAAQ,EAAE,cAAAkB,eAAA,uBAAhBA,eAAA,CAAkBC,QAAQ,CAAC3B,MAAM,cAAAyB,qBAAA,cAAAA,qBAAA,GAAI,CAAC;EAC/D,MAAMG,kBAAkB,GAAGvC,KAAK,CAACU,qBAAqB,EAAE,CAACC,MAAM,GAAGwB,gBAAgB;EAElF,oBAAO7B,6BAACE,QAAQ;IAACC,UAAU,EAAE8B,kBAAkB;IAAExC,KAAK,EAAEA;IAAS;AACrE;AAEA,MAAMS,QAAQ,gBAAGF,cAAK,CAACkC,UAAU,CAAC,SAAShC,QAAQA,CAC/CV,KAA4C,EAC5C2C,GAAmC;EAEnC,MAAM;IAAEhC,UAAU;IAAEV;GAAO,GAAGD,KAAK;EAEnC,oBACIQ;sBAAoBP,KAAK;IAAE0C,GAAG,EAAEA;KAC3BC,KAAK,CAACjC,UAAU,CAAC,CACbkC,IAAI,CAAC,IAAI,CAAC,CACVC,GAAG,CAAC,CAACC,CAAC,EAAE9C,KAAK,mBACVO;IAAIwC,GAAG,EAAE/C;kBACLO;IAAMyC,SAAS,EAAC;IAA6D,CAC5E,CACR,CAAC,CACL;AAEb,CAAC,CAAC;;;;"}
@@ -1,7 +1,8 @@
1
1
  import React__default from 'react';
2
- import { SkeletonRow } from './BuiltIns/SkeletonRow.js';
2
+ import { getHiddenColumns } from '../../../useTableManager/util/columns.js';
3
3
  import { RowContext } from './RowContext.js';
4
4
 
5
+ const DELAY_BEFORE_LOAD_MS = 250;
5
6
  /* anonymous functions will break the memoisation on each render, wrap handlers in callbacks */
6
7
  function Row(props) {
7
8
  const {
@@ -9,6 +10,8 @@ function Row(props) {
9
10
  cellRenderer: CellRenderer,
10
11
  hideInternalColumns = false,
11
12
  hideRowActions = false,
13
+ scrollDirection,
14
+ skipPageLoading = false,
12
15
  ...displayRowProps
13
16
  } = props;
14
17
  const tableMeta = props.table.options.meta;
@@ -20,9 +23,43 @@ function Row(props) {
20
23
  hideInternalColumns,
21
24
  hideRowActions
22
25
  }), [isHovered, props.index, hideInternalColumns, hideRowActions]);
23
- if (props.row.original === undefined) {
24
- return /*#__PURE__*/React__default.createElement(SkeletonRow, Object.assign({}, props));
25
- }
26
+ React__default.useEffect(() => {
27
+ let timeout;
28
+ if (tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 && !skipPageLoading) {
29
+ const pageIndex = Math.floor(props.index / tableMeta.server.pageSize) * tableMeta.server.pageSize / tableMeta.server.pageSize;
30
+ const sorting = props.table.getState().sorting;
31
+ const filters = props.table.getState().columnFilters;
32
+ const search = props.table.getState().globalFilter;
33
+ const hiddenColumns = getHiddenColumns(props.table.getState().columnVisibility);
34
+ const pageIndexesToFetch = [];
35
+ /*
36
+ // if there's no direction, it means the scroll bar got dropped un unloaded pages,
37
+ // in that case, load forward and backward pages to prevent skeletons
38
+ if (scrollDirection === 'backward' || !scrollDirection) {
39
+ const backIndex = pageIndex - 1;
40
+ if (backIndex > -1) {
41
+ pageIndexesToFetch.push(backIndex);
42
+ }
43
+ }
44
+ */
45
+ // always load the next page
46
+ if (scrollDirection === 'forward' || !scrollDirection) {
47
+ pageIndexesToFetch.push(pageIndex + 1);
48
+ }
49
+ // the virtualiser fetches a page ahead, so this won't get called in most cases
50
+ // but it provides a fallback for some edge cases
51
+ timeout = setTimeout(() => {
52
+ pageIndexesToFetch.forEach(index => {
53
+ var _tableMeta$server$loa, _tableMeta$server;
54
+ // this can be called by every row within the current page, but loadPage returns early if a pending request exists
55
+ (_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, index, sorting, filters, tableMeta.search.enableGlobalFilter ? search : undefined, hiddenColumns);
56
+ });
57
+ }, DELAY_BEFORE_LOAD_MS);
58
+ }
59
+ return () => {
60
+ clearTimeout(timeout);
61
+ };
62
+ }, [tableMeta.server.pages]);
26
63
  return /*#__PURE__*/React__default.createElement(RowContext.Provider, {
27
64
  value: contextValue
28
65
  }, /*#__PURE__*/React__default.createElement(RowRenderer, Object.assign({}, displayRowProps, {