@elliemae/ds-shuttle-v2 3.13.1-rc.0 → 3.14.0-next.2
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/DSShuttleV2.js +2 -3
- package/dist/cjs/DSShuttleV2.js.map +3 -3
- package/dist/cjs/config/DSShuttleV2Definitions.js +67 -0
- package/dist/cjs/config/DSShuttleV2Definitions.js.map +7 -0
- package/dist/cjs/config/itemMovementHelpers.js +17 -1
- package/dist/cjs/config/itemMovementHelpers.js.map +2 -2
- package/dist/cjs/config/useAutoCalculated/index.js +39 -0
- package/dist/cjs/config/useAutoCalculated/index.js.map +7 -0
- package/dist/cjs/config/{configureAutoCalculated.js → useAutoCalculated/useDataStructure.js} +22 -12
- package/dist/cjs/config/useAutoCalculated/useDataStructure.js.map +7 -0
- package/dist/cjs/config/useAutoCalculated/useShuttleVirtualized.js +98 -0
- package/dist/cjs/config/useAutoCalculated/useShuttleVirtualized.js.map +7 -0
- package/dist/cjs/config/useFocusTracker/useFocusActionTrackers.js +6 -6
- package/dist/cjs/config/useFocusTracker/useFocusActionTrackers.js.map +2 -2
- package/dist/cjs/config/useShuttleV2.js +4 -5
- package/dist/cjs/config/useShuttleV2.js.map +2 -2
- package/dist/cjs/config/useStore/useStore.js +14 -5
- package/dist/cjs/config/useStore/useStore.js.map +2 -2
- package/dist/cjs/constants/index.js +4 -0
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/parts/Dnd/DndHandle.js +64 -0
- package/dist/cjs/parts/Dnd/DndHandle.js.map +7 -0
- package/dist/cjs/parts/Dnd/DropIndicator.js +88 -0
- package/dist/cjs/parts/Dnd/DropIndicator.js.map +7 -0
- package/dist/cjs/parts/Header.js +2 -1
- package/dist/cjs/parts/Header.js.map +2 -2
- package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js +90 -0
- package/dist/cjs/parts/HoC/withConditionalDnDRowContext.js.map +7 -0
- package/dist/cjs/parts/HoC/withConditionalUseSortable.js +38 -0
- package/dist/cjs/parts/HoC/withConditionalUseSortable.js.map +7 -0
- package/dist/cjs/parts/Item/Item.js +64 -11
- package/dist/cjs/parts/Item/Item.js.map +3 -3
- package/dist/cjs/parts/Item/ItemActions/ItemActions.js +10 -9
- package/dist/cjs/parts/Item/ItemActions/ItemActions.js.map +2 -2
- package/dist/cjs/parts/Item/ItemActions/useActionsLogicHandlers.js +16 -1
- package/dist/cjs/parts/Item/ItemActions/useActionsLogicHandlers.js.map +2 -2
- package/dist/cjs/parts/Item/ItemActions/useInnerRefHandlers.js +18 -4
- package/dist/cjs/parts/Item/ItemActions/useInnerRefHandlers.js.map +2 -2
- package/dist/cjs/parts/Item/ItemMiddleSection.js +4 -3
- package/dist/cjs/parts/Item/ItemMiddleSection.js.map +2 -2
- package/dist/cjs/parts/Item/ItemOverlay.js +61 -0
- package/dist/cjs/parts/Item/ItemOverlay.js.map +7 -0
- package/dist/cjs/parts/Item/ItemSelection.js +2 -1
- package/dist/cjs/parts/Item/ItemSelection.js.map +2 -2
- package/dist/cjs/parts/Item/useItemArrowNavigation.js +7 -0
- package/dist/cjs/parts/Item/useItemArrowNavigation.js.map +2 -2
- package/dist/cjs/parts/Item/useSelectionLogic.js +12 -1
- package/dist/cjs/parts/Item/useSelectionLogic.js.map +2 -2
- package/dist/cjs/parts/MainContent.js +2 -1
- package/dist/cjs/parts/MainContent.js.map +2 -2
- package/dist/cjs/parts/Panel/bottom/LoadMoreBtn.js +5 -1
- package/dist/cjs/parts/Panel/bottom/LoadMoreBtn.js.map +2 -2
- package/dist/cjs/parts/Panel/bottom/LoadingMore.js +5 -1
- package/dist/cjs/parts/Panel/bottom/LoadingMore.js.map +2 -2
- package/dist/cjs/parts/Panel/bottom/PanelContentBottomSection.js +2 -1
- package/dist/cjs/parts/Panel/bottom/PanelContentBottomSection.js.map +2 -2
- package/dist/cjs/parts/Panel/bottom/useLoadMoreBtnArrowNavigation.js +14 -1
- package/dist/cjs/parts/Panel/bottom/useLoadMoreBtnArrowNavigation.js.map +2 -2
- package/dist/cjs/parts/Panel/middle/EmptyItems.js +2 -1
- package/dist/cjs/parts/Panel/middle/EmptyItems.js.map +2 -2
- package/dist/cjs/parts/Panel/middle/ItemListWrapper.js +48 -102
- package/dist/cjs/parts/Panel/middle/ItemListWrapper.js.map +2 -2
- package/dist/cjs/parts/Panel/middle/LoadingItems.js +2 -1
- package/dist/cjs/parts/Panel/middle/LoadingItems.js.map +2 -2
- package/dist/cjs/parts/Panel/middle/MultipleSelectionAction.js +9 -7
- package/dist/cjs/parts/Panel/middle/MultipleSelectionAction.js.map +2 -2
- package/dist/cjs/parts/Panel/middle/PanelContentMiddleSection.js +120 -7
- package/dist/cjs/parts/Panel/middle/PanelContentMiddleSection.js.map +2 -2
- package/dist/cjs/parts/Panel/top/PanelContentTopSection.js +2 -1
- package/dist/cjs/parts/Panel/top/PanelContentTopSection.js.map +2 -2
- package/dist/cjs/parts/Panel/top/PanelFilterSection.js +3 -2
- package/dist/cjs/parts/Panel/top/PanelFilterSection.js.map +2 -2
- package/dist/cjs/parts/Panel/top/SelectionHeader.js +7 -3
- package/dist/cjs/parts/Panel/top/SelectionHeader.js.map +2 -2
- package/dist/cjs/parts/PanelWrapper.js +3 -2
- package/dist/cjs/parts/PanelWrapper.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +14 -2
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/esm/DSShuttleV2.js +2 -3
- package/dist/esm/DSShuttleV2.js.map +3 -3
- package/dist/esm/config/DSShuttleV2Definitions.js +41 -0
- package/dist/esm/config/DSShuttleV2Definitions.js.map +7 -0
- package/dist/esm/config/itemMovementHelpers.js +17 -1
- package/dist/esm/config/itemMovementHelpers.js.map +2 -2
- package/dist/esm/config/useAutoCalculated/index.js +13 -0
- package/dist/esm/config/useAutoCalculated/index.js.map +7 -0
- package/dist/esm/config/{configureAutoCalculated.js → useAutoCalculated/useDataStructure.js} +19 -9
- package/dist/esm/config/useAutoCalculated/useDataStructure.js.map +7 -0
- package/dist/esm/config/useAutoCalculated/useShuttleVirtualized.js +72 -0
- package/dist/esm/config/useAutoCalculated/useShuttleVirtualized.js.map +7 -0
- package/dist/esm/config/useFocusTracker/useFocusActionTrackers.js +6 -6
- package/dist/esm/config/useFocusTracker/useFocusActionTrackers.js.map +2 -2
- package/dist/esm/config/useShuttleV2.js +4 -5
- package/dist/esm/config/useShuttleV2.js.map +2 -2
- package/dist/esm/config/useStore/useStore.js +14 -5
- package/dist/esm/config/useStore/useStore.js.map +2 -2
- package/dist/esm/constants/index.js +4 -0
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/index.js +5 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/parts/Dnd/DndHandle.js +38 -0
- package/dist/esm/parts/Dnd/DndHandle.js.map +7 -0
- package/dist/esm/parts/Dnd/DropIndicator.js +62 -0
- package/dist/esm/parts/Dnd/DropIndicator.js.map +7 -0
- package/dist/esm/parts/Header.js +2 -1
- package/dist/esm/parts/Header.js.map +2 -2
- package/dist/esm/parts/HoC/withConditionalDnDRowContext.js +64 -0
- package/dist/esm/parts/HoC/withConditionalDnDRowContext.js.map +7 -0
- package/dist/esm/parts/HoC/withConditionalUseSortable.js +12 -0
- package/dist/esm/parts/HoC/withConditionalUseSortable.js.map +7 -0
- package/dist/esm/parts/Item/Item.js +66 -13
- package/dist/esm/parts/Item/Item.js.map +2 -2
- package/dist/esm/parts/Item/ItemActions/ItemActions.js +10 -9
- package/dist/esm/parts/Item/ItemActions/ItemActions.js.map +2 -2
- package/dist/esm/parts/Item/ItemActions/useActionsLogicHandlers.js +16 -1
- package/dist/esm/parts/Item/ItemActions/useActionsLogicHandlers.js.map +2 -2
- package/dist/esm/parts/Item/ItemActions/useInnerRefHandlers.js +18 -4
- package/dist/esm/parts/Item/ItemActions/useInnerRefHandlers.js.map +2 -2
- package/dist/esm/parts/Item/ItemMiddleSection.js +4 -3
- package/dist/esm/parts/Item/ItemMiddleSection.js.map +2 -2
- package/dist/esm/parts/Item/ItemOverlay.js +35 -0
- package/dist/esm/parts/Item/ItemOverlay.js.map +7 -0
- package/dist/esm/parts/Item/ItemSelection.js +2 -1
- package/dist/esm/parts/Item/ItemSelection.js.map +2 -2
- package/dist/esm/parts/Item/useItemArrowNavigation.js +7 -0
- package/dist/esm/parts/Item/useItemArrowNavigation.js.map +2 -2
- package/dist/esm/parts/Item/useSelectionLogic.js +13 -2
- package/dist/esm/parts/Item/useSelectionLogic.js.map +2 -2
- package/dist/esm/parts/MainContent.js +2 -1
- package/dist/esm/parts/MainContent.js.map +2 -2
- package/dist/esm/parts/Panel/bottom/LoadMoreBtn.js +5 -1
- package/dist/esm/parts/Panel/bottom/LoadMoreBtn.js.map +2 -2
- package/dist/esm/parts/Panel/bottom/LoadingMore.js +5 -1
- package/dist/esm/parts/Panel/bottom/LoadingMore.js.map +2 -2
- package/dist/esm/parts/Panel/bottom/PanelContentBottomSection.js +2 -1
- package/dist/esm/parts/Panel/bottom/PanelContentBottomSection.js.map +2 -2
- package/dist/esm/parts/Panel/bottom/useLoadMoreBtnArrowNavigation.js +14 -1
- package/dist/esm/parts/Panel/bottom/useLoadMoreBtnArrowNavigation.js.map +2 -2
- package/dist/esm/parts/Panel/middle/EmptyItems.js +2 -1
- package/dist/esm/parts/Panel/middle/EmptyItems.js.map +2 -2
- package/dist/esm/parts/Panel/middle/ItemListWrapper.js +50 -104
- package/dist/esm/parts/Panel/middle/ItemListWrapper.js.map +2 -2
- package/dist/esm/parts/Panel/middle/LoadingItems.js +2 -1
- package/dist/esm/parts/Panel/middle/LoadingItems.js.map +2 -2
- package/dist/esm/parts/Panel/middle/MultipleSelectionAction.js +9 -7
- package/dist/esm/parts/Panel/middle/MultipleSelectionAction.js.map +2 -2
- package/dist/esm/parts/Panel/middle/PanelContentMiddleSection.js +122 -9
- package/dist/esm/parts/Panel/middle/PanelContentMiddleSection.js.map +2 -2
- package/dist/esm/parts/Panel/top/PanelContentTopSection.js +2 -1
- package/dist/esm/parts/Panel/top/PanelContentTopSection.js.map +2 -2
- package/dist/esm/parts/Panel/top/PanelFilterSection.js +3 -2
- package/dist/esm/parts/Panel/top/PanelFilterSection.js.map +2 -2
- package/dist/esm/parts/Panel/top/SelectionHeader.js +7 -3
- package/dist/esm/parts/Panel/top/SelectionHeader.js.map +2 -2
- package/dist/esm/parts/PanelWrapper.js +3 -2
- package/dist/esm/parts/PanelWrapper.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +14 -2
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/package.json +13 -11
- package/dist/cjs/config/configureAutoCalculated.js.map +0 -7
- package/dist/esm/config/configureAutoCalculated.js.map +0 -7
package/dist/cjs/DSShuttleV2.js
CHANGED
|
@@ -29,14 +29,13 @@ __export(DSShuttleV2_exports, {
|
|
|
29
29
|
module.exports = __toCommonJS(DSShuttleV2_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
31
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
-
var import_react = __toESM(require("react"));
|
|
33
32
|
var import_useShuttleV2 = require("./config/useShuttleV2");
|
|
34
33
|
var import_useStore = require("./config/useStore");
|
|
35
34
|
var import_MainContent = require("./parts/MainContent");
|
|
36
|
-
const ConfiguredComponent =
|
|
35
|
+
const ConfiguredComponent = (props) => {
|
|
37
36
|
(0, import_useShuttleV2.useShuttleV2)(props.userProps);
|
|
38
37
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_MainContent.MainContent, {});
|
|
39
|
-
}
|
|
38
|
+
};
|
|
40
39
|
const DSShuttleV2 = (props) => {
|
|
41
40
|
const createInternalStore = (0, import_useStore.useShuttleV2InternalStoreConfig)(props);
|
|
42
41
|
const createPropsStore = (0, import_useStore.useShuttleV2PropsStoreConfig)(props);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSShuttleV2.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { useShuttleV2 } from './config/useShuttleV2';\nimport {\n InternalProvider,\n PropsProvider,\n useShuttleV2InternalStoreConfig,\n useShuttleV2PropsStoreConfig,\n // useInternalStore,\n} from './config/useStore';\nimport { type DSShuttleV2T } from './react-desc-prop-types';\nimport { MainContent } from './parts/MainContent';\n\nconst ConfiguredComponent =
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADuBd;
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { useShuttleV2 } from './config/useShuttleV2';\nimport {\n InternalProvider,\n PropsProvider,\n useShuttleV2InternalStoreConfig,\n useShuttleV2PropsStoreConfig,\n // useInternalStore,\n} from './config/useStore';\nimport { type DSShuttleV2T } from './react-desc-prop-types';\nimport { MainContent } from './parts/MainContent';\n\nconst ConfiguredComponent = (props: { userProps: DSShuttleV2T.Props }) => {\n useShuttleV2(props.userProps);\n // const store = useInternalStore((state) => state);\n // React.useEffect(() => {\n // console.group('-----------------------------------------');\n // console.groupCollapsed('Full Store');\n // console.log(store);\n // console.groupEnd();\n // console.groupEnd();\n // }, [store]);\n\n return <MainContent />;\n};\n\nexport const DSShuttleV2 = (props: DSShuttleV2T.Props) => {\n const createInternalStore = useShuttleV2InternalStoreConfig(props);\n const createPropsStore = useShuttleV2PropsStoreConfig(props);\n\n return (\n <PropsProvider createStore={createPropsStore}>\n <InternalProvider createStore={createInternalStore}>\n <ConfiguredComponent userProps={props} />\n </InternalProvider>\n </PropsProvider>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADuBd;AAtBT,0BAA6B;AAC7B,sBAMO;AAEP,yBAA4B;AAE5B,MAAM,sBAAsB,CAAC,UAA6C;AACxE,wCAAa,MAAM,SAAS;AAU5B,SAAO,4CAAC,kCAAY;AACtB;AAEO,MAAM,cAAc,CAAC,UAA8B;AACxD,QAAM,0BAAsB,iDAAgC,KAAK;AACjE,QAAM,uBAAmB,8CAA6B,KAAK;AAE3D,SACE,4CAAC,iCAAc,aAAa,kBAC1B,sDAAC,oCAAiB,aAAa,qBAC7B,sDAAC,uBAAoB,WAAW,OAAO,GACzC,GACF;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var DSShuttleV2Definitions_exports = {};
|
|
26
|
+
__export(DSShuttleV2Definitions_exports, {
|
|
27
|
+
DSShuttleV2DataTestIds: () => DSShuttleV2DataTestIds,
|
|
28
|
+
DSShuttleV2Name: () => DSShuttleV2Name,
|
|
29
|
+
DSShuttleV2Slots: () => DSShuttleV2Slots
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(DSShuttleV2Definitions_exports);
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
34
|
+
const DSShuttleV2Name = "DSShuttleV2";
|
|
35
|
+
const DSShuttleV2Slots = {
|
|
36
|
+
HEADER_SEARCH_ICON: "header-search-icon",
|
|
37
|
+
WRAPPER: "wrapper",
|
|
38
|
+
PANEL_WRAPPER: "panel-wrapper",
|
|
39
|
+
LIST_WRAPPER: "list-wrapper",
|
|
40
|
+
ITEM_WRAPPER: "item-wrapper",
|
|
41
|
+
ITEM_ICON_WRAPPER: "item-icon-wrapper",
|
|
42
|
+
ITEM_LABEL_WRAPPER: "item-label-wrapper",
|
|
43
|
+
ITEM_MIDSECTION_WRAPPER: "item-midsection-wrapper",
|
|
44
|
+
ITEM_SELECTION: "item-selection",
|
|
45
|
+
ITEM_ACTIONS_WRAPPER: "item-actions-wrapper",
|
|
46
|
+
ITEM_ACTION_WRAPPER: "item-action-wrapper",
|
|
47
|
+
ITEM_ACTION_BTN: "item-action-btn",
|
|
48
|
+
ITEM_ACTION_BTN_DRILLDOWN_ICON: "item-action-btn-drilldown-icon",
|
|
49
|
+
ITEM_ACTION_BTN_TO_SOURCE_ICON: "item-action-btn-to-source-icon",
|
|
50
|
+
ITEM_ACTION_BTN_TO_DESTINATION_ICON: "item-action-btn-to-destination-icon",
|
|
51
|
+
LIST_BOTTOM_LOADING_MORE: "list-bottom-loading-more",
|
|
52
|
+
LIST_BOTTOM_LOAD_MORE_BTN: "list-bottom-load-more-btn",
|
|
53
|
+
LIST_WRAPPER_BOTTOM: "list-wrapper-bottom",
|
|
54
|
+
EMPTY_LIST_WRAPPER: "empty-list-wrapper",
|
|
55
|
+
ITEMS_WRAPPER: "items-wrapper",
|
|
56
|
+
LOADING_LIST_WRAPPER: "loading-list-wrapper",
|
|
57
|
+
MOVE_MULTIPLE_WRAPPER: "move-multiple-wrapper",
|
|
58
|
+
MOVE_MULTIPLE_BTN: "move-multiple-btn",
|
|
59
|
+
LIST_WRAPPER_MID: "list-wrapper-mid",
|
|
60
|
+
LIST_WRAPPER_TOP: "list-wrapper-top",
|
|
61
|
+
AREA_SEARCH_WRAPPER: "area-search-wrapper",
|
|
62
|
+
AREA_SEARCH_BAR: "area-search-bar",
|
|
63
|
+
AREA_SELECTION_HEADER: "area-selection-header",
|
|
64
|
+
AREA_SELECTION_HEADER_COUNT_LABEL: "area-selection-header-count-label"
|
|
65
|
+
};
|
|
66
|
+
const DSShuttleV2DataTestIds = (0, import_ds_system.slotObjectToDataTestIds)(DSShuttleV2Name, DSShuttleV2Slots);
|
|
67
|
+
//# sourceMappingURL=DSShuttleV2Definitions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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';\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_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};\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,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,uBAAuB;AAAA,EACvB,mCAAmC;AACrC;AAEO,MAAM,6BAAyB,0CAAwB,iBAAiB,gBAAgB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -74,6 +74,9 @@ const useHandleMoveSelection = ({ isDestinationPanel }) => {
|
|
|
74
74
|
const currOnChange = (0, import_useStore.usePropsStore)(
|
|
75
75
|
(state) => isDestinationPanel ? state.onDestinationChange : state.onSourceChange
|
|
76
76
|
);
|
|
77
|
+
const currOnRemove = (0, import_useStore.usePropsStore)(
|
|
78
|
+
(state) => isDestinationPanel ? state.onDestinationRemove : state.onSourceRemove
|
|
79
|
+
);
|
|
77
80
|
const onSelectionChange = (0, import_useStore.usePropsStore)(
|
|
78
81
|
(state) => isDestinationPanel ? state.onDestinationSelectionChange : state.onSourceSelectionChange
|
|
79
82
|
);
|
|
@@ -81,6 +84,7 @@ const useHandleMoveSelection = ({ isDestinationPanel }) => {
|
|
|
81
84
|
const otherPanelOnChange = (0, import_useStore.usePropsStore)(
|
|
82
85
|
(state) => isDestinationPanel ? state.onSourceChange : state.onDestinationChange
|
|
83
86
|
);
|
|
87
|
+
const otherPanelOnAdd = (0, import_useStore.usePropsStore)((state) => isDestinationPanel ? state.onSourceAdd : state.onDestinationAdd);
|
|
84
88
|
const destinationSelectionArray = (0, import_useStore.useInternalStore)((store) => store.destinationSelectionItemArray);
|
|
85
89
|
const sourceSelectionArray = (0, import_useStore.useInternalStore)((store) => store.sourceSelectionItemArray);
|
|
86
90
|
const selectedItems = isDestinationPanel ? destinationSelectionArray : sourceSelectionArray;
|
|
@@ -101,10 +105,22 @@ const useHandleMoveSelection = ({ isDestinationPanel }) => {
|
|
|
101
105
|
iteratedNewOtherData = newOtherData;
|
|
102
106
|
});
|
|
103
107
|
currOnChange(iteratedNewCurrData, { event, selectedItems });
|
|
108
|
+
currOnRemove(selectedItems, { event });
|
|
104
109
|
otherPanelOnChange(iteratedNewOtherData, { event, selectedItems });
|
|
110
|
+
otherPanelOnAdd(selectedItems, { event });
|
|
105
111
|
onSelectionChange({}, { event });
|
|
106
112
|
},
|
|
107
|
-
[
|
|
113
|
+
[
|
|
114
|
+
currData,
|
|
115
|
+
otherData,
|
|
116
|
+
selectedItems,
|
|
117
|
+
currOnChange,
|
|
118
|
+
currOnRemove,
|
|
119
|
+
otherPanelOnChange,
|
|
120
|
+
otherPanelOnAdd,
|
|
121
|
+
onSelectionChange,
|
|
122
|
+
currWithSoftDelete
|
|
123
|
+
]
|
|
108
124
|
);
|
|
109
125
|
return import_react.default.useMemo(() => ({ moveSelection }), [moveSelection]);
|
|
110
126
|
};
|
|
@@ -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 { type DSButtonT } from '@elliemae/ds-button';\nimport { type DSShuttleV2T } from '../react-desc-prop-types';\nimport { usePropsStore, useInternalStore } from './useStore';\n\nexport const getNewDatasWithItemMoved = ({\n item,\n currData,\n currWithSoftDelete,\n otherData,\n}: {\n item: DSShuttleV2T.Datum;\n currData: DSShuttleV2T.Datum[];\n currWithSoftDelete: boolean;\n otherData: DSShuttleV2T.Datum[];\n}) => {\n const { id, softDeleted } = item;\n const newCurrData = [...currData];\n const newOtherData = [...otherData];\n const currListIndex = newCurrData.findIndex((datum) => datum.id === id);\n const otherListIndex = newOtherData.findIndex((datum) => datum.id === id);\n const isCurrDataItemOriginalList = otherListIndex === -1 || (otherListIndex !== -1 && softDeleted);\n let currRemoveAtIndex = -1;\n /**\n * current data management\n * soft-deletion\n * if enabled\n * hard deletion\n * if not enabled\n * or\n * if we are \"moving back\" an item\n */\n if (currListIndex !== -1) {\n if (isCurrDataItemOriginalList) {\n // if curr data is the item's original list\n // soft-delete if users asks for soft-deletion\n if (currWithSoftDelete) newCurrData[currListIndex].softDeleted = true;\n // else hard delete\n else currRemoveAtIndex = currListIndex;\n } else {\n // else hard delete because we are moving back a soft-deleted element\n currRemoveAtIndex = currListIndex;\n }\n }\n // if hard-deletion was configured to be carried out -> hard delete in curr-data\n if (currRemoveAtIndex !== -1) newCurrData.splice(currRemoveAtIndex, 1);\n\n // we append to other data when it was not already present\n const shouldAppendToOtherData = otherListIndex === -1;\n // in the new list we don't treat the item as soft-deleted\n if (shouldAppendToOtherData) newOtherData.push({ ...item, softDeleted: false });\n // if it is already present we remove the soft-deleted status instead\n else newOtherData[otherListIndex].softDeleted = false;\n\n return {\n newCurrData,\n newOtherData,\n };\n};\nexport const useHandleMoveSelection = ({ isDestinationPanel }: { isDestinationPanel: boolean }) => {\n const currData = usePropsStore((state) => (isDestinationPanel ? state.destinationData : state.sourceData));\n const currWithSoftDelete = usePropsStore((state) =>\n isDestinationPanel ? state.destinationWithSoftDelete : state.sourceWithSoftDelete,\n );\n const currOnChange = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationChange : state.onSourceChange,\n );\n const onSelectionChange = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationSelectionChange : state.onSourceSelectionChange,\n );\n\n const otherData = usePropsStore((state) => (isDestinationPanel ? state.sourceData : state.destinationData));\n const otherPanelOnChange = usePropsStore((state) =>\n isDestinationPanel ? state.onSourceChange : state.onDestinationChange,\n );\n const destinationSelectionArray = useInternalStore((store) => store.destinationSelectionItemArray);\n const sourceSelectionArray = useInternalStore((store) => store.sourceSelectionItemArray);\n const selectedItems = isDestinationPanel ? destinationSelectionArray : sourceSelectionArray;\n\n const moveSelection = React.useCallback(\n (event: Parameters<Required<DSButtonT.Props>['onClick']>[0]) => {\n event.preventDefault();\n event.stopPropagation();\n let iteratedNewCurrData = [...currData];\n let iteratedNewOtherData = [...otherData];\n selectedItems.forEach((datum) => {\n const { newCurrData, newOtherData } = getNewDatasWithItemMoved({\n item: datum,\n currData: iteratedNewCurrData,\n currWithSoftDelete,\n otherData: iteratedNewOtherData,\n });\n iteratedNewCurrData = newCurrData;\n iteratedNewOtherData = newOtherData;\n });\n currOnChange(iteratedNewCurrData, { event, selectedItems });\n otherPanelOnChange(iteratedNewOtherData, { event, selectedItems });\n onSelectionChange({}, { event });\n },\n [currData
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAkB;AAGlB,sBAAgD;AAEzC,MAAM,2BAA2B,CAAC;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAKM;AACJ,QAAM,EAAE,IAAI,YAAY,IAAI;AAC5B,QAAM,cAAc,CAAC,GAAG,QAAQ;AAChC,QAAM,eAAe,CAAC,GAAG,SAAS;AAClC,QAAM,gBAAgB,YAAY,UAAU,CAAC,UAAU,MAAM,OAAO,EAAE;AACtE,QAAM,iBAAiB,aAAa,UAAU,CAAC,UAAU,MAAM,OAAO,EAAE;AACxE,QAAM,6BAA6B,mBAAmB,MAAO,mBAAmB,MAAM;AACtF,MAAI,oBAAoB;AAUxB,MAAI,kBAAkB,IAAI;AACxB,QAAI,4BAA4B;AAG9B,UAAI;AAAoB,oBAAY,eAAe,cAAc;AAAA;AAE5D,4BAAoB;AAAA,IAC3B,OAAO;AAEL,0BAAoB;AAAA,IACtB;AAAA,EACF;AAEA,MA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AAA,QACb,CAAC;AACD,8BAAsB;AACtB,+BAAuB;AAAA,MACzB,CAAC;AACD,mBAAa,qBAAqB,EAAE,OAAO,cAAc,CAAC;AAC1D,yBAAmB,sBAAsB,EAAE,OAAO,cAAc,CAAC;AACjE,wBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC;AAAA,IACjC;AAAA,IACA,
|
|
4
|
+
"sourcesContent": ["/* eslint-disable complexity */\n/* eslint-disable max-statements */\nimport React from 'react';\nimport { type DSButtonT } from '@elliemae/ds-button';\nimport { type DSShuttleV2T } from '../react-desc-prop-types';\nimport { usePropsStore, useInternalStore } from './useStore';\n\nexport const getNewDatasWithItemMoved = ({\n item,\n currData,\n currWithSoftDelete,\n otherData,\n}: {\n item: DSShuttleV2T.Datum;\n currData: DSShuttleV2T.Datum[];\n currWithSoftDelete: boolean;\n otherData: DSShuttleV2T.Datum[];\n}) => {\n const { id, softDeleted } = item;\n const newCurrData = [...currData];\n const newOtherData = [...otherData];\n const currListIndex = newCurrData.findIndex((datum) => datum.id === id);\n const otherListIndex = newOtherData.findIndex((datum) => datum.id === id);\n const isCurrDataItemOriginalList = otherListIndex === -1 || (otherListIndex !== -1 && softDeleted);\n let currRemoveAtIndex = -1;\n /**\n * current data management\n * soft-deletion\n * if enabled\n * hard deletion\n * if not enabled\n * or\n * if we are \"moving back\" an item\n */\n if (currListIndex !== -1) {\n if (isCurrDataItemOriginalList) {\n // if curr data is the item's original list\n // soft-delete if users asks for soft-deletion\n if (currWithSoftDelete) newCurrData[currListIndex].softDeleted = true;\n // else hard delete\n else currRemoveAtIndex = currListIndex;\n } else {\n // else hard delete because we are moving back a soft-deleted element\n currRemoveAtIndex = currListIndex;\n }\n }\n // if hard-deletion was configured to be carried out -> hard delete in curr-data\n if (currRemoveAtIndex !== -1) newCurrData.splice(currRemoveAtIndex, 1);\n\n // we append to other data when it was not already present\n const shouldAppendToOtherData = otherListIndex === -1;\n // in the new list we don't treat the item as soft-deleted\n if (shouldAppendToOtherData) newOtherData.push({ ...item, softDeleted: false });\n // if it is already present we remove the soft-deleted status instead\n else newOtherData[otherListIndex].softDeleted = false;\n\n return {\n newCurrData,\n newOtherData,\n };\n};\nexport const useHandleMoveSelection = ({ isDestinationPanel }: { isDestinationPanel: boolean }) => {\n const currData = usePropsStore((state) => (isDestinationPanel ? state.destinationData : state.sourceData));\n const currWithSoftDelete = usePropsStore((state) =>\n isDestinationPanel ? state.destinationWithSoftDelete : state.sourceWithSoftDelete,\n );\n const currOnChange = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationChange : state.onSourceChange,\n );\n const currOnRemove = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationRemove : state.onSourceRemove,\n );\n\n const onSelectionChange = usePropsStore((state) =>\n isDestinationPanel ? state.onDestinationSelectionChange : state.onSourceSelectionChange,\n );\n\n const otherData = usePropsStore((state) => (isDestinationPanel ? state.sourceData : state.destinationData));\n const otherPanelOnChange = usePropsStore((state) =>\n isDestinationPanel ? state.onSourceChange : state.onDestinationChange,\n );\n const otherPanelOnAdd = usePropsStore((state) => (isDestinationPanel ? state.onSourceAdd : state.onDestinationAdd));\n const destinationSelectionArray = useInternalStore((store) => store.destinationSelectionItemArray);\n const sourceSelectionArray = useInternalStore((store) => store.sourceSelectionItemArray);\n const selectedItems = isDestinationPanel ? destinationSelectionArray : sourceSelectionArray;\n\n const moveSelection = React.useCallback(\n (event: Parameters<Required<DSButtonT.Props>['onClick']>[0]) => {\n event.preventDefault();\n event.stopPropagation();\n let iteratedNewCurrData = [...currData];\n let iteratedNewOtherData = [...otherData];\n selectedItems.forEach((datum) => {\n const { newCurrData, newOtherData } = getNewDatasWithItemMoved({\n item: datum,\n currData: iteratedNewCurrData,\n currWithSoftDelete,\n otherData: iteratedNewOtherData,\n });\n iteratedNewCurrData = newCurrData;\n iteratedNewOtherData = newOtherData;\n });\n currOnChange(iteratedNewCurrData, { event, selectedItems });\n currOnRemove(selectedItems, { event });\n\n otherPanelOnChange(iteratedNewOtherData, { event, selectedItems });\n otherPanelOnAdd(selectedItems, { event });\n onSelectionChange({}, { event });\n },\n [\n currData,\n otherData,\n selectedItems,\n currOnChange,\n currOnRemove,\n otherPanelOnChange,\n otherPanelOnAdd,\n onSelectionChange,\n currWithSoftDelete,\n ],\n );\n return React.useMemo(() => ({ moveSelection }), [moveSelection]);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAkB;AAGlB,sBAAgD;AAEzC,MAAM,2BAA2B,CAAC;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAKM;AACJ,QAAM,EAAE,IAAI,YAAY,IAAI;AAC5B,QAAM,cAAc,CAAC,GAAG,QAAQ;AAChC,QAAM,eAAe,CAAC,GAAG,SAAS;AAClC,QAAM,gBAAgB,YAAY,UAAU,CAAC,UAAU,MAAM,OAAO,EAAE;AACtE,QAAM,iBAAiB,aAAa,UAAU,CAAC,UAAU,MAAM,OAAO,EAAE;AACxE,QAAM,6BAA6B,mBAAmB,MAAO,mBAAmB,MAAM;AACtF,MAAI,oBAAoB;AAUxB,MAAI,kBAAkB,IAAI;AACxB,QAAI,4BAA4B;AAG9B,UAAI;AAAoB,oBAAY,eAAe,cAAc;AAAA;AAE5D,4BAAoB;AAAA,IAC3B,OAAO;AAEL,0BAAoB;AAAA,IACtB;AAAA,EACF;AAEA,MAAI,sBAAsB;AAAI,gBAAY,OAAO,mBAAmB,CAAC;AAGrE,QAAM,0BAA0B,mBAAmB;AAEnD,MAAI;AAAyB,iBAAa,KAAK,EAAE,GAAG,MAAM,aAAa,MAAM,CAAC;AAAA;AAEzE,iBAAa,gBAAgB,cAAc;AAEhD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;AACO,MAAM,yBAAyB,CAAC,EAAE,mBAAmB,MAAuC;AACjG,QAAM,eAAW,+BAAc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;AAErC,yBAAmB,sBAAsB,EAAE,OAAO,cAAc,CAAC;AACjE,sBAAgB,eAAe,EAAE,MAAM,CAAC;AACxC,wBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC;AAAA,IACjC;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,SAAO,aAAAA,QAAM,QAAQ,OAAO,EAAE,cAAc,IAAI,CAAC,aAAa,CAAC;AACjE;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var useAutoCalculated_exports = {};
|
|
26
|
+
__export(useAutoCalculated_exports, {
|
|
27
|
+
useAutoCalculated: () => useAutoCalculated
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(useAutoCalculated_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
var import_react = require("react");
|
|
32
|
+
var import_useDataStructure = require("./useDataStructure");
|
|
33
|
+
var import_useShuttleVirtualized = require("./useShuttleVirtualized");
|
|
34
|
+
const useAutoCalculated = (propsWithDefaults) => {
|
|
35
|
+
const dataScructured = (0, import_useDataStructure.useDataStructure)(propsWithDefaults);
|
|
36
|
+
const virtualData = (0, import_useShuttleVirtualized.useShuttleVirtualized)(propsWithDefaults);
|
|
37
|
+
return (0, import_react.useMemo)(() => ({ ...dataScructured, ...virtualData }), [dataScructured, virtualData]);
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/config/useAutoCalculated/index.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { useMemo } from 'react';\n\nimport { type DSShuttleV2T } from '../../react-desc-prop-types';\nimport { useDataStructure } from './useDataStructure';\nimport { useShuttleVirtualized } from './useShuttleVirtualized';\n\nexport const useAutoCalculated = (propsWithDefaults: DSShuttleV2T.InternalProps) => {\n const dataScructured = useDataStructure(propsWithDefaults);\n const virtualData = useShuttleVirtualized(propsWithDefaults);\n\n return useMemo(() => ({ ...dataScructured, ...virtualData }), [dataScructured, virtualData]);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAwB;AAGxB,8BAAiC;AACjC,mCAAsC;AAE/B,MAAM,oBAAoB,CAAC,sBAAkD;AAClF,QAAM,qBAAiB,0CAAiB,iBAAiB;AACzD,QAAM,kBAAc,oDAAsB,iBAAiB;AAE3D,aAAO,sBAAQ,OAAO,EAAE,GAAG,gBAAgB,GAAG,YAAY,IAAI,CAAC,gBAAgB,WAAW,CAAC;AAC7F;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/config/{configureAutoCalculated.js → useAutoCalculated/useDataStructure.js}
RENAMED
|
@@ -22,12 +22,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
mod
|
|
23
23
|
));
|
|
24
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
-
var
|
|
26
|
-
__export(
|
|
27
|
-
|
|
25
|
+
var useDataStructure_exports = {};
|
|
26
|
+
__export(useDataStructure_exports, {
|
|
27
|
+
useDataStructure: () => useDataStructure
|
|
28
28
|
});
|
|
29
|
-
module.exports = __toCommonJS(
|
|
29
|
+
module.exports = __toCommonJS(useDataStructure_exports);
|
|
30
30
|
var React = __toESM(require("react"));
|
|
31
|
+
var import_react = require("react");
|
|
31
32
|
const getDatumFlags = (datum) => ({
|
|
32
33
|
selectionPrevented: Boolean(datum.softDeleted || datum.preventMove),
|
|
33
34
|
withActions: !datum.softDeleted,
|
|
@@ -55,7 +56,10 @@ const configureDestination = ({ destinationData, destinationSelectedItems }) =>
|
|
|
55
56
|
original: datum,
|
|
56
57
|
localIndex: i,
|
|
57
58
|
isFirst: i === 0,
|
|
58
|
-
isLast: i === destinationData.length - 1
|
|
59
|
+
isLast: i === destinationData.length - 1,
|
|
60
|
+
uid: datum.id,
|
|
61
|
+
depth: 0,
|
|
62
|
+
realIndex: datum.id
|
|
59
63
|
};
|
|
60
64
|
destinationConfiguredData.push(configuredItem);
|
|
61
65
|
if (!datum.preventMove) {
|
|
@@ -97,7 +101,10 @@ const configureSource = ({ sourceData, sourceSelectedItems }) => {
|
|
|
97
101
|
original: datum,
|
|
98
102
|
localIndex: i,
|
|
99
103
|
isFirst: i === 0,
|
|
100
|
-
isLast: i === sourceData.length - 1
|
|
104
|
+
isLast: i === sourceData.length - 1,
|
|
105
|
+
uid: datum.id,
|
|
106
|
+
depth: 0,
|
|
107
|
+
realIndex: datum.id
|
|
101
108
|
};
|
|
102
109
|
sourceConfiguredData.push(configuredItem);
|
|
103
110
|
if (!datum.preventMove) {
|
|
@@ -118,11 +125,14 @@ const configureSource = ({ sourceData, sourceSelectedItems }) => {
|
|
|
118
125
|
sourceSelectionableIds
|
|
119
126
|
};
|
|
120
127
|
};
|
|
121
|
-
const
|
|
128
|
+
const useDataStructure = (propsFromUser) => {
|
|
122
129
|
const { sourceData, sourceSelectedItems, destinationData, destinationSelectedItems } = propsFromUser;
|
|
123
|
-
return
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
130
|
+
return (0, import_react.useMemo)(
|
|
131
|
+
() => ({
|
|
132
|
+
...configureSource({ sourceData, sourceSelectedItems }),
|
|
133
|
+
...configureDestination({ destinationData, destinationSelectedItems })
|
|
134
|
+
}),
|
|
135
|
+
[destinationData, destinationSelectedItems, sourceData, sourceSelectedItems]
|
|
136
|
+
);
|
|
127
137
|
};
|
|
128
|
-
//# sourceMappingURL=
|
|
138
|
+
//# sourceMappingURL=useDataStructure.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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\nconst getDatumFlags = (datum: DSShuttleV2T.Datum) => ({\n selectionPrevented: Boolean(datum.softDeleted || datum.preventMove),\n withActions: !datum.softDeleted,\n withMoveBtn: !datum.softDeleted && !datum.preventMove,\n withDrilldownBtn: !datum.softDeleted && !datum.preventDrilldown,\n});\n\ntype ConfigureDestinationConfig = {\n destinationData: DSShuttleV2T.Datum[];\n destinationSelectedItems: Record<DSShuttleV2T.Datum['id'], boolean>;\n};\nconst configureDestination = ({ destinationData, destinationSelectedItems }: ConfigureDestinationConfig) => {\n const destinationSelectedItemsMap: Record<string, { datum: DSShuttleV2T.Datum; index: number }> = {};\n const destinationSelectionItemArray: DSShuttleV2T.Datum[] = [];\n const destinationSelectionArray: DSShuttleV2T.Datum['id'][] = [];\n const destinationConfiguredData: DSShuttleV2T.ConfiguredDatum[] = [];\n const destinationSelectionableData: DSShuttleV2T.ConfiguredDatum[] = [];\n const destinationSelectionableDataIds: DSShuttleV2T.Datum['id'][] = [];\n destinationData.forEach((datum, i) => {\n let isSelected = false;\n if (destinationSelectedItems[datum.id] === true) {\n destinationSelectionItemArray.push(datum);\n destinationSelectionArray.push(datum.id);\n isSelected = true;\n }\n destinationSelectedItemsMap[datum.id] = { datum, index: i };\n const configuredItem = {\n isSelected,\n ...getDatumFlags(datum),\n original: datum,\n localIndex: i,\n isFirst: i === 0,\n isLast: i === destinationData.length - 1,\n uid: datum.id,\n depth: 0,\n realIndex: datum.id,\n };\n destinationConfiguredData.push(configuredItem);\n if (!datum.preventMove) {\n destinationSelectionableData.push(configuredItem);\n destinationSelectionableDataIds.push(datum.id);\n }\n });\n const destinationHasMultipleSelectedItems = destinationSelectionArray.length >= 1;\n const destinationSelectionableIds = destinationSelectionableDataIds.join(' ');\n\n return {\n destinationSelectedItemsMap,\n destinationSelectionItemArray,\n destinationSelectionArray,\n destinationHasMultipleSelectedItems,\n destinationConfiguredData,\n destinationSelectionableData,\n destinationSelectionableDataIds,\n destinationSelectionableIds,\n };\n};\ntype ConfigureSourceConfig = {\n sourceData: DSShuttleV2T.Datum[];\n sourceSelectedItems: Record<DSShuttleV2T.Datum['id'], boolean>;\n};\n\nconst configureSource = ({ sourceData, sourceSelectedItems }: ConfigureSourceConfig) => {\n const sourceSelectedItemsMap: Record<string, { datum: DSShuttleV2T.Datum; index: number }> = {};\n const sourceSelectionItemArray: DSShuttleV2T.Datum[] = [];\n const sourceSelectionArray: DSShuttleV2T.Datum['id'][] = [];\n const sourceConfiguredData: DSShuttleV2T.ConfiguredDatum[] = [];\n const sourceSelectionableData: DSShuttleV2T.ConfiguredDatum[] = [];\n const sourceSelectionableDataIds: DSShuttleV2T.Datum['id'][] = [];\n sourceData.forEach((datum, i) => {\n let isSelected = false;\n if (sourceSelectedItems[datum.id] === true) {\n sourceSelectionItemArray.push(datum);\n sourceSelectionArray.push(datum.id);\n isSelected = true;\n }\n\n sourceSelectedItemsMap[datum.id] = { datum, index: i };\n const configuredItem = {\n isSelected,\n ...getDatumFlags(datum),\n original: datum,\n localIndex: i,\n isFirst: i === 0,\n isLast: i === sourceData.length - 1,\n // dnd\n uid: datum.id,\n depth: 0,\n realIndex: datum.id,\n };\n sourceConfiguredData.push(configuredItem);\n if (!datum.preventMove) {\n sourceSelectionableData.push(configuredItem);\n sourceSelectionableDataIds.push(datum.id);\n }\n });\n const sourceHasMultipleSelectedItems = sourceSelectionArray.length >= 1;\n const sourceSelectionableIds = sourceSelectionableDataIds.join(' ');\n return {\n sourceConfiguredData,\n sourceSelectedItemsMap,\n sourceSelectionItemArray,\n sourceSelectionArray,\n sourceHasMultipleSelectedItems,\n sourceSelectionableData,\n sourceSelectionableDataIds,\n sourceSelectionableIds,\n };\n};\n\nexport const useDataStructure = (propsFromUser: DSShuttleV2T.InternalProps) => {\n const { sourceData, sourceSelectedItems, destinationData, destinationSelectedItems } = propsFromUser;\n return useMemo(\n () => ({\n ...configureSource({ sourceData, sourceSelectedItems }),\n ...configureDestination({ destinationData, destinationSelectedItems }),\n }),\n [destinationData, destinationSelectedItems, sourceData, sourceSelectedItems],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;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AgB,EAAE,YAAY,oBAAoB,CAAC;AAAA,MACtD,GAAG,qBAAqB,EAAE,iBAAiB,yBAAyB,CAAC;AAAA,IACvE;AAAA,IACA,CAAC,iBAAiB,0BAA0B,YAAY,mBAAmB;AAAA,EAC7E;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var useShuttleVirtualized_exports = {};
|
|
26
|
+
__export(useShuttleVirtualized_exports, {
|
|
27
|
+
useShuttleVirtualized: () => useShuttleVirtualized
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(useShuttleVirtualized_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
var import_react = require("react");
|
|
32
|
+
var import_react_virtual = require("react-virtual");
|
|
33
|
+
const useShuttleVirtualized = (propsWithDefaults) => {
|
|
34
|
+
const destinationVirtualRef = (0, import_react.useRef)(null);
|
|
35
|
+
const sourceVirtualRef = (0, import_react.useRef)(null);
|
|
36
|
+
const estimatedSize = (0, import_react.useCallback)(() => 36, []);
|
|
37
|
+
const destinationVirtualConfig = (0, import_react.useMemo)(
|
|
38
|
+
() => ({
|
|
39
|
+
size: propsWithDefaults.destinationData.length,
|
|
40
|
+
parentRef: destinationVirtualRef,
|
|
41
|
+
overscan: 30,
|
|
42
|
+
estimateSize: estimatedSize
|
|
43
|
+
}),
|
|
44
|
+
[propsWithDefaults.destinationData.length, destinationVirtualRef, estimatedSize]
|
|
45
|
+
);
|
|
46
|
+
const {
|
|
47
|
+
virtualItems: destinationVirtualItems,
|
|
48
|
+
measure: destinationMeasure,
|
|
49
|
+
scrollToIndex: destinationScrollToIndex,
|
|
50
|
+
scrollToOffset: destinationScrollToOffset,
|
|
51
|
+
totalSize: destinationTotalSize
|
|
52
|
+
} = (0, import_react_virtual.useVirtual)(destinationVirtualConfig);
|
|
53
|
+
const sourceVirtualConfig = (0, import_react.useMemo)(
|
|
54
|
+
() => ({
|
|
55
|
+
size: propsWithDefaults.sourceData.length,
|
|
56
|
+
parentRef: sourceVirtualRef,
|
|
57
|
+
overscan: 30,
|
|
58
|
+
estimateSize: estimatedSize
|
|
59
|
+
}),
|
|
60
|
+
[propsWithDefaults.sourceData.length, sourceVirtualRef, estimatedSize]
|
|
61
|
+
);
|
|
62
|
+
const {
|
|
63
|
+
virtualItems: sourceVirtualItems,
|
|
64
|
+
measure: sourceMeasure,
|
|
65
|
+
scrollToIndex: sourceScrollToIndex,
|
|
66
|
+
scrollToOffset: sourceScrollToOffset,
|
|
67
|
+
totalSize: sourceTotalSize
|
|
68
|
+
} = (0, import_react_virtual.useVirtual)(sourceVirtualConfig);
|
|
69
|
+
return (0, import_react.useMemo)(
|
|
70
|
+
() => ({
|
|
71
|
+
destinationVirtualRef,
|
|
72
|
+
destinationVirtualItems,
|
|
73
|
+
destinationMeasure,
|
|
74
|
+
destinationScrollToIndex,
|
|
75
|
+
destinationScrollToOffset,
|
|
76
|
+
destinationTotalSize,
|
|
77
|
+
sourceVirtualRef,
|
|
78
|
+
sourceVirtualItems,
|
|
79
|
+
sourceMeasure,
|
|
80
|
+
sourceScrollToIndex,
|
|
81
|
+
sourceScrollToOffset,
|
|
82
|
+
sourceTotalSize
|
|
83
|
+
}),
|
|
84
|
+
[
|
|
85
|
+
destinationVirtualItems,
|
|
86
|
+
destinationMeasure,
|
|
87
|
+
destinationScrollToIndex,
|
|
88
|
+
destinationScrollToOffset,
|
|
89
|
+
destinationTotalSize,
|
|
90
|
+
sourceVirtualItems,
|
|
91
|
+
sourceMeasure,
|
|
92
|
+
sourceScrollToIndex,
|
|
93
|
+
sourceScrollToOffset,
|
|
94
|
+
sourceTotalSize
|
|
95
|
+
]
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=useShuttleVirtualized.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/config/useAutoCalculated/useShuttleVirtualized.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { useMemo, useCallback, useRef } from 'react';\nimport { useVirtual } from 'react-virtual';\n\nimport { type DSShuttleV2T } from '../../react-desc-prop-types';\n\ntype UseVirtualT = ReturnType<typeof useVirtual>;\ninterface UseVirtualizedT {\n destinationVirtualItems: UseVirtualT['virtualItems'];\n destinationMeasure: UseVirtualT['measure'];\n destinationScrollToIndex: UseVirtualT['scrollToIndex'];\n destinationScrollToOffset: UseVirtualT['scrollToOffset'];\n destinationTotalSize: UseVirtualT['totalSize'];\n destinationVirtualRef: React.Ref<HTMLDivElement>;\n sourceVirtualItems: UseVirtualT['virtualItems'];\n sourceMeasure: UseVirtualT['measure'];\n sourceScrollToIndex: UseVirtualT['scrollToIndex'];\n sourceScrollToOffset: UseVirtualT['scrollToOffset'];\n sourceTotalSize: UseVirtualT['totalSize'];\n sourceVirtualRef: React.Ref<HTMLDivElement>;\n}\nexport const useShuttleVirtualized = (propsWithDefaults: DSShuttleV2T.InternalProps): UseVirtualizedT => {\n const destinationVirtualRef = useRef<HTMLDivElement>(null);\n const sourceVirtualRef = useRef<HTMLDivElement>(null);\n\n const estimatedSize = useCallback(() => 36, []);\n\n const destinationVirtualConfig = useMemo(\n () => ({\n size: propsWithDefaults.destinationData.length,\n parentRef: destinationVirtualRef,\n overscan: 30,\n estimateSize: estimatedSize,\n }),\n [propsWithDefaults.destinationData.length, destinationVirtualRef, estimatedSize],\n );\n\n const {\n virtualItems: destinationVirtualItems,\n measure: destinationMeasure,\n scrollToIndex: destinationScrollToIndex,\n scrollToOffset: destinationScrollToOffset,\n totalSize: destinationTotalSize,\n }: ReturnType<typeof useVirtual> = useVirtual(destinationVirtualConfig);\n\n const sourceVirtualConfig = useMemo(\n () => ({\n size: propsWithDefaults.sourceData.length,\n parentRef: sourceVirtualRef,\n overscan: 30,\n estimateSize: estimatedSize,\n }),\n [propsWithDefaults.sourceData.length, sourceVirtualRef, estimatedSize],\n );\n\n const {\n virtualItems: sourceVirtualItems,\n measure: sourceMeasure,\n scrollToIndex: sourceScrollToIndex,\n scrollToOffset: sourceScrollToOffset,\n totalSize: sourceTotalSize,\n }: ReturnType<typeof useVirtual> = useVirtual(sourceVirtualConfig);\n\n return useMemo(\n () => ({\n destinationVirtualRef,\n destinationVirtualItems,\n destinationMeasure,\n destinationScrollToIndex,\n destinationScrollToOffset,\n destinationTotalSize,\n sourceVirtualRef,\n sourceVirtualItems,\n sourceMeasure,\n sourceScrollToIndex,\n sourceScrollToOffset,\n sourceTotalSize,\n }),\n [\n destinationVirtualItems,\n destinationMeasure,\n destinationScrollToIndex,\n destinationScrollToOffset,\n destinationTotalSize,\n sourceVirtualItems,\n sourceMeasure,\n sourceScrollToIndex,\n sourceScrollToOffset,\n sourceTotalSize,\n ],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA6C;AAC7C,2BAA2B;AAmBpB,MAAM,wBAAwB,CAAC,sBAAmE;AACvG,QAAM,4BAAwB,qBAAuB,IAAI;AACzD,QAAM,uBAAmB,qBAAuB,IAAI;AAEpD,QAAM,oBAAgB,0BAAY,MAAM,IAAI,CAAC,CAAC;AAE9C,QAAM,+BAA2B;AAAA,IAC/B,OAAO;AAAA,MACL,MAAM,kBAAkB,gBAAgB;AAAA,MACxC,WAAW;AAAA,MACX,UAAU;AAAA,MACV,cAAc;AAAA,IAChB;AAAA,IACA,CAAC,kBAAkB,gBAAgB,QAAQ,uBAAuB,aAAa;AAAA,EACjF;AAEA,QAAM;AAAA,IACJ,cAAc;AAAA,IACd,SAAS;AAAA,IACT,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,WAAW;AAAA,EACb,QAAmC,iCAAW,wBAAwB;AAEtE,QAAM,0BAAsB;AAAA,IAC1B,OAAO;AAAA,MACL,MAAM,kBAAkB,WAAW;AAAA,MACnC,WAAW;AAAA,MACX,UAAU;AAAA,MACV,cAAc;AAAA,IAChB;AAAA,IACA,CAAC,kBAAkB,WAAW,QAAQ,kBAAkB,aAAa;AAAA,EACvE;AAEA,QAAM;AAAA,IACJ,cAAc;AAAA,IACd,SAAS;AAAA,IACT,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,WAAW;AAAA,EACb,QAAmC,iCAAW,mBAAmB;AAEjE,aAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -103,33 +103,33 @@ const useFocusActionTrackers = () => {
|
|
|
103
103
|
const focusItemAction = (0, import_useStore.useInternalStore)((state) => state.focusItemAction);
|
|
104
104
|
const mutableFocusItemAction = (0, import_ds_utilities.useMakeMutable)(focusItemAction);
|
|
105
105
|
const setFocusItemAction = (0, import_useStore.useInternalStore)((state) => state.setFocusItemAction);
|
|
106
|
-
const
|
|
107
|
-
const
|
|
106
|
+
const removeDragAndDropFromDestination = (0, import_useStore.usePropsStore)((state) => state.removeDragAndDropFromDestination);
|
|
107
|
+
const addDragAndDropFromSource = (0, import_useStore.usePropsStore)((state) => state.addDragAndDropFromSource);
|
|
108
108
|
const trackFocusPrevAction = (0, import_react.useCallback)(
|
|
109
109
|
({ isDestinationPanel, item }) => {
|
|
110
110
|
const preventMove = Boolean(item.original.preventMove);
|
|
111
111
|
const preventDrilldown = Boolean(item.original.preventDrilldown);
|
|
112
|
-
const withDragAndDrop = isDestinationPanel &&
|
|
112
|
+
const withDragAndDrop = isDestinationPanel && !removeDragAndDropFromDestination || !isDestinationPanel && addDragAndDropFromSource;
|
|
113
113
|
const { prevAction } = getActionByProxymity({
|
|
114
114
|
flags: { preventMove, preventDrilldown, withDragAndDrop },
|
|
115
115
|
currentAction: mutableFocusItemAction.current
|
|
116
116
|
});
|
|
117
117
|
setFocusItemAction(prevAction);
|
|
118
118
|
},
|
|
119
|
-
[
|
|
119
|
+
[addDragAndDropFromSource, mutableFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction]
|
|
120
120
|
);
|
|
121
121
|
const trackFocusNextAction = (0, import_react.useCallback)(
|
|
122
122
|
({ isDestinationPanel, item }) => {
|
|
123
123
|
const preventMove = Boolean(item.original.preventMove);
|
|
124
124
|
const preventDrilldown = Boolean(item.original.preventDrilldown);
|
|
125
|
-
const withDragAndDrop = isDestinationPanel &&
|
|
125
|
+
const withDragAndDrop = isDestinationPanel && !removeDragAndDropFromDestination || !isDestinationPanel && addDragAndDropFromSource;
|
|
126
126
|
const { nextAction } = getActionByProxymity({
|
|
127
127
|
flags: { preventMove, preventDrilldown, withDragAndDrop },
|
|
128
128
|
currentAction: mutableFocusItemAction.current
|
|
129
129
|
});
|
|
130
130
|
setFocusItemAction(nextAction);
|
|
131
131
|
},
|
|
132
|
-
[
|
|
132
|
+
[addDragAndDropFromSource, mutableFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction]
|
|
133
133
|
);
|
|
134
134
|
return (0, import_react.useMemo)(
|
|
135
135
|
() => ({
|
|
@@ -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 { 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
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAqC;AACrC,0BAA+B;AAE/B,uBAAgC;AAChC,sBAAgD;AAWhD,MAAM,8BAA8B,CAAC,UAAuB;AAE1D,QAAM,EAAE,kBAAkB,gBAAgB,IAAI;AAC9C,QAAM,YAAY,EAAE,YAAY,IAAI,YAAY,GAA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;AACA,MAAM,uBAAuB,CAAC,EAAE,OAAO,cAAc,MAAqD;AACxG,MAAI,kBAAkB,iCAAgB;AAAU,WAAO,4BAA4B,KAAK;AACxF,MAAI,kBAAkB,iCAAgB;AAAa,WAAO,mCAAmC,KAAK;AAClG,MAAI,kBAAkB,iCAAgB;AAAe,WAAO,iCAAiC,KAAK;AAClG,SAAO,6BAA6B,KAAK;AAC3C;AACO,MAAM,yBAAyB,MAAM;AAC1C,QAAM,sBAAkB,kCAAiB,CAAC,UAAU,MAAM,eAAe;AAKzE,QAAM,6BAAyB,oCAAe,eAAe;AAC7D,QAAM,yBAAqB,kCAAiB,CAAC,UAAU,MAAM,kBAAkB;AAC/E,QAAM,
|
|
4
|
+
"sourcesContent": ["import { useMemo, useCallback } from 'react';\nimport { useMakeMutable } from '@elliemae/ds-utilities';\nimport { type DSShuttleV2T } from '../../react-desc-prop-types';\nimport { ACTIONS_FOCUSES } from '../../constants';\nimport { useInternalStore, usePropsStore } from '../useStore';\n\ntype ActionFlags = {\n preventDrilldown: boolean;\n withDragAndDrop: boolean;\n preventMove: boolean;\n};\ntype ActionByProxymity = {\n prevAction: typeof ACTIONS_FOCUSES[keyof typeof ACTIONS_FOCUSES];\n nextAction: typeof ACTIONS_FOCUSES[keyof typeof ACTIONS_FOCUSES];\n};\nconst getMoveBtnActionByProxymity = (flags: ActionFlags) => {\n // move button\n const { preventDrilldown, withDragAndDrop } = flags;\n const actionMap = { prevAction: '', nextAction: '' } as ActionByProxymity;\n // prev\n // drilldown if it exist\n // else drag n drop if it exist\n // else parent\n if (!preventDrilldown) actionMap.prevAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else if (withDragAndDrop) actionMap.prevAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.prevAction = ACTIONS_FOCUSES.PARENT;\n // next\n // drag n drop if it exist\n // else parent\n if (withDragAndDrop) actionMap.nextAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.nextAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getDragAndDropBtnActionByProxymity = (flags: ActionFlags) => {\n // Drag and drop handler\n const { preventMove, preventDrilldown } = flags;\n // next\n // always parent\n const actionMap = { prevAction: '', nextAction: ACTIONS_FOCUSES.PARENT } as ActionByProxymity;\n // prev\n // move if it exist\n // else drilldown if it exist\n // else parent\n if (!preventMove) actionMap.prevAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (!preventDrilldown) actionMap.prevAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else actionMap.prevAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getDrilldownBtnActionByProxymity = (flags: ActionFlags) => {\n // Drilldown handler\n const { withDragAndDrop, preventMove } = flags;\n // prev\n // always parent\n const actionMap = { prevAction: ACTIONS_FOCUSES.PARENT, nextAction: '' } as ActionByProxymity;\n // next\n // move if it exist\n // else drag n drop if it exist\n // else parent\n if (!preventMove) actionMap.nextAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (withDragAndDrop) actionMap.nextAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.nextAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getParenBtnActionByProxymity = (flags: ActionFlags) => {\n // Parent handler\n const { preventDrilldown, withDragAndDrop, preventMove } = flags;\n const actionMap = { prevAction: '', nextAction: '' } as ActionByProxymity;\n // prev\n // drag n drop if it exist\n // else move if it exist\n // else drilldown if it exist\n // else parent\n if (withDragAndDrop) actionMap.prevAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else if (!preventMove) actionMap.prevAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (!preventDrilldown) actionMap.prevAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else actionMap.prevAction = ACTIONS_FOCUSES.PARENT;\n // next\n // drilldown if it exist\n // else move if it exist\n // else drag n drop if it exist\n // else parent\n if (!preventDrilldown) actionMap.nextAction = ACTIONS_FOCUSES.DRILLDOWN_BTN;\n else if (!preventMove) actionMap.nextAction = ACTIONS_FOCUSES.MOVE_BTN;\n else if (withDragAndDrop) actionMap.nextAction = ACTIONS_FOCUSES.DRAG_N_DROP;\n else actionMap.nextAction = ACTIONS_FOCUSES.PARENT;\n return actionMap;\n};\nconst getActionByProxymity = ({ flags, currentAction }: { flags: ActionFlags; currentAction: string }) => {\n if (currentAction === ACTIONS_FOCUSES.MOVE_BTN) return getMoveBtnActionByProxymity(flags);\n if (currentAction === ACTIONS_FOCUSES.DRAG_N_DROP) return getDragAndDropBtnActionByProxymity(flags);\n if (currentAction === ACTIONS_FOCUSES.DRILLDOWN_BTN) return getDrilldownBtnActionByProxymity(flags);\n return getParenBtnActionByProxymity(flags);\n};\nexport const useFocusActionTrackers = () => {\n const focusItemAction = useInternalStore((state) => state.focusItemAction);\n // tracking actions are always triggered as user action callbacks\n // this means it should always be invoked after all the useEffect execute\n // since this is the case, we can avoid re-declaring the function with mutable pattern\n // this way we avoid useless re-renders\n const mutableFocusItemAction = useMakeMutable(focusItemAction);\n const setFocusItemAction = useInternalStore((state) => state.setFocusItemAction);\n const removeDragAndDropFromDestination = usePropsStore((state) => state.removeDragAndDropFromDestination);\n const addDragAndDropFromSource = usePropsStore((state) => state.addDragAndDropFromSource);\n const trackFocusPrevAction = useCallback(\n ({ isDestinationPanel, item }: DSShuttleV2T.ItemMeta) => {\n const preventMove = Boolean(item.original.preventMove);\n const preventDrilldown = Boolean(item.original.preventDrilldown);\n const withDragAndDrop =\n (isDestinationPanel && !removeDragAndDropFromDestination) || (!isDestinationPanel && addDragAndDropFromSource);\n const { prevAction } = getActionByProxymity({\n flags: { preventMove, preventDrilldown, withDragAndDrop },\n currentAction: mutableFocusItemAction.current,\n });\n setFocusItemAction(prevAction);\n },\n [addDragAndDropFromSource, mutableFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction],\n );\n const trackFocusNextAction = useCallback(\n ({ isDestinationPanel, item }: DSShuttleV2T.ItemMeta) => {\n const preventMove = Boolean(item.original.preventMove);\n const preventDrilldown = Boolean(item.original.preventDrilldown);\n const withDragAndDrop =\n (isDestinationPanel && !removeDragAndDropFromDestination) || (!isDestinationPanel && addDragAndDropFromSource);\n const { nextAction } = getActionByProxymity({\n flags: { preventMove, preventDrilldown, withDragAndDrop },\n currentAction: mutableFocusItemAction.current,\n });\n setFocusItemAction(nextAction);\n },\n [addDragAndDropFromSource, mutableFocusItemAction, removeDragAndDropFromDestination, setFocusItemAction],\n );\n return useMemo(\n () => ({\n mutableFocusItemAction,\n trackFocusActionMove: () => setFocusItemAction('move-btn'),\n trackFocusActionDrilldown: () => setFocusItemAction('drilldown-btn'),\n trackFocusActionDragAndDrop: () => setFocusItemAction('drag-n-drop'),\n trackFocusActionParent: () => setFocusItemAction('parent'),\n trackFocusActionReset: () => setFocusItemAction(''),\n trackFocusPrevAction,\n trackFocusNextAction,\n }),\n [mutableFocusItemAction, setFocusItemAction, trackFocusNextAction, trackFocusPrevAction],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAqC;AACrC,0BAA+B;AAE/B,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,Y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M,mBAAmB,aAAa;AAAA,MACnE,wBAAwB,MAAM,mBAAmB,QAAQ;AAAA,MACzD,uBAAuB,MAAM,mBAAmB,EAAE;AAAA,MAClD;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,wBAAwB,oBAAoB,sBAAsB,oBAAoB;AAAA,EACzF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -32,16 +32,15 @@ var import_react = require("react");
|
|
|
32
32
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
33
33
|
var import_react_desc_prop_types = require("../react-desc-prop-types");
|
|
34
34
|
var import_useStore = require("./useStore");
|
|
35
|
-
var
|
|
35
|
+
var import_useAutoCalculated = require("./useAutoCalculated");
|
|
36
36
|
const useShuttleV2 = (propsFromUser) => {
|
|
37
37
|
const propsWithDefaults = (0, import_ds_utilities.useMemoMergePropsWithDefault)(propsFromUser, import_react_desc_prop_types.defaultProps);
|
|
38
38
|
const setProps = (0, import_useStore.usePropsStore)((state) => state.set);
|
|
39
39
|
const setAutoCalculated = (0, import_useStore.useInternalStore)((state) => state.set);
|
|
40
|
+
const autoCalculatedConfig = (0, import_useAutoCalculated.useAutoCalculated)(propsWithDefaults);
|
|
40
41
|
(0, import_react.useEffect)(() => {
|
|
41
42
|
setProps({ ...propsWithDefaults });
|
|
42
|
-
setAutoCalculated(
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
}, [propsWithDefaults, setProps, setAutoCalculated]);
|
|
43
|
+
setAutoCalculated(autoCalculatedConfig);
|
|
44
|
+
}, [propsWithDefaults, setProps, setAutoCalculated, autoCalculatedConfig]);
|
|
46
45
|
};
|
|
47
46
|
//# sourceMappingURL=useShuttleV2.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/config/useShuttleV2.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { useEffect } from 'react';\nimport { useMemoMergePropsWithDefault } from '@elliemae/ds-utilities';\nimport { type DSShuttleV2T, defaultProps } from '../react-desc-prop-types';\nimport { usePropsStore, useInternalStore } from './useStore';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA0B;AAC1B,0BAA6C;
|
|
4
|
+
"sourcesContent": ["import { useEffect } from 'react';\nimport { useMemoMergePropsWithDefault } from '@elliemae/ds-utilities';\n\nimport { type DSShuttleV2T, defaultProps } from '../react-desc-prop-types';\nimport { usePropsStore, useInternalStore } from './useStore';\nimport { useAutoCalculated } from './useAutoCalculated';\nexport const useShuttleV2 = (propsFromUser: DSShuttleV2T.Props) => {\n // auto-update props-store and auto-calculated when props changes\n const propsWithDefaults = useMemoMergePropsWithDefault<DSShuttleV2T.InternalProps>(propsFromUser, defaultProps);\n const setProps = usePropsStore((state) => state.set);\n const setAutoCalculated = useInternalStore((state) => state.set);\n\n const autoCalculatedConfig = useAutoCalculated(propsWithDefaults);\n useEffect(() => {\n setProps({ ...propsWithDefaults });\n setAutoCalculated(autoCalculatedConfig);\n }, [propsWithDefaults, setProps, setAutoCalculated, autoCalculatedConfig]);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA0B;AAC1B,0BAA6C;AAE7C,mCAAgD;AAChD,sBAAgD;AAChD,+BAAkC;AAC3B,MAAM,eAAe,CAAC,kBAAsC;AAEjE,QAAM,wBAAoB,kDAAyD,eAAe,yCAAY;AAC9G,QAAM,eAAW,+BAAc,CAAC,UAAU,MAAM,GAAG;AACnD,QAAM,wBAAoB,kCAAiB,CAAC,UAAU,MAAM,GAAG;AAE/D,QAAM,2BAAuB,4CAAkB,iBAAiB;AAChE,8BAAU,MAAM;AACd,aAAS,EAAE,GAAG,kBAAkB,CAAC;AACjC,sBAAkB,oBAAoB;AAAA,EACxC,GAAG,CAAC,mBAAmB,UAAU,mBAAmB,oBAAoB,CAAC;AAC3E;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|