@mui/x-tree-view 8.11.0 → 8.11.2
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 +169 -0
- package/RichTreeView/RichTreeView.js +16 -15
- package/RichTreeView/RichTreeView.types.d.ts +3 -2
- package/SimpleTreeView/SimpleTreeView.js +10 -9
- package/SimpleTreeView/SimpleTreeView.types.d.ts +3 -2
- package/TreeItem/TreeItem.d.ts +1 -1
- package/TreeItemProvider/TreeItemProvider.js +3 -3
- package/esm/RichTreeView/RichTreeView.js +16 -15
- package/esm/RichTreeView/RichTreeView.types.d.ts +3 -2
- package/esm/SimpleTreeView/SimpleTreeView.js +10 -9
- package/esm/SimpleTreeView/SimpleTreeView.types.d.ts +3 -2
- package/esm/TreeItem/TreeItem.d.ts +1 -1
- package/esm/TreeItemProvider/TreeItemProvider.js +3 -3
- package/esm/hooks/index.d.ts +2 -1
- package/esm/hooks/index.js +2 -1
- package/esm/hooks/useApplyPropagationToSelectedItemsOnMount.d.ts +53 -0
- package/esm/hooks/useApplyPropagationToSelectedItemsOnMount.js +80 -0
- package/esm/hooks/useTreeItemModel.js +3 -3
- package/esm/hooks/useTreeItemUtils/useTreeItemUtils.js +24 -25
- package/esm/index.js +1 -1
- package/esm/internals/TreeViewProvider/TreeViewChildrenItemProvider.js +2 -2
- package/esm/internals/TreeViewProvider/TreeViewProvider.types.d.ts +3 -3
- package/esm/internals/components/RichTreeViewItems.js +5 -5
- package/esm/internals/corePlugins/useTreeViewId/index.d.ts +2 -1
- package/esm/internals/corePlugins/useTreeViewId/index.js +2 -1
- package/esm/internals/corePlugins/useTreeViewId/useTreeViewId.js +10 -13
- package/esm/internals/corePlugins/useTreeViewId/useTreeViewId.selectors.d.ts +8 -34
- package/esm/internals/corePlugins/useTreeViewId/useTreeViewId.selectors.js +9 -9
- package/esm/internals/index.d.ts +6 -14
- package/esm/internals/index.js +6 -13
- package/esm/internals/models/plugin.d.ts +2 -3
- package/esm/internals/models/treeView.d.ts +4 -6
- package/esm/internals/plugins/useTreeViewExpansion/index.d.ts +2 -1
- package/esm/internals/plugins/useTreeViewExpansion/index.js +2 -1
- package/esm/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.js +26 -30
- package/esm/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.selectors.d.ts +24 -316
- package/esm/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.selectors.js +27 -38
- package/esm/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.types.d.ts +7 -1
- package/esm/internals/plugins/useTreeViewFocus/index.d.ts +2 -1
- package/esm/internals/plugins/useTreeViewFocus/index.js +2 -1
- package/esm/internals/plugins/useTreeViewFocus/useTreeViewFocus.js +17 -21
- package/esm/internals/plugins/useTreeViewFocus/useTreeViewFocus.selectors.d.ts +20 -628
- package/esm/internals/plugins/useTreeViewFocus/useTreeViewFocus.selectors.js +25 -37
- package/esm/internals/plugins/useTreeViewItems/index.d.ts +2 -1
- package/esm/internals/plugins/useTreeViewItems/index.js +2 -1
- package/esm/internals/plugins/useTreeViewItems/useTreeViewItems.js +82 -102
- package/esm/internals/plugins/useTreeViewItems/useTreeViewItems.selectors.d.ts +52 -1142
- package/esm/internals/plugins/useTreeViewItems/useTreeViewItems.selectors.js +58 -98
- package/esm/internals/plugins/useTreeViewItems/useTreeViewItems.utils.d.ts +1 -1
- package/esm/internals/plugins/useTreeViewItems/useTreeViewItems.utils.js +1 -1
- package/esm/internals/plugins/useTreeViewJSXItems/useTreeViewJSXItems.js +32 -42
- package/esm/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.js +22 -22
- package/esm/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.types.d.ts +2 -0
- package/esm/internals/plugins/useTreeViewLabel/index.d.ts +2 -1
- package/esm/internals/plugins/useTreeViewLabel/index.js +2 -1
- package/esm/internals/plugins/useTreeViewLabel/useTreeViewLabel.itemPlugin.js +4 -4
- package/esm/internals/plugins/useTreeViewLabel/useTreeViewLabel.js +17 -25
- package/esm/internals/plugins/useTreeViewLabel/useTreeViewLabel.selectors.d.ts +14 -100
- package/esm/internals/plugins/useTreeViewLabel/useTreeViewLabel.selectors.js +24 -34
- package/esm/internals/plugins/useTreeViewLazyLoading/index.d.ts +2 -1
- package/esm/internals/plugins/useTreeViewLazyLoading/index.js +1 -1
- package/esm/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.selectors.d.ts +18 -245
- package/esm/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.selectors.js +15 -27
- package/esm/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.types.d.ts +20 -6
- package/esm/internals/plugins/useTreeViewSelection/index.d.ts +2 -1
- package/esm/internals/plugins/useTreeViewSelection/index.js +2 -1
- package/esm/internals/plugins/useTreeViewSelection/useTreeViewSelection.itemPlugin.js +25 -38
- package/esm/internals/plugins/useTreeViewSelection/useTreeViewSelection.js +30 -34
- package/esm/internals/plugins/useTreeViewSelection/useTreeViewSelection.selectors.d.ts +38 -517
- package/esm/internals/plugins/useTreeViewSelection/useTreeViewSelection.selectors.js +46 -71
- package/esm/internals/plugins/useTreeViewSelection/useTreeViewSelection.types.d.ts +1 -0
- package/esm/internals/plugins/useTreeViewSelection/useTreeViewSelection.utils.js +10 -10
- package/esm/internals/useTreeView/useTreeView.d.ts +1 -1
- package/esm/internals/useTreeView/useTreeView.js +11 -18
- package/esm/internals/useTreeView/useTreeView.types.d.ts +1 -1
- package/esm/internals/useTreeView/useTreeViewBuildContext.d.ts +2 -3
- package/esm/internals/utils/tree.js +33 -33
- package/esm/useTreeItem/useTreeItem.js +14 -14
- package/esm/useTreeItem/useTreeItem.types.d.ts +2 -1
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +8 -1
- package/hooks/useApplyPropagationToSelectedItemsOnMount.d.ts +53 -0
- package/hooks/useApplyPropagationToSelectedItemsOnMount.js +87 -0
- package/hooks/useTreeItemModel.js +3 -3
- package/hooks/useTreeItemUtils/useTreeItemUtils.js +18 -19
- package/index.js +1 -1
- package/internals/TreeViewProvider/TreeViewChildrenItemProvider.js +1 -1
- package/internals/TreeViewProvider/TreeViewProvider.types.d.ts +3 -3
- package/internals/components/RichTreeViewItems.js +5 -5
- package/internals/corePlugins/useTreeViewId/index.d.ts +2 -1
- package/internals/corePlugins/useTreeViewId/index.js +8 -1
- package/internals/corePlugins/useTreeViewId/useTreeViewId.js +9 -12
- package/internals/corePlugins/useTreeViewId/useTreeViewId.selectors.d.ts +8 -34
- package/internals/corePlugins/useTreeViewId/useTreeViewId.selectors.js +10 -10
- package/internals/index.d.ts +6 -14
- package/internals/index.js +12 -73
- package/internals/models/plugin.d.ts +2 -3
- package/internals/models/treeView.d.ts +4 -6
- package/internals/plugins/useTreeViewExpansion/index.d.ts +2 -1
- package/internals/plugins/useTreeViewExpansion/index.js +8 -1
- package/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.js +24 -28
- package/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.selectors.d.ts +24 -316
- package/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.selectors.js +27 -38
- package/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.types.d.ts +7 -1
- package/internals/plugins/useTreeViewFocus/index.d.ts +2 -1
- package/internals/plugins/useTreeViewFocus/index.js +8 -1
- package/internals/plugins/useTreeViewFocus/useTreeViewFocus.js +14 -18
- package/internals/plugins/useTreeViewFocus/useTreeViewFocus.selectors.d.ts +20 -628
- package/internals/plugins/useTreeViewFocus/useTreeViewFocus.selectors.js +23 -35
- package/internals/plugins/useTreeViewItems/index.d.ts +2 -1
- package/internals/plugins/useTreeViewItems/index.js +8 -1
- package/internals/plugins/useTreeViewItems/useTreeViewItems.js +81 -101
- package/internals/plugins/useTreeViewItems/useTreeViewItems.selectors.d.ts +52 -1142
- package/internals/plugins/useTreeViewItems/useTreeViewItems.selectors.js +59 -99
- package/internals/plugins/useTreeViewItems/useTreeViewItems.utils.d.ts +1 -1
- package/internals/plugins/useTreeViewItems/useTreeViewItems.utils.js +1 -1
- package/internals/plugins/useTreeViewJSXItems/useTreeViewJSXItems.js +32 -42
- package/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.js +18 -18
- package/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.types.d.ts +2 -0
- package/internals/plugins/useTreeViewLabel/index.d.ts +2 -1
- package/internals/plugins/useTreeViewLabel/index.js +8 -1
- package/internals/plugins/useTreeViewLabel/useTreeViewLabel.itemPlugin.js +3 -3
- package/internals/plugins/useTreeViewLabel/useTreeViewLabel.js +16 -24
- package/internals/plugins/useTreeViewLabel/useTreeViewLabel.selectors.d.ts +14 -100
- package/internals/plugins/useTreeViewLabel/useTreeViewLabel.selectors.js +24 -34
- package/internals/plugins/useTreeViewLazyLoading/index.d.ts +2 -1
- package/internals/plugins/useTreeViewLazyLoading/index.js +8 -1
- package/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.selectors.d.ts +18 -245
- package/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.selectors.js +16 -28
- package/internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.types.d.ts +20 -6
- package/internals/plugins/useTreeViewSelection/index.d.ts +2 -1
- package/internals/plugins/useTreeViewSelection/index.js +8 -1
- package/internals/plugins/useTreeViewSelection/useTreeViewSelection.itemPlugin.js +23 -37
- package/internals/plugins/useTreeViewSelection/useTreeViewSelection.js +29 -33
- package/internals/plugins/useTreeViewSelection/useTreeViewSelection.selectors.d.ts +38 -517
- package/internals/plugins/useTreeViewSelection/useTreeViewSelection.selectors.js +46 -71
- package/internals/plugins/useTreeViewSelection/useTreeViewSelection.types.d.ts +1 -0
- package/internals/plugins/useTreeViewSelection/useTreeViewSelection.utils.js +8 -8
- package/internals/useTreeView/useTreeView.d.ts +1 -1
- package/internals/useTreeView/useTreeView.js +11 -18
- package/internals/useTreeView/useTreeView.types.d.ts +1 -1
- package/internals/useTreeView/useTreeViewBuildContext.d.ts +2 -3
- package/internals/utils/tree.js +31 -31
- package/package.json +13 -14
- package/useTreeItem/useTreeItem.js +14 -14
- package/useTreeItem/useTreeItem.types.d.ts +2 -1
- package/esm/internals/hooks/useSelector.d.ts +0 -4
- package/esm/internals/hooks/useSelector.js +0 -8
- package/esm/internals/utils/TreeViewStore.d.ts +0 -12
- package/esm/internals/utils/TreeViewStore.js +0 -22
- package/esm/internals/utils/selectors.d.ts +0 -21
- package/esm/internals/utils/selectors.js +0 -51
- package/internals/hooks/useSelector.d.ts +0 -4
- package/internals/hooks/useSelector.js +0 -16
- package/internals/utils/TreeViewStore.d.ts +0 -12
- package/internals/utils/TreeViewStore.js +0 -29
- package/internals/utils/selectors.d.ts +0 -21
- package/internals/utils/selectors.js +0 -58
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import useLazyRef from '@mui/utils/useLazyRef';
|
|
2
|
+
import { getLookupFromArray } from "../internals/plugins/useTreeViewSelection/useTreeViewSelection.utils.js";
|
|
3
|
+
const defaultGetItemId = item => item.id;
|
|
4
|
+
const defaultGetItemChildren = item => item.children;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Applies the selection propagation rules to the selected items.
|
|
8
|
+
* The value is only computed during the first render, any update of the parameters will be ignored.
|
|
9
|
+
*
|
|
10
|
+
* Uncontrolled example:
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const defaultSelectedItems = useApplyPropagationToSelectedItemsOnMount({
|
|
13
|
+
* items: props.items,
|
|
14
|
+
* selectionPropagation: props.selectionPropagation,
|
|
15
|
+
* selectedItems: ['10', '11', '13', '14'],
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* return (
|
|
19
|
+
* <RichTreeView
|
|
20
|
+
* items={props.items}
|
|
21
|
+
* selectionPropagation={props.selectionPropagation}
|
|
22
|
+
* defaultSelectedItems={defaultSelectedItems}
|
|
23
|
+
* />
|
|
24
|
+
* );
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* Controlled example:
|
|
28
|
+
* ```tsx
|
|
29
|
+
* const initialSelectedItems = useApplyPropagationToSelectedItemsOnMount({
|
|
30
|
+
* items: props.items,
|
|
31
|
+
* selectionPropagation: props.selectionPropagation,
|
|
32
|
+
* selectedItems: ['10', '11', '13', '14'],
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* const [selectedItems, setSelectedItems] = React.useState(initialSelectedItems);
|
|
36
|
+
*
|
|
37
|
+
* return (
|
|
38
|
+
* <RichTreeView
|
|
39
|
+
* items={props.items}
|
|
40
|
+
* selectionPropagation={props.selectionPropagation}
|
|
41
|
+
* selectedItems={selectedItems}
|
|
42
|
+
* onSelectedItemsChange={setSelectedItems}
|
|
43
|
+
* />
|
|
44
|
+
* );
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export function useApplyPropagationToSelectedItemsOnMount(parameters) {
|
|
48
|
+
const {
|
|
49
|
+
items: itemsParam,
|
|
50
|
+
getItemId = defaultGetItemId,
|
|
51
|
+
getItemChildren = defaultGetItemChildren,
|
|
52
|
+
selectedItems,
|
|
53
|
+
selectionPropagation
|
|
54
|
+
} = parameters;
|
|
55
|
+
return useLazyRef(() => {
|
|
56
|
+
const lookup = getLookupFromArray(selectedItems);
|
|
57
|
+
function walk(items, isParentSelected) {
|
|
58
|
+
for (const item of items) {
|
|
59
|
+
const itemId = getItemId(item);
|
|
60
|
+
let isSelected = lookup[itemId];
|
|
61
|
+
if (!isSelected && selectionPropagation.descendants && isParentSelected) {
|
|
62
|
+
lookup[itemId] = true;
|
|
63
|
+
isSelected = true;
|
|
64
|
+
}
|
|
65
|
+
const children = getItemChildren(item) ?? [];
|
|
66
|
+
if (children.length > 0) {
|
|
67
|
+
walk(children, isSelected);
|
|
68
|
+
if (!isSelected && selectionPropagation.parents) {
|
|
69
|
+
const areAllChildrenSelected = children.every(childId => lookup[getItemId(childId)]);
|
|
70
|
+
if (areAllChildrenSelected) {
|
|
71
|
+
lookup[itemId] = true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
walk(itemsParam, false);
|
|
78
|
+
return Object.keys(lookup);
|
|
79
|
+
}).current;
|
|
80
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { useStore } from '@mui/x-internals/store';
|
|
3
4
|
import { useTreeViewContext } from "../internals/TreeViewProvider/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import { selectorItemModel } from "../internals/plugins/useTreeViewItems/useTreeViewItems.selectors.js";
|
|
5
|
+
import { itemsSelectors } from "../internals/plugins/useTreeViewItems/index.js";
|
|
6
6
|
export const useTreeItemModel = itemId => {
|
|
7
7
|
const {
|
|
8
8
|
store
|
|
9
9
|
} = useTreeViewContext();
|
|
10
|
-
return
|
|
10
|
+
return useStore(store, itemsSelectors.itemModel, itemId);
|
|
11
11
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { useStore } from '@mui/x-internals/store';
|
|
3
4
|
import { useTreeViewContext } from "../../internals/TreeViewProvider/index.js";
|
|
4
5
|
import { useTreeViewLabel } from "../../internals/plugins/useTreeViewLabel/index.js";
|
|
5
6
|
import { hasPlugin } from "../../internals/utils/plugins.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { selectorIsItemBeingEdited, selectorIsItemEditable } from "../../internals/plugins/useTreeViewLabel/useTreeViewLabel.selectors.js";
|
|
7
|
+
import { expansionSelectors } from "../../internals/plugins/useTreeViewExpansion/useTreeViewExpansion.selectors.js";
|
|
8
|
+
import { focusSelectors } from "../../internals/plugins/useTreeViewFocus/useTreeViewFocus.selectors.js";
|
|
9
|
+
import { itemsSelectors } from "../../internals/plugins/useTreeViewItems/useTreeViewItems.selectors.js";
|
|
10
|
+
import { selectionSelectors } from "../../internals/plugins/useTreeViewSelection/useTreeViewSelection.selectors.js";
|
|
11
|
+
import { lazyLoadingSelectors } from "../../internals/plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.selectors.js";
|
|
12
|
+
import { labelSelectors } from "../../internals/plugins/useTreeViewLabel/useTreeViewLabel.selectors.js";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Plugins that need to be present in the Tree View in order for `useTreeItemUtils` to work correctly.
|
|
@@ -34,18 +34,16 @@ export const useTreeItemUtils = ({
|
|
|
34
34
|
store,
|
|
35
35
|
publicAPI
|
|
36
36
|
} = useTreeViewContext();
|
|
37
|
-
const isItemExpandable =
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const loading = useSelector(store, state => isLazyLoadingEnabled ? selectorIsItemLoading(state, itemId) : false);
|
|
41
|
-
const error = useSelector(store, state => isLazyLoadingEnabled ? Boolean(selectorGetTreeItemError(state, itemId)) : false);
|
|
37
|
+
const isItemExpandable = useStore(store, expansionSelectors.isItemExpandable, itemId);
|
|
38
|
+
const isLoading = useStore(store, lazyLoadingSelectors.isItemLoading, itemId);
|
|
39
|
+
const hasError = useStore(store, lazyLoadingSelectors.itemHasError, itemId);
|
|
42
40
|
const isExpandable = itemHasChildren(children) || isItemExpandable;
|
|
43
|
-
const isExpanded =
|
|
44
|
-
const isFocused =
|
|
45
|
-
const isSelected =
|
|
46
|
-
const isDisabled =
|
|
47
|
-
const isEditing =
|
|
48
|
-
const isEditable =
|
|
41
|
+
const isExpanded = useStore(store, expansionSelectors.isItemExpanded, itemId);
|
|
42
|
+
const isFocused = useStore(store, focusSelectors.isItemFocused, itemId);
|
|
43
|
+
const isSelected = useStore(store, selectionSelectors.isItemSelected, itemId);
|
|
44
|
+
const isDisabled = useStore(store, itemsSelectors.isItemDisabled, itemId);
|
|
45
|
+
const isEditing = useStore(store, labelSelectors.isItemBeingEdited, itemId);
|
|
46
|
+
const isEditable = useStore(store, labelSelectors.isItemEditable, itemId);
|
|
49
47
|
const status = {
|
|
50
48
|
expandable: isExpandable,
|
|
51
49
|
expanded: isExpanded,
|
|
@@ -54,8 +52,8 @@ export const useTreeItemUtils = ({
|
|
|
54
52
|
disabled: isDisabled,
|
|
55
53
|
editing: isEditing,
|
|
56
54
|
editable: isEditable,
|
|
57
|
-
loading,
|
|
58
|
-
error
|
|
55
|
+
loading: isLoading,
|
|
56
|
+
error: hasError
|
|
59
57
|
};
|
|
60
58
|
const handleExpansion = event => {
|
|
61
59
|
if (status.disabled) {
|
|
@@ -64,10 +62,10 @@ export const useTreeItemUtils = ({
|
|
|
64
62
|
if (!status.focused) {
|
|
65
63
|
instance.focusItem(event, itemId);
|
|
66
64
|
}
|
|
67
|
-
const multiple = isMultiSelectEnabled && (event.shiftKey || event.ctrlKey || event.metaKey);
|
|
65
|
+
const multiple = selectionSelectors.isMultiSelectEnabled(store.state) && (event.shiftKey || event.ctrlKey || event.metaKey);
|
|
68
66
|
|
|
69
67
|
// If already expanded and trying to toggle selection don't close
|
|
70
|
-
if (status.expandable && !(multiple &&
|
|
68
|
+
if (status.expandable && !(multiple && expansionSelectors.isItemExpanded(store.state, itemId))) {
|
|
71
69
|
// make sure the children selection is propagated again
|
|
72
70
|
instance.setItemExpansion({
|
|
73
71
|
event,
|
|
@@ -82,7 +80,7 @@ export const useTreeItemUtils = ({
|
|
|
82
80
|
if (!status.focused && !status.editing) {
|
|
83
81
|
instance.focusItem(event, itemId);
|
|
84
82
|
}
|
|
85
|
-
const multiple = isMultiSelectEnabled && (event.shiftKey || event.ctrlKey || event.metaKey);
|
|
83
|
+
const multiple = selectionSelectors.isMultiSelectEnabled(store.state) && (event.shiftKey || event.ctrlKey || event.metaKey);
|
|
86
84
|
if (multiple) {
|
|
87
85
|
if (event.shiftKey) {
|
|
88
86
|
instance.expandSelectionRange(event, itemId);
|
|
@@ -103,6 +101,7 @@ export const useTreeItemUtils = ({
|
|
|
103
101
|
};
|
|
104
102
|
const handleCheckboxSelection = event => {
|
|
105
103
|
const hasShift = event.nativeEvent.shiftKey;
|
|
104
|
+
const isMultiSelectEnabled = selectionSelectors.isMultiSelectEnabled(store.state);
|
|
106
105
|
if (isMultiSelectEnabled && hasShift) {
|
|
107
106
|
instance.expandSelectionRange(event, itemId);
|
|
108
107
|
} else {
|
|
@@ -132,7 +131,7 @@ export const useTreeItemUtils = ({
|
|
|
132
131
|
// As a side effect of `instance.focusItem` called here and in `handleCancelItemLabelEditing` the `labelInput` is blurred
|
|
133
132
|
// The `onBlur` event is triggered, which calls `handleSaveItemLabel` again.
|
|
134
133
|
// To avoid creating an unwanted behavior we need to check if the item is being edited before calling `updateItemLabel`
|
|
135
|
-
if (
|
|
134
|
+
if (labelSelectors.isItemBeingEdited(store.state, itemId)) {
|
|
136
135
|
instance.updateItemLabel(itemId, newLabel);
|
|
137
136
|
toggleItemEditing();
|
|
138
137
|
instance.focusItem(event, itemId);
|
|
@@ -142,7 +141,7 @@ export const useTreeItemUtils = ({
|
|
|
142
141
|
if (!hasPlugin(instance, useTreeViewLabel)) {
|
|
143
142
|
return;
|
|
144
143
|
}
|
|
145
|
-
if (
|
|
144
|
+
if (labelSelectors.isItemBeingEdited(store.state, itemId)) {
|
|
146
145
|
toggleItemEditing();
|
|
147
146
|
instance.focusItem(event, itemId);
|
|
148
147
|
}
|
package/esm/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { useTreeViewContext } from "./TreeViewContext.js";
|
|
6
6
|
import { escapeOperandAttributeSelector } from "../utils/utils.js";
|
|
7
|
-
import {
|
|
7
|
+
import { itemsSelectors } from "../plugins/useTreeViewItems/useTreeViewItems.selectors.js";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
export const TreeViewChildrenItemContext = /*#__PURE__*/React.createContext(null);
|
|
10
10
|
if (process.env.NODE_ENV !== "production") TreeViewChildrenItemContext.displayName = "TreeViewChildrenItemContext";
|
|
@@ -24,7 +24,7 @@ export function TreeViewChildrenItemProvider(props) {
|
|
|
24
24
|
if (!rootRef.current) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
const previousChildrenIds =
|
|
27
|
+
const previousChildrenIds = itemsSelectors.itemOrderedChildrenIds(store.state, itemId ?? null) ?? [];
|
|
28
28
|
const escapedIdAttr = escapeOperandAttributeSelector(idAttribute ?? rootRef.current.id);
|
|
29
29
|
|
|
30
30
|
// If collapsed, skip childrenIds update prevents clearing the parent's indeterminate state after opening a sibling.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { TreeItemWrapper, TreeRootWrapper, TreeViewAnyPluginSignature, TreeViewInstance, TreeViewItemPluginResponse, TreeViewPublicAPI } from "../models/index.js";
|
|
3
|
-
import { TreeViewStore } from "../utils/TreeViewStore.js";
|
|
2
|
+
import { TreeItemWrapper, TreeRootWrapper, TreeViewAnyPluginSignature, TreeViewInstance, TreeViewItemPluginResponse, TreeViewPublicAPI, TreeViewReadonlyStore } from "../models/index.js";
|
|
4
3
|
import type { TreeItemProps } from "../../TreeItem/TreeItem.types.js";
|
|
5
4
|
import { TreeViewClasses, TreeViewSlotProps, TreeViewSlots } from "./TreeViewStyleContext.js";
|
|
5
|
+
import { TreeViewCorePluginSignatures } from "../corePlugins/index.js";
|
|
6
6
|
export type TreeViewItemPluginsRunner = (props: TreeItemProps) => Required<TreeViewItemPluginResponse>;
|
|
7
7
|
export interface TreeViewContextValue<TSignatures extends readonly TreeViewAnyPluginSignature[], TOptionalSignatures extends readonly TreeViewAnyPluginSignature[] = []> {
|
|
8
8
|
instance: TreeViewInstance<TSignatures, TOptionalSignatures>;
|
|
9
9
|
publicAPI: TreeViewPublicAPI<TSignatures, TOptionalSignatures>;
|
|
10
|
-
store:
|
|
10
|
+
store: TreeViewReadonlyStore<readonly [...TreeViewCorePluginSignatures, ...TSignatures]>;
|
|
11
11
|
rootRef: React.RefObject<HTMLUListElement | null>;
|
|
12
12
|
wrapItem: TreeItemWrapper<TSignatures>;
|
|
13
13
|
wrapRoot: TreeRootWrapper;
|
|
@@ -4,11 +4,11 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
5
|
const _excluded = ["ownerState"];
|
|
6
6
|
import * as React from 'react';
|
|
7
|
+
import { useStore } from '@mui/x-internals/store';
|
|
7
8
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
8
9
|
import { fastObjectShallowCompare } from '@mui/x-internals/fastObjectShallowCompare';
|
|
9
10
|
import { TreeItem } from "../../TreeItem/index.js";
|
|
10
|
-
import {
|
|
11
|
-
import { selectorItemMeta, selectorItemOrderedChildrenIds } from "../plugins/useTreeViewItems/useTreeViewItems.selectors.js";
|
|
11
|
+
import { itemsSelectors } from "../plugins/useTreeViewItems/index.js";
|
|
12
12
|
import { useTreeViewContext } from "../TreeViewProvider/index.js";
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
const RichTreeViewItemsContext = /*#__PURE__*/React.createContext(null);
|
|
@@ -22,8 +22,8 @@ const WrappedTreeItem = /*#__PURE__*/React.memo(function WrappedTreeItem({
|
|
|
22
22
|
const {
|
|
23
23
|
store
|
|
24
24
|
} = useTreeViewContext();
|
|
25
|
-
const itemMeta =
|
|
26
|
-
const children =
|
|
25
|
+
const itemMeta = useStore(store, itemsSelectors.itemMeta, itemId);
|
|
26
|
+
const children = useStore(store, itemsSelectors.itemOrderedChildrenIds, itemId);
|
|
27
27
|
const Item = itemSlot ?? TreeItem;
|
|
28
28
|
const _useSlotProps = useSlotProps({
|
|
29
29
|
elementType: Item,
|
|
@@ -54,7 +54,7 @@ export function RichTreeViewItems(props) {
|
|
|
54
54
|
} = useTreeViewContext();
|
|
55
55
|
const itemSlot = slots?.item;
|
|
56
56
|
const itemSlotProps = slotProps?.item;
|
|
57
|
-
const items =
|
|
57
|
+
const items = useStore(store, itemsSelectors.itemOrderedChildrenIds, null);
|
|
58
58
|
const renderItem = React.useCallback(itemId => {
|
|
59
59
|
return /*#__PURE__*/_jsx(WrappedTreeItem, {
|
|
60
60
|
itemSlot: itemSlot,
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { useTreeViewId } from "./useTreeViewId.js";
|
|
2
|
-
export type { UseTreeViewIdSignature, UseTreeViewIdParameters, UseTreeViewIdParametersWithDefaults } from "./useTreeViewId.types.js";
|
|
2
|
+
export type { UseTreeViewIdSignature, UseTreeViewIdParameters, UseTreeViewIdParametersWithDefaults } from "./useTreeViewId.types.js";
|
|
3
|
+
export { idSelectors } from "./useTreeViewId.selectors.js";
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { useTreeViewId } from "./useTreeViewId.js";
|
|
1
|
+
export { useTreeViewId } from "./useTreeViewId.js";
|
|
2
|
+
export { idSelectors } from "./useTreeViewId.selectors.js";
|
|
@@ -2,26 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useStore } from '@mui/x-internals/store';
|
|
6
|
+
import { idSelectors } from "./useTreeViewId.selectors.js";
|
|
7
7
|
import { createTreeViewDefaultId } from "./useTreeViewId.utils.js";
|
|
8
8
|
export const useTreeViewId = ({
|
|
9
9
|
params,
|
|
10
10
|
store
|
|
11
11
|
}) => {
|
|
12
12
|
React.useEffect(() => {
|
|
13
|
-
store.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
})
|
|
21
|
-
});
|
|
22
|
-
});
|
|
13
|
+
const prevIdState = store.state.id;
|
|
14
|
+
if (params.id === prevIdState.providedTreeId && prevIdState.treeId !== undefined) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
store.set('id', _extends({}, prevIdState, {
|
|
18
|
+
treeId: params.id ?? createTreeViewDefaultId()
|
|
19
|
+
}));
|
|
23
20
|
}, [store, params.id]);
|
|
24
|
-
const treeId =
|
|
21
|
+
const treeId = useStore(store, idSelectors.treeId);
|
|
25
22
|
return {
|
|
26
23
|
getRootProps: () => ({
|
|
27
24
|
id: treeId
|
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
import { TreeViewRootSelector } from "../../utils/selectors.js";
|
|
2
1
|
import { UseTreeViewIdSignature } from "./useTreeViewId.types.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
clearCache: () => void;
|
|
12
|
-
resultsCount: () => number;
|
|
13
|
-
resetResultsCount: () => void;
|
|
14
|
-
} & {
|
|
15
|
-
resultFunc: (resultFuncArgs_0: {
|
|
16
|
-
treeId: string | undefined;
|
|
17
|
-
providedTreeId: string | undefined;
|
|
18
|
-
}) => string | undefined;
|
|
19
|
-
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
20
|
-
treeId: string | undefined;
|
|
21
|
-
providedTreeId: string | undefined;
|
|
22
|
-
}) => string | undefined) & {
|
|
23
|
-
clearCache: () => void;
|
|
24
|
-
resultsCount: () => number;
|
|
25
|
-
resetResultsCount: () => void;
|
|
26
|
-
};
|
|
27
|
-
lastResult: () => string | undefined;
|
|
28
|
-
dependencies: [TreeViewRootSelector<UseTreeViewIdSignature>];
|
|
29
|
-
recomputations: () => number;
|
|
30
|
-
resetRecomputations: () => void;
|
|
31
|
-
dependencyRecomputations: () => number;
|
|
32
|
-
resetDependencyRecomputations: () => void;
|
|
33
|
-
} & {
|
|
34
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
35
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
2
|
+
import { TreeViewState } from "../../models/index.js";
|
|
3
|
+
export declare const idSelectors: {
|
|
4
|
+
/**
|
|
5
|
+
* Get the id attribute of the tree view.
|
|
6
|
+
* @param {TreeViewState<[UseTreeViewIdSignature]>} state The state of the tree view.
|
|
7
|
+
* @returns {string} The id attribute of the tree view.
|
|
8
|
+
*/
|
|
9
|
+
treeId: (state: TreeViewState<[UseTreeViewIdSignature]>) => string | undefined;
|
|
36
10
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createSelector } from
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { createSelector } from '@mui/x-internals/store';
|
|
2
|
+
export const idSelectors = {
|
|
3
|
+
/**
|
|
4
|
+
* Get the id attribute of the tree view.
|
|
5
|
+
* @param {TreeViewState<[UseTreeViewIdSignature]>} state The state of the tree view.
|
|
6
|
+
* @returns {string} The id attribute of the tree view.
|
|
7
|
+
*/
|
|
8
|
+
treeId: createSelector(state => state.id.treeId)
|
|
9
|
+
};
|
package/esm/internals/index.d.ts
CHANGED
|
@@ -3,31 +3,23 @@ export { TreeViewProvider, useTreeViewContext } from "./TreeViewProvider/index.j
|
|
|
3
3
|
export { RichTreeViewItems } from "./components/RichTreeViewItems.js";
|
|
4
4
|
export type { RichTreeViewItemsSlots, RichTreeViewItemsSlotProps } from "./components/RichTreeViewItems.js";
|
|
5
5
|
export { unstable_resetCleanupTracking, useInstanceEventHandler } from "./hooks/useInstanceEventHandler.js";
|
|
6
|
-
export { useSelector } from "./hooks/useSelector.js";
|
|
7
6
|
export type { TreeViewPlugin, TreeViewPluginSignature, ConvertPluginsIntoSignatures, MergeSignaturesProperty, TreeViewPublicAPI, TreeViewState, TreeViewItemMeta, TreeViewInstance, TreeViewItemPlugin, TreeViewUsedStore } from "./models/index.js";
|
|
8
7
|
export type { TreeViewCorePluginParameters } from "./corePlugins/index.js";
|
|
9
|
-
export { useTreeViewExpansion } from "./plugins/useTreeViewExpansion/index.js";
|
|
8
|
+
export { useTreeViewExpansion, expansionSelectors } from "./plugins/useTreeViewExpansion/index.js";
|
|
10
9
|
export type { UseTreeViewExpansionSignature, UseTreeViewExpansionParameters } from "./plugins/useTreeViewExpansion/index.js";
|
|
11
|
-
export { useTreeViewSelection } from "./plugins/useTreeViewSelection/index.js";
|
|
10
|
+
export { useTreeViewSelection, selectionSelectors } from "./plugins/useTreeViewSelection/index.js";
|
|
12
11
|
export type { UseTreeViewSelectionSignature, UseTreeViewSelectionParameters } from "./plugins/useTreeViewSelection/index.js";
|
|
13
12
|
export { useTreeViewFocus } from "./plugins/useTreeViewFocus/index.js";
|
|
14
13
|
export type { UseTreeViewFocusSignature, UseTreeViewFocusParameters } from "./plugins/useTreeViewFocus/index.js";
|
|
15
14
|
export { useTreeViewKeyboardNavigation } from "./plugins/useTreeViewKeyboardNavigation/index.js";
|
|
16
15
|
export type { UseTreeViewKeyboardNavigationSignature } from "./plugins/useTreeViewKeyboardNavigation/index.js";
|
|
17
|
-
export { useTreeViewItems, buildSiblingIndexes, TREE_VIEW_ROOT_PARENT_ID } from "./plugins/useTreeViewItems/index.js";
|
|
18
|
-
export { selectorItemMetaLookup, selectorItemMeta, selectorItemIndex, selectorItemOrderedChildrenIds } from "./plugins/useTreeViewItems/useTreeViewItems.selectors.js";
|
|
16
|
+
export { useTreeViewItems, buildSiblingIndexes, itemsSelectors, TREE_VIEW_ROOT_PARENT_ID } from "./plugins/useTreeViewItems/index.js";
|
|
19
17
|
export type { UseTreeViewItemsSignature, UseTreeViewItemsParameters, UseTreeViewItemsState } from "./plugins/useTreeViewItems/index.js";
|
|
20
|
-
export { useTreeViewLabel } from "./plugins/useTreeViewLabel/index.js";
|
|
21
|
-
export { selectorIsItemBeingEdited, selectorIsAnyItemBeingEdited } from "./plugins/useTreeViewLabel/useTreeViewLabel.selectors.js";
|
|
18
|
+
export { useTreeViewLabel, labelSelectors } from "./plugins/useTreeViewLabel/index.js";
|
|
22
19
|
export type { UseTreeViewLabelSignature, UseTreeViewLabelParameters } from "./plugins/useTreeViewLabel/index.js";
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
export { selectorDataSourceState, selectorGetTreeItemError } from "./plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.selectors.js";
|
|
26
|
-
export type { UseTreeViewLazyLoadingSignature } from "./plugins/useTreeViewLazyLoading/index.js";
|
|
27
|
-
export type { UseTreeViewLazyLoadingParameters } from "./plugins/useTreeViewLazyLoading/index.js";
|
|
20
|
+
export type { UseTreeViewLazyLoadingSignature, UseTreeViewLazyLoadingParameters, UseTreeViewLazyLoadingInstance } from "./plugins/useTreeViewLazyLoading/index.js";
|
|
21
|
+
export { lazyLoadingSelectors } from "./plugins/useTreeViewLazyLoading/index.js";
|
|
28
22
|
export { useTreeViewJSXItems } from "./plugins/useTreeViewJSXItems/index.js";
|
|
29
23
|
export type { UseTreeViewJSXItemsSignature, UseTreeViewJSXItemsParameters } from "./plugins/useTreeViewJSXItems/index.js";
|
|
30
|
-
export { createSelector } from "./utils/selectors.js";
|
|
31
24
|
export { isTargetInDescendants } from "./utils/tree.js";
|
|
32
|
-
export { TreeViewStore } from "./utils/TreeViewStore.js";
|
|
33
25
|
export type { TreeViewClasses, TreeViewSlots, TreeViewSlotProps } from "./TreeViewProvider/TreeViewStyleContext.js";
|
package/esm/internals/index.js
CHANGED
|
@@ -2,23 +2,16 @@ export { useTreeView } from "./useTreeView/index.js";
|
|
|
2
2
|
export { TreeViewProvider, useTreeViewContext } from "./TreeViewProvider/index.js";
|
|
3
3
|
export { RichTreeViewItems } from "./components/RichTreeViewItems.js";
|
|
4
4
|
export { unstable_resetCleanupTracking, useInstanceEventHandler } from "./hooks/useInstanceEventHandler.js";
|
|
5
|
-
export { useSelector } from "./hooks/useSelector.js";
|
|
6
5
|
|
|
7
6
|
// Core plugins
|
|
8
7
|
|
|
9
8
|
// Plugins
|
|
10
|
-
export { useTreeViewExpansion } from "./plugins/useTreeViewExpansion/index.js";
|
|
11
|
-
export { useTreeViewSelection } from "./plugins/useTreeViewSelection/index.js";
|
|
9
|
+
export { useTreeViewExpansion, expansionSelectors } from "./plugins/useTreeViewExpansion/index.js";
|
|
10
|
+
export { useTreeViewSelection, selectionSelectors } from "./plugins/useTreeViewSelection/index.js";
|
|
12
11
|
export { useTreeViewFocus } from "./plugins/useTreeViewFocus/index.js";
|
|
13
12
|
export { useTreeViewKeyboardNavigation } from "./plugins/useTreeViewKeyboardNavigation/index.js";
|
|
14
|
-
export { useTreeViewItems, buildSiblingIndexes, TREE_VIEW_ROOT_PARENT_ID } from "./plugins/useTreeViewItems/index.js";
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export { selectorIsItemBeingEdited, selectorIsAnyItemBeingEdited } from "./plugins/useTreeViewLabel/useTreeViewLabel.selectors.js";
|
|
18
|
-
export { selectorIsItemExpanded, selectorExpandedItems } from "./plugins/useTreeViewExpansion/useTreeViewExpansion.selectors.js";
|
|
19
|
-
export { selectorIsItemSelected } from "./plugins/useTreeViewSelection/useTreeViewSelection.selectors.js";
|
|
20
|
-
export { selectorDataSourceState, selectorGetTreeItemError } from "./plugins/useTreeViewLazyLoading/useTreeViewLazyLoading.selectors.js";
|
|
13
|
+
export { useTreeViewItems, buildSiblingIndexes, itemsSelectors, TREE_VIEW_ROOT_PARENT_ID } from "./plugins/useTreeViewItems/index.js";
|
|
14
|
+
export { useTreeViewLabel, labelSelectors } from "./plugins/useTreeViewLabel/index.js";
|
|
15
|
+
export { lazyLoadingSelectors } from "./plugins/useTreeViewLazyLoading/index.js";
|
|
21
16
|
export { useTreeViewJSXItems } from "./plugins/useTreeViewJSXItems/index.js";
|
|
22
|
-
export {
|
|
23
|
-
export { isTargetInDescendants } from "./utils/tree.js";
|
|
24
|
-
export { TreeViewStore } from "./utils/TreeViewStore.js";
|
|
17
|
+
export { isTargetInDescendants } from "./utils/tree.js";
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { EventHandlers } from '@mui/utils/types';
|
|
3
|
-
import { TreeViewInstance } from "./treeView.js";
|
|
3
|
+
import { TreeViewInstance, TreeViewStore } from "./treeView.js";
|
|
4
4
|
import type { MergeSignaturesProperty, OptionalIfEmpty } from "./helpers.js";
|
|
5
5
|
import { TreeViewEventLookupElement } from "./events.js";
|
|
6
6
|
import type { TreeViewCorePluginSignatures } from "../corePlugins/index.js";
|
|
7
7
|
import { TreeViewItemPlugin } from "./itemPlugin.js";
|
|
8
8
|
import { TreeViewItemId } from "../../models/index.js";
|
|
9
|
-
import { TreeViewStore } from "../utils/TreeViewStore.js";
|
|
10
9
|
export interface TreeViewPluginOptions<TSignature extends TreeViewAnyPluginSignature> {
|
|
11
10
|
/**
|
|
12
11
|
* An imperative API available for internal use. Used to access methods from other plugins.
|
|
@@ -109,7 +108,7 @@ export type TreeViewUsedInstance<TSignature extends TreeViewAnyPluginSignature>
|
|
|
109
108
|
*/
|
|
110
109
|
$$signature: TSignature;
|
|
111
110
|
};
|
|
112
|
-
export type TreeViewUsedStore<TSignature extends TreeViewAnyPluginSignature> = TreeViewStore<[TSignature, ...TSignature['dependencies']]>;
|
|
111
|
+
export type TreeViewUsedStore<TSignature extends TreeViewAnyPluginSignature> = TreeViewStore<[TSignature, ...TSignature['dependencies']], TSignature['optionalDependencies']>;
|
|
113
112
|
export type TreeViewUsedEvents<TSignature extends TreeViewAnyPluginSignature> = TSignature['events'] & MergeSignaturesProperty<TreeViewRequiredPlugins<TSignature>, 'events'>;
|
|
114
113
|
export type TreeItemWrapper<TSignatures extends readonly TreeViewAnyPluginSignature[]> = (params: {
|
|
115
114
|
itemId: TreeViewItemId;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReadonlyStore, Store } from '@mui/x-internals/store';
|
|
1
2
|
import type { TreeViewAnyPluginSignature } from "./plugin.js";
|
|
2
3
|
import type { MergeSignaturesProperty } from "./helpers.js";
|
|
3
4
|
import type { TreeViewCorePluginSignatures } from "../corePlugins/index.js";
|
|
@@ -18,9 +19,6 @@ export interface TreeViewItemMeta {
|
|
|
18
19
|
}
|
|
19
20
|
export type TreeViewInstance<TSignatures extends readonly TreeViewAnyPluginSignature[], TOptionalSignatures extends readonly TreeViewAnyPluginSignature[] = []> = MergeSignaturesProperty<[...TreeViewCorePluginSignatures, ...TSignatures], 'instance'> & Partial<MergeSignaturesProperty<TOptionalSignatures, 'instance'>>;
|
|
20
21
|
export type TreeViewPublicAPI<TSignatures extends readonly TreeViewAnyPluginSignature[], TOptionalSignatures extends readonly TreeViewAnyPluginSignature[] = []> = MergeSignaturesProperty<[...TreeViewCorePluginSignatures, ...TSignatures], 'publicAPI'> & Partial<MergeSignaturesProperty<TOptionalSignatures, 'instance'>>;
|
|
21
|
-
export type
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export type TreeViewState<TSignatures extends readonly TreeViewAnyPluginSignature[], TOptionalSignatures extends readonly TreeViewAnyPluginSignature[] = []> = MergeSignaturesProperty<[...TreeViewCorePluginSignatures, ...TSignatures], 'state'> & Partial<MergeSignaturesProperty<TOptionalSignatures, 'state'>> & {
|
|
25
|
-
cacheKey: TreeViewStateCacheKey;
|
|
26
|
-
};
|
|
22
|
+
export type TreeViewState<TSignatures extends readonly TreeViewAnyPluginSignature[], TOptionalSignatures extends readonly TreeViewAnyPluginSignature[] = []> = MergeSignaturesProperty<[...TreeViewCorePluginSignatures, ...TSignatures], 'state'> & Partial<MergeSignaturesProperty<TOptionalSignatures, 'state'>>;
|
|
23
|
+
export type TreeViewStore<TSignatures extends readonly TreeViewAnyPluginSignature[], TOptionalSignatures extends readonly TreeViewAnyPluginSignature[] = []> = Store<TreeViewState<TSignatures, TOptionalSignatures>>;
|
|
24
|
+
export type TreeViewReadonlyStore<TSignatures extends readonly TreeViewAnyPluginSignature[], TOptionalSignatures extends readonly TreeViewAnyPluginSignature[] = []> = ReadonlyStore<TreeViewState<TSignatures, TOptionalSignatures>>;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { useTreeViewExpansion } from "./useTreeViewExpansion.js";
|
|
2
|
-
export type { UseTreeViewExpansionSignature, UseTreeViewExpansionParameters, UseTreeViewExpansionParametersWithDefaults } from "./useTreeViewExpansion.types.js";
|
|
2
|
+
export type { UseTreeViewExpansionSignature, UseTreeViewExpansionParameters, UseTreeViewExpansionParametersWithDefaults } from "./useTreeViewExpansion.types.js";
|
|
3
|
+
export { expansionSelectors } from "./useTreeViewExpansion.selectors.js";
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { useTreeViewExpansion } from "./useTreeViewExpansion.js";
|
|
1
|
+
export { useTreeViewExpansion } from "./useTreeViewExpansion.js";
|
|
2
|
+
export { expansionSelectors } from "./useTreeViewExpansion.selectors.js";
|