@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,99 +1,110 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var dsClassnames = require('@elliemae/ds-classnames');
|
|
6
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
7
|
+
var dsForm = require('@elliemae/ds-form');
|
|
8
|
+
|
|
9
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
12
|
+
|
|
13
|
+
const blockName = 'shuttle-search-box';
|
|
14
|
+
const SearchBoxContainer = dsClassnames.aggregatedClasses('div')(blockName, null, _ref => {
|
|
15
|
+
let {
|
|
16
|
+
isOpen
|
|
17
|
+
} = _ref;
|
|
18
|
+
return {
|
|
19
|
+
opened: isOpen
|
|
26
20
|
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var ShuttleSearchBox_exports = {};
|
|
29
|
-
__export(ShuttleSearchBox_exports, {
|
|
30
|
-
ShuttleSearchBox: () => ShuttleSearchBox,
|
|
31
|
-
default: () => ShuttleSearchBox_default
|
|
32
21
|
});
|
|
33
|
-
|
|
34
|
-
var import_react = __toESM(require("react"));
|
|
35
|
-
var import_ds_classnames = require("@elliemae/ds-classnames");
|
|
36
|
-
var import_ds_utilities = require("@elliemae/ds-utilities");
|
|
37
|
-
var import_ds_form = require("@elliemae/ds-form");
|
|
38
|
-
const blockName = "shuttle-search-box";
|
|
39
|
-
const SearchBoxContainer = (0, import_ds_classnames.aggregatedClasses)("div")(blockName, null, ({ isOpen }) => ({ opened: isOpen }));
|
|
40
|
-
const filterList = (0, import_ds_utilities.debounce)((term, onFilterCallback) => {
|
|
22
|
+
const filterList = dsUtilities.debounce((term, onFilterCallback) => {
|
|
41
23
|
onFilterCallback(term);
|
|
42
24
|
}, 200);
|
|
43
|
-
class ShuttleSearchBox extends
|
|
25
|
+
class ShuttleSearchBox extends react.Component {
|
|
44
26
|
constructor(props) {
|
|
45
27
|
super(props);
|
|
46
28
|
this.state = {
|
|
47
29
|
value: props.value,
|
|
48
30
|
prevProps: {}
|
|
49
31
|
};
|
|
50
|
-
this.handleKeyPress = this.handleKeyPress.bind(this);
|
|
51
32
|
this.handleChange = this.handleChange.bind(this);
|
|
33
|
+
this.handleKeyPress = this.handleKeyPress.bind(this);
|
|
52
34
|
}
|
|
53
|
-
|
|
54
|
-
|
|
35
|
+
|
|
36
|
+
static getDerivedStateFromProps(nextProps, _ref2) {
|
|
37
|
+
let {
|
|
38
|
+
prevProps
|
|
39
|
+
} = _ref2;
|
|
40
|
+
const {
|
|
41
|
+
value
|
|
42
|
+
} = nextProps;
|
|
43
|
+
|
|
55
44
|
if (value !== prevProps.value) {
|
|
56
45
|
return {
|
|
57
46
|
value,
|
|
58
|
-
prevProps: {
|
|
47
|
+
prevProps: {
|
|
48
|
+
value
|
|
49
|
+
}
|
|
59
50
|
};
|
|
60
51
|
}
|
|
52
|
+
|
|
61
53
|
return null;
|
|
62
54
|
}
|
|
55
|
+
|
|
63
56
|
handleChange(e) {
|
|
64
|
-
const {
|
|
65
|
-
|
|
57
|
+
const {
|
|
58
|
+
onChange,
|
|
59
|
+
filterOnKeyStroke,
|
|
60
|
+
onFilter
|
|
61
|
+
} = this.props;
|
|
62
|
+
const {
|
|
63
|
+
value
|
|
64
|
+
} = e.target;
|
|
66
65
|
onChange(value);
|
|
67
|
-
if (filterOnKeyStroke)
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
if (filterOnKeyStroke) filterList(value, onFilter);
|
|
67
|
+
this.setState({
|
|
68
|
+
value
|
|
69
|
+
});
|
|
70
70
|
}
|
|
71
|
+
|
|
71
72
|
handleKeyPress(e) {
|
|
72
|
-
const {
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
const {
|
|
74
|
+
onFilter
|
|
75
|
+
} = this.props;
|
|
76
|
+
if (e.keyCode === 13) onFilter(e.target.value);
|
|
75
77
|
}
|
|
78
|
+
|
|
76
79
|
render() {
|
|
77
|
-
const {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
const {
|
|
81
|
+
value
|
|
82
|
+
} = this.state;
|
|
83
|
+
const {
|
|
84
|
+
isOpen,
|
|
85
|
+
onClose,
|
|
86
|
+
placeholder
|
|
87
|
+
} = this.props;
|
|
88
|
+
return /*#__PURE__*/_jsx__default["default"](SearchBoxContainer, {
|
|
89
|
+
classProps: {
|
|
90
|
+
isOpen
|
|
91
|
+
}
|
|
92
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](dsForm.DSTextBox, {
|
|
82
93
|
autoFocus: true,
|
|
83
94
|
clearable: true,
|
|
84
95
|
onChange: this.handleChange,
|
|
85
96
|
onClear: onClose,
|
|
86
97
|
onKeyDown: this.handleKeyPress,
|
|
87
|
-
placeholder,
|
|
88
|
-
value
|
|
98
|
+
placeholder: placeholder,
|
|
99
|
+
value: value
|
|
89
100
|
}));
|
|
90
101
|
}
|
|
102
|
+
|
|
91
103
|
}
|
|
92
104
|
ShuttleSearchBox.defaultProps = {
|
|
93
105
|
filterOnKeyStroke: false,
|
|
94
106
|
onChange: () => null,
|
|
95
107
|
onFilter: () => null
|
|
96
108
|
};
|
|
97
|
-
|
|
98
|
-
module.exports =
|
|
99
|
-
//# sourceMappingURL=ShuttleSearchBox.js.map
|
|
109
|
+
|
|
110
|
+
module.exports = ShuttleSearchBox;
|
|
@@ -1,192 +1,188 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
moreItemsLoading = false,
|
|
75
|
-
hasNextPage = false
|
|
76
|
-
}) {
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
4
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
5
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.reduce.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.reduce.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
13
|
+
var react = require('react');
|
|
14
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
15
|
+
var DSButton = require('@elliemae/ds-button');
|
|
16
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
17
|
+
var ShuttleSearchBox = require('./ShuttleSearchBox.js');
|
|
18
|
+
var ShuttleInfiniteScrollIndicator = require('./ShuttleInfiniteScrollIndicator.js');
|
|
19
|
+
var ShuttleSourceListItem = require('./ShuttleListItem/ShuttleSourceListItem.js');
|
|
20
|
+
var classedComponents = require('../classedComponents.js');
|
|
21
|
+
var ShuttleListPanel = require('./ShuttleListPanel.js');
|
|
22
|
+
var VirtualizedList = require('./VirtualizedList.js');
|
|
23
|
+
var helper = require('../helper.js');
|
|
24
|
+
var AnimationState = require('../AnimationState.js');
|
|
25
|
+
var SearchState = require('../SearchState.js');
|
|
26
|
+
var VirtualizedSortableList = require('./VirtualizedSortableList.js');
|
|
27
|
+
var LoadingIndicator = require('./LoadingIndicator.js');
|
|
28
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
29
|
+
|
|
30
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
31
|
+
|
|
32
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
33
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
34
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
35
|
+
var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
|
|
36
|
+
|
|
37
|
+
const _excluded = ["item"];
|
|
38
|
+
|
|
39
|
+
var _Search, _LoadingList, _ArrowShortRight, _ShuttleInfiniteScrol;
|
|
40
|
+
|
|
41
|
+
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; }
|
|
42
|
+
|
|
43
|
+
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__default["default"](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; }
|
|
44
|
+
|
|
45
|
+
const noop = () => {};
|
|
46
|
+
|
|
47
|
+
function ShuttleSource(_ref) {
|
|
48
|
+
let {
|
|
49
|
+
items = [],
|
|
50
|
+
checkedItems = [],
|
|
51
|
+
// build Map() and memoize it for better performance
|
|
52
|
+
hierarchy = [],
|
|
53
|
+
onMoveItem = noop,
|
|
54
|
+
onCheckItem = noop,
|
|
55
|
+
onMoveCheckedItems = noop,
|
|
56
|
+
onNavigateTo = noop,
|
|
57
|
+
onClearCheckedItems = noop,
|
|
58
|
+
emptyMessage = 'No items found',
|
|
59
|
+
composeSourceItemProps = noop,
|
|
60
|
+
loading = false,
|
|
61
|
+
onSearch = noop,
|
|
62
|
+
onSearchClose = noop,
|
|
63
|
+
onSearchOpen = noop,
|
|
64
|
+
sourceSortable = false,
|
|
65
|
+
onSortEnd = noop,
|
|
66
|
+
sourceClearItemsText = 'CLEAR ALL',
|
|
67
|
+
searchPlaceholder,
|
|
68
|
+
renderSourceCounter = amount => "".concat(amount, " items"),
|
|
69
|
+
onGetMoreItems = () => {},
|
|
70
|
+
moreItemsLoading = false,
|
|
71
|
+
hasNextPage = false
|
|
72
|
+
} = _ref;
|
|
77
73
|
const {
|
|
78
|
-
state: {
|
|
79
|
-
|
|
74
|
+
state: {
|
|
75
|
+
isMovingBack = false,
|
|
76
|
+
isMoving
|
|
77
|
+
}
|
|
78
|
+
} = react.useContext(AnimationState.Context);
|
|
80
79
|
const {
|
|
81
|
-
state: {
|
|
80
|
+
state: {
|
|
81
|
+
searching,
|
|
82
|
+
searchTerm
|
|
83
|
+
},
|
|
82
84
|
setSearchTerm,
|
|
83
85
|
reset: resetSearch,
|
|
84
86
|
toggleSearchBox
|
|
85
|
-
} =
|
|
86
|
-
const hashedCheckedItems =
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
} = react.useContext(SearchState.Context);
|
|
88
|
+
const hashedCheckedItems = react.useMemo(() => checkedItems.reduce((result, item) => _objectSpread(_objectSpread({}, result), {}, {
|
|
89
|
+
[item]: true
|
|
90
|
+
}), {}), [checkedItems]);
|
|
91
|
+
const handleCloseSearch = react.useCallback(() => {
|
|
92
|
+
setSearchTerm('');
|
|
93
|
+
dsUtilities.runAll(resetSearch, onSearchClose)();
|
|
90
94
|
}, [searching]);
|
|
91
|
-
const handleToggleSearch =
|
|
95
|
+
const handleToggleSearch = react.useCallback(() => {
|
|
92
96
|
toggleSearchBox(!searching);
|
|
97
|
+
|
|
93
98
|
if (searching) {
|
|
94
99
|
handleCloseSearch();
|
|
95
100
|
} else {
|
|
96
101
|
onSearchOpen();
|
|
97
102
|
}
|
|
98
103
|
}, [searching]);
|
|
99
|
-
const ComponentList =
|
|
100
|
-
|
|
104
|
+
const ComponentList = react.useMemo(() => sourceSortable ? VirtualizedSortableList : VirtualizedList, [sourceSortable]);
|
|
105
|
+
|
|
106
|
+
const handleSortEnd = _ref2 => {
|
|
107
|
+
let {
|
|
108
|
+
oldIndex,
|
|
109
|
+
newIndex
|
|
110
|
+
} = _ref2;
|
|
101
111
|
onSortEnd({
|
|
102
112
|
sourceItem: items[oldIndex],
|
|
103
113
|
targetItem: items[newIndex]
|
|
104
114
|
});
|
|
105
115
|
};
|
|
116
|
+
|
|
106
117
|
const isEmpty = !items.length;
|
|
107
118
|
const hasContent = !loading && !isEmpty;
|
|
108
119
|
const contentIsEmpty = !loading && isEmpty;
|
|
109
|
-
return
|
|
110
|
-
hierarchy,
|
|
111
|
-
onNavigateTo
|
|
112
|
-
}),
|
|
120
|
+
return /*#__PURE__*/_jsx__default["default"](classedComponents.ShuttleWrapper, {}, void 0, /*#__PURE__*/_jsx__default["default"](classedComponents.ShuttleHeader, {}, void 0, /*#__PURE__*/_jsx__default["default"](classedComponents.ShuttleHeaderBreadcrumb, {
|
|
121
|
+
hierarchy: hierarchy,
|
|
122
|
+
onNavigateTo: onNavigateTo
|
|
123
|
+
}), /*#__PURE__*/_jsx__default["default"](classedComponents.ShuttleHeaderSearchToggle, {
|
|
113
124
|
buttonType: "text",
|
|
114
|
-
icon:
|
|
125
|
+
icon: _Search || (_Search = /*#__PURE__*/_jsx__default["default"](dsIcons.Search, {})),
|
|
115
126
|
onClick: handleToggleSearch,
|
|
116
|
-
containerProps: {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
127
|
+
containerProps: {
|
|
128
|
+
'data-testid': 'shuttle-header-search-toggle'
|
|
129
|
+
}
|
|
130
|
+
})), /*#__PURE__*/_jsx__default["default"](classedComponents.ShuttleList, {
|
|
131
|
+
classProps: {
|
|
132
|
+
showPulse: isMovingBack
|
|
133
|
+
},
|
|
134
|
+
style: {
|
|
135
|
+
pointerEvents: isMoving ? 'none' : null
|
|
136
|
+
}
|
|
137
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](ShuttleSearchBox, {
|
|
122
138
|
isOpen: searching,
|
|
123
|
-
onClose:
|
|
124
|
-
onFilter:
|
|
139
|
+
onClose: dsUtilities.runAll(() => toggleSearchBox(false), handleCloseSearch),
|
|
140
|
+
onFilter: dsUtilities.runAll(setSearchTerm, onSearch),
|
|
125
141
|
placeholder: searchPlaceholder,
|
|
126
142
|
value: searchTerm
|
|
127
|
-
}), hasContent ?
|
|
128
|
-
activeHierarchy:
|
|
143
|
+
}, searching), hasContent ? /*#__PURE__*/_jsx__default["default"](classedComponents.Overflow, {
|
|
144
|
+
activeHierarchy: helper.getActiveIdFromHierarchy(hierarchy).id,
|
|
129
145
|
classProps: {
|
|
130
146
|
searching,
|
|
131
147
|
empty: isEmpty
|
|
132
148
|
}
|
|
133
|
-
},
|
|
134
|
-
key: searchTerm,
|
|
149
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](ComponentList, {
|
|
135
150
|
helperClass: "drag-helper",
|
|
136
|
-
itemRenderer:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
151
|
+
itemRenderer: _ref3 => {
|
|
152
|
+
let {
|
|
153
|
+
item
|
|
154
|
+
} = _ref3,
|
|
155
|
+
rest = _objectWithoutProperties__default["default"](_ref3, _excluded);
|
|
156
|
+
|
|
157
|
+
return /*#__PURE__*/jsxRuntime.jsx(ShuttleSourceListItem, _objectSpread(_objectSpread(_objectSpread({
|
|
158
|
+
"data-testid": "source-list-item"
|
|
159
|
+
}, rest), composeSourceItemProps(item, rest)), {}, {
|
|
160
|
+
isChecked: !!hashedCheckedItems[item.id],
|
|
161
|
+
item: item,
|
|
162
|
+
onItemCheck: onCheckItem,
|
|
163
|
+
onMoveToTarget: onMoveItem,
|
|
164
|
+
onNavigateOnSourceTo: onNavigateTo,
|
|
165
|
+
showSortHandler: sourceSortable
|
|
166
|
+
}));
|
|
167
|
+
},
|
|
168
|
+
items: items,
|
|
148
169
|
onSortEnd: handleSortEnd,
|
|
149
170
|
getMoreItems: onGetMoreItems,
|
|
150
|
-
hasNextPage
|
|
151
|
-
})) : null, contentIsEmpty ?
|
|
171
|
+
hasNextPage: hasNextPage
|
|
172
|
+
}, searchTerm)) : null, contentIsEmpty ? /*#__PURE__*/_jsx__default["default"](classedComponents.LoadingList, {
|
|
152
173
|
"data-testid": "shuttle__loading-list"
|
|
153
|
-
},
|
|
174
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](classedComponents.EmptyMessage, {}, void 0, emptyMessage)) : null, loading ? _LoadingList || (_LoadingList = /*#__PURE__*/_jsx__default["default"](classedComponents.LoadingList, {
|
|
154
175
|
"data-testid": "shuttle__loading-list"
|
|
155
|
-
},
|
|
176
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](LoadingIndicator, {}))) : null, /*#__PURE__*/_jsx__default["default"](ShuttleListPanel, {
|
|
156
177
|
onClick: onMoveCheckedItems,
|
|
157
178
|
open: checkedItems.length > 1
|
|
158
|
-
},
|
|
179
|
+
}, void 0, _ArrowShortRight || (_ArrowShortRight = /*#__PURE__*/_jsx__default["default"](dsIcons.ArrowShortRight, {}))), moreItemsLoading ? _ShuttleInfiniteScrol || (_ShuttleInfiniteScrol = /*#__PURE__*/_jsx__default["default"](ShuttleInfiniteScrollIndicator, {
|
|
159
180
|
isOpen: true
|
|
160
|
-
}) : null),
|
|
181
|
+
})) : null), /*#__PURE__*/_jsx__default["default"](classedComponents.ShuttleFooter, {}, void 0, /*#__PURE__*/_jsx__default["default"](classedComponents.ShuttleFooterActions, {}, void 0, !!checkedItems.length && /*#__PURE__*/_jsx__default["default"](DSButton__default["default"], {
|
|
161
182
|
buttonType: "link",
|
|
162
183
|
labelText: sourceClearItemsText,
|
|
163
184
|
onClick: onClearCheckedItems
|
|
164
|
-
})),
|
|
185
|
+
})), /*#__PURE__*/_jsx__default["default"](classedComponents.ShuttleFooterCounter, {}, void 0, renderSourceCounter(checkedItems.length))));
|
|
165
186
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
checkedItems: import_prop_types.default.arrayOf(import_prop_types.default.shape({})),
|
|
169
|
-
hierarchy: import_prop_types.default.arrayOf(import_prop_types.default.shape({})),
|
|
170
|
-
onMoveItem: import_prop_types.default.func,
|
|
171
|
-
onCheckItem: import_prop_types.default.func,
|
|
172
|
-
onMoveCheckedItems: import_prop_types.default.func,
|
|
173
|
-
onNavigateTo: import_prop_types.default.func,
|
|
174
|
-
onClearCheckedItems: import_prop_types.default.func,
|
|
175
|
-
emptyMessage: import_prop_types.default.string,
|
|
176
|
-
composeSourceItemProps: import_prop_types.default.func,
|
|
177
|
-
loading: import_prop_types.default.bool,
|
|
178
|
-
onSearch: import_prop_types.default.func,
|
|
179
|
-
onSearchClose: import_prop_types.default.func,
|
|
180
|
-
onSearchOpen: import_prop_types.default.func,
|
|
181
|
-
sourceSortable: import_prop_types.default.bool,
|
|
182
|
-
onSortEnd: import_prop_types.default.func,
|
|
183
|
-
sourceClearItemsText: import_prop_types.default.string,
|
|
184
|
-
searchPlaceholder: import_prop_types.default.string,
|
|
185
|
-
renderSourceCounter: import_prop_types.default.func,
|
|
186
|
-
onGetMoreItems: import_prop_types.default.func,
|
|
187
|
-
moreItemsLoading: import_prop_types.default.bool,
|
|
188
|
-
hasNextPage: import_prop_types.default.bool
|
|
189
|
-
};
|
|
190
|
-
var ShuttleSource_default = ShuttleSource;
|
|
191
|
-
module.exports = __toCommonJS(ShuttleSource_exports);
|
|
192
|
-
//# sourceMappingURL=ShuttleSource.js.map
|
|
187
|
+
|
|
188
|
+
module.exports = ShuttleSource;
|