@economic/taco 2.15.0 → 2.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (291) hide show
  1. package/dist/components/Drawer/Drawer.d.ts +5 -1
  2. package/dist/components/Provider/Localization.d.ts +19 -0
  3. package/dist/components/SearchInput2/SearchInput2.d.ts +1 -0
  4. package/dist/components/Table3/Table3.d.ts +0 -2
  5. package/dist/components/Table3/components/alert/ErrorAlert.d.ts +10 -0
  6. package/dist/components/Table3/components/columns/cell/DisplayCell.d.ts +5 -2
  7. package/dist/components/Table3/components/columns/cell/EditingCell.d.ts +3 -0
  8. package/dist/components/Table3/components/columns/cell/EditingControl.d.ts +1 -1
  9. package/dist/components/Table3/components/columns/cell/Highlight.d.ts +2 -0
  10. package/dist/components/Table3/components/columns/header/Header.d.ts +1 -1
  11. package/dist/components/Table3/components/columns/internal/EditingActions.d.ts +1 -1
  12. package/dist/components/Table3/components/columns/styles.d.ts +2 -2
  13. package/dist/components/Table3/components/rows/Row.d.ts +5 -1
  14. package/dist/components/Table3/components/rows/RowContext.d.ts +1 -0
  15. package/dist/components/Table3/hooks/features/useEditing.d.ts +12 -11
  16. package/dist/components/Table3/hooks/features/{usePauseHoverState.d.ts → usePauseShortcuts.d.ts} +1 -2
  17. package/dist/components/Table3/hooks/features/useSearch.d.ts +3 -3
  18. package/dist/components/Table3/hooks/features/useValidation.d.ts +13 -0
  19. package/dist/components/Table3/hooks/useTable.d.ts +25 -20
  20. package/dist/components/Table3/types.d.ts +41 -19
  21. package/dist/components/Table3/util/editing.d.ts +6 -0
  22. package/dist/components/Table3/util/scrolling.d.ts +2 -0
  23. package/dist/esm/index.css +108 -33
  24. package/dist/esm/packages/taco/src/components/Banner/Banner.js +2 -2
  25. package/dist/esm/packages/taco/src/components/Banner/Banner.js.map +1 -1
  26. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js +4 -4
  27. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
  28. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +3 -3
  29. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +2 -1
  31. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +6 -6
  33. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +3 -3
  35. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +7 -2
  37. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -1
  38. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +7 -7
  39. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
  40. package/dist/esm/packages/taco/src/components/Field/Field.js +2 -2
  41. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  42. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js +2 -2
  43. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js.map +1 -1
  44. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +4 -4
  45. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
  46. package/dist/esm/packages/taco/src/components/Header/components/Link.js +2 -2
  47. package/dist/esm/packages/taco/src/components/Header/components/Link.js.map +1 -1
  48. package/dist/esm/packages/taco/src/components/Icon/Icon.js +2 -2
  49. package/dist/esm/packages/taco/src/components/Icon/Icon.js.map +1 -1
  50. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js +2 -2
  51. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +6 -6
  53. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
  54. package/dist/esm/packages/taco/src/components/Menu/components/Item.js +4 -4
  55. package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
  56. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js +2 -2
  57. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js.map +1 -1
  58. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js +3 -3
  59. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js.map +1 -1
  60. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js +2 -2
  61. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js.map +1 -1
  62. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +1 -1
  63. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
  64. package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js +2 -2
  65. package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js.map +1 -1
  66. package/dist/esm/packages/taco/src/components/Pagination/Pagination.js +5 -5
  67. package/dist/esm/packages/taco/src/components/Pagination/Pagination.js.map +1 -1
  68. package/dist/esm/packages/taco/src/components/Popover/Popover.js +2 -2
  69. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  70. package/dist/esm/packages/taco/src/components/Provider/Localization.js +19 -0
  71. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  72. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js +2 -2
  73. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js.map +1 -1
  74. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +12 -8
  75. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  76. package/dist/esm/packages/taco/src/components/Select/useSelect.js +2 -2
  77. package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
  78. package/dist/esm/packages/taco/src/components/Select2/Select2.js +7 -7
  79. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  80. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +8 -8
  81. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  82. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +5 -5
  83. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  84. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +10 -10
  85. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  86. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +2 -2
  87. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
  88. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js +3 -3
  89. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js.map +1 -1
  90. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +2 -2
  91. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
  92. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +10 -10
  93. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js.map +1 -1
  94. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js +2 -2
  95. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js.map +1 -1
  96. package/dist/esm/packages/taco/src/components/Table3/Table3.js +37 -30
  97. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  98. package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js +154 -0
  99. package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js.map +1 -0
  100. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +54 -9
  101. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
  102. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +9 -57
  103. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
  104. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +72 -41
  105. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  106. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +41 -17
  107. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
  108. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js +41 -0
  109. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js.map +1 -0
  110. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +23 -14
  111. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
  112. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js +3 -3
  113. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js.map +1 -1
  114. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js +1 -1
  115. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js.map +1 -1
  116. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +9 -9
  117. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
  118. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +37 -6
  119. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
  120. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +12 -12
  121. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
  122. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js +2 -2
  123. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js.map +1 -1
  124. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +63 -23
  125. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js.map +1 -1
  126. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js +3 -3
  127. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js.map +1 -1
  128. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +3 -3
  129. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
  130. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js +2 -13
  131. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js.map +1 -1
  132. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +67 -57
  133. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
  134. package/dist/esm/packages/taco/src/components/Table3/components/rows/RowContext.js +2 -1
  135. package/dist/esm/packages/taco/src/components/Table3/components/rows/RowContext.js.map +1 -1
  136. package/dist/esm/packages/taco/src/components/Table3/components/rows/SkeletonRow.js +2 -2
  137. package/dist/esm/packages/taco/src/components/Table3/components/rows/SkeletonRow.js.map +1 -1
  138. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +8 -6
  139. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js.map +1 -1
  140. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +23 -8
  141. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
  142. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js +2 -2
  143. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterColumn.js.map +1 -1
  144. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +2 -2
  145. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js.map +1 -1
  146. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +16 -16
  147. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
  148. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +1 -0
  149. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
  150. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +53 -4
  151. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
  152. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js +8 -8
  153. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js.map +1 -1
  154. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js +185 -101
  155. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js.map +1 -1
  156. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseShortcuts.js +12 -0
  157. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseShortcuts.js.map +1 -0
  158. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSearch.js +4 -2
  159. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSearch.js.map +1 -1
  160. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useValidation.js +178 -0
  161. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useValidation.js.map +1 -0
  162. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js +3 -3
  163. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js.map +1 -1
  164. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +1 -49
  165. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
  166. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +1 -2
  167. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
  168. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js +0 -2
  169. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js.map +1 -1
  170. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +135 -111
  171. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  172. package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js +4 -4
  173. package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js.map +1 -1
  174. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  175. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +21 -1
  176. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  177. package/dist/esm/packages/taco/src/components/Table3/util/scrolling.js +53 -0
  178. package/dist/esm/packages/taco/src/components/Table3/util/scrolling.js.map +1 -0
  179. package/dist/esm/packages/taco/src/components/Tag/Tag.js +4 -4
  180. package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
  181. package/dist/esm/packages/taco/src/components/Toast/Toaster.js +2 -2
  182. package/dist/esm/packages/taco/src/components/Toast/Toaster.js.map +1 -1
  183. package/dist/esm/packages/taco/src/components/Tour/Tour.js +4 -4
  184. package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
  185. package/dist/esm/packages/taco/src/components/Treeview/Treeview.js +2 -2
  186. package/dist/esm/packages/taco/src/components/Treeview/Treeview.js.map +1 -1
  187. package/dist/esm/packages/taco/src/index.js +2 -1
  188. package/dist/esm/packages/taco/src/index.js.map +1 -1
  189. package/dist/esm/packages/taco/src/primitives/Table/types.js +10 -0
  190. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -0
  191. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js +8 -0
  192. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js.map +1 -0
  193. package/dist/esm/packages/taco/src/{components/Table3/hooks/features/useFontSize.js → primitives/Table/useTable/features/useTableFontSize.js} +3 -3
  194. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFontSize.js.map +1 -0
  195. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js +14 -0
  196. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +1 -0
  197. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js +100 -0
  198. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js.map +1 -0
  199. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowClick.js +30 -0
  200. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowClick.js.map +1 -0
  201. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js +9 -0
  202. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js.map +1 -0
  203. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowHeight.js +13 -0
  204. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowHeight.js.map +1 -0
  205. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js +32 -0
  206. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js.map +1 -0
  207. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js +11 -0
  208. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js.map +1 -0
  209. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableDataListener.js +15 -0
  210. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableDataListener.js.map +1 -0
  211. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useFilteringStateListener.js → primitives/Table/useTable/listeners/useTableFilterListener.js} +3 -3
  212. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFilterListener.js.map +1 -0
  213. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFontSizeListener.js +40 -0
  214. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableFontSizeListener.js.map +1 -0
  215. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useRowSelectionListener.js → primitives/Table/useTable/listeners/useTableRowSelectionListener.js} +5 -6
  216. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowSelectionListener.js.map +1 -0
  217. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useServerLoadingListener.js → primitives/Table/useTable/listeners/useTableServerLoadingListener.js} +3 -3
  218. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableServerLoadingListener.js.map +1 -0
  219. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useShortcutsListener.js → primitives/Table/useTable/listeners/useTableShortcutsListener.js} +7 -7
  220. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableShortcutsListener.js.map +1 -0
  221. package/dist/esm/packages/taco/src/{components/Table3/hooks/listeners/useSortingStateListener.js → primitives/Table/useTable/listeners/useTableSortingListener.js} +6 -4
  222. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSortingListener.js.map +1 -0
  223. package/dist/esm/packages/taco/src/{components/Table3/hooks/features/useColumnOrdering.js → primitives/Table/useTable/util/columns.js} +24 -15
  224. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -0
  225. package/dist/esm/packages/taco/src/types.js +6 -0
  226. package/dist/esm/packages/taco/src/types.js.map +1 -0
  227. package/dist/esm/packages/taco/src/utils/date.js +0 -1
  228. package/dist/esm/packages/taco/src/utils/date.js.map +1 -1
  229. package/dist/index.css +108 -33
  230. package/dist/primitives/Table/types.d.ts +35 -0
  231. package/dist/primitives/Table/useTable/features/useTableColumnOrdering.d.ts +3 -0
  232. package/dist/primitives/Table/useTable/features/useTableFontSize.d.ts +7 -0
  233. package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +7 -0
  234. package/dist/primitives/Table/useTable/features/useTableRowActive.d.ts +12 -0
  235. package/dist/primitives/Table/useTable/features/useTableRowClick.d.ts +7 -0
  236. package/dist/primitives/Table/useTable/features/useTableRowGoto.d.ts +5 -0
  237. package/dist/primitives/Table/useTable/features/useTableRowHeight.d.ts +7 -0
  238. package/dist/primitives/Table/useTable/features/useTableRowSelection.d.ts +6 -0
  239. package/dist/primitives/Table/useTable/features/useTableServerLoading.d.ts +6 -0
  240. package/dist/primitives/Table/useTable/listeners/useTableDataListener.d.ts +2 -0
  241. package/dist/primitives/Table/useTable/listeners/useTableFilterListener.d.ts +3 -0
  242. package/dist/primitives/Table/useTable/listeners/useTableFontSizeListener.d.ts +2 -0
  243. package/dist/primitives/Table/useTable/listeners/useTableRowSelectionListener.d.ts +3 -0
  244. package/dist/primitives/Table/useTable/listeners/useTableServerLoadingListener.d.ts +3 -0
  245. package/dist/primitives/Table/useTable/listeners/useTableShortcutsListener.d.ts +3 -0
  246. package/dist/primitives/Table/useTable/listeners/useTableSortingListener.d.ts +3 -0
  247. package/dist/primitives/Table/useTable/util/columns.d.ts +4 -0
  248. package/dist/taco.cjs.development.js +2294 -1543
  249. package/dist/taco.cjs.development.js.map +1 -1
  250. package/dist/taco.cjs.production.min.js +1 -1
  251. package/dist/taco.cjs.production.min.js.map +1 -1
  252. package/dist/types.d.ts +5 -0
  253. package/package.json +3 -3
  254. package/types.json +13547 -12953
  255. package/dist/components/Table3/hooks/features/useColumnOrdering.d.ts +0 -6
  256. package/dist/components/Table3/hooks/features/useCurrentRow.d.ts +0 -11
  257. package/dist/components/Table3/hooks/features/useFontSize.d.ts +0 -7
  258. package/dist/components/Table3/hooks/features/usePrinting.d.ts +0 -8
  259. package/dist/components/Table3/hooks/features/useRowClick.d.ts +0 -6
  260. package/dist/components/Table3/hooks/features/useRowGoto.d.ts +0 -5
  261. package/dist/components/Table3/hooks/features/useRowHeight.d.ts +0 -7
  262. package/dist/components/Table3/hooks/features/useRowSelection.d.ts +0 -6
  263. package/dist/components/Table3/hooks/listeners/useCurrentRowListener.d.ts +0 -2
  264. package/dist/components/Table3/hooks/listeners/useFilteringStateListener.d.ts +0 -3
  265. package/dist/components/Table3/hooks/listeners/useRowSelectionListener.d.ts +0 -3
  266. package/dist/components/Table3/hooks/listeners/useServerLoadingListener.d.ts +0 -3
  267. package/dist/components/Table3/hooks/listeners/useShortcutsListener.d.ts +0 -3
  268. package/dist/components/Table3/hooks/listeners/useSortingStateListener.d.ts +0 -3
  269. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnOrdering.js.map +0 -1
  270. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js +0 -93
  271. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js.map +0 -1
  272. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useFontSize.js.map +0 -1
  273. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseHoverState.js +0 -22
  274. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePauseHoverState.js.map +0 -1
  275. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePrinting.js +0 -14
  276. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePrinting.js.map +0 -1
  277. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js +0 -25
  278. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js.map +0 -1
  279. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowGoto.js +0 -9
  280. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowGoto.js.map +0 -1
  281. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowHeight.js +0 -27
  282. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowHeight.js.map +0 -1
  283. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js +0 -32
  284. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js.map +0 -1
  285. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js +0 -15
  286. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js.map +0 -1
  287. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useFilteringStateListener.js.map +0 -1
  288. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useRowSelectionListener.js.map +0 -1
  289. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useServerLoadingListener.js.map +0 -1
  290. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useShortcutsListener.js.map +0 -1
  291. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSortingStateListener.js.map +0 -1
@@ -1,57 +1,48 @@
1
1
  import React__default from 'react';
2
2
  import { shouldTriggerShortcut } from '../../../../utils/keyboard.js';
3
3
  import _ from 'lodash-es';
4
+ import { lastCellIndex } from '../../components/rows/Row.js';
4
5
 
5
- var SavingStateValue;
6
- (function (SavingStateValue) {
7
- SavingStateValue["Saving"] = "saving";
8
- SavingStateValue["Saved"] = "saved";
9
- SavingStateValue["Error"] = "error";
10
- })(SavingStateValue || (SavingStateValue = {}));
11
- function useEditing(isEnabled, onSave) {
6
+ var SavingStatusValue;
7
+ (function (SavingStatusValue) {
8
+ SavingStatusValue["Saving"] = "saving";
9
+ SavingStatusValue["Saved"] = "saved";
10
+ SavingStatusValue["Error"] = "error";
11
+ })(SavingStatusValue || (SavingStatusValue = {}));
12
+ function useEditing(isEnabled, validation, onSave) {
12
13
  // used to switch the table into editing mode
13
14
  const [isEditing, setIsEditing] = React__default.useState(false);
14
- // Saving indicator need to show saving state per row, saving state can have at lkeast two states 'saving', 'saved',
15
+ // Saving indicator need to show saving status per row, saving status can have at least two states 'saving', 'saved',
15
16
  // 'saved' should remain for a few seconds to show tick icon after row has been saved.
16
- const [savingStates, setSavingStates] = React__default.useState(null);
17
+ const [savingStatuses, dispatchSavingStatusAction] = React__default.useReducer(savingStatusesReducer, null);
17
18
  // sets of row changes pending save, either they have not saved yet or they have errors
18
- const [changes, setChanges] = React__default.useState(null);
19
+ const [editingState, dispatchEditingAction] = React__default.useReducer((state, action) => editingReducer(state, action), null);
19
20
  const [detailModeEditing, setDetailModeEditing] = React__default.useState(false);
20
21
  function getCellValue(cell) {
21
- var _changes$cell$row$id;
22
- return changes ? (_changes$cell$row$id = changes[cell.row.id]) === null || _changes$cell$row$id === void 0 ? void 0 : _changes$cell$row$id[cell.column.id] : undefined;
22
+ var _editingState$cell$ro;
23
+ return editingState ? (_editingState$cell$ro = editingState[cell.row.id]) === null || _editingState$cell$ro === void 0 ? void 0 : _editingState$cell$ro[cell.column.id] : undefined;
23
24
  }
24
25
  // Saves editing cell value into editing state.
25
26
  function setCellValue(cell, value) {
26
- setChanges(currentChanges => {
27
- const nextChanges = {
28
- ...currentChanges
29
- };
30
- if (nextChanges[cell.row.id]) {
31
- nextChanges[cell.row.id][cell.column.id] = value;
32
- // we should probably delete the cell if it has just reverted back to its original value
33
- } else {
34
- nextChanges[cell.row.id] = {
35
- ...cell.row.original,
36
- [cell.column.id]: value
37
- };
27
+ dispatchEditingAction({
28
+ type: EditingActionType.SET_CELL_VALUE,
29
+ payload: {
30
+ rowId: cell.row.id,
31
+ cellId: cell.column.id,
32
+ value,
33
+ originalValues: cell.row.original
38
34
  }
39
- return nextChanges;
40
35
  });
41
36
  }
42
37
  // Removes changes from editing state by row id
43
38
  function resetChange(rowId) {
44
- let currentChanges = changes ? {
45
- ...changes
46
- } : {};
47
- if (currentChanges) {
48
- delete currentChanges[rowId];
49
- }
50
- const changeset = Object.keys(currentChanges);
51
- if (changeset.length === 0) {
52
- currentChanges = null;
53
- }
54
- setChanges(currentChanges);
39
+ dispatchEditingAction({
40
+ type: EditingActionType.RESET_CHANGE,
41
+ payload: {
42
+ rowId
43
+ }
44
+ });
45
+ validation.resetErrors(rowId);
55
46
  }
56
47
  const handleKeyDown = React__default.useCallback(event => {
57
48
  if (event.defaultPrevented) {
@@ -78,71 +69,93 @@ function useEditing(isEnabled, onSave) {
78
69
  saveChangesIfNeeded();
79
70
  }
80
71
  }, []);
81
- // Creates initial saving states from changes object
82
- const addSavingStates = () => {
83
- const changeset = Object.keys(changes || {});
84
- const additionalSavingStates = _.reduce(changeset, (result, value) => {
72
+ // Creates initial saving statuses from changes object
73
+ const addSavingStatuses = () => {
74
+ const changeset = Object.keys(editingState || {});
75
+ const additionalSavingStatuses = _.reduce(changeset, (result, rowId) => {
85
76
  return {
86
77
  ...result,
87
- [value]: {
88
- state: SavingStateValue.Saving
89
- }
78
+ [rowId]: SavingStatusValue.Saving
90
79
  };
91
80
  }, {});
92
- setSavingStates({
93
- ...savingStates,
94
- ...additionalSavingStates
81
+ dispatchSavingStatusAction({
82
+ type: SavingStatusActionType.SET_SAVING_STATUSES,
83
+ payload: {
84
+ states: additionalSavingStatuses
85
+ }
95
86
  });
96
87
  };
97
- // Repoves edititng state by row is. Used in delayed saving indicator.
98
- const removeSavingState = rowId => {
99
- const newSavingStates = {
100
- ...savingStates
101
- };
102
- delete newSavingStates[rowId];
103
- setSavingStates(newSavingStates);
88
+ // Resets/removes saving status by row id. Used in delayed saving indicator.
89
+ const resetSavingStatus = rowId => {
90
+ dispatchSavingStatusAction({
91
+ type: SavingStatusActionType.RESET_SAVING_STATUS,
92
+ payload: {
93
+ rowId
94
+ }
95
+ });
104
96
  };
105
97
  // Checks if we have changes, then saves them
106
98
  const saveChangesIfNeeded = function () {
107
99
  try {
108
- if (!changes) {
100
+ if (!editingState) {
109
101
  return Promise.resolve();
110
102
  }
111
- const changeset = Object.keys(changes);
103
+ const changeset = Object.keys(editingState);
112
104
  const _temp = function () {
113
105
  if (onSave && changeset.length) {
114
- addSavingStates();
115
- return Promise.resolve(Promise.allSettled(changeset.map(rowId => onSave(changes[rowId])))).then(function (responses) {
116
- setChanges(currentChanges => {
117
- const nextChanges = {
118
- ...currentChanges
119
- };
120
- responses.forEach((response, index) => {
121
- const rowId = changeset[index];
122
- if (response.status === 'fulfilled') {
123
- delete nextChanges[rowId];
124
- }
125
- });
126
- return nextChanges;
106
+ addSavingStatuses();
107
+ return Promise.resolve(Promise.allSettled(changeset.map(rowId => {
108
+ const validationSavePromise = new Promise((resolve, reject) => {
109
+ const changedRow = editingState === null || editingState === void 0 ? void 0 : editingState[rowId];
110
+ if (changedRow) {
111
+ var _validation$validate;
112
+ (_validation$validate = validation.validate(rowId, changedRow)) === null || _validation$validate === void 0 ? void 0 : _validation$validate.then(() => {
113
+ const savePromise = onSave(changedRow);
114
+ savePromise.then(() => {
115
+ resolve();
116
+ }).catch(reason => {
117
+ if (reason.errors) {
118
+ validation.setRowErrors(rowId, reason.errors);
119
+ }
120
+ reject(reason);
121
+ });
122
+ }).catch(() => {
123
+ validation.confirmErrors(rowId);
124
+ dispatchSavingStatusAction({
125
+ type: SavingStatusActionType.SET_SAVING_STATUS,
126
+ payload: {
127
+ rowId,
128
+ state: SavingStatusValue.Error
129
+ }
130
+ });
131
+ reject();
132
+ });
133
+ } else {
134
+ reject();
135
+ }
127
136
  });
128
- setSavingStates(savingStates => {
129
- const nextSavingStates = savingStates ? {
130
- ...savingStates
131
- } : {};
132
- responses.forEach((response, index) => {
133
- const rowId = changeset[index];
134
- if (response.status === 'fulfilled') {
135
- nextSavingStates[rowId] = {
136
- state: SavingStateValue.Saved
137
- };
138
- } else {
139
- // add the error when validation is added
140
- nextSavingStates[rowId] = {
141
- state: SavingStateValue.Error
142
- };
143
- }
144
- });
145
- return nextSavingStates;
137
+ return validationSavePromise;
138
+ }))).then(function (responses) {
139
+ responses.forEach((response, index) => {
140
+ const rowId = changeset[index];
141
+ if (response.status === 'fulfilled') {
142
+ resetChange(rowId);
143
+ dispatchSavingStatusAction({
144
+ type: SavingStatusActionType.SET_SAVING_STATUS,
145
+ payload: {
146
+ rowId,
147
+ state: SavingStatusValue.Saved
148
+ }
149
+ });
150
+ } else {
151
+ dispatchSavingStatusAction({
152
+ type: SavingStatusActionType.SET_SAVING_STATUS,
153
+ payload: {
154
+ rowId,
155
+ state: SavingStatusValue.Error
156
+ }
157
+ });
158
+ }
146
159
  });
147
160
  });
148
161
  }
@@ -152,34 +165,37 @@ function useEditing(isEnabled, onSave) {
152
165
  return Promise.reject(e);
153
166
  }
154
167
  };
155
- const [rowMoveReason, setRowMoveReason] = React__default.useState({});
156
- const removeRowMoveReason = columnId => {
157
- setRowMoveReason(prevState => {
158
- const newState = {
159
- ...prevState
160
- };
161
- delete newState[columnId];
162
- return newState;
163
- });
168
+ const [rowMoveReason, setRowMoveReason] = React__default.useState(null);
169
+ const removeRowMoveReason = () => {
170
+ setRowMoveReason(null);
164
171
  };
165
172
  const showWarning = React__default.useCallback(event => {
166
- if (isEditing && changes && Object.keys(changes).length > 0) {
173
+ if (isEditing && editingState && Object.keys(editingState).length > 0) {
167
174
  event.returnValue = true;
168
175
  return true;
169
176
  }
170
177
  return false;
171
- }, [isEditing, changes]);
178
+ }, [isEditing, editingState]);
179
+ function getSavingStatus(rowId) {
180
+ return savingStatuses && savingStatuses[rowId];
181
+ }
172
182
  React__default.useEffect(() => {
173
183
  window.addEventListener('beforeunload', showWarning);
174
184
  return () => {
175
185
  window.removeEventListener('beforeunload', showWarning);
176
186
  };
177
187
  }, [showWarning]);
188
+ React__default.useEffect(() => {
189
+ if (!isEditing) {
190
+ setDetailModeEditing(false);
191
+ lastCellIndex.value = null;
192
+ }
193
+ }, [isEditing]);
178
194
  return {
179
195
  isEnabled,
180
196
  isEditing,
181
197
  toggleEditing: setIsEditing,
182
- changes,
198
+ changes: editingState,
183
199
  getCellValue,
184
200
  setCellValue,
185
201
  saveChangesIfNeeded,
@@ -191,10 +207,78 @@ function useEditing(isEnabled, onSave) {
191
207
  handleKeyDown,
192
208
  handleBlur,
193
209
  resetChange,
194
- savingStates,
195
- removeSavingState
210
+ getSavingStatus,
211
+ resetSavingStatus
196
212
  };
197
213
  }
214
+ var EditingActionType;
215
+ (function (EditingActionType) {
216
+ EditingActionType[EditingActionType["SET_CELL_VALUE"] = 0] = "SET_CELL_VALUE";
217
+ EditingActionType[EditingActionType["RESET_CHANGE"] = 1] = "RESET_CHANGE";
218
+ })(EditingActionType || (EditingActionType = {}));
219
+ function editingReducer(state, action) {
220
+ switch (action.type) {
221
+ // Set cell value of the row
222
+ case EditingActionType.SET_CELL_VALUE:
223
+ return {
224
+ ...state,
225
+ [action.payload.rowId]: {
226
+ ...((state === null || state === void 0 ? void 0 : state[action.payload.rowId]) || action.payload.originalValues),
227
+ [action.payload.cellId]: action.payload.value
228
+ }
229
+ };
230
+ // Reset changes for the row
231
+ case EditingActionType.RESET_CHANGE:
232
+ {
233
+ let currentChanges = {
234
+ ...state
235
+ };
236
+ if (currentChanges) {
237
+ delete currentChanges[action.payload.rowId];
238
+ }
239
+ const changeset = Object.keys(currentChanges);
240
+ if (changeset.length === 0) {
241
+ currentChanges = null;
242
+ }
243
+ return currentChanges;
244
+ }
245
+ default:
246
+ return state;
247
+ }
248
+ }
249
+ var SavingStatusActionType;
250
+ (function (SavingStatusActionType) {
251
+ SavingStatusActionType[SavingStatusActionType["SET_SAVING_STATUS"] = 0] = "SET_SAVING_STATUS";
252
+ SavingStatusActionType[SavingStatusActionType["SET_SAVING_STATUSES"] = 1] = "SET_SAVING_STATUSES";
253
+ SavingStatusActionType[SavingStatusActionType["RESET_SAVING_STATUS"] = 2] = "RESET_SAVING_STATUS";
254
+ })(SavingStatusActionType || (SavingStatusActionType = {}));
255
+ function savingStatusesReducer(state, action) {
256
+ switch (action.type) {
257
+ // Set single saving status for the row
258
+ case SavingStatusActionType.SET_SAVING_STATUS:
259
+ return {
260
+ ...state,
261
+ [action.payload.rowId]: action.payload.state
262
+ };
263
+ // Set multiple saving statuses for multiple rows at the same time
264
+ case SavingStatusActionType.SET_SAVING_STATUSES:
265
+ return {
266
+ ...state,
267
+ ...action.payload.states
268
+ };
269
+ // Reset/remove saving status for particular row
270
+ case SavingStatusActionType.RESET_SAVING_STATUS:
271
+ {
272
+ const newSavingStatus = {
273
+ ...state
274
+ };
275
+ newSavingStatus === null || newSavingStatus === void 0 ? true : delete newSavingStatus[action.payload.rowId];
276
+ return newSavingStatus;
277
+ }
278
+ default:
279
+ return state;
280
+ }
281
+ }
198
282
 
199
- export { SavingStateValue, useEditing };
283
+ export { SavingStatusValue, useEditing };
200
284
  //# sourceMappingURL=useEditing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEditing.js","sources":["../../../../../../../../../src/components/Table3/hooks/features/useEditing.tsx"],"sourcesContent":["import React from 'react';\nimport _ from 'lodash';\nimport { Cell as RTCell } from '@tanstack/react-table';\n\nimport { IndicatorReason } from '../../components/columns/cell/Indicator';\nimport { shouldTriggerShortcut } from '../../../../utils/keyboard';\n\nexport enum SavingStateValue {\n Saving = 'saving',\n Saved = 'saved',\n Error = 'error',\n}\n\nexport type SavingState = {\n state: SavingStateValue;\n};\n\nexport function useEditing<TType = unknown>(isEnabled: boolean, onSave?: (row: TType) => void) {\n // used to switch the table into editing mode\n const [isEditing, setIsEditing] = React.useState(false);\n // Saving indicator need to show saving state per row, saving state can have at lkeast two states 'saving', 'saved',\n // 'saved' should remain for a few seconds to show tick icon after row has been saved.\n const [savingStates, setSavingStates] = React.useState<Record<string, SavingState> | null>(null);\n\n // sets of row changes pending save, either they have not saved yet or they have errors\n const [changes, setChanges] = React.useState<Record<string, TType> | null>(null);\n\n const [detailModeEditing, setDetailModeEditing] = React.useState(false);\n\n function getCellValue<T extends TType>(cell: RTCell<T, unknown>) {\n return changes ? changes[cell.row.id]?.[cell.column.id] : undefined;\n }\n\n // Saves editing cell value into editing state.\n function setCellValue<T extends TType>(cell: RTCell<T, unknown>, value: unknown) {\n setChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n\n if (nextChanges[cell.row.id]) {\n nextChanges[cell.row.id][cell.column.id] = value;\n // we should probably delete the cell if it has just reverted back to its original value\n } else {\n nextChanges[cell.row.id] = { ...cell.row.original, [cell.column.id]: value };\n }\n\n return nextChanges;\n });\n }\n\n // Removes changes from editing state by row id\n function resetChange(rowId: string) {\n let currentChanges: Record<string, TType> | null = changes ? { ...changes } : {};\n if (currentChanges) {\n delete currentChanges[rowId];\n }\n const changeset = Object.keys(currentChanges);\n if (changeset.length === 0) {\n currentChanges = null;\n }\n\n setChanges(currentChanges);\n }\n\n const handleKeyDown = React.useCallback(\n (event: KeyboardEvent) => {\n if (event.defaultPrevented) {\n return;\n }\n\n if (shouldTriggerShortcut(event, { key: 'e', meta: true, shift: false })) {\n setIsEditing(editing => !editing);\n } else if (shouldTriggerShortcut(event, { key: 's', meta: true, shift: false })) {\n // Prevent default browser save\n event.preventDefault();\n saveChangesIfNeeded();\n }\n },\n [isEditing]\n );\n\n const handleBlur = React.useCallback((event: React.FocusEvent) => {\n if (event.target === event.currentTarget) {\n saveChangesIfNeeded();\n }\n }, []);\n\n // Creates initial saving states from changes object\n const addSavingStates = () => {\n const changeset = Object.keys(changes || {});\n const additionalSavingStates = _.reduce(\n changeset,\n (result, value) => {\n return { ...result, [value]: { state: SavingStateValue.Saving } };\n },\n {}\n );\n setSavingStates({ ...savingStates, ...additionalSavingStates });\n };\n\n // Repoves edititng state by row is. Used in delayed saving indicator.\n const removeSavingState = (rowId: string) => {\n const newSavingStates = { ...savingStates };\n delete newSavingStates[rowId];\n setSavingStates(newSavingStates);\n };\n\n // Checks if we have changes, then saves them\n const saveChangesIfNeeded = async () => {\n if (!changes) {\n return;\n }\n\n const changeset = Object.keys(changes);\n if (onSave && changeset.length) {\n addSavingStates();\n\n const responses = await Promise.allSettled(changeset.map(rowId => onSave(changes[rowId])));\n\n setChanges(currentChanges => {\n const nextChanges = { ...currentChanges };\n\n responses.forEach((response, index) => {\n const rowId = changeset[index];\n\n if (response.status === 'fulfilled') {\n delete nextChanges[rowId];\n }\n });\n\n return nextChanges;\n });\n\n setSavingStates(savingStates => {\n const nextSavingStates = savingStates ? { ...savingStates } : {};\n responses.forEach((response, index) => {\n const rowId = changeset[index];\n\n if (response.status === 'fulfilled') {\n nextSavingStates[rowId] = { state: SavingStateValue.Saved };\n } else {\n // add the error when validation is added\n nextSavingStates[rowId] = { state: SavingStateValue.Error };\n }\n });\n return nextSavingStates;\n });\n }\n };\n\n const [rowMoveReason, setRowMoveReason] = React.useState<Record<string, IndicatorReason | null>>({});\n\n const removeRowMoveReason = (columnId: string) => {\n setRowMoveReason(prevState => {\n const newState = { ...prevState };\n delete newState[columnId];\n\n return newState;\n });\n };\n\n const showWarning = React.useCallback(\n event => {\n if (isEditing && changes && Object.keys(changes).length > 0) {\n event.returnValue = true;\n return true;\n }\n\n return false;\n },\n [isEditing, changes]\n );\n\n React.useEffect(() => {\n window.addEventListener('beforeunload', showWarning);\n\n return () => {\n window.removeEventListener('beforeunload', showWarning);\n };\n }, [showWarning]);\n\n return {\n isEnabled,\n isEditing,\n toggleEditing: setIsEditing,\n changes,\n getCellValue,\n setCellValue,\n saveChangesIfNeeded,\n detailModeEditing,\n setDetailModeEditing,\n rowMoveReason,\n setRowMoveReason,\n removeRowMoveReason,\n handleKeyDown,\n handleBlur,\n resetChange,\n savingStates,\n removeSavingState,\n };\n}\n"],"names":["SavingStateValue","useEditing","isEnabled","onSave","isEditing","setIsEditing","React","useState","savingStates","setSavingStates","changes","setChanges","detailModeEditing","setDetailModeEditing","getCellValue","cell","_changes$cell$row$id","row","id","column","undefined","setCellValue","value","currentChanges","nextChanges","original","resetChange","rowId","changeset","Object","keys","length","handleKeyDown","useCallback","event","defaultPrevented","shouldTriggerShortcut","key","meta","shift","editing","preventDefault","saveChangesIfNeeded","handleBlur","target","currentTarget","addSavingStates","additionalSavingStates","_","reduce","result","state","Saving","removeSavingState","newSavingStates","Promise","resolve","_temp","allSettled","map","then","responses","forEach","response","index","status","nextSavingStates","Saved","Error","e","reject","rowMoveReason","setRowMoveReason","removeRowMoveReason","columnId","prevState","newState","showWarning","returnValue","useEffect","window","addEventListener","removeEventListener","toggleEditing"],"mappings":";;;;IAOYA;AAAZ,WAAYA,gBAAgB;EACxBA,qCAAiB;EACjBA,mCAAe;EACfA,mCAAe;AACnB,CAAC,EAJWA,gBAAgB,KAAhBA,gBAAgB;SAUZC,UAAUA,CAAkBC,SAAkB,EAAEC,MAA6B;;EAEzF,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;;;EAGvD,MAAM,CAACC,YAAY,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;IACnB9B,iBAAiB;IACjBC,oBAAoB;IACpB0D,aAAa;IACbC,gBAAgB;IAChBC,mBAAmB;IACnBzC,aAAa;IACbW,UAAU;IACVjB,WAAW;IACXlB,YAAY;IACZ6C;GACH;AACL;;;;"}
1
+ {"version":3,"file":"useEditing.js","sources":["../../../../../../../../../src/components/Table3/hooks/features/useEditing.tsx"],"sourcesContent":["import React from 'react';\nimport _ from 'lodash';\nimport { Cell as RTCell } from '@tanstack/react-table';\n\nimport { Table3SaveHandler } from '../../types';\nimport { IndicatorReason } from '../../components/columns/cell/Indicator';\nimport { shouldTriggerShortcut } from '../../../../utils/keyboard';\nimport { Table3Validation } from './useValidation';\nimport { lastCellIndex } from '../../components/rows/Row';\n\nexport enum SavingStatusValue {\n Saving = 'saving',\n Saved = 'saved',\n Error = 'error',\n}\n\nexport function useEditing<TType = unknown>(\n isEnabled: boolean,\n validation: Table3Validation<TType>,\n onSave?: Table3SaveHandler<TType>\n) {\n // used to switch the table into editing mode\n const [isEditing, setIsEditing] = React.useState(false);\n // Saving indicator need to show saving status per row, saving status can have at least two states 'saving', 'saved',\n // 'saved' should remain for a few seconds to show tick icon after row has been saved.\n const [savingStatuses, dispatchSavingStatusAction] = React.useReducer(savingStatusesReducer, null);\n\n // sets of row changes pending save, either they have not saved yet or they have errors\n const [editingState, dispatchEditingAction] = React.useReducer((state: EditingState<TType>, action) => editingReducer<TType>(state, action), null);\n\n const [detailModeEditing, setDetailModeEditing] = React.useState(false);\n\n function getCellValue<T extends TType>(cell: RTCell<T, unknown>) {\n return editingState ? editingState[cell.row.id]?.[cell.column.id] : undefined;\n }\n\n // Saves editing cell value into editing state.\n function setCellValue<T extends TType>(cell: RTCell<T, unknown>, value: unknown) {\n dispatchEditingAction({\n type: EditingActionType.SET_CELL_VALUE,\n payload: { rowId: cell.row.id, cellId: cell.column.id, value, originalValues: cell.row.original },\n });\n }\n\n // Removes changes from editing state by row id\n function resetChange(rowId: string) {\n dispatchEditingAction({\n type: EditingActionType.RESET_CHANGE,\n payload: { rowId },\n });\n validation.resetErrors(rowId);\n }\n\n const handleKeyDown = React.useCallback(\n (event: KeyboardEvent) => {\n if (event.defaultPrevented) {\n return;\n }\n\n if (shouldTriggerShortcut(event, { key: 'e', meta: true, shift: false })) {\n setIsEditing(editing => !editing);\n } else if (shouldTriggerShortcut(event, { key: 's', meta: true, shift: false })) {\n // Prevent default browser save\n event.preventDefault();\n saveChangesIfNeeded();\n }\n },\n [isEditing]\n );\n\n const handleBlur = React.useCallback((event: React.FocusEvent) => {\n if (event.target === event.currentTarget) {\n saveChangesIfNeeded();\n }\n }, []);\n\n // Creates initial saving statuses from changes object\n const addSavingStatuses = () => {\n const changeset = Object.keys(editingState || {});\n const additionalSavingStatuses = _.reduce(\n changeset,\n (result, rowId) => {\n return { ...result, [rowId]: SavingStatusValue.Saving };\n },\n {}\n );\n dispatchSavingStatusAction({\n type: SavingStatusActionType.SET_SAVING_STATUSES,\n payload: { states: additionalSavingStatuses },\n });\n };\n\n // Resets/removes saving status by row id. Used in delayed saving indicator.\n const resetSavingStatus = (rowId: string) => {\n dispatchSavingStatusAction({\n type: SavingStatusActionType.RESET_SAVING_STATUS,\n payload: { rowId },\n });\n };\n\n // Checks if we have changes, then saves them\n const saveChangesIfNeeded = async () => {\n if (!editingState) {\n return;\n }\n\n const changeset = Object.keys(editingState);\n if (onSave && changeset.length) {\n addSavingStatuses();\n\n const responses = await Promise.allSettled(\n changeset.map(rowId => {\n const validationSavePromise = new Promise<void>((resolve, reject) => {\n const changedRow = editingState?.[rowId];\n if (changedRow) {\n validation\n .validate(rowId, changedRow)\n ?.then(() => {\n const savePromise = onSave(changedRow);\n savePromise\n .then(() => {\n resolve();\n })\n .catch(reason => {\n if (reason.errors) {\n validation.setRowErrors(rowId, reason.errors);\n }\n\n reject(reason);\n });\n })\n .catch(() => {\n validation.confirmErrors(rowId);\n dispatchSavingStatusAction({\n type: SavingStatusActionType.SET_SAVING_STATUS,\n payload: { rowId, state: SavingStatusValue.Error },\n });\n reject();\n });\n } else {\n reject();\n }\n });\n return validationSavePromise;\n })\n );\n\n responses.forEach((response, index) => {\n const rowId = changeset[index];\n\n if (response.status === 'fulfilled') {\n resetChange(rowId);\n dispatchSavingStatusAction({\n type: SavingStatusActionType.SET_SAVING_STATUS,\n payload: { rowId, state: SavingStatusValue.Saved },\n });\n } else {\n dispatchSavingStatusAction({\n type: SavingStatusActionType.SET_SAVING_STATUS,\n payload: { rowId, state: SavingStatusValue.Error },\n });\n }\n });\n }\n };\n\n const [rowMoveReason, setRowMoveReason] = React.useState<Record<string, IndicatorReason | null> | null>(null);\n\n const removeRowMoveReason = () => {\n setRowMoveReason(null);\n };\n\n const showWarning = React.useCallback(\n event => {\n if (isEditing && editingState && Object.keys(editingState).length > 0) {\n event.returnValue = true;\n return true;\n }\n\n return false;\n },\n [isEditing, editingState]\n );\n\n function getSavingStatus(rowId: string) {\n return savingStatuses && savingStatuses[rowId];\n }\n\n React.useEffect(() => {\n window.addEventListener('beforeunload', showWarning);\n\n return () => {\n window.removeEventListener('beforeunload', showWarning);\n };\n }, [showWarning]);\n\n React.useEffect(() => {\n if (!isEditing) {\n setDetailModeEditing(false);\n lastCellIndex.value = null;\n }\n }, [isEditing]);\n\n return {\n isEnabled,\n isEditing,\n toggleEditing: setIsEditing,\n changes: editingState,\n getCellValue,\n setCellValue,\n saveChangesIfNeeded,\n detailModeEditing,\n setDetailModeEditing,\n rowMoveReason,\n setRowMoveReason,\n removeRowMoveReason,\n handleKeyDown,\n handleBlur,\n resetChange,\n getSavingStatus,\n resetSavingStatus,\n };\n}\n\nenum EditingActionType {\n SET_CELL_VALUE,\n RESET_CHANGE,\n}\n\ntype EditingState<TType = unknown> = Record<string, TType> | null;\n\ntype EditingAction =\n | { type: EditingActionType.SET_CELL_VALUE; payload: { rowId: string; cellId: string; value: unknown; originalValues } }\n | {\n type: EditingActionType.RESET_CHANGE;\n payload: { rowId: string };\n };\n\nfunction editingReducer<TType = unknown>(state: EditingState<TType>, action: EditingAction): EditingState<TType> {\n switch (action.type) {\n // Set cell value of the row\n case EditingActionType.SET_CELL_VALUE:\n return {\n ...state,\n [action.payload.rowId]: {\n ...(state?.[action.payload.rowId] || action.payload.originalValues),\n [action.payload.cellId]: action.payload.value,\n },\n };\n\n // Reset changes for the row\n case EditingActionType.RESET_CHANGE: {\n let currentChanges: Record<string, TType> | null = { ...state };\n if (currentChanges) {\n delete currentChanges[action.payload.rowId];\n }\n const changeset = Object.keys(currentChanges);\n if (changeset.length === 0) {\n currentChanges = null;\n }\n return currentChanges;\n }\n\n default:\n return state;\n }\n}\n\nenum SavingStatusActionType {\n SET_SAVING_STATUS,\n SET_SAVING_STATUSES,\n RESET_SAVING_STATUS,\n}\n\ntype SavingStatus = Record<string, SavingStatusValue> | null;\n\ntype SavingStatusAction =\n | { type: SavingStatusActionType.SET_SAVING_STATUS; payload: { rowId: string; state: SavingStatusValue } }\n | { type: SavingStatusActionType.SET_SAVING_STATUSES; payload: { states: Record<string, SavingStatusValue> } }\n | { type: SavingStatusActionType.RESET_SAVING_STATUS; payload: { rowId: string } };\n\nfunction savingStatusesReducer(state: SavingStatus, action: SavingStatusAction): SavingStatus {\n switch (action.type) {\n // Set single saving status for the row\n case SavingStatusActionType.SET_SAVING_STATUS:\n return {\n ...state,\n [action.payload.rowId]: action.payload.state,\n };\n // Set multiple saving statuses for multiple rows at the same time\n case SavingStatusActionType.SET_SAVING_STATUSES:\n return {\n ...state,\n ...action.payload.states,\n };\n // Reset/remove saving status for particular row\n case SavingStatusActionType.RESET_SAVING_STATUS: {\n const newSavingStatus = { ...state };\n delete newSavingStatus?.[action.payload.rowId];\n return newSavingStatus;\n }\n\n default:\n return state;\n }\n}\n"],"names":["SavingStatusValue","useEditing","isEnabled","validation","onSave","isEditing","setIsEditing","React","useState","savingStatuses","dispatchSavingStatusAction","useReducer","savingStatusesReducer","editingState","dispatchEditingAction","state","action","editingReducer","detailModeEditing","setDetailModeEditing","getCellValue","cell","_editingState$cell$ro","row","id","column","undefined","setCellValue","value","type","EditingActionType","SET_CELL_VALUE","payload","rowId","cellId","originalValues","original","resetChange","RESET_CHANGE","resetErrors","handleKeyDown","useCallback","event","defaultPrevented","shouldTriggerShortcut","key","meta","shift","editing","preventDefault","saveChangesIfNeeded","handleBlur","target","currentTarget","addSavingStatuses","changeset","Object","keys","additionalSavingStatuses","_","reduce","result","Saving","SavingStatusActionType","SET_SAVING_STATUSES","states","resetSavingStatus","RESET_SAVING_STATUS","Promise","resolve","_temp","length","allSettled","map","validationSavePromise","reject","changedRow","_validation$validate","validate","then","savePromise","catch","reason","errors","setRowErrors","confirmErrors","SET_SAVING_STATUS","Error","responses","forEach","response","index","status","Saved","e","rowMoveReason","setRowMoveReason","removeRowMoveReason","showWarning","returnValue","getSavingStatus","useEffect","window","addEventListener","removeEventListener","lastCellIndex","toggleEditing","changes","currentChanges","newSavingStatus"],"mappings":";;;;;IAUYA;AAAZ,WAAYA,iBAAiB;EACzBA,sCAAiB;EACjBA,oCAAe;EACfA,oCAAe;AACnB,CAAC,EAJWA,iBAAiB,KAAjBA,iBAAiB;SAMbC,UAAUA,CACtBC,SAAkB,EAClBC,UAAmC,EACnCC,MAAiC;;EAGjC,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;;;EAGvD,MAAM,CAACC,cAAc,EAAEC,0BAA0B,CAAC,GAAGH,cAAK,CAACI,UAAU,CAACC,qBAAqB,EAAE,IAAI,CAAC;;EAGlG,MAAM,CAACC,YAAY,EAAEC,qBAAqB,CAAC,GAAGP,cAAK,CAACI,UAAU,CAAC,CAACI,KAA0B,EAAEC,MAAM,KAAKC,cAAc,CAAQF,KAAK,EAAEC,MAAM,CAAC,EAAE,IAAI,CAAC;EAElJ,MAAM,CAACE,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGZ,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EAEvE,SAASY,YAAYA,CAAkBC,IAA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GzB;MACI,OAAO7F,KAAK;;AAExB;AAEA,IAAKgD,sBAIJ;AAJD,WAAKA,sBAAsB;EACvBA,6FAAiB;EACjBA,iGAAmB;EACnBA,iGAAmB;AACvB,CAAC,EAJIA,sBAAsB,KAAtBA,sBAAsB;AAa3B,SAASnD,qBAAqBA,CAACG,KAAmB,EAAEC,MAA0B;EAC1E,QAAQA,MAAM,CAACa,IAAI;;IAEf,KAAKkC,sBAAsB,CAACuB,iBAAiB;MACzC,OAAO;QACH,GAAGvE,KAAK;QACR,CAACC,MAAM,CAACgB,OAAO,CAACC,KAAK,GAAGjB,MAAM,CAACgB,OAAO,CAACjB;OAC1C;;IAEL,KAAKgD,sBAAsB,CAACC,mBAAmB;MAC3C,OAAO;QACH,GAAGjD,KAAK;QACR,GAAGC,MAAM,CAACgB,OAAO,CAACiC;OACrB;;IAEL,KAAKF,sBAAsB,CAACI,mBAAmB;MAAE;QAC7C,MAAM0C,eAAe,GAAG;UAAE,GAAG9F;SAAO;QAC7B8F,eAAe,aAAfA,eAAe,qBAAtB,OAAOA,eAAe,CAAG7F,MAAM,CAACgB,OAAO,CAACC,KAAK,CAAC;QAC9C,OAAO4E,eAAe;;IAG1B;MACI,OAAO9F,KAAK;;AAExB;;;;"}
@@ -0,0 +1,12 @@
1
+ import React__default from 'react';
2
+
3
+ function usePauseShortcuts() {
4
+ const [isShortcutsPaused, setIsShortcutsPaused] = React__default.useState(false);
5
+ return {
6
+ isPaused: isShortcutsPaused,
7
+ pause: setIsShortcutsPaused
8
+ };
9
+ }
10
+
11
+ export { usePauseShortcuts };
12
+ //# sourceMappingURL=usePauseShortcuts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePauseShortcuts.js","sources":["../../../../../../../../../src/components/Table3/hooks/features/usePauseShortcuts.ts"],"sourcesContent":["import React from 'react';\n\nexport function usePauseShortcuts() {\n const [isShortcutsPaused, setIsShortcutsPaused] = React.useState(false);\n\n return {\n isPaused: isShortcutsPaused,\n pause: setIsShortcutsPaused,\n };\n}\n"],"names":["usePauseShortcuts","isShortcutsPaused","setIsShortcutsPaused","React","useState","isPaused","pause"],"mappings":";;SAEgBA,iBAAiBA;EAC7B,MAAM,CAACC,iBAAiB,EAAEC,oBAAoB,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EAEvE,OAAO;IACHC,QAAQ,EAAEJ,iBAAiB;IAC3BK,KAAK,EAAEJ;GACV;AACL;;;;"}
@@ -1,6 +1,7 @@
1
1
  import React__default from 'react';
2
2
 
3
- function useSearch(isEnabled, excludeUnmatchedResultsInSearch = false, loadAll) {
3
+ function useSearch(isEnabled, excludeUnmatchedResultsInSearch = false) {
4
+ const [isSearching, setIsSearching] = React__default.useState(false);
4
5
  const [query, setQuery] = React__default.useState();
5
6
  const [enableHighlighting, setEnableHighlighting] = React__default.useState(true);
6
7
  const [excludeUnmatchedResults, setExcludeUnmatchedResults] = React__default.useState(excludeUnmatchedResultsInSearch);
@@ -19,7 +20,8 @@ function useSearch(isEnabled, excludeUnmatchedResultsInSearch = false, loadAll)
19
20
  setHighlightedColumnIndexes,
20
21
  currentHighlightColumnIndex,
21
22
  setCurrentHighlightColumnIndex,
22
- loadAll
23
+ isSearching,
24
+ setIsSearching
23
25
  };
24
26
  }
25
27
 
@@ -1 +1 @@
1
- {"version":3,"file":"useSearch.js","sources":["../../../../../../../../../src/components/Table3/hooks/features/useSearch.ts"],"sourcesContent":["import React from 'react';\nimport { Table3LoadAllHandler } from '../../types';\n\nexport function useSearch(isEnabled: boolean, excludeUnmatchedResultsInSearch = false, loadAll?: Table3LoadAllHandler) {\n const [query, setQuery] = React.useState<string | undefined>();\n const [enableHighlighting, setEnableHighlighting] = React.useState<boolean>(true);\n const [excludeUnmatchedResults, setExcludeUnmatchedResults] = React.useState<boolean>(excludeUnmatchedResultsInSearch);\n\n // highlighting\n const [highlightedColumnIndexes, setHighlightedColumnIndexes] = React.useState<number[][]>([]);\n const [currentHighlightColumnIndex, setCurrentHighlightColumnIndex] = React.useState<number | undefined>(undefined);\n\n return {\n isEnabled,\n isHighlightingEnabled: enableHighlighting,\n toggleHighlighting: setEnableHighlighting,\n excludeUnmatchedResults,\n toggleExcludeUnmatchedResults: setExcludeUnmatchedResults,\n query,\n setQuery: isEnabled ? setQuery : () => undefined,\n highlightedColumnIndexes,\n setHighlightedColumnIndexes,\n currentHighlightColumnIndex,\n setCurrentHighlightColumnIndex,\n loadAll,\n };\n}\n"],"names":["useSearch","isEnabled","excludeUnmatchedResultsInSearch","loadAll","query","setQuery","React","useState","enableHighlighting","setEnableHighlighting","excludeUnmatchedResults","setExcludeUnmatchedResults","highlightedColumnIndexes","setHighlightedColumnIndexes","currentHighlightColumnIndex","setCurrentHighlightColumnIndex","undefined","isHighlightingEnabled","toggleHighlighting","toggleExcludeUnmatchedResults"],"mappings":";;SAGgBA,SAASA,CAACC,SAAkB,EAAEC,+BAA+B,GAAG,KAAK,EAAEC,OAA8B;EACjH,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGC,cAAK,CAACC,QAAQ,EAAsB;EAC9D,MAAM,CAACC,kBAAkB,EAAEC,qBAAqB,CAAC,GAAGH,cAAK,CAACC,QAAQ,CAAU,IAAI,CAAC;EACjF,MAAM,CAACG,uBAAuB,EAAEC,0BAA0B,CAAC,GAAGL,cAAK,CAACC,QAAQ,CAAUL,+BAA+B,CAAC;;EAGtH,MAAM,CAACU,wBAAwB,EAAEC,2BAA2B,CAAC,GAAGP,cAAK,CAACC,QAAQ,CAAa,EAAE,CAAC;EAC9F,MAAM,CAACO,2BAA2B,EAAEC,8BAA8B,CAAC,GAAGT,cAAK,CAACC,QAAQ,CAAqBS,SAAS,CAAC;EAEnH,OAAO;IACHf,SAAS;IACTgB,qBAAqB,EAAET,kBAAkB;IACzCU,kBAAkB,EAAET,qBAAqB;IACzCC,uBAAuB;IACvBS,6BAA6B,EAAER,0BAA0B;IACzDP,KAAK;IACLC,QAAQ,EAAEJ,SAAS,GAAGI,QAAQ,GAAG,MAAMW,SAAS;IAChDJ,wBAAwB;IACxBC,2BAA2B;IAC3BC,2BAA2B;IAC3BC,8BAA8B;IAC9BZ;GACH;AACL;;;;"}
1
+ {"version":3,"file":"useSearch.js","sources":["../../../../../../../../../src/components/Table3/hooks/features/useSearch.ts"],"sourcesContent":["import React from 'react';\n\nexport function useSearch(isEnabled: boolean, excludeUnmatchedResultsInSearch = false) {\n const [isSearching, setIsSearching] = React.useState(false);\n const [query, setQuery] = React.useState<string | undefined>();\n const [enableHighlighting, setEnableHighlighting] = React.useState<boolean>(true);\n const [excludeUnmatchedResults, setExcludeUnmatchedResults] = React.useState<boolean>(excludeUnmatchedResultsInSearch);\n\n // highlighting\n const [highlightedColumnIndexes, setHighlightedColumnIndexes] = React.useState<number[][]>([]);\n const [currentHighlightColumnIndex, setCurrentHighlightColumnIndex] = React.useState<number | undefined>(undefined);\n\n return {\n isEnabled,\n isHighlightingEnabled: enableHighlighting,\n toggleHighlighting: setEnableHighlighting,\n excludeUnmatchedResults,\n toggleExcludeUnmatchedResults: setExcludeUnmatchedResults,\n query,\n setQuery: isEnabled ? setQuery : () => undefined,\n highlightedColumnIndexes,\n setHighlightedColumnIndexes,\n currentHighlightColumnIndex,\n setCurrentHighlightColumnIndex,\n isSearching,\n setIsSearching,\n };\n}\n"],"names":["useSearch","isEnabled","excludeUnmatchedResultsInSearch","isSearching","setIsSearching","React","useState","query","setQuery","enableHighlighting","setEnableHighlighting","excludeUnmatchedResults","setExcludeUnmatchedResults","highlightedColumnIndexes","setHighlightedColumnIndexes","currentHighlightColumnIndex","setCurrentHighlightColumnIndex","undefined","isHighlightingEnabled","toggleHighlighting","toggleExcludeUnmatchedResults"],"mappings":";;SAEgBA,SAASA,CAACC,SAAkB,EAAEC,+BAA+B,GAAG,KAAK;EACjF,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAC,KAAK,CAAC;EAC3D,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGH,cAAK,CAACC,QAAQ,EAAsB;EAC9D,MAAM,CAACG,kBAAkB,EAAEC,qBAAqB,CAAC,GAAGL,cAAK,CAACC,QAAQ,CAAU,IAAI,CAAC;EACjF,MAAM,CAACK,uBAAuB,EAAEC,0BAA0B,CAAC,GAAGP,cAAK,CAACC,QAAQ,CAAUJ,+BAA+B,CAAC;;EAGtH,MAAM,CAACW,wBAAwB,EAAEC,2BAA2B,CAAC,GAAGT,cAAK,CAACC,QAAQ,CAAa,EAAE,CAAC;EAC9F,MAAM,CAACS,2BAA2B,EAAEC,8BAA8B,CAAC,GAAGX,cAAK,CAACC,QAAQ,CAAqBW,SAAS,CAAC;EAEnH,OAAO;IACHhB,SAAS;IACTiB,qBAAqB,EAAET,kBAAkB;IACzCU,kBAAkB,EAAET,qBAAqB;IACzCC,uBAAuB;IACvBS,6BAA6B,EAAER,0BAA0B;IACzDL,KAAK;IACLC,QAAQ,EAAEP,SAAS,GAAGO,QAAQ,GAAG,MAAMS,SAAS;IAChDJ,wBAAwB;IACxBC,2BAA2B;IAC3BC,2BAA2B;IAC3BC,8BAA8B;IAC9Bb,WAAW;IACXC;GACH;AACL;;;;"}