@economic/taco 2.15.0 → 2.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. package/dist/components/Drawer/Drawer.d.ts +5 -1
  2. package/dist/components/Provider/Localization.d.ts +19 -0
  3. package/dist/components/SearchInput2/SearchInput2.d.ts +1 -0
  4. package/dist/components/Table3/Table3.d.ts +0 -2
  5. package/dist/components/Table3/components/alert/ErrorAlert.d.ts +10 -0
  6. package/dist/components/Table3/components/columns/cell/DisplayCell.d.ts +5 -2
  7. package/dist/components/Table3/components/columns/cell/EditingCell.d.ts +3 -0
  8. package/dist/components/Table3/components/columns/cell/EditingControl.d.ts +1 -1
  9. package/dist/components/Table3/components/columns/cell/Highlight.d.ts +2 -0
  10. package/dist/components/Table3/components/columns/header/Header.d.ts +1 -1
  11. package/dist/components/Table3/components/columns/internal/EditingActions.d.ts +1 -1
  12. package/dist/components/Table3/components/columns/styles.d.ts +2 -2
  13. package/dist/components/Table3/components/rows/Row.d.ts +5 -1
  14. package/dist/components/Table3/components/rows/RowContext.d.ts +1 -0
  15. package/dist/components/Table3/hooks/features/useEditing.d.ts +12 -11
  16. package/dist/components/Table3/hooks/features/{usePauseHoverState.d.ts → usePauseShortcuts.d.ts} +1 -2
  17. package/dist/components/Table3/hooks/features/useSearch.d.ts +3 -3
  18. package/dist/components/Table3/hooks/features/useValidation.d.ts +13 -0
  19. package/dist/components/Table3/hooks/useTable.d.ts +25 -20
  20. package/dist/components/Table3/types.d.ts +41 -19
  21. package/dist/components/Table3/util/editing.d.ts +6 -0
  22. package/dist/components/Table3/util/scrolling.d.ts +2 -0
  23. package/dist/esm/index.css +108 -33
  24. package/dist/esm/packages/taco/src/components/Banner/Banner.js +2 -2
  25. package/dist/esm/packages/taco/src/components/Banner/Banner.js.map +1 -1
  26. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js +4 -4
  27. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
  28. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +3 -3
  29. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +2 -1
  31. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +6 -6
  33. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +3 -3
  35. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +7 -2
  37. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -1
  38. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +7 -7
  39. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
  40. package/dist/esm/packages/taco/src/components/Field/Field.js +2 -2
  41. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  42. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js +2 -2
  43. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js.map +1 -1
  44. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +4 -4
  45. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
  46. package/dist/esm/packages/taco/src/components/Header/components/Link.js +2 -2
  47. package/dist/esm/packages/taco/src/components/Header/components/Link.js.map +1 -1
  48. package/dist/esm/packages/taco/src/components/Icon/Icon.js +2 -2
  49. package/dist/esm/packages/taco/src/components/Icon/Icon.js.map +1 -1
  50. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js +2 -2
  51. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +6 -6
  53. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
  54. package/dist/esm/packages/taco/src/components/Menu/components/Item.js +4 -4
  55. package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
  56. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js +2 -2
  57. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js.map +1 -1
  58. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js +3 -3
  59. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js.map +1 -1
  60. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js +2 -2
  61. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js.map +1 -1
  62. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +1 -1
  63. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
  64. package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js +2 -2
  65. package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js.map +1 -1
  66. package/dist/esm/packages/taco/src/components/Pagination/Pagination.js +5 -5
  67. package/dist/esm/packages/taco/src/components/Pagination/Pagination.js.map +1 -1
  68. package/dist/esm/packages/taco/src/components/Popover/Popover.js +2 -2
  69. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  70. package/dist/esm/packages/taco/src/components/Provider/Localization.js +19 -0
  71. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  72. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js +2 -2
  73. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js.map +1 -1
  74. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +12 -8
  75. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  76. package/dist/esm/packages/taco/src/components/Select/useSelect.js +2 -2
  77. package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
  78. package/dist/esm/packages/taco/src/components/Select2/Select2.js +7 -7
  79. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  80. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +8 -8
  81. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  82. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +5 -5
  83. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  84. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +10 -10
  85. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  86. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +2 -2
  87. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
  88. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js +3 -3
  89. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js.map +1 -1
  90. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +2 -2
  91. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
  92. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +10 -10
  93. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js.map +1 -1
  94. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js +2 -2
  95. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js.map +1 -1
  96. package/dist/esm/packages/taco/src/components/Table3/Table3.js +37 -30
  97. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  98. package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js +154 -0
  99. package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js.map +1 -0
  100. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +54 -9
  101. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
  102. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +9 -57
  103. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
  104. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +72 -41
  105. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  106. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +41 -17
  107. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
  108. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js +41 -0
  109. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js.map +1 -0
  110. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +23 -14
  111. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
  112. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js +3 -3
  113. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js.map +1 -1
  114. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js +1 -1
  115. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js.map +1 -1
  116. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +9 -9
  117. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
  118. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +37 -6
  119. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
  120. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +12 -12
  121. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
  122. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js +2 -2
  123. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js.map +1 -1
  124. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +63 -23
  125. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js.map +1 -1
  126. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js +3 -3
  127. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js.map +1 -1
  128. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +3 -3
  129. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
  130. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js +2 -13
  131. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js.map +1 -1
  132. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +67 -57
  133. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
  134. package/dist/esm/packages/taco/src/components/Table3/components/rows/RowContext.js +2 -1
  135. package/dist/esm/packages/taco/src/components/Table3/components/rows/RowContext.js.map +1 -1
  136. package/dist/esm/packages/taco/src/components/Table3/components/rows/SkeletonRow.js +2 -2
  137. package/dist/esm/packages/taco/src/components/Table3/components/rows/SkeletonRow.js.map +1 -1
  138. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +8 -6
  139. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js.map +1 -1
  140. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +23 -8
  141. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
  142. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js +2 -2
  143. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js.map +1 -1
  144. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +2 -2
  145. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js.map +1 -1
  146. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +16 -16
  147. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
  148. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +1 -0
  149. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
  150. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +53 -4
  151. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
  152. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js +8 -8
  153. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js.map +1 -1
  154. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js +185 -101
  155. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js.map +1 -1
  156. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseShortcuts.js +12 -0
  157. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseShortcuts.js.map +1 -0
  158. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSearch.js +4 -2
  159. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSearch.js.map +1 -1
  160. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useValidation.js +178 -0
  161. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useValidation.js.map +1 -0
  162. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js +3 -3
  163. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js.map +1 -1
  164. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +1 -49
  165. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
  166. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +1 -2
  167. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
  168. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js +0 -2
  169. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js.map +1 -1
  170. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +135 -111
  171. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  172. package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js +4 -4
  173. package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js.map +1 -1
  174. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  175. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +21 -1
  176. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  177. package/dist/esm/packages/taco/src/components/Table3/util/scrolling.js +53 -0
  178. package/dist/esm/packages/taco/src/components/Table3/util/scrolling.js.map +1 -0
  179. package/dist/esm/packages/taco/src/components/Tag/Tag.js +4 -4
  180. package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
  181. package/dist/esm/packages/taco/src/components/Toast/Toaster.js +2 -2
  182. package/dist/esm/packages/taco/src/components/Toast/Toaster.js.map +1 -1
  183. package/dist/esm/packages/taco/src/components/Tour/Tour.js +4 -4
  184. package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
  185. package/dist/esm/packages/taco/src/components/Treeview/Treeview.js +2 -2
  186. package/dist/esm/packages/taco/src/components/Treeview/Treeview.js.map +1 -1
  187. package/dist/esm/packages/taco/src/index.js +2 -1
  188. package/dist/esm/packages/taco/src/index.js.map +1 -1
  189. package/dist/esm/packages/taco/src/primitives/Table/types.js +10 -0
  190. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -0
  191. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js +8 -0
  192. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js.map +1 -0
  193. package/dist/esm/packages/taco/src/{components/Table3/hooks/features/useFontSize.js → primitives/Table/useTable/features/useTableFontSize.js} +3 -3
  194. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFontSize.js.map +1 -0
  195. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js +14 -0
  196. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +1 -0
  197. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js +100 -0
  198. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js.map +1 -0
  199. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowClick.js +30 -0
  200. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowClick.js.map +1 -0
  201. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js +9 -0
  202. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js.map +1 -0
  203. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowHeight.js +13 -0
  204. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowHeight.js.map +1 -0
  205. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js +32 -0
  206. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js.map +1 -0
  207. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js +11 -0
  208. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js.map +1 -0
  209. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableDataListener.js +15 -0
  210. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableDataListener.js.map +1 -0
  211. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useFilteringStateListener.js → primitives/Table/useTable/listeners/useTableFilterListener.js} +3 -3
  212. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFilterListener.js.map +1 -0
  213. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFontSizeListener.js +40 -0
  214. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFontSizeListener.js.map +1 -0
  215. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useRowSelectionListener.js → primitives/Table/useTable/listeners/useTableRowSelectionListener.js} +5 -6
  216. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowSelectionListener.js.map +1 -0
  217. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useServerLoadingListener.js → primitives/Table/useTable/listeners/useTableServerLoadingListener.js} +3 -3
  218. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableServerLoadingListener.js.map +1 -0
  219. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useShortcutsListener.js → primitives/Table/useTable/listeners/useTableShortcutsListener.js} +7 -7
  220. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableShortcutsListener.js.map +1 -0
  221. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useSortingStateListener.js → primitives/Table/useTable/listeners/useTableSortingListener.js} +6 -4
  222. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSortingListener.js.map +1 -0
  223. package/dist/esm/packages/taco/src/{components/Table3/hooks/features/useColumnOrdering.js → primitives/Table/useTable/util/columns.js} +24 -15
  224. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -0
  225. package/dist/esm/packages/taco/src/types.js +6 -0
  226. package/dist/esm/packages/taco/src/types.js.map +1 -0
  227. package/dist/esm/packages/taco/src/utils/date.js +0 -1
  228. package/dist/esm/packages/taco/src/utils/date.js.map +1 -1
  229. package/dist/index.css +108 -33
  230. package/dist/primitives/Table/types.d.ts +35 -0
  231. package/dist/primitives/Table/useTable/features/useTableColumnOrdering.d.ts +3 -0
  232. package/dist/primitives/Table/useTable/features/useTableFontSize.d.ts +7 -0
  233. package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +7 -0
  234. package/dist/primitives/Table/useTable/features/useTableRowActive.d.ts +12 -0
  235. package/dist/primitives/Table/useTable/features/useTableRowClick.d.ts +7 -0
  236. package/dist/primitives/Table/useTable/features/useTableRowGoto.d.ts +5 -0
  237. package/dist/primitives/Table/useTable/features/useTableRowHeight.d.ts +7 -0
  238. package/dist/primitives/Table/useTable/features/useTableRowSelection.d.ts +6 -0
  239. package/dist/primitives/Table/useTable/features/useTableServerLoading.d.ts +6 -0
  240. package/dist/primitives/Table/useTable/listeners/useTableDataListener.d.ts +2 -0
  241. package/dist/primitives/Table/useTable/listeners/useTableFilterListener.d.ts +3 -0
  242. package/dist/primitives/Table/useTable/listeners/useTableFontSizeListener.d.ts +2 -0
  243. package/dist/primitives/Table/useTable/listeners/useTableRowSelectionListener.d.ts +3 -0
  244. package/dist/primitives/Table/useTable/listeners/useTableServerLoadingListener.d.ts +3 -0
  245. package/dist/primitives/Table/useTable/listeners/useTableShortcutsListener.d.ts +3 -0
  246. package/dist/primitives/Table/useTable/listeners/useTableSortingListener.d.ts +3 -0
  247. package/dist/primitives/Table/useTable/util/columns.d.ts +4 -0
  248. package/dist/taco.cjs.development.js +2294 -1543
  249. package/dist/taco.cjs.development.js.map +1 -1
  250. package/dist/taco.cjs.production.min.js +1 -1
  251. package/dist/taco.cjs.production.min.js.map +1 -1
  252. package/dist/types.d.ts +5 -0
  253. package/package.json +3 -3
  254. package/types.json +13547 -12953
  255. package/dist/components/Table3/hooks/features/useColumnOrdering.d.ts +0 -6
  256. package/dist/components/Table3/hooks/features/useCurrentRow.d.ts +0 -11
  257. package/dist/components/Table3/hooks/features/useFontSize.d.ts +0 -7
  258. package/dist/components/Table3/hooks/features/usePrinting.d.ts +0 -8
  259. package/dist/components/Table3/hooks/features/useRowClick.d.ts +0 -6
  260. package/dist/components/Table3/hooks/features/useRowGoto.d.ts +0 -5
  261. package/dist/components/Table3/hooks/features/useRowHeight.d.ts +0 -7
  262. package/dist/components/Table3/hooks/features/useRowSelection.d.ts +0 -6
  263. package/dist/components/Table3/hooks/listeners/useCurrentRowListener.d.ts +0 -2
  264. package/dist/components/Table3/hooks/listeners/useFilteringStateListener.d.ts +0 -3
  265. package/dist/components/Table3/hooks/listeners/useRowSelectionListener.d.ts +0 -3
  266. package/dist/components/Table3/hooks/listeners/useServerLoadingListener.d.ts +0 -3
  267. package/dist/components/Table3/hooks/listeners/useShortcutsListener.d.ts +0 -3
  268. package/dist/components/Table3/hooks/listeners/useSortingStateListener.d.ts +0 -3
  269. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnOrdering.js.map +0 -1
  270. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js +0 -93
  271. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js.map +0 -1
  272. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useFontSize.js.map +0 -1
  273. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseHoverState.js +0 -22
  274. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseHoverState.js.map +0 -1
  275. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePrinting.js +0 -14
  276. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePrinting.js.map +0 -1
  277. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js +0 -25
  278. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js.map +0 -1
  279. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowGoto.js +0 -9
  280. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowGoto.js.map +0 -1
  281. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowHeight.js +0 -27
  282. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowHeight.js.map +0 -1
  283. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js +0 -32
  284. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js.map +0 -1
  285. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js +0 -15
  286. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js.map +0 -1
  287. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useFilteringStateListener.js.map +0 -1
  288. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useRowSelectionListener.js.map +0 -1
  289. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useServerLoadingListener.js.map +0 -1
  290. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useShortcutsListener.js.map +0 -1
  291. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSortingStateListener.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Menu.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Header as RTHeader, Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Menu as MenuPrimitive } from '../../../../Menu/Menu';\nimport { isInternalColumn } from '../../../util/columns';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Table3ColumnHeaderMenu, TableStrategy } from '../../../types';\nimport { GotoPopover } from './Goto';\nimport { HeaderSortDirection, SORT_DIRECTION, SortToggleHandler } from './Header';\nimport { RadioGroupItemValue } from '../../../../RadioGroup/RadioGroup';\n\nexport function isGotoAvailable<TType = unknown>(table: RTable<TType>, header: RTHeader<TType, unknown>) {\n if (isInternalColumn(header.id)) {\n return false;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return !!(tableMeta.rowGoto.isEnabled && header.column.getCanSort() && header.column.getIsSorted());\n}\n\nexport function isMenuAvailable<TType = unknown>(table: RTable<TType>, header: RTHeader<TType, unknown>): boolean {\n if (isInternalColumn(header.id)) {\n return false;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return (\n !!header.column.columnDef.meta?.menu ||\n !!tableMeta.columnFreezing.isEnabled ||\n (!!table.options.enableHiding && !!header.column.getCanHide()) ||\n isGotoAvailable(table, header)\n );\n}\n\nexport type MenuProps<TType = unknown> = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n canFreeze: boolean;\n canHide: boolean;\n canSort: boolean;\n index: number;\n menu?: Table3ColumnHeaderMenu;\n onGoto?: (query: string) => Promise<number>;\n onHide: (event: unknown) => void;\n onSortToggle: SortToggleHandler;\n scrollToIndex: TableStrategy['scrollToIndex'];\n sortDirection: HeaderSortDirection;\n table: RTable<TType>;\n};\n\nexport function Menu<TType = unknown>(props: MenuProps<TType>) {\n const {\n canFreeze,\n canHide,\n canSort,\n index,\n menu,\n onGoto: handleGoto,\n onHide: handleHide,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n sortDirection,\n table,\n } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n const { texts } = useLocalization();\n const [popover, setPopover] = React.useState<string | undefined>(undefined);\n const [sortDirectionState, setSortDirectionState] = React.useState<HeaderSortDirection>(sortDirection);\n\n const handleSortMenuRadioGroupChange = (newSortDirection: RadioGroupItemValue) => {\n setSortDirectionState(newSortDirection as HeaderSortDirection);\n handleSortToggle(newSortDirection as HeaderSortDirection);\n };\n\n let popoverElement;\n\n if (popover) {\n const handleClosePopover = () => setPopover(undefined);\n\n switch (popover) {\n case 'goto': {\n if (handleGoto) {\n const goto = async (query: string) => {\n try {\n const index = await handleGoto(query);\n tableMeta.currentRow.setCurrentRowIndex(index);\n scrollToIndex(index + 2, { align: 'center' });\n } catch {\n //\n } finally {\n handleClosePopover();\n }\n };\n popoverElement = props => <GotoPopover {...props} open onChange={handleClosePopover} onGoto={goto} />;\n }\n }\n }\n }\n\n const className = cn(\n '-my-0.5 -mr-1 -ml-0.5 !h-6 !min-h-[theme(spacing.6)] flex-shrink-0 justify-end !w-0 !min-w-0 !overflow-hidden',\n 'aria-expanded:!min-w-[theme(spacing.6)] aria-expanded:!w-6 aria-expanded:!overflow-auto',\n 'focus:!min-w-[theme(spacing.6)] focus:!w-6 focus:!overflow-auto',\n 'group-hover/column:!min-w-[theme(spacing.6)] group-hover/column:!w-6 group-hover/column:!overflow-auto',\n {\n '!w-6 !min-w-[theme(spacing.6)] !overflow-auto': !!popoverElement,\n },\n props.className\n );\n\n const memoedMenuItems = React.useMemo(() => {\n const menuItems: JSX.Element[] = [];\n\n if (canHide) {\n // we do this in the next tick, otherwise the menu closes and react throws a \"state update on unmounted component\" error\n const handleClick = event => setTimeout(() => handleHide(event), 1);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"eye-off\" onClick={handleClick}>\n {texts.table3.columns.menu.hideColumn}\n </MenuPrimitive.Item>\n );\n }\n\n // We rely on canSort value instead of onSort function's value because some columns might have sorting disabled,\n // so even though onSort is truthy, we don't want to show sorting menu.\n if (canSort) {\n menuItems.push(\n <MenuPrimitive.Item\n icon=\"sort-by\"\n subMenu={() => (\n <MenuPrimitive.SubMenu>\n <MenuPrimitive.RadioGroup onChange={handleSortMenuRadioGroupChange} value={sortDirectionState}>\n <MenuPrimitive.RadioGroup.Item value={SORT_DIRECTION.ASC}>\n {texts.table3.columns.menu.sortingOrder.ascending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={SORT_DIRECTION.DESC}>\n {texts.table3.columns.menu.sortingOrder.descending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={false}>\n {texts.table3.columns.menu.sortingOrder.unsorted}\n </MenuPrimitive.RadioGroup.Item>\n </MenuPrimitive.RadioGroup>\n </MenuPrimitive.SubMenu>\n )}>\n {texts.table3.columns.menu.sorting}\n </MenuPrimitive.Item>\n );\n }\n\n if (handleGoto) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"move\" onClick={() => setPopover('goto')} shortcut=\"g\">\n {texts.table3.columns.menu.gotoRow}...\n </MenuPrimitive.Item>\n );\n }\n\n if (canFreeze) {\n const frozenIndex = index - tableMeta.columnFreezing.frozenInternalColumnCount;\n const handleClick = () => tableMeta.columnFreezing.setFrozenColumnIndex(frozenIndex);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-freeze\" onClick={handleClick}>\n {frozenIndex === 0\n ? texts.table3.columns.menu.freezeFirstColumn\n : texts.table3.columns.menu.freezeUptoColumn.replace('[TOTAL]', String(frozenIndex + 1))}\n </MenuPrimitive.Item>\n );\n\n if (tableMeta.columnFreezing.frozenColumnIndex !== undefined) {\n const handleClick = () => {\n tableMeta.columnFreezing.setFrozenColumnIndex(undefined);\n };\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-unfreeze\" onClick={handleClick}>\n {texts.table3.columns.menu.unfreezeColumns}\n </MenuPrimitive.Item>\n );\n }\n }\n\n if (menu) {\n const customMenu = menu({ trigger: undefined });\n const customItems = React.Children.toArray(customMenu.props.children.props.children) as JSX.Element[];\n\n if (customItems.length) {\n if (menuItems.length) {\n menuItems.push(<MenuPrimitive.Separator />);\n }\n\n menuItems.push(...customItems);\n }\n }\n\n return menuItems.map((item, key) => React.cloneElement(item, { key }));\n }, [\n menu,\n index,\n canFreeze,\n canHide,\n canSort,\n handleGoto,\n handleSortToggle,\n sortDirection,\n tableMeta.columnFreezing.frozenColumnIndex,\n ]);\n\n return (\n <IconButton\n className={className}\n icon=\"more\"\n menu={\n popoverElement\n ? undefined\n : menuProps => (\n <MenuPrimitive {...menuProps}>\n <MenuPrimitive.Content>{memoedMenuItems}</MenuPrimitive.Content>\n </MenuPrimitive>\n )\n }\n popover={popoverElement}\n onClickCapture={event => event.preventDefault()}\n />\n );\n}\n"],"names":["isGotoAvailable","table","header","isInternalColumn","id","tableMeta","options","meta","rowGoto","isEnabled","column","getCanSort","getIsSorted","isMenuAvailable","_header$column$column","columnDef","menu","columnFreezing","enableHiding","getCanHide","Menu","props","canFreeze","canHide","canSort","index","onGoto","handleGoto","onHide","handleHide","onSortToggle","handleSortToggle","scrollToIndex","sortDirection","texts","useLocalization","popover","setPopover","React","useState","undefined","sortDirectionState","setSortDirectionState","handleSortMenuRadioGroupChange","newSortDirection","popoverElement","handleClosePopover","goto","query","Promise","resolve","then","currentRow","setCurrentRowIndex","align","_wasThrown","_result","_temp","e","reject","GotoPopover","open","onChange","className","cn","memoedMenuItems","useMemo","menuItems","handleClick","event","setTimeout","push","MenuPrimitive","Item","icon","onClick","table3","columns","hideColumn","subMenu","SubMenu","RadioGroup","value","SORT_DIRECTION","ASC","sortingOrder","ascending","DESC","descending","unsorted","sorting","shortcut","gotoRow","frozenIndex","frozenInternalColumnCount","setFrozenColumnIndex","freezeFirstColumn","freezeUptoColumn","replace","String","frozenColumnIndex","unfreezeColumns","customMenu","trigger","customItems","Children","toArray","children","length","Separator","map","item","key","cloneElement","IconButton","menuProps","Content","onClickCapture","preventDefault"],"mappings":";;;;;;;;;;SAYgBA,eAAeA,CAAkBC,KAAoB,EAAEC,MAAgC;EACnG,IAAIC,gBAAgB,CAACD,MAAM,CAACE,EAAE,CAAC,EAAE;IAC7B,OAAO,KAAK;;EAGhB,MAAMC,SAAS,GAAGJ,KAAK,CAACK,OAAO,CAACC,IAAwB;EAExD,OAAO,CAAC,EAAEF,SAAS,CAACG,OAAO,CAACC,SAAS,IAAIP,MAAM,CAACQ,MAAM,CAACC,UAAU,EAAE,IAAIT,MAAM,CAACQ,MAAM,CAACE,WAAW,EAAE,CAAC;AACvG;SAEgBC,eAAeA,CAAkBZ,KAAoB,EAAEC,MAAgC;;EACnG,IAAIC,gBAAgB,CAACD,MAAM,CAACE,EAAE,CAAC,EAAE;IAC7B,OAAO,KAAK;;EAGhB,MAAMC,SAAS,GAAGJ,KAAK,CAACK,OAAO,CAACC,IAAwB;EAExD,OACI,CAAC,GAAAO,qBAAA,GAACZ,MAAM,CAACQ,MAAM,CAACK,SAAS,CAACR,IAAI,cAAAO,qBAAA,eAA5BA,qBAAA,CAA8BE,IAAI,KACpC,CAAC,CAACX,SAAS,CAACY,cAAc,CAACR,SAAS,IACnC,CAAC,CAACR,KAAK,CAACK,OAAO,CAACY,YAAY,IAAI,CAAC,CAAChB,MAAM,CAACQ,MAAM,CAACS,UAAU,EAAG,IAC9DnB,eAAe,CAACC,KAAK,EAAEC,MAAM,CAAC;AAEtC;SAgBgBkB,IAAIA,CAAkBC,KAAuB;EACzD,MAAM;IACFC,SAAS;IACTC,OAAO;IACPC,OAAO;IACPC,K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MAAa,oBAAK2C,SAAS,gBACxB7E,6BAACkC,MAAa,CAAC4C,OAAO,QAAEnD,eAAe,CAAyB,CAEvE;IAEX7B,OAAO,EAAES,cAAc;IACvBwE,cAAc,EAAEhD,KAAK,IAAIA,KAAK,CAACiD,cAAc;IAC/C;AAEV;;;;"}
1
+ {"version":3,"file":"Menu.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Menu.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Header as RTHeader, Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Menu as MenuPrimitive } from '../../../../Menu/Menu';\nimport { isInternalColumn } from '../../../util/columns';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Table3ColumnHeaderMenu, TableStrategy } from '../../../types';\nimport { GotoPopover } from './Goto';\nimport { HeaderSortDirection, SORT_DIRECTION, SortToggleHandler } from './Header';\nimport { RadioGroupItemValue } from '../../../../RadioGroup/RadioGroup';\nimport { createShortcutKeyDownHandler } from '../../../../../utils/keyboard';\nimport { getTableLeftScrollDistance } from '../../../util/scrolling';\n\nexport function isGotoAvailable<TType = unknown>(table: RTable<TType>, header: RTHeader<TType, unknown>) {\n if (isInternalColumn(header.id)) {\n return false;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return !!(tableMeta.rowGoto.isEnabled && header.column.getCanSort() && header.column.getIsSorted());\n}\n\nexport function isMenuAvailable<TType = unknown>(table: RTable<TType>, header: RTHeader<TType, unknown>): boolean {\n if (isInternalColumn(header.id)) {\n return false;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return (\n !!header.column.columnDef.meta?.menu ||\n !!tableMeta.columnFreezing.isEnabled ||\n (!!table.options.enableHiding && !!header.column.getCanHide()) ||\n isGotoAvailable(table, header)\n );\n}\n\nexport type MenuProps<TType = unknown> = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n canFreeze: boolean;\n canHide: boolean;\n canSort: boolean;\n index: number;\n menu?: Table3ColumnHeaderMenu;\n onGoto?: (query: string) => Promise<number>;\n onHide: (event: unknown) => void;\n onSortToggle: SortToggleHandler;\n scrollToIndex: TableStrategy['scrollToIndex'];\n sortDirection: HeaderSortDirection;\n table: RTable<TType>;\n};\n\nexport function Menu<TType = unknown>(props: MenuProps<TType>) {\n const {\n canFreeze,\n canHide,\n canSort,\n index,\n menu,\n onGoto: handleGoto,\n onHide: handleHide,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n sortDirection,\n table,\n } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n const { texts } = useLocalization();\n const [popover, setPopover] = React.useState<string | undefined>(undefined);\n const [sortDirectionState, setSortDirectionState] = React.useState<HeaderSortDirection>(sortDirection);\n const ref = React.useRef<HTMLButtonElement>(null);\n\n const gotoShortcut = 'g';\n\n React.useEffect(() => {\n const { frozenColumnIndex: externalFrozenColumnIndex = -1, frozenInternalColumnCount = 0 } = tableMeta.columnFreezing;\n\n const handler = createShortcutKeyDownHandler(\n gotoShortcut,\n () => {\n // Only execute the below code if the header menu has goto menu item\n if (handleGoto) {\n const tableElement = tableMeta.tableRef.current;\n const frozenColumnIndex =\n externalFrozenColumnIndex > -1\n ? externalFrozenColumnIndex + frozenInternalColumnCount\n : frozenInternalColumnCount - 1;\n const parentHeader = ref.current?.closest('[role=\"columnheader\"]');\n\n if (!tableElement || !parentHeader) {\n return;\n }\n\n const leftScrollDistance = getTableLeftScrollDistance(tableElement, parentHeader, frozenColumnIndex);\n\n if (leftScrollDistance !== null) {\n tableElement.scrollLeft = leftScrollDistance;\n }\n }\n },\n // Prevents the stopping of event propagation\n false\n );\n\n document.addEventListener('keydown', handler);\n\n return () => document.removeEventListener('keydown', handler);\n }, [tableMeta.columnFreezing.frozenColumnIndex, handleGoto]);\n\n const handleSortMenuRadioGroupChange = (newSortDirection: RadioGroupItemValue) => {\n setSortDirectionState(newSortDirection as HeaderSortDirection);\n handleSortToggle(newSortDirection as HeaderSortDirection);\n };\n\n let popoverElement;\n\n if (popover) {\n const handleClosePopover = () => setPopover(undefined);\n\n switch (popover) {\n case 'goto': {\n if (handleGoto) {\n const goto = async (query: string) => {\n try {\n const index = await handleGoto(query);\n tableMeta.rowActive.setRowActiveIndex(index);\n scrollToIndex(index + 2, { align: 'center' });\n } catch {\n //\n } finally {\n handleClosePopover();\n }\n };\n popoverElement = props => <GotoPopover {...props} open onChange={handleClosePopover} onGoto={goto} />;\n }\n }\n }\n }\n\n const className = cn(\n '-my-0.5 -mr-1 -ml-0.5 !h-6 !min-h-[theme(spacing.6)] flex-shrink-0 justify-end !w-0 !min-w-0 !overflow-hidden',\n 'aria-expanded:!min-w-[theme(spacing.6)] aria-expanded:!w-6 aria-expanded:!overflow-auto',\n 'focus:!min-w-[theme(spacing.6)] focus:!w-6 focus:!overflow-auto',\n 'group-hover/column:!min-w-[theme(spacing.6)] group-hover/column:!w-6 group-hover/column:!overflow-auto',\n {\n '!w-6 !min-w-[theme(spacing.6)] !overflow-auto': !!popoverElement,\n },\n props.className\n );\n\n const memoedMenuItems = React.useMemo(() => {\n const menuItems: JSX.Element[] = [];\n\n if (canHide) {\n // we do this in the next tick, otherwise the menu closes and react throws a \"state update on unmounted component\" error\n const handleClick = event => setTimeout(() => handleHide(event), 1);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"eye-off\" onClick={handleClick}>\n {texts.table3.columns.menu.hideColumn}\n </MenuPrimitive.Item>\n );\n }\n\n // We rely on canSort value instead of onSort function's value because some columns might have sorting disabled,\n // so even though onSort is truthy, we don't want to show sorting menu.\n if (canSort) {\n menuItems.push(\n <MenuPrimitive.Item\n icon=\"sort-by\"\n subMenu={() => (\n <MenuPrimitive.SubMenu>\n <MenuPrimitive.RadioGroup onChange={handleSortMenuRadioGroupChange} value={sortDirectionState}>\n <MenuPrimitive.RadioGroup.Item value={SORT_DIRECTION.ASC}>\n {texts.table3.columns.menu.sortingOrder.ascending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={SORT_DIRECTION.DESC}>\n {texts.table3.columns.menu.sortingOrder.descending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={false}>\n {texts.table3.columns.menu.sortingOrder.unsorted}\n </MenuPrimitive.RadioGroup.Item>\n </MenuPrimitive.RadioGroup>\n </MenuPrimitive.SubMenu>\n )}>\n {texts.table3.columns.menu.sorting}\n </MenuPrimitive.Item>\n );\n }\n\n if (handleGoto) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"move\" onClick={() => setPopover('goto')} shortcut={gotoShortcut}>\n {texts.table3.columns.menu.gotoRow}...\n </MenuPrimitive.Item>\n );\n }\n\n if (canFreeze) {\n const frozenIndex = index - tableMeta.columnFreezing.frozenInternalColumnCount;\n const handleClick = () => tableMeta.columnFreezing.setFrozenColumnIndex(frozenIndex);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-freeze\" onClick={handleClick}>\n {frozenIndex === 0\n ? texts.table3.columns.menu.freezeFirstColumn\n : texts.table3.columns.menu.freezeUptoColumn.replace('[TOTAL]', String(frozenIndex + 1))}\n </MenuPrimitive.Item>\n );\n\n if (tableMeta.columnFreezing.frozenColumnIndex !== undefined) {\n const handleClick = () => {\n tableMeta.columnFreezing.setFrozenColumnIndex(undefined);\n };\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-unfreeze\" onClick={handleClick}>\n {texts.table3.columns.menu.unfreezeColumns}\n </MenuPrimitive.Item>\n );\n }\n }\n\n if (menu) {\n const customMenu = menu({ trigger: undefined });\n const customItems = React.Children.toArray(customMenu.props.children.props.children) as JSX.Element[];\n\n if (customItems.length) {\n if (menuItems.length) {\n menuItems.push(<MenuPrimitive.Separator />);\n }\n\n menuItems.push(...customItems);\n }\n }\n\n return menuItems.map((item, key) => React.cloneElement(item, { key }));\n }, [\n menu,\n index,\n canFreeze,\n canHide,\n canSort,\n handleGoto,\n handleSortToggle,\n sortDirection,\n tableMeta.columnFreezing.frozenColumnIndex,\n ]);\n\n return (\n <IconButton\n className={className}\n icon=\"more\"\n menu={\n popoverElement\n ? undefined\n : menuProps => (\n <MenuPrimitive {...menuProps}>\n <MenuPrimitive.Content>{memoedMenuItems}</MenuPrimitive.Content>\n </MenuPrimitive>\n )\n }\n popover={popoverElement}\n onClickCapture={event => event.preventDefault()}\n ref={ref}\n />\n );\n}\n"],"names":["isGotoAvailable","table","header","isInternalColumn","id","tableMeta","options","meta","rowGoto","isEnabled","column","getCanSort","getIsSorted","isMenuAvailable","_header$column$column","columnDef","menu","columnFreezing","enableHiding","getCanHide","Menu","props","canFreeze","canHide","canSort","index","onGoto","handleGoto","onHide","handleHide","onSortToggle","handleSortToggle","scrollToIndex","sortDirection","texts","useLocalization","popover","setPopover","React","useState","undefined","sortDirectionState","setSortDirectionState","ref","useRef","gotoShortcut","useEffect","frozenColumnIndex","externalFrozenColumnIndex","frozenInternalColumnCount","handler","createShortcutKeyDownHandler","_ref$current","tableElement","tableRef","current","parentHeader","closest","leftScrollDistance","getTableLeftScrollDistance","scrollLeft","document","addEventListener","removeEventListener","handleSortMenuRadioGroupChange","newSortDirection","popoverElement","handleClosePopover","goto","query","Promise","resolve","then","rowActive","setRowActiveIndex","align","_wasThrown","_result","_temp","e","reject","GotoPopover","open","onChange","className","cn","memoedMenuItems","useMemo","menuItems","handleClick","event","setTimeout","push","MenuPrimitive","Item","icon","onClick","table3","columns","hideColumn","subMenu","SubMenu","RadioGroup","value","SORT_DIRECTION","ASC","sortingOrder","ascending","DESC","descending","unsorted","sorting","shortcut","gotoRow","frozenIndex","setFrozenColumnIndex","freezeFirstColumn","freezeUptoColumn","replace","String","unfreezeColumns","customMenu","trigger","customItems","Children","toArray","children","length","Separator","map","item","key","cloneElement","IconButton","menuProps","Content","onClickCapture","preventDefault"],"mappings":";;;;;;;;;;;;SAcgBA,eAAeA,CAAkBC,KAAoB,EAAEC,MAAgC;EACnG,IAAIC,gBAAgB,CAACD,MAAM,CAACE,EAAE,CAAC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,CAACJ,UAAU,CAACpG,KAAK,CAACyG,QAAQ,CAACzG,KAAK,CAACyG,QAAQ,CAAkB;MAErG,IAAIH,WAAW,CAACI,MAAM,EAAE;QACpB,IAAIvC,SAAS,CAACuC,MAAM,EAAE;UAClBvC,SAAS,CAACI,IAAI,eAACtD,6BAACuD,MAAa,CAACmC,SAAS,OAAG,CAAC;;QAG/CxC,SAAS,CAACI,IAAI,CAAC,GAAG+B,WAAW,CAAC;;;IAItC,OAAOnC,SAAS,CAACyC,GAAG,CAAC,CAACC,IAAI,EAAEC,GAAG,kBAAK7F,cAAK,CAAC8F,YAAY,CAACF,IAAI,EAAE;MAAEC;KAAK,CAAC,CAAC;GACzE,EAAE,CACCnH,IAAI,EACJS,KAAK,EACLH,SAAS,EACTC,OAAO,EACPC,OAAO,EACPG,UAAU,EACVI,gBAAgB,EAChBE,aAAa,EACb5B,SAAS,CAACY,cAAc,CAAC8B,iBAAiB,CAC7C,CAAC;EAEF,oBACIT,6BAAC+F,UAAU;IACPjD,SAAS,EAAEA,SAAS;IACpBW,IAAI,EAAC,MAAM;IACX/E,IAAI,EACAkD,cAAc,GACR1B,SAAS,GACT8F,SAAS,mBACLhG,6BAACuD,MAAa,oBAAKyC,SAAS,gBACxBhG,6BAACuD,MAAa,CAAC0C,OAAO,QAAEjD,eAAe,CAAyB,CACpD,CACnB;IAEXlD,OAAO,EAAE8B,cAAc;IACvBsE,cAAc,EAAE9C,KAAK,IAAIA,KAAK,CAAC+C,cAAc,EAAE;IAC/C9F,GAAG,EAAEA;IACP;AAEV;;;;"}
@@ -16,7 +16,7 @@ const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
16
16
  actions,
17
17
  actionsLength,
18
18
  fontSize,
19
- isCurrentRow,
19
+ isActiveRow,
20
20
  isEditing,
21
21
  isResizingColumn,
22
22
  isHoverStatePaused,
@@ -46,7 +46,7 @@ const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
46
46
  let content;
47
47
  // We don't want to show actions in edit mode, since we have editing actions,
48
48
  // which is shown in edit mode instead.
49
- if (actions !== null && actions !== void 0 && actions.length && !isEditing && (isCurrentRow || isHovered && !isHoverStatePaused && !isResizingColumn)) {
49
+ if (actions !== null && actions !== void 0 && actions.length && !isEditing && (isActiveRow || isHovered && !isHoverStatePaused && !isResizingColumn)) {
50
50
  const visibleActions = actions.map(action => action(row.original)).filter(action => !!action);
51
51
  const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);
52
52
  const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
@@ -64,23 +64,23 @@ const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
64
64
  return /*#__PURE__*/React__default.cloneElement(button, {
65
65
  appearance: 'transparent',
66
66
  key: index,
67
- tabIndex: isCurrentRow ? 0 : -1,
68
- tooltip: button.props.shortcut ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
67
+ tabIndex: isActiveRow ? 0 : -1,
68
+ tooltip: button.props.shortcut ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
69
69
  className: "ml-2",
70
70
  keys: button.props.shortcut
71
- })) : tooltip
71
+ }))) : tooltip
72
72
  });
73
- }), actionsInMenu.length ? /*#__PURE__*/React__default.createElement(IconButton, {
73
+ }), actionsInMenu.length ? ( /*#__PURE__*/React__default.createElement(IconButton, {
74
74
  appearance: "transparent",
75
75
  "aria-label": texts.table3.columns.actions.tooltip,
76
76
  icon: "more",
77
- tabIndex: isCurrentRow ? 0 : -1,
78
- menu: menuProps => /*#__PURE__*/React__default.createElement(Menu, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu.Content, null, actionsInMenu.map((action, i) => /*#__PURE__*/React__default.createElement(Menu.Item, Object.assign({
77
+ tabIndex: isActiveRow ? 0 : -1,
78
+ menu: menuProps => ( /*#__PURE__*/React__default.createElement(Menu, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu.Content, null, actionsInMenu.map((action, i) => ( /*#__PURE__*/React__default.createElement(Menu.Item, Object.assign({
79
79
  key: i
80
80
  }, action.props, {
81
81
  shortcut: action.props.shortcut
82
- }), action.props['aria-label']))))
83
- }) : null);
82
+ }), action.props['aria-label']))))))
83
+ })) : null);
84
84
  }
85
85
  return /*#__PURE__*/React__default.createElement(DisplayCell, Object.assign({}, props), content);
86
86
  });
@@ -93,10 +93,10 @@ function Cell(context) {
93
93
  actions: tableMeta.rowActions.actionsForRow,
94
94
  actionsLength: tableMeta.rowActions.actionsForRowLength,
95
95
  fontSize: tableMeta.fontSize.size,
96
- isCurrentRow: tableMeta.currentRow.currentRowIndex === rowIndex,
96
+ isActiveRow: tableMeta.rowActive.rowActiveIndex === rowIndex,
97
97
  isEditing: tableMeta.editing.isEditing,
98
98
  isResizingColumn: !!context.table.getState().columnSizingInfo.isResizingColumn,
99
- isHoverStatePaused: !!tableMeta.hoverState.isPaused
99
+ isHoverStatePaused: !!tableMeta.rowActive.isHoverStatePaused
100
100
  }));
101
101
  }
102
102
  function createRowActionsColumn() {
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Actions.tsx"],"sourcesContent":["import React from 'react';\nimport { CellContext, DisplayColumnDef, TableMeta } from '@tanstack/react-table';\nimport cn from 'classnames';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Table3FontSize, Table3RowActionRenderer } from '../../../types';\nimport { RowContext } from '../../rows/RowContext';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Menu } from '../../../../Menu/Menu';\nimport { Shortcut } from '../../../../Shortcut/Shortcut';\nimport { Footer } from '../footer/Footer';\nimport { FONT_SIZE } from '../../toolbar/FontSize';\n\nexport const COLUMN_ID = '__actions';\n\ntype MemoedCellProps<TType = unknown> = CellContext<TType, unknown> & {\n actions?: Table3RowActionRenderer<TType>[];\n actionsLength: number;\n fontSize: Table3FontSize;\n isCurrentRow: boolean;\n isEditing: boolean;\n isResizingColumn: boolean;\n isHoverStatePaused: boolean;\n};\n\nconst MemoedCell = React.memo(function MemoedCell<TType = unknown>(props: MemoedCellProps<TType>) {\n const { actions, actionsLength, fontSize, isCurrentRow, isEditing, isResizingColumn, isHoverStatePaused, row } = props;\n const { isHovered } = React.useContext(RowContext);\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLSpanElement | null>(null);\n /*\n const size = table.getState().columnSizing[COLUMN_ID];\n\n // the actions column needs to set its size based on its content, not the actual column\n // so we do this here instead of in the header\n React.useLayoutEffect(() => {\n if (ref.current && !size) {\n const width = ref.current.getBoundingClientRect().width;\n\n table.setColumnSizing(sizes => ({\n ...sizes,\n [COLUMN_ID]: width,\n }));\n }\n }, [ref.current]);\n */\n\n let content;\n\n // We don't want to show actions in edit mode, since we have editing actions,\n // which is shown in edit mode instead.\n if (actions?.length && !isEditing && (isCurrentRow || (isHovered && !isHoverStatePaused && !isResizingColumn))) {\n const visibleActions = actions.map(action => action(row.original)).filter(action => !!action) as JSX.Element[];\n\n const actionsOnRow =\n visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);\n const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);\n\n const className = cn('-mb-2 flex justify-end pl-2 text-right', {\n // Adjust negative margin on row actions cell to ensure that the cell aligns vertically.\n '-mt-2': fontSize === FONT_SIZE.small,\n '-mt-1.5': fontSize !== FONT_SIZE.small,\n });\n\n content = (\n <span className={className} ref={ref}>\n {actionsOnRow.map((button, index) => {\n const tooltip = String(button.props.tooltip ?? button.props['aria-label'] ?? '');\n\n return React.cloneElement(button, {\n appearance: 'transparent',\n key: index,\n tabIndex: isCurrentRow ? 0 : -1,\n tooltip: button.props.shortcut ? (\n <>\n {tooltip}\n <Shortcut className=\"ml-2\" keys={button.props.shortcut} />\n </>\n ) : (\n tooltip\n ),\n });\n })}\n {actionsInMenu.length ? (\n <IconButton\n appearance=\"transparent\"\n aria-label={texts.table3.columns.actions.tooltip}\n icon=\"more\"\n tabIndex={isCurrentRow ? 0 : -1}\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content>\n {actionsInMenu.map((action, i) => (\n <Menu.Item key={i} {...action.props} shortcut={action.props.shortcut}>\n {action.props['aria-label']}\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu>\n )}\n />\n ) : null}\n </span>\n );\n }\n\n return <DisplayCell {...props}>{content}</DisplayCell>;\n}) as <TType = unknown>(props: MemoedCellProps<TType>) => JSX.Element;\n\ntype CellProps<TType = unknown> = CellContext<TType, unknown>;\n\nfunction Cell<TType = unknown>(context: CellProps<TType>) {\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as TableMeta<TType>;\n\n return (\n <MemoedCell\n {...context}\n actions={tableMeta.rowActions.actionsForRow}\n actionsLength={tableMeta.rowActions.actionsForRowLength}\n fontSize={tableMeta.fontSize.size}\n isCurrentRow={tableMeta.currentRow.currentRowIndex === rowIndex}\n isEditing={tableMeta.editing.isEditing}\n isResizingColumn={!!context.table.getState().columnSizingInfo.isResizingColumn}\n isHoverStatePaused={!!tableMeta.hoverState.isPaused}\n />\n );\n}\n\nexport function createRowActionsColumn<TType = unknown>(): DisplayColumnDef<TType, unknown> {\n return {\n id: COLUMN_ID,\n header: ColumnHeader,\n cell: Cell,\n footer: Footer,\n meta: {\n align: 'right',\n className: cn(\n '!pt-[var(--table3-cell-padding-y)] print:opacity-0 [[role=\"table\"][data-editing=\"false\"]_&]:group-[[data-current=\"true\"]]/row:sticky [[role=\"table\"][data-pause-hover=\"false\"][data-editing=\"false\"]_&]:group-hover/row:sticky right-0 !pl-1 !pr-1',\n 'shadow-[-6px_0px_6px_var(--table3-row-actions-shadow)]',\n 'group-[[data-current=\"true\"][data-selected=\"false\"]]/row:text-grey-200',\n 'group-[[data-selected=\"true\"]]/row:text-blue-100',\n 'group-[[data-selected=\"false\"]:hover]/row:text-grey-100'\n ),\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: 'items-center !p-0',\n },\n // options\n enableResizing: false,\n };\n}\n"],"names":["COLUMN_ID","MemoedCell","React","memo","props","actions","actionsLength","fontSize","isCurrentRow","isEditing","isResizingColumn","isHoverStatePaused","row","isHovered","useContext","RowContext","texts","useLocalization","ref","useRef","content","length","visibleActions","map","action","original","filter","actionsOnRow","slice","actionsInMenu","className","cn","FONT_SIZE","small","button","index","tooltip","String","_ref","_button$props$tooltip","cloneElement","appearance","key","tabIndex","shortcut","Shortcut","keys","IconButton","table3","columns","icon","menu","menuProps","Menu","Content","i","Item","DisplayCell","Cell","context","rowIndex","tableMeta","table","options","meta","rowActions","actionsForRow","actionsForRowLength","size","currentRow","currentRowIndex","editing","getState","columnSizingInfo","hoverState","isPaused","createRowActionsColumn","id","header","ColumnHeader","cell","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing"],"mappings":";;;;;;;;;;;;MAcaA,SAAS,GAAG;AAYzB,MAAMC,UAAU,gBAAGC,cAAK,CAACC,IAAI,CAAC,SAASF,UAAUA,CAAkBG,KAA6B;EAC5F,MAAM;IAAEC,OAAO;IAAEC,aAAa;IAAEC,QAAQ;IAAEC,YAAY;IAAEC,SAAS;IAAEC,gBAAgB;IAAEC,kBAAkB;IAAEC;GAAK,GAAGR,KAAK;EACtH,MAAM;IAAES;GAAW,GAAGX,cAAK,CAACY,UAAU,CAACC,UAAU,CAAC;EAClD,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,GAAG,GAAGhB,cAAK,CAACiB,MAAM,CAAyB,IAAI,CAAC;;;;;;;;;;;;;;;EAkBtD,IAAIC,OAAO;;;EAIX,IAAIf,OAAO,aAAPA,OAAO,eAAPA,OAAO,C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U,CAACE,mBAAmB;IACvD5D,QAAQ,EAAEsD,SAAS,CAACtD,QAAQ,CAAC6D,IAAI;IACjC5D,YAAY,EAAEqD,SAAS,CAACQ,UAAU,CAACC,eAAe,KAAKV,QAAQ;IAC/DnD,SAAS,EAAEoD,SAAS,CAACU,OAAO,CAAC9D,SAAS;IACtCC,gBAAgB,EAAE,CAAC,CAACiD,OAAO,CAACG,KAAK,CAACU,QAAQ,EAAE,CAACC,gBAAgB,CAAC/D,gBAAgB;IAC9EC,kBAAkB,EAAE,CAAC,CAACkD,SAAS,CAACa,UAAU,CAACC;KAC7C;AAEV;SAEgBC,sBAAsBA;EAClC,OAAO;IACHC,EAAE,EAAE7E,SAAS;IACb8E,MAAM,EAAEC,MAAY;IACpBC,IAAI,EAAEtB,IAAI;IACVuB,MAAM,EAAEC,MAAM;IACdlB,IAAI,EAAE;MACFmB,KAAK,EAAE,OAAO;MACdrD,SAAS,EAAEC,EAAE,CACT,oPAAoP,EACpP,wDAAwD,EACxD,wEAAwE,EACxE,kDAAkD,EAClD,yDAAyD,CAC5D;MACDqD,cAAc,EAAE,KAAK;MACrBC,YAAY,EAAE,KAAK;MACnBC,cAAc,EAAE,KAAK;MACrBR,MAAM,EAAE,EAAE;MACVS,eAAe,EAAE;KACpB;;IAEDC,cAAc,EAAE;GACnB;AACL;;;;"}
1
+ {"version":3,"file":"Actions.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Actions.tsx"],"sourcesContent":["import React from 'react';\nimport { CellContext, DisplayColumnDef, TableMeta } from '@tanstack/react-table';\nimport cn from 'classnames';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Table3FontSize, Table3RowActionRenderer } from '../../../types';\nimport { RowContext } from '../../rows/RowContext';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Menu } from '../../../../Menu/Menu';\nimport { Shortcut } from '../../../../Shortcut/Shortcut';\nimport { Footer } from '../footer/Footer';\nimport { FONT_SIZE } from '../../toolbar/FontSize';\n\nexport const COLUMN_ID = '__actions';\n\ntype MemoedCellProps<TType = unknown> = CellContext<TType, unknown> & {\n actions?: Table3RowActionRenderer<TType>[];\n actionsLength: number;\n fontSize: Table3FontSize;\n isActiveRow: boolean;\n isEditing: boolean;\n isResizingColumn: boolean;\n isHoverStatePaused: boolean;\n};\n\nconst MemoedCell = React.memo(function MemoedCell<TType = unknown>(props: MemoedCellProps<TType>) {\n const { actions, actionsLength, fontSize, isActiveRow, isEditing, isResizingColumn, isHoverStatePaused, row } = props;\n const { isHovered } = React.useContext(RowContext);\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLSpanElement | null>(null);\n /*\n const size = table.getState().columnSizing[COLUMN_ID];\n\n // the actions column needs to set its size based on its content, not the actual column\n // so we do this here instead of in the header\n React.useLayoutEffect(() => {\n if (ref.current && !size) {\n const width = ref.current.getBoundingClientRect().width;\n\n table.setColumnSizing(sizes => ({\n ...sizes,\n [COLUMN_ID]: width,\n }));\n }\n }, [ref.current]);\n */\n\n let content;\n\n // We don't want to show actions in edit mode, since we have editing actions,\n // which is shown in edit mode instead.\n if (actions?.length && !isEditing && (isActiveRow || (isHovered && !isHoverStatePaused && !isResizingColumn))) {\n const visibleActions = actions.map(action => action(row.original)).filter(action => !!action) as JSX.Element[];\n\n const actionsOnRow =\n visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);\n const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);\n\n const className = cn('-mb-2 flex justify-end pl-2 text-right', {\n // Adjust negative margin on row actions cell to ensure that the cell aligns vertically.\n '-mt-2': fontSize === FONT_SIZE.small,\n '-mt-1.5': fontSize !== FONT_SIZE.small,\n });\n\n content = (\n <span className={className} ref={ref}>\n {actionsOnRow.map((button, index) => {\n const tooltip = String(button.props.tooltip ?? button.props['aria-label'] ?? '');\n\n return React.cloneElement(button, {\n appearance: 'transparent',\n key: index,\n tabIndex: isActiveRow ? 0 : -1,\n tooltip: button.props.shortcut ? (\n <>\n {tooltip}\n <Shortcut className=\"ml-2\" keys={button.props.shortcut} />\n </>\n ) : (\n tooltip\n ),\n });\n })}\n {actionsInMenu.length ? (\n <IconButton\n appearance=\"transparent\"\n aria-label={texts.table3.columns.actions.tooltip}\n icon=\"more\"\n tabIndex={isActiveRow ? 0 : -1}\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content>\n {actionsInMenu.map((action, i) => (\n <Menu.Item key={i} {...action.props} shortcut={action.props.shortcut}>\n {action.props['aria-label']}\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu>\n )}\n />\n ) : null}\n </span>\n );\n }\n\n return <DisplayCell {...props}>{content}</DisplayCell>;\n}) as <TType = unknown>(props: MemoedCellProps<TType>) => JSX.Element;\n\ntype CellProps<TType = unknown> = CellContext<TType, unknown>;\n\nfunction Cell<TType = unknown>(context: CellProps<TType>) {\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as TableMeta<TType>;\n\n return (\n <MemoedCell<TType>\n {...context}\n actions={tableMeta.rowActions.actionsForRow}\n actionsLength={tableMeta.rowActions.actionsForRowLength}\n fontSize={tableMeta.fontSize.size}\n isActiveRow={tableMeta.rowActive.rowActiveIndex === rowIndex}\n isEditing={tableMeta.editing.isEditing}\n isResizingColumn={!!context.table.getState().columnSizingInfo.isResizingColumn}\n isHoverStatePaused={!!tableMeta.rowActive.isHoverStatePaused}\n />\n );\n}\n\nexport function createRowActionsColumn<TType = unknown>(): DisplayColumnDef<TType, unknown> {\n return {\n id: COLUMN_ID,\n header: ColumnHeader,\n cell: Cell,\n footer: Footer,\n meta: {\n align: 'right',\n className: cn(\n '!pt-[var(--table3-cell-padding-y)] print:opacity-0 [[role=\"table\"][data-editing=\"false\"]_&]:group-[[data-current=\"true\"]]/row:sticky [[role=\"table\"][data-pause-hover=\"false\"][data-editing=\"false\"]_&]:group-hover/row:sticky right-0 !pl-1 !pr-1',\n 'shadow-[-6px_0px_6px_var(--table3-row-actions-shadow)]',\n 'group-[[data-current=\"true\"][data-selected=\"false\"]]/row:text-grey-200',\n 'group-[[data-selected=\"true\"]]/row:text-blue-100',\n 'group-[[data-selected=\"false\"]:hover]/row:text-grey-100'\n ),\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: 'items-center !p-0',\n },\n // options\n enableResizing: false,\n };\n}\n"],"names":["COLUMN_ID","MemoedCell","React","memo","props","actions","actionsLength","fontSize","isActiveRow","isEditing","isResizingColumn","isHoverStatePaused","row","isHovered","useContext","RowContext","texts","useLocalization","ref","useRef","content","length","visibleActions","map","action","original","filter","actionsOnRow","slice","actionsInMenu","className","cn","FONT_SIZE","small","button","index","tooltip","String","_ref","_button$props$tooltip","cloneElement","appearance","key","tabIndex","shortcut","Shortcut","keys","IconButton","table3","columns","icon","menu","menuProps","Menu","Content","i","Item","DisplayCell","Cell","context","rowIndex","tableMeta","table","options","meta","rowActions","actionsForRow","actionsForRowLength","size","rowActive","rowActiveIndex","editing","getState","columnSizingInfo","createRowActionsColumn","id","header","ColumnHeader","cell","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing"],"mappings":";;;;;;;;;;;;MAcaA,SAAS,GAAG;AAYzB,MAAMC,UAAU,gBAAGC,cAAK,CAACC,IAAI,CAAC,SAASF,UAAUA,CAAkBG,KAA6B;EAC5F,MAAM;IAAEC,OAAO;IAAEC,aAAa;IAAEC,QAAQ;IAAEC,WAAW;IAAEC,SAAS;IAAEC,gBAAgB;IAAEC,kBAAkB;IAAEC;GAAK,GAAGR,KAAK;EACrH,MAAM;IAAES;GAAW,GAAGX,cAAK,CAACY,UAAU,CAACC,UAAU,CAAC;EAClD,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,GAAG,GAAGhB,cAAK,CAACiB,MAAM,CAAyB,IAAI,CAAC;;;;;;;;;;;;;;;EAkBtD,IAA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AAS,CAACI,UAAU,CAACC,aAAa;IAC3C5D,aAAa,EAAEuD,SAAS,CAACI,UAAU,CAACE,mBAAmB;IACvD5D,QAAQ,EAAEsD,SAAS,CAACtD,QAAQ,CAAC6D,IAAI;IACjC5D,WAAW,EAAEqD,SAAS,CAACQ,SAAS,CAACC,cAAc,KAAKV,QAAQ;IAC5DnD,SAAS,EAAEoD,SAAS,CAACU,OAAO,CAAC9D,SAAS;IACtCC,gBAAgB,EAAE,CAAC,CAACiD,OAAO,CAACG,KAAK,CAACU,QAAQ,EAAE,CAACC,gBAAgB,CAAC/D,gBAAgB;IAC9EC,kBAAkB,EAAE,CAAC,CAACkD,SAAS,CAACQ,SAAS,CAAC1D;KAC5C;AAEV;SAEgB+D,sBAAsBA;EAClC,OAAO;IACHC,EAAE,EAAE3E,SAAS;IACb4E,MAAM,EAAEC,MAAY;IACpBC,IAAI,EAAEpB,IAAI;IACVqB,MAAM,EAAEC,MAAM;IACdhB,IAAI,EAAE;MACFiB,KAAK,EAAE,OAAO;MACdnD,SAAS,EAAEC,EAAE,CACT,oPAAoP,EACpP,wDAAwD,EACxD,wEAAwE,EACxE,kDAAkD,EAClD,yDAAyD,CAC5D;MACDmD,cAAc,EAAE,KAAK;MACrBC,YAAY,EAAE,KAAK;MACnBC,cAAc,EAAE,KAAK;MACrBR,MAAM,EAAE,EAAE;MACVS,eAAe,EAAE;KACpB;;IAEDC,cAAc,EAAE;GACnB;AACL;;;;"}
@@ -61,10 +61,10 @@ function createRowDragColumn(onRowDrag) {
61
61
  return {
62
62
  id: COLUMN_ID,
63
63
  header: Header,
64
- cell: context => /*#__PURE__*/React__default.createElement(Cell, Object.assign({}, context, {
64
+ cell: context => ( /*#__PURE__*/React__default.createElement(Cell, Object.assign({}, context, {
65
65
  isSelected: context.row.getIsSelected(),
66
66
  onRowDrag: onRowDrag
67
- })),
67
+ }))),
68
68
  footer: Footer,
69
69
  meta: {
70
70
  align: 'center',
@@ -1 +1 @@
1
- {"version":3,"file":"Drag.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Drag.tsx"],"sourcesContent":["import React from 'react';\nimport { CellContext, DisplayColumnDef, TableMeta } from '@tanstack/react-table';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Table3RowDragHandler } from '../../../types';\nimport { Icon } from '../../../../Icon/Icon';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Footer } from '../footer/Footer';\n\nexport const COLUMN_ID = '__drag';\nconst GHOST_ELEMENT_ID = 'taco_table_dragging';\n\ntype CellProps<TType = unknown> = CellContext<TType, unknown> & {\n isSelected: boolean;\n onRowDrag: Table3RowDragHandler<TType>;\n};\n\nconst Cell = React.memo(function MemoedCell<TType = unknown>(props: CellProps<TType>) {\n const { isSelected, onRowDrag: handleRowDrag, row, table } = props;\n const { texts } = useLocalization();\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const onDragStart = (event: React.DragEvent): void => {\n let rows = [row];\n\n if (table.options.enableRowSelection) {\n rows = isSelected ? table.getSelectedRowModel().rows : [row, ...table.getSelectedRowModel().rows];\n }\n\n const data = rows.map(row => row.original);\n\n tableMeta.rowDrag.setDragging(\n rows.reduce((dragging, rowBeingDragged) => ({ ...dragging, [rowBeingDragged.id]: true }), {})\n );\n\n // set a default data value so that the consumer doesn't have to\n event.dataTransfer.setData('text', JSON.stringify(data));\n\n const showPlaceholder = (text: string) => {\n const ghost = document.createElement('div');\n ghost.id = GHOST_ELEMENT_ID;\n ghost.className = 'wcag-blue rounded flex w-48 p-4 absolute -ml-[100vw]';\n ghost.innerText = text;\n document.body.appendChild(ghost);\n event.dataTransfer.setDragImage(ghost, 0, 0);\n };\n\n const setDataTransfer = (text: string) => event.dataTransfer.setData('text', text);\n\n handleRowDrag(data, showPlaceholder, setDataTransfer);\n };\n\n const handleDragEnd = (): void => {\n document.getElementById(GHOST_ELEMENT_ID)?.remove();\n tableMeta.rowDrag.setDragging({});\n };\n\n return (\n <DisplayCell {...props}>\n <div draggable onDragStart={onDragStart} onDragOver={event => event.preventDefault()} onDragEnd={handleDragEnd}>\n <Icon\n aria-label={texts.table3.columns.drag.tooltip}\n name=\"drag\"\n className=\"text-grey-darkest invisible -mt-1 w-[20px] cursor-grab active:cursor-grabbing group-hover/row:visible group-[[aria-grabbed='true']]/row:text-white\"\n />\n </div>\n </DisplayCell>\n );\n}) as <TType = unknown>(props: CellProps<TType>) => JSX.Element;\n\nexport function createRowDragColumn<TType = unknown>(onRowDrag: Table3RowDragHandler<TType>): DisplayColumnDef<TType, unknown> {\n return {\n id: COLUMN_ID,\n header: ColumnHeader,\n cell: (context: CellContext<TType, unknown>) => (\n <Cell {...context} isSelected={context.row.getIsSelected()} onRowDrag={onRowDrag} />\n ),\n footer: Footer,\n meta: {\n align: 'center',\n className: '!p-0 !pt-[var(--table3-cell-padding-y)]',\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: 'items-center !p-0',\n },\n // options\n enableResizing: false,\n size: 20,\n minSize: 20,\n };\n}\n"],"names":["COLUMN_ID","GHOST_ELEMENT_ID","Cell","React","memo","MemoedCell","props","isSelected","onRowDrag","handleRowDrag","row","table","texts","useLocalization","tableMeta","options","meta","onDragStart","event","rows","enableRowSelection","getSelectedRowModel","data","map","original","rowDrag","setDragging","reduce","dragging","rowBeingDragged","id","dataTransfer","setData","JSON","stringify","showPlaceholder","text","ghost","document","createElement","className","innerText","body","appendChild","setDragImage","setDataTransfer","handleDragEnd","_document$getElementB","getElementById","remove","DisplayCell","draggable","onDragOver","preventDefault","onDragEnd","Icon","table3","columns","drag","tooltip","name","createRowDragColumn","header","ColumnHeader","cell","context","getIsSelected","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing","size","minSize"],"mappings":";;;;;;;MASaA,SAAS,GAAG;AACzB,MAAMC,gBAAgB,GAAG,qBAAqB;AAO9C,MAAMC,IAAI,gBAAGC,cAAK,CAACC,IAAI,CAAC,SAASC,U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C,cAAc,EAAE,KAAK;IACrBC,IAAI,EAAE,EAAE;IACRC,OAAO,EAAE;GACZ;AACL;;;;"}
1
+ {"version":3,"file":"Drag.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Drag.tsx"],"sourcesContent":["import React from 'react';\nimport { CellContext, DisplayColumnDef, TableMeta } from '@tanstack/react-table';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Table3RowDragHandler } from '../../../types';\nimport { Icon } from '../../../../Icon/Icon';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Footer } from '../footer/Footer';\n\nexport const COLUMN_ID = '__drag';\nconst GHOST_ELEMENT_ID = 'taco_table_dragging';\n\ntype CellProps<TType = unknown> = CellContext<TType, unknown> & {\n isSelected: boolean;\n onRowDrag: Table3RowDragHandler<TType>;\n};\n\nconst Cell = React.memo(function MemoedCell<TType = unknown>(props: CellProps<TType>) {\n const { isSelected, onRowDrag: handleRowDrag, row, table } = props;\n const { texts } = useLocalization();\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const onDragStart = (event: React.DragEvent): void => {\n let rows = [row];\n\n if (table.options.enableRowSelection) {\n rows = isSelected ? table.getSelectedRowModel().rows : [row, ...table.getSelectedRowModel().rows];\n }\n\n const data = rows.map(row => row.original);\n\n tableMeta.rowDrag.setDragging(\n rows.reduce((dragging, rowBeingDragged) => ({ ...dragging, [rowBeingDragged.id]: true }), {})\n );\n\n // set a default data value so that the consumer doesn't have to\n event.dataTransfer.setData('text', JSON.stringify(data));\n\n const showPlaceholder = (text: string) => {\n const ghost = document.createElement('div');\n ghost.id = GHOST_ELEMENT_ID;\n ghost.className = 'wcag-blue rounded flex w-48 p-4 absolute -ml-[100vw]';\n ghost.innerText = text;\n document.body.appendChild(ghost);\n event.dataTransfer.setDragImage(ghost, 0, 0);\n };\n\n const setDataTransfer = (text: string) => event.dataTransfer.setData('text', text);\n\n handleRowDrag(data, showPlaceholder, setDataTransfer);\n };\n\n const handleDragEnd = (): void => {\n document.getElementById(GHOST_ELEMENT_ID)?.remove();\n tableMeta.rowDrag.setDragging({});\n };\n\n return (\n <DisplayCell {...props}>\n <div draggable onDragStart={onDragStart} onDragOver={event => event.preventDefault()} onDragEnd={handleDragEnd}>\n <Icon\n aria-label={texts.table3.columns.drag.tooltip}\n name=\"drag\"\n className=\"text-grey-darkest invisible -mt-1 w-[20px] cursor-grab active:cursor-grabbing group-hover/row:visible group-[[aria-grabbed='true']]/row:text-white\"\n />\n </div>\n </DisplayCell>\n );\n}) as <TType = unknown>(props: CellProps<TType>) => JSX.Element;\n\nexport function createRowDragColumn<TType = unknown>(onRowDrag: Table3RowDragHandler<TType>): DisplayColumnDef<TType, unknown> {\n return {\n id: COLUMN_ID,\n header: ColumnHeader,\n cell: (context: CellContext<TType, unknown>) => (\n <Cell {...context} isSelected={context.row.getIsSelected()} onRowDrag={onRowDrag} />\n ),\n footer: Footer,\n meta: {\n align: 'center',\n className: '!p-0 !pt-[var(--table3-cell-padding-y)]',\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: 'items-center !p-0',\n },\n // options\n enableResizing: false,\n size: 20,\n minSize: 20,\n };\n}\n"],"names":["COLUMN_ID","GHOST_ELEMENT_ID","Cell","React","memo","MemoedCell","props","isSelected","onRowDrag","handleRowDrag","row","table","texts","useLocalization","tableMeta","options","meta","onDragStart","event","rows","enableRowSelection","getSelectedRowModel","data","map","original","rowDrag","setDragging","reduce","dragging","rowBeingDragged","id","dataTransfer","setData","JSON","stringify","showPlaceholder","text","ghost","document","createElement","className","innerText","body","appendChild","setDragImage","setDataTransfer","handleDragEnd","_document$getElementB","getElementById","remove","DisplayCell","draggable","onDragOver","preventDefault","onDragEnd","Icon","table3","columns","drag","tooltip","name","createRowDragColumn","header","ColumnHeader","cell","context","getIsSelected","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing","size","minSize"],"mappings":";;;;;;;MASaA,SAAS,GA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ACrBC,YAAY,EAAE,KAAK;MACnBC,cAAc,EAAE,KAAK;MACrBV,MAAM,EAAE,EAAE;MACVW,eAAe,EAAE;KACpB;;IAEDC,cAAc,EAAE,KAAK;IACrBC,IAAI,EAAE,EAAE;IACRC,OAAO,EAAE;GACZ;AACL;;;;"}
@@ -4,45 +4,60 @@ import { Icon } from '../../../../Icon/Icon.js';
4
4
  import { Tooltip } from '../../../../Tooltip/Tooltip.js';
5
5
  import { IconButton } from '../../../../IconButton/IconButton.js';
6
6
  import { useLocalization } from '../../../../Provider/Localization.js';
7
+ import { Button } from '../../../../Button/Button.js';
7
8
  import { Spinner } from '../../../../Spinner/Spinner.js';
9
+ import { Dialog } from '../../../../Dialog/Dialog.js';
10
+ import { Group } from '../../../../Group/Group.js';
8
11
  import useTimer from '../../../../../utils/hooks/useTimer.js';
9
12
  import { Menu } from '../../../../Menu/Menu.js';
10
13
  import { Header } from '../header/Header.js';
11
14
  import { RowContext } from '../../rows/RowContext.js';
12
15
  import { DisplayCell } from '../cell/DisplayCell.js';
13
16
  import { Footer } from '../footer/Footer.js';
14
- import { SavingStateValue } from '../../../hooks/features/useEditing.js';
17
+ import { getColumnIndex } from '../../../util/editing.js';
18
+ import { lastCellIndex } from '../../rows/Row.js';
19
+ import { SavingStatusValue } from '../../../hooks/features/useEditing.js';
15
20
 
16
21
  const savingIndicatorHideDelay = 3000;
17
22
  const COLUMN_ID = '__editing_actions';
18
23
  const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
24
+ var _column$columnDef$met;
19
25
  const {
20
26
  hasChanges,
21
- isCurrentRow,
22
- isEditing,
27
+ isActiveRow,
23
28
  row,
29
+ editing,
30
+ rowIdentifier,
24
31
  table
25
32
  } = props;
26
- const tableMeta = table.options.meta;
27
- const savingState = tableMeta.editing.savingStates && tableMeta.editing.savingStates[row.id];
33
+ const savingStatus = editing.getSavingStatus(row.id);
28
34
  const [isSavedIndicatorVisible, setIsSavingIndicatorVisible] = React__default.useState(false);
29
35
  const {
30
36
  texts
31
37
  } = useLocalization();
38
+ const [clearConfirmationOpen, setClearConfirmationOpen] = React__default.useState(false);
39
+ const columns = table.getAllFlatColumns();
40
+ const column = columns.find(column => column.id === rowIdentifier);
41
+ const rowIdentifierHeader = column === null || column === void 0 ? void 0 : (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.header;
42
+ const edititngActionsRef = React__default.useRef(null);
43
+ const tableMeta = table.options.meta;
32
44
  const handleSaved = () => {
33
45
  setIsSavingIndicatorVisible(false);
34
- tableMeta.editing.removeSavingState(row.id);
46
+ editing.resetSavingStatus(row.id);
35
47
  };
36
48
  const timer = useTimer(savingIndicatorHideDelay, handleSaved);
37
49
  React__default.useEffect(() => {
38
- if (savingState && savingState.state === SavingStateValue.Saved && !isSavedIndicatorVisible) {
50
+ if (savingStatus && savingStatus === SavingStatusValue.Saved && !isSavedIndicatorVisible) {
39
51
  setIsSavingIndicatorVisible(true);
40
52
  timer.start();
41
53
  }
42
- }, [savingState]);
54
+ }, [savingStatus]);
55
+ React__default.useEffect(() => {
56
+ tableMeta.shortcutsState.pause(clearConfirmationOpen);
57
+ }, [clearConfirmationOpen]);
43
58
  let content;
44
- if (savingState) {
45
- if (savingState.state === SavingStateValue.Saving) {
59
+ if (savingStatus) {
60
+ if (savingStatus === SavingStatusValue.Saving) {
46
61
  content = /*#__PURE__*/React__default.createElement(Tooltip, {
47
62
  title: texts.table3.editing.saving.progress
48
63
  }, /*#__PURE__*/React__default.createElement(Spinner, {
@@ -58,28 +73,51 @@ const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
58
73
  }));
59
74
  }
60
75
  }
61
- if (isEditing && isCurrentRow) {
76
+ if (editing.isEditing && isActiveRow) {
62
77
  content = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, content, /*#__PURE__*/React__default.createElement(IconButton, {
78
+ ref: edititngActionsRef,
63
79
  appearance: "transparent",
64
80
  "aria-label": texts.table3.editing.actions.tooltip,
65
81
  icon: "more",
66
- menu: menuProps => /*#__PURE__*/React__default.createElement(Menu, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu.Content, null, /*#__PURE__*/React__default.createElement(Menu.Item, {
82
+ menu: menuProps => ( /*#__PURE__*/React__default.createElement(Menu, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu.Content, null, /*#__PURE__*/React__default.createElement(Menu.Item, {
67
83
  icon: "tick",
68
84
  disabled: !hasChanges,
69
- onClick: () => tableMeta.editing.saveChangesIfNeeded()
85
+ onClick: () => editing.saveChangesIfNeeded()
70
86
  }, texts.table3.editing.actions.save), /*#__PURE__*/React__default.createElement(Menu.Item, {
71
87
  icon: "close",
72
88
  disabled: !hasChanges,
73
- onClick: () => tableMeta.editing.resetChange(row.id)
89
+ onClick: () => setClearConfirmationOpen(true)
74
90
  }, texts.table3.editing.actions.clear), /*#__PURE__*/React__default.createElement(Menu.Item, {
75
91
  icon: "undo",
76
- onClick: () => tableMeta.editing.toggleEditing(false)
77
- }, texts.table3.editing.actions.exit))),
78
- tabIndex: isCurrentRow ? 0 : -1
79
- }));
92
+ onClick: () => editing.toggleEditing(false)
93
+ }, texts.table3.editing.actions.exit)))),
94
+ tabIndex: isActiveRow ? 0 : -1
95
+ }), /*#__PURE__*/React__default.createElement(Dialog, {
96
+ size: "xs",
97
+ open: clearConfirmationOpen,
98
+ onClose: () => {
99
+ setClearConfirmationOpen(false);
100
+ requestAnimationFrame(() => {
101
+ if (edititngActionsRef.current) {
102
+ edititngActionsRef.current.focus();
103
+ // When table looses focus, we need to re-set the last column index
104
+ lastCellIndex.value = getColumnIndex(edititngActionsRef.current);
105
+ }
106
+ });
107
+ }
108
+ }, /*#__PURE__*/React__default.createElement(Dialog.Content, {
109
+ "aria-label": texts.table3.editing.clearChangesConfirmationDialog.title
110
+ }, /*#__PURE__*/React__default.createElement(Dialog.Title, null, texts.table3.editing.clearChangesConfirmationDialog.title), /*#__PURE__*/React__default.createElement("p", null, texts.table3.editing.clearChangesConfirmationDialog.description.replace('[ROW_IDENTIFIER]', rowIdentifier && rowIdentifierHeader ? rowIdentifierHeader : texts.table3.validation.index).replace('[ROW_IDENTIFIER_VALUE]', rowIdentifier && rowIdentifierHeader ? row.original[rowIdentifier] : row.index)), /*#__PURE__*/React__default.createElement(Dialog.Footer, null, /*#__PURE__*/React__default.createElement(Group, null, /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button, {
111
+ tabIndex: 0
112
+ }, texts.table3.editing.clearChangesConfirmationDialog.cancel)), /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button, {
113
+ tabIndex: 0,
114
+ appearance: "primary",
115
+ autoFocus: true,
116
+ onClick: () => editing.resetChange(row.id)
117
+ }, texts.table3.editing.clearChangesConfirmationDialog.confirm)))))));
80
118
  }
81
119
  const contentClassName = cn('flex items-center justify-end text-right', {
82
- '-mb-2 -mt-2': isCurrentRow
120
+ '-mb-2 -mt-2': isActiveRow
83
121
  });
84
122
  return /*#__PURE__*/React__default.createElement(DisplayCell, Object.assign({}, props, {
85
123
  className: cn({
@@ -97,16 +135,18 @@ function Cell(props) {
97
135
  const changeset = tableMeta.editing.changes ? Object.keys(tableMeta.editing.changes) : [];
98
136
  return /*#__PURE__*/React__default.createElement(MemoedCell, Object.assign({}, props, {
99
137
  hasChanges: changeset.indexOf(props.row.id) >= 0,
100
- isCurrentRow: tableMeta.currentRow.currentRowIndex === rowIndex,
101
- isEditing: tableMeta.editing.isEditing
138
+ isActiveRow: tableMeta.rowActive.rowActiveIndex === rowIndex,
139
+ editing: tableMeta.editing
102
140
  }));
103
141
  }
104
142
  const EDITING_ACTIONS_WIDTH = 60;
105
- function createRowEditingActionsColumn() {
143
+ function createRowEditingActionsColumn(rowIdentifier) {
106
144
  return {
107
145
  id: COLUMN_ID,
108
146
  header: Header,
109
- cell: Cell,
147
+ cell: context => /*#__PURE__*/React__default.createElement(Cell, Object.assign({}, context, {
148
+ rowIdentifier: rowIdentifier
149
+ })),
110
150
  footer: Footer,
111
151
  meta: {
112
152
  align: 'right',
@@ -1 +1 @@
1
- {"version":3,"file":"EditingActions.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/EditingActions.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { CellContext, TableMeta, DisplayColumnDef } from '@tanstack/react-table';\nimport { Spinner } from '../../../../Spinner/Spinner';\nimport { SavingStateValue } from '../../../hooks/features/useEditing';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Menu } from '../../../../Menu/Menu';\nimport { RowContext } from '../../rows/RowContext';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { Footer } from '../footer/Footer';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport useTimer from '../../../../../utils/hooks/useTimer';\nimport { Icon } from '../../../../Icon/Icon';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\n\nexport type EditingActionsProps<TType = unknown> = CellContext<TType, unknown> & {\n className?: string;\n isHovered: boolean;\n};\n\nconst savingIndicatorHideDelay = 3000;\n\nexport const COLUMN_ID = '__editing_actions';\n\ntype MemoedCellProps<TType = unknown> = CellContext<TType, unknown> & {\n hasChanges: boolean;\n isCurrentRow: boolean;\n isEditing: boolean;\n};\n\nconst MemoedCell = React.memo(function MemoedCell<TType = unknown>(props: MemoedCellProps<TType>) {\n const { hasChanges, isCurrentRow, isEditing, row, table } = props;\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n const savingState = tableMeta.editing.savingStates && tableMeta.editing.savingStates[row.id];\n const [isSavedIndicatorVisible, setIsSavingIndicatorVisible] = React.useState(false);\n const { texts } = useLocalization();\n\n const handleSaved = () => {\n setIsSavingIndicatorVisible(false);\n tableMeta.editing.removeSavingState(row.id);\n };\n const timer = useTimer(savingIndicatorHideDelay, handleSaved);\n\n React.useEffect(() => {\n if (savingState && savingState.state === SavingStateValue.Saved && !isSavedIndicatorVisible) {\n setIsSavingIndicatorVisible(true);\n timer.start();\n }\n }, [savingState]);\n\n let content;\n\n if (savingState) {\n if (savingState.state === SavingStateValue.Saving) {\n content = (\n <Tooltip title={texts.table3.editing.saving.progress}>\n <Spinner delay={0} className=\"!text-grey-700 mr-1 !h-5 !w-5\" />\n </Tooltip>\n );\n } else if (isSavedIndicatorVisible) {\n content = (\n <Tooltip title={texts.table3.editing.saving.complete}>\n <Icon name=\"tick\" className=\"!text-grey-700 mr-1 !h-5 !w-5\" />\n </Tooltip>\n );\n }\n }\n\n if (isEditing && isCurrentRow) {\n content = (\n <>\n {content}\n <IconButton\n appearance=\"transparent\"\n aria-label={texts.table3.editing.actions.tooltip}\n icon=\"more\"\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content>\n <Menu.Item\n icon=\"tick\"\n disabled={!hasChanges}\n onClick={() => tableMeta.editing.saveChangesIfNeeded()}>\n {texts.table3.editing.actions.save}\n </Menu.Item>\n <Menu.Item\n icon=\"close\"\n disabled={!hasChanges}\n onClick={() => tableMeta.editing.resetChange(row.id)}>\n {texts.table3.editing.actions.clear}\n </Menu.Item>\n <Menu.Item icon=\"undo\" onClick={() => tableMeta.editing.toggleEditing(false)}>\n {texts.table3.editing.actions.exit}\n </Menu.Item>\n </Menu.Content>\n </Menu>\n )}\n tabIndex={isCurrentRow ? 0 : -1}\n />\n </>\n );\n }\n\n const contentClassName = cn('flex items-center justify-end text-right', { '-mb-2 -mt-2': isCurrentRow });\n return (\n <DisplayCell {...props} className={cn({ '!sticky': !!content })}>\n {content ? <span className={contentClassName}>{content}</span> : undefined}\n </DisplayCell>\n );\n}) as <TType = unknown>(props: MemoedCellProps<TType>) => JSX.Element;\n\ntype CellProps<TType = unknown> = CellContext<TType, unknown> & {};\n\nfunction Cell<TType = unknown>(props: CellProps<TType>) {\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = props.table.options.meta as TableMeta<TType>;\n const changeset = tableMeta.editing.changes ? Object.keys(tableMeta.editing.changes) : [];\n\n return (\n <MemoedCell\n {...props}\n hasChanges={changeset.indexOf(props.row.id) >= 0}\n isCurrentRow={tableMeta.currentRow.currentRowIndex === rowIndex}\n isEditing={tableMeta.editing.isEditing}\n />\n );\n}\n\nexport const EDITING_ACTIONS_WIDTH = 60;\n\nexport function createRowEditingActionsColumn<TType = unknown>(): DisplayColumnDef<TType, unknown> {\n return {\n id: COLUMN_ID,\n header: ColumnHeader,\n cell: Cell,\n footer: Footer,\n meta: {\n align: 'right',\n className: cn(\n 'items-center print:opacity-0 [[role=\"table\"][data-editing=\"true\"]_&]:group-[[data-current=\"true\"]]/row:sticky right-0 !pl-0 !pr-1',\n '[[role=\"table\"][data-editing=\"true\"]_&]:group-[[data-current=\"true\"]]/row:shadow-[-6px_0px_6px_var(--table3-row-actions-shadow)]',\n 'group-[[data-current=\"true\"][data-selected=\"false\"]]/row:text-grey-200',\n 'group-[[data-selected=\"true\"]]/row:text-blue-100',\n 'group-[[data-selected=\"false\"]:hover]/row:text-grey-100'\n ),\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: 'items-center !p-0',\n },\n // options\n enableResizing: false,\n size: EDITING_ACTIONS_WIDTH,\n minSize: EDITING_ACTIONS_WIDTH,\n };\n}\n"],"names":["savingIndicatorHideDelay","COLUMN_ID","MemoedCell","React","memo","props","hasChanges","isCurrentRow","isEditing","row","table","tableMeta","options","meta","savingState","editing","savingStates","id","isSavedIndicatorVisible","setIsSavingIndicatorVisible","useState","texts","useLocalization","handleSaved","removeSavingState","timer","useTimer","useEffect","state","SavingStateValue","Saved","start","content","Saving","Tooltip","title","table3","saving","progress","Spinner","delay","className","complete","Icon","name","IconButton","appearance","actions","tooltip","icon","menu","menuProps","Menu","Content","Item","disabled","onClick","saveChangesIfNeeded","save","resetChange","clear","toggleEditing","exit","tabIndex","contentClassName","cn","DisplayCell","undefined","Cell","rowIndex","useContext","RowContext","changeset","changes","Object","keys","indexOf","currentRow","currentRowIndex","EDITING_ACTIONS_WIDTH","createRowEditingActionsColumn","header","ColumnHeader","cell","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing","size","minSize"],"mappings":";;;;;;;;;;;;;;;AAqBA,MAAMA,wBAAwB,GAAG,IAAI;MAExBC,SAAS,GAAG;AAQzB,MAAMC,UAAU,gBAAGC,cAAK,CAACC,IAAI,CAAC,SAASF,UAAUA,CAAkBG,KAA6B;EAC5F,MAAM;IAAEC,UAAU;IAAEC,YAAY;IAAEC,SAAS;IAAEC,GAAG;IAAEC;GAAO,GAAGL,KAAK;EAEjE,MAAMM,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAAwB;EACxD,MAAMC,WAAW,GAAGH,SAAS,CAACI,OAAO,CAACC,YAAY,IAAIL,SAAS,CAACI,OAAO,CAACC,YAAY,CAACP,GAAG,CAACQ,EAAE,CAAC;EAC5F,MAAM,CAACC,uBAAuB,EAAEC,2BAA2B,CAAC,GAAGhB,cAAK,CAACiB,QAAQ,CAAC,KAAK,CAAC;EACpF,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,WAAW,GAAGA;IAChBJ,2BAA2B,CAAC,KAAK,CAAC;IAClCR,SAAS,CAACI,OAAO,CAACS,iBAAiB,CAACf,GAAG,CAACQ,EAAE,CAAC;GAC9C;EACD,MAAMQ,KAAK,GAAGC,QAAQ,CAAC1B,wBAAwB,EAAEuB,WAAW,CAAC;EAE7DpB,cAAK,CAACwB,SAAS,CAAC;IACZ,IAAIb,WAAW,IAAIA,WAAW,CAACc,KAAK,KAAKC,gBAAgB,CAACC,KAAK,IAAI,CAACZ,uBAAuB,EAAE;MACzFC,2BAA2B,CAAC,IAAI,CAAC;MACjCM,KAAK,CAACM,KAAK,EAAE;;GAEpB,EAAE,CAACjB,WAAW,CAAC,CAAC;EAEjB,IAAIkB,OAAO;EAEX,IAAIlB,WAAW,EAAE;IACb,IAAIA,WAAW,CAACc,KAAK,K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AO;IACH/D,EAAE,EAAEhB,SAAS;IACbgF,MAAM,EAAEC,MAAY;IACpBC,IAAI,EAAEf,IAAI;IACVgB,MAAM,EAAEC,MAAM;IACdxE,IAAI,EAAE;MACFyE,KAAK,EAAE,OAAO;MACd7C,SAAS,EAAEwB,EAAE,CACT,mIAAmI,EACnI,kIAAkI,EAClI,wEAAwE,EACxE,kDAAkD,EAClD,yDAAyD,CAC5D;MACDsB,cAAc,EAAE,KAAK;MACrBC,YAAY,EAAE,KAAK;MACnBC,cAAc,EAAE,KAAK;MACrBR,MAAM,EAAE,EAAE;MACVS,eAAe,EAAE;KACpB;;IAEDC,cAAc,EAAE,KAAK;IACrBC,IAAI,EAAEb,qBAAqB;IAC3Bc,OAAO,EAAEd;GACZ;AACL;;;;"}
1
+ {"version":3,"file":"EditingActions.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/EditingActions.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { CellContext, TableMeta, DisplayColumnDef } from '@tanstack/react-table';\nimport { Spinner } from '../../../../Spinner/Spinner';\nimport { SavingStatusValue, useEditing } from '../../../hooks/features/useEditing';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Menu } from '../../../../Menu/Menu';\nimport { RowContext } from '../../rows/RowContext';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { Footer } from '../footer/Footer';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport useTimer from '../../../../../utils/hooks/useTimer';\nimport { Icon } from '../../../../Icon/Icon';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { Dialog } from '../../../../Dialog/Dialog';\nimport { Group } from '../../../../Group/Group';\nimport { Button } from '../../../../Button/Button';\nimport { lastCellIndex } from '../../rows/Row';\nimport { getColumnIndex } from '../../../util/editing';\n\nexport type EditingActionsProps<TType = unknown> = CellContext<TType, unknown> & {\n className?: string;\n isHovered: boolean;\n};\n\nconst savingIndicatorHideDelay = 3000;\n\nexport const COLUMN_ID = '__editing_actions';\n\ntype MemoedCellProps<TType = unknown> = CellContext<TType, unknown> & {\n hasChanges: boolean;\n isActiveRow: boolean;\n editing: ReturnType<typeof useEditing>;\n rowIdentifier?: string;\n};\n\nconst MemoedCell = React.memo(function MemoedCell<TType = unknown>(props: MemoedCellProps<TType>) {\n const { hasChanges, isActiveRow, row, editing, rowIdentifier, table } = props;\n\n const savingStatus = editing.getSavingStatus(row.id);\n const [isSavedIndicatorVisible, setIsSavingIndicatorVisible] = React.useState(false);\n const { texts } = useLocalization();\n const [clearConfirmationOpen, setClearConfirmationOpen] = React.useState(false);\n const columns = table.getAllFlatColumns();\n const column = columns.find(column => column.id === rowIdentifier);\n const rowIdentifierHeader = column?.columnDef.meta?.header;\n const edititngActionsRef = React.useRef<HTMLButtonElement | HTMLAnchorElement>(null);\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const handleSaved = () => {\n setIsSavingIndicatorVisible(false);\n editing.resetSavingStatus(row.id);\n };\n const timer = useTimer(savingIndicatorHideDelay, handleSaved);\n\n React.useEffect(() => {\n if (savingStatus && savingStatus === SavingStatusValue.Saved && !isSavedIndicatorVisible) {\n setIsSavingIndicatorVisible(true);\n timer.start();\n }\n }, [savingStatus]);\n\n React.useEffect(() => {\n tableMeta.shortcutsState.pause(clearConfirmationOpen);\n }, [clearConfirmationOpen]);\n\n let content;\n\n if (savingStatus) {\n if (savingStatus === SavingStatusValue.Saving) {\n content = (\n <Tooltip title={texts.table3.editing.saving.progress}>\n <Spinner delay={0} className=\"!text-grey-700 mr-1 !h-5 !w-5\" />\n </Tooltip>\n );\n } else if (isSavedIndicatorVisible) {\n content = (\n <Tooltip title={texts.table3.editing.saving.complete}>\n <Icon name=\"tick\" className=\"!text-grey-700 mr-1 !h-5 !w-5\" />\n </Tooltip>\n );\n }\n }\n\n if (editing.isEditing && isActiveRow) {\n content = (\n <>\n {content}\n <IconButton\n ref={edititngActionsRef}\n appearance=\"transparent\"\n aria-label={texts.table3.editing.actions.tooltip}\n icon=\"more\"\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content>\n <Menu.Item icon=\"tick\" disabled={!hasChanges} onClick={() => editing.saveChangesIfNeeded()}>\n {texts.table3.editing.actions.save}\n </Menu.Item>\n <Menu.Item icon=\"close\" disabled={!hasChanges} onClick={() => setClearConfirmationOpen(true)}>\n {texts.table3.editing.actions.clear}\n </Menu.Item>\n <Menu.Item icon=\"undo\" onClick={() => editing.toggleEditing(false)}>\n {texts.table3.editing.actions.exit}\n </Menu.Item>\n </Menu.Content>\n </Menu>\n )}\n tabIndex={isActiveRow ? 0 : -1}\n />\n <Dialog\n size=\"xs\"\n open={clearConfirmationOpen}\n onClose={() => {\n setClearConfirmationOpen(false);\n requestAnimationFrame(() => {\n if (edititngActionsRef.current) {\n edititngActionsRef.current.focus();\n // When table looses focus, we need to re-set the last column index\n lastCellIndex.value = getColumnIndex(edititngActionsRef.current);\n }\n });\n }}>\n <Dialog.Content aria-label={texts.table3.editing.clearChangesConfirmationDialog.title}>\n <Dialog.Title>{texts.table3.editing.clearChangesConfirmationDialog.title}</Dialog.Title>\n\n <p>\n {texts.table3.editing.clearChangesConfirmationDialog.description\n .replace(\n '[ROW_IDENTIFIER]',\n rowIdentifier && rowIdentifierHeader ? rowIdentifierHeader : texts.table3.validation.index\n )\n .replace(\n '[ROW_IDENTIFIER_VALUE]',\n rowIdentifier && rowIdentifierHeader ? row.original[rowIdentifier] : row.index\n )}\n </p>\n\n <Dialog.Footer>\n <Group>\n <Dialog.Close>\n <Button tabIndex={0}>{texts.table3.editing.clearChangesConfirmationDialog.cancel}</Button>\n </Dialog.Close>\n <Dialog.Close>\n <Button\n tabIndex={0}\n appearance=\"primary\"\n autoFocus\n onClick={() => editing.resetChange(row.id)}>\n {texts.table3.editing.clearChangesConfirmationDialog.confirm}\n </Button>\n </Dialog.Close>\n </Group>\n </Dialog.Footer>\n </Dialog.Content>\n </Dialog>\n </>\n );\n }\n\n const contentClassName = cn('flex items-center justify-end text-right', { '-mb-2 -mt-2': isActiveRow });\n return (\n <DisplayCell {...props} className={cn({ '!sticky': !!content })}>\n {content ? <span className={contentClassName}>{content}</span> : undefined}\n </DisplayCell>\n );\n}) as <TType = unknown>(props: MemoedCellProps<TType>) => JSX.Element;\n\ntype CellProps<TType = unknown> = CellContext<TType, unknown> & {\n rowIdentifier?: string;\n};\n\nfunction Cell<TType = unknown>(props: CellProps<TType>) {\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = props.table.options.meta as TableMeta<TType>;\n const changeset = tableMeta.editing.changes ? Object.keys(tableMeta.editing.changes) : [];\n\n return (\n <MemoedCell\n {...props}\n hasChanges={changeset.indexOf(props.row.id) >= 0}\n isActiveRow={tableMeta.rowActive.rowActiveIndex === rowIndex}\n editing={tableMeta.editing}\n />\n );\n}\n\nexport const EDITING_ACTIONS_WIDTH = 60;\n\nexport function createRowEditingActionsColumn<TType = unknown>(rowIdentifier?: string): DisplayColumnDef<TType, unknown> {\n return {\n id: COLUMN_ID,\n header: ColumnHeader,\n cell: (context: CellContext<TType, unknown>) => <Cell {...context} rowIdentifier={rowIdentifier} />,\n footer: Footer,\n meta: {\n align: 'right',\n className: cn(\n 'items-center print:opacity-0 [[role=\"table\"][data-editing=\"true\"]_&]:group-[[data-current=\"true\"]]/row:sticky right-0 !pl-0 !pr-1',\n '[[role=\"table\"][data-editing=\"true\"]_&]:group-[[data-current=\"true\"]]/row:shadow-[-6px_0px_6px_var(--table3-row-actions-shadow)]',\n 'group-[[data-current=\"true\"][data-selected=\"false\"]]/row:text-grey-200',\n 'group-[[data-selected=\"true\"]]/row:text-blue-100',\n 'group-[[data-selected=\"false\"]:hover]/row:text-grey-100'\n ),\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: 'items-center !p-0',\n },\n // options\n enableResizing: false,\n size: EDITING_ACTIONS_WIDTH,\n minSize: EDITING_ACTIONS_WIDTH,\n };\n}\n"],"names":["savingIndicatorHideDelay","COLUMN_ID","MemoedCell","React","memo","props","hasChanges","isActiveRow","row","editing","rowIdentifier","table","savingStatus","getSavingStatus","id","isSavedIndicatorVisible","setIsSavingIndicatorVisible","useState","texts","useLocalization","clearConfirmationOpen","setClearConfirmationOpen","columns","getAllFlatColumns","column","find","rowIdentifierHeader","_column$columnDef$met","columnDef","meta","header","edititngActionsRef","useRef","tableMeta","options","handleSaved","resetSavingStatus","timer","useTimer","useEffect","SavingStatusValue","Saved","start","shortcutsState","pause","content","Saving","Tooltip","title","table3","saving","progress","Spinner","delay","className","complete","Icon","name","isEditing","IconButton","ref","appearance","actions","tooltip","icon","menu","menuProps","Menu","Content","Item","disabled","onClick","saveChangesIfNeeded","save","clear","toggleEditing","exit","tabIndex","Dialog","size","open","onClose","requestAnimationFrame","current","focus","lastCellIndex","value","getColumnIndex","clearChangesConfirmationDialog","Title","description","replace","validation","index","original","Footer","Group","Close","Button","cancel","autoFocus","resetChange","confirm","contentClassName","cn","DisplayCell","undefined","Cell","rowIndex","useContext","RowContext","changeset","changes","Object","keys","indexOf","rowActive","rowActiveIndex","EDITING_ACTIONS_WIDTH","createRowEditingActionsColumn","ColumnHeader","cell","context","footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing","minSize"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0BA,MAAMA,wBAAwB,GAAG,IAAI;MAExBC,SAAS,GAAG;AASzB,MAAMC,UAAU,gBAAGC,cAAK,CAACC,IAAI,CAAC,SAASF,UAAUA,CAAkBG,KAA6B;;EAC5F,MAAM;IAAEC,UAAU;IAAEC,WAAW;IAAEC,GAAG;IAAEC,OAAO;IAAEC,aAAa;IAAEC;GAAO,GAAGN,KAAK;EAE7E,MAAMO,YAAY,GAAGH,OAAO,CAACI,eAAe,CAACL,GAAG,CAACM,EAAE,CAAC;EACpD,MAAM,CAACC,uBAAuB,EAAEC,2BAA2B,CAAC,GAAGb,cAAK,CAACc,QAAQ,CAAC,KAAK,CAAC;EACpF,MA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AAC,IAAI,CAAC;IAChDP,WAAW,EAAE0B,SAAS,CAACmF,SAAS,CAACC,cAAc,KAAKT,QAAQ;IAC5DnG,OAAO,EAAEwB,SAAS,CAACxB;KACrB;AAEV;MAEa6G,qBAAqB,GAAG;SAErBC,6BAA6BA,CAAkB7G,aAAsB;EACjF,OAAO;IACHI,EAAE,EAAEb,SAAS;IACb6B,MAAM,EAAE0F,MAAY;IACpBC,IAAI,EAAGC,OAAoC,iBAAKvH,6BAACwG,IAAI,oBAAKe,OAAO;MAAEhH,aAAa,EAAEA;OAAiB;IACnGiH,MAAM,EAAE5B,MAAM;IACdlE,IAAI,EAAE;MACF+F,KAAK,EAAE,OAAO;MACdtE,SAAS,EAAEkD,EAAE,CACT,mIAAmI,EACnI,kIAAkI,EAClI,wEAAwE,EACxE,kDAAkD,EAClD,yDAAyD,CAC5D;MACDqB,cAAc,EAAE,KAAK;MACrBC,YAAY,EAAE,KAAK;MACnBC,cAAc,EAAE,KAAK;MACrBjG,MAAM,EAAE,EAAE;MACVkG,eAAe,EAAE;KACpB;;IAEDC,cAAc,EAAE,KAAK;IACrBlD,IAAI,EAAEuC,qBAAqB;IAC3BY,OAAO,EAAEZ;GACZ;AACL;;;;"}
@@ -31,7 +31,7 @@ function Header(context) {
31
31
  const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
32
32
  const {
33
33
  expandedRowRenderer,
34
- isCurrentRow,
34
+ isActiveRow,
35
35
  isExpanded,
36
36
  row,
37
37
  table
@@ -48,7 +48,7 @@ const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
48
48
  row.toggleExpanded();
49
49
  };
50
50
  const title = isExpanded ? texts.table3.columns.expansion.collapse : texts.table3.columns.expansion.expand;
51
- const tabIndex = isCurrentRow && !tableMeta.editing.isEditing ? 0 : -1;
51
+ const tabIndex = isActiveRow && !tableMeta.editing.isEditing ? 0 : -1;
52
52
  content = /*#__PURE__*/React__default.createElement(Tooltip, {
53
53
  title: title
54
54
  }, /*#__PURE__*/React__default.createElement(IconButton, {
@@ -73,7 +73,7 @@ function Cell(props) {
73
73
  const tableMeta = context.table.options.meta;
74
74
  return /*#__PURE__*/React__default.createElement(MemoedCell, Object.assign({}, context, {
75
75
  expandedRowRenderer: expandedRowRenderer,
76
- isCurrentRow: tableMeta.currentRow.currentRowIndex === rowIndex,
76
+ isActiveRow: tableMeta.rowActive.rowActiveIndex === rowIndex,
77
77
  isExpanded: context.row.getIsExpanded()
78
78
  }));
79
79
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Expansion.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Expansion.tsx"],"sourcesContent":["import React from 'react';\nimport { HeaderContext, CellContext, DisplayColumnDef, TableMeta } from '@tanstack/react-table';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Table3RowExpansionRenderer } from '../../../types';\nimport { RowContext } from '../../rows/RowContext';\nimport { Footer } from '../footer/Footer';\n\nexport const COLUMN_ID = '__expansion';\n\nfunction Header<TType = unknown>(context: HeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n\n const isSomeRowsExpanded = context.table.getIsSomeRowsExpanded();\n const handleClick = event => {\n event.stopPropagation();\n context.table.toggleAllRowsExpanded(!isSomeRowsExpanded);\n };\n\n const title = isSomeRowsExpanded ? texts.table3.columns.expansion.collapseAll : texts.table3.columns.expansion.expandAll;\n\n return (\n <ColumnHeader {...context}>\n <Tooltip title={title}>\n <IconButton\n appearance=\"transparent\"\n icon={isSomeRowsExpanded ? 'chevron-down-double' : 'chevron-right-double'}\n onClick={handleClick}\n tabIndex={-1}\n title={title}\n />\n </Tooltip>\n </ColumnHeader>\n );\n}\n\ntype MemoedCellProps<TType = unknown> = CellContext<TType, unknown> & {\n expandedRowRenderer: Table3RowExpansionRenderer<TType>;\n isCurrentRow: boolean;\n isExpanded: boolean;\n};\n\nconst MemoedCell = React.memo(function MemoedCell<TType = unknown>(props: MemoedCellProps<TType>) {\n const { expandedRowRenderer, isCurrentRow, isExpanded, row, table } = props;\n const { texts } = useLocalization();\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const hasExpandedRow = expandedRowRenderer(row.original);\n\n let content;\n\n if (hasExpandedRow) {\n const handleClick = event => {\n event.stopPropagation();\n row.toggleExpanded();\n };\n const title = isExpanded ? texts.table3.columns.expansion.collapse : texts.table3.columns.expansion.expand;\n\n const tabIndex = isCurrentRow && !tableMeta.editing.isEditing ? 0 : -1;\n\n content = (\n <Tooltip title={title}>\n <IconButton\n appearance=\"discrete\"\n className=\"-mt-1.5\"\n icon={isExpanded ? 'chevron-down' : 'chevron-right'}\n onClick={handleClick}\n tabIndex={tabIndex}\n title={title}\n />\n </Tooltip>\n );\n }\n\n return <DisplayCell {...props}>{content}</DisplayCell>;\n}) as <TType = unknown>(props: MemoedCellProps<TType>) => JSX.Element;\n\ntype CellProps<TType = unknown> = CellContext<TType, unknown> & {\n expandedRowRenderer: Table3RowExpansionRenderer<TType>;\n};\n\nfunction Cell<TType = unknown>(props: CellProps<TType>) {\n const { expandedRowRenderer, ...context } = props;\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as TableMeta<TType>;\n\n return (\n <MemoedCell\n {...context}\n expandedRowRenderer={expandedRowRenderer}\n isCurrentRow={tableMeta.currentRow.currentRowIndex === rowIndex}\n isExpanded={context.row.getIsExpanded()}\n />\n );\n}\n\nexport function createRowExpansionColumn<TType = unknown>(\n expandedRowRenderer: Table3RowExpansionRenderer<TType>\n): DisplayColumnDef<TType, unknown> {\n return {\n id: COLUMN_ID,\n header: Header,\n cell: (context: CellContext<TType, unknown>) => <Cell {...context} expandedRowRenderer={expandedRowRenderer} />,\n footer: Footer,\n meta: {\n align: 'center',\n className: '!p-0 !pt-[var(--table3-cell-padding-y)]',\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: 'items-center !p-0',\n },\n // options\n enableResizing: false,\n size: 40,\n };\n}\n"],"names":["COLUMN_ID","Header","context","texts","useLocalization","isSomeRowsExpanded","table","getIsSomeRowsExpanded","handleClick","event","stopPropagation","toggleAllRowsExpanded","title","table3","columns","expansion","collapseAll","expandAll","React","ColumnHeader","Tooltip","IconButton","appearance","icon","onClick","tabIndex","MemoedCell","memo","props","expandedRowRenderer","isCurrentRow","isExpanded","row","tableMeta","options","meta","hasExpandedRow","original","content","toggleExpanded","collapse","expand","editing","isEditing","className","DisplayCell","Cell","rowIndex","useContext","RowContext","currentRow","currentRowIndex","getIsExpanded","createRowExpansionColumn","id","header","cell","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing","size"],"mappings":";;;;;;;;;MAWaA,SAAS,GAAG;AAEzB,SAASC,MAAMA,CAAkBC,OAAsC;EACnE,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,kBAAkB,GAAGH,OAAO,CAACI,KAAK,CAACC,qBAAqB,EAAE;EAChE,MAAMC,WAAW,GAAGC,KAAK;IACrBA,KAAK,CAACC,eAAe,EAAE;IACvBR,OAAO,CAACI,KAAK,CAACK,qBAAqB,CAAC,CAACN,kBAAkB,CAAC;GAC3D;EAED,MAAMO,KAAK,GAAGP,kBAAkB,GAAGF,KAAK,CAACU,MAAM,CAACC,OAAO,CAACC,SAAS,CAACC,WAAW,GAAGb,KAAK,CAACU,MAAM,CAACC,OAAO,CAACC,SAAS,CAACE,SAAS;EAExH,oBACIC,6BAACC,QAAY,oBAAKjB,OAAO,gBACrBgB,6BAACE,OAAO;IAACR,KAAK,EAAEA;kBACZM,6BAACG,UAAU;IACPC,UAAU,EAAC,aAAa;IACxBC,IAAI,EAAElB,kBAAkB,GAAG,qBAAqB,GAAG,sBAAsB;IACzEmB,OAAO,EAAEhB,WAAW;IACpBiB,QAAQ,EAAE,CAAC,CAAC;I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;IAAE,GAAG3B;GAAS,GAAG0B,KAAK;EACjD,MAAM;IAAEmB;GAAU,GAAG7B,cAAK,CAAC8B,UAAU,CAACC,UAAU,CAAC;EACjD,MAAMhB,SAAS,GAAG/B,OAAO,CAACI,KAAK,CAAC4B,OAAO,CAACC,IAAwB;EAEhE,oBACIjB,6BAACQ,UAAU,oBACHxB,OAAO;IACX2B,mBAAmB,EAAEA,mBAAmB;IACxCC,YAAY,EAAEG,SAAS,CAACiB,UAAU,CAACC,eAAe,KAAKJ,QAAQ;IAC/DhB,UAAU,EAAE7B,OAAO,CAAC8B,GAAG,CAACoB,aAAa;KACvC;AAEV;SAEgBC,wBAAwBA,CACpCxB,mBAAsD;EAEtD,OAAO;IACHyB,EAAE,EAAEtD,SAAS;IACbuD,MAAM,EAAEtD,MAAM;IACduD,IAAI,EAAGtD,OAAoC,iBAAKgB,6BAAC4B,IAAI,oBAAK5C,OAAO;MAAE2B,mBAAmB,EAAEA;OAAuB;IAC/G4B,MAAM,EAAEC,MAAM;IACdvB,IAAI,EAAE;MACFwB,KAAK,EAAE,QAAQ;MACff,SAAS,EAAE,yCAAyC;MACpDgB,cAAc,EAAE,KAAK;MACrBC,YAAY,EAAE,KAAK;MACnBC,cAAc,EAAE,KAAK;MACrBP,MAAM,EAAE,EAAE;MACVQ,eAAe,EAAE;KACpB;;IAEDC,cAAc,EAAE,KAAK;IACrBC,IAAI,EAAE;GACT;AACL;;;;"}
1
+ {"version":3,"file":"Expansion.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Expansion.tsx"],"sourcesContent":["import React from 'react';\nimport { HeaderContext, CellContext, DisplayColumnDef, TableMeta } from '@tanstack/react-table';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Tooltip } from '../../../../Tooltip/Tooltip';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Table3RowExpansionRenderer } from '../../../types';\nimport { RowContext } from '../../rows/RowContext';\nimport { Footer } from '../footer/Footer';\n\nexport const COLUMN_ID = '__expansion';\n\nfunction Header<TType = unknown>(context: HeaderContext<TType, unknown>) {\n const { texts } = useLocalization();\n\n const isSomeRowsExpanded = context.table.getIsSomeRowsExpanded();\n const handleClick = event => {\n event.stopPropagation();\n context.table.toggleAllRowsExpanded(!isSomeRowsExpanded);\n };\n\n const title = isSomeRowsExpanded ? texts.table3.columns.expansion.collapseAll : texts.table3.columns.expansion.expandAll;\n\n return (\n <ColumnHeader {...context}>\n <Tooltip title={title}>\n <IconButton\n appearance=\"transparent\"\n icon={isSomeRowsExpanded ? 'chevron-down-double' : 'chevron-right-double'}\n onClick={handleClick}\n tabIndex={-1}\n title={title}\n />\n </Tooltip>\n </ColumnHeader>\n );\n}\n\ntype MemoedCellProps<TType = unknown> = CellContext<TType, unknown> & {\n expandedRowRenderer: Table3RowExpansionRenderer<TType>;\n isActiveRow: boolean;\n isExpanded: boolean;\n};\n\nconst MemoedCell = React.memo(function MemoedCell<TType = unknown>(props: MemoedCellProps<TType>) {\n const { expandedRowRenderer, isActiveRow, isExpanded, row, table } = props;\n const { texts } = useLocalization();\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const hasExpandedRow = expandedRowRenderer(row.original);\n\n let content;\n\n if (hasExpandedRow) {\n const handleClick = event => {\n event.stopPropagation();\n row.toggleExpanded();\n };\n const title = isExpanded ? texts.table3.columns.expansion.collapse : texts.table3.columns.expansion.expand;\n\n const tabIndex = isActiveRow && !tableMeta.editing.isEditing ? 0 : -1;\n\n content = (\n <Tooltip title={title}>\n <IconButton\n appearance=\"discrete\"\n className=\"-mt-1.5\"\n icon={isExpanded ? 'chevron-down' : 'chevron-right'}\n onClick={handleClick}\n tabIndex={tabIndex}\n title={title}\n />\n </Tooltip>\n );\n }\n\n return <DisplayCell {...props}>{content}</DisplayCell>;\n}) as <TType = unknown>(props: MemoedCellProps<TType>) => JSX.Element;\n\ntype CellProps<TType = unknown> = CellContext<TType, unknown> & {\n expandedRowRenderer: Table3RowExpansionRenderer<TType>;\n};\n\nfunction Cell<TType = unknown>(props: CellProps<TType>) {\n const { expandedRowRenderer, ...context } = props;\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as TableMeta<TType>;\n\n return (\n <MemoedCell\n {...context}\n expandedRowRenderer={expandedRowRenderer}\n isActiveRow={tableMeta.rowActive.rowActiveIndex === rowIndex}\n isExpanded={context.row.getIsExpanded()}\n />\n );\n}\n\nexport function createRowExpansionColumn<TType = unknown>(\n expandedRowRenderer: Table3RowExpansionRenderer<TType>\n): DisplayColumnDef<TType, unknown> {\n return {\n id: COLUMN_ID,\n header: Header,\n cell: (context: CellContext<TType, unknown>) => <Cell {...context} expandedRowRenderer={expandedRowRenderer} />,\n footer: Footer,\n meta: {\n align: 'center',\n className: '!p-0 !pt-[var(--table3-cell-padding-y)]',\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: 'items-center !p-0',\n },\n // options\n enableResizing: false,\n size: 40,\n };\n}\n"],"names":["COLUMN_ID","Header","context","texts","useLocalization","isSomeRowsExpanded","table","getIsSomeRowsExpanded","handleClick","event","stopPropagation","toggleAllRowsExpanded","title","table3","columns","expansion","collapseAll","expandAll","React","ColumnHeader","Tooltip","IconButton","appearance","icon","onClick","tabIndex","MemoedCell","memo","props","expandedRowRenderer","isActiveRow","isExpanded","row","tableMeta","options","meta","hasExpandedRow","original","content","toggleExpanded","collapse","expand","editing","isEditing","className","DisplayCell","Cell","rowIndex","useContext","RowContext","rowActive","rowActiveIndex","getIsExpanded","createRowExpansionColumn","id","header","cell","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing","size"],"mappings":";;;;;;;;;MAWaA,SAAS,GAAG;AAEzB,SAASC,MAAMA,CAAkBC,OAAsC;EACnE,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,kBAAkB,GAAGH,OAAO,CAACI,KAAK,C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