@elliemae/ds-shuttle 3.15.0 → 3.16.0-next.10
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/AnimationState.js +1 -3
- package/dist/cjs/AnimationState.js.map +2 -2
- package/dist/cjs/DSShuttle.js +46 -46
- package/dist/cjs/DSShuttle.js.map +2 -2
- package/dist/cjs/SearchState.js.map +2 -2
- package/dist/cjs/Shuttle.actions.js +6 -15
- package/dist/cjs/Shuttle.actions.js.map +3 -3
- package/dist/cjs/ShuttleContainer.js +6 -10
- package/dist/cjs/ShuttleContainer.js.map +2 -2
- package/dist/cjs/ShuttleImpl.js +26 -55
- package/dist/cjs/ShuttleImpl.js.map +2 -2
- package/dist/cjs/ShuttleRenderer.js +11 -19
- package/dist/cjs/ShuttleRenderer.js.map +2 -2
- package/dist/cjs/ShuttleState.js +4 -8
- package/dist/cjs/ShuttleState.js.map +2 -2
- package/dist/cjs/animation/animationConfig.js.map +2 -2
- package/dist/cjs/classedComponents.js +2 -2
- package/dist/cjs/classedComponents.js.map +1 -1
- package/dist/cjs/components/OverflowList.js +2 -2
- package/dist/cjs/components/OverflowList.js.map +1 -1
- package/dist/cjs/components/ShuttleBreadcrumb.js +3 -3
- package/dist/cjs/components/ShuttleBreadcrumb.js.map +2 -2
- package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js +4 -4
- package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js.map +2 -2
- package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +7 -9
- package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js.map +2 -2
- package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +6 -8
- package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js.map +2 -2
- package/dist/cjs/components/ShuttleListPanel.js +2 -4
- package/dist/cjs/components/ShuttleListPanel.js.map +2 -2
- package/dist/cjs/components/ShuttleSource.js +14 -14
- package/dist/cjs/components/ShuttleSource.js.map +2 -2
- package/dist/cjs/components/ShuttleTarget.js +10 -10
- package/dist/cjs/components/ShuttleTarget.js.map +2 -2
- package/dist/cjs/components/VirtualizedItem.js +13 -16
- package/dist/cjs/components/VirtualizedItem.js.map +2 -2
- package/dist/cjs/components/VirtualizedList.js +22 -30
- package/dist/cjs/components/VirtualizedList.js.map +2 -2
- package/dist/cjs/components/VirtualizedSortableList.js +3 -5
- package/dist/cjs/components/VirtualizedSortableList.js.map +2 -2
- package/dist/cjs/helper.js.map +2 -2
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/package.json +7 -0
- package/dist/cjs/tests/utils.js +1 -3
- package/dist/cjs/tests/utils.js.map +2 -2
- package/dist/cjs/updateShuttleStateFromProps.js +6 -10
- package/dist/cjs/updateShuttleStateFromProps.js.map +2 -2
- package/dist/cjs/utils.js +1 -1
- package/dist/cjs/utils.js.map +2 -2
- package/dist/cjs/withProviders.js +6 -4
- package/dist/cjs/withProviders.js.map +2 -2
- package/dist/esm/AnimationState.js +1 -3
- package/dist/esm/AnimationState.js.map +2 -2
- package/dist/esm/DSShuttle.js +3 -3
- package/dist/esm/DSShuttle.js.map +1 -1
- package/dist/esm/SearchState.js.map +2 -2
- package/dist/esm/Shuttle.actions.js +7 -25
- package/dist/esm/Shuttle.actions.js.map +3 -3
- package/dist/esm/ShuttleContainer.js +7 -22
- package/dist/esm/ShuttleContainer.js.map +2 -2
- package/dist/esm/ShuttleImpl.js +18 -47
- package/dist/esm/ShuttleImpl.js.map +2 -2
- package/dist/esm/ShuttleRenderer.js +11 -19
- package/dist/esm/ShuttleRenderer.js.map +2 -2
- package/dist/esm/ShuttleState.js +4 -8
- package/dist/esm/ShuttleState.js.map +2 -2
- package/dist/esm/animation/animationConfig.js.map +2 -2
- package/dist/esm/classedComponents.js +2 -2
- package/dist/esm/classedComponents.js.map +1 -1
- package/dist/esm/components/OverflowList.js +2 -2
- package/dist/esm/components/OverflowList.js.map +1 -1
- package/dist/esm/components/ShuttleBreadcrumb.js +3 -3
- package/dist/esm/components/ShuttleBreadcrumb.js.map +2 -2
- package/dist/esm/components/ShuttleListItem/ShuttleListItem.js +4 -4
- package/dist/esm/components/ShuttleListItem/ShuttleListItem.js.map +2 -2
- package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js +7 -9
- package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js.map +2 -2
- package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js +6 -8
- package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js.map +2 -2
- package/dist/esm/components/ShuttleListPanel.js +2 -4
- package/dist/esm/components/ShuttleListPanel.js.map +2 -2
- package/dist/esm/components/ShuttleSource.js +14 -14
- package/dist/esm/components/ShuttleSource.js.map +2 -2
- package/dist/esm/components/ShuttleTarget.js +10 -10
- package/dist/esm/components/ShuttleTarget.js.map +2 -2
- package/dist/esm/components/VirtualizedItem.js +13 -16
- package/dist/esm/components/VirtualizedItem.js.map +2 -2
- package/dist/esm/components/VirtualizedList.js +22 -30
- package/dist/esm/components/VirtualizedList.js.map +2 -2
- package/dist/esm/components/VirtualizedSortableList.js +3 -5
- package/dist/esm/components/VirtualizedSortableList.js.map +2 -2
- package/dist/esm/helper.js.map +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/package.json +7 -0
- package/dist/esm/tests/utils.js +1 -3
- package/dist/esm/tests/utils.js.map +2 -2
- package/dist/esm/updateShuttleStateFromProps.js +4 -8
- package/dist/esm/updateShuttleStateFromProps.js.map +2 -2
- package/dist/esm/utils.js +1 -1
- package/dist/esm/utils.js.map +2 -2
- package/dist/esm/withProviders.js +6 -4
- package/dist/esm/withProviders.js.map +2 -2
- package/dist/types/DSShuttle.d.ts +38 -38
- package/dist/types/Shuttle.actions.d.ts +7 -7
- package/dist/types/ShuttleRenderer.d.ts +2 -2
- package/dist/types/ShuttleState.d.ts +1 -1
- package/dist/types/components/ShuttleBreadcrumb.d.ts +2 -2
- package/dist/types/components/ShuttleListItem/ShuttleListItem.d.ts +2 -2
- package/dist/types/components/ShuttleListItem/ShuttleSourceListItem.d.ts +2 -2
- package/dist/types/components/ShuttleListItem/ShuttleTargetListItem.d.ts +2 -2
- package/dist/types/components/ShuttleListPanel.d.ts +2 -2
- package/dist/types/components/ShuttleSource.d.ts +27 -28
- package/dist/types/components/ShuttleTarget.d.ts +2 -2
- package/dist/types/components/VirtualizedList.d.ts +2 -2
- package/dist/types/components/VirtualizedSortableList.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/package.json +15 -14
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/Shuttle.actions.
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/Shuttle.actions.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { addOrRemove, cloneDeep, hashArray, compose } from '@elliemae/ds-utilities';\nimport { getHierarchyTypeName, toggleInObject, filterMovedItems } from './helper.js';\nimport utils from './utils.js';\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((hItem) => hItem.id === item.id);\n const hierarchy = state[hierarchyType];\n return {\n ...state,\n [hierarchyType]: indexInHierarchy !== -1 ? hierarchy.slice(0, indexInHierarchy + 1) : [...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 ? compose(utils.getChildren({ index: itemIndex }))(collection) || [] : [];\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((fItem) => fItem.id === itemToRemove.id);\n\n const item = targetItems[itemIndex];\n const children = item?.hasChildren\n ? compose(filterMovedItems(state.movedItems), utils.getChildren({ index: itemIndex }))(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((mItem) => mItem[idField] !== itemToRemove[idField]),\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": "AAAA,YAAY,WAAW;ACAvB,SAAS,aAAa,WAAW,WAAW,eAAe;AAC3D,SAAS,sBAAsB,gBAAgB,wBAAwB;AACvE,OAAO,WAAW;AAEX,SAAS,oBAAoB,QAAQ;AAC1C,SAAO,CAAC,WAAW;AAAA,IACjB,GAAG;AAAA,IACH,cAAc,YAAY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|
9
|
-
} from "@elliemae/ds-utilities";
|
|
10
|
-
import { withProviders } from "./withProviders";
|
|
11
|
-
import {
|
|
12
|
-
prepareItems,
|
|
13
|
-
getActiveIdFromHierarchy,
|
|
14
|
-
filterItemsByHierarchy,
|
|
15
|
-
getItemsById
|
|
16
|
-
} from "./helper";
|
|
17
|
-
import { SearchState } from "./SearchState";
|
|
18
|
-
import { ShuttleState } from "./ShuttleState";
|
|
3
|
+
import { isFunction, compose, uniqBy, values, sortBy } from "@elliemae/ds-utilities";
|
|
4
|
+
import { withProviders } from "./withProviders.js";
|
|
5
|
+
import { prepareItems, getActiveIdFromHierarchy, filterItemsByHierarchy, getItemsById } from "./helper.js";
|
|
6
|
+
import { SearchState } from "./SearchState.js";
|
|
7
|
+
import { ShuttleState } from "./ShuttleState.js";
|
|
19
8
|
function filterItemsByTerm(items, term) {
|
|
20
9
|
return items.filter(
|
|
21
10
|
(item) => item.name.toLowerCase().indexOf(String(term).toLowerCase()) !== -1 || String(item.id).indexOf(String(term).toLowerCase()) !== -1
|
|
22
11
|
);
|
|
23
12
|
}
|
|
24
13
|
function ShuttleContainer({ items = [], children }) {
|
|
25
|
-
const { state: shuttleState, ...handlers } = useContext(
|
|
26
|
-
ShuttleState.Context
|
|
27
|
-
);
|
|
14
|
+
const { state: shuttleState, ...handlers } = useContext(ShuttleState.Context);
|
|
28
15
|
const { state: searchState } = useContext(SearchState.Context);
|
|
29
16
|
const {
|
|
30
17
|
movedItems,
|
|
@@ -53,9 +40,7 @@ function ShuttleContainer({ items = [], children }) {
|
|
|
53
40
|
const hierarchyId = getActiveIdFromHierarchy(hierarchyDest).id;
|
|
54
41
|
return compose(
|
|
55
42
|
(items2) => sortBy(items2, ["name"]),
|
|
56
|
-
(items2) => hierarchyId ? filterItemsByHierarchy(items2, hierarchyId).filter(
|
|
57
|
-
(item) => !movedItems[item.id]
|
|
58
|
-
) : uniqBy(values(movedItems), "id")
|
|
43
|
+
(items2) => hierarchyId ? filterItemsByHierarchy(items2, hierarchyId).filter((item) => !movedItems[item.id]) : uniqBy(values(movedItems), "id")
|
|
59
44
|
)(items);
|
|
60
45
|
}, [items, searching, hierarchyDest, movedItems]);
|
|
61
46
|
return isFunction(children) && children({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ShuttleContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-shadow */\nimport { useContext, useMemo } from 'react';\nimport {
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,YAAY,eAAe;AACpC
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable no-shadow */\nimport { useContext, useMemo } from 'react';\nimport { isFunction, compose, uniqBy, values, sortBy } from '@elliemae/ds-utilities';\nimport { withProviders } from './withProviders.js';\nimport { prepareItems, getActiveIdFromHierarchy, filterItemsByHierarchy, getItemsById } from './helper.js';\nimport { SearchState } from './SearchState.js';\nimport { ShuttleState } from './ShuttleState.js';\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(ShuttleState.Context);\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) => (searchTerm && searching ? filterItemsByTerm(items, searchTerm) : items),\n (items) => 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((item) => !movedItems[item.id])\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: () => 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": "AAAA,YAAY,WAAW;ACCvB,SAAS,YAAY,eAAe;AACpC,SAAS,YAAY,SAAS,QAAQ,QAAQ,cAAc;AAC5D,SAAS,qBAAqB;AAC9B,SAAS,cAAc,0BAA0B,wBAAwB,oBAAoB;AAC7F,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAE7B,SAAS,kBAAkB,OAAO,MAAM;AACtC,SAAO,MAAM;AAAA,IACX,CAAC,SACC,KAAK,KAAK,YAAY,EAAE,QAAQ,OAAO,IAAI,EAAE,YAAY,CAAC,MAAM,MAChE,OAAO,KAAK,EAAE,EAAE,QAAQ,OAAO,IAAI,EAAE,YAAY,CAAC,MAAM;AAAA,EAC5D;AACF;AAEA,SAAS,iBAAiB,EAAE,QAAQ,CAAC,GAAG,SAAS,GAAG;AAClD,QAAM,EAAE,OAAO,iBAAiB,SAAS,IAAI,WAAW,aAAa,OAAO;AAC5E,QA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AS,MAAM,IAAI;AAAA,IACjD,sBAAsB,CAAC,SAAS,SAAS,MAAM,KAAK;AAAA,IACpD,sBAAsB,CAAC,SAAS,SAAS,MAAM,IAAI;AAAA,IACnD;AAAA,IACA;AAAA,EACF,CAAC;AAEL;AAEA,IAAO,2BAAQ,cAAc,gBAAgB;",
|
|
6
6
|
"names": ["items"]
|
|
7
7
|
}
|
package/dist/esm/ShuttleImpl.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Component } from "react";
|
|
4
4
|
import { compose, arrayMove } from "@elliemae/ds-utilities";
|
|
5
|
-
import { withProviders } from "./withProviders";
|
|
5
|
+
import { withProviders } from "./withProviders.js";
|
|
6
6
|
import {
|
|
7
7
|
addToTarget,
|
|
8
8
|
navigateTo,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
resetMovedItems,
|
|
11
11
|
toggleItemSelection,
|
|
12
12
|
removeFromTarget
|
|
13
|
-
} from "./Shuttle.actions";
|
|
13
|
+
} from "./Shuttle.actions.js";
|
|
14
14
|
import {
|
|
15
15
|
getActiveIdFromHierarchy,
|
|
16
16
|
filterBySearch,
|
|
@@ -18,10 +18,10 @@ import {
|
|
|
18
18
|
pipe,
|
|
19
19
|
getChildrenFromParent,
|
|
20
20
|
filterMovedItems
|
|
21
|
-
} from "./helper";
|
|
22
|
-
import { ShuttleRenderer } from "./ShuttleRenderer";
|
|
23
|
-
import { SearchState } from "./SearchState";
|
|
24
|
-
import { updateShuttleStateFromProps } from "./updateShuttleStateFromProps";
|
|
21
|
+
} from "./helper.js";
|
|
22
|
+
import { ShuttleRenderer } from "./ShuttleRenderer.js";
|
|
23
|
+
import { SearchState } from "./SearchState.js";
|
|
24
|
+
import { updateShuttleStateFromProps } from "./updateShuttleStateFromProps.js";
|
|
25
25
|
class ShuttleImpl extends Component {
|
|
26
26
|
constructor(props) {
|
|
27
27
|
super(props);
|
|
@@ -50,12 +50,9 @@ class ShuttleImpl extends Component {
|
|
|
50
50
|
this.resetMovedItems = () => {
|
|
51
51
|
const { selectedItems, onRemoveAllFromTarget } = this.props;
|
|
52
52
|
if (!selectedItems) {
|
|
53
|
-
this.setState(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
this.handleChange();
|
|
57
|
-
}
|
|
58
|
-
);
|
|
53
|
+
this.setState(pipe([navigateTo({ id: null }, true), resetMovedItems()]), () => {
|
|
54
|
+
this.handleChange();
|
|
55
|
+
});
|
|
59
56
|
} else {
|
|
60
57
|
this.setState(pipe([navigateTo({ id: null }, true)]));
|
|
61
58
|
}
|
|
@@ -86,9 +83,7 @@ class ShuttleImpl extends Component {
|
|
|
86
83
|
const { onAddCheckedItems, selectedItems, nonSelectedItems } = this.props;
|
|
87
84
|
const { checkedItems, preparedItems } = this.state;
|
|
88
85
|
const isControlledV2 = !!selectedItems && !!nonSelectedItems;
|
|
89
|
-
const checked = isControlledV2 ? nonSelectedItems.filter(
|
|
90
|
-
(item) => checkedItems.some((check) => check === item)
|
|
91
|
-
) : checkedItems;
|
|
86
|
+
const checked = isControlledV2 ? nonSelectedItems.filter((item) => checkedItems.some((check) => check === item)) : checkedItems;
|
|
92
87
|
const items = getItemsById(checked, preparedItems);
|
|
93
88
|
const actions = !selectedItems ? items.map((item) => addToTarget(item)) : [];
|
|
94
89
|
this.setState(pipe([...actions, resetCheckedItems()]), () => {
|
|
@@ -101,12 +96,8 @@ class ShuttleImpl extends Component {
|
|
|
101
96
|
const { targetItems, hierarchyDest, movedItems } = this.state;
|
|
102
97
|
const hierarchyId = getActiveIdFromHierarchy(hierarchyDest).id;
|
|
103
98
|
const collection = !hierarchyId ? movedItems : targetItems;
|
|
104
|
-
const oldIndex = collection.findIndex(
|
|
105
|
-
|
|
106
|
-
);
|
|
107
|
-
const newIndex = collection.findIndex(
|
|
108
|
-
(tItem) => tItem[idField] === targetItem[idField]
|
|
109
|
-
);
|
|
99
|
+
const oldIndex = collection.findIndex((tItem) => tItem[idField] === sourceItem[idField]);
|
|
100
|
+
const newIndex = collection.findIndex((tItem) => tItem[idField] === targetItem[idField]);
|
|
110
101
|
const sortedMovedItems = !hierarchyId ? arrayMove(movedItems, oldIndex, newIndex) : movedItems;
|
|
111
102
|
const sortedItems = hierarchyId ? arrayMove(targetItems, oldIndex, newIndex) : targetItems;
|
|
112
103
|
this.setState({
|
|
@@ -135,14 +126,7 @@ class ShuttleImpl extends Component {
|
|
|
135
126
|
}
|
|
136
127
|
render() {
|
|
137
128
|
const { idField, nonSelectedItems, moreItemsLoading, ...rest } = this.props;
|
|
138
|
-
const {
|
|
139
|
-
hierarchy,
|
|
140
|
-
hierarchyDest,
|
|
141
|
-
checkedItems,
|
|
142
|
-
movedItems,
|
|
143
|
-
preparedItems: items,
|
|
144
|
-
targetItems
|
|
145
|
-
} = this.state;
|
|
129
|
+
const { hierarchy, hierarchyDest, checkedItems, movedItems, preparedItems: items, targetItems } = this.state;
|
|
146
130
|
const {
|
|
147
131
|
state: { searchTerm, searching }
|
|
148
132
|
} = this.context;
|
|
@@ -152,20 +136,14 @@ class ShuttleImpl extends Component {
|
|
|
152
136
|
return filterBySearch(
|
|
153
137
|
searchTerm,
|
|
154
138
|
searching
|
|
155
|
-
)(
|
|
156
|
-
getChildrenFromParent(id)(
|
|
157
|
-
nonSelectedItems.map((it) => items.find((itt) => itt.id === it))
|
|
158
|
-
)
|
|
159
|
-
);
|
|
139
|
+
)(getChildrenFromParent(id)(nonSelectedItems.map((it) => items.find((itt) => itt.id === it))));
|
|
160
140
|
}
|
|
161
141
|
return filterBySearch(
|
|
162
142
|
searchTerm,
|
|
163
143
|
searching
|
|
164
144
|
)(
|
|
165
145
|
items.filter(
|
|
166
|
-
(it) => nonSelectedItems.some(
|
|
167
|
-
(itt) => itt === it.id && !nonSelectedItems.some((ittt) => ittt === it.parent)
|
|
168
|
-
)
|
|
146
|
+
(it) => nonSelectedItems.some((itt) => itt === it.id && !nonSelectedItems.some((ittt) => ittt === it.parent))
|
|
169
147
|
)
|
|
170
148
|
);
|
|
171
149
|
};
|
|
@@ -182,12 +160,8 @@ class ShuttleImpl extends Component {
|
|
|
182
160
|
const handleControlledTargetItms = () => {
|
|
183
161
|
const { id } = getActiveIdFromHierarchy(hierarchyDest);
|
|
184
162
|
if (id) {
|
|
185
|
-
return getChildrenFromParent(
|
|
186
|
-
|
|
187
|
-
)(
|
|
188
|
-
this.props.selectedItems.map(
|
|
189
|
-
(it) => items.find((itt) => itt.id === it)
|
|
190
|
-
)
|
|
163
|
+
return getChildrenFromParent(getActiveIdFromHierarchy(hierarchyDest).id)(
|
|
164
|
+
this.props.selectedItems.map((it) => items.find((itt) => itt.id === it))
|
|
191
165
|
);
|
|
192
166
|
}
|
|
193
167
|
return targetItems.filter(
|
|
@@ -202,10 +176,7 @@ class ShuttleImpl extends Component {
|
|
|
202
176
|
} else {
|
|
203
177
|
composedTargetItems = compose((tItems) => {
|
|
204
178
|
const hierarchyId = getActiveIdFromHierarchy(hierarchyDest).id;
|
|
205
|
-
return hierarchyId ? compose(
|
|
206
|
-
filterMovedItems(movedItems),
|
|
207
|
-
getChildrenFromParent(hierarchyId)
|
|
208
|
-
)(tItems) : movedItems;
|
|
179
|
+
return hierarchyId ? compose(filterMovedItems(movedItems), getChildrenFromParent(hierarchyId))(tItems) : movedItems;
|
|
209
180
|
})(targetItems);
|
|
210
181
|
}
|
|
211
182
|
return /* @__PURE__ */ jsx(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ShuttleImpl.tsx"],
|
|
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 }
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
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.js';\nimport {\n addToTarget,\n navigateTo,\n resetCheckedItems,\n resetMovedItems,\n toggleItemSelection,\n removeFromTarget,\n} from './Shuttle.actions.js';\nimport {\n getActiveIdFromHierarchy,\n filterBySearch,\n getItemsById,\n pipe,\n getChildrenFromParent,\n filterMovedItems,\n} from './helper.js';\nimport { ShuttleRenderer } from './ShuttleRenderer.js';\nimport { SearchState } from './SearchState.js';\nimport { updateShuttleStateFromProps } from './updateShuttleStateFromProps.js';\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(pipe([navigateTo({ id: null }, true), resetMovedItems()]), () => {\n this.handleChange();\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) => checkedItems.some((check) => check === item))\n : checkedItems;\n const items = getItemsById(checked, preparedItems);\n const actions = !selectedItems ? items.map((item) => addToTarget(item)) : [];\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((tItem) => tItem[idField] === sourceItem[idField]);\n const newIndex = collection.findIndex((tItem) => tItem[idField] === targetItem[idField]);\n\n const sortedMovedItems = !hierarchyId ? arrayMove(movedItems, oldIndex, newIndex) : movedItems;\n const sortedItems = hierarchyId ? arrayMove(targetItems, oldIndex, newIndex) : 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 { hierarchy, hierarchyDest, checkedItems, movedItems, preparedItems: items, targetItems } = 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 )(getChildrenFromParent(id)(nonSelectedItems.map((it) => items.find((itt) => itt.id === it))));\n }\n\n return filterBySearch(\n searchTerm,\n searching,\n )(\n items.filter((it) =>\n nonSelectedItems.some((itt) => itt === it.id && !nonSelectedItems.some((ittt) => ittt === it.parent)),\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(getActiveIdFromHierarchy(hierarchyDest).id)(\n this.props.selectedItems.map((it) => items.find((itt) => itt.id === it)),\n );\n }\n\n return targetItems.filter((it) =>\n this.props.selectedItems.some(\n (itt) => itt === it.id && !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(filterMovedItems(movedItems), getChildrenFromParent(hierarchyId))(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) => this.navigate(item, false, direction)}\n onNavigateOnTargetTo={(item, direction) => this.navigate(item, true, direction)}\n onSourceSortEnd={() => null}\n onTargetSortEnd={this.handleTargetSortEnd}\n sourceItems={composedSourceItems}\n targetItems={composedTargetItems}\n />\n );\n }\n}\n\nconst ShuttleImplHoc = withProviders(ShuttleImpl);\nexport { ShuttleImplHoc as ShuttleImpl };\nexport default ShuttleImplHoc;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACgOjB;AA5NN,SAAgB,iBAAiB;AACjC,SAAS,SAAS,iBAAiB;AACnC,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAC5B,SAAS,mCAAmC;AAE5C,MAAM,oBAAoB,UAAU;AAAA,EAGlC,YAAY,OAAO;AACjB,UAAM,KAAK;AAyBb,oBAAW,MAAM;AACf,YAAM,EAAE,WAAW,IAAI,KAAK;AAC5B,aAAO,OAAO,KAAK,UAAU;AAAA,IAC/B;AAEA,wBAAe,MAAM;AACnB,YAAM,EAAE,SAAS,IAAI,KAAK;AAC1B,YAAM,EAAE,WAAW,IAAI,KAAK;AAC5B,eAAS,OAAO,KAAK,UAAU,CAAC;AAAA,IAClC;AAEA,oBAAW,CAAC,MAAM,MAAM,cAAc;AACpC,YAAM,EAAE,aAAa,kBAAkB,IAAI,KAAK;AAEhD,UAAI,CAAC;AAAM,oBAAY,MAAM,SAAS;AACtC,UAAI;AAAM,0BAAkB,MAAM,SAAS;AAE3C,YAAM,EAAE,OAAO,iBAAiB,IAAI,KAAK;AACzC,uBAAiB;AAEjB,WAAK,SAAS,KAAK,CAAC,WAAW,MAAM,IAAI,GAAG,kBAAkB,CAAC,CAAC,CAAC;AAAA,IACnE;AAEA,6BAAoB,MAAM;AACxB,WAAK,SAAS,kBAAkB,CAAC;AAAA,IACnC;AAEA,2BAAkB,MAAM;AACtB,YAAM,EAAE,eAAe,sBAAsB,IAAI,KAAK;AACtD,UAAI,CAAC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
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useContext } from "react";
|
|
4
|
-
import { ShuttleSource } from "./components/ShuttleSource";
|
|
5
|
-
import { ShuttleTarget } from "./components/ShuttleTarget";
|
|
6
|
-
import { ShuttleContainer } from "./classedComponents";
|
|
7
|
-
import { AnimationState } from "./AnimationState";
|
|
4
|
+
import { ShuttleSource } from "./components/ShuttleSource.js";
|
|
5
|
+
import { ShuttleTarget } from "./components/ShuttleTarget.js";
|
|
6
|
+
import { ShuttleContainer } from "./classedComponents.js";
|
|
7
|
+
import { AnimationState } from "./AnimationState.js";
|
|
8
8
|
const noop = () => {
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
const ShuttleRenderer = ({
|
|
11
11
|
containerProps,
|
|
12
12
|
onNavigateOnTargetTo = noop,
|
|
13
13
|
onNavigateOnSourceTo = noop,
|
|
@@ -42,13 +42,9 @@ function ShuttleRenderer({
|
|
|
42
42
|
moreItemsLoading = false,
|
|
43
43
|
hasNextPage = false,
|
|
44
44
|
...otherProps
|
|
45
|
-
}) {
|
|
46
|
-
const { setIsMoving, setIsDrillingDown, setIsMovingBack, reset } = useContext(
|
|
47
|
-
|
|
48
|
-
);
|
|
49
|
-
const removeAnimationState = useCallback(
|
|
50
|
-
() => setTimeout(() => reset(), 500)
|
|
51
|
-
);
|
|
45
|
+
}) => {
|
|
46
|
+
const { setIsMoving, setIsDrillingDown, setIsMovingBack, reset } = useContext(AnimationState.Context);
|
|
47
|
+
const removeAnimationState = useCallback(() => setTimeout(() => reset(), 500));
|
|
52
48
|
return /* @__PURE__ */ jsxs(ShuttleContainer, { "data-testid": "em-ds-shuttle", ...containerProps, children: [
|
|
53
49
|
/* @__PURE__ */ jsx(
|
|
54
50
|
ShuttleSource,
|
|
@@ -71,9 +67,7 @@ function ShuttleRenderer({
|
|
|
71
67
|
removeAnimationState();
|
|
72
68
|
},
|
|
73
69
|
onNavigateTo: (item, direction = "down") => {
|
|
74
|
-
const indexInHierarchy = hierarchy.findIndex(
|
|
75
|
-
(hItem) => hItem.id === item.id
|
|
76
|
-
);
|
|
70
|
+
const indexInHierarchy = hierarchy.findIndex((hItem) => hItem.id === item.id);
|
|
77
71
|
setIsDrillingDown(indexInHierarchy === -1);
|
|
78
72
|
onNavigateOnSourceTo(item, direction);
|
|
79
73
|
},
|
|
@@ -109,9 +103,7 @@ function ShuttleRenderer({
|
|
|
109
103
|
onMoveItemToSource(item);
|
|
110
104
|
},
|
|
111
105
|
onNavigateTo: (item, direction = "down") => {
|
|
112
|
-
const indexInHierarchy = hierarchyDest.findIndex(
|
|
113
|
-
(hItem) => hItem.id === item.id
|
|
114
|
-
);
|
|
106
|
+
const indexInHierarchy = hierarchyDest.findIndex((hItem) => hItem.id === item.id);
|
|
115
107
|
setIsDrillingDown(indexInHierarchy === -1);
|
|
116
108
|
onNavigateOnTargetTo(item, direction);
|
|
117
109
|
},
|
|
@@ -121,7 +113,7 @@ function ShuttleRenderer({
|
|
|
121
113
|
}
|
|
122
114
|
)
|
|
123
115
|
] });
|
|
124
|
-
}
|
|
116
|
+
};
|
|
125
117
|
var ShuttleRenderer_default = ShuttleRenderer;
|
|
126
118
|
export {
|
|
127
119
|
ShuttleRenderer,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ShuttleRenderer.tsx"],
|
|
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 = () => {};\
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
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.js';\nimport { ShuttleTarget } from './components/ShuttleTarget.js';\nimport { ShuttleContainer } from './classedComponents.js';\nimport { AnimationState } from './AnimationState.js';\n\n// todo: clean methods on jsx\nconst noop = () => {};\nconst 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(AnimationState.Context);\n\n const removeAnimationState = useCallback(() => setTimeout(() => reset(), 500));\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((hItem) => hItem.id === item.id);\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((hItem) => hItem.id === item.id);\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": "AAAA,YAAY,WAAW;ACkDnB,SACE,KADF;AAhDJ,SAAgB,aAAa,kBAAkB;AAC/C,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAG/B,MAAM,OAAO,MAAM;AAAC;AACpB,MAAM,kBAAkB,CAAC;AAAA,EACvB;AAAA,EACA,uBAAuB;AAAA,EACvB,uBAAuB;AAAA,EACvB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,qBAAqB;AAAA,EACrB,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,YAAY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QACE,GAAG;AAAA,QACJ;AAAA,QACA,cAAc;AAAA,QACd,WAAW;AAAA,QACX,OAAO;AAAA,QACP,mBAAmB,MAAM;AACvB,0BAAgB,IAAI;AACpB,+BAAqB;AACrB,4BAAkB;AAAA,QACpB;AAAA,QACA,YAAY,CAAC,SAAS;AACpB,0BAAgB,IAAI;AACpB,+BAAqB;AACrB,6BAAmB,IAAI;AAAA,QACzB;AAAA,QACA,cAAc,CAAC,MAAM,YAAY,WAAW;AAC1C,gBAAM,mBAAmB,cAAc,UAAU,CAAC,UAAU,MAAM,OAAO,KAAK,EAAE;AAChF,4BAAkB,qBAAqB,EAAE;AACzC,+BAAqB,MAAM,SAAS;AAAA,QACtC;AAAA,QACA,WAAW;AAAA,QACX;AAAA,QACA,SAAS;AAAA;AAAA,IACX;AAAA,KACF;AAEJ;AAGA,IAAO,0BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/ShuttleState.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import createContainer from "constate";
|
|
4
|
-
import { getItemsById, pipe } from "./helper";
|
|
5
|
-
import * as actions from "./Shuttle.actions";
|
|
4
|
+
import { getItemsById, pipe } from "./helper.js";
|
|
5
|
+
import * as actions from "./Shuttle.actions.js";
|
|
6
6
|
function useShuttleState() {
|
|
7
7
|
const [shuttleState, setShuttleState] = useState({
|
|
8
8
|
checkedItems: [],
|
|
@@ -17,17 +17,13 @@ function useShuttleState() {
|
|
|
17
17
|
setState(pipe([actions.resetMovedItems(), ...pipeActions]));
|
|
18
18
|
}
|
|
19
19
|
function navigate(item, dest) {
|
|
20
|
-
setState(
|
|
21
|
-
pipe([actions.navigateTo(item, dest), actions.resetCheckedItems()])
|
|
22
|
-
);
|
|
20
|
+
setState(pipe([actions.navigateTo(item, dest), actions.resetCheckedItems()]));
|
|
23
21
|
}
|
|
24
22
|
function resetCheckedItems() {
|
|
25
23
|
setState(actions.resetCheckedItems());
|
|
26
24
|
}
|
|
27
25
|
function resetMovedItems() {
|
|
28
|
-
setState(
|
|
29
|
-
pipe([actions.navigateTo({ id: null }, true), actions.resetMovedItems()])
|
|
30
|
-
);
|
|
26
|
+
setState(pipe([actions.navigateTo({ id: null }, true), actions.resetMovedItems()]));
|
|
31
27
|
}
|
|
32
28
|
function moveItem(item, dest) {
|
|
33
29
|
setState(pipe([actions.moveItem(item, dest), actions.resetCheckedItems()]));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/ShuttleState.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useState } from 'react';\nimport createContainer from 'constate';\nimport { getItemsById, pipe } from './helper';\nimport * as actions from './Shuttle.actions';\n\nfunction useShuttleState() {\n const [shuttleState, setShuttleState] = useState({\n checkedItems: [],\n movedItems: {},\n hierarchy: [{ name: 'Category', id: null }],\n hierarchyDest: [{ name: 'Added users', id: null }],\n });\n\n const setState = state => setShuttleState(state(shuttleState));\n\n function setMovedItems(itemsIds = [], items = []) {\n const itemsToMove = getItemsById(itemsIds, items);\n const pipeActions = itemsToMove.map(item => actions.moveItem(item, true));\n setState(pipe([actions.resetMovedItems(), ...pipeActions]));\n }\n\n function navigate(item, dest) {\n setState(
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,gBAAgB;AACzB,OAAO,qBAAqB;AAC5B,SAAS,cAAc,YAAY;AACnC,YAAY,aAAa;AAEzB,SAAS,kBAAkB;AACzB,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS;AAAA,IAC/C,cAAc,CAAC;AAAA,IACf,YAAY,CAAC;AAAA,IACb,WAAW,CAAC,EAAE,MAAM,YAAY,IAAI,KAAK,CAAC;AAAA,IAC1C,eAAe,CAAC,EAAE,MAAM,eAAe,IAAI,KAAK,CAAC;AAAA,EACnD,CAAC;AAED,QAAM,WAAW,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useState } from 'react';\nimport createContainer from 'constate';\nimport { getItemsById, pipe } from './helper.js';\nimport * as actions from './Shuttle.actions.js';\n\nfunction useShuttleState() {\n const [shuttleState, setShuttleState] = useState({\n checkedItems: [],\n movedItems: {},\n hierarchy: [{ name: 'Category', id: null }],\n hierarchyDest: [{ name: 'Added users', id: null }],\n });\n\n const setState = (state) => setShuttleState(state(shuttleState));\n\n function setMovedItems(itemsIds = [], items = []) {\n const itemsToMove = getItemsById(itemsIds, items);\n const pipeActions = itemsToMove.map((item) => actions.moveItem(item, true));\n setState(pipe([actions.resetMovedItems(), ...pipeActions]));\n }\n\n function navigate(item, dest) {\n setState(pipe([actions.navigateTo(item, dest), actions.resetCheckedItems()]));\n }\n\n function resetCheckedItems() {\n setState(actions.resetCheckedItems());\n }\n\n function resetMovedItems() {\n setState(pipe([actions.navigateTo({ id: null }, true), actions.resetMovedItems()]));\n }\n\n function moveItem(item, dest) {\n setState(pipe([actions.moveItem(item, dest), actions.resetCheckedItems()]));\n }\n\n function toggleItemSelection(item) {\n setState(actions.toggleItemSelection(item.id));\n }\n\n function moveCheckedItems(items, dest = true) {\n const pipeActions = items.map((item) => moveItem(item, dest));\n setState(pipe([...pipeActions, resetCheckedItems()]));\n }\n\n return {\n state: shuttleState,\n toggleItemSelection,\n moveCheckedItems,\n moveItem,\n resetMovedItems,\n resetCheckedItems,\n navigate,\n setMovedItems,\n };\n}\n\nconst useShuttleStateHOC = createContainer(useShuttleState, (value) => [value.state]);\nexport { useShuttleStateHOC as ShuttleState };\nexport default useShuttleStateHOC;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,gBAAgB;AACzB,OAAO,qBAAqB;AAC5B,SAAS,cAAc,YAAY;AACnC,YAAY,aAAa;AAEzB,SAAS,kBAAkB;AACzB,QAAM,CAAC,cAAc,eAAe,IAAI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A,EACtD;AAEA,SAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,MAAM,qBAAqB,gBAAgB,iBAAiB,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;AAEpF,IAAO,uBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/animation/animationConfig.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// shuttle list and items constants\nconst itemAnimationDuration = 300;\nconst listAnimationDuration = 300;\nconst xPosMovement = 500;\n\n// breadcrumb constants\nconst breadcrumbDuration = 200;\nconst xBreadcrumbPos = 300;\n\nexport const animationConfig = {\n slideRight: {\n from: { transform: 'translate3d(0,0,0)' },\n to: { transform: `translate3d(${xPosMovement}px,0,0)` },\n },\n slideLeft: {\n from: { transform: 'translate3d(0,0,0)' },\n to: { transform: `translate3d(${-xPosMovement}px,0,0)` },\n },\n moveItem: isMovingLeft => ({\n config: { duration: itemAnimationDuration },\n enter: { opacity: 1, transform: `translate3d(${0}px,0,0)` },\n from: {\n opacity: 1,\n transform: `translate3d(${
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACCvB,MAAM,wBAAwB;AAC9B,MAAM,wBAAwB;AAC9B,MAAM,eAAe;AAGrB,MAAM,qBAAqB;AAC3B,MAAM,iBAAiB;AAEhB,MAAM,kBAAkB;AAAA,EAC7B,YAAY;AAAA,IACV,MAAM,EAAE,WAAW,qBAAqB;AAAA,IACxC,IAAI,EAAE,WAAW,eAAe,sBAAsB;AAAA,EACxD;AAAA,EACA,WAAW;AAAA,IACT,MAAM,EAAE,WAAW,qBAAqB;AAAA,IACxC,IAAI,EAAE,WAAW,eAAe,CAAC,sBAAsB;AAAA,EACzD;AAAA,EACA,UAAU,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// shuttle list and items constants\nconst itemAnimationDuration = 300;\nconst listAnimationDuration = 300;\nconst xPosMovement = 500;\n\n// breadcrumb constants\nconst breadcrumbDuration = 200;\nconst xBreadcrumbPos = 300;\n\nexport const animationConfig = {\n slideRight: {\n from: { transform: 'translate3d(0,0,0)' },\n to: { transform: `translate3d(${xPosMovement}px,0,0)` },\n },\n slideLeft: {\n from: { transform: 'translate3d(0,0,0)' },\n to: { transform: `translate3d(${-xPosMovement}px,0,0)` },\n },\n moveItem: (isMovingLeft) => ({\n config: { duration: itemAnimationDuration },\n enter: { opacity: 1, transform: `translate3d(${0}px,0,0)` },\n from: {\n opacity: 1,\n transform: `translate3d(${isMovingLeft ? -xPosMovement : xPosMovement}px,0,0)`,\n },\n leave: {\n transform: `translate3d(${isMovingLeft ? -xPosMovement : xPosMovement}px,0,0)`,\n },\n }),\n moveList: (isDrillingDown) => ({\n config: { duration: listAnimationDuration },\n enter: { opacity: 1, transform: 'translate3d(0,0,0)' },\n from: {\n opacity: 0,\n transform: `translate3d(0px,${isDrillingDown ? xPosMovement : -xPosMovement}px,0)`,\n },\n leave: {\n opacity: 0,\n transform: `translate3d(0,${isDrillingDown ? -xPosMovement : xPosMovement}px,0)`,\n },\n }),\n breadcrumb: () => ({\n config: { duration: breadcrumbDuration },\n enter: { opacity: 1, transform: `translate3d(${0}px,0,0)` },\n from: { opacity: 0, transform: `translate3d(${xBreadcrumbPos}px,0px,0)` },\n leave: { opacity: 0, transform: `translate3d(${xBreadcrumbPos}px,0,0)` },\n }),\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,MAAM,wBAAwB;AAC9B,MAAM,wBAAwB;AAC9B,MAAM,eAAe;AAGrB,MAAM,qBAAqB;AAC3B,MAAM,iBAAiB;AAEhB,MAAM,kBAAkB;AAAA,EAC7B,YAAY;AAAA,IACV,MAAM,EAAE,WAAW,qBAAqB;AAAA,IACxC,IAAI,EAAE,WAAW,eAAe,sBAAsB;AAAA,EACxD;AAAA,EACA,WAAW;AAAA,IACT,MAAM,EAAE,WAAW,qBAAqB;AAAA,IACxC,IAAI,EAAE,WAAW,eAAe,CAAC,sBAAsB;AAAA,EACzD;AAAA,EACA,UAAU,CAAC,kBAAkB;AAAA,IAC3B,QAAQ,EAAE,UAAU,sBAAsB;AAAA,IAC1C,OAAO,EAAE,SAAS,GAAG,WAAW,eAAe,WAAW;AAAA,IAC1D,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,WAAW,eAAe,eAAe,CAAC,eAAe;AAAA,IAC3D;AAAA,IACA,OAAO;AAAA,MACL,WAAW,eAAe,eAAe,CAAC,eAAe;AAAA,IAC3D;AAAA,EACF;AAAA,EACA,UAAU,CAAC,oBAAoB;AAAA,IAC7B,QAAQ,EAAE,UAAU,sBAAsB;AAAA,IAC1C,OAAO,EAAE,SAAS,GAAG,WAAW,qBAAqB;AAAA,IACrD,MAAM;AAAA,MACJ,SAAS;AAAA,MACT,WAAW,mBAAmB,iBAAiB,eAAe,CAAC;AAAA,IACjE;AAAA,IACA,OAAO;AAAA,MACL,SAAS;AAAA,MACT,WAAW,iBAAiB,iBAAiB,CAAC,eAAe;AAAA,IAC/D;AAAA,EACF;AAAA,EACA,YAAY,OAAO;AAAA,IACjB,QAAQ,EAAE,UAAU,mBAAmB;AAAA,IACvC,OAAO,EAAE,SAAS,GAAG,WAAW,eAAe,WAAW;AAAA,IAC1D,MAAM,EAAE,SAAS,GAAG,WAAW,eAAe,0BAA0B;AAAA,IACxE,OAAO,EAAE,SAAS,GAAG,WAAW,eAAe,wBAAwB;AAAA,EACzE;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { DSButton } from "@elliemae/ds-button";
|
|
3
3
|
import { aggregatedClasses } from "@elliemae/ds-classnames";
|
|
4
|
-
import { ShuttleBreadcrumb } from "./components/ShuttleBreadcrumb";
|
|
5
|
-
import { OverflowList } from "./components/OverflowList";
|
|
4
|
+
import { ShuttleBreadcrumb } from "./components/ShuttleBreadcrumb.js";
|
|
5
|
+
import { OverflowList } from "./components/OverflowList.js";
|
|
6
6
|
const blockName = "shuttle";
|
|
7
7
|
const headerBlockName = `${blockName}-header`;
|
|
8
8
|
const listBlockName = `${blockName}-list`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/classedComponents.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { DSButton } from '@elliemae/ds-button';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { ShuttleBreadcrumb } from './components/ShuttleBreadcrumb';\nimport { OverflowList } from './components/OverflowList';\n\n// block names\nconst blockName = 'shuttle';\nconst headerBlockName = `${blockName}-header`;\nconst listBlockName = `${blockName}-list`;\nconst footerBlockName = `${blockName}-footer`;\n\nexport const ShuttleContainer = aggregatedClasses('div')(blockName);\n\n// wrapper\nexport const ShuttleWrapper = aggregatedClasses('div')(`${blockName}-wrapper`);\n\n// header\nexport const ShuttleHeader = aggregatedClasses('div')(headerBlockName);\nexport const ShuttleHeaderBreadcrumb = aggregatedClasses(ShuttleBreadcrumb)(headerBlockName, 'breadcrumb');\nexport const ShuttleHeaderSearchToggle = aggregatedClasses(DSButton)(headerBlockName, 'search-toggle');\n\n// list\nexport const ShuttleList = aggregatedClasses('div')(listBlockName, null, ({ showPulse }) => ({\n 'show-pulse': showPulse,\n}));\n\nexport const ShuttleListPanel = aggregatedClasses('div')(listBlockName, 'panel', ({ open }) => ({ open }));\nexport const Overflow = aggregatedClasses(OverflowList)(listBlockName, 'overflow', ({ empty, searching }) => ({\n empty,\n searching,\n}));\nexport const EmptyMessage = aggregatedClasses('span')(listBlockName, 'empty-message');\nexport const LoadingList = aggregatedClasses('div')(listBlockName, 'loading-list');\n\n// footer\nexport const ShuttleFooter = aggregatedClasses('div')(footerBlockName);\nexport const ShuttleFooterActions = aggregatedClasses('div')(footerBlockName, 'actions');\nexport const ShuttleFooterCounter = aggregatedClasses('span')(footerBlockName, 'counter');\n"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { DSButton } from '@elliemae/ds-button';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { ShuttleBreadcrumb } from './components/ShuttleBreadcrumb.js';\nimport { OverflowList } from './components/OverflowList.js';\n\n// block names\nconst blockName = 'shuttle';\nconst headerBlockName = `${blockName}-header`;\nconst listBlockName = `${blockName}-list`;\nconst footerBlockName = `${blockName}-footer`;\n\nexport const ShuttleContainer = aggregatedClasses('div')(blockName);\n\n// wrapper\nexport const ShuttleWrapper = aggregatedClasses('div')(`${blockName}-wrapper`);\n\n// header\nexport const ShuttleHeader = aggregatedClasses('div')(headerBlockName);\nexport const ShuttleHeaderBreadcrumb = aggregatedClasses(ShuttleBreadcrumb)(headerBlockName, 'breadcrumb');\nexport const ShuttleHeaderSearchToggle = aggregatedClasses(DSButton)(headerBlockName, 'search-toggle');\n\n// list\nexport const ShuttleList = aggregatedClasses('div')(listBlockName, null, ({ showPulse }) => ({\n 'show-pulse': showPulse,\n}));\n\nexport const ShuttleListPanel = aggregatedClasses('div')(listBlockName, 'panel', ({ open }) => ({ open }));\nexport const Overflow = aggregatedClasses(OverflowList)(listBlockName, 'overflow', ({ empty, searching }) => ({\n empty,\n searching,\n}));\nexport const EmptyMessage = aggregatedClasses('span')(listBlockName, 'empty-message');\nexport const LoadingList = aggregatedClasses('div')(listBlockName, 'loading-list');\n\n// footer\nexport const ShuttleFooter = aggregatedClasses('div')(footerBlockName);\nexport const ShuttleFooterActions = aggregatedClasses('div')(footerBlockName, 'actions');\nexport const ShuttleFooterCounter = aggregatedClasses('span')(footerBlockName, 'counter');\n"],
|
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,gBAAgB;AACzB,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAClC,SAAS,oBAAoB;AAG7B,MAAM,YAAY;AAClB,MAAM,kBAAkB,GAAG;AAC3B,MAAM,gBAAgB,GAAG;AACzB,MAAM,kBAAkB,GAAG;AAEpB,MAAM,mBAAmB,kBAAkB,KAAK,EAAE,SAAS;AAG3D,MAAM,iBAAiB,kBAAkB,KAAK,EAAE,GAAG,mBAAmB;AAGtE,MAAM,gBAAgB,kBAAkB,KAAK,EAAE,eAAe;AAC9D,MAAM,0BAA0B,kBAAkB,iBAAiB,EAAE,iBAAiB,YAAY;AAClG,MAAM,4BAA4B,kBAAkB,QAAQ,EAAE,iBAAiB,eAAe;AAG9F,MAAM,cAAc,kBAAkB,KAAK,EAAE,eAAe,MAAM,CAAC,EAAE,UAAU,OAAO;AAAA,EAC3F,cAAc;AAChB,EAAE;AAEK,MAAM,mBAAmB,kBAAkB,KAAK,EAAE,eAAe,SAAS,CAAC,EAAE,KAAK,OAAO,EAAE,KAAK,EAAE;AAClG,MAAM,WAAW,kBAAkB,YAAY,EAAE,eAAe,YAAY,CAAC,EAAE,OAAO,UAAU,OAAO;AAAA,EAC5G;AAAA,EACA;AACF,EAAE;AACK,MAAM,eAAe,kBAAkB,MAAM,EAAE,eAAe,eAAe;AAC7E,MAAM,cAAc,kBAAkB,KAAK,EAAE,eAAe,cAAc;AAG1E,MAAM,gBAAgB,kBAAkB,KAAK,EAAE,eAAe;AAC9D,MAAM,uBAAuB,kBAAkB,KAAK,EAAE,iBAAiB,SAAS;AAChF,MAAM,uBAAuB,kBAAkB,MAAM,EAAE,iBAAiB,SAAS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,8 +2,8 @@ import * as React from "react";
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useContext } from "react";
|
|
4
4
|
import { useTransition, animated } from "react-spring/web";
|
|
5
|
-
import { animationConfig } from "../animation/animationConfig";
|
|
6
|
-
import { AnimationState } from "../AnimationState";
|
|
5
|
+
import { animationConfig } from "../animation/animationConfig.js";
|
|
6
|
+
import { AnimationState } from "../AnimationState.js";
|
|
7
7
|
function OverflowList({ className = "", activeHierarchy = "", children }) {
|
|
8
8
|
const {
|
|
9
9
|
state: { isDrillingDown = false },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/OverflowList.tsx"],
|
|
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"],
|
|
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.js';\nimport { AnimationState } from '../AnimationState.js';\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
5
|
"mappings": "AAAA,YAAY,WAAW;ACgBnB;AAhBJ,SAAgB,kBAAkB;AAClC,SAAS,eAAe,gBAAgB;AACxC,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAE/B,SAAS,aAAa,EAAE,YAAY,IAAI,kBAAkB,IAAI,SAAS,GAAG;AACxE,QAAM;AAAA,IACJ,OAAO,EAAE,iBAAiB,MAAM;AAAA,IAChC;AAAA,EACF,IAAI,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,IAAI,MAC1C,oBAAC,SAAS,KAAT,EAAuB,WAAsB,OAAO,OAClD,YADgB,GAEnB,CACD;AACH;AAGA,IAAO,uBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,8 +2,8 @@ import * as React from "react";
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useTransition, animated } from "react-spring/web";
|
|
4
4
|
import { DSBreadcrumb } from "@elliemae/ds-breadcrumb";
|
|
5
|
-
import { animationConfig } from "../animation/animationConfig";
|
|
6
|
-
|
|
5
|
+
import { animationConfig } from "../animation/animationConfig.js";
|
|
6
|
+
const ShuttleBreadcrumb = ({ className = "", hierarchy = [], onNavigateTo = () => null }) => {
|
|
7
7
|
const animatedCrumbs = useTransition(hierarchy, (item) => item.id, animationConfig.breadcrumb());
|
|
8
8
|
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(DSBreadcrumb, { isTitle: true, children: animatedCrumbs.map(({ item, props, key }) => /* @__PURE__ */ jsx(
|
|
9
9
|
DSBreadcrumb.Item,
|
|
@@ -15,7 +15,7 @@ function ShuttleBreadcrumb({ className = "", hierarchy = [], onNavigateTo = () =
|
|
|
15
15
|
},
|
|
16
16
|
key
|
|
17
17
|
)) }) });
|
|
18
|
-
}
|
|
18
|
+
};
|
|
19
19
|
var ShuttleBreadcrumb_default = ShuttleBreadcrumb;
|
|
20
20
|
export {
|
|
21
21
|
ShuttleBreadcrumb,
|