@elliemae/ds-shuttle-v2 3.14.0-next.1 → 3.14.0-next.10

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 (170) hide show
  1. package/dist/cjs/DSShuttleV2.js.map +2 -2
  2. package/dist/cjs/config/DSShuttleV2Definitions.js.map +1 -1
  3. package/dist/cjs/config/itemMovementHelpers.js +99 -74
  4. package/dist/cjs/config/itemMovementHelpers.js.map +2 -2
  5. package/dist/cjs/config/useAutoCalculated/useDataStructure.js +55 -34
  6. package/dist/cjs/config/useAutoCalculated/useDataStructure.js.map +2 -2
  7. package/dist/cjs/config/useAutoCalculated/useShuttleVirtualized.js.map +2 -2
  8. package/dist/cjs/config/useFocusTracker/useFocusActionTrackers.js +6 -6
  9. package/dist/cjs/config/useFocusTracker/useFocusActionTrackers.js.map +2 -2
  10. package/dist/cjs/config/useFocusTracker/useFocusItemTracker.js +5 -5
  11. package/dist/cjs/config/useFocusTracker/useFocusItemTracker.js.map +2 -2
  12. package/dist/cjs/config/useFocusTracker/useFocusRegionTrackers.js +2 -2
  13. package/dist/cjs/config/useFocusTracker/useFocusRegionTrackers.js.map +2 -2
  14. package/dist/cjs/config/useShuttleV2.js +2 -0
  15. package/dist/cjs/config/useShuttleV2.js.map +2 -2
  16. package/dist/cjs/config/useStore/createAtomInStore.bak +18 -0
  17. package/dist/cjs/config/useStore/useStore.js +14 -1
  18. package/dist/cjs/config/useStore/useStore.js.map +2 -2
  19. package/dist/cjs/config/{useStore/createAtomInStore.js → useValidateProps.js} +9 -13
  20. package/dist/cjs/config/useValidateProps.js.map +7 -0
  21. package/dist/cjs/constants/index.js +3 -1
  22. package/dist/cjs/constants/index.js.map +2 -2
  23. package/dist/cjs/parts/Dnd/DndHandle.js +17 -10
  24. package/dist/cjs/parts/Dnd/DndHandle.js.map +2 -2
  25. package/dist/cjs/parts/Dnd/DragOverlay.js +47 -0
  26. package/dist/cjs/parts/Dnd/DragOverlay.js.map +7 -0
  27. package/dist/cjs/parts/Header.js +5 -5
  28. package/dist/cjs/parts/Header.js.map +2 -2
  29. package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js +42 -17
  30. package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js.map +3 -3
  31. package/dist/cjs/parts/HoC/withConditionalUseSortable.js +4 -3
  32. package/dist/cjs/parts/HoC/withConditionalUseSortable.js.map +2 -2
  33. package/dist/cjs/parts/Item/Item.js +42 -33
  34. package/dist/cjs/parts/Item/Item.js.map +2 -2
  35. package/dist/cjs/parts/Item/ItemActions/ItemActions.js +16 -14
  36. package/dist/cjs/parts/Item/ItemActions/ItemActions.js.map +2 -2
  37. package/dist/cjs/parts/Item/ItemActions/useActionsHandlers.js +8 -3
  38. package/dist/cjs/parts/Item/ItemActions/useActionsHandlers.js.map +2 -2
  39. package/dist/cjs/parts/Item/ItemActions/useActionsLogicHandlers.js +27 -39
  40. package/dist/cjs/parts/Item/ItemActions/useActionsLogicHandlers.js.map +2 -2
  41. package/dist/cjs/parts/Item/ItemActions/useInnerRefHandlers.js +2 -2
  42. package/dist/cjs/parts/Item/ItemActions/useInnerRefHandlers.js.map +2 -2
  43. package/dist/cjs/parts/Item/ItemMiddleSection.js +21 -22
  44. package/dist/cjs/parts/Item/ItemMiddleSection.js.map +2 -2
  45. package/dist/cjs/parts/Item/ItemOverlay.js +15 -7
  46. package/dist/cjs/parts/Item/ItemOverlay.js.map +2 -2
  47. package/dist/cjs/parts/Item/ItemSelection.js +3 -1
  48. package/dist/cjs/parts/Item/ItemSelection.js.map +2 -2
  49. package/dist/cjs/parts/Item/TextSection.js +50 -0
  50. package/dist/cjs/parts/Item/TextSection.js.map +7 -0
  51. package/dist/cjs/parts/Item/useItemArrowNavigation.js +46 -20
  52. package/dist/cjs/parts/Item/useItemArrowNavigation.js.map +2 -2
  53. package/dist/cjs/parts/Item/useItemKeyboardSelection.js +57 -0
  54. package/dist/cjs/parts/Item/useItemKeyboardSelection.js.map +7 -0
  55. package/dist/cjs/parts/Item/useSelectionLogic.js +64 -21
  56. package/dist/cjs/parts/Item/useSelectionLogic.js.map +2 -2
  57. package/dist/cjs/parts/MainContent.js +5 -2
  58. package/dist/cjs/parts/MainContent.js.map +2 -2
  59. package/dist/cjs/parts/Panel/bottom/LoadMoreBtn.js +3 -3
  60. package/dist/cjs/parts/Panel/bottom/LoadMoreBtn.js.map +2 -2
  61. package/dist/cjs/parts/Panel/bottom/LoadingMore.js +1 -1
  62. package/dist/cjs/parts/Panel/bottom/LoadingMore.js.map +2 -2
  63. package/dist/cjs/parts/Panel/bottom/PanelContentBottomSection.js +1 -1
  64. package/dist/cjs/parts/Panel/bottom/PanelContentBottomSection.js.map +1 -1
  65. package/dist/cjs/parts/Panel/bottom/useLoadMoreBtnArrowNavigation.js +4 -3
  66. package/dist/cjs/parts/Panel/bottom/useLoadMoreBtnArrowNavigation.js.map +2 -2
  67. package/dist/cjs/parts/Panel/middle/{ItemListWrapper.js → ItemListWrapper/Index.js} +25 -19
  68. package/dist/cjs/parts/Panel/middle/ItemListWrapper/Index.js.map +7 -0
  69. package/dist/cjs/parts/Panel/middle/ItemListWrapper/getDatumFlags.js +44 -0
  70. package/dist/cjs/parts/Panel/middle/ItemListWrapper/getDatumFlags.js.map +7 -0
  71. package/dist/cjs/parts/Panel/middle/ItemListWrapper/useGetDatumHydratables.js +57 -0
  72. package/dist/cjs/parts/Panel/middle/ItemListWrapper/useGetDatumHydratables.js.map +7 -0
  73. package/dist/cjs/parts/Panel/middle/MultipleSelectionAction.js +30 -7
  74. package/dist/cjs/parts/Panel/middle/MultipleSelectionAction.js.map +2 -2
  75. package/dist/cjs/parts/Panel/middle/PanelContentMiddleSection.js +12 -22
  76. package/dist/cjs/parts/Panel/middle/PanelContentMiddleSection.js.map +2 -2
  77. package/dist/cjs/parts/Panel/top/SelectionHeader.js +1 -1
  78. package/dist/cjs/parts/Panel/top/SelectionHeader.js.map +2 -2
  79. package/dist/cjs/parts/PanelWrapper.js +8 -11
  80. package/dist/cjs/parts/PanelWrapper.js.map +2 -2
  81. package/dist/cjs/react-desc-prop-types.js +31 -14
  82. package/dist/cjs/react-desc-prop-types.js.map +2 -2
  83. package/dist/esm/DSShuttleV2.js.map +2 -2
  84. package/dist/esm/config/DSShuttleV2Definitions.js.map +1 -1
  85. package/dist/esm/config/itemMovementHelpers.js +99 -74
  86. package/dist/esm/config/itemMovementHelpers.js.map +2 -2
  87. package/dist/esm/config/useAutoCalculated/useDataStructure.js +55 -34
  88. package/dist/esm/config/useAutoCalculated/useDataStructure.js.map +2 -2
  89. package/dist/esm/config/useAutoCalculated/useShuttleVirtualized.js.map +2 -2
  90. package/dist/esm/config/useFocusTracker/useFocusActionTrackers.js +6 -6
  91. package/dist/esm/config/useFocusTracker/useFocusActionTrackers.js.map +2 -2
  92. package/dist/esm/config/useFocusTracker/useFocusItemTracker.js +5 -5
  93. package/dist/esm/config/useFocusTracker/useFocusItemTracker.js.map +2 -2
  94. package/dist/esm/config/useFocusTracker/useFocusRegionTrackers.js +2 -2
  95. package/dist/esm/config/useFocusTracker/useFocusRegionTrackers.js.map +2 -2
  96. package/dist/esm/config/useShuttleV2.js +3 -1
  97. package/dist/esm/config/useShuttleV2.js.map +2 -2
  98. package/dist/esm/config/useStore/createAtomInStore.bak +18 -0
  99. package/dist/esm/config/useStore/useStore.js +14 -1
  100. package/dist/esm/config/useStore/useStore.js.map +2 -2
  101. package/dist/esm/config/useValidateProps.js +10 -0
  102. package/dist/esm/config/useValidateProps.js.map +7 -0
  103. package/dist/esm/constants/index.js +3 -1
  104. package/dist/esm/constants/index.js.map +2 -2
  105. package/dist/esm/parts/Dnd/DndHandle.js +17 -10
  106. package/dist/esm/parts/Dnd/DndHandle.js.map +2 -2
  107. package/dist/esm/parts/Dnd/DragOverlay.js +21 -0
  108. package/dist/esm/parts/Dnd/DragOverlay.js.map +7 -0
  109. package/dist/esm/parts/Header.js +4 -4
  110. package/dist/esm/parts/Header.js.map +2 -2
  111. package/dist/esm/parts/HoC/withConditionalDnDRowContext.js +43 -18
  112. package/dist/esm/parts/HoC/withConditionalDnDRowContext.js.map +3 -3
  113. package/dist/esm/parts/HoC/withConditionalUseSortable.js +4 -3
  114. package/dist/esm/parts/HoC/withConditionalUseSortable.js.map +2 -2
  115. package/dist/esm/parts/Item/Item.js +42 -33
  116. package/dist/esm/parts/Item/Item.js.map +2 -2
  117. package/dist/esm/parts/Item/ItemActions/ItemActions.js +13 -11
  118. package/dist/esm/parts/Item/ItemActions/ItemActions.js.map +2 -2
  119. package/dist/esm/parts/Item/ItemActions/useActionsHandlers.js +8 -3
  120. package/dist/esm/parts/Item/ItemActions/useActionsHandlers.js.map +2 -2
  121. package/dist/esm/parts/Item/ItemActions/useActionsLogicHandlers.js +28 -40
  122. package/dist/esm/parts/Item/ItemActions/useActionsLogicHandlers.js.map +2 -2
  123. package/dist/esm/parts/Item/ItemActions/useInnerRefHandlers.js +2 -2
  124. package/dist/esm/parts/Item/ItemActions/useInnerRefHandlers.js.map +2 -2
  125. package/dist/esm/parts/Item/ItemMiddleSection.js +20 -21
  126. package/dist/esm/parts/Item/ItemMiddleSection.js.map +2 -2
  127. package/dist/esm/parts/Item/ItemOverlay.js +15 -7
  128. package/dist/esm/parts/Item/ItemOverlay.js.map +2 -2
  129. package/dist/esm/parts/Item/ItemSelection.js +3 -1
  130. package/dist/esm/parts/Item/ItemSelection.js.map +2 -2
  131. package/dist/esm/parts/Item/TextSection.js +24 -0
  132. package/dist/esm/parts/Item/TextSection.js.map +7 -0
  133. package/dist/esm/parts/Item/useItemArrowNavigation.js +47 -21
  134. package/dist/esm/parts/Item/useItemArrowNavigation.js.map +2 -2
  135. package/dist/esm/parts/Item/useItemKeyboardSelection.js +31 -0
  136. package/dist/esm/parts/Item/useItemKeyboardSelection.js.map +7 -0
  137. package/dist/esm/parts/Item/useSelectionLogic.js +64 -21
  138. package/dist/esm/parts/Item/useSelectionLogic.js.map +2 -2
  139. package/dist/esm/parts/MainContent.js +5 -2
  140. package/dist/esm/parts/MainContent.js.map +2 -2
  141. package/dist/esm/parts/Panel/bottom/LoadMoreBtn.js +1 -1
  142. package/dist/esm/parts/Panel/bottom/LoadMoreBtn.js.map +1 -1
  143. package/dist/esm/parts/Panel/bottom/LoadingMore.js +1 -1
  144. package/dist/esm/parts/Panel/bottom/LoadingMore.js.map +2 -2
  145. package/dist/esm/parts/Panel/bottom/PanelContentBottomSection.js +1 -1
  146. package/dist/esm/parts/Panel/bottom/PanelContentBottomSection.js.map +1 -1
  147. package/dist/esm/parts/Panel/bottom/useLoadMoreBtnArrowNavigation.js +4 -3
  148. package/dist/esm/parts/Panel/bottom/useLoadMoreBtnArrowNavigation.js.map +2 -2
  149. package/dist/esm/parts/Panel/middle/{ItemListWrapper.js → ItemListWrapper/Index.js} +22 -16
  150. package/dist/esm/parts/Panel/middle/ItemListWrapper/Index.js.map +7 -0
  151. package/dist/esm/parts/Panel/middle/ItemListWrapper/getDatumFlags.js +18 -0
  152. package/dist/esm/parts/Panel/middle/ItemListWrapper/getDatumFlags.js.map +7 -0
  153. package/dist/esm/parts/Panel/middle/ItemListWrapper/useGetDatumHydratables.js +31 -0
  154. package/dist/esm/parts/Panel/middle/ItemListWrapper/useGetDatumHydratables.js.map +7 -0
  155. package/dist/esm/parts/Panel/middle/MultipleSelectionAction.js +29 -6
  156. package/dist/esm/parts/Panel/middle/MultipleSelectionAction.js.map +2 -2
  157. package/dist/esm/parts/Panel/middle/PanelContentMiddleSection.js +11 -21
  158. package/dist/esm/parts/Panel/middle/PanelContentMiddleSection.js.map +2 -2
  159. package/dist/esm/parts/Panel/top/SelectionHeader.js +1 -1
  160. package/dist/esm/parts/Panel/top/SelectionHeader.js.map +2 -2
  161. package/dist/esm/parts/PanelWrapper.js +8 -11
  162. package/dist/esm/parts/PanelWrapper.js.map +2 -2
  163. package/dist/esm/react-desc-prop-types.js +32 -15
  164. package/dist/esm/react-desc-prop-types.js.map +2 -2
  165. package/package.json +13 -11
  166. package/dist/cjs/config/useStore/createAtomInStore.js.map +0 -7
  167. package/dist/cjs/parts/Panel/middle/ItemListWrapper.js.map +0 -7
  168. package/dist/esm/config/useStore/createAtomInStore.js +0 -14
  169. package/dist/esm/config/useStore/createAtomInStore.js.map +0 -7
  170. package/dist/esm/parts/Panel/middle/ItemListWrapper.js.map +0 -7
@@ -1,101 +1,126 @@
1
1
  import * as React from "react";
2
2
  import React2 from "react";
3
+ import { useMakeMutable } from "@elliemae/ds-utilities";
3
4
  import { usePropsStore, useInternalStore } from "./useStore";
4
- const getNewDatasWithItemMoved = ({
5
- item,
6
- currData,
7
- currWithSoftDelete,
8
- otherData
9
- }) => {
10
- const { id, softDeleted } = item;
11
- const newCurrData = [...currData];
12
- const newOtherData = [...otherData];
13
- const currListIndex = newCurrData.findIndex((datum) => datum.id === id);
14
- const otherListIndex = newOtherData.findIndex((datum) => datum.id === id);
15
- const isCurrDataItemOriginalList = otherListIndex === -1 || otherListIndex !== -1 && softDeleted;
16
- let currRemoveAtIndex = -1;
17
- if (currListIndex !== -1) {
18
- if (isCurrDataItemOriginalList) {
19
- if (currWithSoftDelete)
20
- newCurrData[currListIndex].softDeleted = true;
21
- else
22
- currRemoveAtIndex = currListIndex;
23
- } else {
24
- currRemoveAtIndex = currListIndex;
25
- }
26
- }
27
- if (currRemoveAtIndex !== -1)
28
- newCurrData.splice(currRemoveAtIndex, 1);
29
- const shouldAppendToOtherData = otherListIndex === -1;
30
- if (shouldAppendToOtherData)
31
- newOtherData.push({ ...item, softDeleted: false });
32
- else
33
- newOtherData[otherListIndex].softDeleted = false;
34
- return {
35
- newCurrData,
36
- newOtherData
37
- };
38
- };
39
5
  const useHandleMoveSelection = ({ isDestinationPanel }) => {
40
- const currData = usePropsStore((state) => isDestinationPanel ? state.destinationData : state.sourceData);
41
- const currWithSoftDelete = usePropsStore(
42
- (state) => isDestinationPanel ? state.destinationWithSoftDelete : state.sourceWithSoftDelete
43
- );
44
- const currOnChange = usePropsStore(
45
- (state) => isDestinationPanel ? state.onDestinationChange : state.onSourceChange
46
- );
47
6
  const currOnRemove = usePropsStore(
48
7
  (state) => isDestinationPanel ? state.onDestinationRemove : state.onSourceRemove
49
8
  );
50
- const onSelectionChange = usePropsStore(
51
- (state) => isDestinationPanel ? state.onDestinationSelectionChange : state.onSourceSelectionChange
9
+ const currSoftDeletedItems = usePropsStore(
10
+ (state) => isDestinationPanel ? state.destinationSoftDeletedItems : state.sourceSoftDeletedItems
11
+ );
12
+ const currOnSoftDelete = usePropsStore(
13
+ (state) => isDestinationPanel ? state.onDestinationSoftDelete : state.onSourceSoftDelete
14
+ );
15
+ const otherSoftDeletedItems = usePropsStore(
16
+ (state) => isDestinationPanel ? state.sourceSoftDeletedItems : state.destinationSoftDeletedItems
17
+ );
18
+ const otherOnSoftDelete = usePropsStore(
19
+ (state) => isDestinationPanel ? state.onSourceSoftDelete : state.onDestinationSoftDelete
52
20
  );
53
- const otherData = usePropsStore((state) => isDestinationPanel ? state.sourceData : state.destinationData);
54
- const otherPanelOnChange = usePropsStore(
55
- (state) => isDestinationPanel ? state.onSourceChange : state.onDestinationChange
21
+ const currSelectionMap = useInternalStore(
22
+ (store) => isDestinationPanel ? store.destinationSelectionArray : store.sourceSelectionArray
23
+ );
24
+ const currOnSelectionChange = usePropsStore(
25
+ (state) => isDestinationPanel ? state.onDestinationSelectionChange : state.onSourceSelectionChange
56
26
  );
57
27
  const otherPanelOnAdd = usePropsStore((state) => isDestinationPanel ? state.onSourceAdd : state.onDestinationAdd);
58
28
  const destinationSelectionArray = useInternalStore((store) => store.destinationSelectionItemArray);
59
29
  const sourceSelectionArray = useInternalStore((store) => store.sourceSelectionItemArray);
60
30
  const selectedItems = isDestinationPanel ? destinationSelectionArray : sourceSelectionArray;
31
+ const mutableSelectedItems = useMakeMutable(selectedItems);
32
+ const mutableCurrSelectionMap = useMakeMutable(currSelectionMap);
33
+ const mutableCurrOnSelectionChange = useMakeMutable(currOnSelectionChange);
34
+ const mutableCurrOnRemove = useMakeMutable(currOnRemove);
35
+ const mutableOtherOnAdd = useMakeMutable(otherPanelOnAdd);
36
+ const mutableCurrOnSoftDelete = useMakeMutable(currOnSoftDelete);
37
+ const mutableOtherOnSoftDelete = useMakeMutable(otherOnSoftDelete);
38
+ const mutableCurrSoftDeletedItems = useMakeMutable(currSoftDeletedItems);
39
+ const mutableOtherSoftDeletedItems = useMakeMutable(otherSoftDeletedItems);
61
40
  const moveSelection = React2.useCallback(
62
41
  (event) => {
63
42
  event.preventDefault();
64
43
  event.stopPropagation();
65
- let iteratedNewCurrData = [...currData];
66
- let iteratedNewOtherData = [...otherData];
67
- selectedItems.forEach((datum) => {
68
- const { newCurrData, newOtherData } = getNewDatasWithItemMoved({
69
- item: datum,
70
- currData: iteratedNewCurrData,
71
- currWithSoftDelete,
72
- otherData: iteratedNewOtherData
73
- });
74
- iteratedNewCurrData = newCurrData;
75
- iteratedNewOtherData = newOtherData;
44
+ mutableCurrOnRemove.current(mutableSelectedItems.current, { event });
45
+ mutableOtherOnAdd.current(mutableSelectedItems.current, { event });
46
+ const currSoftDeletedMap = {};
47
+ const otherSoftDeletedMap = {};
48
+ mutableCurrSelectionMap.current.forEach((id) => {
49
+ currSoftDeletedMap[id] = true;
50
+ otherSoftDeletedMap[id] = false;
76
51
  });
77
- currOnChange(iteratedNewCurrData, { event, selectedItems });
78
- currOnRemove(selectedItems, { event });
79
- otherPanelOnChange(iteratedNewOtherData, { event, selectedItems });
80
- otherPanelOnAdd(selectedItems, { event });
81
- onSelectionChange({}, { event });
52
+ mutableCurrOnSoftDelete.current({ ...mutableCurrSoftDeletedItems.current, ...currSoftDeletedMap }, { event });
53
+ mutableOtherOnSoftDelete.current({ ...mutableOtherSoftDeletedItems.current, ...otherSoftDeletedMap }, { event });
54
+ mutableCurrOnSelectionChange.current({}, { event });
55
+ },
56
+ [
57
+ mutableCurrSelectionMap,
58
+ mutableCurrOnRemove,
59
+ mutableCurrOnSelectionChange,
60
+ mutableCurrOnSoftDelete,
61
+ mutableCurrSoftDeletedItems,
62
+ mutableOtherOnAdd,
63
+ mutableOtherOnSoftDelete,
64
+ mutableOtherSoftDeletedItems,
65
+ mutableSelectedItems
66
+ ]
67
+ );
68
+ const mutableMoveSelection = useMakeMutable(moveSelection);
69
+ return React2.useMemo(() => ({ moveSelection: mutableMoveSelection.current }), [mutableMoveSelection]);
70
+ };
71
+ const useHandleMoveItem = ({ datum, datumInternalMeta, isDestinationPanel }) => {
72
+ const currSoftDeletedItems = usePropsStore(
73
+ (state) => isDestinationPanel ? state.destinationSoftDeletedItems : state.sourceSoftDeletedItems
74
+ );
75
+ const otherSoftDeletedItems = usePropsStore(
76
+ (state) => isDestinationPanel ? state.sourceSoftDeletedItems : state.destinationSoftDeletedItems
77
+ );
78
+ const currOnSoftDelete = usePropsStore(
79
+ (state) => isDestinationPanel ? state.onDestinationSoftDelete : state.onSourceSoftDelete
80
+ );
81
+ const otherOnSoftDelete = usePropsStore(
82
+ (state) => isDestinationPanel ? state.onSourceSoftDelete : state.onDestinationSoftDelete
83
+ );
84
+ const currOnRemove = usePropsStore(
85
+ (state) => isDestinationPanel ? state.onDestinationRemove : state.onSourceRemove
86
+ );
87
+ const otherPanelOnAdd = usePropsStore((state) => isDestinationPanel ? state.onSourceAdd : state.onDestinationAdd);
88
+ const mutableCurrOnRemove = useMakeMutable(currOnRemove);
89
+ const mutableOtherOnAdd = useMakeMutable(otherPanelOnAdd);
90
+ const mutableCurrOnSoftDelete = useMakeMutable(currOnSoftDelete);
91
+ const mutableOtherOnSoftDelete = useMakeMutable(otherOnSoftDelete);
92
+ const mutableCurrSoftDeletedItems = useMakeMutable(currSoftDeletedItems);
93
+ const mutableOtherSoftDeletedItems = useMakeMutable(otherSoftDeletedItems);
94
+ const moveItem = React2.useCallback(
95
+ (event) => {
96
+ event.preventDefault();
97
+ event.stopPropagation();
98
+ mutableCurrOnRemove.current([datum], { event });
99
+ mutableOtherOnAdd.current([datum], { event });
100
+ mutableCurrOnSoftDelete.current(
101
+ { ...mutableCurrSoftDeletedItems.current, [datumInternalMeta.hydratedId]: true },
102
+ { event }
103
+ );
104
+ mutableOtherOnSoftDelete.current(
105
+ { ...mutableOtherSoftDeletedItems.current, [datumInternalMeta.hydratedId]: false },
106
+ { event }
107
+ );
82
108
  },
83
109
  [
84
- currData,
85
- otherData,
86
- selectedItems,
87
- currOnChange,
88
- currOnRemove,
89
- otherPanelOnChange,
90
- otherPanelOnAdd,
91
- onSelectionChange,
92
- currWithSoftDelete
110
+ datum,
111
+ datumInternalMeta.hydratedId,
112
+ mutableCurrOnRemove,
113
+ mutableCurrOnSoftDelete,
114
+ mutableCurrSoftDeletedItems,
115
+ mutableOtherOnAdd,
116
+ mutableOtherOnSoftDelete,
117
+ mutableOtherSoftDeletedItems
93
118
  ]
94
119
  );
95
- return React2.useMemo(() => ({ moveSelection }), [moveSelection]);
120
+ return moveItem;
96
121
  };
97
122
  export {
98
- getNewDatasWithItemMoved,
123
+ useHandleMoveItem,
99
124
  useHandleMoveSelection
100
125
  };
101
126
  //# sourceMappingURL=itemMovementHelpers.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/itemMovementHelpers.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport React from 'react';\nimport { type DSButtonT } from '@elliemae/ds-button';\nimport { type DSShuttleV2T } from '../react-desc-prop-types';\nimport { usePropsStore, useInternalStore } from './useStore';\n\nexport const getNewDatasWithItemMoved = ({\n item,\n currData,\n currWithSoftDelete,\n otherData,\n}: {\n item: DSShuttleV2T.Datum;\n currData: DSShuttleV2T.Datum[];\n currWithSoftDelete: boolean;\n otherData: DSShuttleV2T.Datum[];\n}) => {\n const { id, softDeleted } = item;\n const newCurrData = [...currData];\n const newOtherData = [...otherData];\n const currListIndex = newCurrData.findIndex((datum) => datum.id === id);\n const otherListIndex = newOtherData.findIndex((datum) => datum.id === id);\n const isCurrDataItemOriginalList = otherListIndex === -1 || (otherListIndex !== -1 && softDeleted);\n let currRemoveAtIndex = -1;\n /**\n * current data management\n * soft-deletion\n * if enabled\n * hard deletion\n * if not enabled\n * or\n * if we are \"moving back\" an item\n */\n if (currListIndex !== -1) {\n if (isCurrDataItemOriginalList) {\n // if curr data is the item's original list\n // soft-delete if users asks for soft-deletion\n if (currWithSoftDelete) newCurrData[currListIndex].softDeleted = true;\n // else hard delete\n else currRemoveAtIndex = currListIndex;\n } else {\n // else hard delete because we are moving back a soft-deleted element\n currRemoveAtIndex = currListIndex;\n }\n }\n // if hard-deletion was configured to be carried out -> hard delete in curr-data\n if (currRemoveAtIndex !== -1) newCurrData.splice(currRemoveAtIndex, 1);\n\n // we append to other data when it was not already present\n const shouldAppendToOtherData = otherListIndex === -1;\n // in the new list we don't treat the item as soft-deleted\n if (shouldAppendToOtherData) newOtherData.push({ ...item, softDeleted: false });\n // if it is already present we remove the soft-deleted status instead\n else newOtherData[otherListIndex].softDeleted = false;\n\n return {\n newCurrData,\n newOtherData,\n };\n};\nexport const useHandleMoveSelection = ({ isDestinationPanel }: { isDestinationPanel: boolean }) => {\n const currData = usePropsStore((state) => (isDestinationPanel ? state.destinationData : state.sourceData));\n const currWithSoftDelete = usePropsStore((state) =>\n isDestinationPanel ? state.destinationWithSoftDelete : state.sourceWithSoftDelete,\n );\n const currOnChange = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationChange : state.onSourceChange,\n );\n const currOnRemove = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationRemove : state.onSourceRemove,\n );\n\n const onSelectionChange = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationSelectionChange : state.onSourceSelectionChange,\n );\n\n const otherData = usePropsStore((state) => (isDestinationPanel ? state.sourceData : state.destinationData));\n const otherPanelOnChange = usePropsStore((state) =>\n isDestinationPanel ? state.onSourceChange : state.onDestinationChange,\n );\n const otherPanelOnAdd = usePropsStore((state) => (isDestinationPanel ? state.onSourceAdd : state.onDestinationAdd));\n const destinationSelectionArray = useInternalStore((store) => store.destinationSelectionItemArray);\n const sourceSelectionArray = useInternalStore((store) => store.sourceSelectionItemArray);\n const selectedItems = isDestinationPanel ? destinationSelectionArray : sourceSelectionArray;\n\n const moveSelection = React.useCallback(\n (event: Parameters<Required<DSButtonT.Props>['onClick']>[0]) => {\n event.preventDefault();\n event.stopPropagation();\n let iteratedNewCurrData = [...currData];\n let iteratedNewOtherData = [...otherData];\n selectedItems.forEach((datum) => {\n const { newCurrData, newOtherData } = getNewDatasWithItemMoved({\n item: datum,\n currData: iteratedNewCurrData,\n currWithSoftDelete,\n otherData: iteratedNewOtherData,\n });\n iteratedNewCurrData = newCurrData;\n iteratedNewOtherData = newOtherData;\n });\n currOnChange(iteratedNewCurrData, { event, selectedItems });\n currOnRemove(selectedItems, { event });\n\n otherPanelOnChange(iteratedNewOtherData, { event, selectedItems });\n otherPanelOnAdd(selectedItems, { event });\n onSelectionChange({}, { event });\n },\n [\n currData,\n otherData,\n selectedItems,\n currOnChange,\n currOnRemove,\n otherPanelOnChange,\n otherPanelOnAdd,\n onSelectionChange,\n currWithSoftDelete,\n ],\n );\n return React.useMemo(() => ({ moveSelection }), [moveSelection]);\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACEvB,OAAOA,YAAW;AAGlB,SAAS,eAAe,wBAAwB;AAEzC,MAAM,2BAA2B,CAAC;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAKM;AACJ,QAAM,EAAE,IAAI,YAAY,IAAI;AAC5B,QAAM,cAAc,CAAC,GAAG,QAAQ;AAChC,QAAM,eAAe,CAAC,GAAG,SAAS;AAClC,QAAM,gBAAgB,YAAY,UAAU,CAAC,UAAU,MAAM,OAAO,EAAE;AACtE,QAAM,iBAAiB,aAAa,UAAU,CAAC,UAAU,MAAM,OAAO,EAAE;AACxE,QAAM,6BAA6B,mBAAmB,MAAO,mBAAmB,MAAM;AACtF,MAAI,oBAAoB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A4B;AAEvE,QAAM,gBAAgBA,OAAM;AAAA,IAC1B,CAAC,UAA+D;AAC9D,YAAM,eAAe;AACrB,YAAM,gBAAgB;AACtB,UAAI,sBAAsB,CAAC,GAAG,QAAQ;AACtC,UAAI,uBAAuB,CAAC,GAAG,SAAS;AACxC,oBAAc,QAAQ,CAAC,UAAU;AAC/B,cAAM,EAAE,aAAa,aAAa,IAAI,yBAAyB;AAAA,UAC7D,MAAM;AAAA,UACN,UAAU;AAAA,UACV;AAAA,UACA,WAAW;AAAA,QACb,CAAC;AACD,8BAAsB;AACtB,+BAAuB;AAAA,MACzB,CAAC;AACD,mBAAa,qBAAqB,EAAE,OAAO,cAAc,CAAC;AAC1D,mBAAa,eAAe,EAAE,MAAM,CAAC;AAErC,yBAAmB,sBAAsB,EAAE,OAAO,cAAc,CAAC;AACjE,sBAAgB,eAAe,EAAE,MAAM,CAAC;AACxC,wBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC;AAAA,IACjC;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,SAAOA,OAAM,QAAQ,OAAO,EAAE,cAAc,IAAI,CAAC,aAAa,CAAC;AACjE;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport React from 'react';\nimport { useMakeMutable } from '@elliemae/ds-utilities';\nimport { type DSButtonT } from '@elliemae/ds-button-v2';\nimport { type DSShuttleV2T } from '../react-desc-prop-types';\nimport { usePropsStore, useInternalStore } from './useStore';\n\nexport const useHandleMoveSelection = ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) => {\n const currOnRemove = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationRemove : state.onSourceRemove,\n );\n const currSoftDeletedItems = usePropsStore((state) =>\n isDestinationPanel ? state.destinationSoftDeletedItems : state.sourceSoftDeletedItems,\n );\n const currOnSoftDelete = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationSoftDelete : state.onSourceSoftDelete,\n );\n const otherSoftDeletedItems = usePropsStore((state) =>\n isDestinationPanel ? state.sourceSoftDeletedItems : state.destinationSoftDeletedItems,\n );\n const otherOnSoftDelete = usePropsStore((state) =>\n isDestinationPanel ? state.onSourceSoftDelete : state.onDestinationSoftDelete,\n );\n const currSelectionMap = useInternalStore((store) =>\n isDestinationPanel ? store.destinationSelectionArray : store.sourceSelectionArray,\n );\n const currOnSelectionChange = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationSelectionChange : state.onSourceSelectionChange,\n );\n\n const otherPanelOnAdd = usePropsStore((state) => (isDestinationPanel ? state.onSourceAdd : state.onDestinationAdd));\n\n const destinationSelectionArray = useInternalStore((store) => store.destinationSelectionItemArray);\n const sourceSelectionArray = useInternalStore((store) => store.sourceSelectionItemArray);\n const selectedItems = isDestinationPanel ? destinationSelectionArray : sourceSelectionArray;\n\n const mutableSelectedItems = useMakeMutable(selectedItems);\n const mutableCurrSelectionMap = useMakeMutable(currSelectionMap);\n const mutableCurrOnSelectionChange = useMakeMutable(currOnSelectionChange);\n const mutableCurrOnRemove = useMakeMutable(currOnRemove);\n const mutableOtherOnAdd = useMakeMutable(otherPanelOnAdd);\n const mutableCurrOnSoftDelete = useMakeMutable(currOnSoftDelete);\n const mutableOtherOnSoftDelete = useMakeMutable(otherOnSoftDelete);\n const mutableCurrSoftDeletedItems = useMakeMutable(currSoftDeletedItems);\n const mutableOtherSoftDeletedItems = useMakeMutable(otherSoftDeletedItems);\n\n const moveSelection = React.useCallback(\n (event: Parameters<Required<DSButtonT.Props>['onClick']>[0]) => {\n event.preventDefault();\n event.stopPropagation();\n // movement\n mutableCurrOnRemove.current(mutableSelectedItems.current, { event });\n mutableOtherOnAdd.current(mutableSelectedItems.current, { event });\n // soft delete\n const currSoftDeletedMap: DSShuttleV2T.SoftDeletedMap = {};\n const otherSoftDeletedMap: DSShuttleV2T.SoftDeletedMap = {};\n mutableCurrSelectionMap.current.forEach((id) => {\n currSoftDeletedMap[id] = true;\n otherSoftDeletedMap[id] = false;\n });\n mutableCurrOnSoftDelete.current({ ...mutableCurrSoftDeletedItems.current, ...currSoftDeletedMap }, { event });\n mutableOtherOnSoftDelete.current({ ...mutableOtherSoftDeletedItems.current, ...otherSoftDeletedMap }, { event });\n // cleanup\n mutableCurrOnSelectionChange.current({}, { event });\n },\n [\n mutableCurrSelectionMap,\n mutableCurrOnRemove,\n mutableCurrOnSelectionChange,\n mutableCurrOnSoftDelete,\n mutableCurrSoftDeletedItems,\n mutableOtherOnAdd,\n mutableOtherOnSoftDelete,\n mutableOtherSoftDeletedItems,\n mutableSelectedItems,\n ],\n );\n // optimization ...\n const mutableMoveSelection = useMakeMutable(moveSelection);\n return React.useMemo(() => ({ moveSelection: mutableMoveSelection.current }), [mutableMoveSelection]);\n};\n\nexport const useHandleMoveItem = ({ datum, datumInternalMeta, isDestinationPanel }: DSShuttleV2T.ItemMeta) => {\n const currSoftDeletedItems = usePropsStore((state) =>\n isDestinationPanel ? state.destinationSoftDeletedItems : state.sourceSoftDeletedItems,\n );\n const otherSoftDeletedItems = usePropsStore((state) =>\n isDestinationPanel ? state.sourceSoftDeletedItems : state.destinationSoftDeletedItems,\n );\n const currOnSoftDelete = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationSoftDelete : state.onSourceSoftDelete,\n );\n const otherOnSoftDelete = usePropsStore((state) =>\n isDestinationPanel ? state.onSourceSoftDelete : state.onDestinationSoftDelete,\n );\n\n const currOnRemove = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationRemove : state.onSourceRemove,\n );\n const otherPanelOnAdd = usePropsStore((state) => (isDestinationPanel ? state.onSourceAdd : state.onDestinationAdd));\n\n const mutableCurrOnRemove = useMakeMutable(currOnRemove);\n const mutableOtherOnAdd = useMakeMutable(otherPanelOnAdd);\n const mutableCurrOnSoftDelete = useMakeMutable(currOnSoftDelete);\n const mutableOtherOnSoftDelete = useMakeMutable(otherOnSoftDelete);\n const mutableCurrSoftDeletedItems = useMakeMutable(currSoftDeletedItems);\n const mutableOtherSoftDeletedItems = useMakeMutable(otherSoftDeletedItems);\n\n const moveItem = React.useCallback(\n (event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>) => {\n event.preventDefault();\n event.stopPropagation();\n mutableCurrOnRemove.current([datum], { event });\n mutableOtherOnAdd.current([datum], { event });\n mutableCurrOnSoftDelete.current(\n { ...mutableCurrSoftDeletedItems.current, [datumInternalMeta.hydratedId]: true },\n { event },\n );\n mutableOtherOnSoftDelete.current(\n { ...mutableOtherSoftDeletedItems.current, [datumInternalMeta.hydratedId]: false },\n { event },\n );\n },\n [\n datum,\n datumInternalMeta.hydratedId,\n mutableCurrOnRemove,\n mutableCurrOnSoftDelete,\n mutableCurrSoftDeletedItems,\n mutableOtherOnAdd,\n mutableOtherOnSoftDelete,\n mutableOtherSoftDeletedItems,\n ],\n );\n return moveItem;\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACEvB,OAAOA,YAAW;AAClB,SAAS,sBAAsB;AAG/B,SAAS,eAAe,wBAAwB;AAEzC,MAAM,yBAAyB,CAAC,EAAE,mBAAmB,MAAkC;AAC5F,QAAM,eAAe;AAAA,IAAc,CAAC,UAClC,qBAAqB,MAAM,sBAAsB,MAAM;AAAA,EACzD;AACA,QAAM,uBAAuB;AAAA,IAAc,CAAC,UAC1C,qBAAqB,MAAM,8BAA8B,MAAM;AAAA,EACjE;AACA,QAAM,mBAAmB;AAAA,IAAc,CAAC,UACtC,qBAAqB,MAAM,0BAA0B,MAAM;AAAA,EAC7D;AACA,QAAM,wBAAwB;AAAA,IAAc,CAAC,UAC3C,qBAAqB,MAAM,yBAAyB,MAAM;AAAA,EAC5D;AACA,QAAM,oBAAoB;AAAA,IAAc,CAAC,UACvC,qBAAqB,MAAM,qBAAqB,MAAM;AAAA,EACxD;AACA,QAAM,mB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C9C,wBAAkB,QAAQ,CAAC,KAAK,GAAG,EAAE,MAAM,CAAC;AAC5C,8BAAwB;AAAA,QACtB,EAAE,GAAG,4BAA4B,SAAS,CAAC,kBAAkB,aAAa,KAAK;AAAA,QAC/E,EAAE,MAAM;AAAA,MACV;AACA,+BAAyB;AAAA,QACvB,EAAE,GAAG,6BAA6B,SAAS,CAAC,kBAAkB,aAAa,MAAM;AAAA,QACjF,EAAE,MAAM;AAAA,MACV;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA,kBAAkB;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;",
6
6
  "names": ["React"]
7
7
  }
@@ -1,41 +1,43 @@
1
1
  import * as React from "react";
2
2
  import { useMemo } from "react";
3
- const getDatumFlags = (datum) => ({
4
- selectionPrevented: Boolean(datum.softDeleted || datum.preventMove),
5
- withActions: !datum.softDeleted,
6
- withMoveBtn: !datum.softDeleted && !datum.preventMove,
7
- withDrilldownBtn: !datum.softDeleted && !datum.preventDrilldown
8
- });
9
- const configureDestination = ({ destinationData, destinationSelectedItems }) => {
3
+ const configureDestination = ({
4
+ destinationData,
5
+ destinationSelectedItems,
6
+ destinationSoftDeletedItems,
7
+ getId
8
+ }) => {
10
9
  const destinationSelectedItemsMap = {};
11
- const destinationSelectionItemArray = [];
12
10
  const destinationSelectionArray = [];
11
+ const destinationSelectionableDataIds = [];
12
+ const destinationSelectionItemArray = [];
13
13
  const destinationConfiguredData = [];
14
14
  const destinationSelectionableData = [];
15
- const destinationSelectionableDataIds = [];
16
15
  destinationData.forEach((datum, i) => {
16
+ const hydratedId = getId(datum);
17
17
  let isSelected = false;
18
- if (destinationSelectedItems[datum.id] === true) {
18
+ if (destinationSelectedItems[hydratedId] === true) {
19
19
  destinationSelectionItemArray.push(datum);
20
- destinationSelectionArray.push(datum.id);
20
+ destinationSelectionArray.push(hydratedId);
21
21
  isSelected = true;
22
22
  }
23
- destinationSelectedItemsMap[datum.id] = { datum, index: i };
23
+ let softDeleted = false;
24
+ if (destinationSoftDeletedItems[hydratedId] === true) {
25
+ softDeleted = true;
26
+ }
27
+ destinationSelectedItemsMap[hydratedId] = { datum, index: i };
24
28
  const configuredItem = {
29
+ hydratedId,
25
30
  isSelected,
26
- ...getDatumFlags(datum),
31
+ softDeleted,
27
32
  original: datum,
28
33
  localIndex: i,
29
34
  isFirst: i === 0,
30
- isLast: i === destinationData.length - 1,
31
- uid: datum.id,
32
- depth: 0,
33
- realIndex: datum.id
35
+ isLast: i === destinationData.length - 1
34
36
  };
35
37
  destinationConfiguredData.push(configuredItem);
36
38
  if (!datum.preventMove) {
37
39
  destinationSelectionableData.push(configuredItem);
38
- destinationSelectionableDataIds.push(datum.id);
40
+ destinationSelectionableDataIds.push(hydratedId);
39
41
  }
40
42
  });
41
43
  const destinationHasMultipleSelectedItems = destinationSelectionArray.length >= 1;
@@ -51,36 +53,39 @@ const configureDestination = ({ destinationData, destinationSelectedItems }) =>
51
53
  destinationSelectionableIds
52
54
  };
53
55
  };
54
- const configureSource = ({ sourceData, sourceSelectedItems }) => {
56
+ const configureSource = ({ sourceData, sourceSelectedItems, sourceSoftDeletedItems, getId }) => {
55
57
  const sourceSelectedItemsMap = {};
56
- const sourceSelectionItemArray = [];
57
58
  const sourceSelectionArray = [];
59
+ const sourceSelectionableDataIds = [];
60
+ const sourceSelectionItemArray = [];
58
61
  const sourceConfiguredData = [];
59
62
  const sourceSelectionableData = [];
60
- const sourceSelectionableDataIds = [];
61
63
  sourceData.forEach((datum, i) => {
64
+ const hydratedId = getId(datum);
62
65
  let isSelected = false;
63
- if (sourceSelectedItems[datum.id] === true) {
66
+ if (sourceSelectedItems[hydratedId] === true) {
64
67
  sourceSelectionItemArray.push(datum);
65
- sourceSelectionArray.push(datum.id);
68
+ sourceSelectionArray.push(hydratedId);
66
69
  isSelected = true;
67
70
  }
68
- sourceSelectedItemsMap[datum.id] = { datum, index: i };
71
+ let softDeleted = false;
72
+ if (sourceSoftDeletedItems[hydratedId] === true) {
73
+ softDeleted = true;
74
+ }
75
+ sourceSelectedItemsMap[hydratedId] = { datum, index: i };
69
76
  const configuredItem = {
77
+ hydratedId,
70
78
  isSelected,
71
- ...getDatumFlags(datum),
79
+ softDeleted,
72
80
  original: datum,
73
81
  localIndex: i,
74
82
  isFirst: i === 0,
75
- isLast: i === sourceData.length - 1,
76
- uid: datum.id,
77
- depth: 0,
78
- realIndex: datum.id
83
+ isLast: i === sourceData.length - 1
79
84
  };
80
85
  sourceConfiguredData.push(configuredItem);
81
86
  if (!datum.preventMove) {
82
87
  sourceSelectionableData.push(configuredItem);
83
- sourceSelectionableDataIds.push(datum.id);
88
+ sourceSelectionableDataIds.push(hydratedId);
84
89
  }
85
90
  });
86
91
  const sourceHasMultipleSelectedItems = sourceSelectionArray.length >= 1;
@@ -97,13 +102,29 @@ const configureSource = ({ sourceData, sourceSelectedItems }) => {
97
102
  };
98
103
  };
99
104
  const useDataStructure = (propsFromUser) => {
100
- const { sourceData, sourceSelectedItems, destinationData, destinationSelectedItems } = propsFromUser;
105
+ const {
106
+ sourceData,
107
+ sourceSelectedItems,
108
+ destinationData,
109
+ destinationSelectedItems,
110
+ getId,
111
+ sourceSoftDeletedItems,
112
+ destinationSoftDeletedItems
113
+ } = propsFromUser;
101
114
  return useMemo(
102
115
  () => ({
103
- ...configureSource({ sourceData, sourceSelectedItems }),
104
- ...configureDestination({ destinationData, destinationSelectedItems })
116
+ ...configureSource({ sourceData, sourceSelectedItems, sourceSoftDeletedItems, getId }),
117
+ ...configureDestination({ destinationData, destinationSelectedItems, destinationSoftDeletedItems, getId })
105
118
  }),
106
- [destinationData, destinationSelectedItems, sourceData, sourceSelectedItems]
119
+ [
120
+ sourceData,
121
+ sourceSelectedItems,
122
+ sourceSoftDeletedItems,
123
+ getId,
124
+ destinationData,
125
+ destinationSelectedItems,
126
+ destinationSoftDeletedItems
127
+ ]
107
128
  );
108
129
  };
109
130
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/config/useAutoCalculated/useDataStructure.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// import { useRef } from 'react';\n// import { useVirtual } from 'react-virtual';\nimport { useMemo } from 'react';\nimport { type DSShuttleV2T } from '../../react-desc-prop-types';\n\nconst getDatumFlags = (datum: DSShuttleV2T.Datum) => ({\n selectionPrevented: Boolean(datum.softDeleted || datum.preventMove),\n withActions: !datum.softDeleted,\n withMoveBtn: !datum.softDeleted && !datum.preventMove,\n withDrilldownBtn: !datum.softDeleted && !datum.preventDrilldown,\n});\n\ntype ConfigureDestinationConfig = {\n destinationData: DSShuttleV2T.Datum[];\n destinationSelectedItems: Record<DSShuttleV2T.Datum['id'], boolean>;\n};\nconst configureDestination = ({ destinationData, destinationSelectedItems }: ConfigureDestinationConfig) => {\n const destinationSelectedItemsMap: Record<string, { datum: DSShuttleV2T.Datum; index: number }> = {};\n const destinationSelectionItemArray: DSShuttleV2T.Datum[] = [];\n const destinationSelectionArray: DSShuttleV2T.Datum['id'][] = [];\n const destinationConfiguredData: DSShuttleV2T.ConfiguredDatum[] = [];\n const destinationSelectionableData: DSShuttleV2T.ConfiguredDatum[] = [];\n const destinationSelectionableDataIds: DSShuttleV2T.Datum['id'][] = [];\n destinationData.forEach((datum, i) => {\n let isSelected = false;\n if (destinationSelectedItems[datum.id] === true) {\n destinationSelectionItemArray.push(datum);\n destinationSelectionArray.push(datum.id);\n isSelected = true;\n }\n destinationSelectedItemsMap[datum.id] = { datum, index: i };\n const configuredItem = {\n isSelected,\n ...getDatumFlags(datum),\n original: datum,\n localIndex: i,\n isFirst: i === 0,\n isLast: i === destinationData.length - 1,\n uid: datum.id,\n depth: 0,\n realIndex: datum.id,\n };\n destinationConfiguredData.push(configuredItem);\n if (!datum.preventMove) {\n destinationSelectionableData.push(configuredItem);\n destinationSelectionableDataIds.push(datum.id);\n }\n });\n const destinationHasMultipleSelectedItems = destinationSelectionArray.length >= 1;\n const destinationSelectionableIds = destinationSelectionableDataIds.join(' ');\n\n return {\n destinationSelectedItemsMap,\n destinationSelectionItemArray,\n destinationSelectionArray,\n destinationHasMultipleSelectedItems,\n destinationConfiguredData,\n destinationSelectionableData,\n destinationSelectionableDataIds,\n destinationSelectionableIds,\n };\n};\ntype ConfigureSourceConfig = {\n sourceData: DSShuttleV2T.Datum[];\n sourceSelectedItems: Record<DSShuttleV2T.Datum['id'], boolean>;\n};\n\nconst configureSource = ({ sourceData, sourceSelectedItems }: ConfigureSourceConfig) => {\n const sourceSelectedItemsMap: Record<string, { datum: DSShuttleV2T.Datum; index: number }> = {};\n const sourceSelectionItemArray: DSShuttleV2T.Datum[] = [];\n const sourceSelectionArray: DSShuttleV2T.Datum['id'][] = [];\n const sourceConfiguredData: DSShuttleV2T.ConfiguredDatum[] = [];\n const sourceSelectionableData: DSShuttleV2T.ConfiguredDatum[] = [];\n const sourceSelectionableDataIds: DSShuttleV2T.Datum['id'][] = [];\n sourceData.forEach((datum, i) => {\n let isSelected = false;\n if (sourceSelectedItems[datum.id] === true) {\n sourceSelectionItemArray.push(datum);\n sourceSelectionArray.push(datum.id);\n isSelected = true;\n }\n\n sourceSelectedItemsMap[datum.id] = { datum, index: i };\n const configuredItem = {\n isSelected,\n ...getDatumFlags(datum),\n original: datum,\n localIndex: i,\n isFirst: i === 0,\n isLast: i === sourceData.length - 1,\n // dnd\n uid: datum.id,\n depth: 0,\n realIndex: datum.id,\n };\n sourceConfiguredData.push(configuredItem);\n if (!datum.preventMove) {\n sourceSelectionableData.push(configuredItem);\n sourceSelectionableDataIds.push(datum.id);\n }\n });\n const sourceHasMultipleSelectedItems = sourceSelectionArray.length >= 1;\n const sourceSelectionableIds = sourceSelectionableDataIds.join(' ');\n return {\n sourceConfiguredData,\n sourceSelectedItemsMap,\n sourceSelectionItemArray,\n sourceSelectionArray,\n sourceHasMultipleSelectedItems,\n sourceSelectionableData,\n sourceSelectionableDataIds,\n sourceSelectionableIds,\n };\n};\n\nexport const useDataStructure = (propsFromUser: DSShuttleV2T.InternalProps) => {\n const { sourceData, sourceSelectedItems, destinationData, destinationSelectedItems } = propsFromUser;\n return useMemo(\n () => ({\n ...configureSource({ sourceData, sourceSelectedItems }),\n ...configureDestination({ destinationData, destinationSelectedItems }),\n }),\n [destinationData, destinationSelectedItems, sourceData, sourceSelectedItems],\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,eAAe;AAGxB,MAAM,gBAAgB,CAAC,WAA+B;AAAA,EACpD,oBAAoB,QAAQ,MAAM,eAAe,MAAM,WAAW;AAAA,EAClE,aAAa,CAAC,MAAM;AAAA,EACpB,aAAa,CAAC,MAAM,eAAe,CAAC,MAAM;AAAA,EAC1C,kBAAkB,CAAC,MAAM,eAAe,CAAC,MAAM;AACjD;AAMA,MAAM,uBAAuB,CAAC,EAAE,iBAAiB,yBAAyB,MAAkC;AAC1G,QAAM,8BAA4F,CAAC;AACnG,QAAM,gCAAsD,CAAC;AAC7D,QAAM,4BAAwD,CAAC;AAC/D,QAAM,4BAA4D,CAAC;AACnE,QAAM,+BAA+D,CAAC;AACtE,QAAM,kCAA8D,CAAC;AACrE,kBAAgB,QAAQ,CAAC,OAAO,MAAM;AACpC,QAAI,aAAa;AACjB,QAAI,yBAAyB,MAAM,QAAQ,MAAM;AAC/C,oCAA8B,KAAK,KAAK;AACxC,gCAA0B,KAAK,MAAM,EAAE;AACvC,mBAAa;AAAA,IACf;AACA,gCAA4B,MAAM,MAAM,EAAE,OAAO,OAAO,EAAE;AAC1D,UAAM,iBAAiB;AAAA,MACrB;AAAA,MACA,GAAG,cAAc,KAAK;AAAA,MACtB,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,SAAS,MAAM;AAAA,MACf,QAAQ,MAAM,gBAAgB,SAAS;AAAA,MACvC,KAAK,MAAM;AAAA,MACX,OAAO;AAAA,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AM,yBAAyB,2BAA2B,KAAK,GAAG;AAClE,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,MAAM,mBAAmB,CAAC,kBAA8C;AAC7E,QAAM,EAAE,YAAY,qBAAqB,iBAAiB,yBAAyB,IAAI;AACvF,SAAO;AAAA,IACL,OAAO;AAAA,MACL,GAAG,gBAAgB,EAAE,YAAY,oBAAoB,CAAC;AAAA,MACtD,GAAG,qBAAqB,EAAE,iBAAiB,yBAAyB,CAAC;AAAA,IACvE;AAAA,IACA,CAAC,iBAAiB,0BAA0B,YAAY,mBAAmB;AAAA,EAC7E;AACF;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// import { useRef } from 'react';\n// import { useVirtual } from 'react-virtual';\nimport { useMemo } from 'react';\nimport { type DSShuttleV2T } from '../../react-desc-prop-types';\n\ntype ConfigureDestinationConfig = {\n destinationData: DSShuttleV2T.Datum[];\n destinationSelectedItems: DSShuttleV2T.SelectionMap;\n destinationSoftDeletedItems: DSShuttleV2T.SoftDeletedMap;\n getId: DSShuttleV2T.PrimaryKeyHydraters['getId'];\n};\nconst configureDestination = ({\n destinationData,\n destinationSelectedItems,\n destinationSoftDeletedItems,\n getId,\n}: ConfigureDestinationConfig) => {\n const destinationSelectedItemsMap: Record<string, { datum: DSShuttleV2T.Datum; index: number }> = {};\n const destinationSelectionArray: DSShuttleV2T.PrimaryKeyHydratables['id'][] = [];\n const destinationSelectionableDataIds: DSShuttleV2T.PrimaryKeyHydratables['id'][] = [];\n\n const destinationSelectionItemArray: DSShuttleV2T.Datum[] = [];\n const destinationConfiguredData: DSShuttleV2T.ConfiguredDatum[] = [];\n const destinationSelectionableData: DSShuttleV2T.ConfiguredDatum[] = [];\n\n destinationData.forEach((datum, i) => {\n const hydratedId = getId(datum);\n let isSelected = false;\n if (destinationSelectedItems[hydratedId] === true) {\n destinationSelectionItemArray.push(datum);\n destinationSelectionArray.push(hydratedId);\n isSelected = true;\n }\n let softDeleted = false;\n if (destinationSoftDeletedItems[hydratedId] === true) {\n softDeleted = true;\n }\n destinationSelectedItemsMap[hydratedId] = { datum, index: i };\n const configuredItem = {\n hydratedId,\n isSelected,\n softDeleted,\n original: datum,\n localIndex: i,\n isFirst: i === 0,\n isLast: i === destinationData.length - 1,\n } as const;\n destinationConfiguredData.push(configuredItem);\n if (!datum.preventMove) {\n destinationSelectionableData.push(configuredItem);\n destinationSelectionableDataIds.push(hydratedId);\n }\n });\n const destinationHasMultipleSelectedItems = destinationSelectionArray.length >= 1;\n const destinationSelectionableIds = destinationSelectionableDataIds.join(' ');\n\n return {\n destinationSelectedItemsMap,\n destinationSelectionItemArray,\n destinationSelectionArray,\n destinationHasMultipleSelectedItems,\n destinationConfiguredData,\n destinationSelectionableData,\n destinationSelectionableDataIds,\n destinationSelectionableIds,\n };\n};\ntype ConfigureSourceConfig = {\n sourceData: DSShuttleV2T.Datum[];\n sourceSelectedItems: DSShuttleV2T.SelectionMap;\n sourceSoftDeletedItems: DSShuttleV2T.SoftDeletedMap;\n getId: DSShuttleV2T.PrimaryKeyHydraters['getId'];\n};\n\nconst configureSource = ({ sourceData, sourceSelectedItems, sourceSoftDeletedItems, getId }: ConfigureSourceConfig) => {\n const sourceSelectedItemsMap: Record<string, { datum: DSShuttleV2T.Datum; index: number }> = {};\n const sourceSelectionArray: DSShuttleV2T.PrimaryKeyHydratables['id'][] = [];\n const sourceSelectionableDataIds: DSShuttleV2T.PrimaryKeyHydratables['id'][] = [];\n\n const sourceSelectionItemArray: DSShuttleV2T.Datum[] = [];\n const sourceConfiguredData: DSShuttleV2T.ConfiguredDatum[] = [];\n const sourceSelectionableData: DSShuttleV2T.ConfiguredDatum[] = [];\n sourceData.forEach((datum, i) => {\n const hydratedId = getId(datum);\n let isSelected = false;\n if (sourceSelectedItems[hydratedId] === true) {\n sourceSelectionItemArray.push(datum);\n sourceSelectionArray.push(hydratedId);\n isSelected = true;\n }\n let softDeleted = false;\n if (sourceSoftDeletedItems[hydratedId] === true) {\n softDeleted = true;\n }\n\n sourceSelectedItemsMap[hydratedId] = { datum, index: i };\n const configuredItem = {\n hydratedId,\n isSelected,\n softDeleted,\n original: datum,\n localIndex: i,\n isFirst: i === 0,\n isLast: i === sourceData.length - 1,\n } as const;\n sourceConfiguredData.push(configuredItem);\n if (!datum.preventMove) {\n sourceSelectionableData.push(configuredItem);\n sourceSelectionableDataIds.push(hydratedId);\n }\n });\n const sourceHasMultipleSelectedItems = sourceSelectionArray.length >= 1;\n const sourceSelectionableIds = sourceSelectionableDataIds.join(' ');\n return {\n sourceConfiguredData,\n sourceSelectedItemsMap,\n sourceSelectionItemArray,\n sourceSelectionArray,\n sourceHasMultipleSelectedItems,\n sourceSelectionableData,\n sourceSelectionableDataIds,\n sourceSelectionableIds,\n };\n};\n\nexport const useDataStructure = (propsFromUser: DSShuttleV2T.InternalProps) => {\n const {\n sourceData,\n sourceSelectedItems,\n destinationData,\n destinationSelectedItems,\n getId,\n sourceSoftDeletedItems,\n destinationSoftDeletedItems,\n } = propsFromUser;\n return useMemo(\n () => ({\n ...configureSource({ sourceData, sourceSelectedItems, sourceSoftDeletedItems, getId }),\n ...configureDestination({ destinationData, destinationSelectedItems, destinationSoftDeletedItems, getId }),\n }),\n [\n sourceData,\n sourceSelectedItems,\n sourceSoftDeletedItems,\n getId,\n destinationData,\n destinationSelectedItems,\n destinationSoftDeletedItems,\n ],\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,eAAe;AASxB,MAAM,uBAAuB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAkC;AAChC,QAAM,8BAA4F,CAAC;AACnG,QAAM,4BAAwE,CAAC;AAC/E,QAAM,kCAA8E,CAAC;AAErF,QAAM,gCAAsD,CAAC;AAC7D,QAAM,4BAA4D,CAAC;AACnE,QAAM,+BAA+D,CAAC;A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Aa;AAAA,IACf;AACA,QAAI,cAAc;AAClB,QAAI,uBAAuB,gBAAgB,MAAM;AAC/C,oBAAc;AAAA,IAChB;AAEA,2BAAuB,cAAc,EAAE,OAAO,OAAO,EAAE;AACvD,UAAM,iBAAiB;AAAA,MACrB;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,SAAS,MAAM;AAAA,MACf,QAAQ,MAAM,WAAW,SAAS;AAAA,IACpC;AACA,yBAAqB,KAAK,cAAc;AACxC,QAAI,CAAC,MAAM,aAAa;AACtB,8BAAwB,KAAK,cAAc;AAC3C,iCAA2B,KAAK,UAAU;AAAA,IAC5C;AAAA,EACF,CAAC;AACD,QAAM,iCAAiC,qBAAqB,UAAU;AACtE,QAAM,yBAAyB,2BAA2B,KAAK,GAAG;AAClE,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,MAAM,mBAAmB,CAAC,kBAA8C;AAC7E,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,SAAO;AAAA,IACL,OAAO;AAAA,MACL,GAAG,gBAAgB,EAAE,YAAY,qBAAqB,wBAAwB,MAAM,CAAC;AAAA,MACrF,GAAG,qBAAqB,EAAE,iBAAiB,0BAA0B,6BAA6B,MAAM,CAAC;AAAA,IAC3G;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/config/useAutoCalculated/useShuttleVirtualized.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo, useCallback, useRef } from 'react';\nimport { useVirtual } from 'react-virtual';\n\nimport { type DSShuttleV2T } from '../../react-desc-prop-types';\n\ntype UseVirtualT = ReturnType<typeof useVirtual>;\ninterface UseVirtualizedT {\n destinationVirtualItems: UseVirtualT['virtualItems'];\n destinationMeasure: UseVirtualT['measure'];\n destinationScrollToIndex: UseVirtualT['scrollToIndex'];\n destinationScrollToOffset: UseVirtualT['scrollToOffset'];\n destinationTotalSize: UseVirtualT['totalSize'];\n destinationVirtualRef: React.Ref<HTMLDivElement>;\n sourceVirtualItems: UseVirtualT['virtualItems'];\n sourceMeasure: UseVirtualT['measure'];\n sourceScrollToIndex: UseVirtualT['scrollToIndex'];\n sourceScrollToOffset: UseVirtualT['scrollToOffset'];\n sourceTotalSize: UseVirtualT['totalSize'];\n sourceVirtualRef: React.Ref<HTMLDivElement>;\n}\nexport const useShuttleVirtualized = (propsWithDefaults: DSShuttleV2T.InternalProps): UseVirtualizedT => {\n const destinationVirtualRef = useRef<HTMLDivElement>(null);\n const sourceVirtualRef = useRef<HTMLDivElement>(null);\n\n const estimatedSize = useCallback(() => 36, []);\n\n const destinationVirtualConfig = useMemo(\n () => ({\n size: propsWithDefaults.destinationData.length,\n parentRef: destinationVirtualRef,\n overscan: 30,\n estimateSize: estimatedSize,\n }),\n [propsWithDefaults.destinationData.length, destinationVirtualRef, estimatedSize],\n );\n\n const {\n virtualItems: destinationVirtualItems,\n measure: destinationMeasure,\n scrollToIndex: destinationScrollToIndex,\n scrollToOffset: destinationScrollToOffset,\n totalSize: destinationTotalSize,\n }: ReturnType<typeof useVirtual> = useVirtual(destinationVirtualConfig);\n\n const sourceVirtualConfig = useMemo(\n () => ({\n size: propsWithDefaults.sourceData.length,\n parentRef: sourceVirtualRef,\n overscan: 30,\n estimateSize: estimatedSize,\n }),\n [propsWithDefaults.sourceData.length, sourceVirtualRef, estimatedSize],\n );\n\n const {\n virtualItems: sourceVirtualItems,\n measure: sourceMeasure,\n scrollToIndex: sourceScrollToIndex,\n scrollToOffset: sourceScrollToOffset,\n totalSize: sourceTotalSize,\n }: ReturnType<typeof useVirtual> = useVirtual(sourceVirtualConfig);\n\n return useMemo(\n () => ({\n destinationVirtualRef,\n destinationVirtualItems,\n destinationMeasure,\n destinationScrollToIndex,\n destinationScrollToOffset,\n destinationTotalSize,\n sourceVirtualRef,\n sourceVirtualItems,\n sourceMeasure,\n sourceScrollToIndex,\n sourceScrollToOffset,\n sourceTotalSize,\n }),\n [\n destinationVirtualItems,\n destinationMeasure,\n destinationScrollToIndex,\n destinationScrollToOffset,\n destinationTotalSize,\n sourceVirtualItems,\n sourceMeasure,\n sourceScrollToIndex,\n sourceScrollToOffset,\n sourceTotalSize,\n ],\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,SAAS,aAAa,cAAc;AAC7C,SAAS,kBAAkB;AAmBpB,MAAM,wBAAwB,CAAC,sBAAmE;AACvG,QAAM,wBAAwB,OAAuB,IAAI;AACzD,QAAM,mBAAmB,OAAuB,IAAI;AAEpD,QAAM,gBAAgB,YAAY,MAAM,IAAI,CAAC,CAAC;AAE9C,QAAM,2BAA2B;AAAA,IAC/B,OAAO;AAAA,MACL,MAAM,kBAAkB,gBAAgB;AAAA,MACxC,WAAW;AAAA,MACX,UAAU;AAAA,MACV,cAAc;AAAA,IAChB;AAAA,IACA,CAAC,kBAAkB,gBAAgB,QAAQ,uBAAuB,aAAa;AAAA,EACjF;AAEA,QAAM;AAAA,IACJ,cAAc;AAAA,IACd,SAAS;AAAA,IACT,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,WAAW;AAAA,EACb,IAAmC,WAAW,wBAAwB;AAEtE,QAAM,sBAAsB;AAAA,IAC1B,OAAO;AAAA,MACL,MAAM,kBAAkB,WAAW;AAAA,MACnC,WAAW;AAAA,MACX,UAAU;AAAA,MACV,cAAc;AAAA,IAChB;AAAA,IACA,CAAC,kBAAkB,WAAW,QAAQ,kBAAkB,aAAa;AAAA,EACvE;AAEA,QAAM;AAAA,IACJ,cAAc;AAAA,IACd,SAAS;AAAA,IACT,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,WAAW;AAAA,EACb,IAAmC,WAAW,mBAAmB;AAEjE,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo, useCallback, useRef } from 'react';\nimport { useVirtual } from 'react-virtual';\n\nimport { type DSShuttleV2T } from '../../react-desc-prop-types';\n\ntype UseVirtualT = ReturnType<typeof useVirtual>;\ninterface UseVirtualizedT {\n destinationVirtualItems: UseVirtualT['virtualItems'];\n destinationMeasure: UseVirtualT['measure'];\n destinationScrollToIndex: UseVirtualT['scrollToIndex'];\n destinationScrollToOffset: UseVirtualT['scrollToOffset'];\n destinationTotalSize: UseVirtualT['totalSize'];\n destinationVirtualRef: React.Ref<HTMLDivElement>;\n sourceVirtualItems: UseVirtualT['virtualItems'];\n sourceMeasure: UseVirtualT['measure'];\n sourceScrollToIndex: UseVirtualT['scrollToIndex'];\n sourceScrollToOffset: UseVirtualT['scrollToOffset'];\n sourceTotalSize: UseVirtualT['totalSize'];\n sourceVirtualRef: React.Ref<HTMLDivElement>;\n}\n\nexport const useShuttleVirtualized = (propsWithDefaults: DSShuttleV2T.InternalProps): UseVirtualizedT => {\n const destinationVirtualRef = useRef<HTMLDivElement>(null);\n const sourceVirtualRef = useRef<HTMLDivElement>(null);\n\n const estimatedSize = useCallback(() => 36, []);\n\n const destinationVirtualConfig = useMemo(\n () => ({\n size: propsWithDefaults.destinationData.length,\n parentRef: destinationVirtualRef,\n overscan: 30,\n estimateSize: estimatedSize,\n }),\n [propsWithDefaults.destinationData.length, destinationVirtualRef, estimatedSize],\n );\n\n const {\n virtualItems: destinationVirtualItems,\n measure: destinationMeasure,\n scrollToIndex: destinationScrollToIndex,\n scrollToOffset: destinationScrollToOffset,\n totalSize: destinationTotalSize,\n }: ReturnType<typeof useVirtual> = useVirtual(destinationVirtualConfig);\n\n const sourceVirtualConfig = useMemo(\n () => ({\n size: propsWithDefaults.sourceData.length,\n parentRef: sourceVirtualRef,\n overscan: 30,\n estimateSize: estimatedSize,\n }),\n [propsWithDefaults.sourceData.length, sourceVirtualRef, estimatedSize],\n );\n\n const {\n virtualItems: sourceVirtualItems,\n measure: sourceMeasure,\n scrollToIndex: sourceScrollToIndex,\n scrollToOffset: sourceScrollToOffset,\n totalSize: sourceTotalSize,\n }: ReturnType<typeof useVirtual> = useVirtual(sourceVirtualConfig);\n\n return useMemo(\n () => ({\n destinationVirtualRef,\n destinationVirtualItems,\n destinationMeasure,\n destinationScrollToIndex,\n destinationScrollToOffset,\n destinationTotalSize,\n sourceVirtualRef,\n sourceVirtualItems,\n sourceMeasure,\n sourceScrollToIndex,\n sourceScrollToOffset,\n sourceTotalSize,\n }),\n [\n destinationVirtualItems,\n destinationMeasure,\n destinationScrollToIndex,\n destinationScrollToOffset,\n destinationTotalSize,\n sourceVirtualItems,\n sourceMeasure,\n sourceScrollToIndex,\n sourceScrollToOffset,\n sourceTotalSize,\n ],\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,SAAS,aAAa,cAAc;AAC7C,SAAS,kBAAkB;AAoBpB,MAAM,wBAAwB,CAAC,sBAAmE;AACvG,QAAM,wBAAwB,OAAuB,IAAI;AACzD,QAAM,mBAAmB,OAAuB,IAAI;AAEpD,QAAM,gBAAgB,YAAY,MAAM,IAAI,CAAC,CAAC;AAE9C,QAAM,2BAA2B;AAAA,IAC/B,OAAO;AAAA,MACL,MAAM,kBAAkB,gBAAgB;AAAA,MACxC,WAAW;AAAA,MACX,UAAU;AAAA,MACV,cAAc;AAAA,IAChB;AAAA,IACA,CAAC,kBAAkB,gBAAgB,QAAQ,uBAAuB,aAAa;AAAA,EACjF;AAEA,QAAM;AAAA,IACJ,cAAc;AAAA,IACd,SAAS;AAAA,IACT,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,WAAW;AAAA,EACb,IAAmC,WAAW,wBAAwB;AAEtE,QAAM,sBAAsB;AAAA,IAC1B,OAAO;AAAA,MACL,MAAM,kBAAkB,WAAW;AAAA,MACnC,WAAW;AAAA,MACX,UAAU;AAAA,MACV,cAAc;AAAA,IAChB;AAAA,IACA,CAAC,kBAAkB,WAAW,QAAQ,kBAAkB,aAAa;AAAA,EACvE;AAEA,QAAM;AAAA,IACJ,cAAc;AAAA,IACd,SAAS;AAAA,IACT,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,WAAW;AAAA,EACb,IAAmC,WAAW,mBAAmB;AAEjE,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -77,9 +77,9 @@ const useFocusActionTrackers = () => {
77
77
  const removeDragAndDropFromDestination = usePropsStore((state) => state.removeDragAndDropFromDestination);
78
78
  const addDragAndDropFromSource = usePropsStore((state) => state.addDragAndDropFromSource);
79
79
  const trackFocusPrevAction = useCallback(
80
- ({ isDestinationPanel, item }) => {
81
- const preventMove = Boolean(item.original.preventMove);
82
- const preventDrilldown = Boolean(item.original.preventDrilldown);
80
+ ({ isDestinationPanel, datumHydratables }) => {
81
+ const preventMove = Boolean(datumHydratables.preventMove);
82
+ const preventDrilldown = Boolean(datumHydratables.preventDrilldown);
83
83
  const withDragAndDrop = isDestinationPanel && !removeDragAndDropFromDestination || !isDestinationPanel && addDragAndDropFromSource;
84
84
  const { prevAction } = getActionByProxymity({
85
85
  flags: { preventMove, preventDrilldown, withDragAndDrop },
@@ -90,9 +90,9 @@ const useFocusActionTrackers = () => {
90
90
  [addDragAndDropFromSource, mutableFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction]
91
91
  );
92
92
  const trackFocusNextAction = useCallback(
93
- ({ isDestinationPanel, item }) => {
94
- const preventMove = Boolean(item.original.preventMove);
95
- const preventDrilldown = Boolean(item.original.preventDrilldown);
93
+ ({ isDestinationPanel, datumHydratables }) => {
94
+ const preventMove = Boolean(datumHydratables.preventMove);
95
+ const preventDrilldown = Boolean(datumHydratables.preventDrilldown);
96
96
  const withDragAndDrop = isDestinationPanel && !removeDragAndDropFromDestination || !isDestinationPanel && addDragAndDropFromSource;
97
97
  const { nextAction } = getActionByProxymity({
98
98
  flags: { preventMove, preventDrilldown, withDragAndDrop },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/config/useFocusTracker/useFocusActionTrackers.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo, useCallback } from 'react';\nimport { useMakeMutable } from '@elliemae/ds-utilities';\nimport { type DSShuttleV2T } from '../../react-desc-prop-types';\nimport { ACTIONS_FOCUSES } from '../../constants';\nimport { useInternalStore, usePropsStore } from '../useStore';\n\ntype ActionFlags = {\n preventDrilldown: boolean;\n withDragAndDrop: boolean;\n preventMove: boolean;\n};\ntype ActionByProxymity = {\n prevAction: typeof ACTIONS_FOCUSES[keyof typeof ACTIONS_FOCUSES];\n nextAction: typeof ACTIONS_FOCUSES[keyof typeof ACTIONS_FOCUSES];\n};\nconst getMoveBtnActionByProxymity = (flags: ActionFlags) => {\n // move button\n const { preventDrilldown, withDragAndDrop } = flags;\n const actionMap = { prevAction: '', nextAction: '' } as ActionByProxymity;\n // prev\n // drilldown if it exist\n // else drag n drop if it exist\n // else parent\n if (!preventDrilldown) actionMap.prevAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else if (withDragAndDrop) actionMap.prevAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.prevAction = ACTIONS_FOCUSES.PARENT;\n // next\n // drag n drop if it exist\n // else parent\n if (withDragAndDrop) actionMap.nextAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.nextAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getDragAndDropBtnActionByProxymity = (flags: ActionFlags) => {\n // Drag and drop handler\n const { preventMove, preventDrilldown } = flags;\n // next\n // always parent\n const actionMap = { prevAction: '', nextAction: ACTIONS_FOCUSES.PARENT } as ActionByProxymity;\n // prev\n // move if it exist\n // else drilldown if it exist\n // else parent\n if (!preventMove) actionMap.prevAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (!preventDrilldown) actionMap.prevAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else actionMap.prevAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getDrilldownBtnActionByProxymity = (flags: ActionFlags) => {\n // Drilldown handler\n const { withDragAndDrop, preventMove } = flags;\n // prev\n // always parent\n const actionMap = { prevAction: ACTIONS_FOCUSES.PARENT, nextAction: '' } as ActionByProxymity;\n // next\n // move if it exist\n // else drag n drop if it exist\n // else parent\n if (!preventMove) actionMap.nextAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (withDragAndDrop) actionMap.nextAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.nextAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getParenBtnActionByProxymity = (flags: ActionFlags) => {\n // Parent handler\n const { preventDrilldown, withDragAndDrop, preventMove } = flags;\n const actionMap = { prevAction: '', nextAction: '' } as ActionByProxymity;\n // prev\n // drag n drop if it exist\n // else move if it exist\n // else drilldown if it exist\n // else parent\n if (withDragAndDrop) actionMap.prevAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else if (!preventMove) actionMap.prevAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (!preventDrilldown) actionMap.prevAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else actionMap.prevAction = ACTIONS_FOCUSES.PARENT;\n // next\n // drilldown if it exist\n // else move if it exist\n // else drag n drop if it exist\n // else parent\n if (!preventDrilldown) actionMap.nextAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else if (!preventMove) actionMap.nextAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (withDragAndDrop) actionMap.nextAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.nextAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getActionByProxymity = ({ flags, currentAction }: { flags: ActionFlags; currentAction: string }) => {\n if (currentAction === ACTIONS_FOCUSES.MOVE_BTN) return getMoveBtnActionByProxymity(flags);\n if (currentAction === ACTIONS_FOCUSES.DRAG_N_DROP) return getDragAndDropBtnActionByProxymity(flags);\n if (currentAction === ACTIONS_FOCUSES.DRILLDOWN_BTN) return getDrilldownBtnActionByProxymity(flags);\n return getParenBtnActionByProxymity(flags);\n};\nexport const useFocusActionTrackers = () => {\n const focusItemAction = useInternalStore((state) => state.focusItemAction);\n // tracking actions are always triggered as user action callbacks\n // this means it should always be invoked after all the useEffect execute\n // since this is the case, we can avoid re-declaring the function with mutable pattern\n // this way we avoid useless re-renders\n const mutableFocusItemAction = useMakeMutable(focusItemAction);\n const setFocusItemAction = useInternalStore((state) => state.setFocusItemAction);\n const removeDragAndDropFromDestination = usePropsStore((state) => state.removeDragAndDropFromDestination);\n const addDragAndDropFromSource = usePropsStore((state) => state.addDragAndDropFromSource);\n const trackFocusPrevAction = useCallback(\n ({ isDestinationPanel, item }: DSShuttleV2T.ItemMeta) => {\n const preventMove = Boolean(item.original.preventMove);\n const preventDrilldown = Boolean(item.original.preventDrilldown);\n const withDragAndDrop =\n (isDestinationPanel && !removeDragAndDropFromDestination) || (!isDestinationPanel && addDragAndDropFromSource);\n const { prevAction } = getActionByProxymity({\n flags: { preventMove, preventDrilldown, withDragAndDrop },\n currentAction: mutableFocusItemAction.current,\n });\n setFocusItemAction(prevAction);\n },\n [addDragAndDropFromSource, mutableFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction],\n );\n const trackFocusNextAction = useCallback(\n ({ isDestinationPanel, item }: DSShuttleV2T.ItemMeta) => {\n const preventMove = Boolean(item.original.preventMove);\n const preventDrilldown = Boolean(item.original.preventDrilldown);\n const withDragAndDrop =\n (isDestinationPanel && !removeDragAndDropFromDestination) || (!isDestinationPanel && addDragAndDropFromSource);\n const { nextAction } = getActionByProxymity({\n flags: { preventMove, preventDrilldown, withDragAndDrop },\n currentAction: mutableFocusItemAction.current,\n });\n setFocusItemAction(nextAction);\n },\n [addDragAndDropFromSource, mutableFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction],\n );\n return useMemo(\n () => ({\n mutableFocusItemAction,\n trackFocusActionMove: () => setFocusItemAction('move-btn'),\n trackFocusActionDrilldown: () => setFocusItemAction('drilldown-btn'),\n trackFocusActionDragAndDrop: () => setFocusItemAction('drag-n-drop'),\n trackFocusActionParent: () => setFocusItemAction('parent'),\n trackFocusActionReset: () => setFocusItemAction(''),\n trackFocusPrevAction,\n trackFocusNextAction,\n }),\n [mutableFocusItemAction, setFocusItemAction, trackFocusNextAction, trackFocusPrevAction],\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,SAAS,mBAAmB;AACrC,SAAS,sBAAsB;AAE/B,SAAS,uBAAuB;AAChC,SAAS,kBAAkB,qBAAqB;AAWhD,MAAM,8BAA8B,CAAC,UAAuB;AAE1D,QAAM,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AAC,oCAAsC,CAAC,sBAAsB;AACvF,YAAM,EAAE,WAAW,IAAI,qBAAqB;AAAA,QAC1C,OAAO,EAAE,aAAa,kBAAkB,gBAAgB;AAAA,QACxD,eAAe,uBAAuB;AAAA,MACxC,CAAC;AACD,yBAAmB,UAAU;AAAA,IAC/B;AAAA,IACA,CAAC,0BAA0B,wBAAwB,kCAAkC,kBAAkB;AAAA,EACzG;AACA,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA,sBAAsB,MAAM,mBAAmB,UAAU;AAAA,MACzD,2BAA2B,MAAM,mBAAmB,eAAe;AAAA,MACnE,6BAA6B,MAAM,mBAAmB,aAAa;AAAA,MACnE,wBAAwB,MAAM,mBAAmB,QAAQ;AAAA,MACzD,uBAAuB,MAAM,mBAAmB,EAAE;AAAA,MAClD;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,wBAAwB,oBAAoB,sBAAsB,oBAAoB;AAAA,EACzF;AACF;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useMemo, useCallback } from 'react';\nimport { useMakeMutable } from '@elliemae/ds-utilities';\nimport { type DSShuttleV2T } from '../../react-desc-prop-types';\nimport { ACTIONS_FOCUSES } from '../../constants';\nimport { useInternalStore, usePropsStore } from '../useStore';\n\ntype ActionFlags = {\n preventDrilldown: boolean;\n withDragAndDrop: boolean;\n preventMove: boolean;\n};\ntype ActionByProxymity = {\n prevAction: (typeof ACTIONS_FOCUSES)[keyof typeof ACTIONS_FOCUSES];\n nextAction: (typeof ACTIONS_FOCUSES)[keyof typeof ACTIONS_FOCUSES];\n};\nconst getMoveBtnActionByProxymity = (flags: ActionFlags) => {\n // move button\n const { preventDrilldown, withDragAndDrop } = flags;\n const actionMap = { prevAction: '', nextAction: '' } as ActionByProxymity;\n // prev\n // drilldown if it exist\n // else drag n drop if it exist\n // else parent\n if (!preventDrilldown) actionMap.prevAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else if (withDragAndDrop) actionMap.prevAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.prevAction = ACTIONS_FOCUSES.PARENT;\n // next\n // drag n drop if it exist\n // else parent\n if (withDragAndDrop) actionMap.nextAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.nextAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getDragAndDropBtnActionByProxymity = (flags: ActionFlags) => {\n // Drag and drop handler\n const { preventMove, preventDrilldown } = flags;\n // next\n // always parent\n const actionMap = { prevAction: '', nextAction: ACTIONS_FOCUSES.PARENT } as ActionByProxymity;\n // prev\n // move if it exist\n // else drilldown if it exist\n // else parent\n if (!preventMove) actionMap.prevAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (!preventDrilldown) actionMap.prevAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else actionMap.prevAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getDrilldownBtnActionByProxymity = (flags: ActionFlags) => {\n // Drilldown handler\n const { withDragAndDrop, preventMove } = flags;\n // prev\n // always parent\n const actionMap = { prevAction: ACTIONS_FOCUSES.PARENT, nextAction: '' } as ActionByProxymity;\n // next\n // move if it exist\n // else drag n drop if it exist\n // else parent\n if (!preventMove) actionMap.nextAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (withDragAndDrop) actionMap.nextAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.nextAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getParenBtnActionByProxymity = (flags: ActionFlags) => {\n // Parent handler\n const { preventDrilldown, withDragAndDrop, preventMove } = flags;\n const actionMap = { prevAction: '', nextAction: '' } as ActionByProxymity;\n // prev\n // drag n drop if it exist\n // else move if it exist\n // else drilldown if it exist\n // else parent\n if (withDragAndDrop) actionMap.prevAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else if (!preventMove) actionMap.prevAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (!preventDrilldown) actionMap.prevAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else actionMap.prevAction = ACTIONS_FOCUSES.PARENT;\n // next\n // drilldown if it exist\n // else move if it exist\n // else drag n drop if it exist\n // else parent\n if (!preventDrilldown) actionMap.nextAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else if (!preventMove) actionMap.nextAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (withDragAndDrop) actionMap.nextAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.nextAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getActionByProxymity = ({ flags, currentAction }: { flags: ActionFlags; currentAction: string }) => {\n if (currentAction === ACTIONS_FOCUSES.MOVE_BTN) return getMoveBtnActionByProxymity(flags);\n if (currentAction === ACTIONS_FOCUSES.DRAG_N_DROP) return getDragAndDropBtnActionByProxymity(flags);\n if (currentAction === ACTIONS_FOCUSES.DRILLDOWN_BTN) return getDrilldownBtnActionByProxymity(flags);\n return getParenBtnActionByProxymity(flags);\n};\nexport const useFocusActionTrackers = () => {\n const focusItemAction = useInternalStore((state) => state.focusItemAction);\n // tracking actions are always triggered as user action callbacks\n // this means it should always be invoked after all the useEffect execute\n // since this is the case, we can avoid re-declaring the function with mutable pattern\n // this way we avoid useless re-renders\n const mutableFocusItemAction = useMakeMutable(focusItemAction);\n const setFocusItemAction = useInternalStore((state) => state.setFocusItemAction);\n const removeDragAndDropFromDestination = usePropsStore((state) => state.removeDragAndDropFromDestination);\n const addDragAndDropFromSource = usePropsStore((state) => state.addDragAndDropFromSource);\n const trackFocusPrevAction = useCallback(\n ({ isDestinationPanel, datumHydratables }: DSShuttleV2T.ItemMeta) => {\n const preventMove = Boolean(datumHydratables.preventMove);\n const preventDrilldown = Boolean(datumHydratables.preventDrilldown);\n const withDragAndDrop =\n (isDestinationPanel && !removeDragAndDropFromDestination) || (!isDestinationPanel && addDragAndDropFromSource);\n const { prevAction } = getActionByProxymity({\n flags: { preventMove, preventDrilldown, withDragAndDrop },\n currentAction: mutableFocusItemAction.current,\n });\n setFocusItemAction(prevAction);\n },\n [addDragAndDropFromSource, mutableFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction],\n );\n const trackFocusNextAction = useCallback(\n ({ isDestinationPanel, datumHydratables }: DSShuttleV2T.ItemMeta) => {\n const preventMove = Boolean(datumHydratables.preventMove);\n const preventDrilldown = Boolean(datumHydratables.preventDrilldown);\n const withDragAndDrop =\n (isDestinationPanel && !removeDragAndDropFromDestination) || (!isDestinationPanel && addDragAndDropFromSource);\n const { nextAction } = getActionByProxymity({\n flags: { preventMove, preventDrilldown, withDragAndDrop },\n currentAction: mutableFocusItemAction.current,\n });\n setFocusItemAction(nextAction);\n },\n [addDragAndDropFromSource, mutableFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction],\n );\n return useMemo(\n () => ({\n mutableFocusItemAction,\n trackFocusActionMove: () => setFocusItemAction('move-btn'),\n trackFocusActionDrilldown: () => setFocusItemAction('drilldown-btn'),\n trackFocusActionDragAndDrop: () => setFocusItemAction('drag-n-drop'),\n trackFocusActionParent: () => setFocusItemAction('parent'),\n trackFocusActionReset: () => setFocusItemAction(''),\n trackFocusPrevAction,\n trackFocusNextAction,\n }),\n [mutableFocusItemAction, setFocusItemAction, trackFocusNextAction, trackFocusPrevAction],\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,SAAS,mBAAmB;AACrC,SAAS,sBAAsB;AAE/B,SAAS,uBAAuB;AAChC,SAAS,kBAAkB,qBAAqB;AAWhD,MAAM,8BAA8B,CAAC,UAAuB;AAE1D,QAAM,EAAE,kBAAkB,gBAAgB,IAAI;AAC9C,QAAM,YAAY,EAAE,YAAY,IAAI,YAAY,GAAG;AAKnD,MAAI,CAAC;AAAkB,cAAU,aAAa,gBAAgB;AAAA,WACrD;AAAiB,cAAU,aAAa,gBAAgB;AAAA;AAC5D,cAAU,aAAa,gBAAgB;AAI5C,MAAI;AAAiB,cAAU,aAAa,gBAA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EACzG;AACA,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA,sBAAsB,MAAM,mBAAmB,UAAU;AAAA,MACzD,2BAA2B,MAAM,mBAAmB,eAAe;AAAA,MACnE,6BAA6B,MAAM,mBAAmB,aAAa;AAAA,MACnE,wBAAwB,MAAM,mBAAmB,QAAQ;AAAA,MACzD,uBAAuB,MAAM,mBAAmB,EAAE;AAAA,MAClD;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,wBAAwB,oBAAoB,sBAAsB,oBAAoB;AAAA,EACzF;AACF;",
6
6
  "names": []
7
7
  }
@@ -7,8 +7,8 @@ const useFocusItemTracker = () => {
7
7
  const focusItem = useInternalStore((state) => state.focusItem);
8
8
  const mutableFocusItem = useMakeMutable(focusItem);
9
9
  const setFocusItem = useInternalStore((state) => state.setFocusItem);
10
- const sourceData = usePropsStore((state) => state.sourceData);
11
- const destinationData = usePropsStore((state) => state.destinationData);
10
+ const sourceData = useInternalStore((state) => state.sourceConfiguredData);
11
+ const destinationData = useInternalStore((state) => state.destinationConfiguredData);
12
12
  const sourceWithLoadMore = usePropsStore((state) => state.sourceWithLoadMore);
13
13
  const destinationWithLoadMore = usePropsStore((state) => state.destinationWithLoadMore);
14
14
  const trackFocusPrevItem = useCallback(
@@ -31,7 +31,7 @@ const useFocusItemTracker = () => {
31
31
  setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));
32
32
  return;
33
33
  }
34
- const currentItemIndex = referenceData.findIndex((currItem) => currItem.id === mutableFocusItem.current);
34
+ const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === mutableFocusItem.current);
35
35
  if (currentItemIndex === 0 && withLoadMore)
36
36
  setFocusItem(ITEMS_FOCUSES.LOAD_MORE_BTN);
37
37
  else if (currentItemIndex !== -1) {
@@ -66,7 +66,7 @@ const useFocusItemTracker = () => {
66
66
  }
67
67
  return;
68
68
  }
69
- const currentItemIndex = referenceData.findIndex((currItem) => currItem.id === mutableFocusItem.current);
69
+ const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === mutableFocusItem.current);
70
70
  if (currentItemIndex === referenceData.length - 1 && withLoadMore)
71
71
  setFocusItem(ITEMS_FOCUSES.LOAD_MORE_BTN);
72
72
  else if (currentItemIndex !== -1) {
@@ -84,7 +84,7 @@ const useFocusItemTracker = () => {
84
84
  return useMemo(
85
85
  () => ({
86
86
  mutableFocusItem,
87
- trackFocusItem: (item) => setFocusItem(item.original.id),
87
+ trackFocusItem: (item) => setFocusItem(item.hydratedId),
88
88
  trackFocusItemReset: () => setFocusItem(ITEMS_FOCUSES.RESET),
89
89
  trackFocusItemFirst: () => setFocusItem(ITEMS_FOCUSES.FIRST),
90
90
  trackFocusItemLast: () => setFocusItem(ITEMS_FOCUSES.LAST),