@progress/kendo-react-treeview 7.2.4-develop.2 → 7.2.4-develop.4
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/TreeView.js +8 -0
- package/TreeView.mjs +256 -0
- package/TreeViewDragAnalyzer.js +8 -0
- package/TreeViewDragAnalyzer.mjs +66 -0
- package/TreeViewDragClue.js +8 -0
- package/TreeViewDragClue.mjs +58 -0
- package/TreeViewItem.js +8 -0
- package/TreeViewItem.mjs +203 -0
- package/dist/cdn/js/kendo-react-treeview.js +8 -5
- package/handleTreeViewCheckChange.js +8 -0
- package/handleTreeViewCheckChange.mjs +63 -0
- package/index.d.mts +1141 -5
- package/index.d.ts +1141 -20
- package/index.js +8 -5
- package/index.mjs +29 -752
- package/moveTreeViewItem.js +8 -0
- package/moveTreeViewItem.mjs +48 -0
- package/package-metadata.js +8 -0
- package/package-metadata.mjs +19 -0
- package/package.json +3 -3
- package/processTreeViewItems.js +8 -0
- package/processTreeViewItems.mjs +84 -0
- package/utils/consts.js +8 -0
- package/utils/consts.mjs +21 -0
- package/utils/getItemIdUponKeyboardNavigation.js +8 -0
- package/utils/getItemIdUponKeyboardNavigation.mjs +57 -0
- package/ItemRenderProps.d.ts +0 -17
- package/TreeView.d.ts +0 -133
- package/TreeViewDragAnalyzer.d.ts +0 -139
- package/TreeViewDragClue.d.ts +0 -148
- package/TreeViewItem.d.ts +0 -106
- package/TreeViewOperationDescriptors.d.ts +0 -80
- package/TreeViewProps.d.ts +0 -149
- package/events.d.ts +0 -162
- package/handleTreeViewCheckChange.d.ts +0 -73
- package/moveTreeViewItem.d.ts +0 -113
- package/package-metadata.d.ts +0 -9
- package/processTreeViewItems.d.ts +0 -55
- package/utils/consts.d.ts +0 -44
- package/utils/getItemIdUponKeyboardNavigation.d.ts +0 -9
package/index.d.ts
CHANGED
|
@@ -1,20 +1,1141 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { BaseEvent } from '@progress/kendo-react-common';
|
|
9
|
+
import { ComponentType } from 'react';
|
|
10
|
+
import { CSSProperties } from 'react';
|
|
11
|
+
import { TreeFieldsService as FieldsService } from '@progress/kendo-react-common';
|
|
12
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
13
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
14
|
+
import PropTypes from 'prop-types';
|
|
15
|
+
import * as React_2 from 'react';
|
|
16
|
+
import { RefAttributes } from 'react';
|
|
17
|
+
|
|
18
|
+
declare namespace events {
|
|
19
|
+
export {
|
|
20
|
+
TreeViewExpandChangeEvent,
|
|
21
|
+
TreeViewItemClickEvent,
|
|
22
|
+
TreeViewCheckChangeEvent,
|
|
23
|
+
TreeViewContextMenuEvent,
|
|
24
|
+
TreeViewItemDragStartEvent,
|
|
25
|
+
TreeViewItemDragOverEvent,
|
|
26
|
+
TreeViewItemDragEndEvent
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { FieldsService }
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @hidden
|
|
34
|
+
*/
|
|
35
|
+
export declare function getItemIdUponKeyboardNavigation(item: any, itemId: string, items: any[], keyCode: number, fieldsSvc: FieldsService): any;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A helper function which updates the check descriptor.
|
|
39
|
+
*
|
|
40
|
+
* @param event - The event that triggered the change.
|
|
41
|
+
* @param check - The check descriptor that will be updated.
|
|
42
|
+
* @param data - The TreeView items.
|
|
43
|
+
* @param settings - The additional settings that configure the update of the check descriptor.
|
|
44
|
+
* @param childrenField - The field that points to the dataItem sub items. Defaults to `items`.
|
|
45
|
+
* The default behavior allows the selection of multiple items.
|
|
46
|
+
* @returns - The updated copy of the input check descriptor.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```jsx
|
|
50
|
+
* class App extends React.Component {
|
|
51
|
+
* state = { check: [], items: tree };
|
|
52
|
+
* render() {
|
|
53
|
+
* return (
|
|
54
|
+
* <div>
|
|
55
|
+
* <TreeView
|
|
56
|
+
* checkboxes={true} onCheckChange={this.onCheckChange}
|
|
57
|
+
* data={processTreeViewItems(this.state.items, { check: this.state.check })}
|
|
58
|
+
* />
|
|
59
|
+
* <div style={{ marginTop: 5 }}>
|
|
60
|
+
* <i>Press SPACE to check/uncheck the active item</i>
|
|
61
|
+
* <div className="example-config">
|
|
62
|
+
* Checked Indices: {this.state.check.join(",")}
|
|
63
|
+
* </div>
|
|
64
|
+
* </div>
|
|
65
|
+
* </div>
|
|
66
|
+
* );
|
|
67
|
+
* }
|
|
68
|
+
* onCheckChange = (event) => {
|
|
69
|
+
* this.setState({ check: handleTreeViewCheckChange(event, this.state.check, this.state.items) });
|
|
70
|
+
* }
|
|
71
|
+
* }
|
|
72
|
+
*
|
|
73
|
+
* const tree = [ {
|
|
74
|
+
* text: 'Furniture', expanded: true, items: [
|
|
75
|
+
* { text: 'Tables & Chairs' }, { text: 'Sofas' }, { text: 'Occasional Furniture' } ]
|
|
76
|
+
* }, {
|
|
77
|
+
* text: 'Decor', expanded: true, items: [
|
|
78
|
+
* { text: 'Bed Linen' }, { text: 'Curtains & Blinds' }, { text: 'Carpets' } ]
|
|
79
|
+
* } ];
|
|
80
|
+
*
|
|
81
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function handleTreeViewCheckChange(event: TreeViewExpandChangeEvent, check: string[] | TreeViewCheckDescriptor, data?: any[] | null, settings?: TreeViewCheckChangeSettings, childrenField?: string): any[] | (TreeViewCheckDescriptor & {
|
|
85
|
+
ids: any[];
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The props of the ItemRender component ([see example]({% slug rendering_treeview %})).
|
|
90
|
+
*/
|
|
91
|
+
export declare interface ItemRenderProps {
|
|
92
|
+
/**
|
|
93
|
+
* The item that is rendered.
|
|
94
|
+
*/
|
|
95
|
+
item: any;
|
|
96
|
+
/**
|
|
97
|
+
* The hierarchical index of the item. The indices are zero-based. The first root item has a `0` (zero) index. If the first root item has children, the first child acquires a `0_0` index and the second acquires a `0_1` index.
|
|
98
|
+
*/
|
|
99
|
+
itemHierarchicalIndex: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* A helper function which moves a TreeView item in an immutable way.
|
|
104
|
+
*
|
|
105
|
+
* @param sourceItemHierarchicalIndex - The hierarchical index of the item that will be moved.
|
|
106
|
+
* @param sourceData - The tree which contains the item that will be moved.
|
|
107
|
+
* @param operation - The specific move operation.
|
|
108
|
+
*
|
|
109
|
+
* The available options are:
|
|
110
|
+
* * `before`—Indicates that the source item will become the previous sibling of the target item.
|
|
111
|
+
* * `after`—Indicates that the source item will become the next sibling of the target item.
|
|
112
|
+
* * `child`—Indicates that the source item will become a child of the target item.
|
|
113
|
+
* @param targetItemHierarchicalIndex - The hierarchical index of the item next to which the source item will be moved.
|
|
114
|
+
* @param targetData - The tree which contains the target item.
|
|
115
|
+
* If the argument is skipped, then the move operation will be executed within the same tree.
|
|
116
|
+
* Setting the `sourceData` and `targetData` arguments to the same tree is also supported.
|
|
117
|
+
* @param childrenField - The field that points to the dataItem sub items. Defaults to `items`.
|
|
118
|
+
* @returns - The updated copies of the `sourceData` and `targetData` input arguments.
|
|
119
|
+
* If `targetData` is not passed, then only the updated copy of the `sourceData` will be returned.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```jsx
|
|
123
|
+
* class App extends React.Component {
|
|
124
|
+
* dragClue;
|
|
125
|
+
* state = { tree };
|
|
126
|
+
*
|
|
127
|
+
* render() {
|
|
128
|
+
* return (
|
|
129
|
+
* <div>
|
|
130
|
+
* <TreeView data={this.state.tree} draggable={true}
|
|
131
|
+
* onItemDragOver={this.onItemDragOver} onItemDragEnd={this.onItemDragEnd} />
|
|
132
|
+
* <TreeViewDragClue ref={dragClue => this.dragClue = dragClue} />
|
|
133
|
+
* </div>
|
|
134
|
+
* );
|
|
135
|
+
* }
|
|
136
|
+
*
|
|
137
|
+
* onItemDragOver = (event) => {
|
|
138
|
+
* this.dragClue.show(event.pageY + 10, event.pageX, event.item.text, this.getClueClassName(event));
|
|
139
|
+
* }
|
|
140
|
+
* onItemDragEnd = (event) => {
|
|
141
|
+
* this.dragClue.hide();
|
|
142
|
+
* const eventAnalyzer = new TreeViewDragAnalyzer(event).init();
|
|
143
|
+
*
|
|
144
|
+
* if (eventAnalyzer.isDropAllowed) {
|
|
145
|
+
* const updatedTree = moveTreeViewItem(
|
|
146
|
+
* event.itemHierarchicalIndex,
|
|
147
|
+
* this.state.tree,
|
|
148
|
+
* eventAnalyzer.getDropOperation(),
|
|
149
|
+
* eventAnalyzer.destinationMeta.itemHierarchicalIndex,
|
|
150
|
+
* );
|
|
151
|
+
*
|
|
152
|
+
* this.setState({ tree: updatedTree });
|
|
153
|
+
* }
|
|
154
|
+
* }
|
|
155
|
+
* getClueClassName(event) {
|
|
156
|
+
* const eventAnalyzer = new TreeViewDragAnalyzer(event).init();
|
|
157
|
+
* const itemIndex = eventAnalyzer.destinationMeta.itemHierarchicalIndex;
|
|
158
|
+
*
|
|
159
|
+
* if (eventAnalyzer.isDropAllowed) {
|
|
160
|
+
* switch (eventAnalyzer.getDropOperation()) {
|
|
161
|
+
* case 'child':
|
|
162
|
+
* return 'k-i-plus';
|
|
163
|
+
* case 'before':
|
|
164
|
+
* return itemIndex === '0' || itemIndex.endsWith(`${SEPARATOR}0`) ?
|
|
165
|
+
* 'k-i-insert-up' : 'k-i-insert-middle';
|
|
166
|
+
* case 'after':
|
|
167
|
+
* const siblings = getSiblings(itemIndex, this.state.tree);
|
|
168
|
+
* const lastIndex = Number(itemIndex.split(SEPARATOR).pop());
|
|
169
|
+
*
|
|
170
|
+
* return lastIndex < siblings.length - 1 ? 'k-i-insert-middle' : 'k-i-insert-down';
|
|
171
|
+
* default:
|
|
172
|
+
* break;
|
|
173
|
+
* }
|
|
174
|
+
* }
|
|
175
|
+
*
|
|
176
|
+
* return 'k-i-cancel';
|
|
177
|
+
* }
|
|
178
|
+
* }
|
|
179
|
+
*
|
|
180
|
+
* function getSiblings(itemIndex, data) {
|
|
181
|
+
* let result = data;
|
|
182
|
+
*
|
|
183
|
+
* const indices = itemIndex.split(SEPARATOR).map(index => Number(index));
|
|
184
|
+
* for (let i = 0; i < indices.length - 1; i++) {
|
|
185
|
+
* result = result[indices[i]].items;
|
|
186
|
+
* }
|
|
187
|
+
*
|
|
188
|
+
* return result;
|
|
189
|
+
* }
|
|
190
|
+
*
|
|
191
|
+
* const SEPARATOR = '_';
|
|
192
|
+
* const tree = [{
|
|
193
|
+
* text: 'Furniture', expanded: true, items: [
|
|
194
|
+
* { text: 'Tables & Chairs', expanded: true },
|
|
195
|
+
* { text: 'Sofas', expanded: true },
|
|
196
|
+
* { text: 'Occasional Furniture', expanded: true }]
|
|
197
|
+
* }, {
|
|
198
|
+
* text: 'Decor', expanded: true, items: [
|
|
199
|
+
* { text: 'Bed Linen', expanded: true },
|
|
200
|
+
* { text: 'Curtains & Blinds', expanded: true },
|
|
201
|
+
* { text: 'Carpets', expanded: true }]
|
|
202
|
+
* }];
|
|
203
|
+
*
|
|
204
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
export declare function moveTreeViewItem(sourceItemHierarchicalIndex: string, sourceData: any[] | null | undefined, operation: 'before' | 'after' | 'child', targetItemHierarchicalIndex: string, targetData?: any[] | null, childrenField?: string): any[] | {
|
|
208
|
+
sourceData: any[] | null | undefined;
|
|
209
|
+
targetData: any[];
|
|
210
|
+
} | null | undefined;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* A helper function which applies the specified operation descriptors to the data.
|
|
214
|
+
* * [Expanding and collapsing items]({% slug expansion_ways_treeview %}#toc-using-a-helper-function)
|
|
215
|
+
* * [Selecting and deselecting items]({% slug selection_ways_treeview %}#toc-using-a-helper-function)
|
|
216
|
+
* * [Checking and unchecking items]({% slug check_helper_funcs_treeview %})
|
|
217
|
+
*
|
|
218
|
+
* @param data - The data that will be processed.
|
|
219
|
+
* @param operations - The operation descriptors that will be applied to the data.
|
|
220
|
+
* @returns - The processed copy of the input data.
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```jsx
|
|
224
|
+
* class App extends React.Component {
|
|
225
|
+
* state = { items: tree, expand: [], select: [], check: [] };
|
|
226
|
+
* render() {
|
|
227
|
+
* const { expand, select, check } = this.state;
|
|
228
|
+
* return (
|
|
229
|
+
* <TreeView
|
|
230
|
+
* data={processTreeViewItems(this.state.items, { expand, select, check })}
|
|
231
|
+
* expandIcons={true} onExpandChange={this.onExpandChange} checkboxes={true}
|
|
232
|
+
* onCheckChange={event => this.setState({ check: [ event.itemHierarchicalIndex ] })}
|
|
233
|
+
* onItemClick={event => this.setState({ select: [ event.itemHierarchicalIndex ] })}
|
|
234
|
+
* />
|
|
235
|
+
* );
|
|
236
|
+
* }
|
|
237
|
+
* onExpandChange = (event) => {
|
|
238
|
+
* let expand = this.state.expand.slice();
|
|
239
|
+
* const index = expand.indexOf(event.itemHierarchicalIndex);
|
|
240
|
+
* index === -1 ? expand.push(event.itemHierarchicalIndex) : expand.splice(index, 1);
|
|
241
|
+
* this.setState({ expand });
|
|
242
|
+
* }
|
|
243
|
+
* }
|
|
244
|
+
*
|
|
245
|
+
* const tree = [{
|
|
246
|
+
* text: 'Item1',
|
|
247
|
+
* items: [
|
|
248
|
+
* { text: 'Item1.1' },
|
|
249
|
+
* { text: 'Item1.2' },
|
|
250
|
+
* { text: 'Item1.3', items: [{ text: 'Item1.3.1' }] }]
|
|
251
|
+
* }, {
|
|
252
|
+
* text: 'Item2', disabled: true,
|
|
253
|
+
* items: [{ text: 'Item2.1' }, { text: 'Item2.2' }, { text: 'Item2.3' }]
|
|
254
|
+
* }, {
|
|
255
|
+
* text: 'Item3'
|
|
256
|
+
* }];
|
|
257
|
+
*
|
|
258
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
export declare function processTreeViewItems(data: any[] | null | undefined, operations: TreeViewOperationDescriptors): any[];
|
|
262
|
+
|
|
263
|
+
/** @hidden */
|
|
264
|
+
export declare const TreeView: ForwardRefExoticComponent<TreeViewProps & RefAttributes<any>>;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Represents the object of the `onCheckChange` event ([see example]({% slug check_helper_funcs_treeview %})).
|
|
268
|
+
*/
|
|
269
|
+
export declare interface TreeViewCheckChangeEvent extends BaseEvent<TreeViewClassComponent> {
|
|
270
|
+
/**
|
|
271
|
+
* The item that is selected or deselected.
|
|
272
|
+
*/
|
|
273
|
+
item: any;
|
|
274
|
+
/**
|
|
275
|
+
* The hierarchical index of the item. The indices are zero-based.
|
|
276
|
+
* The first root item has a `0` (zero) index. If the first root item has children, the first child acquires a `0_0` index and the second acquires a `0_1` index.
|
|
277
|
+
*/
|
|
278
|
+
itemHierarchicalIndex: string;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* The settings that configure the update of the check descriptor.
|
|
283
|
+
*/
|
|
284
|
+
export declare interface TreeViewCheckChangeSettings {
|
|
285
|
+
/**
|
|
286
|
+
* Determines a selection of a single node at a time.
|
|
287
|
+
*/
|
|
288
|
+
singleMode?: boolean;
|
|
289
|
+
/**
|
|
290
|
+
* Determines if the children checkboxes will be selected when the user selects the parent checkbox.
|
|
291
|
+
*/
|
|
292
|
+
checkChildren?: boolean;
|
|
293
|
+
/**
|
|
294
|
+
* Determines if the parent checkbox will be selected when the user selects all its children checkboxes.
|
|
295
|
+
*/
|
|
296
|
+
checkParents?: boolean;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* The descriptor which is used for checking.
|
|
301
|
+
*/
|
|
302
|
+
export declare interface TreeViewCheckDescriptor extends TreeViewOperationDescriptor {
|
|
303
|
+
/**
|
|
304
|
+
* Determines if a parent item will have an indeterminate state when not all its children are checked.
|
|
305
|
+
*/
|
|
306
|
+
applyCheckIndeterminate?: boolean;
|
|
307
|
+
/**
|
|
308
|
+
* The name of the field which will provide a Boolean representation for the indeterminate state of a parent item.
|
|
309
|
+
* Defaults to `checkIndeterminate`.
|
|
310
|
+
*/
|
|
311
|
+
checkIndeterminateField?: string;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Represents the [KendoReact TreeView component]({% slug overview_treeview %}).
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```jsx
|
|
319
|
+
* const data = [{
|
|
320
|
+
* text: 'Furniture', expanded: true, items: [
|
|
321
|
+
* { text: 'Tables & Chairs' }, { text: 'Sofas' }, { text: 'Occasional Furniture' }]
|
|
322
|
+
* }, {
|
|
323
|
+
* text: 'Decor', expanded: true, items: [
|
|
324
|
+
* { text: 'Bed Linen' }, { text: 'Curtains & Blinds' }, { text: 'Carpets' }]
|
|
325
|
+
* }];
|
|
326
|
+
* class App extends React.Component {
|
|
327
|
+
* render() {
|
|
328
|
+
* return <TreeView data={data} />;
|
|
329
|
+
* }
|
|
330
|
+
* }
|
|
331
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
332
|
+
* ```
|
|
333
|
+
*/
|
|
334
|
+
export declare class TreeViewClassComponent extends React_2.Component<TreeViewProps, TreeViewState> {
|
|
335
|
+
/**
|
|
336
|
+
* @hidden
|
|
337
|
+
*/
|
|
338
|
+
static propTypes: {
|
|
339
|
+
data: PropTypes.Requireable<any[]>;
|
|
340
|
+
animate: PropTypes.Requireable<boolean>;
|
|
341
|
+
tabIndex: PropTypes.Requireable<number>;
|
|
342
|
+
focusIdField: PropTypes.Requireable<string>;
|
|
343
|
+
getHierarchicalIndexById: PropTypes.Requireable<(...args: any[]) => any>;
|
|
344
|
+
onExpandChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
345
|
+
onItemClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
346
|
+
expandField: PropTypes.Requireable<string>;
|
|
347
|
+
selectField: PropTypes.Requireable<string>;
|
|
348
|
+
childrenField: PropTypes.Requireable<string>;
|
|
349
|
+
hasChildrenField: PropTypes.Requireable<string>;
|
|
350
|
+
textField: PropTypes.Requireable<string>;
|
|
351
|
+
disableField: PropTypes.Requireable<string>;
|
|
352
|
+
item: PropTypes.Requireable<any>;
|
|
353
|
+
'aria-multiselectable': (props: any, propName: string, componentName: string) => Error | null;
|
|
354
|
+
'aria-label': PropTypes.Requireable<string>;
|
|
355
|
+
'aria-labelledby': PropTypes.Requireable<string>;
|
|
356
|
+
size: PropTypes.Requireable<"small" | "large" | "medium" | null | undefined>;
|
|
357
|
+
dir: PropTypes.Requireable<string>;
|
|
358
|
+
};
|
|
359
|
+
/**
|
|
360
|
+
* @hidden
|
|
361
|
+
*/
|
|
362
|
+
static defaultProps: {
|
|
363
|
+
animate: boolean;
|
|
364
|
+
expandField: string;
|
|
365
|
+
selectField: string;
|
|
366
|
+
hasChildrenField: string;
|
|
367
|
+
childrenField: string;
|
|
368
|
+
textField: string;
|
|
369
|
+
disableField: string;
|
|
370
|
+
checkField: string;
|
|
371
|
+
checkIndeterminateField: string;
|
|
372
|
+
size: "small" | "large" | "medium" | null | undefined;
|
|
373
|
+
};
|
|
374
|
+
/**
|
|
375
|
+
* @hidden
|
|
376
|
+
*/
|
|
377
|
+
state: {
|
|
378
|
+
focusedItemId: undefined;
|
|
379
|
+
focusedItemPublicId: undefined;
|
|
380
|
+
tabbableItemId: string;
|
|
381
|
+
};
|
|
382
|
+
private blurRequest;
|
|
383
|
+
private fieldsSvc;
|
|
384
|
+
private allowExplicitFocus;
|
|
385
|
+
private get treeGuid();
|
|
386
|
+
private _element;
|
|
387
|
+
/**
|
|
388
|
+
* @hidden
|
|
389
|
+
*/
|
|
390
|
+
get element(): HTMLDivElement | null;
|
|
391
|
+
constructor(props: TreeViewProps);
|
|
392
|
+
/**
|
|
393
|
+
* @hidden
|
|
394
|
+
*/
|
|
395
|
+
render(): JSX_2.Element;
|
|
396
|
+
/**
|
|
397
|
+
* @hidden
|
|
398
|
+
*/
|
|
399
|
+
componentDidUpdate(): void;
|
|
400
|
+
private onFocusDomElNeeded;
|
|
401
|
+
private onCheckChange;
|
|
402
|
+
private onExpandChange;
|
|
403
|
+
private onPress;
|
|
404
|
+
private onDrag;
|
|
405
|
+
private onRelease;
|
|
406
|
+
private onItemClick;
|
|
407
|
+
private onFocus;
|
|
408
|
+
private onBlur;
|
|
409
|
+
private onKeyDown;
|
|
410
|
+
private dispatchEventsOnKeyDown;
|
|
411
|
+
private setFocus;
|
|
412
|
+
private onContextMenu;
|
|
413
|
+
private getFocusedItem;
|
|
414
|
+
private getItemById;
|
|
415
|
+
private dispatchCheckChange;
|
|
416
|
+
private dispatchExpandChange;
|
|
417
|
+
private dispatchItemClick;
|
|
418
|
+
private refocusDueToFocusIdField;
|
|
419
|
+
private get ariaMultiSelectable();
|
|
420
|
+
private get data();
|
|
421
|
+
private focusDomItem;
|
|
422
|
+
/**
|
|
423
|
+
* Returns the `guid` which is associated with the TreeView.
|
|
424
|
+
*/
|
|
425
|
+
get guid(): string;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Represents the object of the `onContextMenu` event ([see example]({% slug overview_treeview %}#toc-basic-usage)).
|
|
430
|
+
*/
|
|
431
|
+
declare interface TreeViewContextMenuEvent extends BaseEvent<TreeViewClassComponent> {
|
|
432
|
+
/**
|
|
433
|
+
* An event target.
|
|
434
|
+
*/
|
|
435
|
+
target: TreeViewClassComponent;
|
|
436
|
+
/**
|
|
437
|
+
* The data object that represents the current item.
|
|
438
|
+
*/
|
|
439
|
+
item: any;
|
|
440
|
+
/**
|
|
441
|
+
* The ID of the current item.
|
|
442
|
+
*/
|
|
443
|
+
itemID: string;
|
|
444
|
+
/**
|
|
445
|
+
* A React Synthetic Event.
|
|
446
|
+
*/
|
|
447
|
+
syntheticEvent: React.MouseEvent<any>;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* A class which provides an API for analyzing the `drag` events
|
|
452
|
+
* of the TreeView.
|
|
453
|
+
*
|
|
454
|
+
* @example
|
|
455
|
+
* ```jsx
|
|
456
|
+
* class App extends React.Component {
|
|
457
|
+
* dragClue;
|
|
458
|
+
* state = { tree };
|
|
459
|
+
*
|
|
460
|
+
* render() {
|
|
461
|
+
* return (
|
|
462
|
+
* <div>
|
|
463
|
+
* <TreeView data={this.state.tree} draggable={true}
|
|
464
|
+
* onItemDragOver={this.onItemDragOver} onItemDragEnd={this.onItemDragEnd} />
|
|
465
|
+
* <TreeViewDragClue ref={dragClue => this.dragClue = dragClue} />
|
|
466
|
+
* </div>
|
|
467
|
+
* );
|
|
468
|
+
* }
|
|
469
|
+
*
|
|
470
|
+
* onItemDragOver = (event) => {
|
|
471
|
+
* this.dragClue.show(event.pageY + 10, event.pageX, event.item.text, this.getClueClassName(event));
|
|
472
|
+
* }
|
|
473
|
+
* onItemDragEnd = (event) => {
|
|
474
|
+
* this.dragClue.hide();
|
|
475
|
+
* const eventAnalyzer = new TreeViewDragAnalyzer(event).init();
|
|
476
|
+
*
|
|
477
|
+
* if (eventAnalyzer.isDropAllowed) {
|
|
478
|
+
* const updatedTree = moveTreeViewItem(
|
|
479
|
+
* event.itemHierarchicalIndex,
|
|
480
|
+
* this.state.tree,
|
|
481
|
+
* eventAnalyzer.getDropOperation(),
|
|
482
|
+
* eventAnalyzer.destinationMeta.itemHierarchicalIndex,
|
|
483
|
+
* );
|
|
484
|
+
*
|
|
485
|
+
* this.setState({ tree: updatedTree });
|
|
486
|
+
* }
|
|
487
|
+
* }
|
|
488
|
+
* getClueClassName(event) {
|
|
489
|
+
* const eventAnalyzer = new TreeViewDragAnalyzer(event).init();
|
|
490
|
+
* const itemIndex = eventAnalyzer.destinationMeta.itemHierarchicalIndex;
|
|
491
|
+
*
|
|
492
|
+
* if (eventAnalyzer.isDropAllowed) {
|
|
493
|
+
* switch (eventAnalyzer.getDropOperation()) {
|
|
494
|
+
* case 'child':
|
|
495
|
+
* return 'k-i-plus';
|
|
496
|
+
* case 'before':
|
|
497
|
+
* return itemIndex === '0' || itemIndex.endsWith(`${SEPARATOR}0`) ?
|
|
498
|
+
* 'k-i-insert-up' : 'k-i-insert-middle';
|
|
499
|
+
* case 'after':
|
|
500
|
+
* const siblings = getSiblings(itemIndex, this.state.tree);
|
|
501
|
+
* const lastIndex = Number(itemIndex.split(SEPARATOR).pop());
|
|
502
|
+
*
|
|
503
|
+
* return lastIndex < siblings.length - 1 ? 'k-i-insert-middle' : 'k-i-insert-down';
|
|
504
|
+
* default:
|
|
505
|
+
* break;
|
|
506
|
+
* }
|
|
507
|
+
* }
|
|
508
|
+
*
|
|
509
|
+
* return 'k-i-cancel';
|
|
510
|
+
* }
|
|
511
|
+
* }
|
|
512
|
+
*
|
|
513
|
+
* function getSiblings(itemIndex, data) {
|
|
514
|
+
* let result = data;
|
|
515
|
+
*
|
|
516
|
+
* const indices = itemIndex.split(SEPARATOR).map(index => Number(index));
|
|
517
|
+
* for (let i = 0; i < indices.length - 1; i++) {
|
|
518
|
+
* result = result[indices[i]].items;
|
|
519
|
+
* }
|
|
520
|
+
*
|
|
521
|
+
* return result;
|
|
522
|
+
* }
|
|
523
|
+
*
|
|
524
|
+
* const SEPARATOR = '_';
|
|
525
|
+
* const tree = [{
|
|
526
|
+
* text: 'Furniture', expanded: true, items: [
|
|
527
|
+
* { text: 'Tables & Chairs', expanded: true },
|
|
528
|
+
* { text: 'Sofas', expanded: true },
|
|
529
|
+
* { text: 'Occasional Furniture', expanded: true }]
|
|
530
|
+
* }, {
|
|
531
|
+
* text: 'Decor', expanded: true, items: [
|
|
532
|
+
* { text: 'Bed Linen', expanded: true },
|
|
533
|
+
* { text: 'Curtains & Blinds', expanded: true },
|
|
534
|
+
* { text: 'Carpets', expanded: true }]
|
|
535
|
+
* }];
|
|
536
|
+
*
|
|
537
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
538
|
+
* ```
|
|
539
|
+
*/
|
|
540
|
+
export declare class TreeViewDragAnalyzer {
|
|
541
|
+
private event;
|
|
542
|
+
private itemId;
|
|
543
|
+
private treeViewGuid;
|
|
544
|
+
private initialized;
|
|
545
|
+
private destDomNodeWithMeta;
|
|
546
|
+
private destItemId;
|
|
547
|
+
private destTreeViewGuid;
|
|
548
|
+
/**
|
|
549
|
+
* @param event - The event that will be analyzed.
|
|
550
|
+
*/
|
|
551
|
+
constructor(event: TreeViewItemDragOverEvent | TreeViewItemDragEndEvent);
|
|
552
|
+
/**
|
|
553
|
+
* The method which initializes the analyzer.
|
|
554
|
+
* Invoke the method before you call any other methods.
|
|
555
|
+
*
|
|
556
|
+
* @returns - The analyzer object of the `drag` event.
|
|
557
|
+
*/
|
|
558
|
+
init(): this;
|
|
559
|
+
/**
|
|
560
|
+
* Returns `true` if dropping is allowed. Otherwise, returns `false`.
|
|
561
|
+
*/
|
|
562
|
+
get isDropAllowed(): boolean;
|
|
563
|
+
/**
|
|
564
|
+
* Returns an object which contains:
|
|
565
|
+
* * The `itemHierarchicalIndex` of the destination item (the item below the dragged item) and
|
|
566
|
+
* * The `guid` of the destination TreeView (the TreeView which renders the destination item).
|
|
567
|
+
*/
|
|
568
|
+
get destinationMeta(): {
|
|
569
|
+
itemHierarchicalIndex: string;
|
|
570
|
+
treeViewGuid: string;
|
|
571
|
+
};
|
|
572
|
+
/**
|
|
573
|
+
* Returns the specific drop operation.
|
|
574
|
+
*
|
|
575
|
+
* @returns - The following values are returned:
|
|
576
|
+
* * `before`—Indicates that the dragged item is positioned at the beginning of the destination item.
|
|
577
|
+
* * `after`—Indicates that the dragged item is positioned at the end of the destination item.
|
|
578
|
+
* * `child`—Indicates that the dragged item is positioned in the middle of the destination item.
|
|
579
|
+
* * `undefined`—Indicates that dropping is not allowed.
|
|
580
|
+
*/
|
|
581
|
+
getDropOperation(): "child" | "after" | "before" | undefined;
|
|
582
|
+
private setDestimationMeta;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Represents the KendoReact TreeViewDragClue component which renders a clue when an item is dragged.
|
|
587
|
+
*
|
|
588
|
+
* @example
|
|
589
|
+
* ```jsx
|
|
590
|
+
* class App extends React.Component {
|
|
591
|
+
* dragClue;
|
|
592
|
+
* state = { tree };
|
|
593
|
+
*
|
|
594
|
+
* render() {
|
|
595
|
+
* return (
|
|
596
|
+
* <div>
|
|
597
|
+
* <TreeView data={this.state.tree} draggable={true}
|
|
598
|
+
* onItemDragOver={this.onItemDragOver} onItemDragEnd={this.onItemDragEnd} />
|
|
599
|
+
* <TreeViewDragClue ref={dragClue => this.dragClue = dragClue} />
|
|
600
|
+
* </div>
|
|
601
|
+
* );
|
|
602
|
+
* }
|
|
603
|
+
*
|
|
604
|
+
* onItemDragOver = (event) => {
|
|
605
|
+
* this.dragClue.show(event.pageY + 10, event.pageX, event.item.text, this.getClueClassName(event));
|
|
606
|
+
* }
|
|
607
|
+
* onItemDragEnd = (event) => {
|
|
608
|
+
* this.dragClue.hide();
|
|
609
|
+
* const eventAnalyzer = new TreeViewDragAnalyzer(event).init();
|
|
610
|
+
*
|
|
611
|
+
* if (eventAnalyzer.isDropAllowed) {
|
|
612
|
+
* const updatedTree = moveTreeViewItem(
|
|
613
|
+
* event.itemHierarchicalIndex,
|
|
614
|
+
* this.state.tree,
|
|
615
|
+
* eventAnalyzer.getDropOperation(),
|
|
616
|
+
* eventAnalyzer.destinationMeta.itemHierarchicalIndex,
|
|
617
|
+
* );
|
|
618
|
+
*
|
|
619
|
+
* this.setState({ tree: updatedTree });
|
|
620
|
+
* }
|
|
621
|
+
* }
|
|
622
|
+
* getClueClassName(event) {
|
|
623
|
+
* const eventAnalyzer = new TreeViewDragAnalyzer(event).init();
|
|
624
|
+
* const itemIndex = eventAnalyzer.destinationMeta.itemHierarchicalIndex;
|
|
625
|
+
*
|
|
626
|
+
* if (eventAnalyzer.isDropAllowed) {
|
|
627
|
+
* switch (eventAnalyzer.getDropOperation()) {
|
|
628
|
+
* case 'child':
|
|
629
|
+
* return 'k-i-plus';
|
|
630
|
+
* case 'before':
|
|
631
|
+
* return itemIndex === '0' || itemIndex.endsWith(`${SEPARATOR}0`) ?
|
|
632
|
+
* 'k-i-insert-up' : 'k-i-insert-middle';
|
|
633
|
+
* case 'after':
|
|
634
|
+
* const siblings = getSiblings(itemIndex, this.state.tree);
|
|
635
|
+
* const lastIndex = Number(itemIndex.split(SEPARATOR).pop());
|
|
636
|
+
*
|
|
637
|
+
* return lastIndex < siblings.length - 1 ? 'k-i-insert-middle' : 'k-i-insert-down';
|
|
638
|
+
* default:
|
|
639
|
+
* break;
|
|
640
|
+
* }
|
|
641
|
+
* }
|
|
642
|
+
*
|
|
643
|
+
* return 'k-i-cancel';
|
|
644
|
+
* }
|
|
645
|
+
* }
|
|
646
|
+
*
|
|
647
|
+
* function getSiblings(itemIndex, data) {
|
|
648
|
+
* let result = data;
|
|
649
|
+
*
|
|
650
|
+
* const indices = itemIndex.split(SEPARATOR).map(index => Number(index));
|
|
651
|
+
* for (let i = 0; i < indices.length - 1; i++) {
|
|
652
|
+
* result = result[indices[i]].items;
|
|
653
|
+
* }
|
|
654
|
+
*
|
|
655
|
+
* return result;
|
|
656
|
+
* }
|
|
657
|
+
*
|
|
658
|
+
* const SEPARATOR = '_';
|
|
659
|
+
* const tree = [{
|
|
660
|
+
* text: 'Furniture', expanded: true, items: [
|
|
661
|
+
* { text: 'Tables & Chairs', expanded: true },
|
|
662
|
+
* { text: 'Sofas', expanded: true },
|
|
663
|
+
* { text: 'Occasional Furniture', expanded: true }]
|
|
664
|
+
* }, {
|
|
665
|
+
* text: 'Decor', expanded: true, items: [
|
|
666
|
+
* { text: 'Bed Linen', expanded: true },
|
|
667
|
+
* { text: 'Curtains & Blinds', expanded: true },
|
|
668
|
+
* { text: 'Carpets', expanded: true }]
|
|
669
|
+
* }];
|
|
670
|
+
*
|
|
671
|
+
* ReactDOM.render(<App />, document.querySelector('my-app'));
|
|
672
|
+
* ```
|
|
673
|
+
*/
|
|
674
|
+
export declare class TreeViewDragClue extends React_2.PureComponent<TreeViewDragClueProps, TreeViewDragClueState> {
|
|
675
|
+
/**
|
|
676
|
+
* @hidden
|
|
677
|
+
*/
|
|
678
|
+
static defaultProps: {
|
|
679
|
+
style: {
|
|
680
|
+
display: string;
|
|
681
|
+
position: string;
|
|
682
|
+
zIndex: number;
|
|
683
|
+
padding: string;
|
|
684
|
+
};
|
|
685
|
+
};
|
|
686
|
+
/**
|
|
687
|
+
* @hidden
|
|
688
|
+
*/
|
|
689
|
+
readonly state: TreeViewDragClueState;
|
|
690
|
+
/**
|
|
691
|
+
* @hidden
|
|
692
|
+
*/
|
|
693
|
+
render(): false | JSX_2.Element | undefined;
|
|
694
|
+
/**
|
|
695
|
+
* Displays the TreeViewDragClue component.
|
|
696
|
+
*
|
|
697
|
+
* @param top - The `top` CSS position of the component.
|
|
698
|
+
* @param left - The `left` CSS position of the component.
|
|
699
|
+
* @param text - The text of the component.
|
|
700
|
+
* @param operationClassName - The CSS class name which is related to the specific drop operation.
|
|
701
|
+
*/
|
|
702
|
+
show(top: number, left: number, text: string, operationClassName: string): void;
|
|
703
|
+
/**
|
|
704
|
+
* Hides the TreeViewDragClue component.
|
|
705
|
+
*/
|
|
706
|
+
hide(): void;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Represents the props of the KendoReact TreeViewDragClue component.
|
|
711
|
+
*/
|
|
712
|
+
declare interface TreeViewDragClueProps {
|
|
713
|
+
/**
|
|
714
|
+
* Sets custom CSS styles to the component.
|
|
715
|
+
* When specified, the default CSS styles are removed.
|
|
716
|
+
*/
|
|
717
|
+
style?: React_2.CSSProperties;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* @hidden
|
|
722
|
+
*/
|
|
723
|
+
declare interface TreeViewDragClueState {
|
|
724
|
+
visible?: boolean;
|
|
725
|
+
top?: number;
|
|
726
|
+
left?: number;
|
|
727
|
+
text?: string;
|
|
728
|
+
operationClassName?: string;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Represents the object of the `onExpandChange` event ([see example]({% slug overview_treeview %}#toc-basic-usage)).
|
|
733
|
+
*/
|
|
734
|
+
export declare interface TreeViewExpandChangeEvent extends BaseEvent<TreeViewClassComponent> {
|
|
735
|
+
/**
|
|
736
|
+
* The item that is expanded or collapsed.
|
|
737
|
+
*/
|
|
738
|
+
item: any;
|
|
739
|
+
/**
|
|
740
|
+
* The hierarchical index of the item. The indices are zero-based. The first root item has a `0` (zero) index. If the first root item has children, the first child acquires a `0_0` index and the second acquires a `0_1` index.
|
|
741
|
+
*/
|
|
742
|
+
itemHierarchicalIndex: string;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* Represent the `ref` of the TreeView component.
|
|
747
|
+
*/
|
|
748
|
+
export declare interface TreeViewHandle extends Pick<TreeViewClassComponent, keyof TreeViewClassComponent> {
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* Represents the object of the `onItemClick` event ([see example]({% slug overview_treeview %}#toc-basic-usage)).
|
|
753
|
+
*/
|
|
754
|
+
export declare interface TreeViewItemClickEvent extends BaseEvent<TreeViewClassComponent> {
|
|
755
|
+
/**
|
|
756
|
+
* The item that is clicked.
|
|
757
|
+
*/
|
|
758
|
+
item: any;
|
|
759
|
+
/**
|
|
760
|
+
* The hierarchical index of the item. The indices are zero-based.
|
|
761
|
+
* The first root item has a `0` (zero) index. If the first root item has children, the first child acquires a `0_0` index and the second acquires a `0_1` index.
|
|
762
|
+
*/
|
|
763
|
+
itemHierarchicalIndex: string;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* Represents the object of the `onItemDragEnd` event ([see example]({% slug dragdrop_treeview %})).
|
|
768
|
+
*/
|
|
769
|
+
export declare interface TreeViewItemDragEndEvent {
|
|
770
|
+
/**
|
|
771
|
+
* The target that is associated with the dragged item.
|
|
772
|
+
*/
|
|
773
|
+
target: TreeViewClassComponent;
|
|
774
|
+
/**
|
|
775
|
+
* The item that is dragged.
|
|
776
|
+
*/
|
|
777
|
+
item: any;
|
|
778
|
+
/**
|
|
779
|
+
* The hierarchical index of the dragged item. The indices are zero-based.
|
|
780
|
+
* The first root item has a `0` (zero) index. If the first root item has children, the first child acquires a `0_0` index and the second acquires a `0_1` index.
|
|
781
|
+
*/
|
|
782
|
+
itemHierarchicalIndex: string;
|
|
783
|
+
/**
|
|
784
|
+
* The X (horizontal) coordinate (in pixels) at which the event occured that is relative to the left edge of the entire document.
|
|
785
|
+
* `pageX` includes any portion of the document that is not currently visible.
|
|
786
|
+
*/
|
|
787
|
+
pageX: number;
|
|
788
|
+
/**
|
|
789
|
+
* The Y (vertical) coordinate (in pixels) at which the event occured that is relative to the whole document.
|
|
790
|
+
* `pageY` observes any vertical scrolling of the page.
|
|
791
|
+
*/
|
|
792
|
+
pageY: number;
|
|
793
|
+
/**
|
|
794
|
+
* Provides the horizontal coordinate within the client area of the application at which the event occurred
|
|
795
|
+
* (as opposed to the coordinate within the page).
|
|
796
|
+
*/
|
|
797
|
+
clientX: number;
|
|
798
|
+
/**
|
|
799
|
+
* Provides the vertical coordinate within the client area of the application at which the event occurred
|
|
800
|
+
* (as opposed to the coordinate within the page).
|
|
801
|
+
*/
|
|
802
|
+
clientY: number;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* Represents the object of the `onItemDragOver` event ([see example]({% slug dragdrop_treeview %})).
|
|
807
|
+
*/
|
|
808
|
+
export declare interface TreeViewItemDragOverEvent {
|
|
809
|
+
/**
|
|
810
|
+
* The target that is associated with the dragged item.
|
|
811
|
+
*/
|
|
812
|
+
target: TreeViewClassComponent;
|
|
813
|
+
/**
|
|
814
|
+
* The item that is dragged.
|
|
815
|
+
*/
|
|
816
|
+
item: any;
|
|
817
|
+
/**
|
|
818
|
+
* The hierarchical index of the dragged item. The indices are zero-based.
|
|
819
|
+
* The first root item has a `0` (zero) index. If the first root item has children, the first child acquires a `0_0` index and the second acquires a `0_1` index.
|
|
820
|
+
*/
|
|
821
|
+
itemHierarchicalIndex: string;
|
|
822
|
+
/**
|
|
823
|
+
* The X (horizontal) coordinate (in pixels) at which the event occurred that is relative to the left edge of the entire document.
|
|
824
|
+
* Includes any portion of the document which is not currently visible.
|
|
825
|
+
*/
|
|
826
|
+
pageX: number;
|
|
827
|
+
/**
|
|
828
|
+
* The Y (vertical) coordinate (in pixels) at which the event occurred that is relative to the whole document.
|
|
829
|
+
* `pageY` observes any vertical scrolling of the page.
|
|
830
|
+
*/
|
|
831
|
+
pageY: number;
|
|
832
|
+
/**
|
|
833
|
+
* Provides the horizontal coordinate within the client area of the application at which the event occurred
|
|
834
|
+
* (as opposed to the coordinate within the page).
|
|
835
|
+
*/
|
|
836
|
+
clientX: number;
|
|
837
|
+
/**
|
|
838
|
+
* Provides the vertical coordinate within the client area of the application at which the event occurred
|
|
839
|
+
* (as opposed to the coordinate within the page).
|
|
840
|
+
*/
|
|
841
|
+
clientY: number;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Represents the object of the `onItemDragStart` event.
|
|
846
|
+
*/
|
|
847
|
+
export declare interface TreeViewItemDragStartEvent {
|
|
848
|
+
/**
|
|
849
|
+
* An event target.
|
|
850
|
+
*/
|
|
851
|
+
target: TreeViewClassComponent;
|
|
852
|
+
/**
|
|
853
|
+
* The item that is dragged.
|
|
854
|
+
*/
|
|
855
|
+
item: any;
|
|
856
|
+
/**
|
|
857
|
+
* The hierarchical index of the dragged item. The indices are zero-based.
|
|
858
|
+
* The first root item has a `0` (zero) index. If the first root item has children, the first child acquires a `0_0` index and the second acquires a `0_1` index.
|
|
859
|
+
*/
|
|
860
|
+
itemHierarchicalIndex: string;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
/**
|
|
864
|
+
* @hidden
|
|
865
|
+
*/
|
|
866
|
+
declare interface TreeViewItemProps {
|
|
867
|
+
item: any;
|
|
868
|
+
itemId: string;
|
|
869
|
+
treeGuid: string;
|
|
870
|
+
animate: boolean;
|
|
871
|
+
focusedItemId?: string;
|
|
872
|
+
tabbableItemId: string;
|
|
873
|
+
fieldsService: FieldsService;
|
|
874
|
+
itemUI?: React_2.ComponentType<{
|
|
875
|
+
item: any;
|
|
876
|
+
itemHierarchicalIndex: string;
|
|
877
|
+
}>;
|
|
878
|
+
ariaMultiSelectable: boolean;
|
|
879
|
+
onItemClick: any;
|
|
880
|
+
expandIcons?: boolean;
|
|
881
|
+
onExpandChange: any;
|
|
882
|
+
onCheckChange: any;
|
|
883
|
+
checkboxes?: boolean;
|
|
884
|
+
onFocusDomElNeeded: any;
|
|
885
|
+
draggable?: boolean;
|
|
886
|
+
onPress: any;
|
|
887
|
+
onDrag: any;
|
|
888
|
+
onRelease: any;
|
|
889
|
+
size?: null | 'small' | 'medium' | 'large';
|
|
890
|
+
/**
|
|
891
|
+
* @hidden
|
|
892
|
+
*
|
|
893
|
+
* Internal usage!!!
|
|
894
|
+
*/
|
|
895
|
+
position?: 'top' | 'mid' | 'bot';
|
|
896
|
+
/**
|
|
897
|
+
* Currently for internal usage only! Replicates the current behavior which disables all children
|
|
898
|
+
* if the parent is disabled, which was previously achieved only though the kendo-themes,
|
|
899
|
+
* but due to rendering changes had to be replicated programmatically!
|
|
900
|
+
*
|
|
901
|
+
* @hidden
|
|
902
|
+
*/
|
|
903
|
+
disabled?: boolean;
|
|
904
|
+
/**
|
|
905
|
+
* @hidden
|
|
906
|
+
*/
|
|
907
|
+
isRtl?: boolean;
|
|
908
|
+
/**
|
|
909
|
+
* @hidden
|
|
910
|
+
*/
|
|
911
|
+
onContextMenu: (event: React_2.MouseEvent<HTMLElement>, item: any, itemId: string) => void;
|
|
912
|
+
/**
|
|
913
|
+
* @hidden
|
|
914
|
+
* This prop comes from the `TreeView`component.
|
|
915
|
+
* It replaces the previously used guid() function and is used to generate unique `id` for
|
|
916
|
+
* the checkbox and label in the TreeViewItem.
|
|
917
|
+
*/
|
|
918
|
+
id?: string;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* @hidden
|
|
923
|
+
*/
|
|
924
|
+
export declare const TreeViewItemPropsContext: React_2.Context<(props: TreeViewItemProps) => TreeViewItemProps>;
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* The descriptor which is used for expanding, selecting, and checking.
|
|
928
|
+
*/
|
|
929
|
+
export declare interface TreeViewOperationDescriptor {
|
|
930
|
+
/**
|
|
931
|
+
* The IDs of the items to which the operation will be applied. By default, the TreeView applies the hierarchical indices of the items. These indices are zero-based. The first root item has a `0` (zero) index. If the first root item has children, the first child acquires a `0_0` index and the second acquires a `0_1` index.
|
|
932
|
+
*/
|
|
933
|
+
ids?: any[];
|
|
934
|
+
/**
|
|
935
|
+
* The name of the field which will provide a Boolean representation for the operation state of the item.
|
|
936
|
+
*
|
|
937
|
+
* The default fields are:
|
|
938
|
+
* * `expanded`—Indicates that an item is expanded.
|
|
939
|
+
* * `selected`—Indicates that an item is selected.
|
|
940
|
+
* * `checked`—Indicates that an item is checked.
|
|
941
|
+
*/
|
|
942
|
+
operationField?: string;
|
|
943
|
+
/**
|
|
944
|
+
* The name of the field which will uniquely describe an item as an alternative to its hierarchical index.
|
|
945
|
+
*/
|
|
946
|
+
idField?: string;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* The descriptors of the data operations which are applied to the TreeView component.
|
|
951
|
+
*/
|
|
952
|
+
export declare interface TreeViewOperationDescriptors {
|
|
953
|
+
/**
|
|
954
|
+
* The hierarchical indices of the items to which the expand operation will be applied, or the descriptor of the operation.
|
|
955
|
+
*/
|
|
956
|
+
expand?: string[] | TreeViewOperationDescriptor;
|
|
957
|
+
/**
|
|
958
|
+
* The hierarchical indices of the items to which the select operation will be applied, or the descriptor of the operation.
|
|
959
|
+
*/
|
|
960
|
+
select?: string[] | TreeViewOperationDescriptor;
|
|
961
|
+
/**
|
|
962
|
+
* The hierarchical indices of the items to which the check operation will be applied, or the descriptor of the operation.
|
|
963
|
+
*/
|
|
964
|
+
check?: string[] | TreeViewCheckDescriptor;
|
|
965
|
+
/**
|
|
966
|
+
* When the operations are applied, the corresponding items and their parents are cloned.
|
|
967
|
+
* For performance reasons, TreeView items are cloned only once.
|
|
968
|
+
* The name of the field which provides a Boolean representation of whether an item is already cloned.
|
|
969
|
+
* Defaults to `cloned`.
|
|
970
|
+
*/
|
|
971
|
+
cloneField?: string;
|
|
972
|
+
/**
|
|
973
|
+
* The expand field of the item.
|
|
974
|
+
*/
|
|
975
|
+
expandField?: string;
|
|
976
|
+
/**
|
|
977
|
+
* The select field of the item.
|
|
978
|
+
*/
|
|
979
|
+
selectField?: string;
|
|
980
|
+
/**
|
|
981
|
+
* The check field of the item.
|
|
982
|
+
*/
|
|
983
|
+
checkField?: string;
|
|
984
|
+
/**
|
|
985
|
+
* The children field of the item.
|
|
986
|
+
*/
|
|
987
|
+
childrenField?: string;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
/**
|
|
991
|
+
* Represents the props of the [KendoReact TreeView component]({% slug overview_treeview %}).
|
|
992
|
+
*/
|
|
993
|
+
export declare interface TreeViewProps {
|
|
994
|
+
/**
|
|
995
|
+
* Sets a class of the TreeView DOM element.
|
|
996
|
+
*/
|
|
997
|
+
className?: string;
|
|
998
|
+
/**
|
|
999
|
+
* Sets an `id` of the TreeView DOM element.
|
|
1000
|
+
*/
|
|
1001
|
+
id?: string;
|
|
1002
|
+
/**
|
|
1003
|
+
* Sets the `style`attribute of the TreeView DOM element.
|
|
1004
|
+
*/
|
|
1005
|
+
style?: CSSProperties;
|
|
1006
|
+
/**
|
|
1007
|
+
* Sets the data of the TreeView ([more information and examples]({% slug databinding_treeview %})).
|
|
1008
|
+
*/
|
|
1009
|
+
data?: any[] | null;
|
|
1010
|
+
/**
|
|
1011
|
+
* Controls the animation. By default, the expand and collapse animations are enabled.
|
|
1012
|
+
*/
|
|
1013
|
+
animate?: boolean;
|
|
1014
|
+
/**
|
|
1015
|
+
* Sets a tabIndex of the TreeView DOM element.
|
|
1016
|
+
*/
|
|
1017
|
+
tabIndex?: number;
|
|
1018
|
+
/**
|
|
1019
|
+
* The TreeView has a built-in implementation of focusing and keyboard navigation. By default, the component uses hierarchical indices to uniquely match the focused item. You can use the `focusIdField` prop for specifying the name of the field which will uniquely describe an item as an alternative to its hierarchical index ([see example]({% slug datareload_treeview %}#toc-using-item-ids)).
|
|
1020
|
+
*/
|
|
1021
|
+
focusIdField?: string;
|
|
1022
|
+
/**
|
|
1023
|
+
* When `focusIdField` is set, the TreeView executes a depth-first search on the data to find the currently focused item. The `getFocusHierarchicalIndex` prop specifies the function that will be used as an alternative to the default search algorithm.
|
|
1024
|
+
*/
|
|
1025
|
+
getFocusHierarchicalIndex?: (itemId: any) => string | undefined;
|
|
1026
|
+
/**
|
|
1027
|
+
* Controls the rendering of the expand (collapse) icons. By default, the icons are not rendered ([see example]({% slug expansion_ways_treeview %})).
|
|
1028
|
+
*/
|
|
1029
|
+
expandIcons?: boolean;
|
|
1030
|
+
/**
|
|
1031
|
+
* Fires when the expanding or collapsing of an item is requested ([see example]({% slug expansion_ways_treeview %})).
|
|
1032
|
+
*/
|
|
1033
|
+
onExpandChange?: (event: events.TreeViewExpandChangeEvent) => void;
|
|
1034
|
+
/**
|
|
1035
|
+
* Fires when an item is clicked or when `Enter` is pressed on a focused item ([see example]({% slug selection_ways_treeview %})).
|
|
1036
|
+
*/
|
|
1037
|
+
onItemClick?: (event: events.TreeViewItemClickEvent) => void;
|
|
1038
|
+
/**
|
|
1039
|
+
* Specifies the name of the field which will provide a Boolean representation for the expanded state of the item. Defaults to `expanded`.
|
|
1040
|
+
*/
|
|
1041
|
+
expandField?: string;
|
|
1042
|
+
/**
|
|
1043
|
+
* Specifies the name of the field which will provide a Boolean representation for the selected state of the item. Defaults to `selected`.
|
|
1044
|
+
*/
|
|
1045
|
+
selectField?: string;
|
|
1046
|
+
/**
|
|
1047
|
+
* Specifies the name of the field which indicates to the TreeView that an item has children even if the children are not initially passed. Used for implementing the load-on-demand feature ([see example]({% slug databinding_treeview %}#toc-loading-data-on-demand)). Defaults to `hasChildren`.
|
|
1048
|
+
*/
|
|
1049
|
+
hasChildrenField?: string;
|
|
1050
|
+
/**
|
|
1051
|
+
* Specifies the name of the field which will provide an array representation of the item children.
|
|
1052
|
+
*/
|
|
1053
|
+
childrenField?: string;
|
|
1054
|
+
/**
|
|
1055
|
+
* Specifies the name of the field which will provide a text representation for the item. Defaults to `text`.
|
|
1056
|
+
*/
|
|
1057
|
+
textField?: string;
|
|
1058
|
+
/**
|
|
1059
|
+
* Specifies the name of the field which will provide a Boolean representation for the disabled state of the item. Defaults to `disabled`.
|
|
1060
|
+
*/
|
|
1061
|
+
disableField?: string;
|
|
1062
|
+
/**
|
|
1063
|
+
* Defines the component that will be used for rendering each of the TreeView items ([see example]({% slug rendering_treeview %})).
|
|
1064
|
+
*/
|
|
1065
|
+
item?: ComponentType<ItemRenderProps>;
|
|
1066
|
+
/**
|
|
1067
|
+
* Indicates that the user can select more than one TreeView items. If the TreeView is in a multiple selection mode, set the `aria-multiselectable` prop to `true` ([more on accessibility by the TreeView]({% slug accessibility_treeview %})).
|
|
1068
|
+
*/
|
|
1069
|
+
'aria-multiselectable'?: boolean | 'false' | 'true';
|
|
1070
|
+
/**
|
|
1071
|
+
* Defines a string value that labels the TreeView ([more on accessibility by the TreeView]({% slug accessibility_treeview %})).
|
|
1072
|
+
*/
|
|
1073
|
+
'aria-label'?: string;
|
|
1074
|
+
/**
|
|
1075
|
+
* Identifies the element or elements which will label the TreeView ([more on accessibility by the TreeView]({% slug accessibility_treeview %})).
|
|
1076
|
+
*/
|
|
1077
|
+
'aria-labelledby'?: string;
|
|
1078
|
+
/**
|
|
1079
|
+
* Controls the rendering of checkboxes. By default, the checkboxes are not rendered ([see example]({% slug check_items_directly_treeview %})).
|
|
1080
|
+
*/
|
|
1081
|
+
checkboxes?: boolean;
|
|
1082
|
+
/**
|
|
1083
|
+
* Specifies the name of the field which will provide a Boolean representation for the checked state of the item. Defaults to `checked`.
|
|
1084
|
+
*/
|
|
1085
|
+
checkField?: string;
|
|
1086
|
+
/**
|
|
1087
|
+
* Specifies the name of the field which will provide a Boolean representation for the check indeterminate state of the item. Defaults to `checkIndeterminate`.
|
|
1088
|
+
*/
|
|
1089
|
+
checkIndeterminateField?: string;
|
|
1090
|
+
/**
|
|
1091
|
+
* Fires when a checkbox is clicked or when `Space` is pressed on a focused item ([see example]({% slug check_items_directly_treeview %})).
|
|
1092
|
+
*/
|
|
1093
|
+
onCheckChange?: (event: events.TreeViewCheckChangeEvent) => void;
|
|
1094
|
+
/**
|
|
1095
|
+
* Controls the dispatching of the `drag` events. By default, the `drag` events are not dispatched ([see example]({% slug dragdrop_treeview %})).
|
|
1096
|
+
*/
|
|
1097
|
+
draggable?: boolean;
|
|
1098
|
+
/**
|
|
1099
|
+
* Fires when the dragging of an item has started.
|
|
1100
|
+
*/
|
|
1101
|
+
onItemDragStart?: (event: events.TreeViewItemDragStartEvent) => void;
|
|
1102
|
+
/**
|
|
1103
|
+
* Fires when a dragged item changes its position ([see example]({% slug dragdrop_treeview %})).
|
|
1104
|
+
*/
|
|
1105
|
+
onItemDragOver?: (event: events.TreeViewItemDragOverEvent) => void;
|
|
1106
|
+
/**
|
|
1107
|
+
* Fires when a dragged item is dropped ([see example]({% slug dragdrop_treeview %})).
|
|
1108
|
+
*/
|
|
1109
|
+
onItemDragEnd?: (event: events.TreeViewItemDragEndEvent) => void;
|
|
1110
|
+
/**
|
|
1111
|
+
* Configures the `size` of the TreeView.
|
|
1112
|
+
*
|
|
1113
|
+
* The available options are:
|
|
1114
|
+
* - small
|
|
1115
|
+
* - medium
|
|
1116
|
+
* - large
|
|
1117
|
+
* - null—Does not set a size `className`.
|
|
1118
|
+
*
|
|
1119
|
+
* @default `medium`
|
|
1120
|
+
*/
|
|
1121
|
+
size?: null | 'small' | 'medium' | 'large';
|
|
1122
|
+
/**
|
|
1123
|
+
* Sets the direction of the component.
|
|
1124
|
+
*/
|
|
1125
|
+
dir?: string;
|
|
1126
|
+
/**
|
|
1127
|
+
* The event that is fired when the ContextMenu is activated.
|
|
1128
|
+
*/
|
|
1129
|
+
onContextMenu?: (event: TreeViewContextMenuEvent) => void;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
/**
|
|
1133
|
+
* @hidden
|
|
1134
|
+
*/
|
|
1135
|
+
declare interface TreeViewState {
|
|
1136
|
+
focusedItemId?: string;
|
|
1137
|
+
focusedItemPublicId?: any;
|
|
1138
|
+
tabbableItemId?: string;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
export { }
|