@progress/kendo-react-treeview 13.3.0-develop.9 → 13.4.0-develop.1
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/ItemRenderProps.d.ts +20 -0
- package/TreeView.d.ts +137 -0
- package/TreeView.js +1 -1
- package/TreeView.mjs +17 -17
- package/TreeViewDragAnalyzer.d.ts +137 -0
- package/TreeViewDragClue.d.ts +146 -0
- package/TreeViewDragClue.mjs +3 -3
- package/TreeViewItem.d.ts +112 -0
- package/TreeViewItem.js +1 -1
- package/TreeViewItem.mjs +47 -36
- package/TreeViewOperationDescriptors.d.ts +83 -0
- package/TreeViewProps.d.ts +341 -0
- package/dist/cdn/js/kendo-react-treeview.js +1 -1
- package/events.d.ts +165 -0
- package/handleTreeViewCheckChange.d.ts +75 -0
- package/handleTreeViewCheckChange.mjs +5 -5
- package/index.d.mts +16 -1310
- package/index.d.ts +16 -1310
- package/moveTreeViewItem.d.ts +111 -0
- package/package-metadata.d.ts +12 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +10 -16
- package/package.json +4 -4
- package/processTreeViewItems.d.ts +58 -0
- package/processTreeViewItems.mjs +1 -1
- package/utils/consts.d.ts +51 -0
- package/utils/getItemIdUponKeyboardNavigation.d.ts +12 -0
- package/utils/utils.d.ts +13 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 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 { TreeViewExpandChangeEvent } from './events.js';
|
|
9
|
+
import { TreeViewCheckDescriptor } from './TreeViewOperationDescriptors.js';
|
|
10
|
+
/**
|
|
11
|
+
* The settings that configure the update of the check descriptor.
|
|
12
|
+
*/
|
|
13
|
+
export interface TreeViewCheckChangeSettings {
|
|
14
|
+
/**
|
|
15
|
+
* Determines a selection of a single node at a time.
|
|
16
|
+
*/
|
|
17
|
+
singleMode?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Determines if the children checkboxes will be selected when the user selects the parent checkbox.
|
|
20
|
+
*/
|
|
21
|
+
checkChildren?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Determines if the parent checkbox will be selected when the user selects all its children checkboxes.
|
|
24
|
+
*/
|
|
25
|
+
checkParents?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A helper function which updates the check descriptor.
|
|
29
|
+
*
|
|
30
|
+
* @param event - The event that triggered the change.
|
|
31
|
+
* @param check - The check descriptor that will be updated.
|
|
32
|
+
* @param data - The TreeView items.
|
|
33
|
+
* @param settings - The additional settings that configure the update of the check descriptor.
|
|
34
|
+
* @param childrenField - The field that points to the dataItem sub items. Defaults to `items`.
|
|
35
|
+
* The default behavior allows the selection of multiple items.
|
|
36
|
+
* @returns - The updated copy of the input check descriptor.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```jsx
|
|
40
|
+
* const App = () => {
|
|
41
|
+
* const [check, setCheck] = React.useState([]);
|
|
42
|
+
* const [items] = React.useState(tree);
|
|
43
|
+
*
|
|
44
|
+
* const onCheckChange = (event) => {
|
|
45
|
+
* setCheck(handleTreeViewCheckChange(event, check, items));
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* return (
|
|
49
|
+
* <div>
|
|
50
|
+
* <TreeView
|
|
51
|
+
* checkboxes={true} onCheckChange={onCheckChange}
|
|
52
|
+
* data={processTreeViewItems(items, { check })}
|
|
53
|
+
* />
|
|
54
|
+
* <div style={{ marginTop: 5 }}>
|
|
55
|
+
* <i>Press SPACE to check/uncheck the active item</i>
|
|
56
|
+
* <div className="example-config">
|
|
57
|
+
* Checked Indices: {check.join(",")}
|
|
58
|
+
* </div>
|
|
59
|
+
* </div>
|
|
60
|
+
* </div>
|
|
61
|
+
* );
|
|
62
|
+
* }
|
|
63
|
+
*
|
|
64
|
+
* const tree = [ {
|
|
65
|
+
* text: 'Furniture', expanded: true, items: [
|
|
66
|
+
* { text: 'Tables & Chairs' }, { text: 'Sofas' }, { text: 'Occasional Furniture' } ]
|
|
67
|
+
* }, {
|
|
68
|
+
* text: 'Decor', expanded: true, items: [
|
|
69
|
+
* { text: 'Bed Linen' }, { text: 'Curtains & Blinds' }, { text: 'Carpets' } ]
|
|
70
|
+
* } ];
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function handleTreeViewCheckChange(event: TreeViewExpandChangeEvent, check: string[] | TreeViewCheckDescriptor, data?: any[] | null, settings?: TreeViewCheckChangeSettings, childrenField?: string): any[] | (TreeViewCheckDescriptor & {
|
|
74
|
+
ids: any[];
|
|
75
|
+
});
|
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { isArray as I, getNestedValue as x, getAllDirectIndirectChildrenIds as m, areAllDirectChildrenChecked as p, getAllParents as g, treeIdUtils as u } from "@progress/kendo-react-common";
|
|
9
9
|
import { CHILDREN_FIELD as O } from "./utils/consts.mjs";
|
|
10
10
|
function b(i, n, t, s = {}, d) {
|
|
11
11
|
if (!t || !t.length)
|
|
12
12
|
return [];
|
|
13
|
-
const { ids: l, idField: r } = k(n), c = r ?
|
|
13
|
+
const { ids: l, idField: r } = k(n), c = r ? x(r, i.item) : i.itemHierarchicalIndex, h = l.indexOf(c), o = h === -1, a = d || O;
|
|
14
14
|
let e;
|
|
15
|
-
return s.singleMode ? e = o ? [c] : [] : (e = l.slice(), o ? e.push(c) : e.splice(h, 1), s.checkChildren && C(i.item, i.itemHierarchicalIndex, o, r, a, e), s.checkParents && D(i.itemHierarchicalIndex, o, r, a, e, t)),
|
|
15
|
+
return s.singleMode ? e = o ? [c] : [] : (e = l.slice(), o ? e.push(c) : e.splice(h, 1), s.checkChildren && C(i.item, i.itemHierarchicalIndex, o, r, a, e), s.checkParents && D(i.itemHierarchicalIndex, o, r, a, e, t)), I(n) ? e : Object.assign({}, n, { ids: e });
|
|
16
16
|
}
|
|
17
17
|
function k(i) {
|
|
18
18
|
let n, t;
|
|
19
|
-
return
|
|
19
|
+
return I(i) ? n = i : (n = i.ids || [], t = i.idField), { ids: n, idField: t };
|
|
20
20
|
}
|
|
21
21
|
function C(i, n, t, s, d, l) {
|
|
22
22
|
m(i, n, d, s).forEach((r) => {
|
|
@@ -49,7 +49,7 @@ function D(i, n, t, s, d, l) {
|
|
|
49
49
|
if (t) {
|
|
50
50
|
const e = g(i, s, l);
|
|
51
51
|
for (let f = e.length - 1; f > -1; f--)
|
|
52
|
-
yield { id:
|
|
52
|
+
yield { id: x(t, e[f]), item: n ? e[f] : void 0 };
|
|
53
53
|
} else {
|
|
54
54
|
let e = u.getDirectParentId(i);
|
|
55
55
|
for (; e; )
|