@elliemae/ds-shuttle 2.2.0-alpha.4 → 3.0.0-next.2
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/cjs/AnimationState.js +19 -46
- package/cjs/DSShuttle.js +219 -166
- package/cjs/SearchState.js +25 -44
- package/cjs/Shuttle.actions.js +98 -87
- package/cjs/ShuttleContainer.js +61 -56
- package/cjs/ShuttleImpl.js +206 -109
- package/cjs/ShuttleRenderer.js +135 -140
- package/cjs/ShuttleState.js +53 -57
- package/cjs/animation/animationConfig.js +56 -53
- package/cjs/classedComponents.js +69 -70
- package/cjs/components/LoadingIndicator.js +22 -49
- package/cjs/components/OverflowList.js +48 -50
- package/cjs/components/ShuttleBreadcrumb.js +40 -52
- package/cjs/components/ShuttleInfiniteScrollIndicator.js +37 -46
- package/cjs/components/ShuttleListItem/ActionButtons.js +51 -56
- package/cjs/components/ShuttleListItem/ShuttleListItem.js +80 -78
- package/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +64 -78
- package/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +56 -72
- package/cjs/components/ShuttleListPanel.js +26 -44
- package/cjs/components/ShuttleSearchBox.js +72 -61
- package/cjs/components/ShuttleSource.js +146 -150
- package/cjs/components/ShuttleTarget.js +100 -88
- package/cjs/components/VirtualizedItem.js +40 -45
- package/cjs/components/VirtualizedList.js +86 -81
- package/cjs/components/VirtualizedSortableList.js +40 -47
- package/cjs/helper.js +103 -69
- package/cjs/index.js +12 -38
- package/cjs/updateShuttleStateFromProps.js +69 -73
- package/cjs/utils.js +42 -40
- package/cjs/withProviders.js +27 -43
- package/esm/AnimationState.js +8 -12
- package/esm/DSShuttle.js +198 -126
- package/esm/SearchState.js +19 -15
- package/esm/Shuttle.actions.js +80 -63
- package/esm/ShuttleContainer.js +50 -34
- package/esm/ShuttleImpl.js +183 -78
- package/esm/ShuttleRenderer.js +128 -111
- package/esm/ShuttleState.js +53 -34
- package/esm/animation/animationConfig.js +52 -24
- package/esm/classedComponents.js +51 -43
- package/esm/components/LoadingIndicator.js +15 -20
- package/esm/components/OverflowList.js +41 -21
- package/esm/components/ShuttleBreadcrumb.js +33 -23
- package/esm/components/ShuttleInfiniteScrollIndicator.js +31 -18
- package/esm/components/ShuttleListItem/ActionButtons.js +39 -27
- package/esm/components/ShuttleListItem/ShuttleListItem.js +72 -50
- package/esm/components/ShuttleListItem/ShuttleSourceListItem.js +52 -45
- package/esm/components/ShuttleListItem/ShuttleTargetListItem.js +47 -42
- package/esm/components/ShuttleListPanel.js +19 -15
- package/esm/components/ShuttleSearchBox.js +66 -32
- package/esm/components/ShuttleSource.js +129 -125
- package/esm/components/ShuttleTarget.js +89 -68
- package/esm/components/VirtualizedItem.js +33 -15
- package/esm/components/VirtualizedList.js +75 -50
- package/esm/components/VirtualizedSortableList.js +32 -17
- package/esm/helper.js +67 -43
- package/esm/index.js +2 -9
- package/esm/updateShuttleStateFromProps.js +58 -39
- package/esm/utils.js +18 -12
- package/esm/withProviders.js +20 -14
- package/package.json +11 -11
- package/types/AnimationState.d.ts +2 -3
- package/types/DSShuttle.d.ts +1 -1
- package/types/SearchState.d.ts +2 -3
- package/types/ShuttleImpl.d.ts +2 -3
- package/types/ShuttleRenderer.d.ts +0 -1
- package/types/ShuttleState.d.ts +2 -3
- package/types/components/LoadingIndicator.d.ts +0 -1
- package/types/components/OverflowList.d.ts +0 -1
- package/types/components/ShuttleBreadcrumb.d.ts +0 -1
- package/types/components/ShuttleInfiniteScrollIndicator.d.ts +0 -1
- package/types/components/ShuttleListItem/ShuttleListItem.d.ts +0 -1
- package/types/components/ShuttleListItem/ShuttleSourceListItem.d.ts +0 -1
- package/types/components/ShuttleListItem/ShuttleTargetListItem.d.ts +0 -1
- package/types/components/ShuttleListPanel.d.ts +0 -1
- package/types/components/ShuttleSearchBox.d.ts +1 -3
- package/types/components/ShuttleSource.d.ts +0 -1
- package/types/components/ShuttleTarget.d.ts +0 -1
- package/types/components/VirtualizedItem.d.ts +0 -1
- package/types/components/VirtualizedList.d.ts +0 -1
- package/types/components/VirtualizedSortableList.d.ts +0 -1
- package/types/index.d.ts +1 -1
- package/types/updateShuttleStateFromProps.d.ts +1 -3
- package/types/withProviders.d.ts +0 -1
- package/cjs/AnimationState.js.map +0 -7
- package/cjs/DSShuttle.js.map +0 -7
- package/cjs/SearchState.js.map +0 -7
- package/cjs/Shuttle.actions.js.map +0 -7
- package/cjs/ShuttleContainer.js.map +0 -7
- package/cjs/ShuttleImpl.js.map +0 -7
- package/cjs/ShuttleRenderer.js.map +0 -7
- package/cjs/ShuttleState.js.map +0 -7
- package/cjs/animation/animationConfig.js.map +0 -7
- package/cjs/classedComponents.js.map +0 -7
- package/cjs/components/LoadingIndicator.js.map +0 -7
- package/cjs/components/OverflowList.js.map +0 -7
- package/cjs/components/ShuttleBreadcrumb.js.map +0 -7
- package/cjs/components/ShuttleInfiniteScrollIndicator.js.map +0 -7
- package/cjs/components/ShuttleListItem/ActionButtons.js.map +0 -7
- package/cjs/components/ShuttleListItem/ShuttleListItem.js.map +0 -7
- package/cjs/components/ShuttleListItem/ShuttleSourceListItem.js.map +0 -7
- package/cjs/components/ShuttleListItem/ShuttleTargetListItem.js.map +0 -7
- package/cjs/components/ShuttleListPanel.js.map +0 -7
- package/cjs/components/ShuttleSearchBox.js.map +0 -7
- package/cjs/components/ShuttleSource.js.map +0 -7
- package/cjs/components/ShuttleTarget.js.map +0 -7
- package/cjs/components/VirtualizedItem.js.map +0 -7
- package/cjs/components/VirtualizedList.js.map +0 -7
- package/cjs/components/VirtualizedSortableList.js.map +0 -7
- package/cjs/helper.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/tests/utils.js +0 -1218
- package/cjs/tests/utils.js.map +0 -7
- package/cjs/updateShuttleStateFromProps.js.map +0 -7
- package/cjs/utils.js.map +0 -7
- package/cjs/withProviders.js.map +0 -7
- package/esm/AnimationState.js.map +0 -7
- package/esm/DSShuttle.js.map +0 -7
- package/esm/SearchState.js.map +0 -7
- package/esm/Shuttle.actions.js.map +0 -7
- package/esm/ShuttleContainer.js.map +0 -7
- package/esm/ShuttleImpl.js.map +0 -7
- package/esm/ShuttleRenderer.js.map +0 -7
- package/esm/ShuttleState.js.map +0 -7
- package/esm/animation/animationConfig.js.map +0 -7
- package/esm/classedComponents.js.map +0 -7
- package/esm/components/LoadingIndicator.js.map +0 -7
- package/esm/components/OverflowList.js.map +0 -7
- package/esm/components/ShuttleBreadcrumb.js.map +0 -7
- package/esm/components/ShuttleInfiniteScrollIndicator.js.map +0 -7
- package/esm/components/ShuttleListItem/ActionButtons.js.map +0 -7
- package/esm/components/ShuttleListItem/ShuttleListItem.js.map +0 -7
- package/esm/components/ShuttleListItem/ShuttleSourceListItem.js.map +0 -7
- package/esm/components/ShuttleListItem/ShuttleTargetListItem.js.map +0 -7
- package/esm/components/ShuttleListPanel.js.map +0 -7
- package/esm/components/ShuttleSearchBox.js.map +0 -7
- package/esm/components/ShuttleSource.js.map +0 -7
- package/esm/components/ShuttleTarget.js.map +0 -7
- package/esm/components/VirtualizedItem.js.map +0 -7
- package/esm/components/VirtualizedList.js.map +0 -7
- package/esm/components/VirtualizedSortableList.js.map +0 -7
- package/esm/helper.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/tests/utils.js +0 -1189
- package/esm/tests/utils.js.map +0 -7
- package/esm/updateShuttleStateFromProps.js.map +0 -7
- package/esm/utils.js.map +0 -7
- package/esm/withProviders.js.map +0 -7
package/cjs/AnimationState.js
CHANGED
|
@@ -1,60 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var AnimationState_exports = {};
|
|
29
|
-
__export(AnimationState_exports, {
|
|
30
|
-
AnimationState: () => AnimationState,
|
|
31
|
-
default: () => AnimationState_default
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
var import_react = require("react");
|
|
35
|
-
var import_constate = __toESM(require("constate"));
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var createContainer = require('constate');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var createContainer__default = /*#__PURE__*/_interopDefaultLegacy(createContainer);
|
|
10
|
+
|
|
36
11
|
function useShuttleAnimationState() {
|
|
37
|
-
const [animationState, setAnimationState] =
|
|
12
|
+
const [animationState, setAnimationState] = react.useState({
|
|
38
13
|
isMoving: false,
|
|
39
14
|
isMovingBack: false,
|
|
40
15
|
isDrillingDown: false
|
|
41
16
|
});
|
|
42
|
-
const reset =
|
|
17
|
+
const reset = react.useCallback(() => setAnimationState({
|
|
43
18
|
isMoving: false,
|
|
44
19
|
isMovingBack: false,
|
|
45
20
|
isDrillingDown: false
|
|
46
21
|
}), []);
|
|
47
|
-
const move =
|
|
22
|
+
const move = react.useCallback(() => setAnimationState({
|
|
48
23
|
isMovingBack: false,
|
|
49
24
|
isMoving: true,
|
|
50
25
|
isDrillingDown: false
|
|
51
26
|
}), []);
|
|
52
|
-
const moveBack =
|
|
27
|
+
const moveBack = react.useCallback(() => setAnimationState({
|
|
53
28
|
isMovingBack: true,
|
|
54
29
|
isMoving: false,
|
|
55
30
|
isDrillingDown: false
|
|
56
31
|
}), []);
|
|
57
|
-
const drilldown =
|
|
32
|
+
const drilldown = react.useCallback(() => setAnimationState({
|
|
58
33
|
isMovingBack: false,
|
|
59
34
|
isMoving: false,
|
|
60
35
|
isDrillingDown: true
|
|
@@ -67,9 +42,7 @@ function useShuttleAnimationState() {
|
|
|
67
42
|
reset
|
|
68
43
|
};
|
|
69
44
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
module.exports = __toCommonJS(AnimationState_exports);
|
|
75
|
-
//# sourceMappingURL=AnimationState.js.map
|
|
45
|
+
|
|
46
|
+
var AnimationContext = createContainer__default["default"](useShuttleAnimationState, value => [value.state]);
|
|
47
|
+
|
|
48
|
+
module.exports = AnimationContext;
|
package/cjs/DSShuttle.js
CHANGED
|
@@ -1,170 +1,223 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
+
require('react');
|
|
8
|
+
var lodash = require('lodash');
|
|
9
|
+
var reactDesc = require('react-desc');
|
|
10
|
+
var dsTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
|
|
11
|
+
var ShuttleImpl = require('./ShuttleImpl.js');
|
|
12
|
+
var utils = require('./utils.js');
|
|
13
|
+
|
|
14
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
+
|
|
16
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
17
|
+
|
|
18
|
+
const noop = () => {};
|
|
19
|
+
|
|
20
|
+
const DSShuttle = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
containerProps = {},
|
|
23
|
+
idField = 'id',
|
|
24
|
+
parentIdField = 'parent',
|
|
25
|
+
showIcons = true,
|
|
26
|
+
items = [],
|
|
27
|
+
selectedItems = undefined,
|
|
28
|
+
// if defined it becomes controlled (v1)
|
|
29
|
+
// TODO make `nonSelectedItems` the default controlled behavior (v2)
|
|
30
|
+
nonSelectedItems = undefined,
|
|
31
|
+
onSearch = noop,
|
|
32
|
+
onSearchOpen = noop,
|
|
33
|
+
onSearchClose = noop,
|
|
34
|
+
onDrillDown = noop,
|
|
35
|
+
onDrillDownTarget = noop,
|
|
36
|
+
onTargetSortEnd = noop,
|
|
37
|
+
setGetStatus = noop,
|
|
38
|
+
targetSortable = true,
|
|
39
|
+
sourceEmptyMessage = 'No Items Found',
|
|
40
|
+
sourceRootTitle = 'Category',
|
|
41
|
+
targetEmptyMessage = 'No Items Selected',
|
|
42
|
+
targetRootTitle = 'Selected Items',
|
|
43
|
+
composeSourceItemProps = () => ({}),
|
|
44
|
+
composeTargetItemProps = () => ({}),
|
|
45
|
+
onAddToTarget = noop,
|
|
46
|
+
onAddCheckedItems = noop,
|
|
47
|
+
onRemoveFromTarget = noop,
|
|
48
|
+
onRemoveAllFromTarget = noop,
|
|
49
|
+
onChange = noop,
|
|
50
|
+
renderSourceCounter = noop,
|
|
51
|
+
renderTargetCounter = noop,
|
|
52
|
+
sourceClearItemsText = 'CLEAR ALL',
|
|
53
|
+
targetClearItemsText = 'CLEAR ALL',
|
|
54
|
+
searchPlaceholder = 'Search field ID, name, etc.',
|
|
55
|
+
loadingSource = false,
|
|
56
|
+
loadingTarget = false,
|
|
57
|
+
onGetMoreItems = () => null,
|
|
58
|
+
hasNextPage = false,
|
|
59
|
+
moreItemsLoading
|
|
60
|
+
} = _ref;
|
|
61
|
+
return /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.TooltipTextProvider, {}, void 0, /*#__PURE__*/_jsx__default["default"](ShuttleImpl, {
|
|
62
|
+
composeSourceItemProps: composeSourceItemProps,
|
|
63
|
+
composeTargetItemProps: composeTargetItemProps,
|
|
64
|
+
containerProps: containerProps,
|
|
65
|
+
idField: idField,
|
|
66
|
+
items: items,
|
|
67
|
+
onAddCheckedItems: onAddCheckedItems,
|
|
68
|
+
onAddToTarget: onAddToTarget,
|
|
69
|
+
onChange: onChange,
|
|
70
|
+
onDrillDown: onDrillDown,
|
|
71
|
+
nonSelectedItems: nonSelectedItems,
|
|
72
|
+
onDrillDownTarget: onDrillDownTarget,
|
|
73
|
+
onRemoveAllFromTarget: onRemoveAllFromTarget,
|
|
74
|
+
onRemoveFromTarget: onRemoveFromTarget,
|
|
75
|
+
onSearch: onSearch,
|
|
76
|
+
onSearchClose: onSearchClose,
|
|
77
|
+
onSearchOpen: onSearchOpen,
|
|
78
|
+
onTargetSortEnd: onTargetSortEnd,
|
|
79
|
+
parentIdField: parentIdField,
|
|
80
|
+
renderSourceCounter: renderSourceCounter,
|
|
81
|
+
renderTargetCounter: renderTargetCounter,
|
|
82
|
+
searchPlaceholder: searchPlaceholder,
|
|
83
|
+
selectedItems: selectedItems,
|
|
84
|
+
setGetStatus: setGetStatus,
|
|
85
|
+
showIcons: showIcons,
|
|
86
|
+
sourceClearItemsText: sourceClearItemsText,
|
|
87
|
+
sourceEmptyMessage: sourceEmptyMessage,
|
|
88
|
+
sourceRootTitle: sourceRootTitle,
|
|
89
|
+
targetClearItemsText: targetClearItemsText,
|
|
90
|
+
targetEmptyMessage: targetEmptyMessage,
|
|
91
|
+
targetRootTitle: targetRootTitle,
|
|
92
|
+
targetSortable: targetSortable,
|
|
93
|
+
loadingSource: loadingSource,
|
|
94
|
+
loadingTarget: loadingTarget,
|
|
95
|
+
onGetMoreItems: lodash.debounce(function () {
|
|
96
|
+
onGetMoreItems(...arguments);
|
|
97
|
+
}, 500),
|
|
98
|
+
moreItemsLoading: moreItemsLoading,
|
|
99
|
+
hasNextPage: hasNextPage
|
|
100
|
+
}));
|
|
11
101
|
};
|
|
12
|
-
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var DSShuttle_exports = {};
|
|
29
|
-
__export(DSShuttle_exports, {
|
|
30
|
-
DSShuttle: () => DSShuttle,
|
|
31
|
-
DSShuttleWithSchema: () => DSShuttleWithSchema,
|
|
32
|
-
default: () => DSShuttle_default,
|
|
33
|
-
utils: () => import_utils.default
|
|
34
|
-
});
|
|
35
|
-
var React = __toESM(require("react"));
|
|
36
|
-
var import_react = __toESM(require("react"));
|
|
37
|
-
var import_lodash = require("lodash");
|
|
38
|
-
var import_react_desc = require("react-desc");
|
|
39
|
-
var import_ds_truncated_tooltip_text = require("@elliemae/ds-truncated-tooltip-text");
|
|
40
|
-
var import_ShuttleImpl = require("./ShuttleImpl");
|
|
41
|
-
var import_utils = __toESM(require("./utils"));
|
|
42
|
-
const noop = () => {
|
|
43
|
-
};
|
|
44
|
-
const DSShuttle = ({
|
|
45
|
-
containerProps = {},
|
|
46
|
-
idField = "id",
|
|
47
|
-
parentIdField = "parent",
|
|
48
|
-
showIcons = true,
|
|
49
|
-
items = [],
|
|
50
|
-
selectedItems = void 0,
|
|
51
|
-
nonSelectedItems = void 0,
|
|
52
|
-
onSearch = noop,
|
|
53
|
-
onSearchOpen = noop,
|
|
54
|
-
onSearchClose = noop,
|
|
55
|
-
onDrillDown = noop,
|
|
56
|
-
onDrillDownTarget = noop,
|
|
57
|
-
onTargetSortEnd = noop,
|
|
58
|
-
setGetStatus = noop,
|
|
59
|
-
targetSortable = true,
|
|
60
|
-
sourceEmptyMessage = "No Items Found",
|
|
61
|
-
sourceRootTitle = "Category",
|
|
62
|
-
targetEmptyMessage = "No Items Selected",
|
|
63
|
-
targetRootTitle = "Selected Items",
|
|
64
|
-
composeSourceItemProps = () => ({}),
|
|
65
|
-
composeTargetItemProps = () => ({}),
|
|
66
|
-
onAddToTarget = noop,
|
|
67
|
-
onAddCheckedItems = noop,
|
|
68
|
-
onRemoveFromTarget = noop,
|
|
69
|
-
onRemoveAllFromTarget = noop,
|
|
70
|
-
onChange = noop,
|
|
71
|
-
renderSourceCounter = noop,
|
|
72
|
-
renderTargetCounter = noop,
|
|
73
|
-
sourceClearItemsText = "CLEAR ALL",
|
|
74
|
-
targetClearItemsText = "CLEAR ALL",
|
|
75
|
-
searchPlaceholder = "Search field ID, name, etc.",
|
|
76
|
-
loadingSource = false,
|
|
77
|
-
loadingTarget = false,
|
|
78
|
-
onGetMoreItems = () => null,
|
|
79
|
-
hasNextPage = false,
|
|
80
|
-
moreItemsLoading
|
|
81
|
-
}) => /* @__PURE__ */ import_react.default.createElement(import_ds_truncated_tooltip_text.TooltipTextProvider, null, /* @__PURE__ */ import_react.default.createElement(import_ShuttleImpl.ShuttleImpl, {
|
|
82
|
-
composeSourceItemProps,
|
|
83
|
-
composeTargetItemProps,
|
|
84
|
-
containerProps,
|
|
85
|
-
idField,
|
|
86
|
-
items,
|
|
87
|
-
onAddCheckedItems,
|
|
88
|
-
onAddToTarget,
|
|
89
|
-
onChange,
|
|
90
|
-
onDrillDown,
|
|
91
|
-
nonSelectedItems,
|
|
92
|
-
onDrillDownTarget,
|
|
93
|
-
onRemoveAllFromTarget,
|
|
94
|
-
onRemoveFromTarget,
|
|
95
|
-
onSearch,
|
|
96
|
-
onSearchClose,
|
|
97
|
-
onSearchOpen,
|
|
98
|
-
onTargetSortEnd,
|
|
99
|
-
parentIdField,
|
|
100
|
-
renderSourceCounter,
|
|
101
|
-
renderTargetCounter,
|
|
102
|
-
searchPlaceholder,
|
|
103
|
-
selectedItems,
|
|
104
|
-
setGetStatus,
|
|
105
|
-
showIcons,
|
|
106
|
-
sourceClearItemsText,
|
|
107
|
-
sourceEmptyMessage,
|
|
108
|
-
sourceRootTitle,
|
|
109
|
-
targetClearItemsText,
|
|
110
|
-
targetEmptyMessage,
|
|
111
|
-
targetRootTitle,
|
|
112
|
-
targetSortable,
|
|
113
|
-
loadingSource,
|
|
114
|
-
loadingTarget,
|
|
115
|
-
onGetMoreItems: (0, import_lodash.debounce)((...args) => {
|
|
116
|
-
onGetMoreItems(...args);
|
|
117
|
-
}, 500),
|
|
118
|
-
moreItemsLoading,
|
|
119
|
-
hasNextPage
|
|
120
|
-
}));
|
|
102
|
+
|
|
121
103
|
const props = {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
104
|
+
/** inject props to shuttle wrapper */
|
|
105
|
+
containerProps: reactDesc.PropTypes.object.description('inject props to shuttle wrapper'),
|
|
106
|
+
|
|
107
|
+
/** The identifier field for the item object */
|
|
108
|
+
idField: reactDesc.PropTypes.string.description('The identifier field for the item object'),
|
|
109
|
+
|
|
110
|
+
/** The parent identifier field for the item object */
|
|
111
|
+
parentIdField: reactDesc.PropTypes.string.description('The parent identifier field for the item object'),
|
|
112
|
+
|
|
113
|
+
/** Whether to show the icons or not */
|
|
114
|
+
showIcons: reactDesc.PropTypes.string.description('Whether to show the icons or not'),
|
|
115
|
+
|
|
116
|
+
/** List of items */
|
|
117
|
+
items: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.shape({
|
|
118
|
+
disableDrillDown: reactDesc.PropTypes.bool,
|
|
119
|
+
icon: reactDesc.PropTypes.element,
|
|
120
|
+
name: reactDesc.PropTypes.string,
|
|
121
|
+
readOnly: reactDesc.PropTypes.bool,
|
|
122
|
+
description: reactDesc.PropTypes.string
|
|
123
|
+
})).description('list of items'),
|
|
124
|
+
|
|
125
|
+
/** Array of item ids that are selected. If passed the component behaves as controlled */
|
|
126
|
+
selectedItems: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.string).description('Array of item ids that are selected. If passed the component behaves as controlled'),
|
|
127
|
+
|
|
128
|
+
/** Array of item ids that aren't selected. Should include ALL non selected items, even those not rendered */
|
|
129
|
+
nonSelectedItems: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.string).description("Array of item ids that aren't selected.. Should include ALL non selected items, even those not rendered"),
|
|
130
|
+
|
|
131
|
+
/** Handler on search */
|
|
132
|
+
onSearch: reactDesc.PropTypes.func.description('Handler on search'),
|
|
133
|
+
|
|
134
|
+
/** Handler when the searchbox is visible */
|
|
135
|
+
onSearchOpen: reactDesc.PropTypes.func.description('Handler when the searchbox is visible'),
|
|
136
|
+
|
|
137
|
+
/** Handler when the searchbox is not visible */
|
|
138
|
+
onSearchClose: reactDesc.PropTypes.func.description('Handler when the searchbox is not visible'),
|
|
139
|
+
|
|
140
|
+
/** Source handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down") */
|
|
141
|
+
onDrillDown: reactDesc.PropTypes.func.description('Source handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down")'),
|
|
142
|
+
|
|
143
|
+
/** Target handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down") */
|
|
144
|
+
onDrillDownTarget: reactDesc.PropTypes.func.description('Target handler when a user navigates to a level down on the nested structure. First param: item drilled. Second param: direction ("up" | "down")'),
|
|
145
|
+
|
|
146
|
+
/** Target handler when user stops dragging an item */
|
|
147
|
+
onTargetSortEnd: reactDesc.PropTypes.func.description('Target handler when user stops dragging an item'),
|
|
148
|
+
|
|
149
|
+
/** Callback function that gets more items for Infinite Scroll */
|
|
150
|
+
onGetMoreItems: reactDesc.PropTypes.func.description('Callback function that gets more items for Infinite Scroll'),
|
|
151
|
+
|
|
152
|
+
/** Wheter there are mor items loading for Infinite Scroll */
|
|
153
|
+
moreItemsLoading: reactDesc.PropTypes.bool.description('Wheter there are mor items loading for Infinite Scroll'),
|
|
154
|
+
|
|
155
|
+
/** Wheter there is a next page for Infinite Scroll, controls when to trigger onGetMoreItems */
|
|
156
|
+
hasNextPage: reactDesc.PropTypes.bool.description('Wheter there is a next page for Infinite Scroll, controls when to trigger onGetMoreItems'),
|
|
157
|
+
|
|
158
|
+
/** Function that takes as a parameter an internal getter for the state */
|
|
159
|
+
setGetStatus: reactDesc.PropTypes.func.description('Function that takes as a parameter an internal getter for the state'),
|
|
160
|
+
|
|
161
|
+
/** Whether the target can be sortable with DnD */
|
|
162
|
+
targetSortable: reactDesc.PropTypes.bool.description('Whether the target can be sortable with DnD'),
|
|
163
|
+
|
|
164
|
+
/** Handler when the searchbox is visible */
|
|
165
|
+
sourceRootTitle: reactDesc.PropTypes.string.description('Handler when the searchbox is visible'),
|
|
166
|
+
|
|
167
|
+
/** Source text when there is no items */
|
|
168
|
+
sourceEmptyMessage: reactDesc.PropTypes.string.description('Source text when there is no items'),
|
|
169
|
+
|
|
170
|
+
/** Target text when there is no items */
|
|
171
|
+
targetEmptyMessage: reactDesc.PropTypes.string.description('Target text when there is no items'),
|
|
172
|
+
|
|
173
|
+
/** Target text for the first hierarchy item */
|
|
174
|
+
targetRootTitle: reactDesc.PropTypes.string.description('Target text for the first hierarchy item'),
|
|
175
|
+
|
|
176
|
+
/** Function that allow to compose the item props in the source */
|
|
177
|
+
composeSourceItemProps: reactDesc.PropTypes.func.description('Function that allow to compose the item props in the source'),
|
|
178
|
+
|
|
179
|
+
/** Function that allow to compose the item props in the target */
|
|
180
|
+
composeTargetItemProps: reactDesc.PropTypes.func.description('Function that allow to compose the item props in the target'),
|
|
181
|
+
|
|
182
|
+
/** Handler when a users moves an item to the target */
|
|
183
|
+
onAddToTarget: reactDesc.PropTypes.func.description('Handler when a users moves an item to the target'),
|
|
184
|
+
|
|
185
|
+
/** Handler when a users moves all the 'checked' items to the target */
|
|
186
|
+
onAddCheckedItems: reactDesc.PropTypes.func.description("Handler when a users moves all the 'checked' items to the target"),
|
|
187
|
+
|
|
188
|
+
/** Handler when a user removes an item from the target */
|
|
189
|
+
onRemoveFromTarget: reactDesc.PropTypes.func.description('Handler when a user removes an item from the target'),
|
|
190
|
+
|
|
191
|
+
/** Handler when a user removes all the items from the target */
|
|
192
|
+
onRemoveAllFromTarget: reactDesc.PropTypes.func.description('Handler when a user removes all the items from the target'),
|
|
193
|
+
|
|
194
|
+
/** Handler for every change on the state */
|
|
195
|
+
onChange: reactDesc.PropTypes.func.description('Handler for every change on the state'),
|
|
196
|
+
|
|
197
|
+
/** Function that returns an element for the source counter */
|
|
198
|
+
renderSourceCounter: reactDesc.PropTypes.func.description('Function that returns an element for the source counter'),
|
|
199
|
+
|
|
200
|
+
/** Function that returns an element for the target counter */
|
|
201
|
+
renderTargetCounter: reactDesc.PropTypes.func.description('Function that returns an element for the target counter'),
|
|
202
|
+
|
|
203
|
+
/** Source text for the clear items button */
|
|
204
|
+
sourceClearItemsText: reactDesc.PropTypes.string.description('Source text for the clear items button'),
|
|
205
|
+
|
|
206
|
+
/** Target text for the clear items button */
|
|
207
|
+
targetClearItemsText: reactDesc.PropTypes.string.description('Target text for the clear items button'),
|
|
208
|
+
|
|
209
|
+
/** Searchbox placeholder */
|
|
210
|
+
searchPlaceholder: reactDesc.PropTypes.string.description('Searchbox placeholder'),
|
|
211
|
+
|
|
212
|
+
/** Displays loading indicator on source section */
|
|
213
|
+
loadingSource: reactDesc.PropTypes.bool.description('Displays loading indicator on source section'),
|
|
214
|
+
|
|
215
|
+
/** Displays loading indicator on target section */
|
|
216
|
+
loadingTarget: reactDesc.PropTypes.bool.description('Displays loading indicator on target section')
|
|
164
217
|
};
|
|
165
|
-
|
|
166
|
-
const DSShuttleWithSchema = (0, import_react_desc.describe)(DSShuttle);
|
|
218
|
+
const DSShuttleWithSchema = reactDesc.describe(DSShuttle);
|
|
167
219
|
DSShuttleWithSchema.propTypes = props;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
220
|
+
|
|
221
|
+
exports.utils = utils;
|
|
222
|
+
exports.DSShuttleWithSchema = DSShuttleWithSchema;
|
|
223
|
+
exports["default"] = DSShuttle;
|
package/cjs/SearchState.js
CHANGED
|
@@ -1,60 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var SearchState_exports = {};
|
|
29
|
-
__export(SearchState_exports, {
|
|
30
|
-
SearchState: () => SearchState,
|
|
31
|
-
default: () => SearchState_default
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
var import_react = require("react");
|
|
35
|
-
var import_constate = __toESM(require("constate"));
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var createContainer = require('constate');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var createContainer__default = /*#__PURE__*/_interopDefaultLegacy(createContainer);
|
|
10
|
+
|
|
36
11
|
function useSearchState() {
|
|
37
|
-
const [searchTerm, setSearchTerm] =
|
|
38
|
-
const [searching, setSearchBoxVisibility] =
|
|
12
|
+
const [searchTerm, setSearchTerm] = react.useState('');
|
|
13
|
+
const [searching, setSearchBoxVisibility] = react.useState(false); // todo: create a hook for Visibility behavior
|
|
14
|
+
|
|
39
15
|
function toggleSearchBox(userVisible) {
|
|
40
|
-
if (userVisible !==
|
|
16
|
+
if (userVisible !== undefined) {
|
|
41
17
|
setSearchBoxVisibility(userVisible);
|
|
42
18
|
} else {
|
|
43
19
|
setSearchBoxVisibility(!searching);
|
|
44
20
|
}
|
|
45
21
|
}
|
|
22
|
+
|
|
46
23
|
function reset() {
|
|
47
|
-
setSearchTerm(
|
|
24
|
+
setSearchTerm('');
|
|
48
25
|
setSearchBoxVisibility(false);
|
|
49
26
|
}
|
|
27
|
+
|
|
50
28
|
return {
|
|
51
|
-
state: {
|
|
29
|
+
state: {
|
|
30
|
+
searchTerm,
|
|
31
|
+
searching
|
|
32
|
+
},
|
|
52
33
|
setSearchTerm,
|
|
53
34
|
toggleSearchBox,
|
|
54
35
|
reset
|
|
55
36
|
};
|
|
56
37
|
}
|
|
57
|
-
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
38
|
+
|
|
39
|
+
var SearchState = createContainer__default["default"](useSearchState, value => [value.state]);
|
|
40
|
+
|
|
41
|
+
module.exports = SearchState;
|