@elliemae/ds-shuttle-v2 3.6.0-next.7
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 +57 -0
- package/dist/cjs/DSShuttleV2.js.map +7 -0
- package/dist/cjs/config/configureAutoCalculated.js +131 -0
- package/dist/cjs/config/configureAutoCalculated.js.map +7 -0
- package/dist/cjs/config/itemMovementHelpers.js +148 -0
- package/dist/cjs/config/itemMovementHelpers.js.map +7 -0
- package/dist/cjs/config/useFocusTracker/index.js +38 -0
- package/dist/cjs/config/useFocusTracker/index.js.map +7 -0
- package/dist/cjs/config/useFocusTracker/useFocusActionTrackers.js +148 -0
- package/dist/cjs/config/useFocusTracker/useFocusActionTrackers.js.map +7 -0
- package/dist/cjs/config/useFocusTracker/useFocusItemTracker.js +95 -0
- package/dist/cjs/config/useFocusTracker/useFocusItemTracker.js.map +7 -0
- package/dist/cjs/config/useFocusTracker/useFocusRegionTrackers.js +79 -0
- package/dist/cjs/config/useFocusTracker/useFocusRegionTrackers.js.map +7 -0
- package/dist/cjs/config/useFocusTracker/useFocusTracker.js +48 -0
- package/dist/cjs/config/useFocusTracker/useFocusTracker.js.map +7 -0
- package/dist/cjs/config/useShuttleV2.js +43 -0
- package/dist/cjs/config/useShuttleV2.js.map +7 -0
- package/dist/cjs/config/useStore/createAtomInStore.js +40 -0
- package/dist/cjs/config/useStore/createAtomInStore.js.map +7 -0
- package/dist/cjs/config/useStore/index.js +26 -0
- package/dist/cjs/config/useStore/index.js.map +7 -0
- package/dist/cjs/config/useStore/useStore.js +79 -0
- package/dist/cjs/config/useStore/useStore.js.map +7 -0
- package/dist/cjs/constants/index.js +50 -0
- package/dist/cjs/constants/index.js.map +7 -0
- package/dist/cjs/index.js +32 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/parts/Header.js +78 -0
- package/dist/cjs/parts/Header.js.map +7 -0
- package/dist/cjs/parts/Item/Item.js +121 -0
- package/dist/cjs/parts/Item/Item.js.map +7 -0
- package/dist/cjs/parts/Item/ItemActions/ItemActions.js +132 -0
- package/dist/cjs/parts/Item/ItemActions/ItemActions.js.map +7 -0
- package/dist/cjs/parts/Item/ItemActions/index.js +26 -0
- package/dist/cjs/parts/Item/ItemActions/index.js.map +7 -0
- package/dist/cjs/parts/Item/ItemActions/useInnerRefHandlers.js +66 -0
- package/dist/cjs/parts/Item/ItemActions/useInnerRefHandlers.js.map +7 -0
- package/dist/cjs/parts/Item/ItemMiddleSection.js +125 -0
- package/dist/cjs/parts/Item/ItemMiddleSection.js.map +7 -0
- package/dist/cjs/parts/Item/ItemSelection.js +61 -0
- package/dist/cjs/parts/Item/ItemSelection.js.map +7 -0
- package/dist/cjs/parts/Item/useItemArrowNavigation.js +82 -0
- package/dist/cjs/parts/Item/useItemArrowNavigation.js.map +7 -0
- package/dist/cjs/parts/Item/useSelectionLogic.js +70 -0
- package/dist/cjs/parts/Item/useSelectionLogic.js.map +7 -0
- package/dist/cjs/parts/ItemListWrapper.js +114 -0
- package/dist/cjs/parts/ItemListWrapper.js.map +7 -0
- package/dist/cjs/parts/MainContent.js +71 -0
- package/dist/cjs/parts/MainContent.js.map +7 -0
- package/dist/cjs/parts/MultipleSelectionAction.js +120 -0
- package/dist/cjs/parts/MultipleSelectionAction.js.map +7 -0
- package/dist/cjs/parts/PanelWrapper.js +112 -0
- package/dist/cjs/parts/PanelWrapper.js.map +7 -0
- package/dist/cjs/parts/SelectionHeader.js +112 -0
- package/dist/cjs/parts/SelectionHeader.js.map +7 -0
- package/dist/cjs/react-desc-prop-types.js +43 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/sharedTypes.js +24 -0
- package/dist/cjs/sharedTypes.js.map +7 -0
- package/dist/esm/DSShuttleV2.js +31 -0
- package/dist/esm/DSShuttleV2.js.map +7 -0
- package/dist/esm/config/configureAutoCalculated.js +105 -0
- package/dist/esm/config/configureAutoCalculated.js.map +7 -0
- package/dist/esm/config/itemMovementHelpers.js +122 -0
- package/dist/esm/config/itemMovementHelpers.js.map +7 -0
- package/dist/esm/config/useFocusTracker/index.js +12 -0
- package/dist/esm/config/useFocusTracker/index.js.map +7 -0
- package/dist/esm/config/useFocusTracker/useFocusActionTrackers.js +122 -0
- package/dist/esm/config/useFocusTracker/useFocusActionTrackers.js.map +7 -0
- package/dist/esm/config/useFocusTracker/useFocusItemTracker.js +69 -0
- package/dist/esm/config/useFocusTracker/useFocusItemTracker.js.map +7 -0
- package/dist/esm/config/useFocusTracker/useFocusRegionTrackers.js +53 -0
- package/dist/esm/config/useFocusTracker/useFocusRegionTrackers.js.map +7 -0
- package/dist/esm/config/useFocusTracker/useFocusTracker.js +22 -0
- package/dist/esm/config/useFocusTracker/useFocusTracker.js.map +7 -0
- package/dist/esm/config/useShuttleV2.js +17 -0
- package/dist/esm/config/useShuttleV2.js.map +7 -0
- package/dist/esm/config/useStore/createAtomInStore.js +14 -0
- package/dist/esm/config/useStore/createAtomInStore.js.map +7 -0
- package/dist/esm/config/useStore/index.js +3 -0
- package/dist/esm/config/useStore/index.js.map +7 -0
- package/dist/esm/config/useStore/useStore.js +53 -0
- package/dist/esm/config/useStore/useStore.js.map +7 -0
- package/dist/esm/constants/index.js +24 -0
- package/dist/esm/constants/index.js.map +7 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/parts/Header.js +52 -0
- package/dist/esm/parts/Header.js.map +7 -0
- package/dist/esm/parts/Item/Item.js +95 -0
- package/dist/esm/parts/Item/Item.js.map +7 -0
- package/dist/esm/parts/Item/ItemActions/ItemActions.js +106 -0
- package/dist/esm/parts/Item/ItemActions/ItemActions.js.map +7 -0
- package/dist/esm/parts/Item/ItemActions/index.js +3 -0
- package/dist/esm/parts/Item/ItemActions/index.js.map +7 -0
- package/dist/esm/parts/Item/ItemActions/useInnerRefHandlers.js +40 -0
- package/dist/esm/parts/Item/ItemActions/useInnerRefHandlers.js.map +7 -0
- package/dist/esm/parts/Item/ItemMiddleSection.js +99 -0
- package/dist/esm/parts/Item/ItemMiddleSection.js.map +7 -0
- package/dist/esm/parts/Item/ItemSelection.js +35 -0
- package/dist/esm/parts/Item/ItemSelection.js.map +7 -0
- package/dist/esm/parts/Item/useItemArrowNavigation.js +56 -0
- package/dist/esm/parts/Item/useItemArrowNavigation.js.map +7 -0
- package/dist/esm/parts/Item/useSelectionLogic.js +44 -0
- package/dist/esm/parts/Item/useSelectionLogic.js.map +7 -0
- package/dist/esm/parts/ItemListWrapper.js +88 -0
- package/dist/esm/parts/ItemListWrapper.js.map +7 -0
- package/dist/esm/parts/MainContent.js +45 -0
- package/dist/esm/parts/MainContent.js.map +7 -0
- package/dist/esm/parts/MultipleSelectionAction.js +94 -0
- package/dist/esm/parts/MultipleSelectionAction.js.map +7 -0
- package/dist/esm/parts/PanelWrapper.js +86 -0
- package/dist/esm/parts/PanelWrapper.js.map +7 -0
- package/dist/esm/parts/SelectionHeader.js +86 -0
- package/dist/esm/parts/SelectionHeader.js.map +7 -0
- package/dist/esm/react-desc-prop-types.js +20 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/esm/sharedTypes.js +2 -0
- package/dist/esm/sharedTypes.js.map +7 -0
- package/package.json +75 -0
|
@@ -0,0 +1,57 @@
|
|
|
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 DSShuttleV2_exports = {};
|
|
26
|
+
__export(DSShuttleV2_exports, {
|
|
27
|
+
DSShuttleV2: () => DSShuttleV2
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(DSShuttleV2_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
+
var import_react = __toESM(require("react"));
|
|
33
|
+
var import_useShuttleV2 = require("./config/useShuttleV2");
|
|
34
|
+
var import_useStore = require("./config/useStore");
|
|
35
|
+
var import_MainContent = require("./parts/MainContent");
|
|
36
|
+
const ConfiguredComponent = import_react.default.memo((props) => {
|
|
37
|
+
(0, import_useShuttleV2.useShuttleV2)(props.userProps);
|
|
38
|
+
const store = (0, import_useStore.useStore)((state) => state);
|
|
39
|
+
(0, import_react.useEffect)(() => {
|
|
40
|
+
console.group("-----------------------------------------");
|
|
41
|
+
console.groupCollapsed("Full Store");
|
|
42
|
+
console.log(store);
|
|
43
|
+
console.groupEnd();
|
|
44
|
+
console.groupEnd();
|
|
45
|
+
}, [store]);
|
|
46
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_MainContent.MainContent, {});
|
|
47
|
+
});
|
|
48
|
+
const DSShuttleV2 = (props) => {
|
|
49
|
+
const createStore = (0, import_useStore.useShuttleV2StoreConfig)(props);
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_useStore.Provider, {
|
|
51
|
+
createStore,
|
|
52
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfiguredComponent, {
|
|
53
|
+
userProps: props
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=DSShuttleV2.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSShuttleV2.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { useEffect } from 'react';\nimport { useShuttleV2 } from './config/useShuttleV2';\nimport { Provider, useShuttleV2StoreConfig, useStore } from './config/useStore';\nimport { type DSShuttleV2T } from './react-desc-prop-types';\nimport { MainContent } from './parts/MainContent';\n\nconst ConfiguredComponent = React.memo((props: { userProps: DSShuttleV2T.Props }) => {\n useShuttleV2(props.userProps);\n const store = useStore((state) => state);\n 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 createStore = useShuttleV2StoreConfig(props);\n\n return (\n <Provider createStore={createStore}>\n <ConfiguredComponent userProps={props} />\n </Provider>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAAiC;AACjC,0BAA6B;AAC7B,sBAA4D;AAE5D,yBAA4B;AAE5B,MAAM,sBAAsB,aAAAA,QAAM,KAAK,CAAC,UAA6C;AACnF,wCAAa,MAAM,SAAS;AAC5B,QAAM,YAAQ,0BAAS,CAAC,UAAU,KAAK;AACvC,8BAAU,MAAM;AACd,YAAQ,MAAM,2CAA2C;AACzD,YAAQ,eAAe,YAAY;AACnC,YAAQ,IAAI,KAAK;AACjB,YAAQ,SAAS;AACjB,YAAQ,SAAS;AAAA,EACnB,GAAG,CAAC,KAAK,CAAC;AAEV,SAAO,4CAAC,kCAAY;AACtB,CAAC;AAEM,MAAM,cAAc,CAAC,UAA8B;AACxD,QAAM,kBAAc,yCAAwB,KAAK;AAEjD,SACE,4CAAC;AAAA,IAAS;AAAA,IACR,sDAAC;AAAA,MAAoB,WAAW;AAAA,KAAO;AAAA,GACzC;AAEJ;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
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 configureAutoCalculated_exports = {};
|
|
26
|
+
__export(configureAutoCalculated_exports, {
|
|
27
|
+
configureAutoCalculated: () => configureAutoCalculated
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(configureAutoCalculated_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
const getDatumFlags = (datum) => ({
|
|
32
|
+
selectionPrevented: Boolean(datum.softDeleted || datum.preventMove),
|
|
33
|
+
withActions: !datum.softDeleted,
|
|
34
|
+
withMoveBtn: !datum.softDeleted && !datum.preventMove,
|
|
35
|
+
withDrilldownBtn: !datum.softDeleted && !datum.preventDrilldown
|
|
36
|
+
});
|
|
37
|
+
const configureDestination = ({ destinationData, destinationSelectedItems }) => {
|
|
38
|
+
const destinationSelectedItemsMap = {};
|
|
39
|
+
const destinationSelectionItemArray = [];
|
|
40
|
+
const destinationSelectionArray = [];
|
|
41
|
+
const destinationConfiguredData = [];
|
|
42
|
+
const destinationSelectionableData = [];
|
|
43
|
+
const destinationSelectionableDataIds = [];
|
|
44
|
+
destinationData.forEach((datum, i) => {
|
|
45
|
+
let isSelected = false;
|
|
46
|
+
if (destinationSelectedItems[datum.id] === true) {
|
|
47
|
+
destinationSelectionItemArray.push(datum);
|
|
48
|
+
destinationSelectionArray.push(datum.id);
|
|
49
|
+
isSelected = true;
|
|
50
|
+
}
|
|
51
|
+
destinationSelectedItemsMap[datum.id] = { datum, index: i };
|
|
52
|
+
const configuredItem = {
|
|
53
|
+
isSelected,
|
|
54
|
+
...getDatumFlags(datum),
|
|
55
|
+
original: datum,
|
|
56
|
+
localIndex: i,
|
|
57
|
+
isFirst: i === 0,
|
|
58
|
+
isLast: i === destinationData.length - 1
|
|
59
|
+
};
|
|
60
|
+
destinationConfiguredData.push(configuredItem);
|
|
61
|
+
if (!datum.preventMove) {
|
|
62
|
+
destinationSelectionableData.push(configuredItem);
|
|
63
|
+
destinationSelectionableDataIds.push(datum.id);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
const destinationHasMultipleSelectedItems = destinationSelectionArray.length >= 1;
|
|
67
|
+
const destinationSelectionableIds = destinationSelectionableDataIds.join(" ");
|
|
68
|
+
return {
|
|
69
|
+
destinationSelectedItemsMap,
|
|
70
|
+
destinationSelectionItemArray,
|
|
71
|
+
destinationSelectionArray,
|
|
72
|
+
destinationHasMultipleSelectedItems,
|
|
73
|
+
destinationConfiguredData,
|
|
74
|
+
destinationSelectionableData,
|
|
75
|
+
destinationSelectionableDataIds,
|
|
76
|
+
destinationSelectionableIds
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
const configureSource = ({ sourceData, sourceSelectedItems }) => {
|
|
80
|
+
const sourceSelectedItemsMap = {};
|
|
81
|
+
const sourceSelectionItemArray = [];
|
|
82
|
+
const sourceSelectionArray = [];
|
|
83
|
+
const sourceConfiguredData = [];
|
|
84
|
+
const sourceSelectionableData = [];
|
|
85
|
+
const sourceSelectionableDataIds = [];
|
|
86
|
+
sourceData.forEach((datum, i) => {
|
|
87
|
+
let isSelected = false;
|
|
88
|
+
if (sourceSelectedItems[datum.id] === true) {
|
|
89
|
+
sourceSelectionItemArray.push(datum);
|
|
90
|
+
sourceSelectionArray.push(datum.id);
|
|
91
|
+
isSelected = true;
|
|
92
|
+
}
|
|
93
|
+
sourceSelectedItemsMap[datum.id] = { datum, index: i };
|
|
94
|
+
const configuredItem = {
|
|
95
|
+
isSelected,
|
|
96
|
+
...getDatumFlags(datum),
|
|
97
|
+
original: datum,
|
|
98
|
+
localIndex: i,
|
|
99
|
+
isFirst: i === 0,
|
|
100
|
+
isLast: i === sourceData.length - 1
|
|
101
|
+
};
|
|
102
|
+
sourceConfiguredData.push(configuredItem);
|
|
103
|
+
if (!datum.preventMove) {
|
|
104
|
+
sourceSelectionableData.push(configuredItem);
|
|
105
|
+
sourceSelectionableDataIds.push(datum.id);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const sourceHasMultipleSelectedItems = sourceSelectionArray.length >= 1;
|
|
109
|
+
const sourceSelectionableIds = sourceSelectionableDataIds.join(" ");
|
|
110
|
+
return {
|
|
111
|
+
sourceConfiguredData,
|
|
112
|
+
sourceSelectedItemsMap,
|
|
113
|
+
sourceSelectionItemArray,
|
|
114
|
+
sourceSelectionArray,
|
|
115
|
+
sourceHasMultipleSelectedItems,
|
|
116
|
+
sourceSelectionableData,
|
|
117
|
+
sourceSelectionableDataIds,
|
|
118
|
+
sourceSelectionableIds
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
const configureAutoCalculated = (propsFromUser) => {
|
|
122
|
+
const { sourceData } = propsFromUser;
|
|
123
|
+
const { sourceSelectedItems } = propsFromUser;
|
|
124
|
+
const { destinationData } = propsFromUser;
|
|
125
|
+
const { destinationSelectedItems } = propsFromUser;
|
|
126
|
+
return {
|
|
127
|
+
...configureSource({ sourceData, sourceSelectedItems }),
|
|
128
|
+
...configureDestination({ destinationData, destinationSelectedItems })
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=configureAutoCalculated.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/configureAutoCalculated.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { 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 };\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 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 };\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 configureAutoCalculated = (propsFromUser: DSShuttleV2T.InternalProps) => {\n const { sourceData } = propsFromUser;\n const { sourceSelectedItems } = propsFromUser;\n const { destinationData } = propsFromUser;\n const { destinationSelectedItems } = propsFromUser;\n return {\n ...configureSource({ sourceData, sourceSelectedItems }),\n ...configureDestination({ destinationData, destinationSelectedItems }),\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,MAAM,gBAAgB,CAAC,WAA+B;AAAA,EACpD,oBAAoB,QAAQ,MAAM,eAAe,MAAM,WAAW;AAAA,EAClE,aAAa,CAAC,MAAM;AAAA,EACpB,aAAa,CAAC,MAAM,eAAe,CAAC,MAAM;AAAA,EAC1C,kBAAkB,CAAC,MAAM,eAAe,CAAC,MAAM;AACj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;AACjB,QAAI,oBAAoB,MAAM,QAAQ,MAAM;AAC1C,+BAAyB,KAAK,KAAK;AACnC,2BAAqB,KAAK,MAAM,EAAE;AAClC,mBAAa;AAAA,IACf;AAEA,2BAAuB,MAAM,MAAM,EAAE,OAAO,OAAO,EAAE;AACrD,UAAM,iBAAiB;AAAA,MACrB;AAAA,MACA,GAAG,cAAc,KAAK;AAAA,MACtB,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,SAAS,MAAM;AAAA,MACf,QAAQ,MAAM,WAAW,SAAS;AAAA,IACpC;AACA,yBAAqB,KAAK,cAAc;AACxC,QAAI,CAAC,MAAM,aAAa;AACtB,8BAAwB,KAAK,cAAc;AAC3C,iCAA2B,KAAK,MAAM,EAAE;AAAA,IAC1C;AAAA,EACF,CAAC;AACD,QAAM,iCAAiC,qBAAqB,UAAU;AACtE,QAAM,yBAAyB,2BAA2B,KAAK,GAAG;AAClE,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,MAAM,0BAA0B,CAAC,kBAA8C;AACpF,QAAM,EAAE,WAAW,IAAI;AACvB,QAAM,EAAE,oBAAoB,IAAI;AAChC,QAAM,EAAE,gBAAgB,IAAI;AAC5B,QAAM,EAAE,yBAAyB,IAAI;AACrC,SAAO;AAAA,IACL,GAAG,gBAAgB,EAAE,YAAY,oBAAoB,CAAC;AAAA,IACtD,GAAG,qBAAqB,EAAE,iBAAiB,yBAAyB,CAAC;AAAA,EACvE;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
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 itemMovementHelpers_exports = {};
|
|
26
|
+
__export(itemMovementHelpers_exports, {
|
|
27
|
+
useActionsClickHandlers: () => useActionsClickHandlers,
|
|
28
|
+
useHandleMoveSelection: () => useHandleMoveSelection
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(itemMovementHelpers_exports);
|
|
31
|
+
var React = __toESM(require("react"));
|
|
32
|
+
var import_react = __toESM(require("react"));
|
|
33
|
+
var import_useStore = require("./useStore");
|
|
34
|
+
const getNewDatasWithItemMoved = ({
|
|
35
|
+
item,
|
|
36
|
+
currData,
|
|
37
|
+
currWithSoftDelete,
|
|
38
|
+
otherData
|
|
39
|
+
}) => {
|
|
40
|
+
const { id, softDeleted } = item;
|
|
41
|
+
const newCurrData = [...currData];
|
|
42
|
+
const newOtherData = [...otherData];
|
|
43
|
+
const currListIndex = newCurrData.findIndex((datum) => datum.id === id);
|
|
44
|
+
const otherListIndex = newOtherData.findIndex((datum) => datum.id === id);
|
|
45
|
+
const isCurrDataItemOriginalList = otherListIndex === -1 || otherListIndex !== -1 && softDeleted;
|
|
46
|
+
let currRemoveAtIndex = -1;
|
|
47
|
+
if (currListIndex !== -1) {
|
|
48
|
+
if (isCurrDataItemOriginalList) {
|
|
49
|
+
if (currWithSoftDelete)
|
|
50
|
+
newCurrData[currListIndex].softDeleted = true;
|
|
51
|
+
else
|
|
52
|
+
currRemoveAtIndex = currListIndex;
|
|
53
|
+
} else {
|
|
54
|
+
currRemoveAtIndex = currListIndex;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (currRemoveAtIndex !== -1)
|
|
58
|
+
newCurrData.splice(currRemoveAtIndex, 1);
|
|
59
|
+
const shouldAppendToOtherData = otherListIndex === -1;
|
|
60
|
+
if (shouldAppendToOtherData)
|
|
61
|
+
newOtherData.push({ ...item, softDeleted: false });
|
|
62
|
+
else
|
|
63
|
+
newOtherData[otherListIndex].softDeleted = false;
|
|
64
|
+
return {
|
|
65
|
+
newCurrData,
|
|
66
|
+
newOtherData
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
const useHandleMoveSelection = ({ isDestinationPanel }) => {
|
|
70
|
+
const currData = (0, import_useStore.useStore)((state) => isDestinationPanel ? state.destinationData : state.sourceData);
|
|
71
|
+
const currWithSoftDelete = (0, import_useStore.useStore)(
|
|
72
|
+
(state) => isDestinationPanel ? state.destinationWithSoftDelete : state.sourceWithSoftDelete
|
|
73
|
+
);
|
|
74
|
+
const currOnChange = (0, import_useStore.useStore)((state) => isDestinationPanel ? state.onDestinationChange : state.onSourceChange);
|
|
75
|
+
const onSelectionChange = (0, import_useStore.useStore)(
|
|
76
|
+
(state) => isDestinationPanel ? state.onDestinationSelectionChange : state.onSourceSelectionChange
|
|
77
|
+
);
|
|
78
|
+
const otherData = (0, import_useStore.useStore)((state) => isDestinationPanel ? state.sourceData : state.destinationData);
|
|
79
|
+
const otherPanelOnChange = (0, import_useStore.useStore)(
|
|
80
|
+
(state) => isDestinationPanel ? state.onSourceChange : state.onDestinationChange
|
|
81
|
+
);
|
|
82
|
+
const destinationSelectionArray = (0, import_useStore.useStore)((store) => store.destinationSelectionItemArray);
|
|
83
|
+
const sourceSelectionArray = (0, import_useStore.useStore)((store) => store.sourceSelectionItemArray);
|
|
84
|
+
const selectedItems = isDestinationPanel ? destinationSelectionArray : sourceSelectionArray;
|
|
85
|
+
const moveSelection = import_react.default.useCallback(
|
|
86
|
+
(event) => {
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
event.stopPropagation();
|
|
89
|
+
let iteratedNewCurrData = [...currData];
|
|
90
|
+
let iteratedNewOtherData = [...otherData];
|
|
91
|
+
selectedItems.forEach((datum) => {
|
|
92
|
+
const { newCurrData, newOtherData } = getNewDatasWithItemMoved({
|
|
93
|
+
item: datum,
|
|
94
|
+
currData: iteratedNewCurrData,
|
|
95
|
+
currWithSoftDelete,
|
|
96
|
+
otherData: iteratedNewOtherData
|
|
97
|
+
});
|
|
98
|
+
iteratedNewCurrData = newCurrData;
|
|
99
|
+
iteratedNewOtherData = newOtherData;
|
|
100
|
+
});
|
|
101
|
+
currOnChange(iteratedNewCurrData, { event, selectedItems });
|
|
102
|
+
otherPanelOnChange(iteratedNewOtherData, { event, selectedItems });
|
|
103
|
+
onSelectionChange({}, { event });
|
|
104
|
+
},
|
|
105
|
+
[currData, otherData, selectedItems, currOnChange, otherPanelOnChange, onSelectionChange, currWithSoftDelete]
|
|
106
|
+
);
|
|
107
|
+
return import_react.default.useMemo(() => ({ moveSelection }), [moveSelection]);
|
|
108
|
+
};
|
|
109
|
+
const useActionsClickHandlers = (itemMeta) => {
|
|
110
|
+
const { item, isDestinationPanel } = itemMeta;
|
|
111
|
+
const currData = (0, import_useStore.useStore)((state) => isDestinationPanel ? state.destinationData : state.sourceData);
|
|
112
|
+
const currWithSoftDelete = (0, import_useStore.useStore)(
|
|
113
|
+
(state) => isDestinationPanel ? state.destinationWithSoftDelete : state.sourceWithSoftDelete
|
|
114
|
+
);
|
|
115
|
+
const currOnChange = (0, import_useStore.useStore)((state) => isDestinationPanel ? state.onDestinationChange : state.onSourceChange);
|
|
116
|
+
const currDrilldown = (0, import_useStore.useStore)(
|
|
117
|
+
(state) => isDestinationPanel ? state.onDestinationDrilldown : state.onSourceDrilldown
|
|
118
|
+
);
|
|
119
|
+
const otherData = (0, import_useStore.useStore)((state) => isDestinationPanel ? state.sourceData : state.destinationData);
|
|
120
|
+
const otherPanelOnChange = (0, import_useStore.useStore)(
|
|
121
|
+
(state) => isDestinationPanel ? state.onSourceChange : state.onDestinationChange
|
|
122
|
+
);
|
|
123
|
+
const handleDrilldown = import_react.default.useCallback(
|
|
124
|
+
(event) => {
|
|
125
|
+
event.preventDefault();
|
|
126
|
+
event.stopPropagation();
|
|
127
|
+
currDrilldown(item.original, { event });
|
|
128
|
+
},
|
|
129
|
+
[currDrilldown, item]
|
|
130
|
+
);
|
|
131
|
+
const handleSingleMove = import_react.default.useCallback(
|
|
132
|
+
(event) => {
|
|
133
|
+
event.preventDefault();
|
|
134
|
+
event.stopPropagation();
|
|
135
|
+
const { newCurrData, newOtherData } = getNewDatasWithItemMoved({
|
|
136
|
+
item: item.original,
|
|
137
|
+
currData,
|
|
138
|
+
currWithSoftDelete,
|
|
139
|
+
otherData
|
|
140
|
+
});
|
|
141
|
+
currOnChange(newCurrData, { item: item.original, event });
|
|
142
|
+
otherPanelOnChange(newOtherData, { item: item.original, event });
|
|
143
|
+
},
|
|
144
|
+
[currData, currOnChange, currWithSoftDelete, item, otherData, otherPanelOnChange]
|
|
145
|
+
);
|
|
146
|
+
return import_react.default.useMemo(() => ({ handleDrilldown, handleSingleMove }), [handleDrilldown, handleSingleMove]);
|
|
147
|
+
};
|
|
148
|
+
//# sourceMappingURL=itemMovementHelpers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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 DSShuttleV2T } from '../react-desc-prop-types';\nimport { useStore } from './useStore';\n\nconst 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 = useStore((state) => (isDestinationPanel ? state.destinationData : state.sourceData));\n const currWithSoftDelete = useStore((state) =>\n isDestinationPanel ? state.destinationWithSoftDelete : state.sourceWithSoftDelete,\n );\n const currOnChange = useStore((state) => (isDestinationPanel ? state.onDestinationChange : state.onSourceChange));\n const onSelectionChange = useStore((state) =>\n isDestinationPanel ? state.onDestinationSelectionChange : state.onSourceSelectionChange,\n );\n\n const otherData = useStore((state) => (isDestinationPanel ? state.sourceData : state.destinationData));\n const otherPanelOnChange = useStore((state) =>\n isDestinationPanel ? state.onSourceChange : state.onDestinationChange,\n );\n const destinationSelectionArray = useStore((store) => store.destinationSelectionItemArray);\n const sourceSelectionArray = useStore((store) => store.sourceSelectionItemArray);\n const selectedItems = isDestinationPanel ? destinationSelectionArray : sourceSelectionArray;\n\n const moveSelection = React.useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\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, otherData, selectedItems, currOnChange, otherPanelOnChange, onSelectionChange, currWithSoftDelete],\n );\n return React.useMemo(() => ({ moveSelection }), [moveSelection]);\n};\n\nexport const useActionsClickHandlers = (itemMeta: DSShuttleV2T.ItemMeta) => {\n const { item, isDestinationPanel } = itemMeta;\n\n const currData = useStore((state) => (isDestinationPanel ? state.destinationData : state.sourceData));\n const currWithSoftDelete = useStore((state) =>\n isDestinationPanel ? state.destinationWithSoftDelete : state.sourceWithSoftDelete,\n );\n const currOnChange = useStore((state) => (isDestinationPanel ? state.onDestinationChange : state.onSourceChange));\n const currDrilldown = useStore((state) =>\n isDestinationPanel ? state.onDestinationDrilldown : state.onSourceDrilldown,\n );\n\n const otherData = useStore((state) => (isDestinationPanel ? state.sourceData : state.destinationData));\n const otherPanelOnChange = useStore((state) =>\n isDestinationPanel ? state.onSourceChange : state.onDestinationChange,\n );\n\n const handleDrilldown: React.MouseEventHandler<HTMLButtonElement> = React.useCallback(\n (event) => {\n event.preventDefault();\n event.stopPropagation();\n currDrilldown(item.original, { event });\n },\n [currDrilldown, item],\n );\n\n const handleSingleMove: React.MouseEventHandler<HTMLButtonElement> = React.useCallback(\n (event) => {\n event.preventDefault();\n event.stopPropagation();\n const { newCurrData, newOtherData } = getNewDatasWithItemMoved({\n item: item.original,\n currData,\n currWithSoftDelete,\n otherData,\n });\n\n currOnChange(newCurrData, { item: item.original, event });\n otherPanelOnChange(newOtherData, { item: item.original, event });\n },\n [currData, currOnChange, currWithSoftDelete, item, otherData, otherPanelOnChange],\n );\n return React.useMemo(() => ({ handleDrilldown, handleSingleMove }), [handleDrilldown, handleSingleMove]);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,mBAAkB;AAElB,sBAAyB;AAEzB,MAAM,2BAA2B,CAAC;AAAA,EAChC;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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BAA+D,aAAAA,QAAM;AAAA,IACzE,CAAC,UAAU;AACT,YAAM,eAAe;AACrB,YAAM,gBAAgB;AACtB,YAAM,EAAE,aAAa,aAAa,IAAI,yBAAyB;AAAA,QAC7D,MAAM,KAAK;AAAA,QACX;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAED,mBAAa,aAAa,EAAE,MAAM,KAAK,UAAU,MAAM,CAAC;AACxD,yBAAmB,cAAc,EAAE,MAAM,KAAK,UAAU,MAAM,CAAC;AAAA,IACjE;AAAA,IACA,CAAC,UAAU,cAAc,oBAAoB,MAAM,WAAW,kBAAkB;AAAA,EAClF;AACA,SAAO,aAAAA,QAAM,QAAQ,OAAO,EAAE,iBAAiB,iBAAiB,IAAI,CAAC,iBAAiB,gBAAgB,CAAC;AACzG;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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 useFocusTracker_exports = {};
|
|
26
|
+
__export(useFocusTracker_exports, {
|
|
27
|
+
useFocusActionTrackers: () => import_useFocusActionTrackers.useFocusActionTrackers,
|
|
28
|
+
useFocusItemTracker: () => import_useFocusItemTracker.useFocusItemTracker,
|
|
29
|
+
useFocusRegionTrackers: () => import_useFocusRegionTrackers.useFocusRegionTrackers,
|
|
30
|
+
useFocusTracker: () => import_useFocusTracker.useFocusTracker
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(useFocusTracker_exports);
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
var import_useFocusActionTrackers = require("./useFocusActionTrackers");
|
|
35
|
+
var import_useFocusItemTracker = require("./useFocusItemTracker");
|
|
36
|
+
var import_useFocusRegionTrackers = require("./useFocusRegionTrackers");
|
|
37
|
+
var import_useFocusTracker = require("./useFocusTracker");
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/config/useFocusTracker/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export { useFocusActionTrackers } from './useFocusActionTrackers';\nexport { useFocusItemTracker } from './useFocusItemTracker';\nexport { useFocusRegionTrackers } from './useFocusRegionTrackers';\nexport { useFocusTracker } from './useFocusTracker';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,oCAAuC;AACvC,iCAAoC;AACpC,oCAAuC;AACvC,6BAAgC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
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 useFocusActionTrackers_exports = {};
|
|
26
|
+
__export(useFocusActionTrackers_exports, {
|
|
27
|
+
useFocusActionTrackers: () => useFocusActionTrackers
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(useFocusActionTrackers_exports);
|
|
30
|
+
var React = __toESM(require("react"));
|
|
31
|
+
var import_react = require("react");
|
|
32
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
33
|
+
var import_constants = require("../../constants");
|
|
34
|
+
var import_useStore = require("../useStore");
|
|
35
|
+
const getMoveBtnActionByProxymity = (flags) => {
|
|
36
|
+
const { preventDrilldown, withDragAndDrop } = flags;
|
|
37
|
+
const actionMap = { prevAction: "", nextAction: "" };
|
|
38
|
+
if (!preventDrilldown)
|
|
39
|
+
actionMap.prevAction = import_constants.ACTIONS_FOCUSES.DRILLDOWN_BTN;
|
|
40
|
+
else if (withDragAndDrop)
|
|
41
|
+
actionMap.prevAction = import_constants.ACTIONS_FOCUSES.DRAG_N_DROP;
|
|
42
|
+
else
|
|
43
|
+
actionMap.prevAction = import_constants.ACTIONS_FOCUSES.PARENT;
|
|
44
|
+
if (withDragAndDrop)
|
|
45
|
+
actionMap.nextAction = import_constants.ACTIONS_FOCUSES.DRAG_N_DROP;
|
|
46
|
+
else
|
|
47
|
+
actionMap.nextAction = import_constants.ACTIONS_FOCUSES.PARENT;
|
|
48
|
+
return actionMap;
|
|
49
|
+
};
|
|
50
|
+
const getDragAndDropBtnActionByProxymity = (flags) => {
|
|
51
|
+
const { preventMove, preventDrilldown } = flags;
|
|
52
|
+
const actionMap = { prevAction: "", nextAction: import_constants.ACTIONS_FOCUSES.PARENT };
|
|
53
|
+
if (!preventMove)
|
|
54
|
+
actionMap.prevAction = import_constants.ACTIONS_FOCUSES.MOVE_BTN;
|
|
55
|
+
else if (!preventDrilldown)
|
|
56
|
+
actionMap.prevAction = import_constants.ACTIONS_FOCUSES.DRILLDOWN_BTN;
|
|
57
|
+
else
|
|
58
|
+
actionMap.prevAction = import_constants.ACTIONS_FOCUSES.PARENT;
|
|
59
|
+
return actionMap;
|
|
60
|
+
};
|
|
61
|
+
const getDrilldownBtnActionByProxymity = (flags) => {
|
|
62
|
+
const { withDragAndDrop, preventMove } = flags;
|
|
63
|
+
const actionMap = { prevAction: import_constants.ACTIONS_FOCUSES.PARENT, nextAction: "" };
|
|
64
|
+
if (!preventMove)
|
|
65
|
+
actionMap.nextAction = import_constants.ACTIONS_FOCUSES.MOVE_BTN;
|
|
66
|
+
else if (withDragAndDrop)
|
|
67
|
+
actionMap.nextAction = import_constants.ACTIONS_FOCUSES.DRAG_N_DROP;
|
|
68
|
+
else
|
|
69
|
+
actionMap.nextAction = import_constants.ACTIONS_FOCUSES.PARENT;
|
|
70
|
+
return actionMap;
|
|
71
|
+
};
|
|
72
|
+
const getParenBtnActionByProxymity = (flags) => {
|
|
73
|
+
const { preventDrilldown, withDragAndDrop, preventMove } = flags;
|
|
74
|
+
const actionMap = { prevAction: "", nextAction: "" };
|
|
75
|
+
if (withDragAndDrop)
|
|
76
|
+
actionMap.prevAction = import_constants.ACTIONS_FOCUSES.DRAG_N_DROP;
|
|
77
|
+
else if (!preventMove)
|
|
78
|
+
actionMap.prevAction = import_constants.ACTIONS_FOCUSES.MOVE_BTN;
|
|
79
|
+
else if (!preventDrilldown)
|
|
80
|
+
actionMap.prevAction = import_constants.ACTIONS_FOCUSES.DRILLDOWN_BTN;
|
|
81
|
+
else
|
|
82
|
+
actionMap.prevAction = import_constants.ACTIONS_FOCUSES.PARENT;
|
|
83
|
+
if (!preventDrilldown)
|
|
84
|
+
actionMap.nextAction = import_constants.ACTIONS_FOCUSES.DRILLDOWN_BTN;
|
|
85
|
+
else if (!preventMove)
|
|
86
|
+
actionMap.nextAction = import_constants.ACTIONS_FOCUSES.MOVE_BTN;
|
|
87
|
+
else if (withDragAndDrop)
|
|
88
|
+
actionMap.nextAction = import_constants.ACTIONS_FOCUSES.DRAG_N_DROP;
|
|
89
|
+
else
|
|
90
|
+
actionMap.nextAction = import_constants.ACTIONS_FOCUSES.PARENT;
|
|
91
|
+
return actionMap;
|
|
92
|
+
};
|
|
93
|
+
const getActionByProxymity = ({ flags, currentAction }) => {
|
|
94
|
+
if (currentAction === import_constants.ACTIONS_FOCUSES.MOVE_BTN)
|
|
95
|
+
return getMoveBtnActionByProxymity(flags);
|
|
96
|
+
if (currentAction === import_constants.ACTIONS_FOCUSES.DRAG_N_DROP)
|
|
97
|
+
return getDragAndDropBtnActionByProxymity(flags);
|
|
98
|
+
if (currentAction === import_constants.ACTIONS_FOCUSES.DRILLDOWN_BTN)
|
|
99
|
+
return getDrilldownBtnActionByProxymity(flags);
|
|
100
|
+
return getParenBtnActionByProxymity(flags);
|
|
101
|
+
};
|
|
102
|
+
const useFocusActionTrackers = () => {
|
|
103
|
+
const focusItemAction = (0, import_useStore.useStore)((state) => state.focusItemAction);
|
|
104
|
+
const mutableFocusItemAction = (0, import_ds_utilities.useMakeMutable)(focusItemAction);
|
|
105
|
+
const setFocusItemAction = (0, import_useStore.useStore)((state) => state.setFocusItemAction);
|
|
106
|
+
const addDragAndDropToDestiantion = (0, import_useStore.useStore)((state) => state.addDragAndDropToDestiantion);
|
|
107
|
+
const removeDragAndDropFromSource = (0, import_useStore.useStore)((state) => state.removeDragAndDropFromSource);
|
|
108
|
+
const trackFocusPrevAction = (0, import_react.useCallback)(
|
|
109
|
+
({ isDestinationPanel, item }) => {
|
|
110
|
+
const preventMove = Boolean(item.original.preventMove);
|
|
111
|
+
const preventDrilldown = Boolean(item.original.preventDrilldown);
|
|
112
|
+
const withDragAndDrop = isDestinationPanel && addDragAndDropToDestiantion || !isDestinationPanel && !removeDragAndDropFromSource;
|
|
113
|
+
const { prevAction } = getActionByProxymity({
|
|
114
|
+
flags: { preventMove, preventDrilldown, withDragAndDrop },
|
|
115
|
+
currentAction: mutableFocusItemAction.current
|
|
116
|
+
});
|
|
117
|
+
setFocusItemAction(prevAction);
|
|
118
|
+
},
|
|
119
|
+
[addDragAndDropToDestiantion, mutableFocusItemAction, removeDragAndDropFromSource, setFocusItemAction]
|
|
120
|
+
);
|
|
121
|
+
const trackFocusNextAction = (0, import_react.useCallback)(
|
|
122
|
+
({ isDestinationPanel, item }) => {
|
|
123
|
+
const preventMove = Boolean(item.original.preventMove);
|
|
124
|
+
const preventDrilldown = Boolean(item.original.preventDrilldown);
|
|
125
|
+
const withDragAndDrop = isDestinationPanel && addDragAndDropToDestiantion || !isDestinationPanel && !removeDragAndDropFromSource;
|
|
126
|
+
const { nextAction } = getActionByProxymity({
|
|
127
|
+
flags: { preventMove, preventDrilldown, withDragAndDrop },
|
|
128
|
+
currentAction: mutableFocusItemAction.current
|
|
129
|
+
});
|
|
130
|
+
setFocusItemAction(nextAction);
|
|
131
|
+
},
|
|
132
|
+
[addDragAndDropToDestiantion, mutableFocusItemAction, removeDragAndDropFromSource, setFocusItemAction]
|
|
133
|
+
);
|
|
134
|
+
return (0, import_react.useMemo)(
|
|
135
|
+
() => ({
|
|
136
|
+
mutableFocusItemAction,
|
|
137
|
+
trackFocusActionMove: () => setFocusItemAction("move-btn"),
|
|
138
|
+
trackFocusActionDrilldown: () => setFocusItemAction("drilldown-btn"),
|
|
139
|
+
trackFocusActionDragAndDrop: () => setFocusItemAction("drag-n-drop"),
|
|
140
|
+
trackFocusActionParent: () => setFocusItemAction("parent"),
|
|
141
|
+
trackFocusActionReset: () => setFocusItemAction(""),
|
|
142
|
+
trackFocusPrevAction,
|
|
143
|
+
trackFocusNextAction
|
|
144
|
+
}),
|
|
145
|
+
[mutableFocusItemAction, setFocusItemAction, trackFocusNextAction, trackFocusPrevAction]
|
|
146
|
+
);
|
|
147
|
+
};
|
|
148
|
+
//# sourceMappingURL=useFocusActionTrackers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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 { useStore } 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 = useStore((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 = useStore((state) => state.setFocusItemAction);\n const addDragAndDropToDestiantion = useStore((state) => state.addDragAndDropToDestiantion);\n const removeDragAndDropFromSource = useStore((state) => state.removeDragAndDropFromSource);\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 && addDragAndDropToDestiantion) || (!isDestinationPanel && !removeDragAndDropFromSource);\n const { prevAction } = getActionByProxymity({\n flags: { preventMove, preventDrilldown, withDragAndDrop },\n currentAction: mutableFocusItemAction.current,\n });\n setFocusItemAction(prevAction);\n },\n [addDragAndDropToDestiantion, mutableFocusItemAction, removeDragAndDropFromSource, 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 && addDragAndDropToDestiantion) || (!isDestinationPanel && !removeDragAndDropFromSource);\n const { nextAction } = getActionByProxymity({\n flags: { preventMove, preventDrilldown, withDragAndDrop },\n currentAction: mutableFocusItemAction.current,\n });\n setFocusItemAction(nextAction);\n },\n [addDragAndDropToDestiantion, mutableFocusItemAction, removeDragAndDropFromSource, 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;ADA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