@elliemae/ds-shuttle 2.3.0-next.0 → 3.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/AnimationState.js +75 -0
- package/dist/cjs/AnimationState.js.map +7 -0
- package/dist/cjs/DSShuttle.js +170 -0
- package/dist/cjs/DSShuttle.js.map +7 -0
- package/dist/cjs/SearchState.js +60 -0
- package/dist/cjs/SearchState.js.map +7 -0
- package/dist/cjs/Shuttle.actions.js +126 -0
- package/dist/cjs/Shuttle.actions.js.map +7 -0
- package/dist/cjs/ShuttleContainer.js +82 -0
- package/dist/cjs/ShuttleContainer.js.map +7 -0
- package/dist/cjs/ShuttleImpl.js +214 -0
- package/dist/cjs/ShuttleImpl.js.map +7 -0
- package/dist/cjs/ShuttleRenderer.js +144 -0
- package/dist/cjs/ShuttleRenderer.js.map +7 -0
- package/dist/cjs/ShuttleState.js +84 -0
- package/dist/cjs/ShuttleState.js.map +7 -0
- package/dist/cjs/animation/animationConfig.js +78 -0
- package/dist/cjs/animation/animationConfig.js.map +7 -0
- package/dist/cjs/classedComponents.js +72 -0
- package/dist/cjs/classedComponents.js.map +7 -0
- package/dist/cjs/components/LoadingIndicator.js +52 -0
- package/dist/cjs/components/LoadingIndicator.js.map +7 -0
- package/dist/cjs/components/OverflowList.js +55 -0
- package/dist/cjs/components/OverflowList.js.map +7 -0
- package/dist/cjs/components/ShuttleBreadcrumb.js +54 -0
- package/dist/cjs/components/ShuttleBreadcrumb.js.map +7 -0
- package/dist/cjs/components/ShuttleInfiniteScrollIndicator.js +48 -0
- package/dist/cjs/components/ShuttleInfiniteScrollIndicator.js.map +7 -0
- package/dist/cjs/components/ShuttleListItem/ActionButtons.js +60 -0
- package/dist/cjs/components/ShuttleListItem/ActionButtons.js.map +7 -0
- package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js +83 -0
- package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js.map +7 -0
- package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +90 -0
- package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js.map +7 -0
- package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +73 -0
- package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js.map +7 -0
- package/dist/cjs/components/ShuttleListPanel.js +49 -0
- package/dist/cjs/components/ShuttleListPanel.js.map +7 -0
- package/dist/cjs/components/ShuttleSearchBox.js +99 -0
- package/dist/cjs/components/ShuttleSearchBox.js.map +7 -0
- package/dist/cjs/components/ShuttleSource.js +192 -0
- package/dist/cjs/components/ShuttleSource.js.map +7 -0
- package/dist/cjs/components/ShuttleTarget.js +104 -0
- package/dist/cjs/components/ShuttleTarget.js.map +7 -0
- package/dist/cjs/components/VirtualizedItem.js +51 -0
- package/dist/cjs/components/VirtualizedItem.js.map +7 -0
- package/dist/cjs/components/VirtualizedList.js +88 -0
- package/dist/cjs/components/VirtualizedList.js.map +7 -0
- package/dist/cjs/components/VirtualizedSortableList.js +48 -0
- package/dist/cjs/components/VirtualizedSortableList.js.map +7 -0
- package/dist/cjs/helper.js +83 -0
- package/dist/cjs/helper.js.map +7 -0
- package/dist/cjs/index.js +38 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/tests/utils.js +1218 -0
- package/dist/cjs/tests/utils.js.map +7 -0
- package/dist/cjs/updateShuttleStateFromProps.js +98 -0
- package/dist/cjs/updateShuttleStateFromProps.js.map +7 -0
- package/dist/cjs/utils.js +41 -0
- package/dist/cjs/utils.js.map +7 -0
- package/dist/cjs/withProviders.js +45 -0
- package/dist/cjs/withProviders.js.map +7 -0
- package/{esm → dist/esm}/AnimationState.js +12 -8
- package/dist/esm/AnimationState.js.map +7 -0
- package/dist/esm/DSShuttle.js +141 -0
- package/dist/esm/DSShuttle.js.map +7 -0
- package/dist/esm/SearchState.js +31 -0
- package/dist/esm/SearchState.js.map +7 -0
- package/dist/esm/Shuttle.actions.js +106 -0
- package/dist/esm/Shuttle.actions.js.map +7 -0
- package/dist/esm/ShuttleContainer.js +64 -0
- package/dist/esm/ShuttleContainer.js.map +7 -0
- package/dist/esm/ShuttleImpl.js +199 -0
- package/dist/esm/ShuttleImpl.js.map +7 -0
- package/dist/esm/ShuttleRenderer.js +115 -0
- package/dist/esm/ShuttleRenderer.js.map +7 -0
- package/dist/esm/ShuttleState.js +55 -0
- package/dist/esm/ShuttleState.js.map +7 -0
- package/dist/esm/animation/animationConfig.js +49 -0
- package/dist/esm/animation/animationConfig.js.map +7 -0
- package/dist/esm/classedComponents.js +43 -0
- package/dist/esm/classedComponents.js.map +7 -0
- package/dist/esm/components/LoadingIndicator.js +23 -0
- package/dist/esm/components/LoadingIndicator.js.map +7 -0
- package/dist/esm/components/OverflowList.js +26 -0
- package/dist/esm/components/OverflowList.js.map +7 -0
- package/dist/esm/components/ShuttleBreadcrumb.js +25 -0
- package/dist/esm/components/ShuttleBreadcrumb.js.map +7 -0
- package/dist/esm/components/ShuttleInfiniteScrollIndicator.js +19 -0
- package/dist/esm/components/ShuttleInfiniteScrollIndicator.js.map +7 -0
- package/dist/esm/components/ShuttleListItem/ActionButtons.js +31 -0
- package/dist/esm/components/ShuttleListItem/ActionButtons.js.map +7 -0
- package/dist/esm/components/ShuttleListItem/ShuttleListItem.js +54 -0
- package/dist/esm/components/ShuttleListItem/ShuttleListItem.js.map +7 -0
- package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js +61 -0
- package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js.map +7 -0
- package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js +44 -0
- package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js.map +7 -0
- package/dist/esm/components/ShuttleListPanel.js +20 -0
- package/dist/esm/components/ShuttleListPanel.js.map +7 -0
- package/dist/esm/components/ShuttleSearchBox.js +70 -0
- package/dist/esm/components/ShuttleSearchBox.js.map +7 -0
- package/dist/esm/components/ShuttleSource.js +175 -0
- package/dist/esm/components/ShuttleSource.js.map +7 -0
- package/dist/esm/components/ShuttleTarget.js +86 -0
- package/dist/esm/components/ShuttleTarget.js.map +7 -0
- package/dist/esm/components/VirtualizedItem.js +22 -0
- package/dist/esm/components/VirtualizedItem.js.map +7 -0
- package/dist/esm/components/VirtualizedList.js +59 -0
- package/dist/esm/components/VirtualizedList.js.map +7 -0
- package/dist/esm/components/VirtualizedSortableList.js +19 -0
- package/dist/esm/components/VirtualizedSortableList.js.map +7 -0
- package/dist/esm/helper.js +54 -0
- package/dist/esm/helper.js.map +7 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/tests/utils.js +1189 -0
- package/dist/esm/tests/utils.js.map +7 -0
- package/dist/esm/updateShuttleStateFromProps.js +69 -0
- package/dist/esm/updateShuttleStateFromProps.js.map +7 -0
- package/dist/esm/utils.js +12 -0
- package/dist/esm/utils.js.map +7 -0
- package/dist/esm/withProviders.js +16 -0
- package/dist/esm/withProviders.js.map +7 -0
- package/{types → dist/types}/AnimationState.d.ts +3 -2
- package/{types → dist/types}/DSShuttle.d.ts +1 -1
- package/{types → dist/types}/SearchState.d.ts +3 -2
- package/{types → dist/types}/Shuttle.actions.d.ts +0 -0
- package/{types → dist/types}/ShuttleContainer.d.ts +0 -0
- package/dist/types/ShuttleImpl.d.ts +4 -0
- package/{types → dist/types}/ShuttleRenderer.d.ts +1 -0
- package/{types → dist/types}/ShuttleState.d.ts +3 -2
- package/{types → dist/types}/animation/animationConfig.d.ts +0 -0
- package/{types → dist/types}/classedComponents.d.ts +0 -0
- package/{types → dist/types}/components/LoadingIndicator.d.ts +1 -0
- package/{types → dist/types}/components/OverflowList.d.ts +1 -0
- package/{types → dist/types}/components/ShuttleBreadcrumb.d.ts +1 -0
- package/{types → dist/types}/components/ShuttleInfiniteScrollIndicator.d.ts +1 -0
- package/{types → dist/types}/components/ShuttleListItem/ActionButtons.d.ts +0 -0
- package/{types → dist/types}/components/ShuttleListItem/ShuttleListItem.d.ts +1 -0
- package/{types → dist/types}/components/ShuttleListItem/ShuttleSourceListItem.d.ts +1 -0
- package/{types → dist/types}/components/ShuttleListItem/ShuttleTargetListItem.d.ts +1 -0
- package/{types → dist/types}/components/ShuttleListPanel.d.ts +1 -0
- package/{types → dist/types}/components/ShuttleSearchBox.d.ts +3 -1
- package/{types → dist/types}/components/ShuttleSource.d.ts +1 -0
- package/{types → dist/types}/components/ShuttleTarget.d.ts +1 -0
- package/{types → dist/types}/components/VirtualizedItem.d.ts +1 -0
- package/{types → dist/types}/components/VirtualizedList.d.ts +1 -0
- package/{types → dist/types}/components/VirtualizedSortableList.d.ts +1 -0
- package/{types → dist/types}/helper.d.ts +0 -0
- package/dist/types/index.d.ts +1 -0
- package/{types → dist/types}/tests/DSShuttle.events.test.d.ts +0 -0
- package/{types → dist/types}/tests/DSShuttle.test.d.ts +0 -0
- package/{types → dist/types}/tests/utils.d.ts +0 -0
- package/dist/types/updateShuttleStateFromProps.d.ts +3 -0
- package/{types → dist/types}/utils.d.ts +0 -0
- package/{types → dist/types}/withProviders.d.ts +1 -0
- package/package.json +97 -89
- package/cjs/AnimationState.js +0 -48
- package/cjs/DSShuttle.js +0 -223
- package/cjs/SearchState.js +0 -41
- package/cjs/Shuttle.actions.js +0 -137
- package/cjs/ShuttleContainer.js +0 -87
- package/cjs/ShuttleImpl.js +0 -311
- package/cjs/ShuttleRenderer.js +0 -139
- package/cjs/ShuttleState.js +0 -80
- package/cjs/animation/animationConfig.js +0 -81
- package/cjs/classedComponents.js +0 -71
- package/cjs/components/LoadingIndicator.js +0 -25
- package/cjs/components/OverflowList.js +0 -53
- package/cjs/components/ShuttleBreadcrumb.js +0 -42
- package/cjs/components/ShuttleInfiniteScrollIndicator.js +0 -39
- package/cjs/components/ShuttleListItem/ActionButtons.js +0 -55
- package/cjs/components/ShuttleListItem/ShuttleListItem.js +0 -85
- package/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +0 -76
- package/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +0 -57
- package/cjs/components/ShuttleListPanel.js +0 -31
- package/cjs/components/ShuttleSearchBox.js +0 -110
- package/cjs/components/ShuttleSource.js +0 -188
- package/cjs/components/ShuttleTarget.js +0 -116
- package/cjs/components/VirtualizedItem.js +0 -46
- package/cjs/components/VirtualizedList.js +0 -93
- package/cjs/components/VirtualizedSortableList.js +0 -41
- package/cjs/helper.js +0 -117
- package/cjs/index.js +0 -12
- package/cjs/updateShuttleStateFromProps.js +0 -94
- package/cjs/utils.js +0 -43
- package/cjs/withProviders.js +0 -29
- package/esm/DSShuttle.js +0 -213
- package/esm/SearchState.js +0 -35
- package/esm/Shuttle.actions.js +0 -123
- package/esm/ShuttleContainer.js +0 -80
- package/esm/ShuttleImpl.js +0 -304
- package/esm/ShuttleRenderer.js +0 -132
- package/esm/ShuttleState.js +0 -74
- package/esm/animation/animationConfig.js +0 -77
- package/esm/classedComponents.js +0 -51
- package/esm/components/LoadingIndicator.js +0 -18
- package/esm/components/OverflowList.js +0 -46
- package/esm/components/ShuttleBreadcrumb.js +0 -35
- package/esm/components/ShuttleInfiniteScrollIndicator.js +0 -32
- package/esm/components/ShuttleListItem/ActionButtons.js +0 -43
- package/esm/components/ShuttleListItem/ShuttleListItem.js +0 -76
- package/esm/components/ShuttleListItem/ShuttleSourceListItem.js +0 -68
- package/esm/components/ShuttleListItem/ShuttleTargetListItem.js +0 -49
- package/esm/components/ShuttleListPanel.js +0 -24
- package/esm/components/ShuttleSearchBox.js +0 -104
- package/esm/components/ShuttleSource.js +0 -179
- package/esm/components/ShuttleTarget.js +0 -107
- package/esm/components/VirtualizedItem.js +0 -40
- package/esm/components/VirtualizedList.js +0 -84
- package/esm/components/VirtualizedSortableList.js +0 -34
- package/esm/helper.js +0 -78
- package/esm/index.js +0 -2
- package/esm/updateShuttleStateFromProps.js +0 -88
- package/esm/utils.js +0 -18
- package/esm/withProviders.js +0 -22
- package/types/ShuttleImpl.d.ts +0 -3
- package/types/index.d.ts +0 -1
- package/types/updateShuttleStateFromProps.d.ts +0 -1
package/esm/Shuttle.actions.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
2
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
3
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
4
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
6
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
8
|
-
import { addOrRemove, cloneDeep, compose, hashArray } from '@elliemae/ds-utilities';
|
|
9
|
-
import { toggleInObject, filterMovedItems, getHierarchyTypeName } from './helper.js';
|
|
10
|
-
import utils from './utils.js';
|
|
11
|
-
|
|
12
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
-
|
|
14
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
|
-
function toggleItemSelection(itemId) {
|
|
16
|
-
return state => _objectSpread(_objectSpread({}, state), {}, {
|
|
17
|
-
checkedItems: addOrRemove(state.checkedItems, itemId)
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
function navigateTo(item, dest) {
|
|
21
|
-
const hierarchyType = getHierarchyTypeName(dest);
|
|
22
|
-
return state => {
|
|
23
|
-
const indexInHierarchy = state[hierarchyType].findIndex(hItem => hItem.id === item.id);
|
|
24
|
-
const hierarchy = state[hierarchyType];
|
|
25
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
26
|
-
[hierarchyType]: indexInHierarchy !== -1 ? hierarchy.slice(0, indexInHierarchy + 1) : [...hierarchy, item]
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function moveItem(item) {
|
|
31
|
-
return state => {
|
|
32
|
-
const movedItems = toggleInObject(state.movedItems, item.id, item);
|
|
33
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
34
|
-
movedItems
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
const defaultOptions = {
|
|
39
|
-
parentField: 'parent',
|
|
40
|
-
idField: 'id',
|
|
41
|
-
op: hasMoved => !hasMoved
|
|
42
|
-
}; // todo: optimize this
|
|
43
|
-
|
|
44
|
-
function getItemDeep(_ref) {
|
|
45
|
-
let {
|
|
46
|
-
collection,
|
|
47
|
-
id,
|
|
48
|
-
options
|
|
49
|
-
} = _ref;
|
|
50
|
-
|
|
51
|
-
const {
|
|
52
|
-
idField
|
|
53
|
-
} = _objectSpread(_objectSpread({}, defaultOptions), options);
|
|
54
|
-
|
|
55
|
-
const itemIndex = collection.findIndex(fItem => fItem[idField] === id); // get item with nested children
|
|
56
|
-
|
|
57
|
-
const item = collection[itemIndex];
|
|
58
|
-
const children = item !== null && item !== void 0 && item.hasChildren ? compose(utils.getChildren({
|
|
59
|
-
index: itemIndex
|
|
60
|
-
}))(collection) || [] : [];
|
|
61
|
-
return {
|
|
62
|
-
item,
|
|
63
|
-
children
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function addToTarget(itemToAdd, collection) {
|
|
68
|
-
return (state, _ref2) => {
|
|
69
|
-
let {
|
|
70
|
-
idField
|
|
71
|
-
} = _ref2;
|
|
72
|
-
const items = collection || state.preparedItems;
|
|
73
|
-
const {
|
|
74
|
-
item,
|
|
75
|
-
children
|
|
76
|
-
} = getItemDeep({
|
|
77
|
-
collection: items,
|
|
78
|
-
id: itemToAdd[idField]
|
|
79
|
-
});
|
|
80
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
81
|
-
movedItems: [...state.movedItems, item],
|
|
82
|
-
targetItems: [...state.targetItems, item, ...children]
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
} // todo: optimize this
|
|
86
|
-
|
|
87
|
-
function removeFromTarget(itemToRemove) {
|
|
88
|
-
return (state, _ref3) => {
|
|
89
|
-
let {
|
|
90
|
-
idField
|
|
91
|
-
} = _ref3;
|
|
92
|
-
let targetItems = cloneDeep(state.targetItems);
|
|
93
|
-
const itemIndex = targetItems.findIndex(fItem => fItem.id === itemToRemove.id);
|
|
94
|
-
const item = targetItems[itemIndex];
|
|
95
|
-
const children = item !== null && item !== void 0 && item.hasChildren ? compose(filterMovedItems(state.movedItems), utils.getChildren({
|
|
96
|
-
index: itemIndex
|
|
97
|
-
}))(targetItems) || [] : [];
|
|
98
|
-
targetItems.splice(itemIndex, 1);
|
|
99
|
-
|
|
100
|
-
if (item !== null && item !== void 0 && item.hasChildren && children.length) {
|
|
101
|
-
const childrenHash = hashArray(children, 'id');
|
|
102
|
-
targetItems = targetItems.filter(i => !childrenHash[i.id]);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
106
|
-
movedItems: state.movedItems.filter(mItem => mItem[idField] !== itemToRemove[idField]),
|
|
107
|
-
targetItems
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
function resetCheckedItems() {
|
|
112
|
-
return state => _objectSpread(_objectSpread({}, state), {}, {
|
|
113
|
-
checkedItems: []
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
function resetMovedItems() {
|
|
117
|
-
return state => _objectSpread(_objectSpread({}, state), {}, {
|
|
118
|
-
movedItems: [],
|
|
119
|
-
targetItems: []
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export { addToTarget, moveItem, navigateTo, removeFromTarget, resetCheckedItems, resetMovedItems, toggleItemSelection };
|
package/esm/ShuttleContainer.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
4
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
5
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
6
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
7
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
8
|
-
import { useContext, useMemo } from 'react';
|
|
9
|
-
import { compose, sortBy, uniqBy, values, isFunction } from '@elliemae/ds-utilities';
|
|
10
|
-
import withProviders from './withProviders.js';
|
|
11
|
-
import { filterItemsByHierarchy, getActiveIdFromHierarchy, prepareItems, getItemsById } from './helper.js';
|
|
12
|
-
import SearchState from './SearchState.js';
|
|
13
|
-
import useShuttleState from './ShuttleState.js';
|
|
14
|
-
|
|
15
|
-
const _excluded = ["state"];
|
|
16
|
-
|
|
17
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
18
|
-
|
|
19
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
|
-
|
|
21
|
-
function filterItemsByTerm(items, term) {
|
|
22
|
-
return items.filter(item => item.name.toLowerCase().indexOf(String(term).toLowerCase()) !== -1 || String(item.id).indexOf(String(term).toLowerCase()) !== -1);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function ShuttleContainer(_ref) {
|
|
26
|
-
let {
|
|
27
|
-
items = [],
|
|
28
|
-
children
|
|
29
|
-
} = _ref;
|
|
30
|
-
|
|
31
|
-
const _useContext = useContext(useShuttleState.Context),
|
|
32
|
-
{
|
|
33
|
-
state: shuttleState
|
|
34
|
-
} = _useContext,
|
|
35
|
-
handlers = _objectWithoutProperties(_useContext, _excluded);
|
|
36
|
-
|
|
37
|
-
const {
|
|
38
|
-
state: searchState
|
|
39
|
-
} = useContext(SearchState.Context);
|
|
40
|
-
|
|
41
|
-
const {
|
|
42
|
-
movedItems,
|
|
43
|
-
hierarchy,
|
|
44
|
-
hierarchyDest,
|
|
45
|
-
checkedItems,
|
|
46
|
-
searchTerm,
|
|
47
|
-
searching,
|
|
48
|
-
toggleItemSelection,
|
|
49
|
-
resetCheckedItems,
|
|
50
|
-
resetMovedItems,
|
|
51
|
-
moveCheckedItems,
|
|
52
|
-
moveItem,
|
|
53
|
-
navigate
|
|
54
|
-
} = _objectSpread(_objectSpread(_objectSpread({}, shuttleState), searchState), handlers);
|
|
55
|
-
|
|
56
|
-
const sourceItems = useMemo(() => compose(items => items.filter(item => !movedItems[item.id]), items => searchTerm && searching ? filterItemsByTerm(items, searchTerm) : items, items => filterItemsByHierarchy(items, getActiveIdFromHierarchy(hierarchy).id), items => prepareItems(items))(items), [items, searchTerm, searching, hierarchy, movedItems]);
|
|
57
|
-
const targetItems = useMemo(() => {
|
|
58
|
-
const hierarchyId = getActiveIdFromHierarchy(hierarchyDest).id;
|
|
59
|
-
return compose(items => sortBy(items, ['name']), items => hierarchyId ? filterItemsByHierarchy(items, hierarchyId).filter(item => !movedItems[item.id]) : uniqBy(values(movedItems), 'id'))(items);
|
|
60
|
-
}, [items, searching, hierarchyDest, movedItems]);
|
|
61
|
-
return isFunction(children) && children({
|
|
62
|
-
checkedItems,
|
|
63
|
-
hierarchy,
|
|
64
|
-
hierarchyDest,
|
|
65
|
-
onCheckItem: toggleItemSelection,
|
|
66
|
-
onClearCheckedItems: resetCheckedItems,
|
|
67
|
-
onClearMovedItems: resetMovedItems,
|
|
68
|
-
onMoveCheckedItems: () => moveCheckedItems(getItemsById(checkedItems, items)),
|
|
69
|
-
onMoveItemToSource: item => moveItem(item, false),
|
|
70
|
-
onMoveItemToTarget: item => moveItem(item, true),
|
|
71
|
-
onNavigateOnSourceTo: item => navigate(item, false),
|
|
72
|
-
onNavigateOnTargetTo: item => navigate(item, true),
|
|
73
|
-
sourceItems,
|
|
74
|
-
targetItems
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
var ShuttleContainer$1 = withProviders(ShuttleContainer);
|
|
79
|
-
|
|
80
|
-
export { ShuttleContainer$1 as default };
|
package/esm/ShuttleImpl.js
DELETED
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
3
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
4
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
5
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
6
|
-
import 'core-js/modules/esnext.async-iterator.some.js';
|
|
7
|
-
import 'core-js/modules/esnext.iterator.some.js';
|
|
8
|
-
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
9
|
-
import 'core-js/modules/esnext.iterator.map.js';
|
|
10
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
11
|
-
import 'core-js/modules/esnext.async-iterator.find.js';
|
|
12
|
-
import 'core-js/modules/esnext.iterator.find.js';
|
|
13
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
14
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
15
|
-
import { Component } from 'react';
|
|
16
|
-
import { arrayMove, compose } from '@elliemae/ds-utilities';
|
|
17
|
-
import withProviders from './withProviders.js';
|
|
18
|
-
import { navigateTo, resetCheckedItems, resetMovedItems, addToTarget, removeFromTarget, toggleItemSelection } from './Shuttle.actions.js';
|
|
19
|
-
import { pipe, getItemsById, getActiveIdFromHierarchy, filterBySearch, filterMovedItems, getChildrenFromParent } from './helper.js';
|
|
20
|
-
import ShuttleRenderer from './ShuttleRenderer.js';
|
|
21
|
-
import SearchState from './SearchState.js';
|
|
22
|
-
import updateShuttleStateFromProps from './updateShuttleStateFromProps.js';
|
|
23
|
-
import { jsx } from 'react/jsx-runtime';
|
|
24
|
-
|
|
25
|
-
const _excluded = ["idField", "nonSelectedItems", "moreItemsLoading"];
|
|
26
|
-
|
|
27
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
28
|
-
|
|
29
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
30
|
-
|
|
31
|
-
class ShuttleImpl extends Component {
|
|
32
|
-
constructor(props) {
|
|
33
|
-
super(props);
|
|
34
|
-
|
|
35
|
-
this.getState = () => {
|
|
36
|
-
const {
|
|
37
|
-
movedItems
|
|
38
|
-
} = this.state;
|
|
39
|
-
return Object.keys(movedItems);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
this.state = {
|
|
43
|
-
prevProps: {},
|
|
44
|
-
preparedItems: [],
|
|
45
|
-
checkedItems: [],
|
|
46
|
-
// left breadcrumb
|
|
47
|
-
hierarchy: [{
|
|
48
|
-
name: props.sourceRootTitle,
|
|
49
|
-
id: null
|
|
50
|
-
}],
|
|
51
|
-
// right breadcrumb
|
|
52
|
-
hierarchyDest: [{
|
|
53
|
-
name: props.targetRootTitle,
|
|
54
|
-
id: null
|
|
55
|
-
}],
|
|
56
|
-
movedItems: [],
|
|
57
|
-
sourceItems: [],
|
|
58
|
-
targetItems: []
|
|
59
|
-
};
|
|
60
|
-
this.toggleItemSelection = this.toggleItemSelection.bind(this);
|
|
61
|
-
this.resetCheckedItems = this.resetCheckedItems.bind(this);
|
|
62
|
-
this.resetMovedItems = this.resetMovedItems.bind(this);
|
|
63
|
-
this.moveCheckedItems = this.moveCheckedItems.bind(this);
|
|
64
|
-
this.handleTargetSortEnd = this.handleTargetSortEnd.bind(this);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
static getDerivedStateFromProps(nextProps, prevState) {
|
|
68
|
-
return updateShuttleStateFromProps(nextProps, prevState);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
componentDidMount() {
|
|
72
|
-
const {
|
|
73
|
-
setGetStatus
|
|
74
|
-
} = this.props;
|
|
75
|
-
setGetStatus(this.getState);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
handleChange() {
|
|
79
|
-
const {
|
|
80
|
-
onChange
|
|
81
|
-
} = this.props;
|
|
82
|
-
const {
|
|
83
|
-
movedItems
|
|
84
|
-
} = this.state;
|
|
85
|
-
onChange(Object.keys(movedItems));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
navigate(item, dest, direction) {
|
|
89
|
-
const {
|
|
90
|
-
onDrillDown,
|
|
91
|
-
onDrillDownTarget
|
|
92
|
-
} = this.props;
|
|
93
|
-
if (!dest) onDrillDown(item, direction);
|
|
94
|
-
if (dest) onDrillDownTarget(item, direction);
|
|
95
|
-
const {
|
|
96
|
-
reset: resetSearchState
|
|
97
|
-
} = this.context;
|
|
98
|
-
resetSearchState();
|
|
99
|
-
this.setState(pipe([navigateTo(item, dest), resetCheckedItems()]));
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
resetCheckedItems() {
|
|
103
|
-
this.setState(resetCheckedItems());
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
resetMovedItems() {
|
|
107
|
-
const {
|
|
108
|
-
selectedItems,
|
|
109
|
-
onRemoveAllFromTarget
|
|
110
|
-
} = this.props;
|
|
111
|
-
|
|
112
|
-
if (!selectedItems) {
|
|
113
|
-
this.setState(pipe([navigateTo({
|
|
114
|
-
id: null
|
|
115
|
-
}, true), resetMovedItems()]), () => {
|
|
116
|
-
this.handleChange();
|
|
117
|
-
});
|
|
118
|
-
} else {
|
|
119
|
-
this.setState(pipe([navigateTo({
|
|
120
|
-
id: null
|
|
121
|
-
}, true)]));
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
onRemoveAllFromTarget();
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
addToTarget(item) {
|
|
128
|
-
const {
|
|
129
|
-
selectedItems,
|
|
130
|
-
onAddToTarget
|
|
131
|
-
} = this.props;
|
|
132
|
-
|
|
133
|
-
if (!selectedItems) {
|
|
134
|
-
this.setState(pipe([addToTarget(item), resetCheckedItems()]), () => {
|
|
135
|
-
this.handleChange();
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
onAddToTarget(item);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
removeFromTarget(item) {
|
|
143
|
-
const {
|
|
144
|
-
selectedItems,
|
|
145
|
-
onRemoveFromTarget
|
|
146
|
-
} = this.props;
|
|
147
|
-
|
|
148
|
-
if (!selectedItems) {
|
|
149
|
-
this.setState(pipe([removeFromTarget(item)]), () => {
|
|
150
|
-
this.handleChange();
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
onRemoveFromTarget(item);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
toggleItemSelection(item) {
|
|
158
|
-
this.setState(toggleItemSelection(item.id));
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
moveCheckedItems() {
|
|
162
|
-
const {
|
|
163
|
-
onAddCheckedItems,
|
|
164
|
-
selectedItems,
|
|
165
|
-
nonSelectedItems
|
|
166
|
-
} = this.props;
|
|
167
|
-
const {
|
|
168
|
-
checkedItems,
|
|
169
|
-
preparedItems
|
|
170
|
-
} = this.state;
|
|
171
|
-
const isControlledV2 = !!selectedItems && !!nonSelectedItems;
|
|
172
|
-
const checked = isControlledV2 ? nonSelectedItems.filter(item => checkedItems.some(check => check === item)) : checkedItems;
|
|
173
|
-
const items = getItemsById(checked, preparedItems);
|
|
174
|
-
const actions = !selectedItems ? items.map(item => addToTarget(item)) : [];
|
|
175
|
-
this.setState(pipe([...actions, resetCheckedItems()]), () => {
|
|
176
|
-
this.handleChange();
|
|
177
|
-
});
|
|
178
|
-
onAddCheckedItems(items);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
handleTargetSortEnd(_ref) {
|
|
182
|
-
let {
|
|
183
|
-
sourceItem,
|
|
184
|
-
targetItem
|
|
185
|
-
} = _ref;
|
|
186
|
-
const {
|
|
187
|
-
idField,
|
|
188
|
-
onTargetSortEnd
|
|
189
|
-
} = this.props;
|
|
190
|
-
const {
|
|
191
|
-
targetItems,
|
|
192
|
-
hierarchyDest,
|
|
193
|
-
movedItems
|
|
194
|
-
} = this.state;
|
|
195
|
-
const hierarchyId = getActiveIdFromHierarchy(hierarchyDest).id;
|
|
196
|
-
const collection = !hierarchyId ? movedItems : targetItems;
|
|
197
|
-
const oldIndex = collection.findIndex(tItem => tItem[idField] === sourceItem[idField]);
|
|
198
|
-
const newIndex = collection.findIndex(tItem => tItem[idField] === targetItem[idField]);
|
|
199
|
-
const sortedMovedItems = !hierarchyId ? arrayMove(movedItems, oldIndex, newIndex) : movedItems;
|
|
200
|
-
const sortedItems = hierarchyId ? arrayMove(targetItems, oldIndex, newIndex) : targetItems;
|
|
201
|
-
this.setState({
|
|
202
|
-
targetItems: sortedItems,
|
|
203
|
-
movedItems: sortedMovedItems
|
|
204
|
-
});
|
|
205
|
-
onTargetSortEnd({
|
|
206
|
-
sourceItem,
|
|
207
|
-
targetItem
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
render() {
|
|
212
|
-
const _this$props = this.props,
|
|
213
|
-
{
|
|
214
|
-
idField,
|
|
215
|
-
nonSelectedItems,
|
|
216
|
-
moreItemsLoading
|
|
217
|
-
} = _this$props,
|
|
218
|
-
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
219
|
-
|
|
220
|
-
const {
|
|
221
|
-
hierarchy,
|
|
222
|
-
hierarchyDest,
|
|
223
|
-
checkedItems,
|
|
224
|
-
movedItems,
|
|
225
|
-
preparedItems: items,
|
|
226
|
-
targetItems
|
|
227
|
-
} = this.state;
|
|
228
|
-
const {
|
|
229
|
-
state: {
|
|
230
|
-
searchTerm,
|
|
231
|
-
searching
|
|
232
|
-
}
|
|
233
|
-
} = this.context;
|
|
234
|
-
|
|
235
|
-
const handleControlledSourceItms = () => {
|
|
236
|
-
const {
|
|
237
|
-
id
|
|
238
|
-
} = getActiveIdFromHierarchy(hierarchy);
|
|
239
|
-
|
|
240
|
-
if (id) {
|
|
241
|
-
return filterBySearch(searchTerm, searching)(getChildrenFromParent(id)(nonSelectedItems.map(it => items.find(itt => itt.id === it))));
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
return filterBySearch(searchTerm, searching)(items.filter(it => nonSelectedItems.some(itt => itt === it.id && !nonSelectedItems.some(ittt => ittt === it.parent))));
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
let composedSourceItems; // controlled V2 TODO make it default controlled behavior
|
|
248
|
-
|
|
249
|
-
if (nonSelectedItems) {
|
|
250
|
-
composedSourceItems = handleControlledSourceItms();
|
|
251
|
-
} else {
|
|
252
|
-
composedSourceItems = compose(filterBySearch(searchTerm, searching), filterMovedItems(movedItems), getChildrenFromParent(getActiveIdFromHierarchy(hierarchy).id))(items);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
const handleControlledTargetItms = () => {
|
|
256
|
-
const {
|
|
257
|
-
id
|
|
258
|
-
} = getActiveIdFromHierarchy(hierarchyDest);
|
|
259
|
-
|
|
260
|
-
if (id) {
|
|
261
|
-
return getChildrenFromParent(getActiveIdFromHierarchy(hierarchyDest).id)(this.props.selectedItems.map(it => items.find(itt => itt.id === it)));
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
return targetItems.filter(it => this.props.selectedItems.some(itt => itt === it.id && !this.props.selectedItems.some(ittt => ittt === it.parent)));
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
let composedTargetItems; // controlled V2 TODO make it default controlled behavior
|
|
268
|
-
|
|
269
|
-
if (nonSelectedItems) {
|
|
270
|
-
composedTargetItems = handleControlledTargetItms();
|
|
271
|
-
} else {
|
|
272
|
-
composedTargetItems = compose(tItems => {
|
|
273
|
-
const hierarchyId = getActiveIdFromHierarchy(hierarchyDest).id;
|
|
274
|
-
return hierarchyId ? compose(filterMovedItems(movedItems), getChildrenFromParent(hierarchyId))(tItems) : movedItems;
|
|
275
|
-
})(targetItems);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
return /*#__PURE__*/jsx(ShuttleRenderer, _objectSpread(_objectSpread({}, rest), {}, {
|
|
279
|
-
moreItemsLoading: moreItemsLoading,
|
|
280
|
-
checkedItems: checkedItems,
|
|
281
|
-
hierarchy: hierarchy,
|
|
282
|
-
hierarchyDest: hierarchyDest,
|
|
283
|
-
onCheckItem: this.toggleItemSelection,
|
|
284
|
-
onClearCheckedItems: this.resetCheckedItems,
|
|
285
|
-
onClearMovedItems: this.resetMovedItems,
|
|
286
|
-
onItemCheck: this.toggleItemSelection,
|
|
287
|
-
onMoveCheckedItems: this.moveCheckedItems,
|
|
288
|
-
onMoveItemToSource: item => this.removeFromTarget(item, false),
|
|
289
|
-
onMoveItemToTarget: item => this.addToTarget(item, true),
|
|
290
|
-
onNavigateOnSourceTo: (item, direction) => this.navigate(item, false, direction),
|
|
291
|
-
onNavigateOnTargetTo: (item, direction) => this.navigate(item, true, direction),
|
|
292
|
-
onSourceSortEnd: () => null,
|
|
293
|
-
onTargetSortEnd: this.handleTargetSortEnd,
|
|
294
|
-
sourceItems: composedSourceItems,
|
|
295
|
-
targetItems: composedTargetItems
|
|
296
|
-
}));
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
ShuttleImpl.contextType = SearchState.Context;
|
|
302
|
-
var ShuttleImpl$1 = withProviders(ShuttleImpl);
|
|
303
|
-
|
|
304
|
-
export { ShuttleImpl$1 as default };
|
package/esm/ShuttleRenderer.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
-
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
-
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
-
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
-
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
-
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
8
|
-
import { useContext, useCallback } from 'react';
|
|
9
|
-
import ShuttleSource from './components/ShuttleSource.js';
|
|
10
|
-
import ShuttleTarget from './components/ShuttleTarget.js';
|
|
11
|
-
import { ShuttleContainer } from './classedComponents.js';
|
|
12
|
-
import AnimationContext from './AnimationState.js';
|
|
13
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
14
|
-
|
|
15
|
-
const _excluded = ["containerProps", "onNavigateOnTargetTo", "onNavigateOnSourceTo", "onMoveItemToSource", "onMoveItemToTarget", "onClearMovedItems", "onMoveCheckedItems", "onClearCheckedItems", "onToggleSearch", "onSearch", "onSearchClose", "onSearchOpen", "searching", "onCheckItem", "hierarchy", "hierarchyDest", "checkedItems", "sourceItems", "targetItems", "sourceEmptyMessage", "targetEmptyMessage", "composeTargetItemProps", "composeSourceItemProps", "targetSortable", "sourceSortable", "onSourceSortEnd", "onTargetSortEnd", "loadingSource", "loadingTarget", "onGetMoreItems", "moreItemsLoading", "hasNextPage"];
|
|
16
|
-
|
|
17
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
18
|
-
|
|
19
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
|
-
|
|
21
|
-
const noop = () => {};
|
|
22
|
-
|
|
23
|
-
function ShuttleRenderer(_ref) {
|
|
24
|
-
let {
|
|
25
|
-
containerProps,
|
|
26
|
-
onNavigateOnTargetTo = noop,
|
|
27
|
-
onNavigateOnSourceTo = noop,
|
|
28
|
-
onMoveItemToSource = noop,
|
|
29
|
-
onMoveItemToTarget = noop,
|
|
30
|
-
onClearMovedItems = noop,
|
|
31
|
-
onMoveCheckedItems = noop,
|
|
32
|
-
onClearCheckedItems = noop,
|
|
33
|
-
onToggleSearch = noop,
|
|
34
|
-
onSearch = noop,
|
|
35
|
-
onSearchClose = noop,
|
|
36
|
-
onSearchOpen = noop,
|
|
37
|
-
searching = false,
|
|
38
|
-
onCheckItem = noop,
|
|
39
|
-
hierarchy = [],
|
|
40
|
-
hierarchyDest = [],
|
|
41
|
-
checkedItems = [],
|
|
42
|
-
sourceItems = [],
|
|
43
|
-
targetItems = [],
|
|
44
|
-
sourceEmptyMessage,
|
|
45
|
-
targetEmptyMessage,
|
|
46
|
-
composeTargetItemProps,
|
|
47
|
-
composeSourceItemProps,
|
|
48
|
-
targetSortable,
|
|
49
|
-
sourceSortable,
|
|
50
|
-
onSourceSortEnd,
|
|
51
|
-
onTargetSortEnd,
|
|
52
|
-
loadingSource = false,
|
|
53
|
-
loadingTarget = false,
|
|
54
|
-
onGetMoreItems = () => {},
|
|
55
|
-
moreItemsLoading = false,
|
|
56
|
-
hasNextPage = false
|
|
57
|
-
} = _ref,
|
|
58
|
-
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
59
|
-
|
|
60
|
-
const {
|
|
61
|
-
setIsMoving,
|
|
62
|
-
setIsDrillingDown,
|
|
63
|
-
setIsMovingBack,
|
|
64
|
-
reset
|
|
65
|
-
} = useContext(AnimationContext.Context);
|
|
66
|
-
const removeAnimationState = useCallback(() => setTimeout(() => reset(), 500));
|
|
67
|
-
return /*#__PURE__*/jsxs(ShuttleContainer, _objectSpread(_objectSpread({
|
|
68
|
-
"data-testid": "em-ds-shuttle"
|
|
69
|
-
}, containerProps), {}, {
|
|
70
|
-
children: [/*#__PURE__*/jsx(ShuttleSource, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
71
|
-
checkedItems: checkedItems,
|
|
72
|
-
composeSourceItemProps: composeSourceItemProps,
|
|
73
|
-
emptyMessage: sourceEmptyMessage,
|
|
74
|
-
hierarchy: hierarchy,
|
|
75
|
-
items: sourceItems,
|
|
76
|
-
onCheckItem: onCheckItem,
|
|
77
|
-
onClearCheckedItems: onClearCheckedItems,
|
|
78
|
-
onMoveCheckedItems: item => {
|
|
79
|
-
setIsMoving(true);
|
|
80
|
-
onMoveCheckedItems(item);
|
|
81
|
-
},
|
|
82
|
-
onMoveItem: item => {
|
|
83
|
-
setIsMoving(true);
|
|
84
|
-
onMoveItemToTarget(item);
|
|
85
|
-
removeAnimationState();
|
|
86
|
-
},
|
|
87
|
-
onNavigateTo: function (item) {
|
|
88
|
-
let direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'down';
|
|
89
|
-
const indexInHierarchy = hierarchy.findIndex(hItem => hItem.id === item.id);
|
|
90
|
-
setIsDrillingDown(indexInHierarchy === -1);
|
|
91
|
-
onNavigateOnSourceTo(item, direction);
|
|
92
|
-
},
|
|
93
|
-
onSearch: onSearch,
|
|
94
|
-
onSearchClose: onSearchClose,
|
|
95
|
-
onSearchOpen: onSearchOpen,
|
|
96
|
-
onSortEnd: onSourceSortEnd,
|
|
97
|
-
onToggleSearch: onToggleSearch,
|
|
98
|
-
searching: searching,
|
|
99
|
-
sourceSortable: sourceSortable,
|
|
100
|
-
loading: loadingSource,
|
|
101
|
-
onGetMoreItems: onGetMoreItems,
|
|
102
|
-
moreItemsLoading: moreItemsLoading,
|
|
103
|
-
hasNextPage: hasNextPage
|
|
104
|
-
})), /*#__PURE__*/jsx(ShuttleTarget, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
105
|
-
composeTargetItemProps: composeTargetItemProps,
|
|
106
|
-
emptyMessage: targetEmptyMessage,
|
|
107
|
-
hierarchy: hierarchyDest,
|
|
108
|
-
items: targetItems,
|
|
109
|
-
onClearMovedItems: () => {
|
|
110
|
-
setIsMovingBack(true);
|
|
111
|
-
removeAnimationState();
|
|
112
|
-
onClearMovedItems();
|
|
113
|
-
},
|
|
114
|
-
onMoveItem: item => {
|
|
115
|
-
setIsMovingBack(true);
|
|
116
|
-
removeAnimationState();
|
|
117
|
-
onMoveItemToSource(item);
|
|
118
|
-
},
|
|
119
|
-
onNavigateTo: function (item) {
|
|
120
|
-
let direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'down';
|
|
121
|
-
const indexInHierarchy = hierarchyDest.findIndex(hItem => hItem.id === item.id);
|
|
122
|
-
setIsDrillingDown(indexInHierarchy === -1);
|
|
123
|
-
onNavigateOnTargetTo(item, direction);
|
|
124
|
-
},
|
|
125
|
-
onSortEnd: onTargetSortEnd,
|
|
126
|
-
targetSortable: targetSortable,
|
|
127
|
-
loading: loadingTarget
|
|
128
|
-
}))]
|
|
129
|
-
}));
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export { ShuttleRenderer as default };
|