@mui/x-tree-view 7.6.2 → 7.7.1
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 +163 -0
- package/RichTreeView/RichTreeView.d.ts +1 -3
- package/RichTreeView/RichTreeView.js +12 -15
- package/RichTreeView/RichTreeView.plugins.d.ts +13 -0
- package/RichTreeView/RichTreeView.plugins.js +9 -0
- package/RichTreeView/RichTreeView.types.d.ts +6 -6
- package/RichTreeView/index.d.ts +2 -0
- package/RichTreeView/index.js +1 -1
- package/SimpleTreeView/SimpleTreeView.d.ts +1 -1
- package/SimpleTreeView/SimpleTreeView.js +11 -14
- package/SimpleTreeView/SimpleTreeView.plugins.d.ts +12 -7
- package/SimpleTreeView/SimpleTreeView.plugins.js +7 -2
- package/SimpleTreeView/SimpleTreeView.types.d.ts +3 -3
- package/TreeItem/TreeItem.js +7 -1
- package/TreeItem/TreeItem.types.d.ts +27 -1
- package/TreeItem2/TreeItem2.js +12 -2
- package/TreeItem2/TreeItem2.types.d.ts +10 -1
- package/TreeView/TreeView.js +2 -1
- package/hooks/useTreeItem2Utils/useTreeItem2Utils.d.ts +4 -0
- package/hooks/useTreeItem2Utils/useTreeItem2Utils.js +9 -0
- package/hooks/useTreeViewApiRef.d.ts +1 -1
- package/index.js +1 -1
- package/internals/TreeViewProvider/TreeViewChildrenItemProvider.js +3 -1
- package/internals/TreeViewProvider/TreeViewContext.d.ts +2 -8
- package/internals/TreeViewProvider/TreeViewProvider.d.ts +1 -1
- package/internals/TreeViewProvider/TreeViewProvider.types.d.ts +10 -9
- package/internals/TreeViewProvider/index.d.ts +1 -1
- package/internals/TreeViewProvider/useTreeViewContext.d.ts +1 -1
- package/internals/corePlugins/corePlugins.d.ts +6 -3
- package/internals/corePlugins/corePlugins.js +2 -1
- package/internals/corePlugins/index.d.ts +1 -1
- package/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.types.d.ts +0 -4
- package/internals/hooks/useInstanceEventHandler.d.ts +2 -2
- package/internals/index.d.ts +2 -7
- package/internals/index.js +4 -4
- package/internals/models/helpers.d.ts +3 -16
- package/internals/models/plugin.d.ts +25 -19
- package/internals/models/treeView.d.ts +5 -4
- package/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.types.d.ts +1 -1
- package/internals/plugins/useTreeViewFocus/useTreeViewFocus.types.d.ts +1 -3
- package/internals/plugins/useTreeViewIcons/useTreeViewIcons.types.d.ts +1 -1
- package/internals/plugins/useTreeViewJSXItems/useTreeViewJSXItems.types.d.ts +1 -1
- package/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.js +4 -5
- package/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.types.d.ts +1 -1
- package/internals/plugins/useTreeViewSelection/useTreeViewSelection.types.d.ts +1 -1
- package/internals/useTreeView/extractPluginParamsFromProps.d.ts +13 -0
- package/internals/{utils → useTreeView}/extractPluginParamsFromProps.js +16 -16
- package/internals/useTreeView/index.d.ts +0 -1
- package/internals/useTreeView/useTreeView.d.ts +4 -4
- package/internals/useTreeView/useTreeView.js +85 -72
- package/internals/useTreeView/useTreeView.types.d.ts +13 -12
- package/internals/useTreeView/useTreeViewModels.d.ts +3 -2
- package/internals/utils/publishTreeViewEvent.d.ts +1 -1
- package/internals/utils/utils.d.ts +1 -0
- package/internals/utils/utils.js +7 -1
- package/internals/zero-styled/index.d.ts +3 -0
- package/internals/zero-styled/index.js +7 -0
- package/modern/RichTreeView/RichTreeView.js +12 -15
- package/modern/RichTreeView/RichTreeView.plugins.js +9 -0
- package/modern/RichTreeView/index.js +1 -1
- package/modern/SimpleTreeView/SimpleTreeView.js +11 -14
- package/modern/SimpleTreeView/SimpleTreeView.plugins.js +7 -2
- package/modern/TreeItem/TreeItem.js +7 -1
- package/modern/TreeItem2/TreeItem2.js +12 -2
- package/modern/TreeView/TreeView.js +2 -1
- package/modern/hooks/useTreeItem2Utils/useTreeItem2Utils.js +9 -0
- package/modern/index.js +1 -1
- package/modern/internals/TreeViewProvider/TreeViewChildrenItemProvider.js +3 -1
- package/modern/internals/corePlugins/corePlugins.js +2 -1
- package/modern/internals/index.js +4 -4
- package/modern/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.js +4 -5
- package/modern/internals/{utils → useTreeView}/extractPluginParamsFromProps.js +16 -16
- package/modern/internals/useTreeView/useTreeView.js +85 -72
- package/modern/internals/utils/utils.js +7 -1
- package/modern/internals/zero-styled/index.js +7 -0
- package/node/RichTreeView/RichTreeView.js +14 -17
- package/node/RichTreeView/RichTreeView.plugins.js +15 -0
- package/node/RichTreeView/index.js +13 -1
- package/node/SimpleTreeView/SimpleTreeView.js +13 -16
- package/node/SimpleTreeView/SimpleTreeView.plugins.js +7 -2
- package/node/TreeItem/TreeItem.js +10 -4
- package/node/TreeItem2/TreeItem2.js +18 -8
- package/node/TreeView/TreeView.js +4 -3
- package/node/hooks/useTreeItem2Utils/useTreeItem2Utils.js +9 -0
- package/node/index.js +1 -1
- package/node/internals/TreeViewProvider/TreeViewChildrenItemProvider.js +3 -1
- package/node/internals/corePlugins/corePlugins.js +2 -1
- package/node/internals/index.js +1 -22
- package/node/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.js +4 -5
- package/node/internals/{utils → useTreeView}/extractPluginParamsFromProps.js +16 -16
- package/node/internals/useTreeView/useTreeView.js +85 -72
- package/node/internals/utils/utils.js +8 -1
- package/node/internals/zero-styled/index.js +17 -0
- package/package.json +4 -4
- package/useTreeItem2/useTreeItem2.d.ts +2 -2
- package/useTreeItem2/useTreeItem2.types.d.ts +20 -3
- package/internals/plugins/defaultPlugins.d.ts +0 -13
- package/internals/plugins/defaultPlugins.js +0 -10
- package/internals/plugins/index.d.ts +0 -2
- package/internals/plugins/index.js +0 -1
- package/internals/utils/extractPluginParamsFromProps.d.ts +0 -18
- package/modern/internals/plugins/defaultPlugins.js +0 -10
- package/modern/internals/plugins/index.js +0 -1
- package/node/internals/plugins/defaultPlugins.js +0 -16
- package/node/internals/plugins/index.js +0 -12
- /package/internals/{plugins → corePlugins}/useTreeViewId/index.d.ts +0 -0
- /package/internals/{plugins → corePlugins}/useTreeViewId/index.js +0 -0
- /package/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.d.ts +0 -0
- /package/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.js +0 -0
- /package/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.types.js +0 -0
- /package/modern/internals/{plugins → corePlugins}/useTreeViewId/index.js +0 -0
- /package/modern/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.js +0 -0
- /package/modern/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.types.js +0 -0
- /package/node/internals/{plugins → corePlugins}/useTreeViewId/index.js +0 -0
- /package/node/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.js +0 -0
- /package/node/internals/{plugins → corePlugins}/useTreeViewId/useTreeViewId.types.js +0 -0
|
@@ -5,6 +5,15 @@ const isItemExpandable = reactChildren => {
|
|
|
5
5
|
}
|
|
6
6
|
return Boolean(reactChildren);
|
|
7
7
|
};
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Plugins that need to be present in the Tree View in order for `useTreeItem2Utils` to work correctly.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Plugins that `useTreeItem2Utils` can use if they are present, but are not required.
|
|
15
|
+
*/
|
|
16
|
+
|
|
8
17
|
export const useTreeItem2Utils = ({
|
|
9
18
|
itemId,
|
|
10
19
|
children
|
|
@@ -3,4 +3,4 @@ import { TreeViewAnyPluginSignature, TreeViewPublicAPI } from '../internals/mode
|
|
|
3
3
|
/**
|
|
4
4
|
* Hook that instantiates a [[TreeViewApiRef]].
|
|
5
5
|
*/
|
|
6
|
-
export declare const useTreeViewApiRef: <
|
|
6
|
+
export declare const useTreeViewApiRef: <TSignatures extends readonly TreeViewAnyPluginSignature[] = readonly [import("../internals").UseTreeViewItemsSignature, import("../internals").UseTreeViewExpansionSignature, import("../internals").UseTreeViewSelectionSignature, import("../internals").UseTreeViewFocusSignature, import("../internals").UseTreeViewKeyboardNavigationSignature, import("../internals").UseTreeViewIconsSignature]>() => React.MutableRefObject<TreeViewPublicAPI<TSignatures> | undefined>;
|
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { useTreeViewContext } from './useTreeViewContext';
|
|
4
|
+
import { escapeOperandAttributeSelector } from '../utils/utils';
|
|
4
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
6
|
export const TreeViewChildrenItemContext = /*#__PURE__*/React.createContext(null);
|
|
6
7
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -34,7 +35,8 @@ export function TreeViewChildrenItemProvider(props) {
|
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
36
37
|
const previousChildrenIds = instance.getItemOrderedChildrenIds(itemId ?? null) ?? [];
|
|
37
|
-
const
|
|
38
|
+
const escapedIdAttr = escapeOperandAttributeSelector(idAttr);
|
|
39
|
+
const childrenElements = rootRef.current.querySelectorAll(`${itemId == null ? '' : `*[id="${escapedIdAttr}"] `}[role="treeitem"]:not(*[id="${escapedIdAttr}"] [role="treeitem"] [role="treeitem"])`);
|
|
38
40
|
const childrenIds = Array.from(childrenElements).map(child => childrenIdAttrToIdRef.current.get(child.id));
|
|
39
41
|
const hasChanged = childrenIds.length !== previousChildrenIds.length || childrenIds.some((childId, index) => childId !== previousChildrenIds[index]);
|
|
40
42
|
if (hasChanged) {
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { TreeViewContextValue } from './TreeViewProvider.types';
|
|
2
3
|
/**
|
|
3
4
|
* @ignore - internal component.
|
|
4
5
|
*/
|
|
5
|
-
export declare const TreeViewContext: React.Context<
|
|
6
|
-
instance: {};
|
|
7
|
-
publicAPI: {};
|
|
8
|
-
rootRef: React.RefObject<HTMLUListElement>;
|
|
9
|
-
wrapItem: import("../models").TreeItemWrapper<any>;
|
|
10
|
-
wrapRoot: import("../models").TreeRootWrapper<any>;
|
|
11
|
-
runItemPlugins: <TProps extends {}>(props: TProps) => Required<import("../models").TreeViewItemPluginResponse>;
|
|
12
|
-
} | null>;
|
|
6
|
+
export declare const TreeViewContext: React.Context<TreeViewContextValue<any> | null>;
|
|
@@ -6,4 +6,4 @@ import { TreeViewAnyPluginSignature } from '../models';
|
|
|
6
6
|
*
|
|
7
7
|
* @ignore - do not document.
|
|
8
8
|
*/
|
|
9
|
-
export declare function TreeViewProvider<
|
|
9
|
+
export declare function TreeViewProvider<TSignatures extends readonly TreeViewAnyPluginSignature[]>(props: TreeViewProviderProps<TSignatures>): React.JSX.Element;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { MergeSignaturesProperty, TreeItemWrapper, TreeRootWrapper, TreeViewAnyPluginSignature, TreeViewInstance, TreeViewItemPluginResponse, TreeViewPublicAPI } from '../models';
|
|
3
|
+
export type TreeViewItemPluginsRunner = <TProps extends {}>(props: TProps) => Required<TreeViewItemPluginResponse>;
|
|
4
|
+
export type TreeViewContextValue<TSignatures extends readonly TreeViewAnyPluginSignature[], TOptionalSignatures extends readonly TreeViewAnyPluginSignature[] = []> = MergeSignaturesProperty<TSignatures, 'contextValue'> & Partial<MergeSignaturesProperty<TOptionalSignatures, 'contextValue'>> & {
|
|
5
|
+
instance: TreeViewInstance<TSignatures, TOptionalSignatures>;
|
|
6
|
+
publicAPI: TreeViewPublicAPI<TSignatures, TOptionalSignatures>;
|
|
6
7
|
rootRef: React.RefObject<HTMLUListElement>;
|
|
7
|
-
wrapItem: TreeItemWrapper<
|
|
8
|
-
wrapRoot: TreeRootWrapper<
|
|
9
|
-
runItemPlugins:
|
|
8
|
+
wrapItem: TreeItemWrapper<TSignatures>;
|
|
9
|
+
wrapRoot: TreeRootWrapper<TSignatures>;
|
|
10
|
+
runItemPlugins: TreeViewItemPluginsRunner;
|
|
10
11
|
};
|
|
11
|
-
export interface TreeViewProviderProps<
|
|
12
|
-
value: TreeViewContextValue<
|
|
12
|
+
export interface TreeViewProviderProps<TSignatures extends readonly TreeViewAnyPluginSignature[]> {
|
|
13
|
+
value: TreeViewContextValue<TSignatures>;
|
|
13
14
|
children: React.ReactNode;
|
|
14
15
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { TreeViewProvider } from './TreeViewProvider';
|
|
2
|
-
export type { TreeViewProviderProps, TreeViewContextValue } from './TreeViewProvider.types';
|
|
2
|
+
export type { TreeViewProviderProps, TreeViewContextValue, TreeViewItemPluginsRunner, } from './TreeViewProvider.types';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { TreeViewAnyPluginSignature } from '../models';
|
|
2
2
|
import { TreeViewContextValue } from './TreeViewProvider.types';
|
|
3
|
-
export declare const useTreeViewContext: <
|
|
3
|
+
export declare const useTreeViewContext: <TSignatures extends readonly TreeViewAnyPluginSignature[], TOptionalSignatures extends readonly TreeViewAnyPluginSignature[] = []>() => NonNullable<TreeViewContextValue<TSignatures, TOptionalSignatures>>;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UseTreeViewIdParameters } from './useTreeViewId';
|
|
2
|
+
import { ConvertPluginsIntoSignatures } from '../models';
|
|
2
3
|
/**
|
|
3
4
|
* Internal plugins that create the tools used by the other plugins.
|
|
4
5
|
* These plugins are used by the tree view components.
|
|
5
6
|
*/
|
|
6
|
-
export declare const TREE_VIEW_CORE_PLUGINS: readonly [import("../models").TreeViewPlugin<import("./useTreeViewInstanceEvents").UseTreeViewInstanceEventsSignature>];
|
|
7
|
-
export type
|
|
7
|
+
export declare const TREE_VIEW_CORE_PLUGINS: readonly [import("../models").TreeViewPlugin<import("./useTreeViewInstanceEvents").UseTreeViewInstanceEventsSignature>, import("../models").TreeViewPlugin<import("./useTreeViewId").UseTreeViewIdSignature>];
|
|
8
|
+
export type TreeViewCorePluginSignatures = ConvertPluginsIntoSignatures<typeof TREE_VIEW_CORE_PLUGINS>;
|
|
9
|
+
export interface TreeViewCorePluginParameters extends UseTreeViewIdParameters {
|
|
10
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useTreeViewInstanceEvents } from './useTreeViewInstanceEvents';
|
|
2
|
+
import { useTreeViewId } from './useTreeViewId';
|
|
2
3
|
/**
|
|
3
4
|
* Internal plugins that create the tools used by the other plugins.
|
|
4
5
|
* These plugins are used by the tree view components.
|
|
5
6
|
*/
|
|
6
|
-
export const TREE_VIEW_CORE_PLUGINS = [useTreeViewInstanceEvents];
|
|
7
|
+
export const TREE_VIEW_CORE_PLUGINS = [useTreeViewInstanceEvents, useTreeViewId];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { TREE_VIEW_CORE_PLUGINS } from './corePlugins';
|
|
2
|
-
export type {
|
|
2
|
+
export type { TreeViewCorePluginSignatures, TreeViewCorePluginParameters } from './corePlugins';
|
|
@@ -19,12 +19,8 @@ export interface UseTreeViewIdParameters {
|
|
|
19
19
|
id?: string;
|
|
20
20
|
}
|
|
21
21
|
export type UseTreeViewIdDefaultizedParameters = UseTreeViewIdParameters;
|
|
22
|
-
export interface UseTreeViewIdState {
|
|
23
|
-
focusedItemId: string | null;
|
|
24
|
-
}
|
|
25
22
|
export type UseTreeViewIdSignature = TreeViewPluginSignature<{
|
|
26
23
|
params: UseTreeViewIdParameters;
|
|
27
24
|
defaultizedParams: UseTreeViewIdDefaultizedParameters;
|
|
28
25
|
instance: UseTreeViewIdInstance;
|
|
29
|
-
state: UseTreeViewIdState;
|
|
30
26
|
}>;
|
|
@@ -7,9 +7,9 @@ interface RegistryContainer {
|
|
|
7
7
|
}
|
|
8
8
|
export declare function createUseInstanceEventHandler(registryContainer: RegistryContainer): <Instance extends UseTreeViewInstanceEventsInstance & {
|
|
9
9
|
$$signature: TreeViewAnyPluginSignature;
|
|
10
|
-
}, E extends keyof Instance["$$signature"]["events"] | keyof import("../models").
|
|
10
|
+
}, E extends keyof Instance["$$signature"]["events"] | keyof import("../models").MergeSignaturesProperty<[import("../corePlugins/useTreeViewInstanceEvents/useTreeViewInstanceEvents.types").UseTreeViewInstanceEventsSignature, import("../corePlugins/useTreeViewId").UseTreeViewIdSignature, ...Instance["$$signature"]["dependencies"]], "events">>(instance: Instance, eventName: E, handler: TreeViewEventListener<TreeViewUsedEvents<Instance['$$signature']>[E]>) => void;
|
|
11
11
|
export declare const unstable_resetCleanupTracking: () => void;
|
|
12
12
|
export declare const useInstanceEventHandler: <Instance extends UseTreeViewInstanceEventsInstance & {
|
|
13
13
|
$$signature: TreeViewAnyPluginSignature;
|
|
14
|
-
}, E extends keyof Instance["$$signature"]["events"] | keyof import("../models").
|
|
14
|
+
}, E extends keyof Instance["$$signature"]["events"] | keyof import("../models").MergeSignaturesProperty<[import("../corePlugins/useTreeViewInstanceEvents/useTreeViewInstanceEvents.types").UseTreeViewInstanceEventsSignature, import("../corePlugins/useTreeViewId").UseTreeViewIdSignature, ...Instance["$$signature"]["dependencies"]], "events">>(instance: Instance, eventName: E, handler: TreeViewEventListener<TreeViewUsedEvents<Instance['$$signature']>[E]>) => void;
|
|
15
15
|
export {};
|
package/internals/index.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
export { useTreeView } from './useTreeView';
|
|
2
2
|
export { TreeViewProvider } from './TreeViewProvider';
|
|
3
3
|
export { unstable_resetCleanupTracking } from './hooks/useInstanceEventHandler';
|
|
4
|
-
export type { TreeViewPlugin, TreeViewPluginSignature, ConvertPluginsIntoSignatures,
|
|
5
|
-
export {
|
|
6
|
-
export type { DefaultTreeViewPlugins, DefaultTreeViewPluginSlots, DefaultTreeViewPluginSlotProps, } from './plugins/defaultPlugins';
|
|
7
|
-
export type { DefaultTreeViewPluginParameters } from './plugins/defaultPlugins';
|
|
4
|
+
export type { TreeViewPlugin, TreeViewPluginSignature, ConvertPluginsIntoSignatures, MergeSignaturesProperty, TreeViewPublicAPI, TreeViewExperimentalFeatures, } from './models';
|
|
5
|
+
export type { TreeViewCorePluginParameters } from './corePlugins';
|
|
8
6
|
export { useTreeViewExpansion } from './plugins/useTreeViewExpansion';
|
|
9
7
|
export type { UseTreeViewExpansionSignature, UseTreeViewExpansionParameters, } from './plugins/useTreeViewExpansion';
|
|
10
8
|
export { useTreeViewSelection } from './plugins/useTreeViewSelection';
|
|
@@ -13,8 +11,6 @@ export { useTreeViewFocus } from './plugins/useTreeViewFocus';
|
|
|
13
11
|
export type { UseTreeViewFocusSignature, UseTreeViewFocusParameters, } from './plugins/useTreeViewFocus';
|
|
14
12
|
export { useTreeViewKeyboardNavigation } from './plugins/useTreeViewKeyboardNavigation';
|
|
15
13
|
export type { UseTreeViewKeyboardNavigationSignature } from './plugins/useTreeViewKeyboardNavigation';
|
|
16
|
-
export { useTreeViewId } from './plugins/useTreeViewId';
|
|
17
|
-
export type { UseTreeViewIdSignature, UseTreeViewIdParameters } from './plugins/useTreeViewId';
|
|
18
14
|
export { useTreeViewIcons } from './plugins/useTreeViewIcons';
|
|
19
15
|
export type { UseTreeViewIconsSignature, UseTreeViewIconsParameters, } from './plugins/useTreeViewIcons';
|
|
20
16
|
export { useTreeViewItems } from './plugins/useTreeViewItems';
|
|
@@ -22,4 +18,3 @@ export type { UseTreeViewItemsSignature, UseTreeViewItemsParameters, } from './p
|
|
|
22
18
|
export { useTreeViewJSXItems } from './plugins/useTreeViewJSXItems';
|
|
23
19
|
export type { UseTreeViewJSXItemsSignature, UseTreeViewJSXItemsParameters, } from './plugins/useTreeViewJSXItems';
|
|
24
20
|
export { buildWarning } from './utils/warning';
|
|
25
|
-
export { extractPluginParamsFromProps } from './utils/extractPluginParamsFromProps';
|
package/internals/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export { useTreeView } from './useTreeView';
|
|
2
2
|
export { TreeViewProvider } from './TreeViewProvider';
|
|
3
3
|
export { unstable_resetCleanupTracking } from './hooks/useInstanceEventHandler';
|
|
4
|
+
|
|
5
|
+
// Core plugins
|
|
6
|
+
|
|
4
7
|
// Plugins
|
|
5
|
-
export { DEFAULT_TREE_VIEW_PLUGINS } from './plugins/defaultPlugins';
|
|
6
8
|
export { useTreeViewExpansion } from './plugins/useTreeViewExpansion';
|
|
7
9
|
export { useTreeViewSelection } from './plugins/useTreeViewSelection';
|
|
8
10
|
export { useTreeViewFocus } from './plugins/useTreeViewFocus';
|
|
9
11
|
export { useTreeViewKeyboardNavigation } from './plugins/useTreeViewKeyboardNavigation';
|
|
10
|
-
export { useTreeViewId } from './plugins/useTreeViewId';
|
|
11
12
|
export { useTreeViewIcons } from './plugins/useTreeViewIcons';
|
|
12
13
|
export { useTreeViewItems } from './plugins/useTreeViewItems';
|
|
13
14
|
export { useTreeViewJSXItems } from './plugins/useTreeViewJSXItems';
|
|
14
|
-
export { buildWarning } from './utils/warning';
|
|
15
|
-
export { extractPluginParamsFromProps } from './utils/extractPluginParamsFromProps';
|
|
15
|
+
export { buildWarning } from './utils/warning';
|
|
@@ -3,20 +3,7 @@ export type DefaultizedProps<P extends {}, RequiredProps extends keyof P, Additi
|
|
|
3
3
|
export type SlotComponentPropsFromProps<TProps extends {}, TOverrides extends {}, TOwnerState extends {}> = (Partial<TProps> & TOverrides) | ((ownerState: TOwnerState) => Partial<TProps> & TOverrides);
|
|
4
4
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
5
5
|
export type OptionalIfEmpty<A extends string, B> = keyof B extends never ? Partial<Record<A, B>> : IsAny<B> extends true ? Partial<Record<A, B>> : Record<A, B>;
|
|
6
|
-
export type
|
|
7
|
-
export type ConvertPluginsIntoSignatures<TPlugins extends readonly
|
|
8
|
-
export
|
|
9
|
-
state: MergePluginsProperty<TPlugins, 'state'>;
|
|
10
|
-
instance: MergePluginsProperty<TPlugins, 'instance'>;
|
|
11
|
-
publicAPI: MergePluginsProperty<TPlugins, 'publicAPI'>;
|
|
12
|
-
params: MergePluginsProperty<TPlugins, 'params'>;
|
|
13
|
-
defaultizedParams: MergePluginsProperty<TPlugins, 'defaultizedParams'>;
|
|
14
|
-
dependantPlugins: MergePluginsProperty<TPlugins, 'dependantPlugins'>;
|
|
15
|
-
contextValue: MergePluginsProperty<TPlugins, 'contextValue'>;
|
|
16
|
-
slots: MergePluginsProperty<TPlugins, 'slots'>;
|
|
17
|
-
slotProps: MergePluginsProperty<TPlugins, 'slotProps'>;
|
|
18
|
-
events: MergePluginsProperty<TPlugins, 'events'>;
|
|
19
|
-
models: MergePluginsProperty<TPlugins, 'models'>;
|
|
20
|
-
experimentalFeatures: MergePluginsProperty<TPlugins, 'experimentalFeatures'>;
|
|
21
|
-
}
|
|
6
|
+
export type MergeSignaturesProperty<TSignatures extends readonly any[], TProperty extends keyof TreeViewAnyPluginSignature> = TSignatures extends readonly [plugin: infer P, ...otherPlugin: infer R] ? P extends TreeViewAnyPluginSignature ? P[TProperty] & MergeSignaturesProperty<R, TProperty> : {} : {};
|
|
7
|
+
export type ConvertPluginsIntoSignatures<TPlugins extends readonly TreeViewPlugin<TreeViewAnyPluginSignature>[]> = TPlugins extends readonly [plugin: infer TPlugin, ...otherPlugin: infer R] ? R extends readonly TreeViewPlugin<any>[] ? TPlugin extends TreeViewPlugin<infer TSignature> ? readonly [TSignature, ...ConvertPluginsIntoSignatures<R>] : never : never : [];
|
|
8
|
+
export type ConvertSignaturesIntoPlugins<TSignatures extends readonly TreeViewAnyPluginSignature[]> = TSignatures extends readonly [signature: infer TSignature, ...otherSignatures: infer R] ? R extends readonly TreeViewAnyPluginSignature[] ? TSignature extends TreeViewAnyPluginSignature ? readonly [TreeViewPlugin<TSignature>, ...ConvertSignaturesIntoPlugins<R>] : never : never : [];
|
|
22
9
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { EventHandlers } from '@mui/base/utils';
|
|
3
3
|
import { TreeViewExperimentalFeatures, TreeViewInstance, TreeViewModel } from './treeView';
|
|
4
|
-
import type {
|
|
4
|
+
import type { MergeSignaturesProperty, OptionalIfEmpty } from './helpers';
|
|
5
5
|
import { TreeViewEventLookupElement } from './events';
|
|
6
|
-
import type {
|
|
6
|
+
import type { TreeViewCorePluginSignatures } from '../corePlugins';
|
|
7
7
|
import { TreeViewItemId } from '../../models';
|
|
8
8
|
export interface TreeViewPluginOptions<TSignature extends TreeViewAnyPluginSignature> {
|
|
9
9
|
instance: TreeViewUsedInstance<TSignature>;
|
|
@@ -42,7 +42,8 @@ export type TreeViewPluginSignature<T extends {
|
|
|
42
42
|
};
|
|
43
43
|
modelNames?: keyof T['defaultizedParams'];
|
|
44
44
|
experimentalFeatures?: string;
|
|
45
|
-
|
|
45
|
+
dependencies?: readonly TreeViewAnyPluginSignature[];
|
|
46
|
+
optionalDependencies?: readonly TreeViewAnyPluginSignature[];
|
|
46
47
|
}> = {
|
|
47
48
|
params: T extends {
|
|
48
49
|
params: {};
|
|
@@ -78,16 +79,20 @@ export type TreeViewPluginSignature<T extends {
|
|
|
78
79
|
[TControlled in T['modelNames']]-?: TreeViewModel<Exclude<T['defaultizedParams'][TControlled], undefined>>;
|
|
79
80
|
} : {};
|
|
80
81
|
experimentalFeatures: T['experimentalFeatures'];
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
} ? T['
|
|
82
|
+
dependencies: T extends {
|
|
83
|
+
dependencies: Array<any>;
|
|
84
|
+
} ? T['dependencies'] : [];
|
|
85
|
+
optionalDependencies: T extends {
|
|
86
|
+
optionalDependencies: Array<any>;
|
|
87
|
+
} ? T['optionalDependencies'] : [];
|
|
84
88
|
};
|
|
85
89
|
export type TreeViewAnyPluginSignature = {
|
|
86
90
|
state: any;
|
|
87
91
|
instance: any;
|
|
88
92
|
params: any;
|
|
89
93
|
defaultizedParams: any;
|
|
90
|
-
|
|
94
|
+
dependencies: any;
|
|
95
|
+
optionalDependencies: any;
|
|
91
96
|
events: any;
|
|
92
97
|
contextValue: any;
|
|
93
98
|
slots: any;
|
|
@@ -96,25 +101,26 @@ export type TreeViewAnyPluginSignature = {
|
|
|
96
101
|
experimentalFeatures: any;
|
|
97
102
|
publicAPI: any;
|
|
98
103
|
};
|
|
99
|
-
type
|
|
100
|
-
|
|
101
|
-
...TSignature['
|
|
104
|
+
type TreeViewRequiredPlugins<TSignature extends TreeViewAnyPluginSignature> = [
|
|
105
|
+
...TreeViewCorePluginSignatures,
|
|
106
|
+
...TSignature['dependencies']
|
|
102
107
|
];
|
|
103
|
-
|
|
104
|
-
type
|
|
105
|
-
|
|
108
|
+
type PluginPropertyWithDependencies<TSignature extends TreeViewAnyPluginSignature, TProperty extends keyof TreeViewAnyPluginSignature> = TSignature[TProperty] & MergeSignaturesProperty<TreeViewRequiredPlugins<TSignature>, TProperty> & Partial<MergeSignaturesProperty<TSignature['optionalDependencies'], TProperty>>;
|
|
109
|
+
export type TreeViewUsedParams<TSignature extends TreeViewAnyPluginSignature> = PluginPropertyWithDependencies<TSignature, 'params'>;
|
|
110
|
+
type TreeViewUsedDefaultizedParams<TSignature extends TreeViewAnyPluginSignature> = PluginPropertyWithDependencies<TSignature, 'defaultizedParams'>;
|
|
111
|
+
export type TreeViewUsedInstance<TSignature extends TreeViewAnyPluginSignature> = PluginPropertyWithDependencies<TSignature, 'instance'> & {
|
|
106
112
|
/**
|
|
107
113
|
* Private property only defined in TypeScript to be able to access the plugin signature from the instance object.
|
|
108
114
|
*/
|
|
109
115
|
$$signature: TSignature;
|
|
110
116
|
};
|
|
111
|
-
type TreeViewUsedState<TSignature extends TreeViewAnyPluginSignature> =
|
|
112
|
-
type TreeViewUsedExperimentalFeatures<TSignature extends TreeViewAnyPluginSignature> = TreeViewExperimentalFeatures<[TSignature, ...TSignature['
|
|
117
|
+
type TreeViewUsedState<TSignature extends TreeViewAnyPluginSignature> = PluginPropertyWithDependencies<TSignature, 'state'>;
|
|
118
|
+
type TreeViewUsedExperimentalFeatures<TSignature extends TreeViewAnyPluginSignature> = TreeViewExperimentalFeatures<[TSignature, ...TSignature['dependencies']]>;
|
|
113
119
|
type RemoveSetValue<Models extends Record<string, TreeViewModel<any>>> = {
|
|
114
120
|
[K in keyof Models]: Omit<Models[K], 'setValue'>;
|
|
115
121
|
};
|
|
116
|
-
export type TreeViewUsedModels<TSignature extends TreeViewAnyPluginSignature> = TSignature['models'] & RemoveSetValue<
|
|
117
|
-
export type TreeViewUsedEvents<TSignature extends TreeViewAnyPluginSignature> = TSignature['events'] &
|
|
122
|
+
export type TreeViewUsedModels<TSignature extends TreeViewAnyPluginSignature> = TSignature['models'] & RemoveSetValue<MergeSignaturesProperty<TreeViewRequiredPlugins<TSignature>, 'models'>>;
|
|
123
|
+
export type TreeViewUsedEvents<TSignature extends TreeViewAnyPluginSignature> = TSignature['events'] & MergeSignaturesProperty<TreeViewRequiredPlugins<TSignature>, 'events'>;
|
|
118
124
|
export interface TreeViewItemPluginOptions<TProps extends {}> extends TreeViewItemPluginResponse {
|
|
119
125
|
props: TProps;
|
|
120
126
|
}
|
|
@@ -150,12 +156,12 @@ export type TreeViewPlugin<TSignature extends TreeViewAnyPluginSignature> = {
|
|
|
150
156
|
* @param {{ nodeId: TreeViewItemId; children: React.ReactNode; }} params The params of the item.
|
|
151
157
|
* @returns {React.ReactNode} The wrapped item.
|
|
152
158
|
*/
|
|
153
|
-
wrapItem?: TreeItemWrapper<[TSignature, ...TSignature['
|
|
159
|
+
wrapItem?: TreeItemWrapper<[TSignature, ...TSignature['dependencies']]>;
|
|
154
160
|
/**
|
|
155
161
|
* Render function used to add React wrappers around the TreeView.
|
|
156
162
|
* @param {{ children: React.ReactNode; }} params The params of the root.
|
|
157
163
|
* @returns {React.ReactNode} The wrapped root.
|
|
158
164
|
*/
|
|
159
|
-
wrapRoot?: TreeRootWrapper<[TSignature, ...TSignature['
|
|
165
|
+
wrapRoot?: TreeRootWrapper<[TSignature, ...TSignature['dependencies']]>;
|
|
160
166
|
};
|
|
161
167
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { TreeViewAnyPluginSignature } from './plugin';
|
|
2
|
-
import type {
|
|
2
|
+
import type { MergeSignaturesProperty } from './helpers';
|
|
3
|
+
import type { TreeViewCorePluginSignatures } from '../corePlugins';
|
|
3
4
|
export interface TreeViewItemMeta {
|
|
4
5
|
id: string;
|
|
5
6
|
idAttribute: string | undefined;
|
|
@@ -20,8 +21,8 @@ export interface TreeViewModel<TValue> {
|
|
|
20
21
|
value: TValue;
|
|
21
22
|
setControlledValue: (value: TValue | ((prevValue: TValue) => TValue)) => void;
|
|
22
23
|
}
|
|
23
|
-
export type TreeViewInstance<TSignatures extends readonly TreeViewAnyPluginSignature[]> =
|
|
24
|
-
export type TreeViewPublicAPI<TSignatures extends readonly TreeViewAnyPluginSignature[]> =
|
|
24
|
+
export type TreeViewInstance<TSignatures extends readonly TreeViewAnyPluginSignature[], TOptionalSignatures extends readonly TreeViewAnyPluginSignature[] = []> = MergeSignaturesProperty<[...TreeViewCorePluginSignatures, ...TSignatures], 'instance'> & Partial<MergeSignaturesProperty<TOptionalSignatures, 'instance'>>;
|
|
25
|
+
export type TreeViewPublicAPI<TSignatures extends readonly TreeViewAnyPluginSignature[], TOptionalSignatures extends readonly TreeViewAnyPluginSignature[] = []> = MergeSignaturesProperty<[...TreeViewCorePluginSignatures, ...TSignatures], 'publicAPI'> & Partial<MergeSignaturesProperty<TOptionalSignatures, 'instance'>>;
|
|
25
26
|
export type TreeViewExperimentalFeatures<TSignatures extends readonly TreeViewAnyPluginSignature[]> = {
|
|
26
|
-
[key in
|
|
27
|
+
[key in MergeSignaturesProperty<TSignatures, 'experimentalFeatures'>]?: boolean;
|
|
27
28
|
};
|
|
@@ -73,5 +73,5 @@ export type UseTreeViewExpansionSignature = TreeViewPluginSignature<{
|
|
|
73
73
|
instance: UseTreeViewExpansionInstance;
|
|
74
74
|
publicAPI: UseTreeViewExpansionPublicAPI;
|
|
75
75
|
modelNames: 'expandedItems';
|
|
76
|
-
|
|
76
|
+
dependencies: [UseTreeViewItemsSignature];
|
|
77
77
|
}>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { TreeViewPluginSignature } from '../../models';
|
|
3
|
-
import { UseTreeViewIdSignature } from '../useTreeViewId/useTreeViewId.types';
|
|
4
3
|
import type { UseTreeViewItemsSignature } from '../useTreeViewItems';
|
|
5
4
|
import type { UseTreeViewSelectionSignature } from '../useTreeViewSelection';
|
|
6
5
|
import { UseTreeViewExpansionSignature } from '../useTreeViewExpansion';
|
|
@@ -55,8 +54,7 @@ export type UseTreeViewFocusSignature = TreeViewPluginSignature<{
|
|
|
55
54
|
instance: UseTreeViewFocusInstance;
|
|
56
55
|
publicAPI: UseTreeViewFocusPublicAPI;
|
|
57
56
|
state: UseTreeViewFocusState;
|
|
58
|
-
|
|
59
|
-
UseTreeViewIdSignature,
|
|
57
|
+
dependencies: [
|
|
60
58
|
UseTreeViewItemsSignature,
|
|
61
59
|
UseTreeViewSelectionSignature,
|
|
62
60
|
UseTreeViewExpansionSignature
|
|
@@ -38,6 +38,6 @@ export type UseTreeViewIconsSignature = TreeViewPluginSignature<{
|
|
|
38
38
|
contextValue: UseTreeViewIconsContextValue;
|
|
39
39
|
slots: UseTreeViewIconsSlots;
|
|
40
40
|
slotProps: UseTreeViewIconsSlotProps;
|
|
41
|
-
|
|
41
|
+
dependencies: [UseTreeViewItemsSignature, UseTreeViewSelectionSignature];
|
|
42
42
|
}>;
|
|
43
43
|
export {};
|
|
@@ -33,5 +33,5 @@ export type UseTreeViewJSXItemsSignature = TreeViewPluginSignature<{
|
|
|
33
33
|
params: UseTreeViewJSXItemsParameters;
|
|
34
34
|
defaultizedParams: UseTreeViewItemsDefaultizedParameters;
|
|
35
35
|
instance: UseTreeViewItemsInstance;
|
|
36
|
-
|
|
36
|
+
dependencies: [UseTreeViewItemsSignature, UseTreeViewKeyboardNavigationSignature];
|
|
37
37
|
}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
3
3
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
4
4
|
import { getFirstNavigableItem, getLastNavigableItem, getNextNavigableItem, getPreviousNavigableItem } from '../../utils/tree';
|
|
5
5
|
function isPrintableCharacter(string) {
|
|
@@ -10,8 +10,7 @@ export const useTreeViewKeyboardNavigation = ({
|
|
|
10
10
|
params,
|
|
11
11
|
state
|
|
12
12
|
}) => {
|
|
13
|
-
const
|
|
14
|
-
const isRTL = theme.direction === 'rtl';
|
|
13
|
+
const isRtl = useRtl();
|
|
15
14
|
const firstCharMap = React.useRef({});
|
|
16
15
|
const updateFirstCharMap = useEventCallback(callback => {
|
|
17
16
|
firstCharMap.current = callback(firstCharMap.current);
|
|
@@ -138,7 +137,7 @@ export const useTreeViewKeyboardNavigation = ({
|
|
|
138
137
|
|
|
139
138
|
// If the focused item is expanded, we move the focus to its first child
|
|
140
139
|
// If the focused item is collapsed and has children, we expand it
|
|
141
|
-
case key === 'ArrowRight' && !
|
|
140
|
+
case key === 'ArrowRight' && !isRtl || key === 'ArrowLeft' && isRtl:
|
|
142
141
|
{
|
|
143
142
|
if (instance.isItemExpanded(itemId)) {
|
|
144
143
|
const nextItemId = getNextNavigableItem(instance, itemId);
|
|
@@ -155,7 +154,7 @@ export const useTreeViewKeyboardNavigation = ({
|
|
|
155
154
|
|
|
156
155
|
// If the focused item is expanded, we collapse it
|
|
157
156
|
// If the focused item is collapsed and has a parent, we move the focus to this parent
|
|
158
|
-
case key === 'ArrowLeft' && !
|
|
157
|
+
case key === 'ArrowLeft' && !isRtl || key === 'ArrowRight' && isRtl:
|
|
159
158
|
{
|
|
160
159
|
if (canToggleItemExpansion(itemId) && instance.isItemExpanded(itemId)) {
|
|
161
160
|
instance.toggleItemExpansion(event, itemId);
|
package/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.types.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export interface UseTreeViewKeyboardNavigationInstance {
|
|
|
24
24
|
}
|
|
25
25
|
export type UseTreeViewKeyboardNavigationSignature = TreeViewPluginSignature<{
|
|
26
26
|
instance: UseTreeViewKeyboardNavigationInstance;
|
|
27
|
-
|
|
27
|
+
dependencies: [
|
|
28
28
|
UseTreeViewItemsSignature,
|
|
29
29
|
UseTreeViewSelectionSignature,
|
|
30
30
|
UseTreeViewFocusSignature,
|
|
@@ -101,7 +101,7 @@ export type UseTreeViewSelectionSignature = TreeViewPluginSignature<{
|
|
|
101
101
|
instance: UseTreeViewSelectionInstance;
|
|
102
102
|
contextValue: UseTreeViewSelectionContextValue;
|
|
103
103
|
modelNames: 'selectedItems';
|
|
104
|
-
|
|
104
|
+
dependencies: [
|
|
105
105
|
UseTreeViewItemsSignature,
|
|
106
106
|
UseTreeViewExpansionSignature,
|
|
107
107
|
UseTreeViewItemsSignature
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ConvertSignaturesIntoPlugins, MergeSignaturesProperty, TreeViewAnyPluginSignature, TreeViewPluginSignature } from '../models';
|
|
2
|
+
import { UseTreeViewBaseProps } from './useTreeView.types';
|
|
3
|
+
import { TreeViewCorePluginSignatures } from '../corePlugins';
|
|
4
|
+
interface ExtractPluginParamsFromPropsParameters<TSignatures extends readonly TreeViewAnyPluginSignature[], TProps extends Partial<UseTreeViewBaseProps<TSignatures>>> {
|
|
5
|
+
plugins: ConvertSignaturesIntoPlugins<readonly [...TreeViewCorePluginSignatures, ...TSignatures]>;
|
|
6
|
+
props: TProps;
|
|
7
|
+
}
|
|
8
|
+
interface ExtractPluginParamsFromPropsReturnValue<TSignatures extends readonly TreeViewAnyPluginSignature[], TProps extends Partial<UseTreeViewBaseProps<TSignatures>>> extends UseTreeViewBaseProps<TSignatures> {
|
|
9
|
+
pluginParams: MergeSignaturesProperty<TSignatures, 'defaultizedParams'>;
|
|
10
|
+
forwardedProps: Omit<TProps, keyof MergeSignaturesProperty<TSignatures, 'params'>>;
|
|
11
|
+
}
|
|
12
|
+
export declare const extractPluginParamsFromProps: <TSignatures extends readonly TreeViewPluginSignature<any>[], TProps extends Partial<UseTreeViewBaseProps<TSignatures>>>({ props: { slots, slotProps, apiRef, experimentalFeatures, ...props }, plugins, }: ExtractPluginParamsFromPropsParameters<TSignatures, TProps>) => ExtractPluginParamsFromPropsReturnValue<TSignatures, TProps>;
|
|
13
|
+
export {};
|
|
@@ -8,35 +8,35 @@ export const extractPluginParamsFromProps = _ref => {
|
|
|
8
8
|
apiRef,
|
|
9
9
|
experimentalFeatures
|
|
10
10
|
},
|
|
11
|
-
plugins
|
|
12
|
-
rootRef
|
|
11
|
+
plugins
|
|
13
12
|
} = _ref,
|
|
14
13
|
props = _objectWithoutPropertiesLoose(_ref.props, _excluded);
|
|
15
14
|
const paramsLookup = {};
|
|
16
15
|
plugins.forEach(plugin => {
|
|
17
16
|
Object.assign(paramsLookup, plugin.params);
|
|
18
17
|
});
|
|
19
|
-
const pluginParams = {
|
|
20
|
-
|
|
21
|
-
rootRef,
|
|
22
|
-
slots: slots ?? {},
|
|
23
|
-
slotProps: slotProps ?? {},
|
|
24
|
-
experimentalFeatures: experimentalFeatures ?? {},
|
|
25
|
-
apiRef
|
|
26
|
-
};
|
|
27
|
-
const otherProps = {};
|
|
18
|
+
const pluginParams = {};
|
|
19
|
+
const forwardedProps = {};
|
|
28
20
|
Object.keys(props).forEach(propName => {
|
|
29
21
|
const prop = props[propName];
|
|
30
22
|
if (paramsLookup[propName]) {
|
|
31
23
|
pluginParams[propName] = prop;
|
|
32
24
|
} else {
|
|
33
|
-
|
|
25
|
+
forwardedProps[propName] = prop;
|
|
34
26
|
}
|
|
35
27
|
});
|
|
28
|
+
const defaultizedPluginParams = plugins.reduce((acc, plugin) => {
|
|
29
|
+
if (plugin.getDefaultizedParams) {
|
|
30
|
+
return plugin.getDefaultizedParams(acc);
|
|
31
|
+
}
|
|
32
|
+
return acc;
|
|
33
|
+
}, pluginParams);
|
|
36
34
|
return {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
apiRef,
|
|
36
|
+
forwardedProps,
|
|
37
|
+
pluginParams: defaultizedPluginParams,
|
|
38
|
+
slots: slots ?? {},
|
|
39
|
+
slotProps: slotProps ?? {},
|
|
40
|
+
experimentalFeatures: experimentalFeatures ?? {}
|
|
41
41
|
};
|
|
42
42
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { TreeViewAnyPluginSignature
|
|
3
|
-
import { UseTreeViewParameters, UseTreeViewReturnValue } from './useTreeView.types';
|
|
4
|
-
export declare function useTreeViewApiInitialization<T>(inputApiRef: React.MutableRefObject<T> | undefined): T;
|
|
5
|
-
export declare const useTreeView: <
|
|
2
|
+
import { TreeViewAnyPluginSignature } from '../models';
|
|
3
|
+
import { UseTreeViewBaseProps, UseTreeViewParameters, UseTreeViewReturnValue } from './useTreeView.types';
|
|
4
|
+
export declare function useTreeViewApiInitialization<T>(inputApiRef: React.MutableRefObject<T | undefined> | undefined): T;
|
|
5
|
+
export declare const useTreeView: <TSignatures extends readonly TreeViewAnyPluginSignature[], TProps extends Partial<UseTreeViewBaseProps<TSignatures>>>({ plugins: inPlugins, rootRef, props, }: UseTreeViewParameters<TSignatures, TProps>) => UseTreeViewReturnValue<TSignatures>;
|