@mui/x-tree-view-pro 8.0.0-beta.2 → 8.0.0
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/CHANGELOG.md +423 -96
- package/RichTreeViewPro/RichTreeViewPro.js +12 -8
- package/RichTreeViewPro/RichTreeViewPro.plugins.d.ts +3 -5
- package/RichTreeViewPro/RichTreeViewPro.plugins.js +1 -1
- package/RichTreeViewPro/RichTreeViewPro.types.d.ts +4 -4
- package/esm/RichTreeViewPro/RichTreeViewPro.js +11 -7
- package/esm/RichTreeViewPro/RichTreeViewPro.plugins.d.ts +3 -5
- package/esm/RichTreeViewPro/RichTreeViewPro.plugins.js +2 -2
- package/esm/RichTreeViewPro/RichTreeViewPro.types.d.ts +4 -4
- package/esm/index.js +1 -1
- package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.js +1 -1
- package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.js +17 -11
- package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.d.ts +30 -2
- package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.js +2 -2
- package/index.js +1 -1
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.js +1 -1
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.js +16 -10
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.d.ts +30 -2
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.js +1 -1
- package/package.json +9 -17
- package/esm/internals/utils/releaseInfo.d.ts +0 -1
- package/esm/internals/utils/releaseInfo.js +0 -13
- package/internals/utils/releaseInfo.d.ts +0 -1
- package/internals/utils/releaseInfo.js +0 -21
- package/modern/RichTreeViewPro/RichTreeViewPro.d.ts +0 -20
- package/modern/RichTreeViewPro/RichTreeViewPro.js +0 -351
- package/modern/RichTreeViewPro/RichTreeViewPro.plugins.d.ts +0 -7
- package/modern/RichTreeViewPro/RichTreeViewPro.plugins.js +0 -6
- package/modern/RichTreeViewPro/RichTreeViewPro.types.d.ts +0 -51
- package/modern/RichTreeViewPro/RichTreeViewPro.types.js +0 -1
- package/modern/RichTreeViewPro/index.d.ts +0 -3
- package/modern/RichTreeViewPro/index.js +0 -3
- package/modern/RichTreeViewPro/richTreeViewProClasses.d.ts +0 -5
- package/modern/RichTreeViewPro/richTreeViewProClasses.js +0 -6
- package/modern/index.d.ts +0 -12
- package/modern/index.js +0 -22
- package/modern/internals/index.d.ts +0 -1
- package/modern/internals/index.js +0 -1
- package/modern/internals/plugins/useTreeViewItemsReordering/index.d.ts +0 -2
- package/modern/internals/plugins/useTreeViewItemsReordering/index.js +0 -1
- package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.d.ts +0 -3
- package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.d.ts +0 -3
- package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.js +0 -126
- package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.js +0 -203
- package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.d.ts +0 -417
- package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.js +0 -50
- package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.d.ts +0 -127
- package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.js +0 -1
- package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.utils.d.ts +0 -37
- package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.utils.js +0 -158
- package/modern/internals/plugins/useTreeViewLazyLoading/index.d.ts +0 -1
- package/modern/internals/plugins/useTreeViewLazyLoading/index.js +0 -1
- package/modern/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.d.ts +0 -3
- package/modern/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.js +0 -269
- package/modern/internals/plugins/useTreeViewLazyLoading/utils.d.ts +0 -32
- package/modern/internals/plugins/useTreeViewLazyLoading/utils.js +0 -85
- package/modern/internals/utils/releaseInfo.d.ts +0 -1
- package/modern/internals/utils/releaseInfo.js +0 -13
- package/modern/internals/zero-styled/index.d.ts +0 -3
- package/modern/internals/zero-styled/index.js +0 -7
- package/modern/package.json +0 -1
- package/modern/themeAugmentation/components.d.ts +0 -11
- package/modern/themeAugmentation/index.d.ts +0 -3
- package/modern/themeAugmentation/index.js +0 -0
- package/modern/themeAugmentation/overrides.d.ts +0 -12
- package/modern/themeAugmentation/props.d.ts +0 -10
- package/tsconfig.build.tsbuildinfo +0 -1
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
4
|
-
import { selectorItemIndex, selectorItemMeta, selectorItemOrderedChildrenIds } from '@mui/x-tree-view/internals';
|
|
5
|
-
import { chooseActionToApply, isAncestor, moveItemInTree } from "./useTreeViewItemsReordering.utils.js";
|
|
6
|
-
import { useTreeViewItemsReorderingItemPlugin } from "./useTreeViewItemsReordering.itemPlugin.js";
|
|
7
|
-
import { selectorCurrentItemReordering } from "./useTreeViewItemsReordering.selectors.js";
|
|
8
|
-
export const useTreeViewItemsReordering = ({
|
|
9
|
-
params,
|
|
10
|
-
store
|
|
11
|
-
}) => {
|
|
12
|
-
const canItemBeDragged = React.useCallback(itemId => {
|
|
13
|
-
if (!params.itemsReordering) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
const isItemReorderable = params.isItemReorderable;
|
|
17
|
-
if (isItemReorderable) {
|
|
18
|
-
return isItemReorderable(itemId);
|
|
19
|
-
}
|
|
20
|
-
return true;
|
|
21
|
-
}, [params.itemsReordering, params.isItemReorderable]);
|
|
22
|
-
const getDroppingTargetValidActions = React.useCallback(itemId => {
|
|
23
|
-
const currentReorder = selectorCurrentItemReordering(store.value);
|
|
24
|
-
if (!currentReorder) {
|
|
25
|
-
throw new Error('There is no ongoing reordering.');
|
|
26
|
-
}
|
|
27
|
-
if (itemId === currentReorder.draggedItemId) {
|
|
28
|
-
return {};
|
|
29
|
-
}
|
|
30
|
-
const canMoveItemToNewPosition = params.canMoveItemToNewPosition;
|
|
31
|
-
const targetItemMeta = selectorItemMeta(store.value, itemId);
|
|
32
|
-
const targetItemIndex = selectorItemIndex(store.value, targetItemMeta.id);
|
|
33
|
-
const draggedItemMeta = selectorItemMeta(store.value, currentReorder.draggedItemId);
|
|
34
|
-
const draggedItemIndex = selectorItemIndex(store.value, draggedItemMeta.id);
|
|
35
|
-
const isTargetLastSibling = targetItemIndex === selectorItemOrderedChildrenIds(store.value, targetItemMeta.parentId).length - 1;
|
|
36
|
-
const oldPosition = {
|
|
37
|
-
parentId: draggedItemMeta.parentId,
|
|
38
|
-
index: draggedItemIndex
|
|
39
|
-
};
|
|
40
|
-
const checkIfPositionIsValid = positionAfterAction => {
|
|
41
|
-
let isValid;
|
|
42
|
-
// If the new position is equal to the old one, we don't want to show any dropping UI.
|
|
43
|
-
if (positionAfterAction.parentId === oldPosition.parentId && positionAfterAction.index === oldPosition.index) {
|
|
44
|
-
isValid = false;
|
|
45
|
-
} else if (canMoveItemToNewPosition) {
|
|
46
|
-
isValid = canMoveItemToNewPosition({
|
|
47
|
-
itemId: currentReorder.draggedItemId,
|
|
48
|
-
oldPosition,
|
|
49
|
-
newPosition: positionAfterAction
|
|
50
|
-
});
|
|
51
|
-
} else {
|
|
52
|
-
isValid = true;
|
|
53
|
-
}
|
|
54
|
-
return isValid;
|
|
55
|
-
};
|
|
56
|
-
const positionsAfterAction = {
|
|
57
|
-
'make-child': {
|
|
58
|
-
parentId: targetItemMeta.id,
|
|
59
|
-
index: 0
|
|
60
|
-
},
|
|
61
|
-
'reorder-above': {
|
|
62
|
-
parentId: targetItemMeta.parentId,
|
|
63
|
-
index: targetItemMeta.parentId === draggedItemMeta.parentId && targetItemIndex > draggedItemIndex ? targetItemIndex - 1 : targetItemIndex
|
|
64
|
-
},
|
|
65
|
-
'reorder-below': !targetItemMeta.expandable || isTargetLastSibling ? {
|
|
66
|
-
parentId: targetItemMeta.parentId,
|
|
67
|
-
index: targetItemMeta.parentId === draggedItemMeta.parentId && targetItemIndex > draggedItemIndex ? targetItemIndex : targetItemIndex + 1
|
|
68
|
-
} : null,
|
|
69
|
-
'move-to-parent': targetItemMeta.parentId == null ? null : {
|
|
70
|
-
parentId: targetItemMeta.parentId,
|
|
71
|
-
index: selectorItemOrderedChildrenIds(store.value, targetItemMeta.parentId).length
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
const validActions = {};
|
|
75
|
-
Object.keys(positionsAfterAction).forEach(action => {
|
|
76
|
-
const positionAfterAction = positionsAfterAction[action];
|
|
77
|
-
if (positionAfterAction != null && checkIfPositionIsValid(positionAfterAction)) {
|
|
78
|
-
validActions[action] = positionAfterAction;
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
return validActions;
|
|
82
|
-
}, [store, params.canMoveItemToNewPosition]);
|
|
83
|
-
const startDraggingItem = React.useCallback(itemId => {
|
|
84
|
-
store.update(prevState => _extends({}, prevState, {
|
|
85
|
-
itemsReordering: _extends({}, prevState.itemsReordering, {
|
|
86
|
-
currentReorder: {
|
|
87
|
-
targetItemId: itemId,
|
|
88
|
-
draggedItemId: itemId,
|
|
89
|
-
action: null,
|
|
90
|
-
newPosition: null
|
|
91
|
-
}
|
|
92
|
-
})
|
|
93
|
-
}));
|
|
94
|
-
}, [store]);
|
|
95
|
-
const stopDraggingItem = React.useCallback(itemId => {
|
|
96
|
-
const currentReorder = selectorCurrentItemReordering(store.value);
|
|
97
|
-
if (currentReorder == null || currentReorder.draggedItemId !== itemId) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
if (currentReorder.draggedItemId === currentReorder.targetItemId || currentReorder.action == null || currentReorder.newPosition == null) {
|
|
101
|
-
store.update(prevState => _extends({}, prevState, {
|
|
102
|
-
itemsReordering: _extends({}, prevState.itemsReordering, {
|
|
103
|
-
currentReorder: null
|
|
104
|
-
})
|
|
105
|
-
}));
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
const draggedItemMeta = selectorItemMeta(store.value, currentReorder.draggedItemId);
|
|
109
|
-
const oldPosition = {
|
|
110
|
-
parentId: draggedItemMeta.parentId,
|
|
111
|
-
index: selectorItemIndex(store.value, draggedItemMeta.id)
|
|
112
|
-
};
|
|
113
|
-
const newPosition = currentReorder.newPosition;
|
|
114
|
-
store.update(prevState => _extends({}, prevState, {
|
|
115
|
-
itemsReordering: _extends({}, prevState.itemsReordering, {
|
|
116
|
-
currentReorder: null
|
|
117
|
-
}),
|
|
118
|
-
items: moveItemInTree({
|
|
119
|
-
itemToMoveId: itemId,
|
|
120
|
-
newPosition,
|
|
121
|
-
oldPosition,
|
|
122
|
-
prevState: prevState.items
|
|
123
|
-
})
|
|
124
|
-
}));
|
|
125
|
-
const onItemPositionChange = params.onItemPositionChange;
|
|
126
|
-
onItemPositionChange?.({
|
|
127
|
-
itemId,
|
|
128
|
-
newPosition,
|
|
129
|
-
oldPosition
|
|
130
|
-
});
|
|
131
|
-
}, [store, params.onItemPositionChange]);
|
|
132
|
-
const setDragTargetItem = React.useCallback(({
|
|
133
|
-
itemId,
|
|
134
|
-
validActions,
|
|
135
|
-
targetHeight,
|
|
136
|
-
cursorY,
|
|
137
|
-
cursorX,
|
|
138
|
-
contentElement
|
|
139
|
-
}) => {
|
|
140
|
-
store.update(prevState => {
|
|
141
|
-
const prevItemReorder = prevState.itemsReordering.currentReorder;
|
|
142
|
-
if (prevItemReorder == null || isAncestor(store, itemId, prevItemReorder.draggedItemId)) {
|
|
143
|
-
return prevState;
|
|
144
|
-
}
|
|
145
|
-
const action = chooseActionToApply({
|
|
146
|
-
itemChildrenIndentation: params.itemChildrenIndentation,
|
|
147
|
-
validActions,
|
|
148
|
-
targetHeight,
|
|
149
|
-
targetDepth: prevState.items.itemMetaLookup[itemId].depth,
|
|
150
|
-
cursorY,
|
|
151
|
-
cursorX,
|
|
152
|
-
contentElement
|
|
153
|
-
});
|
|
154
|
-
const newPosition = action == null ? null : validActions[action];
|
|
155
|
-
if (prevItemReorder.targetItemId === itemId && prevItemReorder.action === action && prevItemReorder.newPosition?.parentId === newPosition?.parentId && prevItemReorder.newPosition?.index === newPosition?.index) {
|
|
156
|
-
return prevState;
|
|
157
|
-
}
|
|
158
|
-
return _extends({}, prevState, {
|
|
159
|
-
itemsReordering: _extends({}, prevState.itemsReordering, {
|
|
160
|
-
currentReorder: _extends({}, prevItemReorder, {
|
|
161
|
-
targetItemId: itemId,
|
|
162
|
-
newPosition,
|
|
163
|
-
action
|
|
164
|
-
})
|
|
165
|
-
})
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
}, [store, params.itemChildrenIndentation]);
|
|
169
|
-
useEnhancedEffect(() => {
|
|
170
|
-
store.update(prevState => _extends({}, prevState, {
|
|
171
|
-
itemsReordering: _extends({}, prevState.itemsReordering, {
|
|
172
|
-
isItemReorderable: params.itemsReordering ? params.isItemReorderable ?? (() => true) : () => false
|
|
173
|
-
})
|
|
174
|
-
}));
|
|
175
|
-
}, [store, params.itemsReordering, params.isItemReorderable]);
|
|
176
|
-
return {
|
|
177
|
-
instance: {
|
|
178
|
-
canItemBeDragged,
|
|
179
|
-
getDroppingTargetValidActions,
|
|
180
|
-
startDraggingItem,
|
|
181
|
-
stopDraggingItem,
|
|
182
|
-
setDragTargetItem
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
};
|
|
186
|
-
useTreeViewItemsReordering.itemPlugin = useTreeViewItemsReorderingItemPlugin;
|
|
187
|
-
useTreeViewItemsReordering.getDefaultizedParams = ({
|
|
188
|
-
params
|
|
189
|
-
}) => _extends({}, params, {
|
|
190
|
-
itemsReordering: params.itemsReordering ?? false
|
|
191
|
-
});
|
|
192
|
-
useTreeViewItemsReordering.getInitialState = params => ({
|
|
193
|
-
itemsReordering: {
|
|
194
|
-
currentReorder: null,
|
|
195
|
-
isItemReorderable: params.itemsReordering ? params.isItemReorderable ?? (() => true) : () => false
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
useTreeViewItemsReordering.params = {
|
|
199
|
-
itemsReordering: true,
|
|
200
|
-
isItemReorderable: true,
|
|
201
|
-
canMoveItemToNewPosition: true,
|
|
202
|
-
onItemPositionChange: true
|
|
203
|
-
};
|
|
@@ -1,417 +0,0 @@
|
|
|
1
|
-
import { TreeViewState } from '@mui/x-tree-view/internals';
|
|
2
|
-
import { UseTreeViewItemsReorderingSignature } from "./useTreeViewItemsReordering.types.js";
|
|
3
|
-
/**
|
|
4
|
-
* Get the properties of the current reordering.
|
|
5
|
-
* @param {TreeViewState<[UseTreeViewItemsReorderingSignature]>} state The state of the tree view.
|
|
6
|
-
* @returns {TreeViewItemsReorderingState['currentReorder']} The properties of the current reordering.
|
|
7
|
-
*/
|
|
8
|
-
export declare const selectorCurrentItemReordering: ((state: import("@mui/x-tree-view/internals/corePlugins/useTreeViewId/useTreeViewId.types").UseTreeViewIdState & import("./useTreeViewItemsReordering.types").UseTreeViewItemsReorderingState & Partial<{}> & {
|
|
9
|
-
cacheKey: import("@mui/x-tree-view/internals/models").TreeViewStateCacheKey;
|
|
10
|
-
}) => {
|
|
11
|
-
draggedItemId: string;
|
|
12
|
-
targetItemId: string;
|
|
13
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
14
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
15
|
-
} | null) & {
|
|
16
|
-
clearCache: () => void;
|
|
17
|
-
resultsCount: () => number;
|
|
18
|
-
resetResultsCount: () => void;
|
|
19
|
-
} & {
|
|
20
|
-
resultFunc: (resultFuncArgs_0: {
|
|
21
|
-
isItemReorderable: (itemId: string) => boolean;
|
|
22
|
-
currentReorder: {
|
|
23
|
-
draggedItemId: string;
|
|
24
|
-
targetItemId: string;
|
|
25
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
26
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
27
|
-
} | null;
|
|
28
|
-
}) => {
|
|
29
|
-
draggedItemId: string;
|
|
30
|
-
targetItemId: string;
|
|
31
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
32
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
33
|
-
} | null;
|
|
34
|
-
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
35
|
-
isItemReorderable: (itemId: string) => boolean;
|
|
36
|
-
currentReorder: {
|
|
37
|
-
draggedItemId: string;
|
|
38
|
-
targetItemId: string;
|
|
39
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
40
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
41
|
-
} | null;
|
|
42
|
-
}) => {
|
|
43
|
-
draggedItemId: string;
|
|
44
|
-
targetItemId: string;
|
|
45
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
46
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
47
|
-
} | null) & {
|
|
48
|
-
clearCache: () => void;
|
|
49
|
-
resultsCount: () => number;
|
|
50
|
-
resetResultsCount: () => void;
|
|
51
|
-
};
|
|
52
|
-
lastResult: () => {
|
|
53
|
-
draggedItemId: string;
|
|
54
|
-
targetItemId: string;
|
|
55
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
56
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
57
|
-
} | null;
|
|
58
|
-
dependencies: [(state: TreeViewState<[UseTreeViewItemsReorderingSignature]>) => {
|
|
59
|
-
isItemReorderable: (itemId: string) => boolean;
|
|
60
|
-
currentReorder: {
|
|
61
|
-
draggedItemId: string;
|
|
62
|
-
targetItemId: string;
|
|
63
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
64
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
65
|
-
} | null;
|
|
66
|
-
}];
|
|
67
|
-
recomputations: () => number;
|
|
68
|
-
resetRecomputations: () => void;
|
|
69
|
-
dependencyRecomputations: () => number;
|
|
70
|
-
resetDependencyRecomputations: () => void;
|
|
71
|
-
} & {
|
|
72
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
73
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* Get the properties of the dragged item.
|
|
77
|
-
* @param {TreeViewState<[UseTreeViewItemsSignature, UseTreeViewItemsReorderingSignature]>} state The state of the tree view.
|
|
78
|
-
* @param {string} itemId The id of the item.
|
|
79
|
-
* @returns {TreeViewItemDraggedItemProperties | null} The properties of the dragged item if the current item is being dragged, `null` otherwise.
|
|
80
|
-
*/
|
|
81
|
-
export declare const selectorDraggedItemProperties: ((state: any, itemId: string) => {
|
|
82
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
83
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction;
|
|
84
|
-
targetDepth: number;
|
|
85
|
-
} | null) & {
|
|
86
|
-
clearCache: () => void;
|
|
87
|
-
resultsCount: () => number;
|
|
88
|
-
resetResultsCount: () => void;
|
|
89
|
-
} & {
|
|
90
|
-
resultFunc: (resultFuncArgs_0: {
|
|
91
|
-
draggedItemId: string;
|
|
92
|
-
targetItemId: string;
|
|
93
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
94
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
95
|
-
} | null, resultFuncArgs_1: {
|
|
96
|
-
[itemId: string]: import("@mui/x-tree-view/internals").TreeViewItemMeta;
|
|
97
|
-
}, resultFuncArgs_2: string) => {
|
|
98
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
99
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction;
|
|
100
|
-
targetDepth: number;
|
|
101
|
-
} | null;
|
|
102
|
-
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
103
|
-
draggedItemId: string;
|
|
104
|
-
targetItemId: string;
|
|
105
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
106
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
107
|
-
} | null, resultFuncArgs_1: {
|
|
108
|
-
[itemId: string]: import("@mui/x-tree-view/internals").TreeViewItemMeta;
|
|
109
|
-
}, resultFuncArgs_2: string) => {
|
|
110
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
111
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction;
|
|
112
|
-
targetDepth: number;
|
|
113
|
-
} | null) & {
|
|
114
|
-
clearCache: () => void;
|
|
115
|
-
resultsCount: () => number;
|
|
116
|
-
resetResultsCount: () => void;
|
|
117
|
-
};
|
|
118
|
-
lastResult: () => {
|
|
119
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
120
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction;
|
|
121
|
-
targetDepth: number;
|
|
122
|
-
} | null;
|
|
123
|
-
dependencies: [((state: import("@mui/x-tree-view/internals/corePlugins/useTreeViewId/useTreeViewId.types").UseTreeViewIdState & import("./useTreeViewItemsReordering.types").UseTreeViewItemsReorderingState & Partial<{}> & {
|
|
124
|
-
cacheKey: import("@mui/x-tree-view/internals/models").TreeViewStateCacheKey;
|
|
125
|
-
}) => {
|
|
126
|
-
draggedItemId: string;
|
|
127
|
-
targetItemId: string;
|
|
128
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
129
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
130
|
-
} | null) & {
|
|
131
|
-
clearCache: () => void;
|
|
132
|
-
resultsCount: () => number;
|
|
133
|
-
resetResultsCount: () => void;
|
|
134
|
-
} & {
|
|
135
|
-
resultFunc: (resultFuncArgs_0: {
|
|
136
|
-
isItemReorderable: (itemId: string) => boolean;
|
|
137
|
-
currentReorder: {
|
|
138
|
-
draggedItemId: string;
|
|
139
|
-
targetItemId: string;
|
|
140
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
141
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
142
|
-
} | null;
|
|
143
|
-
}) => {
|
|
144
|
-
draggedItemId: string;
|
|
145
|
-
targetItemId: string;
|
|
146
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
147
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
148
|
-
} | null;
|
|
149
|
-
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
150
|
-
isItemReorderable: (itemId: string) => boolean;
|
|
151
|
-
currentReorder: {
|
|
152
|
-
draggedItemId: string;
|
|
153
|
-
targetItemId: string;
|
|
154
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
155
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
156
|
-
} | null;
|
|
157
|
-
}) => {
|
|
158
|
-
draggedItemId: string;
|
|
159
|
-
targetItemId: string;
|
|
160
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
161
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
162
|
-
} | null) & {
|
|
163
|
-
clearCache: () => void;
|
|
164
|
-
resultsCount: () => number;
|
|
165
|
-
resetResultsCount: () => void;
|
|
166
|
-
};
|
|
167
|
-
lastResult: () => {
|
|
168
|
-
draggedItemId: string;
|
|
169
|
-
targetItemId: string;
|
|
170
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
171
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
172
|
-
} | null;
|
|
173
|
-
dependencies: [(state: TreeViewState<[UseTreeViewItemsReorderingSignature]>) => {
|
|
174
|
-
isItemReorderable: (itemId: string) => boolean;
|
|
175
|
-
currentReorder: {
|
|
176
|
-
draggedItemId: string;
|
|
177
|
-
targetItemId: string;
|
|
178
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
179
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
180
|
-
} | null;
|
|
181
|
-
}];
|
|
182
|
-
recomputations: () => number;
|
|
183
|
-
resetRecomputations: () => void;
|
|
184
|
-
dependencyRecomputations: () => number;
|
|
185
|
-
resetDependencyRecomputations: () => void;
|
|
186
|
-
} & {
|
|
187
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
188
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
189
|
-
}, ((state: import("@mui/x-tree-view/internals/corePlugins/useTreeViewId/useTreeViewId.types").UseTreeViewIdState & import("@mui/x-tree-view/internals").UseTreeViewItemsState<import("@mui/x-tree-view").TreeViewDefaultItemModelProperties> & Partial<{}> & {
|
|
190
|
-
cacheKey: import("@mui/x-tree-view/internals/models").TreeViewStateCacheKey;
|
|
191
|
-
}) => {
|
|
192
|
-
[itemId: string]: import("@mui/x-tree-view/internals").TreeViewItemMeta;
|
|
193
|
-
}) & {
|
|
194
|
-
clearCache: () => void;
|
|
195
|
-
resultsCount: () => number;
|
|
196
|
-
resetResultsCount: () => void;
|
|
197
|
-
} & {
|
|
198
|
-
resultFunc: (resultFuncArgs_0: {
|
|
199
|
-
disabledItemsFocusable: boolean;
|
|
200
|
-
itemModelLookup: {
|
|
201
|
-
[itemId: string]: import("@mui/x-tree-view").TreeViewBaseItem<import("@mui/x-tree-view").TreeViewDefaultItemModelProperties>;
|
|
202
|
-
};
|
|
203
|
-
itemMetaLookup: {
|
|
204
|
-
[itemId: string]: import("@mui/x-tree-view/internals").TreeViewItemMeta;
|
|
205
|
-
};
|
|
206
|
-
itemOrderedChildrenIdsLookup: {
|
|
207
|
-
[parentItemId: string]: string[];
|
|
208
|
-
};
|
|
209
|
-
itemChildrenIndexesLookup: {
|
|
210
|
-
[parentItemId: string]: {
|
|
211
|
-
[itemId: string]: number;
|
|
212
|
-
};
|
|
213
|
-
};
|
|
214
|
-
loading: boolean;
|
|
215
|
-
error: Error | null;
|
|
216
|
-
}) => {
|
|
217
|
-
[itemId: string]: import("@mui/x-tree-view/internals").TreeViewItemMeta;
|
|
218
|
-
};
|
|
219
|
-
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
220
|
-
disabledItemsFocusable: boolean;
|
|
221
|
-
itemModelLookup: {
|
|
222
|
-
[itemId: string]: import("@mui/x-tree-view").TreeViewBaseItem<import("@mui/x-tree-view").TreeViewDefaultItemModelProperties>;
|
|
223
|
-
};
|
|
224
|
-
itemMetaLookup: {
|
|
225
|
-
[itemId: string]: import("@mui/x-tree-view/internals").TreeViewItemMeta;
|
|
226
|
-
};
|
|
227
|
-
itemOrderedChildrenIdsLookup: {
|
|
228
|
-
[parentItemId: string]: string[];
|
|
229
|
-
};
|
|
230
|
-
itemChildrenIndexesLookup: {
|
|
231
|
-
[parentItemId: string]: {
|
|
232
|
-
[itemId: string]: number;
|
|
233
|
-
};
|
|
234
|
-
};
|
|
235
|
-
loading: boolean;
|
|
236
|
-
error: Error | null;
|
|
237
|
-
}) => {
|
|
238
|
-
[itemId: string]: import("@mui/x-tree-view/internals").TreeViewItemMeta;
|
|
239
|
-
}) & {
|
|
240
|
-
clearCache: () => void;
|
|
241
|
-
resultsCount: () => number;
|
|
242
|
-
resetResultsCount: () => void;
|
|
243
|
-
};
|
|
244
|
-
lastResult: () => {
|
|
245
|
-
[itemId: string]: import("@mui/x-tree-view/internals").TreeViewItemMeta;
|
|
246
|
-
};
|
|
247
|
-
dependencies: [import("@mui/x-tree-view/internals/utils/selectors").TreeViewRootSelector<import("@mui/x-tree-view/internals").UseTreeViewItemsSignature>];
|
|
248
|
-
recomputations: () => number;
|
|
249
|
-
resetRecomputations: () => void;
|
|
250
|
-
dependencyRecomputations: () => number;
|
|
251
|
-
resetDependencyRecomputations: () => void;
|
|
252
|
-
} & {
|
|
253
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
254
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
255
|
-
}, (_: any, itemId: string) => string];
|
|
256
|
-
recomputations: () => number;
|
|
257
|
-
resetRecomputations: () => void;
|
|
258
|
-
dependencyRecomputations: () => number;
|
|
259
|
-
resetDependencyRecomputations: () => void;
|
|
260
|
-
} & {
|
|
261
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
262
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
263
|
-
};
|
|
264
|
-
/**
|
|
265
|
-
* Check if the current item is a valid target for the dragged item.
|
|
266
|
-
* @param {TreeViewState<[UseTreeViewItemsReorderingSignature]>} state The state of the tree view.
|
|
267
|
-
* @param {string} itemId The id of the item.
|
|
268
|
-
* @returns {boolean} `true` if the current item is a valid target for the dragged item, `false` otherwise.
|
|
269
|
-
*/
|
|
270
|
-
export declare const selectorIsItemValidReorderingTarget: ((state: any, itemId: string) => boolean | null) & {
|
|
271
|
-
clearCache: () => void;
|
|
272
|
-
resultsCount: () => number;
|
|
273
|
-
resetResultsCount: () => void;
|
|
274
|
-
} & {
|
|
275
|
-
resultFunc: (resultFuncArgs_0: {
|
|
276
|
-
draggedItemId: string;
|
|
277
|
-
targetItemId: string;
|
|
278
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
279
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
280
|
-
} | null, resultFuncArgs_1: string) => boolean | null;
|
|
281
|
-
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
282
|
-
draggedItemId: string;
|
|
283
|
-
targetItemId: string;
|
|
284
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
285
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
286
|
-
} | null, resultFuncArgs_1: string) => boolean | null) & {
|
|
287
|
-
clearCache: () => void;
|
|
288
|
-
resultsCount: () => number;
|
|
289
|
-
resetResultsCount: () => void;
|
|
290
|
-
};
|
|
291
|
-
lastResult: () => boolean | null;
|
|
292
|
-
dependencies: [((state: import("@mui/x-tree-view/internals/corePlugins/useTreeViewId/useTreeViewId.types").UseTreeViewIdState & import("./useTreeViewItemsReordering.types").UseTreeViewItemsReorderingState & Partial<{}> & {
|
|
293
|
-
cacheKey: import("@mui/x-tree-view/internals/models").TreeViewStateCacheKey;
|
|
294
|
-
}) => {
|
|
295
|
-
draggedItemId: string;
|
|
296
|
-
targetItemId: string;
|
|
297
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
298
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
299
|
-
} | null) & {
|
|
300
|
-
clearCache: () => void;
|
|
301
|
-
resultsCount: () => number;
|
|
302
|
-
resetResultsCount: () => void;
|
|
303
|
-
} & {
|
|
304
|
-
resultFunc: (resultFuncArgs_0: {
|
|
305
|
-
isItemReorderable: (itemId: string) => boolean;
|
|
306
|
-
currentReorder: {
|
|
307
|
-
draggedItemId: string;
|
|
308
|
-
targetItemId: string;
|
|
309
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
310
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
311
|
-
} | null;
|
|
312
|
-
}) => {
|
|
313
|
-
draggedItemId: string;
|
|
314
|
-
targetItemId: string;
|
|
315
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
316
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
317
|
-
} | null;
|
|
318
|
-
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
319
|
-
isItemReorderable: (itemId: string) => boolean;
|
|
320
|
-
currentReorder: {
|
|
321
|
-
draggedItemId: string;
|
|
322
|
-
targetItemId: string;
|
|
323
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
324
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
325
|
-
} | null;
|
|
326
|
-
}) => {
|
|
327
|
-
draggedItemId: string;
|
|
328
|
-
targetItemId: string;
|
|
329
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
330
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
331
|
-
} | null) & {
|
|
332
|
-
clearCache: () => void;
|
|
333
|
-
resultsCount: () => number;
|
|
334
|
-
resetResultsCount: () => void;
|
|
335
|
-
};
|
|
336
|
-
lastResult: () => {
|
|
337
|
-
draggedItemId: string;
|
|
338
|
-
targetItemId: string;
|
|
339
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
340
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
341
|
-
} | null;
|
|
342
|
-
dependencies: [(state: TreeViewState<[UseTreeViewItemsReorderingSignature]>) => {
|
|
343
|
-
isItemReorderable: (itemId: string) => boolean;
|
|
344
|
-
currentReorder: {
|
|
345
|
-
draggedItemId: string;
|
|
346
|
-
targetItemId: string;
|
|
347
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
348
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
349
|
-
} | null;
|
|
350
|
-
}];
|
|
351
|
-
recomputations: () => number;
|
|
352
|
-
resetRecomputations: () => void;
|
|
353
|
-
dependencyRecomputations: () => number;
|
|
354
|
-
resetDependencyRecomputations: () => void;
|
|
355
|
-
} & {
|
|
356
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
357
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
358
|
-
}, (_: any, itemId: string) => string];
|
|
359
|
-
recomputations: () => number;
|
|
360
|
-
resetRecomputations: () => void;
|
|
361
|
-
dependencyRecomputations: () => number;
|
|
362
|
-
resetDependencyRecomputations: () => void;
|
|
363
|
-
} & {
|
|
364
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
365
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
366
|
-
};
|
|
367
|
-
/**
|
|
368
|
-
* Check if the items can be reordered.
|
|
369
|
-
* @param {TreeViewState<[UseTreeViewItemsReorderingSignature]>} state The state of the tree view.
|
|
370
|
-
* @param {string} itemId The id of the item.
|
|
371
|
-
* @returns {boolean} `true` if the items can be reordered, `false` otherwise.
|
|
372
|
-
*/
|
|
373
|
-
export declare const selectorCanItemBeReordered: ((state: any, itemId: string) => boolean) & {
|
|
374
|
-
clearCache: () => void;
|
|
375
|
-
resultsCount: () => number;
|
|
376
|
-
resetResultsCount: () => void;
|
|
377
|
-
} & {
|
|
378
|
-
resultFunc: (resultFuncArgs_0: {
|
|
379
|
-
isItemReorderable: (itemId: string) => boolean;
|
|
380
|
-
currentReorder: {
|
|
381
|
-
draggedItemId: string;
|
|
382
|
-
targetItemId: string;
|
|
383
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
384
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
385
|
-
} | null;
|
|
386
|
-
}, resultFuncArgs_1: string) => boolean;
|
|
387
|
-
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
388
|
-
isItemReorderable: (itemId: string) => boolean;
|
|
389
|
-
currentReorder: {
|
|
390
|
-
draggedItemId: string;
|
|
391
|
-
targetItemId: string;
|
|
392
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
393
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
394
|
-
} | null;
|
|
395
|
-
}, resultFuncArgs_1: string) => boolean) & {
|
|
396
|
-
clearCache: () => void;
|
|
397
|
-
resultsCount: () => number;
|
|
398
|
-
resetResultsCount: () => void;
|
|
399
|
-
};
|
|
400
|
-
lastResult: () => boolean;
|
|
401
|
-
dependencies: [(state: TreeViewState<[UseTreeViewItemsReorderingSignature]>) => {
|
|
402
|
-
isItemReorderable: (itemId: string) => boolean;
|
|
403
|
-
currentReorder: {
|
|
404
|
-
draggedItemId: string;
|
|
405
|
-
targetItemId: string;
|
|
406
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
407
|
-
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
408
|
-
} | null;
|
|
409
|
-
}, (_: any, itemId: string) => string];
|
|
410
|
-
recomputations: () => number;
|
|
411
|
-
resetRecomputations: () => void;
|
|
412
|
-
dependencyRecomputations: () => number;
|
|
413
|
-
resetDependencyRecomputations: () => void;
|
|
414
|
-
} & {
|
|
415
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
416
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
417
|
-
};
|
package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { createSelector, selectorItemMetaLookup } from '@mui/x-tree-view/internals';
|
|
2
|
-
/**
|
|
3
|
-
* Get the items reordering state.
|
|
4
|
-
* @param {TreeViewState<[UseTreeViewItemsReorderingSignature]>} state The state of the tree view.
|
|
5
|
-
* @returns {TreeViewItemsReorderingState} The items reordering state.
|
|
6
|
-
*/
|
|
7
|
-
const selectorItemsReordering = state => state.itemsReordering;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Get the properties of the current reordering.
|
|
11
|
-
* @param {TreeViewState<[UseTreeViewItemsReorderingSignature]>} state The state of the tree view.
|
|
12
|
-
* @returns {TreeViewItemsReorderingState['currentReorder']} The properties of the current reordering.
|
|
13
|
-
*/
|
|
14
|
-
export const selectorCurrentItemReordering = createSelector([selectorItemsReordering], itemsReordering => itemsReordering.currentReorder);
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Get the properties of the dragged item.
|
|
18
|
-
* @param {TreeViewState<[UseTreeViewItemsSignature, UseTreeViewItemsReorderingSignature]>} state The state of the tree view.
|
|
19
|
-
* @param {string} itemId The id of the item.
|
|
20
|
-
* @returns {TreeViewItemDraggedItemProperties | null} The properties of the dragged item if the current item is being dragged, `null` otherwise.
|
|
21
|
-
*/
|
|
22
|
-
export const selectorDraggedItemProperties = createSelector([selectorCurrentItemReordering, selectorItemMetaLookup, (_, itemId) => itemId], (currentReorder, itemMetaLookup, itemId) => {
|
|
23
|
-
if (!currentReorder || currentReorder.targetItemId !== itemId || currentReorder.action == null) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
const targetDepth = currentReorder.newPosition?.parentId == null ? 0 :
|
|
27
|
-
// The depth is always defined because drag&drop is only usable with Rich Tree View components.
|
|
28
|
-
itemMetaLookup[itemId].depth + 1;
|
|
29
|
-
return {
|
|
30
|
-
newPosition: currentReorder.newPosition,
|
|
31
|
-
action: currentReorder.action,
|
|
32
|
-
targetDepth
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Check if the current item is a valid target for the dragged item.
|
|
38
|
-
* @param {TreeViewState<[UseTreeViewItemsReorderingSignature]>} state The state of the tree view.
|
|
39
|
-
* @param {string} itemId The id of the item.
|
|
40
|
-
* @returns {boolean} `true` if the current item is a valid target for the dragged item, `false` otherwise.
|
|
41
|
-
*/
|
|
42
|
-
export const selectorIsItemValidReorderingTarget = createSelector([selectorCurrentItemReordering, (_, itemId) => itemId], (currentReorder, itemId) => currentReorder && currentReorder.draggedItemId !== itemId);
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Check if the items can be reordered.
|
|
46
|
-
* @param {TreeViewState<[UseTreeViewItemsReorderingSignature]>} state The state of the tree view.
|
|
47
|
-
* @param {string} itemId The id of the item.
|
|
48
|
-
* @returns {boolean} `true` if the items can be reordered, `false` otherwise.
|
|
49
|
-
*/
|
|
50
|
-
export const selectorCanItemBeReordered = createSelector([selectorItemsReordering, (_, itemId) => itemId], (itemsReordering, itemId) => itemsReordering.isItemReorderable(itemId));
|