@mui/x-tree-view-pro 8.0.0-alpha.8 → 8.0.0-beta.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 +2566 -687
- package/README.md +1 -1
- package/RichTreeViewPro/RichTreeViewPro.d.ts +5 -5
- package/RichTreeViewPro/RichTreeViewPro.js +101 -89
- package/RichTreeViewPro/RichTreeViewPro.plugins.d.ts +4 -5
- package/RichTreeViewPro/RichTreeViewPro.plugins.js +10 -3
- package/RichTreeViewPro/RichTreeViewPro.types.d.ts +38 -38
- package/RichTreeViewPro/RichTreeViewPro.types.js +5 -1
- package/RichTreeViewPro/index.d.ts +3 -3
- package/RichTreeViewPro/index.js +27 -3
- package/RichTreeViewPro/richTreeViewProClasses.d.ts +3 -3
- package/RichTreeViewPro/richTreeViewProClasses.js +13 -5
- package/esm/RichTreeViewPro/RichTreeViewPro.d.ts +20 -0
- package/{node → esm}/RichTreeViewPro/RichTreeViewPro.js +95 -95
- package/esm/RichTreeViewPro/RichTreeViewPro.plugins.d.ts +7 -0
- package/esm/RichTreeViewPro/RichTreeViewPro.plugins.js +6 -0
- package/esm/RichTreeViewPro/RichTreeViewPro.types.d.ts +51 -0
- package/esm/RichTreeViewPro/RichTreeViewPro.types.js +1 -0
- package/esm/RichTreeViewPro/index.d.ts +3 -0
- package/esm/RichTreeViewPro/index.js +3 -0
- package/esm/RichTreeViewPro/richTreeViewProClasses.d.ts +7 -0
- package/esm/RichTreeViewPro/richTreeViewProClasses.js +6 -0
- package/esm/index.d.ts +12 -0
- package/esm/index.js +22 -0
- package/esm/internals/index.d.ts +1 -0
- package/esm/internals/index.js +1 -0
- package/esm/internals/plugins/useTreeViewItemsReordering/index.d.ts +2 -0
- package/esm/internals/plugins/useTreeViewItemsReordering/index.js +1 -0
- package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.d.ts +3 -0
- package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.d.ts +3 -0
- package/{node → esm}/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.js +10 -19
- package/{node → esm}/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.js +29 -48
- package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.d.ts +183 -0
- package/{node → esm}/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.js +4 -11
- package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.d.ts +132 -0
- package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.js +1 -0
- package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.utils.d.ts +37 -0
- package/{node → esm}/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.utils.js +21 -31
- package/esm/internals/plugins/useTreeViewLazyLoading/index.d.ts +1 -0
- package/esm/internals/plugins/useTreeViewLazyLoading/index.js +1 -0
- package/esm/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.d.ts +3 -0
- package/esm/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.js +288 -0
- package/esm/internals/plugins/useTreeViewLazyLoading/utils.d.ts +32 -0
- package/esm/internals/plugins/useTreeViewLazyLoading/utils.js +85 -0
- package/esm/internals/utils/releaseInfo.d.ts +1 -0
- package/esm/internals/utils/releaseInfo.js +13 -0
- package/esm/internals/zero-styled/index.d.ts +3 -0
- package/esm/internals/zero-styled/index.js +7 -0
- package/esm/package.json +1 -0
- package/esm/themeAugmentation/components.d.ts +11 -0
- package/esm/themeAugmentation/index.d.ts +3 -0
- package/esm/themeAugmentation/index.js +0 -0
- package/esm/themeAugmentation/overrides.d.ts +12 -0
- package/esm/themeAugmentation/props.d.ts +10 -0
- package/index.d.ts +2 -2
- package/index.js +147 -15
- package/internals/index.d.ts +1 -1
- package/internals/index.js +12 -1
- package/internals/plugins/useTreeViewItemsReordering/index.d.ts +2 -2
- package/internals/plugins/useTreeViewItemsReordering/index.js +12 -1
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.d.ts +2 -2
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.d.ts +1 -1
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.js +19 -10
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.js +38 -39
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.d.ts +138 -134
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.js +11 -4
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.d.ts +108 -117
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.js +5 -1
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.utils.d.ts +28 -15
- package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.utils.js +31 -21
- package/internals/plugins/useTreeViewLazyLoading/index.d.ts +1 -0
- package/internals/plugins/useTreeViewLazyLoading/index.js +12 -0
- package/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.d.ts +3 -0
- package/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.js +297 -0
- package/internals/plugins/useTreeViewLazyLoading/utils.d.ts +32 -0
- package/internals/plugins/useTreeViewLazyLoading/utils.js +89 -0
- package/internals/utils/releaseInfo.d.ts +1 -1
- package/internals/utils/releaseInfo.js +13 -5
- package/internals/zero-styled/index.d.ts +1 -1
- package/internals/zero-styled/index.js +14 -4
- package/modern/RichTreeViewPro/RichTreeViewPro.d.ts +20 -0
- package/modern/RichTreeViewPro/RichTreeViewPro.js +21 -15
- package/modern/RichTreeViewPro/RichTreeViewPro.plugins.d.ts +7 -0
- package/modern/RichTreeViewPro/RichTreeViewPro.plugins.js +2 -1
- package/modern/RichTreeViewPro/RichTreeViewPro.types.d.ts +51 -0
- package/modern/RichTreeViewPro/index.d.ts +3 -0
- package/modern/RichTreeViewPro/richTreeViewProClasses.d.ts +7 -0
- package/modern/index.d.ts +12 -0
- package/modern/index.js +1 -1
- package/modern/internals/index.d.ts +1 -0
- package/modern/internals/plugins/useTreeViewItemsReordering/index.d.ts +2 -0
- package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.d.ts +3 -0
- package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.d.ts +3 -0
- package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.js +4 -14
- package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.d.ts +183 -0
- package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.d.ts +132 -0
- package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.utils.d.ts +37 -0
- package/modern/internals/plugins/useTreeViewLazyLoading/index.d.ts +1 -0
- package/modern/internals/plugins/useTreeViewLazyLoading/index.js +1 -0
- package/modern/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.d.ts +3 -0
- package/modern/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.js +288 -0
- package/modern/internals/plugins/useTreeViewLazyLoading/utils.d.ts +32 -0
- package/modern/internals/plugins/useTreeViewLazyLoading/utils.js +85 -0
- package/modern/internals/utils/releaseInfo.d.ts +1 -0
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/internals/zero-styled/index.d.ts +3 -0
- package/modern/package.json +1 -0
- package/modern/themeAugmentation/components.d.ts +11 -0
- package/modern/themeAugmentation/index.d.ts +3 -0
- package/modern/themeAugmentation/overrides.d.ts +12 -0
- package/modern/themeAugmentation/props.d.ts +10 -0
- package/package.json +43 -10
- package/themeAugmentation/components.d.ts +1 -3
- package/themeAugmentation/index.d.ts +1 -1
- package/themeAugmentation/index.js +1 -0
- package/themeAugmentation/overrides.d.ts +2 -3
- package/themeAugmentation/props.d.ts +2 -4
- package/tsconfig.build.tsbuildinfo +1 -0
- package/RichTreeViewPro/package.json +0 -6
- package/internals/package.json +0 -6
- package/node/RichTreeViewPro/RichTreeViewPro.plugins.js +0 -11
- package/node/RichTreeViewPro/RichTreeViewPro.types.js +0 -5
- package/node/RichTreeViewPro/index.js +0 -27
- package/node/RichTreeViewPro/richTreeViewProClasses.js +0 -14
- package/node/index.js +0 -154
- package/node/internals/index.js +0 -12
- package/node/internals/plugins/useTreeViewItemsReordering/index.js +0 -12
- package/node/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.js +0 -5
- package/node/internals/utils/releaseInfo.js +0 -21
- package/node/internals/zero-styled/index.js +0 -17
- package/node/themeAugmentation/index.js +0 -1
- package/themeAugmentation/package.json +0 -6
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
export { styled } from '@mui/material/styles';
|
|
1
|
+
"use strict";
|
|
3
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createUseThemeProps = createUseThemeProps;
|
|
7
|
+
Object.defineProperty(exports, "styled", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _styles.styled;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _styles = require("@mui/material/styles");
|
|
4
14
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
|
-
|
|
6
|
-
return useThemeProps;
|
|
15
|
+
function createUseThemeProps(name) {
|
|
16
|
+
return _styles.useThemeProps;
|
|
7
17
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RichTreeViewProProps } from "./RichTreeViewPro.types.js";
|
|
3
|
+
export declare const RichTreeViewProRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
4
|
+
ownerState: RichTreeViewProProps<any, any>;
|
|
5
|
+
}, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, keyof React.HTMLAttributes<HTMLUListElement> | keyof React.ClassAttributes<HTMLUListElement>>, {}>;
|
|
6
|
+
type RichTreeViewProComponent = (<R extends {}, Multiple extends boolean | undefined = undefined>(props: RichTreeViewProProps<R, Multiple> & React.RefAttributes<HTMLUListElement>) => React.JSX.Element) & {
|
|
7
|
+
propTypes?: any;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* Demos:
|
|
12
|
+
*
|
|
13
|
+
* - [Tree View](https://mui.com/x/react-tree-view/)
|
|
14
|
+
*
|
|
15
|
+
* API:
|
|
16
|
+
*
|
|
17
|
+
* - [RichTreeView API](https://mui.com/x/api/tree-view/rich-tree-view/)
|
|
18
|
+
*/
|
|
19
|
+
declare const RichTreeViewPro: RichTreeViewProComponent;
|
|
20
|
+
export { RichTreeViewPro };
|
|
@@ -106,8 +106,10 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
|
|
|
106
106
|
getItemDOMElement: PropTypes.func.isRequired,
|
|
107
107
|
getItemOrderedChildrenIds: PropTypes.func.isRequired,
|
|
108
108
|
getItemTree: PropTypes.func.isRequired,
|
|
109
|
-
|
|
109
|
+
getParentId: PropTypes.func.isRequired,
|
|
110
|
+
setIsItemDisabled: PropTypes.func.isRequired,
|
|
110
111
|
setItemExpansion: PropTypes.func.isRequired,
|
|
112
|
+
setItemSelection: PropTypes.func.isRequired,
|
|
111
113
|
updateItemLabel: PropTypes.func.isRequired
|
|
112
114
|
})
|
|
113
115
|
}),
|
|
@@ -130,6 +132,15 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
|
|
|
130
132
|
*/
|
|
131
133
|
classes: PropTypes.object,
|
|
132
134
|
className: PropTypes.string,
|
|
135
|
+
dataSource: PropTypes.shape({
|
|
136
|
+
getChildrenCount: PropTypes.func,
|
|
137
|
+
getTreeItems: PropTypes.func
|
|
138
|
+
}),
|
|
139
|
+
dataSourceCache: PropTypes.shape({
|
|
140
|
+
clear: PropTypes.func.isRequired,
|
|
141
|
+
get: PropTypes.func.isRequired,
|
|
142
|
+
set: PropTypes.func.isRequired
|
|
143
|
+
}),
|
|
133
144
|
/**
|
|
134
145
|
* Expanded item ids.
|
|
135
146
|
* Used when the item's expansion is not controlled.
|
|
@@ -168,8 +179,7 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
|
|
|
168
179
|
* the feature will be fully disabled and any property / method call will not have any effect.
|
|
169
180
|
*/
|
|
170
181
|
experimentalFeatures: PropTypes.shape({
|
|
171
|
-
|
|
172
|
-
labelEditing: PropTypes.bool
|
|
182
|
+
lazyLoading: PropTypes.bool
|
|
173
183
|
}),
|
|
174
184
|
/**
|
|
175
185
|
* Used to determine the id of a given item.
|
|
@@ -202,17 +212,15 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
|
|
|
202
212
|
*/
|
|
203
213
|
isItemDisabled: PropTypes.func,
|
|
204
214
|
/**
|
|
205
|
-
*
|
|
206
|
-
* Make sure to also enable the `labelEditing` experimental feature:
|
|
207
|
-
* `<RichTreeViewPro experimentalFeatures={{ labelEditing: true }} />`.
|
|
208
|
-
* By default, the items are not editable.
|
|
215
|
+
* Determine if a given item can be edited.
|
|
209
216
|
* @template R
|
|
210
217
|
* @param {R} item The item to check.
|
|
211
|
-
* @returns {boolean} `true` if the item
|
|
218
|
+
* @returns {boolean} `true` if the item can be edited.
|
|
219
|
+
* @default () => false
|
|
212
220
|
*/
|
|
213
221
|
isItemEditable: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
|
214
222
|
/**
|
|
215
|
-
*
|
|
223
|
+
* Determine if a given item can be reordered.
|
|
216
224
|
* @param {string} itemId The id of the item to check.
|
|
217
225
|
* @returns {boolean} `true` if the item can be reordered.
|
|
218
226
|
* @default () => true
|
|
@@ -227,8 +235,6 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
|
|
|
227
235
|
items: PropTypes.array.isRequired,
|
|
228
236
|
/**
|
|
229
237
|
* If `true`, the reordering of items is enabled.
|
|
230
|
-
* Make sure to also enable the `itemsReordering` experimental feature:
|
|
231
|
-
* `<RichTreeViewPro experimentalFeatures={{ itemsReordering: true }} itemsReordering />`.
|
|
232
238
|
* @default false
|
|
233
239
|
*/
|
|
234
240
|
itemsReordering: PropTypes.bool,
|
|
@@ -239,7 +245,7 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
|
|
|
239
245
|
multiSelect: PropTypes.bool,
|
|
240
246
|
/**
|
|
241
247
|
* Callback fired when Tree Items are expanded/collapsed.
|
|
242
|
-
* @param {React.SyntheticEvent} event The DOM event that triggered the change.
|
|
248
|
+
* @param {React.SyntheticEvent} event The DOM event that triggered the change. Can be null when the change is caused by the `publicAPI.setItemExpansion()` method.
|
|
243
249
|
* @param {array} itemIds The ids of the expanded items.
|
|
244
250
|
*/
|
|
245
251
|
onExpandedItemsChange: PropTypes.func,
|
|
@@ -251,7 +257,7 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
|
|
|
251
257
|
onItemClick: PropTypes.func,
|
|
252
258
|
/**
|
|
253
259
|
* Callback fired when a Tree Item is expanded or collapsed.
|
|
254
|
-
* @param {React.SyntheticEvent} event The DOM event that triggered the change.
|
|
260
|
+
* @param {React.SyntheticEvent | null} event The DOM event that triggered the change. Can be null when the change is caused by the `publicAPI.setItemExpansion()` method.
|
|
255
261
|
* @param {array} itemId The itemId of the modified item.
|
|
256
262
|
* @param {array} isExpanded `true` if the item has just been expanded, `false` if it has just been collapsed.
|
|
257
263
|
*/
|
|
@@ -278,14 +284,14 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
|
|
|
278
284
|
onItemPositionChange: PropTypes.func,
|
|
279
285
|
/**
|
|
280
286
|
* Callback fired when a Tree Item is selected or deselected.
|
|
281
|
-
* @param {React.SyntheticEvent} event The DOM event that triggered the change.
|
|
287
|
+
* @param {React.SyntheticEvent} event The DOM event that triggered the change. Can be null when the change is caused by the `publicAPI.setItemSelection()` method.
|
|
282
288
|
* @param {array} itemId The itemId of the modified item.
|
|
283
289
|
* @param {array} isSelected `true` if the item has just been selected, `false` if it has just been deselected.
|
|
284
290
|
*/
|
|
285
291
|
onItemSelectionToggle: PropTypes.func,
|
|
286
292
|
/**
|
|
287
293
|
* Callback fired when Tree Items are selected/deselected.
|
|
288
|
-
* @param {React.SyntheticEvent} event The DOM event that triggered the change.
|
|
294
|
+
* @param {React.SyntheticEvent} event The DOM event that triggered the change. Can be null when the change is caused by the `publicAPI.setItemSelection()` method.
|
|
289
295
|
* @param {string[] | string} itemIds The ids of the selected items.
|
|
290
296
|
* When `multiSelect` is `true`, this is an array of strings; when false (default) a string.
|
|
291
297
|
*/
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UseTreeViewItemsParameters, UseTreeViewExpansionParameters, UseTreeViewSelectionParameters, UseTreeViewFocusParameters, UseTreeViewIconsParameters, ConvertPluginsIntoSignatures, MergeSignaturesProperty, TreeViewCorePluginParameters, UseTreeViewLabelParameters, UseTreeViewLazyLoadingParameters } from '@mui/x-tree-view/internals';
|
|
2
|
+
import { UseTreeViewItemsReorderingParameters } from "../internals/plugins/useTreeViewItemsReordering/index.js";
|
|
3
|
+
export declare const RICH_TREE_VIEW_PRO_PLUGINS: readonly [import("@mui/x-tree-view/internals").TreeViewPlugin<import("@mui/x-tree-view/internals").UseTreeViewItemsSignature>, import("@mui/x-tree-view/internals").TreeViewPlugin<import("@mui/x-tree-view/internals").UseTreeViewExpansionSignature>, import("@mui/x-tree-view/internals").TreeViewPlugin<import("@mui/x-tree-view/internals").UseTreeViewSelectionSignature>, import("@mui/x-tree-view/internals").TreeViewPlugin<import("@mui/x-tree-view/internals").UseTreeViewFocusSignature>, import("@mui/x-tree-view/internals").TreeViewPlugin<import("@mui/x-tree-view/internals").UseTreeViewKeyboardNavigationSignature>, import("@mui/x-tree-view/internals").TreeViewPlugin<import("@mui/x-tree-view/internals").UseTreeViewIconsSignature>, import("@mui/x-tree-view/internals").TreeViewPlugin<import("@mui/x-tree-view/internals").UseTreeViewLabelSignature>, import("@mui/x-tree-view/internals").TreeViewPlugin<import("@mui/x-tree-view/internals").UseTreeViewLazyLoadingSignature>, import("@mui/x-tree-view/internals").TreeViewPlugin<import("../internals").UseTreeViewItemsReorderingSignature>];
|
|
4
|
+
export type RichTreeViewProPluginSignatures = ConvertPluginsIntoSignatures<typeof RICH_TREE_VIEW_PRO_PLUGINS>;
|
|
5
|
+
export type RichTreeViewProPluginSlots = MergeSignaturesProperty<RichTreeViewProPluginSignatures, 'slots'>;
|
|
6
|
+
export type RichTreeViewProPluginSlotProps = MergeSignaturesProperty<RichTreeViewProPluginSignatures, 'slotProps'>;
|
|
7
|
+
export interface RichTreeViewProPluginParameters<R extends {}, Multiple extends boolean | undefined> extends TreeViewCorePluginParameters, UseTreeViewItemsParameters<R>, UseTreeViewExpansionParameters, UseTreeViewFocusParameters, UseTreeViewSelectionParameters<Multiple>, UseTreeViewIconsParameters, UseTreeViewLabelParameters<R>, UseTreeViewLazyLoadingParameters<R>, UseTreeViewItemsReorderingParameters {}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useTreeViewItems, useTreeViewExpansion, useTreeViewSelection, useTreeViewFocus, useTreeViewKeyboardNavigation, useTreeViewIcons, useTreeViewLabel } from '@mui/x-tree-view/internals';
|
|
2
2
|
import { useTreeViewItemsReordering } from "../internals/plugins/useTreeViewItemsReordering/index.js";
|
|
3
|
-
|
|
3
|
+
import { useTreeViewLazyLoading } from "../internals/plugins/useTreeViewLazyLoading/index.js";
|
|
4
|
+
export const RICH_TREE_VIEW_PRO_PLUGINS = [useTreeViewItems, useTreeViewExpansion, useTreeViewSelection, useTreeViewFocus, useTreeViewKeyboardNavigation, useTreeViewIcons, useTreeViewLabel, useTreeViewLazyLoading, useTreeViewItemsReordering];
|
|
4
5
|
|
|
5
6
|
// We can't infer this type from the plugin, otherwise we would lose the generics.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Theme } from '@mui/material/styles';
|
|
3
|
+
import { SxProps } from '@mui/system/styleFunctionSx';
|
|
4
|
+
import { SlotComponentProps } from '@mui/utils/types';
|
|
5
|
+
import { TreeViewPublicAPI, TreeViewExperimentalFeatures, RichTreeViewItemsSlots, RichTreeViewItemsSlotProps } from '@mui/x-tree-view/internals';
|
|
6
|
+
import { RichTreeViewProClasses } from "./richTreeViewProClasses.js";
|
|
7
|
+
import { RichTreeViewProPluginParameters, RichTreeViewProPluginSlotProps, RichTreeViewProPluginSlots, RichTreeViewProPluginSignatures } from "./RichTreeViewPro.plugins.js";
|
|
8
|
+
export interface RichTreeViewProSlots extends RichTreeViewProPluginSlots, RichTreeViewItemsSlots {
|
|
9
|
+
/**
|
|
10
|
+
* Element rendered at the root.
|
|
11
|
+
* @default RichTreeViewProRoot
|
|
12
|
+
*/
|
|
13
|
+
root?: React.ElementType;
|
|
14
|
+
}
|
|
15
|
+
export interface RichTreeViewProSlotProps<R extends {}, Multiple extends boolean | undefined> extends RichTreeViewProPluginSlotProps, RichTreeViewItemsSlotProps {
|
|
16
|
+
root?: SlotComponentProps<'ul', {}, RichTreeViewProProps<R, Multiple>>;
|
|
17
|
+
}
|
|
18
|
+
export type RichTreeViewProApiRef = React.RefObject<TreeViewPublicAPI<RichTreeViewProPluginSignatures> | undefined>;
|
|
19
|
+
export interface RichTreeViewProPropsBase extends React.HTMLAttributes<HTMLUListElement> {
|
|
20
|
+
className?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Override or extend the styles applied to the component.
|
|
23
|
+
*/
|
|
24
|
+
classes?: Partial<RichTreeViewProClasses>;
|
|
25
|
+
/**
|
|
26
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
27
|
+
*/
|
|
28
|
+
sx?: SxProps<Theme>;
|
|
29
|
+
}
|
|
30
|
+
export interface RichTreeViewProProps<R extends {}, Multiple extends boolean | undefined> extends RichTreeViewProPluginParameters<R, Multiple>, RichTreeViewProPropsBase {
|
|
31
|
+
/**
|
|
32
|
+
* Overridable component slots.
|
|
33
|
+
* @default {}
|
|
34
|
+
*/
|
|
35
|
+
slots?: RichTreeViewProSlots;
|
|
36
|
+
/**
|
|
37
|
+
* The props used for each component slot.
|
|
38
|
+
* @default {}
|
|
39
|
+
*/
|
|
40
|
+
slotProps?: RichTreeViewProSlotProps<R, Multiple>;
|
|
41
|
+
/**
|
|
42
|
+
* The ref object that allows Tree View manipulation. Can be instantiated with `useTreeViewApiRef()`.
|
|
43
|
+
*/
|
|
44
|
+
apiRef?: RichTreeViewProApiRef;
|
|
45
|
+
/**
|
|
46
|
+
* Unstable features, breaking changes might be introduced.
|
|
47
|
+
* For each feature, if the flag is not explicitly set to `true`,
|
|
48
|
+
* the feature will be fully disabled and any property / method call will not have any effect.
|
|
49
|
+
*/
|
|
50
|
+
experimentalFeatures?: TreeViewExperimentalFeatures<RichTreeViewProPluginSignatures>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface RichTreeViewProClasses {
|
|
2
|
+
/** Styles applied to the root element. */
|
|
3
|
+
root: string;
|
|
4
|
+
}
|
|
5
|
+
export type RichTreeViewProClassKey = keyof RichTreeViewProClasses;
|
|
6
|
+
export declare function getRichTreeViewProUtilityClass(slot: string): string;
|
|
7
|
+
export declare const richTreeViewProClasses: RichTreeViewProClasses;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from '@mui/x-tree-view/SimpleTreeView';
|
|
2
|
+
export * from "./RichTreeViewPro/index.js";
|
|
3
|
+
export * from '@mui/x-tree-view/TreeItem';
|
|
4
|
+
export * from '@mui/x-tree-view/useTreeItem';
|
|
5
|
+
export * from '@mui/x-tree-view/TreeItemIcon';
|
|
6
|
+
export * from '@mui/x-tree-view/TreeItemProvider';
|
|
7
|
+
export * from '@mui/x-tree-view/TreeItemDragAndDropOverlay';
|
|
8
|
+
export * from '@mui/x-tree-view/TreeItemLabelInput';
|
|
9
|
+
export { unstable_resetCleanupTracking } from '@mui/x-tree-view/internals';
|
|
10
|
+
export * from '@mui/x-tree-view/models';
|
|
11
|
+
export * from '@mui/x-tree-view/icons';
|
|
12
|
+
export * from '@mui/x-tree-view/hooks';
|
package/modern/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UseTreeViewItemsReorderingSignature } from "./plugins/useTreeViewItemsReordering/index.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { useTreeViewItemsReordering } from "./useTreeViewItemsReordering.js";
|
|
2
|
+
export type { UseTreeViewItemsReorderingSignature, UseTreeViewItemsReorderingParameters, UseTreeViewItemsReorderingDefaultizedParameters, TreeViewItemReorderPosition } from './useTreeViewItemsReordering.types';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { selectorItemIndex, selectorItemMeta, selectorItemOrderedChildrenIds } from '@mui/x-tree-view/internals';
|
|
4
|
-
import { warnOnce } from '@mui/x-internals/warning';
|
|
5
4
|
import { chooseActionToApply, isAncestor, moveItemInTree } from "./useTreeViewItemsReordering.utils.js";
|
|
6
5
|
import { useTreeViewItemsReorderingItemPlugin } from "./useTreeViewItemsReordering.itemPlugin.js";
|
|
7
6
|
import { selectorItemsReordering } from "./useTreeViewItemsReordering.selectors.js";
|
|
@@ -176,19 +175,10 @@ export const useTreeViewItemsReordering = ({
|
|
|
176
175
|
};
|
|
177
176
|
useTreeViewItemsReordering.itemPlugin = useTreeViewItemsReorderingItemPlugin;
|
|
178
177
|
useTreeViewItemsReordering.getDefaultizedParams = ({
|
|
179
|
-
params
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
184
|
-
if (params.itemsReordering && !canUseFeature) {
|
|
185
|
-
warnOnce(['MUI X: The items reordering feature requires the `itemsReordering` experimental feature to be enabled.', 'You can do it by passing `experimentalFeatures={{ itemsReordering: true }}` to the `<RichTreeViewPro />`component.', 'Check the documentation for more details: https://mui.com/x/react-tree-view/rich-tree-view/items/']);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
return _extends({}, params, {
|
|
189
|
-
itemsReordering: canUseFeature ? params.itemsReordering ?? false : false
|
|
190
|
-
});
|
|
191
|
-
};
|
|
178
|
+
params
|
|
179
|
+
}) => _extends({}, params, {
|
|
180
|
+
itemsReordering: params.itemsReordering ?? false
|
|
181
|
+
});
|
|
192
182
|
useTreeViewItemsReordering.getInitialState = () => ({
|
|
193
183
|
itemsReordering: null
|
|
194
184
|
});
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { TreeViewState } from '@mui/x-tree-view/internals';
|
|
2
|
+
import { UseTreeViewItemsReorderingSignature } from "./useTreeViewItemsReordering.types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Get the items reordering state.
|
|
5
|
+
* @param {TreeViewState<[UseTreeViewItemsReorderingSignature]>} state The state of the tree view.
|
|
6
|
+
* @returns {TreeViewItemsReorderingState | null} The items reordering state.
|
|
7
|
+
*/
|
|
8
|
+
export declare const selectorItemsReordering: (state: TreeViewState<[UseTreeViewItemsReorderingSignature]>) => {
|
|
9
|
+
draggedItemId: string;
|
|
10
|
+
targetItemId: string;
|
|
11
|
+
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
12
|
+
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
13
|
+
} | null;
|
|
14
|
+
/**
|
|
15
|
+
* Get the properties of the dragged item.
|
|
16
|
+
* @param {TreeViewState<[UseTreeViewItemsSignature, UseTreeViewItemsReorderingSignature]>} state The state of the tree view.
|
|
17
|
+
* @param {string} itemId The id of the item.
|
|
18
|
+
* @returns {TreeViewItemDraggedItemProperties | null} The properties of the dragged item if the current item is being dragged, `null` otherwise.
|
|
19
|
+
*/
|
|
20
|
+
export declare const selectorItemsReorderingDraggedItemProperties: ((state: any, itemId: string) => {
|
|
21
|
+
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
22
|
+
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction;
|
|
23
|
+
targetDepth: number;
|
|
24
|
+
} | null) & {
|
|
25
|
+
clearCache: () => void;
|
|
26
|
+
resultsCount: () => number;
|
|
27
|
+
resetResultsCount: () => void;
|
|
28
|
+
} & {
|
|
29
|
+
resultFunc: (resultFuncArgs_0: {
|
|
30
|
+
draggedItemId: string;
|
|
31
|
+
targetItemId: string;
|
|
32
|
+
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
33
|
+
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
34
|
+
} | null, resultFuncArgs_1: {
|
|
35
|
+
[itemId: string]: import("@mui/x-tree-view/internals").TreeViewItemMeta;
|
|
36
|
+
}, resultFuncArgs_2: string) => {
|
|
37
|
+
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
38
|
+
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction;
|
|
39
|
+
targetDepth: number;
|
|
40
|
+
} | null;
|
|
41
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
42
|
+
draggedItemId: string;
|
|
43
|
+
targetItemId: string;
|
|
44
|
+
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
45
|
+
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
46
|
+
} | null, resultFuncArgs_1: {
|
|
47
|
+
[itemId: string]: import("@mui/x-tree-view/internals").TreeViewItemMeta;
|
|
48
|
+
}, resultFuncArgs_2: string) => {
|
|
49
|
+
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
50
|
+
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction;
|
|
51
|
+
targetDepth: number;
|
|
52
|
+
} | null) & {
|
|
53
|
+
clearCache: () => void;
|
|
54
|
+
resultsCount: () => number;
|
|
55
|
+
resetResultsCount: () => void;
|
|
56
|
+
};
|
|
57
|
+
lastResult: () => {
|
|
58
|
+
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
59
|
+
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction;
|
|
60
|
+
targetDepth: number;
|
|
61
|
+
} | null;
|
|
62
|
+
dependencies: [(state: TreeViewState<[UseTreeViewItemsReorderingSignature]>) => {
|
|
63
|
+
draggedItemId: string;
|
|
64
|
+
targetItemId: string;
|
|
65
|
+
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
66
|
+
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
67
|
+
} | null, ((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<{}> & {
|
|
68
|
+
cacheKey: import("@mui/x-tree-view/internals/models").TreeViewStateCacheKey;
|
|
69
|
+
}) => {
|
|
70
|
+
[itemId: string]: import("@mui/x-tree-view/internals").TreeViewItemMeta;
|
|
71
|
+
}) & {
|
|
72
|
+
clearCache: () => void;
|
|
73
|
+
resultsCount: () => number;
|
|
74
|
+
resetResultsCount: () => void;
|
|
75
|
+
} & {
|
|
76
|
+
resultFunc: (resultFuncArgs_0: {
|
|
77
|
+
disabledItemsFocusable: boolean;
|
|
78
|
+
itemModelLookup: {
|
|
79
|
+
[itemId: string]: import("@mui/x-tree-view").TreeViewBaseItem<import("@mui/x-tree-view").TreeViewDefaultItemModelProperties>;
|
|
80
|
+
};
|
|
81
|
+
itemMetaLookup: {
|
|
82
|
+
[itemId: string]: import("@mui/x-tree-view/internals").TreeViewItemMeta;
|
|
83
|
+
};
|
|
84
|
+
itemOrderedChildrenIdsLookup: {
|
|
85
|
+
[parentItemId: string]: string[];
|
|
86
|
+
};
|
|
87
|
+
itemChildrenIndexesLookup: {
|
|
88
|
+
[parentItemId: string]: {
|
|
89
|
+
[itemId: string]: number;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
loading: boolean;
|
|
93
|
+
error: Error | null;
|
|
94
|
+
}) => {
|
|
95
|
+
[itemId: string]: import("@mui/x-tree-view/internals").TreeViewItemMeta;
|
|
96
|
+
};
|
|
97
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
98
|
+
disabledItemsFocusable: boolean;
|
|
99
|
+
itemModelLookup: {
|
|
100
|
+
[itemId: string]: import("@mui/x-tree-view").TreeViewBaseItem<import("@mui/x-tree-view").TreeViewDefaultItemModelProperties>;
|
|
101
|
+
};
|
|
102
|
+
itemMetaLookup: {
|
|
103
|
+
[itemId: string]: import("@mui/x-tree-view/internals").TreeViewItemMeta;
|
|
104
|
+
};
|
|
105
|
+
itemOrderedChildrenIdsLookup: {
|
|
106
|
+
[parentItemId: string]: string[];
|
|
107
|
+
};
|
|
108
|
+
itemChildrenIndexesLookup: {
|
|
109
|
+
[parentItemId: string]: {
|
|
110
|
+
[itemId: string]: number;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
loading: boolean;
|
|
114
|
+
error: Error | null;
|
|
115
|
+
}) => {
|
|
116
|
+
[itemId: string]: import("@mui/x-tree-view/internals").TreeViewItemMeta;
|
|
117
|
+
}) & {
|
|
118
|
+
clearCache: () => void;
|
|
119
|
+
resultsCount: () => number;
|
|
120
|
+
resetResultsCount: () => void;
|
|
121
|
+
};
|
|
122
|
+
lastResult: () => {
|
|
123
|
+
[itemId: string]: import("@mui/x-tree-view/internals").TreeViewItemMeta;
|
|
124
|
+
};
|
|
125
|
+
dependencies: [import("@mui/x-tree-view/internals/utils/selectors").TreeViewRootSelector<import("@mui/x-tree-view/internals").UseTreeViewItemsSignature>];
|
|
126
|
+
recomputations: () => number;
|
|
127
|
+
resetRecomputations: () => void;
|
|
128
|
+
dependencyRecomputations: () => number;
|
|
129
|
+
resetDependencyRecomputations: () => void;
|
|
130
|
+
} & {
|
|
131
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
132
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
133
|
+
}, (_: any, itemId: string) => string];
|
|
134
|
+
recomputations: () => number;
|
|
135
|
+
resetRecomputations: () => void;
|
|
136
|
+
dependencyRecomputations: () => number;
|
|
137
|
+
resetDependencyRecomputations: () => void;
|
|
138
|
+
} & {
|
|
139
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
140
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Check if the current item is a valid target for the dragged item.
|
|
144
|
+
* @param {TreeViewState<[UseTreeViewItemsReorderingSignature]>} state The state of the tree view.
|
|
145
|
+
* @param {string} itemId The id of the item.
|
|
146
|
+
* @returns {boolean} `true` if the current item is a valid target for the dragged item, `false` otherwise.
|
|
147
|
+
*/
|
|
148
|
+
export declare const selectorItemsReorderingIsValidTarget: ((state: any, itemId: string) => boolean | null) & {
|
|
149
|
+
clearCache: () => void;
|
|
150
|
+
resultsCount: () => number;
|
|
151
|
+
resetResultsCount: () => void;
|
|
152
|
+
} & {
|
|
153
|
+
resultFunc: (resultFuncArgs_0: {
|
|
154
|
+
draggedItemId: string;
|
|
155
|
+
targetItemId: string;
|
|
156
|
+
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
157
|
+
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
158
|
+
} | null, resultFuncArgs_1: string) => boolean | null;
|
|
159
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
160
|
+
draggedItemId: string;
|
|
161
|
+
targetItemId: string;
|
|
162
|
+
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
163
|
+
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
164
|
+
} | null, resultFuncArgs_1: string) => boolean | null) & {
|
|
165
|
+
clearCache: () => void;
|
|
166
|
+
resultsCount: () => number;
|
|
167
|
+
resetResultsCount: () => void;
|
|
168
|
+
};
|
|
169
|
+
lastResult: () => boolean | null;
|
|
170
|
+
dependencies: [(state: TreeViewState<[UseTreeViewItemsReorderingSignature]>) => {
|
|
171
|
+
draggedItemId: string;
|
|
172
|
+
targetItemId: string;
|
|
173
|
+
newPosition: import("./useTreeViewItemsReordering.types").TreeViewItemReorderPosition | null;
|
|
174
|
+
action: import("@mui/x-tree-view").TreeViewItemsReorderingAction | null;
|
|
175
|
+
} | null, (_: any, itemId: string) => string];
|
|
176
|
+
recomputations: () => number;
|
|
177
|
+
resetRecomputations: () => void;
|
|
178
|
+
dependencyRecomputations: () => number;
|
|
179
|
+
resetDependencyRecomputations: () => void;
|
|
180
|
+
} & {
|
|
181
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
182
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
183
|
+
};
|
package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.d.ts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
3
|
+
import { TreeViewPluginSignature, UseTreeViewItemsSignature } from '@mui/x-tree-view/internals';
|
|
4
|
+
import { TreeViewItemId, TreeViewItemsReorderingAction, TreeViewCancellableEventHandler } from '@mui/x-tree-view/models';
|
|
5
|
+
import { TreeItemDragAndDropOverlayProps } from '@mui/x-tree-view/TreeItemDragAndDropOverlay';
|
|
6
|
+
export interface UseTreeViewItemsReorderingInstance {
|
|
7
|
+
/**
|
|
8
|
+
* Check if a given item can be dragged.
|
|
9
|
+
* @param {TreeViewItemId} itemId The id of the item to check.
|
|
10
|
+
* @returns {boolean} `true` if the item can be dragged, `false` otherwise.
|
|
11
|
+
*/
|
|
12
|
+
canItemBeDragged: (itemId: TreeViewItemId) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Get the valid reordering action if a given item is the target of the ongoing reordering.
|
|
15
|
+
* @param {TreeViewItemId} itemId The id of the item to get the action of.
|
|
16
|
+
* @returns {TreeViewItemItemReorderingValidActions} The valid actions for the item.
|
|
17
|
+
*/
|
|
18
|
+
getDroppingTargetValidActions: (itemId: TreeViewItemId) => TreeViewItemItemReorderingValidActions;
|
|
19
|
+
/**
|
|
20
|
+
* Start a reordering for the given item.
|
|
21
|
+
* @param {TreeViewItemId} itemId The id of the item to start the reordering for.
|
|
22
|
+
*/
|
|
23
|
+
startDraggingItem: (itemId: TreeViewItemId) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Stop the reordering of a given item.
|
|
26
|
+
* @param {TreeViewItemId} itemId The id of the item to stop the reordering for.
|
|
27
|
+
*/
|
|
28
|
+
stopDraggingItem: (itemId: TreeViewItemId) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Set the new target item for the ongoing reordering.
|
|
31
|
+
* The action will be determined based on the position of the cursor inside the target and the valid actions for this target.
|
|
32
|
+
* @param {object} params The params describing the new target item.
|
|
33
|
+
* @param {TreeViewItemId} params.itemId The id of the new target item.
|
|
34
|
+
* @param {TreeViewItemItemReorderingValidActions} params.validActions The valid actions for the new target item.
|
|
35
|
+
* @param {number} params.targetHeight The height of the target item.
|
|
36
|
+
* @param {number} params.cursorY The Y coordinate of the mouse cursor.
|
|
37
|
+
* @param {number} params.cursorX The X coordinate of the mouse cursor.
|
|
38
|
+
* @param {HTMLDivElement} params.contentElement The DOM element rendered for the content slot.
|
|
39
|
+
*/
|
|
40
|
+
setDragTargetItem: (params: {
|
|
41
|
+
itemId: TreeViewItemId;
|
|
42
|
+
validActions: TreeViewItemItemReorderingValidActions;
|
|
43
|
+
targetHeight: number;
|
|
44
|
+
cursorY: number;
|
|
45
|
+
cursorX: number;
|
|
46
|
+
contentElement: HTMLDivElement;
|
|
47
|
+
}) => void;
|
|
48
|
+
}
|
|
49
|
+
export interface TreeViewItemReorderPosition {
|
|
50
|
+
parentId: string | null;
|
|
51
|
+
index: number;
|
|
52
|
+
}
|
|
53
|
+
export type TreeViewItemItemReorderingValidActions = { [key in TreeViewItemsReorderingAction]?: TreeViewItemReorderPosition };
|
|
54
|
+
export interface UseTreeViewItemsReorderingParameters {
|
|
55
|
+
/**
|
|
56
|
+
* If `true`, the reordering of items is enabled.
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
|
+
itemsReordering?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Determine if a given item can be reordered.
|
|
62
|
+
* @param {string} itemId The id of the item to check.
|
|
63
|
+
* @returns {boolean} `true` if the item can be reordered.
|
|
64
|
+
* @default () => true
|
|
65
|
+
*/
|
|
66
|
+
isItemReorderable?: (itemId: string) => boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Used to determine if a given item can move to some new position.
|
|
69
|
+
* @param {object} params The params describing the item re-ordering.
|
|
70
|
+
* @param {string} params.itemId The id of the item that is being moved to a new position.
|
|
71
|
+
* @param {TreeViewItemReorderPosition} params.oldPosition The old position of the item.
|
|
72
|
+
* @param {TreeViewItemReorderPosition} params.newPosition The new position of the item.
|
|
73
|
+
* @returns {boolean} `true` if the item can move to the new position.
|
|
74
|
+
*/
|
|
75
|
+
canMoveItemToNewPosition?: (params: {
|
|
76
|
+
itemId: string;
|
|
77
|
+
oldPosition: TreeViewItemReorderPosition;
|
|
78
|
+
newPosition: TreeViewItemReorderPosition;
|
|
79
|
+
}) => boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Callback fired when a Tree Item is moved in the tree.
|
|
82
|
+
* @param {object} params The params describing the item re-ordering.
|
|
83
|
+
* @param {string} params.itemId The id of the item moved.
|
|
84
|
+
* @param {TreeViewItemReorderPosition} params.oldPosition The old position of the item.
|
|
85
|
+
* @param {TreeViewItemReorderPosition} params.newPosition The new position of the item.
|
|
86
|
+
*/
|
|
87
|
+
onItemPositionChange?: (params: {
|
|
88
|
+
itemId: string;
|
|
89
|
+
oldPosition: TreeViewItemReorderPosition;
|
|
90
|
+
newPosition: TreeViewItemReorderPosition;
|
|
91
|
+
}) => void;
|
|
92
|
+
}
|
|
93
|
+
export type UseTreeViewItemsReorderingDefaultizedParameters = DefaultizedProps<UseTreeViewItemsReorderingParameters, 'itemsReordering'>;
|
|
94
|
+
export interface UseTreeViewItemsReorderingState {
|
|
95
|
+
itemsReordering: {
|
|
96
|
+
draggedItemId: string;
|
|
97
|
+
targetItemId: string;
|
|
98
|
+
newPosition: TreeViewItemReorderPosition | null;
|
|
99
|
+
action: TreeViewItemsReorderingAction | null;
|
|
100
|
+
} | null;
|
|
101
|
+
}
|
|
102
|
+
interface UseTreeViewItemsReorderingContextValue {
|
|
103
|
+
itemsReordering: {
|
|
104
|
+
enabled: boolean;
|
|
105
|
+
isItemReorderable: ((itemId: string) => boolean) | undefined;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
export type UseTreeViewItemsReorderingSignature = TreeViewPluginSignature<{
|
|
109
|
+
params: UseTreeViewItemsReorderingParameters;
|
|
110
|
+
defaultizedParams: UseTreeViewItemsReorderingDefaultizedParameters;
|
|
111
|
+
instance: UseTreeViewItemsReorderingInstance;
|
|
112
|
+
state: UseTreeViewItemsReorderingState;
|
|
113
|
+
contextValue: UseTreeViewItemsReorderingContextValue;
|
|
114
|
+
dependencies: [UseTreeViewItemsSignature];
|
|
115
|
+
}>;
|
|
116
|
+
export interface UseTreeItemRootSlotPropsFromItemsReordering {
|
|
117
|
+
draggable?: true;
|
|
118
|
+
onDragStart?: TreeViewCancellableEventHandler<React.DragEvent>;
|
|
119
|
+
onDragOver?: TreeViewCancellableEventHandler<React.DragEvent>;
|
|
120
|
+
onDragEnd?: TreeViewCancellableEventHandler<React.DragEvent>;
|
|
121
|
+
}
|
|
122
|
+
export interface UseTreeItemContentSlotPropsFromItemsReordering {
|
|
123
|
+
onDragEnter?: TreeViewCancellableEventHandler<React.DragEvent>;
|
|
124
|
+
onDragOver?: TreeViewCancellableEventHandler<React.DragEvent>;
|
|
125
|
+
}
|
|
126
|
+
export interface UseTreeItemDragAndDropOverlaySlotPropsFromItemsReordering extends TreeItemDragAndDropOverlayProps {}
|
|
127
|
+
declare module '@mui/x-tree-view/useTreeItem' {
|
|
128
|
+
interface UseTreeItemRootSlotOwnProps extends UseTreeItemRootSlotPropsFromItemsReordering {}
|
|
129
|
+
interface UseTreeItemContentSlotOwnProps extends UseTreeItemContentSlotPropsFromItemsReordering {}
|
|
130
|
+
interface UseTreeItemDragAndDropOverlaySlotOwnProps extends UseTreeItemDragAndDropOverlaySlotPropsFromItemsReordering {}
|
|
131
|
+
}
|
|
132
|
+
export {};
|