@progress/kendo-react-treeview 15.1.1-develop.3 → 15.2.0-develop.2

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.mjs CHANGED
@@ -5,228 +5,300 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as l from "react";
8
+ import * as n from "react";
9
9
  import a from "prop-types";
10
- import { treeIdUtils as u, validatePackage as g, getLicenseMessage as F, TreeFieldsService as E, classNames as b, kendoThemeMaps as C, WatermarkOverlay as v, Keys as d, hasChildren as D, dispatchEvent as p, resolveItemId as x, isEnabledAndAllParentsEnabled as k } from "@progress/kendo-react-common";
11
- import S from "./utils/getItemIdUponKeyboardNavigation.mjs";
12
- import { getNodePosition as y } from "./utils/utils.mjs";
13
- import { TreeViewItem as w } from "./TreeViewItem.mjs";
14
- import { packageMetadata as I } from "./package-metadata.mjs";
15
- import { CHECK_INDETERMINATE_FIELD as L, CHECK_FIELD as _, DISABLED_FIELD as M, TEXT_FIELD as H, CHILDREN_FIELD as m, HAS_CHILDREN_FIELD as P, ICON_FIELD as R, SELECT_FIELD as T, EXPAND_FIELD as N } from "./utils/consts.mjs";
16
- const { sizeMap: O } = C, r = class r extends l.Component {
17
- constructor(t) {
18
- super(t), this.state = {
19
- focusedItemId: void 0,
20
- focusedItemPublicId: void 0,
21
- tabbableItemId: u.ZERO_LEVEL_ZERO_NODE_ID
22
- }, this.fieldsSvc = null, this.allowExplicitFocus = !1, this.showLicenseWatermark = !1, this._element = null, this.onFocusDomElNeeded = (e) => {
23
- this.allowExplicitFocus && this.focusDomItem(e);
24
- }, this.onCheckChange = (e, i, s) => {
25
- this.setFocus(s), this.dispatchCheckChange(e, i, s);
26
- }, this.onExpandChange = (e, i, s) => {
27
- this.setFocus(s), this.dispatchExpandChange(e, i, s);
28
- }, this.onPress = (e, i, s) => {
29
- this.props.onItemDragStart && this.props.onItemDragStart.call(void 0, { target: this, item: i, itemHierarchicalIndex: s });
30
- }, this.onDrag = (e, i, s) => {
31
- const { pageX: o, pageY: n, clientX: h, clientY: c } = e;
32
- this.props.onItemDragOver && this.props.onItemDragOver.call(void 0, {
33
- target: this,
34
- item: i,
35
- itemHierarchicalIndex: s,
36
- pageX: o,
37
- pageY: n,
38
- clientX: h,
39
- clientY: c
10
+ import { validatePackage as De, getLicenseMessage as ve, useId as Re, treeIdUtils as w, TreeFieldsService as xe, useWebMcpRegister as ye, dispatchEvent as T, Keys as L, hasChildren as we, resolveItemId as Le, classNames as _e, kendoThemeMaps as Se, WatermarkOverlay as Pe, isEnabledAndAllParentsEnabled as He } from "@progress/kendo-react-common";
11
+ import Te from "./utils/getItemIdUponKeyboardNavigation.mjs";
12
+ import { getNodePosition as Me } from "./utils/utils.mjs";
13
+ import { TreeViewItem as Oe } from "./TreeViewItem.mjs";
14
+ import { packageMetadata as Z } from "./package-metadata.mjs";
15
+ import { EXPAND_FIELD as Ne, SELECT_FIELD as Ve, ICON_FIELD as Ke, HAS_CHILDREN_FIELD as Ae, CHILDREN_FIELD as h, TEXT_FIELD as Xe, DISABLED_FIELD as Be, CHECK_FIELD as Ye, CHECK_INDETERMINATE_FIELD as Ze } from "./utils/consts.mjs";
16
+ const { sizeMap: ze } = Se, z = n.forwardRef((o, m) => {
17
+ const [_] = n.useState(
18
+ () => !De(Z, { component: "TreeView" })
19
+ ), [U] = n.useState(() => ve(Z)), {
20
+ animate: M = u.animate,
21
+ expandField: W = u.expandField,
22
+ selectField: $ = u.selectField,
23
+ iconField: O = u.iconField,
24
+ hasChildrenField: q = u.hasChildrenField,
25
+ childrenField: G = u.childrenField,
26
+ textField: j = u.textField,
27
+ disableField: J = u.disableField,
28
+ checkField: Q = u.checkField,
29
+ checkIndeterminateField: ee = u.checkIndeterminateField,
30
+ size: C,
31
+ className: te,
32
+ data: re,
33
+ id: ne,
34
+ style: ce,
35
+ tabIndex: ae,
36
+ expandIcons: ie,
37
+ item: le,
38
+ checkboxes: se,
39
+ draggable: N,
40
+ dir: V,
41
+ "aria-multiselectable": K,
42
+ "aria-label": de,
43
+ "aria-labelledby": oe
44
+ } = o, S = {
45
+ ...o,
46
+ animate: M,
47
+ expandField: W,
48
+ selectField: $,
49
+ iconField: O,
50
+ hasChildrenField: q,
51
+ childrenField: G,
52
+ textField: j,
53
+ disableField: J,
54
+ checkField: Q,
55
+ checkIndeterminateField: ee
56
+ }, E = Re(ne), k = re || [], A = E + "-accessibility-id", X = K === !0 || K === "true", B = n.useRef(null), P = n.useRef(void 0), p = n.useRef(!1), [D, v] = n.useState({
57
+ focusedItemId: void 0,
58
+ focusedItemPublicId: void 0,
59
+ tabbableItemId: w.ZERO_LEVEL_ZERO_NODE_ID
60
+ }), H = new xe(S), b = n.useRef(H);
61
+ b.current = H;
62
+ const g = n.useRef(D);
63
+ g.current = D;
64
+ const c = n.useRef(S);
65
+ c.current = S;
66
+ const R = n.useRef(k);
67
+ R.current = k;
68
+ const ue = (e) => {
69
+ e.focus();
70
+ }, I = n.useRef({
71
+ get element() {
72
+ return B.current;
73
+ },
74
+ get props() {
75
+ return c.current;
76
+ },
77
+ get guid() {
78
+ return A;
79
+ }
80
+ });
81
+ n.useImperativeHandle(m, () => I.current, []), ye("treeview", I, o, o.webMcp);
82
+ const x = n.useCallback(
83
+ (e, t, r) => {
84
+ T(c.current.onCheckChange, e, I.current, {
85
+ item: t,
86
+ itemHierarchicalIndex: r
40
87
  });
41
- }, this.onRelease = (e, i, s) => {
42
- const { pageX: o, pageY: n, clientX: h, clientY: c } = e;
43
- this.props.onItemDragEnd && this.props.onItemDragEnd.call(void 0, {
44
- target: this,
45
- item: i,
46
- itemHierarchicalIndex: s,
47
- pageX: o,
48
- pageY: n,
49
- clientX: h,
50
- clientY: c
88
+ },
89
+ []
90
+ ), F = n.useCallback(
91
+ (e, t, r) => {
92
+ T(c.current.onExpandChange, e, I.current, {
93
+ item: t,
94
+ itemHierarchicalIndex: r
51
95
  });
52
- }, this.onItemClick = (e, i, s) => {
53
- this.setFocus(s), this.dispatchItemClick(e, i, s);
54
- }, this.onFocus = () => {
55
- clearTimeout(this.blurRequest), this.state.focusedItemId === void 0 && this.data.length && this.setFocus(this.state.tabbableItemId);
56
- }, this.onBlur = () => {
57
- clearTimeout(this.blurRequest), this.blurRequest = window.setTimeout(() => this.setFocus(void 0), 0);
58
- }, this.onKeyDown = (e) => {
59
- const i = this.getFocusedItem();
60
- if (i && this.fieldsSvc) {
61
- const s = S(i, this.state.focusedItemId, this.data, e.keyCode, this.fieldsSvc);
62
- s !== this.state.focusedItemId && (e.preventDefault(), this.allowExplicitFocus = !0, this.setFocus(s)), this.dispatchEventsOnKeyDown(e, i);
63
- }
64
- }, this.onContextMenu = (e, i, s) => {
65
- if (this.props.onContextMenu) {
66
- const o = {
67
- target: this,
68
- syntheticEvent: e,
69
- nativeEvent: e.nativeEvent,
70
- item: i,
71
- itemID: s
72
- };
73
- this.props.onContextMenu.call(void 0, o);
74
- }
75
- }, this.showLicenseWatermark = !g(I, { component: "TreeView" }), this.licenseMessage = F(I);
76
- }
77
- get treeGuid() {
78
- return this.props.id + "-accessibility-id";
79
- }
80
- /**
81
- * @hidden
82
- */
83
- get element() {
84
- return this._element;
85
- }
86
- /**
87
- * @hidden
88
- */
89
- render() {
90
- this.fieldsSvc = new E(this.props);
91
- const { size: t, className: e } = this.props;
92
- return /* @__PURE__ */ l.createElement(
93
- "div",
94
- {
95
- id: this.props.id,
96
- style: { position: "relative", ...this.props.style },
97
- className: b(
98
- "k-treeview",
99
- {
100
- [`k-treeview-${O[t] || t}`]: t,
101
- "k-user-select-none": this.props.draggable,
102
- "k-rtl": this.props.dir === "rtl"
103
- },
104
- e
105
- ),
106
- onKeyDown: this.onKeyDown,
107
- onFocus: this.onFocus,
108
- onBlur: this.onBlur,
109
- ref: (i) => {
110
- this._element = i;
111
- },
112
- tabIndex: this.props.tabIndex
113
- },
114
- /* @__PURE__ */ l.createElement(
115
- "ul",
116
- {
117
- className: "k-treeview-lines k-treeview-group",
118
- role: "tree",
119
- "aria-multiselectable": this.ariaMultiSelectable ? !0 : void 0,
120
- "aria-label": this.props["aria-label"],
121
- "aria-labelledby": this.props["aria-labelledby"]
122
- },
123
- this.data.map((i, s) => /* @__PURE__ */ l.createElement(
124
- w,
125
- {
126
- id: this.props.id + "-item-" + s,
127
- item: i,
128
- position: y(s, this.data),
129
- itemId: s.toString(),
130
- treeGuid: this.treeGuid,
131
- animate: this.props.animate,
132
- focusedItemId: this.state.focusedItemId,
133
- tabbableItemId: this.state.tabbableItemId,
134
- fieldsService: this.fieldsSvc,
135
- itemUI: this.props.item,
136
- checkboxes: this.props.checkboxes,
137
- ariaMultiSelectable: this.ariaMultiSelectable,
138
- onItemClick: this.onItemClick,
139
- onFocusDomElNeeded: this.onFocusDomElNeeded,
140
- draggable: this.props.draggable,
141
- onPress: this.onPress,
142
- onDrag: this.onDrag,
143
- onRelease: this.onRelease,
144
- expandIcons: this.props.expandIcons,
145
- iconField: this.props.iconField,
146
- onExpandChange: this.onExpandChange,
147
- onCheckChange: this.onCheckChange,
148
- onContextMenu: this.onContextMenu,
149
- key: s,
150
- size: t,
151
- isRtl: this.props.dir === "rtl"
152
- }
153
- ))
154
- ),
155
- this.showLicenseWatermark && /* @__PURE__ */ l.createElement(v, { message: this.licenseMessage })
156
- );
157
- }
158
- /**
159
- * @hidden
160
- */
161
- componentDidUpdate() {
162
- this.allowExplicitFocus = !1, this.refocusDueToFocusIdField();
163
- }
164
- dispatchEventsOnKeyDown(t, e) {
165
- if (this.fieldsSvc === null)
166
- return;
167
- const i = () => this.fieldsSvc && k(this.state.focusedItemId, this.data, this.fieldsSvc);
168
- 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) || D(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));
169
- }
170
- setFocus(t) {
171
- if (t && this.fieldsSvc)
172
- if (this.fieldsSvc.focusIdField) {
173
- const e = this.getItemById(t);
174
- this.setState({ focusedItemId: t, focusedItemPublicId: this.fieldsSvc.focusId(e) });
96
+ },
97
+ []
98
+ ), y = n.useCallback(
99
+ (e, t, r) => {
100
+ T(c.current.onItemClick, e, I.current, {
101
+ item: t,
102
+ itemHierarchicalIndex: r
103
+ });
104
+ },
105
+ []
106
+ ), d = n.useCallback((e) => {
107
+ if (e && b.current)
108
+ if (b.current.focusIdField) {
109
+ const t = c.current.data || [], r = c.current.childrenField || h, i = w.getItemById(e, t, r);
110
+ v((l) => ({
111
+ ...l,
112
+ focusedItemId: e,
113
+ focusedItemPublicId: b.current.focusId(i)
114
+ }));
175
115
  } else
176
- this.setState({ focusedItemId: t });
116
+ v((t) => ({ ...t, focusedItemId: e }));
177
117
  else
178
- this.setState((e) => ({
118
+ v((t) => ({
119
+ ...t,
179
120
  focusedItemId: void 0,
180
121
  focusedItemPublicId: void 0,
181
- tabbableItemId: e.focusedItemId
122
+ tabbableItemId: t.focusedItemId
182
123
  }));
183
- }
184
- getFocusedItem() {
185
- return this.state.focusedItemId ? this.getItemById(this.state.focusedItemId) : void 0;
186
- }
187
- getItemById(t) {
188
- return u.getItemById(t, this.data, this.props.childrenField || m);
189
- }
190
- dispatchCheckChange(t, e, i) {
191
- p(this.props.onCheckChange, t, this, { item: e, itemHierarchicalIndex: i });
192
- }
193
- dispatchExpandChange(t, e, i) {
194
- p(this.props.onExpandChange, t, this, { item: e, itemHierarchicalIndex: i });
195
- }
196
- dispatchItemClick(t, e, i) {
197
- p(this.props.onItemClick, t, this, { item: e, itemHierarchicalIndex: i });
198
- }
199
- refocusDueToFocusIdField() {
200
- if (this.fieldsSvc && this.fieldsSvc.focusIdField) {
201
- const t = this.state.focusedItemPublicId;
202
- if (t) {
203
- const e = this.props.getFocusHierarchicalIndex ? this.props.getFocusHierarchicalIndex(t) : x(
204
- t,
205
- this.fieldsSvc.focusIdField,
206
- this.data,
207
- this.props.childrenField
124
+ }, []), Ie = n.useCallback((e) => {
125
+ p.current && ue(e);
126
+ }, []), me = n.useCallback(
127
+ (e, t, r) => {
128
+ d(r), x(e, t, r);
129
+ },
130
+ [d, x]
131
+ ), fe = n.useCallback(
132
+ (e, t, r) => {
133
+ d(r), F(e, t, r);
134
+ },
135
+ [d, F]
136
+ ), be = n.useCallback((e, t, r) => {
137
+ c.current.onItemDragStart && c.current.onItemDragStart({
138
+ target: I.current,
139
+ item: t,
140
+ itemHierarchicalIndex: r
141
+ });
142
+ }, []), ge = n.useCallback((e, t, r) => {
143
+ const { pageX: i, pageY: l, clientX: s, clientY: f } = e;
144
+ c.current.onItemDragOver && c.current.onItemDragOver({
145
+ target: I.current,
146
+ item: t,
147
+ itemHierarchicalIndex: r,
148
+ pageX: i,
149
+ pageY: l,
150
+ clientX: s,
151
+ clientY: f
152
+ });
153
+ }, []), Fe = n.useCallback((e, t, r) => {
154
+ const { pageX: i, pageY: l, clientX: s, clientY: f } = e;
155
+ c.current.onItemDragEnd && c.current.onItemDragEnd({
156
+ target: I.current,
157
+ item: t,
158
+ itemHierarchicalIndex: r,
159
+ pageX: i,
160
+ pageY: l,
161
+ clientX: s,
162
+ clientY: f
163
+ });
164
+ }, []), he = n.useCallback(
165
+ (e, t, r) => {
166
+ d(r), y(e, t, r);
167
+ },
168
+ [d, y]
169
+ ), Ce = n.useCallback(() => {
170
+ clearTimeout(P.current), g.current.focusedItemId === void 0 && R.current.length && d(g.current.tabbableItemId);
171
+ }, [d]), Ee = n.useCallback(() => {
172
+ clearTimeout(P.current), P.current = window.setTimeout(() => d(void 0), 0);
173
+ }, [d]), Y = n.useCallback(
174
+ (e, t) => {
175
+ const r = b.current;
176
+ if (r === null)
177
+ return;
178
+ const i = g.current, l = R.current, s = i.focusedItemId, f = () => r && He(s, l, r);
179
+ e.keyCode === L.left && r.expanded(t) && f() || e.keyCode === L.right && !r.expanded(t) && (r.hasChildren(t) || we(t, c.current.childrenField || h)) && f() ? F(e, t, s) : e.keyCode === L.enter && f() ? y(e, t, s) : e.keyCode === L.space && f() && (e.preventDefault(), x(e, t, s));
180
+ },
181
+ [F, y, x]
182
+ ), ke = n.useCallback(
183
+ (e) => {
184
+ const t = g.current, r = R.current, i = b.current, l = t.focusedItemId ? w.getItemById(
185
+ t.focusedItemId,
186
+ r,
187
+ c.current.childrenField || h
188
+ ) : void 0;
189
+ if (l && i) {
190
+ const s = Te(
191
+ l,
192
+ t.focusedItemId,
193
+ r,
194
+ e.keyCode,
195
+ i
208
196
  );
209
- e !== this.state.focusedItemId && (this.allowExplicitFocus = !0, this.setState({ focusedItemId: e }));
197
+ s !== t.focusedItemId && (e.preventDefault(), p.current = !0, d(s)), Y(e, l);
198
+ }
199
+ },
200
+ [d, Y]
201
+ ), pe = n.useCallback(
202
+ (e, t, r) => {
203
+ if (c.current.onContextMenu) {
204
+ const i = {
205
+ target: I.current,
206
+ syntheticEvent: e,
207
+ nativeEvent: e.nativeEvent,
208
+ item: t,
209
+ itemID: r
210
+ };
211
+ c.current.onContextMenu(i);
212
+ }
213
+ },
214
+ []
215
+ );
216
+ return n.useLayoutEffect(() => {
217
+ p.current = !1;
218
+ const e = b.current;
219
+ if (e != null && e.focusIdField) {
220
+ const t = g.current.focusedItemPublicId;
221
+ if (t) {
222
+ const r = c.current.data || [], i = c.current.childrenField || h, l = c.current.getFocusHierarchicalIndex ? c.current.getFocusHierarchicalIndex(t) : Le(t, e.focusIdField, r, i);
223
+ l !== g.current.focusedItemId && (p.current = !0, v((s) => ({ ...s, focusedItemId: l })));
210
224
  }
211
225
  }
212
- }
213
- get ariaMultiSelectable() {
214
- return this.props["aria-multiselectable"] === !0 || this.props["aria-multiselectable"] === "true";
215
- }
216
- get data() {
217
- return this.props.data || [];
218
- }
219
- focusDomItem(t) {
220
- t.focus();
221
- }
222
- /**
223
- * Returns the `guid` which is associated with the TreeView.
224
- */
225
- get guid() {
226
- return this.treeGuid;
227
- }
226
+ }), /* @__PURE__ */ n.createElement(
227
+ "div",
228
+ {
229
+ id: E,
230
+ style: { position: "relative", ...ce },
231
+ className: _e(
232
+ "k-treeview",
233
+ {
234
+ [`k-treeview-${ze[C] || C}`]: C,
235
+ "k-user-select-none": N,
236
+ "k-rtl": V === "rtl"
237
+ },
238
+ te
239
+ ),
240
+ onKeyDown: ke,
241
+ onFocus: Ce,
242
+ onBlur: Ee,
243
+ ref: B,
244
+ tabIndex: ae
245
+ },
246
+ /* @__PURE__ */ n.createElement(
247
+ "ul",
248
+ {
249
+ className: "k-treeview-lines k-treeview-group",
250
+ role: "tree",
251
+ "aria-multiselectable": X ? !0 : void 0,
252
+ "aria-label": de,
253
+ "aria-labelledby": oe
254
+ },
255
+ k.map((e, t) => /* @__PURE__ */ n.createElement(
256
+ Oe,
257
+ {
258
+ key: E + "-item-" + t,
259
+ id: E + "-item-" + t,
260
+ item: e,
261
+ position: Me(t, k),
262
+ itemId: t.toString(),
263
+ treeGuid: A,
264
+ animate: M,
265
+ focusedItemId: D.focusedItemId,
266
+ tabbableItemId: D.tabbableItemId || w.ZERO_LEVEL_ZERO_NODE_ID,
267
+ fieldsService: H,
268
+ itemUI: le,
269
+ checkboxes: se,
270
+ ariaMultiSelectable: X,
271
+ onItemClick: he,
272
+ onFocusDomElNeeded: Ie,
273
+ draggable: N,
274
+ onPress: be,
275
+ onDrag: ge,
276
+ onRelease: Fe,
277
+ expandIcons: ie,
278
+ iconField: O,
279
+ onExpandChange: fe,
280
+ onCheckChange: me,
281
+ onContextMenu: pe,
282
+ size: C,
283
+ isRtl: V === "rtl"
284
+ }
285
+ ))
286
+ ),
287
+ _ && /* @__PURE__ */ n.createElement(Pe, { message: U })
288
+ );
289
+ }), u = {
290
+ animate: !0,
291
+ expandField: Ne,
292
+ selectField: Ve,
293
+ iconField: Ke,
294
+ hasChildrenField: Ae,
295
+ childrenField: h,
296
+ textField: Xe,
297
+ disableField: Be,
298
+ checkField: Ye,
299
+ checkIndeterminateField: Ze
228
300
  };
229
- r.propTypes = {
301
+ z.propTypes = {
230
302
  data: a.arrayOf(a.any),
231
303
  animate: a.bool,
232
304
  tabIndex: a.number,
@@ -242,27 +314,14 @@ r.propTypes = {
242
314
  textField: a.string,
243
315
  disableField: a.string,
244
316
  item: a.any,
245
- "aria-multiselectable": (t, e, i) => t[e] !== void 0 && t[e] !== !0 && t[e] !== !1 && t[e] !== "true" && t[e] !== "false" ? new Error(
246
- "Invalid prop `" + e + "` supplied to `" + i + "`. Validation failed."
247
- ) : null,
317
+ "aria-multiselectable": (o, m, _) => o[m] !== void 0 && o[m] !== !0 && o[m] !== !1 && o[m] !== "true" && o[m] !== "false" ? new Error(`Invalid prop \`${m}\` supplied to \`${_}\`. Validation failed.`) : null,
248
318
  "aria-label": a.string,
249
319
  "aria-labelledby": a.string,
250
320
  size: a.oneOf(["small", "medium", "large"]),
251
321
  dir: a.string
252
- }, r.defaultProps = {
253
- animate: !0,
254
- expandField: N,
255
- selectField: T,
256
- iconField: R,
257
- hasChildrenField: P,
258
- childrenField: m,
259
- textField: H,
260
- disableField: M,
261
- checkField: _,
262
- checkIndeterminateField: L,
263
- size: void 0
264
322
  };
265
- let f = r;
323
+ z.displayName = "KendoReactTreeView";
266
324
  export {
267
- f as TreeView
325
+ z as TreeView,
326
+ u as treeViewDefaultProps
268
327
  };
@@ -26,6 +26,26 @@ export interface TreeViewDragClueState {
26
26
  text?: string;
27
27
  operationClassName?: string;
28
28
  }
29
+ /**
30
+ * Represent the `ref` of the TreeViewDragClue component.
31
+ */
32
+ export interface TreeViewDragClueHandle {
33
+ /**
34
+ * Displays the TreeViewDragClue component.
35
+ *
36
+ * @param top - The `top` CSS position of the component.
37
+ * @param left - The `left` CSS position of the component.
38
+ * @param text - The text of the component.
39
+ * @param operationClassName - The CSS class name which is related to the specific drop operation.
40
+ */
41
+ show: (top: number, left: number, text: string, operationClassName: string) => void;
42
+ /**
43
+ * Hides the TreeViewDragClue component.
44
+ */
45
+ hide: () => void;
46
+ }
47
+ /** The default props of the TreeViewDragClue component. */
48
+ export declare const treeViewDragClueDefaultProps: Partial<TreeViewDragClueProps>;
29
49
  /**
30
50
  * Represents the KendoReact TreeViewDragClue component which renders a clue when an item is dragged.
31
51
  *
@@ -110,37 +130,4 @@ export interface TreeViewDragClueState {
110
130
  * }
111
131
  * ```
112
132
  */
113
- export declare class TreeViewDragClue extends React.PureComponent<TreeViewDragClueProps, TreeViewDragClueState> {
114
- /**
115
- * @hidden
116
- */
117
- static defaultProps: {
118
- style: {
119
- display: string;
120
- position: string;
121
- zIndex: number;
122
- padding: string;
123
- };
124
- };
125
- /**
126
- * @hidden
127
- */
128
- readonly state: TreeViewDragClueState;
129
- /**
130
- * @hidden
131
- */
132
- render(): false | React.JSX.Element | undefined;
133
- /**
134
- * Displays the TreeViewDragClue component.
135
- *
136
- * @param top - The `top` CSS position of the component.
137
- * @param left - The `left` CSS position of the component.
138
- * @param text - The text of the component.
139
- * @param operationClassName - The CSS class name which is related to the specific drop operation.
140
- */
141
- show(top: number, left: number, text: string, operationClassName: string): void;
142
- /**
143
- * Hides the TreeViewDragClue component.
144
- */
145
- hide(): void;
146
- }
133
+ export declare const TreeViewDragClue: React.ForwardRefExoticComponent<TreeViewDragClueProps & React.RefAttributes<TreeViewDragClueHandle>>;
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "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 t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const e in s)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(s,e);Object.defineProperty(t,e,o.get?o:{enumerable:!0,get:()=>s[e]})}}return t.default=s,Object.freeze(t)}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 t={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,...t}},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(t,e,o,c){this.setState({visible:!0,top:t,left:e,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;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),l=require("@progress/kendo-react-common"),n=require("@progress/kendo-svg-icons");function v(a){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const s in a)if(s!=="default"){const e=Object.getOwnPropertyDescriptor(a,s);Object.defineProperty(r,s,e.get?e:{enumerable:!0,get:()=>a[s]})}}return r.default=a,Object.freeze(r)}const t=v(y),u={style:{display:"block",position:"absolute",zIndex:2e4,padding:"4px 6px"}},d=t.forwardRef((a,r)=>{const{style:s=u.style}=a,[e,c]=t.useState({visible:!1,top:0,left:0,text:"",operationClassName:"cancel"}),p=t.useCallback((o,b,C,k)=>{c({visible:!0,top:o,left:b,text:C,operationClassName:k})},[]),m=t.useCallback(()=>{c(o=>({...o,visible:!1}))},[]),i=t.useRef({show:()=>{},hide:()=>{}});i.current={show:p,hide:m},t.useImperativeHandle(r,()=>i.current);const f=t.useMemo(()=>{switch(e.operationClassName){case"k-i-plus":return n.plusIcon;case"k-i-insert-up":return n.insertTopIcon;case"k-i-insert-down":return n.insertBottomIcon;case"k-i-insert-middle":return n.insertMiddleIcon;default:return n.cancelIcon}},[e.operationClassName]);if(!e.visible)return null;const g={top:e.top+"px",left:e.left+"px"};return t.createElement("div",{className:"k-header k-drag-clue",style:{...s,...g}},t.createElement(l.IconWrap,{className:l.classNames("k-drag-status"),name:e.operationClassName&&l.toIconName(e.operationClassName),icon:f}),e.text)});d.displayName="KendoReactTreeViewDragClue";exports.TreeViewDragClue=d;exports.treeViewDragClueDefaultProps=u;