@elliemae/ds-shuttle 2.2.0-alpha.4 → 3.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/AnimationState.js +19 -46
- package/cjs/DSShuttle.js +219 -166
- package/cjs/SearchState.js +25 -44
- package/cjs/Shuttle.actions.js +98 -87
- package/cjs/ShuttleContainer.js +61 -56
- package/cjs/ShuttleImpl.js +206 -109
- package/cjs/ShuttleRenderer.js +135 -140
- package/cjs/ShuttleState.js +53 -57
- package/cjs/animation/animationConfig.js +56 -53
- package/cjs/classedComponents.js +69 -70
- package/cjs/components/LoadingIndicator.js +22 -49
- package/cjs/components/OverflowList.js +48 -50
- package/cjs/components/ShuttleBreadcrumb.js +40 -52
- package/cjs/components/ShuttleInfiniteScrollIndicator.js +37 -46
- package/cjs/components/ShuttleListItem/ActionButtons.js +51 -56
- package/cjs/components/ShuttleListItem/ShuttleListItem.js +80 -78
- package/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +64 -78
- package/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +56 -72
- package/cjs/components/ShuttleListPanel.js +26 -44
- package/cjs/components/ShuttleSearchBox.js +72 -61
- package/cjs/components/ShuttleSource.js +146 -150
- package/cjs/components/ShuttleTarget.js +100 -88
- package/cjs/components/VirtualizedItem.js +40 -45
- package/cjs/components/VirtualizedList.js +86 -81
- package/cjs/components/VirtualizedSortableList.js +40 -47
- package/cjs/helper.js +103 -69
- package/cjs/index.js +12 -38
- package/cjs/updateShuttleStateFromProps.js +69 -73
- package/cjs/utils.js +42 -40
- package/cjs/withProviders.js +27 -43
- package/esm/AnimationState.js +8 -12
- package/esm/DSShuttle.js +198 -126
- package/esm/SearchState.js +19 -15
- package/esm/Shuttle.actions.js +80 -63
- package/esm/ShuttleContainer.js +50 -34
- package/esm/ShuttleImpl.js +183 -78
- package/esm/ShuttleRenderer.js +128 -111
- package/esm/ShuttleState.js +53 -34
- package/esm/animation/animationConfig.js +52 -24
- package/esm/classedComponents.js +51 -43
- package/esm/components/LoadingIndicator.js +15 -20
- package/esm/components/OverflowList.js +41 -21
- package/esm/components/ShuttleBreadcrumb.js +33 -23
- package/esm/components/ShuttleInfiniteScrollIndicator.js +31 -18
- package/esm/components/ShuttleListItem/ActionButtons.js +39 -27
- package/esm/components/ShuttleListItem/ShuttleListItem.js +72 -50
- package/esm/components/ShuttleListItem/ShuttleSourceListItem.js +52 -45
- package/esm/components/ShuttleListItem/ShuttleTargetListItem.js +47 -42
- package/esm/components/ShuttleListPanel.js +19 -15
- package/esm/components/ShuttleSearchBox.js +66 -32
- package/esm/components/ShuttleSource.js +129 -125
- package/esm/components/ShuttleTarget.js +89 -68
- package/esm/components/VirtualizedItem.js +33 -15
- package/esm/components/VirtualizedList.js +75 -50
- package/esm/components/VirtualizedSortableList.js +32 -17
- package/esm/helper.js +67 -43
- package/esm/index.js +2 -9
- package/esm/updateShuttleStateFromProps.js +58 -39
- package/esm/utils.js +18 -12
- package/esm/withProviders.js +20 -14
- package/package.json +11 -11
- package/types/AnimationState.d.ts +2 -3
- package/types/DSShuttle.d.ts +1 -1
- package/types/SearchState.d.ts +2 -3
- package/types/ShuttleImpl.d.ts +2 -3
- package/types/ShuttleRenderer.d.ts +0 -1
- package/types/ShuttleState.d.ts +2 -3
- package/types/components/LoadingIndicator.d.ts +0 -1
- package/types/components/OverflowList.d.ts +0 -1
- package/types/components/ShuttleBreadcrumb.d.ts +0 -1
- package/types/components/ShuttleInfiniteScrollIndicator.d.ts +0 -1
- package/types/components/ShuttleListItem/ShuttleListItem.d.ts +0 -1
- package/types/components/ShuttleListItem/ShuttleSourceListItem.d.ts +0 -1
- package/types/components/ShuttleListItem/ShuttleTargetListItem.d.ts +0 -1
- package/types/components/ShuttleListPanel.d.ts +0 -1
- package/types/components/ShuttleSearchBox.d.ts +1 -3
- package/types/components/ShuttleSource.d.ts +0 -1
- package/types/components/ShuttleTarget.d.ts +0 -1
- package/types/components/VirtualizedItem.d.ts +0 -1
- package/types/components/VirtualizedList.d.ts +0 -1
- package/types/components/VirtualizedSortableList.d.ts +0 -1
- package/types/index.d.ts +1 -1
- package/types/updateShuttleStateFromProps.d.ts +1 -3
- package/types/withProviders.d.ts +0 -1
- package/cjs/AnimationState.js.map +0 -7
- package/cjs/DSShuttle.js.map +0 -7
- package/cjs/SearchState.js.map +0 -7
- package/cjs/Shuttle.actions.js.map +0 -7
- package/cjs/ShuttleContainer.js.map +0 -7
- package/cjs/ShuttleImpl.js.map +0 -7
- package/cjs/ShuttleRenderer.js.map +0 -7
- package/cjs/ShuttleState.js.map +0 -7
- package/cjs/animation/animationConfig.js.map +0 -7
- package/cjs/classedComponents.js.map +0 -7
- package/cjs/components/LoadingIndicator.js.map +0 -7
- package/cjs/components/OverflowList.js.map +0 -7
- package/cjs/components/ShuttleBreadcrumb.js.map +0 -7
- package/cjs/components/ShuttleInfiniteScrollIndicator.js.map +0 -7
- package/cjs/components/ShuttleListItem/ActionButtons.js.map +0 -7
- package/cjs/components/ShuttleListItem/ShuttleListItem.js.map +0 -7
- package/cjs/components/ShuttleListItem/ShuttleSourceListItem.js.map +0 -7
- package/cjs/components/ShuttleListItem/ShuttleTargetListItem.js.map +0 -7
- package/cjs/components/ShuttleListPanel.js.map +0 -7
- package/cjs/components/ShuttleSearchBox.js.map +0 -7
- package/cjs/components/ShuttleSource.js.map +0 -7
- package/cjs/components/ShuttleTarget.js.map +0 -7
- package/cjs/components/VirtualizedItem.js.map +0 -7
- package/cjs/components/VirtualizedList.js.map +0 -7
- package/cjs/components/VirtualizedSortableList.js.map +0 -7
- package/cjs/helper.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/tests/utils.js +0 -1218
- package/cjs/tests/utils.js.map +0 -7
- package/cjs/updateShuttleStateFromProps.js.map +0 -7
- package/cjs/utils.js.map +0 -7
- package/cjs/withProviders.js.map +0 -7
- package/esm/AnimationState.js.map +0 -7
- package/esm/DSShuttle.js.map +0 -7
- package/esm/SearchState.js.map +0 -7
- package/esm/Shuttle.actions.js.map +0 -7
- package/esm/ShuttleContainer.js.map +0 -7
- package/esm/ShuttleImpl.js.map +0 -7
- package/esm/ShuttleRenderer.js.map +0 -7
- package/esm/ShuttleState.js.map +0 -7
- package/esm/animation/animationConfig.js.map +0 -7
- package/esm/classedComponents.js.map +0 -7
- package/esm/components/LoadingIndicator.js.map +0 -7
- package/esm/components/OverflowList.js.map +0 -7
- package/esm/components/ShuttleBreadcrumb.js.map +0 -7
- package/esm/components/ShuttleInfiniteScrollIndicator.js.map +0 -7
- package/esm/components/ShuttleListItem/ActionButtons.js.map +0 -7
- package/esm/components/ShuttleListItem/ShuttleListItem.js.map +0 -7
- package/esm/components/ShuttleListItem/ShuttleSourceListItem.js.map +0 -7
- package/esm/components/ShuttleListItem/ShuttleTargetListItem.js.map +0 -7
- package/esm/components/ShuttleListPanel.js.map +0 -7
- package/esm/components/ShuttleSearchBox.js.map +0 -7
- package/esm/components/ShuttleSource.js.map +0 -7
- package/esm/components/ShuttleTarget.js.map +0 -7
- package/esm/components/VirtualizedItem.js.map +0 -7
- package/esm/components/VirtualizedList.js.map +0 -7
- package/esm/components/VirtualizedSortableList.js.map +0 -7
- package/esm/helper.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/tests/utils.js +0 -1189
- package/esm/tests/utils.js.map +0 -7
- package/esm/updateShuttleStateFromProps.js.map +0 -7
- package/esm/utils.js.map +0 -7
- package/esm/withProviders.js.map +0 -7
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { aggregatedClasses } from
|
|
4
|
-
import { debounce } from
|
|
5
|
-
import { DSTextBox } from
|
|
6
|
-
|
|
7
|
-
const
|
|
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
|
+
});
|
|
8
16
|
const filterList = debounce((term, onFilterCallback) => {
|
|
9
17
|
onFilterCallback(term);
|
|
10
18
|
}, 200);
|
|
@@ -15,56 +23,82 @@ class ShuttleSearchBox extends Component {
|
|
|
15
23
|
value: props.value,
|
|
16
24
|
prevProps: {}
|
|
17
25
|
};
|
|
18
|
-
this.handleKeyPress = this.handleKeyPress.bind(this);
|
|
19
26
|
this.handleChange = this.handleChange.bind(this);
|
|
27
|
+
this.handleKeyPress = this.handleKeyPress.bind(this);
|
|
20
28
|
}
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
|
|
30
|
+
static getDerivedStateFromProps(nextProps, _ref2) {
|
|
31
|
+
let {
|
|
32
|
+
prevProps
|
|
33
|
+
} = _ref2;
|
|
34
|
+
const {
|
|
35
|
+
value
|
|
36
|
+
} = nextProps;
|
|
37
|
+
|
|
23
38
|
if (value !== prevProps.value) {
|
|
24
39
|
return {
|
|
25
40
|
value,
|
|
26
|
-
prevProps: {
|
|
41
|
+
prevProps: {
|
|
42
|
+
value
|
|
43
|
+
}
|
|
27
44
|
};
|
|
28
45
|
}
|
|
46
|
+
|
|
29
47
|
return null;
|
|
30
48
|
}
|
|
49
|
+
|
|
31
50
|
handleChange(e) {
|
|
32
|
-
const {
|
|
33
|
-
|
|
51
|
+
const {
|
|
52
|
+
onChange,
|
|
53
|
+
filterOnKeyStroke,
|
|
54
|
+
onFilter
|
|
55
|
+
} = this.props;
|
|
56
|
+
const {
|
|
57
|
+
value
|
|
58
|
+
} = e.target;
|
|
34
59
|
onChange(value);
|
|
35
|
-
if (filterOnKeyStroke)
|
|
36
|
-
|
|
37
|
-
|
|
60
|
+
if (filterOnKeyStroke) filterList(value, onFilter);
|
|
61
|
+
this.setState({
|
|
62
|
+
value
|
|
63
|
+
});
|
|
38
64
|
}
|
|
65
|
+
|
|
39
66
|
handleKeyPress(e) {
|
|
40
|
-
const {
|
|
41
|
-
|
|
42
|
-
|
|
67
|
+
const {
|
|
68
|
+
onFilter
|
|
69
|
+
} = this.props;
|
|
70
|
+
if (e.keyCode === 13) onFilter(e.target.value);
|
|
43
71
|
}
|
|
72
|
+
|
|
44
73
|
render() {
|
|
45
|
-
const {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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, {
|
|
50
87
|
autoFocus: true,
|
|
51
88
|
clearable: true,
|
|
52
89
|
onChange: this.handleChange,
|
|
53
90
|
onClear: onClose,
|
|
54
91
|
onKeyDown: this.handleKeyPress,
|
|
55
|
-
placeholder,
|
|
56
|
-
value
|
|
92
|
+
placeholder: placeholder,
|
|
93
|
+
value: value
|
|
57
94
|
}));
|
|
58
95
|
}
|
|
96
|
+
|
|
59
97
|
}
|
|
60
98
|
ShuttleSearchBox.defaultProps = {
|
|
61
99
|
filterOnKeyStroke: false,
|
|
62
100
|
onChange: () => null,
|
|
63
101
|
onFilter: () => null
|
|
64
102
|
};
|
|
65
|
-
|
|
66
|
-
export {
|
|
67
|
-
ShuttleSearchBox,
|
|
68
|
-
ShuttleSearchBox_default as default
|
|
69
|
-
};
|
|
70
|
-
//# sourceMappingURL=ShuttleSearchBox.js.map
|
|
103
|
+
|
|
104
|
+
export { ShuttleSearchBox as default };
|
|
@@ -1,75 +1,91 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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;
|
|
57
64
|
const {
|
|
58
|
-
state: {
|
|
59
|
-
|
|
65
|
+
state: {
|
|
66
|
+
isMovingBack = false,
|
|
67
|
+
isMoving
|
|
68
|
+
}
|
|
69
|
+
} = useContext(AnimationContext.Context);
|
|
60
70
|
const {
|
|
61
|
-
state: {
|
|
71
|
+
state: {
|
|
72
|
+
searching,
|
|
73
|
+
searchTerm
|
|
74
|
+
},
|
|
62
75
|
setSearchTerm,
|
|
63
76
|
reset: resetSearch,
|
|
64
77
|
toggleSearchBox
|
|
65
78
|
} = useContext(SearchState.Context);
|
|
66
|
-
const hashedCheckedItems = useMemo(() => checkedItems.reduce((result, item) => ({
|
|
79
|
+
const hashedCheckedItems = useMemo(() => checkedItems.reduce((result, item) => _objectSpread(_objectSpread({}, result), {}, {
|
|
80
|
+
[item]: true
|
|
81
|
+
}), {}), [checkedItems]);
|
|
67
82
|
const handleCloseSearch = useCallback(() => {
|
|
68
|
-
setSearchTerm(
|
|
83
|
+
setSearchTerm('');
|
|
69
84
|
runAll(resetSearch, onSearchClose)();
|
|
70
85
|
}, [searching]);
|
|
71
86
|
const handleToggleSearch = useCallback(() => {
|
|
72
87
|
toggleSearchBox(!searching);
|
|
88
|
+
|
|
73
89
|
if (searching) {
|
|
74
90
|
handleCloseSearch();
|
|
75
91
|
} else {
|
|
@@ -77,99 +93,87 @@ function ShuttleSource({
|
|
|
77
93
|
}
|
|
78
94
|
}, [searching]);
|
|
79
95
|
const ComponentList = useMemo(() => sourceSortable ? VirtualizedSortableList : VirtualizedList, [sourceSortable]);
|
|
80
|
-
|
|
96
|
+
|
|
97
|
+
const handleSortEnd = _ref2 => {
|
|
98
|
+
let {
|
|
99
|
+
oldIndex,
|
|
100
|
+
newIndex
|
|
101
|
+
} = _ref2;
|
|
81
102
|
onSortEnd({
|
|
82
103
|
sourceItem: items[oldIndex],
|
|
83
104
|
targetItem: items[newIndex]
|
|
84
105
|
});
|
|
85
106
|
};
|
|
107
|
+
|
|
86
108
|
const isEmpty = !items.length;
|
|
87
109
|
const hasContent = !loading && !isEmpty;
|
|
88
110
|
const contentIsEmpty = !loading && isEmpty;
|
|
89
|
-
return
|
|
90
|
-
hierarchy,
|
|
91
|
-
onNavigateTo
|
|
92
|
-
}),
|
|
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, {
|
|
93
115
|
buttonType: "text",
|
|
94
|
-
icon:
|
|
116
|
+
icon: _Search || (_Search = /*#__PURE__*/_jsx(Search, {})),
|
|
95
117
|
onClick: handleToggleSearch,
|
|
96
|
-
containerProps: {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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, {
|
|
102
129
|
isOpen: searching,
|
|
103
130
|
onClose: runAll(() => toggleSearchBox(false), handleCloseSearch),
|
|
104
131
|
onFilter: runAll(setSearchTerm, onSearch),
|
|
105
132
|
placeholder: searchPlaceholder,
|
|
106
133
|
value: searchTerm
|
|
107
|
-
}), hasContent ?
|
|
134
|
+
}, searching), hasContent ? /*#__PURE__*/_jsx(Overflow, {
|
|
108
135
|
activeHierarchy: getActiveIdFromHierarchy(hierarchy).id,
|
|
109
136
|
classProps: {
|
|
110
137
|
searching,
|
|
111
138
|
empty: isEmpty
|
|
112
139
|
}
|
|
113
|
-
},
|
|
114
|
-
key: searchTerm,
|
|
140
|
+
}, void 0, /*#__PURE__*/_jsx(ComponentList, {
|
|
115
141
|
helperClass: "drag-helper",
|
|
116
|
-
itemRenderer:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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,
|
|
128
160
|
onSortEnd: handleSortEnd,
|
|
129
161
|
getMoreItems: onGetMoreItems,
|
|
130
|
-
hasNextPage
|
|
131
|
-
})) : null, contentIsEmpty ?
|
|
162
|
+
hasNextPage: hasNextPage
|
|
163
|
+
}, searchTerm)) : null, contentIsEmpty ? /*#__PURE__*/_jsx(LoadingList, {
|
|
132
164
|
"data-testid": "shuttle__loading-list"
|
|
133
|
-
},
|
|
165
|
+
}, void 0, /*#__PURE__*/_jsx(EmptyMessage, {}, void 0, emptyMessage)) : null, loading ? _LoadingList || (_LoadingList = /*#__PURE__*/_jsx(LoadingList, {
|
|
134
166
|
"data-testid": "shuttle__loading-list"
|
|
135
|
-
},
|
|
167
|
+
}, void 0, /*#__PURE__*/_jsx(LoadingIndicator, {}))) : null, /*#__PURE__*/_jsx(ShuttleListPanel, {
|
|
136
168
|
onClick: onMoveCheckedItems,
|
|
137
169
|
open: checkedItems.length > 1
|
|
138
|
-
},
|
|
170
|
+
}, void 0, _ArrowShortRight || (_ArrowShortRight = /*#__PURE__*/_jsx(ArrowShortRight, {}))), moreItemsLoading ? _ShuttleInfiniteScrol || (_ShuttleInfiniteScrol = /*#__PURE__*/_jsx(ShuttleInfiniteScrollIndicator, {
|
|
139
171
|
isOpen: true
|
|
140
|
-
}) : null),
|
|
172
|
+
})) : null), /*#__PURE__*/_jsx(ShuttleFooter, {}, void 0, /*#__PURE__*/_jsx(ShuttleFooterActions, {}, void 0, !!checkedItems.length && /*#__PURE__*/_jsx(DSButton, {
|
|
141
173
|
buttonType: "link",
|
|
142
174
|
labelText: sourceClearItemsText,
|
|
143
175
|
onClick: onClearCheckedItems
|
|
144
|
-
})),
|
|
176
|
+
})), /*#__PURE__*/_jsx(ShuttleFooterCounter, {}, void 0, renderSourceCounter(checkedItems.length))));
|
|
145
177
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
checkedItems: PropTypes.arrayOf(PropTypes.shape({})),
|
|
149
|
-
hierarchy: PropTypes.arrayOf(PropTypes.shape({})),
|
|
150
|
-
onMoveItem: PropTypes.func,
|
|
151
|
-
onCheckItem: PropTypes.func,
|
|
152
|
-
onMoveCheckedItems: PropTypes.func,
|
|
153
|
-
onNavigateTo: PropTypes.func,
|
|
154
|
-
onClearCheckedItems: PropTypes.func,
|
|
155
|
-
emptyMessage: PropTypes.string,
|
|
156
|
-
composeSourceItemProps: PropTypes.func,
|
|
157
|
-
loading: PropTypes.bool,
|
|
158
|
-
onSearch: PropTypes.func,
|
|
159
|
-
onSearchClose: PropTypes.func,
|
|
160
|
-
onSearchOpen: PropTypes.func,
|
|
161
|
-
sourceSortable: PropTypes.bool,
|
|
162
|
-
onSortEnd: PropTypes.func,
|
|
163
|
-
sourceClearItemsText: PropTypes.string,
|
|
164
|
-
searchPlaceholder: PropTypes.string,
|
|
165
|
-
renderSourceCounter: PropTypes.func,
|
|
166
|
-
onGetMoreItems: PropTypes.func,
|
|
167
|
-
moreItemsLoading: PropTypes.bool,
|
|
168
|
-
hasNextPage: PropTypes.bool
|
|
169
|
-
};
|
|
170
|
-
var ShuttleSource_default = ShuttleSource;
|
|
171
|
-
export {
|
|
172
|
-
ShuttleSource,
|
|
173
|
-
ShuttleSource_default as default
|
|
174
|
-
};
|
|
175
|
-
//# sourceMappingURL=ShuttleSource.js.map
|
|
178
|
+
|
|
179
|
+
export { ShuttleSource as default };
|
|
@@ -1,86 +1,107 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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 { useContext } from 'react';
|
|
10
|
+
import DSButton from '@elliemae/ds-button';
|
|
11
|
+
import { ShuttleWrapper, ShuttleHeader, ShuttleHeaderBreadcrumb, ShuttleList, Overflow, LoadingList, ShuttleFooter, ShuttleFooterActions, ShuttleFooterCounter, EmptyMessage } from '../classedComponents.js';
|
|
12
|
+
import { getActiveIdFromHierarchy } from '../helper.js';
|
|
13
|
+
import AnimationContext from '../AnimationState.js';
|
|
14
|
+
import VirtualizedList from './VirtualizedList.js';
|
|
15
|
+
import ShuttleTargetListItem from './ShuttleListItem/ShuttleTargetListItem.js';
|
|
16
|
+
import VirtualizedSortableList from './VirtualizedSortableList.js';
|
|
17
|
+
import LoadingIndicator from './LoadingIndicator.js';
|
|
18
|
+
import { jsx } from 'react/jsx-runtime';
|
|
19
|
+
|
|
20
|
+
const _excluded = ["item"];
|
|
21
|
+
|
|
22
|
+
var _LoadingIndicator;
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
const noop = () => {};
|
|
29
|
+
|
|
30
|
+
function ShuttleTarget(_ref) {
|
|
31
|
+
let {
|
|
32
|
+
items = [],
|
|
33
|
+
hierarchy = [],
|
|
34
|
+
onNavigateTo = noop,
|
|
35
|
+
onMoveItem = noop,
|
|
36
|
+
onClearMovedItems = noop,
|
|
37
|
+
emptyMessage = 'No items selected',
|
|
38
|
+
composeTargetItemProps = () => ({}),
|
|
39
|
+
targetSortable = false,
|
|
40
|
+
onSortEnd = noop,
|
|
41
|
+
targetClearItemsText = 'CLEAR ALL',
|
|
42
|
+
renderTargetCounter = amount => "".concat(amount, " items"),
|
|
43
|
+
loading = false
|
|
44
|
+
} = _ref;
|
|
38
45
|
const {
|
|
39
|
-
state: {
|
|
40
|
-
|
|
46
|
+
state: {
|
|
47
|
+
isMoving = false
|
|
48
|
+
}
|
|
49
|
+
} = useContext(AnimationContext.Context);
|
|
41
50
|
const isEmpty = !items.length;
|
|
42
|
-
const emptyContent = loading ?
|
|
51
|
+
const emptyContent = loading ? _LoadingIndicator || (_LoadingIndicator = /*#__PURE__*/_jsx(LoadingIndicator, {})) : /*#__PURE__*/_jsx(EmptyMessage, {}, void 0, emptyMessage);
|
|
43
52
|
const ComponentList = targetSortable ? VirtualizedSortableList : VirtualizedList;
|
|
44
|
-
|
|
53
|
+
|
|
54
|
+
const handleSortEnd = _ref2 => {
|
|
55
|
+
let {
|
|
56
|
+
oldIndex,
|
|
57
|
+
newIndex
|
|
58
|
+
} = _ref2;
|
|
45
59
|
onSortEnd({
|
|
46
60
|
sourceItem: items[oldIndex],
|
|
47
61
|
targetItem: items[newIndex]
|
|
48
62
|
});
|
|
49
63
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
|
|
65
|
+
return /*#__PURE__*/_jsx(ShuttleWrapper, {}, void 0, /*#__PURE__*/_jsx(ShuttleHeader, {}, void 0, /*#__PURE__*/_jsx(ShuttleHeaderBreadcrumb, {
|
|
66
|
+
hierarchy: hierarchy,
|
|
67
|
+
onNavigateTo: onNavigateTo
|
|
68
|
+
})), /*#__PURE__*/_jsx(ShuttleList, {
|
|
69
|
+
classProps: {
|
|
70
|
+
showPulse: isMoving
|
|
71
|
+
}
|
|
72
|
+
}, void 0, !loading && !isEmpty ? /*#__PURE__*/_jsx(Overflow, {
|
|
56
73
|
activeHierarchy: getActiveIdFromHierarchy(hierarchy).id,
|
|
57
74
|
classProps: {
|
|
58
75
|
empty: !items.length
|
|
59
76
|
}
|
|
60
|
-
},
|
|
61
|
-
itemRenderer:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
77
|
+
}, void 0, /*#__PURE__*/_jsx(ComponentList, {
|
|
78
|
+
itemRenderer: _ref3 => {
|
|
79
|
+
let {
|
|
80
|
+
item
|
|
81
|
+
} = _ref3,
|
|
82
|
+
rest = _objectWithoutProperties(_ref3, _excluded);
|
|
83
|
+
|
|
84
|
+
return /*#__PURE__*/jsx(ShuttleTargetListItem, _objectSpread(_objectSpread(_objectSpread({
|
|
85
|
+
"data-testid": "target-list-item"
|
|
86
|
+
}, rest), composeTargetItemProps(item, rest)), {}, {
|
|
87
|
+
isRoot: !getActiveIdFromHierarchy(hierarchy).id,
|
|
88
|
+
item: item,
|
|
89
|
+
onMoveToSource: onMoveItem,
|
|
90
|
+
onNavigateOnTargetTo: onNavigateTo,
|
|
91
|
+
showSortHandler: targetSortable
|
|
92
|
+
}));
|
|
93
|
+
},
|
|
94
|
+
items: items,
|
|
72
95
|
onSortEnd: handleSortEnd,
|
|
73
96
|
target: true
|
|
74
|
-
})) :
|
|
75
|
-
containerProps: {
|
|
97
|
+
})) : /*#__PURE__*/_jsx(LoadingList, {}, void 0, emptyContent)), /*#__PURE__*/_jsx(ShuttleFooter, {}, void 0, /*#__PURE__*/_jsx(ShuttleFooterActions, {}, void 0, !!items.length && /*#__PURE__*/_jsx(DSButton, {
|
|
98
|
+
containerProps: {
|
|
99
|
+
'data-testid': 'shuttle-clear-all-target'
|
|
100
|
+
},
|
|
76
101
|
buttonType: "link",
|
|
77
102
|
labelText: targetClearItemsText,
|
|
78
103
|
onClick: onClearMovedItems
|
|
79
|
-
})),
|
|
104
|
+
})), /*#__PURE__*/_jsx(ShuttleFooterCounter, {}, void 0, renderTargetCounter(items.length))));
|
|
80
105
|
}
|
|
81
|
-
|
|
82
|
-
export {
|
|
83
|
-
ShuttleTarget,
|
|
84
|
-
ShuttleTarget_default as default
|
|
85
|
-
};
|
|
86
|
-
//# sourceMappingURL=ShuttleTarget.js.map
|
|
106
|
+
|
|
107
|
+
export { ShuttleTarget as default };
|