@elliemae/ds-shuttle 1.60.0 → 2.0.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/AnimationState.js +26 -42
- package/cjs/DSShuttle.js +54 -146
- package/cjs/SearchState.js +10 -22
- package/cjs/Shuttle.actions.js +65 -73
- package/cjs/ShuttleContainer.js +49 -77
- package/cjs/ShuttleImpl.js +250 -338
- package/cjs/ShuttleRenderer.js +121 -184
- package/cjs/ShuttleState.js +22 -39
- package/cjs/animation/animationConfig.js +56 -63
- package/cjs/classedComponents.js +32 -35
- package/cjs/components/LoadingIndicator.js +11 -12
- package/cjs/components/OverflowList.js +33 -29
- package/cjs/components/ShuttleBreadcrumb.js +26 -32
- package/cjs/components/ShuttleInfiniteScrollIndicator.js +17 -13
- package/cjs/components/ShuttleListItem/ActionButtons.js +39 -34
- package/cjs/components/ShuttleListItem/ShuttleListItem.js +59 -58
- package/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +40 -61
- package/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +35 -50
- package/cjs/components/ShuttleListPanel.js +11 -23
- package/cjs/components/ShuttleSearchBox.js +79 -102
- package/cjs/components/ShuttleSource.js +99 -169
- package/cjs/components/ShuttleTarget.js +62 -82
- package/cjs/components/VirtualizedItem.js +28 -22
- package/cjs/components/VirtualizedList.js +52 -50
- package/cjs/components/VirtualizedSortableList.js +25 -23
- package/cjs/helper.js +52 -82
- package/cjs/index.js +1 -60
- package/cjs/updateShuttleStateFromProps.js +41 -40
- package/cjs/utils.js +9 -9
- package/cjs/withProviders.js +15 -16
- package/esm/AnimationState.js +25 -40
- package/esm/DSShuttle.js +51 -143
- package/esm/SearchState.js +9 -20
- package/esm/Shuttle.actions.js +64 -71
- package/esm/ShuttleContainer.js +47 -75
- package/esm/ShuttleImpl.js +254 -334
- package/esm/ShuttleRenderer.js +117 -179
- package/esm/ShuttleState.js +17 -32
- package/esm/animation/animationConfig.js +56 -63
- package/esm/classedComponents.js +30 -33
- package/esm/components/LoadingIndicator.js +10 -11
- package/esm/components/OverflowList.js +30 -26
- package/esm/components/ShuttleBreadcrumb.js +23 -29
- package/esm/components/ShuttleInfiniteScrollIndicator.js +16 -12
- package/esm/components/ShuttleListItem/ActionButtons.js +38 -33
- package/esm/components/ShuttleListItem/ShuttleListItem.js +56 -55
- package/esm/components/ShuttleListItem/ShuttleSourceListItem.js +36 -56
- package/esm/components/ShuttleListItem/ShuttleTargetListItem.js +31 -46
- package/esm/components/ShuttleListPanel.js +10 -22
- package/esm/components/ShuttleSearchBox.js +78 -95
- package/esm/components/ShuttleSource.js +89 -157
- package/esm/components/ShuttleTarget.js +55 -75
- package/esm/components/VirtualizedItem.js +26 -20
- package/esm/components/VirtualizedList.js +48 -46
- package/esm/components/VirtualizedSortableList.js +21 -18
- package/esm/helper.js +49 -77
- package/esm/index.js +0 -59
- package/esm/updateShuttleStateFromProps.js +40 -38
- package/esm/utils.js +6 -4
- package/esm/withProviders.js +13 -15
- package/package.json +163 -18
- package/types/AnimationState.d.ts +26 -0
- package/types/DSShuttle.d.ts +341 -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,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
4
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
5
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
9
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
10
|
+
require('react');
|
|
4
11
|
var AnimationState = require('./AnimationState.js');
|
|
5
12
|
var SearchState = require('./SearchState.js');
|
|
6
13
|
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');
|
|
13
|
-
require('treetabular');
|
|
14
|
-
require('./Shuttle.actions.js');
|
|
15
|
-
require('./utils.js');
|
|
14
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
16
15
|
|
|
17
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
17
|
|
|
19
|
-
var
|
|
18
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
19
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
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; }
|
|
22
|
+
|
|
23
|
+
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
24
|
|
|
23
25
|
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
|
-
};
|
|
26
|
+
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
27
|
}
|
|
28
28
|
|
|
29
29
|
module.exports = withProviders;
|
|
30
|
-
//# sourceMappingURL=withProviders.js.map
|
package/esm/AnimationState.js
CHANGED
|
@@ -1,57 +1,42 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
2
|
import { useState, useCallback } from 'react';
|
|
3
3
|
import createContainer from 'constate';
|
|
4
4
|
|
|
5
5
|
function useShuttleAnimationState() {
|
|
6
|
-
|
|
6
|
+
const [animationState, setAnimationState] = useState({
|
|
7
7
|
isMoving: false,
|
|
8
8
|
isMovingBack: false,
|
|
9
9
|
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
|
-
}, []);
|
|
10
|
+
});
|
|
11
|
+
const reset = useCallback(() => setAnimationState({
|
|
12
|
+
isMoving: false,
|
|
13
|
+
isMovingBack: false,
|
|
14
|
+
isDrillingDown: false
|
|
15
|
+
}), []);
|
|
16
|
+
const move = useCallback(() => setAnimationState({
|
|
17
|
+
isMovingBack: false,
|
|
18
|
+
isMoving: true,
|
|
19
|
+
isDrillingDown: false
|
|
20
|
+
}), []);
|
|
21
|
+
const moveBack = useCallback(() => setAnimationState({
|
|
22
|
+
isMovingBack: true,
|
|
23
|
+
isMoving: false,
|
|
24
|
+
isDrillingDown: false
|
|
25
|
+
}), []);
|
|
26
|
+
const drilldown = useCallback(() => setAnimationState({
|
|
27
|
+
isMovingBack: false,
|
|
28
|
+
isMoving: false,
|
|
29
|
+
isDrillingDown: true
|
|
30
|
+
}), []);
|
|
43
31
|
return {
|
|
44
32
|
state: animationState,
|
|
45
33
|
setIsMoving: move,
|
|
46
34
|
setIsMovingBack: moveBack,
|
|
47
35
|
setIsDrillingDown: drilldown,
|
|
48
|
-
reset
|
|
36
|
+
reset
|
|
49
37
|
};
|
|
50
38
|
}
|
|
51
39
|
|
|
52
|
-
var AnimationContext = createContainer(useShuttleAnimationState,
|
|
53
|
-
return [value.state];
|
|
54
|
-
});
|
|
40
|
+
var AnimationContext = createContainer(useShuttleAnimationState, value => [value.state]);
|
|
55
41
|
|
|
56
42
|
export { AnimationContext as default };
|
|
57
|
-
//# sourceMappingURL=AnimationState.js.map
|
package/esm/DSShuttle.js
CHANGED
|
@@ -1,146 +1,56 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
+
import 'react';
|
|
2
4
|
import { debounce } from 'lodash';
|
|
3
5
|
import { PropTypes, describe } from 'react-desc';
|
|
4
6
|
import { TooltipTextProvider } from '@elliemae/ds-truncated-tooltip-text';
|
|
5
7
|
import ShuttleImpl from './ShuttleImpl.js';
|
|
6
8
|
export { default as utils } from './utils.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
import './components/VirtualizedItem.js';
|
|
53
|
-
import './components/VirtualizedSortableList.js';
|
|
54
|
-
import './components/LoadingIndicator.js';
|
|
55
|
-
import '@elliemae/ds-circular-progress-indicator';
|
|
56
|
-
import 'styled-components';
|
|
57
|
-
import './components/ShuttleTarget.js';
|
|
58
|
-
import './components/ShuttleListItem/ShuttleTargetListItem.js';
|
|
59
|
-
import './updateShuttleStateFromProps.js';
|
|
60
|
-
|
|
61
|
-
/* eslint-disable max-lines */
|
|
62
|
-
|
|
63
|
-
var noop = function noop() {};
|
|
64
|
-
|
|
65
|
-
var DSShuttle = function DSShuttle(_ref) {
|
|
66
|
-
var _ref$containerProps = _ref.containerProps,
|
|
67
|
-
containerProps = _ref$containerProps === void 0 ? {} : _ref$containerProps,
|
|
68
|
-
_ref$idField = _ref.idField,
|
|
69
|
-
idField = _ref$idField === void 0 ? 'id' : _ref$idField,
|
|
70
|
-
_ref$parentIdField = _ref.parentIdField,
|
|
71
|
-
parentIdField = _ref$parentIdField === void 0 ? 'parent' : _ref$parentIdField,
|
|
72
|
-
_ref$showIcons = _ref.showIcons,
|
|
73
|
-
showIcons = _ref$showIcons === void 0 ? true : _ref$showIcons,
|
|
74
|
-
_ref$items = _ref.items,
|
|
75
|
-
items = _ref$items === void 0 ? [] : _ref$items,
|
|
76
|
-
_ref$selectedItems = _ref.selectedItems,
|
|
77
|
-
selectedItems = _ref$selectedItems === void 0 ? undefined : _ref$selectedItems,
|
|
78
|
-
_ref$nonSelectedItems = _ref.nonSelectedItems,
|
|
79
|
-
nonSelectedItems = _ref$nonSelectedItems === void 0 ? undefined : _ref$nonSelectedItems,
|
|
80
|
-
_ref$onSearch = _ref.onSearch,
|
|
81
|
-
onSearch = _ref$onSearch === void 0 ? noop : _ref$onSearch,
|
|
82
|
-
_ref$onSearchOpen = _ref.onSearchOpen,
|
|
83
|
-
onSearchOpen = _ref$onSearchOpen === void 0 ? noop : _ref$onSearchOpen,
|
|
84
|
-
_ref$onSearchClose = _ref.onSearchClose,
|
|
85
|
-
onSearchClose = _ref$onSearchClose === void 0 ? noop : _ref$onSearchClose,
|
|
86
|
-
_ref$onDrillDown = _ref.onDrillDown,
|
|
87
|
-
onDrillDown = _ref$onDrillDown === void 0 ? noop : _ref$onDrillDown,
|
|
88
|
-
_ref$onDrillDownTarge = _ref.onDrillDownTarget,
|
|
89
|
-
onDrillDownTarget = _ref$onDrillDownTarge === void 0 ? noop : _ref$onDrillDownTarge,
|
|
90
|
-
_ref$onTargetSortEnd = _ref.onTargetSortEnd,
|
|
91
|
-
onTargetSortEnd = _ref$onTargetSortEnd === void 0 ? noop : _ref$onTargetSortEnd,
|
|
92
|
-
_ref$setGetStatus = _ref.setGetStatus,
|
|
93
|
-
setGetStatus = _ref$setGetStatus === void 0 ? noop : _ref$setGetStatus,
|
|
94
|
-
_ref$targetSortable = _ref.targetSortable,
|
|
95
|
-
targetSortable = _ref$targetSortable === void 0 ? true : _ref$targetSortable,
|
|
96
|
-
_ref$sourceEmptyMessa = _ref.sourceEmptyMessage,
|
|
97
|
-
sourceEmptyMessage = _ref$sourceEmptyMessa === void 0 ? 'No Items Found' : _ref$sourceEmptyMessa,
|
|
98
|
-
_ref$sourceRootTitle = _ref.sourceRootTitle,
|
|
99
|
-
sourceRootTitle = _ref$sourceRootTitle === void 0 ? 'Category' : _ref$sourceRootTitle,
|
|
100
|
-
_ref$targetEmptyMessa = _ref.targetEmptyMessage,
|
|
101
|
-
targetEmptyMessage = _ref$targetEmptyMessa === void 0 ? 'No Items Selected' : _ref$targetEmptyMessa,
|
|
102
|
-
_ref$targetRootTitle = _ref.targetRootTitle,
|
|
103
|
-
targetRootTitle = _ref$targetRootTitle === void 0 ? 'Selected Items' : _ref$targetRootTitle,
|
|
104
|
-
_ref$composeSourceIte = _ref.composeSourceItemProps,
|
|
105
|
-
composeSourceItemProps = _ref$composeSourceIte === void 0 ? function () {
|
|
106
|
-
return {};
|
|
107
|
-
} : _ref$composeSourceIte,
|
|
108
|
-
_ref$composeTargetIte = _ref.composeTargetItemProps,
|
|
109
|
-
composeTargetItemProps = _ref$composeTargetIte === void 0 ? function () {
|
|
110
|
-
return {};
|
|
111
|
-
} : _ref$composeTargetIte,
|
|
112
|
-
_ref$onAddToTarget = _ref.onAddToTarget,
|
|
113
|
-
onAddToTarget = _ref$onAddToTarget === void 0 ? noop : _ref$onAddToTarget,
|
|
114
|
-
_ref$onAddCheckedItem = _ref.onAddCheckedItems,
|
|
115
|
-
onAddCheckedItems = _ref$onAddCheckedItem === void 0 ? noop : _ref$onAddCheckedItem,
|
|
116
|
-
_ref$onRemoveFromTarg = _ref.onRemoveFromTarget,
|
|
117
|
-
onRemoveFromTarget = _ref$onRemoveFromTarg === void 0 ? noop : _ref$onRemoveFromTarg,
|
|
118
|
-
_ref$onRemoveAllFromT = _ref.onRemoveAllFromTarget,
|
|
119
|
-
onRemoveAllFromTarget = _ref$onRemoveAllFromT === void 0 ? noop : _ref$onRemoveAllFromT,
|
|
120
|
-
_ref$onChange = _ref.onChange,
|
|
121
|
-
onChange = _ref$onChange === void 0 ? noop : _ref$onChange,
|
|
122
|
-
_ref$renderSourceCoun = _ref.renderSourceCounter,
|
|
123
|
-
renderSourceCounter = _ref$renderSourceCoun === void 0 ? noop : _ref$renderSourceCoun,
|
|
124
|
-
_ref$renderTargetCoun = _ref.renderTargetCounter,
|
|
125
|
-
renderTargetCounter = _ref$renderTargetCoun === void 0 ? noop : _ref$renderTargetCoun,
|
|
126
|
-
_ref$sourceClearItems = _ref.sourceClearItemsText,
|
|
127
|
-
sourceClearItemsText = _ref$sourceClearItems === void 0 ? 'CLEAR ALL' : _ref$sourceClearItems,
|
|
128
|
-
_ref$targetClearItems = _ref.targetClearItemsText,
|
|
129
|
-
targetClearItemsText = _ref$targetClearItems === void 0 ? 'CLEAR ALL' : _ref$targetClearItems,
|
|
130
|
-
_ref$searchPlaceholde = _ref.searchPlaceholder,
|
|
131
|
-
searchPlaceholder = _ref$searchPlaceholde === void 0 ? 'Search field ID, name, etc.' : _ref$searchPlaceholde,
|
|
132
|
-
_ref$loadingSource = _ref.loadingSource,
|
|
133
|
-
loadingSource = _ref$loadingSource === void 0 ? false : _ref$loadingSource,
|
|
134
|
-
_ref$loadingTarget = _ref.loadingTarget,
|
|
135
|
-
loadingTarget = _ref$loadingTarget === void 0 ? false : _ref$loadingTarget,
|
|
136
|
-
_ref$onGetMoreItems = _ref.onGetMoreItems,
|
|
137
|
-
onGetMoreItems = _ref$onGetMoreItems === void 0 ? function () {
|
|
138
|
-
return null;
|
|
139
|
-
} : _ref$onGetMoreItems,
|
|
140
|
-
_ref$hasNextPage = _ref.hasNextPage,
|
|
141
|
-
hasNextPage = _ref$hasNextPage === void 0 ? false : _ref$hasNextPage,
|
|
142
|
-
moreItemsLoading = _ref.moreItemsLoading;
|
|
143
|
-
return /*#__PURE__*/React.createElement(TooltipTextProvider, null, /*#__PURE__*/React.createElement(ShuttleImpl, {
|
|
9
|
+
|
|
10
|
+
const noop = () => {};
|
|
11
|
+
|
|
12
|
+
const DSShuttle = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
containerProps = {},
|
|
15
|
+
idField = 'id',
|
|
16
|
+
parentIdField = 'parent',
|
|
17
|
+
showIcons = true,
|
|
18
|
+
items = [],
|
|
19
|
+
selectedItems = undefined,
|
|
20
|
+
// if defined it becomes controlled (v1)
|
|
21
|
+
// TODO make `nonSelectedItems` the default controlled behavior (v2)
|
|
22
|
+
nonSelectedItems = undefined,
|
|
23
|
+
onSearch = noop,
|
|
24
|
+
onSearchOpen = noop,
|
|
25
|
+
onSearchClose = noop,
|
|
26
|
+
onDrillDown = noop,
|
|
27
|
+
onDrillDownTarget = noop,
|
|
28
|
+
onTargetSortEnd = noop,
|
|
29
|
+
setGetStatus = noop,
|
|
30
|
+
targetSortable = true,
|
|
31
|
+
sourceEmptyMessage = 'No Items Found',
|
|
32
|
+
sourceRootTitle = 'Category',
|
|
33
|
+
targetEmptyMessage = 'No Items Selected',
|
|
34
|
+
targetRootTitle = 'Selected Items',
|
|
35
|
+
composeSourceItemProps = () => ({}),
|
|
36
|
+
composeTargetItemProps = () => ({}),
|
|
37
|
+
onAddToTarget = noop,
|
|
38
|
+
onAddCheckedItems = noop,
|
|
39
|
+
onRemoveFromTarget = noop,
|
|
40
|
+
onRemoveAllFromTarget = noop,
|
|
41
|
+
onChange = noop,
|
|
42
|
+
renderSourceCounter = noop,
|
|
43
|
+
renderTargetCounter = noop,
|
|
44
|
+
sourceClearItemsText = 'CLEAR ALL',
|
|
45
|
+
targetClearItemsText = 'CLEAR ALL',
|
|
46
|
+
searchPlaceholder = 'Search field ID, name, etc.',
|
|
47
|
+
loadingSource = false,
|
|
48
|
+
loadingTarget = false,
|
|
49
|
+
onGetMoreItems = () => null,
|
|
50
|
+
hasNextPage = false,
|
|
51
|
+
moreItemsLoading
|
|
52
|
+
} = _ref;
|
|
53
|
+
return /*#__PURE__*/_jsx(TooltipTextProvider, {}, void 0, /*#__PURE__*/_jsx(ShuttleImpl, {
|
|
144
54
|
composeSourceItemProps: composeSourceItemProps,
|
|
145
55
|
composeTargetItemProps: composeTargetItemProps,
|
|
146
56
|
containerProps: containerProps,
|
|
@@ -175,14 +85,14 @@ var DSShuttle = function DSShuttle(_ref) {
|
|
|
175
85
|
loadingSource: loadingSource,
|
|
176
86
|
loadingTarget: loadingTarget,
|
|
177
87
|
onGetMoreItems: debounce(function () {
|
|
178
|
-
onGetMoreItems
|
|
88
|
+
onGetMoreItems(...arguments);
|
|
179
89
|
}, 500),
|
|
180
90
|
moreItemsLoading: moreItemsLoading,
|
|
181
91
|
hasNextPage: hasNextPage
|
|
182
92
|
}));
|
|
183
93
|
};
|
|
184
94
|
|
|
185
|
-
|
|
95
|
+
const props = {
|
|
186
96
|
/** inject props to shuttle wrapper */
|
|
187
97
|
containerProps: PropTypes.object.description('inject props to shuttle wrapper'),
|
|
188
98
|
|
|
@@ -297,9 +207,7 @@ var props = {
|
|
|
297
207
|
/** Displays loading indicator on target section */
|
|
298
208
|
loadingTarget: PropTypes.bool.description('Displays loading indicator on target section')
|
|
299
209
|
};
|
|
300
|
-
|
|
301
|
-
var DSShuttleWithSchema = describe(DSShuttle);
|
|
210
|
+
const DSShuttleWithSchema = describe(DSShuttle);
|
|
302
211
|
DSShuttleWithSchema.propTypes = props;
|
|
303
212
|
|
|
304
213
|
export { DSShuttleWithSchema, DSShuttle as default };
|
|
305
|
-
//# sourceMappingURL=DSShuttle.js.map
|
package/esm/SearchState.js
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import createContainer from 'constate';
|
|
4
4
|
|
|
5
5
|
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
|
-
|
|
6
|
+
const [searchTerm, setSearchTerm] = useState('');
|
|
7
|
+
const [searching, setSearchBoxVisibility] = useState(false); // todo: create a hook for Visibility behavior
|
|
16
8
|
|
|
17
9
|
function toggleSearchBox(userVisible) {
|
|
18
10
|
if (userVisible !== undefined) {
|
|
@@ -29,18 +21,15 @@ function useSearchState() {
|
|
|
29
21
|
|
|
30
22
|
return {
|
|
31
23
|
state: {
|
|
32
|
-
searchTerm
|
|
33
|
-
searching
|
|
24
|
+
searchTerm,
|
|
25
|
+
searching
|
|
34
26
|
},
|
|
35
|
-
setSearchTerm
|
|
36
|
-
toggleSearchBox
|
|
37
|
-
reset
|
|
27
|
+
setSearchTerm,
|
|
28
|
+
toggleSearchBox,
|
|
29
|
+
reset
|
|
38
30
|
};
|
|
39
31
|
}
|
|
40
32
|
|
|
41
|
-
var SearchState = createContainer(useSearchState,
|
|
42
|
-
return [value.state];
|
|
43
|
-
});
|
|
33
|
+
var SearchState = createContainer(useSearchState, value => [value.state]);
|
|
44
34
|
|
|
45
35
|
export { SearchState as default };
|
|
46
|
-
//# sourceMappingURL=SearchState.js.map
|
package/esm/Shuttle.actions.js
CHANGED
|
@@ -1,130 +1,123 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
2
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';
|
|
3
8
|
import { addOrRemove, cloneDeep, compose, hashArray } from '@elliemae/ds-utilities';
|
|
4
9
|
import { toggleInObject, filterMovedItems, getHierarchyTypeName } from './helper.js';
|
|
5
10
|
import utils from './utils.js';
|
|
6
|
-
import 'treetabular';
|
|
7
11
|
|
|
8
12
|
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
13
|
|
|
10
14
|
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
15
|
function toggleItemSelection(itemId) {
|
|
12
|
-
return
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
16
|
-
};
|
|
16
|
+
return state => _objectSpread(_objectSpread({}, state), {}, {
|
|
17
|
+
checkedItems: addOrRemove(state.checkedItems, itemId)
|
|
18
|
+
});
|
|
17
19
|
}
|
|
18
20
|
function navigateTo(item, dest) {
|
|
19
|
-
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
|
|
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]
|
|
23
27
|
});
|
|
24
|
-
var hierarchy = state[hierarchyType];
|
|
25
|
-
return _objectSpread(_objectSpread({}, state), {}, _defineProperty({}, hierarchyType, indexInHierarchy !== -1 ? hierarchy.slice(0, indexInHierarchy + 1) : [].concat(_toConsumableArray(hierarchy), [item])));
|
|
26
28
|
};
|
|
27
29
|
}
|
|
28
30
|
function moveItem(item) {
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
+
return state => {
|
|
32
|
+
const movedItems = toggleInObject(state.movedItems, item.id, item);
|
|
31
33
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
32
|
-
movedItems
|
|
34
|
+
movedItems
|
|
33
35
|
});
|
|
34
36
|
};
|
|
35
37
|
}
|
|
36
|
-
|
|
38
|
+
const defaultOptions = {
|
|
37
39
|
parentField: 'parent',
|
|
38
40
|
idField: 'id',
|
|
39
|
-
op:
|
|
40
|
-
return !hasMoved;
|
|
41
|
-
}
|
|
41
|
+
op: hasMoved => !hasMoved
|
|
42
42
|
}; // todo: optimize this
|
|
43
43
|
|
|
44
44
|
function getItemDeep(_ref) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
let {
|
|
46
|
+
collection,
|
|
47
|
+
id,
|
|
48
|
+
options
|
|
49
|
+
} = _ref;
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
const {
|
|
52
|
+
idField
|
|
53
|
+
} = _objectSpread(_objectSpread({}, defaultOptions), options);
|
|
51
54
|
|
|
52
|
-
|
|
53
|
-
return fItem[idField] === id;
|
|
54
|
-
}); // get item with nested children
|
|
55
|
+
const itemIndex = collection.findIndex(fItem => fItem[idField] === id); // get item with nested children
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
const item = collection[itemIndex];
|
|
58
|
+
const children = item !== null && item !== void 0 && item.hasChildren ? compose(utils.getChildren({
|
|
58
59
|
index: itemIndex
|
|
59
60
|
}))(collection) || [] : [];
|
|
60
61
|
return {
|
|
61
|
-
item
|
|
62
|
-
children
|
|
62
|
+
item,
|
|
63
|
+
children
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
function addToTarget(itemToAdd, collection) {
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
return (state, _ref2) => {
|
|
69
|
+
let {
|
|
70
|
+
idField
|
|
71
|
+
} = _ref2;
|
|
72
|
+
const items = collection || state.preparedItems;
|
|
73
|
+
const {
|
|
74
|
+
item,
|
|
75
|
+
children
|
|
76
|
+
} = getItemDeep({
|
|
72
77
|
collection: items,
|
|
73
78
|
id: itemToAdd[idField]
|
|
74
|
-
})
|
|
75
|
-
item = _getItemDeep.item,
|
|
76
|
-
children = _getItemDeep.children;
|
|
77
|
-
|
|
79
|
+
});
|
|
78
80
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
79
|
-
movedItems: [
|
|
80
|
-
targetItems: [
|
|
81
|
+
movedItems: [...state.movedItems, item],
|
|
82
|
+
targetItems: [...state.targetItems, item, ...children]
|
|
81
83
|
});
|
|
82
84
|
};
|
|
83
85
|
} // todo: optimize this
|
|
84
86
|
|
|
85
87
|
function removeFromTarget(itemToRemove) {
|
|
86
|
-
return
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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({
|
|
94
96
|
index: itemIndex
|
|
95
97
|
}))(targetItems) || [] : [];
|
|
96
98
|
targetItems.splice(itemIndex, 1);
|
|
97
99
|
|
|
98
100
|
if (item !== null && item !== void 0 && item.hasChildren && children.length) {
|
|
99
|
-
|
|
100
|
-
targetItems = targetItems.filter(
|
|
101
|
-
return !childrenHash[i.id];
|
|
102
|
-
});
|
|
101
|
+
const childrenHash = hashArray(children, 'id');
|
|
102
|
+
targetItems = targetItems.filter(i => !childrenHash[i.id]);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
106
|
-
movedItems: state.movedItems.filter(
|
|
107
|
-
|
|
108
|
-
}),
|
|
109
|
-
targetItems: targetItems
|
|
106
|
+
movedItems: state.movedItems.filter(mItem => mItem[idField] !== itemToRemove[idField]),
|
|
107
|
+
targetItems
|
|
110
108
|
});
|
|
111
109
|
};
|
|
112
110
|
}
|
|
113
111
|
function resetCheckedItems() {
|
|
114
|
-
return
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
});
|
|
118
|
-
};
|
|
112
|
+
return state => _objectSpread(_objectSpread({}, state), {}, {
|
|
113
|
+
checkedItems: []
|
|
114
|
+
});
|
|
119
115
|
}
|
|
120
116
|
function resetMovedItems() {
|
|
121
|
-
return
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
});
|
|
126
|
-
};
|
|
117
|
+
return state => _objectSpread(_objectSpread({}, state), {}, {
|
|
118
|
+
movedItems: [],
|
|
119
|
+
targetItems: []
|
|
120
|
+
});
|
|
127
121
|
}
|
|
128
122
|
|
|
129
123
|
export { addToTarget, moveItem, navigateTo, removeFromTarget, resetCheckedItems, resetMovedItems, toggleItemSelection };
|
|
130
|
-
//# sourceMappingURL=Shuttle.actions.js.map
|