@progress/kendo-react-dropdowns 14.5.0-develop.14 → 14.5.0-develop.16
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/AutoComplete/AutoComplete.d.ts +4 -23
- package/AutoComplete/AutoComplete.js +1 -1
- package/AutoComplete/AutoComplete.mjs +206 -196
- package/AutoComplete/AutoCompleteProps.d.ts +12 -0
- package/ComboBox/ComboBox.d.ts +1 -1
- package/ComboBox/ComboBox.js +1 -1
- package/ComboBox/ComboBox.mjs +224 -224
- package/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +253 -252
- package/DropDownTree/DropDownTree.js +1 -1
- package/DropDownTree/DropDownTree.mjs +202 -196
- package/DropDownTree/DropDownTreeProps.d.ts +12 -0
- package/MultiSelect/MultiSelect.d.ts +2 -1
- package/MultiSelect/MultiSelect.js +1 -1
- package/MultiSelect/MultiSelect.mjs +182 -175
- package/MultiSelect/TagList.js +1 -1
- package/MultiSelect/TagList.mjs +1 -1
- package/MultiSelectTree/MultiSelectTree.js +1 -1
- package/MultiSelectTree/MultiSelectTree.mjs +237 -221
- package/MultiSelectTree/MultiSelectTreeProps.d.ts +12 -0
- package/common/ClearButton.js +1 -1
- package/common/ClearButton.mjs +6 -7
- package/common/List.d.ts +1 -0
- package/common/List.js +1 -1
- package/common/List.mjs +84 -81
- package/common/ListFilter.js +1 -1
- package/common/ListFilter.mjs +20 -17
- package/common/SearchBar.d.ts +1 -0
- package/common/SearchBar.js +1 -1
- package/common/SearchBar.mjs +7 -7
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/messages/index.d.ts +14 -4
- package/messages/index.js +1 -1
- package/messages/index.mjs +15 -11
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
|
@@ -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 Wt=require("react"),L=require("prop-types"),o=require("@progress/kendo-react-common"),_t=require("@progress/kendo-react-labels"),Ut=require("@progress/kendo-svg-icons"),Gt=require("../common/ListContainer.js"),jt=require("../common/ListFilter.js"),tt=require("../common/GroupStickyHeader.js"),$t=require("../common/ListDefaultItem.js"),Rt=require("../common/List.js"),rt=require("../common/DropDownBase.js"),d=require("../common/utils.js"),nt=require("../package-metadata.js"),Yt=require("@progress/kendo-react-buttons"),Jt=require("@progress/kendo-react-intl"),R=require("../messages/index.js"),Qt=require("@progress/kendo-react-layout"),Xt=require("../common/AdaptiveMode.js");function Zt(M){const Y=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(M){for(const O in M)if(O!=="default"){const re=Object.getOwnPropertyDescriptor(M,O);Object.defineProperty(Y,O,re.get?re:{enumerable:!0,get:()=>M[O]})}}return Y.default=M,Object.freeze(Y)}const a=Zt(Wt),en="Please select a value from the list!",fe=a.forwardRef((M,Y)=>{let O=!1;const re=o.getLicenseMessage(nt.packageMetadata),n=o.usePropsContext(ot,M),{delay:st=P.delay,tabIndex:at=P.tabIndex,ignoreCase:J=P.ignoreCase,size:T=P.size,rounded:Me=P.rounded,fillMode:ve=P.fillMode}=n;if(n.filterable||n.virtual){const e=[];n.filterable&&e.push("filterable"),n.virtual&&e.push("virtualization"),O=!o.validatePackage(nt.packageMetadata,{component:"DropDownList",features:e})}const E=o.useUnstyled(),ye=o.useId(n.id),De=()=>{var e;if(o.canUseDOM)return((e=V.current)==null?void 0:e.ownerDocument)||window.document},it=()=>{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 A.current!==void 0&&A.current!==null?e=A.current:n.value!==void 0?e=n.value:f.value!==void 0&&f.value!==null?e=f.value:n.defaultValue!==void 0&&n.defaultValue!==null&&(e=n.defaultValue),!d.isPresent(e)&&n.defaultItem!==void 0&&n.defaultItem!==null&&(e=n.defaultItem),e},lt=()=>{const{dataItemKey:e}=n,r=d.getFilteredData(n),s=k();return r.findIndex(c=>d.areSame(c,s,e))},he=()=>n.required!==void 0?n.required:P.required,Ie=()=>{const e=n.validationMessage!==void 0,r=k(),s=!he()||r!==null&&r!==""&&r!==void 0,c=n.valid!==void 0?n.valid:s;return{customError:e,valid:c,valueMissing:r===null}},dt=()=>n.validityStyles!==void 0?n.validityStyles:P.validityStyles,oe=e=>{se.current=!0,e.focus(),window.setTimeout(()=>se.current=!1,30)},we=()=>{X.current&&oe(X.current),n.adaptive&&setTimeout(()=>{X.current&&oe(X.current)},300)},ct=a.useCallback(e=>{for(const r of e)Ft(r.target.clientWidth)},[]),Oe=()=>{var e;(e=ke.current)!=null&&e.setCustomValidity&&ke.current.setCustomValidity(Ie().valid?"":n.validationMessage||en)},q=(e,r)=>{const s=k();d.areSame(s,e,n.dataItemKey)||(n.value===void 0&&(r.data.value=e),t.current.updateComponentArgs({value:e}),A.current=e,r.events.push({type:"onChange"}))},K=e=>{var r;(r=t==null?void 0:t.current)==null||r.applyState(e),A.current=void 0},Q=(e,r)=>{var m;const{virtual:s,dataItemKey:c,defaultItem:l}=n,p=d.getFilteredData(n),g=s?s.skip:0,v=k(),u=e===-1&&l!==void 0?l:p[e-g],y=!d.areSame(u,v,c);q(u,r),y&&((m=t==null?void 0:t.current)==null||m.triggerPageChangeCornerItems(u,r))},z=(e,r,s)=>{var C,D;const{defaultItem:c,dataItemKey:l,virtual:p={skip:0,total:0,pageSize:0}}=n,g=k(),v=d.getFilteredData(n),u=(C=t==null?void 0:t.current)==null?void 0:C.vs,y=v.findIndex(h=>d.areSame(h,g,l)),m=(D=t==null?void 0:t.current)==null?void 0:D.navigation.navigate({current:p.skip+y,max:(u!=null&&u.enabled?p.total:v.length)-1,min:c!==void 0?-1:0,keyCode:r,skipItems:s||void 0});m!==void 0&&Q(m,e),K(e)},ut=e=>{V.current=e,t.current.wrapper=e},pt=e=>a.createElement("select",{name:n.name,ref:r=>{ke.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})),Se=()=>{const{textField:e,dataItemKey:r,virtual:s={skip:0},focusedItemIndex:c=d.itemIndexStartsWith,filterable:l,skipDisabledItems:p=!0}=n,g=k(),v=d.getFilteredData(n),u=n.filter?n.filter:f.text;return p&&e&&!u&&!g?v.findIndex(y=>!y.disabled):d.isPresent(g)&&u===void 0||l&&u===""?v.findIndex(y=>d.areSame(y,g,r)):u?be.current?c(v,u,e):v.findIndex(y=>d.areSame(y,g,r)):s.skip===0?0:-1},Te=(e,r)=>r!==void 0&&r!==-1&&e&&e.length>0&&e[r].disabled,xe=()=>{const e=d.getFilteredData(n),r=t.current.initState(),s=Se();Te(e,s)&&(q(null,r),K(r))},Ce=e=>{if(e.isPropagationStopped())return;const r=t.current.initState();r.syntheticEvent=e,f.focused||(r.data.focused=!0),xe(),t.current.togglePopup(r),K(r)},qe=e=>{var N,me,U,ge,$,Ze,et;e&&e.target instanceof Element&&e.target.nodeName==="INPUT"&&e.stopPropagation&&e.stopPropagation();const{filterable:r,disabled:s,defaultItem:c,leftRightKeysNavigation:l=!0,virtual:p={skip:0,total:0,pageSize:0},dataItemKey:g,groupField:v="",textField:u,skipDisabledItems:y=!0}=n,m=d.getFilteredData(n),C=k(),D=m.findIndex(w=>d.areSame(w,C,g)),h=n.opened!==void 0?n.opened:f.opened,i=e.keyCode,F=i===o.Keys.home||i===o.Keys.end,b=i===o.Keys.up||i===o.Keys.down,j=!h&&(e.altKey&&i===o.Keys.down||i===o.Keys.enter||i===o.Keys.space),ne=h&&(e.altKey&&i===o.Keys.up||i===o.Keys.esc),ue=l&&(i===o.Keys.left||i===o.Keys.right),pe=b||ue&&!r||F,I=t.current.initState();if(I.syntheticEvent=e,!s){if(F&&((N=t==null?void 0:t.current)!=null&&N.vs.enabled))i===o.Keys.home?p.skip!==0?((me=t==null?void 0:t.current)==null||me.triggerOnPageChange(I,0,p.pageSize),B.current=!0):q(m[0],I):p.skip<p.total-p.pageSize?((U=t==null?void 0:t.current)==null||U.triggerOnPageChange(I,p.total-p.pageSize,p.pageSize),B.current=!0):q(m[m.length-1],I);else if(h&&i===o.Keys.pageUp)e.preventDefault(),(ge=t==null?void 0:t.current)==null||ge.scrollPopupByPageSize(-1);else if(h&&i===o.Keys.pageDown)e.preventDefault(),($=t==null?void 0:t.current)==null||$.scrollPopupByPageSize(1);else if(h&&i===o.Keys.enter){const w=Se();Te(m,w)?(q(null,I),K(I)):Q(w,I),(Ze=t==null?void 0:t.current)==null||Ze.togglePopup(I),e.preventDefault()}else if(j||ne)ne&&xe(),(et=t==null?void 0:t.current)==null||et.togglePopup(I),e.preventDefault();else if(pe){if(be.current=!1,v!==""&&u)if(!y&&h)z(I,i);else{let w;if(i===o.Keys.down||i===o.Keys.right){const S=m.slice(D+1).find(x=>!x.disabled);w=S&&m.indexOf(S)}else if(i===o.Keys.up||i===o.Keys.left){let S;if(D===0&&c)w=-1;else if(D===-1)S=m,w=m.findIndex(x=>!x.disabled);else{S=m.slice(0,D);let x=S.pop();for(;x&&x.disabled;)x=S.pop();w=x&&m.indexOf(x)}}if(w!==void 0){const S=w-D;z(I,i,S)}else w===void 0&&D===m.length-1&&z(I,i)}else if(!y&&h||F)z(I,i);else if(u){let w;if(i===o.Keys.down||i===o.Keys.right){const S=m.slice(D+1).find(x=>!x.disabled);w=S&&m.indexOf(S)}else if(i===o.Keys.up||i===o.Keys.left){let S;if(D===0&&c)w=-1;else if(D===-1)S=m,w=m.findIndex(x=>!x.disabled);else{S=m.slice(0,D);let x=S.pop();for(;x&&x.disabled;)x=S.pop();w=x&&m.indexOf(x)}}if(w!==void 0){const S=w-D;z(I,i,S)}else w===void 0&&D===m.length-1&&z(I,i)}else z(I,i);e.preventDefault()}K(I)}},mt=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),be.current=!0,K(r),ee({group:void 0,text:String(e.target.value)})},ze=e=>{const r=n.filter!==void 0?n.filter:f.text;return n.filterable&&a.createElement(jt,{value:r,ref:s=>{X.current=s&&s.element},onChange:mt,onKeyDown:qe,size:e?"large":T,rounded:Me,fillMode:ve,renderListFilterWrapper:!0,placeholder:We.toLanguageString(R.dropDownListAdaptiveFilterPlaceholder,R.messages[R.dropDownListAdaptiveFilterPlaceholder])})},gt=e=>{var s;const r=t.current.initState();r.syntheticEvent=e,(s=t==null?void 0:t.current)==null||s.togglePopup(r),q(n.defaultItem,r),K(r)},ft=()=>{const{textField:e,defaultItem:r,dataItemKey:s}=n,c=k();return r!==void 0&&a.createElement($t,{defaultItem:r,textField:e,selected:d.areSame(c,r,s),key:"defaultitemkey",onClick:gt})},vt=(e,r)=>{var s;(s=t==null?void 0:t.current)==null||s.handleItemClick(e,r),A.current=void 0},yt=e=>{const{vs:r,list:s}=t.current;r.scrollHandler(e);const{groupField:c}=n;let l=d.getFilteredData(n);if(!(!c||!l.length)&&c){const p=Be.current=Be.current||(r.enabled?r.itemHeight:s?s.children[0].offsetHeight:0),v=e.target.scrollTop-r.skip*p;l=t.current.getGroupedDataModernMode(l,c);let u=l[0][c];for(let y=1;y<l.length&&!(p*y>v);y++)l[y]&&l[y][c]&&(u=l[y][c]);u!==f.group&&ee({group:u})}},Ve=()=>{var i;const{textField:e,dataItemKey:r,virtual:s={skip:0,total:void 0},groupHeaderItemRender:c,listNoDataRender:l,itemRender:p}=n,g=d.getFilteredData(n),v=E&&E.uDropDownList,u=t.current.vs,y=s.skip,m=n.opened!==void 0?n.opened:f.opened,C=t.current.getPopupSettings(),D=`translateY(${u.translate}px)`,h=k();return a.createElement(Rt,{id:Fe,show:m,data:g.slice(),focusedIndex:Se(),value:h,textField:e,valueField:r,optionsGuid:Ge,groupField:n.groupField,listRef:F=>{u.list=t.current.list=F},wrapperStyle:{maxHeight:_?void 0:C.height},wrapperCssClass:o.classNames(o.uDropDownList.listContent({c:v})),listStyle:u.enabled?{transform:D}:void 0,key:"listkey",skip:y,onClick:vt,itemRender:p,groupHeaderItemRender:c,noDataRender:l,onScroll:yt,wrapperRef:u.scrollerRef,scroller:(i=t==null?void 0:t.current)==null?void 0:i.renderScrollElement(),ariaSetSize:s.total})},Dt=()=>{const{groupField:e}=n,r=d.getFilteredData(n),s=n.opened!==void 0?n.opened:f.opened,c=E&&E.uDropDownList,l={title:n.adaptiveTitle||n.label,subTitle:n.adaptiveSubtitle,expand:s,onClose:g=>Ce(g),windowWidth:Ee,mobileFilter:ze(!0)};let{group:p}=f;return p===void 0&&e!==void 0&&(p=d.getItemValue(r[0],e)),a.createElement(Xt.AdaptiveMode,{...l},a.createElement(Qt.ActionSheetContent,null,a.createElement("div",{className:o.classNames(o.uDropDownList.listContainer({c,popup:!1}))},St())))},ht=()=>{f.focused&&window.setTimeout(()=>{f.focused&&t.current.wrapper&&oe(t.current.wrapper)})},It=e=>{"onMouseDownOutside"in(n.popupSettings||{})&&n.popupSettings.onMouseDownOutside.call(void 0,e)},wt=()=>{const{header:e,footer:r,dir:s,groupField:c,groupStickyHeaderItemRender:l,list:p}=n,g=d.getFilteredData(n),v=t.current,u=v.getPopupSettings(),y=n.opened!==void 0?n.opened:f.opened,m=u.width!==void 0?u.width:v.popupWidth,C=E&&E.uDropDownList,D={dir:s!==void 0?s:v.dirCalculated,width:m,popupSettings:{...u,popupClass:o.classNames(u.popupClass,o.uDropDownList.listContainer({c:C,popup:!0})),anchor:u.anchor||V.current,show:y,onOpen:we,onClose:ht,onMouseDownOutside:It},itemsCount:[g.length]};let{group:h}=f;return h===void 0&&c!==void 0&&(h=d.getItemValue(g[0],c)),a.createElement(Gt,{...D},ze(!1),e&&a.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:C}))},e),a.createElement("div",{className:o.classNames(o.uDropDownList.list({c:C,size:T,virtual:t.current.vs.enabled}))},ft(),!p&&h&&g.length!==0&&a.createElement(tt,{group:h,render:l}),Ve()),r&&a.createElement("div",{className:o.classNames(o.uDropDownList.listFooter({c:C}))},r),O&&a.createElement(o.WatermarkOverlay,{message:re}))},St=()=>{const{header:e,footer:r,groupStickyHeaderItemRender:s,groupField:c,list:l}=n,p=d.getFilteredData(n),g=E&&E.uDropDownList;let{group:v}=f;return v===void 0&&c!==void 0&&(v=d.getItemValue(p[0],c)),a.createElement(a.Fragment,null,e&&a.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:g}))},e),a.createElement("div",{className:o.classNames("k-list",{[`k-list-${_?"lg":o.sizeMap[T]||T}`]:_||T})},!l&&v&&p.length!==0&&a.createElement(tt,{group:v,render:s}),Ve()),r&&a.createElement("div",{className:"k-list-footer"},r))},xt=e=>{const{dataItemKey:r}=n,s=d.getFilteredData(n),c=k();let l=s.map((b,j)=>({item:b,itemIndex:j}));const p=G.current.word,g=G.current.last,v=d.sameCharsOnly(p,g);let u=l.length,y=Math.max(0,s.findIndex(b=>d.areSame(b,c,r))),m;n.defaultItem&&(m={item:n.defaultItem,itemIndex:-1},u+=1,y+=1),y+=v?1:0,l=d.shuffleData(l,y,m);let C,D,h,i=0;const{textField:F}=n;for(;i<u;){if(C=d.getItemValue(l[i].item,F),D=v&&d.matchText(C,g,J),h=d.matchText(C,p,J),D||h){i=l[i].itemIndex;break}i++}if(i!==u){const b=t.current.initState();b.syntheticEvent=e,Q(i,b),K(b),A.current=void 0}},Ct=e=>{clearTimeout(Ae.current),n.filterable||(Ae.current=window.setTimeout(()=>G.current.word="",st),xt(e))},Lt=e=>{se.current||t.current.handleFocus(e)},kt=e=>{if(se.current||!f.focused)return;const r=n.opened!==void 0?n.opened:f.opened,s=t.current.initState();s.syntheticEvent=e,s.data.focused=!1,s.events.push({type:"onBlur"}),r&&xe(),r&&!_&&t.current.togglePopup(s),K(s)},bt=e=>{if(n.filterable||e.which===0||e.keyCode===o.Keys.enter)return;let r=String.fromCharCode(e.charCode||e.keyCode);J&&(r=r.toLowerCase()),r===" "&&e.preventDefault(),G.current={word:G.current.word+r,last:G.current.last+r},Ct(e)},Kt=()=>{const e=t.current.initState();e.data.opened=f.opened,t.current.togglePopup(e),K(e)},Le=a.useRef(null),V=a.useRef(null),ke=a.useRef(null),X=a.useRef(null);a.useImperativeHandle(Le,()=>({get element(){return V.current},get index(){return lt()},get name(){return n.name},get validity(){return Ie()},get value(){return k()},get focused(){return f.focused},get opened(){return f.opened},focus:it,props:n,togglePopup:Kt})),a.useImperativeHandle(Y,()=>Le.current),o.useWebMcpRegister("dropdownlist",Le,n,n.webMcp);const Ae=a.useRef(null),G=a.useRef({word:"",last:""}),se=a.useRef(!1),A=a.useRef(null),B=a.useRef(!1),be=a.useRef(!1),H=a.useRef({}),Ke=a.useRef({}),t=a.useRef(new rt({props:n,setState:()=>{},state:{},forceUpdate:()=>{},element:null,value:null,handleItemSelect:()=>{}})),Be=a.useRef(0),Z=a.useRef(null),[f,Et]=a.useState({}),[Ee,Ft]=a.useState(),[,He]=a.useReducer(e=>e,!0),We=Jt.useLocalization(),_e=n.name||n.id,Pt=a.useCallback(e=>{if(e==null||!t.current)return;const r=d.getFilteredData(n),{textField:s}=n,c=String(e),l=d.getItemIndexByText(r,c,s,!1,J),p=l!==-1?r[l]:void 0;if(p!==void 0){const g=t.current.initState();g.syntheticEvent={target:V.current},q(p,g),K(g)}},[n,J]);o.useKendoPaste(V,{fieldName:_e,onValueChange:Pt,enabled:!!_e});const ee=e=>{Et({...f,...e})};a.useEffect(()=>{t.current.updateComponentArgs({props:n,setState:ee,state:f,forceUpdate:He,element:V.current,handleItemSelect:Q,value:k()})},[ee,f,He,Q,k]),a.useEffect(()=>{var y,m,C,D,h,i,F,b,j,ne,ue,pe,I;const{dataItemKey:e,virtual:r,groupField:s="",textField:c}=n,l=d.getFilteredData(n),p=H.current.virtual?H.current.virtual.total:0,g=n.opened!==void 0?n.opened:f.opened,v=H.current.opened!==void 0?H.current.opened:Ke.current.opened,u=!v&&g;if((y=t==null?void 0:t.current)==null||y.didUpdate(),(m=t==null?void 0:t.current)!=null&&m.getPopupSettings().animate||u&&we(),r&&r.total!==p)(C=t==null?void 0:t.current)==null||C.vs.calcScrollElementHeight(),(D=t==null?void 0:t.current)==null||D.vs.reset();else{const N=k(),me=H.current.value!==void 0?H.current.value:Ke.current.value;let U=l.findIndex($=>d.areSame($,N,e));s!==""&&N&&c&&(U=(i=(h=t==null?void 0:t.current)==null?void 0:h.getGroupedDataModernMode(l,s))==null?void 0:i.map($=>$[c]).indexOf(N[c]));const ge=!d.areSame(me,N,e);u&&r?(F=t==null?void 0:t.current)==null||F.scrollToVirtualItem(r,U):u&&!r?(we(),l&&l.length!==0&&((b=t==null?void 0:t.current)==null||b.resetGroupStickyHeader(l[0][s],{setState:ee,group:f.group,state:f})),(j=t==null?void 0:t.current)==null||j.scrollToItem(U)):g&&v&&N&&ge&&!B.current?(ue=t==null?void 0:t.current)==null||ue.scrollToItem(U,(ne=t==null?void 0:t.current)==null?void 0:ne.vs.enabled):g&&v&&B.current&&(B.current&&r&&r.skip===0?(pe=t==null?void 0:t.current)==null||pe.vs.reset():B.current&&r&&r.skip===r.total-r.pageSize&&((I=t==null?void 0:t.current)==null||I.vs.scrollToEnd()))}B.current=!1,Ke.current=f,H.current=n,Oe()}),a.useEffect(()=>{var e,r;return Z.current=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(ct.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 s;(s=De())!=null&&s.body&&Z.current&&Z.current.disconnect()}},[]);const Ue=ye+"-accessibility-id",Fe=ye+"-listbox-id",Ge=ye+"-guid",Nt=We.toLanguageString(R.dropDownListArrowBtnAriaLabel,R.messages[R.dropDownListArrowBtnAriaLabel]),{style:ae,className:Mt,label:Pe,dir:Ot,virtual:W,adaptive:tn,dataItemKey:Tt,disabled:ie,loading:je,iconClassName:$e,svgIcon:qt,valueRender:Re}=n,le=n.opened!==void 0?n.opened:f.opened,de=k(),Ne=d.getItemValue(de,n.textField),Ye=!dt()||Ie().valid,ce=t.current,zt=ce.vs,te=E&&E.uDropDownList;zt.enabled=W!==void 0;const Je=o.useAdaptiveModeContext(),_=!!(Ee&&Je&&Ee<=Je.medium&&n.adaptive);W!==void 0&&(ce.vs.skip=W.skip,ce.vs.total=W.total,ce.vs.pageSize=W.pageSize);const Vt=d.getFilteredData(n),{focused:At}=f,Bt=Vt.findIndex(e=>d.areSame(e,de,Tt)),Qe=a.createElement("span",{id:Ue,className:o.classNames(o.uDropDownList.inputInner({c:te}))},Ne&&a.createElement("span",{className:o.classNames(o.uDropDownList.inputText({c:te}))},Ne)),Ht=Re!==void 0?Re.call(void 0,Qe,de):Qe,Xe=a.createElement(a.Fragment,null,a.createElement("span",{ref:ut,className:o.classNames(o.uDropDownList.wrapper({c:te,size:T,rounded:Me,fillMode:ve,focused:At,disabled:ie,invalid:!Ye,loading:je,required:he()}),Mt),style:Pe?{...ae,width:void 0}:ae,dir:Ot,onMouseDown:le?e=>{e.target.nodeName!=="INPUT"&&(oe(t.current.wrapper),e.preventDefault())}:void 0,onFocus:_?e=>Ce(e):Lt,onBlur:kt,tabIndex:o.getTabIndex(at,ie),accessKey:n.accessKey,onKeyDown:qe,onKeyPress:bt,onClick:ie?void 0:Ce,role:"combobox","aria-required":he(),"aria-disabled":ie||void 0,"aria-haspopup":"listbox","aria-expanded":le||!1,"aria-owns":Fe,"aria-activedescendant":le?"option-"+Ge+"-"+(Bt+(W?W.skip:0)):void 0,"aria-label":n.ariaLabel||n.label,"aria-labelledby":n.ariaLabelledBy,"aria-describedby":n.ariaDescribedBy||Ue,"aria-controls":le?Fe:void 0,id:n.id,title:n.title},Ht,je&&a.createElement(o.IconWrap,{className:o.classNames(o.uDropDownList.loadingIcon({c:te})),name:"loading"}),a.createElement(Yt.Button,{tabIndex:-1,type:"button","aria-label":Nt,size:T,fillMode:ve,className:o.classNames(o.uDropDownList.inputButton({c:te})),iconClass:$e,svgIcon:$e?void 0:qt||Ut.chevronDownIcon,onMouseDown:e=>f.focused&&e.preventDefault()}),pt(de),!_&&wt()),_&&Dt());return Pe?a.createElement(_t.FloatingLabel,{label:Pe,editorValue:Ne,editorValid:Ye,editorDisabled:n.disabled,style:{width:ae?ae.width:void 0},children:Xe}):Xe});fe.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,...rt.defaultProps,required:!1,size:void 0,rounded:void 0,fillMode:void 0};fe.displayName="KendoReactDropDownList";const ot=o.createPropsContext();fe.displayName="KendoReactDropDownList";exports.DropDownList=fe;exports.DropDownListPropsContext=ot;exports.dropDownListDefaultProps=P;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Gt=require("react"),L=require("prop-types"),o=require("@progress/kendo-react-common"),jt=require("@progress/kendo-react-labels"),$t=require("@progress/kendo-svg-icons"),Rt=require("../common/ListContainer.js"),Yt=require("../common/ListFilter.js"),rt=require("../common/GroupStickyHeader.js"),Jt=require("../common/ListDefaultItem.js"),Qt=require("../common/List.js"),st=require("../common/DropDownBase.js"),d=require("../common/utils.js"),ot=require("../package-metadata.js"),Xt=require("@progress/kendo-react-buttons"),Zt=require("@progress/kendo-react-intl"),P=require("../messages/index.js"),en=require("@progress/kendo-react-layout"),tn=require("../common/AdaptiveMode.js");function nn(T){const Y=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(T){for(const q in T)if(q!=="default"){const oe=Object.getOwnPropertyDescriptor(T,q);Object.defineProperty(Y,q,oe.get?oe:{enumerable:!0,get:()=>T[q]})}}return Y.default=T,Object.freeze(Y)}const a=nn(Gt),rn="Please select a value from the list!",fe=a.forwardRef((T,Y)=>{var et;let q=!1;const oe=o.getLicenseMessage(ot.packageMetadata),n=o.usePropsContext(at,T),{delay:it=N.delay,tabIndex:lt=N.tabIndex,ignoreCase:J=N.ignoreCase,size:z=N.size,rounded:Me=N.rounded,fillMode:ve=N.fillMode}=n;if(n.filterable||n.virtual){const e=[];n.filterable&&e.push("filterable"),n.virtual&&e.push("virtualization"),q=!o.validatePackage(ot.packageMetadata,{component:"DropDownList",features:e})}const E=o.useUnstyled(),ye=o.useId(n.id),De=()=>{var e;if(o.canUseDOM)return((e=B.current)==null?void 0:e.ownerDocument)||window.document},dt=()=>{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 H.current!==void 0&&H.current!==null?e=H.current:n.value!==void 0?e=n.value:f.value!==void 0&&f.value!==null?e=f.value:n.defaultValue!==void 0&&n.defaultValue!==null&&(e=n.defaultValue),!d.isPresent(e)&&n.defaultItem!==void 0&&n.defaultItem!==null&&(e=n.defaultItem),e},ct=()=>{const{dataItemKey:e}=n,r=d.getFilteredData(n),s=k();return r.findIndex(c=>d.areSame(c,s,e))},Ie=()=>n.required!==void 0?n.required:N.required,he=()=>{const e=n.validationMessage!==void 0,r=k(),s=!Ie()||r!==null&&r!==""&&r!==void 0,c=n.valid!==void 0?n.valid:s;return{customError:e,valid:c,valueMissing:r===null}},ut=()=>n.validityStyles!==void 0?n.validityStyles:N.validityStyles,se=e=>{ae.current=!0,e.focus(),window.setTimeout(()=>ae.current=!1,30)},we=()=>{X.current&&se(X.current),n.adaptive&&setTimeout(()=>{X.current&&se(X.current)},300)},pt=a.useCallback(e=>{for(const r of e)Nt(r.target.clientWidth)},[]),Oe=()=>{var e;(e=ke.current)!=null&&e.setCustomValidity&&ke.current.setCustomValidity(he().valid?"":n.validationMessage||rn)},A=(e,r)=>{const s=k();d.areSame(s,e,n.dataItemKey)||(n.value===void 0&&(r.data.value=e),t.current.updateComponentArgs({value:e}),H.current=e,r.events.push({type:"onChange"}))},K=e=>{var r;(r=t==null?void 0:t.current)==null||r.applyState(e),H.current=void 0},Q=(e,r)=>{var m;const{virtual:s,dataItemKey:c,defaultItem:l}=n,p=d.getFilteredData(n),g=s?s.skip:0,v=k(),u=e===-1&&l!==void 0?l:p[e-g],y=!d.areSame(u,v,c);A(u,r),y&&((m=t==null?void 0:t.current)==null||m.triggerPageChangeCornerItems(u,r))},V=(e,r,s)=>{var C,D;const{defaultItem:c,dataItemKey:l,virtual:p={skip:0,total:0,pageSize:0}}=n,g=k(),v=d.getFilteredData(n),u=(C=t==null?void 0:t.current)==null?void 0:C.vs,y=v.findIndex(I=>d.areSame(I,g,l)),m=(D=t==null?void 0:t.current)==null?void 0:D.navigation.navigate({current:p.skip+y,max:(u!=null&&u.enabled?p.total:v.length)-1,min:c!==void 0?-1:0,keyCode:r,skipItems:s||void 0});m!==void 0&&Q(m,e),K(e)},mt=e=>{B.current=e,t.current.wrapper=e},gt=e=>a.createElement("select",{name:n.name,ref:r=>{ke.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})),Se=()=>{const{textField:e,dataItemKey:r,virtual:s={skip:0},focusedItemIndex:c=d.itemIndexStartsWith,filterable:l,skipDisabledItems:p=!0}=n,g=k(),v=d.getFilteredData(n),u=n.filter?n.filter:f.text;return p&&e&&!u&&!g?v.findIndex(y=>!y.disabled):d.isPresent(g)&&u===void 0||l&&u===""?v.findIndex(y=>d.areSame(y,g,r)):u?be.current?c(v,u,e):v.findIndex(y=>d.areSame(y,g,r)):s.skip===0?0:-1},Te=(e,r)=>r!==void 0&&r!==-1&&e&&e.length>0&&e[r].disabled,xe=()=>{const e=d.getFilteredData(n),r=t.current.initState(),s=Se();Te(e,s)&&(A(null,r),K(r))},Ce=e=>{if(e.isPropagationStopped())return;const r=t.current.initState();r.syntheticEvent=e,f.focused||(r.data.focused=!0),xe(),t.current.togglePopup(r),K(r)},qe=e=>{var O,me,G,ge,R,tt,nt;e&&e.target instanceof Element&&e.target.nodeName==="INPUT"&&e.stopPropagation&&e.stopPropagation();const{filterable:r,disabled:s,defaultItem:c,leftRightKeysNavigation:l=!0,virtual:p={skip:0,total:0,pageSize:0},dataItemKey:g,groupField:v="",textField:u,skipDisabledItems:y=!0}=n,m=d.getFilteredData(n),C=k(),D=m.findIndex(w=>d.areSame(w,C,g)),I=n.opened!==void 0?n.opened:f.opened,i=e.keyCode,F=i===o.Keys.home||i===o.Keys.end,b=i===o.Keys.up||i===o.Keys.down,$=!I&&(e.altKey&&i===o.Keys.down||i===o.Keys.enter||i===o.Keys.space),re=I&&(e.altKey&&i===o.Keys.up||i===o.Keys.esc),ue=l&&(i===o.Keys.left||i===o.Keys.right),pe=b||ue&&!r||F,h=t.current.initState();if(h.syntheticEvent=e,!s){if(F&&((O=t==null?void 0:t.current)!=null&&O.vs.enabled))i===o.Keys.home?p.skip!==0?((me=t==null?void 0:t.current)==null||me.triggerOnPageChange(h,0,p.pageSize),W.current=!0):A(m[0],h):p.skip<p.total-p.pageSize?((G=t==null?void 0:t.current)==null||G.triggerOnPageChange(h,p.total-p.pageSize,p.pageSize),W.current=!0):A(m[m.length-1],h);else if(I&&i===o.Keys.pageUp)e.preventDefault(),(ge=t==null?void 0:t.current)==null||ge.scrollPopupByPageSize(-1);else if(I&&i===o.Keys.pageDown)e.preventDefault(),(R=t==null?void 0:t.current)==null||R.scrollPopupByPageSize(1);else if(I&&i===o.Keys.enter){const w=Se();Te(m,w)?(A(null,h),K(h)):Q(w,h),(tt=t==null?void 0:t.current)==null||tt.togglePopup(h),e.preventDefault()}else if($||re)re&&xe(),(nt=t==null?void 0:t.current)==null||nt.togglePopup(h),e.preventDefault();else if(pe){if(be.current=!1,v!==""&&u)if(!y&&I)V(h,i);else{let w;if(i===o.Keys.down||i===o.Keys.right){const S=m.slice(D+1).find(x=>!x.disabled);w=S&&m.indexOf(S)}else if(i===o.Keys.up||i===o.Keys.left){let S;if(D===0&&c)w=-1;else if(D===-1)S=m,w=m.findIndex(x=>!x.disabled);else{S=m.slice(0,D);let x=S.pop();for(;x&&x.disabled;)x=S.pop();w=x&&m.indexOf(x)}}if(w!==void 0){const S=w-D;V(h,i,S)}else w===void 0&&D===m.length-1&&V(h,i)}else if(!y&&I||F)V(h,i);else if(u){let w;if(i===o.Keys.down||i===o.Keys.right){const S=m.slice(D+1).find(x=>!x.disabled);w=S&&m.indexOf(S)}else if(i===o.Keys.up||i===o.Keys.left){let S;if(D===0&&c)w=-1;else if(D===-1)S=m,w=m.findIndex(x=>!x.disabled);else{S=m.slice(0,D);let x=S.pop();for(;x&&x.disabled;)x=S.pop();w=x&&m.indexOf(x)}}if(w!==void 0){const S=w-D;V(h,i,S)}else w===void 0&&D===m.length-1&&V(h,i)}else V(h,i);e.preventDefault()}K(h)}},ft=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),be.current=!0,K(r),ee({group:void 0,text:String(e.target.value)})},ze=e=>{const r=n.filter!==void 0?n.filter:f.text;return n.filterable&&a.createElement(Yt,{value:r,ref:s=>{X.current=s&&s.element},onChange:ft,onKeyDown:qe,size:e?"large":z,rounded:Me,fillMode:ve,renderListFilterWrapper:!0,placeholder:Fe.toLanguageString(P.dropDownListAdaptiveFilterPlaceholder,P.messages[P.dropDownListAdaptiveFilterPlaceholder])})},vt=e=>{var s;const r=t.current.initState();r.syntheticEvent=e,(s=t==null?void 0:t.current)==null||s.togglePopup(r),A(n.defaultItem,r),K(r)},yt=()=>{const{textField:e,defaultItem:r,dataItemKey:s}=n,c=k();return r!==void 0&&a.createElement(Jt,{defaultItem:r,textField:e,selected:d.areSame(c,r,s),key:"defaultitemkey",onClick:vt})},Dt=(e,r)=>{var s;(s=t==null?void 0:t.current)==null||s.handleItemClick(e,r),H.current=void 0},It=e=>{const{vs:r,list:s}=t.current;r.scrollHandler(e);const{groupField:c}=n;let l=d.getFilteredData(n);if(!(!c||!l.length)&&c){const p=Be.current=Be.current||(r.enabled?r.itemHeight:s?s.children[0].offsetHeight:0),v=e.target.scrollTop-r.skip*p;l=t.current.getGroupedDataModernMode(l,c);let u=l[0][c];for(let y=1;y<l.length&&!(p*y>v);y++)l[y]&&l[y][c]&&(u=l[y][c]);u!==f.group&&ee({group:u})}},Ae=()=>{var i;const{textField:e,dataItemKey:r,virtual:s={skip:0,total:void 0},groupHeaderItemRender:c,listNoDataRender:l,itemRender:p}=n,g=d.getFilteredData(n),v=E&&E.uDropDownList,u=t.current.vs,y=s.skip,m=n.opened!==void 0?n.opened:f.opened,C=t.current.getPopupSettings(),D=`translateY(${u.translate}px)`,I=k();return a.createElement(Qt,{id:Ue,show:m,data:g.slice(),focusedIndex:Se(),value:I,textField:e,valueField:r,optionsGuid:Ge,groupField:n.groupField,ariaLabel:Fe.toLanguageString(P.listAriaLabel,P.messages[P.listAriaLabel]),listRef:F=>{u.list=t.current.list=F},wrapperStyle:{maxHeight:U?void 0:C.height},wrapperCssClass:o.classNames(o.uDropDownList.listContent({c:v})),listStyle:u.enabled?{transform:D}:void 0,key:"listkey",skip:y,onClick:Dt,itemRender:p,groupHeaderItemRender:c,noDataRender:l,onScroll:It,wrapperRef:u.scrollerRef,scroller:(i=t==null?void 0:t.current)==null?void 0:i.renderScrollElement(),ariaSetSize:s.total})},ht=()=>{const{groupField:e}=n,r=d.getFilteredData(n),s=n.opened!==void 0?n.opened:f.opened,c=E&&E.uDropDownList,l={title:n.adaptiveTitle||n.label,subTitle:n.adaptiveSubtitle,expand:s,onClose:g=>Ce(g),windowWidth:Ee,mobileFilter:ze(!0)};let{group:p}=f;return p===void 0&&e!==void 0&&(p=d.getItemValue(r[0],e)),a.createElement(tn.AdaptiveMode,{...l},a.createElement(en.ActionSheetContent,null,a.createElement("div",{className:o.classNames(o.uDropDownList.listContainer({c,popup:!1}))},Ct())))},wt=()=>{f.focused&&window.setTimeout(()=>{f.focused&&t.current.wrapper&&se(t.current.wrapper)})},St=e=>{"onMouseDownOutside"in(n.popupSettings||{})&&n.popupSettings.onMouseDownOutside.call(void 0,e)},xt=()=>{const{header:e,footer:r,dir:s,groupField:c,groupStickyHeaderItemRender:l,list:p}=n,g=d.getFilteredData(n),v=t.current,u=v.getPopupSettings(),y=n.opened!==void 0?n.opened:f.opened,m=u.width!==void 0?u.width:v.popupWidth,C=E&&E.uDropDownList,D={dir:s!==void 0?s:v.dirCalculated,width:m,popupSettings:{...u,popupClass:o.classNames(u.popupClass,o.uDropDownList.listContainer({c:C,popup:!0})),anchor:u.anchor||B.current,show:y,onOpen:we,onClose:wt,onMouseDownOutside:St},itemsCount:[g.length]};let{group:I}=f;return I===void 0&&c!==void 0&&(I=d.getItemValue(g[0],c)),a.createElement(Rt,{...D},ze(!1),e&&a.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:C}))},e),a.createElement("div",{className:o.classNames(o.uDropDownList.list({c:C,size:z,virtual:t.current.vs.enabled}))},yt(),!p&&I&&g.length!==0&&a.createElement(rt,{group:I,render:l}),Ae()),r&&a.createElement("div",{className:o.classNames(o.uDropDownList.listFooter({c:C}))},r),q&&a.createElement(o.WatermarkOverlay,{message:oe}))},Ct=()=>{const{header:e,footer:r,groupStickyHeaderItemRender:s,groupField:c,list:l}=n,p=d.getFilteredData(n),g=E&&E.uDropDownList;let{group:v}=f;return v===void 0&&c!==void 0&&(v=d.getItemValue(p[0],c)),a.createElement(a.Fragment,null,e&&a.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:g}))},e),a.createElement("div",{className:o.classNames("k-list",{[`k-list-${U?"lg":o.sizeMap[z]||z}`]:U||z})},!l&&v&&p.length!==0&&a.createElement(rt,{group:v,render:s}),Ae()),r&&a.createElement("div",{className:"k-list-footer"},r))},Lt=e=>{const{dataItemKey:r}=n,s=d.getFilteredData(n),c=k();let l=s.map((b,$)=>({item:b,itemIndex:$}));const p=j.current.word,g=j.current.last,v=d.sameCharsOnly(p,g);let u=l.length,y=Math.max(0,s.findIndex(b=>d.areSame(b,c,r))),m;n.defaultItem&&(m={item:n.defaultItem,itemIndex:-1},u+=1,y+=1),y+=v?1:0,l=d.shuffleData(l,y,m);let C,D,I,i=0;const{textField:F}=n;for(;i<u;){if(C=d.getItemValue(l[i].item,F),D=v&&d.matchText(C,g,J),I=d.matchText(C,p,J),D||I){i=l[i].itemIndex;break}i++}if(i!==u){const b=t.current.initState();b.syntheticEvent=e,Q(i,b),K(b),H.current=void 0}},kt=e=>{clearTimeout(Ve.current),n.filterable||(Ve.current=window.setTimeout(()=>j.current.word="",it),Lt(e))},bt=e=>{ae.current||t.current.handleFocus(e)},Kt=e=>{if(ae.current||!f.focused)return;const r=n.opened!==void 0?n.opened:f.opened,s=t.current.initState();s.syntheticEvent=e,s.data.focused=!1,s.events.push({type:"onBlur"}),r&&xe(),r&&!U&&t.current.togglePopup(s),K(s)},Et=e=>{if(n.filterable||e.which===0||e.keyCode===o.Keys.enter)return;let r=String.fromCharCode(e.charCode||e.keyCode);J&&(r=r.toLowerCase()),r===" "&&e.preventDefault(),j.current={word:j.current.word+r,last:j.current.last+r},kt(e)},Ft=()=>{const e=t.current.initState();e.data.opened=f.opened,t.current.togglePopup(e),K(e)},Le=a.useRef(null),B=a.useRef(null),ke=a.useRef(null),X=a.useRef(null);a.useImperativeHandle(Le,()=>({get element(){return B.current},get index(){return ct()},get name(){return n.name},get validity(){return he()},get value(){return k()},get focused(){return f.focused},get opened(){return f.opened},focus:dt,props:n,togglePopup:Ft})),a.useImperativeHandle(Y,()=>Le.current),o.useWebMcpRegister("dropdownlist",Le,n,n.webMcp);const Ve=a.useRef(null),j=a.useRef({word:"",last:""}),ae=a.useRef(!1),H=a.useRef(null),W=a.useRef(!1),be=a.useRef(!1),_=a.useRef({}),Ke=a.useRef({}),t=a.useRef(new st({props:n,setState:()=>{},state:{},forceUpdate:()=>{},element:null,value:null,handleItemSelect:()=>{}})),Be=a.useRef(0),Z=a.useRef(null),[f,Pt]=a.useState({}),[Ee,Nt]=a.useState(),[,He]=a.useReducer(e=>e,!0),Fe=Zt.useLocalization(),We=n.name||n.id,Mt=a.useCallback(e=>{if(e==null||!t.current)return;const r=d.getFilteredData(n),{textField:s}=n,c=String(e),l=d.getItemIndexByText(r,c,s,!1,J),p=l!==-1?r[l]:void 0;if(p!==void 0){const g=t.current.initState();g.syntheticEvent={target:B.current},A(p,g),K(g)}},[n,J]);o.useKendoPaste(B,{fieldName:We,onValueChange:Mt,enabled:!!We});const ee=e=>{Pt({...f,...e})};a.useEffect(()=>{t.current.updateComponentArgs({props:n,setState:ee,state:f,forceUpdate:He,element:B.current,handleItemSelect:Q,value:k()})},[ee,f,He,Q,k]),a.useEffect(()=>{var y,m,C,D,I,i,F,b,$,re,ue,pe,h;const{dataItemKey:e,virtual:r,groupField:s="",textField:c}=n,l=d.getFilteredData(n),p=_.current.virtual?_.current.virtual.total:0,g=n.opened!==void 0?n.opened:f.opened,v=_.current.opened!==void 0?_.current.opened:Ke.current.opened,u=!v&&g;if((y=t==null?void 0:t.current)==null||y.didUpdate(),(m=t==null?void 0:t.current)!=null&&m.getPopupSettings().animate||u&&we(),r&&r.total!==p)(C=t==null?void 0:t.current)==null||C.vs.calcScrollElementHeight(),(D=t==null?void 0:t.current)==null||D.vs.reset();else{const O=k(),me=_.current.value!==void 0?_.current.value:Ke.current.value;let G=l.findIndex(R=>d.areSame(R,O,e));s!==""&&O&&c&&(G=(i=(I=t==null?void 0:t.current)==null?void 0:I.getGroupedDataModernMode(l,s))==null?void 0:i.map(R=>R[c]).indexOf(O[c]));const ge=!d.areSame(me,O,e);u&&r?(F=t==null?void 0:t.current)==null||F.scrollToVirtualItem(r,G):u&&!r?(we(),l&&l.length!==0&&((b=t==null?void 0:t.current)==null||b.resetGroupStickyHeader(l[0][s],{setState:ee,group:f.group,state:f})),($=t==null?void 0:t.current)==null||$.scrollToItem(G)):g&&v&&O&&ge&&!W.current?(ue=t==null?void 0:t.current)==null||ue.scrollToItem(G,(re=t==null?void 0:t.current)==null?void 0:re.vs.enabled):g&&v&&W.current&&(W.current&&r&&r.skip===0?(pe=t==null?void 0:t.current)==null||pe.vs.reset():W.current&&r&&r.skip===r.total-r.pageSize&&((h=t==null?void 0:t.current)==null||h.vs.scrollToEnd()))}W.current=!1,Ke.current=f,_.current=n,Oe()}),a.useEffect(()=>{var e,r;return Z.current=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(pt.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 s;(s=De())!=null&&s.body&&Z.current&&Z.current.disconnect()}},[]);const _e=ye+"-accessibility-id",Ue=ye+"-listbox-id",Ge=ye+"-guid",Ot=Fe.toLanguageString(P.dropDownListArrowBtnAriaLabel,P.messages[P.dropDownListArrowBtnAriaLabel]),{style:ie,className:Tt,label:Pe,dir:qt,virtual:M,adaptive:on,dataItemKey:zt,disabled:le,loading:je,iconClassName:$e,svgIcon:At,valueRender:Re}=n,te=n.opened!==void 0?n.opened:f.opened,de=k(),Ne=d.getItemValue(de,n.textField),Ye=!ut()||he().valid,ce=t.current,Vt=ce.vs,ne=E&&E.uDropDownList;Vt.enabled=M!==void 0;const Je=o.useAdaptiveModeContext(),U=!!(Ee&&Je&&Ee<=Je.medium&&n.adaptive);M!==void 0&&(ce.vs.skip=M.skip,ce.vs.total=M.total,ce.vs.pageSize=M.pageSize);const Bt=d.getFilteredData(n),{focused:Ht}=f,Qe=Bt.findIndex(e=>d.areSame(e,de,zt)),Wt=(et=M==null?void 0:M.skip)!=null?et:0,_t=te&&Qe>=0?`k-${Ge}-item-${Qe+Wt+1}`:void 0,Xe=a.createElement("span",{id:_e,className:o.classNames(o.uDropDownList.inputInner({c:ne}))},Ne&&a.createElement("span",{className:o.classNames(o.uDropDownList.inputText({c:ne}))},Ne)),Ut=Re!==void 0?Re.call(void 0,Xe,de):Xe,Ze=a.createElement(a.Fragment,null,a.createElement("span",{ref:mt,className:o.classNames(o.uDropDownList.wrapper({c:ne,size:z,rounded:Me,fillMode:ve,focused:Ht,disabled:le,invalid:!Ye,loading:je,required:Ie()}),Tt),style:Pe?{...ie,width:void 0}:ie,dir:qt,onMouseDown:te?e=>{e.target.nodeName!=="INPUT"&&(se(t.current.wrapper),e.preventDefault())}:void 0,onFocus:U?e=>Ce(e):bt,onBlur:Kt,tabIndex:o.getTabIndex(lt,le),accessKey:n.accessKey,onKeyDown:qe,onKeyPress:Et,onClick:le?void 0:Ce,role:"combobox","aria-required":Ie()||void 0,"aria-disabled":le||void 0,"aria-haspopup":"listbox","aria-expanded":te||!1,"aria-activedescendant":_t,"aria-label":n.ariaLabel||n.label,"aria-labelledby":n.ariaLabelledBy,"aria-describedby":n.ariaDescribedBy||(te?_e:void 0),"aria-controls":te?Ue:void 0,id:n.id,title:n.title},Ut,je&&a.createElement(o.IconWrap,{className:o.classNames(o.uDropDownList.loadingIcon({c:ne})),name:"loading"}),a.createElement(Xt.Button,{tabIndex:-1,type:"button","aria-label":Ot,size:z,fillMode:ve,className:o.classNames(o.uDropDownList.inputButton({c:ne})),iconClass:$e,svgIcon:$e?void 0:At||$t.chevronDownIcon,onMouseDown:e=>f.focused&&e.preventDefault()}),gt(de),!U&&xt()),U&&ht());return Pe?a.createElement(jt.FloatingLabel,{label:Pe,editorValue:Ne,editorValid:Ye,editorDisabled:n.disabled,style:{width:ie?ie.width:void 0},children:Ze}):Ze});fe.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 N={delay:500,tabIndex:0,ignoreCase:!0,...st.defaultProps,required:!1,size:void 0,rounded:void 0,fillMode:void 0};fe.displayName="KendoReactDropDownList";const at=o.createPropsContext();fe.displayName="KendoReactDropDownList";exports.DropDownList=fe;exports.DropDownListPropsContext=at;exports.dropDownListDefaultProps=N;
|