@elliemae/ds-shuttle 2.3.0-alpha.9 → 2.3.0-next.3
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 +48 -0
- package/cjs/DSShuttle.js +223 -0
- package/cjs/SearchState.js +41 -0
- package/cjs/Shuttle.actions.js +137 -0
- package/cjs/ShuttleContainer.js +87 -0
- package/cjs/ShuttleImpl.js +311 -0
- package/cjs/ShuttleRenderer.js +139 -0
- package/cjs/ShuttleState.js +80 -0
- package/cjs/animation/animationConfig.js +81 -0
- package/cjs/classedComponents.js +71 -0
- package/cjs/components/LoadingIndicator.js +25 -0
- package/cjs/components/OverflowList.js +53 -0
- package/cjs/components/ShuttleBreadcrumb.js +42 -0
- package/cjs/components/ShuttleInfiniteScrollIndicator.js +39 -0
- package/cjs/components/ShuttleListItem/ActionButtons.js +55 -0
- package/cjs/components/ShuttleListItem/ShuttleListItem.js +85 -0
- package/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +76 -0
- package/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +57 -0
- package/cjs/components/ShuttleListPanel.js +31 -0
- package/cjs/components/ShuttleSearchBox.js +110 -0
- package/cjs/components/ShuttleSource.js +188 -0
- package/cjs/components/ShuttleTarget.js +116 -0
- package/cjs/components/VirtualizedItem.js +46 -0
- package/cjs/components/VirtualizedList.js +93 -0
- package/cjs/components/VirtualizedSortableList.js +41 -0
- package/cjs/helper.js +117 -0
- package/cjs/index.js +12 -0
- package/cjs/updateShuttleStateFromProps.js +94 -0
- package/cjs/utils.js +43 -0
- package/cjs/withProviders.js +29 -0
- package/{dist/esm → esm}/AnimationState.js +8 -12
- package/esm/DSShuttle.js +213 -0
- package/esm/SearchState.js +35 -0
- package/esm/Shuttle.actions.js +123 -0
- package/esm/ShuttleContainer.js +80 -0
- package/esm/ShuttleImpl.js +304 -0
- package/esm/ShuttleRenderer.js +132 -0
- package/esm/ShuttleState.js +74 -0
- package/esm/animation/animationConfig.js +77 -0
- package/esm/classedComponents.js +51 -0
- package/esm/components/LoadingIndicator.js +18 -0
- package/esm/components/OverflowList.js +46 -0
- package/esm/components/ShuttleBreadcrumb.js +35 -0
- package/esm/components/ShuttleInfiniteScrollIndicator.js +32 -0
- package/esm/components/ShuttleListItem/ActionButtons.js +43 -0
- package/esm/components/ShuttleListItem/ShuttleListItem.js +76 -0
- package/esm/components/ShuttleListItem/ShuttleSourceListItem.js +68 -0
- package/esm/components/ShuttleListItem/ShuttleTargetListItem.js +49 -0
- package/esm/components/ShuttleListPanel.js +24 -0
- package/esm/components/ShuttleSearchBox.js +104 -0
- package/esm/components/ShuttleSource.js +179 -0
- package/esm/components/ShuttleTarget.js +107 -0
- package/esm/components/VirtualizedItem.js +40 -0
- package/esm/components/VirtualizedList.js +84 -0
- package/esm/components/VirtualizedSortableList.js +34 -0
- package/esm/helper.js +78 -0
- package/esm/index.js +2 -0
- package/esm/updateShuttleStateFromProps.js +88 -0
- package/esm/utils.js +18 -0
- package/esm/withProviders.js +22 -0
- package/package.json +90 -93
- package/{dist/types → types}/AnimationState.d.ts +2 -3
- package/{dist/types → types}/DSShuttle.d.ts +1 -1
- package/{dist/types → types}/SearchState.d.ts +2 -3
- package/{dist/types → types}/Shuttle.actions.d.ts +0 -0
- package/{dist/types → types}/ShuttleContainer.d.ts +0 -0
- package/types/ShuttleImpl.d.ts +3 -0
- package/{dist/types → types}/ShuttleRenderer.d.ts +0 -1
- package/{dist/types → types}/ShuttleState.d.ts +2 -3
- package/{dist/types → types}/animation/animationConfig.d.ts +0 -0
- package/{dist/types → types}/classedComponents.d.ts +0 -0
- package/{dist/types → types}/components/LoadingIndicator.d.ts +0 -1
- package/{dist/types → types}/components/OverflowList.d.ts +0 -1
- package/{dist/types → types}/components/ShuttleBreadcrumb.d.ts +0 -1
- package/{dist/types → types}/components/ShuttleInfiniteScrollIndicator.d.ts +0 -1
- package/{dist/types → types}/components/ShuttleListItem/ActionButtons.d.ts +0 -0
- package/{dist/types → types}/components/ShuttleListItem/ShuttleListItem.d.ts +0 -1
- package/{dist/types → types}/components/ShuttleListItem/ShuttleSourceListItem.d.ts +0 -1
- package/{dist/types → types}/components/ShuttleListItem/ShuttleTargetListItem.d.ts +0 -1
- package/{dist/types → types}/components/ShuttleListPanel.d.ts +0 -1
- package/{dist/types → types}/components/ShuttleSearchBox.d.ts +1 -3
- package/{dist/types → types}/components/ShuttleSource.d.ts +0 -1
- package/{dist/types → types}/components/ShuttleTarget.d.ts +0 -1
- package/{dist/types → types}/components/VirtualizedItem.d.ts +0 -1
- package/{dist/types → types}/components/VirtualizedList.d.ts +0 -1
- package/{dist/types → types}/components/VirtualizedSortableList.d.ts +0 -1
- package/{dist/types → types}/helper.d.ts +0 -0
- package/types/index.d.ts +1 -0
- package/{dist/types → types}/tests/DSShuttle.events.test.d.ts +0 -0
- package/{dist/types → types}/tests/DSShuttle.test.d.ts +0 -0
- package/{dist/types → types}/tests/utils.d.ts +0 -0
- package/types/updateShuttleStateFromProps.d.ts +1 -0
- package/{dist/types → types}/utils.d.ts +0 -0
- package/{dist/types → types}/withProviders.d.ts +0 -1
- package/dist/cjs/AnimationState.js +0 -75
- package/dist/cjs/AnimationState.js.map +0 -7
- package/dist/cjs/DSShuttle.js +0 -170
- package/dist/cjs/DSShuttle.js.map +0 -7
- package/dist/cjs/SearchState.js +0 -60
- package/dist/cjs/SearchState.js.map +0 -7
- package/dist/cjs/Shuttle.actions.js +0 -126
- package/dist/cjs/Shuttle.actions.js.map +0 -7
- package/dist/cjs/ShuttleContainer.js +0 -82
- package/dist/cjs/ShuttleContainer.js.map +0 -7
- package/dist/cjs/ShuttleImpl.js +0 -214
- package/dist/cjs/ShuttleImpl.js.map +0 -7
- package/dist/cjs/ShuttleRenderer.js +0 -144
- package/dist/cjs/ShuttleRenderer.js.map +0 -7
- package/dist/cjs/ShuttleState.js +0 -84
- package/dist/cjs/ShuttleState.js.map +0 -7
- package/dist/cjs/animation/animationConfig.js +0 -78
- package/dist/cjs/animation/animationConfig.js.map +0 -7
- package/dist/cjs/classedComponents.js +0 -72
- package/dist/cjs/classedComponents.js.map +0 -7
- package/dist/cjs/components/LoadingIndicator.js +0 -52
- package/dist/cjs/components/LoadingIndicator.js.map +0 -7
- package/dist/cjs/components/OverflowList.js +0 -55
- package/dist/cjs/components/OverflowList.js.map +0 -7
- package/dist/cjs/components/ShuttleBreadcrumb.js +0 -54
- package/dist/cjs/components/ShuttleBreadcrumb.js.map +0 -7
- package/dist/cjs/components/ShuttleInfiniteScrollIndicator.js +0 -48
- package/dist/cjs/components/ShuttleInfiniteScrollIndicator.js.map +0 -7
- package/dist/cjs/components/ShuttleListItem/ActionButtons.js +0 -60
- package/dist/cjs/components/ShuttleListItem/ActionButtons.js.map +0 -7
- package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js +0 -83
- package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js.map +0 -7
- package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +0 -90
- package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js.map +0 -7
- package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +0 -73
- package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js.map +0 -7
- package/dist/cjs/components/ShuttleListPanel.js +0 -49
- package/dist/cjs/components/ShuttleListPanel.js.map +0 -7
- package/dist/cjs/components/ShuttleSearchBox.js +0 -99
- package/dist/cjs/components/ShuttleSearchBox.js.map +0 -7
- package/dist/cjs/components/ShuttleSource.js +0 -192
- package/dist/cjs/components/ShuttleSource.js.map +0 -7
- package/dist/cjs/components/ShuttleTarget.js +0 -104
- package/dist/cjs/components/ShuttleTarget.js.map +0 -7
- package/dist/cjs/components/VirtualizedItem.js +0 -51
- package/dist/cjs/components/VirtualizedItem.js.map +0 -7
- package/dist/cjs/components/VirtualizedList.js +0 -88
- package/dist/cjs/components/VirtualizedList.js.map +0 -7
- package/dist/cjs/components/VirtualizedSortableList.js +0 -48
- package/dist/cjs/components/VirtualizedSortableList.js.map +0 -7
- package/dist/cjs/helper.js +0 -83
- package/dist/cjs/helper.js.map +0 -7
- package/dist/cjs/index.js +0 -38
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/tests/utils.js +0 -1218
- package/dist/cjs/tests/utils.js.map +0 -7
- package/dist/cjs/updateShuttleStateFromProps.js +0 -98
- package/dist/cjs/updateShuttleStateFromProps.js.map +0 -7
- package/dist/cjs/utils.js +0 -41
- package/dist/cjs/utils.js.map +0 -7
- package/dist/cjs/withProviders.js +0 -45
- package/dist/cjs/withProviders.js.map +0 -7
- package/dist/esm/AnimationState.js.map +0 -7
- package/dist/esm/DSShuttle.js +0 -141
- package/dist/esm/DSShuttle.js.map +0 -7
- package/dist/esm/SearchState.js +0 -31
- package/dist/esm/SearchState.js.map +0 -7
- package/dist/esm/Shuttle.actions.js +0 -106
- package/dist/esm/Shuttle.actions.js.map +0 -7
- package/dist/esm/ShuttleContainer.js +0 -64
- package/dist/esm/ShuttleContainer.js.map +0 -7
- package/dist/esm/ShuttleImpl.js +0 -199
- package/dist/esm/ShuttleImpl.js.map +0 -7
- package/dist/esm/ShuttleRenderer.js +0 -115
- package/dist/esm/ShuttleRenderer.js.map +0 -7
- package/dist/esm/ShuttleState.js +0 -55
- package/dist/esm/ShuttleState.js.map +0 -7
- package/dist/esm/animation/animationConfig.js +0 -49
- package/dist/esm/animation/animationConfig.js.map +0 -7
- package/dist/esm/classedComponents.js +0 -43
- package/dist/esm/classedComponents.js.map +0 -7
- package/dist/esm/components/LoadingIndicator.js +0 -23
- package/dist/esm/components/LoadingIndicator.js.map +0 -7
- package/dist/esm/components/OverflowList.js +0 -26
- package/dist/esm/components/OverflowList.js.map +0 -7
- package/dist/esm/components/ShuttleBreadcrumb.js +0 -25
- package/dist/esm/components/ShuttleBreadcrumb.js.map +0 -7
- package/dist/esm/components/ShuttleInfiniteScrollIndicator.js +0 -19
- package/dist/esm/components/ShuttleInfiniteScrollIndicator.js.map +0 -7
- package/dist/esm/components/ShuttleListItem/ActionButtons.js +0 -31
- package/dist/esm/components/ShuttleListItem/ActionButtons.js.map +0 -7
- package/dist/esm/components/ShuttleListItem/ShuttleListItem.js +0 -54
- package/dist/esm/components/ShuttleListItem/ShuttleListItem.js.map +0 -7
- package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js +0 -61
- package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js.map +0 -7
- package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js +0 -44
- package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js.map +0 -7
- package/dist/esm/components/ShuttleListPanel.js +0 -20
- package/dist/esm/components/ShuttleListPanel.js.map +0 -7
- package/dist/esm/components/ShuttleSearchBox.js +0 -70
- package/dist/esm/components/ShuttleSearchBox.js.map +0 -7
- package/dist/esm/components/ShuttleSource.js +0 -175
- package/dist/esm/components/ShuttleSource.js.map +0 -7
- package/dist/esm/components/ShuttleTarget.js +0 -86
- package/dist/esm/components/ShuttleTarget.js.map +0 -7
- package/dist/esm/components/VirtualizedItem.js +0 -22
- package/dist/esm/components/VirtualizedItem.js.map +0 -7
- package/dist/esm/components/VirtualizedList.js +0 -59
- package/dist/esm/components/VirtualizedList.js.map +0 -7
- package/dist/esm/components/VirtualizedSortableList.js +0 -19
- package/dist/esm/components/VirtualizedSortableList.js.map +0 -7
- package/dist/esm/helper.js +0 -54
- package/dist/esm/helper.js.map +0 -7
- package/dist/esm/index.js +0 -9
- package/dist/esm/index.js.map +0 -7
- package/dist/esm/tests/utils.js +0 -1189
- package/dist/esm/tests/utils.js.map +0 -7
- package/dist/esm/updateShuttleStateFromProps.js +0 -69
- package/dist/esm/updateShuttleStateFromProps.js.map +0 -7
- package/dist/esm/utils.js +0 -12
- package/dist/esm/utils.js.map +0 -7
- package/dist/esm/withProviders.js +0 -16
- package/dist/esm/withProviders.js.map +0 -7
- package/dist/types/ShuttleImpl.d.ts +0 -4
- package/dist/types/index.d.ts +0 -1
- package/dist/types/updateShuttleStateFromProps.d.ts +0 -3
|
@@ -0,0 +1,46 @@
|
|
|
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 _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
10
|
+
import { useContext } from 'react';
|
|
11
|
+
import { useTransition, animated } from 'react-spring/web';
|
|
12
|
+
import { animationConfig } from '../animation/animationConfig.js';
|
|
13
|
+
import AnimationContext from '../AnimationState.js';
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
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; }
|
|
18
|
+
|
|
19
|
+
function OverflowList(_ref) {
|
|
20
|
+
let {
|
|
21
|
+
className = '',
|
|
22
|
+
activeHierarchy = '',
|
|
23
|
+
children
|
|
24
|
+
} = _ref;
|
|
25
|
+
const {
|
|
26
|
+
state: {
|
|
27
|
+
isDrillingDown = false
|
|
28
|
+
},
|
|
29
|
+
setIsDrillingDown
|
|
30
|
+
} = useContext(AnimationContext.Context);
|
|
31
|
+
const overflowTransition = useTransition(activeHierarchy, null, _objectSpread(_objectSpread({}, animationConfig.moveList(isDrillingDown)), {}, {
|
|
32
|
+
onDestroyed: () => setIsDrillingDown(false)
|
|
33
|
+
}));
|
|
34
|
+
return overflowTransition.map(_ref2 => {
|
|
35
|
+
let {
|
|
36
|
+
props,
|
|
37
|
+
key
|
|
38
|
+
} = _ref2;
|
|
39
|
+
return /*#__PURE__*/_jsx(animated.div, {
|
|
40
|
+
className: className,
|
|
41
|
+
style: props
|
|
42
|
+
}, key, children);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { OverflowList as default };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
4
|
+
import 'react';
|
|
5
|
+
import { useTransition, animated } from 'react-spring/web';
|
|
6
|
+
import DSBreadcrumb from '@elliemae/ds-basic/Breadcrumb';
|
|
7
|
+
import { animationConfig } from '../animation/animationConfig.js';
|
|
8
|
+
|
|
9
|
+
function ShuttleBreadcrumb(_ref) {
|
|
10
|
+
let {
|
|
11
|
+
className = '',
|
|
12
|
+
hierarchy = [],
|
|
13
|
+
onNavigateTo = () => null
|
|
14
|
+
} = _ref;
|
|
15
|
+
const animatedCrumbs = useTransition(hierarchy, item => item.id, animationConfig.breadcrumb());
|
|
16
|
+
return /*#__PURE__*/_jsx("div", {
|
|
17
|
+
className: className
|
|
18
|
+
}, void 0, /*#__PURE__*/_jsx(DSBreadcrumb, {
|
|
19
|
+
isTitle: true
|
|
20
|
+
}, void 0, animatedCrumbs.map(_ref2 => {
|
|
21
|
+
let {
|
|
22
|
+
item,
|
|
23
|
+
props,
|
|
24
|
+
key
|
|
25
|
+
} = _ref2;
|
|
26
|
+
return /*#__PURE__*/_jsx(DSBreadcrumb.Item, {
|
|
27
|
+
containerComponent: animated.li,
|
|
28
|
+
label: item.name,
|
|
29
|
+
onClick: () => onNavigateTo(item, 'up'),
|
|
30
|
+
style: props
|
|
31
|
+
}, key);
|
|
32
|
+
})));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { ShuttleBreadcrumb as default };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
4
|
+
import DSIndeterminateProgressIndicator from '@elliemae/ds-indeterminate-progress-indicator';
|
|
5
|
+
|
|
6
|
+
var _DSIndeterminateProgr;
|
|
7
|
+
const blockName = 'shuttle-infinite-scroll-indicator';
|
|
8
|
+
const InfiniteScrollBarContainer = aggregatedClasses('div')(blockName, null, _ref => {
|
|
9
|
+
let {
|
|
10
|
+
isOpen
|
|
11
|
+
} = _ref;
|
|
12
|
+
return {
|
|
13
|
+
opened: isOpen
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const ShuttleInfiniteScrollIndicator = _ref2 => {
|
|
18
|
+
let {
|
|
19
|
+
isOpen
|
|
20
|
+
} = _ref2;
|
|
21
|
+
return /*#__PURE__*/_jsx(InfiniteScrollBarContainer, {
|
|
22
|
+
classProps: {
|
|
23
|
+
isOpen
|
|
24
|
+
},
|
|
25
|
+
"data-testid": blockName
|
|
26
|
+
}, void 0, _DSIndeterminateProgr || (_DSIndeterminateProgr = /*#__PURE__*/_jsx(DSIndeterminateProgressIndicator, {
|
|
27
|
+
processing: true,
|
|
28
|
+
title: "Loading"
|
|
29
|
+
})));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { ShuttleInfiniteScrollIndicator as default };
|
|
@@ -0,0 +1,43 @@
|
|
|
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 _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
+
import 'react';
|
|
9
|
+
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
10
|
+
import DSButton from '@elliemae/ds-button';
|
|
11
|
+
import { ArrowShortRight, ArrowShortReturn, CloseCircle } from '@elliemae/ds-icons';
|
|
12
|
+
import { jsx } from 'react/jsx-runtime';
|
|
13
|
+
|
|
14
|
+
var _CloseCircle, _ArrowShortRight, _ArrowShortReturn;
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
const ActionButton = aggregatedClasses(DSButton)('shuttle-list-item', 'action-button');
|
|
20
|
+
const DeleteButton = props => /*#__PURE__*/jsx(ActionButton, _objectSpread({
|
|
21
|
+
buttonType: "text",
|
|
22
|
+
icon: _CloseCircle || (_CloseCircle = /*#__PURE__*/_jsx(CloseCircle, {}))
|
|
23
|
+
}, props));
|
|
24
|
+
const MoveButton = props => /*#__PURE__*/jsx(ActionButton, _objectSpread(_objectSpread({
|
|
25
|
+
buttonType: "text",
|
|
26
|
+
icon: _ArrowShortRight || (_ArrowShortRight = /*#__PURE__*/_jsx(ArrowShortRight, {}))
|
|
27
|
+
}, props), {}, {
|
|
28
|
+
containerProps: {
|
|
29
|
+
'data-testid': 'ds-shuttle__move-button'
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
const DrillDownButton = props => /*#__PURE__*/jsx(ActionButton, _objectSpread(_objectSpread({
|
|
33
|
+
buttonType: "text",
|
|
34
|
+
icon: _ArrowShortReturn || (_ArrowShortReturn = /*#__PURE__*/_jsx(ArrowShortReturn, {
|
|
35
|
+
"data-testid": "shuttle__drill-btn-icon"
|
|
36
|
+
}))
|
|
37
|
+
}, props), {}, {
|
|
38
|
+
containerProps: {
|
|
39
|
+
'data-testid': 'shuttle__drill-btn'
|
|
40
|
+
}
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
export { DeleteButton, DrillDownButton, MoveButton };
|
|
@@ -0,0 +1,76 @@
|
|
|
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 _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
9
|
+
import 'react';
|
|
10
|
+
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
11
|
+
import { animated } from 'react-spring/web';
|
|
12
|
+
import TruncatedTooltipText from '@elliemae/ds-basic/TruncatedTooltipText';
|
|
13
|
+
import { sortableHandle } from 'react-sortable-hoc';
|
|
14
|
+
import { GripperVertical } from '@elliemae/ds-icons';
|
|
15
|
+
import { isMovable } from '../../helper.js';
|
|
16
|
+
import { jsxs } from 'react/jsx-runtime';
|
|
17
|
+
|
|
18
|
+
const _excluded = ["item", "showIcons", "showIcon", "onSelect", "isChecked", "style", "showActions", "actions", "showSortHandler"];
|
|
19
|
+
|
|
20
|
+
var _GripperVertical, _SortHandler;
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
const blockName = 'shuttle-list-item';
|
|
26
|
+
const Wrapper = aggregatedClasses(animated.li)(blockName);
|
|
27
|
+
const ActionsGroup = aggregatedClasses('div')(blockName, 'actions');
|
|
28
|
+
const IconWrapper = aggregatedClasses('div')(blockName, 'icon-wrapper');
|
|
29
|
+
const Content = aggregatedClasses('label')(blockName, 'content', _ref => {
|
|
30
|
+
let {
|
|
31
|
+
isChecked,
|
|
32
|
+
canMove,
|
|
33
|
+
isReadonly
|
|
34
|
+
} = _ref;
|
|
35
|
+
return {
|
|
36
|
+
checked: isChecked,
|
|
37
|
+
'can-hover': canMove,
|
|
38
|
+
'read-only': isReadonly
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
const SortHandler = sortableHandle(() => _GripperVertical || (_GripperVertical = /*#__PURE__*/_jsx(GripperVertical, {
|
|
42
|
+
className: "gripper"
|
|
43
|
+
})));
|
|
44
|
+
|
|
45
|
+
function ShuttleListItem(_ref2) {
|
|
46
|
+
let {
|
|
47
|
+
item = {},
|
|
48
|
+
showIcons = undefined,
|
|
49
|
+
showIcon = true,
|
|
50
|
+
onSelect = () => null,
|
|
51
|
+
isChecked = false,
|
|
52
|
+
style = undefined,
|
|
53
|
+
showActions = true,
|
|
54
|
+
actions = [],
|
|
55
|
+
showSortHandler = false
|
|
56
|
+
} = _ref2,
|
|
57
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
58
|
+
|
|
59
|
+
return /*#__PURE__*/jsxs(Wrapper, _objectSpread(_objectSpread({}, rest), {}, {
|
|
60
|
+
role: "listitem",
|
|
61
|
+
style: style,
|
|
62
|
+
children: [/*#__PURE__*/_jsx(Content, {
|
|
63
|
+
classProps: {
|
|
64
|
+
canMove: isMovable(item),
|
|
65
|
+
isChecked,
|
|
66
|
+
isReadonly: item.readyOnly
|
|
67
|
+
},
|
|
68
|
+
onClick: onSelect
|
|
69
|
+
}, void 0, showSortHandler && (_SortHandler || (_SortHandler = /*#__PURE__*/_jsx(SortHandler, {}))), (showIcon || showIcons) && /*#__PURE__*/_jsx(IconWrapper, {}, void 0, item.icon), /*#__PURE__*/_jsx(TruncatedTooltipText, {
|
|
70
|
+
className: "shuttle-tooltip-text",
|
|
71
|
+
value: item.name
|
|
72
|
+
})), showActions && /*#__PURE__*/_jsx(ActionsGroup, {}, void 0, actions)]
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { ShuttleListItem as default };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
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 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
10
|
+
import { useState, useCallback, useEffect } from 'react';
|
|
11
|
+
import { isMovable } from '../../helper.js';
|
|
12
|
+
import { DrillDownButton, MoveButton } from './ActionButtons.js';
|
|
13
|
+
import ShuttleListItem from './ShuttleListItem.js';
|
|
14
|
+
import { jsx } from 'react/jsx-runtime';
|
|
15
|
+
|
|
16
|
+
const _excluded = ["item", "onItemCheck", "onMoveToTarget", "onNavigateOnSourceTo", "isChecked", "showMoveButton", "showDrillDownButton", "index"];
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
function ShuttleSourceListItem(_ref) {
|
|
23
|
+
let {
|
|
24
|
+
item = {},
|
|
25
|
+
onItemCheck = () => null,
|
|
26
|
+
onMoveToTarget = () => null,
|
|
27
|
+
onNavigateOnSourceTo = () => null,
|
|
28
|
+
isChecked = false,
|
|
29
|
+
showMoveButton = true,
|
|
30
|
+
showDrillDownButton = true,
|
|
31
|
+
index
|
|
32
|
+
} = _ref,
|
|
33
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
34
|
+
|
|
35
|
+
const [clicked, setClicked] = useState(false);
|
|
36
|
+
const moveToTarget = useCallback(() => onMoveToTarget(item), [item]);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (clicked) {
|
|
39
|
+
moveToTarget();
|
|
40
|
+
}
|
|
41
|
+
}, [clicked]);
|
|
42
|
+
const navigateOnSourceTo = useCallback(() => onNavigateOnSourceTo(item), [item]);
|
|
43
|
+
const checkItem = useCallback(() => {
|
|
44
|
+
if (!clicked) onItemCheck(item);
|
|
45
|
+
}, [item, clicked]);
|
|
46
|
+
|
|
47
|
+
const handleOnClick = () => {
|
|
48
|
+
if (!clicked) {
|
|
49
|
+
setClicked(true);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return /*#__PURE__*/jsx(ShuttleListItem, _objectSpread(_objectSpread({}, rest), {}, {
|
|
54
|
+
actions: [showDrillDownButton && /*#__PURE__*/_jsx(DrillDownButton, {
|
|
55
|
+
disabled: !item.hasChildren && !item.asyncLoad || item.readOnly || item.disableDrillDown,
|
|
56
|
+
onClick: navigateOnSourceTo
|
|
57
|
+
}, "drill-down"), showMoveButton && /*#__PURE__*/_jsx(MoveButton, {
|
|
58
|
+
"data-testid": "ds-shuttle__move-button",
|
|
59
|
+
disabled: !isMovable(item) || item.readOnly,
|
|
60
|
+
onClick: handleOnClick
|
|
61
|
+
}, "move")],
|
|
62
|
+
isChecked: isChecked,
|
|
63
|
+
item: item,
|
|
64
|
+
onSelect: checkItem
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { ShuttleSourceListItem as default };
|
|
@@ -0,0 +1,49 @@
|
|
|
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 _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
9
|
+
import { useCallback } from 'react';
|
|
10
|
+
import { DrillDownButton, DeleteButton } from './ActionButtons.js';
|
|
11
|
+
import ShuttleListItem from './ShuttleListItem.js';
|
|
12
|
+
import { jsx } from 'react/jsx-runtime';
|
|
13
|
+
|
|
14
|
+
const _excluded = ["item", "onMoveToSource", "onNavigateOnTargetTo", "isRoot", "showDeleteButton", "showDrillDownButton", "showActions", "index"];
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
20
|
+
function ShuttleTargetListItem(_ref) {
|
|
21
|
+
let {
|
|
22
|
+
item = {},
|
|
23
|
+
onMoveToSource = () => null,
|
|
24
|
+
onNavigateOnTargetTo = () => null,
|
|
25
|
+
isRoot = false,
|
|
26
|
+
showDeleteButton = true,
|
|
27
|
+
showDrillDownButton = true,
|
|
28
|
+
showActions = true,
|
|
29
|
+
index
|
|
30
|
+
} = _ref,
|
|
31
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
|
|
33
|
+
const moveToSource = useCallback(() => onMoveToSource(item), [item]);
|
|
34
|
+
const navigateOnTargetTo = useCallback(() => onNavigateOnTargetTo(item), [item]);
|
|
35
|
+
return /*#__PURE__*/jsx(ShuttleListItem, _objectSpread(_objectSpread({}, rest), {}, {
|
|
36
|
+
actions: [showDrillDownButton && /*#__PURE__*/_jsx(DrillDownButton, {
|
|
37
|
+
disabled: !item.hasChildren && !item.asyncLoad || item.readOnly || item.disableDrillDown,
|
|
38
|
+
onClick: navigateOnTargetTo
|
|
39
|
+
}, "drill-down"), showDeleteButton && isRoot && /*#__PURE__*/_jsx(DeleteButton, {
|
|
40
|
+
disabled: item.readOnly,
|
|
41
|
+
onClick: moveToSource,
|
|
42
|
+
"data-testid": "ds-shuttle__close-button"
|
|
43
|
+
}, "delete")],
|
|
44
|
+
item: item,
|
|
45
|
+
showActions: showActions
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { ShuttleTargetListItem as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
3
|
+
import DSButton from '@elliemae/ds-button';
|
|
4
|
+
import { ShuttleListPanel as ShuttleListPanel$1 } from '../classedComponents.js';
|
|
5
|
+
|
|
6
|
+
function ShuttleListPanel(_ref) {
|
|
7
|
+
let {
|
|
8
|
+
onClick = () => null,
|
|
9
|
+
open = false,
|
|
10
|
+
children
|
|
11
|
+
} = _ref;
|
|
12
|
+
return /*#__PURE__*/_jsx(ShuttleListPanel$1, {
|
|
13
|
+
classProps: {
|
|
14
|
+
open
|
|
15
|
+
}
|
|
16
|
+
}, void 0, /*#__PURE__*/_jsx(DSButton, {
|
|
17
|
+
buttonType: "text",
|
|
18
|
+
icon: children,
|
|
19
|
+
onClick: onClick,
|
|
20
|
+
"data-testid": "list-panel-btn"
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { ShuttleListPanel as default };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
4
|
+
import { debounce } from '@elliemae/ds-utilities';
|
|
5
|
+
import { DSTextBox } from '@elliemae/ds-form';
|
|
6
|
+
|
|
7
|
+
const blockName = 'shuttle-search-box';
|
|
8
|
+
const SearchBoxContainer = aggregatedClasses('div')(blockName, null, _ref => {
|
|
9
|
+
let {
|
|
10
|
+
isOpen
|
|
11
|
+
} = _ref;
|
|
12
|
+
return {
|
|
13
|
+
opened: isOpen
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
const filterList = debounce((term, onFilterCallback) => {
|
|
17
|
+
onFilterCallback(term);
|
|
18
|
+
}, 200);
|
|
19
|
+
class ShuttleSearchBox extends Component {
|
|
20
|
+
constructor(props) {
|
|
21
|
+
super(props);
|
|
22
|
+
this.state = {
|
|
23
|
+
value: props.value,
|
|
24
|
+
prevProps: {}
|
|
25
|
+
};
|
|
26
|
+
this.handleChange = this.handleChange.bind(this);
|
|
27
|
+
this.handleKeyPress = this.handleKeyPress.bind(this);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static getDerivedStateFromProps(nextProps, _ref2) {
|
|
31
|
+
let {
|
|
32
|
+
prevProps
|
|
33
|
+
} = _ref2;
|
|
34
|
+
const {
|
|
35
|
+
value
|
|
36
|
+
} = nextProps;
|
|
37
|
+
|
|
38
|
+
if (value !== prevProps.value) {
|
|
39
|
+
return {
|
|
40
|
+
value,
|
|
41
|
+
prevProps: {
|
|
42
|
+
value
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
handleChange(e) {
|
|
51
|
+
const {
|
|
52
|
+
onChange,
|
|
53
|
+
filterOnKeyStroke,
|
|
54
|
+
onFilter
|
|
55
|
+
} = this.props;
|
|
56
|
+
const {
|
|
57
|
+
value
|
|
58
|
+
} = e.target;
|
|
59
|
+
onChange(value);
|
|
60
|
+
if (filterOnKeyStroke) filterList(value, onFilter);
|
|
61
|
+
this.setState({
|
|
62
|
+
value
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
handleKeyPress(e) {
|
|
67
|
+
const {
|
|
68
|
+
onFilter
|
|
69
|
+
} = this.props;
|
|
70
|
+
if (e.keyCode === 13) onFilter(e.target.value);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
render() {
|
|
74
|
+
const {
|
|
75
|
+
value
|
|
76
|
+
} = this.state;
|
|
77
|
+
const {
|
|
78
|
+
isOpen,
|
|
79
|
+
onClose,
|
|
80
|
+
placeholder
|
|
81
|
+
} = this.props;
|
|
82
|
+
return /*#__PURE__*/_jsx(SearchBoxContainer, {
|
|
83
|
+
classProps: {
|
|
84
|
+
isOpen
|
|
85
|
+
}
|
|
86
|
+
}, void 0, /*#__PURE__*/_jsx(DSTextBox, {
|
|
87
|
+
autoFocus: true,
|
|
88
|
+
clearable: true,
|
|
89
|
+
onChange: this.handleChange,
|
|
90
|
+
onClear: onClose,
|
|
91
|
+
onKeyDown: this.handleKeyPress,
|
|
92
|
+
placeholder: placeholder,
|
|
93
|
+
value: value
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
}
|
|
98
|
+
ShuttleSearchBox.defaultProps = {
|
|
99
|
+
filterOnKeyStroke: false,
|
|
100
|
+
onChange: () => null,
|
|
101
|
+
onFilter: () => null
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export { ShuttleSearchBox as default };
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
2
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.reduce.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.reduce.js';
|
|
7
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
9
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
10
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
11
|
+
import { useContext, useMemo, useCallback } from 'react';
|
|
12
|
+
import { Search, ArrowShortRight } from '@elliemae/ds-icons';
|
|
13
|
+
import DSButton from '@elliemae/ds-button';
|
|
14
|
+
import { runAll } from '@elliemae/ds-utilities';
|
|
15
|
+
import ShuttleSearchBox from './ShuttleSearchBox.js';
|
|
16
|
+
import ShuttleInfiniteScrollIndicator from './ShuttleInfiniteScrollIndicator.js';
|
|
17
|
+
import ShuttleSourceListItem from './ShuttleListItem/ShuttleSourceListItem.js';
|
|
18
|
+
import { ShuttleWrapper, ShuttleHeader, ShuttleHeaderBreadcrumb, ShuttleHeaderSearchToggle, ShuttleList, Overflow, LoadingList, EmptyMessage, ShuttleFooter, ShuttleFooterActions, ShuttleFooterCounter } from '../classedComponents.js';
|
|
19
|
+
import ShuttleListPanel from './ShuttleListPanel.js';
|
|
20
|
+
import VirtualizedList from './VirtualizedList.js';
|
|
21
|
+
import { getActiveIdFromHierarchy } from '../helper.js';
|
|
22
|
+
import AnimationContext from '../AnimationState.js';
|
|
23
|
+
import SearchState from '../SearchState.js';
|
|
24
|
+
import VirtualizedSortableList from './VirtualizedSortableList.js';
|
|
25
|
+
import LoadingIndicator from './LoadingIndicator.js';
|
|
26
|
+
import { jsx } from 'react/jsx-runtime';
|
|
27
|
+
|
|
28
|
+
const _excluded = ["item"];
|
|
29
|
+
|
|
30
|
+
var _Search, _LoadingList, _ArrowShortRight, _ShuttleInfiniteScrol;
|
|
31
|
+
|
|
32
|
+
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; }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
36
|
+
const noop = () => {};
|
|
37
|
+
|
|
38
|
+
function ShuttleSource(_ref) {
|
|
39
|
+
let {
|
|
40
|
+
items = [],
|
|
41
|
+
checkedItems = [],
|
|
42
|
+
// build Map() and memoize it for better performance
|
|
43
|
+
hierarchy = [],
|
|
44
|
+
onMoveItem = noop,
|
|
45
|
+
onCheckItem = noop,
|
|
46
|
+
onMoveCheckedItems = noop,
|
|
47
|
+
onNavigateTo = noop,
|
|
48
|
+
onClearCheckedItems = noop,
|
|
49
|
+
emptyMessage = 'No items found',
|
|
50
|
+
composeSourceItemProps = noop,
|
|
51
|
+
loading = false,
|
|
52
|
+
onSearch = noop,
|
|
53
|
+
onSearchClose = noop,
|
|
54
|
+
onSearchOpen = noop,
|
|
55
|
+
sourceSortable = false,
|
|
56
|
+
onSortEnd = noop,
|
|
57
|
+
sourceClearItemsText = 'CLEAR ALL',
|
|
58
|
+
searchPlaceholder,
|
|
59
|
+
renderSourceCounter = amount => "".concat(amount, " items"),
|
|
60
|
+
onGetMoreItems = () => {},
|
|
61
|
+
moreItemsLoading = false,
|
|
62
|
+
hasNextPage = false
|
|
63
|
+
} = _ref;
|
|
64
|
+
const {
|
|
65
|
+
state: {
|
|
66
|
+
isMovingBack = false,
|
|
67
|
+
isMoving
|
|
68
|
+
}
|
|
69
|
+
} = useContext(AnimationContext.Context);
|
|
70
|
+
const {
|
|
71
|
+
state: {
|
|
72
|
+
searching,
|
|
73
|
+
searchTerm
|
|
74
|
+
},
|
|
75
|
+
setSearchTerm,
|
|
76
|
+
reset: resetSearch,
|
|
77
|
+
toggleSearchBox
|
|
78
|
+
} = useContext(SearchState.Context);
|
|
79
|
+
const hashedCheckedItems = useMemo(() => checkedItems.reduce((result, item) => _objectSpread(_objectSpread({}, result), {}, {
|
|
80
|
+
[item]: true
|
|
81
|
+
}), {}), [checkedItems]);
|
|
82
|
+
const handleCloseSearch = useCallback(() => {
|
|
83
|
+
setSearchTerm('');
|
|
84
|
+
runAll(resetSearch, onSearchClose)();
|
|
85
|
+
}, [searching]);
|
|
86
|
+
const handleToggleSearch = useCallback(() => {
|
|
87
|
+
toggleSearchBox(!searching);
|
|
88
|
+
|
|
89
|
+
if (searching) {
|
|
90
|
+
handleCloseSearch();
|
|
91
|
+
} else {
|
|
92
|
+
onSearchOpen();
|
|
93
|
+
}
|
|
94
|
+
}, [searching]);
|
|
95
|
+
const ComponentList = useMemo(() => sourceSortable ? VirtualizedSortableList : VirtualizedList, [sourceSortable]);
|
|
96
|
+
|
|
97
|
+
const handleSortEnd = _ref2 => {
|
|
98
|
+
let {
|
|
99
|
+
oldIndex,
|
|
100
|
+
newIndex
|
|
101
|
+
} = _ref2;
|
|
102
|
+
onSortEnd({
|
|
103
|
+
sourceItem: items[oldIndex],
|
|
104
|
+
targetItem: items[newIndex]
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const isEmpty = !items.length;
|
|
109
|
+
const hasContent = !loading && !isEmpty;
|
|
110
|
+
const contentIsEmpty = !loading && isEmpty;
|
|
111
|
+
return /*#__PURE__*/_jsx(ShuttleWrapper, {}, void 0, /*#__PURE__*/_jsx(ShuttleHeader, {}, void 0, /*#__PURE__*/_jsx(ShuttleHeaderBreadcrumb, {
|
|
112
|
+
hierarchy: hierarchy,
|
|
113
|
+
onNavigateTo: onNavigateTo
|
|
114
|
+
}), /*#__PURE__*/_jsx(ShuttleHeaderSearchToggle, {
|
|
115
|
+
buttonType: "text",
|
|
116
|
+
icon: _Search || (_Search = /*#__PURE__*/_jsx(Search, {})),
|
|
117
|
+
onClick: handleToggleSearch,
|
|
118
|
+
containerProps: {
|
|
119
|
+
'data-testid': 'shuttle-header-search-toggle'
|
|
120
|
+
}
|
|
121
|
+
})), /*#__PURE__*/_jsx(ShuttleList, {
|
|
122
|
+
classProps: {
|
|
123
|
+
showPulse: isMovingBack
|
|
124
|
+
},
|
|
125
|
+
style: {
|
|
126
|
+
pointerEvents: isMoving ? 'none' : null
|
|
127
|
+
}
|
|
128
|
+
}, void 0, /*#__PURE__*/_jsx(ShuttleSearchBox, {
|
|
129
|
+
isOpen: searching,
|
|
130
|
+
onClose: runAll(() => toggleSearchBox(false), handleCloseSearch),
|
|
131
|
+
onFilter: runAll(setSearchTerm, onSearch),
|
|
132
|
+
placeholder: searchPlaceholder,
|
|
133
|
+
value: searchTerm
|
|
134
|
+
}, searching), hasContent ? /*#__PURE__*/_jsx(Overflow, {
|
|
135
|
+
activeHierarchy: getActiveIdFromHierarchy(hierarchy).id,
|
|
136
|
+
classProps: {
|
|
137
|
+
searching,
|
|
138
|
+
empty: isEmpty
|
|
139
|
+
}
|
|
140
|
+
}, void 0, /*#__PURE__*/_jsx(ComponentList, {
|
|
141
|
+
helperClass: "drag-helper",
|
|
142
|
+
itemRenderer: _ref3 => {
|
|
143
|
+
let {
|
|
144
|
+
item
|
|
145
|
+
} = _ref3,
|
|
146
|
+
rest = _objectWithoutProperties(_ref3, _excluded);
|
|
147
|
+
|
|
148
|
+
return /*#__PURE__*/jsx(ShuttleSourceListItem, _objectSpread(_objectSpread(_objectSpread({
|
|
149
|
+
"data-testid": "source-list-item"
|
|
150
|
+
}, rest), composeSourceItemProps(item, rest)), {}, {
|
|
151
|
+
isChecked: !!hashedCheckedItems[item.id],
|
|
152
|
+
item: item,
|
|
153
|
+
onItemCheck: onCheckItem,
|
|
154
|
+
onMoveToTarget: onMoveItem,
|
|
155
|
+
onNavigateOnSourceTo: onNavigateTo,
|
|
156
|
+
showSortHandler: sourceSortable
|
|
157
|
+
}));
|
|
158
|
+
},
|
|
159
|
+
items: items,
|
|
160
|
+
onSortEnd: handleSortEnd,
|
|
161
|
+
getMoreItems: onGetMoreItems,
|
|
162
|
+
hasNextPage: hasNextPage
|
|
163
|
+
}, searchTerm)) : null, contentIsEmpty ? /*#__PURE__*/_jsx(LoadingList, {
|
|
164
|
+
"data-testid": "shuttle__loading-list"
|
|
165
|
+
}, void 0, /*#__PURE__*/_jsx(EmptyMessage, {}, void 0, emptyMessage)) : null, loading ? _LoadingList || (_LoadingList = /*#__PURE__*/_jsx(LoadingList, {
|
|
166
|
+
"data-testid": "shuttle__loading-list"
|
|
167
|
+
}, void 0, /*#__PURE__*/_jsx(LoadingIndicator, {}))) : null, /*#__PURE__*/_jsx(ShuttleListPanel, {
|
|
168
|
+
onClick: onMoveCheckedItems,
|
|
169
|
+
open: checkedItems.length > 1
|
|
170
|
+
}, void 0, _ArrowShortRight || (_ArrowShortRight = /*#__PURE__*/_jsx(ArrowShortRight, {}))), moreItemsLoading ? _ShuttleInfiniteScrol || (_ShuttleInfiniteScrol = /*#__PURE__*/_jsx(ShuttleInfiniteScrollIndicator, {
|
|
171
|
+
isOpen: true
|
|
172
|
+
})) : null), /*#__PURE__*/_jsx(ShuttleFooter, {}, void 0, /*#__PURE__*/_jsx(ShuttleFooterActions, {}, void 0, !!checkedItems.length && /*#__PURE__*/_jsx(DSButton, {
|
|
173
|
+
buttonType: "link",
|
|
174
|
+
labelText: sourceClearItemsText,
|
|
175
|
+
onClick: onClearCheckedItems
|
|
176
|
+
})), /*#__PURE__*/_jsx(ShuttleFooterCounter, {}, void 0, renderSourceCounter(checkedItems.length))));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export { ShuttleSource as default };
|