react-magma-dom 4.7.0-next.20 → 4.7.0-next.21

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.
@@ -4,6 +4,7 @@ import { IndeterminateCheckboxStatus } from '../IndeterminateCheckbox';
4
4
  export interface TreeItemSelectedInterface {
5
5
  itemId?: string;
6
6
  checkedStatus: IndeterminateCheckboxStatus;
7
+ isDisabled?: boolean;
7
8
  }
8
9
  export interface TreeViewItemInterface {
9
10
  itemId?: string;
@@ -11,6 +12,7 @@ export interface TreeViewItemInterface {
11
12
  icon?: React.ReactNode;
12
13
  checkedStatus: IndeterminateCheckboxStatus;
13
14
  hasOwnTreeItems: boolean;
15
+ isDisabled?: boolean;
14
16
  }
15
17
  export interface TreeViewContextInterface {
16
18
  children?: React.ReactNode[];
@@ -68,6 +68,7 @@ export declare function useTreeItem(props: UseTreeItemProps, forwardedRef: any):
68
68
  selectedItems: import("./TreeViewContext").TreeItemSelectedInterface[];
69
69
  setExpanded: React.Dispatch<React.SetStateAction<boolean>>;
70
70
  treeItemChildren: (string | number | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any>) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal)[];
71
+ isDisabled: boolean;
71
72
  };
72
73
  handleClick: (event: any, itemId: any) => void;
73
74
  handleKeyDown: (event: React.KeyboardEvent) => void;
@@ -72,6 +72,11 @@ export interface UseTreeViewProps {
72
72
  * clearAll(): void - action that allows to unselect all items.
73
73
  */
74
74
  apiRef?: React.MutableRefObject<TreeViewApi>;
75
+ /**
76
+ * If true, every item is disabled
77
+ * @default false
78
+ */
79
+ isDisabled?: boolean;
75
80
  }
76
81
  export declare function useTreeView(props: UseTreeViewProps): {
77
82
  contextValue: {
@@ -89,7 +94,7 @@ export declare function useTreeView(props: UseTreeViewProps): {
89
94
  checkChildren: boolean;
90
95
  checkParents: boolean;
91
96
  items: any;
92
- selectItem: ({ itemId, checkedStatus }: Pick<TreeViewItemInterface, 'itemId' | 'checkedStatus'>) => void;
97
+ selectItem: ({ itemId, checkedStatus }: Pick<TreeViewItemInterface, 'itemId'> & Partial<Pick<TreeViewItemInterface, 'checkedStatus'>>) => void;
93
98
  };
94
99
  };
95
100
  export declare type UseTreeViewReturn = ReturnType<typeof useTreeView>;
@@ -3,7 +3,7 @@ import { UseTreeViewProps } from './useTreeView';
3
3
  import { TreeViewSelectable } from './types';
4
4
  import React from 'react';
5
5
  import { IndeterminateCheckboxStatus } from '../IndeterminateCheckbox';
6
- import { TreeViewItemInterface } from './TreeViewContext';
6
+ import { TreeItemSelectedInterface, TreeViewItemInterface } from './TreeViewContext';
7
7
  export declare enum TreeNodeType {
8
8
  branch = "branch",
9
9
  leaf = "leaf"
@@ -31,7 +31,7 @@ export declare function filterNullEntries(obj: any): {
31
31
  } | {
32
32
  current?: undefined;
33
33
  };
34
- export declare const getInitialItems: ({ children, preselectedItems: rawPreselectedItems, checkParents, selectable }: Pick<UseTreeViewProps, 'children' | 'preselectedItems' | 'checkParents' | 'selectable'>) => any;
34
+ export declare const getInitialItems: ({ children, preselectedItems: rawPreselectedItems, checkParents, checkChildren, selectable, isDisabled: isTreeViewDisabled }: Pick<UseTreeViewProps, 'children' | 'preselectedItems' | 'checkParents' | 'checkChildren' | 'selectable' | 'isDisabled'>) => any;
35
35
  export declare const selectSingle: ({ items, itemId, checkedStatus }: {
36
36
  items: TreeViewItemInterface[];
37
37
  itemId: TreeViewItemInterface['itemId'];
@@ -42,12 +42,19 @@ export declare const selectSingle: ({ items, itemId, checkedStatus }: {
42
42
  parentId?: string;
43
43
  icon?: React.ReactNode;
44
44
  hasOwnTreeItems: boolean;
45
+ isDisabled?: boolean;
45
46
  }[];
46
- export declare const selectMulti: ({ items, itemId, checkedStatus, checkChildren, checkParents }: {
47
+ export declare const toggleMulti: ({ items, itemId, checkedStatus: rawCheckedStatus, forceCheckedStatus, checkChildren, checkParents }: {
47
48
  items: TreeViewItemInterface[];
48
49
  itemId: TreeViewItemInterface['itemId'];
49
50
  checkedStatus: TreeViewItemInterface['checkedStatus'];
50
- } & Pick<UseTreeViewProps, "checkParents" | "checkChildren">) => any;
51
+ forceCheckedStatus?: boolean;
52
+ } & Pick<UseTreeViewProps, "checkChildren" | "checkParents">) => any;
53
+ export declare const toggleAllMulti: ({ items, checkedStatus, checkChildren, checkParents }: {
54
+ items: TreeViewItemInterface[];
55
+ checkedStatus: TreeViewItemInterface['checkedStatus'];
56
+ } & Pick<UseTreeViewProps, "checkChildren" | "checkParents">) => any;
51
57
  export declare const getInitialExpandedIds: ({ items, initialExpandedItems }: {
52
58
  items: TreeViewItemInterface[];
53
59
  } & Pick<UseTreeViewProps, "initialExpandedItems">) => any[];
60
+ export declare const isSelectedItemsChanged: (prevSelectedItems: TreeItemSelectedInterface[] | null, selectedItems: TreeItemSelectedInterface[]) => boolean;