@mui/x-tree-view 8.0.0-alpha.1 → 8.0.0-alpha.11
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 +2007 -230
- package/README.md +1 -1
- package/RichTreeView/RichTreeView.js +4 -8
- package/RichTreeView/RichTreeView.types.d.ts +3 -3
- package/SimpleTreeView/SimpleTreeView.types.d.ts +3 -3
- package/TreeItem/TreeItem.d.ts +1 -1
- package/TreeItem/TreeItem.types.d.ts +1 -1
- package/TreeItemDragAndDropOverlay/TreeItemDragAndDropOverlay.js +1 -1
- package/TreeItemIcon/TreeItemIcon.types.d.ts +1 -1
- package/TreeItemProvider/TreeItemProvider.d.ts +2 -4
- package/TreeItemProvider/TreeItemProvider.js +13 -11
- package/hooks/useTreeItemUtils/useTreeItemUtils.d.ts +4 -4
- package/hooks/useTreeViewApiRef.d.ts +2 -1
- package/index.js +1 -1
- package/internals/TreeViewProvider/TreeViewProvider.types.d.ts +1 -1
- package/internals/components/RichTreeViewItems.d.ts +1 -1
- package/internals/hooks/useInstanceEventHandler.js +1 -1
- package/internals/models/itemPlugin.d.ts +3 -3
- package/internals/models/plugin.d.ts +3 -3
- package/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.js +23 -24
- package/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.selectors.d.ts +66 -10
- package/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.selectors.js +8 -1
- package/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.types.d.ts +1 -5
- package/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.utils.d.ts +3 -0
- package/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.utils.js +12 -0
- package/internals/plugins/useTreeViewIcons/useTreeViewIcons.types.d.ts +1 -1
- package/internals/plugins/useTreeViewItems/useTreeViewItems.selectors.d.ts +252 -84
- package/internals/plugins/useTreeViewItems/useTreeViewItems.types.d.ts +26 -8
- package/internals/plugins/useTreeViewLabel/useTreeViewLabel.js +4 -14
- package/internals/plugins/useTreeViewLabel/useTreeViewLabel.types.d.ts +3 -6
- package/internals/plugins/useTreeViewSelection/useTreeViewSelection.itemPlugin.js +13 -16
- package/internals/useTreeView/useTreeView.d.ts +1 -1
- package/internals/useTreeView/useTreeView.types.d.ts +2 -2
- package/internals/useTreeView/useTreeViewBuildContext.d.ts +1 -1
- package/modern/RichTreeView/RichTreeView.js +4 -8
- package/modern/TreeItemDragAndDropOverlay/TreeItemDragAndDropOverlay.js +1 -1
- package/modern/TreeItemProvider/TreeItemProvider.js +13 -11
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useInstanceEventHandler.js +1 -1
- package/modern/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.js +23 -24
- package/modern/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.selectors.js +8 -1
- package/modern/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.utils.js +12 -0
- package/modern/internals/plugins/useTreeViewLabel/useTreeViewLabel.js +4 -14
- package/modern/internals/plugins/useTreeViewSelection/useTreeViewSelection.itemPlugin.js +13 -16
- package/modern/useTreeItem/useTreeItem.js +3 -5
- package/node/RichTreeView/RichTreeView.js +4 -8
- package/node/TreeItemDragAndDropOverlay/TreeItemDragAndDropOverlay.js +2 -2
- package/node/TreeItemProvider/TreeItemProvider.js +13 -10
- package/node/index.js +1 -1
- package/node/internals/hooks/useInstanceEventHandler.js +1 -1
- package/node/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.js +22 -24
- package/node/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.selectors.js +9 -2
- package/node/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.utils.js +15 -2
- package/node/internals/plugins/useTreeViewLabel/useTreeViewLabel.js +4 -14
- package/node/internals/plugins/useTreeViewSelection/useTreeViewSelection.itemPlugin.js +13 -16
- package/node/useTreeItem/useTreeItem.js +3 -5
- package/package.json +5 -5
- package/useTreeItem/useTreeItem.js +3 -5
- package/useTreeItem/useTreeItem.types.d.ts +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# MUI X Tree View
|
|
2
2
|
|
|
3
3
|
This package is the Community plan edition of the Tree View components.
|
|
4
|
-
It's part of [MUI X](https://mui.com/x/), an open-core extension of
|
|
4
|
+
It's part of [MUI X](https://mui.com/x/), an open-core extension of our Core libraries, with advanced components.
|
|
5
5
|
|
|
6
6
|
## Installation
|
|
7
7
|
|
|
@@ -152,9 +152,7 @@ process.env.NODE_ENV !== "production" ? RichTreeView.propTypes = {
|
|
|
152
152
|
* For each feature, if the flag is not explicitly set to `true`,
|
|
153
153
|
* the feature will be fully disabled and any property / method call will not have any effect.
|
|
154
154
|
*/
|
|
155
|
-
experimentalFeatures: PropTypes.
|
|
156
|
-
labelEditing: PropTypes.bool
|
|
157
|
-
}),
|
|
155
|
+
experimentalFeatures: PropTypes.object,
|
|
158
156
|
/**
|
|
159
157
|
* Used to determine the id of a given item.
|
|
160
158
|
*
|
|
@@ -186,13 +184,11 @@ process.env.NODE_ENV !== "production" ? RichTreeView.propTypes = {
|
|
|
186
184
|
*/
|
|
187
185
|
isItemDisabled: PropTypes.func,
|
|
188
186
|
/**
|
|
189
|
-
*
|
|
190
|
-
* Make sure to also enable the `labelEditing` experimental feature:
|
|
191
|
-
* `<RichTreeViewPro experimentalFeatures={{ labelEditing: true }} />`.
|
|
192
|
-
* By default, the items are not editable.
|
|
187
|
+
* Determine if a given item can be edited.
|
|
193
188
|
* @template R
|
|
194
189
|
* @param {R} item The item to check.
|
|
195
|
-
* @returns {boolean} `true` if the item
|
|
190
|
+
* @returns {boolean} `true` if the item can be edited.
|
|
191
|
+
* @default () => false
|
|
196
192
|
*/
|
|
197
193
|
isItemEditable: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
|
198
194
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Theme } from '@mui/material/styles';
|
|
3
|
-
import { SxProps } from '@mui/system';
|
|
4
|
-
import { SlotComponentProps } from '@mui/utils';
|
|
3
|
+
import { SxProps } from '@mui/system/styleFunctionSx';
|
|
4
|
+
import { SlotComponentProps } from '@mui/utils/types';
|
|
5
5
|
import { RichTreeViewClasses } from './richTreeViewClasses';
|
|
6
6
|
import { RichTreeViewPluginParameters, RichTreeViewPluginSlotProps, RichTreeViewPluginSlots, RichTreeViewPluginSignatures } from './RichTreeView.plugins';
|
|
7
7
|
import { TreeViewExperimentalFeatures, TreeViewPublicAPI } from '../internals/models';
|
|
@@ -16,7 +16,7 @@ export interface RichTreeViewSlots extends RichTreeViewPluginSlots, RichTreeView
|
|
|
16
16
|
export interface RichTreeViewSlotProps<R extends {}, Multiple extends boolean | undefined> extends RichTreeViewPluginSlotProps, RichTreeViewItemsSlotProps {
|
|
17
17
|
root?: SlotComponentProps<'ul', {}, RichTreeViewProps<R, Multiple>>;
|
|
18
18
|
}
|
|
19
|
-
export type RichTreeViewApiRef = React.
|
|
19
|
+
export type RichTreeViewApiRef = React.RefObject<TreeViewPublicAPI<RichTreeViewPluginSignatures> | undefined>;
|
|
20
20
|
export interface RichTreeViewPropsBase extends React.HTMLAttributes<HTMLUListElement> {
|
|
21
21
|
className?: string;
|
|
22
22
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Theme } from '@mui/material/styles';
|
|
3
|
-
import { SlotComponentProps } from '@mui/utils';
|
|
4
|
-
import { SxProps } from '@mui/system';
|
|
3
|
+
import { SlotComponentProps } from '@mui/utils/types';
|
|
4
|
+
import { SxProps } from '@mui/system/styleFunctionSx';
|
|
5
5
|
import { SimpleTreeViewClasses } from './simpleTreeViewClasses';
|
|
6
6
|
import { SimpleTreeViewPluginParameters, SimpleTreeViewPluginSlotProps, SimpleTreeViewPluginSlots, SimpleTreeViewPluginSignatures } from './SimpleTreeView.plugins';
|
|
7
7
|
import { TreeViewExperimentalFeatures, TreeViewPublicAPI } from '../internals/models';
|
|
@@ -15,7 +15,7 @@ export interface SimpleTreeViewSlots extends SimpleTreeViewPluginSlots {
|
|
|
15
15
|
export interface SimpleTreeViewSlotProps extends SimpleTreeViewPluginSlotProps {
|
|
16
16
|
root?: SlotComponentProps<'ul', {}, {}>;
|
|
17
17
|
}
|
|
18
|
-
export type SimpleTreeViewApiRef = React.
|
|
18
|
+
export type SimpleTreeViewApiRef = React.RefObject<TreeViewPublicAPI<SimpleTreeViewPluginSignatures> | undefined>;
|
|
19
19
|
export interface SimpleTreeViewProps<Multiple extends boolean | undefined> extends SimpleTreeViewPluginParameters<Multiple>, React.HTMLAttributes<HTMLUListElement> {
|
|
20
20
|
/**
|
|
21
21
|
* The content of the component.
|
package/TreeItem/TreeItem.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare const TreeItemIconContainer: import("@emotion/styled").StyledComp
|
|
|
13
13
|
export declare const TreeItemGroupTransition: import("@emotion/styled").StyledComponent<Pick<import("@mui/material").CollapseProps, keyof import("@mui/material").CollapseProps> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
14
14
|
export declare const TreeItemCheckbox: import("@emotion/styled").StyledComponent<Pick<Omit<CheckboxProps & {
|
|
15
15
|
visible?: boolean;
|
|
16
|
-
}, "ref"> & React.RefAttributes<HTMLButtonElement>, "hidden" | "visible" | "color" | "content" | "size" | "style" | "icon" | "translate" | "disabled" | "form" | "slot" | "title" | "suppressHydrationWarning" | "className" | "id" | "lang" | "
|
|
16
|
+
}, "ref"> & React.RefAttributes<HTMLButtonElement>, "hidden" | "visible" | "color" | "content" | "size" | "style" | "icon" | "translate" | "disabled" | "form" | "slot" | "title" | "action" | "checked" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "readOnly" | "required" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture" | "component" | "sx" | "classes" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge" | "checkedIcon" | "inputProps" | "inputRef" | "indeterminate" | "indeterminateIcon" | keyof React.RefAttributes<HTMLButtonElement>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
17
17
|
type TreeItemComponent = ((props: TreeItemProps & React.RefAttributes<HTMLLIElement>) => React.JSX.Element) & {
|
|
18
18
|
propTypes?: any;
|
|
19
19
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
3
3
|
import { TransitionProps } from '@mui/material/transitions';
|
|
4
|
-
import { SlotComponentProps } from '@mui/utils';
|
|
4
|
+
import { SlotComponentProps } from '@mui/utils/types';
|
|
5
5
|
import { UseTreeItemParameters, UseTreeItemStatus } from '../useTreeItem';
|
|
6
6
|
import { TreeItemClasses } from './treeItemClasses';
|
|
7
7
|
import { TreeItemIconSlotProps, TreeItemIconSlots } from '../TreeItemIcon';
|
|
@@ -4,7 +4,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { alpha } from '@mui/material/styles';
|
|
7
|
-
import { shouldForwardProp } from '@mui/system';
|
|
7
|
+
import { shouldForwardProp } from '@mui/system/createStyled';
|
|
8
8
|
import { styled } from "../internals/zero-styled/index.js";
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
const TreeItemDragAndDropOverlayRoot = styled('div', {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import { TreeItemProviderProps } from './TreeItemProvider.types';
|
|
2
|
-
|
|
3
|
-
* @ignore - internal component.
|
|
4
|
-
*/
|
|
5
|
-
declare function TreeItemProvider(props: TreeItemProviderProps): import("react").ReactNode;
|
|
3
|
+
declare function TreeItemProvider(props: TreeItemProviderProps): React.JSX.Element;
|
|
6
4
|
declare namespace TreeItemProvider {
|
|
7
5
|
var propTypes: any;
|
|
8
6
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
1
4
|
import PropTypes from 'prop-types';
|
|
2
5
|
import { useTreeViewContext } from "../internals/TreeViewProvider/index.js";
|
|
3
6
|
import { generateTreeItemIdAttribute } from "../internals/corePlugins/useTreeViewId/useTreeViewId.utils.js";
|
|
4
7
|
import { useSelector } from "../internals/hooks/useSelector.js";
|
|
5
8
|
import { selectorTreeViewId } from "../internals/corePlugins/useTreeViewId/useTreeViewId.selectors.js";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @ignore - internal component.
|
|
9
|
-
*/
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
function TreeItemProvider(props) {
|
|
11
11
|
const {
|
|
12
12
|
children,
|
|
@@ -24,14 +24,16 @@ function TreeItemProvider(props) {
|
|
|
24
24
|
treeId,
|
|
25
25
|
id
|
|
26
26
|
});
|
|
27
|
-
return
|
|
28
|
-
children
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
28
|
+
children: wrapItem({
|
|
29
|
+
children,
|
|
30
|
+
itemId,
|
|
31
|
+
instance,
|
|
32
|
+
idAttribute
|
|
33
|
+
})
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
|
-
TreeItemProvider.propTypes = {
|
|
36
|
+
process.env.NODE_ENV !== "production" ? TreeItemProvider.propTypes = {
|
|
35
37
|
// ----------------------------- Warning --------------------------------
|
|
36
38
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
37
39
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
@@ -39,5 +41,5 @@ TreeItemProvider.propTypes = {
|
|
|
39
41
|
children: PropTypes.node,
|
|
40
42
|
id: PropTypes.string,
|
|
41
43
|
itemId: PropTypes.string.isRequired
|
|
42
|
-
};
|
|
44
|
+
} : void 0;
|
|
43
45
|
export { TreeItemProvider };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { UseTreeViewSelectionSignature } from '../../internals/plugins/useTreeViewSelection';
|
|
3
|
-
import { UseTreeViewExpansionSignature } from '../../internals/plugins/useTreeViewExpansion';
|
|
4
|
-
import { UseTreeViewItemsSignature } from '../../internals/plugins/useTreeViewItems';
|
|
5
|
-
import { UseTreeViewFocusSignature } from '../../internals/plugins/useTreeViewFocus';
|
|
2
|
+
import type { UseTreeViewSelectionSignature } from '../../internals/plugins/useTreeViewSelection';
|
|
3
|
+
import type { UseTreeViewExpansionSignature } from '../../internals/plugins/useTreeViewExpansion';
|
|
4
|
+
import type { UseTreeViewItemsSignature } from '../../internals/plugins/useTreeViewItems';
|
|
5
|
+
import type { UseTreeViewFocusSignature } from '../../internals/plugins/useTreeViewFocus';
|
|
6
6
|
import { UseTreeViewLabelSignature } from '../../internals/plugins/useTreeViewLabel';
|
|
7
7
|
import type { UseTreeItemStatus } from '../../useTreeItem';
|
|
8
8
|
import { TreeViewPublicAPI } from '../../internals/models';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { TreeViewAnyPluginSignature, TreeViewPublicAPI } from '../internals/models';
|
|
3
|
+
import { RichTreeViewPluginSignatures } from '../RichTreeView/RichTreeView.plugins';
|
|
3
4
|
/**
|
|
4
5
|
* Hook that instantiates a [[TreeViewApiRef]].
|
|
5
6
|
*/
|
|
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, import("../internals").UseTreeViewLabelSignature]>() => React.
|
|
7
|
+
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, import("../internals").UseTreeViewLabelSignature]>() => React.RefObject<TreeViewPublicAPI<TSignatures> | undefined>;
|
package/index.js
CHANGED
|
@@ -8,7 +8,7 @@ export type TreeViewContextValue<TSignatures extends readonly TreeViewAnyPluginS
|
|
|
8
8
|
instance: TreeViewInstance<TSignatures, TOptionalSignatures>;
|
|
9
9
|
publicAPI: TreeViewPublicAPI<TSignatures, TOptionalSignatures>;
|
|
10
10
|
store: TreeViewStore<TSignatures>;
|
|
11
|
-
rootRef: React.RefObject<HTMLUListElement>;
|
|
11
|
+
rootRef: React.RefObject<HTMLUListElement | null>;
|
|
12
12
|
wrapItem: TreeItemWrapper<TSignatures>;
|
|
13
13
|
wrapRoot: TreeRootWrapper;
|
|
14
14
|
runItemPlugins: TreeViewItemPluginsRunner;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { SlotComponentProps } from '@mui/utils';
|
|
2
|
+
import { SlotComponentProps } from '@mui/utils/types';
|
|
3
3
|
import { TreeItem, TreeItemProps } from '../../TreeItem';
|
|
4
4
|
import { TreeViewItemId } from '../../models';
|
|
5
5
|
export declare function RichTreeViewItems(props: RichTreeViewItemsProps): React.JSX.Element;
|
|
@@ -14,7 +14,7 @@ export function createUseInstanceEventHandler(registryContainer) {
|
|
|
14
14
|
}
|
|
15
15
|
const [objectRetainedByReact] = React.useState(new ObjectToBeRetainedByReact());
|
|
16
16
|
const subscription = React.useRef(null);
|
|
17
|
-
const handlerRef = React.useRef();
|
|
17
|
+
const handlerRef = React.useRef(undefined);
|
|
18
18
|
handlerRef.current = handler;
|
|
19
19
|
const cleanupTokenRef = React.useRef(null);
|
|
20
20
|
if (!subscription.current && handlerRef.current) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { EventHandlers } from '@mui/utils';
|
|
2
|
+
import { EventHandlers } from '@mui/utils/types';
|
|
3
3
|
import type { UseTreeItemContentSlotOwnProps, UseTreeItemDragAndDropOverlaySlotOwnProps, UseTreeItemLabelInputSlotOwnProps, UseTreeItemRootSlotOwnProps, UseTreeItemCheckboxSlotOwnProps, UseTreeItemStatus } from '../../useTreeItem';
|
|
4
4
|
import type { UseTreeItemInteractions } from '../../hooks/useTreeItemUtils/useTreeItemUtils';
|
|
5
5
|
import type { TreeItemProps } from '../../TreeItem/TreeItem.types';
|
|
6
6
|
export interface TreeViewItemPluginSlotPropsEnhancerParams {
|
|
7
|
-
rootRefObject: React.
|
|
8
|
-
contentRefObject: React.
|
|
7
|
+
rootRefObject: React.RefObject<HTMLLIElement | null>;
|
|
8
|
+
contentRefObject: React.RefObject<HTMLDivElement | null>;
|
|
9
9
|
externalEventHandlers: EventHandlers;
|
|
10
10
|
interactions: UseTreeItemInteractions;
|
|
11
11
|
status: UseTreeItemStatus;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { EventHandlers } from '@mui/utils';
|
|
2
|
+
import { EventHandlers } from '@mui/utils/types';
|
|
3
3
|
import { TreeViewExperimentalFeatures, TreeViewInstance, TreeViewModel } from './treeView';
|
|
4
4
|
import type { MergeSignaturesProperty, OptionalIfEmpty } from './helpers';
|
|
5
5
|
import { TreeViewEventLookupElement } from './events';
|
|
@@ -15,7 +15,7 @@ export interface TreeViewPluginOptions<TSignature extends TreeViewAnyPluginSigna
|
|
|
15
15
|
experimentalFeatures: TreeViewUsedExperimentalFeatures<TSignature>;
|
|
16
16
|
models: TreeViewUsedModels<TSignature>;
|
|
17
17
|
store: TreeViewUsedStore<TSignature>;
|
|
18
|
-
rootRef: React.RefObject<HTMLUListElement>;
|
|
18
|
+
rootRef: React.RefObject<HTMLUListElement | null>;
|
|
19
19
|
plugins: TreeViewPlugin<TreeViewAnyPluginSignature>[];
|
|
20
20
|
}
|
|
21
21
|
type TreeViewModelsInitializer<TSignature extends TreeViewAnyPluginSignature> = {
|
|
@@ -118,7 +118,7 @@ type TreeViewRequiredPlugins<TSignature extends TreeViewAnyPluginSignature> = [
|
|
|
118
118
|
];
|
|
119
119
|
type PluginPropertyWithDependencies<TSignature extends TreeViewAnyPluginSignature, TProperty extends keyof TreeViewAnyPluginSignature> = TSignature[TProperty] & MergeSignaturesProperty<TreeViewRequiredPlugins<TSignature>, TProperty> & Partial<MergeSignaturesProperty<TSignature['optionalDependencies'], TProperty>>;
|
|
120
120
|
export type TreeViewUsedParams<TSignature extends TreeViewAnyPluginSignature> = PluginPropertyWithDependencies<TSignature, 'params'>;
|
|
121
|
-
type TreeViewUsedDefaultizedParams<TSignature extends TreeViewAnyPluginSignature> = PluginPropertyWithDependencies<TSignature, 'defaultizedParams'>;
|
|
121
|
+
export type TreeViewUsedDefaultizedParams<TSignature extends TreeViewAnyPluginSignature> = PluginPropertyWithDependencies<TSignature, 'defaultizedParams'>;
|
|
122
122
|
export type TreeViewUsedInstance<TSignature extends TreeViewAnyPluginSignature> = PluginPropertyWithDependencies<TSignature, 'instance'> & {
|
|
123
123
|
/**
|
|
124
124
|
* Private property only defined in TypeScript to be able to access the plugin signature from the instance object.
|
|
@@ -1,25 +1,38 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import * as React from 'react';
|
|
3
2
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
4
3
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
5
4
|
import { selectorIsItemExpandable, selectorIsItemExpanded } from "./useTreeViewExpansion.selectors.js";
|
|
6
|
-
import { createExpandedItemsMap } from "./useTreeViewExpansion.utils.js";
|
|
5
|
+
import { createExpandedItemsMap, getExpansionTrigger } from "./useTreeViewExpansion.utils.js";
|
|
7
6
|
import { selectorItemMeta, selectorItemOrderedChildrenIds } from "../useTreeViewItems/useTreeViewItems.selectors.js";
|
|
8
7
|
export const useTreeViewExpansion = ({
|
|
9
8
|
instance,
|
|
10
9
|
store,
|
|
11
10
|
params,
|
|
12
|
-
models
|
|
13
|
-
experimentalFeatures
|
|
11
|
+
models
|
|
14
12
|
}) => {
|
|
15
|
-
const isTreeViewEditable = Boolean(params.isItemEditable) && !!experimentalFeatures.labelEditing;
|
|
16
13
|
useEnhancedEffect(() => {
|
|
17
14
|
store.update(prevState => _extends({}, prevState, {
|
|
18
|
-
expansion: {
|
|
15
|
+
expansion: _extends({}, prevState.expansion, {
|
|
19
16
|
expandedItemsMap: createExpandedItemsMap(models.expandedItems.value)
|
|
20
|
-
}
|
|
17
|
+
})
|
|
21
18
|
}));
|
|
22
19
|
}, [store, models.expandedItems.value]);
|
|
20
|
+
useEnhancedEffect(() => {
|
|
21
|
+
store.update(prevState => {
|
|
22
|
+
const newExpansionTrigger = getExpansionTrigger({
|
|
23
|
+
isItemEditable: params.isItemEditable,
|
|
24
|
+
expansionTrigger: params.expansionTrigger
|
|
25
|
+
});
|
|
26
|
+
if (prevState.expansion.expansionTrigger === newExpansionTrigger) {
|
|
27
|
+
return prevState;
|
|
28
|
+
}
|
|
29
|
+
return _extends({}, prevState, {
|
|
30
|
+
expansion: _extends({}, prevState.expansion, {
|
|
31
|
+
expansionTrigger: newExpansionTrigger
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}, [store, params.isItemEditable, params.expansionTrigger]);
|
|
23
36
|
const setExpandedItems = (event, value) => {
|
|
24
37
|
params.onExpandedItemsChange?.(event, value);
|
|
25
38
|
models.expandedItems.setControlledValue(value);
|
|
@@ -61,20 +74,6 @@ export const useTreeViewExpansion = ({
|
|
|
61
74
|
setExpandedItems(event, newExpanded);
|
|
62
75
|
}
|
|
63
76
|
};
|
|
64
|
-
const expansionTrigger = React.useMemo(() => {
|
|
65
|
-
if (params.expansionTrigger) {
|
|
66
|
-
return params.expansionTrigger;
|
|
67
|
-
}
|
|
68
|
-
if (isTreeViewEditable) {
|
|
69
|
-
return 'iconContainer';
|
|
70
|
-
}
|
|
71
|
-
return 'content';
|
|
72
|
-
}, [params.expansionTrigger, isTreeViewEditable]);
|
|
73
|
-
const pluginContextValue = React.useMemo(() => ({
|
|
74
|
-
expansion: {
|
|
75
|
-
expansionTrigger
|
|
76
|
-
}
|
|
77
|
-
}), [expansionTrigger]);
|
|
78
77
|
return {
|
|
79
78
|
publicAPI: {
|
|
80
79
|
setItemExpansion
|
|
@@ -83,8 +82,7 @@ export const useTreeViewExpansion = ({
|
|
|
83
82
|
setItemExpansion,
|
|
84
83
|
toggleItemExpansion,
|
|
85
84
|
expandAllSiblings
|
|
86
|
-
}
|
|
87
|
-
contextValue: pluginContextValue
|
|
85
|
+
}
|
|
88
86
|
};
|
|
89
87
|
};
|
|
90
88
|
useTreeViewExpansion.models = {
|
|
@@ -100,7 +98,8 @@ useTreeViewExpansion.getDefaultizedParams = ({
|
|
|
100
98
|
});
|
|
101
99
|
useTreeViewExpansion.getInitialState = params => ({
|
|
102
100
|
expansion: {
|
|
103
|
-
expandedItemsMap: createExpandedItemsMap(params.expandedItems === undefined ? params.defaultExpandedItems : params.expandedItems)
|
|
101
|
+
expandedItemsMap: createExpandedItemsMap(params.expandedItems === undefined ? params.defaultExpandedItems : params.expandedItems),
|
|
102
|
+
expansionTrigger: getExpansionTrigger(params)
|
|
104
103
|
}
|
|
105
104
|
});
|
|
106
105
|
useTreeViewExpansion.params = {
|
|
@@ -12,9 +12,11 @@ export declare const selectorIsItemExpanded: ((state: any, itemId: string) => bo
|
|
|
12
12
|
} & {
|
|
13
13
|
resultFunc: (resultFuncArgs_0: {
|
|
14
14
|
expandedItemsMap: Map<string, true>;
|
|
15
|
+
expansionTrigger: "content" | "iconContainer";
|
|
15
16
|
}, resultFuncArgs_1: string) => boolean;
|
|
16
17
|
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
17
18
|
expandedItemsMap: Map<string, true>;
|
|
19
|
+
expansionTrigger: "content" | "iconContainer";
|
|
18
20
|
}, resultFuncArgs_1: string) => boolean) & {
|
|
19
21
|
clearCache: () => void;
|
|
20
22
|
resultsCount: () => number;
|
|
@@ -52,8 +54,12 @@ export declare const selectorIsItemExpandable: ((state: any, itemId: string | nu
|
|
|
52
54
|
resultsCount: () => number;
|
|
53
55
|
resetResultsCount: () => void;
|
|
54
56
|
} & {
|
|
55
|
-
resultFunc: (resultFuncArgs_0:
|
|
56
|
-
|
|
57
|
+
resultFunc: (resultFuncArgs_0: {
|
|
58
|
+
[itemId: string]: import("../..").TreeViewItemMeta;
|
|
59
|
+
}, resultFuncArgs_1: string | null) => import("../..").TreeViewItemMeta | null;
|
|
60
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
61
|
+
[itemId: string]: import("../..").TreeViewItemMeta;
|
|
62
|
+
}, resultFuncArgs_1: string | null) => import("../..").TreeViewItemMeta | null) & {
|
|
57
63
|
clearCache: () => void;
|
|
58
64
|
resultsCount: () => number;
|
|
59
65
|
resetResultsCount: () => void;
|
|
@@ -61,15 +67,21 @@ export declare const selectorIsItemExpandable: ((state: any, itemId: string | nu
|
|
|
61
67
|
lastResult: () => import("../..").TreeViewItemMeta | null;
|
|
62
68
|
dependencies: [((state: import("../../corePlugins/useTreeViewId/useTreeViewId.types").UseTreeViewIdState & import("../useTreeViewItems").UseTreeViewItemsState<import("../../..").TreeViewDefaultItemModelProperties> & Partial<{}> & {
|
|
63
69
|
cacheKey: import("../../models").TreeViewStateCacheKey;
|
|
64
|
-
}) =>
|
|
70
|
+
}) => {
|
|
71
|
+
[itemId: string]: import("../..").TreeViewItemMeta;
|
|
72
|
+
}) & {
|
|
65
73
|
clearCache: () => void;
|
|
66
74
|
resultsCount: () => number;
|
|
67
75
|
resetResultsCount: () => void;
|
|
68
76
|
} & {
|
|
69
77
|
resultFunc: (resultFuncArgs_0: {
|
|
70
78
|
disabledItemsFocusable: boolean;
|
|
71
|
-
itemModelLookup:
|
|
72
|
-
|
|
79
|
+
itemModelLookup: {
|
|
80
|
+
[itemId: string]: import("../../..").TreeViewBaseItem<import("../../..").TreeViewDefaultItemModelProperties>;
|
|
81
|
+
};
|
|
82
|
+
itemMetaLookup: {
|
|
83
|
+
[itemId: string]: import("../..").TreeViewItemMeta;
|
|
84
|
+
};
|
|
73
85
|
itemOrderedChildrenIdsLookup: {
|
|
74
86
|
[parentItemId: string]: string[];
|
|
75
87
|
};
|
|
@@ -78,11 +90,17 @@ export declare const selectorIsItemExpandable: ((state: any, itemId: string | nu
|
|
|
78
90
|
[itemId: string]: number;
|
|
79
91
|
};
|
|
80
92
|
};
|
|
81
|
-
}) =>
|
|
93
|
+
}) => {
|
|
94
|
+
[itemId: string]: import("../..").TreeViewItemMeta;
|
|
95
|
+
};
|
|
82
96
|
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
83
97
|
disabledItemsFocusable: boolean;
|
|
84
|
-
itemModelLookup:
|
|
85
|
-
|
|
98
|
+
itemModelLookup: {
|
|
99
|
+
[itemId: string]: import("../../..").TreeViewBaseItem<import("../../..").TreeViewDefaultItemModelProperties>;
|
|
100
|
+
};
|
|
101
|
+
itemMetaLookup: {
|
|
102
|
+
[itemId: string]: import("../..").TreeViewItemMeta;
|
|
103
|
+
};
|
|
86
104
|
itemOrderedChildrenIdsLookup: {
|
|
87
105
|
[parentItemId: string]: string[];
|
|
88
106
|
};
|
|
@@ -91,12 +109,16 @@ export declare const selectorIsItemExpandable: ((state: any, itemId: string | nu
|
|
|
91
109
|
[itemId: string]: number;
|
|
92
110
|
};
|
|
93
111
|
};
|
|
94
|
-
}) =>
|
|
112
|
+
}) => {
|
|
113
|
+
[itemId: string]: import("../..").TreeViewItemMeta;
|
|
114
|
+
}) & {
|
|
95
115
|
clearCache: () => void;
|
|
96
116
|
resultsCount: () => number;
|
|
97
117
|
resetResultsCount: () => void;
|
|
98
118
|
};
|
|
99
|
-
lastResult: () =>
|
|
119
|
+
lastResult: () => {
|
|
120
|
+
[itemId: string]: import("../..").TreeViewItemMeta;
|
|
121
|
+
};
|
|
100
122
|
dependencies: [TreeViewRootSelector<import("../useTreeViewItems").UseTreeViewItemsSignature>];
|
|
101
123
|
recomputations: () => number;
|
|
102
124
|
resetRecomputations: () => void;
|
|
@@ -122,3 +144,37 @@ export declare const selectorIsItemExpandable: ((state: any, itemId: string | nu
|
|
|
122
144
|
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
123
145
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
124
146
|
};
|
|
147
|
+
/**
|
|
148
|
+
* Get the slot that triggers the item's expansion when clicked.
|
|
149
|
+
* @param {TreeViewState<[UseTreeViewExpansionSignature]>} state The state of the tree view.
|
|
150
|
+
* @returns {'content' | 'iconContainer'} The slot that triggers the item's expansion when clicked. Is `null` if the item is not expandable.
|
|
151
|
+
*/
|
|
152
|
+
export declare const selectorItemExpansionTrigger: ((state: import("../../corePlugins/useTreeViewId/useTreeViewId.types").UseTreeViewIdState & import("./useTreeViewExpansion.types").UseTreeViewExpansionState & Partial<{}> & {
|
|
153
|
+
cacheKey: import("../../models").TreeViewStateCacheKey;
|
|
154
|
+
}) => "content" | "iconContainer") & {
|
|
155
|
+
clearCache: () => void;
|
|
156
|
+
resultsCount: () => number;
|
|
157
|
+
resetResultsCount: () => void;
|
|
158
|
+
} & {
|
|
159
|
+
resultFunc: (resultFuncArgs_0: {
|
|
160
|
+
expandedItemsMap: Map<string, true>;
|
|
161
|
+
expansionTrigger: "content" | "iconContainer";
|
|
162
|
+
}) => "content" | "iconContainer";
|
|
163
|
+
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
164
|
+
expandedItemsMap: Map<string, true>;
|
|
165
|
+
expansionTrigger: "content" | "iconContainer";
|
|
166
|
+
}) => "content" | "iconContainer") & {
|
|
167
|
+
clearCache: () => void;
|
|
168
|
+
resultsCount: () => number;
|
|
169
|
+
resetResultsCount: () => void;
|
|
170
|
+
};
|
|
171
|
+
lastResult: () => "content" | "iconContainer";
|
|
172
|
+
dependencies: [TreeViewRootSelector<UseTreeViewExpansionSignature>];
|
|
173
|
+
recomputations: () => number;
|
|
174
|
+
resetRecomputations: () => void;
|
|
175
|
+
dependencyRecomputations: () => number;
|
|
176
|
+
resetDependencyRecomputations: () => void;
|
|
177
|
+
} & {
|
|
178
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
179
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
180
|
+
};
|
|
@@ -14,4 +14,11 @@ export const selectorIsItemExpanded = createSelector([selectorExpansion, (_, ite
|
|
|
14
14
|
* @param {TreeViewState<[UseTreeViewItemsSignature]>} state The state of the tree view.
|
|
15
15
|
* @returns {boolean} `true` if the item is expandable, `false` otherwise.
|
|
16
16
|
*/
|
|
17
|
-
export const selectorIsItemExpandable = createSelector([selectorItemMeta], itemMeta => itemMeta?.expandable ?? false);
|
|
17
|
+
export const selectorIsItemExpandable = createSelector([selectorItemMeta], itemMeta => itemMeta?.expandable ?? false);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Get the slot that triggers the item's expansion when clicked.
|
|
21
|
+
* @param {TreeViewState<[UseTreeViewExpansionSignature]>} state The state of the tree view.
|
|
22
|
+
* @returns {'content' | 'iconContainer'} The slot that triggers the item's expansion when clicked. Is `null` if the item is not expandable.
|
|
23
|
+
*/
|
|
24
|
+
export const selectorItemExpansionTrigger = createSelector([selectorExpansion], expansionState => expansionState.expansionTrigger);
|
|
@@ -63,11 +63,9 @@ export type UseTreeViewExpansionDefaultizedParameters = DefaultizedProps<UseTree
|
|
|
63
63
|
export interface UseTreeViewExpansionState {
|
|
64
64
|
expansion: {
|
|
65
65
|
expandedItemsMap: Map<string, true>;
|
|
66
|
+
expansionTrigger: 'content' | 'iconContainer';
|
|
66
67
|
};
|
|
67
68
|
}
|
|
68
|
-
interface UseTreeViewExpansionContextValue {
|
|
69
|
-
expansion: Pick<UseTreeViewExpansionParameters, 'expansionTrigger'>;
|
|
70
|
-
}
|
|
71
69
|
export type UseTreeViewExpansionSignature = TreeViewPluginSignature<{
|
|
72
70
|
params: UseTreeViewExpansionParameters;
|
|
73
71
|
defaultizedParams: UseTreeViewExpansionDefaultizedParameters;
|
|
@@ -75,8 +73,6 @@ export type UseTreeViewExpansionSignature = TreeViewPluginSignature<{
|
|
|
75
73
|
publicAPI: UseTreeViewExpansionPublicAPI;
|
|
76
74
|
modelNames: 'expandedItems';
|
|
77
75
|
state: UseTreeViewExpansionState;
|
|
78
|
-
contextValue: UseTreeViewExpansionContextValue;
|
|
79
76
|
dependencies: [UseTreeViewItemsSignature];
|
|
80
77
|
optionalDependencies: [UseTreeViewLabelSignature];
|
|
81
78
|
}>;
|
|
82
|
-
export {};
|
|
@@ -1 +1,4 @@
|
|
|
1
|
+
import { TreeViewUsedDefaultizedParams } from '../../models';
|
|
2
|
+
import { UseTreeViewExpansionSignature } from './useTreeViewExpansion.types';
|
|
1
3
|
export declare const createExpandedItemsMap: (expandedItems: string[]) => Map<string, true>;
|
|
4
|
+
export declare const getExpansionTrigger: ({ isItemEditable, expansionTrigger, }: Pick<TreeViewUsedDefaultizedParams<UseTreeViewExpansionSignature>, "isItemEditable" | "expansionTrigger">) => "content" | "iconContainer";
|
|
@@ -4,4 +4,16 @@ export const createExpandedItemsMap = expandedItems => {
|
|
|
4
4
|
expandedItemsMap.set(id, true);
|
|
5
5
|
});
|
|
6
6
|
return expandedItemsMap;
|
|
7
|
+
};
|
|
8
|
+
export const getExpansionTrigger = ({
|
|
9
|
+
isItemEditable,
|
|
10
|
+
expansionTrigger
|
|
11
|
+
}) => {
|
|
12
|
+
if (expansionTrigger) {
|
|
13
|
+
return expansionTrigger;
|
|
14
|
+
}
|
|
15
|
+
if (isItemEditable) {
|
|
16
|
+
return 'iconContainer';
|
|
17
|
+
}
|
|
18
|
+
return 'content';
|
|
7
19
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { SlotComponentProps } from '@mui/utils';
|
|
2
|
+
import { SlotComponentProps } from '@mui/utils/types';
|
|
3
3
|
import { TreeViewPluginSignature } from '../../models';
|
|
4
4
|
import { UseTreeViewItemsSignature } from '../useTreeViewItems';
|
|
5
5
|
import { UseTreeViewSelectionSignature } from '../useTreeViewSelection';
|