@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.
- package/dist/cjs/config/DSShuttleV2Definitions.js +2 -1
- package/dist/cjs/config/DSShuttleV2Definitions.js.map +2 -2
- package/dist/cjs/config/itemMovementHelpers.js +29 -52
- package/dist/cjs/config/itemMovementHelpers.js.map +2 -2
- package/dist/cjs/config/useAutoCalculated/useDataStructure.js +25 -6
- package/dist/cjs/config/useAutoCalculated/useDataStructure.js.map +2 -2
- package/dist/cjs/config/useFocusTracker/useFocusActionTrackers.js +10 -13
- package/dist/cjs/config/useFocusTracker/useFocusActionTrackers.js.map +2 -2
- package/dist/cjs/config/useFocusTracker/useFocusItemTracker.js +16 -49
- package/dist/cjs/config/useFocusTracker/useFocusItemTracker.js.map +2 -2
- package/dist/cjs/config/useFocusTracker/useFocusRegionTrackers.js +1 -5
- package/dist/cjs/config/useFocusTracker/useFocusRegionTrackers.js.map +2 -2
- package/dist/cjs/config/useStore/focusAndTabIndexManager.js +73 -0
- package/dist/cjs/config/useStore/focusAndTabIndexManager.js.map +7 -0
- package/dist/cjs/config/useStore/useStore.js +13 -0
- package/dist/cjs/config/useStore/useStore.js.map +3 -3
- package/dist/cjs/constants/index.js +1 -3
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/parts/Dnd/DndHandle.js +5 -1
- package/dist/cjs/parts/Dnd/DndHandle.js.map +2 -2
- package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js +14 -12
- package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js.map +2 -2
- package/dist/cjs/parts/Item/Item.js +44 -39
- package/dist/cjs/parts/Item/Item.js.map +2 -2
- package/dist/cjs/parts/Item/ItemActions/ItemActions.js +6 -6
- package/dist/cjs/parts/Item/ItemActions/ItemActions.js.map +2 -2
- package/dist/cjs/parts/Item/ItemActions/useInnerRefHandlers.js +8 -23
- package/dist/cjs/parts/Item/ItemActions/useInnerRefHandlers.js.map +2 -2
- package/dist/cjs/parts/Item/ItemOverlay.js +2 -1
- package/dist/cjs/parts/Item/ItemOverlay.js.map +2 -2
- package/dist/cjs/parts/Item/useItemArrowNavigation.js +7 -22
- package/dist/cjs/parts/Item/useItemArrowNavigation.js.map +2 -2
- package/dist/cjs/parts/Item/useSelectionLogic.js +1 -1
- package/dist/cjs/parts/Item/useSelectionLogic.js.map +2 -2
- package/dist/cjs/parts/MainContent.js +2 -2
- package/dist/cjs/parts/MainContent.js.map +2 -2
- package/dist/cjs/parts/Panel/bottom/LoadMoreBtn.js +2 -8
- package/dist/cjs/parts/Panel/bottom/LoadMoreBtn.js.map +2 -2
- package/dist/cjs/parts/Panel/bottom/useInnerRefHandlers.js +7 -12
- package/dist/cjs/parts/Panel/bottom/useInnerRefHandlers.js.map +2 -2
- package/dist/cjs/parts/Panel/middle/ItemListWrapper/Index.js +3 -12
- package/dist/cjs/parts/Panel/middle/ItemListWrapper/Index.js.map +2 -2
- package/dist/cjs/parts/Panel/middle/ItemListWrapper/useGetDatumHydratables.js +3 -4
- package/dist/cjs/parts/Panel/middle/ItemListWrapper/useGetDatumHydratables.js.map +2 -2
- package/dist/cjs/parts/Panel/middle/MultipleSelectionAction.js +3 -7
- package/dist/cjs/parts/Panel/middle/MultipleSelectionAction.js.map +2 -2
- package/dist/cjs/parts/Panel/middle/PanelContentMiddleSection.js +21 -19
- package/dist/cjs/parts/Panel/middle/PanelContentMiddleSection.js.map +2 -2
- package/dist/cjs/parts/Panel/top/SelectionHeader.js +3 -3
- package/dist/cjs/parts/Panel/top/SelectionHeader.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +52 -2
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/esm/config/DSShuttleV2Definitions.js +2 -1
- package/dist/esm/config/DSShuttleV2Definitions.js.map +2 -2
- package/dist/esm/config/itemMovementHelpers.js +30 -53
- package/dist/esm/config/itemMovementHelpers.js.map +2 -2
- package/dist/esm/config/useAutoCalculated/useDataStructure.js +25 -6
- package/dist/esm/config/useAutoCalculated/useDataStructure.js.map +2 -2
- package/dist/esm/config/useFocusTracker/useFocusActionTrackers.js +10 -13
- package/dist/esm/config/useFocusTracker/useFocusActionTrackers.js.map +2 -2
- package/dist/esm/config/useFocusTracker/useFocusItemTracker.js +16 -49
- package/dist/esm/config/useFocusTracker/useFocusItemTracker.js.map +2 -2
- package/dist/esm/config/useFocusTracker/useFocusRegionTrackers.js +1 -5
- package/dist/esm/config/useFocusTracker/useFocusRegionTrackers.js.map +2 -2
- package/dist/esm/config/useStore/focusAndTabIndexManager.js +47 -0
- package/dist/esm/config/useStore/focusAndTabIndexManager.js.map +7 -0
- package/dist/esm/config/useStore/useStore.js +13 -0
- package/dist/esm/config/useStore/useStore.js.map +2 -2
- package/dist/esm/constants/index.js +1 -3
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/parts/Dnd/DndHandle.js +5 -1
- package/dist/esm/parts/Dnd/DndHandle.js.map +2 -2
- package/dist/esm/parts/HoC/withConditionalDnDRowContext.js +14 -12
- package/dist/esm/parts/HoC/withConditionalDnDRowContext.js.map +2 -2
- package/dist/esm/parts/Item/Item.js +44 -39
- package/dist/esm/parts/Item/Item.js.map +2 -2
- package/dist/esm/parts/Item/ItemActions/ItemActions.js +6 -6
- package/dist/esm/parts/Item/ItemActions/ItemActions.js.map +2 -2
- package/dist/esm/parts/Item/ItemActions/useInnerRefHandlers.js +8 -23
- package/dist/esm/parts/Item/ItemActions/useInnerRefHandlers.js.map +2 -2
- package/dist/esm/parts/Item/ItemOverlay.js +2 -1
- package/dist/esm/parts/Item/ItemOverlay.js.map +2 -2
- package/dist/esm/parts/Item/useItemArrowNavigation.js +7 -22
- package/dist/esm/parts/Item/useItemArrowNavigation.js.map +2 -2
- package/dist/esm/parts/Item/useSelectionLogic.js +1 -1
- package/dist/esm/parts/Item/useSelectionLogic.js.map +2 -2
- package/dist/esm/parts/MainContent.js +3 -3
- package/dist/esm/parts/MainContent.js.map +2 -2
- package/dist/esm/parts/Panel/bottom/LoadMoreBtn.js +2 -8
- package/dist/esm/parts/Panel/bottom/LoadMoreBtn.js.map +2 -2
- package/dist/esm/parts/Panel/bottom/useInnerRefHandlers.js +7 -12
- package/dist/esm/parts/Panel/bottom/useInnerRefHandlers.js.map +2 -2
- package/dist/esm/parts/Panel/middle/ItemListWrapper/Index.js +4 -13
- package/dist/esm/parts/Panel/middle/ItemListWrapper/Index.js.map +2 -2
- package/dist/esm/parts/Panel/middle/ItemListWrapper/useGetDatumHydratables.js +3 -4
- package/dist/esm/parts/Panel/middle/ItemListWrapper/useGetDatumHydratables.js.map +2 -2
- package/dist/esm/parts/Panel/middle/MultipleSelectionAction.js +3 -7
- package/dist/esm/parts/Panel/middle/MultipleSelectionAction.js.map +2 -2
- package/dist/esm/parts/Panel/middle/PanelContentMiddleSection.js +21 -19
- package/dist/esm/parts/Panel/middle/PanelContentMiddleSection.js.map +2 -2
- package/dist/esm/parts/Panel/top/SelectionHeader.js +4 -4
- package/dist/esm/parts/Panel/top/SelectionHeader.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +52 -2
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/types/config/DSShuttleV2Definitions.d.ts +1 -0
- package/dist/types/config/useFocusTracker/useFocusActionTrackers.d.ts +2 -4
- package/dist/types/config/useFocusTracker/useFocusItemTracker.d.ts +2 -6
- package/dist/types/config/useFocusTracker/useFocusRegionTrackers.d.ts +0 -2
- package/dist/types/config/useFocusTracker/useFocusTracker.d.ts +4 -10
- package/dist/types/config/useStore/focusAndTabIndexManager.d.ts +10 -0
- package/dist/types/config/useStore/useStore.d.ts +35 -60
- package/dist/types/constants/index.d.ts +1 -3
- package/dist/types/parts/Dnd/DndHandle.d.ts +3 -3
- package/dist/types/parts/Item/ItemActions/useActionsHandlers.d.ts +2 -2
- package/dist/types/parts/Item/ItemActions/useInnerRefHandlers.d.ts +0 -2
- package/dist/types/parts/Panel/bottom/useInnerRefHandlers.d.ts +0 -1
- package/dist/types/parts/Panel/middle/ItemListWrapper/useGetDatumHydratables.d.ts +1 -1
- package/dist/types/react-desc-prop-types.d.ts +35 -4
- package/package.json +17 -17
- package/dist/cjs/config/useStore/createAtomInStore.bak +0 -18
- package/dist/esm/config/useStore/createAtomInStore.bak +0 -18
|
@@ -62,7 +62,8 @@ const DSShuttleV2Slots = {
|
|
|
62
62
|
AREA_SEARCH_WRAPPER: "area-search-wrapper",
|
|
63
63
|
AREA_SEARCH_BAR: "area-search-bar",
|
|
64
64
|
AREA_SELECTION_HEADER: "area-selection-header",
|
|
65
|
-
AREA_SELECTION_HEADER_COUNT_LABEL: "area-selection-header-count-label"
|
|
65
|
+
AREA_SELECTION_HEADER_COUNT_LABEL: "area-selection-header-count-label",
|
|
66
|
+
DRAG_AND_DROP_HANDLE: "drag-and-drop-handle"
|
|
66
67
|
};
|
|
67
68
|
const DSShuttleV2DataTestIds = (0, import_ds_system.slotObjectToDataTestIds)(DSShuttleV2Name, DSShuttleV2Slots);
|
|
68
69
|
//# sourceMappingURL=DSShuttleV2Definitions.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/DSShuttleV2Definitions.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSShuttleV2Name = 'DSShuttleV2' as const;\n\nexport const DSShuttleV2Slots = {\n HEADER_SEARCH_ICON: 'header-search-icon',\n WRAPPER: 'wrapper',\n PANEL_WRAPPER: 'panel-wrapper',\n LIST_WRAPPER: 'list-wrapper',\n ITEM_WRAPPER: 'item-wrapper',\n ITEM_ICON_WRAPPER: 'item-icon-wrapper',\n ITEM_LABEL_WRAPPER: 'item-label-wrapper',\n ITEM_MIDSECTION_WRAPPER: 'item-midsection-wrapper',\n ITEM_SELECTION: 'item-selection',\n ITEM_ACTIONS_WRAPPER: 'item-actions-wrapper',\n ITEM_ACTION_WRAPPER: 'item-action-wrapper',\n ITEM_ACTION_BTN: 'item-action-btn',\n ITEM_ACTION_BTN_DRILLDOWN_ICON: 'item-action-btn-drilldown-icon',\n ITEM_ACTION_BTN_TO_SOURCE_ICON: 'item-action-btn-to-source-icon',\n ITEM_ACTION_BTN_TO_DESTINATION_ICON: 'item-action-btn-to-destination-icon',\n LIST_BOTTOM_LOADING_MORE: 'list-bottom-loading-more',\n LIST_BOTTOM_LOAD_MORE_BTN: 'list-bottom-load-more-btn',\n LIST_WRAPPER_BOTTOM: 'list-wrapper-bottom',\n EMPTY_LIST_WRAPPER: 'empty-list-wrapper',\n ITEMS_WRAPPER: 'items-wrapper',\n LOADING_LIST_WRAPPER: 'loading-list-wrapper',\n MOVE_MULTIPLE_WRAPPER: 'move-multiple-wrapper',\n MOVE_MULTIPLE_BTN: 'move-multiple-btn',\n LIST_WRAPPER_MID: 'list-wrapper-mid',\n LIST_WRAPPER_MID_SCROLLER: 'list-wrapper-mid-scroller',\n LIST_WRAPPER_TOP: 'list-wrapper-top',\n AREA_SEARCH_WRAPPER: 'area-search-wrapper',\n AREA_SEARCH_BAR: 'area-search-bar',\n AREA_SELECTION_HEADER: 'area-selection-header',\n AREA_SELECTION_HEADER_COUNT_LABEL: 'area-selection-header-count-label',\n} as const;\n\nexport const DSShuttleV2DataTestIds = slotObjectToDataTestIds(DSShuttleV2Name, DSShuttleV2Slots)
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,kBAAkB;AAExB,MAAM,mBAAmB;AAAA,EAC9B,oBAAoB;AAAA,EACpB,SAAS;AAAA,EACT,eAAe;AAAA,EACf,cAAc;AAAA,EACd,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,EACzB,gBAAgB;AAAA,EAChB,sBAAsB;AAAA,EACtB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,gCAAgC;AAAA,EAChC,gCAAgC;AAAA,EAChC,qCAAqC;AAAA,EACrC,0BAA0B;AAAA,EAC1B,2BAA2B;AAAA,EAC3B,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,sBAAsB;AAAA,EACtB,uBAAuB;AAAA,EACvB,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,2BAA2B;AAAA,EAC3B,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,uBAAuB;AAAA,EACvB,mCAAmC;
|
|
4
|
+
"sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSShuttleV2Name = 'DSShuttleV2' as const;\n\nexport const DSShuttleV2Slots = {\n HEADER_SEARCH_ICON: 'header-search-icon',\n WRAPPER: 'wrapper',\n PANEL_WRAPPER: 'panel-wrapper',\n LIST_WRAPPER: 'list-wrapper',\n ITEM_WRAPPER: 'item-wrapper',\n ITEM_ICON_WRAPPER: 'item-icon-wrapper',\n ITEM_LABEL_WRAPPER: 'item-label-wrapper',\n ITEM_MIDSECTION_WRAPPER: 'item-midsection-wrapper',\n ITEM_SELECTION: 'item-selection',\n ITEM_ACTIONS_WRAPPER: 'item-actions-wrapper',\n ITEM_ACTION_WRAPPER: 'item-action-wrapper',\n ITEM_ACTION_BTN: 'item-action-btn',\n ITEM_ACTION_BTN_DRILLDOWN_ICON: 'item-action-btn-drilldown-icon',\n ITEM_ACTION_BTN_TO_SOURCE_ICON: 'item-action-btn-to-source-icon',\n ITEM_ACTION_BTN_TO_DESTINATION_ICON: 'item-action-btn-to-destination-icon',\n LIST_BOTTOM_LOADING_MORE: 'list-bottom-loading-more',\n LIST_BOTTOM_LOAD_MORE_BTN: 'list-bottom-load-more-btn',\n LIST_WRAPPER_BOTTOM: 'list-wrapper-bottom',\n EMPTY_LIST_WRAPPER: 'empty-list-wrapper',\n ITEMS_WRAPPER: 'items-wrapper',\n LOADING_LIST_WRAPPER: 'loading-list-wrapper',\n MOVE_MULTIPLE_WRAPPER: 'move-multiple-wrapper',\n MOVE_MULTIPLE_BTN: 'move-multiple-btn',\n LIST_WRAPPER_MID: 'list-wrapper-mid',\n LIST_WRAPPER_MID_SCROLLER: 'list-wrapper-mid-scroller',\n LIST_WRAPPER_TOP: 'list-wrapper-top',\n AREA_SEARCH_WRAPPER: 'area-search-wrapper',\n AREA_SEARCH_BAR: 'area-search-bar',\n AREA_SELECTION_HEADER: 'area-selection-header',\n AREA_SELECTION_HEADER_COUNT_LABEL: 'area-selection-header-count-label',\n DRAG_AND_DROP_HANDLE: 'drag-and-drop-handle',\n} as const;\n\nexport const DSShuttleV2DataTestIds = slotObjectToDataTestIds(DSShuttleV2Name, DSShuttleV2Slots);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,kBAAkB;AAExB,MAAM,mBAAmB;AAAA,EAC9B,oBAAoB;AAAA,EACpB,SAAS;AAAA,EACT,eAAe;AAAA,EACf,cAAc;AAAA,EACd,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,EACzB,gBAAgB;AAAA,EAChB,sBAAsB;AAAA,EACtB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,gCAAgC;AAAA,EAChC,gCAAgC;AAAA,EAChC,qCAAqC;AAAA,EACrC,0BAA0B;AAAA,EAC1B,2BAA2B;AAAA,EAC3B,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,sBAAsB;AAAA,EACtB,uBAAuB;AAAA,EACvB,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,2BAA2B;AAAA,EAC3B,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,uBAAuB;AAAA,EACvB,mCAAmC;AAAA,EACnC,sBAAsB;AACxB;AAEO,MAAM,6BAAyB,0CAAwB,iBAAiB,gBAAgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -30,7 +30,6 @@ __export(itemMovementHelpers_exports, {
|
|
|
30
30
|
module.exports = __toCommonJS(itemMovementHelpers_exports);
|
|
31
31
|
var React = __toESM(require("react"));
|
|
32
32
|
var import_react = __toESM(require("react"));
|
|
33
|
-
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
34
33
|
var import_useStore = require("./useStore");
|
|
35
34
|
const useHandleMoveSelection = ({ isDestinationPanel }) => {
|
|
36
35
|
const currOnRemove = (0, import_useStore.usePropsStore)(
|
|
@@ -48,55 +47,45 @@ const useHandleMoveSelection = ({ isDestinationPanel }) => {
|
|
|
48
47
|
const otherOnSoftDelete = (0, import_useStore.usePropsStore)(
|
|
49
48
|
(state) => isDestinationPanel ? state.onSourceSoftDelete : state.onDestinationSoftDelete
|
|
50
49
|
);
|
|
51
|
-
const currSelectionMap = (0, import_useStore.
|
|
50
|
+
const currSelectionMap = (0, import_useStore.usePropsStore)(
|
|
52
51
|
(store) => isDestinationPanel ? store.destinationSelectionArray : store.sourceSelectionArray
|
|
53
52
|
);
|
|
54
53
|
const currOnSelectionChange = (0, import_useStore.usePropsStore)(
|
|
55
54
|
(state) => isDestinationPanel ? state.onDestinationSelectionChange : state.onSourceSelectionChange
|
|
56
55
|
);
|
|
57
56
|
const otherPanelOnAdd = (0, import_useStore.usePropsStore)((state) => isDestinationPanel ? state.onSourceAdd : state.onDestinationAdd);
|
|
58
|
-
const destinationSelectionArray = (0, import_useStore.
|
|
59
|
-
const sourceSelectionArray = (0, import_useStore.
|
|
57
|
+
const destinationSelectionArray = (0, import_useStore.usePropsStore)((store) => store.destinationSelectionItemArray);
|
|
58
|
+
const sourceSelectionArray = (0, import_useStore.usePropsStore)((store) => store.sourceSelectionItemArray);
|
|
60
59
|
const selectedItems = isDestinationPanel ? destinationSelectionArray : sourceSelectionArray;
|
|
61
|
-
const mutableSelectedItems = (0, import_ds_utilities.useMakeMutable)(selectedItems);
|
|
62
|
-
const mutableCurrSelectionMap = (0, import_ds_utilities.useMakeMutable)(currSelectionMap);
|
|
63
|
-
const mutableCurrOnSelectionChange = (0, import_ds_utilities.useMakeMutable)(currOnSelectionChange);
|
|
64
|
-
const mutableCurrOnRemove = (0, import_ds_utilities.useMakeMutable)(currOnRemove);
|
|
65
|
-
const mutableOtherOnAdd = (0, import_ds_utilities.useMakeMutable)(otherPanelOnAdd);
|
|
66
|
-
const mutableCurrOnSoftDelete = (0, import_ds_utilities.useMakeMutable)(currOnSoftDelete);
|
|
67
|
-
const mutableOtherOnSoftDelete = (0, import_ds_utilities.useMakeMutable)(otherOnSoftDelete);
|
|
68
|
-
const mutableCurrSoftDeletedItems = (0, import_ds_utilities.useMakeMutable)(currSoftDeletedItems);
|
|
69
|
-
const mutableOtherSoftDeletedItems = (0, import_ds_utilities.useMakeMutable)(otherSoftDeletedItems);
|
|
70
60
|
const moveSelection = import_react.default.useCallback(
|
|
71
61
|
(event) => {
|
|
72
62
|
event.preventDefault();
|
|
73
63
|
event.stopPropagation();
|
|
74
|
-
|
|
75
|
-
|
|
64
|
+
currOnRemove(selectedItems, { event });
|
|
65
|
+
otherPanelOnAdd(selectedItems, { event });
|
|
76
66
|
const currSoftDeletedMap = {};
|
|
77
67
|
const otherSoftDeletedMap = {};
|
|
78
|
-
|
|
68
|
+
currSelectionMap.forEach((id) => {
|
|
79
69
|
currSoftDeletedMap[id] = true;
|
|
80
70
|
otherSoftDeletedMap[id] = false;
|
|
81
71
|
});
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
72
|
+
currOnSoftDelete({ ...currSoftDeletedItems, ...currSoftDeletedMap }, { event });
|
|
73
|
+
otherOnSoftDelete({ ...otherSoftDeletedItems, ...otherSoftDeletedMap }, { event });
|
|
74
|
+
currOnSelectionChange({}, { event });
|
|
85
75
|
},
|
|
86
76
|
[
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
77
|
+
currOnRemove,
|
|
78
|
+
selectedItems,
|
|
79
|
+
otherPanelOnAdd,
|
|
80
|
+
currSelectionMap,
|
|
81
|
+
currOnSoftDelete,
|
|
82
|
+
currSoftDeletedItems,
|
|
83
|
+
otherOnSoftDelete,
|
|
84
|
+
otherSoftDeletedItems,
|
|
85
|
+
currOnSelectionChange
|
|
96
86
|
]
|
|
97
87
|
);
|
|
98
|
-
|
|
99
|
-
return import_react.default.useMemo(() => ({ moveSelection: mutableMoveSelection.current }), [mutableMoveSelection]);
|
|
88
|
+
return import_react.default.useMemo(() => ({ moveSelection }), [moveSelection]);
|
|
100
89
|
};
|
|
101
90
|
const useHandleMoveItem = ({ datum, datumInternalMeta, isDestinationPanel }) => {
|
|
102
91
|
const currSoftDeletedItems = (0, import_useStore.usePropsStore)(
|
|
@@ -115,36 +104,24 @@ const useHandleMoveItem = ({ datum, datumInternalMeta, isDestinationPanel }) =>
|
|
|
115
104
|
(state) => isDestinationPanel ? state.onDestinationRemove : state.onSourceRemove
|
|
116
105
|
);
|
|
117
106
|
const otherPanelOnAdd = (0, import_useStore.usePropsStore)((state) => isDestinationPanel ? state.onSourceAdd : state.onDestinationAdd);
|
|
118
|
-
const mutableCurrOnRemove = (0, import_ds_utilities.useMakeMutable)(currOnRemove);
|
|
119
|
-
const mutableOtherOnAdd = (0, import_ds_utilities.useMakeMutable)(otherPanelOnAdd);
|
|
120
|
-
const mutableCurrOnSoftDelete = (0, import_ds_utilities.useMakeMutable)(currOnSoftDelete);
|
|
121
|
-
const mutableOtherOnSoftDelete = (0, import_ds_utilities.useMakeMutable)(otherOnSoftDelete);
|
|
122
|
-
const mutableCurrSoftDeletedItems = (0, import_ds_utilities.useMakeMutable)(currSoftDeletedItems);
|
|
123
|
-
const mutableOtherSoftDeletedItems = (0, import_ds_utilities.useMakeMutable)(otherSoftDeletedItems);
|
|
124
107
|
const moveItem = import_react.default.useCallback(
|
|
125
108
|
(event) => {
|
|
126
109
|
event.preventDefault();
|
|
127
110
|
event.stopPropagation();
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
{ event }
|
|
133
|
-
);
|
|
134
|
-
mutableOtherOnSoftDelete.current(
|
|
135
|
-
{ ...mutableOtherSoftDeletedItems.current, [datumInternalMeta.hydratedId]: false },
|
|
136
|
-
{ event }
|
|
137
|
-
);
|
|
111
|
+
currOnRemove([datum], { event });
|
|
112
|
+
otherPanelOnAdd([datum], { event });
|
|
113
|
+
currOnSoftDelete({ ...currSoftDeletedItems, [datumInternalMeta.hydratedId]: true }, { event });
|
|
114
|
+
otherOnSoftDelete({ ...otherSoftDeletedItems, [datumInternalMeta.hydratedId]: false }, { event });
|
|
138
115
|
},
|
|
139
116
|
[
|
|
117
|
+
currOnRemove,
|
|
118
|
+
currOnSoftDelete,
|
|
119
|
+
currSoftDeletedItems,
|
|
140
120
|
datum,
|
|
141
121
|
datumInternalMeta.hydratedId,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
mutableOtherOnAdd,
|
|
146
|
-
mutableOtherOnSoftDelete,
|
|
147
|
-
mutableOtherSoftDeletedItems
|
|
122
|
+
otherOnSoftDelete,
|
|
123
|
+
otherPanelOnAdd,
|
|
124
|
+
otherSoftDeletedItems
|
|
148
125
|
]
|
|
149
126
|
);
|
|
150
127
|
return moveItem;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/itemMovementHelpers.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport React from 'react';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAkB;
|
|
4
|
+
"sourcesContent": ["/* 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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAkB;AAGlB,sBAA8B;AAEvB,MAAM,yBAAyB,CAAC,EAAE,mBAAmB,MAAkC;AAC5F,QAAM,mBAAe;AAAA,IAAc,CAAC,UAClC,qBAAqB,MAAM,sBAAsB,MAAM;AAAA,EACzD;AACA,QAAM,2BAAuB;AAAA,IAAc,CAAC,UAC1C,qBAAqB,MAAM,8BAA8B,MAAM;AAAA,EACjE;AACA,QAAM,uBAAmB;AAAA,IAAc,CAAC,UACtC,qBAAqB,MAAM,0BAA0B,MAAM;AAAA,EAC7D;AACA,QAAM,4BAAwB;AAAA,IAAc,CAAC,UAC3C,qBAAqB,MAAM,yBAAyB,MAAM;AAAA,EAC5D;AACA,QAAM,wBAAoB;AAAA,IAAc,CAAC,UACvC,qBAAqB,MAAM,qBAAqB,MAAM;AAAA,EACxD;AACA,QAAM,uBAAmB;AAAA,IAAc,CAAC,UACtC,qBAAqB,MAAM,4BAA4B,MAAM;AAAA,EAC/D;AACA,QAAM,4BAAwB;AAAA,IAAc,CAAC,UAC3C,qBAAqB,MAAM,+BAA+B,MAAM;AAAA,EAClE;AAEA,QAAM,sBAAkB,+BAAc,CAAC,UAAW,qBAAqB,MAAM,cAAc,MAAM,gBAAiB;AAElH,QAAM,gCAA4B,+BAAc,CAAC,UAAU,MAAM,6BAA6B;AAC9F,QAAM,2BAAuB,+BAAc,CAAC,U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AAc,CAAC,UAClC,qBAAqB,MAAM,sBAAsB,MAAM;AAAA,EACzD;AACA,QAAM,sBAAkB,+BAAc,CAAC,UAAW,qBAAqB,MAAM,cAAc,MAAM,gBAAiB;AAElH,QAAM,WAAW,aAAAA,QAAM;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
|
}
|
|
@@ -33,7 +33,8 @@ const configureDestination = ({
|
|
|
33
33
|
destinationData,
|
|
34
34
|
destinationSelectedItems,
|
|
35
35
|
destinationSoftDeletedItems,
|
|
36
|
-
getId
|
|
36
|
+
getId,
|
|
37
|
+
getPreventMove
|
|
37
38
|
}) => {
|
|
38
39
|
const destinationSelectedItemsMap = {};
|
|
39
40
|
const destinationSelectionArray = [];
|
|
@@ -43,6 +44,7 @@ const configureDestination = ({
|
|
|
43
44
|
const destinationSelectionableData = [];
|
|
44
45
|
destinationData.forEach((datum, i) => {
|
|
45
46
|
const hydratedId = getId(datum);
|
|
47
|
+
const hydratedPreventMove = getPreventMove?.(datum) ?? false;
|
|
46
48
|
let isSelected = false;
|
|
47
49
|
if (destinationSelectedItems[hydratedId] === true) {
|
|
48
50
|
destinationSelectionItemArray.push(datum);
|
|
@@ -56,6 +58,7 @@ const configureDestination = ({
|
|
|
56
58
|
destinationSelectedItemsMap[hydratedId] = { datum, index: i };
|
|
57
59
|
const configuredItem = {
|
|
58
60
|
hydratedId,
|
|
61
|
+
hydratedPreventMove,
|
|
59
62
|
isSelected,
|
|
60
63
|
softDeleted,
|
|
61
64
|
original: datum,
|
|
@@ -64,7 +67,7 @@ const configureDestination = ({
|
|
|
64
67
|
isLast: i === destinationData.length - 1
|
|
65
68
|
};
|
|
66
69
|
destinationConfiguredData.push(configuredItem);
|
|
67
|
-
if (!
|
|
70
|
+
if (!hydratedPreventMove && !softDeleted) {
|
|
68
71
|
destinationSelectionableData.push(configuredItem);
|
|
69
72
|
destinationSelectionableDataIds.push(`${hydratedId}`);
|
|
70
73
|
}
|
|
@@ -82,7 +85,13 @@ const configureDestination = ({
|
|
|
82
85
|
destinationSelectionableIds
|
|
83
86
|
};
|
|
84
87
|
};
|
|
85
|
-
const configureSource = ({
|
|
88
|
+
const configureSource = ({
|
|
89
|
+
sourceData,
|
|
90
|
+
sourceSelectedItems,
|
|
91
|
+
sourceSoftDeletedItems,
|
|
92
|
+
getId,
|
|
93
|
+
getPreventMove
|
|
94
|
+
}) => {
|
|
86
95
|
const sourceSelectedItemsMap = {};
|
|
87
96
|
const sourceSelectionArray = [];
|
|
88
97
|
const sourceSelectionableDataIds = [];
|
|
@@ -91,6 +100,7 @@ const configureSource = ({ sourceData, sourceSelectedItems, sourceSoftDeletedIte
|
|
|
91
100
|
const sourceSelectionableData = [];
|
|
92
101
|
sourceData.forEach((datum, i) => {
|
|
93
102
|
const hydratedId = getId(datum);
|
|
103
|
+
const hydratedPreventMove = getPreventMove?.(datum) ?? false;
|
|
94
104
|
let isSelected = false;
|
|
95
105
|
if (sourceSelectedItems[hydratedId] === true) {
|
|
96
106
|
sourceSelectionItemArray.push(datum);
|
|
@@ -104,6 +114,7 @@ const configureSource = ({ sourceData, sourceSelectedItems, sourceSoftDeletedIte
|
|
|
104
114
|
sourceSelectedItemsMap[hydratedId] = { datum, index: i };
|
|
105
115
|
const configuredItem = {
|
|
106
116
|
hydratedId,
|
|
117
|
+
hydratedPreventMove,
|
|
107
118
|
isSelected,
|
|
108
119
|
softDeleted,
|
|
109
120
|
original: datum,
|
|
@@ -112,7 +123,7 @@ const configureSource = ({ sourceData, sourceSelectedItems, sourceSoftDeletedIte
|
|
|
112
123
|
isLast: i === sourceData.length - 1
|
|
113
124
|
};
|
|
114
125
|
sourceConfiguredData.push(configuredItem);
|
|
115
|
-
if (!
|
|
126
|
+
if (!hydratedPreventMove && !softDeleted) {
|
|
116
127
|
sourceSelectionableData.push(configuredItem);
|
|
117
128
|
sourceSelectionableDataIds.push(`${hydratedId}`);
|
|
118
129
|
}
|
|
@@ -137,19 +148,27 @@ const useDataStructure = (propsFromUser) => {
|
|
|
137
148
|
destinationData,
|
|
138
149
|
destinationSelectedItems,
|
|
139
150
|
getId,
|
|
151
|
+
getPreventMove,
|
|
140
152
|
sourceSoftDeletedItems,
|
|
141
153
|
destinationSoftDeletedItems
|
|
142
154
|
} = propsFromUser;
|
|
143
155
|
return (0, import_react.useMemo)(
|
|
144
156
|
() => ({
|
|
145
|
-
...configureSource({ sourceData, sourceSelectedItems, sourceSoftDeletedItems, getId }),
|
|
146
|
-
...configureDestination({
|
|
157
|
+
...configureSource({ sourceData, sourceSelectedItems, sourceSoftDeletedItems, getId, getPreventMove }),
|
|
158
|
+
...configureDestination({
|
|
159
|
+
destinationData,
|
|
160
|
+
destinationSelectedItems,
|
|
161
|
+
destinationSoftDeletedItems,
|
|
162
|
+
getId,
|
|
163
|
+
getPreventMove
|
|
164
|
+
})
|
|
147
165
|
}),
|
|
148
166
|
[
|
|
149
167
|
sourceData,
|
|
150
168
|
sourceSelectedItems,
|
|
151
169
|
sourceSoftDeletedItems,
|
|
152
170
|
getId,
|
|
171
|
+
getPreventMove,
|
|
153
172
|
destinationData,
|
|
154
173
|
destinationSelectedItems,
|
|
155
174
|
destinationSoftDeletedItems
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/config/useAutoCalculated/useDataStructure.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["// 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 (!
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAwB;
|
|
4
|
+
"sourcesContent": ["// 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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAwB;AAUxB,MAAM,uBAAuB,CAAC;AAAA,EAC5B;AAAA,EACA;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,O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ACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -29,7 +29,6 @@ __export(useFocusActionTrackers_exports, {
|
|
|
29
29
|
module.exports = __toCommonJS(useFocusActionTrackers_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
31
|
var import_react = require("react");
|
|
32
|
-
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
33
32
|
var import_constants = require("../../constants");
|
|
34
33
|
var import_useStore = require("../useStore");
|
|
35
34
|
const getMoveBtnActionByProxymity = (flags) => {
|
|
@@ -100,40 +99,38 @@ const getActionByProxymity = ({ flags, currentAction }) => {
|
|
|
100
99
|
return getParenBtnActionByProxymity(flags);
|
|
101
100
|
};
|
|
102
101
|
const useFocusActionTrackers = () => {
|
|
103
|
-
const
|
|
104
|
-
const mutableFocusItemAction = (0, import_ds_utilities.useMakeMutable)(focusItemAction);
|
|
102
|
+
const getFocusItemAction = (0, import_useStore.useInternalStore)((state) => state.getFocusItemAction);
|
|
105
103
|
const setFocusItemAction = (0, import_useStore.useInternalStore)((state) => state.setFocusItemAction);
|
|
106
104
|
const removeDragAndDropFromDestination = (0, import_useStore.usePropsStore)((state) => state.removeDragAndDropFromDestination);
|
|
107
105
|
const addDragAndDropFromSource = (0, import_useStore.usePropsStore)((state) => state.addDragAndDropFromSource);
|
|
108
106
|
const trackFocusPrevAction = (0, import_react.useCallback)(
|
|
109
|
-
({ isDestinationPanel, datumHydratables }) => {
|
|
110
|
-
const preventMove = Boolean(
|
|
107
|
+
({ isDestinationPanel, datumHydratables, datumInternalMeta: { hydratedPreventMove } }) => {
|
|
108
|
+
const preventMove = Boolean(hydratedPreventMove);
|
|
111
109
|
const preventDrilldown = Boolean(datumHydratables.preventDrilldown);
|
|
112
110
|
const withDragAndDrop = isDestinationPanel && !removeDragAndDropFromDestination || !isDestinationPanel && addDragAndDropFromSource;
|
|
113
111
|
const { prevAction } = getActionByProxymity({
|
|
114
112
|
flags: { preventMove, preventDrilldown, withDragAndDrop },
|
|
115
|
-
currentAction:
|
|
113
|
+
currentAction: getFocusItemAction()
|
|
116
114
|
});
|
|
117
115
|
setFocusItemAction(prevAction);
|
|
118
116
|
},
|
|
119
|
-
[addDragAndDropFromSource,
|
|
117
|
+
[addDragAndDropFromSource, getFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction]
|
|
120
118
|
);
|
|
121
119
|
const trackFocusNextAction = (0, import_react.useCallback)(
|
|
122
|
-
({ isDestinationPanel, datumHydratables }) => {
|
|
123
|
-
const preventMove = Boolean(
|
|
120
|
+
({ isDestinationPanel, datumHydratables, datumInternalMeta: { hydratedPreventMove } }) => {
|
|
121
|
+
const preventMove = Boolean(hydratedPreventMove);
|
|
124
122
|
const preventDrilldown = Boolean(datumHydratables.preventDrilldown);
|
|
125
123
|
const withDragAndDrop = isDestinationPanel && !removeDragAndDropFromDestination || !isDestinationPanel && addDragAndDropFromSource;
|
|
126
124
|
const { nextAction } = getActionByProxymity({
|
|
127
125
|
flags: { preventMove, preventDrilldown, withDragAndDrop },
|
|
128
|
-
currentAction:
|
|
126
|
+
currentAction: getFocusItemAction()
|
|
129
127
|
});
|
|
130
128
|
setFocusItemAction(nextAction);
|
|
131
129
|
},
|
|
132
|
-
[addDragAndDropFromSource,
|
|
130
|
+
[addDragAndDropFromSource, getFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction]
|
|
133
131
|
);
|
|
134
132
|
return (0, import_react.useMemo)(
|
|
135
133
|
() => ({
|
|
136
|
-
mutableFocusItemAction,
|
|
137
134
|
trackFocusActionMove: () => setFocusItemAction("move-btn"),
|
|
138
135
|
trackFocusActionDrilldown: () => setFocusItemAction("drilldown-btn"),
|
|
139
136
|
trackFocusActionDragAndDrop: () => setFocusItemAction("drag-n-drop"),
|
|
@@ -142,7 +139,7 @@ const useFocusActionTrackers = () => {
|
|
|
142
139
|
trackFocusPrevAction,
|
|
143
140
|
trackFocusNextAction
|
|
144
141
|
}),
|
|
145
|
-
[
|
|
142
|
+
[setFocusItemAction, trackFocusNextAction, trackFocusPrevAction]
|
|
146
143
|
);
|
|
147
144
|
};
|
|
148
145
|
//# sourceMappingURL=useFocusActionTrackers.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/config/useFocusTracker/useFocusActionTrackers.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useMemo, useCallback } from 'react';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAqC;
|
|
4
|
+
"sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAqC;AAErC,uBAAgC;AAChC,sBAAgD;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,iCAAgB;AAAA,WACrD;AAAiB,cAAU,aAAa,iCAAgB;AAAA;AAC5D,cAAU,aAAa,iCAAgB;AAI5C,MAAI;AAAiB,cAAU,aAAa,iCAAgB;AAAA;AACvD,cAAU,aAAa,iCAAgB;AAC5C,SAAO;AACT;AACA,MAAM,qCAAqC,CAAC,UAAuB;AAEjE,QAAM,EAAE,aAAa,iBAAiB,IAAI;AAG1C,QAAM,YAAY,EAAE,YAAY,IAAI,YAAY,iCAAgB,OAAO;AAKvE,MAAI,CAAC;AAAa,cAAU,aAAa,iCAAgB;AAAA,WAChD,CAAC;AAAkB,cAAU,aAAa,iCAAgB;AAAA;AAC9D,cAAU,aAAa,iCAAgB;AAC5C,SAAO;AACT;AACA,MAAM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AAA,EACjE;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -29,40 +29,21 @@ __export(useFocusItemTracker_exports, {
|
|
|
29
29
|
module.exports = __toCommonJS(useFocusItemTracker_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
31
|
var import_react = require("react");
|
|
32
|
-
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
33
32
|
var import_useStore = require("../useStore");
|
|
34
33
|
var import_constants = require("../../constants/index");
|
|
35
34
|
const useFocusItemTracker = () => {
|
|
36
|
-
const
|
|
37
|
-
const mutableFocusItem = (0, import_ds_utilities.useMakeMutable)(focusItem);
|
|
35
|
+
const getFocusItem = (0, import_useStore.useInternalStore)((state) => state.getFocusItem);
|
|
38
36
|
const setFocusItem = (0, import_useStore.useInternalStore)((state) => state.setFocusItem);
|
|
39
|
-
const sourceData = (0, import_useStore.
|
|
40
|
-
const destinationData = (0, import_useStore.
|
|
37
|
+
const sourceData = (0, import_useStore.usePropsStore)((state) => state.sourceConfiguredData);
|
|
38
|
+
const destinationData = (0, import_useStore.usePropsStore)((state) => state.destinationConfiguredData);
|
|
41
39
|
const sourceWithLoadMore = (0, import_useStore.usePropsStore)((state) => state.sourceWithLoadMore);
|
|
42
40
|
const destinationWithLoadMore = (0, import_useStore.usePropsStore)((state) => state.destinationWithLoadMore);
|
|
43
41
|
const trackFocusPrevItem = (0, import_react.useCallback)(
|
|
44
42
|
({ isDestinationPanel }) => {
|
|
43
|
+
const focusItem = getFocusItem();
|
|
45
44
|
const referenceData = isDestinationPanel ? destinationData : sourceData;
|
|
46
45
|
const withLoadMore = isDestinationPanel ? destinationWithLoadMore : sourceWithLoadMore;
|
|
47
|
-
|
|
48
|
-
if (withLoadMore)
|
|
49
|
-
setFocusItem(
|
|
50
|
-
isDestinationPanel ? import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE
|
|
51
|
-
);
|
|
52
|
-
else {
|
|
53
|
-
const prevItemIndex = referenceData.length > 1 ? referenceData.length - 1 : 0;
|
|
54
|
-
const prevItem = referenceData[prevItemIndex];
|
|
55
|
-
setFocusItem(import_constants.ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));
|
|
56
|
-
}
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
if (mutableFocusItem.current === import_constants.ITEMS_FOCUSES.LAST) {
|
|
60
|
-
const prevItemIndex = referenceData.length > 2 ? referenceData.length - 2 : 0;
|
|
61
|
-
const prevItem = referenceData[prevItemIndex];
|
|
62
|
-
setFocusItem(import_constants.ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === mutableFocusItem.current);
|
|
46
|
+
const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === focusItem);
|
|
66
47
|
if (currentItemIndex === 0 && withLoadMore)
|
|
67
48
|
setFocusItem(isDestinationPanel ? import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE);
|
|
68
49
|
else if (currentItemIndex !== -1) {
|
|
@@ -75,31 +56,14 @@ const useFocusItemTracker = () => {
|
|
|
75
56
|
setFocusItem(import_constants.ITEMS_FOCUSES.GET_SPECIFIC_ITEM(prevItem));
|
|
76
57
|
}
|
|
77
58
|
},
|
|
78
|
-
[destinationData, destinationWithLoadMore,
|
|
59
|
+
[destinationData, destinationWithLoadMore, getFocusItem, setFocusItem, sourceData, sourceWithLoadMore]
|
|
79
60
|
);
|
|
80
61
|
const trackFocusNextItem = (0, import_react.useCallback)(
|
|
81
62
|
({ isDestinationPanel }) => {
|
|
63
|
+
const focusItem = getFocusItem();
|
|
82
64
|
const referenceData = isDestinationPanel ? destinationData : sourceData;
|
|
83
65
|
const withLoadMore = isDestinationPanel ? destinationWithLoadMore : sourceWithLoadMore;
|
|
84
|
-
|
|
85
|
-
const nextItemIndex = referenceData.length > 1 ? 1 : 0;
|
|
86
|
-
const nextItem = referenceData[nextItemIndex];
|
|
87
|
-
setFocusItem(import_constants.ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (mutableFocusItem.current === import_constants.ITEMS_FOCUSES.LAST) {
|
|
91
|
-
if (withLoadMore)
|
|
92
|
-
setFocusItem(
|
|
93
|
-
isDestinationPanel ? import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE
|
|
94
|
-
);
|
|
95
|
-
else {
|
|
96
|
-
const nextItemIndex = 0;
|
|
97
|
-
const nextItem = referenceData[nextItemIndex];
|
|
98
|
-
setFocusItem(import_constants.ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));
|
|
99
|
-
}
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === mutableFocusItem.current);
|
|
66
|
+
const currentItemIndex = referenceData.findIndex((currItem) => currItem.hydratedId === focusItem);
|
|
103
67
|
if (currentItemIndex === referenceData.length - 1 && withLoadMore)
|
|
104
68
|
setFocusItem(isDestinationPanel ? import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION : import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE);
|
|
105
69
|
else if (currentItemIndex !== -1) {
|
|
@@ -112,21 +76,24 @@ const useFocusItemTracker = () => {
|
|
|
112
76
|
setFocusItem(import_constants.ITEMS_FOCUSES.GET_SPECIFIC_ITEM(nextItem));
|
|
113
77
|
}
|
|
114
78
|
},
|
|
115
|
-
[destinationData, destinationWithLoadMore,
|
|
79
|
+
[destinationData, destinationWithLoadMore, getFocusItem, setFocusItem, sourceData, sourceWithLoadMore]
|
|
116
80
|
);
|
|
117
81
|
return (0, import_react.useMemo)(
|
|
118
82
|
() => ({
|
|
119
|
-
mutableFocusItem,
|
|
120
83
|
trackFocusItem: (item) => setFocusItem(item.hydratedId),
|
|
121
84
|
trackFocusItemReset: () => setFocusItem(import_constants.ITEMS_FOCUSES.RESET),
|
|
122
|
-
trackFocusItemFirst: () => setFocusItem(import_constants.ITEMS_FOCUSES.
|
|
123
|
-
trackFocusItemLast: () => setFocusItem(
|
|
85
|
+
trackFocusItemFirst: ({ isDestinationPanel }) => setFocusItem(import_constants.ITEMS_FOCUSES.GET_SPECIFIC_ITEM(isDestinationPanel ? destinationData[0] : sourceData[0])),
|
|
86
|
+
trackFocusItemLast: ({ isDestinationPanel }) => setFocusItem(
|
|
87
|
+
import_constants.ITEMS_FOCUSES.GET_SPECIFIC_ITEM(
|
|
88
|
+
isDestinationPanel ? destinationData[destinationData.length - 1] : sourceData[sourceData.length - 1]
|
|
89
|
+
)
|
|
90
|
+
),
|
|
124
91
|
trackFocusLoadMoreBtnDestination: () => setFocusItem(import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_DESTINATION),
|
|
125
92
|
trackFocusLoadMoreBtn: () => setFocusItem(import_constants.ITEMS_FOCUSES.LOAD_MORE_BTN_SOURCE),
|
|
126
93
|
trackFocusPrevItem,
|
|
127
94
|
trackFocusNextItem
|
|
128
95
|
}),
|
|
129
|
-
[
|
|
96
|
+
[destinationData, setFocusItem, sourceData, trackFocusNextItem, trackFocusPrevItem]
|
|
130
97
|
);
|
|
131
98
|
};
|
|
132
99
|
//# sourceMappingURL=useFocusItemTracker.js.map
|