@progress/kendo-react-dropdowns 13.3.0 → 13.4.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.
- package/AutoComplete/AutoComplete.d.ts +274 -0
- package/AutoComplete/AutoComplete.js +1 -1
- package/AutoComplete/AutoComplete.mjs +67 -69
- package/AutoComplete/AutoCompleteProps.d.ts +509 -0
- package/ComboBox/ComboBox.d.ts +279 -0
- package/ComboBox/ComboBox.js +1 -1
- package/ComboBox/ComboBox.mjs +281 -297
- package/ComboBox/ComboBoxProps.d.ts +632 -0
- package/DropDownList/DropDownList.d.ts +41 -0
- package/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +78 -83
- package/DropDownList/DropDownListProps.d.ts +594 -0
- package/DropDownList/models/index.d.ts +54 -0
- package/DropDownTree/DropDownTree.d.ts +76 -0
- package/DropDownTree/DropDownTree.js +1 -1
- package/DropDownTree/DropDownTree.mjs +6 -8
- package/DropDownTree/DropDownTreeProps.d.ts +506 -0
- package/DropDownTree/ListNoData.d.ts +13 -0
- package/DropDownTree/useDropdownWidth.d.ts +13 -0
- package/MultiColumnComboBox/MultiColumnComboBox.d.ts +299 -0
- package/MultiColumnComboBox/MultiColumnComboBox.js +1 -1
- package/MultiColumnComboBox/MultiColumnComboBox.mjs +45 -48
- package/MultiSelect/MultiSelect.d.ts +281 -0
- package/MultiSelect/MultiSelect.js +1 -1
- package/MultiSelect/MultiSelect.mjs +13 -15
- package/MultiSelect/MultiSelectProps.d.ts +592 -0
- package/MultiSelect/TagList.d.ts +45 -0
- package/MultiSelectTree/MultiSelectTree.d.ts +87 -0
- package/MultiSelectTree/MultiSelectTree.js +1 -1
- package/MultiSelectTree/MultiSelectTree.mjs +7 -7
- package/MultiSelectTree/MultiSelectTreeProps.d.ts +554 -0
- package/MultiSelectTree/utils.d.ts +24 -0
- package/common/AdaptiveMode.d.ts +22 -0
- package/common/ClearButton.d.ts +19 -0
- package/common/DropDownBase.d.ts +186 -0
- package/common/DropDownBase.js +1 -1
- package/common/DropDownBase.mjs +1 -1
- package/common/GroupStickyHeader.d.ts +26 -0
- package/common/GroupStickyHeader.js +1 -1
- package/common/GroupStickyHeader.mjs +6 -6
- package/common/List.d.ts +54 -0
- package/common/List.js +1 -1
- package/common/List.mjs +129 -77
- package/common/ListContainer.d.ts +24 -0
- package/common/ListDefaultItem.d.ts +22 -0
- package/common/ListFilter.d.ts +29 -0
- package/common/ListFilter.js +1 -1
- package/common/ListFilter.mjs +12 -12
- package/common/ListGroupItem.d.ts +54 -0
- package/common/ListGroupItem.js +1 -1
- package/common/ListGroupItem.mjs +21 -13
- package/common/ListItem.d.ts +87 -0
- package/common/ListItem.js +1 -1
- package/common/ListItem.mjs +62 -21
- package/common/ListItemIcon.d.ts +26 -0
- package/common/ListItemIcon.js +8 -0
- package/common/ListItemIcon.mjs +21 -0
- package/common/MultiColumnList.d.ts +13 -0
- package/common/Navigation.d.ts +20 -0
- package/common/SearchBar.d.ts +55 -0
- package/common/VirtualScrollStatic.d.ts +44 -0
- package/common/events.d.ts +82 -0
- package/common/filterDescriptor.d.ts +48 -0
- package/common/settings.d.ts +112 -0
- package/common/utils.d.ts +82 -0
- package/common/utils.js +1 -1
- package/common/utils.mjs +50 -47
- package/common/withCustomComponent.d.ts +12 -0
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/index.d.mts +28 -5545
- package/index.d.ts +28 -5545
- package/messages/index.d.ts +52 -0
- package/package-metadata.d.ts +12 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +10 -16
- 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 Bt=require("react"),L=require("prop-types"),o=require("@progress/kendo-react-common"),Wt=require("@progress/kendo-react-labels"),_t=require("@progress/kendo-svg-icons"),Ut=require("../common/ListContainer.js"),Gt=require("../common/ListFilter.js"),tt=require("../common/GroupStickyHeader.js"),jt=require("../common/ListDefaultItem.js"),$t=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"),$=require("../messages/index.js"),Qt=require("@progress/kendo-react-layout"),Rt=require("../common/AdaptiveMode.js");function Xt(N){const Y=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(N){for(const T in N)if(T!=="default"){const ne=Object.getOwnPropertyDescriptor(N,T);Object.defineProperty(Y,T,ne.get?ne:{enumerable:!0,get:()=>N[T]})}}return Y.default=N,Object.freeze(Y)}const i=Xt(Bt),Zt="Please select a value from the list!",me=i.forwardRef((N,Y)=>{let T=!1;const ne=o.getLicenseMessage(nt.packageMetadata),n=o.usePropsContext(ot,N),{delay:st=P.delay,tabIndex:at=P.tabIndex,ignoreCase:ge=P.ignoreCase,size:O=P.size,rounded:Ne=P.rounded,fillMode:fe=P.fillMode,groupMode:en=P.groupMode}=n;if(n.filterable||n.virtual){const e=[];n.filterable&&e.push("filterable"),n.virtual&&e.push("virtualization"),T=!o.validatePackage(nt.packageMetadata,{component:"DropDownList",features:e})}const b=o.useUnstyled(),ve=o.useId(n.id),ye=()=>{var e;if(o.canUseDOM)return((e=Q.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 z.current!==void 0&&z.current!==null?e=z.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),!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))},De=()=>n.required!==void 0?n.required:P.required,Ie=()=>{const e=n.validationMessage!==void 0,r=k(),s=!De()||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,re=e=>{oe.current=!0,e.focus(),window.setTimeout(()=>oe.current=!1,30)},we=()=>{R.current&&re(R.current),n.adaptive&&setTimeout(()=>{R.current&&re(R.current)},300)},ct=i.useCallback(e=>{for(const r of e)Ft(r.target.clientWidth)},[]),Te=()=>{var e;(e=Ce.current)!=null&&e.setCustomValidity&&Ce.current.setCustomValidity(Ie().valid?"":n.validationMessage||Zt)},W=(e,r)=>{const s=k();d.areSame(s,e,n.dataItemKey)||(n.value===void 0&&(r.data.value=e),t.current.updateComponentArgs({value:e}),z.current=e,r.events.push({type:"onChange"}))},E=e=>{var r;(r=t==null?void 0:t.current)==null||r.applyState(e),z.current=void 0},J=(e,r)=>{var p;const{virtual:s,dataItemKey:c,defaultItem:u}=n,m=d.getFilteredData(n),y=s?s.skip:0,f=k(),a=e===-1&&u!==void 0?u:m[e-y],v=!d.areSame(a,f,c);W(a,r),v&&((p=t==null?void 0:t.current)==null||p.triggerPageChangeCornerItems(a,r))},q=(e,r,s)=>{var x,I;const{defaultItem:c,dataItemKey:u,virtual:m={skip:0,total:0,pageSize:0}}=n,y=k(),f=d.getFilteredData(n),a=(x=t==null?void 0:t.current)==null?void 0:x.vs,v=f.findIndex(h=>d.areSame(h,y,u)),p=(I=t==null?void 0:t.current)==null?void 0:I.navigation.navigate({current:m.skip+v,max:(a!=null&&a.enabled?m.total:f.length)-1,min:c!==void 0?-1:0,keyCode:r,skipItems:s||void 0});p!==void 0&&J(p,e),E(e)},ut=e=>{Q.current=e,t.current.wrapper=e},pt=e=>i.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%"}},i.createElement("option",{value:n.valueMap?n.valueMap.call(void 0,e):e})),he=()=>{const{textField:e,dataItemKey:r,virtual:s={skip:0},focusedItemIndex:c=d.itemIndexStartsWith,filterable:u,skipDisabledItems:m=!0}=n,y=k(),f=d.getFilteredData(n),a=n.filter?n.filter:g.text;return m&&e&&!a&&!y?f.findIndex(v=>!v.disabled&&v[e]):d.isPresent(y)&&a===void 0||u&&a===""?f.findIndex(v=>d.areSame(v,y,r)):a?Le.current?c(f,a,e):f.findIndex(v=>d.areSame(v,y,r)):s.skip===0?0:-1},Oe=(e,r)=>r!==void 0&&r!==-1&&e&&e.length>0&&e[r].disabled,Se=()=>{const e=d.getFilteredData(n),r=t.current.initState(),s=he();Oe(e,s)&&(W(null,r),E(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),E(r)},qe=e=>{var M,ue,B,pe,j,Ze,et;e&&e.target instanceof Element&&e.target.nodeName==="INPUT"&&e.stopPropagation&&e.stopPropagation();const{filterable:r,disabled:s,defaultItem:c,leftRightKeysNavigation:u=!0,virtual:m={skip:0,total:0,pageSize:0},dataItemKey:y,groupField:f="",textField:a,skipDisabledItems:v=!0}=n,p=d.getFilteredData(n),x=k(),I=p.findIndex(C=>d.areSame(C,x,y)),h=n.opened!==void 0?n.opened:g.opened,l=e.keyCode,F=l===o.Keys.home||l===o.Keys.end,K=l===o.Keys.up||l===o.Keys.down,G=!h&&(e.altKey&&l===o.Keys.down||l===o.Keys.enter||l===o.Keys.space),te=h&&(e.altKey&&l===o.Keys.up||l===o.Keys.esc),de=u&&(l===o.Keys.left||l===o.Keys.right),ce=K||de&&!r||F,S=t.current.initState();if(S.syntheticEvent=e,!s){if(F&&((M=t==null?void 0:t.current)!=null&&M.vs.enabled))l===o.Keys.home?m.skip!==0?((ue=t==null?void 0:t.current)==null||ue.triggerOnPageChange(S,0,m.pageSize),V.current=!0):W(p[0],S):m.skip<m.total-m.pageSize?((B=t==null?void 0:t.current)==null||B.triggerOnPageChange(S,m.total-m.pageSize,m.pageSize),V.current=!0):W(p[p.length-1],S);else if(h&&l===o.Keys.pageUp)e.preventDefault(),(pe=t==null?void 0:t.current)==null||pe.scrollPopupByPageSize(-1);else if(h&&l===o.Keys.pageDown)e.preventDefault(),(j=t==null?void 0:t.current)==null||j.scrollPopupByPageSize(1);else if(h&&l===o.Keys.enter){const C=he();Oe(p,C)?(W(null,S),E(S)):J(C,S),(Ze=t==null?void 0:t.current)==null||Ze.togglePopup(S),e.preventDefault()}else if(G||te)te&&Se(),(et=t==null?void 0:t.current)==null||et.togglePopup(S),e.preventDefault();else if(ce){if(Le.current=!1,f!==""&&a)if(!v&&h)q(S,l);else{let C;if(l===o.Keys.down||l===o.Keys.right){const w=p.slice(I+1).find(D=>!D.disabled&&D[a]);C=w&&p.findIndex(D=>D[a]===w[a])}else if(l===o.Keys.up||l===o.Keys.left){let w;if(I===0&&c)C=-1;else if(I===-1)w=p,C=p.findIndex(D=>!D.disabled&&D[a]);else{w=p.slice(0,I);let D=w.pop();for(;D&&D.disabled;)D=w.pop();C=D&&p.findIndex(Me=>Me[a]===D[a])}}if(C!==void 0){const w=C-I;q(S,l,w)}else C===void 0&&p.findIndex(w=>w[a]===x[a])===p.length-1&&q(S,l)}else if(!v&&h||F)q(S,l);else if(a){let C;if(l===o.Keys.down||l===o.Keys.right){const w=p.slice(I+1).find(D=>!D.disabled&&D[a]);C=w&&p.findIndex(D=>D[a]===w[a])}else if(l===o.Keys.up||l===o.Keys.left){let w;if(I===0&&c)C=-1;else if(I===-1)w=p,C=p.find(D=>!D.disabled&&D[a]);else{w=p.slice(0,I);let D=w.pop();for(;D&&D.disabled;)D=w.pop();C=D&&p.findIndex(Me=>Me[a]===D[a])}}if(C!==void 0){const w=C-I;q(S,l,w)}else C===void 0&&p.findIndex(w=>w[a]===x[a])===p.length-1&&q(S,l)}else q(S,l);e.preventDefault()}E(S)}},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),Le.current=!0,E(r),Z({group:void 0,text:String(e.target.value)})},ze=e=>{const r=n.filter!==void 0?n.filter:g.text;return n.filterable&&i.createElement(Gt,{value:r,ref:s=>{R.current=s&&s.element},onChange:mt,onKeyDown:qe,size:e?"large":O,rounded:Ne,fillMode:fe,renderListFilterWrapper:!0,placeholder:_e.toLanguageString($.dropDownListAdaptiveFilterPlaceholder,$.messages[$.dropDownListAdaptiveFilterPlaceholder])})},gt=e=>{var s;const r=t.current.initState();r.syntheticEvent=e,(s=t==null?void 0:t.current)==null||s.togglePopup(r),W(n.defaultItem,r),E(r)},ft=()=>{const{textField:e,defaultItem:r,dataItemKey:s}=n,c=k();return r!==void 0&&i.createElement(jt,{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),z.current=void 0},yt=e=>{const{vs:r,list:s}=t.current;r.scrollHandler(e);const{groupField:c}=n;let u=d.getFilteredData(n);if(!(!c||!u.length)&&c){const m=Be.current=Be.current||(r.enabled?r.itemHeight:s?s.children[0].offsetHeight:0),f=e.target.scrollTop-r.skip*m;u=t.current.getGroupedDataModernMode(u,c);let a=u[0][c];for(let v=1;v<u.length&&!(m*v>f);v++)u[v]&&u[v][c]&&(a=u[v][c]);a!==g.group&&Z({group:a})}},Ve=()=>{var l;const{textField:e,dataItemKey:r,virtual:s={skip:0,total:void 0},groupHeaderItemRender:c,listNoDataRender:u,itemRender:m}=n,y=d.getFilteredData(n),f=b&&b.uDropDownList,a=t.current.vs,v=s.skip,p=n.opened!==void 0?n.opened:g.opened,x=t.current.getPopupSettings(),I=`translateY(${a.translate}px)`,h=k();return i.createElement($t,{id:be,show:p,data:y.slice(),focusedIndex:he(),value:h,textField:e,valueField:r,optionsGuid:Ge,groupField:n.groupField,groupMode:"modern",listRef:F=>{a.list=t.current.list=F},wrapperStyle:{maxHeight:U?void 0:x.height},wrapperCssClass:o.classNames(o.uDropDownList.listContent({c:f})),listStyle:a.enabled?{transform:I}:void 0,key:"listkey",skip:v,onClick:vt,itemRender:m,groupHeaderItemRender:c,noDataRender:u,onScroll:yt,wrapperRef:a.scrollerRef,scroller:(l=t==null?void 0:t.current)==null?void 0:l.renderScrollElement(),ariaSetSize:s.total})},Dt=()=>{const{groupField:e}=n,r=d.getFilteredData(n),s=n.opened!==void 0?n.opened:g.opened,c=b&&b.uDropDownList,u={title:n.adaptiveTitle||n.label,subTitle:n.adaptiveSubtitle,expand:s,onClose:y=>xe(y),windowWidth:Ke,mobileFilter:ze(!0)};let{group:m}=g;return m===void 0&&e!==void 0&&(m=d.getItemValue(r[0],e)),i.createElement(Rt.AdaptiveMode,{...u},i.createElement(Qt.ActionSheetContent,null,i.createElement("div",{className:o.classNames(o.uDropDownList.listContainer({c,popup:!1}))},St())))},It=()=>{g.focused&&window.setTimeout(()=>{g.focused&&t.current.wrapper&&re(t.current.wrapper)})},wt=e=>{"onMouseDownOutside"in(n.popupSettings||{})&&n.popupSettings.onMouseDownOutside.call(void 0,e)},ht=()=>{const{header:e,footer:r,dir:s,groupField:c,groupStickyHeaderItemRender:u,list:m}=n,y=d.getFilteredData(n),f=t.current,a=f.getPopupSettings(),v=n.opened!==void 0?n.opened:g.opened,p=a.width!==void 0?a.width:f.popupWidth,x=b&&b.uDropDownList,I={dir:s!==void 0?s:f.dirCalculated,width:p,popupSettings:{...a,popupClass:o.classNames(a.popupClass,o.uDropDownList.listContainer({c:x,popup:!0})),anchor:a.anchor||Q.current,show:v,onOpen:we,onClose:It,onMouseDownOutside:wt},itemsCount:[y.length]};let{group:h}=g;return h===void 0&&c!==void 0&&(h=d.getItemValue(y[0],c)),i.createElement(Ut,{...I},ze(!1),e&&i.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:x}))},e),i.createElement("div",{className:o.classNames(o.uDropDownList.list({c:x,size:O,virtual:t.current.vs.enabled}))},ft(),!m&&h&&y.length!==0&&i.createElement(tt,{group:h,groupMode:"modern",render:u}),Ve()),r&&i.createElement("div",{className:o.classNames(o.uDropDownList.listFooter({c:x}))},r),T&&i.createElement(o.WatermarkOverlay,{message:ne}))},St=()=>{const{header:e,footer:r,groupStickyHeaderItemRender:s,groupField:c,list:u}=n,m=d.getFilteredData(n),y=b&&b.uDropDownList;let{group:f}=g;return f===void 0&&c!==void 0&&(f=d.getItemValue(m[0],c)),i.createElement(i.Fragment,null,e&&i.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:y}))},e),i.createElement("div",{className:o.classNames("k-list",{[`k-list-${U?"lg":o.sizeMap[O]||O}`]:O})},!u&&f&&m.length!==0&&i.createElement(tt,{group:f,groupMode:"modern",render:s}),Ve()),r&&i.createElement("div",{className:"k-list-footer"},r))},xt=e=>{const{dataItemKey:r}=n,s=d.getFilteredData(n),c=k();let u=s.map((K,G)=>({item:K,itemIndex:G}));const m=_.current.word,y=_.current.last,f=d.sameCharsOnly(m,y);let a=u.length,v=Math.max(0,s.findIndex(K=>d.areSame(K,c,r))),p;n.defaultItem&&(p={item:n.defaultItem,itemIndex:-1},a+=1,v+=1),v+=f?1:0,u=d.shuffleData(u,v,p);let x,I,h,l=0;const{textField:F}=n;for(;l<a;){if(x=d.getItemValue(u[l].item,F),I=f&&d.matchText(x,y,ge),h=d.matchText(x,m,ge),I||h){l=u[l].itemIndex;break}l++}if(l!==a){const K=t.current.initState();K.syntheticEvent=e,J(l,K),E(K),z.current=void 0}},Ct=e=>{clearTimeout(He.current),n.filterable||(He.current=window.setTimeout(()=>_.current.word="",st),xt(e))},Lt=e=>{oe.current||t.current.handleFocus(e)},kt=e=>{if(oe.current||!g.focused)return;const r=n.opened!==void 0?n.opened:g.opened,s=t.current.initState();s.syntheticEvent=e,s.data.focused=!1,s.events.push({type:"onBlur"}),r&&Se(),r&&!U&&t.current.togglePopup(s),E(s)},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(),_.current={word:_.current.word+r,last:_.current.last+r},Ct(e)},bt=()=>{const e=t.current.initState();e.data.opened=g.opened,t.current.togglePopup(e),E(e)},Ae=i.useRef(null),Q=i.useRef(null),Ce=i.useRef(null),R=i.useRef(null);i.useImperativeHandle(Ae,()=>({get element(){return Q.current},get index(){return lt()},get name(){return n.name},get validity(){return Ie()},get value(){return k()},get focused(){return g.focused},get opened(){return g.opened},focus:it,props:n,togglePopup:bt})),i.useImperativeHandle(Y,()=>Ae.current);const He=i.useRef(null),_=i.useRef({word:"",last:""}),oe=i.useRef(!1),z=i.useRef(null),V=i.useRef(!1),Le=i.useRef(!1),A=i.useRef({}),ke=i.useRef({}),t=i.useRef(new rt({props:n,setState:()=>{},state:{},forceUpdate:()=>{},element:null,value:null,handleItemSelect:()=>{}})),Be=i.useRef(0),X=i.useRef(null),[g,Et]=i.useState({}),[Ke,Ft]=i.useState(),[,We]=i.useReducer(e=>e,!0),_e=Jt.useLocalization(),Z=e=>{Et({...g,...e})};i.useEffect(()=>{t.current.updateComponentArgs({props:n,setState:Z,state:g,forceUpdate:We,element:Q.current,handleItemSelect:J,value:k()})},[Z,g,We,J,k]),i.useEffect(()=>{var v,p,x,I,h,l,F,K,G,te,de,ce,S;const{dataItemKey:e,virtual:r,groupField:s="",textField:c}=n,u=d.getFilteredData(n),m=A.current.virtual?A.current.virtual.total:0,y=n.opened!==void 0?n.opened:g.opened,f=A.current.opened!==void 0?A.current.opened:ke.current.opened,a=!f&&y;if((v=t==null?void 0:t.current)==null||v.didUpdate(),(p=t==null?void 0:t.current)!=null&&p.getPopupSettings().animate||a&&we(),r&&r.total!==m)(x=t==null?void 0:t.current)==null||x.vs.calcScrollElementHeight(),(I=t==null?void 0:t.current)==null||I.vs.reset();else{const M=k(),ue=A.current.value!==void 0?A.current.value:ke.current.value;let B=u.findIndex(j=>d.areSame(j,M,e));s!==""&&M&&c&&(B=(l=(h=t==null?void 0:t.current)==null?void 0:h.getGroupedDataModernMode(u,s))==null?void 0:l.map(j=>j[c]).indexOf(M[c]));const pe=!d.areSame(ue,M,e);a&&r?(F=t==null?void 0:t.current)==null||F.scrollToVirtualItem(r,B):a&&!r?(we(),u&&u.length!==0&&((K=t==null?void 0:t.current)==null||K.resetGroupStickyHeader(u[0][s],{setState:Z,group:g.group,state:g})),(G=t==null?void 0:t.current)==null||G.scrollToItem(B)):y&&f&&M&&pe&&!V.current?(de=t==null?void 0:t.current)==null||de.scrollToItem(B,(te=t==null?void 0:t.current)==null?void 0:te.vs.enabled):y&&f&&V.current&&(V.current&&r&&r.skip===0?(ce=t==null?void 0:t.current)==null||ce.vs.reset():V.current&&r&&r.skip===r.total-r.pageSize&&((S=t==null?void 0:t.current)==null||S.vs.scrollToEnd()))}V.current=!1,ke.current=g,A.current=n,Te()}),i.useEffect(()=>{var e,r;return X.current=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(ct.bind(void 0)),(e=t==null?void 0:t.current)==null||e.didMount(),Te(),(r=ye())!=null&&r.body&&X.current&&X.current.observe(ye().body),()=>{var s;(s=ye())!=null&&s.body&&X.current&&X.current.disconnect()}},[]);const Ue=ve+"-accessibility-id",be=ve+"-listbox-id",Ge=ve+"-guid",Pt=_e.toLanguageString($.dropDownListArrowBtnAriaLabel,$.messages[$.dropDownListArrowBtnAriaLabel]),{style:se,className:Mt,label:Ee,dir:Nt,virtual:H,adaptive:tn,dataItemKey:Tt,disabled:ae,loading:je,iconClassName:$e,svgIcon:Ot,valueRender:Ye}=n,Fe=n.opened!==void 0?n.opened:g.opened,ie=k(),Pe=d.getItemValue(ie,n.textField),Je=!dt()||Ie().valid,le=t.current,qt=le.vs,ee=b&&b.uDropDownList;qt.enabled=H!==void 0;const Qe=o.useAdaptiveModeContext(),U=!!(Ke&&Qe&&Ke<=Qe.medium&&n.adaptive);H!==void 0&&(le.vs.skip=H.skip,le.vs.total=H.total,le.vs.pageSize=H.pageSize);const zt=d.getFilteredData(n),{focused:Vt}=g,At=zt.findIndex(e=>d.areSame(e,ie,Tt)),Re=i.createElement("span",{id:Ue,className:o.classNames(o.uDropDownList.inputInner({c:ee}))},Pe&&i.createElement("span",{className:o.classNames(o.uDropDownList.inputText({c:ee}))},Pe)),Ht=Ye!==void 0?Ye.call(void 0,Re,ie):Re,Xe=i.createElement(i.Fragment,null,i.createElement("span",{ref:ut,className:o.classNames(o.uDropDownList.wrapper({c:ee,size:O,rounded:Ne,fillMode:fe,focused:Vt,disabled:ae,invalid:!Je,loading:je,required:De()}),Mt),style:Ee?{...se,width:void 0}:se,dir:Nt,onMouseDown:Fe?e=>{e.target.nodeName!=="INPUT"&&(re(t.current.wrapper),e.preventDefault())}:void 0,onFocus:U?e=>xe(e):Lt,onBlur:kt,tabIndex:o.getTabIndex(at,ae),accessKey:n.accessKey,onKeyDown:qe,onKeyPress:Kt,onClick:ae?void 0:xe,role:"combobox","aria-required":De(),"aria-disabled":ae||void 0,"aria-haspopup":"listbox","aria-expanded":Fe||!1,"aria-owns":be,"aria-activedescendant":Fe?"option-"+Ge+"-"+(At+(H?H.skip:0)):void 0,"aria-label":n.ariaLabel||n.label,"aria-labelledby":n.ariaLabelledBy,"aria-describedby":n.ariaDescribedBy||Ue,"aria-controls":be,id:n.id,title:n.title},Ht,je&&i.createElement(o.IconWrap,{className:o.classNames(o.uDropDownList.loadingIcon({c:ee})),name:"loading"}),i.createElement(Yt.Button,{tabIndex:-1,type:"button","aria-label":Pt,size:O,fillMode:fe,className:o.classNames(o.uDropDownList.inputButton({c:ee})),rounded:null,themeColor:"base",iconClass:$e,svgIcon:$e?void 0:Ot||_t.caretAltDownIcon,onMouseDown:e=>g.focused&&e.preventDefault()}),pt(ie),!U&&ht()),U&&Dt());return Ee?i.createElement(Wt.FloatingLabel,{label:Ee,editorValue:Pe,editorValid:Je,editorDisabled:n.disabled,style:{width:se?se.width:void 0},children:Xe}):Xe});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,...rt.defaultProps,required:!1,size:"medium",rounded:"medium",fillMode:"solid",groupMode:"modern"};me.displayName="KendoReactDropDownList";const ot=o.createPropsContext();me.displayName="KendoReactDropDownList";exports.DropDownList=me;exports.DropDownListPropsContext=ot;exports.dropDownListDefaultProps=P;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Bt=require("react"),L=require("prop-types"),o=require("@progress/kendo-react-common"),Wt=require("@progress/kendo-react-labels"),_t=require("@progress/kendo-svg-icons"),Ut=require("../common/ListContainer.js"),Gt=require("../common/ListFilter.js"),tt=require("../common/GroupStickyHeader.js"),jt=require("../common/ListDefaultItem.js"),$t=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"),$=require("../messages/index.js"),Qt=require("@progress/kendo-react-layout"),Rt=require("../common/AdaptiveMode.js");function Xt(M){const Y=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(M){for(const T in M)if(T!=="default"){const ne=Object.getOwnPropertyDescriptor(M,T);Object.defineProperty(Y,T,ne.get?ne:{enumerable:!0,get:()=>M[T]})}}return Y.default=M,Object.freeze(Y)}const i=Xt(Bt),Zt="Please select a value from the list!",me=i.forwardRef((M,Y)=>{let T=!1;const ne=o.getLicenseMessage(nt.packageMetadata),n=o.usePropsContext(ot,M),{delay:st=P.delay,tabIndex:at=P.tabIndex,ignoreCase:ge=P.ignoreCase,size:O=P.size,rounded:Me=P.rounded,fillMode:fe=P.fillMode}=n;if(n.filterable||n.virtual){const e=[];n.filterable&&e.push("filterable"),n.virtual&&e.push("virtualization"),T=!o.validatePackage(nt.packageMetadata,{component:"DropDownList",features:e})}const E=o.useUnstyled(),ve=o.useId(n.id),ye=()=>{var e;if(o.canUseDOM)return((e=Q.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 z.current!==void 0&&z.current!==null?e=z.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),!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))},De=()=>n.required!==void 0?n.required:P.required,Ie=()=>{const e=n.validationMessage!==void 0,r=k(),s=!De()||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,re=e=>{oe.current=!0,e.focus(),window.setTimeout(()=>oe.current=!1,30)},we=()=>{R.current&&re(R.current),n.adaptive&&setTimeout(()=>{R.current&&re(R.current)},300)},ct=i.useCallback(e=>{for(const r of e)Ft(r.target.clientWidth)},[]),Te=()=>{var e;(e=Ce.current)!=null&&e.setCustomValidity&&Ce.current.setCustomValidity(Ie().valid?"":n.validationMessage||Zt)},_=(e,r)=>{const s=k();d.areSame(s,e,n.dataItemKey)||(n.value===void 0&&(r.data.value=e),t.current.updateComponentArgs({value:e}),z.current=e,r.events.push({type:"onChange"}))},b=e=>{var r;(r=t==null?void 0:t.current)==null||r.applyState(e),z.current=void 0},J=(e,r)=>{var p;const{virtual:s,dataItemKey:c,defaultItem:u}=n,m=d.getFilteredData(n),y=s?s.skip:0,f=k(),a=e===-1&&u!==void 0?u:m[e-y],v=!d.areSame(a,f,c);_(a,r),v&&((p=t==null?void 0:t.current)==null||p.triggerPageChangeCornerItems(a,r))},q=(e,r,s)=>{var x,I;const{defaultItem:c,dataItemKey:u,virtual:m={skip:0,total:0,pageSize:0}}=n,y=k(),f=d.getFilteredData(n),a=(x=t==null?void 0:t.current)==null?void 0:x.vs,v=f.findIndex(h=>d.areSame(h,y,u)),p=(I=t==null?void 0:t.current)==null?void 0:I.navigation.navigate({current:m.skip+v,max:(a!=null&&a.enabled?m.total:f.length)-1,min:c!==void 0?-1:0,keyCode:r,skipItems:s||void 0});p!==void 0&&J(p,e),b(e)},ut=e=>{Q.current=e,t.current.wrapper=e},pt=e=>i.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%"}},i.createElement("option",{value:n.valueMap?n.valueMap.call(void 0,e):e})),he=()=>{const{textField:e,dataItemKey:r,virtual:s={skip:0},focusedItemIndex:c=d.itemIndexStartsWith,filterable:u,skipDisabledItems:m=!0}=n,y=k(),f=d.getFilteredData(n),a=n.filter?n.filter:g.text;return m&&e&&!a&&!y?f.findIndex(v=>!v.disabled&&v[e]):d.isPresent(y)&&a===void 0||u&&a===""?f.findIndex(v=>d.areSame(v,y,r)):a?Le.current?c(f,a,e):f.findIndex(v=>d.areSame(v,y,r)):s.skip===0?0:-1},Oe=(e,r)=>r!==void 0&&r!==-1&&e&&e.length>0&&e[r].disabled,Se=()=>{const e=d.getFilteredData(n),r=t.current.initState(),s=he();Oe(e,s)&&(_(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)},qe=e=>{var N,ue,W,pe,j,Ze,et;e&&e.target instanceof Element&&e.target.nodeName==="INPUT"&&e.stopPropagation&&e.stopPropagation();const{filterable:r,disabled:s,defaultItem:c,leftRightKeysNavigation:u=!0,virtual:m={skip:0,total:0,pageSize:0},dataItemKey:y,groupField:f="",textField:a,skipDisabledItems:v=!0}=n,p=d.getFilteredData(n),x=k(),I=p.findIndex(C=>d.areSame(C,x,y)),h=n.opened!==void 0?n.opened:g.opened,l=e.keyCode,F=l===o.Keys.home||l===o.Keys.end,K=l===o.Keys.up||l===o.Keys.down,G=!h&&(e.altKey&&l===o.Keys.down||l===o.Keys.enter||l===o.Keys.space),te=h&&(e.altKey&&l===o.Keys.up||l===o.Keys.esc),de=u&&(l===o.Keys.left||l===o.Keys.right),ce=K||de&&!r||F,S=t.current.initState();if(S.syntheticEvent=e,!s){if(F&&((N=t==null?void 0:t.current)!=null&&N.vs.enabled))l===o.Keys.home?m.skip!==0?((ue=t==null?void 0:t.current)==null||ue.triggerOnPageChange(S,0,m.pageSize),V.current=!0):_(p[0],S):m.skip<m.total-m.pageSize?((W=t==null?void 0:t.current)==null||W.triggerOnPageChange(S,m.total-m.pageSize,m.pageSize),V.current=!0):_(p[p.length-1],S);else if(h&&l===o.Keys.pageUp)e.preventDefault(),(pe=t==null?void 0:t.current)==null||pe.scrollPopupByPageSize(-1);else if(h&&l===o.Keys.pageDown)e.preventDefault(),(j=t==null?void 0:t.current)==null||j.scrollPopupByPageSize(1);else if(h&&l===o.Keys.enter){const C=he();Oe(p,C)?(_(null,S),b(S)):J(C,S),(Ze=t==null?void 0:t.current)==null||Ze.togglePopup(S),e.preventDefault()}else if(G||te)te&&Se(),(et=t==null?void 0:t.current)==null||et.togglePopup(S),e.preventDefault();else if(ce){if(Le.current=!1,f!==""&&a)if(!v&&h)q(S,l);else{let C;if(l===o.Keys.down||l===o.Keys.right){const w=p.slice(I+1).find(D=>!D.disabled&&D[a]);C=w&&p.findIndex(D=>D[a]===w[a])}else if(l===o.Keys.up||l===o.Keys.left){let w;if(I===0&&c)C=-1;else if(I===-1)w=p,C=p.findIndex(D=>!D.disabled&&D[a]);else{w=p.slice(0,I);let D=w.pop();for(;D&&D.disabled;)D=w.pop();C=D&&p.findIndex(Ne=>Ne[a]===D[a])}}if(C!==void 0){const w=C-I;q(S,l,w)}else C===void 0&&p.findIndex(w=>w[a]===x[a])===p.length-1&&q(S,l)}else if(!v&&h||F)q(S,l);else if(a){let C;if(l===o.Keys.down||l===o.Keys.right){const w=p.slice(I+1).find(D=>!D.disabled&&D[a]);C=w&&p.findIndex(D=>D[a]===w[a])}else if(l===o.Keys.up||l===o.Keys.left){let w;if(I===0&&c)C=-1;else if(I===-1)w=p,C=p.find(D=>!D.disabled&&D[a]);else{w=p.slice(0,I);let D=w.pop();for(;D&&D.disabled;)D=w.pop();C=D&&p.findIndex(Ne=>Ne[a]===D[a])}}if(C!==void 0){const w=C-I;q(S,l,w)}else C===void 0&&p.findIndex(w=>w[a]===x[a])===p.length-1&&q(S,l)}else q(S,l);e.preventDefault()}b(S)}},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),Le.current=!0,b(r),Z({group:void 0,text:String(e.target.value)})},ze=e=>{const r=n.filter!==void 0?n.filter:g.text;return n.filterable&&i.createElement(Gt,{value:r,ref:s=>{R.current=s&&s.element},onChange:mt,onKeyDown:qe,size:e?"large":O,rounded:Me,fillMode:fe,renderListFilterWrapper:!0,placeholder:_e.toLanguageString($.dropDownListAdaptiveFilterPlaceholder,$.messages[$.dropDownListAdaptiveFilterPlaceholder])})},gt=e=>{var s;const r=t.current.initState();r.syntheticEvent=e,(s=t==null?void 0:t.current)==null||s.togglePopup(r),_(n.defaultItem,r),b(r)},ft=()=>{const{textField:e,defaultItem:r,dataItemKey:s}=n,c=k();return r!==void 0&&i.createElement(jt,{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),z.current=void 0},yt=e=>{const{vs:r,list:s}=t.current;r.scrollHandler(e);const{groupField:c}=n;let u=d.getFilteredData(n);if(!(!c||!u.length)&&c){const m=Be.current=Be.current||(r.enabled?r.itemHeight:s?s.children[0].offsetHeight:0),f=e.target.scrollTop-r.skip*m;u=t.current.getGroupedDataModernMode(u,c);let a=u[0][c];for(let v=1;v<u.length&&!(m*v>f);v++)u[v]&&u[v][c]&&(a=u[v][c]);a!==g.group&&Z({group:a})}},Ve=()=>{var l;const{textField:e,dataItemKey:r,virtual:s={skip:0,total:void 0},groupHeaderItemRender:c,listNoDataRender:u,itemRender:m}=n,y=d.getFilteredData(n),f=E&&E.uDropDownList,a=t.current.vs,v=s.skip,p=n.opened!==void 0?n.opened:g.opened,x=t.current.getPopupSettings(),I=`translateY(${a.translate}px)`,h=k();return i.createElement($t,{id:Ee,show:p,data:y.slice(),focusedIndex:he(),value:h,textField:e,valueField:r,optionsGuid:Ge,groupField:n.groupField,listRef:F=>{a.list=t.current.list=F},wrapperStyle:{maxHeight:B?void 0:x.height},wrapperCssClass:o.classNames(o.uDropDownList.listContent({c:f})),listStyle:a.enabled?{transform:I}:void 0,key:"listkey",skip:v,onClick:vt,itemRender:m,groupHeaderItemRender:c,noDataRender:u,onScroll:yt,wrapperRef:a.scrollerRef,scroller:(l=t==null?void 0:t.current)==null?void 0:l.renderScrollElement(),ariaSetSize:s.total})},Dt=()=>{const{groupField:e}=n,r=d.getFilteredData(n),s=n.opened!==void 0?n.opened:g.opened,c=E&&E.uDropDownList,u={title:n.adaptiveTitle||n.label,subTitle:n.adaptiveSubtitle,expand:s,onClose:y=>xe(y),windowWidth:Ke,mobileFilter:ze(!0)};let{group:m}=g;return m===void 0&&e!==void 0&&(m=d.getItemValue(r[0],e)),i.createElement(Rt.AdaptiveMode,{...u},i.createElement(Qt.ActionSheetContent,null,i.createElement("div",{className:o.classNames(o.uDropDownList.listContainer({c,popup:!1}))},St())))},It=()=>{g.focused&&window.setTimeout(()=>{g.focused&&t.current.wrapper&&re(t.current.wrapper)})},wt=e=>{"onMouseDownOutside"in(n.popupSettings||{})&&n.popupSettings.onMouseDownOutside.call(void 0,e)},ht=()=>{const{header:e,footer:r,dir:s,groupField:c,groupStickyHeaderItemRender:u,list:m}=n,y=d.getFilteredData(n),f=t.current,a=f.getPopupSettings(),v=n.opened!==void 0?n.opened:g.opened,p=a.width!==void 0?a.width:f.popupWidth,x=E&&E.uDropDownList,I={dir:s!==void 0?s:f.dirCalculated,width:p,popupSettings:{...a,popupClass:o.classNames(a.popupClass,o.uDropDownList.listContainer({c:x,popup:!0})),anchor:a.anchor||Q.current,show:v,onOpen:we,onClose:It,onMouseDownOutside:wt},itemsCount:[y.length]};let{group:h}=g;return h===void 0&&c!==void 0&&(h=d.getItemValue(y[0],c)),i.createElement(Ut,{...I},ze(!1),e&&i.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:x}))},e),i.createElement("div",{className:o.classNames(o.uDropDownList.list({c:x,size:O,virtual:t.current.vs.enabled}))},ft(),!m&&h&&y.length!==0&&i.createElement(tt,{group:h,render:u}),Ve()),r&&i.createElement("div",{className:o.classNames(o.uDropDownList.listFooter({c:x}))},r),T&&i.createElement(o.WatermarkOverlay,{message:ne}))},St=()=>{const{header:e,footer:r,groupStickyHeaderItemRender:s,groupField:c,list:u}=n,m=d.getFilteredData(n),y=E&&E.uDropDownList;let{group:f}=g;return f===void 0&&c!==void 0&&(f=d.getItemValue(m[0],c)),i.createElement(i.Fragment,null,e&&i.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:y}))},e),i.createElement("div",{className:o.classNames("k-list",{[`k-list-${B?"lg":o.sizeMap[O]||O}`]:B||O})},!u&&f&&m.length!==0&&i.createElement(tt,{group:f,render:s}),Ve()),r&&i.createElement("div",{className:"k-list-footer"},r))},xt=e=>{const{dataItemKey:r}=n,s=d.getFilteredData(n),c=k();let u=s.map((K,G)=>({item:K,itemIndex:G}));const m=U.current.word,y=U.current.last,f=d.sameCharsOnly(m,y);let a=u.length,v=Math.max(0,s.findIndex(K=>d.areSame(K,c,r))),p;n.defaultItem&&(p={item:n.defaultItem,itemIndex:-1},a+=1,v+=1),v+=f?1:0,u=d.shuffleData(u,v,p);let x,I,h,l=0;const{textField:F}=n;for(;l<a;){if(x=d.getItemValue(u[l].item,F),I=f&&d.matchText(x,y,ge),h=d.matchText(x,m,ge),I||h){l=u[l].itemIndex;break}l++}if(l!==a){const K=t.current.initState();K.syntheticEvent=e,J(l,K),b(K),z.current=void 0}},Ct=e=>{clearTimeout(He.current),n.filterable||(He.current=window.setTimeout(()=>U.current.word="",st),xt(e))},Lt=e=>{oe.current||t.current.handleFocus(e)},kt=e=>{if(oe.current||!g.focused)return;const r=n.opened!==void 0?n.opened:g.opened,s=t.current.initState();s.syntheticEvent=e,s.data.focused=!1,s.events.push({type:"onBlur"}),r&&Se(),r&&!B&&t.current.togglePopup(s),b(s)},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(),U.current={word:U.current.word+r,last:U.current.last+r},Ct(e)},Et=()=>{const e=t.current.initState();e.data.opened=g.opened,t.current.togglePopup(e),b(e)},Ae=i.useRef(null),Q=i.useRef(null),Ce=i.useRef(null),R=i.useRef(null);i.useImperativeHandle(Ae,()=>({get element(){return Q.current},get index(){return lt()},get name(){return n.name},get validity(){return Ie()},get value(){return k()},get focused(){return g.focused},get opened(){return g.opened},focus:it,props:n,togglePopup:Et})),i.useImperativeHandle(Y,()=>Ae.current);const He=i.useRef(null),U=i.useRef({word:"",last:""}),oe=i.useRef(!1),z=i.useRef(null),V=i.useRef(!1),Le=i.useRef(!1),A=i.useRef({}),ke=i.useRef({}),t=i.useRef(new rt({props:n,setState:()=>{},state:{},forceUpdate:()=>{},element:null,value:null,handleItemSelect:()=>{}})),Be=i.useRef(0),X=i.useRef(null),[g,bt]=i.useState({}),[Ke,Ft]=i.useState(),[,We]=i.useReducer(e=>e,!0),_e=Jt.useLocalization(),Z=e=>{bt({...g,...e})};i.useEffect(()=>{t.current.updateComponentArgs({props:n,setState:Z,state:g,forceUpdate:We,element:Q.current,handleItemSelect:J,value:k()})},[Z,g,We,J,k]),i.useEffect(()=>{var v,p,x,I,h,l,F,K,G,te,de,ce,S;const{dataItemKey:e,virtual:r,groupField:s="",textField:c}=n,u=d.getFilteredData(n),m=A.current.virtual?A.current.virtual.total:0,y=n.opened!==void 0?n.opened:g.opened,f=A.current.opened!==void 0?A.current.opened:ke.current.opened,a=!f&&y;if((v=t==null?void 0:t.current)==null||v.didUpdate(),(p=t==null?void 0:t.current)!=null&&p.getPopupSettings().animate||a&&we(),r&&r.total!==m)(x=t==null?void 0:t.current)==null||x.vs.calcScrollElementHeight(),(I=t==null?void 0:t.current)==null||I.vs.reset();else{const N=k(),ue=A.current.value!==void 0?A.current.value:ke.current.value;let W=u.findIndex(j=>d.areSame(j,N,e));s!==""&&N&&c&&(W=(l=(h=t==null?void 0:t.current)==null?void 0:h.getGroupedDataModernMode(u,s))==null?void 0:l.map(j=>j[c]).indexOf(N[c]));const pe=!d.areSame(ue,N,e);a&&r?(F=t==null?void 0:t.current)==null||F.scrollToVirtualItem(r,W):a&&!r?(we(),u&&u.length!==0&&((K=t==null?void 0:t.current)==null||K.resetGroupStickyHeader(u[0][s],{setState:Z,group:g.group,state:g})),(G=t==null?void 0:t.current)==null||G.scrollToItem(W)):y&&f&&N&&pe&&!V.current?(de=t==null?void 0:t.current)==null||de.scrollToItem(W,(te=t==null?void 0:t.current)==null?void 0:te.vs.enabled):y&&f&&V.current&&(V.current&&r&&r.skip===0?(ce=t==null?void 0:t.current)==null||ce.vs.reset():V.current&&r&&r.skip===r.total-r.pageSize&&((S=t==null?void 0:t.current)==null||S.vs.scrollToEnd()))}V.current=!1,ke.current=g,A.current=n,Te()}),i.useEffect(()=>{var e,r;return X.current=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(ct.bind(void 0)),(e=t==null?void 0:t.current)==null||e.didMount(),Te(),(r=ye())!=null&&r.body&&X.current&&X.current.observe(ye().body),()=>{var s;(s=ye())!=null&&s.body&&X.current&&X.current.disconnect()}},[]);const Ue=ve+"-accessibility-id",Ee=ve+"-listbox-id",Ge=ve+"-guid",Pt=_e.toLanguageString($.dropDownListArrowBtnAriaLabel,$.messages[$.dropDownListArrowBtnAriaLabel]),{style:se,className:Nt,label:be,dir:Mt,virtual:H,adaptive:en,dataItemKey:Tt,disabled:ae,loading:je,iconClassName:$e,svgIcon:Ot,valueRender:Ye}=n,Fe=n.opened!==void 0?n.opened:g.opened,ie=k(),Pe=d.getItemValue(ie,n.textField),Je=!dt()||Ie().valid,le=t.current,qt=le.vs,ee=E&&E.uDropDownList;qt.enabled=H!==void 0;const Qe=o.useAdaptiveModeContext(),B=!!(Ke&&Qe&&Ke<=Qe.medium&&n.adaptive);H!==void 0&&(le.vs.skip=H.skip,le.vs.total=H.total,le.vs.pageSize=H.pageSize);const zt=d.getFilteredData(n),{focused:Vt}=g,At=zt.findIndex(e=>d.areSame(e,ie,Tt)),Re=i.createElement("span",{id:Ue,className:o.classNames(o.uDropDownList.inputInner({c:ee}))},Pe&&i.createElement("span",{className:o.classNames(o.uDropDownList.inputText({c:ee}))},Pe)),Ht=Ye!==void 0?Ye.call(void 0,Re,ie):Re,Xe=i.createElement(i.Fragment,null,i.createElement("span",{ref:ut,className:o.classNames(o.uDropDownList.wrapper({c:ee,size:O,rounded:Me,fillMode:fe,focused:Vt,disabled:ae,invalid:!Je,loading:je,required:De()}),Nt),style:be?{...se,width:void 0}:se,dir:Mt,onMouseDown:Fe?e=>{e.target.nodeName!=="INPUT"&&(re(t.current.wrapper),e.preventDefault())}:void 0,onFocus:B?e=>xe(e):Lt,onBlur:kt,tabIndex:o.getTabIndex(at,ae),accessKey:n.accessKey,onKeyDown:qe,onKeyPress:Kt,onClick:ae?void 0:xe,role:"combobox","aria-required":De(),"aria-disabled":ae||void 0,"aria-haspopup":"listbox","aria-expanded":Fe||!1,"aria-owns":Ee,"aria-activedescendant":Fe?"option-"+Ge+"-"+(At+(H?H.skip:0)):void 0,"aria-label":n.ariaLabel||n.label,"aria-labelledby":n.ariaLabelledBy,"aria-describedby":n.ariaDescribedBy||Ue,"aria-controls":Ee,id:n.id,title:n.title},Ht,je&&i.createElement(o.IconWrap,{className:o.classNames(o.uDropDownList.loadingIcon({c:ee})),name:"loading"}),i.createElement(Yt.Button,{tabIndex:-1,type:"button","aria-label":Pt,size:O,fillMode:fe,className:o.classNames(o.uDropDownList.inputButton({c:ee})),iconClass:$e,svgIcon:$e?void 0:Ot||_t.caretAltDownIcon,onMouseDown:e=>g.focused&&e.preventDefault()}),pt(ie),!B&&ht()),B&&Dt());return be?i.createElement(Wt.FloatingLabel,{label:be,editorValue:Pe,editorValid:Je,editorDisabled:n.disabled,style:{width:se?se.width:void 0},children:Xe}):Xe});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,...rt.defaultProps,required:!1,size:void 0,rounded:void 0,fillMode:void 0};me.displayName="KendoReactDropDownList";const ot=o.createPropsContext();me.displayName="KendoReactDropDownList";exports.DropDownList=me;exports.DropDownListPropsContext=ot;exports.dropDownListDefaultProps=P;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as s from "react";
|
|
9
9
|
import C from "prop-types";
|
|
10
|
-
import {
|
|
10
|
+
import { createPropsContext as Jt, getLicenseMessage as Qt, usePropsContext as Xt, validatePackage as Zt, useUnstyled as Rt, useId as en, canUseDOM as tt, useAdaptiveModeContext as tn, classNames as L, uDropDownList as P, getTabIndex as nn, IconWrap as rn, Keys as I, WatermarkOverlay as on, sizeMap as sn, svgIconPropType as an } from "@progress/kendo-react-common";
|
|
11
11
|
import { FloatingLabel as ln } from "@progress/kendo-react-labels";
|
|
12
12
|
import { caretAltDownIcon as dn } from "@progress/kendo-svg-icons";
|
|
13
13
|
import cn from "../common/ListContainer.mjs";
|
|
@@ -16,32 +16,31 @@ import nt from "../common/GroupStickyHeader.mjs";
|
|
|
16
16
|
import pn from "../common/ListDefaultItem.mjs";
|
|
17
17
|
import mn from "../common/List.mjs";
|
|
18
18
|
import dt from "../common/DropDownBase.mjs";
|
|
19
|
-
import { getFilteredData as E, areSame as
|
|
19
|
+
import { getFilteredData as E, areSame as F, getItemValue as te, isPresent as rt, itemIndexStartsWith as fn, sameCharsOnly as gn, shuffleData as vn, matchText as ot } from "../common/utils.mjs";
|
|
20
20
|
import { packageMetadata as it } from "../package-metadata.mjs";
|
|
21
21
|
import { Button as In } from "@progress/kendo-react-buttons";
|
|
22
22
|
import { useLocalization as hn } from "@progress/kendo-react-intl";
|
|
23
23
|
import { dropDownListArrowBtnAriaLabel as st, messages as at, dropDownListAdaptiveFilterPlaceholder as lt } from "../messages/index.mjs";
|
|
24
24
|
import { ActionSheetContent as yn } from "@progress/kendo-react-layout";
|
|
25
25
|
import { AdaptiveMode as wn } from "../common/AdaptiveMode.mjs";
|
|
26
|
-
const Dn = "Please select a value from the list!",
|
|
26
|
+
const Dn = "Please select a value from the list!", Me = s.forwardRef((ct, ut) => {
|
|
27
27
|
let Ke = !1;
|
|
28
|
-
const pt =
|
|
29
|
-
delay: mt =
|
|
30
|
-
tabIndex: ft =
|
|
31
|
-
ignoreCase: pe =
|
|
32
|
-
size: O =
|
|
33
|
-
rounded: Ne =
|
|
34
|
-
fillMode: me =
|
|
35
|
-
groupMode: Sn = T.groupMode
|
|
28
|
+
const pt = Qt(it), n = Xt(xn, ct), {
|
|
29
|
+
delay: mt = z.delay,
|
|
30
|
+
tabIndex: ft = z.tabIndex,
|
|
31
|
+
ignoreCase: pe = z.ignoreCase,
|
|
32
|
+
size: O = z.size,
|
|
33
|
+
rounded: Ne = z.rounded,
|
|
34
|
+
fillMode: me = z.fillMode
|
|
36
35
|
} = n;
|
|
37
36
|
if (n.filterable || n.virtual) {
|
|
38
37
|
const e = [];
|
|
39
|
-
n.filterable && e.push("filterable"), n.virtual && e.push("virtualization"), Ke = !
|
|
38
|
+
n.filterable && e.push("filterable"), n.virtual && e.push("virtualization"), Ke = !Zt(it, {
|
|
40
39
|
component: "DropDownList",
|
|
41
40
|
features: e
|
|
42
41
|
});
|
|
43
42
|
}
|
|
44
|
-
const
|
|
43
|
+
const M = Rt(), fe = en(n.id), ge = () => {
|
|
45
44
|
var e;
|
|
46
45
|
if (tt)
|
|
47
46
|
return ((e = J.current) == null ? void 0 : e.ownerDocument) || window.document;
|
|
@@ -53,15 +52,15 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
53
52
|
return H.current !== void 0 && H.current !== null ? e = H.current : n.value !== void 0 ? e = n.value : p.value !== void 0 && p.value !== null ? e = p.value : n.defaultValue !== void 0 && n.defaultValue !== null && (e = n.defaultValue), !rt(e) && n.defaultItem !== void 0 && n.defaultItem !== null && (e = n.defaultItem), e;
|
|
54
53
|
}, vt = () => {
|
|
55
54
|
const { dataItemKey: e } = n, r = E(n), o = k();
|
|
56
|
-
return r.findIndex((l) =>
|
|
57
|
-
}, ve = () => n.required !== void 0 ? n.required :
|
|
55
|
+
return r.findIndex((l) => F(l, o, e));
|
|
56
|
+
}, ve = () => n.required !== void 0 ? n.required : z.required, Ie = () => {
|
|
58
57
|
const e = n.validationMessage !== void 0, r = k(), o = !ve() || r !== null && r !== "" && r !== void 0, l = n.valid !== void 0 ? n.valid : o;
|
|
59
58
|
return {
|
|
60
59
|
customError: e,
|
|
61
60
|
valid: l,
|
|
62
61
|
valueMissing: r === null
|
|
63
62
|
};
|
|
64
|
-
}, It = () => n.validityStyles !== void 0 ? n.validityStyles :
|
|
63
|
+
}, It = () => n.validityStyles !== void 0 ? n.validityStyles : z.validityStyles, ne = (e) => {
|
|
65
64
|
re.current = !0, e.focus(), window.setTimeout(() => re.current = !1, 30);
|
|
66
65
|
}, he = () => {
|
|
67
66
|
Q.current && ne(Q.current), n.adaptive && setTimeout(() => {
|
|
@@ -75,19 +74,19 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
75
74
|
(e = xe.current) != null && e.setCustomValidity && xe.current.setCustomValidity(
|
|
76
75
|
Ie().valid ? "" : n.validationMessage || Dn
|
|
77
76
|
);
|
|
78
|
-
},
|
|
77
|
+
}, _ = (e, r) => {
|
|
79
78
|
const o = k();
|
|
80
|
-
|
|
79
|
+
F(o, e, n.dataItemKey) || (n.value === void 0 && (r.data.value = e), t.current.updateComponentArgs({ value: e }), H.current = e, r.events.push({ type: "onChange" }));
|
|
81
80
|
}, K = (e) => {
|
|
82
81
|
var r;
|
|
83
82
|
(r = t == null ? void 0 : t.current) == null || r.applyState(e), H.current = void 0;
|
|
84
83
|
}, j = (e, r) => {
|
|
85
84
|
var c;
|
|
86
|
-
const { virtual: o, dataItemKey: l, defaultItem: d } = n, u = E(n), g = o ? o.skip : 0, m = k(), i = e === -1 && d !== void 0 ? d : u[e - g], f = !
|
|
87
|
-
|
|
85
|
+
const { virtual: o, dataItemKey: l, defaultItem: d } = n, u = E(n), g = o ? o.skip : 0, m = k(), i = e === -1 && d !== void 0 ? d : u[e - g], f = !F(i, m, l);
|
|
86
|
+
_(i, r), f && ((c = t == null ? void 0 : t.current) == null || c.triggerPageChangeCornerItems(i, r));
|
|
88
87
|
}, V = (e, r, o) => {
|
|
89
88
|
var x, h;
|
|
90
|
-
const { defaultItem: l, dataItemKey: d, virtual: u = { skip: 0, total: 0, pageSize: 0 } } = n, g = k(), m = E(n), i = (x = t == null ? void 0 : t.current) == null ? void 0 : x.vs, f = m.findIndex((w) =>
|
|
89
|
+
const { defaultItem: l, dataItemKey: d, virtual: u = { skip: 0, total: 0, pageSize: 0 } } = n, g = k(), m = E(n), i = (x = t == null ? void 0 : t.current) == null ? void 0 : x.vs, f = m.findIndex((w) => F(w, g, d)), c = (h = t == null ? void 0 : t.current) == null ? void 0 : h.navigation.navigate({
|
|
91
90
|
current: u.skip + f,
|
|
92
91
|
max: (i != null && i.enabled ? u.total : m.length) - 1,
|
|
93
92
|
min: l !== void 0 ? -1 : 0,
|
|
@@ -119,17 +118,17 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
119
118
|
filterable: d,
|
|
120
119
|
skipDisabledItems: u = !0
|
|
121
120
|
} = n, g = k(), m = E(n), i = n.filter ? n.filter : p.text;
|
|
122
|
-
return u && e && !i && !g ? m.findIndex((f) => !f.disabled && f[e]) : rt(g) && i === void 0 || d && i === "" ? m.findIndex((f) =>
|
|
121
|
+
return u && e && !i && !g ? m.findIndex((f) => !f.disabled && f[e]) : rt(g) && i === void 0 || d && i === "" ? m.findIndex((f) => F(f, g, r)) : i ? Se.current ? l(m, i, e) : m.findIndex((f) => F(f, g, r)) : o.skip === 0 ? 0 : -1;
|
|
123
122
|
}, ze = (e, r) => r !== void 0 && r !== -1 && e && e.length > 0 && e[r].disabled, we = () => {
|
|
124
123
|
const e = E(n), r = t.current.initState(), o = ye();
|
|
125
|
-
ze(e, o) && (
|
|
124
|
+
ze(e, o) && (_(null, r), K(r));
|
|
126
125
|
}, De = (e) => {
|
|
127
126
|
if (e.isPropagationStopped())
|
|
128
127
|
return;
|
|
129
128
|
const r = t.current.initState();
|
|
130
129
|
r.syntheticEvent = e, p.focused || (r.data.focused = !0), we(), t.current.togglePopup(r), K(r);
|
|
131
130
|
}, Oe = (e) => {
|
|
132
|
-
var
|
|
131
|
+
var T, ce, U, ue, Y, Re, et;
|
|
133
132
|
e && e.target instanceof Element && e.target.nodeName === "INPUT" && e.stopPropagation && e.stopPropagation();
|
|
134
133
|
const {
|
|
135
134
|
filterable: r,
|
|
@@ -141,21 +140,21 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
141
140
|
groupField: m = "",
|
|
142
141
|
textField: i,
|
|
143
142
|
skipDisabledItems: f = !0
|
|
144
|
-
} = n, c = E(n), x = k(), h = c.findIndex((S) =>
|
|
143
|
+
} = n, c = E(n), x = k(), h = c.findIndex((S) => F(S, x, g)), w = n.opened !== void 0 ? n.opened : p.opened, a = e.keyCode, N = a === I.home || a === I.end, b = a === I.up || a === I.down, $ = !w && (e.altKey && a === I.down || a === I.enter || a === I.space), ee = w && (e.altKey && a === I.up || a === I.esc), le = d && (a === I.left || a === I.right), de = b || le && !r || N, D = t.current.initState();
|
|
145
144
|
if (D.syntheticEvent = e, !o) {
|
|
146
|
-
if (N && ((
|
|
147
|
-
a === I.home ? u.skip !== 0 ? ((ce = t == null ? void 0 : t.current) == null || ce.triggerOnPageChange(D, 0, u.pageSize), A.current = !0) :
|
|
145
|
+
if (N && ((T = t == null ? void 0 : t.current) != null && T.vs.enabled))
|
|
146
|
+
a === I.home ? u.skip !== 0 ? ((ce = t == null ? void 0 : t.current) == null || ce.triggerOnPageChange(D, 0, u.pageSize), A.current = !0) : _(c[0], D) : u.skip < u.total - u.pageSize ? ((U = t == null ? void 0 : t.current) == null || U.triggerOnPageChange(
|
|
148
147
|
D,
|
|
149
148
|
u.total - u.pageSize,
|
|
150
149
|
u.pageSize
|
|
151
|
-
), A.current = !0) :
|
|
150
|
+
), A.current = !0) : _(c[c.length - 1], D);
|
|
152
151
|
else if (w && a === I.pageUp)
|
|
153
152
|
e.preventDefault(), (ue = t == null ? void 0 : t.current) == null || ue.scrollPopupByPageSize(-1);
|
|
154
153
|
else if (w && a === I.pageDown)
|
|
155
154
|
e.preventDefault(), (Y = t == null ? void 0 : t.current) == null || Y.scrollPopupByPageSize(1);
|
|
156
155
|
else if (w && a === I.enter) {
|
|
157
156
|
const S = ye();
|
|
158
|
-
ze(c, S) ? (
|
|
157
|
+
ze(c, S) ? (_(null, D), K(D)) : j(S, D), (Re = t == null ? void 0 : t.current) == null || Re.togglePopup(D), e.preventDefault();
|
|
159
158
|
} else if ($ || ee)
|
|
160
159
|
ee && we(), (et = t == null ? void 0 : t.current) == null || et.togglePopup(D), e.preventDefault();
|
|
161
160
|
else if (de) {
|
|
@@ -178,7 +177,7 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
178
177
|
let v = y.pop();
|
|
179
178
|
for (; v && v.disabled; )
|
|
180
179
|
v = y.pop();
|
|
181
|
-
S = v && c.findIndex((
|
|
180
|
+
S = v && c.findIndex((Fe) => Fe[i] === v[i]);
|
|
182
181
|
}
|
|
183
182
|
}
|
|
184
183
|
if (S !== void 0) {
|
|
@@ -204,7 +203,7 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
204
203
|
let v = y.pop();
|
|
205
204
|
for (; v && v.disabled; )
|
|
206
205
|
v = y.pop();
|
|
207
|
-
S = v && c.findIndex((
|
|
206
|
+
S = v && c.findIndex((Fe) => Fe[i] === v[i]);
|
|
208
207
|
}
|
|
209
208
|
}
|
|
210
209
|
if (S !== void 0) {
|
|
@@ -244,7 +243,7 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
244
243
|
}, xt = (e) => {
|
|
245
244
|
var o;
|
|
246
245
|
const r = t.current.initState();
|
|
247
|
-
r.syntheticEvent = e, (o = t == null ? void 0 : t.current) == null || o.togglePopup(r),
|
|
246
|
+
r.syntheticEvent = e, (o = t == null ? void 0 : t.current) == null || o.togglePopup(r), _(n.defaultItem, r), K(r);
|
|
248
247
|
}, St = () => {
|
|
249
248
|
const { textField: e, defaultItem: r, dataItemKey: o } = n, l = k();
|
|
250
249
|
return r !== void 0 && /* @__PURE__ */ s.createElement(
|
|
@@ -252,7 +251,7 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
252
251
|
{
|
|
253
252
|
defaultItem: r,
|
|
254
253
|
textField: e,
|
|
255
|
-
selected:
|
|
254
|
+
selected: F(l, r, o),
|
|
256
255
|
key: "defaultitemkey",
|
|
257
256
|
onClick: xt
|
|
258
257
|
}
|
|
@@ -282,7 +281,7 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
282
281
|
groupHeaderItemRender: l,
|
|
283
282
|
listNoDataRender: d,
|
|
284
283
|
itemRender: u
|
|
285
|
-
} = n, g = E(n), m =
|
|
284
|
+
} = n, g = E(n), m = M && M.uDropDownList, i = t.current.vs, f = o.skip, c = n.opened !== void 0 ? n.opened : p.opened, x = t.current.getPopupSettings(), h = `translateY(${i.translate}px)`, w = k();
|
|
286
285
|
return /* @__PURE__ */ s.createElement(
|
|
287
286
|
mn,
|
|
288
287
|
{
|
|
@@ -295,11 +294,10 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
295
294
|
valueField: r,
|
|
296
295
|
optionsGuid: Ge,
|
|
297
296
|
groupField: n.groupField,
|
|
298
|
-
groupMode: "modern",
|
|
299
297
|
listRef: (N) => {
|
|
300
298
|
i.list = t.current.list = N;
|
|
301
299
|
},
|
|
302
|
-
wrapperStyle: { maxHeight:
|
|
300
|
+
wrapperStyle: { maxHeight: q ? void 0 : x.height },
|
|
303
301
|
wrapperCssClass: L(P.listContent({ c: m })),
|
|
304
302
|
listStyle: i.enabled ? { transform: h } : void 0,
|
|
305
303
|
key: "listkey",
|
|
@@ -315,7 +313,7 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
315
313
|
}
|
|
316
314
|
);
|
|
317
315
|
}, Et = () => {
|
|
318
|
-
const { groupField: e } = n, r = E(n), o = n.opened !== void 0 ? n.opened : p.opened, l =
|
|
316
|
+
const { groupField: e } = n, r = E(n), o = n.opened !== void 0 ? n.opened : p.opened, l = M && M.uDropDownList, d = {
|
|
319
317
|
title: n.adaptiveTitle || n.label,
|
|
320
318
|
subTitle: n.adaptiveSubtitle,
|
|
321
319
|
expand: o,
|
|
@@ -324,7 +322,7 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
324
322
|
mobileFilter: Ve(!0)
|
|
325
323
|
};
|
|
326
324
|
let { group: u } = p;
|
|
327
|
-
return u === void 0 && e !== void 0 && (u = te(r[0], e)), /* @__PURE__ */ s.createElement(wn, { ...d }, /* @__PURE__ */ s.createElement(yn, null, /* @__PURE__ */ s.createElement("div", { className: L(P.listContainer({ c: l, popup: !1 })) },
|
|
325
|
+
return u === void 0 && e !== void 0 && (u = te(r[0], e)), /* @__PURE__ */ s.createElement(wn, { ...d }, /* @__PURE__ */ s.createElement(yn, null, /* @__PURE__ */ s.createElement("div", { className: L(P.listContainer({ c: l, popup: !1 })) }, Ft())));
|
|
328
326
|
}, Lt = () => {
|
|
329
327
|
p.focused && window.setTimeout(() => {
|
|
330
328
|
p.focused && t.current.wrapper && ne(t.current.wrapper);
|
|
@@ -332,7 +330,7 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
332
330
|
}, bt = (e) => {
|
|
333
331
|
"onMouseDownOutside" in (n.popupSettings || {}) && n.popupSettings.onMouseDownOutside.call(void 0, e);
|
|
334
332
|
}, Pt = () => {
|
|
335
|
-
const { header: e, footer: r, dir: o, groupField: l, groupStickyHeaderItemRender: d, list: u } = n, g = E(n), m = t.current, i = m.getPopupSettings(), f = n.opened !== void 0 ? n.opened : p.opened, c = i.width !== void 0 ? i.width : m.popupWidth, x =
|
|
333
|
+
const { header: e, footer: r, dir: o, groupField: l, groupStickyHeaderItemRender: d, list: u } = n, g = E(n), m = t.current, i = m.getPopupSettings(), f = n.opened !== void 0 ? n.opened : p.opened, c = i.width !== void 0 ? i.width : m.popupWidth, x = M && M.uDropDownList, h = {
|
|
336
334
|
dir: o !== void 0 ? o : m.dirCalculated,
|
|
337
335
|
width: c,
|
|
338
336
|
popupSettings: {
|
|
@@ -365,29 +363,29 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
365
363
|
)
|
|
366
364
|
},
|
|
367
365
|
St(),
|
|
368
|
-
!u && w && g.length !== 0 && /* @__PURE__ */ s.createElement(nt, { group: w,
|
|
366
|
+
!u && w && g.length !== 0 && /* @__PURE__ */ s.createElement(nt, { group: w, render: d }),
|
|
369
367
|
He()
|
|
370
|
-
), r && /* @__PURE__ */ s.createElement("div", { className: L(P.listFooter({ c: x })) }, r), Ke && /* @__PURE__ */ s.createElement(
|
|
371
|
-
},
|
|
372
|
-
const { header: e, footer: r, groupStickyHeaderItemRender: o, groupField: l, list: d } = n, u = E(n), g =
|
|
368
|
+
), r && /* @__PURE__ */ s.createElement("div", { className: L(P.listFooter({ c: x })) }, r), Ke && /* @__PURE__ */ s.createElement(on, { message: pt }));
|
|
369
|
+
}, Ft = () => {
|
|
370
|
+
const { header: e, footer: r, groupStickyHeaderItemRender: o, groupField: l, list: d } = n, u = E(n), g = M && M.uDropDownList;
|
|
373
371
|
let { group: m } = p;
|
|
374
372
|
return m === void 0 && l !== void 0 && (m = te(u[0], l)), /* @__PURE__ */ s.createElement(s.Fragment, null, e && /* @__PURE__ */ s.createElement("div", { className: L(P.listHeader({ c: g })) }, e), /* @__PURE__ */ s.createElement(
|
|
375
373
|
"div",
|
|
376
374
|
{
|
|
377
375
|
className: L("k-list", {
|
|
378
|
-
[`k-list-${
|
|
376
|
+
[`k-list-${q ? "lg" : sn[O] || O}`]: q || O
|
|
379
377
|
})
|
|
380
378
|
},
|
|
381
|
-
!d && m && u.length !== 0 && /* @__PURE__ */ s.createElement(nt, { group: m,
|
|
379
|
+
!d && m && u.length !== 0 && /* @__PURE__ */ s.createElement(nt, { group: m, render: o }),
|
|
382
380
|
He()
|
|
383
381
|
), r && /* @__PURE__ */ s.createElement("div", { className: "k-list-footer" }, r));
|
|
384
|
-
},
|
|
382
|
+
}, Mt = (e) => {
|
|
385
383
|
const { dataItemKey: r } = n, o = E(n), l = k();
|
|
386
384
|
let d = o.map((b, $) => ({ item: b, itemIndex: $ }));
|
|
387
|
-
const u =
|
|
385
|
+
const u = G.current.word, g = G.current.last, m = gn(u, g);
|
|
388
386
|
let i = d.length, f = Math.max(
|
|
389
387
|
0,
|
|
390
|
-
o.findIndex((b) =>
|
|
388
|
+
o.findIndex((b) => F(b, l, r))
|
|
391
389
|
), c;
|
|
392
390
|
n.defaultItem && (c = { item: n.defaultItem, itemIndex: -1 }, i += 1, f += 1), f += m ? 1 : 0, d = vn(d, f, c);
|
|
393
391
|
let x, h, w, a = 0;
|
|
@@ -404,21 +402,21 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
404
402
|
b.syntheticEvent = e, j(a, b), K(b), H.current = void 0;
|
|
405
403
|
}
|
|
406
404
|
}, Kt = (e) => {
|
|
407
|
-
clearTimeout(Be.current), n.filterable || (Be.current = window.setTimeout(() =>
|
|
405
|
+
clearTimeout(Be.current), n.filterable || (Be.current = window.setTimeout(() => G.current.word = "", mt), Mt(e));
|
|
408
406
|
}, Nt = (e) => {
|
|
409
407
|
re.current || t.current.handleFocus(e);
|
|
410
408
|
}, Tt = (e) => {
|
|
411
409
|
if (re.current || !p.focused)
|
|
412
410
|
return;
|
|
413
411
|
const r = n.opened !== void 0 ? n.opened : p.opened, o = t.current.initState();
|
|
414
|
-
o.syntheticEvent = e, o.data.focused = !1, o.events.push({ type: "onBlur" }), r && we(), r && !
|
|
412
|
+
o.syntheticEvent = e, o.data.focused = !1, o.events.push({ type: "onBlur" }), r && we(), r && !q && t.current.togglePopup(o), K(o);
|
|
415
413
|
}, zt = (e) => {
|
|
416
414
|
if (n.filterable || e.which === 0 || e.keyCode === I.enter)
|
|
417
415
|
return;
|
|
418
416
|
let r = String.fromCharCode(e.charCode || e.keyCode);
|
|
419
|
-
pe && (r = r.toLowerCase()), r === " " && e.preventDefault(),
|
|
420
|
-
word:
|
|
421
|
-
last:
|
|
417
|
+
pe && (r = r.toLowerCase()), r === " " && e.preventDefault(), G.current = {
|
|
418
|
+
word: G.current.word + r,
|
|
419
|
+
last: G.current.last + r
|
|
422
420
|
}, Kt(e);
|
|
423
421
|
}, Ot = () => {
|
|
424
422
|
const e = t.current.initState();
|
|
@@ -456,7 +454,7 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
456
454
|
ut,
|
|
457
455
|
() => Ae.current
|
|
458
456
|
);
|
|
459
|
-
const Be = s.useRef(null),
|
|
457
|
+
const Be = s.useRef(null), G = s.useRef({ word: "", last: "" }), re = s.useRef(!1), H = s.useRef(null), A = s.useRef(!1), Se = s.useRef(!1), B = s.useRef({}), Ce = s.useRef({}), t = s.useRef(
|
|
460
458
|
new dt({
|
|
461
459
|
props: n,
|
|
462
460
|
setState: () => {
|
|
@@ -488,15 +486,15 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
488
486
|
if ((f = t == null ? void 0 : t.current) == null || f.didUpdate(), (c = t == null ? void 0 : t.current) != null && c.getPopupSettings().animate || i && he(), r && r.total !== u)
|
|
489
487
|
(x = t == null ? void 0 : t.current) == null || x.vs.calcScrollElementHeight(), (h = t == null ? void 0 : t.current) == null || h.vs.reset();
|
|
490
488
|
else {
|
|
491
|
-
const
|
|
492
|
-
let
|
|
493
|
-
o !== "" &&
|
|
494
|
-
const ue = !
|
|
495
|
-
i && r ? (N = t == null ? void 0 : t.current) == null || N.scrollToVirtualItem(r,
|
|
489
|
+
const T = k(), ce = B.current.value !== void 0 ? B.current.value : Ce.current.value;
|
|
490
|
+
let U = d.findIndex((Y) => F(Y, T, e));
|
|
491
|
+
o !== "" && T && l && (U = (a = (w = t == null ? void 0 : t.current) == null ? void 0 : w.getGroupedDataModernMode(d, o)) == null ? void 0 : a.map((Y) => Y[l]).indexOf(T[l]));
|
|
492
|
+
const ue = !F(ce, T, e);
|
|
493
|
+
i && r ? (N = t == null ? void 0 : t.current) == null || N.scrollToVirtualItem(r, U) : i && !r ? (he(), d && d.length !== 0 && ((b = t == null ? void 0 : t.current) == null || b.resetGroupStickyHeader(d[0][o], {
|
|
496
494
|
setState: Z,
|
|
497
495
|
group: p.group,
|
|
498
496
|
state: p
|
|
499
|
-
})), ($ = t == null ? void 0 : t.current) == null || $.scrollToItem(
|
|
497
|
+
})), ($ = t == null ? void 0 : t.current) == null || $.scrollToItem(U)) : g && m && T && ue && !A.current ? (le = t == null ? void 0 : t.current) == null || le.scrollToItem(U, (ee = t == null ? void 0 : t.current) == null ? void 0 : ee.vs.enabled) : g && m && 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 && ((D = t == null ? void 0 : t.current) == null || D.vs.scrollToEnd()));
|
|
500
498
|
}
|
|
501
499
|
A.current = !1, Ce.current = p, B.current = n, Te();
|
|
502
500
|
}), s.useEffect(() => {
|
|
@@ -515,18 +513,18 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
515
513
|
label: Le,
|
|
516
514
|
dir: Wt,
|
|
517
515
|
virtual: W,
|
|
518
|
-
adaptive:
|
|
516
|
+
adaptive: Sn,
|
|
519
517
|
dataItemKey: qt,
|
|
520
518
|
disabled: ie,
|
|
521
519
|
loading: $e,
|
|
522
520
|
iconClassName: Ye,
|
|
523
521
|
svgIcon: Ut,
|
|
524
522
|
valueRender: je
|
|
525
|
-
} = n, be = n.opened !== void 0 ? n.opened : p.opened, se = k(), Pe = te(se, n.textField), Je = !It() || Ie().valid, ae = t.current, _t = ae.vs, R =
|
|
523
|
+
} = n, be = n.opened !== void 0 ? n.opened : p.opened, se = k(), Pe = te(se, n.textField), Je = !It() || Ie().valid, ae = t.current, _t = ae.vs, R = M && M.uDropDownList;
|
|
526
524
|
_t.enabled = W !== void 0;
|
|
527
|
-
const Qe =
|
|
525
|
+
const Qe = tn(), q = !!(ke && Qe && ke <= Qe.medium && n.adaptive);
|
|
528
526
|
W !== void 0 && (ae.vs.skip = W.skip, ae.vs.total = W.total, ae.vs.pageSize = W.pageSize);
|
|
529
|
-
const Gt = E(n), { focused: $t } = p, Yt = Gt.findIndex((e) =>
|
|
527
|
+
const Gt = E(n), { focused: $t } = p, Yt = Gt.findIndex((e) => F(e, se, qt)), Xe = /* @__PURE__ */ s.createElement("span", { id: _e, className: L(P.inputInner({ c: R })) }, Pe && /* @__PURE__ */ s.createElement("span", { className: L(P.inputText({ c: R })) }, Pe)), jt = je !== void 0 ? je.call(void 0, Xe, se) : Xe, Ze = /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(
|
|
530
528
|
"span",
|
|
531
529
|
{
|
|
532
530
|
ref: yt,
|
|
@@ -549,9 +547,9 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
549
547
|
onMouseDown: be ? (e) => {
|
|
550
548
|
e.target.nodeName !== "INPUT" && (ne(t.current.wrapper), e.preventDefault());
|
|
551
549
|
} : void 0,
|
|
552
|
-
onFocus:
|
|
550
|
+
onFocus: q ? (e) => De(e) : Nt,
|
|
553
551
|
onBlur: Tt,
|
|
554
|
-
tabIndex:
|
|
552
|
+
tabIndex: nn(ft, ie),
|
|
555
553
|
accessKey: n.accessKey,
|
|
556
554
|
onKeyDown: Oe,
|
|
557
555
|
onKeyPress: zt,
|
|
@@ -571,7 +569,7 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
571
569
|
title: n.title
|
|
572
570
|
},
|
|
573
571
|
jt,
|
|
574
|
-
$e && /* @__PURE__ */ s.createElement(
|
|
572
|
+
$e && /* @__PURE__ */ s.createElement(rn, { className: L(P.loadingIcon({ c: R })), name: "loading" }),
|
|
575
573
|
/* @__PURE__ */ s.createElement(
|
|
576
574
|
In,
|
|
577
575
|
{
|
|
@@ -581,16 +579,14 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
581
579
|
size: O,
|
|
582
580
|
fillMode: me,
|
|
583
581
|
className: L(P.inputButton({ c: R })),
|
|
584
|
-
rounded: null,
|
|
585
|
-
themeColor: "base",
|
|
586
582
|
iconClass: Ye,
|
|
587
583
|
svgIcon: Ye ? void 0 : Ut || dn,
|
|
588
584
|
onMouseDown: (e) => p.focused && e.preventDefault()
|
|
589
585
|
}
|
|
590
586
|
),
|
|
591
587
|
wt(se),
|
|
592
|
-
!
|
|
593
|
-
),
|
|
588
|
+
!q && Pt()
|
|
589
|
+
), q && Et());
|
|
594
590
|
return Le ? /* @__PURE__ */ s.createElement(
|
|
595
591
|
ln,
|
|
596
592
|
{
|
|
@@ -603,11 +599,11 @@ const Dn = "Please select a value from the list!", Fe = s.forwardRef((ct, ut) =>
|
|
|
603
599
|
}
|
|
604
600
|
) : Ze;
|
|
605
601
|
});
|
|
606
|
-
|
|
602
|
+
Me.propTypes = {
|
|
607
603
|
delay: C.number,
|
|
608
604
|
ignoreCase: C.bool,
|
|
609
605
|
iconClassName: C.string,
|
|
610
|
-
svgIcon:
|
|
606
|
+
svgIcon: an,
|
|
611
607
|
defaultItem: C.any,
|
|
612
608
|
valueRender: C.func,
|
|
613
609
|
valueMap: C.func,
|
|
@@ -623,22 +619,21 @@ Fe.propTypes = {
|
|
|
623
619
|
list: C.any,
|
|
624
620
|
skipDisabledItems: C.bool
|
|
625
621
|
};
|
|
626
|
-
const
|
|
622
|
+
const z = {
|
|
627
623
|
delay: 500,
|
|
628
624
|
tabIndex: 0,
|
|
629
625
|
ignoreCase: !0,
|
|
630
626
|
...dt.defaultProps,
|
|
631
627
|
required: !1,
|
|
632
|
-
size:
|
|
633
|
-
rounded:
|
|
634
|
-
fillMode:
|
|
635
|
-
groupMode: "modern"
|
|
628
|
+
size: void 0,
|
|
629
|
+
rounded: void 0,
|
|
630
|
+
fillMode: void 0
|
|
636
631
|
};
|
|
637
|
-
|
|
638
|
-
const xn =
|
|
639
|
-
|
|
632
|
+
Me.displayName = "KendoReactDropDownList";
|
|
633
|
+
const xn = Jt();
|
|
634
|
+
Me.displayName = "KendoReactDropDownList";
|
|
640
635
|
export {
|
|
641
|
-
|
|
636
|
+
Me as DropDownList,
|
|
642
637
|
xn as DropDownListPropsContext,
|
|
643
|
-
|
|
638
|
+
z as dropDownListDefaultProps
|
|
644
639
|
};
|