@progress/kendo-react-treeview 7.2.4-develop.3 → 7.3.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.
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
package/TreeView.js ADDED
@@ -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 m=require("react"),a=require("prop-types"),l=require("@progress/kendo-react-common"),f=require("./utils/getItemIdUponKeyboardNavigation.js"),g=require("./TreeViewItem.js"),b=require("./package-metadata.js"),o=require("./utils/consts.js");function E(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const e in n)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(n,e);Object.defineProperty(t,e,s.get?s:{enumerable:!0,get:()=>n[e]})}}return t.default=n,Object.freeze(t)}const r=E(m),{sizeMap:F}=l.kendoThemeMaps,c=class c extends r.Component{constructor(t){super(t),this.state={focusedItemId:void 0,focusedItemPublicId:void 0,tabbableItemId:l.treeIdUtils.ZERO_LEVEL_ZERO_NODE_ID},this.fieldsSvc=null,this.allowExplicitFocus=!1,this._element=null,this.onFocusDomElNeeded=e=>{this.allowExplicitFocus&&this.focusDomItem(e)},this.onCheckChange=(e,s,i)=>{this.setFocus(i),this.dispatchCheckChange(e,s,i)},this.onExpandChange=(e,s,i)=>{this.setFocus(i),this.dispatchExpandChange(e,s,i)},this.onPress=(e,s,i)=>{this.props.onItemDragStart&&this.props.onItemDragStart.call(void 0,{target:this,item:s,itemHierarchicalIndex:i})},this.onDrag=(e,s,i)=>{const{pageX:d,pageY:h,clientX:u,clientY:p}=e;this.props.onItemDragOver&&this.props.onItemDragOver.call(void 0,{target:this,item:s,itemHierarchicalIndex:i,pageX:d,pageY:h,clientX:u,clientY:p})},this.onRelease=(e,s,i)=>{const{pageX:d,pageY:h,clientX:u,clientY:p}=e;this.props.onItemDragEnd&&this.props.onItemDragEnd.call(void 0,{target:this,item:s,itemHierarchicalIndex:i,pageX:d,pageY:h,clientX:u,clientY:p})},this.onItemClick=(e,s,i)=>{this.setFocus(i),this.dispatchItemClick(e,s,i)},this.onFocus=()=>{clearTimeout(this.blurRequest),this.state.focusedItemId===void 0&&this.data.length&&this.setFocus(this.state.tabbableItemId)},this.onBlur=()=>{clearTimeout(this.blurRequest),this.blurRequest=window.setTimeout(()=>this.setFocus(void 0),0)},this.onKeyDown=e=>{const s=this.getFocusedItem();if(s&&this.fieldsSvc){const i=f(s,this.state.focusedItemId,this.data,e.keyCode,this.fieldsSvc);i!==this.state.focusedItemId&&(e.preventDefault(),this.allowExplicitFocus=!0,this.setFocus(i)),this.dispatchEventsOnKeyDown(e,s)}},this.onContextMenu=(e,s,i)=>{if(this.props.onContextMenu){const d={target:this,syntheticEvent:e,nativeEvent:e.nativeEvent,item:s,itemID:i};this.props.onContextMenu.call(void 0,d)}},l.validatePackage(b.packageMetadata)}get treeGuid(){return this.props.id+"-accessibility-id"}get element(){return this._element}render(){this.fieldsSvc=new l.TreeFieldsService(this.props);const{size:t,className:e}=this.props;return r.createElement("div",{id:this.props.id,style:this.props.style?this.props.style:void 0,className:l.classNames("k-treeview",{[`k-treeview-${F[t]||t}`]:t,"k-user-select-none":this.props.draggable,"k-rtl":this.props.dir==="rtl"},e),onKeyDown:this.onKeyDown,onFocus:this.onFocus,onBlur:this.onBlur,role:"tree","aria-multiselectable":this.ariaMultiSelectable?!0:void 0,"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],ref:s=>this._element=s,tabIndex:this.props.tabIndex},r.createElement("ul",{className:"k-treeview-lines k-treeview-group",role:"group"},this.data.map((s,i)=>r.createElement(g.TreeViewItem,{id:this.props.id+"-item-"+i,item:s,position:i===0?"top":i===this.data.length-1?"bot":"mid",itemId:i.toString(),treeGuid:this.treeGuid,animate:this.props.animate,focusedItemId:this.state.focusedItemId,tabbableItemId:this.state.tabbableItemId,fieldsService:this.fieldsSvc,itemUI:this.props.item,checkboxes:this.props.checkboxes,ariaMultiSelectable:this.ariaMultiSelectable,onItemClick:this.onItemClick,onFocusDomElNeeded:this.onFocusDomElNeeded,draggable:this.props.draggable,onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease,expandIcons:this.props.expandIcons,onExpandChange:this.onExpandChange,onCheckChange:this.onCheckChange,onContextMenu:this.onContextMenu,key:i,size:t,isRtl:this.props.dir==="rtl"}))))}componentDidUpdate(){this.allowExplicitFocus=!1,this.refocusDueToFocusIdField()}dispatchEventsOnKeyDown(t,e){if(this.fieldsSvc===null)return;const s=()=>this.fieldsSvc&&l.isEnabledAndAllParentsEnabled(this.state.focusedItemId,this.data,this.fieldsSvc);t.keyCode===l.Keys.left&&this.fieldsSvc.expanded(e)&&s()?this.dispatchExpandChange(t,e,this.state.focusedItemId):t.keyCode===l.Keys.right&&!this.fieldsSvc.expanded(e)&&(this.fieldsSvc.hasChildren(e)||l.hasChildren(e,this.props.childrenField))&&s()?this.dispatchExpandChange(t,e,this.state.focusedItemId):t.keyCode===l.Keys.enter&&s()?this.dispatchItemClick(t,e,this.state.focusedItemId):t.keyCode===l.Keys.space&&s()&&(t.preventDefault(),this.dispatchCheckChange(t,e,this.state.focusedItemId))}setFocus(t){if(t&&this.fieldsSvc)if(this.fieldsSvc.focusIdField){const e=this.getItemById(t);this.setState({focusedItemId:t,focusedItemPublicId:this.fieldsSvc.focusId(e)})}else this.setState({focusedItemId:t});else this.setState(e=>({focusedItemId:void 0,focusedItemPublicId:void 0,tabbableItemId:e.focusedItemId}))}getFocusedItem(){return this.state.focusedItemId?this.getItemById(this.state.focusedItemId):void 0}getItemById(t){return l.treeIdUtils.getItemById(t,this.data,this.props.childrenField||o.CHILDREN_FIELD)}dispatchCheckChange(t,e,s){l.dispatchEvent(this.props.onCheckChange,t,this,{item:e,itemHierarchicalIndex:s})}dispatchExpandChange(t,e,s){l.dispatchEvent(this.props.onExpandChange,t,this,{item:e,itemHierarchicalIndex:s})}dispatchItemClick(t,e,s){l.dispatchEvent(this.props.onItemClick,t,this,{item:e,itemHierarchicalIndex:s})}refocusDueToFocusIdField(){if(this.fieldsSvc&&this.fieldsSvc.focusIdField){const t=this.state.focusedItemPublicId;if(t){const e=this.props.getFocusHierarchicalIndex?this.props.getFocusHierarchicalIndex(t):l.resolveItemId(t,this.fieldsSvc.focusIdField,this.data,this.props.childrenField);e!==this.state.focusedItemId&&(this.allowExplicitFocus=!0,this.setState({focusedItemId:e}))}}}get ariaMultiSelectable(){return this.props["aria-multiselectable"]===!0||this.props["aria-multiselectable"]==="true"}get data(){return this.props.data||[]}focusDomItem(t){t.focus()}get guid(){return this.treeGuid}};c.propTypes={data:a.arrayOf(a.any),animate:a.bool,tabIndex:a.number,focusIdField:a.string,getHierarchicalIndexById:a.func,onExpandChange:a.func,onItemClick:a.func,expandField:a.string,selectField:a.string,childrenField:a.string,hasChildrenField:a.string,textField:a.string,disableField:a.string,item:a.any,"aria-multiselectable":(t,e,s)=>t[e]!==void 0&&t[e]!==!0&&t[e]!==!1&&t[e]!=="true"&&t[e]!=="false"?new Error("Invalid prop `"+e+"` supplied to `"+s+"`. Validation failed."):null,"aria-label":a.string,"aria-labelledby":a.string,size:a.oneOf([null,"small","medium","large"]),dir:a.string},c.defaultProps={animate:!0,expandField:o.EXPAND_FIELD,selectField:o.SELECT_FIELD,hasChildrenField:o.HAS_CHILDREN_FIELD,childrenField:o.CHILDREN_FIELD,textField:o.TEXT_FIELD,disableField:o.DISABLED_FIELD,checkField:o.CHECK_FIELD,checkIndeterminateField:o.CHECK_INDETERMINATE_FIELD,size:"medium"};let I=c;exports.TreeView=I;
package/TreeView.mjs ADDED
@@ -0,0 +1,256 @@
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 * as o from "react";
10
+ import a from "prop-types";
11
+ import { treeIdUtils as u, validatePackage as f, TreeFieldsService as g, classNames as b, Keys as d, hasChildren as E, dispatchEvent as p, resolveItemId as F, kendoThemeMaps as C, isEnabledAndAllParentsEnabled as v } from "@progress/kendo-react-common";
12
+ import D from "./utils/getItemIdUponKeyboardNavigation.mjs";
13
+ import { TreeViewItem as x } from "./TreeViewItem.mjs";
14
+ import { packageMetadata as k } from "./package-metadata.mjs";
15
+ import { EXPAND_FIELD as S, SELECT_FIELD as y, HAS_CHILDREN_FIELD as w, CHILDREN_FIELD as I, TEXT_FIELD as _, DISABLED_FIELD as H, CHECK_FIELD as L, CHECK_INDETERMINATE_FIELD as M } from "./utils/consts.mjs";
16
+ const { sizeMap: P } = C, h = class h extends o.Component {
17
+ constructor(t) {
18
+ super(t), this.state = { focusedItemId: void 0, focusedItemPublicId: void 0, tabbableItemId: u.ZERO_LEVEL_ZERO_NODE_ID }, this.fieldsSvc = null, this.allowExplicitFocus = !1, this._element = null, this.onFocusDomElNeeded = (e) => {
19
+ this.allowExplicitFocus && this.focusDomItem(e);
20
+ }, this.onCheckChange = (e, i, s) => {
21
+ this.setFocus(s), this.dispatchCheckChange(e, i, s);
22
+ }, this.onExpandChange = (e, i, s) => {
23
+ this.setFocus(s), this.dispatchExpandChange(e, i, s);
24
+ }, this.onPress = (e, i, s) => {
25
+ this.props.onItemDragStart && this.props.onItemDragStart.call(
26
+ void 0,
27
+ { target: this, item: i, itemHierarchicalIndex: s }
28
+ );
29
+ }, this.onDrag = (e, i, s) => {
30
+ const { pageX: l, pageY: r, clientX: n, clientY: c } = e;
31
+ this.props.onItemDragOver && this.props.onItemDragOver.call(
32
+ void 0,
33
+ {
34
+ target: this,
35
+ item: i,
36
+ itemHierarchicalIndex: s,
37
+ pageX: l,
38
+ pageY: r,
39
+ clientX: n,
40
+ clientY: c
41
+ }
42
+ );
43
+ }, this.onRelease = (e, i, s) => {
44
+ const { pageX: l, pageY: r, clientX: n, clientY: c } = e;
45
+ this.props.onItemDragEnd && this.props.onItemDragEnd.call(
46
+ void 0,
47
+ {
48
+ target: this,
49
+ item: i,
50
+ itemHierarchicalIndex: s,
51
+ pageX: l,
52
+ pageY: r,
53
+ clientX: n,
54
+ clientY: c
55
+ }
56
+ );
57
+ }, this.onItemClick = (e, i, s) => {
58
+ this.setFocus(s), this.dispatchItemClick(e, i, s);
59
+ }, this.onFocus = () => {
60
+ clearTimeout(this.blurRequest), this.state.focusedItemId === void 0 && this.data.length && this.setFocus(this.state.tabbableItemId);
61
+ }, this.onBlur = () => {
62
+ clearTimeout(this.blurRequest), this.blurRequest = window.setTimeout(() => this.setFocus(void 0), 0);
63
+ }, this.onKeyDown = (e) => {
64
+ const i = this.getFocusedItem();
65
+ if (i && this.fieldsSvc) {
66
+ const s = D(i, this.state.focusedItemId, this.data, e.keyCode, this.fieldsSvc);
67
+ s !== this.state.focusedItemId && (e.preventDefault(), this.allowExplicitFocus = !0, this.setFocus(s)), this.dispatchEventsOnKeyDown(e, i);
68
+ }
69
+ }, this.onContextMenu = (e, i, s) => {
70
+ if (this.props.onContextMenu) {
71
+ const l = {
72
+ target: this,
73
+ syntheticEvent: e,
74
+ nativeEvent: e.nativeEvent,
75
+ item: i,
76
+ itemID: s
77
+ };
78
+ this.props.onContextMenu.call(void 0, l);
79
+ }
80
+ }, f(k);
81
+ }
82
+ get treeGuid() {
83
+ return this.props.id + "-accessibility-id";
84
+ }
85
+ /**
86
+ * @hidden
87
+ */
88
+ get element() {
89
+ return this._element;
90
+ }
91
+ /**
92
+ * @hidden
93
+ */
94
+ render() {
95
+ this.fieldsSvc = new g(this.props);
96
+ const { size: t, className: e } = this.props;
97
+ return /* @__PURE__ */ o.createElement(
98
+ "div",
99
+ {
100
+ id: this.props.id,
101
+ style: this.props.style ? this.props.style : void 0,
102
+ className: b(
103
+ "k-treeview",
104
+ {
105
+ [`k-treeview-${P[t] || t}`]: t,
106
+ "k-user-select-none": this.props.draggable,
107
+ "k-rtl": this.props.dir === "rtl"
108
+ },
109
+ e
110
+ ),
111
+ onKeyDown: this.onKeyDown,
112
+ onFocus: this.onFocus,
113
+ onBlur: this.onBlur,
114
+ role: "tree",
115
+ "aria-multiselectable": this.ariaMultiSelectable ? !0 : void 0,
116
+ "aria-label": this.props["aria-label"],
117
+ "aria-labelledby": this.props["aria-labelledby"],
118
+ ref: (i) => this._element = i,
119
+ tabIndex: this.props.tabIndex
120
+ },
121
+ /* @__PURE__ */ o.createElement("ul", { className: "k-treeview-lines k-treeview-group", role: "group" }, this.data.map((i, s) => /* @__PURE__ */ o.createElement(
122
+ x,
123
+ {
124
+ id: this.props.id + "-item-" + s,
125
+ item: i,
126
+ position: s === 0 ? "top" : s === this.data.length - 1 ? "bot" : "mid",
127
+ itemId: s.toString(),
128
+ treeGuid: this.treeGuid,
129
+ animate: this.props.animate,
130
+ focusedItemId: this.state.focusedItemId,
131
+ tabbableItemId: this.state.tabbableItemId,
132
+ fieldsService: this.fieldsSvc,
133
+ itemUI: this.props.item,
134
+ checkboxes: this.props.checkboxes,
135
+ ariaMultiSelectable: this.ariaMultiSelectable,
136
+ onItemClick: this.onItemClick,
137
+ onFocusDomElNeeded: this.onFocusDomElNeeded,
138
+ draggable: this.props.draggable,
139
+ onPress: this.onPress,
140
+ onDrag: this.onDrag,
141
+ onRelease: this.onRelease,
142
+ expandIcons: this.props.expandIcons,
143
+ onExpandChange: this.onExpandChange,
144
+ onCheckChange: this.onCheckChange,
145
+ onContextMenu: this.onContextMenu,
146
+ key: s,
147
+ size: t,
148
+ isRtl: this.props.dir === "rtl"
149
+ }
150
+ )))
151
+ );
152
+ }
153
+ /**
154
+ * @hidden
155
+ */
156
+ componentDidUpdate() {
157
+ this.allowExplicitFocus = !1, this.refocusDueToFocusIdField();
158
+ }
159
+ dispatchEventsOnKeyDown(t, e) {
160
+ if (this.fieldsSvc === null)
161
+ return;
162
+ const i = () => this.fieldsSvc && v(this.state.focusedItemId, this.data, this.fieldsSvc);
163
+ t.keyCode === d.left && this.fieldsSvc.expanded(e) && i() ? this.dispatchExpandChange(t, e, this.state.focusedItemId) : t.keyCode === d.right && !this.fieldsSvc.expanded(e) && (this.fieldsSvc.hasChildren(e) || E(e, this.props.childrenField)) && i() ? this.dispatchExpandChange(t, e, this.state.focusedItemId) : t.keyCode === d.enter && i() ? this.dispatchItemClick(t, e, this.state.focusedItemId) : t.keyCode === d.space && i() && (t.preventDefault(), this.dispatchCheckChange(t, e, this.state.focusedItemId));
164
+ }
165
+ setFocus(t) {
166
+ if (t && this.fieldsSvc)
167
+ if (this.fieldsSvc.focusIdField) {
168
+ const e = this.getItemById(t);
169
+ this.setState({ focusedItemId: t, focusedItemPublicId: this.fieldsSvc.focusId(e) });
170
+ } else
171
+ this.setState({ focusedItemId: t });
172
+ else
173
+ this.setState((e) => ({
174
+ focusedItemId: void 0,
175
+ focusedItemPublicId: void 0,
176
+ tabbableItemId: e.focusedItemId
177
+ }));
178
+ }
179
+ getFocusedItem() {
180
+ return this.state.focusedItemId ? this.getItemById(this.state.focusedItemId) : void 0;
181
+ }
182
+ getItemById(t) {
183
+ return u.getItemById(t, this.data, this.props.childrenField || I);
184
+ }
185
+ dispatchCheckChange(t, e, i) {
186
+ p(this.props.onCheckChange, t, this, { item: e, itemHierarchicalIndex: i });
187
+ }
188
+ dispatchExpandChange(t, e, i) {
189
+ p(this.props.onExpandChange, t, this, { item: e, itemHierarchicalIndex: i });
190
+ }
191
+ dispatchItemClick(t, e, i) {
192
+ p(this.props.onItemClick, t, this, { item: e, itemHierarchicalIndex: i });
193
+ }
194
+ refocusDueToFocusIdField() {
195
+ if (this.fieldsSvc && this.fieldsSvc.focusIdField) {
196
+ const t = this.state.focusedItemPublicId;
197
+ if (t) {
198
+ const e = this.props.getFocusHierarchicalIndex ? this.props.getFocusHierarchicalIndex(t) : F(t, this.fieldsSvc.focusIdField, this.data, this.props.childrenField);
199
+ e !== this.state.focusedItemId && (this.allowExplicitFocus = !0, this.setState({ focusedItemId: e }));
200
+ }
201
+ }
202
+ }
203
+ get ariaMultiSelectable() {
204
+ return this.props["aria-multiselectable"] === !0 || this.props["aria-multiselectable"] === "true";
205
+ }
206
+ get data() {
207
+ return this.props.data || [];
208
+ }
209
+ focusDomItem(t) {
210
+ t.focus();
211
+ }
212
+ /**
213
+ * Returns the `guid` which is associated with the TreeView.
214
+ */
215
+ get guid() {
216
+ return this.treeGuid;
217
+ }
218
+ };
219
+ h.propTypes = {
220
+ data: a.arrayOf(a.any),
221
+ animate: a.bool,
222
+ tabIndex: a.number,
223
+ focusIdField: a.string,
224
+ getHierarchicalIndexById: a.func,
225
+ onExpandChange: a.func,
226
+ onItemClick: a.func,
227
+ expandField: a.string,
228
+ selectField: a.string,
229
+ childrenField: a.string,
230
+ hasChildrenField: a.string,
231
+ textField: a.string,
232
+ disableField: a.string,
233
+ item: a.any,
234
+ "aria-multiselectable": (t, e, i) => t[e] !== void 0 && t[e] !== !0 && t[e] !== !1 && t[e] !== "true" && t[e] !== "false" ? new Error(
235
+ "Invalid prop `" + e + "` supplied to `" + i + "`. Validation failed."
236
+ ) : null,
237
+ "aria-label": a.string,
238
+ "aria-labelledby": a.string,
239
+ size: a.oneOf([null, "small", "medium", "large"]),
240
+ dir: a.string
241
+ }, h.defaultProps = {
242
+ animate: !0,
243
+ expandField: S,
244
+ selectField: y,
245
+ hasChildrenField: w,
246
+ childrenField: I,
247
+ textField: _,
248
+ disableField: H,
249
+ checkField: L,
250
+ checkIndeterminateField: M,
251
+ size: "medium"
252
+ };
253
+ let m = h;
254
+ export {
255
+ m as TreeView
256
+ };
@@ -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 i=require("./utils/consts.js"),s=6;class r{constructor(t){this.event=t,this.initialized=!1,this.destItemId="",this.destTreeViewGuid="",this.itemId=t.itemHierarchicalIndex,this.treeViewGuid=t.target.guid}init(){return this.initialized||(this.setDestimationMeta(document.elementFromPoint(this.event.clientX,this.event.clientY)),this.initialized=!0),this}get isDropAllowed(){return this.initialized&&this.destItemId&&this.destTreeViewGuid?!`${this.destTreeViewGuid}_${this.destItemId}_`.startsWith(`${this.treeViewGuid}_${this.itemId}_`):!1}get destinationMeta(){return{itemHierarchicalIndex:this.destItemId,treeViewGuid:this.destTreeViewGuid}}getDropOperation(){if(this.initialized&&this.isDropAllowed){const{top:t,height:e}=this.destDomNodeWithMeta.getBoundingClientRect();return t+e-this.event.clientY<s?"after":this.event.clientY-t<s?"before":"child"}else return}setDestimationMeta(t){let e=t;for(;e&&!e[i.DOM_KENDO_ITEM_ID_FIELD];)e=e.parentNode;e&&e[i.DOM_KENDO_ITEM_ID_FIELD]&&(this.destDomNodeWithMeta=e,this.destItemId=e[i.DOM_KENDO_ITEM_ID_FIELD],this.destTreeViewGuid=e[i.DOM_KENDO_TREEVIEW_GUID_FIELD])}}exports.TreeViewDragAnalyzer=r;
@@ -0,0 +1,66 @@
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 { DOM_KENDO_ITEM_ID_FIELD as i, DOM_KENDO_TREEVIEW_GUID_FIELD as r } from "./utils/consts.mjs";
10
+ const s = 6;
11
+ class h {
12
+ /**
13
+ * @param event - The event that will be analyzed.
14
+ */
15
+ constructor(t) {
16
+ this.event = t, this.initialized = !1, this.destItemId = "", this.destTreeViewGuid = "", this.itemId = t.itemHierarchicalIndex, this.treeViewGuid = t.target.guid;
17
+ }
18
+ /**
19
+ * The method which initializes the analyzer.
20
+ * Invoke the method before you call any other methods.
21
+ *
22
+ * @returns - The analyzer object of the `drag` event.
23
+ */
24
+ init() {
25
+ return this.initialized || (this.setDestimationMeta(document.elementFromPoint(this.event.clientX, this.event.clientY)), this.initialized = !0), this;
26
+ }
27
+ /**
28
+ * Returns `true` if dropping is allowed. Otherwise, returns `false`.
29
+ */
30
+ get isDropAllowed() {
31
+ return this.initialized && this.destItemId && this.destTreeViewGuid ? !`${this.destTreeViewGuid}_${this.destItemId}_`.startsWith(`${this.treeViewGuid}_${this.itemId}_`) : !1;
32
+ }
33
+ /**
34
+ * Returns an object which contains:
35
+ * * The `itemHierarchicalIndex` of the destination item (the item below the dragged item) and
36
+ * * The `guid` of the destination TreeView (the TreeView which renders the destination item).
37
+ */
38
+ get destinationMeta() {
39
+ return { itemHierarchicalIndex: this.destItemId, treeViewGuid: this.destTreeViewGuid };
40
+ }
41
+ /**
42
+ * Returns the specific drop operation.
43
+ *
44
+ * @returns - The following values are returned:
45
+ * * `before`&mdash;Indicates that the dragged item is positioned at the beginning of the destination item.
46
+ * * `after`&mdash;Indicates that the dragged item is positioned at the end of the destination item.
47
+ * * `child`&mdash;Indicates that the dragged item is positioned in the middle of the destination item.
48
+ * * `undefined`&mdash;Indicates that dropping is not allowed.
49
+ */
50
+ getDropOperation() {
51
+ if (this.initialized && this.isDropAllowed) {
52
+ const { top: t, height: e } = this.destDomNodeWithMeta.getBoundingClientRect();
53
+ return t + e - this.event.clientY < s ? "after" : this.event.clientY - t < s ? "before" : "child";
54
+ } else
55
+ return;
56
+ }
57
+ setDestimationMeta(t) {
58
+ let e = t;
59
+ for (; e && !e[i]; )
60
+ e = e.parentNode;
61
+ e && e[i] && (this.destDomNodeWithMeta = e, this.destItemId = e[i], this.destTreeViewGuid = e[r]);
62
+ }
63
+ }
64
+ export {
65
+ h as TreeViewDragAnalyzer
66
+ };
@@ -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 p=require("react"),i=require("@progress/kendo-react-common"),a=require("@progress/kendo-svg-icons");function u(s){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:()=>s[t]})}}return e.default=s,Object.freeze(e)}const n=u(p),l=class l extends n.PureComponent{constructor(){super(...arguments),this.state={visible:!1,top:0,left:0,text:"",operationClassName:"cancel"}}render(){const e={top:this.state.top+"px",left:this.state.left+"px"};return this.state.visible&&n.createElement("div",{className:"k-header k-drag-clue",style:{...this.props.style,...e}},n.createElement(i.IconWrap,{className:i.classNames("k-drag-status"),name:this.state.operationClassName&&i.toIconName(this.state.operationClassName),icon:this.state.operationClassName==="k-i-plus"?a.plusIcon:this.state.operationClassName==="k-i-insert-up"?a.insertTopIcon:this.state.operationClassName==="k-i-insert-down"?a.insertBottomIcon:this.state.operationClassName==="k-i-insert-middle"?a.insertMiddleIcon:a.cancelIcon}),this.state.text)}show(e,t,o,c){this.setState({visible:!0,top:e,left:t,text:o,operationClassName:c})}hide(){this.setState({visible:!1})}};l.defaultProps={style:{display:"block",position:"absolute",zIndex:2e4,padding:"4px 6px"}};let r=l;exports.TreeViewDragClue=r;
@@ -0,0 +1,58 @@
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 * as s from "react";
10
+ import { IconWrap as l, classNames as r, toIconName as p } from "@progress/kendo-react-common";
11
+ import { plusIcon as c, insertTopIcon as m, insertBottomIcon as d, insertMiddleIcon as h, cancelIcon as u } from "@progress/kendo-svg-icons";
12
+ const e = class e extends s.PureComponent {
13
+ constructor() {
14
+ super(...arguments), this.state = {
15
+ visible: !1,
16
+ top: 0,
17
+ left: 0,
18
+ text: "",
19
+ operationClassName: "cancel"
20
+ };
21
+ }
22
+ /**
23
+ * @hidden
24
+ */
25
+ render() {
26
+ const t = { top: this.state.top + "px", left: this.state.left + "px" };
27
+ return this.state.visible && /* @__PURE__ */ s.createElement("div", { className: "k-header k-drag-clue", style: { ...this.props.style, ...t } }, /* @__PURE__ */ s.createElement(
28
+ l,
29
+ {
30
+ className: r("k-drag-status"),
31
+ name: this.state.operationClassName && p(this.state.operationClassName),
32
+ icon: this.state.operationClassName === "k-i-plus" ? c : this.state.operationClassName === "k-i-insert-up" ? m : this.state.operationClassName === "k-i-insert-down" ? d : this.state.operationClassName === "k-i-insert-middle" ? h : u
33
+ }
34
+ ), this.state.text);
35
+ }
36
+ /**
37
+ * Displays the TreeViewDragClue component.
38
+ *
39
+ * @param top - The `top` CSS position of the component.
40
+ * @param left - The `left` CSS position of the component.
41
+ * @param text - The text of the component.
42
+ * @param operationClassName - The CSS class name which is related to the specific drop operation.
43
+ */
44
+ show(t, i, o, n) {
45
+ this.setState({ visible: !0, top: t, left: i, text: o, operationClassName: n });
46
+ }
47
+ /**
48
+ * Hides the TreeViewDragClue component.
49
+ */
50
+ hide() {
51
+ this.setState({ visible: !1 });
52
+ }
53
+ };
54
+ e.defaultProps = { style: { display: "block", position: "absolute", zIndex: 2e4, padding: "4px 6px" } };
55
+ let a = e;
56
+ export {
57
+ a as TreeViewDragClue
58
+ };
@@ -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 p=require("react"),n=require("@progress/kendo-react-common"),o=require("@progress/kendo-svg-icons"),m=require("@progress/kendo-react-animation"),h=require("./utils/consts.js");function I(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const s=I(p),{sizeMap:u}=n.kendoThemeMaps,l=s.createContext(r=>r),c=class c extends s.Component{constructor(){super(...arguments),this.onCheckChange=e=>{this.props.onCheckChange(e,this.item,this.itemId)},this.onExpandChange=e=>{this.props.onExpandChange(e,this.item,this.itemId)},this.onItemClick=e=>{this.props.onItemClick(e,this.item,this.itemId)},this.onPress=e=>{this.props.onPress(e.event,this.item,this.itemId)},this.onDrag=e=>{this.props.onDrag(e.event,this.item,this.itemId)},this.onRelease=e=>{this.props.onRelease(e.event,this.item,this.itemId)},this.onContextMenu=e=>{this.props.onContextMenu(e,this.item,this.itemId)},this.assignDraggableMeta=e=>{e&&(e[h.DOM_KENDO_ITEM_ID_FIELD]=this.props.itemId,e[h.DOM_KENDO_TREEVIEW_GUID_FIELD]=this.props.treeGuid)}}render(){const e=this.renderSubitemsIfApplicable(),t=this.renderItemInPart();return s.createElement("li",{className:n.classNames("k-treeview-item"),tabIndex:this.tabIndex,role:"treeitem","aria-expanded":this.ariaExpanded,"aria-selected":this.ariaSelected,"aria-checked":this.ariaChecked,"aria-disabled":this.disabled?!0:void 0,ref:i=>this.itemElement=i},s.createElement("div",{className:`k-treeview-${this.props.position}`,ref:this.assignDraggableMeta},this.renderExpandIcon(),this.renderCheckbox(),this.props.draggable?s.createElement(n.Draggable,{onPress:this.onPress,onDrag:this.onDrag,onRelease:this.onRelease},t):t),this.props.animate?s.createElement(m.Reveal,{transitionEnterDuration:200,transitionExitDuration:200,style:{display:"block"},children:e}):e)}componentDidMount(){const e=this.props.focusedItemId,t=this.itemId;e&&e===t&&this.props.onFocusDomElNeeded(this.itemElement),this.checkboxElement&&(this.checkboxElement.indeterminate=this.fieldsSvc.checkIndeterminate(this.item))}componentDidUpdate(e){const t=this.props.focusedItemId;if(t&&t!==e.focusedItemId&&t===this.itemId&&this.props.onFocusDomElNeeded(this.itemElement),this.checkboxElement){const i=this.fieldsSvc.checkIndeterminate(this.item);i!==e.fieldsService.checkIndeterminate(e.item)&&(this.checkboxElement.indeterminate=i)}}renderCheckbox(){if(this.props.checkboxes){const e=this.props.size;return s.createElement("div",{className:n.classNames("k-checkbox-wrap")},s.createElement("input",{type:"checkbox",className:n.classNames("k-checkbox k-rounded-md",{[`k-checkbox-${u[e]||e}`]:e,"k-disabled":this.disabled}),"aria-label":this.item.text,checked:!!this.fieldsSvc.checked(this.item),id:this.props.id,tabIndex:-1,onChange:this.onCheckChange,ref:t=>this.checkboxElement=t}),s.createElement("label",{className:"k-checkbox-label",htmlFor:this.props.id}))}else return}renderExpandIcon(){return this.props.expandIcons&&(this.fieldsSvc.hasChildren(this.item)||n.hasChildren(this.item,this.fieldsSvc.getChildrenField()))&&s.createElement("span",{className:n.classNames("k-treeview-toggle",{"k-disabled":this.disabled}),onClick:this.onExpandChange},s.createElement(n.IconWrap,{...this.getIconProps()}))}renderSubitemsIfApplicable(){const e=this.fieldsSvc.children(this.item);return n.isItemExpandedAndWithChildren(this.item,this.fieldsSvc)?s.createElement("ul",{className:"k-treeview-group",role:"group"},e.map((t,i)=>s.createElement(d,{item:t,position:i===0?"top":i===e.length-1?"bot":"mid",itemId:n.treeIdUtils.createId(i,this.itemId),treeGuid:this.props.treeGuid,animate:this.props.animate,focusedItemId:this.props.focusedItemId,tabbableItemId:this.props.tabbableItemId,fieldsService:this.props.fieldsService,itemUI:this.props.itemUI,checkboxes:this.props.checkboxes,ariaMultiSelectable:this.props.ariaMultiSelectable,onItemClick:this.props.onItemClick,onFocusDomElNeeded:this.props.onFocusDomElNeeded,draggable:this.props.draggable,onPress:this.props.onPress,onDrag:this.props.onDrag,onRelease:this.props.onRelease,expandIcons:this.props.expandIcons,onExpandChange:this.props.onExpandChange,onCheckChange:this.props.onCheckChange,onContextMenu:this.props.onContextMenu,key:i,size:this.props.size,disabled:this.disabled,isRtl:this.props.isRtl}))):void 0}renderItemInPart(){return s.createElement("span",{className:n.classNames("k-treeview-leaf",{"k-focus":this.props.focusedItemId===this.itemId,"k-selected":this.fieldsSvc.selected(this.item),"k-disabled":this.disabled}),style:{touchAction:"none"},onClick:this.onItemClick,onContextMenu:this.onContextMenu},s.createElement("span",{className:"k-treeview-leaf-text"},this.props.itemUI?s.createElement(this.props.itemUI,{item:this.item,itemHierarchicalIndex:this.itemId}):this.fieldsSvc.text(this.item)))}get fieldsSvc(){return this.props.fieldsService}get itemId(){return this.props.itemId}get item(){return this.props.item}get tabIndex(){return(this.props.focusedItemId||this.props.tabbableItemId)===this.itemId?0:-1}get ariaExpanded(){return this.fieldsSvc.hasChildren(this.item)||n.hasChildren(this.item,this.fieldsSvc.getChildrenField())?!!this.fieldsSvc.expanded(this.item):void 0}get disabled(){return this.props.disabled||this.fieldsSvc.disabled(this.item)}get ariaChecked(){if(this.props.checkboxes)return this.fieldsSvc.checked(this.item)?"true":this.fieldsSvc.checkIndeterminate(this.item)?"mixed":"false"}get ariaSelected(){return this.fieldsSvc.selected(this.item)?!0:this.props.ariaMultiSelectable?this.disabled?void 0:!1:void 0}getIconProps(){const e=this.fieldsSvc.expanded(this.item);return e&&!n.hasChildren(this.item,this.fieldsSvc.getChildrenField())?{name:"loading"}:e?{name:"caret-alt-down",icon:o.caretAltDownIcon}:{name:this.props.isRtl?"caret-alt-left":"caret-alt-right",icon:this.props.isRtl?o.caretAltLeftIcon:o.caretAltRightIcon}}};c.defaultProps={position:"top"};let a=c;const d=n.withIdHOC(s.forwardRef((r,e)=>{const i=s.useContext(l).call(void 0,r);return s.createElement(a,{ref:e,...i})}));d.displayName="TreeViewItem";exports.TreeViewItem=d;exports.TreeViewItemPropsContext=l;
@@ -0,0 +1,203 @@
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 * as t from "react";
10
+ import { classNames as r, Draggable as c, hasChildren as o, IconWrap as l, isItemExpandedAndWithChildren as p, treeIdUtils as m, withIdHOC as I, kendoThemeMaps as u } from "@progress/kendo-react-common";
11
+ import { caretAltDownIcon as b, caretAltLeftIcon as f, caretAltRightIcon as k } from "@progress/kendo-svg-icons";
12
+ import { Reveal as g } from "@progress/kendo-react-animation";
13
+ import { DOM_KENDO_ITEM_ID_FIELD as x, DOM_KENDO_TREEVIEW_GUID_FIELD as E } from "./utils/consts.mjs";
14
+ const { sizeMap: C } = u, v = t.createContext((n) => n), h = class h extends t.Component {
15
+ constructor() {
16
+ super(...arguments), this.onCheckChange = (e) => {
17
+ this.props.onCheckChange(e, this.item, this.itemId);
18
+ }, this.onExpandChange = (e) => {
19
+ this.props.onExpandChange(e, this.item, this.itemId);
20
+ }, this.onItemClick = (e) => {
21
+ this.props.onItemClick(e, this.item, this.itemId);
22
+ }, this.onPress = (e) => {
23
+ this.props.onPress(e.event, this.item, this.itemId);
24
+ }, this.onDrag = (e) => {
25
+ this.props.onDrag(e.event, this.item, this.itemId);
26
+ }, this.onRelease = (e) => {
27
+ this.props.onRelease(e.event, this.item, this.itemId);
28
+ }, this.onContextMenu = (e) => {
29
+ this.props.onContextMenu(e, this.item, this.itemId);
30
+ }, this.assignDraggableMeta = (e) => {
31
+ e && (e[x] = this.props.itemId, e[E] = this.props.treeGuid);
32
+ };
33
+ }
34
+ render() {
35
+ const e = this.renderSubitemsIfApplicable(), i = this.renderItemInPart();
36
+ return /* @__PURE__ */ t.createElement(
37
+ "li",
38
+ {
39
+ className: r("k-treeview-item"),
40
+ tabIndex: this.tabIndex,
41
+ role: "treeitem",
42
+ "aria-expanded": this.ariaExpanded,
43
+ "aria-selected": this.ariaSelected,
44
+ "aria-checked": this.ariaChecked,
45
+ "aria-disabled": this.disabled ? !0 : void 0,
46
+ ref: (s) => this.itemElement = s
47
+ },
48
+ /* @__PURE__ */ t.createElement("div", { className: `k-treeview-${this.props.position}`, ref: this.assignDraggableMeta }, this.renderExpandIcon(), this.renderCheckbox(), this.props.draggable ? /* @__PURE__ */ t.createElement(c, { onPress: this.onPress, onDrag: this.onDrag, onRelease: this.onRelease }, i) : i),
49
+ this.props.animate ? /* @__PURE__ */ t.createElement(
50
+ g,
51
+ {
52
+ transitionEnterDuration: 200,
53
+ transitionExitDuration: 200,
54
+ style: { display: "block" },
55
+ children: e
56
+ }
57
+ ) : e
58
+ );
59
+ }
60
+ componentDidMount() {
61
+ const e = this.props.focusedItemId, i = this.itemId;
62
+ e && e === i && this.props.onFocusDomElNeeded(this.itemElement), this.checkboxElement && (this.checkboxElement.indeterminate = this.fieldsSvc.checkIndeterminate(this.item));
63
+ }
64
+ componentDidUpdate(e) {
65
+ const i = this.props.focusedItemId;
66
+ if (i && i !== e.focusedItemId && i === this.itemId && this.props.onFocusDomElNeeded(this.itemElement), this.checkboxElement) {
67
+ const s = this.fieldsSvc.checkIndeterminate(this.item);
68
+ s !== e.fieldsService.checkIndeterminate(e.item) && (this.checkboxElement.indeterminate = s);
69
+ }
70
+ }
71
+ renderCheckbox() {
72
+ if (this.props.checkboxes) {
73
+ const e = this.props.size;
74
+ return /* @__PURE__ */ t.createElement("div", { className: r("k-checkbox-wrap") }, /* @__PURE__ */ t.createElement(
75
+ "input",
76
+ {
77
+ type: "checkbox",
78
+ className: r(
79
+ "k-checkbox k-rounded-md",
80
+ {
81
+ [`k-checkbox-${C[e] || e}`]: e,
82
+ "k-disabled": this.disabled
83
+ }
84
+ ),
85
+ "aria-label": this.item.text,
86
+ checked: !!this.fieldsSvc.checked(this.item),
87
+ id: this.props.id,
88
+ tabIndex: -1,
89
+ onChange: this.onCheckChange,
90
+ ref: (i) => this.checkboxElement = i
91
+ }
92
+ ), /* @__PURE__ */ t.createElement("label", { className: "k-checkbox-label", htmlFor: this.props.id }));
93
+ } else
94
+ return;
95
+ }
96
+ renderExpandIcon() {
97
+ return this.props.expandIcons && // If it is explicitly said that the item has children (even not loaded yet)
98
+ // or if the item actually has children, then render the icon.
99
+ (this.fieldsSvc.hasChildren(this.item) || o(this.item, this.fieldsSvc.getChildrenField())) && // Allowing the toggle-button even with `disabled=true` might be a valid case!
100
+ // Re-evaluate the classes bellow if such scenario occurs
101
+ /* @__PURE__ */ t.createElement("span", { className: r("k-treeview-toggle", { "k-disabled": this.disabled }), onClick: this.onExpandChange }, /* @__PURE__ */ t.createElement(l, { ...this.getIconProps() }));
102
+ }
103
+ renderSubitemsIfApplicable() {
104
+ const e = this.fieldsSvc.children(this.item);
105
+ return p(this.item, this.fieldsSvc) ? /* @__PURE__ */ t.createElement("ul", { className: "k-treeview-group", role: "group" }, e.map((i, s) => /* @__PURE__ */ t.createElement(
106
+ d,
107
+ {
108
+ item: i,
109
+ position: s === 0 ? "top" : s === e.length - 1 ? "bot" : "mid",
110
+ itemId: m.createId(s, this.itemId),
111
+ treeGuid: this.props.treeGuid,
112
+ animate: this.props.animate,
113
+ focusedItemId: this.props.focusedItemId,
114
+ tabbableItemId: this.props.tabbableItemId,
115
+ fieldsService: this.props.fieldsService,
116
+ itemUI: this.props.itemUI,
117
+ checkboxes: this.props.checkboxes,
118
+ ariaMultiSelectable: this.props.ariaMultiSelectable,
119
+ onItemClick: this.props.onItemClick,
120
+ onFocusDomElNeeded: this.props.onFocusDomElNeeded,
121
+ draggable: this.props.draggable,
122
+ onPress: this.props.onPress,
123
+ onDrag: this.props.onDrag,
124
+ onRelease: this.props.onRelease,
125
+ expandIcons: this.props.expandIcons,
126
+ onExpandChange: this.props.onExpandChange,
127
+ onCheckChange: this.props.onCheckChange,
128
+ onContextMenu: this.props.onContextMenu,
129
+ key: s,
130
+ size: this.props.size,
131
+ disabled: this.disabled,
132
+ isRtl: this.props.isRtl
133
+ }
134
+ ))) : void 0;
135
+ }
136
+ renderItemInPart() {
137
+ return /* @__PURE__ */ t.createElement(
138
+ "span",
139
+ {
140
+ className: r(
141
+ "k-treeview-leaf",
142
+ {
143
+ "k-focus": this.props.focusedItemId === this.itemId,
144
+ "k-selected": this.fieldsSvc.selected(this.item),
145
+ "k-disabled": this.disabled
146
+ }
147
+ ),
148
+ style: { touchAction: "none" },
149
+ onClick: this.onItemClick,
150
+ onContextMenu: this.onContextMenu
151
+ },
152
+ /* @__PURE__ */ t.createElement("span", { className: "k-treeview-leaf-text" }, this.props.itemUI ? /* @__PURE__ */ t.createElement(this.props.itemUI, { item: this.item, itemHierarchicalIndex: this.itemId }) : this.fieldsSvc.text(this.item))
153
+ );
154
+ }
155
+ get fieldsSvc() {
156
+ return this.props.fieldsService;
157
+ }
158
+ get itemId() {
159
+ return this.props.itemId;
160
+ }
161
+ get item() {
162
+ return this.props.item;
163
+ }
164
+ get tabIndex() {
165
+ return (this.props.focusedItemId || this.props.tabbableItemId) === this.itemId ? 0 : -1;
166
+ }
167
+ get ariaExpanded() {
168
+ return this.fieldsSvc.hasChildren(this.item) || o(this.item, this.fieldsSvc.getChildrenField()) ? !!this.fieldsSvc.expanded(this.item) : void 0;
169
+ }
170
+ get disabled() {
171
+ return this.props.disabled || this.fieldsSvc.disabled(this.item);
172
+ }
173
+ get ariaChecked() {
174
+ if (this.props.checkboxes)
175
+ return this.fieldsSvc.checked(this.item) ? "true" : this.fieldsSvc.checkIndeterminate(this.item) ? "mixed" : "false";
176
+ }
177
+ get ariaSelected() {
178
+ return this.fieldsSvc.selected(this.item) ? !0 : this.props.ariaMultiSelectable ? this.disabled ? void 0 : !1 : void 0;
179
+ }
180
+ getIconProps() {
181
+ const e = this.fieldsSvc.expanded(this.item);
182
+ return e && !o(this.item, this.fieldsSvc.getChildrenField()) ? { name: "loading" } : e ? { name: "caret-alt-down", icon: b } : { name: this.props.isRtl ? "caret-alt-left" : "caret-alt-right", icon: this.props.isRtl ? f : k };
183
+ }
184
+ };
185
+ h.defaultProps = {
186
+ position: "top"
187
+ };
188
+ let a = h;
189
+ const d = I(t.forwardRef((n, e) => {
190
+ const s = t.useContext(v).call(void 0, n);
191
+ return /* @__PURE__ */ t.createElement(
192
+ a,
193
+ {
194
+ ref: e,
195
+ ...s
196
+ }
197
+ );
198
+ }));
199
+ d.displayName = "TreeViewItem";
200
+ export {
201
+ d as TreeViewItem,
202
+ v as TreeViewItemPropsContext
203
+ };