@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
@@ -17,14 +17,14 @@ function PrintButton(props) {
17
17
  texts
18
18
  } = useLocalization();
19
19
  const toast = useToast();
20
- const [isPrinting, setIsPrinting] = React__default.useState(false);
20
+ const [isCurrentlyPrinting, setIsCurrentlyPrinting] = React__default.useState(false);
21
21
  const [showWarningDialog, setShowWarningDialog] = React__default.useState(false);
22
22
  const loadingToastRef = React__default.useRef(null);
23
23
  const buttonRef = React__default.useRef(null);
24
24
  const tableMeta = table.options.meta;
25
25
  const state = table.getState();
26
26
  const {
27
- printWarningDialogVisibility
27
+ isWarningVisibleForLargeDatasets
28
28
  } = tableMeta.printing;
29
29
  // When changing printTableId, update packages/taco/src/components/Table3/Table3.tsx file and other usages where
30
30
  // printTableId is used to figure out whether the table is a print table or not.
@@ -77,8 +77,8 @@ function PrintButton(props) {
77
77
  const restoreTableDataWithoutSearch = function () {
78
78
  try {
79
79
  const _temp = _catch(function () {
80
- var _tableMeta$printing$l, _tableMeta$printing;
81
- return Promise.resolve((_tableMeta$printing$l = (_tableMeta$printing = tableMeta.printing).loadAll) === null || _tableMeta$printing$l === void 0 ? void 0 : _tableMeta$printing$l.call(_tableMeta$printing, table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
80
+ var _tableMeta$server$loa, _tableMeta$server;
81
+ return Promise.resolve((_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadAll) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
82
82
  }, function (error) {
83
83
  handleLoadingError(error);
84
84
  });
@@ -91,11 +91,11 @@ function PrintButton(props) {
91
91
  try {
92
92
  function _temp3() {
93
93
  var _loadingToastRef$curr2;
94
- setIsPrinting(false);
94
+ setIsCurrentlyPrinting(false);
95
95
  (_loadingToastRef$curr2 = loadingToastRef.current) === null || _loadingToastRef$curr2 === void 0 ? void 0 : _loadingToastRef$curr2.close();
96
96
  }
97
97
  const _temp2 = function () {
98
- if (tableMeta.printing.loadAll && excludeUnmatchedResults) {
98
+ if (tableMeta.server.loadAll && excludeUnmatchedResults) {
99
99
  return Promise.resolve(restoreTableDataWithoutSearch()).then(function () {});
100
100
  }
101
101
  }();
@@ -113,11 +113,11 @@ function PrintButton(props) {
113
113
  let _exit = false;
114
114
  function _temp6(_result3) {
115
115
  if (_exit) return _result3;
116
- if (hasNonSafeCellCount && printWarningDialogVisibility) {
116
+ if (hasNonSafeCellCount && isWarningVisibleForLargeDatasets) {
117
117
  setShowWarningDialog(true);
118
118
  } else {
119
119
  // only set printing (mount the iframe) when the data has loaded, it prevents repaint performance slow downs
120
- setIsPrinting(true);
120
+ setIsCurrentlyPrinting(true);
121
121
  }
122
122
  }
123
123
  loadingToastRef.current = toast.loading(texts.table3.print.loading);
@@ -126,7 +126,7 @@ function PrintButton(props) {
126
126
  // if loadAll is not defined, just print with what we've got
127
127
  // don't compare length to data.length because the api might be choosing not to return all for performance
128
128
  const _temp5 = function () {
129
- if (!tableMeta.printing.loadAll) {
129
+ if (!tableMeta.server.loadAll) {
130
130
  const {
131
131
  data
132
132
  } = tableProps;
@@ -134,7 +134,7 @@ function PrintButton(props) {
134
134
  hasNonSafeCellCount = cellCount > SAFE_PRINT_CELL_COUNT;
135
135
  } else {
136
136
  const _temp4 = _catch(function () {
137
- return Promise.resolve(tableMeta.printing.loadAll(table.getState().sorting, table.getState().columnFilters,
137
+ return Promise.resolve(tableMeta.server.loadAll(table.getState().sorting, table.getState().columnFilters,
138
138
  // We need to pass search query to the server when printing, to be able to render correct data set in iFrame,
139
139
  // But in "display" table, search is performed only on client side, so we'll need to request data again without search query,
140
140
  // when printing will be finished.
@@ -161,12 +161,12 @@ function PrintButton(props) {
161
161
  }
162
162
  };
163
163
  const handleWarningDialogAccept = () => {
164
- setIsPrinting(true);
164
+ setIsCurrentlyPrinting(true);
165
165
  };
166
166
  const handleWarningDialogCancel = function () {
167
167
  try {
168
168
  const _temp7 = function () {
169
- if (tableMeta.printing.loadAll && excludeUnmatchedResults) {
169
+ if (tableMeta.server.loadAll && excludeUnmatchedResults) {
170
170
  return Promise.resolve(restoreTableDataWithoutSearch()).then(function () {});
171
171
  }
172
172
  }();
@@ -181,22 +181,22 @@ function PrintButton(props) {
181
181
  setShowWarningDialog(false);
182
182
  };
183
183
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(IconButton, {
184
- disabled: isPrinting,
184
+ disabled: isCurrentlyPrinting,
185
185
  icon: "print",
186
186
  onClick: handlePrint,
187
187
  "aria-label": texts.table3.print.tooltip,
188
188
  tooltip: texts.table3.print.tooltip,
189
189
  ref: buttonRef
190
- }), isPrinting && iframeTableProps.data !== null && /*#__PURE__*/React__default.createElement(PrintIFrame, {
190
+ }), isCurrentlyPrinting && iframeTableProps.data !== null && ( /*#__PURE__*/React__default.createElement(PrintIFrame, {
191
191
  onAfterPrint: handleAfterPrint,
192
192
  onBeforePrint: handleBeforePrint,
193
193
  tableProps: iframeTableProps
194
- }), /*#__PURE__*/React__default.createElement(WarningDialog, {
194
+ })), /*#__PURE__*/React__default.createElement(WarningDialog, {
195
195
  open: showWarningDialog,
196
196
  onAccept: handleWarningDialogAccept,
197
197
  onClose: handleWarningDialogClose,
198
198
  onCancel: handleWarningDialogCancel,
199
- onVisibilityChange: tableMeta.printing.setPrintWarningDialogVisibility
199
+ onVisibilityChange: tableMeta.printing.setIsWarningVisibleForLargeDatasets
200
200
  }));
201
201
  }
202
202
 
@@ -1 +1 @@
1
- {"version":3,"file":"PrintButton.js","sources":["../../../../../../../../../../src/components/Table3/components/toolbar/PrintButton/PrintButton.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\n\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { ToastReference, useToast } from '../../../../Toast/Toaster';\nimport { PrintIFrame } from './PrintIFrame';\nimport { Table3ColumnProps, Table3Props } from '../../../types';\nimport { useGlobalKeyDown } from '../../../../../hooks/useGlobalKeyDown';\nimport { WarningDialog } from './WarningDialog';\n\nconst SAFE_PRINT_CELL_COUNT = 10000;\n\nexport type PrintButtonProps<TType = unknown> = React.HTMLAttributes<HTMLButtonElement> & {\n table: RTable<TType>;\n tableProps: Table3Props<TType>;\n};\n\nexport function PrintButton<TType = unknown>(props: PrintButtonProps<TType>) {\n const { table, tableProps } = props;\n const { texts } = useLocalization();\n const toast = useToast();\n\n const [isPrinting, setIsPrinting] = React.useState(false);\n const [showWarningDialog, setShowWarningDialog] = React.useState(false);\n const loadingToastRef = React.useRef<ToastReference | null>(null);\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n const state = table.getState();\n const { printWarningDialogVisibility } = tableMeta.printing;\n\n // When changing printTableId, update packages/taco/src/components/Table3/Table3.tsx file and other usages where\n // printTableId is used to figure out whether the table is a print table or not.\n const printTableId = `${tableProps.id}_print`;\n const excludeUnmatchedResults = tableMeta.search.excludeUnmatchedResults;\n\n const defaultSettings = React.useMemo(\n () => ({\n columnFreezingIndex: tableMeta.columnFreezing.frozenColumnIndex,\n columnOrder: state.columnOrder,\n columnSizing: state.columnSizing,\n columnVisibility: state.columnVisibility,\n excludeUnmatchedRecordsInSearch: excludeUnmatchedResults,\n fontSize: tableMeta.fontSize.size,\n rowHeight: tableMeta.rowHeight.height,\n sorting: state.sorting,\n // we don't save these, but we must pass them to print\n columnFilters: state.columnFilters,\n globalFilter: state.globalFilter,\n }),\n [\n tableMeta.columnFreezing.frozenColumnIndex,\n state.columnOrder,\n state.columnSizing,\n state.columnVisibility,\n excludeUnmatchedResults,\n tableMeta.fontSize.size,\n tableMeta.rowHeight.height,\n state.sorting,\n state.columnFilters,\n state.globalFilter,\n ]\n );\n\n const iframeTableChildren = React.useMemo(\n () =>\n (React.Children.toArray(tableProps.children) as React.ReactElement<Table3ColumnProps<TType>>[]).filter(child => {\n const enableColumnInPrinting = child.props?.enablePrinting;\n\n // For table children, only include columns doesn't have 'false' value for enablePrinting prop.\n if (React.isValidElement<Table3ColumnProps<TType>>(child) && enableColumnInPrinting === false) {\n return false;\n }\n\n return true;\n }),\n [tableProps.children]\n );\n\n const iframeTableProps = {\n ...tableProps,\n children: iframeTableChildren,\n defaultSettings,\n id: printTableId,\n };\n\n useGlobalKeyDown({ key: 'p', meta: true, shift: false }, (event: KeyboardEvent) => {\n event.preventDefault();\n // Starts custom printing\n buttonRef.current?.click();\n });\n\n const handleLoadingError = (error: any) => {\n const errorMessage = `${texts.table3.print.error}: ${error}`;\n\n console.error(errorMessage);\n loadingToastRef.current?.error(errorMessage);\n };\n\n const restoreTableDataWithoutSearch = async () => {\n try {\n await tableMeta.printing.loadAll?.(table.getState().sorting, table.getState().columnFilters, undefined);\n } catch (error) {\n handleLoadingError(error);\n return;\n }\n };\n\n const handleAfterPrint = async () => {\n if (tableMeta.printing.loadAll && excludeUnmatchedResults) {\n await restoreTableDataWithoutSearch();\n }\n setIsPrinting(false);\n loadingToastRef.current?.close();\n };\n\n const handleBeforePrint = () => {\n loadingToastRef.current?.close();\n };\n\n const handlePrint = async () => {\n loadingToastRef.current = toast.loading(texts.table3.print.loading as any);\n\n const getCellCount = (data: TType[]) => (data.length ? data.length * Object.keys(data[0]).length : 0);\n let hasNonSafeCellCount = false;\n\n // if loadAll is not defined, just print with what we've got\n // don't compare length to data.length because the api might be choosing not to return all for performance\n if (!tableMeta.printing.loadAll) {\n const { data } = tableProps;\n const cellCount = getCellCount(data);\n\n hasNonSafeCellCount = cellCount > SAFE_PRINT_CELL_COUNT;\n } else {\n try {\n await tableMeta.printing.loadAll(\n table.getState().sorting,\n table.getState().columnFilters,\n // We need to pass search query to the server when printing, to be able to render correct data set in iFrame,\n // But in \"display\" table, search is performed only on client side, so we'll need to request data again without search query,\n // when printing will be finished.\n excludeUnmatchedResults ? tableMeta.search.query : undefined\n );\n\n // After the loadAll call above, the data changes. Hence, it becomes essential to acquire the data after\n // this call rather than before it.\n const { data } = tableProps;\n const cellCount = getCellCount(data);\n\n hasNonSafeCellCount = cellCount > SAFE_PRINT_CELL_COUNT;\n } catch (error) {\n handleLoadingError(error);\n\n // in case of error, we return early\n return;\n }\n }\n\n if (hasNonSafeCellCount && printWarningDialogVisibility) {\n setShowWarningDialog(true);\n } else {\n // only set printing (mount the iframe) when the data has loaded, it prevents repaint performance slow downs\n setIsPrinting(true);\n }\n };\n\n const handleWarningDialogAccept = () => {\n setIsPrinting(true);\n };\n\n const handleWarningDialogCancel = async () => {\n if (tableMeta.printing.loadAll && excludeUnmatchedResults) {\n await restoreTableDataWithoutSearch();\n }\n };\n\n const handleWarningDialogClose = () => {\n loadingToastRef.current?.close();\n setShowWarningDialog(false);\n };\n\n return (\n <>\n <IconButton\n disabled={isPrinting}\n icon=\"print\"\n onClick={handlePrint}\n aria-label={texts.table3.print.tooltip}\n tooltip={texts.table3.print.tooltip}\n ref={buttonRef}\n />\n {isPrinting && iframeTableProps.data !== null && (\n <PrintIFrame\n onAfterPrint={handleAfterPrint}\n onBeforePrint={handleBeforePrint}\n tableProps={iframeTableProps as Table3Props<TType>}\n />\n )}\n <WarningDialog\n open={showWarningDialog}\n onAccept={handleWarningDialogAccept}\n onClose={handleWarningDialogClose}\n onCancel={handleWarningDialogCancel}\n onVisibilityChange={tableMeta.printing.setPrintWarningDialogVisibility}\n />\n </>\n );\n}\n"],"names":["SAFE_PRINT_CELL_COUNT","PrintButton","props","table","tableProps","texts","useLocalization","toast","useToast","isPrinting","setIsPrinting","React","useState","showWarningDialog","setShowWarningDialog","loadingToastRef","useRef","buttonRef","tableMeta","options","meta","state","getState","printWarningDialogVisibility","printing","printTableId","id","excludeUnmatchedResults","search","defaultSettings","useMemo","columnFreezingIndex","columnFreezing","frozenColumnIndex","columnOrder","columnSizing","columnVisibility","excludeUnmatchedRecordsInSearch","fontSize","size","rowHeight","height","sorting","columnFilters","globalFilter","iframeTableChildren","Children","toArray","children","filter","child","enableColumnInPrinting","_child$props","enablePrinting","isValidElement","iframeTableProps","useGlobalKeyDown","key","shift","event","preventDefault","_buttonRef$current","current","click","handleLoadingError","error","errorMessage","table3","print","console","_loadingToastRef$curr","restoreTableDataWithoutSearch","_tableMeta$printing$l","_tableMeta$printing","Promise","resolve","loadAll","call","undefined","then","_temp","e","reject","handleAfterPrint","_loadingToastRef$curr2","close","_temp2","_temp3","handleBeforePrint","_loadingToastRef$curr3","handlePrint","hasNonSafeCellCount","loading","getCellCount","data","length","Object","keys","_temp5","cellCount","_temp4","_catch","query","_exit","_temp6","handleWarningDialogAccept","handleWarningDialogCancel","_temp7","handleWarningDialogClose","_loadingToastRef$curr4","IconButton","disabled","icon","onClick","tooltip","ref","PrintIFrame","onAfterPrint","onBeforePrint","WarningDialog","open","onAccept","onClose","onCancel","onVisibilityChange","setPrintWarningDialogVisibility"],"mappings":";;;;;;;;;AAWA,MAAMA,qBAAqB,GAAG,KAAK;SAOnBC,WAAWA,CAAkBC,KAA8B;EACvE,MAAM;IAAEC,KAAK;IAAEC;GAAY,GAAGF,KAAK;EACnC,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,KAAK,GAAGC,QAAQ,EAAE;EAExB,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EACzD,MAAM,CAACC,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGH,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EACvE,MAAMG,eAAe,GAAGJ,cAAK,CAACK,MAAM,CAAwB,IAAI,CAAC;EACjE,MAAMC,SAAS,GAAGN,cAAK,CAACK,MAAM,CAAoB,IAAI,CAAC;EAEvD,MAAME,SAAS,GAAGf,KAAK,CAACgB,OAAO,CAACC,IAAwB;EACxD,MAAMC,KAAK,GAAGlB,KAAK,CAACmB,QAAQ,EAAE;EAC9B,MAAM;IAAEC;GA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gG,yBAAyB;IAAA;;YACvBxF,SAAS,CAACM,QAAQ,CAACoD,OAAO,IAAIjD,uBAAuB;UAAA,OAAA+C,OAAA,CAAAC,OAAA,CAC/CJ,6BAA6B,EAAE,EAAAQ,IAAA;;;MAAA,OAAAL,OAAA,CAAAC,OAAA,CAAAgC,MAAA,IAAAA,MAAA,CAAA5B,IAAA,GAAA4B,MAAA,CAAA5B,IAAA;KAE5C,QAAAE,CAAA;MAAA,OAAAP,OAAA,CAAAQ,MAAA,CAAAD,CAAA;;;EAED,MAAM2B,wBAAwB,GAAGA;;IAC7B,CAAAC,sBAAA,GAAA9F,eAAe,CAAC+C,OAAO,cAAA+C,sBAAA,uBAAvBA,sBAAA,CAAyBxB,KAAK,EAAE;IAChCvE,oBAAoB,CAAC,KAAK,CAAC;GAC9B;EAED,oBACIH,yEACIA,6BAACmG,UAAU;IACPC,QAAQ,EAAEtG,UAAU;IACpBuG,IAAI,EAAC,OAAO;IACZC,OAAO,EAAEvB,WAAW;kBACRrF,KAAK,CAAC8D,MAAM,CAACC,KAAK,CAAC8C,OAAO;IACtCA,OAAO,EAAE7G,KAAK,CAAC8D,MAAM,CAACC,KAAK,CAAC8C,OAAO;IACnCC,GAAG,EAAElG;IACP,EACDR,UAAU,IAAI8C,gBAAgB,CAACuC,IAAI,KAAK,IAAI,iBACzCnF,6BAACyG,WAAW;IACRC,YAAY,EAAElC,gBAAgB;IAC9BmC,aAAa,EAAE9B,iBAAiB;IAChCpF,UAAU,EAAEmD;IAEnB,eACD5C,6BAAC4G,aAAa;IACVC,IAAI,EAAE3G,iBAAiB;IACvB4G,QAAQ,EAAEhB,yBAAyB;IACnCiB,OAAO,EAAEd,wBAAwB;IACjCe,QAAQ,EAAEjB,yBAAyB;IACnCkB,kBAAkB,EAAE1G,SAAS,CAACM,QAAQ,CAACqG;IACzC,CACH;AAEX;;;;"}
1
+ {"version":3,"file":"PrintButton.js","sources":["../../../../../../../../../../src/components/Table3/components/toolbar/PrintButton/PrintButton.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\n\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { ToastReference, useToast } from '../../../../Toast/Toaster';\nimport { PrintIFrame } from './PrintIFrame';\nimport { Table3ColumnProps, Table3Props } from '../../../types';\nimport { useGlobalKeyDown } from '../../../../../hooks/useGlobalKeyDown';\nimport { WarningDialog } from './WarningDialog';\n\nconst SAFE_PRINT_CELL_COUNT = 10000;\n\nexport type PrintButtonProps<TType = unknown> = React.HTMLAttributes<HTMLButtonElement> & {\n table: RTable<TType>;\n tableProps: Table3Props<TType>;\n};\n\nexport function PrintButton<TType = unknown>(props: PrintButtonProps<TType>) {\n const { table, tableProps } = props;\n const { texts } = useLocalization();\n const toast = useToast();\n\n const [isCurrentlyPrinting, setIsCurrentlyPrinting] = React.useState(false);\n const [showWarningDialog, setShowWarningDialog] = React.useState(false);\n const loadingToastRef = React.useRef<ToastReference | null>(null);\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n const state = table.getState();\n const { isWarningVisibleForLargeDatasets } = tableMeta.printing;\n\n // When changing printTableId, update packages/taco/src/components/Table3/Table3.tsx file and other usages where\n // printTableId is used to figure out whether the table is a print table or not.\n const printTableId = `${tableProps.id}_print`;\n const excludeUnmatchedResults = tableMeta.search.excludeUnmatchedResults;\n\n const defaultSettings = React.useMemo(\n () => ({\n columnFreezingIndex: tableMeta.columnFreezing.frozenColumnIndex,\n columnOrder: state.columnOrder,\n columnSizing: state.columnSizing,\n columnVisibility: state.columnVisibility,\n excludeUnmatchedRecordsInSearch: excludeUnmatchedResults,\n fontSize: tableMeta.fontSize.size,\n rowHeight: tableMeta.rowHeight.height,\n sorting: state.sorting,\n // we don't save these, but we must pass them to print\n columnFilters: state.columnFilters,\n globalFilter: state.globalFilter,\n }),\n [\n tableMeta.columnFreezing.frozenColumnIndex,\n state.columnOrder,\n state.columnSizing,\n state.columnVisibility,\n excludeUnmatchedResults,\n tableMeta.fontSize.size,\n tableMeta.rowHeight.height,\n state.sorting,\n state.columnFilters,\n state.globalFilter,\n ]\n );\n\n const iframeTableChildren = React.useMemo(\n () =>\n (React.Children.toArray(tableProps.children) as React.ReactElement<Table3ColumnProps<TType>>[]).filter(child => {\n const enableColumnInPrinting = child.props?.enablePrinting;\n\n // For table children, only include columns doesn't have 'false' value for enablePrinting prop.\n if (React.isValidElement<Table3ColumnProps<TType>>(child) && enableColumnInPrinting === false) {\n return false;\n }\n\n return true;\n }),\n [tableProps.children]\n );\n\n const iframeTableProps = {\n ...tableProps,\n children: iframeTableChildren,\n defaultSettings,\n id: printTableId,\n };\n\n useGlobalKeyDown({ key: 'p', meta: true, shift: false }, (event: KeyboardEvent) => {\n event.preventDefault();\n // Starts custom printing\n buttonRef.current?.click();\n });\n\n const handleLoadingError = (error: any) => {\n const errorMessage = `${texts.table3.print.error}: ${error}`;\n\n console.error(errorMessage);\n loadingToastRef.current?.error(errorMessage);\n };\n\n const restoreTableDataWithoutSearch = async () => {\n try {\n await tableMeta.server.loadAll?.(table.getState().sorting, table.getState().columnFilters, undefined);\n } catch (error) {\n handleLoadingError(error);\n return;\n }\n };\n\n const handleAfterPrint = async () => {\n if (tableMeta.server.loadAll && excludeUnmatchedResults) {\n await restoreTableDataWithoutSearch();\n }\n setIsCurrentlyPrinting(false);\n loadingToastRef.current?.close();\n };\n\n const handleBeforePrint = () => {\n loadingToastRef.current?.close();\n };\n\n const handlePrint = async () => {\n loadingToastRef.current = toast.loading(texts.table3.print.loading as any);\n\n const getCellCount = (data: TType[]) => (data.length ? data.length * Object.keys(data[0]).length : 0);\n let hasNonSafeCellCount = false;\n\n // if loadAll is not defined, just print with what we've got\n // don't compare length to data.length because the api might be choosing not to return all for performance\n if (!tableMeta.server.loadAll) {\n const { data } = tableProps;\n const cellCount = getCellCount(data);\n\n hasNonSafeCellCount = cellCount > SAFE_PRINT_CELL_COUNT;\n } else {\n try {\n await tableMeta.server.loadAll(\n table.getState().sorting,\n table.getState().columnFilters,\n // We need to pass search query to the server when printing, to be able to render correct data set in iFrame,\n // But in \"display\" table, search is performed only on client side, so we'll need to request data again without search query,\n // when printing will be finished.\n excludeUnmatchedResults ? tableMeta.search.query : undefined\n );\n\n // After the loadAll call above, the data changes. Hence, it becomes essential to acquire the data after\n // this call rather than before it.\n const { data } = tableProps;\n const cellCount = getCellCount(data);\n\n hasNonSafeCellCount = cellCount > SAFE_PRINT_CELL_COUNT;\n } catch (error) {\n handleLoadingError(error);\n\n // in case of error, we return early\n return;\n }\n }\n\n if (hasNonSafeCellCount && isWarningVisibleForLargeDatasets) {\n setShowWarningDialog(true);\n } else {\n // only set printing (mount the iframe) when the data has loaded, it prevents repaint performance slow downs\n setIsCurrentlyPrinting(true);\n }\n };\n\n const handleWarningDialogAccept = () => {\n setIsCurrentlyPrinting(true);\n };\n\n const handleWarningDialogCancel = async () => {\n if (tableMeta.server.loadAll && excludeUnmatchedResults) {\n await restoreTableDataWithoutSearch();\n }\n };\n\n const handleWarningDialogClose = () => {\n loadingToastRef.current?.close();\n setShowWarningDialog(false);\n };\n\n return (\n <>\n <IconButton\n disabled={isCurrentlyPrinting}\n icon=\"print\"\n onClick={handlePrint}\n aria-label={texts.table3.print.tooltip}\n tooltip={texts.table3.print.tooltip}\n ref={buttonRef}\n />\n {isCurrentlyPrinting && iframeTableProps.data !== null && (\n <PrintIFrame\n onAfterPrint={handleAfterPrint}\n onBeforePrint={handleBeforePrint}\n tableProps={iframeTableProps as Table3Props<TType>}\n />\n )}\n <WarningDialog\n open={showWarningDialog}\n onAccept={handleWarningDialogAccept}\n onClose={handleWarningDialogClose}\n onCancel={handleWarningDialogCancel}\n onVisibilityChange={tableMeta.printing.setIsWarningVisibleForLargeDatasets}\n />\n </>\n );\n}\n"],"names":["SAFE_PRINT_CELL_COUNT","PrintButton","props","table","tableProps","texts","useLocalization","toast","useToast","isCurrentlyPrinting","setIsCurrentlyPrinting","React","useState","showWarningDialog","setShowWarningDialog","loadingToastRef","useRef","buttonRef","tableMeta","options","meta","state","getState","isWarningVisibleForLargeDatasets","printing","printTableId","id","excludeUnmatchedResults","search","defaultSettings","useMemo","columnFreezingIndex","columnFreezing","frozenColumnIndex","columnOrder","columnSizing","columnVisibility","excludeUnmatchedRecordsInSearch","fontSize","size","rowHeight","height","sorting","columnFilters","globalFilter","iframeTableChildren","Children","toArray","children","filter","child","enableColumnInPrinting","_child$props","enablePrinting","isValidElement","iframeTableProps","useGlobalKeyDown","key","shift","event","preventDefault","_buttonRef$current","current","click","handleLoadingError","error","errorMessage","table3","print","console","_loadingToastRef$curr","restoreTableDataWithoutSearch","_tableMeta$server$loa","_tableMeta$server","Promise","resolve","server","loadAll","call","undefined","then","_temp","e","reject","handleAfterPrint","_loadingToastRef$curr2","close","_temp2","_temp3","handleBeforePrint","_loadingToastRef$curr3","handlePrint","hasNonSafeCellCount","loading","getCellCount","data","length","Object","keys","_temp5","cellCount","_temp4","_catch","query","_exit","_temp6","handleWarningDialogAccept","handleWarningDialogCancel","_temp7","handleWarningDialogClose","_loadingToastRef$curr4","IconButton","disabled","icon","onClick","tooltip","ref","PrintIFrame","onAfterPrint","onBeforePrint","WarningDialog","open","onAccept","onClose","onCancel","onVisibilityChange","setIsWarningVisibleForLargeDatasets"],"mappings":";;;;;;;;;AAWA,MAAMA,qBAAqB,GAAG,KAAK;SAOnBC,WAAWA,CAAkBC,KAA8B;EACvE,MAAM;IAAEC,KAAK;IAAEC;GAAY,GAAGF,KAAK;EACnC,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,KAAK,GAAGC,QAAQ,EAAE;EAExB,MAAM,CAACC,mBAAmB,EAAEC,sBAAsB,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EAC3E,MAAM,CAACC,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGH,cAAK,CAACC,QAAQ,CAAC,KAAK,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Aa;IACVC,IAAI,EAAE5G,iBAAiB;IACvB6G,QAAQ,EAAEhB,yBAAyB;IACnCiB,OAAO,EAAEd,wBAAwB;IACjCe,QAAQ,EAAEjB,yBAAyB;IACnCkB,kBAAkB,EAAE3G,SAAS,CAACM,QAAQ,CAACsG;IACzC,CACH;AAEX;;;;"}
@@ -68,6 +68,7 @@ import '../../../../Textarea/Textarea.js';
68
68
  import '../../../../../hooks/useMatchMedia.js';
69
69
  import '../../../../../hooks/useIsLargeScreen.js';
70
70
  import { useParentStylesheets } from './hooks/useParentStylesheets.js';
71
+ import '../../../../../types.js';
71
72
  import '../../../hooks/useTableDataLoader.js';
72
73
  import { Table3 } from '../../../Table3.js';
73
74
  import '../../../../Tabs/Tabs.js';
@@ -1 +1 @@
1
- {"version":3,"file":"PrintIFrame.js","sources":["../../../../../../../../../../src/components/Table3/components/toolbar/PrintButton/PrintIFrame.tsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { Table3 } from '../../../../..';\nimport { Table3Props } from '../../../types';\nimport { useParentStylesheets } from './hooks/useParentStylesheets';\n\nexport type PrintIFrameProps<TType = unknown> = {\n onAfterPrint?: () => void;\n onBeforePrint?: () => void;\n tableProps: Table3Props<TType>;\n};\n\nexport function PrintIFrame<TType = unknown>({ onAfterPrint, onBeforePrint, tableProps }: PrintIFrameProps<TType>) {\n const [contentRef, setContentRef] = React.useState<HTMLIFrameElement | null>(null);\n const [mountNode, setMountNode] = React.useState<HTMLElement | null>(null);\n\n const isFirefoxBrowser = React.useMemo(() => navigator.userAgent.toLowerCase().includes('firefox'), []);\n const isSafariBrowser = React.useMemo(\n () => navigator.userAgent.toLowerCase().includes('safari') && !navigator.userAgent.toLowerCase().includes('chrome'),\n []\n );\n\n const iframeWindow = contentRef?.contentWindow;\n\n const stylesReady = useParentStylesheets(iframeWindow);\n\n // Calls print method when table has loaded in the iframe.\n React.useEffect(() => {\n let intervalId: NodeJS.Timer;\n let timeoutId: NodeJS.Timer;\n\n // Invoke the print functionality on the window once the table has finished rendering and all print styles are\n // added.\n if (mountNode && stylesReady) {\n intervalId = setInterval(async () => {\n const tableWrapper = mountNode;\n const table = tableWrapper.querySelector('[role=\"table\"]') as HTMLElement;\n const hasTableRendered = !!table;\n\n if (hasTableRendered && intervalId) {\n clearInterval(intervalId);\n\n // Calling the onBeforePrint method here as a fallback because certain browsers, like Safari,\n // do not call the beforeprint event.\n // Bug - Even though onBeforePrint is called before printing, the execution doesn't finish before\n // the print dialog shows up, which results into having a visible loading toast.\n onBeforePrint?.();\n\n // By adding height to the tableWrapper, we make sure the content below absolutely positioned table\n // doesn't hide\n if (isFirefoxBrowser) {\n const tableHeight = `${table.offsetHeight}px`;\n tableWrapper.style.height = tableHeight;\n }\n\n contentRef?.contentWindow?.print();\n\n // Calling the onAfterPrint method here as a fallback to do the cleanup, as certain browsers,\n // like Safari, do not trigger the beforeprint or afterprint events when a confirmation dialog\n // asking if the user wants to print the document, is cancelled.\n\n // Added a setTimeout to prevent calling onAfterPrint immediately after the print function\n // to ensure that the print dialog doesn't close abruptly. Although this behavior is uncommon,\n // there are cases where the print function may not run synchronously, causing onAfterPrint to be\n // invoked right after it.\n timeoutId = setTimeout(() => {\n onAfterPrint?.();\n }, 0);\n }\n }, 1000);\n }\n\n return () => {\n clearInterval(intervalId);\n clearTimeout(timeoutId);\n };\n }, [mountNode, stylesReady]);\n\n React.useEffect(() => {\n if (!contentRef || !iframeWindow || !stylesReady) {\n return;\n }\n\n // get the closest parent/container of the table, and the table itself\n const parentElement = contentRef?.closest('[role=dialog], [data-taco=drawer], main') ?? iframeWindow.parent.document.body;\n\n const iframeDocument = iframeWindow.document;\n iframeDocument.body.innerHTML = parentElement?.innerHTML ?? '';\n\n const tableElement = iframeDocument.querySelector('[role=\"table\"]');\n const tableColumnFreezingStyles = iframeDocument.querySelector('[data-taco=\"table3-column-freezing-styles\"]');\n const tableWrapper = iframeDocument.createElement('div');\n\n tableWrapper.setAttribute('data-role', 'table-wrapper');\n // Adding h-fit class makes sure that table is rendered with the whole content.\n tableWrapper.classList.add('h-fit');\n tableWrapper.classList.add('[&>[role=\"table\"]]:!h-fit');\n\n if (isFirefoxBrowser) {\n // Fix for firefox bug which adds page-long whitespace between page's top content and table.\n tableWrapper.classList.add('[&>[role=\"table\"]]:!absolute');\n }\n\n // Makes sure table takes the full screen width.\n if (isSafariBrowser) {\n // Safari browser doesn't apply correct width to the columns when w-screen is used.\n tableWrapper.classList.add('w-full');\n } else {\n tableWrapper.classList.add('w-screen');\n }\n\n if (tableElement) {\n tableElement.parentNode?.insertBefore(tableWrapper, tableElement);\n tableElement.remove();\n } else {\n iframeDocument.body.append(tableWrapper);\n }\n\n // Remove the already existing column freezing styles.\n if (tableColumnFreezingStyles) {\n tableColumnFreezingStyles.remove();\n }\n\n let currentNode = tableWrapper.parentNode as HTMLElement | null;\n\n while (currentNode !== null && currentNode !== iframeDocument.body) {\n // Add the 'h-fit' class to the 'table-wrapper' element's parent chain.\n // This ensures that the table is not cropped and fits within its container.\n currentNode?.classList.add('!h-fit');\n currentNode = currentNode.parentNode as HTMLElement | null;\n }\n\n setMountNode(tableWrapper);\n }, [iframeWindow, stylesReady]);\n\n const printTableProps: Table3Props<TType> = {\n ...tableProps,\n actionsForRow: undefined,\n // Not the best way to remove the active/current row styles, but a temporary solution for now\n defaultCurrentRowIndex: -1,\n defaultSettings: {\n ...tableProps?.defaultSettings,\n rowHeight: 'short',\n },\n enableColumnFreezing: false,\n enableRowHeight: true,\n enableRowSelection: false,\n enableEditing: false,\n enablePrinting: false,\n enableRowDrag: false,\n enableRowDrop: false,\n enableRowSelectionSingle: false,\n preset: undefined,\n // The presence of the onChangeSettings prop ensures that settings won't be stored in local storage.\n onChangeSettings: () => undefined,\n };\n\n // -top-60 -left-60 styles make sure that iframe is added outside of the viewport\n return (\n <iframe\n className=\"fixed -left-[6000px] -top-[6000px] -z-50 !h-0 !w-0\"\n ref={setContentRef}\n // Temporary fix to support printing in firefox: Find another solution while upgrading React\n src=\"javascript:void(0);\">\n {mountNode && stylesReady ? ReactDOM.createPortal(<Table3 {...printTableProps} />, mountNode) : null}\n </iframe>\n );\n}\n"],"names":["PrintIFrame","onAfterPrint","onBeforePrint","tableProps","contentRef","setContentRef","React","useState","mountNode","setMountNode","isFirefoxBrowser","useMemo","navigator","userAgent","toLowerCase","includes","isSafariBrowser","iframeWindow","contentWindow","stylesReady","useParentStylesheets","useEffect","intervalId","timeoutId","setInterval","tableWrapper","table","querySelector","hasTableRendered","_contentRef$contentWi","clearInterval","tableHeight","offsetHeight","style","height","print","setTimeout","Promise","resolve","e","reject","clearTimeout","parentElement","_contentRef$closest","closest","parent","document","body","iframeDocument","innerHTML","_parentElement$innerH","tableElement","tableColumnFreezingStyles","createElement","setAttribute","classList","add","_tableElement$parentN","parentNode","insertBefore","remove","append","currentNode","_currentNode","printTableProps","actionsForRow","undefined","defaultCurrentRowIndex","defaultSettings","rowHeight","enableColumnFreezing","enableRowHeight","enableRowSelection","enableEditing","enablePrinting","enableRowDrag","enableRowDrop","enableRowSelectionSingle","preset","onChangeSettings","className","ref","src","ReactDOM","createPortal","Table3"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAagBA,WAAWA,CAAkB;EAAEC,YAAY;EAAEC,aAAa;EAAEC;CAAqC;EAC7G,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAA2B,IAAI,CAAC;EAClF,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGH,cAAK,CAACC,QAAQ,CAAqB,IAAI,CAAC;EAE1E,MAAMG,gBAAgB,GAAGJ,cAAK,CAACK,OAAO,CAAC,MAAMC,SAAS,CAACC,SAAS,CAACC,WAAW,EAAE,CAACC,QAAQ,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;EACvG,MAAMC,eAAe,GAAGV,cAAK,CA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M,EAAEZ,SAAS;;IAEjBa,gBAAgB,EAAEA,MAAMb;GAC3B;;EAGD,oBACI5D;IACI0E,SAAS,EAAC,oDAAoD;IAC9DC,GAAG,EAAE5E,aAAa;;IAElB6E,GAAG,EAAC;KACH1E,SAAS,IAAIW,WAAW,gBAAGgE,QAAQ,CAACC,YAAY,eAAC9E,6BAAC+E,MAAM,oBAAKrB,eAAe,EAAI,EAAExD,SAAS,CAAC,GAAG,IAAI,CAC/F;AAEjB;;;;"}
1
+ {"version":3,"file":"PrintIFrame.js","sources":["../../../../../../../../../../src/components/Table3/components/toolbar/PrintButton/PrintIFrame.tsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { Table3 } from '../../../../..';\nimport { Table3Props } from '../../../types';\nimport { useParentStylesheets } from './hooks/useParentStylesheets';\n\nexport type PrintIFrameProps<TType = unknown> = {\n onAfterPrint?: () => void;\n onBeforePrint?: () => void;\n tableProps: Table3Props<TType>;\n};\n\nexport function PrintIFrame<TType = unknown>({ onAfterPrint, onBeforePrint, tableProps }: PrintIFrameProps<TType>) {\n const [contentRef, setContentRef] = React.useState<HTMLIFrameElement | null>(null);\n const [mountNode, setMountNode] = React.useState<HTMLElement | null>(null);\n\n const isFirefoxBrowser = React.useMemo(() => navigator.userAgent.toLowerCase().includes('firefox'), []);\n const isSafariBrowser = React.useMemo(\n () => navigator.userAgent.toLowerCase().includes('safari') && !navigator.userAgent.toLowerCase().includes('chrome'),\n []\n );\n\n const iframeWindow = contentRef?.contentWindow;\n\n const stylesReady = useParentStylesheets(iframeWindow);\n\n // Calls print method when table has loaded in the iframe.\n React.useEffect(() => {\n let intervalId: NodeJS.Timer;\n let timeoutId: NodeJS.Timer;\n\n // Invoke the print functionality on the window once the table has finished rendering and all print styles are\n // added.\n if (mountNode && stylesReady) {\n intervalId = setInterval(async () => {\n const tableWrapper = mountNode;\n const table = tableWrapper.querySelector('[role=\"table\"]') as HTMLElement;\n const hasTableRendered = !!table;\n\n if (hasTableRendered && intervalId) {\n clearInterval(intervalId);\n\n // Calling the onBeforePrint method here as a fallback because certain browsers, like Safari,\n // do not call the beforeprint event.\n // Bug - Even though onBeforePrint is called before printing, the execution doesn't finish before\n // the print dialog shows up, which results into having a visible loading toast.\n onBeforePrint?.();\n\n // By adding height to the tableWrapper, we make sure the content below absolutely positioned table\n // doesn't hide\n if (isFirefoxBrowser) {\n const tableHeight = `${table.offsetHeight}px`;\n tableWrapper.style.height = tableHeight;\n }\n\n contentRef?.contentWindow?.print();\n\n // Calling the onAfterPrint method here as a fallback to do the cleanup, as certain browsers,\n // like Safari, do not trigger the beforeprint or afterprint events when a confirmation dialog\n // asking if the user wants to print the document, is cancelled.\n\n // Added a setTimeout to prevent calling onAfterPrint immediately after the print function\n // to ensure that the print dialog doesn't close abruptly. Although this behavior is uncommon,\n // there are cases where the print function may not run synchronously, causing onAfterPrint to be\n // invoked right after it.\n timeoutId = setTimeout(() => {\n onAfterPrint?.();\n }, 0);\n }\n }, 1000);\n }\n\n return () => {\n clearInterval(intervalId);\n clearTimeout(timeoutId);\n };\n }, [mountNode, stylesReady]);\n\n React.useEffect(() => {\n if (!contentRef || !iframeWindow || !stylesReady) {\n return;\n }\n\n // get the closest parent/container of the table, and the table itself\n const parentElement = contentRef?.closest('[role=dialog], [data-taco=drawer], main') ?? iframeWindow.parent.document.body;\n\n const iframeDocument = iframeWindow.document;\n iframeDocument.body.innerHTML = parentElement?.innerHTML ?? '';\n\n const tableElement = iframeDocument.querySelector('[role=\"table\"]');\n const tableColumnFreezingStyles = iframeDocument.querySelector('[data-taco=\"table3-column-freezing-styles\"]');\n const tableWrapper = iframeDocument.createElement('div');\n\n tableWrapper.setAttribute('data-role', 'table-wrapper');\n // Adding h-fit class makes sure that table is rendered with the whole content.\n tableWrapper.classList.add('h-fit');\n tableWrapper.classList.add('[&>[role=\"table\"]]:!h-fit');\n\n if (isFirefoxBrowser) {\n // Fix for firefox bug which adds page-long whitespace between page's top content and table.\n tableWrapper.classList.add('[&>[role=\"table\"]]:!absolute');\n }\n\n // Makes sure table takes the full screen width.\n if (isSafariBrowser) {\n // Safari browser doesn't apply correct width to the columns when w-screen is used.\n tableWrapper.classList.add('w-full');\n } else {\n tableWrapper.classList.add('w-screen');\n }\n\n if (tableElement) {\n tableElement.parentNode?.insertBefore(tableWrapper, tableElement);\n tableElement.remove();\n } else {\n iframeDocument.body.append(tableWrapper);\n }\n\n // Remove the already existing column freezing styles.\n if (tableColumnFreezingStyles) {\n tableColumnFreezingStyles.remove();\n }\n\n let currentNode = tableWrapper.parentNode as HTMLElement | null;\n\n while (currentNode !== null && currentNode !== iframeDocument.body) {\n // Add the 'h-fit' class to the 'table-wrapper' element's parent chain.\n // This ensures that the table is not cropped and fits within its container.\n currentNode?.classList.add('!h-fit');\n currentNode = currentNode.parentNode as HTMLElement | null;\n }\n\n setMountNode(tableWrapper);\n }, [iframeWindow, stylesReady]);\n\n const printTableProps: Table3Props<TType> = {\n ...tableProps,\n actionsForRow: undefined,\n // Not the best way to remove the active/current row styles, but a temporary solution for now\n defaultCurrentRowIndex: -1,\n defaultSettings: {\n ...tableProps?.defaultSettings,\n rowHeight: 'short',\n },\n enableColumnFreezing: false,\n enableRowHeight: true,\n enableRowSelection: false,\n enableEditing: false,\n enablePrinting: false,\n enableRowDrag: false,\n enableRowDrop: false,\n enableRowSelectionSingle: false,\n preset: undefined,\n // The presence of the onChangeSettings prop ensures that settings won't be stored in local storage.\n onChangeSettings: () => undefined,\n };\n\n // -top-60 -left-60 styles make sure that iframe is added outside of the viewport\n return (\n <iframe\n className=\"fixed -left-[6000px] -top-[6000px] -z-50 !h-0 !w-0\"\n ref={setContentRef}\n // Temporary fix to support printing in firefox: Find another solution while upgrading React\n src=\"javascript:void(0);\">\n {mountNode && stylesReady ? ReactDOM.createPortal(<Table3 {...printTableProps} />, mountNode) : null}\n </iframe>\n );\n}\n"],"names":["PrintIFrame","onAfterPrint","onBeforePrint","tableProps","contentRef","setContentRef","React","useState","mountNode","setMountNode","isFirefoxBrowser","useMemo","navigator","userAgent","toLowerCase","includes","isSafariBrowser","iframeWindow","contentWindow","stylesReady","useParentStylesheets","useEffect","intervalId","timeoutId","setInterval","tableWrapper","table","querySelector","hasTableRendered","_contentRef$contentWi","clearInterval","tableHeight","offsetHeight","style","height","print","setTimeout","Promise","resolve","e","reject","clearTimeout","parentElement","_contentRef$closest","closest","parent","document","body","iframeDocument","innerHTML","_parentElement$innerH","tableElement","tableColumnFreezingStyles","createElement","setAttribute","classList","add","_tableElement$parentN","parentNode","insertBefore","remove","append","currentNode","_currentNode","printTableProps","actionsForRow","undefined","defaultCurrentRowIndex","defaultSettings","rowHeight","enableColumnFreezing","enableRowHeight","enableRowSelection","enableEditing","enablePrinting","enableRowDrag","enableRowDrop","enableRowSelectionSingle","preset","onChangeSettings","className","ref","src","ReactDOM","createPortal","Table3"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAagBA,WAAWA,CAAkB;EAAEC,YAAY;EAAEC,aAAa;EAAEC;CAAqC;EAC7G,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAA2B,IAAI,CAAC;EAClF,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGH,cAAK,CAACC,QAAQ,CAAqB,IAAI,CAAC;EAE1E,MAAMG,gBAAgB,GAAGJ,cAAK,CAACK,OAAO,CAAC,MAAMC,SAAS,CAACC,SAAS,CAACC,WAAW,EAAE,CAACC,QAAQ,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;EACvG,MAAMC,eAAe,GAAGV,cAAK,CAACK,OAAO,CACjC,MAAMC,SAAS,CAACC,SAAS,CAACC,WAAW,EAAE,CAACC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAACH,SAAS,CAACC,SAAS,CAACC,WAAW,EAAE,CAACC,QAAQ,CAAC,QAAQ,CA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W,WAAW,gBAAGgE,QAAQ,CAACC,YAAY,eAAC9E,6BAAC+E,MAAM,oBAAKrB,eAAe,EAAI,EAAExD,SAAS,CAAC,GAAG,IAAI,CAC/F;AAEjB;;;;"}
@@ -60,10 +60,10 @@ function Search(props) {
60
60
  tableMeta.search.setIsSearching(true);
61
61
  // load all data if that is possible
62
62
  const _temp = function () {
63
- if (tableMeta.search.loadAll && loading === LoadingState.Incomplete) {
63
+ if (tableMeta.server.loadAll && loading === LoadingState.Incomplete) {
64
64
  setLoading(LoadingState.Loading);
65
65
  // don't pass the search query because we need all data - not filtered data
66
- return Promise.resolve(tableMeta.search.loadAll(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {
66
+ return Promise.resolve(tableMeta.server.loadAll(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {
67
67
  setLoading(LoadingState.Completed);
68
68
  });
69
69
  }
@@ -81,14 +81,16 @@ function Search(props) {
81
81
  setQuery(String(query !== null && query !== void 0 ? query : ''));
82
82
  };
83
83
  const handleClear = () => {
84
- var _rows$rowIndex;
85
- const [rowIndex, cellIndex] = tableMeta.search.highlightedColumnIndexes[tableMeta.search.currentHighlightColumnIndex || 0];
84
+ const [rowIndex = null, cellIndex = null] = tableMeta.search.highlightedColumnIndexes[tableMeta.search.currentHighlightColumnIndex || 0];
86
85
  const rows = table.getRowModel().rows;
87
- const rowId = ((_rows$rowIndex = rows[rowIndex]) === null || _rows$rowIndex === void 0 ? void 0 : _rows$rowIndex.id) || null;
88
86
  tableMeta.search.setQuery('');
89
87
  // Need to save row id and cell index, to be able to find the row in the table with updated indexes, after global filter will be reset.
90
88
  lastCellIndex.value = String(cellIndex);
91
- setRowIdToNavigate(rowId);
89
+ if (rowIndex !== null) {
90
+ var _rows$rowIndex;
91
+ const rowId = ((_rows$rowIndex = rows[rowIndex]) === null || _rows$rowIndex === void 0 ? void 0 : _rows$rowIndex.id) || null;
92
+ setRowIdToNavigate(rowId);
93
+ }
92
94
  };
93
95
  const handleKeyDown = event => {
94
96
  if (event.key === 'Escape') {
@@ -105,7 +107,7 @@ function Search(props) {
105
107
  const rows = table.getRowModel().rows;
106
108
  const rowIndex = rows.findIndex(row => row.id === rowIdToNavigate);
107
109
  tableMeta.search.setIsSearching(false);
108
- tableMeta.currentRow.setCurrentRowIndex(rowIndex);
110
+ tableMeta.rowActive.setRowActiveIndex(rowIndex);
109
111
  scrollTo(rowIndex);
110
112
  setRowIdToNavigate(null);
111
113
  }
@@ -207,7 +209,7 @@ function resetHighlightedColumnIndexes(enabled, value, table) {
207
209
  tableMeta.search.setCurrentHighlightColumnIndex(undefined);
208
210
  }
209
211
  if (firstRowIndex !== undefined) {
210
- tableMeta.currentRow.setCurrentRowIndex(firstRowIndex);
212
+ tableMeta.rowActive.setRowActiveIndex(firstRowIndex);
211
213
  }
212
214
  return firstRowIndex;
213
215
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Search.js","sources":["../../../../../../../../../src/components/Table3/components/toolbar/Search.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Switch } from '../../../Switch/Switch';\nimport { globalFilterFn } from '../../util/filtering';\nimport { SearchInput2 } from '../../../SearchInput2/SearchInput2';\nimport { useDebouncedEffect } from '../../../../hooks/useDebouncedEffect';\nimport { getCellValueAsString } from '../../util/columns';\nimport { lastCellIndex } from '../rows/Row';\n\ntype SearchProps<TType = unknown> = {\n scrollToIndex: any;\n table: RTable<TType>;\n};\n\nenum LoadingState {\n Incomplete,\n Loading,\n Completed,\n}\n\nexport function Search<TType = unknown>(props: SearchProps<TType>) {\n const { scrollToIndex, table } = props;\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLInputElement>(null);\n const tableMeta = table.options.meta as TableMeta<TType>;\n const [query, setQuery] = React.useState(tableMeta.search.query);\n const [loading, setLoading] = React.useState<LoadingState>(LoadingState.Incomplete);\n const [rowIdToNavigate, setRowIdToNavigate] = React.useState<string | null>(null);\n\n const scrollTo = (rowIndex: number) => scrollToIndex(rowIndex, { align: 'center' });\n\n // update the indexes if the row length changes (e.g. when filtering)\n React.useEffect(() => {\n const firstRowIndex = resetHighlightedColumnIndexes(tableMeta.search.isHighlightingEnabled, ref.current?.value, table);\n\n if (firstRowIndex) {\n scrollTo(firstRowIndex);\n }\n }, [\n tableMeta.search.query,\n tableMeta.search.excludeUnmatchedResults,\n table.getRowModel().rows.length,\n JSON.stringify(table.getState().sorting),\n JSON.stringify(table.getState().columnVisibility),\n loading,\n ]);\n\n // Reseting internal search state if search.query is changed from the outside.\n React.useEffect(() => {\n if (tableMeta.search.query !== query) {\n setQuery(tableMeta.search.query);\n }\n }, [tableMeta.search.query]);\n\n // update the table search and filtering on a debounce\n useDebouncedEffect(() => {\n tableMeta.search.setQuery(query);\n\n if (tableMeta.search.excludeUnmatchedResults) {\n if (query?.length) {\n table.setGlobalFilter(query);\n } else {\n table.resetGlobalFilter();\n }\n }\n }, [query]);\n\n const handleFocus = async () => {\n // While Search input is focused, we'll switch into searching mode\n tableMeta.search.setIsSearching(true);\n // load all data if that is possible\n if (tableMeta.search.loadAll && loading === LoadingState.Incomplete) {\n setLoading(LoadingState.Loading);\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.search.loadAll(table.getState().sorting, table.getState().columnFilters, undefined);\n setLoading(LoadingState.Completed);\n }\n };\n\n const handleBlur = () => {\n // As soon as search input loose a focus, we'll turn of searching mode.\n tableMeta.search.setIsSearching(false);\n };\n\n const handleChange = (query: any) => {\n setQuery(String(query ?? ''));\n };\n\n const handleClear = () => {\n const [rowIndex, cellIndex] =\n tableMeta.search.highlightedColumnIndexes[tableMeta.search.currentHighlightColumnIndex || 0];\n const rows = table.getRowModel().rows;\n const rowId = rows[rowIndex]?.id || null;\n tableMeta.search.setQuery('');\n\n // Need to save row id and cell index, to be able to find the row in the table with updated indexes, after global filter will be reset.\n lastCellIndex.value = String(cellIndex);\n setRowIdToNavigate(rowId);\n };\n\n const handleKeyDown = event => {\n if (event.key === 'Escape') {\n handleClear();\n event.preventDefault();\n }\n };\n\n const { globalFilter } = table.getState();\n\n React.useEffect(() => {\n // need to wait when table global filter will be reset and rows will be re-rendered\n if (rowIdToNavigate !== null && !globalFilter) {\n const rows = table.getRowModel().rows;\n const rowIndex = rows.findIndex(row => row.id === rowIdToNavigate);\n tableMeta.search.setIsSearching(false);\n tableMeta.currentRow.setCurrentRowIndex(rowIndex);\n scrollTo(rowIndex);\n setRowIdToNavigate(null);\n }\n }, [rowIdToNavigate, globalFilter]);\n\n const handleToggleExcludeUnmatchedResults = (enabled: boolean) => {\n tableMeta.search.toggleExcludeUnmatchedResults(enabled);\n\n if (enabled) {\n if (ref.current?.value) {\n table.setGlobalFilter(ref.current?.value);\n } else {\n table.resetGlobalFilter();\n }\n } else {\n table.resetGlobalFilter();\n }\n\n requestAnimationFrame(() => ref.current?.focus());\n };\n\n const handleNextResult = () => {\n if (!tableMeta.search.highlightedColumnIndexes.length) {\n return;\n }\n\n const nextIndex =\n tableMeta.search.currentHighlightColumnIndex === undefined ||\n tableMeta.search.currentHighlightColumnIndex === tableMeta.search.highlightedColumnIndexes.length - 1\n ? 0\n : tableMeta.search.currentHighlightColumnIndex + 1;\n\n tableMeta.search.setCurrentHighlightColumnIndex(nextIndex);\n // we scroll to the row here, the cell scrolls itself into view\n scrollTo(tableMeta.search.highlightedColumnIndexes[nextIndex][0]);\n };\n\n const handlePreviousResult = () => {\n if (!tableMeta.search.highlightedColumnIndexes.length) {\n return;\n }\n\n const nextIndex =\n tableMeta.search.currentHighlightColumnIndex === undefined\n ? 0\n : tableMeta.search.currentHighlightColumnIndex === 0\n ? tableMeta.search.highlightedColumnIndexes.length - 1\n : tableMeta.search.currentHighlightColumnIndex - 1;\n\n tableMeta.search.setCurrentHighlightColumnIndex(nextIndex);\n // we scroll to the row here, the cell scrolls itself into view\n scrollTo(tableMeta.search.highlightedColumnIndexes[nextIndex][0]);\n };\n\n const settings = (\n <Switch\n label={texts.table3.search.excludeUnmatchedResults}\n checked={tableMeta.search.excludeUnmatchedResults}\n onChange={handleToggleExcludeUnmatchedResults}\n />\n );\n\n return (\n <>\n <SearchInput2\n findCurrent={\n tableMeta.search.currentHighlightColumnIndex !== undefined\n ? tableMeta.search.currentHighlightColumnIndex + 1\n : null\n }\n findTotal={tableMeta.search.highlightedColumnIndexes ? tableMeta.search.highlightedColumnIndexes.length : null}\n loading={loading === LoadingState.Loading}\n onClickFindPrevious={handlePreviousResult}\n onClickFindNext={handleNextResult}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n onClear={handleClear}\n placeholder={texts.table3.search.placeholder}\n settingsContent={settings}\n ref={ref}\n shortcut={{ key: 'f', meta: true, shift: false }}\n value={query}\n />\n </>\n );\n}\n\nfunction resetHighlightedColumnIndexes<TType = unknown>(enabled: boolean, value: string | undefined, table: RTable<TType>) {\n const tableMeta = table.options.meta as TableMeta<TType>;\n let firstRowIndex: undefined | number;\n\n if (enabled && value) {\n const rowIndexes: number[] = [];\n const indexes: number[][] = [];\n const columns = table.getVisibleLeafColumns();\n\n table.getRowModel().rows.forEach((row, rowIndex) => {\n columns.forEach((column, columnIndex) => {\n try {\n if (column.getIsVisible() && column.columnDef.meta?.enableSearch) {\n const cellValue = getCellValueAsString(row.original?.[column.id], column.columnDef.meta?.dataType);\n\n if (cellValue !== undefined && globalFilterFn(cellValue, value)) {\n indexes.push([rowIndex, columnIndex]);\n }\n }\n } catch (e) {\n //\n }\n });\n\n if (indexes.length) {\n rowIndexes.push(rowIndex);\n }\n });\n\n tableMeta.search.setHighlightedColumnIndexes(indexes);\n\n if (indexes.length) {\n firstRowIndex = indexes[0][0];\n tableMeta.search.setCurrentHighlightColumnIndex(0);\n } else {\n tableMeta.search.setCurrentHighlightColumnIndex(undefined);\n }\n } else {\n tableMeta.search.setHighlightedColumnIndexes([]);\n tableMeta.search.setCurrentHighlightColumnIndex(undefined);\n }\n\n if (firstRowIndex !== undefined) {\n tableMeta.currentRow.setCurrentRowIndex(firstRowIndex);\n }\n\n return firstRowIndex;\n}\n"],"names":["LoadingState","Search","props","scrollToIndex","table","texts","useLocalization","ref","React","useRef","tableMeta","options","meta","query","setQuery","useState","search","loading","setLoading","Incomplete","rowIdToNavigate","setRowIdToNavigate","scrollTo","rowIndex","align","useEffect","firstRowIndex","resetHighlightedColumnIndexes","isHighlightingEnabled","_ref$current","current","value","excludeUnmatchedResults","getRowModel","rows","length","JSON","stringify","getState","sorting","columnVisibility","useDebouncedEffect","setGlobalFilter","resetGlobalFilter","handleFocus","setIsSearching","_temp","loadAll","Loading","Promise","resolve","columnFilters","undefined","then","Completed","e","reject","handleBlur","handleChange","String","handleClear","cellIndex","highlightedColumnIndexes","currentHighlightColumnIndex","rowId","_rows$rowIndex","id","lastCellIndex","handleKeyDown","event","key","preventDefault","globalFilter","findIndex","row","currentRow","setCurrentRowIndex","handleToggleExcludeUnmatchedResults","enabled","toggleExcludeUnmatchedResults","_ref$current2","_ref$current3","requestAnimationFrame","_ref$current4","focus","handleNextResult","nextIndex","setCurrentHighlightColumnIndex","handlePreviousResult","settings","Switch","label","table3","checked","onChange","SearchInput2","findCurrent","findTotal","onClickFindPrevious","onClickFindNext","onFocus","onBlur","onKeyDown","onClear","placeholder","settingsContent","shortcut","shift","indexes","columns","getVisibleLeafColumns","forEach","column","columnIndex","_column$columnDef$met","getIsVisible","columnDef","enableSearch","_row$original","_column$columnDef$met2","cellValue","getCellValueAsString","original","dataType","globalFilterFn","push","setHighlightedColumnIndexes"],"mappings":";;;;;;;;;AAeA,IAAKA,YAIJ;AAJD,WAAKA,YAAY;EACbA,2DAAU;EACVA,qDAAO;EACPA,yDAAS;AACb,CAAC,EAJIA,YAAY,KAAZA,YAAY;SAMDC,MAAMA,CAAkBC,KAAyB;EAC7D,MAAM;IAAEC,aAAa;IAAEC;GAAO,GAAGF,KAAK;EACtC,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC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AAA,uBAArBA,sBAAA,CAAuBI,QAAQ,CAAC;YAElG,IAAIH,SAAS,KAAKpE,SAAS,IAAIwE,cAAc,CAACJ,SAAS,EAAEzF,KAAK,CAAC,EAAE;cAC7D6E,OAAO,CAACiB,IAAI,CAAC,CAACtG,QAAQ,EAAE0F,WAAW,CAAC,CAAC;;;SAGhD,CAAC,OAAO1D,CAAC,EAAE;;;OAGf,CAAC;KAKL,CAAC;IAEF7C,SAAS,CAACM,MAAM,CAAC8G,2BAA2B,CAAClB,OAAO,CAAC;IAErD,IAAIA,OAAO,CAACzE,MAAM,EAAE;MAChBT,aAAa,GAAGkF,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;MAC7BlG,SAAS,CAACM,MAAM,CAACuE,8BAA8B,CAAC,CAAC,CAAC;KACrD,MAAM;MACH7E,SAAS,CAACM,MAAM,CAACuE,8BAA8B,CAACnC,SAAS,CAAC;;GAEjE,MAAM;IACH1C,SAAS,CAACM,MAAM,CAAC8G,2BAA2B,CAAC,EAAE,CAAC;IAChDpH,SAAS,CAACM,MAAM,CAACuE,8BAA8B,CAACnC,SAAS,CAAC;;EAG9D,IAAI1B,aAAa,KAAK0B,SAAS,EAAE;IAC7B1C,SAAS,CAACiE,UAAU,CAACC,kBAAkB,CAAClD,aAAa,CAAC;;EAG1D,OAAOA,aAAa;AACxB;;;;"}
1
+ {"version":3,"file":"Search.js","sources":["../../../../../../../../../src/components/Table3/components/toolbar/Search.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Switch } from '../../../Switch/Switch';\nimport { globalFilterFn } from '../../util/filtering';\nimport { SearchInput2 } from '../../../SearchInput2/SearchInput2';\nimport { useDebouncedEffect } from '../../../../hooks/useDebouncedEffect';\nimport { getCellValueAsString } from '../../util/columns';\nimport { lastCellIndex } from '../rows/Row';\n\ntype SearchProps<TType = unknown> = {\n scrollToIndex: any;\n table: RTable<TType>;\n};\n\nenum LoadingState {\n Incomplete,\n Loading,\n Completed,\n}\n\nexport function Search<TType = unknown>(props: SearchProps<TType>) {\n const { scrollToIndex, table } = props;\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLInputElement>(null);\n const tableMeta = table.options.meta as TableMeta<TType>;\n const [query, setQuery] = React.useState(tableMeta.search.query);\n const [loading, setLoading] = React.useState<LoadingState>(LoadingState.Incomplete);\n const [rowIdToNavigate, setRowIdToNavigate] = React.useState<string | null>(null);\n\n const scrollTo = (rowIndex: number) => scrollToIndex(rowIndex, { align: 'center' });\n\n // update the indexes if the row length changes (e.g. when filtering)\n React.useEffect(() => {\n const firstRowIndex = resetHighlightedColumnIndexes(tableMeta.search.isHighlightingEnabled, ref.current?.value, table);\n\n if (firstRowIndex) {\n scrollTo(firstRowIndex);\n }\n }, [\n tableMeta.search.query,\n tableMeta.search.excludeUnmatchedResults,\n table.getRowModel().rows.length,\n JSON.stringify(table.getState().sorting),\n JSON.stringify(table.getState().columnVisibility),\n loading,\n ]);\n\n // Reseting internal search state if search.query is changed from the outside.\n React.useEffect(() => {\n if (tableMeta.search.query !== query) {\n setQuery(tableMeta.search.query);\n }\n }, [tableMeta.search.query]);\n\n // update the table search and filtering on a debounce\n useDebouncedEffect(() => {\n tableMeta.search.setQuery(query);\n\n if (tableMeta.search.excludeUnmatchedResults) {\n if (query?.length) {\n table.setGlobalFilter(query);\n } else {\n table.resetGlobalFilter();\n }\n }\n }, [query]);\n\n const handleFocus = async () => {\n // While Search input is focused, we'll switch into searching mode\n tableMeta.search.setIsSearching(true);\n // load all data if that is possible\n if (tableMeta.server.loadAll && loading === LoadingState.Incomplete) {\n setLoading(LoadingState.Loading);\n // don't pass the search query because we need all data - not filtered data\n await tableMeta.server.loadAll(table.getState().sorting, table.getState().columnFilters, undefined);\n setLoading(LoadingState.Completed);\n }\n };\n\n const handleBlur = () => {\n // As soon as search input loose a focus, we'll turn of searching mode.\n tableMeta.search.setIsSearching(false);\n };\n\n const handleChange = (query: any) => {\n setQuery(String(query ?? ''));\n };\n\n const handleClear = () => {\n const [rowIndex = null, cellIndex = null] =\n tableMeta.search.highlightedColumnIndexes[tableMeta.search.currentHighlightColumnIndex || 0];\n const rows = table.getRowModel().rows;\n\n tableMeta.search.setQuery('');\n\n // Need to save row id and cell index, to be able to find the row in the table with updated indexes, after global filter will be reset.\n lastCellIndex.value = String(cellIndex);\n\n if (rowIndex !== null) {\n const rowId = rows[rowIndex]?.id || null;\n setRowIdToNavigate(rowId);\n }\n };\n\n const handleKeyDown = event => {\n if (event.key === 'Escape') {\n handleClear();\n event.preventDefault();\n }\n };\n\n const { globalFilter } = table.getState();\n\n React.useEffect(() => {\n // need to wait when table global filter will be reset and rows will be re-rendered\n if (rowIdToNavigate !== null && !globalFilter) {\n const rows = table.getRowModel().rows;\n const rowIndex = rows.findIndex(row => row.id === rowIdToNavigate);\n tableMeta.search.setIsSearching(false);\n tableMeta.rowActive.setRowActiveIndex(rowIndex);\n scrollTo(rowIndex);\n setRowIdToNavigate(null);\n }\n }, [rowIdToNavigate, globalFilter]);\n\n const handleToggleExcludeUnmatchedResults = (enabled: boolean) => {\n tableMeta.search.toggleExcludeUnmatchedResults(enabled);\n\n if (enabled) {\n if (ref.current?.value) {\n table.setGlobalFilter(ref.current?.value);\n } else {\n table.resetGlobalFilter();\n }\n } else {\n table.resetGlobalFilter();\n }\n\n requestAnimationFrame(() => ref.current?.focus());\n };\n\n const handleNextResult = () => {\n if (!tableMeta.search.highlightedColumnIndexes.length) {\n return;\n }\n\n const nextIndex =\n tableMeta.search.currentHighlightColumnIndex === undefined ||\n tableMeta.search.currentHighlightColumnIndex === tableMeta.search.highlightedColumnIndexes.length - 1\n ? 0\n : tableMeta.search.currentHighlightColumnIndex + 1;\n\n tableMeta.search.setCurrentHighlightColumnIndex(nextIndex);\n // we scroll to the row here, the cell scrolls itself into view\n scrollTo(tableMeta.search.highlightedColumnIndexes[nextIndex][0]);\n };\n\n const handlePreviousResult = () => {\n if (!tableMeta.search.highlightedColumnIndexes.length) {\n return;\n }\n\n const nextIndex =\n tableMeta.search.currentHighlightColumnIndex === undefined\n ? 0\n : tableMeta.search.currentHighlightColumnIndex === 0\n ? tableMeta.search.highlightedColumnIndexes.length - 1\n : tableMeta.search.currentHighlightColumnIndex - 1;\n\n tableMeta.search.setCurrentHighlightColumnIndex(nextIndex);\n // we scroll to the row here, the cell scrolls itself into view\n scrollTo(tableMeta.search.highlightedColumnIndexes[nextIndex][0]);\n };\n\n const settings = (\n <Switch\n label={texts.table3.search.excludeUnmatchedResults}\n checked={tableMeta.search.excludeUnmatchedResults}\n onChange={handleToggleExcludeUnmatchedResults}\n />\n );\n\n return (\n <>\n <SearchInput2\n findCurrent={\n tableMeta.search.currentHighlightColumnIndex !== undefined\n ? tableMeta.search.currentHighlightColumnIndex + 1\n : null\n }\n findTotal={tableMeta.search.highlightedColumnIndexes ? tableMeta.search.highlightedColumnIndexes.length : null}\n loading={loading === LoadingState.Loading}\n onClickFindPrevious={handlePreviousResult}\n onClickFindNext={handleNextResult}\n onChange={handleChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n onClear={handleClear}\n placeholder={texts.table3.search.placeholder}\n settingsContent={settings}\n ref={ref}\n shortcut={{ key: 'f', meta: true, shift: false }}\n value={query}\n />\n </>\n );\n}\n\nfunction resetHighlightedColumnIndexes<TType = unknown>(enabled: boolean, value: string | undefined, table: RTable<TType>) {\n const tableMeta = table.options.meta as TableMeta<TType>;\n let firstRowIndex: undefined | number;\n\n if (enabled && value) {\n const rowIndexes: number[] = [];\n const indexes: number[][] = [];\n const columns = table.getVisibleLeafColumns();\n\n table.getRowModel().rows.forEach((row, rowIndex) => {\n columns.forEach((column, columnIndex) => {\n try {\n if (column.getIsVisible() && column.columnDef.meta?.enableSearch) {\n const cellValue = getCellValueAsString(row.original?.[column.id], column.columnDef.meta?.dataType);\n\n if (cellValue !== undefined && globalFilterFn(cellValue, value)) {\n indexes.push([rowIndex, columnIndex]);\n }\n }\n } catch (e) {\n //\n }\n });\n\n if (indexes.length) {\n rowIndexes.push(rowIndex);\n }\n });\n\n tableMeta.search.setHighlightedColumnIndexes(indexes);\n\n if (indexes.length) {\n firstRowIndex = indexes[0][0];\n tableMeta.search.setCurrentHighlightColumnIndex(0);\n } else {\n tableMeta.search.setCurrentHighlightColumnIndex(undefined);\n }\n } else {\n tableMeta.search.setHighlightedColumnIndexes([]);\n tableMeta.search.setCurrentHighlightColumnIndex(undefined);\n }\n\n if (firstRowIndex !== undefined) {\n tableMeta.rowActive.setRowActiveIndex(firstRowIndex);\n }\n\n return firstRowIndex;\n}\n"],"names":["LoadingState","Search","props","scrollToIndex","table","texts","useLocalization","ref","React","useRef","tableMeta","options","meta","query","setQuery","useState","search","loading","setLoading","Incomplete","rowIdToNavigate","setRowIdToNavigate","scrollTo","rowIndex","align","useEffect","firstRowIndex","resetHighlightedColumnIndexes","isHighlightingEnabled","_ref$current","current","value","excludeUnmatchedResults","getRowModel","rows","length","JSON","stringify","getState","sorting","columnVisibility","useDebouncedEffect","setGlobalFilter","resetGlobalFilter","handleFocus","setIsSearching","_temp","server","loadAll","Loading","Promise","resolve","columnFilters","undefined","then","Completed","e","reject","handleBlur","handleChange","String","handleClear","cellIndex","highlightedColumnIndexes","currentHighlightColumnIndex","lastCellIndex","_rows$rowIndex","rowId","id","handleKeyDown","event","key","preventDefault","globalFilter","findIndex","row","rowActive","setRowActiveIndex","handleToggleExcludeUnmatchedResults","enabled","toggleExcludeUnmatchedResults","_ref$current2","_ref$current3","requestAnimationFrame","_ref$current4","focus","handleNextResult","nextIndex","setCurrentHighlightColumnIndex","handlePreviousResult","settings","Switch","label","table3","checked","onChange","SearchInput2","findCurrent","findTotal","onClickFindPrevious","onClickFindNext","onFocus","onBlur","onKeyDown","onClear","placeholder","settingsContent","shortcut","shift","indexes","columns","getVisibleLeafColumns","forEach","column","columnIndex","_column$columnDef$met","getIsVisible","columnDef","enableSearch","_row$original","_column$columnDef$met2","cellValue","getCellValueAsString","original","dataType","globalFilterFn","push","setHighlightedColumnIndexes"],"mappings":";;;;;;;;;AAeA,IAAKA,YAIJ;AAJD,WAAKA,YAAY;EACbA,2DAAU;EACVA,qDAAO;EACPA,yDAAS;AACb,CAAC,EAJIA,YAAY,KAAZA,YAAY;SAMDC,MAAMA,CAAkBC,KAAyB;EAC7D,MAAM;IAAEC,aAAa;IAAEC;GAAO,GAAGF,KAAK;EACtC,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAmB,IAAI,CAAC;EAChD,MAAMC,SAAS,GAAGN,KAAK,CAACO,OAAO,CAACC,IAAwB;EACxD,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGN,cAAK,CAACO,QAAQ,CAACL,SAAS,CAACM,MAAM,CAACH,KAAK,CAAC;EAChE,MAAM,CAACI,OAAO,EAAEC,UAAU,CAAC,GAAGV,cAAK,CAACO,QAAQ,CAAef,YAAY,CAACmB,UAAU,CAAC;EACnF,MAAM,CAACC,eAAe,EAAEC,kBAAkB,CAAC,GAAGb,cAAK,CAACO,QAAQ,CAAgB,IAAI,CAAC;EAEjF,MAAMO,QAAQ,GAAIC,QAAgB,IAAKpB,aAAa,CAACoB,QAAQ,EAAE;IAAEC,KAAK,EAAE;GAAU,CAAC;;EAGnFhB,cAAK,CAACiB,SAAS,CAAC;;IACZ,MAAMC,aAAa,GAAGC,6BAA6B,CAACjB,SAAS,CAACM,MAAM,CAACY,qBAAqB,GAAAC,YAAA,GAAEtB,GAAG,CAACuB,OAAO,cAAAD,YAAA,uBAAXA,YAAA,CAAaE,KAAK,EAAE3B,KAAK,CAAC;IAEtH,IAAIsB,aAAa,EAAE;MACfJ,QAAQ,CAACI,aAAa,CAAC;;GAE9B,EAAE,CACChB,SAAS,CAACM,MAAM,CAACH,KAAK,EACtBH,SAAS,CAACM,MAAM,CAACgB,uBAAuB,EACxC5B,KAAK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ACxB;;;;"}
@@ -24,11 +24,11 @@ function SettingsButton(props) {
24
24
  case 'columnSettings':
25
25
  {
26
26
  if (hasColumnSettings) {
27
- popoverElement = props => /*#__PURE__*/React__default.createElement(ColumnSettingsPopover, Object.assign({}, props, {
27
+ popoverElement = props => ( /*#__PURE__*/React__default.createElement(ColumnSettingsPopover, Object.assign({}, props, {
28
28
  open: true,
29
29
  onChange: handleClosePopover,
30
30
  table: table
31
- }));
31
+ })));
32
32
  }
33
33
  }
34
34
  }
@@ -36,25 +36,25 @@ function SettingsButton(props) {
36
36
  return /*#__PURE__*/React__default.createElement(IconButton, {
37
37
  "aria-label": texts.table3.otherOptions.tooltip,
38
38
  icon: "sliders",
39
- menu: popoverElement ? undefined : menuProps => /*#__PURE__*/React__default.createElement(Menu, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu.Content, {
39
+ menu: popoverElement ? undefined : menuProps => ( /*#__PURE__*/React__default.createElement(Menu, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu.Content, {
40
40
  align: "end"
41
- }, table.options.enableHiding || tableMeta.columnOrdering.isEnabled ? /*#__PURE__*/React__default.createElement(Menu.Item, {
41
+ }, table.options.enableHiding || tableMeta.columnOrdering.isEnabled ? ( /*#__PURE__*/React__default.createElement(Menu.Item, {
42
42
  icon: "columns",
43
43
  onClick: () => setPopover('columnSettings')
44
- }, texts.table3.columnSettings.button) : null, tableMeta.rowHeight.isEnabled || tableMeta.fontSize.isEnabled ? /*#__PURE__*/React__default.createElement(Menu.Separator, null) : null, tableMeta.rowHeight.isEnabled ? /*#__PURE__*/React__default.createElement(Menu.Item, {
44
+ }, texts.table3.columnSettings.button)) : null, tableMeta.rowHeight.isEnabled || tableMeta.fontSize.isEnabled ? /*#__PURE__*/React__default.createElement(Menu.Separator, null) : null, tableMeta.rowHeight.isEnabled ? ( /*#__PURE__*/React__default.createElement(Menu.Item, {
45
45
  icon: `height-${tableMeta.rowHeight.height}`,
46
46
  subMenu: () => /*#__PURE__*/React__default.createElement(RowHeight, {
47
47
  table: table
48
48
  })
49
- }, texts.table3.rowHeight.tooltip) : null, tableMeta.fontSize.isEnabled ? /*#__PURE__*/React__default.createElement(Menu.Item, {
49
+ }, texts.table3.rowHeight.tooltip)) : null, tableMeta.fontSize.isEnabled ? ( /*#__PURE__*/React__default.createElement(Menu.Item, {
50
50
  icon: "font-size",
51
51
  subMenu: () => /*#__PURE__*/React__default.createElement(FontSize, {
52
52
  table: table
53
53
  })
54
- }, texts.table3.fontSize.tooltip) : null, customSettings ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Menu.Separator, null), customSettings.map(customSetting => {
54
+ }, texts.table3.fontSize.tooltip)) : null, customSettings ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Menu.Separator, null), customSettings.map(customSetting => {
55
55
  const props = tableMeta.getSettings();
56
56
  return customSetting(props);
57
- })) : null)),
57
+ }))) : null))),
58
58
  popover: popoverElement,
59
59
  onClickCapture: event => event.preventDefault(),
60
60
  tooltip: texts.table3.otherOptions.tooltip
@@ -1 +1 @@
1
- {"version":3,"file":"Settings.js","sources":["../../../../../../../../../src/components/Table3/components/toolbar/Settings.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { RowHeight } from './RowHeight';\nimport { ColumnSettingsPopover } from './ColumnSettings';\nimport { IconButton } from '../../../IconButton/IconButton';\nimport { Menu } from '../../../Menu/Menu';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { IconName } from '../../../Icon/Icon';\nimport { FontSize } from './FontSize';\nimport { Table3CustomSettingRenderer } from '../../types';\n\nexport type SettingsButtonProps<TType = unknown> = {\n customSettings?: Table3CustomSettingRenderer[];\n table: RTable<TType>;\n};\nexport function SettingsButton<TType = unknown>(props: SettingsButtonProps<TType>) {\n const { customSettings, table } = props;\n const { texts } = useLocalization();\n const [popover, setPopover] = React.useState<string | undefined>(undefined);\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const hasColumnSettings = table.options.enableHiding || tableMeta.columnOrdering.isEnabled;\n\n let popoverElement;\n\n if (popover) {\n const handleClosePopover = () => setPopover(undefined);\n\n switch (popover) {\n case 'columnSettings': {\n if (hasColumnSettings) {\n popoverElement = props => (\n <ColumnSettingsPopover {...props} open onChange={handleClosePopover} table={table} />\n );\n }\n }\n }\n }\n\n return (\n <IconButton\n aria-label={texts.table3.otherOptions.tooltip}\n icon=\"sliders\"\n menu={\n popoverElement\n ? undefined\n : menuProps => (\n <Menu {...menuProps}>\n <Menu.Content align=\"end\">\n {table.options.enableHiding || tableMeta.columnOrdering.isEnabled ? (\n <Menu.Item icon=\"columns\" onClick={() => setPopover('columnSettings')}>\n {texts.table3.columnSettings.button}\n </Menu.Item>\n ) : null}\n {tableMeta.rowHeight.isEnabled || tableMeta.fontSize.isEnabled ? <Menu.Separator /> : null}\n {tableMeta.rowHeight.isEnabled ? (\n <Menu.Item\n icon={`height-${tableMeta.rowHeight.height}` as IconName}\n subMenu={() => <RowHeight table={table} />}>\n {texts.table3.rowHeight.tooltip}\n </Menu.Item>\n ) : null}\n {tableMeta.fontSize.isEnabled ? (\n <Menu.Item icon=\"font-size\" subMenu={() => <FontSize table={table} />}>\n {texts.table3.fontSize.tooltip}\n </Menu.Item>\n ) : null}\n {customSettings ? (\n <>\n <Menu.Separator />\n {customSettings.map(customSetting => {\n const props = tableMeta.getSettings();\n return customSetting(props);\n })}\n </>\n ) : null}\n </Menu.Content>\n </Menu>\n )\n }\n popover={popoverElement}\n onClickCapture={event => event.preventDefault()}\n tooltip={texts.table3.otherOptions.tooltip}\n />\n );\n}\n"],"names":["SettingsButton","props","customSettings","table","texts","useLocalization","popover","setPopover","React","useState","undefined","tableMeta","options","meta","hasColumnSettings","enableHiding","columnOrdering","isEnabled","popoverElement","handleClosePopover","ColumnSettingsPopover","open","onChange","IconButton","table3","otherOptions","tooltip","icon","menu","menuProps","Menu","Content","align","Item","onClick","columnSettings","button","rowHeight","fontSize","Separator","height","subMenu","RowHeight","FontSize","map","customSetting","getSettings","onClickCapture","event","preventDefault"],"mappings":";;;;;;;;SAegBA,cAAcA,CAAkBC,KAAiC;EAC7E,MAAM;IAAEC,cAAc;IAAEC;GAAO,GAAGF,KAAK;EACvC,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAqBC,SAAS,CAAC;EAC3E,MAAMC,SAAS,GAAGR,KAAK,CAACS,OAAO,CAACC,IAAwB;EAExD,MAAMC,iBAAiB,GAAGX,KAAK,CAACS,OAAO,CAACG,YAAY,IAAIJ,SAAS,CAACK,cAAc,CAACC,SAAS;EAE1F,IAAIC,cAAc;EAElB,IAAIZ,OAAO,EAAE;IACT,MAAMa,kBAAkB,GAAGA,MAAMZ,UAAU,CAACG,SAAS,CAAC;IAEtD,QAAQJ,OAAO;MACX,KAAK,gBAAgB;QAAE;UACnB,IAAIQ,iBAAiB,EAAE;YACnBI,cAAc,GAAGjB,KAAK,iBAClBO,6BAACY,qBAAqB,oBAAKnB,KAAK;cAAEoB,IAAI;cAACC,QAAQ,EAAEH,kBAAkB;cAAEhB,KAAK,EAAEA;eAC/E;;;;;EAMjB,oBACIK,6BAACe,UAAU;kBACKnB,KAAK,CAACoB,MAAM,CAACC,YAAY,CAACC,OAAO;IAC7CC,IAAI,EAAC,SAAS;IACdC,IAAI,EACAV,cAAc,GACRR,SAAS,GACTmB,SAAS,iBACLrB,6BAACsB,IAAI,oBAAKD,SAAS,gBACfrB,6BAACsB,IAAI,CAACC,OAAO;MAACC,KAAK,EAAC;OACf7B,KAAK,CAACS,OAAO,CAACG,YAAY,IAAIJ,SAAS,CAACK,cAAc,CAACC,SAAS,gBAC7DT,6BAACsB,IAAI,CAACG,IAAI;MAACN,IAAI,EAAC,SAAS;MAACO,OAAO,EAAEA,MAAM3B,UAAU,CAAC,gBAAgB;OAC/DH,KAAK,CAACoB,MAAM,CAACW,cAAc,CAACC,MAAM,CAC3B,GACZ,IAAI,EACPzB,SAAS,CAAC0B,SAAS,CAACpB,SAAS,IAAIN,SAAS,CAAC2B,QAAQ,CAACrB,SAAS,gBAAGT,6BAACsB,IAAI,CAACS,SAAS,OAAG,GAAG,IAAI,EACzF5B,SAAS,CAAC0B,SAAS,CAACpB,SAAS,gBAC1BT,6BAACsB,IAAI,CAACG,IAAI;MACNN,IAAI,YAAYhB,SAAS,CAAC0B,SAAS,CAACG,QAAoB;MACxDC,OAAO,EAAEA,mBAAMjC,6BAACkC,SAAS;QAACvC,KAAK,EAAEA;;OAChCC,KAAK,CAACoB,MAAM,CAACa,SAAS,CAACX,OAAO,CACvB,GACZ,IAAI,EACPf,SAAS,CAAC2B,QAAQ,CAACrB,SAAS,gBACzBT,6BAACsB,IAAI,CAACG,IAAI;MAACN,IAAI,EAAC,WAAW;MAACc,OAAO,EAAEA,mBAAMjC,6BAACmC,QAAQ;QAACxC,KAAK,EAAEA;;OACvDC,KAAK,CAACoB,MAAM,CAACc,QAAQ,CAACZ,OAAO,CACtB,GACZ,IAAI,EACPxB,cAAc,gBACXM,yEACIA,6BAACsB,IAAI,CAACS,SAAS,OAAG,EACjBrC,cAAc,CAAC0C,GAAG,CAACC,aAAa;MAC7B,MAAM5C,KAAK,GAAGU,SAAS,CAACmC,WAAW,EAAE;MACrC,OAAOD,aAAa,CAAC5C,KAAK,CAAC;KAC9B,CAAC,CACH,GACH,IAAI,CACG,CAEtB;IAEXK,OAAO,EAAEY,cAAc;IACvB6B,cAAc,EAAEC,KAAK,IAAIA,KAAK,CAACC,cAAc,EAAE;IAC/CvB,OAAO,EAAEtB,KAAK,CAACoB,MAAM,CAACC,YAAY,CAACC;IACrC;AAEV;;;;"}
1
+ {"version":3,"file":"Settings.js","sources":["../../../../../../../../../src/components/Table3/components/toolbar/Settings.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { RowHeight } from './RowHeight';\nimport { ColumnSettingsPopover } from './ColumnSettings';\nimport { IconButton } from '../../../IconButton/IconButton';\nimport { Menu } from '../../../Menu/Menu';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { IconName } from '../../../Icon/Icon';\nimport { FontSize } from './FontSize';\nimport { Table3CustomSettingRenderer } from '../../types';\n\nexport type SettingsButtonProps<TType = unknown> = {\n customSettings?: Table3CustomSettingRenderer[];\n table: RTable<TType>;\n};\nexport function SettingsButton<TType = unknown>(props: SettingsButtonProps<TType>) {\n const { customSettings, table } = props;\n const { texts } = useLocalization();\n const [popover, setPopover] = React.useState<string | undefined>(undefined);\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n const hasColumnSettings = table.options.enableHiding || tableMeta.columnOrdering.isEnabled;\n\n let popoverElement;\n\n if (popover) {\n const handleClosePopover = () => setPopover(undefined);\n\n switch (popover) {\n case 'columnSettings': {\n if (hasColumnSettings) {\n popoverElement = props => (\n <ColumnSettingsPopover {...props} open onChange={handleClosePopover} table={table} />\n );\n }\n }\n }\n }\n\n return (\n <IconButton\n aria-label={texts.table3.otherOptions.tooltip}\n icon=\"sliders\"\n menu={\n popoverElement\n ? undefined\n : menuProps => (\n <Menu {...menuProps}>\n <Menu.Content align=\"end\">\n {table.options.enableHiding || tableMeta.columnOrdering.isEnabled ? (\n <Menu.Item icon=\"columns\" onClick={() => setPopover('columnSettings')}>\n {texts.table3.columnSettings.button}\n </Menu.Item>\n ) : null}\n {tableMeta.rowHeight.isEnabled || tableMeta.fontSize.isEnabled ? <Menu.Separator /> : null}\n {tableMeta.rowHeight.isEnabled ? (\n <Menu.Item\n icon={`height-${tableMeta.rowHeight.height}` as IconName}\n subMenu={() => <RowHeight table={table} />}>\n {texts.table3.rowHeight.tooltip}\n </Menu.Item>\n ) : null}\n {tableMeta.fontSize.isEnabled ? (\n <Menu.Item icon=\"font-size\" subMenu={() => <FontSize table={table} />}>\n {texts.table3.fontSize.tooltip}\n </Menu.Item>\n ) : null}\n {customSettings ? (\n <>\n <Menu.Separator />\n {customSettings.map(customSetting => {\n const props = tableMeta.getSettings();\n return customSetting(props);\n })}\n </>\n ) : null}\n </Menu.Content>\n </Menu>\n )\n }\n popover={popoverElement}\n onClickCapture={event => event.preventDefault()}\n tooltip={texts.table3.otherOptions.tooltip}\n />\n );\n}\n"],"names":["SettingsButton","props","customSettings","table","texts","useLocalization","popover","setPopover","React","useState","undefined","tableMeta","options","meta","hasColumnSettings","enableHiding","columnOrdering","isEnabled","popoverElement","handleClosePopover","ColumnSettingsPopover","open","onChange","IconButton","table3","otherOptions","tooltip","icon","menu","menuProps","Menu","Content","align","Item","onClick","columnSettings","button","rowHeight","fontSize","Separator","height","subMenu","RowHeight","FontSize","map","customSetting","getSettings","onClickCapture","event","preventDefault"],"mappings":";;;;;;;;SAegBA,cAAcA,CAAkBC,KAAiC;EAC7E,MAAM;IAAEC,cAAc;IAAEC;GAAO,GAAGF,KAAK;EACvC,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAqBC,SAAS,CAAC;EAC3E,MAAMC,SAAS,GAAGR,KAAK,CAACS,OAAO,CAACC,IAAwB;EAExD,MAAMC,iBAAiB,GAAGX,KAAK,CAACS,OAAO,CAACG,YAAY,IAAIJ,SAAS,CAACK,cAAc,CAACC,SAAS;EAE1F,IAAIC,cAAc;EAElB,IAAIZ,OAAO,EAAE;IACT,MAAMa,kBAAkB,GAAGA,MAAMZ,UAAU,CAACG,SAAS,CAAC;IAEtD,QAAQJ,OAAO;MACX,KAAK,gBAAgB;QAAE;UACnB,IAAIQ,iBAAiB,EAAE;YACnBI,cAAc,GAAGjB,KAAK,mBAClBO,6BAACY,qBAAqB,oBAAKnB,KAAK;cAAEoB,IAAI;cAACC,QAAQ,EAAEH,kBAAkB;cAAEhB,KAAK,EAAEA;eAAS,CACxF;;;;;EA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,aAAa;MAC7B,MAAM5C,KAAK,GAAGU,SAAS,CAACmC,WAAW,EAAE;MACrC,OAAOD,aAAa,CAAC5C,KAAK,CAAC;KAC9B,CAAC,CACH,IACH,IAAI,CACG,CACZ,CACV;IAEXK,OAAO,EAAEY,cAAc;IACvB6B,cAAc,EAAEC,KAAK,IAAIA,KAAK,CAACC,cAAc,EAAE;IAC/CvB,OAAO,EAAEtB,KAAK,CAACoB,MAAM,CAACC,YAAY,CAACC;IACrC;AAEV;;;;"}
@@ -1,6 +1,6 @@
1
1
  import React__default from 'react';
2
2
 
3
- function useSearch(isEnabled, excludeUnmatchedResultsInSearch = false, loadAll) {
3
+ function useSearch(isEnabled, excludeUnmatchedResultsInSearch = false) {
4
4
  const [isSearching, setIsSearching] = React__default.useState(false);
5
5
  const [query, setQuery] = React__default.useState();
6
6
  const [enableHighlighting, setEnableHighlighting] = React__default.useState(true);
@@ -20,7 +20,6 @@ function useSearch(isEnabled, excludeUnmatchedResultsInSearch = false, loadAll)
20
20
  setHighlightedColumnIndexes,
21
21
  currentHighlightColumnIndex,
22
22
  setCurrentHighlightColumnIndex,
23
- loadAll,
24
23
  isSearching,
25
24
  setIsSearching
26
25
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useSearch.js","sources":["../../../../../../../../../src/components/Table3/hooks/features/useSearch.ts"],"sourcesContent":["import React from 'react';\nimport { Table3LoadAllHandler } from '../../types';\n\nexport function useSearch(isEnabled: boolean, excludeUnmatchedResultsInSearch = false, loadAll?: Table3LoadAllHandler) {\n const [isSearching, setIsSearching] = React.useState(false);\n const [query, setQuery] = React.useState<string | undefined>();\n const [enableHighlighting, setEnableHighlighting] = React.useState<boolean>(true);\n const [excludeUnmatchedResults, setExcludeUnmatchedResults] = React.useState<boolean>(excludeUnmatchedResultsInSearch);\n\n // highlighting\n const [highlightedColumnIndexes, setHighlightedColumnIndexes] = React.useState<number[][]>([]);\n const [currentHighlightColumnIndex, setCurrentHighlightColumnIndex] = React.useState<number | undefined>(undefined);\n\n return {\n isEnabled,\n isHighlightingEnabled: enableHighlighting,\n toggleHighlighting: setEnableHighlighting,\n excludeUnmatchedResults,\n toggleExcludeUnmatchedResults: setExcludeUnmatchedResults,\n query,\n setQuery: isEnabled ? setQuery : () => undefined,\n highlightedColumnIndexes,\n setHighlightedColumnIndexes,\n currentHighlightColumnIndex,\n setCurrentHighlightColumnIndex,\n loadAll,\n isSearching,\n setIsSearching,\n };\n}\n"],"names":["useSearch","isEnabled","excludeUnmatchedResultsInSearch","loadAll","isSearching","setIsSearching","React","useState","query","setQuery","enableHighlighting","setEnableHighlighting","excludeUnmatchedResults","setExcludeUnmatchedResults","highlightedColumnIndexes","setHighlightedColumnIndexes","currentHighlightColumnIndex","setCurrentHighlightColumnIndex","undefined","isHighlightingEnabled","toggleHighlighting","toggleExcludeUnmatchedResults"],"mappings":";;SAGgBA,SAASA,CAACC,SAAkB,EAAEC,+BAA+B,GAAG,KAAK,EAAEC,OAA8B;EACjH,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EAC3D,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGH,cAAK,CAACC,QAAQ,EAAsB;EAC9D,MAAM,CAACG,kBAAkB,EAAEC,qBAAqB,CAAC,GAAGL,cAAK,CAACC,QAAQ,CAAU,IAAI,CAAC;EACjF,MAAM,CAACK,uBAAuB,EAAEC,0BAA0B,CAAC,GAAGP,cAAK,CAACC,QAAQ,CAAUL,+BAA+B,CAAC;;EAGtH,MAAM,CAACY,wBAAwB,EAAEC,2BAA2B,CAAC,GAAGT,cAAK,CAACC,QAAQ,CAAa,EAAE,CAAC;EAC9F,MAAM,CAACS,2BAA2B,EAAEC,8BAA8B,CAAC,GAAGX,cAAK,CAACC,QAAQ,CAAqBW,SAAS,CAAC;EAEnH,OAAO;IACHjB,SAAS;IACTkB,qBAAqB,EAAET,kBAAkB;IACzCU,kBAAkB,EAAET,qBAAqB;IACzCC,uBAAuB;IACvBS,6BAA6B,EAAER,0BAA0B;IACzDL,KAAK;IACLC,QAAQ,EAAER,SAAS,GAAGQ,QAAQ,GAAG,MAAMS,SAAS;IAChDJ,wBAAwB;IACxBC,2BAA2B;IAC3BC,2BAA2B;IAC3BC,8BAA8B;IAC9Bd,OAAO;IACPC,WAAW;IACXC;GACH;AACL;;;;"}
1
+ {"version":3,"file":"useSearch.js","sources":["../../../../../../../../../src/components/Table3/hooks/features/useSearch.ts"],"sourcesContent":["import React from 'react';\n\nexport function useSearch(isEnabled: boolean, excludeUnmatchedResultsInSearch = false) {\n const [isSearching, setIsSearching] = React.useState(false);\n const [query, setQuery] = React.useState<string | undefined>();\n const [enableHighlighting, setEnableHighlighting] = React.useState<boolean>(true);\n const [excludeUnmatchedResults, setExcludeUnmatchedResults] = React.useState<boolean>(excludeUnmatchedResultsInSearch);\n\n // highlighting\n const [highlightedColumnIndexes, setHighlightedColumnIndexes] = React.useState<number[][]>([]);\n const [currentHighlightColumnIndex, setCurrentHighlightColumnIndex] = React.useState<number | undefined>(undefined);\n\n return {\n isEnabled,\n isHighlightingEnabled: enableHighlighting,\n toggleHighlighting: setEnableHighlighting,\n excludeUnmatchedResults,\n toggleExcludeUnmatchedResults: setExcludeUnmatchedResults,\n query,\n setQuery: isEnabled ? setQuery : () => undefined,\n highlightedColumnIndexes,\n setHighlightedColumnIndexes,\n currentHighlightColumnIndex,\n setCurrentHighlightColumnIndex,\n isSearching,\n setIsSearching,\n };\n}\n"],"names":["useSearch","isEnabled","excludeUnmatchedResultsInSearch","isSearching","setIsSearching","React","useState","query","setQuery","enableHighlighting","setEnableHighlighting","excludeUnmatchedResults","setExcludeUnmatchedResults","highlightedColumnIndexes","setHighlightedColumnIndexes","currentHighlightColumnIndex","setCurrentHighlightColumnIndex","undefined","isHighlightingEnabled","toggleHighlighting","toggleExcludeUnmatchedResults"],"mappings":";;SAEgBA,SAASA,CAACC,SAAkB,EAAEC,+BAA+B,GAAG,KAAK;EACjF,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EAC3D,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGH,cAAK,CAACC,QAAQ,EAAsB;EAC9D,MAAM,CAACG,kBAAkB,EAAEC,qBAAqB,CAAC,GAAGL,cAAK,CAACC,QAAQ,CAAU,IAAI,CAAC;EACjF,MAAM,CAACK,uBAAuB,EAAEC,0BAA0B,CAAC,GAAGP,cAAK,CAACC,QAAQ,CAAUJ,+BAA+B,CAAC;;EAGtH,MAAM,CAACW,wBAAwB,EAAEC,2BAA2B,CAAC,GAAGT,cAAK,CAACC,QAAQ,CAAa,EAAE,CAAC;EAC9F,MAAM,CAACS,2BAA2B,EAAEC,8BAA8B,CAAC,GAAGX,cAAK,CAACC,QAAQ,CAAqBW,SAAS,CAAC;EAEnH,OAAO;IACHhB,SAAS;IACTiB,qBAAqB,EAAET,kBAAkB;IACzCU,kBAAkB,EAAET,qBAAqB;IACzCC,uBAAuB;IACvBS,6BAA6B,EAAER,0BAA0B;IACzDL,KAAK;IACLC,QAAQ,EAAEP,SAAS,GAAGO,QAAQ,GAAG,MAAMS,SAAS;IAChDJ,wBAAwB;IACxBC,2BAA2B;IAC3BC,2BAA2B;IAC3BC,8BAA8B;IAC9Bb,WAAW;IACXC;GACH;AACL;;;;"}
@@ -9,7 +9,7 @@ function useEditingStateListener(table) {
9
9
  meta.editing.saveChangesIfNeeded();
10
10
  });
11
11
  }
12
- }, [meta.currentRow.currentRowIndex]);
12
+ }, [meta.rowActive.rowActiveIndex]);
13
13
  // save if editing gets toggled off
14
14
  React__default.useEffect(() => {
15
15
  if (meta.editing.isEnabled) {
@@ -17,8 +17,8 @@ function useEditingStateListener(table) {
17
17
  requestAnimationFrame(() => {
18
18
  meta.editing.saveChangesIfNeeded();
19
19
  });
20
- } else if (meta.currentRow.currentRowIndex === undefined) {
21
- meta.currentRow.setCurrentRowIndex(0);
20
+ } else if (meta.rowActive.rowActiveIndex === undefined) {
21
+ meta.rowActive.setRowActiveIndex(0);
22
22
  }
23
23
  }
24
24
  }, [meta.editing.isEditing]);
@@ -1 +1 @@
1
- {"version":3,"file":"useEditingStateListener.js","sources":["../../../../../../../../../src/components/Table3/hooks/listeners/useEditingStateListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\n\nexport function useEditingStateListener<TType = unknown>(table: RTable<TType>) {\n const meta = table.options.meta as TableMeta<TType>;\n\n // save when the row changes\n React.useEffect(() => {\n if (meta.editing.isEnabled && meta.editing.isEditing) {\n requestAnimationFrame(() => {\n meta.editing.saveChangesIfNeeded();\n });\n }\n }, [meta.currentRow.currentRowIndex]);\n\n // save if editing gets toggled off\n React.useEffect(() => {\n if (meta.editing.isEnabled) {\n if (!meta.editing.isEditing) {\n requestAnimationFrame(() => {\n meta.editing.saveChangesIfNeeded();\n });\n } else if (meta.currentRow.currentRowIndex === undefined) {\n meta.currentRow.setCurrentRowIndex(0);\n }\n }\n }, [meta.editing.isEditing]);\n}\n"],"names":["useEditingStateListener","table","meta","options","React","useEffect","editing","isEnabled","isEditing","requestAnimationFrame","saveChangesIfNeeded","currentRow","currentRowIndex","undefined","setCurrentRowIndex"],"mappings":";;SAGgBA,uBAAuBA,CAAkBC,KAAoB;EACzE,MAAMC,IAAI,GAAGD,KAAK,CAACE,OAAO,CAACD,IAAwB;;EAGnDE,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIH,IAAI,CAACI,OAAO,CAACC,SAAS,IAAIL,IAAI,CAACI,OAAO,CAACE,SAAS,EAAE;MAClDC,qBAAqB,CAAC;QAClBP,IAAI,CAACI,OAAO,CAACI,mBAAmB,EAAE;OACrC,CAAC;;GAET,EAAE,CAACR,IAAI,CAACS,UAAU,CAACC,eAAe,CAAC,CAAC;;EAGrCR,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIH,IAAI,CAACI,OAAO,CAACC,SAAS,EAAE;MACxB,IAAI,CAACL,IAAI,CAACI,OAAO,CAACE,SAAS,EAAE;QACzBC,qBAAqB,CAAC;UAClBP,IAAI,CAACI,OAAO,CAACI,mBAAmB,EAAE;SACrC,CAAC;OACL,MAAM,IAAIR,IAAI,CAACS,UAAU,CAACC,eAAe,KAAKC,SAAS,EAAE;QACtDX,IAAI,CAACS,UAAU,CAACG,kBAAkB,CAAC,CAAC,CAAC;;;GAGhD,EAAE,CAACZ,IAAI,CAACI,OAAO,CAACE,SAAS,CAAC,CAAC;AAChC;;;;"}
1
+ {"version":3,"file":"useEditingStateListener.js","sources":["../../../../../../../../../src/components/Table3/hooks/listeners/useEditingStateListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as RTable, TableMeta } from '@tanstack/react-table';\n\nexport function useEditingStateListener<TType = unknown>(table: RTable<TType>) {\n const meta = table.options.meta as TableMeta<TType>;\n\n // save when the row changes\n React.useEffect(() => {\n if (meta.editing.isEnabled && meta.editing.isEditing) {\n requestAnimationFrame(() => {\n meta.editing.saveChangesIfNeeded();\n });\n }\n }, [meta.rowActive.rowActiveIndex]);\n\n // save if editing gets toggled off\n React.useEffect(() => {\n if (meta.editing.isEnabled) {\n if (!meta.editing.isEditing) {\n requestAnimationFrame(() => {\n meta.editing.saveChangesIfNeeded();\n });\n } else if (meta.rowActive.rowActiveIndex === undefined) {\n meta.rowActive.setRowActiveIndex(0);\n }\n }\n }, [meta.editing.isEditing]);\n}\n"],"names":["useEditingStateListener","table","meta","options","React","useEffect","editing","isEnabled","isEditing","requestAnimationFrame","saveChangesIfNeeded","rowActive","rowActiveIndex","undefined","setRowActiveIndex"],"mappings":";;SAGgBA,uBAAuBA,CAAkBC,KAAoB;EACzE,MAAMC,IAAI,GAAGD,KAAK,CAACE,OAAO,CAACD,IAAwB;;EAGnDE,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIH,IAAI,CAACI,OAAO,CAACC,SAAS,IAAIL,IAAI,CAACI,OAAO,CAACE,SAAS,EAAE;MAClDC,qBAAqB,CAAC;QAClBP,IAAI,CAACI,OAAO,CAACI,mBAAmB,EAAE;OACrC,CAAC;;GAET,EAAE,CAACR,IAAI,CAACS,SAAS,CAACC,cAAc,CAAC,CAAC;;EAGnCR,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIH,IAAI,CAACI,OAAO,CAACC,SAAS,EAAE;MACxB,IAAI,CAACL,IAAI,CAACI,OAAO,CAACE,SAAS,EAAE;QACzBC,qBAAqB,CAAC;UAClBP,IAAI,CAACI,OAAO,CAACI,mBAAmB,EAAE;SACrC,CAAC;OACL,MAAM,IAAIR,IAAI,CAACS,SAAS,CAACC,cAAc,KAAKC,SAAS,EAAE;QACpDX,IAAI,CAACS,SAAS,CAACG,iBAAiB,CAAC,CAAC,CAAC;;;GAG9C,EAAE,CAACZ,IAAI,CAACI,OAAO,CAACE,SAAS,CAAC,CAAC;AAChC;;;;"}