@elliemae/ds-shuttle 3.0.0-next.2 → 3.0.0-next.6
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/AnimationState.js +75 -0
- package/dist/cjs/AnimationState.js.map +7 -0
- package/dist/cjs/DSShuttle.js +170 -0
- package/dist/cjs/DSShuttle.js.map +7 -0
- package/dist/cjs/SearchState.js +60 -0
- package/dist/cjs/SearchState.js.map +7 -0
- package/dist/cjs/Shuttle.actions.js +136 -0
- package/dist/cjs/Shuttle.actions.js.map +7 -0
- package/dist/cjs/ShuttleContainer.js +108 -0
- package/dist/cjs/ShuttleContainer.js.map +7 -0
- package/dist/cjs/ShuttleImpl.js +242 -0
- package/dist/cjs/ShuttleImpl.js.map +7 -0
- package/dist/cjs/ShuttleRenderer.js +203 -0
- package/dist/cjs/ShuttleRenderer.js.map +7 -0
- package/dist/cjs/ShuttleState.js +84 -0
- package/dist/cjs/ShuttleState.js.map +7 -0
- package/dist/cjs/animation/animationConfig.js +78 -0
- package/dist/cjs/animation/animationConfig.js.map +7 -0
- package/dist/cjs/classedComponents.js +72 -0
- package/dist/cjs/classedComponents.js.map +7 -0
- package/dist/cjs/components/LoadingIndicator.js +52 -0
- package/dist/cjs/components/LoadingIndicator.js.map +7 -0
- package/dist/cjs/components/OverflowList.js +71 -0
- package/dist/cjs/components/OverflowList.js.map +7 -0
- package/dist/cjs/components/ShuttleBreadcrumb.js +54 -0
- package/dist/cjs/components/ShuttleBreadcrumb.js.map +7 -0
- package/dist/cjs/components/ShuttleInfiniteScrollIndicator.js +48 -0
- package/dist/cjs/components/ShuttleInfiniteScrollIndicator.js.map +7 -0
- package/dist/cjs/components/ShuttleListItem/ActionButtons.js +76 -0
- package/dist/cjs/components/ShuttleListItem/ActionButtons.js.map +7 -0
- package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js +121 -0
- package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js.map +7 -0
- package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +127 -0
- package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js.map +7 -0
- package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +110 -0
- package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js.map +7 -0
- package/dist/cjs/components/ShuttleListPanel.js +49 -0
- package/dist/cjs/components/ShuttleListPanel.js.map +7 -0
- package/dist/cjs/components/ShuttleSearchBox.js +99 -0
- package/dist/cjs/components/ShuttleSearchBox.js.map +7 -0
- package/dist/cjs/components/ShuttleSource.js +223 -0
- package/dist/cjs/components/ShuttleSource.js.map +7 -0
- package/dist/cjs/components/ShuttleTarget.js +135 -0
- package/dist/cjs/components/ShuttleTarget.js.map +7 -0
- package/dist/cjs/components/VirtualizedItem.js +65 -0
- package/dist/cjs/components/VirtualizedItem.js.map +7 -0
- package/dist/cjs/components/VirtualizedList.js +104 -0
- package/dist/cjs/components/VirtualizedList.js.map +7 -0
- package/dist/cjs/components/VirtualizedSortableList.js +77 -0
- package/dist/cjs/components/VirtualizedSortableList.js.map +7 -0
- package/dist/cjs/helper.js +99 -0
- package/dist/cjs/helper.js.map +7 -0
- package/dist/cjs/index.js +38 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/tests/utils.js +1235 -0
- package/dist/cjs/tests/utils.js.map +7 -0
- package/dist/cjs/updateShuttleStateFromProps.js +108 -0
- package/dist/cjs/updateShuttleStateFromProps.js.map +7 -0
- package/dist/cjs/utils.js +54 -0
- package/dist/cjs/utils.js.map +7 -0
- package/dist/cjs/withProviders.js +57 -0
- package/dist/cjs/withProviders.js.map +7 -0
- package/{esm → dist/esm}/AnimationState.js +12 -8
- package/dist/esm/AnimationState.js.map +7 -0
- package/dist/esm/DSShuttle.js +141 -0
- package/dist/esm/DSShuttle.js.map +7 -0
- package/dist/esm/SearchState.js +31 -0
- package/dist/esm/SearchState.js.map +7 -0
- package/dist/esm/Shuttle.actions.js +118 -0
- package/dist/esm/Shuttle.actions.js.map +7 -0
- package/dist/esm/ShuttleContainer.js +92 -0
- package/dist/esm/ShuttleContainer.js.map +7 -0
- package/dist/esm/ShuttleImpl.js +229 -0
- package/dist/esm/ShuttleImpl.js.map +7 -0
- package/dist/esm/ShuttleRenderer.js +176 -0
- package/dist/esm/ShuttleRenderer.js.map +7 -0
- package/dist/esm/ShuttleState.js +55 -0
- package/dist/esm/ShuttleState.js.map +7 -0
- package/dist/esm/animation/animationConfig.js +49 -0
- package/dist/esm/animation/animationConfig.js.map +7 -0
- package/dist/esm/classedComponents.js +43 -0
- package/dist/esm/classedComponents.js.map +7 -0
- package/dist/esm/components/LoadingIndicator.js +23 -0
- package/dist/esm/components/LoadingIndicator.js.map +7 -0
- package/dist/esm/components/OverflowList.js +44 -0
- package/dist/esm/components/OverflowList.js.map +7 -0
- package/dist/esm/components/ShuttleBreadcrumb.js +25 -0
- package/dist/esm/components/ShuttleBreadcrumb.js.map +7 -0
- package/dist/esm/components/ShuttleInfiniteScrollIndicator.js +19 -0
- package/dist/esm/components/ShuttleInfiniteScrollIndicator.js.map +7 -0
- package/dist/esm/components/ShuttleListItem/ActionButtons.js +49 -0
- package/dist/esm/components/ShuttleListItem/ActionButtons.js.map +7 -0
- package/dist/esm/components/ShuttleListItem/ShuttleListItem.js +94 -0
- package/dist/esm/components/ShuttleListItem/ShuttleListItem.js.map +7 -0
- package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js +100 -0
- package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js.map +7 -0
- package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js +83 -0
- package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js.map +7 -0
- package/dist/esm/components/ShuttleListPanel.js +20 -0
- package/dist/esm/components/ShuttleListPanel.js.map +7 -0
- package/dist/esm/components/ShuttleSearchBox.js +70 -0
- package/dist/esm/components/ShuttleSearchBox.js.map +7 -0
- package/dist/esm/components/ShuttleSource.js +208 -0
- package/dist/esm/components/ShuttleSource.js.map +7 -0
- package/dist/esm/components/ShuttleTarget.js +119 -0
- package/dist/esm/components/ShuttleTarget.js.map +7 -0
- package/dist/esm/components/VirtualizedItem.js +38 -0
- package/dist/esm/components/VirtualizedItem.js.map +7 -0
- package/dist/esm/components/VirtualizedList.js +77 -0
- package/dist/esm/components/VirtualizedList.js.map +7 -0
- package/dist/esm/components/VirtualizedSortableList.js +50 -0
- package/dist/esm/components/VirtualizedSortableList.js.map +7 -0
- package/dist/esm/helper.js +72 -0
- package/dist/esm/helper.js.map +7 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/tests/utils.js +1208 -0
- package/dist/esm/tests/utils.js.map +7 -0
- package/dist/esm/updateShuttleStateFromProps.js +81 -0
- package/dist/esm/updateShuttleStateFromProps.js.map +7 -0
- package/dist/esm/utils.js +27 -0
- package/dist/esm/utils.js.map +7 -0
- package/dist/esm/withProviders.js +30 -0
- package/dist/esm/withProviders.js.map +7 -0
- package/package.json +98 -89
- package/cjs/AnimationState.js +0 -48
- package/cjs/DSShuttle.js +0 -223
- package/cjs/SearchState.js +0 -41
- package/cjs/Shuttle.actions.js +0 -137
- package/cjs/ShuttleContainer.js +0 -87
- package/cjs/ShuttleImpl.js +0 -311
- package/cjs/ShuttleRenderer.js +0 -139
- package/cjs/ShuttleState.js +0 -80
- package/cjs/animation/animationConfig.js +0 -81
- package/cjs/classedComponents.js +0 -71
- package/cjs/components/LoadingIndicator.js +0 -25
- package/cjs/components/OverflowList.js +0 -53
- package/cjs/components/ShuttleBreadcrumb.js +0 -42
- package/cjs/components/ShuttleInfiniteScrollIndicator.js +0 -39
- package/cjs/components/ShuttleListItem/ActionButtons.js +0 -55
- package/cjs/components/ShuttleListItem/ShuttleListItem.js +0 -85
- package/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +0 -76
- package/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +0 -57
- package/cjs/components/ShuttleListPanel.js +0 -31
- package/cjs/components/ShuttleSearchBox.js +0 -110
- package/cjs/components/ShuttleSource.js +0 -188
- package/cjs/components/ShuttleTarget.js +0 -116
- package/cjs/components/VirtualizedItem.js +0 -46
- package/cjs/components/VirtualizedList.js +0 -93
- package/cjs/components/VirtualizedSortableList.js +0 -41
- package/cjs/helper.js +0 -117
- package/cjs/index.js +0 -12
- package/cjs/updateShuttleStateFromProps.js +0 -94
- package/cjs/utils.js +0 -43
- package/cjs/withProviders.js +0 -29
- package/esm/DSShuttle.js +0 -213
- package/esm/SearchState.js +0 -35
- package/esm/Shuttle.actions.js +0 -123
- package/esm/ShuttleContainer.js +0 -80
- package/esm/ShuttleImpl.js +0 -304
- package/esm/ShuttleRenderer.js +0 -132
- package/esm/ShuttleState.js +0 -74
- package/esm/animation/animationConfig.js +0 -77
- package/esm/classedComponents.js +0 -51
- package/esm/components/LoadingIndicator.js +0 -18
- package/esm/components/OverflowList.js +0 -46
- package/esm/components/ShuttleBreadcrumb.js +0 -35
- package/esm/components/ShuttleInfiniteScrollIndicator.js +0 -32
- package/esm/components/ShuttleListItem/ActionButtons.js +0 -43
- package/esm/components/ShuttleListItem/ShuttleListItem.js +0 -76
- package/esm/components/ShuttleListItem/ShuttleSourceListItem.js +0 -68
- package/esm/components/ShuttleListItem/ShuttleTargetListItem.js +0 -49
- package/esm/components/ShuttleListPanel.js +0 -24
- package/esm/components/ShuttleSearchBox.js +0 -104
- package/esm/components/ShuttleSource.js +0 -179
- package/esm/components/ShuttleTarget.js +0 -107
- package/esm/components/VirtualizedItem.js +0 -40
- package/esm/components/VirtualizedList.js +0 -84
- package/esm/components/VirtualizedSortableList.js +0 -34
- package/esm/helper.js +0 -78
- package/esm/index.js +0 -2
- package/esm/updateShuttleStateFromProps.js +0 -88
- package/esm/utils.js +0 -18
- package/esm/withProviders.js +0 -22
- package/types/AnimationState.d.ts +0 -26
- package/types/DSShuttle.d.ts +0 -341
- package/types/SearchState.d.ts +0 -22
- package/types/Shuttle.actions.d.ts +0 -11
- package/types/ShuttleContainer.d.ts +0 -3
- package/types/ShuttleImpl.d.ts +0 -3
- package/types/ShuttleRenderer.d.ts +0 -37
- package/types/ShuttleState.d.ts +0 -53
- package/types/animation/animationConfig.d.ts +0 -68
- package/types/classedComponents.d.ts +0 -14
- package/types/components/LoadingIndicator.d.ts +0 -3
- package/types/components/OverflowList.d.ts +0 -7
- package/types/components/ShuttleBreadcrumb.d.ts +0 -7
- package/types/components/ShuttleInfiniteScrollIndicator.d.ts +0 -5
- package/types/components/ShuttleListItem/ActionButtons.d.ts +0 -4
- package/types/components/ShuttleListItem/ShuttleListItem.d.ts +0 -14
- package/types/components/ShuttleListItem/ShuttleSourceListItem.d.ts +0 -13
- package/types/components/ShuttleListItem/ShuttleTargetListItem.d.ts +0 -13
- package/types/components/ShuttleListPanel.d.ts +0 -7
- package/types/components/ShuttleSearchBox.d.ts +0 -20
- package/types/components/ShuttleSource.d.ts +0 -54
- package/types/components/ShuttleTarget.d.ts +0 -16
- package/types/components/VirtualizedItem.d.ts +0 -3
- package/types/components/VirtualizedList.d.ts +0 -12
- package/types/components/VirtualizedSortableList.d.ts +0 -6
- package/types/helper.d.ts +0 -16
- package/types/index.d.ts +0 -1
- package/types/tests/DSShuttle.events.test.d.ts +0 -1
- package/types/tests/DSShuttle.test.d.ts +0 -1
- package/types/tests/utils.d.ts +0 -116
- package/types/updateShuttleStateFromProps.d.ts +0 -1
- package/types/utils.d.ts +0 -2
- package/types/withProviders.d.ts +0 -3
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var AnimationState_exports = {};
|
|
29
|
+
__export(AnimationState_exports, {
|
|
30
|
+
AnimationState: () => AnimationState,
|
|
31
|
+
default: () => AnimationState_default
|
|
32
|
+
});
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
var import_react = require("react");
|
|
35
|
+
var import_constate = __toESM(require("constate"));
|
|
36
|
+
function useShuttleAnimationState() {
|
|
37
|
+
const [animationState, setAnimationState] = (0, import_react.useState)({
|
|
38
|
+
isMoving: false,
|
|
39
|
+
isMovingBack: false,
|
|
40
|
+
isDrillingDown: false
|
|
41
|
+
});
|
|
42
|
+
const reset = (0, import_react.useCallback)(() => setAnimationState({
|
|
43
|
+
isMoving: false,
|
|
44
|
+
isMovingBack: false,
|
|
45
|
+
isDrillingDown: false
|
|
46
|
+
}), []);
|
|
47
|
+
const move = (0, import_react.useCallback)(() => setAnimationState({
|
|
48
|
+
isMovingBack: false,
|
|
49
|
+
isMoving: true,
|
|
50
|
+
isDrillingDown: false
|
|
51
|
+
}), []);
|
|
52
|
+
const moveBack = (0, import_react.useCallback)(() => setAnimationState({
|
|
53
|
+
isMovingBack: true,
|
|
54
|
+
isMoving: false,
|
|
55
|
+
isDrillingDown: false
|
|
56
|
+
}), []);
|
|
57
|
+
const drilldown = (0, import_react.useCallback)(() => setAnimationState({
|
|
58
|
+
isMovingBack: false,
|
|
59
|
+
isMoving: false,
|
|
60
|
+
isDrillingDown: true
|
|
61
|
+
}), []);
|
|
62
|
+
return {
|
|
63
|
+
state: animationState,
|
|
64
|
+
setIsMoving: move,
|
|
65
|
+
setIsMovingBack: moveBack,
|
|
66
|
+
setIsDrillingDown: drilldown,
|
|
67
|
+
reset
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const AnimationState = (0, import_constate.default)(useShuttleAnimationState, (value) => [
|
|
71
|
+
value.state
|
|
72
|
+
]);
|
|
73
|
+
var AnimationState_default = AnimationState;
|
|
74
|
+
module.exports = __toCommonJS(AnimationState_exports);
|
|
75
|
+
//# sourceMappingURL=AnimationState.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/AnimationState.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { useCallback, useState } from 'react';\nimport createContainer from 'constate';\n\nfunction useShuttleAnimationState() {\n const [animationState, setAnimationState] = useState({\n isMoving: false,\n isMovingBack: false,\n isDrillingDown: false,\n });\n const reset = useCallback(\n () =>\n setAnimationState({\n isMoving: false,\n isMovingBack: false,\n isDrillingDown: false,\n }),\n [],\n );\n const move = useCallback(\n () =>\n setAnimationState({\n isMovingBack: false,\n isMoving: true,\n isDrillingDown: false,\n }),\n [],\n );\n\n const moveBack = useCallback(\n () =>\n setAnimationState({\n isMovingBack: true,\n isMoving: false,\n isDrillingDown: false,\n }),\n [],\n );\n\n const drilldown = useCallback(\n () =>\n setAnimationState({\n isMovingBack: false,\n isMoving: false,\n isDrillingDown: true,\n }),\n [],\n );\n\n return {\n state: animationState,\n setIsMoving: move,\n setIsMovingBack: moveBack,\n setIsDrillingDown: drilldown,\n reset,\n };\n}\n\nconst AnimationState = createContainer(useShuttleAnimationState, value => [\n value.state,\n]);\n\nexport { AnimationState };\nexport default AnimationState;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAsC;AACtC,sBAA4B;AAE5B,oCAAoC;AAClC,QAAM,CAAC,gBAAgB,qBAAqB,2BAAS;AAAA,IACnD,UAAU;AAAA,IACV,cAAc;AAAA,IACd,gBAAgB;AAAA;AAElB,QAAM,QAAQ,8BACZ,MACE,kBAAkB;AAAA,IAChB,UAAU;AAAA,IACV,cAAc;AAAA,IACd,gBAAgB;AAAA,MAEpB;AAEF,QAAM,OAAO,8BACX,MACE,kBAAkB;AAAA,IAChB,cAAc;AAAA,IACd,UAAU;AAAA,IACV,gBAAgB;AAAA,MAEpB;AAGF,QAAM,WAAW,8BACf,MACE,kBAAkB;AAAA,IAChB,cAAc;AAAA,IACd,UAAU;AAAA,IACV,gBAAgB;AAAA,MAEpB;AAGF,QAAM,YAAY,8BAChB,MACE,kBAAkB;AAAA,IAChB,cAAc;AAAA,IACd,UAAU;AAAA,IACV,gBAAgB;AAAA,MAEpB;AAGF,SAAO;AAAA,IACL,OAAO;AAAA,IACP,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB;AAAA;AAAA;AAIJ,MAAM,iBAAiB,6BAAgB,0BAA0B,WAAS;AAAA,EACxE,MAAM;AAAA;AAIR,IAAO,yBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var DSShuttle_exports = {};
|
|
29
|
+
__export(DSShuttle_exports, {
|
|
30
|
+
DSShuttle: () => DSShuttle,
|
|
31
|
+
DSShuttleWithSchema: () => DSShuttleWithSchema,
|
|
32
|
+
default: () => DSShuttle_default,
|
|
33
|
+
utils: () => import_utils.default
|
|
34
|
+
});
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_lodash = require("lodash");
|
|
38
|
+
var import_react_desc = require("react-desc");
|
|
39
|
+
var import_ds_truncated_tooltip_text = require("@elliemae/ds-truncated-tooltip-text");
|
|
40
|
+
var import_ShuttleImpl = require("./ShuttleImpl");
|
|
41
|
+
var import_utils = __toESM(require("./utils"));
|
|
42
|
+
const noop = () => {
|
|
43
|
+
};
|
|
44
|
+
const DSShuttle = ({
|
|
45
|
+
containerProps = {},
|
|
46
|
+
idField = "id",
|
|
47
|
+
parentIdField = "parent",
|
|
48
|
+
showIcons = true,
|
|
49
|
+
items = [],
|
|
50
|
+
selectedItems = void 0,
|
|
51
|
+
nonSelectedItems = void 0,
|
|
52
|
+
onSearch = noop,
|
|
53
|
+
onSearchOpen = noop,
|
|
54
|
+
onSearchClose = noop,
|
|
55
|
+
onDrillDown = noop,
|
|
56
|
+
onDrillDownTarget = noop,
|
|
57
|
+
onTargetSortEnd = noop,
|
|
58
|
+
setGetStatus = noop,
|
|
59
|
+
targetSortable = true,
|
|
60
|
+
sourceEmptyMessage = "No Items Found",
|
|
61
|
+
sourceRootTitle = "Category",
|
|
62
|
+
targetEmptyMessage = "No Items Selected",
|
|
63
|
+
targetRootTitle = "Selected Items",
|
|
64
|
+
composeSourceItemProps = () => ({}),
|
|
65
|
+
composeTargetItemProps = () => ({}),
|
|
66
|
+
onAddToTarget = noop,
|
|
67
|
+
onAddCheckedItems = noop,
|
|
68
|
+
onRemoveFromTarget = noop,
|
|
69
|
+
onRemoveAllFromTarget = noop,
|
|
70
|
+
onChange = noop,
|
|
71
|
+
renderSourceCounter = noop,
|
|
72
|
+
renderTargetCounter = noop,
|
|
73
|
+
sourceClearItemsText = "CLEAR ALL",
|
|
74
|
+
targetClearItemsText = "CLEAR ALL",
|
|
75
|
+
searchPlaceholder = "Search field ID, name, etc.",
|
|
76
|
+
loadingSource = false,
|
|
77
|
+
loadingTarget = false,
|
|
78
|
+
onGetMoreItems = () => null,
|
|
79
|
+
hasNextPage = false,
|
|
80
|
+
moreItemsLoading
|
|
81
|
+
}) => /* @__PURE__ */ import_react.default.createElement(import_ds_truncated_tooltip_text.TooltipTextProvider, null, /* @__PURE__ */ import_react.default.createElement(import_ShuttleImpl.ShuttleImpl, {
|
|
82
|
+
composeSourceItemProps,
|
|
83
|
+
composeTargetItemProps,
|
|
84
|
+
containerProps,
|
|
85
|
+
idField,
|
|
86
|
+
items,
|
|
87
|
+
onAddCheckedItems,
|
|
88
|
+
onAddToTarget,
|
|
89
|
+
onChange,
|
|
90
|
+
onDrillDown,
|
|
91
|
+
nonSelectedItems,
|
|
92
|
+
onDrillDownTarget,
|
|
93
|
+
onRemoveAllFromTarget,
|
|
94
|
+
onRemoveFromTarget,
|
|
95
|
+
onSearch,
|
|
96
|
+
onSearchClose,
|
|
97
|
+
onSearchOpen,
|
|
98
|
+
onTargetSortEnd,
|
|
99
|
+
parentIdField,
|
|
100
|
+
renderSourceCounter,
|
|
101
|
+
renderTargetCounter,
|
|
102
|
+
searchPlaceholder,
|
|
103
|
+
selectedItems,
|
|
104
|
+
setGetStatus,
|
|
105
|
+
showIcons,
|
|
106
|
+
sourceClearItemsText,
|
|
107
|
+
sourceEmptyMessage,
|
|
108
|
+
sourceRootTitle,
|
|
109
|
+
targetClearItemsText,
|
|
110
|
+
targetEmptyMessage,
|
|
111
|
+
targetRootTitle,
|
|
112
|
+
targetSortable,
|
|
113
|
+
loadingSource,
|
|
114
|
+
loadingTarget,
|
|
115
|
+
onGetMoreItems: (0, import_lodash.debounce)((...args) => {
|
|
116
|
+
onGetMoreItems(...args);
|
|
117
|
+
}, 500),
|
|
118
|
+
moreItemsLoading,
|
|
119
|
+
hasNextPage
|
|
120
|
+
}));
|
|
121
|
+
const props = {
|
|
122
|
+
containerProps: import_react_desc.PropTypes.object.description("inject props to shuttle wrapper"),
|
|
123
|
+
idField: import_react_desc.PropTypes.string.description("The identifier field for the item object"),
|
|
124
|
+
parentIdField: import_react_desc.PropTypes.string.description("The parent identifier field for the item object"),
|
|
125
|
+
showIcons: import_react_desc.PropTypes.string.description("Whether to show the icons or not"),
|
|
126
|
+
items: import_react_desc.PropTypes.arrayOf(import_react_desc.PropTypes.shape({
|
|
127
|
+
disableDrillDown: import_react_desc.PropTypes.bool,
|
|
128
|
+
icon: import_react_desc.PropTypes.element,
|
|
129
|
+
name: import_react_desc.PropTypes.string,
|
|
130
|
+
readOnly: import_react_desc.PropTypes.bool,
|
|
131
|
+
description: import_react_desc.PropTypes.string
|
|
132
|
+
})).description("list of items"),
|
|
133
|
+
selectedItems: import_react_desc.PropTypes.arrayOf(import_react_desc.PropTypes.string).description("Array of item ids that are selected. If passed the component behaves as controlled"),
|
|
134
|
+
nonSelectedItems: import_react_desc.PropTypes.arrayOf(import_react_desc.PropTypes.string).description("Array of item ids that aren't selected.. Should include ALL non selected items, even those not rendered"),
|
|
135
|
+
onSearch: import_react_desc.PropTypes.func.description("Handler on search"),
|
|
136
|
+
onSearchOpen: import_react_desc.PropTypes.func.description("Handler when the searchbox is visible"),
|
|
137
|
+
onSearchClose: import_react_desc.PropTypes.func.description("Handler when the searchbox is not visible"),
|
|
138
|
+
onDrillDown: import_react_desc.PropTypes.func.description('Source handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down")'),
|
|
139
|
+
onDrillDownTarget: import_react_desc.PropTypes.func.description('Target handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down")'),
|
|
140
|
+
onTargetSortEnd: import_react_desc.PropTypes.func.description("Target handler when user stops dragging an item"),
|
|
141
|
+
onGetMoreItems: import_react_desc.PropTypes.func.description("Callback function that gets more items for Infinite Scroll"),
|
|
142
|
+
moreItemsLoading: import_react_desc.PropTypes.bool.description("Wheter there are mor items loading for Infinite Scroll"),
|
|
143
|
+
hasNextPage: import_react_desc.PropTypes.bool.description("Wheter there is a next page for Infinite Scroll, controls when to trigger onGetMoreItems"),
|
|
144
|
+
setGetStatus: import_react_desc.PropTypes.func.description("Function that takes as a parameter an internal getter for the state"),
|
|
145
|
+
targetSortable: import_react_desc.PropTypes.bool.description("Whether the target can be sortable with DnD"),
|
|
146
|
+
sourceRootTitle: import_react_desc.PropTypes.string.description("Handler when the searchbox is visible"),
|
|
147
|
+
sourceEmptyMessage: import_react_desc.PropTypes.string.description("Source text when there is no items"),
|
|
148
|
+
targetEmptyMessage: import_react_desc.PropTypes.string.description("Target text when there is no items"),
|
|
149
|
+
targetRootTitle: import_react_desc.PropTypes.string.description("Target text for the first hierarchy item"),
|
|
150
|
+
composeSourceItemProps: import_react_desc.PropTypes.func.description("Function that allow to compose the item props in the source"),
|
|
151
|
+
composeTargetItemProps: import_react_desc.PropTypes.func.description("Function that allow to compose the item props in the target"),
|
|
152
|
+
onAddToTarget: import_react_desc.PropTypes.func.description("Handler when a users moves an item to the target"),
|
|
153
|
+
onAddCheckedItems: import_react_desc.PropTypes.func.description("Handler when a users moves all the 'checked' items to the target"),
|
|
154
|
+
onRemoveFromTarget: import_react_desc.PropTypes.func.description("Handler when a user removes an item from the target"),
|
|
155
|
+
onRemoveAllFromTarget: import_react_desc.PropTypes.func.description("Handler when a user removes all the items from the target"),
|
|
156
|
+
onChange: import_react_desc.PropTypes.func.description("Handler for every change on the state"),
|
|
157
|
+
renderSourceCounter: import_react_desc.PropTypes.func.description("Function that returns an element for the source counter"),
|
|
158
|
+
renderTargetCounter: import_react_desc.PropTypes.func.description("Function that returns an element for the target counter"),
|
|
159
|
+
sourceClearItemsText: import_react_desc.PropTypes.string.description("Source text for the clear items button"),
|
|
160
|
+
targetClearItemsText: import_react_desc.PropTypes.string.description("Target text for the clear items button"),
|
|
161
|
+
searchPlaceholder: import_react_desc.PropTypes.string.description("Searchbox placeholder"),
|
|
162
|
+
loadingSource: import_react_desc.PropTypes.bool.description("Displays loading indicator on source section"),
|
|
163
|
+
loadingTarget: import_react_desc.PropTypes.bool.description("Displays loading indicator on target section")
|
|
164
|
+
};
|
|
165
|
+
DSShuttle.propTypes = props;
|
|
166
|
+
const DSShuttleWithSchema = (0, import_react_desc.describe)(DSShuttle);
|
|
167
|
+
DSShuttleWithSchema.propTypes = props;
|
|
168
|
+
var DSShuttle_default = DSShuttle;
|
|
169
|
+
module.exports = __toCommonJS(DSShuttle_exports);
|
|
170
|
+
//# sourceMappingURL=DSShuttle.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSShuttle.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport React from 'react';\nimport { debounce } from 'lodash';\nimport { describe, PropTypes } from 'react-desc';\nimport { TooltipTextProvider } from '@elliemae/ds-truncated-tooltip-text';\nimport { ShuttleImpl } from './ShuttleImpl';\nimport utils from './utils';\n\nconst noop = () => {};\n\nconst DSShuttle = ({\n containerProps = {},\n idField = 'id',\n parentIdField = 'parent',\n showIcons = true,\n items = [],\n selectedItems = undefined, // if defined it becomes controlled (v1)\n // TODO make `nonSelectedItems` the default controlled behavior (v2)\n nonSelectedItems = undefined,\n onSearch = noop,\n onSearchOpen = noop,\n onSearchClose = noop,\n onDrillDown = noop,\n onDrillDownTarget = noop,\n onTargetSortEnd = noop,\n setGetStatus = noop,\n targetSortable = true,\n sourceEmptyMessage = 'No Items Found',\n sourceRootTitle = 'Category',\n targetEmptyMessage = 'No Items Selected',\n targetRootTitle = 'Selected Items',\n composeSourceItemProps = () => ({}),\n composeTargetItemProps = () => ({}),\n onAddToTarget = noop,\n onAddCheckedItems = noop,\n onRemoveFromTarget = noop,\n onRemoveAllFromTarget = noop,\n onChange = noop,\n renderSourceCounter = noop,\n renderTargetCounter = noop,\n sourceClearItemsText = 'CLEAR ALL',\n targetClearItemsText = 'CLEAR ALL',\n searchPlaceholder = 'Search field ID, name, etc.',\n loadingSource = false,\n loadingTarget = false,\n onGetMoreItems = () => null,\n hasNextPage = false,\n moreItemsLoading,\n}) => (\n <TooltipTextProvider>\n <ShuttleImpl\n composeSourceItemProps={composeSourceItemProps}\n composeTargetItemProps={composeTargetItemProps}\n containerProps={containerProps}\n idField={idField}\n items={items}\n onAddCheckedItems={onAddCheckedItems}\n onAddToTarget={onAddToTarget}\n onChange={onChange}\n onDrillDown={onDrillDown}\n nonSelectedItems={nonSelectedItems}\n onDrillDownTarget={onDrillDownTarget}\n onRemoveAllFromTarget={onRemoveAllFromTarget}\n onRemoveFromTarget={onRemoveFromTarget}\n onSearch={onSearch}\n onSearchClose={onSearchClose}\n onSearchOpen={onSearchOpen}\n onTargetSortEnd={onTargetSortEnd}\n parentIdField={parentIdField}\n renderSourceCounter={renderSourceCounter}\n renderTargetCounter={renderTargetCounter}\n searchPlaceholder={searchPlaceholder}\n selectedItems={selectedItems}\n setGetStatus={setGetStatus}\n showIcons={showIcons}\n sourceClearItemsText={sourceClearItemsText}\n sourceEmptyMessage={sourceEmptyMessage}\n sourceRootTitle={sourceRootTitle}\n targetClearItemsText={targetClearItemsText}\n targetEmptyMessage={targetEmptyMessage}\n targetRootTitle={targetRootTitle}\n targetSortable={targetSortable}\n loadingSource={loadingSource}\n loadingTarget={loadingTarget}\n onGetMoreItems={debounce((...args) => {\n onGetMoreItems(...args);\n }, 500)}\n moreItemsLoading={moreItemsLoading}\n hasNextPage={hasNextPage}\n />\n </TooltipTextProvider>\n);\n\nconst props = {\n /** inject props to shuttle wrapper */\n containerProps: PropTypes.object.description('inject props to shuttle wrapper'),\n /** The identifier field for the item object */\n idField: PropTypes.string.description('The identifier field for the item object'),\n /** The parent identifier field for the item object */\n parentIdField: PropTypes.string.description('The parent identifier field for the item object'),\n /** Whether to show the icons or not */\n showIcons: PropTypes.string.description('Whether to show the icons or not'),\n /** List of items */\n items: PropTypes.arrayOf(\n PropTypes.shape({\n disableDrillDown: PropTypes.bool,\n icon: PropTypes.element,\n name: PropTypes.string,\n readOnly: PropTypes.bool,\n description: PropTypes.string,\n }),\n ).description('list of items'),\n /** Array of item ids that are selected. If passed the component behaves as controlled */\n selectedItems: PropTypes.arrayOf(PropTypes.string).description(\n 'Array of item ids that are selected. If passed the component behaves as controlled',\n ),\n /** Array of item ids that aren't selected. Should include ALL non selected items, even those not rendered */\n nonSelectedItems: PropTypes.arrayOf(PropTypes.string).description(\n \"Array of item ids that aren't selected.. Should include ALL non selected items, even those not rendered\",\n ),\n /** Handler on search */\n onSearch: PropTypes.func.description('Handler on search'),\n /** Handler when the searchbox is visible */\n onSearchOpen: PropTypes.func.description('Handler when the searchbox is visible'),\n /** Handler when the searchbox is not visible */\n onSearchClose: PropTypes.func.description('Handler when the searchbox is not visible'),\n /** Source handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction (\"up\" | \"down\") */\n onDrillDown: PropTypes.func.description(\n 'Source handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction (\"up\" | \"down\")',\n ),\n /** Target handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction (\"up\" | \"down\") */\n onDrillDownTarget: PropTypes.func.description(\n 'Target handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction (\"up\" | \"down\")',\n ),\n /** Target handler when user stops dragging an item */\n onTargetSortEnd: PropTypes.func.description('Target handler when user stops dragging an item'),\n /** Callback function that gets more items for Infinite Scroll */\n onGetMoreItems: PropTypes.func.description('Callback function that gets more items for Infinite Scroll'),\n /** Wheter there are mor items loading for Infinite Scroll */\n moreItemsLoading: PropTypes.bool.description('Wheter there are mor items loading for Infinite Scroll'),\n /** Wheter there is a next page for Infinite Scroll, controls when to trigger onGetMoreItems */\n hasNextPage: PropTypes.bool.description(\n 'Wheter there is a next page for Infinite Scroll, controls when to trigger onGetMoreItems',\n ),\n /** Function that takes as a parameter an internal getter for the state */\n setGetStatus: PropTypes.func.description('Function that takes as a parameter an internal getter for the state'),\n /** Whether the target can be sortable with DnD */\n targetSortable: PropTypes.bool.description('Whether the target can be sortable with DnD'),\n /** Handler when the searchbox is visible */\n sourceRootTitle: PropTypes.string.description('Handler when the searchbox is visible'),\n /** Source text when there is no items */\n sourceEmptyMessage: PropTypes.string.description('Source text when there is no items'),\n /** Target text when there is no items */\n targetEmptyMessage: PropTypes.string.description('Target text when there is no items'),\n /** Target text for the first hierarchy item */\n targetRootTitle: PropTypes.string.description('Target text for the first hierarchy item'),\n /** Function that allow to compose the item props in the source */\n composeSourceItemProps: PropTypes.func.description('Function that allow to compose the item props in the source'),\n /** Function that allow to compose the item props in the target */\n composeTargetItemProps: PropTypes.func.description('Function that allow to compose the item props in the target'),\n /** Handler when a users moves an item to the target */\n onAddToTarget: PropTypes.func.description('Handler when a users moves an item to the target'),\n /** Handler when a users moves all the 'checked' items to the target */\n onAddCheckedItems: PropTypes.func.description(\"Handler when a users moves all the 'checked' items to the target\"),\n /** Handler when a user removes an item from the target */\n onRemoveFromTarget: PropTypes.func.description('Handler when a user removes an item from the target'),\n /** Handler when a user removes all the items from the target */\n onRemoveAllFromTarget: PropTypes.func.description('Handler when a user removes all the items from the target'),\n /** Handler for every change on the state */\n onChange: PropTypes.func.description('Handler for every change on the state'),\n /** Function that returns an element for the source counter */\n renderSourceCounter: PropTypes.func.description('Function that returns an element for the source counter'),\n /** Function that returns an element for the target counter */\n renderTargetCounter: PropTypes.func.description('Function that returns an element for the target counter'),\n /** Source text for the clear items button */\n sourceClearItemsText: PropTypes.string.description('Source text for the clear items button'),\n /** Target text for the clear items button */\n targetClearItemsText: PropTypes.string.description('Target text for the clear items button'),\n /** Searchbox placeholder */\n searchPlaceholder: PropTypes.string.description('Searchbox placeholder'),\n /** Displays loading indicator on source section */\n loadingSource: PropTypes.bool.description('Displays loading indicator on source section'),\n /** Displays loading indicator on target section */\n loadingTarget: PropTypes.bool.description('Displays loading indicator on target section'),\n};\n\nDSShuttle.propTypes = props;\nconst DSShuttleWithSchema = describe(DSShuttle);\nDSShuttleWithSchema.propTypes = props;\n\nexport { utils, DSShuttleWithSchema, DSShuttle };\n\nexport default DSShuttle;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAkB;AAClB,oBAAyB;AACzB,wBAAoC;AACpC,uCAAoC;AACpC,yBAA4B;AAC5B,mBAAkB;AAElB,MAAM,OAAO,MAAM;AAAA;AAEnB,MAAM,YAAY,CAAC;AAAA,EACjB,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAEhB,mBAAmB;AAAA,EACnB,WAAW;AAAA,EACX,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,qBAAqB;AAAA,EACrB,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,kBAAkB;AAAA,EAClB,yBAAyB,MAAO;AAAA,EAChC,yBAAyB,MAAO;AAAA,EAChC,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,qBAAqB;AAAA,EACrB,wBAAwB;AAAA,EACxB,WAAW;AAAA,EACX,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,EACtB,uBAAuB;AAAA,EACvB,uBAAuB;AAAA,EACvB,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,iBAAiB,MAAM;AAAA,EACvB,cAAc;AAAA,EACd;AAAA,MAEA,mDAAC,sDAAD,MACE,mDAAC,gCAAD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB,4BAAS,IAAI,SAAS;AACpC,mBAAe,GAAG;AAAA,KACjB;AAAA,EACH;AAAA,EACA;AAAA;AAKN,MAAM,QAAQ;AAAA,EAEZ,gBAAgB,4BAAU,OAAO,YAAY;AAAA,EAE7C,SAAS,4BAAU,OAAO,YAAY;AAAA,EAEtC,eAAe,4BAAU,OAAO,YAAY;AAAA,EAE5C,WAAW,4BAAU,OAAO,YAAY;AAAA,EAExC,OAAO,4BAAU,QACf,4BAAU,MAAM;AAAA,IACd,kBAAkB,4BAAU;AAAA,IAC5B,MAAM,4BAAU;AAAA,IAChB,MAAM,4BAAU;AAAA,IAChB,UAAU,4BAAU;AAAA,IACpB,aAAa,4BAAU;AAAA,MAEzB,YAAY;AAAA,EAEd,eAAe,4BAAU,QAAQ,4BAAU,QAAQ,YACjD;AAAA,EAGF,kBAAkB,4BAAU,QAAQ,4BAAU,QAAQ,YACpD;AAAA,EAGF,UAAU,4BAAU,KAAK,YAAY;AAAA,EAErC,cAAc,4BAAU,KAAK,YAAY;AAAA,EAEzC,eAAe,4BAAU,KAAK,YAAY;AAAA,EAE1C,aAAa,4BAAU,KAAK,YAC1B;AAAA,EAGF,mBAAmB,4BAAU,KAAK,YAChC;AAAA,EAGF,iBAAiB,4BAAU,KAAK,YAAY;AAAA,EAE5C,gBAAgB,4BAAU,KAAK,YAAY;AAAA,EAE3C,kBAAkB,4BAAU,KAAK,YAAY;AAAA,EAE7C,aAAa,4BAAU,KAAK,YAC1B;AAAA,EAGF,cAAc,4BAAU,KAAK,YAAY;AAAA,EAEzC,gBAAgB,4BAAU,KAAK,YAAY;AAAA,EAE3C,iBAAiB,4BAAU,OAAO,YAAY;AAAA,EAE9C,oBAAoB,4BAAU,OAAO,YAAY;AAAA,EAEjD,oBAAoB,4BAAU,OAAO,YAAY;AAAA,EAEjD,iBAAiB,4BAAU,OAAO,YAAY;AAAA,EAE9C,wBAAwB,4BAAU,KAAK,YAAY;AAAA,EAEnD,wBAAwB,4BAAU,KAAK,YAAY;AAAA,EAEnD,eAAe,4BAAU,KAAK,YAAY;AAAA,EAE1C,mBAAmB,4BAAU,KAAK,YAAY;AAAA,EAE9C,oBAAoB,4BAAU,KAAK,YAAY;AAAA,EAE/C,uBAAuB,4BAAU,KAAK,YAAY;AAAA,EAElD,UAAU,4BAAU,KAAK,YAAY;AAAA,EAErC,qBAAqB,4BAAU,KAAK,YAAY;AAAA,EAEhD,qBAAqB,4BAAU,KAAK,YAAY;AAAA,EAEhD,sBAAsB,4BAAU,OAAO,YAAY;AAAA,EAEnD,sBAAsB,4BAAU,OAAO,YAAY;AAAA,EAEnD,mBAAmB,4BAAU,OAAO,YAAY;AAAA,EAEhD,eAAe,4BAAU,KAAK,YAAY;AAAA,EAE1C,eAAe,4BAAU,KAAK,YAAY;AAAA;AAG5C,UAAU,YAAY;AACtB,MAAM,sBAAsB,gCAAS;AACrC,oBAAoB,YAAY;AAIhC,IAAO,oBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(module2))
|
|
15
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (module2, isNodeMode) => {
|
|
21
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
+
return (module2, temp) => {
|
|
25
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
+
};
|
|
27
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
+
var SearchState_exports = {};
|
|
29
|
+
__export(SearchState_exports, {
|
|
30
|
+
SearchState: () => SearchState,
|
|
31
|
+
default: () => SearchState_default
|
|
32
|
+
});
|
|
33
|
+
var React = __toESM(require("react"));
|
|
34
|
+
var import_react = require("react");
|
|
35
|
+
var import_constate = __toESM(require("constate"));
|
|
36
|
+
function useSearchState() {
|
|
37
|
+
const [searchTerm, setSearchTerm] = (0, import_react.useState)("");
|
|
38
|
+
const [searching, setSearchBoxVisibility] = (0, import_react.useState)(false);
|
|
39
|
+
function toggleSearchBox(userVisible) {
|
|
40
|
+
if (userVisible !== void 0) {
|
|
41
|
+
setSearchBoxVisibility(userVisible);
|
|
42
|
+
} else {
|
|
43
|
+
setSearchBoxVisibility(!searching);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function reset() {
|
|
47
|
+
setSearchTerm("");
|
|
48
|
+
setSearchBoxVisibility(false);
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
state: { searchTerm, searching },
|
|
52
|
+
setSearchTerm,
|
|
53
|
+
toggleSearchBox,
|
|
54
|
+
reset
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const SearchState = (0, import_constate.default)(useSearchState, (value) => [value.state]);
|
|
58
|
+
var SearchState_default = SearchState;
|
|
59
|
+
module.exports = __toCommonJS(SearchState_exports);
|
|
60
|
+
//# sourceMappingURL=SearchState.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/SearchState.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { useState } from 'react';\nimport createContainer from 'constate';\n\nfunction useSearchState() {\n const [searchTerm, setSearchTerm] = useState('');\n const [searching, setSearchBoxVisibility] = useState(false); // todo: create a hook for Visibility behavior\n\n function toggleSearchBox(userVisible) {\n if (userVisible !== undefined) {\n setSearchBoxVisibility(userVisible);\n } else {\n setSearchBoxVisibility(!searching);\n }\n }\n\n function reset() {\n setSearchTerm('');\n setSearchBoxVisibility(false);\n }\n\n return {\n state: { searchTerm, searching },\n setSearchTerm,\n toggleSearchBox,\n reset,\n };\n}\n\nconst SearchState = createContainer(useSearchState, value => [value.state]);\nexport { SearchState };\nexport default SearchState;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAyB;AACzB,sBAA4B;AAE5B,0BAA0B;AACxB,QAAM,CAAC,YAAY,iBAAiB,2BAAS;AAC7C,QAAM,CAAC,WAAW,0BAA0B,2BAAS;AAErD,2BAAyB,aAAa;AACpC,QAAI,gBAAgB,QAAW;AAC7B,6BAAuB;AAAA,WAClB;AACL,6BAAuB,CAAC;AAAA;AAAA;AAI5B,mBAAiB;AACf,kBAAc;AACd,2BAAuB;AAAA;AAGzB,SAAO;AAAA,IACL,OAAO,EAAE,YAAY;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAIJ,MAAM,cAAc,6BAAgB,gBAAgB,WAAS,CAAC,MAAM;AAEpE,IAAO,sBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
25
|
+
var __export = (target, all) => {
|
|
26
|
+
for (var name in all)
|
|
27
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
28
|
+
};
|
|
29
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
30
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
31
|
+
for (let key of __getOwnPropNames(module2))
|
|
32
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
33
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
var __toESM = (module2, isNodeMode) => {
|
|
38
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
39
|
+
};
|
|
40
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
41
|
+
return (module2, temp) => {
|
|
42
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
43
|
+
};
|
|
44
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
45
|
+
var Shuttle_actions_exports = {};
|
|
46
|
+
__export(Shuttle_actions_exports, {
|
|
47
|
+
addToTarget: () => addToTarget,
|
|
48
|
+
moveItem: () => moveItem,
|
|
49
|
+
navigateTo: () => navigateTo,
|
|
50
|
+
removeFromTarget: () => removeFromTarget,
|
|
51
|
+
resetCheckedItems: () => resetCheckedItems,
|
|
52
|
+
resetMovedItems: () => resetMovedItems,
|
|
53
|
+
toggleItemSelection: () => toggleItemSelection
|
|
54
|
+
});
|
|
55
|
+
var React = __toESM(require("react"));
|
|
56
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
57
|
+
var import_helper = require("./helper");
|
|
58
|
+
var import_utils = __toESM(require("./utils"));
|
|
59
|
+
function toggleItemSelection(itemId) {
|
|
60
|
+
return (state) => __spreadProps(__spreadValues({}, state), {
|
|
61
|
+
checkedItems: (0, import_ds_utilities.addOrRemove)(state.checkedItems, itemId)
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function navigateTo(item, dest) {
|
|
65
|
+
const hierarchyType = (0, import_helper.getHierarchyTypeName)(dest);
|
|
66
|
+
return (state) => {
|
|
67
|
+
const indexInHierarchy = state[hierarchyType].findIndex((hItem) => hItem.id === item.id);
|
|
68
|
+
const hierarchy = state[hierarchyType];
|
|
69
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
70
|
+
[hierarchyType]: indexInHierarchy !== -1 ? hierarchy.slice(0, indexInHierarchy + 1) : [...hierarchy, item]
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function moveItem(item) {
|
|
75
|
+
return (state) => {
|
|
76
|
+
const movedItems = (0, import_helper.toggleInObject)(state.movedItems, item.id, item);
|
|
77
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
78
|
+
movedItems
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const defaultOptions = {
|
|
83
|
+
parentField: "parent",
|
|
84
|
+
idField: "id",
|
|
85
|
+
op: (hasMoved) => !hasMoved
|
|
86
|
+
};
|
|
87
|
+
function getItemDeep({ collection, id, options }) {
|
|
88
|
+
const { idField } = __spreadValues(__spreadValues({}, defaultOptions), options);
|
|
89
|
+
const itemIndex = collection.findIndex((fItem) => fItem[idField] === id);
|
|
90
|
+
const item = collection[itemIndex];
|
|
91
|
+
const children = item?.hasChildren ? (0, import_ds_utilities.compose)(import_utils.default.getChildren({ index: itemIndex }))(collection) || [] : [];
|
|
92
|
+
return { item, children };
|
|
93
|
+
}
|
|
94
|
+
function addToTarget(itemToAdd, collection) {
|
|
95
|
+
return (state, { idField }) => {
|
|
96
|
+
const items = collection || state.preparedItems;
|
|
97
|
+
const { item, children } = getItemDeep({
|
|
98
|
+
collection: items,
|
|
99
|
+
id: itemToAdd[idField]
|
|
100
|
+
});
|
|
101
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
102
|
+
movedItems: [...state.movedItems, item],
|
|
103
|
+
targetItems: [...state.targetItems, item, ...children]
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function removeFromTarget(itemToRemove) {
|
|
108
|
+
return (state, { idField }) => {
|
|
109
|
+
let targetItems = (0, import_ds_utilities.cloneDeep)(state.targetItems);
|
|
110
|
+
const itemIndex = targetItems.findIndex((fItem) => fItem.id === itemToRemove.id);
|
|
111
|
+
const item = targetItems[itemIndex];
|
|
112
|
+
const children = item?.hasChildren ? (0, import_ds_utilities.compose)((0, import_helper.filterMovedItems)(state.movedItems), import_utils.default.getChildren({ index: itemIndex }))(targetItems) || [] : [];
|
|
113
|
+
targetItems.splice(itemIndex, 1);
|
|
114
|
+
if (item?.hasChildren && children.length) {
|
|
115
|
+
const childrenHash = (0, import_ds_utilities.hashArray)(children, "id");
|
|
116
|
+
targetItems = targetItems.filter((i) => !childrenHash[i.id]);
|
|
117
|
+
}
|
|
118
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
119
|
+
movedItems: state.movedItems.filter((mItem) => mItem[idField] !== itemToRemove[idField]),
|
|
120
|
+
targetItems
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function resetCheckedItems() {
|
|
125
|
+
return (state) => __spreadProps(__spreadValues({}, state), {
|
|
126
|
+
checkedItems: []
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function resetMovedItems() {
|
|
130
|
+
return (state) => __spreadProps(__spreadValues({}, state), {
|
|
131
|
+
movedItems: [],
|
|
132
|
+
targetItems: []
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
module.exports = __toCommonJS(Shuttle_actions_exports);
|
|
136
|
+
//# sourceMappingURL=Shuttle.actions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Shuttle.actions.js", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import {\n addOrRemove,\n cloneDeep,\n hashArray,\n compose,\n} from '@elliemae/ds-utilities';\nimport {\n getHierarchyTypeName,\n toggleInObject,\n filterMovedItems,\n} from './helper';\n\nimport utils from './utils';\n\nexport function toggleItemSelection(itemId) {\n return state => ({\n ...state,\n checkedItems: addOrRemove(state.checkedItems, itemId),\n });\n}\nexport function navigateTo(item, dest) {\n const hierarchyType = getHierarchyTypeName(dest);\n return state => {\n const indexInHierarchy = state[hierarchyType].findIndex(\n hItem => hItem.id === item.id,\n );\n const hierarchy = state[hierarchyType];\n return {\n ...state,\n [hierarchyType]:\n indexInHierarchy !== -1\n ? hierarchy.slice(0, indexInHierarchy + 1)\n : [...hierarchy, item],\n };\n };\n}\nexport function moveItem(item) {\n return state => {\n const movedItems = toggleInObject(state.movedItems, item.id, item);\n return {\n ...state,\n movedItems,\n };\n };\n}\n\nconst defaultOptions = {\n parentField: 'parent',\n idField: 'id',\n op: hasMoved => !hasMoved,\n};\n\n// todo: optimize this\nfunction getItemDeep({ collection, id, options }) {\n const { idField } = { ...defaultOptions, ...options };\n const itemIndex = collection.findIndex(fItem => fItem[idField] === id);\n\n // get item with nested children\n const item = collection[itemIndex];\n const children = item?.hasChildren\n ? compose(utils.getChildren({ index: itemIndex }))(collection) || []\n : [];\n\n return { item, children };\n}\n\nexport function addToTarget(itemToAdd, collection) {\n return (state, { idField }) => {\n const items = collection || state.preparedItems;\n\n const { item, children } = getItemDeep({\n collection: items,\n id: itemToAdd[idField],\n });\n\n return {\n ...state,\n movedItems: [...state.movedItems, item],\n targetItems: [...state.targetItems, item, ...children],\n };\n };\n}\n\n// todo: optimize this\nexport function removeFromTarget(itemToRemove) {\n return (state, { idField }) => {\n let targetItems = cloneDeep(state.targetItems);\n\n const itemIndex = targetItems.findIndex(\n fItem => fItem.id === itemToRemove.id,\n );\n\n const item = targetItems[itemIndex];\n const children = item?.hasChildren\n ? compose(\n filterMovedItems(state.movedItems),\n utils.getChildren({ index: itemIndex }),\n )(targetItems) || []\n : [];\n\n targetItems.splice(itemIndex, 1);\n if (item?.hasChildren && children.length) {\n const childrenHash = hashArray(children, 'id');\n targetItems = targetItems.filter(i => !childrenHash[i.id]);\n }\n\n return {\n ...state,\n movedItems: state.movedItems.filter(\n mItem => mItem[idField] !== itemToRemove[idField],\n ),\n targetItems,\n };\n };\n}\n\nexport function resetCheckedItems() {\n return state => ({\n ...state,\n checkedItems: [],\n });\n}\nexport function resetMovedItems() {\n return state => ({\n ...state,\n movedItems: [],\n targetItems: [],\n });\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,0BAKO;AACP,oBAIO;AAEP,mBAAkB;AAEX,6BAA6B,QAAQ;AAC1C,SAAO,WAAU,iCACZ,QADY;AAAA,IAEf,cAAc,qCAAY,MAAM,cAAc;AAAA;AAAA;AAG3C,oBAAoB,MAAM,MAAM;AACrC,QAAM,gBAAgB,wCAAqB;AAC3C,SAAO,WAAS;AACd,UAAM,mBAAmB,MAAM,eAAe,UAC5C,WAAS,MAAM,OAAO,KAAK;AAE7B,UAAM,YAAY,MAAM;AACxB,WAAO,iCACF,QADE;AAAA,OAEJ,gBACC,qBAAqB,KACjB,UAAU,MAAM,GAAG,mBAAmB,KACtC,CAAC,GAAG,WAAW;AAAA;AAAA;AAAA;AAIpB,kBAAkB,MAAM;AAC7B,SAAO,WAAS;AACd,UAAM,aAAa,kCAAe,MAAM,YAAY,KAAK,IAAI;AAC7D,WAAO,iCACF,QADE;AAAA,MAEL;AAAA;AAAA;AAAA;AAKN,MAAM,iBAAiB;AAAA,EACrB,aAAa;AAAA,EACb,SAAS;AAAA,EACT,IAAI,cAAY,CAAC;AAAA;AAInB,qBAAqB,EAAE,YAAY,IAAI,WAAW;AAChD,QAAM,EAAE,YAAY,kCAAK,iBAAmB;AAC5C,QAAM,YAAY,WAAW,UAAU,WAAS,MAAM,aAAa;AAGnE,QAAM,OAAO,WAAW;AACxB,QAAM,WAAW,MAAM,cACnB,iCAAQ,qBAAM,YAAY,EAAE,OAAO,cAAc,eAAe,KAChE;AAEJ,SAAO,EAAE,MAAM;AAAA;AAGV,qBAAqB,WAAW,YAAY;AACjD,SAAO,CAAC,OAAO,EAAE,cAAc;AAC7B,UAAM,QAAQ,cAAc,MAAM;AAElC,UAAM,EAAE,MAAM,aAAa,YAAY;AAAA,MACrC,YAAY;AAAA,MACZ,IAAI,UAAU;AAAA;AAGhB,WAAO,iCACF,QADE;AAAA,MAEL,YAAY,CAAC,GAAG,MAAM,YAAY;AAAA,MAClC,aAAa,CAAC,GAAG,MAAM,aAAa,MAAM,GAAG;AAAA;AAAA;AAAA;AAM5C,0BAA0B,cAAc;AAC7C,SAAO,CAAC,OAAO,EAAE,cAAc;AAC7B,QAAI,cAAc,mCAAU,MAAM;AAElC,UAAM,YAAY,YAAY,UAC5B,WAAS,MAAM,OAAO,aAAa;AAGrC,UAAM,OAAO,YAAY;AACzB,UAAM,WAAW,MAAM,cACnB,iCACE,oCAAiB,MAAM,aACvB,qBAAM,YAAY,EAAE,OAAO,cAC3B,gBAAgB,KAClB;AAEJ,gBAAY,OAAO,WAAW;AAC9B,QAAI,MAAM,eAAe,SAAS,QAAQ;AACxC,YAAM,eAAe,mCAAU,UAAU;AACzC,oBAAc,YAAY,OAAO,OAAK,CAAC,aAAa,EAAE;AAAA;AAGxD,WAAO,iCACF,QADE;AAAA,MAEL,YAAY,MAAM,WAAW,OAC3B,WAAS,MAAM,aAAa,aAAa;AAAA,MAE3C;AAAA;AAAA;AAAA;AAKC,6BAA6B;AAClC,SAAO,WAAU,iCACZ,QADY;AAAA,IAEf,cAAc;AAAA;AAAA;AAGX,2BAA2B;AAChC,SAAO,WAAU,iCACZ,QADY;AAAA,IAEf,YAAY;AAAA,IACZ,aAAa;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
22
|
+
var __objRest = (source, exclude) => {
|
|
23
|
+
var target = {};
|
|
24
|
+
for (var prop in source)
|
|
25
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
26
|
+
target[prop] = source[prop];
|
|
27
|
+
if (source != null && __getOwnPropSymbols)
|
|
28
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
29
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
30
|
+
target[prop] = source[prop];
|
|
31
|
+
}
|
|
32
|
+
return target;
|
|
33
|
+
};
|
|
34
|
+
var __export = (target, all) => {
|
|
35
|
+
for (var name in all)
|
|
36
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
37
|
+
};
|
|
38
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
39
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
40
|
+
for (let key of __getOwnPropNames(module2))
|
|
41
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
42
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
43
|
+
}
|
|
44
|
+
return target;
|
|
45
|
+
};
|
|
46
|
+
var __toESM = (module2, isNodeMode) => {
|
|
47
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
48
|
+
};
|
|
49
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
50
|
+
return (module2, temp) => {
|
|
51
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
52
|
+
};
|
|
53
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
54
|
+
var ShuttleContainer_exports = {};
|
|
55
|
+
__export(ShuttleContainer_exports, {
|
|
56
|
+
default: () => ShuttleContainer_default
|
|
57
|
+
});
|
|
58
|
+
var React = __toESM(require("react"));
|
|
59
|
+
var import_react = require("react");
|
|
60
|
+
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
61
|
+
var import_withProviders = require("./withProviders");
|
|
62
|
+
var import_helper = require("./helper");
|
|
63
|
+
var import_SearchState = require("./SearchState");
|
|
64
|
+
var import_ShuttleState = require("./ShuttleState");
|
|
65
|
+
function filterItemsByTerm(items, term) {
|
|
66
|
+
return items.filter((item) => item.name.toLowerCase().indexOf(String(term).toLowerCase()) !== -1 || String(item.id).indexOf(String(term).toLowerCase()) !== -1);
|
|
67
|
+
}
|
|
68
|
+
function ShuttleContainer({ items = [], children }) {
|
|
69
|
+
const _a = (0, import_react.useContext)(import_ShuttleState.ShuttleState.Context), { state: shuttleState } = _a, handlers = __objRest(_a, ["state"]);
|
|
70
|
+
const { state: searchState } = (0, import_react.useContext)(import_SearchState.SearchState.Context);
|
|
71
|
+
const {
|
|
72
|
+
movedItems,
|
|
73
|
+
hierarchy,
|
|
74
|
+
hierarchyDest,
|
|
75
|
+
checkedItems,
|
|
76
|
+
searchTerm,
|
|
77
|
+
searching,
|
|
78
|
+
toggleItemSelection,
|
|
79
|
+
resetCheckedItems,
|
|
80
|
+
resetMovedItems,
|
|
81
|
+
moveCheckedItems,
|
|
82
|
+
moveItem,
|
|
83
|
+
navigate
|
|
84
|
+
} = __spreadValues(__spreadValues(__spreadValues({}, shuttleState), searchState), handlers);
|
|
85
|
+
const sourceItems = (0, import_react.useMemo)(() => (0, import_ds_utilities.compose)((items2) => items2.filter((item) => !movedItems[item.id]), (items2) => searchTerm && searching ? filterItemsByTerm(items2, searchTerm) : items2, (items2) => (0, import_helper.filterItemsByHierarchy)(items2, (0, import_helper.getActiveIdFromHierarchy)(hierarchy).id), (items2) => (0, import_helper.prepareItems)(items2))(items), [items, searchTerm, searching, hierarchy, movedItems]);
|
|
86
|
+
const targetItems = (0, import_react.useMemo)(() => {
|
|
87
|
+
const hierarchyId = (0, import_helper.getActiveIdFromHierarchy)(hierarchyDest).id;
|
|
88
|
+
return (0, import_ds_utilities.compose)((items2) => (0, import_ds_utilities.sortBy)(items2, ["name"]), (items2) => hierarchyId ? (0, import_helper.filterItemsByHierarchy)(items2, hierarchyId).filter((item) => !movedItems[item.id]) : (0, import_ds_utilities.uniqBy)((0, import_ds_utilities.values)(movedItems), "id"))(items);
|
|
89
|
+
}, [items, searching, hierarchyDest, movedItems]);
|
|
90
|
+
return (0, import_ds_utilities.isFunction)(children) && children({
|
|
91
|
+
checkedItems,
|
|
92
|
+
hierarchy,
|
|
93
|
+
hierarchyDest,
|
|
94
|
+
onCheckItem: toggleItemSelection,
|
|
95
|
+
onClearCheckedItems: resetCheckedItems,
|
|
96
|
+
onClearMovedItems: resetMovedItems,
|
|
97
|
+
onMoveCheckedItems: () => moveCheckedItems((0, import_helper.getItemsById)(checkedItems, items)),
|
|
98
|
+
onMoveItemToSource: (item) => moveItem(item, false),
|
|
99
|
+
onMoveItemToTarget: (item) => moveItem(item, true),
|
|
100
|
+
onNavigateOnSourceTo: (item) => navigate(item, false),
|
|
101
|
+
onNavigateOnTargetTo: (item) => navigate(item, true),
|
|
102
|
+
sourceItems,
|
|
103
|
+
targetItems
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
var ShuttleContainer_default = (0, import_withProviders.withProviders)(ShuttleContainer);
|
|
107
|
+
module.exports = __toCommonJS(ShuttleContainer_exports);
|
|
108
|
+
//# sourceMappingURL=ShuttleContainer.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ShuttleContainer.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-shadow */\nimport { useContext, useMemo } from 'react';\nimport {\n isFunction,\n compose,\n uniqBy,\n values,\n sortBy,\n} from '@elliemae/ds-utilities';\nimport { withProviders } from './withProviders';\nimport {\n prepareItems,\n getActiveIdFromHierarchy,\n filterItemsByHierarchy,\n getItemsById,\n} from './helper';\nimport { SearchState } from './SearchState';\nimport { ShuttleState } from './ShuttleState';\n\nfunction filterItemsByTerm(items, term) {\n return items.filter(\n item =>\n item.name.toLowerCase().indexOf(String(term).toLowerCase()) !== -1 ||\n String(item.id).indexOf(String(term).toLowerCase()) !== -1,\n );\n}\n\nfunction ShuttleContainer({ items = [], children }) {\n const { state: shuttleState, ...handlers } = useContext(\n ShuttleState.Context,\n );\n const { state: searchState } = useContext(SearchState.Context);\n const {\n movedItems,\n hierarchy,\n hierarchyDest,\n checkedItems,\n searchTerm,\n searching,\n toggleItemSelection,\n resetCheckedItems,\n resetMovedItems,\n moveCheckedItems,\n moveItem,\n navigate,\n } = { ...shuttleState, ...searchState, ...handlers };\n\n const sourceItems = useMemo(\n () =>\n compose(\n items => items.filter(item => !movedItems[item.id]),\n items =>\n searchTerm && searching\n ? filterItemsByTerm(items, searchTerm)\n : items,\n items =>\n filterItemsByHierarchy(items, getActiveIdFromHierarchy(hierarchy).id),\n items => prepareItems(items),\n )(items),\n [items, searchTerm, searching, hierarchy, movedItems],\n );\n\n const targetItems = useMemo(() => {\n const hierarchyId = getActiveIdFromHierarchy(hierarchyDest).id;\n return compose(\n items => sortBy(items, ['name']),\n items =>\n hierarchyId\n ? filterItemsByHierarchy(items, hierarchyId).filter(\n item => !movedItems[item.id],\n )\n : uniqBy(values(movedItems), 'id'),\n )(items);\n }, [items, searching, hierarchyDest, movedItems]);\n\n return (\n isFunction(children) &&\n children({\n checkedItems,\n hierarchy,\n hierarchyDest,\n onCheckItem: toggleItemSelection,\n onClearCheckedItems: resetCheckedItems,\n onClearMovedItems: resetMovedItems,\n onMoveCheckedItems: () =>\n moveCheckedItems(getItemsById(checkedItems, items)),\n onMoveItemToSource: item => moveItem(item, false),\n onMoveItemToTarget: item => moveItem(item, true),\n onNavigateOnSourceTo: item => navigate(item, false),\n onNavigateOnTargetTo: item => navigate(item, true),\n sourceItems,\n targetItems,\n })\n );\n}\n\nexport default withProviders(ShuttleContainer);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAoC;AACpC,0BAMO;AACP,2BAA8B;AAC9B,oBAKO;AACP,yBAA4B;AAC5B,0BAA6B;AAE7B,2BAA2B,OAAO,MAAM;AACtC,SAAO,MAAM,OACX,UACE,KAAK,KAAK,cAAc,QAAQ,OAAO,MAAM,mBAAmB,MAChE,OAAO,KAAK,IAAI,QAAQ,OAAO,MAAM,mBAAmB;AAAA;AAI9D,0BAA0B,EAAE,QAAQ,IAAI,YAAY;AAClD,QAA6C,kCAC3C,iCAAa,UADP,SAAO,iBAA8B,IAAb,qBAAa,IAAb,CAAxB;AAGR,QAAM,EAAE,OAAO,gBAAgB,6BAAW,+BAAY;AACtD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,iDAAK,eAAiB,cAAgB;AAE1C,QAAM,cAAc,0BAClB,MACE,iCACE,YAAS,OAAM,OAAO,UAAQ,CAAC,WAAW,KAAK,MAC/C,YACE,cAAc,YACV,kBAAkB,QAAO,cACzB,QACN,YACE,0CAAuB,QAAO,4CAAyB,WAAW,KACpE,YAAS,gCAAa,SACtB,QACJ,CAAC,OAAO,YAAY,WAAW,WAAW;AAG5C,QAAM,cAAc,0BAAQ,MAAM;AAChC,UAAM,cAAc,4CAAyB,eAAe;AAC5D,WAAO,iCACL,YAAS,gCAAO,QAAO,CAAC,UACxB,YACE,cACI,0CAAuB,QAAO,aAAa,OACzC,UAAQ,CAAC,WAAW,KAAK,OAE3B,gCAAO,gCAAO,aAAa,OACjC;AAAA,KACD,CAAC,OAAO,WAAW,eAAe;AAErC,SACE,oCAAW,aACX,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb,qBAAqB;AAAA,IACrB,mBAAmB;AAAA,IACnB,oBAAoB,MAClB,iBAAiB,gCAAa,cAAc;AAAA,IAC9C,oBAAoB,UAAQ,SAAS,MAAM;AAAA,IAC3C,oBAAoB,UAAQ,SAAS,MAAM;AAAA,IAC3C,sBAAsB,UAAQ,SAAS,MAAM;AAAA,IAC7C,sBAAsB,UAAQ,SAAS,MAAM;AAAA,IAC7C;AAAA,IACA;AAAA;AAAA;AAKN,IAAO,2BAAQ,wCAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|