@economic/taco 2.21.3 → 2.22.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (232) hide show
  1. package/dist/components/Report/Report.d.ts +21 -0
  2. package/dist/components/Report/components/Cell/Cell.d.ts +0 -1
  3. package/dist/components/Report/components/Cell/DisplayCell.d.ts +1 -1
  4. package/dist/components/Report/components/Cell/util.d.ts +1 -1
  5. package/dist/components/Report/components/Row/DisplayRow.d.ts +2 -9
  6. package/dist/components/Report/components/Toolbar/components/Filters/components/Placeholder.d.ts +5 -5
  7. package/dist/components/Report/listeners/useTableRowActiveListener.d.ts +3 -0
  8. package/dist/components/Report/styles/util.d.ts +2 -2
  9. package/dist/components/Report/types.d.ts +1 -3
  10. package/dist/components/Report/useReport.d.ts +2 -7
  11. package/dist/components/Table3/types.d.ts +1 -1
  12. package/dist/esm/index.css +501 -9
  13. package/dist/esm/packages/taco/src/components/Card/Card.js +1 -1
  14. package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Group/Group.js +1 -1
  16. package/dist/esm/packages/taco/src/components/Group/Group.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Input/Input.js +37 -7
  18. package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
  19. package/dist/esm/packages/taco/src/components/Input/util.js +3 -1
  20. package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
  21. package/dist/esm/packages/taco/src/components/Report/Report.js +70 -0
  22. package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -0
  23. package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js +61 -0
  24. package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js.map +1 -0
  25. package/dist/esm/packages/taco/src/components/Report/components/Body/util.js +22 -0
  26. package/dist/esm/packages/taco/src/components/Report/components/Body/util.js.map +1 -0
  27. package/dist/esm/packages/taco/src/components/Report/components/Cell/Cell.js +32 -0
  28. package/dist/esm/packages/taco/src/components/Report/components/Cell/Cell.js.map +1 -0
  29. package/dist/esm/packages/taco/src/components/Report/components/Cell/DisplayCell.js +23 -0
  30. package/dist/esm/packages/taco/src/components/Report/components/Cell/DisplayCell.js.map +1 -0
  31. package/dist/esm/packages/taco/src/components/Report/components/Cell/GroupedCell.js +58 -0
  32. package/dist/esm/packages/taco/src/components/Report/components/Cell/GroupedCell.js.map +1 -0
  33. package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js +69 -0
  34. package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js.map +1 -0
  35. package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js +34 -0
  36. package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js.map +1 -0
  37. package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js +39 -0
  38. package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js.map +1 -0
  39. package/dist/esm/packages/taco/src/components/Report/components/Header/Header.js +194 -0
  40. package/dist/esm/packages/taco/src/components/Report/components/Header/Header.js.map +1 -0
  41. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Goto.js +28 -0
  42. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Goto.js.map +1 -0
  43. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Menu.js +150 -0
  44. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Menu.js.map +1 -0
  45. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Resizer.js +60 -0
  46. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Resizer.js.map +1 -0
  47. package/dist/esm/packages/taco/src/components/Report/components/Header/components/SortIndicator.js +41 -0
  48. package/dist/esm/packages/taco/src/components/Report/components/Header/components/SortIndicator.js.map +1 -0
  49. package/dist/esm/packages/taco/src/components/Report/components/Header/util.js +24 -0
  50. package/dist/esm/packages/taco/src/components/Report/components/Header/util.js.map +1 -0
  51. package/dist/esm/packages/taco/src/components/Report/components/Internal/Actions.js +90 -0
  52. package/dist/esm/packages/taco/src/components/Report/components/Internal/Actions.js.map +1 -0
  53. package/dist/esm/packages/taco/src/components/Report/components/Internal/Expansion.js +59 -0
  54. package/dist/esm/packages/taco/src/components/Report/components/Internal/Expansion.js.map +1 -0
  55. package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js +118 -0
  56. package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js.map +1 -0
  57. package/dist/esm/packages/taco/src/components/Report/components/Row/DisplayRow.js +102 -0
  58. package/dist/esm/packages/taco/src/components/Report/components/Row/DisplayRow.js.map +1 -0
  59. package/dist/esm/packages/taco/src/components/Report/components/Row/Row.js +24 -0
  60. package/dist/esm/packages/taco/src/components/Report/components/Row/Row.js.map +1 -0
  61. package/dist/esm/packages/taco/src/components/Report/components/Row/RowContext.js +10 -0
  62. package/dist/esm/packages/taco/src/components/Report/components/Row/RowContext.js.map +1 -0
  63. package/dist/esm/packages/taco/src/components/Report/components/Row/SkeletonRow.js +62 -0
  64. package/dist/esm/packages/taco/src/components/Report/components/Row/SkeletonRow.js.map +1 -0
  65. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/Toolbar.js +63 -0
  66. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/Toolbar.js.map +1 -0
  67. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/Filters.js +50 -0
  68. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/Filters.js.map +1 -0
  69. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js +136 -0
  70. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -0
  71. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js +95 -0
  72. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js.map +1 -0
  73. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js +49 -0
  74. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -0
  75. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterComparator.js +110 -0
  76. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterComparator.js.map +1 -0
  77. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterValue.js +118 -0
  78. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -0
  79. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js +41 -0
  80. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js.map +1 -0
  81. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/util.js +7 -0
  82. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/util.js.map +1 -0
  83. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js +123 -0
  84. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js.map +1 -0
  85. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/PrintDialog.js +88 -0
  86. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/PrintDialog.js.map +1 -0
  87. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Search/Search.js +95 -0
  88. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Search/Search.js.map +1 -0
  89. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/HideOrOrderPopover.js +105 -0
  90. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/HideOrOrderPopover.js.map +1 -0
  91. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/Settings.js +103 -0
  92. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/Settings.js.map +1 -0
  93. package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js +24 -0
  94. package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js.map +1 -0
  95. package/dist/esm/packages/taco/src/components/Report/styles/useColumnPinningStylesheet.js +44 -0
  96. package/dist/esm/packages/taco/src/components/Report/styles/useColumnPinningStylesheet.js.map +1 -0
  97. package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js +54 -0
  98. package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js.map +1 -0
  99. package/dist/esm/packages/taco/src/components/Report/styles/useStylesheet.js +20 -0
  100. package/dist/esm/packages/taco/src/components/Report/styles/useStylesheet.js.map +1 -0
  101. package/dist/esm/packages/taco/src/components/Report/styles/util.js +61 -0
  102. package/dist/esm/packages/taco/src/components/Report/styles/util.js.map +1 -0
  103. package/dist/esm/packages/taco/src/components/Report/useReport.js +51 -0
  104. package/dist/esm/packages/taco/src/components/Report/useReport.js.map +1 -0
  105. package/dist/esm/packages/taco/src/components/Report/util/rows.js +10 -0
  106. package/dist/esm/packages/taco/src/components/Report/util/rows.js.map +1 -0
  107. package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js +39 -0
  108. package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js.map +1 -0
  109. package/dist/esm/packages/taco/src/components/Report/util/useTableRenderer.js +162 -0
  110. package/dist/esm/packages/taco/src/components/Report/util/useTableRenderer.js.map +1 -0
  111. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js +3 -2
  112. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
  113. package/dist/esm/packages/taco/src/components/Select2/Select2.js +2 -2
  114. package/dist/esm/packages/taco/src/components/Select2/components/Create.js +1 -1
  115. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +1 -1
  116. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +1 -1
  117. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +6 -7
  118. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  119. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +1 -1
  120. package/dist/esm/packages/taco/src/components/Table3/Table3.js +7 -2
  121. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  122. package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js +6 -6
  123. package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js.map +1 -1
  124. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +7 -1
  125. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
  126. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +2 -0
  127. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
  128. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +6 -1
  129. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  130. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +1 -0
  131. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
  132. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +3 -1
  133. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
  134. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Summary.js +1 -0
  135. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Summary.js.map +1 -1
  136. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +9 -1
  137. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
  138. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +1 -0
  139. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
  140. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +2 -0
  141. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
  142. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +3 -3
  143. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +4 -8
  144. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
  145. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +1 -0
  146. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js.map +1 -1
  147. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +19 -14
  148. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
  149. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +6 -5
  150. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
  151. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +18 -1
  152. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
  153. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnFreezing.js +8 -14
  154. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnFreezing.js.map +1 -1
  155. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js +1 -1
  156. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js +1 -1
  157. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +5 -1
  158. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
  159. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +15 -15
  160. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  161. package/dist/esm/packages/taco/src/components/Table3/hooks/useTablePreset.js +20 -0
  162. package/dist/esm/packages/taco/src/components/Table3/hooks/useTablePreset.js.map +1 -1
  163. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  164. package/dist/esm/packages/taco/src/components/Table3/util/columns.js +2 -0
  165. package/dist/esm/packages/taco/src/components/Table3/util/columns.js.map +1 -1
  166. package/dist/esm/packages/taco/src/components/Textarea/Textarea.js +1 -1
  167. package/dist/esm/packages/taco/src/components/Textarea/Textarea.js.map +1 -1
  168. package/dist/esm/packages/taco/src/hooks/useBoundaryOverflowDetection.js +1 -1
  169. package/dist/esm/packages/taco/src/index.js +7 -6
  170. package/dist/esm/packages/taco/src/index.js.map +1 -1
  171. package/dist/esm/packages/taco/src/primitives/Button.js +2 -1
  172. package/dist/esm/packages/taco/src/primitives/Button.js.map +1 -1
  173. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  174. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnFreezing.js +21 -0
  175. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnFreezing.js.map +1 -0
  176. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFooter.js +8 -0
  177. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFooter.js.map +1 -0
  178. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js +16 -0
  179. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +1 -0
  180. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRef.js +17 -0
  181. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRef.js.map +1 -0
  182. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActions.js +11 -0
  183. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActions.js.map +1 -0
  184. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowExpansion.js +9 -0
  185. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowExpansion.js.map +1 -0
  186. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGroups.js +9 -0
  187. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGroups.js.map +1 -0
  188. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSearch.js +38 -0
  189. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSearch.js.map +1 -0
  190. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js +28 -0
  191. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js.map +1 -0
  192. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowHeightListener.js +14 -0
  193. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowHeightListener.js.map +1 -0
  194. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSearchListener.js +15 -0
  195. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSearchListener.js.map +1 -0
  196. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js +26 -0
  197. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js.map +1 -0
  198. package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js +117 -0
  199. package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js.map +1 -0
  200. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js +30 -3
  201. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -1
  202. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/filtering.js +131 -0
  203. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/filtering.js.map +1 -0
  204. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/presets.js +131 -0
  205. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/presets.js.map +1 -0
  206. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/search.js +43 -0
  207. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/search.js.map +1 -0
  208. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/settings.js +22 -0
  209. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/settings.js.map +1 -0
  210. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/setup.js +270 -0
  211. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/setup.js.map +1 -0
  212. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/sorting.js +18 -0
  213. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/sorting.js.map +1 -0
  214. package/dist/esm/packages/taco/src/utils/dom.js +5 -1
  215. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  216. package/dist/esm/packages/taco/src/utils/keyboard.js +3 -5
  217. package/dist/esm/packages/taco/src/utils/keyboard.js.map +1 -1
  218. package/dist/index.css +501 -9
  219. package/dist/index.d.ts +1 -0
  220. package/dist/primitives/Table/types.d.ts +2 -2
  221. package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +1 -1
  222. package/dist/primitives/Table/useTable/util/settings.d.ts +1 -1
  223. package/dist/primitives/Table/useTable/util/sorting.d.ts +1 -1
  224. package/dist/taco.cjs.development.js +6381 -2732
  225. package/dist/taco.cjs.development.js.map +1 -1
  226. package/dist/taco.cjs.production.min.js +1 -1
  227. package/dist/taco.cjs.production.min.js.map +1 -1
  228. package/dist/utils/dom.d.ts +1 -0
  229. package/dist/utils/keyboard.d.ts +0 -1
  230. package/package.json +2 -2
  231. package/types.json +6050 -4979
  232. package/dist/components/Report/features/useReportExport.d.ts +0 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presets.js","sources":["../../../../../../../../../src/primitives/Table/useTable/util/presets.ts"],"sourcesContent":["import React from 'react';\nimport { TableFeatureProps, TablePreset, useTableProps } from '../../types';\n\nconst DEFAULT_PRESET: TableFeatureProps = {\n // react-table built-in\n enableFiltering: false,\n enableSearch: false,\n enableSorting: false,\n enableColumnFreezing: false,\n enableColumnHiding: false,\n enableColumnResizing: false,\n enableRowExpansion: false,\n enableRowSelection: false,\n enableRowSelectionSingle: false,\n\n // custom -- common between all table types\n enableColumnOrdering: false,\n enableFontSize: false,\n enableFooter: false,\n enablePrinting: false,\n enableRowActive: true,\n enableRowActions: false,\n enableRowClick: false,\n enableRowGoto: false,\n enableRowHeight: false,\n enableSettings: false,\n};\n\nconst presets: Record<TablePreset, TableFeatureProps> = {\n lite: {\n // react-table built-in\n enableFiltering: true,\n enableSearch: true,\n enableSorting: true,\n enableColumnFreezing: true,\n enableColumnHiding: false,\n enableColumnResizing: true,\n enableRowExpansion: true,\n enableRowSelection: true,\n enableRowSelectionSingle: false,\n\n // custom -- common between all table types\n enableColumnOrdering: false,\n enableFontSize: false,\n enableFooter: true,\n enablePrinting: false,\n enableRowActive: true,\n enableRowActions: true,\n enableRowClick: true,\n enableRowGoto: true,\n enableRowHeight: false,\n enableSettings: true,\n },\n complex: {\n // react-table built-in\n enableFiltering: true,\n enableSearch: true,\n enableSorting: true,\n enableColumnFreezing: true,\n enableColumnHiding: true,\n enableColumnResizing: true,\n enableRowExpansion: true,\n enableRowSelection: true,\n enableRowSelectionSingle: false,\n\n // custom -- common between all table types\n enableColumnOrdering: true,\n enableFontSize: true,\n enableFooter: true,\n enablePrinting: true,\n enableRowActive: true,\n enableRowActions: true,\n enableRowClick: true,\n enableRowGoto: true,\n enableRowHeight: true,\n enableSettings: true,\n },\n};\n\nexport function useTableFeaturePreset<TType = unknown>(props: useTableProps<TType>): TableFeatureProps {\n const presetOptions = props.preset ? presets[props.preset] : DEFAULT_PRESET;\n\n const enableRowActions = props.enableRowActions ?? presetOptions.enableRowActions;\n const enableRowClick = props.enableRowClick ?? presetOptions.enableRowClick;\n const enableRowGoto = props.enableRowGoto ?? presetOptions.enableRowGoto;\n const enableRowExpansion = props.enableRowExpansion ?? presetOptions.enableRowExpansion;\n const enableRowSelection = props.enableRowSelection ?? presetOptions.enableRowSelection;\n const enableRowSelectionSingle = props.enableRowSelectionSingle ?? presetOptions.enableRowSelectionSingle;\n\n // guard options that might be unintentionally broken\n React.useEffect(() => {\n if (enableRowActions && !props.rowActions?.length) {\n console.warn(\n `Table (id: ${props.id}) - Row actions is enabled but no \\`rowActions\\` has been provided. Provide one to enable row actions or set \\`enableRowActions\\` to \\`false\\`.`\n );\n }\n\n if (enableRowClick && !props.onRowClick) {\n console.warn(\n `Table (id: ${props.id}) - Row click is enabled but no \\`onRowClick\\` handler has been provided. Provide one to enable row click or set \\`enableRowClick\\` to \\`false\\`.`\n );\n }\n\n if (enableRowGoto && !props.onRowGoto) {\n console.warn(\n `Table (id: ${props.id}) - Row click is enabled but no \\`onRowGoto\\` handler has been provided. Provide one to enable row goto or set \\`enableRowGoto\\` to \\`false\\`.`\n );\n }\n\n if (enableRowExpansion && !props.rowExpansionRenderer) {\n console.warn(\n `Table (id: ${props.id}) - Row expansion is enabled but no \\`rowExpansionRenderer\\` has been provided. Provide one to enable row expansion or set \\`enableRowExpansion\\` to \\`false\\`.`\n );\n }\n\n if (enableRowSelection && !props.onRowSelect) {\n console.warn(\n `Table (id: ${props.id}) - Row selection is enabled but no \\`onRowSelect\\` handler has been provided. Provide one to enable row selection or set \\`enableRowSelection\\` to \\`false\\`.`\n );\n }\n\n if (enableRowSelectionSingle && !props.onRowSelect) {\n console.warn(\n `Table (id: ${props.id}) - Row selection (single) is enabled but no \\`onRowSelect\\` handler has been provided. Provide one to enable row selection or set \\`enableRowSelectionSingle\\` to \\`false\\`.`\n );\n }\n }, []);\n\n return {\n // react-table built-in\n enableFiltering: props.enableFiltering ?? presetOptions.enableFiltering,\n enableSearch: props.enableSearch ?? presetOptions.enableSearch,\n enableSorting: props.enableSorting ?? presetOptions.enableSorting,\n enableColumnFreezing: props.enableColumnFreezing ?? presetOptions.enableColumnFreezing,\n enableColumnHiding: props.enableColumnHiding ?? presetOptions.enableColumnHiding,\n enableColumnResizing: props.enableColumnResizing ?? presetOptions.enableColumnResizing,\n enableRowExpansion: enableRowExpansion && !!props.rowExpansionRenderer,\n enableRowSelection: enableRowSelection && !!props.onRowSelect,\n enableRowSelectionSingle: enableRowSelectionSingle && !!props.onRowSelect,\n\n // custom -- common between all table types\n enableColumnOrdering: props.enableColumnOrdering ?? presetOptions.enableColumnOrdering,\n enableFontSize: props.enableFontSize ?? presetOptions.enableFontSize,\n enableFooter: props.enableFooter ?? presetOptions.enableFooter,\n enablePrinting: props.enablePrinting ?? presetOptions.enablePrinting,\n enableRowActive: props.enableRowActive ?? presetOptions.enableRowActive,\n enableRowActions: enableRowActions && !!props.rowActions?.length,\n enableRowClick: enableRowClick && !!props.onRowClick,\n enableRowGoto: enableRowGoto && !!props.onRowGoto,\n enableRowHeight: props.enableRowHeight ?? presetOptions.enableRowHeight,\n enableSettings: props.enableSettings ?? presetOptions.enableSettings,\n };\n}\n"],"names":["DEFAULT_PRESET","enableFiltering","enableSearch","enableSorting","enableColumnFreezing","enableColumnHiding","enableColumnResizing","enableRowExpansion","enableRowSelection","enableRowSelectionSingle","enableColumnOrdering","enableFontSize","enableFooter","enablePrinting","enableRowActive","enableRowActions","enableRowClick","enableRowGoto","enableRowHeight","enableSettings","presets","lite","complex","useTableFeaturePreset","props","presetOptions","preset","_props$enableRowActio","_props$enableRowClick","_props$enableRowGoto","_props$enableRowExpan","_props$enableRowSelec","_props$enableRowSelec2","React","useEffect","_props$rowActions","rowActions","length","console","warn","id","onRowClick","onRowGoto","rowExpansionRenderer","onRowSelect","_props$enableFilterin","_props$enableSearch","_props$enableSorting","_props$enableColumnFr","_props$enableColumnHi","_props$enableColumnRe","_props$enableColumnOr","_props$enableFontSize","_props$enableFooter","_props$enablePrinting","_props$enableRowActiv","_props$rowActions2","_props$enableRowHeigh","_props$enableSettings"],"mappings":";;AAGA,MAAMA,cAAc,GAAsB;;EAEtCC,eAAe,EAAE,KAAK;EACtBC,YAAY,EAAE,KAAK;EACnBC,aAAa,EAAE,KAAK;EACpBC,oBAAoB,EAAE,KAAK;EAC3BC,kBAAkB,EAAE,KAAK;EACzBC,oBAAoB,EAAE,KAAK;EAC3BC,kBAAkB,EAAE,KAAK;EACzBC,kBAAkB,EAAE,KAAK;EACzBC,wBAAwB,EAAE,KAAK;;EAG/BC,oBAAoB,E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GAAAuC,qBAAA,GAAElC,KAAK,CAACL,cAAc,cAAAuC,qBAAA,cAAAA,qBAAA,GAAIjC,aAAa,CAACN;GACzD;AACL;;;;"}
@@ -0,0 +1,43 @@
1
+ import { getCellValueAsString } from './columns.js';
2
+ import { isWeakContains } from './filtering.js';
3
+
4
+ function resetHighlightedColumnIndexes(value, table) {
5
+ const tableMeta = table.options.meta;
6
+ let firstRowIndex;
7
+ if (value) {
8
+ const indexes = [];
9
+ const columns = table.getVisibleLeafColumns();
10
+ table.getRowModel().rows.forEach((row, rowIndex) => {
11
+ columns.forEach((column, columnIndex) => {
12
+ try {
13
+ if (column.getIsVisible() && column.columnDef.enableGlobalFilter) {
14
+ var _row$original, _column$columnDef$met;
15
+ const cellValue = getCellValueAsString((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original[column.id], (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.dataType);
16
+ if (cellValue !== undefined && isWeakContains(cellValue, value)) {
17
+ indexes.push([rowIndex, columnIndex]);
18
+ }
19
+ }
20
+ } catch (e) {
21
+ //
22
+ }
23
+ });
24
+ });
25
+ tableMeta.search.setHighlightedColumnIndexes(indexes);
26
+ if (indexes.length) {
27
+ firstRowIndex = indexes[0][0];
28
+ tableMeta.search.setCurrentHighlightColumnIndex(0);
29
+ } else {
30
+ tableMeta.search.setCurrentHighlightColumnIndex(undefined);
31
+ }
32
+ } else {
33
+ tableMeta.search.setHighlightedColumnIndexes([]);
34
+ tableMeta.search.setCurrentHighlightColumnIndex(undefined);
35
+ }
36
+ if (firstRowIndex !== undefined) {
37
+ tableMeta.rowActive.setRowActiveIndex(firstRowIndex);
38
+ }
39
+ return firstRowIndex;
40
+ }
41
+
42
+ export { resetHighlightedColumnIndexes };
43
+ //# sourceMappingURL=search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.js","sources":["../../../../../../../../../src/primitives/Table/useTable/util/search.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { getCellValueAsString } from './columns';\nimport { isWeakContains } from './filtering';\n\nexport function resetHighlightedColumnIndexes<TType = unknown>(value: string | undefined, table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n let firstRowIndex: undefined | number;\n\n if (value) {\n const rowIndexes: number[] = [];\n const indexes: number[][] = [];\n const columns = table.getVisibleLeafColumns();\n\n table.getRowModel().rows.forEach((row, rowIndex) => {\n columns.forEach((column, columnIndex) => {\n try {\n if (column.getIsVisible() && column.columnDef.enableGlobalFilter) {\n const cellValue = getCellValueAsString(row.original?.[column.id], column.columnDef.meta?.dataType);\n\n if (cellValue !== undefined && isWeakContains(cellValue, value)) {\n indexes.push([rowIndex, columnIndex]);\n }\n }\n } catch (e) {\n //\n }\n });\n\n if (indexes.length) {\n rowIndexes.push(rowIndex);\n }\n });\n\n tableMeta.search.setHighlightedColumnIndexes(indexes);\n\n if (indexes.length) {\n firstRowIndex = indexes[0][0];\n tableMeta.search.setCurrentHighlightColumnIndex(0);\n } else {\n tableMeta.search.setCurrentHighlightColumnIndex(undefined);\n }\n } else {\n tableMeta.search.setHighlightedColumnIndexes([]);\n tableMeta.search.setCurrentHighlightColumnIndex(undefined);\n }\n\n if (firstRowIndex !== undefined) {\n tableMeta.rowActive.setRowActiveIndex(firstRowIndex);\n }\n\n return firstRowIndex;\n}\n"],"names":["resetHighlightedColumnIndexes","value","table","tableMeta","options","meta","firstRowIndex","indexes","columns","getVisibleLeafColumns","getRowModel","rows","forEach","row","rowIndex","column","columnIndex","getIsVisible","columnDef","enableGlobalFilter","_row$original","_column$columnDef$met","cellValue","getCellValueAsString","original","id","dataType","undefined","isWeakContains","push","e","search","setHighlightedColumnIndexes","length","setCurrentHighlightColumnIndex","rowActive","setRowActiveIndex"],"mappings":";;;SAIgBA,6BAA6BA,CAAkBC,KAAyB,EAAEC,KAAwB;EAC9G,MAAMC,SAAS,GAAGD,KAAK,CAACE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C,2BAA2B,CAAC,EAAE,CAAC;IAChD7B,SAAS,CAAC4B,MAAM,CAACG,8BAA8B,CAACP,SAAS,CAAC;;EAG9D,IAAIrB,aAAa,KAAKqB,SAAS,EAAE;IAC7BxB,SAAS,CAACgC,SAAS,CAACC,iBAAiB,CAAC9B,aAAa,CAAC;;EAGxD,OAAOA,aAAa;AACxB;;;;"}
@@ -0,0 +1,22 @@
1
+ function getSettings(table) {
2
+ const meta = table.options.meta;
3
+ const state = table.getState();
4
+ return {
5
+ //columnFilters: table.options.enableColumnFilters ? state.columnFilters : undefined,
6
+ columnOrder: meta.columnOrdering.isEnabled ? state.columnOrder : undefined,
7
+ columnPinning: state.columnPinning,
8
+ columnSizing: state.columnSizing,
9
+ columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,
10
+ // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel
11
+ excludeUnmatchedRecordsInSearch: meta.search.excludeUnmatchedResults,
12
+ fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,
13
+ grouping: table.options.enableGrouping ? state.grouping : undefined,
14
+ rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,
15
+ showWarningWhenPrintingLargeDataset: meta.printing.isWarningVisibleForLargeDatasets,
16
+ //searchQuery: table.options.enableGlobalFilter ? state.globalFilter : undefined,
17
+ sorting: state.sorting
18
+ };
19
+ }
20
+
21
+ export { getSettings };
22
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sources":["../../../../../../../../../src/primitives/Table/useTable/util/settings.ts"],"sourcesContent":["import { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\n\nexport function getSettings<TType = unknown>(table: ReactTable<TType>) {\n const meta = table.options.meta as ReactTableMeta<TType>;\n const state = table.getState();\n\n return {\n //columnFilters: table.options.enableColumnFilters ? state.columnFilters : undefined,\n columnOrder: meta.columnOrdering.isEnabled ? state.columnOrder : undefined,\n columnPinning: state.columnPinning,\n columnSizing: state.columnSizing,\n columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,\n // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel\n excludeUnmatchedRecordsInSearch: meta.search.excludeUnmatchedResults,\n fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,\n grouping: table.options.enableGrouping ? state.grouping : undefined,\n rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,\n showWarningWhenPrintingLargeDataset: meta.printing.isWarningVisibleForLargeDatasets,\n //searchQuery: table.options.enableGlobalFilter ? state.globalFilter : undefined,\n sorting: state.sorting,\n };\n}\n"],"names":["getSettings","table","meta","options","state","getState","columnOrder","columnOrdering","isEnabled","undefined","columnPinning","columnSizing","columnVisibility","enableHiding","excludeUnmatchedRecordsInSearch","search","excludeUnmatchedResults","fontSize","size","grouping","enableGrouping","rowHeight","height","showWarningWhenPrintingLargeDataset","printing","isWarningVisibleForLargeDatasets","sorting"],"mappings":"SAEgBA,WAAWA,CAAkBC,KAAwB;EACjE,MAAMC,IAAI,GAAGD,KAAK,CAACE,OAAO,CAACD,IAA6B;EACxD,MAAME,KAAK,GAAGH,KAAK,CAACI,QAAQ,EAAE;EAE9B,OAAO;;IAEHC,WAAW,EAAEJ,IAAI,CAACK,cAAc,CAACC,SAAS,GAAGJ,KAAK,CAACE,WAAW,GAAGG,SAAS;IAC1EC,aAAa,EAAEN,KAAK,CAACM,aAAa;IAClCC,YAAY,EAAEP,KAAK,CAACO,YAAY;IAChCC,gBAAgB,EAAEX,KAAK,CAACE,OAAO,CAACU,YAAY,GAAGT,KAAK,CAACQ,gBAAgB,GAAGH,SAAS;;IAEjFK,+BAA+B,EAAEZ,IAAI,CAACa,MAAM,CAACC,uBAAuB;IACpEC,QAAQ,EAAEf,IAAI,CAACe,QAAQ,CAACT,SAAS,GAAGN,IAAI,CAACe,QAAQ,CAACC,IAAI,GAAGT,SAAS;IAClEU,QAAQ,EAAElB,KAAK,CAACE,OAAO,CAACiB,cAAc,GAAGhB,KAAK,CAACe,QAAQ,GAAGV,SAAS;IACnEY,SAAS,EAAEnB,IAAI,CAACmB,SAAS,CAACb,SAAS,GAAGN,IAAI,CAACmB,SAAS,CAACC,MAAM,GAAGb,SAAS;IACvEc,mCAAmC,EAAErB,IAAI,CAACsB,QAAQ,CAACC,gCAAgC;;IAEnFC,OAAO,EAAEtB,KAAK,CAACsB;GAClB;AACL;;;;"}
@@ -0,0 +1,270 @@
1
+ import React__default from 'react';
2
+ import { getCoreRowModel, getExpandedRowModel, getGroupedRowModel, getFilteredRowModel, getSortedRowModel, createColumnHelper } from '@tanstack/react-table';
3
+ import { getSortingFn } from './sorting.js';
4
+ import { ensureOrdering, freezeUptoExternalColumn, unfreezeAllExternalColumns, getCellMinWidth } from './columns.js';
5
+ import { columnFilterFn, globalFilterFn } from './filtering.js';
6
+
7
+ // mapping children to react-table columns
8
+ function processChildren(child, columns, defaultSizing, defaultSorting, defaultVisibility, settings, defaultRowGroupColumnId) {
9
+ const columnHelper = createColumnHelper();
10
+ if ( /*#__PURE__*/React__default.isValidElement(child) && child.props.children) {
11
+ const {
12
+ children,
13
+ id,
14
+ header
15
+ } = child.props;
16
+ columns.push(columnHelper.group({
17
+ id,
18
+ header,
19
+ columns: React__default.Children.toArray(children).reduce((columns, child) => processChildren(child, columns, defaultSizing, defaultSorting, defaultVisibility, settings, defaultRowGroupColumnId), []),
20
+ // we don't want to let column groups be grouped/aggregrated
21
+ enableGrouping: false
22
+ }));
23
+ } else if ( /*#__PURE__*/React__default.isValidElement(child) && (child.props.accessor || child.props.id)) {
24
+ const {
25
+ id,
26
+ accessor: accessorKey = id,
27
+ // renderers
28
+ renderer,
29
+ aggregate,
30
+ footer,
31
+ header,
32
+ // options
33
+ aggregationFn,
34
+ defaultHidden,
35
+ defaultWidth,
36
+ enableFiltering: enableColumnFilter = true,
37
+ enableGrouping = false,
38
+ enableHiding = true,
39
+ enableOrdering = true,
40
+ enablePrinting = true,
41
+ enableResizing = true,
42
+ enableSearch: enableGlobalFilter = true,
43
+ enableSorting = true,
44
+ enableTruncate = false,
45
+ minWidth: minSize = getCellMinWidth(settings.fontSize),
46
+ sort,
47
+ sortFn,
48
+ ...meta
49
+ } = child.props;
50
+ if (defaultHidden && enableHiding) {
51
+ defaultVisibility[id] = false;
52
+ }
53
+ if (defaultWidth) {
54
+ defaultSizing[id] = defaultWidth;
55
+ }
56
+ if (child.props.sort !== undefined) {
57
+ defaultSorting.push({
58
+ id,
59
+ desc: sort === 'desc'
60
+ });
61
+ }
62
+ const isGrouped = defaultRowGroupColumnId === id;
63
+ const column = {
64
+ id,
65
+ accessorKey,
66
+ header: header,
67
+ // features
68
+ enableColumnFilter,
69
+ enableGlobalFilter,
70
+ enableGrouping,
71
+ enableHiding: isGrouped ? false : enableHiding,
72
+ enableResizing,
73
+ enableSorting,
74
+ // config - sizing
75
+ minSize,
76
+ // meta
77
+ meta: {
78
+ ...meta,
79
+ defaultWidth,
80
+ enableOrdering: isGrouped ? false : enableOrdering,
81
+ enablePrinting,
82
+ enableTruncate,
83
+ header
84
+ }
85
+ };
86
+ // renderers
87
+ if (typeof renderer === 'function') {
88
+ column.cell = info => renderer(info.getValue(), info.row.original);
89
+ }
90
+ if (typeof footer === 'function') {
91
+ column.footer = info => footer(info.table.getRowModel().rows.map(row => row.original[id]));
92
+ }
93
+ // config - filtering
94
+ if (enableColumnFilter) {
95
+ column.filterFn = 'tacoFilter';
96
+ }
97
+ // config - grouping/aggregation
98
+ if (enableGrouping) {
99
+ column.aggregationFn = aggregationFn;
100
+ if (typeof aggregate === 'function') {
101
+ column.aggregatedCell = info => aggregate(info.getValue(), info.row.original);
102
+ }
103
+ }
104
+ // config - sorting
105
+ if (enableSorting) {
106
+ column.sortingFn = getSortingFn(child.props.dataType, sortFn);
107
+ column.sortDescFirst = false;
108
+ column.sortUndefined = 1;
109
+ }
110
+ columns.push(column);
111
+ }
112
+ return columns;
113
+ }
114
+ function createInternalColumn(id, column, defaultSizing) {
115
+ if (column.size) {
116
+ defaultSizing[id] = column.size;
117
+ }
118
+ return {
119
+ id,
120
+ accessorKey: id,
121
+ header: column.header,
122
+ cell: column.renderer,
123
+ // features
124
+ enableColumnFilter: false,
125
+ enableGlobalFilter: false,
126
+ enableGrouping: false,
127
+ enableHiding: false,
128
+ enableResizing: false,
129
+ enableSorting: false,
130
+ // config - sizing
131
+ size: column.size,
132
+ minSize: column.size,
133
+ // meta
134
+ meta: {
135
+ ...column.meta,
136
+ enableOrdering: false,
137
+ enablePrinting: false,
138
+ enableTruncate: false
139
+ }
140
+ };
141
+ }
142
+ function mapTableChildrenToColumns(props, settings, options, internalColumns) {
143
+ const {
144
+ children,
145
+ defaultRowGroupColumnId
146
+ } = props;
147
+ const defaultSizing = {};
148
+ const defaultSorting = [];
149
+ const defaultVisibility = {};
150
+ const columns = React__default.Children.toArray(children).reduce((columns, child) => processChildren(child, columns, defaultSizing, defaultSorting, defaultVisibility, settings, defaultRowGroupColumnId), []);
151
+ if (internalColumns) {
152
+ var _props$rowActions;
153
+ if (options.enableRowExpansion && props.rowExpansionRenderer && internalColumns.rowExpansion) {
154
+ const column = createInternalColumn('__expansion', internalColumns.rowExpansion, defaultSizing);
155
+ columns.unshift(column);
156
+ }
157
+ if ((options.enableRowSelection || options.enableRowSelectionSingle) && internalColumns.rowSelection) {
158
+ const column = createInternalColumn('__select', internalColumns.rowSelection, defaultSizing);
159
+ columns.unshift(column);
160
+ }
161
+ if (options.enableRowActions && (_props$rowActions = props.rowActions) !== null && _props$rowActions !== void 0 && _props$rowActions.length && internalColumns.rowActions) {
162
+ const column = createInternalColumn('__actions', internalColumns.rowActions, defaultSizing);
163
+ columns.push(column);
164
+ }
165
+ }
166
+ return {
167
+ columns,
168
+ defaultSizing,
169
+ defaultSorting,
170
+ defaultVisibility
171
+ };
172
+ }
173
+ function configureReactTableOptions(options, props) {
174
+ var _options$enableFilter, _options$enableColumn, _options$enableRowExp, _options$enableColumn2, _options$enableColumn3, _options$enableSortin;
175
+ const enableRowSelection = options.enableRowSelection || options.enableRowSelectionSingle;
176
+ const tableOptions = {
177
+ defaultColumn: {
178
+ enableColumnFilter: options.enableFiltering || true,
179
+ enableGrouping: false,
180
+ enableHiding: options.enableColumnHiding || true,
181
+ enableResizing: options.enableColumnResizing || true,
182
+ enableGlobalFilter: options.enableSearch || true,
183
+ enableSorting: options.enableSorting || true,
184
+ minSize: 1,
185
+ // the default is 150, which is a bit random
186
+ size: 1
187
+ },
188
+ enableColumnFilters: (_options$enableFilter = options.enableFiltering) !== null && _options$enableFilter !== void 0 ? _options$enableFilter : false,
189
+ enableColumnResizing: (_options$enableColumn = options.enableColumnResizing) !== null && _options$enableColumn !== void 0 ? _options$enableColumn : false,
190
+ enableExpanding: (_options$enableRowExp = options.enableRowExpansion) !== null && _options$enableRowExp !== void 0 ? _options$enableRowExp : false,
191
+ enableGrouping: true,
192
+ enableHiding: (_options$enableColumn2 = options.enableColumnHiding) !== null && _options$enableColumn2 !== void 0 ? _options$enableColumn2 : false,
193
+ enablePinning: (_options$enableColumn3 = options.enableColumnFreezing) !== null && _options$enableColumn3 !== void 0 ? _options$enableColumn3 : false,
194
+ enableRowSelection: enableRowSelection !== null && enableRowSelection !== void 0 ? enableRowSelection : false,
195
+ enableMultiRowSelection: options.enableRowSelectionSingle === true ? false : enableRowSelection,
196
+ enableSorting: (_options$enableSortin = options.enableSorting) !== null && _options$enableSortin !== void 0 ? _options$enableSortin : false,
197
+ // models for default features
198
+ getCoreRowModel: getCoreRowModel(),
199
+ getExpandedRowModel: getExpandedRowModel(),
200
+ getGroupedRowModel: getGroupedRowModel(),
201
+ groupedColumnMode: false
202
+ };
203
+ if (tableOptions.enableColumnResizing) {
204
+ tableOptions.columnResizeMode = 'onChange';
205
+ }
206
+ if (tableOptions.enableColumnFilters) {
207
+ // enter controlled filter mode (controlled could be local state, but usually the server)
208
+ if (props.onChangeFilter) ; else {
209
+ tableOptions.getFilteredRowModel = getFilteredRowModel();
210
+ tableOptions.filterFns = {
211
+ tacoFilter: (row, columnId, filter) => columnFilterFn(row.getValue(columnId), filter)
212
+ };
213
+ }
214
+ }
215
+ if (options.enableSearch) {
216
+ // always set these because enableGlobalFilter can be toggled on and off by the user
217
+ tableOptions.getFilteredRowModel = getFilteredRowModel();
218
+ tableOptions.globalFilterFn = globalFilterFn;
219
+ tableOptions.getColumnCanGlobalFilter = column => {
220
+ var _column$columnDef$met, _column$columnDef$met2;
221
+ return (_column$columnDef$met = (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.enableSearch) !== null && _column$columnDef$met !== void 0 ? _column$columnDef$met : true;
222
+ };
223
+ }
224
+ if (tableOptions.enableSorting) {
225
+ // enter controlled sort mode (controlled could be local state, but usually the server)
226
+ if (props.onChangeSort) {
227
+ tableOptions.manualSorting = true;
228
+ // tableOptions.onSortingChange = ...
229
+ // we don't set this because it expects state to be maintained externally, and we don't want
230
+ // consumers to control state outside the table. instead we have a listener that calls onSort
231
+ } else {
232
+ tableOptions.getSortedRowModel = getSortedRowModel();
233
+ }
234
+ }
235
+ return tableOptions;
236
+ }
237
+ function useReactTableInitialState(props, columns, persistedSettings, defaults) {
238
+ return React__default.useMemo(() => {
239
+ var _persistedSettings$co, _props$defaultSetting, _ref, _persistedSettings$co2, _props$defaultSetting2, _columnPinning$left, _ref2, _persistedSettings$co3, _props$defaultSetting3, _ref3, _ref4, _persistedSettings$co4, _props$defaultSetting4, _ref5, _ref6, _persistedSettings$co5, _props$defaultSetting5, _persistedSettings$se, _props$defaultSetting6, _props$defaultSetting7, _props$defaultSetting8, _ref7, _persistedSettings$gr, _persistedSettings$gr2, _props$defaultSetting9, _props$defaultSetting10;
240
+ const ignoreNotDefinedColumns = column => columns.find(definedColumn => definedColumn.id === column.id);
241
+ const columnOrder = ensureOrdering(columns, (_persistedSettings$co = persistedSettings.columnOrder) !== null && _persistedSettings$co !== void 0 ? _persistedSettings$co : (_props$defaultSetting = props.defaultSettings) === null || _props$defaultSetting === void 0 ? void 0 : _props$defaultSetting.columnOrder);
242
+ const columnPinning = (_ref = (_persistedSettings$co2 = persistedSettings.columnPinning) !== null && _persistedSettings$co2 !== void 0 ? _persistedSettings$co2 : (_props$defaultSetting2 = props.defaultSettings) === null || _props$defaultSetting2 === void 0 ? void 0 : _props$defaultSetting2.columnPinning) !== null && _ref !== void 0 ? _ref : {};
243
+ // ensure internal columns are pinned
244
+ if (!(columnPinning !== null && columnPinning !== void 0 && (_columnPinning$left = columnPinning.left) !== null && _columnPinning$left !== void 0 && _columnPinning$left.length)) {
245
+ if (props.defaultColumnFreezingIndex) {
246
+ columnPinning.left = freezeUptoExternalColumn(props.defaultColumnFreezingIndex, columnOrder);
247
+ } else {
248
+ columnPinning.left = unfreezeAllExternalColumns(columnOrder);
249
+ }
250
+ }
251
+ const state = {
252
+ columnFilters: (_ref2 = (_persistedSettings$co3 = persistedSettings.columnFilters) !== null && _persistedSettings$co3 !== void 0 ? _persistedSettings$co3 : (_props$defaultSetting3 = props.defaultSettings) === null || _props$defaultSetting3 === void 0 ? void 0 : _props$defaultSetting3.columnFilters) !== null && _ref2 !== void 0 ? _ref2 : [],
253
+ columnOrder,
254
+ columnPinning,
255
+ columnSizing: (_ref3 = (_ref4 = (_persistedSettings$co4 = persistedSettings.columnSizing) !== null && _persistedSettings$co4 !== void 0 ? _persistedSettings$co4 : (_props$defaultSetting4 = props.defaultSettings) === null || _props$defaultSetting4 === void 0 ? void 0 : _props$defaultSetting4.columnSizing) !== null && _ref4 !== void 0 ? _ref4 : defaults.defaultSizing) !== null && _ref3 !== void 0 ? _ref3 : {},
256
+ columnVisibility: (_ref5 = (_ref6 = (_persistedSettings$co5 = persistedSettings.columnVisibility) !== null && _persistedSettings$co5 !== void 0 ? _persistedSettings$co5 : (_props$defaultSetting5 = props.defaultSettings) === null || _props$defaultSetting5 === void 0 ? void 0 : _props$defaultSetting5.columnVisibility) !== null && _ref6 !== void 0 ? _ref6 : defaults.defaultVisibility) !== null && _ref5 !== void 0 ? _ref5 : {},
257
+ globalFilter: (_persistedSettings$se = persistedSettings.searchQuery) !== null && _persistedSettings$se !== void 0 ? _persistedSettings$se : (_props$defaultSetting6 = props.defaultSettings) === null || _props$defaultSetting6 === void 0 ? void 0 : _props$defaultSetting6.searchQuery,
258
+ sorting: persistedSettings.sorting ? persistedSettings.sorting.filter(ignoreNotDefinedColumns) : (_props$defaultSetting7 = (_props$defaultSetting8 = props.defaultSettings) === null || _props$defaultSetting8 === void 0 ? void 0 : _props$defaultSetting8.sorting) !== null && _props$defaultSetting7 !== void 0 ? _props$defaultSetting7 : defaults.defaultSorting
259
+ };
260
+ if ((_ref7 = (_persistedSettings$gr = (_persistedSettings$gr2 = persistedSettings.grouping) === null || _persistedSettings$gr2 === void 0 ? void 0 : _persistedSettings$gr2.length) !== null && _persistedSettings$gr !== void 0 ? _persistedSettings$gr : (_props$defaultSetting9 = props.defaultSettings) === null || _props$defaultSetting9 === void 0 ? void 0 : (_props$defaultSetting10 = _props$defaultSetting9.grouping) === null || _props$defaultSetting10 === void 0 ? void 0 : _props$defaultSetting10.length) !== null && _ref7 !== void 0 ? _ref7 : props.defaultRowGroupColumnId) {
261
+ state.grouping = [props.defaultRowGroupColumnId];
262
+ // row groups should (all) always be expanded by default
263
+ state.expanded = true;
264
+ }
265
+ return state;
266
+ }, []);
267
+ }
268
+
269
+ export { configureReactTableOptions, mapTableChildrenToColumns, useReactTableInitialState };
270
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.js","sources":["../../../../../../../../../src/primitives/Table/useTable/util/setup.ts"],"sourcesContent":["import React from 'react';\nimport {\n createColumnHelper,\n getCoreRowModel,\n getExpandedRowModel,\n getFilteredRowModel,\n getGroupedRowModel,\n getSortedRowModel,\n TableOptions as ReactTableOptions,\n Row as ReactTableRow,\n Column as ReactTableColumn,\n ColumnDef as ReactTableColumnDef,\n ColumnPinningState as ReactTableColumnPinningState,\n ColumnSizingState as ReactTableColumnSizingState,\n ColumnSort as ReactTableColumnSort,\n TableState as ReactTableState,\n VisibilityState as ReactTableVisibilityState,\n} from '@tanstack/react-table';\nimport {\n TableColumnProps,\n TableFeatureProps,\n TableGroupProps,\n useTableProps,\n TableSettings,\n useTableInternalColumns,\n useTableInternalColumn,\n} from '../../types';\nimport { getSortingFn } from './sorting';\nimport { ensureOrdering, freezeUptoExternalColumn, getCellMinWidth, unfreezeAllExternalColumns } from './columns';\nimport { columnFilterFn, globalFilterFn } from './filtering';\n\n// mapping children to react-table columns\nfunction processChildren<TType>(\n child: React.ReactChild | React.ReactFragment | React.ReactPortal,\n columns: ReactTableColumnDef<TType>[],\n defaultSizing: ReactTableColumnSizingState,\n defaultSorting: ReactTableColumnSort[],\n defaultVisibility: ReactTableVisibilityState,\n settings: TableSettings,\n defaultRowGroupColumnId?: keyof TType\n): ReactTableColumnDef<TType>[] {\n const columnHelper = createColumnHelper<TType>();\n\n if (React.isValidElement<TableGroupProps>(child) && child.props.children) {\n const { children, id, header } = child.props;\n\n columns.push(\n columnHelper.group({\n id,\n header,\n columns: React.Children.toArray(children).reduce(\n (columns: ReactTableColumnDef<TType>[], child) =>\n processChildren<TType>(\n child,\n columns,\n defaultSizing,\n defaultSorting,\n defaultVisibility,\n settings,\n defaultRowGroupColumnId\n ),\n []\n ),\n // we don't want to let column groups be grouped/aggregrated\n enableGrouping: false,\n })\n );\n } else if (React.isValidElement<TableColumnProps<TType>>(child) && (child.props.accessor || child.props.id)) {\n const {\n id,\n accessor: accessorKey = id,\n // renderers\n renderer,\n aggregate,\n footer,\n header,\n // options\n aggregationFn,\n defaultHidden,\n defaultWidth,\n enableFiltering: enableColumnFilter = true,\n enableGrouping = false,\n enableHiding = true,\n enableOrdering = true,\n enablePrinting = true,\n enableResizing = true,\n enableSearch: enableGlobalFilter = true,\n enableSorting = true,\n enableTruncate = false,\n minWidth: minSize = getCellMinWidth(settings.fontSize),\n sort,\n sortFn,\n ...meta\n } = child.props;\n\n if (defaultHidden && enableHiding) {\n defaultVisibility[id] = false;\n }\n\n if (defaultWidth) {\n defaultSizing[id] = defaultWidth as any;\n }\n\n if (child.props.sort !== undefined) {\n defaultSorting.push({\n id,\n desc: sort === 'desc',\n });\n }\n\n const isGrouped = defaultRowGroupColumnId === id;\n\n const column: ReactTableColumnDef<TType, any> = {\n id,\n accessorKey,\n header: header,\n // features\n enableColumnFilter,\n enableGlobalFilter,\n enableGrouping,\n enableHiding: isGrouped ? false : enableHiding,\n enableResizing,\n enableSorting,\n // config - sizing\n minSize,\n // meta\n meta: {\n ...(meta as any),\n defaultWidth,\n enableOrdering: isGrouped ? false : enableOrdering,\n enablePrinting,\n enableTruncate,\n header,\n },\n };\n\n // renderers\n if (typeof renderer === 'function') {\n column.cell = info => renderer(info.getValue(), info.row.original);\n }\n\n if (typeof footer === 'function') {\n column.footer = info => footer(info.table.getRowModel().rows.map(row => row.original[id]));\n }\n\n // config - filtering\n if (enableColumnFilter) {\n column.filterFn = 'tacoFilter' as any;\n }\n\n // config - grouping/aggregation\n if (enableGrouping) {\n column.aggregationFn = aggregationFn;\n\n if (typeof aggregate === 'function') {\n column.aggregatedCell = info => aggregate(info.getValue(), info.row.original);\n }\n }\n\n // config - sorting\n if (enableSorting) {\n column.sortingFn = getSortingFn<TType>(child.props.dataType, sortFn);\n column.sortDescFirst = false;\n column.sortUndefined = 1;\n }\n\n columns.push(column);\n }\n\n return columns;\n}\n\nfunction createInternalColumn<TType = unknown>(\n id: string,\n column: useTableInternalColumn<TType>,\n defaultSizing: ReactTableColumnSizingState\n) {\n if (column.size) {\n defaultSizing[id] = column.size;\n }\n\n return {\n id,\n accessorKey: id,\n header: column.header,\n cell: column.renderer,\n // features\n enableColumnFilter: false,\n enableGlobalFilter: false,\n enableGrouping: false,\n enableHiding: false,\n enableResizing: false,\n enableSorting: false,\n // config - sizing\n size: column.size,\n minSize: column.size,\n // meta\n meta: {\n ...(column.meta as any),\n enableOrdering: false,\n enablePrinting: false,\n enableTruncate: false,\n },\n } as ReactTableColumnDef<TType, any>;\n}\n\nexport function mapTableChildrenToColumns<TType = unknown>(\n props: useTableProps<TType>,\n settings: TableSettings,\n options: TableFeatureProps,\n internalColumns?: useTableInternalColumns<TType>\n) {\n const { children, defaultRowGroupColumnId } = props;\n const defaultSizing: ReactTableColumnSizingState = {};\n const defaultSorting: ReactTableColumnSort[] = [];\n const defaultVisibility: ReactTableVisibilityState = {};\n\n const columns = React.Children.toArray(children).reduce(\n (columns: ReactTableColumnDef<TType>[], child) =>\n processChildren<TType>(\n child,\n columns,\n defaultSizing,\n defaultSorting,\n defaultVisibility,\n settings,\n defaultRowGroupColumnId\n ),\n\n []\n );\n\n if (internalColumns) {\n if (options.enableRowExpansion && props.rowExpansionRenderer && internalColumns.rowExpansion) {\n const column = createInternalColumn<TType>('__expansion', internalColumns.rowExpansion, defaultSizing);\n columns.unshift(column);\n }\n\n if ((options.enableRowSelection || options.enableRowSelectionSingle) && internalColumns.rowSelection) {\n const column = createInternalColumn<TType>('__select', internalColumns.rowSelection, defaultSizing);\n columns.unshift(column);\n }\n\n if (options.enableRowActions && props.rowActions?.length && internalColumns.rowActions) {\n const column = createInternalColumn<TType>('__actions', internalColumns.rowActions, defaultSizing);\n columns.push(column);\n }\n }\n\n return { columns, defaultSizing, defaultSorting, defaultVisibility };\n}\n\nexport function configureReactTableOptions<TType = unknown>(options: TableFeatureProps, props: useTableProps<TType>) {\n const enableRowSelection = options.enableRowSelection || options.enableRowSelectionSingle;\n const tableOptions: Partial<ReactTableOptions<TType>> = {\n defaultColumn: {\n enableColumnFilter: options.enableFiltering || true,\n enableGrouping: false,\n enableHiding: options.enableColumnHiding || true,\n enableResizing: options.enableColumnResizing || true,\n enableGlobalFilter: options.enableSearch || true,\n enableSorting: options.enableSorting || true,\n minSize: 1,\n // the default is 150, which is a bit random\n size: 1,\n },\n enableColumnFilters: options.enableFiltering ?? false,\n enableColumnResizing: options.enableColumnResizing ?? false,\n enableExpanding: options.enableRowExpansion ?? false,\n enableGrouping: true, // users can't customise row grouping, so it can just be always enabled and left to the defaultRowGroupColumnId prop\n enableHiding: options.enableColumnHiding ?? false,\n enablePinning: options.enableColumnFreezing ?? false,\n enableRowSelection: enableRowSelection ?? false,\n enableMultiRowSelection: options.enableRowSelectionSingle === true ? false : enableRowSelection,\n enableSorting: options.enableSorting ?? false,\n // models for default features\n getCoreRowModel: getCoreRowModel(),\n getExpandedRowModel: getExpandedRowModel(),\n getGroupedRowModel: getGroupedRowModel(),\n groupedColumnMode: false,\n };\n\n if (tableOptions.enableColumnResizing) {\n tableOptions.columnResizeMode = 'onChange';\n }\n\n if (tableOptions.enableColumnFilters) {\n // enter controlled filter mode (controlled could be local state, but usually the server)\n if (props.onChangeFilter) {\n // tableOptions.manualFiltering = true;\n // we don't set it because it breaks global filtering (used for search, which is fully client side)\n //\n // tableOptions.onColumnFiltersChange = ...\n // we don't set this because it expects state to be maintained externally, and we don't want\n // consumers to control state outside the table. instead we have a listener that calls onFilter\n } else {\n tableOptions.getFilteredRowModel = getFilteredRowModel();\n tableOptions.filterFns = {\n tacoFilter: (row: ReactTableRow<TType>, columnId: string, filter: any) =>\n columnFilterFn(row.getValue(columnId), filter),\n };\n }\n }\n\n if (options.enableSearch) {\n // always set these because enableGlobalFilter can be toggled on and off by the user\n tableOptions.getFilteredRowModel = getFilteredRowModel();\n tableOptions.globalFilterFn = globalFilterFn;\n tableOptions.getColumnCanGlobalFilter = (column: ReactTableColumn<TType>) => column.columnDef.meta?.enableSearch ?? true;\n\n // enter controlled search mode (controlled could be local state, but usually the server)\n if (props.onChangeSearch) {\n // tableOptions.manualFiltering = true;\n // we don't set this because controlled search is not currently supported, search is always client side\n //\n // tableOptions.onGlobalFilterChange = ...\n // we don't set this because it expects state to be maintained externally, and we don't want\n // consumers to control state outside the table. instead we have a listener that calls onSearch.\n //\n // we also don't always filter when searching, we have the highlight functionality as the default\n // and filtering can be toggled by the user\n }\n }\n\n if (tableOptions.enableSorting) {\n // enter controlled sort mode (controlled could be local state, but usually the server)\n if (props.onChangeSort) {\n tableOptions.manualSorting = true;\n\n // tableOptions.onSortingChange = ...\n // we don't set this because it expects state to be maintained externally, and we don't want\n // consumers to control state outside the table. instead we have a listener that calls onSort\n } else {\n tableOptions.getSortedRowModel = getSortedRowModel();\n }\n }\n\n return tableOptions;\n}\n\nexport function useReactTableInitialState<TType = unknown>(\n props: useTableProps<TType>,\n columns: ReactTableColumnDef<TType>[],\n persistedSettings: TableSettings,\n defaults: {\n defaultSizing: ReactTableColumnSizingState;\n defaultSorting: ReactTableColumnSort[];\n defaultVisibility: ReactTableVisibilityState;\n }\n): Partial<ReactTableState> {\n return React.useMemo(() => {\n const ignoreNotDefinedColumns = column => columns.find(definedColumn => definedColumn.id === column.id);\n\n const columnOrder = ensureOrdering<TType>(columns, persistedSettings.columnOrder ?? props.defaultSettings?.columnOrder);\n\n const columnPinning: ReactTableColumnPinningState =\n persistedSettings.columnPinning ?? props.defaultSettings?.columnPinning ?? {};\n\n // ensure internal columns are pinned\n if (!columnPinning?.left?.length) {\n if (props.defaultColumnFreezingIndex) {\n columnPinning.left = freezeUptoExternalColumn(props.defaultColumnFreezingIndex, columnOrder);\n } else {\n columnPinning.left = unfreezeAllExternalColumns(columnOrder);\n }\n }\n\n const state: Partial<ReactTableState> = {\n columnFilters: persistedSettings.columnFilters ?? props.defaultSettings?.columnFilters ?? [],\n columnOrder,\n columnPinning,\n columnSizing: persistedSettings.columnSizing ?? props.defaultSettings?.columnSizing ?? defaults.defaultSizing ?? {},\n columnVisibility:\n persistedSettings.columnVisibility ?? props.defaultSettings?.columnVisibility ?? defaults.defaultVisibility ?? {},\n globalFilter: persistedSettings.searchQuery ?? props.defaultSettings?.searchQuery,\n sorting: persistedSettings.sorting\n ? persistedSettings.sorting.filter(ignoreNotDefinedColumns)\n : props.defaultSettings?.sorting ?? defaults.defaultSorting,\n };\n\n if (persistedSettings.grouping?.length ?? props.defaultSettings?.grouping?.length ?? props.defaultRowGroupColumnId) {\n state.grouping = [props.defaultRowGroupColumnId as string];\n // row groups should (all) always be expanded by default\n state.expanded = true;\n }\n\n return state;\n }, []);\n}\n"],"names":["processChildren","child","columns","defaultSizing","defaultSorting","defaultVisibility","settings","defaultRowGroupColumnId","columnHelper","createColumnHelper","React","isValidElement","props","children","id","header","push","group","Children","toArray","reduce","enableGrouping","accessor","accessorKey","renderer","aggregate","footer","aggregationFn","defaultHidden","defaultWidth","enableFiltering","enableColumnFilter","enableHiding","enableOrdering","enablePrinting","enableResizing","enableSearch","enableGlobalFilter","enableSorting","enableTruncate","minWidth","minSize","getCellMinWidth","fontSize","sort","sortFn","meta","undefined","desc","isGrouped","column","cell","info","getValue","row","original","table","getRowModel","rows","map","filterFn","aggregatedCell","sortingFn","getSortingFn","dataType","sortDescFirst","sortUndefined","createInternalColumn","size","mapTableChildrenToColumns","options","internalColumns","_props$rowActions","enableRowExpansion","rowExpansionRenderer","rowExpansion","unshift","enableRowSelection","enableRowSelectionSingle","rowSelection","enableRowActions","rowActions","length","configureReactTableOptions","tableOptions","defaultColumn","enableColumnHiding","enableColumnResizing","enableColumnFilters","_options$enableFilter","_options$enableColumn","enableExpanding","_options$enableRowExp","_options$enableColumn2","enablePinning","_options$enableColumn3","enableColumnFreezing","enableMultiRowSelection","_options$enableSortin","getCoreRowModel","getExpandedRowModel","getGroupedRowModel","groupedColumnMode","columnResizeMode","onChangeFilter","getFilteredRowModel","filterFns","tacoFilter","columnId","filter","columnFilterFn","globalFilterFn","getColumnCanGlobalFilter","_column$columnDef$met","_column$columnDef$met2","columnDef","onChangeSort","manualSorting","getSortedRowModel","useReactTableInitialState","persistedSettings","defaults","useMemo","ignoreNotDefinedColumns","find","definedColumn","columnOrder","ensureOrdering","_persistedSettings$co","_props$defaultSetting","defaultSettings","columnPinning","_ref","_persistedSettings$co2","_props$defaultSetting2","_columnPinning$left","left","defaultColumnFreezingIndex","freezeUptoExternalColumn","unfreezeAllExternalColumns","state","columnFilters","_ref2","_persistedSettings$co3","_props$defaultSetting3","columnSizing","_ref3","_ref4","_persistedSettings$co4","_props$defaultSetting4","columnVisibility","_ref5","_ref6","_persistedSettings$co5","_props$defaultSetting5","globalFilter","_persistedSettings$se","searchQuery","_props$defaultSetting6","sorting","_props$defaultSetting7","_props$defaultSetting8","_ref7","_persistedSettings$gr","_persistedSettings$gr2","grouping","_props$defaultSetting9","_props$defaultSetting10","expanded"],"mappings":";;;;;;AA+BA;AACA,SAASA,eAAeA,CACpBC,KAAiE,EACjEC,OAAqC,EACrCC,aAA0C,EAC1CC,cAAsC,EACtCC,iBAA4C,EAC5CC,QAAuB,EACvBC,uBAAqC;EAErC,MAAMC,YAAY,GAAGC,kBAAkB,EAAS;EAEhD,kBAAIC,cAAK,CAACC,cAAc,CAAkBV,KAAK,CAAC,IAAIA,KAAK,CAACW,KAAK,CAACC,QAAQ,EAAE;IACtE,MAAM;MAAEA,QAAQ;MAAEC,EAAE;MAAEC;KAAQ,GAAGd,KAAK,CAACW,KAAK;IAE5CV,OAAO,CAACc,IAAI,CACRR,YAAY,CAACS,KAAK,CAAC;MACfH,EAAE;MACFC,MAAM;MACNb,OAAO,EAAEQ,cAAK,CAACQ,QAAQ,CAACC,OAAO,CAACN,QAAQ,CAAC,CAACO,MAAM,CAC5C,CAAClB,OAAqC,EAAED,KAAK,KACzCD,eAAe,CACXC,KAAK,EACLC,OAAO,EACPC,aAAa,EACbC,cAAc,EACdC,iBAAiB,EACjBC,QAAQ,EACRC,uBAAuB,CAC1B,EACL,EAAE,CACL;;MAEDc,cAAc,EAAE;KACnB,CAAC,CACL;GACJ,MAAM,kBAAIX,cAAK,CAACC,cAAc,CAA0BV,KAAK,CAAC,KAAKA,KAAK,CAACW,KAAK,CAACU,QAAQ,IAAIrB,KAAK,CAACW,KAAK,CAACE,EAAE,CAAC,EAAE;IACzG,MAAM;MACFA,EAAE;MACFQ,QAAQ,EAAEC,WAAW,GAAGT,EAAE;;MAE1BU,QAAQ;MACRC,SAAS;MACTC,MAAM;M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AAAA,KAAA,GAAI/B,QAAQ,CAACpH,iBAAiB,cAAAkJ,KAAA,cAAAA,KAAA,GAAI,EAAE;MACrHI,YAAY,GAAAC,qBAAA,GAAEpC,iBAAiB,CAACqC,WAAW,cAAAD,qBAAA,cAAAA,qBAAA,IAAAE,sBAAA,GAAIlJ,KAAK,CAACsH,eAAe,cAAA4B,sBAAA,uBAArBA,sBAAA,CAAuBD,WAAW;MACjFE,OAAO,EAAEvC,iBAAiB,CAACuC,OAAO,GAC5BvC,iBAAiB,CAACuC,OAAO,CAAClD,MAAM,CAACc,uBAAuB,CAAC,IAAAqC,sBAAA,IAAAC,sBAAA,GACzDrJ,KAAK,CAACsH,eAAe,cAAA+B,sBAAA,uBAArBA,sBAAA,CAAuBF,OAAO,cAAAC,sBAAA,cAAAA,sBAAA,GAAIvC,QAAQ,CAACrH;KACpD;IAED,KAAA8J,KAAA,IAAAC,qBAAA,IAAAC,sBAAA,GAAI5C,iBAAiB,CAAC6C,QAAQ,cAAAD,sBAAA,uBAA1BA,sBAAA,CAA4BlF,MAAM,cAAAiF,qBAAA,cAAAA,qBAAA,IAAAG,sBAAA,GAAI1J,KAAK,CAACsH,eAAe,cAAAoC,sBAAA,wBAAAC,uBAAA,GAArBD,sBAAA,CAAuBD,QAAQ,cAAAE,uBAAA,uBAA/BA,uBAAA,CAAiCrF,MAAM,cAAAgF,KAAA,cAAAA,KAAA,GAAItJ,KAAK,CAACL,uBAAuB,EAAE;MAChHqI,KAAK,CAACyB,QAAQ,GAAG,CAACzJ,KAAK,CAACL,uBAAiC,CAAC;;MAE1DqI,KAAK,CAAC4B,QAAQ,GAAG,IAAI;;IAGzB,OAAO5B,KAAK;GACf,EAAE,EAAE,CAAC;AACV;;;;"}
@@ -0,0 +1,18 @@
1
+ function getSortingFn(dataType, customFnOrBuiltIn) {
2
+ if (typeof customFnOrBuiltIn === 'function') {
3
+ return (rowA, rowB, columnId) => customFnOrBuiltIn(rowA.original, rowB.original, columnId);
4
+ }
5
+ // if a built in is being used, just return that
6
+ if (customFnOrBuiltIn) {
7
+ return customFnOrBuiltIn;
8
+ }
9
+ // some times we alias based on the type
10
+ if (dataType && dataType !== 'boolean' && dataType !== 'number') {
11
+ return dataType;
12
+ }
13
+ // otherwise fall back to auto
14
+ return 'auto';
15
+ }
16
+
17
+ export { getSortingFn };
18
+ //# sourceMappingURL=sorting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sorting.js","sources":["../../../../../../../../../src/primitives/Table/useTable/util/sorting.ts"],"sourcesContent":["import { TableColumnDataType, TableColumnSortFn } from '../../types';\n\nexport function getSortingFn<TType = unknown>(dataType?: TableColumnDataType, customFnOrBuiltIn?: TableColumnSortFn<TType>) {\n if (typeof customFnOrBuiltIn === 'function') {\n return (rowA, rowB, columnId) => customFnOrBuiltIn(rowA.original, rowB.original, columnId);\n }\n\n // if a built in is being used, just return that\n if (customFnOrBuiltIn) {\n return customFnOrBuiltIn;\n }\n\n // some times we alias based on the type\n if (dataType && dataType !== 'boolean' && dataType !== 'number') {\n return dataType;\n }\n\n // otherwise fall back to auto\n return 'auto';\n}\n"],"names":["getSortingFn","dataType","customFnOrBuiltIn","rowA","rowB","columnId","original"],"mappings":"SAEgBA,YAAYA,CAAkBC,QAA8B,EAAEC,iBAA4C;EACtH,IAAI,OAAOA,iBAAiB,KAAK,UAAU,EAAE;IACzC,OAAO,CAACC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,KAAKH,iBAAiB,CAACC,IAAI,CAACG,QAAQ,EAAEF,IAAI,CAACE,QAAQ,EAAED,QAAQ,CAAC;;;EAI9F,IAAIH,iBAAiB,EAAE;IACnB,OAAOA,iBAAiB;;;EAI5B,IAAID,QAAQ,IAAIA,QAAQ,KAAK,SAAS,IAAIA,QAAQ,KAAK,QAAQ,EAAE;IAC7D,OAAOA,QAAQ;;;EAInB,OAAO,MAAM;AACjB;;;;"}
@@ -43,6 +43,10 @@ function isElementInsideOrTriggeredFromContainer(element, container) {
43
43
  }
44
44
  return !!(container !== null && container !== void 0 && container.contains(element));
45
45
  }
46
+ function isEventTriggeredOnInteractiveElement(eventTarget) {
47
+ const element = eventTarget;
48
+ return ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL', 'OPTION'].includes(element.tagName) && !element.hidden && !element.disabled && !element.readOnly;
49
+ }
46
50
 
47
- export { getIndexOfFirstChildOverflowingParent, getNextFocussableElement, isElementInsideOrTriggeredFromContainer };
51
+ export { getIndexOfFirstChildOverflowingParent, getNextFocussableElement, isElementInsideOrTriggeredFromContainer, isEventTriggeredOnInteractiveElement };
48
52
  //# sourceMappingURL=dom.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dom.js","sources":["../../../../../../src/utils/dom.ts"],"sourcesContent":["export const isOverflowing = (element: HTMLElement | null) =>\n element !== null ? element.scrollWidth > element.offsetWidth : false;\n\nexport const getIndexOfFirstChildOverflowingParent = (element: HTMLElement, overscan = 0) => {\n let index = 0;\n let boundaryChildIndex: number | null = null;\n const clientRect = element.getBoundingClientRect();\n\n for (const child of Array.from(element.children)) {\n const right = child.getBoundingClientRect().right - clientRect.left;\n const width = clientRect.width - overscan;\n\n if (right > width) {\n boundaryChildIndex = index;\n break;\n }\n index++;\n }\n\n return boundaryChildIndex;\n};\n\nexport const getNextFocussableElement = (currentElement: HTMLElement | null) => {\n if (!currentElement) {\n return null;\n }\n\n const focussableElements = [\n ...document.querySelectorAll<HTMLElement>(\n 'button:not([disabled]), [href]:not(link):not(script), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]):not([disabled]), details:not([disabled]), summary:not(:disabled)'\n ),\n ];\n const currentElementIndex = focussableElements.indexOf(currentElement);\n\n // If the currentElement is not in the focussable elements list or it is the last element\n if (currentElementIndex !== -1 && currentElementIndex === focussableElements.length - 1) {\n return null;\n }\n\n return focussableElements[currentElementIndex + 1];\n};\n\nconst getOverlaySelector = (element: Element | null) => {\n switch (element?.getAttribute('role')) {\n case 'dialog':\n return `[aria-controls='${element.id}']`;\n\n case 'menu':\n return `#${element.getAttribute('aria-labelledby')}`;\n\n default:\n return undefined;\n }\n};\n\nexport function isElementInsideOrTriggeredFromContainer(element: Element | null, container: Element | null) {\n const selector = getOverlaySelector(element) ?? getOverlaySelector(element?.closest('[role=dialog],[role=menu]') ?? null);\n\n if (selector) {\n return !!container?.querySelector(selector);\n }\n\n return !!container?.contains(element);\n}\n"],"names":["getIndexOfFirstChildOverflowingParent","element","overscan","index","boundaryChildIndex","clientRect","getBoundingClientRect","child","Array","from","children","right","left","width","getNextFocussableElement","currentElement","focussableElements","document","querySelectorAll","currentElementIndex","indexOf","length","getOverlaySelector","getAttribute","id","undefined","isElementInsideOrTriggeredFromContainer","container","selector","_getOverlaySelector","_element$closest","closest","querySelector","contains"],"mappings":"MAGaA,qCAAqC,GAAGA,CAACC,OAAoB,EAAEC,QAAQ,GAAG,CAAC;EACpF,IAAIC,KAAK,GAAG,CAAC;EACb,IAAIC,kBAAkB,GAAkB,IAAI;EAC5C,MAAMC,UAAU,GAAGJ,OAAO,CAACK,qBAAqB,EAAE;EAElD,KAAK,MAAMC,KAAK,IAAIC,KAAK,CAACC,IAAI,CAACR,OAAO,CAACS,QAAQ,CAAC,EAAE;IAC9C,MAAMC,KAAK,GAAGJ,KAAK,CAACD,qBAAqB,EAAE,CAACK,KAAK,GAAGN,UAAU,CAACO,IAAI;IACnE,MAAMC,KAAK,GAAGR,UAAU,CAACQ,KAAK,GAAGX,QAAQ;IAEzC,IAAIS,KAAK,GAAGE,KAAK,EAAE;MACfT,kBAAkB,GAAGD,KAAK;MAC1B;;IAEJA,KAAK,EAAE;;EAGX,OAAOC,kBAAkB;AAC7B;MAEaU,wBAAwB,GAAIC,cAAkC;EACvE,IAAI,CAACA,cAAc,EAAE;IACjB,OAAO,IAAI;;EAGf,MAAMC,kBAAkB,GAAG,CACvB,GAAGC,QAAQ,CAACC,gBAAgB,CACxB,iOAAiO,CACpO,CACJ;EACD,MAAMC,mBAAmB,GAAGH,kBAAkB,CAACI,OAAO,CAACL,cAAc,CAAC;;EAGtE,IAAII,mBAAmB,KAAK,CAAC,CAAC,IAAIA,mBAAmB,KAAKH,kBAAkB,CAACK,MAAM,GAAG,CAAC,EAAE;IACrF,OAAO,IAAI;;EAGf,OAAOL,kBAAkB,CAACG,mBAAmB,GAAG,CAAC,CAAC;AACtD;AAEA,MAAMG,kBAAkB,GAAIrB,OAAuB;EAC/C,QAAQA,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEsB,YAAY,CAAC,MAAM,CAAC;IACjC,KAAK,QAAQ;MACT,0BAA0BtB,OAAO,CAACuB,MAAM;IAE5C,KAAK,MAAM;MACP,WAAWvB,OAAO,CAACsB,YAAY,CAAC,iBAAiB,GAAG;IAExD;MACI,OAAOE,SAAS;;AAE5B,CAAC;SAEeC,uCAAuCA,CAACzB,OAAuB,EAAE0B,SAAyB;;EACtG,MAAMC,QAAQ,IAAAC,mBAAA,GAAGP,kBAAkB,CAACrB,OAAO,CAAC,cAAA4B,mBAAA,cAAAA,mBAAA,GAAIP,kBAAkB,EAAAQ,gBAAA,GAAC7B,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAE8B,OAAO,CAAC,2BAA2B,CAAC,cAAAD,gBAAA,cAAAA,gBAAA,GAAI,IAAI,CAAC;EAEzH,IAAIF,QAAQ,EAAE;IACV,OAAO,CAAC,EAACD,SAAS,aAATA,SAAS,eAATA,SAAS,CAAEK,aAAa,CAACJ,QAAQ,CAAC;;EAG/C,OAAO,CAAC,EAACD,SAAS,aAATA,SAAS,eAATA,SAAS,CAAEM,QAAQ,CAAChC,OAAO,CAAC;AACzC;;;;"}
1
+ {"version":3,"file":"dom.js","sources":["../../../../../../src/utils/dom.ts"],"sourcesContent":["export const isOverflowing = (element: HTMLElement | null) =>\n element !== null ? element.scrollWidth > element.offsetWidth : false;\n\nexport const getIndexOfFirstChildOverflowingParent = (element: HTMLElement, overscan = 0) => {\n let index = 0;\n let boundaryChildIndex: number | null = null;\n const clientRect = element.getBoundingClientRect();\n\n for (const child of Array.from(element.children)) {\n const right = child.getBoundingClientRect().right - clientRect.left;\n const width = clientRect.width - overscan;\n\n if (right > width) {\n boundaryChildIndex = index;\n break;\n }\n index++;\n }\n\n return boundaryChildIndex;\n};\n\nexport const getNextFocussableElement = (currentElement: HTMLElement | null) => {\n if (!currentElement) {\n return null;\n }\n\n const focussableElements = [\n ...document.querySelectorAll<HTMLElement>(\n 'button:not([disabled]), [href]:not(link):not(script), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]):not([disabled]), details:not([disabled]), summary:not(:disabled)'\n ),\n ];\n const currentElementIndex = focussableElements.indexOf(currentElement);\n\n // If the currentElement is not in the focussable elements list or it is the last element\n if (currentElementIndex !== -1 && currentElementIndex === focussableElements.length - 1) {\n return null;\n }\n\n return focussableElements[currentElementIndex + 1];\n};\n\nconst getOverlaySelector = (element: Element | null) => {\n switch (element?.getAttribute('role')) {\n case 'dialog':\n return `[aria-controls='${element.id}']`;\n\n case 'menu':\n return `#${element.getAttribute('aria-labelledby')}`;\n\n default:\n return undefined;\n }\n};\n\nexport function isElementInsideOrTriggeredFromContainer(element: Element | null, container: Element | null) {\n const selector = getOverlaySelector(element) ?? getOverlaySelector(element?.closest('[role=dialog],[role=menu]') ?? null);\n\n if (selector) {\n return !!container?.querySelector(selector);\n }\n\n return !!container?.contains(element);\n}\n\nexport function isEventTriggeredOnInteractiveElement(eventTarget: EventTarget | null) {\n const element = eventTarget as HTMLElement;\n\n return (\n ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL', 'OPTION'].includes(element.tagName) &&\n !element.hidden &&\n !(element as HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLButtonElement).disabled &&\n !(element as HTMLInputElement | HTMLTextAreaElement).readOnly\n );\n}\n"],"names":["getIndexOfFirstChildOverflowingParent","element","overscan","index","boundaryChildIndex","clientRect","getBoundingClientRect","child","Array","from","children","right","left","width","getNextFocussableElement","currentElement","focussableElements","document","querySelectorAll","currentElementIndex","indexOf","length","getOverlaySelector","getAttribute","id","undefined","isElementInsideOrTriggeredFromContainer","container","selector","_getOverlaySelector","_element$closest","closest","querySelector","contains","isEventTriggeredOnInteractiveElement","eventTarget","includes","tagName","hidden","disabled","readOnly"],"mappings":"MAGaA,qCAAqC,GAAGA,CAACC,OAAoB,EAAEC,QAAQ,GAAG,CAAC;EACpF,IAAIC,KAAK,GAAG,CAAC;EACb,IAAIC,kBAAkB,GAAkB,IAAI;EAC5C,MAAMC,UAAU,GAAGJ,OAAO,CAACK,qBAAqB,EAAE;EAElD,KAAK,MAAMC,KAAK,IAAIC,KAAK,CAACC,IAAI,CAACR,OAAO,CAACS,QAAQ,CAAC,EAAE;IAC9C,MAAMC,KAAK,GAAGJ,KAAK,CAACD,qBAAqB,EAAE,CAACK,KAAK,GAAGN,UAAU,CAACO,IAAI;IACnE,MAAMC,KAAK,GAAGR,UAAU,CAACQ,KAAK,GAAGX,QAAQ;IAEzC,IAAIS,KAAK,GAAGE,KAAK,EAAE;MACfT,kBAAkB,GAAGD,KAAK;MAC1B;;IAEJA,KAAK,EAAE;;EAGX,OAAOC,kBAAkB;AAC7B;MAEaU,wBAAwB,GAAIC,cAAkC;EACvE,IAAI,CAACA,cAAc,EAAE;IACjB,OAAO,IAAI;;EAGf,MAAMC,kBAAkB,GAAG,CACvB,GAAGC,QAAQ,CAACC,gBAAgB,CACxB,iOAAiO,CACpO,CACJ;EACD,MAAMC,mBAAmB,GAAGH,kBAAkB,CAACI,OAAO,CAACL,cAAc,CAAC;;EAGtE,IAAII,mBAAmB,KAAK,CAAC,CAAC,IAAIA,mBAAmB,KAAKH,kBAAkB,CAACK,MAAM,GAAG,CAAC,EAAE;IACrF,OAAO,IAAI;;EAGf,OAAOL,kBAAkB,CAACG,mBAAmB,GAAG,CAAC,CAAC;AACtD;AAEA,MAAMG,kBAAkB,GAAIrB,OAAuB;EAC/C,QAAQA,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEsB,YAAY,CAAC,MAAM,CAAC;IACjC,KAAK,QAAQ;MACT,0BAA0BtB,OAAO,CAACuB,MAAM;IAE5C,KAAK,MAAM;MACP,WAAWvB,OAAO,CAACsB,YAAY,CAAC,iBAAiB,GAAG;IAExD;MACI,OAAOE,SAAS;;AAE5B,CAAC;SAEeC,uCAAuCA,CAACzB,OAAuB,EAAE0B,SAAyB;;EACtG,MAAMC,QAAQ,IAAAC,mBAAA,GAAGP,kBAAkB,CAACrB,OAAO,CAAC,cAAA4B,mBAAA,cAAAA,mBAAA,GAAIP,kBAAkB,EAAAQ,gBAAA,GAAC7B,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAE8B,OAAO,CAAC,2BAA2B,CAAC,cAAAD,gBAAA,cAAAA,gBAAA,GAAI,IAAI,CAAC;EAEzH,IAAIF,QAAQ,EAAE;IACV,OAAO,CAAC,EAACD,SAAS,aAATA,SAAS,eAATA,SAAS,CAAEK,aAAa,CAACJ,QAAQ,CAAC;;EAG/C,OAAO,CAAC,EAACD,SAAS,aAATA,SAAS,eAATA,SAAS,CAAEM,QAAQ,CAAChC,OAAO,CAAC;AACzC;SAEgBiC,oCAAoCA,CAACC,WAA+B;EAChF,MAAMlC,OAAO,GAAGkC,WAA0B;EAE1C,OACI,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAACC,QAAQ,CAACnC,OAAO,CAACoC,OAAO,CAAC,IAC3F,CAACpC,OAAO,CAACqC,MAAM,IACf,CAAErC,OAA0F,CAACsC,QAAQ,IACrG,CAAEtC,OAAkD,CAACuC,QAAQ;AAErE;;;;"}
@@ -1,7 +1,5 @@
1
- function isEventTriggeredOnInteractiveElement(eventTarget) {
2
- const element = eventTarget;
3
- return ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName) && !element.hidden && !element.disabled && !element.readOnly;
4
- }
1
+ import { isEventTriggeredOnInteractiveElement } from './dom.js';
2
+
5
3
  function isPressingMetaKey(event) {
6
4
  return isMacOs() ? event.metaKey : event.ctrlKey;
7
5
  }
@@ -42,5 +40,5 @@ const isMacOs = () => {
42
40
  return (_window = window) === null || _window === void 0 ? void 0 : _window.navigator.userAgent.includes('Mac');
43
41
  };
44
42
 
45
- export { createShortcutKeyDownHandler, isEventTriggeredOnInteractiveElement, isMacOs, isPressingMetaKey, shouldTriggerShortcut };
43
+ export { createShortcutKeyDownHandler, isMacOs, isPressingMetaKey, shouldTriggerShortcut };
46
44
  //# sourceMappingURL=keyboard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyboard.js","sources":["../../../../../../src/utils/keyboard.ts"],"sourcesContent":["import React from 'react';\n\nexport type KeyDownHandlerOptions = { key: string; meta?: boolean; shift?: boolean };\n\nexport function isEventTriggeredOnInteractiveElement(eventTarget: EventTarget | null) {\n const element = eventTarget as HTMLElement;\n\n return (\n ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName) &&\n !element.hidden &&\n !(element as HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | HTMLButtonElement).disabled &&\n !(element as HTMLInputElement | HTMLTextAreaElement).readOnly\n );\n}\n\nexport function isPressingMetaKey<T = Element>(event: KeyboardEvent | React.KeyboardEvent<T>) {\n return isMacOs() ? event.metaKey : event.ctrlKey;\n}\n\nexport function shouldTriggerShortcut<T = Element>(\n event: KeyboardEvent | React.KeyboardEvent<T>,\n key: string | KeyDownHandlerOptions\n) {\n const keyOptions: KeyDownHandlerOptions = typeof key === 'string' ? { key, meta: false, shift: false } : key;\n\n if (\n (keyOptions.meta && (isMacOs() ? !event.metaKey : !event.ctrlKey)) ||\n (!keyOptions.meta && (isMacOs() ? event.metaKey : event.ctrlKey))\n ) {\n return false;\n }\n\n if ((keyOptions.shift && !event.shiftKey) || (keyOptions.shift === false && event.shiftKey)) {\n return false;\n }\n\n return event.key.toLowerCase() === keyOptions.key.toLowerCase();\n}\n\nexport function createShortcutKeyDownHandler<T = Element>(\n key: string | KeyDownHandlerOptions,\n handler: (event: KeyboardEvent | React.KeyboardEvent<T>) => void,\n stopPropagation = true\n) {\n return function (event: KeyboardEvent | React.KeyboardEvent<T>) {\n if (\n event.target !== event.currentTarget &&\n isEventTriggeredOnInteractiveElement(event.target as HTMLElement) &&\n !isPressingMetaKey(event)\n ) {\n return;\n }\n\n const condition = shouldTriggerShortcut(event, key);\n\n if (condition) {\n if (stopPropagation) {\n // stops react handlers bubbling up to global\n event.stopPropagation();\n // stops global handlers bubbling up to other global\n (event as KeyboardEvent).stopImmediatePropagation?.();\n }\n\n handler(event);\n }\n };\n}\n\nexport const isMacOs = () => window?.navigator.userAgent.includes('Mac');\n"],"names":["isEventTriggeredOnInteractiveElement","eventTarget","element","includes","tagName","hidden","disabled","readOnly","isPressingMetaKey","event","isMacOs","metaKey","ctrlKey","shouldTriggerShortcut","key","keyOptions","meta","shift","shiftKey","toLowerCase","createShortcutKeyDownHandler","handler","stopPropagation","target","currentTarget","condition","_event$stopImmediateP","stopImmediatePropagation","call","_window","window","navigator","userAgent"],"mappings":"SAIgBA,oCAAoCA,CAACC,WAA+B;EAChF,MAAMC,OAAO,GAAGD,WAA0B;EAE1C,OACI,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,CAACE,QAAQ,CAACD,OAAO,CAACE,OAAO,CAAC,IACxE,CAACF,OAAO,CAACG,MAAM,IACf,CAAEH,OAA0F,CAACI,QAAQ,IACrG,CAAEJ,OAAkD,CAACK,QAAQ;AAErE;SAEgBC,iBAAiBA,CAAcC,KAA6C;EACxF,OAAOC,OAAO,EAAE,GAAGD,KAAK,CAACE,OAAO,GAAGF,KAAK,CAACG,OAAO;AACpD;SAEgBC,qBAAqBA,CACjCJ,KAA6C,EAC7CK,GAAmC;EAEnC,MAAMC,UAAU,GAA0B,OAA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B,OAAA;EAAA,QAAAA,OAAA,GAAMC,MAAM,cAAAD,OAAA,uBAANA,OAAA,CAAQE,SAAS,CAACC,SAAS,CAAC7B,QAAQ,CAAC,KAAK,CAAC;AAAA;;;;"}
1
+ {"version":3,"file":"keyboard.js","sources":["../../../../../../src/utils/keyboard.ts"],"sourcesContent":["import React from 'react';\nimport { isEventTriggeredOnInteractiveElement } from './dom';\n\nexport type KeyDownHandlerOptions = { key: string; meta?: boolean; shift?: boolean };\n\nexport function isPressingMetaKey<T = Element>(event: KeyboardEvent | React.KeyboardEvent<T>) {\n return isMacOs() ? event.metaKey : event.ctrlKey;\n}\n\nexport function shouldTriggerShortcut<T = Element>(\n event: KeyboardEvent | React.KeyboardEvent<T>,\n key: string | KeyDownHandlerOptions\n) {\n const keyOptions: KeyDownHandlerOptions = typeof key === 'string' ? { key, meta: false, shift: false } : key;\n\n if (\n (keyOptions.meta && (isMacOs() ? !event.metaKey : !event.ctrlKey)) ||\n (!keyOptions.meta && (isMacOs() ? event.metaKey : event.ctrlKey))\n ) {\n return false;\n }\n\n if ((keyOptions.shift && !event.shiftKey) || (keyOptions.shift === false && event.shiftKey)) {\n return false;\n }\n\n return event.key.toLowerCase() === keyOptions.key.toLowerCase();\n}\n\nexport function createShortcutKeyDownHandler<T = Element>(\n key: string | KeyDownHandlerOptions,\n handler: (event: KeyboardEvent | React.KeyboardEvent<T>) => void,\n stopPropagation = true\n) {\n return function (event: KeyboardEvent | React.KeyboardEvent<T>) {\n if (\n event.target !== event.currentTarget &&\n isEventTriggeredOnInteractiveElement(event.target as HTMLElement) &&\n !isPressingMetaKey(event)\n ) {\n return;\n }\n\n const condition = shouldTriggerShortcut(event, key);\n\n if (condition) {\n if (stopPropagation) {\n // stops react handlers bubbling up to global\n event.stopPropagation();\n // stops global handlers bubbling up to other global\n (event as KeyboardEvent).stopImmediatePropagation?.();\n }\n\n handler(event);\n }\n };\n}\n\nexport const isMacOs = () => window?.navigator.userAgent.includes('Mac');\n"],"names":["isPressingMetaKey","event","isMacOs","metaKey","ctrlKey","shouldTriggerShortcut","key","keyOptions","meta","shift","shiftKey","toLowerCase","createShortcutKeyDownHandler","handler","stopPropagation","target","currentTarget","isEventTriggeredOnInteractiveElement","condition","_event$stopImmediateP","stopImmediatePropagation","call","_window","window","navigator","userAgent","includes"],"mappings":";;SAKgBA,iBAAiBA,CAAcC,KAA6C;EACxF,OAAOC,OAAO,EAAE,GAAGD,KAAK,CAACE,OAAO,GAAGF,KAAK,CAACG,OAAO;AACpD;SAEgBC,qBAAqBA,CACjCJ,KAA6C,EAC7CK,GAAmC;EAEnC,MAAMC,UAAU,GAA0B,OAAOD,GAAG,KAAK,QAAQ,GAAG;IAAEA,GAAG;IAAEE,IAAI,EAAE,KAAK;IAAEC,KAAK,EAAE;GAAO,GAAGH,GAAG;EAE5G,IACKC,UAAU,CAACC,IAAI,KAAKN,OAAO,EAAE,GAAG,CAACD,KAAK,CAACE,OAAO,GAAG,CAACF,KAAK,CAACG,OAAO,CAAC,IAChE,CAACG,UAAU,CAACC,IAAI,KAAKN,OAAO,EAAE,GAAGD,KAAK,CAACE,OAAO,GAAGF,KAAK,CAACG,OAAO,CAAE,EACnE;IACE,OAAO,KAAK;;EAGhB,IAAKG,UAAU,CAACE,KAAK,IAAI,CAACR,KAAK,CAACS,QAAQ,IAAMH,UAAU,CAACE,KAAK,KAAK,KAAK,IAAIR,KAAK,CAACS,QAAS,EAAE;IACzF,OAAO,KAAK;;EAGhB,OAAOT,KAAK,CAACK,GAAG,CAACK,WAAW,EAAE,KAAKJ,UAAU,CAACD,GAAG,CAACK,WAAW,EAAE;AACnE;SAEgBC,4BAA4BA,CACxCN,GAAmC,EACnCO,OAAgE,EAChEC,eAAe,GAAG,IAAI;EAEtB,OAAO,UAAUb,KAA6C;IAC1D,IACIA,KAAK,CAACc,MAAM,KAAKd,KAAK,CAACe,aAAa,IACpCC,oCAAoC,CAAChB,KAAK,CAACc,MAAqB,CAAC,IACjE,CAACf,iBAAiB,CA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