@mui/x-tree-view-pro 8.1.0 → 8.3.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 +233 -7
- package/RichTreeViewPro/RichTreeViewPro.js +1 -9
- package/RichTreeViewPro/RichTreeViewPro.plugins.d.ts +1 -1
- package/RichTreeViewPro/RichTreeViewPro.types.d.ts +1 -7
- package/RichTreeViewPro/index.d.ts +1 -1
- package/esm/RichTreeViewPro/RichTreeViewPro.js +1 -9
- package/esm/RichTreeViewPro/RichTreeViewPro.plugins.d.ts +1 -1
- package/esm/RichTreeViewPro/RichTreeViewPro.types.d.ts +1 -7
- package/esm/RichTreeViewPro/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/internals/plugins/useTreeViewItemsReordering/index.d.ts +1 -1
- package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.js +7 -1
- package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.js +15 -3
- package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.d.ts +35 -35
- package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.js +2 -2
- package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.d.ts +9 -5
- package/esm/themeAugmentation/components.js +1 -0
- package/esm/themeAugmentation/index.d.ts +3 -3
- package/esm/themeAugmentation/overrides.d.ts +0 -4
- package/esm/themeAugmentation/overrides.js +4 -0
- package/esm/themeAugmentation/props.d.ts +0 -2
- package/esm/themeAugmentation/props.js +2 -0
- package/index.js +1 -1
- package/internals/plugins/useTreeViewItemsReordering/index.d.ts +1 -1
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.js +7 -1
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.js +15 -3
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.d.ts +35 -35
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.js +1 -1
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.d.ts +9 -5
- package/package.json +6 -6
- package/themeAugmentation/components.js +5 -0
- package/themeAugmentation/index.d.ts +3 -3
- package/themeAugmentation/overrides.d.ts +0 -4
- package/themeAugmentation/overrides.js +5 -0
- package/themeAugmentation/props.d.ts +0 -2
- package/themeAugmentation/props.js +5 -0
package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ import { UseTreeViewItemsReorderingSignature } from "./useTreeViewItemsReorderin
|
|
|
5
5
|
* @param {TreeViewState<[UseTreeViewItemsReorderingSignature]>} state The state of the tree view.
|
|
6
6
|
* @returns {TreeViewItemsReorderingState['currentReorder']} The properties of the current reordering.
|
|
7
7
|
*/
|
|
8
|
-
export declare const selectorCurrentItemReordering: ((state: import("@mui/x-tree-view/internals/corePlugins/useTreeViewId/useTreeViewId.types").UseTreeViewIdState & import("./useTreeViewItemsReordering.types").UseTreeViewItemsReorderingState & Partial<{}> & {
|
|
8
|
+
export declare const selectorCurrentItemReordering: ((state: import("@mui/x-tree-view/internals/corePlugins/useTreeViewId/useTreeViewId.types").UseTreeViewIdState & import("./useTreeViewItemsReordering.types.js").UseTreeViewItemsReorderingState & Partial<{}> & {
|
|
9
9
|
cacheKey: import("@mui/x-tree-view/internals/models").TreeViewStateCacheKey;
|
|
10
10
|
}) => {
|
|
11
11
|
draggedItemId: string;
|
|
12
12
|
targetItemId: string;
|
|
13
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
13
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
14
14
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
15
15
|
} | null) & {
|
|
16
16
|
clearCache: () => void;
|
|
@@ -22,13 +22,13 @@ export declare const selectorCurrentItemReordering: ((state: import("@mui/x-tree
|
|
|
22
22
|
currentReorder: {
|
|
23
23
|
draggedItemId: string;
|
|
24
24
|
targetItemId: string;
|
|
25
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
25
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
26
26
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
27
27
|
} | null;
|
|
28
28
|
}) => {
|
|
29
29
|
draggedItemId: string;
|
|
30
30
|
targetItemId: string;
|
|
31
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
31
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
32
32
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
33
33
|
} | null;
|
|
34
34
|
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
@@ -36,13 +36,13 @@ export declare const selectorCurrentItemReordering: ((state: import("@mui/x-tree
|
|
|
36
36
|
currentReorder: {
|
|
37
37
|
draggedItemId: string;
|
|
38
38
|
targetItemId: string;
|
|
39
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
39
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
40
40
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
41
41
|
} | null;
|
|
42
42
|
}) => {
|
|
43
43
|
draggedItemId: string;
|
|
44
44
|
targetItemId: string;
|
|
45
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
45
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
46
46
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
47
47
|
} | null) & {
|
|
48
48
|
clearCache: () => void;
|
|
@@ -52,7 +52,7 @@ export declare const selectorCurrentItemReordering: ((state: import("@mui/x-tree
|
|
|
52
52
|
lastResult: () => {
|
|
53
53
|
draggedItemId: string;
|
|
54
54
|
targetItemId: string;
|
|
55
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
55
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
56
56
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
57
57
|
} | null;
|
|
58
58
|
dependencies: [(state: TreeViewState<[UseTreeViewItemsReorderingSignature]>) => {
|
|
@@ -60,7 +60,7 @@ export declare const selectorCurrentItemReordering: ((state: import("@mui/x-tree
|
|
|
60
60
|
currentReorder: {
|
|
61
61
|
draggedItemId: string;
|
|
62
62
|
targetItemId: string;
|
|
63
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
63
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
64
64
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
65
65
|
} | null;
|
|
66
66
|
}];
|
|
@@ -79,7 +79,7 @@ export declare const selectorCurrentItemReordering: ((state: import("@mui/x-tree
|
|
|
79
79
|
* @returns {TreeViewItemDraggedItemProperties | null} The properties of the dragged item if the current item is being dragged, `null` otherwise.
|
|
80
80
|
*/
|
|
81
81
|
export declare const selectorDraggedItemProperties: ((state: any, itemId: string) => {
|
|
82
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
82
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
83
83
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction;
|
|
84
84
|
targetDepth: number;
|
|
85
85
|
} | null) & {
|
|
@@ -90,24 +90,24 @@ export declare const selectorDraggedItemProperties: ((state: any, itemId: string
|
|
|
90
90
|
resultFunc: (resultFuncArgs_0: {
|
|
91
91
|
draggedItemId: string;
|
|
92
92
|
targetItemId: string;
|
|
93
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
93
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
94
94
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
95
95
|
} | null, resultFuncArgs_1: {
|
|
96
96
|
[itemId: string]: import("@mui/x-tree-view/internals").TreeViewItemMeta;
|
|
97
97
|
}, resultFuncArgs_2: string) => {
|
|
98
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
98
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
99
99
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction;
|
|
100
100
|
targetDepth: number;
|
|
101
101
|
} | null;
|
|
102
102
|
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
103
103
|
draggedItemId: string;
|
|
104
104
|
targetItemId: string;
|
|
105
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
105
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
106
106
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
107
107
|
} | null, resultFuncArgs_1: {
|
|
108
108
|
[itemId: string]: import("@mui/x-tree-view/internals").TreeViewItemMeta;
|
|
109
109
|
}, resultFuncArgs_2: string) => {
|
|
110
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
110
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
111
111
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction;
|
|
112
112
|
targetDepth: number;
|
|
113
113
|
} | null) & {
|
|
@@ -116,16 +116,16 @@ export declare const selectorDraggedItemProperties: ((state: any, itemId: string
|
|
|
116
116
|
resetResultsCount: () => void;
|
|
117
117
|
};
|
|
118
118
|
lastResult: () => {
|
|
119
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
119
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
120
120
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction;
|
|
121
121
|
targetDepth: number;
|
|
122
122
|
} | null;
|
|
123
|
-
dependencies: [((state: import("@mui/x-tree-view/internals/corePlugins/useTreeViewId/useTreeViewId.types").UseTreeViewIdState & import("./useTreeViewItemsReordering.types").UseTreeViewItemsReorderingState & Partial<{}> & {
|
|
123
|
+
dependencies: [((state: import("@mui/x-tree-view/internals/corePlugins/useTreeViewId/useTreeViewId.types").UseTreeViewIdState & import("./useTreeViewItemsReordering.types.js").UseTreeViewItemsReorderingState & Partial<{}> & {
|
|
124
124
|
cacheKey: import("@mui/x-tree-view/internals/models").TreeViewStateCacheKey;
|
|
125
125
|
}) => {
|
|
126
126
|
draggedItemId: string;
|
|
127
127
|
targetItemId: string;
|
|
128
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
128
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
129
129
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
130
130
|
} | null) & {
|
|
131
131
|
clearCache: () => void;
|
|
@@ -137,13 +137,13 @@ export declare const selectorDraggedItemProperties: ((state: any, itemId: string
|
|
|
137
137
|
currentReorder: {
|
|
138
138
|
draggedItemId: string;
|
|
139
139
|
targetItemId: string;
|
|
140
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
140
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
141
141
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
142
142
|
} | null;
|
|
143
143
|
}) => {
|
|
144
144
|
draggedItemId: string;
|
|
145
145
|
targetItemId: string;
|
|
146
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
146
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
147
147
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
148
148
|
} | null;
|
|
149
149
|
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
@@ -151,13 +151,13 @@ export declare const selectorDraggedItemProperties: ((state: any, itemId: string
|
|
|
151
151
|
currentReorder: {
|
|
152
152
|
draggedItemId: string;
|
|
153
153
|
targetItemId: string;
|
|
154
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
154
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
155
155
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
156
156
|
} | null;
|
|
157
157
|
}) => {
|
|
158
158
|
draggedItemId: string;
|
|
159
159
|
targetItemId: string;
|
|
160
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
160
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
161
161
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
162
162
|
} | null) & {
|
|
163
163
|
clearCache: () => void;
|
|
@@ -167,7 +167,7 @@ export declare const selectorDraggedItemProperties: ((state: any, itemId: string
|
|
|
167
167
|
lastResult: () => {
|
|
168
168
|
draggedItemId: string;
|
|
169
169
|
targetItemId: string;
|
|
170
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
170
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
171
171
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
172
172
|
} | null;
|
|
173
173
|
dependencies: [(state: TreeViewState<[UseTreeViewItemsReorderingSignature]>) => {
|
|
@@ -175,7 +175,7 @@ export declare const selectorDraggedItemProperties: ((state: any, itemId: string
|
|
|
175
175
|
currentReorder: {
|
|
176
176
|
draggedItemId: string;
|
|
177
177
|
targetItemId: string;
|
|
178
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
178
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
179
179
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
180
180
|
} | null;
|
|
181
181
|
}];
|
|
@@ -275,13 +275,13 @@ export declare const selectorIsItemValidReorderingTarget: ((state: any, itemId:
|
|
|
275
275
|
resultFunc: (resultFuncArgs_0: {
|
|
276
276
|
draggedItemId: string;
|
|
277
277
|
targetItemId: string;
|
|
278
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
278
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
279
279
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
280
280
|
} | null, resultFuncArgs_1: string) => boolean | null;
|
|
281
281
|
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
282
282
|
draggedItemId: string;
|
|
283
283
|
targetItemId: string;
|
|
284
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
284
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
285
285
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
286
286
|
} | null, resultFuncArgs_1: string) => boolean | null) & {
|
|
287
287
|
clearCache: () => void;
|
|
@@ -289,12 +289,12 @@ export declare const selectorIsItemValidReorderingTarget: ((state: any, itemId:
|
|
|
289
289
|
resetResultsCount: () => void;
|
|
290
290
|
};
|
|
291
291
|
lastResult: () => boolean | null;
|
|
292
|
-
dependencies: [((state: import("@mui/x-tree-view/internals/corePlugins/useTreeViewId/useTreeViewId.types").UseTreeViewIdState & import("./useTreeViewItemsReordering.types").UseTreeViewItemsReorderingState & Partial<{}> & {
|
|
292
|
+
dependencies: [((state: import("@mui/x-tree-view/internals/corePlugins/useTreeViewId/useTreeViewId.types").UseTreeViewIdState & import("./useTreeViewItemsReordering.types.js").UseTreeViewItemsReorderingState & Partial<{}> & {
|
|
293
293
|
cacheKey: import("@mui/x-tree-view/internals/models").TreeViewStateCacheKey;
|
|
294
294
|
}) => {
|
|
295
295
|
draggedItemId: string;
|
|
296
296
|
targetItemId: string;
|
|
297
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
297
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
298
298
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
299
299
|
} | null) & {
|
|
300
300
|
clearCache: () => void;
|
|
@@ -306,13 +306,13 @@ export declare const selectorIsItemValidReorderingTarget: ((state: any, itemId:
|
|
|
306
306
|
currentReorder: {
|
|
307
307
|
draggedItemId: string;
|
|
308
308
|
targetItemId: string;
|
|
309
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
309
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
310
310
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
311
311
|
} | null;
|
|
312
312
|
}) => {
|
|
313
313
|
draggedItemId: string;
|
|
314
314
|
targetItemId: string;
|
|
315
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
315
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
316
316
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
317
317
|
} | null;
|
|
318
318
|
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
@@ -320,13 +320,13 @@ export declare const selectorIsItemValidReorderingTarget: ((state: any, itemId:
|
|
|
320
320
|
currentReorder: {
|
|
321
321
|
draggedItemId: string;
|
|
322
322
|
targetItemId: string;
|
|
323
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
323
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
324
324
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
325
325
|
} | null;
|
|
326
326
|
}) => {
|
|
327
327
|
draggedItemId: string;
|
|
328
328
|
targetItemId: string;
|
|
329
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
329
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
330
330
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
331
331
|
} | null) & {
|
|
332
332
|
clearCache: () => void;
|
|
@@ -336,7 +336,7 @@ export declare const selectorIsItemValidReorderingTarget: ((state: any, itemId:
|
|
|
336
336
|
lastResult: () => {
|
|
337
337
|
draggedItemId: string;
|
|
338
338
|
targetItemId: string;
|
|
339
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
339
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
340
340
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
341
341
|
} | null;
|
|
342
342
|
dependencies: [(state: TreeViewState<[UseTreeViewItemsReorderingSignature]>) => {
|
|
@@ -344,7 +344,7 @@ export declare const selectorIsItemValidReorderingTarget: ((state: any, itemId:
|
|
|
344
344
|
currentReorder: {
|
|
345
345
|
draggedItemId: string;
|
|
346
346
|
targetItemId: string;
|
|
347
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
347
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
348
348
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
349
349
|
} | null;
|
|
350
350
|
}];
|
|
@@ -380,7 +380,7 @@ export declare const selectorCanItemBeReordered: ((state: any, itemId: string) =
|
|
|
380
380
|
currentReorder: {
|
|
381
381
|
draggedItemId: string;
|
|
382
382
|
targetItemId: string;
|
|
383
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
383
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
384
384
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
385
385
|
} | null;
|
|
386
386
|
}, resultFuncArgs_1: boolean, resultFuncArgs_2: string) => boolean;
|
|
@@ -389,7 +389,7 @@ export declare const selectorCanItemBeReordered: ((state: any, itemId: string) =
|
|
|
389
389
|
currentReorder: {
|
|
390
390
|
draggedItemId: string;
|
|
391
391
|
targetItemId: string;
|
|
392
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
392
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
393
393
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
394
394
|
} | null;
|
|
395
395
|
}, resultFuncArgs_1: boolean, resultFuncArgs_2: string) => boolean) & {
|
|
@@ -403,7 +403,7 @@ export declare const selectorCanItemBeReordered: ((state: any, itemId: string) =
|
|
|
403
403
|
currentReorder: {
|
|
404
404
|
draggedItemId: string;
|
|
405
405
|
targetItemId: string;
|
|
406
|
-
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
406
|
+
newPosition: import("./useTreeViewItemsReordering.types.js").TreeViewItemReorderPosition | null;
|
|
407
407
|
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
408
408
|
} | null;
|
|
409
409
|
}, ((state: import("@mui/x-tree-view/internals/corePlugins/useTreeViewId/useTreeViewId.types").UseTreeViewIdState & Partial<import("@mui/x-tree-view/internals/plugins/useTreeViewLabel/useTreeViewLabel.types").UseTreeViewLabelState> & {
|
package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createSelector, selectorItemMetaLookup,
|
|
1
|
+
import { createSelector, selectorItemMetaLookup, selectorIsAnyItemBeingEdited } from '@mui/x-tree-view/internals';
|
|
2
2
|
/**
|
|
3
3
|
* Get the items reordering state.
|
|
4
4
|
* @param {TreeViewState<[UseTreeViewItemsReorderingSignature]>} state The state of the tree view.
|
|
@@ -47,4 +47,4 @@ export const selectorIsItemValidReorderingTarget = createSelector([selectorCurre
|
|
|
47
47
|
* @param {string} itemId The id of the item.
|
|
48
48
|
* @returns {boolean} `true` if the items can be reordered, `false` otherwise.
|
|
49
49
|
*/
|
|
50
|
-
export const selectorCanItemBeReordered = createSelector([selectorItemsReordering,
|
|
50
|
+
export const selectorCanItemBeReordered = createSelector([selectorItemsReordering, selectorIsAnyItemBeingEdited, (_, itemId) => itemId], (itemsReordering, isEditing, itemId) => !isEditing && itemsReordering.isItemReorderable(itemId));
|
package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.d.ts
CHANGED
|
@@ -22,10 +22,14 @@ export interface UseTreeViewItemsReorderingInstance {
|
|
|
22
22
|
*/
|
|
23
23
|
startDraggingItem: (itemId: TreeViewItemId) => void;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
* @param {TreeViewItemId} itemId The id of the item to
|
|
25
|
+
* Complete the reordering of a given item.
|
|
26
|
+
* @param {TreeViewItemId} itemId The id of the item to complete the reordering for.
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
completeDraggingItem: (itemId: TreeViewItemId) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Cancel the current reordering operation and reset the state.
|
|
31
|
+
*/
|
|
32
|
+
cancelDraggingItem: () => void;
|
|
29
33
|
/**
|
|
30
34
|
* Set the new target item for the ongoing reordering.
|
|
31
35
|
* The action will be determined based on the position of the cursor inside the target and the valid actions for this target.
|
|
@@ -90,7 +94,7 @@ export interface UseTreeViewItemsReorderingParameters {
|
|
|
90
94
|
newPosition: TreeViewItemReorderPosition;
|
|
91
95
|
}) => void;
|
|
92
96
|
}
|
|
93
|
-
export type
|
|
97
|
+
export type UseTreeViewItemsReorderingParametersWithDefaults = DefaultizedProps<UseTreeViewItemsReorderingParameters, 'itemsReordering'>;
|
|
94
98
|
export interface UseTreeViewItemsReorderingState {
|
|
95
99
|
itemsReordering: {
|
|
96
100
|
isItemReorderable: (itemId: string) => boolean;
|
|
@@ -104,7 +108,7 @@ export interface UseTreeViewItemsReorderingState {
|
|
|
104
108
|
}
|
|
105
109
|
export type UseTreeViewItemsReorderingSignature = TreeViewPluginSignature<{
|
|
106
110
|
params: UseTreeViewItemsReorderingParameters;
|
|
107
|
-
|
|
111
|
+
paramsWithDefaults: UseTreeViewItemsReorderingParametersWithDefaults;
|
|
108
112
|
instance: UseTreeViewItemsReorderingInstance;
|
|
109
113
|
state: UseTreeViewItemsReorderingState;
|
|
110
114
|
dependencies: [UseTreeViewItemsSignature];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type * from
|
|
2
|
-
export type * from
|
|
3
|
-
export type * from
|
|
1
|
+
export type * from "./overrides.js";
|
|
2
|
+
export type * from "./props.js";
|
|
3
|
+
export type * from "./components.js";
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { RichTreeViewProClassKey } from "../RichTreeViewPro/index.js";
|
|
2
|
-
|
|
3
|
-
// prettier-ignore
|
|
4
2
|
export interface TreeViewComponentNameToClassKey {
|
|
5
3
|
MuiRichTreeViewPro: RichTreeViewProClassKey;
|
|
6
4
|
}
|
|
7
5
|
declare module '@mui/material/styles' {
|
|
8
6
|
interface ComponentNameToClassKey extends TreeViewComponentNameToClassKey {}
|
|
9
7
|
}
|
|
10
|
-
|
|
11
|
-
// disable automatic export
|
|
12
8
|
export {};
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { useTreeViewItemsReordering } from "./useTreeViewItemsReordering.js";
|
|
2
|
-
export type { UseTreeViewItemsReorderingSignature, UseTreeViewItemsReorderingParameters,
|
|
2
|
+
export type { UseTreeViewItemsReorderingSignature, UseTreeViewItemsReorderingParameters, UseTreeViewItemsReorderingParametersWithDefaults, TreeViewItemReorderPosition } from "./useTreeViewItemsReordering.types.js";
|
package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.js
CHANGED
|
@@ -73,7 +73,13 @@ const useTreeViewItemsReorderingItemPlugin = ({
|
|
|
73
73
|
if (event.defaultMuiPrevented) {
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
|
|
77
|
+
// Check if the drag-and-drop was cancelled, possibly by pressing Escape
|
|
78
|
+
if (event.dataTransfer.dropEffect === 'none') {
|
|
79
|
+
instance.cancelDraggingItem();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
instance.completeDraggingItem(itemId);
|
|
77
83
|
};
|
|
78
84
|
return {
|
|
79
85
|
draggable: true,
|
|
@@ -106,7 +106,18 @@ const useTreeViewItemsReordering = ({
|
|
|
106
106
|
});
|
|
107
107
|
});
|
|
108
108
|
}, [store]);
|
|
109
|
-
const
|
|
109
|
+
const cancelDraggingItem = React.useCallback(() => {
|
|
110
|
+
const currentReorder = (0, _useTreeViewItemsReordering3.selectorCurrentItemReordering)(store.value);
|
|
111
|
+
if (currentReorder == null) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
store.update(prevState => (0, _extends2.default)({}, prevState, {
|
|
115
|
+
itemsReordering: (0, _extends2.default)({}, prevState.itemsReordering, {
|
|
116
|
+
currentReorder: null
|
|
117
|
+
})
|
|
118
|
+
}));
|
|
119
|
+
}, [store]);
|
|
120
|
+
const completeDraggingItem = React.useCallback(itemId => {
|
|
110
121
|
const currentReorder = (0, _useTreeViewItemsReordering3.selectorCurrentItemReordering)(store.value);
|
|
111
122
|
if (currentReorder == null || currentReorder.draggedItemId !== itemId) {
|
|
112
123
|
return;
|
|
@@ -192,14 +203,15 @@ const useTreeViewItemsReordering = ({
|
|
|
192
203
|
canItemBeDragged,
|
|
193
204
|
getDroppingTargetValidActions,
|
|
194
205
|
startDraggingItem,
|
|
195
|
-
|
|
206
|
+
cancelDraggingItem,
|
|
207
|
+
completeDraggingItem,
|
|
196
208
|
setDragTargetItem
|
|
197
209
|
}
|
|
198
210
|
};
|
|
199
211
|
};
|
|
200
212
|
exports.useTreeViewItemsReordering = useTreeViewItemsReordering;
|
|
201
213
|
useTreeViewItemsReordering.itemPlugin = _useTreeViewItemsReordering2.useTreeViewItemsReorderingItemPlugin;
|
|
202
|
-
useTreeViewItemsReordering.
|
|
214
|
+
useTreeViewItemsReordering.applyDefaultValuesToParams = ({
|
|
203
215
|
params
|
|
204
216
|
}) => (0, _extends2.default)({}, params, {
|
|
205
217
|
itemsReordering: params.itemsReordering ?? false
|