@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":"types.js","sources":["../../../../../../../src/components/Table2/types.ts"],"sourcesContent":["import React from 'react';\nimport {\n BuiltInSortingFn,\n ColumnFiltersState,\n ColumnOrderState,\n ColumnSizingState,\n OnChangeFn,\n Row,\n SortingState,\n VisibilityState,\n} from '@tanstack/react-table';\nimport { DialogProps } from '../Dialog/Dialog';\nimport { IconName } from '../Icon/Icon';\nimport { MenuProps } from '../Menu/Menu';\n\nexport enum Table2FilterComparator {\n Contains,\n DoesNotContain,\n IsEqualTo,\n IsNotEqualTo,\n IsGreaterThan,\n IsLessThan,\n IsBetween,\n IsOneOf,\n IsNoneOf,\n IsAllOf,\n IsEmpty,\n IsNotEmpty,\n}\n\nexport type Table2Filter<TType = any> = {\n comparator?: Table2FilterComparator;\n value: TType | TType[];\n};\n\nexport type ColumnOffsetState = Record<string, number | undefined>;\nexport type RowDensity = 'compact' | 'normal' | 'comfortable' | 'spacious';\nexport type CellAlignment = 'left' | 'center' | 'right';\n\nexport type SortDirection = 'asc' | 'desc';\nexport type ColumnDataType = 'auto' | 'alphanumeric' | 'alphanumericCaseSensitive' | 'datetime' | 'boolean';\n\nexport type Table2ColumnHeaderRenderer<TType = any> = (value: any, row: TType) => JSX.Element | string | null;\nexport type Table2ColumnHeaderMenu = (props: Partial<MenuProps>) => JSX.Element;\nexport type Table2ColumnFooterRenderer = (values: any[]) => JSX.Element | string | null;\n\nexport type Table2ColumnControlProps = {\n className?: string;\n disabled?: boolean;\n invalid?: boolean;\n onBlur: ((newValue?: any) => void) | ((newValue?: any) => Promise<void>);\n onFocus: React.FocusEventHandler;\n readOnly?: boolean;\n ref: React.RefObject<HTMLElement>;\n setValue: (value: any) => void;\n value: any;\n // This is a temporary fix to enable up/down arrow key shortcuts on input in quick mode. For some reason,\n // the preventDefault is true on Taco Input, so the keyboard shortcuts doesn't work. By adding this\n // data attribute we make sure the event is coming from a control component, and then we can make sure\n // keyboard shortcut works as expected.\n 'data-inline-editing-component'?: 'true';\n};\nexport type Table2ColumnControlRenderer<TType = any> =\n | ((props: Table2ColumnControlProps, row?: TType) => JSX.Element)\n | 'datepicker'\n | 'input'\n | 'switch';\n\nexport type SortFn<TType = unknown> = ((rowA: TType, rowB: TType, columnId: string) => -1 | 0 | 1) | BuiltInSortingFn | 'auto';\n\nexport type Table2ColumnProps<TType = any> = {\n accessor: string;\n align?: CellAlignment;\n className?: string | ((row: Row<TType>) => string);\n control?: Table2ColumnControlRenderer<TType>;\n dataType?: ColumnDataType;\n defaultActiveColumnIndex?: number;\n defaultActiveRowIndex?: number;\n defaultHidden?: boolean;\n disableFiltering?: boolean;\n disableHiding?: boolean;\n disableReordering?: boolean;\n disableResizing?: boolean;\n disableSorting?: boolean;\n defaultWidth?: number | 'grow';\n header: string;\n headerClassName?: string;\n footer?: Table2ColumnFooterRenderer;\n renderer?: Table2ColumnHeaderRenderer<TType>;\n menu?: Table2ColumnHeaderMenu;\n minWidth?: number;\n sort?: SortDirection;\n sortFn?: SortFn<TType>;\n tooltip?: string;\n};\n\nexport type Table2ActionProps<TType> = {\n dialog?: (rows: TType[], resetSelectedRows: () => void) => (props: Partial<DialogProps>) => JSX.Element;\n disabled?: boolean | ((rows: TType[]) => boolean);\n icon: IconName | ((rows: TType[]) => IconName);\n onClick?: (rows: TType[], resetSelectedRows: () => void) => void;\n text: string | ((rows: TType[]) => string);\n visible?: boolean | ((rows: TType[]) => boolean);\n};\n\nexport type Table2RowActionRenderer<TType = unknown> = (row: TType) => JSX.Element | null;\n\nexport type Table2Settings = {\n columnFilters?: ColumnFiltersState;\n columnOrder?: ColumnOrderState;\n columnSizing?: ColumnSizingState;\n columnVisibility?: VisibilityState;\n frozenColumnCount?: number;\n globalFilter?: string;\n rowDensity?: RowDensity;\n sorting?: SortingState;\n};\n\nexport type RowClickHandler<TType = any> = (row: TType) => void;\nexport type RowDragHandler<TType = any> = (\n rows: TType[],\n showPlaceholder: (string) => void,\n setDataTransfer: (data: string) => void\n) => void;\nexport type RowDropHandler<TType = any> = (event: React.DragEvent, row: TType) => void;\nexport type RowSelectionHandler<TType = any> = (rows: TType[], allSelected: boolean) => void;\nexport type RowExpansionRenderer<TType = any> = (row: TType) => (() => JSX.Element) | null;\nexport type SortHandler = OnChangeFn<SortingState>;\nexport type SettingsHandler = OnChangeFn<Table2Settings>;\nexport type SaveHandlerErrorResponse = Record<string, string | undefined | null> | null;\nexport type SaveHandler<TType = any> = (row: TType, accessor: string) => Promise<SaveHandlerErrorResponse | void>;\n\nexport type DataColumnIndexes = {\n dataColumnStartOffset: number;\n dataColumnEndOffset: number;\n};\n\nexport type Table2Children<TType = any> = (React.ReactElement<Table2ColumnProps<TType>> | boolean | null | undefined)[];\n\nexport type Table2ShortcutHandlerFn<TType = any> = (row: TType) => void;\nexport type Table2ShortcutHandlerObject<TType = any> = {\n handler: Table2ShortcutHandlerFn<TType>;\n meta?: boolean;\n shift?: boolean;\n};\nexport type Table2Shortcuts<TType = any> = Record<string, Table2ShortcutHandlerFn<TType> | Table2ShortcutHandlerObject<TType>>;\n\nexport type Table2Props<TType = any> = Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> & {\n actionsForRow?: Table2RowActionRenderer<TType>[];\n actionsForRowLength?: number;\n children: Table2Children;\n className?: string;\n data: TType[];\n defaultActiveRowIndex?: number;\n disableColumnFiltering?: boolean;\n disableColumnHiding?: boolean;\n disableColumnFreezing?: boolean;\n disableColumnReordering?: boolean;\n disableColumnResizing?: boolean;\n disableRowDensity?: boolean;\n disableRowExpansion?: boolean;\n disableRowSelection?: boolean;\n disableMultipleRowSelection?: boolean;\n disableSearch?: boolean;\n disableSorting?: boolean;\n emptyState?: () => JSX.Element;\n expandedRowRenderer?: RowExpansionRenderer<TType>;\n length?: number;\n loadMore?: () => Promise<void>;\n manualColumnFiltering?: boolean;\n manualSearch?: boolean;\n manualSorting?: boolean;\n onChangeSettings?: SettingsHandler;\n onRowClick?: RowClickHandler<TType>;\n onRowDrag?: RowDragHandler<TType>;\n onRowDrop?: RowDropHandler<TType>;\n onRowSelect?: RowSelectionHandler<TType>;\n onSave?: SaveHandler<TType>;\n shortcuts?: Table2Shortcuts<TType>;\n toolbarLeft?: JSX.Element;\n toolbarRight?: JSX.Element;\n settings?: Table2Settings;\n _experimentalActionsForTable?: Table2ActionProps<TType>[];\n _experimentalActionsForTableSummary?: (rows: TType[]) => JSX.Element | string;\n};\n"],"names":["Table2FilterComparator"],"mappings":"IAeYA;AAAZ,WAAYA,sBAAsB;EAC9BA,2EAAQ;EACRA,uFAAc;EACdA,6EAAS;EACTA,mFAAY;EACZA,qFAAa;EACbA,+EAAU;EACVA,6EAAS;EACTA,yEAAO;EACPA,2EAAQ;EACRA,yEAAO;EACPA,0EAAO;EACPA,gFAAU;AACd,CAAC,EAbWA,sBAAsB,KAAtBA,sBAAsB;;;;"}
@@ -1,41 +0,0 @@
1
- import cn from 'classnames';
2
- import { COLUMN_ID_FOR_EXPANSION, COLUMN_ID_FOR_SELECTION } from './columns.js';
3
-
4
- const getDensitySizing = (density, editing = false) => {
5
- switch (density) {
6
- case 'compact':
7
- return editing ? 'py-0' : 'py-1.5';
8
- case 'comfortable':
9
- return editing ? 'py-2' : 'py-3.5';
10
- case 'spacious':
11
- return editing ? 'py-3' : 'py-5';
12
- default:
13
- return editing ? 'py-1' : 'py-2.5';
14
- }
15
- };
16
- const getCellSizingClasses = (density = 'normal', editing = false) => {
17
- return cn('min-h-0 flex items-start', getDensitySizing(density, editing), editing ? 'px-[7px]' : 'px-4');
18
- };
19
- const getCellAlignmentClasses = (alignment = 'left') => ({
20
- 'justify-start text-left': alignment === 'left',
21
- 'justify-end text-right': alignment === 'right',
22
- 'justify-center text-center': alignment === 'center'
23
- });
24
- const getFrozenShadowClasses = (column, frozenColumns, isHorizontallyOffset) => {
25
- const frozen = !!column.getIsPinned();
26
- // react-table has column.getPinnedIndex() but it does not exclude hidden columns, so the number is wrong
27
- const frozenColumnIndex = frozenColumns.indexOf(column.id);
28
- const isLastFrozen = frozen && frozenColumnIndex === frozenColumns.length - 1;
29
- const hideFrozenShadow = !isHorizontallyOffset && (column.id === COLUMN_ID_FOR_EXPANSION || column.id === COLUMN_ID_FOR_SELECTION);
30
- return {
31
- 'shadow-[6px_0px_6px_rgb(0_0_0/8%),1px_0px_0px_theme(colors.grey.300)]': isLastFrozen && isHorizontallyOffset,
32
- 'shadow-[1px_0px_0px_theme(colors.grey.300)]': isLastFrozen && !isHorizontallyOffset && !hideFrozenShadow
33
- };
34
- };
35
- const focussableNodeNames = ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'DETAILS'];
36
- const isKeyboardFocusableElement = element => {
37
- return focussableNodeNames.includes(element.nodeName) && !element.hasAttribute('disabled') && !element.hasAttribute('readonly') && !element.getAttribute('aria-hidden');
38
- };
39
-
40
- export { focussableNodeNames, getCellAlignmentClasses, getCellSizingClasses, getFrozenShadowClasses, isKeyboardFocusableElement };
41
- //# sourceMappingURL=cell.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cell.js","sources":["../../../../../../../../src/components/Table2/utilities/cell.ts"],"sourcesContent":["import cn from 'classnames';\nimport { Column } from '@tanstack/react-table';\nimport { CellAlignment, RowDensity } from '../types';\nimport { COLUMN_ID_FOR_EXPANSION, COLUMN_ID_FOR_SELECTION } from './columns';\n\nconst getDensitySizing = (density: RowDensity, editing = false) => {\n switch (density) {\n case 'compact':\n return editing ? 'py-0' : 'py-1.5';\n case 'comfortable':\n return editing ? 'py-2' : 'py-3.5';\n case 'spacious':\n return editing ? 'py-3' : 'py-5';\n default:\n return editing ? 'py-1' : 'py-2.5';\n }\n};\n\nexport const getCellSizingClasses = (density: RowDensity = 'normal', editing = false) => {\n return cn('min-h-0 flex items-start', getDensitySizing(density, editing), editing ? 'px-[7px]' : 'px-4');\n};\n\nexport const getCellAlignmentClasses = (alignment: CellAlignment = 'left') => ({\n 'justify-start text-left': alignment === 'left',\n 'justify-end text-right': alignment === 'right',\n 'justify-center text-center': alignment === 'center',\n});\n\nexport const getFrozenShadowClasses = (column: Column<any, any>, frozenColumns: string[], isHorizontallyOffset: boolean) => {\n const frozen = !!column.getIsPinned();\n\n // react-table has column.getPinnedIndex() but it does not exclude hidden columns, so the number is wrong\n const frozenColumnIndex = frozenColumns.indexOf(column.id);\n const isLastFrozen = frozen && frozenColumnIndex === frozenColumns.length - 1;\n const hideFrozenShadow =\n !isHorizontallyOffset && (column.id === COLUMN_ID_FOR_EXPANSION || column.id === COLUMN_ID_FOR_SELECTION);\n\n return {\n 'shadow-[6px_0px_6px_rgb(0_0_0/8%),1px_0px_0px_theme(colors.grey.300)]': isLastFrozen && isHorizontallyOffset,\n 'shadow-[1px_0px_0px_theme(colors.grey.300)]': isLastFrozen && !isHorizontallyOffset && !hideFrozenShadow,\n };\n};\n\nexport const focussableNodeNames = ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'DETAILS'];\n\nexport const isKeyboardFocusableElement = (element: Element) => {\n return (\n focussableNodeNames.includes(element.nodeName) &&\n !element.hasAttribute('disabled') &&\n !element.hasAttribute('readonly') &&\n !element.getAttribute('aria-hidden')\n );\n};\n"],"names":["getDensitySizing","density","editing","getCellSizingClasses","cn","getCellAlignmentClasses","alignment","getFrozenShadowClasses","column","frozenColumns","isHorizontallyOffset","frozen","getIsPinned","frozenColumnIndex","indexOf","id","isLastFrozen","length","hideFrozenShadow","COLUMN_ID_FOR_EXPANSION","COLUMN_ID_FOR_SELECTION","focussableNodeNames","isKeyboardFocusableElement","element","includes","nodeName","hasAttribute","getAttribute"],"mappings":";;;AAKA,MAAMA,gBAAgB,GAAGA,CAACC,OAAmB,EAAEC,OAAO,GAAG,KAAK;EAC1D,QAAQD,OAAO;IACX,KAAK,SAAS;MACV,OAAOC,OAAO,GAAG,MAAM,GAAG,QAAQ;IACtC,KAAK,aAAa;MACd,OAAOA,OAAO,GAAG,MAAM,GAAG,QAAQ;IACtC,KAAK,UAAU;MACX,OAAOA,OAAO,GAAG,MAAM,GAAG,MAAM;IACpC;MACI,OAAOA,OAAO,GAAG,MAAM,GAAG,QAAQ;;AAE9C,CAAC;MAEYC,oBAAoB,GAAGA,CAACF,UAAsB,QAAQ,EAAEC,OAAO,GAAG,KAAK;EAChF,OAAOE,EAAE,CAAC,0BAA0B,EAAEJ,gBAAgB,CAACC,OAAO,EAAEC,OAAO,CAAC,EAAEA,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;AAC5G;MAEaG,uBAAuB,GAAGA,CAACC,YAA2B,MAAM,MAAM;EAC3E,yBAAyB,EAAEA,SAAS,KAAK,MAAM;EAC/C,wBAAwB,EAAEA,SAAS,KAAK,OAAO;EAC/C,4BAA4B,EAAEA,SAAS,KAAK;CAC/C;MAEYC,sBAAsB,GAAGA,CAACC,MAAwB,EAAEC,aAAuB,EAAEC,oBAA6B;EACnH,MAAMC,MAAM,GAAG,CAAC,CAACH,MAAM,CAACI,WAAW,EAAE;;EAGrC,MAAMC,iBAAiB,GAAGJ,aAAa,CAACK,OAAO,CAACN,MAAM,CAACO,EAAE,CAAC;EAC1D,MAAMC,YAAY,GAAGL,MAAM,IAAIE,iBAAiB,KAAKJ,aAAa,CAACQ,MAAM,GAAG,CAAC;EAC7E,MAAMC,gBAAgB,GAClB,CAACR,oBAAoB,KAAKF,MAAM,CAACO,EAAE,KAAKI,uBAAuB,IAAIX,MAAM,CAACO,EAAE,KAAKK,uBAAuB,CAAC;EAE7G,OAAO;IACH,uEAAuE,EAAEJ,YAAY,IAAIN,oBAAoB;IAC7G,6CAA6C,EAAEM,YAAY,IAAI,CAACN,oBAAoB,IAAI,CAACQ;GAC5F;AACL;MAEaG,mBAAmB,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS;MAE9EC,0BAA0B,GAAIC,OAAgB;EACvD,OACIF,mBAAmB,CAACG,QAAQ,CAACD,OAAO,CAACE,QAAQ,CAAC,IAC9C,CAACF,OAAO,CAACG,YAAY,CAAC,UAAU,CAAC,IACjC,CAACH,OAAO,CAACG,YAAY,CAAC,UAAU,CAAC,IACjC,CAACH,OAAO,CAACI,YAAY,CAAC,aAAa,CAAC;AAE5C;;;;"}
@@ -1,387 +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 { IconButton } from '../../IconButton/IconButton.js';
6
- import { Checkbox } from '../../Checkbox/Checkbox.js';
7
- import { Shortcut } from '../../Shortcut/Shortcut.js';
8
- import { Menu } from '../../Menu/Menu.js';
9
- import { useRowContext } from '../components/row/Context.js';
10
-
11
- const COLUMN_ID_FOR_DRAGGABLE = '__draggable';
12
- const COLUMN_ID_FOR_SELECTION = '__select';
13
- const COLUMN_ID_FOR_EXPANSION = '__expansion';
14
- const COLUMN_ID_FOR_ACTIONS = '__actions';
15
- const isInternalFrozenColumn = id => isInternalColumn(id) && id !== COLUMN_ID_FOR_ACTIONS;
16
- const isInternalColumn = id => id === COLUMN_ID_FOR_SELECTION || id === COLUMN_ID_FOR_EXPANSION || id === COLUMN_ID_FOR_ACTIONS || id === COLUMN_ID_FOR_DRAGGABLE;
17
- const MIN_COLUMN_SIZE = 80; // accounts for padding and sort controls
18
- const toggleBetween = (fromRowIndex, toRowIndex) => {
19
- const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;
20
- const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;
21
- return [fromIndex, toIndex];
22
- };
23
- function createRowDraggableColumn(onRowDrag, texts) {
24
- return {
25
- id: COLUMN_ID_FOR_DRAGGABLE,
26
- cell: ({
27
- row,
28
- table
29
- }) => {
30
- const meta = table.options.meta;
31
- const GHOST_ELEMENT_ID = 'taco_table_dragging';
32
- const onDragStart = event => {
33
- const rows = row.getIsSelected() ? table.getSelectedRowModel().rows : [row, ...table.getSelectedRowModel().rows];
34
- meta.setDragging(rows.reduce((dragging, rowBeingDragged) => ({
35
- ...dragging,
36
- [rowBeingDragged.id]: true
37
- }), {}));
38
- const data = rows.map(row => row.original);
39
- // set a default data value so that the consumer doesn't have to
40
- event.dataTransfer.setData('text', JSON.stringify(data));
41
- const showPlaceholder = text => {
42
- const ghost = document.createElement('div');
43
- ghost.id = GHOST_ELEMENT_ID;
44
- ghost.className = 'wcag-blue rounded flex w-48 p-4 absolute -ml-[100vw]';
45
- ghost.innerText = text;
46
- document.body.appendChild(ghost);
47
- event.dataTransfer.setDragImage(ghost, 0, 0);
48
- };
49
- const setDataTransfer = text => event.dataTransfer.setData('text', text);
50
- onRowDrag(data, showPlaceholder, setDataTransfer);
51
- };
52
- const onDragEnd = () => {
53
- var _document$getElementB;
54
- (_document$getElementB = document.getElementById(GHOST_ELEMENT_ID)) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.remove();
55
- meta.setDragging({});
56
- };
57
- return /*#__PURE__*/React__default.createElement("div", {
58
- draggable: true,
59
- onDragStart: onDragStart,
60
- onDragEnd: onDragEnd
61
- }, /*#__PURE__*/React__default.createElement(Icon, {
62
- "aria-label": texts.table2.columns.drag.tooltip,
63
- name: "drag",
64
- className: "text-grey-darkest invisible w-[20px] cursor-grab active:cursor-grabbing group-hover/row:visible group-[[aria-grabbed]]/row:text-white"
65
- }));
66
- },
67
- footer: () => /*#__PURE__*/React__default.createElement("span", null),
68
- meta: {
69
- align: 'center',
70
- className: 'items-center !px-0',
71
- headerClassName: 'items-center !px-0'
72
- },
73
- // sizing
74
- enableResizing: false,
75
- size: 10
76
- };
77
- }
78
- const SelectCell = /*#__PURE__*/React__default.memo(({
79
- lastSelectedRowIndex,
80
- rowIndex,
81
- isSelected,
82
- table,
83
- tableRef,
84
- texts,
85
- toggleSelected
86
- }) => {
87
- const meta = table.options.meta;
88
- const handleClick = event => {
89
- var _tableRef$current;
90
- event.stopPropagation();
91
- if (event.shiftKey) {
92
- const [fromIndex, toIndex] = toggleBetween((lastSelectedRowIndex === null || lastSelectedRowIndex === void 0 ? void 0 : lastSelectedRowIndex.current) || 0, rowIndex);
93
- table.getRowModel().rows.slice(fromIndex, toIndex + 1).forEach(row => row.toggleSelected(true));
94
- } else {
95
- toggleSelected();
96
- }
97
- lastSelectedRowIndex.current = rowIndex;
98
- meta.setActiveRowIndex(rowIndex);
99
- (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.focus();
100
- };
101
- return /*#__PURE__*/React__default.createElement(Tooltip, {
102
- title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isSelected ? texts.table2.columns.select.deselect : texts.table2.columns.select.select, /*#__PURE__*/React__default.createElement(Shortcut, {
103
- className: "ml-2",
104
- keys: "Space"
105
- }))
106
- }, /*#__PURE__*/React__default.createElement(Checkbox, {
107
- "aria-label": isSelected ? texts.table2.columns.select.select : texts.table2.columns.select.deselect,
108
- className: "hover:border-blue !mt-0",
109
- checked: isSelected,
110
- onClick: handleClick,
111
- // this is necessary to remove console spam from eslint
112
- onChange: () => false,
113
- tabIndex: -1
114
- }));
115
- });
116
- function createRowSelectionColumn(enableMultipleRowSelection, lastSelectedRowIndex, onRowDrag, tableRef, texts) {
117
- let header;
118
- let cell;
119
- if (enableMultipleRowSelection) {
120
- header = ({
121
- table
122
- }) => /*#__PURE__*/React__default.createElement(Tooltip, {
123
- title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, table.getIsAllPageRowsSelected() ? texts.table2.columns.select.deselectAll : texts.table2.columns.select.selectAll, /*#__PURE__*/React__default.createElement(Shortcut, {
124
- className: "ml-2",
125
- keys: {
126
- key: 'a',
127
- meta: true
128
- }
129
- }))
130
- }, /*#__PURE__*/React__default.createElement(Checkbox, {
131
- "aria-label": table.getIsAllPageRowsSelected() ? texts.table2.columns.select.deselectAll : texts.table2.columns.select.selectAll,
132
- className: "hover:border-blue !mt-0",
133
- checked: table.getIsAllPageRowsSelected(),
134
- indeterminate: table.getIsSomePageRowsSelected(),
135
- onChange: checked => table.toggleAllPageRowsSelected(checked),
136
- onClick: () => {
137
- var _tableRef$current2;
138
- (_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : _tableRef$current2.focus();
139
- },
140
- tabIndex: -1
141
- }));
142
- cell = ({
143
- row,
144
- table
145
- }) => /*#__PURE__*/React__default.createElement(SelectCell, {
146
- lastSelectedRowIndex: lastSelectedRowIndex,
147
- rowIndex: row.index,
148
- isSelected: row.getIsSelected(),
149
- table: table,
150
- tableRef: tableRef,
151
- texts: texts,
152
- toggleSelected: row.toggleSelected
153
- });
154
- } else {
155
- cell = ({
156
- row,
157
- table
158
- }) => {
159
- const meta = table.options.meta;
160
- const className = 'border-grey-300 focus:yt-focus flex h-5 w-5 mt-[0.45rem] flex-shrink-0 items-center justify-center self-start rounded-full border-2 bg-white hover:border-[5px] aria-checked:border-blue-500 aria-checked:bg-blue-500 hover:aria-checked:border-blue-300';
161
- const handleClick = event => {
162
- var _tableRef$current3;
163
- event.stopPropagation();
164
- row.toggleSelected();
165
- meta.setActiveRowIndex(row.index);
166
- (_tableRef$current3 = tableRef.current) === null || _tableRef$current3 === void 0 ? void 0 : _tableRef$current3.focus();
167
- };
168
- return /*#__PURE__*/React__default.createElement("button", {
169
- className: className,
170
- "aria-checked": row.getIsSelected(),
171
- onClick: handleClick,
172
- role: "radio",
173
- tabIndex: -1,
174
- type: "button"
175
- }, row.getIsSelected() ? /*#__PURE__*/React__default.createElement("span", {
176
- className: "h-2.5 w-2.5 rounded-full bg-white"
177
- }) : null);
178
- };
179
- }
180
- return {
181
- id: COLUMN_ID_FOR_SELECTION,
182
- header,
183
- cell,
184
- footer: () => /*#__PURE__*/React__default.createElement("span", null),
185
- meta: {
186
- align: 'center',
187
- className: onRowDrag ? '!pl-0 !pr-3' : '!px-3',
188
- headerClassName: onRowDrag ? '!pl-0 !pr-3' : '!px-3'
189
- },
190
- // sizing
191
- enableResizing: false,
192
- size: 46
193
- };
194
- }
195
- const ExpandCell = /*#__PURE__*/React__default.memo(({
196
- expandedRowRenderer,
197
- isExpanded,
198
- row,
199
- texts
200
- }) => {
201
- const hasExpandedRow = expandedRowRenderer(row.original);
202
- if (!hasExpandedRow) {
203
- return null;
204
- }
205
- return /*#__PURE__*/React__default.createElement(Tooltip, {
206
- title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isExpanded ? texts.table2.columns.expansion.collapse : texts.table2.columns.expansion.expand, /*#__PURE__*/React__default.createElement(Shortcut, {
207
- className: "ml-2",
208
- keys: {
209
- key: isExpanded ? 'ArrowLeft' : 'ArrowRight',
210
- meta: true
211
- }
212
- }))
213
- }, /*#__PURE__*/React__default.createElement(IconButton, {
214
- appearance: "discrete",
215
- icon: isExpanded ? 'chevron-down' : 'chevron-right',
216
- onClick: event => {
217
- event.stopPropagation();
218
- row.toggleExpanded();
219
- },
220
- tabIndex: -1
221
- }));
222
- });
223
- function createRowExpansionColumn(expandedRowRenderer, texts) {
224
- return {
225
- id: COLUMN_ID_FOR_EXPANSION,
226
- header: ({
227
- table
228
- }) => /*#__PURE__*/React__default.createElement(Tooltip, {
229
- title: table.getIsSomeRowsExpanded() ? texts.table2.columns.expansion.collapseAll : texts.table2.columns.expansion.expandAll
230
- }, /*#__PURE__*/React__default.createElement(IconButton, {
231
- appearance: "discrete",
232
- className: "-mb-2 -mt-1.5",
233
- icon: table.getIsSomeRowsExpanded() ? 'chevron-down-double' : 'chevron-right-double',
234
- onClick: event => {
235
- event.stopPropagation();
236
- table.toggleAllRowsExpanded(table.getIsSomeRowsExpanded() ? false : true);
237
- },
238
- tabIndex: -1
239
- })),
240
- cell: ({
241
- row
242
- }) =>
243
- /*#__PURE__*/
244
- // ExpandCell is memoised and that's why calling row.getIsExpanded() inside it doesn't return the correct
245
- // expand state. This is the reason why isExpanded is pulled out of the ExpandCell component.
246
- React__default.createElement(ExpandCell, {
247
- expandedRowRenderer: expandedRowRenderer,
248
- isExpanded: row.getIsExpanded(),
249
- row: row,
250
- texts: texts
251
- }),
252
- footer: () => /*#__PURE__*/React__default.createElement("span", null),
253
- meta: {
254
- align: 'center',
255
- className: 'items-center !p-0',
256
- headerClassName: 'items-center hover:!bg-white !p-0'
257
- },
258
- // sizing
259
- enableResizing: false,
260
- size: 36
261
- };
262
- }
263
- const RowActionsCell = /*#__PURE__*/React__default.memo(({
264
- row,
265
- actions,
266
- actionsLength,
267
- isEditing,
268
- shouldPauseHoverState,
269
- table,
270
- texts
271
- }) => {
272
- const {
273
- isActive,
274
- isHovered
275
- } = useRowContext();
276
- if (!isActive && (!isHovered || shouldPauseHoverState) || isEditing) {
277
- return null;
278
- }
279
- const visibleActions = actions.map(action => action(row.original)).filter(action => !!action);
280
- const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);
281
- const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
282
- // If the row is not the active row or the hovered row then actions are hidden.
283
- const actionClassName = 'group-hover/row:flex group-[[aria-current]]/row:flex hidden';
284
- // only actions in the active row should be tabbable
285
- const tabIndex = table.options.meta.activeRowIndex === row.index ? 0 : -1;
286
- return /*#__PURE__*/React__default.createElement("span", {
287
- className: "-mb-2 -mt-2 flex justify-end text-right"
288
- }, actionsOnRow.map((button, index) => {
289
- var _button$props$tooltip, _button$props$tooltip2;
290
- return /*#__PURE__*/React__default.cloneElement(button, {
291
- appearance: 'discrete',
292
- className: cn(actionClassName, button.props.className),
293
- key: index,
294
- tabIndex,
295
- tooltip: button.props.shortcut ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, (_button$props$tooltip = button.props.tooltip) !== null && _button$props$tooltip !== void 0 ? _button$props$tooltip : button.props['aria-label'], /*#__PURE__*/React__default.createElement(Shortcut, {
296
- className: "ml-2",
297
- keys: button.props.shortcut
298
- })) : (_button$props$tooltip2 = button.props.tooltip) !== null && _button$props$tooltip2 !== void 0 ? _button$props$tooltip2 : button.props['aria-label']
299
- });
300
- }), actionsInMenu.length ? /*#__PURE__*/React__default.createElement(IconButton, {
301
- appearance: "discrete",
302
- "aria-label": texts.table2.columns.actions.tooltip,
303
- icon: "more",
304
- tabIndex: tabIndex,
305
- menu: menuProps => /*#__PURE__*/React__default.createElement(Menu, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu.Content, null, actionsInMenu.map((action, i) => /*#__PURE__*/React__default.createElement(Menu.Item, Object.assign({
306
- key: i
307
- }, action.props, {
308
- shortcut: action.props.shortcut
309
- }), action.props['aria-label'])))),
310
- tooltip: texts.table2.columns.actions.tooltip
311
- }) : null);
312
- });
313
- function createRowActionsColumn(rowActions, rowActionsLength, texts) {
314
- return {
315
- id: COLUMN_ID_FOR_ACTIONS,
316
- cell: ({
317
- row,
318
- table
319
- }) => {
320
- var _table$options$meta, _table$options$meta2;
321
- return /*#__PURE__*/React__default.createElement(RowActionsCell, {
322
- row: row,
323
- actions: rowActions,
324
- actionsLength: rowActionsLength,
325
- texts: texts,
326
- table: table,
327
- isEditing: !!((_table$options$meta = table.options.meta) !== null && _table$options$meta !== void 0 && _table$options$meta.editMode.isEditing),
328
- shouldPauseHoverState: !!((_table$options$meta2 = table.options.meta) !== null && _table$options$meta2 !== void 0 && _table$options$meta2.shouldPauseHoverState)
329
- });
330
- },
331
- footer: () => /*#__PURE__*/React__default.createElement("span", null),
332
- meta: {
333
- align: 'right',
334
- className: (row, table) => {
335
- var _table$options$meta3;
336
- return (
337
- // Adding z-index so that it shows on top of frozen columns
338
- cn('items-center print:opacity-0 group-[[aria-current]]/row:sticky group-hover/row:sticky right-0 !px-1 z-[1]', {
339
- 'group-[[aria-current]]/row:!shadow-[-6px_0px_6px_theme(colors.grey.200)]': !row.getIsSelected(),
340
- 'group-hover/row:!shadow-[-6px_0px_6px_theme(colors.grey.100)]': !row.getIsSelected() && (!((_table$options$meta3 = table.options.meta) !== null && _table$options$meta3 !== void 0 && _table$options$meta3.shouldPauseHoverState) || table.options.meta.editMode.isEditing),
341
- 'shadow-[-6px_0px_6px_theme(colors.blue.100)]': row.getIsSelected()
342
- })
343
- );
344
- },
345
- headerClassName: 'hover:!bg-white !px-1'
346
- },
347
- // sizing
348
- enableResizing: false
349
- };
350
- }
351
- function ensureOrdering(columns, settingsOrder) {
352
- // internal column come with a defined order
353
- const internalColumns = columns.filter(column => {
354
- var _column$id;
355
- return ((_column$id = column.id) === null || _column$id === void 0 ? void 0 : _column$id.startsWith('__')) && column.id !== COLUMN_ID_FOR_ACTIONS;
356
- }).map(column => column.id);
357
- // columns with ordering disabled should be moved to the front
358
- const orderingDisabled = [];
359
- const orderingEnabled = [];
360
- let orderedColumns = columns;
361
- // if settings is defined, make sure the columns that are actual children are sorted by it
362
- if (Array.isArray(settingsOrder)) {
363
- orderedColumns = columns.slice().sort(
364
- // the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end
365
- (a, b) => (settingsOrder.indexOf(a.id) >>> 0) - (settingsOrder.indexOf(b.id) >>> 0));
366
- }
367
- orderedColumns.forEach(column => {
368
- var _column$id2, _column$meta;
369
- if ((_column$id2 = column.id) !== null && _column$id2 !== void 0 && _column$id2.startsWith('__')) {
370
- return;
371
- }
372
- if ((_column$meta = column.meta) !== null && _column$meta !== void 0 && _column$meta.disableReordering) {
373
- orderingDisabled.push(column.id);
374
- } else {
375
- orderingEnabled.push(column.id);
376
- }
377
- });
378
- const order = [...internalColumns, ...orderingDisabled, ...orderingEnabled];
379
- // actions should always be last, enforce that
380
- if (columns.findIndex(column => column.id === COLUMN_ID_FOR_ACTIONS) > -1) {
381
- order.push(COLUMN_ID_FOR_ACTIONS);
382
- }
383
- return order;
384
- }
385
-
386
- export { COLUMN_ID_FOR_ACTIONS, COLUMN_ID_FOR_DRAGGABLE, COLUMN_ID_FOR_EXPANSION, COLUMN_ID_FOR_SELECTION, MIN_COLUMN_SIZE, createRowActionsColumn, createRowDraggableColumn, createRowExpansionColumn, createRowSelectionColumn, ensureOrdering, isInternalColumn, isInternalFrozenColumn };
387
- //# sourceMappingURL=columns.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"columns.js","sources":["../../../../../../../../src/components/Table2/utilities/columns.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { CellContext, ColumnDef, DisplayColumnDef, Row, TableMeta } from '@tanstack/react-table';\nimport { Checkbox } from '../../Checkbox/Checkbox';\nimport { IconButton } from '../../IconButton/IconButton';\nimport { Shortcut } from '../../Shortcut/Shortcut';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { RowDragHandler, RowExpansionRenderer } from '../types';\nimport { Menu } from '../../Menu/Menu';\nimport { Icon } from '../../Icon/Icon';\nimport { LocalizationTexts } from '../../Provider/Localization';\nimport { useRowContext } from '../components/row/Context';\n\nexport const COLUMN_ID_FOR_DRAGGABLE = '__draggable';\nexport const COLUMN_ID_FOR_SELECTION = '__select';\nexport const COLUMN_ID_FOR_EXPANSION = '__expansion';\nexport const COLUMN_ID_FOR_ACTIONS = '__actions';\n\nexport const isInternalFrozenColumn = (id: string) => isInternalColumn(id) && id !== COLUMN_ID_FOR_ACTIONS;\n\nexport const isInternalColumn = (id: string) =>\n id === COLUMN_ID_FOR_SELECTION ||\n id === COLUMN_ID_FOR_EXPANSION ||\n id === COLUMN_ID_FOR_ACTIONS ||\n id === COLUMN_ID_FOR_DRAGGABLE;\n\nexport const MIN_COLUMN_SIZE = 80; // accounts for padding and sort controls\n\nconst toggleBetween = (fromRowIndex: number, toRowIndex: number): [number, number] => {\n const fromIndex = toRowIndex < fromRowIndex ? toRowIndex : fromRowIndex;\n const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;\n\n return [fromIndex, toIndex];\n};\n\nexport function createRowDraggableColumn<TType = any>(\n onRowDrag: RowDragHandler<TType>,\n texts: LocalizationTexts\n): DisplayColumnDef<TType, any> {\n return {\n id: COLUMN_ID_FOR_DRAGGABLE,\n cell: ({ row, table }) => {\n const meta = table.options.meta as TableMeta<any>;\n const GHOST_ELEMENT_ID = 'taco_table_dragging';\n\n const onDragStart = (event: React.DragEvent): void => {\n const rows = row.getIsSelected() ? table.getSelectedRowModel().rows : [row, ...table.getSelectedRowModel().rows];\n\n meta.setDragging(rows.reduce((dragging, rowBeingDragged) => ({ ...dragging, [rowBeingDragged.id]: true }), {}));\n\n const data = rows.map(row => row.original);\n // set a default data value so that the consumer doesn't have to\n event.dataTransfer.setData('text', JSON.stringify(data));\n\n const showPlaceholder = (text: string) => {\n const ghost = document.createElement('div');\n ghost.id = GHOST_ELEMENT_ID;\n ghost.className = 'wcag-blue rounded flex w-48 p-4 absolute -ml-[100vw]';\n ghost.innerText = text;\n document.body.appendChild(ghost);\n event.dataTransfer.setDragImage(ghost, 0, 0);\n };\n\n const setDataTransfer = (text: string) => event.dataTransfer.setData('text', text);\n\n onRowDrag(data, showPlaceholder, setDataTransfer);\n };\n\n const onDragEnd = (): void => {\n document.getElementById(GHOST_ELEMENT_ID)?.remove();\n meta.setDragging({});\n };\n\n return (\n <div draggable onDragStart={onDragStart} onDragEnd={onDragEnd}>\n <Icon\n aria-label={texts.table2.columns.drag.tooltip}\n name=\"drag\"\n className=\"text-grey-darkest invisible w-[20px] cursor-grab active:cursor-grabbing group-hover/row:visible group-[[aria-grabbed]]/row:text-white\"\n />\n </div>\n );\n },\n footer: () => <span />,\n meta: {\n align: 'center',\n className: 'items-center !px-0',\n headerClassName: 'items-center !px-0',\n },\n // sizing\n enableResizing: false,\n size: 10,\n };\n}\n\nconst SelectCell = React.memo(({ lastSelectedRowIndex, rowIndex, isSelected, table, tableRef, texts, toggleSelected }: any) => {\n const meta = table.options.meta as TableMeta<any>;\n\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n\n if (event.shiftKey) {\n const [fromIndex, toIndex] = toggleBetween(lastSelectedRowIndex?.current || 0, rowIndex);\n\n table\n .getRowModel()\n .rows.slice(fromIndex, toIndex + 1)\n .forEach(row => row.toggleSelected(true));\n } else {\n toggleSelected();\n }\n\n lastSelectedRowIndex.current = rowIndex;\n meta.setActiveRowIndex(rowIndex);\n tableRef.current?.focus();\n };\n\n return (\n <Tooltip\n title={\n <>\n {isSelected ? texts.table2.columns.select.deselect : texts.table2.columns.select.select}\n <Shortcut className=\"ml-2\" keys=\"Space\" />\n </>\n }>\n <Checkbox\n aria-label={isSelected ? texts.table2.columns.select.select : texts.table2.columns.select.deselect}\n className=\"hover:border-blue !mt-0\"\n checked={isSelected}\n onClick={handleClick}\n // this is necessary to remove console spam from eslint\n onChange={() => false}\n tabIndex={-1}\n />\n </Tooltip>\n );\n});\nexport function createRowSelectionColumn<TType = any>(\n enableMultipleRowSelection: boolean,\n lastSelectedRowIndex: React.MutableRefObject<number | undefined>,\n onRowDrag: RowDragHandler<TType> | undefined,\n tableRef: React.RefObject<HTMLDivElement>,\n texts: LocalizationTexts\n): DisplayColumnDef<TType, any> {\n let header;\n let cell;\n\n if (enableMultipleRowSelection) {\n header = ({ table }) => (\n <Tooltip\n title={\n <>\n {table.getIsAllPageRowsSelected()\n ? texts.table2.columns.select.deselectAll\n : texts.table2.columns.select.selectAll}\n <Shortcut className=\"ml-2\" keys={{ key: 'a', meta: true }} />\n </>\n }>\n <Checkbox\n aria-label={\n table.getIsAllPageRowsSelected()\n ? texts.table2.columns.select.deselectAll\n : texts.table2.columns.select.selectAll\n }\n className=\"hover:border-blue !mt-0\"\n checked={table.getIsAllPageRowsSelected()}\n indeterminate={table.getIsSomePageRowsSelected()}\n onChange={checked => table.toggleAllPageRowsSelected(checked)}\n onClick={() => {\n tableRef.current?.focus();\n }}\n tabIndex={-1}\n />\n </Tooltip>\n );\n cell = ({ row, table }) => (\n <SelectCell\n lastSelectedRowIndex={lastSelectedRowIndex}\n rowIndex={row.index}\n isSelected={row.getIsSelected()}\n table={table}\n tableRef={tableRef}\n texts={texts}\n toggleSelected={row.toggleSelected}\n />\n );\n } else {\n cell = ({ row, table }) => {\n const meta = table.options.meta as TableMeta<any>;\n const className =\n 'border-grey-300 focus:yt-focus flex h-5 w-5 mt-[0.45rem] flex-shrink-0 items-center justify-center self-start rounded-full border-2 bg-white hover:border-[5px] aria-checked:border-blue-500 aria-checked:bg-blue-500 hover:aria-checked:border-blue-300';\n\n const handleClick = (event: React.MouseEvent): void => {\n event.stopPropagation();\n row.toggleSelected();\n meta.setActiveRowIndex(row.index);\n tableRef.current?.focus();\n };\n\n return (\n <button\n className={className}\n aria-checked={row.getIsSelected()}\n onClick={handleClick}\n role=\"radio\"\n tabIndex={-1}\n type=\"button\">\n {row.getIsSelected() ? <span className=\"h-2.5 w-2.5 rounded-full bg-white\" /> : null}\n </button>\n );\n };\n }\n\n return {\n id: COLUMN_ID_FOR_SELECTION,\n header,\n cell,\n footer: () => <span />,\n meta: {\n align: 'center',\n className: onRowDrag ? '!pl-0 !pr-3' : '!px-3',\n headerClassName: onRowDrag ? '!pl-0 !pr-3' : '!px-3',\n },\n // sizing\n enableResizing: false,\n size: 46,\n };\n}\n\nconst ExpandCell = React.memo(({ expandedRowRenderer, isExpanded, row, texts }: any) => {\n const hasExpandedRow = expandedRowRenderer(row.original);\n\n if (!hasExpandedRow) {\n return null;\n }\n\n return (\n <Tooltip\n title={\n <>\n {isExpanded ? texts.table2.columns.expansion.collapse : texts.table2.columns.expansion.expand}\n <Shortcut className=\"ml-2\" keys={{ key: isExpanded ? 'ArrowLeft' : 'ArrowRight', meta: true }} />\n </>\n }>\n <IconButton\n appearance=\"discrete\"\n icon={isExpanded ? 'chevron-down' : 'chevron-right'}\n onClick={event => {\n event.stopPropagation();\n row.toggleExpanded();\n }}\n tabIndex={-1}\n />\n </Tooltip>\n );\n});\n\nexport function createRowExpansionColumn<TType = any>(\n expandedRowRenderer: RowExpansionRenderer<TType>,\n texts: LocalizationTexts\n): DisplayColumnDef<TType, any> {\n return {\n id: COLUMN_ID_FOR_EXPANSION,\n header: ({ table }) => (\n <Tooltip\n title={\n table.getIsSomeRowsExpanded()\n ? texts.table2.columns.expansion.collapseAll\n : texts.table2.columns.expansion.expandAll\n }>\n <IconButton\n appearance=\"discrete\"\n className=\"-mb-2 -mt-1.5\"\n icon={table.getIsSomeRowsExpanded() ? 'chevron-down-double' : 'chevron-right-double'}\n onClick={event => {\n event.stopPropagation();\n table.toggleAllRowsExpanded(table.getIsSomeRowsExpanded() ? false : true);\n }}\n tabIndex={-1}\n />\n </Tooltip>\n ),\n cell: ({ row }: CellContext<TType, any>) => (\n // ExpandCell is memoised and that's why calling row.getIsExpanded() inside it doesn't return the correct\n // expand state. This is the reason why isExpanded is pulled out of the ExpandCell component.\n <ExpandCell expandedRowRenderer={expandedRowRenderer} isExpanded={row.getIsExpanded()} row={row} texts={texts} />\n ),\n footer: () => <span />,\n meta: {\n align: 'center',\n className: 'items-center !p-0',\n headerClassName: 'items-center hover:!bg-white !p-0',\n },\n // sizing\n enableResizing: false,\n size: 36,\n };\n}\n\nconst RowActionsCell = React.memo(({ row, actions, actionsLength, isEditing, shouldPauseHoverState, table, texts }: any) => {\n const { isActive, isHovered } = useRowContext();\n\n if ((!isActive && (!isHovered || shouldPauseHoverState)) || isEditing) {\n return null;\n }\n\n const visibleActions = actions.map(action => action(row.original)).filter(action => !!action);\n\n const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);\n const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);\n\n // If the row is not the active row or the hovered row then actions are hidden.\n const actionClassName = 'group-hover/row:flex group-[[aria-current]]/row:flex hidden';\n\n // only actions in the active row should be tabbable\n const tabIndex = table.options.meta.activeRowIndex === row.index ? 0 : -1;\n\n return (\n <span className=\"-mb-2 -mt-2 flex justify-end text-right\">\n {actionsOnRow.map((button, index) =>\n React.cloneElement(button, {\n appearance: 'discrete',\n className: cn(actionClassName, button.props.className),\n key: index,\n tabIndex,\n tooltip: button.props.shortcut ? (\n <>\n {button.props.tooltip ?? button.props['aria-label']}\n <Shortcut className=\"ml-2\" keys={button.props.shortcut} />\n </>\n ) : (\n button.props.tooltip ?? button.props['aria-label']\n ),\n })\n )}\n {actionsInMenu.length ? (\n <IconButton\n appearance=\"discrete\"\n aria-label={texts.table2.columns.actions.tooltip}\n icon=\"more\"\n tabIndex={tabIndex}\n menu={menuProps => (\n <Menu {...menuProps}>\n <Menu.Content>\n {actionsInMenu.map((action, i) => (\n <Menu.Item key={i} {...action.props} shortcut={action.props.shortcut}>\n {action.props['aria-label']}\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu>\n )}\n tooltip={texts.table2.columns.actions.tooltip}\n />\n ) : null}\n </span>\n );\n});\n\nexport function createRowActionsColumn<TType = any>(\n rowActions,\n rowActionsLength,\n texts: LocalizationTexts\n): DisplayColumnDef<TType, any> {\n return {\n id: COLUMN_ID_FOR_ACTIONS,\n cell: ({ row, table }) => (\n <RowActionsCell\n row={row}\n actions={rowActions}\n actionsLength={rowActionsLength}\n texts={texts}\n table={table}\n isEditing={!!table.options.meta?.editMode.isEditing}\n shouldPauseHoverState={!!table.options.meta?.shouldPauseHoverState}\n />\n ),\n footer: () => <span />,\n meta: {\n align: 'right',\n className: (row: Row<any>, table: any) =>\n // Adding z-index so that it shows on top of frozen columns\n cn('items-center print:opacity-0 group-[[aria-current]]/row:sticky group-hover/row:sticky right-0 !px-1 z-[1]', {\n 'group-[[aria-current]]/row:!shadow-[-6px_0px_6px_theme(colors.grey.200)]': !row.getIsSelected(),\n 'group-hover/row:!shadow-[-6px_0px_6px_theme(colors.grey.100)]':\n !row.getIsSelected() &&\n (!table.options.meta?.shouldPauseHoverState || table.options.meta.editMode.isEditing),\n 'shadow-[-6px_0px_6px_theme(colors.blue.100)]': row.getIsSelected(),\n }),\n headerClassName: 'hover:!bg-white !px-1',\n },\n // sizing\n enableResizing: false,\n };\n}\n\nexport function ensureOrdering<TType = unknown>(columns: ColumnDef<TType>[], settingsOrder: string[] | undefined): string[] {\n // internal column come with a defined order\n const internalColumns = columns\n .filter(column => column.id?.startsWith('__') && column.id !== COLUMN_ID_FOR_ACTIONS)\n .map(column => column.id) as string[];\n\n // columns with ordering disabled should be moved to the front\n const orderingDisabled: string[] = [];\n const orderingEnabled: string[] = [];\n\n let orderedColumns = columns;\n\n // if settings is defined, make sure the columns that are actual children are sorted by it\n if (Array.isArray(settingsOrder)) {\n orderedColumns = columns.slice().sort(\n // the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end\n (a, b) => (settingsOrder.indexOf(a.id as string) >>> 0) - (settingsOrder.indexOf(b.id as string) >>> 0)\n );\n }\n\n orderedColumns.forEach(column => {\n if (column.id?.startsWith('__')) {\n return;\n }\n\n if (column.meta?.disableReordering) {\n orderingDisabled.push(column.id as string);\n } else {\n orderingEnabled.push(column.id as string);\n }\n });\n\n const order = [...internalColumns, ...orderingDisabled, ...orderingEnabled];\n\n // actions should always be last, enforce that\n if (columns.findIndex(column => column.id === COLUMN_ID_FOR_ACTIONS) > -1) {\n order.push(COLUMN_ID_FOR_ACTIONS);\n }\n\n return order;\n}\n"],"names":["COLUMN_ID_FOR_DRAGGABLE","COLUMN_ID_FOR_SELECTION","COLUMN_ID_FOR_EXPANSION","COLUMN_ID_FOR_ACTIONS","isInternalFrozenColumn","id","isInternalColumn","MIN_COLUMN_SIZE","toggleBetween","fromRowIndex","toRowIndex","fromIndex","toIndex","createRowDraggableColumn","onRowDrag","texts","cell","row","table","meta","options","GHOST_ELEMENT_ID","onDragStart","event","rows","getIsSelected","getSelectedRowModel","setDragging","reduce","dragging","rowBeingDragged","data","map","original","dataTransfer","setData","JSON","stringify","showPlaceholder","text","ghost","document","createElement","className","innerText","body","appendChild","setDragImage","setDataTransfer","onDragEnd","_document$getElementB","getElementById","remove","React","draggable","Icon","table2","columns","drag","tooltip","name","footer","align","headerClassName","enableResizing","size","SelectCell","memo","lastSelectedRowIndex","rowIndex","isSelected","tableRef","toggleSelected","handleClick","stopPropagation","shiftKey","current","getRowModel","slice","forEach","setActiveRowIndex","_tableRef$current","focus","Tooltip","title","select","deselect","Shortcut","keys","Checkbox","checked","onClick","onChange","tabIndex","createRowSelectionColumn","enableMultipleRowSelection","header","getIsAllPageRowsSelected","deselectAll","selectAll","key","indeterminate","getIsSomePageRowsSelected","toggleAllPageRowsSelected","_tableRef$current2","index","_tableRef$current3","role","type","ExpandCell","expandedRowRenderer","isExpanded","hasExpandedRow","expansion","collapse","expand","IconButton","appearance","icon","toggleExpanded","createRowExpansionColumn","getIsSomeRowsExpanded","collapseAll","expandAll","toggleAllRowsExpanded","getIsExpanded","RowActionsCell","actions","actionsLength","isEditing","shouldPauseHoverState","isActive","isHovered","useRowContext","visibleActions","action","filter","actionsOnRow","length","actionsInMenu","actionClassName","activeRowIndex","button","_button$props$tooltip","_button$props$tooltip2","cloneElement","cn","props","shortcut","menu","menuProps","Menu","Content","i","Item","createRowActionsColumn","rowActions","rowActionsLength","_table$options$meta","_table$options$meta2","editMode","_table$options$meta3","ensureOrdering","settingsOrder","internalColumns","column","_column$id","startsWith","orderingDisabled","orderingEnabled","orderedColumns","Array","isArray","sort","a","b","indexOf","_column$id2","_column$meta","disableReordering","push","order","findIndex"],"mappings":";;;;;;;;;;MAaaA,uBAAuB,GAAG;MAC1BC,uBAAuB,GAAG;MAC1BC,uBAAuB,GAAG;MAC1BC,qBAAqB,GAAG;MAExBC,sBAAsB,GAAIC,EAAU,IAAKC,gBAAgB,CAACD,EAAE,CAAC,IAAIA,EAAE,KAAKF;MAExEG,g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,GAAa,EAAE;EAEpC,IAAIC,cAAc,GAAGjH,OAAO;;EAG5B,IAAIkH,KAAK,CAACC,OAAO,CAACT,aAAa,CAAC,EAAE;IAC9BO,cAAc,GAAGjH,OAAO,CAACqB,KAAK,EAAE,CAAC+F,IAAI;;IAEjC,CAACC,CAAC,EAAEC,CAAC,KAAK,CAACZ,aAAa,CAACa,OAAO,CAACF,CAAC,CAACzK,EAAY,CAAC,KAAK,CAAC,KAAK8J,aAAa,CAACa,OAAO,CAACD,CAAC,CAAC1K,EAAY,CAAC,KAAK,CAAC,CAAC,CAC1G;;EAGLqK,cAAc,CAAC3F,OAAO,CAACsF,MAAM;;IACzB,KAAAY,WAAA,GAAIZ,MAAM,CAAChK,EAAE,cAAA4K,WAAA,eAATA,WAAA,CAAWV,UAAU,CAAC,IAAI,CAAC,EAAE;MAC7B;;IAGJ,KAAAW,YAAA,GAAIb,MAAM,CAAClJ,IAAI,cAAA+J,YAAA,eAAXA,YAAA,CAAaC,iBAAiB,EAAE;MAChCX,gBAAgB,CAACY,IAAI,CAACf,MAAM,CAAChK,EAAY,CAAC;KAC7C,MAAM;MACHoK,eAAe,CAACW,IAAI,CAACf,MAAM,CAAChK,EAAY,CAAC;;GAEhD,CAAC;EAEF,MAAMgL,KAAK,GAAG,CAAC,GAAGjB,eAAe,EAAE,GAAGI,gBAAgB,EAAE,GAAGC,eAAe,CAAC;;EAG3E,IAAIhH,OAAO,CAAC6H,SAAS,CAACjB,MAAM,IAAIA,MAAM,CAAChK,EAAE,KAAKF,qBAAqB,CAAC,GAAG,CAAC,CAAC,EAAE;IACvEkL,KAAK,CAACD,IAAI,CAACjL,qBAAqB,CAAC;;EAGrC,OAAOkL,KAAK;AAChB;;;;"}
@@ -1,100 +0,0 @@
1
- import { isDate, isBefore, isAfter } from 'date-fns';
2
- import { isWeakEqual as isWeakEqual$1 } from '../../../utils/date.js';
3
- import { Table2FilterComparator } from '../types.js';
4
-
5
- const toLowerCase = value => String(value !== null && value !== void 0 ? value : '').toLocaleLowerCase();
6
- const isWeakContains = (left, right) => toLowerCase(left).includes(toLowerCase(right));
7
- const isWeakEqual = (left, right) => toLowerCase(left) === toLowerCase(right);
8
- const globalFilterFn = (value, query) => isWeakContains(value, query);
9
- // the filter type is only settable on the column definition, which would re-render all columns
10
- // so instead we store it in the filter value, but that means we also have to destructure that
11
- // before we filter - that's why this custom filter function exists
12
- const columnFilterFn = (value, filter) => {
13
- try {
14
- if (filter.comparator === Table2FilterComparator.IsEmpty || filter.comparator === Table2FilterComparator.IsNotEmpty) {
15
- const isEmpty = value === undefined || value === null || value === '';
16
- return filter.comparator === Table2FilterComparator.IsEmpty ? isEmpty : !isEmpty;
17
- }
18
- if (filter.value === undefined || filter.value === null || filter.value === '') {
19
- return true;
20
- }
21
- switch (filter.comparator) {
22
- case Table2FilterComparator.Contains:
23
- return isWeakContains(value, filter.value);
24
- case Table2FilterComparator.DoesNotContain:
25
- return !isWeakContains(value, filter.value);
26
- case Table2FilterComparator.IsEqualTo:
27
- {
28
- if (isDate(value)) {
29
- return isDate(filter.value) && isWeakEqual$1(value, filter.value);
30
- } else if (typeof filter.value === 'boolean') {
31
- return value === filter.value;
32
- }
33
- return isWeakEqual(value, filter.value);
34
- }
35
- case Table2FilterComparator.IsNotEqualTo:
36
- {
37
- if (isDate(value)) {
38
- return isDate(filter.value) && isWeakEqual$1(value, filter.value) === false;
39
- } else if (typeof filter.value === 'boolean') {
40
- return value !== filter.value;
41
- }
42
- return !isWeakEqual(value, filter.value);
43
- }
44
- case Table2FilterComparator.IsGreaterThan:
45
- {
46
- if (isDate(value)) {
47
- return isDate(filter.value) && isAfter(value, filter.value);
48
- } else {
49
- const valueAsNumber = parseInt(value);
50
- return !isNaN(valueAsNumber) && filter.value !== undefined && valueAsNumber > filter.value;
51
- }
52
- }
53
- case Table2FilterComparator.IsLessThan:
54
- {
55
- if (isDate(value)) {
56
- return isDate(filter.value) && isBefore(value, filter.value);
57
- } else {
58
- const valueAsNumber = parseInt(value);
59
- return !isNaN(valueAsNumber) && filter.value !== undefined && valueAsNumber < filter.value;
60
- }
61
- }
62
- case Table2FilterComparator.IsBetween:
63
- {
64
- const [fromValue, toValue] = filter.value;
65
- if (isDate(value)) {
66
- if (isDate(fromValue) && isBefore(value, fromValue)) {
67
- return false;
68
- } else if (isDate(toValue) && isAfter(value, toValue)) {
69
- return false;
70
- }
71
- return true;
72
- } else {
73
- const valueAsNumber = parseInt(value);
74
- if (isNaN(valueAsNumber)) {
75
- return false;
76
- }
77
- if (fromValue !== undefined && valueAsNumber < fromValue) {
78
- return false;
79
- } else if (toValue !== undefined && valueAsNumber > toValue) {
80
- return false;
81
- }
82
- return true;
83
- }
84
- }
85
- case Table2FilterComparator.IsOneOf:
86
- return Array.isArray(filter.value) ? filter.value.includes(value) : false;
87
- case Table2FilterComparator.IsNoneOf:
88
- return Array.isArray(filter.value) ? filter.value.includes(value) === false : false;
89
- case Table2FilterComparator.IsAllOf:
90
- return Array.isArray(filter.value) && Array.isArray(value) ? filter.value.filter(v => value.includes(v)).length === filter.value.length : false;
91
- }
92
- return false;
93
- } catch (e) {
94
- console.error(e);
95
- return true;
96
- }
97
- };
98
-
99
- export { columnFilterFn, globalFilterFn };
100
- //# sourceMappingURL=filterFn.js.map