@economic/taco 2.23.0 → 2.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (300) hide show
  1. package/dist/components/Card/Card.d.ts +1 -0
  2. package/dist/components/Checkbox/Checkbox.d.ts +2 -0
  3. package/dist/components/Provider/Localization.d.ts +6 -0
  4. package/dist/components/Report/Report.d.ts +2 -2
  5. package/dist/components/Report/components/Body/Body.d.ts +0 -1
  6. package/dist/components/Report/components/Footer/Summary.d.ts +0 -1
  7. package/dist/components/Report/components/Header/Header.d.ts +3 -0
  8. package/dist/components/Report/components/Header/components/Menu.d.ts +3 -0
  9. package/dist/components/Report/components/Toolbar/components/Filters/components/Filter.d.ts +2 -2
  10. package/dist/components/Report/components/Toolbar/components/Filters/components/FilterColumn.d.ts +5 -2
  11. package/dist/components/Report/components/Toolbar/components/Filters/util.d.ts +2 -0
  12. package/dist/components/Report/types.d.ts +2 -2
  13. package/dist/components/Report/useReport.d.ts +0 -1
  14. package/dist/components/Select2/Select2.d.ts +22 -0
  15. package/dist/components/Select2/hooks/useChildren.d.ts +1 -0
  16. package/dist/components/Table/Table.d.ts +1 -1
  17. package/dist/components/Table/components/BaseTable.d.ts +1 -1
  18. package/dist/components/Table/hooks/useRowCreation.d.ts +2 -2
  19. package/dist/components/Table/hooks/useTable.d.ts +5 -5
  20. package/dist/components/Table/hooks/useTableKeyboardNavigation.d.ts +2 -2
  21. package/dist/components/Table/types.d.ts +37 -37
  22. package/dist/components/Table/util/sortTypes.d.ts +2 -2
  23. package/dist/components/Table/util.d.ts +4 -4
  24. package/dist/components/Table3/components/toolbar/Filter/filters/components/Filter.d.ts +2 -2
  25. package/dist/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.d.ts +5 -2
  26. package/dist/components/Table3/hooks/useTable.d.ts +8 -8
  27. package/dist/components/Table3/types.d.ts +2 -0
  28. package/dist/esm/index.css +55 -46
  29. package/dist/esm/packages/taco/src/components/Button/util.js +8 -8
  30. package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
  31. package/dist/esm/packages/taco/src/components/Card/Card.js +2 -1
  32. package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
  33. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +11 -2
  34. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
  35. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +1 -1
  36. package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js +12 -1
  37. package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js.map +1 -1
  38. package/dist/esm/packages/taco/src/components/Provider/Localization.js +7 -1
  39. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  40. package/dist/esm/packages/taco/src/components/Report/Report.js +3 -8
  41. package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -1
  42. package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js +4 -3
  43. package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js.map +1 -1
  44. package/dist/esm/packages/taco/src/components/Report/components/Cell/Cell.js +1 -1
  45. package/dist/esm/packages/taco/src/components/Report/components/Cell/Cell.js.map +1 -1
  46. package/dist/esm/packages/taco/src/components/Report/components/Cell/GroupedCell.js +1 -1
  47. package/dist/esm/packages/taco/src/components/Report/components/Cell/GroupedCell.js.map +1 -1
  48. package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js +1 -1
  49. package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js.map +1 -1
  50. package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js +14 -2
  51. package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js +3 -3
  53. package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js.map +1 -1
  54. package/dist/esm/packages/taco/src/components/Report/components/Header/Header.js +18 -1
  55. package/dist/esm/packages/taco/src/components/Report/components/Header/Header.js.map +1 -1
  56. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Menu.js +10 -1
  57. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Menu.js.map +1 -1
  58. package/dist/esm/packages/taco/src/components/Report/components/Header/util.js +1 -1
  59. package/dist/esm/packages/taco/src/components/Report/components/Header/util.js.map +1 -1
  60. package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js +47 -11
  61. package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js.map +1 -1
  62. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/Filters.js +13 -1
  63. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/Filters.js.map +1 -1
  64. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js +44 -51
  65. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
  66. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js +14 -7
  67. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js.map +1 -1
  68. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js +4 -3
  69. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -1
  70. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterValue.js +11 -1
  71. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -1
  72. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/util.js +4 -1
  73. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/util.js.map +1 -1
  74. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js +10 -8
  75. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js.map +1 -1
  76. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/HideOrOrderPopover.js +1 -1
  77. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/HideOrOrderPopover.js.map +1 -1
  78. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/Settings.js +1 -1
  79. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/Settings.js.map +1 -1
  80. package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js +2 -2
  81. package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js.map +1 -1
  82. package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js +8 -5
  83. package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js.map +1 -1
  84. package/dist/esm/packages/taco/src/components/Report/useReport.js +3 -3
  85. package/dist/esm/packages/taco/src/components/Report/useReport.js.map +1 -1
  86. package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js +3 -10
  87. package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js.map +1 -1
  88. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +2 -1
  89. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  90. package/dist/esm/packages/taco/src/components/Select2/Select2.js +43 -4
  91. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  92. package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js +1 -1
  93. package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js.map +1 -1
  94. package/dist/esm/packages/taco/src/components/Table/components/PaginatedTable.js.map +1 -1
  95. package/dist/esm/packages/taco/src/components/Table/components/Table.js.map +1 -1
  96. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
  97. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js.map +1 -1
  98. package/dist/esm/packages/taco/src/components/Table/hooks/useRowCreation.js.map +1 -1
  99. package/dist/esm/packages/taco/src/components/Table/hooks/useTable.js.map +1 -1
  100. package/dist/esm/packages/taco/src/components/Table/hooks/useTableKeyboardNavigation.js.map +1 -1
  101. package/dist/esm/packages/taco/src/components/Table/util/renderRow.js.map +1 -1
  102. package/dist/esm/packages/taco/src/components/Table/util/sortTypes.js.map +1 -1
  103. package/dist/esm/packages/taco/src/components/Table/util.js.map +1 -1
  104. package/dist/esm/packages/taco/src/components/Table3/Table3.js +4 -6
  105. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  106. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Summary.js +1 -1
  107. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Summary.js.map +1 -1
  108. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +66 -14
  109. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
  110. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js +1 -1
  111. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js.map +1 -1
  112. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +1 -1
  113. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js.map +1 -1
  114. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +27 -44
  115. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
  116. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Filter.js +14 -7
  117. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Filter.js.map +1 -1
  118. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js +4 -3
  119. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js.map +1 -1
  120. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +1 -1
  121. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js.map +1 -1
  122. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +2 -0
  123. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
  124. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +1 -1
  125. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js +1 -1
  126. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +3 -1
  127. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
  128. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +26 -19
  129. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  130. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  131. package/dist/esm/packages/taco/src/hooks/useLocalStorage.js.map +1 -1
  132. package/dist/esm/packages/taco/src/index.js +1 -1
  133. package/dist/esm/packages/taco/src/primitives/Button.js +1 -0
  134. package/dist/esm/packages/taco/src/primitives/Button.js.map +1 -1
  135. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  136. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableColumnFreezing.js.map +1 -0
  137. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableColumnOrdering.js.map +1 -0
  138. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableFontSize.js.map +1 -0
  139. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableFooter.js.map +1 -0
  140. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTablePrinting.js +36 -0
  141. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTablePrinting.js.map +1 -0
  142. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRef.js.map +1 -0
  143. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActions.js.map +1 -0
  144. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js.map +1 -0
  145. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowClick.js.map +1 -0
  146. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js.map +1 -0
  147. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowGoto.js.map +1 -0
  148. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowGroups.js.map +1 -0
  149. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowHeight.js.map +1 -0
  150. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowSelection.js.map +1 -0
  151. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js.map +1 -0
  152. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js.map +1 -0
  153. package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableSettings.js +1 -2
  154. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js.map +1 -0
  155. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableDataListener.js.map +1 -0
  156. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFilterListener.js.map +1 -0
  157. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js.map +1 -0
  158. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowHeightListener.js.map +1 -0
  159. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js.map +1 -0
  160. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -0
  161. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js.map +1 -0
  162. package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableSettingsListener.js +1 -1
  163. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js.map +1 -0
  164. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableShortcutsListener.js.map +1 -0
  165. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSortingListener.js.map +1 -0
  166. package/dist/esm/packages/taco/src/primitives/Table/{useTable/useTable.js → useTableManager/useTableManager.js} +10 -8
  167. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -0
  168. package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/util/columns.js +33 -7
  169. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js.map +1 -0
  170. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/filtering.js.map +1 -0
  171. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js.map +1 -0
  172. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js.map +1 -0
  173. package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/util/settings.js +0 -1
  174. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js.map +1 -0
  175. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -0
  176. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/sorting.js.map +1 -0
  177. package/dist/esm/packages/taco/src/utils/dom.js +12 -3
  178. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  179. package/dist/esm/packages/taco/src/utils/keyboard.js +2 -2
  180. package/dist/esm/packages/taco/src/utils/keyboard.js.map +1 -1
  181. package/dist/hooks/useLocalStorage.d.ts +2 -1
  182. package/dist/index.css +55 -46
  183. package/dist/primitives/Table/types.d.ts +5 -18
  184. package/dist/primitives/Table/useTableManager/features/useTablePrinting.d.ts +15 -0
  185. package/dist/primitives/Table/useTableManager/types.d.ts +13 -0
  186. package/dist/primitives/Table/{useTable/useTable.d.ts → useTableManager/useTableManager.d.ts} +4 -3
  187. package/dist/primitives/Table/useTableManager/util/presets.d.ts +2 -0
  188. package/dist/primitives/Table/{useTable → useTableManager}/util/settings.d.ts +0 -1
  189. package/dist/primitives/Table/{useTable → useTableManager}/util/setup.d.ts +5 -4
  190. package/dist/taco.cjs.development.js +603 -408
  191. package/dist/taco.cjs.development.js.map +1 -1
  192. package/dist/taco.cjs.production.min.js +1 -1
  193. package/dist/taco.cjs.production.min.js.map +1 -1
  194. package/dist/utils/dom.d.ts +3 -1
  195. package/package.json +2 -2
  196. package/types.json +10314 -9345
  197. package/dist/components/Report/components/Toolbar/components/Filters/components/Placeholder.d.ts +0 -12
  198. package/dist/components/Table3/components/toolbar/Filter/filters/components/Placeholder.d.ts +0 -12
  199. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js +0 -41
  200. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js.map +0 -1
  201. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js +0 -41
  202. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js.map +0 -1
  203. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnFreezing.js.map +0 -1
  204. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js.map +0 -1
  205. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFontSize.js.map +0 -1
  206. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFooter.js.map +0 -1
  207. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js +0 -16
  208. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +0 -1
  209. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRef.js.map +0 -1
  210. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActions.js.map +0 -1
  211. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js.map +0 -1
  212. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowClick.js.map +0 -1
  213. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowExpansion.js.map +0 -1
  214. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js.map +0 -1
  215. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGroups.js.map +0 -1
  216. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowHeight.js.map +0 -1
  217. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js.map +0 -1
  218. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSearch.js.map +0 -1
  219. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js.map +0 -1
  220. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js.map +0 -1
  221. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableDataListener.js.map +0 -1
  222. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFilterListener.js.map +0 -1
  223. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFontSizeListener.js.map +0 -1
  224. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowHeightListener.js.map +0 -1
  225. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowSelectionListener.js.map +0 -1
  226. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSearchListener.js.map +0 -1
  227. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableServerLoadingListener.js.map +0 -1
  228. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js.map +0 -1
  229. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableShortcutsListener.js.map +0 -1
  230. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSortingListener.js.map +0 -1
  231. package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js.map +0 -1
  232. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +0 -1
  233. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/filtering.js.map +0 -1
  234. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/presets.js.map +0 -1
  235. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/search.js.map +0 -1
  236. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/settings.js.map +0 -1
  237. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/setup.js.map +0 -1
  238. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/sorting.js.map +0 -1
  239. package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +0 -8
  240. package/dist/primitives/Table/useTable/util/presets.d.ts +0 -2
  241. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableColumnFreezing.js +0 -0
  242. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableColumnOrdering.js +0 -0
  243. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableFontSize.js +0 -0
  244. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableFooter.js +0 -0
  245. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableRef.js +0 -0
  246. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableRowActions.js +0 -0
  247. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableRowActive.js +0 -0
  248. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableRowClick.js +0 -0
  249. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableRowExpansion.js +0 -0
  250. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableRowGoto.js +0 -0
  251. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableRowGroups.js +0 -0
  252. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableRowHeight.js +0 -0
  253. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableRowSelection.js +0 -0
  254. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableSearch.js +0 -0
  255. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/features/useTableServerLoading.js +0 -0
  256. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableDataListener.js +0 -0
  257. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableFilterListener.js +0 -0
  258. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableFontSizeListener.js +0 -0
  259. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableRowHeightListener.js +0 -0
  260. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableRowSelectionListener.js +0 -0
  261. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableSearchListener.js +0 -0
  262. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableServerLoadingListener.js +0 -0
  263. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableShortcutsListener.js +0 -0
  264. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/listeners/useTableSortingListener.js +0 -0
  265. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/util/filtering.js +0 -0
  266. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/util/presets.js +0 -0
  267. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/util/search.js +0 -0
  268. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/util/setup.js +0 -0
  269. /package/dist/esm/packages/taco/src/primitives/Table/{useTable → useTableManager}/util/sorting.js +0 -0
  270. /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableColumnFreezing.d.ts +0 -0
  271. /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableColumnOrdering.d.ts +0 -0
  272. /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableFontSize.d.ts +0 -0
  273. /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableFooter.d.ts +0 -0
  274. /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableRef.d.ts +0 -0
  275. /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableRowActions.d.ts +0 -0
  276. /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableRowActive.d.ts +0 -0
  277. /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableRowClick.d.ts +0 -0
  278. /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableRowExpansion.d.ts +0 -0
  279. /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableRowGoto.d.ts +0 -0
  280. /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableRowGroups.d.ts +0 -0
  281. /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableRowHeight.d.ts +0 -0
  282. /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableRowSelection.d.ts +0 -0
  283. /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableSearch.d.ts +0 -0
  284. /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableServerLoading.d.ts +0 -0
  285. /package/dist/primitives/Table/{useTable → useTableManager}/features/useTableSettings.d.ts +0 -0
  286. /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableDataListener.d.ts +0 -0
  287. /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableFilterListener.d.ts +0 -0
  288. /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableFontSizeListener.d.ts +0 -0
  289. /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableRowHeightListener.d.ts +0 -0
  290. /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableRowSelectionListener.d.ts +0 -0
  291. /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableSearchListener.d.ts +0 -0
  292. /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableServerLoadingListener.d.ts +0 -0
  293. /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableSettingsListener.d.ts +0 -0
  294. /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableShortcutsListener.d.ts +0 -0
  295. /package/dist/primitives/Table/{useTable → useTableManager}/listeners/useTableSortingListener.d.ts +0 -0
  296. /package/dist/primitives/Table/{useTable → useTableManager}/util/columns.d.ts +0 -0
  297. /package/dist/primitives/Table/{useTable → useTableManager}/util/columns.spec.d.ts +0 -0
  298. /package/dist/primitives/Table/{useTable → useTableManager}/util/filtering.d.ts +0 -0
  299. /package/dist/primitives/Table/{useTable → useTableManager}/util/search.d.ts +0 -0
  300. /package/dist/primitives/Table/{useTable → useTableManager}/util/sorting.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"useRowActions.js","sources":["../../../../../../../../../src/components/Table/hooks/plugins/useRowActions.tsx"],"sourcesContent":["import React from 'react';\nimport { PluginHook } from 'react-table';\nimport { InView } from 'react-intersection-observer';\nimport { sanitizeRowProps } from '../../util';\nimport { IconButton } from '../../../IconButton/IconButton';\nimport { LocalizationTexts } from '../../../Provider/Localization';\nimport { Menu } from '../../../Menu/Menu';\nimport { RowAction, RowActionHandler, TableRow } from '../../types';\n\nconst actionGroupClassName = '-mt-1 -mb-1 h-8 flex';\n\nconst hasActions = (inlineEditingUniqueId: any, handlers: any, actions: RowActionHandler<any>[] | undefined): number => {\n return (\n !!actions ||\n handlers.onRowCreate ||\n handlers.onRowCopy ||\n handlers.onRowDelete ||\n !!inlineEditingUniqueId ||\n handlers.onRowEdit\n );\n};\n\nconst getActions = (\n actions: RowActionHandler<any>[] | undefined,\n row: TableRow<any> | undefined = undefined\n): [RowAction<any>[], RowAction<any>[]] => {\n const primary: RowAction<any>[] = [];\n const secondary: RowAction<any>[] = [];\n\n if (actions) {\n let visibleActions = actions.filter(x => !!x && typeof x !== 'boolean') as RowAction<any>[];\n\n if (row) {\n visibleActions = visibleActions.filter(action => {\n if (action.visible !== undefined) {\n if (typeof action.visible === 'function') {\n return action.visible(row);\n }\n\n return action.visible;\n }\n\n return true;\n });\n }\n\n visibleActions.forEach(action => {\n if (action.showOnRow) {\n primary.push(action);\n } else {\n secondary.push(action);\n }\n });\n }\n\n return [primary, secondary];\n};\n\nconst getLength = (inlineEditingUniqueId: any, handlers: any, actions: RowActionHandler<any>[] | undefined): number => {\n const [primaryActions, secondaryActions] = getActions(actions);\n\n let length = primaryActions.length + (secondaryActions.length ? 1 : 0);\n\n if (handlers.onRowCreate) {\n length++;\n }\n\n if (handlers.onRowCopy) {\n length++;\n }\n\n if (handlers.onRowDelete) {\n length++;\n }\n\n if (!!inlineEditingUniqueId || handlers.onRowEdit) {\n length++;\n\n if (length < 2) {\n length++;\n }\n }\n\n return length;\n};\n\nconst getActionProps = (action: RowAction<any>, row: TableRow<any>) => {\n return {\n 'aria-label': typeof action.tooltip === 'function' ? action.tooltip(row) : action.tooltip,\n disabled: typeof action.disabled === 'function' ? action.disabled(row) : action.disabled,\n onClick: (event: React.MouseEvent<HTMLElement>) => {\n action.onClick(row, event);\n },\n };\n};\n\nconst EditModeActions = () => {\n React.useEffect(() => {\n const listener = (event: any) => {\n if (event.key === 'Escape' && event.target?.form?.reset) {\n event.preventDefault();\n event.target.form.reset();\n }\n };\n\n document.addEventListener('keydown', listener);\n\n return () => {\n document.removeEventListener('keydown', listener);\n };\n }, []);\n\n return (\n <div className={actionGroupClassName}>\n <IconButton appearance=\"primary\" icon=\"tick\" type=\"submit\" className=\"mr-2\" />\n <IconButton appearance=\"ghost\" icon=\"close\" type=\"reset\" />\n </div>\n );\n};\n\nexport const useRowActions = <T extends {}>(\n inlineEditingUniqueId: keyof T | undefined,\n handlers: any,\n actions: RowActionHandler<T>[] | undefined,\n rowExpansionRenderer: any,\n texts: LocalizationTexts,\n windowed = false\n): PluginHook<{}> => {\n const inlineEditing = !!inlineEditingUniqueId;\n const actionsLength = getLength(inlineEditingUniqueId, handlers, actions);\n\n const plugin = (hooks: any): void => {\n if (hasActions(inlineEditingUniqueId, handlers, actions)) {\n hooks.visibleColumns.push((columns: any) => [\n ...columns,\n {\n id: '_actions',\n className: 'flex justify-end px-1 overflow-visible',\n flex: `0 0 calc((${actionsLength} * 2rem) + .5rem)`,\n Cell: ({ row }: any) => {\n if (row.isEditing) {\n return <EditModeActions />;\n }\n\n const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);\n const [primaryActions, secondaryActions] = getActions(actions, sanitizedRow);\n\n const output = (\n <>\n {handlers.onRowCreate && (\n <IconButton\n appearance=\"discrete\"\n icon=\"circle-plus\"\n aria-label={texts.table.newSubRow}\n tooltip={texts.table.newSubRow}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n event.persist();\n row.setActive();\n\n if (!row.isExpanded) {\n row.toggleRowExpanded();\n }\n\n handlers.onRowCreate(sanitizedRow, event);\n }}\n />\n )}\n {(inlineEditing || handlers.onRowEdit) && (\n <IconButton\n appearance=\"discrete\"\n icon=\"edit\"\n aria-label={texts.table.edit}\n tooltip={texts.table.edit}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n row.setActive();\n\n if (inlineEditing) {\n row.toggleRowEditing();\n } else if (handlers.onRowEdit) {\n event.persist();\n handlers.onRowEdit(sanitizedRow, event);\n }\n }}\n />\n )}\n {handlers.onRowCopy && (\n <IconButton\n appearance=\"discrete\"\n icon=\"copy\"\n aria-label={texts.table.copy}\n tooltip={texts.table.copy}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n event.persist();\n row.setActive();\n handlers.onRowCopy(sanitizedRow, event);\n }}\n />\n )}\n {handlers.onRowDelete && (\n <IconButton\n appearance=\"discrete\"\n icon=\"delete\"\n aria-label={texts.table.del}\n tooltip={texts.table.del}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n event.persist();\n row.setActive();\n handlers.onRowDelete(sanitizedRow, event);\n }}\n />\n )}\n {primaryActions.map((action: RowAction<T>, index: number) => (\n <IconButton\n {...getActionProps(action, sanitizedRow)}\n key={index}\n appearance=\"discrete\"\n icon={typeof action.icon === 'function' ? action.icon(sanitizedRow) : action.icon}\n tooltip={\n typeof action.tooltip === 'function' ? action.tooltip(sanitizedRow) : action.tooltip\n }\n />\n ))}\n {secondaryActions.length ? (\n <Menu>\n <Menu.Trigger>\n <IconButton\n appearance=\"discrete\"\n icon=\"ellipsis-vertical\"\n aria-label={texts.table.actions}\n tooltip={texts.table.actions}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n row.setActive();\n }}\n />\n </Menu.Trigger>\n <Menu.Content>\n {secondaryActions.map((action: RowAction<T>, index: number) => (\n <Menu.Item\n key={index}\n icon={\n typeof action.icon === 'function'\n ? action.icon(sanitizedRow)\n : action.icon\n }\n {...getActionProps(action, sanitizedRow)}>\n {typeof action.text === 'function' ? action.text(sanitizedRow) : action.text}\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu>\n ) : null}\n </>\n );\n\n if (windowed) {\n return <div className={actionGroupClassName}>{output}</div>;\n }\n\n return (\n <InView rootMargin=\"100px 0px\">\n {({ inView, ref }) => (\n <div className={actionGroupClassName} ref={ref}>\n {inView ? output : null}\n </div>\n )}\n </InView>\n );\n },\n },\n ]);\n }\n };\n plugin.pluginName = 'useRowActions';\n return plugin;\n};\n"],"names":["actionGroupClassName","hasActions","inlineEditingUniqueId","handlers","actions","onRowCreate","onRowCopy","onRowDelete","onRowEdit","getActions","row","undefined","primary","secondary","visibleActions","filter","x","action","visible","forEach","showOnRow","push","getLength","primaryActions","secondaryActions","length","getActionProps","tooltip","disabled","onClick","event","EditModeActions","React","useEffect","listener","key","_event$target","target","_event$target$form","form","reset","preventDefault","document","addEventListener","removeEventListener","className","IconButton","appearance","icon","type","useRowActions","rowExpansionRenderer","texts","windowed","inlineEditing","actionsLength","plugin","hooks","visibleColumns","columns","id","flex","Cell","isEditing","sanitizedRow","sanitizeRowProps","output","table","newSubRow","canEdit","stopPropagation","persist","setActive","isExpanded","toggleRowExpanded","edit","toggleRowEditing","copy","del","map","index","Menu","Trigger","Content","Item","text","InView","rootMargin","inView","ref","pluginName"],"mappings":";;;;;;AASA,MAAMA,oBAAoB,GAAG,sBAAsB;AAEnD,MAAMC,UAAU,GAAGA,CAACC,qBAA0B,EAAEC,QAAa,EAAEC,OAA4C;EACvG,OACI,CAAC,CAACA,OAAO,IACTD,QAAQ,CAACE,WAAW,IACpBF,QAAQ,CAACG,SAAS,IAClBH,QAAQ,CAACI,WAAW,IACpB,CAAC,CAACL,qBAAqB,IACvBC,QAAQ,CAACK,SAAS;AAE1B,CAAC;AAED,MAAMC,UAAU,GAAGA,CACfL,OAA4C,EAC5CM,MAAiCC,SAAS;EAE1C,MAAMC,OAAO,GAAqB,EAAE;EACpC,MAAMC,SAAS,GAAqB,EAAE;EAEtC,IAAIT,OAAO,EAAE;IACT,IAAIU,cAAc,GAAGV,OAAO,CAACW,MAAM,CAACC,CAAC,IAAI,CAAC,CAACA,CAAC,IAAI,OAAOA,CAAC,KAAK,SAAS,CAAqB;IAE3F,IAAIN,GAAG,EAAE;MACLI,cAAc,GAAGA,cAAc,CAACC,MAAM,CAACE,MAAM;QACzC,IAAIA,MAAM,CAACC,OAAO,KAAKP,SAAS,EAAE;UAC9B,IAAI,OAAOM,MAAM,CAACC,OAAO,KAAK,UAAU,EAAE;YACtC,OAAOD,MAAM,CAACC,OAAO,CAACR,GAAG,CAAC;;UAG9B,OAAOO,MAAM,CAACC,OAAO;;QAGzB,OAAO,IAAI;OACd,CAAC;;IAGNJ,cAAc,CAACK,OAAO,CAACF,MAAM;MACzB,IAAIA,MAAM,CAACG,SAAS,EAAE;QAClBR,OAAO,CAACS,IAAI,CAACJ,MAAM,CAAC;OACvB,MAAM;QACHJ,SAAS,CA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YAAY,CAAC,GAAG/C,MAAM,CAACoE,IAAI,CACpE,CACf,CAAC,CACS,CACZ,IACP,IAAI,CAEf;UAED,IAAIhC,QAAQ,EAAE;YACV,oBAAOrB;cAAKa,SAAS,EAAE7C;eAAuBkE,MAAM,CAAO;;UAG/D,oBACIlC,6BAACsD,MAAM;YAACC,UAAU,EAAC;aACd,CAAC;YAAEC,MAAM;YAAEC;WAAK,oBACbzD;YAAKa,SAAS,EAAE7C,oBAAoB;YAAEyF,GAAG,EAAEA;aACtCD,MAAM,GAAGtB,MAAM,GAAG,IAAI,CACrB,CACT,CACI;;OAGpB,CACJ,CAAC;;GAET;EACDV,MAAM,CAACkC,UAAU,GAAG,eAAe;EACnC,OAAOlC,MAAM;AACjB;;;;"}
1
+ {"version":3,"file":"useRowActions.js","sources":["../../../../../../../../../src/components/Table/hooks/plugins/useRowActions.tsx"],"sourcesContent":["import React from 'react';\nimport { PluginHook } from 'react-table';\nimport { InView } from 'react-intersection-observer';\nimport { sanitizeRowProps } from '../../util';\nimport { IconButton } from '../../../IconButton/IconButton';\nimport { LocalizationTexts } from '../../../Provider/Localization';\nimport { Menu } from '../../../Menu/Menu';\nimport { RowAction, RowActionHandler, LegacyTableRow } from '../../types';\n\nconst actionGroupClassName = '-mt-1 -mb-1 h-8 flex';\n\nconst hasActions = (inlineEditingUniqueId: any, handlers: any, actions: RowActionHandler<any>[] | undefined): number => {\n return (\n !!actions ||\n handlers.onRowCreate ||\n handlers.onRowCopy ||\n handlers.onRowDelete ||\n !!inlineEditingUniqueId ||\n handlers.onRowEdit\n );\n};\n\nconst getActions = (\n actions: RowActionHandler<any>[] | undefined,\n row: LegacyTableRow<any> | undefined = undefined\n): [RowAction<any>[], RowAction<any>[]] => {\n const primary: RowAction<any>[] = [];\n const secondary: RowAction<any>[] = [];\n\n if (actions) {\n let visibleActions = actions.filter(x => !!x && typeof x !== 'boolean') as RowAction<any>[];\n\n if (row) {\n visibleActions = visibleActions.filter(action => {\n if (action.visible !== undefined) {\n if (typeof action.visible === 'function') {\n return action.visible(row);\n }\n\n return action.visible;\n }\n\n return true;\n });\n }\n\n visibleActions.forEach(action => {\n if (action.showOnRow) {\n primary.push(action);\n } else {\n secondary.push(action);\n }\n });\n }\n\n return [primary, secondary];\n};\n\nconst getLength = (inlineEditingUniqueId: any, handlers: any, actions: RowActionHandler<any>[] | undefined): number => {\n const [primaryActions, secondaryActions] = getActions(actions);\n\n let length = primaryActions.length + (secondaryActions.length ? 1 : 0);\n\n if (handlers.onRowCreate) {\n length++;\n }\n\n if (handlers.onRowCopy) {\n length++;\n }\n\n if (handlers.onRowDelete) {\n length++;\n }\n\n if (!!inlineEditingUniqueId || handlers.onRowEdit) {\n length++;\n\n if (length < 2) {\n length++;\n }\n }\n\n return length;\n};\n\nconst getActionProps = (action: RowAction<any>, row: LegacyTableRow<any>) => {\n return {\n 'aria-label': typeof action.tooltip === 'function' ? action.tooltip(row) : action.tooltip,\n disabled: typeof action.disabled === 'function' ? action.disabled(row) : action.disabled,\n onClick: (event: React.MouseEvent<HTMLElement>) => {\n action.onClick(row, event);\n },\n };\n};\n\nconst EditModeActions = () => {\n React.useEffect(() => {\n const listener = (event: any) => {\n if (event.key === 'Escape' && event.target?.form?.reset) {\n event.preventDefault();\n event.target.form.reset();\n }\n };\n\n document.addEventListener('keydown', listener);\n\n return () => {\n document.removeEventListener('keydown', listener);\n };\n }, []);\n\n return (\n <div className={actionGroupClassName}>\n <IconButton appearance=\"primary\" icon=\"tick\" type=\"submit\" className=\"mr-2\" />\n <IconButton appearance=\"ghost\" icon=\"close\" type=\"reset\" />\n </div>\n );\n};\n\nexport const useRowActions = <T extends {}>(\n inlineEditingUniqueId: keyof T | undefined,\n handlers: any,\n actions: RowActionHandler<T>[] | undefined,\n rowExpansionRenderer: any,\n texts: LocalizationTexts,\n windowed = false\n): PluginHook<{}> => {\n const inlineEditing = !!inlineEditingUniqueId;\n const actionsLength = getLength(inlineEditingUniqueId, handlers, actions);\n\n const plugin = (hooks: any): void => {\n if (hasActions(inlineEditingUniqueId, handlers, actions)) {\n hooks.visibleColumns.push((columns: any) => [\n ...columns,\n {\n id: '_actions',\n className: 'flex justify-end px-1 overflow-visible',\n flex: `0 0 calc((${actionsLength} * 2rem) + .5rem)`,\n Cell: ({ row }: any) => {\n if (row.isEditing) {\n return <EditModeActions />;\n }\n\n const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);\n const [primaryActions, secondaryActions] = getActions(actions, sanitizedRow);\n\n const output = (\n <>\n {handlers.onRowCreate && (\n <IconButton\n appearance=\"discrete\"\n icon=\"circle-plus\"\n aria-label={texts.table.newSubRow}\n tooltip={texts.table.newSubRow}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n event.persist();\n row.setActive();\n\n if (!row.isExpanded) {\n row.toggleRowExpanded();\n }\n\n handlers.onRowCreate(sanitizedRow, event);\n }}\n />\n )}\n {(inlineEditing || handlers.onRowEdit) && (\n <IconButton\n appearance=\"discrete\"\n icon=\"edit\"\n aria-label={texts.table.edit}\n tooltip={texts.table.edit}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n row.setActive();\n\n if (inlineEditing) {\n row.toggleRowEditing();\n } else if (handlers.onRowEdit) {\n event.persist();\n handlers.onRowEdit(sanitizedRow, event);\n }\n }}\n />\n )}\n {handlers.onRowCopy && (\n <IconButton\n appearance=\"discrete\"\n icon=\"copy\"\n aria-label={texts.table.copy}\n tooltip={texts.table.copy}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n event.persist();\n row.setActive();\n handlers.onRowCopy(sanitizedRow, event);\n }}\n />\n )}\n {handlers.onRowDelete && (\n <IconButton\n appearance=\"discrete\"\n icon=\"delete\"\n aria-label={texts.table.del}\n tooltip={texts.table.del}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n event.persist();\n row.setActive();\n handlers.onRowDelete(sanitizedRow, event);\n }}\n />\n )}\n {primaryActions.map((action: RowAction<T>, index: number) => (\n <IconButton\n {...getActionProps(action, sanitizedRow)}\n key={index}\n appearance=\"discrete\"\n icon={typeof action.icon === 'function' ? action.icon(sanitizedRow) : action.icon}\n tooltip={\n typeof action.tooltip === 'function' ? action.tooltip(sanitizedRow) : action.tooltip\n }\n />\n ))}\n {secondaryActions.length ? (\n <Menu>\n <Menu.Trigger>\n <IconButton\n appearance=\"discrete\"\n icon=\"ellipsis-vertical\"\n aria-label={texts.table.actions}\n tooltip={texts.table.actions}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n row.setActive();\n }}\n />\n </Menu.Trigger>\n <Menu.Content>\n {secondaryActions.map((action: RowAction<T>, index: number) => (\n <Menu.Item\n key={index}\n icon={\n typeof action.icon === 'function'\n ? action.icon(sanitizedRow)\n : action.icon\n }\n {...getActionProps(action, sanitizedRow)}>\n {typeof action.text === 'function' ? action.text(sanitizedRow) : action.text}\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu>\n ) : null}\n </>\n );\n\n if (windowed) {\n return <div className={actionGroupClassName}>{output}</div>;\n }\n\n return (\n <InView rootMargin=\"100px 0px\">\n {({ inView, ref }) => (\n <div className={actionGroupClassName} ref={ref}>\n {inView ? output : null}\n </div>\n )}\n </InView>\n );\n },\n },\n ]);\n }\n };\n plugin.pluginName = 'useRowActions';\n return plugin;\n};\n"],"names":["actionGroupClassName","hasActions","inlineEditingUniqueId","handlers","actions","onRowCreate","onRowCopy","onRowDelete","onRowEdit","getActions","row","undefined","primary","secondary","visibleActions","filter","x","action","visible","forEach","showOnRow","push","getLength","primaryActions","secondaryActions","length","getActionProps","tooltip","disabled","onClick","event","EditModeActions","React","useEffect","listener","key","_event$target","target","_event$target$form","form","reset","preventDefault","document","addEventListener","removeEventListener","className","IconButton","appearance","icon","type","useRowActions","rowExpansionRenderer","texts","windowed","inlineEditing","actionsLength","plugin","hooks","visibleColumns","columns","id","flex","Cell","isEditing","sanitizedRow","sanitizeRowProps","output","table","newSubRow","canEdit","stopPropagation","persist","setActive","isExpanded","toggleRowExpanded","edit","toggleRowEditing","copy","del","map","index","Menu","Trigger","Content","Item","text","InView","rootMargin","inView","ref","pluginName"],"mappings":";;;;;;AASA,MAAMA,oBAAoB,GAAG,sBAAsB;AAEnD,MAAMC,UAAU,GAAGA,CAACC,qBAA0B,EAAEC,QAAa,EAAEC,OAA4C;EACvG,OACI,CAAC,CAACA,OAAO,IACTD,QAAQ,CAACE,WAAW,IACpBF,QAAQ,CAACG,SAAS,IAClBH,QAAQ,CAACI,WAAW,IACpB,CAAC,CAACL,qBAAqB,IACvBC,QAAQ,CAACK,SAAS;AAE1B,CAAC;AAED,MAAMC,UAAU,GAAGA,CACfL,OAA4C,EAC5CM,MAAuCC,SAAS;EAEhD,MAAMC,OAAO,GAAqB,EAAE;EACpC,MAAMC,SAAS,GAAqB,EAAE;EAEtC,IAAIT,OAAO,EAAE;IACT,IAAIU,cAAc,GAAGV,OAAO,CAACW,MAAM,CAACC,CAAC,IAAI,CAAC,CAACA,CAAC,IAAI,OAAOA,CAAC,KAAK,SAAS,CAAqB;IAE3F,IAAIN,GAAG,EAAE;MACLI,cAAc,GAAGA,cAAc,CAACC,MAAM,CAACE,MAAM;QACzC,IAAIA,MAAM,CAACC,OAAO,KAAKP,SAAS,EAAE;UAC9B,IAAI,OAAOM,MAAM,CAACC,OAAO,KAAK,UAAU,EAAE;YACtC,OAAOD,MAAM,CAACC,OAAO,CAACR,GAAG,CAAC;;UAG9B,OAAOO,MAAM,CAACC,OAAO;;QAGzB,OAAO,IAAI;OACd,CAAC;;IAGNJ,cAAc,CAACK,OAAO,CAACF,MAAM;MACzB,IAAIA,MAAM,CAACG,SAAS,EAAE;QAClBR,OAAO,CAACS,IAAI,CAACJ,MAAM,CAAC;OACvB,MAAM;QACHJ,SAAS,CAACQ,IAAI,CAACJ,MAAM,CAAC;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E,IAAI,CACpE,CACf,CAAC,CACS,CACZ,IACP,IAAI,CAEf;UAED,IAAIhC,QAAQ,EAAE;YACV,oBAAOrB;cAAKa,SAAS,EAAE7C;eAAuBkE,MAAM,CAAO;;UAG/D,oBACIlC,6BAACsD,MAAM;YAACC,UAAU,EAAC;aACd,CAAC;YAAEC,MAAM;YAAEC;WAAK,oBACbzD;YAAKa,SAAS,EAAE7C,oBAAoB;YAAEyF,GAAG,EAAEA;aACtCD,MAAM,GAAGtB,MAAM,GAAG,IAAI,CACrB,CACT,CACI;;OAGpB,CACJ,CAAC;;GAET;EACDV,MAAM,CAACkC,UAAU,GAAG,eAAe;EACnC,OAAOlC,MAAM;AACjB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useRowCreation.js","sources":["../../../../../../../../src/components/Table/hooks/useRowCreation.tsx"],"sourcesContent":["import React from 'react';\nimport { v4 as uuid } from 'uuid';\nimport set from 'lodash/set';\nimport unset from 'lodash/unset';\nimport get from 'lodash/get';\nimport compact from 'lodash/compact';\nimport pullAt from 'lodash/pullAt';\n\nimport { convertRowIndexPathToNumberArray, getByRowIndexPath, getParentRowIndexPath } from '../util/rowIndexPath';\nimport { Row, RowIndexPath, TableRef } from '../types';\n\nexport const insertChildTableRow = <TRow,>(\n data: Row<TRow>[],\n rowIndexPath: RowIndexPath = undefined,\n values: any = {}\n): [Row<TRow>[], RowIndexPath] => {\n const nexTRow: Row<TRow>[] = JSON.parse(JSON.stringify(data));\n\n let childRowIndexPath;\n\n if (rowIndexPath) {\n const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);\n const currentRow = getByRowIndexPath(nexTRow, rowIndexes.join('.'));\n const nextSubRows = currentRow?.subRows ?? [];\n\n const path = rowIndexes.map(i => `[${i}]`).join('.subRows') + '.subRows';\n nextSubRows.unshift(values);\n set(nexTRow, path, nextSubRows);\n\n // rebuild the new id\n rowIndexes.push(0);\n childRowIndexPath = rowIndexes.join('.');\n } else {\n nexTRow.unshift(values);\n childRowIndexPath = '0';\n }\n\n return [nexTRow, childRowIndexPath];\n};\n\nexport const removeChildTableRow = <TRow,>(data: Row<TRow>[], rowIndexPath: RowIndexPath): Row<TRow>[] => {\n const nexTRow = JSON.parse(JSON.stringify(data));\n\n const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);\n const rootIndex = Number(rowIndexes.shift());\n\n if (rowIndexes.length) {\n // unset\n const unsetPath = rowIndexes.map(index => `subRows[${index}]`).join('.');\n unset(nexTRow[rootIndex], unsetPath);\n\n // remove empty value from subRows\n rowIndexes.pop();\n const setPath = rowIndexes.length ? rowIndexes.map(index => `subRows[${index}]`).join('.') + '.subRows' : 'subRows';\n set(nexTRow[rootIndex], setPath, compact(get(nexTRow[rootIndex], setPath)));\n } else {\n pullAt(nexTRow, rootIndex);\n }\n\n return nexTRow;\n};\n\nexport type useTableRowCreation<TRow> = {\n data: Row<TRow>[];\n create: (rowIndexPath: RowIndexPath, values?: object | undefined) => RowIndexPath;\n remove: (rowIndexPath: RowIndexPath) => void;\n isCreating: boolean;\n};\n\nexport const useTableRowCreation = <TRow,>(data: Row<TRow>[], tableRef: React.RefObject<TableRef>): useTableRowCreation<TRow> => {\n const [internalData, setInternalData] = React.useState(JSON.parse(JSON.stringify(data)));\n const [activeRowIndexPath, setActiveRowIndexPath] = React.useState<string | undefined>(undefined);\n\n React.useEffect(() => {\n if (activeRowIndexPath !== undefined) {\n // keep the same edit key, so that we don't remount the row/form\n const currentRow: any = getByRowIndexPath(internalData, activeRowIndexPath);\n\n // get the active creation rows parent\n const parentId = getParentRowIndexPath(activeRowIndexPath);\n\n // insert a new empty row in the external data (with the same key)\n const [nexTRow, newRowIndexPath] = insertChildTableRow(JSON.parse(JSON.stringify(data)), parentId, currentRow);\n\n // update and set that row as active, we basically just changed it's position in our internal data\n setActiveRowIndexPath(newRowIndexPath);\n setInternalData(nexTRow);\n\n if (tableRef?.current) {\n tableRef.current.instance.toggleRowEditing(currentRow?._createKey);\n }\n } else {\n setInternalData(data);\n }\n }, [JSON.stringify(data)]);\n\n const create = (rowIndexPath: RowIndexPath = undefined, values: object | undefined = {}): RowIndexPath => {\n const _createKey = uuid();\n const [nexTRow, newRowIndexPath] = insertChildTableRow(internalData, rowIndexPath, { ...values, _createKey });\n setActiveRowIndexPath(newRowIndexPath);\n setInternalData(nexTRow);\n\n if (tableRef?.current) {\n tableRef.current.instance.toggleRowEditing(_createKey);\n }\n\n return newRowIndexPath;\n };\n\n const remove = (rowIndexPath: any): void => {\n const nexTRow = removeChildTableRow(internalData, rowIndexPath);\n setInternalData(nexTRow);\n setActiveRowIndexPath(undefined);\n };\n\n return {\n data: internalData,\n create,\n remove,\n isCreating: activeRowIndexPath !== undefined,\n };\n};\n"],"names":["insertChildTableRow","data","rowIndexPath","undefined","values","nexTRow","JSON","parse","stringify","childRowIndexPath","_currentRow$subRows","rowIndexes","convertRowIndexPathToNumberArray","currentRow","getByRowIndexPath","join","nextSubRows","subRows","path","map","i","unshift","set","push","removeChildTableRow","rootIndex","Number","shift","length","unsetPath","index","unset","pop","setPath","compact","get","pullAt","useTableRowCreation","tableRef","internalData","setInternalData","React","useState","activeRowIndexPath","setActiveRowIndexPath","useEffect","parentId","getParentRowIndexPath","newRowIndexPath","current","instance","toggleRowEditing","_createKey","create","uuid","remove","isCreating"],"mappings":";;;;;;;;;MAWaA,mBAAmB,GAAGA,CAC/BC,IAAiB,EACjBC,eAA6BC,SAAS,EACtCC,SAAc,EAAE;EAEhB,MAAMC,OAAO,GAAgBC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,SAAS,CAACP,IAAI,CAAC,CAAC;EAE7D,IAAIQ,iBAAiB;EAErB,IAAIP,YAAY,EAAE;IAAA,IAAAQ,mBAAA;IACd,MAAMC,UAAU,GAAGC,gCAAgC,CAACV,YAAY,CAAC;IACjE,MAAMW,UAAU,GAAGC,iBAAiB,CAACT,OAAO,EAAEM,UAAU,CAACI,IAAI,CAAC,GAAG,CAAC,CAAC;IACnE,MAAMC,WAAW,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,eAAe,CAACvC,IAAI,CAAC;;GAE5B,EAAE,CAACK,IAAI,CAACE,SAAS,CAACP,IAAI,CAAC,CAAC,CAAC;EAE1B,MAAMoD,MAAM,GAAGA,CAACnD,eAA6BC,SAAS,EAAEC,SAA6B,EAAE;IACnF,MAAMgD,UAAU,GAAGE,EAAI,EAAE;IACzB,MAAM,CAACjD,OAAO,EAAE2C,eAAe,CAAC,GAAGhD,mBAAmB,CAACuC,YAAY,EAAErC,YAAY,EAAE;MAAE,GAAGE,MAAM;MAAEgD;KAAY,CAAC;IAC7GR,qBAAqB,CAACI,eAAe,CAAC;IACtCR,eAAe,CAACnC,OAAO,CAAC;IAExB,IAAIiC,QAAQ,aAARA,QAAQ,eAARA,QAAQ,CAAEW,OAAO,EAAE;MACnBX,QAAQ,CAACW,OAAO,CAACC,QAAQ,CAACC,gBAAgB,CAACC,UAAU,CAAC;;IAG1D,OAAOJ,eAAe;GACzB;EAED,MAAMO,MAAM,GAAIrD,YAAiB;IAC7B,MAAMG,OAAO,GAAGmB,mBAAmB,CAACe,YAAY,EAAErC,YAAY,CAAC;IAC/DsC,eAAe,CAACnC,OAAO,CAAC;IACxBuC,qBAAqB,CAACzC,SAAS,CAAC;GACnC;EAED,OAAO;IACHF,IAAI,EAAEsC,YAAY;IAClBc,MAAM;IACNE,MAAM;IACNC,UAAU,EAAEb,kBAAkB,KAAKxC;GACtC;AACL;;;;"}
1
+ {"version":3,"file":"useRowCreation.js","sources":["../../../../../../../../src/components/Table/hooks/useRowCreation.tsx"],"sourcesContent":["import React from 'react';\nimport { v4 as uuid } from 'uuid';\nimport set from 'lodash/set';\nimport unset from 'lodash/unset';\nimport get from 'lodash/get';\nimport compact from 'lodash/compact';\nimport pullAt from 'lodash/pullAt';\n\nimport { convertRowIndexPathToNumberArray, getByRowIndexPath, getParentRowIndexPath } from '../util/rowIndexPath';\nimport { Row, RowIndexPath, LegacyTableRef } from '../types';\n\nexport const insertChildTableRow = <TRow,>(\n data: Row<TRow>[],\n rowIndexPath: RowIndexPath = undefined,\n values: any = {}\n): [Row<TRow>[], RowIndexPath] => {\n const nexTRow: Row<TRow>[] = JSON.parse(JSON.stringify(data));\n\n let childRowIndexPath;\n\n if (rowIndexPath) {\n const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);\n const currentRow = getByRowIndexPath(nexTRow, rowIndexes.join('.'));\n const nextSubRows = currentRow?.subRows ?? [];\n\n const path = rowIndexes.map(i => `[${i}]`).join('.subRows') + '.subRows';\n nextSubRows.unshift(values);\n set(nexTRow, path, nextSubRows);\n\n // rebuild the new id\n rowIndexes.push(0);\n childRowIndexPath = rowIndexes.join('.');\n } else {\n nexTRow.unshift(values);\n childRowIndexPath = '0';\n }\n\n return [nexTRow, childRowIndexPath];\n};\n\nexport const removeChildTableRow = <TRow,>(data: Row<TRow>[], rowIndexPath: RowIndexPath): Row<TRow>[] => {\n const nexTRow = JSON.parse(JSON.stringify(data));\n\n const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);\n const rootIndex = Number(rowIndexes.shift());\n\n if (rowIndexes.length) {\n // unset\n const unsetPath = rowIndexes.map(index => `subRows[${index}]`).join('.');\n unset(nexTRow[rootIndex], unsetPath);\n\n // remove empty value from subRows\n rowIndexes.pop();\n const setPath = rowIndexes.length ? rowIndexes.map(index => `subRows[${index}]`).join('.') + '.subRows' : 'subRows';\n set(nexTRow[rootIndex], setPath, compact(get(nexTRow[rootIndex], setPath)));\n } else {\n pullAt(nexTRow, rootIndex);\n }\n\n return nexTRow;\n};\n\nexport type useTableRowCreation<TRow> = {\n data: Row<TRow>[];\n create: (rowIndexPath: RowIndexPath, values?: object | undefined) => RowIndexPath;\n remove: (rowIndexPath: RowIndexPath) => void;\n isCreating: boolean;\n};\n\nexport const useTableRowCreation = <TRow,>(\n data: Row<TRow>[],\n tableRef: React.RefObject<LegacyTableRef>\n): useTableRowCreation<TRow> => {\n const [internalData, setInternalData] = React.useState(JSON.parse(JSON.stringify(data)));\n const [activeRowIndexPath, setActiveRowIndexPath] = React.useState<string | undefined>(undefined);\n\n React.useEffect(() => {\n if (activeRowIndexPath !== undefined) {\n // keep the same edit key, so that we don't remount the row/form\n const currentRow: any = getByRowIndexPath(internalData, activeRowIndexPath);\n\n // get the active creation rows parent\n const parentId = getParentRowIndexPath(activeRowIndexPath);\n\n // insert a new empty row in the external data (with the same key)\n const [nexTRow, newRowIndexPath] = insertChildTableRow(JSON.parse(JSON.stringify(data)), parentId, currentRow);\n\n // update and set that row as active, we basically just changed it's position in our internal data\n setActiveRowIndexPath(newRowIndexPath);\n setInternalData(nexTRow);\n\n if (tableRef?.current) {\n tableRef.current.instance.toggleRowEditing(currentRow?._createKey);\n }\n } else {\n setInternalData(data);\n }\n }, [JSON.stringify(data)]);\n\n const create = (rowIndexPath: RowIndexPath = undefined, values: object | undefined = {}): RowIndexPath => {\n const _createKey = uuid();\n const [nexTRow, newRowIndexPath] = insertChildTableRow(internalData, rowIndexPath, { ...values, _createKey });\n setActiveRowIndexPath(newRowIndexPath);\n setInternalData(nexTRow);\n\n if (tableRef?.current) {\n tableRef.current.instance.toggleRowEditing(_createKey);\n }\n\n return newRowIndexPath;\n };\n\n const remove = (rowIndexPath: any): void => {\n const nexTRow = removeChildTableRow(internalData, rowIndexPath);\n setInternalData(nexTRow);\n setActiveRowIndexPath(undefined);\n };\n\n return {\n data: internalData,\n create,\n remove,\n isCreating: activeRowIndexPath !== undefined,\n };\n};\n"],"names":["insertChildTableRow","data","rowIndexPath","undefined","values","nexTRow","JSON","parse","stringify","childRowIndexPath","_currentRow$subRows","rowIndexes","convertRowIndexPathToNumberArray","currentRow","getByRowIndexPath","join","nextSubRows","subRows","path","map","i","unshift","set","push","removeChildTableRow","rootIndex","Number","shift","length","unsetPath","index","unset","pop","setPath","compact","get","pullAt","useTableRowCreation","tableRef","internalData","setInternalData","React","useState","activeRowIndexPath","setActiveRowIndexPath","useEffect","parentId","getParentRowIndexPath","newRowIndexPath","current","instance","toggleRowEditing","_createKey","create","uuid","rem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;IAClBc,MAAM;IACNE,MAAM;IACNC,UAAU,EAAEb,kBAAkB,KAAKxC;GACtC;AACL;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTable.js","sources":["../../../../../../../../src/components/Table/hooks/useTable.tsx"],"sourcesContent":["import React from 'react';\nimport { useTable as useReactTable, useExpanded, useSortBy, usePagination, useRowState } from 'react-table';\nimport { getColumnsFromChildren, getInternalSortRules } from '../util';\nimport { sortTypes } from '../util/sortTypes';\nimport { useRowEditing } from './plugins/useRowEditing';\nimport { useRowActions } from './plugins/useRowActions';\nimport { useRowSelect } from './plugins/useRowSelect';\nimport {\n InternalTable,\n InternalTableRow,\n PaginationHandler,\n RowActiveHandler,\n SortHandler,\n TableProps,\n TableRef,\n} from '../types';\nimport { useTableKeyboardNavigation } from './useTableKeyboardNavigation';\nimport { useLocalization } from '../../Provider/Localization';\nimport { useRowDraggable } from './plugins/useRowDraggable';\nimport { sanitizeRowProps } from '../util';\n\nconst useTableRowActive = (\n activeIndex: number | undefined,\n rows: InternalTableRow[],\n rowExpansionRenderer: TableProps<any>['rowExpansionRenderer'],\n handleonRowActive: RowActiveHandler<any> | undefined\n) => {\n React.useEffect(() => {\n if (activeIndex !== undefined && rows.length && handleonRowActive) {\n const focusedRow = rows[activeIndex];\n if (focusedRow) {\n const sanitizedFocusedRow = sanitizeRowProps(focusedRow, rowExpansionRenderer);\n handleonRowActive(sanitizedFocusedRow);\n }\n }\n }, [activeIndex, rows]);\n};\n\nconst useTableInstance = (instance: any, ref: React.RefObject<TableRef>): object => {\n const sanitizedInstance = React.useMemo(\n () => ({\n toggleAllRowsExpanded: instance.toggleAllRowsExpanded,\n toggleHideAllColumns: instance.toggleHideAllColumns,\n toggleHideColumn: instance.toggleHideColumn,\n toggleEditing: instance.toggleEditing,\n toggleRowEditing: instance.toggleRowEditing,\n resetRowEditing: instance.resetRowEditing,\n toggleRowExpanded: instance.toggleRowExpanded,\n toggleSortBy: instance.toggleSortBy,\n }),\n []\n );\n\n React.useEffect(() => {\n if (ref?.current) {\n ref.current.instance = sanitizedInstance;\n }\n }, [ref]);\n\n return sanitizedInstance;\n};\n\nconst useTablePaginationListener = (disablePagination: boolean, onPaginate: PaginationHandler | undefined, state: any): void => {\n React.useEffect(() => {\n if (!disablePagination && onPaginate) {\n onPaginate(state.pageIndex, state.pageSize);\n }\n }, [state.pageIndex, state.pageSize]);\n};\n\nconst useTableSortingListener = (\n data: any[],\n sortedRows: any[],\n onSort: SortHandler<any> | undefined,\n manualSorting: boolean,\n state: any\n): void => {\n React.useEffect(() => {\n if (onSort) {\n const sortRules = state.sortBy.map((rule: any) => ({ accessor: rule.id, desc: rule.desc }));\n\n if (manualSorting) {\n onSort(sortRules);\n } else {\n let sortedData;\n\n if (sortRules.length && sortedRows?.length) {\n sortedData = sortedRows.map((row: any) => row.original);\n }\n\n onSort(sortRules, sortedData || data);\n }\n }\n }, [onSort && JSON.stringify(state.sortBy), manualSorting]);\n};\n\nconst DEFAULT_PAGE_SIZE = 10;\n\nexport const useTable = <T extends {}>(\n props: TableProps<T> & { windowed?: boolean },\n ref: React.RefObject<TableRef>\n): InternalTable => {\n const {\n children,\n data,\n dangerouslyHijackGlobalKeyboardNavigation: _,\n onRowClick,\n onRowDrag,\n onSelectedRows,\n rowClassName,\n rowExpansionRenderer,\n rowHeight,\n selectedRows,\n\n // sorting\n disableSorting,\n manualSorting,\n onSort,\n sortRules,\n\n //index\n activeIndex: _1,\n defaultActiveIndex: _2,\n onChangeActiveIndex: _3,\n\n // pagination\n disablePagination = true,\n length,\n onPaginate,\n pageSize = DEFAULT_PAGE_SIZE,\n pageIndex = 0,\n\n // row editing\n inlineEditingUniqueId = undefined,\n onRowCreate,\n\n // actions\n actions,\n onRowEdit,\n onRowCopy,\n onRowDelete,\n onRowActive,\n\n windowed = false,\n\n ...otherProps\n } = props;\n\n if ((onSelectedRows && !selectedRows) || (!onSelectedRows && selectedRows)) {\n throw new Error(\n 'Selected rows in a Table component are fully controlled - you must pass both the `onSelectedRows` and `selectedRows` props when using row selection'\n );\n }\n\n const { texts, locale } = useLocalization();\n const { columns, sortRules: defaultSortRules } = React.useMemo(\n () => getColumnsFromChildren(children, rowExpansionRenderer),\n [children, rowExpansionRenderer]\n );\n\n const manualPagination = !disablePagination && !!onPaginate && !!length;\n\n const {\n headerGroups,\n rows,\n sortedRows,\n prepareRow: prepareBaseRow,\n state,\n // pagination\n page,\n gotoPage,\n setPageSize,\n ...instance\n }: any = useReactTable(\n {\n columns,\n data,\n initialState: {\n // @ts-expect-error: not sure how to type this correctly right now\n sortBy: getInternalSortRules(sortRules) || defaultSortRules,\n pageSize: !disablePagination ? pageSize : undefined,\n pageIndex: !disablePagination ? pageIndex : undefined,\n },\n manualPagination,\n pageCount: manualPagination && length ? Math.ceil(length / pageSize) : -1,\n manualSortBy: manualSorting,\n disableSortBy: disableSorting,\n // most of these resets preventions are needed for editing mode\n autoResetExpanded: false,\n autoResetSelectedRows: false,\n autoResetSortBy: false,\n autoResetPage: false,\n sortTypes: React.useMemo(() => sortTypes(locale), []),\n useControlledState: currentState => {\n return React.useMemo(\n () => ({\n ...currentState,\n selectedRowIds: selectedRows || [],\n }),\n [currentState, selectedRows]\n );\n },\n },\n useRowState,\n useSortBy,\n useExpanded,\n usePagination,\n useRowSelect(onSelectedRows),\n useRowDraggable(onRowDrag),\n useRowEditing(inlineEditingUniqueId),\n useRowActions(\n inlineEditingUniqueId,\n { onRowCreate, onRowEdit, onRowCopy, onRowDelete },\n actions,\n rowExpansionRenderer,\n texts,\n windowed\n )\n );\n\n useTablePaginationListener(disablePagination, onPaginate, state);\n useTableSortingListener(data, sortedRows, onSort, !!manualSorting, state);\n\n const sanitizedInstance = useTableInstance(instance, ref);\n\n const visibleRows = !disablePagination && !manualPagination ? page : rows;\n\n const [activeIndex, setActiveIndex, handleKeyDown, handleFocus] = useTableKeyboardNavigation<T>(\n props,\n visibleRows,\n { onRowClick, onRowCreate, onRowEdit, onRowCopy, onRowDelete, rowExpansionRenderer },\n ref\n );\n\n useTableRowActive(activeIndex, rows, rowExpansionRenderer, onRowActive);\n\n const prepareRow = React.useCallback(\n (row: any, index: number) => {\n prepareBaseRow(row);\n row.setActive = () => setActiveIndex(index);\n },\n [prepareBaseRow, setActiveIndex]\n );\n\n return {\n rowProps: {\n activeIndex,\n setActiveIndex,\n onRowClick,\n rowClassName,\n rowExpansionRenderer,\n rowHeight,\n inlineEditingUniqueId,\n },\n tableProps: {\n ...otherProps,\n headerGroups,\n onFocus: handleFocus,\n onKeyDown: handleKeyDown,\n tabIndex: otherProps.tabIndex ?? 0,\n },\n state,\n pagination: !disablePagination\n ? {\n length: manualPagination && length ? length : data.length,\n pageIndex: state.pageIndex,\n pageSize: state.pageSize,\n setPageIndex: gotoPage,\n setPageSize: setPageSize,\n }\n : null,\n rows: visibleRows,\n prepareRow,\n instance: sanitizedInstance,\n };\n};\n"],"names":["useTableRowActive","activeIndex","rows","rowExpansionRenderer","handleonRowActive","React","useEffect","undefined","length","focusedRow","sanitizedFocusedRow","sanitizeRowProps","useTableInstance","instance","ref","sanitizedInstance","useMemo","toggleAllRowsExpanded","toggleHideAllColumns","toggleHideColumn","toggleEditing","toggleRowEditing","resetRowEditing","toggleRowExpanded","toggleSortBy","current","useTablePaginationListener","disablePagination","onPaginate","state","pageIndex","pageSize","useTableSortingListener","data","sortedRows","onSort","manualSorting","sortRules","sortBy","map","rule","accessor","id","desc","sortedData","row","original","JSON","stringify","DEFAULT_PAGE_SIZE","useTable","props","children","dangerouslyHijackGlobalKeyboardNavigation","_","onRowClick","onRowDrag","onSelectedRows","rowClassName","rowHeight","selectedRows","disableSorting","_1","defaultActiveIndex","_2","onChangeActiveIndex","_3","inlineEditingUniqueId","onRowCreate","actions","onRowEdit","onRowCopy","onRowDelete","onRowActive","windowed","otherProps","Error","texts","locale","useLocalization","columns","defaultSortRules","getColumnsFromChildren","manualPagination","headerGroups","prepareRow","prepareBaseRow","page","gotoPage","setPageSize","useReactTable","initialState","getInternalSortRules","pageCount","Math","ceil","manualSortBy","disableSortBy","autoResetExpanded","autoResetSelectedRows","autoResetSortBy","autoResetPage","sortTypes","useControlledState","currentState","selectedRowIds","useRowState","useSortBy","useExpanded","usePagination","useRowSelect","useRowDraggable","useRowEditing","useRowActions","visibleRows","setActiveIndex","handleKeyDown","handleFocus","useTableKeyboardNavigation","useCallback","index","setActive","rowProps","tableProps","onFocus","onKeyDown","tabIndex","_otherProps$tabIndex","pagination","setPageIndex"],"mappings":";;;;;;;;;;;AAqBA,MAAMA,iBAAiB,GAAGA,CACtBC,WAA+B,EAC/BC,IAAwB,EACxBC,oBAA6D,EAC7DC,iBAAoD;EAEpDC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIL,WAAW,KAAKM,SAAS,IAAIL,IAAI,CAACM,MAAM,IAAIJ,iBAAiB,EAAE;MAC/D,MAAMK,UAAU,GAAGP,IAAI,CAACD,WAAW,CAAC;MACpC,IAAIQ,UAAU,EAAE;QACZ,MAAMC,mBAAmB,GAAGC,gBAAgB,CAACF,UAAU,EAAEN,oBAAoB,CAAC;QAC9EC,iBAAiB,CAACM,mBAAmB,CAAC;;;GAGjD,EAAE,CAACT,WAAW,EAAEC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,MAAMU,gBAAgB,GAAGA,CAACC,QAAa,EAAEC,GAA8B;EACnE,MAAMC,iBAAiB,GAAGV,cAAK,CAACW,OAAO,CACnC,OAAO;IACHC,qBAAqB,EAAEJ,QAAQ,CAACI,qBAAqB;IACrDC,oBAAoB,EAAEL,QAAQ,CAACK,oBAAoB;IACnDC,gBAAgB,EAAEN,QAAQ,CAACM,gBAAgB;IAC3CC,aAAa,EAAEP,QAAQ,CAACO,aAAa;IACrCC,gBAAgB,EAAER,QAAQ,CAACQ,gBAAgB;IAC3CC,eAAe,EAAET,QAAQ,CAACS,eAAe;IACzCC,iBAAiB,EAAEV,QAAQ,CAACU,iBAAiB;IAC7CC,YAAY,EAAEX,QAAQ,CAACW;GAC1B,CAAC,EACF,EA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C,oBAAA,cAAAA,oBAAA,GAAI;KACpC;IACDlG,KAAK;IACLmG,UAAU,EAAE,CAACrG,iBAAiB,GACxB;MACInB,MAAM,EAAE2E,gBAAgB,IAAI3E,MAAM,GAAGA,MAAM,GAAGyB,IAAI,CAACzB,MAAM;MACzDsB,SAAS,EAAED,KAAK,CAACC,SAAS;MAC1BC,QAAQ,EAAEF,KAAK,CAACE,QAAQ;MACxBkG,YAAY,EAAEzC,QAAQ;MACtBC,WAAW,EAAEA;KAChB,GACD,IAAI;IACVvF,IAAI,EAAEgH,WAAW;IACjB7B,UAAU;IACVxE,QAAQ,EAAEE;GACb;AACL;;;;"}
1
+ {"version":3,"file":"useTable.js","sources":["../../../../../../../../src/components/Table/hooks/useTable.tsx"],"sourcesContent":["import React from 'react';\nimport { useTable as useReactTable, useExpanded, useSortBy, usePagination, useRowState } from 'react-table';\nimport { getColumnsFromChildren, getInternalSortRules } from '../util';\nimport { sortTypes } from '../util/sortTypes';\nimport { useRowEditing } from './plugins/useRowEditing';\nimport { useRowActions } from './plugins/useRowActions';\nimport { useRowSelect } from './plugins/useRowSelect';\nimport {\n InternalTable,\n InternalTableRow,\n PaginationHandler,\n RowActiveHandler,\n SortHandler,\n LegacyTableProps,\n LegacyTableRef,\n} from '../types';\nimport { useTableKeyboardNavigation } from './useTableKeyboardNavigation';\nimport { useLocalization } from '../../Provider/Localization';\nimport { useRowDraggable } from './plugins/useRowDraggable';\nimport { sanitizeRowProps } from '../util';\n\nconst useTableRowActive = (\n activeIndex: number | undefined,\n rows: InternalTableRow[],\n rowExpansionRenderer: LegacyTableProps<any>['rowExpansionRenderer'],\n handleonRowActive: RowActiveHandler<any> | undefined\n) => {\n React.useEffect(() => {\n if (activeIndex !== undefined && rows.length && handleonRowActive) {\n const focusedRow = rows[activeIndex];\n if (focusedRow) {\n const sanitizedFocusedRow = sanitizeRowProps(focusedRow, rowExpansionRenderer);\n handleonRowActive(sanitizedFocusedRow);\n }\n }\n }, [activeIndex, rows]);\n};\n\nconst useTableInstance = (instance: any, ref: React.RefObject<LegacyTableRef>): object => {\n const sanitizedInstance = React.useMemo(\n () => ({\n toggleAllRowsExpanded: instance.toggleAllRowsExpanded,\n toggleHideAllColumns: instance.toggleHideAllColumns,\n toggleHideColumn: instance.toggleHideColumn,\n toggleEditing: instance.toggleEditing,\n toggleRowEditing: instance.toggleRowEditing,\n resetRowEditing: instance.resetRowEditing,\n toggleRowExpanded: instance.toggleRowExpanded,\n toggleSortBy: instance.toggleSortBy,\n }),\n []\n );\n\n React.useEffect(() => {\n if (ref?.current) {\n ref.current.instance = sanitizedInstance;\n }\n }, [ref]);\n\n return sanitizedInstance;\n};\n\nconst useTablePaginationListener = (disablePagination: boolean, onPaginate: PaginationHandler | undefined, state: any): void => {\n React.useEffect(() => {\n if (!disablePagination && onPaginate) {\n onPaginate(state.pageIndex, state.pageSize);\n }\n }, [state.pageIndex, state.pageSize]);\n};\n\nconst useTableSortingListener = (\n data: any[],\n sortedRows: any[],\n onSort: SortHandler<any> | undefined,\n manualSorting: boolean,\n state: any\n): void => {\n React.useEffect(() => {\n if (onSort) {\n const sortRules = state.sortBy.map((rule: any) => ({ accessor: rule.id, desc: rule.desc }));\n\n if (manualSorting) {\n onSort(sortRules);\n } else {\n let sortedData;\n\n if (sortRules.length && sortedRows?.length) {\n sortedData = sortedRows.map((row: any) => row.original);\n }\n\n onSort(sortRules, sortedData || data);\n }\n }\n }, [onSort && JSON.stringify(state.sortBy), manualSorting]);\n};\n\nconst DEFAULT_PAGE_SIZE = 10;\n\nexport const useTable = <T extends {}>(\n props: LegacyTableProps<T> & { windowed?: boolean },\n ref: React.RefObject<LegacyTableRef>\n): InternalTable => {\n const {\n children,\n data,\n dangerouslyHijackGlobalKeyboardNavigation: _,\n onRowClick,\n onRowDrag,\n onSelectedRows,\n rowClassName,\n rowExpansionRenderer,\n rowHeight,\n selectedRows,\n\n // sorting\n disableSorting,\n manualSorting,\n onSort,\n sortRules,\n\n //index\n activeIndex: _1,\n defaultActiveIndex: _2,\n onChangeActiveIndex: _3,\n\n // pagination\n disablePagination = true,\n length,\n onPaginate,\n pageSize = DEFAULT_PAGE_SIZE,\n pageIndex = 0,\n\n // row editing\n inlineEditingUniqueId = undefined,\n onRowCreate,\n\n // actions\n actions,\n onRowEdit,\n onRowCopy,\n onRowDelete,\n onRowActive,\n\n windowed = false,\n\n ...otherProps\n } = props;\n\n if ((onSelectedRows && !selectedRows) || (!onSelectedRows && selectedRows)) {\n throw new Error(\n 'Selected rows in a Table component are fully controlled - you must pass both the `onSelectedRows` and `selectedRows` props when using row selection'\n );\n }\n\n const { texts, locale } = useLocalization();\n const { columns, sortRules: defaultSortRules } = React.useMemo(\n () => getColumnsFromChildren(children, rowExpansionRenderer),\n [children, rowExpansionRenderer]\n );\n\n const manualPagination = !disablePagination && !!onPaginate && !!length;\n\n const {\n headerGroups,\n rows,\n sortedRows,\n prepareRow: prepareBaseRow,\n state,\n // pagination\n page,\n gotoPage,\n setPageSize,\n ...instance\n }: any = useReactTable(\n {\n columns,\n data,\n initialState: {\n // @ts-expect-error: not sure how to type this correctly right now\n sortBy: getInternalSortRules(sortRules) || defaultSortRules,\n pageSize: !disablePagination ? pageSize : undefined,\n pageIndex: !disablePagination ? pageIndex : undefined,\n },\n manualPagination,\n pageCount: manualPagination && length ? Math.ceil(length / pageSize) : -1,\n manualSortBy: manualSorting,\n disableSortBy: disableSorting,\n // most of these resets preventions are needed for editing mode\n autoResetExpanded: false,\n autoResetSelectedRows: false,\n autoResetSortBy: false,\n autoResetPage: false,\n sortTypes: React.useMemo(() => sortTypes(locale), []),\n useControlledState: currentState => {\n return React.useMemo(\n () => ({\n ...currentState,\n selectedRowIds: selectedRows || [],\n }),\n [currentState, selectedRows]\n );\n },\n },\n useRowState,\n useSortBy,\n useExpanded,\n usePagination,\n useRowSelect(onSelectedRows),\n useRowDraggable(onRowDrag),\n useRowEditing(inlineEditingUniqueId),\n useRowActions(\n inlineEditingUniqueId,\n { onRowCreate, onRowEdit, onRowCopy, onRowDelete },\n actions,\n rowExpansionRenderer,\n texts,\n windowed\n )\n );\n\n useTablePaginationListener(disablePagination, onPaginate, state);\n useTableSortingListener(data, sortedRows, onSort, !!manualSorting, state);\n\n const sanitizedInstance = useTableInstance(instance, ref);\n\n const visibleRows = !disablePagination && !manualPagination ? page : rows;\n\n const [activeIndex, setActiveIndex, handleKeyDown, handleFocus] = useTableKeyboardNavigation<T>(\n props,\n visibleRows,\n { onRowClick, onRowCreate, onRowEdit, onRowCopy, onRowDelete, rowExpansionRenderer },\n ref\n );\n\n useTableRowActive(activeIndex, rows, rowExpansionRenderer, onRowActive);\n\n const prepareRow = React.useCallback(\n (row: any, index: number) => {\n prepareBaseRow(row);\n row.setActive = () => setActiveIndex(index);\n },\n [prepareBaseRow, setActiveIndex]\n );\n\n return {\n rowProps: {\n activeIndex,\n setActiveIndex,\n onRowClick,\n rowClassName,\n rowExpansionRenderer,\n rowHeight,\n inlineEditingUniqueId,\n },\n tableProps: {\n ...otherProps,\n headerGroups,\n onFocus: handleFocus,\n onKeyDown: handleKeyDown,\n tabIndex: otherProps.tabIndex ?? 0,\n },\n state,\n pagination: !disablePagination\n ? {\n length: manualPagination && length ? length : data.length,\n pageIndex: state.pageIndex,\n pageSize: state.pageSize,\n setPageIndex: gotoPage,\n setPageSize: setPageSize,\n }\n : null,\n rows: visibleRows,\n prepareRow,\n instance: sanitizedInstance,\n };\n};\n"],"names":["useTableRowActive","activeIndex","rows","rowExpansionRenderer","handleonRowActive","React","useEffect","undefined","length","focusedRow","sanitizedFocusedRow","sanitizeRowProps","useTableInstance","instance","ref","sanitizedInstance","useMemo","toggleAllRowsExpanded","toggleHideAllColumns","toggleHideColumn","toggleEditing","toggleRowEditing","resetRowEditing","toggleRowExpanded","toggleSortBy","current","useTablePaginationListener","disablePagination","onPaginate","state","pageIndex","pageSize","useTableSortingListener","data","sortedRows","onSort","manualSorting","sortRules","sortBy","map","rule","accessor","id","desc","sortedData","row","original","JSON","stringify","DEFAULT_PAGE_SIZE","useTable","props","children","dangerouslyHijackGlobalKeyboardNavigation","_","onRowClick","onRowDrag","onSelectedRows","rowClassName","rowHeight","selectedRows","disableSorting","_1","defaultActiveIndex","_2","onChangeActiveIndex","_3","inlineEditingUniqueId","onRowCreate","actions","onRowEdit","onRowCopy","onRowDelete","onRowActive","windowed","otherProps","Error","texts","locale","useLocalization","columns","defaultSortRules","getColumnsFromChildren","manualPagination","headerGroups","prepareRow","prepareBaseRow","page","gotoPage","setPageSize","useReactTable","initialState","getInternalSortRules","pageCount","Math","ceil","manualSortBy","disableSortBy","autoResetExpanded","autoResetSelectedRows","autoResetSortBy","autoResetPage","sortTypes","useControlledState","currentState","selectedRowIds","useRowState","useSortBy","useExpanded","usePagination","useRowSelect","useRowDraggable","useRowEditing","useRowActions","visibleRows","setActiveIndex","handleKeyDown","handleFocus","useTableKeyboardNavigation","useCallback","index","setActive","rowProps","tableProps","onFocus","onKeyDown","tabIndex","_otherProps$tabIndex","pagination","setPageIndex"],"mappings":";;;;;;;;;;;AAqBA,MAAMA,iBAAiB,GAAGA,CACtBC,WAA+B,EAC/BC,IAAwB,EACxBC,oBAAmE,EACnEC,iBAAoD;EAEpDC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIL,WAAW,KAAKM,SAAS,IAAIL,IAAI,CAACM,MAAM,IAAIJ,iBAAiB,EAAE;MAC/D,MAAMK,UAAU,GAAGP,IAAI,CAACD,WAAW,CAAC;MACpC,IAAIQ,UAAU,EAAE;QACZ,MAAMC,mBAAmB,GAAGC,gBAAgB,CAACF,UAAU,EAAEN,oBAAoB,CAAC;QAC9EC,iBAAiB,CAACM,mBAAmB,CAAC;;;GAGjD,EAAE,CAACT,WAAW,EAAEC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,MAAMU,gBAAgB,GAAGA,CAACC,QAAa,EAAEC,GAAoC;EACzE,MAAMC,iBAAiB,GAAGV,cAAK,CAACW,OAAO,CACnC,OAAO;IACHC,qBAAqB,EAAEJ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,EACD,CAAClC,cAAc,EAAE6B,cAAc,CAAC,CACnC;EAED,OAAO;IACHO,QAAQ,EAAE;MACNzH,WAAW;MACXkH,cAAc;MACd5D,UAAU;MACVG,YAAY;MACZvD,oBAAoB;MACpBwD,SAAS;MACTQ;KACH;IACDwD,UAAU,EAAE;MACR,GAAGhD,UAAU;MACbS,YAAY;MACZwC,OAAO,EAAEP,WAAW;MACpBQ,SAAS,EAAET,aAAa;MACxBU,QAAQ,GAAAC,oBAAA,GAAEpD,UAAU,CAACmD,QAAQ,cAAAC,oBAAA,cAAAA,oBAAA,GAAI;KACpC;IACDlG,KAAK;IACLmG,UAAU,EAAE,CAACrG,iBAAiB,GACxB;MACInB,MAAM,EAAE2E,gBAAgB,IAAI3E,MAAM,GAAGA,MAAM,GAAGyB,IAAI,CAACzB,MAAM;MACzDsB,SAAS,EAAED,KAAK,CAACC,SAAS;MAC1BC,QAAQ,EAAEF,KAAK,CAACE,QAAQ;MACxBkG,YAAY,EAAEzC,QAAQ;MACtBC,WAAW,EAAEA;KAChB,GACD,IAAI;IACVvF,IAAI,EAAEgH,WAAW;IACjB7B,UAAU;IACVxE,QAAQ,EAAEE;GACb;AACL;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTableKeyboardNavigation.js","sources":["../../../../../../../../src/components/Table/hooks/useTableKeyboardNavigation.ts"],"sourcesContent":["import React from 'react';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { getNextIndexFromKey } from '../../../utils/hooks/useListKeyboardNavigation';\nimport { sanitizeRowProps } from '../util';\nimport { TableProps } from '../types';\n\nexport const useTableKeyboardNavigation = <T extends {}>(\n props: TableProps<T>,\n rows: any[],\n rowProps: any,\n ref: React.RefObject<HTMLDivElement>\n): [\n number | undefined,\n (index: number) => void,\n (event: React.KeyboardEvent<HTMLElement>) => void,\n (event: React.FocusEvent<HTMLElement>) => void\n] => {\n const useGlobalKeyboardNavigation = props.dangerouslyHijackGlobalKeyboardNavigation;\n\n const [activeIndex, setActiveIndex] = useControllableState<number | undefined>({\n prop: props.activeIndex,\n defaultProp:\n props.defaultActiveIndex !== undefined ? props.defaultActiveIndex : useGlobalKeyboardNavigation ? 0 : undefined,\n onChange: index => {\n if (index !== undefined) {\n props.onChangeActiveIndex?.(index);\n }\n },\n });\n\n const onKeyDown = (event: KeyboardEvent): void => {\n const isModifierKeyPressed = event.metaKey || event.ctrlKey || event.altKey || event.shiftKey;\n\n if (\n useGlobalKeyboardNavigation &&\n document.activeElement !== ref.current &&\n document.activeElement?.getAttribute('type') !== 'search' &&\n document.activeElement !== document.body &&\n document.activeElement?.getAttribute('role') !== 'dialog'\n ) {\n return;\n }\n // abort key handling if other elements inside table are focused and we don't use global keyboard navigation\n if (!useGlobalKeyboardNavigation && document.activeElement !== ref.current) {\n return;\n }\n\n if (activeIndex !== undefined) {\n const currentRow = rows[activeIndex];\n\n if (currentRow) {\n const sanitizedRow = sanitizeRowProps(currentRow, rowProps.rowExpansionRenderer);\n\n if (rowProps.onRowClick && event.key === 'Enter') {\n event.preventDefault();\n rowProps.onRowClick(sanitizedRow);\n return;\n }\n\n if (currentRow.toggleRowSelected && event.key === ' ') {\n event.preventDefault();\n currentRow.toggleRowSelected();\n return;\n }\n\n if (currentRow.toggleRowExpanded) {\n if (currentRow.isExpanded && event.key === 'ArrowLeft') {\n event.preventDefault();\n currentRow.toggleRowExpanded();\n return;\n } else if (!currentRow.isExpanded && event.key === 'ArrowRight') {\n event.preventDefault();\n currentRow.toggleRowExpanded();\n return;\n }\n }\n\n // inline editing\n if (currentRow.toggleRowEditing) {\n if (currentRow.canEdit && !currentRow.isEditing) {\n if (rowProps.onRowCreate && event.shiftKey && event.key === 'n') {\n event.preventDefault();\n\n if (!currentRow.isExpanded) {\n currentRow.toggleRowExpanded();\n }\n\n rowProps.onRowCreate(sanitizedRow, event);\n return;\n }\n\n if (event.key === 'e') {\n event.preventDefault();\n currentRow.toggleRowEditing();\n return;\n }\n }\n }\n\n if (rowProps.onRowEdit && event.key === 'e' && !isModifierKeyPressed) {\n event.preventDefault();\n rowProps.onRowEdit(sanitizedRow, event);\n return;\n }\n\n if (rowProps.onRowCopy && event.key === 'c' && !isModifierKeyPressed) {\n event.preventDefault();\n rowProps.onRowCopy(sanitizedRow, event);\n return;\n }\n\n if (rowProps.onRowDelete && event.key === 'Delete' && !isModifierKeyPressed) {\n event.preventDefault();\n rowProps.onRowDelete(sanitizedRow, event);\n return;\n }\n }\n }\n\n const nextIndex = getNextIndexFromKey(event.key, rows.length, activeIndex);\n\n if (nextIndex !== undefined) {\n event.preventDefault();\n setActiveIndex(nextIndex);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n if (!useGlobalKeyboardNavigation) {\n onKeyDown(event.nativeEvent);\n }\n };\n\n React.useEffect(() => {\n if (useGlobalKeyboardNavigation) {\n window.addEventListener('keydown', onKeyDown);\n }\n\n return () => {\n if (useGlobalKeyboardNavigation) {\n window.removeEventListener('keydown', onKeyDown);\n }\n };\n }, [onKeyDown]);\n\n const handleFocus = (): void => {\n if (activeIndex === undefined && rows.length) {\n setActiveIndex(0);\n }\n };\n\n return [activeIndex, setActiveIndex, handleKeyDown, handleFocus];\n};\n"],"names":["useTableKeyboardNavigation","props","rows","rowProps","ref","useGlobalKeyboardNavigation","dangerouslyHijackGlobalKeyboardNavigation","activeIndex","setActiveIndex","useControllableState","prop","defaultProp","defaultActiveIndex","undefined","onChange","index","_props$onChangeActive","onChangeActiveIndex","call","onKeyDown","event","isModifierKeyPressed","metaKey","ctrlKey","altKey","shiftKey","document","activeElement","current","_document$activeEleme","getAttribute","body","_document$activeEleme2","currentRow","sanitizedRow","sanitizeRowProps","rowExpansionRenderer","onRowClick","key","preventDefault","toggleRowSelected","toggleRowExpanded","isExpanded","toggleRowEditing","canEdit","isEditing","onRowCreate","onRowEdit","onRowCopy","onRowDelete","nextIndex","getNextIndexFromKey","length","handleKeyDown","nativeEvent","React","useEffect","window","addEventListener","removeEventListener","handleFocus"],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2BAA2B,EAAE;MAC7BoD,MAAM,CAACC,gBAAgB,CAAC,SAAS,EAAEvC,SAAS,CAAC;;IAGjD,OAAO;MACH,IAAId,2BAA2B,EAAE;QAC7BoD,MAAM,CAACE,mBAAmB,CAAC,SAAS,EAAExC,SAAS,CAAC;;KAEvD;GACJ,EAAE,CAACA,SAAS,CAAC,CAAC;EAEf,MAAMyC,WAAW,GAAGA;IAChB,IAAIrD,WAAW,KAAKM,SAAS,IAAIX,IAAI,CAACkD,MAAM,EAAE;MAC1C5C,cAAc,CAAC,CAAC,CAAC;;GAExB;EAED,OAAO,CAACD,WAAW,EAAEC,cAAc,EAAE6C,aAAa,EAAEO,WAAW,CAAC;AACpE;;;;"}
1
+ {"version":3,"file":"useTableKeyboardNavigation.js","sources":["../../../../../../../../src/components/Table/hooks/useTableKeyboardNavigation.ts"],"sourcesContent":["import React from 'react';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { getNextIndexFromKey } from '../../../utils/hooks/useListKeyboardNavigation';\nimport { sanitizeRowProps } from '../util';\nimport { LegacyTableProps } from '../types';\n\nexport const useTableKeyboardNavigation = <T extends {}>(\n props: LegacyTableProps<T>,\n rows: any[],\n rowProps: any,\n ref: React.RefObject<HTMLDivElement>\n): [\n number | undefined,\n (index: number) => void,\n (event: React.KeyboardEvent<HTMLElement>) => void,\n (event: React.FocusEvent<HTMLElement>) => void\n] => {\n const useGlobalKeyboardNavigation = props.dangerouslyHijackGlobalKeyboardNavigation;\n\n const [activeIndex, setActiveIndex] = useControllableState<number | undefined>({\n prop: props.activeIndex,\n defaultProp:\n props.defaultActiveIndex !== undefined ? props.defaultActiveIndex : useGlobalKeyboardNavigation ? 0 : undefined,\n onChange: index => {\n if (index !== undefined) {\n props.onChangeActiveIndex?.(index);\n }\n },\n });\n\n const onKeyDown = (event: KeyboardEvent): void => {\n const isModifierKeyPressed = event.metaKey || event.ctrlKey || event.altKey || event.shiftKey;\n\n if (\n useGlobalKeyboardNavigation &&\n document.activeElement !== ref.current &&\n document.activeElement?.getAttribute('type') !== 'search' &&\n document.activeElement !== document.body &&\n document.activeElement?.getAttribute('role') !== 'dialog'\n ) {\n return;\n }\n // abort key handling if other elements inside table are focused and we don't use global keyboard navigation\n if (!useGlobalKeyboardNavigation && document.activeElement !== ref.current) {\n return;\n }\n\n if (activeIndex !== undefined) {\n const currentRow = rows[activeIndex];\n\n if (currentRow) {\n const sanitizedRow = sanitizeRowProps(currentRow, rowProps.rowExpansionRenderer);\n\n if (rowProps.onRowClick && event.key === 'Enter') {\n event.preventDefault();\n rowProps.onRowClick(sanitizedRow);\n return;\n }\n\n if (currentRow.toggleRowSelected && event.key === ' ') {\n event.preventDefault();\n currentRow.toggleRowSelected();\n return;\n }\n\n if (currentRow.toggleRowExpanded) {\n if (currentRow.isExpanded && event.key === 'ArrowLeft') {\n event.preventDefault();\n currentRow.toggleRowExpanded();\n return;\n } else if (!currentRow.isExpanded && event.key === 'ArrowRight') {\n event.preventDefault();\n currentRow.toggleRowExpanded();\n return;\n }\n }\n\n // inline editing\n if (currentRow.toggleRowEditing) {\n if (currentRow.canEdit && !currentRow.isEditing) {\n if (rowProps.onRowCreate && event.shiftKey && event.key === 'n') {\n event.preventDefault();\n\n if (!currentRow.isExpanded) {\n currentRow.toggleRowExpanded();\n }\n\n rowProps.onRowCreate(sanitizedRow, event);\n return;\n }\n\n if (event.key === 'e') {\n event.preventDefault();\n currentRow.toggleRowEditing();\n return;\n }\n }\n }\n\n if (rowProps.onRowEdit && event.key === 'e' && !isModifierKeyPressed) {\n event.preventDefault();\n rowProps.onRowEdit(sanitizedRow, event);\n return;\n }\n\n if (rowProps.onRowCopy && event.key === 'c' && !isModifierKeyPressed) {\n event.preventDefault();\n rowProps.onRowCopy(sanitizedRow, event);\n return;\n }\n\n if (rowProps.onRowDelete && event.key === 'Delete' && !isModifierKeyPressed) {\n event.preventDefault();\n rowProps.onRowDelete(sanitizedRow, event);\n return;\n }\n }\n }\n\n const nextIndex = getNextIndexFromKey(event.key, rows.length, activeIndex);\n\n if (nextIndex !== undefined) {\n event.preventDefault();\n setActiveIndex(nextIndex);\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>): void => {\n if (!useGlobalKeyboardNavigation) {\n onKeyDown(event.nativeEvent);\n }\n };\n\n React.useEffect(() => {\n if (useGlobalKeyboardNavigation) {\n window.addEventListener('keydown', onKeyDown);\n }\n\n return () => {\n if (useGlobalKeyboardNavigation) {\n window.removeEventListener('keydown', onKeyDown);\n }\n };\n }, [onKeyDown]);\n\n const handleFocus = (): void => {\n if (activeIndex === undefined && rows.length) {\n setActiveIndex(0);\n }\n };\n\n return [activeIndex, setActiveIndex, handleKeyDown, handleFocus];\n};\n"],"names":["useTableKeyboardNavigation","props","rows","rowProps","ref","useGlobalKeyboardNavigation","dangerouslyHijackGlobalKeyboardNavigation","activeIndex","setActiveIndex","useControllableState","prop","defaultProp","defaultActiveIndex","undefined","onChange","index","_props$onChangeActive","onChangeActiveIndex","call","onKeyDown","event","isModifierKeyPressed","metaKey","ctrlKey","altKey","shiftKey","document","activeElement","current","_document$activeEleme","getAttribute","body","_document$activeEleme2","currentRow","sanitizedRow","sanitizeRowProps","rowExpansionRenderer","onRowClick","key","preventDefault","toggleRowSelected","toggleRowExpanded","isExpanded","toggleRowEditing","canEdit","isEditing","onRowCreate","onRowEdit","onRowCopy","onRowDelete","nextIndex","getNextIndexFromKey","length","handleKeyDown","nativeEvent","React","useEffect","window","addEventListener","removeEventListener","handleFocus"],"mappings":";;;;;MAMaA,0BAA0B,GAAGA,CACtCC,KAA0B,EAC1BC,IAAW,EACXC,QAAa,EACbC,GAAoC;EAOpC,MAAMC,2BAA2B,GAAGJ,KAAK,CAACK,yCAAyC;EAEnF,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGC,oBAAoB,CAAqB;IAC3EC,IAAI,EAAET,KAAK,CAACM,WAAW;IACvBI,WAAW,EACPV,KAAK,CAACW,kBAAkB,KAAKC,SAAS,GA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kD,MAAM,EAAE;MAC1C5C,cAAc,CAAC,CAAC,CAAC;;GAExB;EAED,OAAO,CAACD,WAAW,EAAEC,cAAc,EAAE6C,aAAa,EAAEO,WAAW,CAAC;AACpE;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"renderRow.js","sources":["../../../../../../../../src/components/Table/util/renderRow.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { FocusScope } from '@react-aria/focus';\nimport { InternalTableCell, TableRow } from '../types';\nimport { sanitizeRowProps } from '../util';\n\nconst renderCell = (cell: InternalTableCell, row: TableRow<any>): JSX.Element => {\n const props = {\n ...cell.getCellProps(),\n className: cn('yt-table__cell flex-1 truncate p-2 align-middle', cell.column.className, {\n 'justify-start text-left': cell.column.align === 'left',\n 'justify-end text-right': cell.column.align === 'right',\n 'text-center': !cell.column.align,\n }),\n style: {\n ...cell.column.style,\n flex: typeof cell.column.flex === 'function' ? cell.column.flex(row) : cell.column.flex,\n },\n };\n return (\n <div {...props} role=\"gridcell\" data-taco=\"table-cell\">\n {cell.render('Cell') || null}\n </div>\n );\n};\n\nexport const Row = React.forwardRef(function TableRow({ row, index, instance, headerGroups, ...rowProps }: any, ref: any) {\n const {\n activeIndex,\n onRowClick,\n rowClassName,\n rowExpansionRenderer,\n rowHeight,\n setActiveIndex,\n style,\n inlineEditingUniqueId,\n } = rowProps;\n const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);\n\n const props = {\n ...row.getRowProps(),\n style: {\n ...style,\n minHeight: rowHeight ? `${rowHeight}px` : undefined,\n paddingLeft: row.depth ? `${row.depth * 2}rem` : undefined,\n },\n className: cn(\n 'yt-table__row border-grey-300 flex border-b min-h-[2.5rem] hover:bg-grey-100',\n {\n 'yt-table__row--active bg-grey-200 hover:bg-grey-200': activeIndex === index,\n 'yt-table__row--clickable': !!onRowClick,\n 'yt-table__row--dragging': !!row.isDragging,\n 'yt-table__row--editing': !!row.isEditing,\n },\n typeof rowClassName === 'function' ? rowClassName(sanitizedRow) : rowClassName\n ),\n onClick: onRowClick\n ? (event: React.MouseEvent<HTMLElement>) => {\n if (\n event.target === event.currentTarget ||\n (event.target as HTMLElement).classList.contains('yt-table__cell')\n ) {\n event.preventDefault();\n event.persist();\n setActiveIndex(index);\n onRowClick(sanitizedRow);\n }\n }\n : () => {\n setActiveIndex(index);\n },\n };\n\n let cells = row.cells;\n\n if (row.depth > 0) {\n cells = row.cells.filter((cell: any) => !cell.column.hiddenOnSubRows);\n }\n\n const expandedRow = rowExpansionRenderer && row.isExpanded && <div>{rowExpansionRenderer(sanitizedRow, instance)}</div>;\n const rowContent = React.useMemo(() => {\n return (\n <>\n <FocusScope key={row.original._createKey} contain restoreFocus autoFocus>\n <div {...props} role=\"row\" ref={ref}>\n <input type=\"hidden\" name=\"_rowIndexPath\" value={row.id} />\n <input type=\"hidden\" name=\"_inlineEditingUniqueId\" value={row.original[inlineEditingUniqueId]} />\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\n </div>\n </FocusScope>\n {expandedRow}\n </>\n );\n }, [row.original._createKey]);\n\n if (row.isEditing) {\n return rowContent;\n }\n\n return (\n <>\n <div {...props} role=\"row\" ref={ref}>\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\n </div>\n {expandedRow}\n </>\n );\n});\n"],"names":["renderCell","cell","row","props","getCellProps","className","cn","column","align","style","flex","React","role","render","Row","forwardRef","TableRow","index","instance","headerGroups","rowProps","ref","activeIndex","onRowClick","rowClassName","rowExpansionRenderer","rowHeight","setActiveIndex","inlineEditingUniqueId","sanitizedRow","sanitizeRowProps","getRowProps","minHeight","undefined","paddingLeft","depth","isDragging","isEditing","onClick","event","target","currentTarget","classList","contains","preventDefault","persist","cells","filter","hiddenOnSubRows","expandedRow","isExpanded","rowContent","useMemo","FocusScope","key","original","_createKey","contain","restoreFocus","autoFocus","type","name","value","id","map"],"mappings":";;;;;AAMA,MAAMA,UAAU,GAAGA,CAACC,IAAuB,EAAEC,GAAkB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O;MAACC,YAAY;MAACC,SAAS;oBACpEhD,sDAASR,KAAK;MAAES,IAAI,EAAC,KAAK;MAACS,GAAG,EAAEA;qBAC5BV;MAAOiD,IAAI,EAAC,QAAQ;MAACC,IAAI,EAAC,eAAe;MAACC,KAAK,EAAE5D,GAAG,CAAC6D;MAAM,eAC3DpD;MAAOiD,IAAI,EAAC,QAAQ;MAACC,IAAI,EAAC,wBAAwB;MAACC,KAAK,EAAE5D,GAAG,CAACqD,QAAQ,CAAC3B,qBAAqB;MAAK,EAChGkB,KAAK,CAACkB,GAAG,CAAE/D,IAAuB,IAAKD,UAAU,CAACC,IAAI,EAAE4B,YAAY,CAAC,CAAC,CACrE,CACG,EACZoB,WAAW,CACb;GAEV,EAAE,CAAC/C,GAAG,CAACqD,QAAQ,CAACC,UAAU,CAAC,CAAC;EAE7B,IAAItD,GAAG,CAACmC,SAAS,EAAE;IACf,OAAOc,UAAU;;EAGrB,oBACIxC,yEACIA,sDAASR,KAAK;IAAES,IAAI,EAAC,KAAK;IAACS,GAAG,EAAEA;MAC3ByB,KAAK,CAACkB,GAAG,CAAE/D,IAAuB,IAAKD,UAAU,CAACC,IAAI,EAAE4B,YAAY,CAAC,CAAC,CACrE,EACLoB,WAAW,CACb;AAEX,CAAC;;;;"}
1
+ {"version":3,"file":"renderRow.js","sources":["../../../../../../../../src/components/Table/util/renderRow.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { FocusScope } from '@react-aria/focus';\nimport { InternalTableCell, LegacyTableRow } from '../types';\nimport { sanitizeRowProps } from '../util';\n\nconst renderCell = (cell: InternalTableCell, row: LegacyTableRow<any>): JSX.Element => {\n const props = {\n ...cell.getCellProps(),\n className: cn('yt-table__cell flex-1 truncate p-2 align-middle', cell.column.className, {\n 'justify-start text-left': cell.column.align === 'left',\n 'justify-end text-right': cell.column.align === 'right',\n 'text-center': !cell.column.align,\n }),\n style: {\n ...cell.column.style,\n flex: typeof cell.column.flex === 'function' ? cell.column.flex(row) : cell.column.flex,\n },\n };\n return (\n <div {...props} role=\"gridcell\" data-taco=\"table-cell\">\n {cell.render('Cell') || null}\n </div>\n );\n};\n\nexport const Row = React.forwardRef(function TableRow({ row, index, instance, headerGroups, ...rowProps }: any, ref: any) {\n const {\n activeIndex,\n onRowClick,\n rowClassName,\n rowExpansionRenderer,\n rowHeight,\n setActiveIndex,\n style,\n inlineEditingUniqueId,\n } = rowProps;\n const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);\n\n const props = {\n ...row.getRowProps(),\n style: {\n ...style,\n minHeight: rowHeight ? `${rowHeight}px` : undefined,\n paddingLeft: row.depth ? `${row.depth * 2}rem` : undefined,\n },\n className: cn(\n 'yt-table__row border-grey-300 flex border-b min-h-[2.5rem] hover:bg-grey-100',\n {\n 'yt-table__row--active bg-grey-200 hover:bg-grey-200': activeIndex === index,\n 'yt-table__row--clickable': !!onRowClick,\n 'yt-table__row--dragging': !!row.isDragging,\n 'yt-table__row--editing': !!row.isEditing,\n },\n typeof rowClassName === 'function' ? rowClassName(sanitizedRow) : rowClassName\n ),\n onClick: onRowClick\n ? (event: React.MouseEvent<HTMLElement>) => {\n if (\n event.target === event.currentTarget ||\n (event.target as HTMLElement).classList.contains('yt-table__cell')\n ) {\n event.preventDefault();\n event.persist();\n setActiveIndex(index);\n onRowClick(sanitizedRow);\n }\n }\n : () => {\n setActiveIndex(index);\n },\n };\n\n let cells = row.cells;\n\n if (row.depth > 0) {\n cells = row.cells.filter((cell: any) => !cell.column.hiddenOnSubRows);\n }\n\n const expandedRow = rowExpansionRenderer && row.isExpanded && <div>{rowExpansionRenderer(sanitizedRow, instance)}</div>;\n const rowContent = React.useMemo(() => {\n return (\n <>\n <FocusScope key={row.original._createKey} contain restoreFocus autoFocus>\n <div {...props} role=\"row\" ref={ref}>\n <input type=\"hidden\" name=\"_rowIndexPath\" value={row.id} />\n <input type=\"hidden\" name=\"_inlineEditingUniqueId\" value={row.original[inlineEditingUniqueId]} />\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\n </div>\n </FocusScope>\n {expandedRow}\n </>\n );\n }, [row.original._createKey]);\n\n if (row.isEditing) {\n return rowContent;\n }\n\n return (\n <>\n <div {...props} role=\"row\" ref={ref}>\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\n </div>\n {expandedRow}\n </>\n );\n});\n"],"names":["renderCell","cell","row","props","getCellProps","className","cn","column","align","style","flex","React","role","render","Row","forwardRef","TableRow","index","instance","headerGroups","rowProps","ref","activeIndex","onRowClick","rowClassName","rowExpansionRenderer","rowHeight","setActiveIndex","inlineEditingUniqueId","sanitizedRow","sanitizeRowProps","getRowProps","minHeight","undefined","paddingLeft","depth","isDragging","isEditing","onClick","event","target","currentTarget","classList","contains","preventDefault","persist","cells","filter","hiddenOnSubRows","expandedRow","isExpanded","rowContent","useMemo","FocusScope","key","original","_createKey","contain","restoreFocus","autoFocus","type","name","value","id","map"],"mappings":";;;;;AAMA,MAAMA,UAAU,GAAGA,CAACC,IAAuB,EAAEC,GAAwB;EACjE,MAAMC,KAAK,GAAG;IACV,GAAGF,IAAI,CAACG,YAAY,EAAE;IACtBC,SAAS,EAAEC,EAAE,CAAC,iDAAiD,EAAEL,IAAI,CAACM,MAAM,CAACF,SAAS,EAAE;MACpF,yBAAyB,EAAEJ,IAAI,CAACM,MAAM,CAACC,KAAK,KAAK,MAAM;MACvD,wBAAwB,EAAEP,IAAI,CAACM,MAAM,CAACC,KAAK,KAAK,OAAO;MACvD,aAAa,EAAE,CAACP,IAAI,CAACM,MAAM,CAACC;KAC/B,CAAC;IACFC,KAAK,EAAE;MACH,GAAGR,IAAI,CAACM,MAAM,CAACE,KAAK;MACpBC,IAAI,EAAE,OAAOT,IAAI,CAACM,MAAM,CAACG,IAAI,KAAK,UAAU,GAAGT,IAAI,CAACM,MAAM,CAACG,IAAI,CAACR,GAAG,CAAC,GAAGD,IAAI,CAACM,MAAM,CAACG;;GAE1F;EACD,oBACIC,sDAASR,KAAK;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EACIA,sDAASR,KAAK;IAAES,IAAI,EAAC,KAAK;IAACS,GAAG,EAAEA;MAC3ByB,KAAK,CAACkB,GAAG,CAAE/D,IAAuB,IAAKD,UAAU,CAACC,IAAI,EAAE4B,YAAY,CAAC,CAAC,CACrE,EACLoB,WAAW,CACb;AAEX,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"sortTypes.js","sources":["../../../../../../../../src/components/Table/util/sortTypes.ts"],"sourcesContent":["import { SortTypes, TableRow } from '../types';\n\nconst getTime = (value: any): number | undefined => {\n const parsedValue: Date = typeof value === 'string' ? new Date(value) : value;\n return parsedValue?.getTime ? parsedValue.getTime() : undefined;\n};\n\nconst getNumber = (amount = '', decimalSeparator = ','): number | undefined => {\n if (typeof amount === 'number') {\n return amount;\n }\n\n if (amount === null || !amount.length) {\n return undefined;\n }\n\n let value;\n\n if (decimalSeparator === ',') {\n // replace digit seperator then replace decimal separator\n value = Number(amount.replace(/\\./g, '').replace(',', '.'));\n } else {\n // replace digit seperator\n value = Number(amount.replace(/,/g, ''));\n }\n\n return Number.isNaN(value) ? undefined : value;\n};\n\nconst getString = (value: any): string | undefined => {\n if (value) {\n return String(value).toLowerCase();\n }\n\n return undefined;\n};\n\nconst guess = (value: any): any => {\n if (typeof value === 'boolean') {\n return value;\n }\n\n return isNaN(value) ? getString(value) : Number(value);\n};\n\nconst compareBasic = (a: any, b: any) => {\n // places undefined values first in ascending order instead of descending\n if (a !== undefined && b === undefined) {\n return 1;\n }\n\n return a === b ? 0 : a > b ? 1 : -1;\n};\n\nconst stringsLocaleCompare = (a: string, b: string, locale: string): 0 | 1 | -1 => {\n // In some browsers 'localCompare' may return -2 or 2 instead of -1 or 1\n const compareResult = a.localeCompare(b, locale);\n return compareResult === 0 ? 0 : compareResult > 0 ? 1 : -1;\n};\n\nconst compareBasicStrings = (a: string | undefined, b: string | undefined, locale: string): 0 | 1 | -1 => {\n if (a && b) {\n return stringsLocaleCompare(a, b, locale);\n }\n\n return compareBasic(a, b);\n};\n\ntype SortHandler<T> = (rowA: TableRow<T>, rowB: TableRow<T>, columnId: string) => 0 | 1 | -1;\n\nexport const sortTypes = (locale: string): Record<SortTypes, SortHandler<any>> => {\n return {\n datetime: (rowA, rowB, columnId) => {\n const a = getTime(rowA.values[columnId]);\n const b = getTime(rowB.values[columnId]);\n return compareBasic(a, b);\n },\n string: (rowA, rowB, columnId) => {\n const a = getString(rowA.values[columnId]);\n const b = getString(rowB.values[columnId]);\n return compareBasicStrings(a, b, locale);\n },\n number: (rowA, rowB, columnId) => {\n const a = getNumber(rowA.values[columnId]);\n const b = getNumber(rowB.values[columnId]);\n return compareBasic(a, b);\n },\n boolean: (rowA, rowB, columnId) => {\n const a = !!rowA.values[columnId];\n const b = !!rowB.values[columnId];\n return compareBasic(a, b);\n },\n auto: (rowA, rowB, columnId) => {\n const a = guess(rowA.values[columnId]);\n const b = guess(rowB.values[columnId]);\n if (typeof a === 'string' && typeof b === 'string') {\n return compareBasicStrings(a, b, locale);\n } else {\n return compareBasic(a, b);\n }\n },\n };\n};\n"],"names":["getTime","value","parsedValue","Date","undefined","getNumber","amount","decimalSeparator","length","Number","replace","isNaN","getString","String","toLowerCase","guess","compareBasic","a","b","stringsLocaleCompare","locale","compareResult","localeCompare","compareBasicStrings","sortTypes","datetime","rowA","rowB","columnId","values","string","number","boolean","auto"],"mappings":"AAEA,MAAMA,OAAO,GAAIC,KAAU;EACvB,MAAMC,WAAW,GAAS,OAAOD,KAAK,KAAK,QAAQ,GAAG,IAAIE,IAAI,CAACF,KAAK,CAAC,GAAGA,KAAK;EAC7E,OAAOC,WAAW,aAAXA,WAAW,eAAXA,WAAW,CAAEF,OAAO,GAAGE,WAAW,CAACF,OAAO,EAAE,GAAGI,SAAS;AACnE,CAAC;AAED,MAAMC,SAAS,GAAGA,CAACC,MAAM,GAAG,EAAE,EAAEC,gBAAgB,GAAG,GAAG;EAClD,IAAI,OAAOD,MAAM,KAAK,QAAQ,EAAE;IAC5B,OAAOA,MA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ACC,CAAC,EAAEC,CAAC,CAAC;KAC5B;IACDc,OAAO,EAAEA,CAACN,IAAI,EAAEC,IAAI,EAAEC,QAAQ;MAC1B,MAAMX,CAAC,GAAG,CAAC,CAACS,IAAI,CAACG,MAAM,CAACD,QAAQ,CAAC;MACjC,MAAMV,CAAC,GAAG,CAAC,CAACS,IAAI,CAACE,MAAM,CAACD,QAAQ,CAAC;MACjC,OAAOZ,YAAY,CAACC,CAAC,EAAEC,CAAC,CAAC;KAC5B;IACDe,IAAI,EAAEA,CAACP,IAAI,EAAEC,IAAI,EAAEC,QAAQ;MACvB,MAAMX,CAAC,GAAGF,KAAK,CAACW,IAAI,CAACG,MAAM,CAACD,QAAQ,CAAC,CAAC;MACtC,MAAMV,CAAC,GAAGH,KAAK,CAACY,IAAI,CAACE,MAAM,CAACD,QAAQ,CAAC,CAAC;MACtC,IAAI,OAAOX,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;QAChD,OAAOK,mBAAmB,CAACN,CAAC,EAAEC,CAAC,EAAEE,MAAM,CAAC;OAC3C,MAAM;QACH,OAAOJ,YAAY,CAACC,CAAC,EAAEC,CAAC,CAAC;;;GAGpC;AACL;;;;"}
1
+ {"version":3,"file":"sortTypes.js","sources":["../../../../../../../../src/components/Table/util/sortTypes.ts"],"sourcesContent":["import { SortTypes, LegacyTableRow } from '../types';\n\nconst getTime = (value: any): number | undefined => {\n const parsedValue: Date = typeof value === 'string' ? new Date(value) : value;\n return parsedValue?.getTime ? parsedValue.getTime() : undefined;\n};\n\nconst getNumber = (amount = '', decimalSeparator = ','): number | undefined => {\n if (typeof amount === 'number') {\n return amount;\n }\n\n if (amount === null || !amount.length) {\n return undefined;\n }\n\n let value;\n\n if (decimalSeparator === ',') {\n // replace digit seperator then replace decimal separator\n value = Number(amount.replace(/\\./g, '').replace(',', '.'));\n } else {\n // replace digit seperator\n value = Number(amount.replace(/,/g, ''));\n }\n\n return Number.isNaN(value) ? undefined : value;\n};\n\nconst getString = (value: any): string | undefined => {\n if (value) {\n return String(value).toLowerCase();\n }\n\n return undefined;\n};\n\nconst guess = (value: any): any => {\n if (typeof value === 'boolean') {\n return value;\n }\n\n return isNaN(value) ? getString(value) : Number(value);\n};\n\nconst compareBasic = (a: any, b: any) => {\n // places undefined values first in ascending order instead of descending\n if (a !== undefined && b === undefined) {\n return 1;\n }\n\n return a === b ? 0 : a > b ? 1 : -1;\n};\n\nconst stringsLocaleCompare = (a: string, b: string, locale: string): 0 | 1 | -1 => {\n // In some browsers 'localCompare' may return -2 or 2 instead of -1 or 1\n const compareResult = a.localeCompare(b, locale);\n return compareResult === 0 ? 0 : compareResult > 0 ? 1 : -1;\n};\n\nconst compareBasicStrings = (a: string | undefined, b: string | undefined, locale: string): 0 | 1 | -1 => {\n if (a && b) {\n return stringsLocaleCompare(a, b, locale);\n }\n\n return compareBasic(a, b);\n};\n\ntype SortHandler<T> = (rowA: LegacyTableRow<T>, rowB: LegacyTableRow<T>, columnId: string) => 0 | 1 | -1;\n\nexport const sortTypes = (locale: string): Record<SortTypes, SortHandler<any>> => {\n return {\n datetime: (rowA, rowB, columnId) => {\n const a = getTime(rowA.values[columnId]);\n const b = getTime(rowB.values[columnId]);\n return compareBasic(a, b);\n },\n string: (rowA, rowB, columnId) => {\n const a = getString(rowA.values[columnId]);\n const b = getString(rowB.values[columnId]);\n return compareBasicStrings(a, b, locale);\n },\n number: (rowA, rowB, columnId) => {\n const a = getNumber(rowA.values[columnId]);\n const b = getNumber(rowB.values[columnId]);\n return compareBasic(a, b);\n },\n boolean: (rowA, rowB, columnId) => {\n const a = !!rowA.values[columnId];\n const b = !!rowB.values[columnId];\n return compareBasic(a, b);\n },\n auto: (rowA, rowB, columnId) => {\n const a = guess(rowA.values[columnId]);\n const b = guess(rowB.values[columnId]);\n if (typeof a === 'string' && typeof b === 'string') {\n return compareBasicStrings(a, b, locale);\n } else {\n return compareBasic(a, b);\n }\n },\n };\n};\n"],"names":["getTime","value","parsedValue","Date","undefined","getNumber","amount","decimalSeparator","length","Number","replace","isNaN","getString","String","toLowerCase","guess","compareBasic","a","b","stringsLocaleCompare","locale","compareResult","localeCompare","compareBasicStrings","sortTypes","datetime","rowA","rowB","columnId","values","string","number","boolean","auto"],"mappings":"AAEA,MAAMA,OAAO,GAAIC,KAAU;EACvB,MAAMC,WAAW,GAAS,OAAOD,KAAK,KAAK,QAAQ,GAAG,IAAIE,IAAI,CAACF,KAAK,CAAC,GAAGA,KAAK;EAC7E,OAAOC,WAAW,aAAXA,WAAW,eAAXA,WAAW,CAAEF,OAAO,GAAGE,WAAW,CAACF,OAAO,EAAE,GAAGI,SAAS;AACnE,CAAC;AAED,MAAMC,SAAS,GAAGA,CAACC,MAAM,GAAG,EAAE,EAAEC,gBAAgB,GAAG,GAAG;EAClD,IAAI,OAAOD,MAAM,KAAK,QAAQ,EAAE;IAC5B,OAAOA,MAAM;;EAGjB,IAAIA,MAAM,KAAK,IAAI,IAAI,CAACA,MAAM,CAACE,MAAM,EAAE;IACnC,OAAOJ,SAAS;;EAGpB,IAAIH,KAAK;EAET,IAAIM,gBAAgB,KAAK,GAAG,EAAE;;IAE1BN,KAAK,GAAGQ,MAAM,CAACH,MAAM,CAACI,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAACA,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;GAC9D,MAAM;;IAEHT,KAAK,GAAGQ,MAAM,CAACH,MAAM,CAACI,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;;EAG5C,OAAOD,MAAM,CAACE,KAAK,CAACV,KAAK,CAAC,GAAGG,SAAS,GAAGH,KAAK;AAClD,CAAC;AAED,MAAMW,SAAS,GAAIX,KAAU;EACzB,IAAIA,KAAK,EAAE;IACP,OAAOY,MAAM,CAACZ,KAAK,CAAC,CAACa,WAAW,EAAE;;EAGtC,OAAOV,SAAS;AACpB,CAAC;AAED,MAAMW,KAAK,GAAId,KAAU;EACrB,IAAI,OAAOA,KAA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MAAM;QACH,OAAOJ,YAAY,CAACC,CAAC,EAAEC,CAAC,CAAC;;;GAGpC;AACL;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sources":["../../../../../../../src/components/Table/util.ts"],"sourcesContent":["import React from 'react';\nimport { TableRow, TableCell, TableChildren, InternalTableRow, InternalTableColumn, SortRule } from './types';\nimport { SortingRule } from 'react-table';\n\nexport const sanitizeRowProps = (row: InternalTableRow, rowExpansionRenderer: any): TableRow<any> => {\n const props: TableRow<any> = {\n index: row.index,\n indexPath: row.id,\n values: row.original,\n };\n\n if (row.subRows?.length > 0) {\n props.isExpanded = !!row.isExpanded;\n props.depth = row.depth;\n props.toggleRowExpanded = () => row.toggleRowExpanded(!props.isExpanded);\n } else if (rowExpansionRenderer) {\n props.isExpanded = !!row.isExpanded;\n props.toggleRowExpanded = () => row.toggleRowExpanded(!props.isExpanded);\n }\n\n if (row.toggleRowEditing) {\n props.isEditing = !!row.isEditing;\n props.toggleRowEditing = row.toggleRowEditing;\n }\n\n return props;\n};\n\nexport const getColumnsFromChildren = (children: TableChildren<any>, rowExpansionRenderer: any) => {\n const sortRules: SortingRule<any>[] = [];\n\n const columns = React.Children.toArray(children)\n .filter((child: any) => !!child && !child.props.hidden) // skip falsey or hidden columns\n .map(({ props: { children: groupChildren, ...props } }: any) => {\n const column: InternalTableColumn & { disableSortBy: boolean | undefined } = { ...props };\n\n column.sortType = column.sortType || 'auto';\n column.disableSortBy = column.disableSorting;\n\n // this is a Table.Group - TODO: Find a better way to determine the child type\n if (props.title && groupChildren) {\n column.Header = props.title;\n\n const { columns: groupColumns, sortRules: groupSortRules } = getColumnsFromChildren(\n groupChildren,\n rowExpansionRenderer\n );\n column.columns = groupColumns;\n groupSortRules.forEach(sort => sortRules.push(sort));\n } else {\n column.accessor = props.accessor;\n column.Header = props.headRenderer || '';\n column.Cell = (columnProps: any) => {\n const cell: TableCell<any> = {\n accessor: columnProps.cell.column.id,\n row: sanitizeRowProps(columnProps.cell.row, rowExpansionRenderer),\n value: columnProps.cell.value,\n };\n\n if (cell.row.isEditing && typeof props.editRenderer === 'function') {\n return props.editRenderer(cell);\n }\n\n return typeof props.cellRenderer === 'function' ? props.cellRenderer(cell) ?? null : cell.value ?? null;\n };\n\n // custom props\n column.align = props.align;\n column.flex = props.flex;\n\n if (props.sort && !props.disableSorting) {\n sortRules.push({\n id: props.accessor,\n desc: props.sort === 'desc',\n });\n }\n }\n\n return column;\n });\n\n return { columns, sortRules };\n};\n\nexport const getInternalSortRules = <T>(sortRules: SortRule<T>[] | undefined): SortingRule<T>[] | undefined => {\n return sortRules?.map<SortingRule<T>>(rule => ({ id: rule.accessor, desc: rule.desc }));\n};\n"],"names":["sanitizeRowProps","row","rowExpansionRenderer","props","index","indexPath","id","values","original","_row$subRows","subRows","length","isExpanded","depth","toggleRowExpanded","toggleRowEditing","isEditing","getColumnsFromChildren","children","sortRules","columns","React","Children","toArray","filter","child","hidden","map","groupChildren","column","sortType","disableSortBy","disableSorting","title","Header","groupColumns","groupSortRules","forEach","sort","push","accessor","headRenderer","Cell","columnProps","cell","value","editRenderer","cellRenderer","_props$cellRenderer","_cell$value","align","flex","desc","getInternalSortRules","rule"],"mappings":";;MAIaA,gBAAgB,GAAGA,CAACC,GAAqB,EAAEC,oBAAyB;;EAC7E,MAAMC,KAAK,GAAkB;IACzBC,KAAK,EAAEH,GAAG,CAACG,KAAK;IAChBC,SAAS,EAAEJ,GAAG,CAACK,EAAE;IACjBC,MAAM,EAAEN,GAAG,CAACO;GACf;EAED,IAAI,EAAAC,YAAA,GAAAR,GAAG,CAACS,OAAO,cAAAD,YAAA,uBAAXA,YAAA,CAAaE,MAAM,IAAG,CAAC,EAAE;IACzBR,KAAK,CAACS,UAAU,GAAG,CAAC,CAACX,GAAG,CAACW,UAAU;IACnCT,KAAK,CAACU,KAAK,GAAGZ,GAAG,CAACY,KAAK;IACvBV,KAAK,CAACW,iBAAiB,GAAG,MAAMb,GAAG,CAACa,iBAAiB,CAAC,C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AO;IAAET,OAAO;IAAED;GAAW;AACjC;MAEakC,oBAAoB,GAAOlC,SAAoC;EACxE,OAAOA,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEQ,GAAG,CAAiB2B,IAAI,KAAK;IAAEhD,EAAE,EAAEgD,IAAI,CAACd,QAAQ;IAAEY,IAAI,EAAEE,IAAI,CAACF;GAAM,CAAC,CAAC;AAC3F;;;;"}
1
+ {"version":3,"file":"util.js","sources":["../../../../../../../src/components/Table/util.ts"],"sourcesContent":["import React from 'react';\nimport { LegacyTableRow, LegacyTableCell, LegacyTableChildren, InternalTableRow, InternalTableColumn, SortRule } from './types';\nimport { SortingRule } from 'react-table';\n\nexport const sanitizeRowProps = (row: InternalTableRow, rowExpansionRenderer: any): LegacyTableRow<any> => {\n const props: LegacyTableRow<any> = {\n index: row.index,\n indexPath: row.id,\n values: row.original,\n };\n\n if (row.subRows?.length > 0) {\n props.isExpanded = !!row.isExpanded;\n props.depth = row.depth;\n props.toggleRowExpanded = () => row.toggleRowExpanded(!props.isExpanded);\n } else if (rowExpansionRenderer) {\n props.isExpanded = !!row.isExpanded;\n props.toggleRowExpanded = () => row.toggleRowExpanded(!props.isExpanded);\n }\n\n if (row.toggleRowEditing) {\n props.isEditing = !!row.isEditing;\n props.toggleRowEditing = row.toggleRowEditing;\n }\n\n return props;\n};\n\nexport const getColumnsFromChildren = (children: LegacyTableChildren<any>, rowExpansionRenderer: any) => {\n const sortRules: SortingRule<any>[] = [];\n\n const columns = React.Children.toArray(children)\n .filter((child: any) => !!child && !child.props.hidden) // skip falsey or hidden columns\n .map(({ props: { children: groupChildren, ...props } }: any) => {\n const column: InternalTableColumn & { disableSortBy: boolean | undefined } = { ...props };\n\n column.sortType = column.sortType || 'auto';\n column.disableSortBy = column.disableSorting;\n\n // this is a Table.Group - TODO: Find a better way to determine the child type\n if (props.title && groupChildren) {\n column.Header = props.title;\n\n const { columns: groupColumns, sortRules: groupSortRules } = getColumnsFromChildren(\n groupChildren,\n rowExpansionRenderer\n );\n column.columns = groupColumns;\n groupSortRules.forEach(sort => sortRules.push(sort));\n } else {\n column.accessor = props.accessor;\n column.Header = props.headRenderer || '';\n column.Cell = (columnProps: any) => {\n const cell: LegacyTableCell<any> = {\n accessor: columnProps.cell.column.id,\n row: sanitizeRowProps(columnProps.cell.row, rowExpansionRenderer),\n value: columnProps.cell.value,\n };\n\n if (cell.row.isEditing && typeof props.editRenderer === 'function') {\n return props.editRenderer(cell);\n }\n\n return typeof props.cellRenderer === 'function' ? props.cellRenderer(cell) ?? null : cell.value ?? null;\n };\n\n // custom props\n column.align = props.align;\n column.flex = props.flex;\n\n if (props.sort && !props.disableSorting) {\n sortRules.push({\n id: props.accessor,\n desc: props.sort === 'desc',\n });\n }\n }\n\n return column;\n });\n\n return { columns, sortRules };\n};\n\nexport const getInternalSortRules = <T>(sortRules: SortRule<T>[] | undefined): SortingRule<T>[] | undefined => {\n return sortRules?.map<SortingRule<T>>(rule => ({ id: rule.accessor, desc: rule.desc }));\n};\n"],"names":["sanitizeRowProps","row","rowExpansionRenderer","props","index","indexPath","id","values","original","_row$subRows","subRows","length","isExpanded","depth","toggleRowExpanded","toggleRowEditing","isEditing","getColumnsFromChildren","children","sortRules","columns","React","Children","toArray","filter","child","hidden","map","groupChildren","column","sortType","disableSortBy","disableSorting","title","Header","groupColumns","groupSortRules","forEach","sort","push","accessor","headRenderer","Cell","columnProps","cell","value","editRenderer","cellRenderer","_props$cellRenderer","_cell$value","align","flex","desc","getInternalSortRules","rule"],"mappings":";;MAIaA,gBAAgB,GAAGA,CAACC,GAAqB,EAAEC,oBAAyB;;EAC7E,MAAMC,KAAK,GAAwB;IAC/BC,KAAK,EAAEH,GAAG,CAACG,KAAK;IAChBC,SAAS,EAAEJ,GAAG,CAACK,EAAE;IACjBC,MAAM,EAAEN,GAAG,CAACO;GACf;EAED,IAAI,EAAAC,YAAA,GAAAR,GAAG,CAACS,OAAO,cAAAD,YAAA,uBAAXA,YAAA,CAAaE,MAAM,IAA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,CAAC6B,cAAc,EAAE;QACrCb,SAAS,CAACoB,IAAI,CAAC;UACXjC,EAAE,EAAEH,KAAK,CAACqC,QAAQ;UAClBY,IAAI,EAAEjD,KAAK,CAACmC,IAAI,KAAK;SACxB,CAAC;;;IAIV,OAAOT,MAAM;GAChB,CAAC;EAEN,OAAO;IAAET,OAAO;IAAED;GAAW;AACjC;MAEakC,oBAAoB,GAAOlC,SAAoC;EACxE,OAAOA,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEQ,GAAG,CAAiB2B,IAAI,KAAK;IAAEhD,EAAE,EAAEgD,IAAI,CAACd,QAAQ;IAAEY,IAAI,EAAEE,IAAI,CAACF;GAAM,CAAC,CAAC;AAC3F;;;;"}
@@ -1,6 +1,7 @@
1
1
  import React__default from 'react';
2
2
  import cn from 'clsx';
3
3
  import { useMergedRef } from '../../hooks/useMergedRef.js';
4
+ import { isElementInsideOverlay, isSiblingElementInsideSameParentOverlay, isElementInteractive, isElementInsideOrTriggeredFromContainer } from '../../utils/dom.js';
4
5
  import { FocusScope } from '@react-aria/focus';
5
6
  import { fixedForwardRef, FontSizes } from '../../types.js';
6
7
  import { flexRender } from '@tanstack/react-table';
@@ -67,13 +68,10 @@ const Table = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
67
68
  }, []);
68
69
  React__default.useEffect(() => {
69
70
  const handleKeyDown = event => {
70
- const target = event.target;
71
- const dialog = target.closest('[role="dialog"]');
71
+ const trigger = event.target;
72
72
  // Select2 also have combobox role to align with W3C guidelines
73
- const eventOriginatedFromCombobox = !!target.closest('[role="combobox"]:not([data-taco="Select2"])');
74
- // Don't trigger global shortcuts on the table if event originated from a combobox or if table is
75
- // outside the dialog
76
- if (eventOriginatedFromCombobox || dialog && !(dialog !== null && dialog !== void 0 && dialog.contains(internalRef.current)) || tableMeta.shortcutsState.isPaused) {
73
+ const eventOriginatedFromCombobox = !!trigger.closest('[role="combobox"]:not([data-taco="Select2"])');
74
+ if (tableMeta.shortcutsState.isPaused || isElementInsideOverlay(trigger) && !isSiblingElementInsideSameParentOverlay(trigger, internalRef.current) || isElementInteractive(trigger) && !isElementInsideOrTriggeredFromContainer(trigger, internalRef.current) || eventOriginatedFromCombobox) {
77
75
  return;
78
76
  }
79
77
  const rows = table.getRowModel().rows;
@@ -1 +1 @@
1
- {"version":3,"file":"Table3.js","sources":["../../../../../../../src/components/Table3/Table3.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { flexRender, TableMeta } from '@tanstack/react-table';\nimport { FocusScope } from '@react-aria/focus';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { useCssGrid } from './hooks/useCssGrid';\nimport { useTable } from './hooks/useTable';\nimport { useTableRenderStrategy } from './strategies';\nimport { Table3ColumnProps, Table3GroupProps, Table3Props, Table3Ref } from './types';\nimport { Toolbar } from './components/toolbar/Toolbar';\nimport { useColumnFreezingStyle } from './hooks/features/useColumnFreezing';\nimport { useTableRefInstanceSetup } from './hooks/useTableRefInstanceSetup';\nimport { Summary } from './components/columns/footer/Summary';\nimport { useCssVars } from './hooks/useCssVars';\nimport './style.css';\nimport { useHeaderOffsetStyle } from './hooks/features/useHeaderOffsetStyle';\nimport { ErrorAlert } from './components/alert/ErrorAlert';\nimport { fixedForwardRef, FontSizes } from '../../types';\n\nfunction Column<TType = unknown>(_: Table3ColumnProps<TType>) {\n return null;\n}\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: Table3GroupProps) {\n return null;\n}\nGroup.displayName = 'Table3Group';\n\nconst Table = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const {\n emptyState: EmptyState,\n customSettings,\n toolbarLeft,\n toolbarRight,\n defaultCurrentRowIndex: defaultRowActiveIndex,\n } = props;\n const internalRef = useMergedRef<Table3Ref>(ref);\n\n const { table, length } = useTable<TType>(props, internalRef);\n useTableRefInstanceSetup(table, internalRef);\n\n React.useEffect(() => {\n if (props.autoFocus) {\n internalRef.current?.focus();\n }\n }, []);\n\n const { renderBody, scrollToIndex } = useTableRenderStrategy<TType>(props, table, internalRef);\n const tableMeta = table.options.meta as TableMeta<TType>;\n const state = table.getState();\n\n const bodyRef = React.useRef<HTMLDivElement | null>(null);\n\n React.useEffect(() => {\n // On a very first render, the tanstack table rendered without any rows,\n // so we delaying default row scrolling logic with using of requestAnimation frame\n const animationFrameId = requestAnimationFrame(() => {\n if (defaultRowActiveIndex) {\n scrollToIndex(defaultRowActiveIndex, { align: 'center' });\n }\n });\n\n return () => {\n cancelAnimationFrame(animationFrameId);\n };\n }, []);\n\n React.useEffect(\n () => {\n const handleKeyDown = (event: KeyboardEvent) => {\n const target = event.target as HTMLElement;\n const dialog = target.closest('[role=\"dialog\"]');\n // Select2 also have combobox role to align with W3C guidelines\n const eventOriginatedFromCombobox = !!target.closest('[role=\"combobox\"]:not([data-taco=\"Select2\"])');\n\n // Don't trigger global shortcuts on the table if event originated from a combobox or if table is\n // outside the dialog\n if (\n eventOriginatedFromCombobox ||\n (dialog && !dialog?.contains(internalRef.current)) ||\n tableMeta.shortcutsState.isPaused\n ) {\n return;\n }\n\n const rows = table.getRowModel().rows;\n\n tableMeta.rowActive.handleKeyDown(\n event,\n rows.length,\n scrollToIndex,\n tableMeta.editing.isEditing ? undefined : internalRef\n );\n if (tableMeta.rowActive.rowActiveIndex !== undefined) {\n tableMeta.rowClick.handleKeyDown(event, rows[tableMeta.rowActive.rowActiveIndex]?.original);\n }\n tableMeta.rowSelection.handleKeyDown(event, table);\n tableMeta.editing.handleKeyDown(event);\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n },\n // See https://github.com/e-conomic/taco/blob/dev/packages/taco/src/components/Table3/strategies/virtualised.tsx#L143\n // scrollToIndex function changes when row count changes, so it is important to update handlers with new\n // scrollToIndex function.\n [scrollToIndex, tableMeta.editing.isEditing, internalRef.current, tableMeta.rowActive.rowActiveIndex]\n );\n\n const handleBlur = tableMeta.editing.isEnabled\n ? (event: React.FocusEvent) => {\n tableMeta.editing.handleBlur(event);\n }\n : undefined;\n\n const handleFocus =\n tableMeta.rowActive.rowActiveIndex === undefined\n ? (event: React.FocusEvent) => {\n tableMeta.rowActive.handleFocus(event, table.getRowModel().rows.length, scrollToIndex);\n }\n : undefined;\n\n const handleScroll = async (event: React.MouseEvent<HTMLDivElement>) => {\n // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel\n tableMeta.columnFreezing.handleScroll(event);\n };\n\n const className = cn(\n 'border-grey-300 relative grid h-full w-full flex-grow overflow-auto rounded border bg-white scroll-mt-[41px] focus-visible:outline-none',\n '[&[data-resizing=\"true\"]]:select-none',\n {\n 'text-xs': tableMeta.fontSize.size === FontSizes.small,\n 'text-sm': tableMeta.fontSize.size === FontSizes.medium,\n 'text-base': tableMeta.fontSize.size === FontSizes.large,\n }\n );\n\n // Print tables have \"_print\" as the postfix for the table id, so we can use the it to determine\n // if the table is a print table or not.\n const { style: cssGridStyle } = useCssGrid<TType>(\n table,\n tableMeta.printing.isPrinting,\n // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel\n tableMeta.rowActions.actionsForRowLength,\n tableMeta.fontSize.size\n );\n const { style: cssVars } = useCssVars(tableMeta.rowHeight.height, tableMeta.fontSize.size);\n\n const style = {\n ...cssVars,\n ...cssGridStyle,\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n opacity: 0.999,\n };\n\n const columnFreezingStyle = useColumnFreezingStyle(props.id, table);\n const headerOffsetStyle = useHeaderOffsetStyle(props.id, table);\n const isServerLoadingAndNotReady = tableMeta.isUsingServer && props.length === undefined;\n\n return (\n <>\n {columnFreezingStyle ? <style data-taco=\"table3-column-freezing-styles\">{columnFreezingStyle}</style> : null}\n {headerOffsetStyle && !tableMeta.printing.isPrinting ? (\n <style data-taco=\"table3-column-header-offset-styles\">{headerOffsetStyle}</style>\n ) : null}\n <Toolbar\n table={table}\n tableProps={props}\n total={length}\n left={toolbarLeft}\n right={toolbarRight}\n customSettings={customSettings}\n scrollToIndex={scrollToIndex}\n />\n <ErrorAlert table={table} tableRef={internalRef} scrollToIndex={scrollToIndex} rowIdentifier={props.rowIdentifier} />\n <div\n className={className}\n id={props.id}\n data-font-size={tableMeta.fontSize.size}\n data-editing={tableMeta.editing.isEditing}\n // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel\n data-horizontally-scrolled={tableMeta.columnFreezing.horizontallyScrolled}\n data-pause-hover={tableMeta?.rowActive.isHoverStatePaused}\n data-resizing={!!state.columnSizingInfo.isResizingColumn}\n data-taco=\"table2\"\n onBlur={handleBlur}\n onFocus={handleFocus}\n onScroll={handleScroll}\n ref={internalRef}\n role=\"table\"\n style={style}\n tabIndex={-1}>\n {isServerLoadingAndNotReady ? null : (\n <div className=\"group/header contents\" data-taco=\"table2-header\" role=\"rowgroup\">\n {table.getHeaderGroups().map(headerGroup => (\n <div className=\"contents\" key={headerGroup.id} role=\"row\">\n {headerGroup.headers.map((header, index) => {\n // We need to render separator if column is not the last in array, if index is not equal to freeze column index,\n // if next element is not placeholder and if column itself is not placeholder.\n const hasSeparator =\n // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel\n index !== tableMeta.columnFreezing.frozenColumnIndex &&\n index !== headerGroup.headers.length - 1 &&\n (!headerGroup.headers[index + 1]?.isPlaceholder || !header.isPlaceholder);\n return (\n <React.Fragment key={header.id}>\n {flexRender(header.column.columnDef.header, {\n ...header.getContext(),\n scrollToIndex,\n hasSeparator,\n })}\n </React.Fragment>\n );\n })}\n </div>\n ))}\n </div>\n )}\n {table.getRowModel().rows.length ? (\n <>\n <FocusScope autoFocus={tableMeta.editing.isEditing}>\n <div className=\"group/body contents\" data-taco=\"table2-body\" role=\"rowgroup\" ref={bodyRef}>\n {renderBody()}\n </div>\n </FocusScope>\n {/* This div makes sure that there is always a free space between the rows and footer when\n table height exceeds the cumulative height of all rows. See useCSSGrid.ts */}\n {/* By vertically translating the div a pixel down, we hide the div border below footer so that\n the footer border doesn't appear an extra pixel thick */}\n <div\n className={cn('border-grey-300 col-span-full border-t', { 'translate-y-px': tableMeta.enableFooter })}\n />\n {tableMeta.enableFooter ? (\n <div className=\"group/footer contents\" data-taco=\"table2-footer\" role=\"rowgroup\">\n {\n // Render the footer cell only for individual columns, excluding column groups.\n table\n .getFooterGroups()\n .slice(0, 1)\n .map(footerGroup => (\n <div className=\"contents\" key={footerGroup.id} role=\"row\">\n {footerGroup.headers.map(footer => (\n <React.Fragment key={footer.id}>\n {flexRender(footer.column.columnDef.footer, footer.getContext())}\n </React.Fragment>\n ))}\n </div>\n ))\n }\n {length ? (\n <Summary currentLength={table.getRowModel().rows.length} length={length} table={table} />\n ) : null}\n </div>\n ) : null}\n </>\n ) : (\n <div className=\"col-span-full box-border min-h-[theme(spacing.8)]\">{EmptyState ? <EmptyState /> : null}</div>\n )}\n </div>\n </>\n );\n});\n\ntype Table3WithStatics = (<TType = unknown>(props: Table3Props<TType> & React.RefAttributes<Table3Ref>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\n\nexport const Table3 = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n return <Table<TType> {...props} key={key} ref={ref} />;\n}) as Table3WithStatics;\nTable3.Column = Column;\nTable3.Group = Group;\n\n// hooks\nexport { useTable3DataLoader } from './hooks/useTableDataLoader';\n\n// types\nexport type {\n useTable3DataFetcher,\n useTable3DataOptions,\n useTable3DataFetcherValues as useTableDataValues,\n} from './hooks/useTableDataLoader';\n\nexport type {\n Table3Ref,\n Table3Props,\n Table3Preset,\n Table3Settings,\n Table3SettingsHandler,\n Table3RowHeight,\n Table3FilterComparator,\n Table3FilterHandler,\n Table3LoadPageHandler,\n Table3LoadAllHandler,\n Table3RowGotoHandler,\n Table3SortHandler,\n Table3Shortcuts,\n Table3ShortcutHandlerFn,\n Table3ShortcutHandlerObject,\n Table3SortDirection,\n Table3SortFn,\n Table3RowActionRenderer,\n Table3RowSelectionHandler,\n Table3RowExpansionRenderer,\n Table3RowDropHandler,\n Table3RowDragHandler,\n Table3RowClickHandler,\n Table3ColumnProps,\n Table3ColumnAlignment,\n Table3ColumnDataType,\n Table3ColumnHeaderMenu,\n Table3ColumnClassNameHandler,\n Table3ColumnFooterRenderer,\n Table3ColumnRenderer,\n Table3ColumnControlRenderer,\n Table3ColumnControlProps,\n} from './types';\n"],"names":["Column","_","displayName","Group","Table","fixedForwardRef","Table3","props","ref","emptyState","EmptyState","customSettings","toolbarLeft","toolbarRight","defaultCurrentRowIndex","defaultRowActiveIndex","internalRef","useMergedRef","table","length","useTable","useTableRefInstanceSetup","React","useEffect","autoFocus","_internalRef$current","current","focus","renderBody","scrollToIndex","useTableRenderStrategy","tableMeta","options","meta","state","getState","bodyRef","useRef","animationFrameId","requestAnimationFrame","align","cancelAnimationFrame","handleKeyDown","event","target","dialog","closest","eventOriginatedFromCombobox","contains","shortcutsState","isPaused","rows","getRowModel","rowActive","editing","isEditing","undefined","rowActiveIndex","_rows$tableMeta$rowAc","rowClick","original","rowSelection","document","addEventListener","removeEventListener","handleBlur","isEnabled","handleFocus","handleScroll","columnFreezing","Promise","resolve","e","reject","className","cn","fontSize","size","FontSizes","small","medium","large","style","cssGridStyle","useCssGrid","printing","isPrinting","rowActions","actionsForRowLength","cssVars","useCssVars","rowHeight","height","opacity","columnFreezingStyle","useColumnFreezingStyle","id","headerOffsetStyle","useHeaderOffsetStyle","isServerLoadingAndNotReady","isUsingServer","Toolbar","tableProps","total","left","right","ErrorAlert","tableRef","rowIdentifier","horizontallyScrolled","isHoverStatePaused","columnSizingInfo","isResizingColumn","onBlur","onFocus","onScroll","role","tabIndex","getHeaderGroups","map","headerGroup","key","headers","header","index","hasSeparator","frozenColumnIndex","_headerGroup$headers","isPlaceholder","Fragment","flexRender","column","columnDef","getContext","FocusScope","enableFooter","getFooterGroups","slice","footerGroup","footer","Summary","currentLength","stringifiedChildren","String","children","useMemo"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,SAASA,MAAMA,CAAkBC,CAA2B;EACxD,OAAO,IAAI;AACf;AACAD,MAAM,CAACE,WAAW,GAAG,cAAc;AAEnC,SAASC,KAAKA,CAACF,CAAmB;EAC9B,OAAO,IAAI;AACf;AACAE,KAAK,CAACD,WAAW,GAAG,aAAa;AAEjC,MAAME,KAAK,gBAAGC,eAAe,CAAC,SAASC,MAAMA,CAAkBC,KAAyB,EAAEC,GAAyB;EAC/G,MAAM;IACFC,UAAU,EAAEC,UAAU;IACtBC,cAAc;IACdC,WAAW;IACXC,YAAY;IACZC,sBAAsB,EAAEC;GAC3B,GAAGR,KAAK;EACT,MAAMS,WAAW,GAAGC,YAAY,CAAYT,GAAG,CAAC;EAEhD,MAAM;IAAEU,KAAK;IAAEC;GAAQ,GAAGC,QAAQ,CAAQb,KAAK,EAAES,WAAW,CAAC;EAC7DK,wBAAwB,CAACH,KAAK,EAAEF,WAAW,CAAC;EAE5CM,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIhB,KAAK,CAACiB,SAAS,EAAE;MAAA,IAAAC,oBAAA;MACjB,CAAAA,oBAAA,GAAAT,WAAW,CAACU,OAAO,cAAAD,oBAAA,uBAAnBA,oBAAA,CAAqBE,KAAK,EAAE;;GAEnC,EAAE,EAAE,CAAC;EAEN,MAAM;IAAEC,UAAU;IAAEC;GAAe,GAAGC,sBAAsB,CAAQvB,KAAK,EAAEW,KAAK,EAAEF,WAAW,CAAC;EAC9F,MAAMe,SAAS,GAAGb,KAAK,CAACc,OAAO,CAACC,IAAwB;EACxD,MAAMC,KAAK,GAAGhB,KAAK,CAACiB,QAAQ,EAAE;E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,UAAU,EAAE,CAAC,CACnD,CACpB,CAAC,CACA,CACT,CAAC,EAETlH,MAAM,kBACHG,6BAACsH,OAAO;IAACC,aAAa,EAAE3H,KAAK,CAACkC,WAAW,EAAE,CAACD,IAAI,CAAChC,MAAM;IAAEA,MAAM,EAAEA,MAAM;IAAED,KAAK,EAAEA;IAAS,IACzF,IAAI,CACN,IACN,IAAI,CACT,mBAEHI;IAAKoD,SAAS,EAAC;KAAqDhE,UAAU,gBAAGY,6BAACZ,UAAU,OAAG,GAAG,IAAI,CAAO,CAChH,CACC,CACP;AAEX,CAAC,CAAC;MAOWJ,MAAM,gBAAGD,eAAe,CAAC,SAASC,MAAMA,CAAkBC,KAAyB,EAAEC,GAAyB;EACvH,MAAMsI,mBAAmB,GAAGC,MAAM,CAACxI,KAAK,CAACyI,QAAQ,CAAC;;;EAGlD,MAAMvB,GAAG,GAAGnG,cAAK,CAAC2H,OAAO,CAAC,MAAMF,MAAM,CAAC,WAAW,GAAGD,mBAAmB,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EACjG,oBAAOxH,6BAAClB,KAAK,oBAAYG,KAAK;IAAEkH,GAAG,EAAEA,GAAG;IAAEjH,GAAG,EAAEA;KAAO;AAC1D,CAAC;AACDF,MAAM,CAACN,MAAM,GAAGA,MAAM;AACtBM,MAAM,CAACH,KAAK,GAAGA,KAAK;;;;"}
1
+ {"version":3,"file":"Table3.js","sources":["../../../../../../../src/components/Table3/Table3.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { flexRender, TableMeta } from '@tanstack/react-table';\nimport { FocusScope } from '@react-aria/focus';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { useCssGrid } from './hooks/useCssGrid';\nimport { useTable } from './hooks/useTable';\nimport { useTableRenderStrategy } from './strategies';\nimport { Table3ColumnProps, Table3GroupProps, Table3Props, Table3Ref } from './types';\nimport { Toolbar } from './components/toolbar/Toolbar';\nimport { useColumnFreezingStyle } from './hooks/features/useColumnFreezing';\nimport { useTableRefInstanceSetup } from './hooks/useTableRefInstanceSetup';\nimport { Summary } from './components/columns/footer/Summary';\nimport { useCssVars } from './hooks/useCssVars';\nimport './style.css';\nimport { useHeaderOffsetStyle } from './hooks/features/useHeaderOffsetStyle';\nimport { ErrorAlert } from './components/alert/ErrorAlert';\nimport { fixedForwardRef, FontSizes } from '../../types';\nimport {\n isElementInsideOrTriggeredFromContainer,\n isElementInsideOverlay,\n isElementInteractive,\n isSiblingElementInsideSameParentOverlay,\n} from '../../utils/dom';\n\nfunction Column<TType = unknown>(_: Table3ColumnProps<TType>) {\n return null;\n}\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: Table3GroupProps) {\n return null;\n}\nGroup.displayName = 'Table3Group';\n\nconst Table = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const {\n emptyState: EmptyState,\n customSettings,\n toolbarLeft,\n toolbarRight,\n defaultCurrentRowIndex: defaultRowActiveIndex,\n } = props;\n const internalRef = useMergedRef<Table3Ref>(ref);\n\n const { table, length } = useTable<TType>(props, internalRef);\n useTableRefInstanceSetup(table, internalRef);\n\n React.useEffect(() => {\n if (props.autoFocus) {\n internalRef.current?.focus();\n }\n }, []);\n\n const { renderBody, scrollToIndex } = useTableRenderStrategy<TType>(props, table, internalRef);\n const tableMeta = table.options.meta as TableMeta<TType>;\n const state = table.getState();\n\n const bodyRef = React.useRef<HTMLDivElement | null>(null);\n\n React.useEffect(() => {\n // On a very first render, the tanstack table rendered without any rows,\n // so we delaying default row scrolling logic with using of requestAnimation frame\n const animationFrameId = requestAnimationFrame(() => {\n if (defaultRowActiveIndex) {\n scrollToIndex(defaultRowActiveIndex, { align: 'center' });\n }\n });\n\n return () => {\n cancelAnimationFrame(animationFrameId);\n };\n }, []);\n\n React.useEffect(\n () => {\n const handleKeyDown = (event: KeyboardEvent) => {\n const trigger = event.target as HTMLElement;\n // Select2 also have combobox role to align with W3C guidelines\n const eventOriginatedFromCombobox = !!trigger.closest('[role=\"combobox\"]:not([data-taco=\"Select2\"])');\n\n if (\n tableMeta.shortcutsState.isPaused ||\n (isElementInsideOverlay(trigger) && !isSiblingElementInsideSameParentOverlay(trigger, internalRef.current)) ||\n (isElementInteractive(trigger) && !isElementInsideOrTriggeredFromContainer(trigger, internalRef.current)) ||\n eventOriginatedFromCombobox\n ) {\n return;\n }\n\n const rows = table.getRowModel().rows;\n\n tableMeta.rowActive.handleKeyDown(\n event,\n rows.length,\n scrollToIndex,\n tableMeta.editing.isEditing ? undefined : internalRef\n );\n if (tableMeta.rowActive.rowActiveIndex !== undefined) {\n tableMeta.rowClick.handleKeyDown(event, rows[tableMeta.rowActive.rowActiveIndex]?.original);\n }\n tableMeta.rowSelection.handleKeyDown(event, table);\n tableMeta.editing.handleKeyDown(event);\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n },\n // See https://github.com/e-conomic/taco/blob/dev/packages/taco/src/components/Table3/strategies/virtualised.tsx#L143\n // scrollToIndex function changes when row count changes, so it is important to update handlers with new\n // scrollToIndex function.\n [scrollToIndex, tableMeta.editing.isEditing, internalRef.current, tableMeta.rowActive.rowActiveIndex]\n );\n\n const handleBlur = tableMeta.editing.isEnabled\n ? (event: React.FocusEvent) => {\n tableMeta.editing.handleBlur(event);\n }\n : undefined;\n\n const handleFocus =\n tableMeta.rowActive.rowActiveIndex === undefined\n ? (event: React.FocusEvent) => {\n tableMeta.rowActive.handleFocus(event, table.getRowModel().rows.length, scrollToIndex);\n }\n : undefined;\n\n const handleScroll = async (event: React.MouseEvent<HTMLDivElement>) => {\n // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel\n tableMeta.columnFreezing.handleScroll(event);\n };\n\n const className = cn(\n 'border-grey-300 relative grid h-full w-full flex-grow overflow-auto rounded border bg-white scroll-mt-[41px] focus-visible:outline-none',\n '[&[data-resizing=\"true\"]]:select-none',\n {\n 'text-xs': tableMeta.fontSize.size === FontSizes.small,\n 'text-sm': tableMeta.fontSize.size === FontSizes.medium,\n 'text-base': tableMeta.fontSize.size === FontSizes.large,\n }\n );\n\n // Print tables have \"_print\" as the postfix for the table id, so we can use the it to determine\n // if the table is a print table or not.\n const { style: cssGridStyle } = useCssGrid<TType>(\n table,\n tableMeta.printing.isPrinting,\n // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel\n tableMeta.rowActions.actionsForRowLength,\n tableMeta.fontSize.size\n );\n const { style: cssVars } = useCssVars(tableMeta.rowHeight.height, tableMeta.fontSize.size);\n\n const style = {\n ...cssVars,\n ...cssGridStyle,\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n opacity: 0.999,\n };\n\n const columnFreezingStyle = useColumnFreezingStyle(props.id, table);\n const headerOffsetStyle = useHeaderOffsetStyle(props.id, table);\n const isServerLoadingAndNotReady = tableMeta.isUsingServer && props.length === undefined;\n\n return (\n <>\n {columnFreezingStyle ? <style data-taco=\"table3-column-freezing-styles\">{columnFreezingStyle}</style> : null}\n {headerOffsetStyle && !tableMeta.printing.isPrinting ? (\n <style data-taco=\"table3-column-header-offset-styles\">{headerOffsetStyle}</style>\n ) : null}\n <Toolbar\n table={table}\n tableProps={props}\n total={length}\n left={toolbarLeft}\n right={toolbarRight}\n customSettings={customSettings}\n scrollToIndex={scrollToIndex}\n />\n <ErrorAlert table={table} tableRef={internalRef} scrollToIndex={scrollToIndex} rowIdentifier={props.rowIdentifier} />\n <div\n className={className}\n id={props.id}\n data-font-size={tableMeta.fontSize.size}\n data-editing={tableMeta.editing.isEditing}\n // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel\n data-horizontally-scrolled={tableMeta.columnFreezing.horizontallyScrolled}\n data-pause-hover={tableMeta?.rowActive.isHoverStatePaused}\n data-resizing={!!state.columnSizingInfo.isResizingColumn}\n data-taco=\"table2\"\n onBlur={handleBlur}\n onFocus={handleFocus}\n onScroll={handleScroll}\n ref={internalRef}\n role=\"table\"\n style={style}\n tabIndex={-1}>\n {isServerLoadingAndNotReady ? null : (\n <div className=\"group/header contents\" data-taco=\"table2-header\" role=\"rowgroup\">\n {table.getHeaderGroups().map(headerGroup => (\n <div className=\"contents\" key={headerGroup.id} role=\"row\">\n {headerGroup.headers.map((header, index) => {\n // We need to render separator if column is not the last in array, if index is not equal to freeze column index,\n // if next element is not placeholder and if column itself is not placeholder.\n const hasSeparator =\n // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel\n index !== tableMeta.columnFreezing.frozenColumnIndex &&\n index !== headerGroup.headers.length - 1 &&\n (!headerGroup.headers[index + 1]?.isPlaceholder || !header.isPlaceholder);\n return (\n <React.Fragment key={header.id}>\n {flexRender(header.column.columnDef.header, {\n ...header.getContext(),\n scrollToIndex,\n hasSeparator,\n })}\n </React.Fragment>\n );\n })}\n </div>\n ))}\n </div>\n )}\n {table.getRowModel().rows.length ? (\n <>\n <FocusScope autoFocus={tableMeta.editing.isEditing}>\n <div className=\"group/body contents\" data-taco=\"table2-body\" role=\"rowgroup\" ref={bodyRef}>\n {renderBody()}\n </div>\n </FocusScope>\n {/* This div makes sure that there is always a free space between the rows and footer when\n table height exceeds the cumulative height of all rows. See useCSSGrid.ts */}\n {/* By vertically translating the div a pixel down, we hide the div border below footer so that\n the footer border doesn't appear an extra pixel thick */}\n <div\n className={cn('border-grey-300 col-span-full border-t', { 'translate-y-px': tableMeta.enableFooter })}\n />\n {tableMeta.enableFooter ? (\n <div className=\"group/footer contents\" data-taco=\"table2-footer\" role=\"rowgroup\">\n {\n // Render the footer cell only for individual columns, excluding column groups.\n table\n .getFooterGroups()\n .slice(0, 1)\n .map(footerGroup => (\n <div className=\"contents\" key={footerGroup.id} role=\"row\">\n {footerGroup.headers.map(footer => (\n <React.Fragment key={footer.id}>\n {flexRender(footer.column.columnDef.footer, footer.getContext())}\n </React.Fragment>\n ))}\n </div>\n ))\n }\n {length ? (\n <Summary currentLength={table.getRowModel().rows.length} length={length} table={table} />\n ) : null}\n </div>\n ) : null}\n </>\n ) : (\n <div className=\"col-span-full box-border min-h-[theme(spacing.8)]\">{EmptyState ? <EmptyState /> : null}</div>\n )}\n </div>\n </>\n );\n});\n\ntype Table3WithStatics = (<TType = unknown>(props: Table3Props<TType> & React.RefAttributes<Table3Ref>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\n\nexport const Table3 = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n return <Table<TType> {...props} key={key} ref={ref} />;\n}) as Table3WithStatics;\nTable3.Column = Column;\nTable3.Group = Group;\n\n// hooks\nexport { useTable3DataLoader } from './hooks/useTableDataLoader';\n\n// types\nexport type {\n useTable3DataFetcher,\n useTable3DataOptions,\n useTable3DataFetcherValues as useTableDataValues,\n} from './hooks/useTableDataLoader';\n\nexport type {\n Table3Ref,\n Table3Props,\n Table3Preset,\n Table3Settings,\n Table3SettingsHandler,\n Table3RowHeight,\n Table3FilterComparator,\n Table3FilterHandler,\n Table3LoadPageHandler,\n Table3LoadAllHandler,\n Table3RowGotoHandler,\n Table3SortHandler,\n Table3Shortcuts,\n Table3ShortcutHandlerFn,\n Table3ShortcutHandlerObject,\n Table3SortDirection,\n Table3SortFn,\n Table3RowActionRenderer,\n Table3RowSelectionHandler,\n Table3RowExpansionRenderer,\n Table3RowDropHandler,\n Table3RowDragHandler,\n Table3RowClickHandler,\n Table3ColumnProps,\n Table3ColumnAlignment,\n Table3ColumnDataType,\n Table3ColumnHeaderMenu,\n Table3ColumnClassNameHandler,\n Table3ColumnFooterRenderer,\n Table3ColumnRenderer,\n Table3ColumnControlRenderer,\n Table3ColumnControlProps,\n} from './types';\n"],"names":["Column","_","displayName","Group","Table","fixedForwardRef","Table3","props","ref","emptyState","EmptyState","customSettings","toolbarLeft","toolbarRight","defaultCurrentRowIndex","defaultRowActiveIndex","internalRef","useMergedRef","table","length","useTable","useTableRefInstanceSetup","React","useEffect","autoFocus","_internalRef$current","current","focus","renderBody","scrollToIndex","useTableRenderStrategy","tableMeta","options","meta","state","getState","bodyRef","useRef","animationFrameId","requestAnimationFrame","align","cancelAnimationFrame","handleKeyDown","event","trigger","target","eventOriginatedFromCombobox","closest","shortcutsState","isPaused","isElementInsideOverlay","isSiblingElementInsideSameParentOverlay","isElementInteractive","isElementInsideOrTriggeredFromContainer","rows","getRowModel","rowActive","editing","isEditing","undefined","rowActiveIndex","_rows$tableMeta$rowAc","rowClick","original","rowSelection","document","addEventListener","removeEventListener","handleBlur","isEnabled","handleFocus","handleScroll","columnFreezing","Promise","resolve","e","reject","className","cn","fontSize","size","FontSizes","small","medium","large","style","cssGridStyle","useCssGrid","printing","isPrinting","rowActions","actionsForRowLength","cssVars","useCssVars","rowHeight","height","opacity","columnFreezingStyle","useColumnFreezingStyle","id","headerOffsetStyle","useHeaderOffsetStyle","isServerLoadingAndNotReady","isUsingServer","Toolbar","tableProps","total","left","right","ErrorAlert","tableRef","rowIdentifier","horizontallyScrolled","isHoverStatePaused","columnSizingInfo","isResizingColumn","onBlur","onFocus","onScroll","role","tabIndex","getHeaderGroups","map","headerGroup","key","headers","header","index","hasSeparator","frozenColumnIndex","_headerGroup$headers","isPlaceholder","Fragment","flexRender","column","columnDef","getContext","FocusScope","enableFooter","getFooterGroups","slice","footerGroup","footer","Summary","currentLength","stringifiedChildren","String","children","useMemo"],"mappings":";;;;;;;;;;;;;;;;;;;AAyBA,SAASA,MAAMA,CAAkBC,CAA2B;EACxD,OAAO,IAAI;AACf;AACAD,MAAM,CAACE,WAAW,GAAG,cAAc;AAEnC,SAASC,KAAKA,CAACF,CAAmB;EAC9B,OAAO,IAAI;AACf;AACAE,K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