@progress/kendo-react-dropdowns 8.3.0-develop.4 → 8.3.0-develop.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +284 -279
- package/common/ClearButton.js +1 -1
- package/common/ClearButton.mjs +21 -27
- package/common/GroupStickyHeader.js +1 -1
- package/common/GroupStickyHeader.mjs +11 -12
- package/common/List.js +1 -1
- package/common/List.mjs +88 -92
- package/common/ListContainer.js +1 -1
- package/common/ListContainer.mjs +21 -23
- package/common/ListDefaultItem.js +1 -1
- package/common/ListDefaultItem.mjs +20 -25
- package/common/ListFilter.js +1 -1
- package/common/ListFilter.mjs +19 -19
- package/common/ListGroupItem.js +1 -1
- package/common/ListGroupItem.mjs +22 -22
- package/common/ListItem.js +1 -1
- package/common/ListItem.mjs +37 -39
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/index.d.mts +15 -19
- package/index.d.ts +15 -19
- package/package-metadata.mjs +1 -1
- package/package.json +9 -9
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("react"),w=require("prop-types"),p=require("@progress/kendo-react-common"),J=require("@progress/kendo-react-labels"),B=require("@progress/kendo-svg-icons"),Q=require("../common/ListContainer.js"),X=require("../common/ListFilter.js"),H=require("../common/GroupStickyHeader.js"),Z=require("../common/ListDefaultItem.js"),ee=require("../common/List.js"),R=require("../common/DropDownBase.js"),c=require("../common/utils.js"),te=require("../package-metadata.js"),W=require("@progress/kendo-react-buttons"),se=require("@progress/kendo-react-intl"),T=require("../messages/index.js"),L=require("../common/constants.js"),q=require("@progress/kendo-react-layout");function ie(K){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(K){for(const e in K)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(K,e);Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:()=>K[e]})}}return s.default=K,Object.freeze(s)}const u=ie(Y),ae="Please select a value from the list!",{sizeMap:z,roundedMap:oe}=p.kendoThemeMaps,E=class E extends u.Component{constructor(s){super(s),this.state={},this._element=null,this.base=new R(this),this.searchState={word:"",last:""},this._select=null,this._skipFocusEvent=!1,this._filterInput=null,this._navigated=!1,this._lastKeypressIsFilter=!1,this.itemHeight=0,this.focus=()=>{this.base.wrapper&&this.base.wrapper.focus({preventScroll:!0})},this.handleItemSelect=(e,t)=>{const{virtual:a,dataItemKey:h,defaultItem:n}=this.props,o=c.getFilteredData(this.props),v=a?a.skip:0,l=e===-1&&n!==void 0?n:o[e-v],i=!c.areSame(l,this.value,h);this.triggerOnChange(l,t),i&&this.base.triggerPageChangeCornerItems(l,t)},this.componentRef=e=>{this._element=e,this.base.wrapper=e},this.dummySelect=e=>u.createElement("select",{name:this.props.name,ref:t=>{this._select=t},tabIndex:-1,"aria-hidden":!0,title:this.props.label,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},u.createElement("option",{value:this.props.valueMap?this.props.valueMap.call(void 0,e):e})),this.renderListContainer=()=>{const{header:e,footer:t,dir:a,size:h,groupField:n,groupStickyHeaderItemRender:o,list:v}=this.props,l=c.getFilteredData(this.props),i=this.base,g=i.getPopupSettings(),r=this.props.opened!==void 0?this.props.opened:this.state.opened,I=g.width!==void 0?g.width:i.popupWidth,y={dir:a!==void 0?a:i.dirCalculated,width:I,popupSettings:{...g,popupClass:p.classNames(g.popupClass,"k-list-container","k-dropdownlist-popup"),anchor:g.anchor||this.element,show:r,onOpen:this.onPopupOpened,onClose:this.onPopupClosed},itemsCount:[l.length]};let{group:f}=this.state;return f===void 0&&n!==void 0&&(f=c.getItemValue(l[0],n)),u.createElement(Q,{...y},this.renderListFilter(),e&&u.createElement("div",{className:"k-list-header"},e),u.createElement("div",{className:p.classNames("k-list",{[`k-list-${z[h]||h}`]:h,"k-virtual-list":this.base.vs.enabled})},this.renderDefaultItem(),!v&&f&&l.length!==0&&u.createElement(H,{group:f,groupMode:"modern",render:o}),this.renderList()),t&&u.createElement("div",{className:"k-list-footer"},t))},this.renderList=()=>{const{textField:e,dataItemKey:t,virtual:a={skip:0,total:void 0},groupHeaderItemRender:h,listNoDataRender:n,itemRender:o}=this.props,v=c.getFilteredData(this.props),l=this.base.vs,i=a.skip,g=this.props.opened!==void 0?this.props.opened:this.state.opened,r=this.base.getPopupSettings(),I=`translateY(${l.translate}px)`;return u.createElement(ee,{id:this._listboxId,show:g,data:v.slice(),focusedIndex:this.getFocusedIndex(),value:this.value,textField:e,valueField:t,optionsGuid:this._guid,groupField:this.props.groupField,groupMode:"modern",listRef:y=>l.list=this.base.list=y,wrapperStyle:{maxHeight:r.height},wrapperCssClass:"k-list-content",listStyle:l.enabled?{transform:I}:void 0,key:"listkey",skip:i,onClick:this.handleItemClick,itemRender:o,groupHeaderItemRender:h,noDataRender:n,onScroll:this.onScroll,wrapperRef:l.scrollerRef,scroller:this.base.renderScrollElement(),ariaSetSize:a.total})},this.onScroll=e=>{const{vs:t,list:a}=this.base;t.scrollHandler(e);const{groupField:h}=this.props;let n=c.getFilteredData(this.props);if(!(!h||!n.length)&&h){const o=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:a?a.children[0].offsetHeight:0),l=e.target.scrollTop-t.skip*o;n=this.base.getGroupedDataModernMode(n,h);let i=n[0][h];for(let g=1;g<n.length&&!(o*g>l);g++)n[g]&&n[g][h]&&(i=n[g][h]);i!==this.state.group&&this.setState({group:i})}},this.renderListFilter=()=>{const e=this.props.filter!==void 0?this.props.filter:this.state.text;return this.props.filterable&&u.createElement(X,{value:e,ref:t=>this._filterInput=t&&t.element,onChange:this.handleListFilterChange,onKeyDown:this.handleKeyDown,size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode,renderListFilterWrapper:!0})},this.renderDefaultItem=()=>{const{textField:e,defaultItem:t,dataItemKey:a}=this.props;return t!==void 0&&u.createElement(Z,{defaultItem:t,textField:e,selected:c.areSame(this.value,t,a),key:"defaultitemkey",onClick:this.handleDefaultItemClick})},this.search=e=>{clearTimeout(this._typingTimeout),this.props.filterable||(this._typingTimeout=window.setTimeout(()=>this.searchState.word="",this.props.delay),this.selectNext(e))},this.selectNext=e=>{const{dataItemKey:t}=this.props,a=c.getFilteredData(this.props);let h=a.map((D,_)=>({item:D,itemIndex:_}));const n=this.searchState.word,o=this.searchState.last,v=c.sameCharsOnly(n,o);let l=h.length,i=Math.max(0,a.findIndex(D=>c.areSame(D,this.value,t))),g;this.props.defaultItem&&(g={item:this.props.defaultItem,itemIndex:-1},l+=1,i+=1),i+=v?1:0,h=c.shuffleData(h,i,g);let r,I,y,f=0;const{textField:d,ignoreCase:x}=this.props;for(;f<l;f++)if(r=c.getItemValue(h[f].item,d),I=v&&c.matchText(r,o,x),y=c.matchText(r,n,x),I||y){f=h[f].itemIndex;break}if(f!==l){const D=this.base.initState();D.syntheticEvent=e,this.handleItemSelect(f,D),this.applyState(D),this._valueDuringOnChange=void 0}},this.handleKeyDown=e=>{e&&e.target instanceof Element&&e.target.nodeName==="INPUT"&&e.stopPropagation&&e.stopPropagation();const{filterable:t,disabled:a,defaultItem:h,leftRightKeysNavigation:n=!0,virtual:o={skip:0,total:0,pageSize:0},dataItemKey:v,groupField:l="",textField:i,skipDisabledItems:g=!0}=this.props,r=c.getFilteredData(this.props),I=this.value,y=r.findIndex(k=>c.areSame(k,I,v)),f=this.props.opened!==void 0?this.props.opened:this.state.opened,d=e.keyCode,x=d===p.Keys.home||d===p.Keys.end,D=d===p.Keys.up||d===p.Keys.down,_=!f&&(e.altKey&&d===p.Keys.down||d===p.Keys.enter||d===p.Keys.space),C=f&&(e.altKey&&d===p.Keys.up||d===p.Keys.esc),P=n&&(d===p.Keys.left||d===p.Keys.right),M=D||P&&!t||x,S=this.base.initState();if(S.syntheticEvent=e,!a){if(x&&this.base.vs.enabled)d===p.Keys.home?o.skip!==0?(this.base.triggerOnPageChange(S,0,o.pageSize),this._navigated=!0):this.triggerOnChange(r[0],S):o.skip<o.total-o.pageSize?(this.base.triggerOnPageChange(S,o.total-o.pageSize,o.pageSize),this._navigated=!0):this.triggerOnChange(r[r.length-1],S);else if(f&&d===p.Keys.pageUp)e.preventDefault(),this.base.scrollPopupByPageSize(-1);else if(f&&d===p.Keys.pageDown)e.preventDefault(),this.base.scrollPopupByPageSize(1);else if(f&&d===p.Keys.enter){const k=this.getFocusedIndex();this.haveFocusedItemAndDataNotEmpty(r,k)?(this.triggerOnChange(null,S),this.applyState(S)):this.handleItemSelect(k,S),this.base.togglePopup(S),e.preventDefault()}else if(_||C)C&&this.resetValueIfDisabledItem(),this.base.togglePopup(S),e.preventDefault();else if(M){if(this._lastKeypressIsFilter=!1,l!==""&&i)if(!g&&f)this.onNavigate(S,d);else{let k;if(d===p.Keys.down||d===p.Keys.right){const b=r.slice(y+1).find(m=>!m.disabled&&m[i]);k=b&&r.findIndex(m=>m[i]===b[i])}else if(d===p.Keys.up||d===p.Keys.left){let b;if(y===0&&h)k=-1;else if(y===-1)b=r,k=r.findIndex(m=>!m.disabled&&m[i]);else{b=r.slice(0,y);let m=b.pop();for(;m&&m.disabled;)m=b.pop();k=m&&r.findIndex(N=>N[i]===m[i])}}if(k!==void 0){const b=k-y;this.onNavigate(S,d,b)}else k===void 0&&r.findIndex(b=>b[i]===I[i])===r.length-1&&this.onNavigate(S,d)}else if(!g&&f||x)this.onNavigate(S,d);else if(i){let k;if(d===p.Keys.down||d===p.Keys.right){const b=r.slice(y+1).find(m=>!m.disabled&&m[i]);k=b&&r.findIndex(m=>m[i]===b[i])}else if(d===p.Keys.up||d===p.Keys.left){let b;if(y===0&&h)k=-1;else if(y===-1)b=r,k=r.find(m=>!m.disabled&&m[i]);else{b=r.slice(0,y);let m=b.pop();for(;m&&m.disabled;)m=b.pop();k=m&&r.findIndex(N=>N[i]===m[i])}}if(k!==void 0){const b=k-y;this.onNavigate(S,d,b)}else k===void 0&&r.findIndex(b=>b[i]===I[i])===r.length-1&&this.onNavigate(S,d)}else this.onNavigate(S,d);e.preventDefault()}this.applyState(S)}},this.handleItemClick=(e,t)=>{this.base.handleItemClick(e,t),this._valueDuringOnChange=void 0},this.handleFocus=e=>{this._skipFocusEvent||this.base.handleFocus(e)},this.handleBlur=e=>{if(this._skipFocusEvent||!this.state.focused)return;const t=this.props.opened!==void 0?this.props.opened:this.state.opened,{adaptive:a}=this.props,{windowWidth:h=0}=this.state,n=h<=L.MOBILE_MEDIUM_DEVISE&&a,o=this.base.initState();o.syntheticEvent=e,o.data.focused=!1,o.events.push({type:"onBlur"}),t&&this.resetValueIfDisabledItem(),t&&!n&&this.base.togglePopup(o),this.applyState(o)},this.handleDefaultItemClick=e=>{const t=this.base.initState();t.syntheticEvent=e,this.base.togglePopup(t),this.triggerOnChange(this.props.defaultItem,t),this.applyState(t)},this.handleWrapperClick=e=>{if(e.isPropagationStopped())return;const t=this.base.initState();t.syntheticEvent=e,this.state.focused||(t.data.focused=!0),this.resetValueIfDisabledItem(),this.base.togglePopup(t),this.applyState(t)},this.handleKeyPress=e=>{if(this.props.filterable||e.which===0||e.keyCode===p.Keys.enter)return;let t=String.fromCharCode(e.charCode||e.keyCode);this.props.ignoreCase&&(t=t.toLowerCase()),t===" "&&e.preventDefault(),this.searchState={word:this.searchState.word+t,last:this.searchState.last+t},this.search(e)},this.handleListFilterChange=e=>{const t=this.base.initState();t.syntheticEvent=e.syntheticEvent,this.props.filter===void 0&&(t.data.text=e.target.value),this.base.filterChanged(e.target.value,t),this._lastKeypressIsFilter=!0,this.applyState(t),this.setState({group:void 0})},this.onPopupOpened=()=>{this._filterInput&&this.focusElement(this._filterInput),this.props.adaptive&&setTimeout(()=>{this._filterInput&&this.focusElement(this._filterInput)},300)},this.onPopupClosed=()=>{this.state.focused&&window.setTimeout(()=>{this.state.focused&&this.base.wrapper&&this.focusElement(this.base.wrapper)})},this.setValidity=()=>{this._select&&this._select.setCustomValidity&&this._select.setCustomValidity(this.validity.valid?"":this.props.validationMessage||ae)},p.validatePackage(te.packageMetadata)}get _inputId(){return this.props.id+"-accessibility-id"}get _listboxId(){return this.props.id+"-listbox-id"}get _guid(){return this.props.id+"-guid"}get document(){if(p.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get value(){let s;return this._valueDuringOnChange!==void 0?s=this._valueDuringOnChange:this.props.value!==void 0?s=this.props.value:this.state.value!==void 0?s=this.state.value:this.props.defaultValue!==void 0&&(s=this.props.defaultValue),!c.isPresent(s)&&this.props.defaultItem!==void 0&&(s=this.props.defaultItem),s}get index(){const{dataItemKey:s}=this.props,e=c.getFilteredData(this.props),t=this.value;return e.findIndex(a=>c.areSame(a,t,s))}get name(){return this.props.name}get validity(){const s=this.props.validationMessage!==void 0,e=!this.required||this.value!==null&&this.value!==""&&this.value!==void 0,t=this.props.valid!==void 0?this.props.valid:e;return{customError:s,valid:t,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:E.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:E.defaultProps.required}componentDidUpdate(s,e){var r;const{dataItemKey:t,virtual:a,groupField:h="",textField:n}=this.props,o=c.getFilteredData(this.props),v=s.virtual?s.virtual.total:0,l=this.props.opened!==void 0?this.props.opened:this.state.opened,i=s.opened!==void 0?s.opened:e.opened,g=!i&&l;if(this.base.didUpdate(),this.base.getPopupSettings().animate||g&&this.onPopupOpened(),a&&a.total!==v)this.base.vs.calcScrollElementHeight(),this.base.vs.reset();else{const I=this.value,y=s.value!==void 0?s.value:e.value;let f=o.findIndex(x=>c.areSame(x,I,t));h!==""&&I&&n&&(f=(r=this.base.getGroupedDataModernMode(o,h))==null?void 0:r.map(x=>x[n]).indexOf(I[n]));const d=!c.areSame(y,I,t);g&&a?this.base.scrollToVirtualItem(a,f):g&&!a?(this.onPopupOpened(),o&&o.length!==0&&this.base.resetGroupStickyHeader(o[0][h],this),this.base.scrollToItem(f)):l&&i&&I&&d&&!this._navigated?this.base.scrollToItem(f,this.base.vs.enabled):l&&i&&this._navigated&&(this._navigated&&a&&a.skip===0?this.base.vs.reset():this._navigated&&a&&a.skip===a.total-a.pageSize&&this.base.vs.scrollToEnd())}this._navigated=!1,this.setValidity()}componentDidMount(){var s;this.observerResize=p.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.base.didMount(),this.setValidity(),(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentWillUnmount(){var s;(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.disconnect()}render(){const s=se.provideLocalizationService(this).toLanguageString(T.dropDownListArrowBtnAriaLabel,T.messages[T.dropDownListArrowBtnAriaLabel]),{style:e,className:t,label:a,dir:h,virtual:n,size:o,rounded:v,fillMode:l,adaptive:i}=this.props,{windowWidth:g=0}=this.state,r=this.props.opened!==void 0?this.props.opened:this.state.opened,I=this.value,y=c.getItemValue(I,this.props.textField),f=!this.validityStyles||this.validity.valid,d=this.base,x=d.vs,D=g<=L.MOBILE_MEDIUM_DEVISE&&i;x.enabled=n!==void 0,n!==void 0&&(d.vs.skip=n.skip,d.vs.total=n.total,d.vs.pageSize=n.pageSize);const{dataItemKey:_,disabled:C,tabIndex:P,loading:M,iconClassName:S,svgIcon:k,valueRender:b}=this.props,m=c.getFilteredData(this.props),{focused:N}=this.state,$=m.findIndex(F=>c.areSame(F,I,_)),V=u.createElement("span",{id:this._inputId,className:"k-input-inner"},y&&u.createElement("span",{className:"k-input-value-text"},y)),j=b!==void 0?b.call(void 0,V,I):V,A=u.createElement(u.Fragment,null,u.createElement("span",{ref:this.componentRef,className:p.classNames("k-dropdownlist k-picker",t,{[`k-picker-${z[o]||o}`]:o,[`k-rounded-${oe[v]||v}`]:v,[`k-picker-${l}`]:l,"k-focus":N,"k-disabled":C,"k-invalid":!f,"k-loading":M,"k-required":this.required}),style:a?{...e,width:void 0}:e,dir:h,onMouseDown:r?F=>{F.target.nodeName!=="INPUT"&&(this.focusElement(this.base.wrapper),F.preventDefault())}:void 0,onFocus:this.handleFocus,onBlur:this.handleBlur,tabIndex:p.getTabIndex(P,C),accessKey:this.props.accessKey,onKeyDown:this.handleKeyDown,onKeyPress:this.handleKeyPress,onClick:C?void 0:this.handleWrapperClick,role:"combobox","aria-required":this.required,"aria-disabled":C||void 0,"aria-haspopup":"listbox","aria-expanded":r||!1,"aria-owns":this._listboxId,"aria-activedescendant":r?"option-"+this._guid+"-"+($+(n?n.skip:0)):void 0,"aria-label":this.props.ariaLabel||this.props.label,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy||this._inputId,"aria-controls":this._listboxId,id:this.props.id,title:this.props.title},j,M&&u.createElement(p.IconWrap,{className:"k-input-loading-icon",name:"loading"}),u.createElement(W.Button,{tabIndex:-1,type:"button","aria-label":s,"aria-hidden":!0,size:o,fillMode:l,iconClass:S,className:"k-input-button",rounded:null,themeColor:"base",icon:S?void 0:"caret-alt-down",svgIcon:k||B.caretAltDownIcon,onMouseDown:F=>this.state.focused&&F.preventDefault()}),this.dummySelect(I),!D&&this.renderListContainer()),D&&this.renderAdaptiveListContainer());return a?u.createElement(J.FloatingLabel,{label:a,editorValue:y,editorValid:f,editorDisabled:this.props.disabled,style:{width:e?e.width:void 0},children:A}):A}onNavigate(s,e,t){const{defaultItem:a,dataItemKey:h,virtual:n={skip:0,total:0,pageSize:0}}=this.props,o=c.getFilteredData(this.props),v=this.base.vs,l=this.value,i=o.findIndex(r=>c.areSame(r,l,h)),g=this.base.navigation.navigate({current:n.skip+i,max:(v.enabled?n.total:o.length)-1,min:a!==void 0?-1:0,keyCode:e,skipItems:t||void 0});g!==void 0&&this.handleItemSelect(g,s),this.applyState(s)}renderAdaptiveListContainer(){const{windowWidth:s=0}=this.state,{header:e,footer:t,size:a,adaptiveTitle:h,groupField:n,groupStickyHeaderItemRender:o,list:v}=this.props,l=c.getFilteredData(this.props),i=this.props.opened!==void 0?this.props.opened:this.state.opened,g={navigatable:!1,navigatableElements:[],expand:i,animation:!0,onClose:I=>this.handleWrapperClick(I),animationStyles:s<=L.MOBILE_SMALL_DEVISE?{top:0,width:"100%",height:"100%"}:void 0,className:s<=L.MOBILE_SMALL_DEVISE?"k-adaptive-actionsheet k-actionsheet-fullscreen":"k-adaptive-actionsheet k-actionsheet-bottom"};let{group:r}=this.state;return r===void 0&&n!==void 0&&(r=c.getItemValue(l[0],n)),u.createElement(q.ActionSheet,{...g},u.createElement(q.ActionSheetHeader,{className:"k-text-center"},u.createElement("div",{className:"k-actionsheet-titlebar-group k-hbox"},u.createElement("div",{className:"k-actionsheet-title"},u.createElement("div",null,h)),u.createElement("div",{className:"k-actionsheet-actions"},u.createElement(W.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:this.handleWrapperClick,icon:"x",svgIcon:B.xIcon}))),u.createElement("div",{className:"k-actionsheet-titlebar-group k-actionsheet-filter"},this.renderListFilter())),u.createElement(q.ActionSheetContent,{className:"!k-overflow-hidden"},e&&u.createElement("div",{className:"k-list-header"},e),u.createElement("div",{className:p.classNames("k-list",{[`k-list-${z[a]||a}`]:a,"k-virtual-list":this.base.vs.enabled})},this.renderDefaultItem(),!v&&r&&l.length!==0&&u.createElement(H,{group:r,groupMode:"modern",render:o}),this.renderList()),t&&u.createElement("div",{className:"k-list-footer"},t)))}getFocusedIndex(){const s=this.value,{textField:e,dataItemKey:t,virtual:a={skip:0},focusedItemIndex:h=c.itemIndexStartsWith,filterable:n,skipDisabledItems:o=!0}=this.props,v=c.getFilteredData(this.props),l=this.props.filter?this.props.filter:this.state.text;return o&&e&&!l&&!s?v.findIndex(i=>!i.disabled&&i[e]):c.isPresent(s)&&l===void 0||n&&l===""?v.findIndex(i=>c.areSame(i,s,t)):l?this._lastKeypressIsFilter?h(v,l,e):v.findIndex(i=>c.areSame(i,s,t)):a.skip===0?0:-1}focusElement(s){this._skipFocusEvent=!0,s.focus(),window.setTimeout(()=>this._skipFocusEvent=!1,30)}triggerOnChange(s,e){c.areSame(this.value,s,this.props.dataItemKey)||(this.props.value===void 0&&(e.data.value=s),this._valueDuringOnChange=s,e.events.push({type:"onChange"}))}applyState(s){this.base.applyState(s),this._valueDuringOnChange=void 0}calculateMedia(s){for(const e of s)this.setState({windowWidth:e.target.clientWidth})}resetValueIfDisabledItem(){const s=c.getFilteredData(this.props),e=this.base.initState(),t=this.getFocusedIndex();this.haveFocusedItemAndDataNotEmpty(s,t)&&(this.triggerOnChange(null,e),this.applyState(e))}haveFocusedItemAndDataNotEmpty(s,e){return e!==void 0&&e!==-1&&s&&s.length>0&&s[e].disabled}};E.displayName="DropDownList",E.propTypes={delay:w.number,ignoreCase:w.bool,iconClassName:w.string,svgIcon:p.svgIconPropType,defaultItem:w.any,valueRender:w.func,valueMap:w.func,validationMessage:w.string,required:w.bool,id:w.string,ariaLabelledBy:w.string,ariaDescribedBy:w.string,ariaLabel:w.string,leftRightKeysNavigation:w.bool,title:w.string,groupField:w.string,list:w.any,skipDisabledItems:w.bool,renderListFilterWrapper:w.bool,...R.propTypes},E.defaultProps={delay:500,tabIndex:0,ignoreCase:!0,...R.defaultProps,required:!1,size:"medium",rounded:"medium",fillMode:"solid",groupMode:"modern"};let O=E;const U=p.createPropsContext(),G=p.withIdHOC(p.withPropsContext(U,O));G.displayName="KendoReactDropDownList";exports.DropDownList=G;exports.DropDownListPropsContext=U;exports.DropDownListWithoutContext=O;
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const J=require("react"),x=require("prop-types"),s=require("@progress/kendo-react-common"),Q=require("@progress/kendo-react-labels"),V=require("@progress/kendo-svg-icons"),X=require("../common/ListContainer.js"),Z=require("../common/ListFilter.js"),B=require("../common/GroupStickyHeader.js"),ee=require("../common/ListDefaultItem.js"),te=require("../common/List.js"),R=require("../common/DropDownBase.js"),c=require("../common/utils.js"),se=require("../package-metadata.js"),H=require("@progress/kendo-react-buttons"),ie=require("@progress/kendo-react-intl"),T=require("../messages/index.js"),M=require("../common/constants.js"),q=require("@progress/kendo-react-layout");function ae(_){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(_){for(const e in _)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(_,e);Object.defineProperty(i,e,t.get?t:{enumerable:!0,get:()=>_[e]})}}return i.default=_,Object.freeze(i)}const g=ae(J),oe="Please select a value from the list!",N=class N extends g.Component{constructor(i){super(i),this.state={},this._element=null,this.base=new R(this),this.searchState={word:"",last:""},this._select=null,this._skipFocusEvent=!1,this._filterInput=null,this._navigated=!1,this._lastKeypressIsFilter=!1,this.itemHeight=0,this.focus=()=>{this.base.wrapper&&this.base.wrapper.focus({preventScroll:!0})},this.handleItemSelect=(e,t)=>{const{virtual:n,dataItemKey:u,defaultItem:r}=this.props,d=c.getFilteredData(this.props),I=n?n.skip:0,p=e===-1&&r!==void 0?r:d[e-I],a=!c.areSame(p,this.value,u);this.triggerOnChange(p,t),a&&this.base.triggerPageChangeCornerItems(p,t)},this.componentRef=e=>{this._element=e,this.base.wrapper=e},this.dummySelect=e=>g.createElement("select",{name:this.props.name,ref:t=>{this._select=t},tabIndex:-1,"aria-hidden":!0,title:this.props.label,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},g.createElement("option",{value:this.props.valueMap?this.props.valueMap.call(void 0,e):e})),this.renderListContainer=()=>{const{header:e,footer:t,dir:n,size:u,groupField:r,groupStickyHeaderItemRender:d,list:I,unstyled:p}=this.props,a=c.getFilteredData(this.props),m=this.base,o=m.getPopupSettings(),v=this.props.opened!==void 0?this.props.opened:this.state.opened,b=o.width!==void 0?o.width:m.popupWidth,h=p&&p.uDropDownList,l={dir:n!==void 0?n:m.dirCalculated,width:b,popupSettings:{...o,popupClass:s.classNames(o.popupClass,s.uDropDownList.listContainer({c:h})),anchor:o.anchor||this.element,show:v,onOpen:this.onPopupOpened,onClose:this.onPopupClosed},itemsCount:[a.length]};let{group:S}=this.state;return S===void 0&&r!==void 0&&(S=c.getItemValue(a[0],r)),g.createElement(X,{...l},this.renderListFilter(),e&&g.createElement("div",{className:s.classNames(s.uDropDownList.listHeader({c:h}))},e),g.createElement("div",{className:s.classNames(s.uDropDownList.list({c:h,size:u,virtual:this.base.vs.enabled}))},this.renderDefaultItem(),!I&&S&&a.length!==0&&g.createElement(B,{group:S,groupMode:"modern",render:d}),this.renderList()),t&&g.createElement("div",{className:s.classNames(s.uDropDownList.listFooter({c:h}))},t))},this.renderList=()=>{const{textField:e,dataItemKey:t,virtual:n={skip:0,total:void 0},groupHeaderItemRender:u,listNoDataRender:r,itemRender:d,unstyled:I}=this.props,p=c.getFilteredData(this.props),a=I&&I.uDropDownList,m=this.base.vs,o=n.skip,v=this.props.opened!==void 0?this.props.opened:this.state.opened,b=this.base.getPopupSettings(),h=`translateY(${m.translate}px)`;return g.createElement(te,{id:this._listboxId,show:v,data:p.slice(),focusedIndex:this.getFocusedIndex(),value:this.value,textField:e,valueField:t,optionsGuid:this._guid,groupField:this.props.groupField,groupMode:"modern",listRef:l=>m.list=this.base.list=l,wrapperStyle:{maxHeight:b.height},wrapperCssClass:s.classNames(s.uDropDownList.listContent({c:a})),listStyle:m.enabled?{transform:h}:void 0,key:"listkey",skip:o,onClick:this.handleItemClick,itemRender:d,groupHeaderItemRender:u,noDataRender:r,onScroll:this.onScroll,wrapperRef:m.scrollerRef,scroller:this.base.renderScrollElement(),ariaSetSize:n.total})},this.onScroll=e=>{const{vs:t,list:n}=this.base;t.scrollHandler(e);const{groupField:u}=this.props;let r=c.getFilteredData(this.props);if(!(!u||!r.length)&&u){const d=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:n?n.children[0].offsetHeight:0),p=e.target.scrollTop-t.skip*d;r=this.base.getGroupedDataModernMode(r,u);let a=r[0][u];for(let m=1;m<r.length&&!(d*m>p);m++)r[m]&&r[m][u]&&(a=r[m][u]);a!==this.state.group&&this.setState({group:a})}},this.renderListFilter=()=>{const e=this.props.filter!==void 0?this.props.filter:this.state.text;return this.props.filterable&&g.createElement(Z,{value:e,ref:t=>this._filterInput=t&&t.element,onChange:this.handleListFilterChange,onKeyDown:this.handleKeyDown,size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode,renderListFilterWrapper:!0})},this.renderDefaultItem=()=>{const{textField:e,defaultItem:t,dataItemKey:n}=this.props;return t!==void 0&&g.createElement(ee,{defaultItem:t,textField:e,selected:c.areSame(this.value,t,n),key:"defaultitemkey",onClick:this.handleDefaultItemClick})},this.search=e=>{clearTimeout(this._typingTimeout),this.props.filterable||(this._typingTimeout=window.setTimeout(()=>this.searchState.word="",this.props.delay),this.selectNext(e))},this.selectNext=e=>{const{dataItemKey:t}=this.props,n=c.getFilteredData(this.props);let u=n.map((C,k)=>({item:C,itemIndex:k}));const r=this.searchState.word,d=this.searchState.last,I=c.sameCharsOnly(r,d);let p=u.length,a=Math.max(0,n.findIndex(C=>c.areSame(C,this.value,t))),m;this.props.defaultItem&&(m={item:this.props.defaultItem,itemIndex:-1},p+=1,a+=1),a+=I?1:0,u=c.shuffleData(u,a,m);let o,v,b,h=0;const{textField:l,ignoreCase:S}=this.props;for(;h<p;h++)if(o=c.getItemValue(u[h].item,l),v=I&&c.matchText(o,d,S),b=c.matchText(o,r,S),v||b){h=u[h].itemIndex;break}if(h!==p){const C=this.base.initState();C.syntheticEvent=e,this.handleItemSelect(h,C),this.applyState(C),this._valueDuringOnChange=void 0}},this.handleKeyDown=e=>{e&&e.target instanceof Element&&e.target.nodeName==="INPUT"&&e.stopPropagation&&e.stopPropagation();const{filterable:t,disabled:n,defaultItem:u,leftRightKeysNavigation:r=!0,virtual:d={skip:0,total:0,pageSize:0},dataItemKey:I,groupField:p="",textField:a,skipDisabledItems:m=!0}=this.props,o=c.getFilteredData(this.props),v=this.value,b=o.findIndex(D=>c.areSame(D,v,I)),h=this.props.opened!==void 0?this.props.opened:this.state.opened,l=e.keyCode,S=l===s.Keys.home||l===s.Keys.end,C=l===s.Keys.up||l===s.Keys.down,k=!h&&(e.altKey&&l===s.Keys.down||l===s.Keys.enter||l===s.Keys.space),E=h&&(e.altKey&&l===s.Keys.up||l===s.Keys.esc),P=r&&(l===s.Keys.left||l===s.Keys.right),L=C||P&&!t||S,w=this.base.initState();if(w.syntheticEvent=e,!n){if(S&&this.base.vs.enabled)l===s.Keys.home?d.skip!==0?(this.base.triggerOnPageChange(w,0,d.pageSize),this._navigated=!0):this.triggerOnChange(o[0],w):d.skip<d.total-d.pageSize?(this.base.triggerOnPageChange(w,d.total-d.pageSize,d.pageSize),this._navigated=!0):this.triggerOnChange(o[o.length-1],w);else if(h&&l===s.Keys.pageUp)e.preventDefault(),this.base.scrollPopupByPageSize(-1);else if(h&&l===s.Keys.pageDown)e.preventDefault(),this.base.scrollPopupByPageSize(1);else if(h&&l===s.Keys.enter){const D=this.getFocusedIndex();this.haveFocusedItemAndDataNotEmpty(o,D)?(this.triggerOnChange(null,w),this.applyState(w)):this.handleItemSelect(D,w),this.base.togglePopup(w),e.preventDefault()}else if(k||E)E&&this.resetValueIfDisabledItem(),this.base.togglePopup(w),e.preventDefault();else if(L){if(this._lastKeypressIsFilter=!1,p!==""&&a)if(!m&&h)this.onNavigate(w,l);else{let D;if(l===s.Keys.down||l===s.Keys.right){const y=o.slice(b+1).find(f=>!f.disabled&&f[a]);D=y&&o.findIndex(f=>f[a]===y[a])}else if(l===s.Keys.up||l===s.Keys.left){let y;if(b===0&&u)D=-1;else if(b===-1)y=o,D=o.findIndex(f=>!f.disabled&&f[a]);else{y=o.slice(0,b);let f=y.pop();for(;f&&f.disabled;)f=y.pop();D=f&&o.findIndex(F=>F[a]===f[a])}}if(D!==void 0){const y=D-b;this.onNavigate(w,l,y)}else D===void 0&&o.findIndex(y=>y[a]===v[a])===o.length-1&&this.onNavigate(w,l)}else if(!m&&h||S)this.onNavigate(w,l);else if(a){let D;if(l===s.Keys.down||l===s.Keys.right){const y=o.slice(b+1).find(f=>!f.disabled&&f[a]);D=y&&o.findIndex(f=>f[a]===y[a])}else if(l===s.Keys.up||l===s.Keys.left){let y;if(b===0&&u)D=-1;else if(b===-1)y=o,D=o.find(f=>!f.disabled&&f[a]);else{y=o.slice(0,b);let f=y.pop();for(;f&&f.disabled;)f=y.pop();D=f&&o.findIndex(F=>F[a]===f[a])}}if(D!==void 0){const y=D-b;this.onNavigate(w,l,y)}else D===void 0&&o.findIndex(y=>y[a]===v[a])===o.length-1&&this.onNavigate(w,l)}else this.onNavigate(w,l);e.preventDefault()}this.applyState(w)}},this.handleItemClick=(e,t)=>{this.base.handleItemClick(e,t),this._valueDuringOnChange=void 0},this.handleFocus=e=>{this._skipFocusEvent||this.base.handleFocus(e)},this.handleBlur=e=>{if(this._skipFocusEvent||!this.state.focused)return;const t=this.props.opened!==void 0?this.props.opened:this.state.opened,{adaptive:n}=this.props,{windowWidth:u=0}=this.state,r=u<=M.MOBILE_MEDIUM_DEVISE&&n,d=this.base.initState();d.syntheticEvent=e,d.data.focused=!1,d.events.push({type:"onBlur"}),t&&this.resetValueIfDisabledItem(),t&&!r&&this.base.togglePopup(d),this.applyState(d)},this.handleDefaultItemClick=e=>{const t=this.base.initState();t.syntheticEvent=e,this.base.togglePopup(t),this.triggerOnChange(this.props.defaultItem,t),this.applyState(t)},this.handleWrapperClick=e=>{if(e.isPropagationStopped())return;const t=this.base.initState();t.syntheticEvent=e,this.state.focused||(t.data.focused=!0),this.resetValueIfDisabledItem(),this.base.togglePopup(t),this.applyState(t)},this.handleKeyPress=e=>{if(this.props.filterable||e.which===0||e.keyCode===s.Keys.enter)return;let t=String.fromCharCode(e.charCode||e.keyCode);this.props.ignoreCase&&(t=t.toLowerCase()),t===" "&&e.preventDefault(),this.searchState={word:this.searchState.word+t,last:this.searchState.last+t},this.search(e)},this.handleListFilterChange=e=>{const t=this.base.initState();t.syntheticEvent=e.syntheticEvent,this.props.filter===void 0&&(t.data.text=e.target.value),this.base.filterChanged(e.target.value,t),this._lastKeypressIsFilter=!0,this.applyState(t),this.setState({group:void 0})},this.onPopupOpened=()=>{this._filterInput&&this.focusElement(this._filterInput),this.props.adaptive&&setTimeout(()=>{this._filterInput&&this.focusElement(this._filterInput)},300)},this.onPopupClosed=()=>{this.state.focused&&window.setTimeout(()=>{this.state.focused&&this.base.wrapper&&this.focusElement(this.base.wrapper)})},this.setValidity=()=>{this._select&&this._select.setCustomValidity&&this._select.setCustomValidity(this.validity.valid?"":this.props.validationMessage||oe)},s.validatePackage(se.packageMetadata)}get _inputId(){return this.props.id+"-accessibility-id"}get _listboxId(){return this.props.id+"-listbox-id"}get _guid(){return this.props.id+"-guid"}get document(){if(s.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get value(){let i;return this._valueDuringOnChange!==void 0?i=this._valueDuringOnChange:this.props.value!==void 0?i=this.props.value:this.state.value!==void 0?i=this.state.value:this.props.defaultValue!==void 0&&(i=this.props.defaultValue),!c.isPresent(i)&&this.props.defaultItem!==void 0&&(i=this.props.defaultItem),i}get index(){const{dataItemKey:i}=this.props,e=c.getFilteredData(this.props),t=this.value;return e.findIndex(n=>c.areSame(n,t,i))}get name(){return this.props.name}get validity(){const i=this.props.validationMessage!==void 0,e=!this.required||this.value!==null&&this.value!==""&&this.value!==void 0,t=this.props.valid!==void 0?this.props.valid:e;return{customError:i,valid:t,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:N.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:N.defaultProps.required}componentDidUpdate(i,e){var o;const{dataItemKey:t,virtual:n,groupField:u="",textField:r}=this.props,d=c.getFilteredData(this.props),I=i.virtual?i.virtual.total:0,p=this.props.opened!==void 0?this.props.opened:this.state.opened,a=i.opened!==void 0?i.opened:e.opened,m=!a&&p;if(this.base.didUpdate(),this.base.getPopupSettings().animate||m&&this.onPopupOpened(),n&&n.total!==I)this.base.vs.calcScrollElementHeight(),this.base.vs.reset();else{const v=this.value,b=i.value!==void 0?i.value:e.value;let h=d.findIndex(S=>c.areSame(S,v,t));u!==""&&v&&r&&(h=(o=this.base.getGroupedDataModernMode(d,u))==null?void 0:o.map(S=>S[r]).indexOf(v[r]));const l=!c.areSame(b,v,t);m&&n?this.base.scrollToVirtualItem(n,h):m&&!n?(this.onPopupOpened(),d&&d.length!==0&&this.base.resetGroupStickyHeader(d[0][u],this),this.base.scrollToItem(h)):p&&a&&v&&l&&!this._navigated?this.base.scrollToItem(h,this.base.vs.enabled):p&&a&&this._navigated&&(this._navigated&&n&&n.skip===0?this.base.vs.reset():this._navigated&&n&&n.skip===n.total-n.pageSize&&this.base.vs.scrollToEnd())}this._navigated=!1,this.setValidity()}componentDidMount(){var i;this.observerResize=s.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.base.didMount(),this.setValidity(),(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentWillUnmount(){var i;(i=this.document)!=null&&i.body&&this.observerResize&&this.observerResize.disconnect()}render(){const i=ie.provideLocalizationService(this).toLanguageString(T.dropDownListArrowBtnAriaLabel,T.messages[T.dropDownListArrowBtnAriaLabel]),{style:e,className:t,label:n,dir:u,virtual:r,size:d,rounded:I,fillMode:p,adaptive:a,unstyled:m}=this.props,{windowWidth:o=0}=this.state,v=this.props.opened!==void 0?this.props.opened:this.state.opened,b=this.value,h=c.getItemValue(b,this.props.textField),l=!this.validityStyles||this.validity.valid,S=this.base,C=S.vs,k=o<=M.MOBILE_MEDIUM_DEVISE&&a,E=m&&m.uDropDownList;C.enabled=r!==void 0,r!==void 0&&(S.vs.skip=r.skip,S.vs.total=r.total,S.vs.pageSize=r.pageSize);const{dataItemKey:P,disabled:L,tabIndex:w,loading:D,iconClassName:y,svgIcon:f,valueRender:F}=this.props,G=c.getFilteredData(this.props),{focused:j}=this.state,Y=G.findIndex(K=>c.areSame(K,b,P)),A=g.createElement("span",{id:this._inputId,className:s.classNames(s.uDropDownList.input({c:E}))},h&&g.createElement("span",{className:s.classNames(s.uDropDownList.inputText({c:E}))},h)),$=F!==void 0?F.call(void 0,A,b):A,z=g.createElement(g.Fragment,null,g.createElement("span",{ref:this.componentRef,className:s.classNames(s.uDropDownList.wrapper({c:E,size:d,rounded:I,fillMode:p,focused:j,disabled:L,invalid:!l,loading:D,required:this.required}),t),style:n?{...e,width:void 0}:e,dir:u,onMouseDown:v?K=>{K.target.nodeName!=="INPUT"&&(this.focusElement(this.base.wrapper),K.preventDefault())}:void 0,onFocus:this.handleFocus,onBlur:this.handleBlur,tabIndex:s.getTabIndex(w,L),accessKey:this.props.accessKey,onKeyDown:this.handleKeyDown,onKeyPress:this.handleKeyPress,onClick:L?void 0:this.handleWrapperClick,role:"combobox","aria-required":this.required,"aria-disabled":L||void 0,"aria-haspopup":"listbox","aria-expanded":v||!1,"aria-owns":this._listboxId,"aria-activedescendant":v?"option-"+this._guid+"-"+(Y+(r?r.skip:0)):void 0,"aria-label":this.props.ariaLabel||this.props.label,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy||this._inputId,"aria-controls":this._listboxId,id:this.props.id,title:this.props.title},$,D&&g.createElement(s.IconWrap,{className:s.classNames(s.uDropDownList.loadingIcon({c:E})),name:"loading"}),g.createElement(H.Button,{tabIndex:-1,type:"button","aria-label":i,"aria-hidden":!0,size:d,fillMode:p,iconClass:y,className:s.classNames(s.uDropDownList.iconButton({c:E})),rounded:null,themeColor:"base",icon:y?void 0:"caret-alt-down",svgIcon:f||V.caretAltDownIcon,onMouseDown:K=>this.state.focused&&K.preventDefault()}),this.dummySelect(b),!k&&this.renderListContainer()),k&&this.renderAdaptiveListContainer());return n?g.createElement(Q.FloatingLabel,{label:n,editorValue:h,editorValid:l,editorDisabled:this.props.disabled,style:{width:e?e.width:void 0},children:z}):z}onNavigate(i,e,t){const{defaultItem:n,dataItemKey:u,virtual:r={skip:0,total:0,pageSize:0}}=this.props,d=c.getFilteredData(this.props),I=this.base.vs,p=this.value,a=d.findIndex(o=>c.areSame(o,p,u)),m=this.base.navigation.navigate({current:r.skip+a,max:(I.enabled?r.total:d.length)-1,min:n!==void 0?-1:0,keyCode:e,skipItems:t||void 0});m!==void 0&&this.handleItemSelect(m,i),this.applyState(i)}renderAdaptiveListContainer(){const{windowWidth:i=0}=this.state,{header:e,footer:t,size:n,adaptiveTitle:u,groupField:r,groupStickyHeaderItemRender:d,list:I,unstyled:p}=this.props,a=c.getFilteredData(this.props),m=this.props.opened!==void 0?this.props.opened:this.state.opened,o=p&&p.uDropDownList,v=p&&p.uDropDownList,b={navigatable:!1,navigatableElements:[],expand:m,animation:!0,onClose:l=>this.handleWrapperClick(l),animationStyles:i<=M.MOBILE_SMALL_DEVISE?{top:0,width:"100%",height:"100%"}:void 0,className:s.classNames(s.uDropDownsActionSheet.wrapper({c:o,isFullScreen:i<=M.MOBILE_SMALL_DEVISE}))};let{group:h}=this.state;return h===void 0&&r!==void 0&&(h=c.getItemValue(a[0],r)),g.createElement(q.ActionSheet,{...b},g.createElement(q.ActionSheetHeader,{className:s.classNames(s.uDropDownsActionSheet.header({c:v}))},g.createElement("div",{className:s.classNames(s.uDropDownsActionSheet.titleBar({c:v}))},g.createElement("div",{className:s.classNames(s.uDropDownsActionSheet.title({c:v}))},g.createElement("div",null,u)),g.createElement("div",{className:s.classNames(s.uDropDownsActionSheet.actions({c:v}))},g.createElement(H.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:this.handleWrapperClick,icon:"x",svgIcon:V.xIcon}))),g.createElement("div",{className:s.classNames(s.uDropDownsActionSheet.titleBarGroup({c:v}))},this.renderListFilter())),g.createElement(q.ActionSheetContent,{className:s.classNames(s.uDropDownsActionSheet.content({c:v}))},e&&g.createElement("div",{className:s.classNames(s.uDropDownList.listHeader({c:o}))},e),g.createElement("div",{className:s.classNames(s.uDropDownList.list({c:o,size:n,virtual:this.base.vs.enabled}))},this.renderDefaultItem(),!I&&h&&a.length!==0&&g.createElement(B,{group:h,groupMode:"modern",render:d}),this.renderList()),t&&g.createElement("div",{className:s.classNames(s.uDropDownList.listFooter({c:o}))},t)))}getFocusedIndex(){const i=this.value,{textField:e,dataItemKey:t,virtual:n={skip:0},focusedItemIndex:u=c.itemIndexStartsWith,filterable:r,skipDisabledItems:d=!0}=this.props,I=c.getFilteredData(this.props),p=this.props.filter?this.props.filter:this.state.text;return d&&e&&!p&&!i?I.findIndex(a=>!a.disabled&&a[e]):c.isPresent(i)&&p===void 0||r&&p===""?I.findIndex(a=>c.areSame(a,i,t)):p?this._lastKeypressIsFilter?u(I,p,e):I.findIndex(a=>c.areSame(a,i,t)):n.skip===0?0:-1}focusElement(i){this._skipFocusEvent=!0,i.focus(),window.setTimeout(()=>this._skipFocusEvent=!1,30)}triggerOnChange(i,e){c.areSame(this.value,i,this.props.dataItemKey)||(this.props.value===void 0&&(e.data.value=i),this._valueDuringOnChange=i,e.events.push({type:"onChange"}))}applyState(i){this.base.applyState(i),this._valueDuringOnChange=void 0}calculateMedia(i){for(const e of i)this.setState({windowWidth:e.target.clientWidth})}resetValueIfDisabledItem(){const i=c.getFilteredData(this.props),e=this.base.initState(),t=this.getFocusedIndex();this.haveFocusedItemAndDataNotEmpty(i,t)&&(this.triggerOnChange(null,e),this.applyState(e))}haveFocusedItemAndDataNotEmpty(i,e){return e!==void 0&&e!==-1&&i&&i.length>0&&i[e].disabled}};N.displayName="DropDownList",N.propTypes={delay:x.number,ignoreCase:x.bool,iconClassName:x.string,svgIcon:s.svgIconPropType,defaultItem:x.any,valueRender:x.func,valueMap:x.func,validationMessage:x.string,required:x.bool,id:x.string,ariaLabelledBy:x.string,ariaDescribedBy:x.string,ariaLabel:x.string,leftRightKeysNavigation:x.bool,title:x.string,groupField:x.string,list:x.any,skipDisabledItems:x.bool,renderListFilterWrapper:x.bool,...R.propTypes},N.defaultProps={delay:500,tabIndex:0,ignoreCase:!0,...R.defaultProps,required:!1,size:"medium",rounded:"medium",fillMode:"solid",groupMode:"modern"};let O=N;const W=s.createPropsContext(),U=s.withIdHOC(s.withPropsContext(W,s.withUnstyledHOC(O)));U.displayName="KendoReactDropDownList";exports.DropDownList=U;exports.DropDownListPropsContext=W;exports.DropDownListWithoutContext=O;
|