@mui/x-tree-view 9.11.0 → 9.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +317 -0
- package/RichTreeView/RichTreeView.js +30 -25
- package/RichTreeView/RichTreeView.mjs +30 -25
- package/RichTreeView/RichTreeView.types.d.mts +27 -1
- package/RichTreeView/RichTreeView.types.d.ts +27 -1
- package/RichTreeView/richTreeViewClasses.d.mts +4 -1
- package/RichTreeView/richTreeViewClasses.d.ts +4 -1
- package/RichTreeView/richTreeViewClasses.js +1 -1
- package/RichTreeView/richTreeViewClasses.mjs +1 -1
- package/RichTreeView/useExtractRichTreeViewParameters.d.mts +1 -0
- package/RichTreeView/useExtractRichTreeViewParameters.d.ts +1 -0
- package/RichTreeView/useExtractRichTreeViewParameters.js +6 -3
- package/RichTreeView/useExtractRichTreeViewParameters.mjs +6 -3
- package/SimpleTreeView/simpleTreeViewClasses.d.mts +1 -1
- package/SimpleTreeView/simpleTreeViewClasses.d.ts +1 -1
- package/TreeItem/TreeItem.js +2 -1
- package/TreeItem/TreeItem.mjs +2 -1
- package/TreeItemLoader/TreeItemLoader.d.mts +20 -0
- package/TreeItemLoader/TreeItemLoader.d.ts +20 -0
- package/TreeItemLoader/TreeItemLoader.js +152 -0
- package/TreeItemLoader/TreeItemLoader.mjs +146 -0
- package/TreeItemLoader/TreeItemLoader.types.d.mts +36 -0
- package/TreeItemLoader/TreeItemLoader.types.d.ts +36 -0
- package/TreeItemLoader/TreeItemLoader.types.js +5 -0
- package/TreeItemLoader/TreeItemLoader.types.mjs +1 -0
- package/TreeItemLoader/TreeItemLoaderContext.d.mts +24 -0
- package/TreeItemLoader/TreeItemLoaderContext.d.ts +24 -0
- package/TreeItemLoader/TreeItemLoaderContext.js +22 -0
- package/TreeItemLoader/TreeItemLoaderContext.mjs +16 -0
- package/TreeItemLoader/index.d.mts +3 -0
- package/TreeItemLoader/index.d.ts +3 -0
- package/TreeItemLoader/index.js +34 -0
- package/TreeItemLoader/index.mjs +2 -0
- package/TreeItemLoader/treeItemLoaderClasses.d.mts +13 -0
- package/TreeItemLoader/treeItemLoaderClasses.d.ts +13 -0
- package/TreeItemLoader/treeItemLoaderClasses.js +14 -0
- package/TreeItemLoader/treeItemLoaderClasses.mjs +6 -0
- package/index.d.mts +1 -0
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/index.mjs +2 -1
- package/internals/MinimalTreeViewStore/MinimalTreeViewStore.js +2 -2
- package/internals/MinimalTreeViewStore/MinimalTreeViewStore.mjs +3 -3
- package/internals/MinimalTreeViewStore/MinimalTreeViewStore.types.d.mts +4 -0
- package/internals/MinimalTreeViewStore/MinimalTreeViewStore.types.d.ts +4 -0
- package/internals/MinimalTreeViewStore/MinimalTreeViewStore.utils.d.mts +1 -2
- package/internals/MinimalTreeViewStore/MinimalTreeViewStore.utils.d.ts +1 -2
- package/internals/MinimalTreeViewStore/MinimalTreeViewStore.utils.js +2 -9
- package/internals/MinimalTreeViewStore/MinimalTreeViewStore.utils.mjs +2 -7
- package/internals/TreeViewProvider/TreeViewProvider.js +7 -3
- package/internals/TreeViewProvider/TreeViewProvider.mjs +7 -3
- package/internals/TreeViewProvider/TreeViewProvider.types.d.mts +3 -3
- package/internals/TreeViewProvider/TreeViewProvider.types.d.ts +3 -3
- package/internals/TreeViewProvider/TreeViewStyleContext.d.mts +30 -2
- package/internals/TreeViewProvider/TreeViewStyleContext.d.ts +30 -2
- package/internals/TreeViewProvider/TreeViewStyleContext.js +12 -0
- package/internals/TreeViewProvider/TreeViewStyleContext.mjs +13 -0
- package/internals/components/RichTreeViewItems.js +59 -2
- package/internals/components/RichTreeViewItems.mjs +59 -2
- package/internals/components/RichTreeViewLoading.d.mts +97 -0
- package/internals/components/RichTreeViewLoading.d.ts +97 -0
- package/internals/components/RichTreeViewLoading.js +171 -0
- package/internals/components/RichTreeViewLoading.mjs +160 -0
- package/internals/constants.d.mts +6 -0
- package/internals/constants.d.ts +6 -0
- package/internals/constants.js +12 -0
- package/internals/constants.mjs +6 -0
- package/internals/hooks/useTreeViewStore.d.mts +1 -1
- package/internals/hooks/useTreeViewStore.d.ts +1 -1
- package/internals/hooks/useTreeViewStore.js +7 -3
- package/internals/hooks/useTreeViewStore.mjs +7 -3
- package/internals/index.d.mts +2 -0
- package/internals/index.d.ts +2 -0
- package/internals/index.js +13 -0
- package/internals/index.mjs +1 -0
- package/internals/plugins/expansion/selectors.d.mts +3 -2
- package/internals/plugins/expansion/selectors.d.ts +3 -2
- package/internals/plugins/expansion/selectors.js +4 -4
- package/internals/plugins/expansion/selectors.mjs +5 -5
- package/internals/plugins/focus/selectors.d.mts +3 -2
- package/internals/plugins/focus/selectors.d.ts +3 -2
- package/internals/plugins/focus/selectors.js +3 -3
- package/internals/plugins/focus/selectors.mjs +4 -4
- package/internals/plugins/id/selectors.d.mts +6 -3
- package/internals/plugins/id/selectors.d.ts +6 -3
- package/internals/plugins/id/selectors.js +4 -5
- package/internals/plugins/id/selectors.mjs +4 -5
- package/internals/plugins/items/selectors.d.mts +9 -8
- package/internals/plugins/items/selectors.d.ts +9 -8
- package/internals/plugins/items/selectors.js +15 -16
- package/internals/plugins/items/selectors.mjs +15 -16
- package/internals/plugins/labelEditing/selectors.d.mts +3 -2
- package/internals/plugins/labelEditing/selectors.d.ts +3 -2
- package/internals/plugins/labelEditing/selectors.js +6 -5
- package/internals/plugins/labelEditing/selectors.mjs +6 -5
- package/internals/plugins/lazyLoading/selectors.d.mts +9 -3
- package/internals/plugins/lazyLoading/selectors.d.ts +9 -3
- package/internals/plugins/lazyLoading/selectors.js +10 -6
- package/internals/plugins/lazyLoading/selectors.mjs +10 -6
- package/internals/plugins/lazyLoading/types.d.mts +5 -1
- package/internals/plugins/lazyLoading/types.d.ts +5 -1
- package/internals/plugins/selection/selectors.d.mts +15 -9
- package/internals/plugins/selection/selectors.d.ts +15 -9
- package/internals/plugins/selection/selectors.js +12 -12
- package/internals/plugins/selection/selectors.mjs +13 -13
- package/package.json +19 -7
- package/useTreeItem/useTreeItem.js +3 -3
- package/useTreeItem/useTreeItem.mjs +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
5
|
const _excluded = ["ownerState"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { EMPTY_ARRAY } from '@base-ui/utils/empty';
|
|
@@ -12,12 +12,62 @@ import { TreeItem } from "../../TreeItem/index.mjs";
|
|
|
12
12
|
import { itemsSelectors } from "../plugins/items/index.mjs";
|
|
13
13
|
import { useTreeViewContext, useTreeViewStyleContext } from "../TreeViewProvider/index.mjs";
|
|
14
14
|
import { expansionSelectors } from "../plugins/expansion/index.mjs";
|
|
15
|
+
import { lazyLoadingSelectors } from "../plugins/lazyLoading/index.mjs";
|
|
16
|
+
import { RichTreeViewItemLoaders, RichTreeViewLoadingContext, getLoadingItemsCount, MAX_LOADING_ITEMS_COUNT } from "./RichTreeViewLoading.mjs";
|
|
15
17
|
import { useTreeViewRootProps } from "../hooks/useTreeViewRootProps.mjs";
|
|
16
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
19
|
const RichTreeViewItemsContext = /*#__PURE__*/React.createContext(null);
|
|
18
20
|
if (process.env.NODE_ENV !== "production") RichTreeViewItemsContext.displayName = "RichTreeViewItemsContext";
|
|
19
21
|
const selectorNoChildren = () => EMPTY_ARRAY;
|
|
20
22
|
const selectorChildrenIdsNull = state => itemsSelectors.itemOrderedChildrenIds(state, null);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Renders the loading rows for the children of an item that lazily loads them.
|
|
26
|
+
* It only mounts while the item is loading, so the `loading` slot props are not
|
|
27
|
+
* resolved for the other items.
|
|
28
|
+
*/
|
|
29
|
+
function RichTreeViewItemLoadingChildren({
|
|
30
|
+
itemId
|
|
31
|
+
}) {
|
|
32
|
+
const {
|
|
33
|
+
store
|
|
34
|
+
} = useTreeViewContext();
|
|
35
|
+
const {
|
|
36
|
+
classes,
|
|
37
|
+
slots: styleSlots,
|
|
38
|
+
slotProps: styleSlotProps
|
|
39
|
+
} = useTreeViewStyleContext();
|
|
40
|
+
const itemDepth = useStore(store, itemsSelectors.itemDepth, itemId);
|
|
41
|
+
const loadingChildrenCount = useStore(store, lazyLoadingSelectors.itemLoadingChildrenCount, itemId);
|
|
42
|
+
const Loading = styleSlots.loading;
|
|
43
|
+
const loadingProps = useSlotProps({
|
|
44
|
+
elementType: Loading ?? 'div',
|
|
45
|
+
externalSlotProps: styleSlotProps.loading,
|
|
46
|
+
ownerState: {
|
|
47
|
+
itemId
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// The count reported by `getChildrenCount()` wins over `slotProps.loading.itemsCount`,
|
|
52
|
+
// which only acts as a fallback when the count is unknown.
|
|
53
|
+
const itemsCount = loadingChildrenCount > 0 ? Math.min(loadingChildrenCount, MAX_LOADING_ITEMS_COUNT) : getLoadingItemsCount(loadingProps.itemsCount);
|
|
54
|
+
return /*#__PURE__*/_jsx(RichTreeViewLoadingContext, {
|
|
55
|
+
store: store,
|
|
56
|
+
itemDepth: itemDepth + 1,
|
|
57
|
+
children: Loading ? /*#__PURE__*/_jsx(Loading, _extends({}, loadingProps, {
|
|
58
|
+
itemsCount: itemsCount
|
|
59
|
+
})) : /*#__PURE__*/_jsx(RichTreeViewItemLoaders, {
|
|
60
|
+
classes: classes,
|
|
61
|
+
slots: {
|
|
62
|
+
itemLoader: styleSlots.itemLoader
|
|
63
|
+
},
|
|
64
|
+
slotProps: {
|
|
65
|
+
itemLoader: styleSlotProps.itemLoader
|
|
66
|
+
},
|
|
67
|
+
itemsCount: itemsCount
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
}
|
|
21
71
|
export const RichTreeViewItem = /*#__PURE__*/React.memo(function RichTreeViewItem({
|
|
22
72
|
itemSlot,
|
|
23
73
|
itemSlotProps,
|
|
@@ -30,6 +80,7 @@ export const RichTreeViewItem = /*#__PURE__*/React.memo(function RichTreeViewIte
|
|
|
30
80
|
} = useTreeViewContext();
|
|
31
81
|
const itemMeta = useStore(store, itemsSelectors.itemMeta, itemId);
|
|
32
82
|
const children = useStore(store, skipChildren ? selectorNoChildren : itemsSelectors.itemOrderedChildrenIds, itemId);
|
|
83
|
+
const isLoadingChildren = useStore(store, lazyLoadingSelectors.isItemLoading, itemId);
|
|
33
84
|
const Item = itemSlot ?? TreeItem;
|
|
34
85
|
const _useSlotProps = useSlotProps({
|
|
35
86
|
elementType: Item,
|
|
@@ -45,8 +96,14 @@ export const RichTreeViewItem = /*#__PURE__*/React.memo(function RichTreeViewIte
|
|
|
45
96
|
}
|
|
46
97
|
}),
|
|
47
98
|
itemProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded);
|
|
99
|
+
let renderedChildren = renderItemForRichTreeView ? children?.map(renderItemForRichTreeView) : null;
|
|
100
|
+
if (isLoadingChildren && !skipChildren && (children == null || children.length === 0)) {
|
|
101
|
+
renderedChildren = /*#__PURE__*/_jsx(RichTreeViewItemLoadingChildren, {
|
|
102
|
+
itemId: itemId
|
|
103
|
+
});
|
|
104
|
+
}
|
|
48
105
|
return /*#__PURE__*/_jsx(Item, _extends({}, itemProps, {
|
|
49
|
-
children:
|
|
106
|
+
children: renderedChildren
|
|
50
107
|
}));
|
|
51
108
|
}, fastObjectShallowCompare);
|
|
52
109
|
if (process.env.NODE_ENV !== "production") RichTreeViewItem.displayName = "RichTreeViewItem";
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { SlotComponentProps } from '@mui/utils/types';
|
|
3
|
+
import type { TreeItemLoaderOwnerState } from "../../TreeItemLoader/index.mjs";
|
|
4
|
+
import type { TreeViewAnyStore } from "../models/index.mjs";
|
|
5
|
+
import type { TreeViewItemId } from "../../models/index.mjs";
|
|
6
|
+
import type { TreeViewStoreInContext } from "../TreeViewProvider/index.mjs";
|
|
7
|
+
export declare const DEFAULT_LOADING_ITEMS_COUNT = 5;
|
|
8
|
+
export declare const MAX_LOADING_ITEMS_COUNT = 100;
|
|
9
|
+
export declare function getLoadingItemsCount(itemsCount: number | undefined): number;
|
|
10
|
+
export interface RichTreeViewLoadingSlots {
|
|
11
|
+
/**
|
|
12
|
+
* Element rendered at the root.
|
|
13
|
+
*/
|
|
14
|
+
root: React.ElementType;
|
|
15
|
+
/**
|
|
16
|
+
* Component rendered instead of the default loading rows.
|
|
17
|
+
* It renders inside the tree root while the tree is loading and inside a
|
|
18
|
+
* lazily loading item while its children load.
|
|
19
|
+
*/
|
|
20
|
+
loading?: React.ElementType;
|
|
21
|
+
/**
|
|
22
|
+
* Component rendered for each loading row.
|
|
23
|
+
* @default TreeItemLoader
|
|
24
|
+
*/
|
|
25
|
+
itemLoader?: React.ElementType;
|
|
26
|
+
}
|
|
27
|
+
export interface RichTreeViewLoadingSlotOwnProps {
|
|
28
|
+
/**
|
|
29
|
+
* The number of loading rows to render.
|
|
30
|
+
* The children of a lazily loading item use `getChildrenCount()` as the default instead.
|
|
31
|
+
* @default 5
|
|
32
|
+
*/
|
|
33
|
+
itemsCount?: number;
|
|
34
|
+
/**
|
|
35
|
+
* A message describing the loading state.
|
|
36
|
+
* The default loading rows do not render it.
|
|
37
|
+
* It is forwarded to a custom `loading` slot component.
|
|
38
|
+
*/
|
|
39
|
+
message?: React.ReactNode;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The owner state of the `loading` slot.
|
|
43
|
+
*/
|
|
44
|
+
export interface RichTreeViewLoadingSlotOwnerState {
|
|
45
|
+
/**
|
|
46
|
+
* The id of the item whose children are loading.
|
|
47
|
+
* `null` while the whole tree is loading.
|
|
48
|
+
*/
|
|
49
|
+
itemId: TreeViewItemId | null;
|
|
50
|
+
}
|
|
51
|
+
export interface RichTreeViewLoadingSlotProps<TOwnerState extends object> {
|
|
52
|
+
root?: SlotComponentProps<'ul', {}, TOwnerState>;
|
|
53
|
+
loading?: SlotComponentProps<'div', RichTreeViewLoadingSlotOwnProps, RichTreeViewLoadingSlotOwnerState>;
|
|
54
|
+
itemLoader?: SlotComponentProps<'li', {}, TreeItemLoaderOwnerState>;
|
|
55
|
+
}
|
|
56
|
+
export interface RichTreeViewLoadingClasses {
|
|
57
|
+
root?: string;
|
|
58
|
+
itemLoader?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface RichTreeViewLoadingProps<TStore extends TreeViewAnyStore, TOwnerState extends object> {
|
|
61
|
+
store: TreeViewStoreInContext<TStore>;
|
|
62
|
+
slots: RichTreeViewLoadingSlots;
|
|
63
|
+
slotProps?: RichTreeViewLoadingSlotProps<TOwnerState>;
|
|
64
|
+
ownerState: TOwnerState;
|
|
65
|
+
forwardedProps: React.HTMLAttributes<HTMLUListElement>;
|
|
66
|
+
rootRef: React.Ref<HTMLUListElement>;
|
|
67
|
+
classes: RichTreeViewLoadingClasses;
|
|
68
|
+
}
|
|
69
|
+
export interface RichTreeViewItemLoadersProps {
|
|
70
|
+
classes: Pick<RichTreeViewLoadingClasses, 'itemLoader'>;
|
|
71
|
+
slots: Pick<RichTreeViewLoadingSlots, 'itemLoader'>;
|
|
72
|
+
slotProps?: Pick<RichTreeViewLoadingSlotProps<object>, 'itemLoader'>;
|
|
73
|
+
itemsCount: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Renders the default loading rows without any wrapper.
|
|
77
|
+
* Used by `RichTreeViewLoading` for the whole-tree loading state and by
|
|
78
|
+
* `RichTreeViewItem` for the children of an item that lazily loads them.
|
|
79
|
+
* It must render inside a `TreeItemLoaderContext` provider.
|
|
80
|
+
*/
|
|
81
|
+
export declare function RichTreeViewItemLoaders(props: RichTreeViewItemLoadersProps): React.JSX.Element;
|
|
82
|
+
/**
|
|
83
|
+
* Provides the layout information the loading rows need to `TreeItemLoader`.
|
|
84
|
+
* Wraps both the default rows and a custom `loading` slot, so custom loading
|
|
85
|
+
* UIs composed with `TreeItemLoader` keep the correct depth and height.
|
|
86
|
+
*/
|
|
87
|
+
export declare function RichTreeViewLoadingContext<TStore extends TreeViewAnyStore>(props: {
|
|
88
|
+
store: TreeViewStoreInContext<TStore>;
|
|
89
|
+
itemDepth?: number;
|
|
90
|
+
children: React.ReactNode;
|
|
91
|
+
}): React.JSX.Element;
|
|
92
|
+
/**
|
|
93
|
+
* Renders the loading placeholder shared by `RichTreeView` and `RichTreeViewPro`.
|
|
94
|
+
* It reuses `useTreeViewRootProps` so the root element keeps the same `role="tree"`,
|
|
95
|
+
* `id`, `aria-multiselectable` and slot/className behavior as the non-loading tree.
|
|
96
|
+
*/
|
|
97
|
+
export declare function RichTreeViewLoading<TStore extends TreeViewAnyStore, TOwnerState extends object>(props: RichTreeViewLoadingProps<TStore, TOwnerState>): React.JSX.Element;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { SlotComponentProps } from '@mui/utils/types';
|
|
3
|
+
import type { TreeItemLoaderOwnerState } from "../../TreeItemLoader/index.js";
|
|
4
|
+
import type { TreeViewAnyStore } from "../models/index.js";
|
|
5
|
+
import type { TreeViewItemId } from "../../models/index.js";
|
|
6
|
+
import type { TreeViewStoreInContext } from "../TreeViewProvider/index.js";
|
|
7
|
+
export declare const DEFAULT_LOADING_ITEMS_COUNT = 5;
|
|
8
|
+
export declare const MAX_LOADING_ITEMS_COUNT = 100;
|
|
9
|
+
export declare function getLoadingItemsCount(itemsCount: number | undefined): number;
|
|
10
|
+
export interface RichTreeViewLoadingSlots {
|
|
11
|
+
/**
|
|
12
|
+
* Element rendered at the root.
|
|
13
|
+
*/
|
|
14
|
+
root: React.ElementType;
|
|
15
|
+
/**
|
|
16
|
+
* Component rendered instead of the default loading rows.
|
|
17
|
+
* It renders inside the tree root while the tree is loading and inside a
|
|
18
|
+
* lazily loading item while its children load.
|
|
19
|
+
*/
|
|
20
|
+
loading?: React.ElementType;
|
|
21
|
+
/**
|
|
22
|
+
* Component rendered for each loading row.
|
|
23
|
+
* @default TreeItemLoader
|
|
24
|
+
*/
|
|
25
|
+
itemLoader?: React.ElementType;
|
|
26
|
+
}
|
|
27
|
+
export interface RichTreeViewLoadingSlotOwnProps {
|
|
28
|
+
/**
|
|
29
|
+
* The number of loading rows to render.
|
|
30
|
+
* The children of a lazily loading item use `getChildrenCount()` as the default instead.
|
|
31
|
+
* @default 5
|
|
32
|
+
*/
|
|
33
|
+
itemsCount?: number;
|
|
34
|
+
/**
|
|
35
|
+
* A message describing the loading state.
|
|
36
|
+
* The default loading rows do not render it.
|
|
37
|
+
* It is forwarded to a custom `loading` slot component.
|
|
38
|
+
*/
|
|
39
|
+
message?: React.ReactNode;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The owner state of the `loading` slot.
|
|
43
|
+
*/
|
|
44
|
+
export interface RichTreeViewLoadingSlotOwnerState {
|
|
45
|
+
/**
|
|
46
|
+
* The id of the item whose children are loading.
|
|
47
|
+
* `null` while the whole tree is loading.
|
|
48
|
+
*/
|
|
49
|
+
itemId: TreeViewItemId | null;
|
|
50
|
+
}
|
|
51
|
+
export interface RichTreeViewLoadingSlotProps<TOwnerState extends object> {
|
|
52
|
+
root?: SlotComponentProps<'ul', {}, TOwnerState>;
|
|
53
|
+
loading?: SlotComponentProps<'div', RichTreeViewLoadingSlotOwnProps, RichTreeViewLoadingSlotOwnerState>;
|
|
54
|
+
itemLoader?: SlotComponentProps<'li', {}, TreeItemLoaderOwnerState>;
|
|
55
|
+
}
|
|
56
|
+
export interface RichTreeViewLoadingClasses {
|
|
57
|
+
root?: string;
|
|
58
|
+
itemLoader?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface RichTreeViewLoadingProps<TStore extends TreeViewAnyStore, TOwnerState extends object> {
|
|
61
|
+
store: TreeViewStoreInContext<TStore>;
|
|
62
|
+
slots: RichTreeViewLoadingSlots;
|
|
63
|
+
slotProps?: RichTreeViewLoadingSlotProps<TOwnerState>;
|
|
64
|
+
ownerState: TOwnerState;
|
|
65
|
+
forwardedProps: React.HTMLAttributes<HTMLUListElement>;
|
|
66
|
+
rootRef: React.Ref<HTMLUListElement>;
|
|
67
|
+
classes: RichTreeViewLoadingClasses;
|
|
68
|
+
}
|
|
69
|
+
export interface RichTreeViewItemLoadersProps {
|
|
70
|
+
classes: Pick<RichTreeViewLoadingClasses, 'itemLoader'>;
|
|
71
|
+
slots: Pick<RichTreeViewLoadingSlots, 'itemLoader'>;
|
|
72
|
+
slotProps?: Pick<RichTreeViewLoadingSlotProps<object>, 'itemLoader'>;
|
|
73
|
+
itemsCount: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Renders the default loading rows without any wrapper.
|
|
77
|
+
* Used by `RichTreeViewLoading` for the whole-tree loading state and by
|
|
78
|
+
* `RichTreeViewItem` for the children of an item that lazily loads them.
|
|
79
|
+
* It must render inside a `TreeItemLoaderContext` provider.
|
|
80
|
+
*/
|
|
81
|
+
export declare function RichTreeViewItemLoaders(props: RichTreeViewItemLoadersProps): React.JSX.Element;
|
|
82
|
+
/**
|
|
83
|
+
* Provides the layout information the loading rows need to `TreeItemLoader`.
|
|
84
|
+
* Wraps both the default rows and a custom `loading` slot, so custom loading
|
|
85
|
+
* UIs composed with `TreeItemLoader` keep the correct depth and height.
|
|
86
|
+
*/
|
|
87
|
+
export declare function RichTreeViewLoadingContext<TStore extends TreeViewAnyStore>(props: {
|
|
88
|
+
store: TreeViewStoreInContext<TStore>;
|
|
89
|
+
itemDepth?: number;
|
|
90
|
+
children: React.ReactNode;
|
|
91
|
+
}): React.JSX.Element;
|
|
92
|
+
/**
|
|
93
|
+
* Renders the loading placeholder shared by `RichTreeView` and `RichTreeViewPro`.
|
|
94
|
+
* It reuses `useTreeViewRootProps` so the root element keeps the same `role="tree"`,
|
|
95
|
+
* `id`, `aria-multiselectable` and slot/className behavior as the non-loading tree.
|
|
96
|
+
*/
|
|
97
|
+
export declare function RichTreeViewLoading<TStore extends TreeViewAnyStore, TOwnerState extends object>(props: RichTreeViewLoadingProps<TStore, TOwnerState>): React.JSX.Element;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.MAX_LOADING_ITEMS_COUNT = exports.DEFAULT_LOADING_ITEMS_COUNT = void 0;
|
|
10
|
+
exports.RichTreeViewItemLoaders = RichTreeViewItemLoaders;
|
|
11
|
+
exports.RichTreeViewLoading = RichTreeViewLoading;
|
|
12
|
+
exports.RichTreeViewLoadingContext = RichTreeViewLoadingContext;
|
|
13
|
+
exports.getLoadingItemsCount = getLoadingItemsCount;
|
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
+
var React = _interopRequireWildcard(require("react"));
|
|
16
|
+
var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
|
17
|
+
var _store = require("@mui/x-internals/store");
|
|
18
|
+
var _warning = require("@mui/x-internals/warning");
|
|
19
|
+
var _TreeItemLoader = require("../../TreeItemLoader");
|
|
20
|
+
var _TreeItemLoaderContext = require("../../TreeItemLoader/TreeItemLoaderContext");
|
|
21
|
+
var _useTreeViewRootProps = require("../hooks/useTreeViewRootProps");
|
|
22
|
+
var _items = require("../plugins/items");
|
|
23
|
+
var _selection = require("../plugins/selection");
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
const DEFAULT_LOADING_ITEMS_COUNT = exports.DEFAULT_LOADING_ITEMS_COUNT = 5;
|
|
26
|
+
const MAX_LOADING_ITEMS_COUNT = exports.MAX_LOADING_ITEMS_COUNT = 100;
|
|
27
|
+
function getLoadingItemsCount(itemsCount) {
|
|
28
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
29
|
+
if (itemsCount != null && (!Number.isFinite(itemsCount) || itemsCount < 0)) {
|
|
30
|
+
(0, _warning.warnOnce)([`MUI X: The \`itemsCount\` value in \`slotProps.loading\` received an invalid value (${itemsCount}).`, 'It must be a non-negative finite number.']);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const rawCount = itemsCount ?? DEFAULT_LOADING_ITEMS_COUNT;
|
|
34
|
+
return Number.isFinite(rawCount) ? Math.max(1, Math.min(MAX_LOADING_ITEMS_COUNT, Math.floor(rawCount))) : DEFAULT_LOADING_ITEMS_COUNT;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The owner state of the `loading` slot.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
function RichTreeViewItemLoaderRow(props) {
|
|
42
|
+
const {
|
|
43
|
+
classes,
|
|
44
|
+
slots,
|
|
45
|
+
slotProps,
|
|
46
|
+
ownerState
|
|
47
|
+
} = props;
|
|
48
|
+
const ItemLoader = slots.itemLoader ?? _TreeItemLoader.TreeItemLoader;
|
|
49
|
+
const itemLoaderProps = (0, _useSlotProps.default)({
|
|
50
|
+
elementType: ItemLoader,
|
|
51
|
+
externalSlotProps: slotProps?.itemLoader,
|
|
52
|
+
className: classes.itemLoader,
|
|
53
|
+
additionalProps: {
|
|
54
|
+
role: 'treeitem',
|
|
55
|
+
'aria-disabled': true
|
|
56
|
+
},
|
|
57
|
+
ownerState
|
|
58
|
+
});
|
|
59
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ItemLoader, (0, _extends2.default)({}, itemLoaderProps));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Renders the default loading rows without any wrapper.
|
|
64
|
+
* Used by `RichTreeViewLoading` for the whole-tree loading state and by
|
|
65
|
+
* `RichTreeViewItem` for the children of an item that lazily loads them.
|
|
66
|
+
* It must render inside a `TreeItemLoaderContext` provider.
|
|
67
|
+
*/
|
|
68
|
+
function RichTreeViewItemLoaders(props) {
|
|
69
|
+
const {
|
|
70
|
+
classes,
|
|
71
|
+
slots,
|
|
72
|
+
slotProps,
|
|
73
|
+
itemsCount
|
|
74
|
+
} = props;
|
|
75
|
+
const {
|
|
76
|
+
itemDepth,
|
|
77
|
+
isCheckboxSelectionEnabled
|
|
78
|
+
} = React.useContext(_TreeItemLoaderContext.TreeItemLoaderContext);
|
|
79
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
80
|
+
children: Array.from({
|
|
81
|
+
length: itemsCount
|
|
82
|
+
}, (_, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(RichTreeViewItemLoaderRow, {
|
|
83
|
+
classes: classes,
|
|
84
|
+
slots: slots,
|
|
85
|
+
slotProps: slotProps,
|
|
86
|
+
ownerState: {
|
|
87
|
+
index,
|
|
88
|
+
itemsCount,
|
|
89
|
+
itemDepth,
|
|
90
|
+
isCheckboxSelectionEnabled
|
|
91
|
+
}
|
|
92
|
+
}, index))
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Provides the layout information the loading rows need to `TreeItemLoader`.
|
|
98
|
+
* Wraps both the default rows and a custom `loading` slot, so custom loading
|
|
99
|
+
* UIs composed with `TreeItemLoader` keep the correct depth and height.
|
|
100
|
+
*/
|
|
101
|
+
function RichTreeViewLoadingContext(props) {
|
|
102
|
+
const {
|
|
103
|
+
store,
|
|
104
|
+
itemDepth = 0,
|
|
105
|
+
children
|
|
106
|
+
} = props;
|
|
107
|
+
const itemHeight = (0, _store.useStore)(store, _items.itemsSelectors.itemHeight);
|
|
108
|
+
const isCheckboxSelectionEnabled = (0, _store.useStore)(store, _selection.selectionSelectors.isCheckboxSelectionEnabled);
|
|
109
|
+
const contextValue = React.useMemo(() => ({
|
|
110
|
+
itemDepth,
|
|
111
|
+
itemHeight,
|
|
112
|
+
isCheckboxSelectionEnabled
|
|
113
|
+
}), [itemDepth, itemHeight, isCheckboxSelectionEnabled]);
|
|
114
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_TreeItemLoaderContext.TreeItemLoaderContext.Provider, {
|
|
115
|
+
value: contextValue,
|
|
116
|
+
children: children
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Renders the loading placeholder shared by `RichTreeView` and `RichTreeViewPro`.
|
|
122
|
+
* It reuses `useTreeViewRootProps` so the root element keeps the same `role="tree"`,
|
|
123
|
+
* `id`, `aria-multiselectable` and slot/className behavior as the non-loading tree.
|
|
124
|
+
*/
|
|
125
|
+
function RichTreeViewLoading(props) {
|
|
126
|
+
const {
|
|
127
|
+
store,
|
|
128
|
+
slots,
|
|
129
|
+
slotProps,
|
|
130
|
+
ownerState,
|
|
131
|
+
forwardedProps,
|
|
132
|
+
rootRef,
|
|
133
|
+
classes
|
|
134
|
+
} = props;
|
|
135
|
+
const getRootProps = (0, _useTreeViewRootProps.useTreeViewRootProps)(store, forwardedProps, rootRef);
|
|
136
|
+
const Root = slots.root;
|
|
137
|
+
const Loading = slots.loading;
|
|
138
|
+
const loadingProps = (0, _useSlotProps.default)({
|
|
139
|
+
elementType: Loading ?? 'div',
|
|
140
|
+
externalSlotProps: slotProps?.loading,
|
|
141
|
+
ownerState: {
|
|
142
|
+
itemId: null
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
const itemsCount = getLoadingItemsCount(loadingProps.itemsCount);
|
|
146
|
+
const rootProps = (0, _useSlotProps.default)({
|
|
147
|
+
elementType: Root,
|
|
148
|
+
externalSlotProps: slotProps?.root,
|
|
149
|
+
className: classes.root,
|
|
150
|
+
getSlotProps: getRootProps,
|
|
151
|
+
additionalProps: (0, _extends2.default)({
|
|
152
|
+
'aria-busy': true
|
|
153
|
+
}, forwardedProps['aria-label'] == null && forwardedProps['aria-labelledby'] == null ? {
|
|
154
|
+
'aria-label': 'Loading'
|
|
155
|
+
} : {}),
|
|
156
|
+
ownerState
|
|
157
|
+
});
|
|
158
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Root, (0, _extends2.default)({}, rootProps, {
|
|
159
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(RichTreeViewLoadingContext, {
|
|
160
|
+
store: store,
|
|
161
|
+
children: Loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Loading, (0, _extends2.default)({}, loadingProps, {
|
|
162
|
+
itemsCount: itemsCount
|
|
163
|
+
})) : /*#__PURE__*/(0, _jsxRuntime.jsx)(RichTreeViewItemLoaders, {
|
|
164
|
+
classes: classes,
|
|
165
|
+
slots: slots,
|
|
166
|
+
slotProps: slotProps,
|
|
167
|
+
itemsCount: itemsCount
|
|
168
|
+
})
|
|
169
|
+
})
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
6
|
+
import { useStore } from '@mui/x-internals/store';
|
|
7
|
+
import { warnOnce } from '@mui/x-internals/warning';
|
|
8
|
+
import { TreeItemLoader } from "../../TreeItemLoader/index.mjs";
|
|
9
|
+
import { TreeItemLoaderContext } from "../../TreeItemLoader/TreeItemLoaderContext.mjs";
|
|
10
|
+
import { useTreeViewRootProps } from "../hooks/useTreeViewRootProps.mjs";
|
|
11
|
+
import { itemsSelectors } from "../plugins/items/index.mjs";
|
|
12
|
+
import { selectionSelectors } from "../plugins/selection/index.mjs";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
export const DEFAULT_LOADING_ITEMS_COUNT = 5;
|
|
15
|
+
export const MAX_LOADING_ITEMS_COUNT = 100;
|
|
16
|
+
export function getLoadingItemsCount(itemsCount) {
|
|
17
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
18
|
+
if (itemsCount != null && (!Number.isFinite(itemsCount) || itemsCount < 0)) {
|
|
19
|
+
warnOnce([`MUI X: The \`itemsCount\` value in \`slotProps.loading\` received an invalid value (${itemsCount}).`, 'It must be a non-negative finite number.']);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const rawCount = itemsCount ?? DEFAULT_LOADING_ITEMS_COUNT;
|
|
23
|
+
return Number.isFinite(rawCount) ? Math.max(1, Math.min(MAX_LOADING_ITEMS_COUNT, Math.floor(rawCount))) : DEFAULT_LOADING_ITEMS_COUNT;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The owner state of the `loading` slot.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
function RichTreeViewItemLoaderRow(props) {
|
|
31
|
+
const {
|
|
32
|
+
classes,
|
|
33
|
+
slots,
|
|
34
|
+
slotProps,
|
|
35
|
+
ownerState
|
|
36
|
+
} = props;
|
|
37
|
+
const ItemLoader = slots.itemLoader ?? TreeItemLoader;
|
|
38
|
+
const itemLoaderProps = useSlotProps({
|
|
39
|
+
elementType: ItemLoader,
|
|
40
|
+
externalSlotProps: slotProps?.itemLoader,
|
|
41
|
+
className: classes.itemLoader,
|
|
42
|
+
additionalProps: {
|
|
43
|
+
role: 'treeitem',
|
|
44
|
+
'aria-disabled': true
|
|
45
|
+
},
|
|
46
|
+
ownerState
|
|
47
|
+
});
|
|
48
|
+
return /*#__PURE__*/_jsx(ItemLoader, _extends({}, itemLoaderProps));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Renders the default loading rows without any wrapper.
|
|
53
|
+
* Used by `RichTreeViewLoading` for the whole-tree loading state and by
|
|
54
|
+
* `RichTreeViewItem` for the children of an item that lazily loads them.
|
|
55
|
+
* It must render inside a `TreeItemLoaderContext` provider.
|
|
56
|
+
*/
|
|
57
|
+
export function RichTreeViewItemLoaders(props) {
|
|
58
|
+
const {
|
|
59
|
+
classes,
|
|
60
|
+
slots,
|
|
61
|
+
slotProps,
|
|
62
|
+
itemsCount
|
|
63
|
+
} = props;
|
|
64
|
+
const {
|
|
65
|
+
itemDepth,
|
|
66
|
+
isCheckboxSelectionEnabled
|
|
67
|
+
} = React.useContext(TreeItemLoaderContext);
|
|
68
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
69
|
+
children: Array.from({
|
|
70
|
+
length: itemsCount
|
|
71
|
+
}, (_, index) => /*#__PURE__*/_jsx(RichTreeViewItemLoaderRow, {
|
|
72
|
+
classes: classes,
|
|
73
|
+
slots: slots,
|
|
74
|
+
slotProps: slotProps,
|
|
75
|
+
ownerState: {
|
|
76
|
+
index,
|
|
77
|
+
itemsCount,
|
|
78
|
+
itemDepth,
|
|
79
|
+
isCheckboxSelectionEnabled
|
|
80
|
+
}
|
|
81
|
+
}, index))
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Provides the layout information the loading rows need to `TreeItemLoader`.
|
|
87
|
+
* Wraps both the default rows and a custom `loading` slot, so custom loading
|
|
88
|
+
* UIs composed with `TreeItemLoader` keep the correct depth and height.
|
|
89
|
+
*/
|
|
90
|
+
export function RichTreeViewLoadingContext(props) {
|
|
91
|
+
const {
|
|
92
|
+
store,
|
|
93
|
+
itemDepth = 0,
|
|
94
|
+
children
|
|
95
|
+
} = props;
|
|
96
|
+
const itemHeight = useStore(store, itemsSelectors.itemHeight);
|
|
97
|
+
const isCheckboxSelectionEnabled = useStore(store, selectionSelectors.isCheckboxSelectionEnabled);
|
|
98
|
+
const contextValue = React.useMemo(() => ({
|
|
99
|
+
itemDepth,
|
|
100
|
+
itemHeight,
|
|
101
|
+
isCheckboxSelectionEnabled
|
|
102
|
+
}), [itemDepth, itemHeight, isCheckboxSelectionEnabled]);
|
|
103
|
+
return /*#__PURE__*/_jsx(TreeItemLoaderContext.Provider, {
|
|
104
|
+
value: contextValue,
|
|
105
|
+
children: children
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Renders the loading placeholder shared by `RichTreeView` and `RichTreeViewPro`.
|
|
111
|
+
* It reuses `useTreeViewRootProps` so the root element keeps the same `role="tree"`,
|
|
112
|
+
* `id`, `aria-multiselectable` and slot/className behavior as the non-loading tree.
|
|
113
|
+
*/
|
|
114
|
+
export function RichTreeViewLoading(props) {
|
|
115
|
+
const {
|
|
116
|
+
store,
|
|
117
|
+
slots,
|
|
118
|
+
slotProps,
|
|
119
|
+
ownerState,
|
|
120
|
+
forwardedProps,
|
|
121
|
+
rootRef,
|
|
122
|
+
classes
|
|
123
|
+
} = props;
|
|
124
|
+
const getRootProps = useTreeViewRootProps(store, forwardedProps, rootRef);
|
|
125
|
+
const Root = slots.root;
|
|
126
|
+
const Loading = slots.loading;
|
|
127
|
+
const loadingProps = useSlotProps({
|
|
128
|
+
elementType: Loading ?? 'div',
|
|
129
|
+
externalSlotProps: slotProps?.loading,
|
|
130
|
+
ownerState: {
|
|
131
|
+
itemId: null
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
const itemsCount = getLoadingItemsCount(loadingProps.itemsCount);
|
|
135
|
+
const rootProps = useSlotProps({
|
|
136
|
+
elementType: Root,
|
|
137
|
+
externalSlotProps: slotProps?.root,
|
|
138
|
+
className: classes.root,
|
|
139
|
+
getSlotProps: getRootProps,
|
|
140
|
+
additionalProps: _extends({
|
|
141
|
+
'aria-busy': true
|
|
142
|
+
}, forwardedProps['aria-label'] == null && forwardedProps['aria-labelledby'] == null ? {
|
|
143
|
+
'aria-label': 'Loading'
|
|
144
|
+
} : {}),
|
|
145
|
+
ownerState
|
|
146
|
+
});
|
|
147
|
+
return /*#__PURE__*/_jsx(Root, _extends({}, rootProps, {
|
|
148
|
+
children: /*#__PURE__*/_jsx(RichTreeViewLoadingContext, {
|
|
149
|
+
store: store,
|
|
150
|
+
children: Loading ? /*#__PURE__*/_jsx(Loading, _extends({}, loadingProps, {
|
|
151
|
+
itemsCount: itemsCount
|
|
152
|
+
})) : /*#__PURE__*/_jsx(RichTreeViewItemLoaders, {
|
|
153
|
+
classes: classes,
|
|
154
|
+
slots: slots,
|
|
155
|
+
slotProps: slotProps,
|
|
156
|
+
itemsCount: itemsCount
|
|
157
|
+
})
|
|
158
|
+
})
|
|
159
|
+
}));
|
|
160
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Width of the icon container rendered at the start of each tree item content, in px.
|
|
3
|
+
* The item loader rows render a gutter with the same width to keep the label placeholders
|
|
4
|
+
* aligned with the tree item labels.
|
|
5
|
+
*/
|
|
6
|
+
export declare const TREE_ITEM_ICON_CONTAINER_WIDTH_PX = 16;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Width of the icon container rendered at the start of each tree item content, in px.
|
|
3
|
+
* The item loader rows render a gutter with the same width to keep the label placeholders
|
|
4
|
+
* aligned with the tree item labels.
|
|
5
|
+
*/
|
|
6
|
+
export declare const TREE_ITEM_ICON_CONTAINER_WIDTH_PX = 16;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TREE_ITEM_ICON_CONTAINER_WIDTH_PX = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Width of the icon container rendered at the start of each tree item content, in px.
|
|
9
|
+
* The item loader rows render a gutter with the same width to keep the label placeholders
|
|
10
|
+
* aligned with the tree item labels.
|
|
11
|
+
*/
|
|
12
|
+
const TREE_ITEM_ICON_CONTAINER_WIDTH_PX = exports.TREE_ITEM_ICON_CONTAINER_WIDTH_PX = 16;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Width of the icon container rendered at the start of each tree item content, in px.
|
|
3
|
+
* The item loader rows render a gutter with the same width to keep the label placeholders
|
|
4
|
+
* aligned with the tree item labels.
|
|
5
|
+
*/
|
|
6
|
+
export const TREE_ITEM_ICON_CONTAINER_WIDTH_PX = 16;
|
|
@@ -2,7 +2,7 @@ import type { TreeViewAnyStore } from "../models/index.mjs";
|
|
|
2
2
|
interface ValidTreeViewStoreConstructor<TStore extends TreeViewAnyStore> {
|
|
3
3
|
new (parameters: TStore['parameters']): TStore;
|
|
4
4
|
}
|
|
5
|
-
export type UseTreeViewStoreParameters<TStore extends TreeViewAnyStore> = Omit<Parameters<TStore['updateStateFromParameters']>[0], 'isRtl'>;
|
|
5
|
+
export type UseTreeViewStoreParameters<TStore extends TreeViewAnyStore> = Omit<Parameters<TStore['updateStateFromParameters']>[0], 'isRtl' | 'defaultId'>;
|
|
6
6
|
/**
|
|
7
7
|
* Creates a Tree View store and keep it in sync with the provided parameters.
|
|
8
8
|
*/
|
|
@@ -2,7 +2,7 @@ import type { TreeViewAnyStore } from "../models/index.js";
|
|
|
2
2
|
interface ValidTreeViewStoreConstructor<TStore extends TreeViewAnyStore> {
|
|
3
3
|
new (parameters: TStore['parameters']): TStore;
|
|
4
4
|
}
|
|
5
|
-
export type UseTreeViewStoreParameters<TStore extends TreeViewAnyStore> = Omit<Parameters<TStore['updateStateFromParameters']>[0], 'isRtl'>;
|
|
5
|
+
export type UseTreeViewStoreParameters<TStore extends TreeViewAnyStore> = Omit<Parameters<TStore['updateStateFromParameters']>[0], 'isRtl' | 'defaultId'>;
|
|
6
6
|
/**
|
|
7
7
|
* Creates a Tree View store and keep it in sync with the provided parameters.
|
|
8
8
|
*/
|