@elliemae/ds-treeview 2.0.1 → 2.1.0-rc.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/cjs/TreeView.js +5 -103
- package/cjs/TreeViewContext.js +44 -47
- package/cjs/config/useTreeview.js +137 -0
- package/cjs/index.js +1 -7
- package/cjs/parts/CheckboxSelectable.js +7 -9
- package/cjs/parts/ExpandCaret.js +17 -11
- package/cjs/parts/Icon.js +4 -0
- package/cjs/parts/NestingSpace.js +15 -22
- package/cjs/parts/RadioSelectable.js +7 -9
- package/cjs/parts/TreeItem.js +16 -13
- package/cjs/parts/TreeList.js +6 -4
- package/cjs/plugins/dnd/TreeDndPlugin.js +1 -1
- package/cjs/react-desc-prop-types.js +28 -27
- package/cjs/related-components/TreeViewSearchBar.js +9 -1
- package/cjs/{deprecated/plugins/selectable/helper.js → sharedTypes.js} +0 -0
- package/cjs/utils/dnd-helpers.js +2 -4
- package/cjs/utils/group-expands-helpers.js +34 -8
- package/cjs/utils/keyboard-helpers.js +64 -60
- package/cjs/utils/object-helpers.js +25 -7
- package/cjs/utils/refs-helpers.js +2 -2
- package/cjs/utils/selectable-helper.js +2 -2
- package/cjs/utils/tree-helpers.js +42 -27
- package/cjs/utils/useDnDHelpers.js +107 -100
- package/cjs/utils/useInstanceRefActions.js +3 -2
- package/cjs/utils/useTree.js +27 -8
- package/esm/TreeView.js +6 -103
- package/esm/TreeViewContext.js +44 -47
- package/esm/config/useTreeview.js +129 -0
- package/esm/index.js +0 -8
- package/esm/parts/CheckboxSelectable.js +7 -9
- package/esm/parts/ExpandCaret.js +17 -11
- package/esm/parts/Icon.js +4 -0
- package/esm/parts/NestingSpace.js +15 -21
- package/esm/parts/RadioSelectable.js +7 -9
- package/esm/parts/TreeItem.js +16 -13
- package/esm/parts/TreeList.js +6 -4
- package/esm/plugins/dnd/TreeDndPlugin.js +1 -1
- package/esm/react-desc-prop-types.js +28 -27
- package/esm/related-components/TreeViewSearchBar.js +9 -1
- package/esm/{deprecated/plugins/selectable/helper.js → sharedTypes.js} +0 -0
- package/esm/utils/dnd-helpers.js +2 -4
- package/esm/utils/group-expands-helpers.js +34 -9
- package/esm/utils/keyboard-helpers.js +62 -58
- package/esm/utils/object-helpers.js +25 -7
- package/esm/utils/refs-helpers.js +2 -2
- package/esm/utils/selectable-helper.js +2 -2
- package/esm/utils/tree-helpers.js +42 -27
- package/esm/utils/useDnDHelpers.js +107 -100
- package/esm/utils/useInstanceRefActions.js +3 -2
- package/esm/utils/useTree.js +27 -8
- package/package.json +17 -128
- package/types/TreeView.d.ts +4 -148
- package/types/TreeViewContext.d.ts +4 -106
- package/types/config/useTreeview.d.ts +7 -0
- package/types/index.d.ts +0 -1
- package/types/parts/CheckboxSelectable.d.ts +5 -6
- package/types/parts/ChildrenCountDisplayer.d.ts +6 -6
- package/types/parts/ExpandCaret.d.ts +6 -6
- package/types/parts/Icon.d.ts +7 -5
- package/types/parts/NestingSpace.d.ts +3 -8
- package/types/parts/RadioSelectable.d.ts +5 -6
- package/types/parts/TreeItem.d.ts +22 -14
- package/types/parts/TreeItemText.d.ts +5 -5
- package/types/parts/TreeList.d.ts +22 -9
- package/types/react-desc-prop-types.d.ts +124 -43
- package/types/related-components/TreeViewSearchBar.d.ts +14 -11
- package/types/sharedTypes.d.ts +54 -0
- package/types/utils/array-helpers.d.ts +2 -2
- package/types/utils/dnd-helpers.d.ts +26 -25
- package/types/utils/group-expands-helpers.d.ts +13 -10
- package/types/utils/keyboard-helpers.d.ts +5 -3
- package/types/utils/object-helpers.d.ts +6 -2
- package/types/utils/refs-helpers.d.ts +4 -1
- package/types/utils/selectable-helper.d.ts +7 -3
- package/types/utils/string-helpers.d.ts +1 -1
- package/types/utils/tree-helpers.d.ts +25 -11
- package/types/utils/useDnDHelpers.d.ts +23 -3
- package/types/utils/useInstanceRefActions.d.ts +3 -3
- package/types/utils/useTree.d.ts +8 -7
- package/cjs/deprecated/TreeView.js +0 -72
- package/cjs/deprecated/__testUtils__/utils.js +0 -89
- package/cjs/deprecated/index.js +0 -27
- package/cjs/deprecated/plugins/dnd/TreeDndPlugin.js +0 -119
- package/cjs/deprecated/plugins/dnd/index.js +0 -9
- package/cjs/deprecated/plugins/dnd/renderers/DraggableItem.js +0 -67
- package/cjs/deprecated/plugins/dnd/renderers/DroppableList.js +0 -181
- package/cjs/deprecated/plugins/dnd/utils.js +0 -157
- package/cjs/deprecated/plugins/index.js +0 -21
- package/cjs/deprecated/plugins/roving/TreeRovingPlugin.js +0 -109
- package/cjs/deprecated/plugins/roving/index.js +0 -9
- package/cjs/deprecated/plugins/searchable/SearchableTreePlugin.js +0 -109
- package/cjs/deprecated/plugins/searchable/index.js +0 -9
- package/cjs/deprecated/plugins/searchable/utils.js +0 -7
- package/cjs/deprecated/plugins/selectable/SelectablePluginTree.js +0 -290
- package/cjs/deprecated/plugins/selectable/index.js +0 -9
- package/cjs/deprecated/plugins/selectable/utils.js +0 -19
- package/cjs/deprecated/plugins/toolbar/TreeToolbarPlugin.js +0 -128
- package/cjs/deprecated/plugins/toolbar/index.js +0 -9
- package/cjs/deprecated/plugins/tree/TreeDataPlugin.js +0 -281
- package/cjs/deprecated/plugins/tree/index.js +0 -9
- package/cjs/deprecated/plugins/tree/useExpandTreeState.js +0 -143
- package/cjs/deprecated/plugins/tree/utils.js +0 -43
- package/cjs/deprecated/plugins/tree/walkTreeStrategy.js +0 -60
- package/cjs/deprecated/plugins/virtualization/TreeVirtualizationPlugin.js +0 -209
- package/cjs/deprecated/plugins/virtualization/index.js +0 -9
- package/cjs/deprecated/renderers.js +0 -76
- package/cjs/prop-types.js +0 -61
- package/esm/deprecated/TreeView.js +0 -61
- package/esm/deprecated/__testUtils__/utils.js +0 -79
- package/esm/deprecated/index.js +0 -14
- package/esm/deprecated/plugins/dnd/TreeDndPlugin.js +0 -110
- package/esm/deprecated/plugins/dnd/index.js +0 -1
- package/esm/deprecated/plugins/dnd/renderers/DraggableItem.js +0 -59
- package/esm/deprecated/plugins/dnd/renderers/DroppableList.js +0 -172
- package/esm/deprecated/plugins/dnd/utils.js +0 -139
- package/esm/deprecated/plugins/index.js +0 -7
- package/esm/deprecated/plugins/roving/TreeRovingPlugin.js +0 -96
- package/esm/deprecated/plugins/roving/index.js +0 -1
- package/esm/deprecated/plugins/searchable/SearchableTreePlugin.js +0 -99
- package/esm/deprecated/plugins/searchable/index.js +0 -1
- package/esm/deprecated/plugins/searchable/utils.js +0 -3
- package/esm/deprecated/plugins/selectable/SelectablePluginTree.js +0 -280
- package/esm/deprecated/plugins/selectable/index.js +0 -1
- package/esm/deprecated/plugins/selectable/utils.js +0 -15
- package/esm/deprecated/plugins/toolbar/TreeToolbarPlugin.js +0 -114
- package/esm/deprecated/plugins/toolbar/index.js +0 -1
- package/esm/deprecated/plugins/tree/TreeDataPlugin.js +0 -269
- package/esm/deprecated/plugins/tree/index.js +0 -1
- package/esm/deprecated/plugins/tree/useExpandTreeState.js +0 -135
- package/esm/deprecated/plugins/tree/utils.js +0 -28
- package/esm/deprecated/plugins/tree/walkTreeStrategy.js +0 -56
- package/esm/deprecated/plugins/virtualization/TreeVirtualizationPlugin.js +0 -197
- package/esm/deprecated/plugins/virtualization/index.js +0 -1
- package/esm/deprecated/renderers.js +0 -59
- package/esm/prop-types.js +0 -46
- package/types/deprecated/TreeView.d.ts +0 -8
- package/types/deprecated/__testUtils__/utils.d.ts +0 -72
- package/types/deprecated/index.d.ts +0 -2
- package/types/deprecated/plugins/dnd/TreeDndPlugin.d.ts +0 -1
- package/types/deprecated/plugins/dnd/index.d.ts +0 -1
- package/types/deprecated/plugins/dnd/renderers/DraggableItem.d.ts +0 -3
- package/types/deprecated/plugins/dnd/renderers/DroppableList.d.ts +0 -6
- package/types/deprecated/plugins/dnd/tests/TreeDndPlugin.test.d.ts +0 -0
- package/types/deprecated/plugins/dnd/utils.d.ts +0 -28
- package/types/deprecated/plugins/index.d.ts +0 -7
- package/types/deprecated/plugins/roving/TreeRovingPlugin.d.ts +0 -1
- package/types/deprecated/plugins/roving/index.d.ts +0 -1
- package/types/deprecated/plugins/searchable/SearchableTreePlugin.d.ts +0 -1
- package/types/deprecated/plugins/searchable/index.d.ts +0 -1
- package/types/deprecated/plugins/searchable/utils.d.ts +0 -1
- package/types/deprecated/plugins/selectable/SelectablePluginTree.d.ts +0 -1
- package/types/deprecated/plugins/selectable/helper.d.ts +0 -0
- package/types/deprecated/plugins/selectable/index.d.ts +0 -1
- package/types/deprecated/plugins/selectable/tests/SelectablePluginTree.test.d.ts +0 -1
- package/types/deprecated/plugins/selectable/utils.d.ts +0 -1
- package/types/deprecated/plugins/toolbar/TreeToolbarPlugin.d.ts +0 -1
- package/types/deprecated/plugins/toolbar/index.d.ts +0 -1
- package/types/deprecated/plugins/tree/TreeDataPlugin.d.ts +0 -1
- package/types/deprecated/plugins/tree/index.d.ts +0 -1
- package/types/deprecated/plugins/tree/tests/TreeDataPlugin.test.d.ts +0 -1
- package/types/deprecated/plugins/tree/useExpandTreeState.d.ts +0 -14
- package/types/deprecated/plugins/tree/utils.d.ts +0 -8
- package/types/deprecated/plugins/tree/walkTreeStrategy.d.ts +0 -9
- package/types/deprecated/plugins/virtualization/TreeVirtualizationPlugin.d.ts +0 -1
- package/types/deprecated/plugins/virtualization/index.d.ts +0 -1
- package/types/deprecated/renderers.d.ts +0 -19
- package/types/prop-types.d.ts +0 -26
|
@@ -1,22 +1,112 @@
|
|
|
1
1
|
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import TreeModel from 'tree-model';
|
|
4
|
+
import { useVirtual } from 'react-virtual';
|
|
5
|
+
export declare namespace DSTreeviewT {
|
|
6
|
+
type StringOrNum = string | number;
|
|
7
|
+
type SelectionState = boolean | 'mixed';
|
|
8
|
+
type SelectionItems = Record<StringOrNum, SelectionState>;
|
|
9
|
+
type ScrollToFunc = ReturnType<typeof useVirtual>['scrollToIndex'];
|
|
10
|
+
type ScrollToItemOptions = Parameters<ReturnType<typeof useVirtual>['scrollToIndex']>[1];
|
|
11
|
+
type ScrollToItemFunc = (options: ScrollToItemOptions) => void;
|
|
12
|
+
type ExpandedItems = Record<StringOrNum, true>;
|
|
13
|
+
interface SimpleItem {
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
name: string;
|
|
16
|
+
children: SimpleItem[];
|
|
17
|
+
id: StringOrNum;
|
|
18
|
+
}
|
|
19
|
+
interface Item extends SimpleItem {
|
|
20
|
+
children: Item[];
|
|
21
|
+
treeDepth?: number;
|
|
22
|
+
virtualIndex?: number;
|
|
23
|
+
isChecked?: boolean | 'mixed';
|
|
24
|
+
isGroup?: boolean;
|
|
25
|
+
isExpanded?: boolean;
|
|
26
|
+
childrenMatchesSearchQuery?: boolean;
|
|
27
|
+
matchesSearchQuery?: boolean;
|
|
28
|
+
nodeItemRef?: React.RefObject<HTMLLIElement>;
|
|
29
|
+
model: TreeModel.Node<Item>['model'];
|
|
30
|
+
node: TreeModel.Node<Item>;
|
|
31
|
+
nodePath: TreeModel.Node<Item>[];
|
|
32
|
+
}
|
|
33
|
+
interface Actions {
|
|
34
|
+
toggleExpandAll: (isExpand: boolean) => Promise<DSTreeviewT.Item[]>;
|
|
35
|
+
scrollTo: DSTreeviewT.ScrollToFunc;
|
|
36
|
+
setSelectedItemByVirtualIndex: (index: number) => void;
|
|
37
|
+
setFocusedItemByVirtualIndex: (index: number, scrollOpts: DSTreeviewT.ScrollToItemOptions & {
|
|
38
|
+
withScroll?: boolean;
|
|
39
|
+
}) => void;
|
|
40
|
+
}
|
|
41
|
+
interface InstanceRef {
|
|
42
|
+
actions: Actions;
|
|
43
|
+
}
|
|
44
|
+
interface DefaultProps {
|
|
45
|
+
plugins: string[];
|
|
46
|
+
selection: SelectionItems;
|
|
47
|
+
instanceRef: React.MutableRefObject<InstanceRef>;
|
|
48
|
+
isItemDisabled: (item: Item) => boolean;
|
|
49
|
+
disableIcons: boolean;
|
|
50
|
+
fluid: boolean;
|
|
51
|
+
isMultiSelect: boolean;
|
|
52
|
+
isSingleSelect: boolean;
|
|
53
|
+
restrictDragAndDrop: boolean;
|
|
54
|
+
showChildrenAmount: boolean;
|
|
55
|
+
sortable: boolean;
|
|
56
|
+
isLoading: boolean;
|
|
57
|
+
highlightOnlyQuery: boolean;
|
|
58
|
+
onItemClick: (item: Item, e: React.MouseEvent<HTMLLIElement>) => void;
|
|
59
|
+
onItemFocus: (meta: {
|
|
60
|
+
scrollToItem: ScrollToItemFunc;
|
|
61
|
+
itemIndex: number;
|
|
62
|
+
item: Item;
|
|
63
|
+
}) => void;
|
|
64
|
+
onVisibleItemsChange: (newVisibleItems: Item[]) => void;
|
|
65
|
+
onOrderChange: (newData: Item[], oldData: Item[], draggedItem: Item) => void;
|
|
66
|
+
onSelectionChange: (selection: SelectionItems, item: Item, meta: {
|
|
67
|
+
scrollToItem: ScrollToItemFunc;
|
|
68
|
+
itemIndex: number;
|
|
69
|
+
}) => void;
|
|
70
|
+
onExpandChange: (expandedHashmap: ExpandedItems, itemToggled: Item | null | undefined) => void;
|
|
71
|
+
onInstanceRefInitialized: (instanceRef: React.MutableRefObject<InstanceRef>) => void;
|
|
72
|
+
rowSize: 'normal' | 'compact';
|
|
73
|
+
labelOverflow: 'wrap' | 'wrap-all' | 'truncate';
|
|
74
|
+
noItemsPlaceholder: string;
|
|
75
|
+
nameKey: string;
|
|
76
|
+
width: StringOrNum;
|
|
77
|
+
height: StringOrNum;
|
|
78
|
+
groupIcon: JSX.Element | null;
|
|
79
|
+
itemIcon: JSX.Element | null;
|
|
80
|
+
searchQuery: string;
|
|
81
|
+
}
|
|
82
|
+
interface PropsOptional {
|
|
83
|
+
expanded: ExpandedItems;
|
|
84
|
+
rightAddons: ((item: Item) => React.ReactNode | React.ReactNode[]) | JSX.Element;
|
|
85
|
+
}
|
|
86
|
+
interface PropsRequired {
|
|
87
|
+
data: Item[];
|
|
88
|
+
}
|
|
89
|
+
interface Props extends DefaultProps, PropsOptional, PropsRequired {
|
|
90
|
+
}
|
|
91
|
+
}
|
|
2
92
|
export declare const TreeViewPropTypes: {
|
|
3
|
-
data: import("react-desc").
|
|
93
|
+
data: import("react-desc").PropTypesDescValue;
|
|
4
94
|
plugins: {
|
|
5
95
|
deprecated: import("react-desc").PropTypesDescValidator;
|
|
6
96
|
};
|
|
7
97
|
selection: {
|
|
8
98
|
deprecated: import("react-desc").PropTypesDescValidator;
|
|
9
99
|
};
|
|
100
|
+
expanded: {
|
|
101
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
102
|
+
};
|
|
10
103
|
instanceRef: {
|
|
11
|
-
defaultValue
|
|
104
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
12
105
|
deprecated: import("react-desc").PropTypesDescValidator;
|
|
13
106
|
};
|
|
14
|
-
isRequired: import("react-desc").
|
|
107
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
15
108
|
};
|
|
16
|
-
|
|
17
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
18
|
-
};
|
|
19
|
-
disableLeafs: {
|
|
109
|
+
isItemDisabled: {
|
|
20
110
|
deprecated: import("react-desc").PropTypesDescValidator;
|
|
21
111
|
};
|
|
22
112
|
disableIcons: {
|
|
@@ -31,6 +121,9 @@ export declare const TreeViewPropTypes: {
|
|
|
31
121
|
isSingleSelect: {
|
|
32
122
|
deprecated: import("react-desc").PropTypesDescValidator;
|
|
33
123
|
};
|
|
124
|
+
isLoading: {
|
|
125
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
126
|
+
};
|
|
34
127
|
restrictDragAndDrop: {
|
|
35
128
|
deprecated: import("react-desc").PropTypesDescValidator;
|
|
36
129
|
};
|
|
@@ -40,51 +133,33 @@ export declare const TreeViewPropTypes: {
|
|
|
40
133
|
sortable: {
|
|
41
134
|
deprecated: import("react-desc").PropTypesDescValidator;
|
|
42
135
|
};
|
|
43
|
-
labelRenderer: {
|
|
44
|
-
defaultValue<T = unknown>(arg: T): {
|
|
45
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
46
|
-
};
|
|
47
|
-
isRequired: import("react-desc").PropTypesDescValidator;
|
|
48
|
-
};
|
|
49
136
|
onItemClick: {
|
|
50
|
-
|
|
51
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
52
|
-
};
|
|
53
|
-
isRequired: import("react-desc").PropTypesDescValidator;
|
|
137
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
54
138
|
};
|
|
55
139
|
onItemFocus: {
|
|
56
|
-
|
|
57
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
58
|
-
};
|
|
59
|
-
isRequired: import("react-desc").PropTypesDescValidator;
|
|
140
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
60
141
|
};
|
|
61
142
|
onVisibleItemsChange: {
|
|
62
|
-
|
|
63
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
64
|
-
};
|
|
65
|
-
isRequired: import("react-desc").PropTypesDescValidator;
|
|
143
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
66
144
|
};
|
|
67
145
|
onOrderChange: {
|
|
68
|
-
|
|
69
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
70
|
-
};
|
|
71
|
-
isRequired: import("react-desc").PropTypesDescValidator;
|
|
146
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
72
147
|
};
|
|
73
148
|
onSelectionChange: {
|
|
74
|
-
|
|
75
|
-
deprecated: import("react-desc").PropTypesDescValidator;
|
|
76
|
-
};
|
|
77
|
-
isRequired: import("react-desc").PropTypesDescValidator;
|
|
149
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
78
150
|
};
|
|
79
151
|
onExpandChange: {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
152
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
153
|
+
};
|
|
154
|
+
onInstanceRefInitialized: {
|
|
155
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
84
156
|
};
|
|
85
157
|
rowSize: {
|
|
86
158
|
deprecated: import("react-desc").PropTypesDescValidator;
|
|
87
159
|
};
|
|
160
|
+
labelOverflow: {
|
|
161
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
162
|
+
};
|
|
88
163
|
width: {
|
|
89
164
|
deprecated: import("react-desc").PropTypesDescValidator;
|
|
90
165
|
};
|
|
@@ -92,22 +167,28 @@ export declare const TreeViewPropTypes: {
|
|
|
92
167
|
deprecated: import("react-desc").PropTypesDescValidator;
|
|
93
168
|
};
|
|
94
169
|
groupIcon: {
|
|
95
|
-
defaultValue
|
|
170
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
96
171
|
deprecated: import("react-desc").PropTypesDescValidator;
|
|
97
172
|
};
|
|
98
|
-
isRequired: import("react-desc").
|
|
173
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
99
174
|
};
|
|
100
175
|
itemIcon: {
|
|
101
|
-
defaultValue
|
|
176
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
102
177
|
deprecated: import("react-desc").PropTypesDescValidator;
|
|
103
178
|
};
|
|
104
|
-
isRequired: import("react-desc").
|
|
179
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
105
180
|
};
|
|
106
181
|
searchQuery: {
|
|
107
|
-
defaultValue
|
|
182
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
108
183
|
deprecated: import("react-desc").PropTypesDescValidator;
|
|
109
184
|
};
|
|
110
|
-
isRequired: import("react-desc").
|
|
185
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
186
|
+
};
|
|
187
|
+
noItemsPlaceholder: {
|
|
188
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
189
|
+
};
|
|
190
|
+
name: {
|
|
191
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
111
192
|
};
|
|
112
193
|
highlightOnlyQuery: {
|
|
113
194
|
deprecated: import("react-desc").PropTypesDescValidator;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
interface PropsT {
|
|
3
|
+
handleChange: (opt: {
|
|
4
|
+
target: {
|
|
5
|
+
value: string;
|
|
6
|
+
};
|
|
7
|
+
}) => void;
|
|
8
|
+
onNext: () => void;
|
|
9
|
+
onPrevious: () => void;
|
|
10
|
+
onClear: () => void;
|
|
11
|
+
currentResultIndex: number;
|
|
12
|
+
totalResults: number;
|
|
13
|
+
value: string;
|
|
13
14
|
}
|
|
15
|
+
export declare function TreeViewSearchBar(props: PropsT): JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import TreeModel from 'tree-model';
|
|
2
|
+
import { useVirtual } from 'react-virtual';
|
|
3
|
+
import type { SetStateAction } from 'react';
|
|
4
|
+
import type { DSTreeviewT } from './react-desc-prop-types';
|
|
5
|
+
export declare namespace DSTreeviewInternalsT {
|
|
6
|
+
type GenericFunc<T extends unknown[]> = (..._args: T) => void;
|
|
7
|
+
type DnDMovementDirectionT = 'topToBottom' | 'bottomToTop';
|
|
8
|
+
interface MouseCoord {
|
|
9
|
+
isBefore: boolean;
|
|
10
|
+
isAfter: boolean;
|
|
11
|
+
isValid: boolean;
|
|
12
|
+
item: DSTreeviewT.Item | null;
|
|
13
|
+
x: number | null;
|
|
14
|
+
y: number | null;
|
|
15
|
+
relativeElementDOMRect: DOMRect | null;
|
|
16
|
+
relativeElementIndex: number | null;
|
|
17
|
+
}
|
|
18
|
+
type StateSetter<T = unknown> = React.Dispatch<SetStateAction<T>>;
|
|
19
|
+
interface CTX {
|
|
20
|
+
props: DSTreeviewT.Props;
|
|
21
|
+
visibleItems: DSTreeviewT.Item[];
|
|
22
|
+
withRadioChecks: boolean;
|
|
23
|
+
withCheckboxChecks: boolean;
|
|
24
|
+
withDragAndDrop: boolean;
|
|
25
|
+
relativeMouseCord: MouseCoord;
|
|
26
|
+
setRelativeMouseCord: StateSetter<MouseCoord>;
|
|
27
|
+
triggerTreeRerender: () => void;
|
|
28
|
+
tree?: TreeModel;
|
|
29
|
+
treeRoot?: TreeModel.Node<DSTreeviewT.Item>;
|
|
30
|
+
virtualListHelpers: ReturnType<typeof useVirtual>;
|
|
31
|
+
virtualListRef?: React.MutableRefObject<HTMLUListElement | undefined>;
|
|
32
|
+
isDragging: boolean;
|
|
33
|
+
setIsDragging: StateSetter<boolean>;
|
|
34
|
+
isKeyboardDragging: boolean;
|
|
35
|
+
setIsKeyboardDragging: StateSetter<boolean>;
|
|
36
|
+
draggedItem: DSTreeviewT.Item | null;
|
|
37
|
+
setDraggedItem: StateSetter<DSTreeviewT.Item | null>;
|
|
38
|
+
uniqueTreeViewUUID: string;
|
|
39
|
+
selectedItem: DSTreeviewT.Item | null;
|
|
40
|
+
setSelectedItem: StateSetter<DSTreeviewT.Item | null>;
|
|
41
|
+
focusedItem: DSTreeviewT.Item | null;
|
|
42
|
+
setFocusedItem: StateSetter<DSTreeviewT.Item | null>;
|
|
43
|
+
selectedCheckboxes: DSTreeviewT.SelectionItems;
|
|
44
|
+
setSelectedCheckboxes: StateSetter<DSTreeviewT.SelectionItems>;
|
|
45
|
+
expandedGroups: DSTreeviewT.ExpandedItems;
|
|
46
|
+
setExpandedGroups: StateSetter<DSTreeviewT.ExpandedItems>;
|
|
47
|
+
latestToggledItem?: DSTreeviewT.Item | null | undefined;
|
|
48
|
+
setLatestToggledItem: StateSetter<DSTreeviewT.Item | null>;
|
|
49
|
+
hoverItem: DSTreeviewT.Item | null;
|
|
50
|
+
setHoverItem: StateSetter<DSTreeviewT.Item | null>;
|
|
51
|
+
handleExpandGroup: (itemToToggle: DSTreeviewT.Item, triggerTreeRerender: () => void, updateUserExpandedState: () => void, scrollTo?: DSTreeviewT.ScrollToFunc, e?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void;
|
|
52
|
+
updateUserExpandedState: () => void;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const arrayMoveMutate: (array:
|
|
2
|
-
export declare const arrayMove: (array:
|
|
1
|
+
export declare const arrayMoveMutate: (array: unknown[], from: number, to: number) => void;
|
|
2
|
+
export declare const arrayMove: (array: unknown[], from: number, to: number) => unknown[];
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
import type { DSTreeviewT } from '../react-desc-prop-types';
|
|
2
|
+
import type { DSTreeviewInternalsT } from '../sharedTypes';
|
|
3
|
+
interface MetaInfoT {
|
|
4
|
+
isBefore: boolean;
|
|
5
|
+
isAfter: boolean;
|
|
6
|
+
draggedItem: DSTreeviewT.Item;
|
|
7
|
+
overItem: DSTreeviewT.Item;
|
|
8
|
+
}
|
|
9
|
+
interface KinshipT {
|
|
10
|
+
newParentNode: DSTreeviewT.Item['node'];
|
|
11
|
+
newNestedIndex: number;
|
|
12
|
+
}
|
|
1
13
|
export declare const keyCodes: {
|
|
2
14
|
lift: number[];
|
|
3
15
|
drop: number[];
|
|
@@ -5,34 +17,23 @@ export declare const keyCodes: {
|
|
|
5
17
|
up: number[];
|
|
6
18
|
down: number[];
|
|
7
19
|
};
|
|
8
|
-
export declare const sameParentAsHoverItemDrop: ({ isBefore, isAfter, draggedItem, overItem, movementDirection, }: {
|
|
9
|
-
|
|
10
|
-
isAfter: any;
|
|
11
|
-
draggedItem: any;
|
|
12
|
-
overItem: any;
|
|
13
|
-
movementDirection: any;
|
|
20
|
+
export declare const sameParentAsHoverItemDrop: ({ isBefore, isAfter, draggedItem, overItem, movementDirection, }: MetaInfoT & {
|
|
21
|
+
movementDirection: DSTreeviewInternalsT.DnDMovementDirectionT;
|
|
14
22
|
}) => {
|
|
15
|
-
newNestedIndex:
|
|
16
|
-
newParentNode:
|
|
23
|
+
newNestedIndex: number;
|
|
24
|
+
newParentNode: import("tree-model/types").Node<DSTreeviewT.Item>;
|
|
17
25
|
};
|
|
18
|
-
export declare const inferHoverItemKinshipDrop: ({ isBefore, isAfter, draggedItem, overItem, movementDirection, }: {
|
|
19
|
-
|
|
20
|
-
isAfter: any;
|
|
21
|
-
draggedItem: any;
|
|
22
|
-
overItem: any;
|
|
23
|
-
movementDirection: any;
|
|
26
|
+
export declare const inferHoverItemKinshipDrop: ({ isBefore, isAfter, draggedItem, overItem, movementDirection, }: MetaInfoT & {
|
|
27
|
+
movementDirection: DSTreeviewInternalsT.DnDMovementDirectionT;
|
|
24
28
|
}) => {
|
|
25
|
-
newNestedIndex:
|
|
26
|
-
newParentNode:
|
|
29
|
+
newNestedIndex: number;
|
|
30
|
+
newParentNode: import("tree-model/types").Node<DSTreeviewT.Item>;
|
|
27
31
|
};
|
|
28
|
-
export declare const isDropValid: ({ isBefore, isAfter, draggedItem, overItem, restrictDragAndDrop, }: {
|
|
29
|
-
|
|
30
|
-
isAfter: any;
|
|
31
|
-
draggedItem: any;
|
|
32
|
-
overItem: any;
|
|
33
|
-
restrictDragAndDrop: any;
|
|
32
|
+
export declare const isDropValid: ({ isBefore, isAfter, draggedItem, overItem, restrictDragAndDrop, }: MetaInfoT & {
|
|
33
|
+
restrictDragAndDrop: boolean;
|
|
34
34
|
}) => boolean;
|
|
35
35
|
export declare const inferKeyboardKinshipDrop: ({ items, newIndex, }: {
|
|
36
|
-
items:
|
|
37
|
-
newIndex:
|
|
38
|
-
}) =>
|
|
36
|
+
items: DSTreeviewT.Item[];
|
|
37
|
+
newIndex: number;
|
|
38
|
+
}) => Partial<KinshipT>;
|
|
39
|
+
export {};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import type { DSTreeviewT } from '../react-desc-prop-types';
|
|
2
|
+
import type { DSTreeviewInternalsT } from '../sharedTypes';
|
|
3
|
+
export declare const updateExpandedState: (treeRoot: DSTreeviewT.Item['node'], onExpandChange: DSTreeviewT.Props['onExpandChange'] | null | undefined) => void;
|
|
4
|
+
export declare const toggleItemExpand: (itemToToggle: DSTreeviewT.Item, triggerTreeRerender: () => void, updateUserExpandedState: DSTreeviewInternalsT.CTX['updateUserExpandedState'], scrollTo?: DSTreeviewT.ScrollToFunc) => void;
|
|
5
|
+
export declare const expandItemModel: (modelToExpand: DSTreeviewT.Item['model']) => void;
|
|
6
|
+
export declare const collapseItemModel: (modelToCollapse: DSTreeviewT.Item['model']) => void;
|
|
7
|
+
export declare const expandAll: (treeRoot: DSTreeviewT.Item['node'], triggerTreeRerender: () => void) => void;
|
|
8
|
+
export declare const collapseAll: (treeRoot: DSTreeviewT.Item['node'], triggerTreeRerender: () => void) => void;
|
|
9
|
+
export declare const getToggleExpandShouldExpand: (treeRoot: DSTreeviewT.Item['node']) => boolean;
|
|
10
|
+
export declare const toggleExpandAllHelper: (isExpand: boolean | 'toggle', treeRoot: DSTreeviewT.Item['node'], triggerTreeRerender: () => void, setLatestToggledItem: DSTreeviewInternalsT.CTX['setLatestToggledItem'], updateUserExpandedState: DSTreeviewInternalsT.CTX['updateUserExpandedState']) => void;
|
|
11
|
+
export declare const useNotifyExpandedChange: (propsWithDefaults: DSTreeviewT.Props, { latestToggledItem, expandedGroups, }: {
|
|
12
|
+
latestToggledItem?: DSTreeviewInternalsT.CTX['latestToggledItem'];
|
|
13
|
+
expandedGroups?: DSTreeviewT.ExpandedItems | undefined;
|
|
11
14
|
}) => void;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
1
|
+
import type { DSTreeviewT } from '../react-desc-prop-types';
|
|
2
|
+
import type { DSTreeviewInternalsT } from '../sharedTypes';
|
|
3
|
+
export declare const useOnItemKeyDown: (item: DSTreeviewT.Item) => (e: React.KeyboardEvent<HTMLLIElement>) => void;
|
|
4
|
+
export declare const useGlobalKeyboardListener: (func: (e: KeyboardEvent) => void) => void;
|
|
5
|
+
export declare const useGlobalToggleAllExpandShortcut: (treeRoot: DSTreeviewT.Item['node'], triggerTreeRerender: () => void, setLatestToggledItem: DSTreeviewInternalsT.CTX['setLatestToggledItem'], updateUserExpandedState: DSTreeviewInternalsT.CTX['updateUserExpandedState']) => void;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
export declare const unfreeze: (o:
|
|
2
|
-
|
|
1
|
+
export declare const unfreeze: (o: string | number | unknown[] | Date | null | undefined | Record<string, unknown>) => string | number | unknown[] | Date | Record<string, unknown> | null | undefined;
|
|
2
|
+
declare type GenericItemT<T = unknown> = {
|
|
3
|
+
[key: string]: T;
|
|
4
|
+
};
|
|
5
|
+
export declare function filterObject<T = unknown>(obj: GenericItemT<T>, predicate: (val: T) => boolean): GenericItemT<T>;
|
|
6
|
+
export {};
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type GenericMergeableRef = null | undefined | React.MutableRefObject<unknown> | ((ref: HTMLElement) => void);
|
|
3
|
+
export declare const setMultipleRefs: (...refs: GenericMergeableRef[]) => (ref: HTMLElement) => void;
|
|
4
|
+
export {};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
1
|
+
import type { DSTreeviewT } from '../react-desc-prop-types';
|
|
2
|
+
export declare const getGroupCheckState: (node: DSTreeviewT.Item['node']) => boolean | "mixed";
|
|
3
|
+
export declare const selectCheckboxItemModelParentsTillRoot: (modelToCheck: DSTreeviewT.Item, triggerTreeRerender?: (() => void) | null) => DSTreeviewT.SelectionItems;
|
|
4
|
+
export declare const toggleCheckboxItem: (itemToSelect: DSTreeviewT.Item, triggerTreeRerender?: (() => void) | null) => {
|
|
5
|
+
[x: string]: DSTreeviewT.SelectionState;
|
|
6
|
+
[x: number]: DSTreeviewT.SelectionState;
|
|
7
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const standardizeSearchQueryString: (input:
|
|
1
|
+
export declare const standardizeSearchQueryString: (input: string) => string;
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
1
|
+
import type TreeModel from 'tree-model';
|
|
2
|
+
import type { DSTreeviewT } from '../react-desc-prop-types';
|
|
3
|
+
export declare const walkVisibles: (node: DSTreeviewT.Item['node'], callback: (node: DSTreeviewT.Item['node']) => void, skipRoot?: boolean, highlightOnlyQuery?: boolean) => void;
|
|
4
|
+
export declare const walkParents: (nodePath: DSTreeviewT.Item['nodePath'], callback: (currParent: DSTreeviewT.Item['node']) => void, skipRoot?: boolean) => void;
|
|
5
|
+
declare type RecursiveCallbackT = (childNode: DSTreeviewT.Item['node'], cb?: RecursiveCallbackT, isFirst?: boolean) => void;
|
|
6
|
+
export declare const walkAllNodeChildren: (node: DSTreeviewT.Item['node'], callback: RecursiveCallbackT, isFirst?: boolean) => void;
|
|
7
|
+
export declare const getNodeById: (treeRoot: DSTreeviewT.Item['node'], id: DSTreeviewT.StringOrNum) => TreeModel.Node<DSTreeviewT.Item>;
|
|
8
|
+
export declare const cloneNode: (tree: TreeModel, node: DSTreeviewT.Item) => TreeModel.Node<DSTreeviewT.Item>;
|
|
9
|
+
export declare const itemsShareSameParent: (items?: DSTreeviewT.Item[]) => boolean;
|
|
10
|
+
export declare const getItemsParentNode: (items?: DSTreeviewT.Item[], skipSameParentCheck?: boolean) => TreeModel.Node<DSTreeviewT.Item>;
|
|
11
|
+
export declare const getNodeMatchesSearchQuery: (node: DSTreeviewT.Item['node'], searchQuery?: string) => boolean;
|
|
12
|
+
export declare const getChildrenMatchesSearchQuery: (parentNode: DSTreeviewT.Item['node'], searchQuery?: string) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Mutate in place a node from tree-model normalizing object properties like "isGroup" even if user didn't specify it explicitly,
|
|
15
|
+
* after execution the node will have "nodePath" "treeDepth" "nodeItemRef" "isGroup" "isExpanded"
|
|
16
|
+
* (optionally, based on the provided arguments) "matchesSearchQuery" "childrenMatchesSearchQuery" "isChecked"
|
|
17
|
+
*
|
|
18
|
+
* @param {Object} node - node (based on 'tree-model' lib) that you wish to mutate with extra props
|
|
19
|
+
* @param {string} [searchQuery=''] - optional string used to parse "matchesSearchQuery"/"childrenMatchesSearchQuery" properties
|
|
20
|
+
* @param {Object} [selection=null] - optional selection hashmap used to parse "isChecked" properties
|
|
21
|
+
* @param {Object} [expanded=null] - optional expanded hashmap used to parse "isExpanded" properties
|
|
22
|
+
*/
|
|
23
|
+
export declare const enrichNodeModelInPlace: (node: TreeModel.Node<DSTreeviewT.SimpleItem>, searchQuery?: string, selection?: DSTreeviewT.SelectionItems | null, expanded?: DSTreeviewT.ExpandedItems | null) => void;
|
|
24
|
+
export declare const focusItem: (item: DSTreeviewT.Item | null) => void;
|
|
25
|
+
export {};
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="mocha" />
|
|
3
|
+
/// <reference types="webpack-env" />
|
|
4
|
+
/// <reference types="styled-components" />
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import type { DSTreeviewT } from '../react-desc-prop-types';
|
|
7
|
+
import type { DSTreeviewInternalsT } from '../sharedTypes';
|
|
1
8
|
export declare const useDnDHelpers: () => {
|
|
2
|
-
updateBeforeSortStart: (beforeStartArgs:
|
|
9
|
+
updateBeforeSortStart: (beforeStartArgs: {
|
|
10
|
+
index: number;
|
|
11
|
+
isKeySorting: boolean;
|
|
12
|
+
}) => Promise<unknown>;
|
|
3
13
|
onSortStart: () => void;
|
|
4
|
-
onSortEnd: ({ oldIndex, newIndex, isKeySorting }:
|
|
5
|
-
|
|
14
|
+
onSortEnd: ({ oldIndex, newIndex, isKeySorting }: {
|
|
15
|
+
oldIndex: number;
|
|
16
|
+
newIndex: number;
|
|
17
|
+
isKeySorting: boolean;
|
|
18
|
+
}) => void;
|
|
19
|
+
onMouseDragOverItem: ({ event, item, itemIndex, setIsDraggingOverThis, openFolderOnHoverTimeout, }: {
|
|
20
|
+
event: React.MouseEvent<HTMLLIElement>;
|
|
21
|
+
item: DSTreeviewT.Item;
|
|
22
|
+
itemIndex: number;
|
|
23
|
+
setIsDraggingOverThis: DSTreeviewInternalsT.StateSetter<boolean>;
|
|
24
|
+
openFolderOnHoverTimeout: React.MutableRefObject<NodeJS.Timeout | null>;
|
|
25
|
+
}) => void;
|
|
6
26
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}, ctx:
|
|
1
|
+
import type { DSTreeviewT } from '../react-desc-prop-types';
|
|
2
|
+
import type { DSTreeviewInternalsT } from '../sharedTypes';
|
|
3
|
+
export declare const useInstanceRefActions: ({ actions }: DSTreeviewT.InstanceRef, ctx: DSTreeviewInternalsT.CTX) => DSTreeviewT.Actions;
|
package/types/utils/useTree.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import TreeModel from 'tree-model';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import type { DSTreeviewT } from '../react-desc-prop-types';
|
|
3
|
+
import type { DSTreeviewInternalsT } from '../sharedTypes';
|
|
4
|
+
export declare const useTree: (data: DSTreeviewT.SimpleItem[], props: DSTreeviewT.Props, states: {
|
|
5
|
+
setExpandedGroups: DSTreeviewInternalsT.StateSetter<DSTreeviewT.ExpandedItems>;
|
|
6
|
+
}) => {
|
|
7
|
+
visibleItems: DSTreeviewT.Item[];
|
|
4
8
|
tree: TreeModel;
|
|
5
|
-
treeRoot: TreeModel.Node<
|
|
6
|
-
name: string;
|
|
7
|
-
isExpanded: boolean;
|
|
8
|
-
children: any;
|
|
9
|
-
}>;
|
|
9
|
+
treeRoot: TreeModel.Node<DSTreeviewT.Item>;
|
|
10
10
|
rerenderItems: {};
|
|
11
11
|
triggerTreeRerender: () => void;
|
|
12
|
+
updateUserExpandedState: () => void;
|
|
12
13
|
};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
-
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
7
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
8
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
9
|
-
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
10
|
-
require('core-js/modules/esnext.iterator.constructor.js');
|
|
11
|
-
require('core-js/modules/esnext.iterator.filter.js');
|
|
12
|
-
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
|
-
require('core-js/modules/esnext.iterator.for-each.js');
|
|
14
|
-
require('react');
|
|
15
|
-
var useDataList = require('@elliemae/ds-shared/useDataList');
|
|
16
|
-
var renderers = require('./renderers.js');
|
|
17
|
-
var TreeDataPlugin = require('./plugins/tree/TreeDataPlugin.js');
|
|
18
|
-
var TreeVirtualizationPlugin = require('./plugins/virtualization/TreeVirtualizationPlugin.js');
|
|
19
|
-
var TreeRovingPlugin = require('./plugins/roving/TreeRovingPlugin.js');
|
|
20
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
21
|
-
|
|
22
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
23
|
-
|
|
24
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
25
|
-
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
26
|
-
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
27
|
-
var useDataList__default = /*#__PURE__*/_interopDefaultLegacy(useDataList);
|
|
28
|
-
|
|
29
|
-
const _excluded = ["data", "plugins", "children", "roving", "rowSize"];
|
|
30
|
-
|
|
31
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
32
|
-
|
|
33
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
34
|
-
|
|
35
|
-
const wrapComponentIfExists = (Wrapper, children) => Wrapper ? /*#__PURE__*/_jsx__default["default"](Wrapper, {}, void 0, children) : children;
|
|
36
|
-
|
|
37
|
-
function TreeView(_ref) {
|
|
38
|
-
let {
|
|
39
|
-
data,
|
|
40
|
-
plugins = [],
|
|
41
|
-
children,
|
|
42
|
-
roving = true,
|
|
43
|
-
rowSize = 'normal'
|
|
44
|
-
} = _ref,
|
|
45
|
-
props = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
46
|
-
|
|
47
|
-
const instance = useDataList__default["default"](_objectSpread(_objectSpread({
|
|
48
|
-
data,
|
|
49
|
-
plugins: [TreeDataPlugin.TreePluginList, TreeVirtualizationPlugin.TreeVirtualizationPlugin, roving && TreeRovingPlugin.TreeRovingPlugin, ...plugins],
|
|
50
|
-
customDecorators: {
|
|
51
|
-
shouldWalkChildren: []
|
|
52
|
-
},
|
|
53
|
-
// adds a new decorator to the useDataList specific for trees
|
|
54
|
-
renderers: renderers.TreeRenderers
|
|
55
|
-
}, props), {}, {
|
|
56
|
-
rowSize
|
|
57
|
-
}));
|
|
58
|
-
const {
|
|
59
|
-
list: ListComponent,
|
|
60
|
-
listWrapper: Wrapper
|
|
61
|
-
} = instance.renderers;
|
|
62
|
-
const {
|
|
63
|
-
getListProps
|
|
64
|
-
} = instance;
|
|
65
|
-
return wrapComponentIfExists(Wrapper, /*#__PURE__*/jsxRuntime.jsx(ListComponent, _objectSpread(_objectSpread({
|
|
66
|
-
records: instance.records
|
|
67
|
-
}, getListProps()), {}, {
|
|
68
|
-
className: "em-ds-tv-row-size-".concat(rowSize)
|
|
69
|
-
})));
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
exports.TreeView = TreeView;
|