@economic/taco 2.21.3 → 2.22.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (232) hide show
  1. package/dist/components/Report/Report.d.ts +21 -0
  2. package/dist/components/Report/components/Cell/Cell.d.ts +0 -1
  3. package/dist/components/Report/components/Cell/DisplayCell.d.ts +1 -1
  4. package/dist/components/Report/components/Cell/util.d.ts +1 -1
  5. package/dist/components/Report/components/Row/DisplayRow.d.ts +2 -9
  6. package/dist/components/Report/components/Toolbar/components/Filters/components/Placeholder.d.ts +5 -5
  7. package/dist/components/Report/listeners/useTableRowActiveListener.d.ts +3 -0
  8. package/dist/components/Report/styles/util.d.ts +2 -2
  9. package/dist/components/Report/types.d.ts +1 -3
  10. package/dist/components/Report/useReport.d.ts +2 -7
  11. package/dist/components/Table3/types.d.ts +1 -1
  12. package/dist/esm/index.css +501 -9
  13. package/dist/esm/packages/taco/src/components/Card/Card.js +1 -1
  14. package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Group/Group.js +1 -1
  16. package/dist/esm/packages/taco/src/components/Group/Group.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Input/Input.js +37 -7
  18. package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
  19. package/dist/esm/packages/taco/src/components/Input/util.js +3 -1
  20. package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
  21. package/dist/esm/packages/taco/src/components/Report/Report.js +70 -0
  22. package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -0
  23. package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js +61 -0
  24. package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js.map +1 -0
  25. package/dist/esm/packages/taco/src/components/Report/components/Body/util.js +22 -0
  26. package/dist/esm/packages/taco/src/components/Report/components/Body/util.js.map +1 -0
  27. package/dist/esm/packages/taco/src/components/Report/components/Cell/Cell.js +32 -0
  28. package/dist/esm/packages/taco/src/components/Report/components/Cell/Cell.js.map +1 -0
  29. package/dist/esm/packages/taco/src/components/Report/components/Cell/DisplayCell.js +23 -0
  30. package/dist/esm/packages/taco/src/components/Report/components/Cell/DisplayCell.js.map +1 -0
  31. package/dist/esm/packages/taco/src/components/Report/components/Cell/GroupedCell.js +58 -0
  32. package/dist/esm/packages/taco/src/components/Report/components/Cell/GroupedCell.js.map +1 -0
  33. package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js +69 -0
  34. package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js.map +1 -0
  35. package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js +34 -0
  36. package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js.map +1 -0
  37. package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js +39 -0
  38. package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js.map +1 -0
  39. package/dist/esm/packages/taco/src/components/Report/components/Header/Header.js +194 -0
  40. package/dist/esm/packages/taco/src/components/Report/components/Header/Header.js.map +1 -0
  41. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Goto.js +28 -0
  42. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Goto.js.map +1 -0
  43. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Menu.js +150 -0
  44. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Menu.js.map +1 -0
  45. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Resizer.js +60 -0
  46. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Resizer.js.map +1 -0
  47. package/dist/esm/packages/taco/src/components/Report/components/Header/components/SortIndicator.js +41 -0
  48. package/dist/esm/packages/taco/src/components/Report/components/Header/components/SortIndicator.js.map +1 -0
  49. package/dist/esm/packages/taco/src/components/Report/components/Header/util.js +24 -0
  50. package/dist/esm/packages/taco/src/components/Report/components/Header/util.js.map +1 -0
  51. package/dist/esm/packages/taco/src/components/Report/components/Internal/Actions.js +90 -0
  52. package/dist/esm/packages/taco/src/components/Report/components/Internal/Actions.js.map +1 -0
  53. package/dist/esm/packages/taco/src/components/Report/components/Internal/Expansion.js +59 -0
  54. package/dist/esm/packages/taco/src/components/Report/components/Internal/Expansion.js.map +1 -0
  55. package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js +118 -0
  56. package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js.map +1 -0
  57. package/dist/esm/packages/taco/src/components/Report/components/Row/DisplayRow.js +102 -0
  58. package/dist/esm/packages/taco/src/components/Report/components/Row/DisplayRow.js.map +1 -0
  59. package/dist/esm/packages/taco/src/components/Report/components/Row/Row.js +24 -0
  60. package/dist/esm/packages/taco/src/components/Report/components/Row/Row.js.map +1 -0
  61. package/dist/esm/packages/taco/src/components/Report/components/Row/RowContext.js +10 -0
  62. package/dist/esm/packages/taco/src/components/Report/components/Row/RowContext.js.map +1 -0
  63. package/dist/esm/packages/taco/src/components/Report/components/Row/SkeletonRow.js +62 -0
  64. package/dist/esm/packages/taco/src/components/Report/components/Row/SkeletonRow.js.map +1 -0
  65. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/Toolbar.js +63 -0
  66. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/Toolbar.js.map +1 -0
  67. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/Filters.js +50 -0
  68. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/Filters.js.map +1 -0
  69. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js +136 -0
  70. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -0
  71. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js +95 -0
  72. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js.map +1 -0
  73. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js +49 -0
  74. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -0
  75. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterComparator.js +110 -0
  76. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterComparator.js.map +1 -0
  77. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterValue.js +118 -0
  78. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -0
  79. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js +41 -0
  80. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js.map +1 -0
  81. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/util.js +7 -0
  82. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/util.js.map +1 -0
  83. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js +123 -0
  84. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js.map +1 -0
  85. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/PrintDialog.js +88 -0
  86. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/PrintDialog.js.map +1 -0
  87. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Search/Search.js +95 -0
  88. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Search/Search.js.map +1 -0
  89. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/HideOrOrderPopover.js +105 -0
  90. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/HideOrOrderPopover.js.map +1 -0
  91. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/Settings.js +103 -0
  92. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/Settings.js.map +1 -0
  93. package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js +24 -0
  94. package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js.map +1 -0
  95. package/dist/esm/packages/taco/src/components/Report/styles/useColumnPinningStylesheet.js +44 -0
  96. package/dist/esm/packages/taco/src/components/Report/styles/useColumnPinningStylesheet.js.map +1 -0
  97. package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js +54 -0
  98. package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js.map +1 -0
  99. package/dist/esm/packages/taco/src/components/Report/styles/useStylesheet.js +20 -0
  100. package/dist/esm/packages/taco/src/components/Report/styles/useStylesheet.js.map +1 -0
  101. package/dist/esm/packages/taco/src/components/Report/styles/util.js +61 -0
  102. package/dist/esm/packages/taco/src/components/Report/styles/util.js.map +1 -0
  103. package/dist/esm/packages/taco/src/components/Report/useReport.js +51 -0
  104. package/dist/esm/packages/taco/src/components/Report/useReport.js.map +1 -0
  105. package/dist/esm/packages/taco/src/components/Report/util/rows.js +10 -0
  106. package/dist/esm/packages/taco/src/components/Report/util/rows.js.map +1 -0
  107. package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js +39 -0
  108. package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js.map +1 -0
  109. package/dist/esm/packages/taco/src/components/Report/util/useTableRenderer.js +162 -0
  110. package/dist/esm/packages/taco/src/components/Report/util/useTableRenderer.js.map +1 -0
  111. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js +3 -2
  112. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
  113. package/dist/esm/packages/taco/src/components/Select2/Select2.js +2 -2
  114. package/dist/esm/packages/taco/src/components/Select2/components/Create.js +1 -1
  115. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +1 -1
  116. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +1 -1
  117. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +6 -7
  118. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  119. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +1 -1
  120. package/dist/esm/packages/taco/src/components/Table3/Table3.js +7 -2
  121. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  122. package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js +6 -6
  123. package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js.map +1 -1
  124. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +7 -1
  125. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
  126. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +2 -0
  127. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
  128. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +6 -1
  129. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  130. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +1 -0
  131. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
  132. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +3 -1
  133. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
  134. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Summary.js +1 -0
  135. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Summary.js.map +1 -1
  136. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +9 -1
  137. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
  138. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +1 -0
  139. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
  140. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +2 -0
  141. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
  142. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +3 -3
  143. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +4 -8
  144. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
  145. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +1 -0
  146. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js.map +1 -1
  147. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +19 -14
  148. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
  149. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +6 -5
  150. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
  151. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +18 -1
  152. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
  153. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnFreezing.js +8 -14
  154. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnFreezing.js.map +1 -1
  155. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js +1 -1
  156. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js +1 -1
  157. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +5 -1
  158. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
  159. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +15 -15
  160. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  161. package/dist/esm/packages/taco/src/components/Table3/hooks/useTablePreset.js +20 -0
  162. package/dist/esm/packages/taco/src/components/Table3/hooks/useTablePreset.js.map +1 -1
  163. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  164. package/dist/esm/packages/taco/src/components/Table3/util/columns.js +2 -0
  165. package/dist/esm/packages/taco/src/components/Table3/util/columns.js.map +1 -1
  166. package/dist/esm/packages/taco/src/components/Textarea/Textarea.js +1 -1
  167. package/dist/esm/packages/taco/src/components/Textarea/Textarea.js.map +1 -1
  168. package/dist/esm/packages/taco/src/hooks/useBoundaryOverflowDetection.js +1 -1
  169. package/dist/esm/packages/taco/src/index.js +7 -6
  170. package/dist/esm/packages/taco/src/index.js.map +1 -1
  171. package/dist/esm/packages/taco/src/primitives/Button.js +2 -1
  172. package/dist/esm/packages/taco/src/primitives/Button.js.map +1 -1
  173. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  174. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnFreezing.js +21 -0
  175. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnFreezing.js.map +1 -0
  176. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFooter.js +8 -0
  177. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFooter.js.map +1 -0
  178. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js +16 -0
  179. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +1 -0
  180. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRef.js +17 -0
  181. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRef.js.map +1 -0
  182. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActions.js +11 -0
  183. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActions.js.map +1 -0
  184. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowExpansion.js +9 -0
  185. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowExpansion.js.map +1 -0
  186. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGroups.js +9 -0
  187. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGroups.js.map +1 -0
  188. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSearch.js +38 -0
  189. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSearch.js.map +1 -0
  190. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js +28 -0
  191. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js.map +1 -0
  192. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowHeightListener.js +14 -0
  193. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowHeightListener.js.map +1 -0
  194. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSearchListener.js +15 -0
  195. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSearchListener.js.map +1 -0
  196. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js +26 -0
  197. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js.map +1 -0
  198. package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js +117 -0
  199. package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js.map +1 -0
  200. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js +30 -3
  201. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -1
  202. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/filtering.js +131 -0
  203. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/filtering.js.map +1 -0
  204. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/presets.js +131 -0
  205. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/presets.js.map +1 -0
  206. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/search.js +43 -0
  207. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/search.js.map +1 -0
  208. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/settings.js +22 -0
  209. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/settings.js.map +1 -0
  210. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/setup.js +270 -0
  211. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/setup.js.map +1 -0
  212. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/sorting.js +18 -0
  213. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/sorting.js.map +1 -0
  214. package/dist/esm/packages/taco/src/utils/dom.js +5 -1
  215. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  216. package/dist/esm/packages/taco/src/utils/keyboard.js +3 -5
  217. package/dist/esm/packages/taco/src/utils/keyboard.js.map +1 -1
  218. package/dist/index.css +501 -9
  219. package/dist/index.d.ts +1 -0
  220. package/dist/primitives/Table/types.d.ts +2 -2
  221. package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +1 -1
  222. package/dist/primitives/Table/useTable/util/settings.d.ts +1 -1
  223. package/dist/primitives/Table/useTable/util/sorting.d.ts +1 -1
  224. package/dist/taco.cjs.development.js +6381 -2732
  225. package/dist/taco.cjs.development.js.map +1 -1
  226. package/dist/taco.cjs.production.min.js +1 -1
  227. package/dist/taco.cjs.production.min.js.map +1 -1
  228. package/dist/utils/dom.d.ts +1 -0
  229. package/dist/utils/keyboard.d.ts +0 -1
  230. package/package.json +2 -2
  231. package/types.json +6050 -4979
  232. package/dist/components/Report/features/useReportExport.d.ts +0 -3
@@ -0,0 +1,110 @@
1
+ import React__default from 'react';
2
+ import { useLocalization } from '../../../../../../Provider/Localization.js';
3
+ import { TableFilterComparator } from '../../../../../../../primitives/Table/types.js';
4
+ import { Select2 } from '../../../../../../Select2/Select2.js';
5
+
6
+ function FilterComparator(props) {
7
+ const {
8
+ column,
9
+ onChange: handleChange,
10
+ value,
11
+ ...attributes
12
+ } = props;
13
+ const {
14
+ texts
15
+ } = useLocalization();
16
+ const validComparators = guessComparatorsBasedOnControl(column);
17
+ React__default.useEffect(() => {
18
+ if (value === undefined || !validComparators.includes(value)) {
19
+ handleChange === null || handleChange === void 0 ? void 0 : handleChange(validComparators[0]);
20
+ }
21
+ }, [validComparators]);
22
+ return /*#__PURE__*/React__default.createElement(Select2, Object.assign({}, attributes, {
23
+ className: "!w-32 flex-shrink-0",
24
+ disabled: !column,
25
+ onChange: handleChange,
26
+ value: value
27
+ }), validComparators.map(comparator => ( /*#__PURE__*/React__default.createElement(Select2.Option, {
28
+ key: comparator,
29
+ value: comparator
30
+ }, getComparatorText(comparator, texts, column)))));
31
+ }
32
+ function guessComparatorsBasedOnControl(column) {
33
+ var _column$columnDef$met;
34
+ const columnMeta = (_column$columnDef$met = column === null || column === void 0 ? void 0 : column.columnDef.meta) !== null && _column$columnDef$met !== void 0 ? _column$columnDef$met : {};
35
+ if (Array.isArray(columnMeta.filters)) {
36
+ return columnMeta.filters;
37
+ }
38
+ if (typeof columnMeta.control === 'function') {
39
+ const renderedControl = columnMeta.control({
40
+ onBlur: () => undefined,
41
+ onFocus: () => undefined,
42
+ setValue: () => undefined,
43
+ value: undefined,
44
+ disabled: false,
45
+ readOnly: false,
46
+ ref: undefined
47
+ });
48
+ if ( /*#__PURE__*/React__default.isValidElement(renderedControl)) {
49
+ const {
50
+ props,
51
+ type
52
+ } = renderedControl;
53
+ if (type.displayName === 'Select2') {
54
+ if (props.multiple) {
55
+ return [TableFilterComparator.HasAnyOf, TableFilterComparator.HasAllOf, TableFilterComparator.IsEqualTo, TableFilterComparator.HasNoneOf, TableFilterComparator.IsEmpty, TableFilterComparator.IsNotEmpty];
56
+ }
57
+ return [TableFilterComparator.IsEqualTo, TableFilterComparator.IsNotEqualTo, TableFilterComparator.IsEmpty, TableFilterComparator.IsNotEmpty];
58
+ }
59
+ }
60
+ }
61
+ if (columnMeta.dataType === 'number') {
62
+ return [TableFilterComparator.IsEqualTo, TableFilterComparator.IsNotEqualTo, TableFilterComparator.IsGreaterThan, TableFilterComparator.IsLessThan, TableFilterComparator.IsBetween, TableFilterComparator.IsEmpty, TableFilterComparator.IsNotEmpty];
63
+ }
64
+ if (columnMeta.control === 'datepicker' || columnMeta.dataType === 'datetime') {
65
+ return [TableFilterComparator.IsEqualTo, TableFilterComparator.IsNotEqualTo, TableFilterComparator.IsBetween, TableFilterComparator.IsLessThan, TableFilterComparator.IsGreaterThan, TableFilterComparator.IsEmpty, TableFilterComparator.IsNotEmpty, TableFilterComparator.IsLessThanOrEqualTo, TableFilterComparator.IsGreaterThanOrEqualTo];
66
+ }
67
+ if (columnMeta.control === 'switch') {
68
+ return [TableFilterComparator.IsEqualTo];
69
+ }
70
+ return [TableFilterComparator.Contains, TableFilterComparator.DoesNotContain, TableFilterComparator.IsEqualTo, TableFilterComparator.IsNotEqualTo, TableFilterComparator.IsEmpty, TableFilterComparator.IsNotEmpty];
71
+ }
72
+ function getComparatorText(comparator, texts, column) {
73
+ var _column$columnDef, _column$columnDef$met2;
74
+ const isDate = (column === null || column === void 0 ? void 0 : (_column$columnDef = column.columnDef) === null || _column$columnDef === void 0 ? void 0 : (_column$columnDef$met2 = _column$columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.control) === 'datepicker';
75
+ switch (comparator) {
76
+ case TableFilterComparator.Contains:
77
+ return texts.table3.filters.comparators.contains;
78
+ case TableFilterComparator.DoesNotContain:
79
+ return texts.table3.filters.comparators.doesNotContain;
80
+ case TableFilterComparator.IsEqualTo:
81
+ return texts.table3.filters.comparators.isEqualTo;
82
+ case TableFilterComparator.IsNotEqualTo:
83
+ return texts.table3.filters.comparators.isNotEqualTo;
84
+ case TableFilterComparator.IsGreaterThan:
85
+ return isDate ? texts.table3.filters.comparators.isAfter : texts.table3.filters.comparators.isGreaterThan;
86
+ case TableFilterComparator.IsLessThan:
87
+ return isDate ? texts.table3.filters.comparators.isBefore : texts.table3.filters.comparators.isLessThan;
88
+ case TableFilterComparator.IsBetween:
89
+ return texts.table3.filters.comparators.isBetween;
90
+ case TableFilterComparator.IsEmpty:
91
+ return texts.table3.filters.comparators.isEmpty;
92
+ case TableFilterComparator.IsNotEmpty:
93
+ return texts.table3.filters.comparators.isNotEmpty;
94
+ case TableFilterComparator.IsLessThanOrEqualTo:
95
+ return isDate ? texts.table3.filters.comparators.isOnOrBefore : texts.table3.filters.comparators.isLessThanOrEqualTo;
96
+ case TableFilterComparator.IsGreaterThanOrEqualTo:
97
+ return isDate ? texts.table3.filters.comparators.isOnOrAfter : texts.table3.filters.comparators.isGreaterThanOrEqualTo;
98
+ case TableFilterComparator.HasAnyOf:
99
+ return texts.table3.filters.comparators.hasAnyOf;
100
+ case TableFilterComparator.HasAllOf:
101
+ return texts.table3.filters.comparators.hasAllOf;
102
+ case TableFilterComparator.HasNoneOf:
103
+ return texts.table3.filters.comparators.hasNoneOf;
104
+ default:
105
+ return '';
106
+ }
107
+ }
108
+
109
+ export { FilterComparator };
110
+ //# sourceMappingURL=FilterComparator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterComparator.js","sources":["../../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/components/FilterComparator.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as ReactTableColumn, ColumnMeta as ReactTableColumnMeta } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../../../Select2/Select2';\nimport { LocalizationTexts, useLocalization } from '../../../../../../Provider/Localization';\nimport { TableFilterComparator } from '../../../../../../../primitives/Table/types';\n\nexport type FilterComparatorProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n column?: ReactTableColumn<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?: ReactTableColumn<TType>): TableFilterComparator[] {\n const columnMeta = (column?.columnDef.meta ?? {}) as ReactTableColumnMeta<TType, unknown>;\n\n if (Array.isArray(columnMeta.filters)) {\n return (columnMeta as any).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 TableFilterComparator.HasAnyOf,\n TableFilterComparator.HasAllOf,\n TableFilterComparator.IsEqualTo,\n TableFilterComparator.HasNoneOf,\n TableFilterComparator.IsEmpty,\n TableFilterComparator.IsNotEmpty,\n ];\n }\n\n return [\n TableFilterComparator.IsEqualTo,\n TableFilterComparator.IsNotEqualTo,\n TableFilterComparator.IsEmpty,\n TableFilterComparator.IsNotEmpty,\n ];\n }\n }\n }\n\n if (columnMeta.dataType === 'number') {\n return [\n TableFilterComparator.IsEqualTo,\n TableFilterComparator.IsNotEqualTo,\n TableFilterComparator.IsGreaterThan,\n TableFilterComparator.IsLessThan,\n TableFilterComparator.IsBetween,\n TableFilterComparator.IsEmpty,\n TableFilterComparator.IsNotEmpty,\n ];\n }\n\n if (columnMeta.control === 'datepicker' || columnMeta.dataType === 'datetime') {\n return [\n TableFilterComparator.IsEqualTo,\n TableFilterComparator.IsNotEqualTo,\n TableFilterComparator.IsBetween,\n TableFilterComparator.IsLessThan,\n TableFilterComparator.IsGreaterThan,\n TableFilterComparator.IsEmpty,\n TableFilterComparator.IsNotEmpty,\n TableFilterComparator.IsLessThanOrEqualTo,\n TableFilterComparator.IsGreaterThanOrEqualTo,\n ];\n }\n\n if (columnMeta.control === 'switch') {\n return [TableFilterComparator.IsEqualTo];\n }\n\n return [\n TableFilterComparator.Contains,\n TableFilterComparator.DoesNotContain,\n TableFilterComparator.IsEqualTo,\n TableFilterComparator.IsNotEqualTo,\n TableFilterComparator.IsEmpty,\n TableFilterComparator.IsNotEmpty,\n ];\n}\n\nfunction getComparatorText<TType = unknown>(\n comparator: TableFilterComparator,\n texts: LocalizationTexts,\n column?: ReactTableColumn<TType, unknown>\n) {\n const isDate = column?.columnDef?.meta?.control === 'datepicker';\n\n switch (comparator) {\n case TableFilterComparator.Contains:\n return texts.table3.filters.comparators.contains;\n\n case TableFilterComparator.DoesNotContain:\n return texts.table3.filters.comparators.doesNotContain;\n\n case TableFilterComparator.IsEqualTo:\n return texts.table3.filters.comparators.isEqualTo;\n\n case TableFilterComparator.IsNotEqualTo:\n return texts.table3.filters.comparators.isNotEqualTo;\n\n case TableFilterComparator.IsGreaterThan:\n return isDate ? texts.table3.filters.comparators.isAfter : texts.table3.filters.comparators.isGreaterThan;\n\n case TableFilterComparator.IsLessThan:\n return isDate ? texts.table3.filters.comparators.isBefore : texts.table3.filters.comparators.isLessThan;\n\n case TableFilterComparator.IsBetween:\n return texts.table3.filters.comparators.isBetween;\n\n case TableFilterComparator.IsEmpty:\n return texts.table3.filters.comparators.isEmpty;\n\n case TableFilterComparator.IsNotEmpty:\n return texts.table3.filters.comparators.isNotEmpty;\n\n case TableFilterComparator.IsLessThanOrEqualTo:\n return isDate ? texts.table3.filters.comparators.isOnOrBefore : texts.table3.filters.comparators.isLessThanOrEqualTo;\n\n case TableFilterComparator.IsGreaterThanOrEqualTo:\n return isDate\n ? texts.table3.filters.comparators.isOnOrAfter\n : texts.table3.filters.comparators.isGreaterThanOrEqualTo;\n\n case TableFilterComparator.HasAnyOf:\n return texts.table3.filters.comparators.hasAnyOf;\n\n case TableFilterComparator.HasAllOf:\n return texts.table3.filters.comparators.hasAllOf;\n\n case TableFilterComparator.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","TableFilterComparator","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,gBA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AAC/B,OAAO,CAACgC,WAAW,CAACW,UAAU;IAEtD,KAAK/B,qBAAqB,CAACY,mBAAmB;MAC1C,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,qBAAqB,CAACa,sBAAsB;MAC7C,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,qBAAqB,CAACC,QAAQ;MAC/B,OAAOnC,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACgB,QAAQ;IAEpD,KAAKpC,qBAAqB,CAACE,QAAQ;MAC/B,OAAOpC,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACiB,QAAQ;IAEpD,KAAKrC,qBAAqB,CAACI,SAAS;MAChC,OAAOtC,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACkB,SAAS;IAErD;MACI,OAAO,EAAE;;AAErB;;;;"}
@@ -0,0 +1,118 @@
1
+ import React__default, { useEffect } from 'react';
2
+ import { useLocalization } from '../../../../../../Provider/Localization.js';
3
+ import { Input } from '../../../../../../Input/Input.js';
4
+ import { Datepicker } from '../../../../../../Datepicker/Datepicker.js';
5
+ import { TableFilterComparator } from '../../../../../../../primitives/Table/types.js';
6
+ import { Switch } from '../../../../../../Switch/Switch.js';
7
+
8
+ function FilterValue(props) {
9
+ const {
10
+ column,
11
+ comparator,
12
+ onChange: handleChange,
13
+ value
14
+ } = props;
15
+ const {
16
+ texts
17
+ } = useLocalization();
18
+ if (comparator === TableFilterComparator.IsEmpty || comparator === TableFilterComparator.IsNotEmpty) {
19
+ return null;
20
+ }
21
+ if (comparator === TableFilterComparator.IsBetween) {
22
+ var _column$columnDef$met;
23
+ const fromValue = Array.isArray(value) ? value[0] : undefined;
24
+ const toValue = Array.isArray(value) ? value[1] : undefined;
25
+ if (column === undefined) {
26
+ return /*#__PURE__*/React__default.createElement(Input, {
27
+ "aria-label": texts.table3.filters.emptyFilter.value,
28
+ className: "flex-grow",
29
+ disabled: true,
30
+ value: texts.table3.filters.emptyFilter.value
31
+ });
32
+ }
33
+ if (((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.dataType) === 'datetime') {
34
+ return /*#__PURE__*/React__default.createElement("div", {
35
+ className: "flex flex-grow items-center gap-2"
36
+ }, /*#__PURE__*/React__default.createElement(Control, {
37
+ column: column,
38
+ onChange: value => handleChange([value, toValue]),
39
+ value: fromValue
40
+ }), /*#__PURE__*/React__default.createElement(Control, {
41
+ column: column,
42
+ onChange: value => handleChange([fromValue, value]),
43
+ value: toValue
44
+ }));
45
+ }
46
+ return /*#__PURE__*/React__default.createElement("div", {
47
+ className: "flex flex-grow items-center gap-2"
48
+ }, /*#__PURE__*/React__default.createElement(Control, {
49
+ column: column,
50
+ onChange: value => handleChange([isNaN(value) ? undefined : value, toValue]),
51
+ placeholder: "from",
52
+ value: fromValue !== null && fromValue !== void 0 ? fromValue : ''
53
+ }), /*#__PURE__*/React__default.createElement(Control, {
54
+ column: column,
55
+ onChange: value => handleChange([fromValue, isNaN(value) ? undefined : value]),
56
+ placeholder: "to",
57
+ value: toValue !== null && toValue !== void 0 ? toValue : ''
58
+ }));
59
+ }
60
+ return /*#__PURE__*/React__default.createElement(Control, {
61
+ comparator: comparator,
62
+ column: column,
63
+ onChange: handleChange,
64
+ value: value
65
+ });
66
+ }
67
+ function Control(props) {
68
+ var _column$columnDef$met2, _column$columnDef$met3;
69
+ const {
70
+ column,
71
+ comparator,
72
+ onChange,
73
+ value,
74
+ ...attributes
75
+ } = props;
76
+ const controlRenderer = column === null || column === void 0 ? void 0 : (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.control;
77
+ const dataType = column === null || column === void 0 ? void 0 : (_column$columnDef$met3 = column.columnDef.meta) === null || _column$columnDef$met3 === void 0 ? void 0 : _column$columnDef$met3.dataType;
78
+ useEffect(() => {
79
+ if (controlRenderer === 'switch') {
80
+ onChange(false);
81
+ }
82
+ }, []);
83
+ if (typeof controlRenderer === 'function') {
84
+ return controlRenderer({
85
+ ...attributes,
86
+ setValue: value => onChange(value),
87
+ value
88
+ });
89
+ } else if (controlRenderer === 'datepicker' || dataType === 'datetime') {
90
+ return /*#__PURE__*/React__default.createElement(Datepicker, Object.assign({}, attributes, {
91
+ onChange: event => onChange(event.detail),
92
+ value: value
93
+ }));
94
+ } else if (controlRenderer === 'switch') {
95
+ return /*#__PURE__*/React__default.createElement(Switch, Object.assign({}, attributes, {
96
+ className: "m-1.5",
97
+ checked: Boolean(value),
98
+ onChange: onChange
99
+ }));
100
+ } else if ((controlRenderer === 'input' || controlRenderer === undefined) && dataType === 'number') {
101
+ return /*#__PURE__*/React__default.createElement(Input, Object.assign({}, attributes, {
102
+ className: "flex-grow",
103
+ type: "number",
104
+ onChange: event => onChange(event.target.valueAsNumber),
105
+ value: String(value !== null && value !== void 0 ? value : '')
106
+ }));
107
+ }
108
+ return /*#__PURE__*/React__default.createElement(Input, Object.assign({
109
+ disabled: !column
110
+ }, attributes, {
111
+ className: "flex-grow",
112
+ onChange: event => onChange(event.target.value),
113
+ value: String(value !== null && value !== void 0 ? value : '')
114
+ }));
115
+ }
116
+
117
+ export { FilterValue };
118
+ //# sourceMappingURL=FilterValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterValue.js","sources":["../../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/components/FilterValue.tsx"],"sourcesContent":["import React, { useEffect } from 'react';\nimport { Column as ReactTableColumn } from '@tanstack/react-table';\nimport { Input } from '../../../../../../Input/Input';\nimport { Datepicker } from '../../../../../../Datepicker/Datepicker';\nimport { Switch } from '../../../../../../Switch/Switch';\nimport { useLocalization } from '../../../../../../Provider/Localization';\nimport { TableFilterComparator } from '../../../../../../../primitives/Table/types';\n\nexport type FilterValueProps<TType = unknown> = {\n column?: ReactTableColumn<TType, unknown>;\n comparator: TableFilterComparator;\n onChange: (value: any) => void;\n value: any;\n};\n\nexport function FilterValue<TType = unknown>(props: FilterValueProps<TType>) {\n const { column, comparator, onChange: handleChange, value } = props;\n const { texts } = useLocalization();\n\n if (comparator === TableFilterComparator.IsEmpty || comparator === TableFilterComparator.IsNotEmpty) {\n return null;\n }\n\n if (comparator === TableFilterComparator.IsBetween) {\n const fromValue = Array.isArray(value) ? value[0] : undefined;\n const toValue = Array.isArray(value) ? value[1] : undefined;\n\n if (column === undefined) {\n return (\n <Input\n aria-label={texts.table3.filters.emptyFilter.value}\n className=\"flex-grow\"\n disabled\n value={texts.table3.filters.emptyFilter.value}\n />\n );\n }\n\n if (column.columnDef.meta?.dataType === 'datetime') {\n return (\n <div className=\"flex flex-grow items-center gap-2\">\n <Control column={column} onChange={value => handleChange([value, toValue])} value={fromValue} />\n <Control column={column} onChange={value => handleChange([fromValue, value])} value={toValue} />\n </div>\n );\n }\n\n return (\n <div className=\"flex flex-grow items-center gap-2\">\n <Control\n column={column}\n onChange={value => handleChange([isNaN(value) ? undefined : value, toValue])}\n placeholder=\"from\"\n value={fromValue ?? ''}\n />\n <Control\n column={column}\n onChange={value => handleChange([fromValue, isNaN(value) ? undefined : value])}\n placeholder=\"to\"\n value={toValue ?? ''}\n />\n </div>\n );\n }\n return <Control comparator={comparator} column={column} onChange={handleChange} value={value} />;\n}\n\nfunction Control(props) {\n const { column, comparator, onChange, value, ...attributes } = props;\n const controlRenderer = column?.columnDef.meta?.control;\n const dataType = column?.columnDef.meta?.dataType;\n\n useEffect(() => {\n if (controlRenderer === 'switch') {\n onChange(false);\n }\n }, []);\n\n if (typeof controlRenderer === 'function') {\n return controlRenderer({\n ...attributes,\n setValue: value => onChange(value),\n value,\n });\n } else if (controlRenderer === 'datepicker' || dataType === 'datetime') {\n return <Datepicker {...attributes} onChange={event => onChange((event as any).detail)} value={value as Date} />;\n } else if (controlRenderer === 'switch') {\n return <Switch {...attributes} className=\"m-1.5\" checked={Boolean(value)} onChange={onChange} />;\n } else if ((controlRenderer === 'input' || controlRenderer === undefined) && dataType === 'number') {\n return (\n <Input\n {...attributes}\n className=\"flex-grow\"\n type=\"number\"\n onChange={event => onChange(event.target.valueAsNumber)}\n value={String(value ?? '')}\n />\n );\n }\n\n return (\n <Input\n disabled={!column}\n {...attributes}\n className=\"flex-grow\"\n onChange={event => onChange(event.target.value)}\n value={String(value ?? '')}\n />\n );\n}\n"],"names":["FilterValue","props","column","comparator","onChange","handleChange","value","texts","useLocalization","TableFilterComparator","IsEmpty","IsNotEmpty","IsBetween","_column$columnDef$met","fromValue","Array","isArray","undefined","toValue","React","Input","table3","filters","emptyFilter","className","disabled","columnDef","meta","dataType","Control","isNaN","placeholder","attributes","controlRenderer","_column$columnDef$met2","control","_column$columnDef$met3","useEffect","setValue","Datepicker","event","detail","Switch","checked","Boolean","type","target","valueAsNumber","String"],"mappings":";;;;;;;SAegBA,WAAWA,CAAkBC,KAA8B;EACvE,MAAM;IAAEC,MAAM;IAAEC,UAAU;IAAEC,QAAQ,EAAEC,YAAY;IAAEC;GAAO,GAAGL,KAAK;EACnE,MAAM;IAAEM;GAAO,GAAGC,eAAe,EAAE;EAEnC,IAAIL,UAAU,KAAKM,qBAAqB,CAACC,OAAO,IAAIP,UAAU,KAAKM,qBAAqB,CAACE,UAAU,EAAE;IACjG,OAAO,IAAI;;EAGf,IAAIR,UAAU,KAAKM,qBAAqB,CAACG,SAAS,EAAE;IAAA,IAAAC,qBAAA;IAChD,MAAMC,SAAS,GAAGC,KAAK,CAACC,OAAO,CAACV,KAAK,CAAC,GAAGA,KAAK,CAAC,CAAC,CAAC,GAAGW,SAAS;IAC7D,MAAM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AAEnC,KAAK,EAAEA;OAAiB;GAClH,MAAM,IAAI2B,eAAe,KAAK,QAAQ,EAAE;IACrC,oBAAOd,6BAACuB,MAAM,oBAAKV,UAAU;MAAER,SAAS,EAAC,OAAO;MAACmB,OAAO,EAAEC,OAAO,CAACtC,KAAK,CAAC;MAAEF,QAAQ,EAAEA;OAAY;GACnG,MAAM,IAAI,CAAC6B,eAAe,KAAK,OAAO,IAAIA,eAAe,KAAKhB,SAAS,KAAKW,QAAQ,KAAK,QAAQ,EAAE;IAChG,oBACIT,6BAACC,KAAK,oBACEY,UAAU;MACdR,SAAS,EAAC,WAAW;MACrBqB,IAAI,EAAC,QAAQ;MACbzC,QAAQ,EAAEoC,KAAK,IAAIpC,QAAQ,CAACoC,KAAK,CAACM,MAAM,CAACC,aAAa,CAAC;MACvDzC,KAAK,EAAE0C,MAAM,CAAC1C,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE;OAC3B;;EAIV,oBACIa,6BAACC,KAAK;IACFK,QAAQ,EAAE,CAACvB;KACP8B,UAAU;IACdR,SAAS,EAAC,WAAW;IACrBpB,QAAQ,EAAEoC,KAAK,IAAIpC,QAAQ,CAACoC,KAAK,CAACM,MAAM,CAACxC,KAAK,CAAC;IAC/CA,KAAK,EAAE0C,MAAM,CAAC1C,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,EAAE;KAC3B;AAEV;;;;"}
@@ -0,0 +1,41 @@
1
+ import React__default from 'react';
2
+ import { IconButton } from '../../../../../../IconButton/IconButton.js';
3
+ import { useLocalization } from '../../../../../../Provider/Localization.js';
4
+ import { Input } from '../../../../../../Input/Input.js';
5
+ import { FilterColumn } from './FilterColumn.js';
6
+ import { FilterComparator } from './FilterComparator.js';
7
+
8
+ function Placeholder(props) {
9
+ const {
10
+ allColumns,
11
+ filters,
12
+ onCreate: handleCreate,
13
+ onRemove: handleRemove,
14
+ position
15
+ } = props;
16
+ const {
17
+ texts
18
+ } = useLocalization();
19
+ return /*#__PURE__*/React__default.createElement("div", {
20
+ className: "flex items-start gap-2"
21
+ }, /*#__PURE__*/React__default.createElement("div", {
22
+ className: "flex min-h-[theme(spacing.8)] w-14 flex-shrink-0 items-center justify-end pr-2 text-right"
23
+ }, position > 0 ? texts.table3.filters.conditions.and : texts.table3.filters.conditions.where), /*#__PURE__*/React__default.createElement(FilterColumn, {
24
+ allColumns: allColumns,
25
+ filters: filters,
26
+ onChange: handleCreate,
27
+ value: null
28
+ }), /*#__PURE__*/React__default.createElement(FilterComparator, null), /*#__PURE__*/React__default.createElement(Input, {
29
+ "aria-label": texts.table3.filters.emptyFilter.value,
30
+ className: "flex-grow",
31
+ disabled: true,
32
+ value: texts.table3.filters.emptyFilter.value
33
+ }), handleRemove ? /*#__PURE__*/React__default.createElement(IconButton, {
34
+ appearance: "discrete",
35
+ icon: "close",
36
+ onClick: handleRemove
37
+ }) : null);
38
+ }
39
+
40
+ export { Placeholder };
41
+ //# sourceMappingURL=Placeholder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Placeholder.js","sources":["../../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/components/Placeholder.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as ReactTableColumn } from '@tanstack/react-table';\nimport { Select2Value } from '../../../../../../Select2/Select2';\nimport { useLocalization } from '../../../../../../Provider/Localization';\nimport { Input } from '../../../../../../Input/Input';\nimport { IconButton } from '../../../../../../IconButton/IconButton';\nimport { FilterColumn } from './FilterColumn';\nimport { FilterComparator } from './FilterComparator';\nimport { TableFilter } from '../../../../../types';\n\nexport type PlaceholderFilterProps<TType = unknown> = {\n allColumns: ReactTableColumn<TType, unknown>[];\n filters: TableFilter[];\n onCreate?: (value: Select2Value) => void;\n onRemove?: () => void;\n position: number;\n};\n\nexport function Placeholder<TType = unknown>(props: PlaceholderFilterProps<TType>) {\n const { allColumns, filters, onCreate: handleCreate, onRemove: handleRemove, position } = props;\n const { texts } = useLocalization();\n\n return (\n <div className=\"flex items-start gap-2\">\n <div className=\"flex min-h-[theme(spacing.8)] w-14 flex-shrink-0 items-center justify-end pr-2 text-right\">\n {position > 0 ? texts.table3.filters.conditions.and : texts.table3.filters.conditions.where}\n </div>\n <FilterColumn allColumns={allColumns} filters={filters} onChange={handleCreate} value={null} />\n <FilterComparator />\n <Input\n aria-label={texts.table3.filters.emptyFilter.value}\n className=\"flex-grow\"\n disabled\n value={texts.table3.filters.emptyFilter.value}\n />\n {handleRemove ? <IconButton appearance=\"discrete\" icon=\"close\" onClick={handleRemove} /> : null}\n </div>\n );\n}\n"],"names":["Placeholder","props","allColumns","filters","onCreate","handleCreate","onRemove","handleRemove","position","texts","useLocalization","React","className","table3","conditions","and","where","FilterColumn","onChange","value","FilterComparator","Input","emptyFilter","disabled","IconButton","appearance","icon","onClick"],"mappings":";;;;;;;SAkBgBA,WAAWA,CAAkBC,KAAoC;EAC7E,MAAM;IAAEC,UAAU;IAAEC,OAAO;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,QAAQ,EAAEC,YAAY;IAAEC;GAAU,GAAGP,KAAK;EAC/F,MAAM;IAAEQ;GAAO,GAAGC,eAAe,EAAE;EAEnC,oBACIC;IAAKC,SAAS,EAAC;kBACXD;IAAKC,SAAS,EAAC;KACVJ,QAAQ,GAAG,CAAC,GAAGC,KAAK,CAACI,MAAM,CAACV,OAAO,CAACW,UAAU,CAACC,GAAG,GAAGN,KAAK,CAACI,MAAM,CAACV,OAAO,CAACW,UAAU,CAACE,KAAK,CACzF,eACNL,6BAACM,YAAY;IAACf,UAAU,EAAEA,UAAU;IAAEC,OAAO,EAAEA,OAAO;IAAEe,QAAQ,EAAEb,YAAY;IAAEc,KAAK,EAAE;IAAQ,eAC/FR,6BAACS,gBAAgB,OAAG,eACpBT,6BAACU,KAAK;kBACUZ,KAAK,CAACI,MAAM,CAACV,OAAO,CAACmB,WAAW,CAACH,KAAK;IAClDP,SAAS,EAAC,WAAW;IACrBW,QAAQ;IACRJ,KAAK,EAAEV,KAAK,CAACI,MAAM,CAACV,OAAO,CAACmB,WAAW,CAACH;IAC1C,EACDZ,YAAY,gBAAGI,6BAACa,UAAU;IAACC,UAAU,EAAC,UAAU;IAACC,IAAI,EAAC,OAAO;IAACC,OAAO,EAAEpB;IAAgB,GAAG,IAAI,CAC7F;AAEd;;;;"}
@@ -0,0 +1,7 @@
1
+ function sortByHeader(a, b) {
2
+ var _a$columnDef$meta, _a$columnDef$meta$hea, _a$columnDef$meta$hea2, _b$columnDef$meta;
3
+ return (_a$columnDef$meta = a.columnDef.meta) === null || _a$columnDef$meta === void 0 ? void 0 : (_a$columnDef$meta$hea = _a$columnDef$meta.header) === null || _a$columnDef$meta$hea === void 0 ? void 0 : (_a$columnDef$meta$hea2 = _a$columnDef$meta$hea.localeCompare) === null || _a$columnDef$meta$hea2 === void 0 ? void 0 : _a$columnDef$meta$hea2.call(_a$columnDef$meta$hea, (_b$columnDef$meta = b.columnDef.meta) === null || _b$columnDef$meta === void 0 ? void 0 : _b$columnDef$meta.header);
4
+ }
5
+
6
+ export { sortByHeader };
7
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sources":["../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/util.ts"],"sourcesContent":["import { Column as ReactTableColumn } from '@tanstack/react-table';\n\nexport function sortByHeader<TType = unknown>(a: ReactTableColumn<TType>, b: ReactTableColumn<TType>) {\n return (a.columnDef.meta?.header as string)?.localeCompare?.(b.columnDef.meta?.header as string);\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"],"mappings":"SAEgBA,YAAYA,CAAkBC,CAA0B,EAAEC,CAA0B;;EAChG,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;;;;"}
@@ -0,0 +1,123 @@
1
+ import React__default from 'react';
2
+ import { IconButton } from '../../../../../IconButton/IconButton.js';
3
+ import { useLocalization } from '../../../../../Provider/Localization.js';
4
+ import { Shortcut } from '../../../../../Shortcut/Shortcut.js';
5
+ import { useToast } from '../../../../../Toast/Toaster.js';
6
+ import { _catch } from '../../../../../../../../../node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js';
7
+ import { PrintDialog } from './PrintDialog.js';
8
+
9
+ function Print(props) {
10
+ const {
11
+ table,
12
+ tableId,
13
+ tableRef
14
+ } = props;
15
+ const {
16
+ texts
17
+ } = useLocalization();
18
+ const ref = React__default.useRef(null);
19
+ const lastScrollTopRef = React__default.useRef();
20
+ const toast = useToast();
21
+ const tableMeta = table.options.meta;
22
+ const togglePrinting = React__default.useCallback(enabled => {
23
+ tableMeta.printing.setIsPrinting(enabled);
24
+ if (tableRef.current) {
25
+ if (enabled) {
26
+ lastScrollTopRef.current = tableRef.current.scrollTop;
27
+ } else if (lastScrollTopRef.current !== undefined) {
28
+ tableRef.current.scrollTop = lastScrollTopRef.current;
29
+ lastScrollTopRef.current = undefined;
30
+ }
31
+ }
32
+ }, [tableRef.current]);
33
+ React__default.useEffect(() => {
34
+ const afterPrint = () => {
35
+ togglePrinting(false);
36
+ };
37
+ window.addEventListener('afterprint', afterPrint);
38
+ return () => {
39
+ window.removeEventListener('afterprint', afterPrint);
40
+ };
41
+ }, []);
42
+ const print = function () {
43
+ try {
44
+ function _temp3() {
45
+ // this might close immediately if the dataset is small - this is okay
46
+ toastRef.close();
47
+ // use a timeout to let the toast close, otherwise it freezes mid animation when the print dialog opens
48
+ setTimeout(() => {
49
+ // do this here because Safari doesn't support the beforeprint event
50
+ togglePrinting(true);
51
+ requestAnimationFrame(() => {
52
+ try {
53
+ // window.print doesn't always work in Safari :man_shrugging:
54
+ document.execCommand('print', false, undefined);
55
+ } catch {
56
+ window.print();
57
+ }
58
+ });
59
+ }, 150);
60
+ }
61
+ const toastRef = toast.loading(texts.table3.print.loading);
62
+ const _temp2 = function () {
63
+ if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {
64
+ const _temp = _catch(function () {
65
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
66
+ }, function (error) {
67
+ const errorMessage = `${texts.table3.print.error}: ${error}`;
68
+ console.error(errorMessage);
69
+ toastRef.error(errorMessage);
70
+ });
71
+ if (_temp && _temp.then) return _temp.then(function () {});
72
+ }
73
+ }();
74
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2));
75
+ } catch (e) {
76
+ return Promise.reject(e);
77
+ }
78
+ };
79
+ const [orientation, setOrientation] = React__default.useState('portrait');
80
+ const [size, setSize] = React__default.useState('A4');
81
+ const [allRows, setAllRows] = React__default.useState(true);
82
+ const [splitGroups, setSplitGroups] = React__default.useState(true);
83
+ const printStyle = [`@page { size: ${size} ${orientation}; }`];
84
+ if (!allRows) {
85
+ printStyle.push(`table[data-taco='report']#${tableId} tr:not([data-row-selected="true"]) { display: none; }`);
86
+ }
87
+ if (splitGroups) {
88
+ printStyle.push(`table[data-taco='report']#${tableId} tr[data-row-group]:not(:first-child) { break-before: page; }`);
89
+ }
90
+ const shortcut = {
91
+ key: 'p',
92
+ meta: true,
93
+ shift: false
94
+ };
95
+ const tooltip = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table3.print.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
96
+ className: "ml-2",
97
+ keys: shortcut
98
+ }));
99
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("style", {
100
+ media: "print"
101
+ }, printStyle.join('\n')), /*#__PURE__*/React__default.createElement(IconButton, {
102
+ icon: "print",
103
+ "aria-label": texts.table3.print.tooltip,
104
+ dialog: dialogProps => ( /*#__PURE__*/React__default.createElement(PrintDialog, Object.assign({}, dialogProps, {
105
+ table: table,
106
+ onAccept: print,
107
+ orientation: orientation,
108
+ setOrientation: setOrientation,
109
+ size: size,
110
+ setSize: setSize,
111
+ allRows: allRows,
112
+ setAllRows: setAllRows,
113
+ splitGroups: splitGroups,
114
+ setSplitGroups: setSplitGroups
115
+ }))),
116
+ ref: ref,
117
+ shortcut: shortcut,
118
+ tooltip: tooltip
119
+ }));
120
+ }
121
+
122
+ export { Print };
123
+ //# sourceMappingURL=Print.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Print.js","sources":["../../../../../../../../../../../src/components/Report/components/Toolbar/components/Print/Print.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { IconButton } from '../../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { useToast } from '../../../../../Toast/Toaster';\nimport { TableRef } from '../../../../../../primitives/Table/types';\nimport { PrintDialog } from './PrintDialog';\nimport { Select2Value } from '../../../../../Select2/types';\nimport { RadioGroupItemValue } from '../../../../../RadioGroup/RadioGroup';\nimport { Shortcut } from '../../../../../Shortcut/Shortcut';\n\nexport type PrintProps<TType = unknown> = {\n table: ReactTable<TType>;\n tableId: string;\n tableRef: React.RefObject<TableRef>;\n};\n\nexport function Print<TType = unknown>(props: PrintProps<TType>) {\n const { table, tableId, tableRef } = props;\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLButtonElement>(null);\n const lastScrollTopRef = React.useRef<number>();\n const toast = useToast();\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const togglePrinting = React.useCallback(\n enabled => {\n tableMeta.printing.setIsPrinting(enabled);\n\n if (tableRef.current) {\n if (enabled) {\n lastScrollTopRef.current = tableRef.current.scrollTop;\n } else if (lastScrollTopRef.current !== undefined) {\n tableRef.current.scrollTop = lastScrollTopRef.current;\n lastScrollTopRef.current = undefined;\n }\n }\n },\n [tableRef.current]\n );\n\n React.useEffect(() => {\n const afterPrint = () => {\n togglePrinting(false);\n };\n\n window.addEventListener('afterprint', afterPrint);\n\n return () => {\n window.removeEventListener('afterprint', afterPrint);\n };\n }, []);\n\n const print = async () => {\n const toastRef = toast.loading(texts.table3.print.loading);\n\n if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {\n try {\n await tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined);\n } catch (error) {\n const errorMessage = `${texts.table3.print.error}: ${error}`;\n console.error(errorMessage);\n toastRef.error(errorMessage);\n }\n }\n\n // this might close immediately if the dataset is small - this is okay\n toastRef.close();\n\n // use a timeout to let the toast close, otherwise it freezes mid animation when the print dialog opens\n setTimeout(() => {\n // do this here because Safari doesn't support the beforeprint event\n togglePrinting(true);\n\n requestAnimationFrame(() => {\n try {\n // window.print doesn't always work in Safari :man_shrugging:\n document.execCommand('print', false, undefined);\n } catch {\n window.print();\n }\n });\n }, 150);\n };\n\n const [orientation, setOrientation] = React.useState<Select2Value>('portrait');\n const [size, setSize] = React.useState<Select2Value>('A4');\n const [allRows, setAllRows] = React.useState<RadioGroupItemValue>(true);\n const [splitGroups, setSplitGroups] = React.useState<boolean>(true);\n\n const printStyle = [`@page { size: ${size} ${orientation}; }`];\n\n if (!allRows) {\n printStyle.push(`table[data-taco='report']#${tableId} tr:not([data-row-selected=\"true\"]) { display: none; }`);\n }\n\n if (splitGroups) {\n printStyle.push(`table[data-taco='report']#${tableId} tr[data-row-group]:not(:first-child) { break-before: page; }`);\n }\n\n const shortcut = { key: 'p', meta: true, shift: false };\n const tooltip = (\n <>\n {texts.table3.print.tooltip}\n <Shortcut className=\"ml-2\" keys={shortcut} />\n </>\n );\n\n return (\n <>\n <style media=\"print\">{printStyle.join('\\n')}</style>\n <IconButton\n icon=\"print\"\n aria-label={texts.table3.print.tooltip}\n dialog={dialogProps => (\n <PrintDialog\n {...dialogProps}\n table={table}\n onAccept={print}\n orientation={orientation}\n setOrientation={setOrientation}\n size={size}\n setSize={setSize}\n allRows={allRows}\n setAllRows={setAllRows}\n splitGroups={splitGroups}\n setSplitGroups={setSplitGroups}\n />\n )}\n ref={ref}\n shortcut={shortcut}\n tooltip={tooltip}\n />\n </>\n );\n}\n"],"names":["Print","props","table","tableId","tableRef","texts","useLocalization","ref","React","useRef","lastScrollTopRef","toast","useToast","tableMeta","options","meta","togglePrinting","useCallback","enabled","printing","setIsPrinting","current","scrollTop","undefined","useEffect","afterPrint","window","addEventListener","removeEventListener","print","toastRef","close","setTimeout","requestAnimationFrame","document","execCommand","loading","table3","_temp2","server","isEnabled","loadAllIfNeeded","_temp","_catch","Promise","resolve","getState","sorting","columnFilters","then","error","errorMessage","console","_temp3","e","reject","orientation","setOrientation","useState","size","setSize","allRows","setAllRows","splitGroups","setSplitGroups","printStyle","push","shortcut","key","shift","tooltip","Shortcut","className","keys","media","join","IconButton","icon","dialog","dialogProps","PrintDialog","onAccept"],"mappings":";;;;;;;;SAiBgBA,KAAKA,CAAkBC,KAAwB;EAC3D,MAAM;IAAEC,KAAK;IAAEC,OAAO;IAAEC;GAAU,GAAGH,KAAK;EAC1C,MAAM;IAAEI;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAoB,IAAI,CAAC;EACjD,MAAMC,gBAAgB,GAAGF,cAAK,CAACC,MAAM,EAAU;EAC/C,MAAME,KAAK,GAAGC,QAAQ,EAAE;EACxB,MAAMC,SAAS,GAAGX,KAAK,CAACY,OAAO,CAACC,IAA6B;EAE7D,MAAMC,cAAc,GAAGR,cAAK,CAACS,WAAW,CACpCC,OAAO;IACHL,SAAS,CAACM,QAAQ,CAACC,aAAa,CAACF,OAAO,CAAC;IAEzC,I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GAAG;IAAEC,GAAG,EAAE,GAAG;IAAErD,IAAI,EAAE,IAAI;IAAEsD,KAAK,EAAE;GAAO;EACvD,MAAMC,OAAO,gBACT9D,4DACKH,KAAK,CAACgC,MAAM,CAACR,KAAK,CAACyC,OAAO,eAC3B9D,6BAAC+D,QAAQ;IAACC,SAAS,EAAC,MAAM;IAACC,IAAI,EAAEN;IAAY,CAEpD;EAED,oBACI3D,yEACIA;IAAOkE,KAAK,EAAC;KAAST,UAAU,CAACU,IAAI,CAAC,IAAI,CAAC,CAAS,eACpDnE,6BAACoE,UAAU;IACPC,IAAI,EAAC,OAAO;kBACAxE,KAAK,CAACgC,MAAM,CAACR,KAAK,CAACyC,OAAO;IACtCQ,MAAM,EAAEC,WAAW,mBACfvE,6BAACwE,WAAW,oBACJD,WAAW;MACf7E,KAAK,EAAEA,KAAK;MACZ+E,QAAQ,EAAEpD,KAAK;MACf2B,WAAW,EAAEA,WAAW;MACxBC,cAAc,EAAEA,cAAc;MAC9BE,IAAI,EAAEA,IAAI;MACVC,OAAO,EAAEA,OAAO;MAChBC,OAAO,EAAEA,OAAO;MAChBC,UAAU,EAAEA,UAAU;MACtBC,WAAW,EAAEA,WAAW;MACxBC,cAAc,EAAEA;OAClB,CACL;IACDzD,GAAG,EAAEA,GAAG;IACR4D,QAAQ,EAAEA,QAAQ;IAClBG,OAAO,EAAEA;IACX,CACH;AAEX;;;;"}
@@ -0,0 +1,88 @@
1
+ import React__default from 'react';
2
+ import { Alert } from '../../../../../Alert/Alert.js';
3
+ import { useLocalization } from '../../../../../Provider/Localization.js';
4
+ import { Button } from '../../../../../Button/Button.js';
5
+ import { Checkbox } from '../../../../../Checkbox/Checkbox.js';
6
+ import { Dialog } from '../../../../../Dialog/Dialog.js';
7
+ import { Group } from '../../../../../Group/Group.js';
8
+ import { Field } from '../../../../../Field/Field.js';
9
+ import { RadioGroup } from '../../../../../RadioGroup/RadioGroup.js';
10
+ import { Select2 } from '../../../../../Select2/Select2.js';
11
+
12
+ const SAFE_PRINT_CELL_COUNT = 10000;
13
+ function PrintDialog(props) {
14
+ var _columns$find, _columns$find$columnD;
15
+ const {
16
+ onAccept,
17
+ table,
18
+ orientation,
19
+ setOrientation,
20
+ size,
21
+ setSize,
22
+ allRows,
23
+ setAllRows,
24
+ splitGroups,
25
+ setSplitGroups,
26
+ ...dialogProps
27
+ } = props;
28
+ const {
29
+ texts
30
+ } = useLocalization();
31
+ const columns = table.getVisibleFlatColumns();
32
+ const cellCount = table.getRowModel().rows.length * columns.length;
33
+ const rowGroupingColumnName = table.getState().grouping.length ? (_columns$find = columns.find(column => column.id === table.getState().grouping[0])) === null || _columns$find === void 0 ? void 0 : (_columns$find$columnD = _columns$find.columnDef.meta) === null || _columns$find$columnD === void 0 ? void 0 : _columns$find$columnD.header : undefined;
34
+ return /*#__PURE__*/React__default.createElement(Dialog, Object.assign({}, dialogProps, {
35
+ size: "xs"
36
+ }), /*#__PURE__*/React__default.createElement(Dialog.Content, {
37
+ "aria-label": texts.table3.print.warningDialog.title
38
+ }, ({
39
+ close
40
+ }) => ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Dialog.Title, null, texts.table3.print.settingsDialog.title), /*#__PURE__*/React__default.createElement("div", {
41
+ className: "mt-4 flex flex-col gap-2"
42
+ }, /*#__PURE__*/React__default.createElement("div", {
43
+ className: "grid grid-cols-2 gap-4"
44
+ }, /*#__PURE__*/React__default.createElement(Field, null, texts.table3.print.settingsDialog.size, /*#__PURE__*/React__default.createElement(Select2, {
45
+ onChange: setSize,
46
+ value: size
47
+ }, /*#__PURE__*/React__default.createElement(Select2.Option, {
48
+ value: "A5"
49
+ }, texts.table3.print.settingsDialog.sizeA5), /*#__PURE__*/React__default.createElement(Select2.Option, {
50
+ value: "A4"
51
+ }, texts.table3.print.settingsDialog.sizeA4), /*#__PURE__*/React__default.createElement(Select2.Option, {
52
+ value: "A3"
53
+ }, texts.table3.print.settingsDialog.sizeA3), /*#__PURE__*/React__default.createElement(Select2.Option, {
54
+ value: "letter"
55
+ }, texts.table3.print.settingsDialog.sizeLetter), /*#__PURE__*/React__default.createElement(Select2.Option, {
56
+ value: "legal"
57
+ }, texts.table3.print.settingsDialog.sizeLegal))), /*#__PURE__*/React__default.createElement(Field, null, texts.table3.print.settingsDialog.orientation, /*#__PURE__*/React__default.createElement(Select2, {
58
+ onChange: setOrientation,
59
+ value: orientation
60
+ }, /*#__PURE__*/React__default.createElement(Select2.Option, {
61
+ value: "landscape"
62
+ }, texts.table3.print.settingsDialog.orientationLandscape), /*#__PURE__*/React__default.createElement(Select2.Option, {
63
+ value: "portrait"
64
+ }, texts.table3.print.settingsDialog.orientationPortrait)))), table.options.enableRowSelection && table.getIsSomeRowsSelected() ? ( /*#__PURE__*/React__default.createElement(Field, null, texts.table3.print.settingsDialog.rows, /*#__PURE__*/React__default.createElement(RadioGroup, {
65
+ onChange: setAllRows,
66
+ value: allRows
67
+ }, /*#__PURE__*/React__default.createElement(RadioGroup.Item, {
68
+ value: true
69
+ }, texts.table3.print.settingsDialog.rowsAll), /*#__PURE__*/React__default.createElement(RadioGroup.Item, {
70
+ value: false
71
+ }, texts.table3.print.settingsDialog.rowsSelected)))) : undefined, rowGroupingColumnName ? ( /*#__PURE__*/React__default.createElement(Field, null, texts.table3.print.settingsDialog.layout, /*#__PURE__*/React__default.createElement(Checkbox, {
72
+ label: texts.table3.print.settingsDialog.layoutSplitGroups.replace('[COLUMN]', rowGroupingColumnName),
73
+ checked: splitGroups,
74
+ onChange: setSplitGroups
75
+ }))) : null, cellCount > SAFE_PRINT_CELL_COUNT ? ( /*#__PURE__*/React__default.createElement(Alert, {
76
+ state: "warning"
77
+ }, texts.table3.print.warningDialog.description)) : null), /*#__PURE__*/React__default.createElement(Dialog.Footer, null, /*#__PURE__*/React__default.createElement(Group, null, /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button, null, texts.table3.print.warningDialog.cancelButtonText)), /*#__PURE__*/React__default.createElement(Button, {
78
+ appearance: "primary",
79
+ autoFocus: true,
80
+ onClick: () => {
81
+ close();
82
+ setTimeout(() => onAccept(), 1);
83
+ }
84
+ }, texts.table3.print.warningDialog.printButtonText)))))));
85
+ }
86
+
87
+ export { PrintDialog };
88
+ //# sourceMappingURL=PrintDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrintDialog.js","sources":["../../../../../../../../../../../src/components/Report/components/Toolbar/components/Print/PrintDialog.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable } from '@tanstack/react-table';\nimport { Dialog } from '../../../../../Dialog/Dialog';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { Checkbox } from '../../../../../Checkbox/Checkbox';\nimport { Group } from '../../../../../Group/Group';\nimport { Button } from '../../../../../Button/Button';\nimport { Field } from '../../../../../Field/Field';\nimport { Select2, Select2Value } from '../../../../../Select2/Select2';\nimport { RadioGroup, RadioGroupItemValue } from '../../../../../RadioGroup/RadioGroup';\nimport { Alert } from '../../../../../Alert/Alert';\n\nconst SAFE_PRINT_CELL_COUNT = 10000;\n\nexport type PrintDialogProps<TType = unknown> = {\n table: ReactTable<TType>;\n onAccept: () => void;\n orientation: Select2Value;\n setOrientation: (orientation: Select2Value) => void;\n size: Select2Value;\n setSize: (size: Select2Value) => void;\n allRows: RadioGroupItemValue;\n setAllRows: (allRows: RadioGroupItemValue) => void;\n splitGroups: boolean;\n setSplitGroups: (splitGroups: boolean) => void;\n};\n\nexport function PrintDialog<TType = unknown>(props: PrintDialogProps<TType>) {\n const {\n onAccept,\n table,\n orientation,\n setOrientation,\n size,\n setSize,\n allRows,\n setAllRows,\n splitGroups,\n setSplitGroups,\n ...dialogProps\n } = props;\n const { texts } = useLocalization();\n\n const columns = table.getVisibleFlatColumns();\n const cellCount = table.getRowModel().rows.length * columns.length;\n const rowGroupingColumnName = table.getState().grouping.length\n ? columns.find(column => column.id === table.getState().grouping[0])?.columnDef.meta?.header\n : undefined;\n\n return (\n <Dialog {...dialogProps} size=\"xs\">\n <Dialog.Content aria-label={texts.table3.print.warningDialog.title}>\n {({ close }) => (\n <>\n <Dialog.Title>{texts.table3.print.settingsDialog.title}</Dialog.Title>\n <div className=\"mt-4 flex flex-col gap-2\">\n <div className=\"grid grid-cols-2 gap-4\">\n <Field>\n {texts.table3.print.settingsDialog.size}\n <Select2 onChange={setSize} value={size}>\n <Select2.Option value=\"A5\">{texts.table3.print.settingsDialog.sizeA5}</Select2.Option>\n <Select2.Option value=\"A4\">{texts.table3.print.settingsDialog.sizeA4}</Select2.Option>\n <Select2.Option value=\"A3\">{texts.table3.print.settingsDialog.sizeA3}</Select2.Option>\n <Select2.Option value=\"letter\">\n {texts.table3.print.settingsDialog.sizeLetter}\n </Select2.Option>\n <Select2.Option value=\"legal\">\n {texts.table3.print.settingsDialog.sizeLegal}\n </Select2.Option>\n </Select2>\n </Field>\n <Field>\n {texts.table3.print.settingsDialog.orientation}\n <Select2 onChange={setOrientation} value={orientation}>\n <Select2.Option value=\"landscape\">\n {texts.table3.print.settingsDialog.orientationLandscape}\n </Select2.Option>\n <Select2.Option value=\"portrait\">\n {texts.table3.print.settingsDialog.orientationPortrait}\n </Select2.Option>\n </Select2>\n </Field>\n </div>\n {table.options.enableRowSelection && table.getIsSomeRowsSelected() ? (\n <Field>\n {texts.table3.print.settingsDialog.rows}\n <RadioGroup onChange={setAllRows} value={allRows}>\n <RadioGroup.Item value={true}>\n {texts.table3.print.settingsDialog.rowsAll}\n </RadioGroup.Item>\n <RadioGroup.Item value={false}>\n {texts.table3.print.settingsDialog.rowsSelected}\n </RadioGroup.Item>\n </RadioGroup>\n </Field>\n ) : undefined}\n {rowGroupingColumnName ? (\n <Field>\n {texts.table3.print.settingsDialog.layout}\n <Checkbox\n label={texts.table3.print.settingsDialog.layoutSplitGroups.replace(\n '[COLUMN]',\n rowGroupingColumnName\n )}\n checked={splitGroups}\n onChange={setSplitGroups}\n />\n </Field>\n ) : null}\n\n {cellCount > SAFE_PRINT_CELL_COUNT ? (\n <Alert state=\"warning\">{texts.table3.print.warningDialog.description}</Alert>\n ) : null}\n </div>\n <Dialog.Footer>\n <Group>\n <Dialog.Close>\n <Button>{texts.table3.print.warningDialog.cancelButtonText}</Button>\n </Dialog.Close>\n <Button\n appearance=\"primary\"\n autoFocus\n onClick={() => {\n close();\n setTimeout(() => onAccept(), 1);\n }}>\n {texts.table3.print.warningDialog.printButtonText}\n </Button>\n </Group>\n </Dialog.Footer>\n </>\n )}\n </Dialog.Content>\n </Dialog>\n );\n}\n"],"names":["SAFE_PRINT_CELL_COUNT","PrintDialog","props","onAccept","table","orientation","setOrientation","size","setSize","allRows","setAllRows","splitGroups","setSplitGroups","dialogProps","texts","useLocalization","columns","getVisibleFlatColumns","cellCount","getRowModel","rows","length","rowGroupingColumnName","getState","grouping","_columns$find","find","column","id","_columns$find$columnD","columnDef","meta","header","undefined","React","Dialog","Content","table3","print","warningDialog","title","close","Title","settingsDialog","className","Field","Select2","onChange","value","Option","sizeA5","sizeA4","sizeA3","sizeLetter","sizeLegal","orientationLandscape","orientationPortrait","options","enableRowSelection","getIsSomeRowsSelected","RadioGroup","Item","rowsAll","rowsSelected","layout","Checkbox","label","layoutSplitGroups","replace","checked","Alert","state","description","Footer","Group","Close","Button","cancelButtonText","appearance","autoFocus","onClick","setTimeout","printButtonText"],"mappings":";;;;;;;;;;;AAYA,MAAMA,qBAAqB,GAAG,KAAK;SAenBC,WAAWA,CAAkBC,KAA8B;;EACvE,MAAM;IACFC,QAAQ;IACRC,KAAK;IACLC,WAAW;IACXC,cAAc;IACdC,IAAI;IACJC,OAAO;IACPC,OAAO;IACPC,UAAU;IACVC,WAAW;IACXC,cAAc;IACd,GAAGC;GACN,GAAGX,KAAK;EACT,MAAM;IAAEY;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,OAAO,GAAGZ,KAAK,CAACa,qBAAqB,EAAE;EAC7C,MAAMC,SAAS,GAAGd,KAAK,CAACe,WAAW,EAAE,CAACC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