@elliemae/ds-shuttle 3.5.0-rc.1 → 3.5.0-rc.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 +36 -21
- package/dist/cjs/AnimationState.js.map +2 -2
- package/dist/cjs/DSShuttle.js +71 -54
- package/dist/cjs/DSShuttle.js.map +2 -2
- package/dist/cjs/SearchState.js +4 -1
- package/dist/cjs/SearchState.js.map +2 -2
- package/dist/cjs/Shuttle.actions.js +17 -5
- package/dist/cjs/Shuttle.actions.js.map +2 -2
- package/dist/cjs/ShuttleContainer.js +25 -5
- package/dist/cjs/ShuttleContainer.js.map +2 -2
- package/dist/cjs/ShuttleImpl.js +61 -15
- package/dist/cjs/ShuttleImpl.js.map +1 -1
- package/dist/cjs/ShuttleRenderer.js +81 -65
- package/dist/cjs/ShuttleRenderer.js.map +1 -1
- package/dist/cjs/ShuttleState.js +10 -3
- package/dist/cjs/ShuttleState.js.map +2 -2
- package/dist/cjs/animation/animationConfig.js +4 -1
- package/dist/cjs/animation/animationConfig.js.map +1 -1
- package/dist/cjs/classedComponents.js +4 -1
- package/dist/cjs/classedComponents.js.map +1 -1
- package/dist/cjs/components/LoadingIndicator.js +12 -8
- package/dist/cjs/components/LoadingIndicator.js.map +1 -1
- package/dist/cjs/components/OverflowList.js +10 -6
- package/dist/cjs/components/OverflowList.js.map +1 -1
- package/dist/cjs/components/ShuttleBreadcrumb.js +17 -13
- package/dist/cjs/components/ShuttleBreadcrumb.js.map +1 -1
- package/dist/cjs/components/ShuttleInfiniteScrollIndicator.js +12 -8
- package/dist/cjs/components/ShuttleInfiniteScrollIndicator.js.map +1 -1
- package/dist/cjs/components/ShuttleListItem/ActionButtons.js +11 -8
- package/dist/cjs/components/ShuttleListItem/ActionButtons.js.map +1 -1
- package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js +33 -16
- package/dist/cjs/components/ShuttleListItem/ShuttleListItem.js.map +1 -1
- package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js +11 -9
- package/dist/cjs/components/ShuttleListItem/ShuttleSourceListItem.js.map +1 -1
- package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js +11 -9
- package/dist/cjs/components/ShuttleListItem/ShuttleTargetListItem.js.map +1 -1
- package/dist/cjs/components/ShuttleListPanel.js +14 -10
- package/dist/cjs/components/ShuttleListPanel.js.map +2 -2
- package/dist/cjs/components/ShuttleSearchBox.js +18 -13
- package/dist/cjs/components/ShuttleSearchBox.js.map +1 -1
- package/dist/cjs/components/ShuttleSource.js +98 -59
- package/dist/cjs/components/ShuttleSource.js.map +2 -2
- package/dist/cjs/components/ShuttleTarget.js +60 -33
- package/dist/cjs/components/ShuttleTarget.js.map +1 -1
- package/dist/cjs/components/VirtualizedItem.js +20 -14
- package/dist/cjs/components/VirtualizedItem.js.map +1 -1
- package/dist/cjs/components/VirtualizedList.js +28 -20
- package/dist/cjs/components/VirtualizedList.js.map +2 -2
- package/dist/cjs/components/VirtualizedSortableList.js +9 -5
- package/dist/cjs/components/VirtualizedSortableList.js.map +1 -1
- package/dist/cjs/helper.js +18 -7
- package/dist/cjs/helper.js.map +2 -2
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/tests/utils.js +7 -2
- package/dist/cjs/tests/utils.js.map +1 -1
- package/dist/cjs/updateShuttleStateFromProps.js +13 -4
- package/dist/cjs/updateShuttleStateFromProps.js.map +1 -1
- package/dist/cjs/utils.js +4 -1
- package/dist/cjs/utils.js.map +1 -1
- package/dist/cjs/withProviders.js +14 -5
- package/dist/cjs/withProviders.js.map +1 -1
- package/dist/esm/AnimationState.js +32 -20
- package/dist/esm/AnimationState.js.map +1 -1
- package/dist/esm/DSShuttle.js +67 -53
- package/dist/esm/DSShuttle.js.map +1 -1
- package/dist/esm/SearchState.js.map +1 -1
- package/dist/esm/Shuttle.actions.js +13 -4
- package/dist/esm/Shuttle.actions.js.map +1 -1
- package/dist/esm/ShuttleContainer.js +21 -4
- package/dist/esm/ShuttleContainer.js.map +2 -2
- package/dist/esm/ShuttleImpl.js +57 -14
- package/dist/esm/ShuttleImpl.js.map +1 -1
- package/dist/esm/ShuttleRenderer.js +77 -64
- package/dist/esm/ShuttleRenderer.js.map +1 -1
- package/dist/esm/ShuttleState.js +6 -2
- package/dist/esm/ShuttleState.js.map +1 -1
- package/dist/esm/animation/animationConfig.js.map +1 -1
- package/dist/esm/classedComponents.js.map +1 -1
- package/dist/esm/components/LoadingIndicator.js +8 -7
- package/dist/esm/components/LoadingIndicator.js.map +1 -1
- package/dist/esm/components/OverflowList.js +6 -5
- package/dist/esm/components/OverflowList.js.map +1 -1
- package/dist/esm/components/ShuttleBreadcrumb.js +13 -12
- package/dist/esm/components/ShuttleBreadcrumb.js.map +1 -1
- package/dist/esm/components/ShuttleInfiniteScrollIndicator.js +8 -7
- package/dist/esm/components/ShuttleInfiniteScrollIndicator.js.map +1 -1
- package/dist/esm/components/ShuttleListItem/ActionButtons.js +7 -7
- package/dist/esm/components/ShuttleListItem/ActionButtons.js.map +1 -1
- package/dist/esm/components/ShuttleListItem/ShuttleListItem.js +29 -15
- package/dist/esm/components/ShuttleListItem/ShuttleListItem.js.map +1 -1
- package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js +7 -8
- package/dist/esm/components/ShuttleListItem/ShuttleSourceListItem.js.map +1 -1
- package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js +7 -8
- package/dist/esm/components/ShuttleListItem/ShuttleTargetListItem.js.map +1 -1
- package/dist/esm/components/ShuttleListPanel.js +10 -9
- package/dist/esm/components/ShuttleListPanel.js.map +1 -1
- package/dist/esm/components/ShuttleSearchBox.js +14 -12
- package/dist/esm/components/ShuttleSearchBox.js.map +1 -1
- package/dist/esm/components/ShuttleSource.js +94 -58
- package/dist/esm/components/ShuttleSource.js.map +1 -1
- package/dist/esm/components/ShuttleTarget.js +56 -32
- package/dist/esm/components/ShuttleTarget.js.map +1 -1
- package/dist/esm/components/VirtualizedItem.js +16 -13
- package/dist/esm/components/VirtualizedItem.js.map +1 -1
- package/dist/esm/components/VirtualizedList.js +24 -19
- package/dist/esm/components/VirtualizedList.js.map +1 -1
- package/dist/esm/components/VirtualizedSortableList.js +5 -4
- package/dist/esm/components/VirtualizedSortableList.js.map +1 -1
- package/dist/esm/helper.js +14 -6
- package/dist/esm/helper.js.map +2 -2
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/tests/utils.js +3 -1
- package/dist/esm/tests/utils.js.map +1 -1
- package/dist/esm/updateShuttleStateFromProps.js +9 -3
- package/dist/esm/updateShuttleStateFromProps.js.map +1 -1
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/withProviders.js +10 -4
- package/dist/esm/withProviders.js.map +1 -1
- package/package.json +11 -11
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useContext, useMemo } from "react";
|
|
3
4
|
import PropTypes from "prop-types";
|
|
4
5
|
import { ArrowShortRight, Search } from "@elliemae/ds-icons";
|
|
5
6
|
import { DSButton } from "@elliemae/ds-button";
|
|
@@ -63,7 +64,10 @@ function ShuttleSource({
|
|
|
63
64
|
reset: resetSearch,
|
|
64
65
|
toggleSearchBox
|
|
65
66
|
} = useContext(SearchState.Context);
|
|
66
|
-
const hashedCheckedItems = useMemo(
|
|
67
|
+
const hashedCheckedItems = useMemo(
|
|
68
|
+
() => checkedItems.reduce((result, item) => ({ ...result, [item]: true }), {}),
|
|
69
|
+
[checkedItems]
|
|
70
|
+
);
|
|
67
71
|
const handleCloseSearch = useCallback(() => {
|
|
68
72
|
setSearchTerm("");
|
|
69
73
|
runAll(resetSearch, onSearchClose)();
|
|
@@ -86,62 +90,94 @@ function ShuttleSource({
|
|
|
86
90
|
const isEmpty = !items.length;
|
|
87
91
|
const hasContent = !loading && !isEmpty;
|
|
88
92
|
const contentIsEmpty = !loading && isEmpty;
|
|
89
|
-
return /* @__PURE__ */
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
93
|
+
return /* @__PURE__ */ jsxs(ShuttleWrapper, {
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ jsxs(ShuttleHeader, {
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ jsx(ShuttleHeaderBreadcrumb, {
|
|
98
|
+
hierarchy,
|
|
99
|
+
onNavigateTo
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ jsx(ShuttleHeaderSearchToggle, {
|
|
102
|
+
buttonType: "text",
|
|
103
|
+
icon: /* @__PURE__ */ jsx(Search, {}),
|
|
104
|
+
onClick: handleToggleSearch,
|
|
105
|
+
containerProps: { "data-testid": "shuttle-header-search-toggle" }
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ jsxs(ShuttleList, {
|
|
110
|
+
classProps: { showPulse: isMovingBack },
|
|
111
|
+
style: { pointerEvents: isMoving ? "none" : null },
|
|
112
|
+
children: [
|
|
113
|
+
/* @__PURE__ */ jsx(ShuttleSearchBox, {
|
|
114
|
+
isOpen: searching,
|
|
115
|
+
onClose: runAll(() => toggleSearchBox(false), handleCloseSearch),
|
|
116
|
+
onFilter: runAll(setSearchTerm, onSearch),
|
|
117
|
+
placeholder: searchPlaceholder,
|
|
118
|
+
value: searchTerm
|
|
119
|
+
}, searching),
|
|
120
|
+
hasContent ? /* @__PURE__ */ jsx(Overflow, {
|
|
121
|
+
activeHierarchy: getActiveIdFromHierarchy(hierarchy).id,
|
|
122
|
+
classProps: {
|
|
123
|
+
searching,
|
|
124
|
+
empty: isEmpty
|
|
125
|
+
},
|
|
126
|
+
children: /* @__PURE__ */ jsx(ComponentList, {
|
|
127
|
+
helperClass: "drag-helper",
|
|
128
|
+
itemRenderer: ({ item, ...rest }) => /* @__PURE__ */ jsx(ShuttleSourceListItem, {
|
|
129
|
+
"data-testid": "source-list-item",
|
|
130
|
+
...rest,
|
|
131
|
+
...composeSourceItemProps(item, rest),
|
|
132
|
+
isChecked: !!hashedCheckedItems[item.id],
|
|
133
|
+
item,
|
|
134
|
+
onItemCheck: onCheckItem,
|
|
135
|
+
onMoveToTarget: onMoveItem,
|
|
136
|
+
onNavigateOnSourceTo: onNavigateTo,
|
|
137
|
+
showSortHandler: sourceSortable
|
|
138
|
+
}),
|
|
139
|
+
items,
|
|
140
|
+
onSortEnd: handleSortEnd,
|
|
141
|
+
getMoreItems: onGetMoreItems,
|
|
142
|
+
hasNextPage
|
|
143
|
+
}, searchTerm)
|
|
144
|
+
}) : null,
|
|
145
|
+
contentIsEmpty ? /* @__PURE__ */ jsx(LoadingList, {
|
|
146
|
+
"data-testid": "shuttle__loading-list",
|
|
147
|
+
children: /* @__PURE__ */ jsx(EmptyMessage, {
|
|
148
|
+
children: emptyMessage
|
|
149
|
+
})
|
|
150
|
+
}) : null,
|
|
151
|
+
loading ? /* @__PURE__ */ jsx(LoadingList, {
|
|
152
|
+
"data-testid": "shuttle__loading-list",
|
|
153
|
+
children: /* @__PURE__ */ jsx(LoadingIndicator, {})
|
|
154
|
+
}) : null,
|
|
155
|
+
/* @__PURE__ */ jsx(ShuttleListPanel, {
|
|
156
|
+
onClick: onMoveCheckedItems,
|
|
157
|
+
open: checkedItems.length > 1,
|
|
158
|
+
children: /* @__PURE__ */ jsx(ArrowShortRight, {})
|
|
159
|
+
}),
|
|
160
|
+
moreItemsLoading ? /* @__PURE__ */ jsx(ShuttleInfiniteScrollIndicator, {
|
|
161
|
+
isOpen: true
|
|
162
|
+
}) : null
|
|
163
|
+
]
|
|
164
|
+
}),
|
|
165
|
+
/* @__PURE__ */ jsxs(ShuttleFooter, {
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ jsx(ShuttleFooterActions, {
|
|
168
|
+
children: !!checkedItems.length && /* @__PURE__ */ jsx(DSButton, {
|
|
169
|
+
buttonType: "link",
|
|
170
|
+
labelText: sourceClearItemsText,
|
|
171
|
+
onClick: onClearCheckedItems
|
|
172
|
+
})
|
|
173
|
+
}),
|
|
174
|
+
/* @__PURE__ */ jsx(ShuttleFooterCounter, {
|
|
175
|
+
children: renderSourceCounter(checkedItems.length)
|
|
176
|
+
})
|
|
177
|
+
]
|
|
178
|
+
})
|
|
179
|
+
]
|
|
180
|
+
});
|
|
145
181
|
}
|
|
146
182
|
ShuttleSource.propTypes = {
|
|
147
183
|
items: PropTypes.arrayOf(PropTypes.shape({})),
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/ShuttleSource.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable no-shadow */\nimport React, { useCallback, useContext, useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport { ArrowShortRight, Search } from '@elliemae/ds-icons';\nimport { DSButton } from '@elliemae/ds-button';\nimport { runAll } from '@elliemae/ds-utilities';\nimport { ShuttleSearchBox } from './ShuttleSearchBox';\nimport { ShuttleInfiniteScrollIndicator } from './ShuttleInfiniteScrollIndicator';\nimport { ShuttleSourceListItem } from './ShuttleListItem/ShuttleSourceListItem';\nimport {\n ShuttleFooterCounter,\n Overflow,\n ShuttleFooter,\n ShuttleHeader,\n ShuttleHeaderBreadcrumb,\n ShuttleHeaderSearchToggle,\n ShuttleList,\n ShuttleWrapper,\n ShuttleFooterActions,\n EmptyMessage,\n LoadingList,\n} from '../classedComponents';\nimport { ShuttleListPanel } from './ShuttleListPanel';\nimport { VirtualizedList } from './VirtualizedList';\nimport { getActiveIdFromHierarchy } from '../helper';\nimport { AnimationState } from '../AnimationState';\nimport { SearchState } from '../SearchState';\nimport { VirtualizedSortableList } from './VirtualizedSortableList';\nimport { LoadingIndicator } from './LoadingIndicator';\n\nconst noop = () => {};\n\nfunction ShuttleSource({\n items = [],\n checkedItems = [], // build Map() and memoize it for better performance\n hierarchy = [],\n onMoveItem = noop,\n onCheckItem = noop,\n onMoveCheckedItems = noop,\n onNavigateTo = noop,\n onClearCheckedItems = noop,\n emptyMessage = 'No items found',\n composeSourceItemProps = noop,\n loading = false,\n onSearch = noop,\n onSearchClose = noop,\n onSearchOpen = noop,\n sourceSortable = false,\n onSortEnd = noop,\n sourceClearItemsText = 'CLEAR ALL',\n searchPlaceholder,\n renderSourceCounter = (amount) => `${amount} items`,\n onGetMoreItems = () => {},\n moreItemsLoading = false,\n hasNextPage = false,\n}) {\n const {\n state: { isMovingBack = false, isMoving },\n } = useContext(AnimationState.Context);\n const {\n state: { searching, searchTerm },\n setSearchTerm,\n reset: resetSearch,\n toggleSearchBox,\n } = useContext(SearchState.Context);\n\n const hashedCheckedItems = useMemo(\n () => checkedItems.reduce((result, item) => ({ ...result, [item]: true }), {}),\n [checkedItems],\n );\n\n const handleCloseSearch = useCallback(() => {\n setSearchTerm('');\n runAll(resetSearch, onSearchClose)();\n }, [searching]);\n\n const handleToggleSearch = useCallback(() => {\n toggleSearchBox(!searching);\n if (searching) {\n handleCloseSearch();\n } else {\n onSearchOpen();\n }\n }, [searching]);\n\n const ComponentList = useMemo(() => (sourceSortable ? VirtualizedSortableList : VirtualizedList), [sourceSortable]);\n\n const handleSortEnd = ({ oldIndex, newIndex }) => {\n onSortEnd({\n sourceItem: items[oldIndex],\n targetItem: items[newIndex],\n });\n };\n\n const isEmpty = !items.length;\n const hasContent = !loading && !isEmpty;\n const contentIsEmpty = !loading && isEmpty;\n\n return (\n <ShuttleWrapper>\n <ShuttleHeader>\n <ShuttleHeaderBreadcrumb hierarchy={hierarchy} onNavigateTo={onNavigateTo} />\n <ShuttleHeaderSearchToggle\n buttonType=\"text\"\n icon={<Search />}\n onClick={handleToggleSearch}\n containerProps={{ 'data-testid': 'shuttle-header-search-toggle' }}\n />\n </ShuttleHeader>\n <ShuttleList classProps={{ showPulse: isMovingBack }} style={{ pointerEvents: isMoving ? 'none' : null }}>\n <ShuttleSearchBox\n key={searching}\n isOpen={searching}\n onClose={runAll(() => toggleSearchBox(false), handleCloseSearch)}\n onFilter={runAll(setSearchTerm, onSearch)}\n placeholder={searchPlaceholder}\n value={searchTerm}\n />\n {hasContent ? (\n <Overflow\n activeHierarchy={getActiveIdFromHierarchy(hierarchy).id}\n classProps={{\n searching,\n empty: isEmpty,\n }}\n >\n <ComponentList\n key={searchTerm}\n helperClass=\"drag-helper\"\n itemRenderer={({ item, ...rest }) => (\n <ShuttleSourceListItem\n data-testid=\"source-list-item\"\n {...rest}\n {...composeSourceItemProps(item, rest)}\n isChecked={!!hashedCheckedItems[item.id]}\n item={item}\n onItemCheck={onCheckItem}\n onMoveToTarget={onMoveItem}\n onNavigateOnSourceTo={onNavigateTo}\n showSortHandler={sourceSortable}\n />\n )}\n items={items}\n onSortEnd={handleSortEnd}\n getMoreItems={onGetMoreItems}\n hasNextPage={hasNextPage}\n />\n </Overflow>\n ) : null}\n {contentIsEmpty ? (\n <LoadingList data-testid=\"shuttle__loading-list\">\n <EmptyMessage>{emptyMessage}</EmptyMessage>\n </LoadingList>\n ) : null}\n {loading ? (\n <LoadingList data-testid=\"shuttle__loading-list\">\n <LoadingIndicator />\n </LoadingList>\n ) : null}\n <ShuttleListPanel onClick={onMoveCheckedItems} open={checkedItems.length > 1}>\n <ArrowShortRight />\n </ShuttleListPanel>\n {moreItemsLoading ? <ShuttleInfiniteScrollIndicator isOpen /> : null}\n </ShuttleList>\n <ShuttleFooter>\n <ShuttleFooterActions>\n {!!checkedItems.length && (\n <DSButton buttonType=\"link\" labelText={sourceClearItemsText} onClick={onClearCheckedItems} />\n )}\n </ShuttleFooterActions>\n <ShuttleFooterCounter>{renderSourceCounter(checkedItems.length)}</ShuttleFooterCounter>\n </ShuttleFooter>\n </ShuttleWrapper>\n );\n}\n\nShuttleSource.propTypes = {\n items: PropTypes.arrayOf(PropTypes.shape({})),\n checkedItems: PropTypes.arrayOf(PropTypes.shape({})),\n hierarchy: PropTypes.arrayOf(PropTypes.shape({})),\n onMoveItem: PropTypes.func,\n onCheckItem: PropTypes.func,\n onMoveCheckedItems: PropTypes.func,\n onNavigateTo: PropTypes.func,\n onClearCheckedItems: PropTypes.func,\n emptyMessage: PropTypes.string,\n composeSourceItemProps: PropTypes.func,\n loading: PropTypes.bool,\n onSearch: PropTypes.func,\n onSearchClose: PropTypes.func,\n onSearchOpen: PropTypes.func,\n sourceSortable: PropTypes.bool,\n onSortEnd: PropTypes.func,\n sourceClearItemsText: PropTypes.string,\n searchPlaceholder: PropTypes.string,\n renderSourceCounter: PropTypes.func,\n onGetMoreItems: PropTypes.func,\n moreItemsLoading: PropTypes.bool,\n hasNextPage: PropTypes.bool,\n};\n\nexport { ShuttleSource };\nexport default ShuttleSource;\n"],
|
|
5
|
-
"mappings": "AAAA;
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAEA,SAAgB,aAAa,YAAY,eA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AO,UAAU,QAAQ,UAAU,MAAM,CAAC,CAAC,CAAC;AAAA,EAC5C,cAAc,UAAU,QAAQ,UAAU,MAAM,CAAC,CAAC,CAAC;AAAA,EACnD,WAAW,UAAU,QAAQ,UAAU,MAAM,CAAC,CAAC,CAAC;AAAA,EAChD,YAAY,UAAU;AAAA,EACtB,aAAa,UAAU;AAAA,EACvB,oBAAoB,UAAU;AAAA,EAC9B,cAAc,UAAU;AAAA,EACxB,qBAAqB,UAAU;AAAA,EAC/B,cAAc,UAAU;AAAA,EACxB,wBAAwB,UAAU;AAAA,EAClC,SAAS,UAAU;AAAA,EACnB,UAAU,UAAU;AAAA,EACpB,eAAe,UAAU;AAAA,EACzB,cAAc,UAAU;AAAA,EACxB,gBAAgB,UAAU;AAAA,EAC1B,WAAW,UAAU;AAAA,EACrB,sBAAsB,UAAU;AAAA,EAChC,mBAAmB,UAAU;AAAA,EAC7B,qBAAqB,UAAU;AAAA,EAC/B,gBAAgB,UAAU;AAAA,EAC1B,kBAAkB,UAAU;AAAA,EAC5B,aAAa,UAAU;AACzB;AAGA,IAAO,wBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useContext } from "react";
|
|
3
4
|
import { DSButton } from "@elliemae/ds-button";
|
|
4
5
|
import {
|
|
5
6
|
EmptyMessage,
|
|
@@ -39,7 +40,9 @@ function ShuttleTarget({
|
|
|
39
40
|
state: { isMoving = false }
|
|
40
41
|
} = useContext(AnimationState.Context);
|
|
41
42
|
const isEmpty = !items.length;
|
|
42
|
-
const emptyContent = loading ? /* @__PURE__ */
|
|
43
|
+
const emptyContent = loading ? /* @__PURE__ */ jsx(LoadingIndicator, {}) : /* @__PURE__ */ jsx(EmptyMessage, {
|
|
44
|
+
children: emptyMessage
|
|
45
|
+
});
|
|
43
46
|
const ComponentList = targetSortable ? VirtualizedSortableList : VirtualizedList;
|
|
44
47
|
const handleSortEnd = ({ oldIndex, newIndex }) => {
|
|
45
48
|
onSortEnd({
|
|
@@ -47,36 +50,57 @@ function ShuttleTarget({
|
|
|
47
50
|
targetItem: items[newIndex]
|
|
48
51
|
});
|
|
49
52
|
};
|
|
50
|
-
return /* @__PURE__ */
|
|
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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
53
|
+
return /* @__PURE__ */ jsxs(ShuttleWrapper, {
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsx(ShuttleHeader, {
|
|
56
|
+
children: /* @__PURE__ */ jsx(ShuttleHeaderBreadcrumb, {
|
|
57
|
+
hierarchy,
|
|
58
|
+
onNavigateTo
|
|
59
|
+
})
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ jsx(ShuttleList, {
|
|
62
|
+
classProps: { showPulse: isMoving },
|
|
63
|
+
children: !loading && !isEmpty ? /* @__PURE__ */ jsx(Overflow, {
|
|
64
|
+
activeHierarchy: getActiveIdFromHierarchy(hierarchy).id,
|
|
65
|
+
classProps: {
|
|
66
|
+
empty: !items.length
|
|
67
|
+
},
|
|
68
|
+
children: /* @__PURE__ */ jsx(ComponentList, {
|
|
69
|
+
itemRenderer: ({ item, ...rest }) => /* @__PURE__ */ jsx(ShuttleTargetListItem, {
|
|
70
|
+
"data-testid": "target-list-item",
|
|
71
|
+
...rest,
|
|
72
|
+
...composeTargetItemProps(item, rest),
|
|
73
|
+
isRoot: !getActiveIdFromHierarchy(hierarchy).id,
|
|
74
|
+
item,
|
|
75
|
+
onMoveToSource: onMoveItem,
|
|
76
|
+
onNavigateOnTargetTo: onNavigateTo,
|
|
77
|
+
showSortHandler: targetSortable
|
|
78
|
+
}),
|
|
79
|
+
items,
|
|
80
|
+
onSortEnd: handleSortEnd,
|
|
81
|
+
target: true
|
|
82
|
+
})
|
|
83
|
+
}) : /* @__PURE__ */ jsx(LoadingList, {
|
|
84
|
+
children: emptyContent
|
|
85
|
+
})
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ jsxs(ShuttleFooter, {
|
|
88
|
+
children: [
|
|
89
|
+
/* @__PURE__ */ jsx(ShuttleFooterActions, {
|
|
90
|
+
children: !!items.length && /* @__PURE__ */ jsx(DSButton, {
|
|
91
|
+
containerProps: { "data-testid": "shuttle-clear-all-target" },
|
|
92
|
+
buttonType: "link",
|
|
93
|
+
labelText: targetClearItemsText,
|
|
94
|
+
onClick: onClearMovedItems
|
|
95
|
+
})
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ jsx(ShuttleFooterCounter, {
|
|
98
|
+
children: renderTargetCounter(items.length)
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
})
|
|
102
|
+
]
|
|
103
|
+
});
|
|
80
104
|
}
|
|
81
105
|
var ShuttleTarget_default = ShuttleTarget;
|
|
82
106
|
export {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/ShuttleTarget.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { DSButton } from '@elliemae/ds-button';\n\nimport {\n EmptyMessage,\n Overflow,\n ShuttleFooter,\n ShuttleFooterActions,\n ShuttleFooterCounter,\n ShuttleHeader,\n ShuttleHeaderBreadcrumb,\n ShuttleList,\n ShuttleWrapper,\n LoadingList,\n} from '../classedComponents';\nimport { getActiveIdFromHierarchy } from '../helper';\nimport { AnimationState } from '../AnimationState';\nimport { VirtualizedList } from './VirtualizedList';\nimport { ShuttleTargetListItem } from './ShuttleListItem/ShuttleTargetListItem';\nimport { VirtualizedSortableList } from './VirtualizedSortableList';\nimport { LoadingIndicator } from './LoadingIndicator';\n\nconst noop = () => {};\n\nfunction ShuttleTarget({\n items = [],\n hierarchy = [],\n onNavigateTo = noop,\n onMoveItem = noop,\n onClearMovedItems = noop,\n emptyMessage = 'No items selected',\n composeTargetItemProps = () => ({}),\n targetSortable = false,\n onSortEnd = noop,\n targetClearItemsText = 'CLEAR ALL',\n renderTargetCounter = (amount) => `${amount} items`,\n loading = false,\n}) {\n const {\n state: { isMoving = false },\n } = useContext(AnimationState.Context);\n const isEmpty = !items.length;\n const emptyContent = loading ? <LoadingIndicator /> : <EmptyMessage>{emptyMessage}</EmptyMessage>;\n\n const ComponentList = targetSortable ? VirtualizedSortableList : VirtualizedList;\n\n const handleSortEnd = ({ oldIndex, newIndex }) => {\n onSortEnd({\n sourceItem: items[oldIndex],\n targetItem: items[newIndex],\n });\n };\n\n return (\n <ShuttleWrapper>\n <ShuttleHeader>\n <ShuttleHeaderBreadcrumb hierarchy={hierarchy} onNavigateTo={onNavigateTo} />\n </ShuttleHeader>\n <ShuttleList classProps={{ showPulse: isMoving }}>\n {!loading && !isEmpty ? (\n <Overflow\n activeHierarchy={getActiveIdFromHierarchy(hierarchy).id}\n classProps={{\n empty: !items.length,\n }}\n >\n <ComponentList\n itemRenderer={({ item, ...rest }) => (\n <ShuttleTargetListItem\n data-testid=\"target-list-item\"\n {...rest}\n {...composeTargetItemProps(item, rest)}\n isRoot={!getActiveIdFromHierarchy(hierarchy).id}\n item={item}\n onMoveToSource={onMoveItem}\n onNavigateOnTargetTo={onNavigateTo}\n showSortHandler={targetSortable}\n />\n )}\n items={items}\n onSortEnd={handleSortEnd}\n target\n />\n </Overflow>\n ) : (\n <LoadingList>{emptyContent}</LoadingList>\n )}\n </ShuttleList>\n <ShuttleFooter>\n <ShuttleFooterActions>\n {!!items.length && (\n <DSButton\n containerProps={{ 'data-testid': 'shuttle-clear-all-target' }}\n buttonType=\"link\"\n labelText={targetClearItemsText}\n onClick={onClearMovedItems}\n />\n )}\n </ShuttleFooterActions>\n <ShuttleFooterCounter>{renderTargetCounter(items.length)}</ShuttleFooterCounter>\n </ShuttleFooter>\n </ShuttleWrapper>\n );\n}\n\nexport { ShuttleTarget };\nexport default ShuttleTarget;\n"],
|
|
5
|
-
"mappings": "AAAA;
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AAAA,SAAgB,kBAAkB;AAClC,SAAS,gBAAgB;AAEzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gCAAgC;AACzC,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,+BAA+B;AACxC,SAAS,wBAAwB;AAEjC,MAAM,OAAO,MAAM;AAAC;AAEpB,SAAS,cAAc;AAAA,EACrB,QAAQ,CAAC;AAAA,EACT,YAAY,CAAC;AAAA,EACb,eAAe;AAAA,EACf,aAAa;AAAA,EACb,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,yBAAyB,OAAO,CAAC;AAAA,EACjC,iBAAiB;AAAA,EACjB,YAAY;AAAA,EACZ,uBAAuB;AAAA,EACvB,sBAAsB,CAAC,WAAW,GAAG;AAAA,EACrC,UAAU;AACZ,GAAG;AACD,QAAM;AAAA,IACJ,OAAO,EAAE,WAAW,MAAM;AAAA,EAC5B,IAAI,WAAW,eAAe,OAAO;AACrC,QAAM,UAAU,CAAC,MAAM;AACvB,QAAM,eAAe,UAAU,oBAAC,oBAAiB,IAAK,oBAAC;AAAA,IAAc;AAAA,GAAa;AAElF,QAAM,gBAAgB,iBAAiB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1,22 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { memo } from "react";
|
|
3
3
|
import { areEqual } from "react-window";
|
|
4
|
-
const VirtualizedItem = memo(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
4
|
+
const VirtualizedItem = memo(
|
|
5
|
+
({ data, index, style: virtualizedStyles, showSortHandler = false }) => {
|
|
6
|
+
const { items, itemRenderer, isItemMoving } = data;
|
|
7
|
+
const { item, props: animatedStyles, key } = items[index] || {};
|
|
8
|
+
if (!item)
|
|
9
|
+
return null;
|
|
10
|
+
return itemRenderer({
|
|
11
|
+
index,
|
|
12
|
+
key,
|
|
13
|
+
item,
|
|
14
|
+
showSortHandler,
|
|
15
|
+
style: isItemMoving ? { ...animatedStyles, ...virtualizedStyles } : virtualizedStyles
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
areEqual
|
|
19
|
+
);
|
|
17
20
|
var VirtualizedItem_default = VirtualizedItem;
|
|
18
21
|
export {
|
|
19
22
|
VirtualizedItem,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/VirtualizedItem.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { memo } from 'react';\nimport { areEqual } from 'react-window';\n\nconst VirtualizedItem = memo(\n ({ data, index, style: virtualizedStyles, showSortHandler = false }) => {\n const { items, itemRenderer, isItemMoving } = data;\n const { item, props: animatedStyles, key } = items[index] || {};\n if (!item) return null;\n return itemRenderer({\n index,\n key,\n item,\n showSortHandler,\n style: isItemMoving\n ? { ...animatedStyles, ...virtualizedStyles }\n : virtualizedStyles,\n });\n },\n areEqual,\n);\n\nexport { VirtualizedItem };\nexport default VirtualizedItem;\n"],
|
|
5
|
-
"mappings": "AAAA;
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,YAAY;AACrB,SAAS,gBAAgB;AAEzB,MAAM,kBAAkB;AAAA,EACtB,CAAC,EAAE,MAAM,OAAO,OAAO,mBAAmB,kBAAkB,MAAM,MAAM;AACtE,UAAM,EAAE,OAAO,cAAc,aAAa,IAAI;AAC9C,UAAM,EAAE,MAAM,OAAO,gBAAgB,IAAI,IAAI,MAAM,UAAU,CAAC;AAC9D,QAAI,CAAC;AAAM,aAAO;AAClB,WAAO,aAAa;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO,eACH,EAAE,GAAG,gBAAgB,GAAG,kBAAkB,IAC1C;AAAA,IACN,CAAC;AAAA,EACH;AAAA,EACA;AACF;AAGA,IAAO,0BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useContext, useEffect, useRef } from "react";
|
|
3
4
|
import { useTransition } from "react-spring/web";
|
|
4
5
|
import { FixedSizeList as List } from "react-window";
|
|
5
6
|
import InfiniteLoader from "react-window-infinite-loader";
|
|
@@ -32,24 +33,28 @@ function VirtualizedList({
|
|
|
32
33
|
});
|
|
33
34
|
const itemCount = hasNextPage ? items.length + 1 : items.length;
|
|
34
35
|
const isItemLoaded = (index) => !hasNextPage || index < items.length;
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
36
|
+
return /* @__PURE__ */ jsx(AutoSizer, {
|
|
37
|
+
children: ({ height, width }) => /* @__PURE__ */ jsx(InfiniteLoader, {
|
|
38
|
+
isItemLoaded,
|
|
39
|
+
itemCount,
|
|
40
|
+
loadMoreItems: getMoreItems,
|
|
41
|
+
children: ({ onItemsRendered, ref }) => /* @__PURE__ */ jsx(List, {
|
|
42
|
+
height: searching ? 300 : height,
|
|
43
|
+
width,
|
|
44
|
+
innerRef,
|
|
45
|
+
itemCount: transitions.length,
|
|
46
|
+
itemData: {
|
|
47
|
+
items: transitions,
|
|
48
|
+
itemRenderer,
|
|
49
|
+
isItemMoving: hasMounted.current && (isMoving || isMovingBack)
|
|
50
|
+
},
|
|
51
|
+
itemSize: 35,
|
|
52
|
+
onItemsRendered,
|
|
53
|
+
ref,
|
|
54
|
+
children: children || VirtualizedItem
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
});
|
|
53
58
|
}
|
|
54
59
|
var VirtualizedList_default = VirtualizedList;
|
|
55
60
|
export {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/VirtualizedList.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React, { useContext, useEffect, useRef } from 'react';\nimport { useTransition } from 'react-spring/web';\nimport { FixedSizeList as List } from 'react-window';\nimport InfiniteLoader from 'react-window-infinite-loader';\nimport AutoSizer from 'react-virtualized-auto-sizer';\nimport { animationConfig } from '../animation/animationConfig';\nimport { AnimationState } from '../AnimationState';\nimport { VirtualizedItem } from './VirtualizedItem';\n\nfunction VirtualizedList({\n items,\n itemRenderer,\n searching,\n target = false,\n innerRef,\n children,\n hasNextPage = true,\n getMoreItems = () => {},\n}) {\n const hasMounted = useRef(false);\n const {\n state: { isMoving, isMovingBack },\n reset,\n } = useContext(AnimationState.Context);\n\n useEffect(() => {\n hasMounted.current = true;\n }, []);\n\n const transitions = useTransition(items, (item) => item.id, {\n ...animationConfig.moveItem(target),\n onDestroyed: () => reset(),\n });\n\n const itemCount = hasNextPage ? items.length + 1 : items.length;\n\n const isItemLoaded = (index) => !hasNextPage || index < items.length;\n\n return (\n <AutoSizer>\n {({ height, width }) => (\n <InfiniteLoader\n isItemLoaded={isItemLoaded}\n itemCount={itemCount}\n loadMoreItems={getMoreItems}\n >\n {({ onItemsRendered, ref }) => (\n <List\n height={searching ? 300 : height}\n width={width}\n innerRef={innerRef}\n itemCount={transitions.length}\n itemData={{\n items: transitions,\n itemRenderer,\n isItemMoving: hasMounted.current && (isMoving || isMovingBack),\n }}\n itemSize={35}\n onItemsRendered={onItemsRendered}\n ref={ref}\n >\n {children || VirtualizedItem}\n </List>\n )}\n </InfiniteLoader>\n )}\n </AutoSizer>\n );\n}\n\nexport { VirtualizedList };\nexport default VirtualizedList;\n"],
|
|
5
|
-
"mappings": "AAAA;
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAgB,YAAY,WAAW,cAAc;AACrD,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB,YAAY;AACtC,OAAO,oBAAoB;AAC3B,OAAO,eAAe;AACtB,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAEhC,SAAS,gBAAgB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,eAAe,MAAM;AAAA,EAAC;AACxB,GAAG;AACD,QAAM,aAAa,OAAO,KAAK;AAC/B,QAAM;AAAA,IACJ,OAAO,EAAE,UAAU,aAAa;AAAA,IAChC;AAAA,EACF,IAAI,WAAW,eAAe,OAAO;AAErC,YAAU,MAAM;AACd,eAAW,UAAU;AAAA,EACvB,GAAG,CAAC,CAAC;AAEL,QAAM,cAAc,cAAc,OAAO,CAAC,SAAS,KAAK,IAAI;AAAA,IAC1D,GAAG,gBAAgB,SAAS,MAAM;AAAA,IAClC,aAAa,MAAM,MAAM;AAAA,EAC3B,CAAC;AAED,QAAM,YAAY,cAAc,MAAM,SAAS,IAAI,MAAM;AAEzD,QAAM,eAAe,CAAC,UAAU,CAAC,eAAe,QAAQ,MAAM;AAE9D,SACE,oBAAC;AAAA,IACE,WAAC,EAAE,QAAQ,MAAM,MAChB,oBAAC;AAAA,MACC;AAAA,MACA;AAAA,MACA,eAAe;AAAA,MAEd,WAAC,EAAE,iBAAiB,IAAI,MACvB,oBAAC;AAAA,QACC,QAAQ,YAAY,MAAM;AAAA,QAC1B;AAAA,QACA;AAAA,QACA,WAAW,YAAY;AAAA,QACvB,UAAU;AAAA,UACR,OAAO;AAAA,UACP;AAAA,UACA,cAAc,WAAW,YAAY,YAAY;AAAA,QACnD;AAAA,QACA,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QAEC,sBAAY;AAAA,OACf;AAAA,KAEJ;AAAA,GAEJ;AAEJ;AAGA,IAAO,0BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { sortableElement, sortableContainer } from "react-sortable-hoc";
|
|
4
4
|
import { VirtualizedList } from "./VirtualizedList";
|
|
5
5
|
import { VirtualizedItem } from "./VirtualizedItem";
|
|
6
6
|
const SortableList = sortableContainer(VirtualizedList);
|
|
7
7
|
function VirtualizedSortableList({ items, ...otherProps }) {
|
|
8
|
-
return /* @__PURE__ */
|
|
8
|
+
return /* @__PURE__ */ jsx(SortableList, {
|
|
9
9
|
...otherProps,
|
|
10
10
|
items,
|
|
11
|
-
useDragHandle: true
|
|
12
|
-
|
|
11
|
+
useDragHandle: true,
|
|
12
|
+
children: sortableElement(VirtualizedItem)
|
|
13
|
+
});
|
|
13
14
|
}
|
|
14
15
|
var VirtualizedSortableList_default = VirtualizedSortableList;
|
|
15
16
|
export {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/components/VirtualizedSortableList.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { sortableElement, sortableContainer } from 'react-sortable-hoc';\nimport { VirtualizedList } from './VirtualizedList';\nimport { VirtualizedItem } from './VirtualizedItem';\n\nconst SortableList = sortableContainer(VirtualizedList);\n\nfunction VirtualizedSortableList({ items, ...otherProps }) {\n return (\n <SortableList {...otherProps} items={items} useDragHandle>\n {sortableElement(VirtualizedItem)}\n </SortableList>\n );\n}\n\nexport { VirtualizedSortableList };\nexport default VirtualizedSortableList;\n"],
|
|
5
|
-
"mappings": "AAAA;
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB;AACA,SAAS,iBAAiB,yBAAyB;AACnD,SAAS,uBAAuB;AAChC,SAAS,uBAAuB;AAEhC,MAAM,eAAe,kBAAkB,eAAe;AAEtD,SAAS,wBAAwB,EAAE,UAAU,WAAW,GAAG;AACzD,SACE,oBAAC;AAAA,IAAc,GAAG;AAAA,IAAY;AAAA,IAAc,eAAa;AAAA,IACtD,0BAAgB,eAAe;AAAA,GAClC;AAEJ;AAGA,IAAO,kCAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/helper.js
CHANGED
|
@@ -5,7 +5,10 @@ const getHierarchyTypeName = (dest) => !dest ? "hierarchy" : "hierarchyDest";
|
|
|
5
5
|
const checkHasChildren = (list, currentItem) => list.some((item) => currentItem.id === item.parent);
|
|
6
6
|
const getActiveIdFromHierarchy = (hierarchy = []) => hierarchy[hierarchy.length - 1] || {};
|
|
7
7
|
const filterItemsByHierarchy = (list, hierarchyId, parentField = "parent") => list.filter((item) => item[parentField] === hierarchyId);
|
|
8
|
-
const getItemsById = (ids, list) => ids.reduce(
|
|
8
|
+
const getItemsById = (ids, list) => ids.reduce(
|
|
9
|
+
(acc, id) => acc.concat(list.find((item) => String(item.id) === String(id))),
|
|
10
|
+
[]
|
|
11
|
+
).filter((item) => item);
|
|
9
12
|
const toggleInObject = (obj, key, value) => obj[key] ? omit(obj, [key]) : { ...obj, [key]: value };
|
|
10
13
|
const isMovable = (item) => !item.forceNotMovable && (item.hasChildren && item.isMoveableContainer || !item.hasChildren);
|
|
11
14
|
const pipe = (actions) => (initState, props) => actions.reduce((prevState, action) => action(prevState, props), initState);
|
|
@@ -15,10 +18,13 @@ const moveItems = ({ oldIndex, newIndex }) => (items) => {
|
|
|
15
18
|
items.splice(newIndex, 0, sourceItem);
|
|
16
19
|
return items;
|
|
17
20
|
};
|
|
18
|
-
const prepareItems = (items) => compose(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
const prepareItems = (items) => compose(
|
|
22
|
+
tree.fixOrder(),
|
|
23
|
+
(items2) => items2.map((item) => ({
|
|
24
|
+
...item,
|
|
25
|
+
hasChildren: checkHasChildren(items2, item)
|
|
26
|
+
}))
|
|
27
|
+
)(items);
|
|
22
28
|
const defaultOptions = {
|
|
23
29
|
parentField: "parent",
|
|
24
30
|
idField: "id",
|
|
@@ -34,7 +40,9 @@ function filterMovedItems(movedItems, options) {
|
|
|
34
40
|
return (items) => items.filter((item) => filterOp(!!movedItemsHash[item[idField]]));
|
|
35
41
|
}
|
|
36
42
|
function filterBySearch(term, searching) {
|
|
37
|
-
return (items) => searching ? items.filter(
|
|
43
|
+
return (items) => searching ? items.filter(
|
|
44
|
+
(item) => item.name.toLowerCase().indexOf(String(term).toLowerCase()) !== -1
|
|
45
|
+
) : items;
|
|
38
46
|
}
|
|
39
47
|
export {
|
|
40
48
|
checkHasChildren,
|
package/dist/esm/helper.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/helper.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable prettier/prettier */\n/* eslint-disable no-shadow,no-plusplus */\nimport { omit, compose, hashArray } from '@elliemae/ds-utilities';\nimport * as tree from 'treetabular';\n\nexport const getHierarchyTypeName = (dest) =>\n !dest ? 'hierarchy' : 'hierarchyDest';\nexport const checkHasChildren = (list, currentItem) =>\n list.some((item) => currentItem.id === item.parent);\nexport const getActiveIdFromHierarchy = (hierarchy = []) =>\n hierarchy[hierarchy.length - 1] || {};\n\nexport const filterItemsByHierarchy = (\n list,\n hierarchyId,\n parentField = 'parent',\n) => list.filter((item) => item[parentField] === hierarchyId);\nexport const getItemsById = (ids, list) =>\n ids\n .reduce(\n (acc, id) =>\n acc.concat(list.find((item) => String(item.id) === String(id))),\n [],\n )\n .filter((item) => item);\nexport const toggleInObject = (obj, key, value) =>\n obj[key] ? omit(obj, [key]) : { ...obj, [key]: value };\nexport const isMovable = (item) =>\n !item.forceNotMovable &&\n ((item.hasChildren && item.isMoveableContainer) || !item.hasChildren);\n// utility to execute all specified actions in sequence\nexport const pipe = (actions) => (initState, props) =>\n actions.reduce((prevState, action) => action(prevState, props), initState);\n\nexport const moveItems = ({ oldIndex, newIndex }) => (items) => {\n const sourceItem = items[oldIndex];\n items.splice(oldIndex, 1);\n items.splice(newIndex, 0, sourceItem);\n return items;\n};\n\nexport const prepareItems = (items) =>\n compose(tree.fixOrder(), (items) =>\n items.map((item) => ({\n ...item,\n hasChildren: checkHasChildren(items, item),\n })),\n )(items);\n\nconst defaultOptions = {\n parentField: 'parent',\n idField: 'id',\n op: (hasMoved) => !hasMoved,\n};\n\nexport function getChildrenFromParent(parentId, options) {\n const { parentField } = { ...defaultOptions, ...options };\n return (items) => items.filter((item) => item[parentField] === parentId);\n}\n\nexport function filterMovedItems(movedItems, options) {\n const { idField, op: filterOp } = { ...defaultOptions, ...options };\n const movedItemsHash = hashArray(movedItems, idField);\n return (items) =>\n items.filter((item) => filterOp(!!movedItemsHash[item[idField]]));\n}\n\nexport function filterBySearch(term, searching) {\n return (items) =>\n searching\n ? items.filter(\n (item) =>\n item.name.toLowerCase().indexOf(String(term).toLowerCase()) !== -1,\n )\n : items;\n}\n"],
|
|
5
|
-
"mappings": "AAAA;
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,MAAM,SAAS,iBAAiB;AACzC,YAAY,UAAU;AAEf,MAAM,uBAAuB,CAAC,SACnC,CAAC,OAAO,cAAc;AACjB,MAAM,mBAAmB,CAAC,MAAM,gBACrC,KAAK,KAAK,CAAC,SAAS,YAAY,OAAO,KAAK,MAAM;AAC7C,MAAM,2BAA2B,CAAC,YAAY,CAAC,MACpD,UAAU,UAAU,SAAS,MAAM,CAAC;AAE/B,MAAM,yBAAyB,CACpC,MACA,aACA,cAAc,aACX,KAAK,OAAO,CAAC,SAAS,KAAK,iBAAiB,WAAW;AACrD,MAAM,eAAe,CAAC,KAAK,SAChC,IACG;AAAA,EACC,CAAC,KAAK,OACJ,IAAI,OAAO,KAAK,KAAK,CAAC,SAAS,OAAO,KAAK,EAAE,MAAM,OAAO,EAAE,CAAC,CAAC;AAAA,EAChE,CAAC;AACH,EACC,OAAO,CAAC,SAAS,IAAI;AACnB,MAAM,iBAAiB,CAAC,KAAK,KAAK,UACvC,IAAI,OAAO,KAAK,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,MAAM,MAAM;AAChD,MAAM,YAAY,CAAC,SACxB,CAAC,KAAK,oBACJ,KAAK,eAAe,KAAK,uBAAwB,CAAC,KAAK;AAEpD,MAAM,OAAO,CAAC,YAAY,CAAC,WAAW,UAC3C,QAAQ,OAAO,CAAC,WAAW,WAAW,OAAO,WAAW,KAAK,GAAG,SAAS;AAEpE,MAAM,YAAY,CAAC,EAAE,UAAU,SAAS,MAAM,CAAC,UAAU;AAC9D,QAAM,aAAa,MAAM;AACzB,QAAM,OAAO,UAAU,CAAC;AACxB,QAAM,OAAO,UAAU,GAAG,UAAU;AACpC,SAAO;AACT;AAEO,MAAM,eAAe,CAAC,UAC3B;AAAA,EAAQ,KAAK,SAAS;AAAA,EAAG,CAACA,WACxBA,OAAM,IAAI,CAAC,UAAU;AAAA,IACnB,GAAG;AAAA,IACH,aAAa,iBAAiBA,QAAO,IAAI;AAAA,EAC3C,EAAE;AACJ,EAAE,KAAK;AAET,MAAM,iBAAiB;AAAA,EACrB,aAAa;AAAA,EACb,SAAS;AAAA,EACT,IAAI,CAAC,aAAa,CAAC;AACrB;AAEO,SAAS,sBAAsB,UAAU,SAAS;AACvD,QAAM,EAAE,YAAY,IAAI,EAAE,GAAG,gBAAgB,GAAG,QAAQ;AACxD,SAAO,CAAC,UAAU,MAAM,OAAO,CAAC,SAAS,KAAK,iBAAiB,QAAQ;AACzE;AAEO,SAAS,iBAAiB,YAAY,SAAS;AACpD,QAAM,EAAE,SAAS,IAAI,SAAS,IAAI,EAAE,GAAG,gBAAgB,GAAG,QAAQ;AAClE,QAAM,iBAAiB,UAAU,YAAY,OAAO;AACpD,SAAO,CAAC,UACN,MAAM,OAAO,CAAC,SAAS,SAAS,CAAC,CAAC,eAAe,KAAK,SAAS,CAAC;AACpE;AAEO,SAAS,eAAe,MAAM,WAAW;AAC9C,SAAO,CAAC,UACN,YACI,MAAM;AAAA,IACJ,CAAC,SACC,KAAK,KAAK,YAAY,EAAE,QAAQ,OAAO,IAAI,EAAE,YAAY,CAAC,MAAM;AAAA,EACpE,IACA;AACR;",
|
|
6
|
+
"names": ["items"]
|
|
7
7
|
}
|
package/dist/esm/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { default, utils, DSShuttleWithSchema, DSShuttle } from './DSShuttle';\n"],
|
|
5
|
-
"mappings": "AAAA;
|
|
6
|
-
"names": []
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,WAAAA,UAAS,OAAO,qBAAqB,iBAAiB;",
|
|
6
|
+
"names": ["default"]
|
|
7
7
|
}
|
package/dist/esm/tests/utils.js
CHANGED
|
@@ -1178,7 +1178,9 @@ const newLoadedOptions = [
|
|
|
1178
1178
|
userId: "venkat"
|
|
1179
1179
|
}
|
|
1180
1180
|
];
|
|
1181
|
-
const options2 = options.map(
|
|
1181
|
+
const options2 = options.map(
|
|
1182
|
+
(op, i) => i < 2 ? { ...op, parent: "admin" } : op
|
|
1183
|
+
);
|
|
1182
1184
|
export {
|
|
1183
1185
|
eventsOptions,
|
|
1184
1186
|
newLoadedOptions,
|