@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.
Files changed (40) hide show
  1. package/TreeView.js +8 -0
  2. package/TreeView.mjs +256 -0
  3. package/TreeViewDragAnalyzer.js +8 -0
  4. package/TreeViewDragAnalyzer.mjs +66 -0
  5. package/TreeViewDragClue.js +8 -0
  6. package/TreeViewDragClue.mjs +58 -0
  7. package/TreeViewItem.js +8 -0
  8. package/TreeViewItem.mjs +203 -0
  9. package/dist/cdn/js/kendo-react-treeview.js +8 -5
  10. package/handleTreeViewCheckChange.js +8 -0
  11. package/handleTreeViewCheckChange.mjs +63 -0
  12. package/index.d.mts +1141 -5
  13. package/index.d.ts +1141 -20
  14. package/index.js +8 -5
  15. package/index.mjs +29 -752
  16. package/moveTreeViewItem.js +8 -0
  17. package/moveTreeViewItem.mjs +48 -0
  18. package/package-metadata.js +8 -0
  19. package/package-metadata.mjs +19 -0
  20. package/package.json +3 -3
  21. package/processTreeViewItems.js +8 -0
  22. package/processTreeViewItems.mjs +84 -0
  23. package/utils/consts.js +8 -0
  24. package/utils/consts.mjs +21 -0
  25. package/utils/getItemIdUponKeyboardNavigation.js +8 -0
  26. package/utils/getItemIdUponKeyboardNavigation.mjs +57 -0
  27. package/ItemRenderProps.d.ts +0 -17
  28. package/TreeView.d.ts +0 -133
  29. package/TreeViewDragAnalyzer.d.ts +0 -139
  30. package/TreeViewDragClue.d.ts +0 -148
  31. package/TreeViewItem.d.ts +0 -106
  32. package/TreeViewOperationDescriptors.d.ts +0 -80
  33. package/TreeViewProps.d.ts +0 -149
  34. package/events.d.ts +0 -162
  35. package/handleTreeViewCheckChange.d.ts +0 -73
  36. package/moveTreeViewItem.d.ts +0 -113
  37. package/package-metadata.d.ts +0 -9
  38. package/processTreeViewItems.d.ts +0 -55
  39. package/utils/consts.d.ts +0 -44
  40. package/utils/getItemIdUponKeyboardNavigation.d.ts +0 -9
@@ -0,0 +1,8 @@
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
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@progress/kendo-react-common"),R=require("./utils/consts.js");function y(u,n,r,o,e,i){const f=i||R.CHILDREN_FIELD;if(!p())return l();const m=t.treeIdUtils.getItemById(u,n,f);if(!m)return l();if(!e||e===n){if(!v())return l();const d=t.removeItem(u,f,n),s=t.addItem(m,r,f,t.treeIdUtils.getDecrementedItemIdAfterRemoval(u,o),d);return e?{sourceData:s,targetData:s}:s}else{const d=t.removeItem(u,f,n),s=t.addItem(m,r,f,o,e);return{sourceData:d,targetData:s}}function l(){return e?{sourceData:n,targetData:e}:n}function v(){return!`${o}_`.startsWith(`${u}_`)}function p(){if(!n||!n.length||!u||!o||e&&!e.length)return!1;const d=!e||e===n?n:e;return!!t.treeIdUtils.getItemById(o,d,f)}}exports.moveTreeViewItem=y;
@@ -0,0 +1,48 @@
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
+ "use client";
9
+ import { treeIdUtils as s, removeItem as v, addItem as R } from "@progress/kendo-react-common";
10
+ import { CHILDREN_FIELD as i } from "./utils/consts.mjs";
11
+ function C(u, f, l, t, n, r) {
12
+ const e = r || i;
13
+ if (!_())
14
+ return m();
15
+ const d = s.getItemById(u, f, e);
16
+ if (!d)
17
+ return m();
18
+ if (!n || n === f) {
19
+ if (!F())
20
+ return m();
21
+ const o = v(u, e, f), p = R(
22
+ d,
23
+ l,
24
+ e,
25
+ s.getDecrementedItemIdAfterRemoval(u, t),
26
+ o
27
+ );
28
+ return n ? { sourceData: p, targetData: p } : p;
29
+ } else {
30
+ const o = v(u, e, f), p = R(d, l, e, t, n);
31
+ return { sourceData: o, targetData: p };
32
+ }
33
+ function m() {
34
+ return n ? { sourceData: f, targetData: n } : f;
35
+ }
36
+ function F() {
37
+ return !`${t}_`.startsWith(`${u}_`);
38
+ }
39
+ function _() {
40
+ if (!f || !f.length || !u || !t || n && !n.length)
41
+ return !1;
42
+ const o = !n || n === f ? f : n;
43
+ return !!s.getItemById(t, o, e);
44
+ }
45
+ }
46
+ export {
47
+ C as moveTreeViewItem
48
+ };
@@ -0,0 +1,8 @@
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
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-treeview",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:0,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
@@ -0,0 +1,19 @@
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
+ "use client";
9
+ const e = {
10
+ name: "@progress/kendo-react-treeview",
11
+ productName: "KendoReact",
12
+ productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
13
+ publishDate: 1709714012,
14
+ version: "",
15
+ licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
16
+ };
17
+ export {
18
+ e as packageMetadata
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-react-treeview",
3
- "version": "7.2.4-develop.2",
3
+ "version": "7.2.4-develop.4",
4
4
  "description": "React TreeView displays hierarchical data in a traditional tree structure, supports user interaction. KendoReact TreeView package",
5
5
  "author": "Progress",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -23,8 +23,8 @@
23
23
  "sideEffects": false,
24
24
  "peerDependencies": {
25
25
  "@progress/kendo-licensing": "^1.3.4",
26
- "@progress/kendo-react-animation": "7.2.4-develop.2",
27
- "@progress/kendo-react-common": "7.2.4-develop.2",
26
+ "@progress/kendo-react-animation": "7.2.4-develop.4",
27
+ "@progress/kendo-react-common": "7.2.4-develop.4",
28
28
  "@progress/kendo-svg-icons": "^2.1.0",
29
29
  "react": "^16.8.2 || ^17.0.0 || ^18.0.0",
30
30
  "react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
@@ -0,0 +1,8 @@
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
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("@progress/kendo-react-common"),d=require("./utils/consts.js");function C(n,t){if(!n||!n.length)return[];let e=n;const l=t.cloneField||"cloned",c=t.expandField||d.EXPAND_FIELD,s=t.selectField||d.SELECT_FIELD,r=t.checkField||d.CHECK_FIELD,i=t.childrenField||d.CHILDREN_FIELD;return e=I(e,c,t.expand,l,i),e=I(e,s,t.select,l,i),e=I(e,r,t.check,l,i),m(e,i,t.check),e}function I(n,t,e,l,c){if(e){let{ids:s,field:r}=o(e,t),i=!f.isArray(e)&&e.idField?f.resolveItemsIds(s,e.idField,n,c):s;return F(n,i,r,l,c)}else return n}function o(n,t){let e,l;return f.isArray(n)?(e=n,l=t):(e=n.ids||[],l=n.operationField||t),{ids:e,field:l}}function F(n,t,e,l,c){let s=n;return t.forEach(r=>{s=f.updateItem(s,r,i=>g(e,i),l,c)}),s}function g(n,t){const e=(n||"").split(".");let l=t;for(let c=0;c<e.length;c++){const s=e[c];if(c===e.length-1)l[s]=!0;else if(l[s]!==void 0)l[s]={...l[s]},l=l[s];else return}}function m(n,t,e){if(e&&!f.isArray(e)&&e.applyCheckIndeterminate){const{field:l}=o(e,d.CHECK_FIELD),c=e.checkIndeterminateField||d.CHECK_INDETERMINATE_FIELD;for(let s=0;s<n.length;s++){const r=n[s],i=r[t];i&&E(i,f.getNestedValue(l,r)?[]:[r],t,l,c)}}}function E(n,t,e,l,c){let s=!1;for(let r=0;r<n.length;r++){const i=n[r];if(f.getNestedValue(l,i)){if(!s)for(let u=0;u<t.length;u++)g(c,t[u]);s=!0,i[e]&&E(i[e],[],e,l,c)}else i[e]&&E(i[e],s?[i]:t.concat([i]),e,l,c)}}exports.processTreeViewItems=C;
@@ -0,0 +1,84 @@
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
+ "use client";
9
+ import { isArray as I, resolveItemsIds as g, updateItem as C, getNestedValue as E } from "@progress/kendo-react-common";
10
+ import { EXPAND_FIELD as D, SELECT_FIELD as L, CHECK_FIELD as m, CHILDREN_FIELD as N, CHECK_INDETERMINATE_FIELD as _ } from "./utils/consts.mjs";
11
+ function A(n, t) {
12
+ if (!n || !n.length)
13
+ return [];
14
+ let e = n;
15
+ const l = t.cloneField || "cloned", f = t.expandField || D, s = t.selectField || L, c = t.checkField || m, i = t.childrenField || N;
16
+ return e = r(e, f, t.expand, l, i), e = r(e, s, t.select, l, i), e = r(e, c, t.check, l, i), p(e, i, t.check), e;
17
+ }
18
+ function r(n, t, e, l, f) {
19
+ if (e) {
20
+ let { ids: s, field: c } = F(e, t), i = !I(e) && e.idField ? g(s, e.idField, n, f) : s;
21
+ return h(n, i, c, l, f);
22
+ } else
23
+ return n;
24
+ }
25
+ function F(n, t) {
26
+ let e, l;
27
+ return I(n) ? (e = n, l = t) : (e = n.ids || [], l = n.operationField || t), { ids: e, field: l };
28
+ }
29
+ function h(n, t, e, l, f) {
30
+ let s = n;
31
+ return t.forEach((c) => {
32
+ s = C(s, c, (i) => o(e, i), l, f);
33
+ }), s;
34
+ }
35
+ function o(n, t) {
36
+ const e = (n || "").split(".");
37
+ let l = t;
38
+ for (let f = 0; f < e.length; f++) {
39
+ const s = e[f];
40
+ if (f === e.length - 1)
41
+ l[s] = !0;
42
+ else if (l[s] !== void 0)
43
+ l[s] = { ...l[s] }, l = l[s];
44
+ else
45
+ return;
46
+ }
47
+ }
48
+ function p(n, t, e) {
49
+ if (e && !I(e) && e.applyCheckIndeterminate) {
50
+ const { field: l } = F(e, m), f = e.checkIndeterminateField || _;
51
+ for (let s = 0; s < n.length; s++) {
52
+ const c = n[s], i = c[t];
53
+ i && u(
54
+ i,
55
+ E(l, c) ? [] : [c],
56
+ t,
57
+ l,
58
+ f
59
+ );
60
+ }
61
+ }
62
+ }
63
+ function u(n, t, e, l, f) {
64
+ let s = !1;
65
+ for (let c = 0; c < n.length; c++) {
66
+ const i = n[c];
67
+ if (E(l, i)) {
68
+ if (!s)
69
+ for (let d = 0; d < t.length; d++)
70
+ o(f, t[d]);
71
+ s = !0, i[e] && u(i[e], [], e, l, f);
72
+ } else
73
+ i[e] && u(
74
+ i[e],
75
+ s ? [i] : t.concat([i]),
76
+ e,
77
+ l,
78
+ f
79
+ );
80
+ }
81
+ }
82
+ export {
83
+ A as processTreeViewItems
84
+ };
@@ -0,0 +1,8 @@
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
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E="expanded",D="text",I="disabled",_="items",e="hasChildren",L="selected",t="checked",F="checkIndeterminate",n="_kendoItemId",c="_kendoTreeViewGuid";exports.CHECK_FIELD=t;exports.CHECK_INDETERMINATE_FIELD=F;exports.CHILDREN_FIELD=_;exports.DISABLED_FIELD=I;exports.DOM_KENDO_ITEM_ID_FIELD=n;exports.DOM_KENDO_TREEVIEW_GUID_FIELD=c;exports.EXPAND_FIELD=E;exports.HAS_CHILDREN_FIELD=e;exports.SELECT_FIELD=L;exports.TEXT_FIELD=D;
@@ -0,0 +1,21 @@
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
+ "use client";
9
+ const E = "expanded", e = "text", D = "disabled", I = "items", _ = "hasChildren", t = "selected", n = "checked", c = "checkIndeterminate", s = "_kendoItemId", L = "_kendoTreeViewGuid";
10
+ export {
11
+ n as CHECK_FIELD,
12
+ c as CHECK_INDETERMINATE_FIELD,
13
+ I as CHILDREN_FIELD,
14
+ D as DISABLED_FIELD,
15
+ s as DOM_KENDO_ITEM_ID_FIELD,
16
+ L as DOM_KENDO_TREEVIEW_GUID_FIELD,
17
+ E as EXPAND_FIELD,
18
+ _ as HAS_CHILDREN_FIELD,
19
+ t as SELECT_FIELD,
20
+ e as TEXT_FIELD
21
+ };
@@ -0,0 +1,8 @@
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
+ "use client";"use strict";const e=require("@progress/kendo-react-common");function p(d,t,n,l,r){switch(l){case e.Keys.left:return g();case e.Keys.right:return s();case e.Keys.up:return h();case e.Keys.down:return c();case e.Keys.home:return e.treeIdUtils.ZERO_LEVEL_ZERO_NODE_ID;case e.Keys.end:return U();default:return t}function g(){return e.treeIdUtils.isIdZeroLevel(t)||r.expanded(d)&&e.isEnabledAndAllParentsEnabled(t,n,r)?t:e.treeIdUtils.getDirectParentId(t)}function s(){return e.isItemExpandedAndWithChildren(d,r)?e.treeIdUtils.getFirstChildId(t):t}function h(){const i=Number(e.treeIdUtils.getShortId(t)),o=e.treeIdUtils.getDirectParentId(t);return i?a(e.treeIdUtils.createId(i-1,o),n,r):e.treeIdUtils.isIdZeroLevel(t)?t:o}function c(){return e.isItemExpandedAndWithChildren(d,r)?e.treeIdUtils.getFirstChildId(t):u(t,n,r)||t}function U(){let i=(n.length-1).toString(),o=n[n.length-1],I;for(;e.isItemExpandedAndWithChildren(o,r);)I=o[r.getChildrenField()],i=e.treeIdUtils.createId(I.length-1,i),o=I[I.length-1];return i}}function u(d,t,n){const l=e.treeIdUtils.getDirectParentId(d),r=l?e.treeIdUtils.getItemById(l,t,n.getChildrenField()):void 0,g=r?r[n.getChildrenField()]:t,s=Number(e.treeIdUtils.getShortId(d));return s<g.length-1?e.treeIdUtils.createId(s+1,l):r?u(l,t,n):void 0}function a(d,t,n){const l=e.treeIdUtils.getItemById(d,t,n.getChildrenField());return e.isItemExpandedAndWithChildren(l,n)?a(e.treeIdUtils.createId(l[n.getChildrenField()].length-1,d),t,n):d}module.exports=p;
@@ -0,0 +1,57 @@
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
+ "use client";
9
+ import { Keys as a, treeIdUtils as n, isEnabledAndAllParentsEnabled as E, isItemExpandedAndWithChildren as c } from "@progress/kendo-react-common";
10
+ function F(o, e, t, g, r) {
11
+ switch (g) {
12
+ case a.left:
13
+ return I();
14
+ case a.right:
15
+ return l();
16
+ case a.up:
17
+ return s();
18
+ case a.down:
19
+ return y();
20
+ case a.home:
21
+ return n.ZERO_LEVEL_ZERO_NODE_ID;
22
+ case a.end:
23
+ return C();
24
+ default:
25
+ return e;
26
+ }
27
+ function I() {
28
+ return n.isIdZeroLevel(e) || r.expanded(o) && E(e, t, r) ? e : n.getDirectParentId(e);
29
+ }
30
+ function l() {
31
+ return c(o, r) ? n.getFirstChildId(e) : e;
32
+ }
33
+ function s() {
34
+ const d = Number(n.getShortId(e)), u = n.getDirectParentId(e);
35
+ return d ? i(n.createId(d - 1, u), t, r) : n.isIdZeroLevel(e) ? e : u;
36
+ }
37
+ function y() {
38
+ return c(o, r) ? n.getFirstChildId(e) : p(e, t, r) || e;
39
+ }
40
+ function C() {
41
+ let d = (t.length - 1).toString(), u = t[t.length - 1], h;
42
+ for (; c(u, r); )
43
+ h = u[r.getChildrenField()], d = n.createId(h.length - 1, d), u = h[h.length - 1];
44
+ return d;
45
+ }
46
+ }
47
+ function p(o, e, t) {
48
+ const g = n.getDirectParentId(o), r = g ? n.getItemById(g, e, t.getChildrenField()) : void 0, I = r ? r[t.getChildrenField()] : e, l = Number(n.getShortId(o));
49
+ return l < I.length - 1 ? n.createId(l + 1, g) : r ? p(g, e, t) : void 0;
50
+ }
51
+ function i(o, e, t) {
52
+ const g = n.getItemById(o, e, t.getChildrenField());
53
+ return c(g, t) ? i(n.createId(g[t.getChildrenField()].length - 1, o), e, t) : o;
54
+ }
55
+ export {
56
+ F as default
57
+ };
@@ -1,17 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /**
6
- * The props of the ItemRender component ([see example]({% slug rendering_treeview %})).
7
- */
8
- export interface ItemRenderProps {
9
- /**
10
- * The item that is rendered.
11
- */
12
- item: any;
13
- /**
14
- * 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.
15
- */
16
- itemHierarchicalIndex: string;
17
- }
package/TreeView.d.ts DELETED
@@ -1,133 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import * as React from 'react';
6
- import PropTypes from 'prop-types';
7
- import { TreeViewProps } from './TreeViewProps';
8
- /**
9
- * @hidden
10
- */
11
- export interface TreeViewState {
12
- focusedItemId?: string;
13
- focusedItemPublicId?: any;
14
- tabbableItemId?: string;
15
- }
16
- /**
17
- * Represents the [KendoReact TreeView component]({% slug overview_treeview %}).
18
- *
19
- * @example
20
- * ```jsx
21
- * const data = [{
22
- * text: 'Furniture', expanded: true, items: [
23
- * { text: 'Tables & Chairs' }, { text: 'Sofas' }, { text: 'Occasional Furniture' }]
24
- * }, {
25
- * text: 'Decor', expanded: true, items: [
26
- * { text: 'Bed Linen' }, { text: 'Curtains & Blinds' }, { text: 'Carpets' }]
27
- * }];
28
- * class App extends React.Component {
29
- * render() {
30
- * return <TreeView data={data} />;
31
- * }
32
- * }
33
- * ReactDOM.render(<App />, document.querySelector('my-app'));
34
- * ```
35
- */
36
- export declare class TreeView extends React.Component<TreeViewProps, TreeViewState> {
37
- /**
38
- * @hidden
39
- */
40
- static propTypes: {
41
- data: PropTypes.Requireable<any[]>;
42
- animate: PropTypes.Requireable<boolean>;
43
- tabIndex: PropTypes.Requireable<number>;
44
- focusIdField: PropTypes.Requireable<string>;
45
- getHierarchicalIndexById: PropTypes.Requireable<(...args: any[]) => any>;
46
- onExpandChange: PropTypes.Requireable<(...args: any[]) => any>;
47
- onItemClick: PropTypes.Requireable<(...args: any[]) => any>;
48
- expandField: PropTypes.Requireable<string>;
49
- selectField: PropTypes.Requireable<string>;
50
- childrenField: PropTypes.Requireable<string>;
51
- hasChildrenField: PropTypes.Requireable<string>;
52
- textField: PropTypes.Requireable<string>;
53
- disableField: PropTypes.Requireable<string>;
54
- item: PropTypes.Requireable<any>;
55
- 'aria-multiselectable': (props: any, propName: string, componentName: string) => Error | null;
56
- 'aria-label': PropTypes.Requireable<string>;
57
- 'aria-labelledby': PropTypes.Requireable<string>;
58
- size: PropTypes.Requireable<"small" | "medium" | "large" | null | undefined>;
59
- dir: PropTypes.Requireable<string>;
60
- };
61
- /**
62
- * @hidden
63
- */
64
- static defaultProps: {
65
- animate: boolean;
66
- expandField: string;
67
- selectField: string;
68
- hasChildrenField: string;
69
- childrenField: string;
70
- textField: string;
71
- disableField: string;
72
- checkField: string;
73
- checkIndeterminateField: string;
74
- size: "small" | "medium" | "large" | null | undefined;
75
- };
76
- /**
77
- * @hidden
78
- */
79
- state: {
80
- focusedItemId: undefined;
81
- focusedItemPublicId: undefined;
82
- tabbableItemId: string;
83
- };
84
- private blurRequest;
85
- private fieldsSvc;
86
- private allowExplicitFocus;
87
- private get treeGuid();
88
- private _element;
89
- /**
90
- * @hidden
91
- */
92
- get element(): HTMLDivElement | null;
93
- constructor(props: TreeViewProps);
94
- /**
95
- * @hidden
96
- */
97
- render(): import("react/jsx-runtime").JSX.Element;
98
- /**
99
- * @hidden
100
- */
101
- componentDidUpdate(): void;
102
- private onFocusDomElNeeded;
103
- private onCheckChange;
104
- private onExpandChange;
105
- private onPress;
106
- private onDrag;
107
- private onRelease;
108
- private onItemClick;
109
- private onFocus;
110
- private onBlur;
111
- private onKeyDown;
112
- private dispatchEventsOnKeyDown;
113
- private setFocus;
114
- private onContextMenu;
115
- private getFocusedItem;
116
- private getItemById;
117
- private dispatchCheckChange;
118
- private dispatchExpandChange;
119
- private dispatchItemClick;
120
- private refocusDueToFocusIdField;
121
- private get ariaMultiSelectable();
122
- private get data();
123
- private focusDomItem;
124
- /**
125
- * Returns the `guid` which is associated with the TreeView.
126
- */
127
- get guid(): string;
128
- }
129
- /**
130
- * Represent the `ref` of the TreeView component.
131
- */
132
- export interface TreeViewHandle extends Pick<TreeView, keyof TreeView> {
133
- }
@@ -1,139 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { TreeViewItemDragOverEvent, TreeViewItemDragEndEvent } from './events';
6
- /**
7
- * A class which provides an API for analyzing the `drag` events
8
- * of the TreeView.
9
- *
10
- * @example
11
- * ```jsx
12
- * class App extends React.Component {
13
- * dragClue;
14
- * state = { tree };
15
- *
16
- * render() {
17
- * return (
18
- * <div>
19
- * <TreeView data={this.state.tree} draggable={true}
20
- * onItemDragOver={this.onItemDragOver} onItemDragEnd={this.onItemDragEnd} />
21
- * <TreeViewDragClue ref={dragClue => this.dragClue = dragClue} />
22
- * </div>
23
- * );
24
- * }
25
- *
26
- * onItemDragOver = (event) => {
27
- * this.dragClue.show(event.pageY + 10, event.pageX, event.item.text, this.getClueClassName(event));
28
- * }
29
- * onItemDragEnd = (event) => {
30
- * this.dragClue.hide();
31
- * const eventAnalyzer = new TreeViewDragAnalyzer(event).init();
32
- *
33
- * if (eventAnalyzer.isDropAllowed) {
34
- * const updatedTree = moveTreeViewItem(
35
- * event.itemHierarchicalIndex,
36
- * this.state.tree,
37
- * eventAnalyzer.getDropOperation(),
38
- * eventAnalyzer.destinationMeta.itemHierarchicalIndex,
39
- * );
40
- *
41
- * this.setState({ tree: updatedTree });
42
- * }
43
- * }
44
- * getClueClassName(event) {
45
- * const eventAnalyzer = new TreeViewDragAnalyzer(event).init();
46
- * const itemIndex = eventAnalyzer.destinationMeta.itemHierarchicalIndex;
47
- *
48
- * if (eventAnalyzer.isDropAllowed) {
49
- * switch (eventAnalyzer.getDropOperation()) {
50
- * case 'child':
51
- * return 'k-i-plus';
52
- * case 'before':
53
- * return itemIndex === '0' || itemIndex.endsWith(`${SEPARATOR}0`) ?
54
- * 'k-i-insert-up' : 'k-i-insert-middle';
55
- * case 'after':
56
- * const siblings = getSiblings(itemIndex, this.state.tree);
57
- * const lastIndex = Number(itemIndex.split(SEPARATOR).pop());
58
- *
59
- * return lastIndex < siblings.length - 1 ? 'k-i-insert-middle' : 'k-i-insert-down';
60
- * default:
61
- * break;
62
- * }
63
- * }
64
- *
65
- * return 'k-i-cancel';
66
- * }
67
- * }
68
- *
69
- * function getSiblings(itemIndex, data) {
70
- * let result = data;
71
- *
72
- * const indices = itemIndex.split(SEPARATOR).map(index => Number(index));
73
- * for (let i = 0; i < indices.length - 1; i++) {
74
- * result = result[indices[i]].items;
75
- * }
76
- *
77
- * return result;
78
- * }
79
- *
80
- * const SEPARATOR = '_';
81
- * const tree = [{
82
- * text: 'Furniture', expanded: true, items: [
83
- * { text: 'Tables & Chairs', expanded: true },
84
- * { text: 'Sofas', expanded: true },
85
- * { text: 'Occasional Furniture', expanded: true }]
86
- * }, {
87
- * text: 'Decor', expanded: true, items: [
88
- * { text: 'Bed Linen', expanded: true },
89
- * { text: 'Curtains & Blinds', expanded: true },
90
- * { text: 'Carpets', expanded: true }]
91
- * }];
92
- *
93
- * ReactDOM.render(<App />, document.querySelector('my-app'));
94
- * ```
95
- */
96
- export declare class TreeViewDragAnalyzer {
97
- private event;
98
- private itemId;
99
- private treeViewGuid;
100
- private initialized;
101
- private destDomNodeWithMeta;
102
- private destItemId;
103
- private destTreeViewGuid;
104
- /**
105
- * @param event - The event that will be analyzed.
106
- */
107
- constructor(event: TreeViewItemDragOverEvent | TreeViewItemDragEndEvent);
108
- /**
109
- * The method which initializes the analyzer.
110
- * Invoke the method before you call any other methods.
111
- *
112
- * @returns - The analyzer object of the `drag` event.
113
- */
114
- init(): this;
115
- /**
116
- * Returns `true` if dropping is allowed. Otherwise, returns `false`.
117
- */
118
- get isDropAllowed(): boolean;
119
- /**
120
- * Returns an object which contains:
121
- * * The `itemHierarchicalIndex` of the destination item (the item below the dragged item) and
122
- * * The `guid` of the destination TreeView (the TreeView which renders the destination item).
123
- */
124
- get destinationMeta(): {
125
- itemHierarchicalIndex: string;
126
- treeViewGuid: string;
127
- };
128
- /**
129
- * Returns the specific drop operation.
130
- *
131
- * @returns - The following values are returned:
132
- * * `before`&mdash;Indicates that the dragged item is positioned at the beginning of the destination item.
133
- * * `after`&mdash;Indicates that the dragged item is positioned at the end of the destination item.
134
- * * `child`&mdash;Indicates that the dragged item is positioned in the middle of the destination item.
135
- * * `undefined`&mdash;Indicates that dropping is not allowed.
136
- */
137
- getDropOperation(): "before" | "after" | "child" | undefined;
138
- private setDestimationMeta;
139
- }