@progress/kendo-react-dropdowns 9.0.0-develop.8 → 9.0.0

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.
@@ -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";const v=require("react"),n=require("prop-types"),y=require("./VirtualScrollStatic.js"),S=require("./Navigation.js"),c=require("./utils.js");function b(l){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const e in l)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(l,e);Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:()=>l[e]})}}return s.default=l,Object.freeze(s)}const P=b(v),a=class a{constructor(s){this.wrapper=null,this.list=null,this.vs=new y.VirtualScroll,this.navigation=new S.Navigation,this.handleItemClick=(e,t)=>{const i=this.initState();i.syntheticEvent=t,t.stopPropagation(),this.component.handleItemSelect(e,i),this.togglePopup(i),this.applyState(i)},this.handleFocus=e=>{if(!this.component.state.focused){const t=this.initState();t.data.focused=!0,t.events.push({type:"onFocus"}),t.syntheticEvent=e,this.applyState(t)}},this.filterChanged=(e,t)=>{const{textField:i,filterable:o}=this.component.props;o&&t.events.push({type:"onFilterChange",filter:{field:i,operator:"contains",ignoreCase:!0,value:e}})},this.togglePopup=e=>{const t=this.component.props,i=t.opened!==void 0?t.opened:this.component.state.opened;t.opened===void 0&&(e.data.opened=!i),i?e.events.push({type:"onClose"}):(e.events.push({type:"onOpen"}),this.calculatePopupWidth())},this.pageChange=(e,t)=>{const i=this.initState();i.syntheticEvent=t,this.triggerOnPageChange(i,e.skip,e.take),this.applyState(i)},this.scrollToVirtualItem=(e,t)=>{const i=this.vs;if(e.skip===0)i.reset();else{let o=i.translate;o===0&&(i.calcScrollElementHeight(),o=i.itemHeight*e.skip,i.translateTo(o,!0)),t<0&&o>0&&(o+=i.itemHeight*(e.pageSize/4)),i.container&&(i.container.scrollTop=o),this.scrollToItem(t,!0)}},this.scrollPopupByPageSize=e=>{var p,u,d,g,f,m;const t=this.vs,i=(u=(p=this.list)==null?void 0:p.parentElement)==null?void 0:u.scrollTop,o=t.enabled&&t.itemHeight?t.itemHeight:this.list?this.list.children[0].offsetHeight:0,r=(g=(d=this.list)==null?void 0:d.parentElement)==null?void 0:g.offsetHeight;i!==void 0&&r!==void 0&&((m=(f=this.list)==null?void 0:f.parentElement)==null||m.scroll({top:i+e*Math.floor(r/o)*o}))},this.renderScrollElement=()=>{const e=this.vs;return e.enabled&&P.createElement("div",{ref:t=>e.scrollElement=t,key:"scrollElementKey"})},this.resetGroupStickyHeader=(e,t)=>{e!==t.state.group&&t.setState({...t.state,group:e})},this.listBoxId=s.props.id+"list",this.guid=s.props.id,this.component=s,this.vs.PageChange=this.pageChange}didUpdate(){this.vs.listTransform&&this.vs.list&&(this.vs.list.style.transform=this.vs.listTransform,this.vs.listTransform="")}didMount(){const s=this.component.props,e=s.popupSettings||{},t=s.style||{},i=e.width;let o=s.opened===!0;i===void 0&&this.calculatePopupWidth(),s.dir===void 0&&t.direction===void 0&&(this.calculateDir(),o=!0),o&&this.component.forceUpdate()}calculateDir(){const s=this.component.element;s&&s.ownerDocument&&s.ownerDocument.defaultView&&(this.dirCalculated=s.ownerDocument.defaultView.getComputedStyle(s).direction||void 0)}calculatePopupWidth(){this.wrapper&&(this.popupWidth=this.wrapper.offsetWidth+"px")}scrollToItem(s,e,t){const i=this.list||this.vs.list;if(!i&&!t&&setTimeout(()=>{this.scrollToItem(s,e,!0)},10),s===0&&e&&this.vs.skip===0){this.vs.reset();return}if(i&&s>=0){const o=this.vs,r=o.container||i.parentNode,p=e!==void 0?e:o.enabled;c.scrollToItem(r,i,s,o.translate,p)}}initState(){return{data:{},events:[],syntheticEvent:void 0}}applyState(s){Object.keys(s.data).length>0&&this.component.setState(s.data);const e={syntheticEvent:s.syntheticEvent,nativeEvent:s.syntheticEvent?s.syntheticEvent.nativeEvent:void 0,target:this.component,value:this.component.value};s.events.forEach(t=>{const i=t.type;delete t.type;const o=i&&this.component.props[i];o&&o.call(void 0,{...e,...t})})}triggerOnPageChange(s,e,t){const i=this.component.props.virtual;if(i){const o=Math.min(Math.max(0,e),Math.max(0,i.total-t));o!==i.skip&&s.events.push({type:"onPageChange",page:{skip:o,take:t}})}}triggerPageChangeCornerItems(s,e){const t=this.component.props,{data:i=[],dataItemKey:o,virtual:r}=t,p=t.opened!==void 0?t.opened:this.component.state.opened;s&&r&&this.vs.enabled&&(r.skip>0&&c.areSame(s,i[0],o)?this.triggerOnPageChange(e,r.skip-1,r.pageSize):!p&&r.skip+r.pageSize<r.total&&c.areSame(s,i[i.length-1],o)&&this.triggerOnPageChange(e,r.skip+1,r.pageSize))}getPopupSettings(){return Object.assign({},a.defaultProps.popupSettings,this.component.props.popupSettings)}getAdaptiveAnimation(){const s=this.getPopupSettings();return s.animate!==void 0?s.animate:!0}getGroupedDataModernMode(s,e){const t=[];return s.forEach((i,o)=>{s[o-1]&&i[e]!==s[o-1][e]&&t.push({[e]:i[e]}),t.push(s[o])}),t}};a.basicPropTypes={opened:n.bool,disabled:n.bool,dir:n.string,tabIndex:n.number,accessKey:n.string,data:n.array,textField:n.string,className:n.string,label: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,itemRender:n.func,listNoDataRender:n.func,focusedItemIndex:n.func,header:n.node,footer:n.node},a.propTypes={...a.basicPropTypes,value:n.any,defaultValue:n.any,filterable:n.bool,filter:n.string,virtual:n.shape({pageSize:n.number.isRequired,skip:n.number.isRequired,total:n.number.isRequired}),onFilterChange:n.func,onPageChange:n.func},a.defaultProps={popupSettings:{height:"200px"},required:!1,validityStyles:!0};let h=a;module.exports=h;
8
+ "use client";"use strict";const v=require("react"),n=require("prop-types"),y=require("./VirtualScrollStatic.js"),S=require("./Navigation.js"),c=require("./utils.js");function b(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const P=b(v),a=class a{constructor(e){this.wrapper=null,this.list=null,this.vs=new y.VirtualScroll,this.navigation=new S.Navigation,this.handleItemClick=(t,s)=>{const i=this.initState();i.syntheticEvent=s,s.stopPropagation(),this.component.handleItemSelect(t,i),this.togglePopup(i),this.applyState(i)},this.handleFocus=t=>{if(!this.component.state.focused){const s=this.initState();s.data.focused=!0,s.events.push({type:"onFocus"}),s.syntheticEvent=t,this.applyState(s)}},this.filterChanged=(t,s)=>{const{textField:i,filterable:o}=this.component.props;o&&s.events.push({type:"onFilterChange",filter:{field:i,operator:"contains",ignoreCase:!0,value:t}})},this.togglePopup=t=>{const s=this.component.props,i=s.opened!==void 0?s.opened:this.component.state.opened;s.opened===void 0&&(t.data.opened=!i),i?t.events.push({type:"onClose"}):(t.events.push({type:"onOpen"}),this.calculatePopupWidth())},this.pageChange=(t,s)=>{const i=this.initState();i.syntheticEvent=s,this.triggerOnPageChange(i,t.skip,t.take),this.applyState(i)},this.scrollToVirtualItem=(t,s)=>{const i=this.vs;if(t.skip===0)i.reset();else{let o=i.translate;o===0&&(i.calcScrollElementHeight(),o=i.itemHeight*t.skip,i.translateTo(o,!0)),s<0&&o>0&&(o+=i.itemHeight*(t.pageSize/4)),i.container&&(i.container.scrollTop=o),this.scrollToItem(s,!0)}},this.scrollPopupByPageSize=t=>{var p,u,d,g,f,m;const s=this.vs,i=(u=(p=this.list)==null?void 0:p.parentElement)==null?void 0:u.scrollTop,o=s.enabled&&s.itemHeight?s.itemHeight:this.list?this.list.children[0].offsetHeight:0,r=(g=(d=this.list)==null?void 0:d.parentElement)==null?void 0:g.offsetHeight;i!==void 0&&r!==void 0&&((m=(f=this.list)==null?void 0:f.parentElement)==null||m.scroll({top:i+t*Math.floor(r/o)*o}))},this.renderScrollElement=()=>{const t=this.vs;return t.enabled&&P.createElement("div",{ref:s=>t.scrollElement=s,key:"scrollElementKey"})},this.resetGroupStickyHeader=(t,s)=>{t!==s.state.group&&s.setState({group:t})},this.listBoxId=e.props.id+"list",this.guid=e.props.id,this.component=e,this.vs.PageChange=this.pageChange}didUpdate(){this.vs.listTransform&&this.vs.list&&(this.vs.list.style.transform=this.vs.listTransform,this.vs.listTransform="")}didMount(){const e=this.component.props,t=e.popupSettings||{},s=e.style||{},i=t.width;let o=e.opened===!0;i===void 0&&this.calculatePopupWidth(),e.dir===void 0&&s.direction===void 0&&(this.calculateDir(),o=!0),o&&this.component.forceUpdate()}calculateDir(){const e=this.component.element;e&&e.ownerDocument&&e.ownerDocument.defaultView&&(this.dirCalculated=e.ownerDocument.defaultView.getComputedStyle(e).direction||void 0)}calculatePopupWidth(){this.wrapper&&(this.popupWidth=this.wrapper.offsetWidth+"px")}scrollToItem(e,t,s){const i=this.list||this.vs.list;if(!i&&!s&&setTimeout(()=>{this.scrollToItem(e,t,!0)},10),e===0&&t&&this.vs.skip===0){this.vs.reset();return}if(i&&e>=0){const o=this.vs,r=o.container||i.parentNode,p=t!==void 0?t:o.enabled;c.scrollToItem(r,i,e,o.translate,p)}}updateComponentArgs(e){for(let t in e)Object.hasOwnProperty.call(e,t)&&(this.component[t]=e[t])}initState(){return{data:{},events:[],syntheticEvent:void 0}}applyState(e){Object.keys(e.data).length>0&&this.component.setState(e.data);const t={syntheticEvent:e.syntheticEvent,nativeEvent:e.syntheticEvent?e.syntheticEvent.nativeEvent:void 0,target:this.component,value:this.component.value};e.events.forEach(s=>{const i=s.type;delete s.type;const o=i&&this.component.props[i];o&&o.call(void 0,{...t,...s})})}triggerOnPageChange(e,t,s){const i=this.component.props.virtual;if(i){const o=Math.min(Math.max(0,t),Math.max(0,i.total-s));o!==i.skip&&e.events.push({type:"onPageChange",page:{skip:o,take:s}})}}triggerPageChangeCornerItems(e,t){const s=this.component.props,{data:i=[],dataItemKey:o,virtual:r}=s,p=s.opened!==void 0?s.opened:this.component.state.opened;e&&r&&this.vs.enabled&&(r.skip>0&&c.areSame(e,i[0],o)?this.triggerOnPageChange(t,r.skip-1,r.pageSize):!p&&r.skip+r.pageSize<r.total&&c.areSame(e,i[i.length-1],o)&&this.triggerOnPageChange(t,r.skip+1,r.pageSize))}getPopupSettings(){return Object.assign({},a.defaultProps.popupSettings,this.component.props.popupSettings)}getAdaptiveAnimation(){const e=this.getPopupSettings();return e.animate!==void 0?e.animate:!0}getGroupedDataModernMode(e,t){const s=[];return e.forEach((i,o)=>{e[o-1]&&i[t]!==e[o-1][t]&&s.push({[t]:i[t]}),s.push(e[o])}),s}};a.basicPropTypes={opened:n.bool,disabled:n.bool,dir:n.string,tabIndex:n.number,accessKey:n.string,data:n.array,textField:n.string,className:n.string,label: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,itemRender:n.func,listNoDataRender:n.func,focusedItemIndex:n.func,header:n.node,footer:n.node},a.propTypes={...a.basicPropTypes,value:n.any,defaultValue:n.any,filterable:n.bool,filter:n.string,virtual:n.shape({pageSize:n.number.isRequired,skip:n.number.isRequired,total:n.number.isRequired}),onFilterChange:n.func,onPageChange:n.func},a.defaultProps={popupSettings:{height:"200px"},required:!1,validityStyles:!0};let h=a;module.exports=h;
@@ -7,86 +7,90 @@
7
7
  */
8
8
  "use client";
9
9
  import * as m from "react";
10
- import s from "prop-types";
10
+ import n from "prop-types";
11
11
  import { VirtualScroll as v } from "./VirtualScrollStatic.mjs";
12
12
  import { Navigation as y } from "./Navigation.mjs";
13
13
  import { scrollToItem as S, areSame as g } from "./utils.mjs";
14
14
  const a = class a {
15
- constructor(n) {
16
- this.wrapper = null, this.list = null, this.vs = new v(), this.navigation = new y(), this.handleItemClick = (i, t) => {
17
- const e = this.initState();
18
- e.syntheticEvent = t, t.stopPropagation(), this.component.handleItemSelect(i, e), this.togglePopup(e), this.applyState(e);
19
- }, this.handleFocus = (i) => {
15
+ constructor(s) {
16
+ this.wrapper = null, this.list = null, this.vs = new v(), this.navigation = new y(), this.handleItemClick = (t, e) => {
17
+ const i = this.initState();
18
+ i.syntheticEvent = e, e.stopPropagation(), this.component.handleItemSelect(t, i), this.togglePopup(i), this.applyState(i);
19
+ }, this.handleFocus = (t) => {
20
20
  if (!this.component.state.focused) {
21
- const t = this.initState();
22
- t.data.focused = !0, t.events.push({ type: "onFocus" }), t.syntheticEvent = i, this.applyState(t);
21
+ const e = this.initState();
22
+ e.data.focused = !0, e.events.push({ type: "onFocus" }), e.syntheticEvent = t, this.applyState(e);
23
23
  }
24
- }, this.filterChanged = (i, t) => {
25
- const { textField: e, filterable: o } = this.component.props;
26
- o && t.events.push({
24
+ }, this.filterChanged = (t, e) => {
25
+ const { textField: i, filterable: o } = this.component.props;
26
+ o && e.events.push({
27
27
  type: "onFilterChange",
28
28
  filter: {
29
- field: e,
29
+ field: i,
30
30
  operator: "contains",
31
31
  ignoreCase: !0,
32
- value: i
32
+ value: t
33
33
  }
34
34
  });
35
- }, this.togglePopup = (i) => {
36
- const t = this.component.props, e = t.opened !== void 0 ? t.opened : this.component.state.opened;
37
- t.opened === void 0 && (i.data.opened = !e), e ? i.events.push({ type: "onClose" }) : (i.events.push({ type: "onOpen" }), this.calculatePopupWidth());
38
- }, this.pageChange = (i, t) => {
39
- const e = this.initState();
40
- e.syntheticEvent = t, this.triggerOnPageChange(e, i.skip, i.take), this.applyState(e);
41
- }, this.scrollToVirtualItem = (i, t) => {
42
- const e = this.vs;
43
- if (i.skip === 0)
44
- e.reset();
35
+ }, this.togglePopup = (t) => {
36
+ const e = this.component.props, i = e.opened !== void 0 ? e.opened : this.component.state.opened;
37
+ e.opened === void 0 && (t.data.opened = !i), i ? t.events.push({ type: "onClose" }) : (t.events.push({ type: "onOpen" }), this.calculatePopupWidth());
38
+ }, this.pageChange = (t, e) => {
39
+ const i = this.initState();
40
+ i.syntheticEvent = e, this.triggerOnPageChange(i, t.skip, t.take), this.applyState(i);
41
+ }, this.scrollToVirtualItem = (t, e) => {
42
+ const i = this.vs;
43
+ if (t.skip === 0)
44
+ i.reset();
45
45
  else {
46
- let o = e.translate;
47
- o === 0 && (e.calcScrollElementHeight(), o = e.itemHeight * i.skip, e.translateTo(o, !0)), t < 0 && o > 0 && (o += e.itemHeight * (i.pageSize / 4)), e.container && (e.container.scrollTop = o), this.scrollToItem(t, !0);
46
+ let o = i.translate;
47
+ o === 0 && (i.calcScrollElementHeight(), o = i.itemHeight * t.skip, i.translateTo(o, !0)), e < 0 && o > 0 && (o += i.itemHeight * (t.pageSize / 4)), i.container && (i.container.scrollTop = o), this.scrollToItem(e, !0);
48
48
  }
49
- }, this.scrollPopupByPageSize = (i) => {
49
+ }, this.scrollPopupByPageSize = (t) => {
50
50
  var r, l, h, c, u, d;
51
- const t = this.vs, e = (l = (r = this.list) == null ? void 0 : r.parentElement) == null ? void 0 : l.scrollTop, o = t.enabled && t.itemHeight ? t.itemHeight : this.list ? this.list.children[0].offsetHeight : 0, p = (c = (h = this.list) == null ? void 0 : h.parentElement) == null ? void 0 : c.offsetHeight;
52
- e !== void 0 && p !== void 0 && ((d = (u = this.list) == null ? void 0 : u.parentElement) == null || d.scroll({
53
- top: e + i * Math.floor(p / o) * o
51
+ const e = this.vs, i = (l = (r = this.list) == null ? void 0 : r.parentElement) == null ? void 0 : l.scrollTop, o = e.enabled && e.itemHeight ? e.itemHeight : this.list ? this.list.children[0].offsetHeight : 0, p = (c = (h = this.list) == null ? void 0 : h.parentElement) == null ? void 0 : c.offsetHeight;
52
+ i !== void 0 && p !== void 0 && ((d = (u = this.list) == null ? void 0 : u.parentElement) == null || d.scroll({
53
+ top: i + t * Math.floor(p / o) * o
54
54
  }));
55
55
  }, this.renderScrollElement = () => {
56
- const i = this.vs;
57
- return i.enabled && /* @__PURE__ */ m.createElement("div", { ref: (t) => i.scrollElement = t, key: "scrollElementKey" });
58
- }, this.resetGroupStickyHeader = (i, t) => {
59
- i !== t.state.group && t.setState({ ...t.state, group: i });
60
- }, this.listBoxId = n.props.id + "list", this.guid = n.props.id, this.component = n, this.vs.PageChange = this.pageChange;
56
+ const t = this.vs;
57
+ return t.enabled && /* @__PURE__ */ m.createElement("div", { ref: (e) => t.scrollElement = e, key: "scrollElementKey" });
58
+ }, this.resetGroupStickyHeader = (t, e) => {
59
+ t !== e.state.group && e.setState({ group: t });
60
+ }, this.listBoxId = s.props.id + "list", this.guid = s.props.id, this.component = s, this.vs.PageChange = this.pageChange;
61
61
  }
62
62
  didUpdate() {
63
63
  this.vs.listTransform && this.vs.list && (this.vs.list.style.transform = this.vs.listTransform, this.vs.listTransform = "");
64
64
  }
65
65
  didMount() {
66
- const n = this.component.props, i = n.popupSettings || {}, t = n.style || {}, e = i.width;
67
- let o = n.opened === !0;
68
- e === void 0 && this.calculatePopupWidth(), n.dir === void 0 && t.direction === void 0 && (this.calculateDir(), o = !0), o && this.component.forceUpdate();
66
+ const s = this.component.props, t = s.popupSettings || {}, e = s.style || {}, i = t.width;
67
+ let o = s.opened === !0;
68
+ i === void 0 && this.calculatePopupWidth(), s.dir === void 0 && e.direction === void 0 && (this.calculateDir(), o = !0), o && this.component.forceUpdate();
69
69
  }
70
70
  calculateDir() {
71
- const n = this.component.element;
72
- n && n.ownerDocument && n.ownerDocument.defaultView && (this.dirCalculated = n.ownerDocument.defaultView.getComputedStyle(n).direction || void 0);
71
+ const s = this.component.element;
72
+ s && s.ownerDocument && s.ownerDocument.defaultView && (this.dirCalculated = s.ownerDocument.defaultView.getComputedStyle(s).direction || void 0);
73
73
  }
74
74
  calculatePopupWidth() {
75
75
  this.wrapper && (this.popupWidth = this.wrapper.offsetWidth + "px");
76
76
  }
77
- scrollToItem(n, i, t) {
78
- const e = this.list || this.vs.list;
79
- if (!e && !t && setTimeout(() => {
80
- this.scrollToItem(n, i, !0);
81
- }, 10), n === 0 && i && this.vs.skip === 0) {
77
+ scrollToItem(s, t, e) {
78
+ const i = this.list || this.vs.list;
79
+ if (!i && !e && setTimeout(() => {
80
+ this.scrollToItem(s, t, !0);
81
+ }, 10), s === 0 && t && this.vs.skip === 0) {
82
82
  this.vs.reset();
83
83
  return;
84
84
  }
85
- if (e && n >= 0) {
86
- const o = this.vs, p = o.container || e.parentNode, r = i !== void 0 ? i : o.enabled;
87
- S(p, e, n, o.translate, r);
85
+ if (i && s >= 0) {
86
+ const o = this.vs, p = o.container || i.parentNode, r = t !== void 0 ? t : o.enabled;
87
+ S(p, i, s, o.translate, r);
88
88
  }
89
89
  }
90
+ updateComponentArgs(s) {
91
+ for (let t in s)
92
+ Object.hasOwnProperty.call(s, t) && (this.component[t] = s[t]);
93
+ }
90
94
  initState() {
91
95
  return {
92
96
  data: {},
@@ -94,100 +98,100 @@ const a = class a {
94
98
  syntheticEvent: void 0
95
99
  };
96
100
  }
97
- applyState(n) {
98
- Object.keys(n.data).length > 0 && this.component.setState(n.data);
99
- const i = {
100
- syntheticEvent: n.syntheticEvent,
101
- nativeEvent: n.syntheticEvent ? n.syntheticEvent.nativeEvent : void 0,
101
+ applyState(s) {
102
+ Object.keys(s.data).length > 0 && this.component.setState(s.data);
103
+ const t = {
104
+ syntheticEvent: s.syntheticEvent,
105
+ nativeEvent: s.syntheticEvent ? s.syntheticEvent.nativeEvent : void 0,
102
106
  target: this.component,
103
107
  value: this.component.value
104
108
  };
105
- n.events.forEach((t) => {
106
- const e = t.type;
107
- delete t.type;
108
- const o = e && this.component.props[e];
109
+ s.events.forEach((e) => {
110
+ const i = e.type;
111
+ delete e.type;
112
+ const o = i && this.component.props[i];
109
113
  o && o.call(void 0, {
110
- ...i,
111
- ...t
114
+ ...t,
115
+ ...e
112
116
  });
113
117
  });
114
118
  }
115
- triggerOnPageChange(n, i, t) {
116
- const e = this.component.props.virtual;
117
- if (e) {
118
- const o = Math.min(Math.max(0, i), Math.max(0, e.total - t));
119
- o !== e.skip && n.events.push({
119
+ triggerOnPageChange(s, t, e) {
120
+ const i = this.component.props.virtual;
121
+ if (i) {
122
+ const o = Math.min(Math.max(0, t), Math.max(0, i.total - e));
123
+ o !== i.skip && s.events.push({
120
124
  type: "onPageChange",
121
- page: { skip: o, take: t }
125
+ page: { skip: o, take: e }
122
126
  });
123
127
  }
124
128
  }
125
- triggerPageChangeCornerItems(n, i) {
126
- const t = this.component.props, { data: e = [], dataItemKey: o, virtual: p } = t, r = t.opened !== void 0 ? t.opened : this.component.state.opened;
127
- n && p && this.vs.enabled && (p.skip > 0 && g(n, e[0], o) ? this.triggerOnPageChange(i, p.skip - 1, p.pageSize) : !r && p.skip + p.pageSize < p.total && g(n, e[e.length - 1], o) && this.triggerOnPageChange(i, p.skip + 1, p.pageSize));
129
+ triggerPageChangeCornerItems(s, t) {
130
+ const e = this.component.props, { data: i = [], dataItemKey: o, virtual: p } = e, r = e.opened !== void 0 ? e.opened : this.component.state.opened;
131
+ s && p && this.vs.enabled && (p.skip > 0 && g(s, i[0], o) ? this.triggerOnPageChange(t, p.skip - 1, p.pageSize) : !r && p.skip + p.pageSize < p.total && g(s, i[i.length - 1], o) && this.triggerOnPageChange(t, p.skip + 1, p.pageSize));
128
132
  }
129
133
  getPopupSettings() {
130
134
  return Object.assign({}, a.defaultProps.popupSettings, this.component.props.popupSettings);
131
135
  }
132
136
  getAdaptiveAnimation() {
133
- const n = this.getPopupSettings();
134
- return n.animate !== void 0 ? n.animate : !0;
137
+ const s = this.getPopupSettings();
138
+ return s.animate !== void 0 ? s.animate : !0;
135
139
  }
136
- getGroupedDataModernMode(n, i) {
137
- const t = [];
138
- return n.forEach((e, o) => {
139
- n[o - 1] && e[i] !== n[o - 1][i] && t.push({ [i]: e[i] }), t.push(n[o]);
140
- }), t;
140
+ getGroupedDataModernMode(s, t) {
141
+ const e = [];
142
+ return s.forEach((i, o) => {
143
+ s[o - 1] && i[t] !== s[o - 1][t] && e.push({ [t]: i[t] }), e.push(s[o]);
144
+ }), e;
141
145
  }
142
146
  };
143
147
  a.basicPropTypes = {
144
- opened: s.bool,
145
- disabled: s.bool,
146
- dir: s.string,
147
- tabIndex: s.number,
148
- accessKey: s.string,
149
- data: s.array,
150
- textField: s.string,
151
- className: s.string,
152
- label: s.string,
153
- loading: s.bool,
154
- popupSettings: s.shape({
155
- animate: s.oneOfType([
156
- s.bool,
157
- s.shape({
158
- openDuration: s.number,
159
- closeDuration: s.number
148
+ opened: n.bool,
149
+ disabled: n.bool,
150
+ dir: n.string,
151
+ tabIndex: n.number,
152
+ accessKey: n.string,
153
+ data: n.array,
154
+ textField: n.string,
155
+ className: n.string,
156
+ label: n.string,
157
+ loading: n.bool,
158
+ popupSettings: n.shape({
159
+ animate: n.oneOfType([
160
+ n.bool,
161
+ n.shape({
162
+ openDuration: n.number,
163
+ closeDuration: n.number
160
164
  })
161
165
  ]),
162
- popupClass: s.string,
163
- className: s.string,
164
- appendTo: s.any,
165
- width: s.oneOfType([s.string, s.number]),
166
- height: s.oneOfType([s.string, s.number])
166
+ popupClass: n.string,
167
+ className: n.string,
168
+ appendTo: n.any,
169
+ width: n.oneOfType([n.string, n.number]),
170
+ height: n.oneOfType([n.string, n.number])
167
171
  }),
168
- onOpen: s.func,
169
- onClose: s.func,
170
- onFocus: s.func,
171
- onBlur: s.func,
172
- onChange: s.func,
173
- itemRender: s.func,
174
- listNoDataRender: s.func,
175
- focusedItemIndex: s.func,
176
- header: s.node,
177
- footer: s.node
172
+ onOpen: n.func,
173
+ onClose: n.func,
174
+ onFocus: n.func,
175
+ onBlur: n.func,
176
+ onChange: n.func,
177
+ itemRender: n.func,
178
+ listNoDataRender: n.func,
179
+ focusedItemIndex: n.func,
180
+ header: n.node,
181
+ footer: n.node
178
182
  }, a.propTypes = {
179
183
  ...a.basicPropTypes,
180
- value: s.any,
181
- defaultValue: s.any,
182
- filterable: s.bool,
183
- filter: s.string,
184
- virtual: s.shape({
185
- pageSize: s.number.isRequired,
186
- skip: s.number.isRequired,
187
- total: s.number.isRequired
184
+ value: n.any,
185
+ defaultValue: n.any,
186
+ filterable: n.bool,
187
+ filter: n.string,
188
+ virtual: n.shape({
189
+ pageSize: n.number.isRequired,
190
+ skip: n.number.isRequired,
191
+ total: n.number.isRequired
188
192
  }),
189
- onFilterChange: s.func,
190
- onPageChange: s.func
193
+ onFilterChange: n.func,
194
+ onPageChange: n.func
191
195
  }, a.defaultProps = {
192
196
  popupSettings: {
193
197
  height: "200px"
@@ -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";const o=require("@progress/kendo-react-common"),d=require("react");function m(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const l=m(d),p=e=>{const{group:n,virtual:t,render:s,isMultiColumn:r=!1,id:u}=e,a=o.useUnstyled(),c=a&&a.uDropDownsBase,i=l.createElement("li",{id:u,role:"group",className:o.classNames(o.uDropDownsBase.groupLi({c,isMultiColumn:r})),style:r?{boxSizing:"inherit"}:{position:t?"relative":"unset"}},l.createElement("span",{className:s?void 0:o.classNames(o.uDropDownsBase.groupItemText({c,isMultiColumn:r}))},n));return s!==void 0?s.call(void 0,i,e):i};module.exports=p;
8
+ "use client";"use strict";const o=require("@progress/kendo-react-common"),d=require("react");function m(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const l=m(d),p=e=>{const{group:n,virtual:t,render:s,isMultiColumn:r=!1,id:u}=e,a=o.useUnstyled(),c=a&&a.uDropDownsBase,i=l.createElement("li",{id:u,role:"group",className:o.classNames(o.uDropDownsBase.groupLi({c,isMultiColumn:r})),style:r?{boxSizing:"inherit",position:t?"relative":"unset"}:{position:t?"relative":"unset"}},l.createElement("span",{className:s?void 0:o.classNames(o.uDropDownsBase.groupItemText({c,isMultiColumn:r}))},n));return s!==void 0?s.call(void 0,i,e):i};module.exports=p;
@@ -6,27 +6,27 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import { useUnstyled as d, classNames as i, uDropDownsBase as l } from "@progress/kendo-react-common";
10
- import * as n from "react";
11
- const g = (t) => {
12
- const { group: u, virtual: c, render: e, isMultiColumn: s = !1, id: m } = t, o = d(), r = o && o.uDropDownsBase, a = /* @__PURE__ */ n.createElement(
9
+ import { useUnstyled as d, classNames as a, uDropDownsBase as l } from "@progress/kendo-react-common";
10
+ import * as u from "react";
11
+ const v = (t) => {
12
+ const { group: c, virtual: o, render: e, isMultiColumn: s = !1, id: m } = t, r = d(), i = r && r.uDropDownsBase, n = /* @__PURE__ */ u.createElement(
13
13
  "li",
14
14
  {
15
15
  id: m,
16
16
  role: "group",
17
- className: i(l.groupLi({ c: r, isMultiColumn: s })),
18
- style: s ? { boxSizing: "inherit" } : { position: c ? "relative" : "unset" }
17
+ className: a(l.groupLi({ c: i, isMultiColumn: s })),
18
+ style: s ? { boxSizing: "inherit", position: o ? "relative" : "unset" } : { position: o ? "relative" : "unset" }
19
19
  },
20
- /* @__PURE__ */ n.createElement(
20
+ /* @__PURE__ */ u.createElement(
21
21
  "span",
22
22
  {
23
- className: e ? void 0 : i(l.groupItemText({ c: r, isMultiColumn: s }))
23
+ className: e ? void 0 : a(l.groupItemText({ c: i, isMultiColumn: s }))
24
24
  },
25
- u
25
+ c
26
26
  )
27
27
  );
28
- return e !== void 0 ? e.call(void 0, a, t) : a;
28
+ return e !== void 0 ? e.call(void 0, n, t) : n;
29
29
  };
30
30
  export {
31
- g as default
31
+ v as default
32
32
  };