@elliemae/ds-shuttle 3.16.0 → 3.16.1
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 +5 -3
- package/dist/cjs/AnimationState.js.map +2 -2
- package/dist/cjs/DSShuttle.js +44 -2
- package/dist/cjs/DSShuttle.js.map +2 -2
- package/dist/cjs/SearchState.js +4 -0
- package/dist/cjs/SearchState.js.map +2 -2
- package/dist/cjs/Shuttle.actions.js +6 -2
- package/dist/cjs/Shuttle.actions.js.map +3 -3
- package/dist/cjs/ShuttleContainer.js +8 -4
- package/dist/cjs/ShuttleContainer.js.map +2 -2
- package/dist/cjs/ShuttleImpl.js +32 -55
- package/dist/cjs/ShuttleImpl.js.map +2 -2
- package/dist/cjs/ShuttleRenderer.js +15 -19
- package/dist/cjs/ShuttleRenderer.js.map +2 -2
- package/dist/cjs/ShuttleState.js +8 -8
- package/dist/cjs/ShuttleState.js.map +2 -2
- package/dist/cjs/animation/animationConfig.js +4 -0
- package/dist/cjs/animation/animationConfig.js.map +2 -2
- package/dist/cjs/classedComponents.js +6 -2
- package/dist/cjs/classedComponents.js.map +2 -2
- package/dist/cjs/components/LoadingIndicator.js +4 -0
- package/dist/cjs/components/LoadingIndicator.js.map +1 -1
- package/dist/cjs/components/OverflowList.js +6 -2
- package/dist/cjs/components/OverflowList.js.map +2 -2
- package/dist/cjs/components/ShuttleBreadcrumb.js +7 -3
- package/dist/cjs/components/ShuttleBreadcrumb.js.map +2 -2
- package/dist/cjs/components/ShuttleInfiniteScrollIndicator.js +4 -0
- package/dist/cjs/components/ShuttleInfiniteScrollIndicator.js.map +1 -1
- package/dist/cjs/components/ShuttleListItem/ActionButtons.js +4 -0
- package/dist/cjs/components/ShuttleListItem/ActionButtons.js.map +1 -1
- package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js +30 -23
- package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js.map +2 -2
- package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +11 -9
- package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js.map +2 -2
- package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +10 -8
- package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js.map +2 -2
- package/dist/cjs/components/ShuttleListPanel.js +6 -4
- package/dist/cjs/components/ShuttleListPanel.js.map +2 -2
- package/dist/cjs/components/ShuttleSearchBox.js +4 -0
- package/dist/cjs/components/ShuttleSearchBox.js.map +1 -1
- package/dist/cjs/components/ShuttleSource.js +19 -14
- package/dist/cjs/components/ShuttleSource.js.map +2 -2
- package/dist/cjs/components/ShuttleTarget.js +14 -10
- package/dist/cjs/components/ShuttleTarget.js.map +2 -2
- package/dist/cjs/components/VirtualizedItem.js +17 -16
- package/dist/cjs/components/VirtualizedItem.js.map +2 -2
- package/dist/cjs/components/VirtualizedList.js +26 -30
- package/dist/cjs/components/VirtualizedList.js.map +2 -2
- package/dist/cjs/components/VirtualizedSortableList.js +7 -5
- package/dist/cjs/components/VirtualizedSortableList.js.map +2 -2
- package/dist/cjs/helper.js +4 -0
- package/dist/cjs/helper.js.map +2 -2
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/package.json +7 -0
- package/dist/cjs/tests/utils.js +5 -3
- package/dist/cjs/tests/utils.js.map +2 -2
- package/dist/cjs/updateShuttleStateFromProps.js +13 -10
- package/dist/cjs/updateShuttleStateFromProps.js.map +2 -2
- package/dist/cjs/utils.js +5 -1
- package/dist/cjs/utils.js.map +2 -2
- package/dist/cjs/withProviders.js +10 -4
- package/dist/cjs/withProviders.js.map +2 -2
- package/dist/esm/AnimationState.js +1 -3
- package/dist/esm/AnimationState.js.map +2 -2
- package/dist/esm/DSShuttle.js +40 -2
- package/dist/esm/DSShuttle.js.map +2 -2
- package/dist/esm/SearchState.js.map +2 -2
- package/dist/esm/Shuttle.actions.js +2 -2
- package/dist/esm/Shuttle.actions.js.map +3 -3
- package/dist/esm/ShuttleContainer.js +4 -4
- package/dist/esm/ShuttleContainer.js.map +2 -2
- package/dist/esm/ShuttleImpl.js +20 -47
- package/dist/esm/ShuttleImpl.js.map +2 -2
- package/dist/esm/ShuttleRenderer.js +11 -19
- package/dist/esm/ShuttleRenderer.js.map +2 -2
- package/dist/esm/ShuttleState.js +4 -8
- package/dist/esm/ShuttleState.js.map +2 -2
- package/dist/esm/animation/animationConfig.js.map +2 -2
- package/dist/esm/classedComponents.js +2 -2
- package/dist/esm/classedComponents.js.map +1 -1
- package/dist/esm/components/OverflowList.js +2 -2
- package/dist/esm/components/OverflowList.js.map +1 -1
- package/dist/esm/components/ShuttleBreadcrumb.js +3 -3
- package/dist/esm/components/ShuttleBreadcrumb.js.map +2 -2
- package/dist/esm/components/ShuttleListItem/ShuttleListItem.js +26 -23
- package/dist/esm/components/ShuttleListItem/ShuttleListItem.js.map +2 -2
- package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js +7 -9
- package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js.map +2 -2
- package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js +6 -8
- package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js.map +2 -2
- package/dist/esm/components/ShuttleListPanel.js +2 -4
- package/dist/esm/components/ShuttleListPanel.js.map +2 -2
- package/dist/esm/components/ShuttleSource.js +15 -14
- package/dist/esm/components/ShuttleSource.js.map +2 -2
- package/dist/esm/components/ShuttleTarget.js +10 -10
- package/dist/esm/components/ShuttleTarget.js.map +2 -2
- package/dist/esm/components/VirtualizedItem.js +13 -16
- package/dist/esm/components/VirtualizedItem.js.map +2 -2
- package/dist/esm/components/VirtualizedList.js +22 -30
- package/dist/esm/components/VirtualizedList.js.map +2 -2
- package/dist/esm/components/VirtualizedSortableList.js +3 -5
- package/dist/esm/components/VirtualizedSortableList.js.map +2 -2
- package/dist/esm/helper.js.map +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/package.json +7 -0
- package/dist/esm/tests/utils.js +1 -3
- package/dist/esm/tests/utils.js.map +2 -2
- package/dist/esm/updateShuttleStateFromProps.js +7 -8
- package/dist/esm/updateShuttleStateFromProps.js.map +2 -2
- package/dist/esm/utils.js +1 -1
- package/dist/esm/utils.js.map +2 -2
- package/dist/esm/withProviders.js +6 -4
- package/dist/esm/withProviders.js.map +2 -2
- package/dist/types/DSShuttle.d.ts +38 -38
- package/dist/types/Shuttle.actions.d.ts +7 -7
- package/dist/types/ShuttleRenderer.d.ts +2 -2
- package/dist/types/ShuttleState.d.ts +1 -1
- package/dist/types/components/ShuttleBreadcrumb.d.ts +2 -2
- package/dist/types/components/ShuttleListItem/ShuttleListItem.d.ts +2 -2
- package/dist/types/components/ShuttleListItem/ShuttleSourceListItem.d.ts +2 -2
- package/dist/types/components/ShuttleListItem/ShuttleTargetListItem.d.ts +2 -2
- package/dist/types/components/ShuttleListPanel.d.ts +2 -2
- package/dist/types/components/ShuttleSource.d.ts +27 -28
- package/dist/types/components/ShuttleTarget.d.ts +2 -2
- package/dist/types/components/VirtualizedList.d.ts +2 -2
- package/dist/types/components/VirtualizedSortableList.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/package.json +20 -19
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -77,8 +81,6 @@ function useShuttleAnimationState() {
|
|
|
77
81
|
reset
|
|
78
82
|
};
|
|
79
83
|
}
|
|
80
|
-
const AnimationState = (0, import_constate.default)(useShuttleAnimationState, (value) => [
|
|
81
|
-
value.state
|
|
82
|
-
]);
|
|
84
|
+
const AnimationState = (0, import_constate.default)(useShuttleAnimationState, (value) => [value.state]);
|
|
83
85
|
var AnimationState_default = AnimationState;
|
|
84
86
|
//# sourceMappingURL=AnimationState.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 => [
|
|
5
|
-
"mappings": "
|
|
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) => [value.state]);\n\nexport { AnimationState };\nexport default AnimationState;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
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,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;AAGzF,IAAO,yBAAQ;",
|
|
6
6
|
"names": ["createContainer"]
|
|
7
7
|
}
|
package/dist/cjs/DSShuttle.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -35,8 +39,8 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
35
39
|
var import_lodash = require("lodash");
|
|
36
40
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
37
41
|
var import_ds_truncated_tooltip_text = require("@elliemae/ds-truncated-tooltip-text");
|
|
38
|
-
var import_ShuttleImpl = require("./ShuttleImpl");
|
|
39
|
-
var import_utils = __toESM(require("./utils"));
|
|
42
|
+
var import_ShuttleImpl = require("./ShuttleImpl.js");
|
|
43
|
+
var import_utils = __toESM(require("./utils.js"));
|
|
40
44
|
const noop = () => {
|
|
41
45
|
};
|
|
42
46
|
const DSShuttle = ({
|
|
@@ -46,6 +50,8 @@ const DSShuttle = ({
|
|
|
46
50
|
showIcons = true,
|
|
47
51
|
items = [],
|
|
48
52
|
selectedItems = void 0,
|
|
53
|
+
// if defined it becomes controlled (v1)
|
|
54
|
+
// TODO make `nonSelectedItems` the default controlled behavior (v2)
|
|
49
55
|
nonSelectedItems = void 0,
|
|
50
56
|
onSearch = noop,
|
|
51
57
|
onSearchOpen = noop,
|
|
@@ -120,10 +126,15 @@ const DSShuttle = ({
|
|
|
120
126
|
}
|
|
121
127
|
) });
|
|
122
128
|
const props = {
|
|
129
|
+
/** inject props to shuttle wrapper */
|
|
123
130
|
containerProps: import_ds_props_helpers.PropTypes.object.description("inject props to shuttle wrapper"),
|
|
131
|
+
/** The identifier field for the item object */
|
|
124
132
|
idField: import_ds_props_helpers.PropTypes.string.description("The identifier field for the item object"),
|
|
133
|
+
/** The parent identifier field for the item object */
|
|
125
134
|
parentIdField: import_ds_props_helpers.PropTypes.string.description("The parent identifier field for the item object"),
|
|
135
|
+
/** Whether to show the icons or not */
|
|
126
136
|
showIcons: import_ds_props_helpers.PropTypes.string.description("Whether to show the icons or not"),
|
|
137
|
+
/** List of items */
|
|
127
138
|
items: import_ds_props_helpers.PropTypes.arrayOf(
|
|
128
139
|
import_ds_props_helpers.PropTypes.shape({
|
|
129
140
|
disableDrillDown: import_ds_props_helpers.PropTypes.bool,
|
|
@@ -133,46 +144,77 @@ const props = {
|
|
|
133
144
|
description: import_ds_props_helpers.PropTypes.string
|
|
134
145
|
})
|
|
135
146
|
).description("list of items"),
|
|
147
|
+
/** Array of item ids that are selected. If passed the component behaves as controlled */
|
|
136
148
|
selectedItems: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.string).description(
|
|
137
149
|
"Array of item ids that are selected. If passed the component behaves as controlled"
|
|
138
150
|
),
|
|
151
|
+
/** Array of item ids that aren't selected. Should include ALL non selected items, even those not rendered */
|
|
139
152
|
nonSelectedItems: import_ds_props_helpers.PropTypes.arrayOf(import_ds_props_helpers.PropTypes.string).description(
|
|
140
153
|
"Array of item ids that aren't selected.. Should include ALL non selected items, even those not rendered"
|
|
141
154
|
),
|
|
155
|
+
/** Handler on search */
|
|
142
156
|
onSearch: import_ds_props_helpers.PropTypes.func.description("Handler on search"),
|
|
157
|
+
/** Handler when the searchbox is visible */
|
|
143
158
|
onSearchOpen: import_ds_props_helpers.PropTypes.func.description("Handler when the searchbox is visible"),
|
|
159
|
+
/** Handler when the searchbox is not visible */
|
|
144
160
|
onSearchClose: import_ds_props_helpers.PropTypes.func.description("Handler when the searchbox is not visible"),
|
|
161
|
+
/** Source handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down") */
|
|
145
162
|
onDrillDown: import_ds_props_helpers.PropTypes.func.description(
|
|
146
163
|
'Source handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down")'
|
|
147
164
|
),
|
|
165
|
+
/** Target handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down") */
|
|
148
166
|
onDrillDownTarget: import_ds_props_helpers.PropTypes.func.description(
|
|
149
167
|
'Target handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down")'
|
|
150
168
|
),
|
|
169
|
+
/** Target handler when user stops dragging an item */
|
|
151
170
|
onTargetSortEnd: import_ds_props_helpers.PropTypes.func.description("Target handler when user stops dragging an item"),
|
|
171
|
+
/** Callback function that gets more items for Infinite Scroll */
|
|
152
172
|
onGetMoreItems: import_ds_props_helpers.PropTypes.func.description("Callback function that gets more items for Infinite Scroll"),
|
|
173
|
+
/** Wheter there are mor items loading for Infinite Scroll */
|
|
153
174
|
moreItemsLoading: import_ds_props_helpers.PropTypes.bool.description("Wheter there are mor items loading for Infinite Scroll"),
|
|
175
|
+
/** Wheter there is a next page for Infinite Scroll, controls when to trigger onGetMoreItems */
|
|
154
176
|
hasNextPage: import_ds_props_helpers.PropTypes.bool.description(
|
|
155
177
|
"Wheter there is a next page for Infinite Scroll, controls when to trigger onGetMoreItems"
|
|
156
178
|
),
|
|
179
|
+
/** Function that takes as a parameter an internal getter for the state */
|
|
157
180
|
setGetStatus: import_ds_props_helpers.PropTypes.func.description("Function that takes as a parameter an internal getter for the state"),
|
|
181
|
+
/** Whether the target can be sortable with DnD */
|
|
158
182
|
targetSortable: import_ds_props_helpers.PropTypes.bool.description("Whether the target can be sortable with DnD"),
|
|
183
|
+
/** Handler when the searchbox is visible */
|
|
159
184
|
sourceRootTitle: import_ds_props_helpers.PropTypes.string.description("Handler when the searchbox is visible"),
|
|
185
|
+
/** Source text when there is no items */
|
|
160
186
|
sourceEmptyMessage: import_ds_props_helpers.PropTypes.string.description("Source text when there is no items"),
|
|
187
|
+
/** Target text when there is no items */
|
|
161
188
|
targetEmptyMessage: import_ds_props_helpers.PropTypes.string.description("Target text when there is no items"),
|
|
189
|
+
/** Target text for the first hierarchy item */
|
|
162
190
|
targetRootTitle: import_ds_props_helpers.PropTypes.string.description("Target text for the first hierarchy item"),
|
|
191
|
+
/** Function that allow to compose the item props in the source */
|
|
163
192
|
composeSourceItemProps: import_ds_props_helpers.PropTypes.func.description("Function that allow to compose the item props in the source"),
|
|
193
|
+
/** Function that allow to compose the item props in the target */
|
|
164
194
|
composeTargetItemProps: import_ds_props_helpers.PropTypes.func.description("Function that allow to compose the item props in the target"),
|
|
195
|
+
/** Handler when a users moves an item to the target */
|
|
165
196
|
onAddToTarget: import_ds_props_helpers.PropTypes.func.description("Handler when a users moves an item to the target"),
|
|
197
|
+
/** Handler when a users moves all the 'checked' items to the target */
|
|
166
198
|
onAddCheckedItems: import_ds_props_helpers.PropTypes.func.description("Handler when a users moves all the 'checked' items to the target"),
|
|
199
|
+
/** Handler when a user removes an item from the target */
|
|
167
200
|
onRemoveFromTarget: import_ds_props_helpers.PropTypes.func.description("Handler when a user removes an item from the target"),
|
|
201
|
+
/** Handler when a user removes all the items from the target */
|
|
168
202
|
onRemoveAllFromTarget: import_ds_props_helpers.PropTypes.func.description("Handler when a user removes all the items from the target"),
|
|
203
|
+
/** Handler for every change on the state */
|
|
169
204
|
onChange: import_ds_props_helpers.PropTypes.func.description("Handler for every change on the state"),
|
|
205
|
+
/** Function that returns an element for the source counter */
|
|
170
206
|
renderSourceCounter: import_ds_props_helpers.PropTypes.func.description("Function that returns an element for the source counter"),
|
|
207
|
+
/** Function that returns an element for the target counter */
|
|
171
208
|
renderTargetCounter: import_ds_props_helpers.PropTypes.func.description("Function that returns an element for the target counter"),
|
|
209
|
+
/** Source text for the clear items button */
|
|
172
210
|
sourceClearItemsText: import_ds_props_helpers.PropTypes.string.description("Source text for the clear items button"),
|
|
211
|
+
/** Target text for the clear items button */
|
|
173
212
|
targetClearItemsText: import_ds_props_helpers.PropTypes.string.description("Target text for the clear items button"),
|
|
213
|
+
/** Searchbox placeholder */
|
|
174
214
|
searchPlaceholder: import_ds_props_helpers.PropTypes.string.description("Searchbox placeholder"),
|
|
215
|
+
/** Displays loading indicator on source section */
|
|
175
216
|
loadingSource: import_ds_props_helpers.PropTypes.bool.description("Displays loading indicator on source section"),
|
|
217
|
+
/** Displays loading indicator on target section */
|
|
176
218
|
loadingTarget: import_ds_props_helpers.PropTypes.bool.description("Displays loading indicator on target section")
|
|
177
219
|
};
|
|
178
220
|
DSShuttle.propTypes = props;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 '@elliemae/ds-props-helpers';\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": "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\nimport React from 'react';\nimport { debounce } from 'lodash';\nimport { describe, PropTypes } from '@elliemae/ds-props-helpers';\nimport { TooltipTextProvider } from '@elliemae/ds-truncated-tooltip-text';\nimport { ShuttleImpl } from './ShuttleImpl.js';\nimport utils from './utils.js';\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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAAA;AAAA;AAAA;ACAA,YAAuB;ADkDnB;AAhDJ,oBAAyB;AACzB,8BAAoC;AACpC,uCAAoC;AACpC,yBAA4B;AAC5B,mBAAkB;AAElB,MAAM,OAAO,MAAM;AAAC;AAEpB,MAAM,YAAY,CAAC;AAAA,EACjB,iBAAiB,CAAC;AAAA,EAClB,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,QAAQ,CAAC;AAAA,EACT,gBAAgB;AAAA;AAAA;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,OAAO,CAAC;AAAA,EACjC,yBAAyB,OAAO,CAAC;AAAA,EACjC,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,qBAAqB;AAAA,EACrB,wBAAwB;AAAA,EACxB,WAAW;AAAA,EACX,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,EACtB,uBAAuB;AAAA,EACvB,uBA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U,KAAK,YAAY,uCAAuC;AAAA;AAAA,EAE5E,qBAAqB,kCAAU,KAAK,YAAY,yDAAyD;AAAA;AAAA,EAEzG,qBAAqB,kCAAU,KAAK,YAAY,yDAAyD;AAAA;AAAA,EAEzG,sBAAsB,kCAAU,OAAO,YAAY,wCAAwC;AAAA;AAAA,EAE3F,sBAAsB,kCAAU,OAAO,YAAY,wCAAwC;AAAA;AAAA,EAE3F,mBAAmB,kCAAU,OAAO,YAAY,uBAAuB;AAAA;AAAA,EAEvE,eAAe,kCAAU,KAAK,YAAY,8CAA8C;AAAA;AAAA,EAExF,eAAe,kCAAU,KAAK,YAAY,8CAA8C;AAC1F;AAEA,UAAU,YAAY;AACtB,UAAU,cAAc;AACxB,MAAM,0BAAsB,kCAAS,SAAS;AAC9C,oBAAoB,YAAY;AAIhC,IAAO,oBAAQ;",
|
|
6
6
|
"names": ["utils"]
|
|
7
7
|
}
|
package/dist/cjs/SearchState.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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": "
|
|
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;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,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;AAE5E,IAAO,sBAAQ;",
|
|
6
6
|
"names": ["createContainer"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -35,8 +39,8 @@ __export(Shuttle_actions_exports, {
|
|
|
35
39
|
module.exports = __toCommonJS(Shuttle_actions_exports);
|
|
36
40
|
var React = __toESM(require("react"));
|
|
37
41
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
38
|
-
var import_helper = require("./helper");
|
|
39
|
-
var import_utils = __toESM(require("./utils"));
|
|
42
|
+
var import_helper = require("./helper.js");
|
|
43
|
+
var import_utils = __toESM(require("./utils.js"));
|
|
40
44
|
function toggleItemSelection(itemId) {
|
|
41
45
|
return (state) => ({
|
|
42
46
|
...state,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/Shuttle.actions.
|
|
4
|
-
"sourcesContent": ["import { addOrRemove, cloneDeep, hashArray, compose } from '@elliemae/ds-utilities';\nimport { getHierarchyTypeName, toggleInObject, filterMovedItems } from './helper';\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((hItem) => hItem.id === item.id);\n const hierarchy = state[hierarchyType];\n return {\n ...state,\n [hierarchyType]: indexInHierarchy !== -1 ? hierarchy.slice(0, indexInHierarchy + 1) : [...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 ? compose(utils.getChildren({ index: itemIndex }))(collection) || [] : [];\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((fItem) => fItem.id === itemToRemove.id);\n\n const item = targetItems[itemIndex];\n const children = item?.hasChildren\n ? compose(filterMovedItems(state.movedItems), utils.getChildren({ index: itemIndex }))(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((mItem) => mItem[idField] !== itemToRemove[idField]),\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": "
|
|
3
|
+
"sources": ["../../src/Shuttle.actions.ts", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { addOrRemove, cloneDeep, hashArray, compose } from '@elliemae/ds-utilities';\nimport { getHierarchyTypeName, toggleInObject, filterMovedItems } from './helper.js';\nimport utils from './utils.js';\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((hItem) => hItem.id === item.id);\n const hierarchy = state[hierarchyType];\n return {\n ...state,\n [hierarchyType]: indexInHierarchy !== -1 ? hierarchy.slice(0, indexInHierarchy + 1) : [...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 ? compose(utils.getChildren({ index: itemIndex }))(collection) || [] : [];\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((fItem) => fItem.id === itemToRemove.id);\n\n const item = targetItems[itemIndex];\n const children = item?.hasChildren\n ? compose(filterMovedItems(state.movedItems), utils.getChildren({ index: itemIndex }))(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((mItem) => mItem[idField] !== itemToRemove[idField]),\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;AAAA;ACAA,YAAuB;ADAvB,0BAA2D;AAC3D,oBAAuE;AACvE,mBAAkB;AAEX,SAAS,oBAAoB,QAAQ;AAC1C,SAAO,CAAC,WAAW;AAAA,IACjB,GAAG;AAAA,IACH,kBAAc,iCAAY,MAAM,cAAc,MAAM;AAAA,EACtD;AACF;AACO,SAAS,WAAW,MAAM,MAAM;AACrC,QAAM,oBAAgB,oCAAqB,IAAI;AAC/C,SAAO,CAAC,UAAU;AAChB,UAAM,mBAAmB,MAAM,aAAa,EAAE,UAAU,CAAC,UAAU,MAAM,OAAO,KAAK,EAAE;AACvF,UAAM,YAAY,MAAM,aAAa;AACrC,W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E,QAAQ,MAAM;AAC7B,QAAI,kBAAc,+BAAU,MAAM,WAAW;AAE7C,UAAM,YAAY,YAAY,UAAU,CAAC,UAAU,MAAM,OAAO,aAAa,EAAE;AAE/E,UAAM,OAAO,YAAY,SAAS;AAClC,UAAM,WAAW,MAAM,kBACnB,iCAAQ,gCAAiB,MAAM,UAAU,GAAG,aAAAA,QAAM,YAAY,EAAE,OAAO,UAAU,CAAC,CAAC,EAAE,WAAW,KAAK,CAAC,IACtG,CAAC;AAEL,gBAAY,OAAO,WAAW,CAAC;AAC/B,QAAI,MAAM,eAAe,SAAS,QAAQ;AACxC,YAAM,mBAAe,+BAAU,UAAU,IAAI;AAC7C,oBAAc,YAAY,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,EAAE,CAAC;AAAA,IAC7D;AAEA,WAAO;AAAA,MACL,GAAG;AAAA,MACH,YAAY,MAAM,WAAW,OAAO,CAAC,UAAU,MAAM,OAAO,MAAM,aAAa,OAAO,CAAC;AAAA,MACvF;AAAA,IACF;AAAA,EACF;AACF;AAEO,SAAS,oBAAoB;AAClC,SAAO,CAAC,WAAW;AAAA,IACjB,GAAG;AAAA,IACH,cAAc,CAAC;AAAA,EACjB;AACF;AACO,SAAS,kBAAkB;AAChC,SAAO,CAAC,WAAW;AAAA,IACjB,GAAG;AAAA,IACH,YAAY,CAAC;AAAA,IACb,aAAa,CAAC;AAAA,EAChB;AACF;",
|
|
6
6
|
"names": ["utils"]
|
|
7
7
|
}
|
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -30,10 +34,10 @@ module.exports = __toCommonJS(ShuttleContainer_exports);
|
|
|
30
34
|
var React = __toESM(require("react"));
|
|
31
35
|
var import_react = require("react");
|
|
32
36
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
33
|
-
var import_withProviders = require("./withProviders");
|
|
34
|
-
var import_helper = require("./helper");
|
|
35
|
-
var import_SearchState = require("./SearchState");
|
|
36
|
-
var import_ShuttleState = require("./ShuttleState");
|
|
37
|
+
var import_withProviders = require("./withProviders.js");
|
|
38
|
+
var import_helper = require("./helper.js");
|
|
39
|
+
var import_SearchState = require("./SearchState.js");
|
|
40
|
+
var import_ShuttleState = require("./ShuttleState.js");
|
|
37
41
|
function filterItemsByTerm(items, term) {
|
|
38
42
|
return items.filter(
|
|
39
43
|
(item) => item.name.toLowerCase().indexOf(String(term).toLowerCase()) !== -1 || String(item.id).indexOf(String(term).toLowerCase()) !== -1
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ShuttleContainer.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable no-shadow */\nimport { useContext, useMemo } from 'react';\nimport { isFunction, compose, uniqBy, values, sortBy } from '@elliemae/ds-utilities';\nimport { withProviders } from './withProviders';\nimport { prepareItems, getActiveIdFromHierarchy, filterItemsByHierarchy, getItemsById } 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(ShuttleState.Context);\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) => (searchTerm && searching ? filterItemsByTerm(items, searchTerm) : items),\n (items) => 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((item) => !movedItems[item.id])\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: () => 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": "
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-shadow */\nimport { useContext, useMemo } from 'react';\nimport { isFunction, compose, uniqBy, values, sortBy } from '@elliemae/ds-utilities';\nimport { withProviders } from './withProviders.js';\nimport { prepareItems, getActiveIdFromHierarchy, filterItemsByHierarchy, getItemsById } from './helper.js';\nimport { SearchState } from './SearchState.js';\nimport { ShuttleState } from './ShuttleState.js';\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(ShuttleState.Context);\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) => (searchTerm && searching ? filterItemsByTerm(items, searchTerm) : items),\n (items) => 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((item) => !movedItems[item.id])\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: () => 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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MAAM;AAChC,UAAM,kBAAc,wCAAyB,aAAa,EAAE;AAC5D,eAAO;AAAA,MACL,CAACA,eAAU,4BAAOA,QAAO,CAAC,MAAM,CAAC;AAAA,MACjC,CAACA,WACC,kBACI,sCAAuBA,QAAO,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,WAAW,KAAK,EAAE,CAAC,QAChF,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,MAAM,qBAAiB,4BAAa,cAAc,KAAK,CAAC;AAAA,IAC5E,oBAAoB,CAAC,SAAS,SAAS,MAAM,KAAK;AAAA,IAClD,oBAAoB,CAAC,SAAS,SAAS,MAAM,IAAI;AAAA,IACjD,sBAAsB,CAAC,SAAS,SAAS,MAAM,KAAK;AAAA,IACpD,sBAAsB,CAAC,SAAS,SAAS,MAAM,IAAI;AAAA,IACnD;AAAA,IACA;AAAA,EACF,CAAC;AAEL;AAEA,IAAO,+BAAQ,oCAAc,gBAAgB;",
|
|
6
6
|
"names": ["items"]
|
|
7
7
|
}
|
package/dist/cjs/ShuttleImpl.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -32,12 +36,12 @@ var React = __toESM(require("react"));
|
|
|
32
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
37
|
var import_react = require("react");
|
|
34
38
|
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
35
|
-
var import_withProviders = require("./withProviders");
|
|
36
|
-
var
|
|
37
|
-
var import_helper = require("./helper");
|
|
38
|
-
var import_ShuttleRenderer = require("./ShuttleRenderer");
|
|
39
|
-
var import_SearchState = require("./SearchState");
|
|
40
|
-
var import_updateShuttleStateFromProps = require("./updateShuttleStateFromProps");
|
|
39
|
+
var import_withProviders = require("./withProviders.js");
|
|
40
|
+
var import_Shuttle_actions = require("./Shuttle.actions.js");
|
|
41
|
+
var import_helper = require("./helper.js");
|
|
42
|
+
var import_ShuttleRenderer = require("./ShuttleRenderer.js");
|
|
43
|
+
var import_SearchState = require("./SearchState.js");
|
|
44
|
+
var import_updateShuttleStateFromProps = require("./updateShuttleStateFromProps.js");
|
|
41
45
|
class ShuttleImpl extends import_react.Component {
|
|
42
46
|
constructor(props) {
|
|
43
47
|
super(props);
|
|
@@ -58,29 +62,26 @@ class ShuttleImpl extends import_react.Component {
|
|
|
58
62
|
onDrillDownTarget(item, direction);
|
|
59
63
|
const { reset: resetSearchState } = this.context;
|
|
60
64
|
resetSearchState();
|
|
61
|
-
this.setState((0, import_helper.pipe)([(0,
|
|
65
|
+
this.setState((0, import_helper.pipe)([(0, import_Shuttle_actions.navigateTo)(item, dest), (0, import_Shuttle_actions.resetCheckedItems)()]));
|
|
62
66
|
};
|
|
63
67
|
this.resetCheckedItems = () => {
|
|
64
|
-
this.setState((0,
|
|
68
|
+
this.setState((0, import_Shuttle_actions.resetCheckedItems)());
|
|
65
69
|
};
|
|
66
70
|
this.resetMovedItems = () => {
|
|
67
71
|
const { selectedItems, onRemoveAllFromTarget } = this.props;
|
|
68
72
|
if (!selectedItems) {
|
|
69
|
-
this.setState(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
this.handleChange();
|
|
73
|
-
}
|
|
74
|
-
);
|
|
73
|
+
this.setState((0, import_helper.pipe)([(0, import_Shuttle_actions.navigateTo)({ id: null }, true), (0, import_Shuttle_actions.resetMovedItems)()]), () => {
|
|
74
|
+
this.handleChange();
|
|
75
|
+
});
|
|
75
76
|
} else {
|
|
76
|
-
this.setState((0, import_helper.pipe)([(0,
|
|
77
|
+
this.setState((0, import_helper.pipe)([(0, import_Shuttle_actions.navigateTo)({ id: null }, true)]));
|
|
77
78
|
}
|
|
78
79
|
onRemoveAllFromTarget();
|
|
79
80
|
};
|
|
80
81
|
this.addToTarget = (item) => {
|
|
81
82
|
const { selectedItems, onAddToTarget } = this.props;
|
|
82
83
|
if (!selectedItems) {
|
|
83
|
-
this.setState((0, import_helper.pipe)([(0,
|
|
84
|
+
this.setState((0, import_helper.pipe)([(0, import_Shuttle_actions.addToTarget)(item), (0, import_Shuttle_actions.resetCheckedItems)()]), () => {
|
|
84
85
|
this.handleChange();
|
|
85
86
|
});
|
|
86
87
|
}
|
|
@@ -89,25 +90,23 @@ class ShuttleImpl extends import_react.Component {
|
|
|
89
90
|
this.removeFromTarget = (item) => {
|
|
90
91
|
const { selectedItems, onRemoveFromTarget } = this.props;
|
|
91
92
|
if (!selectedItems) {
|
|
92
|
-
this.setState((0, import_helper.pipe)([(0,
|
|
93
|
+
this.setState((0, import_helper.pipe)([(0, import_Shuttle_actions.removeFromTarget)(item)]), () => {
|
|
93
94
|
this.handleChange();
|
|
94
95
|
});
|
|
95
96
|
}
|
|
96
97
|
onRemoveFromTarget(item);
|
|
97
98
|
};
|
|
98
99
|
this.toggleItemSelection = (item) => {
|
|
99
|
-
this.setState((0,
|
|
100
|
+
this.setState((0, import_Shuttle_actions.toggleItemSelection)(item.id));
|
|
100
101
|
};
|
|
101
102
|
this.moveCheckedItems = () => {
|
|
102
103
|
const { onAddCheckedItems, selectedItems, nonSelectedItems } = this.props;
|
|
103
104
|
const { checkedItems, preparedItems } = this.state;
|
|
104
105
|
const isControlledV2 = !!selectedItems && !!nonSelectedItems;
|
|
105
|
-
const checked = isControlledV2 ? nonSelectedItems.filter(
|
|
106
|
-
(item) => checkedItems.some((check) => check === item)
|
|
107
|
-
) : checkedItems;
|
|
106
|
+
const checked = isControlledV2 ? nonSelectedItems.filter((item) => checkedItems.some((check) => check === item)) : checkedItems;
|
|
108
107
|
const items = (0, import_helper.getItemsById)(checked, preparedItems);
|
|
109
|
-
const actions = !selectedItems ? items.map((item) => (0,
|
|
110
|
-
this.setState((0, import_helper.pipe)([...actions, (0,
|
|
108
|
+
const actions = !selectedItems ? items.map((item) => (0, import_Shuttle_actions.addToTarget)(item)) : [];
|
|
109
|
+
this.setState((0, import_helper.pipe)([...actions, (0, import_Shuttle_actions.resetCheckedItems)()]), () => {
|
|
111
110
|
this.handleChange();
|
|
112
111
|
});
|
|
113
112
|
onAddCheckedItems(items);
|
|
@@ -117,12 +116,8 @@ class ShuttleImpl extends import_react.Component {
|
|
|
117
116
|
const { targetItems, hierarchyDest, movedItems } = this.state;
|
|
118
117
|
const hierarchyId = (0, import_helper.getActiveIdFromHierarchy)(hierarchyDest).id;
|
|
119
118
|
const collection = !hierarchyId ? movedItems : targetItems;
|
|
120
|
-
const oldIndex = collection.findIndex(
|
|
121
|
-
|
|
122
|
-
);
|
|
123
|
-
const newIndex = collection.findIndex(
|
|
124
|
-
(tItem) => tItem[idField] === targetItem[idField]
|
|
125
|
-
);
|
|
119
|
+
const oldIndex = collection.findIndex((tItem) => tItem[idField] === sourceItem[idField]);
|
|
120
|
+
const newIndex = collection.findIndex((tItem) => tItem[idField] === targetItem[idField]);
|
|
126
121
|
const sortedMovedItems = !hierarchyId ? (0, import_ds_utilities.arrayMove)(movedItems, oldIndex, newIndex) : movedItems;
|
|
127
122
|
const sortedItems = hierarchyId ? (0, import_ds_utilities.arrayMove)(targetItems, oldIndex, newIndex) : targetItems;
|
|
128
123
|
this.setState({
|
|
@@ -135,7 +130,9 @@ class ShuttleImpl extends import_react.Component {
|
|
|
135
130
|
prevProps: {},
|
|
136
131
|
preparedItems: [],
|
|
137
132
|
checkedItems: [],
|
|
133
|
+
// left breadcrumb
|
|
138
134
|
hierarchy: [{ name: props.sourceRootTitle, id: null }],
|
|
135
|
+
// right breadcrumb
|
|
139
136
|
hierarchyDest: [{ name: props.targetRootTitle, id: null }],
|
|
140
137
|
movedItems: [],
|
|
141
138
|
sourceItems: [],
|
|
@@ -151,14 +148,7 @@ class ShuttleImpl extends import_react.Component {
|
|
|
151
148
|
}
|
|
152
149
|
render() {
|
|
153
150
|
const { idField, nonSelectedItems, moreItemsLoading, ...rest } = this.props;
|
|
154
|
-
const {
|
|
155
|
-
hierarchy,
|
|
156
|
-
hierarchyDest,
|
|
157
|
-
checkedItems,
|
|
158
|
-
movedItems,
|
|
159
|
-
preparedItems: items,
|
|
160
|
-
targetItems
|
|
161
|
-
} = this.state;
|
|
151
|
+
const { hierarchy, hierarchyDest, checkedItems, movedItems, preparedItems: items, targetItems } = this.state;
|
|
162
152
|
const {
|
|
163
153
|
state: { searchTerm, searching }
|
|
164
154
|
} = this.context;
|
|
@@ -168,20 +158,14 @@ class ShuttleImpl extends import_react.Component {
|
|
|
168
158
|
return (0, import_helper.filterBySearch)(
|
|
169
159
|
searchTerm,
|
|
170
160
|
searching
|
|
171
|
-
)(
|
|
172
|
-
(0, import_helper.getChildrenFromParent)(id)(
|
|
173
|
-
nonSelectedItems.map((it) => items.find((itt) => itt.id === it))
|
|
174
|
-
)
|
|
175
|
-
);
|
|
161
|
+
)((0, import_helper.getChildrenFromParent)(id)(nonSelectedItems.map((it) => items.find((itt) => itt.id === it))));
|
|
176
162
|
}
|
|
177
163
|
return (0, import_helper.filterBySearch)(
|
|
178
164
|
searchTerm,
|
|
179
165
|
searching
|
|
180
166
|
)(
|
|
181
167
|
items.filter(
|
|
182
|
-
(it) => nonSelectedItems.some(
|
|
183
|
-
(itt) => itt === it.id && !nonSelectedItems.some((ittt) => ittt === it.parent)
|
|
184
|
-
)
|
|
168
|
+
(it) => nonSelectedItems.some((itt) => itt === it.id && !nonSelectedItems.some((ittt) => ittt === it.parent))
|
|
185
169
|
)
|
|
186
170
|
);
|
|
187
171
|
};
|
|
@@ -198,12 +182,8 @@ class ShuttleImpl extends import_react.Component {
|
|
|
198
182
|
const handleControlledTargetItms = () => {
|
|
199
183
|
const { id } = (0, import_helper.getActiveIdFromHierarchy)(hierarchyDest);
|
|
200
184
|
if (id) {
|
|
201
|
-
return (0, import_helper.getChildrenFromParent)(
|
|
202
|
-
(
|
|
203
|
-
)(
|
|
204
|
-
this.props.selectedItems.map(
|
|
205
|
-
(it) => items.find((itt) => itt.id === it)
|
|
206
|
-
)
|
|
185
|
+
return (0, import_helper.getChildrenFromParent)((0, import_helper.getActiveIdFromHierarchy)(hierarchyDest).id)(
|
|
186
|
+
this.props.selectedItems.map((it) => items.find((itt) => itt.id === it))
|
|
207
187
|
);
|
|
208
188
|
}
|
|
209
189
|
return targetItems.filter(
|
|
@@ -218,10 +198,7 @@ class ShuttleImpl extends import_react.Component {
|
|
|
218
198
|
} else {
|
|
219
199
|
composedTargetItems = (0, import_ds_utilities.compose)((tItems) => {
|
|
220
200
|
const hierarchyId = (0, import_helper.getActiveIdFromHierarchy)(hierarchyDest).id;
|
|
221
|
-
return hierarchyId ? (0, import_ds_utilities.compose)(
|
|
222
|
-
(0, import_helper.filterMovedItems)(movedItems),
|
|
223
|
-
(0, import_helper.getChildrenFromParent)(hierarchyId)
|
|
224
|
-
)(tItems) : movedItems;
|
|
201
|
+
return hierarchyId ? (0, import_ds_utilities.compose)((0, import_helper.filterMovedItems)(movedItems), (0, import_helper.getChildrenFromParent)(hierarchyId))(tItems) : movedItems;
|
|
225
202
|
})(targetItems);
|
|
226
203
|
}
|
|
227
204
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|