@progress/kendo-react-dropdowns 10.3.0-develop.1 → 11.0.0-develop.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ht=require("react"),L=require("prop-types"),o=require("@progress/kendo-react-common"),Wt=require("@progress/kendo-react-labels"),tt=require("@progress/kendo-svg-icons"),_t=require("../common/ListContainer.js"),Ut=require("../common/ListFilter.js"),nt=require("../common/GroupStickyHeader.js"),Gt=require("../common/ListDefaultItem.js"),jt=require("../common/List.js"),ot=require("../common/DropDownBase.js"),u=require("../common/utils.js"),Yt=require("../package-metadata.js"),rt=require("@progress/kendo-react-buttons"),$t=require("@progress/kendo-react-intl"),Fe=require("../messages/index.js"),Me=require("@progress/kendo-react-layout");function Jt(M){const Y=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(M){for(const T in M)if(T!=="default"){const n=Object.getOwnPropertyDescriptor(M,T);Object.defineProperty(Y,T,n.get?n:{enumerable:!0,get:()=>M[T]})}}return Y.default=M,Object.freeze(Y)}const a=Jt(Ht),Qt="Please select a value from the list!",pe=a.forwardRef((M,Y)=>{let T=!1;const n=o.usePropsContext(st,M),{delay:at=P.delay,tabIndex:it=P.tabIndex,ignoreCase:me=P.ignoreCase,size:$=P.size,rounded:Te=P.rounded,fillMode:ge=P.fillMode,groupMode:Xt=P.groupMode}=n;if(n.filterable||n.virtual){const e=[];n.filterable&&e.push("filterable"),n.virtual&&e.push("virtualization"),T=!o.validatePackage(Yt.packageMetadata,{component:"DropDownList",features:e})}const N=o.useUnstyled(),fe=o.useId(n.id),ve=()=>{var e;if(o.canUseDOM)return((e=Q.current)==null?void 0:e.ownerDocument)||window.document},lt=()=>{var e,r;(e=t==null?void 0:t.current)!=null&&e.wrapper&&((r=t==null?void 0:t.current)==null||r.wrapper.focus({preventScroll:!0}))},k=()=>{let e;return q.current!==void 0&&q.current!==null?e=q.current:n.value!==void 0?e=n.value:g.value!==void 0&&g.value!==null?e=g.value:n.defaultValue!==void 0&&n.defaultValue!==null&&(e=n.defaultValue),!u.isPresent(e)&&n.defaultItem!==void 0&&n.defaultItem!==null&&(e=n.defaultItem),e},ct=()=>{const{dataItemKey:e}=n,r=u.getFilteredData(n),i=k();return r.findIndex(p=>u.areSame(p,i,e))},De=()=>n.required!==void 0?n.required:P.required,ye=()=>{const e=n.validationMessage!==void 0,r=k(),i=!De()||r!==null&&r!==""&&r!==void 0,p=n.valid!==void 0?n.valid:i;return{customError:e,valid:p,valueMissing:r===null}},dt=()=>n.validityStyles!==void 0?n.validityStyles:P.validityStyles,ne=e=>{re.current=!0,e.focus(),window.setTimeout(()=>re.current=!1,30)},he=()=>{X.current&&ne(X.current),n.adaptive&&setTimeout(()=>{X.current&&ne(X.current)},300)},ut=a.useCallback(e=>{for(const r of e)bt(r.target.clientWidth)},[]),Oe=()=>{var e;(e=xe.current)!=null&&e.setCustomValidity&&xe.current.setCustomValidity(ye().valid?"":n.validationMessage||Qt)},H=(e,r)=>{const i=k();u.areSame(i,e,n.dataItemKey)||(n.value===void 0&&(r.data.value=e),t.current.updateComponentArgs({value:e}),q.current=e,r.events.push({type:"onChange"}))},b=e=>{var r;(r=t==null?void 0:t.current)==null||r.applyState(e),q.current=void 0},J=(e,r)=>{var c;const{virtual:i,dataItemKey:p,defaultItem:m}=n,f=u.getFilteredData(n),D=i?i.skip:0,v=k(),s=e===-1&&m!==void 0?m:f[e-D],d=!u.areSame(s,v,p);H(s,r),d&&((c=t==null?void 0:t.current)==null||c.triggerPageChangeCornerItems(s,r))},O=(e,r,i)=>{var w,h;const{defaultItem:p,dataItemKey:m,virtual:f={skip:0,total:0,pageSize:0}}=n,D=k(),v=u.getFilteredData(n),s=(w=t==null?void 0:t.current)==null?void 0:w.vs,d=v.findIndex(I=>u.areSame(I,D,m)),c=(h=t==null?void 0:t.current)==null?void 0:h.navigation.navigate({current:f.skip+d,max:(s!=null&&s.enabled?f.total:v.length)-1,min:p!==void 0?-1:0,keyCode:r,skipItems:i||void 0});c!==void 0&&J(c,e),b(e)},pt=e=>{Q.current=e,t.current.wrapper=e},mt=e=>a.createElement("select",{name:n.name,ref:r=>{xe.current=r},tabIndex:-1,"aria-hidden":!0,title:n.label,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},a.createElement("option",{value:n.valueMap?n.valueMap.call(void 0,e):e})),we=()=>{const{textField:e,dataItemKey:r,virtual:i={skip:0},focusedItemIndex:p=u.itemIndexStartsWith,filterable:m,skipDisabledItems:f=!0}=n,D=k(),v=u.getFilteredData(n),s=n.filter?n.filter:g.text;return f&&e&&!s&&!D?v.findIndex(d=>!d.disabled&&d[e]):u.isPresent(D)&&s===void 0||m&&s===""?v.findIndex(d=>u.areSame(d,D,r)):s?Ce.current?p(v,s,e):v.findIndex(d=>u.areSame(d,D,r)):i.skip===0?0:-1},qe=(e,r)=>r!==void 0&&r!==-1&&e&&e.length>0&&e[r].disabled,Ie=()=>{const e=u.getFilteredData(n),r=t.current.initState(),i=we();qe(e,i)&&(H(null,r),b(r))},Se=e=>{if(e.isPropagationStopped())return;const r=t.current.initState();r.syntheticEvent=e,g.focused||(r.data.focused=!0),Ie(),t.current.togglePopup(r),b(r)},Ae=e=>{var F,de,B,ue,j,Re,et;e&&e.target instanceof Element&&e.target.nodeName==="INPUT"&&e.stopPropagation&&e.stopPropagation();const{filterable:r,disabled:i,defaultItem:p,leftRightKeysNavigation:m=!0,virtual:f={skip:0,total:0,pageSize:0},dataItemKey:D,groupField:v="",textField:s,skipDisabledItems:d=!0}=n,c=u.getFilteredData(n),w=k(),h=c.findIndex(C=>u.areSame(C,w,D)),I=n.opened!==void 0?n.opened:g.opened,l=e.keyCode,K=l===o.Keys.home||l===o.Keys.end,E=l===o.Keys.up||l===o.Keys.down,G=!I&&(e.altKey&&l===o.Keys.down||l===o.Keys.enter||l===o.Keys.space),te=I&&(e.altKey&&l===o.Keys.up||l===o.Keys.esc),le=m&&(l===o.Keys.left||l===o.Keys.right),ce=E||le&&!r||K,x=t.current.initState();if(x.syntheticEvent=e,!i){if(K&&((F=t==null?void 0:t.current)!=null&&F.vs.enabled))l===o.Keys.home?f.skip!==0?((de=t==null?void 0:t.current)==null||de.triggerOnPageChange(x,0,f.pageSize),A.current=!0):H(c[0],x):f.skip<f.total-f.pageSize?((B=t==null?void 0:t.current)==null||B.triggerOnPageChange(x,f.total-f.pageSize,f.pageSize),A.current=!0):H(c[c.length-1],x);else if(I&&l===o.Keys.pageUp)e.preventDefault(),(ue=t==null?void 0:t.current)==null||ue.scrollPopupByPageSize(-1);else if(I&&l===o.Keys.pageDown)e.preventDefault(),(j=t==null?void 0:t.current)==null||j.scrollPopupByPageSize(1);else if(I&&l===o.Keys.enter){const C=we();qe(c,C)?(H(null,x),b(x)):J(C,x),(Re=t==null?void 0:t.current)==null||Re.togglePopup(x),e.preventDefault()}else if(G||te)te&&Ie(),(et=t==null?void 0:t.current)==null||et.togglePopup(x),e.preventDefault();else if(ce){if(Ce.current=!1,v!==""&&s)if(!d&&I)O(x,l);else{let C;if(l===o.Keys.down||l===o.Keys.right){const S=c.slice(h+1).find(y=>!y.disabled&&y[s]);C=S&&c.findIndex(y=>y[s]===S[s])}else if(l===o.Keys.up||l===o.Keys.left){let S;if(h===0&&p)C=-1;else if(h===-1)S=c,C=c.findIndex(y=>!y.disabled&&y[s]);else{S=c.slice(0,h);let y=S.pop();for(;y&&y.disabled;)y=S.pop();C=y&&c.findIndex(Pe=>Pe[s]===y[s])}}if(C!==void 0){const S=C-h;O(x,l,S)}else C===void 0&&c.findIndex(S=>S[s]===w[s])===c.length-1&&O(x,l)}else if(!d&&I||K)O(x,l);else if(s){let C;if(l===o.Keys.down||l===o.Keys.right){const S=c.slice(h+1).find(y=>!y.disabled&&y[s]);C=S&&c.findIndex(y=>y[s]===S[s])}else if(l===o.Keys.up||l===o.Keys.left){let S;if(h===0&&p)C=-1;else if(h===-1)S=c,C=c.find(y=>!y.disabled&&y[s]);else{S=c.slice(0,h);let y=S.pop();for(;y&&y.disabled;)y=S.pop();C=y&&c.findIndex(Pe=>Pe[s]===y[s])}}if(C!==void 0){const S=C-h;O(x,l,S)}else C===void 0&&c.findIndex(S=>S[s]===w[s])===c.length-1&&O(x,l)}else O(x,l);e.preventDefault()}b(x)}},gt=e=>{const r=t.current.initState();r.syntheticEvent=e.syntheticEvent,n.filter===void 0&&(r.data.text=e.target.value),t.current.filterChanged(e.target.value,r),Ce.current=!0,b(r),R({group:void 0,text:String(e.target.value)})},ze=()=>{const e=n.filter!==void 0?n.filter:g.text;return n.filterable&&a.createElement(Ut,{value:e,ref:r=>{X.current=r&&r.element},onChange:gt,onKeyDown:Ae,size:$,rounded:Te,fillMode:ge,renderListFilterWrapper:!0})},ft=e=>{var i;const r=t.current.initState();r.syntheticEvent=e,(i=t==null?void 0:t.current)==null||i.togglePopup(r),H(n.defaultItem,r),b(r)},Ve=()=>{const{textField:e,defaultItem:r,dataItemKey:i}=n,p=k();return r!==void 0&&a.createElement(Gt,{defaultItem:r,textField:e,selected:u.areSame(p,r,i),key:"defaultitemkey",onClick:ft})},vt=(e,r)=>{var i;(i=t==null?void 0:t.current)==null||i.handleItemClick(e,r),q.current=void 0},Dt=e=>{const{vs:r,list:i}=t.current;r.scrollHandler(e);const{groupField:p}=n;let m=u.getFilteredData(n);if(!(!p||!m.length)&&p){const f=_e.current=_e.current||(r.enabled?r.itemHeight:i?i.children[0].offsetHeight:0),v=e.target.scrollTop-r.skip*f;m=t.current.getGroupedDataModernMode(m,p);let s=m[0][p];for(let d=1;d<m.length&&!(f*d>v);d++)m[d]&&m[d][p]&&(s=m[d][p]);s!==g.group&&R({group:s})}},Be=()=>{var l;const{textField:e,dataItemKey:r,virtual:i={skip:0,total:void 0},groupHeaderItemRender:p,listNoDataRender:m,itemRender:f}=n,D=u.getFilteredData(n),v=N&&N.uDropDownList,s=t.current.vs,d=i.skip,c=n.opened!==void 0?n.opened:g.opened,w=t.current.getPopupSettings(),h=`translateY(${s.translate}px)`,I=k();return a.createElement(jt,{id:ke,show:c,data:D.slice(),focusedIndex:we(),value:I,textField:e,valueField:r,optionsGuid:je,groupField:n.groupField,groupMode:"modern",listRef:K=>{s.list=t.current.list=K},wrapperStyle:{maxHeight:w.height},wrapperCssClass:o.classNames(o.uDropDownList.listContent({c:v})),listStyle:s.enabled?{transform:h}:void 0,key:"listkey",skip:d,onClick:vt,itemRender:f,groupHeaderItemRender:p,noDataRender:m,onScroll:Dt,wrapperRef:s.scrollerRef,scroller:(l=t==null?void 0:t.current)==null?void 0:l.renderScrollElement(),ariaSetSize:i.total})},yt=()=>{var h;const{header:e,footer:r,adaptiveTitle:i,groupField:p,groupStickyHeaderItemRender:m,list:f}=n,D=u.getFilteredData(n),v=n.opened!==void 0?n.opened:g.opened,s=N&&N.uDropDownList,d=N&&N.uDropDownsActionSheet,c={navigatable:!1,navigatableElements:[],expand:v,animation:!0,onClose:I=>Se(I),className:o.classNames(o.uDropDownsActionSheet.wrapper({c:d}),"k-adaptive-actionsheet"),animationStyles:_&&U&&_<=U.small?{top:0,width:"100%",height:"100%"}:void 0,position:_&&U&&_<=U.small?"fullscreen":void 0};let{group:w}=g;return w===void 0&&p!==void 0&&(w=u.getItemValue(D[0],p)),a.createElement(Me.ActionSheet,{...c},a.createElement(Me.ActionSheetHeader,{className:o.classNames(o.uDropDownsActionSheet.header({c:d}))},a.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.titleBar({c:d}))},a.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.title({c:d}))},a.createElement("div",null,i)),a.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.actions({c:d}))},a.createElement(rt.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:Se,icon:"x",svgIcon:tt.xIcon}))),a.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.titleBarGroup({c:d}))},ze())),a.createElement(Me.ActionSheetContent,null,e&&a.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:s}))},e),a.createElement("div",{className:o.classNames(o.uDropDownList.list({c:s,size:$,virtual:(h=t==null?void 0:t.current)==null?void 0:h.vs.enabled}))},Ve(),!f&&w&&D.length!==0&&a.createElement(nt,{group:w,groupMode:"modern",render:m}),Be()),r&&a.createElement("div",{className:o.classNames(o.uDropDownList.listFooter({c:s}))},r)))},ht=()=>{g.focused&&window.setTimeout(()=>{g.focused&&t.current.wrapper&&ne(t.current.wrapper)})},wt=e=>{"onMouseDownOutside"in(n.popupSettings||{})&&n.popupSettings.onMouseDownOutside.call(void 0,e)},It=()=>{const{header:e,footer:r,dir:i,groupField:p,groupStickyHeaderItemRender:m,list:f}=n,D=u.getFilteredData(n),v=t.current,s=v.getPopupSettings(),d=n.opened!==void 0?n.opened:g.opened,c=s.width!==void 0?s.width:v.popupWidth,w=N&&N.uDropDownList,h={dir:i!==void 0?i:v.dirCalculated,width:c,popupSettings:{...s,popupClass:o.classNames(s.popupClass,o.uDropDownList.listContainer({c:w})),anchor:s.anchor||Q.current,show:d,onOpen:he,onClose:ht,onMouseDownOutside:wt},itemsCount:[D.length]};let{group:I}=g;return I===void 0&&p!==void 0&&(I=u.getItemValue(D[0],p)),a.createElement(_t,{...h},ze(),e&&a.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:w}))},e),a.createElement("div",{className:o.classNames(o.uDropDownList.list({c:w,size:$,virtual:t.current.vs.enabled}))},Ve(),!f&&I&&D.length!==0&&a.createElement(nt,{group:I,groupMode:"modern",render:m}),Be()),r&&a.createElement("div",{className:o.classNames(o.uDropDownList.listFooter({c:w}))},r),T&&a.createElement(o.WatermarkOverlay,null))},St=e=>{const{dataItemKey:r}=n,i=u.getFilteredData(n),p=k();let m=i.map((E,G)=>({item:E,itemIndex:G}));const f=W.current.word,D=W.current.last,v=u.sameCharsOnly(f,D);let s=m.length,d=Math.max(0,i.findIndex(E=>u.areSame(E,p,r))),c;n.defaultItem&&(c={item:n.defaultItem,itemIndex:-1},s+=1,d+=1),d+=v?1:0,m=u.shuffleData(m,d,c);let w,h,I,l=0;const{textField:K}=n;for(;l<s;){if(w=u.getItemValue(m[l].item,K),h=v&&u.matchText(w,D,me),I=u.matchText(w,f,me),h||I){l=m[l].itemIndex;break}l++}if(l!==s){const E=t.current.initState();E.syntheticEvent=e,J(l,E),b(E),q.current=void 0}},xt=e=>{clearTimeout(We.current),n.filterable||(We.current=window.setTimeout(()=>W.current.word="",at),St(e))},Ct=e=>{re.current||t.current.handleFocus(e)},Lt=e=>{if(re.current||!g.focused)return;const r=n.opened!==void 0?n.opened:g.opened,i=t.current.initState();i.syntheticEvent=e,i.data.focused=!1,i.events.push({type:"onBlur"}),r&&Ie(),r&&!Ke&&t.current.togglePopup(i),b(i)},kt=e=>{if(n.filterable||e.which===0||e.keyCode===o.Keys.enter)return;let r=String.fromCharCode(e.charCode||e.keyCode);me&&(r=r.toLowerCase()),r===" "&&e.preventDefault(),W.current={word:W.current.word+r,last:W.current.last+r},xt(e)},Et=()=>{const e=t.current.initState();e.data.opened=g.opened,t.current.togglePopup(e),b(e)},He=a.useRef(null),Q=a.useRef(null),xe=a.useRef(null),X=a.useRef(null);a.useImperativeHandle(He,()=>({get element(){return Q.current},get index(){return ct()},get name(){return n.name},get validity(){return ye()},get value(){return k()},get focused(){return g.focused},get opened(){return g.opened},focus:lt,props:n,togglePopup:Et})),a.useImperativeHandle(Y,()=>He.current);const We=a.useRef(null),W=a.useRef({word:"",last:""}),re=a.useRef(!1),q=a.useRef(null),A=a.useRef(!1),Ce=a.useRef(!1),z=a.useRef({}),Le=a.useRef({}),t=a.useRef(new ot({props:n,setState:()=>{},state:{},forceUpdate:()=>{},element:null,value:null,handleItemSelect:()=>{}})),_e=a.useRef(0),Z=a.useRef(null),[g,Nt]=a.useState({}),[_,bt]=a.useState(),[,Ue]=a.useReducer(e=>e,!0),Kt=$t.useLocalization(),R=e=>{Nt({...g,...e})};a.useEffect(()=>{t.current.updateComponentArgs({props:n,setState:R,state:g,forceUpdate:Ue,element:Q.current,handleItemSelect:J,value:k()})},[R,g,Ue,J,k]),a.useEffect(()=>{var d,c,w,h,I,l,K,E,G,te,le,ce,x;const{dataItemKey:e,virtual:r,groupField:i="",textField:p}=n,m=u.getFilteredData(n),f=z.current.virtual?z.current.virtual.total:0,D=n.opened!==void 0?n.opened:g.opened,v=z.current.opened!==void 0?z.current.opened:Le.current.opened,s=!v&&D;if((d=t==null?void 0:t.current)==null||d.didUpdate(),(c=t==null?void 0:t.current)!=null&&c.getPopupSettings().animate||s&&he(),r&&r.total!==f)(w=t==null?void 0:t.current)==null||w.vs.calcScrollElementHeight(),(h=t==null?void 0:t.current)==null||h.vs.reset();else{const F=k(),de=z.current.value!==void 0?z.current.value:Le.current.value;let B=m.findIndex(j=>u.areSame(j,F,e));i!==""&&F&&p&&(B=(l=(I=t==null?void 0:t.current)==null?void 0:I.getGroupedDataModernMode(m,i))==null?void 0:l.map(j=>j[p]).indexOf(F[p]));const ue=!u.areSame(de,F,e);s&&r?(K=t==null?void 0:t.current)==null||K.scrollToVirtualItem(r,B):s&&!r?(he(),m&&m.length!==0&&((E=t==null?void 0:t.current)==null||E.resetGroupStickyHeader(m[0][i],{setState:R,group:g.group,state:g})),(G=t==null?void 0:t.current)==null||G.scrollToItem(B)):D&&v&&F&&ue&&!A.current?(le=t==null?void 0:t.current)==null||le.scrollToItem(B,(te=t==null?void 0:t.current)==null?void 0:te.vs.enabled):D&&v&&A.current&&(A.current&&r&&r.skip===0?(ce=t==null?void 0:t.current)==null||ce.vs.reset():A.current&&r&&r.skip===r.total-r.pageSize&&((x=t==null?void 0:t.current)==null||x.vs.scrollToEnd()))}A.current=!1,Le.current=g,z.current=n,Oe()}),a.useEffect(()=>{var e,r;return Z.current=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(ut.bind(void 0)),(e=t==null?void 0:t.current)==null||e.didMount(),Oe(),(r=ve())!=null&&r.body&&Z.current&&Z.current.observe(ve().body),()=>{var i;(i=ve())!=null&&i.body&&Z.current&&Z.current.disconnect()}},[]);const Ge=fe+"-accessibility-id",ke=fe+"-listbox-id",je=fe+"-guid",Pt=Kt.toLanguageString(Fe.dropDownListArrowBtnAriaLabel,Fe.messages[Fe.dropDownListArrowBtnAriaLabel]),{style:oe,className:Ft,label:Ee,dir:Mt,virtual:V,adaptive:Zt,dataItemKey:Tt,disabled:se,loading:Ye,iconClassName:$e,svgIcon:Ot,valueRender:Je}=n,Ne=n.opened!==void 0?n.opened:g.opened,ae=k(),be=u.getItemValue(ae,n.textField),Qe=!dt()||ye().valid,ie=t.current,qt=ie.vs,ee=N&&N.uDropDownList;qt.enabled=V!==void 0;const U=o.useAdaptiveModeContext(),Ke=!!(_&&U&&_<=U.medium&&n.adaptive);V!==void 0&&(ie.vs.skip=V.skip,ie.vs.total=V.total,ie.vs.pageSize=V.pageSize);const At=u.getFilteredData(n),{focused:zt}=g,Vt=At.findIndex(e=>u.areSame(e,ae,Tt)),Xe=a.createElement("span",{id:Ge,className:o.classNames(o.uDropDownList.inputInner({c:ee}))},be&&a.createElement("span",{className:o.classNames(o.uDropDownList.inputText({c:ee}))},be)),Bt=Je!==void 0?Je.call(void 0,Xe,ae):Xe,Ze=a.createElement(a.Fragment,null,a.createElement("span",{ref:pt,className:o.classNames(o.uDropDownList.wrapper({c:ee,size:$,rounded:Te,fillMode:ge,focused:zt,disabled:se,invalid:!Qe,loading:Ye,required:De()}),Ft),style:Ee?{...oe,width:void 0}:oe,dir:Mt,onMouseDown:Ne?e=>{e.target.nodeName!=="INPUT"&&(ne(t.current.wrapper),e.preventDefault())}:void 0,onFocus:Ct,onBlur:Lt,tabIndex:o.getTabIndex(it,se),accessKey:n.accessKey,onKeyDown:Ae,onKeyPress:kt,onClick:se?void 0:Se,role:"combobox","aria-required":De(),"aria-disabled":se||void 0,"aria-haspopup":"listbox","aria-expanded":Ne||!1,"aria-owns":ke,"aria-activedescendant":Ne?"option-"+je+"-"+(Vt+(V?V.skip:0)):void 0,"aria-label":n.ariaLabel||n.label,"aria-labelledby":n.ariaLabelledBy,"aria-describedby":n.ariaDescribedBy||Ge,"aria-controls":ke,id:n.id,title:n.title},Bt,Ye&&a.createElement(o.IconWrap,{className:o.classNames(o.uDropDownList.loadingIcon({c:ee})),name:"loading"}),a.createElement(rt.Button,{tabIndex:-1,type:"button","aria-label":Pt,size:$,fillMode:ge,className:o.classNames(o.uDropDownList.inputButton({c:ee})),rounded:null,themeColor:"base",iconClass:$e,svgIcon:$e?void 0:Ot||tt.caretAltDownIcon,onMouseDown:e=>g.focused&&e.preventDefault()}),mt(ae),!Ke&&It()),Ke&&yt());return Ee?a.createElement(Wt.FloatingLabel,{label:Ee,editorValue:be,editorValid:Qe,editorDisabled:n.disabled,style:{width:oe?oe.width:void 0},children:Ze}):Ze});pe.propTypes={delay:L.number,ignoreCase:L.bool,iconClassName:L.string,svgIcon:o.svgIconPropType,defaultItem:L.any,valueRender:L.func,valueMap:L.func,validationMessage:L.string,required:L.bool,id:L.string,ariaLabelledBy:L.string,ariaDescribedBy:L.string,ariaLabel:L.string,leftRightKeysNavigation:L.bool,title:L.string,groupField:L.string,list:L.any,skipDisabledItems:L.bool};const P={delay:500,tabIndex:0,ignoreCase:!0,...ot.defaultProps,required:!1,size:"medium",rounded:"medium",fillMode:"solid",groupMode:"modern"};pe.displayName="KendoReactDropDownList";const st=o.createPropsContext();pe.displayName="KendoReactDropDownList";exports.DropDownList=pe;exports.DropDownListPropsContext=st;exports.dropDownListDefaultProps=P;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ht=require("react"),L=require("prop-types"),o=require("@progress/kendo-react-common"),Wt=require("@progress/kendo-react-labels"),tt=require("@progress/kendo-svg-icons"),_t=require("../common/ListContainer.js"),Ut=require("../common/ListFilter.js"),nt=require("../common/GroupStickyHeader.js"),Gt=require("../common/ListDefaultItem.js"),jt=require("../common/List.js"),ot=require("../common/DropDownBase.js"),u=require("../common/utils.js"),Yt=require("../package-metadata.js"),rt=require("@progress/kendo-react-buttons"),$t=require("@progress/kendo-react-intl"),Fe=require("../messages/index.js"),Me=require("@progress/kendo-react-layout");function Jt(M){const Y=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(M){for(const T in M)if(T!=="default"){const n=Object.getOwnPropertyDescriptor(M,T);Object.defineProperty(Y,T,n.get?n:{enumerable:!0,get:()=>M[T]})}}return Y.default=M,Object.freeze(Y)}const a=Jt(Ht),Qt="Please select a value from the list!",me=a.forwardRef((M,Y)=>{let T=!1;const n=o.usePropsContext(st,M),{delay:at=P.delay,tabIndex:it=P.tabIndex,ignoreCase:ge=P.ignoreCase,size:$=P.size,rounded:Te=P.rounded,fillMode:fe=P.fillMode,groupMode:Xt=P.groupMode}=n;if(n.filterable||n.virtual){const e=[];n.filterable&&e.push("filterable"),n.virtual&&e.push("virtualization"),T=!o.validatePackage(Yt.packageMetadata,{component:"DropDownList",features:e})}const N=o.useUnstyled(),ve=o.useId(n.id),De=()=>{var e;if(o.canUseDOM)return((e=Q.current)==null?void 0:e.ownerDocument)||window.document},lt=()=>{var e,r;(e=t==null?void 0:t.current)!=null&&e.wrapper&&((r=t==null?void 0:t.current)==null||r.wrapper.focus({preventScroll:!0}))},k=()=>{let e;return q.current!==void 0&&q.current!==null?e=q.current:n.value!==void 0?e=n.value:g.value!==void 0&&g.value!==null?e=g.value:n.defaultValue!==void 0&&n.defaultValue!==null&&(e=n.defaultValue),!u.isPresent(e)&&n.defaultItem!==void 0&&n.defaultItem!==null&&(e=n.defaultItem),e},ct=()=>{const{dataItemKey:e}=n,r=u.getFilteredData(n),i=k();return r.findIndex(p=>u.areSame(p,i,e))},ye=()=>n.required!==void 0?n.required:P.required,he=()=>{const e=n.validationMessage!==void 0,r=k(),i=!ye()||r!==null&&r!==""&&r!==void 0,p=n.valid!==void 0?n.valid:i;return{customError:e,valid:p,valueMissing:r===null}},dt=()=>n.validityStyles!==void 0?n.validityStyles:P.validityStyles,ne=e=>{re.current=!0,e.focus(),window.setTimeout(()=>re.current=!1,30)},we=()=>{X.current&&ne(X.current),n.adaptive&&setTimeout(()=>{X.current&&ne(X.current)},300)},ut=a.useCallback(e=>{for(const r of e)bt(r.target.clientWidth)},[]),Oe=()=>{var e;(e=Ce.current)!=null&&e.setCustomValidity&&Ce.current.setCustomValidity(he().valid?"":n.validationMessage||Qt)},H=(e,r)=>{const i=k();u.areSame(i,e,n.dataItemKey)||(n.value===void 0&&(r.data.value=e),t.current.updateComponentArgs({value:e}),q.current=e,r.events.push({type:"onChange"}))},b=e=>{var r;(r=t==null?void 0:t.current)==null||r.applyState(e),q.current=void 0},J=(e,r)=>{var c;const{virtual:i,dataItemKey:p,defaultItem:m}=n,f=u.getFilteredData(n),D=i?i.skip:0,v=k(),s=e===-1&&m!==void 0?m:f[e-D],d=!u.areSame(s,v,p);H(s,r),d&&((c=t==null?void 0:t.current)==null||c.triggerPageChangeCornerItems(s,r))},O=(e,r,i)=>{var w,h;const{defaultItem:p,dataItemKey:m,virtual:f={skip:0,total:0,pageSize:0}}=n,D=k(),v=u.getFilteredData(n),s=(w=t==null?void 0:t.current)==null?void 0:w.vs,d=v.findIndex(I=>u.areSame(I,D,m)),c=(h=t==null?void 0:t.current)==null?void 0:h.navigation.navigate({current:f.skip+d,max:(s!=null&&s.enabled?f.total:v.length)-1,min:p!==void 0?-1:0,keyCode:r,skipItems:i||void 0});c!==void 0&&J(c,e),b(e)},pt=e=>{Q.current=e,t.current.wrapper=e},mt=e=>a.createElement("select",{name:n.name,ref:r=>{Ce.current=r},tabIndex:-1,"aria-hidden":!0,title:n.label,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},a.createElement("option",{value:n.valueMap?n.valueMap.call(void 0,e):e})),Ie=()=>{const{textField:e,dataItemKey:r,virtual:i={skip:0},focusedItemIndex:p=u.itemIndexStartsWith,filterable:m,skipDisabledItems:f=!0}=n,D=k(),v=u.getFilteredData(n),s=n.filter?n.filter:g.text;return f&&e&&!s&&!D?v.findIndex(d=>!d.disabled&&d[e]):u.isPresent(D)&&s===void 0||m&&s===""?v.findIndex(d=>u.areSame(d,D,r)):s?Le.current?p(v,s,e):v.findIndex(d=>u.areSame(d,D,r)):i.skip===0?0:-1},qe=(e,r)=>r!==void 0&&r!==-1&&e&&e.length>0&&e[r].disabled,Se=()=>{const e=u.getFilteredData(n),r=t.current.initState(),i=Ie();qe(e,i)&&(H(null,r),b(r))},xe=e=>{if(e.isPropagationStopped())return;const r=t.current.initState();r.syntheticEvent=e,g.focused||(r.data.focused=!0),Se(),t.current.togglePopup(r),b(r)},Ae=e=>{var F,ue,B,pe,j,Re,et;e&&e.target instanceof Element&&e.target.nodeName==="INPUT"&&e.stopPropagation&&e.stopPropagation();const{filterable:r,disabled:i,defaultItem:p,leftRightKeysNavigation:m=!0,virtual:f={skip:0,total:0,pageSize:0},dataItemKey:D,groupField:v="",textField:s,skipDisabledItems:d=!0}=n,c=u.getFilteredData(n),w=k(),h=c.findIndex(C=>u.areSame(C,w,D)),I=n.opened!==void 0?n.opened:g.opened,l=e.keyCode,K=l===o.Keys.home||l===o.Keys.end,E=l===o.Keys.up||l===o.Keys.down,G=!I&&(e.altKey&&l===o.Keys.down||l===o.Keys.enter||l===o.Keys.space),te=I&&(e.altKey&&l===o.Keys.up||l===o.Keys.esc),ce=m&&(l===o.Keys.left||l===o.Keys.right),de=E||ce&&!r||K,x=t.current.initState();if(x.syntheticEvent=e,!i){if(K&&((F=t==null?void 0:t.current)!=null&&F.vs.enabled))l===o.Keys.home?f.skip!==0?((ue=t==null?void 0:t.current)==null||ue.triggerOnPageChange(x,0,f.pageSize),A.current=!0):H(c[0],x):f.skip<f.total-f.pageSize?((B=t==null?void 0:t.current)==null||B.triggerOnPageChange(x,f.total-f.pageSize,f.pageSize),A.current=!0):H(c[c.length-1],x);else if(I&&l===o.Keys.pageUp)e.preventDefault(),(pe=t==null?void 0:t.current)==null||pe.scrollPopupByPageSize(-1);else if(I&&l===o.Keys.pageDown)e.preventDefault(),(j=t==null?void 0:t.current)==null||j.scrollPopupByPageSize(1);else if(I&&l===o.Keys.enter){const C=Ie();qe(c,C)?(H(null,x),b(x)):J(C,x),(Re=t==null?void 0:t.current)==null||Re.togglePopup(x),e.preventDefault()}else if(G||te)te&&Se(),(et=t==null?void 0:t.current)==null||et.togglePopup(x),e.preventDefault();else if(de){if(Le.current=!1,v!==""&&s)if(!d&&I)O(x,l);else{let C;if(l===o.Keys.down||l===o.Keys.right){const S=c.slice(h+1).find(y=>!y.disabled&&y[s]);C=S&&c.findIndex(y=>y[s]===S[s])}else if(l===o.Keys.up||l===o.Keys.left){let S;if(h===0&&p)C=-1;else if(h===-1)S=c,C=c.findIndex(y=>!y.disabled&&y[s]);else{S=c.slice(0,h);let y=S.pop();for(;y&&y.disabled;)y=S.pop();C=y&&c.findIndex(Pe=>Pe[s]===y[s])}}if(C!==void 0){const S=C-h;O(x,l,S)}else C===void 0&&c.findIndex(S=>S[s]===w[s])===c.length-1&&O(x,l)}else if(!d&&I||K)O(x,l);else if(s){let C;if(l===o.Keys.down||l===o.Keys.right){const S=c.slice(h+1).find(y=>!y.disabled&&y[s]);C=S&&c.findIndex(y=>y[s]===S[s])}else if(l===o.Keys.up||l===o.Keys.left){let S;if(h===0&&p)C=-1;else if(h===-1)S=c,C=c.find(y=>!y.disabled&&y[s]);else{S=c.slice(0,h);let y=S.pop();for(;y&&y.disabled;)y=S.pop();C=y&&c.findIndex(Pe=>Pe[s]===y[s])}}if(C!==void 0){const S=C-h;O(x,l,S)}else C===void 0&&c.findIndex(S=>S[s]===w[s])===c.length-1&&O(x,l)}else O(x,l);e.preventDefault()}b(x)}},gt=e=>{const r=t.current.initState();r.syntheticEvent=e.syntheticEvent,n.filter===void 0&&(r.data.text=e.target.value),t.current.filterChanged(e.target.value,r),Le.current=!0,b(r),R({group:void 0,text:String(e.target.value)})},ze=()=>{const e=n.filter!==void 0?n.filter:g.text;return n.filterable&&a.createElement(Ut,{value:e,ref:r=>{X.current=r&&r.element},onChange:gt,onKeyDown:Ae,size:$,rounded:Te,fillMode:fe,renderListFilterWrapper:!0})},ft=e=>{var i;const r=t.current.initState();r.syntheticEvent=e,(i=t==null?void 0:t.current)==null||i.togglePopup(r),H(n.defaultItem,r),b(r)},Ve=()=>{const{textField:e,defaultItem:r,dataItemKey:i}=n,p=k();return r!==void 0&&a.createElement(Gt,{defaultItem:r,textField:e,selected:u.areSame(p,r,i),key:"defaultitemkey",onClick:ft})},vt=(e,r)=>{var i;(i=t==null?void 0:t.current)==null||i.handleItemClick(e,r),q.current=void 0},Dt=e=>{const{vs:r,list:i}=t.current;r.scrollHandler(e);const{groupField:p}=n;let m=u.getFilteredData(n);if(!(!p||!m.length)&&p){const f=_e.current=_e.current||(r.enabled?r.itemHeight:i?i.children[0].offsetHeight:0),v=e.target.scrollTop-r.skip*f;m=t.current.getGroupedDataModernMode(m,p);let s=m[0][p];for(let d=1;d<m.length&&!(f*d>v);d++)m[d]&&m[d][p]&&(s=m[d][p]);s!==g.group&&R({group:s})}},Be=()=>{var l;const{textField:e,dataItemKey:r,virtual:i={skip:0,total:void 0},groupHeaderItemRender:p,listNoDataRender:m,itemRender:f}=n,D=u.getFilteredData(n),v=N&&N.uDropDownList,s=t.current.vs,d=i.skip,c=n.opened!==void 0?n.opened:g.opened,w=t.current.getPopupSettings(),h=`translateY(${s.translate}px)`,I=k();return a.createElement(jt,{id:Ee,show:c,data:D.slice(),focusedIndex:Ie(),value:I,textField:e,valueField:r,optionsGuid:je,groupField:n.groupField,groupMode:"modern",listRef:K=>{s.list=t.current.list=K},wrapperStyle:{maxHeight:le?void 0:w.height},wrapperCssClass:o.classNames(o.uDropDownList.listContent({c:v})),listStyle:s.enabled?{transform:h}:void 0,key:"listkey",skip:d,onClick:vt,itemRender:f,groupHeaderItemRender:p,noDataRender:m,onScroll:Dt,wrapperRef:s.scrollerRef,scroller:(l=t==null?void 0:t.current)==null?void 0:l.renderScrollElement(),ariaSetSize:i.total})},yt=()=>{var h;const{header:e,footer:r,adaptiveTitle:i,groupField:p,groupStickyHeaderItemRender:m,list:f}=n,D=u.getFilteredData(n),v=n.opened!==void 0?n.opened:g.opened,s=N&&N.uDropDownList,d=N&&N.uDropDownsActionSheet,c={navigatable:!1,navigatableElements:[],expand:v,animation:!0,onClose:I=>xe(I),className:o.classNames(o.uDropDownsActionSheet.wrapper({c:d}),"k-adaptive-actionsheet"),animationStyles:_&&U&&_<=U.small?{top:0,width:"100%",height:"100%"}:void 0,position:_&&U&&_<=U.small?"fullscreen":void 0};let{group:w}=g;return w===void 0&&p!==void 0&&(w=u.getItemValue(D[0],p)),a.createElement(Me.ActionSheet,{...c},a.createElement(Me.ActionSheetHeader,{className:o.classNames(o.uDropDownsActionSheet.header({c:d}))},a.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.titleBar({c:d}))},a.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.title({c:d}))},a.createElement("div",null,i)),a.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.actions({c:d}))},a.createElement(rt.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:xe,icon:"x",svgIcon:tt.xIcon}))),a.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.titleBarGroup({c:d}))},ze())),a.createElement(Me.ActionSheetContent,null,e&&a.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:s}))},e),a.createElement("div",{className:o.classNames(o.uDropDownList.list({c:s,size:$,virtual:(h=t==null?void 0:t.current)==null?void 0:h.vs.enabled}))},Ve(),!f&&w&&D.length!==0&&a.createElement(nt,{group:w,groupMode:"modern",render:m}),Be()),r&&a.createElement("div",{className:o.classNames(o.uDropDownList.listFooter({c:s}))},r)))},ht=()=>{g.focused&&window.setTimeout(()=>{g.focused&&t.current.wrapper&&ne(t.current.wrapper)})},wt=e=>{"onMouseDownOutside"in(n.popupSettings||{})&&n.popupSettings.onMouseDownOutside.call(void 0,e)},It=()=>{const{header:e,footer:r,dir:i,groupField:p,groupStickyHeaderItemRender:m,list:f}=n,D=u.getFilteredData(n),v=t.current,s=v.getPopupSettings(),d=n.opened!==void 0?n.opened:g.opened,c=s.width!==void 0?s.width:v.popupWidth,w=N&&N.uDropDownList,h={dir:i!==void 0?i:v.dirCalculated,width:c,popupSettings:{...s,popupClass:o.classNames(s.popupClass,o.uDropDownList.listContainer({c:w})),anchor:s.anchor||Q.current,show:d,onOpen:we,onClose:ht,onMouseDownOutside:wt},itemsCount:[D.length]};let{group:I}=g;return I===void 0&&p!==void 0&&(I=u.getItemValue(D[0],p)),a.createElement(_t,{...h},ze(),e&&a.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:w}))},e),a.createElement("div",{className:o.classNames(o.uDropDownList.list({c:w,size:$,virtual:t.current.vs.enabled}))},Ve(),!f&&I&&D.length!==0&&a.createElement(nt,{group:I,groupMode:"modern",render:m}),Be()),r&&a.createElement("div",{className:o.classNames(o.uDropDownList.listFooter({c:w}))},r),T&&a.createElement(o.WatermarkOverlay,null))},St=e=>{const{dataItemKey:r}=n,i=u.getFilteredData(n),p=k();let m=i.map((E,G)=>({item:E,itemIndex:G}));const f=W.current.word,D=W.current.last,v=u.sameCharsOnly(f,D);let s=m.length,d=Math.max(0,i.findIndex(E=>u.areSame(E,p,r))),c;n.defaultItem&&(c={item:n.defaultItem,itemIndex:-1},s+=1,d+=1),d+=v?1:0,m=u.shuffleData(m,d,c);let w,h,I,l=0;const{textField:K}=n;for(;l<s;){if(w=u.getItemValue(m[l].item,K),h=v&&u.matchText(w,D,ge),I=u.matchText(w,f,ge),h||I){l=m[l].itemIndex;break}l++}if(l!==s){const E=t.current.initState();E.syntheticEvent=e,J(l,E),b(E),q.current=void 0}},xt=e=>{clearTimeout(We.current),n.filterable||(We.current=window.setTimeout(()=>W.current.word="",at),St(e))},Ct=e=>{re.current||t.current.handleFocus(e)},Lt=e=>{if(re.current||!g.focused)return;const r=n.opened!==void 0?n.opened:g.opened,i=t.current.initState();i.syntheticEvent=e,i.data.focused=!1,i.events.push({type:"onBlur"}),r&&Se(),r&&!le&&t.current.togglePopup(i),b(i)},kt=e=>{if(n.filterable||e.which===0||e.keyCode===o.Keys.enter)return;let r=String.fromCharCode(e.charCode||e.keyCode);ge&&(r=r.toLowerCase()),r===" "&&e.preventDefault(),W.current={word:W.current.word+r,last:W.current.last+r},xt(e)},Et=()=>{const e=t.current.initState();e.data.opened=g.opened,t.current.togglePopup(e),b(e)},He=a.useRef(null),Q=a.useRef(null),Ce=a.useRef(null),X=a.useRef(null);a.useImperativeHandle(He,()=>({get element(){return Q.current},get index(){return ct()},get name(){return n.name},get validity(){return he()},get value(){return k()},get focused(){return g.focused},get opened(){return g.opened},focus:lt,props:n,togglePopup:Et})),a.useImperativeHandle(Y,()=>He.current);const We=a.useRef(null),W=a.useRef({word:"",last:""}),re=a.useRef(!1),q=a.useRef(null),A=a.useRef(!1),Le=a.useRef(!1),z=a.useRef({}),ke=a.useRef({}),t=a.useRef(new ot({props:n,setState:()=>{},state:{},forceUpdate:()=>{},element:null,value:null,handleItemSelect:()=>{}})),_e=a.useRef(0),Z=a.useRef(null),[g,Nt]=a.useState({}),[_,bt]=a.useState(),[,Ue]=a.useReducer(e=>e,!0),Kt=$t.useLocalization(),R=e=>{Nt({...g,...e})};a.useEffect(()=>{t.current.updateComponentArgs({props:n,setState:R,state:g,forceUpdate:Ue,element:Q.current,handleItemSelect:J,value:k()})},[R,g,Ue,J,k]),a.useEffect(()=>{var d,c,w,h,I,l,K,E,G,te,ce,de,x;const{dataItemKey:e,virtual:r,groupField:i="",textField:p}=n,m=u.getFilteredData(n),f=z.current.virtual?z.current.virtual.total:0,D=n.opened!==void 0?n.opened:g.opened,v=z.current.opened!==void 0?z.current.opened:ke.current.opened,s=!v&&D;if((d=t==null?void 0:t.current)==null||d.didUpdate(),(c=t==null?void 0:t.current)!=null&&c.getPopupSettings().animate||s&&we(),r&&r.total!==f)(w=t==null?void 0:t.current)==null||w.vs.calcScrollElementHeight(),(h=t==null?void 0:t.current)==null||h.vs.reset();else{const F=k(),ue=z.current.value!==void 0?z.current.value:ke.current.value;let B=m.findIndex(j=>u.areSame(j,F,e));i!==""&&F&&p&&(B=(l=(I=t==null?void 0:t.current)==null?void 0:I.getGroupedDataModernMode(m,i))==null?void 0:l.map(j=>j[p]).indexOf(F[p]));const pe=!u.areSame(ue,F,e);s&&r?(K=t==null?void 0:t.current)==null||K.scrollToVirtualItem(r,B):s&&!r?(we(),m&&m.length!==0&&((E=t==null?void 0:t.current)==null||E.resetGroupStickyHeader(m[0][i],{setState:R,group:g.group,state:g})),(G=t==null?void 0:t.current)==null||G.scrollToItem(B)):D&&v&&F&&pe&&!A.current?(ce=t==null?void 0:t.current)==null||ce.scrollToItem(B,(te=t==null?void 0:t.current)==null?void 0:te.vs.enabled):D&&v&&A.current&&(A.current&&r&&r.skip===0?(de=t==null?void 0:t.current)==null||de.vs.reset():A.current&&r&&r.skip===r.total-r.pageSize&&((x=t==null?void 0:t.current)==null||x.vs.scrollToEnd()))}A.current=!1,ke.current=g,z.current=n,Oe()}),a.useEffect(()=>{var e,r;return Z.current=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(ut.bind(void 0)),(e=t==null?void 0:t.current)==null||e.didMount(),Oe(),(r=De())!=null&&r.body&&Z.current&&Z.current.observe(De().body),()=>{var i;(i=De())!=null&&i.body&&Z.current&&Z.current.disconnect()}},[]);const Ge=ve+"-accessibility-id",Ee=ve+"-listbox-id",je=ve+"-guid",Pt=Kt.toLanguageString(Fe.dropDownListArrowBtnAriaLabel,Fe.messages[Fe.dropDownListArrowBtnAriaLabel]),{style:oe,className:Ft,label:Ne,dir:Mt,virtual:V,adaptive:Zt,dataItemKey:Tt,disabled:se,loading:Ye,iconClassName:$e,svgIcon:Ot,valueRender:Je}=n,be=n.opened!==void 0?n.opened:g.opened,ae=k(),Ke=u.getItemValue(ae,n.textField),Qe=!dt()||he().valid,ie=t.current,qt=ie.vs,ee=N&&N.uDropDownList;qt.enabled=V!==void 0;const U=o.useAdaptiveModeContext(),le=!!(_&&U&&_<=U.medium&&n.adaptive);V!==void 0&&(ie.vs.skip=V.skip,ie.vs.total=V.total,ie.vs.pageSize=V.pageSize);const At=u.getFilteredData(n),{focused:zt}=g,Vt=At.findIndex(e=>u.areSame(e,ae,Tt)),Xe=a.createElement("span",{id:Ge,className:o.classNames(o.uDropDownList.inputInner({c:ee}))},Ke&&a.createElement("span",{className:o.classNames(o.uDropDownList.inputText({c:ee}))},Ke)),Bt=Je!==void 0?Je.call(void 0,Xe,ae):Xe,Ze=a.createElement(a.Fragment,null,a.createElement("span",{ref:pt,className:o.classNames(o.uDropDownList.wrapper({c:ee,size:$,rounded:Te,fillMode:fe,focused:zt,disabled:se,invalid:!Qe,loading:Ye,required:ye()}),Ft),style:Ne?{...oe,width:void 0}:oe,dir:Mt,onMouseDown:be?e=>{e.target.nodeName!=="INPUT"&&(ne(t.current.wrapper),e.preventDefault())}:void 0,onFocus:Ct,onBlur:Lt,tabIndex:o.getTabIndex(it,se),accessKey:n.accessKey,onKeyDown:Ae,onKeyPress:kt,onClick:se?void 0:xe,role:"combobox","aria-required":ye(),"aria-disabled":se||void 0,"aria-haspopup":"listbox","aria-expanded":be||!1,"aria-owns":Ee,"aria-activedescendant":be?"option-"+je+"-"+(Vt+(V?V.skip:0)):void 0,"aria-label":n.ariaLabel||n.label,"aria-labelledby":n.ariaLabelledBy,"aria-describedby":n.ariaDescribedBy||Ge,"aria-controls":Ee,id:n.id,title:n.title},Bt,Ye&&a.createElement(o.IconWrap,{className:o.classNames(o.uDropDownList.loadingIcon({c:ee})),name:"loading"}),a.createElement(rt.Button,{tabIndex:-1,type:"button","aria-label":Pt,size:$,fillMode:fe,className:o.classNames(o.uDropDownList.inputButton({c:ee})),rounded:null,themeColor:"base",iconClass:$e,svgIcon:$e?void 0:Ot||tt.caretAltDownIcon,onMouseDown:e=>g.focused&&e.preventDefault()}),mt(ae),!le&&It()),le&&yt());return Ne?a.createElement(Wt.FloatingLabel,{label:Ne,editorValue:Ke,editorValid:Qe,editorDisabled:n.disabled,style:{width:oe?oe.width:void 0},children:Ze}):Ze});me.propTypes={delay:L.number,ignoreCase:L.bool,iconClassName:L.string,svgIcon:o.svgIconPropType,defaultItem:L.any,valueRender:L.func,valueMap:L.func,validationMessage:L.string,required:L.bool,id:L.string,ariaLabelledBy:L.string,ariaDescribedBy:L.string,ariaLabel:L.string,leftRightKeysNavigation:L.bool,title:L.string,groupField:L.string,list:L.any,skipDisabledItems:L.bool};const P={delay:500,tabIndex:0,ignoreCase:!0,...ot.defaultProps,required:!1,size:"medium",rounded:"medium",fillMode:"solid",groupMode:"modern"};me.displayName="KendoReactDropDownList";const st=o.createPropsContext();me.displayName="KendoReactDropDownList";exports.DropDownList=me;exports.DropDownListPropsContext=st;exports.dropDownListDefaultProps=P;
|
|
@@ -16,7 +16,7 @@ import rt from "../common/GroupStickyHeader.mjs";
|
|
|
16
16
|
import ln from "../common/ListDefaultItem.mjs";
|
|
17
17
|
import dn from "../common/List.mjs";
|
|
18
18
|
import lt from "../common/DropDownBase.mjs";
|
|
19
|
-
import { getFilteredData as b, areSame as M, getItemValue as
|
|
19
|
+
import { getFilteredData as b, areSame as M, getItemValue as fe, isPresent as ot, itemIndexStartsWith as cn, sameCharsOnly as un, shuffleData as pn, matchText as it } from "../common/utils.mjs";
|
|
20
20
|
import { packageMetadata as mn } from "../package-metadata.mjs";
|
|
21
21
|
import { Button as at } from "@progress/kendo-react-buttons";
|
|
22
22
|
import { useLocalization as fn } from "@progress/kendo-react-intl";
|
|
@@ -27,10 +27,10 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
27
27
|
const n = Yt(wn, dt), {
|
|
28
28
|
delay: ut = T.delay,
|
|
29
29
|
tabIndex: pt = T.tabIndex,
|
|
30
|
-
ignoreCase:
|
|
30
|
+
ignoreCase: ve = T.ignoreCase,
|
|
31
31
|
size: J = T.size,
|
|
32
32
|
rounded: ze = T.rounded,
|
|
33
|
-
fillMode:
|
|
33
|
+
fillMode: ge = T.fillMode,
|
|
34
34
|
groupMode: xn = T.groupMode
|
|
35
35
|
} = n;
|
|
36
36
|
if (n.filterable || n.virtual) {
|
|
@@ -40,7 +40,7 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
40
40
|
features: e
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
const N = jt(),
|
|
43
|
+
const N = jt(), he = Jt(n.id), Ie = () => {
|
|
44
44
|
var e;
|
|
45
45
|
if (nt)
|
|
46
46
|
return ((e = X.current) == null ? void 0 : e.ownerDocument) || window.document;
|
|
@@ -53,8 +53,8 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
53
53
|
}, ft = () => {
|
|
54
54
|
const { dataItemKey: e } = n, r = b(n), a = k();
|
|
55
55
|
return r.findIndex((c) => M(c, a, e));
|
|
56
|
-
},
|
|
57
|
-
const e = n.validationMessage !== void 0, r = k(), a = !
|
|
56
|
+
}, ye = () => n.required !== void 0 ? n.required : T.required, we = () => {
|
|
57
|
+
const e = n.validationMessage !== void 0, r = k(), a = !ye() || r !== null && r !== "" && r !== void 0, c = n.valid !== void 0 ? n.valid : a;
|
|
58
58
|
return {
|
|
59
59
|
customError: e,
|
|
60
60
|
valid: c,
|
|
@@ -62,7 +62,7 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
62
62
|
};
|
|
63
63
|
}, vt = () => n.validityStyles !== void 0 ? n.validityStyles : T.validityStyles, re = (e) => {
|
|
64
64
|
oe.current = !0, e.focus(), window.setTimeout(() => oe.current = !1, 30);
|
|
65
|
-
},
|
|
65
|
+
}, xe = () => {
|
|
66
66
|
Z.current && re(Z.current), n.adaptive && setTimeout(() => {
|
|
67
67
|
Z.current && re(Z.current);
|
|
68
68
|
}, 300);
|
|
@@ -71,8 +71,8 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
71
71
|
Tt(r.target.clientWidth);
|
|
72
72
|
}, []), Oe = () => {
|
|
73
73
|
var e;
|
|
74
|
-
(e =
|
|
75
|
-
|
|
74
|
+
(e = Ee.current) != null && e.setCustomValidity && Ee.current.setCustomValidity(
|
|
75
|
+
we().valid ? "" : n.validationMessage || yn
|
|
76
76
|
);
|
|
77
77
|
}, q = (e, r) => {
|
|
78
78
|
const a = k();
|
|
@@ -101,7 +101,7 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
101
101
|
{
|
|
102
102
|
name: n.name,
|
|
103
103
|
ref: (r) => {
|
|
104
|
-
|
|
104
|
+
Ee.current = r;
|
|
105
105
|
},
|
|
106
106
|
tabIndex: -1,
|
|
107
107
|
"aria-hidden": !0,
|
|
@@ -109,7 +109,7 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
109
109
|
style: { opacity: 0, width: 1, border: 0, zIndex: -1, position: "absolute", left: "50%" }
|
|
110
110
|
},
|
|
111
111
|
/* @__PURE__ */ i.createElement("option", { value: n.valueMap ? n.valueMap.call(void 0, e) : e })
|
|
112
|
-
),
|
|
112
|
+
), De = () => {
|
|
113
113
|
const {
|
|
114
114
|
textField: e,
|
|
115
115
|
dataItemKey: r,
|
|
@@ -118,17 +118,17 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
118
118
|
filterable: u,
|
|
119
119
|
skipDisabledItems: m = !0
|
|
120
120
|
} = n, v = k(), f = b(n), o = n.filter ? n.filter : p.text;
|
|
121
|
-
return m && e && !o && !v ? f.findIndex((d) => !d.disabled && d[e]) : ot(v) && o === void 0 || u && o === "" ? f.findIndex((d) => M(d, v, r)) : o ?
|
|
122
|
-
}, Ae = (e, r) => r !== void 0 && r !== -1 && e && e.length > 0 && e[r].disabled,
|
|
123
|
-
const e = b(n), r = t.current.initState(), a =
|
|
121
|
+
return m && e && !o && !v ? f.findIndex((d) => !d.disabled && d[e]) : ot(v) && o === void 0 || u && o === "" ? f.findIndex((d) => M(d, v, r)) : o ? ke.current ? c(f, o, e) : f.findIndex((d) => M(d, v, r)) : a.skip === 0 ? 0 : -1;
|
|
122
|
+
}, Ae = (e, r) => r !== void 0 && r !== -1 && e && e.length > 0 && e[r].disabled, Se = () => {
|
|
123
|
+
const e = b(n), r = t.current.initState(), a = De();
|
|
124
124
|
Ae(e, a) && (q(null, r), F(r));
|
|
125
|
-
},
|
|
125
|
+
}, Ce = (e) => {
|
|
126
126
|
if (e.isPropagationStopped())
|
|
127
127
|
return;
|
|
128
128
|
const r = t.current.initState();
|
|
129
|
-
r.syntheticEvent = e, p.focused || (r.data.focused = !0),
|
|
129
|
+
r.syntheticEvent = e, p.focused || (r.data.focused = !0), Se(), t.current.togglePopup(r), F(r);
|
|
130
130
|
}, He = (e) => {
|
|
131
|
-
var z,
|
|
131
|
+
var z, pe, W, me, $, et, tt;
|
|
132
132
|
e && e.target instanceof Element && e.target.nodeName === "INPUT" && e.stopPropagation && e.stopPropagation();
|
|
133
133
|
const {
|
|
134
134
|
filterable: r,
|
|
@@ -140,25 +140,25 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
140
140
|
groupField: f = "",
|
|
141
141
|
textField: o,
|
|
142
142
|
skipDisabledItems: d = !0
|
|
143
|
-
} = n, l = b(n), I = k(), h = l.findIndex((S) => M(S, I, v)), y = n.opened !== void 0 ? n.opened : p.opened, s = e.keyCode, K = s === w.home || s === w.end, P = s === w.up || s === w.down, Y = !y && (e.altKey && s === w.down || s === w.enter || s === w.space), ne = y && (e.altKey && s === w.up || s === w.esc),
|
|
143
|
+
} = n, l = b(n), I = k(), h = l.findIndex((S) => M(S, I, v)), y = n.opened !== void 0 ? n.opened : p.opened, s = e.keyCode, K = s === w.home || s === w.end, P = s === w.up || s === w.down, Y = !y && (e.altKey && s === w.down || s === w.enter || s === w.space), ne = y && (e.altKey && s === w.up || s === w.esc), ce = u && (s === w.left || s === w.right), ue = P || ce && !r || K, D = t.current.initState();
|
|
144
144
|
if (D.syntheticEvent = e, !a) {
|
|
145
145
|
if (K && ((z = t == null ? void 0 : t.current) != null && z.vs.enabled))
|
|
146
|
-
s === w.home ? m.skip !== 0 ? ((
|
|
146
|
+
s === w.home ? m.skip !== 0 ? ((pe = t == null ? void 0 : t.current) == null || pe.triggerOnPageChange(D, 0, m.pageSize), H.current = !0) : q(l[0], D) : m.skip < m.total - m.pageSize ? ((W = t == null ? void 0 : t.current) == null || W.triggerOnPageChange(
|
|
147
147
|
D,
|
|
148
148
|
m.total - m.pageSize,
|
|
149
149
|
m.pageSize
|
|
150
150
|
), H.current = !0) : q(l[l.length - 1], D);
|
|
151
151
|
else if (y && s === w.pageUp)
|
|
152
|
-
e.preventDefault(), (
|
|
152
|
+
e.preventDefault(), (me = t == null ? void 0 : t.current) == null || me.scrollPopupByPageSize(-1);
|
|
153
153
|
else if (y && s === w.pageDown)
|
|
154
154
|
e.preventDefault(), ($ = t == null ? void 0 : t.current) == null || $.scrollPopupByPageSize(1);
|
|
155
155
|
else if (y && s === w.enter) {
|
|
156
|
-
const S =
|
|
156
|
+
const S = De();
|
|
157
157
|
Ae(l, S) ? (q(null, D), F(D)) : Q(S, D), (et = t == null ? void 0 : t.current) == null || et.togglePopup(D), e.preventDefault();
|
|
158
158
|
} else if (Y || ne)
|
|
159
|
-
ne &&
|
|
160
|
-
else if (
|
|
161
|
-
if (
|
|
159
|
+
ne && Se(), (tt = t == null ? void 0 : t.current) == null || tt.togglePopup(D), e.preventDefault();
|
|
160
|
+
else if (ue) {
|
|
161
|
+
if (ke.current = !1, f !== "" && o)
|
|
162
162
|
if (!d && y)
|
|
163
163
|
O(D, s);
|
|
164
164
|
else {
|
|
@@ -218,7 +218,7 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
218
218
|
}
|
|
219
219
|
}, yt = (e) => {
|
|
220
220
|
const r = t.current.initState();
|
|
221
|
-
r.syntheticEvent = e.syntheticEvent, n.filter === void 0 && (r.data.text = e.target.value), t.current.filterChanged(e.target.value, r),
|
|
221
|
+
r.syntheticEvent = e.syntheticEvent, n.filter === void 0 && (r.data.text = e.target.value), t.current.filterChanged(e.target.value, r), ke.current = !0, F(r), ee({ group: void 0, text: String(e.target.value) });
|
|
222
222
|
}, Ve = () => {
|
|
223
223
|
const e = n.filter !== void 0 ? n.filter : p.text;
|
|
224
224
|
return n.filterable && /* @__PURE__ */ i.createElement(
|
|
@@ -232,7 +232,7 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
232
232
|
onKeyDown: He,
|
|
233
233
|
size: J,
|
|
234
234
|
rounded: ze,
|
|
235
|
-
fillMode:
|
|
235
|
+
fillMode: ge,
|
|
236
236
|
renderListFilterWrapper: !0
|
|
237
237
|
}
|
|
238
238
|
);
|
|
@@ -281,10 +281,10 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
281
281
|
return /* @__PURE__ */ i.createElement(
|
|
282
282
|
dn,
|
|
283
283
|
{
|
|
284
|
-
id:
|
|
284
|
+
id: be,
|
|
285
285
|
show: l,
|
|
286
286
|
data: v.slice(),
|
|
287
|
-
focusedIndex:
|
|
287
|
+
focusedIndex: De(),
|
|
288
288
|
value: y,
|
|
289
289
|
textField: e,
|
|
290
290
|
valueField: r,
|
|
@@ -294,7 +294,7 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
294
294
|
listRef: (K) => {
|
|
295
295
|
o.list = t.current.list = K;
|
|
296
296
|
},
|
|
297
|
-
wrapperStyle: { maxHeight: I.height },
|
|
297
|
+
wrapperStyle: { maxHeight: de ? void 0 : I.height },
|
|
298
298
|
wrapperCssClass: C(L.listContent({ c: f })),
|
|
299
299
|
listStyle: o.enabled ? { transform: h } : void 0,
|
|
300
300
|
key: "listkey",
|
|
@@ -316,7 +316,7 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
316
316
|
navigatableElements: [],
|
|
317
317
|
expand: f,
|
|
318
318
|
animation: !0,
|
|
319
|
-
onClose: (y) =>
|
|
319
|
+
onClose: (y) => Ce(y),
|
|
320
320
|
className: C(
|
|
321
321
|
j.wrapper({
|
|
322
322
|
c: d
|
|
@@ -327,7 +327,7 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
327
327
|
position: _ && G && _ <= G.small ? "fullscreen" : void 0
|
|
328
328
|
};
|
|
329
329
|
let { group: I } = p;
|
|
330
|
-
return I === void 0 && c !== void 0 && (I =
|
|
330
|
+
return I === void 0 && c !== void 0 && (I = fe(v[0], c)), /* @__PURE__ */ i.createElement(gn, { ...l }, /* @__PURE__ */ i.createElement(hn, { className: C(j.header({ c: d })) }, /* @__PURE__ */ i.createElement("div", { className: C(j.titleBar({ c: d })) }, /* @__PURE__ */ i.createElement("div", { className: C(j.title({ c: d })) }, /* @__PURE__ */ i.createElement("div", null, a)), /* @__PURE__ */ i.createElement("div", { className: C(j.actions({ c: d })) }, /* @__PURE__ */ i.createElement(
|
|
331
331
|
at,
|
|
332
332
|
{
|
|
333
333
|
tabIndex: 0,
|
|
@@ -335,7 +335,7 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
335
335
|
"aria-disabled": "false",
|
|
336
336
|
type: "button",
|
|
337
337
|
fillMode: "flat",
|
|
338
|
-
onClick:
|
|
338
|
+
onClick: Ce,
|
|
339
339
|
icon: "x",
|
|
340
340
|
svgIcon: on
|
|
341
341
|
}
|
|
@@ -381,14 +381,14 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
381
381
|
),
|
|
382
382
|
anchor: o.anchor || X.current,
|
|
383
383
|
show: d,
|
|
384
|
-
onOpen:
|
|
384
|
+
onOpen: xe,
|
|
385
385
|
onClose: Ct,
|
|
386
386
|
onMouseDownOutside: Et
|
|
387
387
|
},
|
|
388
388
|
itemsCount: [v.length]
|
|
389
389
|
};
|
|
390
390
|
let { group: y } = p;
|
|
391
|
-
return y === void 0 && c !== void 0 && (y =
|
|
391
|
+
return y === void 0 && c !== void 0 && (y = fe(v[0], c)), /* @__PURE__ */ i.createElement(an, { ...h }, Ve(), e && /* @__PURE__ */ i.createElement("div", { className: C(L.listHeader({ c: I })) }, e), /* @__PURE__ */ i.createElement(
|
|
392
392
|
"div",
|
|
393
393
|
{
|
|
394
394
|
className: C(
|
|
@@ -415,7 +415,7 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
415
415
|
let I, h, y, s = 0;
|
|
416
416
|
const { textField: K } = n;
|
|
417
417
|
for (; s < o; ) {
|
|
418
|
-
if (I =
|
|
418
|
+
if (I = fe(u[s].item, K), h = f && it(I, v, ve), y = it(I, m, ve), h || y) {
|
|
419
419
|
s = u[s].itemIndex;
|
|
420
420
|
break;
|
|
421
421
|
}
|
|
@@ -433,19 +433,19 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
433
433
|
if (oe.current || !p.focused)
|
|
434
434
|
return;
|
|
435
435
|
const r = n.opened !== void 0 ? n.opened : p.opened, a = t.current.initState();
|
|
436
|
-
a.syntheticEvent = e, a.data.focused = !1, a.events.push({ type: "onBlur" }), r &&
|
|
436
|
+
a.syntheticEvent = e, a.data.focused = !1, a.events.push({ type: "onBlur" }), r && Se(), r && !de && t.current.togglePopup(a), F(a);
|
|
437
437
|
}, Nt = (e) => {
|
|
438
438
|
if (n.filterable || e.which === 0 || e.keyCode === w.enter)
|
|
439
439
|
return;
|
|
440
440
|
let r = String.fromCharCode(e.charCode || e.keyCode);
|
|
441
|
-
|
|
441
|
+
ve && (r = r.toLowerCase()), r === " " && e.preventDefault(), U.current = {
|
|
442
442
|
word: U.current.word + r,
|
|
443
443
|
last: U.current.last + r
|
|
444
444
|
}, bt(e);
|
|
445
445
|
}, Ft = () => {
|
|
446
446
|
const e = t.current.initState();
|
|
447
447
|
e.data.opened = p.opened, t.current.togglePopup(e), F(e);
|
|
448
|
-
}, qe = i.useRef(null), X = i.useRef(null),
|
|
448
|
+
}, qe = i.useRef(null), X = i.useRef(null), Ee = i.useRef(null), Z = i.useRef(null);
|
|
449
449
|
i.useImperativeHandle(
|
|
450
450
|
qe,
|
|
451
451
|
() => ({
|
|
@@ -459,7 +459,7 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
459
459
|
return n.name;
|
|
460
460
|
},
|
|
461
461
|
get validity() {
|
|
462
|
-
return
|
|
462
|
+
return we();
|
|
463
463
|
},
|
|
464
464
|
get value() {
|
|
465
465
|
return k();
|
|
@@ -478,7 +478,7 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
478
478
|
ct,
|
|
479
479
|
() => qe.current
|
|
480
480
|
);
|
|
481
|
-
const Ue = i.useRef(null), U = i.useRef({ word: "", last: "" }), oe = i.useRef(!1), A = i.useRef(null), H = i.useRef(!1),
|
|
481
|
+
const Ue = i.useRef(null), U = i.useRef({ word: "", last: "" }), oe = i.useRef(!1), A = i.useRef(null), H = i.useRef(!1), ke = i.useRef(!1), V = i.useRef({}), Le = i.useRef({}), t = i.useRef(
|
|
482
482
|
new lt({
|
|
483
483
|
props: n,
|
|
484
484
|
setState: () => {
|
|
@@ -505,36 +505,36 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
505
505
|
value: k()
|
|
506
506
|
});
|
|
507
507
|
}, [ee, p, Ge, Q, k]), i.useEffect(() => {
|
|
508
|
-
var d, l, I, h, y, s, K, P, Y, ne,
|
|
509
|
-
const { dataItemKey: e, virtual: r, groupField: a = "", textField: c } = n, u = b(n), m = V.current.virtual ? V.current.virtual.total : 0, v = n.opened !== void 0 ? n.opened : p.opened, f = V.current.opened !== void 0 ? V.current.opened :
|
|
510
|
-
if ((d = t == null ? void 0 : t.current) == null || d.didUpdate(), (l = t == null ? void 0 : t.current) != null && l.getPopupSettings().animate || o &&
|
|
508
|
+
var d, l, I, h, y, s, K, P, Y, ne, ce, ue, D;
|
|
509
|
+
const { dataItemKey: e, virtual: r, groupField: a = "", textField: c } = n, u = b(n), m = V.current.virtual ? V.current.virtual.total : 0, v = n.opened !== void 0 ? n.opened : p.opened, f = V.current.opened !== void 0 ? V.current.opened : Le.current.opened, o = !f && v;
|
|
510
|
+
if ((d = t == null ? void 0 : t.current) == null || d.didUpdate(), (l = t == null ? void 0 : t.current) != null && l.getPopupSettings().animate || o && xe(), r && r.total !== m)
|
|
511
511
|
(I = t == null ? void 0 : t.current) == null || I.vs.calcScrollElementHeight(), (h = t == null ? void 0 : t.current) == null || h.vs.reset();
|
|
512
512
|
else {
|
|
513
|
-
const z = k(),
|
|
513
|
+
const z = k(), pe = V.current.value !== void 0 ? V.current.value : Le.current.value;
|
|
514
514
|
let W = u.findIndex(($) => M($, z, e));
|
|
515
515
|
a !== "" && z && c && (W = (s = (y = t == null ? void 0 : t.current) == null ? void 0 : y.getGroupedDataModernMode(u, a)) == null ? void 0 : s.map(($) => $[c]).indexOf(z[c]));
|
|
516
|
-
const
|
|
517
|
-
o && r ? (K = t == null ? void 0 : t.current) == null || K.scrollToVirtualItem(r, W) : o && !r ? (
|
|
516
|
+
const me = !M(pe, z, e);
|
|
517
|
+
o && r ? (K = t == null ? void 0 : t.current) == null || K.scrollToVirtualItem(r, W) : o && !r ? (xe(), u && u.length !== 0 && ((P = t == null ? void 0 : t.current) == null || P.resetGroupStickyHeader(u[0][a], {
|
|
518
518
|
setState: ee,
|
|
519
519
|
group: p.group,
|
|
520
520
|
state: p
|
|
521
|
-
})), (Y = t == null ? void 0 : t.current) == null || Y.scrollToItem(W)) : v && f && z &&
|
|
521
|
+
})), (Y = t == null ? void 0 : t.current) == null || Y.scrollToItem(W)) : v && f && z && me && !H.current ? (ce = t == null ? void 0 : t.current) == null || ce.scrollToItem(W, (ne = t == null ? void 0 : t.current) == null ? void 0 : ne.vs.enabled) : v && f && H.current && (H.current && r && r.skip === 0 ? (ue = t == null ? void 0 : t.current) == null || ue.vs.reset() : H.current && r && r.skip === r.total - r.pageSize && ((D = t == null ? void 0 : t.current) == null || D.vs.scrollToEnd()));
|
|
522
522
|
}
|
|
523
|
-
H.current = !1,
|
|
523
|
+
H.current = !1, Le.current = p, V.current = n, Oe();
|
|
524
524
|
}), i.useEffect(() => {
|
|
525
525
|
var e, r;
|
|
526
|
-
return R.current = nt && window.ResizeObserver && new window.ResizeObserver(gt.bind(void 0)), (e = t == null ? void 0 : t.current) == null || e.didMount(), Oe(), (r =
|
|
526
|
+
return R.current = nt && window.ResizeObserver && new window.ResizeObserver(gt.bind(void 0)), (e = t == null ? void 0 : t.current) == null || e.didMount(), Oe(), (r = Ie()) != null && r.body && R.current && R.current.observe(Ie().body), () => {
|
|
527
527
|
var a;
|
|
528
|
-
(a =
|
|
528
|
+
(a = Ie()) != null && a.body && R.current && R.current.disconnect();
|
|
529
529
|
};
|
|
530
530
|
}, []);
|
|
531
|
-
const Ye =
|
|
531
|
+
const Ye = he + "-accessibility-id", be = he + "-listbox-id", $e = he + "-guid", Ot = zt.toLanguageString(
|
|
532
532
|
st,
|
|
533
533
|
vn[st]
|
|
534
534
|
), {
|
|
535
535
|
style: ie,
|
|
536
536
|
className: At,
|
|
537
|
-
label:
|
|
537
|
+
label: Pe,
|
|
538
538
|
dir: Ht,
|
|
539
539
|
virtual: B,
|
|
540
540
|
adaptive: Dn,
|
|
@@ -544,11 +544,11 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
544
544
|
iconClassName: Je,
|
|
545
545
|
svgIcon: Bt,
|
|
546
546
|
valueRender: Qe
|
|
547
|
-
} = n,
|
|
547
|
+
} = n, Me = n.opened !== void 0 ? n.opened : p.opened, se = k(), Ne = fe(se, n.textField), Xe = !vt() || we().valid, le = t.current, Wt = le.vs, te = N && N.uDropDownList;
|
|
548
548
|
Wt.enabled = B !== void 0;
|
|
549
|
-
const G = Qt(),
|
|
549
|
+
const G = Qt(), de = !!(_ && G && _ <= G.medium && n.adaptive);
|
|
550
550
|
B !== void 0 && (le.vs.skip = B.skip, le.vs.total = B.total, le.vs.pageSize = B.pageSize);
|
|
551
|
-
const qt = b(n), { focused: Ut } = p, _t = qt.findIndex((e) => M(e, se, Vt)), Ze = /* @__PURE__ */ i.createElement("span", { id: Ye, className: C(L.inputInner({ c: te })) },
|
|
551
|
+
const qt = b(n), { focused: Ut } = p, _t = qt.findIndex((e) => M(e, se, Vt)), Ze = /* @__PURE__ */ i.createElement("span", { id: Ye, className: C(L.inputInner({ c: te })) }, Ne && /* @__PURE__ */ i.createElement("span", { className: C(L.inputText({ c: te })) }, Ne)), Gt = Qe !== void 0 ? Qe.call(void 0, Ze, se) : Ze, Re = /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(
|
|
552
552
|
"span",
|
|
553
553
|
{
|
|
554
554
|
ref: ht,
|
|
@@ -557,18 +557,18 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
557
557
|
c: te,
|
|
558
558
|
size: J,
|
|
559
559
|
rounded: ze,
|
|
560
|
-
fillMode:
|
|
560
|
+
fillMode: ge,
|
|
561
561
|
focused: Ut,
|
|
562
562
|
disabled: ae,
|
|
563
563
|
invalid: !Xe,
|
|
564
564
|
loading: je,
|
|
565
|
-
required:
|
|
565
|
+
required: ye()
|
|
566
566
|
}),
|
|
567
567
|
At
|
|
568
568
|
),
|
|
569
|
-
style:
|
|
569
|
+
style: Pe ? { ...ie, width: void 0 } : ie,
|
|
570
570
|
dir: Ht,
|
|
571
|
-
onMouseDown:
|
|
571
|
+
onMouseDown: Me ? (e) => {
|
|
572
572
|
e.target.nodeName !== "INPUT" && (re(t.current.wrapper), e.preventDefault());
|
|
573
573
|
} : void 0,
|
|
574
574
|
onFocus: Pt,
|
|
@@ -577,18 +577,18 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
577
577
|
accessKey: n.accessKey,
|
|
578
578
|
onKeyDown: He,
|
|
579
579
|
onKeyPress: Nt,
|
|
580
|
-
onClick: ae ? void 0 :
|
|
580
|
+
onClick: ae ? void 0 : Ce,
|
|
581
581
|
role: "combobox",
|
|
582
|
-
"aria-required":
|
|
582
|
+
"aria-required": ye(),
|
|
583
583
|
"aria-disabled": ae || void 0,
|
|
584
584
|
"aria-haspopup": "listbox",
|
|
585
|
-
"aria-expanded":
|
|
586
|
-
"aria-owns":
|
|
587
|
-
"aria-activedescendant":
|
|
585
|
+
"aria-expanded": Me || !1,
|
|
586
|
+
"aria-owns": be,
|
|
587
|
+
"aria-activedescendant": Me ? "option-" + $e + "-" + (_t + (B ? B.skip : 0)) : void 0,
|
|
588
588
|
"aria-label": n.ariaLabel || n.label,
|
|
589
589
|
"aria-labelledby": n.ariaLabelledBy,
|
|
590
590
|
"aria-describedby": n.ariaDescribedBy || Ye,
|
|
591
|
-
"aria-controls":
|
|
591
|
+
"aria-controls": be,
|
|
592
592
|
id: n.id,
|
|
593
593
|
title: n.title
|
|
594
594
|
},
|
|
@@ -601,7 +601,7 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
601
601
|
type: "button",
|
|
602
602
|
"aria-label": Ot,
|
|
603
603
|
size: J,
|
|
604
|
-
fillMode:
|
|
604
|
+
fillMode: ge,
|
|
605
605
|
className: C(L.inputButton({ c: te })),
|
|
606
606
|
rounded: null,
|
|
607
607
|
themeColor: "base",
|
|
@@ -611,13 +611,13 @@ const yn = "Please select a value from the list!", Ke = i.forwardRef((dt, ct) =>
|
|
|
611
611
|
}
|
|
612
612
|
),
|
|
613
613
|
It(se),
|
|
614
|
-
!
|
|
615
|
-
),
|
|
616
|
-
return
|
|
614
|
+
!de && kt()
|
|
615
|
+
), de && St());
|
|
616
|
+
return Pe ? /* @__PURE__ */ i.createElement(
|
|
617
617
|
nn,
|
|
618
618
|
{
|
|
619
|
-
label:
|
|
620
|
-
editorValue:
|
|
619
|
+
label: Pe,
|
|
620
|
+
editorValue: Ne,
|
|
621
621
|
editorValid: Xe,
|
|
622
622
|
editorDisabled: n.disabled,
|
|
623
623
|
style: { width: ie ? ie.width : void 0 },
|