@progress/kendo-react-dropdowns 14.5.0-develop.8 → 14.5.0-develop.9
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/ComboBox/ComboBox.d.ts +1 -1
- package/ComboBox/ComboBox.js +1 -1
- package/ComboBox/ComboBox.mjs +1 -1
- package/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +69 -69
- package/DropDownTree/DropDownTree.js +1 -1
- package/DropDownTree/DropDownTree.mjs +13 -13
- package/common/AdaptiveMode.js +1 -1
- package/common/AdaptiveMode.mjs +10 -9
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +16 -11
|
@@ -9,14 +9,14 @@ import * as i from "react";
|
|
|
9
9
|
import C from "prop-types";
|
|
10
10
|
import { getLicenseMessage as Qt, usePropsContext as Xt, validatePackage as Zt, useUnstyled as Rt, useId as en, useKendoPaste as tn, canUseDOM as tt, useAdaptiveModeContext as nn, classNames as L, uDropDownList as P, getTabIndex as rn, IconWrap as on, createPropsContext as sn, Keys as h, WatermarkOverlay as an, sizeMap as ln, svgIconPropType as dn } from "@progress/kendo-react-common";
|
|
11
11
|
import { FloatingLabel as cn } from "@progress/kendo-react-labels";
|
|
12
|
-
import {
|
|
12
|
+
import { chevronDownIcon as un } from "@progress/kendo-svg-icons";
|
|
13
13
|
import pn from "../common/ListContainer.mjs";
|
|
14
14
|
import mn from "../common/ListFilter.mjs";
|
|
15
15
|
import nt from "../common/GroupStickyHeader.mjs";
|
|
16
16
|
import fn from "../common/ListDefaultItem.mjs";
|
|
17
|
-
import
|
|
17
|
+
import vn from "../common/List.mjs";
|
|
18
18
|
import dt from "../common/DropDownBase.mjs";
|
|
19
|
-
import { getFilteredData as E, getItemIndexByText as
|
|
19
|
+
import { getFilteredData as E, getItemIndexByText as gn, areSame as F, getItemValue as ne, isPresent as rt, itemIndexStartsWith as hn, sameCharsOnly as In, shuffleData as yn, matchText as ot } from "../common/utils.mjs";
|
|
20
20
|
import { packageMetadata as it } from "../package-metadata.mjs";
|
|
21
21
|
import { Button as wn } from "@progress/kendo-react-buttons";
|
|
22
22
|
import { useLocalization as xn } from "@progress/kendo-react-intl";
|
|
@@ -40,17 +40,17 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
40
40
|
features: e
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
const K = Rt(),
|
|
43
|
+
const K = Rt(), ve = en(n.id), ge = () => {
|
|
44
44
|
var e;
|
|
45
45
|
if (tt)
|
|
46
|
-
return ((e =
|
|
47
|
-
},
|
|
46
|
+
return ((e = B.current) == null ? void 0 : e.ownerDocument) || window.document;
|
|
47
|
+
}, vt = () => {
|
|
48
48
|
var e, r;
|
|
49
49
|
(e = t == null ? void 0 : t.current) != null && e.wrapper && ((r = t == null ? void 0 : t.current) == null || r.wrapper.focus({ preventScroll: !0 }));
|
|
50
50
|
}, k = () => {
|
|
51
51
|
let e;
|
|
52
|
-
return
|
|
53
|
-
},
|
|
52
|
+
return A.current !== void 0 && A.current !== null ? e = A.current : n.value !== void 0 ? e = n.value : m.value !== void 0 && m.value !== null ? e = m.value : n.defaultValue !== void 0 && n.defaultValue !== null && (e = n.defaultValue), !rt(e) && n.defaultItem !== void 0 && n.defaultItem !== null && (e = n.defaultItem), e;
|
|
53
|
+
}, gt = () => {
|
|
54
54
|
const { dataItemKey: e } = n, r = E(n), o = k();
|
|
55
55
|
return r.findIndex((l) => F(l, o, e));
|
|
56
56
|
}, he = () => n.required !== void 0 ? n.required : O.required, Ie = () => {
|
|
@@ -76,18 +76,18 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
76
76
|
);
|
|
77
77
|
}, V = (e, r) => {
|
|
78
78
|
const o = k();
|
|
79
|
-
F(o, e, n.dataItemKey) || (n.value === void 0 && (r.data.value = e), t.current.updateComponentArgs({ value: e }),
|
|
79
|
+
F(o, e, n.dataItemKey) || (n.value === void 0 && (r.data.value = e), t.current.updateComponentArgs({ value: e }), A.current = e, r.events.push({ type: "onChange" }));
|
|
80
80
|
}, M = (e) => {
|
|
81
81
|
var r;
|
|
82
|
-
(r = t == null ? void 0 : t.current) == null || r.applyState(e),
|
|
82
|
+
(r = t == null ? void 0 : t.current) == null || r.applyState(e), A.current = void 0;
|
|
83
83
|
}, Q = (e, r) => {
|
|
84
84
|
var u;
|
|
85
|
-
const { virtual: o, dataItemKey: l, defaultItem: a } = n, c = E(n), p = o ? o.skip : 0, f = k(), d = e === -1 && a !== void 0 ? a : c[e - p],
|
|
86
|
-
V(d, r),
|
|
85
|
+
const { virtual: o, dataItemKey: l, defaultItem: a } = n, c = E(n), p = o ? o.skip : 0, f = k(), d = e === -1 && a !== void 0 ? a : c[e - p], v = !F(d, f, l);
|
|
86
|
+
V(d, r), v && ((u = t == null ? void 0 : t.current) == null || u.triggerPageChangeCornerItems(d, r));
|
|
87
87
|
}, H = (e, r, o) => {
|
|
88
|
-
var S,
|
|
89
|
-
const { defaultItem: l, dataItemKey: a, virtual: c = { skip: 0, total: 0, pageSize: 0 } } = n, p = k(), f = E(n), d = (S = t == null ? void 0 : t.current) == null ? void 0 : S.vs,
|
|
90
|
-
current: c.skip +
|
|
88
|
+
var S, g;
|
|
89
|
+
const { defaultItem: l, dataItemKey: a, virtual: c = { skip: 0, total: 0, pageSize: 0 } } = n, p = k(), f = E(n), d = (S = t == null ? void 0 : t.current) == null ? void 0 : S.vs, v = f.findIndex((I) => F(I, p, a)), u = (g = t == null ? void 0 : t.current) == null ? void 0 : g.navigation.navigate({
|
|
90
|
+
current: c.skip + v,
|
|
91
91
|
max: (d != null && d.enabled ? c.total : f.length) - 1,
|
|
92
92
|
min: l !== void 0 ? -1 : 0,
|
|
93
93
|
keyCode: r,
|
|
@@ -95,7 +95,7 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
95
95
|
});
|
|
96
96
|
u !== void 0 && Q(u, e), M(e);
|
|
97
97
|
}, yt = (e) => {
|
|
98
|
-
|
|
98
|
+
B.current = e, t.current.wrapper = e;
|
|
99
99
|
}, wt = (e) => /* @__PURE__ */ i.createElement(
|
|
100
100
|
"select",
|
|
101
101
|
{
|
|
@@ -118,7 +118,7 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
118
118
|
filterable: a,
|
|
119
119
|
skipDisabledItems: c = !0
|
|
120
120
|
} = n, p = k(), f = E(n), d = n.filter ? n.filter : m.text;
|
|
121
|
-
return c && e && !d && !p ? f.findIndex((
|
|
121
|
+
return c && e && !d && !p ? f.findIndex((v) => !v.disabled) : rt(p) && d === void 0 || a && d === "" ? f.findIndex((v) => F(v, p, r)) : d ? Ce.current ? l(f, d, e) : f.findIndex((v) => F(v, p, r)) : o.skip === 0 ? 0 : -1;
|
|
122
122
|
}, Te = (e, r) => r !== void 0 && r !== -1 && e && e.length > 0 && e[r].disabled, xe = () => {
|
|
123
123
|
const e = E(n), r = t.current.initState(), o = we();
|
|
124
124
|
Te(e, o) && (V(null, r), M(r));
|
|
@@ -139,8 +139,8 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
139
139
|
dataItemKey: p,
|
|
140
140
|
groupField: f = "",
|
|
141
141
|
textField: d,
|
|
142
|
-
skipDisabledItems:
|
|
143
|
-
} = n, u = E(n), S = k(),
|
|
142
|
+
skipDisabledItems: v = !0
|
|
143
|
+
} = n, u = E(n), S = k(), g = u.findIndex((w) => F(w, S, p)), I = n.opened !== void 0 ? n.opened : m.opened, s = e.keyCode, N = s === h.home || s === h.end, b = s === h.up || s === h.down, Y = !I && (e.altKey && s === h.down || s === h.enter || s === h.space), te = I && (e.altKey && s === h.up || s === h.esc), ce = a && (s === h.left || s === h.right), ue = b || ce && !r || N, y = t.current.initState();
|
|
144
144
|
if (y.syntheticEvent = e, !o) {
|
|
145
145
|
if (N && ((T = t == null ? void 0 : t.current) != null && T.vs.enabled))
|
|
146
146
|
s === h.home ? c.skip !== 0 ? ((pe = t == null ? void 0 : t.current) == null || pe.triggerOnPageChange(y, 0, c.pageSize), W.current = !0) : V(u[0], y) : c.skip < c.total - c.pageSize ? ((G = t == null ? void 0 : t.current) == null || G.triggerOnPageChange(
|
|
@@ -159,21 +159,21 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
159
159
|
te && xe(), (et = t == null ? void 0 : t.current) == null || et.togglePopup(y), e.preventDefault();
|
|
160
160
|
else if (ue) {
|
|
161
161
|
if (Ce.current = !1, f !== "" && d)
|
|
162
|
-
if (!
|
|
162
|
+
if (!v && I)
|
|
163
163
|
H(y, s);
|
|
164
164
|
else {
|
|
165
165
|
let w;
|
|
166
166
|
if (s === h.down || s === h.right) {
|
|
167
|
-
const x = u.slice(
|
|
167
|
+
const x = u.slice(g + 1).find((D) => !D.disabled);
|
|
168
168
|
w = x && u.indexOf(x);
|
|
169
169
|
} else if (s === h.up || s === h.left) {
|
|
170
170
|
let x;
|
|
171
|
-
if (
|
|
171
|
+
if (g === 0 && l)
|
|
172
172
|
w = -1;
|
|
173
|
-
else if (
|
|
173
|
+
else if (g === -1)
|
|
174
174
|
x = u, w = u.findIndex((D) => !D.disabled);
|
|
175
175
|
else {
|
|
176
|
-
x = u.slice(0,
|
|
176
|
+
x = u.slice(0, g);
|
|
177
177
|
let D = x.pop();
|
|
178
178
|
for (; D && D.disabled; )
|
|
179
179
|
D = x.pop();
|
|
@@ -181,25 +181,25 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
if (w !== void 0) {
|
|
184
|
-
const x = w -
|
|
184
|
+
const x = w - g;
|
|
185
185
|
H(y, s, x);
|
|
186
|
-
} else w === void 0 &&
|
|
186
|
+
} else w === void 0 && g === u.length - 1 && H(y, s);
|
|
187
187
|
}
|
|
188
|
-
else if (!
|
|
188
|
+
else if (!v && I || N)
|
|
189
189
|
H(y, s);
|
|
190
190
|
else if (d) {
|
|
191
191
|
let w;
|
|
192
192
|
if (s === h.down || s === h.right) {
|
|
193
|
-
const x = u.slice(
|
|
193
|
+
const x = u.slice(g + 1).find((D) => !D.disabled);
|
|
194
194
|
w = x && u.indexOf(x);
|
|
195
195
|
} else if (s === h.up || s === h.left) {
|
|
196
196
|
let x;
|
|
197
|
-
if (
|
|
197
|
+
if (g === 0 && l)
|
|
198
198
|
w = -1;
|
|
199
|
-
else if (
|
|
199
|
+
else if (g === -1)
|
|
200
200
|
x = u, w = u.findIndex((D) => !D.disabled);
|
|
201
201
|
else {
|
|
202
|
-
x = u.slice(0,
|
|
202
|
+
x = u.slice(0, g);
|
|
203
203
|
let D = x.pop();
|
|
204
204
|
for (; D && D.disabled; )
|
|
205
205
|
D = x.pop();
|
|
@@ -207,9 +207,9 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
if (w !== void 0) {
|
|
210
|
-
const x = w -
|
|
210
|
+
const x = w - g;
|
|
211
211
|
H(y, s, x);
|
|
212
|
-
} else w === void 0 &&
|
|
212
|
+
} else w === void 0 && g === u.length - 1 && H(y, s);
|
|
213
213
|
} else
|
|
214
214
|
H(y, s);
|
|
215
215
|
e.preventDefault();
|
|
@@ -258,18 +258,18 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
258
258
|
);
|
|
259
259
|
}, Ct = (e, r) => {
|
|
260
260
|
var o;
|
|
261
|
-
(o = t == null ? void 0 : t.current) == null || o.handleItemClick(e, r),
|
|
261
|
+
(o = t == null ? void 0 : t.current) == null || o.handleItemClick(e, r), A.current = void 0;
|
|
262
262
|
}, kt = (e) => {
|
|
263
263
|
const { vs: r, list: o } = t.current;
|
|
264
264
|
r.scrollHandler(e);
|
|
265
265
|
const { groupField: l } = n;
|
|
266
266
|
let a = E(n);
|
|
267
267
|
if (!(!l || !a.length) && l) {
|
|
268
|
-
const c =
|
|
268
|
+
const c = Ae.current = Ae.current || (r.enabled ? r.itemHeight : o ? o.children[0].offsetHeight : 0), f = e.target.scrollTop - r.skip * c;
|
|
269
269
|
a = t.current.getGroupedDataModernMode(a, l);
|
|
270
270
|
let d = a[0][l];
|
|
271
|
-
for (let
|
|
272
|
-
a[
|
|
271
|
+
for (let v = 1; v < a.length && !(c * v > f); v++)
|
|
272
|
+
a[v] && a[v][l] && (d = a[v][l]);
|
|
273
273
|
d !== m.group && R({ group: d });
|
|
274
274
|
}
|
|
275
275
|
}, Ve = () => {
|
|
@@ -281,9 +281,9 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
281
281
|
groupHeaderItemRender: l,
|
|
282
282
|
listNoDataRender: a,
|
|
283
283
|
itemRender: c
|
|
284
|
-
} = n, p = E(n), f = K && K.uDropDownList, d = t.current.vs,
|
|
284
|
+
} = n, p = E(n), f = K && K.uDropDownList, d = t.current.vs, v = o.skip, u = n.opened !== void 0 ? n.opened : m.opened, S = t.current.getPopupSettings(), g = `translateY(${d.translate}px)`, I = k();
|
|
285
285
|
return /* @__PURE__ */ i.createElement(
|
|
286
|
-
|
|
286
|
+
vn,
|
|
287
287
|
{
|
|
288
288
|
id: Le,
|
|
289
289
|
show: u,
|
|
@@ -299,9 +299,9 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
299
299
|
},
|
|
300
300
|
wrapperStyle: { maxHeight: _ ? void 0 : S.height },
|
|
301
301
|
wrapperCssClass: L(P.listContent({ c: f })),
|
|
302
|
-
listStyle: d.enabled ? { transform:
|
|
302
|
+
listStyle: d.enabled ? { transform: g } : void 0,
|
|
303
303
|
key: "listkey",
|
|
304
|
-
skip:
|
|
304
|
+
skip: v,
|
|
305
305
|
onClick: Ct,
|
|
306
306
|
itemRender: c,
|
|
307
307
|
groupHeaderItemRender: l,
|
|
@@ -330,7 +330,7 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
330
330
|
}, bt = (e) => {
|
|
331
331
|
"onMouseDownOutside" in (n.popupSettings || {}) && n.popupSettings.onMouseDownOutside.call(void 0, e);
|
|
332
332
|
}, Pt = () => {
|
|
333
|
-
const { header: e, footer: r, dir: o, groupField: l, groupStickyHeaderItemRender: a, list: c } = n, p = E(n), f = t.current, d = f.getPopupSettings(),
|
|
333
|
+
const { header: e, footer: r, dir: o, groupField: l, groupStickyHeaderItemRender: a, list: c } = n, p = E(n), f = t.current, d = f.getPopupSettings(), v = n.opened !== void 0 ? n.opened : m.opened, u = d.width !== void 0 ? d.width : f.popupWidth, S = K && K.uDropDownList, g = {
|
|
334
334
|
dir: o !== void 0 ? o : f.dirCalculated,
|
|
335
335
|
width: u,
|
|
336
336
|
popupSettings: {
|
|
@@ -342,8 +342,8 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
342
342
|
popup: !0
|
|
343
343
|
})
|
|
344
344
|
),
|
|
345
|
-
anchor: d.anchor ||
|
|
346
|
-
show:
|
|
345
|
+
anchor: d.anchor || B.current,
|
|
346
|
+
show: v,
|
|
347
347
|
onOpen: ye,
|
|
348
348
|
onClose: Lt,
|
|
349
349
|
onMouseDownOutside: bt
|
|
@@ -351,7 +351,7 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
351
351
|
itemsCount: [p.length]
|
|
352
352
|
};
|
|
353
353
|
let { group: I } = m;
|
|
354
|
-
return I === void 0 && l !== void 0 && (I = ne(p[0], l)), /* @__PURE__ */ i.createElement(pn, { ...
|
|
354
|
+
return I === void 0 && l !== void 0 && (I = ne(p[0], l)), /* @__PURE__ */ i.createElement(pn, { ...g }, ze(!1), e && /* @__PURE__ */ i.createElement("div", { className: L(P.listHeader({ c: S })) }, e), /* @__PURE__ */ i.createElement(
|
|
355
355
|
"div",
|
|
356
356
|
{
|
|
357
357
|
className: L(
|
|
@@ -383,15 +383,15 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
383
383
|
const { dataItemKey: r } = n, o = E(n), l = k();
|
|
384
384
|
let a = o.map((b, Y) => ({ item: b, itemIndex: Y }));
|
|
385
385
|
const c = $.current.word, p = $.current.last, f = In(c, p);
|
|
386
|
-
let d = a.length,
|
|
386
|
+
let d = a.length, v = Math.max(
|
|
387
387
|
0,
|
|
388
388
|
o.findIndex((b) => F(b, l, r))
|
|
389
389
|
), u;
|
|
390
|
-
n.defaultItem && (u = { item: n.defaultItem, itemIndex: -1 }, d += 1,
|
|
391
|
-
let S,
|
|
390
|
+
n.defaultItem && (u = { item: n.defaultItem, itemIndex: -1 }, d += 1, v += 1), v += f ? 1 : 0, a = yn(a, v, u);
|
|
391
|
+
let S, g, I, s = 0;
|
|
392
392
|
const { textField: N } = n;
|
|
393
393
|
for (; s < d; ) {
|
|
394
|
-
if (S = ne(a[s].item, N),
|
|
394
|
+
if (S = ne(a[s].item, N), g = f && ot(S, p, J), I = ot(S, c, J), g || I) {
|
|
395
395
|
s = a[s].itemIndex;
|
|
396
396
|
break;
|
|
397
397
|
}
|
|
@@ -399,10 +399,10 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
399
399
|
}
|
|
400
400
|
if (s !== d) {
|
|
401
401
|
const b = t.current.initState();
|
|
402
|
-
b.syntheticEvent = e, Q(s, b), M(b),
|
|
402
|
+
b.syntheticEvent = e, Q(s, b), M(b), A.current = void 0;
|
|
403
403
|
}
|
|
404
404
|
}, Kt = (e) => {
|
|
405
|
-
clearTimeout(
|
|
405
|
+
clearTimeout(Be.current), n.filterable || (Be.current = window.setTimeout(() => $.current.word = "", mt), Mt(e));
|
|
406
406
|
}, Nt = (e) => {
|
|
407
407
|
oe.current || t.current.handleFocus(e);
|
|
408
408
|
}, Tt = (e) => {
|
|
@@ -421,15 +421,15 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
421
421
|
}, zt = () => {
|
|
422
422
|
const e = t.current.initState();
|
|
423
423
|
e.data.opened = m.opened, t.current.togglePopup(e), M(e);
|
|
424
|
-
}, He = i.useRef(null),
|
|
424
|
+
}, He = i.useRef(null), B = i.useRef(null), Se = i.useRef(null), X = i.useRef(null);
|
|
425
425
|
i.useImperativeHandle(
|
|
426
426
|
He,
|
|
427
427
|
() => ({
|
|
428
428
|
get element() {
|
|
429
|
-
return
|
|
429
|
+
return B.current;
|
|
430
430
|
},
|
|
431
431
|
get index() {
|
|
432
|
-
return
|
|
432
|
+
return gt();
|
|
433
433
|
},
|
|
434
434
|
get name() {
|
|
435
435
|
return n.name;
|
|
@@ -446,7 +446,7 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
446
446
|
get opened() {
|
|
447
447
|
return m.opened;
|
|
448
448
|
},
|
|
449
|
-
focus:
|
|
449
|
+
focus: vt,
|
|
450
450
|
props: n,
|
|
451
451
|
togglePopup: zt
|
|
452
452
|
})
|
|
@@ -454,7 +454,7 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
454
454
|
ut,
|
|
455
455
|
() => He.current
|
|
456
456
|
);
|
|
457
|
-
const
|
|
457
|
+
const Be = i.useRef(null), $ = i.useRef({ word: "", last: "" }), oe = i.useRef(!1), A = i.useRef(null), W = i.useRef(!1), Ce = i.useRef(!1), q = i.useRef({}), ke = i.useRef({}), t = i.useRef(
|
|
458
458
|
new dt({
|
|
459
459
|
props: n,
|
|
460
460
|
setState: () => {
|
|
@@ -467,23 +467,23 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
467
467
|
handleItemSelect: () => {
|
|
468
468
|
}
|
|
469
469
|
})
|
|
470
|
-
),
|
|
470
|
+
), Ae = i.useRef(0), Z = i.useRef(null), [m, Vt] = i.useState({}), [Ee, Ht] = i.useState(), [, We] = i.useReducer((e) => e, !0), qe = xn(), Ue = n.name || n.id, Bt = i.useCallback(
|
|
471
471
|
(e) => {
|
|
472
472
|
if (e == null || !t.current)
|
|
473
473
|
return;
|
|
474
|
-
const r = E(n), { textField: o } = n, l = String(e), a =
|
|
474
|
+
const r = E(n), { textField: o } = n, l = String(e), a = gn(r, l, o, !1, J), c = a !== -1 ? r[a] : void 0;
|
|
475
475
|
if (c !== void 0) {
|
|
476
476
|
const p = t.current.initState();
|
|
477
477
|
p.syntheticEvent = {
|
|
478
|
-
target:
|
|
478
|
+
target: B.current
|
|
479
479
|
}, V(c, p), M(p);
|
|
480
480
|
}
|
|
481
481
|
},
|
|
482
482
|
[n, J]
|
|
483
483
|
);
|
|
484
|
-
tn(
|
|
484
|
+
tn(B, {
|
|
485
485
|
fieldName: Ue,
|
|
486
|
-
onValueChange:
|
|
486
|
+
onValueChange: Bt,
|
|
487
487
|
enabled: !!Ue
|
|
488
488
|
});
|
|
489
489
|
const R = (e) => {
|
|
@@ -495,15 +495,15 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
495
495
|
setState: R,
|
|
496
496
|
state: m,
|
|
497
497
|
forceUpdate: We,
|
|
498
|
-
element:
|
|
498
|
+
element: B.current,
|
|
499
499
|
handleItemSelect: Q,
|
|
500
500
|
value: k()
|
|
501
501
|
});
|
|
502
502
|
}, [R, m, We, Q, k]), i.useEffect(() => {
|
|
503
|
-
var
|
|
503
|
+
var v, u, S, g, I, s, N, b, Y, te, ce, ue, y;
|
|
504
504
|
const { dataItemKey: e, virtual: r, groupField: o = "", textField: l } = n, a = E(n), c = q.current.virtual ? q.current.virtual.total : 0, p = n.opened !== void 0 ? n.opened : m.opened, f = q.current.opened !== void 0 ? q.current.opened : ke.current.opened, d = !f && p;
|
|
505
|
-
if ((
|
|
506
|
-
(S = t == null ? void 0 : t.current) == null || S.vs.calcScrollElementHeight(), (
|
|
505
|
+
if ((v = t == null ? void 0 : t.current) == null || v.didUpdate(), (u = t == null ? void 0 : t.current) != null && u.getPopupSettings().animate || d && ye(), r && r.total !== c)
|
|
506
|
+
(S = t == null ? void 0 : t.current) == null || S.vs.calcScrollElementHeight(), (g = t == null ? void 0 : t.current) == null || g.vs.reset();
|
|
507
507
|
else {
|
|
508
508
|
const T = k(), pe = q.current.value !== void 0 ? q.current.value : ke.current.value;
|
|
509
509
|
let G = a.findIndex((j) => F(j, T, e));
|
|
@@ -518,12 +518,12 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
518
518
|
W.current = !1, ke.current = m, q.current = n, Ne();
|
|
519
519
|
}), i.useEffect(() => {
|
|
520
520
|
var e, r;
|
|
521
|
-
return Z.current = tt && window.ResizeObserver && new window.ResizeObserver(It.bind(void 0)), (e = t == null ? void 0 : t.current) == null || e.didMount(), Ne(), (r =
|
|
521
|
+
return Z.current = tt && window.ResizeObserver && new window.ResizeObserver(It.bind(void 0)), (e = t == null ? void 0 : t.current) == null || e.didMount(), Ne(), (r = ge()) != null && r.body && Z.current && Z.current.observe(ge().body), () => {
|
|
522
522
|
var o;
|
|
523
|
-
(o =
|
|
523
|
+
(o = ge()) != null && o.body && Z.current && Z.current.disconnect();
|
|
524
524
|
};
|
|
525
525
|
}, []);
|
|
526
|
-
const _e =
|
|
526
|
+
const _e = ve + "-accessibility-id", Le = ve + "-listbox-id", Ge = ve + "-guid", At = qe.toLanguageString(
|
|
527
527
|
st,
|
|
528
528
|
at[st]
|
|
529
529
|
), {
|
|
@@ -594,7 +594,7 @@ const Cn = "Please select a value from the list!", Fe = i.forwardRef((ct, ut) =>
|
|
|
594
594
|
{
|
|
595
595
|
tabIndex: -1,
|
|
596
596
|
type: "button",
|
|
597
|
-
"aria-label":
|
|
597
|
+
"aria-label": At,
|
|
598
598
|
size: z,
|
|
599
599
|
fillMode: fe,
|
|
600
600
|
className: L(P.inputButton({ c: ee })),
|
|
@@ -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 et=require("react"),n=require("prop-types"),o=require("@progress/kendo-react-common"),tt=require("@progress/kendo-react-popup"),nt=require("@progress/kendo-react-intl"),Ie=require("@progress/kendo-react-treeview"),Se=require("../package-metadata.js"),G=require("../common/utils.js"),at=require("./useDropdownWidth.js"),ot=require("./ListNoData.js"),E=require("../messages/index.js"),rt=require("@progress/kendo-react-labels"),Re=require("../common/ListFilter.js"),st=require("@progress/kendo-react-buttons"),Te=require("@progress/kendo-svg-icons"),it=require("../common/AdaptiveMode.js"),lt=require("@progress/kendo-react-layout");function ct(u){const v=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const C in u)if(C!=="default"){const x=Object.getOwnPropertyDescriptor(u,C);Object.defineProperty(v,C,x.get?x:{enumerable:!0,get:()=>u[C]})}}return v.default=u,Object.freeze(v)}const t=ct(et),{sizeMap:ut,roundedMap:dt}=o.kendoThemeMaps,pt=12e3,ft=2e3,vt="Please select a value from the list!",mt=u=>t.createElement("span",{className:"k-input-value-text"},u.children),Me=u=>u.split("_").map(v=>parseInt(v,10)),gt=(u,v)=>{const{validationMessage:C,valid:x,required:s}=u;return{customError:C!==void 0,valid:!!(x!==void 0?x:!s||v),valueMissing:!v}},re={selectField:"selected",subItemsField:"items",popupSettings:{animate:!0,width:"200px",height:"200px"},data:[],required:!1,style:{},validityStyles:!0,size:void 0,rounded:void 0,fillMode:void 0},Pe=o.createPropsContext(),se=t.forwardRef((u,v)=>{const C=!o.validatePackage(Se.packageMetadata,{component:"DropDownTree"}),x=o.getLicenseMessage(Se.packageMetadata),s=o.usePropsContext(Pe,u),r={...re,...s},qe=o.useId(),ie=r.id||qe,{data:N,dataItemKey:L,popupSettings:m={},style:V,opened:d,disabled:R,onOpen:W=o.noop,onClose:g=o.noop,placeholder:j,label:T,name:Ke,selectField:Z,subItemsField:z,validationMessage:$,valid:Oe,required:J,validityStyles:Ne}=r,Q=o.getTabIndex(r.tabIndex,R),i=t.useRef(null),b=t.useRef(null),M=t.useRef(null),Y=t.useRef(null),U=t.useRef(null),D=t.useRef(null),X=t.useRef(!1),[le,Le]=t.useState(void 0),w=r.value!==void 0,y=w?r.value:le!==void 0?le:r.defaultValue,A=G.isPresent(y),ee=A?G.getItemValue(y,r.textField):"",te=gt({validationMessage:$,valid:Oe,required:J},A),ce=t.useContext(o.ZIndexContext),Ve=ce?ce+ft:pt,We=t.useCallback(()=>b.current&&b.current.focus(),[]);t.useImperativeHandle(i,()=>({props:r,element:b.current,focus:We})),t.useImperativeHandle(v,()=>i.current);const F=o.useRtl(b,r.dir),ze={width:at.useDropdownWidth(b,re,{...re.popupSettings,...m},V),...F!==void 0?{direction:F}:{}},[Ae,ue]=t.useState(!1),l=d!==void 0?d:Ae,[f,ne]=t.useState(!1),[ae,Be]=t.useState(),[de,_e]=t.useState(""),pe=o.useAdaptiveModeContext(),k=!!(ae&&pe&&ae<=pe.medium&&r.adaptive),He=t.useCallback(()=>{U.current&&U.current.setCustomValidity&&U.current.setCustomValidity(te.valid?"":$===void 0?vt:$)},[$,te]);t.useEffect(He),t.useEffect(()=>{const e=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(Qe.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{document!=null&&document.body&&e&&e.disconnect()}},[]);const fe=t.useCallback(e=>{if(!l){if(W){const a={...e};W.call(void 0,a)}d===void 0&&ue(!0)}},[l,d,W]),I=t.useCallback(e=>{if(l){if(g){const a={...e};g.call(void 0,a)}d===void 0&&(ue(!1),k&&setTimeout(()=>{var a;h((a=Y.current)==null?void 0:a.element)},300))}},[l,d,g,k]),ve=t.useCallback(e=>{if(!e.isDefaultPrevented()&&i.current){ne(!0);const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};(l?I:fe)(a)}},[l,d,W,g]),P=t.useCallback(e=>{X.current=!0,e(),window.setTimeout(()=>X.current=!1,0)},[]),je=t.useCallback(e=>{var S,we;const{keyCode:a,altKey:c}=e,p=D.current&&D.current.element;if(!i.current||e.isDefaultPrevented()&&((S=M.current)==null?void 0:S.element)===e.target)return;const K={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};if(l)if(a===o.Keys.esc||c&&a===o.Keys.up)e.preventDefault(),I(K);else if(p&&p.querySelector(".k-focus")&&(a===o.Keys.up||a===o.Keys.down||a===o.Keys.left||a===o.Keys.right||a===o.Keys.home||a===o.Keys.end)){if(a===o.Keys.up&&((we=M.current)!=null&&we.element)){const H=Array.from(p.querySelectorAll(".k-treeview-item")),Fe=[...H].reverse().find(O=>O==null?void 0:O.querySelector(".k-focus"));if(Fe&&H.indexOf(Fe)===0)return P(()=>{var O;h((O=M.current)==null?void 0:O.element)})}P(o.noop)}else a===o.Keys.down&&P(()=>{var H;h(((H=M.current)==null?void 0:H.element)||p)});else c&&a===o.Keys.down?(e.preventDefault(),fe(K)):l||a===o.Keys.esc&&ye(e)},[l,d,W,g]),me=t.useCallback(e=>{const{keyCode:a,altKey:c}=e;c||a!==o.Keys.up&&a!==o.Keys.down||(e.preventDefault(),P(a===o.Keys.up?()=>{h(b.current)}:()=>{var p;h((p=D.current)==null?void 0:p.element)}))},[]),h=t.useCallback(e=>{e&&P(()=>e.focus())},[]),Ze=t.useCallback(e=>{var a;m.onOpen&&m.onOpen(e),!f&&l&&!d?I({target:i.current}):s.filterable?h((a=M.current)==null?void 0:a.element):h(D.current&&D.current.element)},[g,s.filterable,f,d,l]),$e=t.useCallback(e=>{m.onClose&&m.onClose(e),f&&h(b.current)},[f]),Ue=t.useCallback(e=>{if(!f&&!X.current&&(ne(!0),s.onFocus&&i.current)){const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};s.onFocus.call(void 0,a)}},[f,s.onFocus]),Xe=t.useCallback(e=>{if(f&&!X.current&&i.current){ne(!1);const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};if(s.onBlur){const c={...a};s.onBlur.call(void 0,c)}k||I(a)}},[f,s.onBlur,l,d,g]),Ge=t.useCallback(()=>{f&&P(o.noop),k&&setTimeout(()=>{var e;h((e=Y.current)==null?void 0:e.element)},300)},[f,k]),ge=t.useCallback((e,a,c)=>{if(s.onChange){const p={value:a,level:c?Me(c):[],...e};s.onChange.call(void 0,p)}w||Le(a)},[s.onChange,w]),be=t.useCallback(e=>{if(G.areSame(e.item,y,L)||!i.current)return;const{item:a,itemHierarchicalIndex:c,nativeEvent:p,syntheticEvent:K}=e,S={syntheticEvent:K,nativeEvent:p,target:i.current};ge(S,a,c),I(S)},[w,y,s.onChange,L,l,d,g]),ye=t.useCallback(e=>{if(!i.current)return;const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};ge(a,null),I(a),e.preventDefault()},[w,s.onChange,l,d,g]),he=t.useCallback(e=>{if(e.syntheticEvent.stopPropagation(),s.onExpandChange&&i.current){const{item:a,itemHierarchicalIndex:c,nativeEvent:p,syntheticEvent:K}=e,S={level:Me(c),item:a,nativeEvent:p,syntheticEvent:K,target:i.current};s.onExpandChange.call(void 0,S)}},[s.onExpandChange]),Ee=t.useCallback(e=>{if(s.onFilterChange&&i.current){const c={filter:{field:s.textField,operator:"contains",value:e.target.value},syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:i.current};s.onFilterChange.call(void 0,c),s.filter===void 0&&_e(e.target.value)}},[s.onFilterChange,s.filter,s.textField]),Je=()=>{const e=r.filterable?t.createElement(Re,{value:r.filter===void 0?de:r.filter,ref:Y,onChange:Ee,onKeyDown:me,size:"large",rounded:B,fillMode:_,placeholder:j}):null,a={title:r.adaptiveTitle||T,subTitle:r.adaptiveSubtitle,expand:l,onClose:c=>I(c),windowWidth:ae,mobileFilter:e};return t.createElement(it.AdaptiveMode,{...a},t.createElement(lt.ActionSheetContent,null,N.length>0?t.createElement(Ie.TreeView,{ref:D,tabIndex:Q,data:Ce,focusIdField:L,textField:r.textField,selectField:Z,expandField:r.expandField,childrenField:z,expandIcons:!0,onItemClick:be,onExpandChange:he,size:"large",item:r.item,dir:F,animate:!1}):t.createElement(ke,null,oe.toLanguageString(E.nodata,E.messages[E.nodata]))))},Qe=t.useCallback(e=>{for(const a of e)Be(a.target.clientWidth)},[]),Ce=t.useMemo(()=>w||!A?N:o.mapTree(N,z,e=>o.extendDataItem(e,z,{[Z]:G.areSame(e,y,L)})),[N,y,w,A,Z,z]),ke=r.listNoData||ot.ListNoData,Ye=r.valueHolder||mt,oe=nt.useLocalization(),xe=!Ne||te.valid,{size:q,rounded:B,fillMode:_}=r,De=t.createElement(t.Fragment,null,t.createElement("span",{className:o.classNames("k-dropdowntree k-picker",r.className,{[`k-picker-${ut[q]||q}`]:q,[`k-rounded-${dt[B]||B}`]:B,[`k-picker-${_}`]:_,"k-focus":f,"k-invalid":!xe,"k-loading":r.loading,"k-required":J,"k-disabled":r.disabled}),tabIndex:Q,accessKey:r.accessKey,id:ie,style:T?{...V,width:void 0}:V,dir:F,ref:b,onKeyDown:R?void 0:je,onMouseDown:Ge,onClick:R?void 0:ve,onFocus:k?e=>ve(e):Ue,onBlur:Xe,role:"combobox","aria-haspopup":"tree","aria-expanded":l,"aria-disabled":R,"aria-label":T,"aria-labelledby":r.ariaLabelledBy,"aria-describedby":r.ariaDescribedBy,"aria-required":J},t.createElement("span",{className:"k-input-inner"},(ee||j)&&t.createElement(Ye,{item:y},ee||j)),r.loading&&t.createElement(o.IconWrap,{className:"k-input-loading-icon",name:"loading"}),A&&!R&&t.createElement("span",{onClick:ye,className:"k-clear-value",title:oe.toLanguageString(E.clear,E.messages[E.clear]),role:"button",tabIndex:-1,onMouseDown:e=>e.preventDefault()},t.createElement(o.IconWrap,{name:"x",icon:Te.xIcon})),t.createElement(st.Button,{tabIndex:-1,type:"button","aria-label":"select",className:"k-input-button",size:q,fillMode:_,icon:"caret-alt-down",svgIcon:Te.caretAltDownIcon}),t.createElement("select",{name:Ke,ref:U,tabIndex:-1,"aria-hidden":!0,title:T,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},t.createElement("option",{value:r.valueMap?r.valueMap.call(void 0,y):y})),!k&&t.createElement(o.ZIndexContext.Provider,{value:Ve},t.createElement(tt.Popup,{...m,className:o.classNames(m.className,{"k-rtl":F==="rtl"}),popupClass:o.classNames(m.popupClass,"k-dropdowntree-popup k-list-container"),style:ze,anchor:m.anchor||b.current,show:l,onOpen:Ze,onClose:$e},r.filterable&&t.createElement(Re,{value:r.filter===void 0?de:r.filter,ref:M,onChange:Ee,onKeyDown:me,size:q,rounded:B,fillMode:_,renderListFilterWrapper:!0,renderPrefixSeparator:!0}),N.length>0?t.createElement(Ie.TreeView,{style:{height:m.height},ref:D,tabIndex:Q,data:Ce,focusIdField:L,textField:r.textField,selectField:Z,expandField:r.expandField,childrenField:z,expandIcons:!0,onItemClick:be,onExpandChange:he,size:q,item:r.item,dir:F,animate:!1}):t.createElement(ke,null,oe.toLanguageString(E.nodata,E.messages[E.nodata])),C&&t.createElement(o.WatermarkOverlay,{message:x})))),k&&Je());return T?t.createElement(rt.FloatingLabel,{label:T,editorValue:ee,editorPlaceholder:j,editorValid:xe,editorDisabled:R,editorId:ie,style:{width:V?V.width:void 0},children:De,dir:F}):De}),bt={opened:n.bool,disabled:n.bool,dir:n.string,tabIndex:n.number,accessKey:n.string,data:n.array,value:n.any,valueMap:n.func,placeholder:n.string,dataItemKey:n.string.isRequired,textField:n.string.isRequired,selectField:n.string,expandField:n.string,subItemsField:n.string,className:n.string,style:n.object,label:n.string,validationMessage:n.string,validityStyles:n.bool,valid:n.bool,required:n.bool,name:n.string,id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,filterable:n.bool,filter:n.string,loading:n.bool,popupSettings:n.shape({animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),popupClass:n.string,className:n.string,appendTo:n.any,width:n.oneOfType([n.string,n.number]),height:n.oneOfType([n.string,n.number])}),onOpen:n.func,onClose:n.func,onFocus:n.func,onBlur:n.func,onChange:n.func,onFilterChange:n.func,onExpandChange:n.func,item:n.func,valueHolder:n.func,listNoData:n.func,adaptiveTitle:n.string,adaptiveSubtitle:n.string,adaptive:n.bool};se.displayName="KendoReactDropDownTree";se.propTypes=bt;exports.DropDownTree=se;exports.DropDownTreePropsContext=Pe;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const et=require("react"),n=require("prop-types"),a=require("@progress/kendo-react-common"),tt=require("@progress/kendo-react-popup"),nt=require("@progress/kendo-react-intl"),Ie=require("@progress/kendo-react-treeview"),Se=require("../package-metadata.js"),G=require("../common/utils.js"),ot=require("./useDropdownWidth.js"),at=require("./ListNoData.js"),E=require("../messages/index.js"),rt=require("@progress/kendo-react-labels"),Re=require("../common/ListFilter.js"),st=require("@progress/kendo-react-buttons"),Te=require("@progress/kendo-svg-icons"),it=require("../common/AdaptiveMode.js"),lt=require("@progress/kendo-react-layout");function ct(u){const v=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const C in u)if(C!=="default"){const x=Object.getOwnPropertyDescriptor(u,C);Object.defineProperty(v,C,x.get?x:{enumerable:!0,get:()=>u[C]})}}return v.default=u,Object.freeze(v)}const t=ct(et),{sizeMap:ut,roundedMap:dt}=a.kendoThemeMaps,pt=12e3,ft=2e3,vt="Please select a value from the list!",mt=u=>t.createElement("span",{className:"k-input-value-text"},u.children),Me=u=>u.split("_").map(v=>parseInt(v,10)),gt=(u,v)=>{const{validationMessage:C,valid:x,required:s}=u;return{customError:C!==void 0,valid:!!(x!==void 0?x:!s||v),valueMissing:!v}},re={selectField:"selected",subItemsField:"items",popupSettings:{animate:!0,width:"200px",height:"200px"},data:[],required:!1,style:{},validityStyles:!0,size:void 0,rounded:void 0,fillMode:void 0},Pe=a.createPropsContext(),se=t.forwardRef((u,v)=>{const C=!a.validatePackage(Se.packageMetadata,{component:"DropDownTree"}),x=a.getLicenseMessage(Se.packageMetadata),s=a.usePropsContext(Pe,u),r={...re,...s},qe=a.useId(),ie=r.id||qe,{data:N,dataItemKey:L,popupSettings:m={},style:V,opened:d,disabled:R,onOpen:W=a.noop,onClose:g=a.noop,placeholder:j,label:T,name:Ke,selectField:Z,subItemsField:z,validationMessage:$,valid:Oe,required:J,validityStyles:Ne}=r,Q=a.getTabIndex(r.tabIndex,R),i=t.useRef(null),b=t.useRef(null),M=t.useRef(null),Y=t.useRef(null),U=t.useRef(null),D=t.useRef(null),X=t.useRef(!1),[le,Le]=t.useState(void 0),w=r.value!==void 0,y=w?r.value:le!==void 0?le:r.defaultValue,B=G.isPresent(y),ee=B?G.getItemValue(y,r.textField):"",te=gt({validationMessage:$,valid:Oe,required:J},B),ce=t.useContext(a.ZIndexContext),Ve=ce?ce+ft:pt,We=t.useCallback(()=>b.current&&b.current.focus(),[]);t.useImperativeHandle(i,()=>({props:r,element:b.current,focus:We})),t.useImperativeHandle(v,()=>i.current);const F=a.useRtl(b,r.dir),ze={width:ot.useDropdownWidth(b,re,{...re.popupSettings,...m},V),...F!==void 0?{direction:F}:{}},[Be,ue]=t.useState(!1),l=d!==void 0?d:Be,[f,ne]=t.useState(!1),[oe,Ae]=t.useState(),[de,_e]=t.useState(""),pe=a.useAdaptiveModeContext(),k=!!(oe&&pe&&oe<=pe.medium&&r.adaptive),He=t.useCallback(()=>{U.current&&U.current.setCustomValidity&&U.current.setCustomValidity(te.valid?"":$===void 0?vt:$)},[$,te]);t.useEffect(He),t.useEffect(()=>{const e=a.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(Qe.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{document!=null&&document.body&&e&&e.disconnect()}},[]);const fe=t.useCallback(e=>{if(!l){if(W){const o={...e};W.call(void 0,o)}d===void 0&&ue(!0)}},[l,d,W]),I=t.useCallback(e=>{if(l){if(g){const o={...e};g.call(void 0,o)}d===void 0&&(ue(!1),k&&setTimeout(()=>{var o;h((o=Y.current)==null?void 0:o.element)},300))}},[l,d,g,k]),ve=t.useCallback(e=>{if(!e.isDefaultPrevented()&&i.current){ne(!0);const o={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};(l?I:fe)(o)}},[l,d,W,g]),P=t.useCallback(e=>{X.current=!0,e(),window.setTimeout(()=>X.current=!1,0)},[]),je=t.useCallback(e=>{var S,we;const{keyCode:o,altKey:c}=e,p=D.current&&D.current.element;if(!i.current||e.isDefaultPrevented()&&((S=M.current)==null?void 0:S.element)===e.target)return;const K={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};if(l)if(o===a.Keys.esc||c&&o===a.Keys.up)e.preventDefault(),I(K);else if(p&&p.querySelector(".k-focus")&&(o===a.Keys.up||o===a.Keys.down||o===a.Keys.left||o===a.Keys.right||o===a.Keys.home||o===a.Keys.end)){if(o===a.Keys.up&&((we=M.current)!=null&&we.element)){const H=Array.from(p.querySelectorAll(".k-treeview-item")),Fe=[...H].reverse().find(O=>O==null?void 0:O.querySelector(".k-focus"));if(Fe&&H.indexOf(Fe)===0)return P(()=>{var O;h((O=M.current)==null?void 0:O.element)})}P(a.noop)}else o===a.Keys.down&&P(()=>{var H;h(((H=M.current)==null?void 0:H.element)||p)});else c&&o===a.Keys.down?(e.preventDefault(),fe(K)):l||o===a.Keys.esc&&ye(e)},[l,d,W,g]),me=t.useCallback(e=>{const{keyCode:o,altKey:c}=e;c||o!==a.Keys.up&&o!==a.Keys.down||(e.preventDefault(),P(o===a.Keys.up?()=>{h(b.current)}:()=>{var p;h((p=D.current)==null?void 0:p.element)}))},[]),h=t.useCallback(e=>{e&&P(()=>e.focus())},[]),Ze=t.useCallback(e=>{var o;m.onOpen&&m.onOpen(e),!f&&l&&!d?I({target:i.current}):s.filterable?h((o=M.current)==null?void 0:o.element):h(D.current&&D.current.element)},[g,s.filterable,f,d,l]),$e=t.useCallback(e=>{m.onClose&&m.onClose(e),f&&h(b.current)},[f]),Ue=t.useCallback(e=>{if(!f&&!X.current&&(ne(!0),s.onFocus&&i.current)){const o={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};s.onFocus.call(void 0,o)}},[f,s.onFocus]),Xe=t.useCallback(e=>{if(f&&!X.current&&i.current){ne(!1);const o={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};if(s.onBlur){const c={...o};s.onBlur.call(void 0,c)}k||I(o)}},[f,s.onBlur,l,d,g]),Ge=t.useCallback(()=>{f&&P(a.noop),k&&setTimeout(()=>{var e;h((e=Y.current)==null?void 0:e.element)},300)},[f,k]),ge=t.useCallback((e,o,c)=>{if(s.onChange){const p={value:o,level:c?Me(c):[],...e};s.onChange.call(void 0,p)}w||Le(o)},[s.onChange,w]),be=t.useCallback(e=>{if(G.areSame(e.item,y,L)||!i.current)return;const{item:o,itemHierarchicalIndex:c,nativeEvent:p,syntheticEvent:K}=e,S={syntheticEvent:K,nativeEvent:p,target:i.current};ge(S,o,c),I(S)},[w,y,s.onChange,L,l,d,g]),ye=t.useCallback(e=>{if(!i.current)return;const o={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};ge(o,null),I(o),e.preventDefault()},[w,s.onChange,l,d,g]),he=t.useCallback(e=>{if(e.syntheticEvent.stopPropagation(),s.onExpandChange&&i.current){const{item:o,itemHierarchicalIndex:c,nativeEvent:p,syntheticEvent:K}=e,S={level:Me(c),item:o,nativeEvent:p,syntheticEvent:K,target:i.current};s.onExpandChange.call(void 0,S)}},[s.onExpandChange]),Ee=t.useCallback(e=>{if(s.onFilterChange&&i.current){const c={filter:{field:s.textField,operator:"contains",value:e.target.value},syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:i.current};s.onFilterChange.call(void 0,c),s.filter===void 0&&_e(e.target.value)}},[s.onFilterChange,s.filter,s.textField]),Je=()=>{const e=r.filterable?t.createElement(Re,{value:r.filter===void 0?de:r.filter,ref:Y,onChange:Ee,onKeyDown:me,size:"large",rounded:A,fillMode:_,placeholder:j}):null,o={title:r.adaptiveTitle||T,subTitle:r.adaptiveSubtitle,expand:l,onClose:c=>I(c),windowWidth:oe,mobileFilter:e};return t.createElement(it.AdaptiveMode,{...o},t.createElement(lt.ActionSheetContent,null,N.length>0?t.createElement(Ie.TreeView,{ref:D,tabIndex:Q,data:Ce,focusIdField:L,textField:r.textField,selectField:Z,expandField:r.expandField,childrenField:z,expandIcons:!0,onItemClick:be,onExpandChange:he,size:"large",item:r.item,dir:F,animate:!1}):t.createElement(ke,null,ae.toLanguageString(E.nodata,E.messages[E.nodata]))))},Qe=t.useCallback(e=>{for(const o of e)Ae(o.target.clientWidth)},[]),Ce=t.useMemo(()=>w||!B?N:a.mapTree(N,z,e=>a.extendDataItem(e,z,{[Z]:G.areSame(e,y,L)})),[N,y,w,B,Z,z]),ke=r.listNoData||at.ListNoData,Ye=r.valueHolder||mt,ae=nt.useLocalization(),xe=!Ne||te.valid,{size:q,rounded:A,fillMode:_}=r,De=t.createElement(t.Fragment,null,t.createElement("span",{className:a.classNames("k-dropdowntree k-picker",r.className,{[`k-picker-${ut[q]||q}`]:q,[`k-rounded-${dt[A]||A}`]:A,[`k-picker-${_}`]:_,"k-focus":f,"k-invalid":!xe,"k-loading":r.loading,"k-required":J,"k-disabled":r.disabled}),tabIndex:Q,accessKey:r.accessKey,id:ie,style:T?{...V,width:void 0}:V,dir:F,ref:b,onKeyDown:R?void 0:je,onMouseDown:Ge,onClick:R?void 0:ve,onFocus:k?e=>ve(e):Ue,onBlur:Xe,role:"combobox","aria-haspopup":"tree","aria-expanded":l,"aria-disabled":R,"aria-label":T,"aria-labelledby":r.ariaLabelledBy,"aria-describedby":r.ariaDescribedBy,"aria-required":J},t.createElement("span",{className:"k-input-inner"},(ee||j)&&t.createElement(Ye,{item:y},ee||j)),r.loading&&t.createElement(a.IconWrap,{className:"k-input-loading-icon",name:"loading"}),B&&!R&&t.createElement("span",{onClick:ye,className:"k-clear-value",title:ae.toLanguageString(E.clear,E.messages[E.clear]),role:"button",tabIndex:-1,onMouseDown:e=>e.preventDefault()},t.createElement(a.IconWrap,{name:"x",icon:Te.xIcon})),t.createElement(st.Button,{tabIndex:-1,type:"button","aria-label":"select",className:"k-input-button",size:q,fillMode:_,icon:"chevron-down",svgIcon:Te.chevronDownIcon}),t.createElement("select",{name:Ke,ref:U,tabIndex:-1,"aria-hidden":!0,title:T,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},t.createElement("option",{value:r.valueMap?r.valueMap.call(void 0,y):y})),!k&&t.createElement(a.ZIndexContext.Provider,{value:Ve},t.createElement(tt.Popup,{...m,className:a.classNames(m.className,{"k-rtl":F==="rtl"}),popupClass:a.classNames(m.popupClass,"k-dropdowntree-popup k-list-container"),style:ze,anchor:m.anchor||b.current,show:l,onOpen:Ze,onClose:$e},r.filterable&&t.createElement(Re,{value:r.filter===void 0?de:r.filter,ref:M,onChange:Ee,onKeyDown:me,size:q,rounded:A,fillMode:_,renderListFilterWrapper:!0,renderPrefixSeparator:!0}),N.length>0?t.createElement(Ie.TreeView,{style:{height:m.height},ref:D,tabIndex:Q,data:Ce,focusIdField:L,textField:r.textField,selectField:Z,expandField:r.expandField,childrenField:z,expandIcons:!0,onItemClick:be,onExpandChange:he,size:q,item:r.item,dir:F,animate:!1}):t.createElement(ke,null,ae.toLanguageString(E.nodata,E.messages[E.nodata])),C&&t.createElement(a.WatermarkOverlay,{message:x})))),k&&Je());return T?t.createElement(rt.FloatingLabel,{label:T,editorValue:ee,editorPlaceholder:j,editorValid:xe,editorDisabled:R,editorId:ie,style:{width:V?V.width:void 0},children:De,dir:F}):De}),bt={opened:n.bool,disabled:n.bool,dir:n.string,tabIndex:n.number,accessKey:n.string,data:n.array,value:n.any,valueMap:n.func,placeholder:n.string,dataItemKey:n.string.isRequired,textField:n.string.isRequired,selectField:n.string,expandField:n.string,subItemsField:n.string,className:n.string,style:n.object,label:n.string,validationMessage:n.string,validityStyles:n.bool,valid:n.bool,required:n.bool,name:n.string,id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,filterable:n.bool,filter:n.string,loading:n.bool,popupSettings:n.shape({animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),popupClass:n.string,className:n.string,appendTo:n.any,width:n.oneOfType([n.string,n.number]),height:n.oneOfType([n.string,n.number])}),onOpen:n.func,onClose:n.func,onFocus:n.func,onBlur:n.func,onChange:n.func,onFilterChange:n.func,onExpandChange:n.func,item:n.func,valueHolder:n.func,listNoData:n.func,adaptiveTitle:n.string,adaptiveSubtitle:n.string,adaptive:n.bool};se.displayName="KendoReactDropDownTree";se.propTypes=bt;exports.DropDownTree=se;exports.DropDownTreePropsContext=Pe;
|
|
@@ -19,14 +19,14 @@ import { clear as Ne, messages as ie, nodata as j } from "../messages/index.mjs"
|
|
|
19
19
|
import { FloatingLabel as xt } from "@progress/kendo-react-labels";
|
|
20
20
|
import Oe from "../common/ListFilter.mjs";
|
|
21
21
|
import { Button as wt } from "@progress/kendo-react-buttons";
|
|
22
|
-
import { xIcon as Dt,
|
|
22
|
+
import { xIcon as Dt, chevronDownIcon as Ft } from "@progress/kendo-svg-icons";
|
|
23
23
|
import { AdaptiveMode as It } from "../common/AdaptiveMode.mjs";
|
|
24
24
|
import { ActionSheetContent as St } from "@progress/kendo-react-layout";
|
|
25
25
|
const { sizeMap: Tt, roundedMap: Rt } = mt, Mt = 12e3, Pt = 2e3, Nt = "Please select a value from the list!", Ot = (E) => /* @__PURE__ */ t.createElement("span", { className: "k-input-value-text" }, E.children), Ve = (E) => E.split("_").map((D) => parseInt(D, 10)), Vt = (E, D) => {
|
|
26
|
-
const { validationMessage: G, valid:
|
|
26
|
+
const { validationMessage: G, valid: A, required: r } = E;
|
|
27
27
|
return {
|
|
28
28
|
customError: G !== void 0,
|
|
29
|
-
valid: !!(
|
|
29
|
+
valid: !!(A !== void 0 ? A : !r || D),
|
|
30
30
|
valueMissing: !D
|
|
31
31
|
};
|
|
32
32
|
}, le = {
|
|
@@ -45,7 +45,7 @@ const { sizeMap: Tt, roundedMap: Rt } = mt, Mt = 12e3, Pt = 2e3, Nt = "Please se
|
|
|
45
45
|
rounded: void 0,
|
|
46
46
|
fillMode: void 0
|
|
47
47
|
}, Lt = gt(), Le = t.forwardRef((E, D) => {
|
|
48
|
-
const G = !at(Me, { component: "DropDownTree" }),
|
|
48
|
+
const G = !at(Me, { component: "DropDownTree" }), A = rt(Me), r = it(Lt, E), a = {
|
|
49
49
|
...le,
|
|
50
50
|
...r
|
|
51
51
|
}, We = lt(), se = a.id || We, {
|
|
@@ -66,7 +66,7 @@ const { sizeMap: Tt, roundedMap: Rt } = mt, Mt = 12e3, Pt = 2e3, Nt = "Please se
|
|
|
66
66
|
valid: ze,
|
|
67
67
|
required: J,
|
|
68
68
|
validityStyles: qe
|
|
69
|
-
} = a, Q = st(a.tabIndex, F), i = t.useRef(null), v = t.useRef(null), S = t.useRef(null), Y = t.useRef(null), $ = t.useRef(null), y = t.useRef(null), U = t.useRef(!1), [ce,
|
|
69
|
+
} = a, Q = st(a.tabIndex, F), i = t.useRef(null), v = t.useRef(null), S = t.useRef(null), Y = t.useRef(null), $ = t.useRef(null), y = t.useRef(null), U = t.useRef(!1), [ce, Be] = t.useState(void 0), C = a.value !== void 0, g = C ? a.value : ce !== void 0 ? ce : a.defaultValue, K = yt(g), ee = K ? Et(g, a.textField) : "", te = Vt({ validationMessage: Z, valid: ze, required: J }, K), ue = t.useContext(Se), Ae = ue ? ue + Pt : Mt, He = t.useCallback(() => v.current && v.current.focus(), []);
|
|
70
70
|
t.useImperativeHandle(i, () => ({
|
|
71
71
|
props: a,
|
|
72
72
|
element: v.current,
|
|
@@ -147,8 +147,8 @@ const { sizeMap: Tt, roundedMap: Rt } = mt, Mt = 12e3, Pt = 2e3, Nt = "Please se
|
|
|
147
147
|
e.preventDefault(), x(M);
|
|
148
148
|
else if (d && d.querySelector(".k-focus") && (o === c.up || o === c.down || o === c.left || o === c.right || o === c.home || o === c.end)) {
|
|
149
149
|
if (o === c.up && ((Fe = S.current) != null && Fe.element)) {
|
|
150
|
-
const
|
|
151
|
-
if (Ie &&
|
|
150
|
+
const B = Array.from(d.querySelectorAll(".k-treeview-item")), Ie = [...B].reverse().find((P) => P == null ? void 0 : P.querySelector(".k-focus"));
|
|
151
|
+
if (Ie && B.indexOf(Ie) === 0)
|
|
152
152
|
return T(() => {
|
|
153
153
|
var P;
|
|
154
154
|
b((P = S.current) == null ? void 0 : P.element);
|
|
@@ -156,8 +156,8 @@ const { sizeMap: Tt, roundedMap: Rt } = mt, Mt = 12e3, Pt = 2e3, Nt = "Please se
|
|
|
156
156
|
}
|
|
157
157
|
T(X);
|
|
158
158
|
} else o === c.down && T(() => {
|
|
159
|
-
var
|
|
160
|
-
b(((
|
|
159
|
+
var B;
|
|
160
|
+
b(((B = S.current) == null ? void 0 : B.element) || d);
|
|
161
161
|
});
|
|
162
162
|
else s && o === c.down ? (e.preventDefault(), me(M)) : l || o === c.esc && Ee(e);
|
|
163
163
|
},
|
|
@@ -229,7 +229,7 @@ const { sizeMap: Tt, roundedMap: Rt } = mt, Mt = 12e3, Pt = 2e3, Nt = "Please se
|
|
|
229
229
|
};
|
|
230
230
|
r.onChange.call(void 0, d);
|
|
231
231
|
}
|
|
232
|
-
C ||
|
|
232
|
+
C || Be(o);
|
|
233
233
|
},
|
|
234
234
|
[r.onChange, C]
|
|
235
235
|
), he = t.useCallback(
|
|
@@ -391,7 +391,7 @@ const { sizeMap: Tt, roundedMap: Rt } = mt, Mt = 12e3, Pt = 2e3, Nt = "Please se
|
|
|
391
391
|
className: "k-input-button",
|
|
392
392
|
size: R,
|
|
393
393
|
fillMode: q,
|
|
394
|
-
icon: "
|
|
394
|
+
icon: "chevron-down",
|
|
395
395
|
svgIcon: Ft
|
|
396
396
|
}
|
|
397
397
|
),
|
|
@@ -407,7 +407,7 @@ const { sizeMap: Tt, roundedMap: Rt } = mt, Mt = 12e3, Pt = 2e3, Nt = "Please se
|
|
|
407
407
|
},
|
|
408
408
|
/* @__PURE__ */ t.createElement("option", { value: a.valueMap ? a.valueMap.call(void 0, g) : g })
|
|
409
409
|
),
|
|
410
|
-
!h && /* @__PURE__ */ t.createElement(Se.Provider, { value:
|
|
410
|
+
!h && /* @__PURE__ */ t.createElement(Se.Provider, { value: Ae }, /* @__PURE__ */ t.createElement(
|
|
411
411
|
bt,
|
|
412
412
|
{
|
|
413
413
|
...f,
|
|
@@ -454,7 +454,7 @@ const { sizeMap: Tt, roundedMap: Rt } = mt, Mt = 12e3, Pt = 2e3, Nt = "Please se
|
|
|
454
454
|
animate: !1
|
|
455
455
|
}
|
|
456
456
|
) : /* @__PURE__ */ t.createElement(xe, null, ae.toLanguageString(j, ie[j])),
|
|
457
|
-
G && /* @__PURE__ */ t.createElement(vt, { message:
|
|
457
|
+
G && /* @__PURE__ */ t.createElement(vt, { message: A })
|
|
458
458
|
))
|
|
459
459
|
), h && tt());
|
|
460
460
|
return I ? /* @__PURE__ */ t.createElement(
|
package/common/AdaptiveMode.js
CHANGED
|
@@ -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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react"),r=require("@progress/kendo-react-layout"),h=require("@progress/kendo-svg-icons"),i=require("@progress/kendo-react-buttons"),s=require("@progress/kendo-react-common");function k(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const o=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(e,a,o.get?o:{enumerable:!0,get:()=>t[a]})}}return e.default=t,Object.freeze(e)}const n=k(v),C=t=>{const{footer:e,windowWidth:a=0,mobileFilter:o,children:d,navigatable:u,navigatableElements:p,expand:b,animation:m,title:f,subTitle:g,onClose:c}=t,l=s.useAdaptiveModeContext(),y={navigatable:u||!1,navigatableElements:p||[],expand:b,animation:m!==!1,suffixActions:n.createElement(i.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",size:"large",themeColor:"primary",svgIcon:h.checkIcon,onClick:c}),filter:o,onClose:c,animationStyles:l&&a<=l.small?{top:0,width:"100%",height:"100%"}:void 0,title:f,subTitle:g,className:"k-adaptive-actionsheet",position:l&&a<=l.small?"fullscreen":void 0,appendTo:s.canUseDOM?document.body:null};return n.createElement(r.ActionSheet,{...y},d,e&&n.createElement(r.ActionSheetFooter,{className:"k-actions k-actions-stretched"},n.createElement(i.Button,{size:"large",tabIndex:0,"aria-label":e.cancelText,"aria-disabled":"false",type:"button",onClick:e.onCancel},e.cancelText),n.createElement(i.Button,{tabIndex:0,themeColor:"primary",size:"large","aria-label":e.applyText,"aria-disabled":"false",type:"button",onClick:e.onApply},e.applyText)))};exports.AdaptiveMode=C;
|
package/common/AdaptiveMode.mjs
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as t from "react";
|
|
9
|
-
import { ActionSheet as
|
|
9
|
+
import { ActionSheet as u, ActionSheetFooter as x } from "@progress/kendo-react-layout";
|
|
10
10
|
import { checkIcon as C } from "@progress/kendo-svg-icons";
|
|
11
11
|
import { Button as o } from "@progress/kendo-react-buttons";
|
|
12
|
-
import { useAdaptiveModeContext as v } from "@progress/kendo-react-common";
|
|
12
|
+
import { useAdaptiveModeContext as v, canUseDOM as y } from "@progress/kendo-react-common";
|
|
13
13
|
const I = (i) => {
|
|
14
14
|
const {
|
|
15
15
|
footer: e,
|
|
16
|
-
windowWidth:
|
|
16
|
+
windowWidth: n = 0,
|
|
17
17
|
mobileFilter: r,
|
|
18
18
|
children: s,
|
|
19
19
|
navigatable: c,
|
|
@@ -22,7 +22,7 @@ const I = (i) => {
|
|
|
22
22
|
animation: p,
|
|
23
23
|
title: b,
|
|
24
24
|
subTitle: f,
|
|
25
|
-
onClose:
|
|
25
|
+
onClose: l
|
|
26
26
|
} = i, a = v(), h = {
|
|
27
27
|
navigatable: c || !1,
|
|
28
28
|
navigatableElements: m || [],
|
|
@@ -39,18 +39,19 @@ const I = (i) => {
|
|
|
39
39
|
size: "large",
|
|
40
40
|
themeColor: "primary",
|
|
41
41
|
svgIcon: C,
|
|
42
|
-
onClick:
|
|
42
|
+
onClick: l
|
|
43
43
|
}
|
|
44
44
|
),
|
|
45
45
|
filter: r,
|
|
46
|
-
onClose:
|
|
47
|
-
animationStyles: a &&
|
|
46
|
+
onClose: l,
|
|
47
|
+
animationStyles: a && n <= a.small ? { top: 0, width: "100%", height: "100%" } : void 0,
|
|
48
48
|
title: b,
|
|
49
49
|
subTitle: f,
|
|
50
50
|
className: "k-adaptive-actionsheet",
|
|
51
|
-
position: a &&
|
|
51
|
+
position: a && n <= a.small ? "fullscreen" : void 0,
|
|
52
|
+
appendTo: y ? document.body : null
|
|
52
53
|
};
|
|
53
|
-
return /* @__PURE__ */ t.createElement(
|
|
54
|
+
return /* @__PURE__ */ t.createElement(u, { ...h }, s, e && /* @__PURE__ */ t.createElement(x, { className: "k-actions k-actions-stretched" }, /* @__PURE__ */ t.createElement(
|
|
54
55
|
o,
|
|
55
56
|
{
|
|
56
57
|
size: "large",
|