@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,62 @@
1
+ import React__default from 'react';
2
+ import { useInView } from 'react-intersection-observer';
3
+
4
+ function SkeletonRow(props) {
5
+ const {
6
+ index,
7
+ row,
8
+ table
9
+ } = props;
10
+ const tableMeta = table.options.meta;
11
+ if (tableMeta.server.isEnabled) {
12
+ return /*#__PURE__*/React__default.createElement(RowWithServerLoading, Object.assign({}, props, {
13
+ index: index
14
+ }));
15
+ }
16
+ return /*#__PURE__*/React__default.createElement(Skeleton, {
17
+ id: row.id,
18
+ cells: row.getVisibleCells()
19
+ });
20
+ }
21
+ function RowWithServerLoading(props) {
22
+ const {
23
+ index,
24
+ row,
25
+ table
26
+ } = props;
27
+ const tableMeta = table.options.meta;
28
+ const pageIndex = Math.floor(index / tableMeta.server.pageSize) * tableMeta.server.pageSize / tableMeta.server.pageSize;
29
+ const {
30
+ ref,
31
+ inView
32
+ } = useInView({
33
+ threshold: 0,
34
+ triggerOnce: true,
35
+ initialInView: pageIndex === 0
36
+ });
37
+ React__default.useEffect(() => {
38
+ if (inView) {
39
+ var _tableMeta$server$loa, _tableMeta$server;
40
+ (_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, pageIndex, table.getState().sorting, table.getState().columnFilters, table.getState().globalFilter);
41
+ }
42
+ }, [inView]);
43
+ return /*#__PURE__*/React__default.createElement(Skeleton, {
44
+ cells: row.getVisibleCells(),
45
+ ref: ref
46
+ });
47
+ }
48
+ const Skeleton = /*#__PURE__*/React__default.forwardRef(function Skeleton(props, ref) {
49
+ const {
50
+ cells
51
+ } = props;
52
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("tr", {
53
+ ref: ref
54
+ }, cells.map(cell => ( /*#__PURE__*/React__default.createElement("td", {
55
+ key: cell.id
56
+ }, /*#__PURE__*/React__default.createElement("span", {
57
+ className: "bg-grey-100 text-grey-700 h-4 w-full text-center text-xs"
58
+ }))))));
59
+ });
60
+
61
+ export { RowWithServerLoading, Skeleton, SkeletonRow };
62
+ //# sourceMappingURL=SkeletonRow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SkeletonRow.js","sources":["../../../../../../../../../src/components/Report/components/Row/SkeletonRow.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta, Row as ReactTableRow } from '@tanstack/react-table';\nimport { useInView } from 'react-intersection-observer';\n\nexport type RowProps<TType = unknown> = {\n index: number;\n row: ReactTableRow<TType>;\n table: ReactTable<TType>;\n};\n\nexport function SkeletonRow<TType = unknown>(props: RowProps<TType>) {\n const { index, row, table } = props;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (tableMeta.server.isEnabled) {\n return <RowWithServerLoading {...props} index={index} />;\n }\n\n return <Skeleton id={row.id} cells={row.getVisibleCells()} />;\n}\n\nexport function RowWithServerLoading<TType = unknown>(props: RowProps<TType>) {\n const { index, row, table } = props;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const pageIndex = (Math.floor(index / tableMeta.server.pageSize) * tableMeta.server.pageSize) / tableMeta.server.pageSize;\n\n const { ref, inView } = useInView({\n threshold: 0,\n triggerOnce: true,\n initialInView: pageIndex === 0,\n });\n\n React.useEffect(() => {\n if (inView) {\n tableMeta.server.loadPage?.(\n pageIndex,\n table.getState().sorting,\n table.getState().columnFilters,\n table.getState().globalFilter\n );\n }\n }, [inView]);\n\n return <Skeleton cells={row.getVisibleCells()} ref={ref} />;\n}\n\nexport const Skeleton = React.forwardRef(function Skeleton(props: any, ref: React.Ref<HTMLTableRowElement>) {\n const { cells } = props;\n\n return (\n <>\n <tr ref={ref}>\n {cells.map(cell => (\n <td key={cell.id}>\n <span className=\"bg-grey-100 text-grey-700 h-4 w-full text-center text-xs\" />\n </td>\n ))}\n </tr>\n </>\n );\n});\n"],"names":["SkeletonRow","props","index","row","table","tableMeta","options","meta","server","isEnabled","React","RowWithServerLoading","Skeleton","id","cells","getVisibleCells","pageIndex","Math","floor","pageSize","ref","inView","useInView","threshold","triggerOnce","initialInView","useEffect","_tableMeta$server$loa","_tableMeta$server","loadPage","call","getState","sorting","columnFilters","globalFilter","forwardRef","map","cell","key","className"],"mappings":";;;SAUgBA,WAAWA,CAAkBC,KAAsB;EAC/D,MAAM;IAAEC,KAAK;IAAEC,GAAG;IAAEC;GAAO,GAAGH,KAAK;EACnC,MAAMI,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAE7D,IAAIF,SAAS,CAACG,MAAM,CAACC,SAAS,EAAE;IAC5B,oBAAO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CAACyB,UAAU,CAAC,SAASvB,QAAQA,CAACX,KAAU,EAAEmB,GAAmC;EACtG,MAAM;IAAEN;GAAO,GAAGb,KAAK;EAEvB,oBACIS,yEACIA;IAAIU,GAAG,EAAEA;KACJN,KAAK,CAACsB,GAAG,CAACC,IAAI,mBACX3B;IAAI4B,GAAG,EAAED,IAAI,CAACxB;kBACVH;IAAM6B,SAAS,EAAC;IAA6D,CAC5E,CACR,CAAC,CACD,CACN;AAEX,CAAC;;;;"}
@@ -0,0 +1,63 @@
1
+ import React__default from 'react';
2
+ import { Group } from '../../../Group/Group.js';
3
+ import { Search } from './components/Search/Search.js';
4
+ import { Settings } from './components/Settings/Settings.js';
5
+ import { Print } from './components/Print/Print.js';
6
+ import { Filters } from './components/Filters/Filters.js';
7
+
8
+ function Toolbar(props) {
9
+ const {
10
+ customSettings,
11
+ left,
12
+ length,
13
+ right,
14
+ scrollToIndex,
15
+ table,
16
+ tableId,
17
+ tableRef
18
+ } = props;
19
+ const tableMeta = table.options.meta;
20
+ if (!isToolbarVisible(props, customSettings)) {
21
+ return null;
22
+ }
23
+ const canFilter = table.options.enableColumnFilters;
24
+ const canPrint = tableMeta.printing.isEnabled;
25
+ const canSettings = canChangeSettings(table, customSettings);
26
+ const canSearch = tableMeta.search.isEnabled;
27
+ return /*#__PURE__*/React__default.createElement("div", {
28
+ className: "mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2 print:hidden",
29
+ "data-taco": "report-toolbar"
30
+ }, left, /*#__PURE__*/React__default.createElement(Group, {
31
+ className: "ml-auto flex-shrink-0 print:hidden"
32
+ }, canFilter ? /*#__PURE__*/React__default.createElement(Filters, {
33
+ length: length,
34
+ table: table
35
+ }) : null, right, canPrint ? /*#__PURE__*/React__default.createElement(Print, {
36
+ table: table,
37
+ tableId: tableId,
38
+ tableRef: tableRef
39
+ }) : null, canSettings ? /*#__PURE__*/React__default.createElement(Settings, {
40
+ customSettings: customSettings,
41
+ table: table
42
+ }) : null, canSearch ? /*#__PURE__*/React__default.createElement(Search, {
43
+ scrollToIndex: scrollToIndex,
44
+ table: table
45
+ }) : null));
46
+ }
47
+ function canChangeSettings(table, customSettings) {
48
+ const tableMeta = table.options.meta;
49
+ return table.options.enableHiding || tableMeta.columnOrdering.isEnabled || tableMeta.fontSize.isEnabled || tableMeta.rowHeight.isEnabled || typeof customSettings === 'function';
50
+ }
51
+ function isToolbarVisible(props, customSettings) {
52
+ const {
53
+ left,
54
+ right,
55
+ table
56
+ } = props;
57
+ const tableMeta = table.options.meta;
58
+ const hasInternalToolbar = table.options.enableColumnFilters || tableMeta.printing.isEnabled || canChangeSettings(table, customSettings) || tableMeta.search.isEnabled;
59
+ return hasInternalToolbar || !!left || !!right;
60
+ }
61
+
62
+ export { Toolbar };
63
+ //# sourceMappingURL=Toolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Toolbar.js","sources":["../../../../../../../../../src/components/Report/components/Toolbar/Toolbar.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { Group } from '../../../Group/Group';\nimport { Search } from './components/Search/Search';\nimport { Settings } from './components/Settings/Settings';\nimport { Print } from './components/Print/Print';\nimport { Filters } from './components/Filters/Filters';\nimport { TableRef } from '../../../../primitives/Table/types';\nimport { ReportCustomSettingsRenderer } from '../../types';\n\nexport type ToolbarProps<TType = unknown> = {\n customSettings?: ReportCustomSettingsRenderer;\n left?: JSX.Element;\n length: number;\n right?: JSX.Element;\n scrollToIndex: (index: number) => void;\n table: ReactTable<TType>;\n tableId: string;\n tableRef: React.RefObject<TableRef>;\n};\n\nexport function Toolbar<TType = unknown>(props: ToolbarProps<TType>) {\n const { customSettings, left, length, right, scrollToIndex, table, tableId, tableRef } = props;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (!isToolbarVisible(props, customSettings)) {\n return null;\n }\n\n const canFilter = table.options.enableColumnFilters;\n const canPrint = tableMeta.printing.isEnabled;\n const canSettings = canChangeSettings(table, customSettings);\n const canSearch = tableMeta.search.isEnabled;\n\n return (\n <div className=\"mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2 print:hidden\" data-taco=\"report-toolbar\">\n {left}\n <Group className=\"ml-auto flex-shrink-0 print:hidden\">\n {canFilter ? <Filters length={length} table={table} /> : null}\n {right}\n {canPrint ? <Print table={table} tableId={tableId} tableRef={tableRef} /> : null}\n {canSettings ? <Settings customSettings={customSettings} table={table} /> : null}\n {canSearch ? <Search scrollToIndex={scrollToIndex} table={table} /> : null}\n </Group>\n </div>\n );\n}\n\nfunction canChangeSettings<TType = unknown>(table: ReactTable<TType>, customSettings?: ReportCustomSettingsRenderer) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n return (\n table.options.enableHiding ||\n tableMeta.columnOrdering.isEnabled ||\n tableMeta.fontSize.isEnabled ||\n tableMeta.rowHeight.isEnabled ||\n typeof customSettings === 'function'\n );\n}\n\nfunction isToolbarVisible<TType = unknown>(props: ToolbarProps<TType>, customSettings?: ReportCustomSettingsRenderer) {\n const { left, right, table } = props;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const hasInternalToolbar =\n table.options.enableColumnFilters ||\n tableMeta.printing.isEnabled ||\n canChangeSettings(table, customSettings) ||\n tableMeta.search.isEnabled;\n\n return hasInternalToolbar || !!left || !!right;\n}\n"],"names":["Toolbar","props","customSettings","left","length","right","scrollToIndex","table","tableId","tableRef","tableMeta","options","meta","isToolbarVisible","canFilter","enableColumnFilters","canPrint","printing","isEnabled","canSettings","canChangeSettings","canSearch","search","React","className","Group","Filters","Print","Settings","Search","enableHiding","columnOrdering","fontSize","rowHeight","hasInternalToolbar"],"mappings":";;;;;;;SAqBgBA,OAAOA,CAAkBC,KAA0B;EAC/D,MAAM;IAAEC,cAAc;IAAEC,IAAI;IAAEC,MAAM;IAAEC,KAAK;IAAEC,aAAa;IAAEC,KAAK;IAAEC,OAAO;IAAEC;GAAU,GAAGR,KAAK;EAC9F,M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OAAOhB,cAAc,KAAK,UAAU;AAE5C;AAEA,SAASW,gBAAgBA,CAAkBZ,KAA0B,EAAEC,cAA6C;EAChH,MAAM;IAAEC,IAAI;IAAEE,KAAK;IAAEE;GAAO,GAAGN,KAAK;EACpC,MAAMS,SAAS,GAAGH,KAAK,CAACI,OAAO,CAACC,IAA6B;EAE7D,MAAMsB,kBAAkB,GACpB3B,KAAK,CAACI,OAAO,CAACI,mBAAmB,IACjCL,SAAS,CAACO,QAAQ,CAACC,SAAS,IAC5BE,iBAAiB,CAACb,KAAK,EAAEL,cAAc,CAAC,IACxCQ,SAAS,CAACY,MAAM,CAACJ,SAAS;EAE9B,OAAOgB,kBAAkB,IAAI,CAAC,CAAC/B,IAAI,IAAI,CAAC,CAACE,KAAK;AAClD;;;;"}
@@ -0,0 +1,50 @@
1
+ import React__default from 'react';
2
+ import { Icon } from '../../../../../Icon/Icon.js';
3
+ import { IconButton } from '../../../../../IconButton/IconButton.js';
4
+ import { useLocalization } from '../../../../../Provider/Localization.js';
5
+ import { Button } from '../../../../../Button/Button.js';
6
+ import { Shortcut } from '../../../../../Shortcut/Shortcut.js';
7
+ import { useIsLargeScreen } from '../../../../../../hooks/useIsLargeScreen.js';
8
+ import { ManageFiltersPopover } from './ManageFiltersPopover.js';
9
+
10
+ function Filters(props) {
11
+ const {
12
+ length,
13
+ table
14
+ } = props;
15
+ const {
16
+ texts
17
+ } = useLocalization();
18
+ const isLargeScreen = useIsLargeScreen();
19
+ const appliedFilters = table.getState().columnFilters;
20
+ const shortcut = {
21
+ key: 'f',
22
+ meta: true,
23
+ shift: true
24
+ };
25
+ const buttonProps = {
26
+ 'aria-label': texts.table3.filters.tooltip,
27
+ className: appliedFilters.length ? '!wcag-blue-100' : undefined,
28
+ popover: popoverProps => /*#__PURE__*/React__default.createElement(ManageFiltersPopover, Object.assign({}, popoverProps, {
29
+ length: length,
30
+ table: table
31
+ })),
32
+ shortcut,
33
+ tooltip: ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table3.filters.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
34
+ className: "ml-2",
35
+ keys: shortcut
36
+ })))
37
+ };
38
+ if (!isLargeScreen && !appliedFilters.length) {
39
+ return /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, buttonProps, {
40
+ icon: "filter"
41
+ }));
42
+ }
43
+ return /*#__PURE__*/React__default.createElement(Button, Object.assign({}, buttonProps), /*#__PURE__*/React__default.createElement(Icon, {
44
+ className: !isLargeScreen ? '-mr-1.5' : undefined,
45
+ name: appliedFilters.length ? 'filter-solid' : 'filter'
46
+ }), isLargeScreen ? texts.table3.filters.button : '', appliedFilters.length ? `(${appliedFilters.length})` : '');
47
+ }
48
+
49
+ export { Filters };
50
+ //# sourceMappingURL=Filters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Filters.js","sources":["../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/Filters.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable } from '@tanstack/react-table';\nimport { useIsLargeScreen } from '../../../../../../hooks/useIsLargeScreen';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { IconButton } from '../../../../../IconButton/IconButton';\nimport { Button } from '../../../../../Button/Button';\nimport { Icon } from '../../../../../Icon/Icon';\nimport { Shortcut } from '../../../../../Shortcut/Shortcut';\nimport { ManageFiltersPopover } from './ManageFiltersPopover';\n\nexport type FiltersProps<TType = unknown> = {\n length: number;\n table: ReactTable<TType>;\n};\n\nexport function Filters<TType = unknown>(props: FiltersProps<TType>) {\n const { length, table } = props;\n const { texts } = useLocalization();\n const isLargeScreen = useIsLargeScreen();\n const appliedFilters = table.getState().columnFilters;\n\n const shortcut = { key: 'f', meta: true, shift: true };\n\n const buttonProps = {\n 'aria-label': texts.table3.filters.tooltip,\n className: appliedFilters.length ? '!wcag-blue-100' : undefined,\n popover: popoverProps => <ManageFiltersPopover {...popoverProps} length={length} table={table} />,\n shortcut,\n tooltip: (\n <>\n {texts.table3.filters.tooltip}\n <Shortcut className=\"ml-2\" keys={shortcut} />\n </>\n ),\n };\n\n if (!isLargeScreen && !appliedFilters.length) {\n return <IconButton {...buttonProps} icon=\"filter\" />;\n }\n\n return (\n <Button {...buttonProps}>\n <Icon className={!isLargeScreen ? '-mr-1.5' : undefined} name={appliedFilters.length ? 'filter-solid' : 'filter'} />\n {isLargeScreen ? texts.table3.filters.button : ''}\n {appliedFilters.length ? `(${appliedFilters.length})` : ''}\n </Button>\n );\n}\n"],"names":["Filters","props","length","table","texts","useLocalization","isLargeScreen","useIsLargeScreen","appliedFilters","getState","columnFilters","shortcut","key","meta","shift","buttonProps","table3","filters","tooltip","className","undefined","popover","popoverProps","React","ManageFiltersPopover","Shortcut","keys","IconButton","icon","Button","Icon","name","button"],"mappings":";;;;;;;;;SAegBA,OAAOA,CAAkBC,KAA0B;EAC/D,MAAM;IAAEC,MAAM;IAAEC;GAAO,GAAGF,KAAK;EAC/B,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,aAAa,GAAGC,gBAAgB,EAAE;EACxC,MAAMC,cAAc,GAAGL,KAAK,CAACM,QAAQ,EAAE,CAACC,aAAa;EAErD,MAAMC,QAAQ,GAAG;IAAEC,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE,IAAI;IAAEC,KAAK,EAAE;GAAM;EAEtD,MAAMC,WAAW,GAAG;IAChB,YAAY,EAAEX,KAAK,CAACY,MAAM,CAACC,OAAO,CAACC,OAAO;IAC1CC,SAAS,EAAEX,cAAc,CAACN,MAAM,GAAG,gBAAgB,GAAGkB,SAAS;IAC/DC,OAAO,EAAEC,YAAY,iBAAIC,6BAACC,oBAAoB,oBAAKF,YAAY;MAAEpB,MAAM,EAAEA,MAAM;MAAEC,KAAK,EAAEA;OAAS;IACjGQ,QAAQ;IACRO,OAAO,iBACHK,4DACKnB,KAAK,CAACY,MAAM,CAACC,OAAO,CAACC,OAAO,eAC7BK,6BAACE,QAAQ;MAACN,SAAS,EAAC,MAAM;MAACO,IAAI,EAAEf;MAAY,CAC9C;GAEV;EAED,IAAI,CAACL,aAAa,IAAI,CAACE,cAAc,CAACN,MAAM,EAAE;IAC1C,oBAAOqB,6BAACI,UAAU,oBAAKZ,WAAW;MAAEa,IAAI,EAAC;OAAW;;EAGxD,oBACIL,6BAACM,MAAM,oBAAKd,WAAW,gBACnBQ,6BAACO,IAAI;IAACX,SAAS,EAAE,CAACb,aAAa,GAAG,SAAS,GAAGc,SAAS;IAAEW,IAAI,EAAEvB,cAAc,CAACN,MAAM,GAAG,cAAc,GAAG;IAAY,EACnHI,aAAa,GAAGF,KAAK,CAACY,MAAM,CAACC,OAAO,CAACe,MAAM,GAAG,EAAE,EAChDxB,cAAc,CAACN,MAAM,OAAOM,cAAc,CAACN,SAAS,GAAG,EAAE,CACrD;AAEjB;;;;"}
@@ -0,0 +1,136 @@
1
+ import React__default from 'react';
2
+ import { useLocalization } from '../../../../../Provider/Localization.js';
3
+ import { Button } from '../../../../../Button/Button.js';
4
+ import { Popover } from '../../../../../Popover/Popover.js';
5
+ import { Group } from '../../../../../Group/Group.js';
6
+ import { isInternalColumn } from '../../../../../../primitives/Table/useTable/util/columns.js';
7
+ import { TableFilterComparator } from '../../../../../../primitives/Table/types.js';
8
+ import { sortByHeader } from './util.js';
9
+ import { Filter } from './components/Filter.js';
10
+ import { Placeholder } from './components/Placeholder.js';
11
+
12
+ function ManageFiltersPopover(props) {
13
+ const {
14
+ length,
15
+ table,
16
+ ...popoverProps
17
+ } = props;
18
+ const {
19
+ locale,
20
+ texts
21
+ } = useLocalization();
22
+ const allColumns = table.getAllLeafColumns().filter(column => !isInternalColumn(column.id)).sort(sortByHeader);
23
+ const appliedFilters = table.getState().columnFilters;
24
+ // state, since we "apply" filters - our filter values have a special shape, so we force to our type
25
+ const [filters, setFilters] = React__default.useState(table.getState().columnFilters);
26
+ const [placeholderCount, setPlaceholderCount] = React__default.useState(1);
27
+ // filters might reset from the outside
28
+ React__default.useEffect(() => {
29
+ if (appliedFilters.length === 0) {
30
+ setFilters([]);
31
+ setPlaceholderCount(1);
32
+ }
33
+ }, [appliedFilters]);
34
+ // filters
35
+ const handleChangeFilter = (currentId, filter) => {
36
+ setFilters(currentFilters => {
37
+ const nextFilters = [...currentFilters];
38
+ nextFilters[nextFilters.findIndex(f => f.id === currentId)] = filter;
39
+ return nextFilters;
40
+ });
41
+ };
42
+ const handleRemoveFilter = columnId => {
43
+ if (filters.length === 1 && placeholderCount === 0) {
44
+ setPlaceholderCount(count => count + 1);
45
+ }
46
+ setFilters(currentFilters => currentFilters.filter(f => f.id !== columnId));
47
+ };
48
+ // placeholders
49
+ const handleCreateFilterFromPlaceholder = columnId => {
50
+ setFilters(currentFilters => [...currentFilters, {
51
+ id: columnId,
52
+ value: {
53
+ comparator: TableFilterComparator.Contains,
54
+ value: undefined
55
+ }
56
+ }]);
57
+ handleRemovePlaceholder();
58
+ };
59
+ const handleCreatePlaceholder = () => {
60
+ setPlaceholderCount(count => count + 1);
61
+ };
62
+ const handleRemovePlaceholder = () => {
63
+ setPlaceholderCount(count => count - 1);
64
+ };
65
+ //
66
+ const handleApply = () => {
67
+ table.setColumnFilters(() => {
68
+ const newFilters = filters.filter(f => {
69
+ var _allColumns$find, _allColumns$find$colu;
70
+ if (f.id === null) {
71
+ return false;
72
+ }
73
+ const controlRenderer = (_allColumns$find = allColumns.find(c => c.id === f.id)) === null || _allColumns$find === void 0 ? void 0 : (_allColumns$find$colu = _allColumns$find.columnDef.meta) === null || _allColumns$find$colu === void 0 ? void 0 : _allColumns$find$colu.control;
74
+ if (f.value.comparator === TableFilterComparator.IsEmpty || f.value.comparator === TableFilterComparator.IsNotEmpty || controlRenderer === 'switch') {
75
+ return true;
76
+ }
77
+ return !!f.value.value;
78
+ });
79
+ return newFilters;
80
+ });
81
+ };
82
+ const handleClear = () => {
83
+ table.resetColumnFilters();
84
+ setFilters([]);
85
+ setPlaceholderCount(1);
86
+ };
87
+ const handleClose = () => {
88
+ setFilters(appliedFilters);
89
+ setPlaceholderCount(appliedFilters.length ? 0 : 1);
90
+ };
91
+ return /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps, {
92
+ onChange: handleClose
93
+ }), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement("div", {
94
+ className: "flex w-[40rem] flex-col gap-4"
95
+ }, /*#__PURE__*/React__default.createElement("div", {
96
+ className: "flex h-8"
97
+ }, /*#__PURE__*/React__default.createElement("div", {
98
+ className: "flex w-full items-center gap-2"
99
+ }, /*#__PURE__*/React__default.createElement("h4", {
100
+ className: "mb-0 inline-flex"
101
+ }, texts.table3.filters.button), /*#__PURE__*/React__default.createElement("p", {
102
+ className: "text-grey-700 mb-0 mr-auto mt-px inline-flex"
103
+ }, texts.table3.filters.total.replace('[CURRENT]', new Intl.NumberFormat(locale).format(table.getFilteredRowModel().rows.length)).replace('[TOTAL]', new Intl.NumberFormat(locale).format(length))))), /*#__PURE__*/React__default.createElement("div", {
104
+ className: "flex flex-col gap-2"
105
+ }, filters.map((filter, index) => ( /*#__PURE__*/React__default.createElement(Filter, {
106
+ key: `filter_${index}`,
107
+ allColumns: allColumns,
108
+ filter: filter,
109
+ filters: filters,
110
+ position: index,
111
+ onChange: handleChangeFilter,
112
+ onRemove: handleRemoveFilter
113
+ }))), [...Array(placeholderCount)].map((_, index) => ( /*#__PURE__*/React__default.createElement(Placeholder, {
114
+ key: `placeholder_${index}`,
115
+ allColumns: allColumns,
116
+ filters: filters,
117
+ position: filters.length + index,
118
+ onCreate: handleCreateFilterFromPlaceholder,
119
+ onRemove: placeholderCount > 1 || filters.length > 0 ? handleRemovePlaceholder : undefined
120
+ }))), /*#__PURE__*/React__default.createElement("div", {
121
+ className: "justify-start"
122
+ }, /*#__PURE__*/React__default.createElement(Button, {
123
+ appearance: "discrete",
124
+ onClick: handleCreatePlaceholder
125
+ }, "+ ", texts.table3.filters.buttons.addFilter))), /*#__PURE__*/React__default.createElement(Group, {
126
+ className: "ml-auto"
127
+ }, /*#__PURE__*/React__default.createElement(Popover.Close, null, /*#__PURE__*/React__default.createElement(Button, null, "Cancel")), /*#__PURE__*/React__default.createElement(Button, {
128
+ onClick: handleClear
129
+ }, "Clear"), /*#__PURE__*/React__default.createElement(Button, {
130
+ appearance: "primary",
131
+ onClick: handleApply
132
+ }, "Apply")))));
133
+ }
134
+
135
+ export { ManageFiltersPopover };
136
+ //# sourceMappingURL=ManageFiltersPopover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ManageFiltersPopover.js","sources":["../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable } from '@tanstack/react-table';\nimport { Popover } from '../../../../../Popover/Popover';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { Button } from '../../../../../Button/Button';\nimport { Group } from '../../../../../Group/Group';\nimport { sortByHeader } from './util';\nimport { isInternalColumn } from '../../../../../../primitives/Table/useTable/util/columns';\nimport { TableFilter, TableFilterComparator, TableFilterValue } from '../../../../../../primitives/Table/types';\nimport { Filter } from './components/Filter';\nimport { Placeholder } from './components/Placeholder';\n\nexport type ManageFiltersPopoverProps<TType = unknown> = {\n length: number;\n table: ReactTable<TType>;\n};\n\nexport function ManageFiltersPopover<TType = unknown>(props: ManageFiltersPopoverProps<TType>) {\n const { length, table, ...popoverProps } = props;\n const { locale, texts } = useLocalization();\n\n const allColumns = table\n .getAllLeafColumns()\n .filter(column => !isInternalColumn(column.id))\n .sort(sortByHeader);\n\n const appliedFilters = table.getState().columnFilters as TableFilter[];\n\n // state, since we \"apply\" filters - our filter values have a special shape, so we force to our type\n const [filters, setFilters] = React.useState<TableFilter[]>(table.getState().columnFilters as TableFilter[]);\n const [placeholderCount, setPlaceholderCount] = React.useState(1);\n\n // filters might reset from the outside\n React.useEffect(() => {\n if (appliedFilters.length === 0) {\n setFilters([]);\n setPlaceholderCount(1);\n }\n }, [appliedFilters]);\n\n // filters\n const handleChangeFilter = (currentId: string | null, filter: { id: string; value: TableFilterValue }) => {\n setFilters(currentFilters => {\n const nextFilters = [...currentFilters];\n nextFilters[nextFilters.findIndex(f => f.id === currentId)] = 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: TableFilterComparator.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)?.columnDef.meta?.control;\n\n if (\n f.value.comparator === TableFilterComparator.IsEmpty ||\n f.value.comparator === TableFilterComparator.IsNotEmpty ||\n controlRenderer === 'switch'\n ) {\n return true;\n }\n\n return !!f.value.value;\n });\n\n return newFilters;\n });\n };\n\n const handleClear = () => {\n table.resetColumnFilters();\n setFilters([]);\n setPlaceholderCount(1);\n };\n\n const handleClose = () => {\n setFilters(appliedFilters);\n setPlaceholderCount(appliedFilters.length ? 0 : 1);\n };\n\n return (\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(length))}\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}\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}\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}\n"],"names":["ManageFiltersPopover","props","length","table","popoverProps","locale","texts","useLocalization","allColumns","getAllLeafColumns","filter","column","isInternalColumn","id","sort","sortByHeader","appliedFilters","getState","columnFilters","filters","setFilters","React","useState","placeholderCount","setPlaceholderCount","useEffect","handleChangeFilter","currentId","currentFilters","nextFilters","findIndex","f","handleRemoveFilter","columnId","count","handleCreateFilterFromPlaceholder","value","comparator","TableFilterComparator","Contains","undefined","handleRemovePlaceholder","handleCreatePlaceholder","handleApply","setColumnFilters","newFilters","controlRenderer","_allColumns$find","find","c","_allColumns$find$colu","columnDef","meta","control","IsEmpty","IsNotEmpty","handleClear","resetColumnFilters","handleClose","Popover","onChange","Content","className","table3","button","total","replace","Intl","NumberFormat","format","getFilteredRowModel","rows","map","index","Filter","key","position","onRemove","Array","_","Placeholder","onCreate","Button","appearance","onClick","buttons","addFilter","Group","Close"],"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U;IACtBE,MAAM,EAAEA,MAAM;IACdS,OAAO,EAAEA,OAAO;IAChByD,QAAQ,EAAEH,KAAK;IACfb,QAAQ,EAAElC,kBAAkB;IAC5BmD,QAAQ,EAAE7C;IACZ,CACL,CAAC,EACD,CAAC,GAAG8C,KAAK,CAACvD,gBAAgB,CAAC,CAAC,CAACiD,GAAG,CAAC,CAACO,CAAC,EAAEN,KAAK,oBACvCpD,6BAAC2D,WAAW;IACRL,GAAG,iBAAiBF,OAAO;IAC3BjE,UAAU,EAAEA,UAAU;IACtBW,OAAO,EAAEA,OAAO;IAChByD,QAAQ,EAAEzD,OAAO,CAACjB,MAAM,GAAGuE,KAAK;IAChCQ,QAAQ,EAAE9C,iCAAwC;IAClD0C,QAAQ,EAAEtD,gBAAgB,GAAG,CAAC,IAAIJ,OAAO,CAACjB,MAAM,GAAG,CAAC,GAAGuC,uBAAuB,GAAGD;IACnF,CACL,CAAC,eACFnB;IAAKyC,SAAS,EAAC;kBACXzC,6BAAC6D,MAAM;IAACC,UAAU,EAAC,UAAU;IAACC,OAAO,EAAE1C;WAChCpC,KAAK,CAACyD,MAAM,CAAC5C,OAAO,CAACkE,OAAO,CAACC,SAAS,CACpC,CACP,CACJ,eACNjE,6BAACkE,KAAK;IAACzB,SAAS,EAAC;kBACbzC,6BAACsC,OAAO,CAAC6B,KAAK,qBACVnE,6BAAC6D,MAAM,iBAAgB,CACX,eAChB7D,6BAAC6D,MAAM;IAACE,OAAO,EAAE5B;aAA2B,eAC5CnC,6BAAC6D,MAAM;IAACC,UAAU,EAAC,SAAS;IAACC,OAAO,EAAEzC;aAE7B,CACL,CACN,CACQ,CACZ;AAElB;;;;"}
@@ -0,0 +1,95 @@
1
+ import React__default from 'react';
2
+ import { IconButton } from '../../../../../../IconButton/IconButton.js';
3
+ import { useLocalization } from '../../../../../../Provider/Localization.js';
4
+ import { TableFilterComparator } from '../../../../../../../primitives/Table/types.js';
5
+ import { FilterColumn } from './FilterColumn.js';
6
+ import { FilterComparator } from './FilterComparator.js';
7
+ import { FilterValue } from './FilterValue.js';
8
+
9
+ function Filter(props) {
10
+ const {
11
+ allColumns,
12
+ filter,
13
+ filters,
14
+ onChange: handleChange,
15
+ onRemove,
16
+ position
17
+ } = props;
18
+ const {
19
+ texts
20
+ } = useLocalization();
21
+ const column = allColumns.find(c => c.id === filter.id);
22
+ const {
23
+ id,
24
+ value: {
25
+ comparator,
26
+ value
27
+ }
28
+ } = filter;
29
+ const handleChangeColumn = columnId => {
30
+ var _previousColumn$colum, _nextColumn$columnDef;
31
+ const previousColumn = allColumns.find(column => column.id === id);
32
+ const nextColumn = allColumns.find(column => column.id === columnId);
33
+ // UX requirement: if old column data type is the same as next column data type,
34
+ // then we applying the same filter value for the next column,
35
+ // but when data types are different, we're reseting comparator ans value for the next column
36
+ const value = (previousColumn === null || previousColumn === void 0 ? void 0 : (_previousColumn$colum = previousColumn.columnDef.meta) === null || _previousColumn$colum === void 0 ? void 0 : _previousColumn$colum.dataType) === (nextColumn === null || nextColumn === void 0 ? void 0 : (_nextColumn$columnDef = nextColumn.columnDef.meta) === null || _nextColumn$columnDef === void 0 ? void 0 : _nextColumn$columnDef.dataType) ? filter.value : {
37
+ comparator: TableFilterComparator.Contains,
38
+ value: undefined
39
+ };
40
+ handleChange(id, {
41
+ id: columnId,
42
+ value
43
+ });
44
+ };
45
+ const handleChangeComparator = comparator => {
46
+ let nextValue = filter.value.value;
47
+ if (comparator === TableFilterComparator.IsEmpty || comparator === TableFilterComparator.IsNotEmpty) {
48
+ nextValue = undefined;
49
+ }
50
+ handleChange(id, {
51
+ id,
52
+ value: {
53
+ comparator,
54
+ value: nextValue
55
+ }
56
+ });
57
+ };
58
+ const handleChangeValue = value => {
59
+ handleChange(id, {
60
+ id,
61
+ value: {
62
+ ...filter.value,
63
+ value
64
+ }
65
+ });
66
+ };
67
+ const handleRemove = () => onRemove(id);
68
+ return /*#__PURE__*/React__default.createElement("div", {
69
+ className: "flex items-start gap-2"
70
+ }, /*#__PURE__*/React__default.createElement("div", {
71
+ className: "flex min-h-[theme(spacing.8)] w-14 flex-shrink-0 items-center justify-end pr-2 text-right"
72
+ }, position > 0 ? texts.table3.filters.conditions.and : texts.table3.filters.conditions.where), /*#__PURE__*/React__default.createElement(FilterColumn, {
73
+ allColumns: allColumns,
74
+ filters: filters,
75
+ onChange: handleChangeColumn,
76
+ value: id
77
+ }), /*#__PURE__*/React__default.createElement(FilterComparator, {
78
+ column: column,
79
+ onChange: handleChangeComparator,
80
+ value: comparator
81
+ }), /*#__PURE__*/React__default.createElement(FilterValue, {
82
+ column: column,
83
+ comparator: comparator,
84
+ onChange: handleChangeValue,
85
+ value: value
86
+ }), /*#__PURE__*/React__default.createElement(IconButton, {
87
+ appearance: "discrete",
88
+ className: "ml-auto",
89
+ icon: "close",
90
+ onClick: handleRemove
91
+ }));
92
+ }
93
+
94
+ export { Filter };
95
+ //# sourceMappingURL=Filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Filter.js","sources":["../../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/components/Filter.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as ReactTableColumn } from '@tanstack/react-table';\nimport { IconButton } from '../../../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../../../Provider/Localization';\nimport { FilterColumn } from './FilterColumn';\nimport { FilterComparator } from './FilterComparator';\nimport { FilterValue } from './FilterValue';\nimport { TableFilter, TableFilterComparator } from '../../../../../../../primitives/Table/types';\n\nexport type FilterProps<TType = unknown> = {\n allColumns: ReactTableColumn<TType, unknown>[];\n filter: TableFilter;\n filters: TableFilter[];\n position: number;\n onChange: (id: string, value: TableFilter) => void;\n onRemove: (columnId: string) => void;\n};\n\nexport function Filter<TType = unknown>(props: FilterProps<TType>) {\n const { allColumns, filter, filters, onChange: handleChange, onRemove, position } = props;\n const { texts } = useLocalization();\n const column = allColumns.find(c => c.id === filter.id);\n\n const {\n id,\n value: { comparator, value },\n } = filter;\n\n const handleChangeColumn = (columnId: string) => {\n const previousColumn = allColumns.find(column => column.id === id);\n const nextColumn = allColumns.find(column => column.id === columnId);\n // UX requirement: if old column data type is the same as next column data type,\n // then we applying the same filter value for the next column,\n // but when data types are different, we're reseting comparator ans value for the next column\n const value =\n previousColumn?.columnDef.meta?.dataType === nextColumn?.columnDef.meta?.dataType\n ? filter.value\n : {\n comparator: TableFilterComparator.Contains,\n value: undefined,\n };\n\n handleChange(id, { id: columnId, value });\n };\n\n const handleChangeComparator = (comparator: TableFilterComparator) => {\n let nextValue = filter.value.value;\n\n if (comparator === TableFilterComparator.IsEmpty || comparator === TableFilterComparator.IsNotEmpty) {\n nextValue = undefined;\n }\n handleChange(id, { id, value: { comparator, value: nextValue } });\n };\n\n const handleChangeValue = (value: any) => {\n handleChange(id, { id, value: { ...filter.value, value } });\n };\n\n const handleRemove = () => onRemove(id);\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={handleChangeColumn as any} value={id} />\n <FilterComparator column={column} onChange={handleChangeComparator as any} value={comparator} />\n <FilterValue column={column} comparator={comparator} onChange={handleChangeValue} value={value} />\n <IconButton appearance=\"discrete\" className=\"ml-auto\" icon=\"close\" onClick={handleRemove} />\n </div>\n );\n}\n"],"names":["Filter","props","allColumns","filter","filters","onChange","handleChange","onRemove","position","texts","useLocalization","column","find","c","id","value","comparator","handleChangeColumn","columnId","previousColumn","nextColumn","_previousColumn$colum","columnDef","meta","dataType","_nextColumn$columnDef","TableFilterComparator","Contains","undefined","handleChangeComparator","nextValue","IsEmpty","IsNotEmpty","handleChangeValue","handleRemove","React","className","table3","conditions","and","where","FilterColumn","FilterComparator","FilterValue","IconButton","appearance","icon","onClick"],"mappings":";;;;;;;;SAkBgBA,MAAMA,CAAkBC,KAAyB;EAC7D,MAAM;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BAAqB,CAACM,UAAU,EAAE;MACjGF,SAAS,GAAGF,SAAS;;IAEzBtB,YAAY,CAACQ,EAAE,EAAE;MAAEA,EAAE;MAAEC,KAAK,EAAE;QAAEC,UAAU;QAAED,KAAK,EAAEe;;KAAa,CAAC;GACpE;EAED,MAAMG,iBAAiB,GAAIlB,KAAU;IACjCT,YAAY,CAACQ,EAAE,EAAE;MAAEA,EAAE;MAAEC,KAAK,EAAE;QAAE,GAAGZ,MAAM,CAACY,KAAK;QAAEA;;KAAS,CAAC;GAC9D;EAED,MAAMmB,YAAY,GAAGA,MAAM3B,QAAQ,CAACO,EAAE,CAAC;EAEvC,oBACIqB;IAAKC,SAAS,EAAC;kBACXD;IAAKC,SAAS,EAAC;KACV5B,QAAQ,GAAG,CAAC,GAAGC,KAAK,CAAC4B,MAAM,CAACjC,OAAO,CAACkC,UAAU,CAACC,GAAG,GAAG9B,KAAK,CAAC4B,MAAM,CAACjC,OAAO,CAACkC,UAAU,CAACE,KAAK,CACzF,eACNL,6BAACM,YAAY;IAACvC,UAAU,EAAEA,UAAU;IAAEE,OAAO,EAAEA,OAAO;IAAEC,QAAQ,EAAEY,kBAAyB;IAAEF,KAAK,EAAED;IAAM,eAC1GqB,6BAACO,gBAAgB;IAAC/B,MAAM,EAAEA,MAAM;IAAEN,QAAQ,EAAEwB,sBAA6B;IAAEd,KAAK,EAAEC;IAAc,eAChGmB,6BAACQ,WAAW;IAAChC,MAAM,EAAEA,MAAM;IAAEK,UAAU,EAAEA,UAAU;IAAEX,QAAQ,EAAE4B,iBAAiB;IAAElB,KAAK,EAAEA;IAAS,eAClGoB,6BAACS,UAAU;IAACC,UAAU,EAAC,UAAU;IAACT,SAAS,EAAC,SAAS;IAACU,IAAI,EAAC,OAAO;IAACC,OAAO,EAAEb;IAAgB,CAC1F;AAEd;;;;"}
@@ -0,0 +1,49 @@
1
+ import React__default from 'react';
2
+ import { Icon } from '../../../../../../Icon/Icon.js';
3
+ import { Tooltip } from '../../../../../../Tooltip/Tooltip.js';
4
+ import { useLocalization } from '../../../../../../Provider/Localization.js';
5
+ import { Field } from '../../../../../../Field/Field.js';
6
+ import { Select2 } from '../../../../../../Select2/Select2.js';
7
+
8
+ function FilterColumn(props) {
9
+ const {
10
+ allColumns,
11
+ filters,
12
+ onChange: handleChange,
13
+ value = null,
14
+ ...attributes
15
+ } = props;
16
+ const {
17
+ texts
18
+ } = useLocalization();
19
+ const selectedColumn = allColumns.find(column => column.id === value);
20
+ const warning = selectedColumn && !selectedColumn.getIsVisible();
21
+ return /*#__PURE__*/React__default.createElement("div", {
22
+ className: "flex flex-col"
23
+ }, /*#__PURE__*/React__default.createElement(Field, {
24
+ message: warning ? texts.table3.filters.hiddenColumn : undefined,
25
+ warning: warning,
26
+ className: "min-h-[theme(spacing.8)]"
27
+ }, /*#__PURE__*/React__default.createElement(Select2, Object.assign({}, attributes, {
28
+ className: "!w-32 flex-shrink-0",
29
+ emptyValue: null,
30
+ onChange: handleChange,
31
+ value: value
32
+ }), allColumns.map(column => {
33
+ var _column$columnDef$met, _column$parent, _column$parent$column;
34
+ return /*#__PURE__*/React__default.createElement(Select2.Option, {
35
+ key: column.id,
36
+ value: column.id,
37
+ postfix: !column.getIsVisible() || column.getIsGrouped() ? ( /*#__PURE__*/React__default.createElement(Tooltip, {
38
+ title: column.getIsGrouped() ? texts.table3.filters.hiddenGroupedColumn : texts.table3.filters.hiddenColumn
39
+ }, /*#__PURE__*/React__default.createElement(Icon, {
40
+ name: "eye-off",
41
+ className: "text-grey-500 !h-5 !w-5"
42
+ }))) : undefined,
43
+ disabled: column.id !== value && (!column.getCanFilter() || !!filters.find(f => f.id === column.id))
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
+ }))));
46
+ }
47
+
48
+ export { FilterColumn };
49
+ //# sourceMappingURL=FilterColumn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterColumn.js","sources":["../../../../../../../../../../../../src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as ReactTableColumn } 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 { TableFilter } from '../../../../../../../primitives/Table/types';\n\nexport type FilterColumnProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n allColumns: ReactTableColumn<TType, unknown>[];\n filters: TableFilter[];\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() || column.getIsGrouped() ? (\n <Tooltip\n title={\n column.getIsGrouped()\n ? texts.table3.filters.hiddenGroupedColumn\n : texts.table3.filters.hiddenColumn\n }>\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","getIsGrouped","Tooltip","title","hiddenGroupedColumn","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,YA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