@mui/x-tree-view-pro 8.0.0-beta.2 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/CHANGELOG.md +423 -96
  2. package/RichTreeViewPro/RichTreeViewPro.js +12 -8
  3. package/RichTreeViewPro/RichTreeViewPro.plugins.d.ts +3 -5
  4. package/RichTreeViewPro/RichTreeViewPro.plugins.js +1 -1
  5. package/RichTreeViewPro/RichTreeViewPro.types.d.ts +4 -4
  6. package/esm/RichTreeViewPro/RichTreeViewPro.js +11 -7
  7. package/esm/RichTreeViewPro/RichTreeViewPro.plugins.d.ts +3 -5
  8. package/esm/RichTreeViewPro/RichTreeViewPro.plugins.js +2 -2
  9. package/esm/RichTreeViewPro/RichTreeViewPro.types.d.ts +4 -4
  10. package/esm/index.js +1 -1
  11. package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.js +1 -1
  12. package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.js +17 -11
  13. package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.d.ts +30 -2
  14. package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.js +2 -2
  15. package/index.js +1 -1
  16. package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.js +1 -1
  17. package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.js +16 -10
  18. package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.d.ts +30 -2
  19. package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.js +1 -1
  20. package/package.json +9 -17
  21. package/esm/internals/utils/releaseInfo.d.ts +0 -1
  22. package/esm/internals/utils/releaseInfo.js +0 -13
  23. package/internals/utils/releaseInfo.d.ts +0 -1
  24. package/internals/utils/releaseInfo.js +0 -21
  25. package/modern/RichTreeViewPro/RichTreeViewPro.d.ts +0 -20
  26. package/modern/RichTreeViewPro/RichTreeViewPro.js +0 -351
  27. package/modern/RichTreeViewPro/RichTreeViewPro.plugins.d.ts +0 -7
  28. package/modern/RichTreeViewPro/RichTreeViewPro.plugins.js +0 -6
  29. package/modern/RichTreeViewPro/RichTreeViewPro.types.d.ts +0 -51
  30. package/modern/RichTreeViewPro/RichTreeViewPro.types.js +0 -1
  31. package/modern/RichTreeViewPro/index.d.ts +0 -3
  32. package/modern/RichTreeViewPro/index.js +0 -3
  33. package/modern/RichTreeViewPro/richTreeViewProClasses.d.ts +0 -5
  34. package/modern/RichTreeViewPro/richTreeViewProClasses.js +0 -6
  35. package/modern/index.d.ts +0 -12
  36. package/modern/index.js +0 -22
  37. package/modern/internals/index.d.ts +0 -1
  38. package/modern/internals/index.js +0 -1
  39. package/modern/internals/plugins/useTreeViewItemsReordering/index.d.ts +0 -2
  40. package/modern/internals/plugins/useTreeViewItemsReordering/index.js +0 -1
  41. package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.d.ts +0 -3
  42. package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.d.ts +0 -3
  43. package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.js +0 -126
  44. package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.js +0 -203
  45. package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.d.ts +0 -417
  46. package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.js +0 -50
  47. package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.d.ts +0 -127
  48. package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.js +0 -1
  49. package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.utils.d.ts +0 -37
  50. package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.utils.js +0 -158
  51. package/modern/internals/plugins/useTreeViewLazyLoading/index.d.ts +0 -1
  52. package/modern/internals/plugins/useTreeViewLazyLoading/index.js +0 -1
  53. package/modern/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.d.ts +0 -3
  54. package/modern/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.js +0 -269
  55. package/modern/internals/plugins/useTreeViewLazyLoading/utils.d.ts +0 -32
  56. package/modern/internals/plugins/useTreeViewLazyLoading/utils.js +0 -85
  57. package/modern/internals/utils/releaseInfo.d.ts +0 -1
  58. package/modern/internals/utils/releaseInfo.js +0 -13
  59. package/modern/internals/zero-styled/index.d.ts +0 -3
  60. package/modern/internals/zero-styled/index.js +0 -7
  61. package/modern/package.json +0 -1
  62. package/modern/themeAugmentation/components.d.ts +0 -11
  63. package/modern/themeAugmentation/index.d.ts +0 -3
  64. package/modern/themeAugmentation/index.js +0 -0
  65. package/modern/themeAugmentation/overrides.d.ts +0 -12
  66. package/modern/themeAugmentation/props.d.ts +0 -10
  67. package/tsconfig.build.tsbuildinfo +0 -1
@@ -1,351 +0,0 @@
1
- 'use client';
2
-
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');
17
- const useUtilityClasses = ownerState => {
18
- const {
19
- classes
20
- } = ownerState;
21
- return React.useMemo(() => {
22
- const slots = {
23
- root: ['root'],
24
- item: ['item'],
25
- itemContent: ['itemContent'],
26
- itemGroupTransition: ['itemGroupTransition'],
27
- itemIconContainer: ['itemIconContainer'],
28
- itemLabel: ['itemLabel'],
29
- itemLabelInput: ['itemLabelInput'],
30
- itemCheckbox: ['itemCheckbox'],
31
- itemDragAndDropOverlay: ['itemDragAndDropOverlay'],
32
- itemErrorIcon: ['itemErrorIcon']
33
- };
34
- return composeClasses(slots, getRichTreeViewProUtilityClass, classes);
35
- }, [classes]);
36
- };
37
- export const RichTreeViewProRoot = styled('ul', {
38
- name: 'MuiRichTreeViewPro',
39
- slot: 'Root',
40
- overridesResolver: (props, styles) => styles.root
41
- })({
42
- padding: 0,
43
- margin: 0,
44
- listStyle: 'none',
45
- outline: 0,
46
- position: 'relative'
47
- });
48
- const releaseInfo = getReleaseInfo();
49
-
50
- /**
51
- *
52
- * Demos:
53
- *
54
- * - [Tree View](https://mui.com/x/react-tree-view/)
55
- *
56
- * API:
57
- *
58
- * - [RichTreeView API](https://mui.com/x/api/tree-view/rich-tree-view/)
59
- */
60
- const RichTreeViewPro = /*#__PURE__*/React.forwardRef(function RichTreeViewPro(inProps, ref) {
61
- const props = useThemeProps({
62
- props: inProps,
63
- name: 'MuiRichTreeViewPro'
64
- });
65
- useLicenseVerifier('x-tree-view-pro', releaseInfo);
66
- if (process.env.NODE_ENV !== 'production') {
67
- if (props.children != null) {
68
- 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/.']);
69
- }
70
- }
71
- const {
72
- getRootProps,
73
- contextValue
74
- } = useTreeView({
75
- plugins: RICH_TREE_VIEW_PRO_PLUGINS,
76
- rootRef: ref,
77
- props
78
- });
79
- const {
80
- slots,
81
- slotProps
82
- } = props;
83
- const classes = useUtilityClasses(props);
84
- const Root = slots?.root ?? RichTreeViewProRoot;
85
- const rootProps = useSlotProps({
86
- elementType: Root,
87
- externalSlotProps: slotProps?.root,
88
- className: classes.root,
89
- getSlotProps: getRootProps,
90
- ownerState: props
91
- });
92
- return /*#__PURE__*/_jsx(TreeViewProvider, {
93
- contextValue: contextValue,
94
- classes: classes,
95
- children: /*#__PURE__*/_jsxs(Root, _extends({}, rootProps, {
96
- children: [/*#__PURE__*/_jsx(RichTreeViewItems, {
97
- slots: slots,
98
- slotProps: slotProps
99
- }), /*#__PURE__*/_jsx(Watermark, {
100
- packageName: "x-tree-view-pro",
101
- releaseInfo: releaseInfo
102
- })]
103
- }))
104
- });
105
- });
106
- process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
107
- // ----------------------------- Warning --------------------------------
108
- // | These PropTypes are generated from the TypeScript type definitions |
109
- // | To update them edit the TypeScript types and run "pnpm proptypes" |
110
- // ----------------------------------------------------------------------
111
- /**
112
- * The ref object that allows Tree View manipulation. Can be instantiated with `useTreeViewApiRef()`.
113
- */
114
- apiRef: PropTypes.shape({
115
- current: PropTypes.shape({
116
- focusItem: PropTypes.func.isRequired,
117
- getItem: PropTypes.func.isRequired,
118
- getItemDOMElement: PropTypes.func.isRequired,
119
- getItemOrderedChildrenIds: PropTypes.func.isRequired,
120
- getItemTree: PropTypes.func.isRequired,
121
- getParentId: PropTypes.func.isRequired,
122
- setIsItemDisabled: PropTypes.func.isRequired,
123
- setItemExpansion: PropTypes.func.isRequired,
124
- setItemSelection: PropTypes.func.isRequired,
125
- updateItemLabel: PropTypes.func.isRequired
126
- })
127
- }),
128
- /**
129
- * Used to determine if a given item can move to some new position.
130
- * @param {object} params The params describing the item re-ordering.
131
- * @param {string} params.itemId The id of the item that is being moved to a new position.
132
- * @param {TreeViewItemReorderPosition} params.oldPosition The old position of the item.
133
- * @param {TreeViewItemReorderPosition} params.newPosition The new position of the item.
134
- * @returns {boolean} `true` if the item can move to the new position.
135
- */
136
- canMoveItemToNewPosition: PropTypes.func,
137
- /**
138
- * If `true`, the Tree View renders a checkbox at the left of its label that allows selecting it.
139
- * @default false
140
- */
141
- checkboxSelection: PropTypes.bool,
142
- /**
143
- * Override or extend the styles applied to the component.
144
- */
145
- classes: PropTypes.object,
146
- className: PropTypes.string,
147
- dataSource: PropTypes.shape({
148
- getChildrenCount: PropTypes.func.isRequired,
149
- getTreeItems: PropTypes.func.isRequired
150
- }),
151
- dataSourceCache: PropTypes.shape({
152
- clear: PropTypes.func.isRequired,
153
- get: PropTypes.func.isRequired,
154
- set: PropTypes.func.isRequired
155
- }),
156
- /**
157
- * Expanded item ids.
158
- * Used when the item's expansion is not controlled.
159
- * @default []
160
- */
161
- defaultExpandedItems: PropTypes.arrayOf(PropTypes.string),
162
- /**
163
- * Selected item ids. (Uncontrolled)
164
- * When `multiSelect` is true this takes an array of strings; when false (default) a string.
165
- * @default []
166
- */
167
- defaultSelectedItems: PropTypes.any,
168
- /**
169
- * If `true`, will allow focus on disabled items.
170
- * @default false
171
- */
172
- disabledItemsFocusable: PropTypes.bool,
173
- /**
174
- * If `true` selection is disabled.
175
- * @default false
176
- */
177
- disableSelection: PropTypes.bool,
178
- /**
179
- * Expanded item ids.
180
- * Used when the item's expansion is controlled.
181
- */
182
- expandedItems: PropTypes.arrayOf(PropTypes.string),
183
- /**
184
- * The slot that triggers the item's expansion when clicked.
185
- * @default 'content'
186
- */
187
- expansionTrigger: PropTypes.oneOf(['content', 'iconContainer']),
188
- /**
189
- * Unstable features, breaking changes might be introduced.
190
- * For each feature, if the flag is not explicitly set to `true`,
191
- * the feature will be fully disabled and any property / method call will not have any effect.
192
- */
193
- experimentalFeatures: PropTypes.shape({
194
- lazyLoading: PropTypes.bool
195
- }),
196
- /**
197
- * Used to determine the id of a given item.
198
- *
199
- * @template R
200
- * @param {R} item The item to check.
201
- * @returns {string} The id of the item.
202
- * @default (item) => item.id
203
- */
204
- getItemId: PropTypes.func,
205
- /**
206
- * Used to determine the string label for a given item.
207
- *
208
- * @template R
209
- * @param {R} item The item to check.
210
- * @returns {string} The label of the item.
211
- * @default (item) => item.label
212
- */
213
- getItemLabel: PropTypes.func,
214
- /**
215
- * This prop is used to help implement the accessibility logic.
216
- * If you don't provide this prop. It falls back to a randomly generated id.
217
- */
218
- id: PropTypes.string,
219
- /**
220
- * Used to determine if a given item should be disabled.
221
- * @template R
222
- * @param {R} item The item to check.
223
- * @returns {boolean} `true` if the item should be disabled.
224
- */
225
- isItemDisabled: PropTypes.func,
226
- /**
227
- * Determine if a given item can be edited.
228
- * @template R
229
- * @param {R} item The item to check.
230
- * @returns {boolean} `true` if the item can be edited.
231
- * @default () => false
232
- */
233
- isItemEditable: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
234
- /**
235
- * Determine if a given item can be reordered.
236
- * @param {string} itemId The id of the item to check.
237
- * @returns {boolean} `true` if the item can be reordered.
238
- * @default () => true
239
- */
240
- isItemReorderable: PropTypes.func,
241
- /**
242
- * Horizontal indentation between an item and its children.
243
- * Examples: 24, "24px", "2rem", "2em".
244
- * @default 12px
245
- */
246
- itemChildrenIndentation: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
247
- items: PropTypes.array.isRequired,
248
- /**
249
- * If `true`, the reordering of items is enabled.
250
- * @default false
251
- */
252
- itemsReordering: PropTypes.bool,
253
- /**
254
- * If `true`, `ctrl` and `shift` will trigger multiselect.
255
- * @default false
256
- */
257
- multiSelect: PropTypes.bool,
258
- /**
259
- * Callback fired when Tree Items are expanded/collapsed.
260
- * @param {React.SyntheticEvent} event The DOM event that triggered the change. Can be null when the change is caused by the `publicAPI.setItemExpansion()` method.
261
- * @param {array} itemIds The ids of the expanded items.
262
- */
263
- onExpandedItemsChange: PropTypes.func,
264
- /**
265
- * Callback fired when the `content` slot of a given Tree Item is clicked.
266
- * @param {React.MouseEvent} event The DOM event that triggered the change.
267
- * @param {string} itemId The id of the focused item.
268
- */
269
- onItemClick: PropTypes.func,
270
- /**
271
- * Callback fired when a Tree Item is expanded or collapsed.
272
- * @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.
273
- * @param {array} itemId The itemId of the modified item.
274
- * @param {array} isExpanded `true` if the item has just been expanded, `false` if it has just been collapsed.
275
- */
276
- onItemExpansionToggle: PropTypes.func,
277
- /**
278
- * Callback fired when a given Tree Item is focused.
279
- * @param {React.SyntheticEvent | null} event The DOM event that triggered the change. **Warning**: This is a generic event not a focus event.
280
- * @param {string} itemId The id of the focused item.
281
- */
282
- onItemFocus: PropTypes.func,
283
- /**
284
- * Callback fired when the label of an item changes.
285
- * @param {TreeViewItemId} itemId The id of the item that was edited.
286
- * @param {string} newLabel The new label of the items.
287
- */
288
- onItemLabelChange: PropTypes.func,
289
- /**
290
- * Callback fired when a Tree Item is moved in the tree.
291
- * @param {object} params The params describing the item re-ordering.
292
- * @param {string} params.itemId The id of the item moved.
293
- * @param {TreeViewItemReorderPosition} params.oldPosition The old position of the item.
294
- * @param {TreeViewItemReorderPosition} params.newPosition The new position of the item.
295
- */
296
- onItemPositionChange: PropTypes.func,
297
- /**
298
- * Callback fired when a Tree Item is selected or deselected.
299
- * @param {React.SyntheticEvent} event The DOM event that triggered the change. Can be null when the change is caused by the `publicAPI.setItemSelection()` method.
300
- * @param {array} itemId The itemId of the modified item.
301
- * @param {array} isSelected `true` if the item has just been selected, `false` if it has just been deselected.
302
- */
303
- onItemSelectionToggle: PropTypes.func,
304
- /**
305
- * Callback fired when Tree Items are selected/deselected.
306
- * @param {React.SyntheticEvent} event The DOM event that triggered the change. Can be null when the change is caused by the `publicAPI.setItemSelection()` method.
307
- * @param {string[] | string} itemIds The ids of the selected items.
308
- * When `multiSelect` is `true`, this is an array of strings; when false (default) a string.
309
- */
310
- onSelectedItemsChange: PropTypes.func,
311
- /**
312
- * Selected item ids. (Controlled)
313
- * When `multiSelect` is true this takes an array of strings; when false (default) a string.
314
- */
315
- selectedItems: PropTypes.any,
316
- /**
317
- * When `selectionPropagation.descendants` is set to `true`.
318
- *
319
- * - Selecting a parent selects all its descendants automatically.
320
- * - Deselecting a parent deselects all its descendants automatically.
321
- *
322
- * When `selectionPropagation.parents` is set to `true`.
323
- *
324
- * - Selecting all the descendants of a parent selects the parent automatically.
325
- * - Deselecting a descendant of a selected parent deselects the parent automatically.
326
- *
327
- * Only works when `multiSelect` is `true`.
328
- * On the <SimpleTreeView />, only the expanded items are considered (since the collapsed item are not passed to the Tree View component at all)
329
- *
330
- * @default { parents: false, descendants: false }
331
- */
332
- selectionPropagation: PropTypes.shape({
333
- descendants: PropTypes.bool,
334
- parents: PropTypes.bool
335
- }),
336
- /**
337
- * The props used for each component slot.
338
- * @default {}
339
- */
340
- slotProps: PropTypes.object,
341
- /**
342
- * Overridable component slots.
343
- * @default {}
344
- */
345
- slots: PropTypes.object,
346
- /**
347
- * The system prop that allows defining system overrides as well as additional CSS styles.
348
- */
349
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
350
- } : void 0;
351
- export { RichTreeViewPro };
@@ -1,7 +0,0 @@
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,6 +0,0 @@
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.
@@ -1,51 +0,0 @@
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
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- export * from "./RichTreeViewPro.js";
2
- export * from "./richTreeViewProClasses.js";
3
- export type { RichTreeViewProProps, RichTreeViewProPropsBase, RichTreeViewProSlots, RichTreeViewProSlotProps } from './RichTreeViewPro.types';
@@ -1,3 +0,0 @@
1
- export * from "./RichTreeViewPro.js";
2
- export * from "./richTreeViewProClasses.js";
3
- export {};
@@ -1,5 +0,0 @@
1
- import { TreeViewClasses } from '@mui/x-tree-view/internals';
2
- export interface RichTreeViewProClasses extends TreeViewClasses {}
3
- export type RichTreeViewProClassKey = keyof RichTreeViewProClasses;
4
- export declare function getRichTreeViewProUtilityClass(slot: string): string;
5
- export declare const richTreeViewProClasses: RichTreeViewProClasses;
@@ -1,6 +0,0 @@
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', 'item', 'itemContent', 'itemGroupTransition', 'itemIconContainer', 'itemLabel', 'itemCheckbox', 'itemLabelInput', 'itemDragAndDropOverlay', 'itemErrorIcon', 'itemLoadingIcon']);
package/modern/index.d.ts DELETED
@@ -1,12 +0,0 @@
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 DELETED
@@ -1,22 +0,0 @@
1
- /**
2
- * @mui/x-tree-view-pro v8.0.0-beta.2
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';
@@ -1 +0,0 @@
1
- export { UseTreeViewItemsReorderingSignature } from "./plugins/useTreeViewItemsReordering/index.js";
@@ -1 +0,0 @@
1
- export { UseTreeViewItemsReorderingSignature } from "./plugins/useTreeViewItemsReordering/index.js";
@@ -1,2 +0,0 @@
1
- export { useTreeViewItemsReordering } from "./useTreeViewItemsReordering.js";
2
- export type { UseTreeViewItemsReorderingSignature, UseTreeViewItemsReorderingParameters, UseTreeViewItemsReorderingDefaultizedParameters, TreeViewItemReorderPosition } from './useTreeViewItemsReordering.types';
@@ -1 +0,0 @@
1
- export { useTreeViewItemsReordering } from "./useTreeViewItemsReordering.js";
@@ -1,3 +0,0 @@
1
- import { TreeViewPlugin } from '@mui/x-tree-view/internals';
2
- import { UseTreeViewItemsReorderingSignature } from "./useTreeViewItemsReordering.types.js";
3
- export declare const useTreeViewItemsReordering: TreeViewPlugin<UseTreeViewItemsReorderingSignature>;
@@ -1,3 +0,0 @@
1
- import { TreeViewItemPlugin } from '@mui/x-tree-view/internals';
2
- export declare const isAndroid: () => boolean;
3
- export declare const useTreeViewItemsReorderingItemPlugin: TreeViewItemPlugin;
@@ -1,126 +0,0 @@
1
- import * as React from 'react';
2
- import { useTreeViewContext, isTargetInDescendants, useSelector } from '@mui/x-tree-view/internals';
3
- import { selectorCanItemBeReordered, selectorDraggedItemProperties, selectorIsItemValidReorderingTarget } from "./useTreeViewItemsReordering.selectors.js";
4
- export const isAndroid = () => navigator.userAgent.toLowerCase().includes('android');
5
- export const useTreeViewItemsReorderingItemPlugin = ({
6
- props
7
- }) => {
8
- const {
9
- instance,
10
- store
11
- } = useTreeViewContext();
12
- const {
13
- itemId
14
- } = props;
15
- const validActionsRef = React.useRef(null);
16
- const draggedItemProperties = useSelector(store, selectorDraggedItemProperties, itemId);
17
- const canItemBeReordered = useSelector(store, selectorCanItemBeReordered);
18
- const isValidTarget = useSelector(store, selectorIsItemValidReorderingTarget, itemId);
19
- return {
20
- propsEnhancers: {
21
- root: ({
22
- rootRefObject,
23
- contentRefObject,
24
- externalEventHandlers
25
- }) => {
26
- if (!canItemBeReordered) {
27
- return {};
28
- }
29
- const handleDragStart = event => {
30
- externalEventHandlers.onDragStart?.(event);
31
- if (event.defaultMuiPrevented || event.defaultPrevented) {
32
- return;
33
- }
34
-
35
- // We don't use `event.currentTarget` here.
36
- // This is to allow people to pass `onDragStart` to another element than the root.
37
- if (isTargetInDescendants(event.target, rootRefObject.current)) {
38
- return;
39
- }
40
-
41
- // Comment to show the children in the drag preview
42
- // TODO: Improve the customization of the drag preview
43
- event.dataTransfer.effectAllowed = 'move';
44
- event.dataTransfer.setDragImage(contentRefObject.current, 0, 0);
45
- const {
46
- types
47
- } = event.dataTransfer;
48
- if (isAndroid() && !types.includes('text/plain') && !types.includes('text/uri-list')) {
49
- event.dataTransfer.setData('text/plain', 'android-fallback');
50
- }
51
-
52
- // iOS requires a media type to be defined
53
- event.dataTransfer.setData('application/mui-x', '');
54
- instance.startDraggingItem(itemId);
55
- };
56
- const handleRootDragOver = event => {
57
- externalEventHandlers.onDragOver?.(event);
58
- if (event.defaultMuiPrevented) {
59
- return;
60
- }
61
- event.preventDefault();
62
- };
63
- const handleRootDragEnd = event => {
64
- externalEventHandlers.onDragEnd?.(event);
65
- if (event.defaultMuiPrevented) {
66
- return;
67
- }
68
- instance.stopDraggingItem(itemId);
69
- };
70
- return {
71
- draggable: true,
72
- onDragStart: handleDragStart,
73
- onDragOver: handleRootDragOver,
74
- onDragEnd: handleRootDragEnd
75
- };
76
- },
77
- content: ({
78
- externalEventHandlers,
79
- contentRefObject
80
- }) => {
81
- if (!isValidTarget) {
82
- return {};
83
- }
84
- const handleDragOver = event => {
85
- externalEventHandlers.onDragOver?.(event);
86
- if (event.defaultMuiPrevented || validActionsRef.current == null) {
87
- return;
88
- }
89
- const rect = event.target.getBoundingClientRect();
90
- const y = event.clientY - rect.top;
91
- const x = event.clientX - rect.left;
92
- instance.setDragTargetItem({
93
- itemId,
94
- validActions: validActionsRef.current,
95
- targetHeight: rect.height,
96
- cursorY: y,
97
- cursorX: x,
98
- contentElement: contentRefObject.current
99
- });
100
- };
101
- const handleDragEnter = event => {
102
- externalEventHandlers.onDragEnter?.(event);
103
- if (event.defaultMuiPrevented) {
104
- return;
105
- }
106
- validActionsRef.current = instance.getDroppingTargetValidActions(itemId);
107
- };
108
- return {
109
- onDragEnter: handleDragEnter,
110
- onDragOver: handleDragOver
111
- };
112
- },
113
- dragAndDropOverlay: () => {
114
- if (!draggedItemProperties) {
115
- return {};
116
- }
117
- return {
118
- action: draggedItemProperties.action,
119
- style: {
120
- '--TreeView-targetDepth': draggedItemProperties.targetDepth
121
- }
122
- };
123
- }
124
- }
125
- };
126
- };