@elliemae/ds-shuttle 3.2.1-rc.4 → 3.2.1-rc.7
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/dist/cjs/Shuttle.actions.js +19 -29
- package/dist/cjs/Shuttle.actions.js.map +1 -1
- package/dist/cjs/ShuttleContainer.js +2 -28
- package/dist/cjs/ShuttleContainer.js.map +1 -1
- package/dist/cjs/ShuttleImpl.js +4 -32
- package/dist/cjs/ShuttleImpl.js.map +1 -1
- package/dist/cjs/ShuttleRenderer.js +44 -103
- package/dist/cjs/ShuttleRenderer.js.map +1 -1
- package/dist/cjs/components/OverflowList.js +3 -19
- package/dist/cjs/components/OverflowList.js.map +1 -1
- package/dist/cjs/components/ShuttleListItem/ActionButtons.js +12 -28
- package/dist/cjs/components/ShuttleListItem/ActionButtons.js.map +1 -1
- package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js +15 -53
- package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js.map +1 -1
- package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +14 -51
- package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js.map +1 -1
- package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +14 -51
- package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js.map +1 -1
- package/dist/cjs/components/ShuttleSource.js +12 -43
- package/dist/cjs/components/ShuttleSource.js.map +1 -1
- package/dist/cjs/components/ShuttleTarget.js +10 -41
- package/dist/cjs/components/ShuttleTarget.js.map +1 -1
- package/dist/cjs/components/VirtualizedItem.js +1 -15
- package/dist/cjs/components/VirtualizedItem.js.map +1 -1
- package/dist/cjs/components/VirtualizedList.js +3 -19
- package/dist/cjs/components/VirtualizedList.js.map +1 -1
- package/dist/cjs/components/VirtualizedSortableList.js +4 -33
- package/dist/cjs/components/VirtualizedSortableList.js.map +1 -1
- package/dist/cjs/helper.js +5 -21
- package/dist/cjs/helper.js.map +1 -1
- package/dist/cjs/tests/utils.js +1 -18
- package/dist/cjs/tests/utils.js.map +1 -1
- package/dist/cjs/updateShuttleStateFromProps.js +13 -23
- package/dist/cjs/updateShuttleStateFromProps.js.map +1 -1
- package/dist/cjs/utils.js +4 -17
- package/dist/cjs/utils.js.map +1 -1
- package/dist/cjs/withProviders.js +3 -15
- package/dist/cjs/withProviders.js.map +1 -1
- package/dist/esm/Shuttle.actions.js +19 -31
- package/dist/esm/Shuttle.actions.js.map +1 -1
- package/dist/esm/ShuttleContainer.js +2 -30
- package/dist/esm/ShuttleContainer.js.map +1 -1
- package/dist/esm/ShuttleImpl.js +4 -34
- package/dist/esm/ShuttleImpl.js.map +1 -1
- package/dist/esm/ShuttleRenderer.js +44 -105
- package/dist/esm/ShuttleRenderer.js.map +1 -1
- package/dist/esm/components/OverflowList.js +3 -21
- package/dist/esm/components/OverflowList.js.map +1 -1
- package/dist/esm/components/ShuttleListItem/ActionButtons.js +12 -30
- package/dist/esm/components/ShuttleListItem/ActionButtons.js.map +1 -1
- package/dist/esm/components/ShuttleListItem/ShuttleListItem.js +15 -55
- package/dist/esm/components/ShuttleListItem/ShuttleListItem.js.map +1 -1
- package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js +14 -53
- package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js.map +1 -1
- package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js +14 -53
- package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js.map +1 -1
- package/dist/esm/components/ShuttleSource.js +12 -45
- package/dist/esm/components/ShuttleSource.js.map +1 -1
- package/dist/esm/components/ShuttleTarget.js +10 -43
- package/dist/esm/components/ShuttleTarget.js.map +1 -1
- package/dist/esm/components/VirtualizedItem.js +1 -17
- package/dist/esm/components/VirtualizedItem.js.map +1 -1
- package/dist/esm/components/VirtualizedList.js +3 -21
- package/dist/esm/components/VirtualizedList.js.map +1 -1
- package/dist/esm/components/VirtualizedSortableList.js +4 -35
- package/dist/esm/components/VirtualizedSortableList.js.map +1 -1
- package/dist/esm/helper.js +5 -23
- package/dist/esm/helper.js.map +1 -1
- package/dist/esm/tests/utils.js +1 -20
- package/dist/esm/tests/utils.js.map +1 -1
- package/dist/esm/updateShuttleStateFromProps.js +13 -25
- package/dist/esm/updateShuttleStateFromProps.js.map +1 -1
- package/dist/esm/utils.js +4 -19
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/withProviders.js +3 -17
- package/dist/esm/withProviders.js.map +1 -1
- package/package.json +11 -11
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/withProviders.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable react/display-name */\nimport React from 'react';\nimport { AnimationState } from './AnimationState';\nimport { SearchState } from './SearchState';\nimport { ShuttleState } from './ShuttleState';\n\nfunction withProviders(Component) {\n return props => (\n <ShuttleState.Provider>\n <AnimationState.Provider>\n <SearchState.Provider>\n <Component {...props} />\n </SearchState.Provider>\n </AnimationState.Provider>\n </ShuttleState.Provider>\n );\n}\n\nexport { withProviders };\nexport default withProviders;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAkB;AAClB,4BAA+B;AAC/B,yBAA4B;AAC5B,0BAA6B;AAE7B,uBAAuB,WAAW;AAChC,SAAO,WACL,mDAAC,iCAAa,UAAb,MACC,mDAAC,qCAAe,UAAf,MACC,mDAAC,+BAAY,UAAZ,MACC,mDAAC;AAAA,IAAW,GAAG;AAAA,GAAO,CACxB,CACF,CACF;AAEJ;AAGA,IAAO,wBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
2
|
import * as React from "react";
|
|
22
3
|
import {
|
|
23
4
|
addOrRemove,
|
|
@@ -32,7 +13,8 @@ import {
|
|
|
32
13
|
} from "./helper";
|
|
33
14
|
import utils from "./utils";
|
|
34
15
|
function toggleItemSelection(itemId) {
|
|
35
|
-
return (state) =>
|
|
16
|
+
return (state) => ({
|
|
17
|
+
...state,
|
|
36
18
|
checkedItems: addOrRemove(state.checkedItems, itemId)
|
|
37
19
|
});
|
|
38
20
|
}
|
|
@@ -41,17 +23,19 @@ function navigateTo(item, dest) {
|
|
|
41
23
|
return (state) => {
|
|
42
24
|
const indexInHierarchy = state[hierarchyType].findIndex((hItem) => hItem.id === item.id);
|
|
43
25
|
const hierarchy = state[hierarchyType];
|
|
44
|
-
return
|
|
26
|
+
return {
|
|
27
|
+
...state,
|
|
45
28
|
[hierarchyType]: indexInHierarchy !== -1 ? hierarchy.slice(0, indexInHierarchy + 1) : [...hierarchy, item]
|
|
46
|
-
}
|
|
29
|
+
};
|
|
47
30
|
};
|
|
48
31
|
}
|
|
49
32
|
function moveItem(item) {
|
|
50
33
|
return (state) => {
|
|
51
34
|
const movedItems = toggleInObject(state.movedItems, item.id, item);
|
|
52
|
-
return
|
|
35
|
+
return {
|
|
36
|
+
...state,
|
|
53
37
|
movedItems
|
|
54
|
-
}
|
|
38
|
+
};
|
|
55
39
|
};
|
|
56
40
|
}
|
|
57
41
|
const defaultOptions = {
|
|
@@ -60,7 +44,7 @@ const defaultOptions = {
|
|
|
60
44
|
op: (hasMoved) => !hasMoved
|
|
61
45
|
};
|
|
62
46
|
function getItemDeep({ collection, id, options }) {
|
|
63
|
-
const { idField } =
|
|
47
|
+
const { idField } = { ...defaultOptions, ...options };
|
|
64
48
|
const itemIndex = collection.findIndex((fItem) => fItem[idField] === id);
|
|
65
49
|
const item = collection[itemIndex];
|
|
66
50
|
const children = item?.hasChildren ? compose(utils.getChildren({ index: itemIndex }))(collection) || [] : [];
|
|
@@ -73,10 +57,11 @@ function addToTarget(itemToAdd, collection) {
|
|
|
73
57
|
collection: items,
|
|
74
58
|
id: itemToAdd[idField]
|
|
75
59
|
});
|
|
76
|
-
return
|
|
60
|
+
return {
|
|
61
|
+
...state,
|
|
77
62
|
movedItems: [...state.movedItems, item],
|
|
78
63
|
targetItems: [...state.targetItems, item, ...children]
|
|
79
|
-
}
|
|
64
|
+
};
|
|
80
65
|
};
|
|
81
66
|
}
|
|
82
67
|
function removeFromTarget(itemToRemove) {
|
|
@@ -90,19 +75,22 @@ function removeFromTarget(itemToRemove) {
|
|
|
90
75
|
const childrenHash = hashArray(children, "id");
|
|
91
76
|
targetItems = targetItems.filter((i) => !childrenHash[i.id]);
|
|
92
77
|
}
|
|
93
|
-
return
|
|
78
|
+
return {
|
|
79
|
+
...state,
|
|
94
80
|
movedItems: state.movedItems.filter((mItem) => mItem[idField] !== itemToRemove[idField]),
|
|
95
81
|
targetItems
|
|
96
|
-
}
|
|
82
|
+
};
|
|
97
83
|
};
|
|
98
84
|
}
|
|
99
85
|
function resetCheckedItems() {
|
|
100
|
-
return (state) =>
|
|
86
|
+
return (state) => ({
|
|
87
|
+
...state,
|
|
101
88
|
checkedItems: []
|
|
102
89
|
});
|
|
103
90
|
}
|
|
104
91
|
function resetMovedItems() {
|
|
105
|
-
return (state) =>
|
|
92
|
+
return (state) => ({
|
|
93
|
+
...state,
|
|
106
94
|
movedItems: [],
|
|
107
95
|
targetItems: []
|
|
108
96
|
});
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/Shuttle.actions.js"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import {\n addOrRemove,\n cloneDeep,\n hashArray,\n compose,\n} from '@elliemae/ds-utilities';\nimport {\n getHierarchyTypeName,\n toggleInObject,\n filterMovedItems,\n} from './helper';\n\nimport utils from './utils';\n\nexport function toggleItemSelection(itemId) {\n return state => ({\n ...state,\n checkedItems: addOrRemove(state.checkedItems, itemId),\n });\n}\nexport function navigateTo(item, dest) {\n const hierarchyType = getHierarchyTypeName(dest);\n return state => {\n const indexInHierarchy = state[hierarchyType].findIndex(\n hItem => hItem.id === item.id,\n );\n const hierarchy = state[hierarchyType];\n return {\n ...state,\n [hierarchyType]:\n indexInHierarchy !== -1\n ? hierarchy.slice(0, indexInHierarchy + 1)\n : [...hierarchy, item],\n };\n };\n}\nexport function moveItem(item) {\n return state => {\n const movedItems = toggleInObject(state.movedItems, item.id, item);\n return {\n ...state,\n movedItems,\n };\n };\n}\n\nconst defaultOptions = {\n parentField: 'parent',\n idField: 'id',\n op: hasMoved => !hasMoved,\n};\n\n// todo: optimize this\nfunction getItemDeep({ collection, id, options }) {\n const { idField } = { ...defaultOptions, ...options };\n const itemIndex = collection.findIndex(fItem => fItem[idField] === id);\n\n // get item with nested children\n const item = collection[itemIndex];\n const children = item?.hasChildren\n ? compose(utils.getChildren({ index: itemIndex }))(collection) || []\n : [];\n\n return { item, children };\n}\n\nexport function addToTarget(itemToAdd, collection) {\n return (state, { idField }) => {\n const items = collection || state.preparedItems;\n\n const { item, children } = getItemDeep({\n collection: items,\n id: itemToAdd[idField],\n });\n\n return {\n ...state,\n movedItems: [...state.movedItems, item],\n targetItems: [...state.targetItems, item, ...children],\n };\n };\n}\n\n// todo: optimize this\nexport function removeFromTarget(itemToRemove) {\n return (state, { idField }) => {\n let targetItems = cloneDeep(state.targetItems);\n\n const itemIndex = targetItems.findIndex(\n fItem => fItem.id === itemToRemove.id,\n );\n\n const item = targetItems[itemIndex];\n const children = item?.hasChildren\n ? compose(\n filterMovedItems(state.movedItems),\n utils.getChildren({ index: itemIndex }),\n )(targetItems) || []\n : [];\n\n targetItems.splice(itemIndex, 1);\n if (item?.hasChildren && children.length) {\n const childrenHash = hashArray(children, 'id');\n targetItems = targetItems.filter(i => !childrenHash[i.id]);\n }\n\n return {\n ...state,\n movedItems: state.movedItems.filter(\n mItem => mItem[idField] !== itemToRemove[idField],\n ),\n targetItems,\n };\n };\n}\n\nexport function resetCheckedItems() {\n return state => ({\n ...state,\n checkedItems: [],\n });\n}\nexport function resetMovedItems() {\n return state => ({\n ...state,\n movedItems: [],\n targetItems: [],\n });\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA;AAAA;AAAA;AAAA;AAAA;AAMA;AAEO,6BAA6B,QAAQ;AAC1C,SAAO,WAAU;AAAA,IACf,GAAG;AAAA,IACH,cAAc,YAAY,MAAM,cAAc,MAAM;AAAA,EACtD;AACF;AACO,oBAAoB,MAAM,MAAM;AACrC,QAAM,gBAAgB,qBAAqB,IAAI;AAC/C,SAAO,WAAS;AACd,UAAM,mBAAmB,MAAM,eAAe,UAC5C,WAAS,MAAM,OAAO,KAAK,EAC7B;AACA,UAAM,YAAY,MAAM;AACxB,WAAO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rC;AAEA,UAAM,OAAO,YAAY;AACzB,UAAM,WAAW,MAAM,cACnB,QACE,iBAAiB,MAAM,UAAU,GACjC,MAAM,YAAY,EAAE,OAAO,UAAU,CAAC,CACxC,EAAE,WAAW,KAAK,CAAC,IACnB,CAAC;AAEL,gBAAY,OAAO,WAAW,CAAC;AAC/B,QAAI,MAAM,eAAe,SAAS,QAAQ;AACxC,YAAM,eAAe,UAAU,UAAU,IAAI;AAC7C,oBAAc,YAAY,OAAO,OAAK,CAAC,aAAa,EAAE,GAAG;AAAA,IAC3D;AAEA,WAAO;AAAA,MACL,GAAG;AAAA,MACH,YAAY,MAAM,WAAW,OAC3B,WAAS,MAAM,aAAa,aAAa,QAC3C;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEO,6BAA6B;AAClC,SAAO,WAAU;AAAA,IACf,GAAG;AAAA,IACH,cAAc,CAAC;AAAA,EACjB;AACF;AACO,2BAA2B;AAChC,SAAO,WAAU;AAAA,IACf,GAAG;AAAA,IACH,YAAY,CAAC;AAAA,IACb,aAAa,CAAC;AAAA,EAChB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,32 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
-
var __spreadValues = (a, b) => {
|
|
8
|
-
for (var prop in b || (b = {}))
|
|
9
|
-
if (__hasOwnProp.call(b, prop))
|
|
10
|
-
__defNormalProp(a, prop, b[prop]);
|
|
11
|
-
if (__getOwnPropSymbols)
|
|
12
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
-
if (__propIsEnum.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
}
|
|
16
|
-
return a;
|
|
17
|
-
};
|
|
18
|
-
var __objRest = (source, exclude) => {
|
|
19
|
-
var target = {};
|
|
20
|
-
for (var prop in source)
|
|
21
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
22
|
-
target[prop] = source[prop];
|
|
23
|
-
if (source != null && __getOwnPropSymbols)
|
|
24
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
25
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
26
|
-
target[prop] = source[prop];
|
|
27
|
-
}
|
|
28
|
-
return target;
|
|
29
|
-
};
|
|
30
2
|
import * as React from "react";
|
|
31
3
|
import { useContext, useMemo } from "react";
|
|
32
4
|
import {
|
|
@@ -49,7 +21,7 @@ function filterItemsByTerm(items, term) {
|
|
|
49
21
|
return items.filter((item) => item.name.toLowerCase().indexOf(String(term).toLowerCase()) !== -1 || String(item.id).indexOf(String(term).toLowerCase()) !== -1);
|
|
50
22
|
}
|
|
51
23
|
function ShuttleContainer({ items = [], children }) {
|
|
52
|
-
const
|
|
24
|
+
const { state: shuttleState, ...handlers } = useContext(ShuttleState.Context);
|
|
53
25
|
const { state: searchState } = useContext(SearchState.Context);
|
|
54
26
|
const {
|
|
55
27
|
movedItems,
|
|
@@ -64,7 +36,7 @@ function ShuttleContainer({ items = [], children }) {
|
|
|
64
36
|
moveCheckedItems,
|
|
65
37
|
moveItem,
|
|
66
38
|
navigate
|
|
67
|
-
} =
|
|
39
|
+
} = { ...shuttleState, ...searchState, ...handlers };
|
|
68
40
|
const sourceItems = useMemo(() => compose((items2) => items2.filter((item) => !movedItems[item.id]), (items2) => searchTerm && searching ? filterItemsByTerm(items2, searchTerm) : items2, (items2) => filterItemsByHierarchy(items2, getActiveIdFromHierarchy(hierarchy).id), (items2) => prepareItems(items2))(items), [items, searchTerm, searching, hierarchy, movedItems]);
|
|
69
41
|
const targetItems = useMemo(() => {
|
|
70
42
|
const hierarchyId = getActiveIdFromHierarchy(hierarchyDest).id;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ShuttleContainer.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-shadow */\nimport { useContext, useMemo } from 'react';\nimport {\n isFunction,\n compose,\n uniqBy,\n values,\n sortBy,\n} from '@elliemae/ds-utilities';\nimport { withProviders } from './withProviders';\nimport {\n prepareItems,\n getActiveIdFromHierarchy,\n filterItemsByHierarchy,\n getItemsById,\n} from './helper';\nimport { SearchState } from './SearchState';\nimport { ShuttleState } from './ShuttleState';\n\nfunction filterItemsByTerm(items, term) {\n return items.filter(\n item =>\n item.name.toLowerCase().indexOf(String(term).toLowerCase()) !== -1 ||\n String(item.id).indexOf(String(term).toLowerCase()) !== -1,\n );\n}\n\nfunction ShuttleContainer({ items = [], children }) {\n const { state: shuttleState, ...handlers } = useContext(\n ShuttleState.Context,\n );\n const { state: searchState } = useContext(SearchState.Context);\n const {\n movedItems,\n hierarchy,\n hierarchyDest,\n checkedItems,\n searchTerm,\n searching,\n toggleItemSelection,\n resetCheckedItems,\n resetMovedItems,\n moveCheckedItems,\n moveItem,\n navigate,\n } = { ...shuttleState, ...searchState, ...handlers };\n\n const sourceItems = useMemo(\n () =>\n compose(\n items => items.filter(item => !movedItems[item.id]),\n items =>\n searchTerm && searching\n ? filterItemsByTerm(items, searchTerm)\n : items,\n items =>\n filterItemsByHierarchy(items, getActiveIdFromHierarchy(hierarchy).id),\n items => prepareItems(items),\n )(items),\n [items, searchTerm, searching, hierarchy, movedItems],\n );\n\n const targetItems = useMemo(() => {\n const hierarchyId = getActiveIdFromHierarchy(hierarchyDest).id;\n return compose(\n items => sortBy(items, ['name']),\n items =>\n hierarchyId\n ? filterItemsByHierarchy(items, hierarchyId).filter(\n item => !movedItems[item.id],\n )\n : uniqBy(values(movedItems), 'id'),\n )(items);\n }, [items, searching, hierarchyDest, movedItems]);\n\n return (\n isFunction(children) &&\n children({\n checkedItems,\n hierarchy,\n hierarchyDest,\n onCheckItem: toggleItemSelection,\n onClearCheckedItems: resetCheckedItems,\n onClearMovedItems: resetMovedItems,\n onMoveCheckedItems: () =>\n moveCheckedItems(getItemsById(checkedItems, items)),\n onMoveItemToSource: item => moveItem(item, false),\n onMoveItemToTarget: item => moveItem(item, true),\n onNavigateOnSourceTo: item => navigate(item, false),\n onNavigateOnTargetTo: item => navigate(item, true),\n sourceItems,\n targetItems,\n })\n );\n}\n\nexport default withProviders(ShuttleContainer);\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACCA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA;AACA;AAEA,2BAA2B,OAAO,MAAM;AACtC,SAAO,MAAM,OACX,UACE,KAAK,KAAK,YAAY,EAAE,QAAQ,OAAO,IAAI,EAAE,YAAY,CAAC,MAAM,MAChE,OAAO,KAAK,EAAE,EAAE,QAAQ,OAAO,IAAI,EAAE,YAAY,CAAC,MAAM,EAC5D;AACF;AAEA,0BAA0B,EAAE,QAAQ,CAAC,GAAG,YAAY;AAClD,QAAM,EAAE,OAAO,iBAAiB,aAAa,WAC3C,aAAa,OACf;AACA,QAAM,EAAE,OAAO,gBAAgB,WAAW,YAAY,OAAO;AAC7D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,EAAE,GAAG,cAAc,GAAG,aAAa,GAAG,SAAS;AAEnD,QAAM,cAAc,QAClB,MACE,QACE,YAAS,OAAM,OAAO,UAAQ,CAAC,WAAW,KAAK,GAAG,GAClD,YACE,cAAc,YACV,kBAAkB,QAAO,UAAU,IACnC,QACN,YACE,uBAAuB,QAAO,yBAAyB,SAAS,EAAE,EAAE,GACtE,YAAS,aAAa,MAAK,CAC7B,EAAE,KAAK,GACT,CAAC,OAAO,YAAY,WAAW,WAAW,UAAU,CACtD;AAEA,QAAM,cAAc,QAAQ,MAAM;AAChC,UAAM,cAAc,yBAAyB,aAAa,EAAE;AAC5D,WAAO,QACL,YAAS,OAAO,QAAO,CAAC,MAAM,CAAC,GAC/B,YACE,cACI,uBAAuB,QAAO,WAAW,EAAE,OACzC,UAAQ,CAAC,WAAW,KAAK,GAC3B,IACA,OAAO,OAAO,UAAU,GAAG,IAAI,CACvC,EAAE,KAAK;AAAA,EACT,GAAG,CAAC,OAAO,WAAW,eAAe,UAAU,CAAC;AAEhD,SACE,WAAW,QAAQ,KACnB,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb,qBAAqB;AAAA,IACrB,mBAAmB;AAAA,IACnB,oBAAoB,MAClB,iBAAiB,aAAa,cAAc,KAAK,CAAC;AAAA,IACpD,oBAAoB,UAAQ,SAAS,MAAM,KAAK;AAAA,IAChD,oBAAoB,UAAQ,SAAS,MAAM,IAAI;AAAA,IAC/C,sBAAsB,UAAQ,SAAS,MAAM,KAAK;AAAA,IAClD,sBAAsB,UAAQ,SAAS,MAAM,IAAI;AAAA,IACjD;AAAA,IACA;AAAA,EACF,CAAC;AAEL;AAEA,IAAO,2BAAQ,cAAc,gBAAgB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/ShuttleImpl.js
CHANGED
|
@@ -1,35 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
var __objRest = (source, exclude) => {
|
|
22
|
-
var target = {};
|
|
23
|
-
for (var prop in source)
|
|
24
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
if (source != null && __getOwnPropSymbols)
|
|
27
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
2
|
import * as React from "react";
|
|
34
3
|
import React2, { Component } from "react";
|
|
35
4
|
import { compose, arrayMove } from "@elliemae/ds-utilities";
|
|
@@ -156,7 +125,7 @@ class ShuttleImpl extends Component {
|
|
|
156
125
|
setGetStatus(this.getState);
|
|
157
126
|
}
|
|
158
127
|
render() {
|
|
159
|
-
const
|
|
128
|
+
const { idField, nonSelectedItems, moreItemsLoading, ...rest } = this.props;
|
|
160
129
|
const {
|
|
161
130
|
hierarchy,
|
|
162
131
|
hierarchyDest,
|
|
@@ -197,7 +166,8 @@ class ShuttleImpl extends Component {
|
|
|
197
166
|
return hierarchyId ? compose(filterMovedItems(movedItems), getChildrenFromParent(hierarchyId))(tItems) : movedItems;
|
|
198
167
|
})(targetItems);
|
|
199
168
|
}
|
|
200
|
-
return /* @__PURE__ */ React2.createElement(ShuttleRenderer,
|
|
169
|
+
return /* @__PURE__ */ React2.createElement(ShuttleRenderer, {
|
|
170
|
+
...rest,
|
|
201
171
|
moreItemsLoading,
|
|
202
172
|
checkedItems,
|
|
203
173
|
hierarchy,
|
|
@@ -215,7 +185,7 @@ class ShuttleImpl extends Component {
|
|
|
215
185
|
onTargetSortEnd: this.handleTargetSortEnd,
|
|
216
186
|
sourceItems: composedSourceItems,
|
|
217
187
|
targetItems: composedTargetItems
|
|
218
|
-
})
|
|
188
|
+
});
|
|
219
189
|
}
|
|
220
190
|
}
|
|
221
191
|
ShuttleImpl.contextType = SearchState.Context;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ShuttleImpl.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/static-property-placement */\n/* eslint-disable react/prop-types */\n/* eslint-disable indent */\n/* eslint-disable import/extensions,react/no-unused-state,no-shadow,max-lines */\nimport React, { Component } from 'react';\nimport { compose, arrayMove } from '@elliemae/ds-utilities';\nimport { withProviders } from './withProviders';\nimport {\n addToTarget,\n navigateTo,\n resetCheckedItems,\n resetMovedItems,\n toggleItemSelection,\n removeFromTarget,\n} from './Shuttle.actions';\nimport {\n getActiveIdFromHierarchy,\n filterBySearch,\n getItemsById,\n pipe,\n getChildrenFromParent,\n filterMovedItems,\n} from './helper';\nimport { ShuttleRenderer } from './ShuttleRenderer';\nimport { SearchState } from './SearchState';\nimport { updateShuttleStateFromProps } from './updateShuttleStateFromProps';\n\nclass ShuttleImpl extends Component {\n static contextType = SearchState.Context;\n\n constructor(props) {\n super(props);\n this.state = {\n prevProps: {},\n preparedItems: [],\n checkedItems: [],\n // left breadcrumb\n hierarchy: [{ name: props.sourceRootTitle, id: null }],\n // right breadcrumb\n hierarchyDest: [{ name: props.targetRootTitle, id: null }],\n\n movedItems: [],\n sourceItems: [],\n targetItems: [],\n };\n }\n\n static getDerivedStateFromProps(nextProps, prevState) {\n return updateShuttleStateFromProps(nextProps, prevState);\n }\n\n componentDidMount() {\n const { setGetStatus } = this.props;\n setGetStatus(this.getState);\n }\n\n getState = () => {\n const { movedItems } = this.state;\n return Object.keys(movedItems);\n };\n\n handleChange = () => {\n const { onChange } = this.props;\n const { movedItems } = this.state;\n onChange(Object.keys(movedItems));\n }\n\n navigate = (item, dest, direction) => {\n const { onDrillDown, onDrillDownTarget } = this.props;\n\n if (!dest) onDrillDown(item, direction);\n if (dest) onDrillDownTarget(item, direction);\n\n const { reset: resetSearchState } = this.context;\n resetSearchState();\n\n this.setState(pipe([navigateTo(item, dest), resetCheckedItems()]));\n }\n\n resetCheckedItems = () => {\n this.setState(resetCheckedItems());\n }\n\n resetMovedItems = () => {\n const { selectedItems, onRemoveAllFromTarget } = this.props;\n if (!selectedItems) {\n this.setState(\n pipe([navigateTo({ id: null }, true), resetMovedItems()]),\n () => {\n this.handleChange();\n },\n );\n } else {\n this.setState(pipe([navigateTo({ id: null }, true)]));\n }\n onRemoveAllFromTarget();\n }\n\n addToTarget = (item) => {\n const { selectedItems, onAddToTarget } = this.props;\n if (!selectedItems) {\n this.setState(pipe([addToTarget(item), resetCheckedItems()]), () => {\n this.handleChange();\n });\n }\n onAddToTarget(item);\n }\n\n removeFromTarget = (item) => {\n const { selectedItems, onRemoveFromTarget } = this.props;\n if (!selectedItems) {\n this.setState(pipe([removeFromTarget(item)]), () => {\n this.handleChange();\n });\n }\n onRemoveFromTarget(item);\n }\n\n toggleItemSelection = (item) => {\n this.setState(toggleItemSelection(item.id));\n }\n\n moveCheckedItems = () => {\n const { onAddCheckedItems, selectedItems, nonSelectedItems } = this.props;\n const { checkedItems, preparedItems } = this.state;\n const isControlledV2 = !!selectedItems && !!nonSelectedItems;\n const checked = isControlledV2\n ? nonSelectedItems.filter((item) =>\n checkedItems.some((check) => check === item),\n )\n : checkedItems;\n const items = getItemsById(checked, preparedItems);\n const actions = !selectedItems\n ? items.map((item) => addToTarget(item))\n : [];\n this.setState(pipe([...actions, resetCheckedItems()]), () => {\n this.handleChange();\n });\n onAddCheckedItems(items);\n }\n\n handleTargetSortEnd = ({ sourceItem, targetItem }) => {\n const { idField, onTargetSortEnd } = this.props;\n const { targetItems, hierarchyDest, movedItems } = this.state;\n\n const hierarchyId = getActiveIdFromHierarchy(hierarchyDest).id;\n\n const collection = !hierarchyId ? movedItems : targetItems;\n\n const oldIndex = collection.findIndex(\n (tItem) => tItem[idField] === sourceItem[idField],\n );\n const newIndex = collection.findIndex(\n (tItem) => tItem[idField] === targetItem[idField],\n );\n\n const sortedMovedItems = !hierarchyId\n ? arrayMove(movedItems, oldIndex, newIndex)\n : movedItems;\n const sortedItems = hierarchyId\n ? arrayMove(targetItems, oldIndex, newIndex)\n : targetItems;\n\n this.setState({\n targetItems: sortedItems,\n movedItems: sortedMovedItems,\n });\n onTargetSortEnd({ sourceItem, targetItem });\n }\n\n render() {\n const { idField, nonSelectedItems, moreItemsLoading, ...rest } = this.props;\n const {\n hierarchy,\n hierarchyDest,\n checkedItems,\n movedItems,\n preparedItems: items,\n targetItems,\n } = this.state;\n const {\n state: { searchTerm, searching },\n } = this.context;\n\n const handleControlledSourceItms = () => {\n const { id } = getActiveIdFromHierarchy(hierarchy);\n if (id) {\n return filterBySearch(\n searchTerm,\n searching,\n )(\n getChildrenFromParent(id)(\n nonSelectedItems.map((it) => items.find((itt) => itt.id === it)),\n ),\n );\n }\n\n return filterBySearch(\n searchTerm,\n searching,\n )(\n items.filter((it) =>\n nonSelectedItems.some(\n (itt) =>\n itt === it.id &&\n !nonSelectedItems.some((ittt) => ittt === it.parent),\n ),\n ),\n );\n };\n\n let composedSourceItems;\n\n // controlled V2 TODO make it default controlled behavior\n if (nonSelectedItems) {\n composedSourceItems = handleControlledSourceItms();\n } else {\n composedSourceItems = compose(\n filterBySearch(searchTerm, searching),\n filterMovedItems(movedItems),\n getChildrenFromParent(getActiveIdFromHierarchy(hierarchy).id),\n )(items);\n }\n\n const handleControlledTargetItms = () => {\n const { id } = getActiveIdFromHierarchy(hierarchyDest);\n if (id) {\n return getChildrenFromParent(\n getActiveIdFromHierarchy(hierarchyDest).id,\n )(\n this.props.selectedItems.map((it) =>\n items.find((itt) => itt.id === it),\n ),\n );\n }\n\n return targetItems.filter((it) =>\n this.props.selectedItems.some(\n (itt) =>\n itt === it.id &&\n !this.props.selectedItems.some((ittt) => ittt === it.parent),\n ),\n );\n };\n\n let composedTargetItems;\n\n // controlled V2 TODO make it default controlled behavior\n if (nonSelectedItems) {\n composedTargetItems = handleControlledTargetItms();\n } else {\n composedTargetItems = compose((tItems) => {\n const hierarchyId = getActiveIdFromHierarchy(hierarchyDest).id;\n return hierarchyId\n ? compose(\n filterMovedItems(movedItems),\n getChildrenFromParent(hierarchyId),\n )(tItems)\n : movedItems;\n })(targetItems);\n }\n\n return (\n <ShuttleRenderer\n {...rest}\n moreItemsLoading={moreItemsLoading}\n checkedItems={checkedItems}\n hierarchy={hierarchy}\n hierarchyDest={hierarchyDest}\n onCheckItem={this.toggleItemSelection}\n onClearCheckedItems={this.resetCheckedItems}\n onClearMovedItems={this.resetMovedItems}\n onItemCheck={this.toggleItemSelection}\n onMoveCheckedItems={this.moveCheckedItems}\n onMoveItemToSource={(item) => this.removeFromTarget(item, false)}\n onMoveItemToTarget={(item) => this.addToTarget(item, true)}\n onNavigateOnSourceTo={(item, direction) =>\n this.navigate(item, false, direction)\n }\n onNavigateOnTargetTo={(item, direction) =>\n this.navigate(item, true, direction)\n }\n onSourceSortEnd={() => null}\n onTargetSortEnd={this.handleTargetSortEnd}\n sourceItems={composedSourceItems}\n targetItems={composedTargetItems}\n />\n );\n }\n}\n\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;AAAA,MACN,CAAC,EAAE,WAAW;AAAA,IAChB;AAEA,WACE,qCAAC;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,aAAa,KAAK;AAAA,MAClB,qBAAqB,KAAK;AAAA,MAC1B,mBAAmB,KAAK;AAAA,MACxB,aAAa,KAAK;AAAA,MAClB,oBAAoB,KAAK;AAAA,MACzB,oBAAoB,CAAC,SAAS,KAAK,iBAAiB,MAAM,KAAK;AAAA,MAC/D,oBAAoB,CAAC,SAAS,KAAK,YAAY,MAAM,IAAI;AAAA,MACzD,sBAAsB,CAAC,MAAM,cAC3B,KAAK,SAAS,MAAM,OAAO,SAAS;AAAA,MAEtC,sBAAsB,CAAC,MAAM,cAC3B,KAAK,SAAS,MAAM,MAAM,SAAS;AAAA,MAErC,iBAAiB,MAAM;AAAA,MACvB,iBAAiB,KAAK;AAAA,MACtB,aAAa;AAAA,MACb,aAAa;AAAA,KACf;AAAA,EAEJ;AACF;AArQE,AADI,YACG,cAAc,YAAY;AAuQnC,MAAM,iBAAiB,cAAc,WAAW;AAEhD,IAAO,sBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,35 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
var __objRest = (source, exclude) => {
|
|
22
|
-
var target = {};
|
|
23
|
-
for (var prop in source)
|
|
24
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
if (source != null && __getOwnPropSymbols)
|
|
27
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
2
|
import * as React from "react";
|
|
34
3
|
import React2, { useCallback, useContext } from "react";
|
|
35
4
|
import { ShuttleSource } from "./components/ShuttleSource";
|
|
@@ -38,80 +7,49 @@ import { ShuttleContainer } from "./classedComponents";
|
|
|
38
7
|
import { AnimationState } from "./AnimationState";
|
|
39
8
|
const noop = () => {
|
|
40
9
|
};
|
|
41
|
-
function ShuttleRenderer(
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"containerProps",
|
|
78
|
-
"onNavigateOnTargetTo",
|
|
79
|
-
"onNavigateOnSourceTo",
|
|
80
|
-
"onMoveItemToSource",
|
|
81
|
-
"onMoveItemToTarget",
|
|
82
|
-
"onClearMovedItems",
|
|
83
|
-
"onMoveCheckedItems",
|
|
84
|
-
"onClearCheckedItems",
|
|
85
|
-
"onToggleSearch",
|
|
86
|
-
"onSearch",
|
|
87
|
-
"onSearchClose",
|
|
88
|
-
"onSearchOpen",
|
|
89
|
-
"searching",
|
|
90
|
-
"onCheckItem",
|
|
91
|
-
"hierarchy",
|
|
92
|
-
"hierarchyDest",
|
|
93
|
-
"checkedItems",
|
|
94
|
-
"sourceItems",
|
|
95
|
-
"targetItems",
|
|
96
|
-
"sourceEmptyMessage",
|
|
97
|
-
"targetEmptyMessage",
|
|
98
|
-
"composeTargetItemProps",
|
|
99
|
-
"composeSourceItemProps",
|
|
100
|
-
"targetSortable",
|
|
101
|
-
"sourceSortable",
|
|
102
|
-
"onSourceSortEnd",
|
|
103
|
-
"onTargetSortEnd",
|
|
104
|
-
"loadingSource",
|
|
105
|
-
"loadingTarget",
|
|
106
|
-
"onGetMoreItems",
|
|
107
|
-
"moreItemsLoading",
|
|
108
|
-
"hasNextPage"
|
|
109
|
-
]);
|
|
10
|
+
function ShuttleRenderer({
|
|
11
|
+
containerProps,
|
|
12
|
+
onNavigateOnTargetTo = noop,
|
|
13
|
+
onNavigateOnSourceTo = noop,
|
|
14
|
+
onMoveItemToSource = noop,
|
|
15
|
+
onMoveItemToTarget = noop,
|
|
16
|
+
onClearMovedItems = noop,
|
|
17
|
+
onMoveCheckedItems = noop,
|
|
18
|
+
onClearCheckedItems = noop,
|
|
19
|
+
onToggleSearch = noop,
|
|
20
|
+
onSearch = noop,
|
|
21
|
+
onSearchClose = noop,
|
|
22
|
+
onSearchOpen = noop,
|
|
23
|
+
searching = false,
|
|
24
|
+
onCheckItem = noop,
|
|
25
|
+
hierarchy = [],
|
|
26
|
+
hierarchyDest = [],
|
|
27
|
+
checkedItems = [],
|
|
28
|
+
sourceItems = [],
|
|
29
|
+
targetItems = [],
|
|
30
|
+
sourceEmptyMessage,
|
|
31
|
+
targetEmptyMessage,
|
|
32
|
+
composeTargetItemProps,
|
|
33
|
+
composeSourceItemProps,
|
|
34
|
+
targetSortable,
|
|
35
|
+
sourceSortable,
|
|
36
|
+
onSourceSortEnd,
|
|
37
|
+
onTargetSortEnd,
|
|
38
|
+
loadingSource = false,
|
|
39
|
+
loadingTarget = false,
|
|
40
|
+
onGetMoreItems = () => {
|
|
41
|
+
},
|
|
42
|
+
moreItemsLoading = false,
|
|
43
|
+
hasNextPage = false,
|
|
44
|
+
...otherProps
|
|
45
|
+
}) {
|
|
110
46
|
const { setIsMoving, setIsDrillingDown, setIsMovingBack, reset } = useContext(AnimationState.Context);
|
|
111
47
|
const removeAnimationState = useCallback(() => setTimeout(() => reset(), 500));
|
|
112
|
-
return /* @__PURE__ */ React2.createElement(ShuttleContainer,
|
|
113
|
-
"data-testid": "em-ds-shuttle"
|
|
114
|
-
|
|
48
|
+
return /* @__PURE__ */ React2.createElement(ShuttleContainer, {
|
|
49
|
+
"data-testid": "em-ds-shuttle",
|
|
50
|
+
...containerProps
|
|
51
|
+
}, /* @__PURE__ */ React2.createElement(ShuttleSource, {
|
|
52
|
+
...otherProps,
|
|
115
53
|
checkedItems,
|
|
116
54
|
composeSourceItemProps,
|
|
117
55
|
emptyMessage: sourceEmptyMessage,
|
|
@@ -144,7 +82,8 @@ function ShuttleRenderer(_a) {
|
|
|
144
82
|
onGetMoreItems,
|
|
145
83
|
moreItemsLoading,
|
|
146
84
|
hasNextPage
|
|
147
|
-
})
|
|
85
|
+
}), /* @__PURE__ */ React2.createElement(ShuttleTarget, {
|
|
86
|
+
...otherProps,
|
|
148
87
|
composeTargetItemProps,
|
|
149
88
|
emptyMessage: targetEmptyMessage,
|
|
150
89
|
hierarchy: hierarchyDest,
|
|
@@ -167,7 +106,7 @@ function ShuttleRenderer(_a) {
|
|
|
167
106
|
onSortEnd: onTargetSortEnd,
|
|
168
107
|
targetSortable,
|
|
169
108
|
loading: loadingTarget
|
|
170
|
-
}))
|
|
109
|
+
}));
|
|
171
110
|
}
|
|
172
111
|
var ShuttleRenderer_default = ShuttleRenderer;
|
|
173
112
|
export {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ShuttleRenderer.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\n/* eslint-disable max-lines */\nimport React, { useCallback, useContext } from 'react';\nimport { ShuttleSource } from './components/ShuttleSource';\nimport { ShuttleTarget } from './components/ShuttleTarget';\nimport { ShuttleContainer } from './classedComponents';\nimport { AnimationState } from './AnimationState';\n\n// todo: clean methods on jsx\nconst noop = () => {};\nfunction ShuttleRenderer({\n containerProps,\n onNavigateOnTargetTo = noop,\n onNavigateOnSourceTo = noop,\n onMoveItemToSource = noop,\n onMoveItemToTarget = noop,\n onClearMovedItems = noop,\n onMoveCheckedItems = noop,\n onClearCheckedItems = noop,\n onToggleSearch = noop,\n onSearch = noop,\n onSearchClose = noop,\n onSearchOpen = noop,\n searching = false,\n onCheckItem = noop,\n hierarchy = [],\n hierarchyDest = [],\n checkedItems = [],\n sourceItems = [],\n targetItems = [],\n sourceEmptyMessage,\n targetEmptyMessage,\n composeTargetItemProps,\n composeSourceItemProps,\n targetSortable,\n sourceSortable,\n onSourceSortEnd,\n onTargetSortEnd,\n loadingSource = false,\n loadingTarget = false,\n onGetMoreItems = () => {},\n moreItemsLoading = false,\n hasNextPage = false,\n ...otherProps\n}) {\n const { setIsMoving, setIsDrillingDown, setIsMovingBack, reset } = useContext(\n AnimationState.Context,\n );\n\n const removeAnimationState = useCallback(() =>\n setTimeout(() => reset(), 500),\n );\n\n return (\n <ShuttleContainer data-testid=\"em-ds-shuttle\" {...containerProps}>\n <ShuttleSource\n {...otherProps}\n checkedItems={checkedItems}\n composeSourceItemProps={composeSourceItemProps}\n emptyMessage={sourceEmptyMessage}\n hierarchy={hierarchy}\n items={sourceItems}\n onCheckItem={onCheckItem}\n onClearCheckedItems={onClearCheckedItems}\n onMoveCheckedItems={(item) => {\n setIsMoving(true);\n onMoveCheckedItems(item);\n }}\n onMoveItem={(item) => {\n setIsMoving(true);\n onMoveItemToTarget(item);\n removeAnimationState();\n }}\n onNavigateTo={(item, direction = 'down') => {\n const indexInHierarchy = hierarchy.findIndex(\n (hItem) => hItem.id === item.id,\n );\n setIsDrillingDown(indexInHierarchy === -1);\n onNavigateOnSourceTo(item, direction);\n }}\n onSearch={onSearch}\n onSearchClose={onSearchClose}\n onSearchOpen={onSearchOpen}\n onSortEnd={onSourceSortEnd}\n onToggleSearch={onToggleSearch}\n searching={searching}\n sourceSortable={sourceSortable}\n loading={loadingSource}\n onGetMoreItems={onGetMoreItems}\n moreItemsLoading={moreItemsLoading}\n hasNextPage={hasNextPage}\n />\n <ShuttleTarget\n {...otherProps}\n composeTargetItemProps={composeTargetItemProps}\n emptyMessage={targetEmptyMessage}\n hierarchy={hierarchyDest}\n items={targetItems}\n onClearMovedItems={() => {\n setIsMovingBack(true);\n removeAnimationState();\n onClearMovedItems();\n }}\n onMoveItem={(item) => {\n setIsMovingBack(true);\n removeAnimationState();\n onMoveItemToSource(item);\n }}\n onNavigateTo={(item, direction = 'down') => {\n const indexInHierarchy = hierarchyDest.findIndex(\n (hItem) => hItem.id === item.id,\n );\n setIsDrillingDown(indexInHierarchy === -1);\n onNavigateOnTargetTo(item, direction);\n }}\n onSortEnd={onTargetSortEnd}\n targetSortable={targetSortable}\n loading={loadingTarget}\n />\n </ShuttleContainer>\n );\n}\n\nexport { ShuttleRenderer };\nexport default ShuttleRenderer;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA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AmB,UAAU,UACjC,CAAC,UAAU,MAAM,OAAO,KAAK,EAC/B;AACA,wBAAkB,qBAAqB,EAAE;AACzC,2BAAqB,MAAM,SAAS;AAAA,IACtC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,GACF,GACA,qCAAC;AAAA,IACE,GAAG;AAAA,IACJ;AAAA,IACA,cAAc;AAAA,IACd,WAAW;AAAA,IACX,OAAO;AAAA,IACP,mBAAmB,MAAM;AACvB,sBAAgB,IAAI;AACpB,2BAAqB;AACrB,wBAAkB;AAAA,IACpB;AAAA,IACA,YAAY,CAAC,SAAS;AACpB,sBAAgB,IAAI;AACpB,2BAAqB;AACrB,yBAAmB,IAAI;AAAA,IACzB;AAAA,IACA,cAAc,CAAC,MAAM,YAAY,WAAW;AAC1C,YAAM,mBAAmB,cAAc,UACrC,CAAC,UAAU,MAAM,OAAO,KAAK,EAC/B;AACA,wBAAkB,qBAAqB,EAAE;AACzC,2BAAqB,MAAM,SAAS;AAAA,IACtC;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA,SAAS;AAAA,GACX,CACF;AAEJ;AAGA,IAAO,0BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,23 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
2
|
import * as React from "react";
|
|
22
3
|
import React2, { useContext } from "react";
|
|
23
4
|
import { useTransition, animated } from "react-spring/web";
|
|
@@ -28,9 +9,10 @@ function OverflowList({ className = "", activeHierarchy = "", children }) {
|
|
|
28
9
|
state: { isDrillingDown = false },
|
|
29
10
|
setIsDrillingDown
|
|
30
11
|
} = useContext(AnimationState.Context);
|
|
31
|
-
const overflowTransition = useTransition(activeHierarchy, null,
|
|
12
|
+
const overflowTransition = useTransition(activeHierarchy, null, {
|
|
13
|
+
...animationConfig.moveList(isDrillingDown),
|
|
32
14
|
onDestroyed: () => setIsDrillingDown(false)
|
|
33
|
-
})
|
|
15
|
+
});
|
|
34
16
|
return overflowTransition.map(({ props, key }) => /* @__PURE__ */ React2.createElement(animated.div, {
|
|
35
17
|
key,
|
|
36
18
|
className,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/OverflowList.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { useTransition, animated } from 'react-spring/web';\nimport { animationConfig } from '../animation/animationConfig';\nimport { AnimationState } from '../AnimationState';\n\nfunction OverflowList({ className = '', activeHierarchy = '', children }) {\n const {\n state: { isDrillingDown = false },\n setIsDrillingDown,\n } = useContext(AnimationState.Context);\n\n const overflowTransition = useTransition(activeHierarchy, null, {\n ...animationConfig.moveList(isDrillingDown),\n onDestroyed: () => setIsDrillingDown(false),\n });\n return overflowTransition.map(({ props, key }) => (\n <animated.div key={key} className={className} style={props}>\n {children}\n </animated.div>\n ));\n}\n\nexport { OverflowList };\nexport default OverflowList;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAAA;ACAA;AACA;AACA;AACA;AAEA,sBAAsB,EAAE,YAAY,IAAI,kBAAkB,IAAI,YAAY;AACxE,QAAM;AAAA,IACJ,OAAO,EAAE,iBAAiB;AAAA,IAC1B;AAAA,MACE,WAAW,eAAe,OAAO;AAErC,QAAM,qBAAqB,cAAc,iBAAiB,MAAM;AAAA,IAC9D,GAAG,gBAAgB,SAAS,cAAc;AAAA,IAC1C,aAAa,MAAM,kBAAkB,KAAK;AAAA,EAC5C,CAAC;AACD,SAAO,mBAAmB,IAAI,CAAC,EAAE,OAAO,UACtC,qCAAC,SAAS,KAAT;AAAA,IAAa;AAAA,IAAU;AAAA,IAAsB,OAAO;AAAA,KAClD,QACH,CACD;AACH;AAGA,IAAO,uBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,47 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
2
|
import * as React from "react";
|
|
22
3
|
import React2 from "react";
|
|
23
4
|
import { aggregatedClasses } from "@elliemae/ds-classnames";
|
|
24
5
|
import { DSButton } from "@elliemae/ds-button";
|
|
25
6
|
import { ArrowShortRight, ArrowShortReturn, CloseCircle } from "@elliemae/ds-icons";
|
|
26
7
|
const ActionButton = aggregatedClasses(DSButton)("shuttle-list-item", "action-button");
|
|
27
|
-
const DeleteButton = (props) => /* @__PURE__ */ React2.createElement(ActionButton,
|
|
8
|
+
const DeleteButton = (props) => /* @__PURE__ */ React2.createElement(ActionButton, {
|
|
28
9
|
buttonType: "text",
|
|
29
|
-
icon: /* @__PURE__ */ React2.createElement(CloseCircle, null)
|
|
30
|
-
|
|
31
|
-
|
|
10
|
+
icon: /* @__PURE__ */ React2.createElement(CloseCircle, null),
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
const MoveButton = (props) => /* @__PURE__ */ React2.createElement(ActionButton, {
|
|
32
14
|
buttonType: "text",
|
|
33
|
-
icon: /* @__PURE__ */ React2.createElement(ArrowShortRight, null)
|
|
34
|
-
|
|
15
|
+
icon: /* @__PURE__ */ React2.createElement(ArrowShortRight, null),
|
|
16
|
+
...props,
|
|
35
17
|
containerProps: { "data-testid": "ds-shuttle__move-button" }
|
|
36
|
-
})
|
|
37
|
-
const DrillDownButton = (props) => /* @__PURE__ */ React2.createElement(ActionButton,
|
|
18
|
+
});
|
|
19
|
+
const DrillDownButton = (props) => /* @__PURE__ */ React2.createElement(ActionButton, {
|
|
38
20
|
buttonType: "text",
|
|
39
21
|
icon: /* @__PURE__ */ React2.createElement(ArrowShortReturn, {
|
|
40
22
|
"data-testid": "shuttle__drill-btn-icon"
|
|
41
|
-
})
|
|
42
|
-
|
|
23
|
+
}),
|
|
24
|
+
...props,
|
|
43
25
|
containerProps: { "data-testid": "shuttle__drill-btn" }
|
|
44
|
-
})
|
|
26
|
+
});
|
|
45
27
|
export {
|
|
46
28
|
DeleteButton,
|
|
47
29
|
DrillDownButton,
|