@economic/taco 2.39.2 → 2.40.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. package/dist/components/OverflowGroup/OverflowGroup.d.ts +0 -1
  2. package/dist/components/Table/hooks/useRowCreation.d.ts +4 -4
  3. package/dist/components/Table/types.d.ts +19 -19
  4. package/dist/components/Tabs/Tabs.d.ts +0 -5
  5. package/dist/esm/packages/taco/src/components/Alert/Alert.js.map +1 -1
  6. package/dist/esm/packages/taco/src/components/Badge/Badge.js.map +1 -1
  7. package/dist/esm/packages/taco/src/components/BadgeIcon/BadgeIcon.js.map +1 -1
  8. package/dist/esm/packages/taco/src/components/Banner/Banner.js +1 -1
  9. package/dist/esm/packages/taco/src/components/Banner/Banner.js.map +1 -1
  10. package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
  11. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js +4 -4
  12. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/Card/Card.js +2 -2
  14. package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +2 -2
  16. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +2 -2
  18. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
  19. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +6 -6
  20. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
  21. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +2 -2
  22. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  23. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -1
  24. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +5 -5
  25. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
  26. package/dist/esm/packages/taco/src/components/Field/Field.js +1 -1
  27. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  28. package/dist/esm/packages/taco/src/components/Hanger/Hanger.js +1 -1
  29. package/dist/esm/packages/taco/src/components/Hanger/Hanger.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Display.js.map +1 -1
  31. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js +1 -1
  32. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js.map +1 -1
  33. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +2 -2
  34. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
  35. package/dist/esm/packages/taco/src/components/Header/components/Link.js +1 -1
  36. package/dist/esm/packages/taco/src/components/Header/components/Link.js.map +1 -1
  37. package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js +1 -1
  38. package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js.map +1 -1
  39. package/dist/esm/packages/taco/src/components/Icon/Icon.js +1 -1
  40. package/dist/esm/packages/taco/src/components/Icon/Icon.js.map +1 -1
  41. package/dist/esm/packages/taco/src/components/Input/Input.js +1 -1
  42. package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
  43. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js +1 -1
  44. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
  45. package/dist/esm/packages/taco/src/components/List/components/Item.js +1 -1
  46. package/dist/esm/packages/taco/src/components/List/components/Item.js.map +1 -1
  47. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +4 -4
  48. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
  49. package/dist/esm/packages/taco/src/components/Listbox/useMultiListbox.js.map +1 -1
  50. package/dist/esm/packages/taco/src/components/Listbox/util.js.map +1 -1
  51. package/dist/esm/packages/taco/src/components/Menu/components/Item.js +2 -2
  52. package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
  53. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js +1 -1
  54. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js.map +1 -1
  55. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js +2 -2
  56. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js.map +1 -1
  57. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js +1 -1
  58. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js.map +1 -1
  59. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +1 -4
  60. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
  61. package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js +1 -1
  62. package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js.map +1 -1
  63. package/dist/esm/packages/taco/src/components/Pagination/Pagination.js +3 -3
  64. package/dist/esm/packages/taco/src/components/Pagination/Pagination.js.map +1 -1
  65. package/dist/esm/packages/taco/src/components/Popover/Popover.js +2 -2
  66. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  67. package/dist/esm/packages/taco/src/components/Progress/Progress.js.map +1 -1
  68. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  69. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js +1 -1
  70. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
  71. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
  72. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js +1 -1
  73. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js.map +1 -1
  74. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +5 -5
  75. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  76. package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
  77. package/dist/esm/packages/taco/src/components/Select/useSelect.js +1 -1
  78. package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
  79. package/dist/esm/packages/taco/src/components/Select2/Select2.js +7 -7
  80. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  81. package/dist/esm/packages/taco/src/components/Select2/components/Create.js +2 -2
  82. package/dist/esm/packages/taco/src/components/Select2/components/Create.js.map +1 -1
  83. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +5 -5
  84. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  85. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +4 -4
  86. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  87. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +5 -5
  88. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  89. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +1 -1
  90. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
  91. package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
  92. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js +2 -2
  93. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js.map +1 -1
  94. package/dist/esm/packages/taco/src/components/Table/components/PaginatedTable.js.map +1 -1
  95. package/dist/esm/packages/taco/src/components/Table/components/Table.js.map +1 -1
  96. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +1 -1
  97. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
  98. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +8 -8
  99. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js.map +1 -1
  100. package/dist/esm/packages/taco/src/components/Table/hooks/useRowCreation.js.map +1 -1
  101. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js +1 -1
  102. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js.map +1 -1
  103. package/dist/esm/packages/taco/src/components/Table/util/renderRow.js.map +1 -1
  104. package/dist/esm/packages/taco/src/components/Table/util/rowIndexPath.js.map +1 -1
  105. package/dist/esm/packages/taco/src/components/Table3/Table3.js +3 -3
  106. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  107. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.js.map +1 -1
  108. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/TextareaWithAutosizing.js.map +1 -1
  109. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js +1 -1
  110. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js.map +1 -1
  111. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +1 -1
  112. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  113. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js +2 -2
  114. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js.map +1 -1
  115. package/dist/esm/packages/taco/src/components/Table3/useTable3.js +1 -1
  116. package/dist/esm/packages/taco/src/components/Table3/useTable3.js.map +1 -1
  117. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  118. package/dist/esm/packages/taco/src/components/Tabs/Tabs.js +2 -11
  119. package/dist/esm/packages/taco/src/components/Tabs/Tabs.js.map +1 -1
  120. package/dist/esm/packages/taco/src/components/Tag/Tag.js +3 -3
  121. package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
  122. package/dist/esm/packages/taco/src/components/Toast/Toaster.js +1 -1
  123. package/dist/esm/packages/taco/src/components/Toast/Toaster.js.map +1 -1
  124. package/dist/esm/packages/taco/src/components/Toast/util.js.map +1 -1
  125. package/dist/esm/packages/taco/src/components/Tour/Tour.js +2 -2
  126. package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
  127. package/dist/esm/packages/taco/src/components/Treeview/Treeview.js +1 -1
  128. package/dist/esm/packages/taco/src/components/Treeview/Treeview.js.map +1 -1
  129. package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js.map +1 -1
  130. package/dist/esm/packages/taco/src/primitives/BubbleSelect.js.map +1 -1
  131. package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js.map +1 -1
  132. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js.map +1 -1
  133. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +4 -4
  134. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
  135. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js +1 -1
  136. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js.map +1 -1
  137. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +3 -3
  138. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
  139. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
  140. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +1 -1
  141. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
  142. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js +3 -3
  143. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js.map +1 -1
  144. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Goto.js.map +1 -1
  145. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js +9 -9
  146. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js.map +1 -1
  147. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js +2 -2
  148. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js.map +1 -1
  149. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js +1 -1
  150. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js.map +1 -1
  151. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/Toolbar.js +1 -1
  152. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/Toolbar.js.map +1 -1
  153. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/Filters.js +1 -1
  154. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/Filters.js.map +1 -1
  155. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js +1 -1
  156. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
  157. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js +1 -1
  158. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -1
  159. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.js +1 -1
  160. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.js.map +1 -1
  161. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/util.js +1 -1
  162. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/util.js.map +1 -1
  163. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js +1 -1
  164. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
  165. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/PrintDialog.js +4 -4
  166. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/PrintDialog.js.map +1 -1
  167. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js.map +1 -1
  168. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.js +3 -3
  169. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.js.map +1 -1
  170. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/Settings.js +6 -6
  171. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/Settings.js.map +1 -1
  172. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleColumnFreezing.js.map +1 -1
  173. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js.map +1 -1
  174. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTablePrinting.js.map +1 -1
  175. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js.map +1 -1
  176. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js.map +1 -1
  177. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +2 -2
  178. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  179. package/dist/esm/packages/taco/src/utils/date.js +1 -1
  180. package/dist/esm/packages/taco/src/utils/date.js.map +1 -1
  181. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  182. package/dist/taco.cjs.development.js +160 -170
  183. package/dist/taco.cjs.development.js.map +1 -1
  184. package/dist/taco.cjs.production.min.js +1 -1
  185. package/dist/taco.cjs.production.min.js.map +1 -1
  186. package/package.json +2 -2
@@ -178,14 +178,14 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
178
178
  "data-cell-pinned": isPinned ? isPinned : undefined,
179
179
  style: style,
180
180
  ref: setRef
181
- }), isPlaceholder ? null : isInternalColumn(id) ? children : ( /*#__PURE__*/React__default.createElement(Tooltip, {
181
+ }), isPlaceholder ? null : isInternalColumn(id) ? children : (/*#__PURE__*/React__default.createElement(Tooltip, {
182
182
  title: String(tooltip !== null && tooltip !== void 0 ? tooltip : children),
183
183
  placement: "top"
184
184
  }, /*#__PURE__*/React__default.createElement("span", {
185
185
  className: "truncate"
186
186
  }, children))), sortDirection ? /*#__PURE__*/React__default.createElement(SortIndicator, {
187
187
  direction: sortDirection
188
- }) : null, hasMenu ? ( /*#__PURE__*/React__default.createElement(HeaderMenu, {
188
+ }) : null, hasMenu ? (/*#__PURE__*/React__default.createElement(HeaderMenu, {
189
189
  canFilter: canFilter,
190
190
  canGoto: canGoto,
191
191
  canHide: canHide,
@@ -207,7 +207,7 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
207
207
  setRowActiveIndex: setRowActiveIndex,
208
208
  sortDirection: sortDirection,
209
209
  columnId: id
210
- })) : null, canResize ? ( /*#__PURE__*/React__default.createElement(Resizer, {
210
+ })) : null, canResize ? (/*#__PURE__*/React__default.createElement(Resizer, {
211
211
  headerRef: ref,
212
212
  id: id,
213
213
  isResizing: isResizing,
@@ -1 +1 @@
1
- {"version":3,"file":"Header.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Header/Header.tsx"],"sourcesContent":["import React from 'react';\nimport {\n TableMeta as ReactTableMeta,\n ColumnMeta as ReactTableColumnMeta,\n Header as ReactTableHeader,\n ColumnPinningPosition as ReactTableColumnPinningPosition,\n flexRender,\n} from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { freezeUptoExternalColumn, isInternalColumn, unfreezeAllExternalColumns } from '../../../useTableManager/util/columns';\nimport { Tooltip } from '../../../../../components/Tooltip/Tooltip';\nimport { SortIndicator, getSortAttributes } from './components/SortIndicator';\nimport {\n TableColumnAlignment,\n TableColumnMenu,\n TableColumnSortDirection,\n TableColumnWidth,\n TableFilterComparator,\n} from '../../../types';\nimport { Resizer } from './components/Resizer';\nimport { HeaderMenu } from './components/Menu';\nimport { getIsPinned, useSetInitialColumnSizing } from './util';\n\nexport type HeaderProps<TType = unknown> = {\n header: ReactTableHeader<TType, unknown>;\n scrollToIndex: (index: number) => void;\n};\n\nexport function Header<TType = unknown>(props: HeaderProps<TType>) {\n const { header, scrollToIndex } = props;\n\n if (header.column.getIsGrouped()) {\n return null;\n }\n\n const { table } = header.getContext();\n\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const columnMeta = (header.column.columnDef.meta ?? {}) as ReactTableColumnMeta<TType, unknown>;\n\n const isGroup = !!header.subHeaders.length;\n const isPinned = getIsPinned(header);\n\n const canFilter = !header.isPlaceholder && header.column.getCanFilter() && !!table.options.enableColumnFilters;\n const canHide = !header.isPlaceholder && !isGroup && header.column.getCanHide();\n const canMeasureSize = !!table.getRowModel().rows.length;\n const canPin = !header.isPlaceholder && !isGroup && header.column.getCanPin();\n const canResize = !header.isPlaceholder && !isGroup && header.column.getCanResize();\n const canSort = !header.isPlaceholder && !isGroup && header.column.getCanSort();\n const canGoto = canSort && !header.isPlaceholder && !isGroup && tableMeta.rowGoto.isEnabled && !!header.column.getIsSorted();\n\n const hasMenu = !isInternalColumn(header.id) && (canHide || canGoto || canPin || canSort || !!columnMeta.menu);\n\n const sorting = table.getState().sorting;\n const filters = table.getState().columnFilters;\n const search = table.getState().globalFilter;\n\n // passing header or column results in re-renders on scroll, so anything from those objects as memoed props\n const memoedProps: MemoedHeaderProps = {\n align: columnMeta.align,\n canFilter,\n canHide,\n canGoto,\n canMeasureSize,\n canPin,\n canResize,\n canSort,\n className: cn('group/header', columnMeta.headerClassName),\n children: flexRender(header.column.columnDef.header, header.getContext()),\n colSpan: header.colSpan,\n customMenu: columnMeta.menu,\n defaultWidth: columnMeta.defaultWidth,\n hasMenu,\n id: header.id,\n isFiltered: header.column.getIsFiltered(),\n index: header.index,\n isGroup,\n isPinned,\n isPlaceholder: header.isPlaceholder,\n offset: header.column.getStart(isPinned),\n scrollToIndex,\n setRowActiveIndex: tableMeta.rowActive.setRowActiveIndex,\n setColumnSizing: table.setColumnSizing,\n tooltip: columnMeta.tooltip,\n width: table.getState().columnSizing[header.id],\n };\n\n if (header.isPlaceholder) {\n const nextHeader = header.headerGroup.headers[header.index + 1];\n memoedProps.className = cn('!bg-white before:!content-none', memoedProps.className, {\n 'after:!content-none': nextHeader?.isPlaceholder,\n });\n }\n\n if (canFilter) {\n memoedProps.onFilter = () => {\n header.column.setFilterValue({ comparator: TableFilterComparator.Contains });\n };\n }\n\n if (canGoto) {\n memoedProps.onGoto = ((query: string) => tableMeta.rowGoto.handleGoto?.(header.id, query, sorting, filters, search)) as (\n query: string\n ) => Promise<number>;\n }\n\n if (canHide) {\n memoedProps.onHide = header.column.getToggleVisibilityHandler();\n }\n\n if (canPin) {\n memoedProps.onPin = (index: number | undefined) => {\n // TODO: this can probably be moved to a feature hook\n table.setColumnPinning(pinningState => {\n return {\n ...pinningState,\n left:\n index === undefined\n ? unfreezeAllExternalColumns(pinningState.left)\n : freezeUptoExternalColumn(\n index,\n table.getAllLeafColumns().map(column => column.id)\n ),\n };\n });\n };\n }\n\n if (canResize) {\n memoedProps.isResizing = header.column.getIsResizing();\n memoedProps.onResize = header.getResizeHandler();\n memoedProps.resetSize = header.column.resetSize;\n }\n\n if (canSort) {\n const handleSortToggle = (sortDirection: TableColumnSortDirection | false) => {\n if (sortDirection === false) {\n header.column.clearSorting();\n } else {\n header.column.toggleSorting(sortDirection === 'desc');\n }\n };\n\n memoedProps.onSort = header.column.getToggleSortingHandler();\n memoedProps.onSortToggle = handleSortToggle;\n memoedProps.sortDirection = header.column.getIsSorted();\n }\n\n return <MemoedHeader key={header.id} {...memoedProps} />;\n}\n\nexport type MemoedHeaderProps = {\n align?: TableColumnAlignment;\n canFilter: boolean;\n canHide: boolean;\n canGoto: boolean;\n canMeasureSize: boolean;\n canPin: boolean;\n canResize: boolean;\n canSort: boolean;\n children: JSX.Element | React.ReactNode;\n className?: string;\n colSpan: number;\n customMenu?: TableColumnMenu;\n defaultWidth?: TableColumnWidth;\n hasMenu: boolean;\n id: string;\n index: number;\n isFiltered: boolean;\n isGroup: boolean;\n isPinned?: ReactTableColumnPinningPosition;\n isPlaceholder: boolean;\n isResizing?: boolean;\n offset?: number;\n onFilter?: () => void;\n onGoto?: (query: string) => Promise<number>;\n onHide?: (event: unknown) => void;\n onPin?: (index: number | undefined) => void;\n onResize?: (event: unknown) => void;\n onSort?: (event: unknown) => void;\n onSortToggle?: (sortDirection: TableColumnSortDirection | false) => void;\n resetSize?: () => void;\n scrollToIndex: (index: number) => void;\n setRowActiveIndex: (index: number) => void;\n setColumnSizing: any;\n sortDirection?: TableColumnSortDirection | false;\n tooltip?: string;\n width?: TableColumnWidth;\n};\n\nconst MemoedHeader = React.memo(function MemoedHeader(props: MemoedHeaderProps) {\n const {\n align,\n canFilter,\n canGoto,\n canHide,\n canMeasureSize,\n canPin,\n canResize,\n canSort,\n children,\n className,\n colSpan,\n customMenu,\n defaultWidth,\n hasMenu,\n id,\n index,\n isFiltered,\n isGroup,\n isPinned,\n isPlaceholder,\n isResizing,\n offset,\n onFilter: handleFilter,\n onGoto: handleGoto,\n onHide: handleHide,\n onPin: handlePin,\n onResize: handleResize,\n onSort: handleSort,\n onSortToggle: handleSortToggle,\n resetSize: handleResetSize,\n scrollToIndex,\n setRowActiveIndex,\n setColumnSizing,\n sortDirection,\n tooltip,\n width,\n } = props;\n const [ref, setRef] = React.useState<HTMLTableCellElement | null>(null);\n\n // save column width if none is set\n useSetInitialColumnSizing(id, defaultWidth, width, ref, canMeasureSize, setColumnSizing);\n\n // feature specific styles\n const style: React.CSSProperties = {};\n\n // column groups often span multiple columns\n if (colSpan > 1) {\n style.gridColumn = `span ${colSpan}`;\n }\n\n // pinned columns should be offset from either the left or right\n if (isPinned) {\n style[isPinned] = `${offset}px`;\n }\n\n return (\n <th\n {...getSortAttributes(canSort, handleSort, sortDirection)}\n className={className}\n data-cell-align={isGroup ? 'center' : align}\n data-cell-id={id}\n data-cell-pinned={isPinned ? isPinned : undefined}\n style={style}\n ref={setRef}>\n {isPlaceholder ? null : isInternalColumn(id) ? (\n children\n ) : (\n <Tooltip title={String(tooltip ?? children)} placement=\"top\">\n <span className=\"truncate\">{children}</span>\n </Tooltip>\n )}\n {sortDirection ? <SortIndicator direction={sortDirection} /> : null}\n {hasMenu ? (\n <HeaderMenu\n canFilter={canFilter}\n canGoto={canGoto}\n canHide={canHide}\n canPin={canPin}\n canSort={canSort}\n className={cn({\n 'ml-auto': align !== 'right',\n 'ml-0': align === 'right',\n })}\n customMenu={customMenu}\n index={index}\n isFiltered={isFiltered}\n onFilter={handleFilter}\n onGoto={handleGoto}\n onHide={handleHide}\n onPin={handlePin}\n onSortToggle={handleSortToggle}\n scrollToIndex={scrollToIndex}\n setRowActiveIndex={setRowActiveIndex}\n sortDirection={sortDirection}\n columnId={id}\n />\n ) : null}\n {canResize ? (\n <Resizer\n headerRef={ref}\n id={id}\n isResizing={isResizing as boolean}\n onResize={handleResize as (event: unknown) => void}\n onResetSize={handleResetSize as () => void}\n setColumnSizing={setColumnSizing}\n width={width}\n />\n ) : null}\n </th>\n );\n});\n"],"names":["Header","props","header","scrollToIndex","column","getIsGrouped","table","getContext","tableMeta","options","meta","columnMeta","_header$column$column","columnDef","isGroup","subHeaders","length","isPinned","getIsPinned","canFilter","isPlaceholder","getCanFilter","enableColumnFilters","canHide","getCanHide","canMeasureSize","getRowModel","rows","canPin","getCanPin","canResize","getCanResize","canSort","getCanSort","canGoto","rowGoto","isEnabled","getIsSorted","hasMenu","isInternalColumn","id","menu","sorting","getState","filters","columnFilters","search","globalFilter","memoedProps","align","className","cn","headerClassName","children","flexRender","colSpan","customMenu","defaultWidth","isFiltered","getIsFiltered","index","offset","getStart","setRowActiveIndex","rowActive","setColumnSizing","tooltip","width","columnSizing","nextHeader","headerGroup","headers","onFilter","setFilterValue","comparator","TableFilterComparator","Contains","onGoto","query","_tableMeta$rowGoto$ha","_tableMeta$rowGoto","handleGoto","call","onHide","getToggleVisibilityHandler","onPin","setColumnPinning","pinningState","left","undefined","unfreezeAllExternalColumns","freezeUptoExternalColumn","getAllLeafColumns","map","isResizing","getIsResizing","onResize","getResizeHandler","resetSize","handleSortToggle","sortDirection","clearSorting","toggleSorting","onSort","getToggleSortingHandler","onSortToggle","React","MemoedHeader","key","memo","handleFilter","handleHide","handlePin","handleResize","handleSort","handleResetSize","ref","setRef","useState","useSetInitialColumnSizing","style","gridColumn","getSortAttributes","Tooltip","title","String","placement","SortIndicator","direction","HeaderMenu","columnId","Resizer","headerRef","onResetSize"],"mappings":";;;;;;;;;;;SA4BgBA,MAAMA,CAAkBC,KAAyB;;EAC7D,MAAM;IAAEC,MAAM;IAAEC;GAAe,GAAGF,KAAK;EAEvC,IAAIC,MAAM,CAACE,MAAM,CAACC,YAAY,EAAE,EAAE;IAC9B,OAAO,IAAI;;EAGf,MAAM;IAAEC;GAAO,GAAGJ,MAAM,CAACK,UAAU,EAAE;EAErC,MAAMC,SAAS,GAAGF,KAAK,CAACG,OAAO,CAACC,IAA6B;EAC7D,MAAMC,UAAU,IAAAC,qBAAA,GAAIV,MAAM,CAACE,MAAM,CAACS,SAAS,CAACH,IAAI,cAAAE,qBAAA,cAAAA,qBAAA,GAAI,EAA2C;EAE/F,MAAME,OAAO,GAAG,CAAC,CAACZ,MAAM,CAACa,UAAU,CAACC,MAAM;EAC1C,MAAMC,QAAQ,GAAGC,WAAW,CAAChB,MAAM,CAAC;EAEpC,MAAMiB,SAAS,GAAG,CAACjB,MAAM,CAACkB,aAAa,IAAIlB,MAAM,CAACE,MAAM,CAACiB,YAAY,EAAE,IAAI,CAAC,CAACf,KAAK,CAACG,OAAO,CAACa,mBAAmB;EAC9G,MAAMC,OAAO,GAAG,CAACrB,MAAM,CAACkB,aAAa,IAAI,CAACN,OAAO,IAAIZ,MAAM,CAACE,MAAM,CAACoB,UAAU,EAAE;EAC/E,MAAMC,cAAc,GAAG,CAAC,CAACnB,KAAK,CAACoB,WAAW,EAAE,CAACC,IAAI,CAACX,MAAM;EACxD,MAAMY,MAAM,GAAG,CAAC1B,MAAM,CAACkB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,iBAAiB,EAAEA,iBAAiB;IACpCqC,aAAa,EAAEA,aAAa;IAC5B8B,QAAQ,EAAE1F;IACZ,IACF,IAAI,EACPV,SAAS,kBACN4E,6BAACyB,OAAO;IACJC,SAAS,EAAEhB,GAAG;IACd5E,EAAE,EAAEA,EAAE;IACNsD,UAAU,EAAEA,UAAqB;IACjCE,QAAQ,EAAEiB,YAAwC;IAClDoB,WAAW,EAAElB,eAA6B;IAC1ClD,eAAe,EAAEA,eAAe;IAChCE,KAAK,EAAEA;IACT,IACF,IAAI,CACP;AAEb,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"Header.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Header/Header.tsx"],"sourcesContent":["import React from 'react';\nimport {\n TableMeta as ReactTableMeta,\n ColumnMeta as ReactTableColumnMeta,\n Header as ReactTableHeader,\n ColumnPinningPosition as ReactTableColumnPinningPosition,\n flexRender,\n} from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { freezeUptoExternalColumn, isInternalColumn, unfreezeAllExternalColumns } from '../../../useTableManager/util/columns';\nimport { Tooltip } from '../../../../../components/Tooltip/Tooltip';\nimport { SortIndicator, getSortAttributes } from './components/SortIndicator';\nimport {\n TableColumnAlignment,\n TableColumnMenu,\n TableColumnSortDirection,\n TableColumnWidth,\n TableFilterComparator,\n} from '../../../types';\nimport { Resizer } from './components/Resizer';\nimport { HeaderMenu } from './components/Menu';\nimport { getIsPinned, useSetInitialColumnSizing } from './util';\n\nexport type HeaderProps<TType = unknown> = {\n header: ReactTableHeader<TType, unknown>;\n scrollToIndex: (index: number) => void;\n};\n\nexport function Header<TType = unknown>(props: HeaderProps<TType>) {\n const { header, scrollToIndex } = props;\n\n if (header.column.getIsGrouped()) {\n return null;\n }\n\n const { table } = header.getContext();\n\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const columnMeta = (header.column.columnDef.meta ?? {}) as ReactTableColumnMeta<TType, unknown>;\n\n const isGroup = !!header.subHeaders.length;\n const isPinned = getIsPinned(header);\n\n const canFilter = !header.isPlaceholder && header.column.getCanFilter() && !!table.options.enableColumnFilters;\n const canHide = !header.isPlaceholder && !isGroup && header.column.getCanHide();\n const canMeasureSize = !!table.getRowModel().rows.length;\n const canPin = !header.isPlaceholder && !isGroup && header.column.getCanPin();\n const canResize = !header.isPlaceholder && !isGroup && header.column.getCanResize();\n const canSort = !header.isPlaceholder && !isGroup && header.column.getCanSort();\n const canGoto = canSort && !header.isPlaceholder && !isGroup && tableMeta.rowGoto.isEnabled && !!header.column.getIsSorted();\n\n const hasMenu = !isInternalColumn(header.id) && (canHide || canGoto || canPin || canSort || !!columnMeta.menu);\n\n const sorting = table.getState().sorting;\n const filters = table.getState().columnFilters;\n const search = table.getState().globalFilter;\n\n // passing header or column results in re-renders on scroll, so anything from those objects as memoed props\n const memoedProps: MemoedHeaderProps = {\n align: columnMeta.align,\n canFilter,\n canHide,\n canGoto,\n canMeasureSize,\n canPin,\n canResize,\n canSort,\n className: cn('group/header', columnMeta.headerClassName),\n children: flexRender(header.column.columnDef.header, header.getContext()),\n colSpan: header.colSpan,\n customMenu: columnMeta.menu,\n defaultWidth: columnMeta.defaultWidth,\n hasMenu,\n id: header.id,\n isFiltered: header.column.getIsFiltered(),\n index: header.index,\n isGroup,\n isPinned,\n isPlaceholder: header.isPlaceholder,\n offset: header.column.getStart(isPinned),\n scrollToIndex,\n setRowActiveIndex: tableMeta.rowActive.setRowActiveIndex,\n setColumnSizing: table.setColumnSizing,\n tooltip: columnMeta.tooltip,\n width: table.getState().columnSizing[header.id],\n };\n\n if (header.isPlaceholder) {\n const nextHeader = header.headerGroup.headers[header.index + 1];\n memoedProps.className = cn('!bg-white before:!content-none', memoedProps.className, {\n 'after:!content-none': nextHeader?.isPlaceholder,\n });\n }\n\n if (canFilter) {\n memoedProps.onFilter = () => {\n header.column.setFilterValue({ comparator: TableFilterComparator.Contains });\n };\n }\n\n if (canGoto) {\n memoedProps.onGoto = ((query: string) => tableMeta.rowGoto.handleGoto?.(header.id, query, sorting, filters, search)) as (\n query: string\n ) => Promise<number>;\n }\n\n if (canHide) {\n memoedProps.onHide = header.column.getToggleVisibilityHandler();\n }\n\n if (canPin) {\n memoedProps.onPin = (index: number | undefined) => {\n // TODO: this can probably be moved to a feature hook\n table.setColumnPinning(pinningState => {\n return {\n ...pinningState,\n left:\n index === undefined\n ? unfreezeAllExternalColumns(pinningState.left)\n : freezeUptoExternalColumn(\n index,\n table.getAllLeafColumns().map(column => column.id)\n ),\n };\n });\n };\n }\n\n if (canResize) {\n memoedProps.isResizing = header.column.getIsResizing();\n memoedProps.onResize = header.getResizeHandler();\n memoedProps.resetSize = header.column.resetSize;\n }\n\n if (canSort) {\n const handleSortToggle = (sortDirection: TableColumnSortDirection | false) => {\n if (sortDirection === false) {\n header.column.clearSorting();\n } else {\n header.column.toggleSorting(sortDirection === 'desc');\n }\n };\n\n memoedProps.onSort = header.column.getToggleSortingHandler();\n memoedProps.onSortToggle = handleSortToggle;\n memoedProps.sortDirection = header.column.getIsSorted();\n }\n\n return <MemoedHeader key={header.id} {...memoedProps} />;\n}\n\nexport type MemoedHeaderProps = {\n align?: TableColumnAlignment;\n canFilter: boolean;\n canHide: boolean;\n canGoto: boolean;\n canMeasureSize: boolean;\n canPin: boolean;\n canResize: boolean;\n canSort: boolean;\n children: JSX.Element | React.ReactNode;\n className?: string;\n colSpan: number;\n customMenu?: TableColumnMenu;\n defaultWidth?: TableColumnWidth;\n hasMenu: boolean;\n id: string;\n index: number;\n isFiltered: boolean;\n isGroup: boolean;\n isPinned?: ReactTableColumnPinningPosition;\n isPlaceholder: boolean;\n isResizing?: boolean;\n offset?: number;\n onFilter?: () => void;\n onGoto?: (query: string) => Promise<number>;\n onHide?: (event: unknown) => void;\n onPin?: (index: number | undefined) => void;\n onResize?: (event: unknown) => void;\n onSort?: (event: unknown) => void;\n onSortToggle?: (sortDirection: TableColumnSortDirection | false) => void;\n resetSize?: () => void;\n scrollToIndex: (index: number) => void;\n setRowActiveIndex: (index: number) => void;\n setColumnSizing: any;\n sortDirection?: TableColumnSortDirection | false;\n tooltip?: string;\n width?: TableColumnWidth;\n};\n\nconst MemoedHeader = React.memo(function MemoedHeader(props: MemoedHeaderProps) {\n const {\n align,\n canFilter,\n canGoto,\n canHide,\n canMeasureSize,\n canPin,\n canResize,\n canSort,\n children,\n className,\n colSpan,\n customMenu,\n defaultWidth,\n hasMenu,\n id,\n index,\n isFiltered,\n isGroup,\n isPinned,\n isPlaceholder,\n isResizing,\n offset,\n onFilter: handleFilter,\n onGoto: handleGoto,\n onHide: handleHide,\n onPin: handlePin,\n onResize: handleResize,\n onSort: handleSort,\n onSortToggle: handleSortToggle,\n resetSize: handleResetSize,\n scrollToIndex,\n setRowActiveIndex,\n setColumnSizing,\n sortDirection,\n tooltip,\n width,\n } = props;\n const [ref, setRef] = React.useState<HTMLTableCellElement | null>(null);\n\n // save column width if none is set\n useSetInitialColumnSizing(id, defaultWidth, width, ref, canMeasureSize, setColumnSizing);\n\n // feature specific styles\n const style: React.CSSProperties = {};\n\n // column groups often span multiple columns\n if (colSpan > 1) {\n style.gridColumn = `span ${colSpan}`;\n }\n\n // pinned columns should be offset from either the left or right\n if (isPinned) {\n style[isPinned] = `${offset}px`;\n }\n\n return (\n <th\n {...getSortAttributes(canSort, handleSort, sortDirection)}\n className={className}\n data-cell-align={isGroup ? 'center' : align}\n data-cell-id={id}\n data-cell-pinned={isPinned ? isPinned : undefined}\n style={style}\n ref={setRef}>\n {isPlaceholder ? null : isInternalColumn(id) ? (\n children\n ) : (\n <Tooltip title={String(tooltip ?? children)} placement=\"top\">\n <span className=\"truncate\">{children}</span>\n </Tooltip>\n )}\n {sortDirection ? <SortIndicator direction={sortDirection} /> : null}\n {hasMenu ? (\n <HeaderMenu\n canFilter={canFilter}\n canGoto={canGoto}\n canHide={canHide}\n canPin={canPin}\n canSort={canSort}\n className={cn({\n 'ml-auto': align !== 'right',\n 'ml-0': align === 'right',\n })}\n customMenu={customMenu}\n index={index}\n isFiltered={isFiltered}\n onFilter={handleFilter}\n onGoto={handleGoto}\n onHide={handleHide}\n onPin={handlePin}\n onSortToggle={handleSortToggle}\n scrollToIndex={scrollToIndex}\n setRowActiveIndex={setRowActiveIndex}\n sortDirection={sortDirection}\n columnId={id}\n />\n ) : null}\n {canResize ? (\n <Resizer\n headerRef={ref}\n id={id}\n isResizing={isResizing as boolean}\n onResize={handleResize as (event: unknown) => void}\n onResetSize={handleResetSize as () => void}\n setColumnSizing={setColumnSizing}\n width={width}\n />\n ) : null}\n </th>\n );\n});\n"],"names":["Header","props","header","scrollToIndex","column","getIsGrouped","table","getContext","tableMeta","options","meta","columnMeta","_header$column$column","columnDef","isGroup","subHeaders","length","isPinned","getIsPinned","canFilter","isPlaceholder","getCanFilter","enableColumnFilters","canHide","getCanHide","canMeasureSize","getRowModel","rows","canPin","getCanPin","canResize","getCanResize","canSort","getCanSort","canGoto","rowGoto","isEnabled","getIsSorted","hasMenu","isInternalColumn","id","menu","sorting","getState","filters","columnFilters","search","globalFilter","memoedProps","align","className","cn","headerClassName","children","flexRender","colSpan","customMenu","defaultWidth","isFiltered","getIsFiltered","index","offset","getStart","setRowActiveIndex","rowActive","setColumnSizing","tooltip","width","columnSizing","nextHeader","headerGroup","headers","onFilter","setFilterValue","comparator","TableFilterComparator","Contains","onGoto","query","_tableMeta$rowGoto$ha","_tableMeta$rowGoto","handleGoto","call","onHide","getToggleVisibilityHandler","onPin","setColumnPinning","pinningState","left","undefined","unfreezeAllExternalColumns","freezeUptoExternalColumn","getAllLeafColumns","map","isResizing","getIsResizing","onResize","getResizeHandler","resetSize","handleSortToggle","sortDirection","clearSorting","toggleSorting","onSort","getToggleSortingHandler","onSortToggle","React","MemoedHeader","key","memo","handleFilter","handleHide","handlePin","handleResize","handleSort","handleResetSize","ref","setRef","useState","useSetInitialColumnSizing","style","gridColumn","getSortAttributes","Tooltip","title","String","placement","SortIndicator","direction","HeaderMenu","columnId","Resizer","headerRef","onResetSize"],"mappings":";;;;;;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C1ClD,eAAe,EAAEA,eAAe;IAChCE,KAAK,EAAEA;IACT,IACF,IAAI,CACP;AAEb,CAAC,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Goto.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Header/components/Goto.tsx"],"sourcesContent":["import React from 'react';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { Popover, PopoverProps } from '../../../../../../components/Popover/Popover';\nimport { SearchInput } from '../../../../../../components/SearchInput/SearchInput';\n\nexport type GotoProps = PopoverProps & {\n onGoto: (query: string) => Promise<void>;\n};\n\nexport function GotoPopover(props: GotoProps) {\n const { onGoto: handleGoto, trigger, ...popoverProps } = props;\n const { texts } = useLocalization();\n\n const handleSearch = value => handleGoto(value);\n\n return (\n <Popover {...popoverProps} anchor={trigger}>\n <Popover.Content>\n <SearchInput\n aria-label={texts.table.columns.menu.gotoRow}\n name=\"query\"\n onSearch={handleSearch}\n onKeyDown={event => event.stopPropagation()}\n placeholder={`${texts.table.columns.menu.gotoRow}...`}\n />\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["GotoPopover","props","onGoto","handleGoto","trigger","popoverProps","texts","useLocalization","handleSearch","value","React","Popover","anchor","Content","SearchInput","table","columns","menu","gotoRow","name","onSearch","onKeyDown","event","stopPropagation","placeholder"],"mappings":";;;;;SASgBA,WAAWA,CAACC,KAAgB;EACxC,MAAM;IAAEC,MAAM,EAAEC,UAAU;IAAEC,OAAO;IAAE,GAAGC;GAAc,GAAGJ,KAAK;EAC9D,MAAM;IAAEK;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,YAAY,GAAGC,KAAK,IAAIN,UAAU,CAACM,KAAK,CAAC;EAE/C,oBACIC,6BAACC,OAAO,oBAAKN,YAAY;IAAEO,MAAM,EAAER;mBAC/BM,6BAACC,OAAO,CAACE,OAAO,qBACZH,6BAACI,WAAW;kBACIR,KAAK,CAACS,KAAK,CAACC,OAAO,CAACC,IAAI,CAACC,OAAO;IAC5CC,IAAI,EAAC,OAAO;IACZC,QAAQ,EAAEZ,YAAY;IACtBa,SAAS,EAAEC,KAAK,IAAIA,KAAK,CAACC,eAAe,EAAE;IAC3CC,WAAW,KAAKlB,KAAK,CAACS,KAAK,CAACC,OAAO,CAACC,IAAI,CAACC;IAC3C,CACY,CACZ;AAElB;;;;"}
1
+ {"version":3,"file":"Goto.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Header/components/Goto.tsx"],"sourcesContent":["import React from 'react';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { Popover, PopoverProps } from '../../../../../../components/Popover/Popover';\nimport { SearchInput } from '../../../../../../components/SearchInput/SearchInput';\n\nexport type GotoProps = PopoverProps & {\n onGoto: (query: string) => Promise<void>;\n};\n\nexport function GotoPopover(props: GotoProps) {\n const { onGoto: handleGoto, trigger, ...popoverProps } = props;\n const { texts } = useLocalization();\n\n const handleSearch = value => handleGoto(value);\n\n return (\n <Popover {...popoverProps} anchor={trigger}>\n <Popover.Content>\n <SearchInput\n aria-label={texts.table.columns.menu.gotoRow}\n name=\"query\"\n onSearch={handleSearch}\n onKeyDown={event => event.stopPropagation()}\n placeholder={`${texts.table.columns.menu.gotoRow}...`}\n />\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["GotoPopover","props","onGoto","handleGoto","trigger","popoverProps","texts","useLocalization","handleSearch","value","React","Popover","anchor","Content","SearchInput","table","columns","menu","gotoRow","name","onSearch","onKeyDown","event","stopPropagation","placeholder"],"mappings":";;;;;SASgBA,WAAWA,CAACC,KAAgB;EACxC,MAAM;IAAEC,MAAM,EAAEC,UAAU;IAAEC,OAAO;IAAE,GAAGC;GAAc,GAAGJ,KAAK;EAC9D,MAAM;IAAEK;GAAO,GAAGC,eAAe,EAAE;EAEnC,MAAMC,YAAY,GAAGC,KAAK,IAAIN,UAAU,CAACM,KAAK,CAAC;EAE/C,oBACIC,6BAACC,OAAO,oBAAKN,YAAY;IAAEO,MAAM,EAAER;mBAC/BM,6BAACC,OAAO,CAACE,OAAO,qBACZH,6BAACI,WAAW;kBACIR,KAAK,CAACS,KAAK,CAACC,OAAO,CAACC,IAAI,CAACC,OAAO;IAC5CC,IAAI,EAAC,OAAO;IACZC,QAAQ,EAAEZ,YAAY;IACtBa,SAAS,EAAEC,KAAK,IAAIA,KAAK,CAACC,eAAe,EAAE;IAC3CC,WAAW,EAAE,GAAGlB,KAAK,CAACS,KAAK,CAACC,OAAO,CAACC,IAAI,CAACC,OAAO;IAClD,CACY,CACZ;AAElB;;;;"}
@@ -73,15 +73,15 @@ function HeaderMenu(props) {
73
73
  if (canHide && handleHide) {
74
74
  // we do this in the next tick, otherwise the menu closes and react throws a "state update on unmounted component" error
75
75
  const handleClick = event => setTimeout(() => handleHide(event), 1);
76
- menuItems.push( /*#__PURE__*/React__default.createElement(Menu.Item, {
76
+ menuItems.push(/*#__PURE__*/React__default.createElement(Menu.Item, {
77
77
  icon: "eye-off",
78
78
  onClick: handleClick
79
79
  }, texts.table.columns.menu.hideColumn));
80
80
  }
81
81
  if (canSort) {
82
- menuItems.push( /*#__PURE__*/React__default.createElement(Menu.Item, {
82
+ menuItems.push(/*#__PURE__*/React__default.createElement(Menu.Item, {
83
83
  icon: "sort-by",
84
- subMenu: () => ( /*#__PURE__*/React__default.createElement(Menu.SubMenu, null, /*#__PURE__*/React__default.createElement(Menu.RadioGroup, {
84
+ subMenu: () => (/*#__PURE__*/React__default.createElement(Menu.SubMenu, null, /*#__PURE__*/React__default.createElement(Menu.RadioGroup, {
85
85
  onChange: handleSortToggle,
86
86
  value: sortDirection
87
87
  }, /*#__PURE__*/React__default.createElement(Menu.RadioGroup.Item, {
@@ -94,24 +94,24 @@ function HeaderMenu(props) {
94
94
  }, texts.table.columns.menu.sorting));
95
95
  }
96
96
  if (canGoto) {
97
- menuItems.push( /*#__PURE__*/React__default.createElement(Menu.Item, {
97
+ menuItems.push(/*#__PURE__*/React__default.createElement(Menu.Item, {
98
98
  icon: "move",
99
99
  onClick: () => setPopover('goto'),
100
100
  shortcut: "g"
101
101
  }, texts.table.columns.menu.gotoRow, "..."));
102
102
  }
103
103
  if (canPin && handlePin) {
104
- menuItems.push( /*#__PURE__*/React__default.createElement(Menu.Item, {
104
+ menuItems.push(/*#__PURE__*/React__default.createElement(Menu.Item, {
105
105
  icon: "column-freeze",
106
106
  onClick: () => handlePin(index)
107
107
  }, index === 0 ? texts.table.columns.menu.freezeFirstColumn : texts.table.columns.menu.freezeUptoColumn.replace('[TOTAL]', String(index + 1))));
108
- menuItems.push( /*#__PURE__*/React__default.createElement(Menu.Item, {
108
+ menuItems.push(/*#__PURE__*/React__default.createElement(Menu.Item, {
109
109
  icon: "column-unfreeze",
110
110
  onClick: () => handlePin(undefined)
111
111
  }, texts.table.columns.menu.unfreezeColumns));
112
112
  }
113
113
  if (canFilter && handleFilter) {
114
- menuItems.push( /*#__PURE__*/React__default.createElement(Menu.Item, {
114
+ menuItems.push(/*#__PURE__*/React__default.createElement(Menu.Item, {
115
115
  icon: isFiltered ? 'filter-solid' : 'filter',
116
116
  onClick: () => handleFilter()
117
117
  }, isFiltered ? texts.table.columns.menu.editFilter : texts.table.columns.menu.filter));
@@ -120,7 +120,7 @@ function HeaderMenu(props) {
120
120
  const customItems = customMenu.map(menuItem => menuItem(columnId)).filter(action => !!action);
121
121
  if (customItems.length) {
122
122
  if (menuItems.length) {
123
- menuItems.push( /*#__PURE__*/React__default.createElement(Menu.Separator, null));
123
+ menuItems.push(/*#__PURE__*/React__default.createElement(Menu.Separator, null));
124
124
  }
125
125
  menuItems.push(...customItems);
126
126
  }
@@ -146,7 +146,7 @@ function HeaderMenu(props) {
146
146
  return /*#__PURE__*/React__default.createElement(IconButton, {
147
147
  className: className,
148
148
  icon: "more",
149
- menu: popoverElement ? undefined : menuProps => ( /*#__PURE__*/React__default.createElement(Menu, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu.Content, null, memoedMenuItems))),
149
+ menu: popoverElement ? undefined : menuProps => (/*#__PURE__*/React__default.createElement(Menu, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu.Content, null, memoedMenuItems))),
150
150
  popover: popoverElement,
151
151
  onClickCapture: event => event.preventDefault(),
152
152
  onKeyDown: event => {
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Header/components/Menu.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { IconButton } from '../../../../../../components/IconButton/IconButton';\nimport { Menu as MenuPrimitive } from '../../../../../../components/Menu/Menu';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { GotoPopover } from './Goto';\nimport { TableColumnMenu, TableColumnSortDirection } from '../../../../types';\n\nexport type HeaderMenuProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n canFilter: boolean;\n canGoto: boolean;\n canHide: boolean;\n canPin: boolean;\n canSort: boolean;\n columnId: string;\n customMenu?: TableColumnMenu;\n index: number;\n isFiltered: boolean;\n onFilter?: () => void;\n onGoto?: (query: string) => Promise<number>;\n onHide?: (event: unknown) => void;\n onPin?: (index: number | undefined) => void;\n onSortToggle?: (sortDirection: TableColumnSortDirection | false) => void;\n scrollToIndex: (index: number) => void;\n setRowActiveIndex: (index: number) => void;\n sortDirection?: TableColumnSortDirection | false;\n};\n\nexport function HeaderMenu(props: HeaderMenuProps) {\n const {\n canFilter,\n canGoto,\n canHide,\n canPin,\n canSort,\n columnId,\n customMenu,\n index,\n isFiltered,\n onFilter: handleFilter,\n onGoto: handleGoto,\n onHide: handleHide,\n onPin: handlePin,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n setRowActiveIndex,\n sortDirection,\n } = props;\n const { texts } = useLocalization();\n const [popover, setPopover] = React.useState<string | undefined>(undefined);\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 setRowActiveIndex(index);\n scrollToIndex(index);\n } catch (e) {\n console.error(e);\n //\n } finally {\n handleClosePopover();\n }\n };\n popoverElement = props => <GotoPopover {...props} open onChange={handleClosePopover} onGoto={goto} />;\n }\n }\n }\n }\n\n const memoedMenuItems = React.useMemo(() => {\n const menuItems: JSX.Element[] = [];\n\n if (canHide && handleHide) {\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.table.columns.menu.hideColumn}\n </MenuPrimitive.Item>\n );\n }\n\n if (canSort) {\n menuItems.push(\n <MenuPrimitive.Item\n icon=\"sort-by\"\n subMenu={() => (\n <MenuPrimitive.SubMenu>\n <MenuPrimitive.RadioGroup onChange={handleSortToggle as any} value={sortDirection}>\n <MenuPrimitive.RadioGroup.Item value=\"asc\">\n {texts.table.columns.menu.sortingOrder.ascending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value=\"desc\">\n {texts.table.columns.menu.sortingOrder.descending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={false}>\n {texts.table.columns.menu.sortingOrder.unsorted}\n </MenuPrimitive.RadioGroup.Item>\n </MenuPrimitive.RadioGroup>\n </MenuPrimitive.SubMenu>\n )}>\n {texts.table.columns.menu.sorting}\n </MenuPrimitive.Item>\n );\n }\n\n if (canGoto) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"move\" onClick={() => setPopover('goto')} shortcut=\"g\">\n {texts.table.columns.menu.gotoRow}...\n </MenuPrimitive.Item>\n );\n }\n\n if (canPin && handlePin) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-freeze\" onClick={() => handlePin(index)}>\n {index === 0\n ? texts.table.columns.menu.freezeFirstColumn\n : texts.table.columns.menu.freezeUptoColumn.replace('[TOTAL]', String(index + 1))}\n </MenuPrimitive.Item>\n );\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-unfreeze\" onClick={() => handlePin(undefined)}>\n {texts.table.columns.menu.unfreezeColumns}\n </MenuPrimitive.Item>\n );\n }\n if (canFilter && handleFilter) {\n menuItems.push(\n <MenuPrimitive.Item icon={isFiltered ? 'filter-solid' : 'filter'} onClick={() => handleFilter()}>\n {isFiltered ? texts.table.columns.menu.editFilter : texts.table.columns.menu.filter}\n </MenuPrimitive.Item>\n );\n }\n\n if (customMenu) {\n const customItems = customMenu.map(menuItem => menuItem(columnId)).filter(action => !!action) 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 canFilter,\n canGoto,\n canHide,\n canPin,\n canSort,\n customMenu,\n handleGoto,\n handleSortToggle,\n index,\n isFiltered,\n sortDirection,\n ]);\n\n // can't use display: none because the button needs to be focusable\n const className = cn(\n // positioning\n 'justify-end overflow-hidden',\n // sizing\n '!h-6 !w-0 !min-h-[theme(spacing.6)] !min-w-0',\n // visible - hover\n 'group-hover/header:!w-6 group-hover/header:!min-w-[theme(spacing.6)] group-hover/header:-mr-1',\n // visible - expanded\n 'aria-expanded:!w-6 aria-expanded:!min-w-[theme(spacing.6)]',\n // visible - focus\n 'focus:!w-6 focus:!min-w-[theme(spacing.6)]',\n {\n '!w-6 !min-w-[theme(spacing.6)]': !!popoverElement,\n },\n props.className\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 onKeyDown={event => {\n // Removes focus from the column header menu button so that active row shortcuts execute when Tab,\n // Shift+Tab, or any other keydown event occurs.\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n event.currentTarget?.blur();\n }\n }}\n />\n );\n}\n"],"names":["HeaderMenu","props","canFilter","canGoto","canHide","canPin","canSort","columnId","customMenu","index","isFiltered","onFilter","handleFilter","onGoto","handleGoto","onHide","handleHide","onPin","handlePin","onSortToggle","handleSortToggle","scrollToIndex","setRowActiveIndex","sortDirection","texts","useLocalization","popover","setPopover","React","useState","undefined","popoverElement","handleClosePopover","goto","query","Promise","resolve","then","e","console","error","_wasThrown","_result","_temp","reject","GotoPopover","open","onChange","memoedMenuItems","useMemo","menuItems","handleClick","event","setTimeout","push","MenuPrimitive","Item","icon","onClick","table","columns","menu","hideColumn","subMenu","SubMenu","RadioGroup","value","sortingOrder","ascending","descending","unsorted","sorting","shortcut","gotoRow","freezeFirstColumn","freezeUptoColumn","replace","String","unfreezeColumns","editFilter","filter","customItems","map","menuItem","action","length","Separator","item","key","cloneElement","className","cn","IconButton","menuProps","Content","onClickCapture","preventDefault","onKeyDown","_event$currentTarget","currentTarget","blur"],"mappings":";;;;;;;;SA4BgBA,UAAUA,CAACC,KAAsB;EAC7C,MAAM;IACFC,SAAS;IACTC,OAAO;IACPC,OAAO;IACPC,MAAM;IACNC,OAAO;IACPC,QAAQ;IACRC,UAAU;IACVC,KAAK;IACLC,UAAU;IACVC,QAAQ,EAAEC,YAAY;IACtBC,MAAM,EAAEC,UAAU;IAClBC,MAAM,EAAEC,UAAU;IAClBC,KAAK,EAAEC,SAAS;IAChBC,YAAY,EAAEC,gBAAgB;IAC9BC,aAAa;IACbC,iBAAiB;IACjBC;GACH,GAAGtB,KAAK;EACT,MAAM;IAAEuB;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAqBC,SAAS,CAAC;EAE3E,IAAIC,cAAc;EAElB,IAAIL,OAAO,EAAE;IACT,MAAMM,kBAAkB,GAAGA,MAAML,UAAU,CAACG,SAAS,CAAC;IAEtD,QAAQJ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AAY,CAACF,IAAI,EAAE;MAAEC;KAAK,CAAC,CAAC;GACzE,EAAE,CACCtF,SAAS,EACTC,OAAO,EACPC,OAAO,EACPC,MAAM,EACNC,OAAO,EACPE,UAAU,EACVM,UAAU,EACVM,gBAAgB,EAChBX,KAAK,EACLC,UAAU,EACVa,aAAa,CAChB,CAAC;;EAGF,MAAMmE,SAAS,GAAGC,EAAE;;EAEhB,6BAA6B;;EAE7B,8CAA8C;;EAE9C,+FAA+F;;EAE/F,4DAA4D;;EAE5D,4CAA4C,EAC5C;IACI,gCAAgC,EAAE,CAAC,CAAC5D;GACvC,EACD9B,KAAK,CAACyF,SAAS,CAClB;EAED,oBACI9D,6BAACgE,UAAU;IACPF,SAAS,EAAEA,SAAS;IACpBjC,IAAI,EAAC,MAAM;IACXI,IAAI,EACA9B,cAAc,GACRD,SAAS,GACT+D,SAAS,mBACLjE,6BAAC2B,IAAa,oBAAKsC,SAAS,gBACxBjE,6BAAC2B,IAAa,CAACuC,OAAO,QAAE9C,eAAe,CAAyB,CACpD,CACnB;IAEXtB,OAAO,EAAEK,cAAc;IACvBgE,cAAc,EAAE3C,KAAK,IAAIA,KAAK,CAAC4C,cAAc,EAAE;IAC/CC,SAAS,EAAE7C,KAAK;;;MAGZ,IAAIA,KAAK,CAACoC,GAAG,KAAK,SAAS,IAAIpC,KAAK,CAACoC,GAAG,KAAK,WAAW,EAAE;QAAA,IAAAU,oBAAA;QACtD,CAAAA,oBAAA,GAAA9C,KAAK,CAAC+C,aAAa,cAAAD,oBAAA,uBAAnBA,oBAAA,CAAqBE,IAAI,EAAE;;;IAGrC;AAEV;;;;"}
1
+ {"version":3,"file":"Menu.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Header/components/Menu.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { IconButton } from '../../../../../../components/IconButton/IconButton';\nimport { Menu as MenuPrimitive } from '../../../../../../components/Menu/Menu';\nimport { useLocalization } from '../../../../../../components/Provider/Localization';\nimport { GotoPopover } from './Goto';\nimport { TableColumnMenu, TableColumnSortDirection } from '../../../../types';\n\nexport type HeaderMenuProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {\n canFilter: boolean;\n canGoto: boolean;\n canHide: boolean;\n canPin: boolean;\n canSort: boolean;\n columnId: string;\n customMenu?: TableColumnMenu;\n index: number;\n isFiltered: boolean;\n onFilter?: () => void;\n onGoto?: (query: string) => Promise<number>;\n onHide?: (event: unknown) => void;\n onPin?: (index: number | undefined) => void;\n onSortToggle?: (sortDirection: TableColumnSortDirection | false) => void;\n scrollToIndex: (index: number) => void;\n setRowActiveIndex: (index: number) => void;\n sortDirection?: TableColumnSortDirection | false;\n};\n\nexport function HeaderMenu(props: HeaderMenuProps) {\n const {\n canFilter,\n canGoto,\n canHide,\n canPin,\n canSort,\n columnId,\n customMenu,\n index,\n isFiltered,\n onFilter: handleFilter,\n onGoto: handleGoto,\n onHide: handleHide,\n onPin: handlePin,\n onSortToggle: handleSortToggle,\n scrollToIndex,\n setRowActiveIndex,\n sortDirection,\n } = props;\n const { texts } = useLocalization();\n const [popover, setPopover] = React.useState<string | undefined>(undefined);\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 setRowActiveIndex(index);\n scrollToIndex(index);\n } catch (e) {\n console.error(e);\n //\n } finally {\n handleClosePopover();\n }\n };\n popoverElement = props => <GotoPopover {...props} open onChange={handleClosePopover} onGoto={goto} />;\n }\n }\n }\n }\n\n const memoedMenuItems = React.useMemo(() => {\n const menuItems: JSX.Element[] = [];\n\n if (canHide && handleHide) {\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.table.columns.menu.hideColumn}\n </MenuPrimitive.Item>\n );\n }\n\n if (canSort) {\n menuItems.push(\n <MenuPrimitive.Item\n icon=\"sort-by\"\n subMenu={() => (\n <MenuPrimitive.SubMenu>\n <MenuPrimitive.RadioGroup onChange={handleSortToggle as any} value={sortDirection}>\n <MenuPrimitive.RadioGroup.Item value=\"asc\">\n {texts.table.columns.menu.sortingOrder.ascending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value=\"desc\">\n {texts.table.columns.menu.sortingOrder.descending}\n </MenuPrimitive.RadioGroup.Item>\n <MenuPrimitive.RadioGroup.Item value={false}>\n {texts.table.columns.menu.sortingOrder.unsorted}\n </MenuPrimitive.RadioGroup.Item>\n </MenuPrimitive.RadioGroup>\n </MenuPrimitive.SubMenu>\n )}>\n {texts.table.columns.menu.sorting}\n </MenuPrimitive.Item>\n );\n }\n\n if (canGoto) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"move\" onClick={() => setPopover('goto')} shortcut=\"g\">\n {texts.table.columns.menu.gotoRow}...\n </MenuPrimitive.Item>\n );\n }\n\n if (canPin && handlePin) {\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-freeze\" onClick={() => handlePin(index)}>\n {index === 0\n ? texts.table.columns.menu.freezeFirstColumn\n : texts.table.columns.menu.freezeUptoColumn.replace('[TOTAL]', String(index + 1))}\n </MenuPrimitive.Item>\n );\n\n menuItems.push(\n <MenuPrimitive.Item icon=\"column-unfreeze\" onClick={() => handlePin(undefined)}>\n {texts.table.columns.menu.unfreezeColumns}\n </MenuPrimitive.Item>\n );\n }\n if (canFilter && handleFilter) {\n menuItems.push(\n <MenuPrimitive.Item icon={isFiltered ? 'filter-solid' : 'filter'} onClick={() => handleFilter()}>\n {isFiltered ? texts.table.columns.menu.editFilter : texts.table.columns.menu.filter}\n </MenuPrimitive.Item>\n );\n }\n\n if (customMenu) {\n const customItems = customMenu.map(menuItem => menuItem(columnId)).filter(action => !!action) 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 canFilter,\n canGoto,\n canHide,\n canPin,\n canSort,\n customMenu,\n handleGoto,\n handleSortToggle,\n index,\n isFiltered,\n sortDirection,\n ]);\n\n // can't use display: none because the button needs to be focusable\n const className = cn(\n // positioning\n 'justify-end overflow-hidden',\n // sizing\n '!h-6 !w-0 !min-h-[theme(spacing.6)] !min-w-0',\n // visible - hover\n 'group-hover/header:!w-6 group-hover/header:!min-w-[theme(spacing.6)] group-hover/header:-mr-1',\n // visible - expanded\n 'aria-expanded:!w-6 aria-expanded:!min-w-[theme(spacing.6)]',\n // visible - focus\n 'focus:!w-6 focus:!min-w-[theme(spacing.6)]',\n {\n '!w-6 !min-w-[theme(spacing.6)]': !!popoverElement,\n },\n props.className\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 onKeyDown={event => {\n // Removes focus from the column header menu button so that active row shortcuts execute when Tab,\n // Shift+Tab, or any other keydown event occurs.\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n event.currentTarget?.blur();\n }\n }}\n />\n );\n}\n"],"names":["HeaderMenu","props","canFilter","canGoto","canHide","canPin","canSort","columnId","customMenu","index","isFiltered","onFilter","handleFilter","onGoto","handleGoto","onHide","handleHide","onPin","handlePin","onSortToggle","handleSortToggle","scrollToIndex","setRowActiveIndex","sortDirection","texts","useLocalization","popover","setPopover","React","useState","undefined","popoverElement","handleClosePopover","goto","query","Promise","resolve","then","e","console","error","_wasThrown","_result","_temp","reject","GotoPopover","open","onChange","memoedMenuItems","useMemo","menuItems","handleClick","event","setTimeout","push","MenuPrimitive","Item","icon","onClick","table","columns","menu","hideColumn","subMenu","SubMenu","RadioGroup","value","sortingOrder","ascending","descending","unsorted","sorting","shortcut","gotoRow","freezeFirstColumn","freezeUptoColumn","replace","String","unfreezeColumns","editFilter","filter","customItems","map","menuItem","action","length","Separator","item","key","cloneElement","className","cn","IconButton","menuProps","Content","onClickCapture","preventDefault","onKeyDown","_event$currentTarget","currentTarget","blur"],"mappings":";;;;;;;;SA4BgBA,UAAUA,CAACC,KAAsB;EAC7C,MAAM;IACFC,SAAS;IACTC,OAAO;IACPC,OAAO;IACPC,MAAM;IACNC,OAAO;IACPC,QAAQ;IACRC,UAAU;IACVC,KAAK;IACLC,UAAU;IACVC,QAAQ,EAAEC,YAAY;IACtBC,MAAM,EAAEC,UAAU;IAClBC,MAAM,EAAEC,UAAU;IAClBC,KAAK,EAAEC,SAAS;IAChBC,YAAY,EAAEC,gBAAgB;IAC9BC,aAAa;IACbC,iBAAiB;IACjBC;GACH,GAAGtB,KAAK;EACT,MAAM;IAAEuB;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAqBC,SAAS,CAAC;EAE3E,IAAIC,cAAc;EAElB,IAAIL,OAAO,EAAE;IACT,MAAMM,kBAAkB,GAAGA,MAAML,UAAU,CAACG,SAAS,CAAC;IAEtD,QAAQJ,OAAO;MACX,KAAK,MAAM;QAAE;UACT,IAAIZ,UAAU,EAAE;YACZ,MAAMmB,IAAI,aAAUC,KAAa;cAAA;;4CACzB;oBAAA,OAAAC,OAAA,CAAAC,OAAA,CACoBtB,UAAU,CAACoB,KAAK,CAAC,EAAAG,IAAA,WAA/B5B,KAAK;sBACXa,iBAAiB,CAACb,KAAK,CAAC;sBACxBY,aAAa,CAACZ,KAAK,CAAC;;mBACvB,YAAQ6B,CAAC,EAAE;oBACRC,OAAO,CAACC,KAAK,CAACF,CAAC,CAAC;;mBAEnB;6BAAAG,UAAA,EAAAC,OAAA;kBACGV,kB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,CAACyF,SAAS,CAClB;EAED,oBACI9D,6BAACgE,UAAU;IACPF,SAAS,EAAEA,SAAS;IACpBjC,IAAI,EAAC,MAAM;IACXI,IAAI,EACA9B,cAAc,GACRD,SAAS,GACT+D,SAAS,kBACLjE,6BAAC2B,IAAa,oBAAKsC,SAAS,gBACxBjE,6BAAC2B,IAAa,CAACuC,OAAO,QAAE9C,eAAe,CAAyB,CACpD,CACnB;IAEXtB,OAAO,EAAEK,cAAc;IACvBgE,cAAc,EAAE3C,KAAK,IAAIA,KAAK,CAAC4C,cAAc,EAAE;IAC/CC,SAAS,EAAE7C,KAAK;;;MAGZ,IAAIA,KAAK,CAACoC,GAAG,KAAK,SAAS,IAAIpC,KAAK,CAACoC,GAAG,KAAK,WAAW,EAAE;QAAA,IAAAU,oBAAA;QACtD,CAAAA,oBAAA,GAAA9C,KAAK,CAAC+C,aAAa,cAAAD,oBAAA,uBAAnBA,oBAAA,CAAqBE,IAAI,EAAE;;;IAGrC;AAEV;;;;"}
@@ -89,12 +89,12 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
89
89
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("tr", Object.assign({}, attributes, {
90
90
  className: className,
91
91
  ref: ref
92
- }), children, row.getVisibleCells().map((cell, cellIndex) => ( /*#__PURE__*/React__default.createElement(Cell, {
92
+ }), children, row.getVisibleCells().map((cell, cellIndex) => (/*#__PURE__*/React__default.createElement(Cell, {
93
93
  key: cell.id,
94
94
  cell: cell,
95
95
  index: cellIndex,
96
96
  renderer: CellRenderer
97
- })))), expandedRow ? ( /*#__PURE__*/React__default.createElement("tr", {
97
+ })))), expandedRow ? (/*#__PURE__*/React__default.createElement("tr", {
98
98
  "data-row-parent-id": row.id,
99
99
  ref: expansionRef
100
100
  }, /*#__PURE__*/React__default.createElement("td", {
@@ -1 +1 @@
1
- {"version":3,"file":"DisplayRow.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { Cell } from '../../Columns/Cell/Cell';\nimport { TableRowRendererProps } from '../../../types';\nimport { TableRowWithMetaData } from '../../../../types';\nimport { isElementInteractive } from '../../../../../../utils/dom';\nimport { useDropTarget } from '../../../../../../utils/hooks/useDropTarget';\n\nexport type DisplayRowProps<TType = unknown> = React.HTMLAttributes<HTMLTableRowElement> & TableRowRendererProps<TType>;\n\nexport const DisplayRow = React.memo(function DisplayRow<TType = unknown>(props: DisplayRowProps<TType>) {\n const { children, cellRenderer: CellRenderer, index, measureRow, row, table, ...otherAttributes } = props;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const attributes: any = {\n ...otherAttributes,\n 'data-row-id': row.id,\n 'data-row-index': index,\n tabIndex: -1,\n };\n\n const handleClick = React.useCallback(\n (event: React.MouseEvent<HTMLTableRowElement>) => {\n const clickedElement = event.target as HTMLElement;\n\n if (!event.currentTarget?.contains(event.target as HTMLElement) || isElementInteractive(clickedElement)) {\n return;\n }\n\n tableMeta.rowClick.handleClick(event, row.original);\n },\n [row.original]\n );\n const handleClickCapture = React.useCallback(() => {\n tableMeta.rowActive.setRowActiveIndex(index);\n }, [index]);\n\n // row active\n if (tableMeta.rowActive.isEnabled) {\n attributes['data-row-active'] = tableMeta.rowActive.rowActiveIndex === index ? true : undefined;\n // we use capture because it let's us picks up clicks on components inside the row, e.g. checkboxes\n attributes.onClickCapture = handleClickCapture;\n }\n\n // row click\n if (tableMeta.rowClick.isEnabled(row.original)) {\n attributes.onClick = handleClick;\n }\n\n // row drag\n if (tableMeta.rowDrag.isEnabled) {\n attributes['aria-grabbed'] = !!tableMeta.rowDrag.dragging[row.id];\n }\n\n // row drop\n const [isDraggedOver, dropTargetProps] = useDropTarget(event => tableMeta.rowDrop.handleDrop?.(event, row.original));\n\n if (tableMeta.rowDrop.isEnabled) {\n attributes.onDragEnter = dropTargetProps?.onDragEnter;\n attributes.onDragLeave = dropTargetProps?.onDragLeave;\n attributes.onDragOver = dropTargetProps?.onDragOver;\n attributes.onDrop = dropTargetProps?.onDrop;\n attributes['data-row-dragged-over'] = isDraggedOver;\n }\n\n // row grouping\n if (table.options.enableGrouping) {\n attributes['data-row-group'] = row.getIsGrouped() ? true : undefined;\n }\n\n // row selection\n if (table.options.enableRowSelection) {\n attributes['data-row-selected'] = row.getIsSelected() || row.getIsAllSubRowsSelected() ? true : undefined;\n }\n\n // row expansion\n let expandedRow;\n\n if (tableMeta.rowExpansion.isEnabled && row.getIsExpanded()) {\n attributes['data-row-expanded'] = true;\n expandedRow = tableMeta.rowExpansion.rowExpansionRenderer?.(row.original)?.();\n }\n\n const rowMeta = (row.original as TableRowWithMetaData<TType>)._meta;\n\n if (rowMeta) {\n if (rowMeta.layout) {\n attributes['data-row-meta-layout'] = rowMeta.layout;\n }\n }\n\n const ref = React.useRef<HTMLTableRowElement>(null);\n const expansionRef = React.useRef<HTMLTableRowElement>(null);\n const isExpanded = !!attributes['data-row-expanded'];\n\n useSetVirtualisedRowHeight(measureRow, ref.current, expansionRef.current, isExpanded);\n\n const className = cn('group/row', {\n 'hover:cursor-pointer': typeof attributes.onClick === 'function',\n });\n\n return (\n <>\n <tr {...attributes} className={className} ref={ref}>\n {children}\n {row.getVisibleCells().map((cell, cellIndex) => (\n <Cell key={cell.id} cell={cell} index={cellIndex} renderer={CellRenderer} />\n ))}\n </tr>\n {expandedRow ? (\n <tr data-row-parent-id={row.id} ref={expansionRef}>\n <td className=\"col-span-full\">{expandedRow}</td>\n </tr>\n ) : null}\n </>\n );\n}) as <TType = unknown>(props: TableRowRendererProps<TType>) => JSX.Element;\n\nfunction useSetVirtualisedRowHeight(\n measureRow: (size: number, expansionHeight?: number) => void,\n rowEl: HTMLTableRowElement | null,\n expansionEl: HTMLTableRowElement | null,\n isExpanded: boolean\n) {\n React.useEffect(() => {\n if (rowEl) {\n const height = rowEl.getBoundingClientRect().height;\n\n if (isExpanded && expansionEl) {\n measureRow(height, expansionEl.getBoundingClientRect().height);\n } else {\n measureRow(height);\n }\n }\n }, [isExpanded, rowEl, expansionEl]);\n}\n"],"names":["DisplayRow","React","memo","props","children","cellRenderer","CellRenderer","index","measureRow","row","table","otherAttributes","tableMeta","options","meta","attributes","id","tabIndex","handleClick","useCallback","event","clickedElement","target","_event$currentTarget","currentTarget","contains","isElementInteractive","rowClick","original","handleClickCapture","rowActive","setRowActiveIndex","isEnabled","rowActiveIndex","undefined","onClickCapture","onClick","rowDrag","dragging","isDraggedOver","dropTargetProps","useDropTarget","_tableMeta$rowDrop$ha","_tableMeta$rowDrop","rowDrop","handleDrop","call","onDragEnter","onDragLeave","onDragOver","onDrop","enableGrouping","getIsGrouped","enableRowSelection","getIsSelected","getIsAllSubRowsSelected","expandedRow","rowExpansion","getIsExpanded","_tableMeta$rowExpansi","_tableMeta$rowExpansi2","_tableMeta$rowExpansi3","rowExpansionRenderer","rowMeta","_meta","layout","ref","useRef","expansionRef","isExpanded","useSetVirtualisedRowHeight","current","className","cn","getVisibleCells","map","cell","cellIndex","Cell","key","renderer","rowEl","expansionEl","useEffect","height","getBoundingClientRect"],"mappings":";;;;;;MAWaA,UAAU,gBAAGC,cAAK,CAACC,IAAI,CAAC,SAASF,UAAUA,CAAkBG,KAA6B;EACnG,MAAM;IAAEC,QAAQ;IAAEC,YAAY,EAAEC,YAAY;IAAEC,KAAK;IAAEC,UAAU;IAAEC,GAAG;IAAEC,KAAK;IAAE,GAAGC;GAAiB,GAAGR,KAAK;EACzG,MAAMS,SAAS,GAAGF,KAAK,CAACG,OAAO,CAACC,IAA6B;EAE7D,MAAMC,UAAU,GAAQ;IACpB,GAAGJ,eAAe;IAClB,aAAa,EAAEF,GAAG,CAACO,EAAE;IACrB,gBAAgB,EAAET,KAAK;IACvBU,QAAQ,EAAE,CAAC;GACd;EAED,MAAMC,WAAW,GAAGjB,cAAK,CAACkB,WAAW,CAChCC,K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,UAA4D,EAC5DyE,KAAiC,EACjCC,WAAuC,EACvCb,UAAmB;EAEnBpE,cAAK,CAACkF,SAAS,CAAC;IACZ,IAAIF,KAAK,EAAE;MACP,MAAMG,MAAM,GAAGH,KAAK,CAACI,qBAAqB,EAAE,CAACD,MAAM;MAEnD,IAAIf,UAAU,IAAIa,WAAW,EAAE;QAC3B1E,UAAU,CAAC4E,MAAM,EAAEF,WAAW,CAACG,qBAAqB,EAAE,CAACD,MAAM,CAAC;OACjE,MAAM;QACH5E,UAAU,CAAC4E,MAAM,CAAC;;;GAG7B,EAAE,CAACf,UAAU,EAAEY,KAAK,EAAEC,WAAW,CAAC,CAAC;AACxC;;;;"}
1
+ {"version":3,"file":"DisplayRow.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport cn from 'clsx';\nimport { Cell } from '../../Columns/Cell/Cell';\nimport { TableRowRendererProps } from '../../../types';\nimport { TableRowWithMetaData } from '../../../../types';\nimport { isElementInteractive } from '../../../../../../utils/dom';\nimport { useDropTarget } from '../../../../../../utils/hooks/useDropTarget';\n\nexport type DisplayRowProps<TType = unknown> = React.HTMLAttributes<HTMLTableRowElement> & TableRowRendererProps<TType>;\n\nexport const DisplayRow = React.memo(function DisplayRow<TType = unknown>(props: DisplayRowProps<TType>) {\n const { children, cellRenderer: CellRenderer, index, measureRow, row, table, ...otherAttributes } = props;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const attributes: any = {\n ...otherAttributes,\n 'data-row-id': row.id,\n 'data-row-index': index,\n tabIndex: -1,\n };\n\n const handleClick = React.useCallback(\n (event: React.MouseEvent<HTMLTableRowElement>) => {\n const clickedElement = event.target as HTMLElement;\n\n if (!event.currentTarget?.contains(event.target as HTMLElement) || isElementInteractive(clickedElement)) {\n return;\n }\n\n tableMeta.rowClick.handleClick(event, row.original);\n },\n [row.original]\n );\n const handleClickCapture = React.useCallback(() => {\n tableMeta.rowActive.setRowActiveIndex(index);\n }, [index]);\n\n // row active\n if (tableMeta.rowActive.isEnabled) {\n attributes['data-row-active'] = tableMeta.rowActive.rowActiveIndex === index ? true : undefined;\n // we use capture because it let's us picks up clicks on components inside the row, e.g. checkboxes\n attributes.onClickCapture = handleClickCapture;\n }\n\n // row click\n if (tableMeta.rowClick.isEnabled(row.original)) {\n attributes.onClick = handleClick;\n }\n\n // row drag\n if (tableMeta.rowDrag.isEnabled) {\n attributes['aria-grabbed'] = !!tableMeta.rowDrag.dragging[row.id];\n }\n\n // row drop\n const [isDraggedOver, dropTargetProps] = useDropTarget(event => tableMeta.rowDrop.handleDrop?.(event, row.original));\n\n if (tableMeta.rowDrop.isEnabled) {\n attributes.onDragEnter = dropTargetProps?.onDragEnter;\n attributes.onDragLeave = dropTargetProps?.onDragLeave;\n attributes.onDragOver = dropTargetProps?.onDragOver;\n attributes.onDrop = dropTargetProps?.onDrop;\n attributes['data-row-dragged-over'] = isDraggedOver;\n }\n\n // row grouping\n if (table.options.enableGrouping) {\n attributes['data-row-group'] = row.getIsGrouped() ? true : undefined;\n }\n\n // row selection\n if (table.options.enableRowSelection) {\n attributes['data-row-selected'] = row.getIsSelected() || row.getIsAllSubRowsSelected() ? true : undefined;\n }\n\n // row expansion\n let expandedRow;\n\n if (tableMeta.rowExpansion.isEnabled && row.getIsExpanded()) {\n attributes['data-row-expanded'] = true;\n expandedRow = tableMeta.rowExpansion.rowExpansionRenderer?.(row.original)?.();\n }\n\n const rowMeta = (row.original as TableRowWithMetaData<TType>)._meta;\n\n if (rowMeta) {\n if (rowMeta.layout) {\n attributes['data-row-meta-layout'] = rowMeta.layout;\n }\n }\n\n const ref = React.useRef<HTMLTableRowElement>(null);\n const expansionRef = React.useRef<HTMLTableRowElement>(null);\n const isExpanded = !!attributes['data-row-expanded'];\n\n useSetVirtualisedRowHeight(measureRow, ref.current, expansionRef.current, isExpanded);\n\n const className = cn('group/row', {\n 'hover:cursor-pointer': typeof attributes.onClick === 'function',\n });\n\n return (\n <>\n <tr {...attributes} className={className} ref={ref}>\n {children}\n {row.getVisibleCells().map((cell, cellIndex) => (\n <Cell key={cell.id} cell={cell} index={cellIndex} renderer={CellRenderer} />\n ))}\n </tr>\n {expandedRow ? (\n <tr data-row-parent-id={row.id} ref={expansionRef}>\n <td className=\"col-span-full\">{expandedRow}</td>\n </tr>\n ) : null}\n </>\n );\n}) as <TType = unknown>(props: TableRowRendererProps<TType>) => JSX.Element;\n\nfunction useSetVirtualisedRowHeight(\n measureRow: (size: number, expansionHeight?: number) => void,\n rowEl: HTMLTableRowElement | null,\n expansionEl: HTMLTableRowElement | null,\n isExpanded: boolean\n) {\n React.useEffect(() => {\n if (rowEl) {\n const height = rowEl.getBoundingClientRect().height;\n\n if (isExpanded && expansionEl) {\n measureRow(height, expansionEl.getBoundingClientRect().height);\n } else {\n measureRow(height);\n }\n }\n }, [isExpanded, rowEl, expansionEl]);\n}\n"],"names":["DisplayRow","React","memo","props","children","cellRenderer","CellRenderer","index","measureRow","row","table","otherAttributes","tableMeta","options","meta","attributes","id","tabIndex","handleClick","useCallback","event","clickedElement","target","_event$currentTarget","currentTarget","contains","isElementInteractive","rowClick","original","handleClickCapture","rowActive","setRowActiveIndex","isEnabled","rowActiveIndex","undefined","onClickCapture","onClick","rowDrag","dragging","isDraggedOver","dropTargetProps","useDropTarget","_tableMeta$rowDrop$ha","_tableMeta$rowDrop","rowDrop","handleDrop","call","onDragEnter","onDragLeave","onDragOver","onDrop","enableGrouping","getIsGrouped","enableRowSelection","getIsSelected","getIsAllSubRowsSelected","expandedRow","rowExpansion","getIsExpanded","_tableMeta$rowExpansi","_tableMeta$rowExpansi2","_tableMeta$rowExpansi3","rowExpansionRenderer","rowMeta","_meta","layout","ref","useRef","expansionRef","isExpanded","useSetVirtualisedRowHeight","current","className","cn","getVisibleCells","map","cell","cellIndex","Cell","key","renderer","rowEl","expansionEl","useEffect","height","getBoundingClientRect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AS,EAAEA,SAAS;IAAEN,GAAG,EAAEA;MAC1C9D,QAAQ,EACRK,GAAG,CAACiE,eAAe,EAAE,CAACC,GAAG,CAAC,CAACC,IAAI,EAAEC,SAAS,mBACvC5E,6BAAC6E,IAAI;IAACC,GAAG,EAAEH,IAAI,CAAC5D,EAAE;IAAE4D,IAAI,EAAEA,IAAI;IAAErE,KAAK,EAAEsE,SAAS;IAAEG,QAAQ,EAAE1E;IAAgB,CAC/E,CAAC,CACD,EACJkD,WAAW,iBACRvD;0BAAwBQ,GAAG,CAACO,EAAE;IAAEkD,GAAG,EAAEE;kBACjCnE;IAAIuE,SAAS,EAAC;KAAiBhB,WAAW,CAAM,CAC/C,IACL,IAAI,CACT;AAEX,CAAC;AAED,SAASc,0BAA0BA,CAC/B9D,UAA4D,EAC5DyE,KAAiC,EACjCC,WAAuC,EACvCb,UAAmB;EAEnBpE,cAAK,CAACkF,SAAS,CAAC;IACZ,IAAIF,KAAK,EAAE;MACP,MAAMG,MAAM,GAAGH,KAAK,CAACI,qBAAqB,EAAE,CAACD,MAAM;MAEnD,IAAIf,UAAU,IAAIa,WAAW,EAAE;QAC3B1E,UAAU,CAAC4E,MAAM,EAAEF,WAAW,CAACG,qBAAqB,EAAE,CAACD,MAAM,CAAC;OACjE,MAAM;QACH5E,UAAU,CAAC4E,MAAM,CAAC;;;GAG7B,EAAE,CAACf,UAAU,EAAEY,KAAK,EAAEC,WAAW,CAAC,CAAC;AACxC;;;;"}
@@ -53,7 +53,7 @@ const Skeleton = /*#__PURE__*/React__default.forwardRef(function Skeleton(props,
53
53
  } = props;
54
54
  return /*#__PURE__*/React__default.createElement("tr", {
55
55
  ref: ref
56
- }, Array(cellsCount).fill(null).map((_, index) => ( /*#__PURE__*/React__default.createElement("td", {
56
+ }, Array(cellsCount).fill(null).map((_, index) => (/*#__PURE__*/React__default.createElement("td", {
57
57
  key: index
58
58
  }, /*#__PURE__*/React__default.createElement("span", {
59
59
  className: "bg-grey-100 text-grey-700 h-4 w-full text-center text-xs"
@@ -1 +1 @@
1
- {"version":3,"file":"SkeletonRow.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta, Row as ReactTableRow } from '@tanstack/react-table';\nimport { useInView } from 'react-intersection-observer';\n\nexport type RowProps<TType = unknown> = {\n index: number;\n row: ReactTableRow<TType>;\n table: ReactTable<TType>;\n};\n\nexport function SkeletonRow<TType = unknown>(props: RowProps<TType>) {\n const { index, row, table } = props;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (tableMeta.server.isEnabled) {\n return <RowWithServerLoading {...props} index={index} />;\n }\n\n return <Skeleton cellsCount={row.getVisibleCells().length} />;\n}\n\nfunction RowWithServerLoading<TType = unknown>(props: RowProps<TType>) {\n const { index, row, table } = props;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const pageIndex = (Math.floor(index / tableMeta.server.pageSize) * tableMeta.server.pageSize) / tableMeta.server.pageSize;\n\n const { ref, inView } = useInView({\n threshold: 0,\n triggerOnce: true,\n initialInView: pageIndex === 0,\n });\n\n React.useEffect(() => {\n if (inView) {\n tableMeta.server.loadPage?.(pageIndex, table.getState().sorting, table.getState().columnFilters);\n }\n }, [inView]);\n\n const groupedCellCount = table.getState()?.grouping.length ?? 0;\n const ungroupedCellCount = row.getVisibleCells().length - groupedCellCount;\n\n return <Skeleton cellsCount={ungroupedCellCount} ref={ref} />;\n}\n\nconst Skeleton = React.forwardRef(function Skeleton(props: { cellsCount: number }, ref: React.Ref<HTMLTableRowElement>) {\n const { cellsCount } = props;\n\n return (\n <tr ref={ref}>\n {Array(cellsCount)\n .fill(null)\n .map((_, index) => (\n <td key={index}>\n <span className=\"bg-grey-100 text-grey-700 h-4 w-full text-center text-xs\" />\n </td>\n ))}\n </tr>\n );\n});\n"],"names":["SkeletonRow","props","index","row","table","tableMeta","options","meta","server","isEnabled","React","RowWithServerLoading","Skeleton","cellsCount","getVisibleCells","length","pageIndex","Math","floor","pageSize","ref","inView","useInView","threshold","triggerOnce","initialInView","useEffect","_tableMeta$server$loa","_tableMeta$server","loadPage","call","getState","sorting","columnFilters","groupedCellCount","_table$getState$group","_table$getState","grouping","ungroupedCellCount","forwardRef","Array","fill","map","_","key","className"],"mappings":";;;SAUgBA,WAAWA,CAAkBC,KAAsB;EAC/D,MAAM;IAAEC,KAAK;IAAEC,GAAG;IAAEC;GAAO,GAAGH,KAAK;EACnC,MAAMI,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAE7D,IAAIF,SAAS,CAACG,MAAM,CAACC,SAAS,EAAE;IAC5B,oBAAOC,6BAACC,oBAAoB,oBAAKV,KAAK;MAAEC,KAAK,EAAEA;OAAS;;EAG5D,oBAAOQ,6BAACE,QAAQ;IAACC,UAAU,EAAEV,GAAG,CAACW,eAAe,EAAE,CAACC;IAAU;AACjE;AAEA,SAASJ,oBAAoBA,CAAkBV,KAAsB;;EACjE,MAAM;IAAEC,KAAK;IAAEC,GAAG;IAAEC;GAAO,GAAGH,KAAK;EACnC,MAAMI,SAAS,GAAGD,KAAK,CAACE,OAAO,CAACC,IAA6B;EAE7D,MAAMS,SAAS,GAAIC,IAAI,CAACC,KAAK,CAAChB,KAAK,GAAGG,SAAS,CAACG,MAAM,CAACW,QAAQ,CAAC,GAAGd,SAAS,CAACG,MAAM,CAACW,QAAQ,GAAId,SAAS,CAACG,MAAM,CAACW,QAAQ;EAEzH,MAAM;IAAEC,GAAG;IAAEC;GAAQ,GAAGC,SAAS,CAAC;IAC9BC,SAAS,EAAE,CAAC;IACZC,WAAW,EAAE,IAAI;IACjBC,aAAa,EAAET,SAAS,KAAK;GAChC,CAAC;EAEFN,cAAK,CAACgB,SAAS,CAAC;IACZ,IAAIL,MAAM,EAAE;MAAA,IAAAM,qBAAA,EAAAC,iBAAA;MACR,CAAAD,qBAAA,IAAAC,iBAAA,GAAAvB,SAAS,CAACG,MAAM,EAACqB,QAAQ,cAAAF,qBAAA,uBAAzBA,qBAAA,CAAAG,IAAA,CAAAF,iBAAA,EAA4BZ,SAAS,EAAEZ,KAAK,CAAC2B,QAAQ,EAAE,CAACC,OAAO,EAAE5B,KAAK,CAAC2B,QAAQ,EAAE,CAACE,aAAa,CAAC;;GAEvG,EAAE,CAACZ,MAAM,CAAC,CAAC;EAEZ,MAAMa,gBAAgB,IAAAC,qBAAA,IAAAC,eAAA,GAAGhC,KAAK,CAAC2B,QAAQ,EAAE,cAAAK,eAAA,uBAAhBA,eAAA,CAAkBC,QAAQ,CAACtB,MAAM,cAAAoB,qBAAA,cAAAA,qBAAA,GAAI,CAAC;EAC/D,MAAMG,kBAAkB,GAAGnC,GAAG,CAACW,eAAe,EAAE,CAACC,MAAM,GAAGmB,gBAAgB;EAE1E,oBAAOxB,6BAACE,QAAQ;IAACC,UAAU,EAAEyB,kBAAkB;IAAElB,GAAG,EAAEA;IAAO;AACjE;AAEA,MAAMR,QAAQ,gBAAGF,cAAK,CAAC6B,UAAU,CAAC,SAAS3B,QAAQA,CAACX,KAA6B,EAAEmB,GAAmC;EAClH,MAAM;IAAEP;GAAY,GAAGZ,KAAK;EAE5B,oBACIS;IAAIU,GAAG,EAAEA;KACJoB,KAAK,CAAC3B,UAAU,CAAC,CACb4B,IAAI,CAAC,IAAI,CAAC,CACVC,GAAG,CAAC,CAACC,CAAC,EAAEzC,KAAK,oBACVQ;IAAIkC,GAAG,EAAE1C;kBACLQ;IAAMmC,SAAS,EAAC;IAA6D,CAC5E,CACR,CAAC,CACL;AAEb,CAAC,CAAC;;;;"}
1
+ {"version":3,"file":"SkeletonRow.js","sources":["../../../../../../../../../../../src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta, Row as ReactTableRow } from '@tanstack/react-table';\nimport { useInView } from 'react-intersection-observer';\n\nexport type RowProps<TType = unknown> = {\n index: number;\n row: ReactTableRow<TType>;\n table: ReactTable<TType>;\n};\n\nexport function SkeletonRow<TType = unknown>(props: RowProps<TType>) {\n const { index, row, table } = props;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (tableMeta.server.isEnabled) {\n return <RowWithServerLoading {...props} index={index} />;\n }\n\n return <Skeleton cellsCount={row.getVisibleCells().length} />;\n}\n\nfunction RowWithServerLoading<TType = unknown>(props: RowProps<TType>) {\n const { index, row, table } = props;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n const pageIndex = (Math.floor(index / tableMeta.server.pageSize) * tableMeta.server.pageSize) / tableMeta.server.pageSize;\n\n const { ref, inView } = useInView({\n threshold: 0,\n triggerOnce: true,\n initialInView: pageIndex === 0,\n });\n\n React.useEffect(() => {\n if (inView) {\n tableMeta.server.loadPage?.(pageIndex, table.getState().sorting, table.getState().columnFilters);\n }\n }, [inView]);\n\n const groupedCellCount = table.getState()?.grouping.length ?? 0;\n const ungroupedCellCount = row.getVisibleCells().length - groupedCellCount;\n\n return <Skeleton cellsCount={ungroupedCellCount} ref={ref} />;\n}\n\nconst Skeleton = React.forwardRef(function Skeleton(props: { cellsCount: number }, ref: React.Ref<HTMLTableRowElement>) {\n const { cellsCount } = props;\n\n return (\n <tr ref={ref}>\n {Array(cellsCount)\n .fill(null)\n .map((_, index) => (\n <td key={index}>\n <span className=\"bg-grey-100 text-grey-700 h-4 w-full text-center text-xs\" />\n </td>\n ))}\n </tr>\n );\n});\n"],"names":["SkeletonRow","props","index","row","table","tableMeta","options","meta","server","isEnabled","React","RowWithServerLoading","Skeleton","cellsCount","getVisibleCells","length","pageIndex","Math","floor","pageSize","ref","inView","useInView","threshold","triggerOnce","initialInView","useEffect","_tableMeta$server$loa","_tableMeta$server","loadPage","call","getState","sorting","columnFilters","groupedCellCount","_table$getState$group","_table$getState","grouping","ungroupedCellCount","forwardRef","Array","fill","map","_","key","className"],"mappings":";;;SAUgBA,WAAWA,CAAkBC,KAAsB;EAC/D,M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B,IAAAC,qBAAA,IAAAC,eAAA,GAAGhC,KAAK,CAAC2B,QAAQ,EAAE,cAAAK,eAAA,uBAAhBA,eAAA,CAAkBC,QAAQ,CAACtB,MAAM,cAAAoB,qBAAA,cAAAA,qBAAA,GAAI,CAAC;EAC/D,MAAMG,kBAAkB,GAAGnC,GAAG,CAACW,eAAe,EAAE,CAACC,MAAM,GAAGmB,gBAAgB;EAE1E,oBAAOxB,6BAACE,QAAQ;IAACC,UAAU,EAAEyB,kBAAkB;IAAElB,GAAG,EAAEA;IAAO;AACjE;AAEA,MAAMR,QAAQ,gBAAGF,cAAK,CAAC6B,UAAU,CAAC,SAAS3B,QAAQA,CAACX,KAA6B,EAAEmB,GAAmC;EAClH,MAAM;IAAEP;GAAY,GAAGZ,KAAK;EAE5B,oBACIS;IAAIU,GAAG,EAAEA;KACJoB,KAAK,CAAC3B,UAAU,CAAC,CACb4B,IAAI,CAAC,IAAI,CAAC,CACVC,GAAG,CAAC,CAACC,CAAC,EAAEzC,KAAK,mBACVQ;IAAIkC,GAAG,EAAE1C;kBACLQ;IAAMmC,SAAS,EAAC;IAA6D,CAC5E,CACR,CAAC,CACL;AAEb,CAAC,CAAC;;;;"}
@@ -33,7 +33,7 @@ function TableToolbar(props) {
33
33
  }) : null, canSettings ? /*#__PURE__*/React__default.createElement(Settings, {
34
34
  customSettings: table.props.customSettings,
35
35
  table: table.instance
36
- }) : null, canSearch ? ( /*#__PURE__*/React__default.createElement(Search, {
36
+ }) : null, canSearch ? (/*#__PURE__*/React__default.createElement(Search, {
37
37
  scrollToIndex: table.renderer.scrollToIndex,
38
38
  table: table.instance,
39
39
  tableRef: table.ref
@@ -1 +1 @@
1
- {"version":3,"file":"Toolbar.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/Toolbar.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { Group } from '../../../../../components/Group/Group';\nimport { Search } from './components/Search/Search';\nimport { Settings } from './components/Settings/Settings';\nimport { Print } from './components/Print/Print';\nimport { Filters } from './components/Filters/Filters';\nimport { TableCustomSettingsRenderer } from '../../../types';\nimport { useTableReturnValue } from '../../useTable';\n\nexport type TableToolbarProps<TType = unknown> = React.HTMLAttributes<HTMLDivElement> & {\n children?: JSX.Element | null;\n table: useTableReturnValue<TType>;\n};\n\nexport function TableToolbar<TType = unknown>(props: TableToolbarProps<TType>) {\n const { children: customTools, table, ...attributes } = props;\n\n if (!isToolbarVisible<TType>(table, !!customTools)) {\n return null;\n }\n\n const canFilter = table.instance.options.enableColumnFilters;\n const canPrint = table.meta.printing.isEnabled;\n const canSettings = canChangeSettings(table.instance, table.props.customSettings);\n const canSearch = table.meta.search.isEnabled;\n\n return (\n <>\n <div\n {...attributes}\n className=\"mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2 print:hidden\"\n data-taco=\"table-toolbar\">\n {table.props.toolbarLeft}\n <Group className=\"ml-auto flex-shrink-0 items-center print:hidden\">\n {customTools}\n {canFilter ? <Filters length={table.meta.length} table={table.instance} /> : null}\n {table.props.toolbarRight}\n {canPrint ? <Print table={table.instance} tableId={table.id} tableRef={table.ref} /> : null}\n {canSettings ? <Settings customSettings={table.props.customSettings} table={table.instance} /> : null}\n {canSearch ? (\n <Search scrollToIndex={table.renderer.scrollToIndex} table={table.instance} tableRef={table.ref} />\n ) : null}\n </Group>\n </div>\n {table.props.toolbarPanel ? <div className=\"mb-4\">{table.props.toolbarPanel}</div> : undefined}\n </>\n );\n}\n\nfunction canChangeSettings<TType = unknown>(table: ReactTable<TType>, customSettings?: TableCustomSettingsRenderer) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n return (\n table.options.enableHiding ||\n tableMeta.columnOrdering.isEnabled ||\n tableMeta.fontSize.isEnabled ||\n tableMeta.rowHeight.isEnabled ||\n typeof customSettings === 'function'\n );\n}\n\nfunction isToolbarVisible<TType = unknown>(table: useTableReturnValue<TType>, customTools: boolean) {\n const hasInternalToolbar =\n customTools ||\n table.instance.options.enableColumnFilters ||\n table.meta.printing.isEnabled ||\n canChangeSettings(table.instance, table.props.customSettings) ||\n table.meta.search.isEnabled;\n\n return hasInternalToolbar || !!table.props.toolbarLeft || !!table.props.toolbarRight;\n}\n"],"names":["TableToolbar","props","children","customTools","table","attributes","isToolbarVisible","canFilter","instance","options","enableColumnFilters","canPrint","meta","printing","isEnabled","canSettings","canChangeSettings","customSettings","canSearch","search","React","className","toolbarLeft","Group","Filters","length","toolbarRight","Print","tableId","id","tableRef","ref","Settings","Search","scrollToIndex","renderer","toolbarPanel","undefined","tableMeta","enableHiding","columnOrdering","fontSize","rowHeight","hasInternalToolbar"],"mappings":";;;;;;;SAegBA,YAAYA,CAAkBC,KAA+B;EACzE,MAAM;IAAEC,QAAQ,EAAEC,WAAW;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EAE7D,IAAI,CAACK,gBAAgB,CAAQF,KAAK,EAAE,CAAC,CAACD,WAAW,CAAC,EAAE;IAChD,OAAO,IAAI;;EAGf,MAAMI,SAAS,GAAGH,KAAK,CAACI,QAAQ,CAACC,OAAO,CAACC,mBAAmB;EAC5D,MAAMC,QAAQ,GAAGP,KAAK,CAACQ,IAAI,CAACC,QAAQ,CAACC,SAAS;EAC9C,MAAMC,WAAW,GAAGC,iBAAiB,CAACZ,KAAK,CAACI,QAAQ,EAAEJ,KAAK,CAACH,KAAK,CAACgB,cAAc,CAAC;EACjF,MAAMC,SAAS,GAAGd,KAAK,CAACQ,IAAI,CAACO,MAAM,CAACL,SAAS;EAE7C,oBACIM,yEACIA,sDACQf,UAAU;IACdgB,SAAS,EAAC,gEAAgE;iBAChE;MACTjB,KAAK,CAACH,KAAK,CAACqB,WAAW,eACxBF,6BAACG,KAAK;IAACF,SAAS,EAAC;KACZlB,WAAW,EACXI,SAAS,gBAAGa,6BAACI,OAAO;IAACC,MAAM,EAAErB,KAAK,CAACQ,IAAI,CAACa,MAAM;IAAErB,K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AQ,CAACC,SAAS,IAC7BE,iBAAiB,CAACZ,KAAK,CAACI,QAAQ,EAAEJ,KAAK,CAACH,KAAK,CAACgB,cAAc,CAAC,IAC7Db,KAAK,CAACQ,IAAI,CAACO,MAAM,CAACL,SAAS;EAE/B,OAAO6B,kBAAkB,IAAI,CAAC,CAACvC,KAAK,CAACH,KAAK,CAACqB,WAAW,IAAI,CAAC,CAAClB,KAAK,CAACH,KAAK,CAACyB,YAAY;AACxF;;;;"}
1
+ {"version":3,"file":"Toolbar.js","sources":["../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/Toolbar.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { Group } from '../../../../../components/Group/Group';\nimport { Search } from './components/Search/Search';\nimport { Settings } from './components/Settings/Settings';\nimport { Print } from './components/Print/Print';\nimport { Filters } from './components/Filters/Filters';\nimport { TableCustomSettingsRenderer } from '../../../types';\nimport { useTableReturnValue } from '../../useTable';\n\nexport type TableToolbarProps<TType = unknown> = React.HTMLAttributes<HTMLDivElement> & {\n children?: JSX.Element | null;\n table: useTableReturnValue<TType>;\n};\n\nexport function TableToolbar<TType = unknown>(props: TableToolbarProps<TType>) {\n const { children: customTools, table, ...attributes } = props;\n\n if (!isToolbarVisible<TType>(table, !!customTools)) {\n return null;\n }\n\n const canFilter = table.instance.options.enableColumnFilters;\n const canPrint = table.meta.printing.isEnabled;\n const canSettings = canChangeSettings(table.instance, table.props.customSettings);\n const canSearch = table.meta.search.isEnabled;\n\n return (\n <>\n <div\n {...attributes}\n className=\"mb-4 flex flex-shrink flex-grow-0 flex-wrap gap-2 print:hidden\"\n data-taco=\"table-toolbar\">\n {table.props.toolbarLeft}\n <Group className=\"ml-auto flex-shrink-0 items-center print:hidden\">\n {customTools}\n {canFilter ? <Filters length={table.meta.length} table={table.instance} /> : null}\n {table.props.toolbarRight}\n {canPrint ? <Print table={table.instance} tableId={table.id} tableRef={table.ref} /> : null}\n {canSettings ? <Settings customSettings={table.props.customSettings} table={table.instance} /> : null}\n {canSearch ? (\n <Search scrollToIndex={table.renderer.scrollToIndex} table={table.instance} tableRef={table.ref} />\n ) : null}\n </Group>\n </div>\n {table.props.toolbarPanel ? <div className=\"mb-4\">{table.props.toolbarPanel}</div> : undefined}\n </>\n );\n}\n\nfunction canChangeSettings<TType = unknown>(table: ReactTable<TType>, customSettings?: TableCustomSettingsRenderer) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n return (\n table.options.enableHiding ||\n tableMeta.columnOrdering.isEnabled ||\n tableMeta.fontSize.isEnabled ||\n tableMeta.rowHeight.isEnabled ||\n typeof customSettings === 'function'\n );\n}\n\nfunction isToolbarVisible<TType = unknown>(table: useTableReturnValue<TType>, customTools: boolean) {\n const hasInternalToolbar =\n customTools ||\n table.instance.options.enableColumnFilters ||\n table.meta.printing.isEnabled ||\n canChangeSettings(table.instance, table.props.customSettings) ||\n table.meta.search.isEnabled;\n\n return hasInternalToolbar || !!table.props.toolbarLeft || !!table.props.toolbarRight;\n}\n"],"names":["TableToolbar","props","children","customTools","table","attributes","isToolbarVisible","canFilter","instance","options","enableColumnFilters","canPrint","meta","printing","isEnabled","canSettings","canChangeSettings","customSettings","canSearch","search","React","className","toolbarLeft","Group","Filters","length","toolbarRight","Print","tableId","id","tableRef","ref","Settings","Search","scrollToIndex","renderer","toolbarPanel","undefined","tableMeta","enableHiding","columnOrdering","fontSize","rowHeight","hasInternalToolbar"],"mappings":";;;;;;;SAegBA,YAAYA,CAAkBC,KAA+B;EACzE,MAAM;IAAEC,QAAQ,EAAEC,WAAW;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EAE7D,IAAI,CAACK,gBAAgB,CAAQF,KAAK,EAAE,CAAC,CAACD,WAAW,CAAC,EAAE;IAChD,OAAO,IAAI;;EAGf,MAAMI,SAAS,GAAGH,KAAK,CAACI,QAAQ,CAACC,OAAO,CAACC,mBAAmB;EAC5D,MAAMC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,iBAAiBA,CAAkBZ,KAAwB,EAAEa,cAA4C;EAC9G,MAAMqB,SAAS,GAAGlC,KAAK,CAACK,OAAO,CAACG,IAA6B;EAE7D,OACIR,KAAK,CAACK,OAAO,CAAC8B,YAAY,IAC1BD,SAAS,CAACE,cAAc,CAAC1B,SAAS,IAClCwB,SAAS,CAACG,QAAQ,CAAC3B,SAAS,IAC5BwB,SAAS,CAACI,SAAS,CAAC5B,SAAS,IAC7B,OAAOG,cAAc,KAAK,UAAU;AAE5C;AAEA,SAASX,gBAAgBA,CAAkBF,KAAiC,EAAED,WAAoB;EAC9F,MAAMwC,kBAAkB,GACpBxC,WAAW,IACXC,KAAK,CAACI,QAAQ,CAACC,OAAO,CAACC,mBAAmB,IAC1CN,KAAK,CAACQ,IAAI,CAACC,QAAQ,CAACC,SAAS,IAC7BE,iBAAiB,CAACZ,KAAK,CAACI,QAAQ,EAAEJ,KAAK,CAACH,KAAK,CAACgB,cAAc,CAAC,IAC7Db,KAAK,CAACQ,IAAI,CAACO,MAAM,CAACL,SAAS;EAE/B,OAAO6B,kBAAkB,IAAI,CAAC,CAACvC,KAAK,CAACH,KAAK,CAACqB,WAAW,IAAI,CAAC,CAAClB,KAAK,CAACH,KAAK,CAACyB,YAAY;AACxF;;;;"}
@@ -34,7 +34,7 @@ function Filters(props) {
34
34
  })),
35
35
  shortcut,
36
36
  ref,
37
- tooltip: ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table.filters.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
37
+ tooltip: (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table.filters.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
38
38
  className: "ml-2",
39
39
  keys: shortcut
40
40
  })))
@@ -1 +1 @@
1
- {"version":3,"file":"Filters.js","sources":["../../../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/components/Filters/Filters.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable } from '@tanstack/react-table';\nimport { useIsLargeScreen } from '../../../../../../../hooks/useIsLargeScreen';\nimport { useLocalization } from '../../../../../../../components/Provider/Localization';\nimport { IconButton } from '../../../../../../../components/IconButton/IconButton';\nimport { Button } from '../../../../../../../components/Button/Button';\nimport { Icon } from '../../../../../../../components/Icon/Icon';\nimport { Shortcut } from '../../../../../../../components/Shortcut/Shortcut';\nimport { ManageFiltersPopover } from './ManageFiltersPopover';\nimport { TableFilter } from '../../../../../types';\nimport { isEmptyFilter } from './util';\n\nexport type FiltersProps<TType = unknown> = {\n length: number;\n table: ReactTable<TType>;\n};\n\nexport function Filters<TType = unknown>(props: FiltersProps<TType>) {\n const { length, table } = props;\n const { texts } = useLocalization();\n const isLargeScreen = useIsLargeScreen();\n const columnFilters = table.getState().columnFilters as TableFilter[];\n const appliedFilters = columnFilters.filter(f => !isEmptyFilter(f));\n const ref = React.useRef<HTMLButtonElement>(null);\n\n const shortcut = { key: 'f', meta: true, shift: true };\n\n const buttonProps = {\n 'aria-label': texts.table.filters.tooltip,\n className: appliedFilters.length ? '!wcag-blue-100' : undefined,\n popover: popoverProps => <ManageFiltersPopover {...popoverProps} length={length} table={table} />,\n shortcut,\n ref,\n tooltip: (\n <>\n {texts.table.filters.tooltip}\n <Shortcut className=\"ml-2\" keys={shortcut} />\n </>\n ),\n };\n\n React.useEffect(() => {\n const emptyFilter = columnFilters.find(isEmptyFilter);\n\n // we set an empty filter when adding a filter through a column header.\n if (emptyFilter) {\n ref.current?.click();\n }\n }, [columnFilters]);\n\n if (!isLargeScreen && !appliedFilters.length) {\n return <IconButton {...buttonProps} icon=\"filter\" />;\n }\n\n return (\n <Button {...buttonProps}>\n <Icon className={!isLargeScreen ? '-mr-1.5' : undefined} name={appliedFilters.length ? 'filter-solid' : 'filter'} />\n {isLargeScreen ? texts.table.filters.button : ''}\n {appliedFilters.length ? `(${appliedFilters.length})` : ''}\n </Button>\n );\n}\n"],"names":["Filters","props","length","table","texts","useLocalization","isLargeScreen","useIsLargeScreen","columnFilters","getState","appliedFilters","filter","f","isEmptyFilter","ref","React","useRef","shortcut","key","meta","shift","buttonProps","filters","tooltip","className","undefined","popover","popoverProps","ManageFiltersPopover","Shortcut","keys","useEffect","emptyFilter","find","_ref$current","current","click","IconButton","icon","Button","Icon","name","button"],"mappings":";;;;;;;;;;SAiBgBA,OAAOA,CAAkBC,KAA0B;EAC/D,MAAM;IAAEC,MAAM;IAAEC;GAAO,GAAGF,KAAK;EAC/B,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,aAAa,GAAGC,gBAAgB,EAAE;EACxC,MAAMC,aAAa,GAAGL,KAAK,CAACM,QAAQ,EAAE,CAACD,aAA8B;EACrE,MAAME,cAAc,GAAGF,aAAa,CAACG,MAAM,CAACC,CAAC,IAAI,CAACC,aAAa,CAACD,CAAC,CAAC,CAAC;EACnE,MAAME,GAAG,GAAGC,cAAK,CAACC,MAAM,CAAoB,IAAI,CAAC;EAEjD,MAAMC,QAAQ,GAAG;IAAEC,GAAG,EAAE,GAAG;IAAEC,IAAI,EAAE,IAAI;IAAEC,KAAK,EAAE;GAAM;EAEtD,MAAMC,WAAW,GAAG;IAChB,YAAY,EAAEjB,KAAK,CAACD,KAAK,CAACmB,OAAO,CAACC,OAAO;IACzCC,SAAS,EAAEd,cAAc,CAACR,MAAM,GAAG,gBAAgB,GAAGuB,SAAS;IAC/DC,OAAO,EAAEC,YAAY,iBAAIZ,6BAACa,oBAAoB,oBAAKD,YAAY;MAAEzB,MAAM,EAAEA,MAAM;MAAEC,KAAK,EAAEA;OAAS;IACjGc,QAAQ;IACRH,GAAG;IACHS,OAAO,iBACHR,4DACKX,KAAK,CAACD,KAAK,CAACmB,OAAO,CAACC,OAAO,eAC5BR,6BAACc,QAAQ;MAACL,SAAS,EAAC,MAAM;MAACM,IAAI,EAAEb;MAAY,CAC9C;GAEV;EAEDF,cAAK,CAACgB,SAAS,CAAC;IACZ,MAAMC,WAAW,GAAGxB,aAAa,CAACyB,IAAI,CAACpB,aAAa,CAAC;;IAGrD,IAAImB,WAAW,EAAE;MAAA,IAAAE,YAAA;MACb,CAAAA,YAAA,GAAApB,GAAG,CAACqB,OAAO,cAAAD,YAAA,uBAAXA,YAAA,CAAaE,KAAK,EAAE;;GAE3B,EAAE,CAAC5B,aAAa,CAAC,CAAC;EAEnB,IAAI,CAACF,aAAa,IAAI,CAACI,cAAc,CAACR,MAAM,EAAE;IAC1C,oBAAOa,6BAACsB,UAAU,oBAAKhB,WAAW;MAAEiB,IAAI,EAAC;OAAW;;EAGxD,oBACIvB,6BAACwB,MAAM,oBAAKlB,WAAW,gBACnBN,6BAACyB,IAAI;IAAChB,SAAS,EAAE,CAAClB,aAAa,GAAG,SAAS,GAAGmB,SAAS;IAAEgB,IAAI,EAAE/B,cAAc,CAACR,MAAM,GAAG,cAAc,GAAG;IAAY,EACnHI,aAAa,GAAGF,KAAK,CAACD,KAAK,CAACmB,OAAO,CAACoB,MAAM,GAAG,EAAE,EAC/ChC,cAAc,CAACR,MAAM,OAAOQ,cAAc,CAACR,SAAS,GAAG,EAAE,CACrD;AAEjB;;;;"}
1
+ {"version":3,"file":"Filters.js","sources":["../../../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/components/Filters/Filters.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable } from '@tanstack/react-table';\nimport { useIsLargeScreen } from '../../../../../../../hooks/useIsLargeScreen';\nimport { useLocalization } from '../../../../../../../components/Provider/Localization';\nimport { IconButton } from '../../../../../../../components/IconButton/IconButton';\nimport { Button } from '../../../../../../../components/Button/Button';\nimport { Icon } from '../../../../../../../components/Icon/Icon';\nimport { Shortcut } from '../../../../../../../components/Shortcut/Shortcut';\nimport { ManageFiltersPopover } from './ManageFiltersPopover';\nimport { TableFilter } from '../../../../../types';\nimport { isEmptyFilter } from './util';\n\nexport type FiltersProps<TType = unknown> = {\n length: number;\n table: ReactTable<TType>;\n};\n\nexport function Filters<TType = unknown>(props: FiltersProps<TType>) {\n const { length, table } = props;\n const { texts } = useLocalization();\n const isLargeScreen = useIsLargeScreen();\n const columnFilters = table.getState().columnFilters as TableFilter[];\n const appliedFilters = columnFilters.filter(f => !isEmptyFilter(f));\n const ref = React.useRef<HTMLButtonElement>(null);\n\n const shortcut = { key: 'f', meta: true, shift: true };\n\n const buttonProps = {\n 'aria-label': texts.table.filters.tooltip,\n className: appliedFilters.length ? '!wcag-blue-100' : undefined,\n popover: popoverProps => <ManageFiltersPopover {...popoverProps} length={length} table={table} />,\n shortcut,\n ref,\n tooltip: (\n <>\n {texts.table.filters.tooltip}\n <Shortcut className=\"ml-2\" keys={shortcut} />\n </>\n ),\n };\n\n React.useEffect(() => {\n const emptyFilter = columnFilters.find(isEmptyFilter);\n\n // we set an empty filter when adding a filter through a column header.\n if (emptyFilter) {\n ref.current?.click();\n }\n }, [columnFilters]);\n\n if (!isLargeScreen && !appliedFilters.length) {\n return <IconButton {...buttonProps} icon=\"filter\" />;\n }\n\n return (\n <Button {...buttonProps}>\n <Icon className={!isLargeScreen ? '-mr-1.5' : undefined} name={appliedFilters.length ? 'filter-solid' : 'filter'} />\n {isLargeScreen ? texts.table.filters.button : ''}\n {appliedFilters.length ? `(${appliedFilters.length})` : ''}\n </Button>\n );\n}\n"],"names":["Filters","props","length","table","texts","useLocalization","isLargeScreen","useIsLargeScreen","columnFilters","getState","appliedFilters","filter","f","isEmptyFilter","ref","React","useRef","shortcut","key","meta","shift","buttonProps","filters","tooltip","className","undefined","popover","popoverProps","ManageFiltersPopover","Shortcut","keys","useEffect","emptyFilter","find","_ref$current","current","click","IconButton","icon","Button","Icon","name","button"],"mappings":";;;;;;;;;;SAiBgBA,OAAOA,CAAkBC,KAA0B;EAC/D,MAAM;IAAEC,MAAM;IAAEC;GAAO,GAAGF,KAAK;EAC/B,MAAM;IAAEG;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,aAAa,GAAGC,gBAAgB,EAAE;EACxC,MAAMC,aAAa,GAAGL,KAAK,CAACM,QAAQ,EAAE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,EAAE,CAAClB,aAAa,GAAG,SAAS,GAAGmB,SAAS;IAAEgB,IAAI,EAAE/B,cAAc,CAACR,MAAM,GAAG,cAAc,GAAG;IAAY,EACnHI,aAAa,GAAGF,KAAK,CAACD,KAAK,CAACmB,OAAO,CAACoB,MAAM,GAAG,EAAE,EAC/ChC,cAAc,CAACR,MAAM,GAAG,IAAIQ,cAAc,CAACR,MAAM,GAAG,GAAG,EAAE,CACrD;AAEjB;;;;"}
@@ -103,7 +103,7 @@ function ManageFiltersPopover(props) {
103
103
  className: "text-grey-700 mb-0 mr-auto mt-px inline-flex"
104
104
  }, texts.table.filters.total.replace('[CURRENT]', new Intl.NumberFormat(locale).format(table.getFilteredRowModel().rows.length)).replace('[TOTAL]', new Intl.NumberFormat(locale).format(length))))), /*#__PURE__*/React__default.createElement("div", {
105
105
  className: "flex flex-col gap-2"
106
- }, filters.map((filter, index) => ( /*#__PURE__*/React__default.createElement(Filter, {
106
+ }, filters.map((filter, index) => (/*#__PURE__*/React__default.createElement(Filter, {
107
107
  key: `filter_${index}`,
108
108
  allColumns: allColumns,
109
109
  filter: filter,
@@ -1 +1 @@
1
- {"version":3,"file":"ManageFiltersPopover.js","sources":["../../../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable } from '@tanstack/react-table';\nimport { Popover } from '../../../../../../../components/Popover/Popover';\nimport { useLocalization } from '../../../../../../../components/Provider/Localization';\nimport { Button } from '../../../../../../../components/Button/Button';\nimport { Group } from '../../../../../../../components/Group/Group';\nimport { isEmptyFilter, sortByHeader } from './util';\nimport { isInternalColumn } from '../../../../../useTableManager/util/columns';\nimport { TableFilter, TableFilterComparator, TableFilterValue } from '../../../../../types';\nimport { Filter } from './components/Filter';\n\nexport type ManageFiltersPopoverProps<TType = unknown> = {\n length: number;\n table: ReactTable<TType>;\n};\n\nconst placeholderFilter: TableFilter = { id: '', value: { comparator: TableFilterComparator.Contains, value: undefined } };\n\nexport function ManageFiltersPopover<TType = unknown>(props: ManageFiltersPopoverProps<TType>) {\n const { length, table, ...popoverProps } = props;\n const { locale, texts } = useLocalization();\n\n const allColumns = table\n .getAllLeafColumns()\n .filter(column => !isInternalColumn(column.id))\n .sort(sortByHeader);\n\n const columnFilters = table.getState().columnFilters as TableFilter[];\n\n // state, since we \"apply\" filters - our filter values have a special shape, so we force to our type\n const [filters, setFilters] = React.useState<TableFilter[]>(columnFilters.length ? columnFilters : [placeholderFilter]);\n\n // this runs if filters are set outside (e.g. through column header)\n React.useEffect(() => {\n setFilters(columnFilters.length === 0 ? [placeholderFilter] : columnFilters);\n\n // focus the filter value, as we preset the column/comparator.\n requestAnimationFrame(() => {\n const filterValues = document.querySelectorAll('[data-query-selector=\"filter-value\"]');\n const lastFilter = filterValues.length ? filterValues[filterValues.length - 1] : undefined;\n\n (lastFilter as HTMLElement)?.focus();\n });\n }, [columnFilters]);\n\n // filters\n const handleChangeFilter = (position: number, filter: { id: string; value: TableFilterValue }) => {\n setFilters(currentFilters => {\n return currentFilters.map((current, index) => {\n if (index === position) {\n return filter;\n }\n return current;\n });\n });\n };\n\n const handleRemoveFilter = position => {\n if (filters.length === 1) {\n setFilters([placeholderFilter]);\n return;\n }\n\n setFilters(currentFilters => currentFilters.filter((_, index) => index !== position));\n };\n\n const handleCreate = () => {\n setFilters(filters.concat(placeholderFilter));\n };\n\n //\n const handleApply = () => {\n table.setColumnFilters(() => {\n const newFilters = filters.filter(f => {\n if (f.id === null || f.id === '') {\n return false;\n }\n\n const controlRenderer = allColumns.find(c => c.id === f.id)?.columnDef.meta?.control;\n\n if (\n f.value.comparator === TableFilterComparator.IsEmpty ||\n f.value.comparator === TableFilterComparator.IsNotEmpty ||\n controlRenderer === 'switch'\n ) {\n return true;\n }\n\n const value = f.value.value;\n\n return value !== undefined && value !== null && value !== '';\n });\n\n return newFilters;\n });\n };\n\n const handleClear = () => {\n table.resetColumnFilters();\n setFilters([placeholderFilter]);\n };\n\n const handleClose = (open: boolean) => {\n if (!open) {\n const nonEmptyFilters = columnFilters.filter(f => !isEmptyFilter(f));\n table.setColumnFilters(nonEmptyFilters);\n setFilters(nonEmptyFilters.length === 0 ? [placeholderFilter] : nonEmptyFilters);\n }\n };\n\n return (\n <Popover {...popoverProps} onChange={handleClose}>\n <Popover.Content>\n <div className=\"flex w-[40rem] flex-col gap-4\">\n <div className=\"flex h-8\">\n <div className=\"flex w-full items-center gap-2\">\n <h4 className=\"mb-0 inline-flex\">{texts.table.filters.button}</h4>\n <p className=\"text-grey-700 mb-0 mr-auto mt-px inline-flex\">\n {texts.table.filters.total\n .replace(\n '[CURRENT]',\n new Intl.NumberFormat(locale).format(table.getFilteredRowModel().rows.length)\n )\n .replace('[TOTAL]', new Intl.NumberFormat(locale).format(length))}\n </p>\n </div>\n </div>\n <div className=\"flex flex-col gap-2\">\n {filters.map((filter, index) => (\n <Filter\n key={`filter_${index}`}\n allColumns={allColumns}\n filter={filter}\n filters={filters}\n position={index}\n onChange={handleChangeFilter}\n onRemove={\n (filters.length > 0 && filters.some(f => f.id)) || filters.length > 1\n ? handleRemoveFilter\n : undefined\n }\n />\n ))}\n <div className=\"justify-start\">\n <Button appearance=\"discrete\" onClick={handleCreate}>\n + {texts.table.filters.buttons.addFilter}\n </Button>\n </div>\n </div>\n <Group className=\"ml-auto\">\n <Popover.Close>\n <Button>{texts.table.filters.buttons.cancel}</Button>\n </Popover.Close>\n <Button onClick={handleClear}>{texts.table.filters.buttons.clear}</Button>\n <Button appearance=\"primary\" onClick={handleApply}>\n {texts.table.filters.buttons.apply}\n </Button>\n </Group>\n </div>\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["placeholderFilter","id","value","comparator","TableFilterComparator","Contains","undefined","ManageFiltersPopover","props","length","table","popoverProps","locale","texts","useLocalization","allColumns","getAllLeafColumns","filter","column","isInternalColumn","sort","sortByHeader","columnFilters","getState","filters","setFilters","React","useState","useEffect","requestAnimationFrame","filterValues","document","querySelectorAll","lastFilter","focus","handleChangeFilter","position","currentFilters","map","current","index","handleRemoveFilter","_","handleCreate","concat","handleApply","setColumnFilters","newFilters","f","controlRenderer","_allColumns$find","find","c","_allColumns$find$colu","columnDef","meta","control","IsEmpty","IsNotEmpty","handleClear","resetColumnFilters","handleClose","open","nonEmptyFilters","isEmptyFilter","Popover","onChange","Content","className","button","total","replace","Intl","NumberFormat","format","getFilteredRowModel","rows","Filter","key","onRemove","some","Button","appearance","onClick","buttons","addFilter","Group","Close","cancel","clear","apply"],"mappings":";;;;;;;;;;AAgBA,MAAMA,iBAAiB,GAAgB;EAAEC,EAAE,EAAE,EAAE;EAAEC,KAAK,EAAE;IAAEC,UAAU,EAAEC,qBAAqB,CAACC,QAAQ;IAAEH,KAAK,EAAEI;;CAAa;SAE1GC,oBAAoBA,CAAkBC,KAAuC;EACzF,MAAM;IAAEC,MAAM;IAAEC,KAAK;IAAE,GAAGC;GAAc,GAAGH,KAAK;EAChD,MAAM;IAAEI,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAE3C,MAAMC,UAAU,GAAGL,KAAK,CACnBM,iBAAiB,EAAE,CACnBC,MAAM,CAACC,MAAM,IAAI,CAACC,gBAAgB,CAACD,MAAM,CAACjB,EAAE,CAAC,CAAC,CAC9CmB,IAAI,CAACC,YAAY,CAAC;EAEvB,MAAMC,aAAa,GAAGZ,KAAK,CAACa,QAAQ,EAAE,CAACD,aAA8B;;EAGrE,MAAM,CAACE,OAAO,EAAEC,UAAU,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAgBL,aAAa,CAACb,MAAM,GAAGa,aAAa,GAAG,CAACtB,iBAAiB,CAAC,CAAC;;EAGvH0B,cAAK,CAACE,SAAS,CAAC;IACZH,UAAU,CAACH,aAAa,CAACb,MAAM,KAAK,CAAC,GAAG,CAACT,iBAAiB,CAAC,GAAGsB,aAAa,CAAC;;IAG5EO,qBAAqB,CAAC;MAClB,MAAMC,YAAY,GAAGC,QAAQ,CAACC,gBA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ACI,MAAM,CAAU,CACzC,eAChB9D,6BAACuD,MAAM;IAACE,OAAO,EAAExB;KAAc9C,KAAK,CAACH,KAAK,CAACc,OAAO,CAAC4D,OAAO,CAACK,KAAK,CAAU,eAC1E/D,6BAACuD,MAAM;IAACC,UAAU,EAAC,SAAS;IAACC,OAAO,EAAEtC;KACjChC,KAAK,CAACH,KAAK,CAACc,OAAO,CAAC4D,OAAO,CAACM,KAAK,CAC7B,CACL,CACN,CACQ,CACZ;AAElB;;;;"}
1
+ {"version":3,"file":"ManageFiltersPopover.js","sources":["../../../../../../../../../../../../src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable } from '@tanstack/react-table';\nimport { Popover } from '../../../../../../../components/Popover/Popover';\nimport { useLocalization } from '../../../../../../../components/Provider/Localization';\nimport { Button } from '../../../../../../../components/Button/Button';\nimport { Group } from '../../../../../../../components/Group/Group';\nimport { isEmptyFilter, sortByHeader } from './util';\nimport { isInternalColumn } from '../../../../../useTableManager/util/columns';\nimport { TableFilter, TableFilterComparator, TableFilterValue } from '../../../../../types';\nimport { Filter } from './components/Filter';\n\nexport type ManageFiltersPopoverProps<TType = unknown> = {\n length: number;\n table: ReactTable<TType>;\n};\n\nconst placeholderFilter: TableFilter = { id: '', value: { comparator: TableFilterComparator.Contains, value: undefined } };\n\nexport function ManageFiltersPopover<TType = unknown>(props: ManageFiltersPopoverProps<TType>) {\n const { length, table, ...popoverProps } = props;\n const { locale, texts } = useLocalization();\n\n const allColumns = table\n .getAllLeafColumns()\n .filter(column => !isInternalColumn(column.id))\n .sort(sortByHeader);\n\n const columnFilters = table.getState().columnFilters as TableFilter[];\n\n // state, since we \"apply\" filters - our filter values have a special shape, so we force to our type\n const [filters, setFilters] = React.useState<TableFilter[]>(columnFilters.length ? columnFilters : [placeholderFilter]);\n\n // this runs if filters are set outside (e.g. through column header)\n React.useEffect(() => {\n setFilters(columnFilters.length === 0 ? [placeholderFilter] : columnFilters);\n\n // focus the filter value, as we preset the column/comparator.\n requestAnimationFrame(() => {\n const filterValues = document.querySelectorAll('[data-query-selector=\"filter-value\"]');\n const lastFilter = filterValues.length ? filterValues[filterValues.length - 1] : undefined;\n\n (lastFilter as HTMLElement)?.focus();\n });\n }, [columnFilters]);\n\n // filters\n const handleChangeFilter = (position: number, filter: { id: string; value: TableFilterValue }) => {\n setFilters(currentFilters => {\n return currentFilters.map((current, index) => {\n if (index === position) {\n return filter;\n }\n return current;\n });\n });\n };\n\n const handleRemoveFilter = position => {\n if (filters.length === 1) {\n setFilters([placeholderFilter]);\n return;\n }\n\n setFilters(currentFilters => currentFilters.filter((_, index) => index !== position));\n };\n\n const handleCreate = () => {\n setFilters(filters.concat(placeholderFilter));\n };\n\n //\n const handleApply = () => {\n table.setColumnFilters(() => {\n const newFilters = filters.filter(f => {\n if (f.id === null || f.id === '') {\n return false;\n }\n\n const controlRenderer = allColumns.find(c => c.id === f.id)?.columnDef.meta?.control;\n\n if (\n f.value.comparator === TableFilterComparator.IsEmpty ||\n f.value.comparator === TableFilterComparator.IsNotEmpty ||\n controlRenderer === 'switch'\n ) {\n return true;\n }\n\n const value = f.value.value;\n\n return value !== undefined && value !== null && value !== '';\n });\n\n return newFilters;\n });\n };\n\n const handleClear = () => {\n table.resetColumnFilters();\n setFilters([placeholderFilter]);\n };\n\n const handleClose = (open: boolean) => {\n if (!open) {\n const nonEmptyFilters = columnFilters.filter(f => !isEmptyFilter(f));\n table.setColumnFilters(nonEmptyFilters);\n setFilters(nonEmptyFilters.length === 0 ? [placeholderFilter] : nonEmptyFilters);\n }\n };\n\n return (\n <Popover {...popoverProps} onChange={handleClose}>\n <Popover.Content>\n <div className=\"flex w-[40rem] flex-col gap-4\">\n <div className=\"flex h-8\">\n <div className=\"flex w-full items-center gap-2\">\n <h4 className=\"mb-0 inline-flex\">{texts.table.filters.button}</h4>\n <p className=\"text-grey-700 mb-0 mr-auto mt-px inline-flex\">\n {texts.table.filters.total\n .replace(\n '[CURRENT]',\n new Intl.NumberFormat(locale).format(table.getFilteredRowModel().rows.length)\n )\n .replace('[TOTAL]', new Intl.NumberFormat(locale).format(length))}\n </p>\n </div>\n </div>\n <div className=\"flex flex-col gap-2\">\n {filters.map((filter, index) => (\n <Filter\n key={`filter_${index}`}\n allColumns={allColumns}\n filter={filter}\n filters={filters}\n position={index}\n onChange={handleChangeFilter}\n onRemove={\n (filters.length > 0 && filters.some(f => f.id)) || filters.length > 1\n ? handleRemoveFilter\n : undefined\n }\n />\n ))}\n <div className=\"justify-start\">\n <Button appearance=\"discrete\" onClick={handleCreate}>\n + {texts.table.filters.buttons.addFilter}\n </Button>\n </div>\n </div>\n <Group className=\"ml-auto\">\n <Popover.Close>\n <Button>{texts.table.filters.buttons.cancel}</Button>\n </Popover.Close>\n <Button onClick={handleClear}>{texts.table.filters.buttons.clear}</Button>\n <Button appearance=\"primary\" onClick={handleApply}>\n {texts.table.filters.buttons.apply}\n </Button>\n </Group>\n </div>\n </Popover.Content>\n </Popover>\n );\n}\n"],"names":["placeholderFilter","id","value","comparator","TableFilterComparator","Contains","undefined","ManageFiltersPopover","props","length","table","popoverProps","locale","texts","useLocalization","allColumns","getAllLeafColumns","filter","column","isInternalColumn","sort","sortByHeader","columnFilters","getState","filters","setFilters","React","useState","useEffect","requestAnimationFrame","filterValues","document","querySelectorAll","lastFilter","focus","handleChangeFilter","position","currentFilters","map","current","index","handleRemoveFilter","_","handleCreate","concat","handleApply","setColumnFilters","newFilters","f","controlRenderer","_allColumns$find","find","c","_allColumns$find$colu","columnDef","meta","control","IsEmpty","IsNotEmpty","handleClear","resetColumnFilters","handleClose","open","nonEmptyFilters","isEmptyFilter","Popover","onChange","Content","className","button","total","replace","Intl","NumberFormat","format","getFilteredRowModel","rows","Filter","key","onRemove","some","Button","appearance","onClick","buttons","addFilter","Group","Close","cancel","clear","apply"],"mappings":";;;;;;;;;;AAgBA,MAAMA,iBAAiB,GAAgB;EAAEC,EAAE,EAAE,E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AAC,CACrE,CACF,CACJ,eACNiB;IAAK0C,SAAS,EAAC;KACV5C,OAAO,CAACc,GAAG,CAAC,CAACrB,MAAM,EAAEuB,KAAK,mBACvBd,6BAACmD,MAAM;IACHC,GAAG,EAAE,UAAUtC,KAAK,EAAE;IACtBzB,UAAU,EAAEA,UAAU;IACtBE,MAAM,EAAEA,MAAM;IACdO,OAAO,EAAEA,OAAO;IAChBY,QAAQ,EAAEI,KAAK;IACf0B,QAAQ,EAAE/B,kBAAkB;IAC5B4C,QAAQ,EACHvD,OAAO,CAACf,MAAM,GAAG,CAAC,IAAIe,OAAO,CAACwD,IAAI,CAAChC,CAAC,IAAIA,CAAC,CAAC/C,EAAE,CAAC,IAAKuB,OAAO,CAACf,MAAM,GAAG,CAAC,GAC/DgC,kBAAkB,GAClBnC;IAEZ,CACL,CAAC,eACFoB;IAAK0C,SAAS,EAAC;kBACX1C,6BAACuD,MAAM;IAACC,UAAU,EAAC,UAAU;IAACC,OAAO,EAAExC;WAChC9B,KAAK,CAACH,KAAK,CAACc,OAAO,CAAC4D,OAAO,CAACC,SAAS,CACnC,CACP,CACJ,eACN3D,6BAAC4D,KAAK;IAAClB,SAAS,EAAC;kBACb1C,6BAACuC,OAAO,CAACsB,KAAK,qBACV7D,6BAACuD,MAAM,QAAEpE,KAAK,CAACH,KAAK,CAACc,OAAO,CAAC4D,OAAO,CAACI,MAAM,CAAU,CACzC,eAChB9D,6BAACuD,MAAM;IAACE,OAAO,EAAExB;KAAc9C,KAAK,CAACH,KAAK,CAACc,OAAO,CAAC4D,OAAO,CAACK,KAAK,CAAU,eAC1E/D,6BAACuD,MAAM;IAACC,UAAU,EAAC,SAAS;IAACC,OAAO,EAAEtC;KACjChC,KAAK,CAACH,KAAK,CAACc,OAAO,CAAC4D,OAAO,CAACM,KAAK,CAC7B,CACL,CACN,CACQ,CACZ;AAElB;;;;"}
@@ -35,7 +35,7 @@ const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
35
35
  return /*#__PURE__*/React__default.createElement(Select2.Option, {
36
36
  key: column.id,
37
37
  value: column.id,
38
- postfix: !column.getIsVisible() || column.getIsGrouped() ? ( /*#__PURE__*/React__default.createElement(Tooltip, {
38
+ postfix: !column.getIsVisible() || column.getIsGrouped() ? (/*#__PURE__*/React__default.createElement(Tooltip, {
39
39
  title: column.getIsGrouped() ? texts.table.filters.hiddenGroupedColumn : texts.table.filters.hiddenColumn
40
40
  }, /*#__PURE__*/React__default.createElement(Icon, {
41
41
  name: "eye-off",