@economic/taco 2.15.0 → 2.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. package/dist/components/Drawer/Drawer.d.ts +5 -1
  2. package/dist/components/Provider/Localization.d.ts +19 -0
  3. package/dist/components/SearchInput2/SearchInput2.d.ts +1 -0
  4. package/dist/components/Table3/Table3.d.ts +0 -2
  5. package/dist/components/Table3/components/alert/ErrorAlert.d.ts +10 -0
  6. package/dist/components/Table3/components/columns/cell/DisplayCell.d.ts +5 -2
  7. package/dist/components/Table3/components/columns/cell/EditingCell.d.ts +3 -0
  8. package/dist/components/Table3/components/columns/cell/EditingControl.d.ts +1 -1
  9. package/dist/components/Table3/components/columns/cell/Highlight.d.ts +2 -0
  10. package/dist/components/Table3/components/columns/header/Header.d.ts +1 -1
  11. package/dist/components/Table3/components/columns/internal/EditingActions.d.ts +1 -1
  12. package/dist/components/Table3/components/columns/styles.d.ts +2 -2
  13. package/dist/components/Table3/components/rows/Row.d.ts +5 -1
  14. package/dist/components/Table3/components/rows/RowContext.d.ts +1 -0
  15. package/dist/components/Table3/hooks/features/useEditing.d.ts +12 -11
  16. package/dist/components/Table3/hooks/features/{usePauseHoverState.d.ts → usePauseShortcuts.d.ts} +1 -2
  17. package/dist/components/Table3/hooks/features/useSearch.d.ts +3 -3
  18. package/dist/components/Table3/hooks/features/useValidation.d.ts +13 -0
  19. package/dist/components/Table3/hooks/useTable.d.ts +25 -20
  20. package/dist/components/Table3/types.d.ts +41 -19
  21. package/dist/components/Table3/util/editing.d.ts +6 -0
  22. package/dist/components/Table3/util/scrolling.d.ts +2 -0
  23. package/dist/esm/index.css +108 -33
  24. package/dist/esm/packages/taco/src/components/Banner/Banner.js +2 -2
  25. package/dist/esm/packages/taco/src/components/Banner/Banner.js.map +1 -1
  26. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js +4 -4
  27. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
  28. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +3 -3
  29. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +2 -1
  31. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +6 -6
  33. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +3 -3
  35. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +7 -2
  37. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -1
  38. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +7 -7
  39. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
  40. package/dist/esm/packages/taco/src/components/Field/Field.js +2 -2
  41. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  42. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js +2 -2
  43. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js.map +1 -1
  44. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +4 -4
  45. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
  46. package/dist/esm/packages/taco/src/components/Header/components/Link.js +2 -2
  47. package/dist/esm/packages/taco/src/components/Header/components/Link.js.map +1 -1
  48. package/dist/esm/packages/taco/src/components/Icon/Icon.js +2 -2
  49. package/dist/esm/packages/taco/src/components/Icon/Icon.js.map +1 -1
  50. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js +2 -2
  51. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +6 -6
  53. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
  54. package/dist/esm/packages/taco/src/components/Menu/components/Item.js +4 -4
  55. package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
  56. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js +2 -2
  57. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js.map +1 -1
  58. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js +3 -3
  59. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js.map +1 -1
  60. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js +2 -2
  61. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js.map +1 -1
  62. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +1 -1
  63. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
  64. package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js +2 -2
  65. package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js.map +1 -1
  66. package/dist/esm/packages/taco/src/components/Pagination/Pagination.js +5 -5
  67. package/dist/esm/packages/taco/src/components/Pagination/Pagination.js.map +1 -1
  68. package/dist/esm/packages/taco/src/components/Popover/Popover.js +2 -2
  69. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  70. package/dist/esm/packages/taco/src/components/Provider/Localization.js +19 -0
  71. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  72. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js +2 -2
  73. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js.map +1 -1
  74. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +12 -8
  75. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  76. package/dist/esm/packages/taco/src/components/Select/useSelect.js +2 -2
  77. package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
  78. package/dist/esm/packages/taco/src/components/Select2/Select2.js +7 -7
  79. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  80. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +8 -8
  81. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  82. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +5 -5
  83. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  84. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +10 -10
  85. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  86. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +2 -2
  87. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
  88. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js +3 -3
  89. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js.map +1 -1
  90. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +2 -2
  91. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
  92. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +10 -10
  93. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js.map +1 -1
  94. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js +2 -2
  95. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js.map +1 -1
  96. package/dist/esm/packages/taco/src/components/Table3/Table3.js +37 -30
  97. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  98. package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js +154 -0
  99. package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js.map +1 -0
  100. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +54 -9
  101. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
  102. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +9 -57
  103. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
  104. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +72 -41
  105. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  106. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +41 -17
  107. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
  108. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js +41 -0
  109. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js.map +1 -0
  110. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +23 -14
  111. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
  112. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js +3 -3
  113. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js.map +1 -1
  114. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js +1 -1
  115. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js.map +1 -1
  116. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +9 -9
  117. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
  118. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +37 -6
  119. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
  120. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +12 -12
  121. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
  122. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js +2 -2
  123. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js.map +1 -1
  124. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +63 -23
  125. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js.map +1 -1
  126. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js +3 -3
  127. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js.map +1 -1
  128. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +3 -3
  129. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
  130. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js +2 -13
  131. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js.map +1 -1
  132. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +67 -57
  133. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
  134. package/dist/esm/packages/taco/src/components/Table3/components/rows/RowContext.js +2 -1
  135. package/dist/esm/packages/taco/src/components/Table3/components/rows/RowContext.js.map +1 -1
  136. package/dist/esm/packages/taco/src/components/Table3/components/rows/SkeletonRow.js +2 -2
  137. package/dist/esm/packages/taco/src/components/Table3/components/rows/SkeletonRow.js.map +1 -1
  138. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +8 -6
  139. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js.map +1 -1
  140. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +23 -8
  141. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
  142. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js +2 -2
  143. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js.map +1 -1
  144. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +2 -2
  145. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js.map +1 -1
  146. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +16 -16
  147. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
  148. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +1 -0
  149. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
  150. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +53 -4
  151. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
  152. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js +8 -8
  153. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js.map +1 -1
  154. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js +185 -101
  155. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js.map +1 -1
  156. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseShortcuts.js +12 -0
  157. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseShortcuts.js.map +1 -0
  158. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSearch.js +4 -2
  159. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSearch.js.map +1 -1
  160. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useValidation.js +178 -0
  161. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useValidation.js.map +1 -0
  162. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js +3 -3
  163. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js.map +1 -1
  164. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +1 -49
  165. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
  166. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +1 -2
  167. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
  168. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js +0 -2
  169. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js.map +1 -1
  170. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +135 -111
  171. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  172. package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js +4 -4
  173. package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js.map +1 -1
  174. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  175. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +21 -1
  176. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  177. package/dist/esm/packages/taco/src/components/Table3/util/scrolling.js +53 -0
  178. package/dist/esm/packages/taco/src/components/Table3/util/scrolling.js.map +1 -0
  179. package/dist/esm/packages/taco/src/components/Tag/Tag.js +4 -4
  180. package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
  181. package/dist/esm/packages/taco/src/components/Toast/Toaster.js +2 -2
  182. package/dist/esm/packages/taco/src/components/Toast/Toaster.js.map +1 -1
  183. package/dist/esm/packages/taco/src/components/Tour/Tour.js +4 -4
  184. package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
  185. package/dist/esm/packages/taco/src/components/Treeview/Treeview.js +2 -2
  186. package/dist/esm/packages/taco/src/components/Treeview/Treeview.js.map +1 -1
  187. package/dist/esm/packages/taco/src/index.js +2 -1
  188. package/dist/esm/packages/taco/src/index.js.map +1 -1
  189. package/dist/esm/packages/taco/src/primitives/Table/types.js +10 -0
  190. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -0
  191. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js +8 -0
  192. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js.map +1 -0
  193. package/dist/esm/packages/taco/src/{components/Table3/hooks/features/useFontSize.js → primitives/Table/useTable/features/useTableFontSize.js} +3 -3
  194. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFontSize.js.map +1 -0
  195. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js +14 -0
  196. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +1 -0
  197. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js +100 -0
  198. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js.map +1 -0
  199. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowClick.js +30 -0
  200. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowClick.js.map +1 -0
  201. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js +9 -0
  202. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js.map +1 -0
  203. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowHeight.js +13 -0
  204. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowHeight.js.map +1 -0
  205. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js +32 -0
  206. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js.map +1 -0
  207. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js +11 -0
  208. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js.map +1 -0
  209. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableDataListener.js +15 -0
  210. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableDataListener.js.map +1 -0
  211. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useFilteringStateListener.js → primitives/Table/useTable/listeners/useTableFilterListener.js} +3 -3
  212. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFilterListener.js.map +1 -0
  213. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFontSizeListener.js +40 -0
  214. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFontSizeListener.js.map +1 -0
  215. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useRowSelectionListener.js → primitives/Table/useTable/listeners/useTableRowSelectionListener.js} +5 -6
  216. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowSelectionListener.js.map +1 -0
  217. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useServerLoadingListener.js → primitives/Table/useTable/listeners/useTableServerLoadingListener.js} +3 -3
  218. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableServerLoadingListener.js.map +1 -0
  219. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useShortcutsListener.js → primitives/Table/useTable/listeners/useTableShortcutsListener.js} +7 -7
  220. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableShortcutsListener.js.map +1 -0
  221. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useSortingStateListener.js → primitives/Table/useTable/listeners/useTableSortingListener.js} +6 -4
  222. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSortingListener.js.map +1 -0
  223. package/dist/esm/packages/taco/src/{components/Table3/hooks/features/useColumnOrdering.js → primitives/Table/useTable/util/columns.js} +24 -15
  224. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -0
  225. package/dist/esm/packages/taco/src/types.js +6 -0
  226. package/dist/esm/packages/taco/src/types.js.map +1 -0
  227. package/dist/esm/packages/taco/src/utils/date.js +0 -1
  228. package/dist/esm/packages/taco/src/utils/date.js.map +1 -1
  229. package/dist/index.css +108 -33
  230. package/dist/primitives/Table/types.d.ts +35 -0
  231. package/dist/primitives/Table/useTable/features/useTableColumnOrdering.d.ts +3 -0
  232. package/dist/primitives/Table/useTable/features/useTableFontSize.d.ts +7 -0
  233. package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +7 -0
  234. package/dist/primitives/Table/useTable/features/useTableRowActive.d.ts +12 -0
  235. package/dist/primitives/Table/useTable/features/useTableRowClick.d.ts +7 -0
  236. package/dist/primitives/Table/useTable/features/useTableRowGoto.d.ts +5 -0
  237. package/dist/primitives/Table/useTable/features/useTableRowHeight.d.ts +7 -0
  238. package/dist/primitives/Table/useTable/features/useTableRowSelection.d.ts +6 -0
  239. package/dist/primitives/Table/useTable/features/useTableServerLoading.d.ts +6 -0
  240. package/dist/primitives/Table/useTable/listeners/useTableDataListener.d.ts +2 -0
  241. package/dist/primitives/Table/useTable/listeners/useTableFilterListener.d.ts +3 -0
  242. package/dist/primitives/Table/useTable/listeners/useTableFontSizeListener.d.ts +2 -0
  243. package/dist/primitives/Table/useTable/listeners/useTableRowSelectionListener.d.ts +3 -0
  244. package/dist/primitives/Table/useTable/listeners/useTableServerLoadingListener.d.ts +3 -0
  245. package/dist/primitives/Table/useTable/listeners/useTableShortcutsListener.d.ts +3 -0
  246. package/dist/primitives/Table/useTable/listeners/useTableSortingListener.d.ts +3 -0
  247. package/dist/primitives/Table/useTable/util/columns.d.ts +4 -0
  248. package/dist/taco.cjs.development.js +2294 -1543
  249. package/dist/taco.cjs.development.js.map +1 -1
  250. package/dist/taco.cjs.production.min.js +1 -1
  251. package/dist/taco.cjs.production.min.js.map +1 -1
  252. package/dist/types.d.ts +5 -0
  253. package/package.json +3 -3
  254. package/types.json +13547 -12953
  255. package/dist/components/Table3/hooks/features/useColumnOrdering.d.ts +0 -6
  256. package/dist/components/Table3/hooks/features/useCurrentRow.d.ts +0 -11
  257. package/dist/components/Table3/hooks/features/useFontSize.d.ts +0 -7
  258. package/dist/components/Table3/hooks/features/usePrinting.d.ts +0 -8
  259. package/dist/components/Table3/hooks/features/useRowClick.d.ts +0 -6
  260. package/dist/components/Table3/hooks/features/useRowGoto.d.ts +0 -5
  261. package/dist/components/Table3/hooks/features/useRowHeight.d.ts +0 -7
  262. package/dist/components/Table3/hooks/features/useRowSelection.d.ts +0 -6
  263. package/dist/components/Table3/hooks/listeners/useCurrentRowListener.d.ts +0 -2
  264. package/dist/components/Table3/hooks/listeners/useFilteringStateListener.d.ts +0 -3
  265. package/dist/components/Table3/hooks/listeners/useRowSelectionListener.d.ts +0 -3
  266. package/dist/components/Table3/hooks/listeners/useServerLoadingListener.d.ts +0 -3
  267. package/dist/components/Table3/hooks/listeners/useShortcutsListener.d.ts +0 -3
  268. package/dist/components/Table3/hooks/listeners/useSortingStateListener.d.ts +0 -3
  269. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnOrdering.js.map +0 -1
  270. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js +0 -93
  271. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js.map +0 -1
  272. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useFontSize.js.map +0 -1
  273. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseHoverState.js +0 -22
  274. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseHoverState.js.map +0 -1
  275. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePrinting.js +0 -14
  276. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePrinting.js.map +0 -1
  277. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js +0 -25
  278. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js.map +0 -1
  279. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowGoto.js +0 -9
  280. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowGoto.js.map +0 -1
  281. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowHeight.js +0 -27
  282. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowHeight.js.map +0 -1
  283. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js +0 -32
  284. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js.map +0 -1
  285. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js +0 -15
  286. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js.map +0 -1
  287. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useFilteringStateListener.js.map +0 -1
  288. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useRowSelectionListener.js.map +0 -1
  289. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useServerLoadingListener.js.map +0 -1
  290. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useShortcutsListener.js.map +0 -1
  291. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSortingStateListener.js.map +0 -1
@@ -5,8 +5,10 @@ import { useLocalization } from '../../../Provider/Localization.js';
5
5
  import { Checkbox } from '../../../Checkbox/Checkbox.js';
6
6
  import { Input } from '../../../Input/Input.js';
7
7
  import { Popover } from '../../../Popover/Popover.js';
8
+ import { COLUMN_ID } from '../columns/internal/Actions.js';
8
9
  import { isInternalColumn } from '../../util/columns.js';
9
- import { ensureOrdering } from '../../hooks/features/useColumnOrdering.js';
10
+ import { ensureOrdering } from '../../../../primitives/Table/useTable/util/columns.js';
11
+ import { COLUMN_ID as COLUMN_ID$1 } from '../columns/internal/EditingActions.js';
10
12
  import { Container } from '../../../../primitives/Sortable/components/Container.js';
11
13
  import { arrayMove } from '@dnd-kit/sortable';
12
14
  import { Item } from '../../../../primitives/Sortable/components/Item.js';
@@ -69,17 +71,17 @@ function ColumnSettingsPopover(props) {
69
71
  })) {
70
72
  return;
71
73
  }
72
- table.setColumnOrder(currentOrder => ensureOrdering(allColumns, arrayMove(currentOrder, currentOrder.findIndex(c => c === activeId), currentOrder.findIndex(c => c === overId))));
74
+ table.setColumnOrder(currentOrder => ensureOrdering(allColumns, [COLUMN_ID, COLUMN_ID$1], arrayMove(currentOrder, currentOrder.findIndex(c => c === activeId), currentOrder.findIndex(c => c === overId))));
73
75
  };
74
76
  return /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps, {
75
77
  anchor: trigger
76
78
  }), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement("div", {
77
79
  className: "flex max-w-sm flex-col gap-2"
78
- }, table.options.enableHiding ? /*#__PURE__*/React__default.createElement(Input, {
80
+ }, table.options.enableHiding ? ( /*#__PURE__*/React__default.createElement(Input, {
79
81
  onChange: event => setQuery(event.target.value),
80
82
  placeholder: texts.table3.columnSettings.search,
81
83
  value: query
82
- }) : null, tableMeta.columnOrdering.isEnabled && columns.length && !(query !== null && query !== void 0 && query.length) ? /*#__PURE__*/React__default.createElement(Container, {
84
+ })) : null, tableMeta.columnOrdering.isEnabled && columns.length && !(query !== null && query !== void 0 && query.length) ? ( /*#__PURE__*/React__default.createElement(Container, {
83
85
  reorder: handleReorder
84
86
  }, /*#__PURE__*/React__default.createElement(List, {
85
87
  id: "columns",
@@ -95,12 +97,12 @@ function ColumnSettingsPopover(props) {
95
97
  column: column,
96
98
  draggable: (_column$columnDef$met5 = column.columnDef.meta) === null || _column$columnDef$met5 === void 0 ? void 0 : _column$columnDef$met5.enableOrdering
97
99
  }));
98
- }))) : /*#__PURE__*/React__default.createElement("div", {
100
+ })))) : ( /*#__PURE__*/React__default.createElement("div", {
99
101
  className: listClassName
100
102
  }, columns.length ? columns.map(column => /*#__PURE__*/React__default.createElement(Column, {
101
103
  column: column,
102
104
  key: column.id
103
- })) : texts.table3.columnSettings.noResults))));
105
+ })) : texts.table3.columnSettings.noResults)))));
104
106
  }
105
107
 
106
108
  export { ColumnSettingsPopover };
@@ -1 +1 @@
1
- {"version":3,"file":"ColumnSettings.js","sources":["../../../../../../../../../src/components/Table3/components/toolbar/ColumnSettings.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Table as RTable, Column as RTColumn, TableMeta } from '@tanstack/react-table';\nimport { isInternalColumn } from '../../util/columns';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Checkbox } from '../../../Checkbox/Checkbox';\nimport { Popover, PopoverProps } from '../../../Popover/Popover';\nimport { Input } from '../../../Input/Input';\nimport * as SortablePrimitive from '../../../../primitives/Sortable/Sortable';\nimport { Icon } from '../../../Icon/Icon';\nimport { ensureOrdering } from '../../hooks/features/useColumnOrdering';\n\ntype ColumnProps<TType = unknown> = React.HTMLAttributes<HTMLDivElement> & {\n column: RTColumn<TType, unknown>;\n draggable?: boolean;\n};\n\nconst Column = React.forwardRef(function Column<TType = unknown>(props: ColumnProps<TType>, ref: React.Ref<HTMLDivElement>) {\n const { column, draggable = false, ...dragAttributes } = props;\n const canHide = column.getCanHide();\n\n const className = cn('group/column flex items-center gap-x-2 rounded py-1 px-2', {\n 'hover:bg-grey-200': canHide || draggable,\n 'hover:cursor-pointer': canHide,\n 'active:cursor-move active:bg-grey-300': draggable,\n });\n\n const attributes = draggable ? dragAttributes : undefined;\n const isVisible = column.getIsVisible();\n\n const parentText = column.parent ? column.parent?.columnDef.meta?.header : null;\n\n return (\n <div {...attributes} key={column.id} className={className} onClick={() => column.toggleVisibility(!isVisible)} ref={ref}>\n {draggable ? <Icon name=\"drag\" className=\"text-grey-500 group-hover/column:text-grey-700 -mx-2 !h-5\" /> : null}\n <span className=\"flex-grow truncate\">\n {column.columnDef.meta?.header}\n {parentText ? <span className=\"italic\"> ({parentText})</span> : null}\n </span>\n {canHide ? <Checkbox checked={isVisible} onChange={() => column.toggleVisibility(!isVisible)} /> : null}\n </div>\n );\n});\n\nexport type ColumnSettingsProps<TType = unknown> = PopoverProps & {\n table: RTable<TType>;\n};\n\nexport function ColumnSettingsPopover<TType = unknown>(props: ColumnSettingsProps<TType>) {\n const { table, trigger, ...popoverProps } = props;\n const { texts } = useLocalization();\n const [query, setQuery] = React.useState('');\n const allColumns = table.getAllLeafColumns();\n const tableMeta = table.options.meta as TableMeta<TType>;\n const columns = React.useMemo(\n () =>\n allColumns\n .filter(column => !isInternalColumn(column.id))\n .filter(column =>\n query?.length\n ? column.columnDef.meta?.header.toLowerCase().includes(query.toLowerCase()) ||\n column.parent?.columnDef.meta?.header.toLowerCase().includes(query.toLowerCase())\n : true\n ),\n [allColumns, query]\n );\n\n const listClassName = 'flex max-h-64 flex-col gap-y-px overflow-auto';\n\n const handleReorder = (activeId, overId) => {\n if (columns.find(column => column.id === overId && column.columnDef.meta?.enableOrdering === false)) {\n return;\n }\n\n table.setColumnOrder(currentOrder =>\n ensureOrdering(\n allColumns,\n SortablePrimitive.arrayMove(\n currentOrder,\n currentOrder.findIndex(c => c === activeId),\n currentOrder.findIndex(c => c === overId)\n )\n )\n );\n };\n\n return (\n <Popover {...popoverProps} anchor={trigger}>\n <Popover.Content>\n <div className=\"flex max-w-sm flex-col gap-2\">\n {table.options.enableHiding ? (\n <Input\n onChange={event => setQuery(event.target.value)}\n placeholder={texts.table3.columnSettings.search}\n value={query}\n />\n ) : null}\n {tableMeta.columnOrdering.isEnabled && columns.length && !query?.length ? (\n <SortablePrimitive.Container reorder={handleReorder}>\n <SortablePrimitive.List id=\"columns\" className={listClassName}>\n {columns.map(column => (\n <SortablePrimitive.Item\n key={column.id}\n id={column.id}\n disabled={!column.columnDef.meta?.enableOrdering}\n asChild>\n <Column column={column as any} draggable={column.columnDef.meta?.enableOrdering} />\n </SortablePrimitive.Item>\n ))}\n </SortablePrimitive.List>\n </SortablePrimitive.Container>\n ) : (\n <div className={listClassName}>\n {columns.length\n ? columns.map(column => <Column column={column as any} key={column.id} />)\n : texts.table3.columnSettings.noResults}\n </div>\n )}\n </div>\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["Column","React","forwardRef","props","ref","column","draggable","dragAttributes","canHide","getCanHide","className","cn","attributes","undefined","isVisible","getIsVisible","parentText","parent","_column$parent","_column$parent$column","columnDef","meta","header","key","id","onClick","toggleVisibility","Icon","name","_column$columnDef$met","Checkbox","checked","onChange","ColumnSettingsPopover","table","trigger","popoverProps","texts","useLocalization","query","setQuery","useState","allColumns","getAllLeafColumns","tableMeta","options","columns","useMemo","filter","isInternalColumn","_column$columnDef$met2","_column$parent2","_column$parent2$colum","length","toLowerCase","includes","listClassName","handleReorder","activeId","overId","find","_column$columnDef$met3","enableOrdering","setColumnOrder","currentOrder","ensureOrdering","SortablePrimitive","findIndex","c","Popover","anchor","Content","enableHiding","Input","event","target","value","placeholder","table3","columnSettings","search","columnOrdering","isEnabled","reorder","map","_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AAE1B;kBAClCxD,6BAACiE,IAAsB;IAAC1C,EAAE,EAAC,SAAS;IAACd,SAAS,EAAE8C;KAC3CV,OAAO,CAACsC,GAAG,CAAC/E,MAAM;IAAA,IAAAgF,sBAAA,EAAAC,sBAAA;IAAA,oBACfrF,6BAACiE,IAAsB;MACnB3C,GAAG,EAAElB,MAAM,CAACmB,EAAE;MACdA,EAAE,EAAEnB,MAAM,CAACmB,EAAE;MACb+D,QAAQ,EAAE,GAAAF,sBAAA,GAAChF,MAAM,CAACe,SAAS,CAACC,IAAI,cAAAgE,sBAAA,eAArBA,sBAAA,CAAuBvB,cAAc;MAChD0B,OAAO;oBACPvF,6BAACD,MAAM;MAACK,MAAM,EAAEA,MAAa;MAAEC,SAAS,GAAAgF,sBAAA,GAAEjF,MAAM,CAACe,SAAS,CAACC,IAAI,cAAAiE,sBAAA,uBAArBA,sBAAA,CAAuBxB;MAAkB,CAC9D;GAC5B,CAAC,CACmB,CACC,gBAE9B7D;IAAKS,SAAS,EAAE8C;KACXV,OAAO,CAACO,MAAM,GACTP,OAAO,CAACsC,GAAG,CAAC/E,MAAM,iBAAIJ,6BAACD,MAAM;IAACK,MAAM,EAAEA,MAAa;IAAEkB,GAAG,EAAElB,MAAM,CAACmB;IAAM,CAAC,GACxEa,KAAK,CAACyC,MAAM,CAACC,cAAc,CAACU,SAAS,CAElD,CACC,CACQ,CACZ;AAElB;;;;"}
1
+ {"version":3,"file":"ColumnSettings.js","sources":["../../../../../../../../../src/components/Table3/components/toolbar/ColumnSettings.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Table as RTable, Column as RTColumn, TableMeta } from '@tanstack/react-table';\nimport { isInternalColumn } from '../../util/columns';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Checkbox } from '../../../Checkbox/Checkbox';\nimport { Popover, PopoverProps } from '../../../Popover/Popover';\nimport { Input } from '../../../Input/Input';\nimport * as SortablePrimitive from '../../../../primitives/Sortable/Sortable';\nimport { Icon } from '../../../Icon/Icon';\nimport { ensureOrdering } from '../../../../primitives/Table/useTable/util/columns';\nimport { COLUMN_ID as ACTIONS_COLUMN_ID } from '../../components/columns/internal/Actions';\nimport { COLUMN_ID as EDITING_ACTIONS_COLUMN_ID } from '../../components/columns/internal/EditingActions';\n\ntype ColumnProps<TType = unknown> = React.HTMLAttributes<HTMLDivElement> & {\n column: RTColumn<TType, unknown>;\n draggable?: boolean;\n};\n\nconst Column = React.forwardRef(function Column<TType = unknown>(props: ColumnProps<TType>, ref: React.Ref<HTMLDivElement>) {\n const { column, draggable = false, ...dragAttributes } = props;\n const canHide = column.getCanHide();\n\n const className = cn('group/column flex items-center gap-x-2 rounded py-1 px-2', {\n 'hover:bg-grey-200': canHide || draggable,\n 'hover:cursor-pointer': canHide,\n 'active:cursor-move active:bg-grey-300': draggable,\n });\n\n const attributes = draggable ? dragAttributes : undefined;\n const isVisible = column.getIsVisible();\n\n const parentText = column.parent ? column.parent?.columnDef.meta?.header : null;\n\n return (\n <div {...attributes} key={column.id} className={className} onClick={() => column.toggleVisibility(!isVisible)} ref={ref}>\n {draggable ? <Icon name=\"drag\" className=\"text-grey-500 group-hover/column:text-grey-700 -mx-2 !h-5\" /> : null}\n <span className=\"flex-grow truncate\">\n {column.columnDef.meta?.header}\n {parentText ? <span className=\"italic\"> ({parentText})</span> : null}\n </span>\n {canHide ? <Checkbox checked={isVisible} onChange={() => column.toggleVisibility(!isVisible)} /> : null}\n </div>\n );\n});\n\nexport type ColumnSettingsProps<TType = unknown> = PopoverProps & {\n table: RTable<TType>;\n};\n\nexport function ColumnSettingsPopover<TType = unknown>(props: ColumnSettingsProps<TType>) {\n const { table, trigger, ...popoverProps } = props;\n const { texts } = useLocalization();\n const [query, setQuery] = React.useState('');\n const allColumns = table.getAllLeafColumns();\n const tableMeta = table.options.meta as TableMeta<TType>;\n const columns = React.useMemo(\n () =>\n allColumns\n .filter(column => !isInternalColumn(column.id))\n .filter(column =>\n query?.length\n ? column.columnDef.meta?.header.toLowerCase().includes(query.toLowerCase()) ||\n column.parent?.columnDef.meta?.header.toLowerCase().includes(query.toLowerCase())\n : true\n ),\n [allColumns, query]\n );\n\n const listClassName = 'flex max-h-64 flex-col gap-y-px overflow-auto';\n\n const handleReorder = (activeId, overId) => {\n if (columns.find(column => column.id === overId && column.columnDef.meta?.enableOrdering === false)) {\n return;\n }\n\n table.setColumnOrder(currentOrder =>\n ensureOrdering(\n allColumns,\n [ACTIONS_COLUMN_ID, EDITING_ACTIONS_COLUMN_ID],\n SortablePrimitive.arrayMove(\n currentOrder,\n currentOrder.findIndex(c => c === activeId),\n currentOrder.findIndex(c => c === overId)\n )\n )\n );\n };\n\n return (\n <Popover {...popoverProps} anchor={trigger}>\n <Popover.Content>\n <div className=\"flex max-w-sm flex-col gap-2\">\n {table.options.enableHiding ? (\n <Input\n onChange={event => setQuery(event.target.value)}\n placeholder={texts.table3.columnSettings.search}\n value={query}\n />\n ) : null}\n {tableMeta.columnOrdering.isEnabled && columns.length && !query?.length ? (\n <SortablePrimitive.Container reorder={handleReorder}>\n <SortablePrimitive.List id=\"columns\" className={listClassName}>\n {columns.map(column => (\n <SortablePrimitive.Item\n key={column.id}\n id={column.id}\n disabled={!column.columnDef.meta?.enableOrdering}\n asChild>\n <Column column={column as any} draggable={column.columnDef.meta?.enableOrdering} />\n </SortablePrimitive.Item>\n ))}\n </SortablePrimitive.List>\n </SortablePrimitive.Container>\n ) : (\n <div className={listClassName}>\n {columns.length\n ? columns.map(column => <Column column={column as any} key={column.id} />)\n : texts.table3.columnSettings.noResults}\n </div>\n )}\n </div>\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["Column","React","forwardRef","props","ref","column","draggable","dragAttributes","canHide","getCanHide","className","cn","attributes","undefined","isVisible","getIsVisible","parentText","parent","_column$parent","_column$parent$column","columnDef","meta","header","key","id","onClick","toggleVisibility","Icon","name","_column$columnDef$met","Checkbox","checked","onChange","ColumnSettingsPopover","table","trigger","popoverProps","texts","useLocalization","query","setQuery","useState","allColumns","getAllLeafColumns","tableMeta","options","columns","useMemo","filter","isInternalColumn","_column$columnDef$met2","_column$parent2","_column$parent2$colum","length","toLowerCase","includes","listClassName","handleReorder","activeId","overId","find","_column$columnDef$met3","enableOrdering","setColumnOrder","currentOrder","ensureOrdering","ACTIONS_COLUMN_ID","EDITING_ACTIONS_COLUMN_ID","SortablePrimitive","findIndex","c","Popover","anchor","Content","enableHiding","Input","event","target","value","placeholder","table3","columnSettings","search","columnOrdering","isEnabled","reorder","map","_column$columnDef$met4","_column$columnDef$met5","disabled","asChild","noResults"],"mappings":";;;;;;;;;;;;;;;;AAmBA,MAAMA,MAAM,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,MAAMA,CAAkBG,KAAyB,EAAEC,GAA8B;;EACtH,MAAM;IAAEC,MAAM;IAAEC,SAAS,GAAG,KAAK;IAAE,GAAGC;GAAgB,GAAGJ,KAAK;EAC9D,MAAMK,OAAO,GAAGH,MAAM,CAACI,UAAU,EAAE;EAEnC,MAAMC,SAAS,GAAGC,EAAE,CAAC,0DAA0D,EAAE;IAC7E,mBAAmB,EAAEH,OAAO,IAAIF,SAAS;IACzC,sBAAsB,EAAEE,OAAO;IAC/B,uCAAuC,EAAEF;GAC5C,CAAC;EAEF,MAAMM,UAAU,GAAGN,SAAS,GAAGC,cAAc,GAAGM,SAAS;EACzD,MAAMC,SAAS,GAAGT,MAAM,CAACU,YAAY,EAAE;EAEvC,MAAMC,UAAU,GAAGX,MAAM,CAACY,MAAM,IAAAC,cAAA,GAAGb,MAAM,CAACY,MAAM,cAAAC,cAAA,wBAAAC,qBAAA,GAAbD,cAAA,CAAeE,SAAS,CAACC,IAAI,cAAAF,qBAAA,uBAA7BA,qBAAA,CAA+BG,MAAM,GAAG,IAAI;EAE/E,oBACIrB,sDAASW,UAAU;IAAEW,GAAG,EAAElB,MAAM,CAACmB,EAAE;IAAEd,SAAS,EAAEA,SAAS;IAAEe,OAAO,EAAEA,MAAMpB,MAAM,CAACqB,g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;;"}
@@ -41,7 +41,7 @@ function FiltersButton(props) {
41
41
  (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.click();
42
42
  });
43
43
  // state, since we "apply" filters
44
- const [filters, setFilters] = React__default.useState(table.getState().columnFilters);
44
+ const [filters, setFilters] = React__default.useState(appliedFilters);
45
45
  const [placeholderCount, setPlaceholderCount] = React__default.useState(1);
46
46
  // filters
47
47
  const handleChangeFilter = (currentId, filter) => {
@@ -98,12 +98,27 @@ function FiltersButton(props) {
98
98
  setFilters([]);
99
99
  setPlaceholderCount(1);
100
100
  };
101
+ const handleClose = React__default.useCallback(open => {
102
+ if (!open) {
103
+ setFilters(appliedFilters);
104
+ setPlaceholderCount(appliedFilters.length === 0 ? 1 : 0);
105
+ }
106
+ }, [appliedFilters]);
107
+ // Because filters can be reset from outside
108
+ React__default.useEffect(() => {
109
+ if (appliedFilters.length === 0) {
110
+ setFilters([]);
111
+ setPlaceholderCount(1);
112
+ }
113
+ }, [appliedFilters]);
101
114
  const buttonProps = {
102
115
  'aria-label': texts.table3.filters.tooltip,
103
116
  className: cn({
104
117
  '!wcag-blue-100': appliedFilters.length
105
118
  }),
106
- popover: popoverProps => /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement("div", {
119
+ popover: popoverProps => ( /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps, {
120
+ onChange: handleClose
121
+ }), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement("div", {
107
122
  className: "flex w-[40rem] flex-col gap-4"
108
123
  }, /*#__PURE__*/React__default.createElement("div", {
109
124
  className: "flex h-8"
@@ -115,7 +130,7 @@ function FiltersButton(props) {
115
130
  className: "text-grey-700 mb-0 mr-auto mt-px inline-flex"
116
131
  }, texts.table3.filters.total.replace('[CURRENT]', new Intl.NumberFormat(locale).format(table.getFilteredRowModel().rows.length)).replace('[TOTAL]', new Intl.NumberFormat(locale).format(total))))), /*#__PURE__*/React__default.createElement("div", {
117
132
  className: "flex flex-col gap-2"
118
- }, filters.map((filter, index) => /*#__PURE__*/React__default.createElement(Filter, {
133
+ }, filters.map((filter, index) => ( /*#__PURE__*/React__default.createElement(Filter, {
119
134
  key: `filter_${index}`,
120
135
  allColumns: allColumns,
121
136
  filter: filter,
@@ -123,14 +138,14 @@ function FiltersButton(props) {
123
138
  position: index,
124
139
  onChange: handleChangeFilter,
125
140
  onRemove: handleRemoveFilter
126
- })), [...Array(placeholderCount)].map((_, index) => /*#__PURE__*/React__default.createElement(Placeholder, {
141
+ }))), [...Array(placeholderCount)].map((_, index) => ( /*#__PURE__*/React__default.createElement(Placeholder, {
127
142
  key: `placeholder_${index}`,
128
143
  allColumns: allColumns,
129
144
  filters: filters,
130
145
  position: filters.length + index,
131
146
  onCreate: handleCreateFilterFromPlaceholder,
132
147
  onRemove: placeholderCount > 1 || filters.length > 0 ? handleRemovePlaceholder : undefined
133
- })), /*#__PURE__*/React__default.createElement("div", {
148
+ }))), /*#__PURE__*/React__default.createElement("div", {
134
149
  className: "justify-start"
135
150
  }, /*#__PURE__*/React__default.createElement(Button, {
136
151
  appearance: "discrete",
@@ -142,16 +157,16 @@ function FiltersButton(props) {
142
157
  }, "Clear"), /*#__PURE__*/React__default.createElement(Button, {
143
158
  appearance: "primary",
144
159
  onClick: handleApply
145
- }, "Apply"))))),
160
+ }, "Apply")))))),
146
161
  ref,
147
- tooltip: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table3.filters.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
162
+ tooltip: ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table3.filters.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
148
163
  className: "ml-2",
149
164
  keys: {
150
165
  key: 'f',
151
166
  meta: true,
152
167
  shift: true
153
168
  }
154
- }))
169
+ })))
155
170
  };
156
171
  if (!isLargeScreen && !appliedFilters.length) {
157
172
  return /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, buttonProps, {
@@ -1 +1 @@
1
- {"version":3,"file":"Filters.js","sources":["../../../../../../../../../../../src/components/Table3/components/toolbar/Filter/filters/Filters.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Table as RTable, Column as RTColumn } from '@tanstack/react-table';\nimport { Button } from '../../../../../Button/Button';\nimport { Icon } from '../../../../../Icon/Icon';\nimport { Popover } from '../../../../../Popover/Popover';\nimport { Table3FilterValue, Table3FilterComparator, Table3Filter, ColumnFilter } from '../../../../types';\nimport { Shortcut } from '../../../../../Shortcut/Shortcut';\nimport { useGlobalKeyDown } from '../../../../../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { isInternalColumn } from '../../../../util/columns';\nimport { Placeholder } from './components/Placeholder';\nimport { Filter } from './components/Filter';\nimport { Group } from '../../../../../Group/Group';\nimport { useIsLargeScreen } from '../../../../../../hooks/useIsLargeScreen';\nimport { IconButton } from '../../../../../IconButton/IconButton';\n\nfunction sortByHeader<TType = unknown>(a: RTColumn<TType>, b: RTColumn<TType>) {\n return (a.columnDef.meta?.header as string)?.localeCompare?.(b.columnDef.meta?.header as string);\n}\n\nexport type FiltersProps<TType = unknown> = {\n total: number;\n table: RTable<TType>;\n};\n\nexport function FiltersButton<TType = unknown>(props: FiltersProps<TType>) {\n const { total, table } = props;\n const { locale, texts } = useLocalization();\n const ref = React.useRef<HTMLButtonElement>(null);\n const isLargeScreen = useIsLargeScreen();\n const allColumns = table\n .getAllLeafColumns()\n .filter(column => !isInternalColumn(column.id))\n .sort(sortByHeader);\n const appliedFilters = table.getState().columnFilters;\n\n useGlobalKeyDown({ key: 'f', meta: true, shift: true }, (event: KeyboardEvent) => {\n event.preventDefault();\n ref.current?.click();\n });\n\n // state, since we \"apply\" filters\n const [filters, setFilters] = React.useState<Table3Filter[]>(table.getState().columnFilters as Table3Filter[]);\n const [placeholderCount, setPlaceholderCount] = React.useState(1);\n\n // filters\n const handleChangeFilter = (currentId: string | null, filter: { id: string | null; value: Table3FilterValue }) => {\n setFilters(currentFilters => {\n const nextFilters = [...currentFilters];\n const index = nextFilters.findIndex(f => f.id === currentId);\n nextFilters[index] = filter;\n return nextFilters;\n });\n };\n\n const handleRemoveFilter = (columnId: string | null) => {\n if (filters.length === 1 && placeholderCount === 0) {\n setPlaceholderCount(count => count + 1);\n }\n\n setFilters(currentFilters => currentFilters.filter(f => f.id !== columnId));\n };\n\n // placeholders\n const handleCreateFilterFromPlaceholder = (columnId: string) => {\n setFilters(currentFilters => [\n ...currentFilters,\n {\n id: columnId,\n value: {\n comparator: Table3FilterComparator.Contains,\n value: undefined,\n },\n },\n ]);\n handleRemovePlaceholder();\n };\n\n const handleCreatePlaceholder = () => {\n setPlaceholderCount(count => count + 1);\n };\n\n const handleRemovePlaceholder = () => {\n setPlaceholderCount(count => count - 1);\n };\n\n //\n const handleApply = () => {\n table.setColumnFilters(() => {\n const newFilters = filters.filter(f => {\n if (f.id === null) {\n return false;\n }\n\n const controlRenderer = (allColumns.find(c => c.id === f.id) as RTColumn<TType, unknown>)?.columnDef.meta\n ?.control;\n if (\n f.value.comparator === Table3FilterComparator.IsEmpty ||\n f.value.comparator === Table3FilterComparator.IsNotEmpty ||\n controlRenderer === 'switch'\n ) {\n return true;\n }\n return !!f.value.value;\n });\n // Compiler didn't get that we stripped out filters with null ids, so we still need to cast a ColumnFilter type here\n return newFilters as ColumnFilter[];\n });\n };\n\n const handleClear = () => {\n table.resetColumnFilters();\n setFilters([]);\n setPlaceholderCount(1);\n };\n\n const buttonProps = {\n 'aria-label': texts.table3.filters.tooltip,\n className: cn({ '!wcag-blue-100': appliedFilters.length }),\n popover: popoverProps => (\n <Popover {...popoverProps}>\n <Popover.Content>\n <div className=\"flex w-[40rem] flex-col gap-4\">\n <div className=\"flex h-8\">\n <div className=\"flex w-full items-center gap-2\">\n <h4 className=\"mb-0 inline-flex\">{texts.table3.filters.button}</h4>\n <p className=\"text-grey-700 mb-0 mr-auto mt-px inline-flex\">\n {texts.table3.filters.total\n .replace(\n '[CURRENT]',\n new Intl.NumberFormat(locale).format(table.getFilteredRowModel().rows.length)\n )\n .replace('[TOTAL]', new Intl.NumberFormat(locale).format(total))}\n </p>\n </div>\n </div>\n <div className=\"flex flex-col gap-2\">\n {filters.map((filter, index) => (\n <Filter\n key={`filter_${index}`}\n allColumns={allColumns as RTColumn<unknown, unknown>[]}\n filter={filter}\n filters={filters}\n position={index}\n onChange={handleChangeFilter}\n onRemove={handleRemoveFilter}\n />\n ))}\n {[...Array(placeholderCount)].map((_, index) => (\n <Placeholder\n key={`placeholder_${index}`}\n allColumns={allColumns as RTColumn<unknown, unknown>[]}\n filters={filters}\n position={filters.length + index}\n onCreate={handleCreateFilterFromPlaceholder as any}\n onRemove={placeholderCount > 1 || filters.length > 0 ? handleRemovePlaceholder : undefined}\n />\n ))}\n <div className=\"justify-start\">\n <Button appearance=\"discrete\" onClick={handleCreatePlaceholder}>\n + {texts.table3.filters.buttons.addFilter}\n </Button>\n </div>\n </div>\n <Group className=\"ml-auto\">\n <Popover.Close>\n <Button>Cancel</Button>\n </Popover.Close>\n <Button onClick={handleClear}>Clear</Button>\n <Button appearance=\"primary\" onClick={handleApply}>\n Apply\n </Button>\n </Group>\n </div>\n </Popover.Content>\n </Popover>\n ),\n ref,\n tooltip: (\n <>\n {texts.table3.filters.tooltip}\n <Shortcut className=\"ml-2\" keys={{ key: 'f', meta: true, shift: true }} />\n </>\n ),\n };\n\n if (!isLargeScreen && !appliedFilters.length) {\n return <IconButton {...buttonProps} icon=\"filter\" />;\n }\n return (\n <Button {...buttonProps}>\n <Icon className={cn({ '-mr-1.5': !isLargeScreen })} name={appliedFilters.length ? 'filter-solid' : 'filter'} />\n {isLargeScreen ? texts.table3.filters.button : ''}\n {appliedFilters.length ? `(${appliedFilters.length})` : ''}\n </Button>\n );\n}\n"],"names":["sortByHeader","a","b","_a$columnDef$meta","columnDef","meta","_a$columnDef$meta$hea","header","_a$columnDef$meta$hea2","localeCompare","call","_b$columnDef$meta","FiltersButton","props","total","table","locale","texts","useLocalization","ref","React","useRef","isLargeScreen","useIsLargeScreen","allColumns","getAllLeafColumns","filter","column","isInternalColumn","id","sort","appliedFilters","getState","columnFilters","useGlobalKeyDown","key","shift","event","preventDefault","_ref$current","current","click","filters","setFilters","useState","placeholderCount","setPlaceholderCount","handleChangeFilter","currentId","currentFilters","nextFilters","index","findIndex","f","handleRemoveFilter","columnId","length","count","handleCreateFilterFromPlaceholder","value","comparator","Table3FilterComparator","Contains","undefined","handleRemovePlaceholder","handleCreatePlaceholder","handleApply","setColumnFilters","newFilters","controlRenderer","_allColumns$find","find","c","_allColumns$find$colu","control","IsEmpty","IsNotEmpty","handleClear","resetColumnFilters","buttonProps","table3","tooltip","className","cn","popover","popoverProps","Popover","Content","button","replace","Intl","NumberFormat","format","getFilteredRowModel","rows","map","Filter","position","onChange","onRemove","Array","_","Placeholder","onCreate","Button","appearance","onClick","buttons","addFilter","Group","Close","Shortcut","keys","IconButton","icon","Icon","name"],"mappings":";;;;;;;;;;;;;;;;AAiBA,SAASA,YAAYA,CAAkBC,CAAkB,EAAEC,CAAkB;;EACzE,QAAAC,iBAAA,GAAQF,CAAC,CAACG,SAAS,CAACC,IAAI,cAAAF,iBAAA,wBAAAG,qBAAA,GAAhBH,iBAAA,CAAkBI,MAAiB,cAAAD,qBAAA,wBAAAE,sBAAA,GAAnCF,qBAAA,CAAqCG,aAAa,cAAAD,sBAAA,uBAAlDA,sBAAA,CAAAE,IAAA,CAAAJ,qBAAA,GAAAK,iBAAA,GAAqDT,CAAC,CAACE,SAAS,CAACC,IAAI,cAAAM,iBAAA,uBAAhBA,iBAAA,CAAkBJ,MAAgB,CAAC;AACpG;SAOgBK,aAAaA,CAAkBC,KAA0B;EACrE,MAAM;IAAEC,KAAK;IAAEC;GAAO,GAAGF,KAAK;EAC9B,MAAM;IAAEG,MAAM;IAAEC;GAAO,GAAG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C7B,SAAS,EAAC,MAAM;MAAC8B,IAAI,EAAE;QAAE7E,GAAG,EAAE,GAAG;QAAE9B,IAAI,EAAE,IAAI;QAAE+B,KAAK,EAAE;;MAAU;GAGrF;EAED,IAAI,CAACd,aAAa,IAAI,CAACS,cAAc,CAACyB,MAAM,EAAE;IAC1C,oBAAOpC,6BAAC6F,UAAU,oBAAKlC,WAAW;MAAEmC,IAAI,EAAC;OAAW;;EAExD,oBACI9F,6BAACoF,MAAM,oBAAKzB,WAAW,gBACnB3D,6BAAC+F,IAAI;IAACjC,SAAS,EAAEC,EAAE,CAAC;MAAE,SAAS,EAAE,CAAC7D;KAAe,CAAC;IAAE8F,IAAI,EAAErF,cAAc,CAACyB,MAAM,GAAG,cAAc,GAAG;IAAY,EAC9GlC,aAAa,GAAGL,KAAK,CAAC+D,MAAM,CAACtC,OAAO,CAAC8C,MAAM,GAAG,EAAE,EAChDzD,cAAc,CAACyB,MAAM,OAAOzB,cAAc,CAACyB,SAAS,GAAG,EAAE,CACrD;AAEjB;;;;"}
1
+ {"version":3,"file":"Filters.js","sources":["../../../../../../../../../../../src/components/Table3/components/toolbar/Filter/filters/Filters.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Table as RTable, Column as RTColumn } from '@tanstack/react-table';\nimport { Button } from '../../../../../Button/Button';\nimport { Icon } from '../../../../../Icon/Icon';\nimport { Popover } from '../../../../../Popover/Popover';\nimport { Table3FilterValue, Table3FilterComparator, Table3Filter, ColumnFilter } from '../../../../types';\nimport { Shortcut } from '../../../../../Shortcut/Shortcut';\nimport { useGlobalKeyDown } from '../../../../../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { isInternalColumn } from '../../../../util/columns';\nimport { Placeholder } from './components/Placeholder';\nimport { Filter } from './components/Filter';\nimport { Group } from '../../../../../Group/Group';\nimport { useIsLargeScreen } from '../../../../../../hooks/useIsLargeScreen';\nimport { IconButton } from '../../../../../IconButton/IconButton';\n\nfunction sortByHeader<TType = unknown>(a: RTColumn<TType>, b: RTColumn<TType>) {\n return (a.columnDef.meta?.header as string)?.localeCompare?.(b.columnDef.meta?.header as string);\n}\n\nexport type FiltersProps<TType = unknown> = {\n total: number;\n table: RTable<TType>;\n};\n\nexport function FiltersButton<TType = unknown>(props: FiltersProps<TType>) {\n const { total, table } = props;\n const { locale, texts } = useLocalization();\n const ref = React.useRef<HTMLButtonElement>(null);\n const isLargeScreen = useIsLargeScreen();\n const allColumns = table\n .getAllLeafColumns()\n .filter(column => !isInternalColumn(column.id))\n .sort(sortByHeader);\n const appliedFilters = table.getState().columnFilters as Table3Filter[];\n\n useGlobalKeyDown({ key: 'f', meta: true, shift: true }, (event: KeyboardEvent) => {\n event.preventDefault();\n ref.current?.click();\n });\n\n // state, since we \"apply\" filters\n const [filters, setFilters] = React.useState<Table3Filter[]>(appliedFilters);\n const [placeholderCount, setPlaceholderCount] = React.useState(1);\n\n // filters\n const handleChangeFilter = (currentId: string | null, filter: { id: string | null; value: Table3FilterValue }) => {\n setFilters(currentFilters => {\n const nextFilters = [...currentFilters];\n const index = nextFilters.findIndex(f => f.id === currentId);\n nextFilters[index] = filter;\n return nextFilters;\n });\n };\n\n const handleRemoveFilter = (columnId: string | null) => {\n if (filters.length === 1 && placeholderCount === 0) {\n setPlaceholderCount(count => count + 1);\n }\n\n setFilters(currentFilters => currentFilters.filter(f => f.id !== columnId));\n };\n\n // placeholders\n const handleCreateFilterFromPlaceholder = (columnId: string) => {\n setFilters(currentFilters => [\n ...currentFilters,\n {\n id: columnId,\n value: {\n comparator: Table3FilterComparator.Contains,\n value: undefined,\n },\n },\n ]);\n handleRemovePlaceholder();\n };\n\n const handleCreatePlaceholder = () => {\n setPlaceholderCount(count => count + 1);\n };\n\n const handleRemovePlaceholder = () => {\n setPlaceholderCount(count => count - 1);\n };\n\n //\n const handleApply = () => {\n table.setColumnFilters(() => {\n const newFilters = filters.filter(f => {\n if (f.id === null) {\n return false;\n }\n\n const controlRenderer = (allColumns.find(c => c.id === f.id) as RTColumn<TType, unknown>)?.columnDef.meta\n ?.control;\n if (\n f.value.comparator === Table3FilterComparator.IsEmpty ||\n f.value.comparator === Table3FilterComparator.IsNotEmpty ||\n controlRenderer === 'switch'\n ) {\n return true;\n }\n return !!f.value.value;\n });\n // Compiler didn't get that we stripped out filters with null ids, so we still need to cast a ColumnFilter type here\n return newFilters as ColumnFilter[];\n });\n };\n\n const handleClear = () => {\n table.resetColumnFilters();\n setFilters([]);\n setPlaceholderCount(1);\n };\n\n const handleClose = React.useCallback(\n (open: boolean) => {\n if (!open) {\n setFilters(appliedFilters);\n setPlaceholderCount(appliedFilters.length === 0 ? 1 : 0);\n }\n },\n [appliedFilters]\n );\n\n // Because filters can be reset from outside\n React.useEffect(() => {\n if (appliedFilters.length === 0) {\n setFilters([]);\n setPlaceholderCount(1);\n }\n }, [appliedFilters]);\n\n const buttonProps = {\n 'aria-label': texts.table3.filters.tooltip,\n className: cn({ '!wcag-blue-100': appliedFilters.length }),\n popover: popoverProps => (\n <Popover {...popoverProps} onChange={handleClose}>\n <Popover.Content>\n <div className=\"flex w-[40rem] flex-col gap-4\">\n <div className=\"flex h-8\">\n <div className=\"flex w-full items-center gap-2\">\n <h4 className=\"mb-0 inline-flex\">{texts.table3.filters.button}</h4>\n <p className=\"text-grey-700 mb-0 mr-auto mt-px inline-flex\">\n {texts.table3.filters.total\n .replace(\n '[CURRENT]',\n new Intl.NumberFormat(locale).format(table.getFilteredRowModel().rows.length)\n )\n .replace('[TOTAL]', new Intl.NumberFormat(locale).format(total))}\n </p>\n </div>\n </div>\n <div className=\"flex flex-col gap-2\">\n {filters.map((filter, index) => (\n <Filter\n key={`filter_${index}`}\n allColumns={allColumns as RTColumn<unknown, unknown>[]}\n filter={filter}\n filters={filters}\n position={index}\n onChange={handleChangeFilter}\n onRemove={handleRemoveFilter}\n />\n ))}\n {[...Array(placeholderCount)].map((_, index) => (\n <Placeholder\n key={`placeholder_${index}`}\n allColumns={allColumns as RTColumn<unknown, unknown>[]}\n filters={filters}\n position={filters.length + index}\n onCreate={handleCreateFilterFromPlaceholder as any}\n onRemove={placeholderCount > 1 || filters.length > 0 ? handleRemovePlaceholder : undefined}\n />\n ))}\n <div className=\"justify-start\">\n <Button appearance=\"discrete\" onClick={handleCreatePlaceholder}>\n + {texts.table3.filters.buttons.addFilter}\n </Button>\n </div>\n </div>\n <Group className=\"ml-auto\">\n <Popover.Close>\n <Button>Cancel</Button>\n </Popover.Close>\n <Button onClick={handleClear}>Clear</Button>\n <Button appearance=\"primary\" onClick={handleApply}>\n Apply\n </Button>\n </Group>\n </div>\n </Popover.Content>\n </Popover>\n ),\n ref,\n tooltip: (\n <>\n {texts.table3.filters.tooltip}\n <Shortcut className=\"ml-2\" keys={{ key: 'f', meta: true, shift: true }} />\n </>\n ),\n };\n\n if (!isLargeScreen && !appliedFilters.length) {\n return <IconButton {...buttonProps} icon=\"filter\" />;\n }\n return (\n <Button {...buttonProps}>\n <Icon className={cn({ '-mr-1.5': !isLargeScreen })} name={appliedFilters.length ? 'filter-solid' : 'filter'} />\n {isLargeScreen ? texts.table3.filters.button : ''}\n {appliedFilters.length ? `(${appliedFilters.length})` : ''}\n </Button>\n );\n}\n"],"names":["sortByHeader","a","b","_a$columnDef$meta","columnDef","meta","_a$columnDef$meta$hea","header","_a$columnDef$meta$hea2","localeCompare","call","_b$columnDef$meta","FiltersButton","props","total","table","locale","texts","useLocalization","ref","React","useRef","isLargeScreen","useIsLargeScreen","allColumns","getAllLeafColumns","filter","column","isInternalColumn","id","sort","appliedFilters","getState","columnFilters","useGlobalKeyDown","key","shift","event","preventDefault","_ref$current","current","click","filters","setFilters","useState","placeholderCount","setPlaceholderCount","handleChangeFilter","currentId","currentFilters","nextFilters","index","findIndex","f","handleRemoveFilter","columnId","length","count","handleCreateFilterFromPlaceholder","value","comparator","Table3FilterComparator","Contains","undefined","handleRemovePlaceholder","handleCreatePlaceholder","handleApply","setColumnFilters","newFilters","controlRenderer","_allColumns$find","find","c","_allColumns$find$colu","control","IsEmpty","IsNotEmpty","handleClear","resetColumnFilters","handleClose","useCallback","open","useEffect","buttonProps","table3","tooltip","className","cn","popover","popoverProps","Popover","onChange","Content","button","replace","Intl","NumberFormat","format","getFilteredRowModel","rows","map","Filter","position","onRemove","Array","_","Placeholder","onCreate","Button","appearance","onClick","buttons","addFilter","Group","Close","Shortcut","keys","IconButton","icon","Icon","name"],"mappings":";;;;;;;;;;;;;;;;AAiBA,SAASA,YAAYA,CAAkBC,CAAkB,EAAEC,CAAkB;;EACzE,QAAAC,iBAAA,GAAQF,CAAC,CAACG,SAAS,CAACC,IAAI,cAAAF,iBAAA,wBAAAG,qBAAA,GAAhBH,iBAAA,CAAkBI,MAAiB,cAAAD,qBAAA,wBAAAE,sBAAA,GAAnCF,qBAAA,CAAqCG,aAAa,cAAAD,sBAAA,uBAAlDA,sBAAA,CAAAE,IAAA,CAAAJ,qBAAA,GAAAK,iBAAA,GAAqDT,CAAC,CAACE,SAAS,CAACC,IAAI,cAAAM,iBAAA,uBAAhBA,iBAAA,CAAkBJ,MAAgB,CAAC;AACpG;SAOgBK,aAAaA,CAAkBC,KAA0B;EACrE,MAAM;IAAEC,KAAK;IAAEC;GAAO,GAAGF,KAAK;EAC9B,MAAM;IAAEG,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAC3C,MAAMC,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAoB,IAAI,CAAC;EACjD,MAAMC,aAAa,GAAGC,gBAAgB,EAAE;EACxC,MAAMC,UAAU,GAAGT,KAAK,CACnBU,iBAAiB,EAAE,CACnBC,MAAM,CAACC,MAAM,IAAI,CAACC,gBAAgB,CAACD,MAAM,CAACE,EAAE,CAAC,CAAC,CAC9CC,IAAI,CAAC9B,YAAY,CAAC;EACvB,MAAM+B,cAAc,GAAGhB,KAAK,CAACiB,QAAQ,EAAE,CAACC,aAA+B;EAEvEC,gBAAgB,CAAC;IAAEC,GAAG,EAAE,GAAG;IAAE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BjE,6BAAC+F,QAAQ;MAAC7B,SAAS,EAAC,MAAM;MAAC8B,IAAI,EAAE;QAAEjF,GAAG,EAAE,GAAG;QAAE9B,IAAI,EAAE,IAAI;QAAE+B,KAAK,EAAE;;MAAU,CAC3E;GAEV;EAED,IAAI,CAACd,aAAa,IAAI,CAACS,cAAc,CAACyB,MAAM,EAAE;IAC1C,oBAAOpC,6BAACiG,UAAU,oBAAKlC,WAAW;MAAEmC,IAAI,EAAC;OAAW;;EAExD,oBACIlG,6BAACwF,MAAM,oBAAKzB,WAAW,gBACnB/D,6BAACmG,IAAI;IAACjC,SAAS,EAAEC,EAAE,CAAC;MAAE,SAAS,EAAE,CAACjE;KAAe,CAAC;IAAEkG,IAAI,EAAEzF,cAAc,CAACyB,MAAM,GAAG,cAAc,GAAG;IAAY,EAC9GlC,aAAa,GAAGL,KAAK,CAACmE,MAAM,CAAC1C,OAAO,CAACmD,MAAM,GAAG,EAAE,EAChD9D,cAAc,CAACyB,MAAM,OAAOzB,cAAc,CAACyB,SAAS,GAAG,EAAE,CACrD;AAEjB;;;;"}
@@ -34,12 +34,12 @@ function FilterColumn(props) {
34
34
  return /*#__PURE__*/React__default.createElement(Select2.Option, {
35
35
  key: column.id,
36
36
  value: column.id,
37
- postfix: !column.getIsVisible() ? /*#__PURE__*/React__default.createElement(Tooltip, {
37
+ postfix: !column.getIsVisible() ? ( /*#__PURE__*/React__default.createElement(Tooltip, {
38
38
  title: texts.table3.filters.hiddenColumn
39
39
  }, /*#__PURE__*/React__default.createElement(Icon, {
40
40
  name: "eye-off",
41
41
  className: "text-grey-500 !h-5 !w-5"
42
- })) : undefined,
42
+ }))) : undefined,
43
43
  disabled: column.id !== value && (!column.getCanFilter() || !!filters.find(f => f.id === column.id))
44
44
  }, ((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.header) + (column.parent ? ` (${(_column$parent = column.parent) === null || _column$parent === void 0 ? void 0 : (_column$parent$column = _column$parent.columnDef.meta) === null || _column$parent$column === void 0 ? void 0 : _column$parent$column.header})` : ''));
45
45
  }))));
@@ -1 +1 @@
1
- {"version":3,"file":"FilterColumn.js","sources":["../../../../../../../../../../../../src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as RTColumn } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../../../Select2/Select2';\nimport { Icon } from '../../../../../../Icon/Icon';\nimport { Tooltip } from '../../../../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../../../../Provider/Localization';\nimport { Field } from '../../../../../../Field/Field';\nimport { Table3Filter } from '../../../../../types';\n\nexport type FilterColumnProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n allColumns: RTColumn<TType, unknown>[];\n filters: Table3Filter[];\n};\n\nexport function FilterColumn<TType = unknown>(props: FilterColumnProps<TType>) {\n const { allColumns, filters, onChange: handleChange, value = null, ...attributes } = props;\n const { texts } = useLocalization();\n const selectedColumn = allColumns.find(column => column.id === value);\n const warning = selectedColumn && !selectedColumn.getIsVisible();\n\n return (\n <div className=\"flex flex-col\">\n <Field\n message={warning ? texts.table3.filters.hiddenColumn : undefined}\n warning={warning}\n className=\"min-h-[theme(spacing.8)]\">\n <Select2 {...attributes} className=\"!w-32 flex-shrink-0\" emptyValue={null} onChange={handleChange} value={value}>\n {allColumns.map(column => (\n <Select2.Option\n key={column.id}\n value={column.id}\n postfix={\n !column.getIsVisible() ? (\n <Tooltip title={texts.table3.filters.hiddenColumn}>\n <Icon name=\"eye-off\" className=\"text-grey-500 !h-5 !w-5\" />\n </Tooltip>\n ) : undefined\n }\n disabled={column.id !== value && (!column.getCanFilter() || !!filters.find(f => f.id === column.id))}>\n {(column.columnDef.meta?.header as string) +\n (column.parent ? ` (${column.parent?.columnDef.meta?.header})` : '')}\n </Select2.Option>\n ))}\n </Select2>\n </Field>\n </div>\n );\n}\n"],"names":["FilterColumn","props","allColumns","filters","onChange","handleChange","value","attributes","texts","useLocalization","selectedColumn","find","column","id","warning","getIsVisible","React","className","Field","message","table3","hiddenColumn","undefined","Select2","emptyValue","map","_column$columnDef$met","_column$parent","_column$parent$column","Option","key","postfix","Tooltip","title","Icon","name","disabled","getCanFilter","f","columnDef","meta","header","parent"],"mappings":";;;;;;;SAcgBA,YAAYA,CAAkBC,KAA+B;EACzE,MAAM;IAAEC,UAAU;IAAEC,OAAO;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,KAAK,GAAG,IAAI;IAAE,GAAGC;GAAY,GAAGN,KAAK;EAC1F,MAAM;IAAEO;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,cAAc,GAAGR,UAAU,CAACS,IAAI,CAACC,MAAM,IAAIA,MAAM,CAACC,EAAE,KAAKP,KAAK,CAAC;EACrE,MAAMQ,OAAO,GAAGJ,cAAc,IAAI,CAACA,cAAc,CAACK,YAAY,EAAE;EAEhE,oBACIC;IAAKC,SAAS,EAAC;kBACXD,6BAACE,KAAK;IACFC,OAAO,EAAEL,OAAO,GAAGN,KAAK,CAACY,MAAM,CAACjB,OAAO,CAACkB,YAAY,GAAGC,SAAS;IAChER,OAAO,EAAEA,OAAO;IAChBG,SAAS,EAAC;kBACVD,6BAACO,OAAO,oBAAKhB,UAAU;IAAEU,SAAS,EAAC,qBAAqB;IAACO,UAAU,EAAE,IAAI;IAAEpB,QAAQ,EAAEC,YAAY;IAAEC,KAAK,EAAEA;MACrGJ,UAAU,CAACuB,GAAG,CAACb,MAAM;IAAA,IAAAc,qBAAA,EAAAC,cAAA,EAAAC,qBAAA;IAAA,oBAClBZ,6BAACO,OAAO,CAACM,MAAM;MACXC,GAAG,EAAElB,MAAM,CAACC,EAAE;MACdP,KAAK,EAAEM,MAAM,CAACC,EAAE;MAChBkB,OAAO,EACH,CAACnB,MAAM,CAACG,YAAY,EAAE,gBAClBC,6BAACgB,OAAO;QAACC,KAAK,EAAEzB,KAAK,CAACY,MAAM,CAACjB,OAAO,CAACkB;sBACjCL,6BAACkB,IAAI;QAACC,IAAI,EAAC,SAAS;QAAClB,SAAS,EAAC;QAA4B,CACrD,GACVK,SAAS;MAEjBc,QAAQ,EAAExB,MAAM,CAACC,EAAE,KAAKP,KAAK,KAAK,CAACM,MAAM,CAACyB,YAAY,EAAE,IAAI,CAAC,CAAClC,OAAO,CAACQ,IAAI,CAAC2B,CAAC,IAAIA,CAAC,CAACzB,EAAE,KAAKD,MAAM,CAACC,EAAE,CAAC;OACjG,EAAAa,qBAAA,GAAAd,MAAM,CAAC2B,SAAS,CAACC,IAAI,cAAAd,qBAAA,uBAArBA,qBAAA,CAAuBe,MAAiB,KACrC7B,MAAM,CAAC8B,MAAM,0BAAQ9B,MAAM,CAAC8B,MAAM,cAAAf,cAAA,wBAAAC,qBAAA,GAAbD,cAAA,CAAeY,SAAS,CAACC,IAAI,cAAAZ,qBAAA,uBAA7BA,qBAAA,CAA+Ba,SAAS,GAAG,EAAE,CAAC,CAC3D;GACpB,CAAC,CACI,CACN,CACN;AAEd;;;;"}
1
+ {"version":3,"file":"FilterColumn.js","sources":["../../../../../../../../../../../../src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as RTColumn } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../../../Select2/Select2';\nimport { Icon } from '../../../../../../Icon/Icon';\nimport { Tooltip } from '../../../../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../../../../Provider/Localization';\nimport { Field } from '../../../../../../Field/Field';\nimport { Table3Filter } from '../../../../../types';\n\nexport type FilterColumnProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n allColumns: RTColumn<TType, unknown>[];\n filters: Table3Filter[];\n};\n\nexport function FilterColumn<TType = unknown>(props: FilterColumnProps<TType>) {\n const { allColumns, filters, onChange: handleChange, value = null, ...attributes } = props;\n const { texts } = useLocalization();\n const selectedColumn = allColumns.find(column => column.id === value);\n const warning = selectedColumn && !selectedColumn.getIsVisible();\n\n return (\n <div className=\"flex flex-col\">\n <Field\n message={warning ? texts.table3.filters.hiddenColumn : undefined}\n warning={warning}\n className=\"min-h-[theme(spacing.8)]\">\n <Select2 {...attributes} className=\"!w-32 flex-shrink-0\" emptyValue={null} onChange={handleChange} value={value}>\n {allColumns.map(column => (\n <Select2.Option\n key={column.id}\n value={column.id}\n postfix={\n !column.getIsVisible() ? (\n <Tooltip title={texts.table3.filters.hiddenColumn}>\n <Icon name=\"eye-off\" className=\"text-grey-500 !h-5 !w-5\" />\n </Tooltip>\n ) : undefined\n }\n disabled={column.id !== value && (!column.getCanFilter() || !!filters.find(f => f.id === column.id))}>\n {(column.columnDef.meta?.header as string) +\n (column.parent ? ` (${column.parent?.columnDef.meta?.header})` : '')}\n </Select2.Option>\n ))}\n </Select2>\n </Field>\n </div>\n );\n}\n"],"names":["FilterColumn","props","allColumns","filters","onChange","handleChange","value","attributes","texts","useLocalization","selectedColumn","find","column","id","warning","getIsVisible","React","className","Field","message","table3","hiddenColumn","undefined","Select2","emptyValue","map","_column$columnDef$met","_column$parent","_column$parent$column","Option","key","postfix","Tooltip","title","Icon","name","disabled","getCanFilter","f","columnDef","meta","header","parent"],"mappings":";;;;;;;SAcgBA,YAAYA,CAAkBC,KAA+B;EACzE,MAAM;IAAEC,UAAU;IAAEC,OAAO;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,KAAK,GAAG,IAAI;IAAE,GAAGC;GAAY,GAAGN,KAAK;EAC1F,MAAM;IAAEO;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,cAAc,GAAGR,UAAU,CAACS,IAAI,CAACC,MAAM,IAAIA,MAAM,CAACC,EAAE,KAAKP,KAAK,CAAC;EACrE,MAAMQ,OAAO,GAAGJ,cAAc,IAAI,CAACA,cAAc,CAACK,YAAY,EAAE;EAEhE,oBACIC;IAAKC,SAAS,EAAC;kBACXD,6BAACE,KAAK;IACFC,OAAO,EAAEL,OAAO,GAAGN,KAAK,CAACY,MAAM,CAACjB,OAAO,CAACkB,Y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Change: handleChange,
26
26
  value: value
27
- }), validComparators.map(comparator => /*#__PURE__*/React__default.createElement(Select2.Option, {
27
+ }), validComparators.map(comparator => ( /*#__PURE__*/React__default.createElement(Select2.Option, {
28
28
  key: comparator,
29
29
  value: comparator
30
- }, getComparatorText(comparator, texts, column))));
30
+ }, getComparatorText(comparator, texts, column)))));
31
31
  }
32
32
  function guessComparatorsBasedOnControl(column) {
33
33
  var _column$columnDef$met;
@@ -1 +1 @@
1
- {"version":3,"file":"FilterComparator.js","sources":["../../../../../../../../../../../../src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as RTColumn, ColumnMeta } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../../../Select2/Select2';\nimport { Table3FilterComparator } from '../../../../../types';\nimport { LocalizationTexts, useLocalization } from '../../../../../../Provider/Localization';\n\nexport type FilterComparatorProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n column?: RTColumn<TType, unknown>;\n};\n\nexport function FilterComparator<TType = unknown>(props: FilterComparatorProps<TType>) {\n const { column, onChange: handleChange, value, ...attributes } = props;\n const { texts } = useLocalization();\n\n const validComparators = guessComparatorsBasedOnControl(column);\n\n React.useEffect(() => {\n if (value === undefined || !validComparators.includes(value as number)) {\n handleChange?.(validComparators[0]);\n }\n }, [validComparators]);\n\n return (\n <Select2 {...attributes} className=\"!w-32 flex-shrink-0\" disabled={!column} onChange={handleChange} value={value}>\n {validComparators.map(comparator => (\n <Select2.Option key={comparator} value={comparator}>\n {getComparatorText(comparator, texts, column)}\n </Select2.Option>\n ))}\n </Select2>\n );\n}\n\nfunction guessComparatorsBasedOnControl<TType = unknown>(column?: RTColumn<TType, unknown>) {\n const columnMeta = (column?.columnDef.meta ?? {}) as ColumnMeta<TType, unknown>;\n\n if (Array.isArray(columnMeta.filters)) {\n return columnMeta.filters;\n }\n\n if (typeof columnMeta.control === 'function') {\n const renderedControl = columnMeta.control({\n onBlur: () => undefined,\n onFocus: () => undefined,\n setValue: () => undefined,\n value: undefined,\n disabled: false,\n readOnly: false,\n ref: undefined as any,\n });\n\n if (React.isValidElement(renderedControl)) {\n const { props, type } = renderedControl as any;\n\n if (type.displayName === 'Select2') {\n if (props.multiple) {\n return [\n Table3FilterComparator.HasAnyOf,\n Table3FilterComparator.HasAllOf,\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.HasNoneOf,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n ];\n }\n\n return [\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.IsNotEqualTo,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n ];\n }\n }\n }\n\n if (columnMeta.dataType === 'number') {\n return [\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.IsNotEqualTo,\n Table3FilterComparator.IsGreaterThan,\n Table3FilterComparator.IsLessThan,\n Table3FilterComparator.IsBetween,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n ];\n }\n\n if (columnMeta.control === 'datepicker' || columnMeta.dataType === 'datetime') {\n return [\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.IsNotEqualTo,\n Table3FilterComparator.IsBetween,\n Table3FilterComparator.IsLessThan,\n Table3FilterComparator.IsGreaterThan,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n Table3FilterComparator.IsLessThanOrEqualTo,\n Table3FilterComparator.IsGreaterThanOrEqualTo,\n ];\n }\n\n if (columnMeta.control === 'switch') {\n return [Table3FilterComparator.IsEqualTo];\n }\n\n return [\n Table3FilterComparator.Contains,\n Table3FilterComparator.DoesNotContain,\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.IsNotEqualTo,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n ];\n}\n\nfunction getComparatorText<TType = unknown>(\n comparator: Table3FilterComparator,\n texts: LocalizationTexts,\n column?: RTColumn<TType, unknown>\n) {\n const isDate = column?.columnDef?.meta?.control === 'datepicker';\n\n switch (comparator) {\n case Table3FilterComparator.Contains:\n return texts.table3.filters.comparators.contains;\n\n case Table3FilterComparator.DoesNotContain:\n return texts.table3.filters.comparators.doesNotContain;\n\n case Table3FilterComparator.IsEqualTo:\n return texts.table3.filters.comparators.isEqualTo;\n\n case Table3FilterComparator.IsNotEqualTo:\n return texts.table3.filters.comparators.isNotEqualTo;\n\n case Table3FilterComparator.IsGreaterThan:\n return isDate ? texts.table3.filters.comparators.isAfter : texts.table3.filters.comparators.isGreaterThan;\n\n case Table3FilterComparator.IsLessThan:\n return isDate ? texts.table3.filters.comparators.isBefore : texts.table3.filters.comparators.isLessThan;\n\n case Table3FilterComparator.IsBetween:\n return texts.table3.filters.comparators.isBetween;\n\n case Table3FilterComparator.IsEmpty:\n return texts.table3.filters.comparators.isEmpty;\n\n case Table3FilterComparator.IsNotEmpty:\n return texts.table3.filters.comparators.isNotEmpty;\n\n case Table3FilterComparator.IsLessThanOrEqualTo:\n return isDate ? texts.table3.filters.comparators.isOnOrBefore : texts.table3.filters.comparators.isLessThanOrEqualTo;\n\n case Table3FilterComparator.IsGreaterThanOrEqualTo:\n return isDate\n ? texts.table3.filters.comparators.isOnOrAfter\n : texts.table3.filters.comparators.isGreaterThanOrEqualTo;\n\n case Table3FilterComparator.HasAnyOf:\n return texts.table3.filters.comparators.hasAnyOf;\n\n case Table3FilterComparator.HasAllOf:\n return texts.table3.filters.comparators.hasAllOf;\n\n case Table3FilterComparator.HasNoneOf:\n return texts.table3.filters.comparators.hasNoneOf;\n\n default:\n return '';\n }\n}\n"],"names":["FilterComparator","props","column","onChange","handleChange","value","attributes","texts","useLocalization","validComparators","guessComparatorsBasedOnControl","React","useEffect","undefined","includes","Select2","className","disabled","map","comparator","Option","key","getComparatorText","columnMeta","_column$columnDef$met","columnDef","meta","Array","isArray","filters","control","renderedControl","onBlur","onFocus","setValue","readOnly","ref","isValidElement","type","displayName","multiple","Table3FilterComparator","HasAnyOf","HasAllOf","IsEqualTo","HasNoneOf","IsEmpty","IsNotEmpty","IsNotEqualTo","dataType","IsGreaterThan","IsLessThan","IsBetween","IsLessThanOrEqualTo","IsGreaterThanOrEqualTo","Contains","DoesNotContain","isDate","_column$columnDef","_column$columnDef$met2","table3","comparators","contains","doesNotContain","isEqualTo","isNotEqualTo","isAfter","isGreaterThan","isBefore","isLessThan","isBetween","isEmpty","isNotEmpty","isOnOrBefore","isLessThanOrEqualTo","isOnOrAfter","isGreaterThanOrEqualTo","hasAnyOf","hasAllOf","hasNoneOf"],"mappings":";;;;;SAUgBA,gBAAgBA,CAAkBC,KAAmC;EACjF,MAAM;IAAEC,MAAM;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGL,KAAK;EACtE,MAAM;IAAEM;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,gBAAgB,GAAGC,8BAA8B,CAACR,MAAM,CAAC;EAE/DS,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIP,KAAK,KAAKQ,SAAS,IAAI,CAACJ,gBAAgB,CAACK,QAAQ,CAACT,KAAe,CAAC,EAAE;MACpED,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAGK,gBAAgB,CAAC,CAAC,CAAC,CAAC;;GAE1C,EAAE,CAACA,gBAAgB,CAAC,CAAC;EAEtB,oBACIE,6BAACI,OAAO,oBAAKT,UAAU;IAAEU,SAAS,EAAC,qBAAqB;IAACC,QAAQ,EAAE,CAACf,MAAM;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,KAAK,EAAEA;MACtGI,gBAAgB,CAACS,GAAG,CAACC,UAAU,iBAC5BR,6BAACI,OAAO,CAACK,MAAM;IAACC,GAAG,EAAEF,UAAU;IAAEd,KAAK,EAAEc;KACnCG,iBAAiB,CAACH,UAAU,EAAEZ,KAAK,EAAEL,MAAM,CAAC,CAEpD,CAAC,CACI;AAElB;AAEA,SAASQ,8BAA8BA,CAAkBR,MAA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,sBAAsB,CAACa,sBAAsB;MAC9C,OAAOG,MAAM,GACPlD,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACc,WAAW,GAC5CpE,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACe,sBAAsB;IAEjE,KAAKnC,sBAAsB,CAACC,QAAQ;MAChC,OAAOnC,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACgB,QAAQ;IAEpD,KAAKpC,sBAAsB,CAACE,QAAQ;MAChC,OAAOpC,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACiB,QAAQ;IAEpD,KAAKrC,sBAAsB,CAACI,SAAS;MACjC,OAAOtC,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACkB,SAAS;IAErD;MACI,OAAO,EAAE;;AAErB;;;;"}
1
+ {"version":3,"file":"FilterComparator.js","sources":["../../../../../../../../../../../../src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as RTColumn, ColumnMeta } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../../../Select2/Select2';\nimport { Table3FilterComparator } from '../../../../../types';\nimport { LocalizationTexts, useLocalization } from '../../../../../../Provider/Localization';\n\nexport type FilterComparatorProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n column?: RTColumn<TType, unknown>;\n};\n\nexport function FilterComparator<TType = unknown>(props: FilterComparatorProps<TType>) {\n const { column, onChange: handleChange, value, ...attributes } = props;\n const { texts } = useLocalization();\n\n const validComparators = guessComparatorsBasedOnControl(column);\n\n React.useEffect(() => {\n if (value === undefined || !validComparators.includes(value as number)) {\n handleChange?.(validComparators[0]);\n }\n }, [validComparators]);\n\n return (\n <Select2 {...attributes} className=\"!w-32 flex-shrink-0\" disabled={!column} onChange={handleChange} value={value}>\n {validComparators.map(comparator => (\n <Select2.Option key={comparator} value={comparator}>\n {getComparatorText(comparator, texts, column)}\n </Select2.Option>\n ))}\n </Select2>\n );\n}\n\nfunction guessComparatorsBasedOnControl<TType = unknown>(column?: RTColumn<TType, unknown>) {\n const columnMeta = (column?.columnDef.meta ?? {}) as ColumnMeta<TType, unknown>;\n\n if (Array.isArray(columnMeta.filters)) {\n return columnMeta.filters;\n }\n\n if (typeof columnMeta.control === 'function') {\n const renderedControl = columnMeta.control({\n onBlur: () => undefined,\n onFocus: () => undefined,\n setValue: () => undefined,\n value: undefined,\n disabled: false,\n readOnly: false,\n ref: undefined as any,\n });\n\n if (React.isValidElement(renderedControl)) {\n const { props, type } = renderedControl as any;\n\n if (type.displayName === 'Select2') {\n if (props.multiple) {\n return [\n Table3FilterComparator.HasAnyOf,\n Table3FilterComparator.HasAllOf,\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.HasNoneOf,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n ];\n }\n\n return [\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.IsNotEqualTo,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n ];\n }\n }\n }\n\n if (columnMeta.dataType === 'number') {\n return [\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.IsNotEqualTo,\n Table3FilterComparator.IsGreaterThan,\n Table3FilterComparator.IsLessThan,\n Table3FilterComparator.IsBetween,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n ];\n }\n\n if (columnMeta.control === 'datepicker' || columnMeta.dataType === 'datetime') {\n return [\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.IsNotEqualTo,\n Table3FilterComparator.IsBetween,\n Table3FilterComparator.IsLessThan,\n Table3FilterComparator.IsGreaterThan,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n Table3FilterComparator.IsLessThanOrEqualTo,\n Table3FilterComparator.IsGreaterThanOrEqualTo,\n ];\n }\n\n if (columnMeta.control === 'switch') {\n return [Table3FilterComparator.IsEqualTo];\n }\n\n return [\n Table3FilterComparator.Contains,\n Table3FilterComparator.DoesNotContain,\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.IsNotEqualTo,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n ];\n}\n\nfunction getComparatorText<TType = unknown>(\n comparator: Table3FilterComparator,\n texts: LocalizationTexts,\n column?: RTColumn<TType, unknown>\n) {\n const isDate = column?.columnDef?.meta?.control === 'datepicker';\n\n switch (comparator) {\n case Table3FilterComparator.Contains:\n return texts.table3.filters.comparators.contains;\n\n case Table3FilterComparator.DoesNotContain:\n return texts.table3.filters.comparators.doesNotContain;\n\n case Table3FilterComparator.IsEqualTo:\n return texts.table3.filters.comparators.isEqualTo;\n\n case Table3FilterComparator.IsNotEqualTo:\n return texts.table3.filters.comparators.isNotEqualTo;\n\n case Table3FilterComparator.IsGreaterThan:\n return isDate ? texts.table3.filters.comparators.isAfter : texts.table3.filters.comparators.isGreaterThan;\n\n case Table3FilterComparator.IsLessThan:\n return isDate ? texts.table3.filters.comparators.isBefore : texts.table3.filters.comparators.isLessThan;\n\n case Table3FilterComparator.IsBetween:\n return texts.table3.filters.comparators.isBetween;\n\n case Table3FilterComparator.IsEmpty:\n return texts.table3.filters.comparators.isEmpty;\n\n case Table3FilterComparator.IsNotEmpty:\n return texts.table3.filters.comparators.isNotEmpty;\n\n case Table3FilterComparator.IsLessThanOrEqualTo:\n return isDate ? texts.table3.filters.comparators.isOnOrBefore : texts.table3.filters.comparators.isLessThanOrEqualTo;\n\n case Table3FilterComparator.IsGreaterThanOrEqualTo:\n return isDate\n ? texts.table3.filters.comparators.isOnOrAfter\n : texts.table3.filters.comparators.isGreaterThanOrEqualTo;\n\n case Table3FilterComparator.HasAnyOf:\n return texts.table3.filters.comparators.hasAnyOf;\n\n case Table3FilterComparator.HasAllOf:\n return texts.table3.filters.comparators.hasAllOf;\n\n case Table3FilterComparator.HasNoneOf:\n return texts.table3.filters.comparators.hasNoneOf;\n\n default:\n return '';\n }\n}\n"],"names":["FilterComparator","props","column","onChange","handleChange","value","attributes","texts","useLocalization","validComparators","guessComparatorsBasedOnControl","React","useEffect","undefined","includes","Select2","className","disabled","map","comparator","Option","key","getComparatorText","columnMeta","_column$columnDef$met","columnDef","meta","Array","isArray","filters","control","renderedControl","onBlur","onFocus","setValue","readOnly","ref","isValidElement","type","displayName","multiple","Table3FilterComparator","HasAnyOf","HasAllOf","IsEqualTo","HasNoneOf","IsEmpty","IsNotEmpty","IsNotEqualTo","dataType","IsGreaterThan","IsLessThan","IsBetween","IsLessThanOrEqualTo","IsGreaterThanOrEqualTo","Contains","DoesNotContain","isDate","_column$columnDef","_column$columnDef$met2","table3","comparators","contains","doesNotContain","isEqualTo","isNotEqualTo","isAfter","isGreaterThan","isBefore","isLessThan","isBetween","isEmpty","isNotEmpty","isOnOrBefore","isLessThanOrEqualTo","isOnOrAfter","isGreaterThanOrEqualTo","hasAnyOf","hasAllOf","hasNoneOf"],"mappings":";;;;;SAUgBA,gBAAgBA,CAAkBC,KAAmC;EACjF,MAAM;IAAEC,MAAM;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGL,KAAK;EACtE,MAAM;IAAEM;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,gBAAgB,GAAGC,8BAA8B,CAACR,MAAM,CAAC;EAE/DS,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIP,KAAK,KAAKQ,SAAS,IAAI,CAACJ,gBAAgB,CAACK,QAAQ,CAACT,KAAe,CAAC,EAAE;MACpED,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAGK,gBAAgB,CAAC,CAAC,CAAC,CAAC;;GAE1C,EAAE,CAACA,gBAAgB,CAAC,CAAC;EAEtB,oBACIE,6BAACI,OAAO,oBAAKT,UAAU;IAAEU,SAAS,EAAC,qBAAqB;IAACC,QAAQ,EAAE,CAACf,MAAM;IAAEC,QAAQ,EAAE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AOxC,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACW,UAAU;IAEtD,KAAK/B,sBAAsB,CAACY,mBAAmB;MAC3C,OAAOI,MAAM,GAAGlD,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACY,YAAY,GAAGlE,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACa,mBAAmB;IAExH,KAAKjC,sBAAsB,CAACa,sBAAsB;MAC9C,OAAOG,MAAM,GACPlD,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACc,WAAW,GAC5CpE,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACe,sBAAsB;IAEjE,KAAKnC,sBAAsB,CAACC,QAAQ;MAChC,OAAOnC,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACgB,QAAQ;IAEpD,KAAKpC,sBAAsB,CAACE,QAAQ;MAChC,OAAOpC,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACiB,QAAQ;IAEpD,KAAKrC,sBAAsB,CAACI,SAAS;MACjC,OAAOtC,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACkB,SAAS;IAErD;MACI,OAAO,EAAE;;AAErB;;;;"}
@@ -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;GAA8B,GAAGL,SAAS,CAACM,QAAQ;;;EAI3D,MAAMC,YAAY,MAAMrB,UAAU,CAACsB,UAAU;EAC7C,MAAMC,uBAAuB,GAAGT,SAAS,CAACU,MAAM,CAACD,uBAAuB;EAExE,MAAME,eAAe,GAAGlB,cAAK,CAACmB,OAAO,CACjC,OAAO;IACHC,mBAAmB,EAAEb,SAAS,CAACc,cAAc,CAACC,iBAAiB;IAC/DC,WAAW,EAAEb,KAAK,CAACa,WAAW;IAC9BC,YAAY,EAAEd,KAAK,CAACc,YAAY;IAChCC,gBAAgB,EAAEf,KAAK,CAACe,gBAAgB;IACxCC,+BAA+B,EAAEV,uBAAuB;IACxDW,QAAQ,EAAEpB,SAAS,CAACoB,QAAQ,CAACC,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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,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;GAAkC,GAAGL,SAAS,CAACM,QAAQ;;;EAI/D,MAAMC,YAAY,MAAMrB,UAAU,CAACsB,UAAU;EAC7C,MAAMC,uBAAuB,GAAGT,SAAS,CAACU,MAAM,CAACD,uBAAuB;EAExE,MAAME,eAAe,GAAGlB,cAAK,CAACmB,OAAO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