@progress/kendo-react-dropdowns 9.2.0-develop.7 → 9.2.0-develop.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +132 -128
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/index.d.mts +242 -242
- package/index.d.ts +242 -242
- package/package-metadata.mjs +1 -1
- package/package.json +9 -9
|
@@ -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 Bt=require("react"),k=require("prop-types"),o=require("@progress/kendo-react-common"),Ht=require("@progress/kendo-react-labels"),tt=require("@progress/kendo-svg-icons"),_t=require("../common/ListContainer.js"),Wt=require("../common/ListFilter.js"),nt=require("../common/GroupStickyHeader.js"),Ut=require("../common/ListDefaultItem.js"),Gt=require("../common/List.js"),ot=require("../common/DropDownBase.js"),u=require("../common/utils.js"),jt=require("../package-metadata.js"),rt=require("@progress/kendo-react-buttons"),Yt=require("@progress/kendo-react-intl"),Pe=require("../messages/index.js"),Fe=require("@progress/kendo-react-layout");function $t(I){const $=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(I){for(const E in I)if(E!=="default"){const B=Object.getOwnPropertyDescriptor(I,E);Object.defineProperty($,E,B.get?B:{enumerable:!0,get:()=>I[E]})}}return $.default=I,Object.freeze($)}const s=$t(Bt),Jt="Please select a value from the list!",me=s.forwardRef((I,$)=>{o.validatePackage(jt.packageMetadata);const E=o.useUnstyled(),B=o.useId(I.id),r=o.usePropsContext(at,I),{delay:st=F.delay,tabIndex:it=F.tabIndex,ignoreCase:ge=F.ignoreCase,size:J=F.size,rounded:Me=F.rounded,fillMode:fe=F.fillMode,groupMode:Qt=F.groupMode}=r,ve=()=>{if(o.canUseDOM)return _.current&&_.current.ownerDocument||window.document},lt=()=>{var e,n;(e=t==null?void 0:t.current)!=null&&e.wrapper&&((n=t==null?void 0:t.current)==null||n.wrapper.focus({preventScroll:!0}))},N=()=>{let e;return O.current!==void 0&&O.current!==null?e=O.current:r.value!==void 0?e=r.value:g.value!==void 0&&g.value!==null?e=g.value:r.defaultValue!==void 0&&r.defaultValue!==null&&(e=r.defaultValue),!u.isPresent(e)&&r.defaultItem!==void 0&&r.defaultItem!==null&&(e=r.defaultItem),e},ct=()=>{const{dataItemKey:e}=r,n=u.getFilteredData(I),i=N();return n.findIndex(p=>u.areSame(p,i,e))},De=()=>r.required!==void 0?r.required:F.required,ye=()=>{const e=r.validationMessage!==void 0,n=N(),i=!De()||n!==null&&n!==""&&n!==void 0,p=r.valid!==void 0?r.valid:i;return{customError:e,valid:p,valueMissing:n===null}},dt=()=>r.validityStyles!==void 0?r.validityStyles:F.validityStyles,ne=e=>{oe.current=!0,e.focus(),window.setTimeout(()=>oe.current=!1,30)},we=()=>{X.current&&ne(X.current),r.adaptive&&setTimeout(()=>{X.current&&ne(X.current)},300)},ut=s.useCallback(e=>{for(const n of e)Kt(n.target.clientWidth)},[]),Te=()=>{re.current&&re.current.setCustomValidity&&re.current.setCustomValidity(ye().valid?"":r.validationMessage||Jt)},H=(e,n)=>{const i=N();u.areSame(i,e,r.dataItemKey)||(r.value===void 0&&(n.data.value=e),t.current.updateComponentArgs({value:e}),O.current=e,n.events.push({type:"onChange"}))},b=e=>{var n;(n=t==null?void 0:t.current)==null||n.applyState(e),O.current=void 0},Q=(e,n)=>{var c;const{virtual:i,dataItemKey:p,defaultItem:m}=r,f=u.getFilteredData(I),D=i?i.skip:0,v=N(),a=e===-1&&m!==void 0?m:f[e-D],d=!u.areSame(a,v,p);H(a,n),d&&((c=t==null?void 0:t.current)==null||c.triggerPageChangeCornerItems(a,n))},T=(e,n,i)=>{var h,w;const{defaultItem:p,dataItemKey:m,virtual:f={skip:0,total:0,pageSize:0}}=r,D=N(),v=u.getFilteredData(I),a=(h=t==null?void 0:t.current)==null?void 0:h.vs,d=v.findIndex(S=>u.areSame(S,D,m)),c=(w=t==null?void 0:t.current)==null?void 0:w.navigation.navigate({current:f.skip+d,max:(a!=null&&a.enabled?f.total:v.length)-1,min:p!==void 0?-1:0,keyCode:n,skipItems:i||void 0});c!==void 0&&Q(c,e),b(e)},pt=e=>{_.current=e,t.current.wrapper=e},mt=e=>s.createElement("select",{name:r.name,ref:n=>{re.current=n},tabIndex:-1,"aria-hidden":!0,title:r.label,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},s.createElement("option",{value:r.valueMap?r.valueMap.call(void 0,e):e})),he=()=>{const{textField:e,dataItemKey:n,virtual:i={skip:0},focusedItemIndex:p=u.itemIndexStartsWith,filterable:m,skipDisabledItems:f=!0}=r,D=N(),v=u.getFilteredData(I),a=r.filter?r.filter:g.text;return f&&e&&!a&&!D?v.findIndex(d=>!d.disabled&&d[e]):u.isPresent(D)&&a===void 0||m&&a===""?v.findIndex(d=>u.areSame(d,D,n)):a?xe.current?p(v,a,e):v.findIndex(d=>u.areSame(d,D,n)):i.skip===0?0:-1},Oe=(e,n)=>n!==void 0&&n!==-1&&e&&e.length>0&&e[n].disabled,Ie=()=>{const e=u.getFilteredData(I),n=t.current.initState(),i=he();Oe(e,i)&&(H(null,n),b(n))},Se=e=>{if(e.isPropagationStopped())return;const n=t.current.initState();n.syntheticEvent=e,g.focused||(n.data.focused=!0),Ie(),t.current.togglePopup(n),b(n)},qe=e=>{var M,ue,V,pe,Y,Re,et;e&&e.target instanceof Element&&e.target.nodeName==="INPUT"&&e.stopPropagation&&e.stopPropagation();const{filterable:n,disabled:i,defaultItem:p,leftRightKeysNavigation:m=!0,virtual:f={skip:0,total:0,pageSize:0},dataItemKey:D,groupField:v="",textField:a,skipDisabledItems:d=!0}=r,c=u.getFilteredData(I),h=N(),w=c.findIndex(L=>u.areSame(L,h,D)),S=r.opened!==void 0?r.opened:g.opened,l=e.keyCode,P=l===o.Keys.home||l===o.Keys.end,K=l===o.Keys.up||l===o.Keys.down,j=!S&&(e.altKey&&l===o.Keys.down||l===o.Keys.enter||l===o.Keys.space),te=S&&(e.altKey&&l===o.Keys.up||l===o.Keys.esc),ce=m&&(l===o.Keys.left||l===o.Keys.right),de=K||ce&&!n||P,C=t.current.initState();if(C.syntheticEvent=e,!i){if(P&&((M=t==null?void 0:t.current)!=null&&M.vs.enabled))l===o.Keys.home?f.skip!==0?((ue=t==null?void 0:t.current)==null||ue.triggerOnPageChange(C,0,f.pageSize),q.current=!0):H(c[0],C):f.skip<f.total-f.pageSize?((V=t==null?void 0:t.current)==null||V.triggerOnPageChange(C,f.total-f.pageSize,f.pageSize),q.current=!0):H(c[c.length-1],C);else if(S&&l===o.Keys.pageUp)e.preventDefault(),(pe=t==null?void 0:t.current)==null||pe.scrollPopupByPageSize(-1);else if(S&&l===o.Keys.pageDown)e.preventDefault(),(Y=t==null?void 0:t.current)==null||Y.scrollPopupByPageSize(1);else if(S&&l===o.Keys.enter){const L=he();Oe(c,L)?(H(null,C),b(C)):Q(L,C),(Re=t==null?void 0:t.current)==null||Re.togglePopup(C),e.preventDefault()}else if(j||te)te&&Ie(),(et=t==null?void 0:t.current)==null||et.togglePopup(C),e.preventDefault();else if(de){if(xe.current=!1,v!==""&&a)if(!d&&S)T(C,l);else{let L;if(l===o.Keys.down||l===o.Keys.right){const x=c.slice(w+1).find(y=>!y.disabled&&y[a]);L=x&&c.findIndex(y=>y[a]===x[a])}else if(l===o.Keys.up||l===o.Keys.left){let x;if(w===0&&p)L=-1;else if(w===-1)x=c,L=c.findIndex(y=>!y.disabled&&y[a]);else{x=c.slice(0,w);let y=x.pop();for(;y&&y.disabled;)y=x.pop();L=y&&c.findIndex(be=>be[a]===y[a])}}if(L!==void 0){const x=L-w;T(C,l,x)}else L===void 0&&c.findIndex(x=>x[a]===h[a])===c.length-1&&T(C,l)}else if(!d&&S||P)T(C,l);else if(a){let L;if(l===o.Keys.down||l===o.Keys.right){const x=c.slice(w+1).find(y=>!y.disabled&&y[a]);L=x&&c.findIndex(y=>y[a]===x[a])}else if(l===o.Keys.up||l===o.Keys.left){let x;if(w===0&&p)L=-1;else if(w===-1)x=c,L=c.find(y=>!y.disabled&&y[a]);else{x=c.slice(0,w);let y=x.pop();for(;y&&y.disabled;)y=x.pop();L=y&&c.findIndex(be=>be[a]===y[a])}}if(L!==void 0){const x=L-w;T(C,l,x)}else L===void 0&&c.findIndex(x=>x[a]===h[a])===c.length-1&&T(C,l)}else T(C,l);e.preventDefault()}b(C)}},gt=e=>{const n=t.current.initState();n.syntheticEvent=e.syntheticEvent,r.filter===void 0&&(n.data.text=e.target.value),t.current.filterChanged(e.target.value,n),xe.current=!0,b(n),R({group:void 0,text:String(e.target.value)})},Ae=()=>{const e=r.filter!==void 0?r.filter:g.text;return r.filterable&&s.createElement(Wt,{value:e,ref:n=>X.current=n&&n.element,onChange:gt,onKeyDown:qe,size:J,rounded:Me,fillMode:fe,renderListFilterWrapper:!0})},ft=e=>{var i;const n=t.current.initState();n.syntheticEvent=e,(i=t==null?void 0:t.current)==null||i.togglePopup(n),H(r.defaultItem,n),b(n)},ze=()=>{const{textField:e,defaultItem:n,dataItemKey:i}=r,p=N();return n!==void 0&&s.createElement(Ut,{defaultItem:n,textField:e,selected:u.areSame(p,n,i),key:"defaultitemkey",onClick:ft})},vt=(e,n)=>{var i;(i=t==null?void 0:t.current)==null||i.handleItemClick(e,n),O.current=void 0},Dt=e=>{const{vs:n,list:i}=t.current;n.scrollHandler(e);const{groupField:p}=r;let m=u.getFilteredData(I);if(!(!p||!m.length)&&p){const f=_e.current=_e.current||(n.enabled?n.itemHeight:i?i.children[0].offsetHeight:0),v=e.target.scrollTop-n.skip*f;m=t.current.getGroupedDataModernMode(m,p);let a=m[0][p];for(let d=1;d<m.length&&!(f*d>v);d++)m[d]&&m[d][p]&&(a=m[d][p]);a!==g.group&&R({group:a})}},Ve=()=>{var l;const{textField:e,dataItemKey:n,virtual:i={skip:0,total:void 0},groupHeaderItemRender:p,listNoDataRender:m,itemRender:f}=r,D=u.getFilteredData(I),v=E&&E.uDropDownList,a=t.current.vs,d=i.skip,c=r.opened!==void 0?r.opened:g.opened,h=t.current.getPopupSettings(),w=`translateY(${a.translate}px)`,S=N();return s.createElement(Gt,{id:Le,show:c,data:D.slice(),focusedIndex:he(),value:S,textField:e,valueField:n,optionsGuid:Ge,groupField:r.groupField,groupMode:"modern",listRef:P=>a.list=t.current.list=P,wrapperStyle:{maxHeight:h.height},wrapperCssClass:o.classNames(o.uDropDownList.listContent({c:v})),listStyle:a.enabled?{transform:w}:void 0,key:"listkey",skip:d,onClick:vt,itemRender:f,groupHeaderItemRender:p,noDataRender:m,onScroll:Dt,wrapperRef:a.scrollerRef,scroller:(l=t==null?void 0:t.current)==null?void 0:l.renderScrollElement(),ariaSetSize:i.total})},yt=()=>{var w;const{header:e,footer:n,adaptiveTitle:i,groupField:p,groupStickyHeaderItemRender:m,list:f}=r,D=u.getFilteredData(I),v=r.opened!==void 0?r.opened:g.opened,a=E&&E.uDropDownList,d=E&&E.uDropDownsActionSheet,c={navigatable:!1,navigatableElements:[],expand:v,animation:!0,onClose:S=>Se(S),className:o.classNames(o.uDropDownsActionSheet.wrapper({c:d}),"k-adaptive-actionsheet"),animationStyles:U&&G&&U<=G.small?{top:0,width:"100%",height:"100%"}:void 0,position:U&&G&&U<=G.small?"fullscreen":void 0};let{group:h}=g;return h===void 0&&p!==void 0&&(h=u.getItemValue(D[0],p)),s.createElement(Fe.ActionSheet,{...c},s.createElement(Fe.ActionSheetHeader,{className:o.classNames(o.uDropDownsActionSheet.header({c:d}))},s.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.titleBar({c:d}))},s.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.title({c:d}))},s.createElement("div",null,i)),s.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.actions({c:d}))},s.createElement(rt.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:Se,icon:"x",svgIcon:tt.xIcon}))),s.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.titleBarGroup({c:d}))},Ae())),s.createElement(Fe.ActionSheetContent,{overflowHidden:!0},e&&s.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:a}))},e),s.createElement("div",{className:o.classNames(o.uDropDownList.list({c:a,size:J,virtual:(w=t==null?void 0:t.current)==null?void 0:w.vs.enabled}))},ze(),!f&&h&&D.length!==0&&s.createElement(nt,{group:h,groupMode:"modern",render:m}),Ve()),n&&s.createElement("div",{className:o.classNames(o.uDropDownList.listFooter({c:a}))},n)))},wt=()=>{g.focused&&window.setTimeout(()=>{g.focused&&t.current.wrapper&&ne(t.current.wrapper)})},ht=e=>{var n;(n=r.popupSettings)!=null&&n.onMouseDownOutside&&r.popupSettings.onMouseDownOutside.call(void 0,e)},It=()=>{const{header:e,footer:n,dir:i,groupField:p,groupStickyHeaderItemRender:m,list:f}=r,D=u.getFilteredData(I),v=t.current,a=v.getPopupSettings(),d=r.opened!==void 0?r.opened:g.opened,c=a.width!==void 0?a.width:v.popupWidth,h=E&&E.uDropDownList,w={dir:i!==void 0?i:v.dirCalculated,width:c,popupSettings:{...a,popupClass:o.classNames(a.popupClass,o.uDropDownList.listContainer({c:h})),anchor:a.anchor||_.current,show:d,onOpen:we,onClose:wt,onMouseDownOutside:ht},itemsCount:[D.length]};let{group:S}=g;return S===void 0&&p!==void 0&&(S=u.getItemValue(D[0],p)),s.createElement(_t,{...w},Ae(),e&&s.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:h}))},e),s.createElement("div",{className:o.classNames(o.uDropDownList.list({c:h,size:J,virtual:t.current.vs.enabled}))},ze(),!f&&S&&D.length!==0&&s.createElement(nt,{group:S,groupMode:"modern",render:m}),Ve()),n&&s.createElement("div",{className:o.classNames(o.uDropDownList.listFooter({c:h}))},n))},St=e=>{const{dataItemKey:n}=r,i=u.getFilteredData(I),p=N();let m=i.map((K,j)=>({item:K,itemIndex:j}));const f=W.current.word,D=W.current.last,v=u.sameCharsOnly(f,D);let a=m.length,d=Math.max(0,i.findIndex(K=>u.areSame(K,p,n))),c;r.defaultItem&&(c={item:r.defaultItem,itemIndex:-1},a+=1,d+=1),d+=v?1:0,m=u.shuffleData(m,d,c);let h,w,S,l=0;const{textField:P}=r;for(;l<a;l++)if(h=u.getItemValue(m[l].item,P),w=v&&u.matchText(h,D,ge),S=u.matchText(h,f,ge),w||S){l=m[l].itemIndex;break}if(l!==a){const K=t.current.initState();K.syntheticEvent=e,Q(l,K),b(K),O.current=void 0}},xt=e=>{clearTimeout(He.current),r.filterable||(He.current=window.setTimeout(()=>W.current.word="",st),St(e))},Ct=e=>{oe.current||t.current.handleFocus(e)},Lt=e=>{if(oe.current||!g.focused)return;const n=r.opened!==void 0?r.opened:g.opened,i=t.current.initState();i.syntheticEvent=e,i.data.focused=!1,i.events.push({type:"onBlur"}),n&&Ie(),n&&!Ke&&t.current.togglePopup(i),b(i)},kt=e=>{if(r.filterable||e.which===0||e.keyCode===o.Keys.enter)return;let n=String.fromCharCode(e.charCode||e.keyCode);ge&&(n=n.toLowerCase()),n===" "&&e.preventDefault(),W.current={word:W.current.word+n,last:W.current.last+n},xt(e)},Et=()=>{const e=t.current.initState();e.data.opened=g.opened,t.current.togglePopup(e),b(e)},Be=s.useRef(null),_=s.useRef(null),re=s.useRef(),X=s.useRef(null);s.useImperativeHandle(Be,()=>({get element(){return _.current},get index(){return ct()},get name(){return r.name},get validity(){return ye()},get value(){return N()},get focused(){return g.focused},get opened(){return g.opened},focus:lt,props:r,togglePopup:Et})),s.useImperativeHandle($,()=>Be.current);const He=s.useRef(null),W=s.useRef({word:"",last:""}),oe=s.useRef(!1),O=s.useRef(null),q=s.useRef(!1),xe=s.useRef(!1),A=s.useRef({}),Ce=s.useRef({}),t=s.useRef(new ot({props:I,setState:()=>{},state:{},forceUpdate:()=>{},element:null,value:null,handleItemSelect:()=>{}})),_e=s.useRef(0),Z=s.useRef(null),[g,Nt]=s.useState({}),[U,Kt]=s.useState(),[,We]=s.useReducer(e=>e,!0),bt=Yt.useLocalization(),R=e=>{Nt({...g,...e})};s.useEffect(()=>{t.current.updateComponentArgs({props:I,setState:R,state:g,forceUpdate:We,element:_.current,handleItemSelect:Q,value:N()})},[R,g,We,Q,N]),s.useEffect(()=>{var d,c,h,w,S,l,P,K,j,te,ce,de,C;const{dataItemKey:e,virtual:n,groupField:i="",textField:p}=r,m=u.getFilteredData(I),f=A.current.virtual?A.current.virtual.total:0,D=r.opened!==void 0?r.opened:g.opened,v=A.current.opened!==void 0?A.current.opened:Ce.current.opened,a=!v&&D;if((d=t==null?void 0:t.current)==null||d.didUpdate(),(c=t==null?void 0:t.current)!=null&&c.getPopupSettings().animate||a&&we(),n&&n.total!==f)(h=t==null?void 0:t.current)==null||h.vs.calcScrollElementHeight(),(w=t==null?void 0:t.current)==null||w.vs.reset();else{const M=N(),ue=A.current.value!==void 0?A.current.value:Ce.current.value;let V=m.findIndex(Y=>u.areSame(Y,M,e));i!==""&&M&&p&&(V=(l=(S=t==null?void 0:t.current)==null?void 0:S.getGroupedDataModernMode(m,i))==null?void 0:l.map(Y=>Y[p]).indexOf(M[p]));const pe=!u.areSame(ue,M,e);a&&n?(P=t==null?void 0:t.current)==null||P.scrollToVirtualItem(n,V):a&&!n?(we(),m&&m.length!==0&&((K=t==null?void 0:t.current)==null||K.resetGroupStickyHeader(m[0][i],{setState:R,group:g.group,state:g})),(j=t==null?void 0:t.current)==null||j.scrollToItem(V)):D&&v&&M&&pe&&!q.current?(ce=t==null?void 0:t.current)==null||ce.scrollToItem(V,(te=t==null?void 0:t.current)==null?void 0:te.vs.enabled):D&&v&&q.current&&(q.current&&n&&n.skip===0?(de=t==null?void 0:t.current)==null||de.vs.reset():q.current&&n&&n.skip===n.total-n.pageSize&&((C=t==null?void 0:t.current)==null||C.vs.scrollToEnd()))}q.current=!1,Ce.current=g,A.current=r,Te()}),s.useEffect(()=>{var e,n;return Z.current=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(ut.bind(void 0)),(e=t==null?void 0:t.current)==null||e.didMount(),Te(),(n=ve())!=null&&n.body&&Z.current&&Z.current.observe(ve().body),()=>{var i;(i=ve())!=null&&i.body&&Z.current&&Z.current.disconnect()}},[]);const Ue=B+"-accessibility-id",Le=B+"-listbox-id",Ge=B+"-guid",Pt=bt.toLanguageString(Pe.dropDownListArrowBtnAriaLabel,Pe.messages[Pe.dropDownListArrowBtnAriaLabel]),{style:ae,className:Ft,label:ke,dir:Mt,virtual:z,adaptive:Xt,dataItemKey:Tt,disabled:se,loading:je,iconClassName:Ye,svgIcon:$e,valueRender:Je}=r,Ee=r.opened!==void 0?r.opened:g.opened,ie=N(),Ne=u.getItemValue(ie,r.textField),Qe=!dt()||ye().valid,le=t.current,Ot=le.vs,ee=E&&E.uDropDownList;Ot.enabled=z!==void 0;const G=o.useAdaptiveModeContext(),Ke=!!(U&&G&&U<=G.medium&&I.adaptive);z!==void 0&&(le.vs.skip=z.skip,le.vs.total=z.total,le.vs.pageSize=z.pageSize);const qt=u.getFilteredData(I),{focused:At}=g,zt=qt.findIndex(e=>u.areSame(e,ie,Tt)),Xe=s.createElement("span",{id:Ue,className:o.classNames(o.uDropDownList.inputInner({c:ee}))},Ne&&s.createElement("span",{className:o.classNames(o.uDropDownList.inputText({c:ee}))},Ne)),Vt=Je!==void 0?Je.call(void 0,Xe,ie):Xe,Ze=s.createElement(s.Fragment,null,s.createElement("span",{ref:pt,className:o.classNames(o.uDropDownList.wrapper({c:ee,size:J,rounded:Me,fillMode:fe,focused:At,disabled:se,invalid:!Qe,loading:je,required:De()}),Ft),style:ke?{...ae,width:void 0}:ae,dir:Mt,onMouseDown:Ee?e=>{e.target.nodeName!=="INPUT"&&(ne(t.current.wrapper),e.preventDefault())}:void 0,onFocus:Ct,onBlur:Lt,tabIndex:o.getTabIndex(it,se),accessKey:r.accessKey,onKeyDown:qe,onKeyPress:kt,onClick:se?void 0:Se,role:"combobox","aria-required":De(),"aria-disabled":se||void 0,"aria-haspopup":"listbox","aria-expanded":Ee||!1,"aria-owns":Le,"aria-activedescendant":Ee?"option-"+Ge+"-"+(zt+(z?z.skip:0)):void 0,"aria-label":r.ariaLabel||r.label,"aria-labelledby":r.ariaLabelledBy,"aria-describedby":r.ariaDescribedBy||Ue,"aria-controls":Le,id:r.id,title:r.title},Vt,je&&s.createElement(o.IconWrap,{className:o.classNames(o.uDropDownList.loadingIcon({c:ee})),name:"loading"}),s.createElement(rt.Button,{tabIndex:-1,type:"button","aria-label":Pt,size:J,fillMode:fe,iconClass:Ye,className:o.classNames(o.uDropDownList.inputButton({c:ee})),rounded:null,themeColor:"base",icon:Ye?void 0:"caret-alt-down",svgIcon:$e||tt.caretAltDownIcon,onMouseDown:e=>g.focused&&e.preventDefault()}),mt(ie),!Ke&&It()),Ke&&yt());return ke?s.createElement(Ht.FloatingLabel,{label:ke,editorValue:Ne,editorValid:Qe,editorDisabled:r.disabled,style:{width:ae?ae.width:void 0},children:Ze}):Ze});me.propTypes={delay:k.number,ignoreCase:k.bool,iconClassName:k.string,svgIcon:o.svgIconPropType,defaultItem:k.any,valueRender:k.func,valueMap:k.func,validationMessage:k.string,required:k.bool,id:k.string,ariaLabelledBy:k.string,ariaDescribedBy:k.string,ariaLabel:k.string,leftRightKeysNavigation:k.bool,title:k.string,groupField:k.string,list:k.any,skipDisabledItems:k.bool};const F={delay:500,tabIndex:0,ignoreCase:!0,...ot.defaultProps,required:!1,size:"medium",rounded:"medium",fillMode:"solid",groupMode:"modern"};me.displayName="KendoReactDropDownList";const at=o.createPropsContext();me.displayName="KendoReactDropDownList";exports.DropDownList=me;exports.DropDownListPropsContext=at;exports.dropDownListDefaultProps=F;
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Bt=require("react"),k=require("prop-types"),o=require("@progress/kendo-react-common"),Ht=require("@progress/kendo-react-labels"),tt=require("@progress/kendo-svg-icons"),_t=require("../common/ListContainer.js"),Wt=require("../common/ListFilter.js"),nt=require("../common/GroupStickyHeader.js"),Ut=require("../common/ListDefaultItem.js"),Gt=require("../common/List.js"),ot=require("../common/DropDownBase.js"),u=require("../common/utils.js"),jt=require("../package-metadata.js"),rt=require("@progress/kendo-react-buttons"),Yt=require("@progress/kendo-react-intl"),Pe=require("../messages/index.js"),Fe=require("@progress/kendo-react-layout");function $t(I){const Y=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(I){for(const E in I)if(E!=="default"){const B=Object.getOwnPropertyDescriptor(I,E);Object.defineProperty(Y,E,B.get?B:{enumerable:!0,get:()=>I[E]})}}return Y.default=I,Object.freeze(Y)}const s=$t(Bt),Jt="Please select a value from the list!",pe=s.forwardRef((I,Y)=>{o.validatePackage(jt.packageMetadata);const E=o.useUnstyled(),B=o.useId(I.id),r=o.usePropsContext(at,I),{delay:st=F.delay,tabIndex:it=F.tabIndex,ignoreCase:me=F.ignoreCase,size:$=F.size,rounded:Me=F.rounded,fillMode:ge=F.fillMode,groupMode:Qt=F.groupMode}=r,fe=()=>{var e;if(o.canUseDOM)return((e=Q.current)==null?void 0:e.ownerDocument)||window.document},lt=()=>{var e,n;(e=t==null?void 0:t.current)!=null&&e.wrapper&&((n=t==null?void 0:t.current)==null||n.wrapper.focus({preventScroll:!0}))},N=()=>{let e;return O.current!==void 0&&O.current!==null?e=O.current:r.value!==void 0?e=r.value:g.value!==void 0&&g.value!==null?e=g.value:r.defaultValue!==void 0&&r.defaultValue!==null&&(e=r.defaultValue),!u.isPresent(e)&&r.defaultItem!==void 0&&r.defaultItem!==null&&(e=r.defaultItem),e},ct=()=>{const{dataItemKey:e}=r,n=u.getFilteredData(I),i=N();return n.findIndex(p=>u.areSame(p,i,e))},ve=()=>r.required!==void 0?r.required:F.required,De=()=>{const e=r.validationMessage!==void 0,n=N(),i=!ve()||n!==null&&n!==""&&n!==void 0,p=r.valid!==void 0?r.valid:i;return{customError:e,valid:p,valueMissing:n===null}},dt=()=>r.validityStyles!==void 0?r.validityStyles:F.validityStyles,ne=e=>{re.current=!0,e.focus(),window.setTimeout(()=>re.current=!1,30)},ye=()=>{X.current&&ne(X.current),r.adaptive&&setTimeout(()=>{X.current&&ne(X.current)},300)},ut=s.useCallback(e=>{for(const n of e)Kt(n.target.clientWidth)},[]),Te=()=>{var e;(e=Se.current)!=null&&e.setCustomValidity&&Se.current.setCustomValidity(De().valid?"":r.validationMessage||Jt)},H=(e,n)=>{const i=N();u.areSame(i,e,r.dataItemKey)||(r.value===void 0&&(n.data.value=e),t.current.updateComponentArgs({value:e}),O.current=e,n.events.push({type:"onChange"}))},b=e=>{var n;(n=t==null?void 0:t.current)==null||n.applyState(e),O.current=void 0},J=(e,n)=>{var c;const{virtual:i,dataItemKey:p,defaultItem:m}=r,f=u.getFilteredData(I),D=i?i.skip:0,v=N(),a=e===-1&&m!==void 0?m:f[e-D],d=!u.areSame(a,v,p);H(a,n),d&&((c=t==null?void 0:t.current)==null||c.triggerPageChangeCornerItems(a,n))},T=(e,n,i)=>{var h,w;const{defaultItem:p,dataItemKey:m,virtual:f={skip:0,total:0,pageSize:0}}=r,D=N(),v=u.getFilteredData(I),a=(h=t==null?void 0:t.current)==null?void 0:h.vs,d=v.findIndex(S=>u.areSame(S,D,m)),c=(w=t==null?void 0:t.current)==null?void 0:w.navigation.navigate({current:f.skip+d,max:(a!=null&&a.enabled?f.total:v.length)-1,min:p!==void 0?-1:0,keyCode:n,skipItems:i||void 0});c!==void 0&&J(c,e),b(e)},pt=e=>{Q.current=e,t.current.wrapper=e},mt=e=>s.createElement("select",{name:r.name,ref:n=>{Se.current=n},tabIndex:-1,"aria-hidden":!0,title:r.label,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},s.createElement("option",{value:r.valueMap?r.valueMap.call(void 0,e):e})),we=()=>{const{textField:e,dataItemKey:n,virtual:i={skip:0},focusedItemIndex:p=u.itemIndexStartsWith,filterable:m,skipDisabledItems:f=!0}=r,D=N(),v=u.getFilteredData(I),a=r.filter?r.filter:g.text;return f&&e&&!a&&!D?v.findIndex(d=>!d.disabled&&d[e]):u.isPresent(D)&&a===void 0||m&&a===""?v.findIndex(d=>u.areSame(d,D,n)):a?xe.current?p(v,a,e):v.findIndex(d=>u.areSame(d,D,n)):i.skip===0?0:-1},Oe=(e,n)=>n!==void 0&&n!==-1&&e&&e.length>0&&e[n].disabled,he=()=>{const e=u.getFilteredData(I),n=t.current.initState(),i=we();Oe(e,i)&&(H(null,n),b(n))},Ie=e=>{if(e.isPropagationStopped())return;const n=t.current.initState();n.syntheticEvent=e,g.focused||(n.data.focused=!0),he(),t.current.togglePopup(n),b(n)},qe=e=>{var M,de,V,ue,j,Re,et;e&&e.target instanceof Element&&e.target.nodeName==="INPUT"&&e.stopPropagation&&e.stopPropagation();const{filterable:n,disabled:i,defaultItem:p,leftRightKeysNavigation:m=!0,virtual:f={skip:0,total:0,pageSize:0},dataItemKey:D,groupField:v="",textField:a,skipDisabledItems:d=!0}=r,c=u.getFilteredData(I),h=N(),w=c.findIndex(L=>u.areSame(L,h,D)),S=r.opened!==void 0?r.opened:g.opened,l=e.keyCode,P=l===o.Keys.home||l===o.Keys.end,K=l===o.Keys.up||l===o.Keys.down,G=!S&&(e.altKey&&l===o.Keys.down||l===o.Keys.enter||l===o.Keys.space),te=S&&(e.altKey&&l===o.Keys.up||l===o.Keys.esc),le=m&&(l===o.Keys.left||l===o.Keys.right),ce=K||le&&!n||P,C=t.current.initState();if(C.syntheticEvent=e,!i){if(P&&((M=t==null?void 0:t.current)!=null&&M.vs.enabled))l===o.Keys.home?f.skip!==0?((de=t==null?void 0:t.current)==null||de.triggerOnPageChange(C,0,f.pageSize),q.current=!0):H(c[0],C):f.skip<f.total-f.pageSize?((V=t==null?void 0:t.current)==null||V.triggerOnPageChange(C,f.total-f.pageSize,f.pageSize),q.current=!0):H(c[c.length-1],C);else if(S&&l===o.Keys.pageUp)e.preventDefault(),(ue=t==null?void 0:t.current)==null||ue.scrollPopupByPageSize(-1);else if(S&&l===o.Keys.pageDown)e.preventDefault(),(j=t==null?void 0:t.current)==null||j.scrollPopupByPageSize(1);else if(S&&l===o.Keys.enter){const L=we();Oe(c,L)?(H(null,C),b(C)):J(L,C),(Re=t==null?void 0:t.current)==null||Re.togglePopup(C),e.preventDefault()}else if(G||te)te&&he(),(et=t==null?void 0:t.current)==null||et.togglePopup(C),e.preventDefault();else if(ce){if(xe.current=!1,v!==""&&a)if(!d&&S)T(C,l);else{let L;if(l===o.Keys.down||l===o.Keys.right){const x=c.slice(w+1).find(y=>!y.disabled&&y[a]);L=x&&c.findIndex(y=>y[a]===x[a])}else if(l===o.Keys.up||l===o.Keys.left){let x;if(w===0&&p)L=-1;else if(w===-1)x=c,L=c.findIndex(y=>!y.disabled&&y[a]);else{x=c.slice(0,w);let y=x.pop();for(;y&&y.disabled;)y=x.pop();L=y&&c.findIndex(be=>be[a]===y[a])}}if(L!==void 0){const x=L-w;T(C,l,x)}else L===void 0&&c.findIndex(x=>x[a]===h[a])===c.length-1&&T(C,l)}else if(!d&&S||P)T(C,l);else if(a){let L;if(l===o.Keys.down||l===o.Keys.right){const x=c.slice(w+1).find(y=>!y.disabled&&y[a]);L=x&&c.findIndex(y=>y[a]===x[a])}else if(l===o.Keys.up||l===o.Keys.left){let x;if(w===0&&p)L=-1;else if(w===-1)x=c,L=c.find(y=>!y.disabled&&y[a]);else{x=c.slice(0,w);let y=x.pop();for(;y&&y.disabled;)y=x.pop();L=y&&c.findIndex(be=>be[a]===y[a])}}if(L!==void 0){const x=L-w;T(C,l,x)}else L===void 0&&c.findIndex(x=>x[a]===h[a])===c.length-1&&T(C,l)}else T(C,l);e.preventDefault()}b(C)}},gt=e=>{const n=t.current.initState();n.syntheticEvent=e.syntheticEvent,r.filter===void 0&&(n.data.text=e.target.value),t.current.filterChanged(e.target.value,n),xe.current=!0,b(n),R({group:void 0,text:String(e.target.value)})},Ae=()=>{const e=r.filter!==void 0?r.filter:g.text;return r.filterable&&s.createElement(Wt,{value:e,ref:n=>X.current=n&&n.element,onChange:gt,onKeyDown:qe,size:$,rounded:Me,fillMode:ge,renderListFilterWrapper:!0})},ft=e=>{var i;const n=t.current.initState();n.syntheticEvent=e,(i=t==null?void 0:t.current)==null||i.togglePopup(n),H(r.defaultItem,n),b(n)},ze=()=>{const{textField:e,defaultItem:n,dataItemKey:i}=r,p=N();return n!==void 0&&s.createElement(Ut,{defaultItem:n,textField:e,selected:u.areSame(p,n,i),key:"defaultitemkey",onClick:ft})},vt=(e,n)=>{var i;(i=t==null?void 0:t.current)==null||i.handleItemClick(e,n),O.current=void 0},Dt=e=>{const{vs:n,list:i}=t.current;n.scrollHandler(e);const{groupField:p}=r;let m=u.getFilteredData(I);if(!(!p||!m.length)&&p){const f=_e.current=_e.current||(n.enabled?n.itemHeight:i?i.children[0].offsetHeight:0),v=e.target.scrollTop-n.skip*f;m=t.current.getGroupedDataModernMode(m,p);let a=m[0][p];for(let d=1;d<m.length&&!(f*d>v);d++)m[d]&&m[d][p]&&(a=m[d][p]);a!==g.group&&R({group:a})}},Ve=()=>{var l;const{textField:e,dataItemKey:n,virtual:i={skip:0,total:void 0},groupHeaderItemRender:p,listNoDataRender:m,itemRender:f}=r,D=u.getFilteredData(I),v=E&&E.uDropDownList,a=t.current.vs,d=i.skip,c=r.opened!==void 0?r.opened:g.opened,h=t.current.getPopupSettings(),w=`translateY(${a.translate}px)`,S=N();return s.createElement(Gt,{id:Le,show:c,data:D.slice(),focusedIndex:we(),value:S,textField:e,valueField:n,optionsGuid:Ge,groupField:r.groupField,groupMode:"modern",listRef:P=>a.list=t.current.list=P,wrapperStyle:{maxHeight:h.height},wrapperCssClass:o.classNames(o.uDropDownList.listContent({c:v})),listStyle:a.enabled?{transform:w}:void 0,key:"listkey",skip:d,onClick:vt,itemRender:f,groupHeaderItemRender:p,noDataRender:m,onScroll:Dt,wrapperRef:a.scrollerRef,scroller:(l=t==null?void 0:t.current)==null?void 0:l.renderScrollElement(),ariaSetSize:i.total})},yt=()=>{var w;const{header:e,footer:n,adaptiveTitle:i,groupField:p,groupStickyHeaderItemRender:m,list:f}=r,D=u.getFilteredData(I),v=r.opened!==void 0?r.opened:g.opened,a=E&&E.uDropDownList,d=E&&E.uDropDownsActionSheet,c={navigatable:!1,navigatableElements:[],expand:v,animation:!0,onClose:S=>Ie(S),className:o.classNames(o.uDropDownsActionSheet.wrapper({c:d}),"k-adaptive-actionsheet"),animationStyles:W&&U&&W<=U.small?{top:0,width:"100%",height:"100%"}:void 0,position:W&&U&&W<=U.small?"fullscreen":void 0};let{group:h}=g;return h===void 0&&p!==void 0&&(h=u.getItemValue(D[0],p)),s.createElement(Fe.ActionSheet,{...c},s.createElement(Fe.ActionSheetHeader,{className:o.classNames(o.uDropDownsActionSheet.header({c:d}))},s.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.titleBar({c:d}))},s.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.title({c:d}))},s.createElement("div",null,i)),s.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.actions({c:d}))},s.createElement(rt.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:Ie,icon:"x",svgIcon:tt.xIcon}))),s.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.titleBarGroup({c:d}))},Ae())),s.createElement(Fe.ActionSheetContent,{overflowHidden:!0},e&&s.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:a}))},e),s.createElement("div",{className:o.classNames(o.uDropDownList.list({c:a,size:$,virtual:(w=t==null?void 0:t.current)==null?void 0:w.vs.enabled}))},ze(),!f&&h&&D.length!==0&&s.createElement(nt,{group:h,groupMode:"modern",render:m}),Ve()),n&&s.createElement("div",{className:o.classNames(o.uDropDownList.listFooter({c:a}))},n)))},wt=()=>{g.focused&&window.setTimeout(()=>{g.focused&&t.current.wrapper&&ne(t.current.wrapper)})},ht=e=>{var n;(n=r.popupSettings)!=null&&n.onMouseDownOutside&&r.popupSettings.onMouseDownOutside.call(void 0,e)},It=()=>{const{header:e,footer:n,dir:i,groupField:p,groupStickyHeaderItemRender:m,list:f}=r,D=u.getFilteredData(I),v=t.current,a=v.getPopupSettings(),d=r.opened!==void 0?r.opened:g.opened,c=a.width!==void 0?a.width:v.popupWidth,h=E&&E.uDropDownList,w={dir:i!==void 0?i:v.dirCalculated,width:c,popupSettings:{...a,popupClass:o.classNames(a.popupClass,o.uDropDownList.listContainer({c:h})),anchor:a.anchor||Q.current,show:d,onOpen:ye,onClose:wt,onMouseDownOutside:ht},itemsCount:[D.length]};let{group:S}=g;return S===void 0&&p!==void 0&&(S=u.getItemValue(D[0],p)),s.createElement(_t,{...w},Ae(),e&&s.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:h}))},e),s.createElement("div",{className:o.classNames(o.uDropDownList.list({c:h,size:$,virtual:t.current.vs.enabled}))},ze(),!f&&S&&D.length!==0&&s.createElement(nt,{group:S,groupMode:"modern",render:m}),Ve()),n&&s.createElement("div",{className:o.classNames(o.uDropDownList.listFooter({c:h}))},n))},St=e=>{const{dataItemKey:n}=r,i=u.getFilteredData(I),p=N();let m=i.map((K,G)=>({item:K,itemIndex:G}));const f=_.current.word,D=_.current.last,v=u.sameCharsOnly(f,D);let a=m.length,d=Math.max(0,i.findIndex(K=>u.areSame(K,p,n))),c;r.defaultItem&&(c={item:r.defaultItem,itemIndex:-1},a+=1,d+=1),d+=v?1:0,m=u.shuffleData(m,d,c);let h,w,S,l=0;const{textField:P}=r;for(;l<a;){if(h=u.getItemValue(m[l].item,P),w=v&&u.matchText(h,D,me),S=u.matchText(h,f,me),w||S){l=m[l].itemIndex;break}l++}if(l!==a){const K=t.current.initState();K.syntheticEvent=e,J(l,K),b(K),O.current=void 0}},xt=e=>{clearTimeout(He.current),r.filterable||(He.current=window.setTimeout(()=>_.current.word="",st),St(e))},Ct=e=>{re.current||t.current.handleFocus(e)},Lt=e=>{if(re.current||!g.focused)return;const n=r.opened!==void 0?r.opened:g.opened,i=t.current.initState();i.syntheticEvent=e,i.data.focused=!1,i.events.push({type:"onBlur"}),n&&he(),n&&!Ke&&t.current.togglePopup(i),b(i)},kt=e=>{if(r.filterable||e.which===0||e.keyCode===o.Keys.enter)return;let n=String.fromCharCode(e.charCode||e.keyCode);me&&(n=n.toLowerCase()),n===" "&&e.preventDefault(),_.current={word:_.current.word+n,last:_.current.last+n},xt(e)},Et=()=>{const e=t.current.initState();e.data.opened=g.opened,t.current.togglePopup(e),b(e)},Be=s.useRef(null),Q=s.useRef(null),Se=s.useRef(),X=s.useRef(null);s.useImperativeHandle(Be,()=>({get element(){return Q.current},get index(){return ct()},get name(){return r.name},get validity(){return De()},get value(){return N()},get focused(){return g.focused},get opened(){return g.opened},focus:lt,props:r,togglePopup:Et})),s.useImperativeHandle(Y,()=>Be.current);const He=s.useRef(null),_=s.useRef({word:"",last:""}),re=s.useRef(!1),O=s.useRef(null),q=s.useRef(!1),xe=s.useRef(!1),A=s.useRef({}),Ce=s.useRef({}),t=s.useRef(new ot({props:I,setState:()=>{},state:{},forceUpdate:()=>{},element:null,value:null,handleItemSelect:()=>{}})),_e=s.useRef(0),Z=s.useRef(null),[g,Nt]=s.useState({}),[W,Kt]=s.useState(),[,We]=s.useReducer(e=>e,!0),bt=Yt.useLocalization(),R=e=>{Nt({...g,...e})};s.useEffect(()=>{t.current.updateComponentArgs({props:I,setState:R,state:g,forceUpdate:We,element:Q.current,handleItemSelect:J,value:N()})},[R,g,We,J,N]),s.useEffect(()=>{var d,c,h,w,S,l,P,K,G,te,le,ce,C;const{dataItemKey:e,virtual:n,groupField:i="",textField:p}=r,m=u.getFilteredData(I),f=A.current.virtual?A.current.virtual.total:0,D=r.opened!==void 0?r.opened:g.opened,v=A.current.opened!==void 0?A.current.opened:Ce.current.opened,a=!v&&D;if((d=t==null?void 0:t.current)==null||d.didUpdate(),(c=t==null?void 0:t.current)!=null&&c.getPopupSettings().animate||a&&ye(),n&&n.total!==f)(h=t==null?void 0:t.current)==null||h.vs.calcScrollElementHeight(),(w=t==null?void 0:t.current)==null||w.vs.reset();else{const M=N(),de=A.current.value!==void 0?A.current.value:Ce.current.value;let V=m.findIndex(j=>u.areSame(j,M,e));i!==""&&M&&p&&(V=(l=(S=t==null?void 0:t.current)==null?void 0:S.getGroupedDataModernMode(m,i))==null?void 0:l.map(j=>j[p]).indexOf(M[p]));const ue=!u.areSame(de,M,e);a&&n?(P=t==null?void 0:t.current)==null||P.scrollToVirtualItem(n,V):a&&!n?(ye(),m&&m.length!==0&&((K=t==null?void 0:t.current)==null||K.resetGroupStickyHeader(m[0][i],{setState:R,group:g.group,state:g})),(G=t==null?void 0:t.current)==null||G.scrollToItem(V)):D&&v&&M&&ue&&!q.current?(le=t==null?void 0:t.current)==null||le.scrollToItem(V,(te=t==null?void 0:t.current)==null?void 0:te.vs.enabled):D&&v&&q.current&&(q.current&&n&&n.skip===0?(ce=t==null?void 0:t.current)==null||ce.vs.reset():q.current&&n&&n.skip===n.total-n.pageSize&&((C=t==null?void 0:t.current)==null||C.vs.scrollToEnd()))}q.current=!1,Ce.current=g,A.current=r,Te()}),s.useEffect(()=>{var e,n;return Z.current=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(ut.bind(void 0)),(e=t==null?void 0:t.current)==null||e.didMount(),Te(),(n=fe())!=null&&n.body&&Z.current&&Z.current.observe(fe().body),()=>{var i;(i=fe())!=null&&i.body&&Z.current&&Z.current.disconnect()}},[]);const Ue=B+"-accessibility-id",Le=B+"-listbox-id",Ge=B+"-guid",Pt=bt.toLanguageString(Pe.dropDownListArrowBtnAriaLabel,Pe.messages[Pe.dropDownListArrowBtnAriaLabel]),{style:oe,className:Ft,label:ke,dir:Mt,virtual:z,adaptive:Xt,dataItemKey:Tt,disabled:ae,loading:je,iconClassName:Ye,svgIcon:$e,valueRender:Je}=r,Ee=r.opened!==void 0?r.opened:g.opened,se=N(),Ne=u.getItemValue(se,r.textField),Qe=!dt()||De().valid,ie=t.current,Ot=ie.vs,ee=E&&E.uDropDownList;Ot.enabled=z!==void 0;const U=o.useAdaptiveModeContext(),Ke=!!(W&&U&&W<=U.medium&&I.adaptive);z!==void 0&&(ie.vs.skip=z.skip,ie.vs.total=z.total,ie.vs.pageSize=z.pageSize);const qt=u.getFilteredData(I),{focused:At}=g,zt=qt.findIndex(e=>u.areSame(e,se,Tt)),Xe=s.createElement("span",{id:Ue,className:o.classNames(o.uDropDownList.inputInner({c:ee}))},Ne&&s.createElement("span",{className:o.classNames(o.uDropDownList.inputText({c:ee}))},Ne)),Vt=Je!==void 0?Je.call(void 0,Xe,se):Xe,Ze=s.createElement(s.Fragment,null,s.createElement("span",{ref:pt,className:o.classNames(o.uDropDownList.wrapper({c:ee,size:$,rounded:Me,fillMode:ge,focused:At,disabled:ae,invalid:!Qe,loading:je,required:ve()}),Ft),style:ke?{...oe,width:void 0}:oe,dir:Mt,onMouseDown:Ee?e=>{e.target.nodeName!=="INPUT"&&(ne(t.current.wrapper),e.preventDefault())}:void 0,onFocus:Ct,onBlur:Lt,tabIndex:o.getTabIndex(it,ae),accessKey:r.accessKey,onKeyDown:qe,onKeyPress:kt,onClick:ae?void 0:Ie,role:"combobox","aria-required":ve(),"aria-disabled":ae||void 0,"aria-haspopup":"listbox","aria-expanded":Ee||!1,"aria-owns":Le,"aria-activedescendant":Ee?"option-"+Ge+"-"+(zt+(z?z.skip:0)):void 0,"aria-label":r.ariaLabel||r.label,"aria-labelledby":r.ariaLabelledBy,"aria-describedby":r.ariaDescribedBy||Ue,"aria-controls":Le,id:r.id,title:r.title},Vt,je&&s.createElement(o.IconWrap,{className:o.classNames(o.uDropDownList.loadingIcon({c:ee})),name:"loading"}),s.createElement(rt.Button,{tabIndex:-1,type:"button","aria-label":Pt,size:$,fillMode:ge,iconClass:Ye,className:o.classNames(o.uDropDownList.inputButton({c:ee})),rounded:null,themeColor:"base",icon:Ye?void 0:"caret-alt-down",svgIcon:$e||tt.caretAltDownIcon,onMouseDown:e=>g.focused&&e.preventDefault()}),mt(se),!Ke&&It()),Ke&&yt());return ke?s.createElement(Ht.FloatingLabel,{label:ke,editorValue:Ne,editorValid:Qe,editorDisabled:r.disabled,style:{width:oe?oe.width:void 0},children:Ze}):Ze});pe.propTypes={delay:k.number,ignoreCase:k.bool,iconClassName:k.string,svgIcon:o.svgIconPropType,defaultItem:k.any,valueRender:k.func,valueMap:k.func,validationMessage:k.string,required:k.bool,id:k.string,ariaLabelledBy:k.string,ariaDescribedBy:k.string,ariaLabel:k.string,leftRightKeysNavigation:k.bool,title:k.string,groupField:k.string,list:k.any,skipDisabledItems:k.bool};const F={delay:500,tabIndex:0,ignoreCase:!0,...ot.defaultProps,required:!1,size:"medium",rounded:"medium",fillMode:"solid",groupMode:"modern"};pe.displayName="KendoReactDropDownList";const at=o.createPropsContext();pe.displayName="KendoReactDropDownList";exports.DropDownList=pe;exports.DropDownListPropsContext=at;exports.dropDownListDefaultProps=F;
|