@economic/taco 2.13.0 → 2.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. package/dist/components/Field/Field.d.ts +4 -2
  2. package/dist/components/Icon/components/Location.d.ts +3 -0
  3. package/dist/components/Icon/components/index.d.ts +1 -1
  4. package/dist/components/Input/Input.d.ts +1 -1
  5. package/dist/components/Menu/components/Item.d.ts +1 -1
  6. package/dist/components/Menu/components/Link.d.ts +1 -1
  7. package/dist/components/Navigation2/components/Link.d.ts +1 -1
  8. package/dist/components/Provider/Localization.d.ts +0 -113
  9. package/dist/components/Select2/components/Option.d.ts +2 -2
  10. package/dist/components/Select2/components/Search.d.ts +1 -1
  11. package/dist/components/Table3/components/columns/styles.d.ts +2 -2
  12. package/dist/components/Table3/components/toolbar/Filter/filters/components/Filter.d.ts +4 -4
  13. package/dist/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.d.ts +3 -2
  14. package/dist/components/Table3/components/toolbar/Filter/filters/components/Placeholder.d.ts +3 -2
  15. package/dist/components/Table3/components/toolbar/FontSize.d.ts +4 -0
  16. package/dist/components/Table3/hooks/useCssGrid.d.ts +2 -1
  17. package/dist/components/Table3/hooks/useTable.d.ts +1 -1
  18. package/dist/components/Table3/types.d.ts +1 -1
  19. package/dist/components/Tag/Tag.d.ts +1 -1
  20. package/dist/esm/packages/taco/src/components/Field/Field.js +6 -4
  21. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  22. package/dist/esm/packages/taco/src/components/Icon/components/Location.js +17 -0
  23. package/dist/esm/packages/taco/src/components/Icon/components/Location.js.map +1 -0
  24. package/dist/esm/packages/taco/src/components/Icon/components/index.js +2 -0
  25. package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
  26. package/dist/esm/packages/taco/src/components/Provider/Localization.js +0 -110
  27. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  28. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +1 -1
  29. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +1 -1
  31. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Select2/components/Search.js +1 -1
  33. package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Table3/Table3.js +5 -4
  35. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +2 -5
  37. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
  38. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +1 -4
  39. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  40. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
  41. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +6 -1
  42. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
  43. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +3 -2
  44. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
  45. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js +14 -2
  46. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js.map +1 -1
  47. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +2 -2
  48. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +15 -8
  49. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
  50. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Filter.js +2 -2
  51. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Filter.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js +12 -3
  53. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js.map +1 -1
  54. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +0 -1
  55. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js.map +1 -1
  56. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterValue.js +5 -3
  57. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterValue.js.map +1 -1
  58. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js +2 -2
  59. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/Placeholder.js.map +1 -1
  60. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/FontSize.js +9 -4
  61. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/FontSize.js.map +1 -1
  62. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +2 -3
  63. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
  64. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/RowHeight.js +3 -2
  65. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/RowHeight.js.map +1 -1
  66. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js +1 -1
  67. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js +6 -7
  68. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js.map +1 -1
  69. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +48 -0
  70. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
  71. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +4 -2
  72. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
  73. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js +6 -5
  74. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js.map +1 -1
  75. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js +11 -9
  76. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js.map +1 -1
  77. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  78. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  79. package/dist/esm/packages/taco/src/index.js +1 -2
  80. package/dist/esm/packages/taco/src/index.js.map +1 -1
  81. package/dist/esm/packages/taco/src/utils/dom.js +1 -2
  82. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  83. package/dist/index.d.ts +0 -1
  84. package/dist/taco.cjs.development.js +485 -4052
  85. package/dist/taco.cjs.development.js.map +1 -1
  86. package/dist/taco.cjs.production.min.js +1 -1
  87. package/dist/taco.cjs.production.min.js.map +1 -1
  88. package/package.json +2 -2
  89. package/tailwind.config.js +3 -0
  90. package/types.json +13748 -32551
  91. package/dist/components/Table2/Table2.d.ts +0 -130
  92. package/dist/components/Table2/components/BatchActionsMenu.d.ts +0 -10
  93. package/dist/components/Table2/components/ColumnSettingsButton.d.ts +0 -6
  94. package/dist/components/Table2/components/EditModeButton.d.ts +0 -8
  95. package/dist/components/Table2/components/RowDensityButton.d.ts +0 -7
  96. package/dist/components/Table2/components/Search.d.ts +0 -3
  97. package/dist/components/Table2/components/ShortcutsGuideButton.d.ts +0 -7
  98. package/dist/components/Table2/components/column/Base.d.ts +0 -14
  99. package/dist/components/Table2/components/column/Cell.d.ts +0 -15
  100. package/dist/components/Table2/components/column/Footer.d.ts +0 -9
  101. package/dist/components/Table2/components/column/Header.d.ts +0 -11
  102. package/dist/components/Table2/components/column/Indicator.d.ts +0 -17
  103. package/dist/components/Table2/components/column/ValidationError.d.ts +0 -5
  104. package/dist/components/Table2/components/column/utils.d.ts +0 -3
  105. package/dist/components/Table2/components/filters/FiltersButton.d.ts +0 -7
  106. package/dist/components/Table2/components/filters/components/Column.d.ts +0 -11
  107. package/dist/components/Table2/components/filters/components/ColumnFilter.d.ts +0 -10
  108. package/dist/components/Table2/components/filters/components/Comparator.d.ts +0 -11
  109. package/dist/components/Table2/components/filters/components/EmptyFilter.d.ts +0 -13
  110. package/dist/components/Table2/components/filters/components/InferredControl.d.ts +0 -10
  111. package/dist/components/Table2/components/row/Context.d.ts +0 -24
  112. package/dist/components/Table2/components/row/ExpandedRow.d.ts +0 -6
  113. package/dist/components/Table2/components/row/Row.d.ts +0 -2
  114. package/dist/components/Table2/hooks/listeners/useActiveCellStateListener.d.ts +0 -3
  115. package/dist/components/Table2/hooks/listeners/useActiveRowStateListener.d.ts +0 -3
  116. package/dist/components/Table2/hooks/listeners/useColumnOffsetStateListener.d.ts +0 -3
  117. package/dist/components/Table2/hooks/listeners/useFilterStateListener.d.ts +0 -3
  118. package/dist/components/Table2/hooks/listeners/useRowSelectionListener.d.ts +0 -3
  119. package/dist/components/Table2/hooks/listeners/useSettingsStateListener.d.ts +0 -3
  120. package/dist/components/Table2/hooks/useActiveCell.d.ts +0 -26
  121. package/dist/components/Table2/hooks/useActiveRow.d.ts +0 -10
  122. package/dist/components/Table2/hooks/useColumnDefinitions.d.ts +0 -37
  123. package/dist/components/Table2/hooks/useEditMode.d.ts +0 -28
  124. package/dist/components/Table2/hooks/useGridTemplate.d.ts +0 -2
  125. package/dist/components/Table2/hooks/useTable.d.ts +0 -46
  126. package/dist/components/Table2/hooks/useTableShortcuts.d.ts +0 -2
  127. package/dist/components/Table2/hooks/useVirtualiser.d.ts +0 -23
  128. package/dist/components/Table2/types.d.ts +0 -148
  129. package/dist/components/Table2/utilities/cell.d.ts +0 -14
  130. package/dist/components/Table2/utilities/columns.d.ts +0 -16
  131. package/dist/components/Table2/utilities/filterFn.d.ts +0 -3
  132. package/dist/esm/packages/taco/src/components/Table2/Table2.js +0 -422
  133. package/dist/esm/packages/taco/src/components/Table2/Table2.js.map +0 -1
  134. package/dist/esm/packages/taco/src/components/Table2/components/BatchActionsMenu.js +0 -83
  135. package/dist/esm/packages/taco/src/components/Table2/components/BatchActionsMenu.js.map +0 -1
  136. package/dist/esm/packages/taco/src/components/Table2/components/ColumnSettingsButton.js +0 -116
  137. package/dist/esm/packages/taco/src/components/Table2/components/ColumnSettingsButton.js.map +0 -1
  138. package/dist/esm/packages/taco/src/components/Table2/components/EditModeButton.js +0 -81
  139. package/dist/esm/packages/taco/src/components/Table2/components/EditModeButton.js.map +0 -1
  140. package/dist/esm/packages/taco/src/components/Table2/components/RowDensityButton.js +0 -47
  141. package/dist/esm/packages/taco/src/components/Table2/components/RowDensityButton.js.map +0 -1
  142. package/dist/esm/packages/taco/src/components/Table2/components/Search.js +0 -62
  143. package/dist/esm/packages/taco/src/components/Table2/components/Search.js.map +0 -1
  144. package/dist/esm/packages/taco/src/components/Table2/components/column/Base.js +0 -32
  145. package/dist/esm/packages/taco/src/components/Table2/components/column/Base.js.map +0 -1
  146. package/dist/esm/packages/taco/src/components/Table2/components/column/Cell.js +0 -605
  147. package/dist/esm/packages/taco/src/components/Table2/components/column/Cell.js.map +0 -1
  148. package/dist/esm/packages/taco/src/components/Table2/components/column/Footer.js +0 -32
  149. package/dist/esm/packages/taco/src/components/Table2/components/column/Footer.js.map +0 -1
  150. package/dist/esm/packages/taco/src/components/Table2/components/column/Header.js +0 -243
  151. package/dist/esm/packages/taco/src/components/Table2/components/column/Header.js.map +0 -1
  152. package/dist/esm/packages/taco/src/components/Table2/components/column/Indicator.js +0 -73
  153. package/dist/esm/packages/taco/src/components/Table2/components/column/Indicator.js.map +0 -1
  154. package/dist/esm/packages/taco/src/components/Table2/components/column/ValidationError.js +0 -30
  155. package/dist/esm/packages/taco/src/components/Table2/components/column/ValidationError.js.map +0 -1
  156. package/dist/esm/packages/taco/src/components/Table2/components/column/utils.js +0 -39
  157. package/dist/esm/packages/taco/src/components/Table2/components/column/utils.js.map +0 -1
  158. package/dist/esm/packages/taco/src/components/Table2/components/filters/FiltersButton.js +0 -155
  159. package/dist/esm/packages/taco/src/components/Table2/components/filters/FiltersButton.js.map +0 -1
  160. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/Column.js +0 -31
  161. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/Column.js.map +0 -1
  162. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/ColumnFilter.js +0 -129
  163. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/ColumnFilter.js.map +0 -1
  164. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/Comparator.js +0 -68
  165. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/Comparator.js.map +0 -1
  166. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/EmptyFilter.js +0 -63
  167. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/EmptyFilter.js.map +0 -1
  168. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/InferredControl.js +0 -99
  169. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/InferredControl.js.map +0 -1
  170. package/dist/esm/packages/taco/src/components/Table2/components/row/Context.js +0 -58
  171. package/dist/esm/packages/taco/src/components/Table2/components/row/Context.js.map +0 -1
  172. package/dist/esm/packages/taco/src/components/Table2/components/row/ExpandedRow.js +0 -36
  173. package/dist/esm/packages/taco/src/components/Table2/components/row/ExpandedRow.js.map +0 -1
  174. package/dist/esm/packages/taco/src/components/Table2/components/row/Row.js +0 -44
  175. package/dist/esm/packages/taco/src/components/Table2/components/row/Row.js.map +0 -1
  176. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useActiveRowStateListener.js +0 -19
  177. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useActiveRowStateListener.js.map +0 -1
  178. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useColumnOffsetStateListener.js +0 -28
  179. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useColumnOffsetStateListener.js.map +0 -1
  180. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useFilterStateListener.js +0 -12
  181. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useFilterStateListener.js.map +0 -1
  182. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useRowSelectionListener.js +0 -18
  183. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useRowSelectionListener.js.map +0 -1
  184. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useSettingsStateListener.js +0 -25
  185. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useSettingsStateListener.js.map +0 -1
  186. package/dist/esm/packages/taco/src/components/Table2/hooks/useActiveRow.js +0 -33
  187. package/dist/esm/packages/taco/src/components/Table2/hooks/useActiveRow.js.map +0 -1
  188. package/dist/esm/packages/taco/src/components/Table2/hooks/useColumnDefinitions.js +0 -122
  189. package/dist/esm/packages/taco/src/components/Table2/hooks/useColumnDefinitions.js.map +0 -1
  190. package/dist/esm/packages/taco/src/components/Table2/hooks/useEditMode.js +0 -112
  191. package/dist/esm/packages/taco/src/components/Table2/hooks/useEditMode.js.map +0 -1
  192. package/dist/esm/packages/taco/src/components/Table2/hooks/useGridTemplate.js +0 -34
  193. package/dist/esm/packages/taco/src/components/Table2/hooks/useGridTemplate.js.map +0 -1
  194. package/dist/esm/packages/taco/src/components/Table2/hooks/useTable.js +0 -222
  195. package/dist/esm/packages/taco/src/components/Table2/hooks/useTable.js.map +0 -1
  196. package/dist/esm/packages/taco/src/components/Table2/hooks/useTableShortcuts.js +0 -46
  197. package/dist/esm/packages/taco/src/components/Table2/hooks/useTableShortcuts.js.map +0 -1
  198. package/dist/esm/packages/taco/src/components/Table2/hooks/useVirtualiser.js +0 -48
  199. package/dist/esm/packages/taco/src/components/Table2/hooks/useVirtualiser.js.map +0 -1
  200. package/dist/esm/packages/taco/src/components/Table2/types.js +0 -18
  201. package/dist/esm/packages/taco/src/components/Table2/types.js.map +0 -1
  202. package/dist/esm/packages/taco/src/components/Table2/utilities/cell.js +0 -41
  203. package/dist/esm/packages/taco/src/components/Table2/utilities/cell.js.map +0 -1
  204. package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js +0 -387
  205. package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js.map +0 -1
  206. package/dist/esm/packages/taco/src/components/Table2/utilities/filterFn.js +0 -100
  207. package/dist/esm/packages/taco/src/components/Table2/utilities/filterFn.js.map +0 -1
  208. package/dist/esm/packages/taco/src/components/Truncate/Truncate.js +0 -32
  209. package/dist/esm/packages/taco/src/components/Truncate/Truncate.js.map +0 -1
  210. package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js +0 -20
  211. package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"Table2.js","sources":["../../../../../../../src/components/Table2/Table2.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Row as TRow, TableMeta } from '@tanstack/react-table';\nimport { useMergedRef } from '../../hooks/useMergedRef';\nimport { Cell } from './components/column/Cell';\nimport { Header } from './components/column/Header';\nimport { Footer } from './components/column/Footer';\nimport { Table2Props, Table2ColumnProps } from './types';\nimport { useTable } from './hooks/useTable';\nimport { useVirtualiser } from './hooks/useVirtualiser';\nimport { Group } from '../Group/Group';\nimport { useGridTemplate } from './hooks/useGridTemplate';\nimport { RowDensityButton } from './components/RowDensityButton';\nimport { ColumnSettingsButton } from './components/ColumnSettingsButton';\nimport { ExpandedRow } from './components/row/ExpandedRow';\nimport { BatchActionsMenu } from './components/BatchActionsMenu';\nimport { Row } from './components/row/Row';\nimport { FiltersButton } from './components/filters/FiltersButton';\nimport { Search } from './components/Search';\nimport { EditModeButton } from './components/EditModeButton';\nimport { useLocalization } from '../Provider/Localization';\n\nexport type Table2Texts = {\n columns: {\n resize: {\n tooltip: string;\n };\n actions: {\n tooltip: string;\n };\n drag: {\n tooltip: string;\n };\n expansion: {\n collapse: string;\n collapseAll: string;\n expand: string;\n expandAll: string;\n };\n select: {\n deselect: string;\n deselectAll: string;\n select: string;\n selectAll: string;\n };\n menu: {\n hideColumn: string;\n freezeColumns: (count: number) => string;\n unfreezeColumns: string;\n };\n };\n columnSettings: {\n search: string;\n tooltip: string;\n button: string;\n noResults: string;\n };\n editing: {\n button: string;\n tooltip: string;\n tooltipDisabled: string;\n rowIndicator: {\n rowWillMove: string;\n rowWillBeHidden: string;\n rowWillMoveReasonSearch: string;\n rowWillMoveReasonFilter: string;\n rowWillMoveReasonSorting: string;\n };\n };\n filters: {\n button: string;\n buttons: {\n addNewFilter: string;\n clearFilters: string;\n };\n comparators: {\n contains: string;\n doesNotContain: string;\n isEqualTo: string;\n isNotEqualTo: string;\n isGreaterThan: string;\n isLessThan: string;\n isBetween: string;\n isOneOf: string;\n isNoneOf: string;\n isAllOf: string;\n isEmpty: string;\n isNotEmpty: string;\n };\n conditions: {\n and: string;\n where: string;\n };\n emptyFilter: {\n condition: string;\n value: string;\n };\n tooltip: string;\n total: string;\n };\n footer: {\n summary: {\n records: string;\n selected: string;\n };\n };\n rowDensity: {\n tooltip: string;\n compact: string;\n normal: string;\n comfortable: string;\n spacious: string;\n };\n search: {\n placeholder: string;\n };\n shortcuts: {\n tooltip: string;\n search: string;\n filter: string;\n previousRow: string;\n nextRow: string;\n editCell: string;\n previousColumn: string;\n nextColumn: string;\n rowClick: string;\n selectRow: string;\n selectAllRows: string;\n expandRow: string;\n collapseRow: string;\n };\n};\n\nfunction Column<TType = any>(_: Table2ColumnProps<TType>) {\n return null;\n}\nColumn.displayName = 'Table2Column';\n\nexport type Table2Ref = HTMLDivElement & {\n instance: {\n resetFiltering: () => void;\n resetRowExpansion: () => void;\n resetRowSelection: () => void;\n resetSorting: () => void;\n toggleEditing: () => void;\n };\n};\n\nconst BaseTable2 = React.forwardRef(function BaseTable2<TType = any>(props: Table2Props<TType>, ref: React.Ref<Table2Ref>) {\n // dom\n const {\n emptyState: EmptyState,\n expandedRowRenderer,\n length = props.data.length,\n loadMore,\n onRowClick,\n onRowDrop,\n toolbarLeft,\n toolbarRight,\n _experimentalActionsForTable,\n _experimentalActionsForTableSummary,\n } = props;\n const tableRef = useMergedRef<Table2Ref>(ref);\n const timeoutIdRef = React.useRef<NodeJS.Timeout>();\n const prevScrollY = React.useRef<number>(0);\n\n // react-table\n const { rows, table, footers } = useTable(props.children, props, tableRef);\n const meta = table.options.meta as TableMeta<TType>;\n\n const { columnVisibility, columnOrder, globalFilter } = table.getState();\n\n React.useEffect(() => {\n if (tableRef.current) {\n tableRef.current.instance = {\n resetFiltering: () => table.resetColumnFilters(),\n resetRowExpansion: () => table.resetExpanded(),\n resetRowSelection: () => table.resetRowSelection(),\n resetSorting: () => table.resetSorting(),\n toggleEditing: () => meta.editMode.toggleEditing(),\n };\n }\n }, [table, tableRef.current]);\n\n // If column visibility or order changes then we turn off the edit mode so that control indexes gets computed\n // when user turns on the editing mode again. This is a temporary solution to make sure the keyboard navigation\n // still keeps working on changes in column visibility, order, or both\n React.useEffect(() => {\n meta.resetFocussableColumnIndexes();\n }, [columnVisibility, columnOrder]);\n\n React.useEffect(() => {\n // Whenever edit mode is turned off we reset the focussableColumnIndexes ref to an empty array so that\n // we don't have stale values, in case column visibility or ordering changes\n if (!meta.editMode.isEditing) {\n meta.resetFocussableColumnIndexes();\n }\n }, [meta.editMode.isEditing]);\n\n React.useEffect(() => {\n return () => clearTimeout(timeoutIdRef.current);\n }, []);\n\n // virtualiser\n const { virtualiser, virtualiserOffsets, setExpandedRowSizes } = useVirtualiser({ rows, table }, tableRef);\n\n // css grid\n const gridTemplateColumns = useGridTemplate(table);\n\n // handlers\n const editButtonRef = React.useRef(null);\n\n // support grid like keyboard navigation between cells\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (document.activeElement === tableRef.current) {\n if (event.key === 'ArrowUp') {\n event.preventDefault();\n\n if (event.ctrlKey || event.metaKey) {\n meta.setActiveRowIndex(0);\n virtualiser.scrollToOffset(0);\n } else {\n meta.moveToPreviousRow(rows, nextIndex => {\n meta.setShouldPauseHoverState(true);\n virtualiser.scrollToIndex(nextIndex - 1);\n });\n }\n\n return;\n } else if (event.key === 'ArrowDown') {\n event.preventDefault();\n\n if (event.ctrlKey || event.metaKey) {\n meta.setActiveRowIndex(rows.length - 1);\n virtualiser.scrollToOffset(virtualiser.totalSize + 1);\n } else {\n meta.moveToNextRow(rows, nextIndex => {\n meta.setShouldPauseHoverState(true);\n\n // the virtualiser doesn't always scroll right to the bottom for the last row\n if (nextIndex === rows.length - 1) {\n tableRef.current?.scrollTo(0, tableRef.current.scrollHeight);\n } else {\n virtualiser.scrollToIndex(nextIndex + 2);\n }\n });\n }\n\n return;\n }\n\n const canToggleRowExpansion = table.options.enableExpanding;\n\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n\n if (event.ctrlKey || event.metaKey) {\n if (canToggleRowExpansion) {\n rows[meta.activeRowIndex]?.toggleExpanded(false);\n }\n }\n return;\n }\n\n if (event.key === 'ArrowRight') {\n event.preventDefault();\n\n if (event.ctrlKey || event.metaKey) {\n if (canToggleRowExpansion) {\n rows[meta?.activeRowIndex]?.toggleExpanded(true);\n }\n }\n\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n\n if (onRowClick) {\n onRowClick(rows[meta?.activeRowIndex].original);\n }\n\n return;\n }\n\n if (event.key === ' ') {\n event.preventDefault();\n\n if (table.options.enableRowSelection) {\n rows[meta.activeRowIndex]?.toggleSelected();\n }\n\n return;\n }\n\n if (event.ctrlKey || event.metaKey) {\n if (event.key === 'a' && table.options.enableRowSelection) {\n event.preventDefault();\n table.toggleAllRowsSelected();\n }\n\n return;\n }\n }\n };\n\n let handleBlur;\n\n if (meta.editMode.isEditing) {\n handleBlur = (event: React.FocusEvent) => {\n let elementGainingFocus = event.relatedTarget;\n\n if (elementGainingFocus === undefined) {\n return;\n }\n\n // we might be focusing on a select or a popover that was triggered from inside the table\n // so see if the element gaining focus is inside a portal and look up its controller\n const portalId = elementGainingFocus?.closest('[data-radix-popper-content-wrapper] > :first-child')?.id;\n\n if (portalId) {\n elementGainingFocus = event.currentTarget.querySelector(`[aria-controls=\"${portalId}\"]`) ?? event.relatedTarget;\n }\n\n if (!event.currentTarget?.contains(elementGainingFocus) && elementGainingFocus !== editButtonRef.current) {\n // When we call manually blur on control component while navigating to the next cell, then when this\n // handler is run, the related target is not the next control component and active element is null,\n // that's why we explictly need to check what's the next focussed element in order to figure out whether\n // we should disabled the sorting or not.\n timeoutIdRef.current = setTimeout(() => {\n const parentRow = event.target.closest('[role=\"row\"]');\n const isNewFocussedElementInSameRow = parentRow?.contains(document.activeElement);\n\n // When we manually call blur on control component and focus another component then\n // we have to make sure we\n if (meta.shouldPauseSortingAndFiltering && !isNewFocussedElementInSameRow) {\n // if client side - unpause sorting\n meta.setShouldPauseSortingAndFiltering(false);\n }\n });\n }\n };\n }\n\n // TODO: this can probably be extracted into a hook\n // we only show the pinned shadow on display columns when scrolling is active\n const [scrolled, setScrolled] = React.useState(false);\n\n // extract - infinite loading\n const loadingRef = React.useRef(false);\n\n const handleScroll = async (event: React.MouseEvent<HTMLDivElement>) => {\n if (event.currentTarget.scrollLeft > 0 && !scrolled) {\n setScrolled(true);\n } else if (event.currentTarget.scrollLeft === 0 && scrolled) {\n setScrolled(false);\n } else if (typeof loadMore === 'function') {\n const scrollY = event.currentTarget.scrollTop;\n const isScrollingDown = scrollY > prevScrollY.current;\n prevScrollY.current = scrollY;\n\n const scrolledPercentage = Math.round(\n (scrollY / (event.currentTarget.scrollHeight - event.currentTarget.clientHeight)) * 100\n );\n\n if (isScrollingDown && !loadingRef.current && scrolledPercentage >= 80) {\n try {\n const isAllRowsSelected = table.getIsAllRowsSelected();\n loadingRef.current = true;\n await loadMore();\n\n if (isAllRowsSelected) {\n table.toggleAllRowsSelected(true);\n }\n } catch (error) {\n console.error(error);\n } finally {\n loadingRef.current = false;\n }\n }\n }\n };\n\n let handleMouseLeave;\n\n if (meta.shouldPauseHoverState) {\n // sometimes the row's onMouseLeave doesn't trigger, this adds some extra redundancy\n handleMouseLeave = () => meta.setShouldPauseHoverState(false);\n }\n\n const className = cn(\n 'bg-white border border-grey-300 focus:yt-focus focus:border-blue-500 grid auto-rows-max overflow-auto relative rounded group',\n props.className\n );\n\n const enableSettingsButton = table.options.enableHiding || meta.enableColumnReordering;\n const hasInternalToolbar =\n enableSettingsButton ||\n meta.editMode.enableEditMode ||\n table.options.enableColumnFilters ||\n meta.enableRowDensity ||\n table.options.enableGlobalFilter;\n const hasToolbar = hasInternalToolbar || !!toolbarLeft || !toolbarRight;\n\n const frozenColumnIds = table.getLeftVisibleLeafColumns().map(c => c.id);\n\n return (\n <div className=\"-m-0.5 flex h-full w-[calc(100%_+_0.25rem)] flex-col gap-4 overflow-hidden p-0.5\">\n {hasToolbar ? (\n <div className=\"flex flex-wrap gap-2\">\n {toolbarLeft}\n {hasInternalToolbar ? (\n <Group className=\"ml-auto flex-shrink-0 print:hidden\">\n {meta.editMode.enableEditMode ? (\n <EditModeButton\n ref={editButtonRef}\n table={table}\n tableRef={tableRef}\n scrollToIndex={virtualiser.scrollToIndex}\n />\n ) : null}\n {table.options.enableColumnFilters ? <FiltersButton length={length} table={table} /> : null}\n {toolbarRight}\n {meta.enableRowDensity ? <RowDensityButton table={table} /> : null}\n {enableSettingsButton ? <ColumnSettingsButton table={table} /> : null}\n {table.options.enableGlobalFilter ? (\n <Search\n disabled={meta.shouldDisableTableActions}\n onSearch={table.setGlobalFilter}\n value={globalFilter}\n />\n ) : null}\n </Group>\n ) : null}\n {/*<ShortcutsGuideButton table={table} />*/}\n </div>\n ) : null}\n <div\n className={className}\n data-taco=\"table2\"\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n onMouseLeave={handleMouseLeave}\n onScroll={handleScroll}\n ref={tableRef}\n role=\"table\"\n style={{\n gridTemplateColumns,\n gridTemplateRows: rows.length ? undefined : '40px',\n // create a new stacking context so our internal z-indexes don't effect external components\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context\n opacity: 0.999,\n }}\n tabIndex={0}>\n <div className=\"contents\" data-taco=\"table2-header\" role=\"rowgroup\">\n {table.getHeaderGroups().map(headerGroup => (\n <div className=\"contents\" key={headerGroup.id} role=\"row\">\n {headerGroup.headers.map((header, columnIndex) => (\n <Header\n frozenColumnIds={frozenColumnIds}\n key={header.id}\n header={header}\n index={columnIndex}\n isLastColumn={columnIndex === headerGroup.headers.length - 1}\n scrolled={scrolled}\n table={table}\n tableRef={tableRef}\n />\n ))}\n </div>\n ))}\n </div>\n {rows.length ? (\n <div className=\"contents\" data-taco=\"table2-body\" role=\"rowgroup\">\n {virtualiserOffsets.top ? (\n <div style={{ height: virtualiserOffsets.top }} className=\"col-span-full\" />\n ) : null}\n {virtualiser.virtualItems.map(virtualRow => {\n const row = rows[virtualRow.index];\n\n return (\n <React.Fragment key={row.id}>\n <Row\n className=\"group/row contents\"\n onRowDrop={onRowDrop}\n row={row}\n rowIndex={virtualRow.index}\n table={table}>\n {row.getVisibleCells().map((cell, columnIndex) => (\n <Cell\n cell={cell}\n frozenColumnIds={frozenColumnIds}\n key={`${cell.id}_${cell.getValue()}`}\n index={columnIndex}\n isLastRow={virtualRow.index === rows.length - 1}\n rows={rows}\n rowIndex={virtualRow.index}\n scrolled={scrolled}\n scrollToIndex={virtualiser.scrollToIndex}\n scrollToOffset={virtualiser.scrollToOffset}\n table={table}\n tableRef={tableRef}\n />\n ))}\n </Row>\n {row.getIsExpanded() && expandedRowRenderer ? (\n <ExpandedRow index={virtualRow.index} setSize={setExpandedRowSizes}>\n {expandedRowRenderer(row.original)?.()}\n </ExpandedRow>\n ) : null}\n </React.Fragment>\n );\n })}\n {virtualiserOffsets.bottom ? (\n <div style={{ height: virtualiserOffsets.bottom }} className=\"col-span-full\" />\n ) : null}\n </div>\n ) : (\n <div className=\"col-span-full min-h-[theme(spacing.8)]\">{EmptyState ? <EmptyState /> : null}</div>\n )}\n <div className=\"contents\" data-taco=\"table2-footer\" role=\"rowgroup\">\n <div role=\"row\" className=\"contents\">\n {table.getFooterGroups().map(footerGroup =>\n footerGroup.headers.map((footer, cellIndex) => (\n <Footer\n key={footer.id}\n footer={footer}\n frozenColumnIds={frozenColumnIds}\n index={cellIndex}\n scrolled={scrolled}\n table={table}>\n {footers[footer.id]\n ? footers[footer.id](rows.map((row: TRow<TType>) => row.original[footer.id]))\n : null}\n </Footer>\n ))\n )}\n </div>\n <Summary length={length ?? rows.length} table={table} />\n </div>\n </div>\n {!!_experimentalActionsForTable &&\n table.options.enableRowSelection &&\n (table.getIsSomeRowsSelected() || table.getIsAllRowsSelected()) ? (\n <BatchActionsMenu<TType>\n className=\"fixed-center-x bottom-0 z-50 mb-4 print:hidden\"\n actionsForTable={_experimentalActionsForTable}\n summary={_experimentalActionsForTableSummary}\n table={table}\n />\n ) : null}\n </div>\n );\n}) as React.ForwardRefExoticComponent<Table2Props<any>> &\n (<TType>(props: Table2Props<TType> & { ref?: React.Ref<Table2Ref> }) => JSX.Element);\n\nconst Summary = ({ length, table }) => {\n const { texts } = useLocalization();\n\n const selectedLength = table.getIsAllRowsSelected() ? length : table.getSelectedRowModel().rows.length;\n const label = selectedLength > 0 ? texts.table2.footer.summary.selected : texts.table2.footer.summary.records;\n const total = selectedLength > 0 ? selectedLength : length;\n\n return (\n <div\n className={cn(\n 'sticky bottom-0 left-0 z-10 -mt-10 flex h-10 w-fit items-center whitespace-nowrap bg-white px-4 !pr-3 shadow-[6px_0px_6px_theme(colors.white)]'\n )}>\n {label}&nbsp;\n <strong>{total}</strong>\n </div>\n );\n};\n\nexport type ForwardedTable2WithStatics = React.ForwardRefExoticComponent<Table2Props<any>> & {\n Column: <TType>(props: Table2ColumnProps<TType>) => JSX.Element | null;\n} & (<TType>(props: Table2Props<TType> & { ref?: React.Ref<Table2Ref> }) => JSX.Element);\n\nconst Table2 = React.forwardRef(function Table2<TType = any>(props: Table2Props<TType>, ref: React.Ref<Table2Ref>) {\n const key = React.useMemo(() => String('tableKey_' + String(props.children)), [props.children]);\n return <BaseTable2 {...props} key={key} ref={ref} />;\n}) as ForwardedTable2WithStatics;\n\nTable2.Column = Column;\n\nexport { Table2 };\nexport type { Table2Props };\nexport type {\n Table2ColumnProps,\n Table2ActionProps,\n Table2RowActionRenderer,\n Table2Settings,\n Table2Filter,\n Table2FilterComparator,\n} from './types';\n"],"names":["Column","_","displayName","BaseTable2","React","forwardRef","props","ref","emptyState","EmptyState","expandedRowRenderer","length","data","loadMore","onRowClick","onRowDrop","toolbarLeft","toolbarRight","_experimentalActionsForTable","_experimentalActionsForTableSummary","tableRef","useMergedRef","timeoutIdRef","useRef","prevScrollY","rows","table","footers","useTable","children","meta","options","columnVisibility","columnOrder","globalFilter","getState","useEffect","current","instance","resetFiltering","resetColumnFilters","resetRowExpansion","resetExpanded","resetRowSelection","resetSorting","toggleEditing","editMode","resetFocussableColumnIndexes","isEditing","clearTimeout","virtualiser","virtualiserOffsets","setExpandedRowSizes","useVirtualiser","gridTemplateColumns","useGridTemplate","editButtonRef","handleKeyDown","event","document","activeElement","key","preventDefault","ctrlKey","metaKey","setActiveRowIndex","scrollToOffset","moveToPreviousRow","nextIndex","setShouldPauseHoverState","scrollToIndex","totalSize","moveToNextRow","_tableRef$current","scrollTo","scrollHeight","canToggleRowExpansion","enableExpanding","_rows$meta$activeRowI","activeRowIndex","toggleExpanded","_rows$meta$activeRowI2","original","enableRowSelection","_rows$meta$activeRowI3","toggleSelected","toggleAllRowsSelected","handleBlur","elementGainingFocus","relatedTarget","undefined","portalId","_elementGainingFocus","_elementGainingFocus$","closest","id","_event$currentTarget$","currentTarget","querySelector","_event$currentTarget","contains","setTimeout","parentRow","target","isNewFocussedElementInSameRow","shouldPauseSortingAndFiltering","setShouldPauseSortingAndFiltering","scrolled","setScrolled","useState","loadingRef","handleScroll","scrollLeft","_temp4","_temp3","scrollY","scrollTop","isScrollingDown","scrolledPercentage","Math","round","clientHeight","_temp2","_temp","_finallyRethrows","_catch","isAllRowsSelected","getIsAllRowsSelected","Promise","resolve","then","error","console","_wasThrown","_result","_temp5","e","reject","handleMouseLeave","shouldPauseHoverState","className","cn","enableSettingsButton","enableHiding","enableColumnReordering","hasInternalToolbar","enableEditMode","enableColumnFilters","enableRowDensity","enableGlobalFilter","hasToolbar","frozenColumnIds","getLeftVisibleLeafColumns","map","c","Group","EditModeButton","FiltersButton","RowDensityButton","ColumnSettingsButton","Search","disabled","shouldDisableTableActions","onSearch","setGlobalFilter","value","onBlur","onKeyDown","onMouseLeave","onScroll","role","style","gridTemplateRows","opacity","tabIndex","getHeaderGroups","headerGroup","headers","header","columnIndex","Header","index","isLastColumn","top","height","virtualItems","virtualRow","row","Fragment","Row","rowIndex","getVisibleCells","cell","Cell","getValue","isLastRow","getIsExpanded","ExpandedRow","setSize","_expandedRowRenderer","bottom","getFooterGroups","footerGroup","footer","cellIndex","Footer","Summary","getIsSomeRowsSelected","BatchActionsMenu","actionsForTable","summary","texts","useLocalization","selectedLength","getSelectedRowModel","label","table2","selected","records","total","Table2","useMemo","String"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqIA,SAASA,MAAMA,CAAcC,CAA2B;EACpD,OAAO,IAAI;AACf;AACAD,MAAM,CAACE,WAAW,GAAG,cAAc;AAYnC,MAAMC,UAAU,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,UAAUA,CAAcG,KAAyB,EAAEC,GAAyB;;EAErH,MAAM;IACFC,UAAU,EAAEC,UAAU;IACtBC,mBAAmB;IACnBC,MAAM,GAAGL,KAAK,CAACM,IAAI,CAACD,MAAM;IAC1BE,QAAQ;IACRC,UAAU;IACVC,SAAS;IACTC,WAAW;IACXC,YAAY;IACZC,4BAA4B;IAC5BC;GACH,GAAGb,KAAK;EACT,MAAMc,QAAQ,GAAGC,YAAY,CAAYd,GAAG,CAAC;EAC7C,MAAMe,YAAY,GAAGlB,cAAK,CAACmB,MAAM,EAAkB;EACnD,MAAMC,WAAW,GAAGpB,cAAK,CAACmB,MAAM,CAAS,CAAC,CAAC;;EAG3C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GA,MAAM,CAACxN,KAAK,CAACuB,QAAQ,CAAC,CAAC,EAAE,CAACvB,KAAK,CAACuB,QAAQ,CAAC,CAAC;EAC/F,oBAAOzB,6BAACD,UAAU,oBAAKG,KAAK;IAAEuD,GAAG,EAAEA,GAAG;IAAEtD,GAAG,EAAEA;KAAO;AACxD,CAAC;AAEDqN,MAAM,CAAC5N,MAAM,GAAGA,MAAM;;;;"}
@@ -1,83 +0,0 @@
1
- import React__default from 'react';
2
- import cn from 'classnames';
3
- import { Icon } from '../../Icon/Icon.js';
4
- import { Tooltip } from '../../Tooltip/Tooltip.js';
5
- import { getButtonClasses } from '../../Button/util.js';
6
- import { Menu } from '../../Menu/Menu.js';
7
- import { useBoundaryOverflowDetection } from '../../../hooks/useBoundaryOverflowDetection.js';
8
-
9
- const BUTTON_CLASSES = /*#__PURE__*/cn( /*#__PURE__*/getButtonClasses(), 'hover:bg-white/[0.08] disabled:opacity-50 disabled:cursor-not-allowed flex-shrink-0 rounded px-2');
10
- function unwrapActionProperty(property, rowsData) {
11
- return typeof property === 'function' ? property(rowsData) : property;
12
- }
13
- function createActionButton(actions, rowsData, onReset) {
14
- return actions.map((action, index) => {
15
- const button = /*#__PURE__*/React__default.createElement("button", {
16
- className: BUTTON_CLASSES,
17
- disabled: unwrapActionProperty(action.disabled, rowsData),
18
- onClick: action.onClick ? () => action.onClick ? action.onClick(rowsData, onReset) : undefined : undefined
19
- }, action.icon ? /*#__PURE__*/React__default.createElement(Icon, {
20
- name: unwrapActionProperty(action.icon, rowsData)
21
- }) : null, unwrapActionProperty(action.text, rowsData));
22
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
23
- key: index
24
- }, typeof action.dialog === 'function' ? action.dialog(rowsData, onReset)({
25
- trigger: button
26
- }) : button);
27
- });
28
- }
29
- function BatchActionsMenu({
30
- actionsForTable = [],
31
- summary,
32
- table,
33
- ...props
34
- }) {
35
- const className = cn('bg-blue-900 yt-shadow flex w-96 flex-col gap-2 divide-y divide-white/25 rounded p-2 text-white', props.className);
36
- const ref = React__default.useRef(null);
37
- const boundaryIndex = useBoundaryOverflowDetection(ref, actionsForTable);
38
- const rows = table.getSelectedRowModel().rows;
39
- const rowsData = rows.map(row => row.original);
40
- const handleReset = () => table.toggleAllRowsSelected(false);
41
- const isVisible = action => typeof action.visible !== 'undefined' ? typeof action.visible === 'function' ? action.visible(rowsData) : action.visible : true;
42
- const visibleActions = actionsForTable.filter(isVisible);
43
- let content;
44
- if (boundaryIndex !== undefined && boundaryIndex !== null && boundaryIndex < actionsForTable.length) {
45
- const actions = visibleActions.slice(0, boundaryIndex);
46
- const moreActions = visibleActions.slice(boundaryIndex);
47
- content = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, createActionButton(actions, rowsData, handleReset), moreActions.length ? /*#__PURE__*/React__default.createElement(Menu, null, /*#__PURE__*/React__default.createElement(Menu.Trigger, null, /*#__PURE__*/React__default.createElement("button", {
48
- className: cn(BUTTON_CLASSES, 'ml-auto w-8')
49
- }, /*#__PURE__*/React__default.createElement(Icon, {
50
- name: "more",
51
- className: "m-0 p-0"
52
- }))), /*#__PURE__*/React__default.createElement(Menu.Content, null, moreActions.map((action, index) => /*#__PURE__*/React__default.createElement(Menu.Item, {
53
- key: index,
54
- dialog: action.dialog ? action.dialog(rowsData, handleReset) : undefined,
55
- disabled: unwrapActionProperty(action.disabled, rowsData),
56
- icon: unwrapActionProperty(action.icon, rowsData),
57
- onClick: action.onClick ? () => action.onClick ? action.onClick(rowsData, handleReset) : undefined : undefined
58
- }, unwrapActionProperty(action.text, rowsData))))) : null);
59
- } else {
60
- content = createActionButton(visibleActions, rowsData, handleReset);
61
- }
62
- return /*#__PURE__*/React__default.createElement("div", Object.assign({}, props, {
63
- className: className,
64
- tabIndex: 0
65
- }), /*#__PURE__*/React__default.createElement("div", {
66
- className: "flex items-center justify-between gap-2 px-2"
67
- }, rows.length, " items selected ", summary ? ` - ${summary(rowsData)}` : undefined, /*#__PURE__*/React__default.createElement(Tooltip, {
68
- title: "Reset selected",
69
- placement: "top"
70
- }, /*#__PURE__*/React__default.createElement("button", {
71
- "aria-label": "Reset selected",
72
- className: "rounded hover:bg-white/[0.08]",
73
- onClick: handleReset
74
- }, /*#__PURE__*/React__default.createElement(Icon, {
75
- name: "close"
76
- })))), /*#__PURE__*/React__default.createElement("div", {
77
- className: "flex w-full gap-px overflow-hidden px-1 pt-2",
78
- ref: ref
79
- }, content));
80
- }
81
-
82
- export { BatchActionsMenu };
83
- //# sourceMappingURL=BatchActionsMenu.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BatchActionsMenu.js","sources":["../../../../../../../../src/components/Table2/components/BatchActionsMenu.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Table as RTTable } from '@tanstack/react-table';\nimport { Icon } from '../../Icon/Icon';\nimport { Table2ActionProps } from '../types';\nimport { getButtonClasses } from '../../Button/util';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { useBoundaryOverflowDetection } from '../../../hooks/useBoundaryOverflowDetection';\nimport { Menu } from '../../Menu/Menu';\n\ntype BatchActionsMenuProps<TType> = React.HTMLAttributes<HTMLDivElement> & {\n actionsForTable?: Table2ActionProps<TType>[];\n summary?: (rows: TType[]) => JSX.Element | string;\n table: RTTable<TType>;\n};\n\nconst BUTTON_CLASSES = cn(\n getButtonClasses(),\n 'hover:bg-white/[0.08] disabled:opacity-50 disabled:cursor-not-allowed flex-shrink-0 rounded px-2'\n);\n\nfunction unwrapActionProperty<TType = any>(property: unknown | ((rows: TType[]) => unknown), rowsData: TType[]) {\n return typeof property === 'function' ? property(rowsData) : property;\n}\n\nfunction createActionButton<TType = any>(actions: Table2ActionProps<TType>[], rowsData: TType[], onReset) {\n return actions.map((action, index) => {\n const button = (\n <button\n className={BUTTON_CLASSES}\n disabled={unwrapActionProperty(action.disabled, rowsData)}\n onClick={action.onClick ? () => (action.onClick ? action.onClick(rowsData, onReset) : undefined) : undefined}>\n {action.icon ? <Icon name={unwrapActionProperty(action.icon, rowsData)} /> : null}\n {unwrapActionProperty(action.text, rowsData)}\n </button>\n );\n\n return (\n <React.Fragment key={index}>\n {typeof action.dialog === 'function' ? action.dialog(rowsData, onReset)({ trigger: button }) : button}\n </React.Fragment>\n );\n });\n}\n\nexport function BatchActionsMenu<TType = any>({ actionsForTable = [], summary, table, ...props }: BatchActionsMenuProps<TType>) {\n const className = cn(\n 'bg-blue-900 yt-shadow flex w-96 flex-col gap-2 divide-y divide-white/25 rounded p-2 text-white',\n props.className\n );\n const ref = React.useRef<HTMLDivElement>(null);\n const boundaryIndex = useBoundaryOverflowDetection(ref, actionsForTable);\n const rows = table.getSelectedRowModel().rows;\n const rowsData = rows.map(row => row.original);\n\n const handleReset = () => table.toggleAllRowsSelected(false);\n const isVisible = (action: Table2ActionProps<TType>) =>\n typeof action.visible !== 'undefined'\n ? typeof action.visible === 'function'\n ? action.visible(rowsData)\n : action.visible\n : true;\n\n const visibleActions = actionsForTable.filter(isVisible);\n\n let content;\n\n if (boundaryIndex !== undefined && boundaryIndex !== null && boundaryIndex < actionsForTable.length) {\n const actions = visibleActions.slice(0, boundaryIndex);\n const moreActions = visibleActions.slice(boundaryIndex);\n\n content = (\n <>\n {createActionButton(actions, rowsData, handleReset)}\n {moreActions.length ? (\n <Menu>\n <Menu.Trigger>\n <button className={cn(BUTTON_CLASSES, 'ml-auto w-8')}>\n <Icon name=\"more\" className=\"m-0 p-0\" />\n </button>\n </Menu.Trigger>\n <Menu.Content>\n {moreActions.map((action, index) => (\n <Menu.Item\n key={index}\n dialog={action.dialog ? action.dialog(rowsData, handleReset) : undefined}\n disabled={unwrapActionProperty(action.disabled, rowsData)}\n icon={unwrapActionProperty(action.icon, rowsData)}\n onClick={\n action.onClick\n ? () => (action.onClick ? action.onClick(rowsData, handleReset) : undefined)\n : undefined\n }>\n {unwrapActionProperty(action.text, rowsData)}\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu>\n ) : null}\n </>\n );\n } else {\n content = createActionButton(visibleActions, rowsData, handleReset);\n }\n\n return (\n <div {...props} className={className} tabIndex={0}>\n <div className=\"flex items-center justify-between gap-2 px-2\">\n {rows.length} items selected {summary ? ` - ${summary(rowsData)}` : undefined}\n <Tooltip title=\"Reset selected\" placement=\"top\">\n <button aria-label=\"Reset selected\" className=\"rounded hover:bg-white/[0.08]\" onClick={handleReset}>\n <Icon name=\"close\" />\n </button>\n </Tooltip>\n </div>\n <div className=\"flex w-full gap-px overflow-hidden px-1 pt-2\" ref={ref}>\n {content}\n </div>\n </div>\n );\n}\n"],"names":["BUTTON_CLASSES","cn","getButtonClasses","unwrapActionProperty","property","rowsData","createActionButton","actions","onReset","map","action","index","button","React","className","disabled","onClick","undefined","icon","Icon","name","text","Fragment","key","dialog","trigger","BatchActionsMenu","actionsForTable","summary","table","props","ref","useRef","boundaryIndex","useBoundaryOverflowDetection","rows","getSelectedRowModel","row","original","handleReset","toggleAllRowsSelected","isVisible","visible","visibleActions","filter","content","length","slice","moreActions","Menu","Trigger","Content","Item","tabIndex","Tooltip","title","placement"],"mappings":";;;;;;;;AAgBA,MAAMA,cAAc,gBAAGC,EAAE,eACrBC,gBAAgB,EAAE,EAClB,kGAAkG,CACrG;AAED,SAASC,oBAAoBA,CAAcC,QAAgD,EAAEC,QAAiB;EAC1G,OAAO,OAAOD,QAAQ,KAAK,UAAU,GAAGA,QAAQ,CAACC,QAAQ,CAAC,GAAGD,QAAQ;AACzE;AAEA,SAASE,kBAAkBA,CAAcC,OAAmC,EAAEF,QAAiB,EAAEG,OAAO;EACpG,OAAOD,OAAO,CAACE,GAAG,CAAC,CAACC,MAAM,EAAEC,KAAK;IAC7B,MAAMC,MAAM,gBACRC;MACIC,SAAS,EAAEd,cAAc;MACzBe,QAAQ,EAAEZ,oBAAoB,CAACO,MAAM,CAACK,QAAQ,EAAEV,QAAQ,CAAC;MACzDW,OAAO,EAAEN,MAAM,CAACM,OAAO,GAAG,MAAON,MAAM,CAACM,OAAO,GAAGN,MAAM,CAACM,OA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AC1EA;OAETd,oBAAoB,CAACO,MAAM,CAACW,IAAI,EAAEhB,QAAQ,CAAC,CAEnD,CAAC,CACS,CACZ,GACP,IAAI,CAEf;GACJ,MAAM;IACHwC,OAAO,GAAGvC,kBAAkB,CAACqC,cAAc,EAAEtC,QAAQ,EAAEkC,WAAW,CAAC;;EAGvE,oBACI1B,sDAASiB,KAAK;IAAEhB,SAAS,EAAEA,SAAS;IAAEuC,QAAQ,EAAE;mBAC5CxC;IAAKC,SAAS,EAAC;KACVqB,IAAI,CAACW,MAAM,sBAAkBlB,OAAO,SAASA,OAAO,CAACvB,QAAQ,GAAG,GAAGY,SAAS,eAC7EJ,6BAACyC,OAAO;IAACC,KAAK,EAAC,gBAAgB;IAACC,SAAS,EAAC;kBACtC3C;kBAAmB,gBAAgB;IAACC,SAAS,EAAC,+BAA+B;IAACE,OAAO,EAAEuB;kBACnF1B,6BAACM,IAAI;IAACC,IAAI,EAAC;IAAU,CAChB,CACH,CACR,eACNP;IAAKC,SAAS,EAAC,8CAA8C;IAACiB,GAAG,EAAEA;KAC9Dc,OAAO,CACN,CACJ;AAEd;;;;"}
@@ -1,116 +0,0 @@
1
- import React__default from 'react';
2
- import cn from 'classnames';
3
- import { Icon } from '../../Icon/Icon.js';
4
- import { useLocalization } from '../../Provider/Localization.js';
5
- import { Button } from '../../Button/Button.js';
6
- import { Checkbox } from '../../Checkbox/Checkbox.js';
7
- import { Input } from '../../Input/Input.js';
8
- import { Popover } from '../../Popover/Popover.js';
9
- import { isInternalColumn, ensureOrdering } from '../utilities/columns.js';
10
- import { Container } from '../../../primitives/Sortable/components/Container.js';
11
- import { arrayMove } from '@dnd-kit/sortable';
12
- import { Item } from '../../../primitives/Sortable/components/Item.js';
13
- import { List } from '../../../primitives/Sortable/components/List.js';
14
- import { Truncate } from '../../Truncate/Truncate.js';
15
-
16
- function getColumnName(column) {
17
- var _ref, _column$columnDef$hea, _column$columnDef$hea2;
18
- return (_ref = (_column$columnDef$hea = (_column$columnDef$hea2 = column.columnDef.header) === null || _column$columnDef$hea2 === void 0 ? void 0 : _column$columnDef$hea2.toString()) !== null && _column$columnDef$hea !== void 0 ? _column$columnDef$hea : column.columnDef.id) !== null && _ref !== void 0 ? _ref : '';
19
- }
20
- const Column = /*#__PURE__*/React__default.forwardRef(function Column(props, ref) {
21
- const {
22
- column,
23
- draggable = false,
24
- isOrderingEnabled,
25
- ...dragAttributes
26
- } = props;
27
- const canHide = column.getCanHide();
28
- const className = cn('group/column flex items-center gap-x-2 rounded py-1 px-2', {
29
- 'hover:bg-grey-200': canHide || draggable,
30
- 'hover:cursor-pointer': canHide,
31
- 'active:cursor-move active:bg-grey-300': draggable
32
- });
33
- const attributes = draggable ? dragAttributes : undefined;
34
- const text = getColumnName(column);
35
- const isVisible = column.getIsVisible();
36
- return /*#__PURE__*/React__default.createElement("div", Object.assign({}, attributes, {
37
- key: column.id,
38
- className: className,
39
- onClick: () => column.toggleVisibility(!isVisible),
40
- ref: ref
41
- }), draggable ? /*#__PURE__*/React__default.createElement(Icon, {
42
- name: "drag",
43
- className: "text-grey-500 group-hover/column:text-grey-700 -mx-2 !h-5"
44
- }) : isOrderingEnabled ? /*#__PURE__*/React__default.createElement("span", {
45
- className: "flex w-2"
46
- }) : null, /*#__PURE__*/React__default.createElement(Truncate, {
47
- tooltip: text
48
- }, /*#__PURE__*/React__default.createElement("span", {
49
- className: "flex-grow select-none"
50
- }, text)), canHide ? /*#__PURE__*/React__default.createElement(Checkbox, {
51
- checked: isVisible,
52
- onChange: () => column.toggleVisibility(!isVisible)
53
- }) : null);
54
- });
55
- function ColumnSettingsButton(props) {
56
- const {
57
- table
58
- } = props;
59
- const {
60
- texts
61
- } = useLocalization();
62
- const [query, setQuery] = React__default.useState('');
63
- const allColumns = table.getAllLeafColumns();
64
- const tableMeta = table.options.meta;
65
- const columns = React__default.useMemo(() => allColumns.filter(column => !isInternalColumn(column.id)).filter(column => query !== null && query !== void 0 && query.length ? getColumnName(column).toLowerCase().includes(query.toLowerCase()) : true), [allColumns, query]);
66
- const listClassName = 'flex max-h-64 flex-col gap-y-px overflow-auto';
67
- const handleReorder = (activeId, overId) => {
68
- if (columns.find(column => {
69
- var _column$columnDef$met;
70
- return column.id === overId && ((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.disableReordering);
71
- })) {
72
- return;
73
- }
74
- table.setColumnOrder(currentOrder => ensureOrdering(allColumns, arrayMove(currentOrder, currentOrder.findIndex(c => c === activeId), currentOrder.findIndex(c => c === overId))));
75
- };
76
- const popover = popoverProps => /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps), /*#__PURE__*/React__default.createElement(Popover.Content, {
77
- align: "end"
78
- }, /*#__PURE__*/React__default.createElement("div", {
79
- className: "flex w-60 flex-col gap-2"
80
- }, table.options.enableHiding ? /*#__PURE__*/React__default.createElement(Input, {
81
- onChange: event => setQuery(event.target.value),
82
- placeholder: texts.table2.columnSettings.search,
83
- value: query
84
- }) : null, tableMeta.enableColumnReordering && columns.length && !(query !== null && query !== void 0 && query.length) ? /*#__PURE__*/React__default.createElement(Container, {
85
- reorder: handleReorder
86
- }, /*#__PURE__*/React__default.createElement(List, {
87
- id: "columns",
88
- className: listClassName
89
- }, columns.map(column => {
90
- var _column$columnDef$met2, _column$columnDef$met3;
91
- return /*#__PURE__*/React__default.createElement(Item, {
92
- key: column.id,
93
- id: column.id,
94
- disabled: (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.disableReordering,
95
- asChild: true
96
- }, /*#__PURE__*/React__default.createElement(Column, {
97
- column: column,
98
- draggable: !((_column$columnDef$met3 = column.columnDef.meta) !== null && _column$columnDef$met3 !== void 0 && _column$columnDef$met3.disableReordering),
99
- isOrderingEnabled: true
100
- }));
101
- }))) : /*#__PURE__*/React__default.createElement("div", {
102
- className: listClassName
103
- }, columns.length ? columns.map(column => /*#__PURE__*/React__default.createElement(Column, {
104
- column: column,
105
- key: column.id
106
- })) : texts.table2.columnSettings.noResults))));
107
- return /*#__PURE__*/React__default.createElement(Button, {
108
- popover: popover,
109
- tooltip: texts.table2.columnSettings.tooltip
110
- }, /*#__PURE__*/React__default.createElement(Icon, {
111
- name: "columns"
112
- }), " ", texts.table2.columnSettings.button);
113
- }
114
-
115
- export { ColumnSettingsButton };
116
- //# sourceMappingURL=ColumnSettingsButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ColumnSettingsButton.js","sources":["../../../../../../../../src/components/Table2/components/ColumnSettingsButton.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Table as RTable, Column as RTColumn, TableMeta } from '@tanstack/react-table';\nimport { Button } from '../../Button/Button';\nimport { useLocalization } from '../../Provider/Localization';\nimport { Checkbox } from '../../Checkbox/Checkbox';\nimport { Popover } from '../../Popover/Popover';\nimport { Input } from '../../Input/Input';\nimport * as SortablePrimitive from '../../../primitives/Sortable/Sortable';\nimport { Icon } from '../../Icon/Icon';\nimport { ensureOrdering, isInternalColumn } from '../utilities/columns';\nimport { Truncate } from '../../Truncate/Truncate';\n\ntype ColumnProps<TType = unknown> = React.HTMLAttributes<HTMLDivElement> & {\n column: RTColumn<TType, unknown>;\n draggable?: boolean;\n isOrderingEnabled?: boolean;\n};\n\nfunction getColumnName<TType = unknown>(column: RTColumn<TType, unknown>) {\n return column.columnDef.header?.toString() ?? column.columnDef.id ?? '';\n}\n\nconst Column = React.forwardRef(function Column<TType = unknown>(props: ColumnProps<TType>, ref: React.Ref<HTMLDivElement>) {\n const { column, draggable = false, isOrderingEnabled, ...dragAttributes } = props;\n const canHide = column.getCanHide();\n\n const className = cn('group/column flex items-center gap-x-2 rounded py-1 px-2', {\n 'hover:bg-grey-200': canHide || draggable,\n 'hover:cursor-pointer': canHide,\n 'active:cursor-move active:bg-grey-300': draggable,\n });\n\n const attributes = draggable ? dragAttributes : undefined;\n const text = getColumnName(column);\n const isVisible = column.getIsVisible();\n\n return (\n <div {...attributes} key={column.id} className={className} onClick={() => column.toggleVisibility(!isVisible)} ref={ref}>\n {draggable ? (\n <Icon name=\"drag\" className=\"text-grey-500 group-hover/column:text-grey-700 -mx-2 !h-5\" />\n ) : isOrderingEnabled ? (\n <span className=\"flex w-2\" />\n ) : null}\n <Truncate tooltip={text}>\n <span className=\"flex-grow select-none\">{text}</span>\n </Truncate>\n {canHide ? <Checkbox checked={isVisible} onChange={() => column.toggleVisibility(!isVisible)} /> : null}\n </div>\n );\n});\n\nexport type ColumnSettingsProps<TType = unknown> = {\n table: RTable<TType>;\n};\n\nexport function ColumnSettingsButton<TType = unknown>(props: ColumnSettingsProps<TType>) {\n const { table } = props;\n const { texts } = useLocalization();\n const [query, setQuery] = React.useState('');\n const allColumns = table.getAllLeafColumns();\n const tableMeta = table.options.meta as TableMeta<TType>;\n const columns = React.useMemo(\n () =>\n allColumns\n .filter(column => !isInternalColumn(column.id))\n .filter(column => (query?.length ? getColumnName(column).toLowerCase().includes(query.toLowerCase()) : true)),\n [allColumns, query]\n );\n\n const listClassName = 'flex max-h-64 flex-col gap-y-px overflow-auto';\n\n const handleReorder = (activeId, overId) => {\n if (columns.find(column => column.id === overId && column.columnDef.meta?.disableReordering)) {\n return;\n }\n\n table.setColumnOrder(currentOrder =>\n ensureOrdering(\n allColumns,\n SortablePrimitive.arrayMove(\n currentOrder,\n currentOrder.findIndex(c => c === activeId),\n currentOrder.findIndex(c => c === overId)\n )\n )\n );\n };\n\n const popover = popoverProps => (\n <Popover {...popoverProps}>\n <Popover.Content align=\"end\">\n <div className=\"flex w-60 flex-col gap-2\">\n {table.options.enableHiding ? (\n <Input\n onChange={event => setQuery(event.target.value)}\n placeholder={texts.table2.columnSettings.search}\n value={query}\n />\n ) : null}\n {tableMeta.enableColumnReordering && columns.length && !query?.length ? (\n <SortablePrimitive.Container reorder={handleReorder}>\n <SortablePrimitive.List id=\"columns\" className={listClassName}>\n {columns.map(column => (\n <SortablePrimitive.Item\n key={column.id}\n id={column.id}\n disabled={column.columnDef.meta?.disableReordering}\n asChild>\n <Column\n column={column as any}\n draggable={!column.columnDef.meta?.disableReordering}\n isOrderingEnabled\n />\n </SortablePrimitive.Item>\n ))}\n </SortablePrimitive.List>\n </SortablePrimitive.Container>\n ) : (\n <div className={listClassName}>\n {columns.length\n ? columns.map(column => <Column column={column as any} key={column.id} />)\n : texts.table2.columnSettings.noResults}\n </div>\n )}\n </div>\n </Popover.Content>\n </Popover>\n );\n\n return (\n <Button popover={popover} tooltip={texts.table2.columnSettings.tooltip}>\n <Icon name=\"columns\" /> {texts.table2.columnSettings.button}\n </Button>\n );\n}\n"],"names":["getColumnName","column","_ref","_column$columnDef$hea","_column$columnDef$hea2","columnDef","header","toString","id","Column","React","forwardRef","props","ref","draggable","isOrderingEnabled","dragAttributes","canHide","getCanHide","className","cn","attributes","undefined","text","isVisible","getIsVisible","key","onClick","toggleVisibility","Icon","name","Truncate","tooltip","Checkbox","checked","onChange","ColumnSettingsButton","table","texts","useLocalization","query","setQuery","useState","allColumns","getAllLeafColumns","tableMeta","options","meta","columns","useMemo","filter","isInternalColumn","length","toLowerCase","includes","listClassName","handleReorder","activeId","overId","find","_column$columnDef$met","disableReordering","setColumnOrder","currentOrder","ensureOrdering","SortablePrimitive","findIndex","c","popover","popoverProps","Popover","Content","align","enableHiding","Input","event","target","value","placeholder","table2","columnSettings","search","enableColumnReordering","reorder","map","_column$columnDef$met2","_column$columnDef$met3","disabled","asChild","noResults","Button","button"],"mappings":";;;;;;;;;;;;;;;AAmBA,SAASA,aAAaA,CAAkBC,MAAgC;;EACpE,QAAAC,IAAA,IAAAC,qBAAA,IAAAC,sBAAA,GAAOH,MAAM,CAACI,SAAS,CAACC,MAAM,cAAAF,sBAAA,uBAAvBA,sBAAA,CAAyBG,QAAQ,EAAE,cAAAJ,qBAAA,cAAAA,qBAAA,GAAIF,MAAM,CAACI,SAAS,CAACG,EAAE,cAAAN,IAAA,cAAAA,IAAA,GAAI,EAAE;AAC3E;AAEA,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KACXP,OAAO,CAACI,MAAM,GACTJ,OAAO,CAACoC,GAAG,CAACnF,MAAM,iBAAIS,6BAACD,MAAM;IAACR,MAAM,EAAEA,MAAa;IAAEyB,GAAG,EAAEzB,MAAM,CAACO;IAAM,CAAC,GACxE8B,KAAK,CAACyC,MAAM,CAACC,cAAc,CAACS,SAAS,CAElD,CACC,CACQ,CAEzB;EAED,oBACI/E,6BAACgF,MAAM;IAACtB,OAAO,EAAEA,OAAO;IAAEpC,OAAO,EAAEM,KAAK,CAACyC,MAAM,CAACC,cAAc,CAAChD;kBAC3DtB,6BAACmB,IAAI;IAACC,IAAI,EAAC;IAAY,OAAEQ,KAAK,CAACyC,MAAM,CAACC,cAAc,CAACW,MAAM,CACtD;AAEjB;;;;"}
@@ -1,81 +0,0 @@
1
- import React__default from 'react';
2
- import cn from 'classnames';
3
- import { Icon } from '../../Icon/Icon.js';
4
- import { useMergedRef } from '../../../hooks/useMergedRef.js';
5
- import { useGlobalKeyDown } from '../../../hooks/useGlobalKeyDown.js';
6
- import { useLocalization } from '../../Provider/Localization.js';
7
- import { Button } from '../../Button/Button.js';
8
- import { Shortcut } from '../../Shortcut/Shortcut.js';
9
-
10
- const EditModeButton = /*#__PURE__*/React__default.forwardRef(function EditModeButton(props, ref) {
11
- const {
12
- scrollToIndex,
13
- table,
14
- tableRef
15
- } = props;
16
- const {
17
- texts
18
- } = useLocalization();
19
- const internalRef = useMergedRef(ref);
20
- const meta = table.options.meta;
21
- const {
22
- isEditing
23
- } = meta.editMode;
24
- const showWarning = React__default.useCallback(event => {
25
- if (isEditing) {
26
- event.returnValue = true;
27
- return true;
28
- }
29
- return false;
30
- }, [isEditing]);
31
- useGlobalKeyDown({
32
- key: 'e',
33
- meta: true
34
- }, event => {
35
- var _internalRef$current;
36
- event.preventDefault();
37
- (_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.click();
38
- });
39
- React__default.useEffect(() => {
40
- window.addEventListener('beforeunload', showWarning);
41
- return () => {
42
- window.removeEventListener('beforeunload', showWarning);
43
- };
44
- }, [showWarning]);
45
- const handleClick = () => {
46
- var _tableRef$current;
47
- meta.editMode.toggleEditing();
48
- (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.focus();
49
- scrollToIndex(meta.activeRowIndex + 1);
50
- };
51
- const hasVisibleEditableColumns = React__default.useMemo(() => {
52
- const hasColumns = table.getVisibleFlatColumns().some(column => {
53
- var _column$columnDef$met;
54
- return ((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.control) !== undefined;
55
- });
56
- if (!hasColumns && isEditing) {
57
- handleClick();
58
- }
59
- return hasColumns;
60
- }, [table.getState().columnVisibility]);
61
- return /*#__PURE__*/React__default.createElement(Button, {
62
- onClick: handleClick,
63
- className: cn({
64
- '!wcag-blue-100': meta.editMode.isEditing
65
- }),
66
- disabled: !hasVisibleEditableColumns,
67
- ref: internalRef,
68
- tooltip: hasVisibleEditableColumns ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table2.editing.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
69
- className: "ml-2",
70
- keys: {
71
- key: 'e',
72
- meta: true
73
- }
74
- })) : texts.table2.editing.tooltipDisabled
75
- }, /*#__PURE__*/React__default.createElement(Icon, {
76
- name: "edit"
77
- }), texts.table2.editing.button);
78
- });
79
-
80
- export { EditModeButton };
81
- //# sourceMappingURL=EditModeButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditModeButton.js","sources":["../../../../../../../../src/components/Table2/components/EditModeButton.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { Table as RTTable, TableMeta } from '@tanstack/react-table';\nimport { Button } from '../../Button/Button';\nimport { Icon } from '../../Icon/Icon';\nimport { Shortcut } from '../../Shortcut/Shortcut';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { useGlobalKeyDown } from '../../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../../Provider/Localization';\n\nexport type EditModeButtonProps = {\n scrollToIndex: (index: number) => void;\n table: RTTable<any>;\n tableRef: React.RefObject<HTMLDivElement>;\n};\n\nexport const EditModeButton = React.forwardRef<HTMLButtonElement, EditModeButtonProps>(function EditModeButton(props, ref) {\n const { scrollToIndex, table, tableRef } = props;\n const { texts } = useLocalization();\n const internalRef = useMergedRef<HTMLButtonElement>(ref);\n const meta = table.options.meta as TableMeta<any>;\n const { isEditing } = meta.editMode;\n\n const showWarning = React.useCallback(\n event => {\n if (isEditing) {\n event.returnValue = true;\n return true;\n }\n\n return false;\n },\n [isEditing]\n );\n\n useGlobalKeyDown({ key: 'e', meta: true }, (event: KeyboardEvent) => {\n event.preventDefault();\n internalRef.current?.click();\n });\n\n React.useEffect(() => {\n window.addEventListener('beforeunload', showWarning);\n\n return () => {\n window.removeEventListener('beforeunload', showWarning);\n };\n }, [showWarning]);\n\n const handleClick = () => {\n meta.editMode.toggleEditing();\n tableRef.current?.focus();\n scrollToIndex(meta.activeRowIndex + 1);\n };\n\n const hasVisibleEditableColumns = React.useMemo(() => {\n const hasColumns = table.getVisibleFlatColumns().some(column => column.columnDef.meta?.control !== undefined);\n\n if (!hasColumns && isEditing) {\n handleClick();\n }\n\n return hasColumns;\n }, [table.getState().columnVisibility]);\n\n return (\n <Button\n onClick={handleClick}\n className={cn({\n '!wcag-blue-100': meta.editMode.isEditing,\n })}\n disabled={!hasVisibleEditableColumns}\n ref={internalRef}\n tooltip={\n hasVisibleEditableColumns ? (\n <>\n {texts.table2.editing.tooltip}\n <Shortcut className=\"ml-2\" keys={{ key: 'e', meta: true }} />\n </>\n ) : (\n texts.table2.editing.tooltipDisabled\n )\n }>\n <Icon name=\"edit\" />\n {texts.table2.editing.button}\n </Button>\n );\n});\n"],"names":["EditModeButton","React","forwardRef","props","ref","scrollToIndex","table","tableRef","texts","useLocalization","internalRef","useMergedRef","meta","options","isEditing","editMode","showWarning","useCallback","event","returnValue","useGlobalKeyDown","key","preventDefault","_internalRef$current","current","click","useEffect","window","addEventListener","removeEventListener","handleClick","toggleEditing","_tableRef$current","focus","activeRowIndex","hasVisibleEditableColumns","useMemo","hasColumns","getVisibleFlatColumns","some","column","_column$columnDef$met","columnDef","control","undefined","getState","columnVisibility","Button","onClick","className","cn","disabled","tooltip","table2","editing","Shortcut","keys","tooltipDisabled","Icon","name","button"],"mappings":";;;;;;;;;MAgBaA,cAAc,gBAAGC,cAAK,CAACC,UAAU,CAAyC,SAASF,cAAcA,CAACG,KAAK,EAAEC,GAAG;EACrH,MAAM;IAAEC,aAAa;IAAEC,KAAK;IAAEC;GAAU,GAAGJ,KAAK;EAChD,MAAM;IAAEK;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAMC,WAAW,GAAGC,YAAY,CAAoBP,GAAG,CAAC;EACxD,MAAMQ,IAAI,GAAGN,KAAK,CAACO,OAAO,CAACD,IAAsB;EACjD,MAAM;IAAEE;GAAW,GAAGF,IAAI,CAACG,QAAQ;EAEnC,MAAMC,WAAW,GAAGf,cAAK,CAACgB,WAAW,CACjCC,KAAK;IACD,IAAIJ,SAAS,EAAE;MACXI,KAAK,CAACC,WAAW,GAAG,IAAI;MACxB,OAAO,IAAI;;IAGf,OAAO,KAAK;GACf,EACD,CAACL,SAAS,CAAC,CACd;EAEDM,gBAAgB,CAAC;IAAEC,GAAG,EAAE,GAAG;IAAET,IAAI,EAAE;GAAM,EAAGM,KAAoB;;IAC5DA,KAAK,CAACI,cAAc,EAAE;IACtB,CAAAC,oBAAA,GAAAb,WAAW,CAACc,OAAO,cAAAD,oBAAA,uBAAnBA,oBAAA,CAAqBE,KAAK,EAAE;GAC/B,CAAC;EAEFxB,cAAK,CAACyB,SAAS,CAAC;IACZC,MAAM,CAACC,gBAAgB,CAAC,cAAc,EAAEZ,WAAW,CAAC;IAEpD,OAAO;MACHW,MAAM,CAACE,mBAAmB,CAAC,cAAc,EAAEb,WAAW,CAAC;KAC1D;GACJ,EAAE,CAACA,W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AS,EACnBnD,KAAK,CAAC6C,MAAM,CAACC,OAAO,CAACM,MAAM,CACvB;AAEjB,CAAC;;;;"}
@@ -1,47 +0,0 @@
1
- import React__default from 'react';
2
- import { IconButton } from '../../IconButton/IconButton.js';
3
- import { useLocalization } from '../../Provider/Localization.js';
4
- import { Menu } from '../../Menu/Menu.js';
5
-
6
- const convertDensityToHeightIcon = density => {
7
- switch (density) {
8
- case 'compact':
9
- return 'short';
10
- case 'normal':
11
- return 'medium';
12
- case 'comfortable':
13
- return 'tall';
14
- case 'spacious':
15
- return 'extra-tall';
16
- }
17
- };
18
- const RowDensityButton = ({
19
- table
20
- }) => {
21
- const {
22
- texts
23
- } = useLocalization();
24
- const meta = table.options.meta;
25
- return /*#__PURE__*/React__default.createElement(IconButton, {
26
- "aria-label": texts.table2.rowDensity.tooltip,
27
- icon: `height-${convertDensityToHeightIcon(meta.rowDensity)}`,
28
- menu: menuProps => /*#__PURE__*/React__default.createElement(Menu, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu.Content, {
29
- align: "end"
30
- }, /*#__PURE__*/React__default.createElement(Menu.RadioGroup, {
31
- onChange: rowDensity => meta.setRowDensity(rowDensity),
32
- value: meta.rowDensity
33
- }, /*#__PURE__*/React__default.createElement(Menu.RadioGroup.Item, {
34
- value: "compact"
35
- }, texts.table2.rowDensity.compact), /*#__PURE__*/React__default.createElement(Menu.RadioGroup.Item, {
36
- value: "normal"
37
- }, texts.table2.rowDensity.normal), /*#__PURE__*/React__default.createElement(Menu.RadioGroup.Item, {
38
- value: "comfortable"
39
- }, texts.table2.rowDensity.comfortable), /*#__PURE__*/React__default.createElement(Menu.RadioGroup.Item, {
40
- value: "spacious"
41
- }, texts.table2.rowDensity.spacious)))),
42
- tooltip: texts.table2.rowDensity.tooltip
43
- });
44
- };
45
-
46
- export { RowDensityButton };
47
- //# sourceMappingURL=RowDensityButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RowDensityButton.js","sources":["../../../../../../../../src/components/Table2/components/RowDensityButton.tsx"],"sourcesContent":["import React from 'react';\nimport { Table as RTTable, TableMeta } from '@tanstack/react-table';\nimport { IconName } from '../../Icon/Icon';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { Menu } from '../../Menu/Menu';\nimport { RowDensity } from '../types';\nimport { useLocalization } from '../../Provider/Localization';\n\nconst convertDensityToHeightIcon = (density: RowDensity) => {\n switch (density) {\n case 'compact':\n return 'short';\n case 'normal':\n return 'medium';\n case 'comfortable':\n return 'tall';\n case 'spacious':\n return 'extra-tall';\n }\n};\n\ntype RowDensityButtonProps = {\n table: RTTable<any>;\n};\n\nexport const RowDensityButton = ({ table }: RowDensityButtonProps) => {\n const { texts } = useLocalization();\n const meta = table.options.meta as TableMeta<any>;\n\n return (\n <IconButton\n aria-label={texts.table2.rowDensity.tooltip}\n icon={`height-${convertDensityToHeightIcon(meta.rowDensity)}` as IconName}\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content align=\"end\">\n <Menu.RadioGroup\n onChange={rowDensity => meta.setRowDensity(rowDensity as RowDensity)}\n value={meta.rowDensity}>\n <Menu.RadioGroup.Item value=\"compact\">{texts.table2.rowDensity.compact}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item value=\"normal\">{texts.table2.rowDensity.normal}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item value=\"comfortable\">{texts.table2.rowDensity.comfortable}</Menu.RadioGroup.Item>\n <Menu.RadioGroup.Item value=\"spacious\">{texts.table2.rowDensity.spacious}</Menu.RadioGroup.Item>\n </Menu.RadioGroup>\n </Menu.Content>\n </Menu>\n )}\n tooltip={texts.table2.rowDensity.tooltip}\n />\n );\n};\n"],"names":["convertDensityToHeightIcon","density","RowDensityButton","table","texts","useLocalization","meta","options","React","IconButton","table2","rowDensity","tooltip","icon","menu","menuProps","Menu","Content","align","RadioGroup","onChange","setRowDensity","value","Item","compact","normal","comfortable","spacious"],"mappings":";;;;;AAQA,MAAMA,0BAA0B,GAAIC,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Df,OAAO,EAAER,KAAK,CAACM,MAAM,CAACC,UAAU,CAACC;IACnC;AAEV;;;;"}
@@ -1,62 +0,0 @@
1
- import React__default from 'react';
2
- import cn from 'classnames';
3
- import { useGlobalKeyDown } from '../../../hooks/useGlobalKeyDown.js';
4
- import { useLocalization } from '../../Provider/Localization.js';
5
- import { SearchInput } from '../../SearchInput/SearchInput.js';
6
-
7
- const Search = props => {
8
- const {
9
- value,
10
- ...attributes
11
- } = props;
12
- const {
13
- texts
14
- } = useLocalization();
15
- const ref = React__default.useRef(null);
16
- const handleKeyDown = event => {
17
- if (event.key === 'Escape') {
18
- var _props$onSearch;
19
- (_props$onSearch = props.onSearch) === null || _props$onSearch === void 0 ? void 0 : _props$onSearch.call(props, '');
20
- }
21
- };
22
- // gets called when the "clear" button is clicked
23
- const handleInput = event => {
24
- if (props.onInput) {
25
- props.onInput(event);
26
- }
27
- if (!event.isDefaultPrevented() && !event.currentTarget.value) {
28
- var _props$onSearch2;
29
- (_props$onSearch2 = props.onSearch) === null || _props$onSearch2 === void 0 ? void 0 : _props$onSearch2.call(props, '');
30
- }
31
- };
32
- const handleBlur = event => {
33
- var _props$onSearch3;
34
- const value = event.target.value;
35
- (_props$onSearch3 = props.onSearch) === null || _props$onSearch3 === void 0 ? void 0 : _props$onSearch3.call(props, value);
36
- };
37
- useGlobalKeyDown({
38
- key: 'f',
39
- meta: true,
40
- shift: false
41
- }, event => {
42
- if (document.activeElement !== ref.current) {
43
- var _ref$current;
44
- event.preventDefault();
45
- (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
46
- }
47
- });
48
- const className = cn('w-48', {
49
- '!wcag-blue-100': !!value
50
- });
51
- return /*#__PURE__*/React__default.createElement(SearchInput, Object.assign({}, attributes, {
52
- className: className,
53
- onBlur: handleBlur,
54
- onInput: handleInput,
55
- onKeyDown: handleKeyDown,
56
- placeholder: texts.table2.search.placeholder,
57
- ref: ref
58
- }));
59
- };
60
-
61
- export { Search };
62
- //# sourceMappingURL=Search.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Search.js","sources":["../../../../../../../../src/components/Table2/components/Search.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { SearchInput, SearchInputProps } from '../../SearchInput/SearchInput';\nimport { useGlobalKeyDown } from '../../../hooks/useGlobalKeyDown';\nimport { useLocalization } from '../../Provider/Localization';\n\nexport const Search = (props: SearchInputProps) => {\n const { value, ...attributes } = props;\n const { texts } = useLocalization();\n const ref = React.useRef<HTMLInputElement>(null);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Escape') {\n props.onSearch?.('');\n }\n };\n\n // gets called when the \"clear\" button is clicked\n const handleInput = (event: React.FormEvent<HTMLInputElement>) => {\n if (props.onInput) {\n props.onInput(event);\n }\n\n if (!event.isDefaultPrevented() && !event.currentTarget.value) {\n props.onSearch?.('');\n }\n };\n\n const handleBlur = event => {\n const value = event.target.value;\n props.onSearch?.(value);\n };\n\n useGlobalKeyDown({ key: 'f', meta: true, shift: false }, (event: KeyboardEvent) => {\n if (document.activeElement !== ref.current) {\n event.preventDefault();\n ref.current?.focus();\n }\n });\n\n const className = cn('w-48', {\n '!wcag-blue-100': !!value,\n });\n\n return (\n <SearchInput\n {...attributes}\n className={className}\n onBlur={handleBlur}\n onInput={handleInput}\n onKeyDown={handleKeyDown}\n placeholder={texts.table2.search.placeholder}\n ref={ref}\n />\n );\n};\n"],"names":["Search","props","value","attributes","texts","useLocalization","ref","React","useRef","handleKeyDown","event","key","_props$onSearch","onSearch","call","handleInput","onInput","isDefaultPrevented","currentTarget","_props$onSearch2","handleBlur","target","_props$onSearch3","useGlobalKeyDown","meta","shift","document","activeElement","current","_ref$current","preventDefault","focus","className","cn","SearchInput","onBlur","onKeyDown","placeholder","table2","search"],"mappings":";;;;;;MAMaA,MAAM,GAAIC,KAAuB;EAC1C,MAAM;IAAEC,KAAK;IAAE,GAAGC;GAAY,GAAGF,KAAK;E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YAAA,CAAaE,KAAK,EAAE;;GAE3B,CAAC;EAEF,MAAMC,SAAS,GAAGC,EAAE,CAAC,MAAM,EAAE;IACzB,gBAAgB,EAAE,CAAC,CAAC/B;GACvB,CAAC;EAEF,oBACIK,6BAAC2B,WAAW,oBACJ/B,UAAU;IACd6B,SAAS,EAAEA,SAAS;IACpBG,MAAM,EAAEf,UAAU;IAClBJ,OAAO,EAAED,WAAW;IACpBqB,SAAS,EAAE3B,aAAa;IACxB4B,WAAW,EAAEjC,KAAK,CAACkC,MAAM,CAACC,MAAM,CAACF,WAAW;IAC5C/B,GAAG,EAAEA;KACP;AAEV;;;;"}
@@ -1,32 +0,0 @@
1
- import React__default from 'react';
2
- import cn from 'classnames';
3
- import { getCellAlignmentClasses, getFrozenShadowClasses } from '../../utilities/cell.js';
4
-
5
- const ColumnBase = /*#__PURE__*/React__default.forwardRef(function Table2ColumnBase(props, ref) {
6
- var _column$columnDef$met;
7
- const {
8
- column,
9
- frozenColumnIds,
10
- scrolled,
11
- style,
12
- table,
13
- ...attributes
14
- } = props;
15
- const isFrozenColumn = !!column.getIsPinned();
16
- const meta = table.options.meta;
17
- const left = meta.columnOffsets[column.id];
18
- const className = cn('border-grey-300', getCellAlignmentClasses((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.align), getFrozenShadowClasses(column, frozenColumnIds, scrolled), {
19
- 'cursor-pointer': !!attributes.onClick
20
- }, attributes.className);
21
- return /*#__PURE__*/React__default.createElement("div", Object.assign({}, attributes, {
22
- className: className,
23
- style: {
24
- ...style,
25
- left: isFrozenColumn && Number.isInteger(left) ? left : undefined
26
- },
27
- ref: ref
28
- }));
29
- });
30
-
31
- export { ColumnBase };
32
- //# sourceMappingURL=Base.js.map