@elliemae/ds-data-table 3.51.0-next.1 → 3.51.0-next.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/dist/cjs/DSDataTableDefinitions.js +1 -1
  2. package/dist/cjs/DSDataTableDefinitions.js.map +1 -1
  3. package/dist/cjs/addons/Columns/ColumnExpand/ColumnExpand.js +15 -15
  4. package/dist/cjs/addons/Columns/ColumnExpand/ColumnExpand.js.map +2 -2
  5. package/dist/cjs/addons/Columns/ColumnSelectMultiple/ColumnSelectMultiple.js +21 -22
  6. package/dist/cjs/addons/Columns/ColumnSelectMultiple/ColumnSelectMultiple.js.map +2 -2
  7. package/dist/cjs/addons/Columns/ColumnSelectSingle/ColumnSelectSingle.js +5 -5
  8. package/dist/cjs/addons/Columns/ColumnSelectSingle/ColumnSelectSingle.js.map +2 -2
  9. package/dist/cjs/addons/Editables/ComboboxEditableCell/ComboboxEditableCell.js +3 -3
  10. package/dist/cjs/addons/Editables/ComboboxEditableCell/ComboboxEditableCell.js.map +2 -2
  11. package/dist/cjs/addons/Editables/DateEditableCell/DateEditableCell.js +2 -2
  12. package/dist/cjs/addons/Editables/DateEditableCell/DateEditableCell.js.map +2 -2
  13. package/dist/cjs/addons/Editables/TextEditableCell/TextEditableCell.js +3 -3
  14. package/dist/cjs/addons/Editables/TextEditableCell/TextEditableCell.js.map +2 -2
  15. package/dist/cjs/addons/Filters/Components/SelectFilter/BaseSelectFilter.js +2 -2
  16. package/dist/cjs/addons/Filters/Components/SelectFilter/BaseSelectFilter.js.map +2 -2
  17. package/dist/cjs/addons/Pagination/Pagination.js +5 -5
  18. package/dist/cjs/addons/Pagination/Pagination.js.map +2 -2
  19. package/dist/cjs/configs/useStore/createInternalAndPropsContext.js +40 -0
  20. package/dist/cjs/configs/useStore/createInternalAndPropsContext.js.map +7 -0
  21. package/dist/cjs/configs/useStore/index.js +5 -4
  22. package/dist/cjs/configs/useStore/index.js.map +2 -2
  23. package/dist/cjs/configs/useStore/useStore.js +7 -12
  24. package/dist/cjs/configs/useStore/useStore.js.map +2 -2
  25. package/dist/cjs/exported-related/EditableCell.js +4 -4
  26. package/dist/cjs/exported-related/EditableCell.js.map +2 -2
  27. package/dist/cjs/exported-related/FilterBar/FilterBarDropdownMenu.js +2 -2
  28. package/dist/cjs/exported-related/FilterBar/FilterBarDropdownMenu.js.map +2 -2
  29. package/dist/cjs/exported-related/FilterPopover/index.js +7 -7
  30. package/dist/cjs/exported-related/FilterPopover/index.js.map +2 -2
  31. package/dist/cjs/exported-related/FilterPopover/useGetFilterHandlers.js +4 -4
  32. package/dist/cjs/exported-related/FilterPopover/useGetFilterHandlers.js.map +2 -2
  33. package/dist/cjs/exported-related/RowRenderer/DefaultRowContentRenderer.js +11 -10
  34. package/dist/cjs/exported-related/RowRenderer/DefaultRowContentRenderer.js.map +2 -2
  35. package/dist/cjs/exported-related/RowRenderer/index.js +6 -6
  36. package/dist/cjs/exported-related/RowRenderer/index.js.map +2 -2
  37. package/dist/cjs/exported-related/RowRenderer/useRowRendererHandlers.js +12 -12
  38. package/dist/cjs/exported-related/RowRenderer/useRowRendererHandlers.js.map +2 -2
  39. package/dist/cjs/exported-related/RowRenderer/useRowRendererProperties.js +2 -2
  40. package/dist/cjs/exported-related/RowRenderer/useRowRendererProperties.js.map +2 -2
  41. package/dist/cjs/exported-related/RowRenderer/useRowStyle.js +2 -2
  42. package/dist/cjs/exported-related/RowRenderer/useRowStyle.js.map +2 -2
  43. package/dist/cjs/exported-related/Toolbar/Toolbar.js +6 -6
  44. package/dist/cjs/exported-related/Toolbar/Toolbar.js.map +2 -2
  45. package/dist/cjs/parts/Cells/Cell.js +17 -11
  46. package/dist/cjs/parts/Cells/Cell.js.map +2 -2
  47. package/dist/cjs/parts/Cells/CellFactory.js +11 -11
  48. package/dist/cjs/parts/Cells/CellFactory.js.map +2 -2
  49. package/dist/cjs/parts/Cells/index.js +2 -2
  50. package/dist/cjs/parts/Cells/index.js.map +2 -2
  51. package/dist/cjs/parts/Cells/useCellStyle.js +3 -3
  52. package/dist/cjs/parts/Cells/useCellStyle.js.map +2 -2
  53. package/dist/cjs/parts/DnDHandle.js +5 -5
  54. package/dist/cjs/parts/DnDHandle.js.map +2 -2
  55. package/dist/cjs/parts/DropIndicator.js +4 -4
  56. package/dist/cjs/parts/DropIndicator.js.map +2 -2
  57. package/dist/cjs/parts/EmptyContent.js +10 -10
  58. package/dist/cjs/parts/EmptyContent.js.map +2 -2
  59. package/dist/cjs/parts/FilterBar/DeprecatedDropdown.js +6 -1
  60. package/dist/cjs/parts/FilterBar/DeprecatedDropdown.js.map +2 -2
  61. package/dist/cjs/parts/FilterBar/FiltersBar.js +7 -7
  62. package/dist/cjs/parts/FilterBar/FiltersBar.js.map +2 -2
  63. package/dist/cjs/parts/Filters/index.js +5 -5
  64. package/dist/cjs/parts/Filters/index.js.map +2 -2
  65. package/dist/cjs/parts/Headers/EmptyChildrenGroup.js +2 -2
  66. package/dist/cjs/parts/Headers/EmptyChildrenGroup.js.map +2 -2
  67. package/dist/cjs/parts/Headers/HeaderCell.js +13 -13
  68. package/dist/cjs/parts/Headers/HeaderCell.js.map +2 -2
  69. package/dist/cjs/parts/Headers/HeaderCellGroup.js +10 -10
  70. package/dist/cjs/parts/Headers/HeaderCellGroup.js.map +2 -2
  71. package/dist/cjs/parts/Headers/HeaderResizer.js +2 -2
  72. package/dist/cjs/parts/Headers/HeaderResizer.js.map +2 -2
  73. package/dist/cjs/parts/Headers/index.js +8 -8
  74. package/dist/cjs/parts/Headers/index.js.map +2 -2
  75. package/dist/cjs/parts/Headers/useHeaderCellConfig.js +4 -4
  76. package/dist/cjs/parts/Headers/useHeaderCellConfig.js.map +2 -2
  77. package/dist/cjs/parts/Headers/useHeaderCellHandlers.js +7 -7
  78. package/dist/cjs/parts/Headers/useHeaderCellHandlers.js.map +2 -2
  79. package/dist/cjs/parts/Headers/useHeaderResizer.js +8 -8
  80. package/dist/cjs/parts/Headers/useHeaderResizer.js.map +2 -2
  81. package/dist/cjs/parts/HoC/DnDGroupContext.js +39 -0
  82. package/dist/cjs/parts/HoC/DnDGroupContext.js.map +7 -0
  83. package/dist/cjs/parts/HoC/withConditionalDnDColumnContext.js +10 -12
  84. package/dist/cjs/parts/HoC/withConditionalDnDColumnContext.js.map +2 -2
  85. package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js +10 -10
  86. package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js.map +2 -2
  87. package/dist/cjs/parts/HoC/withConditionalDnDSortableContext.js +2 -2
  88. package/dist/cjs/parts/HoC/withConditionalDnDSortableContext.js.map +2 -2
  89. package/dist/cjs/parts/HoC/withDnDSortableColumnContext.js +6 -6
  90. package/dist/cjs/parts/HoC/withDnDSortableColumnContext.js.map +2 -2
  91. package/dist/cjs/parts/HoC/withDnDSortableRowContext.js +3 -3
  92. package/dist/cjs/parts/HoC/withDnDSortableRowContext.js.map +2 -2
  93. package/dist/cjs/parts/Loader.js +4 -4
  94. package/dist/cjs/parts/Loader.js.map +2 -2
  95. package/dist/cjs/parts/MainContent.js +5 -5
  96. package/dist/cjs/parts/MainContent.js.map +2 -2
  97. package/dist/cjs/parts/Row.js +7 -7
  98. package/dist/cjs/parts/Row.js.map +2 -2
  99. package/dist/cjs/parts/RowVariants/RowVariantHeader.js +8 -7
  100. package/dist/cjs/parts/RowVariants/RowVariantHeader.js.map +2 -2
  101. package/dist/cjs/parts/RowVariants/index.js +2 -2
  102. package/dist/cjs/parts/RowVariants/index.js.map +2 -2
  103. package/dist/cjs/parts/Rows.js +7 -7
  104. package/dist/cjs/parts/Rows.js.map +2 -2
  105. package/dist/cjs/parts/TableContent.js +13 -13
  106. package/dist/cjs/parts/TableContent.js.map +2 -2
  107. package/dist/cjs/parts/VirtualRowsList.js +12 -12
  108. package/dist/cjs/parts/VirtualRowsList.js.map +2 -2
  109. package/dist/cjs/types/FunctionalHoC.js.map +1 -1
  110. package/dist/esm/DSDataTableDefinitions.js +1 -1
  111. package/dist/esm/DSDataTableDefinitions.js.map +1 -1
  112. package/dist/esm/addons/Columns/ColumnExpand/ColumnExpand.js +1 -1
  113. package/dist/esm/addons/Columns/ColumnExpand/ColumnExpand.js.map +1 -1
  114. package/dist/esm/addons/Columns/ColumnSelectMultiple/ColumnSelectMultiple.js +2 -3
  115. package/dist/esm/addons/Columns/ColumnSelectMultiple/ColumnSelectMultiple.js.map +2 -2
  116. package/dist/esm/addons/Columns/ColumnSelectSingle/ColumnSelectSingle.js +1 -1
  117. package/dist/esm/addons/Columns/ColumnSelectSingle/ColumnSelectSingle.js.map +1 -1
  118. package/dist/esm/addons/Editables/ComboboxEditableCell/ComboboxEditableCell.js +1 -1
  119. package/dist/esm/addons/Editables/ComboboxEditableCell/ComboboxEditableCell.js.map +1 -1
  120. package/dist/esm/addons/Editables/DateEditableCell/DateEditableCell.js +1 -1
  121. package/dist/esm/addons/Editables/DateEditableCell/DateEditableCell.js.map +1 -1
  122. package/dist/esm/addons/Editables/TextEditableCell/TextEditableCell.js +1 -1
  123. package/dist/esm/addons/Editables/TextEditableCell/TextEditableCell.js.map +1 -1
  124. package/dist/esm/addons/Filters/Components/SelectFilter/BaseSelectFilter.js +1 -1
  125. package/dist/esm/addons/Filters/Components/SelectFilter/BaseSelectFilter.js.map +1 -1
  126. package/dist/esm/addons/Pagination/Pagination.js +1 -1
  127. package/dist/esm/addons/Pagination/Pagination.js.map +1 -1
  128. package/dist/esm/configs/useStore/createInternalAndPropsContext.js +10 -0
  129. package/dist/esm/configs/useStore/createInternalAndPropsContext.js.map +7 -0
  130. package/dist/esm/configs/useStore/index.js +2 -1
  131. package/dist/esm/configs/useStore/index.js.map +2 -2
  132. package/dist/esm/configs/useStore/useStore.js +1 -6
  133. package/dist/esm/configs/useStore/useStore.js.map +2 -2
  134. package/dist/esm/exported-related/EditableCell.js +3 -3
  135. package/dist/esm/exported-related/EditableCell.js.map +2 -2
  136. package/dist/esm/exported-related/FilterBar/FilterBarDropdownMenu.js +1 -1
  137. package/dist/esm/exported-related/FilterBar/FilterBarDropdownMenu.js.map +1 -1
  138. package/dist/esm/exported-related/FilterPopover/index.js +5 -5
  139. package/dist/esm/exported-related/FilterPopover/index.js.map +2 -2
  140. package/dist/esm/exported-related/FilterPopover/useGetFilterHandlers.js +1 -1
  141. package/dist/esm/exported-related/FilterPopover/useGetFilterHandlers.js.map +2 -2
  142. package/dist/esm/exported-related/RowRenderer/DefaultRowContentRenderer.js +4 -3
  143. package/dist/esm/exported-related/RowRenderer/DefaultRowContentRenderer.js.map +2 -2
  144. package/dist/esm/exported-related/RowRenderer/index.js +4 -4
  145. package/dist/esm/exported-related/RowRenderer/index.js.map +2 -2
  146. package/dist/esm/exported-related/RowRenderer/useRowRendererHandlers.js +1 -1
  147. package/dist/esm/exported-related/RowRenderer/useRowRendererHandlers.js.map +2 -2
  148. package/dist/esm/exported-related/RowRenderer/useRowRendererProperties.js +1 -1
  149. package/dist/esm/exported-related/RowRenderer/useRowRendererProperties.js.map +2 -2
  150. package/dist/esm/exported-related/RowRenderer/useRowStyle.js +1 -1
  151. package/dist/esm/exported-related/RowRenderer/useRowStyle.js.map +2 -2
  152. package/dist/esm/exported-related/Toolbar/Toolbar.js +5 -5
  153. package/dist/esm/exported-related/Toolbar/Toolbar.js.map +2 -2
  154. package/dist/esm/parts/Cells/Cell.js +14 -8
  155. package/dist/esm/parts/Cells/Cell.js.map +2 -2
  156. package/dist/esm/parts/Cells/CellFactory.js +6 -6
  157. package/dist/esm/parts/Cells/CellFactory.js.map +2 -2
  158. package/dist/esm/parts/Cells/index.js +1 -1
  159. package/dist/esm/parts/Cells/index.js.map +2 -2
  160. package/dist/esm/parts/Cells/useCellStyle.js +2 -2
  161. package/dist/esm/parts/Cells/useCellStyle.js.map +2 -2
  162. package/dist/esm/parts/DnDHandle.js +5 -5
  163. package/dist/esm/parts/DnDHandle.js.map +2 -2
  164. package/dist/esm/parts/DropIndicator.js +3 -3
  165. package/dist/esm/parts/DropIndicator.js.map +2 -2
  166. package/dist/esm/parts/EmptyContent.js +4 -4
  167. package/dist/esm/parts/EmptyContent.js.map +2 -2
  168. package/dist/esm/parts/FilterBar/DeprecatedDropdown.js +6 -1
  169. package/dist/esm/parts/FilterBar/DeprecatedDropdown.js.map +2 -2
  170. package/dist/esm/parts/FilterBar/FiltersBar.js +1 -1
  171. package/dist/esm/parts/FilterBar/FiltersBar.js.map +1 -1
  172. package/dist/esm/parts/Filters/index.js +6 -6
  173. package/dist/esm/parts/Filters/index.js.map +2 -2
  174. package/dist/esm/parts/Headers/EmptyChildrenGroup.js +1 -1
  175. package/dist/esm/parts/Headers/EmptyChildrenGroup.js.map +2 -2
  176. package/dist/esm/parts/Headers/HeaderCell.js +1 -1
  177. package/dist/esm/parts/Headers/HeaderCell.js.map +1 -1
  178. package/dist/esm/parts/Headers/HeaderCellGroup.js +7 -7
  179. package/dist/esm/parts/Headers/HeaderCellGroup.js.map +2 -2
  180. package/dist/esm/parts/Headers/HeaderResizer.js +1 -1
  181. package/dist/esm/parts/Headers/HeaderResizer.js.map +1 -1
  182. package/dist/esm/parts/Headers/index.js +1 -1
  183. package/dist/esm/parts/Headers/index.js.map +1 -1
  184. package/dist/esm/parts/Headers/useHeaderCellConfig.js +1 -1
  185. package/dist/esm/parts/Headers/useHeaderCellConfig.js.map +1 -1
  186. package/dist/esm/parts/Headers/useHeaderCellHandlers.js +1 -1
  187. package/dist/esm/parts/Headers/useHeaderCellHandlers.js.map +1 -1
  188. package/dist/esm/parts/Headers/useHeaderResizer.js +5 -5
  189. package/dist/esm/parts/Headers/useHeaderResizer.js.map +2 -2
  190. package/dist/esm/parts/HoC/DnDGroupContext.js +9 -0
  191. package/dist/esm/parts/HoC/DnDGroupContext.js.map +7 -0
  192. package/dist/esm/parts/HoC/withConditionalDnDColumnContext.js +7 -9
  193. package/dist/esm/parts/HoC/withConditionalDnDColumnContext.js.map +2 -2
  194. package/dist/esm/parts/HoC/withConditionalDnDRowContext.js +4 -4
  195. package/dist/esm/parts/HoC/withConditionalDnDRowContext.js.map +2 -2
  196. package/dist/esm/parts/HoC/withConditionalDnDSortableContext.js +1 -1
  197. package/dist/esm/parts/HoC/withConditionalDnDSortableContext.js.map +2 -2
  198. package/dist/esm/parts/HoC/withDnDSortableColumnContext.js +4 -4
  199. package/dist/esm/parts/HoC/withDnDSortableColumnContext.js.map +2 -2
  200. package/dist/esm/parts/HoC/withDnDSortableRowContext.js +2 -2
  201. package/dist/esm/parts/HoC/withDnDSortableRowContext.js.map +2 -2
  202. package/dist/esm/parts/Loader.js +3 -3
  203. package/dist/esm/parts/Loader.js.map +2 -2
  204. package/dist/esm/parts/MainContent.js +1 -1
  205. package/dist/esm/parts/MainContent.js.map +1 -1
  206. package/dist/esm/parts/Row.js +3 -3
  207. package/dist/esm/parts/Row.js.map +2 -2
  208. package/dist/esm/parts/RowVariants/RowVariantHeader.js +5 -4
  209. package/dist/esm/parts/RowVariants/RowVariantHeader.js.map +2 -2
  210. package/dist/esm/parts/RowVariants/index.js +1 -1
  211. package/dist/esm/parts/RowVariants/index.js.map +2 -2
  212. package/dist/esm/parts/Rows.js +4 -4
  213. package/dist/esm/parts/Rows.js.map +2 -2
  214. package/dist/esm/parts/TableContent.js +3 -3
  215. package/dist/esm/parts/TableContent.js.map +2 -2
  216. package/dist/esm/parts/VirtualRowsList.js +5 -5
  217. package/dist/esm/parts/VirtualRowsList.js.map +2 -2
  218. package/dist/types/DSDataTableDefinitions.d.ts +1 -1
  219. package/dist/types/configs/useStore/createInternalAndPropsContext.d.ts +15 -0
  220. package/dist/types/configs/useStore/index.d.ts +2 -1
  221. package/dist/types/configs/useStore/useStore.d.ts +0 -13
  222. package/dist/types/exported-related/RowRenderer/index.d.ts +1 -1
  223. package/dist/types/parts/Cells/useCellStyle.d.ts +1 -1
  224. package/dist/types/parts/Headers/index.d.ts +1 -1
  225. package/dist/types/parts/HoC/DnDGroupContext.d.ts +3 -0
  226. package/dist/types/parts/HoC/withConditionalDnDColumnContext.d.ts +1 -4
  227. package/dist/types/parts/HoC/withConditionalDnDSortableContext.d.ts +1 -1
  228. package/dist/types/parts/Loader.d.ts +2 -2
  229. package/dist/types/parts/Rows.d.ts +1 -1
  230. package/dist/types/types/FunctionalHoC.d.ts +1 -1
  231. package/package.json +31 -31
@@ -6,7 +6,7 @@ import { withConditionalDnDColumnContext } from "../HoC/withConditionalDnDColumn
6
6
  import { HeaderCellGroupSortable } from "./HeaderCellGroup.js";
7
7
  import { SortableHeaderCell } from "../SortableHeaderCell.js";
8
8
  import { setSubColumnsGridLayout } from "../../helpers/gridLayoutHelpers.js";
9
- import { usePropsStore } from "../../configs/useStore/useStore.js";
9
+ import { usePropsStore } from "../../configs/useStore/createInternalAndPropsContext.js";
10
10
  const HeadersComp = () => {
11
11
  const isExpandable = usePropsStore((state) => state.isExpandable);
12
12
  const isSkeleton = usePropsStore((state) => state.isSkeleton);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/Headers/index.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useEffect } from 'react';\nimport { StyledHeadWrapper, StyledHeadTr } from '../../styled.js';\nimport { withConditionalDnDColumnContext } from '../HoC/withConditionalDnDColumnContext.js';\nimport { HeaderCellGroupSortable } from './HeaderCellGroup.js';\nimport { SortableHeaderCell } from '../SortableHeaderCell.js';\nimport { setSubColumnsGridLayout } from '../../helpers/gridLayoutHelpers.js';\nimport { usePropsStore } from '../../configs/useStore/useStore.js';\n\nconst HeadersComp = () => {\n const isExpandable = usePropsStore((state) => state.isExpandable);\n const isSkeleton = usePropsStore((state) => state.isSkeleton);\n const colsLayoutStyle = usePropsStore((state) => state.colsLayoutStyle);\n const visibleColumns = usePropsStore((state) => state.visibleColumns);\n const columnHeaderRef = usePropsStore((state) => state.columnHeaderRef);\n const virtualListRef = usePropsStore((state) => state.virtualListRef);\n const getOwnerProps = usePropsStore((store) => store.get);\n\n useEffect(() => {\n // TODO: remove this, for further info see the comment on setSubColumnsGridLayout\n setSubColumnsGridLayout(virtualListRef.current, visibleColumns, true);\n }, [virtualListRef, visibleColumns]);\n\n if (visibleColumns.length === 0 && isSkeleton) {\n return null;\n }\n return (\n <StyledHeadWrapper colsLayoutStyle={colsLayoutStyle} innerRef={columnHeaderRef} getOwnerProps={getOwnerProps}>\n <SortableHeaderCell items={visibleColumns}>\n <StyledHeadTr\n role=\"row\"\n colsLayoutStyle={colsLayoutStyle}\n isExpandable={isExpandable}\n getOwnerProps={getOwnerProps}\n >\n {visibleColumns.map((h, index) => (\n <HeaderCellGroupSortable header={h} key={h.id} isLast={index === visibleColumns.length - 1} />\n ))}\n </StyledHeadTr>\n </SortableHeaderCell>\n </StyledHeadWrapper>\n );\n};\n\nexport const Headers = withConditionalDnDColumnContext(HeadersComp);\n"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useEffect } from 'react';\nimport { StyledHeadWrapper, StyledHeadTr } from '../../styled.js';\nimport { withConditionalDnDColumnContext } from '../HoC/withConditionalDnDColumnContext.js';\nimport { HeaderCellGroupSortable } from './HeaderCellGroup.js';\nimport { SortableHeaderCell } from '../SortableHeaderCell.js';\nimport { setSubColumnsGridLayout } from '../../helpers/gridLayoutHelpers.js';\nimport { usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\n\nconst HeadersComp = () => {\n const isExpandable = usePropsStore((state) => state.isExpandable);\n const isSkeleton = usePropsStore((state) => state.isSkeleton);\n const colsLayoutStyle = usePropsStore((state) => state.colsLayoutStyle);\n const visibleColumns = usePropsStore((state) => state.visibleColumns);\n const columnHeaderRef = usePropsStore((state) => state.columnHeaderRef);\n const virtualListRef = usePropsStore((state) => state.virtualListRef);\n const getOwnerProps = usePropsStore((store) => store.get);\n\n useEffect(() => {\n // TODO: remove this, for further info see the comment on setSubColumnsGridLayout\n setSubColumnsGridLayout(virtualListRef.current, visibleColumns, true);\n }, [virtualListRef, visibleColumns]);\n\n if (visibleColumns.length === 0 && isSkeleton) {\n return null;\n }\n return (\n <StyledHeadWrapper colsLayoutStyle={colsLayoutStyle} innerRef={columnHeaderRef} getOwnerProps={getOwnerProps}>\n <SortableHeaderCell items={visibleColumns}>\n <StyledHeadTr\n role=\"row\"\n colsLayoutStyle={colsLayoutStyle}\n isExpandable={isExpandable}\n getOwnerProps={getOwnerProps}\n >\n {visibleColumns.map((h, index) => (\n <HeaderCellGroupSortable header={h} key={h.id} isLast={index === visibleColumns.length - 1} />\n ))}\n </StyledHeadTr>\n </SortableHeaderCell>\n </StyledHeadWrapper>\n );\n};\n\nexport const Headers = withConditionalDnDColumnContext(HeadersComp);\n"],
5
5
  "mappings": "AAAA,YAAY,WAAW;ACmCX;AAnCZ,SAAgB,iBAAiB;AACjC,SAAS,mBAAmB,oBAAoB;AAChD,SAAS,uCAAuC;AAChD,SAAS,+BAA+B;AACxC,SAAS,0BAA0B;AACnC,SAAS,+BAA+B;AACxC,SAAS,qBAAqB;AAE9B,MAAM,cAAc,MAAM;AACxB,QAAM,eAAe,cAAc,CAAC,UAAU,MAAM,YAAY;AAChE,QAAM,aAAa,cAAc,CAAC,UAAU,MAAM,UAAU;AAC5D,QAAM,kBAAkB,cAAc,CAAC,UAAU,MAAM,eAAe;AACtE,QAAM,iBAAiB,cAAc,CAAC,UAAU,MAAM,cAAc;AACpE,QAAM,kBAAkB,cAAc,CAAC,UAAU,MAAM,eAAe;AACtE,QAAM,iBAAiB,cAAc,CAAC,UAAU,MAAM,cAAc;AACpE,QAAM,gBAAgB,cAAc,CAAC,UAAU,MAAM,GAAG;AAExD,YAAU,MAAM;AAEd,4BAAwB,eAAe,SAAS,gBAAgB,IAAI;AAAA,EACtE,GAAG,CAAC,gBAAgB,cAAc,CAAC;AAEnC,MAAI,eAAe,WAAW,KAAK,YAAY;AAC7C,WAAO;AAAA,EACT;AACA,SACE,oBAAC,qBAAkB,iBAAkC,UAAU,iBAAiB,eAC9E,8BAAC,sBAAmB,OAAO,gBACzB;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MAEC,yBAAe,IAAI,CAAC,GAAG,UACtB,oBAAC,2BAAwB,QAAQ,GAAc,QAAQ,UAAU,eAAe,SAAS,KAAhD,EAAE,EAAiD,CAC7F;AAAA;AAAA,EACH,GACF,GACF;AAEJ;AAEO,MAAM,UAAU,gCAAgC,WAAW;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { useContext, useMemo } from "react";
3
3
  import { SortableItemContext } from "../HoC/SortableItemContext.js";
4
- import { useInternalStore, usePropsStore } from "../../configs/useStore/useStore.js";
4
+ import { useInternalStore, usePropsStore } from "../../configs/useStore/createInternalAndPropsContext.js";
5
5
  const useHeaderCellConfig = ({ column, isDragOverlay = false }) => {
6
6
  const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);
7
7
  const isResizeable = usePropsStore((state) => state.isResizeable);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/Headers/useHeaderCellConfig.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport { useContext, useMemo } from 'react';\nimport { SortableItemContext } from '../HoC/SortableItemContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { useInternalStore, usePropsStore } from '../../configs/useStore/useStore.js';\n\ntype UseHeaderCellConfigType = (args: { column: DSDataTableT.InternalColumn; isDragOverlay?: boolean }) => {\n hasFilter: boolean;\n hasDnD: boolean;\n hasSortingCaret: boolean;\n hasRightIcons: boolean;\n isDragging: boolean;\n shouldShowDnD: boolean;\n shouldShowResize: boolean;\n hCols: string[];\n};\n\nexport const useHeaderCellConfig: UseHeaderCellConfigType = ({ column, isDragOverlay = false }) => {\n const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);\n const isResizeable = usePropsStore((state) => state.isResizeable);\n const reduxHeaders = useInternalStore((state) => state.reduxHeaders);\n\n const { draggableProps } = useContext(SortableItemContext);\n\n const reduxHeader = useMemo(() => reduxHeaders[column.id], [reduxHeaders, column]);\n\n const hasFilter = !!(column.filter || column.Filter);\n\n const hasDnD = dragAndDropColumns && !column.disableDnD;\n\n const hasSortingCaret = Boolean(column.canSort);\n\n const hasRightIcons = !isDragOverlay && (hasSortingCaret || hasFilter);\n\n const isDragging = draggableProps && draggableProps.isDragging;\n\n const shouldShowDnD =\n hasDnD &&\n ((reduxHeader?.showDnDHandle && draggableProps && !draggableProps.active) ||\n (draggableProps && draggableProps.isDragging) ||\n isDragOverlay);\n\n const hasResize = isResizeable && column.canResize !== false && !column.columns;\n\n const shouldShowResize = hasResize && !isDragOverlay && !isDragging;\n\n // Column definition\n const hCols = ['auto'];\n if (hasRightIcons) hCols.push('min-content');\n if (shouldShowDnD) hCols.unshift('min-content');\n\n return {\n hasFilter,\n hasDnD,\n hasSortingCaret,\n hasRightIcons,\n isDragging,\n hCols,\n shouldShowDnD,\n shouldShowResize,\n };\n};\n"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\nimport { useContext, useMemo } from 'react';\nimport { SortableItemContext } from '../HoC/SortableItemContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { useInternalStore, usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\n\ntype UseHeaderCellConfigType = (args: { column: DSDataTableT.InternalColumn; isDragOverlay?: boolean }) => {\n hasFilter: boolean;\n hasDnD: boolean;\n hasSortingCaret: boolean;\n hasRightIcons: boolean;\n isDragging: boolean;\n shouldShowDnD: boolean;\n shouldShowResize: boolean;\n hCols: string[];\n};\n\nexport const useHeaderCellConfig: UseHeaderCellConfigType = ({ column, isDragOverlay = false }) => {\n const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);\n const isResizeable = usePropsStore((state) => state.isResizeable);\n const reduxHeaders = useInternalStore((state) => state.reduxHeaders);\n\n const { draggableProps } = useContext(SortableItemContext);\n\n const reduxHeader = useMemo(() => reduxHeaders[column.id], [reduxHeaders, column]);\n\n const hasFilter = !!(column.filter || column.Filter);\n\n const hasDnD = dragAndDropColumns && !column.disableDnD;\n\n const hasSortingCaret = Boolean(column.canSort);\n\n const hasRightIcons = !isDragOverlay && (hasSortingCaret || hasFilter);\n\n const isDragging = draggableProps && draggableProps.isDragging;\n\n const shouldShowDnD =\n hasDnD &&\n ((reduxHeader?.showDnDHandle && draggableProps && !draggableProps.active) ||\n (draggableProps && draggableProps.isDragging) ||\n isDragOverlay);\n\n const hasResize = isResizeable && column.canResize !== false && !column.columns;\n\n const shouldShowResize = hasResize && !isDragOverlay && !isDragging;\n\n // Column definition\n const hCols = ['auto'];\n if (hasRightIcons) hCols.push('min-content');\n if (shouldShowDnD) hCols.unshift('min-content');\n\n return {\n hasFilter,\n hasDnD,\n hasSortingCaret,\n hasRightIcons,\n isDragging,\n hCols,\n shouldShowDnD,\n shouldShowResize,\n };\n};\n"],
5
5
  "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,YAAY,eAAe;AACpC,SAAS,2BAA2B;AAEpC,SAAS,kBAAkB,qBAAqB;AAazC,MAAM,sBAA+C,CAAC,EAAE,QAAQ,gBAAgB,MAAM,MAAM;AACjG,QAAM,qBAAqB,cAAc,CAAC,UAAU,MAAM,kBAAkB;AAC5E,QAAM,eAAe,cAAc,CAAC,UAAU,MAAM,YAAY;AAChE,QAAM,eAAe,iBAAiB,CAAC,UAAU,MAAM,YAAY;AAEnE,QAAM,EAAE,eAAe,IAAI,WAAW,mBAAmB;AAEzD,QAAM,cAAc,QAAQ,MAAM,aAAa,OAAO,EAAE,GAAG,CAAC,cAAc,MAAM,CAAC;AAEjF,QAAM,YAAY,CAAC,EAAE,OAAO,UAAU,OAAO;AAE7C,QAAM,SAAS,sBAAsB,CAAC,OAAO;AAE7C,QAAM,kBAAkB,QAAQ,OAAO,OAAO;AAE9C,QAAM,gBAAgB,CAAC,kBAAkB,mBAAmB;AAE5D,QAAM,aAAa,kBAAkB,eAAe;AAEpD,QAAM,gBACJ,WACE,aAAa,iBAAiB,kBAAkB,CAAC,eAAe,UAC/D,kBAAkB,eAAe,cAClC;AAEJ,QAAM,YAAY,gBAAgB,OAAO,cAAc,SAAS,CAAC,OAAO;AAExE,QAAM,mBAAmB,aAAa,CAAC,iBAAiB,CAAC;AAGzD,QAAM,QAAQ,CAAC,MAAM;AACrB,MAAI,cAAe,OAAM,KAAK,aAAa;AAC3C,MAAI,cAAe,OAAM,QAAQ,aAAa;AAE9C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { useCallback, useMemo } from "react";
3
- import { useInternalStore, usePropsStore } from "../../configs/useStore/useStore.js";
3
+ import { useInternalStore, usePropsStore } from "../../configs/useStore/createInternalAndPropsContext.js";
4
4
  const buildNextHeader = (reduxHeader, value, hasFilter, hasDnD, hasSortingCaret, withTabStops = false) => ({
5
5
  hideFilterMenu: true,
6
6
  // Do this to overwrite it if it exists
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/Headers/useHeaderCellHandlers.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable max-params */\nimport { useCallback, useMemo } from 'react';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { useInternalStore, usePropsStore } from '../../configs/useStore/useStore.js';\ntype UseHeaderCellHandlersType = (args: {\n hasFilter: boolean;\n column: DSDataTableT.InternalColumn;\n hasDnD: boolean;\n dragHandleRef: React.MutableRefObject<HTMLDivElement | null>;\n sortRef: React.MutableRefObject<HTMLButtonElement | null>;\n filterIconRef: React.MutableRefObject<HTMLButtonElement | null>;\n resizeHandlerRef: React.MutableRefObject<HTMLInputElement | null>;\n hasSortingCaret: boolean;\n isDragOverlay?: boolean;\n draggableProps: DSDataTableT.DraggablePropsT;\n}) => {\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n handleSort: React.MouseEventHandler;\n onKeyDown: React.KeyboardEventHandler;\n onFocus: React.FocusEventHandler;\n onBlur: React.FocusEventHandler;\n};\n\n// TODO: reduxHeader was a mistake from the start.\n// Please remove this and make this logic more simple and\n// easy to follow.\nconst buildNextHeader = (\n reduxHeader: DSDataTableT.ReduxHeader,\n value: boolean,\n hasFilter: boolean,\n hasDnD: boolean,\n hasSortingCaret: boolean,\n withTabStops = false,\n) => ({\n hideFilterMenu: true, // Do this to overwrite it if it exists\n ...reduxHeader,\n hideFilterButton: !(hasFilter && value),\n showDnDHandle: hasDnD && value,\n showSortCaret: hasSortingCaret,\n withTabStops,\n});\n\nconst getNextSortedVisibleColumns = (\n visibleColumns: DSDataTableT.InternalColumn[],\n columnId: string,\n isSortedDesc: boolean,\n) => {\n const doit = (columns: DSDataTableT.InternalColumn[]) =>\n columns.map((col) => {\n const newCol = { ...col };\n delete newCol.isSortedDesc;\n if (col.id === columnId) {\n newCol.isSortedDesc = isSortedDesc;\n }\n if (newCol.columns) {\n newCol.columns = doit(newCol.columns);\n }\n return newCol;\n });\n return doit(visibleColumns);\n};\n\nexport const useHeaderCellHandlers: UseHeaderCellHandlersType = ({\n hasFilter,\n column,\n hasDnD,\n dragHandleRef,\n filterIconRef,\n sortRef,\n resizeHandlerRef,\n hasSortingCaret,\n isDragOverlay,\n draggableProps,\n}) => {\n const onColumnSortChange = usePropsStore((state) => state.onColumnSortChange);\n const onColumnSort = usePropsStore((state) => state.onColumnSort);\n const visibleColumns = usePropsStore((state) => state.visibleColumns);\n const setFocusedRowId = useInternalStore((state) => state.setFocusedRowId);\n const patchHeader = useInternalStore((state) => state.patchHeader);\n const reduxHeaders = useInternalStore((state) => state.reduxHeaders);\n\n const reduxHeader = useMemo(() => reduxHeaders[column.id], [reduxHeaders, column]);\n\n const headerRef = column.ref;\n\n const onMouseEnter: React.MouseEventHandler = useCallback(() => {\n patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD, hasSortingCaret));\n }, [column.id, hasDnD, hasFilter, patchHeader, reduxHeader, hasSortingCaret]);\n\n const onMouseLeave: React.MouseEventHandler = useCallback(() => {\n if (!headerRef?.current?.contains(document.activeElement)) {\n patchHeader(column.id, buildNextHeader(reduxHeader, false, hasFilter, hasDnD, false));\n }\n }, [column.id, hasDnD, hasFilter, headerRef, patchHeader, reduxHeader]);\n\n const handleSort: React.MouseEventHandler = useCallback(() => {\n if (column.canSort) {\n onColumnSortChange?.({\n column: column.id,\n direction: column.isSortedDesc ? 'ASC' : 'DESC',\n });\n onColumnSort(\n getNextSortedVisibleColumns(visibleColumns, column.id, !column.isSortedDesc),\n column.id,\n column.isSortedDesc ? 'ASC' : 'DESC',\n );\n }\n }, [column.canSort, column.id, column.isSortedDesc, onColumnSort, onColumnSortChange, visibleColumns]);\n\n const isActive = draggableProps && draggableProps.active;\n\n const onKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n // we do the same as the draggable rows.\n // we stop the event if the overlay is active\n // main reason is the tab key\n if (isDragOverlay || isActive) {\n e.preventDefault();\n }\n\n if (e.currentTarget !== e.target) return;\n if (e.code === 'ArrowDown' && column.canSort) {\n e.preventDefault();\n onColumnSortChange?.({\n column: column.id,\n direction: 'DESC',\n });\n onColumnSort(getNextSortedVisibleColumns(visibleColumns, column.id, true), column.id, 'DESC');\n } else if (e.code === 'ArrowUp' && column.canSort) {\n e.preventDefault();\n onColumnSortChange?.({\n column: column.id,\n direction: 'ASC',\n });\n onColumnSort(getNextSortedVisibleColumns(visibleColumns, column.id, false), column.id, 'ASC');\n } else if (['Enter', 'Space'].includes(e.code)) {\n patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD, hasSortingCaret, true));\n // Elements don't not yet exist\n setTimeout(() => {\n if (dragHandleRef.current) dragHandleRef.current.focus();\n else if (filterIconRef.current) filterIconRef.current.focus();\n else if (resizeHandlerRef.current) resizeHandlerRef.current.focus();\n else if (sortRef?.current) sortRef.current.focus();\n });\n }\n },\n [\n isDragOverlay,\n isActive,\n column.canSort,\n column.id,\n onColumnSortChange,\n onColumnSort,\n visibleColumns,\n patchHeader,\n reduxHeader,\n hasFilter,\n hasDnD,\n hasSortingCaret,\n dragHandleRef,\n filterIconRef,\n resizeHandlerRef,\n sortRef,\n ],\n );\n\n const onFocus: React.FocusEventHandler = useCallback(\n (e) => {\n // Don't do anything if focus wasn't placed in the element (bubling issues)\n const possibleTargets: (HTMLElement | null)[] = [\n dragHandleRef.current,\n filterIconRef.current,\n resizeHandlerRef.current,\n ];\n if (e.target === headerRef?.current) {\n patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD, hasSortingCaret));\n setFocusedRowId(null);\n }\n\n if (possibleTargets.includes(e.target as HTMLElement | null)) {\n patchHeader(column.id, {\n hideFilterButton: !hasFilter,\n showDnDHandle: hasDnD,\n withTabStops: true,\n });\n setFocusedRowId(null);\n }\n },\n [\n column.id,\n dragHandleRef,\n filterIconRef,\n hasDnD,\n hasFilter,\n headerRef,\n patchHeader,\n reduxHeader,\n resizeHandlerRef,\n setFocusedRowId,\n hasSortingCaret,\n ],\n );\n\n const onBlur: React.FocusEventHandler = useCallback(\n (e) => {\n // Don't do anything if blur was caused by going to a child\n if (e.relatedTarget === dragHandleRef.current) return;\n if (e.relatedTarget === filterIconRef.current) return;\n if (e.relatedTarget === resizeHandlerRef.current) return;\n if (e.relatedTarget === sortRef?.current) return;\n patchHeader(column.id, buildNextHeader(reduxHeader, false, hasFilter, hasDnD, false));\n },\n [dragHandleRef, filterIconRef, resizeHandlerRef, sortRef, patchHeader, column.id, reduxHeader, hasFilter, hasDnD],\n );\n\n return { onMouseEnter, onMouseLeave, handleSort, onKeyDown, onBlur, onFocus };\n};\n"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable max-params */\nimport { useCallback, useMemo } from 'react';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { useInternalStore, usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\ntype UseHeaderCellHandlersType = (args: {\n hasFilter: boolean;\n column: DSDataTableT.InternalColumn;\n hasDnD: boolean;\n dragHandleRef: React.MutableRefObject<HTMLDivElement | null>;\n sortRef: React.MutableRefObject<HTMLButtonElement | null>;\n filterIconRef: React.MutableRefObject<HTMLButtonElement | null>;\n resizeHandlerRef: React.MutableRefObject<HTMLInputElement | null>;\n hasSortingCaret: boolean;\n isDragOverlay?: boolean;\n draggableProps: DSDataTableT.DraggablePropsT;\n}) => {\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n handleSort: React.MouseEventHandler;\n onKeyDown: React.KeyboardEventHandler;\n onFocus: React.FocusEventHandler;\n onBlur: React.FocusEventHandler;\n};\n\n// TODO: reduxHeader was a mistake from the start.\n// Please remove this and make this logic more simple and\n// easy to follow.\nconst buildNextHeader = (\n reduxHeader: DSDataTableT.ReduxHeader,\n value: boolean,\n hasFilter: boolean,\n hasDnD: boolean,\n hasSortingCaret: boolean,\n withTabStops = false,\n) => ({\n hideFilterMenu: true, // Do this to overwrite it if it exists\n ...reduxHeader,\n hideFilterButton: !(hasFilter && value),\n showDnDHandle: hasDnD && value,\n showSortCaret: hasSortingCaret,\n withTabStops,\n});\n\nconst getNextSortedVisibleColumns = (\n visibleColumns: DSDataTableT.InternalColumn[],\n columnId: string,\n isSortedDesc: boolean,\n) => {\n const doit = (columns: DSDataTableT.InternalColumn[]) =>\n columns.map((col) => {\n const newCol = { ...col };\n delete newCol.isSortedDesc;\n if (col.id === columnId) {\n newCol.isSortedDesc = isSortedDesc;\n }\n if (newCol.columns) {\n newCol.columns = doit(newCol.columns);\n }\n return newCol;\n });\n return doit(visibleColumns);\n};\n\nexport const useHeaderCellHandlers: UseHeaderCellHandlersType = ({\n hasFilter,\n column,\n hasDnD,\n dragHandleRef,\n filterIconRef,\n sortRef,\n resizeHandlerRef,\n hasSortingCaret,\n isDragOverlay,\n draggableProps,\n}) => {\n const onColumnSortChange = usePropsStore((state) => state.onColumnSortChange);\n const onColumnSort = usePropsStore((state) => state.onColumnSort);\n const visibleColumns = usePropsStore((state) => state.visibleColumns);\n const setFocusedRowId = useInternalStore((state) => state.setFocusedRowId);\n const patchHeader = useInternalStore((state) => state.patchHeader);\n const reduxHeaders = useInternalStore((state) => state.reduxHeaders);\n\n const reduxHeader = useMemo(() => reduxHeaders[column.id], [reduxHeaders, column]);\n\n const headerRef = column.ref;\n\n const onMouseEnter: React.MouseEventHandler = useCallback(() => {\n patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD, hasSortingCaret));\n }, [column.id, hasDnD, hasFilter, patchHeader, reduxHeader, hasSortingCaret]);\n\n const onMouseLeave: React.MouseEventHandler = useCallback(() => {\n if (!headerRef?.current?.contains(document.activeElement)) {\n patchHeader(column.id, buildNextHeader(reduxHeader, false, hasFilter, hasDnD, false));\n }\n }, [column.id, hasDnD, hasFilter, headerRef, patchHeader, reduxHeader]);\n\n const handleSort: React.MouseEventHandler = useCallback(() => {\n if (column.canSort) {\n onColumnSortChange?.({\n column: column.id,\n direction: column.isSortedDesc ? 'ASC' : 'DESC',\n });\n onColumnSort(\n getNextSortedVisibleColumns(visibleColumns, column.id, !column.isSortedDesc),\n column.id,\n column.isSortedDesc ? 'ASC' : 'DESC',\n );\n }\n }, [column.canSort, column.id, column.isSortedDesc, onColumnSort, onColumnSortChange, visibleColumns]);\n\n const isActive = draggableProps && draggableProps.active;\n\n const onKeyDown: React.KeyboardEventHandler = useCallback(\n (e) => {\n // we do the same as the draggable rows.\n // we stop the event if the overlay is active\n // main reason is the tab key\n if (isDragOverlay || isActive) {\n e.preventDefault();\n }\n\n if (e.currentTarget !== e.target) return;\n if (e.code === 'ArrowDown' && column.canSort) {\n e.preventDefault();\n onColumnSortChange?.({\n column: column.id,\n direction: 'DESC',\n });\n onColumnSort(getNextSortedVisibleColumns(visibleColumns, column.id, true), column.id, 'DESC');\n } else if (e.code === 'ArrowUp' && column.canSort) {\n e.preventDefault();\n onColumnSortChange?.({\n column: column.id,\n direction: 'ASC',\n });\n onColumnSort(getNextSortedVisibleColumns(visibleColumns, column.id, false), column.id, 'ASC');\n } else if (['Enter', 'Space'].includes(e.code)) {\n patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD, hasSortingCaret, true));\n // Elements don't not yet exist\n setTimeout(() => {\n if (dragHandleRef.current) dragHandleRef.current.focus();\n else if (filterIconRef.current) filterIconRef.current.focus();\n else if (resizeHandlerRef.current) resizeHandlerRef.current.focus();\n else if (sortRef?.current) sortRef.current.focus();\n });\n }\n },\n [\n isDragOverlay,\n isActive,\n column.canSort,\n column.id,\n onColumnSortChange,\n onColumnSort,\n visibleColumns,\n patchHeader,\n reduxHeader,\n hasFilter,\n hasDnD,\n hasSortingCaret,\n dragHandleRef,\n filterIconRef,\n resizeHandlerRef,\n sortRef,\n ],\n );\n\n const onFocus: React.FocusEventHandler = useCallback(\n (e) => {\n // Don't do anything if focus wasn't placed in the element (bubling issues)\n const possibleTargets: (HTMLElement | null)[] = [\n dragHandleRef.current,\n filterIconRef.current,\n resizeHandlerRef.current,\n ];\n if (e.target === headerRef?.current) {\n patchHeader(column.id, buildNextHeader(reduxHeader, true, hasFilter, hasDnD, hasSortingCaret));\n setFocusedRowId(null);\n }\n\n if (possibleTargets.includes(e.target as HTMLElement | null)) {\n patchHeader(column.id, {\n hideFilterButton: !hasFilter,\n showDnDHandle: hasDnD,\n withTabStops: true,\n });\n setFocusedRowId(null);\n }\n },\n [\n column.id,\n dragHandleRef,\n filterIconRef,\n hasDnD,\n hasFilter,\n headerRef,\n patchHeader,\n reduxHeader,\n resizeHandlerRef,\n setFocusedRowId,\n hasSortingCaret,\n ],\n );\n\n const onBlur: React.FocusEventHandler = useCallback(\n (e) => {\n // Don't do anything if blur was caused by going to a child\n if (e.relatedTarget === dragHandleRef.current) return;\n if (e.relatedTarget === filterIconRef.current) return;\n if (e.relatedTarget === resizeHandlerRef.current) return;\n if (e.relatedTarget === sortRef?.current) return;\n patchHeader(column.id, buildNextHeader(reduxHeader, false, hasFilter, hasDnD, false));\n },\n [dragHandleRef, filterIconRef, resizeHandlerRef, sortRef, patchHeader, column.id, reduxHeader, hasFilter, hasDnD],\n );\n\n return { onMouseEnter, onMouseLeave, handleSort, onKeyDown, onBlur, onFocus };\n};\n"],
5
5
  "mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,aAAa,eAAe;AAErC,SAAS,kBAAkB,qBAAqB;AAwBhD,MAAM,kBAAkB,CACtB,aACA,OACA,WACA,QACA,iBACA,eAAe,WACX;AAAA,EACJ,gBAAgB;AAAA;AAAA,EAChB,GAAG;AAAA,EACH,kBAAkB,EAAE,aAAa;AAAA,EACjC,eAAe,UAAU;AAAA,EACzB,eAAe;AAAA,EACf;AACF;AAEA,MAAM,8BAA8B,CAClC,gBACA,UACA,iBACG;AACH,QAAM,OAAO,CAAC,YACZ,QAAQ,IAAI,CAAC,QAAQ;AACnB,UAAM,SAAS,EAAE,GAAG,IAAI;AACxB,WAAO,OAAO;AACd,QAAI,IAAI,OAAO,UAAU;AACvB,aAAO,eAAe;AAAA,IACxB;AACA,QAAI,OAAO,SAAS;AAClB,aAAO,UAAU,KAAK,OAAO,OAAO;AAAA,IACtC;AACA,WAAO;AAAA,EACT,CAAC;AACH,SAAO,KAAK,cAAc;AAC5B;AAEO,MAAM,wBAAmD,CAAC;AAAA,EAC/D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,Q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;AAAA,QAC9C,cAAc;AAAA,QACd,cAAc;AAAA,QACd,iBAAiB;AAAA,MACnB;AACA,UAAI,EAAE,WAAW,WAAW,SAAS;AACnC,oBAAY,OAAO,IAAI,gBAAgB,aAAa,MAAM,WAAW,QAAQ,eAAe,CAAC;AAC7F,wBAAgB,IAAI;AAAA,MACtB;AAEA,UAAI,gBAAgB,SAAS,EAAE,MAA4B,GAAG;AAC5D,oBAAY,OAAO,IAAI;AAAA,UACrB,kBAAkB,CAAC;AAAA,UACnB,eAAe;AAAA,UACf,cAAc;AAAA,QAChB,CAAC;AACD,wBAAgB,IAAI;AAAA,MACtB;AAAA,IACF;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,QAAM,SAAkC;AAAA,IACtC,CAAC,MAAM;AAEL,UAAI,EAAE,kBAAkB,cAAc,QAAS;AAC/C,UAAI,EAAE,kBAAkB,cAAc,QAAS;AAC/C,UAAI,EAAE,kBAAkB,iBAAiB,QAAS;AAClD,UAAI,EAAE,kBAAkB,SAAS,QAAS;AAC1C,kBAAY,OAAO,IAAI,gBAAgB,aAAa,OAAO,WAAW,QAAQ,KAAK,CAAC;AAAA,IACtF;AAAA,IACA,CAAC,eAAe,eAAe,kBAAkB,SAAS,aAAa,OAAO,IAAI,aAAa,WAAW,MAAM;AAAA,EAClH;AAEA,SAAO,EAAE,cAAc,cAAc,YAAY,WAAW,QAAQ,QAAQ;AAC9E;",
6
6
  "names": []
7
7
  }
@@ -1,13 +1,13 @@
1
1
  import * as React from "react";
2
- import { useCallback, useMemo, useState } from "react";
3
2
  import { cloneDeep } from "lodash";
3
+ import { useCallback, useMemo, useState } from "react";
4
+ import { usePropsStore } from "../../configs/useStore/createInternalAndPropsContext.js";
4
5
  import {
5
- getGridLayout,
6
6
  changeGridLayout,
7
+ getGridLayout,
7
8
  removeGridLayout,
8
9
  setSubColumnsGridLayout
9
10
  } from "../../helpers/gridLayoutHelpers.js";
10
- import { usePropsStore } from "../../configs/useStore/useStore.js";
11
11
  const narrow = (value, min, max) => Math.min(Math.max(value, min ?? 30), max ?? Infinity);
12
12
  const getCorrectDelta = (e) => {
13
13
  let multiplier = 1;
@@ -63,7 +63,7 @@ const useHeaderResizer = ({
63
63
  }, [pushColumnSizeChange, virtualListRef, realColumnIndex]);
64
64
  const onResizeHandler = useCallback(
65
65
  (e) => {
66
- if (realColumnIndex == -1) return;
66
+ if (realColumnIndex === -1) return;
67
67
  const delta = ("clientX" in e ? e.clientX : e.touches[0].clientX) - (innerRef.current?.getBoundingClientRect().x ?? 0);
68
68
  const originalWidth = getGridLayout(virtualListRef.current)[realColumnIndex];
69
69
  const widthWithDelta = narrow(
@@ -80,7 +80,7 @@ const useHeaderResizer = ({
80
80
  );
81
81
  const handleKeyboardResize = useCallback(
82
82
  (e) => {
83
- if (realColumnIndex == -1) return;
83
+ if (realColumnIndex === -1) return;
84
84
  if (e.key === "Enter") {
85
85
  e.stopPropagation();
86
86
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/Headers/useHeaderResizer.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useCallback, useMemo, useState } from 'react';\nimport { cloneDeep } from 'lodash';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport {\n getGridLayout,\n changeGridLayout,\n removeGridLayout,\n setSubColumnsGridLayout,\n} from '../../helpers/gridLayoutHelpers.js';\nimport { usePropsStore } from '../../configs/useStore/useStore.js';\n\n// if number > max => max\n// if number < min => min\n// else => number\nconst narrow = (value: number, min: number | undefined, max: number | undefined): number =>\n Math.min(Math.max(value, min ?? 30), max ?? Infinity);\n\n// Returns the delta of the keyboard event\nconst getCorrectDelta = (e: React.KeyboardEvent) => {\n let multiplier = 1;\n\n if (e.shiftKey) multiplier *= 5;\n if (e.altKey) multiplier *= 10;\n\n if (e.code === 'ArrowLeft') {\n return -multiplier;\n }\n if (e.code === 'ArrowRight') {\n return multiplier;\n }\n return 0;\n};\n\nexport const useHeaderResizer = ({\n columnId,\n innerRef,\n}: {\n columnId: string;\n innerRef: React.MutableRefObject<HTMLInputElement | null>;\n}) => {\n const visibleColumns = usePropsStore((state) => state.visibleColumns);\n const onColumnResize = usePropsStore((state) => state.onColumnResize);\n const onColumnSizeChange = usePropsStore((state) => state.onColumnSizeChange);\n const virtualListRef = usePropsStore((state) => state.virtualListRef);\n\n const [isResizing, setIsResizing] = useState(false);\n\n const visibleColumnsCopy = useMemo(() => cloneDeep(visibleColumns), [visibleColumns]);\n\n const visibleColumnsOnGridLayout = useMemo(\n () =>\n visibleColumnsCopy.reduce((acc, cur) => {\n if (cur.columns) {\n return acc.concat(cur.columns);\n }\n return acc.concat(cur);\n }, [] as DSDataTableT.InternalColumn[]),\n [visibleColumnsCopy],\n );\n\n const realColumnIndex = useMemo(\n () => visibleColumnsOnGridLayout.findIndex((col) => col.id === columnId),\n [columnId, visibleColumnsOnGridLayout],\n );\n\n // Notifies the user of the change in the column size\n const pushColumnSizeChange = useCallback(\n (nextWidth: number) => {\n // PUI-12695: Avoid unnecessary calls to onColumnResize\n // Avoid calling onColumnResize if the width of the column has not changed\n // unnecessary calls to onColumnResize can cause performance issues (next resizes were not working)\n if (nextWidth === visibleColumnsCopy[realColumnIndex].width) return;\n onColumnResize?.(columnId, nextWidth);\n // this next line is updating also the visibleColumnsCopy\n visibleColumnsOnGridLayout[realColumnIndex].width = nextWidth;\n onColumnSizeChange(visibleColumnsCopy, columnId, nextWidth);\n },\n [columnId, onColumnResize, onColumnSizeChange, realColumnIndex, visibleColumnsCopy, visibleColumnsOnGridLayout],\n );\n\n const onResizeStart = useCallback(() => {\n setIsResizing(true);\n }, []);\n\n const onResizeEnd = useCallback(() => {\n setIsResizing(false);\n pushColumnSizeChange(getGridLayout(virtualListRef.current)[realColumnIndex]);\n removeGridLayout(virtualListRef.current);\n }, [pushColumnSizeChange, virtualListRef, realColumnIndex]);\n\n // Mouse resize\n const onResizeHandler = useCallback(\n (e: MouseEvent | TouchEvent) => {\n if (realColumnIndex == -1) return;\n\n const delta =\n ('clientX' in e ? e.clientX : e.touches[0].clientX) - (innerRef.current?.getBoundingClientRect().x ?? 0); // delta in pixels\n\n const originalWidth = getGridLayout(virtualListRef.current)[realColumnIndex];\n\n const widthWithDelta = narrow(\n originalWidth + delta,\n visibleColumnsOnGridLayout[realColumnIndex].minWidth,\n visibleColumnsOnGridLayout[realColumnIndex].maxWidth,\n );\n\n changeGridLayout(virtualListRef.current, realColumnIndex, widthWithDelta);\n setSubColumnsGridLayout(virtualListRef.current, visibleColumnsCopy);\n\n // We will notify the user of the change in the column size only when the user releases the mouse button\n\n // To prevent text selection\n e.preventDefault();\n e.stopPropagation();\n },\n [realColumnIndex, innerRef, virtualListRef, visibleColumnsCopy, visibleColumnsOnGridLayout],\n );\n\n // Keyboard resize\n const handleKeyboardResize = useCallback(\n (e: React.KeyboardEvent) => {\n if (realColumnIndex == -1) return;\n\n if (e.key === 'Enter') {\n e.stopPropagation();\n }\n\n if (e.code === 'ArrowLeft' || e.code === 'ArrowRight') {\n e.preventDefault();\n }\n\n const delta = getCorrectDelta(e);\n\n if (delta === 0) return;\n\n const originalWidth = getGridLayout(virtualListRef.current)[realColumnIndex];\n\n const widthWithDelta = narrow(\n originalWidth + delta,\n visibleColumnsOnGridLayout[realColumnIndex].minWidth,\n visibleColumnsOnGridLayout[realColumnIndex].maxWidth,\n );\n\n changeGridLayout(virtualListRef.current, realColumnIndex, widthWithDelta);\n setSubColumnsGridLayout(virtualListRef.current, visibleColumnsCopy);\n\n pushColumnSizeChange(getGridLayout(virtualListRef.current)[realColumnIndex] + delta);\n removeGridLayout(virtualListRef.current);\n },\n [pushColumnSizeChange, realColumnIndex, virtualListRef, visibleColumnsCopy, visible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;AAGA,QAAM,uBAAuB;AAAA,IAC3B,CAAC,MAA2B;AAC1B,UAAI,mBAAmB,GAAI;AAE3B,UAAI,EAAE,QAAQ,SAAS;AACrB,UAAE,gBAAgB;AAAA,MACpB;AAEA,UAAI,EAAE,SAAS,eAAe,EAAE,SAAS,cAAc;AACrD,UAAE,eAAe;AAAA,MACnB;AAEA,YAAM,QAAQ,gBAAgB,CAAC;AAE/B,UAAI,UAAU,EAAG;AAEjB,YAAM,gBAAgB,cAAc,eAAe,OAAO,EAAE,eAAe;AAE3E,YAAM,iBAAiB;AAAA,QACrB,gBAAgB;AAAA,QAChB,2BAA2B,eAAe,EAAE;AAAA,QAC5C,2BAA2B,eAAe,EAAE;AAAA,MAC9C;AAEA,uBAAiB,eAAe,SAAS,iBAAiB,cAAc;AACxE,8BAAwB,eAAe,SAAS,kBAAkB;AAElE,2BAAqB,cAAc,eAAe,OAAO,EAAE,eAAe,IAAI,KAAK;AACnF,uBAAiB,eAAe,OAAO;AAAA,IACzC;AAAA,IACA,CAAC,sBAAsB,iBAAiB,gBAAgB,oBAAoB,0BAA0B;AAAA,EACxG;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { cloneDeep } from 'lodash';\nimport { useCallback, useMemo, useState } from 'react';\nimport { usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\nimport {\n changeGridLayout,\n getGridLayout,\n removeGridLayout,\n setSubColumnsGridLayout,\n} from '../../helpers/gridLayoutHelpers.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\n\n// if number > max => max\n// if number < min => min\n// else => number\nconst narrow = (value: number, min: number | undefined, max: number | undefined): number =>\n Math.min(Math.max(value, min ?? 30), max ?? Infinity);\n\n// Returns the delta of the keyboard event\nconst getCorrectDelta = (e: React.KeyboardEvent) => {\n let multiplier = 1;\n\n if (e.shiftKey) multiplier *= 5;\n if (e.altKey) multiplier *= 10;\n\n if (e.code === 'ArrowLeft') {\n return -multiplier;\n }\n if (e.code === 'ArrowRight') {\n return multiplier;\n }\n return 0;\n};\n\nexport const useHeaderResizer = ({\n columnId,\n innerRef,\n}: {\n columnId: string;\n innerRef: React.MutableRefObject<HTMLInputElement | null>;\n}) => {\n const visibleColumns = usePropsStore((state) => state.visibleColumns);\n const onColumnResize = usePropsStore((state) => state.onColumnResize);\n const onColumnSizeChange = usePropsStore((state) => state.onColumnSizeChange);\n const virtualListRef = usePropsStore((state) => state.virtualListRef);\n\n const [isResizing, setIsResizing] = useState(false);\n\n const visibleColumnsCopy = useMemo(() => cloneDeep(visibleColumns), [visibleColumns]);\n\n const visibleColumnsOnGridLayout = useMemo(\n () =>\n visibleColumnsCopy.reduce((acc, cur) => {\n if (cur.columns) {\n return acc.concat(cur.columns);\n }\n return acc.concat(cur);\n }, [] as DSDataTableT.InternalColumn[]),\n [visibleColumnsCopy],\n );\n\n const realColumnIndex = useMemo(\n () => visibleColumnsOnGridLayout.findIndex((col) => col.id === columnId),\n [columnId, visibleColumnsOnGridLayout],\n );\n\n // Notifies the user of the change in the column size\n const pushColumnSizeChange = useCallback(\n (nextWidth: number) => {\n // PUI-12695: Avoid unnecessary calls to onColumnResize\n // Avoid calling onColumnResize if the width of the column has not changed\n // unnecessary calls to onColumnResize can cause performance issues (next resizes were not working)\n if (nextWidth === visibleColumnsCopy[realColumnIndex].width) return;\n onColumnResize?.(columnId, nextWidth);\n // this next line is updating also the visibleColumnsCopy\n visibleColumnsOnGridLayout[realColumnIndex].width = nextWidth;\n onColumnSizeChange(visibleColumnsCopy, columnId, nextWidth);\n },\n [columnId, onColumnResize, onColumnSizeChange, realColumnIndex, visibleColumnsCopy, visibleColumnsOnGridLayout],\n );\n\n const onResizeStart = useCallback(() => {\n setIsResizing(true);\n }, []);\n\n const onResizeEnd = useCallback(() => {\n setIsResizing(false);\n pushColumnSizeChange(getGridLayout(virtualListRef.current)[realColumnIndex]);\n removeGridLayout(virtualListRef.current);\n }, [pushColumnSizeChange, virtualListRef, realColumnIndex]);\n\n // Mouse resize\n const onResizeHandler = useCallback(\n (e: MouseEvent | TouchEvent) => {\n if (realColumnIndex === -1) return;\n\n const delta =\n ('clientX' in e ? e.clientX : e.touches[0].clientX) - (innerRef.current?.getBoundingClientRect().x ?? 0); // delta in pixels\n\n const originalWidth = getGridLayout(virtualListRef.current)[realColumnIndex];\n\n const widthWithDelta = narrow(\n originalWidth + delta,\n visibleColumnsOnGridLayout[realColumnIndex].minWidth,\n visibleColumnsOnGridLayout[realColumnIndex].maxWidth,\n );\n\n changeGridLayout(virtualListRef.current, realColumnIndex, widthWithDelta);\n setSubColumnsGridLayout(virtualListRef.current, visibleColumnsCopy);\n\n // We will notify the user of the change in the column size only when the user releases the mouse button\n\n // To prevent text selection\n e.preventDefault();\n e.stopPropagation();\n },\n [realColumnIndex, innerRef, virtualListRef, visibleColumnsCopy, visibleColumnsOnGridLayout],\n );\n\n // Keyboard resize\n const handleKeyboardResize = useCallback(\n (e: React.KeyboardEvent) => {\n if (realColumnIndex === -1) return;\n\n if (e.key === 'Enter') {\n e.stopPropagation();\n }\n\n if (e.code === 'ArrowLeft' || e.code === 'ArrowRight') {\n e.preventDefault();\n }\n\n const delta = getCorrectDelta(e);\n\n if (delta === 0) return;\n\n const originalWidth = getGridLayout(virtualListRef.current)[realColumnIndex];\n\n const widthWithDelta = narrow(\n originalWidth + delta,\n visibleColumnsOnGridLayout[realColumnIndex].minWidth,\n visibleColumnsOnGridLayout[realColumnIndex].maxWidth,\n );\n\n changeGridLayout(virtualListRef.current, realColumnIndex, widthWithDelta);\n setSubColumnsGridLayout(virtualListRef.current, visibleColumnsCopy);\n\n pushColumnSizeChange(getGridLayout(virtualListRef.current)[realColumnIndex] + delta);\n removeGridLayout(virtualListRef.current);\n },\n [pushColumnSizeChange, realColumnIndex, virtualListRef, visibleColumnsCopy, visibleColumnsOnGridLayout],\n );\n\n return {\n isResizing,\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B,CAAC,MAA2B;AAC1B,UAAI,oBAAoB,GAAI;AAE5B,UAAI,EAAE,QAAQ,SAAS;AACrB,UAAE,gBAAgB;AAAA,MACpB;AAEA,UAAI,EAAE,SAAS,eAAe,EAAE,SAAS,cAAc;AACrD,UAAE,eAAe;AAAA,MACnB;AAEA,YAAM,QAAQ,gBAAgB,CAAC;AAE/B,UAAI,UAAU,EAAG;AAEjB,YAAM,gBAAgB,cAAc,eAAe,OAAO,EAAE,eAAe;AAE3E,YAAM,iBAAiB;AAAA,QACrB,gBAAgB;AAAA,QAChB,2BAA2B,eAAe,EAAE;AAAA,QAC5C,2BAA2B,eAAe,EAAE;AAAA,MAC9C;AAEA,uBAAiB,eAAe,SAAS,iBAAiB,cAAc;AACxE,8BAAwB,eAAe,SAAS,kBAAkB;AAElE,2BAAqB,cAAc,eAAe,OAAO,EAAE,eAAe,IAAI,KAAK;AACnF,uBAAiB,eAAe,OAAO;AAAA,IACzC;AAAA,IACA,CAAC,sBAAsB,iBAAiB,gBAAgB,oBAAoB,0BAA0B;AAAA,EACxG;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ import { createContext } from "react";
3
+ const DnDGroupContext = createContext({
4
+ activeIndex: null
5
+ });
6
+ export {
7
+ DnDGroupContext
8
+ };
9
+ //# sourceMappingURL=DnDGroupContext.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/DnDGroupContext.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createContext } from 'react';\nimport type { DnDGroupContextType } from './withConditionalDnDColumnContext.js';\n\nexport const DnDGroupContext = createContext<DnDGroupContextType>({\n activeIndex: null,\n});\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,qBAAqB;AAGvB,MAAM,kBAAkB,cAAmC;AAAA,EAChE,aAAa;AACf,CAAC;",
6
+ "names": []
7
+ }
@@ -1,19 +1,17 @@
1
1
  import * as React from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { createContext, useCallback, useMemo } from "react";
4
3
  import {
5
- restrictToFirstScrollableAncestor,
6
4
  DndContext,
7
5
  DragOverlay,
8
6
  arrayMove,
7
+ restrictToFirstScrollableAncestor,
9
8
  useHierarchyDndkitConfig
10
9
  } from "@elliemae/ds-drag-and-drop";
11
- import { HeaderCellGroup } from "../internal.js";
10
+ import { useCallback, useMemo } from "react";
12
11
  import { INTERNAL_COLUMNS } from "../../addons/Columns/index.js";
13
- import { usePropsStore } from "../../configs/useStore/useStore.js";
14
- const DnDGroupContext = createContext({
15
- activeIndex: null
16
- });
12
+ import { usePropsStore } from "../../configs/useStore/createInternalAndPropsContext.js";
13
+ import { HeaderCellGroup } from "../Headers/HeaderCellGroup.js";
14
+ import { DnDGroupContext } from "./DnDGroupContext.js";
17
15
  const flattenColumns = (cols) => {
18
16
  const augmentedColumns = [];
19
17
  const flatten = (col, index, parentId = null) => {
@@ -64,15 +62,15 @@ const withConditionalDnDColumnContext = (Component) => function(props) {
64
62
  () => activeId ? flattenedItems.find((item) => item.uid === activeId)?.original : null,
65
63
  [activeId, flattenedItems]
66
64
  );
65
+ const DnDGroupContextVal = useMemo(() => ({ activeIndex }), [activeIndex]);
67
66
  if (dragAndDropColumns)
68
67
  return /* @__PURE__ */ jsxs(DndContext, { ...dndContextProps, children: [
69
- /* @__PURE__ */ jsx(DnDGroupContext.Provider, { value: { activeIndex }, children: /* @__PURE__ */ jsx(Component, { ...props }) }),
68
+ /* @__PURE__ */ jsx(DnDGroupContext.Provider, { value: DnDGroupContextVal, children: /* @__PURE__ */ jsx(Component, { ...props }) }),
70
69
  /* @__PURE__ */ jsx(DragOverlay, { modifiers: [restrictToFirstScrollableAncestor], children: activeId ? /* @__PURE__ */ jsx(HeaderCellGroup, { header: dragOverlayCol, isDragOverlay: true }) : null })
71
70
  ] });
72
71
  return /* @__PURE__ */ jsx(Component, { ...props });
73
72
  };
74
73
  export {
75
- DnDGroupContext,
76
74
  withConditionalDnDColumnContext
77
75
  };
78
76
  //# sourceMappingURL=withConditionalDnDColumnContext.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/withConditionalDnDColumnContext.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-underscore-dangle */\n/* eslint-disable max-params */\nimport React, { createContext, useCallback, useMemo } from 'react';\nimport {\n restrictToFirstScrollableAncestor,\n DndContext,\n DragOverlay,\n arrayMove,\n useHierarchyDndkitConfig,\n type DnDKitHierarchy,\n} from '@elliemae/ds-drag-and-drop';\nimport type { FunctionalHOC } from '../../types/FunctionalHoC.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { HeaderCellGroup } from '../internal.js';\nimport { INTERNAL_COLUMNS } from '../../addons/Columns/index.js';\nimport { usePropsStore } from '../../configs/useStore/useStore.js';\n\ntype DnDGroupContextType = {\n activeIndex: number | null;\n};\n\nexport const DnDGroupContext = createContext<DnDGroupContextType>({\n activeIndex: null,\n});\n\nconst flattenColumns = (cols: DSDataTableT.InternalColumn[]): DnDKitHierarchy.Item<DSDataTableT.InternalColumn>[] => {\n const augmentedColumns = [] as DnDKitHierarchy.Item<DSDataTableT.InternalColumn>[];\n const flatten = (col: DSDataTableT.InternalColumn, index: number, parentId: string | null = null) => {\n const { id } = col;\n augmentedColumns.push({ uid: id, parentId, realIndex: index, original: col });\n if (col.columns)\n col.columns.forEach((subColumn: DSDataTableT.InternalColumn, childIndex: number) =>\n flatten(subColumn, childIndex, id),\n );\n };\n cols.forEach((col, index) => flatten(col, index));\n return augmentedColumns;\n};\n\n// only wraps in \"DnDContext\" and \"DnDGroupContext\" if any Drag and Drop functionality is requested\nexport const withConditionalDnDColumnContext: FunctionalHOC = (Component) =>\n function (props) {\n const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);\n const onColumnsReorder = usePropsStore((state) => state.onColumnsReorder);\n const visibleColumns = usePropsStore((state) => state.visibleColumns);\n\n const flattenedItems = useMemo(() => flattenColumns(visibleColumns), [visibleColumns]);\n\n const onReorder: DnDKitHierarchy.OnReorder<DSDataTableT.InternalColumn> = useCallback(\n (movedItem, indexes) => {\n // Send from index to target index\n const newFlattenedData = arrayMove(flattenedItems, indexes.fromIndex, indexes.targetIndex);\n // Pull the cols's data into an object\n const nodes: Record<string, DSDataTableT.InternalColumn> = {};\n newFlattenedData.forEach(({ original: colData, ...dndData }) => {\n delete colData.columns;\n nodes[dndData.uid] = colData;\n });\n const newData = [] as DSDataTableT.Column[];\n newFlattenedData.forEach(({ original: colData, ...dndData }) => {\n // Don't send internal columns to the user\n if (INTERNAL_COLUMNS.includes(dndData.uid as string)) {\n return;\n }\n // If row has parent, insert it to it's subrows\n // otherwise append it to the new user data\n if (dndData.parentId) {\n const parentNode = nodes[dndData.parentId];\n if (parentNode.columns) parentNode.columns.push(colData);\n else parentNode.columns = [colData];\n } else newData.push(colData);\n });\n onColumnsReorder(newData, indexes);\n },\n [flattenedItems, onColumnsReorder],\n );\n\n const { dndContextProps, activeId, activeIndex } = useHierarchyDndkitConfig({\n flattenedItems,\n isHorizontalDnD: true,\n onReorder,\n });\n\n const dragOverlayCol = useMemo(\n () => (activeId ? flattenedItems.find((item) => item.uid === activeId)?.original : null),\n [activeId, flattenedItems],\n );\n\n if (dragAndDropColumns)\n return (\n <DndContext {...dndContextProps}>\n <DnDGroupContext.Provider value={{ activeIndex }}>\n <Component {...props} />\n </DnDGroupContext.Provider>\n <DragOverlay modifiers={[restrictToFirstScrollableAncestor]}>\n {activeId ? <HeaderCellGroup header={dragOverlayCol as DSDataTableT.InternalColumn} isDragOverlay /> : null}\n </DragOverlay>\n </DndContext>\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AAG,IAAI;AAAA,MACvB,CAAC;AACD,YAAM,UAAU,CAAC;AACjB,uBAAiB,QAAQ,CAAC,EAAE,UAAU,SAAS,GAAG,QAAQ,MAAM;AAE9D,YAAI,iBAAiB,SAAS,QAAQ,GAAa,GAAG;AACpD;AAAA,QACF;AAGA,YAAI,QAAQ,UAAU;AACpB,gBAAM,aAAa,MAAM,QAAQ,QAAQ;AACzC,cAAI,WAAW,QAAS,YAAW,QAAQ,KAAK,OAAO;AAAA,cAClD,YAAW,UAAU,CAAC,OAAO;AAAA,QACpC,MAAO,SAAQ,KAAK,OAAO;AAAA,MAC7B,CAAC;AACD,uBAAiB,SAAS,OAAO;AAAA,IACnC;AAAA,IACA,CAAC,gBAAgB,gBAAgB;AAAA,EACnC;AAEA,QAAM,EAAE,iBAAiB,UAAU,YAAY,IAAI,yBAAyB;AAAA,IAC1E;AAAA,IACA,iBAAiB;AAAA,IACjB;AAAA,EACF,CAAC;AAED,QAAM,iBAAiB;AAAA,IACrB,MAAO,WAAW,eAAe,KAAK,CAAC,SAAS,KAAK,QAAQ,QAAQ,GAAG,WAAW;AAAA,IACnF,CAAC,UAAU,cAAc;AAAA,EAC3B;AAEA,MAAI;AACF,WACE,qBAAC,cAAY,GAAG,iBACd;AAAA,0BAAC,gBAAgB,UAAhB,EAAyB,OAAO,EAAE,YAAY,GAC7C,8BAAC,aAAW,GAAG,OAAO,GACxB;AAAA,MACA,oBAAC,eAAY,WAAW,CAAC,iCAAiC,GACvD,qBAAW,oBAAC,mBAAgB,QAAQ,gBAA+C,eAAa,MAAC,IAAK,MACzG;AAAA,OACF;AAEJ,SAAO,oBAAC,aAAW,GAAG,OAAO;AAC/B;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-underscore-dangle */\n/* eslint-disable max-params */\nimport {\n DndContext,\n DragOverlay,\n arrayMove,\n restrictToFirstScrollableAncestor,\n useHierarchyDndkitConfig,\n type DnDKitHierarchy,\n} from '@elliemae/ds-drag-and-drop';\nimport { useCallback, useMemo } from 'react';\nimport { INTERNAL_COLUMNS } from '../../addons/Columns/index.js';\nimport { usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport type { FunctionalHOC } from '../../types/FunctionalHoC.js';\nimport { HeaderCellGroup } from '../Headers/HeaderCellGroup.js';\nimport { DnDGroupContext } from './DnDGroupContext.js';\n\nexport type DnDGroupContextType = {\n activeIndex: number | null;\n};\n\nconst flattenColumns = (cols: DSDataTableT.InternalColumn[]): DnDKitHierarchy.Item<DSDataTableT.InternalColumn>[] => {\n const augmentedColumns = [] as DnDKitHierarchy.Item<DSDataTableT.InternalColumn>[];\n const flatten = (col: DSDataTableT.InternalColumn, index: number, parentId: string | null = null) => {\n const { id } = col;\n augmentedColumns.push({ uid: id, parentId, realIndex: index, original: col });\n if (col.columns)\n col.columns.forEach((subColumn: DSDataTableT.InternalColumn, childIndex: number) =>\n flatten(subColumn, childIndex, id),\n );\n };\n cols.forEach((col, index) => flatten(col, index));\n return augmentedColumns;\n};\n\n// only wraps in \"DnDContext\" and \"DnDGroupContext\" if any Drag and Drop functionality is requested\nexport const withConditionalDnDColumnContext: FunctionalHOC = (Component) =>\n function (props) {\n const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);\n const onColumnsReorder = usePropsStore((state) => state.onColumnsReorder);\n const visibleColumns = usePropsStore((state) => state.visibleColumns);\n\n const flattenedItems = useMemo(() => flattenColumns(visibleColumns), [visibleColumns]);\n\n const onReorder: DnDKitHierarchy.OnReorder<DSDataTableT.InternalColumn> = useCallback(\n (movedItem, indexes) => {\n // Send from index to target index\n const newFlattenedData = arrayMove(flattenedItems, indexes.fromIndex, indexes.targetIndex);\n // Pull the cols's data into an object\n const nodes: Record<string, DSDataTableT.InternalColumn> = {};\n newFlattenedData.forEach(({ original: colData, ...dndData }) => {\n delete colData.columns;\n nodes[dndData.uid] = colData;\n });\n const newData = [] as DSDataTableT.Column[];\n newFlattenedData.forEach(({ original: colData, ...dndData }) => {\n // Don't send internal columns to the user\n if (INTERNAL_COLUMNS.includes(dndData.uid as string)) {\n return;\n }\n // If row has parent, insert it to it's subrows\n // otherwise append it to the new user data\n if (dndData.parentId) {\n const parentNode = nodes[dndData.parentId];\n if (parentNode.columns) parentNode.columns.push(colData);\n else parentNode.columns = [colData];\n } else newData.push(colData);\n });\n onColumnsReorder(newData, indexes);\n },\n [flattenedItems, onColumnsReorder],\n );\n\n const { dndContextProps, activeId, activeIndex } = useHierarchyDndkitConfig({\n flattenedItems,\n isHorizontalDnD: true,\n onReorder,\n });\n\n const dragOverlayCol = useMemo(\n () => (activeId ? flattenedItems.find((item) => item.uid === activeId)?.original : null),\n [activeId, flattenedItems],\n );\n const DnDGroupContextVal = useMemo(() => ({ activeIndex }), [activeIndex]);\n\n if (dragAndDropColumns)\n return (\n <DndContext {...dndContextProps}>\n <DnDGroupContext.Provider value={DnDGroupContextVal}>\n <Component {...props} />\n </DnDGroupContext.Provider>\n <DragOverlay modifiers={[restrictToFirstScrollableAncestor]}>\n {activeId ? <HeaderCellGroup header={dragOverlayCol as DSDataTableT.InternalColumn} isDragOverlay /> : null}\n </DragOverlay>\n </DndContext>\n );\n return <Component {...props} />;\n };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACwFf,SAEI,KAFJ;AAtFR;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,aAAa,eAAe;AACrC,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAG9B,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAMhC,MAAM,iBAAiB,CAAC,SAA6F;AACnH,QAAM,mBAAmB,CAAC;AAC1B,QAAM,UAAU,CAAC,KAAkC,OAAe,WAA0B,SAAS;AACnG,UAAM,EAAE,GAAG,IAAI;AACf,qBAAiB,KAAK,EAAE,KAAK,IAAI,UAAU,WAAW,OAAO,UAAU,IAAI,CAAC;AA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AyB;AAAA,IAC1E;AAAA,IACA,iBAAiB;AAAA,IACjB;AAAA,EACF,CAAC;AAED,QAAM,iBAAiB;AAAA,IACrB,MAAO,WAAW,eAAe,KAAK,CAAC,SAAS,KAAK,QAAQ,QAAQ,GAAG,WAAW;AAAA,IACnF,CAAC,UAAU,cAAc;AAAA,EAC3B;AACA,QAAM,qBAAqB,QAAQ,OAAO,EAAE,YAAY,IAAI,CAAC,WAAW,CAAC;AAEzE,MAAI;AACF,WACE,qBAAC,cAAY,GAAG,iBACd;AAAA,0BAAC,gBAAgB,UAAhB,EAAyB,OAAO,oBAC/B,8BAAC,aAAW,GAAG,OAAO,GACxB;AAAA,MACA,oBAAC,eAAY,WAAW,CAAC,iCAAiC,GACvD,qBAAW,oBAAC,mBAAgB,QAAQ,gBAA+C,eAAa,MAAC,IAAK,MACzG;AAAA,OACF;AAEJ,SAAO,oBAAC,aAAW,GAAG,OAAO;AAC/B;",
6
6
  "names": []
7
7
  }
@@ -1,17 +1,17 @@
1
1
  import * as React from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useCallback, useMemo } from "react";
4
3
  import {
5
4
  DndContext,
6
5
  DragOverlay,
7
6
  SortableContext,
8
- useTreeDndkitConfig,
9
- restrictToFirstScrollableAncestor
7
+ restrictToFirstScrollableAncestor,
8
+ useTreeDndkitConfig
10
9
  } from "@elliemae/ds-drag-and-drop";
10
+ import { useCallback, useMemo } from "react";
11
11
  import { createPortal } from "react-dom";
12
+ import { useInternalStore, usePropsStore } from "../../configs/useStore/createInternalAndPropsContext.js";
12
13
  import { Row } from "../Row.js";
13
14
  import { DnDTreeContext } from "./DnDTreeContext.js";
14
- import { usePropsStore, useInternalStore } from "../../configs/useStore/useStore.js";
15
15
  const withConditionalDnDRowContext = (Component) => (props) => {
16
16
  const dragAndDropRows = usePropsStore((state) => state.dragAndDropRows);
17
17
  const isExpandable = usePropsStore((state) => state.isExpandable);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/withConditionalDnDRowContext.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/function-component-definition */\nimport React, { useCallback, useMemo } from 'react';\nimport {\n DndContext,\n DragOverlay,\n SortableContext,\n useTreeDndkitConfig,\n restrictToFirstScrollableAncestor,\n type DnDKitTree,\n} from '@elliemae/ds-drag-and-drop';\nimport { createPortal } from 'react-dom';\nimport type { FunctionalHOC } from '../../types/FunctionalHoC.js';\nimport { Row } from '../Row.js';\nimport { DnDTreeContext } from './DnDTreeContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { usePropsStore, useInternalStore } from '../../configs/useStore/useStore.js';\n\n// only wraps in \"DnDContext\" and \"DnDTreeContext\" if any Drag and Drop functionality is requested\nexport const withConditionalDnDRowContext: FunctionalHOC = (Component) => (props) => {\n const dragAndDropRows = usePropsStore((state) => state.dragAndDropRows);\n const isExpandable = usePropsStore((state) => state.isExpandable);\n const onRowsReorder = usePropsStore((state) => state.onRowsReorder);\n const maxDragAndDropLevel = usePropsStore((state) => state.maxDragAndDropLevel);\n const getIsDropValid = usePropsStore((state) => state.getIsDropValid);\n const flattenedData = usePropsStore((state) => state.flattenedData);\n const allDataFlattened = usePropsStore((state) => state.allDataFlattened);\n const setDrilldownRowId = useInternalStore((state) => state.setDrilldownRowId);\n\n const onReorder: DnDKitTree.OnReorder<DSDataTableT.Row> = useCallback(\n (_active, targetIndex, { movedData, fromIndex, considerExpanding }) => {\n const rootMovedData = movedData.root;\n // Pull the row's original data into an object\n const nodes: Record<string, DSDataTableT.Row> = {};\n rootMovedData.forEach((row) => {\n if (row.original.subRows) delete row.original.subRows;\n delete row.original.subRows;\n nodes[row.uid] = row.original;\n });\n const newUserData = [] as DSDataTableT.Row[];\n rootMovedData.forEach((row) => {\n // If row has parent, insert it to it's subrows\n // otherwise append it to the new user data\n if (row.parentId) {\n const parentNode = nodes[row.parentId];\n if (parentNode?.subRows) parentNode.subRows.push(row.original);\n else parentNode.subRows = [row.original];\n } else newUserData.push(row.original);\n });\n // Tell the user that the order has change, he can chose to commit it or not\n onRowsReorder(newUserData, { targetIndex, fromIndex }, considerExpanding as string | null, {\n flattenedData,\n allDataFlattened,\n });\n setDrilldownRowId(_active.uid.toString()); // we restore the drilldown row id which was set null during the blur event on dragging\n },\n [allDataFlattened, flattenedData, onRowsReorder, setDrilldownRowId],\n );\n\n const theFlattenedItems = useMemo(\n () => allDataFlattened.map((datum) => ({ ...datum, collapsed: !datum.isExpanded, subitems: [] })),\n [allDataFlattened],\n );\n\n const { dndContextProps, sortableContextProps, active, dropIndicatorPosition, isDropValid } = useTreeDndkitConfig({\n flattenedItems: theFlattenedItems,\n isHorizontalDnD: false,\n isExpandable,\n onReorder,\n maxDragAndDropLevel,\n getIsDropValid: getIsDropValid,\n });\n\n const containerSortableContextProps = sortableContextProps.root;\n\n const visibleItems = useMemo(() => {\n // active in this case is the row that is being dragged\n // if no drag is happening, return the flattened data as is\n if (!active) return flattenedData;\n // if a drag is happening, exclude the children of the dragged row\n // this is a design choice, this way the user can't drag a parent row into one of it's children.\n const excludeParentIds = [active.id];\n return flattenedData.filter((datum) => {\n const isParentExcluded = datum.parentId !== null && excludeParentIds.includes(datum.parentId);\n if (isParentExcluded) {\n excludeParentIds.push(datum.uid);\n return false;\n }\n return true;\n });\n }, [active, flattenedData]);\n\n const ctx = useMemo(\n () => ({\n visibleItems,\n dropIndicatorPosition,\n isDropValid,\n }),\n [visibleItems, dropIndicatorPosition, isDropValid],\n );\n\n const dragOverlayRow = useMemo(\n () => (active ? flattenedData.find((row) => row.uid === active.id) : null),\n [active, flattenedData],\n );\n\n if (dragAndDropRows)\n return (\n <DndContext {...dndContextProps}>\n <SortableContext {...containerSortableContextProps}>\n <DnDTreeContext.Provider value={ctx}>\n <Component {...props} />\n </DnDTreeContext.Provider>\n </SortableContext>\n {createPortal(\n <DragOverlay style={{ width: 'auto' }} modifiers={[restrictToFirstScrollableAncestor]}>\n {active ? <Row row={dragOverlayRow as DSDataTableT.InternalRow} isDragOverlay /> : null}\n </DragOverlay>,\n document.body,\n )}\n </DndContext>\n );\n return <Component {...props} />;\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;AC2GjB,SAGM,KAHN;AA1GN,SAAgB,aAAa,eAAe;AAC5C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,oBAAoB;AAE7B,SAAS,WAAW;AACpB,SAAS,sBAAsB;AAE/B,SAAS,eAAe,wBAAwB;AAGzC,MAAM,+BAA8C,CAAC,cAAc,CAAC,UAAU;AACnF,QAAM,kBAAkB,cAAc,CAAC,UAAU,MAAM,eAAe;AACtE,QAAM,eAAe,cAAc,CAAC,UAAU,MAAM,YAAY;AAChE,QAAM,gBAAgB,cAAc,CAAC,UAAU,MAAM,aAAa;AAClE,QAAM,sBAAsB,cAAc,CAAC,UAAU,MAAM,mBAAmB;AAC9E,QAAM,iBAAiB,cAAc,CAAC,UAAU,MAAM,cAAc;AACpE,QAAM,gBAAgB,cAAc,CAAC,UAAU,MAAM,aAAa;AAClE,QAAM,mBAAmB,cAAc,CAAC,UAAU,MAAM,gBAAgB;AACxE,QAAM,oBAAoB,iBAAiB,CAAC,UAAU,MAAM,iBAAiB;AAE7E,QAAM,YAAoD;AAAA,IACxD,CAAC,SAAS,aAAa,EAAE,WAAW,WAAW,kBAAkB,MAAM;AACrE,YAAM,gBAAgB,UAAU;AAEhC,YAAM,QAA0C,CAAC;AACjD,oBAAc,QAAQ,CAAC,QAAQ;AAC7B,YAAI,IAAI,SAAS,QAAS,QAAO,IAAI,SAAS;AAC9C,eAAO,IAAI,SAAS;AACpB,cAAM,IAAI,GAAG,IAAI,IAAI;AAAA,MACvB,CAAC;AACD,YAAM,cAAc,CAAC;AACrB,oBAAc,QAAQ,CAAC,QAAQ;AAG7B,YAAI,IAAI,UAAU;A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uB,WAAW;AAAA,EACnD;AAEA,QAAM,iBAAiB;AAAA,IACrB,MAAO,SAAS,cAAc,KAAK,CAAC,QAAQ,IAAI,QAAQ,OAAO,EAAE,IAAI;AAAA,IACrE,CAAC,QAAQ,aAAa;AAAA,EACxB;AAEA,MAAI;AACF,WACE,qBAAC,cAAY,GAAG,iBACd;AAAA,0BAAC,mBAAiB,GAAG,+BACnB,8BAAC,eAAe,UAAf,EAAwB,OAAO,KAC9B,8BAAC,aAAW,GAAG,OAAO,GACxB,GACF;AAAA,MACC;AAAA,QACC,oBAAC,eAAY,OAAO,EAAE,OAAO,OAAO,GAAG,WAAW,CAAC,iCAAiC,GACjF,mBAAS,oBAAC,OAAI,KAAK,gBAA4C,eAAa,MAAC,IAAK,MACrF;AAAA,QACA,SAAS;AAAA,MACX;AAAA,OACF;AAEJ,SAAO,oBAAC,aAAW,GAAG,OAAO;AAC/B;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/function-component-definition */\nimport {\n DndContext,\n DragOverlay,\n SortableContext,\n restrictToFirstScrollableAncestor,\n useTreeDndkitConfig,\n type DnDKitTree,\n} from '@elliemae/ds-drag-and-drop';\nimport { useCallback, useMemo } from 'react';\nimport { createPortal } from 'react-dom';\nimport { useInternalStore, usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport type { FunctionalHOC } from '../../types/FunctionalHoC.js';\nimport { Row } from '../Row.js';\nimport { DnDTreeContext } from './DnDTreeContext.js';\n\n// only wraps in \"DnDContext\" and \"DnDTreeContext\" if any Drag and Drop functionality is requested\nexport const withConditionalDnDRowContext: FunctionalHOC = (Component) => (props) => {\n const dragAndDropRows = usePropsStore((state) => state.dragAndDropRows);\n const isExpandable = usePropsStore((state) => state.isExpandable);\n const onRowsReorder = usePropsStore((state) => state.onRowsReorder);\n const maxDragAndDropLevel = usePropsStore((state) => state.maxDragAndDropLevel);\n const getIsDropValid = usePropsStore((state) => state.getIsDropValid);\n const flattenedData = usePropsStore((state) => state.flattenedData);\n const allDataFlattened = usePropsStore((state) => state.allDataFlattened);\n const setDrilldownRowId = useInternalStore((state) => state.setDrilldownRowId);\n\n const onReorder: DnDKitTree.OnReorder<DSDataTableT.Row> = useCallback(\n (_active, targetIndex, { movedData, fromIndex, considerExpanding }) => {\n const rootMovedData = movedData.root;\n // Pull the row's original data into an object\n const nodes: Record<string, DSDataTableT.Row> = {};\n rootMovedData.forEach((row) => {\n if (row.original.subRows) delete row.original.subRows;\n delete row.original.subRows;\n nodes[row.uid] = row.original;\n });\n const newUserData = [] as DSDataTableT.Row[];\n rootMovedData.forEach((row) => {\n // If row has parent, insert it to it's subrows\n // otherwise append it to the new user data\n if (row.parentId) {\n const parentNode = nodes[row.parentId];\n if (parentNode?.subRows) parentNode.subRows.push(row.original);\n else parentNode.subRows = [row.original];\n } else newUserData.push(row.original);\n });\n // Tell the user that the order has change, he can chose to commit it or not\n onRowsReorder(newUserData, { targetIndex, fromIndex }, considerExpanding as string | null, {\n flattenedData,\n allDataFlattened,\n });\n setDrilldownRowId(_active.uid.toString()); // we restore the drilldown row id which was set null during the blur event on dragging\n },\n [allDataFlattened, flattenedData, onRowsReorder, setDrilldownRowId],\n );\n\n const theFlattenedItems = useMemo(\n () => allDataFlattened.map((datum) => ({ ...datum, collapsed: !datum.isExpanded, subitems: [] })),\n [allDataFlattened],\n );\n\n const { dndContextProps, sortableContextProps, active, dropIndicatorPosition, isDropValid } = useTreeDndkitConfig({\n flattenedItems: theFlattenedItems,\n isHorizontalDnD: false,\n isExpandable,\n onReorder,\n maxDragAndDropLevel,\n getIsDropValid,\n });\n\n const containerSortableContextProps = sortableContextProps.root;\n\n const visibleItems = useMemo(() => {\n // active in this case is the row that is being dragged\n // if no drag is happening, return the flattened data as is\n if (!active) return flattenedData;\n // if a drag is happening, exclude the children of the dragged row\n // this is a design choice, this way the user can't drag a parent row into one of it's children.\n const excludeParentIds = [active.id];\n return flattenedData.filter((datum) => {\n const isParentExcluded = datum.parentId !== null && excludeParentIds.includes(datum.parentId);\n if (isParentExcluded) {\n excludeParentIds.push(datum.uid);\n return false;\n }\n return true;\n });\n }, [active, flattenedData]);\n\n const ctx = useMemo(\n () => ({\n visibleItems,\n dropIndicatorPosition,\n isDropValid,\n }),\n [visibleItems, dropIndicatorPosition, isDropValid],\n );\n\n const dragOverlayRow = useMemo(\n () => (active ? flattenedData.find((row) => row.uid === active.id) : null),\n [active, flattenedData],\n );\n\n if (dragAndDropRows)\n return (\n <DndContext {...dndContextProps}>\n <SortableContext {...containerSortableContextProps}>\n <DnDTreeContext.Provider value={ctx}>\n <Component {...props} />\n </DnDTreeContext.Provider>\n </SortableContext>\n {createPortal(\n <DragOverlay style={{ width: 'auto' }} modifiers={[restrictToFirstScrollableAncestor]}>\n {active ? <Row row={dragOverlayRow as DSDataTableT.InternalRow} isDragOverlay /> : null}\n </DragOverlay>,\n document.body,\n )}\n </DndContext>\n );\n return <Component {...props} />;\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;AC2GjB,SAGM,KAHN;AA1GN;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,aAAa,eAAe;AACrC,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB,qBAAqB;AAGhD,SAAS,WAAW;AACpB,SAAS,sBAAsB;AAGxB,MAAM,+BAA8C,CAAC,cAAc,CAAC,UAAU;AACnF,QAAM,kBAAkB,cAAc,CAAC,UAAU,MAAM,eAAe;AACtE,QAAM,eAAe,cAAc,CAAC,UAAU,MAAM,YAAY;AAChE,QAAM,gBAAgB,cAAc,CAAC,UAAU,MAAM,aAAa;AAClE,QAAM,sBAAsB,cAAc,CAAC,UAAU,MAAM,mBAAmB;AAC9E,QAAM,iBAAiB,cAAc,CAAC,UAAU,MAAM,cAAc;AACpE,QAAM,gBAAgB,cAAc,CAAC,UAAU,MAAM,aAAa;AAClE,QAAM,mB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gC,qBAAqB;AAE3D,QAAM,eAAe,QAAQ,MAAM;AAGjC,QAAI,CAAC,OAAQ,QAAO;AAGpB,UAAM,mBAAmB,CAAC,OAAO,EAAE;AACnC,WAAO,cAAc,OAAO,CAAC,UAAU;AACrC,YAAM,mBAAmB,MAAM,aAAa,QAAQ,iBAAiB,SAAS,MAAM,QAAQ;AAC5F,UAAI,kBAAkB;AACpB,yBAAiB,KAAK,MAAM,GAAG;AAC/B,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT,CAAC;AAAA,EACH,GAAG,CAAC,QAAQ,aAAa,CAAC;AAE1B,QAAM,MAAM;AAAA,IACV,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,cAAc,uBAAuB,WAAW;AAAA,EACnD;AAEA,QAAM,iBAAiB;AAAA,IACrB,MAAO,SAAS,cAAc,KAAK,CAAC,QAAQ,IAAI,QAAQ,OAAO,EAAE,IAAI;AAAA,IACrE,CAAC,QAAQ,aAAa;AAAA,EACxB;AAEA,MAAI;AACF,WACE,qBAAC,cAAY,GAAG,iBACd;AAAA,0BAAC,mBAAiB,GAAG,+BACnB,8BAAC,eAAe,UAAf,EAAwB,OAAO,KAC9B,8BAAC,aAAW,GAAG,OAAO,GACxB,GACF;AAAA,MACC;AAAA,QACC,oBAAC,eAAY,OAAO,EAAE,OAAO,OAAO,GAAG,WAAW,CAAC,iCAAiC,GACjF,mBAAS,oBAAC,OAAI,KAAK,gBAA4C,eAAa,MAAC,IAAK,MACrF;AAAA,QACA,SAAS;AAAA,MACX;AAAA,OACF;AAEJ,SAAO,oBAAC,aAAW,GAAG,OAAO;AAC/B;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { horizontalListSortingStrategy, SortableContext } from "@elliemae/ds-drag-and-drop";
4
- import { usePropsStore } from "../../configs/useStore/useStore.js";
4
+ import { usePropsStore } from "../../configs/useStore/createInternalAndPropsContext.js";
5
5
  const withConditionalDnDSortableContext = (Component) => (props) => {
6
6
  const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);
7
7
  const { isDragOverlay, items } = props;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/withConditionalDnDSortableContext.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/function-component-definition */\nimport { horizontalListSortingStrategy, SortableContext } from '@elliemae/ds-drag-and-drop';\nimport React from 'react';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { usePropsStore } from '../../configs/useStore/useStore.js';\n\ninterface Props {\n items: DSDataTableT.InternalColumn[];\n isDragOverlay: boolean;\n}\n\nexport const withConditionalDnDSortableContext =\n <T,>(Component: React.ComponentType<T>) =>\n (props: T & JSX.IntrinsicAttributes & Props) => {\n const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);\n\n const { isDragOverlay, items } = props;\n\n // Only add the context if it's not a dragOverlay and dnd for cols was requested\n // It's important that drag overlays DO NOT have any sortable functionality!\n if (!isDragOverlay && dragAndDropColumns)\n return (\n <SortableContext items={items.map((item) => item.id)} strategy={horizontalListSortingStrategy}>\n <Component {...props} />\n </SortableContext>\n );\n\n return <Component {...props} />;\n };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACuBb;AAtBV,SAAS,+BAA+B,uBAAuB;AAG/D,SAAS,qBAAqB;AAOvB,MAAM,oCACX,CAAK,cACL,CAAC,UAA+C;AAC9C,QAAM,qBAAqB,cAAc,CAAC,UAAU,MAAM,kBAAkB;AAE5E,QAAM,EAAE,eAAe,MAAM,IAAI;AAIjC,MAAI,CAAC,iBAAiB;AACpB,WACE,oBAAC,mBAAgB,OAAO,MAAM,IAAI,CAAC,SAAS,KAAK,EAAE,GAAG,UAAU,+BAC9D,8BAAC,aAAW,GAAG,OAAO,GACxB;AAGJ,SAAO,oBAAC,aAAW,GAAG,OAAO;AAC/B;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/function-component-definition */\nimport { horizontalListSortingStrategy, SortableContext } from '@elliemae/ds-drag-and-drop';\nimport React from 'react';\nimport { usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\n\ninterface Props {\n items: DSDataTableT.InternalColumn[];\n isDragOverlay: boolean;\n}\n\nexport const withConditionalDnDSortableContext =\n <T,>(Component: React.ComponentType<T>) =>\n (props: T & React.JSX.IntrinsicAttributes & Props) => {\n const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);\n\n const { isDragOverlay, items } = props;\n\n // Only add the context if it's not a dragOverlay and dnd for cols was requested\n // It's important that drag overlays DO NOT have any sortable functionality!\n if (!isDragOverlay && dragAndDropColumns)\n return (\n <SortableContext items={items.map((item) => item.id)} strategy={horizontalListSortingStrategy}>\n <Component {...props} />\n </SortableContext>\n );\n\n return <Component {...props} />;\n };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACuBb;AAtBV,SAAS,+BAA+B,uBAAuB;AAE/D,SAAS,qBAAqB;AAQvB,MAAM,oCACX,CAAK,cACL,CAAC,UAAqD;AACpD,QAAM,qBAAqB,cAAc,CAAC,UAAU,MAAM,kBAAkB;AAE5E,QAAM,EAAE,eAAe,MAAM,IAAI;AAIjC,MAAI,CAAC,iBAAiB;AACpB,WACE,oBAAC,mBAAgB,OAAO,MAAM,IAAI,CAAC,SAAS,KAAK,EAAE,GAAG,UAAU,+BAC9D,8BAAC,aAAW,GAAG,OAAO,GACxB;AAGJ,SAAO,oBAAC,aAAW,GAAG,OAAO;AAC/B;",
6
6
  "names": []
7
7
  }
@@ -1,11 +1,11 @@
1
1
  import * as React from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { useContext, useMemo } from "react";
4
3
  import { useSortable } from "@elliemae/ds-drag-and-drop";
5
- import { DnDGroupContext } from "./withConditionalDnDColumnContext.js";
6
- import { SortableItemContext } from "./SortableItemContext.js";
4
+ import { useContext, useMemo } from "react";
7
5
  import { DropIndicatorPosition } from "../../configs/constants.js";
8
- import { usePropsStore } from "../../configs/useStore/useStore.js";
6
+ import { usePropsStore } from "../../configs/useStore/createInternalAndPropsContext.js";
7
+ import { SortableItemContext } from "./SortableItemContext.js";
8
+ import { DnDGroupContext } from "./DnDGroupContext.js";
9
9
  const withDnDSortableColumnContext = (Component) => (props) => {
10
10
  const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);
11
11
  const { activeIndex } = useContext(DnDGroupContext);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/withDnDSortableColumnContext.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/function-component-definition */\nimport React, { useContext, useMemo } from 'react';\nimport { useSortable } from '@elliemae/ds-drag-and-drop';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { DnDGroupContext } from './withConditionalDnDColumnContext.js';\nimport type { SortableItemContextType } from './SortableItemContext.js';\nimport { SortableItemContext } from './SortableItemContext.js';\nimport { DropIndicatorPosition } from '../../configs/constants.js';\nimport { usePropsStore } from '../../configs/useStore/useStore.js';\n\nexport const withDnDSortableColumnContext =\n <T extends { header: DSDataTableT.InternalColumn }>(Component: React.ComponentType<T>) =>\n (props: T) => {\n const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);\n const { activeIndex } = useContext(DnDGroupContext);\n\n // onMount generate unique options, so everyting is only ran once\n const draggableOptions = useMemo(\n () => ({\n id: props.header.id,\n }),\n [props.header.id],\n );\n\n const useSortableHelpers = useSortable(draggableOptions);\n\n // calculate all the \"useSortable\" values as per required\n const draggableProps: DSDataTableT.DraggablePropsT = useMemo(() => {\n if (!dragAndDropColumns) return false;\n\n const { index, overIndex } = useSortableHelpers;\n\n return {\n ...useSortableHelpers,\n shouldShowDropIndicatorPosition: overIndex === index && overIndex !== -1,\n dropIndicatorPosition:\n activeIndex && index > activeIndex ? DropIndicatorPosition.After : DropIndicatorPosition.Before,\n isDropValid: true,\n };\n }, [useSortableHelpers, dragAndDropColumns, activeIndex]);\n // we use a context so we can easly access information wherever without bubbling down\n // this context is all Memoized so as long as component is not re-mounted,\n // the context won't trigger un-required renders per-se...\n const ctx: SortableItemContextType = useMemo(\n () => ({\n draggableProps,\n }),\n [draggableProps],\n );\n // we always add the context, if draggableProps===false we don't have the DnD enabled.\n return (\n <SortableItemContext.Provider value={ctx}>\n <Component {...props} />\n </SortableItemContext.Provider>\n );\n };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACoDf;AAnDR,SAAgB,YAAY,eAAe;AAC3C,SAAS,mBAAmB;AAE5B,SAAS,uBAAuB;AAEhC,SAAS,2BAA2B;AACpC,SAAS,6BAA6B;AACtC,SAAS,qBAAqB;AAEvB,MAAM,+BACX,CAAoD,cACpD,CAAC,UAAa;AACZ,QAAM,qBAAqB,cAAc,CAAC,UAAU,MAAM,kBAAkB;AAC5E,QAAM,EAAE,YAAY,IAAI,WAAW,eAAe;AAGlD,QAAM,mBAAmB;AAAA,IACvB,OAAO;AAAA,MACL,IAAI,MAAM,OAAO;AAAA,IACnB;AAAA,IACA,CAAC,MAAM,OAAO,EAAE;AAAA,EAClB;AAEA,QAAM,qBAAqB,YAAY,gBAAgB;AAGvD,QAAM,iBAA+C,QAAQ,MAAM;AACjE,QAAI,CAAC,mBAAoB,QAAO;AAEhC,UAAM,EAAE,OAAO,UAAU,IAAI;AAE7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,iCAAiC,cAAc,SAAS,cAAc;AAAA,MACtE,uBACE,eAAe,QAAQ,cAAc,sBAAsB,QAAQ,sBAAsB;AAAA,MAC3F,aAAa;AAAA,IACf;AAAA,EACF,GAAG,CAAC,oBAAoB,oBAAoB,WAAW,CAAC;AAIxD,QAAM,MAA+B;AAAA,IACnC,OAAO;AAAA,MACL;AAAA,IACF;AAAA,IACA,CAAC,cAAc;AAAA,EACjB;AAEA,SACE,oBAAC,oBAAoB,UAApB,EAA6B,OAAO,KACnC,8BAAC,aAAW,GAAG,OAAO,GACxB;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/function-component-definition */\nimport { useSortable } from '@elliemae/ds-drag-and-drop';\nimport React, { useContext, useMemo } from 'react';\nimport { DropIndicatorPosition } from '../../configs/constants.js';\nimport { usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport type { SortableItemContextType } from './SortableItemContext.js';\nimport { SortableItemContext } from './SortableItemContext.js';\nimport { DnDGroupContext } from './DnDGroupContext.js';\n\nexport const withDnDSortableColumnContext =\n <T extends { header: DSDataTableT.InternalColumn }>(Component: React.ComponentType<T>) =>\n (props: T) => {\n const dragAndDropColumns = usePropsStore((state) => state.dragAndDropColumns);\n const { activeIndex } = useContext(DnDGroupContext);\n\n // onMount generate unique options, so everyting is only ran once\n const draggableOptions = useMemo(\n () => ({\n id: props.header.id,\n }),\n [props.header.id],\n );\n\n const useSortableHelpers = useSortable(draggableOptions);\n\n // calculate all the \"useSortable\" values as per required\n const draggableProps: DSDataTableT.DraggablePropsT = useMemo(() => {\n if (!dragAndDropColumns) return false;\n\n const { index, overIndex } = useSortableHelpers;\n\n return {\n ...useSortableHelpers,\n shouldShowDropIndicatorPosition: overIndex === index && overIndex !== -1,\n dropIndicatorPosition:\n activeIndex && index > activeIndex ? DropIndicatorPosition.After : DropIndicatorPosition.Before,\n isDropValid: true,\n };\n }, [useSortableHelpers, dragAndDropColumns, activeIndex]);\n // we use a context so we can easly access information wherever without bubbling down\n // this context is all Memoized so as long as component is not re-mounted,\n // the context won't trigger un-required renders per-se...\n const ctx: SortableItemContextType = useMemo(\n () => ({\n draggableProps,\n }),\n [draggableProps],\n );\n // we always add the context, if draggableProps===false we don't have the DnD enabled.\n return (\n <SortableItemContext.Provider value={ctx}>\n <Component {...props} />\n </SortableItemContext.Provider>\n );\n };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACoDf;AAnDR,SAAS,mBAAmB;AAC5B,SAAgB,YAAY,eAAe;AAC3C,SAAS,6BAA6B;AACtC,SAAS,qBAAqB;AAG9B,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAEzB,MAAM,+BACX,CAAoD,cACpD,CAAC,UAAa;AACZ,QAAM,qBAAqB,cAAc,CAAC,UAAU,MAAM,kBAAkB;AAC5E,QAAM,EAAE,YAAY,IAAI,WAAW,eAAe;AAGlD,QAAM,mBAAmB;AAAA,IACvB,OAAO;AAAA,MACL,IAAI,MAAM,OAAO;AAAA,IACnB;AAAA,IACA,CAAC,MAAM,OAAO,EAAE;AAAA,EAClB;AAEA,QAAM,qBAAqB,YAAY,gBAAgB;AAGvD,QAAM,iBAA+C,QAAQ,MAAM;AACjE,QAAI,CAAC,mBAAoB,QAAO;AAEhC,UAAM,EAAE,OAAO,UAAU,IAAI;AAE7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,iCAAiC,cAAc,SAAS,cAAc;AAAA,MACtE,uBACE,eAAe,QAAQ,cAAc,sBAAsB,QAAQ,sBAAsB;AAAA,MAC3F,aAAa;AAAA,IACf;AAAA,EACF,GAAG,CAAC,oBAAoB,oBAAoB,WAAW,CAAC;AAIxD,QAAM,MAA+B;AAAA,IACnC,OAAO;AAAA,MACL;AAAA,IACF;AAAA,IACA,CAAC,cAAc;AAAA,EACjB;AAEA,SACE,oBAAC,oBAAoB,UAApB,EAA6B,OAAO,KACnC,8BAAC,aAAW,GAAG,OAAO,GACxB;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -1,10 +1,10 @@
1
1
  import * as React from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { useContext, useMemo } from "react";
4
3
  import { useSortable } from "@elliemae/ds-drag-and-drop";
4
+ import { useContext, useMemo } from "react";
5
+ import { usePropsStore } from "../../configs/useStore/createInternalAndPropsContext.js";
5
6
  import { DnDTreeContext } from "./DnDTreeContext.js";
6
7
  import { SortableItemContext } from "./SortableItemContext.js";
7
- import { usePropsStore } from "../../configs/useStore/useStore.js";
8
8
  const withDnDSortableRowContext = (Component) => function(props) {
9
9
  const dragAndDropRows = usePropsStore((state) => state.dragAndDropRows);
10
10
  const { dropIndicatorPosition, isDropValid } = useContext(DnDTreeContext);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/HoC/withDnDSortableRowContext.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext, useMemo } from 'react';\nimport { useSortable } from '@elliemae/ds-drag-and-drop';\nimport { DnDTreeContext } from './DnDTreeContext.js';\nimport type { SortableItemContextType } from './SortableItemContext.js';\nimport { SortableItemContext } from './SortableItemContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { usePropsStore } from '../../configs/useStore/useStore.js';\n\nexport const withDnDSortableRowContext = <T extends { row: DSDataTableT.InternalRow }>(\n Component: React.ComponentType<T>,\n) =>\n function (props: T) {\n const dragAndDropRows = usePropsStore((state) => state.dragAndDropRows);\n const { dropIndicatorPosition, isDropValid } = useContext(DnDTreeContext);\n\n // onMount generate unique options, so everyting is only ran once\n const draggableOptions = useMemo(\n () => ({\n id: props.row.uid,\n }),\n [props.row],\n );\n\n const useSortableHelpers = useSortable(draggableOptions);\n\n // calculate all the \"useSortable\" values as per required\n const draggableProps = useMemo(() => {\n if (!dragAndDropRows) return false;\n\n const { index, overIndex } = useSortableHelpers;\n\n return {\n ...useSortableHelpers,\n shouldShowDropIndicatorPosition: overIndex === index,\n dropIndicatorPosition,\n isDropValid,\n };\n }, [dragAndDropRows, useSortableHelpers, dropIndicatorPosition, isDropValid]);\n\n // we use a context so we can easly access information wherever without bubbling down\n // this context is all Memoized so as long as component is not re-mounted,\n // the context won't trigger un-required renders per-se...\n const ctx: SortableItemContextType = useMemo(\n () => ({\n draggableProps,\n }),\n [draggableProps],\n );\n // we always add the context, if draggableProps===false we don't have the DnD enabled.\n return (\n <SortableItemContext.Provider value={ctx}>\n <Component {...props} />\n </SortableItemContext.Provider>\n );\n };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACmDf;AAnDR,SAAgB,YAAY,eAAe;AAC3C,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAE/B,SAAS,2BAA2B;AAEpC,SAAS,qBAAqB;AAEvB,MAAM,4BAA4B,CACvC,cAEA,SAAU,OAAU;AAClB,QAAM,kBAAkB,cAAc,CAAC,UAAU,MAAM,eAAe;AACtE,QAAM,EAAE,uBAAuB,YAAY,IAAI,WAAW,cAAc;AAGxE,QAAM,mBAAmB;AAAA,IACvB,OAAO;AAAA,MACL,IAAI,MAAM,IAAI;AAAA,IAChB;AAAA,IACA,CAAC,MAAM,GAAG;AAAA,EACZ;AAEA,QAAM,qBAAqB,YAAY,gBAAgB;AAGvD,QAAM,iBAAiB,QAAQ,MAAM;AACnC,QAAI,CAAC,gBAAiB,QAAO;AAE7B,UAAM,EAAE,OAAO,UAAU,IAAI;AAE7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,iCAAiC,cAAc;AAAA,MAC/C;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,iBAAiB,oBAAoB,uBAAuB,WAAW,CAAC;AAK5E,QAAM,MAA+B;AAAA,IACnC,OAAO;AAAA,MACL;AAAA,IACF;AAAA,IACA,CAAC,cAAc;AAAA,EACjB;AAEA,SACE,oBAAC,oBAAoB,UAApB,EAA6B,OAAO,KACnC,8BAAC,aAAW,GAAG,OAAO,GACxB;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable func-names */\nimport { useSortable } from '@elliemae/ds-drag-and-drop';\nimport React, { useContext, useMemo } from 'react';\nimport { usePropsStore } from '../../configs/useStore/createInternalAndPropsContext.js';\nimport type { DSDataTableT } from '../../react-desc-prop-types.js';\nimport { DnDTreeContext } from './DnDTreeContext.js';\nimport type { SortableItemContextType } from './SortableItemContext.js';\nimport { SortableItemContext } from './SortableItemContext.js';\n\nexport const withDnDSortableRowContext = <T extends { row: DSDataTableT.InternalRow }>(\n Component: React.ComponentType<T>,\n) =>\n function (props: T) {\n const dragAndDropRows = usePropsStore((state) => state.dragAndDropRows);\n const { dropIndicatorPosition, isDropValid } = useContext(DnDTreeContext);\n\n // onMount generate unique options, so everyting is only ran once\n const draggableOptions = useMemo(\n () => ({\n id: props.row.uid,\n }),\n [props.row],\n );\n\n const useSortableHelpers = useSortable(draggableOptions);\n\n // calculate all the \"useSortable\" values as per required\n const draggableProps = useMemo(() => {\n if (!dragAndDropRows) return false;\n\n const { index, overIndex } = useSortableHelpers;\n\n return {\n ...useSortableHelpers,\n shouldShowDropIndicatorPosition: overIndex === index,\n dropIndicatorPosition,\n isDropValid,\n };\n }, [dragAndDropRows, useSortableHelpers, dropIndicatorPosition, isDropValid]);\n\n // we use a context so we can easly access information wherever without bubbling down\n // this context is all Memoized so as long as component is not re-mounted,\n // the context won't trigger un-required renders per-se...\n const ctx: SortableItemContextType = useMemo(\n () => ({\n draggableProps,\n }),\n [draggableProps],\n );\n // we always add the context, if draggableProps===false we don't have the DnD enabled.\n return (\n <SortableItemContext.Provider value={ctx}>\n <Component {...props} />\n </SortableItemContext.Provider>\n );\n };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACoDf;AAnDR,SAAS,mBAAmB;AAC5B,SAAgB,YAAY,eAAe;AAC3C,SAAS,qBAAqB;AAE9B,SAAS,sBAAsB;AAE/B,SAAS,2BAA2B;AAE7B,MAAM,4BAA4B,CACvC,cAEA,SAAU,OAAU;AAClB,QAAM,kBAAkB,cAAc,CAAC,UAAU,MAAM,eAAe;AACtE,QAAM,EAAE,uBAAuB,YAAY,IAAI,WAAW,cAAc;AAGxE,QAAM,mBAAmB;AAAA,IACvB,OAAO;AAAA,MACL,IAAI,MAAM,IAAI;AAAA,IAChB;AAAA,IACA,CAAC,MAAM,GAAG;AAAA,EACZ;AAEA,QAAM,qBAAqB,YAAY,gBAAgB;AAGvD,QAAM,iBAAiB,QAAQ,MAAM;AACnC,QAAI,CAAC,gBAAiB,QAAO;AAE7B,UAAM,EAAE,OAAO,UAAU,IAAI;AAE7B,WAAO;AAAA,MACL,GAAG;AAAA,MACH,iCAAiC,cAAc;AAAA,MAC/C;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,iBAAiB,oBAAoB,uBAAuB,WAAW,CAAC;AAK5E,QAAM,MAA+B;AAAA,IACnC,OAAO;AAAA,MACL;AAAA,IACF;AAAA,IACA,CAAC,cAAc;AAAA,EACjB;AAEA,SACE,oBAAC,oBAAoB,UAApB,EAA6B,OAAO,KACnC,8BAAC,aAAW,GAAG,OAAO,GACxB;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -1,11 +1,11 @@
1
1
  import * as React from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { memo } from "react";
4
- import { Grid } from "@elliemae/ds-grid";
5
3
  import { DSCircularProgressIndicator } from "@elliemae/ds-circular-progress-indicator";
4
+ import { Grid } from "@elliemae/ds-grid";
6
5
  import { styled } from "@elliemae/ds-system";
6
+ import { memo } from "react";
7
7
  import { DSDataTableName, DSDataTableSlots } from "../DSDataTableDefinitions.js";
8
- import { usePropsStore } from "../configs/useStore/useStore.js";
8
+ import { usePropsStore } from "../configs/useStore/createInternalAndPropsContext.js";
9
9
  const StyledLoaderWrapper = styled(Grid, { name: DSDataTableName, slot: DSDataTableSlots.LOADER_WRAPPER })`
10
10
  place-items: center;
11
11
  z-index: 0;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/Loader.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { memo } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSCircularProgressIndicator } from '@elliemae/ds-circular-progress-indicator';\nimport { styled } from '@elliemae/ds-system';\nimport { DSDataTableName, DSDataTableSlots } from '../DSDataTableDefinitions.js';\nimport { usePropsStore } from '../configs/useStore/useStore.js';\n\nconst StyledLoaderWrapper = styled(Grid, { name: DSDataTableName, slot: DSDataTableSlots.LOADER_WRAPPER })`\n place-items: center;\n z-index: 0;\n background-color: white;\n`;\n\n/**\n * we need to keep the semantic table structure\n * @returns Loader\n */\nconst Loader = () => {\n const getOwnerProps = usePropsStore((store) => store.get);\n return (\n <StyledLoaderWrapper role=\"row\" aria-live=\"polite\" getOwnerProps={getOwnerProps}>\n <div role=\"cell\">\n <DSCircularProgressIndicator size=\"xl\" loading showLabel waiting={false} showTooltip={false} />\n </div>\n </StyledLoaderWrapper>\n );\n};\nexport const MemoizedLoader = memo(Loader);\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACsBf;AAtBR,SAAgB,YAAY;AAC5B,SAAS,YAAY;AACrB,SAAS,mCAAmC;AAC5C,SAAS,cAAc;AACvB,SAAS,iBAAiB,wBAAwB;AAClD,SAAS,qBAAqB;AAE9B,MAAM,sBAAsB,OAAO,MAAM,EAAE,MAAM,iBAAiB,MAAM,iBAAiB,eAAe,CAAC;AAAA;AAAA;AAAA;AAAA;AAUzG,MAAM,SAAS,MAAM;AACnB,QAAM,gBAAgB,cAAc,CAAC,UAAU,MAAM,GAAG;AACxD,SACE,oBAAC,uBAAoB,MAAK,OAAM,aAAU,UAAS,eACjD,8BAAC,SAAI,MAAK,QACR,8BAAC,+BAA4B,MAAK,MAAK,SAAO,MAAC,WAAS,MAAC,SAAS,OAAO,aAAa,OAAO,GAC/F,GACF;AAEJ;AACO,MAAM,iBAAiB,KAAK,MAAM;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { DSCircularProgressIndicator } from '@elliemae/ds-circular-progress-indicator';\nimport { Grid } from '@elliemae/ds-grid';\nimport { styled } from '@elliemae/ds-system';\nimport { memo } from 'react';\nimport { DSDataTableName, DSDataTableSlots } from '../DSDataTableDefinitions.js';\nimport { usePropsStore } from '../configs/useStore/createInternalAndPropsContext.js';\n\nconst StyledLoaderWrapper = styled(Grid, { name: DSDataTableName, slot: DSDataTableSlots.LOADER_WRAPPER })`\n place-items: center;\n z-index: 0;\n background-color: white;\n`;\n\n/**\n * we need to keep the semantic table structure\n * @returns Loader\n */\nconst Loader = () => {\n const getOwnerProps = usePropsStore((store) => store.get);\n return (\n <StyledLoaderWrapper role=\"row\" aria-live=\"polite\" getOwnerProps={getOwnerProps}>\n <div role=\"cell\">\n <DSCircularProgressIndicator size=\"xl\" loading showLabel waiting={false} showTooltip={false} />\n </div>\n </StyledLoaderWrapper>\n );\n};\nexport const MemoizedLoader = memo(Loader);\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACsBf;AAtBR,SAAS,mCAAmC;AAC5C,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,iBAAiB,wBAAwB;AAClD,SAAS,qBAAqB;AAE9B,MAAM,sBAAsB,OAAO,MAAM,EAAE,MAAM,iBAAiB,MAAM,iBAAiB,eAAe,CAAC;AAAA;AAAA;AAAA;AAAA;AAUzG,MAAM,SAAS,MAAM;AACnB,QAAM,gBAAgB,cAAc,CAAC,UAAU,MAAM,GAAG;AACxD,SACE,oBAAC,uBAAoB,MAAK,OAAM,aAAU,UAAS,eACjD,8BAAC,SAAI,MAAK,QACR,8BAAC,+BAA4B,MAAK,MAAK,SAAO,MAAC,WAAS,MAAC,SAAS,OAAO,aAAa,OAAO,GAC/F,GACF;AAEJ;AACO,MAAM,iBAAiB,KAAK,MAAM;",
6
6
  "names": []
7
7
  }
@@ -4,7 +4,7 @@ import { TableContent } from "./TableContent.js";
4
4
  import { DATA_TESTID } from "../configs/constants.js";
5
5
  import { FiltersBar } from "./FilterBar/FiltersBar.js";
6
6
  import { StyledDataTableWrapper } from "../styled.js";
7
- import { usePropsStore } from "../configs/useStore/useStore.js";
7
+ import { usePropsStore } from "../configs/useStore/createInternalAndPropsContext.js";
8
8
  const MainContent = () => {
9
9
  const height = usePropsStore((state) => state.height);
10
10
  const width = usePropsStore((state) => state.width);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/parts/MainContent.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { TableContent } from './TableContent.js';\nimport { DATA_TESTID } from '../configs/constants.js';\nimport { FiltersBar } from './FilterBar/FiltersBar.js';\nimport { StyledDataTableWrapper } from '../styled.js';\nimport { usePropsStore } from '../configs/useStore/useStore.js';\n\nexport const MainContent = (): JSX.Element => {\n const height = usePropsStore((state) => state.height);\n const width = usePropsStore((state) => state.width);\n const withFilterBar = usePropsStore((state) => state.withFilterBar);\n const getOwnerProps = usePropsStore((store) => store.get);\n\n return (\n <StyledDataTableWrapper\n data-testid={DATA_TESTID.DATA_TABLE_WRAPPER}\n height={height}\n width={width}\n cols={['100%']}\n rows={withFilterBar ? ['auto', '1fr'] : ['1fr']}\n getOwnerProps={getOwnerProps}\n >\n {withFilterBar ? <FiltersBar /> : null}\n <TableContent />\n </StyledDataTableWrapper>\n );\n};\n"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { TableContent } from './TableContent.js';\nimport { DATA_TESTID } from '../configs/constants.js';\nimport { FiltersBar } from './FilterBar/FiltersBar.js';\nimport { StyledDataTableWrapper } from '../styled.js';\nimport { usePropsStore } from '../configs/useStore/createInternalAndPropsContext.js';\n\nexport const MainContent = (): JSX.Element => {\n const height = usePropsStore((state) => state.height);\n const width = usePropsStore((state) => state.width);\n const withFilterBar = usePropsStore((state) => state.withFilterBar);\n const getOwnerProps = usePropsStore((store) => store.get);\n\n return (\n <StyledDataTableWrapper\n data-testid={DATA_TESTID.DATA_TABLE_WRAPPER}\n height={height}\n width={width}\n cols={['100%']}\n rows={withFilterBar ? ['auto', '1fr'] : ['1fr']}\n getOwnerProps={getOwnerProps}\n >\n {withFilterBar ? <FiltersBar /> : null}\n <TableContent />\n </StyledDataTableWrapper>\n );\n};\n"],
5
5
  "mappings": "AAAA,YAAY,WAAW;ACcnB,SAQmB,KARnB;AAbJ,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,8BAA8B;AACvC,SAAS,qBAAqB;AAEvB,MAAM,cAAc,MAAmB;AAC5C,QAAM,SAAS,cAAc,CAAC,UAAU,MAAM,MAAM;AACpD,QAAM,QAAQ,cAAc,CAAC,UAAU,MAAM,KAAK;AAClD,QAAM,gBAAgB,cAAc,CAAC,UAAU,MAAM,aAAa;AAClE,QAAM,gBAAgB,cAAc,CAAC,UAAU,MAAM,GAAG;AAExD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa,YAAY;AAAA,MACzB;AAAA,MACA;AAAA,MACA,MAAM,CAAC,MAAM;AAAA,MACb,MAAM,gBAAgB,CAAC,QAAQ,KAAK,IAAI,CAAC,KAAK;AAAA,MAC9C;AAAA,MAEC;AAAA,wBAAgB,oBAAC,cAAW,IAAK;AAAA,QAClC,oBAAC,gBAAa;AAAA;AAAA;AAAA,EAChB;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -1,12 +1,12 @@
1
1
  import * as React from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
+ import { mergeRefs, styled } from "@elliemae/ds-system";
3
4
  import { useCallback, useContext } from "react";
4
- import { styled, mergeRefs } from "@elliemae/ds-system";
5
+ import { useInternalStore, usePropsStore } from "../configs/useStore/createInternalAndPropsContext.js";
6
+ import { DSDataTableName, DSDataTableSlots } from "../DSDataTableDefinitions.js";
5
7
  import { SortableItemContext } from "./HoC/SortableItemContext.js";
6
8
  import { withDnDSortableRowContext } from "./HoC/withDnDSortableRowContext.js";
7
9
  import { RowVariantMapItem } from "./RowVariants/index.js";
8
- import { useInternalStore, usePropsStore } from "../configs/useStore/useStore.js";
9
- import { DSDataTableName, DSDataTableSlots } from "../DSDataTableDefinitions.js";
10
10
  const StyledRow = styled("div", { name: DSDataTableName, slot: DSDataTableSlots.ROW })`
11
11
  cursor: ${({ isDisabled }) => isDisabled ? "not-allowed" : "normal"};
12
12
  `;