@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
|
@@ -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 };
|
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
'use client';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var _zeroStyled = require("../internals/zero-styled");
|
|
19
|
-
var _richTreeViewProClasses = require("./richTreeViewProClasses");
|
|
20
|
-
var _RichTreeViewPro = require("./RichTreeViewPro.plugins");
|
|
21
|
-
var _releaseInfo = require("../internals/utils/releaseInfo");
|
|
22
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
-
const useThemeProps = (0, _zeroStyled.createUseThemeProps)('MuiRichTreeViewPro');
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
7
|
+
import { useLicenseVerifier, Watermark } from '@mui/x-license';
|
|
8
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
9
|
+
import { useTreeView, TreeViewProvider, RichTreeViewItems } from '@mui/x-tree-view/internals';
|
|
10
|
+
import { warnOnce } from '@mui/x-internals/warning';
|
|
11
|
+
import { styled, createUseThemeProps } from "../internals/zero-styled/index.js";
|
|
12
|
+
import { getRichTreeViewProUtilityClass } from "./richTreeViewProClasses.js";
|
|
13
|
+
import { RICH_TREE_VIEW_PRO_PLUGINS } from "./RichTreeViewPro.plugins.js";
|
|
14
|
+
import { getReleaseInfo } from "../internals/utils/releaseInfo.js";
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
const useThemeProps = createUseThemeProps('MuiRichTreeViewPro');
|
|
24
17
|
const useUtilityClasses = ownerState => {
|
|
25
18
|
const {
|
|
26
19
|
classes
|
|
@@ -28,9 +21,9 @@ const useUtilityClasses = ownerState => {
|
|
|
28
21
|
const slots = {
|
|
29
22
|
root: ['root']
|
|
30
23
|
};
|
|
31
|
-
return (
|
|
24
|
+
return composeClasses(slots, getRichTreeViewProUtilityClass, classes);
|
|
32
25
|
};
|
|
33
|
-
const RichTreeViewProRoot =
|
|
26
|
+
export const RichTreeViewProRoot = styled('ul', {
|
|
34
27
|
name: 'MuiRichTreeViewPro',
|
|
35
28
|
slot: 'Root',
|
|
36
29
|
overridesResolver: (props, styles) => styles.root
|
|
@@ -41,7 +34,7 @@ const RichTreeViewProRoot = exports.RichTreeViewProRoot = (0, _zeroStyled.styled
|
|
|
41
34
|
outline: 0,
|
|
42
35
|
position: 'relative'
|
|
43
36
|
});
|
|
44
|
-
const releaseInfo =
|
|
37
|
+
const releaseInfo = getReleaseInfo();
|
|
45
38
|
|
|
46
39
|
/**
|
|
47
40
|
*
|
|
@@ -53,22 +46,22 @@ const releaseInfo = (0, _releaseInfo.getReleaseInfo)();
|
|
|
53
46
|
*
|
|
54
47
|
* - [RichTreeView API](https://mui.com/x/api/tree-view/rich-tree-view/)
|
|
55
48
|
*/
|
|
56
|
-
const RichTreeViewPro =
|
|
49
|
+
const RichTreeViewPro = /*#__PURE__*/React.forwardRef(function RichTreeViewPro(inProps, ref) {
|
|
57
50
|
const props = useThemeProps({
|
|
58
51
|
props: inProps,
|
|
59
52
|
name: 'MuiRichTreeViewPro'
|
|
60
53
|
});
|
|
61
|
-
|
|
54
|
+
useLicenseVerifier('x-tree-view-pro', releaseInfo);
|
|
62
55
|
if (process.env.NODE_ENV !== 'production') {
|
|
63
56
|
if (props.children != null) {
|
|
64
|
-
|
|
57
|
+
warnOnce(['MUI X: The `<RichTreeViewPro />` component does not support JSX children.', 'If you want to add items, you need to use the `items` prop.', 'Check the documentation for more details: https://mui.com/x/react-tree-view/rich-tree-view/items/.']);
|
|
65
58
|
}
|
|
66
59
|
}
|
|
67
60
|
const {
|
|
68
61
|
getRootProps,
|
|
69
62
|
contextValue
|
|
70
|
-
} =
|
|
71
|
-
plugins:
|
|
63
|
+
} = useTreeView({
|
|
64
|
+
plugins: RICH_TREE_VIEW_PRO_PLUGINS,
|
|
72
65
|
rootRef: ref,
|
|
73
66
|
props
|
|
74
67
|
});
|
|
@@ -78,20 +71,20 @@ const RichTreeViewPro = exports.RichTreeViewPro = /*#__PURE__*/React.forwardRef(
|
|
|
78
71
|
} = props;
|
|
79
72
|
const classes = useUtilityClasses(props);
|
|
80
73
|
const Root = slots?.root ?? RichTreeViewProRoot;
|
|
81
|
-
const rootProps = (
|
|
74
|
+
const rootProps = useSlotProps({
|
|
82
75
|
elementType: Root,
|
|
83
76
|
externalSlotProps: slotProps?.root,
|
|
84
77
|
className: classes.root,
|
|
85
78
|
getSlotProps: getRootProps,
|
|
86
79
|
ownerState: props
|
|
87
80
|
});
|
|
88
|
-
return /*#__PURE__*/(
|
|
81
|
+
return /*#__PURE__*/_jsx(TreeViewProvider, {
|
|
89
82
|
value: contextValue,
|
|
90
|
-
children: /*#__PURE__*/(
|
|
91
|
-
children: [/*#__PURE__*/(
|
|
83
|
+
children: /*#__PURE__*/_jsxs(Root, _extends({}, rootProps, {
|
|
84
|
+
children: [/*#__PURE__*/_jsx(RichTreeViewItems, {
|
|
92
85
|
slots: slots,
|
|
93
86
|
slotProps: slotProps
|
|
94
|
-
}), /*#__PURE__*/(
|
|
87
|
+
}), /*#__PURE__*/_jsx(Watermark, {
|
|
95
88
|
packageName: "x-tree-view-pro",
|
|
96
89
|
releaseInfo: releaseInfo
|
|
97
90
|
})]
|
|
@@ -106,16 +99,18 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
|
|
|
106
99
|
/**
|
|
107
100
|
* The ref object that allows Tree View manipulation. Can be instantiated with `useTreeViewApiRef()`.
|
|
108
101
|
*/
|
|
109
|
-
apiRef:
|
|
110
|
-
current:
|
|
111
|
-
focusItem:
|
|
112
|
-
getItem:
|
|
113
|
-
getItemDOMElement:
|
|
114
|
-
getItemOrderedChildrenIds:
|
|
115
|
-
getItemTree:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
102
|
+
apiRef: PropTypes.shape({
|
|
103
|
+
current: PropTypes.shape({
|
|
104
|
+
focusItem: PropTypes.func.isRequired,
|
|
105
|
+
getItem: PropTypes.func.isRequired,
|
|
106
|
+
getItemDOMElement: PropTypes.func.isRequired,
|
|
107
|
+
getItemOrderedChildrenIds: PropTypes.func.isRequired,
|
|
108
|
+
getItemTree: PropTypes.func.isRequired,
|
|
109
|
+
getParentId: PropTypes.func.isRequired,
|
|
110
|
+
setIsItemDisabled: PropTypes.func.isRequired,
|
|
111
|
+
setItemExpansion: PropTypes.func.isRequired,
|
|
112
|
+
setItemSelection: PropTypes.func.isRequired,
|
|
113
|
+
updateItemLabel: PropTypes.func.isRequired
|
|
119
114
|
})
|
|
120
115
|
}),
|
|
121
116
|
/**
|
|
@@ -126,57 +121,65 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
|
|
|
126
121
|
* @param {TreeViewItemReorderPosition} params.newPosition The new position of the item.
|
|
127
122
|
* @returns {boolean} `true` if the item can move to the new position.
|
|
128
123
|
*/
|
|
129
|
-
canMoveItemToNewPosition:
|
|
124
|
+
canMoveItemToNewPosition: PropTypes.func,
|
|
130
125
|
/**
|
|
131
126
|
* If `true`, the Tree View renders a checkbox at the left of its label that allows selecting it.
|
|
132
127
|
* @default false
|
|
133
128
|
*/
|
|
134
|
-
checkboxSelection:
|
|
129
|
+
checkboxSelection: PropTypes.bool,
|
|
135
130
|
/**
|
|
136
131
|
* Override or extend the styles applied to the component.
|
|
137
132
|
*/
|
|
138
|
-
classes:
|
|
139
|
-
className:
|
|
133
|
+
classes: PropTypes.object,
|
|
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
|
+
}),
|
|
140
144
|
/**
|
|
141
145
|
* Expanded item ids.
|
|
142
146
|
* Used when the item's expansion is not controlled.
|
|
143
147
|
* @default []
|
|
144
148
|
*/
|
|
145
|
-
defaultExpandedItems:
|
|
149
|
+
defaultExpandedItems: PropTypes.arrayOf(PropTypes.string),
|
|
146
150
|
/**
|
|
147
151
|
* Selected item ids. (Uncontrolled)
|
|
148
152
|
* When `multiSelect` is true this takes an array of strings; when false (default) a string.
|
|
149
153
|
* @default []
|
|
150
154
|
*/
|
|
151
|
-
defaultSelectedItems:
|
|
155
|
+
defaultSelectedItems: PropTypes.any,
|
|
152
156
|
/**
|
|
153
157
|
* If `true`, will allow focus on disabled items.
|
|
154
158
|
* @default false
|
|
155
159
|
*/
|
|
156
|
-
disabledItemsFocusable:
|
|
160
|
+
disabledItemsFocusable: PropTypes.bool,
|
|
157
161
|
/**
|
|
158
162
|
* If `true` selection is disabled.
|
|
159
163
|
* @default false
|
|
160
164
|
*/
|
|
161
|
-
disableSelection:
|
|
165
|
+
disableSelection: PropTypes.bool,
|
|
162
166
|
/**
|
|
163
167
|
* Expanded item ids.
|
|
164
168
|
* Used when the item's expansion is controlled.
|
|
165
169
|
*/
|
|
166
|
-
expandedItems:
|
|
170
|
+
expandedItems: PropTypes.arrayOf(PropTypes.string),
|
|
167
171
|
/**
|
|
168
172
|
* The slot that triggers the item's expansion when clicked.
|
|
169
173
|
* @default 'content'
|
|
170
174
|
*/
|
|
171
|
-
expansionTrigger:
|
|
175
|
+
expansionTrigger: PropTypes.oneOf(['content', 'iconContainer']),
|
|
172
176
|
/**
|
|
173
177
|
* Unstable features, breaking changes might be introduced.
|
|
174
178
|
* For each feature, if the flag is not explicitly set to `true`,
|
|
175
179
|
* the feature will be fully disabled and any property / method call will not have any effect.
|
|
176
180
|
*/
|
|
177
|
-
experimentalFeatures:
|
|
178
|
-
|
|
179
|
-
labelEditing: _propTypes.default.bool
|
|
181
|
+
experimentalFeatures: PropTypes.shape({
|
|
182
|
+
lazyLoading: PropTypes.bool
|
|
180
183
|
}),
|
|
181
184
|
/**
|
|
182
185
|
* Used to determine the id of a given item.
|
|
@@ -186,7 +189,7 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
|
|
|
186
189
|
* @returns {string} The id of the item.
|
|
187
190
|
* @default (item) => item.id
|
|
188
191
|
*/
|
|
189
|
-
getItemId:
|
|
192
|
+
getItemId: PropTypes.func,
|
|
190
193
|
/**
|
|
191
194
|
* Used to determine the string label for a given item.
|
|
192
195
|
*
|
|
@@ -195,86 +198,82 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
|
|
|
195
198
|
* @returns {string} The label of the item.
|
|
196
199
|
* @default (item) => item.label
|
|
197
200
|
*/
|
|
198
|
-
getItemLabel:
|
|
201
|
+
getItemLabel: PropTypes.func,
|
|
199
202
|
/**
|
|
200
203
|
* This prop is used to help implement the accessibility logic.
|
|
201
204
|
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
202
205
|
*/
|
|
203
|
-
id:
|
|
206
|
+
id: PropTypes.string,
|
|
204
207
|
/**
|
|
205
208
|
* Used to determine if a given item should be disabled.
|
|
206
209
|
* @template R
|
|
207
210
|
* @param {R} item The item to check.
|
|
208
211
|
* @returns {boolean} `true` if the item should be disabled.
|
|
209
212
|
*/
|
|
210
|
-
isItemDisabled:
|
|
213
|
+
isItemDisabled: PropTypes.func,
|
|
211
214
|
/**
|
|
212
|
-
*
|
|
213
|
-
* Make sure to also enable the `labelEditing` experimental feature:
|
|
214
|
-
* `<RichTreeViewPro experimentalFeatures={{ labelEditing: true }} />`.
|
|
215
|
-
* By default, the items are not editable.
|
|
215
|
+
* Determine if a given item can be edited.
|
|
216
216
|
* @template R
|
|
217
217
|
* @param {R} item The item to check.
|
|
218
|
-
* @returns {boolean} `true` if the item
|
|
218
|
+
* @returns {boolean} `true` if the item can be edited.
|
|
219
|
+
* @default () => false
|
|
219
220
|
*/
|
|
220
|
-
isItemEditable:
|
|
221
|
+
isItemEditable: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
|
221
222
|
/**
|
|
222
|
-
*
|
|
223
|
+
* Determine if a given item can be reordered.
|
|
223
224
|
* @param {string} itemId The id of the item to check.
|
|
224
225
|
* @returns {boolean} `true` if the item can be reordered.
|
|
225
226
|
* @default () => true
|
|
226
227
|
*/
|
|
227
|
-
isItemReorderable:
|
|
228
|
+
isItemReorderable: PropTypes.func,
|
|
228
229
|
/**
|
|
229
230
|
* Horizontal indentation between an item and its children.
|
|
230
231
|
* Examples: 24, "24px", "2rem", "2em".
|
|
231
232
|
* @default 12px
|
|
232
233
|
*/
|
|
233
|
-
itemChildrenIndentation:
|
|
234
|
-
items:
|
|
234
|
+
itemChildrenIndentation: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
235
|
+
items: PropTypes.array.isRequired,
|
|
235
236
|
/**
|
|
236
237
|
* If `true`, the reordering of items is enabled.
|
|
237
|
-
* Make sure to also enable the `itemsReordering` experimental feature:
|
|
238
|
-
* `<RichTreeViewPro experimentalFeatures={{ itemsReordering: true }} itemsReordering />`.
|
|
239
238
|
* @default false
|
|
240
239
|
*/
|
|
241
|
-
itemsReordering:
|
|
240
|
+
itemsReordering: PropTypes.bool,
|
|
242
241
|
/**
|
|
243
242
|
* If `true`, `ctrl` and `shift` will trigger multiselect.
|
|
244
243
|
* @default false
|
|
245
244
|
*/
|
|
246
|
-
multiSelect:
|
|
245
|
+
multiSelect: PropTypes.bool,
|
|
247
246
|
/**
|
|
248
247
|
* Callback fired when Tree Items are expanded/collapsed.
|
|
249
|
-
* @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.
|
|
250
249
|
* @param {array} itemIds The ids of the expanded items.
|
|
251
250
|
*/
|
|
252
|
-
onExpandedItemsChange:
|
|
251
|
+
onExpandedItemsChange: PropTypes.func,
|
|
253
252
|
/**
|
|
254
253
|
* Callback fired when the `content` slot of a given Tree Item is clicked.
|
|
255
254
|
* @param {React.MouseEvent} event The DOM event that triggered the change.
|
|
256
255
|
* @param {string} itemId The id of the focused item.
|
|
257
256
|
*/
|
|
258
|
-
onItemClick:
|
|
257
|
+
onItemClick: PropTypes.func,
|
|
259
258
|
/**
|
|
260
259
|
* Callback fired when a Tree Item is expanded or collapsed.
|
|
261
|
-
* @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.
|
|
262
261
|
* @param {array} itemId The itemId of the modified item.
|
|
263
262
|
* @param {array} isExpanded `true` if the item has just been expanded, `false` if it has just been collapsed.
|
|
264
263
|
*/
|
|
265
|
-
onItemExpansionToggle:
|
|
264
|
+
onItemExpansionToggle: PropTypes.func,
|
|
266
265
|
/**
|
|
267
266
|
* Callback fired when a given Tree Item is focused.
|
|
268
267
|
* @param {React.SyntheticEvent | null} event The DOM event that triggered the change. **Warning**: This is a generic event not a focus event.
|
|
269
268
|
* @param {string} itemId The id of the focused item.
|
|
270
269
|
*/
|
|
271
|
-
onItemFocus:
|
|
270
|
+
onItemFocus: PropTypes.func,
|
|
272
271
|
/**
|
|
273
272
|
* Callback fired when the label of an item changes.
|
|
274
273
|
* @param {TreeViewItemId} itemId The id of the item that was edited.
|
|
275
274
|
* @param {string} newLabel The new label of the items.
|
|
276
275
|
*/
|
|
277
|
-
onItemLabelChange:
|
|
276
|
+
onItemLabelChange: PropTypes.func,
|
|
278
277
|
/**
|
|
279
278
|
* Callback fired when a Tree Item is moved in the tree.
|
|
280
279
|
* @param {object} params The params describing the item re-ordering.
|
|
@@ -282,26 +281,26 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
|
|
|
282
281
|
* @param {TreeViewItemReorderPosition} params.oldPosition The old position of the item.
|
|
283
282
|
* @param {TreeViewItemReorderPosition} params.newPosition The new position of the item.
|
|
284
283
|
*/
|
|
285
|
-
onItemPositionChange:
|
|
284
|
+
onItemPositionChange: PropTypes.func,
|
|
286
285
|
/**
|
|
287
286
|
* Callback fired when a Tree Item is selected or deselected.
|
|
288
|
-
* @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.
|
|
289
288
|
* @param {array} itemId The itemId of the modified item.
|
|
290
289
|
* @param {array} isSelected `true` if the item has just been selected, `false` if it has just been deselected.
|
|
291
290
|
*/
|
|
292
|
-
onItemSelectionToggle:
|
|
291
|
+
onItemSelectionToggle: PropTypes.func,
|
|
293
292
|
/**
|
|
294
293
|
* Callback fired when Tree Items are selected/deselected.
|
|
295
|
-
* @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.
|
|
296
295
|
* @param {string[] | string} itemIds The ids of the selected items.
|
|
297
296
|
* When `multiSelect` is `true`, this is an array of strings; when false (default) a string.
|
|
298
297
|
*/
|
|
299
|
-
onSelectedItemsChange:
|
|
298
|
+
onSelectedItemsChange: PropTypes.func,
|
|
300
299
|
/**
|
|
301
300
|
* Selected item ids. (Controlled)
|
|
302
301
|
* When `multiSelect` is true this takes an array of strings; when false (default) a string.
|
|
303
302
|
*/
|
|
304
|
-
selectedItems:
|
|
303
|
+
selectedItems: PropTypes.any,
|
|
305
304
|
/**
|
|
306
305
|
* When `selectionPropagation.descendants` is set to `true`.
|
|
307
306
|
*
|
|
@@ -318,22 +317,23 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
|
|
|
318
317
|
*
|
|
319
318
|
* @default { parents: false, descendants: false }
|
|
320
319
|
*/
|
|
321
|
-
selectionPropagation:
|
|
322
|
-
descendants:
|
|
323
|
-
parents:
|
|
320
|
+
selectionPropagation: PropTypes.shape({
|
|
321
|
+
descendants: PropTypes.bool,
|
|
322
|
+
parents: PropTypes.bool
|
|
324
323
|
}),
|
|
325
324
|
/**
|
|
326
325
|
* The props used for each component slot.
|
|
327
326
|
* @default {}
|
|
328
327
|
*/
|
|
329
|
-
slotProps:
|
|
328
|
+
slotProps: PropTypes.object,
|
|
330
329
|
/**
|
|
331
330
|
* Overridable component slots.
|
|
332
331
|
* @default {}
|
|
333
332
|
*/
|
|
334
|
-
slots:
|
|
333
|
+
slots: PropTypes.object,
|
|
335
334
|
/**
|
|
336
335
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
337
336
|
*/
|
|
338
|
-
sx:
|
|
339
|
-
} : void 0;
|
|
337
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
338
|
+
} : void 0;
|
|
339
|
+
export { RichTreeViewPro };
|
|
@@ -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 {}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { useTreeViewItems, useTreeViewExpansion, useTreeViewSelection, useTreeViewFocus, useTreeViewKeyboardNavigation, useTreeViewIcons, useTreeViewLabel } from '@mui/x-tree-view/internals';
|
|
2
|
+
import { useTreeViewItemsReordering } from "../internals/plugins/useTreeViewItemsReordering/index.js";
|
|
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];
|
|
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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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,6 @@
|
|
|
1
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
2
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
3
|
+
export function getRichTreeViewProUtilityClass(slot) {
|
|
4
|
+
return generateUtilityClass('MuiRichTreeViewPro', slot);
|
|
5
|
+
}
|
|
6
|
+
export const richTreeViewProClasses = generateUtilityClasses('MuiRichTreeViewPro', ['root']);
|
package/esm/index.d.ts
ADDED
|
@@ -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/esm/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @mui/x-tree-view-pro v8.0.0-beta.0
|
|
3
|
+
*
|
|
4
|
+
* @license MUI X Commercial
|
|
5
|
+
* This source code is licensed under the commercial license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
// Tree View
|
|
9
|
+
export * from '@mui/x-tree-view/SimpleTreeView';
|
|
10
|
+
export * from "./RichTreeViewPro/index.js";
|
|
11
|
+
|
|
12
|
+
// Tree Item
|
|
13
|
+
export * from '@mui/x-tree-view/TreeItem';
|
|
14
|
+
export * from '@mui/x-tree-view/useTreeItem';
|
|
15
|
+
export * from '@mui/x-tree-view/TreeItemIcon';
|
|
16
|
+
export * from '@mui/x-tree-view/TreeItemProvider';
|
|
17
|
+
export * from '@mui/x-tree-view/TreeItemDragAndDropOverlay';
|
|
18
|
+
export * from '@mui/x-tree-view/TreeItemLabelInput';
|
|
19
|
+
export { unstable_resetCleanupTracking } from '@mui/x-tree-view/internals';
|
|
20
|
+
export * from '@mui/x-tree-view/models';
|
|
21
|
+
export * from '@mui/x-tree-view/icons';
|
|
22
|
+
export * from '@mui/x-tree-view/hooks';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UseTreeViewItemsReorderingSignature } from "./plugins/useTreeViewItemsReordering/index.js";
|
|
@@ -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';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useTreeViewItemsReordering } from "./useTreeViewItemsReordering.js";
|
|
@@ -1,29 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
exports.useTreeViewItemsReorderingItemPlugin = exports.isAndroid = void 0;
|
|
8
|
-
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _internals = require("@mui/x-tree-view/internals");
|
|
10
|
-
var _useTreeViewItemsReordering = require("./useTreeViewItemsReordering.selectors");
|
|
11
|
-
const isAndroid = () => navigator.userAgent.toLowerCase().includes('android');
|
|
12
|
-
exports.isAndroid = isAndroid;
|
|
13
|
-
const useTreeViewItemsReorderingItemPlugin = ({
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useTreeViewContext, isTargetInDescendants, useSelector } from '@mui/x-tree-view/internals';
|
|
3
|
+
import { selectorItemsReorderingDraggedItemProperties, selectorItemsReorderingIsValidTarget } from "./useTreeViewItemsReordering.selectors.js";
|
|
4
|
+
export const isAndroid = () => navigator.userAgent.toLowerCase().includes('android');
|
|
5
|
+
export const useTreeViewItemsReorderingItemPlugin = ({
|
|
14
6
|
props
|
|
15
7
|
}) => {
|
|
16
8
|
const {
|
|
17
9
|
instance,
|
|
18
10
|
store,
|
|
19
11
|
itemsReordering
|
|
20
|
-
} =
|
|
12
|
+
} = useTreeViewContext();
|
|
21
13
|
const {
|
|
22
14
|
itemId
|
|
23
15
|
} = props;
|
|
24
16
|
const validActionsRef = React.useRef(null);
|
|
25
|
-
const draggedItemProperties =
|
|
26
|
-
const isValidTarget =
|
|
17
|
+
const draggedItemProperties = useSelector(store, selectorItemsReorderingDraggedItemProperties, itemId);
|
|
18
|
+
const isValidTarget = useSelector(store, selectorItemsReorderingIsValidTarget, itemId);
|
|
27
19
|
return {
|
|
28
20
|
propsEnhancers: {
|
|
29
21
|
root: ({
|
|
@@ -42,7 +34,7 @@ const useTreeViewItemsReorderingItemPlugin = ({
|
|
|
42
34
|
|
|
43
35
|
// We don't use `event.currentTarget` here.
|
|
44
36
|
// This is to allow people to pass `onDragStart` to another element than the root.
|
|
45
|
-
if (
|
|
37
|
+
if (isTargetInDescendants(event.target, rootRefObject.current)) {
|
|
46
38
|
return;
|
|
47
39
|
}
|
|
48
40
|
|
|
@@ -131,5 +123,4 @@ const useTreeViewItemsReorderingItemPlugin = ({
|
|
|
131
123
|
}
|
|
132
124
|
}
|
|
133
125
|
};
|
|
134
|
-
};
|
|
135
|
-
exports.useTreeViewItemsReorderingItemPlugin = useTreeViewItemsReorderingItemPlugin;
|
|
126
|
+
};
|