@progress/kendo-react-dropdowns 9.0.0-develop.2 → 9.0.0-develop.21

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.
@@ -9,12 +9,9 @@
9
9
  import * as p from "react";
10
10
  function u(t, e, n) {
11
11
  const [d, i] = p.useState(e);
12
- return p.useEffect(
13
- () => {
14
- d !== void 0 && t.current && i(t.current.offsetWidth);
15
- },
16
- n
17
- ), d;
12
+ return p.useEffect(() => {
13
+ d !== void 0 && t.current && i(t.current.offsetWidth);
14
+ }, n), d;
18
15
  }
19
16
  function r(t) {
20
17
  return typeof t == "string" ? Number(t.replace("px", "")) : t || void 0;
@@ -13,156 +13,159 @@ import { createPropsContext as ie, usePropsContext as de, getScrollbarWidth as c
13
13
  import { ComboBox as me, ComboBoxWithoutContext as fe } from "../ComboBox/ComboBox.mjs";
14
14
  import { getItemValue as ge } from "../common/utils.mjs";
15
15
  import W from "../common/withCustomComponent.mjs";
16
- const he = (u, h) => u ? typeof u == "number" ? u + "px" : u : h, Ce = ie(), P = e.forwardRef((u, h) => {
17
- const t = de(Ce, u), C = e.useRef(null), a = e.useRef(null), y = ce(), {
18
- columns: n = s.columns,
19
- popupSettings: p = s.popupSettings,
20
- size: z = s.size,
21
- rounded: O = s.rounded,
22
- fillMode: L = s.fillMode,
23
- className: $,
24
- prefix: j = void 0,
25
- suffix: V = void 0,
26
- onOpen: w,
27
- onClose: E,
28
- onFocus: F,
29
- onBlur: H,
30
- onChange: N,
31
- onFilterChange: S,
32
- onPageChange: M,
33
- ...A
34
- } = t;
35
- e.useImperativeHandle(C, () => ({
36
- element: a.current && a.current.element,
37
- focus() {
38
- a.current && a.current.focus();
39
- },
40
- get value() {
41
- return a.current && a.current.value;
42
- },
43
- get name() {
44
- return a.current && a.current.name;
45
- },
46
- props: t
47
- })), e.useImperativeHandle(h, () => C.current);
48
- const c = e.useMemo(
49
- () => {
16
+ const he = (u, h) => u ? typeof u == "number" ? u + "px" : u : h, Ce = ie(), P = e.forwardRef(
17
+ (u, h) => {
18
+ const t = de(Ce, u), C = e.useRef(null), a = e.useRef(null), y = ce(), {
19
+ columns: n = s.columns,
20
+ popupSettings: p = s.popupSettings,
21
+ size: z = s.size,
22
+ rounded: O = s.rounded,
23
+ fillMode: L = s.fillMode,
24
+ className: $,
25
+ prefix: j = void 0,
26
+ suffix: V = void 0,
27
+ onOpen: w,
28
+ onClose: E,
29
+ onFocus: F,
30
+ onBlur: H,
31
+ onChange: N,
32
+ onFilterChange: S,
33
+ onPageChange: M,
34
+ ...A
35
+ } = t;
36
+ e.useImperativeHandle(C, () => ({
37
+ element: a.current && a.current.element,
38
+ focus() {
39
+ a.current && a.current.focus();
40
+ },
41
+ get value() {
42
+ return a.current && a.current.value;
43
+ },
44
+ get name() {
45
+ return a.current && a.current.name;
46
+ },
47
+ props: t
48
+ })), e.useImperativeHandle(
49
+ h,
50
+ () => C.current
51
+ );
52
+ const c = e.useMemo(() => {
50
53
  if (t.groupField !== void 0 && t.data)
51
54
  return ge(t.data[0], t.groupField);
52
- },
53
- [t.data, t.groupField]
54
- ), [k, m] = e.useState(c), [R, B] = e.useState(!0), [D] = j ? W(t.prefix || e.Fragment) : [], [J] = V ? W(t.suffix || e.Fragment) : [], Q = e.useMemo(
55
- () => {
55
+ }, [t.data, t.groupField]), [k, m] = e.useState(c), [R, B] = e.useState(!0), [D] = j ? W(t.prefix || e.Fragment) : [], [J] = V ? W(t.suffix || e.Fragment) : [], Q = e.useMemo(() => {
56
56
  const r = /* @__PURE__ */ e.createElement("th", { className: "k-table-th", colSpan: n.length }, k);
57
- return /* @__PURE__ */ e.createElement(e.Fragment, null, t.header, /* @__PURE__ */ e.createElement("div", { className: "k-table-header-wrap" }, /* @__PURE__ */ e.createElement("table", { className: "k-table", role: "presentation" }, /* @__PURE__ */ e.createElement("colgroup", null, n.map(
58
- (o, i) => /* @__PURE__ */ e.createElement(
59
- "col",
60
- {
61
- key: o.uniqueKey ? o.uniqueKey : i,
62
- style: { width: o.width ? o.width : s.width }
63
- }
64
- )
65
- )), /* @__PURE__ */ e.createElement("thead", { className: "k-table-thead" }, /* @__PURE__ */ e.createElement("tr", { className: "k-table-row" }, n.map((o, i) => /* @__PURE__ */ e.createElement("th", { className: "k-table-th", key: o.uniqueKey ? o.uniqueKey : i }, o.header || " "))), k && R && /* @__PURE__ */ e.createElement("tr", { className: "k-table-group-row" }, t.groupStickyHeaderItemRender ? t.groupStickyHeaderItemRender.call(void 0, r, {}) : r)))));
66
- },
67
- [t.header, n, k, R]
68
- ), U = e.useMemo(
69
- () => (
70
- // These additional 4px are coming from the child elements side borders (fixes horizontal scrollbar)
71
- `calc(${n.map((r) => he(r.width, s.width)).filter(Boolean).join(" + ")} + ${y}px + 4px)`
72
- ),
73
- [n, y]
74
- ), q = t.virtual ? t.virtual.skip : 0, X = e.useCallback(
75
- (r, o) => {
76
- const i = n.map((d, le) => /* @__PURE__ */ e.createElement(
77
- "span",
57
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, t.header, /* @__PURE__ */ e.createElement("div", { className: "k-table-header-wrap" }, /* @__PURE__ */ e.createElement("table", { className: "k-table", role: "presentation" }, /* @__PURE__ */ e.createElement("colgroup", null, n.map((o, i) => /* @__PURE__ */ e.createElement(
58
+ "col",
78
59
  {
79
- className: t.itemRender ? void 0 : "k-table-td",
80
- style: t.itemRender ? void 0 : { width: d.width ? d.width : s.width },
81
- key: d.uniqueKey ? d.uniqueKey : le
82
- },
83
- d.field ? String(T(d.field)(o.dataItem)) : ""
84
- ));
85
- let f, g, b, v, I = t.data || [];
86
- const K = o.index - q;
87
- t.groupField !== void 0 && (v = T(t.groupField), g = v(I[K]), b = v(I[K - 1]), g && b && g !== b && (f = g)), f && t.groupMode === "classic" && i.push(/* @__PURE__ */ e.createElement("div", { key: "group", className: "k-table-td k-table-group-td" }, /* @__PURE__ */ e.createElement("span", null, f)));
88
- const G = e.cloneElement(r, {
89
- ...r.props,
90
- className: x("k-table-row", {
91
- "k-table-alt-row": o.index % 2 !== 0,
92
- "k-focus": o.focused,
93
- "k-selected": o.selected,
94
- "k-first": !!f,
95
- "k-disabled": o.dataItem.disabled
96
- })
97
- }, i);
98
- return t.itemRender ? t.itemRender.call(void 0, G, o) : G;
99
- },
100
- [n, t.groupField, t.itemRender, t.data, q]
101
- ), l = e.useCallback(
102
- (r, o) => {
60
+ key: o.uniqueKey ? o.uniqueKey : i,
61
+ style: { width: o.width ? o.width : s.width }
62
+ }
63
+ ))), /* @__PURE__ */ e.createElement("thead", { className: "k-table-thead" }, /* @__PURE__ */ e.createElement("tr", { className: "k-table-row" }, n.map((o, i) => /* @__PURE__ */ e.createElement("th", { className: "k-table-th", key: o.uniqueKey ? o.uniqueKey : i }, o.header || " "))), k && R && /* @__PURE__ */ e.createElement("tr", { className: "k-table-group-row" }, t.groupStickyHeaderItemRender ? t.groupStickyHeaderItemRender.call(void 0, r, {}) : r)))));
64
+ }, [t.header, n, k, R]), U = e.useMemo(
65
+ () => (
66
+ // These additional 4px are coming from the child elements side borders (fixes horizontal scrollbar)
67
+ `calc(${n.map((r) => he(r.width, s.width)).filter(Boolean).join(" + ")} + ${y}px + 4px)`
68
+ ),
69
+ [n, y]
70
+ ), q = t.virtual ? t.virtual.skip : 0, X = e.useCallback(
71
+ (r, o) => {
72
+ const i = n.map((d, le) => /* @__PURE__ */ e.createElement(
73
+ "span",
74
+ {
75
+ className: t.itemRender ? void 0 : "k-table-td",
76
+ style: t.itemRender ? void 0 : { width: d.width ? d.width : s.width },
77
+ key: d.uniqueKey ? d.uniqueKey : le
78
+ },
79
+ d.field ? String(T(d.field)(o.dataItem)) : ""
80
+ ));
81
+ let f, g, b, v, I = t.data || [];
82
+ const K = o.index - q;
83
+ t.groupField !== void 0 && (v = T(t.groupField), g = v(I[K]), b = v(I[K - 1]), g && b && g !== b && (f = g)), f && t.groupMode === "classic" && i.push(
84
+ /* @__PURE__ */ e.createElement("div", { key: "group", className: "k-table-td k-table-group-td" }, /* @__PURE__ */ e.createElement("span", null, f))
85
+ );
86
+ const G = e.cloneElement(
87
+ r,
88
+ {
89
+ ...r.props,
90
+ className: x("k-table-row", {
91
+ "k-table-alt-row": o.index % 2 !== 0,
92
+ "k-focus": o.focused,
93
+ "k-selected": o.selected,
94
+ "k-first": !!f,
95
+ "k-disabled": o.dataItem.disabled
96
+ })
97
+ },
98
+ i
99
+ );
100
+ return t.itemRender ? t.itemRender.call(void 0, G, o) : G;
101
+ },
102
+ [n, t.groupField, t.itemRender, t.data, q]
103
+ ), l = e.useCallback((r, o) => {
103
104
  r && r.call(void 0, {
104
105
  ...o,
105
106
  target: C.current
106
107
  });
107
- },
108
- []
109
- ), Y = e.useCallback((r) => (t.virtual || m(c), l(w, r)), [l, w, t.virtual, c]), Z = e.useCallback((r) => l(E, r), [E]), _ = e.useCallback((r) => l(F, r), [F]), ee = e.useCallback((r) => l(H, r), [H]), te = e.useCallback((r) => l(N, r), [N]), re = e.useCallback((r) => l(M, r), [M]), oe = e.useCallback((r) => (m(c), l(S, {
110
- ...r,
111
- mobileMode: r.target.mobileMode
112
- })), [S]), ae = e.useCallback(
113
- (r) => {
108
+ }, []), Y = e.useCallback(
109
+ (r) => (t.virtual || m(c), l(w, r)),
110
+ [l, w, t.virtual, c]
111
+ ), Z = e.useCallback((r) => l(E, r), [E]), _ = e.useCallback((r) => l(F, r), [F]), ee = e.useCallback((r) => l(H, r), [H]), te = e.useCallback((r) => l(N, r), [N]), re = e.useCallback((r) => l(M, r), [M]), oe = e.useCallback(
112
+ (r) => (m(c), l(S, {
113
+ ...r,
114
+ mobileMode: r.target.mobileMode
115
+ })),
116
+ [S]
117
+ ), ae = e.useCallback((r) => {
114
118
  m(r.group);
115
- },
116
- []
117
- );
118
- e.useEffect(() => {
119
- pe();
120
- }), e.useEffect(() => {
121
- const r = t.data;
122
- m(c), r && r.length !== 0 ? B(!0) : B(!1);
123
- }, [t.data]);
124
- const ne = e.useCallback((r) => /* @__PURE__ */ e.createElement(ue, { ...r }), []);
125
- return /* @__PURE__ */ e.createElement(
126
- me,
127
- {
128
- ...A,
129
- list: ne,
130
- popupSettings: {
131
- ...p,
132
- popupClass: x("k-dropdowngrid-popup", p.popupClass),
133
- width: p.width || U,
134
- className: p.className
135
- },
136
- ref: a,
137
- header: Q,
138
- itemRender: X,
139
- groupHeaderItemRender: t.groupHeaderItemRender,
140
- size: z,
141
- rounded: O,
142
- fillMode: L,
143
- groupMode: t.groupMode,
144
- groupField: t.groupField,
145
- isMultiColumn: !0,
146
- onOpen: Y,
147
- onClose: Z,
148
- onFocus: _,
149
- onBlur: ee,
150
- onChange: te,
151
- onFilterChange: oe,
152
- onPageChange: re,
153
- onGroupScroll: ae,
154
- className: x("k-dropdowngrid", $),
155
- required: t.required,
156
- adaptive: t.adaptive,
157
- adaptiveFilter: t.adaptiveFilter,
158
- adaptiveTitle: t.adaptiveTitle,
159
- footer: t.footer,
160
- footerClassName: "k-table-footer",
161
- prefix: D,
162
- suffix: J
163
- }
164
- );
165
- }), ke = {
119
+ }, []);
120
+ e.useEffect(() => {
121
+ pe();
122
+ }), e.useEffect(() => {
123
+ const r = t.data;
124
+ m(c), r && r.length !== 0 ? B(!0) : B(!1);
125
+ }, [t.data]);
126
+ const ne = e.useCallback((r) => /* @__PURE__ */ e.createElement(ue, { ...r }), []);
127
+ return /* @__PURE__ */ e.createElement(
128
+ me,
129
+ {
130
+ ...A,
131
+ list: ne,
132
+ popupSettings: {
133
+ ...p,
134
+ popupClass: x("k-dropdowngrid-popup", p.popupClass),
135
+ width: p.width || U,
136
+ className: p.className
137
+ },
138
+ ref: a,
139
+ header: Q,
140
+ itemRender: X,
141
+ groupHeaderItemRender: t.groupHeaderItemRender,
142
+ size: z,
143
+ rounded: O,
144
+ fillMode: L,
145
+ groupMode: t.groupMode,
146
+ groupField: t.groupField,
147
+ isMultiColumn: !0,
148
+ onOpen: Y,
149
+ onClose: Z,
150
+ onFocus: _,
151
+ onBlur: ee,
152
+ onChange: te,
153
+ onFilterChange: oe,
154
+ onPageChange: re,
155
+ onGroupScroll: ae,
156
+ className: x("k-dropdowngrid", $),
157
+ required: t.required,
158
+ adaptive: t.adaptive,
159
+ adaptiveFilter: t.adaptiveFilter,
160
+ adaptiveTitle: t.adaptiveTitle,
161
+ footer: t.footer,
162
+ footerClassName: "k-table-footer",
163
+ prefix: D,
164
+ suffix: J
165
+ }
166
+ );
167
+ }
168
+ ), ke = {
166
169
  ...fe.propTypes,
167
170
  columns: se.any.isRequired
168
171
  }, s = {
@@ -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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ze=require("react"),a=require("prop-types"),i=require("@progress/kendo-react-common"),et=require("@progress/kendo-react-popup"),tt=require("@progress/kendo-react-intl"),we=require("@progress/kendo-react-treeview"),nt=require("../package-metadata.js"),ee=require("../common/utils.js"),at=require("../DropDownTree/useDropdownWidth.js"),rt=require("../DropDownTree/ListNoData.js"),m=require("../messages/index.js"),it=require("@progress/kendo-react-labels"),st=require("../MultiSelect/TagList.js"),ot=require("../common/ClearButton.js"),Ie=require("../common/ListFilter.js"),lt=require("../common/AdaptiveMode.js"),ct=require("@progress/kendo-react-layout"),ut=require("../common/constants.js");function dt(h){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const n in h)if(n!=="default"){const I=Object.getOwnPropertyDescriptor(h,n);Object.defineProperty(b,n,I.get?I:{enumerable:!0,get:()=>h[n]})}}return b.default=h,Object.freeze(b)}const t=dt(Ze),pt="Please select a value from the list!",{sizeMap:Te,roundedMap:ft}=i.kendoThemeMaps,gt=h=>h.split("_").map(b=>parseInt(b,10)),vt=(h,b)=>{const{validationMessage:n,valid:I,required:T}=h;return{customError:n!==void 0,valid:!!(I!==void 0?I:!T||b),valueMissing:!b}},E={checkField:"checkField",checkIndeterminateField:"checkIndeterminateField",subItemsField:"items",popupSettings:{animate:!0,width:"200px",height:"200px"},size:"medium",rounded:"medium",fillMode:"solid",required:!1,validityStyles:!0},Me=i.createPropsContext(),ce=t.forwardRef((h,b)=>{const n=i.usePropsContext(Me,h);i.validatePackage(nt.packageMetadata);const I=i.useId(),T=n.id||I,{data:B=[],dataItemKey:M,style:L={},placeholder:ue,label:V,name:Ke,validationMessage:W,valid:Re,tags:de,value:g,opened:K,disabled:x,popupSettings:N=E.popupSettings,checkField:pe=E.checkField,checkIndeterminateField:fe=E.checkIndeterminateField,subItemsField:ge=E.subItemsField,size:y=E.size,rounded:A=E.rounded,fillMode:z=E.fillMode,required:ve=E.required,validityStyles:De=E.validityStyles,onOpen:te=i.noop,onClose:_=i.noop}=n,j=i.getTabIndex(n.tabIndex,x),o=t.useRef(null),F=t.useRef(null),R=t.useRef(null),ne=t.useRef(null),H=t.useRef(null),S=t.useRef(null),$=t.useRef(!1),G=t.useRef([]),U=t.useRef(null),[O,qe]=t.useState(),[Ne,me]=t.useState(!1),[d,ae]=t.useState(!1),[re,Oe]=t.useState(),[Pe,Le]=t.useState([]),[he,Ve]=t.useState(""),P=!!(re&&re<=ut.MOBILE_MEDIUM_DEVISE&&n.adaptive),l=K!==void 0?K:Ne,ie=!!(Array.isArray(g)&&g.length),se=vt({validationMessage:W,valid:Re,required:ve},ie),D=i.useRtl(F,n.dir),Ae={width:at.useDropdownWidth(F,E,N,L),...D!==void 0?{direction:D}:{}},Be=t.useCallback(()=>F.current&&F.current.focus(),[]);G.current=de===void 0?(g||[]).map(e=>({text:ee.getItemValue(e,n.textField),data:[e]})):[...de],t.useImperativeHandle(o,()=>({props:n,element:F.current,focus:Be})),t.useImperativeHandle(b,()=>o.current);const We=t.useCallback(()=>{H.current&&H.current.setCustomValidity&&H.current.setCustomValidity(se.valid?"":W===void 0?pt:W)},[W,se]);t.useEffect(We),t.useEffect(()=>{const e=i.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(Xe.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{e&&e.disconnect()}},[]),t.useEffect(()=>{U.current&&l&&U.current.setPosition(U.current._popup)},[g,l]);const w=t.useCallback((e,r,s)=>{if(n.onChange){const k={items:r,operation:s,...e};n.onChange.call(void 0,k)}},[n.onChange]),J=t.useCallback(e=>{if(ee.areSame(e.item,g,M)||!o.current)return;const{item:r,nativeEvent:s,syntheticEvent:k}=e,q={syntheticEvent:k,nativeEvent:s,target:o.current};w(q,[r],"toggle")},[g,M,w]),Q=t.useCallback(e=>{if(!l){if(te){const r={...e};te.call(void 0,r)}K===void 0&&(me(!0),Le(g||[]),P&&setTimeout(()=>{var r;u((r=ne.current)==null?void 0:r.element)},300))}},[l,K,te,P,ne]),v=t.useCallback(e=>{if(l){if(_){const r={...e};_.call(void 0,r)}K===void 0&&me(!1)}},[l,K,_]),C=t.useCallback(e=>{$.current=!0,e(),window.setTimeout(()=>$.current=!1,0)},[]),u=t.useCallback(e=>{e&&C(()=>e.focus())},[C]),ze=t.useCallback(()=>{var e;!d&&l?v({target:o.current}):n.filterable?u((e=R.current)==null?void 0:e.element):u(S.current&&S.current.element)},[d,l,u,v,n.filterable]),_e=t.useCallback(()=>{d&&u(F.current)},[d,u]),je=t.useCallback(e=>{if(!d&&!$.current&&(ae(!0),n.onFocus&&o.current)){const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};n.onFocus.call(void 0,r)}},[d,n.onFocus]),He=t.useCallback(e=>{if(d&&!$.current&&o.current){ae(!1);const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};if(n.onBlur){const s={...r};n.onBlur.call(void 0,s)}P||v(r)}},[d,n.onBlur,l,K,_]),$e=t.useCallback(()=>{d&&C(i.noop)},[d,C]),Ge=t.useCallback(e=>{if(!e.isDefaultPrevented()&&o.current){ae(!0);const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};l||Q(r)}},[l,Q]),Ue=t.useCallback(e=>{var Z,Se;const{keyCode:r,altKey:s}=e,k=S.current&&S.current.element;if(!o.current||e.isDefaultPrevented()&&((Z=R.current)==null?void 0:Z.element)===e.target)return;const q={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};if(g&&g.length>0&&(r===i.Keys.left||r===i.Keys.right||r===i.Keys.home||r===i.Keys.end||r===i.Keys.delete)){const c=G.current;let p=O?c.findIndex(Ye=>ee.matchTags(Ye,O,M)):-1,f;const le=p!==-1;r===i.Keys.left?(le?p=Math.max(0,p-1):p=c.length-1,f=c[p]):r===i.Keys.right?p===c.length-1?f=void 0:le&&(p=Math.min(c.length-1,p+1),f=c[p]):r===i.Keys.home?f=c[0]:r===i.Keys.end?f=c[c.length-1]:r===i.Keys.delete&&le&&w(q,c[p].data,"delete"),f!==O&&qe(f)}if(l)if(r===i.Keys.esc||s&&r===i.Keys.up)e.preventDefault(),v(q);else if(k&&k.querySelector(".k-focus")&&(r===i.Keys.up||r===i.Keys.down||r===i.Keys.left||r===i.Keys.right||r===i.Keys.home||r===i.Keys.end)){if(r===i.Keys.up&&((Se=R.current)!=null&&Se.element)){const c=Array.from(k.querySelectorAll(".k-treeview-item")),p=[...c].reverse().find(f=>!!(f&&f.querySelector(".k-focus")));if(p&&c.indexOf(p)===0)return C(()=>{var f;u((f=R.current)==null?void 0:f.element)})}C(i.noop)}else r===i.Keys.down&&C(()=>{var c;u(((c=R.current)==null?void 0:c.element)||k)});else s&&r===i.Keys.down&&(e.preventDefault(),Q(q))},[l,v,u,C,Q,O,M,g,w]),ye=t.useCallback(e=>{const{keyCode:r,altKey:s}=e;s||r!==i.Keys.up&&r!==i.Keys.down||(e.preventDefault(),C(r===i.Keys.up?()=>{u(F.current)}:()=>{u(S.current&&S.current.element)}))},[u,C]),oe=t.useCallback(e=>{if(!o.current)return;const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};w(r,[],"clear"),v(r),e.preventDefault()},[w,v]),Je=t.useCallback((e,r)=>{var s;v({target:o.current}),d||u((s=R.current)==null?void 0:s.element),w({syntheticEvent:r,nativeEvent:r.nativeEvent,target:o.current},e,"delete")},[w,v,u,d]),be=t.useCallback(e=>{if(n.onExpandChange&&o.current){const{item:r,itemHierarchicalIndex:s,nativeEvent:k,syntheticEvent:q}=e,Z={level:gt(s),item:r,nativeEvent:k,syntheticEvent:q,target:o.current};n.onExpandChange.call(void 0,Z)}},[n.onExpandChange]),Ce=t.useCallback(e=>{if(n.onFilterChange&&o.current){const s={filter:{field:n.textField,operator:"contains",value:e.target.value},syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:o.current};n.onFilterChange.call(void 0,s),n.filter===void 0&&Ve(e.target.value)}},[n.onFilterChange,n.filter,n.textField]),ke=t.useCallback(e=>{if(!o.current)return;const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};n.onCancel&&n.onCancel.call(void 0,r),v(r),e.preventDefault()},[n.onCancel,v]),Qe=()=>{const e=n.filterable?t.createElement(Ie,{value:n.filter===void 0?he:n.filter,ref:ne,onChange:Ce,onKeyDown:ye,size:y,rounded:A,fillMode:z}):null,r={adaptiveTitle:n.adaptiveTitle,expand:l,onClose:s=>n.onCancel?ke(s):oe(s),windowWidth:re,mobileFilter:e,footer:{cancelText:X.toLanguageString(m.adaptiveModeFooterCancel,m.messages[m.adaptiveModeFooterCancel]),onCancel:s=>n.onCancel?ke(s):oe(s),applyText:X.toLanguageString(m.adaptiveModeFooterApply,m.messages[m.adaptiveModeFooterApply]),onApply:s=>v(s)}};return t.createElement(lt.AdaptiveMode,{...r},t.createElement(ct.ActionSheetContent,{overflowHidden:!0},t.createElement("div",{className:"k-list-container"},t.createElement("div",{className:"k-list k-list-lg"},B.length>0?t.createElement(we.TreeView,{ref:S,tabIndex:j,data:B,focusIdField:M,textField:n.textField,checkField:pe,checkIndeterminateField:fe,expandField:n.expandField,childrenField:ge,expandIcons:!0,onItemClick:J,onCheckChange:J,onExpandChange:be,checkboxes:!0,size:y,item:n.item,dir:D}):t.createElement(Ee,null,X.toLanguageString(m.nodata,m.messages[m.nodata]))))))},Xe=t.useCallback(e=>{for(const r of e)Oe(r.target.clientWidth)},[]),Ee=n.listNoData||rt.ListNoData,X=tt.useLocalization(),Fe=!De||se.valid,Y=P&&l?Pe:G.current,xe=t.createElement(t.Fragment,null,t.createElement("span",{className:i.classNames("k-multiselecttree k-input",n.className,{[`k-input-${Te[y]||y}`]:y,[`k-rounded-${ft[A]||A}`]:A,[`k-input-${z}`]:z,"k-focus":d&&!x,"k-invalid":!Fe,"k-disabled":x,"k-loading":n.loading,"k-required":ve}),tabIndex:j,accessKey:n.accessKey,id:T,style:V?{...L,width:void 0}:L,dir:D,ref:F,onKeyDown:x?void 0:Ue,onMouseDown:$e,onFocus:je,onBlur:He,role:"combobox","aria-haspopup":"tree","aria-expanded":l,"aria-disabled":x,"aria-label":V,"aria-labelledby":n.ariaLabelledBy,"aria-describedby":n.ariaDescribedBy?n.ariaDescribedBy:"tagslist-"+T,"aria-required":n.required,onClick:x?void 0:Ge},t.createElement("div",{id:"tagslist-"+T,className:i.classNames("k-input-values k-chip-list",{[`k-chip-list-${Te[y]||y}`]:y})},Y.length>0&&t.createElement(st,{tag:n.tag,onTagDelete:Je,data:Y,guid:T,focused:O?G.current.find(e=>ee.matchTags(e,O,M)):void 0,size:y})),t.createElement("span",{className:"k-input-inner"},Y.length===0&&t.createElement("span",{className:"k-input-value-text"},ue)),n.loading&&t.createElement(i.IconWrap,{className:"k-input-loading-icon",name:"loading"}),ie&&!x&&Y.length>0&&t.createElement(ot,{onClick:oe}),t.createElement("select",{name:Ke,ref:H,tabIndex:-1,"aria-hidden":!0,title:V,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},t.createElement("option",{value:n.valueMap?n.valueMap.call(void 0,g):g})),!P&&t.createElement(et.Popup,{...N,popupClass:i.classNames(N.popupClass,"k-multiselecttree-popup"),className:i.classNames(N.className,{"k-rtl":D==="rtl"}),style:Ae,anchor:N.anchor||F.current,show:l,onOpen:ze,onClose:_e,ref:U},n.filterable&&t.createElement(Ie,{value:n.filter===void 0?he:n.filter,ref:R,onChange:Ce,onKeyDown:ye,tabIndex:j,size:y,rounded:A,fillMode:z,renderListFilterWrapper:!0,renderPrefixSeparator:!0}),B.length>0?t.createElement(we.TreeView,{style:{height:N.height},ref:S,tabIndex:j,data:B,focusIdField:M,textField:n.textField,checkField:pe,checkIndeterminateField:fe,expandField:n.expandField,childrenField:ge,expandIcons:!0,onItemClick:J,onCheckChange:J,onExpandChange:be,checkboxes:!0,size:y,item:n.item,dir:D}):t.createElement(Ee,null,X.toLanguageString(m.nodata,m.messages[m.nodata])))),P&&Qe());return V?t.createElement(it.FloatingLabel,{label:V,editorValue:ie,editorPlaceholder:ue,editorValid:Fe,editorDisabled:x,editorId:T,style:{width:L?L.width:void 0},children:xe,dir:D}):xe}),mt={opened:a.bool,disabled:a.bool,dir:a.string,tabIndex:a.number,accessKey:a.string,data:a.array,value:a.any,valueMap:a.func,placeholder:a.string,dataItemKey:a.string.isRequired,textField:a.string.isRequired,checkField:a.string,checkIndeterminateField:a.string,expandField:a.string,subItemsField:a.string,className:a.string,style:a.object,label:a.string,validationMessage:a.string,validityStyles:a.bool,valid:a.bool,required:a.bool,name:a.string,id:a.string,ariaLabelledBy:a.string,ariaDescribedBy:a.string,filterable:a.bool,filter:a.string,loading:a.bool,tags:a.arrayOf(a.shape({text:a.string,data:a.arrayOf(a.any)})),popupSettings:a.shape({animate:a.oneOfType([a.bool,a.shape({openDuration:a.number,closeDuration:a.number})]),popupClass:a.string,className:a.string,appendTo:a.any,width:a.oneOfType([a.string,a.number]),height:a.oneOfType([a.string,a.number])}),onOpen:a.func,onClose:a.func,onFocus:a.func,onBlur:a.func,onChange:a.func,onFilterChange:a.func,onExpandChange:a.func,onCancel:a.func,item:a.func,listNoData:a.func,adaptiveTitle:a.string,adaptive:a.bool};ce.displayName="KendoReactMultiSelectTree";ce.propTypes=mt;exports.MultiSelectTree=ce;exports.MultiSelectTreePropsContext=Me;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ze=require("react"),a=require("prop-types"),i=require("@progress/kendo-react-common"),et=require("@progress/kendo-react-popup"),tt=require("@progress/kendo-react-intl"),we=require("@progress/kendo-react-treeview"),nt=require("../package-metadata.js"),ee=require("../common/utils.js"),at=require("../DropDownTree/useDropdownWidth.js"),rt=require("../DropDownTree/ListNoData.js"),m=require("../messages/index.js"),it=require("@progress/kendo-react-labels"),st=require("../MultiSelect/TagList.js"),ot=require("../common/ClearButton.js"),Ie=require("../common/ListFilter.js"),lt=require("../common/AdaptiveMode.js"),ct=require("@progress/kendo-react-layout"),ut=require("../common/constants.js");function dt(h){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const n in h)if(n!=="default"){const I=Object.getOwnPropertyDescriptor(h,n);Object.defineProperty(b,n,I.get?I:{enumerable:!0,get:()=>h[n]})}}return b.default=h,Object.freeze(b)}const t=dt(Ze),pt="Please select a value from the list!",{sizeMap:Te,roundedMap:ft}=i.kendoThemeMaps,gt=h=>h.split("_").map(b=>parseInt(b,10)),vt=(h,b)=>{const{validationMessage:n,valid:I,required:T}=h;return{customError:n!==void 0,valid:!!(I!==void 0?I:!T||b),valueMissing:!b}},E={checkField:"checkField",checkIndeterminateField:"checkIndeterminateField",subItemsField:"items",popupSettings:{animate:!0,width:"200px",height:"200px"},size:"medium",rounded:"medium",fillMode:"solid",required:!1,validityStyles:!0},Me=i.createPropsContext(),ce=t.forwardRef((h,b)=>{const n=i.usePropsContext(Me,h);i.validatePackage(nt.packageMetadata);const I=i.useId(),T=n.id||I,{data:B=[],dataItemKey:M,style:L={},placeholder:ue,label:V,name:Ke,validationMessage:W,valid:Re,tags:de,value:g,opened:K,disabled:x,popupSettings:N=E.popupSettings,checkField:pe=E.checkField,checkIndeterminateField:fe=E.checkIndeterminateField,subItemsField:ge=E.subItemsField,size:y=E.size,rounded:A=E.rounded,fillMode:z=E.fillMode,required:ve=E.required,validityStyles:De=E.validityStyles,onOpen:te=i.noop,onClose:_=i.noop}=n,j=i.getTabIndex(n.tabIndex,x),o=t.useRef(null),F=t.useRef(null),R=t.useRef(null),ne=t.useRef(null),H=t.useRef(null),S=t.useRef(null),$=t.useRef(!1),G=t.useRef([]),U=t.useRef(null),[O,qe]=t.useState(),[Ne,me]=t.useState(!1),[d,ae]=t.useState(!1),[re,Oe]=t.useState(),[Pe,Le]=t.useState([]),[he,Ve]=t.useState(""),P=!!(re&&re<=ut.MOBILE_MEDIUM_DEVISE&&n.adaptive),l=K!==void 0?K:Ne,ie=!!(Array.isArray(g)&&g.length),se=vt({validationMessage:W,valid:Re,required:ve},ie),D=i.useRtl(F,n.dir),Ae={width:at.useDropdownWidth(F,E,N,L),...D!==void 0?{direction:D}:{}},Be=t.useCallback(()=>F.current&&F.current.focus(),[]);G.current=de===void 0?(g||[]).map(e=>({text:ee.getItemValue(e,n.textField),data:[e]})):[...de],t.useImperativeHandle(o,()=>({props:n,element:F.current,focus:Be})),t.useImperativeHandle(b,()=>o.current);const We=t.useCallback(()=>{H.current&&H.current.setCustomValidity&&H.current.setCustomValidity(se.valid?"":W===void 0?pt:W)},[W,se]);t.useEffect(We),t.useEffect(()=>{const e=i.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(Xe.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{e&&e.disconnect()}},[]),t.useEffect(()=>{U.current&&l&&U.current.setPosition(U.current.element)},[g,l]);const w=t.useCallback((e,r,s)=>{if(n.onChange){const k={items:r,operation:s,...e};n.onChange.call(void 0,k)}},[n.onChange]),J=t.useCallback(e=>{if(ee.areSame(e.item,g,M)||!o.current)return;const{item:r,nativeEvent:s,syntheticEvent:k}=e,q={syntheticEvent:k,nativeEvent:s,target:o.current};w(q,[r],"toggle")},[g,M,w]),Q=t.useCallback(e=>{if(!l){if(te){const r={...e};te.call(void 0,r)}K===void 0&&(me(!0),Le(g||[]),P&&setTimeout(()=>{var r;u((r=ne.current)==null?void 0:r.element)},300))}},[l,K,te,P,ne]),v=t.useCallback(e=>{if(l){if(_){const r={...e};_.call(void 0,r)}K===void 0&&me(!1)}},[l,K,_]),C=t.useCallback(e=>{$.current=!0,e(),window.setTimeout(()=>$.current=!1,0)},[]),u=t.useCallback(e=>{e&&C(()=>e.focus())},[C]),ze=t.useCallback(()=>{var e;!d&&l?v({target:o.current}):n.filterable?u((e=R.current)==null?void 0:e.element):u(S.current&&S.current.element)},[d,l,u,v,n.filterable]),_e=t.useCallback(()=>{d&&u(F.current)},[d,u]),je=t.useCallback(e=>{if(!d&&!$.current&&(ae(!0),n.onFocus&&o.current)){const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};n.onFocus.call(void 0,r)}},[d,n.onFocus]),He=t.useCallback(e=>{if(d&&!$.current&&o.current){ae(!1);const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};if(n.onBlur){const s={...r};n.onBlur.call(void 0,s)}P||v(r)}},[d,n.onBlur,l,K,_]),$e=t.useCallback(()=>{d&&C(i.noop)},[d,C]),Ge=t.useCallback(e=>{if(!e.isDefaultPrevented()&&o.current){ae(!0);const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};l||Q(r)}},[l,Q]),Ue=t.useCallback(e=>{var Z,Se;const{keyCode:r,altKey:s}=e,k=S.current&&S.current.element;if(!o.current||e.isDefaultPrevented()&&((Z=R.current)==null?void 0:Z.element)===e.target)return;const q={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};if(g&&g.length>0&&(r===i.Keys.left||r===i.Keys.right||r===i.Keys.home||r===i.Keys.end||r===i.Keys.delete)){const c=G.current;let p=O?c.findIndex(Ye=>ee.matchTags(Ye,O,M)):-1,f;const le=p!==-1;r===i.Keys.left?(le?p=Math.max(0,p-1):p=c.length-1,f=c[p]):r===i.Keys.right?p===c.length-1?f=void 0:le&&(p=Math.min(c.length-1,p+1),f=c[p]):r===i.Keys.home?f=c[0]:r===i.Keys.end?f=c[c.length-1]:r===i.Keys.delete&&le&&w(q,c[p].data,"delete"),f!==O&&qe(f)}if(l)if(r===i.Keys.esc||s&&r===i.Keys.up)e.preventDefault(),v(q);else if(k&&k.querySelector(".k-focus")&&(r===i.Keys.up||r===i.Keys.down||r===i.Keys.left||r===i.Keys.right||r===i.Keys.home||r===i.Keys.end)){if(r===i.Keys.up&&((Se=R.current)!=null&&Se.element)){const c=Array.from(k.querySelectorAll(".k-treeview-item")),p=[...c].reverse().find(f=>!!(f&&f.querySelector(".k-focus")));if(p&&c.indexOf(p)===0)return C(()=>{var f;u((f=R.current)==null?void 0:f.element)})}C(i.noop)}else r===i.Keys.down&&C(()=>{var c;u(((c=R.current)==null?void 0:c.element)||k)});else s&&r===i.Keys.down&&(e.preventDefault(),Q(q))},[l,v,u,C,Q,O,M,g,w]),ye=t.useCallback(e=>{const{keyCode:r,altKey:s}=e;s||r!==i.Keys.up&&r!==i.Keys.down||(e.preventDefault(),C(r===i.Keys.up?()=>{u(F.current)}:()=>{u(S.current&&S.current.element)}))},[u,C]),oe=t.useCallback(e=>{if(!o.current)return;const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};w(r,[],"clear"),v(r),e.preventDefault()},[w,v]),Je=t.useCallback((e,r)=>{var s;v({target:o.current}),d||u((s=R.current)==null?void 0:s.element),w({syntheticEvent:r,nativeEvent:r.nativeEvent,target:o.current},e,"delete")},[w,v,u,d]),be=t.useCallback(e=>{if(n.onExpandChange&&o.current){const{item:r,itemHierarchicalIndex:s,nativeEvent:k,syntheticEvent:q}=e,Z={level:gt(s),item:r,nativeEvent:k,syntheticEvent:q,target:o.current};n.onExpandChange.call(void 0,Z)}},[n.onExpandChange]),Ce=t.useCallback(e=>{if(n.onFilterChange&&o.current){const s={filter:{field:n.textField,operator:"contains",value:e.target.value},syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:o.current};n.onFilterChange.call(void 0,s),n.filter===void 0&&Ve(e.target.value)}},[n.onFilterChange,n.filter,n.textField]),ke=t.useCallback(e=>{if(!o.current)return;const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};n.onCancel&&n.onCancel.call(void 0,r),v(r),e.preventDefault()},[n.onCancel,v]),Qe=()=>{const e=n.filterable?t.createElement(Ie,{value:n.filter===void 0?he:n.filter,ref:ne,onChange:Ce,onKeyDown:ye,size:y,rounded:A,fillMode:z}):null,r={adaptiveTitle:n.adaptiveTitle,expand:l,onClose:s=>n.onCancel?ke(s):oe(s),windowWidth:re,mobileFilter:e,footer:{cancelText:X.toLanguageString(m.adaptiveModeFooterCancel,m.messages[m.adaptiveModeFooterCancel]),onCancel:s=>n.onCancel?ke(s):oe(s),applyText:X.toLanguageString(m.adaptiveModeFooterApply,m.messages[m.adaptiveModeFooterApply]),onApply:s=>v(s)}};return t.createElement(lt.AdaptiveMode,{...r},t.createElement(ct.ActionSheetContent,{overflowHidden:!0},t.createElement("div",{className:"k-list-container"},t.createElement("div",{className:"k-list k-list-lg"},B.length>0?t.createElement(we.TreeView,{ref:S,tabIndex:j,data:B,focusIdField:M,textField:n.textField,checkField:pe,checkIndeterminateField:fe,expandField:n.expandField,childrenField:ge,expandIcons:!0,onItemClick:J,onCheckChange:J,onExpandChange:be,checkboxes:!0,size:y,item:n.item,dir:D}):t.createElement(Ee,null,X.toLanguageString(m.nodata,m.messages[m.nodata]))))))},Xe=t.useCallback(e=>{for(const r of e)Oe(r.target.clientWidth)},[]),Ee=n.listNoData||rt.ListNoData,X=tt.useLocalization(),Fe=!De||se.valid,Y=P&&l?Pe:G.current,xe=t.createElement(t.Fragment,null,t.createElement("span",{className:i.classNames("k-multiselecttree k-input",n.className,{[`k-input-${Te[y]||y}`]:y,[`k-rounded-${ft[A]||A}`]:A,[`k-input-${z}`]:z,"k-focus":d&&!x,"k-invalid":!Fe,"k-disabled":x,"k-loading":n.loading,"k-required":ve}),tabIndex:j,accessKey:n.accessKey,id:T,style:V?{...L,width:void 0}:L,dir:D,ref:F,onKeyDown:x?void 0:Ue,onMouseDown:$e,onFocus:je,onBlur:He,role:"combobox","aria-haspopup":"tree","aria-expanded":l,"aria-disabled":x,"aria-label":V,"aria-labelledby":n.ariaLabelledBy,"aria-describedby":n.ariaDescribedBy?n.ariaDescribedBy:"tagslist-"+T,"aria-required":n.required,onClick:x?void 0:Ge},t.createElement("div",{id:"tagslist-"+T,className:i.classNames("k-input-values k-chip-list",{[`k-chip-list-${Te[y]||y}`]:y})},Y.length>0&&t.createElement(st,{tag:n.tag,onTagDelete:Je,data:Y,guid:T,focused:O?G.current.find(e=>ee.matchTags(e,O,M)):void 0,size:y})),t.createElement("span",{className:"k-input-inner"},Y.length===0&&t.createElement("span",{className:"k-input-value-text"},ue)),n.loading&&t.createElement(i.IconWrap,{className:"k-input-loading-icon",name:"loading"}),ie&&!x&&Y.length>0&&t.createElement(ot,{onClick:oe}),t.createElement("select",{name:Ke,ref:H,tabIndex:-1,"aria-hidden":!0,title:V,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},t.createElement("option",{value:n.valueMap?n.valueMap.call(void 0,g):g})),!P&&t.createElement(et.Popup,{...N,popupClass:i.classNames(N.popupClass,"k-multiselecttree-popup"),className:i.classNames(N.className,{"k-rtl":D==="rtl"}),style:Ae,anchor:N.anchor||F.current,show:l,onOpen:ze,onClose:_e,ref:U},n.filterable&&t.createElement(Ie,{value:n.filter===void 0?he:n.filter,ref:R,onChange:Ce,onKeyDown:ye,tabIndex:j,size:y,rounded:A,fillMode:z,renderListFilterWrapper:!0,renderPrefixSeparator:!0}),B.length>0?t.createElement(we.TreeView,{style:{height:N.height},ref:S,tabIndex:j,data:B,focusIdField:M,textField:n.textField,checkField:pe,checkIndeterminateField:fe,expandField:n.expandField,childrenField:ge,expandIcons:!0,onItemClick:J,onCheckChange:J,onExpandChange:be,checkboxes:!0,size:y,item:n.item,dir:D}):t.createElement(Ee,null,X.toLanguageString(m.nodata,m.messages[m.nodata])))),P&&Qe());return V?t.createElement(it.FloatingLabel,{label:V,editorValue:ie,editorPlaceholder:ue,editorValid:Fe,editorDisabled:x,editorId:T,style:{width:L?L.width:void 0},children:xe,dir:D}):xe}),mt={opened:a.bool,disabled:a.bool,dir:a.string,tabIndex:a.number,accessKey:a.string,data:a.array,value:a.any,valueMap:a.func,placeholder:a.string,dataItemKey:a.string.isRequired,textField:a.string.isRequired,checkField:a.string,checkIndeterminateField:a.string,expandField:a.string,subItemsField:a.string,className:a.string,style:a.object,label:a.string,validationMessage:a.string,validityStyles:a.bool,valid:a.bool,required:a.bool,name:a.string,id:a.string,ariaLabelledBy:a.string,ariaDescribedBy:a.string,filterable:a.bool,filter:a.string,loading:a.bool,tags:a.arrayOf(a.shape({text:a.string,data:a.arrayOf(a.any)})),popupSettings:a.shape({animate:a.oneOfType([a.bool,a.shape({openDuration:a.number,closeDuration:a.number})]),popupClass:a.string,className:a.string,appendTo:a.any,width:a.oneOfType([a.string,a.number]),height:a.oneOfType([a.string,a.number])}),onOpen:a.func,onClose:a.func,onFocus:a.func,onBlur:a.func,onChange:a.func,onFilterChange:a.func,onExpandChange:a.func,onCancel:a.func,item:a.func,listNoData:a.func,adaptiveTitle:a.string,adaptive:a.bool};ce.displayName="KendoReactMultiSelectTree";ce.propTypes=mt;exports.MultiSelectTree=ce;exports.MultiSelectTreePropsContext=Me;
@@ -73,20 +73,20 @@ const It = "Please select a value from the list!", { sizeMap: Ne, roundedMap: St
73
73
  validityStyles: Be = y.validityStyles,
74
74
  onOpen: ae = Z,
75
75
  onClose: z = Z
76
- } = a, _ = lt(a.tabIndex, E), l = t.useRef(null), C = t.useRef(null), w = t.useRef(null), ie = t.useRef(null), H = t.useRef(null), k = t.useRef(null), $ = t.useRef(!1), G = t.useRef([]), U = t.useRef(null), [N, Ve] = t.useState(), [Ke, he] = t.useState(!1), [d, re] = t.useState(!1), [oe, qe] = t.useState(), [Ae, We] = t.useState([]), [be, ze] = t.useState(""), P = !!(oe && oe <= xt && a.adaptive), s = S !== void 0 ? S : Ke, le = !!(Array.isArray(m) && m.length), se = Tt({ validationMessage: A, valid: Le, required: ve }, le), T = st(C, a.dir), _e = {
76
+ } = a, H = lt(a.tabIndex, E), l = t.useRef(null), C = t.useRef(null), w = t.useRef(null), ie = t.useRef(null), _ = t.useRef(null), k = t.useRef(null), $ = t.useRef(!1), G = t.useRef([]), U = t.useRef(null), [N, Ve] = t.useState(), [Ke, he] = t.useState(!1), [d, re] = t.useState(!1), [oe, qe] = t.useState(), [Ae, We] = t.useState([]), [be, ze] = t.useState(""), P = !!(oe && oe <= xt && a.adaptive), s = S !== void 0 ? S : Ke, le = !!(Array.isArray(m) && m.length), se = Tt({ validationMessage: A, valid: Le, required: ve }, le), T = st(C, a.dir), He = {
77
77
  width: ht(C, y, R, L),
78
78
  ...T !== void 0 ? { direction: T } : {}
79
- }, He = t.useCallback(() => C.current && C.current.focus(), []);
79
+ }, _e = t.useCallback(() => C.current && C.current.focus(), []);
80
80
  G.current = pe === void 0 ? (m || []).map((e) => ({ text: gt(e, a.textField), data: [e] })) : [...pe], t.useImperativeHandle(l, () => ({
81
81
  props: a,
82
82
  element: C.current,
83
- focus: He
83
+ focus: _e
84
84
  })), t.useImperativeHandle(
85
85
  M,
86
86
  () => l.current
87
87
  );
88
88
  const $e = t.useCallback(() => {
89
- H.current && H.current.setCustomValidity && H.current.setCustomValidity(
89
+ _.current && _.current.setCustomValidity && _.current.setCustomValidity(
90
90
  se.valid ? "" : A === void 0 ? It : A
91
91
  );
92
92
  }, [A, se]);
@@ -96,7 +96,7 @@ const It = "Please select a value from the list!", { sizeMap: Ne, roundedMap: St
96
96
  e && e.disconnect();
97
97
  };
98
98
  }, []), t.useEffect(() => {
99
- U.current && s && U.current.setPosition(U.current._popup);
99
+ U.current && s && U.current.setPosition(U.current.element);
100
100
  }, [m, s]);
101
101
  const F = t.useCallback(
102
102
  (e, i, r) => {
@@ -358,7 +358,7 @@ const It = "Please select a value from the list!", { sizeMap: Ne, roundedMap: St
358
358
  we,
359
359
  {
360
360
  ref: k,
361
- tabIndex: _,
361
+ tabIndex: H,
362
362
  data: q,
363
363
  focusIdField: I,
364
364
  textField: a.textField,
@@ -392,7 +392,7 @@ const It = "Please select a value from the list!", { sizeMap: Ne, roundedMap: St
392
392
  "k-loading": a.loading,
393
393
  "k-required": ve
394
394
  }),
395
- tabIndex: _,
395
+ tabIndex: H,
396
396
  accessKey: a.accessKey,
397
397
  id: x,
398
398
  style: B ? { ...L, width: void 0 } : L,
@@ -441,7 +441,7 @@ const It = "Please select a value from the list!", { sizeMap: Ne, roundedMap: St
441
441
  "select",
442
442
  {
443
443
  name: Oe,
444
- ref: H,
444
+ ref: _,
445
445
  tabIndex: -1,
446
446
  "aria-hidden": !0,
447
447
  title: B,
@@ -455,7 +455,7 @@ const It = "Please select a value from the list!", { sizeMap: Ne, roundedMap: St
455
455
  ...R,
456
456
  popupClass: ee(R.popupClass, "k-multiselecttree-popup"),
457
457
  className: ee(R.className, { "k-rtl": T === "rtl" }),
458
- style: _e,
458
+ style: He,
459
459
  anchor: R.anchor || C.current,
460
460
  show: s,
461
461
  onOpen: Ge,
@@ -469,7 +469,7 @@ const It = "Please select a value from the list!", { sizeMap: Ne, roundedMap: St
469
469
  ref: w,
470
470
  onChange: Ee,
471
471
  onKeyDown: ye,
472
- tabIndex: _,
472
+ tabIndex: H,
473
473
  size: v,
474
474
  rounded: V,
475
475
  fillMode: W,
@@ -482,7 +482,7 @@ const It = "Please select a value from the list!", { sizeMap: Ne, roundedMap: St
482
482
  {
483
483
  style: { height: R.height },
484
484
  ref: k,
485
- tabIndex: _,
485
+ tabIndex: H,
486
486
  data: q,
487
487
  focusIdField: I,
488
488
  textField: a.textField,
@@ -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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("@progress/kendo-react-common"),r=(i,m)=>{const u={};return i&&i.length&&i.forEach(f=>{u[m(f)]=!0}),u},G=(i,m)=>{const{items:u,dataItemKey:f,value:p,subItemsField:w="items",operation:V}=m,t=S.getter(f),I=r(p,t);if(V==="clear")return[];if(V==="delete"){const n=r(u,t);return p.filter(e=>!n[t(e)])}const y=u[0],C=t(y),d=S.getter(w),a=[...i],c=[];let M=[],g;for(;a.length;){const n=a.pop();if(C===t(n)){M=c.map(e=>e.item),g=n;break}else{c&&c.length&&c[c.length-1].parentPosition===a.length&&c.pop();const e=d(n);e&&e.length&&(c.push({item:n,parentPosition:a.length}),a.push(...e))}}const b=[...d(g)||[]];let k=[];for(;b.length;){const n=b.pop();k.push(n);const e=d(n);e&&e.length&&b.push(...e)}const P=!I[C],l=[];if(P){l.push(...p),l.push(g),l.push(...k.filter(s=>!I[t(s)]));const n=M.filter(s=>!I[t(s)]),e=r(l,t);for(let s=n.length-1;s>-1;s--){const h=n[s],o=d(h);if(o.filter(T=>e[t(T)]).length<o.length)break;l.push(h),e[t(h)]=!0}}else{const n=t(g),e=r(k,t),s=r(M,t);l.push(...p.filter(h=>{const o=t(h);return!e[o]&&n!==o&&!s[o]}))}return l};exports.getMultiSelectTreeValue=G;exports.getValueMap=r;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("@progress/kendo-react-common"),r=(i,m)=>{const u={};return i&&i.length&&i.forEach(f=>{u[m(f)]=!0}),u},G=(i,m)=>{const{items:u,dataItemKey:f,value:p,subItemsField:w="items",operation:V}=m,t=S.getter(f),I=r(p,t);if(V==="clear")return[];if(V==="delete"){const n=r(u,t);return p.filter(e=>!n[t(e)])}const y=u[0],C=t(y),d=S.getter(w),a=[...i],c=[];let M=[],g;for(;a.length;){const n=a.pop();if(C===t(n)){M=c.map(e=>e.item),g=n;break}else{c&&c.length&&c[c.length-1].parentPosition===a.length&&c.pop();const e=d(n);e&&e.length&&(c.push({item:n,parentPosition:a.length}),a.push(...e))}}const b=[...d(g)||[]],k=[];for(;b.length;){const n=b.pop();k.push(n);const e=d(n);e&&e.length&&b.push(...e)}const P=!I[C],l=[];if(P){l.push(...p),l.push(g),l.push(...k.filter(s=>!I[t(s)]));const n=M.filter(s=>!I[t(s)]),e=r(l,t);for(let s=n.length-1;s>-1;s--){const h=n[s],o=d(h);if(o.filter(T=>e[t(T)]).length<o.length)break;l.push(h),e[t(h)]=!0}}else{const n=t(g),e=r(k,t),s=r(M,t);l.push(...p.filter(h=>{const o=t(h);return!e[o]&&n!==o&&!s[o]}))}return l};exports.getMultiSelectTreeValue=G;exports.getValueMap=r;
@@ -13,13 +13,7 @@ const u = (r, f) => {
13
13
  i[f(g)] = !0;
14
14
  }), i;
15
15
  }, E = (r, f) => {
16
- const {
17
- items: i,
18
- dataItemKey: g,
19
- value: a,
20
- subItemsField: x = "items",
21
- operation: w
22
- } = f, t = V(g), I = u(a, t);
16
+ const { items: i, dataItemKey: g, value: a, subItemsField: x = "items", operation: w } = f, t = V(g), I = u(a, t);
23
17
  if (w === "clear")
24
18
  return [];
25
19
  if (w === "delete") {
@@ -39,34 +33,33 @@ const u = (r, f) => {
39
33
  e && e.length && (c.push({ item: n, parentPosition: h.length }), h.push(...e));
40
34
  }
41
35
  }
42
- const k = [...d(m) || []];
43
- let M = [];
36
+ const k = [...d(m) || []], M = [];
44
37
  for (; k.length; ) {
45
38
  const n = k.pop();
46
39
  M.push(n);
47
40
  const e = d(n);
48
41
  e && e.length && k.push(...e);
49
42
  }
50
- const L = !I[C], l = [];
43
+ const L = !I[C], o = [];
51
44
  if (L) {
52
- l.push(...a), l.push(m), l.push(...M.filter((s) => !I[t(s)]));
53
- const n = b.filter((s) => !I[t(s)]), e = u(l, t);
45
+ o.push(...a), o.push(m), o.push(...M.filter((s) => !I[t(s)]));
46
+ const n = b.filter((s) => !I[t(s)]), e = u(o, t);
54
47
  for (let s = n.length - 1; s > -1; s--) {
55
- const p = n[s], o = d(p);
56
- if (o.filter((P) => e[t(P)]).length < o.length)
48
+ const p = n[s], l = d(p);
49
+ if (l.filter((P) => e[t(P)]).length < l.length)
57
50
  break;
58
- l.push(p), e[t(p)] = !0;
51
+ o.push(p), e[t(p)] = !0;
59
52
  }
60
53
  } else {
61
54
  const n = t(m), e = u(M, t), s = u(b, t);
62
- l.push(
55
+ o.push(
63
56
  ...a.filter((p) => {
64
- const o = t(p);
65
- return !e[o] && n !== o && !s[o];
57
+ const l = t(p);
58
+ return !e[l] && n !== l && !s[l];
66
59
  })
67
60
  );
68
61
  }
69
- return l;
62
+ return o;
70
63
  };
71
64
  export {
72
65
  E as getMultiSelectTreeValue,