@mui/x-tree-view-pro 8.0.0-alpha.10 → 8.0.0-alpha.12

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 (112) hide show
  1. package/CHANGELOG.md +267 -2
  2. package/RichTreeViewPro/RichTreeViewPro.d.ts +4 -4
  3. package/RichTreeViewPro/RichTreeViewPro.js +85 -86
  4. package/RichTreeViewPro/RichTreeViewPro.plugins.d.ts +2 -3
  5. package/RichTreeViewPro/RichTreeViewPro.plugins.js +9 -3
  6. package/RichTreeViewPro/RichTreeViewPro.types.d.ts +38 -38
  7. package/RichTreeViewPro/RichTreeViewPro.types.js +5 -1
  8. package/RichTreeViewPro/index.d.ts +3 -3
  9. package/RichTreeViewPro/index.js +27 -3
  10. package/RichTreeViewPro/richTreeViewProClasses.d.ts +3 -3
  11. package/RichTreeViewPro/richTreeViewProClasses.js +13 -5
  12. package/esm/RichTreeViewPro/RichTreeViewPro.d.ts +20 -0
  13. package/{node → esm}/RichTreeViewPro/RichTreeViewPro.js +79 -92
  14. package/esm/RichTreeViewPro/RichTreeViewPro.plugins.d.ts +7 -0
  15. package/esm/RichTreeViewPro/RichTreeViewPro.plugins.js +5 -0
  16. package/esm/RichTreeViewPro/RichTreeViewPro.types.d.ts +51 -0
  17. package/esm/RichTreeViewPro/RichTreeViewPro.types.js +1 -0
  18. package/esm/RichTreeViewPro/index.d.ts +3 -0
  19. package/esm/RichTreeViewPro/index.js +3 -0
  20. package/esm/RichTreeViewPro/richTreeViewProClasses.d.ts +7 -0
  21. package/esm/RichTreeViewPro/richTreeViewProClasses.js +6 -0
  22. package/esm/index.d.ts +12 -0
  23. package/esm/index.js +22 -0
  24. package/esm/internals/index.d.ts +1 -0
  25. package/esm/internals/index.js +1 -0
  26. package/esm/internals/plugins/useTreeViewItemsReordering/index.d.ts +2 -0
  27. package/esm/internals/plugins/useTreeViewItemsReordering/index.js +1 -0
  28. package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.d.ts +3 -0
  29. package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.d.ts +3 -0
  30. package/{node → esm}/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.js +10 -19
  31. package/{node → esm}/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.js +29 -48
  32. package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.d.ts +179 -0
  33. package/{node → esm}/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.js +4 -11
  34. package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.d.ts +132 -0
  35. package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.js +1 -0
  36. package/esm/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.utils.d.ts +37 -0
  37. package/{node → esm}/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.utils.js +21 -31
  38. package/esm/internals/utils/releaseInfo.d.ts +1 -0
  39. package/esm/internals/utils/releaseInfo.js +13 -0
  40. package/esm/internals/zero-styled/index.d.ts +3 -0
  41. package/esm/internals/zero-styled/index.js +7 -0
  42. package/esm/package.json +1 -0
  43. package/esm/themeAugmentation/components.d.ts +11 -0
  44. package/esm/themeAugmentation/index.d.ts +3 -0
  45. package/esm/themeAugmentation/index.js +0 -0
  46. package/esm/themeAugmentation/overrides.d.ts +12 -0
  47. package/esm/themeAugmentation/props.d.ts +10 -0
  48. package/index.d.ts +2 -2
  49. package/index.js +147 -15
  50. package/internals/index.d.ts +1 -1
  51. package/internals/index.js +12 -1
  52. package/internals/plugins/useTreeViewItemsReordering/index.d.ts +2 -2
  53. package/internals/plugins/useTreeViewItemsReordering/index.js +12 -1
  54. package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.d.ts +2 -2
  55. package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.d.ts +1 -1
  56. package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.js +19 -10
  57. package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.js +38 -39
  58. package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.d.ts +134 -134
  59. package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.js +11 -4
  60. package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.d.ts +108 -117
  61. package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.js +5 -1
  62. package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.utils.d.ts +28 -15
  63. package/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.utils.js +31 -21
  64. package/internals/utils/releaseInfo.d.ts +1 -1
  65. package/internals/utils/releaseInfo.js +13 -5
  66. package/internals/zero-styled/index.d.ts +1 -1
  67. package/internals/zero-styled/index.js +14 -4
  68. package/modern/RichTreeViewPro/RichTreeViewPro.d.ts +20 -0
  69. package/modern/RichTreeViewPro/RichTreeViewPro.js +5 -12
  70. package/modern/RichTreeViewPro/RichTreeViewPro.plugins.d.ts +7 -0
  71. package/modern/RichTreeViewPro/RichTreeViewPro.types.d.ts +51 -0
  72. package/modern/RichTreeViewPro/index.d.ts +3 -0
  73. package/modern/RichTreeViewPro/richTreeViewProClasses.d.ts +7 -0
  74. package/modern/index.d.ts +12 -0
  75. package/modern/index.js +1 -1
  76. package/modern/internals/index.d.ts +1 -0
  77. package/modern/internals/plugins/useTreeViewItemsReordering/index.d.ts +2 -0
  78. package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.d.ts +3 -0
  79. package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.itemPlugin.d.ts +3 -0
  80. package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.js +4 -14
  81. package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.selectors.d.ts +179 -0
  82. package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.d.ts +132 -0
  83. package/modern/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.utils.d.ts +37 -0
  84. package/modern/internals/utils/releaseInfo.d.ts +1 -0
  85. package/modern/internals/utils/releaseInfo.js +1 -1
  86. package/modern/internals/zero-styled/index.d.ts +3 -0
  87. package/modern/package.json +1 -0
  88. package/modern/themeAugmentation/components.d.ts +11 -0
  89. package/modern/themeAugmentation/index.d.ts +3 -0
  90. package/modern/themeAugmentation/overrides.d.ts +12 -0
  91. package/modern/themeAugmentation/props.d.ts +10 -0
  92. package/package.json +40 -10
  93. package/themeAugmentation/components.d.ts +1 -3
  94. package/themeAugmentation/index.d.ts +1 -1
  95. package/themeAugmentation/index.js +1 -0
  96. package/themeAugmentation/overrides.d.ts +2 -3
  97. package/themeAugmentation/props.d.ts +2 -4
  98. package/tsconfig.build.tsbuildinfo +1 -0
  99. package/RichTreeViewPro/package.json +0 -6
  100. package/internals/package.json +0 -6
  101. package/node/RichTreeViewPro/RichTreeViewPro.plugins.js +0 -11
  102. package/node/RichTreeViewPro/RichTreeViewPro.types.js +0 -5
  103. package/node/RichTreeViewPro/index.js +0 -27
  104. package/node/RichTreeViewPro/richTreeViewProClasses.js +0 -14
  105. package/node/index.js +0 -154
  106. package/node/internals/index.js +0 -12
  107. package/node/internals/plugins/useTreeViewItemsReordering/index.js +0 -12
  108. package/node/internals/plugins/useTreeViewItemsReordering/useTreeViewItemsReordering.types.js +0 -5
  109. package/node/internals/utils/releaseInfo.js +0 -21
  110. package/node/internals/zero-styled/index.js +0 -17
  111. package/node/themeAugmentation/index.js +0 -1
  112. package/themeAugmentation/package.json +0 -6
@@ -4,138 +4,129 @@ import { TreeViewPluginSignature, UseTreeViewItemsSignature } from '@mui/x-tree-
4
4
  import { TreeViewItemId, TreeViewItemsReorderingAction, TreeViewCancellableEventHandler } from '@mui/x-tree-view/models';
5
5
  import { TreeItemDragAndDropOverlayProps } from '@mui/x-tree-view/TreeItemDragAndDropOverlay';
6
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;
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
48
  }
49
49
  export interface TreeViewItemReorderPosition {
50
- parentId: string | null;
51
- index: number;
50
+ parentId: string | null;
51
+ index: number;
52
52
  }
53
- export type TreeViewItemItemReorderingValidActions = {
54
- [key in TreeViewItemsReorderingAction]?: TreeViewItemReorderPosition;
55
- };
53
+ export type TreeViewItemItemReorderingValidActions = { [key in TreeViewItemsReorderingAction]?: TreeViewItemReorderPosition };
56
54
  export interface UseTreeViewItemsReorderingParameters {
57
- /**
58
- * If `true`, the reordering of items is enabled.
59
- * Make sure to also enable the `itemsReordering` experimental feature:
60
- * `<RichTreeViewPro experimentalFeatures={{ itemsReordering: true }} itemsReordering />`.
61
- * @default false
62
- */
63
- itemsReordering?: boolean;
64
- /**
65
- * Used to determine if a given item can be reordered.
66
- * @param {string} itemId The id of the item to check.
67
- * @returns {boolean} `true` if the item can be reordered.
68
- * @default () => true
69
- */
70
- isItemReorderable?: (itemId: string) => boolean;
71
- /**
72
- * Used to determine if a given item can move to some new position.
73
- * @param {object} params The params describing the item re-ordering.
74
- * @param {string} params.itemId The id of the item that is being moved to a new position.
75
- * @param {TreeViewItemReorderPosition} params.oldPosition The old position of the item.
76
- * @param {TreeViewItemReorderPosition} params.newPosition The new position of the item.
77
- * @returns {boolean} `true` if the item can move to the new position.
78
- */
79
- canMoveItemToNewPosition?: (params: {
80
- itemId: string;
81
- oldPosition: TreeViewItemReorderPosition;
82
- newPosition: TreeViewItemReorderPosition;
83
- }) => boolean;
84
- /**
85
- * Callback fired when a Tree Item is moved in the tree.
86
- * @param {object} params The params describing the item re-ordering.
87
- * @param {string} params.itemId The id of the item moved.
88
- * @param {TreeViewItemReorderPosition} params.oldPosition The old position of the item.
89
- * @param {TreeViewItemReorderPosition} params.newPosition The new position of the item.
90
- */
91
- onItemPositionChange?: (params: {
92
- itemId: string;
93
- oldPosition: TreeViewItemReorderPosition;
94
- newPosition: TreeViewItemReorderPosition;
95
- }) => void;
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;
96
92
  }
97
93
  export type UseTreeViewItemsReorderingDefaultizedParameters = DefaultizedProps<UseTreeViewItemsReorderingParameters, 'itemsReordering'>;
98
94
  export interface UseTreeViewItemsReorderingState {
99
- itemsReordering: {
100
- draggedItemId: string;
101
- targetItemId: string;
102
- newPosition: TreeViewItemReorderPosition | null;
103
- action: TreeViewItemsReorderingAction | null;
104
- } | null;
95
+ itemsReordering: {
96
+ draggedItemId: string;
97
+ targetItemId: string;
98
+ newPosition: TreeViewItemReorderPosition | null;
99
+ action: TreeViewItemsReorderingAction | null;
100
+ } | null;
105
101
  }
106
102
  interface UseTreeViewItemsReorderingContextValue {
107
- itemsReordering: {
108
- enabled: boolean;
109
- isItemReorderable: ((itemId: string) => boolean) | undefined;
110
- };
103
+ itemsReordering: {
104
+ enabled: boolean;
105
+ isItemReorderable: ((itemId: string) => boolean) | undefined;
106
+ };
111
107
  }
112
108
  export type UseTreeViewItemsReorderingSignature = TreeViewPluginSignature<{
113
- params: UseTreeViewItemsReorderingParameters;
114
- defaultizedParams: UseTreeViewItemsReorderingDefaultizedParameters;
115
- instance: UseTreeViewItemsReorderingInstance;
116
- state: UseTreeViewItemsReorderingState;
117
- contextValue: UseTreeViewItemsReorderingContextValue;
118
- experimentalFeatures: 'itemsReordering';
119
- dependencies: [UseTreeViewItemsSignature];
109
+ params: UseTreeViewItemsReorderingParameters;
110
+ defaultizedParams: UseTreeViewItemsReorderingDefaultizedParameters;
111
+ instance: UseTreeViewItemsReorderingInstance;
112
+ state: UseTreeViewItemsReorderingState;
113
+ contextValue: UseTreeViewItemsReorderingContextValue;
114
+ dependencies: [UseTreeViewItemsSignature];
120
115
  }>;
121
116
  export interface UseTreeItemRootSlotPropsFromItemsReordering {
122
- draggable?: true;
123
- onDragStart?: TreeViewCancellableEventHandler<React.DragEvent>;
124
- onDragOver?: TreeViewCancellableEventHandler<React.DragEvent>;
125
- onDragEnd?: TreeViewCancellableEventHandler<React.DragEvent>;
117
+ draggable?: true;
118
+ onDragStart?: TreeViewCancellableEventHandler<React.DragEvent>;
119
+ onDragOver?: TreeViewCancellableEventHandler<React.DragEvent>;
120
+ onDragEnd?: TreeViewCancellableEventHandler<React.DragEvent>;
126
121
  }
127
122
  export interface UseTreeItemContentSlotPropsFromItemsReordering {
128
- onDragEnter?: TreeViewCancellableEventHandler<React.DragEvent>;
129
- onDragOver?: TreeViewCancellableEventHandler<React.DragEvent>;
130
- }
131
- export interface UseTreeItemDragAndDropOverlaySlotPropsFromItemsReordering extends TreeItemDragAndDropOverlayProps {
123
+ onDragEnter?: TreeViewCancellableEventHandler<React.DragEvent>;
124
+ onDragOver?: TreeViewCancellableEventHandler<React.DragEvent>;
132
125
  }
126
+ export interface UseTreeItemDragAndDropOverlaySlotPropsFromItemsReordering extends TreeItemDragAndDropOverlayProps {}
133
127
  declare module '@mui/x-tree-view/useTreeItem' {
134
- interface UseTreeItemRootSlotOwnProps extends UseTreeItemRootSlotPropsFromItemsReordering {
135
- }
136
- interface UseTreeItemContentSlotOwnProps extends UseTreeItemContentSlotPropsFromItemsReordering {
137
- }
138
- interface UseTreeItemDragAndDropOverlaySlotOwnProps extends UseTreeItemDragAndDropOverlaySlotPropsFromItemsReordering {
139
- }
128
+ interface UseTreeItemRootSlotOwnProps extends UseTreeItemRootSlotPropsFromItemsReordering {}
129
+ interface UseTreeItemContentSlotOwnProps extends UseTreeItemContentSlotPropsFromItemsReordering {}
130
+ interface UseTreeItemDragAndDropOverlaySlotOwnProps extends UseTreeItemDragAndDropOverlaySlotPropsFromItemsReordering {}
140
131
  }
141
- export {};
132
+ export {};
@@ -1 +1,5 @@
1
- export {};
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1,24 +1,37 @@
1
1
  import { TreeViewUsedStore, UseTreeViewItemsState } from '@mui/x-tree-view/internals';
2
2
  import { TreeViewItemId, TreeViewItemsReorderingAction } from '@mui/x-tree-view/models';
3
- import { TreeViewItemItemReorderingValidActions, TreeViewItemReorderPosition, UseTreeViewItemsReorderingSignature } from './useTreeViewItemsReordering.types';
3
+ import { TreeViewItemItemReorderingValidActions, TreeViewItemReorderPosition, UseTreeViewItemsReorderingSignature } from "./useTreeViewItemsReordering.types.js";
4
4
  /**
5
5
  * Checks if the item with the id itemIdB is an ancestor of the item with the id itemIdA.
6
6
  */
7
7
  export declare const isAncestor: (store: TreeViewUsedStore<UseTreeViewItemsReorderingSignature>, itemIdA: string, itemIdB: string) => boolean;
8
8
  interface GetNewPositionParams {
9
- itemChildrenIndentation: string | number;
10
- validActions: TreeViewItemItemReorderingValidActions;
11
- targetHeight: number;
12
- targetDepth: number;
13
- cursorY: number;
14
- cursorX: number;
15
- contentElement: HTMLDivElement;
9
+ itemChildrenIndentation: string | number;
10
+ validActions: TreeViewItemItemReorderingValidActions;
11
+ targetHeight: number;
12
+ targetDepth: number;
13
+ cursorY: number;
14
+ cursorX: number;
15
+ contentElement: HTMLDivElement;
16
16
  }
17
- export declare const chooseActionToApply: ({ itemChildrenIndentation, validActions, targetHeight, targetDepth, cursorX, cursorY, contentElement, }: GetNewPositionParams) => TreeViewItemsReorderingAction | null;
18
- export declare const moveItemInTree: <R extends {}>({ itemToMoveId, oldPosition, newPosition, prevState, }: {
19
- itemToMoveId: TreeViewItemId;
20
- oldPosition: TreeViewItemReorderPosition;
21
- newPosition: TreeViewItemReorderPosition;
22
- prevState: UseTreeViewItemsState<R>["items"];
17
+ export declare const chooseActionToApply: ({
18
+ itemChildrenIndentation,
19
+ validActions,
20
+ targetHeight,
21
+ targetDepth,
22
+ cursorX,
23
+ cursorY,
24
+ contentElement
25
+ }: GetNewPositionParams) => TreeViewItemsReorderingAction | null;
26
+ export declare const moveItemInTree: <R extends {}>({
27
+ itemToMoveId,
28
+ oldPosition,
29
+ newPosition,
30
+ prevState
31
+ }: {
32
+ itemToMoveId: TreeViewItemId;
33
+ oldPosition: TreeViewItemReorderPosition;
34
+ newPosition: TreeViewItemReorderPosition;
35
+ prevState: UseTreeViewItemsState<R>["items"];
23
36
  }) => UseTreeViewItemsState<R>["items"];
24
- export {};
37
+ export {};
@@ -1,10 +1,17 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { buildSiblingIndexes, TREE_VIEW_ROOT_PARENT_ID, selectorItemMeta } from '@mui/x-tree-view/internals';
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.moveItemInTree = exports.isAncestor = exports.chooseActionToApply = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _internals = require("@mui/x-tree-view/internals");
3
10
  /**
4
11
  * Checks if the item with the id itemIdB is an ancestor of the item with the id itemIdA.
5
12
  */
6
- export const isAncestor = (store, itemIdA, itemIdB) => {
7
- const itemMetaA = selectorItemMeta(store.value, itemIdA);
13
+ const isAncestor = (store, itemIdA, itemIdB) => {
14
+ const itemMetaA = (0, _internals.selectorItemMeta)(store.value, itemIdA);
8
15
  if (itemMetaA.parentId === itemIdB) {
9
16
  return true;
10
17
  }
@@ -19,6 +26,7 @@ export const isAncestor = (store, itemIdA, itemIdB) => {
19
26
  * @param {string | null} itemChildrenIndentation The indentation as passed to the `itemChildrenIndentation` prop.
20
27
  * @param {HTMLElement} contentElement The DOM element to which the indentation will be applied.
21
28
  */
29
+ exports.isAncestor = isAncestor;
22
30
  const parseItemChildrenIndentation = (itemChildrenIndentation, contentElement) => {
23
31
  if (typeof itemChildrenIndentation === 'number') {
24
32
  return itemChildrenIndentation;
@@ -37,7 +45,7 @@ const parseItemChildrenIndentation = (itemChildrenIndentation, contentElement) =
37
45
  contentElement.removeChild(tempElement);
38
46
  return value;
39
47
  };
40
- export const chooseActionToApply = ({
48
+ const chooseActionToApply = ({
41
49
  itemChildrenIndentation,
42
50
  validActions,
43
51
  targetHeight,
@@ -82,23 +90,24 @@ export const chooseActionToApply = ({
82
90
  }
83
91
  return action;
84
92
  };
85
- export const moveItemInTree = ({
93
+ exports.chooseActionToApply = chooseActionToApply;
94
+ const moveItemInTree = ({
86
95
  itemToMoveId,
87
96
  oldPosition,
88
97
  newPosition,
89
98
  prevState
90
99
  }) => {
91
100
  const itemToMoveMeta = prevState.itemMetaLookup[itemToMoveId];
92
- const oldParentId = oldPosition.parentId ?? TREE_VIEW_ROOT_PARENT_ID;
93
- const newParentId = newPosition.parentId ?? TREE_VIEW_ROOT_PARENT_ID;
101
+ const oldParentId = oldPosition.parentId ?? _internals.TREE_VIEW_ROOT_PARENT_ID;
102
+ const newParentId = newPosition.parentId ?? _internals.TREE_VIEW_ROOT_PARENT_ID;
94
103
 
95
104
  // 1. Update the `itemOrderedChildrenIds`.
96
- const itemOrderedChildrenIds = _extends({}, prevState.itemOrderedChildrenIdsLookup);
105
+ const itemOrderedChildrenIds = (0, _extends2.default)({}, prevState.itemOrderedChildrenIdsLookup);
97
106
  if (oldParentId === newParentId) {
98
107
  const updatedChildren = [...itemOrderedChildrenIds[oldParentId]];
99
108
  updatedChildren.splice(oldPosition.index, 1);
100
109
  updatedChildren.splice(newPosition.index, 0, itemToMoveId);
101
- itemOrderedChildrenIds[itemToMoveMeta.parentId ?? TREE_VIEW_ROOT_PARENT_ID] = updatedChildren;
110
+ itemOrderedChildrenIds[itemToMoveMeta.parentId ?? _internals.TREE_VIEW_ROOT_PARENT_ID] = updatedChildren;
102
111
  } else {
103
112
  const updatedOldParentChildren = [...itemOrderedChildrenIds[oldParentId]];
104
113
  updatedOldParentChildren.splice(oldPosition.index, 1);
@@ -109,50 +118,51 @@ export const moveItemInTree = ({
109
118
  }
110
119
 
111
120
  // 2. Update the `itemChildrenIndexes`
112
- const itemChildrenIndexes = _extends({}, prevState.itemChildrenIndexesLookup);
113
- itemChildrenIndexes[oldParentId] = buildSiblingIndexes(itemOrderedChildrenIds[oldParentId]);
121
+ const itemChildrenIndexes = (0, _extends2.default)({}, prevState.itemChildrenIndexesLookup);
122
+ itemChildrenIndexes[oldParentId] = (0, _internals.buildSiblingIndexes)(itemOrderedChildrenIds[oldParentId]);
114
123
  if (newParentId !== oldParentId) {
115
- itemChildrenIndexes[newParentId] = buildSiblingIndexes(itemOrderedChildrenIds[newParentId]);
124
+ itemChildrenIndexes[newParentId] = (0, _internals.buildSiblingIndexes)(itemOrderedChildrenIds[newParentId]);
116
125
  }
117
126
 
118
127
  // 3. Update the `itemMetaLookup`
119
- const itemMetaLookup = _extends({}, prevState.itemMetaLookup);
128
+ const itemMetaLookup = (0, _extends2.default)({}, prevState.itemMetaLookup);
120
129
 
121
130
  // 3.1 Update the `expandable` property of the old and the new parent
122
131
  function updateExpandable(itemId) {
123
132
  const isExpandable = itemOrderedChildrenIds[itemId].length > 0;
124
133
  if (itemMetaLookup[itemId].expandable !== isExpandable) {
125
- itemMetaLookup[itemId] = _extends({}, itemMetaLookup[itemId], {
134
+ itemMetaLookup[itemId] = (0, _extends2.default)({}, itemMetaLookup[itemId], {
126
135
  expandable: isExpandable
127
136
  });
128
137
  }
129
138
  }
130
- if (oldParentId !== TREE_VIEW_ROOT_PARENT_ID && oldParentId !== newParentId) {
139
+ if (oldParentId !== _internals.TREE_VIEW_ROOT_PARENT_ID && oldParentId !== newParentId) {
131
140
  updateExpandable(oldParentId);
132
141
  }
133
- if (newParentId !== TREE_VIEW_ROOT_PARENT_ID && newParentId !== oldParentId) {
142
+ if (newParentId !== _internals.TREE_VIEW_ROOT_PARENT_ID && newParentId !== oldParentId) {
134
143
  updateExpandable(newParentId);
135
144
  }
136
145
 
137
146
  // 3.2 Update the `parentId` and `depth` properties of the item to move
138
147
  // The depth is always defined because drag&drop is only usable with Rich Tree View components.
139
148
  const itemToMoveDepth = newPosition.parentId == null ? 0 : itemMetaLookup[newParentId].depth + 1;
140
- itemMetaLookup[itemToMoveId] = _extends({}, itemToMoveMeta, {
149
+ itemMetaLookup[itemToMoveId] = (0, _extends2.default)({}, itemToMoveMeta, {
141
150
  parentId: newPosition.parentId,
142
151
  depth: itemToMoveDepth
143
152
  });
144
153
 
145
154
  // 3.3 Update the depth of all the children of the item to move
146
155
  const updateItemDepth = (itemId, depth) => {
147
- itemMetaLookup[itemId] = _extends({}, itemMetaLookup[itemId], {
156
+ itemMetaLookup[itemId] = (0, _extends2.default)({}, itemMetaLookup[itemId], {
148
157
  depth
149
158
  });
150
159
  itemOrderedChildrenIds[itemId]?.forEach(childId => updateItemDepth(childId, depth + 1));
151
160
  };
152
161
  itemOrderedChildrenIds[itemToMoveId]?.forEach(childId => updateItemDepth(childId, itemToMoveDepth + 1));
153
- return _extends({}, prevState, {
162
+ return (0, _extends2.default)({}, prevState, {
154
163
  itemOrderedChildrenIdsLookup: itemOrderedChildrenIds,
155
164
  itemChildrenIndexesLookup: itemChildrenIndexes,
156
165
  itemMetaLookup
157
166
  });
158
- };
167
+ };
168
+ exports.moveItemInTree = moveItemInTree;
@@ -1 +1 @@
1
- export declare const getReleaseInfo: () => any;
1
+ export declare const getReleaseInfo: () => any;
@@ -1,13 +1,21 @@
1
- import ponyfillGlobal from '@mui/utils/ponyfillGlobal';
2
- export const getReleaseInfo = () => {
3
- const releaseInfo = "MTczODI5OTYwMDAwMA==";
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getReleaseInfo = void 0;
8
+ var _ponyfillGlobal = _interopRequireDefault(require("@mui/utils/ponyfillGlobal"));
9
+ const getReleaseInfo = () => {
10
+ const releaseInfo = "MTczOTc0NjgwMDAwMA==";
4
11
  if (process.env.NODE_ENV !== 'production') {
5
12
  // A simple hack to set the value in the test environment (has no build step).
6
13
  // eslint-disable-next-line no-useless-concat
7
14
  if (releaseInfo === '__RELEASE' + '_INFO__') {
8
15
  // eslint-disable-next-line no-underscore-dangle
9
- return ponyfillGlobal.__MUI_RELEASE_INFO__;
16
+ return _ponyfillGlobal.default.__MUI_RELEASE_INFO__;
10
17
  }
11
18
  }
12
19
  return releaseInfo;
13
- };
20
+ };
21
+ exports.getReleaseInfo = getReleaseInfo;
@@ -1,3 +1,3 @@
1
1
  import { useThemeProps } from '@mui/material/styles';
2
2
  export { styled } from '@mui/material/styles';
3
- export declare function createUseThemeProps(name: string): typeof useThemeProps;
3
+ export declare function createUseThemeProps(name: string): typeof useThemeProps;
@@ -1,7 +1,17 @@
1
- import { useThemeProps } from '@mui/material/styles';
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
- export function createUseThemeProps(name) {
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.ClassAttributes<HTMLUListElement> | keyof React.HTMLAttributes<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 };
@@ -167,10 +167,7 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
167
167
  * For each feature, if the flag is not explicitly set to `true`,
168
168
  * the feature will be fully disabled and any property / method call will not have any effect.
169
169
  */
170
- experimentalFeatures: PropTypes.shape({
171
- itemsReordering: PropTypes.bool,
172
- labelEditing: PropTypes.bool
173
- }),
170
+ experimentalFeatures: PropTypes.object,
174
171
  /**
175
172
  * Used to determine the id of a given item.
176
173
  *
@@ -202,17 +199,15 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
202
199
  */
203
200
  isItemDisabled: PropTypes.func,
204
201
  /**
205
- * Determines if a given item is editable or not.
206
- * Make sure to also enable the `labelEditing` experimental feature:
207
- * `<RichTreeViewPro experimentalFeatures={{ labelEditing: true }} />`.
208
- * By default, the items are not editable.
202
+ * Determine if a given item can be edited.
209
203
  * @template R
210
204
  * @param {R} item The item to check.
211
- * @returns {boolean} `true` if the item is editable.
205
+ * @returns {boolean} `true` if the item can be edited.
206
+ * @default () => false
212
207
  */
213
208
  isItemEditable: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
214
209
  /**
215
- * Used to determine if a given item can be reordered.
210
+ * Determine if a given item can be reordered.
216
211
  * @param {string} itemId The id of the item to check.
217
212
  * @returns {boolean} `true` if the item can be reordered.
218
213
  * @default () => true
@@ -227,8 +222,6 @@ process.env.NODE_ENV !== "production" ? RichTreeViewPro.propTypes = {
227
222
  items: PropTypes.array.isRequired,
228
223
  /**
229
224
  * 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
225
  * @default false
233
226
  */
234
227
  itemsReordering: PropTypes.bool,
@@ -0,0 +1,7 @@
1
+ import { UseTreeViewItemsParameters, UseTreeViewExpansionParameters, UseTreeViewSelectionParameters, UseTreeViewFocusParameters, UseTreeViewIconsParameters, ConvertPluginsIntoSignatures, MergeSignaturesProperty, TreeViewCorePluginParameters, UseTreeViewLabelParameters } 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("../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>, UseTreeViewItemsReorderingParameters {}
@@ -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,3 @@
1
+ export * from "./RichTreeViewPro.js";
2
+ export * from "./richTreeViewProClasses.js";
3
+ export type { RichTreeViewProProps, RichTreeViewProPropsBase, RichTreeViewProSlots, RichTreeViewProSlotProps } from './RichTreeViewPro.types';