@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,112 @@
|
|
|
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 PanelWrapper_exports = {};
|
|
26
|
+
__export(PanelWrapper_exports, {
|
|
27
|
+
PanelWrapper: () => PanelWrapper
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(PanelWrapper_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_ds_system = require("@elliemae/ds-system");
|
|
34
|
+
var import_ds_grid = require("@elliemae/ds-grid");
|
|
35
|
+
var import_ds_form_input_text = require("@elliemae/ds-form-input-text");
|
|
36
|
+
var import_useStore = require("../config/useStore");
|
|
37
|
+
var import_Header = require("./Header");
|
|
38
|
+
var import_ItemListWrapper = require("./ItemListWrapper");
|
|
39
|
+
var import_SelectionHeader = require("./SelectionHeader");
|
|
40
|
+
const StyledPanelWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, { name: "ds-shuttle-v2", slot: "panel-wrapper" })`
|
|
41
|
+
min-width: 300px;
|
|
42
|
+
min-height: 264px;
|
|
43
|
+
`;
|
|
44
|
+
const StyledListWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, { name: "ds-shuttle-v2", slot: "list-wrapper" })`
|
|
45
|
+
border: 1px solid neutral-400;
|
|
46
|
+
`;
|
|
47
|
+
const StyledInputText = (0, import_ds_system.styled)(import_ds_form_input_text.DSInputText, { name: "ds-shuttle-v2", slot: "area-search-bar" })`
|
|
48
|
+
border: none;
|
|
49
|
+
border-bottom: 1px solid neutral-300;
|
|
50
|
+
border-radius: 0;
|
|
51
|
+
`;
|
|
52
|
+
const panelWrapperRows = ["auto", "1fr"];
|
|
53
|
+
const PanelWrapper = import_react.default.memo((panelMetaInfo) => {
|
|
54
|
+
const { isDestinationPanel = false } = panelMetaInfo;
|
|
55
|
+
const itemsLength = (0, import_useStore.useStore)(
|
|
56
|
+
(state) => isDestinationPanel ? state.destinationData.length : state.sourceData.length
|
|
57
|
+
);
|
|
58
|
+
const filterValue = (0, import_useStore.useStore)(
|
|
59
|
+
(state) => isDestinationPanel ? state.destinationFilterValue : state.sourceFilterValue
|
|
60
|
+
);
|
|
61
|
+
const onFilterCb = (0, import_useStore.useStore)(
|
|
62
|
+
(state) => isDestinationPanel ? state.onDestinationFilterChange : state.onSourceFilterChange
|
|
63
|
+
);
|
|
64
|
+
const isSearchBarOpen = (0, import_useStore.useStore)(
|
|
65
|
+
(state) => isDestinationPanel ? state.destinationShowSearchbar : state.sourceShowSearchbar
|
|
66
|
+
);
|
|
67
|
+
const handleFilterChange = import_react.default.useCallback(
|
|
68
|
+
(event) => {
|
|
69
|
+
const {
|
|
70
|
+
target: { value }
|
|
71
|
+
} = event;
|
|
72
|
+
onFilterCb?.(value, { event });
|
|
73
|
+
},
|
|
74
|
+
[onFilterCb]
|
|
75
|
+
);
|
|
76
|
+
const listWrapperRows = import_react.default.useMemo(() => {
|
|
77
|
+
const cols = [];
|
|
78
|
+
if (isSearchBarOpen)
|
|
79
|
+
cols.push("auto");
|
|
80
|
+
cols.push("auto", "1fr");
|
|
81
|
+
return cols;
|
|
82
|
+
}, [isSearchBarOpen]);
|
|
83
|
+
if (itemsLength === 0)
|
|
84
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
85
|
+
children: "Empty state"
|
|
86
|
+
});
|
|
87
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(StyledPanelWrapper, {
|
|
88
|
+
rows: panelWrapperRows,
|
|
89
|
+
gutter: "xxxs",
|
|
90
|
+
children: [
|
|
91
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Header.Header, {
|
|
92
|
+
isDestinationPanel
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(StyledListWrapper, {
|
|
95
|
+
rows: listWrapperRows,
|
|
96
|
+
children: [
|
|
97
|
+
isSearchBarOpen ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledInputText, {
|
|
98
|
+
value: filterValue,
|
|
99
|
+
onValueChange: handleFilterChange
|
|
100
|
+
}) : null,
|
|
101
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SelectionHeader.SelectionHeader, {
|
|
102
|
+
...panelMetaInfo
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ItemListWrapper.ItemListWrapper, {
|
|
105
|
+
isDestinationPanel
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
})
|
|
109
|
+
]
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
//# sourceMappingURL=PanelWrapper.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/PanelWrapper.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSInputText } from '@elliemae/ds-form-input-text';\nimport { useStore } from '../config/useStore';\nimport { type DSShuttleV2InternalsT } from '../sharedTypes';\nimport { Header } from './Header';\nimport { ItemListWrapper } from './ItemListWrapper';\nimport { SelectionHeader } from './SelectionHeader';\n\nconst StyledPanelWrapper = styled(Grid, { name: 'ds-shuttle-v2', slot: 'panel-wrapper' })`\n min-width: 300px;\n min-height: 264px;\n`;\nconst StyledListWrapper = styled(Grid, { name: 'ds-shuttle-v2', slot: 'list-wrapper' })`\n border: 1px solid neutral-400;\n`;\nconst StyledInputText = styled(DSInputText, { name: 'ds-shuttle-v2', slot: 'area-search-bar' })`\n border: none;\n border-bottom: 1px solid neutral-300;\n border-radius: 0;\n`;\n// const panelWrapperRows = ['20px', '1fr'];\n\nconst panelWrapperRows = ['auto', '1fr'];\nexport const PanelWrapper = React.memo((panelMetaInfo: DSShuttleV2InternalsT.PanelMetaInfo) => {\n const { isDestinationPanel = false } = panelMetaInfo;\n const itemsLength = useStore((state) =>\n isDestinationPanel ? state.destinationData.length : state.sourceData.length,\n );\n const filterValue = useStore((state) =>\n isDestinationPanel ? state.destinationFilterValue : state.sourceFilterValue,\n );\n const onFilterCb = useStore((state) =>\n isDestinationPanel ? state.onDestinationFilterChange : state.onSourceFilterChange,\n );\n const isSearchBarOpen = useStore((state) =>\n isDestinationPanel ? state.destinationShowSearchbar : state.sourceShowSearchbar,\n );\n const handleFilterChange: React.ChangeEventHandler<HTMLInputElement> = React.useCallback(\n (event) => {\n const {\n target: { value },\n } = event;\n onFilterCb?.(value, { event });\n },\n [onFilterCb],\n );\n const listWrapperRows = React.useMemo(() => {\n const cols = [];\n if (isSearchBarOpen) cols.push('auto');\n cols.push('auto', '1fr');\n return cols;\n }, [isSearchBarOpen]);\n\n if (itemsLength === 0) return <div>Empty state</div>;\n\n return (\n <StyledPanelWrapper rows={panelWrapperRows} gutter=\"xxxs\">\n <Header isDestinationPanel={isDestinationPanel} />\n <StyledListWrapper rows={listWrapperRows}>\n {isSearchBarOpen ? <StyledInputText value={filterValue} onValueChange={handleFilterChange} /> : null}\n <SelectionHeader {...panelMetaInfo} />\n <ItemListWrapper isDestinationPanel={isDestinationPanel} />\n </StyledListWrapper>\n </StyledPanelWrapper>\n );\n});\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAAkB;AAClB,uBAAuB;AACvB,qBAAqB;AACrB,gCAA4B;AAC5B,sBAAyB;AAEzB,oBAAuB;AACvB,6BAAgC;AAChC,6BAAgC;AAEhC,MAAM,yBAAqB,yBAAO,qBAAM,EAAE,MAAM,iBAAiB,MAAM,gBAAgB,CAAC;AAAA;AAAA;AAAA;AAIxF,MAAM,wBAAoB,yBAAO,qBAAM,EAAE,MAAM,iBAAiB,MAAM,eAAe,CAAC;AAAA;AAAA;AAGtF,MAAM,sBAAkB,yBAAO,uCAAa,EAAE,MAAM,iBAAiB,MAAM,kBAAkB,CAAC;AAAA;AAAA;AAAA;AAAA;AAO9F,MAAM,mBAAmB,CAAC,QAAQ,KAAK;AAChC,MAAM,eAAe,aAAAA,QAAM,KAAK,CAAC,kBAAuD;AAC7F,QAAM,EAAE,qBAAqB,MAAM,IAAI;AACvC,QAAM,kBAAc;AAAA,IAAS,CAAC,UAC5B,qBAAqB,MAAM,gBAAgB,SAAS,MAAM,WAAW;AAAA,EACvE;AACA,QAAM,kBAAc;AAAA,IAAS,CAAC,UAC5B,qBAAqB,MAAM,yBAAyB,MAAM;AAAA,EAC5D;AACA,QAAM,iBAAa;AAAA,IAAS,CAAC,UAC3B,qBAAqB,MAAM,4BAA4B,MAAM;AAAA,EAC/D;AACA,QAAM,sBAAkB;AAAA,IAAS,CAAC,UAChC,qBAAqB,MAAM,2BAA2B,MAAM;AAAA,EAC9D;AACA,QAAM,qBAAiE,aAAAA,QAAM;AAAA,IAC3E,CAAC,UAAU;AACT,YAAM;AAAA,QACJ,QAAQ,EAAE,MAAM;AAAA,MAClB,IAAI;AACJ,mBAAa,OAAO,EAAE,MAAM,CAAC;AAAA,IAC/B;AAAA,IACA,CAAC,UAAU;AAAA,EACb;AACA,QAAM,kBAAkB,aAAAA,QAAM,QAAQ,MAAM;AAC1C,UAAM,OAAO,CAAC;AACd,QAAI;AAAiB,WAAK,KAAK,MAAM;AACrC,SAAK,KAAK,QAAQ,KAAK;AACvB,WAAO;AAAA,EACT,GAAG,CAAC,eAAe,CAAC;AAEpB,MAAI,gBAAgB;AAAG,WAAO,4CAAC;AAAA,MAAI;AAAA,KAAW;AAE9C,SACE,6CAAC;AAAA,IAAmB,MAAM;AAAA,IAAkB,QAAO;AAAA,IACjD;AAAA,kDAAC;AAAA,QAAO;AAAA,OAAwC;AAAA,MAChD,6CAAC;AAAA,QAAkB,MAAM;AAAA,QACtB;AAAA,4BAAkB,4CAAC;AAAA,YAAgB,OAAO;AAAA,YAAa,eAAe;AAAA,WAAoB,IAAK;AAAA,UAChG,4CAAC;AAAA,YAAiB,GAAG;AAAA,WAAe;AAAA,UACpC,4CAAC;AAAA,YAAgB;AAAA,WAAwC;AAAA;AAAA,OAC3D;AAAA;AAAA,GACF;AAEJ,CAAC;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
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 SelectionHeader_exports = {};
|
|
26
|
+
__export(SelectionHeader_exports, {
|
|
27
|
+
SelectionHeader: () => SelectionHeader
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(SelectionHeader_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_ds_system = require("@elliemae/ds-system");
|
|
34
|
+
var import_ds_form_checkbox = require("@elliemae/ds-form-checkbox");
|
|
35
|
+
var import_ds_grid = require("@elliemae/ds-grid");
|
|
36
|
+
var import_useStore = require("../config/useStore");
|
|
37
|
+
const StyledSelectionHeaderWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, { name: "ds-shuttle-v2", slot: "area-selection-header" })`
|
|
38
|
+
line-height: 1;
|
|
39
|
+
font-size: 1rem;
|
|
40
|
+
background-color: neutral-000;
|
|
41
|
+
border-bottom: 1px solid neutral-300;
|
|
42
|
+
`;
|
|
43
|
+
const StyledSelectionHeaderCountLabel = (0, import_ds_system.styled)("div", {
|
|
44
|
+
name: "ds-shuttle-v2",
|
|
45
|
+
slot: "area-selection-header-count-label"
|
|
46
|
+
})`
|
|
47
|
+
text-align: end;
|
|
48
|
+
color: neutral-500;
|
|
49
|
+
`;
|
|
50
|
+
const wrapperCols = ["auto", "1fr"];
|
|
51
|
+
const SelectionHeader = import_react.default.memo(({ isDestinationPanel = false }) => {
|
|
52
|
+
const selectionableItems = (0, import_useStore.useStore)(
|
|
53
|
+
(state) => isDestinationPanel ? state.destinationSelectionableData : state.sourceSelectionableData
|
|
54
|
+
);
|
|
55
|
+
const ariaControls = (0, import_useStore.useStore)(
|
|
56
|
+
(state) => isDestinationPanel ? state.destinationSelectionableIds : state.sourceSelectionableIds
|
|
57
|
+
);
|
|
58
|
+
const onSelectionChange = (0, import_useStore.useStore)(
|
|
59
|
+
(state) => isDestinationPanel ? state.onDestinationSelectionChange : state.onSourceSelectionChange
|
|
60
|
+
);
|
|
61
|
+
const selectionLength = (0, import_useStore.useStore)(
|
|
62
|
+
(state) => isDestinationPanel ? state.destinationSelectionItemArray.length : state.sourceSelectionItemArray.length
|
|
63
|
+
);
|
|
64
|
+
const checkboxValue = import_react.default.useMemo(() => {
|
|
65
|
+
let newVal = false;
|
|
66
|
+
if (selectionLength > 0)
|
|
67
|
+
newVal = "mixed";
|
|
68
|
+
if (selectionLength === selectionableItems.length)
|
|
69
|
+
newVal = true;
|
|
70
|
+
return newVal;
|
|
71
|
+
}, [selectionableItems.length, selectionLength]);
|
|
72
|
+
const handleSelectAll = import_react.default.useCallback(
|
|
73
|
+
(event) => {
|
|
74
|
+
if (checkboxValue === true) {
|
|
75
|
+
onSelectionChange({}, { event });
|
|
76
|
+
} else {
|
|
77
|
+
const newSelection = {};
|
|
78
|
+
selectionableItems.forEach((selectableItem) => {
|
|
79
|
+
newSelection[selectableItem.original.id] = true;
|
|
80
|
+
});
|
|
81
|
+
onSelectionChange(newSelection, { event });
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
[checkboxValue, onSelectionChange, selectionableItems]
|
|
85
|
+
);
|
|
86
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(StyledSelectionHeaderWrapper, {
|
|
87
|
+
cols: wrapperCols,
|
|
88
|
+
justifyContent: "center",
|
|
89
|
+
alignItems: "center",
|
|
90
|
+
py: "7px",
|
|
91
|
+
px: "xxs2",
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_grid.Grid, {
|
|
94
|
+
justifyContent: "center",
|
|
95
|
+
alignItems: "center",
|
|
96
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_form_checkbox.DSControlledCheckbox, {
|
|
97
|
+
checked: checkboxValue,
|
|
98
|
+
"aria-label": `${checkboxValue === true ? "Deselect" : "Select"} all ${isDestinationPanel ? "destination" : "source"} items`,
|
|
99
|
+
onChange: handleSelectAll,
|
|
100
|
+
"aria-controls": ariaControls
|
|
101
|
+
})
|
|
102
|
+
}),
|
|
103
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(StyledSelectionHeaderCountLabel, {
|
|
104
|
+
children: [
|
|
105
|
+
selectionLength,
|
|
106
|
+
" selected"
|
|
107
|
+
]
|
|
108
|
+
})
|
|
109
|
+
]
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
//# sourceMappingURL=SelectionHeader.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/SelectionHeader.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport { DSControlledCheckbox } from '@elliemae/ds-form-checkbox';\nimport { Grid } from '@elliemae/ds-grid';\nimport { useStore } from '../config/useStore';\nimport { type DSShuttleV2T } from '../react-desc-prop-types';\nimport { type DSShuttleV2InternalsT } from '../sharedTypes';\n\nconst StyledSelectionHeaderWrapper = styled(Grid, { name: 'ds-shuttle-v2', slot: 'area-selection-header' })`\n line-height: 1;\n font-size: 1rem;\n background-color: neutral-000;\n border-bottom: 1px solid neutral-300;\n`;\nconst StyledSelectionHeaderCountLabel = styled('div', {\n name: 'ds-shuttle-v2',\n slot: 'area-selection-header-count-label',\n})`\n text-align: end;\n color: neutral-500;\n`;\n\nconst wrapperCols = ['auto', '1fr'];\nexport const SelectionHeader = React.memo(({ isDestinationPanel = false }: DSShuttleV2InternalsT.PanelMetaInfo) => {\n const selectionableItems = useStore((state) =>\n isDestinationPanel ? state.destinationSelectionableData : state.sourceSelectionableData,\n );\n\n const ariaControls = useStore((state) =>\n isDestinationPanel ? state.destinationSelectionableIds : state.sourceSelectionableIds,\n );\n\n const onSelectionChange = useStore((state) =>\n isDestinationPanel ? state.onDestinationSelectionChange : state.onSourceSelectionChange,\n );\n const selectionLength = useStore((state) =>\n isDestinationPanel ? state.destinationSelectionItemArray.length : state.sourceSelectionItemArray.length,\n );\n const checkboxValue = React.useMemo(() => {\n let newVal: boolean | 'mixed' = false;\n if (selectionLength > 0) newVal = 'mixed';\n if (selectionLength === selectionableItems.length) newVal = true;\n return newVal;\n }, [selectionableItems.length, selectionLength]);\n const handleSelectAll: React.ChangeEventHandler<HTMLInputElement> = React.useCallback(\n (event) => {\n if (checkboxValue === true) {\n onSelectionChange({}, { event });\n } else {\n const newSelection: DSShuttleV2T.InternalProps['sourceSelectedItems'] = {};\n selectionableItems.forEach((selectableItem) => {\n newSelection[selectableItem.original.id] = true;\n });\n onSelectionChange(newSelection, { event });\n }\n },\n [checkboxValue, onSelectionChange, selectionableItems],\n );\n\n return (\n <StyledSelectionHeaderWrapper cols={wrapperCols} justifyContent=\"center\" alignItems=\"center\" py=\"7px\" px=\"xxs2\">\n <Grid justifyContent=\"center\" alignItems=\"center\">\n <DSControlledCheckbox\n checked={checkboxValue}\n aria-label={`${checkboxValue === true ? 'Deselect' : 'Select'} all ${\n isDestinationPanel ? 'destination' : 'source'\n } items`}\n onChange={handleSelectAll}\n aria-controls={ariaControls}\n />\n </Grid>\n <StyledSelectionHeaderCountLabel>{selectionLength} selected</StyledSelectionHeaderCountLabel>\n </StyledSelectionHeaderWrapper>\n );\n});\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB;AAAA,mBAAkB;AAClB,uBAAuB;AACvB,8BAAqC;AACrC,qBAAqB;AACrB,sBAAyB;AAIzB,MAAM,mCAA+B,yBAAO,qBAAM,EAAE,MAAM,iBAAiB,MAAM,wBAAwB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAM1G,MAAM,sCAAkC,yBAAO,OAAO;AAAA,EACpD,MAAM;AAAA,EACN,MAAM;AACR,CAAC;AAAA;AAAA;AAAA;AAKD,MAAM,cAAc,CAAC,QAAQ,KAAK;AAC3B,MAAM,kBAAkB,aAAAA,QAAM,KAAK,CAAC,EAAE,qBAAqB,MAAM,MAA2C;AACjH,QAAM,yBAAqB;AAAA,IAAS,CAAC,UACnC,qBAAqB,MAAM,+BAA+B,MAAM;AAAA,EAClE;AAEA,QAAM,mBAAe;AAAA,IAAS,CAAC,UAC7B,qBAAqB,MAAM,8BAA8B,MAAM;AAAA,EACjE;AAEA,QAAM,wBAAoB;AAAA,IAAS,CAAC,UAClC,qBAAqB,MAAM,+BAA+B,MAAM;AAAA,EAClE;AACA,QAAM,sBAAkB;AAAA,IAAS,CAAC,UAChC,qBAAqB,MAAM,8BAA8B,SAAS,MAAM,yBAAyB;AAAA,EACnG;AACA,QAAM,gBAAgB,aAAAA,QAAM,QAAQ,MAAM;AACxC,QAAI,SAA4B;AAChC,QAAI,kBAAkB;AAAG,eAAS;AAClC,QAAI,oBAAoB,mBAAmB;AAAQ,eAAS;AAC5D,WAAO;AAAA,EACT,GAAG,CAAC,mBAAmB,QAAQ,eAAe,CAAC;AAC/C,QAAM,kBAA8D,aAAAA,QAAM;AAAA,IACxE,CAAC,UAAU;AACT,UAAI,kBAAkB,MAAM;AAC1B,0BAAkB,CAAC,GAAG,EAAE,MAAM,CAAC;AAAA,MACjC,OAAO;AACL,cAAM,eAAkE,CAAC;AACzE,2BAAmB,QAAQ,CAAC,mBAAmB;AAC7C,uBAAa,eAAe,SAAS,MAAM;AAAA,QAC7C,CAAC;AACD,0BAAkB,cAAc,EAAE,MAAM,CAAC;AAAA,MAC3C;AAAA,IACF;AAAA,IACA,CAAC,eAAe,mBAAmB,kBAAkB;AAAA,EACvD;AAEA,SACE,6CAAC;AAAA,IAA6B,MAAM;AAAA,IAAa,gBAAe;AAAA,IAAS,YAAW;AAAA,IAAS,IAAG;AAAA,IAAM,IAAG;AAAA,IACvG;AAAA,kDAAC;AAAA,QAAK,gBAAe;AAAA,QAAS,YAAW;AAAA,QACvC,sDAAC;AAAA,UACC,SAAS;AAAA,UACT,cAAY,GAAG,kBAAkB,OAAO,aAAa,gBACnD,qBAAqB,gBAAgB;AAAA,UAEvC,UAAU;AAAA,UACV,iBAAe;AAAA,SACjB;AAAA,OACF;AAAA,MACA,6CAAC;AAAA,QAAiC;AAAA;AAAA,UAAgB;AAAA;AAAA,OAAS;AAAA;AAAA,GAC7D;AAEJ,CAAC;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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 react_desc_prop_types_exports = {};
|
|
26
|
+
__export(react_desc_prop_types_exports, {
|
|
27
|
+
DSSkeletonPropTypes: () => DSSkeletonPropTypes,
|
|
28
|
+
defaultProps: () => defaultProps
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(react_desc_prop_types_exports);
|
|
31
|
+
var React = __toESM(require("react"));
|
|
32
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
33
|
+
const defaultProps = {
|
|
34
|
+
sourceWithSoftDelete: false,
|
|
35
|
+
removeDragAndDropFromSource: false,
|
|
36
|
+
destinationWithSoftDelete: false,
|
|
37
|
+
addDragAndDropToDestiantion: false
|
|
38
|
+
};
|
|
39
|
+
const DSSkeletonPropTypes = {
|
|
40
|
+
...import_ds_utilities.globalAttributesPropTypes,
|
|
41
|
+
...import_ds_utilities.xstyledPropTypes
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/react-desc-prop-types.ts", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React, { WeakValidationMap } from 'react';\nimport {\n PropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n GlobalAttributesT,\n XstyledProps,\n} from '@elliemae/ds-utilities';\n\nexport declare namespace DSShuttleV2T {\n export type ItemMeta = {\n item: DSShuttleV2T.ConfiguredDatum;\n isDestinationPanel: boolean;\n };\n\n export interface Datum extends Record<string, unknown> {\n id: string;\n label: string;\n subtitle?: string;\n Icon?: React.ComponentType<ItemMeta>;\n CustomRenderer?: React.ComponentType<ItemMeta>;\n softDeleted?: boolean;\n preventDrilldown?: boolean;\n preventMove?: boolean;\n }\n export interface ConfiguredDatum {\n isFirst: boolean;\n isLast: boolean;\n isSelected: boolean;\n selectionPrevented: boolean;\n withActions: boolean;\n withMoveBtn: boolean;\n withDrilldownBtn: boolean;\n original: Datum;\n localIndex: number;\n }\n\n type SelectionMap = Record<string, boolean>;\n type OnDataChange = (\n newData: Datum[],\n metainfo: { event: React.MouseEvent<HTMLButtonElement>; item?: Datum; selectedItems?: Datum[] },\n ) => void;\n type OnSelectionChange = (\n newSelection: SelectionMap,\n metainfo: {\n event:\n | React.MouseEvent<HTMLButtonElement | HTMLDivElement>\n | React.KeyboardEvent<HTMLDivElement>\n | React.ChangeEvent<HTMLInputElement>;\n item?: Datum;\n },\n ) => void;\n type OnSelectionDrilldown = (item: Datum, metainfo: { event: React.MouseEvent<HTMLButtonElement> }) => void;\n interface RequiredProps {\n sourceData: Datum[];\n onSourceChange: OnDataChange;\n sourceSelectedItems: SelectionMap;\n onSourceSelectionChange: OnSelectionChange;\n SourceHeader: React.ComponentType<unknown>;\n onSourceDrilldown: OnSelectionDrilldown;\n\n destinationData: Datum[];\n onDestinationChange: OnDataChange;\n destinationSelectedItems: SelectionMap;\n onDestinationSelectionChange: OnSelectionChange;\n DestinationHeader: React.ComponentType<unknown>;\n onDestinationDrilldown: OnSelectionDrilldown;\n }\n\n export interface DefaultProps {\n sourceWithSoftDelete: boolean;\n removeDragAndDropFromSource: boolean;\n\n destinationWithSoftDelete: boolean;\n addDragAndDropToDestiantion: boolean;\n }\n\n type OnFilterChange = (\n newfilter: string | null,\n metainfo: { event: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement> },\n ) => void;\n type OnSearchbarOpen = (newfilter: boolean, metainfo: { event: React.MouseEvent<HTMLButtonElement> }) => void;\n export interface PropsOptional {\n sourceItemProps?: Record<string, unknown>;\n destinationItemProps?: Record<string, unknown>;\n sourceFilterValue?: string;\n onSourceFilterChange?: OnFilterChange;\n onSourceOpenSearchbar?: OnSearchbarOpen;\n sourceShowSearchbar?: boolean;\n destinationFilterValue?: string;\n onDestinationFilterChange?: OnFilterChange;\n onDesinationOpenSearchbar?: OnSearchbarOpen;\n destinationShowSearchbar?: boolean;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n PropsOptional,\n RequiredProps,\n Omit<GlobalAttributesT<HTMLSpanElement>, keyof RequiredProps>,\n XstyledProps {}\n\n export interface InternalProps\n extends DefaultProps,\n PropsOptional,\n RequiredProps,\n Omit<GlobalAttributesT<HTMLSpanElement>, keyof RequiredProps>,\n XstyledProps {}\n}\n\nexport const defaultProps: DSShuttleV2T.DefaultProps = {\n sourceWithSoftDelete: false,\n removeDragAndDropFromSource: false,\n\n destinationWithSoftDelete: false,\n addDragAndDropToDestiantion: false,\n};\n\nexport const DSSkeletonPropTypes = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n} as WeakValidationMap<unknown>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,0BAMO;AAuGA,MAAM,eAA0C;AAAA,EACrD,sBAAsB;AAAA,EACtB,6BAA6B;AAAA,EAE7B,2BAA2B;AAAA,EAC3B,6BAA6B;AAC/B;AAEO,MAAM,sBAAsB;AAAA,EACjC,GAAG;AAAA,EACH,GAAG;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
18
|
+
mod
|
|
19
|
+
));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var sharedTypes_exports = {};
|
|
22
|
+
module.exports = __toCommonJS(sharedTypes_exports);
|
|
23
|
+
var React = __toESM(require("react"));
|
|
24
|
+
//# sourceMappingURL=sharedTypes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/sharedTypes.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { type DSShuttleV2T } from './react-desc-prop-types';\n\nexport namespace DSShuttleV2InternalsT {\n export type PanelMetaInfo = { isDestinationPanel: boolean };\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import React2, { useEffect } from "react";
|
|
4
|
+
import { useShuttleV2 } from "./config/useShuttleV2";
|
|
5
|
+
import { Provider, useShuttleV2StoreConfig, useStore } from "./config/useStore";
|
|
6
|
+
import { MainContent } from "./parts/MainContent";
|
|
7
|
+
const ConfiguredComponent = React2.memo((props) => {
|
|
8
|
+
useShuttleV2(props.userProps);
|
|
9
|
+
const store = useStore((state) => state);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
console.group("-----------------------------------------");
|
|
12
|
+
console.groupCollapsed("Full Store");
|
|
13
|
+
console.log(store);
|
|
14
|
+
console.groupEnd();
|
|
15
|
+
console.groupEnd();
|
|
16
|
+
}, [store]);
|
|
17
|
+
return /* @__PURE__ */ jsx(MainContent, {});
|
|
18
|
+
});
|
|
19
|
+
const DSShuttleV2 = (props) => {
|
|
20
|
+
const createStore = useShuttleV2StoreConfig(props);
|
|
21
|
+
return /* @__PURE__ */ jsx(Provider, {
|
|
22
|
+
createStore,
|
|
23
|
+
children: /* @__PURE__ */ jsx(ConfiguredComponent, {
|
|
24
|
+
userProps: props
|
|
25
|
+
})
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
DSShuttleV2
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=DSShuttleV2.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSShuttleV2.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,OAAOA,UAAS,iBAAiB;AACjC,SAAS,oBAAoB;AAC7B,SAAS,UAAU,yBAAyB,gBAAgB;AAE5D,SAAS,mBAAmB;AAE5B,MAAM,sBAAsBA,OAAM,KAAK,CAAC,UAA6C;AACnF,eAAa,MAAM,SAAS;AAC5B,QAAM,QAAQ,SAAS,CAAC,UAAU,KAAK;AACvC,YAAU,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,oBAAC,eAAY;AACtB,CAAC;AAEM,MAAM,cAAc,CAAC,UAA8B;AACxD,QAAM,cAAc,wBAAwB,KAAK;AAEjD,SACE,oBAAC;AAAA,IAAS;AAAA,IACR,8BAAC;AAAA,MAAoB,WAAW;AAAA,KAAO;AAAA,GACzC;AAEJ;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const getDatumFlags = (datum) => ({
|
|
3
|
+
selectionPrevented: Boolean(datum.softDeleted || datum.preventMove),
|
|
4
|
+
withActions: !datum.softDeleted,
|
|
5
|
+
withMoveBtn: !datum.softDeleted && !datum.preventMove,
|
|
6
|
+
withDrilldownBtn: !datum.softDeleted && !datum.preventDrilldown
|
|
7
|
+
});
|
|
8
|
+
const configureDestination = ({ destinationData, destinationSelectedItems }) => {
|
|
9
|
+
const destinationSelectedItemsMap = {};
|
|
10
|
+
const destinationSelectionItemArray = [];
|
|
11
|
+
const destinationSelectionArray = [];
|
|
12
|
+
const destinationConfiguredData = [];
|
|
13
|
+
const destinationSelectionableData = [];
|
|
14
|
+
const destinationSelectionableDataIds = [];
|
|
15
|
+
destinationData.forEach((datum, i) => {
|
|
16
|
+
let isSelected = false;
|
|
17
|
+
if (destinationSelectedItems[datum.id] === true) {
|
|
18
|
+
destinationSelectionItemArray.push(datum);
|
|
19
|
+
destinationSelectionArray.push(datum.id);
|
|
20
|
+
isSelected = true;
|
|
21
|
+
}
|
|
22
|
+
destinationSelectedItemsMap[datum.id] = { datum, index: i };
|
|
23
|
+
const configuredItem = {
|
|
24
|
+
isSelected,
|
|
25
|
+
...getDatumFlags(datum),
|
|
26
|
+
original: datum,
|
|
27
|
+
localIndex: i,
|
|
28
|
+
isFirst: i === 0,
|
|
29
|
+
isLast: i === destinationData.length - 1
|
|
30
|
+
};
|
|
31
|
+
destinationConfiguredData.push(configuredItem);
|
|
32
|
+
if (!datum.preventMove) {
|
|
33
|
+
destinationSelectionableData.push(configuredItem);
|
|
34
|
+
destinationSelectionableDataIds.push(datum.id);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const destinationHasMultipleSelectedItems = destinationSelectionArray.length >= 1;
|
|
38
|
+
const destinationSelectionableIds = destinationSelectionableDataIds.join(" ");
|
|
39
|
+
return {
|
|
40
|
+
destinationSelectedItemsMap,
|
|
41
|
+
destinationSelectionItemArray,
|
|
42
|
+
destinationSelectionArray,
|
|
43
|
+
destinationHasMultipleSelectedItems,
|
|
44
|
+
destinationConfiguredData,
|
|
45
|
+
destinationSelectionableData,
|
|
46
|
+
destinationSelectionableDataIds,
|
|
47
|
+
destinationSelectionableIds
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const configureSource = ({ sourceData, sourceSelectedItems }) => {
|
|
51
|
+
const sourceSelectedItemsMap = {};
|
|
52
|
+
const sourceSelectionItemArray = [];
|
|
53
|
+
const sourceSelectionArray = [];
|
|
54
|
+
const sourceConfiguredData = [];
|
|
55
|
+
const sourceSelectionableData = [];
|
|
56
|
+
const sourceSelectionableDataIds = [];
|
|
57
|
+
sourceData.forEach((datum, i) => {
|
|
58
|
+
let isSelected = false;
|
|
59
|
+
if (sourceSelectedItems[datum.id] === true) {
|
|
60
|
+
sourceSelectionItemArray.push(datum);
|
|
61
|
+
sourceSelectionArray.push(datum.id);
|
|
62
|
+
isSelected = true;
|
|
63
|
+
}
|
|
64
|
+
sourceSelectedItemsMap[datum.id] = { datum, index: i };
|
|
65
|
+
const configuredItem = {
|
|
66
|
+
isSelected,
|
|
67
|
+
...getDatumFlags(datum),
|
|
68
|
+
original: datum,
|
|
69
|
+
localIndex: i,
|
|
70
|
+
isFirst: i === 0,
|
|
71
|
+
isLast: i === sourceData.length - 1
|
|
72
|
+
};
|
|
73
|
+
sourceConfiguredData.push(configuredItem);
|
|
74
|
+
if (!datum.preventMove) {
|
|
75
|
+
sourceSelectionableData.push(configuredItem);
|
|
76
|
+
sourceSelectionableDataIds.push(datum.id);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const sourceHasMultipleSelectedItems = sourceSelectionArray.length >= 1;
|
|
80
|
+
const sourceSelectionableIds = sourceSelectionableDataIds.join(" ");
|
|
81
|
+
return {
|
|
82
|
+
sourceConfiguredData,
|
|
83
|
+
sourceSelectedItemsMap,
|
|
84
|
+
sourceSelectionItemArray,
|
|
85
|
+
sourceSelectionArray,
|
|
86
|
+
sourceHasMultipleSelectedItems,
|
|
87
|
+
sourceSelectionableData,
|
|
88
|
+
sourceSelectionableDataIds,
|
|
89
|
+
sourceSelectionableIds
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
const configureAutoCalculated = (propsFromUser) => {
|
|
93
|
+
const { sourceData } = propsFromUser;
|
|
94
|
+
const { sourceSelectedItems } = propsFromUser;
|
|
95
|
+
const { destinationData } = propsFromUser;
|
|
96
|
+
const { destinationSelectedItems } = propsFromUser;
|
|
97
|
+
return {
|
|
98
|
+
...configureSource({ sourceData, sourceSelectedItems }),
|
|
99
|
+
...configureDestination({ destinationData, destinationSelectedItems })
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
configureAutoCalculated
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=configureAutoCalculated.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/configureAutoCalculated.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "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"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEvB,MAAM,gBAAgB,CAAC,WAA+B;AAAA,EACpD,oBAAoB,QAAQ,MAAM,eAAe,MAAM,WAAW;AAAA,EAClE,aAAa,CAAC,MAAM;AAAA,EACpB,aAAa,CAAC,MAAM,eAAe,CAAC,MAAM;AAAA,EAC1C,kBAAkB,CAAC,MAAM,eAAe,CAAC,MAAM;AACjD;AAMA,MAAM,uBAAuB,CAAC,EAAE,iBAAiB,yBAAyB,MAAkC;AAC1G,QAAM,8BAA4F,CAAC;AACnG,QAAM,gCAAsD,CAAC;AAC7D,QAAM,4BAAwD,CAAC;AAC/D,QAAM,4BAA4D,CAAC;AACnE,QAAM,+BAA+D,CAAC;AACtE,QAAM,kCAA8D,CAAC;AACrE,kBAAgB,QAAQ,CAAC,OAAO,MAAM;AACpC,QAAI,aAAa;AACjB,QAAI,yBAAyB,MAAM,QAAQ,MAAM;AAC/C,oCAA8B,KAAK,KAAK;AACxC,gCAA0B,KAAK,MAAM,EAAE;AACvC,mBAAa;AAAA,IACf;AACA,gCAA4B,MAAM,MAAM,EAAE,OAAO,OAAO,EAAE;AAC1D,UAAM,iBAAiB;AAAA,MACrB;AAAA,MACA,GAAG,cAAc,KAAK;AAAA,MACtB,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,SAAS,MAAM;AAAA,MACf,QAAQ,MAAM,gBAAgB,SAAS;AAAA,IACzC;AACA,8BAA0B,KAAK,cAAc;AAC7C,QAAI,CAAC,MAAM,aAAa;AACtB,mCAA6B,KAAK,cAAc;AAChD,sCAAgC,KAAK,MAAM,EAAE;AAAA,IAC/C;AAAA,EACF,CAAC;AACD,QAAM,sCAAsC,0BAA0B,UAAU;AAChF,QAAM,8BAA8B,gCAAgC,KAAK,GAAG;AAC5E,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAMA,MAAM,kBAAkB,CAAC,EAAE,YAAY,oBAAoB,MAA6B;AACtF,QAAM,yBAAuF,CAAC;AAC9F,QAAM,2BAAiD,CAAC;AACxD,QAAM,uBAAmD,CAAC;AAC1D,QAAM,uBAAuD,CAAC;AAC9D,QAAM,0BAA0D,CAAC;AACjE,QAAM,6BAAyD,CAAC;AAChE,aAAW,QAAQ,CAAC,OAAO,MAAM;AAC/B,QAAI,aAAa;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,122 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { useStore } from "./useStore";
|
|
4
|
+
const getNewDatasWithItemMoved = ({
|
|
5
|
+
item,
|
|
6
|
+
currData,
|
|
7
|
+
currWithSoftDelete,
|
|
8
|
+
otherData
|
|
9
|
+
}) => {
|
|
10
|
+
const { id, softDeleted } = item;
|
|
11
|
+
const newCurrData = [...currData];
|
|
12
|
+
const newOtherData = [...otherData];
|
|
13
|
+
const currListIndex = newCurrData.findIndex((datum) => datum.id === id);
|
|
14
|
+
const otherListIndex = newOtherData.findIndex((datum) => datum.id === id);
|
|
15
|
+
const isCurrDataItemOriginalList = otherListIndex === -1 || otherListIndex !== -1 && softDeleted;
|
|
16
|
+
let currRemoveAtIndex = -1;
|
|
17
|
+
if (currListIndex !== -1) {
|
|
18
|
+
if (isCurrDataItemOriginalList) {
|
|
19
|
+
if (currWithSoftDelete)
|
|
20
|
+
newCurrData[currListIndex].softDeleted = true;
|
|
21
|
+
else
|
|
22
|
+
currRemoveAtIndex = currListIndex;
|
|
23
|
+
} else {
|
|
24
|
+
currRemoveAtIndex = currListIndex;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (currRemoveAtIndex !== -1)
|
|
28
|
+
newCurrData.splice(currRemoveAtIndex, 1);
|
|
29
|
+
const shouldAppendToOtherData = otherListIndex === -1;
|
|
30
|
+
if (shouldAppendToOtherData)
|
|
31
|
+
newOtherData.push({ ...item, softDeleted: false });
|
|
32
|
+
else
|
|
33
|
+
newOtherData[otherListIndex].softDeleted = false;
|
|
34
|
+
return {
|
|
35
|
+
newCurrData,
|
|
36
|
+
newOtherData
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
const useHandleMoveSelection = ({ isDestinationPanel }) => {
|
|
40
|
+
const currData = useStore((state) => isDestinationPanel ? state.destinationData : state.sourceData);
|
|
41
|
+
const currWithSoftDelete = useStore(
|
|
42
|
+
(state) => isDestinationPanel ? state.destinationWithSoftDelete : state.sourceWithSoftDelete
|
|
43
|
+
);
|
|
44
|
+
const currOnChange = useStore((state) => isDestinationPanel ? state.onDestinationChange : state.onSourceChange);
|
|
45
|
+
const onSelectionChange = useStore(
|
|
46
|
+
(state) => isDestinationPanel ? state.onDestinationSelectionChange : state.onSourceSelectionChange
|
|
47
|
+
);
|
|
48
|
+
const otherData = useStore((state) => isDestinationPanel ? state.sourceData : state.destinationData);
|
|
49
|
+
const otherPanelOnChange = useStore(
|
|
50
|
+
(state) => isDestinationPanel ? state.onSourceChange : state.onDestinationChange
|
|
51
|
+
);
|
|
52
|
+
const destinationSelectionArray = useStore((store) => store.destinationSelectionItemArray);
|
|
53
|
+
const sourceSelectionArray = useStore((store) => store.sourceSelectionItemArray);
|
|
54
|
+
const selectedItems = isDestinationPanel ? destinationSelectionArray : sourceSelectionArray;
|
|
55
|
+
const moveSelection = React2.useCallback(
|
|
56
|
+
(event) => {
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
event.stopPropagation();
|
|
59
|
+
let iteratedNewCurrData = [...currData];
|
|
60
|
+
let iteratedNewOtherData = [...otherData];
|
|
61
|
+
selectedItems.forEach((datum) => {
|
|
62
|
+
const { newCurrData, newOtherData } = getNewDatasWithItemMoved({
|
|
63
|
+
item: datum,
|
|
64
|
+
currData: iteratedNewCurrData,
|
|
65
|
+
currWithSoftDelete,
|
|
66
|
+
otherData: iteratedNewOtherData
|
|
67
|
+
});
|
|
68
|
+
iteratedNewCurrData = newCurrData;
|
|
69
|
+
iteratedNewOtherData = newOtherData;
|
|
70
|
+
});
|
|
71
|
+
currOnChange(iteratedNewCurrData, { event, selectedItems });
|
|
72
|
+
otherPanelOnChange(iteratedNewOtherData, { event, selectedItems });
|
|
73
|
+
onSelectionChange({}, { event });
|
|
74
|
+
},
|
|
75
|
+
[currData, otherData, selectedItems, currOnChange, otherPanelOnChange, onSelectionChange, currWithSoftDelete]
|
|
76
|
+
);
|
|
77
|
+
return React2.useMemo(() => ({ moveSelection }), [moveSelection]);
|
|
78
|
+
};
|
|
79
|
+
const useActionsClickHandlers = (itemMeta) => {
|
|
80
|
+
const { item, isDestinationPanel } = itemMeta;
|
|
81
|
+
const currData = useStore((state) => isDestinationPanel ? state.destinationData : state.sourceData);
|
|
82
|
+
const currWithSoftDelete = useStore(
|
|
83
|
+
(state) => isDestinationPanel ? state.destinationWithSoftDelete : state.sourceWithSoftDelete
|
|
84
|
+
);
|
|
85
|
+
const currOnChange = useStore((state) => isDestinationPanel ? state.onDestinationChange : state.onSourceChange);
|
|
86
|
+
const currDrilldown = useStore(
|
|
87
|
+
(state) => isDestinationPanel ? state.onDestinationDrilldown : state.onSourceDrilldown
|
|
88
|
+
);
|
|
89
|
+
const otherData = useStore((state) => isDestinationPanel ? state.sourceData : state.destinationData);
|
|
90
|
+
const otherPanelOnChange = useStore(
|
|
91
|
+
(state) => isDestinationPanel ? state.onSourceChange : state.onDestinationChange
|
|
92
|
+
);
|
|
93
|
+
const handleDrilldown = React2.useCallback(
|
|
94
|
+
(event) => {
|
|
95
|
+
event.preventDefault();
|
|
96
|
+
event.stopPropagation();
|
|
97
|
+
currDrilldown(item.original, { event });
|
|
98
|
+
},
|
|
99
|
+
[currDrilldown, item]
|
|
100
|
+
);
|
|
101
|
+
const handleSingleMove = React2.useCallback(
|
|
102
|
+
(event) => {
|
|
103
|
+
event.preventDefault();
|
|
104
|
+
event.stopPropagation();
|
|
105
|
+
const { newCurrData, newOtherData } = getNewDatasWithItemMoved({
|
|
106
|
+
item: item.original,
|
|
107
|
+
currData,
|
|
108
|
+
currWithSoftDelete,
|
|
109
|
+
otherData
|
|
110
|
+
});
|
|
111
|
+
currOnChange(newCurrData, { item: item.original, event });
|
|
112
|
+
otherPanelOnChange(newOtherData, { item: item.original, event });
|
|
113
|
+
},
|
|
114
|
+
[currData, currOnChange, currWithSoftDelete, item, otherData, otherPanelOnChange]
|
|
115
|
+
);
|
|
116
|
+
return React2.useMemo(() => ({ handleDrilldown, handleSingleMove }), [handleDrilldown, handleSingleMove]);
|
|
117
|
+
};
|
|
118
|
+
export {
|
|
119
|
+
useActionsClickHandlers,
|
|
120
|
+
useHandleMoveSelection
|
|
121
|
+
};
|
|
122
|
+
//# sourceMappingURL=itemMovementHelpers.js.map
|