@economic/taco 2.13.0 → 2.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. package/dist/components/Field/Field.d.ts +4 -2
  2. package/dist/components/Icon/components/Location.d.ts +3 -0
  3. package/dist/components/Icon/components/index.d.ts +1 -1
  4. package/dist/components/Input/Input.d.ts +1 -1
  5. package/dist/components/Menu/components/Item.d.ts +1 -1
  6. package/dist/components/Menu/components/Link.d.ts +1 -1
  7. package/dist/components/Navigation2/components/Link.d.ts +1 -1
  8. package/dist/components/Provider/Localization.d.ts +0 -113
  9. package/dist/components/Select2/components/Option.d.ts +2 -2
  10. package/dist/components/Select2/components/Search.d.ts +1 -1
  11. package/dist/components/Table3/components/columns/styles.d.ts +2 -2
  12. package/dist/components/Table3/components/toolbar/Filter/filters/components/Filter.d.ts +4 -4
  13. package/dist/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.d.ts +3 -2
  14. package/dist/components/Table3/components/toolbar/Filter/filters/components/Placeholder.d.ts +3 -2
  15. package/dist/components/Table3/components/toolbar/FontSize.d.ts +4 -0
  16. package/dist/components/Table3/hooks/useCssGrid.d.ts +2 -1
  17. package/dist/components/Table3/hooks/useTable.d.ts +1 -1
  18. package/dist/components/Table3/types.d.ts +1 -1
  19. package/dist/components/Tag/Tag.d.ts +1 -1
  20. package/dist/esm/packages/taco/src/components/Field/Field.js +6 -4
  21. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  22. package/dist/esm/packages/taco/src/components/Icon/components/Location.js +17 -0
  23. package/dist/esm/packages/taco/src/components/Icon/components/Location.js.map +1 -0
  24. package/dist/esm/packages/taco/src/components/Icon/components/index.js +2 -0
  25. package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
  26. package/dist/esm/packages/taco/src/components/Provider/Localization.js +0 -110
  27. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  28. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +1 -1
  29. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +1 -1
  31. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Select2/components/Search.js +1 -1
  33. package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Table3/Table3.js +5 -4
  35. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +2 -5
  37. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
  38. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +1 -4
  39. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  40. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
  41. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +6 -1
  42. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
  43. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +3 -2
  44. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
  45. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js +14 -2
  46. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js.map +1 -1
  47. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +2 -2
  48. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +15 -8
  49. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
  50. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Filter.js +2 -2
  51. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Filter.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js +12 -3
  53. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js.map +1 -1
  54. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +0 -1
  55. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js.map +1 -1
  56. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterValue.js +5 -3
  57. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterValue.js.map +1 -1
  58. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js +2 -2
  59. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js.map +1 -1
  60. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/FontSize.js +9 -4
  61. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/FontSize.js.map +1 -1
  62. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +2 -3
  63. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
  64. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/RowHeight.js +3 -2
  65. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/RowHeight.js.map +1 -1
  66. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js +1 -1
  67. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js +6 -7
  68. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js.map +1 -1
  69. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +48 -0
  70. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
  71. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +4 -2
  72. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
  73. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js +6 -5
  74. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js.map +1 -1
  75. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js +11 -9
  76. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js.map +1 -1
  77. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  78. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  79. package/dist/esm/packages/taco/src/index.js +1 -2
  80. package/dist/esm/packages/taco/src/index.js.map +1 -1
  81. package/dist/esm/packages/taco/src/utils/dom.js +1 -2
  82. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  83. package/dist/index.d.ts +0 -1
  84. package/dist/taco.cjs.development.js +485 -4052
  85. package/dist/taco.cjs.development.js.map +1 -1
  86. package/dist/taco.cjs.production.min.js +1 -1
  87. package/dist/taco.cjs.production.min.js.map +1 -1
  88. package/package.json +2 -2
  89. package/tailwind.config.js +3 -0
  90. package/types.json +13748 -32551
  91. package/dist/components/Table2/Table2.d.ts +0 -130
  92. package/dist/components/Table2/components/BatchActionsMenu.d.ts +0 -10
  93. package/dist/components/Table2/components/ColumnSettingsButton.d.ts +0 -6
  94. package/dist/components/Table2/components/EditModeButton.d.ts +0 -8
  95. package/dist/components/Table2/components/RowDensityButton.d.ts +0 -7
  96. package/dist/components/Table2/components/Search.d.ts +0 -3
  97. package/dist/components/Table2/components/ShortcutsGuideButton.d.ts +0 -7
  98. package/dist/components/Table2/components/column/Base.d.ts +0 -14
  99. package/dist/components/Table2/components/column/Cell.d.ts +0 -15
  100. package/dist/components/Table2/components/column/Footer.d.ts +0 -9
  101. package/dist/components/Table2/components/column/Header.d.ts +0 -11
  102. package/dist/components/Table2/components/column/Indicator.d.ts +0 -17
  103. package/dist/components/Table2/components/column/ValidationError.d.ts +0 -5
  104. package/dist/components/Table2/components/column/utils.d.ts +0 -3
  105. package/dist/components/Table2/components/filters/FiltersButton.d.ts +0 -7
  106. package/dist/components/Table2/components/filters/components/Column.d.ts +0 -11
  107. package/dist/components/Table2/components/filters/components/ColumnFilter.d.ts +0 -10
  108. package/dist/components/Table2/components/filters/components/Comparator.d.ts +0 -11
  109. package/dist/components/Table2/components/filters/components/EmptyFilter.d.ts +0 -13
  110. package/dist/components/Table2/components/filters/components/InferredControl.d.ts +0 -10
  111. package/dist/components/Table2/components/row/Context.d.ts +0 -24
  112. package/dist/components/Table2/components/row/ExpandedRow.d.ts +0 -6
  113. package/dist/components/Table2/components/row/Row.d.ts +0 -2
  114. package/dist/components/Table2/hooks/listeners/useActiveCellStateListener.d.ts +0 -3
  115. package/dist/components/Table2/hooks/listeners/useActiveRowStateListener.d.ts +0 -3
  116. package/dist/components/Table2/hooks/listeners/useColumnOffsetStateListener.d.ts +0 -3
  117. package/dist/components/Table2/hooks/listeners/useFilterStateListener.d.ts +0 -3
  118. package/dist/components/Table2/hooks/listeners/useRowSelectionListener.d.ts +0 -3
  119. package/dist/components/Table2/hooks/listeners/useSettingsStateListener.d.ts +0 -3
  120. package/dist/components/Table2/hooks/useActiveCell.d.ts +0 -26
  121. package/dist/components/Table2/hooks/useActiveRow.d.ts +0 -10
  122. package/dist/components/Table2/hooks/useColumnDefinitions.d.ts +0 -37
  123. package/dist/components/Table2/hooks/useEditMode.d.ts +0 -28
  124. package/dist/components/Table2/hooks/useGridTemplate.d.ts +0 -2
  125. package/dist/components/Table2/hooks/useTable.d.ts +0 -46
  126. package/dist/components/Table2/hooks/useTableShortcuts.d.ts +0 -2
  127. package/dist/components/Table2/hooks/useVirtualiser.d.ts +0 -23
  128. package/dist/components/Table2/types.d.ts +0 -148
  129. package/dist/components/Table2/utilities/cell.d.ts +0 -14
  130. package/dist/components/Table2/utilities/columns.d.ts +0 -16
  131. package/dist/components/Table2/utilities/filterFn.d.ts +0 -3
  132. package/dist/esm/packages/taco/src/components/Table2/Table2.js +0 -422
  133. package/dist/esm/packages/taco/src/components/Table2/Table2.js.map +0 -1
  134. package/dist/esm/packages/taco/src/components/Table2/components/BatchActionsMenu.js +0 -83
  135. package/dist/esm/packages/taco/src/components/Table2/components/BatchActionsMenu.js.map +0 -1
  136. package/dist/esm/packages/taco/src/components/Table2/components/ColumnSettingsButton.js +0 -116
  137. package/dist/esm/packages/taco/src/components/Table2/components/ColumnSettingsButton.js.map +0 -1
  138. package/dist/esm/packages/taco/src/components/Table2/components/EditModeButton.js +0 -81
  139. package/dist/esm/packages/taco/src/components/Table2/components/EditModeButton.js.map +0 -1
  140. package/dist/esm/packages/taco/src/components/Table2/components/RowDensityButton.js +0 -47
  141. package/dist/esm/packages/taco/src/components/Table2/components/RowDensityButton.js.map +0 -1
  142. package/dist/esm/packages/taco/src/components/Table2/components/Search.js +0 -62
  143. package/dist/esm/packages/taco/src/components/Table2/components/Search.js.map +0 -1
  144. package/dist/esm/packages/taco/src/components/Table2/components/column/Base.js +0 -32
  145. package/dist/esm/packages/taco/src/components/Table2/components/column/Base.js.map +0 -1
  146. package/dist/esm/packages/taco/src/components/Table2/components/column/Cell.js +0 -605
  147. package/dist/esm/packages/taco/src/components/Table2/components/column/Cell.js.map +0 -1
  148. package/dist/esm/packages/taco/src/components/Table2/components/column/Footer.js +0 -32
  149. package/dist/esm/packages/taco/src/components/Table2/components/column/Footer.js.map +0 -1
  150. package/dist/esm/packages/taco/src/components/Table2/components/column/Header.js +0 -243
  151. package/dist/esm/packages/taco/src/components/Table2/components/column/Header.js.map +0 -1
  152. package/dist/esm/packages/taco/src/components/Table2/components/column/Indicator.js +0 -73
  153. package/dist/esm/packages/taco/src/components/Table2/components/column/Indicator.js.map +0 -1
  154. package/dist/esm/packages/taco/src/components/Table2/components/column/ValidationError.js +0 -30
  155. package/dist/esm/packages/taco/src/components/Table2/components/column/ValidationError.js.map +0 -1
  156. package/dist/esm/packages/taco/src/components/Table2/components/column/utils.js +0 -39
  157. package/dist/esm/packages/taco/src/components/Table2/components/column/utils.js.map +0 -1
  158. package/dist/esm/packages/taco/src/components/Table2/components/filters/FiltersButton.js +0 -155
  159. package/dist/esm/packages/taco/src/components/Table2/components/filters/FiltersButton.js.map +0 -1
  160. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/Column.js +0 -31
  161. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/Column.js.map +0 -1
  162. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/ColumnFilter.js +0 -129
  163. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/ColumnFilter.js.map +0 -1
  164. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/Comparator.js +0 -68
  165. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/Comparator.js.map +0 -1
  166. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/EmptyFilter.js +0 -63
  167. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/EmptyFilter.js.map +0 -1
  168. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/InferredControl.js +0 -99
  169. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/InferredControl.js.map +0 -1
  170. package/dist/esm/packages/taco/src/components/Table2/components/row/Context.js +0 -58
  171. package/dist/esm/packages/taco/src/components/Table2/components/row/Context.js.map +0 -1
  172. package/dist/esm/packages/taco/src/components/Table2/components/row/ExpandedRow.js +0 -36
  173. package/dist/esm/packages/taco/src/components/Table2/components/row/ExpandedRow.js.map +0 -1
  174. package/dist/esm/packages/taco/src/components/Table2/components/row/Row.js +0 -44
  175. package/dist/esm/packages/taco/src/components/Table2/components/row/Row.js.map +0 -1
  176. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useActiveRowStateListener.js +0 -19
  177. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useActiveRowStateListener.js.map +0 -1
  178. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useColumnOffsetStateListener.js +0 -28
  179. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useColumnOffsetStateListener.js.map +0 -1
  180. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useFilterStateListener.js +0 -12
  181. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useFilterStateListener.js.map +0 -1
  182. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useRowSelectionListener.js +0 -18
  183. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useRowSelectionListener.js.map +0 -1
  184. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useSettingsStateListener.js +0 -25
  185. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useSettingsStateListener.js.map +0 -1
  186. package/dist/esm/packages/taco/src/components/Table2/hooks/useActiveRow.js +0 -33
  187. package/dist/esm/packages/taco/src/components/Table2/hooks/useActiveRow.js.map +0 -1
  188. package/dist/esm/packages/taco/src/components/Table2/hooks/useColumnDefinitions.js +0 -122
  189. package/dist/esm/packages/taco/src/components/Table2/hooks/useColumnDefinitions.js.map +0 -1
  190. package/dist/esm/packages/taco/src/components/Table2/hooks/useEditMode.js +0 -112
  191. package/dist/esm/packages/taco/src/components/Table2/hooks/useEditMode.js.map +0 -1
  192. package/dist/esm/packages/taco/src/components/Table2/hooks/useGridTemplate.js +0 -34
  193. package/dist/esm/packages/taco/src/components/Table2/hooks/useGridTemplate.js.map +0 -1
  194. package/dist/esm/packages/taco/src/components/Table2/hooks/useTable.js +0 -222
  195. package/dist/esm/packages/taco/src/components/Table2/hooks/useTable.js.map +0 -1
  196. package/dist/esm/packages/taco/src/components/Table2/hooks/useTableShortcuts.js +0 -46
  197. package/dist/esm/packages/taco/src/components/Table2/hooks/useTableShortcuts.js.map +0 -1
  198. package/dist/esm/packages/taco/src/components/Table2/hooks/useVirtualiser.js +0 -48
  199. package/dist/esm/packages/taco/src/components/Table2/hooks/useVirtualiser.js.map +0 -1
  200. package/dist/esm/packages/taco/src/components/Table2/types.js +0 -18
  201. package/dist/esm/packages/taco/src/components/Table2/types.js.map +0 -1
  202. package/dist/esm/packages/taco/src/components/Table2/utilities/cell.js +0 -41
  203. package/dist/esm/packages/taco/src/components/Table2/utilities/cell.js.map +0 -1
  204. package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js +0 -387
  205. package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js.map +0 -1
  206. package/dist/esm/packages/taco/src/components/Table2/utilities/filterFn.js +0 -100
  207. package/dist/esm/packages/taco/src/components/Table2/utilities/filterFn.js.map +0 -1
  208. package/dist/esm/packages/taco/src/components/Truncate/Truncate.js +0 -32
  209. package/dist/esm/packages/taco/src/components/Truncate/Truncate.js.map +0 -1
  210. package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js +0 -20
  211. package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js.map +0 -1
@@ -5,6 +5,7 @@ import { useLocalization } from '../../../../Provider/Localization.js';
5
5
  import { Menu as Menu$1 } from '../../../../Menu/Menu.js';
6
6
  import { _finallyRethrows, _catch } from '../../../../../../../../node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js';
7
7
  import { GotoPopover } from './Goto.js';
8
+ import { FONT_SIZE } from '../../toolbar/FontSize.js';
8
9
  import { SORT_DIRECTION } from './Header.js';
9
10
  import { isInternalColumn } from '../../../util/columns.js';
10
11
 
@@ -43,6 +44,7 @@ function Menu(props) {
43
44
  } = useLocalization();
44
45
  const [popover, setPopover] = React__default.useState(undefined);
45
46
  const [sortDirectionState, setSortDirectionState] = React__default.useState(sortDirection);
47
+ const isFontSizeLarge = tableMeta.fontSize.size === FONT_SIZE.large;
46
48
  const handleSortMenuRadioGroupChange = newSortDirection => {
47
49
  setSortDirectionState(newSortDirection);
48
50
  handleSortToggle(newSortDirection);
@@ -85,7 +87,10 @@ function Menu(props) {
85
87
  }
86
88
  }
87
89
  const className = cn('-my-0.5 -mr-1 -ml-0.5 !h-6 !min-h-[theme(spacing.6)] flex-shrink-0 justify-end !w-0 !min-w-0 !overflow-hidden', 'aria-expanded:!min-w-[theme(spacing.6)] aria-expanded:!w-6 aria-expanded:!overflow-auto', 'focus:!min-w-[theme(spacing.6)] focus:!w-6 focus:!overflow-auto', 'group-hover/column:!min-w-[theme(spacing.6)] group-hover/column:!w-6 group-hover/column:!overflow-auto', {
88
- '!w-6 !min-w-[theme(spacing.6)] !overflow-auto': !!popoverElement
90
+ '!w-6 !min-w-[theme(spacing.6)] !overflow-auto': !!popoverElement,
91
+ // Icon inside button uses em values therefore text-sm is required to prevent icon from overflowing
92
+ // button's boundaries
93
+ '!text-sm': isFontSizeLarge
89
94
  }, props.className);
90
95
  const memoedMenuItems = React__default.useMemo(() => {
91
96
  const menuItems = [];
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Menu.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Header as RTHeader, Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Menu as MenuPrimitive } from '../../../../Menu/Menu';\nimport { isInternalColumn } from '../../../util/columns';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Table3ColumnHeaderMenu, TableStrategy } from '../../../types';\nimport { GotoPopover } from './Goto';\nimport { HeaderSortDirection, SORT_DIRECTION, SortToggleHandler } from './Header';\nimport { RadioGroupItemValue } from '../../../../RadioGroup/RadioGroup';\n\nexport function isGotoAvailable<TType = unknown>(table: RTable<TType>, header: RTHeader<TType, unknown>) {\n if (isInternalColumn(header.id)) {\n return false;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return !!(tableMeta.rowGoto.isEnabled && header.column.getCanSort() && header.column.getIsSorted());\n}\n\nexport function isMenuAvailable<TType = unknown>(table: RTable<TType>, header: RTHeader<TType, unknown>): boolean {\n if (isInternalColumn(header.id)) {\n return false;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return (\n !!header.column.columnDef.meta?.menu ||\n !!tableMeta.columnFreezing.isEnabled ||\n (!!table.options.enableHiding && !!header.column.getCanHide()) ||\n isGotoAvailable(table, header)\n );\n}\n\nexport type MenuProps<TType = unknown> = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n canFreeze: boolean;\n canHide: boolean;\n canSort: boolean;\n index: number;\n menu?: Table3ColumnHeaderMenu;\n onGoto?: (query: string) => Promise<number>;\n onHide: (event: unknown) => void;\n onSortToggle: SortToggleHandler;\n scrollToIndex: TableStrategy['scrollToIndex'];\n sortDirection: HeaderSortDirection;\n table: RTable<TType>;\n};\n\nexport function Menu<TType = unknown>(props: MenuProps<TType>) {\n const {\n canFreeze,\n canHide,\n canSort,\n index,\n menu,\n onGoto: handleGoto,\n onHide: handleHide,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n sortDirection,\n table,\n } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n const { texts } = useLocalization();\n const [popover, setPopover] = React.useState<string | undefined>(undefined);\n const [sortDirectionState, setSortDirectionState] = React.useState<HeaderSortDirection>(sortDirection);\n\n const handleSortMenuRadioGroupChange = (newSortDirection: RadioGroupItemValue) => {\n setSortDirectionState(newSortDirection as HeaderSortDirection);\n handleSortToggle(newSortDirection as HeaderSortDirection);\n };\n\n let popoverElement;\n\n if (popover) {\n const handleClosePopover = () => setPopover(undefined);\n\n switch (popover) {\n case 'goto': {\n if (handleGoto) {\n const goto = async (query: string) => {\n try {\n const index = await handleGoto(query);\n tableMeta.currentRow.setCurrentRowIndex(index);\n scrollToIndex(index + 2, { align: 'center' });\n } catch {\n //\n } finally {\n handleClosePopover();\n }\n };\n popoverElement = props => <GotoPopover {...props} open onChange={handleClosePopover} onGoto={goto} />;\n }\n }\n }\n }\n\n const className = cn(\n '-my-0.5 -mr-1 -ml-0.5 !h-6 !min-h-[theme(spacing.6)] flex-shrink-0 justify-end !w-0 !min-w-0 !overflow-hidden',\n 'aria-expanded:!min-w-[theme(spacing.6)] aria-expanded:!w-6 aria-expanded:!overflow-auto',\n 'focus:!min-w-[theme(spacing.6)] focus:!w-6 focus:!overflow-auto',\n 'group-hover/column:!min-w-[theme(spacing.6)] group-hover/column:!w-6 group-hover/column:!overflow-auto',\n {\n '!w-6 !min-w-[theme(spacing.6)] !overflow-auto': !!popoverElement,\n },\n props.className\n );\n\n const memoedMenuItems = React.useMemo(() => {\n const menuItems: JSX.Element[] = [];\n\n if (canHide) {\n // we do this in the next tick, otherwise the menu closes and react throws a \"state update on unmounted component\" error\n const handleClick = event => setTimeout(() => handleHide(event), 1);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"eye-off\" onClick={handleClick}>\n {texts.table3.columns.menu.hideColumn}\n </MenuPrimitive.Item>\n );\n }\n\n // We rely on canSort value instead of onSort function's value because some columns might have sorting disabled,\n // so even though onSort is truthy, we don't want to show sorting menu.\n if (canSort) {\n menuItems.push(\n <MenuPrimitive.Item\n icon=\"sort-by\"\n subMenu={() => (\n <MenuPrimitive.SubMenu>\n <MenuPrimitive.RadioGroup onChange={handleSortMenuRadioGroupChange} value={sortDirectionState}>\n <MenuPrimitive.RadioGroup.Item value={SORT_DIRECTION.ASC}>\n {texts.table3.columns.menu.sortingOrder.ascending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={SORT_DIRECTION.DESC}>\n {texts.table3.columns.menu.sortingOrder.descending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={false}>\n {texts.table3.columns.menu.sortingOrder.unsorted}\n </MenuPrimitive.RadioGroup.Item>\n </MenuPrimitive.RadioGroup>\n </MenuPrimitive.SubMenu>\n )}>\n {texts.table3.columns.menu.sorting}\n </MenuPrimitive.Item>\n );\n }\n\n if (handleGoto) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"move\" onClick={() => setPopover('goto')} shortcut=\"g\">\n {texts.table3.columns.menu.gotoRow}...\n </MenuPrimitive.Item>\n );\n }\n\n if (canFreeze) {\n const frozenIndex = index - tableMeta.columnFreezing.frozenInternalColumnCount;\n const handleClick = () => tableMeta.columnFreezing.setFrozenColumnIndex(frozenIndex);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-freeze\" onClick={handleClick}>\n {frozenIndex === 0\n ? texts.table3.columns.menu.freezeFirstColumn\n : texts.table3.columns.menu.freezeUptoColumn.replace('[TOTAL]', String(frozenIndex + 1))}\n </MenuPrimitive.Item>\n );\n\n if (tableMeta.columnFreezing.frozenColumnIndex !== undefined) {\n const handleClick = () => {\n tableMeta.columnFreezing.setFrozenColumnIndex(undefined);\n };\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-unfreeze\" onClick={handleClick}>\n {texts.table3.columns.menu.unfreezeColumns}\n </MenuPrimitive.Item>\n );\n }\n }\n\n if (menu) {\n const customMenu = menu({ trigger: undefined });\n const customItems = React.Children.toArray(customMenu.props.children.props.children) as JSX.Element[];\n\n if (customItems.length) {\n if (menuItems.length) {\n menuItems.push(<MenuPrimitive.Separator />);\n }\n\n menuItems.push(...customItems);\n }\n }\n\n return menuItems.map((item, key) => React.cloneElement(item, { key }));\n }, [\n menu,\n index,\n canFreeze,\n canHide,\n canSort,\n handleGoto,\n handleSortToggle,\n sortDirection,\n tableMeta.columnFreezing.frozenColumnIndex,\n ]);\n\n return (\n <IconButton\n className={className}\n icon=\"more\"\n menu={\n popoverElement\n ? undefined\n : menuProps => (\n <MenuPrimitive {...menuProps}>\n <MenuPrimitive.Content>{memoedMenuItems}</MenuPrimitive.Content>\n </MenuPrimitive>\n )\n }\n popover={popoverElement}\n onClickCapture={event => event.preventDefault()}\n />\n );\n}\n"],"names":["isGotoAvailable","table","header","isInternalColumn","id","tableMeta","options","meta","rowGoto","isEnabled","column","getCanSort","getIsSorted","isMenuAvailable","_header$column$column","columnDef","menu","columnFreezing","enableHiding","getCanHide","Menu","props","canFreeze","canHide","canSort","index","onGoto","handleGoto","onHide","handleHide","onSortToggle","handleSortToggle","scrollToIndex","sortDirection","texts","useLocalization","popover","setPopover","React","useState","undefined","sortDirectionState","setSortDirectionState","handleSortMenuRadioGroupChange","newSortDirection","popoverElement","handleClosePopover","goto","query","Promise","resolve","then","currentRow","setCurrentRowIndex","align","_wasThrown","_result","_temp","e","reject","GotoPopover","open","onChange","className","cn","memoedMenuItems","useMemo","menuItems","handleClick","event","setTimeout","push","MenuPrimitive","Item","icon","onClick","table3","columns","hideColumn","subMenu","SubMenu","RadioGroup","value","SORT_DIRECTION","ASC","sortingOrder","ascending","DESC","descending","unsorted","sorting","shortcut","gotoRow","frozenIndex","frozenInternalColumnCount","setFrozenColumnIndex","freezeFirstColumn","freezeUptoColumn","replace","String","frozenColumnIndex","unfreezeColumns","customMenu","trigger","customItems","Children","toArray","children","length","Separator","map","item","key","cloneElement","IconButton","menuProps","Content","onClickCapture","preventDefault"],"mappings":";;;;;;;;;;SAYgBA,eAAeA,CAAkBC,KAAoB,EAAEC,MAAgC;EACnG,IAAIC,gBAAgB,CAACD,MAAM,CAACE,EAAE,CAAC,EAAE;IAC7B,OAAO,KAAK;;EAGhB,MAAMC,SAAS,GAAGJ,KAAK,CAACK,OAAO,CAACC,IAAwB;EAExD,OAAO,CAAC,EAAEF,SAAS,CAACG,OAAO,CAACC,SAAS,IAAIP,MAAM,CAACQ,MAAM,CAACC,UAAU,EAAE,IAAIT,MAAM,CAACQ,MAAM,CAACE,WAAW,EAAE,CAAC;AACvG;SAEgBC,eAAeA,CAAkBZ,KAAoB,EAAEC,MAAgC;;EACnG,IAAIC,gBAAgB,CAACD,MAAM,CAACE,EAAE,CAAC,EAAE;IAC7B,OAAO,KAAK;;EAGhB,MAAMC,SAAS,GAAGJ,KAAK,CAACK,OAAO,CAACC,IAAwB;EAExD,OACI,CAAC,GAAAO,qBAAA,GAACZ,MAAM,CAACQ,MAAM,CAACK,SAAS,CAACR,IAAI,cAAAO,qBAAA,eAA5BA,qBAAA,CAA8BE,IAAI,KACpC,CAAC,CAACX,SAAS,CAACY,cAAc,CAACR,SAAS,IACnC,CAAC,CAACR,KAAK,CAACK,OAAO,CAACY,YAAY,IAAI,CAAC,CAAChB,MAAM,CAACQ,MAAM,CAACS,UAAU,EAAG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oBACI9D,6BAAC4E,UAAU;IACPnD,SAAS,EAAEA,SAAS;IACpBW,IAAI,EAAC,MAAM;IACX1D,IAAI,EACA6B,cAAc,GACRL,SAAS,GACT2E,SAAS,iBACL7E,6BAACkC,MAAa,oBAAK2C,SAAS,gBACxB7E,6BAACkC,MAAa,CAAC4C,OAAO,QAAEnD,eAAe,CAAyB,CAEvE;IAEX7B,OAAO,EAAES,cAAc;IACvBwE,cAAc,EAAEhD,KAAK,IAAIA,KAAK,CAACiD,cAAc;IAC/C;AAEV;;;;"}
1
+ {"version":3,"file":"Menu.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/header/Menu.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Header as RTHeader, Table as RTable, TableMeta } from '@tanstack/react-table';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { Menu as MenuPrimitive } from '../../../../Menu/Menu';\nimport { isInternalColumn } from '../../../util/columns';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Table3ColumnHeaderMenu, TableStrategy } from '../../../types';\nimport { GotoPopover } from './Goto';\nimport { HeaderSortDirection, SORT_DIRECTION, SortToggleHandler } from './Header';\nimport { RadioGroupItemValue } from '../../../../RadioGroup/RadioGroup';\nimport { FONT_SIZE } from '../../toolbar/FontSize';\n\nexport function isGotoAvailable<TType = unknown>(table: RTable<TType>, header: RTHeader<TType, unknown>) {\n if (isInternalColumn(header.id)) {\n return false;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return !!(tableMeta.rowGoto.isEnabled && header.column.getCanSort() && header.column.getIsSorted());\n}\n\nexport function isMenuAvailable<TType = unknown>(table: RTable<TType>, header: RTHeader<TType, unknown>): boolean {\n if (isInternalColumn(header.id)) {\n return false;\n }\n\n const tableMeta = table.options.meta as TableMeta<TType>;\n\n return (\n !!header.column.columnDef.meta?.menu ||\n !!tableMeta.columnFreezing.isEnabled ||\n (!!table.options.enableHiding && !!header.column.getCanHide()) ||\n isGotoAvailable(table, header)\n );\n}\n\nexport type MenuProps<TType = unknown> = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n canFreeze: boolean;\n canHide: boolean;\n canSort: boolean;\n index: number;\n menu?: Table3ColumnHeaderMenu;\n onGoto?: (query: string) => Promise<number>;\n onHide: (event: unknown) => void;\n onSortToggle: SortToggleHandler;\n scrollToIndex: TableStrategy['scrollToIndex'];\n sortDirection: HeaderSortDirection;\n table: RTable<TType>;\n};\n\nexport function Menu<TType = unknown>(props: MenuProps<TType>) {\n const {\n canFreeze,\n canHide,\n canSort,\n index,\n menu,\n onGoto: handleGoto,\n onHide: handleHide,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n sortDirection,\n table,\n } = props;\n const tableMeta = table.options.meta as TableMeta<TType>;\n const { texts } = useLocalization();\n const [popover, setPopover] = React.useState<string | undefined>(undefined);\n const [sortDirectionState, setSortDirectionState] = React.useState<HeaderSortDirection>(sortDirection);\n\n const isFontSizeLarge = tableMeta.fontSize.size === FONT_SIZE.large;\n\n const handleSortMenuRadioGroupChange = (newSortDirection: RadioGroupItemValue) => {\n setSortDirectionState(newSortDirection as HeaderSortDirection);\n handleSortToggle(newSortDirection as HeaderSortDirection);\n };\n\n let popoverElement;\n\n if (popover) {\n const handleClosePopover = () => setPopover(undefined);\n\n switch (popover) {\n case 'goto': {\n if (handleGoto) {\n const goto = async (query: string) => {\n try {\n const index = await handleGoto(query);\n tableMeta.currentRow.setCurrentRowIndex(index);\n scrollToIndex(index + 2, { align: 'center' });\n } catch {\n //\n } finally {\n handleClosePopover();\n }\n };\n popoverElement = props => <GotoPopover {...props} open onChange={handleClosePopover} onGoto={goto} />;\n }\n }\n }\n }\n\n const className = cn(\n '-my-0.5 -mr-1 -ml-0.5 !h-6 !min-h-[theme(spacing.6)] flex-shrink-0 justify-end !w-0 !min-w-0 !overflow-hidden',\n 'aria-expanded:!min-w-[theme(spacing.6)] aria-expanded:!w-6 aria-expanded:!overflow-auto',\n 'focus:!min-w-[theme(spacing.6)] focus:!w-6 focus:!overflow-auto',\n 'group-hover/column:!min-w-[theme(spacing.6)] group-hover/column:!w-6 group-hover/column:!overflow-auto',\n {\n '!w-6 !min-w-[theme(spacing.6)] !overflow-auto': !!popoverElement,\n // Icon inside button uses em values therefore text-sm is required to prevent icon from overflowing\n // button's boundaries\n '!text-sm': isFontSizeLarge,\n },\n props.className\n );\n\n const memoedMenuItems = React.useMemo(() => {\n const menuItems: JSX.Element[] = [];\n\n if (canHide) {\n // we do this in the next tick, otherwise the menu closes and react throws a \"state update on unmounted component\" error\n const handleClick = event => setTimeout(() => handleHide(event), 1);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"eye-off\" onClick={handleClick}>\n {texts.table3.columns.menu.hideColumn}\n </MenuPrimitive.Item>\n );\n }\n\n // We rely on canSort value instead of onSort function's value because some columns might have sorting disabled,\n // so even though onSort is truthy, we don't want to show sorting menu.\n if (canSort) {\n menuItems.push(\n <MenuPrimitive.Item\n icon=\"sort-by\"\n subMenu={() => (\n <MenuPrimitive.SubMenu>\n <MenuPrimitive.RadioGroup onChange={handleSortMenuRadioGroupChange} value={sortDirectionState}>\n <MenuPrimitive.RadioGroup.Item value={SORT_DIRECTION.ASC}>\n {texts.table3.columns.menu.sortingOrder.ascending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={SORT_DIRECTION.DESC}>\n {texts.table3.columns.menu.sortingOrder.descending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={false}>\n {texts.table3.columns.menu.sortingOrder.unsorted}\n </MenuPrimitive.RadioGroup.Item>\n </MenuPrimitive.RadioGroup>\n </MenuPrimitive.SubMenu>\n )}>\n {texts.table3.columns.menu.sorting}\n </MenuPrimitive.Item>\n );\n }\n\n if (handleGoto) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"move\" onClick={() => setPopover('goto')} shortcut=\"g\">\n {texts.table3.columns.menu.gotoRow}...\n </MenuPrimitive.Item>\n );\n }\n\n if (canFreeze) {\n const frozenIndex = index - tableMeta.columnFreezing.frozenInternalColumnCount;\n const handleClick = () => tableMeta.columnFreezing.setFrozenColumnIndex(frozenIndex);\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-freeze\" onClick={handleClick}>\n {frozenIndex === 0\n ? texts.table3.columns.menu.freezeFirstColumn\n : texts.table3.columns.menu.freezeUptoColumn.replace('[TOTAL]', String(frozenIndex + 1))}\n </MenuPrimitive.Item>\n );\n\n if (tableMeta.columnFreezing.frozenColumnIndex !== undefined) {\n const handleClick = () => {\n tableMeta.columnFreezing.setFrozenColumnIndex(undefined);\n };\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-unfreeze\" onClick={handleClick}>\n {texts.table3.columns.menu.unfreezeColumns}\n </MenuPrimitive.Item>\n );\n }\n }\n\n if (menu) {\n const customMenu = menu({ trigger: undefined });\n const customItems = React.Children.toArray(customMenu.props.children.props.children) as JSX.Element[];\n\n if (customItems.length) {\n if (menuItems.length) {\n menuItems.push(<MenuPrimitive.Separator />);\n }\n\n menuItems.push(...customItems);\n }\n }\n\n return menuItems.map((item, key) => React.cloneElement(item, { key }));\n }, [\n menu,\n index,\n canFreeze,\n canHide,\n canSort,\n handleGoto,\n handleSortToggle,\n sortDirection,\n tableMeta.columnFreezing.frozenColumnIndex,\n ]);\n\n return (\n <IconButton\n className={className}\n icon=\"more\"\n menu={\n popoverElement\n ? undefined\n : menuProps => (\n <MenuPrimitive {...menuProps}>\n <MenuPrimitive.Content>{memoedMenuItems}</MenuPrimitive.Content>\n </MenuPrimitive>\n )\n }\n popover={popoverElement}\n onClickCapture={event => event.preventDefault()}\n />\n );\n}\n"],"names":["isGotoAvailable","table","header","isInternalColumn","id","tableMeta","options","meta","rowGoto","isEnabled","column","getCanSort","getIsSorted","isMenuAvailable","_header$column$column","columnDef","menu","columnFreezing","enableHiding","getCanHide","Menu","props","canFreeze","canHide","canSort","index","onGoto","handleGoto","onHide","handleHide","onSortToggle","handleSortToggle","scrollToIndex","sortDirection","texts","useLocalization","popover","setPopover","React","useState","undefined","sortDirectionState","setSortDirectionState","isFontSizeLarge","fontSize","size","FONT_SIZE","large","handleSortMenuRadioGroupChange","newSortDirection","popoverElement","handleClosePopover","goto","query","Promise","resolve","then","currentRow","setCurrentRowIndex","align","_wasThrown","_result","_temp","e","reject","GotoPopover","open","onChange","className","cn","memoedMenuItems","useMemo","menuItems","handleClick","event","setTimeout","push","MenuPrimitive","Item","icon","onClick","table3","columns","hideColumn","subMenu","SubMenu","RadioGroup","value","SORT_DIRECTION","ASC","sortingOrder","ascending","DESC","descending","unsorted","sorting","shortcut","gotoRow","frozenIndex","frozenInternalColumnCount","setFrozenColumnIndex","freezeFirstColumn","freezeUptoColumn","replace","String","frozenColumnIndex","unfreezeColumns","customMenu","trigger","customItems","Children","toArray","children","length","Separator","map","item","key","cloneElement","IconButton","menuProps","Content","onClickCapture","preventDefault"],"mappings":";;;;;;;;;;;SAagBA,eAAeA,CAAkBC,KAAoB,EAAEC,MAAgC;EACnG,IAAIC,gBAAgB,CAACD,MAAM,CAACE,EAAE,CAAC,EAAE;IAC7B,OAAO,KAAK;;EAGhB,MAAMC,SAAS,GAAGJ,KAAK,CAACK,OAAO,CAACC,IAAwB;EAExD,OAAO,CAAC,EAAEF,SAAS,CAACG,OAAO,CAACC,SAAS,IAAIP,MAAM,CAACQ,MAAM,CAACC,UAAU,EAAE,IAAIT,MAAM,CAACQ,MAAM,CAACE,WAAW,EAAE,CAAC;AACvG;SAEgBC,eAAeA,CAAkBZ,KAAoB,EAAEC,MAAgC;;EACnG,IAAIC,gBAAgB,CAACD,MAAM,CAACE,EAAE,CAAC,EAAE;IAC7B,OAAO,KAAK;;EAGhB,MAAMC,SAAS,GAAGJ,KAAK,CAACK,OAAO,CAACC,IAAwB;EAExD,OACI,CAAC,GAAAO,qBAAA,GAACZ,MAAM,CAACQ,MAAM,CAACK,SAAS,CAACR,IAAI,cAAAO,qBAAA,eAA5BA,qBAAA,CAA8BE,I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C,CAACC,IAAI,EAAEC,GAAG,kBAAK/E,cAAK,CAACgF,YAAY,CAACF,IAAI,EAAE;MAAEC;KAAK,CAAC,CAAC;GACzE,EAAE,CACCrG,IAAI,EACJS,KAAK,EACLH,SAAS,EACTC,OAAO,EACPC,OAAO,EACPG,UAAU,EACVI,gBAAgB,EAChBE,aAAa,EACb5B,SAAS,CAACY,cAAc,CAACwF,iBAAiB,CAC7C,CAAC;EAEF,oBACInE,6BAACiF,UAAU;IACPnD,SAAS,EAAEA,SAAS;IACpBW,IAAI,EAAC,MAAM;IACX/D,IAAI,EACAkC,cAAc,GACRV,SAAS,GACTgF,SAAS,iBACLlF,6BAACuC,MAAa,oBAAK2C,SAAS,gBACxBlF,6BAACuC,MAAa,CAAC4C,OAAO,QAAEnD,eAAe,CAAyB,CAEvE;IAEXlC,OAAO,EAAEc,cAAc;IACvBwE,cAAc,EAAEhD,KAAK,IAAIA,KAAK,CAACiD,cAAc;IAC/C;AAEV;;;;"}
@@ -4,6 +4,7 @@ import { IconButton } from '../../../../IconButton/IconButton.js';
4
4
  import { useLocalization } from '../../../../Provider/Localization.js';
5
5
  import { Shortcut } from '../../../../Shortcut/Shortcut.js';
6
6
  import { Menu } from '../../../../Menu/Menu.js';
7
+ import { FONT_SIZE } from '../../toolbar/FontSize.js';
7
8
  import { Header } from '../header/Header.js';
8
9
  import { RowContext } from '../../rows/RowContext.js';
9
10
  import { DisplayCell } from '../cell/DisplayCell.js';
@@ -51,8 +52,8 @@ const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
51
52
  const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
52
53
  const className = cn('-mb-2 flex justify-end pl-2 text-right', {
53
54
  // Adjust negative margin on row actions cell to ensure that the cell aligns vertically.
54
- '-mt-2': fontSize === 'small',
55
- '-mt-1.5': fontSize !== 'small'
55
+ '-mt-2': fontSize === FONT_SIZE.small,
56
+ '-mt-1.5': fontSize !== FONT_SIZE.small
56
57
  });
57
58
  content = /*#__PURE__*/React__default.createElement("span", {
58
59
  className: className,
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Actions.tsx"],"sourcesContent":["import React from 'react';\nimport { CellContext, DisplayColumnDef, TableMeta } from '@tanstack/react-table';\nimport cn from 'classnames';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Table3FontSize, Table3RowActionRenderer } from '../../../types';\nimport { RowContext } from '../../rows/RowContext';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Menu } from '../../../../Menu/Menu';\nimport { Shortcut } from '../../../../Shortcut/Shortcut';\nimport { Footer } from '../footer/Footer';\n\nexport const COLUMN_ID = '__actions';\n\ntype MemoedCellProps<TType = unknown> = CellContext<TType, unknown> & {\n actions?: Table3RowActionRenderer<TType>[];\n actionsLength: number;\n fontSize: Table3FontSize;\n isCurrentRow: boolean;\n isEditing: boolean;\n isResizingColumn: boolean;\n isHoverStatePaused: boolean;\n};\n\nconst MemoedCell = React.memo(function MemoedCell<TType = unknown>(props: MemoedCellProps<TType>) {\n const { actions, actionsLength, fontSize, isCurrentRow, isEditing, isResizingColumn, isHoverStatePaused, row } = props;\n const { isHovered } = React.useContext(RowContext);\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLSpanElement | null>(null);\n /*\n const size = table.getState().columnSizing[COLUMN_ID];\n\n // the actions column needs to set its size based on its content, not the actual column\n // so we do this here instead of in the header\n React.useLayoutEffect(() => {\n if (ref.current && !size) {\n const width = ref.current.getBoundingClientRect().width;\n\n table.setColumnSizing(sizes => ({\n ...sizes,\n [COLUMN_ID]: width,\n }));\n }\n }, [ref.current]);\n */\n\n let content;\n\n // We don't want to show actions in edit mode, since we have editing actions,\n // which is shown in edit mode instead.\n if (actions?.length && !isEditing && (isCurrentRow || (isHovered && !isHoverStatePaused && !isResizingColumn))) {\n const visibleActions = actions.map(action => action(row.original)).filter(action => !!action) as JSX.Element[];\n\n const actionsOnRow =\n visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);\n const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);\n\n const className = cn('-mb-2 flex justify-end pl-2 text-right', {\n // Adjust negative margin on row actions cell to ensure that the cell aligns vertically.\n '-mt-2': fontSize === 'small',\n '-mt-1.5': fontSize !== 'small',\n });\n\n content = (\n <span className={className} ref={ref}>\n {actionsOnRow.map((button, index) => {\n const tooltip = String(button.props.tooltip ?? button.props['aria-label'] ?? '');\n\n return React.cloneElement(button, {\n appearance: 'transparent',\n key: index,\n tabIndex: isCurrentRow ? 0 : -1,\n tooltip: button.props.shortcut ? (\n <>\n {tooltip}\n <Shortcut className=\"ml-2\" keys={button.props.shortcut} />\n </>\n ) : (\n tooltip\n ),\n });\n })}\n {actionsInMenu.length ? (\n <IconButton\n appearance=\"transparent\"\n aria-label={texts.table3.columns.actions.tooltip}\n icon=\"more\"\n tabIndex={isCurrentRow ? 0 : -1}\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content>\n {actionsInMenu.map((action, i) => (\n <Menu.Item key={i} {...action.props} shortcut={action.props.shortcut}>\n {action.props['aria-label']}\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu>\n )}\n />\n ) : null}\n </span>\n );\n }\n\n return <DisplayCell {...props}>{content}</DisplayCell>;\n}) as <TType = unknown>(props: MemoedCellProps<TType>) => JSX.Element;\n\ntype CellProps<TType = unknown> = CellContext<TType, unknown>;\n\nfunction Cell<TType = unknown>(context: CellProps<TType>) {\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as TableMeta<TType>;\n\n return (\n <MemoedCell\n {...context}\n actions={tableMeta.rowActions.actionsForRow}\n actionsLength={tableMeta.rowActions.actionsForRowLength}\n fontSize={tableMeta.fontSize.size}\n isCurrentRow={tableMeta.currentRow.currentRowIndex === rowIndex}\n isEditing={tableMeta.editing.isEditing}\n isResizingColumn={!!context.table.getState().columnSizingInfo.isResizingColumn}\n isHoverStatePaused={!!tableMeta.hoverState.isPaused}\n />\n );\n}\n\nexport function createRowActionsColumn<TType = unknown>(): DisplayColumnDef<TType, unknown> {\n return {\n id: COLUMN_ID,\n header: ColumnHeader,\n cell: Cell,\n footer: Footer,\n meta: {\n align: 'right',\n className: cn(\n '!pt-[var(--table3-cell-padding-y)] print:opacity-0 [[role=\"table\"][data-editing=\"false\"]_&]:group-[[data-current=\"true\"]]/row:sticky [[role=\"table\"][data-pause-hover=\"false\"][data-editing=\"false\"]_&]:group-hover/row:sticky right-0 !pl-1 !pr-1',\n 'shadow-[-6px_0px_6px_var(--table3-row-actions-shadow)]',\n 'group-[[data-current=\"true\"][data-selected=\"false\"]]/row:text-grey-200',\n 'group-[[data-selected=\"true\"]]/row:text-blue-100',\n 'group-[[data-selected=\"false\"]:hover]/row:text-grey-100'\n ),\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: 'items-center !p-0',\n },\n // options\n enableResizing: false,\n };\n}\n"],"names":["COLUMN_ID","MemoedCell","React","memo","props","actions","actionsLength","fontSize","isCurrentRow","isEditing","isResizingColumn","isHoverStatePaused","row","isHovered","useContext","RowContext","texts","useLocalization","ref","useRef","content","length","visibleActions","map","action","original","filter","actionsOnRow","slice","actionsInMenu","className","cn","button","index","tooltip","String","_ref","_button$props$tooltip","cloneElement","appearance","key","tabIndex","shortcut","Shortcut","keys","IconButton","table3","columns","icon","menu","menuProps","Menu","Content","i","Item","DisplayCell","Cell","context","rowIndex","tableMeta","table","options","meta","rowActions","actionsForRow","actionsForRowLength","size","currentRow","currentRowIndex","editing","getState","columnSizingInfo","hoverState","isPaused","createRowActionsColumn","id","header","ColumnHeader","cell","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing"],"mappings":";;;;;;;;;;;MAaaA,SAAS,GAAG;AAYzB,M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E;KACpB;;IAEDC,cAAc,EAAE;GACnB;AACL;;;;"}
1
+ {"version":3,"file":"Actions.js","sources":["../../../../../../../../../../src/components/Table3/components/columns/internal/Actions.tsx"],"sourcesContent":["import React from 'react';\nimport { CellContext, DisplayColumnDef, TableMeta } from '@tanstack/react-table';\nimport cn from 'classnames';\nimport { Header as ColumnHeader } from '../header/Header';\nimport { DisplayCell } from '../cell/DisplayCell';\nimport { Table3FontSize, Table3RowActionRenderer } from '../../../types';\nimport { RowContext } from '../../rows/RowContext';\nimport { IconButton } from '../../../../IconButton/IconButton';\nimport { useLocalization } from '../../../../Provider/Localization';\nimport { Menu } from '../../../../Menu/Menu';\nimport { Shortcut } from '../../../../Shortcut/Shortcut';\nimport { Footer } from '../footer/Footer';\nimport { FONT_SIZE } from '../../toolbar/FontSize';\n\nexport const COLUMN_ID = '__actions';\n\ntype MemoedCellProps<TType = unknown> = CellContext<TType, unknown> & {\n actions?: Table3RowActionRenderer<TType>[];\n actionsLength: number;\n fontSize: Table3FontSize;\n isCurrentRow: boolean;\n isEditing: boolean;\n isResizingColumn: boolean;\n isHoverStatePaused: boolean;\n};\n\nconst MemoedCell = React.memo(function MemoedCell<TType = unknown>(props: MemoedCellProps<TType>) {\n const { actions, actionsLength, fontSize, isCurrentRow, isEditing, isResizingColumn, isHoverStatePaused, row } = props;\n const { isHovered } = React.useContext(RowContext);\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLSpanElement | null>(null);\n /*\n const size = table.getState().columnSizing[COLUMN_ID];\n\n // the actions column needs to set its size based on its content, not the actual column\n // so we do this here instead of in the header\n React.useLayoutEffect(() => {\n if (ref.current && !size) {\n const width = ref.current.getBoundingClientRect().width;\n\n table.setColumnSizing(sizes => ({\n ...sizes,\n [COLUMN_ID]: width,\n }));\n }\n }, [ref.current]);\n */\n\n let content;\n\n // We don't want to show actions in edit mode, since we have editing actions,\n // which is shown in edit mode instead.\n if (actions?.length && !isEditing && (isCurrentRow || (isHovered && !isHoverStatePaused && !isResizingColumn))) {\n const visibleActions = actions.map(action => action(row.original)).filter(action => !!action) as JSX.Element[];\n\n const actionsOnRow =\n visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);\n const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);\n\n const className = cn('-mb-2 flex justify-end pl-2 text-right', {\n // Adjust negative margin on row actions cell to ensure that the cell aligns vertically.\n '-mt-2': fontSize === FONT_SIZE.small,\n '-mt-1.5': fontSize !== FONT_SIZE.small,\n });\n\n content = (\n <span className={className} ref={ref}>\n {actionsOnRow.map((button, index) => {\n const tooltip = String(button.props.tooltip ?? button.props['aria-label'] ?? '');\n\n return React.cloneElement(button, {\n appearance: 'transparent',\n key: index,\n tabIndex: isCurrentRow ? 0 : -1,\n tooltip: button.props.shortcut ? (\n <>\n {tooltip}\n <Shortcut className=\"ml-2\" keys={button.props.shortcut} />\n </>\n ) : (\n tooltip\n ),\n });\n })}\n {actionsInMenu.length ? (\n <IconButton\n appearance=\"transparent\"\n aria-label={texts.table3.columns.actions.tooltip}\n icon=\"more\"\n tabIndex={isCurrentRow ? 0 : -1}\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content>\n {actionsInMenu.map((action, i) => (\n <Menu.Item key={i} {...action.props} shortcut={action.props.shortcut}>\n {action.props['aria-label']}\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu>\n )}\n />\n ) : null}\n </span>\n );\n }\n\n return <DisplayCell {...props}>{content}</DisplayCell>;\n}) as <TType = unknown>(props: MemoedCellProps<TType>) => JSX.Element;\n\ntype CellProps<TType = unknown> = CellContext<TType, unknown>;\n\nfunction Cell<TType = unknown>(context: CellProps<TType>) {\n const { rowIndex } = React.useContext(RowContext);\n const tableMeta = context.table.options.meta as TableMeta<TType>;\n\n return (\n <MemoedCell\n {...context}\n actions={tableMeta.rowActions.actionsForRow}\n actionsLength={tableMeta.rowActions.actionsForRowLength}\n fontSize={tableMeta.fontSize.size}\n isCurrentRow={tableMeta.currentRow.currentRowIndex === rowIndex}\n isEditing={tableMeta.editing.isEditing}\n isResizingColumn={!!context.table.getState().columnSizingInfo.isResizingColumn}\n isHoverStatePaused={!!tableMeta.hoverState.isPaused}\n />\n );\n}\n\nexport function createRowActionsColumn<TType = unknown>(): DisplayColumnDef<TType, unknown> {\n return {\n id: COLUMN_ID,\n header: ColumnHeader,\n cell: Cell,\n footer: Footer,\n meta: {\n align: 'right',\n className: cn(\n '!pt-[var(--table3-cell-padding-y)] print:opacity-0 [[role=\"table\"][data-editing=\"false\"]_&]:group-[[data-current=\"true\"]]/row:sticky [[role=\"table\"][data-pause-hover=\"false\"][data-editing=\"false\"]_&]:group-hover/row:sticky right-0 !pl-1 !pr-1',\n 'shadow-[-6px_0px_6px_var(--table3-row-actions-shadow)]',\n 'group-[[data-current=\"true\"][data-selected=\"false\"]]/row:text-grey-200',\n 'group-[[data-selected=\"true\"]]/row:text-blue-100',\n 'group-[[data-selected=\"false\"]:hover]/row:text-grey-100'\n ),\n enableOrdering: false,\n enableSearch: false,\n enableTruncate: false,\n header: '',\n headerClassName: 'items-center !p-0',\n },\n // options\n enableResizing: false,\n };\n}\n"],"names":["COLUMN_ID","MemoedCell","React","memo","props","actions","actionsLength","fontSize","isCurrentRow","isEditing","isResizingColumn","isHoverStatePaused","row","isHovered","useContext","RowContext","texts","useLocalization","ref","useRef","content","length","visibleActions","map","action","original","filter","actionsOnRow","slice","actionsInMenu","className","cn","FONT_SIZE","small","button","index","tooltip","String","_ref","_button$props$tooltip","cloneElement","appearance","key","tabIndex","shortcut","Shortcut","keys","IconButton","table3","columns","icon","menu","menuProps","Menu","Content","i","Item","DisplayCell","Cell","context","rowIndex","tableMeta","table","options","meta","rowActions","actionsForRow","actionsForRowLength","size","currentRow","currentRowIndex","editing","getState","columnSizingInfo","hoverState","isPaused","createRowActionsColumn","id","header","ColumnHeader","cell","footer","Footer","align","enableOrdering","enableSearch","enableTruncate","headerClassName","enableResizing"],"mappings":";;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MACnBC,cAAc,EAAE,KAAK;MACrBR,MAAM,EAAE,EAAE;MACVS,eAAe,EAAE;KACpB;;IAEDC,cAAc,EAAE;GACnB;AACL;;;;"}
@@ -1,6 +1,6 @@
1
1
  import cn from 'classnames';
2
+ import { FONT_SIZE } from '../toolbar/FontSize.js';
2
3
 
3
- const MIN_COLUMN_SIZE = 80; // accounts for padding and sort controls
4
4
  const PRINT_MIN_COLUMN_SIZE = 20; // while printing, it accounts for minimum width each column can take
5
5
  const getCellAlignmentClasses = (alignment = 'left') => {
6
6
  return cn({
@@ -9,10 +9,22 @@ const getCellAlignmentClasses = (alignment = 'left') => {
9
9
  'justify-center text-center': alignment === 'center'
10
10
  });
11
11
  };
12
+ const getFontBasedMinColumnSize = fontSize => {
13
+ // The minimum column size are based on the minimum usuable width of Datepicker
14
+ switch (fontSize) {
15
+ case FONT_SIZE.small:
16
+ return 57;
17
+ case FONT_SIZE.large:
18
+ return 83;
19
+ default:
20
+ case FONT_SIZE.medium:
21
+ return 72;
22
+ }
23
+ };
12
24
  // Hiding input number spin buttons
13
25
  const getInputAppearanceClassnames = () => {
14
26
  return cn('[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none');
15
27
  };
16
28
 
17
- export { MIN_COLUMN_SIZE, PRINT_MIN_COLUMN_SIZE, getCellAlignmentClasses, getInputAppearanceClassnames };
29
+ export { PRINT_MIN_COLUMN_SIZE, getCellAlignmentClasses, getFontBasedMinColumnSize, getInputAppearanceClassnames };
18
30
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sources":["../../../../../../../../../src/components/Table3/components/columns/styles.ts"],"sourcesContent":["import cn from 'classnames';\nimport { Table3ColumnAlignment } from '../../types';\n\nexport const MIN_COLUMN_SIZE = 80; // accounts for padding and sort controls\nexport const PRINT_MIN_COLUMN_SIZE = 20; // while printing, it accounts for minimum width each column can take\n\nexport const getCellAlignmentClasses = (alignment: Table3ColumnAlignment = 'left') => {\n return cn({\n 'justify-start text-left': alignment === 'left',\n 'justify-end text-right': alignment === 'right',\n 'justify-center text-center': alignment === 'center',\n });\n};\n\n// Hiding input number spin buttons\nexport const getInputAppearanceClassnames = () => {\n return cn(\n '[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none'\n );\n};\n"],"names":["MIN_COLUMN_SIZE","PRINT_MIN_COLUMN_SIZE","getCellAlignmentClasses","alignment","cn","getInputAppearanceClassnames"],"mappings":";;MAGaA,eAAe,GAAG,GAAG;MACrBC,qBAAqB,GAAG,GAAG;MAE3BC,uBAAuB,GAAGA,CAACC,YAAmC,MAAM;EAC7E,OAAOC,EAAE,CAAC;IACN,yBAAyB,EAAED,SAAS,KAAK,MAAM;IAC/C,wBAAwB,EAAEA,SAAS,KAAK,OAAO;IAC/C,4BAA4B,EAAEA,SAAS,KAAK;GAC/C,CAAC;AACN;AAEA;MACaE,4BAA4B,GAAGA;EACxC,OAAOD,EAAE,CACL,sHAAsH,CACzH;AACL;;;;"}
1
+ {"version":3,"file":"styles.js","sources":["../../../../../../../../../src/components/Table3/components/columns/styles.ts"],"sourcesContent":["import cn from 'classnames';\nimport { Table3ColumnAlignment, Table3FontSize } from '../../types';\nimport { FONT_SIZE } from '../toolbar/FontSize';\n\nexport const PRINT_MIN_COLUMN_SIZE = 20; // while printing, it accounts for minimum width each column can take\n\nexport const getCellAlignmentClasses = (alignment: Table3ColumnAlignment = 'left') => {\n return cn({\n 'justify-start text-left': alignment === 'left',\n 'justify-end text-right': alignment === 'right',\n 'justify-center text-center': alignment === 'center',\n });\n};\n\nexport const getFontBasedMinColumnSize = (fontSize: Table3FontSize | undefined) => {\n // The minimum column size are based on the minimum usuable width of Datepicker\n switch (fontSize) {\n case FONT_SIZE.small:\n return 57;\n case FONT_SIZE.large:\n return 83;\n default:\n case FONT_SIZE.medium:\n return 72;\n }\n};\n\n// Hiding input number spin buttons\nexport const getInputAppearanceClassnames = () => {\n return cn(\n '[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none'\n );\n};\n"],"names":["PRINT_MIN_COLUMN_SIZE","getCellAlignmentClasses","alignment","cn","getFontBasedMinColumnSize","fontSize","FONT_SIZE","small","large","medium","getInputAppearanceClassnames"],"mappings":";;;MAIaA,qBAAqB,GAAG,GAAG;MAE3BC,uBAAuB,GAAGA,CAACC,YAAmC,MAAM;EAC7E,OAAOC,EAAE,CAAC;IACN,yBAAyB,EAAED,SAAS,KAAK,MAAM;IAC/C,wBAAwB,EAAEA,SAAS,KAAK,OAAO;IAC/C,4BAA4B,EAAEA,SAAS,KAAK;GAC/C,CAAC;AACN;MAEaE,yBAAyB,GAAIC,QAAoC;;EAE1E,QAAQA,QAAQ;IACZ,KAAKC,SAAS,CAACC,KAAK;MAChB,OAAO,EAAE;IACb,KAAKD,SAAS,CAACE,KAAK;MAChB,OAAO,EAAE;IACb;IACA,KAAKF,SAAS,CAACG,MAAM;MACjB,OAAO,EAAE;;AAErB;AAEA;MACaC,4BAA4B,GAAGA;EACxC,OAAOP,EAAE,CACL,sHAAsH,CACzH;AACL;;;;"}
@@ -5,12 +5,12 @@ import { useLocalization } from '../../../Provider/Localization.js';
5
5
  import { Checkbox } from '../../../Checkbox/Checkbox.js';
6
6
  import { Input } from '../../../Input/Input.js';
7
7
  import { Popover } from '../../../Popover/Popover.js';
8
+ import { isInternalColumn } from '../../util/columns.js';
9
+ import { ensureOrdering } from '../../hooks/features/useColumnOrdering.js';
8
10
  import { Container } from '../../../../primitives/Sortable/components/Container.js';
9
11
  import { arrayMove } from '@dnd-kit/sortable';
10
12
  import { Item } from '../../../../primitives/Sortable/components/Item.js';
11
13
  import { List } from '../../../../primitives/Sortable/components/List.js';
12
- import { isInternalColumn } from '../../util/columns.js';
13
- import { ensureOrdering } from '../../hooks/features/useColumnOrdering.js';
14
14
 
15
15
  const Column = /*#__PURE__*/React__default.forwardRef(function Column(props, ref) {
16
16
  var _column$parent, _column$parent$column, _column$columnDef$met;
@@ -77,14 +77,21 @@ function FiltersButton(props) {
77
77
  };
78
78
  //
79
79
  const handleApply = () => {
80
- table.setColumnFilters(filters.filter(f => {
81
- var _allColumns$find$colu;
82
- const controlRenderer = (_allColumns$find$colu = allColumns.find(c => c.id === f.id).columnDef.meta) === null || _allColumns$find$colu === void 0 ? void 0 : _allColumns$find$colu.control;
83
- if (f.value.comparator === Table3FilterComparator.IsEmpty || f.value.comparator === Table3FilterComparator.IsNotEmpty || controlRenderer === 'switch') {
84
- return true;
85
- }
86
- return !!f.value.value;
87
- }));
80
+ table.setColumnFilters(() => {
81
+ const newFilters = filters.filter(f => {
82
+ var _allColumns$find, _allColumns$find$colu;
83
+ if (f.id === null) {
84
+ return false;
85
+ }
86
+ 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;
87
+ if (f.value.comparator === Table3FilterComparator.IsEmpty || f.value.comparator === Table3FilterComparator.IsNotEmpty || controlRenderer === 'switch') {
88
+ return true;
89
+ }
90
+ return !!f.value.value;
91
+ });
92
+ // Compiler didn't get that we stripped out filters with null ids, so we still need to cast a ColumnFilter type here
93
+ return newFilters;
94
+ });
88
95
  };
89
96
  const handleClear = () => {
90
97
  table.resetColumnFilters();
@@ -1 +1 @@
1
- {"version":3,"file":"Filters.js","sources":["../../../../../../../../../../../src/components/Table3/components/toolbar/Filter/filters/Filters.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Table as RTable, Column as RTColumn } from '@tanstack/react-table';\nimport { Button } from '../../../../../Button/Button';\nimport { Icon } from '../../../../../Icon/Icon';\nimport { Popover } from '../../../../../Popover/Popover';\nimport { Table3FilterValue, Table3FilterComparator, Table3Filter } from '../../../../types';\nimport { Shortcut } from '../../../../../Shortcut/Shortcut';\nimport { useGlobalKeyDown } from '../../../../../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { isInternalColumn } from '../../../../util/columns';\nimport { Placeholder } from './components/Placeholder';\nimport { Filter } from './components/Filter';\nimport { Group } from '../../../../../Group/Group';\nimport { useIsLargeScreen } from '../../../../../../hooks/useIsLargeScreen';\nimport { IconButton } from '../../../../../IconButton/IconButton';\n\nfunction sortByHeader<TType = unknown>(a: RTColumn<TType>, b: RTColumn<TType>) {\n return (a.columnDef.meta?.header as string)?.localeCompare?.(b.columnDef.meta?.header as string);\n}\n\nexport type FiltersProps<TType = unknown> = {\n total: number;\n table: RTable<TType>;\n};\n\nexport function FiltersButton<TType = unknown>(props: FiltersProps<TType>) {\n const { total, table } = props;\n const { locale, texts } = useLocalization();\n const ref = React.useRef<HTMLButtonElement>(null);\n const isLargeScreen = useIsLargeScreen();\n const allColumns = table\n .getAllLeafColumns()\n .filter(column => !isInternalColumn(column.id))\n .sort(sortByHeader);\n const appliedFilters = table.getState().columnFilters;\n\n useGlobalKeyDown({ key: 'f', meta: true, shift: true }, (event: KeyboardEvent) => {\n event.preventDefault();\n ref.current?.click();\n });\n\n // state, since we \"apply\" filters\n const [filters, setFilters] = React.useState<Table3Filter[]>(table.getState().columnFilters as Table3Filter[]);\n const [placeholderCount, setPlaceholderCount] = React.useState(1);\n\n // filters\n const handleChangeFilter = (currentId: string, filter: { id: string; value: Table3FilterValue }) => {\n setFilters(currentFilters => {\n const nextFilters = [...currentFilters];\n const index = nextFilters.findIndex(f => f.id === currentId);\n nextFilters[index] = filter;\n return nextFilters;\n });\n };\n\n const handleRemoveFilter = (columnId: string) => {\n if (filters.length === 1 && placeholderCount === 0) {\n setPlaceholderCount(count => count + 1);\n }\n\n setFilters(currentFilters => currentFilters.filter(f => f.id !== columnId));\n };\n\n // placeholders\n const handleCreateFilterFromPlaceholder = (columnId: string) => {\n setFilters(currentFilters => [\n ...currentFilters,\n {\n id: columnId,\n value: {\n comparator: Table3FilterComparator.Contains,\n value: undefined,\n },\n },\n ]);\n handleRemovePlaceholder();\n };\n\n const handleCreatePlaceholder = () => {\n setPlaceholderCount(count => count + 1);\n };\n\n const handleRemovePlaceholder = () => {\n setPlaceholderCount(count => count - 1);\n };\n\n //\n const handleApply = () => {\n table.setColumnFilters(\n filters.filter(f => {\n const controlRenderer = (allColumns.find(c => c.id === f.id) as RTColumn<TType, unknown>).columnDef.meta?.control;\n if (\n f.value.comparator === Table3FilterComparator.IsEmpty ||\n f.value.comparator === Table3FilterComparator.IsNotEmpty ||\n controlRenderer === 'switch'\n ) {\n return true;\n }\n return !!f.value.value;\n })\n );\n };\n\n const handleClear = () => {\n table.resetColumnFilters();\n setFilters([]);\n setPlaceholderCount(1);\n };\n\n const buttonProps = {\n 'aria-label': texts.table3.filters.tooltip,\n className: cn({ '!wcag-blue-100': appliedFilters.length }),\n popover: popoverProps => (\n <Popover {...popoverProps}>\n <Popover.Content>\n <div className=\"flex w-[40rem] flex-col gap-4\">\n <div className=\"flex h-8\">\n <div className=\"flex w-full items-center gap-2\">\n <h4 className=\"mb-0 inline-flex\">{texts.table3.filters.button}</h4>\n <p className=\"text-grey-700 mb-0 mr-auto mt-px inline-flex\">\n {texts.table3.filters.total\n .replace(\n '[CURRENT]',\n new Intl.NumberFormat(locale).format(table.getFilteredRowModel().rows.length)\n )\n .replace('[TOTAL]', new Intl.NumberFormat(locale).format(total))}\n </p>\n </div>\n </div>\n <div className=\"flex flex-col gap-2\">\n {filters.map((filter, index) => (\n <Filter\n key={`filter_${index}`}\n allColumns={allColumns as RTColumn<unknown, unknown>[]}\n filter={filter}\n filters={filters}\n position={index}\n onChange={handleChangeFilter}\n onRemove={handleRemoveFilter}\n />\n ))}\n {[...Array(placeholderCount)].map((_, index) => (\n <Placeholder\n key={`placeholder_${index}`}\n allColumns={allColumns as RTColumn<unknown, unknown>[]}\n filters={filters}\n position={filters.length + index}\n onCreate={handleCreateFilterFromPlaceholder as any}\n onRemove={placeholderCount > 1 || filters.length > 0 ? handleRemovePlaceholder : undefined}\n />\n ))}\n <div className=\"justify-start\">\n <Button appearance=\"discrete\" onClick={handleCreatePlaceholder}>\n + {texts.table3.filters.buttons.addFilter}\n </Button>\n </div>\n </div>\n <Group className=\"ml-auto\">\n <Popover.Close>\n <Button>Cancel</Button>\n </Popover.Close>\n <Button onClick={handleClear}>Clear</Button>\n <Button appearance=\"primary\" onClick={handleApply}>\n Apply\n </Button>\n </Group>\n </div>\n </Popover.Content>\n </Popover>\n ),\n ref,\n tooltip: (\n <>\n {texts.table3.filters.tooltip}\n <Shortcut className=\"ml-2\" keys={{ key: 'f', meta: true, shift: true }} />\n </>\n ),\n };\n\n if (!isLargeScreen && !appliedFilters.length) {\n return <IconButton {...buttonProps} icon=\"filter\" />;\n }\n return (\n <Button {...buttonProps}>\n <Icon className={cn({ '-mr-1.5': !isLargeScreen })} name={appliedFilters.length ? 'filter-solid' : 'filter'} />\n {isLargeScreen ? texts.table3.filters.button : ''}\n {appliedFilters.length ? `(${appliedFilters.length})` : ''}\n </Button>\n );\n}\n"],"names":["sortByHeader","a","b","_a$columnDef$meta","columnDef","meta","_a$columnDef$meta$hea","header","_a$columnDef$meta$hea2","localeCompare","call","_b$columnDef$meta","FiltersButton","props","total","table","locale","texts","useLocalization","ref","React","useRef","isLargeScreen","useIsLargeScreen","allColumns","getAllLeafColumns","filter","column","isInternalColumn","id","sort","appliedFilters","getState","columnFilters","useGlobalKeyDown","key","shift","event","preventDefault","_ref$current","current","click","filters","setFilters","useState","placeholderCount","setPlaceholderCount","handleChangeFilter","currentId","currentFilters","nextFilters","index","findIndex","f","handleRemoveFilter","columnId","length","count","handleCreateFilterFromPlaceholder","value","comparator","Table3FilterComparator","Contains","undefined","handleRemovePlaceholder","handleCreatePlaceholder","handleApply","setColumnFilters","controlRenderer","_allColumns$find$colu","find","c","control","IsEmpty","IsNotEmpty","handleClear","resetColumnFilters","buttonProps","table3","tooltip","className","cn","popover","popoverProps","Popover","Content","button","replace","Intl","NumberFormat","format","getFilteredRowModel","rows","map","Filter","position","onChange","onRemove","Array","_","Placeholder","onCreate","Button","appearance","onClick","buttons","addFilter","Group","Close","Shortcut","keys","IconButton","icon","Icon","name"],"mappings":";;;;;;;;;;;;;;;;AAiBA,SAASA,YAAYA,CAAkBC,CAAkB,EAAEC,CAAkB;;EACzE,QAAAC,iBAAA,GAAQF,CAAC,CAACG,SAAS,CAACC,IAAI,cAAAF,iBAAA,wBAAAG,qBAAA,GAAhBH,iBAAA,CAAkBI,MAAiB,cAAAD,qBAAA,wBAAAE,sBAAA,GAAnCF,qBAAA,CAAqCG,aAAa,cAAAD,sBAAA,uBAAlDA,sBAAA,CAAAE,IAAA,CAAAJ,qBAAA,GAAAK,iBAAA,GAAqDT,CAAC,CAACE,SAAS,CAACC,IAAI,cAAAM,iBAAA,uBAAhBA,iBAAA,CAAkBJ,MAAgB,CAAC;AACpG;SAOgBK,aAAaA,CAAkBC,KAA0B;EACrE,MAAM;IAAEC,KAAK;IAAEC;GAAO,GAAGF,KAAK;EAC9B,MAAM;IAAEG,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAC3C,MAAMC,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAoB,IAAI,CAAC;EACjD,MAAMC,aAAa,GAAGC,gBAAgB,EAAE;EACxC,MAAMC,UAAU,GAAGT,KAAK,CACnBU,iBAAiB,EAAE,CACnBC,MAAM,CAACC,MAAM,IAAI,CAACC,gBAAgB,CAACD,MAAM,CAACE,EAAE,CAAC,CAAC,CAC9CC,IAAI,CAAC9B,YAAY,CAAC;EACvB,MAAM+B,cAAc,GAAGhB,KAAK,CAACiB,QAAQ,EAAE,CAACC,aAAa;EAErDC,gBAAgB,CAAC;IAAEC,GAAG,EAAE,GAAG;IAAE9B,IAAI,EAAE,IAAI;IAAE+B,KAAK,EAAE;GAAM,EAAGC,KAAoB;;IACzEA,KAAK,CAACC,cAAc,EAAE;IACtB,CAAAC,YAAA,GAAApB,GAAG,CAACqB,OAAO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C,UAAU,EAAC,UAAU;MAACC,OAAO,EAAEvC;aAChChD,KAAK,CAAC6D,MAAM,CAACpC,OAAO,CAAC+D,OAAO,CAACC,SAAS,CACpC,CACP,CACJ,eACNtF,6BAACuF,KAAK;MAAC3B,SAAS,EAAC;oBACb5D,6BAACgE,OAAO,CAACwB,KAAK,qBACVxF,6BAACkF,MAAM,iBAAgB,CACX,eAChBlF,6BAACkF,MAAM;MAACE,OAAO,EAAE7B;eAA2B,eAC5CvD,6BAACkF,MAAM;MAACC,UAAU,EAAC,SAAS;MAACC,OAAO,EAAEtC;eAE7B,CACL,CACN,CACQ,CAEzB;IACD/C,GAAG;IACH4D,OAAO,eACH3D,4DACKH,KAAK,CAAC6D,MAAM,CAACpC,OAAO,CAACqC,OAAO,eAC7B3D,6BAACyF,QAAQ;MAAC7B,SAAS,EAAC,MAAM;MAAC8B,IAAI,EAAE;QAAE3E,GAAG,EAAE,GAAG;QAAE9B,IAAI,EAAE,IAAI;QAAE+B,KAAK,EAAE;;MAAU;GAGrF;EAED,IAAI,CAACd,aAAa,IAAI,CAACS,cAAc,CAACyB,MAAM,EAAE;IAC1C,oBAAOpC,6BAAC2F,UAAU,oBAAKlC,WAAW;MAAEmC,IAAI,EAAC;OAAW;;EAExD,oBACI5F,6BAACkF,MAAM,oBAAKzB,WAAW,gBACnBzD,6BAAC6F,IAAI;IAACjC,SAAS,EAAEC,EAAE,CAAC;MAAE,SAAS,EAAE,CAAC3D;KAAe,CAAC;IAAE4F,IAAI,EAAEnF,cAAc,CAACyB,MAAM,GAAG,cAAc,GAAG;IAAY,EAC9GlC,aAAa,GAAGL,KAAK,CAAC6D,MAAM,CAACpC,OAAO,CAAC4C,MAAM,GAAG,EAAE,EAChDvD,cAAc,CAACyB,MAAM,OAAOzB,cAAc,CAACyB,SAAS,GAAG,EAAE,CACrD;AAEjB;;;;"}
1
+ {"version":3,"file":"Filters.js","sources":["../../../../../../../../../../../src/components/Table3/components/toolbar/Filter/filters/Filters.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Table as RTable, Column as RTColumn } from '@tanstack/react-table';\nimport { Button } from '../../../../../Button/Button';\nimport { Icon } from '../../../../../Icon/Icon';\nimport { Popover } from '../../../../../Popover/Popover';\nimport { Table3FilterValue, Table3FilterComparator, Table3Filter, ColumnFilter } from '../../../../types';\nimport { Shortcut } from '../../../../../Shortcut/Shortcut';\nimport { useGlobalKeyDown } from '../../../../../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../../../../../Provider/Localization';\nimport { isInternalColumn } from '../../../../util/columns';\nimport { Placeholder } from './components/Placeholder';\nimport { Filter } from './components/Filter';\nimport { Group } from '../../../../../Group/Group';\nimport { useIsLargeScreen } from '../../../../../../hooks/useIsLargeScreen';\nimport { IconButton } from '../../../../../IconButton/IconButton';\n\nfunction sortByHeader<TType = unknown>(a: RTColumn<TType>, b: RTColumn<TType>) {\n return (a.columnDef.meta?.header as string)?.localeCompare?.(b.columnDef.meta?.header as string);\n}\n\nexport type FiltersProps<TType = unknown> = {\n total: number;\n table: RTable<TType>;\n};\n\nexport function FiltersButton<TType = unknown>(props: FiltersProps<TType>) {\n const { total, table } = props;\n const { locale, texts } = useLocalization();\n const ref = React.useRef<HTMLButtonElement>(null);\n const isLargeScreen = useIsLargeScreen();\n const allColumns = table\n .getAllLeafColumns()\n .filter(column => !isInternalColumn(column.id))\n .sort(sortByHeader);\n const appliedFilters = table.getState().columnFilters;\n\n useGlobalKeyDown({ key: 'f', meta: true, shift: true }, (event: KeyboardEvent) => {\n event.preventDefault();\n ref.current?.click();\n });\n\n // state, since we \"apply\" filters\n const [filters, setFilters] = React.useState<Table3Filter[]>(table.getState().columnFilters as Table3Filter[]);\n const [placeholderCount, setPlaceholderCount] = React.useState(1);\n\n // filters\n const handleChangeFilter = (currentId: string | null, filter: { id: string | null; value: Table3FilterValue }) => {\n setFilters(currentFilters => {\n const nextFilters = [...currentFilters];\n const index = nextFilters.findIndex(f => f.id === currentId);\n nextFilters[index] = filter;\n return nextFilters;\n });\n };\n\n const handleRemoveFilter = (columnId: string | null) => {\n if (filters.length === 1 && placeholderCount === 0) {\n setPlaceholderCount(count => count + 1);\n }\n\n setFilters(currentFilters => currentFilters.filter(f => f.id !== columnId));\n };\n\n // placeholders\n const handleCreateFilterFromPlaceholder = (columnId: string) => {\n setFilters(currentFilters => [\n ...currentFilters,\n {\n id: columnId,\n value: {\n comparator: Table3FilterComparator.Contains,\n value: undefined,\n },\n },\n ]);\n handleRemovePlaceholder();\n };\n\n const handleCreatePlaceholder = () => {\n setPlaceholderCount(count => count + 1);\n };\n\n const handleRemovePlaceholder = () => {\n setPlaceholderCount(count => count - 1);\n };\n\n //\n const handleApply = () => {\n table.setColumnFilters(() => {\n const newFilters = filters.filter(f => {\n if (f.id === null) {\n return false;\n }\n\n const controlRenderer = (allColumns.find(c => c.id === f.id) as RTColumn<TType, unknown>)?.columnDef.meta\n ?.control;\n if (\n f.value.comparator === Table3FilterComparator.IsEmpty ||\n f.value.comparator === Table3FilterComparator.IsNotEmpty ||\n controlRenderer === 'switch'\n ) {\n return true;\n }\n return !!f.value.value;\n });\n // Compiler didn't get that we stripped out filters with null ids, so we still need to cast a ColumnFilter type here\n return newFilters as ColumnFilter[];\n });\n };\n\n const handleClear = () => {\n table.resetColumnFilters();\n setFilters([]);\n setPlaceholderCount(1);\n };\n\n const buttonProps = {\n 'aria-label': texts.table3.filters.tooltip,\n className: cn({ '!wcag-blue-100': appliedFilters.length }),\n popover: popoverProps => (\n <Popover {...popoverProps}>\n <Popover.Content>\n <div className=\"flex w-[40rem] flex-col gap-4\">\n <div className=\"flex h-8\">\n <div className=\"flex w-full items-center gap-2\">\n <h4 className=\"mb-0 inline-flex\">{texts.table3.filters.button}</h4>\n <p className=\"text-grey-700 mb-0 mr-auto mt-px inline-flex\">\n {texts.table3.filters.total\n .replace(\n '[CURRENT]',\n new Intl.NumberFormat(locale).format(table.getFilteredRowModel().rows.length)\n )\n .replace('[TOTAL]', new Intl.NumberFormat(locale).format(total))}\n </p>\n </div>\n </div>\n <div className=\"flex flex-col gap-2\">\n {filters.map((filter, index) => (\n <Filter\n key={`filter_${index}`}\n allColumns={allColumns as RTColumn<unknown, unknown>[]}\n filter={filter}\n filters={filters}\n position={index}\n onChange={handleChangeFilter}\n onRemove={handleRemoveFilter}\n />\n ))}\n {[...Array(placeholderCount)].map((_, index) => (\n <Placeholder\n key={`placeholder_${index}`}\n allColumns={allColumns as RTColumn<unknown, unknown>[]}\n filters={filters}\n position={filters.length + index}\n onCreate={handleCreateFilterFromPlaceholder as any}\n onRemove={placeholderCount > 1 || filters.length > 0 ? handleRemovePlaceholder : undefined}\n />\n ))}\n <div className=\"justify-start\">\n <Button appearance=\"discrete\" onClick={handleCreatePlaceholder}>\n + {texts.table3.filters.buttons.addFilter}\n </Button>\n </div>\n </div>\n <Group className=\"ml-auto\">\n <Popover.Close>\n <Button>Cancel</Button>\n </Popover.Close>\n <Button onClick={handleClear}>Clear</Button>\n <Button appearance=\"primary\" onClick={handleApply}>\n Apply\n </Button>\n </Group>\n </div>\n </Popover.Content>\n </Popover>\n ),\n ref,\n tooltip: (\n <>\n {texts.table3.filters.tooltip}\n <Shortcut className=\"ml-2\" keys={{ key: 'f', meta: true, shift: true }} />\n </>\n ),\n };\n\n if (!isLargeScreen && !appliedFilters.length) {\n return <IconButton {...buttonProps} icon=\"filter\" />;\n }\n return (\n <Button {...buttonProps}>\n <Icon className={cn({ '-mr-1.5': !isLargeScreen })} name={appliedFilters.length ? 'filter-solid' : 'filter'} />\n {isLargeScreen ? texts.table3.filters.button : ''}\n {appliedFilters.length ? `(${appliedFilters.length})` : ''}\n </Button>\n );\n}\n"],"names":["sortByHeader","a","b","_a$columnDef$meta","columnDef","meta","_a$columnDef$meta$hea","header","_a$columnDef$meta$hea2","localeCompare","call","_b$columnDef$meta","FiltersButton","props","total","table","locale","texts","useLocalization","ref","React","useRef","isLargeScreen","useIsLargeScreen","allColumns","getAllLeafColumns","filter","column","isInternalColumn","id","sort","appliedFilters","getState","columnFilters","useGlobalKeyDown","key","shift","event","preventDefault","_ref$current","current","click","filters","setFilters","useState","placeholderCount","setPlaceholderCount","handleChangeFilter","currentId","currentFilters","nextFilters","index","findIndex","f","handleRemoveFilter","columnId","length","count","handleCreateFilterFromPlaceholder","value","comparator","Table3FilterComparator","Contains","undefined","handleRemovePlaceholder","handleCreatePlaceholder","handleApply","setColumnFilters","newFilters","controlRenderer","_allColumns$find","find","c","_allColumns$find$colu","control","IsEmpty","IsNotEmpty","handleClear","resetColumnFilters","buttonProps","table3","tooltip","className","cn","popover","popoverProps","Popover","Content","button","replace","Intl","NumberFormat","format","getFilteredRowModel","rows","map","Filter","position","onChange","onRemove","Array","_","Placeholder","onCreate","Button","appearance","onClick","buttons","addFilter","Group","Close","Shortcut","keys","IconButton","icon","Icon","name"],"mappings":";;;;;;;;;;;;;;;;AAiBA,SAASA,YAAYA,CAAkBC,CAAkB,EAAEC,CAAkB;;EACzE,QAAAC,iBAAA,GAAQF,CAAC,CAACG,SAAS,CAACC,IAAI,cAAAF,iBAAA,wBAAAG,qBAAA,GAAhBH,iBAAA,CAAkBI,MAAiB,cAAAD,qBAAA,wBAAAE,sBAAA,GAAnCF,qBAAA,CAAqCG,aAAa,cAAAD,sBAAA,uBAAlDA,sBAAA,CAAAE,IAAA,CAAAJ,qBAAA,GAAAK,iBAAA,GAAqDT,CAAC,CAACE,SAAS,CAACC,IAAI,cAAAM,iBAAA,uBAAhBA,iBAAA,CAAkBJ,MAAgB,CAAC;AACpG;SAOgBK,aAAaA,CAAkBC,KAA0B;EACrE,MAAM;IAAEC,KAAK;IAAEC;GAAO,GAAGF,KAAK;EAC9B,MAAM;IAAEG,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAC3C,MAAMC,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAoB,IAAI,CAAC;EACjD,MAAMC,aAAa,GAAGC,gBAAgB,EAAE;EACxC,MAAMC,UAAU,GAAGT,KAAK,CAC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AAI,CAACS,cAAc,CAACyB,MAAM,EAAE;IAC1C,oBAAOpC,6BAAC6F,UAAU,oBAAKlC,WAAW;MAAEmC,IAAI,EAAC;OAAW;;EAExD,oBACI9F,6BAACoF,MAAM,oBAAKzB,WAAW,gBACnB3D,6BAAC+F,IAAI;IAACjC,SAAS,EAAEC,EAAE,CAAC;MAAE,SAAS,EAAE,CAAC7D;KAAe,CAAC;IAAE8F,IAAI,EAAErF,cAAc,CAACyB,MAAM,GAAG,cAAc,GAAG;IAAY,EAC9GlC,aAAa,GAAGL,KAAK,CAAC+D,MAAM,CAACtC,OAAO,CAAC8C,MAAM,GAAG,EAAE,EAChDzD,cAAc,CAACyB,MAAM,OAAOzB,cAAc,CAACyB,SAAS,GAAG,EAAE,CACrD;AAEjB;;;;"}
@@ -56,9 +56,9 @@ function Filter(props) {
56
56
  };
57
57
  const handleRemove = () => onRemove(id);
58
58
  return /*#__PURE__*/React__default.createElement("div", {
59
- className: "flex gap-2"
59
+ className: "flex items-start gap-2"
60
60
  }, /*#__PURE__*/React__default.createElement("div", {
61
- className: "flex w-14 flex-shrink-0 items-center justify-end pr-2 text-right"
61
+ className: "flex min-h-[theme(spacing.8)] w-14 flex-shrink-0 items-center justify-end pr-2 text-right"
62
62
  }, position > 0 ? texts.table3.filters.conditions.and : texts.table3.filters.conditions.where), /*#__PURE__*/React__default.createElement(FilterColumn, {
63
63
  allColumns: allColumns,
64
64
  filters: filters,
@@ -1 +1 @@
1
- {"version":3,"file":"Filter.js","sources":["../../../../../../../../../../../../src/components/Table3/components/toolbar/Filter/filters/components/Filter.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as RTColumn, ColumnFiltersState } from '@tanstack/react-table';\nimport { IconButton } from '../../../../../../IconButton/IconButton';\nimport { Table3Filter, Table3FilterComparator } from '../../../../../types';\nimport { useLocalization } from '../../../../../../Provider/Localization';\nimport { FilterColumn } from './FilterColumn';\nimport { FilterComparator } from './FilterComparator';\nimport { FilterValue } from './FilterValue';\n\nexport type FilterProps<TType = unknown> = {\n allColumns: RTColumn<TType, unknown>[];\n filter: Table3Filter;\n filters: ColumnFiltersState;\n position: number;\n onChange: (id: string, value: Table3Filter) => 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) as RTColumn<TType, unknown>;\n\n const {\n id,\n value: { comparator, value },\n } = filter;\n\n const handleChangeColumn = (columnId: string) => {\n handleChange(id, { id: columnId, value: filter.value });\n };\n\n const handleChangeComparator = (comparator: Table3FilterComparator) => {\n let nextValue = filter.value.value;\n\n if (comparator === Table3FilterComparator.IsEmpty || comparator === Table3FilterComparator.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 gap-2\">\n <div className=\"flex 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","handleChangeComparator","nextValue","Table3FilterComparator","IsEmpty","IsNotEmpty","undefined","handleChangeValue","handleRemove","React","className","table3","conditions","and","where","FilterColumn","FilterComparator","FilterValue","IconButton","appearance","icon","onClick"],"mappings":";;;;;;;;SAkBgBA,MAAMA,CAAkBC,K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B,KAAK,CAACoB,MAAM,CAACzB,OAAO,CAAC0B,UAAU,CAACE,KAAK,CACzF,eACNL,6BAACM,YAAY;IAAC/B,UAAU,EAAEA,UAAU;IAAEE,OAAO,EAAEA,OAAO;IAAEC,QAAQ,EAAEY,kBAAyB;IAAEF,KAAK,EAAED;IAAM,eAC1Ga,6BAACO,gBAAgB;IAACvB,MAAM,EAAEA,MAAM;IAAEN,QAAQ,EAAEc,sBAA6B;IAAEJ,KAAK,EAAEC;IAAc,eAChGW,6BAACQ,WAAW;IAACxB,MAAM,EAAEA,MAAM;IAAEK,UAAU,EAAEA,UAAU;IAAEX,QAAQ,EAAEoB,iBAAiB;IAAEV,KAAK,EAAEA;IAAS,eAClGY,6BAACS,UAAU;IAACC,UAAU,EAAC,UAAU;IAACT,SAAS,EAAC,SAAS;IAACU,IAAI,EAAC,OAAO;IAACC,OAAO,EAAEb;IAAgB,CAC1F;AAEd;;;;"}
1
+ {"version":3,"file":"Filter.js","sources":["../../../../../../../../../../../../src/components/Table3/components/toolbar/Filter/filters/components/Filter.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as RTColumn } from '@tanstack/react-table';\nimport { IconButton } from '../../../../../../IconButton/IconButton';\nimport { Table3Filter, Table3FilterComparator } from '../../../../../types';\nimport { useLocalization } from '../../../../../../Provider/Localization';\nimport { FilterColumn } from './FilterColumn';\nimport { FilterComparator } from './FilterComparator';\nimport { FilterValue } from './FilterValue';\n\nexport type FilterProps<TType = unknown> = {\n allColumns: RTColumn<TType, unknown>[];\n filter: Table3Filter;\n filters: Table3Filter[];\n position: number;\n onChange: (id: string | null, value: Table3Filter) => void;\n onRemove: (columnId: string | null) => 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) as RTColumn<TType, unknown>;\n\n const {\n id,\n value: { comparator, value },\n } = filter;\n\n const handleChangeColumn = (columnId: string | null) => {\n handleChange(id, { id: columnId, value: filter.value });\n };\n\n const handleChangeComparator = (comparator: Table3FilterComparator) => {\n let nextValue = filter.value.value;\n\n if (comparator === Table3FilterComparator.IsEmpty || comparator === Table3FilterComparator.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","handleChangeComparator","nextValue","Table3FilterComparator","IsEmpty","IsNotEmpty","undefined","handleChangeValue","handleRemove","React","className","table3","conditions","and","where","FilterColumn","FilterComparator","FilterValue","IconButton","appearance","icon","onClick"],"mappings":";;;;;;;;SAkBgBA,MAAMA,CAAkBC,KAAyB;EAC7D,MAAM;IAAEC,UAAU;IAAEC,MAAM;IAAEC,OAAO;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,QAAQ;IAAEC;GAAU,GAAGP,KAAK;EACzF,MAAM;IAAEQ;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,MAAM,GAAGT,UAAU,CAACU,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,EAAE,KAAKX,MAAM,CAACW,EAAE,CAA6B;EAEnF,MAAM;IACFA,EAAE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W,6BAACQ,WAAW;IAACxB,MAAM,EAAEA,MAAM;IAAEK,UAAU,EAAEA,UAAU;IAAEX,QAAQ,EAAEoB,iBAAiB;IAAEV,KAAK,EAAEA;IAAS,eAClGY,6BAACS,UAAU;IAACC,UAAU,EAAC,UAAU;IAACT,SAAS,EAAC,SAAS;IAACU,IAAI,EAAC,OAAO;IAACC,OAAO,EAAEb;IAAgB,CAC1F;AAEd;;;;"}
@@ -2,6 +2,7 @@ import React__default from 'react';
2
2
  import { Icon } from '../../../../../../Icon/Icon.js';
3
3
  import { Tooltip } from '../../../../../../Tooltip/Tooltip.js';
4
4
  import { useLocalization } from '../../../../../../Provider/Localization.js';
5
+ import { Field } from '../../../../../../Field/Field.js';
5
6
  import { Select2 } from '../../../../../../Select2/Select2.js';
6
7
 
7
8
  function FilterColumn(props) {
@@ -15,7 +16,15 @@ function FilterColumn(props) {
15
16
  const {
16
17
  texts
17
18
  } = useLocalization();
18
- return /*#__PURE__*/React__default.createElement(Select2, Object.assign({}, attributes, {
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, {
19
28
  className: "!w-32 flex-shrink-0",
20
29
  emptyValue: null,
21
30
  onChange: handleChange,
@@ -29,11 +38,11 @@ function FilterColumn(props) {
29
38
  title: texts.table3.filters.hiddenColumn
30
39
  }, /*#__PURE__*/React__default.createElement(Icon, {
31
40
  name: "eye-off",
32
- className: "text-grey-500"
41
+ className: "text-grey-500 !h-5 !w-5"
33
42
  })) : undefined,
34
43
  disabled: column.id !== value && (!column.getCanFilter() || !!filters.find(f => f.id === column.id))
35
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})` : ''));
36
- }));
45
+ }))));
37
46
  }
38
47
 
39
48
  export { FilterColumn };
@@ -1 +1 @@
1
- {"version":3,"file":"FilterColumn.js","sources":["../../../../../../../../../../../../src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as RTColumn, ColumnFiltersState } 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';\n\nexport type FilterColumnProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n allColumns: RTColumn<TType, unknown>[];\n filters: ColumnFiltersState;\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\n return (\n <Select2 {...attributes} className=\"!w-32 flex-shrink-0\" emptyValue={null} onChange={handleChange} value={value}>\n {allColumns.map(column => (\n <Select2.Option\n key={column.id}\n value={column.id}\n postfix={\n !column.getIsVisible() ? (\n <Tooltip title={texts.table3.filters.hiddenColumn}>\n <Icon name=\"eye-off\" className=\"text-grey-500\" />\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 );\n}\n"],"names":["FilterColumn","props","allColumns","filters","onChange","handleChange","value","attributes","texts","useLocalization","React","Select2","className","emptyValue","map","column","_column$columnDef$met","_column$parent","_column$parent$column","Option","key","id","postfix","getIsVisible","Tooltip","title","table3","hiddenColumn","Icon","name","undefined","disabled","getCanFilter","find","f","columnDef","meta","header","parent"],"mappings":";;;;;;SAYgBA,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;EAEnC,oBACIC,6BAACC,OAAO,oBAAKJ,UAAU;IAAEK,SAAS,EAAC,qBAAqB;IAACC,UAAU,EAAE,IAAI;IAAET,QAAQ,EAAEC,YAAY;IAAEC,KAAK,EAAEA;MACrGJ,UAAU,CAACY,GAAG,CAACC,MAAM;IAAA,IAAAC,qBAAA,EAAAC,cAAA,EAAAC,qBAAA;IAAA,oBAClBR,6BAACC,OAAO,CAACQ,MAAM;MACXC,GAAG,EAAEL,MAAM,CAACM,EAAE;MACdf,KAAK,EAAES,MAAM,CAACM,EAAE;MAChBC,OAAO,EACH,CAACP,MAAM,CAACQ,YAAY,EAAE,gBAClBb,6BAACc,OAAO;QAACC,KAAK,EAAEjB,KAAK,CAACkB,MAAM,CAACvB,OAAO,CAACwB;sBACjCjB,6BAACkB,IAAI;QAACC,IAAI,EAAC,SAAS;QAACjB,SAAS,EAAC;QAAkB,CAC3C,GACVkB,SAAS;MAEjBC,QAAQ,EAAEhB,MAAM,CAACM,EAAE,KAAKf,KAAK,KAAK,CAACS,MAAM,CAACiB,YAAY,EAAE,IAAI,CAAC,CAAC7B,OAAO,CAAC8B,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACb,EAAE,KAAKN,MAAM,CAACM,EAAE,CAAC;OACjG,EAAAL,qBAAA,GAAAD,MAAM,CAACoB,SAAS,CAACC,IAAI,cAAApB,qBAAA,uBAArBA,qBAAA,CAAuBqB,MAAiB,KACrCtB,MAAM,CAACuB,MAAM,0BAAQvB,MAAM,CAACuB,MAAM,cAAArB,cAAA,wBAAAC,qBAAA,GAAbD,cAAA,CAAekB,SAAS,CAACC,IAAI,cAAAlB,qBAAA,uBAA7BA,qBAAA,CAA+BmB,SAAS,GAAG,EAAE,CAAC,CAC3D;GACpB,CAAC,CACI;AAElB;;;;"}
1
+ {"version":3,"file":"FilterColumn.js","sources":["../../../../../../../../../../../../src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as RTColumn } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../../../Select2/Select2';\nimport { Icon } from '../../../../../../Icon/Icon';\nimport { Tooltip } from '../../../../../../Tooltip/Tooltip';\nimport { useLocalization } from '../../../../../../Provider/Localization';\nimport { Field } from '../../../../../../Field/Field';\nimport { Table3Filter } from '../../../../../types';\n\nexport type FilterColumnProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n allColumns: RTColumn<TType, unknown>[];\n filters: Table3Filter[];\n};\n\nexport function FilterColumn<TType = unknown>(props: FilterColumnProps<TType>) {\n const { allColumns, filters, onChange: handleChange, value = null, ...attributes } = props;\n const { texts } = useLocalization();\n const selectedColumn = allColumns.find(column => column.id === value);\n const warning = selectedColumn && !selectedColumn.getIsVisible();\n\n return (\n <div className=\"flex flex-col\">\n <Field\n message={warning ? texts.table3.filters.hiddenColumn : undefined}\n warning={warning}\n className=\"min-h-[theme(spacing.8)]\">\n <Select2 {...attributes} className=\"!w-32 flex-shrink-0\" emptyValue={null} onChange={handleChange} value={value}>\n {allColumns.map(column => (\n <Select2.Option\n key={column.id}\n value={column.id}\n postfix={\n !column.getIsVisible() ? (\n <Tooltip title={texts.table3.filters.hiddenColumn}>\n <Icon name=\"eye-off\" className=\"text-grey-500 !h-5 !w-5\" />\n </Tooltip>\n ) : undefined\n }\n disabled={column.id !== value && (!column.getCanFilter() || !!filters.find(f => f.id === column.id))}>\n {(column.columnDef.meta?.header as string) +\n (column.parent ? ` (${column.parent?.columnDef.meta?.header})` : '')}\n </Select2.Option>\n ))}\n </Select2>\n </Field>\n </div>\n );\n}\n"],"names":["FilterColumn","props","allColumns","filters","onChange","handleChange","value","attributes","texts","useLocalization","selectedColumn","find","column","id","warning","getIsVisible","React","className","Field","message","table3","hiddenColumn","undefined","Select2","emptyValue","map","_column$columnDef$met","_column$parent","_column$parent$column","Option","key","postfix","Tooltip","title","Icon","name","disabled","getCanFilter","f","columnDef","meta","header","parent"],"mappings":";;;;;;;SAcgBA,YAAYA,CAAkBC,KAA+B;EACzE,MAAM;IAAEC,UAAU;IAAEC,OAAO;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,KAAK,GAAG,IAAI;IAAE,GAAGC;GAAY,GAAGN,KAAK;EAC1F,MAAM;IAAEO;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,cAAc,GAAGR,UAAU,CAACS,IAAI,CAACC,MAAM,IAAIA,MAAM,CAACC,EAAE,KAAKP,KAAK,CAAC;EACrE,MAAMQ,OAAO,GAAGJ,cAAc,IAAI,CAACA,cAAc,CAACK,YAAY,EAAE;EAEhE,oBACIC;IAAKC,SAAS,EAAC;kBACXD,6BAACE,KAAK;IACFC,OAAO,EAAEL,OAAO,GAAGN,KAAK,CAACY,MAAM,CAACjB,OAAO,CAACkB,YAAY,GAAGC,SAAS;IAChER,OAAO,EAAEA,OAAO;IAChBG,SAAS,EAAC;kBACVD,6BAACO,OAAO,oBAAKhB,UAAU;IAAEU,SAAS,EAAC,qBAAqB;IAACO,UAAU,EAAE,IAAI;IAAEpB,QAAQ,EAAEC,YAAY;IAAEC,KAAK,EAAEA;MACrGJ,UAAU,CAACuB,GAAG,CAACb,MAAM;IAAA,IAAAc,qBAAA,EAAAC,cAAA,EAAAC,qBAAA;IAAA,oBAClBZ,6BAACO,OAAO,CAACM,MAAM;MACXC,GAAG,EAAElB,MAAM,CAACC,EAAE;MACdP,KAAK,EAAEM,MAAM,CAACC,EAAE;MAChBkB,OAAO,EACH,CAACnB,MAAM,CAACG,YAAY,EAAE,gBAClBC,6BAACgB,OAAO;QAACC,KAAK,EAAEzB,KAAK,CAACY,MAAM,CAACjB,OAAO,CAACkB;sBACjCL,6BAACkB,IAAI;QAACC,IAAI,EAAC,SAAS;QAAClB,SAAS,EAAC;QAA4B,CACrD,GACVK,SAAS;MAEjBc,QAAQ,EAAExB,MAAM,CAACC,EAAE,KAAKP,KAAK,KAAK,CAACM,MAAM,CAACyB,YAAY,EAAE,IAAI,CAAC,CAAClC,OAAO,CAACQ,IAAI,CAAC2B,CAAC,IAAIA,CAAC,CAACzB,EAAE,KAAKD,MAAM,CAACC,EAAE,CAAC;OACjG,EAAAa,qBAAA,GAAAd,MAAM,CAAC2B,SAAS,CAACC,IAAI,cAAAd,qBAAA,uBAArBA,qBAAA,CAAuBe,MAAiB,KACrC7B,MAAM,CAAC8B,MAAM,0BAAQ9B,MAAM,CAAC8B,MAAM,cAAAf,cAAA,wBAAAC,qBAAA,GAAbD,cAAA,CAAeY,SAAS,CAACC,IAAI,cAAAZ,qBAAA,uBAA7BA,qBAAA,CAA+Ba,SAAS,GAAG,EAAE,CAAC,CAC3D;GACpB,CAAC,CACI,CACN,CACN;AAEd;;;;"}
@@ -58,7 +58,6 @@ function guessComparatorsBasedOnControl(column) {
58
58
  }
59
59
  }
60
60
  }
61
- // @ts-expect-error -- we ignore it because it conflicts with Table2 also overridding ColumnMeta
62
61
  if (columnMeta.dataType === 'number') {
63
62
  return [Table3FilterComparator.IsEqualTo, Table3FilterComparator.IsNotEqualTo, Table3FilterComparator.IsGreaterThan, Table3FilterComparator.IsLessThan, Table3FilterComparator.IsBetween, Table3FilterComparator.IsEmpty, Table3FilterComparator.IsNotEmpty];
64
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FilterComparator.js","sources":["../../../../../../../../../../../../src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as RTColumn, ColumnMeta } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../../../Select2/Select2';\nimport { Table3FilterComparator } from '../../../../../types';\nimport { LocalizationTexts, useLocalization } from '../../../../../../Provider/Localization';\n\nexport type FilterComparatorProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n column?: RTColumn<TType, unknown>;\n};\n\nexport function FilterComparator<TType = unknown>(props: FilterComparatorProps<TType>) {\n const { column, onChange: handleChange, value, ...attributes } = props;\n const { texts } = useLocalization();\n\n const validComparators = guessComparatorsBasedOnControl(column);\n\n React.useEffect(() => {\n if (value === undefined || !validComparators.includes(value as number)) {\n handleChange?.(validComparators[0]);\n }\n }, [validComparators]);\n\n return (\n <Select2 {...attributes} className=\"!w-32 flex-shrink-0\" disabled={!column} onChange={handleChange} value={value}>\n {validComparators.map(comparator => (\n <Select2.Option key={comparator} value={comparator}>\n {getComparatorText(comparator, texts, column)}\n </Select2.Option>\n ))}\n </Select2>\n );\n}\n\nfunction guessComparatorsBasedOnControl<TType = unknown>(column?: RTColumn<TType, unknown>) {\n const columnMeta = (column?.columnDef.meta ?? {}) as ColumnMeta<TType, unknown>;\n\n if (Array.isArray(columnMeta.filters)) {\n return columnMeta.filters;\n }\n\n if (typeof columnMeta.control === 'function') {\n const renderedControl = columnMeta.control({\n onBlur: () => undefined,\n onFocus: () => undefined,\n setValue: () => undefined,\n value: undefined,\n disabled: false,\n readOnly: false,\n ref: undefined as any,\n });\n\n if (React.isValidElement(renderedControl)) {\n const { props, type } = renderedControl as any;\n\n if (type.displayName === 'Select2') {\n if (props.multiple) {\n return [\n Table3FilterComparator.HasAnyOf,\n Table3FilterComparator.HasAllOf,\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.HasNoneOf,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n ];\n }\n\n return [\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.IsNotEqualTo,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n ];\n }\n }\n }\n\n // @ts-expect-error -- we ignore it because it conflicts with Table2 also overridding ColumnMeta\n if (columnMeta.dataType === 'number') {\n return [\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.IsNotEqualTo,\n Table3FilterComparator.IsGreaterThan,\n Table3FilterComparator.IsLessThan,\n Table3FilterComparator.IsBetween,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n ];\n }\n\n if (columnMeta.control === 'datepicker' || columnMeta.dataType === 'datetime') {\n return [\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.IsNotEqualTo,\n Table3FilterComparator.IsBetween,\n Table3FilterComparator.IsLessThan,\n Table3FilterComparator.IsGreaterThan,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n Table3FilterComparator.IsLessThanOrEqualTo,\n Table3FilterComparator.IsGreaterThanOrEqualTo,\n ];\n }\n\n if (columnMeta.control === 'switch') {\n return [Table3FilterComparator.IsEqualTo];\n }\n\n return [\n Table3FilterComparator.Contains,\n Table3FilterComparator.DoesNotContain,\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.IsNotEqualTo,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n ];\n}\n\nfunction getComparatorText<TType = unknown>(\n comparator: Table3FilterComparator,\n texts: LocalizationTexts,\n column?: RTColumn<TType, unknown>\n) {\n const isDate = column?.columnDef?.meta?.control === 'datepicker';\n\n switch (comparator) {\n case Table3FilterComparator.Contains:\n return texts.table3.filters.comparators.contains;\n\n case Table3FilterComparator.DoesNotContain:\n return texts.table3.filters.comparators.doesNotContain;\n\n case Table3FilterComparator.IsEqualTo:\n return texts.table3.filters.comparators.isEqualTo;\n\n case Table3FilterComparator.IsNotEqualTo:\n return texts.table3.filters.comparators.isNotEqualTo;\n\n case Table3FilterComparator.IsGreaterThan:\n return isDate ? texts.table3.filters.comparators.isAfter : texts.table3.filters.comparators.isGreaterThan;\n\n case Table3FilterComparator.IsLessThan:\n return isDate ? texts.table3.filters.comparators.isBefore : texts.table3.filters.comparators.isLessThan;\n\n case Table3FilterComparator.IsBetween:\n return texts.table3.filters.comparators.isBetween;\n\n case Table3FilterComparator.IsEmpty:\n return texts.table3.filters.comparators.isEmpty;\n\n case Table3FilterComparator.IsNotEmpty:\n return texts.table3.filters.comparators.isNotEmpty;\n\n case Table3FilterComparator.IsLessThanOrEqualTo:\n return isDate ? texts.table3.filters.comparators.isOnOrBefore : texts.table3.filters.comparators.isLessThanOrEqualTo;\n\n case Table3FilterComparator.IsGreaterThanOrEqualTo:\n return isDate\n ? texts.table3.filters.comparators.isOnOrAfter\n : texts.table3.filters.comparators.isGreaterThanOrEqualTo;\n\n case Table3FilterComparator.HasAnyOf:\n return texts.table3.filters.comparators.hasAnyOf;\n\n case Table3FilterComparator.HasAllOf:\n return texts.table3.filters.comparators.hasAllOf;\n\n case Table3FilterComparator.HasNoneOf:\n return texts.table3.filters.comparators.hasNoneOf;\n\n default:\n return '';\n }\n}\n"],"names":["FilterComparator","props","column","onChange","handleChange","value","attributes","texts","useLocalization","validComparators","guessComparatorsBasedOnControl","React","useEffect","undefined","includes","Select2","className","disabled","map","comparator","Option","key","getComparatorText","columnMeta","_column$columnDef$met","columnDef","meta","Array","isArray","filters","control","renderedControl","onBlur","onFocus","setValue","readOnly","ref","isValidElement","type","displayName","multiple","Table3FilterComparator","HasAnyOf","HasAllOf","IsEqualTo","HasNoneOf","IsEmpty","IsNotEmpty","IsNotEqualTo","dataType","IsGreaterThan","IsLessThan","IsBetween","IsLessThanOrEqualTo","IsGreaterThanOrEqualTo","Contains","DoesNotContain","isDate","_column$columnDef","_column$columnDef$met2","table3","comparators","contains","doesNotContain","isEqualTo","isNotEqualTo","isAfter","isGreaterThan","isBefore","isLessThan","isBetween","isEmpty","isNotEmpty","isOnOrBefore","isLessThanOrEqualTo","isOnOrAfter","isGreaterThanOrEqualTo","hasAnyOf","hasAllOf","hasNoneOf"],"mappings":";;;;;SAUgBA,gBAAgBA,CAAkBC,KAAmC;EACjF,MAA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;IAEpD,KAAKrC,sBAAsB,CAACI,SAAS;MACjC,OAAOtC,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACkB,SAAS;IAErD;MACI,OAAO,EAAE;;AAErB;;;;"}
1
+ {"version":3,"file":"FilterComparator.js","sources":["../../../../../../../../../../../../src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.tsx"],"sourcesContent":["import React from 'react';\nimport { Column as RTColumn, ColumnMeta } from '@tanstack/react-table';\nimport { Select2, Select2Props } from '../../../../../../Select2/Select2';\nimport { Table3FilterComparator } from '../../../../../types';\nimport { LocalizationTexts, useLocalization } from '../../../../../../Provider/Localization';\n\nexport type FilterComparatorProps<TType = unknown> = Omit<Select2Props, 'children'> & {\n column?: RTColumn<TType, unknown>;\n};\n\nexport function FilterComparator<TType = unknown>(props: FilterComparatorProps<TType>) {\n const { column, onChange: handleChange, value, ...attributes } = props;\n const { texts } = useLocalization();\n\n const validComparators = guessComparatorsBasedOnControl(column);\n\n React.useEffect(() => {\n if (value === undefined || !validComparators.includes(value as number)) {\n handleChange?.(validComparators[0]);\n }\n }, [validComparators]);\n\n return (\n <Select2 {...attributes} className=\"!w-32 flex-shrink-0\" disabled={!column} onChange={handleChange} value={value}>\n {validComparators.map(comparator => (\n <Select2.Option key={comparator} value={comparator}>\n {getComparatorText(comparator, texts, column)}\n </Select2.Option>\n ))}\n </Select2>\n );\n}\n\nfunction guessComparatorsBasedOnControl<TType = unknown>(column?: RTColumn<TType, unknown>) {\n const columnMeta = (column?.columnDef.meta ?? {}) as ColumnMeta<TType, unknown>;\n\n if (Array.isArray(columnMeta.filters)) {\n return columnMeta.filters;\n }\n\n if (typeof columnMeta.control === 'function') {\n const renderedControl = columnMeta.control({\n onBlur: () => undefined,\n onFocus: () => undefined,\n setValue: () => undefined,\n value: undefined,\n disabled: false,\n readOnly: false,\n ref: undefined as any,\n });\n\n if (React.isValidElement(renderedControl)) {\n const { props, type } = renderedControl as any;\n\n if (type.displayName === 'Select2') {\n if (props.multiple) {\n return [\n Table3FilterComparator.HasAnyOf,\n Table3FilterComparator.HasAllOf,\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.HasNoneOf,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n ];\n }\n\n return [\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.IsNotEqualTo,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n ];\n }\n }\n }\n\n if (columnMeta.dataType === 'number') {\n return [\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.IsNotEqualTo,\n Table3FilterComparator.IsGreaterThan,\n Table3FilterComparator.IsLessThan,\n Table3FilterComparator.IsBetween,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n ];\n }\n\n if (columnMeta.control === 'datepicker' || columnMeta.dataType === 'datetime') {\n return [\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.IsNotEqualTo,\n Table3FilterComparator.IsBetween,\n Table3FilterComparator.IsLessThan,\n Table3FilterComparator.IsGreaterThan,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n Table3FilterComparator.IsLessThanOrEqualTo,\n Table3FilterComparator.IsGreaterThanOrEqualTo,\n ];\n }\n\n if (columnMeta.control === 'switch') {\n return [Table3FilterComparator.IsEqualTo];\n }\n\n return [\n Table3FilterComparator.Contains,\n Table3FilterComparator.DoesNotContain,\n Table3FilterComparator.IsEqualTo,\n Table3FilterComparator.IsNotEqualTo,\n Table3FilterComparator.IsEmpty,\n Table3FilterComparator.IsNotEmpty,\n ];\n}\n\nfunction getComparatorText<TType = unknown>(\n comparator: Table3FilterComparator,\n texts: LocalizationTexts,\n column?: RTColumn<TType, unknown>\n) {\n const isDate = column?.columnDef?.meta?.control === 'datepicker';\n\n switch (comparator) {\n case Table3FilterComparator.Contains:\n return texts.table3.filters.comparators.contains;\n\n case Table3FilterComparator.DoesNotContain:\n return texts.table3.filters.comparators.doesNotContain;\n\n case Table3FilterComparator.IsEqualTo:\n return texts.table3.filters.comparators.isEqualTo;\n\n case Table3FilterComparator.IsNotEqualTo:\n return texts.table3.filters.comparators.isNotEqualTo;\n\n case Table3FilterComparator.IsGreaterThan:\n return isDate ? texts.table3.filters.comparators.isAfter : texts.table3.filters.comparators.isGreaterThan;\n\n case Table3FilterComparator.IsLessThan:\n return isDate ? texts.table3.filters.comparators.isBefore : texts.table3.filters.comparators.isLessThan;\n\n case Table3FilterComparator.IsBetween:\n return texts.table3.filters.comparators.isBetween;\n\n case Table3FilterComparator.IsEmpty:\n return texts.table3.filters.comparators.isEmpty;\n\n case Table3FilterComparator.IsNotEmpty:\n return texts.table3.filters.comparators.isNotEmpty;\n\n case Table3FilterComparator.IsLessThanOrEqualTo:\n return isDate ? texts.table3.filters.comparators.isOnOrBefore : texts.table3.filters.comparators.isLessThanOrEqualTo;\n\n case Table3FilterComparator.IsGreaterThanOrEqualTo:\n return isDate\n ? texts.table3.filters.comparators.isOnOrAfter\n : texts.table3.filters.comparators.isGreaterThanOrEqualTo;\n\n case Table3FilterComparator.HasAnyOf:\n return texts.table3.filters.comparators.hasAnyOf;\n\n case Table3FilterComparator.HasAllOf:\n return texts.table3.filters.comparators.hasAllOf;\n\n case Table3FilterComparator.HasNoneOf:\n return texts.table3.filters.comparators.hasNoneOf;\n\n default:\n return '';\n }\n}\n"],"names":["FilterComparator","props","column","onChange","handleChange","value","attributes","texts","useLocalization","validComparators","guessComparatorsBasedOnControl","React","useEffect","undefined","includes","Select2","className","disabled","map","comparator","Option","key","getComparatorText","columnMeta","_column$columnDef$met","columnDef","meta","Array","isArray","filters","control","renderedControl","onBlur","onFocus","setValue","readOnly","ref","isValidElement","type","displayName","multiple","Table3FilterComparator","HasAnyOf","HasAllOf","IsEqualTo","HasNoneOf","IsEmpty","IsNotEmpty","IsNotEqualTo","dataType","IsGreaterThan","IsLessThan","IsBetween","IsLessThanOrEqualTo","IsGreaterThanOrEqualTo","Contains","DoesNotContain","isDate","_column$columnDef","_column$columnDef$met2","table3","comparators","contains","doesNotContain","isEqualTo","isNotEqualTo","isAfter","isGreaterThan","isBefore","isLessThan","isBetween","isEmpty","isNotEmpty","isOnOrBefore","isLessThanOrEqualTo","isOnOrAfter","isGreaterThanOrEqualTo","hasAnyOf","hasAllOf","hasNoneOf"],"mappings":";;;;;SAUgBA,gBAAgBA,CAAkBC,KAAmC;EACjF,MAAM;IAAEC,MAAM;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGL,KAAK;EACtE,MAAM;IAAEM;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,gBAAgB,GAAGC,8BAA8B,CAACR,MAAM,CAAC;EAE/DS,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIP,KAAK,KAAKQ,SAAS,IAAI,CAACJ,gBAAgB,CAACK,QAAQ,CAACT,KAAe,CAAC,EAAE;MACpED,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAGK,gBAAgB,CAAC,CAAC,CAAC,CAAC;;GAE1C,EAAE,CAACA,gBAAgB,CAAC,CAAC;EAEtB,oBACIE,6BAACI,OAAO,oBAAKT,UAAU;IAAEU,SAAS,EAAC,qBAAqB;IAACC,QAAQ,EAAE,CAACf,MAAM;IAAEC,QAAQ,EAAEC,YAAY;IAAEC,KAAK,EAAEA;MACtGI,gBAAgB,CAACS,GAAG,CAACC,UAAU,iBAC5BR,6BAACI,OAAO,CAACK,MAAM;IAACC,GAAG,EAAEF,UAAU;IAAEd,KAAK,EAAEc;KACnCG,iBAAiB,CAACH,UAAU,EAAEZ,KAAK,EAAEL,MAAM,CAAC,CAEpD,CAAC,CACI;AAElB;AAEA,SAASQ,8BAA8BA,CAAkBR,MAAiC;;EACtF,MAAMqB,UAAU,IAAAC,qBAAA,GAAItB,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEuB,SAAS,CAACC,IAAI,cAAAF,qBAAA,cAAAA,qBAAA,GA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AM,CAAC/B,OAAO,CAACgC,WAAW,CAACe,sBAAsB;IAEjE,KAAKnC,sBAAsB,CAACC,QAAQ;MAChC,OAAOnC,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACgB,QAAQ;IAEpD,KAAKpC,sBAAsB,CAACE,QAAQ;MAChC,OAAOpC,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACiB,QAAQ;IAEpD,KAAKrC,sBAAsB,CAACI,SAAS;MACjC,OAAOtC,KAAK,CAACqD,MAAM,CAAC/B,OAAO,CAACgC,WAAW,CAACkB,SAAS;IAErD;MACI,OAAO,EAAE;;AAErB;;;;"}
@@ -75,8 +75,8 @@ function Control(props) {
75
75
  value,
76
76
  ...attributes
77
77
  } = props;
78
- const controlRenderer = (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.control;
79
- const dataType = (_column$columnDef$met3 = column.columnDef.meta) === null || _column$columnDef$met3 === void 0 ? void 0 : _column$columnDef$met3.dataType;
78
+ 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;
79
+ 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;
80
80
  useEffect(() => {
81
81
  if (controlRenderer === 'switch') {
82
82
  onChange(false);
@@ -107,7 +107,9 @@ function Control(props) {
107
107
  value: String(value !== null && value !== void 0 ? value : '')
108
108
  }));
109
109
  }
110
- return /*#__PURE__*/React__default.createElement(Input, Object.assign({}, attributes, {
110
+ return /*#__PURE__*/React__default.createElement(Input, Object.assign({
111
+ disabled: !column
112
+ }, attributes, {
111
113
  className: "flex-grow",
112
114
  onChange: event => onChange(event.target.value),
113
115
  value: String(value !== null && value !== void 0 ? value : '')