@elliemae/ds-shuttle 1.55.0-next.7 → 2.0.0-alpha.10
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 +25 -42
- package/cjs/DSShuttle.js +89 -189
- package/cjs/SearchState.js +9 -22
- package/cjs/Shuttle.actions.js +57 -75
- package/cjs/ShuttleContainer.js +44 -79
- package/cjs/ShuttleImpl.js +236 -342
- package/cjs/ShuttleRenderer.js +114 -188
- package/cjs/ShuttleState.js +19 -41
- package/cjs/animation/animationConfig.js +58 -65
- package/cjs/classedComponents.js +37 -49
- package/cjs/components/LoadingIndicator.js +11 -12
- package/cjs/components/OverflowList.js +27 -34
- package/cjs/components/ShuttleBreadcrumb.js +23 -35
- package/cjs/components/ShuttleInfiniteScrollIndicator.js +21 -23
- package/cjs/components/ShuttleListItem/ActionButtons.js +34 -34
- package/cjs/components/ShuttleListItem/ShuttleListItem.js +57 -64
- package/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +34 -64
- package/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +30 -53
- package/cjs/components/ShuttleListPanel.js +11 -24
- package/cjs/components/ShuttleSearchBox.js +81 -107
- package/cjs/components/ShuttleSource.js +93 -175
- package/cjs/components/ShuttleTarget.js +55 -85
- package/cjs/components/VirtualizedItem.js +22 -22
- package/cjs/components/VirtualizedList.js +56 -66
- package/cjs/components/VirtualizedSortableList.js +20 -23
- package/cjs/helper.js +37 -89
- package/cjs/index.js +1 -64
- package/cjs/package.json +7 -0
- package/cjs/updateShuttleStateFromProps.js +31 -40
- package/cjs/utils.js +4 -9
- package/cjs/withProviders.js +10 -16
- package/esm/AnimationState.js +24 -40
- package/esm/DSShuttle.js +86 -186
- package/esm/SearchState.js +8 -20
- package/esm/Shuttle.actions.js +56 -73
- package/esm/ShuttleContainer.js +42 -77
- package/esm/ShuttleImpl.js +240 -337
- package/esm/ShuttleRenderer.js +110 -183
- package/esm/ShuttleState.js +14 -34
- package/esm/animation/animationConfig.js +58 -65
- package/esm/classedComponents.js +31 -43
- package/esm/components/LoadingIndicator.js +10 -11
- package/esm/components/OverflowList.js +23 -30
- package/esm/components/ShuttleBreadcrumb.js +21 -33
- package/esm/components/ShuttleInfiniteScrollIndicator.js +20 -22
- package/esm/components/ShuttleListItem/ActionButtons.js +32 -32
- package/esm/components/ShuttleListItem/ShuttleListItem.js +55 -62
- package/esm/components/ShuttleListItem/ShuttleSourceListItem.js +30 -59
- package/esm/components/ShuttleListItem/ShuttleTargetListItem.js +26 -49
- package/esm/components/ShuttleListPanel.js +10 -23
- package/esm/components/ShuttleSearchBox.js +79 -99
- package/esm/components/ShuttleSource.js +82 -162
- package/esm/components/ShuttleTarget.js +49 -79
- package/esm/components/VirtualizedItem.js +20 -20
- package/esm/components/VirtualizedList.js +52 -62
- package/esm/components/VirtualizedSortableList.js +16 -18
- package/esm/helper.js +35 -85
- package/esm/index.js +0 -63
- package/esm/package.json +7 -0
- package/esm/updateShuttleStateFromProps.js +30 -38
- package/esm/utils.js +1 -4
- package/esm/withProviders.js +8 -15
- package/package.json +150 -13
- package/types/AnimationState.d.ts +26 -0
- package/types/DSShuttle.d.ts +119 -0
- package/types/SearchState.d.ts +22 -0
- package/types/Shuttle.actions.d.ts +11 -0
- package/types/ShuttleContainer.d.ts +3 -0
- package/types/ShuttleImpl.d.ts +3 -0
- package/types/ShuttleRenderer.d.ts +37 -0
- package/types/ShuttleState.d.ts +53 -0
- package/types/animation/animationConfig.d.ts +68 -0
- package/types/classedComponents.d.ts +14 -0
- package/types/components/LoadingIndicator.d.ts +3 -0
- package/types/components/OverflowList.d.ts +7 -0
- package/types/components/ShuttleBreadcrumb.d.ts +7 -0
- package/types/components/ShuttleInfiniteScrollIndicator.d.ts +5 -0
- package/types/components/ShuttleListItem/ActionButtons.d.ts +4 -0
- package/types/components/ShuttleListItem/ShuttleListItem.d.ts +14 -0
- package/types/components/ShuttleListItem/ShuttleSourceListItem.d.ts +13 -0
- package/types/components/ShuttleListItem/ShuttleTargetListItem.d.ts +13 -0
- package/types/components/ShuttleListPanel.d.ts +7 -0
- package/types/components/ShuttleSearchBox.d.ts +20 -0
- package/types/components/ShuttleSource.d.ts +54 -0
- package/types/components/ShuttleTarget.d.ts +16 -0
- package/types/components/VirtualizedItem.d.ts +3 -0
- package/types/components/VirtualizedList.d.ts +12 -0
- package/types/components/VirtualizedSortableList.d.ts +6 -0
- package/types/helper.d.ts +16 -0
- package/types/index.d.ts +1 -0
- package/types/tests/DSShuttle.events.test.d.ts +1 -0
- package/types/tests/DSShuttle.test.d.ts +1 -0
- package/types/tests/utils.d.ts +116 -0
- package/types/updateShuttleStateFromProps.d.ts +1 -0
- package/types/utils.d.ts +2 -0
- package/types/withProviders.d.ts +3 -0
- package/AnimationState/package.json +0 -10
- package/DSShuttle/package.json +0 -10
- package/SearchState/package.json +0 -10
- package/Shuttle.actions/package.json +0 -10
- package/ShuttleContainer/package.json +0 -10
- package/ShuttleImpl/package.json +0 -10
- package/ShuttleRenderer/package.json +0 -10
- package/ShuttleState/package.json +0 -10
- package/animation/animationConfig/package.json +0 -10
- package/cjs/AnimationState.js.map +0 -1
- package/cjs/DSShuttle.js.map +0 -1
- package/cjs/SearchState.js.map +0 -1
- package/cjs/Shuttle.actions.js.map +0 -1
- package/cjs/ShuttleContainer.js.map +0 -1
- package/cjs/ShuttleImpl.js.map +0 -1
- package/cjs/ShuttleRenderer.js.map +0 -1
- package/cjs/ShuttleState.js.map +0 -1
- package/cjs/animation/animationConfig.js.map +0 -1
- package/cjs/classedComponents.js.map +0 -1
- package/cjs/components/LoadingIndicator.js.map +0 -1
- package/cjs/components/OverflowList.js.map +0 -1
- package/cjs/components/ShuttleBreadcrumb.js.map +0 -1
- package/cjs/components/ShuttleInfiniteScrollIndicator.js.map +0 -1
- package/cjs/components/ShuttleListItem/ActionButtons.js.map +0 -1
- package/cjs/components/ShuttleListItem/ShuttleListItem.js.map +0 -1
- package/cjs/components/ShuttleListItem/ShuttleSourceListItem.js.map +0 -1
- package/cjs/components/ShuttleListItem/ShuttleTargetListItem.js.map +0 -1
- package/cjs/components/ShuttleListPanel.js.map +0 -1
- package/cjs/components/ShuttleSearchBox.js.map +0 -1
- package/cjs/components/ShuttleSource.js.map +0 -1
- package/cjs/components/ShuttleTarget.js.map +0 -1
- package/cjs/components/VirtualizedItem.js.map +0 -1
- package/cjs/components/VirtualizedList.js.map +0 -1
- package/cjs/components/VirtualizedSortableList.js.map +0 -1
- package/cjs/helper.js.map +0 -1
- package/cjs/index.js.map +0 -1
- package/cjs/tests/utils.js +0 -1112
- package/cjs/tests/utils.js.map +0 -1
- package/cjs/updateShuttleStateFromProps.js.map +0 -1
- package/cjs/utils.js.map +0 -1
- package/cjs/withProviders.js.map +0 -1
- package/classedComponents/package.json +0 -10
- package/components/LoadingIndicator/package.json +0 -10
- package/components/OverflowList/package.json +0 -10
- package/components/ShuttleBreadcrumb/package.json +0 -10
- package/components/ShuttleInfiniteScrollIndicator/package.json +0 -10
- package/components/ShuttleListItem/ActionButtons/package.json +0 -10
- package/components/ShuttleListItem/ShuttleListItem/package.json +0 -10
- package/components/ShuttleListItem/ShuttleSourceListItem/package.json +0 -10
- package/components/ShuttleListItem/ShuttleTargetListItem/package.json +0 -10
- package/components/ShuttleListPanel/package.json +0 -10
- package/components/ShuttleSearchBox/package.json +0 -10
- package/components/ShuttleSource/package.json +0 -10
- package/components/ShuttleTarget/package.json +0 -10
- package/components/VirtualizedItem/package.json +0 -10
- package/components/VirtualizedList/package.json +0 -10
- package/components/VirtualizedSortableList/package.json +0 -10
- package/esm/AnimationState.js.map +0 -1
- package/esm/DSShuttle.js.map +0 -1
- package/esm/SearchState.js.map +0 -1
- package/esm/Shuttle.actions.js.map +0 -1
- package/esm/ShuttleContainer.js.map +0 -1
- package/esm/ShuttleImpl.js.map +0 -1
- package/esm/ShuttleRenderer.js.map +0 -1
- package/esm/ShuttleState.js.map +0 -1
- package/esm/animation/animationConfig.js.map +0 -1
- package/esm/classedComponents.js.map +0 -1
- package/esm/components/LoadingIndicator.js.map +0 -1
- package/esm/components/OverflowList.js.map +0 -1
- package/esm/components/ShuttleBreadcrumb.js.map +0 -1
- package/esm/components/ShuttleInfiniteScrollIndicator.js.map +0 -1
- package/esm/components/ShuttleListItem/ActionButtons.js.map +0 -1
- package/esm/components/ShuttleListItem/ShuttleListItem.js.map +0 -1
- package/esm/components/ShuttleListItem/ShuttleSourceListItem.js.map +0 -1
- package/esm/components/ShuttleListItem/ShuttleTargetListItem.js.map +0 -1
- package/esm/components/ShuttleListPanel.js.map +0 -1
- package/esm/components/ShuttleSearchBox.js.map +0 -1
- package/esm/components/ShuttleSource.js.map +0 -1
- package/esm/components/ShuttleTarget.js.map +0 -1
- package/esm/components/VirtualizedItem.js.map +0 -1
- package/esm/components/VirtualizedList.js.map +0 -1
- package/esm/components/VirtualizedSortableList.js.map +0 -1
- package/esm/helper.js.map +0 -1
- package/esm/index.js.map +0 -1
- package/esm/tests/utils.js +0 -1100
- package/esm/tests/utils.js.map +0 -1
- package/esm/updateShuttleStateFromProps.js.map +0 -1
- package/esm/utils.js.map +0 -1
- package/esm/withProviders.js.map +0 -1
- package/helper/package.json +0 -10
- package/tests/utils/package.json +0 -10
- package/updateShuttleStateFromProps/package.json +0 -10
- package/utils/package.json +0 -10
- package/withProviders/package.json +0 -10
package/cjs/withProviders.js
CHANGED
|
@@ -1,30 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
|
+
require('react');
|
|
4
6
|
var AnimationState = require('./AnimationState.js');
|
|
5
7
|
var SearchState = require('./SearchState.js');
|
|
6
8
|
var ShuttleState = require('./ShuttleState.js');
|
|
7
|
-
require('
|
|
8
|
-
require('constate');
|
|
9
|
-
require('@babel/runtime/helpers/toConsumableArray');
|
|
10
|
-
require('./helper.js');
|
|
11
|
-
require('@babel/runtime/helpers/defineProperty');
|
|
12
|
-
require('@elliemae/ds-utilities/utils');
|
|
13
|
-
require('treetabular');
|
|
14
|
-
require('./Shuttle.actions.js');
|
|
15
|
-
require('./utils.js');
|
|
9
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
16
10
|
|
|
17
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
12
|
|
|
19
|
-
var
|
|
13
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
14
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
20
15
|
|
|
21
|
-
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
22
19
|
|
|
23
20
|
function withProviders(Component) {
|
|
24
|
-
return
|
|
25
|
-
return /*#__PURE__*/React__default['default'].createElement(ShuttleState.Provider, null, /*#__PURE__*/React__default['default'].createElement(AnimationState.Provider, null, /*#__PURE__*/React__default['default'].createElement(SearchState.Provider, null, /*#__PURE__*/React__default['default'].createElement(Component, props))));
|
|
26
|
-
};
|
|
21
|
+
return props => /*#__PURE__*/_jsx__default["default"](ShuttleState.Provider, {}, void 0, /*#__PURE__*/_jsx__default["default"](AnimationState.Provider, {}, void 0, /*#__PURE__*/_jsx__default["default"](SearchState.Provider, {}, void 0, /*#__PURE__*/jsxRuntime.jsx(Component, _objectSpread({}, props)))));
|
|
27
22
|
}
|
|
28
23
|
|
|
29
24
|
module.exports = withProviders;
|
|
30
|
-
//# sourceMappingURL=withProviders.js.map
|
package/esm/AnimationState.js
CHANGED
|
@@ -1,57 +1,41 @@
|
|
|
1
|
-
import _slicedToArray from '@babel/runtime/helpers/esm/slicedToArray';
|
|
2
1
|
import { useState, useCallback } from 'react';
|
|
3
2
|
import createContainer from 'constate';
|
|
4
3
|
|
|
5
4
|
function useShuttleAnimationState() {
|
|
6
|
-
|
|
5
|
+
const [animationState, setAnimationState] = useState({
|
|
7
6
|
isMoving: false,
|
|
8
7
|
isMovingBack: false,
|
|
9
8
|
isDrillingDown: false
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
isMovingBack: true,
|
|
32
|
-
isMoving: false,
|
|
33
|
-
isDrillingDown: false
|
|
34
|
-
});
|
|
35
|
-
}, []);
|
|
36
|
-
var drilldown = useCallback(function () {
|
|
37
|
-
return setAnimationState({
|
|
38
|
-
isMovingBack: false,
|
|
39
|
-
isMoving: false,
|
|
40
|
-
isDrillingDown: true
|
|
41
|
-
});
|
|
42
|
-
}, []);
|
|
9
|
+
});
|
|
10
|
+
const reset = useCallback(() => setAnimationState({
|
|
11
|
+
isMoving: false,
|
|
12
|
+
isMovingBack: false,
|
|
13
|
+
isDrillingDown: false
|
|
14
|
+
}), []);
|
|
15
|
+
const move = useCallback(() => setAnimationState({
|
|
16
|
+
isMovingBack: false,
|
|
17
|
+
isMoving: true,
|
|
18
|
+
isDrillingDown: false
|
|
19
|
+
}), []);
|
|
20
|
+
const moveBack = useCallback(() => setAnimationState({
|
|
21
|
+
isMovingBack: true,
|
|
22
|
+
isMoving: false,
|
|
23
|
+
isDrillingDown: false
|
|
24
|
+
}), []);
|
|
25
|
+
const drilldown = useCallback(() => setAnimationState({
|
|
26
|
+
isMovingBack: false,
|
|
27
|
+
isMoving: false,
|
|
28
|
+
isDrillingDown: true
|
|
29
|
+
}), []);
|
|
43
30
|
return {
|
|
44
31
|
state: animationState,
|
|
45
32
|
setIsMoving: move,
|
|
46
33
|
setIsMovingBack: moveBack,
|
|
47
34
|
setIsDrillingDown: drilldown,
|
|
48
|
-
reset
|
|
35
|
+
reset
|
|
49
36
|
};
|
|
50
37
|
}
|
|
51
38
|
|
|
52
|
-
var AnimationContext = createContainer(useShuttleAnimationState,
|
|
53
|
-
return [value.state];
|
|
54
|
-
});
|
|
39
|
+
var AnimationContext = createContainer(useShuttleAnimationState, value => [value.state]);
|
|
55
40
|
|
|
56
41
|
export { AnimationContext as default };
|
|
57
|
-
//# sourceMappingURL=AnimationState.js.map
|
package/esm/DSShuttle.js
CHANGED
|
@@ -1,192 +1,94 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
2
3
|
import { debounce } from 'lodash';
|
|
3
4
|
import { PropTypes, describe } from 'react-desc';
|
|
4
5
|
import { TooltipTextProvider } from '@elliemae/ds-basic/TruncatedTooltipText';
|
|
5
6
|
import ShuttleImpl from './ShuttleImpl.js';
|
|
6
7
|
export { default as utils } from './utils.js';
|
|
7
|
-
import '@babel/runtime/helpers/esm/extends';
|
|
8
|
-
import '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
9
|
-
import '@babel/runtime/helpers/esm/toConsumableArray';
|
|
10
|
-
import '@babel/runtime/helpers/esm/classCallCheck';
|
|
11
|
-
import '@babel/runtime/helpers/esm/createClass';
|
|
12
|
-
import '@babel/runtime/helpers/esm/assertThisInitialized';
|
|
13
|
-
import '@babel/runtime/helpers/esm/inherits';
|
|
14
|
-
import '@babel/runtime/helpers/esm/possibleConstructorReturn';
|
|
15
|
-
import '@babel/runtime/helpers/esm/getPrototypeOf';
|
|
16
|
-
import '@babel/runtime/helpers/esm/defineProperty';
|
|
17
|
-
import '@elliemae/ds-utilities/utils';
|
|
18
|
-
import './withProviders.js';
|
|
19
|
-
import './AnimationState.js';
|
|
20
|
-
import '@babel/runtime/helpers/esm/slicedToArray';
|
|
21
|
-
import 'constate';
|
|
22
|
-
import './SearchState.js';
|
|
23
|
-
import './ShuttleState.js';
|
|
24
|
-
import './helper.js';
|
|
25
|
-
import 'treetabular';
|
|
26
|
-
import './Shuttle.actions.js';
|
|
27
|
-
import './ShuttleRenderer.js';
|
|
28
|
-
import './components/ShuttleSource.js';
|
|
29
|
-
import 'prop-types';
|
|
30
|
-
import '@elliemae/ds-icons/ArrowShortRight';
|
|
31
|
-
import '@elliemae/ds-basic/Button';
|
|
32
|
-
import '@elliemae/ds-icons/Search';
|
|
33
|
-
import './components/ShuttleSearchBox.js';
|
|
34
|
-
import '@elliemae/ds-classnames';
|
|
35
|
-
import '@elliemae/ds-basic/form/TextBox';
|
|
36
|
-
import './components/ShuttleInfiniteScrollIndicator.js';
|
|
37
|
-
import '@elliemae/ds-basic/IndeterminateProgressIndicator';
|
|
38
|
-
import './components/ShuttleListItem/ShuttleSourceListItem.js';
|
|
39
|
-
import './components/ShuttleListItem/ActionButtons.js';
|
|
40
|
-
import '@elliemae/ds-icons/CloseCircle';
|
|
41
|
-
import '@elliemae/ds-icons/ArrowShortReturn';
|
|
42
|
-
import './components/ShuttleListItem/ShuttleListItem.js';
|
|
43
|
-
import 'react-spring/web.cjs';
|
|
44
|
-
import 'react-sortable-hoc';
|
|
45
|
-
import '@elliemae/ds-icons/GripperVertical';
|
|
46
|
-
import './classedComponents.js';
|
|
47
|
-
import './components/ShuttleBreadcrumb.js';
|
|
48
|
-
import '@elliemae/ds-basic/Breadcrumb';
|
|
49
|
-
import './animation/animationConfig.js';
|
|
50
|
-
import './components/OverflowList.js';
|
|
51
|
-
import './components/ShuttleListPanel.js';
|
|
52
|
-
import './components/VirtualizedList.js';
|
|
53
|
-
import 'react-window';
|
|
54
|
-
import 'react-window-infinite-loader';
|
|
55
|
-
import 'react-virtualized-auto-sizer';
|
|
56
|
-
import './components/VirtualizedItem.js';
|
|
57
|
-
import './components/VirtualizedSortableList.js';
|
|
58
|
-
import './components/LoadingIndicator.js';
|
|
59
|
-
import '@elliemae/ds-basic/CircularProgressIndicator';
|
|
60
|
-
import 'styled-components';
|
|
61
|
-
import './components/ShuttleTarget.js';
|
|
62
|
-
import './components/ShuttleListItem/ShuttleTargetListItem.js';
|
|
63
|
-
import './updateShuttleStateFromProps.js';
|
|
64
|
-
|
|
65
|
-
/* eslint-disable max-lines */
|
|
66
|
-
|
|
67
|
-
var noop = function noop() {};
|
|
68
|
-
|
|
69
|
-
var DSShuttle = function DSShuttle(_ref) {
|
|
70
|
-
var _ref$containerProps = _ref.containerProps,
|
|
71
|
-
containerProps = _ref$containerProps === void 0 ? {} : _ref$containerProps,
|
|
72
|
-
_ref$idField = _ref.idField,
|
|
73
|
-
idField = _ref$idField === void 0 ? 'id' : _ref$idField,
|
|
74
|
-
_ref$parentIdField = _ref.parentIdField,
|
|
75
|
-
parentIdField = _ref$parentIdField === void 0 ? 'parent' : _ref$parentIdField,
|
|
76
|
-
_ref$showIcons = _ref.showIcons,
|
|
77
|
-
showIcons = _ref$showIcons === void 0 ? true : _ref$showIcons,
|
|
78
|
-
_ref$items = _ref.items,
|
|
79
|
-
items = _ref$items === void 0 ? [] : _ref$items,
|
|
80
|
-
_ref$selectedItems = _ref.selectedItems,
|
|
81
|
-
selectedItems = _ref$selectedItems === void 0 ? undefined : _ref$selectedItems,
|
|
82
|
-
_ref$nonSelectedItems = _ref.nonSelectedItems,
|
|
83
|
-
nonSelectedItems = _ref$nonSelectedItems === void 0 ? undefined : _ref$nonSelectedItems,
|
|
84
|
-
_ref$onSearch = _ref.onSearch,
|
|
85
|
-
onSearch = _ref$onSearch === void 0 ? noop : _ref$onSearch,
|
|
86
|
-
_ref$onSearchOpen = _ref.onSearchOpen,
|
|
87
|
-
onSearchOpen = _ref$onSearchOpen === void 0 ? noop : _ref$onSearchOpen,
|
|
88
|
-
_ref$onSearchClose = _ref.onSearchClose,
|
|
89
|
-
onSearchClose = _ref$onSearchClose === void 0 ? noop : _ref$onSearchClose,
|
|
90
|
-
_ref$onDrillDown = _ref.onDrillDown,
|
|
91
|
-
onDrillDown = _ref$onDrillDown === void 0 ? noop : _ref$onDrillDown,
|
|
92
|
-
_ref$onDrillDownTarge = _ref.onDrillDownTarget,
|
|
93
|
-
onDrillDownTarget = _ref$onDrillDownTarge === void 0 ? noop : _ref$onDrillDownTarge,
|
|
94
|
-
_ref$onTargetSortEnd = _ref.onTargetSortEnd,
|
|
95
|
-
onTargetSortEnd = _ref$onTargetSortEnd === void 0 ? noop : _ref$onTargetSortEnd,
|
|
96
|
-
_ref$setGetStatus = _ref.setGetStatus,
|
|
97
|
-
setGetStatus = _ref$setGetStatus === void 0 ? noop : _ref$setGetStatus,
|
|
98
|
-
_ref$targetSortable = _ref.targetSortable,
|
|
99
|
-
targetSortable = _ref$targetSortable === void 0 ? true : _ref$targetSortable,
|
|
100
|
-
_ref$sourceEmptyMessa = _ref.sourceEmptyMessage,
|
|
101
|
-
sourceEmptyMessage = _ref$sourceEmptyMessa === void 0 ? 'No Items Found' : _ref$sourceEmptyMessa,
|
|
102
|
-
_ref$sourceRootTitle = _ref.sourceRootTitle,
|
|
103
|
-
sourceRootTitle = _ref$sourceRootTitle === void 0 ? 'Category' : _ref$sourceRootTitle,
|
|
104
|
-
_ref$targetEmptyMessa = _ref.targetEmptyMessage,
|
|
105
|
-
targetEmptyMessage = _ref$targetEmptyMessa === void 0 ? 'No Items Selected' : _ref$targetEmptyMessa,
|
|
106
|
-
_ref$targetRootTitle = _ref.targetRootTitle,
|
|
107
|
-
targetRootTitle = _ref$targetRootTitle === void 0 ? 'Selected Items' : _ref$targetRootTitle,
|
|
108
|
-
_ref$composeSourceIte = _ref.composeSourceItemProps,
|
|
109
|
-
composeSourceItemProps = _ref$composeSourceIte === void 0 ? function () {
|
|
110
|
-
return {};
|
|
111
|
-
} : _ref$composeSourceIte,
|
|
112
|
-
_ref$composeTargetIte = _ref.composeTargetItemProps,
|
|
113
|
-
composeTargetItemProps = _ref$composeTargetIte === void 0 ? function () {
|
|
114
|
-
return {};
|
|
115
|
-
} : _ref$composeTargetIte,
|
|
116
|
-
_ref$onAddToTarget = _ref.onAddToTarget,
|
|
117
|
-
onAddToTarget = _ref$onAddToTarget === void 0 ? noop : _ref$onAddToTarget,
|
|
118
|
-
_ref$onAddCheckedItem = _ref.onAddCheckedItems,
|
|
119
|
-
onAddCheckedItems = _ref$onAddCheckedItem === void 0 ? noop : _ref$onAddCheckedItem,
|
|
120
|
-
_ref$onRemoveFromTarg = _ref.onRemoveFromTarget,
|
|
121
|
-
onRemoveFromTarget = _ref$onRemoveFromTarg === void 0 ? noop : _ref$onRemoveFromTarg,
|
|
122
|
-
_ref$onRemoveAllFromT = _ref.onRemoveAllFromTarget,
|
|
123
|
-
onRemoveAllFromTarget = _ref$onRemoveAllFromT === void 0 ? noop : _ref$onRemoveAllFromT,
|
|
124
|
-
_ref$onChange = _ref.onChange,
|
|
125
|
-
onChange = _ref$onChange === void 0 ? noop : _ref$onChange,
|
|
126
|
-
_ref$renderSourceCoun = _ref.renderSourceCounter,
|
|
127
|
-
renderSourceCounter = _ref$renderSourceCoun === void 0 ? noop : _ref$renderSourceCoun,
|
|
128
|
-
_ref$renderTargetCoun = _ref.renderTargetCounter,
|
|
129
|
-
renderTargetCounter = _ref$renderTargetCoun === void 0 ? noop : _ref$renderTargetCoun,
|
|
130
|
-
_ref$sourceClearItems = _ref.sourceClearItemsText,
|
|
131
|
-
sourceClearItemsText = _ref$sourceClearItems === void 0 ? 'CLEAR ALL' : _ref$sourceClearItems,
|
|
132
|
-
_ref$targetClearItems = _ref.targetClearItemsText,
|
|
133
|
-
targetClearItemsText = _ref$targetClearItems === void 0 ? 'CLEAR ALL' : _ref$targetClearItems,
|
|
134
|
-
_ref$searchPlaceholde = _ref.searchPlaceholder,
|
|
135
|
-
searchPlaceholder = _ref$searchPlaceholde === void 0 ? 'Search field ID, name, etc.' : _ref$searchPlaceholde,
|
|
136
|
-
_ref$loadingSource = _ref.loadingSource,
|
|
137
|
-
loadingSource = _ref$loadingSource === void 0 ? false : _ref$loadingSource,
|
|
138
|
-
_ref$loadingTarget = _ref.loadingTarget,
|
|
139
|
-
loadingTarget = _ref$loadingTarget === void 0 ? false : _ref$loadingTarget,
|
|
140
|
-
_ref$onGetMoreItems = _ref.onGetMoreItems,
|
|
141
|
-
onGetMoreItems = _ref$onGetMoreItems === void 0 ? function () {
|
|
142
|
-
return null;
|
|
143
|
-
} : _ref$onGetMoreItems,
|
|
144
|
-
_ref$hasNextPage = _ref.hasNextPage,
|
|
145
|
-
hasNextPage = _ref$hasNextPage === void 0 ? false : _ref$hasNextPage,
|
|
146
|
-
moreItemsLoading = _ref.moreItemsLoading;
|
|
147
|
-
return /*#__PURE__*/React.createElement(TooltipTextProvider, null, /*#__PURE__*/React.createElement(ShuttleImpl, {
|
|
148
|
-
composeSourceItemProps: composeSourceItemProps,
|
|
149
|
-
composeTargetItemProps: composeTargetItemProps,
|
|
150
|
-
containerProps: containerProps,
|
|
151
|
-
idField: idField,
|
|
152
|
-
items: items,
|
|
153
|
-
onAddCheckedItems: onAddCheckedItems,
|
|
154
|
-
onAddToTarget: onAddToTarget,
|
|
155
|
-
onChange: onChange,
|
|
156
|
-
onDrillDown: onDrillDown,
|
|
157
|
-
nonSelectedItems: nonSelectedItems,
|
|
158
|
-
onDrillDownTarget: onDrillDownTarget,
|
|
159
|
-
onRemoveAllFromTarget: onRemoveAllFromTarget,
|
|
160
|
-
onRemoveFromTarget: onRemoveFromTarget,
|
|
161
|
-
onSearch: onSearch,
|
|
162
|
-
onSearchClose: onSearchClose,
|
|
163
|
-
onSearchOpen: onSearchOpen,
|
|
164
|
-
onTargetSortEnd: onTargetSortEnd,
|
|
165
|
-
parentIdField: parentIdField,
|
|
166
|
-
renderSourceCounter: renderSourceCounter,
|
|
167
|
-
renderTargetCounter: renderTargetCounter,
|
|
168
|
-
searchPlaceholder: searchPlaceholder,
|
|
169
|
-
selectedItems: selectedItems,
|
|
170
|
-
setGetStatus: setGetStatus,
|
|
171
|
-
showIcons: showIcons,
|
|
172
|
-
sourceClearItemsText: sourceClearItemsText,
|
|
173
|
-
sourceEmptyMessage: sourceEmptyMessage,
|
|
174
|
-
sourceRootTitle: sourceRootTitle,
|
|
175
|
-
targetClearItemsText: targetClearItemsText,
|
|
176
|
-
targetEmptyMessage: targetEmptyMessage,
|
|
177
|
-
targetRootTitle: targetRootTitle,
|
|
178
|
-
targetSortable: targetSortable,
|
|
179
|
-
loadingSource: loadingSource,
|
|
180
|
-
loadingTarget: loadingTarget,
|
|
181
|
-
onGetMoreItems: debounce(function () {
|
|
182
|
-
onGetMoreItems.apply(void 0, arguments);
|
|
183
|
-
}, 500),
|
|
184
|
-
moreItemsLoading: moreItemsLoading,
|
|
185
|
-
hasNextPage: hasNextPage
|
|
186
|
-
}));
|
|
187
|
-
};
|
|
188
8
|
|
|
189
|
-
|
|
9
|
+
const noop = () => {};
|
|
10
|
+
|
|
11
|
+
const DSShuttle = ({
|
|
12
|
+
containerProps = {},
|
|
13
|
+
idField = 'id',
|
|
14
|
+
parentIdField = 'parent',
|
|
15
|
+
showIcons = true,
|
|
16
|
+
items = [],
|
|
17
|
+
selectedItems = undefined,
|
|
18
|
+
// if defined it becomes controlled (v1)
|
|
19
|
+
// TODO make `nonSelectedItems` the default controlled behavior (v2)
|
|
20
|
+
nonSelectedItems = undefined,
|
|
21
|
+
onSearch = noop,
|
|
22
|
+
onSearchOpen = noop,
|
|
23
|
+
onSearchClose = noop,
|
|
24
|
+
onDrillDown = noop,
|
|
25
|
+
onDrillDownTarget = noop,
|
|
26
|
+
onTargetSortEnd = noop,
|
|
27
|
+
setGetStatus = noop,
|
|
28
|
+
targetSortable = true,
|
|
29
|
+
sourceEmptyMessage = 'No Items Found',
|
|
30
|
+
sourceRootTitle = 'Category',
|
|
31
|
+
targetEmptyMessage = 'No Items Selected',
|
|
32
|
+
targetRootTitle = 'Selected Items',
|
|
33
|
+
composeSourceItemProps = () => ({}),
|
|
34
|
+
composeTargetItemProps = () => ({}),
|
|
35
|
+
onAddToTarget = noop,
|
|
36
|
+
onAddCheckedItems = noop,
|
|
37
|
+
onRemoveFromTarget = noop,
|
|
38
|
+
onRemoveAllFromTarget = noop,
|
|
39
|
+
onChange = noop,
|
|
40
|
+
renderSourceCounter = noop,
|
|
41
|
+
renderTargetCounter = noop,
|
|
42
|
+
sourceClearItemsText = 'CLEAR ALL',
|
|
43
|
+
targetClearItemsText = 'CLEAR ALL',
|
|
44
|
+
searchPlaceholder = 'Search field ID, name, etc.',
|
|
45
|
+
loadingSource = false,
|
|
46
|
+
loadingTarget = false,
|
|
47
|
+
onGetMoreItems = () => null,
|
|
48
|
+
hasNextPage = false,
|
|
49
|
+
moreItemsLoading
|
|
50
|
+
}) => /*#__PURE__*/_jsx(TooltipTextProvider, {}, void 0, /*#__PURE__*/_jsx(ShuttleImpl, {
|
|
51
|
+
composeSourceItemProps: composeSourceItemProps,
|
|
52
|
+
composeTargetItemProps: composeTargetItemProps,
|
|
53
|
+
containerProps: containerProps,
|
|
54
|
+
idField: idField,
|
|
55
|
+
items: items,
|
|
56
|
+
onAddCheckedItems: onAddCheckedItems,
|
|
57
|
+
onAddToTarget: onAddToTarget,
|
|
58
|
+
onChange: onChange,
|
|
59
|
+
onDrillDown: onDrillDown,
|
|
60
|
+
nonSelectedItems: nonSelectedItems,
|
|
61
|
+
onDrillDownTarget: onDrillDownTarget,
|
|
62
|
+
onRemoveAllFromTarget: onRemoveAllFromTarget,
|
|
63
|
+
onRemoveFromTarget: onRemoveFromTarget,
|
|
64
|
+
onSearch: onSearch,
|
|
65
|
+
onSearchClose: onSearchClose,
|
|
66
|
+
onSearchOpen: onSearchOpen,
|
|
67
|
+
onTargetSortEnd: onTargetSortEnd,
|
|
68
|
+
parentIdField: parentIdField,
|
|
69
|
+
renderSourceCounter: renderSourceCounter,
|
|
70
|
+
renderTargetCounter: renderTargetCounter,
|
|
71
|
+
searchPlaceholder: searchPlaceholder,
|
|
72
|
+
selectedItems: selectedItems,
|
|
73
|
+
setGetStatus: setGetStatus,
|
|
74
|
+
showIcons: showIcons,
|
|
75
|
+
sourceClearItemsText: sourceClearItemsText,
|
|
76
|
+
sourceEmptyMessage: sourceEmptyMessage,
|
|
77
|
+
sourceRootTitle: sourceRootTitle,
|
|
78
|
+
targetClearItemsText: targetClearItemsText,
|
|
79
|
+
targetEmptyMessage: targetEmptyMessage,
|
|
80
|
+
targetRootTitle: targetRootTitle,
|
|
81
|
+
targetSortable: targetSortable,
|
|
82
|
+
loadingSource: loadingSource,
|
|
83
|
+
loadingTarget: loadingTarget,
|
|
84
|
+
onGetMoreItems: debounce((...args) => {
|
|
85
|
+
onGetMoreItems(...args);
|
|
86
|
+
}, 500),
|
|
87
|
+
moreItemsLoading: moreItemsLoading,
|
|
88
|
+
hasNextPage: hasNextPage
|
|
89
|
+
}));
|
|
90
|
+
|
|
91
|
+
const props = {
|
|
190
92
|
/** inject props to shuttle wrapper */
|
|
191
93
|
containerProps: PropTypes.object.description('inject props to shuttle wrapper'),
|
|
192
94
|
|
|
@@ -301,9 +203,7 @@ var props = {
|
|
|
301
203
|
/** Displays loading indicator on target section */
|
|
302
204
|
loadingTarget: PropTypes.bool.description('Displays loading indicator on target section')
|
|
303
205
|
};
|
|
304
|
-
|
|
305
|
-
var DSShuttleWithSchema = describe(DSShuttle);
|
|
206
|
+
const DSShuttleWithSchema = describe(DSShuttle);
|
|
306
207
|
DSShuttleWithSchema.propTypes = props;
|
|
307
208
|
|
|
308
209
|
export { DSShuttleWithSchema, DSShuttle as default };
|
|
309
|
-
//# sourceMappingURL=DSShuttle.js.map
|
package/esm/SearchState.js
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import _slicedToArray from '@babel/runtime/helpers/esm/slicedToArray';
|
|
2
1
|
import { useState } from 'react';
|
|
3
2
|
import createContainer from 'constate';
|
|
4
3
|
|
|
5
4
|
function useSearchState() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
searchTerm = _useState2[0],
|
|
9
|
-
setSearchTerm = _useState2[1];
|
|
10
|
-
|
|
11
|
-
var _useState3 = useState(false),
|
|
12
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
13
|
-
searching = _useState4[0],
|
|
14
|
-
setSearchBoxVisibility = _useState4[1]; // todo: create a hook for Visibility behavior
|
|
15
|
-
|
|
5
|
+
const [searchTerm, setSearchTerm] = useState('');
|
|
6
|
+
const [searching, setSearchBoxVisibility] = useState(false); // todo: create a hook for Visibility behavior
|
|
16
7
|
|
|
17
8
|
function toggleSearchBox(userVisible) {
|
|
18
9
|
if (userVisible !== undefined) {
|
|
@@ -29,18 +20,15 @@ function useSearchState() {
|
|
|
29
20
|
|
|
30
21
|
return {
|
|
31
22
|
state: {
|
|
32
|
-
searchTerm
|
|
33
|
-
searching
|
|
23
|
+
searchTerm,
|
|
24
|
+
searching
|
|
34
25
|
},
|
|
35
|
-
setSearchTerm
|
|
36
|
-
toggleSearchBox
|
|
37
|
-
reset
|
|
26
|
+
setSearchTerm,
|
|
27
|
+
toggleSearchBox,
|
|
28
|
+
reset
|
|
38
29
|
};
|
|
39
30
|
}
|
|
40
31
|
|
|
41
|
-
var SearchState = createContainer(useSearchState,
|
|
42
|
-
return [value.state];
|
|
43
|
-
});
|
|
32
|
+
var SearchState = createContainer(useSearchState, value => [value.state]);
|
|
44
33
|
|
|
45
34
|
export { SearchState as default };
|
|
46
|
-
//# sourceMappingURL=SearchState.js.map
|
package/esm/Shuttle.actions.js
CHANGED
|
@@ -1,130 +1,113 @@
|
|
|
1
|
-
import _toConsumableArray from '@babel/runtime/helpers/esm/toConsumableArray';
|
|
2
1
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
2
|
import { addOrRemove, cloneDeep, compose, hashArray } from '@elliemae/ds-utilities/utils';
|
|
4
3
|
import { toggleInObject, filterMovedItems, getHierarchyTypeName } from './helper.js';
|
|
5
4
|
import utils from './utils.js';
|
|
6
|
-
import 'treetabular';
|
|
7
5
|
|
|
8
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
9
7
|
|
|
10
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
11
9
|
function toggleItemSelection(itemId) {
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
};
|
|
10
|
+
return state => _objectSpread(_objectSpread({}, state), {}, {
|
|
11
|
+
checkedItems: addOrRemove(state.checkedItems, itemId)
|
|
12
|
+
});
|
|
17
13
|
}
|
|
18
14
|
function navigateTo(item, dest) {
|
|
19
|
-
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
const hierarchyType = getHierarchyTypeName(dest);
|
|
16
|
+
return state => {
|
|
17
|
+
const indexInHierarchy = state[hierarchyType].findIndex(hItem => hItem.id === item.id);
|
|
18
|
+
const hierarchy = state[hierarchyType];
|
|
19
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
20
|
+
[hierarchyType]: indexInHierarchy !== -1 ? hierarchy.slice(0, indexInHierarchy + 1) : [...hierarchy, item]
|
|
23
21
|
});
|
|
24
|
-
var hierarchy = state[hierarchyType];
|
|
25
|
-
return _objectSpread(_objectSpread({}, state), {}, _defineProperty({}, hierarchyType, indexInHierarchy !== -1 ? hierarchy.slice(0, indexInHierarchy + 1) : [].concat(_toConsumableArray(hierarchy), [item])));
|
|
26
22
|
};
|
|
27
23
|
}
|
|
28
24
|
function moveItem(item) {
|
|
29
|
-
return
|
|
30
|
-
|
|
25
|
+
return state => {
|
|
26
|
+
const movedItems = toggleInObject(state.movedItems, item.id, item);
|
|
31
27
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
32
|
-
movedItems
|
|
28
|
+
movedItems
|
|
33
29
|
});
|
|
34
30
|
};
|
|
35
31
|
}
|
|
36
|
-
|
|
32
|
+
const defaultOptions = {
|
|
37
33
|
parentField: 'parent',
|
|
38
34
|
idField: 'id',
|
|
39
|
-
op:
|
|
40
|
-
return !hasMoved;
|
|
41
|
-
}
|
|
35
|
+
op: hasMoved => !hasMoved
|
|
42
36
|
}; // todo: optimize this
|
|
43
37
|
|
|
44
|
-
function getItemDeep(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
function getItemDeep({
|
|
39
|
+
collection,
|
|
40
|
+
id,
|
|
41
|
+
options
|
|
42
|
+
}) {
|
|
43
|
+
const {
|
|
44
|
+
idField
|
|
45
|
+
} = _objectSpread(_objectSpread({}, defaultOptions), options);
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
idField = _defaultOptions$optio.idField;
|
|
47
|
+
const itemIndex = collection.findIndex(fItem => fItem[idField] === id); // get item with nested children
|
|
51
48
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}); // get item with nested children
|
|
55
|
-
|
|
56
|
-
var item = collection[itemIndex];
|
|
57
|
-
var children = item !== null && item !== void 0 && item.hasChildren ? compose(utils.getChildren({
|
|
49
|
+
const item = collection[itemIndex];
|
|
50
|
+
const children = item !== null && item !== void 0 && item.hasChildren ? compose(utils.getChildren({
|
|
58
51
|
index: itemIndex
|
|
59
52
|
}))(collection) || [] : [];
|
|
60
53
|
return {
|
|
61
|
-
item
|
|
62
|
-
children
|
|
54
|
+
item,
|
|
55
|
+
children
|
|
63
56
|
};
|
|
64
57
|
}
|
|
65
58
|
|
|
66
59
|
function addToTarget(itemToAdd, collection) {
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
return (state, {
|
|
61
|
+
idField
|
|
62
|
+
}) => {
|
|
63
|
+
const items = collection || state.preparedItems;
|
|
64
|
+
const {
|
|
65
|
+
item,
|
|
66
|
+
children
|
|
67
|
+
} = getItemDeep({
|
|
72
68
|
collection: items,
|
|
73
69
|
id: itemToAdd[idField]
|
|
74
|
-
})
|
|
75
|
-
item = _getItemDeep.item,
|
|
76
|
-
children = _getItemDeep.children;
|
|
77
|
-
|
|
70
|
+
});
|
|
78
71
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
79
|
-
movedItems: [
|
|
80
|
-
targetItems: [
|
|
72
|
+
movedItems: [...state.movedItems, item],
|
|
73
|
+
targetItems: [...state.targetItems, item, ...children]
|
|
81
74
|
});
|
|
82
75
|
};
|
|
83
76
|
} // todo: optimize this
|
|
84
77
|
|
|
85
78
|
function removeFromTarget(itemToRemove) {
|
|
86
|
-
return
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
var children = item !== null && item !== void 0 && item.hasChildren ? compose(filterMovedItems(state.movedItems), utils.getChildren({
|
|
79
|
+
return (state, {
|
|
80
|
+
idField
|
|
81
|
+
}) => {
|
|
82
|
+
let targetItems = cloneDeep(state.targetItems);
|
|
83
|
+
const itemIndex = targetItems.findIndex(fItem => fItem.id === itemToRemove.id);
|
|
84
|
+
const item = targetItems[itemIndex];
|
|
85
|
+
const children = item !== null && item !== void 0 && item.hasChildren ? compose(filterMovedItems(state.movedItems), utils.getChildren({
|
|
94
86
|
index: itemIndex
|
|
95
87
|
}))(targetItems) || [] : [];
|
|
96
88
|
targetItems.splice(itemIndex, 1);
|
|
97
89
|
|
|
98
90
|
if (item !== null && item !== void 0 && item.hasChildren && children.length) {
|
|
99
|
-
|
|
100
|
-
targetItems = targetItems.filter(
|
|
101
|
-
return !childrenHash[i.id];
|
|
102
|
-
});
|
|
91
|
+
const childrenHash = hashArray(children, 'id');
|
|
92
|
+
targetItems = targetItems.filter(i => !childrenHash[i.id]);
|
|
103
93
|
}
|
|
104
94
|
|
|
105
95
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
106
|
-
movedItems: state.movedItems.filter(
|
|
107
|
-
|
|
108
|
-
}),
|
|
109
|
-
targetItems: targetItems
|
|
96
|
+
movedItems: state.movedItems.filter(mItem => mItem[idField] !== itemToRemove[idField]),
|
|
97
|
+
targetItems
|
|
110
98
|
});
|
|
111
99
|
};
|
|
112
100
|
}
|
|
113
101
|
function resetCheckedItems() {
|
|
114
|
-
return
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
});
|
|
118
|
-
};
|
|
102
|
+
return state => _objectSpread(_objectSpread({}, state), {}, {
|
|
103
|
+
checkedItems: []
|
|
104
|
+
});
|
|
119
105
|
}
|
|
120
106
|
function resetMovedItems() {
|
|
121
|
-
return
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
});
|
|
126
|
-
};
|
|
107
|
+
return state => _objectSpread(_objectSpread({}, state), {}, {
|
|
108
|
+
movedItems: [],
|
|
109
|
+
targetItems: []
|
|
110
|
+
});
|
|
127
111
|
}
|
|
128
112
|
|
|
129
113
|
export { addToTarget, moveItem, navigateTo, removeFromTarget, resetCheckedItems, resetMovedItems, toggleItemSelection };
|
|
130
|
-
//# sourceMappingURL=Shuttle.actions.js.map
|