@elliemae/ds-shuttle 3.5.0-rc.1 → 3.5.0-rc.12
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 +36 -21
- package/dist/cjs/AnimationState.js.map +2 -2
- package/dist/cjs/DSShuttle.js +71 -54
- package/dist/cjs/DSShuttle.js.map +2 -2
- package/dist/cjs/SearchState.js +4 -1
- package/dist/cjs/SearchState.js.map +2 -2
- package/dist/cjs/Shuttle.actions.js +17 -5
- package/dist/cjs/Shuttle.actions.js.map +2 -2
- package/dist/cjs/ShuttleContainer.js +25 -5
- package/dist/cjs/ShuttleContainer.js.map +2 -2
- package/dist/cjs/ShuttleImpl.js +61 -15
- package/dist/cjs/ShuttleImpl.js.map +1 -1
- package/dist/cjs/ShuttleRenderer.js +81 -65
- package/dist/cjs/ShuttleRenderer.js.map +1 -1
- package/dist/cjs/ShuttleState.js +10 -3
- package/dist/cjs/ShuttleState.js.map +2 -2
- package/dist/cjs/animation/animationConfig.js +4 -1
- package/dist/cjs/animation/animationConfig.js.map +1 -1
- package/dist/cjs/classedComponents.js +4 -1
- package/dist/cjs/classedComponents.js.map +1 -1
- package/dist/cjs/components/LoadingIndicator.js +12 -8
- package/dist/cjs/components/LoadingIndicator.js.map +1 -1
- package/dist/cjs/components/OverflowList.js +10 -6
- package/dist/cjs/components/OverflowList.js.map +1 -1
- package/dist/cjs/components/ShuttleBreadcrumb.js +17 -13
- package/dist/cjs/components/ShuttleBreadcrumb.js.map +1 -1
- package/dist/cjs/components/ShuttleInfiniteScrollIndicator.js +12 -8
- package/dist/cjs/components/ShuttleInfiniteScrollIndicator.js.map +1 -1
- package/dist/cjs/components/ShuttleListItem/ActionButtons.js +11 -8
- package/dist/cjs/components/ShuttleListItem/ActionButtons.js.map +1 -1
- package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js +33 -16
- package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js.map +1 -1
- package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +11 -9
- package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js.map +1 -1
- package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +11 -9
- package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js.map +1 -1
- package/dist/cjs/components/ShuttleListPanel.js +14 -10
- package/dist/cjs/components/ShuttleListPanel.js.map +2 -2
- package/dist/cjs/components/ShuttleSearchBox.js +18 -13
- package/dist/cjs/components/ShuttleSearchBox.js.map +1 -1
- package/dist/cjs/components/ShuttleSource.js +98 -59
- package/dist/cjs/components/ShuttleSource.js.map +2 -2
- package/dist/cjs/components/ShuttleTarget.js +60 -33
- package/dist/cjs/components/ShuttleTarget.js.map +1 -1
- package/dist/cjs/components/VirtualizedItem.js +20 -14
- package/dist/cjs/components/VirtualizedItem.js.map +1 -1
- package/dist/cjs/components/VirtualizedList.js +28 -20
- package/dist/cjs/components/VirtualizedList.js.map +2 -2
- package/dist/cjs/components/VirtualizedSortableList.js +9 -5
- package/dist/cjs/components/VirtualizedSortableList.js.map +1 -1
- package/dist/cjs/helper.js +18 -7
- package/dist/cjs/helper.js.map +2 -2
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/tests/utils.js +7 -2
- package/dist/cjs/tests/utils.js.map +1 -1
- package/dist/cjs/updateShuttleStateFromProps.js +13 -4
- package/dist/cjs/updateShuttleStateFromProps.js.map +1 -1
- package/dist/cjs/utils.js +4 -1
- package/dist/cjs/utils.js.map +1 -1
- package/dist/cjs/withProviders.js +14 -5
- package/dist/cjs/withProviders.js.map +1 -1
- package/dist/esm/AnimationState.js +32 -20
- package/dist/esm/AnimationState.js.map +1 -1
- package/dist/esm/DSShuttle.js +67 -53
- package/dist/esm/DSShuttle.js.map +1 -1
- package/dist/esm/SearchState.js.map +1 -1
- package/dist/esm/Shuttle.actions.js +13 -4
- package/dist/esm/Shuttle.actions.js.map +1 -1
- package/dist/esm/ShuttleContainer.js +21 -4
- package/dist/esm/ShuttleContainer.js.map +2 -2
- package/dist/esm/ShuttleImpl.js +57 -14
- package/dist/esm/ShuttleImpl.js.map +1 -1
- package/dist/esm/ShuttleRenderer.js +77 -64
- package/dist/esm/ShuttleRenderer.js.map +1 -1
- package/dist/esm/ShuttleState.js +6 -2
- package/dist/esm/ShuttleState.js.map +1 -1
- package/dist/esm/animation/animationConfig.js.map +1 -1
- package/dist/esm/classedComponents.js.map +1 -1
- package/dist/esm/components/LoadingIndicator.js +8 -7
- package/dist/esm/components/LoadingIndicator.js.map +1 -1
- package/dist/esm/components/OverflowList.js +6 -5
- package/dist/esm/components/OverflowList.js.map +1 -1
- package/dist/esm/components/ShuttleBreadcrumb.js +13 -12
- package/dist/esm/components/ShuttleBreadcrumb.js.map +1 -1
- package/dist/esm/components/ShuttleInfiniteScrollIndicator.js +8 -7
- package/dist/esm/components/ShuttleInfiniteScrollIndicator.js.map +1 -1
- package/dist/esm/components/ShuttleListItem/ActionButtons.js +7 -7
- package/dist/esm/components/ShuttleListItem/ActionButtons.js.map +1 -1
- package/dist/esm/components/ShuttleListItem/ShuttleListItem.js +29 -15
- package/dist/esm/components/ShuttleListItem/ShuttleListItem.js.map +1 -1
- package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js +7 -8
- package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js.map +1 -1
- package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js +7 -8
- package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js.map +1 -1
- package/dist/esm/components/ShuttleListPanel.js +10 -9
- package/dist/esm/components/ShuttleListPanel.js.map +1 -1
- package/dist/esm/components/ShuttleSearchBox.js +14 -12
- package/dist/esm/components/ShuttleSearchBox.js.map +1 -1
- package/dist/esm/components/ShuttleSource.js +94 -58
- package/dist/esm/components/ShuttleSource.js.map +1 -1
- package/dist/esm/components/ShuttleTarget.js +56 -32
- package/dist/esm/components/ShuttleTarget.js.map +1 -1
- package/dist/esm/components/VirtualizedItem.js +16 -13
- package/dist/esm/components/VirtualizedItem.js.map +1 -1
- package/dist/esm/components/VirtualizedList.js +24 -19
- package/dist/esm/components/VirtualizedList.js.map +1 -1
- package/dist/esm/components/VirtualizedSortableList.js +5 -4
- package/dist/esm/components/VirtualizedSortableList.js.map +1 -1
- package/dist/esm/helper.js +14 -6
- package/dist/esm/helper.js.map +2 -2
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/tests/utils.js +3 -1
- package/dist/esm/tests/utils.js.map +1 -1
- package/dist/esm/updateShuttleStateFromProps.js +9 -3
- package/dist/esm/updateShuttleStateFromProps.js.map +1 -1
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/withProviders.js +10 -4
- package/dist/esm/withProviders.js.map +1 -1
- package/package.json +11 -11
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
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
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var AnimationState_exports = {};
|
|
23
26
|
__export(AnimationState_exports, {
|
|
@@ -34,26 +37,38 @@ function useShuttleAnimationState() {
|
|
|
34
37
|
isMovingBack: false,
|
|
35
38
|
isDrillingDown: false
|
|
36
39
|
});
|
|
37
|
-
const reset = (0, import_react.useCallback)(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
40
|
+
const reset = (0, import_react.useCallback)(
|
|
41
|
+
() => setAnimationState({
|
|
42
|
+
isMoving: false,
|
|
43
|
+
isMovingBack: false,
|
|
44
|
+
isDrillingDown: false
|
|
45
|
+
}),
|
|
46
|
+
[]
|
|
47
|
+
);
|
|
48
|
+
const move = (0, import_react.useCallback)(
|
|
49
|
+
() => setAnimationState({
|
|
50
|
+
isMovingBack: false,
|
|
51
|
+
isMoving: true,
|
|
52
|
+
isDrillingDown: false
|
|
53
|
+
}),
|
|
54
|
+
[]
|
|
55
|
+
);
|
|
56
|
+
const moveBack = (0, import_react.useCallback)(
|
|
57
|
+
() => setAnimationState({
|
|
58
|
+
isMovingBack: true,
|
|
59
|
+
isMoving: false,
|
|
60
|
+
isDrillingDown: false
|
|
61
|
+
}),
|
|
62
|
+
[]
|
|
63
|
+
);
|
|
64
|
+
const drilldown = (0, import_react.useCallback)(
|
|
65
|
+
() => setAnimationState({
|
|
66
|
+
isMovingBack: false,
|
|
67
|
+
isMoving: false,
|
|
68
|
+
isDrillingDown: true
|
|
69
|
+
}),
|
|
70
|
+
[]
|
|
71
|
+
);
|
|
57
72
|
return {
|
|
58
73
|
state: animationState,
|
|
59
74
|
setIsMoving: move,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/AnimationState.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
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": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAsC;AACtC,sBAA4B;AAE5B,SAAS,2BAA2B;AAClC,QAAM,CAAC,gBAAgB,iBAAiB,QAAI,uBAAS;AAAA,IACnD,UAAU;AAAA,IACV,cAAc;AAAA,IACd,gBAAgB;AAAA,EAClB,CAAC;AACD,QAAM,YAAQ;AAAA,IACZ,MACE,kBAAkB;AAAA,MAChB,UAAU;AAAA,MACV,cAAc;AAAA,MACd,gBAAgB;AAAA,IAClB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACA,QAAM,WAAO;AAAA,IACX,MACE,kBAAkB;AAAA,MAChB,cAAc;AAAA,MACd,UAAU;AAAA,MACV,gBAAgB;AAAA,IAClB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAEA,QAAM,eAAW;AAAA,IACf,MACE,kBAAkB;AAAA,MAChB,cAAc;AAAA,MACd,UAAU;AAAA,MACV,gBAAgB;AAAA,IAClB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAEA,QAAM,gBAAY;AAAA,IAChB,MACE,kBAAkB;AAAA,MAChB,cAAc;AAAA,MACd,UAAU;AAAA,MACV,gBAAgB;AAAA,IAClB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL,OAAO;AAAA,IACP,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB;AAAA,EACF;AACF;AAEA,MAAM,qBAAiB,gBAAAA,SAAgB,0BAA0B,WAAS;AAAA,EACxE,MAAM;AACR,CAAC;AAGD,IAAO,yBAAQ;",
|
|
6
|
+
"names": ["createContainer"]
|
|
7
7
|
}
|
package/dist/cjs/DSShuttle.js
CHANGED
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
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
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var DSShuttle_exports = {};
|
|
23
26
|
__export(DSShuttle_exports, {
|
|
@@ -28,7 +31,7 @@ __export(DSShuttle_exports, {
|
|
|
28
31
|
});
|
|
29
32
|
module.exports = __toCommonJS(DSShuttle_exports);
|
|
30
33
|
var React = __toESM(require("react"));
|
|
31
|
-
var
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
35
|
var import_lodash = require("lodash");
|
|
33
36
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
34
37
|
var import_ds_truncated_tooltip_text = require("@elliemae/ds-truncated-tooltip-text");
|
|
@@ -73,69 +76,83 @@ const DSShuttle = ({
|
|
|
73
76
|
onGetMoreItems = () => null,
|
|
74
77
|
hasNextPage = false,
|
|
75
78
|
moreItemsLoading
|
|
76
|
-
}) => /* @__PURE__ */
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
onGetMoreItems(...args)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
79
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_truncated_tooltip_text.TooltipTextProvider, {
|
|
80
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ShuttleImpl.ShuttleImpl, {
|
|
81
|
+
composeSourceItemProps,
|
|
82
|
+
composeTargetItemProps,
|
|
83
|
+
containerProps,
|
|
84
|
+
idField,
|
|
85
|
+
items,
|
|
86
|
+
onAddCheckedItems,
|
|
87
|
+
onAddToTarget,
|
|
88
|
+
onChange,
|
|
89
|
+
onDrillDown,
|
|
90
|
+
nonSelectedItems,
|
|
91
|
+
onDrillDownTarget,
|
|
92
|
+
onRemoveAllFromTarget,
|
|
93
|
+
onRemoveFromTarget,
|
|
94
|
+
onSearch,
|
|
95
|
+
onSearchClose,
|
|
96
|
+
onSearchOpen,
|
|
97
|
+
onTargetSortEnd,
|
|
98
|
+
parentIdField,
|
|
99
|
+
renderSourceCounter,
|
|
100
|
+
renderTargetCounter,
|
|
101
|
+
searchPlaceholder,
|
|
102
|
+
selectedItems,
|
|
103
|
+
setGetStatus,
|
|
104
|
+
showIcons,
|
|
105
|
+
sourceClearItemsText,
|
|
106
|
+
sourceEmptyMessage,
|
|
107
|
+
sourceRootTitle,
|
|
108
|
+
targetClearItemsText,
|
|
109
|
+
targetEmptyMessage,
|
|
110
|
+
targetRootTitle,
|
|
111
|
+
targetSortable,
|
|
112
|
+
loadingSource,
|
|
113
|
+
loadingTarget,
|
|
114
|
+
onGetMoreItems: (0, import_lodash.debounce)((...args) => {
|
|
115
|
+
onGetMoreItems(...args);
|
|
116
|
+
}, 500),
|
|
117
|
+
moreItemsLoading,
|
|
118
|
+
hasNextPage
|
|
119
|
+
})
|
|
120
|
+
});
|
|
116
121
|
const props = {
|
|
117
122
|
containerProps: import_ds_utilities.PropTypes.object.description("inject props to shuttle wrapper"),
|
|
118
123
|
idField: import_ds_utilities.PropTypes.string.description("The identifier field for the item object"),
|
|
119
124
|
parentIdField: import_ds_utilities.PropTypes.string.description("The parent identifier field for the item object"),
|
|
120
125
|
showIcons: import_ds_utilities.PropTypes.string.description("Whether to show the icons or not"),
|
|
121
|
-
items: import_ds_utilities.PropTypes.arrayOf(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
items: import_ds_utilities.PropTypes.arrayOf(
|
|
127
|
+
import_ds_utilities.PropTypes.shape({
|
|
128
|
+
disableDrillDown: import_ds_utilities.PropTypes.bool,
|
|
129
|
+
icon: import_ds_utilities.PropTypes.element,
|
|
130
|
+
name: import_ds_utilities.PropTypes.string,
|
|
131
|
+
readOnly: import_ds_utilities.PropTypes.bool,
|
|
132
|
+
description: import_ds_utilities.PropTypes.string
|
|
133
|
+
})
|
|
134
|
+
).description("list of items"),
|
|
135
|
+
selectedItems: import_ds_utilities.PropTypes.arrayOf(import_ds_utilities.PropTypes.string).description(
|
|
136
|
+
"Array of item ids that are selected. If passed the component behaves as controlled"
|
|
137
|
+
),
|
|
138
|
+
nonSelectedItems: import_ds_utilities.PropTypes.arrayOf(import_ds_utilities.PropTypes.string).description(
|
|
139
|
+
"Array of item ids that aren't selected.. Should include ALL non selected items, even those not rendered"
|
|
140
|
+
),
|
|
130
141
|
onSearch: import_ds_utilities.PropTypes.func.description("Handler on search"),
|
|
131
142
|
onSearchOpen: import_ds_utilities.PropTypes.func.description("Handler when the searchbox is visible"),
|
|
132
143
|
onSearchClose: import_ds_utilities.PropTypes.func.description("Handler when the searchbox is not visible"),
|
|
133
|
-
onDrillDown: import_ds_utilities.PropTypes.func.description(
|
|
134
|
-
|
|
144
|
+
onDrillDown: import_ds_utilities.PropTypes.func.description(
|
|
145
|
+
'Source handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down")'
|
|
146
|
+
),
|
|
147
|
+
onDrillDownTarget: import_ds_utilities.PropTypes.func.description(
|
|
148
|
+
'Target handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down")'
|
|
149
|
+
),
|
|
135
150
|
onTargetSortEnd: import_ds_utilities.PropTypes.func.description("Target handler when user stops dragging an item"),
|
|
136
151
|
onGetMoreItems: import_ds_utilities.PropTypes.func.description("Callback function that gets more items for Infinite Scroll"),
|
|
137
152
|
moreItemsLoading: import_ds_utilities.PropTypes.bool.description("Wheter there are mor items loading for Infinite Scroll"),
|
|
138
|
-
hasNextPage: import_ds_utilities.PropTypes.bool.description(
|
|
153
|
+
hasNextPage: import_ds_utilities.PropTypes.bool.description(
|
|
154
|
+
"Wheter there is a next page for Infinite Scroll, controls when to trigger onGetMoreItems"
|
|
155
|
+
),
|
|
139
156
|
setGetStatus: import_ds_utilities.PropTypes.func.description("Function that takes as a parameter an internal getter for the state"),
|
|
140
157
|
targetSortable: import_ds_utilities.PropTypes.bool.description("Whether the target can be sortable with DnD"),
|
|
141
158
|
sourceRootTitle: import_ds_utilities.PropTypes.string.description("Handler when the searchbox is visible"),
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSShuttle.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable max-lines */\nimport React from 'react';\nimport { debounce } from 'lodash';\nimport { describe, PropTypes } from '@elliemae/ds-utilities';\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;\nDSShuttle.displayName = 'DSShuttle';\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": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["utils"]
|
|
7
7
|
}
|
package/dist/cjs/SearchState.js
CHANGED
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
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
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var SearchState_exports = {};
|
|
23
26
|
__export(SearchState_exports, {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SearchState.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
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": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAyB;AACzB,sBAA4B;AAE5B,SAAS,iBAAiB;AACxB,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,EAAE;AAC/C,QAAM,CAAC,WAAW,sBAAsB,QAAI,uBAAS,KAAK;AAE1D,WAAS,gBAAgB,aAAa;AACpC,QAAI,gBAAgB,QAAW;AAC7B,6BAAuB,WAAW;AAAA,IACpC,OAAO;AACL,6BAAuB,CAAC,SAAS;AAAA,IACnC;AAAA,EACF;AAEA,WAAS,QAAQ;AACf,kBAAc,EAAE;AAChB,2BAAuB,KAAK;AAAA,EAC9B;AAEA,SAAO;AAAA,IACL,OAAO,EAAE,YAAY,UAAU;AAAA,IAC/B;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,MAAM,kBAAc,gBAAAA,SAAgB,gBAAgB,WAAS,CAAC,MAAM,KAAK,CAAC;AAE1E,IAAO,sBAAQ;",
|
|
6
|
+
"names": ["createContainer"]
|
|
7
7
|
}
|
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
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
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var Shuttle_actions_exports = {};
|
|
23
26
|
__export(Shuttle_actions_exports, {
|
|
@@ -43,7 +46,9 @@ function toggleItemSelection(itemId) {
|
|
|
43
46
|
function navigateTo(item, dest) {
|
|
44
47
|
const hierarchyType = (0, import_helper.getHierarchyTypeName)(dest);
|
|
45
48
|
return (state) => {
|
|
46
|
-
const indexInHierarchy = state[hierarchyType].findIndex(
|
|
49
|
+
const indexInHierarchy = state[hierarchyType].findIndex(
|
|
50
|
+
(hItem) => hItem.id === item.id
|
|
51
|
+
);
|
|
47
52
|
const hierarchy = state[hierarchyType];
|
|
48
53
|
return {
|
|
49
54
|
...state,
|
|
@@ -89,9 +94,14 @@ function addToTarget(itemToAdd, collection) {
|
|
|
89
94
|
function removeFromTarget(itemToRemove) {
|
|
90
95
|
return (state, { idField }) => {
|
|
91
96
|
let targetItems = (0, import_ds_utilities.cloneDeep)(state.targetItems);
|
|
92
|
-
const itemIndex = targetItems.findIndex(
|
|
97
|
+
const itemIndex = targetItems.findIndex(
|
|
98
|
+
(fItem) => fItem.id === itemToRemove.id
|
|
99
|
+
);
|
|
93
100
|
const item = targetItems[itemIndex];
|
|
94
|
-
const children = item?.hasChildren ? (0, import_ds_utilities.compose)(
|
|
101
|
+
const children = item?.hasChildren ? (0, import_ds_utilities.compose)(
|
|
102
|
+
(0, import_helper.filterMovedItems)(state.movedItems),
|
|
103
|
+
import_utils.default.getChildren({ index: itemIndex })
|
|
104
|
+
)(targetItems) || [] : [];
|
|
95
105
|
targetItems.splice(itemIndex, 1);
|
|
96
106
|
if (item?.hasChildren && children.length) {
|
|
97
107
|
const childrenHash = (0, import_ds_utilities.hashArray)(children, "id");
|
|
@@ -99,7 +109,9 @@ function removeFromTarget(itemToRemove) {
|
|
|
99
109
|
}
|
|
100
110
|
return {
|
|
101
111
|
...state,
|
|
102
|
-
movedItems: state.movedItems.filter(
|
|
112
|
+
movedItems: state.movedItems.filter(
|
|
113
|
+
(mItem) => mItem[idField] !== itemToRemove[idField]
|
|
114
|
+
),
|
|
103
115
|
targetItems
|
|
104
116
|
};
|
|
105
117
|
};
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Shuttle.actions.js", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
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": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["utils"]
|
|
7
7
|
}
|
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
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
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var ShuttleContainer_exports = {};
|
|
23
26
|
__export(ShuttleContainer_exports, {
|
|
@@ -32,10 +35,14 @@ var import_helper = require("./helper");
|
|
|
32
35
|
var import_SearchState = require("./SearchState");
|
|
33
36
|
var import_ShuttleState = require("./ShuttleState");
|
|
34
37
|
function filterItemsByTerm(items, term) {
|
|
35
|
-
return items.filter(
|
|
38
|
+
return items.filter(
|
|
39
|
+
(item) => item.name.toLowerCase().indexOf(String(term).toLowerCase()) !== -1 || String(item.id).indexOf(String(term).toLowerCase()) !== -1
|
|
40
|
+
);
|
|
36
41
|
}
|
|
37
42
|
function ShuttleContainer({ items = [], children }) {
|
|
38
|
-
const { state: shuttleState, ...handlers } = (0, import_react.useContext)(
|
|
43
|
+
const { state: shuttleState, ...handlers } = (0, import_react.useContext)(
|
|
44
|
+
import_ShuttleState.ShuttleState.Context
|
|
45
|
+
);
|
|
39
46
|
const { state: searchState } = (0, import_react.useContext)(import_SearchState.SearchState.Context);
|
|
40
47
|
const {
|
|
41
48
|
movedItems,
|
|
@@ -51,10 +58,23 @@ function ShuttleContainer({ items = [], children }) {
|
|
|
51
58
|
moveItem,
|
|
52
59
|
navigate
|
|
53
60
|
} = { ...shuttleState, ...searchState, ...handlers };
|
|
54
|
-
const sourceItems = (0, import_react.useMemo)(
|
|
61
|
+
const sourceItems = (0, import_react.useMemo)(
|
|
62
|
+
() => (0, import_ds_utilities.compose)(
|
|
63
|
+
(items2) => items2.filter((item) => !movedItems[item.id]),
|
|
64
|
+
(items2) => searchTerm && searching ? filterItemsByTerm(items2, searchTerm) : items2,
|
|
65
|
+
(items2) => (0, import_helper.filterItemsByHierarchy)(items2, (0, import_helper.getActiveIdFromHierarchy)(hierarchy).id),
|
|
66
|
+
(items2) => (0, import_helper.prepareItems)(items2)
|
|
67
|
+
)(items),
|
|
68
|
+
[items, searchTerm, searching, hierarchy, movedItems]
|
|
69
|
+
);
|
|
55
70
|
const targetItems = (0, import_react.useMemo)(() => {
|
|
56
71
|
const hierarchyId = (0, import_helper.getActiveIdFromHierarchy)(hierarchyDest).id;
|
|
57
|
-
return (0, import_ds_utilities.compose)(
|
|
72
|
+
return (0, import_ds_utilities.compose)(
|
|
73
|
+
(items2) => (0, import_ds_utilities.sortBy)(items2, ["name"]),
|
|
74
|
+
(items2) => hierarchyId ? (0, import_helper.filterItemsByHierarchy)(items2, hierarchyId).filter(
|
|
75
|
+
(item) => !movedItems[item.id]
|
|
76
|
+
) : (0, import_ds_utilities.uniqBy)((0, import_ds_utilities.values)(movedItems), "id")
|
|
77
|
+
)(items);
|
|
58
78
|
}, [items, searching, hierarchyDest, movedItems]);
|
|
59
79
|
return (0, import_ds_utilities.isFunction)(children) && children({
|
|
60
80
|
checkedItems,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ShuttleContainer.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
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": "
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAoC;AACpC,0BAMO;AACP,2BAA8B;AAC9B,oBAKO;AACP,yBAA4B;AAC5B,0BAA6B;AAE7B,SAAS,kBAAkB,OAAO,MAAM;AACtC,SAAO,MAAM;AAAA,IACX,UACE,KAAK,KAAK,YAAY,EAAE,QAAQ,OAAO,IAAI,EAAE,YAAY,CAAC,MAAM,MAChE,OAAO,KAAK,EAAE,EAAE,QAAQ,OAAO,IAAI,EAAE,YAAY,CAAC,MAAM;AAAA,EAC5D;AACF;AAEA,SAAS,iBAAiB,EAAE,QAAQ,CAAC,GAAG,SAAS,GAAG;AAClD,QAAM,EAAE,OAAO,iBAAiB,SAAS,QAAI;AAAA,IAC3C,iCAAa;AAAA,EACf;AACA,QAAM,EAAE,OAAO,YAAY,QAAI,yBAAW,+BAAY,OAAO;AAC7D,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,EACF,IAAI,EAAE,GAAG,cAAc,GAAG,aAAa,GAAG,SAAS;AAEnD,QAAM,kBAAc;AAAA,IAClB,UACE;AAAA,MACE,CAAAA,WAASA,OAAM,OAAO,UAAQ,CAAC,WAAW,KAAK,GAAG;AAAA,MAClD,CAAAA,WACE,cAAc,YACV,kBAAkBA,QAAO,UAAU,IACnCA;AAAA,MACN,CAAAA,eACE,sCAAuBA,YAAO,wCAAyB,SAAS,EAAE,EAAE;AAAA,MACtE,CAAAA,eAAS,4BAAaA,MAAK;AAAA,IAC7B,EAAE,KAAK;AAAA,IACT,CAAC,OAAO,YAAY,WAAW,WAAW,UAAU;AAAA,EACtD;AAEA,QAAM,kBAAc,sBAAQ,MAAM;AAChC,UAAM,kBAAc,wCAAyB,aAAa,EAAE;AAC5D,eAAO;AAAA,MACL,CAAAA,eAAS,4BAAOA,QAAO,CAAC,MAAM,CAAC;AAAA,MAC/B,CAAAA,WACE,kBACI,sCAAuBA,QAAO,WAAW,EAAE;AAAA,QACzC,UAAQ,CAAC,WAAW,KAAK;AAAA,MAC3B,QACA,gCAAO,4BAAO,UAAU,GAAG,IAAI;AAAA,IACvC,EAAE,KAAK;AAAA,EACT,GAAG,CAAC,OAAO,WAAW,eAAe,UAAU,CAAC;AAEhD,aACE,gCAAW,QAAQ,KACnB,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb,qBAAqB;AAAA,IACrB,mBAAmB;AAAA,IACnB,oBAAoB,MAClB,qBAAiB,4BAAa,cAAc,KAAK,CAAC;AAAA,IACpD,oBAAoB,UAAQ,SAAS,MAAM,KAAK;AAAA,IAChD,oBAAoB,UAAQ,SAAS,MAAM,IAAI;AAAA,IAC/C,sBAAsB,UAAQ,SAAS,MAAM,KAAK;AAAA,IAClD,sBAAsB,UAAQ,SAAS,MAAM,IAAI;AAAA,IACjD;AAAA,IACA;AAAA,EACF,CAAC;AAEL;AAEA,IAAO,+BAAQ,oCAAc,gBAAgB;",
|
|
6
|
+
"names": ["items"]
|
|
7
7
|
}
|
package/dist/cjs/ShuttleImpl.js
CHANGED
|
@@ -17,7 +17,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
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
|
+
));
|
|
21
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
25
|
var ShuttleImpl_exports = {};
|
|
23
26
|
__export(ShuttleImpl_exports, {
|
|
@@ -26,7 +29,8 @@ __export(ShuttleImpl_exports, {
|
|
|
26
29
|
});
|
|
27
30
|
module.exports = __toCommonJS(ShuttleImpl_exports);
|
|
28
31
|
var React = __toESM(require("react"));
|
|
29
|
-
var
|
|
32
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
|
+
var import_react = require("react");
|
|
30
34
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
31
35
|
var import_withProviders = require("./withProviders");
|
|
32
36
|
var import_Shuttle = require("./Shuttle.actions");
|
|
@@ -62,9 +66,12 @@ class ShuttleImpl extends import_react.Component {
|
|
|
62
66
|
this.resetMovedItems = () => {
|
|
63
67
|
const { selectedItems, onRemoveAllFromTarget } = this.props;
|
|
64
68
|
if (!selectedItems) {
|
|
65
|
-
this.setState(
|
|
66
|
-
|
|
67
|
-
|
|
69
|
+
this.setState(
|
|
70
|
+
(0, import_helper.pipe)([(0, import_Shuttle.navigateTo)({ id: null }, true), (0, import_Shuttle.resetMovedItems)()]),
|
|
71
|
+
() => {
|
|
72
|
+
this.handleChange();
|
|
73
|
+
}
|
|
74
|
+
);
|
|
68
75
|
} else {
|
|
69
76
|
this.setState((0, import_helper.pipe)([(0, import_Shuttle.navigateTo)({ id: null }, true)]));
|
|
70
77
|
}
|
|
@@ -95,7 +102,9 @@ class ShuttleImpl extends import_react.Component {
|
|
|
95
102
|
const { onAddCheckedItems, selectedItems, nonSelectedItems } = this.props;
|
|
96
103
|
const { checkedItems, preparedItems } = this.state;
|
|
97
104
|
const isControlledV2 = !!selectedItems && !!nonSelectedItems;
|
|
98
|
-
const checked = isControlledV2 ? nonSelectedItems.filter(
|
|
105
|
+
const checked = isControlledV2 ? nonSelectedItems.filter(
|
|
106
|
+
(item) => checkedItems.some((check) => check === item)
|
|
107
|
+
) : checkedItems;
|
|
99
108
|
const items = (0, import_helper.getItemsById)(checked, preparedItems);
|
|
100
109
|
const actions = !selectedItems ? items.map((item) => (0, import_Shuttle.addToTarget)(item)) : [];
|
|
101
110
|
this.setState((0, import_helper.pipe)([...actions, (0, import_Shuttle.resetCheckedItems)()]), () => {
|
|
@@ -108,8 +117,12 @@ class ShuttleImpl extends import_react.Component {
|
|
|
108
117
|
const { targetItems, hierarchyDest, movedItems } = this.state;
|
|
109
118
|
const hierarchyId = (0, import_helper.getActiveIdFromHierarchy)(hierarchyDest).id;
|
|
110
119
|
const collection = !hierarchyId ? movedItems : targetItems;
|
|
111
|
-
const oldIndex = collection.findIndex(
|
|
112
|
-
|
|
120
|
+
const oldIndex = collection.findIndex(
|
|
121
|
+
(tItem) => tItem[idField] === sourceItem[idField]
|
|
122
|
+
);
|
|
123
|
+
const newIndex = collection.findIndex(
|
|
124
|
+
(tItem) => tItem[idField] === targetItem[idField]
|
|
125
|
+
);
|
|
113
126
|
const sortedMovedItems = !hierarchyId ? (0, import_ds_utilities.arrayMove)(movedItems, oldIndex, newIndex) : movedItems;
|
|
114
127
|
const sortedItems = hierarchyId ? (0, import_ds_utilities.arrayMove)(targetItems, oldIndex, newIndex) : targetItems;
|
|
115
128
|
this.setState({
|
|
@@ -152,22 +165,52 @@ class ShuttleImpl extends import_react.Component {
|
|
|
152
165
|
const handleControlledSourceItms = () => {
|
|
153
166
|
const { id } = (0, import_helper.getActiveIdFromHierarchy)(hierarchy);
|
|
154
167
|
if (id) {
|
|
155
|
-
return (0, import_helper.filterBySearch)(
|
|
168
|
+
return (0, import_helper.filterBySearch)(
|
|
169
|
+
searchTerm,
|
|
170
|
+
searching
|
|
171
|
+
)(
|
|
172
|
+
(0, import_helper.getChildrenFromParent)(id)(
|
|
173
|
+
nonSelectedItems.map((it) => items.find((itt) => itt.id === it))
|
|
174
|
+
)
|
|
175
|
+
);
|
|
156
176
|
}
|
|
157
|
-
return (0, import_helper.filterBySearch)(
|
|
177
|
+
return (0, import_helper.filterBySearch)(
|
|
178
|
+
searchTerm,
|
|
179
|
+
searching
|
|
180
|
+
)(
|
|
181
|
+
items.filter(
|
|
182
|
+
(it) => nonSelectedItems.some(
|
|
183
|
+
(itt) => itt === it.id && !nonSelectedItems.some((ittt) => ittt === it.parent)
|
|
184
|
+
)
|
|
185
|
+
)
|
|
186
|
+
);
|
|
158
187
|
};
|
|
159
188
|
let composedSourceItems;
|
|
160
189
|
if (nonSelectedItems) {
|
|
161
190
|
composedSourceItems = handleControlledSourceItms();
|
|
162
191
|
} else {
|
|
163
|
-
composedSourceItems = (0, import_ds_utilities.compose)(
|
|
192
|
+
composedSourceItems = (0, import_ds_utilities.compose)(
|
|
193
|
+
(0, import_helper.filterBySearch)(searchTerm, searching),
|
|
194
|
+
(0, import_helper.filterMovedItems)(movedItems),
|
|
195
|
+
(0, import_helper.getChildrenFromParent)((0, import_helper.getActiveIdFromHierarchy)(hierarchy).id)
|
|
196
|
+
)(items);
|
|
164
197
|
}
|
|
165
198
|
const handleControlledTargetItms = () => {
|
|
166
199
|
const { id } = (0, import_helper.getActiveIdFromHierarchy)(hierarchyDest);
|
|
167
200
|
if (id) {
|
|
168
|
-
return (0, import_helper.getChildrenFromParent)(
|
|
201
|
+
return (0, import_helper.getChildrenFromParent)(
|
|
202
|
+
(0, import_helper.getActiveIdFromHierarchy)(hierarchyDest).id
|
|
203
|
+
)(
|
|
204
|
+
this.props.selectedItems.map(
|
|
205
|
+
(it) => items.find((itt) => itt.id === it)
|
|
206
|
+
)
|
|
207
|
+
);
|
|
169
208
|
}
|
|
170
|
-
return targetItems.filter(
|
|
209
|
+
return targetItems.filter(
|
|
210
|
+
(it) => this.props.selectedItems.some(
|
|
211
|
+
(itt) => itt === it.id && !this.props.selectedItems.some((ittt) => ittt === it.parent)
|
|
212
|
+
)
|
|
213
|
+
);
|
|
171
214
|
};
|
|
172
215
|
let composedTargetItems;
|
|
173
216
|
if (nonSelectedItems) {
|
|
@@ -175,10 +218,13 @@ class ShuttleImpl extends import_react.Component {
|
|
|
175
218
|
} else {
|
|
176
219
|
composedTargetItems = (0, import_ds_utilities.compose)((tItems) => {
|
|
177
220
|
const hierarchyId = (0, import_helper.getActiveIdFromHierarchy)(hierarchyDest).id;
|
|
178
|
-
return hierarchyId ? (0, import_ds_utilities.compose)(
|
|
221
|
+
return hierarchyId ? (0, import_ds_utilities.compose)(
|
|
222
|
+
(0, import_helper.filterMovedItems)(movedItems),
|
|
223
|
+
(0, import_helper.getChildrenFromParent)(hierarchyId)
|
|
224
|
+
)(tItems) : movedItems;
|
|
179
225
|
})(targetItems);
|
|
180
226
|
}
|
|
181
|
-
return /* @__PURE__ */
|
|
227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ShuttleRenderer.ShuttleRenderer, {
|
|
182
228
|
...rest,
|
|
183
229
|
moreItemsLoading,
|
|
184
230
|
checkedItems,
|