@economic/taco 2.16.0 → 2.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. package/dist/components/Table3/Table3.d.ts +0 -2
  2. package/dist/components/Table3/components/columns/cell/EditingControl.d.ts +1 -1
  3. package/dist/components/Table3/components/columns/header/Header.d.ts +1 -1
  4. package/dist/components/Table3/components/columns/styles.d.ts +2 -2
  5. package/dist/components/Table3/components/rows/Row.d.ts +3 -1
  6. package/dist/components/Table3/hooks/features/useSearch.d.ts +1 -3
  7. package/dist/components/Table3/hooks/useTable.d.ts +21 -20
  8. package/dist/components/Table3/types.d.ts +15 -18
  9. package/dist/components/Table3/util/scrolling.d.ts +2 -0
  10. package/dist/esm/packages/taco/src/components/Banner/Banner.js +2 -2
  11. package/dist/esm/packages/taco/src/components/Banner/Banner.js.map +1 -1
  12. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js +4 -4
  13. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
  14. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +3 -3
  15. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
  16. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +2 -1
  17. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  18. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +6 -6
  19. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
  20. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +3 -3
  21. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  22. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +7 -7
  23. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
  24. package/dist/esm/packages/taco/src/components/Field/Field.js +2 -2
  25. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  26. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js +2 -2
  27. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js.map +1 -1
  28. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +4 -4
  29. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Header/components/Link.js +2 -2
  31. package/dist/esm/packages/taco/src/components/Header/components/Link.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Icon/Icon.js +2 -2
  33. package/dist/esm/packages/taco/src/components/Icon/Icon.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js +2 -2
  35. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +6 -6
  37. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
  38. package/dist/esm/packages/taco/src/components/Menu/components/Item.js +4 -4
  39. package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
  40. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js +2 -2
  41. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js.map +1 -1
  42. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js +3 -3
  43. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js.map +1 -1
  44. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js +2 -2
  45. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js.map +1 -1
  46. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +1 -1
  47. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
  48. package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js +2 -2
  49. package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js.map +1 -1
  50. package/dist/esm/packages/taco/src/components/Pagination/Pagination.js +5 -5
  51. package/dist/esm/packages/taco/src/components/Pagination/Pagination.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/Popover/Popover.js +2 -2
  53. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  54. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js +2 -2
  55. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js.map +1 -1
  56. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +8 -8
  57. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  58. package/dist/esm/packages/taco/src/components/Select/useSelect.js +2 -2
  59. package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
  60. package/dist/esm/packages/taco/src/components/Select2/Select2.js +7 -7
  61. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  62. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +8 -8
  63. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  64. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +5 -5
  65. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  66. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +10 -10
  67. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  68. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +2 -2
  69. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
  70. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js +3 -3
  71. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js.map +1 -1
  72. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +2 -2
  73. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
  74. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +10 -10
  75. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js.map +1 -1
  76. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js +2 -2
  77. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js.map +1 -1
  78. package/dist/esm/packages/taco/src/components/Table3/Table3.js +30 -29
  79. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  80. package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js +3 -3
  81. package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js.map +1 -1
  82. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +6 -6
  83. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
  84. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +2 -2
  85. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
  86. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +13 -14
  87. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  88. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +27 -3
  89. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
  90. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +2 -2
  91. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
  92. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js +2 -2
  93. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js.map +1 -1
  94. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js +1 -1
  95. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js.map +1 -1
  96. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +9 -9
  97. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
  98. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +37 -6
  99. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
  100. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +12 -12
  101. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
  102. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js +2 -2
  103. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js.map +1 -1
  104. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +7 -7
  105. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js.map +1 -1
  106. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js +3 -3
  107. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js.map +1 -1
  108. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +3 -3
  109. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
  110. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js +2 -13
  111. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js.map +1 -1
  112. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +32 -30
  113. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
  114. package/dist/esm/packages/taco/src/components/Table3/components/rows/SkeletonRow.js +2 -2
  115. package/dist/esm/packages/taco/src/components/Table3/components/rows/SkeletonRow.js.map +1 -1
  116. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +8 -6
  117. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js.map +1 -1
  118. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +15 -7
  119. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
  120. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js +2 -2
  121. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js.map +1 -1
  122. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +2 -2
  123. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js.map +1 -1
  124. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +16 -16
  125. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
  126. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +1 -0
  127. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
  128. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +10 -8
  129. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
  130. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js +8 -8
  131. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js.map +1 -1
  132. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSearch.js +1 -2
  133. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSearch.js.map +1 -1
  134. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js +3 -3
  135. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js.map +1 -1
  136. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +1 -49
  137. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
  138. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +0 -1
  139. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
  140. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js +0 -2
  141. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js.map +1 -1
  142. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +127 -109
  143. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  144. package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js +3 -3
  145. package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js.map +1 -1
  146. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  147. package/dist/esm/packages/taco/src/components/Table3/util/scrolling.js +53 -0
  148. package/dist/esm/packages/taco/src/components/Table3/util/scrolling.js.map +1 -0
  149. package/dist/esm/packages/taco/src/components/Tag/Tag.js +4 -4
  150. package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
  151. package/dist/esm/packages/taco/src/components/Toast/Toaster.js +2 -2
  152. package/dist/esm/packages/taco/src/components/Toast/Toaster.js.map +1 -1
  153. package/dist/esm/packages/taco/src/components/Tour/Tour.js +4 -4
  154. package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
  155. package/dist/esm/packages/taco/src/components/Treeview/Treeview.js +2 -2
  156. package/dist/esm/packages/taco/src/components/Treeview/Treeview.js.map +1 -1
  157. package/dist/esm/packages/taco/src/index.js +2 -1
  158. package/dist/esm/packages/taco/src/index.js.map +1 -1
  159. package/dist/esm/packages/taco/src/primitives/Table/types.js +10 -0
  160. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -0
  161. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js +8 -0
  162. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js.map +1 -0
  163. package/dist/esm/packages/taco/src/{components/Table3/hooks/features/useFontSize.js → primitives/Table/useTable/features/useTableFontSize.js} +3 -3
  164. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFontSize.js.map +1 -0
  165. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js +14 -0
  166. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +1 -0
  167. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js +100 -0
  168. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js.map +1 -0
  169. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowClick.js +30 -0
  170. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowClick.js.map +1 -0
  171. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js +9 -0
  172. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js.map +1 -0
  173. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowHeight.js +13 -0
  174. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowHeight.js.map +1 -0
  175. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js +32 -0
  176. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js.map +1 -0
  177. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js +11 -0
  178. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js.map +1 -0
  179. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableDataListener.js +15 -0
  180. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableDataListener.js.map +1 -0
  181. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useFilteringStateListener.js → primitives/Table/useTable/listeners/useTableFilterListener.js} +3 -3
  182. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFilterListener.js.map +1 -0
  183. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFontSizeListener.js +40 -0
  184. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFontSizeListener.js.map +1 -0
  185. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useRowSelectionListener.js → primitives/Table/useTable/listeners/useTableRowSelectionListener.js} +5 -6
  186. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowSelectionListener.js.map +1 -0
  187. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useServerLoadingListener.js → primitives/Table/useTable/listeners/useTableServerLoadingListener.js} +3 -3
  188. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableServerLoadingListener.js.map +1 -0
  189. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useShortcutsListener.js → primitives/Table/useTable/listeners/useTableShortcutsListener.js} +7 -7
  190. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableShortcutsListener.js.map +1 -0
  191. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useSortingStateListener.js → primitives/Table/useTable/listeners/useTableSortingListener.js} +6 -4
  192. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSortingListener.js.map +1 -0
  193. package/dist/esm/packages/taco/src/{components/Table3/hooks/features/useColumnOrdering.js → primitives/Table/useTable/util/columns.js} +24 -15
  194. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -0
  195. package/dist/esm/packages/taco/src/types.js +6 -0
  196. package/dist/esm/packages/taco/src/types.js.map +1 -0
  197. package/dist/esm/packages/taco/src/utils/date.js +0 -1
  198. package/dist/esm/packages/taco/src/utils/date.js.map +1 -1
  199. package/dist/primitives/Table/types.d.ts +35 -0
  200. package/dist/primitives/Table/useTable/features/useTableColumnOrdering.d.ts +3 -0
  201. package/dist/primitives/Table/useTable/features/useTableFontSize.d.ts +7 -0
  202. package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +7 -0
  203. package/dist/primitives/Table/useTable/features/useTableRowActive.d.ts +12 -0
  204. package/dist/primitives/Table/useTable/features/useTableRowClick.d.ts +7 -0
  205. package/dist/primitives/Table/useTable/features/useTableRowGoto.d.ts +5 -0
  206. package/dist/primitives/Table/useTable/features/useTableRowHeight.d.ts +7 -0
  207. package/dist/primitives/Table/useTable/features/useTableRowSelection.d.ts +6 -0
  208. package/dist/primitives/Table/useTable/features/useTableServerLoading.d.ts +6 -0
  209. package/dist/primitives/Table/useTable/listeners/useTableDataListener.d.ts +2 -0
  210. package/dist/primitives/Table/useTable/listeners/useTableFilterListener.d.ts +3 -0
  211. package/dist/primitives/Table/useTable/listeners/useTableFontSizeListener.d.ts +2 -0
  212. package/dist/primitives/Table/useTable/listeners/useTableRowSelectionListener.d.ts +3 -0
  213. package/dist/primitives/Table/useTable/listeners/useTableServerLoadingListener.d.ts +3 -0
  214. package/dist/primitives/Table/useTable/listeners/useTableShortcutsListener.d.ts +3 -0
  215. package/dist/primitives/Table/useTable/listeners/useTableSortingListener.d.ts +3 -0
  216. package/dist/primitives/Table/useTable/util/columns.d.ts +4 -0
  217. package/dist/taco.cjs.development.js +827 -711
  218. package/dist/taco.cjs.development.js.map +1 -1
  219. package/dist/taco.cjs.production.min.js +1 -1
  220. package/dist/taco.cjs.production.min.js.map +1 -1
  221. package/dist/types.d.ts +5 -0
  222. package/package.json +3 -3
  223. package/types.json +11267 -13766
  224. package/dist/components/Table3/hooks/features/useColumnOrdering.d.ts +0 -6
  225. package/dist/components/Table3/hooks/features/useCurrentRow.d.ts +0 -11
  226. package/dist/components/Table3/hooks/features/useFontSize.d.ts +0 -7
  227. package/dist/components/Table3/hooks/features/usePauseHoverState.d.ts +0 -6
  228. package/dist/components/Table3/hooks/features/usePrinting.d.ts +0 -8
  229. package/dist/components/Table3/hooks/features/useRowClick.d.ts +0 -6
  230. package/dist/components/Table3/hooks/features/useRowGoto.d.ts +0 -5
  231. package/dist/components/Table3/hooks/features/useRowHeight.d.ts +0 -7
  232. package/dist/components/Table3/hooks/features/useRowSelection.d.ts +0 -6
  233. package/dist/components/Table3/hooks/listeners/useCurrentRowListener.d.ts +0 -2
  234. package/dist/components/Table3/hooks/listeners/useFilteringStateListener.d.ts +0 -3
  235. package/dist/components/Table3/hooks/listeners/useRowSelectionListener.d.ts +0 -3
  236. package/dist/components/Table3/hooks/listeners/useServerLoadingListener.d.ts +0 -3
  237. package/dist/components/Table3/hooks/listeners/useShortcutsListener.d.ts +0 -3
  238. package/dist/components/Table3/hooks/listeners/useSortingStateListener.d.ts +0 -3
  239. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnOrdering.js.map +0 -1
  240. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js +0 -93
  241. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js.map +0 -1
  242. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useFontSize.js.map +0 -1
  243. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseHoverState.js +0 -22
  244. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseHoverState.js.map +0 -1
  245. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePrinting.js +0 -14
  246. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePrinting.js.map +0 -1
  247. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js +0 -25
  248. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js.map +0 -1
  249. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowGoto.js +0 -9
  250. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowGoto.js.map +0 -1
  251. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowHeight.js +0 -27
  252. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowHeight.js.map +0 -1
  253. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js +0 -32
  254. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js.map +0 -1
  255. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js +0 -15
  256. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js.map +0 -1
  257. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useFilteringStateListener.js.map +0 -1
  258. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useRowSelectionListener.js.map +0 -1
  259. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useServerLoadingListener.js.map +0 -1
  260. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useShortcutsListener.js.map +0 -1
  261. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSortingStateListener.js.map +0 -1
@@ -1,56 +1,8 @@
1
1
  import React__default from 'react';
2
- import { FONT_SIZE } from '../../components/toolbar/FontSize.js';
3
- import { getFontBasedMinColumnSize } from '../../components/columns/styles.js';
4
2
 
5
3
  function useSettingsStateListener(table, onChangeSettings) {
6
4
  const meta = table.options.meta;
7
5
  const state = table.getState();
8
- const prevFontSize = React__default.useRef(meta.fontSize.size);
9
- React__default.useEffect(() => {
10
- const newFontSize = meta.fontSize.size;
11
- const oldFontSize = prevFontSize.current;
12
- const {
13
- small,
14
- medium,
15
- large
16
- } = FONT_SIZE;
17
- let columnSizeChange = 0;
18
- switch (`${oldFontSize}-${newFontSize}`) {
19
- case `${small}-${medium}`:
20
- columnSizeChange = 8;
21
- break;
22
- case `${small}-${large}`:
23
- columnSizeChange = 16;
24
- break;
25
- case `${medium}-${small}`:
26
- columnSizeChange = -8;
27
- break;
28
- case `${medium}-${large}`:
29
- columnSizeChange = 8;
30
- break;
31
- case `${large}-${small}`:
32
- columnSizeChange = -16;
33
- break;
34
- case `${large}-${medium}`:
35
- columnSizeChange = -8;
36
- break;
37
- default:
38
- columnSizeChange = 0;
39
- break;
40
- }
41
- prevFontSize.current = newFontSize;
42
- if (columnSizeChange === 0) {
43
- return;
44
- }
45
- table.setColumnSizing(sizes => {
46
- const minColumnSize = getFontBasedMinColumnSize(newFontSize);
47
- return Object.fromEntries(Object.entries(sizes).map(([columnName, prevColumnSize]) => {
48
- // Prevents width value in the setting to go below the minColumnSize
49
- const newSize = Math.max(minColumnSize, prevColumnSize + columnSizeChange);
50
- return [columnName, newSize];
51
- }));
52
- });
53
- }, [meta.fontSize.size]);
54
6
  React__default.useEffect(() => {
55
7
  let handler;
56
8
  if (typeof onChangeSettings === 'function') {
@@ -59,7 +11,7 @@ function useSettingsStateListener(table, onChangeSettings) {
59
11
  }, 250);
60
12
  }
61
13
  return () => clearTimeout(handler);
62
- }, [meta.columnFreezing.frozenColumnIndex, state.columnOrder, state.columnSizing, state.columnVisibility, meta.search.excludeUnmatchedResults, meta.fontSize.size, meta.rowHeight.height, meta.printing.printWarningDialogVisibility, state.sorting]);
14
+ }, [meta.columnFreezing.frozenColumnIndex, state.columnOrder, state.columnSizing, state.columnVisibility, meta.search.excludeUnmatchedResults, meta.fontSize.size, meta.rowHeight.height, meta.printing.isWarningVisibleForLargeDatasets, state.sorting]);
63
15
  }
64
16
 
65
17
  export { useSettingsStateListener };
@@ -1 +1 @@
1
- {"version":3,"file":"useSettingsStateListener.js","sources":["../../../../../../../../../src/components/Table3/hooks/listeners/useSettingsStateListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { Table3SettingsHandler } from '../../types';\nimport { FONT_SIZE } from '../../components/toolbar/FontSize';\nimport { getFontBasedMinColumnSize } from '../../components/columns/styles';\n\nexport function useSettingsStateListener<TType = unknown>(\n table: RTable<TType>,\n onChangeSettings: Table3SettingsHandler | undefined\n) {\n const meta = table.options.meta as TableMeta<TType>;\n const state = table.getState();\n\n const prevFontSize = React.useRef(meta.fontSize.size);\n\n React.useEffect(() => {\n const newFontSize = meta.fontSize.size;\n const oldFontSize = prevFontSize.current;\n const { small, medium, large } = FONT_SIZE;\n let columnSizeChange = 0;\n\n switch (`${oldFontSize}-${newFontSize}`) {\n case `${small}-${medium}`:\n columnSizeChange = 8;\n break;\n case `${small}-${large}`:\n columnSizeChange = 16;\n break;\n case `${medium}-${small}`:\n columnSizeChange = -8;\n break;\n case `${medium}-${large}`:\n columnSizeChange = 8;\n break;\n case `${large}-${small}`:\n columnSizeChange = -16;\n break;\n case `${large}-${medium}`:\n columnSizeChange = -8;\n break;\n default:\n columnSizeChange = 0;\n break;\n }\n\n prevFontSize.current = newFontSize;\n\n if (columnSizeChange === 0) {\n return;\n }\n\n table.setColumnSizing(sizes => {\n const minColumnSize = getFontBasedMinColumnSize(newFontSize);\n\n return Object.fromEntries(\n Object.entries(sizes).map(([columnName, prevColumnSize]) => {\n // Prevents width value in the setting to go below the minColumnSize\n const newSize = Math.max(minColumnSize, prevColumnSize + columnSizeChange);\n\n return [columnName, newSize];\n })\n );\n });\n }, [meta.fontSize.size]);\n\n React.useEffect(() => {\n let handler;\n\n if (typeof onChangeSettings === 'function') {\n handler = setTimeout(() => {\n onChangeSettings(meta.getSettings());\n }, 250);\n }\n\n return () => clearTimeout(handler);\n }, [\n meta.columnFreezing.frozenColumnIndex,\n state.columnOrder,\n state.columnSizing,\n state.columnVisibility,\n meta.search.excludeUnmatchedResults,\n meta.fontSize.size,\n meta.rowHeight.height,\n meta.printing.printWarningDialogVisibility,\n state.sorting,\n ]);\n}\n"],"names":["useSettingsStateListener","table","onChangeSettings","meta","options","state","getState","prevFontSize","React","useRef","fontSize","size","useEffect","newFontSize","oldFontSize","current","small","medium","large","FONT_SIZE","columnSizeChange","setColumnSizing","sizes","minColumnSize","getFontBasedMinColumnSize","Object","fromEntries","entries","map","columnName","prevColumnSize","newSize","Math","max","handler","setTimeout","getSettings","clearTimeout","columnFreezing","frozenColumnIndex","columnOrder","columnSizing","columnVisibility","search","excludeUnmatchedResults","rowHeight","height","printing","printWarningDialogVisibility","sorting"],"mappings":";;;;SAMgBA,wBAAwBA,CACpCC,KAAoB,EACpBC,gBAAmD;EAEnD,MAAMC,IAAI,GAAGF,KAAK,CAACG,OAAO,CAACD,IAAwB;EACnD,MAAME,KAAK,GAAGJ,KAAK,CAACK,QAAQ,EAAE;EAE9B,MAAMC,YAAY,GAAGC,cAAK,CAACC,MAAM,CAACN,IAAI,CAACO,QAAQ,CAACC,IAAI,CAAC;EAErDH,cAAK,CAACI,SAAS,CAAC;IACZ,MAAMC,WAAW,GAAGV,IAAI,CAACO,QAAQ,CAACC,IAAI;IACtC,MAAMG,WAAW,GAAGP,YAAY,CAACQ,OAAO;IACxC,MAAM;MAAEC,KAAK;MAAEC,MAAM;MAAEC;KAAO,GAAGC,SAAS;IAC1C,IAAIC,gBAAgB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AY,CAACH,OAAO,CAAC;GACrC,EAAE,CACC/B,IAAI,CAACmC,cAAc,CAACC,iBAAiB,EACrClC,KAAK,CAACmC,WAAW,EACjBnC,KAAK,CAACoC,YAAY,EAClBpC,KAAK,CAACqC,gBAAgB,EACtBvC,IAAI,CAACwC,MAAM,CAACC,uBAAuB,EACnCzC,IAAI,CAACO,QAAQ,CAACC,IAAI,EAClBR,IAAI,CAAC0C,SAAS,CAACC,MAAM,EACrB3C,IAAI,CAAC4C,QAAQ,CAACC,4BAA4B,EAC1C3C,KAAK,CAAC4C,OAAO,CAChB,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"useSettingsStateListener.js","sources":["../../../../../../../../../src/components/Table3/hooks/listeners/useSettingsStateListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { Table3SettingsHandler } from '../../types';\n\nexport function useSettingsStateListener<TType = unknown>(\n table: RTable<TType>,\n onChangeSettings: Table3SettingsHandler | undefined\n) {\n const meta = table.options.meta as TableMeta<TType>;\n const state = table.getState();\n\n React.useEffect(() => {\n let handler;\n\n if (typeof onChangeSettings === 'function') {\n handler = setTimeout(() => {\n onChangeSettings(meta.getSettings());\n }, 250);\n }\n\n return () => clearTimeout(handler);\n }, [\n meta.columnFreezing.frozenColumnIndex,\n state.columnOrder,\n state.columnSizing,\n state.columnVisibility,\n meta.search.excludeUnmatchedResults,\n meta.fontSize.size,\n meta.rowHeight.height,\n meta.printing.isWarningVisibleForLargeDatasets,\n state.sorting,\n ]);\n}\n"],"names":["useSettingsStateListener","table","onChangeSettings","meta","options","state","getState","React","useEffect","handler","setTimeout","getSettings","clearTimeout","columnFreezing","frozenColumnIndex","columnOrder","columnSizing","columnVisibility","search","excludeUnmatchedResults","fontSize","size","rowHeight","height","printing","isWarningVisibleForLargeDatasets","sorting"],"mappings":";;SAIgBA,wBAAwBA,CACpCC,KAAoB,EACpBC,gBAAmD;EAEnD,MAAMC,IAAI,GAAGF,KAAK,CAACG,OAAO,CAACD,IAAwB;EACnD,MAAME,KAAK,GAAGJ,KAAK,CAACK,QAAQ,EAAE;EAE9BC,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIC,OAAO;IAEX,IAAI,OAAOP,gBAAgB,KAAK,UAAU,EAAE;MACxCO,OAAO,GAAGC,UAAU,CAAC;QACjBR,gBAAgB,CAACC,IAAI,CAACQ,WAAW,EAAE,CAAC;OACvC,EAAE,GAAG,CAAC;;IAGX,OAAO,MAAMC,YAAY,CAACH,OAAO,CAAC;GACrC,EAAE,CACCN,IAAI,CAACU,cAAc,CAACC,iBAAiB,EACrCT,KAAK,CAACU,WAAW,EACjBV,KAAK,CAACW,YAAY,EAClBX,KAAK,CAACY,gBAAgB,EACtBd,IAAI,CAACe,MAAM,CAACC,uBAAuB,EACnChB,IAAI,CAACiB,QAAQ,CAACC,IAAI,EAClBlB,IAAI,CAACmB,SAAS,CAACC,MAAM,EACrBpB,IAAI,CAACqB,QAAQ,CAACC,gCAAgC,EAC9CpB,KAAK,CAACqB,OAAO,CAChB,CAAC;AACN;;;;"}
@@ -114,7 +114,6 @@ function useConvertChildrenToColumns(props, options, editing) {
114
114
  // compiler cannot get filtering out undefined items, so using the type casting here
115
115
  .filter(child => !!child); // need to remove undefined array items after processing the children
116
116
  }
117
-
118
117
  const columns = processChildren(props.children);
119
118
  if (options.enableRowExpansion && props.expandedRowRenderer) {
120
119
  columns.unshift(columnHelper.display(createRowExpansionColumn(props.expandedRowRenderer)));
@@ -1 +1 @@
1
- {"version":3,"file":"useConvertChildrenToColumns.js","sources":["../../../../../../../../src/components/Table3/hooks/useConvertChildrenToColumns.tsx"],"sourcesContent":["import React from 'react';\nimport {\n ColumnDef,\n ColumnSizingState,\n createColumnHelper,\n ColumnSort,\n VisibilityState,\n GroupColumnDef,\n} from '@tanstack/react-table';\nimport { Table3ColumnProps, Table3Props, Table3Options, Table3ColumnDataType, Table3SortFn, Table3GroupProps } from '../types';\nimport { Header } from '../components/columns/header/Header';\nimport { Footer } from '../components/columns/footer/Footer';\nimport { Cell } from '../components/columns/cell/Cell';\nimport { createRowSelectionColumn } from '../components/columns/internal/Selection';\nimport { getFontBasedMinColumnSize } from '../components/columns/styles';\nimport { createRowActionsColumn } from '../components/columns/internal/Actions';\nimport { createRowExpansionColumn } from '../components/columns/internal/Expansion';\nimport { createRowDragColumn } from '../components/columns/internal/Drag';\nimport { createRowEditingActionsColumn } from '../components/columns/internal/EditingActions';\nimport { useEditing } from './features/useEditing';\nimport { Group } from '../components/columns/header/Group';\n\nfunction getSortingFn<TType = unknown>(dataType?: Table3ColumnDataType, customFnOrBuiltIn?: Table3SortFn<TType>) {\n if (typeof customFnOrBuiltIn === 'function') {\n return (rowA, rowB, columnId) => customFnOrBuiltIn(rowA.original, rowB.original, columnId);\n }\n\n // if a built in is being used, just return that\n if (customFnOrBuiltIn) {\n return customFnOrBuiltIn;\n }\n\n // some times we alias based on the type\n if (dataType && dataType !== 'boolean' && dataType !== 'number') {\n return dataType;\n }\n\n // otherwise fall back to auto\n return 'auto';\n}\n\nexport function useConvertChildrenToColumns<TType = unknown>(\n props: Table3Props<TType>,\n options: Table3Options,\n editing: ReturnType<typeof useEditing>\n) {\n const minColumnSize = getFontBasedMinColumnSize(props?.defaultSettings?.fontSize);\n // It's important to memoise column definitions, because it prevents columns like \"Drag column\" to re-render on every state change,\n // and break dragging at the moment it happens.\n return React.useMemo(() => {\n const columnHelper = createColumnHelper<TType>();\n\n const defaultColumnSizing: ColumnSizingState = {};\n const defaultColumnVisibility: VisibilityState = {};\n const defaultSorting: ColumnSort[] = [];\n\n function processChild<TType>(child: React.ReactChild | React.ReactFragment | React.ReactPortal) {\n if (\n React.isValidElement<Table3ColumnProps<TType>>(child) &&\n (child as any).type?.displayName === 'Table3Column' &&\n child.props.accessor\n ) {\n if (child.props.defaultWidth) {\n defaultColumnSizing[child.props.accessor as string] =\n child.props.defaultWidth === 'grow' ? '1fr' : (child.props.defaultWidth as any);\n }\n\n if (child.props.defaultHidden && options.enableColumnHiding) {\n defaultColumnVisibility[child.props.accessor as string] = false;\n }\n\n if (child.props.sort !== undefined) {\n defaultSorting.push({\n id: child.props.accessor as string,\n desc: child.props.sort === 'desc',\n });\n }\n\n // return regular column definition\n return {\n accessorKey: child.props.accessor,\n id: child.props.accessor as string,\n header: Header,\n cell: Cell,\n footer: Footer,\n // sizing\n minSize: minColumnSize,\n enableResizing: child.props.enableResizing ?? true,\n // filtering\n enableColumnFilter: child.props.enableFiltering ?? true,\n filterFn: 'tacoFilter' as any,\n // sorting\n enableSorting: child.props.enableSorting ?? true,\n sortingFn: getSortingFn<TType>(child.props.dataType, child.props.sortFn),\n sortDescFirst: false,\n sortUndefined: 1,\n // visibility\n enableHiding: child.props.enableHiding ?? true,\n // custom options\n meta: {\n align: child.props.align,\n className: child.props.className,\n control: child.props.control,\n dataType: child.props.dataType,\n enableOrdering: child.props.enableOrdering ?? true,\n enablePrinting: child.props.enablePrinting ?? true,\n enableSearch: child.props.enableSearch ?? true,\n enableTruncate: child.props.enableTruncate ?? false,\n filters: child.props.filters,\n footer: child.props.footer,\n header: child.props.header,\n headerClassName: child.props.headerClassName,\n menu: child.props.menu,\n renderer: child.props.renderer,\n tooltip: child.props.tooltip,\n },\n };\n } else if (\n React.isValidElement<Table3GroupProps>(child) &&\n (child as any).type?.displayName === 'Table3Group' &&\n child.props.children\n ) {\n // return column group definition\n return columnHelper.group({\n id: child.props.id,\n header: Group,\n columns: processChildren(child.props.children),\n meta: {\n align: 'center',\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: child.props.header,\n },\n });\n }\n return;\n }\n\n function processChildren<TType = unknown>(\n children: (JSX.Element | boolean | null | undefined)[]\n ): Array<ColumnDef<TType> | GroupColumnDef<TType>> {\n return (\n React.Children.toArray(children)\n .map(processChild)\n // compiler cannot get filtering out undefined items, so using the type casting here\n .filter(child => !!child) as Array<ColumnDef<TType> | GroupColumnDef<TType>>\n ); // need to remove undefined array items after processing the children\n }\n\n const columns: ColumnDef<TType>[] = processChildren(props.children);\n\n if (options.enableRowExpansion && props.expandedRowRenderer) {\n columns.unshift(columnHelper.display(createRowExpansionColumn(props.expandedRowRenderer)));\n }\n\n if (options.enableRowSelection) {\n columns.unshift(\n columnHelper.display(\n createRowSelectionColumn<TType>(!!(options.enableRowDrag && props.onRowDrag), !!props.expandedRowRenderer)\n )\n );\n }\n\n if (options.enableRowDrag && props.onRowDrag) {\n columns.unshift(columnHelper.display(createRowDragColumn(props.onRowDrag)));\n }\n\n if (props.actionsForRow?.length) {\n columns.push(columnHelper.display(createRowActionsColumn<TType>()));\n }\n\n if (editing.isEnabled && editing.isEditing) {\n columns.push(columnHelper.display(createRowEditingActionsColumn<TType>(props.rowIdentifier)));\n }\n\n return { columns, defaultColumnSizing, defaultColumnVisibility, defaultSorting };\n }, [editing.isEditing]);\n}\n"],"names":["getSortingFn","dataType","customFnOrBuiltIn","rowA","rowB","columnId","original","useConvertChildrenToColumns","props","options","editing","minColumnSize","getFontBasedMinColumnSize","_props$defaultSetting","defaultSettings","fontSize","React","useMemo","columnHelper","createColumnHelper","defaultColumnSizing","defaultColumnVisibility","defaultSorting","processChild","child","isValidElement","_child$type","type","displayName","accessor","_child$props$enableRe","_child$props$enableFi","_child$props$enableSo","_child$props$enableHi","_child$props$enableOr","_child$props$enablePr","_child$props$enableSe","_child$props$enableTr","defaultWidth","defaultHidden","enableColumnHiding","sort","undefined","push","id","desc","accessorKey","header","Header","cell","Cell","footer","Footer","minSize","enableResizing","enableColumnFilter","enableFiltering","filterFn","enableSorting","sortingFn","sortFn","sortDescFirst","sortUndefined","enableHiding","meta","align","className","control","enableOrdering","enablePrinting","enableSearch","enableTruncate","filters","headerClassName","menu","renderer","tooltip","_child$type2","children","group","Group","columns","processChildren","Children","toArray","map","filter","enableRowExpansion","expandedRowRenderer","unshift","display","createRowExpansionColumn","enableRowSelection","createRowSelectionColumn","enableRowDrag","onRowDrag","createRowDragColumn","_props$actionsForRow","actionsForRow","length","createR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O,CAACmF,kBAAkB,EAAE;MAC5BX,OAAO,CAACQ,OAAO,CACXvE,YAAY,CAACwE,OAAO,CAChBG,wBAAwB,CAAQ,CAAC,EAAEpF,OAAO,CAACqF,aAAa,IAAItF,KAAK,CAACuF,SAAS,CAAC,EAAE,CAAC,CAACvF,KAAK,CAACgF,mBAAmB,CAAC,CAC7G,CACJ;;IAGL,IAAI/E,OAAO,CAACqF,aAAa,IAAItF,KAAK,CAACuF,SAAS,EAAE;MAC1Cd,OAAO,CAACQ,OAAO,CAACvE,YAAY,CAACwE,OAAO,CAACM,mBAAmB,CAACxF,KAAK,CAACuF,SAAS,CAAC,CAAC,CAAC;;IAG/E,KAAAE,oBAAA,GAAIzF,KAAK,CAAC0F,aAAa,cAAAD,oBAAA,eAAnBA,oBAAA,CAAqBE,MAAM,EAAE;MAC7BlB,OAAO,CAACtC,IAAI,CAACzB,YAAY,CAACwE,OAAO,CAACU,sBAAsB,EAAS,CAAC,CAAC;;IAGvE,IAAI1F,OAAO,CAAC2F,SAAS,IAAI3F,OAAO,CAAC4F,SAAS,EAAE;MACxCrB,OAAO,CAACtC,IAAI,CAACzB,YAAY,CAACwE,OAAO,CAACa,6BAA6B,CAAQ/F,KAAK,CAACgG,aAAa,CAAC,CAAC,CAAC;;IAGjG,OAAO;MAAEvB,OAAO;MAAE7D,mBAAmB;MAAEC,uBAAuB;MAAEC;KAAgB;GACnF,EAAE,CAACZ,OAAO,CAAC4F,SAAS,CAAC,CAAC;AAC3B;;;;"}
1
+ {"version":3,"file":"useConvertChildrenToColumns.js","sources":["../../../../../../../../src/components/Table3/hooks/useConvertChildrenToColumns.tsx"],"sourcesContent":["import React from 'react';\nimport {\n ColumnDef,\n ColumnSizingState,\n createColumnHelper,\n ColumnSort,\n VisibilityState,\n GroupColumnDef,\n} from '@tanstack/react-table';\nimport { Table3ColumnProps, Table3Props, Table3Options, Table3ColumnDataType, Table3SortFn, Table3GroupProps } from '../types';\nimport { Header } from '../components/columns/header/Header';\nimport { Footer } from '../components/columns/footer/Footer';\nimport { Cell } from '../components/columns/cell/Cell';\nimport { createRowSelectionColumn } from '../components/columns/internal/Selection';\nimport { getFontBasedMinColumnSize } from '../components/columns/styles';\nimport { createRowActionsColumn } from '../components/columns/internal/Actions';\nimport { createRowExpansionColumn } from '../components/columns/internal/Expansion';\nimport { createRowDragColumn } from '../components/columns/internal/Drag';\nimport { createRowEditingActionsColumn } from '../components/columns/internal/EditingActions';\nimport { useEditing } from './features/useEditing';\nimport { Group } from '../components/columns/header/Group';\n\nfunction getSortingFn<TType = unknown>(dataType?: Table3ColumnDataType, customFnOrBuiltIn?: Table3SortFn<TType>) {\n if (typeof customFnOrBuiltIn === 'function') {\n return (rowA, rowB, columnId) => customFnOrBuiltIn(rowA.original, rowB.original, columnId);\n }\n\n // if a built in is being used, just return that\n if (customFnOrBuiltIn) {\n return customFnOrBuiltIn;\n }\n\n // some times we alias based on the type\n if (dataType && dataType !== 'boolean' && dataType !== 'number') {\n return dataType;\n }\n\n // otherwise fall back to auto\n return 'auto';\n}\n\nexport function useConvertChildrenToColumns<TType = unknown>(\n props: Table3Props<TType>,\n options: Table3Options,\n editing: ReturnType<typeof useEditing>\n) {\n const minColumnSize = getFontBasedMinColumnSize(props?.defaultSettings?.fontSize);\n // It's important to memoise column definitions, because it prevents columns like \"Drag column\" to re-render on every state change,\n // and break dragging at the moment it happens.\n return React.useMemo(() => {\n const columnHelper = createColumnHelper<TType>();\n\n const defaultColumnSizing: ColumnSizingState = {};\n const defaultColumnVisibility: VisibilityState = {};\n const defaultSorting: ColumnSort[] = [];\n\n function processChild<TType>(child: React.ReactChild | React.ReactFragment | React.ReactPortal) {\n if (\n React.isValidElement<Table3ColumnProps<TType>>(child) &&\n (child as any).type?.displayName === 'Table3Column' &&\n child.props.accessor\n ) {\n if (child.props.defaultWidth) {\n defaultColumnSizing[child.props.accessor as string] =\n child.props.defaultWidth === 'grow' ? '1fr' : (child.props.defaultWidth as any);\n }\n\n if (child.props.defaultHidden && options.enableColumnHiding) {\n defaultColumnVisibility[child.props.accessor as string] = false;\n }\n\n if (child.props.sort !== undefined) {\n defaultSorting.push({\n id: child.props.accessor as string,\n desc: child.props.sort === 'desc',\n });\n }\n\n // return regular column definition\n return {\n accessorKey: child.props.accessor,\n id: child.props.accessor as string,\n header: Header,\n cell: Cell,\n footer: Footer,\n // sizing\n minSize: minColumnSize,\n enableResizing: child.props.enableResizing ?? true,\n // filtering\n enableColumnFilter: child.props.enableFiltering ?? true,\n filterFn: 'tacoFilter' as any,\n // sorting\n enableSorting: child.props.enableSorting ?? true,\n sortingFn: getSortingFn<TType>(child.props.dataType, child.props.sortFn),\n sortDescFirst: false,\n sortUndefined: 1,\n // visibility\n enableHiding: child.props.enableHiding ?? true,\n // custom options\n meta: {\n align: child.props.align,\n className: child.props.className,\n control: child.props.control,\n dataType: child.props.dataType,\n enableOrdering: child.props.enableOrdering ?? true,\n enablePrinting: child.props.enablePrinting ?? true,\n enableSearch: child.props.enableSearch ?? true,\n enableTruncate: child.props.enableTruncate ?? false,\n filters: child.props.filters,\n footer: child.props.footer,\n header: child.props.header,\n headerClassName: child.props.headerClassName,\n menu: child.props.menu,\n renderer: child.props.renderer,\n tooltip: child.props.tooltip,\n },\n };\n } else if (\n React.isValidElement<Table3GroupProps>(child) &&\n (child as any).type?.displayName === 'Table3Group' &&\n child.props.children\n ) {\n // return column group definition\n return columnHelper.group({\n id: child.props.id,\n header: Group,\n columns: processChildren(child.props.children),\n meta: {\n align: 'center',\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: child.props.header,\n },\n });\n }\n return;\n }\n\n function processChildren<TType = unknown>(\n children: (JSX.Element | boolean | null | undefined)[]\n ): Array<ColumnDef<TType> | GroupColumnDef<TType>> {\n return (\n React.Children.toArray(children)\n .map(processChild)\n // compiler cannot get filtering out undefined items, so using the type casting here\n .filter(child => !!child) as Array<ColumnDef<TType> | GroupColumnDef<TType>>\n ); // need to remove undefined array items after processing the children\n }\n\n const columns: ColumnDef<TType>[] = processChildren(props.children);\n\n if (options.enableRowExpansion && props.expandedRowRenderer) {\n columns.unshift(columnHelper.display(createRowExpansionColumn(props.expandedRowRenderer)));\n }\n\n if (options.enableRowSelection) {\n columns.unshift(\n columnHelper.display(\n createRowSelectionColumn<TType>(!!(options.enableRowDrag && props.onRowDrag), !!props.expandedRowRenderer)\n )\n );\n }\n\n if (options.enableRowDrag && props.onRowDrag) {\n columns.unshift(columnHelper.display(createRowDragColumn(props.onRowDrag)));\n }\n\n if (props.actionsForRow?.length) {\n columns.push(columnHelper.display(createRowActionsColumn<TType>()));\n }\n\n if (editing.isEnabled && editing.isEditing) {\n columns.push(columnHelper.display(createRowEditingActionsColumn<TType>(props.rowIdentifier)));\n }\n\n return { columns, defaultColumnSizing, defaultColumnVisibility, defaultSorting };\n }, [editing.isEditing]);\n}\n"],"names":["getSortingFn","dataType","customFnOrBuiltIn","rowA","rowB","columnId","original","useConvertChildrenToColumns","props","options","editing","minColumnSize","getFontBasedMinColumnSize","_props$defaultSetting","defaultSettings","fontSize","React","useMemo","columnHelper","createColumnHelper","defaultColumnSizing","defaultColumnVisibility","defaultSorting","processChild","child","isValidElement","_child$type","type","displayName","accessor","_child$props$enableRe","_child$props$enableFi","_child$props$enableSo","_child$props$enableHi","_child$props$enableOr","_child$props$enablePr","_child$props$enableSe","_child$props$enableTr","defaultWidth","defaultHidden","enableColumnHiding","sort","undefined","push","id","desc","accessorKey","header","Header","cell","Cell","footer","Footer","minSize","enableResizing","enableColumnFilter","enableFiltering","filterFn","enableSorting","sortingFn","sortFn","sortDescFirst","sortUndefined","enableHiding","meta","align","className","control","enableOrdering","enablePrinting","enableSearch","enableTruncate","filters","headerClassName","menu","renderer","tooltip","_child$type2","children","group","Group","columns","processChildren","Children","toArray","map","filter","enableRowExpansion","expandedRowRenderer","unshift","display","createRowExpansionColumn","enableRowSelection","createRowSelectionColumn","enableRowDrag","onRowDrag","createRowDragColumn","_props$actionsForRow","actionsForRow","length","createRowActionsColum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,kBAAkB,EAAE;MAC5BX,OAAO,CAACQ,OAAO,CACXvE,YAAY,CAACwE,OAAO,CAChBG,wBAAwB,CAAQ,CAAC,EAAEpF,OAAO,CAACqF,aAAa,IAAItF,KAAK,CAACuF,SAAS,CAAC,EAAE,CAAC,CAACvF,KAAK,CAACgF,mBAAmB,CAAC,CAC7G,CACJ;;IAGL,IAAI/E,OAAO,CAACqF,aAAa,IAAItF,KAAK,CAACuF,SAAS,EAAE;MAC1Cd,OAAO,CAACQ,OAAO,CAACvE,YAAY,CAACwE,OAAO,CAACM,mBAAmB,CAACxF,KAAK,CAACuF,SAAS,CAAC,CAAC,CAAC;;IAG/E,KAAAE,oBAAA,GAAIzF,KAAK,CAAC0F,aAAa,cAAAD,oBAAA,eAAnBA,oBAAA,CAAqBE,MAAM,EAAE;MAC7BlB,OAAO,CAACtC,IAAI,CAACzB,YAAY,CAACwE,OAAO,CAACU,sBAAsB,EAAS,CAAC,CAAC;;IAGvE,IAAI1F,OAAO,CAAC2F,SAAS,IAAI3F,OAAO,CAAC4F,SAAS,EAAE;MACxCrB,OAAO,CAACtC,IAAI,CAACzB,YAAY,CAACwE,OAAO,CAACa,6BAA6B,CAAQ/F,KAAK,CAACgG,aAAa,CAAC,CAAC,CAAC;;IAGjG,OAAO;MAAEvB,OAAO;MAAE7D,mBAAmB;MAAEC,uBAAuB;MAAEC;KAAgB;GACnF,EAAE,CAACZ,OAAO,CAAC4F,SAAS,CAAC,CAAC;AAC3B;;;;"}
@@ -14,7 +14,6 @@ const getCellHeightPadding = (height, fontSize) => {
14
14
  // py-1.5
15
15
  }
16
16
  }
17
-
18
17
  case 'tall':
19
18
  {
20
19
  switch (fontSize) {
@@ -61,7 +60,6 @@ const getCellWidthPadding = fontSize => {
61
60
  // py-1.5
62
61
  }
63
62
  };
64
-
65
63
  const useCssVars = (height, fontSize) => {
66
64
  const style = {
67
65
  '--table3-cell-padding-x': getCellWidthPadding(fontSize),
@@ -1 +1 @@
1
- {"version":3,"file":"useCssVars.js","sources":["../../../../../../../../src/components/Table3/hooks/useCssVars.ts"],"sourcesContent":["import { FONT_SIZE } from '../components/toolbar/FontSize';\nimport { Table3FontSize, Table3RowHeight } from '../types';\n\n// we cannot just use a fixed height because our rows need to grow in height (images, edit mode validation etc)\nconst getCellHeightPadding = (height: Table3RowHeight, fontSize: Table3FontSize) => {\n // TODO: can we get the rem values from tailwind\n switch (height) {\n case 'short': {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '8px';\n\n default:\n return '6px'; // py-1.5\n }\n }\n\n case 'tall': {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '16px';\n\n case FONT_SIZE.large:\n return '12px';\n\n default:\n return '14px';\n }\n }\n\n case 'extra-tall': {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '22px';\n\n case FONT_SIZE.large:\n return '18px';\n\n default:\n return '20px';\n }\n }\n\n default: {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '12px';\n\n case FONT_SIZE.large:\n return '8px';\n\n default:\n return '10px';\n }\n }\n }\n};\n\nconst getCellWidthPadding = (fontSize: Table3FontSize) => {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '8px';\n\n case FONT_SIZE.medium:\n return '12px';\n\n default:\n return '16px'; // py-1.5\n }\n};\n\nexport const useCssVars = (height: Table3RowHeight, fontSize: Table3FontSize) => {\n const style = {\n '--table3-cell-padding-x': getCellWidthPadding(fontSize),\n '--table3-cell-padding-y': getCellHeightPadding(height, fontSize),\n };\n\n return { style };\n};\n"],"names":["getCellHeightPadding","height","fontSize","FONT_SIZE","small","large","getCellWidthPadding","medium","useCssVars","style"],"mappings":";;AAGA;AACA,MAAMA,oBAAoB,GAAGA,CAACC,MAAuB,EAAEC,QAAwB;;EAE3E,QAAQD,MAAM;IACV,KAAK,OAAO;MAAE;QACV,QAAQC,QAAQ;UACZ,KAAKC,SAAS,CAACC,KAAK;YAChB,OAAO,KAAK;UAEhB;YACI,OAAO,KAAK;;;;;IAIxB,KAAK,MAAM;MAAE;QACT,QAAQF,QAAQ;UACZ,KAAKC,SAAS,CAACC,KAAK;YAChB,OAAO,MAAM;UAEjB,KAAKD,SAAS,CAACE,KAAK;YAChB,OAAO,MAAM;UAEjB;YACI,OAAO,MAAM;;;IAIzB,KAAK,YAAY;MAAE;QACf,QAAQH,QAAQ;UACZ,KAAKC,SAAS,CAACC,KAAK;YAChB,OAAO,MAAM;UAEjB,KAAKD,SAAS,CAACE,KAAK;YAChB,OAAO,MAAM;UAEjB;YACI,OAAO,MAAM;;;IAIzB;MAAS;QACL,QAAQH,QAAQ;UACZ,KAAKC,SAAS,CAACC,KAAK;YAChB,OAAO,MAAM;UAEjB,KAAKD,SAAS,CAACE,KAAK;YAChB,OAAO,KAAK;UAEhB;YACI,OAAO,MAAM;;;;AAIjC,CAAC;AAED,MAAMC,mBAAmB,GAAIJ,QAAwB;EACjD,QAAQA,QAAQ;IACZ,KAAKC,SAAS,CAACC,KAAK;MAChB,OAAO,KAAK;IAEhB,KAAKD,SAAS,CAACI,MAAM;MACjB,OAAO,MAAM;IAEjB;MACI,OAAO,MAAM;;;AAEzB,CAAC;;MAEYC,UAAU,GAAGA,CAACP,MAAuB,EAAEC,QAAwB;EACxE,MAAMO,KAAK,GAAG;IACV,yBAAyB,EAAEH,mBAAmB,CAACJ,QAAQ,CAAC;IACxD,yBAAyB,EAAEF,oBAAoB,CAACC,MAAM,EAAEC,QAAQ;GACnE;EAED,OAAO;IAAEO;GAAO;AACpB;;;;"}
1
+ {"version":3,"file":"useCssVars.js","sources":["../../../../../../../../src/components/Table3/hooks/useCssVars.ts"],"sourcesContent":["import { FONT_SIZE } from '../components/toolbar/FontSize';\nimport { Table3FontSize, Table3RowHeight } from '../types';\n\n// we cannot just use a fixed height because our rows need to grow in height (images, edit mode validation etc)\nconst getCellHeightPadding = (height: Table3RowHeight, fontSize: Table3FontSize) => {\n // TODO: can we get the rem values from tailwind\n switch (height) {\n case 'short': {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '8px';\n\n default:\n return '6px'; // py-1.5\n }\n }\n\n case 'tall': {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '16px';\n\n case FONT_SIZE.large:\n return '12px';\n\n default:\n return '14px';\n }\n }\n\n case 'extra-tall': {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '22px';\n\n case FONT_SIZE.large:\n return '18px';\n\n default:\n return '20px';\n }\n }\n\n default: {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '12px';\n\n case FONT_SIZE.large:\n return '8px';\n\n default:\n return '10px';\n }\n }\n }\n};\n\nconst getCellWidthPadding = (fontSize: Table3FontSize) => {\n switch (fontSize) {\n case FONT_SIZE.small:\n return '8px';\n\n case FONT_SIZE.medium:\n return '12px';\n\n default:\n return '16px'; // py-1.5\n }\n};\n\nexport const useCssVars = (height: Table3RowHeight, fontSize: Table3FontSize) => {\n const style = {\n '--table3-cell-padding-x': getCellWidthPadding(fontSize),\n '--table3-cell-padding-y': getCellHeightPadding(height, fontSize),\n };\n\n return { style };\n};\n"],"names":["getCellHeightPadding","height","fontSize","FONT_SIZE","small","large","getCellWidthPadding","medium","useCssVars","style"],"mappings":";;AAGA;AACA,MAAMA,oBAAoB,GAAGA,CAACC,MAAuB,EAAEC,QAAwB;;EAE3E,QAAQD,MAAM;IACV,KAAK,OAAO;MAAE;QACV,QAAQC,QAAQ;UACZ,KAAKC,SAAS,CAACC,KAAK;YAChB,OAAO,KAAK;UAEhB;YACI,OAAO,KAAK;;;;IAIxB,KAAK,MAAM;MAAE;QACT,QAAQF,QAAQ;UACZ,KAAKC,SAAS,CAACC,KAAK;YAChB,OAAO,MAAM;UAEjB,KAAKD,SAAS,CAACE,KAAK;YAChB,OAAO,MAAM;UAEjB;YACI,OAAO,MAAM;;;IAIzB,KAAK,YAAY;MAAE;QACf,QAAQH,QAAQ;UACZ,KAAKC,SAAS,CAACC,KAAK;YAChB,OAAO,MAAM;UAEjB,KAAKD,SAAS,CAACE,KAAK;YAChB,OAAO,MAAM;UAEjB;YACI,OAAO,MAAM;;;IAIzB;MAAS;QACL,QAAQH,QAAQ;UACZ,KAAKC,SAAS,CAACC,KAAK;YAChB,OAAO,MAAM;UAEjB,KAAKD,SAAS,CAACE,KAAK;YAChB,OAAO,KAAK;UAEhB;YACI,OAAO,MAAM;;;;AAIjC,CAAC;AAED,MAAMC,mBAAmB,GAAIJ,QAAwB;EACjD,QAAQA,QAAQ;IACZ,KAAKC,SAAS,CAACC,KAAK;MAChB,OAAO,KAAK;IAEhB,KAAKD,SAAS,CAACI,MAAM;MACjB,OAAO,MAAM;IAEjB;MACI,OAAO,MAAM;;;AAEzB,CAAC;MAEYC,UAAU,GAAGA,CAACP,MAAuB,EAAEC,QAAwB;EACxE,MAAMO,KAAK,GAAG;IACV,yBAAyB,EAAEH,mBAAmB,CAACJ,QAAQ,CAAC;IACxD,yBAAyB,EAAEF,oBAAoB,CAACC,MAAM,EAAEC,QAAQ;GACnE;EAED,OAAO;IAAEO;GAAO;AACpB;;;;"}
@@ -1,121 +1,73 @@
1
1
  import React__default from 'react';
2
- import { getFilteredRowModel, getSortedRowModel, useReactTable, getCoreRowModel } from '@tanstack/react-table';
2
+ import { useReactTable, getCoreRowModel, getFilteredRowModel, getSortedRowModel } from '@tanstack/react-table';
3
+ import { COLUMN_ID } from '../components/columns/internal/Actions.js';
3
4
  import { getCellValueAsString } from '../util/columns.js';
4
- import { useCurrentRow } from './features/useCurrentRow.js';
5
- import { usePauseHoverState } from './features/usePauseHoverState.js';
5
+ import { ensureOrdering } from '../../../primitives/Table/useTable/util/columns.js';
6
+ import { useTableRowActive } from '../../../primitives/Table/useTable/features/useTableRowActive.js';
6
7
  import { useTablePreset } from './useTablePreset.js';
7
- import { useRowHeight } from './features/useRowHeight.js';
8
- import { useFontSize } from './features/useFontSize.js';
9
- import { useRowSelectionListener } from './listeners/useRowSelectionListener.js';
8
+ import { useTableRowHeight } from '../../../primitives/Table/useTable/features/useTableRowHeight.js';
9
+ import { useTableFontSize } from '../../../primitives/Table/useTable/features/useTableFontSize.js';
10
+ import { useTableRowSelectionListener } from '../../../primitives/Table/useTable/listeners/useTableRowSelectionListener.js';
10
11
  import { useRowDrag } from './features/useRowDrag.js';
11
12
  import { useSettingsStateListener } from './listeners/useSettingsStateListener.js';
12
13
  import { columnFilterFn, globalFilterFn } from '../util/filtering.js';
13
- import { useSortingStateListener } from './listeners/useSortingStateListener.js';
14
- import { useFilteringStateListener } from './listeners/useFilteringStateListener.js';
15
- import { useCurrentRowListener } from './listeners/useCurrentRowListener.js';
14
+ import { useTableSortingListener } from '../../../primitives/Table/useTable/listeners/useTableSortingListener.js';
15
+ import { useTableFilterListener } from '../../../primitives/Table/useTable/listeners/useTableFilterListener.js';
16
+ import { useTableDataListener } from '../../../primitives/Table/useTable/listeners/useTableDataListener.js';
16
17
  import { useColumnFreezing } from './features/useColumnFreezing.js';
17
- import { useRowSelection } from './features/useRowSelection.js';
18
- import { useRowClick } from './features/useRowClick.js';
19
- import { useEditing } from './features/useEditing.js';
20
- import { ensureOrdering, useColumnOrdering } from './features/useColumnOrdering.js';
18
+ import { useTableRowSelection } from '../../../primitives/Table/useTable/features/useTableRowSelection.js';
19
+ import { useTableServerLoading } from '../../../primitives/Table/useTable/features/useTableServerLoading.js';
20
+ import { useTableRowClick } from '../../../primitives/Table/useTable/features/useTableRowClick.js';
21
+ import { useTableColumnOrdering } from '../../../primitives/Table/useTable/features/useTableColumnOrdering.js';
21
22
  import { useRowDrop } from './features/useRowDrop.js';
23
+ import { useEditing } from './features/useEditing.js';
24
+ import { COLUMN_ID as COLUMN_ID$1 } from '../components/columns/internal/EditingActions.js';
22
25
  import { useConvertChildrenToColumns } from './useConvertChildrenToColumns.js';
23
- import { usePrinting } from './features/usePrinting.js';
24
- import { useShortcutsListener } from './listeners/useShortcutsListener.js';
25
- import { useRowGoto } from './features/useRowGoto.js';
26
- import { useServerLoadingListener } from './listeners/useServerLoadingListener.js';
26
+ import { useTablePrinting } from '../../../primitives/Table/useTable/features/useTablePrinting.js';
27
+ import { useTableShortcutsListener } from '../../../primitives/Table/useTable/listeners/useTableShortcutsListener.js';
28
+ import { useTableRowGoto } from '../../../primitives/Table/useTable/features/useTableRowGoto.js';
29
+ import { useTableServerLoadingListener } from '../../../primitives/Table/useTable/listeners/useTableServerLoadingListener.js';
27
30
  import { useEditingStateListener } from './listeners/useEditingStateListener.js';
28
31
  import { useSearch } from './features/useSearch.js';
29
32
  import { useRowActions } from './features/useRowActions.js';
30
33
  import { useSettings } from './features/useSettings.js';
31
34
  import { useValidation } from './features/useValidation.js';
32
35
  import { usePauseShortcuts } from './features/usePauseShortcuts.js';
36
+ import { useTableFontSizeListener } from '../../../primitives/Table/useTable/listeners/useTableFontSizeListener.js';
33
37
 
34
- function useTable(props) {
35
- var _ref, _defaultSettings$colu, _defaultSettings$rowH, _props$length;
36
- // options
38
+ function useTable(props, ref) {
39
+ var _settings$columnFreez, _props$length;
40
+ // load any persisted table settings and merge them with any defaults
41
+ const [settings, setSettings] = useSettings(props.id, props.defaultSettings, props.onChangeSettings);
42
+ // configure table3 options
37
43
  const options = useTablePreset(props);
38
- const tableOptions = {
39
- enableColumnFilters: options.enableFiltering,
40
- enableColumnResizing: options.enableColumnResizing,
41
- enableExpanding: options.enableRowExpansion,
42
- enableGlobalFilter: options.enableSearch,
43
- enableHiding: options.enableColumnHiding,
44
- enableRowSelection: options.enableRowSelection,
45
- enableMultiRowSelection: !options.enableRowSelectionSingle,
46
- enableSorting: options.enableSorting
47
- };
48
- // resizing
49
- if (tableOptions.enableColumnResizing) {
50
- tableOptions.columnResizeMode = 'onChange';
51
- }
52
- // filtering
53
- if (tableOptions.enableColumnFilters) {
54
- if (!props.onFilter) {
55
- tableOptions.filterFns = {
56
- tacoFilter: (row, columnId, filter) => columnFilterFn(row.getValue(columnId), filter)
57
- };
58
- tableOptions.getFilteredRowModel = getFilteredRowModel();
59
- }
60
- // we don't tableOptions.manualFiltering = true; because it breaks global filtering, server filtering still works :shrug:
61
- }
62
- // search
63
- if (tableOptions.enableGlobalFilter) {
64
- // search is always client side, since we call loadAll when searching
65
- tableOptions.globalFilterFn = (row, columnId, searchQuery) => {
66
- try {
67
- if (row.original) {
68
- const cell = row.getAllCells().find(cell => cell.column.id === columnId);
69
- const columnMeta = cell === null || cell === void 0 ? void 0 : cell.column.columnDef.meta;
70
- if (cell && cell.column.getIsVisible() && columnMeta !== null && columnMeta !== void 0 && columnMeta.enableSearch) {
71
- const cellValue = getCellValueAsString(row.original[columnId], columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.dataType);
72
- if (cellValue !== undefined) {
73
- return globalFilterFn(cellValue, searchQuery);
74
- }
75
- }
76
- return false;
77
- }
78
- } catch {
79
- //
80
- }
81
- return false;
82
- };
83
- tableOptions.getFilteredRowModel = getFilteredRowModel();
84
- tableOptions.getColumnCanGlobalFilter = column => {
85
- var _column$columnDef$met;
86
- return (_column$columnDef$met = column.columnDef.meta.enableSearch) !== null && _column$columnDef$met !== void 0 ? _column$columnDef$met : true;
87
- };
88
- }
89
- // sorting
90
- if (options.enableSorting) {
91
- if (props.onSort) {
92
- tableOptions.manualSorting = true;
93
- // onSort is called as a listener to let the consumer update their data, so we don't use onSortingChange
94
- } else {
95
- tableOptions.getSortedRowModel = getSortedRowModel();
96
- }
97
- }
98
- const [defaultSettings, setSettings] = useSettings(props.id, props.defaultSettings, props.onChangeSettings);
99
- // custom features
100
- const columnFreezing = useColumnFreezing( // temporarily see if deprecated frozenColumnCount is there
101
- (_ref = (_defaultSettings$colu = defaultSettings.columnFreezingIndex) !== null && _defaultSettings$colu !== void 0 ? _defaultSettings$colu : defaultSettings === null || defaultSettings === void 0 ? void 0 : defaultSettings.frozenColumnCount) !== null && _ref !== void 0 ? _ref : props.defaultColumnFreezingIndex, options);
102
- const columnOrdering = useColumnOrdering(options);
103
- const currentRow = useCurrentRow(props.defaultCurrentRowIndex);
44
+ // configure react-table built-in features
45
+ const tableOptions = configureReactTableOptions(props, options);
46
+ // configure custom features
47
+ const columnFreezing = useColumnFreezing((_settings$columnFreez = settings.columnFreezingIndex) !== null && _settings$columnFreez !== void 0 ? _settings$columnFreez : props.defaultColumnFreezingIndex, options);
48
+ // can't change due to rename to "active row"
104
49
  const validation = useValidation(props.onCellValidate, props.onRowValidate);
50
+ // not relevant to common table
105
51
  const editing = useEditing(options.enableEditing, validation, props.onSave);
106
- const fontSize = useFontSize(options.enableFontSize, defaultSettings.fontSize);
107
- const hoverState = usePauseHoverState();
108
- const printing = usePrinting(options.enablePrinting, props.loadAll, defaultSettings.showWarningWhenPrintingLargeDataset);
52
+ // needs to be moved
109
53
  const rowActions = useRowActions(props.actionsForRow, props.actionsForRowLength);
110
- const rowClick = useRowClick(props.onRowClick);
54
+ // not relevant to common table
111
55
  const rowDrag = useRowDrag(options.enableRowDrag);
56
+ // not relevant to common table
112
57
  const rowDrop = useRowDrop(options.enableRowDrop, props.onRowDrop);
113
- const rowGoto = useRowGoto(options.enableRowGoto, props.onRowGoto);
114
- const rowHeight = useRowHeight(options.enableRowHeight, // temporarily see if deprecated rowDensity is there
115
- (_defaultSettings$rowH = defaultSettings.rowHeight) !== null && _defaultSettings$rowH !== void 0 ? _defaultSettings$rowH : defaultSettings === null || defaultSettings === void 0 ? void 0 : defaultSettings.rowDensity);
116
- const rowSelection = useRowSelection();
117
- const search = useSearch(options.enableSearch, defaultSettings.excludeUnmatchedRecordsInSearch, props.loadAll);
58
+ // haven't migrated load all/server loading yet
59
+ const search = useSearch(options.enableSearch, settings.excludeUnmatchedRecordsInSearch);
118
60
  const shortcutsState = usePauseShortcuts();
61
+ // custom features - shared/migrated
62
+ const columnOrdering = useTableColumnOrdering(options.enableColumnOrdering);
63
+ const fontSize = useTableFontSize(options.enableFontSize, settings.fontSize);
64
+ const printing = useTablePrinting(options.enablePrinting, settings.showWarningWhenPrintingLargeDataset, props.id);
65
+ const rowActive = useTableRowActive(true, props.defaultCurrentRowIndex);
66
+ const rowClick = useTableRowClick(true, props.onRowClick);
67
+ const rowGoto = useTableRowGoto(options.enableRowGoto, props.onRowGoto);
68
+ const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);
69
+ const rowSelection = useTableRowSelection(options.enableRowSelection);
70
+ const server = useTableServerLoading(props.loadPage, props.loadAll);
119
71
  // columns
120
72
  const {
121
73
  columns,
@@ -125,13 +77,13 @@ function useTable(props) {
125
77
  } = useConvertChildrenToColumns(props, options, editing);
126
78
  // built-in features
127
79
  const initialState = React__default.useMemo(() => {
128
- var _defaultSettings$colu2, _defaultSettings$colu3, _props$defaultSetting, _props$defaultSetting3;
80
+ var _settings$columnSizin, _settings$columnVisib, _props$defaultSetting, _props$defaultSetting3;
129
81
  const sanitizeSortedColumns = column => columns.find(definedColumn => definedColumn.id === column.id);
130
82
  const state = {
131
- columnOrder: ensureOrdering(columns, defaultSettings.columnOrder),
132
- columnSizing: (_defaultSettings$colu2 = defaultSettings.columnSizing) !== null && _defaultSettings$colu2 !== void 0 ? _defaultSettings$colu2 : defaultColumnSizing,
133
- columnVisibility: (_defaultSettings$colu3 = defaultSettings.columnVisibility) !== null && _defaultSettings$colu3 !== void 0 ? _defaultSettings$colu3 : defaultColumnVisibility,
134
- sorting: defaultSettings.sorting ? defaultSettings.sorting.filter(sanitizeSortedColumns) : defaultSorting
83
+ columnOrder: ensureOrdering(columns, [COLUMN_ID, COLUMN_ID$1], settings.columnOrder),
84
+ columnSizing: (_settings$columnSizin = settings.columnSizing) !== null && _settings$columnSizin !== void 0 ? _settings$columnSizin : defaultColumnSizing,
85
+ columnVisibility: (_settings$columnVisib = settings.columnVisibility) !== null && _settings$columnVisib !== void 0 ? _settings$columnVisib : defaultColumnVisibility,
86
+ sorting: settings.sorting ? settings.sorting.filter(sanitizeSortedColumns) : defaultSorting
135
87
  };
136
88
  // we don't save these outside the table, but they need to be here for print to inherit them - see PrintButton.tsx
137
89
  if ((_props$defaultSetting = props.defaultSettings) !== null && _props$defaultSetting !== void 0 && _props$defaultSetting.columnFilters) {
@@ -154,7 +106,7 @@ function useTable(props) {
154
106
  excludeUnmatchedRecordsInSearch: search.excludeUnmatchedResults,
155
107
  fontSize: fontSize.isEnabled ? fontSize.size : undefined,
156
108
  rowHeight: rowHeight.isEnabled ? rowHeight.height : undefined,
157
- showWarningWhenPrintingLargeDataset: printing.printWarningDialogVisibility,
109
+ showWarningWhenPrintingLargeDataset: printing.isWarningVisibleForLargeDatasets,
158
110
  sorting: state.sorting
159
111
  };
160
112
  };
@@ -168,16 +120,15 @@ function useTable(props) {
168
120
  meta: {
169
121
  columnFreezing,
170
122
  columnOrdering,
171
- currentRow,
172
123
  editing,
173
124
  enableFooter: options.enableFooter,
174
125
  fontSize,
175
126
  getSettings,
176
- hoverState,
177
127
  isPrinting: props.id.endsWith('_print'),
178
128
  isUsingServer: !!props.loadPage,
179
129
  printing,
180
130
  rowActions: rowActions,
131
+ rowActive,
181
132
  rowClick: rowClick,
182
133
  rowDrag,
183
134
  rowDrop,
@@ -185,24 +136,91 @@ function useTable(props) {
185
136
  rowHeight,
186
137
  rowSelection,
187
138
  search,
139
+ server,
188
140
  shortcutsState,
141
+ tableRef: ref,
189
142
  validation
190
143
  }
191
144
  });
192
145
  // listeners
193
- useCurrentRowListener(table);
194
146
  useEditingStateListener(table);
195
- useFilteringStateListener(table, props.onFilter);
196
- useRowSelectionListener(table, props.onRowSelect);
197
147
  useSettingsStateListener(table, setSettings);
198
- useShortcutsListener(table, props.shortcuts);
199
- useServerLoadingListener(table, props.loadPage);
200
- useSortingStateListener(table, props.onSort);
148
+ // listeners - shared/migrated
149
+ useTableDataListener(table);
150
+ useTableFilterListener(table, props.onFilter);
151
+ useTableFontSizeListener(table);
152
+ useTableRowSelectionListener(table, props.onRowSelect);
153
+ useTableServerLoadingListener(table, props.loadPage);
154
+ useTableShortcutsListener(table, props.shortcuts);
155
+ useTableSortingListener(table, props.onSort);
201
156
  return {
202
157
  table,
203
158
  length: (_props$length = props.length) !== null && _props$length !== void 0 ? _props$length : props.data.length
204
159
  };
205
160
  }
161
+ function configureReactTableOptions(props, options) {
162
+ const tableOptions = {
163
+ enableColumnFilters: options.enableFiltering,
164
+ enableColumnResizing: options.enableColumnResizing,
165
+ enableExpanding: options.enableRowExpansion,
166
+ enableGlobalFilter: options.enableSearch,
167
+ enableHiding: options.enableColumnHiding,
168
+ enableRowSelection: options.enableRowSelection,
169
+ enableMultiRowSelection: !options.enableRowSelectionSingle,
170
+ enableSorting: options.enableSorting
171
+ };
172
+ // resizing
173
+ if (tableOptions.enableColumnResizing) {
174
+ tableOptions.columnResizeMode = 'onChange';
175
+ }
176
+ // filtering
177
+ if (tableOptions.enableColumnFilters) {
178
+ if (!props.onFilter) {
179
+ tableOptions.filterFns = {
180
+ tacoFilter: (row, columnId, filter) => columnFilterFn(row.getValue(columnId), filter)
181
+ };
182
+ tableOptions.getFilteredRowModel = getFilteredRowModel();
183
+ }
184
+ // we don't tableOptions.manualFiltering = true; because it breaks global filtering, server filtering still works :shrug:
185
+ }
186
+ // search
187
+ if (tableOptions.enableGlobalFilter) {
188
+ // search is always client side, since we call loadAll when searching
189
+ tableOptions.globalFilterFn = (row, columnId, searchQuery) => {
190
+ try {
191
+ if (row.original) {
192
+ const cell = row.getAllCells().find(cell => cell.column.id === columnId);
193
+ const columnMeta = cell === null || cell === void 0 ? void 0 : cell.column.columnDef.meta;
194
+ if (cell && cell.column.getIsVisible() && columnMeta !== null && columnMeta !== void 0 && columnMeta.enableSearch) {
195
+ const cellValue = getCellValueAsString(row.original[columnId], columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.dataType);
196
+ if (cellValue !== undefined) {
197
+ return globalFilterFn(cellValue, searchQuery);
198
+ }
199
+ }
200
+ return false;
201
+ }
202
+ } catch {
203
+ //
204
+ }
205
+ return false;
206
+ };
207
+ tableOptions.getFilteredRowModel = getFilteredRowModel();
208
+ tableOptions.getColumnCanGlobalFilter = column => {
209
+ var _column$columnDef$met;
210
+ return (_column$columnDef$met = column.columnDef.meta.enableSearch) !== null && _column$columnDef$met !== void 0 ? _column$columnDef$met : true;
211
+ };
212
+ }
213
+ // sorting
214
+ if (options.enableSorting) {
215
+ if (props.onSort) {
216
+ tableOptions.manualSorting = true;
217
+ // onSort is called as a listener to let the consumer update their data, so we don't use onSortingChange
218
+ } else {
219
+ tableOptions.getSortedRowModel = getSortedRowModel();
220
+ }
221
+ }
222
+ return tableOptions;
223
+ }
206
224
 
207
225
  export { useTable };
208
226
  //# sourceMappingURL=useTable.js.map