@elliemae/ds-shuttle-v2 3.14.1 → 3.14.3

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 (121) hide show
  1. package/dist/cjs/config/DSShuttleV2Definitions.js +2 -1
  2. package/dist/cjs/config/DSShuttleV2Definitions.js.map +2 -2
  3. package/dist/cjs/config/itemMovementHelpers.js +29 -52
  4. package/dist/cjs/config/itemMovementHelpers.js.map +2 -2
  5. package/dist/cjs/config/useAutoCalculated/useDataStructure.js +25 -6
  6. package/dist/cjs/config/useAutoCalculated/useDataStructure.js.map +2 -2
  7. package/dist/cjs/config/useFocusTracker/useFocusActionTrackers.js +10 -13
  8. package/dist/cjs/config/useFocusTracker/useFocusActionTrackers.js.map +2 -2
  9. package/dist/cjs/config/useFocusTracker/useFocusItemTracker.js +16 -49
  10. package/dist/cjs/config/useFocusTracker/useFocusItemTracker.js.map +2 -2
  11. package/dist/cjs/config/useFocusTracker/useFocusRegionTrackers.js +1 -5
  12. package/dist/cjs/config/useFocusTracker/useFocusRegionTrackers.js.map +2 -2
  13. package/dist/cjs/config/useStore/focusAndTabIndexManager.js +73 -0
  14. package/dist/cjs/config/useStore/focusAndTabIndexManager.js.map +7 -0
  15. package/dist/cjs/config/useStore/useStore.js +13 -0
  16. package/dist/cjs/config/useStore/useStore.js.map +3 -3
  17. package/dist/cjs/constants/index.js +1 -3
  18. package/dist/cjs/constants/index.js.map +2 -2
  19. package/dist/cjs/parts/Dnd/DndHandle.js +5 -1
  20. package/dist/cjs/parts/Dnd/DndHandle.js.map +2 -2
  21. package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js +14 -12
  22. package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js.map +2 -2
  23. package/dist/cjs/parts/Item/Item.js +44 -39
  24. package/dist/cjs/parts/Item/Item.js.map +2 -2
  25. package/dist/cjs/parts/Item/ItemActions/ItemActions.js +6 -6
  26. package/dist/cjs/parts/Item/ItemActions/ItemActions.js.map +2 -2
  27. package/dist/cjs/parts/Item/ItemActions/useInnerRefHandlers.js +8 -23
  28. package/dist/cjs/parts/Item/ItemActions/useInnerRefHandlers.js.map +2 -2
  29. package/dist/cjs/parts/Item/ItemOverlay.js +2 -1
  30. package/dist/cjs/parts/Item/ItemOverlay.js.map +2 -2
  31. package/dist/cjs/parts/Item/useItemArrowNavigation.js +7 -22
  32. package/dist/cjs/parts/Item/useItemArrowNavigation.js.map +2 -2
  33. package/dist/cjs/parts/Item/useSelectionLogic.js +1 -1
  34. package/dist/cjs/parts/Item/useSelectionLogic.js.map +2 -2
  35. package/dist/cjs/parts/MainContent.js +2 -2
  36. package/dist/cjs/parts/MainContent.js.map +2 -2
  37. package/dist/cjs/parts/Panel/bottom/LoadMoreBtn.js +2 -8
  38. package/dist/cjs/parts/Panel/bottom/LoadMoreBtn.js.map +2 -2
  39. package/dist/cjs/parts/Panel/bottom/useInnerRefHandlers.js +7 -12
  40. package/dist/cjs/parts/Panel/bottom/useInnerRefHandlers.js.map +2 -2
  41. package/dist/cjs/parts/Panel/middle/ItemListWrapper/Index.js +3 -12
  42. package/dist/cjs/parts/Panel/middle/ItemListWrapper/Index.js.map +2 -2
  43. package/dist/cjs/parts/Panel/middle/ItemListWrapper/useGetDatumHydratables.js +3 -4
  44. package/dist/cjs/parts/Panel/middle/ItemListWrapper/useGetDatumHydratables.js.map +2 -2
  45. package/dist/cjs/parts/Panel/middle/MultipleSelectionAction.js +3 -7
  46. package/dist/cjs/parts/Panel/middle/MultipleSelectionAction.js.map +2 -2
  47. package/dist/cjs/parts/Panel/middle/PanelContentMiddleSection.js +21 -19
  48. package/dist/cjs/parts/Panel/middle/PanelContentMiddleSection.js.map +2 -2
  49. package/dist/cjs/parts/Panel/top/SelectionHeader.js +3 -3
  50. package/dist/cjs/parts/Panel/top/SelectionHeader.js.map +2 -2
  51. package/dist/cjs/react-desc-prop-types.js +52 -2
  52. package/dist/cjs/react-desc-prop-types.js.map +2 -2
  53. package/dist/esm/config/DSShuttleV2Definitions.js +2 -1
  54. package/dist/esm/config/DSShuttleV2Definitions.js.map +2 -2
  55. package/dist/esm/config/itemMovementHelpers.js +30 -53
  56. package/dist/esm/config/itemMovementHelpers.js.map +2 -2
  57. package/dist/esm/config/useAutoCalculated/useDataStructure.js +25 -6
  58. package/dist/esm/config/useAutoCalculated/useDataStructure.js.map +2 -2
  59. package/dist/esm/config/useFocusTracker/useFocusActionTrackers.js +10 -13
  60. package/dist/esm/config/useFocusTracker/useFocusActionTrackers.js.map +2 -2
  61. package/dist/esm/config/useFocusTracker/useFocusItemTracker.js +16 -49
  62. package/dist/esm/config/useFocusTracker/useFocusItemTracker.js.map +2 -2
  63. package/dist/esm/config/useFocusTracker/useFocusRegionTrackers.js +1 -5
  64. package/dist/esm/config/useFocusTracker/useFocusRegionTrackers.js.map +2 -2
  65. package/dist/esm/config/useStore/focusAndTabIndexManager.js +47 -0
  66. package/dist/esm/config/useStore/focusAndTabIndexManager.js.map +7 -0
  67. package/dist/esm/config/useStore/useStore.js +13 -0
  68. package/dist/esm/config/useStore/useStore.js.map +2 -2
  69. package/dist/esm/constants/index.js +1 -3
  70. package/dist/esm/constants/index.js.map +2 -2
  71. package/dist/esm/parts/Dnd/DndHandle.js +5 -1
  72. package/dist/esm/parts/Dnd/DndHandle.js.map +2 -2
  73. package/dist/esm/parts/HoC/withConditionalDnDRowContext.js +14 -12
  74. package/dist/esm/parts/HoC/withConditionalDnDRowContext.js.map +2 -2
  75. package/dist/esm/parts/Item/Item.js +44 -39
  76. package/dist/esm/parts/Item/Item.js.map +2 -2
  77. package/dist/esm/parts/Item/ItemActions/ItemActions.js +6 -6
  78. package/dist/esm/parts/Item/ItemActions/ItemActions.js.map +2 -2
  79. package/dist/esm/parts/Item/ItemActions/useInnerRefHandlers.js +8 -23
  80. package/dist/esm/parts/Item/ItemActions/useInnerRefHandlers.js.map +2 -2
  81. package/dist/esm/parts/Item/ItemOverlay.js +2 -1
  82. package/dist/esm/parts/Item/ItemOverlay.js.map +2 -2
  83. package/dist/esm/parts/Item/useItemArrowNavigation.js +7 -22
  84. package/dist/esm/parts/Item/useItemArrowNavigation.js.map +2 -2
  85. package/dist/esm/parts/Item/useSelectionLogic.js +1 -1
  86. package/dist/esm/parts/Item/useSelectionLogic.js.map +2 -2
  87. package/dist/esm/parts/MainContent.js +3 -3
  88. package/dist/esm/parts/MainContent.js.map +2 -2
  89. package/dist/esm/parts/Panel/bottom/LoadMoreBtn.js +2 -8
  90. package/dist/esm/parts/Panel/bottom/LoadMoreBtn.js.map +2 -2
  91. package/dist/esm/parts/Panel/bottom/useInnerRefHandlers.js +7 -12
  92. package/dist/esm/parts/Panel/bottom/useInnerRefHandlers.js.map +2 -2
  93. package/dist/esm/parts/Panel/middle/ItemListWrapper/Index.js +4 -13
  94. package/dist/esm/parts/Panel/middle/ItemListWrapper/Index.js.map +2 -2
  95. package/dist/esm/parts/Panel/middle/ItemListWrapper/useGetDatumHydratables.js +3 -4
  96. package/dist/esm/parts/Panel/middle/ItemListWrapper/useGetDatumHydratables.js.map +2 -2
  97. package/dist/esm/parts/Panel/middle/MultipleSelectionAction.js +3 -7
  98. package/dist/esm/parts/Panel/middle/MultipleSelectionAction.js.map +2 -2
  99. package/dist/esm/parts/Panel/middle/PanelContentMiddleSection.js +21 -19
  100. package/dist/esm/parts/Panel/middle/PanelContentMiddleSection.js.map +2 -2
  101. package/dist/esm/parts/Panel/top/SelectionHeader.js +4 -4
  102. package/dist/esm/parts/Panel/top/SelectionHeader.js.map +2 -2
  103. package/dist/esm/react-desc-prop-types.js +52 -2
  104. package/dist/esm/react-desc-prop-types.js.map +2 -2
  105. package/dist/types/config/DSShuttleV2Definitions.d.ts +1 -0
  106. package/dist/types/config/useFocusTracker/useFocusActionTrackers.d.ts +2 -4
  107. package/dist/types/config/useFocusTracker/useFocusItemTracker.d.ts +2 -6
  108. package/dist/types/config/useFocusTracker/useFocusRegionTrackers.d.ts +0 -2
  109. package/dist/types/config/useFocusTracker/useFocusTracker.d.ts +4 -10
  110. package/dist/types/config/useStore/focusAndTabIndexManager.d.ts +10 -0
  111. package/dist/types/config/useStore/useStore.d.ts +35 -60
  112. package/dist/types/constants/index.d.ts +1 -3
  113. package/dist/types/parts/Dnd/DndHandle.d.ts +3 -3
  114. package/dist/types/parts/Item/ItemActions/useActionsHandlers.d.ts +2 -2
  115. package/dist/types/parts/Item/ItemActions/useInnerRefHandlers.d.ts +0 -2
  116. package/dist/types/parts/Panel/bottom/useInnerRefHandlers.d.ts +0 -1
  117. package/dist/types/parts/Panel/middle/ItemListWrapper/useGetDatumHydratables.d.ts +1 -1
  118. package/dist/types/react-desc-prop-types.d.ts +35 -4
  119. package/package.json +17 -17
  120. package/dist/cjs/config/useStore/createAtomInStore.bak +0 -18
  121. package/dist/esm/config/useStore/createAtomInStore.bak +0 -18
@@ -1,7 +1,6 @@
1
1
  import * as React from "react";
2
2
  import React2 from "react";
3
- import { useMakeMutable } from "@elliemae/ds-utilities";
4
- import { usePropsStore, useInternalStore } from "./useStore";
3
+ import { usePropsStore } from "./useStore";
5
4
  const useHandleMoveSelection = ({ isDestinationPanel }) => {
6
5
  const currOnRemove = usePropsStore(
7
6
  (state) => isDestinationPanel ? state.onDestinationRemove : state.onSourceRemove
@@ -18,55 +17,45 @@ const useHandleMoveSelection = ({ isDestinationPanel }) => {
18
17
  const otherOnSoftDelete = usePropsStore(
19
18
  (state) => isDestinationPanel ? state.onSourceSoftDelete : state.onDestinationSoftDelete
20
19
  );
21
- const currSelectionMap = useInternalStore(
20
+ const currSelectionMap = usePropsStore(
22
21
  (store) => isDestinationPanel ? store.destinationSelectionArray : store.sourceSelectionArray
23
22
  );
24
23
  const currOnSelectionChange = usePropsStore(
25
24
  (state) => isDestinationPanel ? state.onDestinationSelectionChange : state.onSourceSelectionChange
26
25
  );
27
26
  const otherPanelOnAdd = usePropsStore((state) => isDestinationPanel ? state.onSourceAdd : state.onDestinationAdd);
28
- const destinationSelectionArray = useInternalStore((store) => store.destinationSelectionItemArray);
29
- const sourceSelectionArray = useInternalStore((store) => store.sourceSelectionItemArray);
27
+ const destinationSelectionArray = usePropsStore((store) => store.destinationSelectionItemArray);
28
+ const sourceSelectionArray = usePropsStore((store) => store.sourceSelectionItemArray);
30
29
  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);
40
30
  const moveSelection = React2.useCallback(
41
31
  (event) => {
42
32
  event.preventDefault();
43
33
  event.stopPropagation();
44
- mutableCurrOnRemove.current(mutableSelectedItems.current, { event });
45
- mutableOtherOnAdd.current(mutableSelectedItems.current, { event });
34
+ currOnRemove(selectedItems, { event });
35
+ otherPanelOnAdd(selectedItems, { event });
46
36
  const currSoftDeletedMap = {};
47
37
  const otherSoftDeletedMap = {};
48
- mutableCurrSelectionMap.current.forEach((id) => {
38
+ currSelectionMap.forEach((id) => {
49
39
  currSoftDeletedMap[id] = true;
50
40
  otherSoftDeletedMap[id] = false;
51
41
  });
52
- mutableCurrOnSoftDelete.current({ ...mutableCurrSoftDeletedItems.current, ...currSoftDeletedMap }, { event });
53
- mutableOtherOnSoftDelete.current({ ...mutableOtherSoftDeletedItems.current, ...otherSoftDeletedMap }, { event });
54
- mutableCurrOnSelectionChange.current({}, { event });
42
+ currOnSoftDelete({ ...currSoftDeletedItems, ...currSoftDeletedMap }, { event });
43
+ otherOnSoftDelete({ ...otherSoftDeletedItems, ...otherSoftDeletedMap }, { event });
44
+ currOnSelectionChange({}, { event });
55
45
  },
56
46
  [
57
- mutableCurrSelectionMap,
58
- mutableCurrOnRemove,
59
- mutableCurrOnSelectionChange,
60
- mutableCurrOnSoftDelete,
61
- mutableCurrSoftDeletedItems,
62
- mutableOtherOnAdd,
63
- mutableOtherOnSoftDelete,
64
- mutableOtherSoftDeletedItems,
65
- mutableSelectedItems
47
+ currOnRemove,
48
+ selectedItems,
49
+ otherPanelOnAdd,
50
+ currSelectionMap,
51
+ currOnSoftDelete,
52
+ currSoftDeletedItems,
53
+ otherOnSoftDelete,
54
+ otherSoftDeletedItems,
55
+ currOnSelectionChange
66
56
  ]
67
57
  );
68
- const mutableMoveSelection = useMakeMutable(moveSelection);
69
- return React2.useMemo(() => ({ moveSelection: mutableMoveSelection.current }), [mutableMoveSelection]);
58
+ return React2.useMemo(() => ({ moveSelection }), [moveSelection]);
70
59
  };
71
60
  const useHandleMoveItem = ({ datum, datumInternalMeta, isDestinationPanel }) => {
72
61
  const currSoftDeletedItems = usePropsStore(
@@ -85,36 +74,24 @@ const useHandleMoveItem = ({ datum, datumInternalMeta, isDestinationPanel }) =>
85
74
  (state) => isDestinationPanel ? state.onDestinationRemove : state.onSourceRemove
86
75
  );
87
76
  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
77
  const moveItem = React2.useCallback(
95
78
  (event) => {
96
79
  event.preventDefault();
97
80
  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
- );
81
+ currOnRemove([datum], { event });
82
+ otherPanelOnAdd([datum], { event });
83
+ currOnSoftDelete({ ...currSoftDeletedItems, [datumInternalMeta.hydratedId]: true }, { event });
84
+ otherOnSoftDelete({ ...otherSoftDeletedItems, [datumInternalMeta.hydratedId]: false }, { event });
108
85
  },
109
86
  [
87
+ currOnRemove,
88
+ currOnSoftDelete,
89
+ currSoftDeletedItems,
110
90
  datum,
111
91
  datumInternalMeta.hydratedId,
112
- mutableCurrOnRemove,
113
- mutableCurrOnSoftDelete,
114
- mutableCurrSoftDeletedItems,
115
- mutableOtherOnAdd,
116
- mutableOtherOnSoftDelete,
117
- mutableOtherSoftDeletedItems
92
+ otherOnSoftDelete,
93
+ otherPanelOnAdd,
94
+ otherSoftDeletedItems
118
95
  ]
119
96
  );
120
97
  return moveItem;
@@ -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 { 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;AAC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M,CAAC;AAC9C,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;",
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-v2';\nimport { type DSShuttleV2T } from '../react-desc-prop-types';\nimport { usePropsStore } 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 = usePropsStore((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 = usePropsStore((store) => store.destinationSelectionItemArray);\n const sourceSelectionArray = usePropsStore((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 // movement\n currOnRemove(selectedItems, { event });\n otherPanelOnAdd(selectedItems, { event });\n // soft delete\n const currSoftDeletedMap: DSShuttleV2T.SoftDeletedMap = {};\n const otherSoftDeletedMap: DSShuttleV2T.SoftDeletedMap = {};\n currSelectionMap.forEach((id) => {\n currSoftDeletedMap[id] = true;\n otherSoftDeletedMap[id] = false;\n });\n currOnSoftDelete({ ...currSoftDeletedItems, ...currSoftDeletedMap }, { event });\n otherOnSoftDelete({ ...otherSoftDeletedItems, ...otherSoftDeletedMap }, { event });\n // cleanup\n currOnSelectionChange({}, { event });\n },\n [\n currOnRemove,\n selectedItems,\n otherPanelOnAdd,\n currSelectionMap,\n currOnSoftDelete,\n currSoftDeletedItems,\n otherOnSoftDelete,\n otherSoftDeletedItems,\n currOnSelectionChange,\n ],\n );\n return React.useMemo(() => ({ moveSelection: moveSelection }), [moveSelection]);\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 moveItem = React.useCallback(\n (event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>) => {\n event.preventDefault();\n event.stopPropagation();\n currOnRemove([datum], { event });\n otherPanelOnAdd([datum], { event });\n currOnSoftDelete({ ...currSoftDeletedItems, [datumInternalMeta.hydratedId]: true }, { event });\n otherOnSoftDelete({ ...otherSoftDeletedItems, [datumInternalMeta.hydratedId]: false }, { event });\n },\n [\n currOnRemove,\n currOnSoftDelete,\n currSoftDeletedItems,\n datum,\n datumInternalMeta.hydratedId,\n otherOnSoftDelete,\n otherPanelOnAdd,\n otherSoftDeletedItems,\n ],\n );\n return moveItem;\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACEvB,OAAOA,YAAW;AAGlB,SAAS,qBAAqB;AAEvB,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,mBAAmB;AAAA,IAAc,CAAC,UACtC,qBAAqB,MAAM,4BAA4B,MAAM;AAAA,EAC/D;AACA,QAAM,wBAAwB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,MAAM;AAAA,EAC5D;AACA,QAAM,mBAAmB;AAAA,IAAc,CAAC,UACtC,qBAAqB,MAAM,0BAA0B,MAAM;AAAA,EAC7D;AACA,QAAM,oBAAoB;AAAA,IAAc,CAAC,UACvC,qBAAqB,MAAM,qBAAqB,MAAM;AAAA,EACxD;AAEA,QAAM,eAAe;AAAA,IAAc,CAAC,UAClC,qBAAqB,MAAM,sBAAsB,MAAM;AAAA,EACzD;AACA,QAAM,kBAAkB,cAAc,CAAC,UAAW,qBAAqB,MAAM,cAAc,MAAM,gBAAiB;AAElH,QAAM,WAAWA,OAAM;AAAA,IACrB,CAAC,UAAwF;AACvF,YAAM,eAAe;AACrB,YAAM,gBAAgB;AACtB,mBAAa,CAAC,KAAK,GAAG,EAAE,MAAM,CAAC;AAC/B,sBAAgB,CAAC,KAAK,GAAG,EAAE,MAAM,CAAC;AAClC,uBAAiB,EAAE,GAAG,sBAAsB,CAAC,kBAAkB,aAAa,KAAK,GAAG,EAAE,MAAM,CAAC;AAC7F,wBAAkB,EAAE,GAAG,uBAAuB,CAAC,kBAAkB,aAAa,MAAM,GAAG,EAAE,MAAM,CAAC;AAAA,IAClG;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,kBAAkB;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;",
6
6
  "names": ["React"]
7
7
  }
@@ -4,7 +4,8 @@ const configureDestination = ({
4
4
  destinationData,
5
5
  destinationSelectedItems,
6
6
  destinationSoftDeletedItems,
7
- getId
7
+ getId,
8
+ getPreventMove
8
9
  }) => {
9
10
  const destinationSelectedItemsMap = {};
10
11
  const destinationSelectionArray = [];
@@ -14,6 +15,7 @@ const configureDestination = ({
14
15
  const destinationSelectionableData = [];
15
16
  destinationData.forEach((datum, i) => {
16
17
  const hydratedId = getId(datum);
18
+ const hydratedPreventMove = getPreventMove?.(datum) ?? false;
17
19
  let isSelected = false;
18
20
  if (destinationSelectedItems[hydratedId] === true) {
19
21
  destinationSelectionItemArray.push(datum);
@@ -27,6 +29,7 @@ const configureDestination = ({
27
29
  destinationSelectedItemsMap[hydratedId] = { datum, index: i };
28
30
  const configuredItem = {
29
31
  hydratedId,
32
+ hydratedPreventMove,
30
33
  isSelected,
31
34
  softDeleted,
32
35
  original: datum,
@@ -35,7 +38,7 @@ const configureDestination = ({
35
38
  isLast: i === destinationData.length - 1
36
39
  };
37
40
  destinationConfiguredData.push(configuredItem);
38
- if (!datum.preventMove) {
41
+ if (!hydratedPreventMove && !softDeleted) {
39
42
  destinationSelectionableData.push(configuredItem);
40
43
  destinationSelectionableDataIds.push(`${hydratedId}`);
41
44
  }
@@ -53,7 +56,13 @@ const configureDestination = ({
53
56
  destinationSelectionableIds
54
57
  };
55
58
  };
56
- const configureSource = ({ sourceData, sourceSelectedItems, sourceSoftDeletedItems, getId }) => {
59
+ const configureSource = ({
60
+ sourceData,
61
+ sourceSelectedItems,
62
+ sourceSoftDeletedItems,
63
+ getId,
64
+ getPreventMove
65
+ }) => {
57
66
  const sourceSelectedItemsMap = {};
58
67
  const sourceSelectionArray = [];
59
68
  const sourceSelectionableDataIds = [];
@@ -62,6 +71,7 @@ const configureSource = ({ sourceData, sourceSelectedItems, sourceSoftDeletedIte
62
71
  const sourceSelectionableData = [];
63
72
  sourceData.forEach((datum, i) => {
64
73
  const hydratedId = getId(datum);
74
+ const hydratedPreventMove = getPreventMove?.(datum) ?? false;
65
75
  let isSelected = false;
66
76
  if (sourceSelectedItems[hydratedId] === true) {
67
77
  sourceSelectionItemArray.push(datum);
@@ -75,6 +85,7 @@ const configureSource = ({ sourceData, sourceSelectedItems, sourceSoftDeletedIte
75
85
  sourceSelectedItemsMap[hydratedId] = { datum, index: i };
76
86
  const configuredItem = {
77
87
  hydratedId,
88
+ hydratedPreventMove,
78
89
  isSelected,
79
90
  softDeleted,
80
91
  original: datum,
@@ -83,7 +94,7 @@ const configureSource = ({ sourceData, sourceSelectedItems, sourceSoftDeletedIte
83
94
  isLast: i === sourceData.length - 1
84
95
  };
85
96
  sourceConfiguredData.push(configuredItem);
86
- if (!datum.preventMove) {
97
+ if (!hydratedPreventMove && !softDeleted) {
87
98
  sourceSelectionableData.push(configuredItem);
88
99
  sourceSelectionableDataIds.push(`${hydratedId}`);
89
100
  }
@@ -108,19 +119,27 @@ const useDataStructure = (propsFromUser) => {
108
119
  destinationData,
109
120
  destinationSelectedItems,
110
121
  getId,
122
+ getPreventMove,
111
123
  sourceSoftDeletedItems,
112
124
  destinationSoftDeletedItems
113
125
  } = propsFromUser;
114
126
  return useMemo(
115
127
  () => ({
116
- ...configureSource({ sourceData, sourceSelectedItems, sourceSoftDeletedItems, getId }),
117
- ...configureDestination({ destinationData, destinationSelectedItems, destinationSoftDeletedItems, getId })
128
+ ...configureSource({ sourceData, sourceSelectedItems, sourceSoftDeletedItems, getId, getPreventMove }),
129
+ ...configureDestination({
130
+ destinationData,
131
+ destinationSelectedItems,
132
+ destinationSoftDeletedItems,
133
+ getId,
134
+ getPreventMove
135
+ })
118
136
  }),
119
137
  [
120
138
  sourceData,
121
139
  sourceSelectedItems,
122
140
  sourceSoftDeletedItems,
123
141
  getId,
142
+ getPreventMove,
124
143
  destinationData,
125
144
  destinationSelectedItems,
126
145
  destinationSoftDeletedItems
@@ -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\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;AAEtE,kBAAgB,QAAQ,CAAC,OAAO,MAAM;AACpC,UAAM,aAAa,MAAM,KAAK;AAC9B,QAAI,aAAa;AACjB,QAAI,yBAAyB,gBAAgB,MAAM;AACjD,oCAA8B,KAAK,KAAK;AACxC,gCAA0B,KAAK,UAAU;AACzC,mBAAa;AAAA,IACf;AACA,QAAI,cAAc;AAClB,QAAI,4BAA4B,gBAAgB,MAAM;AACpD,oBAAc;AAAA,IAChB;AACA,gCAA4B,cAAc,EAAE,OAAO,OAAO,EAAE;AAC5D,UAAM,iBAAiB;AAAA,MACrB;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,SAAS,MAAM;AAAA,MACf,QAAQ,MAAM,gBAAgB,SAAS;AAAA,IACzC;AACA,8BAA0B,KAAK,cAAc;AAC7C,QAAI,CAAC,MAAM,aAAa;AACtB,mCAA6B,KAAK,cAAc;AAChD,sCAAgC,KAAK,GAAG,YAAY;AAAA,IACtD;AAAA,EACF,CAAC;AACD,QAAM,sCAAsC,0BAA0B,UAAU;AAChF,QAAM,8BAA8B,gCAAgC,KAAK,GAAG;AAE5E,SAAO;AAAA,IACL;AAAA,IACA;AAA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AA,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;",
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 getPreventMove: DSShuttleV2T.FunctionalHydraters['getPreventMove'];\n};\nconst configureDestination = ({\n destinationData,\n destinationSelectedItems,\n destinationSoftDeletedItems,\n getId,\n getPreventMove,\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 const hydratedPreventMove = getPreventMove?.(datum) ?? false;\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 hydratedPreventMove,\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 (!hydratedPreventMove && !softDeleted) {\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 getPreventMove: DSShuttleV2T.FunctionalHydraters['getPreventMove'];\n};\n\nconst configureSource = ({\n sourceData,\n sourceSelectedItems,\n sourceSoftDeletedItems,\n getId,\n getPreventMove,\n}: 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 const hydratedPreventMove = getPreventMove?.(datum) ?? false;\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 hydratedPreventMove,\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 (!hydratedPreventMove && !softDeleted) {\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 getPreventMove,\n sourceSoftDeletedItems,\n destinationSoftDeletedItems,\n } = propsFromUser;\n return useMemo(\n () => ({\n ...configureSource({ sourceData, sourceSelectedItems, sourceSoftDeletedItems, getId, getPreventMove }),\n ...configureDestination({\n destinationData,\n destinationSelectedItems,\n destinationSoftDeletedItems,\n getId,\n getPreventMove,\n }),\n }),\n [\n sourceData,\n sourceSelectedItems,\n sourceSoftDeletedItems,\n getId,\n getPreventMove,\n destinationData,\n destinationSelectedItems,\n destinationSoftDeletedItems,\n ],\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,eAAe;AAUxB,MAAM,uBAAuB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;A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AAA,MACrG,GAAG,qBAAqB;AAAA,QACtB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,5 @@
1
1
  import * as React from "react";
2
2
  import { useMemo, useCallback } from "react";
3
- import { useMakeMutable } from "@elliemae/ds-utilities";
4
3
  import { ACTIONS_FOCUSES } from "../../constants";
5
4
  import { useInternalStore, usePropsStore } from "../useStore";
6
5
  const getMoveBtnActionByProxymity = (flags) => {
@@ -71,40 +70,38 @@ const getActionByProxymity = ({ flags, currentAction }) => {
71
70
  return getParenBtnActionByProxymity(flags);
72
71
  };
73
72
  const useFocusActionTrackers = () => {
74
- const focusItemAction = useInternalStore((state) => state.focusItemAction);
75
- const mutableFocusItemAction = useMakeMutable(focusItemAction);
73
+ const getFocusItemAction = useInternalStore((state) => state.getFocusItemAction);
76
74
  const setFocusItemAction = useInternalStore((state) => state.setFocusItemAction);
77
75
  const removeDragAndDropFromDestination = usePropsStore((state) => state.removeDragAndDropFromDestination);
78
76
  const addDragAndDropFromSource = usePropsStore((state) => state.addDragAndDropFromSource);
79
77
  const trackFocusPrevAction = useCallback(
80
- ({ isDestinationPanel, datumHydratables }) => {
81
- const preventMove = Boolean(datumHydratables.preventMove);
78
+ ({ isDestinationPanel, datumHydratables, datumInternalMeta: { hydratedPreventMove } }) => {
79
+ const preventMove = Boolean(hydratedPreventMove);
82
80
  const preventDrilldown = Boolean(datumHydratables.preventDrilldown);
83
81
  const withDragAndDrop = isDestinationPanel && !removeDragAndDropFromDestination || !isDestinationPanel && addDragAndDropFromSource;
84
82
  const { prevAction } = getActionByProxymity({
85
83
  flags: { preventMove, preventDrilldown, withDragAndDrop },
86
- currentAction: mutableFocusItemAction.current
84
+ currentAction: getFocusItemAction()
87
85
  });
88
86
  setFocusItemAction(prevAction);
89
87
  },
90
- [addDragAndDropFromSource, mutableFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction]
88
+ [addDragAndDropFromSource, getFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction]
91
89
  );
92
90
  const trackFocusNextAction = useCallback(
93
- ({ isDestinationPanel, datumHydratables }) => {
94
- const preventMove = Boolean(datumHydratables.preventMove);
91
+ ({ isDestinationPanel, datumHydratables, datumInternalMeta: { hydratedPreventMove } }) => {
92
+ const preventMove = Boolean(hydratedPreventMove);
95
93
  const preventDrilldown = Boolean(datumHydratables.preventDrilldown);
96
94
  const withDragAndDrop = isDestinationPanel && !removeDragAndDropFromDestination || !isDestinationPanel && addDragAndDropFromSource;
97
95
  const { nextAction } = getActionByProxymity({
98
96
  flags: { preventMove, preventDrilldown, withDragAndDrop },
99
- currentAction: mutableFocusItemAction.current
97
+ currentAction: getFocusItemAction()
100
98
  });
101
99
  setFocusItemAction(nextAction);
102
100
  },
103
- [addDragAndDropFromSource, mutableFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction]
101
+ [addDragAndDropFromSource, getFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction]
104
102
  );
105
103
  return useMemo(
106
104
  () => ({
107
- mutableFocusItemAction,
108
105
  trackFocusActionMove: () => setFocusItemAction("move-btn"),
109
106
  trackFocusActionDrilldown: () => setFocusItemAction("drilldown-btn"),
110
107
  trackFocusActionDragAndDrop: () => setFocusItemAction("drag-n-drop"),
@@ -113,7 +110,7 @@ const useFocusActionTrackers = () => {
113
110
  trackFocusPrevAction,
114
111
  trackFocusNextAction
115
112
  }),
116
- [mutableFocusItemAction, setFocusItemAction, trackFocusNextAction, trackFocusPrevAction]
113
+ [setFocusItemAction, trackFocusNextAction, trackFocusPrevAction]
117
114
  );
118
115
  };
119
116
  export {
@@ -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, 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,gBAAgB;AAAA;AACvD,cAAU,aAAa,gBAAgB;AAC5C,SAAO;AACT;AACA,MAAM,qCAAqC,CAAC,UAAuB;AAEjE,QAAM,EAAE,aAAa,iBAAiB,IAAI;AAG1C,QAAM,YAAY,EAAE,YAAY,IAAI,YAAY,gBAAgB,OAAO;AAKvE,MAAI,CAAC;AAAa,cAAU,aAAa,gBAAgB;AAAA,WAChD,CAAC;AAAkB,cAAU,aAAa,gBAAgB;AAAA;AAC9D,cAAU,aAAa,gBAAgB;AAC5C,SAAO;AACT;AACA,MAAM,mCAAmC,CAAC,UAAuB;AAE/D,QAAM,EAAE,iBAAiB,YAAY,IAAI;AAGzC,QAAM,YAAY,EAAE,YAAY,gBAAgB,QAAQ,YAAY,GAAG;AAKvE,MAAI,CAAC;AAAa,cAAU,aAAa,gBAAgB;AAAA,WAChD;AAAiB,cAAU,aAAa,gBAAgB;AAAA;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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,QAAM,uBAAuB;AAAA,IAC3B,CAAC,EAAE,oBAAoB,iBAAiB,MAA6B;AACnE,YAAM,cAAc,QAAQ,iBAAiB,WAAW;AACxD,YAAM,mBAAmB,QAAQ,iBAAiB,gBAAgB;AAClE,YAAM,kBACH,sBAAsB,CAAC,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 { 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 getFocusItemAction = useInternalStore((state) => state.getFocusItemAction);\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, datumInternalMeta: { hydratedPreventMove } }: DSShuttleV2T.ItemMeta) => {\n const preventMove = Boolean(hydratedPreventMove);\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: getFocusItemAction(),\n });\n setFocusItemAction(prevAction);\n },\n [addDragAndDropFromSource, getFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction],\n );\n const trackFocusNextAction = useCallback(\n ({ isDestinationPanel, datumHydratables, datumInternalMeta: { hydratedPreventMove } }: DSShuttleV2T.ItemMeta) => {\n const preventMove = Boolean(hydratedPreventMove);\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: getFocusItemAction(),\n });\n setFocusItemAction(nextAction);\n },\n [addDragAndDropFromSource, getFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction],\n );\n return useMemo(\n () => ({\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 [setFocusItemAction, trackFocusNextAction, trackFocusPrevAction],\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,SAAS,mBAAmB;AAErC,SAAS,uBAAuB;AAChC,SAAS,kBAAkB,qBAAqB;AAWhD,MAAM,8BAA8B,CAAC,UAA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E,YAAM,kBACH,sBAAsB,CAAC,oCAAsC,CAAC,sBAAsB;AACvF,YAAM,EAAE,WAAW,IAAI,qBAAqB;AAAA,QAC1C,OAAO,EAAE,aAAa,kBAAkB,gBAAgB;AAAA,QACxD,eAAe,mBAAmB;AAAA,MACpC,CAAC;AACD,yBAAmB,UAAU;AAAA,IAC/B;AAAA,IACA,CAAC,0BAA0B,oBAAoB,kCAAkC,kBAAkB;AAAA,EACrG;AACA,SAAO;AAAA,IACL,OAAO;AAAA,MACL,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,oBAAoB,sBAAsB,oBAAoB;AAAA,EACjE;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,39 +1,20 @@
1
1
  import * as React from "react";
2
2
  import { useMemo, useCallback } from "react";
3
- import { useMakeMutable } from "@elliemae/ds-utilities";
4
3
  import { useInternalStore, usePropsStore } from "../useStore";
5
4
  import { ITEMS_FOCUSES } from "../../constants/index";
6
5
  const useFocusItemTracker = () => {
7
- const focusItem = useInternalStore((state) => state.focusItem);
8
- const mutableFocusItem = useMakeMutable(focusItem);
6
+ const getFocusItem = useInternalStore((state) => state.getFocusItem);
9
7
  const setFocusItem = useInternalStore((state) => state.setFocusItem);
10
- const sourceData = useInternalStore((state) => state.sourceConfiguredData);
11
- const destinationData = useInternalStore((state) => state.destinationConfiguredData);
8
+ const sourceData = usePropsStore((state) => state.sourceConfiguredData);
9
+ const destinationData = usePropsStore((state) => state.destinationConfiguredData);
12
10
  const sourceWithLoadMore = usePropsStore((state) => state.sourceWithLoadMore);
13
11
  const destinationWithLoadMore = usePropsStore((state) => state.destinationWithLoadMore);
14
12
  const trackFocusPrevItem = useCallback(
15
13
  ({ isDestinationPanel }) => {
14
+ const focusItem = getFocusItem();
16
15
  const referenceData = isDestinationPanel ? destinationData : sourceData;
17
16
  const withLoadMore = isDestinationPanel ? destinationWithLoadMore : sourceWithLoadMore;
18
- if (mutableFocusItem.current === ITEMS_FOCUSES.FIRST) {
19
- if (withLoadMore)
20
- setFocusItem(
21
- isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE
22
- );
23
- else {
24
- const prevItemIndex = referenceData.length > 1 ? referenceData.length - 1 : 0;
25
- const prevItem = referenceData[prevItemIndex];
26
- setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));
27
- }
28
- return;
29
- }
30
- if (mutableFocusItem.current === ITEMS_FOCUSES.LAST) {
31
- const prevItemIndex = referenceData.length > 2 ? referenceData.length - 2 : 0;
32
- const prevItem = referenceData[prevItemIndex];
33
- setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));
34
- return;
35
- }
36
- const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === mutableFocusItem.current);
17
+ const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === focusItem);
37
18
  if (currentItemIndex === 0 && withLoadMore)
38
19
  setFocusItem(isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE);
39
20
  else if (currentItemIndex !== -1) {
@@ -46,31 +27,14 @@ const useFocusItemTracker = () => {
46
27
  setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));
47
28
  }
48
29
  },
49
- [destinationData, destinationWithLoadMore, mutableFocusItem, setFocusItem, sourceData, sourceWithLoadMore]
30
+ [destinationData, destinationWithLoadMore, getFocusItem, setFocusItem, sourceData, sourceWithLoadMore]
50
31
  );
51
32
  const trackFocusNextItem = useCallback(
52
33
  ({ isDestinationPanel }) => {
34
+ const focusItem = getFocusItem();
53
35
  const referenceData = isDestinationPanel ? destinationData : sourceData;
54
36
  const withLoadMore = isDestinationPanel ? destinationWithLoadMore : sourceWithLoadMore;
55
- if (mutableFocusItem.current === ITEMS_FOCUSES.FIRST) {
56
- const nextItemIndex = referenceData.length > 1 ? 1 : 0;
57
- const nextItem = referenceData[nextItemIndex];
58
- setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));
59
- return;
60
- }
61
- if (mutableFocusItem.current === ITEMS_FOCUSES.LAST) {
62
- if (withLoadMore)
63
- setFocusItem(
64
- isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE
65
- );
66
- else {
67
- const nextItemIndex = 0;
68
- const nextItem = referenceData[nextItemIndex];
69
- setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));
70
- }
71
- return;
72
- }
73
- const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === mutableFocusItem.current);
37
+ const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === focusItem);
74
38
  if (currentItemIndex === referenceData.length - 1 && withLoadMore)
75
39
  setFocusItem(isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE);
76
40
  else if (currentItemIndex !== -1) {
@@ -83,21 +47,24 @@ const useFocusItemTracker = () => {
83
47
  setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));
84
48
  }
85
49
  },
86
- [destinationData, destinationWithLoadMore, mutableFocusItem, setFocusItem, sourceData, sourceWithLoadMore]
50
+ [destinationData, destinationWithLoadMore, getFocusItem, setFocusItem, sourceData, sourceWithLoadMore]
87
51
  );
88
52
  return useMemo(
89
53
  () => ({
90
- mutableFocusItem,
91
54
  trackFocusItem: (item) => setFocusItem(item.hydratedId),
92
55
  trackFocusItemReset: () => setFocusItem(ITEMS_FOCUSES.RESET),
93
- trackFocusItemFirst: () => setFocusItem(ITEMS_FOCUSES.FIRST),
94
- trackFocusItemLast: () => setFocusItem(ITEMS_FOCUSES.LAST),
56
+ trackFocusItemFirst: ({ isDestinationPanel }) => setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(isDestinationPanel ? destinationData[0] : sourceData[0])),
57
+ trackFocusItemLast: ({ isDestinationPanel }) => setFocusItem(
58
+ ITEMS_FOCUSES.GET_SPECIFIC_ITEM(
59
+ isDestinationPanel ? destinationData[destinationData.length - 1] : sourceData[sourceData.length - 1]
60
+ )
61
+ ),
95
62
  trackFocusLoadMoreBtnDestination: () => setFocusItem(ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION),
96
63
  trackFocusLoadMoreBtn: () => setFocusItem(ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE),
97
64
  trackFocusPrevItem,
98
65
  trackFocusNextItem
99
66
  }),
100
- [mutableFocusItem, setFocusItem, trackFocusNextItem, trackFocusPrevItem]
67
+ [destinationData, setFocusItem, sourceData, trackFocusNextItem, trackFocusPrevItem]
101
68
  );
102
69
  };
103
70
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/config/useFocusTracker/useFocusItemTracker.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-statements */\n/* eslint-disable complexity */\nimport { useMemo, useCallback } from 'react';\nimport { useMakeMutable } from '@elliemae/ds-utilities';\nimport { type DSShuttleV2T } from '../../react-desc-prop-types';\nimport { useInternalStore, usePropsStore } from '../useStore';\nimport { ITEMS_FOCUSES } from '../../constants/index';\n\nexport const useFocusItemTracker = () => {\n const focusItem = useInternalStore((state) => state.focusItem);\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 mutableFocusItem = useMakeMutable(focusItem);\n const setFocusItem = useInternalStore((state) => state.setFocusItem);\n const sourceData = useInternalStore((state) => state.sourceConfiguredData);\n const destinationData = useInternalStore((state) => state.destinationConfiguredData);\n const sourceWithLoadMore = usePropsStore((state) => state.sourceWithLoadMore);\n const destinationWithLoadMore = usePropsStore((state) => state.destinationWithLoadMore);\n const trackFocusPrevItem = useCallback(\n ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) => {\n const referenceData = isDestinationPanel ? destinationData : sourceData;\n const withLoadMore = isDestinationPanel ? destinationWithLoadMore : sourceWithLoadMore;\n if (mutableFocusItem.current === ITEMS_FOCUSES.FIRST) {\n if (withLoadMore)\n setFocusItem(\n isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE,\n );\n else {\n const prevItemIndex = referenceData.length > 1 ? referenceData.length - 1 : 0;\n const prevItem = referenceData[prevItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));\n }\n return;\n }\n if (mutableFocusItem.current === ITEMS_FOCUSES.LAST) {\n const prevItemIndex = referenceData.length > 2 ? referenceData.length - 2 : 0;\n const prevItem = referenceData[prevItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));\n return;\n }\n // loop logic\n const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === mutableFocusItem.current);\n if (currentItemIndex === 0 && withLoadMore)\n setFocusItem(isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE);\n else if (currentItemIndex !== -1) {\n const prevItemIndex = currentItemIndex === 0 ? referenceData.length - 1 : currentItemIndex - 1;\n const prevItem = referenceData[prevItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));\n } else {\n const prevItemIndex = 0;\n const prevItem = referenceData[prevItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));\n }\n },\n [destinationData, destinationWithLoadMore, mutableFocusItem, setFocusItem, sourceData, sourceWithLoadMore],\n );\n const trackFocusNextItem = useCallback(\n ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) => {\n const referenceData = isDestinationPanel ? destinationData : sourceData;\n const withLoadMore = isDestinationPanel ? destinationWithLoadMore : sourceWithLoadMore;\n if (mutableFocusItem.current === ITEMS_FOCUSES.FIRST) {\n // \"next\" after the first is position 1,\n // if position 1 exist,\n // else is the \"first\" (position 0) looped back\n const nextItemIndex = referenceData.length > 1 ? 1 : 0;\n const nextItem = referenceData[nextItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));\n return;\n }\n if (mutableFocusItem.current === ITEMS_FOCUSES.LAST) {\n if (withLoadMore)\n setFocusItem(\n isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE,\n );\n else {\n const nextItemIndex = 0;\n const nextItem = referenceData[nextItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));\n }\n return;\n }\n // focus loop logic\n const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === mutableFocusItem.current);\n if (currentItemIndex === referenceData.length - 1 && withLoadMore)\n setFocusItem(isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE);\n else if (currentItemIndex !== -1) {\n const nextItemIndex = currentItemIndex === referenceData.length - 1 ? 0 : currentItemIndex + 1;\n const nextItem = referenceData[nextItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));\n } else {\n const nextItemIndex = referenceData.length - 1;\n const nextItem = referenceData[nextItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));\n }\n },\n [destinationData, destinationWithLoadMore, mutableFocusItem, setFocusItem, sourceData, sourceWithLoadMore],\n );\n return useMemo(\n () => ({\n mutableFocusItem,\n trackFocusItem: (item: DSShuttleV2T.ConfiguredDatum) => setFocusItem(item.hydratedId),\n trackFocusItemReset: () => setFocusItem(ITEMS_FOCUSES.RESET),\n trackFocusItemFirst: () => setFocusItem(ITEMS_FOCUSES.FIRST),\n trackFocusItemLast: () => setFocusItem(ITEMS_FOCUSES.LAST),\n trackFocusLoadMoreBtnDestination: () => setFocusItem(ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION),\n trackFocusLoadMoreBtn: () => setFocusItem(ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE),\n trackFocusPrevItem,\n trackFocusNextItem,\n }),\n [mutableFocusItem, setFocusItem, trackFocusNextItem, trackFocusPrevItem],\n );\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,SAAS,mBAAmB;AACrC,SAAS,sBAAsB;AAE/B,SAAS,kBAAkB,qBAAqB;AAChD,SAAS,qBAAqB;AAEvB,MAAM,sBAAsB,MAAM;AACvC,QAAM,YAAY,iBAAiB,CAAC,UAAU,MAAM,SAAS;AAK7D,QAAM,mBAAmB,eAAe,SAAS;AACjD,QAAM,eAAe,iBAAiB,CAAC,UAAU,MAAM,YAAY;AACnE,QAAM,aAAa,iBAAiB,CAAC,UAAU,MAAM,oBAAoB;AACzE,QAAM,kBAAkB,iBAAiB,CAAC,UAAU,MAAM,yBAAyB;AACnF,QAAM,qBAAqB,cAAc,CAAC,UAAU,MAAM,kBAAkB;AAC5E,QAAM,0BAA0B,cAAc,CAAC,UAAU,MAAM,uBAAuB;AACtF,QAAM,qBAAqB;AAAA,IACzB,CAAC,EAAE,mBAAmB,MAAkC;AACtD,YAAM,gBAAgB,qBAAqB,kBAAkB;AAC7D,YAAM,eAAe,qBAAqB,0BAA0B;AACpE,UAAI,iBAAiB,YAAY,cAAc,OAAO;AACpD,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int-disable complexity */\nimport { useMemo, useCallback } from 'react';\nimport { type DSShuttleV2T } from '../../react-desc-prop-types';\nimport { useInternalStore, usePropsStore } from '../useStore';\nimport { ITEMS_FOCUSES } from '../../constants/index';\n\nexport const useFocusItemTracker = () => {\n const getFocusItem = useInternalStore((state) => state.getFocusItem);\n const setFocusItem = useInternalStore((state) => state.setFocusItem);\n const sourceData = usePropsStore((state) => state.sourceConfiguredData);\n const destinationData = usePropsStore((state) => state.destinationConfiguredData);\n const sourceWithLoadMore = usePropsStore((state) => state.sourceWithLoadMore);\n const destinationWithLoadMore = usePropsStore((state) => state.destinationWithLoadMore);\n const trackFocusPrevItem = useCallback(\n ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) => {\n const focusItem = getFocusItem();\n const referenceData = isDestinationPanel ? destinationData : sourceData;\n const withLoadMore = isDestinationPanel ? destinationWithLoadMore : sourceWithLoadMore;\n // loop logic\n const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === focusItem);\n if (currentItemIndex === 0 && withLoadMore)\n setFocusItem(isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE);\n else if (currentItemIndex !== -1) {\n const prevItemIndex = currentItemIndex === 0 ? referenceData.length - 1 : currentItemIndex - 1;\n const prevItem = referenceData[prevItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));\n } else {\n const prevItemIndex = 0;\n const prevItem = referenceData[prevItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));\n }\n },\n [destinationData, destinationWithLoadMore, getFocusItem, setFocusItem, sourceData, sourceWithLoadMore],\n );\n const trackFocusNextItem = useCallback(\n ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) => {\n const focusItem = getFocusItem();\n const referenceData = isDestinationPanel ? destinationData : sourceData;\n const withLoadMore = isDestinationPanel ? destinationWithLoadMore : sourceWithLoadMore;\n // focus loop logic\n const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === focusItem);\n if (currentItemIndex === referenceData.length - 1 && withLoadMore)\n setFocusItem(isDestinationPanel ? ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE);\n else if (currentItemIndex !== -1) {\n const nextItemIndex = currentItemIndex === referenceData.length - 1 ? 0 : currentItemIndex + 1;\n const nextItem = referenceData[nextItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));\n } else {\n const nextItemIndex = referenceData.length - 1;\n const nextItem = referenceData[nextItemIndex];\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));\n }\n },\n [destinationData, destinationWithLoadMore, getFocusItem, setFocusItem, sourceData, sourceWithLoadMore],\n );\n return useMemo(\n () => ({\n trackFocusItem: (item: DSShuttleV2T.ConfiguredDatum) => setFocusItem(item.hydratedId),\n trackFocusItemReset: () => setFocusItem(ITEMS_FOCUSES.RESET),\n trackFocusItemFirst: ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) =>\n setFocusItem(ITEMS_FOCUSES.GET_SPECIFIC_ITEM(isDestinationPanel ? destinationData[0] : sourceData[0])),\n trackFocusItemLast: ({ isDestinationPanel }: DSShuttleV2T.PanelMetaInfo) =>\n setFocusItem(\n ITEMS_FOCUSES.GET_SPECIFIC_ITEM(\n isDestinationPanel ? destinationData[destinationData.length - 1] : sourceData[sourceData.length - 1],\n ),\n ),\n trackFocusLoadMoreBtnDestination: () => setFocusItem(ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION),\n trackFocusLoadMoreBtn: () => setFocusItem(ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE),\n trackFocusPrevItem,\n trackFocusNextItem,\n }),\n [destinationData, setFocusItem, sourceData, trackFocusNextItem, trackFocusPrevItem],\n );\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACE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