@progress/kendo-react-dropdowns 10.2.0-develop.2 → 10.2.0-develop.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react"),g=require("prop-types"),V=require("../common/SearchBar.js"),q=require("../common/ListContainer.js"),T=require("../common/List.js"),S=require("../common/DropDownBase.js"),N=require("../common/GroupStickyHeader.js"),f=require("../common/utils.js"),l=require("@progress/kendo-react-common"),R=require("@progress/kendo-react-labels"),L=require("../common/ClearButton.js"),z=require("../common/AdaptiveMode.js"),F=require("../common/withCustomComponent.js"),A=require("@progress/kendo-react-layout"),H=require("../common/ListFilter.js");function W(I){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(I){for(const t in I)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(I,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>I[t]})}}return e.default=I,Object.freeze(e)}const m=W(B),j="Please enter a valid value!",{sizeMap:D,roundedMap:G}=l.kendoThemeMaps,y=class y extends m.Component{constructor(){super(...arguments),this.state={},this.base=new S(this),this._element=null,this._suggested="",this._input=null,this._adaptiveInput=null,this._skipFocusEvent=!1,this._isScrolling=!1,this.itemHeight=0,this.focus=()=>{this._input&&this._input.focus()},this.handleItemSelect=(e,t)=>{const s=f.getFilteredData(this.props),n=f.getItemValue(s[e],this.props.textField);this.state.text&&!this.mobileMode&&(this.state.text&&(t.data.text=""),this.base.filterChanged("",t)),this._adaptiveInput&&this._adaptiveInput.blur(),this.triggerOnChange(n,t)},this.itemFocus=(e,t)=>{const{textField:s}=this.props,i=f.getFilteredData(this.props)[e];f.areSame(this.state.focusedItem,i,s)||(t.data.focusedItem=i)},this.togglePopup=e=>{this.base.togglePopup(e)},this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||j)},this.renderAdaptiveListContainer=()=>{const{adaptiveTitle:e}=this.props,{windowWidth:t=0}=this.state,s=m.createElement(H,{value:this.value,ref:i=>this._adaptiveInput=i&&i.element,onChange:this.onChangeHandler,onKeyDown:this.onInputKeyDown,size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode}),n={title:e,expand:this.opened,onClose:i=>this.onCancel(i),windowWidth:t,mobileFilter:s};return m.createElement(z.AdaptiveMode,{...n},m.createElement(A.ActionSheetContent,null,m.createElement("div",{className:"k-list-container"},this.listContainerContent())))},this.onCancel=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.opened&&this.base.togglePopup(t),t.events.push({type:"onCancel"});const s=this.state.text;f.isPresent(s)&&s!==""&&this.base.filterChanged("",t),this.state.text&&(t.data.text=""),this.applyState(t)},this.listContainerContent=()=>{const{header:e,footer:t,size:s,groupStickyHeaderItemRender:n,groupField:i,list:a}=this.props,d=f.getFilteredData(this.props);let{group:o}=this.state;return o===void 0&&i!==void 0&&(o=f.getItemValue(d[0],i)),m.createElement(m.Fragment,null,e&&m.createElement("div",{className:"k-list-header"},e),m.createElement("div",{className:l.classNames("k-list",{[`k-list-${this.mobileMode?"lg":D[s]||s}`]:s})},!a&&o&&d.length!==0&&m.createElement(N,{group:o,groupMode:"modern",render:n}),this.renderList()),t&&m.createElement("div",{className:"k-list-footer"},t))},this.onScroll=e=>{this._isScrolling=!0;const{list:t}=this.base,{groupField:s}=this.props;let n=f.getFilteredData(this.props);if(!s||!n.length)return;const i=this.itemHeight||(t?t.children[0].offsetHeight:0),d=e.target.scrollTop;s&&(n=this.base.getGroupedDataModernMode(n,s));let o=n[0][s];for(let r=1;r<n.length&&!(i*r>d);r++)n[r]&&n[r][s]&&(o=n[r][s]);o!==this.state.group&&this.setState({group:o})},this.handleItemClick=(e,t)=>{this.base.handleItemClick(e,t),this._valueDuringOnChange=void 0},this.onChangeHandler=e=>{const s=this.base.initState(),n=this.mobileMode?e.target.element:e.currentTarget,i=n.value,a=n.selectionEnd===i.length;s.syntheticEvent=e;const d=this._suggested,o=this.value,r=o&&o.substring(0,o.length-d.length),h=r&&r===i,u=r&&r.length>i.length,{suggest:b}=this.props,p=this.props.opened!==void 0?this.props.opened:this.state.opened;if(b!==void 0&&b!==!1){h||u||!a?this._suggested="":this.suggestValue(i);const c=i+this._suggested,v={userInput:i,value:this._suggested};this.triggerOnChange(c,s,{suggestion:v})}else this._suggested="",this.triggerOnChange(i,s);(!p&&i||p&&!i)&&this.togglePopup(s),s.data.focusedItem=void 0,this.applyState(s),this.setState({group:void 0})},this.clearButtonClick=e=>{const s=this.base.initState(),n=this.props.opened!==void 0?this.props.opened:this.state.opened;s.syntheticEvent=e;const i="";this._suggested="",this.triggerOnChange(i,s),this.state.focusedItem!==void 0&&(s.data.focusedItem=void 0),n&&this.togglePopup(s),this.applyState(s)},this.onInputKeyDown=e=>{const{skipDisabledItems:t,groupField:s,textField:n}=this.props,i=f.getFilteredData(this.props);this._isScrolling&&(this._isScrolling=!1);const a=this.focusedIndex(),d=i[a],o=e.keyCode,r=e.altKey,h=this.props.opened!==void 0?this.props.opened:this.state.opened,u=this.base.initState();u.syntheticEvent=e;const b=()=>{h&&e.preventDefault()};if(r&&o===l.Keys.down)this.setState({opened:!0});else if(r&&o===l.Keys.up)this.setState({opened:!1});else if(h&&o===l.Keys.pageUp)b(),this.base.scrollPopupByPageSize(-1);else if(h&&o===l.Keys.pageDown)b(),this.base.scrollPopupByPageSize(1);else if(h&&(o===l.Keys.enter||o===l.Keys.esc))b(),t===!1&&d&&d.disabled?(h&&this.togglePopup(u),this.applyState(u)):this.applyInputValue(e.currentTarget.value,u,e.keyCode);else if(!h&&o===l.Keys.esc){const p="";this._suggested="",this.triggerOnChange(p,u),this.state.focusedItem!==void 0&&(u.data.focusedItem=void 0),this.applyState(u)}else if(o===l.Keys.up||o===l.Keys.down){if(s!==""&&n)if(!this.props.skipDisabledItems&&h)this.onNavigate(u,o);else{let p=0;if(o===l.Keys.down||o===l.Keys.right){const c=i.slice(a+1).find(v=>!v.disabled&&v[n]);p=c&&i.findIndex(v=>v[n]===c[n])}else if(o===l.Keys.up||o===l.Keys.left){let c;if(a===-1)c=i,p=i.findIndex(v=>!v.disabled&&v[n]);else{c=i.slice(0,a);let v=c.pop();for(;v&&v.disabled;)v=c.pop();p=v&&i.findIndex(x=>x[n]===v[n])}}if(p!==void 0){const c=p-a;this.onNavigate(u,o,c)}else p===void 0&&i.findIndex(c=>c[n])===i.length-1&&this.onNavigate(u,o)}else if(!this.props.skipDisabledItems&&h)this.onNavigate(u,o);else{let p=null;if(o===l.Keys.down||o===l.Keys.right)p=i.slice(a+1).find(c=>!c.disabled);else if(o===l.Keys.up||o===l.Keys.left){const c=i.slice(0,a);for(p=c.pop();p&&p.disabled;)p=c.pop()}if(p){const c=p.id-a-1;this.onNavigate(u,o,c)}else this.onNavigate(u,o)}this.applyState(u),b()}},this.handleFocus=e=>{this._skipFocusEvent||this.base.handleFocus(e)},this.handleBlur=e=>{const t=this.base.initState();!this.state.focused||this._skipFocusEvent||(t.syntheticEvent=e,t.data.focused=!1,t.events.push({type:"onBlur"}),this.opened&&!this.mobileMode&&(this.state.opened&&(t.data.opened=!1),t.events.push({type:"onClose"})),this.applyState(t))},this.handleWrapperClick=e=>{const t=this._input;!this.opened&&t&&this.focusElement(t);const s=this.base.initState();s.syntheticEvent=e,!this.state.focused&&!this.mobileMode&&(s.events.push({type:"onFocus"}),s.data.focused=!0),this.mobileMode&&window.setTimeout(()=>this._adaptiveInput&&this._adaptiveInput.focus(),300),this.base.togglePopup(s),this.applyState(s)}}get _inputId(){return this.props.id+"-accessibility-id"}get document(){if(l.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get value(){return this._valueDuringOnChange!==void 0?this._valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value!==void 0?this.state.value:this.props.defaultValue!==void 0?this.props.defaultValue:""}get name(){return this.props.name}get validity(){const e=this.props.validationMessage!==void 0,t=!this.required||this.value!=="",s=this.props.valid!==void 0?this.props.valid:t;return{customError:e,valid:s,valueMissing:this.value===null}}get opened(){return!!(this.props.opened!==void 0?this.props.opened:this.state.opened)}get mobileMode(){var t;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((t=this.props._adaptiveMode)==null?void 0:t.medium)&&this.props.adaptive)}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:y.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:y.defaultProps.required}componentDidUpdate(e,t){var p;const{groupField:s=""}=this.props,n=f.getFilteredData(this.props),{data:i=[]}=e,a=this.focusedIndex(),d=n[a],o=i!==n,r=d!==void 0&&t.focusedItem!==d,h=this.props.opened!==void 0?this.props.opened:this.state.opened,u=e.opened!==void 0?e.opened:t.opened,b=!u&&h;if(s==="")(h&&(r||o)||b)&&this.base.scrollToItem(a);else if(!this._isScrolling){const c=(p=this.base.getGroupedDataModernMode(n,s))==null?void 0:p.indexOf(d);b&&(n&&n.length!==0&&this.base.resetGroupStickyHeader(n[0][s],this),this.base.scrollToItem(c)),h&&u&&r&&this.base.scrollToItem(c)}this.setValidity()}componentDidMount(){var e;this.observerResize=l.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.base.didMount(),this.setValidity(),(e=this.document)!=null&&e.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentWillUnmount(){this.observerResize&&this.observerResize.disconnect()}render(){const{dir:e,disabled:t,label:s,className:n,style:i,loading:a,suggest:d,size:o,rounded:r,fillMode:h}=this.props,u=!this.validityStyles||this.validity.valid,b=this.base,p=this.value,c=this.props.clearButton!==!1&&!a&&!!p,v=this.props.id||this._inputId,x=this.state.focused;typeof d=="string"&&(this._suggested=d);const[E,O]=F(this.props.prefix||m.Fragment),[P,K]=F(this.props.suffix||m.Fragment),w=m.createElement(m.Fragment,null,m.createElement("span",{className:l.classNames("k-autocomplete k-input",n,{[`k-input-${D[o]||o}`]:o,[`k-rounded-${G[r]||r}`]:r,[`k-input-${h}`]:h,"k-invalid":!u,"k-focus":x&&!t,"k-loading":a,"k-required":this.required,"k-disabled":t}),ref:k=>{this._element=k,b.wrapper=k},style:s?{...i,width:void 0}:i,dir:e,onFocus:this.handleFocus,onBlur:this.handleBlur,onClick:this.handleWrapperClick},this.props.prefix&&m.createElement(E,{...O}),this.renderSearchBar(p||"",v),a&&m.createElement(l.IconWrap,{className:"k-input-loading-icon",name:"loading"}),c&&!a&&m.createElement(L,{onClick:this.clearButtonClick,key:"clearbutton"}),this.props.suffix&&m.createElement(P,{...K}),!this.mobileMode&&this.renderListContainer()),this.mobileMode&&this.renderAdaptiveListContainer());return s?m.createElement(R.FloatingLabel,{label:s,editorId:v,editorValue:p,editorValid:u,editorDisabled:t,style:{width:i?i.width:void 0},children:w}):w}onNavigate(e,t,s){const n=this.value,{textField:i,focusedItemIndex:a}=this.props,d=f.getFilteredData(this.props),o=this.state.focusedItem!==void 0?d.findIndex(h=>f.areSame(h,this.state.focusedItem,i)):a?a(d,n,i):d.indexOf(f.getFocusedItem(d,n,i)),r=this.base.navigation.navigate({keyCode:t,current:o,max:d.length-1,min:0,skipItems:s||void 0});r!==void 0&&this.itemFocus(r,e),this.applyState(e)}applyInputValue(e,t,s){const n=this.props.opened!==void 0?this.props.opened:this.state.opened,{textField:i}=this.props,a=f.getFilteredData(this.props),d=this.focusedIndex(),o=a[d];if(this._suggested="",n&&s===l.Keys.enter&&o&&!o.disabled){const r=f.getItemValue(a[this.focusedIndex(e)],i);this.triggerOnChange(r,t)}n&&this.togglePopup(t),this.applyState(t)}renderSearchBar(e,t){const s=this.base,{placeholder:n,tabIndex:i,disabled:a,readonly:d,inputAttributes:o}=this.props,{focused:r}=this.state,h=this.props.opened!==void 0?this.props.opened:this.state.opened;return m.createElement(V,{id:t,placeholder:n,tabIndex:i,accessKey:this.props.accessKey,value:e,suggestedText:this._suggested,focused:r,name:this.props.name,ref:u=>this._input=u&&u.input,onKeyDown:this.onInputKeyDown,onChange:this.onChangeHandler,onFocus:s.handleFocus,onBlur:this.handleBlur,disabled:a,readOnly:d,expanded:h,owns:s.listBoxId,activedescendant:"option-"+s.guid+"-"+this.focusedIndex(),role:"combobox",ariaLabelledBy:this.props.ariaLabelledBy,ariaDescribedBy:this.props.ariaDescribedBy,ariaRequired:this.required,render:this.props.valueRender,inputAttributes:o})}renderListContainer(){const e=this.base,{dir:t,groupField:s}=this.props,n=f.getFilteredData(this.props),i=e.getPopupSettings(),a=this.props.opened!==void 0?this.props.opened:this.state.opened,d=i.width!==void 0?i.width:e.popupWidth;let{group:o}=this.state;return o===void 0&&s!==void 0&&(o=f.getItemValue(n[0],s)),m.createElement(q,{width:d,popupSettings:{...i,anchor:i.anchor||this.element,show:a,popupClass:l.classNames(i.popupClass,"k-list-container","k-autocomplete-popup")},dir:t!==void 0?t:this.base.dirCalculated,itemsCount:[n.length]},this.listContainerContent())}renderList(){const e=this.base,t=e.getPopupSettings(),{textField:s,listNoDataRender:n,itemRender:i,groupHeaderItemRender:a}=this.props,d=f.getFilteredData(this.props),o=this.value,r=this.props.opened!==void 0?this.props.opened:this.state.opened;return m.createElement(T,{id:e.listBoxId,show:r,data:d.slice(),focusedIndex:this.focusedIndex(),value:o,textField:s,valueField:s,highlightSelected:!1,optionsGuid:e.guid,groupField:this.props.groupField,groupMode:"modern",listRef:h=>e.list=h,wrapperStyle:this.mobileMode?{}:{maxHeight:t.height},wrapperCssClass:"k-list-content",onClick:this.handleItemClick,itemRender:i,groupHeaderItemRender:a,noDataRender:n,onMouseDown:h=>h.preventDefault(),onScroll:this.onScroll})}triggerOnChange(e,t,s){this.value===e&&!s||(t.data.value=e,this._valueDuringOnChange=e,t.events.push({type:"onChange",...s||{}}))}focusElement(e){this._skipFocusEvent=!0,e.focus(),window.setTimeout(()=>this._skipFocusEvent=!1,0)}applyState(e){this.base.applyState(e),this._valueDuringOnChange=void 0}suggestValue(e){if(this._suggested="",e){const{textField:t}=this.props,s=f.getFilteredData(this.props),n=s[f.itemIndexStartsWith(s,e,t)];if(n){const i=f.getItemValue(n,t);e.toLowerCase()!==i.toLowerCase()&&(this._suggested=i.substring(e.length))}}}focusedIndex(e){const{textField:t,focusedItemIndex:s,skipDisabledItems:n}=this.props,i=f.getFilteredData(this.props),a=e!==void 0?e:this.value;if(this.state.focusedItem!==void 0)return i.findIndex(o=>f.areSame(o,this.state.focusedItem,t));if(s)return s(i,a,t);const d=i.indexOf(f.getFocusedItem(i,a,t));return n&&t&&d===-1?i.findIndex(o=>!o.disabled&&o[t]):Math.max(0,d)}calculateMedia(e){for(const t of e)this.setState({windowWidth:t.target.clientWidth})}};y.displayName="AutoComplete",y.propTypes={...S.basicPropTypes,size:g.oneOf([null,"small","medium","large"]),rounded:g.oneOf([null,"small","medium","large","full"]),fillMode:g.oneOf([null,"solid","flat","outline"]),groupField:g.string,suggest:g.oneOfType([g.bool,g.string]),placeholder:g.string,value:g.string,defaultValue:g.string,validationMessage:g.string,required:g.bool,readonly:g.bool,clearButton:g.bool,valueRender:g.func,id:g.string,ariaLabelledBy:g.string,ariaDescribedBy:g.string,list:g.any,adaptive:g.bool,adaptiveTitle:g.string,onCancel:g.func,skipDisabledItems:g.bool,inputAttributes:g.object},y.defaultProps={...S.defaultProps,size:"medium",rounded:"medium",fillMode:"solid",skipDisabledItems:!0,prefix:void 0,suffix:void 0};let C=y;const _=l.createPropsContext(),M=l.withIdHOC(l.withPropsContext(_,l.withAdaptiveModeContext(C)));M.displayName="KendoReactAutoComplete";exports.AutoComplete=M;exports.AutoCompletePropsContext=_;exports.AutoCompleteWithoutContext=C;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react"),g=require("prop-types"),V=require("../common/SearchBar.js"),q=require("../common/ListContainer.js"),T=require("../common/List.js"),S=require("../common/DropDownBase.js"),N=require("../common/GroupStickyHeader.js"),f=require("../common/utils.js"),l=require("@progress/kendo-react-common"),R=require("@progress/kendo-react-labels"),L=require("../common/ClearButton.js"),z=require("../common/AdaptiveMode.js"),F=require("../common/withCustomComponent.js"),A=require("@progress/kendo-react-layout"),H=require("../common/ListFilter.js");function W(I){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(I){for(const t in I)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(I,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>I[t]})}}return e.default=I,Object.freeze(e)}const m=W(B),j="Please enter a valid value!",{sizeMap:D,roundedMap:G}=l.kendoThemeMaps,y=class y extends m.Component{constructor(){super(...arguments),this.state={},this.base=new S(this),this._element=null,this._suggested="",this._input=null,this._adaptiveInput=null,this._skipFocusEvent=!1,this._isScrolling=!1,this.itemHeight=0,this.focus=()=>{this._input&&this._input.focus()},this.handleItemSelect=(e,t)=>{const s=f.getFilteredData(this.props),n=f.getItemValue(s[e],this.props.textField);this.state.text&&!this.mobileMode&&(this.state.text&&(t.data.text=""),this.base.filterChanged("",t)),this._adaptiveInput&&this._adaptiveInput.blur(),this.triggerOnChange(n,t)},this.itemFocus=(e,t)=>{const{textField:s}=this.props,i=f.getFilteredData(this.props)[e];f.areSame(this.state.focusedItem,i,s)||(t.data.focusedItem=i)},this.togglePopup=e=>{this.base.togglePopup(e)},this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||j)},this.renderAdaptiveListContainer=()=>{const{adaptiveTitle:e}=this.props,{windowWidth:t=0}=this.state,s=m.createElement(H,{value:this.value,ref:i=>{this._adaptiveInput=i&&i.element},onChange:this.onChangeHandler,onKeyDown:this.onInputKeyDown,size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode}),n={title:e,expand:this.opened,onClose:i=>this.onCancel(i),windowWidth:t,mobileFilter:s};return m.createElement(z.AdaptiveMode,{...n},m.createElement(A.ActionSheetContent,null,m.createElement("div",{className:"k-list-container"},this.listContainerContent())))},this.onCancel=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.opened&&this.base.togglePopup(t),t.events.push({type:"onCancel"});const s=this.state.text;f.isPresent(s)&&s!==""&&this.base.filterChanged("",t),this.state.text&&(t.data.text=""),this.applyState(t)},this.listContainerContent=()=>{const{header:e,footer:t,size:s,groupStickyHeaderItemRender:n,groupField:i,list:a}=this.props,d=f.getFilteredData(this.props);let{group:o}=this.state;return o===void 0&&i!==void 0&&(o=f.getItemValue(d[0],i)),m.createElement(m.Fragment,null,e&&m.createElement("div",{className:"k-list-header"},e),m.createElement("div",{className:l.classNames("k-list",{[`k-list-${this.mobileMode?"lg":D[s]||s}`]:s})},!a&&o&&d.length!==0&&m.createElement(N,{group:o,groupMode:"modern",render:n}),this.renderList()),t&&m.createElement("div",{className:"k-list-footer"},t))},this.onScroll=e=>{this._isScrolling=!0;const{list:t}=this.base,{groupField:s}=this.props;let n=f.getFilteredData(this.props);if(!s||!n.length)return;const i=this.itemHeight||(t?t.children[0].offsetHeight:0),d=e.target.scrollTop;s&&(n=this.base.getGroupedDataModernMode(n,s));let o=n[0][s];for(let r=1;r<n.length&&!(i*r>d);r++)n[r]&&n[r][s]&&(o=n[r][s]);o!==this.state.group&&this.setState({group:o})},this.handleItemClick=(e,t)=>{this.base.handleItemClick(e,t),this._valueDuringOnChange=void 0},this.onChangeHandler=e=>{const s=this.base.initState(),n=this.mobileMode?e.target.element:e.currentTarget,i=n.value,a=n.selectionEnd===i.length;s.syntheticEvent=e;const d=this._suggested,o=this.value,r=o&&o.substring(0,o.length-d.length),h=r&&r===i,u=r&&r.length>i.length,{suggest:b}=this.props,p=this.props.opened!==void 0?this.props.opened:this.state.opened;if(b!==void 0&&b!==!1){h||u||!a?this._suggested="":this.suggestValue(i);const c=i+this._suggested,v={userInput:i,value:this._suggested};this.triggerOnChange(c,s,{suggestion:v})}else this._suggested="",this.triggerOnChange(i,s);(!p&&i||p&&!i)&&this.togglePopup(s),s.data.focusedItem=void 0,this.applyState(s),this.setState({group:void 0})},this.clearButtonClick=e=>{const s=this.base.initState(),n=this.props.opened!==void 0?this.props.opened:this.state.opened;s.syntheticEvent=e;const i="";this._suggested="",this.triggerOnChange(i,s),this.state.focusedItem!==void 0&&(s.data.focusedItem=void 0),n&&this.togglePopup(s),this.applyState(s)},this.onInputKeyDown=e=>{const{skipDisabledItems:t,groupField:s,textField:n}=this.props,i=f.getFilteredData(this.props);this._isScrolling&&(this._isScrolling=!1);const a=this.focusedIndex(),d=i[a],o=e.keyCode,r=e.altKey,h=this.props.opened!==void 0?this.props.opened:this.state.opened,u=this.base.initState();u.syntheticEvent=e;const b=()=>{h&&e.preventDefault()};if(r&&o===l.Keys.down)this.setState({opened:!0});else if(r&&o===l.Keys.up)this.setState({opened:!1});else if(h&&o===l.Keys.pageUp)b(),this.base.scrollPopupByPageSize(-1);else if(h&&o===l.Keys.pageDown)b(),this.base.scrollPopupByPageSize(1);else if(h&&(o===l.Keys.enter||o===l.Keys.esc))b(),t===!1&&d&&d.disabled?(h&&this.togglePopup(u),this.applyState(u)):this.applyInputValue(e.currentTarget.value,u,e.keyCode);else if(!h&&o===l.Keys.esc){const p="";this._suggested="",this.triggerOnChange(p,u),this.state.focusedItem!==void 0&&(u.data.focusedItem=void 0),this.applyState(u)}else if(o===l.Keys.up||o===l.Keys.down){if(s!==""&&n)if(!this.props.skipDisabledItems&&h)this.onNavigate(u,o);else{let p=0;if(o===l.Keys.down||o===l.Keys.right){const c=i.slice(a+1).find(v=>!v.disabled&&v[n]);p=c&&i.findIndex(v=>v[n]===c[n])}else if(o===l.Keys.up||o===l.Keys.left){let c;if(a===-1)c=i,p=i.findIndex(v=>!v.disabled&&v[n]);else{c=i.slice(0,a);let v=c.pop();for(;v&&v.disabled;)v=c.pop();p=v&&i.findIndex(x=>x[n]===v[n])}}if(p!==void 0){const c=p-a;this.onNavigate(u,o,c)}else p===void 0&&i.findIndex(c=>c[n])===i.length-1&&this.onNavigate(u,o)}else if(!this.props.skipDisabledItems&&h)this.onNavigate(u,o);else{let p=null;if(o===l.Keys.down||o===l.Keys.right)p=i.slice(a+1).find(c=>!c.disabled);else if(o===l.Keys.up||o===l.Keys.left){const c=i.slice(0,a);for(p=c.pop();p&&p.disabled;)p=c.pop()}if(p){const c=p.id-a-1;this.onNavigate(u,o,c)}else this.onNavigate(u,o)}this.applyState(u),b()}},this.handleFocus=e=>{this._skipFocusEvent||this.base.handleFocus(e)},this.handleBlur=e=>{const t=this.base.initState();!this.state.focused||this._skipFocusEvent||(t.syntheticEvent=e,t.data.focused=!1,t.events.push({type:"onBlur"}),this.opened&&!this.mobileMode&&(this.state.opened&&(t.data.opened=!1),t.events.push({type:"onClose"})),this.applyState(t))},this.handleWrapperClick=e=>{const t=this._input;!this.opened&&t&&this.focusElement(t);const s=this.base.initState();s.syntheticEvent=e,!this.state.focused&&!this.mobileMode&&(s.events.push({type:"onFocus"}),s.data.focused=!0),this.mobileMode&&window.setTimeout(()=>this._adaptiveInput&&this._adaptiveInput.focus(),300),this.base.togglePopup(s),this.applyState(s)}}get _inputId(){return this.props.id+"-accessibility-id"}get document(){if(l.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get value(){return this._valueDuringOnChange!==void 0?this._valueDuringOnChange:this.props.value!==void 0?this.props.value:this.state.value!==void 0?this.state.value:this.props.defaultValue!==void 0?this.props.defaultValue:""}get name(){return this.props.name}get validity(){const e=this.props.validationMessage!==void 0,t=!this.required||this.value!=="",s=this.props.valid!==void 0?this.props.valid:t;return{customError:e,valid:s,valueMissing:this.value===null}}get opened(){return!!(this.props.opened!==void 0?this.props.opened:this.state.opened)}get mobileMode(){var t;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((t=this.props._adaptiveMode)==null?void 0:t.medium)&&this.props.adaptive)}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:y.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:y.defaultProps.required}componentDidUpdate(e,t){var p;const{groupField:s=""}=this.props,n=f.getFilteredData(this.props),{data:i=[]}=e,a=this.focusedIndex(),d=n[a],o=i!==n,r=d!==void 0&&t.focusedItem!==d,h=this.props.opened!==void 0?this.props.opened:this.state.opened,u=e.opened!==void 0?e.opened:t.opened,b=!u&&h;if(s==="")(h&&(r||o)||b)&&this.base.scrollToItem(a);else if(!this._isScrolling){const c=(p=this.base.getGroupedDataModernMode(n,s))==null?void 0:p.indexOf(d);b&&(n&&n.length!==0&&this.base.resetGroupStickyHeader(n[0][s],this),this.base.scrollToItem(c)),h&&u&&r&&this.base.scrollToItem(c)}this.setValidity()}componentDidMount(){var e;this.observerResize=l.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.base.didMount(),this.setValidity(),(e=this.document)!=null&&e.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentWillUnmount(){this.observerResize&&this.observerResize.disconnect()}render(){const{dir:e,disabled:t,label:s,className:n,style:i,loading:a,suggest:d,size:o,rounded:r,fillMode:h}=this.props,u=!this.validityStyles||this.validity.valid,b=this.base,p=this.value,c=this.props.clearButton!==!1&&!a&&!!p,v=this.props.id||this._inputId,x=this.state.focused;typeof d=="string"&&(this._suggested=d);const[E,O]=F(this.props.prefix||m.Fragment),[P,K]=F(this.props.suffix||m.Fragment),w=m.createElement(m.Fragment,null,m.createElement("span",{className:l.classNames("k-autocomplete k-input",n,{[`k-input-${D[o]||o}`]:o,[`k-rounded-${G[r]||r}`]:r,[`k-input-${h}`]:h,"k-invalid":!u,"k-focus":x&&!t,"k-loading":a,"k-required":this.required,"k-disabled":t}),ref:k=>{this._element=k,b.wrapper=k},style:s?{...i,width:void 0}:i,dir:e,onFocus:this.handleFocus,onBlur:this.handleBlur,onClick:this.handleWrapperClick},this.props.prefix&&m.createElement(E,{...O}),this.renderSearchBar(p||"",v),a&&m.createElement(l.IconWrap,{className:"k-input-loading-icon",name:"loading"}),c&&!a&&m.createElement(L,{onClick:this.clearButtonClick,key:"clearbutton"}),this.props.suffix&&m.createElement(P,{...K}),!this.mobileMode&&this.renderListContainer()),this.mobileMode&&this.renderAdaptiveListContainer());return s?m.createElement(R.FloatingLabel,{label:s,editorId:v,editorValue:p,editorValid:u,editorDisabled:t,style:{width:i?i.width:void 0},children:w}):w}onNavigate(e,t,s){const n=this.value,{textField:i,focusedItemIndex:a}=this.props,d=f.getFilteredData(this.props),o=this.state.focusedItem!==void 0?d.findIndex(h=>f.areSame(h,this.state.focusedItem,i)):a?a(d,n,i):d.indexOf(f.getFocusedItem(d,n,i)),r=this.base.navigation.navigate({keyCode:t,current:o,max:d.length-1,min:0,skipItems:s||void 0});r!==void 0&&this.itemFocus(r,e),this.applyState(e)}applyInputValue(e,t,s){const n=this.props.opened!==void 0?this.props.opened:this.state.opened,{textField:i}=this.props,a=f.getFilteredData(this.props),d=this.focusedIndex(),o=a[d];if(this._suggested="",n&&s===l.Keys.enter&&o&&!o.disabled){const r=f.getItemValue(a[this.focusedIndex(e)],i);this.triggerOnChange(r,t)}n&&this.togglePopup(t),this.applyState(t)}renderSearchBar(e,t){const s=this.base,{placeholder:n,tabIndex:i,disabled:a,readonly:d,inputAttributes:o}=this.props,{focused:r}=this.state,h=this.props.opened!==void 0?this.props.opened:this.state.opened;return m.createElement(V,{id:t,placeholder:n,tabIndex:i,accessKey:this.props.accessKey,value:e,suggestedText:this._suggested,focused:r,name:this.props.name,ref:u=>{this._input=u&&u.input},onKeyDown:this.onInputKeyDown,onChange:this.onChangeHandler,onFocus:s.handleFocus,onBlur:this.handleBlur,disabled:a,readOnly:d,expanded:h,owns:s.listBoxId,activedescendant:"option-"+s.guid+"-"+this.focusedIndex(),role:"combobox",ariaLabelledBy:this.props.ariaLabelledBy,ariaDescribedBy:this.props.ariaDescribedBy,ariaRequired:this.required,render:this.props.valueRender,inputAttributes:o})}renderListContainer(){const e=this.base,{dir:t,groupField:s}=this.props,n=f.getFilteredData(this.props),i=e.getPopupSettings(),a=this.props.opened!==void 0?this.props.opened:this.state.opened,d=i.width!==void 0?i.width:e.popupWidth;let{group:o}=this.state;return o===void 0&&s!==void 0&&(o=f.getItemValue(n[0],s)),m.createElement(q,{width:d,popupSettings:{...i,anchor:i.anchor||this.element,show:a,popupClass:l.classNames(i.popupClass,"k-list-container","k-autocomplete-popup")},dir:t!==void 0?t:this.base.dirCalculated,itemsCount:[n.length]},this.listContainerContent())}renderList(){const e=this.base,t=e.getPopupSettings(),{textField:s,listNoDataRender:n,itemRender:i,groupHeaderItemRender:a}=this.props,d=f.getFilteredData(this.props),o=this.value,r=this.props.opened!==void 0?this.props.opened:this.state.opened;return m.createElement(T,{id:e.listBoxId,show:r,data:d.slice(),focusedIndex:this.focusedIndex(),value:o,textField:s,valueField:s,highlightSelected:!1,optionsGuid:e.guid,groupField:this.props.groupField,groupMode:"modern",listRef:h=>{e.list=h},wrapperStyle:this.mobileMode?{}:{maxHeight:t.height},wrapperCssClass:"k-list-content",onClick:this.handleItemClick,itemRender:i,groupHeaderItemRender:a,noDataRender:n,onMouseDown:h=>h.preventDefault(),onScroll:this.onScroll})}triggerOnChange(e,t,s){this.value===e&&!s||(t.data.value=e,this._valueDuringOnChange=e,t.events.push({type:"onChange",...s||{}}))}focusElement(e){this._skipFocusEvent=!0,e.focus(),window.setTimeout(()=>this._skipFocusEvent=!1,0)}applyState(e){this.base.applyState(e),this._valueDuringOnChange=void 0}suggestValue(e){if(this._suggested="",e){const{textField:t}=this.props,s=f.getFilteredData(this.props),n=s[f.itemIndexStartsWith(s,e,t)];if(n){const i=f.getItemValue(n,t);e.toLowerCase()!==i.toLowerCase()&&(this._suggested=i.substring(e.length))}}}focusedIndex(e){const{textField:t,focusedItemIndex:s,skipDisabledItems:n}=this.props,i=f.getFilteredData(this.props),a=e!==void 0?e:this.value;if(this.state.focusedItem!==void 0)return i.findIndex(o=>f.areSame(o,this.state.focusedItem,t));if(s)return s(i,a,t);const d=i.indexOf(f.getFocusedItem(i,a,t));return n&&t&&d===-1?i.findIndex(o=>!o.disabled&&o[t]):Math.max(0,d)}calculateMedia(e){for(const t of e)this.setState({windowWidth:t.target.clientWidth})}};y.displayName="AutoComplete",y.propTypes={...S.basicPropTypes,size:g.oneOf([null,"small","medium","large"]),rounded:g.oneOf([null,"small","medium","large","full"]),fillMode:g.oneOf([null,"solid","flat","outline"]),groupField:g.string,suggest:g.oneOfType([g.bool,g.string]),placeholder:g.string,value:g.string,defaultValue:g.string,validationMessage:g.string,required:g.bool,readonly:g.bool,clearButton:g.bool,valueRender:g.func,id:g.string,ariaLabelledBy:g.string,ariaDescribedBy:g.string,list:g.any,adaptive:g.bool,adaptiveTitle:g.string,onCancel:g.func,skipDisabledItems:g.bool,inputAttributes:g.object},y.defaultProps={...S.defaultProps,size:"medium",rounded:"medium",fillMode:"solid",skipDisabledItems:!0,prefix:void 0,suffix:void 0};let C=y;const _=l.createPropsContext(),M=l.withIdHOC(l.withPropsContext(_,l.withAdaptiveModeContext(C)));M.displayName="KendoReactAutoComplete";exports.AutoComplete=M;exports.AutoCompletePropsContext=_;exports.AutoCompleteWithoutContext=C;
@@ -41,7 +41,9 @@ const Z = "Please enter a valid value!", { sizeMap: O, roundedMap: ee } = $, I =
41
41
  Y,
42
42
  {
43
43
  value: this.value,
44
- ref: (i) => this._adaptiveInput = i && i.element,
44
+ ref: (i) => {
45
+ this._adaptiveInput = i && i.element;
46
+ },
45
47
  onChange: this.onChangeHandler,
46
48
  onKeyDown: this.onInputKeyDown,
47
49
  size: this.props.size,
@@ -359,7 +361,9 @@ const Z = "Please enter a valid value!", { sizeMap: O, roundedMap: ee } = $, I =
359
361
  suggestedText: this._suggested,
360
362
  focused: r,
361
363
  name: this.props.name,
362
- ref: (h) => this._input = h && h.input,
364
+ ref: (h) => {
365
+ this._input = h && h.input;
366
+ },
363
367
  onKeyDown: this.onInputKeyDown,
364
368
  onChange: this.onChangeHandler,
365
369
  onFocus: s.handleFocus,
@@ -413,7 +417,9 @@ const Z = "Please enter a valid value!", { sizeMap: O, roundedMap: ee } = $, I =
413
417
  optionsGuid: e.guid,
414
418
  groupField: this.props.groupField,
415
419
  groupMode: "modern",
416
- listRef: (l) => e.list = l,
420
+ listRef: (l) => {
421
+ e.list = l;
422
+ },
417
423
  wrapperStyle: this.mobileMode ? {} : { maxHeight: t.height },
418
424
  wrapperCssClass: "k-list-content",
419
425
  onClick: this.handleItemClick,
@@ -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 Q=require("react"),b=require("prop-types"),V=require("../common/DropDownBase.js"),i=require("@progress/kendo-react-common"),X=require("@progress/kendo-react-labels"),h=require("../common/utils.js"),Z=require("../common/SearchBar.js"),ee=require("../common/ListContainer.js"),te=require("../common/List.js"),se=require("../common/ListFilter.js"),A=require("../common/GroupStickyHeader.js"),ie=require("../package-metadata.js"),oe=require("../common/ClearButton.js"),K=require("@progress/kendo-react-buttons"),L=require("@progress/kendo-svg-icons"),k=require("../messages/index.js"),R=require("@progress/kendo-react-intl"),N=require("@progress/kendo-react-layout"),q=require("../common/withCustomComponent.js");function ae(B){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(B){for(const e in B)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(B,e);Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:()=>B[e]})}}return s.default=B,Object.freeze(s)}const g=ae(Q),ne="Please enter a valid value!",D=class D extends g.Component{constructor(s){super(s),this.state={},this.base=new V(this),this._element=null,this._suggested="",this._skipBlur=!1,this._input=null,this._adaptiveFilterInput=null,this.itemHeight=0,this.duplicates=[],this.hasDuplicates=!1,this.showLicenseWatermark=!1,this.focus=()=>{this._input&&this._input.focus()},this.checkForDuplicatePlainTextRecords=()=>{const e=this.props.textField!==void 0,t=this.props.dataItemKey!==void 0;if(this.props.data&&this.props.data.length>0&&!e&&!t){const o=this.props.data;this.duplicates=h.getPlainDataDuplicates(o),this.hasDuplicates=this.duplicates.length>0}},this.handleItemSelect=(e,t)=>{const{virtual:o,dataItemKey:l}=this.props,d=h.getFilteredData(this.props),n=o?o.skip:0,p=d[e-n],r=this.hasDuplicates||!h.areSame(p,this.value,l);this.triggerOnChange(p,t),this.state.text!==void 0&&(t.data.text=void 0),r&&this.base.triggerPageChangeCornerItems(p,t)},this.onPopupOpened=()=>{setTimeout(()=>{this.mobileMode&&this._adaptiveFilterInput&&(this._skipBlur=!0,this._adaptiveFilterInput.focus(),this._skipBlur=!1)},300)},this.componentRef=e=>{this._element=e,this.base.wrapper=e},this.toggleBtnClick=e=>{const{skipDisabledItems:t,textField:o}=this.props,l=h.getFilteredData(this.props),d=this.getFocusedIndex(),n=this.getCurrentValueDisabledStatus(o,l,d),p=this.props.opened!==void 0?this.props.opened:this.state.opened,r=this.base.initState();if(r.syntheticEvent=e,!t&&o&&n&&this.clearValueOnToggleBtnClick(e),this.base.togglePopup(r),!p&&this.mobileMode){const a=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text||null;this.base.filterChanged(a,r)}this.applyState(r)},this.closeOpenedApplyStateNonMobileMode=(e,t)=>{t&&!this.mobileMode&&this.base.togglePopup(e)},this.renderMobileListFilter=()=>{const e=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text,t=h.getItemValue(this.value,this.props.textField),o=h.isPresent(e)?e:t;return g.createElement(se,{value:o,ref:l=>this._adaptiveFilterInput=l&&l.element,onChange:this.handleMobileFilterChange,onKeyDown:this.onInputKeyDown,size:"large",rounded:this.props.rounded,fillMode:this.props.fillMode})},this.handleMobileFilterChange=e=>{const t=this.base.initState();t.syntheticEvent=e.syntheticEvent,t.data.text=e.target.value,this.base.filterChanged(e.target.value,t),this.applyState(t)},this.onScroll=e=>{const{vs:t,list:o}=this.base;t.scrollHandler(e);const{groupField:l}=this.props;let d=h.getFilteredData(this.props);if(!l||!d.length)return;const n=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:o?o.children[0].offsetHeight:0),r=e.target.scrollTop-t.skip*n;this.props.groupMode==="modern"&&(d=this.base.getGroupedDataModernMode(d,l));let a=d[0][l];for(let m=1;m<d.length&&!(n*m>r);m++)d[m]&&d[m][l]&&(a=d[m][l]);a!==this.state.group&&(this.setState({group:a}),this.props.onGroupScroll&&this.props.onGroupScroll.call(void 0,{group:a}))},this.handleItemClick=(e,t)=>{this.navigationIndex=e,this.base.handleItemClick(e,t),this._valueDuringOnChange=void 0},this.handleBlur=e=>{if(this.state.focused&&!this._skipBlur){const t=this.base.initState(),{textField:o}=this.props,l=h.getFilteredData(this.props),d=this.getFocusedIndex(),p=!(d===-1)&&this.getCurrentValueDisabledStatus(o,l,d);t.data.focused=!1,t.events.push({type:"onBlur"}),t.syntheticEvent=e,o&&p&&this.clearValueOnBlur(e),this.applyValueOnRejectSuggestions(e.currentTarget.value,t)}},this.onInputClick=e=>{const t=this.props.opened!==void 0?this.props.opened:this.state.opened,o=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text||null;if(!t&&this.mobileMode){const l=this.base.initState();l.syntheticEvent=e,this.base.togglePopup(l),this.base.filterChanged(o,l),this.applyState(l)}},this.onInputKeyDown=e=>{const{skipDisabledItems:t,textField:o,dataItemKey:l,groupField:d}=this.props,n=h.getFilteredData(this.props),p=this.value,r=Math.max(0,n.findIndex(u=>h.areSame(u,p,l))),a=e.keyCode,m=this.props.opened!==void 0?this.props.opened:this.state.opened,c=this.base.initState();if(c.syntheticEvent=e,!e.altKey&&(a===i.Keys.up||a===i.Keys.down)){if(e.preventDefault(),d!==""&&o)if(!this.props.skipDisabledItems&&m)this.onNavigate(c,a);else{let u=0;if(a===i.Keys.down||a===i.Keys.right){const v=n.slice(r+1<n.length?r+1:r).find(x=>!x.disabled&&x[o]);u=v&&n.findIndex(x=>x[o]===v[o])}else if(a===i.Keys.up||a===i.Keys.left){let v;if(r===0)v=n,u=n.findIndex(x=>!x.disabled&&x[o]);else{v=n.slice(0,r);let x=v.pop();for(;x&&x.disabled;)x=v.pop();u=x&&n.findIndex(S=>S[o]===x[o])}}if(u!==void 0){const v=u-r;this.onNavigate(c,a,v)}else u===void 0&&n.findIndex(v=>v[o]===p[o])===n.length-1&&this.onNavigate(c,a)}else if(!this.props.skipDisabledItems&&m)this.onNavigate(c,a);else{let u=null;if(a===i.Keys.down||a===i.Keys.right)u=n.slice(r+1).find(v=>!v.disabled);else if(a===i.Keys.up||a===i.Keys.left){const v=n.slice(0,r);for(u=v.pop();u&&u.disabled;)u=v.pop()}if(u){const v=u.id-r-1;this.onNavigate(c,a,v)}else this.onNavigate(c,a)}this.applyState(c)}const C=()=>{e.preventDefault(),this.base.togglePopup(c),this.applyState(c)},y=this.getFocusedIndex(),I=y===-1,f=!I&&this.getCurrentValueDisabledStatus(o,n,y);m?a===i.Keys.pageUp?(e.preventDefault(),this.base.scrollPopupByPageSize(-1)):a===i.Keys.pageDown?(e.preventDefault(),this.base.scrollPopupByPageSize(1)):e.altKey&&a===i.Keys.up?C():a===i.Keys.enter?(e.preventDefault(),(o&&!I&&e.currentTarget.value?n[y][o]:void 0)?!t&&o&&f?this.clearValueOnEnterOrEsc(e):f||this.applyValueOnEnter(e.currentTarget.value,c):this.applyValueOnEnter(e.currentTarget.value,c)):a===i.Keys.esc&&(!t&&o&&f&&this.clearValueOnEnterOrEsc(e),this.applyValueOnRejectSuggestions(e.currentTarget.value,c)):!m&&a===i.Keys.esc?this.clearValueOnEnterOrEsc(e):e.altKey&&a===i.Keys.down&&C()},this.inputOnChange=e=>{const t=this.base.initState();t.syntheticEvent=e;const o=this.props.opened!==void 0?this.props.opened:this.state.opened,l=e.currentTarget,d=l.value;if(this.props.suggest){const n=l.selectionEnd===d.length;let p=this.props.filter!==void 0?this.props.filter:this.state.text;h.isPresent(p)||(p=h.getItemValue(this.value,this.props.textField)||"");const r=p&&p===d,a=p&&p.length>d.length;r||a||!n?this._suggested="":this.suggestValue(d)}this.props.filter===void 0&&(t.data.text=d),this.state.focusedItem!==void 0&&(t.data.focusedItem=void 0),o||this.base.togglePopup(t),this.base.filterChanged(d,t),this.applyState(t),this.setState({group:void 0})},this.clearButtonClick=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.clearValueOnEnterOrEsc=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.clearValueOnBlur=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.clearValueOnToggleBtnClick=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||ne)},this.showLicenseWatermark=!i.validatePackage(ie.packageMetadata,{component:"ComboBox"})}get _inputId(){return this.props.id}get document(){if(i.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get mobileMode(){var e;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((e=this.props._adaptiveMode)==null?void 0:e.medium)&&this.props.adaptive)}get value(){if(this._valueDuringOnChange!==void 0)return this._valueDuringOnChange;if(this.props.value!==void 0)return this.props.value;if(this.state.value!==void 0)return this.state.value;if(this.props.defaultValue!==void 0)return this.props.defaultValue}get index(){const{dataItemKey:s}=this.props,e=h.getFilteredData(this.props),t=this.value;return e.findIndex(o=>h.areSame(o,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:D.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:D.defaultProps.required}componentDidUpdate(s,e){var C;const{dataItemKey:t,virtual:o,groupField:l="",textField:d}=this.props,n=h.getFilteredData(this.props),p=s.virtual?s.virtual.total:0,r=this.props.opened!==void 0?this.props.opened:this.state.opened,a=s.opened!==void 0?s.opened:e.opened;s.data!==n&&this.checkForDuplicatePlainTextRecords();const m=!a&&r,c=this.value;if(this._valueOnDidUpdate=c,this.base.didUpdate(),o&&o.total!==p)this.base.vs.calcScrollElementHeight(),this.base.vs.reset();else{const y=s.value!==void 0?s.value:e.value;let I=this.hasDuplicates?this.navigationIndex||0:n.findIndex(u=>h.areSame(u,c,t));this.props.groupMode==="modern"&&d&&c&&(I=(C=this.base.getGroupedDataModernMode(n,l))==null?void 0:C.map(u=>u[d]).indexOf(c[d]));const f=!h.areSame(y,c,t);m&&o?this.base.scrollToVirtualItem(o,I):m&&!o?(this.onPopupOpened(),n&&n.length!==0&&this.base.resetGroupStickyHeader(n[0][l],this),this.base.scrollToItem(I)):(this.hasDuplicates||r&&a&&c&&f)&&this.base.scrollToItem(I)}m&&this._input&&this._input.focus(),this.setValidity()}componentDidMount(){var s;this.observerResize=i.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),this.checkForDuplicatePlainTextRecords()}componentWillUnmount(){var s;(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.disconnect()}render(){const s=R.provideLocalizationService(this).toLanguageString(k.comboArrowBtnAriaLabelExpand,k.messages[k.comboArrowBtnAriaLabelExpand]),e=R.provideLocalizationService(this).toLanguageString(k.comboArrowBtnAriaLabelCollapse,k.messages[k.comboArrowBtnAriaLabelCollapse]),{dir:t,disabled:o,clearButton:l=D.defaultProps.clearButton,label:d,textField:n,className:p,style:r,loading:a,iconClassName:m,virtual:c,size:C,rounded:y,fillMode:I,opened:f=this.state.opened,placeholder:u,svgIcon:v,unstyled:x}=this.props,S=!this.validityStyles||this.validity.valid,w=this.props.filter!==void 0?this.props.filter:this.state.text,W=h.getItemValue(this.value,n),M=h.isPresent(w)?w:W,j=l&&(!!M||h.isPresent(this.value)),F=this.base.vs,P=this.props.id||this._inputId,T=this.mobileMode,O=x&&x.uComboBox;F.enabled=c!==void 0,c!==void 0&&(F.skip=c.skip,F.total=c.total,F.pageSize=c.pageSize);const[G,U]=q(this.props.prefix||g.Fragment),[$,Y]=q(this.props.suffix||g.Fragment),_=g.createElement(g.Fragment,null,g.createElement("span",{className:i.classNames(i.uComboBox.wrapper({c:O,size:C,rounded:y,fillMode:I,disabled:o,invalid:!S,loading:a,required:this.required}),p),ref:this.componentRef,style:d?{...r,width:void 0}:r,dir:t},this.props.prefix&&g.createElement(G,{...U}),this.renderSearchBar(M||"",P,u),j&&!a&&g.createElement(oe,{onClick:this.clearButtonClick,key:"clearbutton"}),a&&g.createElement(i.IconWrap,{className:i.classNames(i.uComboBox.loadingIcon({c:O})),name:"loading",key:"loading"}),this.props.suffix&&g.createElement($,{...Y}),g.createElement(K.Button,{tabIndex:-1,type:"button","aria-label":f?e:s,icon:m?void 0:"caret-alt-down",svgIcon:v||L.caretAltDownIcon,iconClass:m,size:C,fillMode:I,rounded:null,themeColor:"base",className:i.classNames(i.uComboBox.inputButton({c:O})),onClick:this.toggleBtnClick,onMouseDown:J=>J.preventDefault()}),!T&&this.renderListContainer()),T&&this.renderAdaptiveListContainer());return d?g.createElement(X.FloatingLabel,{label:d,editorId:P,editorValue:M,editorValid:S,editorDisabled:o,style:{width:r?r.width:void 0},children:_,unstyled:x}):_}onNavigate(s,e,t){const{virtual:o={skip:0}}=this.props,l=h.getFilteredData(this.props),d=this.props.filter?this.props.filter:this.state.text;let n=-1,p;const r=this.base.vs,a=this.value;this._suggested="";const m=this.hasDuplicates&&this.duplicates.indexOf(a)!==-1;if(n=this.getFocusedIndex(m),n!==-1&&!h.isPresent(a))this.handleItemSelect(n,s);else if(d==="")this.handleItemSelect(0,s);else{const c=o.skip+n;p=this.base.navigation.navigate({keyCode:e,current:c,max:(r.enabled?r.total:l.length)-1,min:0,skipItems:t||void 0}),p!==void 0&&this.handleItemSelect(p,s)}this.navigationIndex=p}getCurrentValueDisabledStatus(s,e,t){return s&&e&&e[t]&&e[t].disabled}applyValueOnEnter(s,e){const{textField:t,allowCustom:o}=this.props,l=h.getFilteredData(this.props),d=this.props.opened!==void 0?this.props.opened:this.state.opened,p=h.getItemValue(this.value,t)===s?this.index:h.getItemIndexByText(l,s,t),r=p!==-1;let a;if(this._suggested="",r)a=l[p];else if(o)a=t!==void 0?{[t]:s}:s;else return this.selectFocusedItem(s,e);this.triggerOnChange(a,e),d&&this.base.togglePopup(e),this.props.filter===void 0&&this.state.text!==void 0&&(e.data.text=void 0),this.applyState(e)}applyValueOnRejectSuggestions(s,e){const{textField:t,allowCustom:o}=this.props,l=h.getFilteredData(this.props),d=this.props.opened!==void 0?this.props.opened:this.state.opened,n=h.getItemValue(this.value,t);if(this._suggested="",s===n||s===""&&!h.isPresent(n))return this.closeOpenedApplyStateNonMobileMode(e,d),this.applyState(e);const p=h.getItemIndexByText(l,s,t,!0),r=p!==-1;let a=null;r?a=l[p]:o&&(a=s?t?{[t]:s}:s:null),this.triggerOnChange(a,e),this.state.text!==void 0&&(e.data.text=void 0,this.base.filterChanged("",e)),this.closeOpenedApplyStateNonMobileMode(e,d),this.applyState(e)}selectFocusedItem(s,e){const t=this.props.opened!==void 0?this.props.opened:this.state.opened,{textField:o,virtual:l={skip:0},focusedItemIndex:d=h.itemIndexStartsWith}=this.props,n=h.getFilteredData(this.props),p=l.skip,r=s===""&&p===0?0:d(n,s,o);return r!==-1?this.handleItemSelect(r+p,e):(this.triggerOnChange(null,e),this.state.text!==void 0&&(e.data.text=void 0)),t&&this.base.togglePopup(e),this.applyState(e)}renderAdaptiveListContainer(){const{windowWidth:s=0}=this.state,{header:e,footer:t,size:o,groupField:l,groupMode:d,list:n,virtual:p,adaptiveTitle:r,groupStickyHeaderItemRender:a,unstyled:m,_adaptiveMode:c}=this.props,C=h.getFilteredData(this.props),y=this.props.opened!==void 0?this.props.opened:this.state.opened,I=this.base.getAdaptiveAnimation(),f=m&&m.uComboBox,u=m&&m.uDropDownsActionSheet;let{group:v}=this.state;v===void 0&&l!==void 0&&(v=h.getItemValue(C[0],l));const x={navigatable:!1,navigatableElements:[],expand:y,animation:I,onClose:S=>this.toggleBtnClick(S),className:i.classNames(i.uDropDownsActionSheet.wrapper({c:u}),"k-adaptive-actionsheet"),animationStyles:s&&c&&s<=c.small?{top:0,width:"100%",height:"100%"}:void 0,position:s&&c&&s<=c.small?"fullscreen":void 0};return g.createElement(N.ActionSheet,{...x},g.createElement(N.ActionSheetHeader,null,g.createElement("div",{className:i.classNames(i.uDropDownsActionSheet.titleBar({c:u}))},g.createElement("div",{className:i.classNames(i.uDropDownsActionSheet.title({c:u}))},g.createElement("div",{className:i.classNames(i.uDropDownsActionSheet.header({c:u}))},r),g.createElement("div",{className:i.classNames(i.uDropDownsActionSheet.subtitle({c:u}))})),g.createElement("div",{className:i.classNames(i.uDropDownsActionSheet.actions({c:u}))},g.createElement(K.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",themeColor:"base",size:"large",onClick:this.toggleBtnClick,icon:"x",svgIcon:L.xIcon}))),g.createElement("div",{className:i.classNames(i.uDropDownsActionSheet.titleBarGroup({c:u}))},this.renderMobileListFilter())),g.createElement(N.ActionSheetContent,null,g.createElement("div",{className:i.classNames(i.uComboBox.listContainer({c:f}))},g.createElement("div",{className:i.classNames(i.uComboBox.list({c:f,list:n,size:"large",tableSize:o,virtual:p}))},e&&g.createElement("div",{className:i.classNames(i.uComboBox.listHeader({c:f}))},e),!n&&v&&C.length!==0&&g.createElement(A,{group:v,groupMode:d,render:a}),this.renderList(),t&&g.createElement("div",{className:i.classNames(i.uComboBox.listFooter({c:f}),this.props.footerClassName)},t)))))}renderListContainer(){const s=this.base,{dir:e,header:t,footer:o,groupField:l,groupMode:d,size:n,list:p,virtual:r,groupStickyHeaderItemRender:a,unstyled:m}=this.props,c=h.getFilteredData(this.props),C=this.props.opened!==void 0?this.props.opened:this.state.opened,y=s.getPopupSettings(),I=y.width!==void 0?y.width:s.popupWidth,f=m&&m.uComboBox;let{group:u}=this.state;return u===void 0&&l!==void 0&&(u=h.getItemValue(c[0],l)),g.createElement(ee,{width:I,popupSettings:{...y,anchor:y.anchor||this.element,show:C,popupClass:i.classNames(y.popupClass,i.uComboBox.listContainer({c:f,popup:!0}))},dir:e!==void 0?e:this.base.dirCalculated,itemsCount:[c.length]},g.createElement("div",{className:i.classNames(i.uComboBox.list({c:f,list:p,size:n,tableSize:n,virtual:r}))},t&&g.createElement("div",{className:i.classNames(i.uComboBox.listHeader({c:f}))},t),!p&&u&&c.length!==0&&g.createElement(A,{group:u,groupMode:d,render:a}),this.renderList(),o&&g.createElement("div",{className:i.classNames(i.uComboBox.listFooter({c:f}),this.props.footerClassName)},o)),this.showLicenseWatermark&&g.createElement(i.WatermarkOverlay,null))}renderList(){const s=this.base,{textField:e,dataItemKey:t,listNoDataRender:o,itemRender:l,groupHeaderItemRender:d,virtual:n={skip:0,total:void 0},unstyled:p}=this.props,r=h.getFilteredData(this.props),a=s.getPopupSettings(),m=s.vs,c=n.skip,C=this.props.opened!==void 0?this.props.opened:this.state.opened,y=`translateY(${m.translate}px)`,I=C?this.getFocusedIndex(this.hasDuplicates):void 0,f=this.props.filter!==void 0?this.props.filter:this.state.text,u=h.getItemValue(this.value,e),v=h.isPresent(f)&&f!==u?null:this.value,x=this.props.list||te,S=p&&p.uComboBox;return g.createElement(x,{id:s.listBoxId,virtual:!!n,show:C,data:r,focusedIndex:I,value:v,textField:e,valueField:t,groupField:this.props.groupField,groupMode:this.props.groupMode,isMultiColumn:this.props.isMultiColumn,optionsGuid:s.guid,hasDuplicates:this.hasDuplicates,listRef:w=>{m.list=this.base.list=w,this.itemHeight=0},wrapperStyle:this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth>this.props._adaptiveMode.medium?{maxHeight:a.height}:{},wrapperCssClass:i.classNames(i.uComboBox.listContent({c:S,virtual:n})),listStyle:m.enabled?{transform:y}:void 0,key:"listkey",skip:c,onClick:this.handleItemClick,itemRender:l,groupHeaderItemRender:d,noDataRender:o,onMouseDown:w=>w.preventDefault(),onScroll:this.onScroll,wrapperRef:m.scrollerRef,scroller:this.base.renderScrollElement(),ariaSetSize:n.total})}renderSearchBar(s,e,t){const{tabIndex:o,disabled:l,title:d,ariaLabelledBy:n,ariaDescribedBy:p,dataItemKey:r,virtual:a={skip:0},accessKey:m,unstyled:c,inputAttributes:C}=this.props,y=h.getFilteredData(this.props),I=this.props.opened!==void 0?this.props.opened:this.state.opened,f=this.value,u=Math.max(0,y.findIndex(v=>h.areSame(v,f,r)));return this._suggested&&!h.areSame(this._valueOnDidUpdate,f,r)&&(this._suggested=""),g.createElement(Z,{id:e,readOnly:I&&this.mobileMode,placeholder:t,tabIndex:o,title:d,value:s+this._suggested,suggestedText:this._suggested,ref:v=>this._input=v&&v.input,onClick:this.onInputClick,onKeyDown:this.onInputKeyDown,onChange:this.inputOnChange,onFocus:this.base.handleFocus,onBlur:this.handleBlur,disabled:l,expanded:I,owns:this.base.listBoxId,activedescendant:`option-${this.base.guid}-${u+a.skip}`,role:"combobox",ariaLabelledBy:n,ariaLabel:this.props.ariaLabel,ariaDescribedBy:p,ariaRequired:this.required,render:this.props.valueRender,ariaControls:this.base.listBoxId,unstyled:c,inputAttributes:C})}clearValue(){const s=this.base.initState();this._suggested="",this.navigationIndex=void 0,this.base.filterChanged("",s),this.props.filter===void 0&&this.state.text!==void 0&&(s.data.text=void 0),this.triggerOnChange(null,s);const e=this.props.opened!==void 0?this.props.opened:this.state.opened,t=this.mobileMode;e&&!t&&this.base.togglePopup(s),this.applyState(s)}triggerOnChange(s,e){const t=this.value;!this.hasDuplicates&&(!h.isPresent(t)&&!h.isPresent(s)||h.areSame(t,s,this.props.dataItemKey))||(this.props.value===void 0&&(e.data.value=s),this._valueDuringOnChange=s,e.events.push({type:"onChange"}))}getFocusedIndex(s){const e=this.value,{textField:t,dataItemKey:o,virtual:l={skip:0},focusedItemIndex:d=h.itemIndexStartsWith,skipDisabledItems:n}=this.props,p=h.getFilteredData(this.props),r=this.props.filter?this.props.filter:this.state.text;return s&&this.navigationIndex!==void 0?this.navigationIndex:h.isPresent(e)&&r===void 0?p.findIndex(a=>h.areSame(a,e,o)):r?d(p,r,t):n&&t&&!r&&l.skip===0?p.findIndex(a=>!a.disabled&&a[t]):l.skip===0?0:-1}suggestValue(s){const{data:e,textField:t}=this.props;this._suggested=h.suggestValue(s,e,t)}applyState(s){this.base.applyState(s),this._valueDuringOnChange=void 0}calculateMedia(s){for(const e of s)this.setState({windowWidth:e.target.clientWidth})}};D.displayName="ComboBox",D.propTypes={...V.propTypes,size:b.oneOf([null,"small","medium","large"]),rounded:b.oneOf([null,"small","medium","large","full"]),fillMode:b.oneOf([null,"solid","flat","outline"]),dataItemKey:b.string,groupField:b.string,groupMode:b.oneOf([void 0,"classic","modern"]),isMultiColumn:b.bool,suggest:b.bool,placeholder:b.string,title:b.string,allowCustom:b.bool,clearButton:b.bool,iconClassName:b.string,svgIcon:i.svgIconPropType,validationMessage:b.string,required:b.bool,id:b.string,ariaLabelledBy:b.string,ariaLabel:b.string,ariaDescribedBy:b.string,list:b.any,valueRender:b.func,skipDisabledItems:b.bool,inputAttributes:b.object},D.defaultProps={...V.defaultProps,size:"medium",rounded:"medium",fillMode:"solid",allowCustom:!1,clearButton:!0,required:!1,groupMode:"modern",isMultiColumn:!1,skipDisabledItems:!0,prefix:void 0,suffix:void 0};let E=D;const z=i.createPropsContext(),H=i.withIdHOC(i.withPropsContext(z,i.withUnstyledHOC(i.withAdaptiveModeContext(E))));H.displayName="KendoReactComboBox";exports.ComboBox=H;exports.ComboBoxPropsContext=z;exports.ComboBoxWithoutContext=E;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Q=require("react"),b=require("prop-types"),V=require("../common/DropDownBase.js"),i=require("@progress/kendo-react-common"),X=require("@progress/kendo-react-labels"),h=require("../common/utils.js"),Z=require("../common/SearchBar.js"),ee=require("../common/ListContainer.js"),te=require("../common/List.js"),se=require("../common/ListFilter.js"),A=require("../common/GroupStickyHeader.js"),ie=require("../package-metadata.js"),oe=require("../common/ClearButton.js"),K=require("@progress/kendo-react-buttons"),L=require("@progress/kendo-svg-icons"),k=require("../messages/index.js"),R=require("@progress/kendo-react-intl"),N=require("@progress/kendo-react-layout"),q=require("../common/withCustomComponent.js");function ae(B){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(B){for(const e in B)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(B,e);Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:()=>B[e]})}}return s.default=B,Object.freeze(s)}const g=ae(Q),ne="Please enter a valid value!",D=class D extends g.Component{constructor(s){super(s),this.state={},this.base=new V(this),this._element=null,this._suggested="",this._skipBlur=!1,this._input=null,this._adaptiveFilterInput=null,this.itemHeight=0,this.duplicates=[],this.hasDuplicates=!1,this.showLicenseWatermark=!1,this.focus=()=>{this._input&&this._input.focus()},this.checkForDuplicatePlainTextRecords=()=>{const e=this.props.textField!==void 0,t=this.props.dataItemKey!==void 0;if(this.props.data&&this.props.data.length>0&&!e&&!t){const o=this.props.data;this.duplicates=h.getPlainDataDuplicates(o),this.hasDuplicates=this.duplicates.length>0}},this.handleItemSelect=(e,t)=>{const{virtual:o,dataItemKey:l}=this.props,d=h.getFilteredData(this.props),n=o?o.skip:0,p=d[e-n],r=this.hasDuplicates||!h.areSame(p,this.value,l);this.triggerOnChange(p,t),this.state.text!==void 0&&(t.data.text=void 0),r&&this.base.triggerPageChangeCornerItems(p,t)},this.onPopupOpened=()=>{setTimeout(()=>{this.mobileMode&&this._adaptiveFilterInput&&(this._skipBlur=!0,this._adaptiveFilterInput.focus(),this._skipBlur=!1)},300)},this.componentRef=e=>{this._element=e,this.base.wrapper=e},this.toggleBtnClick=e=>{const{skipDisabledItems:t,textField:o}=this.props,l=h.getFilteredData(this.props),d=this.getFocusedIndex(),n=this.getCurrentValueDisabledStatus(o,l,d),p=this.props.opened!==void 0?this.props.opened:this.state.opened,r=this.base.initState();if(r.syntheticEvent=e,!t&&o&&n&&this.clearValueOnToggleBtnClick(e),this.base.togglePopup(r),!p&&this.mobileMode){const a=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text||null;this.base.filterChanged(a,r)}this.applyState(r)},this.closeOpenedApplyStateNonMobileMode=(e,t)=>{t&&!this.mobileMode&&this.base.togglePopup(e)},this.renderMobileListFilter=()=>{const e=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text,t=h.getItemValue(this.value,this.props.textField),o=h.isPresent(e)?e:t;return g.createElement(se,{value:o,ref:l=>{this._adaptiveFilterInput=l&&l.element},onChange:this.handleMobileFilterChange,onKeyDown:this.onInputKeyDown,size:"large",rounded:this.props.rounded,fillMode:this.props.fillMode})},this.handleMobileFilterChange=e=>{const t=this.base.initState();t.syntheticEvent=e.syntheticEvent,t.data.text=e.target.value,this.base.filterChanged(e.target.value,t),this.applyState(t)},this.onScroll=e=>{const{vs:t,list:o}=this.base;t.scrollHandler(e);const{groupField:l}=this.props;let d=h.getFilteredData(this.props);if(!l||!d.length)return;const n=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:o?o.children[0].offsetHeight:0),r=e.target.scrollTop-t.skip*n;this.props.groupMode==="modern"&&(d=this.base.getGroupedDataModernMode(d,l));let a=d[0][l];for(let m=1;m<d.length&&!(n*m>r);m++)d[m]&&d[m][l]&&(a=d[m][l]);a!==this.state.group&&(this.setState({group:a}),this.props.onGroupScroll&&this.props.onGroupScroll.call(void 0,{group:a}))},this.handleItemClick=(e,t)=>{this.navigationIndex=e,this.base.handleItemClick(e,t),this._valueDuringOnChange=void 0},this.handleBlur=e=>{if(this.state.focused&&!this._skipBlur){const t=this.base.initState(),{textField:o}=this.props,l=h.getFilteredData(this.props),d=this.getFocusedIndex(),p=!(d===-1)&&this.getCurrentValueDisabledStatus(o,l,d);t.data.focused=!1,t.events.push({type:"onBlur"}),t.syntheticEvent=e,o&&p&&this.clearValueOnBlur(e),this.applyValueOnRejectSuggestions(e.currentTarget.value,t)}},this.onInputClick=e=>{const t=this.props.opened!==void 0?this.props.opened:this.state.opened,o=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text||null;if(!t&&this.mobileMode){const l=this.base.initState();l.syntheticEvent=e,this.base.togglePopup(l),this.base.filterChanged(o,l),this.applyState(l)}},this.onInputKeyDown=e=>{const{skipDisabledItems:t,textField:o,dataItemKey:l,groupField:d}=this.props,n=h.getFilteredData(this.props),p=this.value,r=Math.max(0,n.findIndex(u=>h.areSame(u,p,l))),a=e.keyCode,m=this.props.opened!==void 0?this.props.opened:this.state.opened,c=this.base.initState();if(c.syntheticEvent=e,!e.altKey&&(a===i.Keys.up||a===i.Keys.down)){if(e.preventDefault(),d!==""&&o)if(!this.props.skipDisabledItems&&m)this.onNavigate(c,a);else{let u=0;if(a===i.Keys.down||a===i.Keys.right){const v=n.slice(r+1<n.length?r+1:r).find(x=>!x.disabled&&x[o]);u=v&&n.findIndex(x=>x[o]===v[o])}else if(a===i.Keys.up||a===i.Keys.left){let v;if(r===0)v=n,u=n.findIndex(x=>!x.disabled&&x[o]);else{v=n.slice(0,r);let x=v.pop();for(;x&&x.disabled;)x=v.pop();u=x&&n.findIndex(S=>S[o]===x[o])}}if(u!==void 0){const v=u-r;this.onNavigate(c,a,v)}else u===void 0&&n.findIndex(v=>v[o]===p[o])===n.length-1&&this.onNavigate(c,a)}else if(!this.props.skipDisabledItems&&m)this.onNavigate(c,a);else{let u=null;if(a===i.Keys.down||a===i.Keys.right)u=n.slice(r+1).find(v=>!v.disabled);else if(a===i.Keys.up||a===i.Keys.left){const v=n.slice(0,r);for(u=v.pop();u&&u.disabled;)u=v.pop()}if(u){const v=u.id-r-1;this.onNavigate(c,a,v)}else this.onNavigate(c,a)}this.applyState(c)}const C=()=>{e.preventDefault(),this.base.togglePopup(c),this.applyState(c)},y=this.getFocusedIndex(),I=y===-1,f=!I&&this.getCurrentValueDisabledStatus(o,n,y);m?a===i.Keys.pageUp?(e.preventDefault(),this.base.scrollPopupByPageSize(-1)):a===i.Keys.pageDown?(e.preventDefault(),this.base.scrollPopupByPageSize(1)):e.altKey&&a===i.Keys.up?C():a===i.Keys.enter?(e.preventDefault(),(o&&!I&&e.currentTarget.value?n[y][o]:void 0)?!t&&o&&f?this.clearValueOnEnterOrEsc(e):f||this.applyValueOnEnter(e.currentTarget.value,c):this.applyValueOnEnter(e.currentTarget.value,c)):a===i.Keys.esc&&(!t&&o&&f&&this.clearValueOnEnterOrEsc(e),this.applyValueOnRejectSuggestions(e.currentTarget.value,c)):!m&&a===i.Keys.esc?this.clearValueOnEnterOrEsc(e):e.altKey&&a===i.Keys.down&&C()},this.inputOnChange=e=>{const t=this.base.initState();t.syntheticEvent=e;const o=this.props.opened!==void 0?this.props.opened:this.state.opened,l=e.currentTarget,d=l.value;if(this.props.suggest){const n=l.selectionEnd===d.length;let p=this.props.filter!==void 0?this.props.filter:this.state.text;h.isPresent(p)||(p=h.getItemValue(this.value,this.props.textField)||"");const r=p&&p===d,a=p&&p.length>d.length;r||a||!n?this._suggested="":this.suggestValue(d)}this.props.filter===void 0&&(t.data.text=d),this.state.focusedItem!==void 0&&(t.data.focusedItem=void 0),o||this.base.togglePopup(t),this.base.filterChanged(d,t),this.applyState(t),this.setState({group:void 0})},this.clearButtonClick=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.clearValueOnEnterOrEsc=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.clearValueOnBlur=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.clearValueOnToggleBtnClick=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.clearValue()},this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||ne)},this.showLicenseWatermark=!i.validatePackage(ie.packageMetadata,{component:"ComboBox"})}get _inputId(){return this.props.id}get document(){if(i.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get mobileMode(){var e;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((e=this.props._adaptiveMode)==null?void 0:e.medium)&&this.props.adaptive)}get value(){if(this._valueDuringOnChange!==void 0)return this._valueDuringOnChange;if(this.props.value!==void 0)return this.props.value;if(this.state.value!==void 0)return this.state.value;if(this.props.defaultValue!==void 0)return this.props.defaultValue}get index(){const{dataItemKey:s}=this.props,e=h.getFilteredData(this.props),t=this.value;return e.findIndex(o=>h.areSame(o,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:D.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:D.defaultProps.required}componentDidUpdate(s,e){var C;const{dataItemKey:t,virtual:o,groupField:l="",textField:d}=this.props,n=h.getFilteredData(this.props),p=s.virtual?s.virtual.total:0,r=this.props.opened!==void 0?this.props.opened:this.state.opened,a=s.opened!==void 0?s.opened:e.opened;s.data!==n&&this.checkForDuplicatePlainTextRecords();const m=!a&&r,c=this.value;if(this._valueOnDidUpdate=c,this.base.didUpdate(),o&&o.total!==p)this.base.vs.calcScrollElementHeight(),this.base.vs.reset();else{const y=s.value!==void 0?s.value:e.value;let I=this.hasDuplicates?this.navigationIndex||0:n.findIndex(u=>h.areSame(u,c,t));this.props.groupMode==="modern"&&d&&c&&(I=(C=this.base.getGroupedDataModernMode(n,l))==null?void 0:C.map(u=>u[d]).indexOf(c[d]));const f=!h.areSame(y,c,t);m&&o?this.base.scrollToVirtualItem(o,I):m&&!o?(this.onPopupOpened(),n&&n.length!==0&&this.base.resetGroupStickyHeader(n[0][l],this),this.base.scrollToItem(I)):(this.hasDuplicates||r&&a&&c&&f)&&this.base.scrollToItem(I)}m&&this._input&&this._input.focus(),this.setValidity()}componentDidMount(){var s;this.observerResize=i.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),this.checkForDuplicatePlainTextRecords()}componentWillUnmount(){var s;(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.disconnect()}render(){const s=R.provideLocalizationService(this).toLanguageString(k.comboArrowBtnAriaLabelExpand,k.messages[k.comboArrowBtnAriaLabelExpand]),e=R.provideLocalizationService(this).toLanguageString(k.comboArrowBtnAriaLabelCollapse,k.messages[k.comboArrowBtnAriaLabelCollapse]),{dir:t,disabled:o,clearButton:l=D.defaultProps.clearButton,label:d,textField:n,className:p,style:r,loading:a,iconClassName:m,virtual:c,size:C,rounded:y,fillMode:I,opened:f=this.state.opened,placeholder:u,svgIcon:v,unstyled:x}=this.props,S=!this.validityStyles||this.validity.valid,w=this.props.filter!==void 0?this.props.filter:this.state.text,W=h.getItemValue(this.value,n),M=h.isPresent(w)?w:W,j=l&&(!!M||h.isPresent(this.value)),F=this.base.vs,P=this.props.id||this._inputId,T=this.mobileMode,O=x&&x.uComboBox;F.enabled=c!==void 0,c!==void 0&&(F.skip=c.skip,F.total=c.total,F.pageSize=c.pageSize);const[G,U]=q(this.props.prefix||g.Fragment),[$,Y]=q(this.props.suffix||g.Fragment),_=g.createElement(g.Fragment,null,g.createElement("span",{className:i.classNames(i.uComboBox.wrapper({c:O,size:C,rounded:y,fillMode:I,disabled:o,invalid:!S,loading:a,required:this.required}),p),ref:this.componentRef,style:d?{...r,width:void 0}:r,dir:t},this.props.prefix&&g.createElement(G,{...U}),this.renderSearchBar(M||"",P,u),j&&!a&&g.createElement(oe,{onClick:this.clearButtonClick,key:"clearbutton"}),a&&g.createElement(i.IconWrap,{className:i.classNames(i.uComboBox.loadingIcon({c:O})),name:"loading",key:"loading"}),this.props.suffix&&g.createElement($,{...Y}),g.createElement(K.Button,{tabIndex:-1,type:"button","aria-label":f?e:s,icon:m?void 0:"caret-alt-down",svgIcon:v||L.caretAltDownIcon,iconClass:m,size:C,fillMode:I,rounded:null,themeColor:"base",className:i.classNames(i.uComboBox.inputButton({c:O})),onClick:this.toggleBtnClick,onMouseDown:J=>J.preventDefault()}),!T&&this.renderListContainer()),T&&this.renderAdaptiveListContainer());return d?g.createElement(X.FloatingLabel,{label:d,editorId:P,editorValue:M,editorValid:S,editorDisabled:o,style:{width:r?r.width:void 0},children:_,unstyled:x}):_}onNavigate(s,e,t){const{virtual:o={skip:0}}=this.props,l=h.getFilteredData(this.props),d=this.props.filter?this.props.filter:this.state.text;let n=-1,p;const r=this.base.vs,a=this.value;this._suggested="";const m=this.hasDuplicates&&this.duplicates.indexOf(a)!==-1;if(n=this.getFocusedIndex(m),n!==-1&&!h.isPresent(a))this.handleItemSelect(n,s);else if(d==="")this.handleItemSelect(0,s);else{const c=o.skip+n;p=this.base.navigation.navigate({keyCode:e,current:c,max:(r.enabled?r.total:l.length)-1,min:0,skipItems:t||void 0}),p!==void 0&&this.handleItemSelect(p,s)}this.navigationIndex=p}getCurrentValueDisabledStatus(s,e,t){return s&&e&&e[t]&&e[t].disabled}applyValueOnEnter(s,e){const{textField:t,allowCustom:o}=this.props,l=h.getFilteredData(this.props),d=this.props.opened!==void 0?this.props.opened:this.state.opened,p=h.getItemValue(this.value,t)===s?this.index:h.getItemIndexByText(l,s,t),r=p!==-1;let a;if(this._suggested="",r)a=l[p];else if(o)a=t!==void 0?{[t]:s}:s;else return this.selectFocusedItem(s,e);this.triggerOnChange(a,e),d&&this.base.togglePopup(e),this.props.filter===void 0&&this.state.text!==void 0&&(e.data.text=void 0),this.applyState(e)}applyValueOnRejectSuggestions(s,e){const{textField:t,allowCustom:o}=this.props,l=h.getFilteredData(this.props),d=this.props.opened!==void 0?this.props.opened:this.state.opened,n=h.getItemValue(this.value,t);if(this._suggested="",s===n||s===""&&!h.isPresent(n))return this.closeOpenedApplyStateNonMobileMode(e,d),this.applyState(e);const p=h.getItemIndexByText(l,s,t,!0),r=p!==-1;let a=null;r?a=l[p]:o&&(a=s?t?{[t]:s}:s:null),this.triggerOnChange(a,e),this.state.text!==void 0&&(e.data.text=void 0,this.base.filterChanged("",e)),this.closeOpenedApplyStateNonMobileMode(e,d),this.applyState(e)}selectFocusedItem(s,e){const t=this.props.opened!==void 0?this.props.opened:this.state.opened,{textField:o,virtual:l={skip:0},focusedItemIndex:d=h.itemIndexStartsWith}=this.props,n=h.getFilteredData(this.props),p=l.skip,r=s===""&&p===0?0:d(n,s,o);return r!==-1?this.handleItemSelect(r+p,e):(this.triggerOnChange(null,e),this.state.text!==void 0&&(e.data.text=void 0)),t&&this.base.togglePopup(e),this.applyState(e)}renderAdaptiveListContainer(){const{windowWidth:s=0}=this.state,{header:e,footer:t,size:o,groupField:l,groupMode:d,list:n,virtual:p,adaptiveTitle:r,groupStickyHeaderItemRender:a,unstyled:m,_adaptiveMode:c}=this.props,C=h.getFilteredData(this.props),y=this.props.opened!==void 0?this.props.opened:this.state.opened,I=this.base.getAdaptiveAnimation(),f=m&&m.uComboBox,u=m&&m.uDropDownsActionSheet;let{group:v}=this.state;v===void 0&&l!==void 0&&(v=h.getItemValue(C[0],l));const x={navigatable:!1,navigatableElements:[],expand:y,animation:I,onClose:S=>this.toggleBtnClick(S),className:i.classNames(i.uDropDownsActionSheet.wrapper({c:u}),"k-adaptive-actionsheet"),animationStyles:s&&c&&s<=c.small?{top:0,width:"100%",height:"100%"}:void 0,position:s&&c&&s<=c.small?"fullscreen":void 0};return g.createElement(N.ActionSheet,{...x},g.createElement(N.ActionSheetHeader,null,g.createElement("div",{className:i.classNames(i.uDropDownsActionSheet.titleBar({c:u}))},g.createElement("div",{className:i.classNames(i.uDropDownsActionSheet.title({c:u}))},g.createElement("div",{className:i.classNames(i.uDropDownsActionSheet.header({c:u}))},r),g.createElement("div",{className:i.classNames(i.uDropDownsActionSheet.subtitle({c:u}))})),g.createElement("div",{className:i.classNames(i.uDropDownsActionSheet.actions({c:u}))},g.createElement(K.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",themeColor:"base",size:"large",onClick:this.toggleBtnClick,icon:"x",svgIcon:L.xIcon}))),g.createElement("div",{className:i.classNames(i.uDropDownsActionSheet.titleBarGroup({c:u}))},this.renderMobileListFilter())),g.createElement(N.ActionSheetContent,null,g.createElement("div",{className:i.classNames(i.uComboBox.listContainer({c:f}))},g.createElement("div",{className:i.classNames(i.uComboBox.list({c:f,list:n,size:"large",tableSize:o,virtual:p}))},e&&g.createElement("div",{className:i.classNames(i.uComboBox.listHeader({c:f}))},e),!n&&v&&C.length!==0&&g.createElement(A,{group:v,groupMode:d,render:a}),this.renderList(),t&&g.createElement("div",{className:i.classNames(i.uComboBox.listFooter({c:f}),this.props.footerClassName)},t)))))}renderListContainer(){const s=this.base,{dir:e,header:t,footer:o,groupField:l,groupMode:d,size:n,list:p,virtual:r,groupStickyHeaderItemRender:a,unstyled:m}=this.props,c=h.getFilteredData(this.props),C=this.props.opened!==void 0?this.props.opened:this.state.opened,y=s.getPopupSettings(),I=y.width!==void 0?y.width:s.popupWidth,f=m&&m.uComboBox;let{group:u}=this.state;return u===void 0&&l!==void 0&&(u=h.getItemValue(c[0],l)),g.createElement(ee,{width:I,popupSettings:{...y,anchor:y.anchor||this.element,show:C,popupClass:i.classNames(y.popupClass,i.uComboBox.listContainer({c:f,popup:!0}))},dir:e!==void 0?e:this.base.dirCalculated,itemsCount:[c.length]},g.createElement("div",{className:i.classNames(i.uComboBox.list({c:f,list:p,size:n,tableSize:n,virtual:r}))},t&&g.createElement("div",{className:i.classNames(i.uComboBox.listHeader({c:f}))},t),!p&&u&&c.length!==0&&g.createElement(A,{group:u,groupMode:d,render:a}),this.renderList(),o&&g.createElement("div",{className:i.classNames(i.uComboBox.listFooter({c:f}),this.props.footerClassName)},o)),this.showLicenseWatermark&&g.createElement(i.WatermarkOverlay,null))}renderList(){const s=this.base,{textField:e,dataItemKey:t,listNoDataRender:o,itemRender:l,groupHeaderItemRender:d,virtual:n={skip:0,total:void 0},unstyled:p}=this.props,r=h.getFilteredData(this.props),a=s.getPopupSettings(),m=s.vs,c=n.skip,C=this.props.opened!==void 0?this.props.opened:this.state.opened,y=`translateY(${m.translate}px)`,I=C?this.getFocusedIndex(this.hasDuplicates):void 0,f=this.props.filter!==void 0?this.props.filter:this.state.text,u=h.getItemValue(this.value,e),v=h.isPresent(f)&&f!==u?null:this.value,x=this.props.list||te,S=p&&p.uComboBox;return g.createElement(x,{id:s.listBoxId,virtual:!!n,show:C,data:r,focusedIndex:I,value:v,textField:e,valueField:t,groupField:this.props.groupField,groupMode:this.props.groupMode,isMultiColumn:this.props.isMultiColumn,optionsGuid:s.guid,hasDuplicates:this.hasDuplicates,listRef:w=>{m.list=this.base.list=w,this.itemHeight=0},wrapperStyle:this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth>this.props._adaptiveMode.medium?{maxHeight:a.height}:{},wrapperCssClass:i.classNames(i.uComboBox.listContent({c:S,virtual:n})),listStyle:m.enabled?{transform:y}:void 0,key:"listkey",skip:c,onClick:this.handleItemClick,itemRender:l,groupHeaderItemRender:d,noDataRender:o,onMouseDown:w=>w.preventDefault(),onScroll:this.onScroll,wrapperRef:m.scrollerRef,scroller:this.base.renderScrollElement(),ariaSetSize:n.total})}renderSearchBar(s,e,t){const{tabIndex:o,disabled:l,title:d,ariaLabelledBy:n,ariaDescribedBy:p,dataItemKey:r,virtual:a={skip:0},accessKey:m,unstyled:c,inputAttributes:C}=this.props,y=h.getFilteredData(this.props),I=this.props.opened!==void 0?this.props.opened:this.state.opened,f=this.value,u=Math.max(0,y.findIndex(v=>h.areSame(v,f,r)));return this._suggested&&!h.areSame(this._valueOnDidUpdate,f,r)&&(this._suggested=""),g.createElement(Z,{id:e,readOnly:I&&this.mobileMode,placeholder:t,tabIndex:o,title:d,value:s+this._suggested,suggestedText:this._suggested,ref:v=>{this._input=v&&v.input},onClick:this.onInputClick,onKeyDown:this.onInputKeyDown,onChange:this.inputOnChange,onFocus:this.base.handleFocus,onBlur:this.handleBlur,disabled:l,expanded:I,owns:this.base.listBoxId,activedescendant:`option-${this.base.guid}-${u+a.skip}`,role:"combobox",ariaLabelledBy:n,ariaLabel:this.props.ariaLabel,ariaDescribedBy:p,ariaRequired:this.required,render:this.props.valueRender,ariaControls:this.base.listBoxId,unstyled:c,inputAttributes:C})}clearValue(){const s=this.base.initState();this._suggested="",this.navigationIndex=void 0,this.base.filterChanged("",s),this.props.filter===void 0&&this.state.text!==void 0&&(s.data.text=void 0),this.triggerOnChange(null,s);const e=this.props.opened!==void 0?this.props.opened:this.state.opened,t=this.mobileMode;e&&!t&&this.base.togglePopup(s),this.applyState(s)}triggerOnChange(s,e){const t=this.value;!this.hasDuplicates&&(!h.isPresent(t)&&!h.isPresent(s)||h.areSame(t,s,this.props.dataItemKey))||(this.props.value===void 0&&(e.data.value=s),this._valueDuringOnChange=s,e.events.push({type:"onChange"}))}getFocusedIndex(s){const e=this.value,{textField:t,dataItemKey:o,virtual:l={skip:0},focusedItemIndex:d=h.itemIndexStartsWith,skipDisabledItems:n}=this.props,p=h.getFilteredData(this.props),r=this.props.filter?this.props.filter:this.state.text;return s&&this.navigationIndex!==void 0?this.navigationIndex:h.isPresent(e)&&r===void 0?p.findIndex(a=>h.areSame(a,e,o)):r?d(p,r,t):n&&t&&!r&&l.skip===0?p.findIndex(a=>!a.disabled&&a[t]):l.skip===0?0:-1}suggestValue(s){const{data:e,textField:t}=this.props;this._suggested=h.suggestValue(s,e,t)}applyState(s){this.base.applyState(s),this._valueDuringOnChange=void 0}calculateMedia(s){for(const e of s)this.setState({windowWidth:e.target.clientWidth})}};D.displayName="ComboBox",D.propTypes={...V.propTypes,size:b.oneOf([null,"small","medium","large"]),rounded:b.oneOf([null,"small","medium","large","full"]),fillMode:b.oneOf([null,"solid","flat","outline"]),dataItemKey:b.string,groupField:b.string,groupMode:b.oneOf([void 0,"classic","modern"]),isMultiColumn:b.bool,suggest:b.bool,placeholder:b.string,title:b.string,allowCustom:b.bool,clearButton:b.bool,iconClassName:b.string,svgIcon:i.svgIconPropType,validationMessage:b.string,required:b.bool,id:b.string,ariaLabelledBy:b.string,ariaLabel:b.string,ariaDescribedBy:b.string,list:b.any,valueRender:b.func,skipDisabledItems:b.bool,inputAttributes:b.object},D.defaultProps={...V.defaultProps,size:"medium",rounded:"medium",fillMode:"solid",allowCustom:!1,clearButton:!0,required:!1,groupMode:"modern",isMultiColumn:!1,skipDisabledItems:!0,prefix:void 0,suffix:void 0};let E=D;const z=i.createPropsContext(),H=i.withIdHOC(i.withPropsContext(z,i.withUnstyledHOC(i.withAdaptiveModeContext(E))));H.displayName="KendoReactComboBox";exports.ComboBox=H;exports.ComboBoxPropsContext=z;exports.ComboBoxWithoutContext=E;
@@ -58,7 +58,9 @@ const ke = "Please enter a valid value!", F = class F extends c.Component {
58
58
  be,
59
59
  {
60
60
  value: i,
61
- ref: (n) => this._adaptiveFilterInput = n && n.element,
61
+ ref: (n) => {
62
+ this._adaptiveFilterInput = n && n.element;
63
+ },
62
64
  onChange: this.handleMobileFilterChange,
63
65
  onKeyDown: this.onInputKeyDown,
64
66
  size: "large",
@@ -643,7 +645,9 @@ const ke = "Please enter a valid value!", F = class F extends c.Component {
643
645
  title: r,
644
646
  value: s + this._suggested,
645
647
  suggestedText: this._suggested,
646
- ref: (g) => this._input = g && g.input,
648
+ ref: (g) => {
649
+ this._input = g && g.input;
650
+ },
647
651
  onClick: this.onInputClick,
648
652
  onKeyDown: this.onInputKeyDown,
649
653
  onChange: this.inputOnChange,
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ht=require("react"),k=require("prop-types"),o=require("@progress/kendo-react-common"),Wt=require("@progress/kendo-react-labels"),tt=require("@progress/kendo-svg-icons"),_t=require("../common/ListContainer.js"),Ut=require("../common/ListFilter.js"),nt=require("../common/GroupStickyHeader.js"),Gt=require("../common/ListDefaultItem.js"),jt=require("../common/List.js"),ot=require("../common/DropDownBase.js"),u=require("../common/utils.js"),Yt=require("../package-metadata.js"),rt=require("@progress/kendo-react-buttons"),$t=require("@progress/kendo-react-intl"),Fe=require("../messages/index.js"),Me=require("@progress/kendo-react-layout");function Jt(v){const Y=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(v){for(const T in v)if(T!=="default"){const N=Object.getOwnPropertyDescriptor(v,T);Object.defineProperty(Y,T,N.get?N:{enumerable:!0,get:()=>v[T]})}}return Y.default=v,Object.freeze(Y)}const s=Jt(Ht),Qt="Please select a value from the list!",pe=s.forwardRef((v,Y)=>{let T=!1;if(v.filterable||v.virtual){const e=[];v.filterable&&e.push("filterable"),v.virtual&&e.push("virtualization"),T=!o.validatePackage(Yt.packageMetadata,{component:"DropDownList",features:e})}const N=o.useUnstyled(),me=o.useId(v.id),r=o.usePropsContext(at,v),{delay:st=F.delay,tabIndex:it=F.tabIndex,ignoreCase:ge=F.ignoreCase,size:$=F.size,rounded:Te=F.rounded,fillMode:fe=F.fillMode,groupMode:Xt=F.groupMode}=r,ve=()=>{var e;if(o.canUseDOM)return((e=Q.current)==null?void 0:e.ownerDocument)||window.document},lt=()=>{var e,n;(e=t==null?void 0:t.current)!=null&&e.wrapper&&((n=t==null?void 0:t.current)==null||n.wrapper.focus({preventScroll:!0}))},E=()=>{let e;return q.current!==void 0&&q.current!==null?e=q.current:r.value!==void 0?e=r.value:g.value!==void 0&&g.value!==null?e=g.value:r.defaultValue!==void 0&&r.defaultValue!==null&&(e=r.defaultValue),!u.isPresent(e)&&r.defaultItem!==void 0&&r.defaultItem!==null&&(e=r.defaultItem),e},ct=()=>{const{dataItemKey:e}=r,n=u.getFilteredData(v),i=E();return n.findIndex(p=>u.areSame(p,i,e))},De=()=>r.required!==void 0?r.required:F.required,ye=()=>{const e=r.validationMessage!==void 0,n=E(),i=!De()||n!==null&&n!==""&&n!==void 0,p=r.valid!==void 0?r.valid:i;return{customError:e,valid:p,valueMissing:n===null}},dt=()=>r.validityStyles!==void 0?r.validityStyles:F.validityStyles,ne=e=>{re.current=!0,e.focus(),window.setTimeout(()=>re.current=!1,30)},he=()=>{X.current&&ne(X.current),r.adaptive&&setTimeout(()=>{X.current&&ne(X.current)},300)},ut=s.useCallback(e=>{for(const n of e)bt(n.target.clientWidth)},[]),Oe=()=>{var e;(e=xe.current)!=null&&e.setCustomValidity&&xe.current.setCustomValidity(ye().valid?"":r.validationMessage||Qt)},H=(e,n)=>{const i=E();u.areSame(i,e,r.dataItemKey)||(r.value===void 0&&(n.data.value=e),t.current.updateComponentArgs({value:e}),q.current=e,n.events.push({type:"onChange"}))},K=e=>{var n;(n=t==null?void 0:t.current)==null||n.applyState(e),q.current=void 0},J=(e,n)=>{var c;const{virtual:i,dataItemKey:p,defaultItem:m}=r,f=u.getFilteredData(v),y=i?i.skip:0,D=E(),a=e===-1&&m!==void 0?m:f[e-y],d=!u.areSame(a,D,p);H(a,n),d&&((c=t==null?void 0:t.current)==null||c.triggerPageChangeCornerItems(a,n))},O=(e,n,i)=>{var I,w;const{defaultItem:p,dataItemKey:m,virtual:f={skip:0,total:0,pageSize:0}}=r,y=E(),D=u.getFilteredData(v),a=(I=t==null?void 0:t.current)==null?void 0:I.vs,d=D.findIndex(S=>u.areSame(S,y,m)),c=(w=t==null?void 0:t.current)==null?void 0:w.navigation.navigate({current:f.skip+d,max:(a!=null&&a.enabled?f.total:D.length)-1,min:p!==void 0?-1:0,keyCode:n,skipItems:i||void 0});c!==void 0&&J(c,e),K(e)},pt=e=>{Q.current=e,t.current.wrapper=e},mt=e=>s.createElement("select",{name:r.name,ref:n=>{xe.current=n},tabIndex:-1,"aria-hidden":!0,title:r.label,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},s.createElement("option",{value:r.valueMap?r.valueMap.call(void 0,e):e})),we=()=>{const{textField:e,dataItemKey:n,virtual:i={skip:0},focusedItemIndex:p=u.itemIndexStartsWith,filterable:m,skipDisabledItems:f=!0}=r,y=E(),D=u.getFilteredData(v),a=r.filter?r.filter:g.text;return f&&e&&!a&&!y?D.findIndex(d=>!d.disabled&&d[e]):u.isPresent(y)&&a===void 0||m&&a===""?D.findIndex(d=>u.areSame(d,y,n)):a?Ce.current?p(D,a,e):D.findIndex(d=>u.areSame(d,y,n)):i.skip===0?0:-1},qe=(e,n)=>n!==void 0&&n!==-1&&e&&e.length>0&&e[n].disabled,Ie=()=>{const e=u.getFilteredData(v),n=t.current.initState(),i=we();qe(e,i)&&(H(null,n),K(n))},Se=e=>{if(e.isPropagationStopped())return;const n=t.current.initState();n.syntheticEvent=e,g.focused||(n.data.focused=!0),Ie(),t.current.togglePopup(n),K(n)},Ae=e=>{var M,de,B,ue,j,Re,et;e&&e.target instanceof Element&&e.target.nodeName==="INPUT"&&e.stopPropagation&&e.stopPropagation();const{filterable:n,disabled:i,defaultItem:p,leftRightKeysNavigation:m=!0,virtual:f={skip:0,total:0,pageSize:0},dataItemKey:y,groupField:D="",textField:a,skipDisabledItems:d=!0}=r,c=u.getFilteredData(v),I=E(),w=c.findIndex(L=>u.areSame(L,I,y)),S=r.opened!==void 0?r.opened:g.opened,l=e.keyCode,P=l===o.Keys.home||l===o.Keys.end,b=l===o.Keys.up||l===o.Keys.down,G=!S&&(e.altKey&&l===o.Keys.down||l===o.Keys.enter||l===o.Keys.space),te=S&&(e.altKey&&l===o.Keys.up||l===o.Keys.esc),le=m&&(l===o.Keys.left||l===o.Keys.right),ce=b||le&&!n||P,C=t.current.initState();if(C.syntheticEvent=e,!i){if(P&&((M=t==null?void 0:t.current)!=null&&M.vs.enabled))l===o.Keys.home?f.skip!==0?((de=t==null?void 0:t.current)==null||de.triggerOnPageChange(C,0,f.pageSize),A.current=!0):H(c[0],C):f.skip<f.total-f.pageSize?((B=t==null?void 0:t.current)==null||B.triggerOnPageChange(C,f.total-f.pageSize,f.pageSize),A.current=!0):H(c[c.length-1],C);else if(S&&l===o.Keys.pageUp)e.preventDefault(),(ue=t==null?void 0:t.current)==null||ue.scrollPopupByPageSize(-1);else if(S&&l===o.Keys.pageDown)e.preventDefault(),(j=t==null?void 0:t.current)==null||j.scrollPopupByPageSize(1);else if(S&&l===o.Keys.enter){const L=we();qe(c,L)?(H(null,C),K(C)):J(L,C),(Re=t==null?void 0:t.current)==null||Re.togglePopup(C),e.preventDefault()}else if(G||te)te&&Ie(),(et=t==null?void 0:t.current)==null||et.togglePopup(C),e.preventDefault();else if(ce){if(Ce.current=!1,D!==""&&a)if(!d&&S)O(C,l);else{let L;if(l===o.Keys.down||l===o.Keys.right){const x=c.slice(w+1).find(h=>!h.disabled&&h[a]);L=x&&c.findIndex(h=>h[a]===x[a])}else if(l===o.Keys.up||l===o.Keys.left){let x;if(w===0&&p)L=-1;else if(w===-1)x=c,L=c.findIndex(h=>!h.disabled&&h[a]);else{x=c.slice(0,w);let h=x.pop();for(;h&&h.disabled;)h=x.pop();L=h&&c.findIndex(Pe=>Pe[a]===h[a])}}if(L!==void 0){const x=L-w;O(C,l,x)}else L===void 0&&c.findIndex(x=>x[a]===I[a])===c.length-1&&O(C,l)}else if(!d&&S||P)O(C,l);else if(a){let L;if(l===o.Keys.down||l===o.Keys.right){const x=c.slice(w+1).find(h=>!h.disabled&&h[a]);L=x&&c.findIndex(h=>h[a]===x[a])}else if(l===o.Keys.up||l===o.Keys.left){let x;if(w===0&&p)L=-1;else if(w===-1)x=c,L=c.find(h=>!h.disabled&&h[a]);else{x=c.slice(0,w);let h=x.pop();for(;h&&h.disabled;)h=x.pop();L=h&&c.findIndex(Pe=>Pe[a]===h[a])}}if(L!==void 0){const x=L-w;O(C,l,x)}else L===void 0&&c.findIndex(x=>x[a]===I[a])===c.length-1&&O(C,l)}else O(C,l);e.preventDefault()}K(C)}},gt=e=>{const n=t.current.initState();n.syntheticEvent=e.syntheticEvent,r.filter===void 0&&(n.data.text=e.target.value),t.current.filterChanged(e.target.value,n),Ce.current=!0,K(n),R({group:void 0,text:String(e.target.value)})},ze=()=>{const e=r.filter!==void 0?r.filter:g.text;return r.filterable&&s.createElement(Ut,{value:e,ref:n=>X.current=n&&n.element,onChange:gt,onKeyDown:Ae,size:$,rounded:Te,fillMode:fe,renderListFilterWrapper:!0})},ft=e=>{var i;const n=t.current.initState();n.syntheticEvent=e,(i=t==null?void 0:t.current)==null||i.togglePopup(n),H(r.defaultItem,n),K(n)},Ve=()=>{const{textField:e,defaultItem:n,dataItemKey:i}=r,p=E();return n!==void 0&&s.createElement(Gt,{defaultItem:n,textField:e,selected:u.areSame(p,n,i),key:"defaultitemkey",onClick:ft})},vt=(e,n)=>{var i;(i=t==null?void 0:t.current)==null||i.handleItemClick(e,n),q.current=void 0},Dt=e=>{const{vs:n,list:i}=t.current;n.scrollHandler(e);const{groupField:p}=r;let m=u.getFilteredData(v);if(!(!p||!m.length)&&p){const f=_e.current=_e.current||(n.enabled?n.itemHeight:i?i.children[0].offsetHeight:0),D=e.target.scrollTop-n.skip*f;m=t.current.getGroupedDataModernMode(m,p);let a=m[0][p];for(let d=1;d<m.length&&!(f*d>D);d++)m[d]&&m[d][p]&&(a=m[d][p]);a!==g.group&&R({group:a})}},Be=()=>{var l;const{textField:e,dataItemKey:n,virtual:i={skip:0,total:void 0},groupHeaderItemRender:p,listNoDataRender:m,itemRender:f}=r,y=u.getFilteredData(v),D=N&&N.uDropDownList,a=t.current.vs,d=i.skip,c=r.opened!==void 0?r.opened:g.opened,I=t.current.getPopupSettings(),w=`translateY(${a.translate}px)`,S=E();return s.createElement(jt,{id:ke,show:c,data:y.slice(),focusedIndex:we(),value:S,textField:e,valueField:n,optionsGuid:je,groupField:r.groupField,groupMode:"modern",listRef:P=>a.list=t.current.list=P,wrapperStyle:{maxHeight:I.height},wrapperCssClass:o.classNames(o.uDropDownList.listContent({c:D})),listStyle:a.enabled?{transform:w}:void 0,key:"listkey",skip:d,onClick:vt,itemRender:f,groupHeaderItemRender:p,noDataRender:m,onScroll:Dt,wrapperRef:a.scrollerRef,scroller:(l=t==null?void 0:t.current)==null?void 0:l.renderScrollElement(),ariaSetSize:i.total})},yt=()=>{var w;const{header:e,footer:n,adaptiveTitle:i,groupField:p,groupStickyHeaderItemRender:m,list:f}=r,y=u.getFilteredData(v),D=r.opened!==void 0?r.opened:g.opened,a=N&&N.uDropDownList,d=N&&N.uDropDownsActionSheet,c={navigatable:!1,navigatableElements:[],expand:D,animation:!0,onClose:S=>Se(S),className:o.classNames(o.uDropDownsActionSheet.wrapper({c:d}),"k-adaptive-actionsheet"),animationStyles:_&&U&&_<=U.small?{top:0,width:"100%",height:"100%"}:void 0,position:_&&U&&_<=U.small?"fullscreen":void 0};let{group:I}=g;return I===void 0&&p!==void 0&&(I=u.getItemValue(y[0],p)),s.createElement(Me.ActionSheet,{...c},s.createElement(Me.ActionSheetHeader,{className:o.classNames(o.uDropDownsActionSheet.header({c:d}))},s.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.titleBar({c:d}))},s.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.title({c:d}))},s.createElement("div",null,i)),s.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.actions({c:d}))},s.createElement(rt.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:Se,icon:"x",svgIcon:tt.xIcon}))),s.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.titleBarGroup({c:d}))},ze())),s.createElement(Me.ActionSheetContent,null,e&&s.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:a}))},e),s.createElement("div",{className:o.classNames(o.uDropDownList.list({c:a,size:$,virtual:(w=t==null?void 0:t.current)==null?void 0:w.vs.enabled}))},Ve(),!f&&I&&y.length!==0&&s.createElement(nt,{group:I,groupMode:"modern",render:m}),Be()),n&&s.createElement("div",{className:o.classNames(o.uDropDownList.listFooter({c:a}))},n)))},ht=()=>{g.focused&&window.setTimeout(()=>{g.focused&&t.current.wrapper&&ne(t.current.wrapper)})},wt=e=>{var n;(n=r.popupSettings)!=null&&n.onMouseDownOutside&&r.popupSettings.onMouseDownOutside.call(void 0,e)},It=()=>{const{header:e,footer:n,dir:i,groupField:p,groupStickyHeaderItemRender:m,list:f}=r,y=u.getFilteredData(v),D=t.current,a=D.getPopupSettings(),d=r.opened!==void 0?r.opened:g.opened,c=a.width!==void 0?a.width:D.popupWidth,I=N&&N.uDropDownList,w={dir:i!==void 0?i:D.dirCalculated,width:c,popupSettings:{...a,popupClass:o.classNames(a.popupClass,o.uDropDownList.listContainer({c:I})),anchor:a.anchor||Q.current,show:d,onOpen:he,onClose:ht,onMouseDownOutside:wt},itemsCount:[y.length]};let{group:S}=g;return S===void 0&&p!==void 0&&(S=u.getItemValue(y[0],p)),s.createElement(_t,{...w},ze(),e&&s.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:I}))},e),s.createElement("div",{className:o.classNames(o.uDropDownList.list({c:I,size:$,virtual:t.current.vs.enabled}))},Ve(),!f&&S&&y.length!==0&&s.createElement(nt,{group:S,groupMode:"modern",render:m}),Be()),n&&s.createElement("div",{className:o.classNames(o.uDropDownList.listFooter({c:I}))},n),T&&s.createElement(o.WatermarkOverlay,null))},St=e=>{const{dataItemKey:n}=r,i=u.getFilteredData(v),p=E();let m=i.map((b,G)=>({item:b,itemIndex:G}));const f=W.current.word,y=W.current.last,D=u.sameCharsOnly(f,y);let a=m.length,d=Math.max(0,i.findIndex(b=>u.areSame(b,p,n))),c;r.defaultItem&&(c={item:r.defaultItem,itemIndex:-1},a+=1,d+=1),d+=D?1:0,m=u.shuffleData(m,d,c);let I,w,S,l=0;const{textField:P}=r;for(;l<a;){if(I=u.getItemValue(m[l].item,P),w=D&&u.matchText(I,y,ge),S=u.matchText(I,f,ge),w||S){l=m[l].itemIndex;break}l++}if(l!==a){const b=t.current.initState();b.syntheticEvent=e,J(l,b),K(b),q.current=void 0}},xt=e=>{clearTimeout(We.current),r.filterable||(We.current=window.setTimeout(()=>W.current.word="",st),St(e))},Ct=e=>{re.current||t.current.handleFocus(e)},Lt=e=>{if(re.current||!g.focused)return;const n=r.opened!==void 0?r.opened:g.opened,i=t.current.initState();i.syntheticEvent=e,i.data.focused=!1,i.events.push({type:"onBlur"}),n&&Ie(),n&&!Ke&&t.current.togglePopup(i),K(i)},kt=e=>{if(r.filterable||e.which===0||e.keyCode===o.Keys.enter)return;let n=String.fromCharCode(e.charCode||e.keyCode);ge&&(n=n.toLowerCase()),n===" "&&e.preventDefault(),W.current={word:W.current.word+n,last:W.current.last+n},xt(e)},Et=()=>{const e=t.current.initState();e.data.opened=g.opened,t.current.togglePopup(e),K(e)},He=s.useRef(null),Q=s.useRef(null),xe=s.useRef(),X=s.useRef(null);s.useImperativeHandle(He,()=>({get element(){return Q.current},get index(){return ct()},get name(){return r.name},get validity(){return ye()},get value(){return E()},get focused(){return g.focused},get opened(){return g.opened},focus:lt,props:r,togglePopup:Et})),s.useImperativeHandle(Y,()=>He.current);const We=s.useRef(null),W=s.useRef({word:"",last:""}),re=s.useRef(!1),q=s.useRef(null),A=s.useRef(!1),Ce=s.useRef(!1),z=s.useRef({}),Le=s.useRef({}),t=s.useRef(new ot({props:v,setState:()=>{},state:{},forceUpdate:()=>{},element:null,value:null,handleItemSelect:()=>{}})),_e=s.useRef(0),Z=s.useRef(null),[g,Nt]=s.useState({}),[_,bt]=s.useState(),[,Ue]=s.useReducer(e=>e,!0),Kt=$t.useLocalization(),R=e=>{Nt({...g,...e})};s.useEffect(()=>{t.current.updateComponentArgs({props:v,setState:R,state:g,forceUpdate:Ue,element:Q.current,handleItemSelect:J,value:E()})},[R,g,Ue,J,E]),s.useEffect(()=>{var d,c,I,w,S,l,P,b,G,te,le,ce,C;const{dataItemKey:e,virtual:n,groupField:i="",textField:p}=r,m=u.getFilteredData(v),f=z.current.virtual?z.current.virtual.total:0,y=r.opened!==void 0?r.opened:g.opened,D=z.current.opened!==void 0?z.current.opened:Le.current.opened,a=!D&&y;if((d=t==null?void 0:t.current)==null||d.didUpdate(),(c=t==null?void 0:t.current)!=null&&c.getPopupSettings().animate||a&&he(),n&&n.total!==f)(I=t==null?void 0:t.current)==null||I.vs.calcScrollElementHeight(),(w=t==null?void 0:t.current)==null||w.vs.reset();else{const M=E(),de=z.current.value!==void 0?z.current.value:Le.current.value;let B=m.findIndex(j=>u.areSame(j,M,e));i!==""&&M&&p&&(B=(l=(S=t==null?void 0:t.current)==null?void 0:S.getGroupedDataModernMode(m,i))==null?void 0:l.map(j=>j[p]).indexOf(M[p]));const ue=!u.areSame(de,M,e);a&&n?(P=t==null?void 0:t.current)==null||P.scrollToVirtualItem(n,B):a&&!n?(he(),m&&m.length!==0&&((b=t==null?void 0:t.current)==null||b.resetGroupStickyHeader(m[0][i],{setState:R,group:g.group,state:g})),(G=t==null?void 0:t.current)==null||G.scrollToItem(B)):y&&D&&M&&ue&&!A.current?(le=t==null?void 0:t.current)==null||le.scrollToItem(B,(te=t==null?void 0:t.current)==null?void 0:te.vs.enabled):y&&D&&A.current&&(A.current&&n&&n.skip===0?(ce=t==null?void 0:t.current)==null||ce.vs.reset():A.current&&n&&n.skip===n.total-n.pageSize&&((C=t==null?void 0:t.current)==null||C.vs.scrollToEnd()))}A.current=!1,Le.current=g,z.current=r,Oe()}),s.useEffect(()=>{var e,n;return Z.current=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(ut.bind(void 0)),(e=t==null?void 0:t.current)==null||e.didMount(),Oe(),(n=ve())!=null&&n.body&&Z.current&&Z.current.observe(ve().body),()=>{var i;(i=ve())!=null&&i.body&&Z.current&&Z.current.disconnect()}},[]);const Ge=me+"-accessibility-id",ke=me+"-listbox-id",je=me+"-guid",Pt=Kt.toLanguageString(Fe.dropDownListArrowBtnAriaLabel,Fe.messages[Fe.dropDownListArrowBtnAriaLabel]),{style:oe,className:Ft,label:Ee,dir:Mt,virtual:V,adaptive:Zt,dataItemKey:Tt,disabled:ae,loading:Ye,iconClassName:$e,svgIcon:Ot,valueRender:Je}=r,Ne=r.opened!==void 0?r.opened:g.opened,se=E(),be=u.getItemValue(se,r.textField),Qe=!dt()||ye().valid,ie=t.current,qt=ie.vs,ee=N&&N.uDropDownList;qt.enabled=V!==void 0;const U=o.useAdaptiveModeContext(),Ke=!!(_&&U&&_<=U.medium&&v.adaptive);V!==void 0&&(ie.vs.skip=V.skip,ie.vs.total=V.total,ie.vs.pageSize=V.pageSize);const At=u.getFilteredData(v),{focused:zt}=g,Vt=At.findIndex(e=>u.areSame(e,se,Tt)),Xe=s.createElement("span",{id:Ge,className:o.classNames(o.uDropDownList.inputInner({c:ee}))},be&&s.createElement("span",{className:o.classNames(o.uDropDownList.inputText({c:ee}))},be)),Bt=Je!==void 0?Je.call(void 0,Xe,se):Xe,Ze=s.createElement(s.Fragment,null,s.createElement("span",{ref:pt,className:o.classNames(o.uDropDownList.wrapper({c:ee,size:$,rounded:Te,fillMode:fe,focused:zt,disabled:ae,invalid:!Qe,loading:Ye,required:De()}),Ft),style:Ee?{...oe,width:void 0}:oe,dir:Mt,onMouseDown:Ne?e=>{e.target.nodeName!=="INPUT"&&(ne(t.current.wrapper),e.preventDefault())}:void 0,onFocus:Ct,onBlur:Lt,tabIndex:o.getTabIndex(it,ae),accessKey:r.accessKey,onKeyDown:Ae,onKeyPress:kt,onClick:ae?void 0:Se,role:"combobox","aria-required":De(),"aria-disabled":ae||void 0,"aria-haspopup":"listbox","aria-expanded":Ne||!1,"aria-owns":ke,"aria-activedescendant":Ne?"option-"+je+"-"+(Vt+(V?V.skip:0)):void 0,"aria-label":r.ariaLabel||r.label,"aria-labelledby":r.ariaLabelledBy,"aria-describedby":r.ariaDescribedBy||Ge,"aria-controls":ke,id:r.id,title:r.title},Bt,Ye&&s.createElement(o.IconWrap,{className:o.classNames(o.uDropDownList.loadingIcon({c:ee})),name:"loading"}),s.createElement(rt.Button,{tabIndex:-1,type:"button","aria-label":Pt,size:$,fillMode:fe,className:o.classNames(o.uDropDownList.inputButton({c:ee})),rounded:null,themeColor:"base",iconClass:$e,svgIcon:$e?void 0:Ot||tt.caretAltDownIcon,onMouseDown:e=>g.focused&&e.preventDefault()}),mt(se),!Ke&&It()),Ke&&yt());return Ee?s.createElement(Wt.FloatingLabel,{label:Ee,editorValue:be,editorValid:Qe,editorDisabled:r.disabled,style:{width:oe?oe.width:void 0},children:Ze}):Ze});pe.propTypes={delay:k.number,ignoreCase:k.bool,iconClassName:k.string,svgIcon:o.svgIconPropType,defaultItem:k.any,valueRender:k.func,valueMap:k.func,validationMessage:k.string,required:k.bool,id:k.string,ariaLabelledBy:k.string,ariaDescribedBy:k.string,ariaLabel:k.string,leftRightKeysNavigation:k.bool,title:k.string,groupField:k.string,list:k.any,skipDisabledItems:k.bool};const F={delay:500,tabIndex:0,ignoreCase:!0,...ot.defaultProps,required:!1,size:"medium",rounded:"medium",fillMode:"solid",groupMode:"modern"};pe.displayName="KendoReactDropDownList";const at=o.createPropsContext();pe.displayName="KendoReactDropDownList";exports.DropDownList=pe;exports.DropDownListPropsContext=at;exports.dropDownListDefaultProps=F;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ht=require("react"),k=require("prop-types"),o=require("@progress/kendo-react-common"),Wt=require("@progress/kendo-react-labels"),tt=require("@progress/kendo-svg-icons"),_t=require("../common/ListContainer.js"),Ut=require("../common/ListFilter.js"),nt=require("../common/GroupStickyHeader.js"),Gt=require("../common/ListDefaultItem.js"),jt=require("../common/List.js"),ot=require("../common/DropDownBase.js"),u=require("../common/utils.js"),Yt=require("../package-metadata.js"),rt=require("@progress/kendo-react-buttons"),$t=require("@progress/kendo-react-intl"),Fe=require("../messages/index.js"),Me=require("@progress/kendo-react-layout");function Jt(v){const Y=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(v){for(const T in v)if(T!=="default"){const N=Object.getOwnPropertyDescriptor(v,T);Object.defineProperty(Y,T,N.get?N:{enumerable:!0,get:()=>v[T]})}}return Y.default=v,Object.freeze(Y)}const s=Jt(Ht),Qt="Please select a value from the list!",pe=s.forwardRef((v,Y)=>{let T=!1;if(v.filterable||v.virtual){const e=[];v.filterable&&e.push("filterable"),v.virtual&&e.push("virtualization"),T=!o.validatePackage(Yt.packageMetadata,{component:"DropDownList",features:e})}const N=o.useUnstyled(),me=o.useId(v.id),r=o.usePropsContext(at,v),{delay:st=F.delay,tabIndex:it=F.tabIndex,ignoreCase:ge=F.ignoreCase,size:$=F.size,rounded:Te=F.rounded,fillMode:fe=F.fillMode,groupMode:Xt=F.groupMode}=r,ve=()=>{var e;if(o.canUseDOM)return((e=Q.current)==null?void 0:e.ownerDocument)||window.document},lt=()=>{var e,n;(e=t==null?void 0:t.current)!=null&&e.wrapper&&((n=t==null?void 0:t.current)==null||n.wrapper.focus({preventScroll:!0}))},E=()=>{let e;return q.current!==void 0&&q.current!==null?e=q.current:r.value!==void 0?e=r.value:g.value!==void 0&&g.value!==null?e=g.value:r.defaultValue!==void 0&&r.defaultValue!==null&&(e=r.defaultValue),!u.isPresent(e)&&r.defaultItem!==void 0&&r.defaultItem!==null&&(e=r.defaultItem),e},ct=()=>{const{dataItemKey:e}=r,n=u.getFilteredData(v),i=E();return n.findIndex(p=>u.areSame(p,i,e))},De=()=>r.required!==void 0?r.required:F.required,ye=()=>{const e=r.validationMessage!==void 0,n=E(),i=!De()||n!==null&&n!==""&&n!==void 0,p=r.valid!==void 0?r.valid:i;return{customError:e,valid:p,valueMissing:n===null}},dt=()=>r.validityStyles!==void 0?r.validityStyles:F.validityStyles,ne=e=>{re.current=!0,e.focus(),window.setTimeout(()=>re.current=!1,30)},he=()=>{X.current&&ne(X.current),r.adaptive&&setTimeout(()=>{X.current&&ne(X.current)},300)},ut=s.useCallback(e=>{for(const n of e)bt(n.target.clientWidth)},[]),Oe=()=>{var e;(e=xe.current)!=null&&e.setCustomValidity&&xe.current.setCustomValidity(ye().valid?"":r.validationMessage||Qt)},H=(e,n)=>{const i=E();u.areSame(i,e,r.dataItemKey)||(r.value===void 0&&(n.data.value=e),t.current.updateComponentArgs({value:e}),q.current=e,n.events.push({type:"onChange"}))},K=e=>{var n;(n=t==null?void 0:t.current)==null||n.applyState(e),q.current=void 0},J=(e,n)=>{var c;const{virtual:i,dataItemKey:p,defaultItem:m}=r,f=u.getFilteredData(v),y=i?i.skip:0,D=E(),a=e===-1&&m!==void 0?m:f[e-y],d=!u.areSame(a,D,p);H(a,n),d&&((c=t==null?void 0:t.current)==null||c.triggerPageChangeCornerItems(a,n))},O=(e,n,i)=>{var I,w;const{defaultItem:p,dataItemKey:m,virtual:f={skip:0,total:0,pageSize:0}}=r,y=E(),D=u.getFilteredData(v),a=(I=t==null?void 0:t.current)==null?void 0:I.vs,d=D.findIndex(S=>u.areSame(S,y,m)),c=(w=t==null?void 0:t.current)==null?void 0:w.navigation.navigate({current:f.skip+d,max:(a!=null&&a.enabled?f.total:D.length)-1,min:p!==void 0?-1:0,keyCode:n,skipItems:i||void 0});c!==void 0&&J(c,e),K(e)},pt=e=>{Q.current=e,t.current.wrapper=e},mt=e=>s.createElement("select",{name:r.name,ref:n=>{xe.current=n},tabIndex:-1,"aria-hidden":!0,title:r.label,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},s.createElement("option",{value:r.valueMap?r.valueMap.call(void 0,e):e})),we=()=>{const{textField:e,dataItemKey:n,virtual:i={skip:0},focusedItemIndex:p=u.itemIndexStartsWith,filterable:m,skipDisabledItems:f=!0}=r,y=E(),D=u.getFilteredData(v),a=r.filter?r.filter:g.text;return f&&e&&!a&&!y?D.findIndex(d=>!d.disabled&&d[e]):u.isPresent(y)&&a===void 0||m&&a===""?D.findIndex(d=>u.areSame(d,y,n)):a?Ce.current?p(D,a,e):D.findIndex(d=>u.areSame(d,y,n)):i.skip===0?0:-1},qe=(e,n)=>n!==void 0&&n!==-1&&e&&e.length>0&&e[n].disabled,Ie=()=>{const e=u.getFilteredData(v),n=t.current.initState(),i=we();qe(e,i)&&(H(null,n),K(n))},Se=e=>{if(e.isPropagationStopped())return;const n=t.current.initState();n.syntheticEvent=e,g.focused||(n.data.focused=!0),Ie(),t.current.togglePopup(n),K(n)},Ae=e=>{var M,de,B,ue,j,Re,et;e&&e.target instanceof Element&&e.target.nodeName==="INPUT"&&e.stopPropagation&&e.stopPropagation();const{filterable:n,disabled:i,defaultItem:p,leftRightKeysNavigation:m=!0,virtual:f={skip:0,total:0,pageSize:0},dataItemKey:y,groupField:D="",textField:a,skipDisabledItems:d=!0}=r,c=u.getFilteredData(v),I=E(),w=c.findIndex(L=>u.areSame(L,I,y)),S=r.opened!==void 0?r.opened:g.opened,l=e.keyCode,P=l===o.Keys.home||l===o.Keys.end,b=l===o.Keys.up||l===o.Keys.down,G=!S&&(e.altKey&&l===o.Keys.down||l===o.Keys.enter||l===o.Keys.space),te=S&&(e.altKey&&l===o.Keys.up||l===o.Keys.esc),le=m&&(l===o.Keys.left||l===o.Keys.right),ce=b||le&&!n||P,C=t.current.initState();if(C.syntheticEvent=e,!i){if(P&&((M=t==null?void 0:t.current)!=null&&M.vs.enabled))l===o.Keys.home?f.skip!==0?((de=t==null?void 0:t.current)==null||de.triggerOnPageChange(C,0,f.pageSize),A.current=!0):H(c[0],C):f.skip<f.total-f.pageSize?((B=t==null?void 0:t.current)==null||B.triggerOnPageChange(C,f.total-f.pageSize,f.pageSize),A.current=!0):H(c[c.length-1],C);else if(S&&l===o.Keys.pageUp)e.preventDefault(),(ue=t==null?void 0:t.current)==null||ue.scrollPopupByPageSize(-1);else if(S&&l===o.Keys.pageDown)e.preventDefault(),(j=t==null?void 0:t.current)==null||j.scrollPopupByPageSize(1);else if(S&&l===o.Keys.enter){const L=we();qe(c,L)?(H(null,C),K(C)):J(L,C),(Re=t==null?void 0:t.current)==null||Re.togglePopup(C),e.preventDefault()}else if(G||te)te&&Ie(),(et=t==null?void 0:t.current)==null||et.togglePopup(C),e.preventDefault();else if(ce){if(Ce.current=!1,D!==""&&a)if(!d&&S)O(C,l);else{let L;if(l===o.Keys.down||l===o.Keys.right){const x=c.slice(w+1).find(h=>!h.disabled&&h[a]);L=x&&c.findIndex(h=>h[a]===x[a])}else if(l===o.Keys.up||l===o.Keys.left){let x;if(w===0&&p)L=-1;else if(w===-1)x=c,L=c.findIndex(h=>!h.disabled&&h[a]);else{x=c.slice(0,w);let h=x.pop();for(;h&&h.disabled;)h=x.pop();L=h&&c.findIndex(Pe=>Pe[a]===h[a])}}if(L!==void 0){const x=L-w;O(C,l,x)}else L===void 0&&c.findIndex(x=>x[a]===I[a])===c.length-1&&O(C,l)}else if(!d&&S||P)O(C,l);else if(a){let L;if(l===o.Keys.down||l===o.Keys.right){const x=c.slice(w+1).find(h=>!h.disabled&&h[a]);L=x&&c.findIndex(h=>h[a]===x[a])}else if(l===o.Keys.up||l===o.Keys.left){let x;if(w===0&&p)L=-1;else if(w===-1)x=c,L=c.find(h=>!h.disabled&&h[a]);else{x=c.slice(0,w);let h=x.pop();for(;h&&h.disabled;)h=x.pop();L=h&&c.findIndex(Pe=>Pe[a]===h[a])}}if(L!==void 0){const x=L-w;O(C,l,x)}else L===void 0&&c.findIndex(x=>x[a]===I[a])===c.length-1&&O(C,l)}else O(C,l);e.preventDefault()}K(C)}},gt=e=>{const n=t.current.initState();n.syntheticEvent=e.syntheticEvent,r.filter===void 0&&(n.data.text=e.target.value),t.current.filterChanged(e.target.value,n),Ce.current=!0,K(n),R({group:void 0,text:String(e.target.value)})},ze=()=>{const e=r.filter!==void 0?r.filter:g.text;return r.filterable&&s.createElement(Ut,{value:e,ref:n=>{X.current=n&&n.element},onChange:gt,onKeyDown:Ae,size:$,rounded:Te,fillMode:fe,renderListFilterWrapper:!0})},ft=e=>{var i;const n=t.current.initState();n.syntheticEvent=e,(i=t==null?void 0:t.current)==null||i.togglePopup(n),H(r.defaultItem,n),K(n)},Ve=()=>{const{textField:e,defaultItem:n,dataItemKey:i}=r,p=E();return n!==void 0&&s.createElement(Gt,{defaultItem:n,textField:e,selected:u.areSame(p,n,i),key:"defaultitemkey",onClick:ft})},vt=(e,n)=>{var i;(i=t==null?void 0:t.current)==null||i.handleItemClick(e,n),q.current=void 0},Dt=e=>{const{vs:n,list:i}=t.current;n.scrollHandler(e);const{groupField:p}=r;let m=u.getFilteredData(v);if(!(!p||!m.length)&&p){const f=_e.current=_e.current||(n.enabled?n.itemHeight:i?i.children[0].offsetHeight:0),D=e.target.scrollTop-n.skip*f;m=t.current.getGroupedDataModernMode(m,p);let a=m[0][p];for(let d=1;d<m.length&&!(f*d>D);d++)m[d]&&m[d][p]&&(a=m[d][p]);a!==g.group&&R({group:a})}},Be=()=>{var l;const{textField:e,dataItemKey:n,virtual:i={skip:0,total:void 0},groupHeaderItemRender:p,listNoDataRender:m,itemRender:f}=r,y=u.getFilteredData(v),D=N&&N.uDropDownList,a=t.current.vs,d=i.skip,c=r.opened!==void 0?r.opened:g.opened,I=t.current.getPopupSettings(),w=`translateY(${a.translate}px)`,S=E();return s.createElement(jt,{id:ke,show:c,data:y.slice(),focusedIndex:we(),value:S,textField:e,valueField:n,optionsGuid:je,groupField:r.groupField,groupMode:"modern",listRef:P=>{a.list=t.current.list=P},wrapperStyle:{maxHeight:I.height},wrapperCssClass:o.classNames(o.uDropDownList.listContent({c:D})),listStyle:a.enabled?{transform:w}:void 0,key:"listkey",skip:d,onClick:vt,itemRender:f,groupHeaderItemRender:p,noDataRender:m,onScroll:Dt,wrapperRef:a.scrollerRef,scroller:(l=t==null?void 0:t.current)==null?void 0:l.renderScrollElement(),ariaSetSize:i.total})},yt=()=>{var w;const{header:e,footer:n,adaptiveTitle:i,groupField:p,groupStickyHeaderItemRender:m,list:f}=r,y=u.getFilteredData(v),D=r.opened!==void 0?r.opened:g.opened,a=N&&N.uDropDownList,d=N&&N.uDropDownsActionSheet,c={navigatable:!1,navigatableElements:[],expand:D,animation:!0,onClose:S=>Se(S),className:o.classNames(o.uDropDownsActionSheet.wrapper({c:d}),"k-adaptive-actionsheet"),animationStyles:_&&U&&_<=U.small?{top:0,width:"100%",height:"100%"}:void 0,position:_&&U&&_<=U.small?"fullscreen":void 0};let{group:I}=g;return I===void 0&&p!==void 0&&(I=u.getItemValue(y[0],p)),s.createElement(Me.ActionSheet,{...c},s.createElement(Me.ActionSheetHeader,{className:o.classNames(o.uDropDownsActionSheet.header({c:d}))},s.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.titleBar({c:d}))},s.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.title({c:d}))},s.createElement("div",null,i)),s.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.actions({c:d}))},s.createElement(rt.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:Se,icon:"x",svgIcon:tt.xIcon}))),s.createElement("div",{className:o.classNames(o.uDropDownsActionSheet.titleBarGroup({c:d}))},ze())),s.createElement(Me.ActionSheetContent,null,e&&s.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:a}))},e),s.createElement("div",{className:o.classNames(o.uDropDownList.list({c:a,size:$,virtual:(w=t==null?void 0:t.current)==null?void 0:w.vs.enabled}))},Ve(),!f&&I&&y.length!==0&&s.createElement(nt,{group:I,groupMode:"modern",render:m}),Be()),n&&s.createElement("div",{className:o.classNames(o.uDropDownList.listFooter({c:a}))},n)))},ht=()=>{g.focused&&window.setTimeout(()=>{g.focused&&t.current.wrapper&&ne(t.current.wrapper)})},wt=e=>{var n;(n=r.popupSettings)!=null&&n.onMouseDownOutside&&r.popupSettings.onMouseDownOutside.call(void 0,e)},It=()=>{const{header:e,footer:n,dir:i,groupField:p,groupStickyHeaderItemRender:m,list:f}=r,y=u.getFilteredData(v),D=t.current,a=D.getPopupSettings(),d=r.opened!==void 0?r.opened:g.opened,c=a.width!==void 0?a.width:D.popupWidth,I=N&&N.uDropDownList,w={dir:i!==void 0?i:D.dirCalculated,width:c,popupSettings:{...a,popupClass:o.classNames(a.popupClass,o.uDropDownList.listContainer({c:I})),anchor:a.anchor||Q.current,show:d,onOpen:he,onClose:ht,onMouseDownOutside:wt},itemsCount:[y.length]};let{group:S}=g;return S===void 0&&p!==void 0&&(S=u.getItemValue(y[0],p)),s.createElement(_t,{...w},ze(),e&&s.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:I}))},e),s.createElement("div",{className:o.classNames(o.uDropDownList.list({c:I,size:$,virtual:t.current.vs.enabled}))},Ve(),!f&&S&&y.length!==0&&s.createElement(nt,{group:S,groupMode:"modern",render:m}),Be()),n&&s.createElement("div",{className:o.classNames(o.uDropDownList.listFooter({c:I}))},n),T&&s.createElement(o.WatermarkOverlay,null))},St=e=>{const{dataItemKey:n}=r,i=u.getFilteredData(v),p=E();let m=i.map((b,G)=>({item:b,itemIndex:G}));const f=W.current.word,y=W.current.last,D=u.sameCharsOnly(f,y);let a=m.length,d=Math.max(0,i.findIndex(b=>u.areSame(b,p,n))),c;r.defaultItem&&(c={item:r.defaultItem,itemIndex:-1},a+=1,d+=1),d+=D?1:0,m=u.shuffleData(m,d,c);let I,w,S,l=0;const{textField:P}=r;for(;l<a;){if(I=u.getItemValue(m[l].item,P),w=D&&u.matchText(I,y,ge),S=u.matchText(I,f,ge),w||S){l=m[l].itemIndex;break}l++}if(l!==a){const b=t.current.initState();b.syntheticEvent=e,J(l,b),K(b),q.current=void 0}},xt=e=>{clearTimeout(We.current),r.filterable||(We.current=window.setTimeout(()=>W.current.word="",st),St(e))},Ct=e=>{re.current||t.current.handleFocus(e)},Lt=e=>{if(re.current||!g.focused)return;const n=r.opened!==void 0?r.opened:g.opened,i=t.current.initState();i.syntheticEvent=e,i.data.focused=!1,i.events.push({type:"onBlur"}),n&&Ie(),n&&!Ke&&t.current.togglePopup(i),K(i)},kt=e=>{if(r.filterable||e.which===0||e.keyCode===o.Keys.enter)return;let n=String.fromCharCode(e.charCode||e.keyCode);ge&&(n=n.toLowerCase()),n===" "&&e.preventDefault(),W.current={word:W.current.word+n,last:W.current.last+n},xt(e)},Et=()=>{const e=t.current.initState();e.data.opened=g.opened,t.current.togglePopup(e),K(e)},He=s.useRef(null),Q=s.useRef(null),xe=s.useRef(null),X=s.useRef(null);s.useImperativeHandle(He,()=>({get element(){return Q.current},get index(){return ct()},get name(){return r.name},get validity(){return ye()},get value(){return E()},get focused(){return g.focused},get opened(){return g.opened},focus:lt,props:r,togglePopup:Et})),s.useImperativeHandle(Y,()=>He.current);const We=s.useRef(null),W=s.useRef({word:"",last:""}),re=s.useRef(!1),q=s.useRef(null),A=s.useRef(!1),Ce=s.useRef(!1),z=s.useRef({}),Le=s.useRef({}),t=s.useRef(new ot({props:v,setState:()=>{},state:{},forceUpdate:()=>{},element:null,value:null,handleItemSelect:()=>{}})),_e=s.useRef(0),Z=s.useRef(null),[g,Nt]=s.useState({}),[_,bt]=s.useState(),[,Ue]=s.useReducer(e=>e,!0),Kt=$t.useLocalization(),R=e=>{Nt({...g,...e})};s.useEffect(()=>{t.current.updateComponentArgs({props:v,setState:R,state:g,forceUpdate:Ue,element:Q.current,handleItemSelect:J,value:E()})},[R,g,Ue,J,E]),s.useEffect(()=>{var d,c,I,w,S,l,P,b,G,te,le,ce,C;const{dataItemKey:e,virtual:n,groupField:i="",textField:p}=r,m=u.getFilteredData(v),f=z.current.virtual?z.current.virtual.total:0,y=r.opened!==void 0?r.opened:g.opened,D=z.current.opened!==void 0?z.current.opened:Le.current.opened,a=!D&&y;if((d=t==null?void 0:t.current)==null||d.didUpdate(),(c=t==null?void 0:t.current)!=null&&c.getPopupSettings().animate||a&&he(),n&&n.total!==f)(I=t==null?void 0:t.current)==null||I.vs.calcScrollElementHeight(),(w=t==null?void 0:t.current)==null||w.vs.reset();else{const M=E(),de=z.current.value!==void 0?z.current.value:Le.current.value;let B=m.findIndex(j=>u.areSame(j,M,e));i!==""&&M&&p&&(B=(l=(S=t==null?void 0:t.current)==null?void 0:S.getGroupedDataModernMode(m,i))==null?void 0:l.map(j=>j[p]).indexOf(M[p]));const ue=!u.areSame(de,M,e);a&&n?(P=t==null?void 0:t.current)==null||P.scrollToVirtualItem(n,B):a&&!n?(he(),m&&m.length!==0&&((b=t==null?void 0:t.current)==null||b.resetGroupStickyHeader(m[0][i],{setState:R,group:g.group,state:g})),(G=t==null?void 0:t.current)==null||G.scrollToItem(B)):y&&D&&M&&ue&&!A.current?(le=t==null?void 0:t.current)==null||le.scrollToItem(B,(te=t==null?void 0:t.current)==null?void 0:te.vs.enabled):y&&D&&A.current&&(A.current&&n&&n.skip===0?(ce=t==null?void 0:t.current)==null||ce.vs.reset():A.current&&n&&n.skip===n.total-n.pageSize&&((C=t==null?void 0:t.current)==null||C.vs.scrollToEnd()))}A.current=!1,Le.current=g,z.current=r,Oe()}),s.useEffect(()=>{var e,n;return Z.current=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(ut.bind(void 0)),(e=t==null?void 0:t.current)==null||e.didMount(),Oe(),(n=ve())!=null&&n.body&&Z.current&&Z.current.observe(ve().body),()=>{var i;(i=ve())!=null&&i.body&&Z.current&&Z.current.disconnect()}},[]);const Ge=me+"-accessibility-id",ke=me+"-listbox-id",je=me+"-guid",Pt=Kt.toLanguageString(Fe.dropDownListArrowBtnAriaLabel,Fe.messages[Fe.dropDownListArrowBtnAriaLabel]),{style:oe,className:Ft,label:Ee,dir:Mt,virtual:V,adaptive:Zt,dataItemKey:Tt,disabled:ae,loading:Ye,iconClassName:$e,svgIcon:Ot,valueRender:Je}=r,Ne=r.opened!==void 0?r.opened:g.opened,se=E(),be=u.getItemValue(se,r.textField),Qe=!dt()||ye().valid,ie=t.current,qt=ie.vs,ee=N&&N.uDropDownList;qt.enabled=V!==void 0;const U=o.useAdaptiveModeContext(),Ke=!!(_&&U&&_<=U.medium&&v.adaptive);V!==void 0&&(ie.vs.skip=V.skip,ie.vs.total=V.total,ie.vs.pageSize=V.pageSize);const At=u.getFilteredData(v),{focused:zt}=g,Vt=At.findIndex(e=>u.areSame(e,se,Tt)),Xe=s.createElement("span",{id:Ge,className:o.classNames(o.uDropDownList.inputInner({c:ee}))},be&&s.createElement("span",{className:o.classNames(o.uDropDownList.inputText({c:ee}))},be)),Bt=Je!==void 0?Je.call(void 0,Xe,se):Xe,Ze=s.createElement(s.Fragment,null,s.createElement("span",{ref:pt,className:o.classNames(o.uDropDownList.wrapper({c:ee,size:$,rounded:Te,fillMode:fe,focused:zt,disabled:ae,invalid:!Qe,loading:Ye,required:De()}),Ft),style:Ee?{...oe,width:void 0}:oe,dir:Mt,onMouseDown:Ne?e=>{e.target.nodeName!=="INPUT"&&(ne(t.current.wrapper),e.preventDefault())}:void 0,onFocus:Ct,onBlur:Lt,tabIndex:o.getTabIndex(it,ae),accessKey:r.accessKey,onKeyDown:Ae,onKeyPress:kt,onClick:ae?void 0:Se,role:"combobox","aria-required":De(),"aria-disabled":ae||void 0,"aria-haspopup":"listbox","aria-expanded":Ne||!1,"aria-owns":ke,"aria-activedescendant":Ne?"option-"+je+"-"+(Vt+(V?V.skip:0)):void 0,"aria-label":r.ariaLabel||r.label,"aria-labelledby":r.ariaLabelledBy,"aria-describedby":r.ariaDescribedBy||Ge,"aria-controls":ke,id:r.id,title:r.title},Bt,Ye&&s.createElement(o.IconWrap,{className:o.classNames(o.uDropDownList.loadingIcon({c:ee})),name:"loading"}),s.createElement(rt.Button,{tabIndex:-1,type:"button","aria-label":Pt,size:$,fillMode:fe,className:o.classNames(o.uDropDownList.inputButton({c:ee})),rounded:null,themeColor:"base",iconClass:$e,svgIcon:$e?void 0:Ot||tt.caretAltDownIcon,onMouseDown:e=>g.focused&&e.preventDefault()}),mt(se),!Ke&&It()),Ke&&yt());return Ee?s.createElement(Wt.FloatingLabel,{label:Ee,editorValue:be,editorValid:Qe,editorDisabled:r.disabled,style:{width:oe?oe.width:void 0},children:Ze}):Ze});pe.propTypes={delay:k.number,ignoreCase:k.bool,iconClassName:k.string,svgIcon:o.svgIconPropType,defaultItem:k.any,valueRender:k.func,valueMap:k.func,validationMessage:k.string,required:k.bool,id:k.string,ariaLabelledBy:k.string,ariaDescribedBy:k.string,ariaLabel:k.string,leftRightKeysNavigation:k.bool,title:k.string,groupField:k.string,list:k.any,skipDisabledItems:k.bool};const F={delay:500,tabIndex:0,ignoreCase:!0,...ot.defaultProps,required:!1,size:"medium",rounded:"medium",fillMode:"solid",groupMode:"modern"};pe.displayName="KendoReactDropDownList";const at=o.createPropsContext();pe.displayName="KendoReactDropDownList";exports.DropDownList=pe;exports.DropDownListPropsContext=at;exports.dropDownListDefaultProps=F;
@@ -224,7 +224,9 @@ const yn = "Please select a value from the list!", Te = i.forwardRef((D, ct) =>
224
224
  ln,
225
225
  {
226
226
  value: e,
227
- ref: (n) => R.current = n && n.element,
227
+ ref: (n) => {
228
+ R.current = n && n.element;
229
+ },
228
230
  onChange: yt,
229
231
  onKeyDown: Ve,
230
232
  size: Q,
@@ -288,7 +290,9 @@ const yn = "Please select a value from the list!", Te = i.forwardRef((D, ct) =>
288
290
  optionsGuid: je,
289
291
  groupField: r.groupField,
290
292
  groupMode: "modern",
291
- listRef: (T) => o.list = t.current.list = T,
293
+ listRef: (T) => {
294
+ o.list = t.current.list = T;
295
+ },
292
296
  wrapperStyle: { maxHeight: I.height },
293
297
  wrapperCssClass: E(b.listContent({ c: f })),
294
298
  listStyle: o.enabled ? { transform: h } : void 0,
@@ -441,7 +445,7 @@ const yn = "Please select a value from the list!", Te = i.forwardRef((D, ct) =>
441
445
  }, Ft = () => {
442
446
  const e = t.current.initState();
443
447
  e.data.opened = p.opened, t.current.togglePopup(e), K(e);
444
- }, qe = i.useRef(null), Z = i.useRef(null), Ee = i.useRef(), R = i.useRef(null);
448
+ }, qe = i.useRef(null), Z = i.useRef(null), Ee = i.useRef(null), R = i.useRef(null);
445
449
  i.useImperativeHandle(
446
450
  qe,
447
451
  () => ({
@@ -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 W=require("react"),v=require("prop-types"),h=require("@progress/kendo-react-common"),$=require("@progress/kendo-svg-icons"),j=require("@progress/kendo-react-labels"),G=require("../common/ListContainer.js"),U=require("../common/List.js"),Y=require("../common/GroupStickyHeader.js"),J=require("./TagList.js"),Q=require("../common/SearchBar.js"),K=require("../common/DropDownBase.js"),D=require("../common/settings.js"),g=require("../common/utils.js"),X=require("../package-metadata.js"),Z=require("../common/ClearButton.js"),ee=require("../common/AdaptiveMode.js"),te=require("@progress/kendo-react-layout"),se=require("@progress/kendo-react-intl"),C=require("../messages/index.js"),ie=require("../common/ListFilter.js"),P=require("../common/withCustomComponent.js");function oe(b){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(b){for(const e in b)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(b,e);Object.defineProperty(n,e,t.get?t:{enumerable:!0,get:()=>b[e]})}}return n.default=b,Object.freeze(n)}const f=oe(W),{sizeMap:w,roundedMap:ae}=h.kendoThemeMaps,ne="Please enter a valid value!",E=b=>b.preventDefault(),_=b=>b===2,I=class I extends f.Component{constructor(n){super(n),this.state={activedescendant:D.ActiveDescendant.PopupList,currentValue:[]},this._element=null,this._valueItemsDuringOnChange=null,this.base=new K(this),this._tags=[],this._input=null,this._adaptiveInput=null,this._skipFocusEvent=!1,this._lastSelectedOrDeslectedItemIndex=null,this.itemHeight=0,this.scrollToFocused=!1,this.localization=null,this.showLicenseWatermark=!1,this.focus=()=>{this._input&&this._input.focus()},this.handleItemSelect=(e,t)=>{const{dataItemKey:o,virtual:s}=this.props,a=g.getFilteredData(this.props),p=s?s.skip:0,u=a[e-p],r=this.value.findIndex(m=>g.areSame(m,u,o));this._lastSelectedOrDeslectedItemIndex=a.findIndex(m=>g.areSame(m,u,o));let i=[];r!==-1?(i=this.value,i.splice(r,1)):i=[...this.value,u],(this.props.filter!==void 0?this.props.filter:this.state.text)&&!this.mobileMode&&(this.state.text&&(t.data.text=""),this.base.filterChanged("",t)),this._adaptiveInput&&this._adaptiveInput.blur(),this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.triggerOnChange(i,t),this.base.triggerPageChangeCornerItems(u,t)},this.onTagDelete=(e,t)=>{const o=this.base.initState();o.syntheticEvent=t,this.opened&&this.base.togglePopup(o),!this.state.focused&&!this.mobileMode&&(o.data.focused=!0,this.focus());const s=this.value;g.removeDataItems(s,e,this.props.dataItemKey),this.triggerOnChange(s,o),this.applyState(o)},this.itemFocus=(e,t)=>{const{allowCustom:o,virtual:s}=this.props,a=g.getFilteredData(this.props),p=s?s.skip:0,u=this.props.filter!==void 0?this.props.filter:this.state.text,{focusedIndex:r}=this.getFocusedState(),i=o&&u,l=a[e-p];l&&r!==e?this.state.focusedIndex!==e&&(t.data.focusedIndex=e,t.data.activedescendant=D.ActiveDescendant.PopupList):i&&e===-1&&this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.base.triggerPageChangeCornerItems(l,t)},this.componentRef=e=>{this._element=e,this.base.wrapper=e},this.searchbarRef=e=>{const t=this._input=e&&e.input;t&&this.state.focused&&window.setTimeout(()=>t.focus(),0)},this.onChangeHandler=e=>{const t=this.base.initState(),o=e.target.value;t.syntheticEvent=e,this.props.filter===void 0&&(t.data.text=o),t.data.focusedIndex=void 0,this.opened||(this.base.togglePopup(t),this.setState({currentValue:this.value})),this.base.filterChanged(o,t),this.applyState(t),this.setState({group:void 0})},this.clearButtonClick=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.value.length>0&&this.triggerOnChange([],t),this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.opened&&this.base.togglePopup(t);const o=this.props.filter!==void 0?this.props.filter:this.state.text;g.isPresent(o)&&o!==""&&this.base.filterChanged("",t),this.state.text&&(t.data.text=""),this._lastSelectedOrDeslectedItemIndex=null,this.applyState(t)},this.onInputKeyDown=e=>{const{textField:t,groupField:o}=this.props,s=g.getFilteredData(this.props),a=e.keyCode,p=this.props.filter!==void 0?this.props.filter:this.state.text,u=this.props.opened!==void 0?this.props.opened:this.state.opened,{focusedItem:r,focusedIndex:i}=this.getFocusedState(),l=this.base.initState();if(l.syntheticEvent=e,!p&&this.value.length>0&&(a===h.Keys.left||a===h.Keys.right||a===h.Keys.home||a===h.Keys.end||a===h.Keys.delete||a===h.Keys.backspace)&&!e.shiftKey)return this.onTagsNavigate(e,l);const m=()=>{e.preventDefault(),this.base.togglePopup(l),this.applyState(l)};if(this.opened)if(a===h.Keys.pageUp)e.preventDefault(),this.base.scrollPopupByPageSize(-1);else if(a===h.Keys.pageDown)e.preventDefault(),this.base.scrollPopupByPageSize(1);else if((e.ctrlKey||e.metaKey)&&e.code==="KeyA"){const c=(this.state.value&&this.state.value.length)===s.length?[]:s;this.updateStateOnKeyboardNavigation(c,l)}else if((e.ctrlKey||e.metaKey)&&e.shiftKey&&e.keyCode===h.Keys.end){const d=s.slice(this.getFocusedState().focusedIndex);this.itemFocus(s.length-1,l),this.updateStateOnKeyboardNavigation(d,l)}else if((e.ctrlKey||e.metaKey)&&e.shiftKey&&e.keyCode===h.Keys.home){const d=s.slice(0,this.getFocusedState().focusedIndex+1);this.itemFocus(0,l),this.updateStateOnKeyboardNavigation(d,l)}else if(e.shiftKey&&e.keyCode===h.Keys.up){let d;const c=this.getLastSelectedOrDeselectedIndex(1,i);c===null?d=i!==0?s.slice(i-1,i):[s[i]]:c===i?d=[s[c-1]]:i>=0&&(d=c>i?s.slice(i-1,c):s.slice(c-1,i)),d&&d.length>0&&(i>=1&&this.itemFocus(i-1,l),this.updateStateOnKeyboardNavigation(d,l))}else if(e.shiftKey&&e.keyCode===h.Keys.down){let d;const c=this.getLastSelectedOrDeselectedIndex(0,i);c===null?d=i!==s.length-1?s.slice(i,i+1):[s[i]]:c===i?d=s.slice(i,i+2):i>=0&&(d=c>i?s.slice(i+1,c+1):s.slice(c,i+2)),d&&d.length>=1&&(this.itemFocus(i+1,l),this.updateStateOnKeyboardNavigation(d,l))}else if(e.altKey&&a===h.Keys.up)m();else if(a===h.Keys.up||a===h.Keys.down){if(o!==""&&t)if(!this.props.skipDisabledItems&&u)this.onNavigate(l,a);else{let d=0;if(a===h.Keys.down||a===h.Keys.right){const c=s.slice(i+1).find(y=>!y.disabled&&y[t]);d=c&&s.findIndex(y=>y[t]===c[t])}else if(a===h.Keys.up||a===h.Keys.left){let c;if(i===-1)c=s,d=s.findIndex(y=>!y.disabled&&y[t]);else{c=s.slice(0,i);let y=c.pop();for(;y&&y.disabled;)y=c.pop();d=y&&s.findIndex(x=>x[t]===y[t])}}if(d){const c=d-i;this.onNavigate(l,a,c)}else d!==void 0&&this.onNavigate(l,a)}else if(!this.props.skipDisabledItems&&u)this.onNavigate(l,a);else{let d=null;if(a===h.Keys.down||a===h.Keys.right)d=s.slice(i+1).find(c=>!c.disabled);else if(a===h.Keys.up||a===h.Keys.left){const c=s.slice(0,i);for(d=c.pop();d&&d.disabled;)d=c.pop()}if(d){const c=d.id-i-1;this.onNavigate(l,a,c)}else this.onNavigate(l,a)}this.applyState(l),e.preventDefault()}else a===h.Keys.enter?(e.preventDefault(),this.props.allowCustom&&p&&r===null?this.customItemSelect(e):r&&r.disabled?m():this.selectFocusedItem(e)):a===h.Keys.esc&&m();else e.altKey&&a===h.Keys.down?m():a===h.Keys.esc&&this.clearButtonClick(e)},this.listContainerContent=()=>{const{header:e,footer:t,allowCustom:o,size:s,groupStickyHeaderItemRender:a,groupField:p,list:u}=this.props,r=g.getFilteredData(this.props),i=this.props.filter!==void 0?this.props.filter:this.state.text,{focusedType:l}=this.getFocusedState(),m=o&&i&&f.createElement("div",{className:h.classNames("k-list",{[`k-list-${w[s]||s}`]:s}),key:"customitem",onClick:this.customItemSelect,onMouseDown:E},f.createElement("div",{className:h.classNames("k-list-item k-custom-item",{"k-focus":_(l)}),style:{fontStyle:"italic"}},i,f.createElement(h.IconWrap,{name:"plus",icon:$.plusIcon,style:{position:"absolute",right:"0.5em"}})));let{group:d}=this.state;return d===void 0&&p!==void 0&&(d=g.getItemValue(r[0],p)),f.createElement(f.Fragment,null,e&&f.createElement("div",{className:"k-list-header"},e),m,f.createElement("div",{className:h.classNames("k-list",{[`k-list-${this.mobileMode?"lg":w[s]||s}`]:s,"k-virtual-list":this.base.vs.enabled})},!u&&d&&r.length!==0&&f.createElement(Y,{group:d,groupMode:"modern",render:a}),this.renderList()),this.showLicenseWatermark&&f.createElement(h.WatermarkOverlay,null),t&&f.createElement("div",{className:"k-list-footer"},t))},this.renderListContainer=()=>{const e=this.base,{dir:t}=this.props,o=g.getFilteredData(this.props),s=this.base.getPopupSettings(),a=s.width!==void 0?s.width:e.popupWidth,p={dir:t!==void 0?t:e.dirCalculated,width:a,popupSettings:{...s,popupClass:h.classNames(s.popupClass,"k-list-container","k-multiselect-popup"),anchor:s.anchor||this.element,show:this.opened,onOpen:this.onPopupOpened,onClose:this.onPopupClosed},itemsCount:[o.length,this.value.length]};return f.createElement(G,{...p},this.listContainerContent())},this.renderAdaptiveListContainer=()=>{const{adaptiveTitle:e,filterable:t,filter:o}=this.props,{windowWidth:s=0}=this.state,a=o!==void 0?o:this.state.text;this.localization=se.provideLocalizationService(this);const p=t?f.createElement(ie,{value:a,ref:r=>this._adaptiveInput=r&&r.element,onChange:this.onChangeHandler,onKeyDown:this.onInputKeyDown,size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode}):null,u={title:e,expand:this.opened,onClose:r=>this.onCancel(r),windowWidth:s,mobileFilter:p,footer:{cancelText:this.localization.toLanguageString(C.adaptiveModeFooterCancel,C.messages[C.adaptiveModeFooterCancel]),onCancel:this.onCancel,applyText:this.localization.toLanguageString(C.adaptiveModeFooterApply,C.messages[C.adaptiveModeFooterApply]),onApply:this.closePopup}};return f.createElement(ee.AdaptiveMode,{...u},f.createElement(te.ActionSheetContent,null,f.createElement("div",{className:"k-list-container"},this.listContainerContent())))},this.closePopup=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.opened&&this.base.togglePopup(t),t.events.push({type:"onClose"});const o=this.props.filter!==void 0?this.props.filter:this.state.text;g.isPresent(o)&&o!==""&&this.base.filterChanged("",t),this.state.text&&(t.data.text=""),this.applyState(t)},this.onCancel=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.opened&&this.base.togglePopup(t),t.events.push({type:"onCancel"});const o=this.props.filter!==void 0?this.props.filter:this.state.text;g.isPresent(o)&&o!==""&&this.base.filterChanged("",t),this.state.text&&(t.data.text=""),this.applyState(t)},this.renderList=()=>{const{textField:e,listNoDataRender:t,itemRender:o,groupHeaderItemRender:s,dataItemKey:a,virtual:p={skip:0,total:void 0}}=this.props,u=g.getFilteredData(this.props),r=this.base.vs,{focusedIndex:i}=this.getFocusedState(),l=this.base.getPopupSettings(),m=`translateY(${r.translate}px)`;return f.createElement(U,{id:this.base.listBoxId,show:this.opened,data:u.slice(),focusedIndex:i-p.skip,value:this.value,textField:e,valueField:a,optionsGuid:this.base.guid,groupField:this.props.groupField,groupMode:"modern",listRef:d=>{r.list=this.base.list=d},wrapperStyle:this.mobileMode?{}:{maxHeight:l.height},wrapperCssClass:"k-list-content",listStyle:r.enabled?{transform:m}:void 0,key:"listKey",skip:p.skip,onClick:this.handleItemClick,itemRender:o,groupHeaderItemRender:s,noDataRender:t,onMouseDown:E,onBlur:this.handleBlur,onScroll:this.onScroll,wrapperRef:r.scrollerRef,scroller:this.base.renderScrollElement(),ariaSetSize:p.total})},this.onScroll=e=>{const{vs:t,list:o}=this.base;t.scrollHandler(e);const{groupField:s}=this.props;let a=g.getFilteredData(this.props);if(!(!s||!a.length)&&s){const p=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:o?o.children[0].offsetHeight:0),r=e.target.scrollTop-t.skip*p;a=this.base.getGroupedDataModernMode(a,s);let i=a[0][s];for(let l=1;l<a.length&&!(p*l>r);l++)a[l]&&a[l][s]&&(i=a[l][s]);i!==this.state.group&&this.setState({group:i})}},this.customItemSelect=e=>{const t=this.props.filter!==void 0?this.props.filter:this.state.text,{textField:o}=this.props;if(!t)return;const s=this.base.initState();s.syntheticEvent=e;const a=o?{[o]:t}:t;this.state.text!==void 0&&(s.data.text=""),s.data.focusedIndex=void 0,this.base.filterChanged("",s);const p=[...this.value,a];this.triggerOnChange(p,s),this.base.togglePopup(s),this.applyState(s)},this.handleWrapperClick=e=>{const t=this._input;!this.opened&&t&&this.focusElement(t);const o=this.base.initState();o.syntheticEvent=e,!this.state.focused&&!this.mobileMode&&(o.events.push({type:"onFocus"}),o.data.focused=!0),this.mobileMode&&(this.setState({currentValue:this.tagsToRender}),this.mobileMode&&window.setTimeout(()=>this._adaptiveInput&&this._adaptiveInput.focus(),300)),this.base.togglePopup(o),this.applyState(o)},this.handleItemClick=(e,t)=>{const o=this.base.initState();o.syntheticEvent=t,this.handleItemSelect(e,o),this.props.autoClose&&!this.mobileMode&&this.base.togglePopup(o),t.stopPropagation(),this.applyState(o)},this.handleBlur=e=>{if(!this.state.focused||this._skipFocusEvent)return;const t=this.base.initState(),{allowCustom:o,filterable:s}=this.props;t.syntheticEvent=e,t.data.focused=!1,t.events.push({type:"onBlur"}),this.opened&&!this.mobileMode&&(this.state.opened&&(t.data.opened=!1),t.events.push({type:"onClose"})),!o&&!s&&this.state.text&&(t.data.text=""),this.applyState(t)},this.handleFocus=e=>{this._skipFocusEvent||this.base.handleFocus(e)},this.onPopupOpened=()=>{this._input&&this.state.focused&&!this.mobileMode&&this.focusElement(this._input)},this.onPopupClosed=()=>{this.state.focused&&window.setTimeout(()=>{this.state.focused&&this.focusElement(this._input)},0)},this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||ne)},this.validate(n)}get _inputId(){return this.props.id}get document(){if(h.canUseDOM)return this.element&&this.element.ownerDocument||document}validate(n){if(n.filterable||n.virtual){const e=[];n.filterable&&e.push("filterable"),n.virtual&&e.push("virtualization"),this.showLicenseWatermark=!h.validatePackage(X.packageMetadata,{component:"MultiSelect",features:e})}}get element(){return this._element}get opened(){return!!(this.props.opened!==void 0?this.props.opened:this.state.opened)}get tagsToRender(){const{tags:n,textField:e}=this.props,t=[];return n===void 0?this.value.forEach(o=>{t.push({text:g.getItemValue(o,e),data:[o]})}):t.push(...n),t}get mobileMode(){var e;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((e=this.props._adaptiveMode)==null?void 0:e.medium)&&this.props.adaptive)}get value(){const n=[];return this._valueItemsDuringOnChange?n.push(...this._valueItemsDuringOnChange):this.props.value?n.push(...this.props.value):this.state.value?n.push(...this.state.value):this.props.defaultValue&&n.push(...this.props.defaultValue),n}get name(){return this.props.name}get validity(){const n=this.props.validationMessage!==void 0,e=!this.required||this.value!==null&&this.value.length>0&&this.value!==void 0,t=this.props.valid!==void 0?this.props.valid:e;return{customError:n,valid:t,valueMissing:this.value===null}}get required(){return this.props.required!==void 0?this.props.required:I.defaultProps.required}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:I.defaultProps.validityStyles}componentDidUpdate(n,e){var m;const{virtual:t,groupField:o=""}=this.props,s=g.getFilteredData(this.props),a=t?t.skip:0,p=n.virtual?n.virtual.total:0,u=n.opened!==void 0?n.opened:e.opened,r=!u&&this.opened,i=u&&!this.opened,l=this.base.getPopupSettings();if(this.validate(this.props),this.base.didUpdate(),!l.animate&&i&&this.onPopupClosed(),t&&t.total!==p)this.base.vs.calcScrollElementHeight(),this.base.vs.reset();else{let{focusedItem:d,focusedIndex:c}=this.getFocusedState();o!==""&&(c=(m=this.base.getGroupedDataModernMode(s,o))==null?void 0:m.indexOf(d)),r&&t?this.base.scrollToVirtualItem(t,c-a):r&&!t?(s&&s.length!==0&&this.base.resetGroupStickyHeader(s[0][o],this),this.base.scrollToItem(c)):this.opened&&u&&d&&this.scrollToFocused&&this.base.scrollToItem(c-a)}this.scrollToFocused=!1,this.setValidity()}componentDidMount(){var n;this.observerResize=h.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.base.didMount(),this.setValidity(),(n=this.document)!=null&&n.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentWillUnmount(){var n;(n=this.document)!=null&&n.body&&this.observerResize&&this.observerResize.disconnect()}onNavigate(n,e,t){const{allowCustom:o}=this.props,s=g.getFilteredData(this.props),a=this.props.filter!==void 0?this.props.filter:this.state.text,{focusedType:p,focusedIndex:u}=this.getFocusedState(),r=o&&a,i=_(p),l=this.base,m=l.vs;if(this.opened&&e===h.Keys.up&&i)this.state.focusedIndex!==void 0&&(n.data.focusedIndex=void 0);else{const d=l.navigation.navigate({keyCode:e,current:u,max:(m.enabled?m.total:s.length)-1,min:r?-1:0,skipItems:t||void 0});d!==void 0&&(this.itemFocus(d,n),this.scrollToFocused=!0)}this.applyState(n)}render(){const{style:n,className:e,label:t,dir:o,disabled:s,textField:a,dataItemKey:p,virtual:u,size:r,rounded:i,fillMode:l,loading:m,filter:d}=this.props,{text:c,focused:y,focusedTag:x,currentValue:L}=this.state,k=this.base.vs,T=this.props.id||this._inputId;k.enabled=u!==void 0,u!==void 0&&(k.skip=u.skip,k.total=u.total,k.pageSize=u.pageSize);const S=this.mobileMode&&this.opened?L:this.tagsToRender;this.setItems(this.tagsToRender,this._tags);const M=!this.validityStyles||this.validity.valid,q=!!(d!==void 0?d:c)||S&&S.length>0,[z,B]=P(this.props.prefix||f.Fragment),[V,A]=P(this.props.suffix||f.Fragment),O=f.createElement(f.Fragment,null,f.createElement("div",{ref:this.componentRef,className:h.classNames("k-multiselect k-input",e,{[`k-input-${w[r]||r}`]:r,[`k-rounded-${ae[i]||i}`]:i,[`k-input-${l}`]:l,"k-focus":y&&!s,"k-invalid":!M,"k-disabled":s,"k-loading":m,"k-required":this.required}),style:t?{...n,width:void 0}:n,dir:o,onFocus:this.handleFocus,onBlur:this.handleBlur,onClick:this.handleWrapperClick,onMouseDown:g.preventDefaultNonInputs},this.props.prefix&&f.createElement(z,{...B}),f.createElement("div",{className:h.classNames("k-input-values")},f.createElement("div",{className:h.classNames("k-chip-list",{[`k-chip-list-${w[r]||r}`]:r}),role:"listbox",id:"tagslist-"+this.base.guid},S&&S.length>0&&f.createElement(J,{tagRender:this.props.tagRender,onTagDelete:this.onTagDelete,data:S,guid:this.base.guid,focused:x?S.find(H=>g.matchTags(H,x,p)):void 0,size:r})),this.renderSearchBar(T)),m&&f.createElement(h.IconWrap,{className:"k-input-loading-icon",name:"loading"}),this.props.suffix&&f.createElement(V,{...A}),q&&f.createElement(Z,{onClick:this.clearButtonClick}),!this.mobileMode&&this.renderListContainer()),this.mobileMode&&this.renderAdaptiveListContainer());return t?f.createElement(j.FloatingLabel,{label:t,editorId:T,editorValue:c||g.getItemValue(this.value[0],a),editorValid:M,editorDisabled:s,style:{width:n?n.width:void 0},children:O}):O}renderSearchBar(n){const{activedescendant:e,focusedTag:t,currentValue:o}=this.state,{disabled:s,placeholder:a,ariaDescribedBy:p,ariaLabelledBy:u,ariaLabel:r,inputAttributes:i}=this.props,l=!this.mobileMode&&(this.props.filter!==void 0?this.props.filter:this.state.text)||"",{focusedIndex:m}=this.getFocusedState(),d=this.value.length===0&&!l?a:void 0,c=o&&o.length>0?void 0:a,y=e===D.ActiveDescendant.TagsList&&t!==void 0?`tag-${this.base.guid}-${t.text.replace(/\s+/g,"-")}`:`option-${this.base.guid}-${m}`,x={accessKey:this.props.accessKey,tabIndex:this.props.tabIndex};return f.createElement(Q,{id:n,size:Math.max((d||"").length,l.length,1),placeholder:this.mobileMode&&this.opened?c:d,value:l,onChange:this.onChangeHandler,onKeyDown:this.onInputKeyDown,ref:this.searchbarRef,disabled:s,expanded:this.opened,owns:this.base.listBoxId,role:"combobox",activedescendant:y,ariaDescribedBy:`tagslist-${this.base.guid}${p?" "+p:""}`,ariaLabelledBy:u,ariaRequired:this.required,ariaLabel:r,inputAttributes:i,...x})}onTagsNavigate(n,e){const t=n.keyCode,{focusedTag:o}=this.state,s=this._tags,a=this.props.dataItemKey;let p=o?s.findIndex(i=>g.matchTags(i,o,a)):-1,u;const r=p!==-1;if(t===h.Keys.left)r?p=Math.max(0,p-1):p=s.length-1,u=s[p];else if(t===h.Keys.right)p===s.length-1?u=void 0:r&&(p=Math.min(s.length-1,p+1),u=s[p]);else if(t===h.Keys.home&&!n.shiftKey)u=s[0];else if(t===h.Keys.end&&!n.shiftKey)u=s[s.length-1];else if(t===h.Keys.delete){if(r){const i=this.value;g.removeDataItems(i,s[p].data,a),this.triggerOnChange(i,e)}}else if(t===h.Keys.backspace){const i=this.value;if(r)g.removeDataItems(i,s[p].data,a),this.triggerOnChange(i,e);else if(!r&&s.length){const l=s.pop();g.removeDataItems(i,l.data,a),this.triggerOnChange(i,e)}}u!==o&&(e.data.focusedTag=u,e.data.activedescendant=D.ActiveDescendant.TagsList),this.applyState(e)}triggerOnChange(n,e){this.props.value===void 0&&(e.data.value=[...n]),this._valueItemsDuringOnChange=[],this.setItems(n,this._valueItemsDuringOnChange),e.events.push({type:"onChange"})}selectFocusedItem(n,e){const{virtual:t}=this.props,o=g.getFilteredData(this.props),{focusedIndex:s}=e||this.getFocusedState(),a=t?t.skip:0;o[s-a]!==void 0&&this.handleItemClick(s,n)}setItems(n,e){e.length=0,e.push(...n)}getFocusedState(){const{focusedIndex:n}=this.state,e=this.props.filter!==void 0?this.props.filter:this.state.text,{allowCustom:t,dataItemKey:o,virtual:s,textField:a,focusedItemIndex:p=g.itemIndexStartsWith,skipDisabledItems:u}=this.props,r=g.getFilteredData(this.props),i=s&&s.skip||0;let l;if(n!==void 0)return{focusedIndex:n,focusedItem:r[n-i],focusedType:1};const m=this.value;if(t&&e)return{focusedItem:null,focusedIndex:-1,focusedType:2};if(e)return l=p(r,e,a),{focusedItem:r[l],focusedIndex:l+i,focusedType:1};if(m.length){const d=m[m.length-1];return l=r.findIndex(c=>g.areSame(c,d,o)),r[l]!==void 0?{focusedIndex:l+i,focusedItem:r[l],focusedType:1}:{focusedType:0,focusedIndex:-1}}else if(u&&a&&!e&&i===0){const d=r.findIndex(c=>!c.disabled&&c[a]);return{focusedIndex:d,focusedItem:r[d-i],focusedType:1}}return i===0?{focusedItem:r[0],focusedIndex:0,focusedType:1}:{focusedType:0,focusedIndex:-1}}focusElement(n){this._skipFocusEvent=!0,n.focus(),window.setTimeout(()=>this._skipFocusEvent=!1,0)}applyState(n){this.base.applyState(n),this._valueItemsDuringOnChange=null}calculateMedia(n){for(const e of n)this.setState({windowWidth:e.target.clientWidth})}updateStateOnKeyboardNavigation(n,e){this.setState({value:n}),this.triggerOnChange(n,e),this.applyState(e)}getLastSelectedOrDeselectedIndex(n,e){return this._lastSelectedOrDeslectedItemIndex===null&&(this._lastSelectedOrDeslectedItemIndex=e),this._lastSelectedOrDeslectedItemIndex!==null?this._lastSelectedOrDeslectedItemIndex+n:null}};I.displayName="MultiSelect",I.propTypes={...K.propTypes,autoClose:v.bool,value:v.arrayOf(v.any),defaultValue:v.arrayOf(v.any),dataItemKey:v.string,placeholder:v.string,tags:v.arrayOf(v.shape({text:v.string,data:v.arrayOf(v.any)})),tagRender:v.func,id:v.string,ariaLabelledBy:v.string,ariaDescribedBy:v.string,groupField:v.string,list:v.any,adaptive:v.bool,adaptiveTitle:v.string,onCancel:v.func,skipDisabledItems:v.bool,inputAttributes:v.object},I.defaultProps={...K.defaultProps,autoClose:!0,required:!1,size:"medium",rounded:"medium",fillMode:"solid",groupMode:"modern",skipDisabledItems:!0,prefix:void 0,suffix:void 0};let F=I;const N=h.createPropsContext(),R=h.withIdHOC(h.withPropsContext(N,h.withAdaptiveModeContext(F)));R.displayName="KendoReactMultiSelect";exports.MultiSelect=R;exports.MultiSelectPropsContext=N;exports.MultiSelectWithoutContext=F;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react"),v=require("prop-types"),h=require("@progress/kendo-react-common"),$=require("@progress/kendo-svg-icons"),j=require("@progress/kendo-react-labels"),G=require("../common/ListContainer.js"),U=require("../common/List.js"),Y=require("../common/GroupStickyHeader.js"),J=require("./TagList.js"),Q=require("../common/SearchBar.js"),K=require("../common/DropDownBase.js"),D=require("../common/settings.js"),g=require("../common/utils.js"),X=require("../package-metadata.js"),Z=require("../common/ClearButton.js"),ee=require("../common/AdaptiveMode.js"),te=require("@progress/kendo-react-layout"),se=require("@progress/kendo-react-intl"),C=require("../messages/index.js"),ie=require("../common/ListFilter.js"),P=require("../common/withCustomComponent.js");function oe(b){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(b){for(const e in b)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(b,e);Object.defineProperty(n,e,t.get?t:{enumerable:!0,get:()=>b[e]})}}return n.default=b,Object.freeze(n)}const f=oe(W),{sizeMap:w,roundedMap:ae}=h.kendoThemeMaps,ne="Please enter a valid value!",E=b=>b.preventDefault(),_=b=>b===2,I=class I extends f.Component{constructor(n){super(n),this.state={activedescendant:D.ActiveDescendant.PopupList,currentValue:[]},this._element=null,this._valueItemsDuringOnChange=null,this.base=new K(this),this._tags=[],this._input=null,this._adaptiveInput=null,this._skipFocusEvent=!1,this._lastSelectedOrDeslectedItemIndex=null,this.itemHeight=0,this.scrollToFocused=!1,this.localization=null,this.showLicenseWatermark=!1,this.focus=()=>{this._input&&this._input.focus()},this.handleItemSelect=(e,t)=>{const{dataItemKey:o,virtual:s}=this.props,a=g.getFilteredData(this.props),p=s?s.skip:0,u=a[e-p],r=this.value.findIndex(m=>g.areSame(m,u,o));this._lastSelectedOrDeslectedItemIndex=a.findIndex(m=>g.areSame(m,u,o));let i=[];r!==-1?(i=this.value,i.splice(r,1)):i=[...this.value,u],(this.props.filter!==void 0?this.props.filter:this.state.text)&&!this.mobileMode&&(this.state.text&&(t.data.text=""),this.base.filterChanged("",t)),this._adaptiveInput&&this._adaptiveInput.blur(),this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.triggerOnChange(i,t),this.base.triggerPageChangeCornerItems(u,t)},this.onTagDelete=(e,t)=>{const o=this.base.initState();o.syntheticEvent=t,this.opened&&this.base.togglePopup(o),!this.state.focused&&!this.mobileMode&&(o.data.focused=!0,this.focus());const s=this.value;g.removeDataItems(s,e,this.props.dataItemKey),this.triggerOnChange(s,o),this.applyState(o)},this.itemFocus=(e,t)=>{const{allowCustom:o,virtual:s}=this.props,a=g.getFilteredData(this.props),p=s?s.skip:0,u=this.props.filter!==void 0?this.props.filter:this.state.text,{focusedIndex:r}=this.getFocusedState(),i=o&&u,l=a[e-p];l&&r!==e?this.state.focusedIndex!==e&&(t.data.focusedIndex=e,t.data.activedescendant=D.ActiveDescendant.PopupList):i&&e===-1&&this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.base.triggerPageChangeCornerItems(l,t)},this.componentRef=e=>{this._element=e,this.base.wrapper=e},this.searchbarRef=e=>{const t=this._input=e&&e.input;t&&this.state.focused&&window.setTimeout(()=>t.focus(),0)},this.onChangeHandler=e=>{const t=this.base.initState(),o=e.target.value;t.syntheticEvent=e,this.props.filter===void 0&&(t.data.text=o),t.data.focusedIndex=void 0,this.opened||(this.base.togglePopup(t),this.setState({currentValue:this.value})),this.base.filterChanged(o,t),this.applyState(t),this.setState({group:void 0})},this.clearButtonClick=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.value.length>0&&this.triggerOnChange([],t),this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.opened&&this.base.togglePopup(t);const o=this.props.filter!==void 0?this.props.filter:this.state.text;g.isPresent(o)&&o!==""&&this.base.filterChanged("",t),this.state.text&&(t.data.text=""),this._lastSelectedOrDeslectedItemIndex=null,this.applyState(t)},this.onInputKeyDown=e=>{const{textField:t,groupField:o}=this.props,s=g.getFilteredData(this.props),a=e.keyCode,p=this.props.filter!==void 0?this.props.filter:this.state.text,u=this.props.opened!==void 0?this.props.opened:this.state.opened,{focusedItem:r,focusedIndex:i}=this.getFocusedState(),l=this.base.initState();if(l.syntheticEvent=e,!p&&this.value.length>0&&(a===h.Keys.left||a===h.Keys.right||a===h.Keys.home||a===h.Keys.end||a===h.Keys.delete||a===h.Keys.backspace)&&!e.shiftKey)return this.onTagsNavigate(e,l);const m=()=>{e.preventDefault(),this.base.togglePopup(l),this.applyState(l)};if(this.opened)if(a===h.Keys.pageUp)e.preventDefault(),this.base.scrollPopupByPageSize(-1);else if(a===h.Keys.pageDown)e.preventDefault(),this.base.scrollPopupByPageSize(1);else if((e.ctrlKey||e.metaKey)&&e.code==="KeyA"){const c=(this.state.value&&this.state.value.length)===s.length?[]:s;this.updateStateOnKeyboardNavigation(c,l)}else if((e.ctrlKey||e.metaKey)&&e.shiftKey&&e.keyCode===h.Keys.end){const d=s.slice(this.getFocusedState().focusedIndex);this.itemFocus(s.length-1,l),this.updateStateOnKeyboardNavigation(d,l)}else if((e.ctrlKey||e.metaKey)&&e.shiftKey&&e.keyCode===h.Keys.home){const d=s.slice(0,this.getFocusedState().focusedIndex+1);this.itemFocus(0,l),this.updateStateOnKeyboardNavigation(d,l)}else if(e.shiftKey&&e.keyCode===h.Keys.up){let d;const c=this.getLastSelectedOrDeselectedIndex(1,i);c===null?d=i!==0?s.slice(i-1,i):[s[i]]:c===i?d=[s[c-1]]:i>=0&&(d=c>i?s.slice(i-1,c):s.slice(c-1,i)),d&&d.length>0&&(i>=1&&this.itemFocus(i-1,l),this.updateStateOnKeyboardNavigation(d,l))}else if(e.shiftKey&&e.keyCode===h.Keys.down){let d;const c=this.getLastSelectedOrDeselectedIndex(0,i);c===null?d=i!==s.length-1?s.slice(i,i+1):[s[i]]:c===i?d=s.slice(i,i+2):i>=0&&(d=c>i?s.slice(i+1,c+1):s.slice(c,i+2)),d&&d.length>=1&&(this.itemFocus(i+1,l),this.updateStateOnKeyboardNavigation(d,l))}else if(e.altKey&&a===h.Keys.up)m();else if(a===h.Keys.up||a===h.Keys.down){if(o!==""&&t)if(!this.props.skipDisabledItems&&u)this.onNavigate(l,a);else{let d=0;if(a===h.Keys.down||a===h.Keys.right){const c=s.slice(i+1).find(y=>!y.disabled&&y[t]);d=c&&s.findIndex(y=>y[t]===c[t])}else if(a===h.Keys.up||a===h.Keys.left){let c;if(i===-1)c=s,d=s.findIndex(y=>!y.disabled&&y[t]);else{c=s.slice(0,i);let y=c.pop();for(;y&&y.disabled;)y=c.pop();d=y&&s.findIndex(x=>x[t]===y[t])}}if(d){const c=d-i;this.onNavigate(l,a,c)}else d!==void 0&&this.onNavigate(l,a)}else if(!this.props.skipDisabledItems&&u)this.onNavigate(l,a);else{let d=null;if(a===h.Keys.down||a===h.Keys.right)d=s.slice(i+1).find(c=>!c.disabled);else if(a===h.Keys.up||a===h.Keys.left){const c=s.slice(0,i);for(d=c.pop();d&&d.disabled;)d=c.pop()}if(d){const c=d.id-i-1;this.onNavigate(l,a,c)}else this.onNavigate(l,a)}this.applyState(l),e.preventDefault()}else a===h.Keys.enter?(e.preventDefault(),this.props.allowCustom&&p&&r===null?this.customItemSelect(e):r&&r.disabled?m():this.selectFocusedItem(e)):a===h.Keys.esc&&m();else e.altKey&&a===h.Keys.down?m():a===h.Keys.esc&&this.clearButtonClick(e)},this.listContainerContent=()=>{const{header:e,footer:t,allowCustom:o,size:s,groupStickyHeaderItemRender:a,groupField:p,list:u}=this.props,r=g.getFilteredData(this.props),i=this.props.filter!==void 0?this.props.filter:this.state.text,{focusedType:l}=this.getFocusedState(),m=o&&i&&f.createElement("div",{className:h.classNames("k-list",{[`k-list-${w[s]||s}`]:s}),key:"customitem",onClick:this.customItemSelect,onMouseDown:E},f.createElement("div",{className:h.classNames("k-list-item k-custom-item",{"k-focus":_(l)}),style:{fontStyle:"italic"}},i,f.createElement(h.IconWrap,{name:"plus",icon:$.plusIcon,style:{position:"absolute",right:"0.5em"}})));let{group:d}=this.state;return d===void 0&&p!==void 0&&(d=g.getItemValue(r[0],p)),f.createElement(f.Fragment,null,e&&f.createElement("div",{className:"k-list-header"},e),m,f.createElement("div",{className:h.classNames("k-list",{[`k-list-${this.mobileMode?"lg":w[s]||s}`]:s,"k-virtual-list":this.base.vs.enabled})},!u&&d&&r.length!==0&&f.createElement(Y,{group:d,groupMode:"modern",render:a}),this.renderList()),this.showLicenseWatermark&&f.createElement(h.WatermarkOverlay,null),t&&f.createElement("div",{className:"k-list-footer"},t))},this.renderListContainer=()=>{const e=this.base,{dir:t}=this.props,o=g.getFilteredData(this.props),s=this.base.getPopupSettings(),a=s.width!==void 0?s.width:e.popupWidth,p={dir:t!==void 0?t:e.dirCalculated,width:a,popupSettings:{...s,popupClass:h.classNames(s.popupClass,"k-list-container","k-multiselect-popup"),anchor:s.anchor||this.element,show:this.opened,onOpen:this.onPopupOpened,onClose:this.onPopupClosed},itemsCount:[o.length,this.value.length]};return f.createElement(G,{...p},this.listContainerContent())},this.renderAdaptiveListContainer=()=>{const{adaptiveTitle:e,filterable:t,filter:o}=this.props,{windowWidth:s=0}=this.state,a=o!==void 0?o:this.state.text;this.localization=se.provideLocalizationService(this);const p=t?f.createElement(ie,{value:a,ref:r=>{this._adaptiveInput=r&&r.element},onChange:this.onChangeHandler,onKeyDown:this.onInputKeyDown,size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode}):null,u={title:e,expand:this.opened,onClose:r=>this.onCancel(r),windowWidth:s,mobileFilter:p,footer:{cancelText:this.localization.toLanguageString(C.adaptiveModeFooterCancel,C.messages[C.adaptiveModeFooterCancel]),onCancel:this.onCancel,applyText:this.localization.toLanguageString(C.adaptiveModeFooterApply,C.messages[C.adaptiveModeFooterApply]),onApply:this.closePopup}};return f.createElement(ee.AdaptiveMode,{...u},f.createElement(te.ActionSheetContent,null,f.createElement("div",{className:"k-list-container"},this.listContainerContent())))},this.closePopup=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.opened&&this.base.togglePopup(t),t.events.push({type:"onClose"});const o=this.props.filter!==void 0?this.props.filter:this.state.text;g.isPresent(o)&&o!==""&&this.base.filterChanged("",t),this.state.text&&(t.data.text=""),this.applyState(t)},this.onCancel=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.opened&&this.base.togglePopup(t),t.events.push({type:"onCancel"});const o=this.props.filter!==void 0?this.props.filter:this.state.text;g.isPresent(o)&&o!==""&&this.base.filterChanged("",t),this.state.text&&(t.data.text=""),this.applyState(t)},this.renderList=()=>{const{textField:e,listNoDataRender:t,itemRender:o,groupHeaderItemRender:s,dataItemKey:a,virtual:p={skip:0,total:void 0}}=this.props,u=g.getFilteredData(this.props),r=this.base.vs,{focusedIndex:i}=this.getFocusedState(),l=this.base.getPopupSettings(),m=`translateY(${r.translate}px)`;return f.createElement(U,{id:this.base.listBoxId,show:this.opened,data:u.slice(),focusedIndex:i-p.skip,value:this.value,textField:e,valueField:a,optionsGuid:this.base.guid,groupField:this.props.groupField,groupMode:"modern",listRef:d=>{r.list=this.base.list=d},wrapperStyle:this.mobileMode?{}:{maxHeight:l.height},wrapperCssClass:"k-list-content",listStyle:r.enabled?{transform:m}:void 0,key:"listKey",skip:p.skip,onClick:this.handleItemClick,itemRender:o,groupHeaderItemRender:s,noDataRender:t,onMouseDown:E,onBlur:this.handleBlur,onScroll:this.onScroll,wrapperRef:r.scrollerRef,scroller:this.base.renderScrollElement(),ariaSetSize:p.total})},this.onScroll=e=>{const{vs:t,list:o}=this.base;t.scrollHandler(e);const{groupField:s}=this.props;let a=g.getFilteredData(this.props);if(!(!s||!a.length)&&s){const p=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:o?o.children[0].offsetHeight:0),r=e.target.scrollTop-t.skip*p;a=this.base.getGroupedDataModernMode(a,s);let i=a[0][s];for(let l=1;l<a.length&&!(p*l>r);l++)a[l]&&a[l][s]&&(i=a[l][s]);i!==this.state.group&&this.setState({group:i})}},this.customItemSelect=e=>{const t=this.props.filter!==void 0?this.props.filter:this.state.text,{textField:o}=this.props;if(!t)return;const s=this.base.initState();s.syntheticEvent=e;const a=o?{[o]:t}:t;this.state.text!==void 0&&(s.data.text=""),s.data.focusedIndex=void 0,this.base.filterChanged("",s);const p=[...this.value,a];this.triggerOnChange(p,s),this.base.togglePopup(s),this.applyState(s)},this.handleWrapperClick=e=>{const t=this._input;!this.opened&&t&&this.focusElement(t);const o=this.base.initState();o.syntheticEvent=e,!this.state.focused&&!this.mobileMode&&(o.events.push({type:"onFocus"}),o.data.focused=!0),this.mobileMode&&(this.setState({currentValue:this.tagsToRender}),this.mobileMode&&window.setTimeout(()=>this._adaptiveInput&&this._adaptiveInput.focus(),300)),this.base.togglePopup(o),this.applyState(o)},this.handleItemClick=(e,t)=>{const o=this.base.initState();o.syntheticEvent=t,this.handleItemSelect(e,o),this.props.autoClose&&!this.mobileMode&&this.base.togglePopup(o),t.stopPropagation(),this.applyState(o)},this.handleBlur=e=>{if(!this.state.focused||this._skipFocusEvent)return;const t=this.base.initState(),{allowCustom:o,filterable:s}=this.props;t.syntheticEvent=e,t.data.focused=!1,t.events.push({type:"onBlur"}),this.opened&&!this.mobileMode&&(this.state.opened&&(t.data.opened=!1),t.events.push({type:"onClose"})),!o&&!s&&this.state.text&&(t.data.text=""),this.applyState(t)},this.handleFocus=e=>{this._skipFocusEvent||this.base.handleFocus(e)},this.onPopupOpened=()=>{this._input&&this.state.focused&&!this.mobileMode&&this.focusElement(this._input)},this.onPopupClosed=()=>{this.state.focused&&window.setTimeout(()=>{this.state.focused&&this.focusElement(this._input)},0)},this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||ne)},this.validate(n)}get _inputId(){return this.props.id}get document(){if(h.canUseDOM)return this.element&&this.element.ownerDocument||document}validate(n){if(n.filterable||n.virtual){const e=[];n.filterable&&e.push("filterable"),n.virtual&&e.push("virtualization"),this.showLicenseWatermark=!h.validatePackage(X.packageMetadata,{component:"MultiSelect",features:e})}}get element(){return this._element}get opened(){return!!(this.props.opened!==void 0?this.props.opened:this.state.opened)}get tagsToRender(){const{tags:n,textField:e}=this.props,t=[];return n===void 0?this.value.forEach(o=>{t.push({text:g.getItemValue(o,e),data:[o]})}):t.push(...n),t}get mobileMode(){var e;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((e=this.props._adaptiveMode)==null?void 0:e.medium)&&this.props.adaptive)}get value(){const n=[];return this._valueItemsDuringOnChange?n.push(...this._valueItemsDuringOnChange):this.props.value?n.push(...this.props.value):this.state.value?n.push(...this.state.value):this.props.defaultValue&&n.push(...this.props.defaultValue),n}get name(){return this.props.name}get validity(){const n=this.props.validationMessage!==void 0,e=!this.required||this.value!==null&&this.value.length>0&&this.value!==void 0,t=this.props.valid!==void 0?this.props.valid:e;return{customError:n,valid:t,valueMissing:this.value===null}}get required(){return this.props.required!==void 0?this.props.required:I.defaultProps.required}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:I.defaultProps.validityStyles}componentDidUpdate(n,e){var m;const{virtual:t,groupField:o=""}=this.props,s=g.getFilteredData(this.props),a=t?t.skip:0,p=n.virtual?n.virtual.total:0,u=n.opened!==void 0?n.opened:e.opened,r=!u&&this.opened,i=u&&!this.opened,l=this.base.getPopupSettings();if(this.validate(this.props),this.base.didUpdate(),!l.animate&&i&&this.onPopupClosed(),t&&t.total!==p)this.base.vs.calcScrollElementHeight(),this.base.vs.reset();else{let{focusedItem:d,focusedIndex:c}=this.getFocusedState();o!==""&&(c=(m=this.base.getGroupedDataModernMode(s,o))==null?void 0:m.indexOf(d)),r&&t?this.base.scrollToVirtualItem(t,c-a):r&&!t?(s&&s.length!==0&&this.base.resetGroupStickyHeader(s[0][o],this),this.base.scrollToItem(c)):this.opened&&u&&d&&this.scrollToFocused&&this.base.scrollToItem(c-a)}this.scrollToFocused=!1,this.setValidity()}componentDidMount(){var n;this.observerResize=h.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.base.didMount(),this.setValidity(),(n=this.document)!=null&&n.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentWillUnmount(){var n;(n=this.document)!=null&&n.body&&this.observerResize&&this.observerResize.disconnect()}onNavigate(n,e,t){const{allowCustom:o}=this.props,s=g.getFilteredData(this.props),a=this.props.filter!==void 0?this.props.filter:this.state.text,{focusedType:p,focusedIndex:u}=this.getFocusedState(),r=o&&a,i=_(p),l=this.base,m=l.vs;if(this.opened&&e===h.Keys.up&&i)this.state.focusedIndex!==void 0&&(n.data.focusedIndex=void 0);else{const d=l.navigation.navigate({keyCode:e,current:u,max:(m.enabled?m.total:s.length)-1,min:r?-1:0,skipItems:t||void 0});d!==void 0&&(this.itemFocus(d,n),this.scrollToFocused=!0)}this.applyState(n)}render(){const{style:n,className:e,label:t,dir:o,disabled:s,textField:a,dataItemKey:p,virtual:u,size:r,rounded:i,fillMode:l,loading:m,filter:d}=this.props,{text:c,focused:y,focusedTag:x,currentValue:L}=this.state,k=this.base.vs,T=this.props.id||this._inputId;k.enabled=u!==void 0,u!==void 0&&(k.skip=u.skip,k.total=u.total,k.pageSize=u.pageSize);const S=this.mobileMode&&this.opened?L:this.tagsToRender;this.setItems(this.tagsToRender,this._tags);const M=!this.validityStyles||this.validity.valid,q=!!(d!==void 0?d:c)||S&&S.length>0,[z,B]=P(this.props.prefix||f.Fragment),[V,A]=P(this.props.suffix||f.Fragment),O=f.createElement(f.Fragment,null,f.createElement("div",{ref:this.componentRef,className:h.classNames("k-multiselect k-input",e,{[`k-input-${w[r]||r}`]:r,[`k-rounded-${ae[i]||i}`]:i,[`k-input-${l}`]:l,"k-focus":y&&!s,"k-invalid":!M,"k-disabled":s,"k-loading":m,"k-required":this.required}),style:t?{...n,width:void 0}:n,dir:o,onFocus:this.handleFocus,onBlur:this.handleBlur,onClick:this.handleWrapperClick,onMouseDown:g.preventDefaultNonInputs},this.props.prefix&&f.createElement(z,{...B}),f.createElement("div",{className:h.classNames("k-input-values")},f.createElement("div",{className:h.classNames("k-chip-list",{[`k-chip-list-${w[r]||r}`]:r}),role:"listbox",id:"tagslist-"+this.base.guid},S&&S.length>0&&f.createElement(J,{tagRender:this.props.tagRender,onTagDelete:this.onTagDelete,data:S,guid:this.base.guid,focused:x?S.find(H=>g.matchTags(H,x,p)):void 0,size:r})),this.renderSearchBar(T)),m&&f.createElement(h.IconWrap,{className:"k-input-loading-icon",name:"loading"}),this.props.suffix&&f.createElement(V,{...A}),q&&f.createElement(Z,{onClick:this.clearButtonClick}),!this.mobileMode&&this.renderListContainer()),this.mobileMode&&this.renderAdaptiveListContainer());return t?f.createElement(j.FloatingLabel,{label:t,editorId:T,editorValue:c||g.getItemValue(this.value[0],a),editorValid:M,editorDisabled:s,style:{width:n?n.width:void 0},children:O}):O}renderSearchBar(n){const{activedescendant:e,focusedTag:t,currentValue:o}=this.state,{disabled:s,placeholder:a,ariaDescribedBy:p,ariaLabelledBy:u,ariaLabel:r,inputAttributes:i}=this.props,l=!this.mobileMode&&(this.props.filter!==void 0?this.props.filter:this.state.text)||"",{focusedIndex:m}=this.getFocusedState(),d=this.value.length===0&&!l?a:void 0,c=o&&o.length>0?void 0:a,y=e===D.ActiveDescendant.TagsList&&t!==void 0?`tag-${this.base.guid}-${t.text.replace(/\s+/g,"-")}`:`option-${this.base.guid}-${m}`,x={accessKey:this.props.accessKey,tabIndex:this.props.tabIndex};return f.createElement(Q,{id:n,size:Math.max((d||"").length,l.length,1),placeholder:this.mobileMode&&this.opened?c:d,value:l,onChange:this.onChangeHandler,onKeyDown:this.onInputKeyDown,ref:this.searchbarRef,disabled:s,expanded:this.opened,owns:this.base.listBoxId,role:"combobox",activedescendant:y,ariaDescribedBy:`tagslist-${this.base.guid}${p?" "+p:""}`,ariaLabelledBy:u,ariaRequired:this.required,ariaLabel:r,inputAttributes:i,...x})}onTagsNavigate(n,e){const t=n.keyCode,{focusedTag:o}=this.state,s=this._tags,a=this.props.dataItemKey;let p=o?s.findIndex(i=>g.matchTags(i,o,a)):-1,u;const r=p!==-1;if(t===h.Keys.left)r?p=Math.max(0,p-1):p=s.length-1,u=s[p];else if(t===h.Keys.right)p===s.length-1?u=void 0:r&&(p=Math.min(s.length-1,p+1),u=s[p]);else if(t===h.Keys.home&&!n.shiftKey)u=s[0];else if(t===h.Keys.end&&!n.shiftKey)u=s[s.length-1];else if(t===h.Keys.delete){if(r){const i=this.value;g.removeDataItems(i,s[p].data,a),this.triggerOnChange(i,e)}}else if(t===h.Keys.backspace){const i=this.value;if(r)g.removeDataItems(i,s[p].data,a),this.triggerOnChange(i,e);else if(!r&&s.length){const l=s.pop();g.removeDataItems(i,l.data,a),this.triggerOnChange(i,e)}}u!==o&&(e.data.focusedTag=u,e.data.activedescendant=D.ActiveDescendant.TagsList),this.applyState(e)}triggerOnChange(n,e){this.props.value===void 0&&(e.data.value=[...n]),this._valueItemsDuringOnChange=[],this.setItems(n,this._valueItemsDuringOnChange),e.events.push({type:"onChange"})}selectFocusedItem(n,e){const{virtual:t}=this.props,o=g.getFilteredData(this.props),{focusedIndex:s}=e||this.getFocusedState(),a=t?t.skip:0;o[s-a]!==void 0&&this.handleItemClick(s,n)}setItems(n,e){e.length=0,e.push(...n)}getFocusedState(){const{focusedIndex:n}=this.state,e=this.props.filter!==void 0?this.props.filter:this.state.text,{allowCustom:t,dataItemKey:o,virtual:s,textField:a,focusedItemIndex:p=g.itemIndexStartsWith,skipDisabledItems:u}=this.props,r=g.getFilteredData(this.props),i=s&&s.skip||0;let l;if(n!==void 0)return{focusedIndex:n,focusedItem:r[n-i],focusedType:1};const m=this.value;if(t&&e)return{focusedItem:null,focusedIndex:-1,focusedType:2};if(e)return l=p(r,e,a),{focusedItem:r[l],focusedIndex:l+i,focusedType:1};if(m.length){const d=m[m.length-1];return l=r.findIndex(c=>g.areSame(c,d,o)),r[l]!==void 0?{focusedIndex:l+i,focusedItem:r[l],focusedType:1}:{focusedType:0,focusedIndex:-1}}else if(u&&a&&!e&&i===0){const d=r.findIndex(c=>!c.disabled&&c[a]);return{focusedIndex:d,focusedItem:r[d-i],focusedType:1}}return i===0?{focusedItem:r[0],focusedIndex:0,focusedType:1}:{focusedType:0,focusedIndex:-1}}focusElement(n){this._skipFocusEvent=!0,n.focus(),window.setTimeout(()=>this._skipFocusEvent=!1,0)}applyState(n){this.base.applyState(n),this._valueItemsDuringOnChange=null}calculateMedia(n){for(const e of n)this.setState({windowWidth:e.target.clientWidth})}updateStateOnKeyboardNavigation(n,e){this.setState({value:n}),this.triggerOnChange(n,e),this.applyState(e)}getLastSelectedOrDeselectedIndex(n,e){return this._lastSelectedOrDeslectedItemIndex===null&&(this._lastSelectedOrDeslectedItemIndex=e),this._lastSelectedOrDeslectedItemIndex!==null?this._lastSelectedOrDeslectedItemIndex+n:null}};I.displayName="MultiSelect",I.propTypes={...K.propTypes,autoClose:v.bool,value:v.arrayOf(v.any),defaultValue:v.arrayOf(v.any),dataItemKey:v.string,placeholder:v.string,tags:v.arrayOf(v.shape({text:v.string,data:v.arrayOf(v.any)})),tagRender:v.func,id:v.string,ariaLabelledBy:v.string,ariaDescribedBy:v.string,groupField:v.string,list:v.any,adaptive:v.bool,adaptiveTitle:v.string,onCancel:v.func,skipDisabledItems:v.bool,inputAttributes:v.object},I.defaultProps={...K.defaultProps,autoClose:!0,required:!1,size:"medium",rounded:"medium",fillMode:"solid",groupMode:"modern",skipDisabledItems:!0,prefix:void 0,suffix:void 0};let F=I;const N=h.createPropsContext(),R=h.withIdHOC(h.withPropsContext(N,h.withAdaptiveModeContext(F)));R.displayName="KendoReactMultiSelect";exports.MultiSelect=R;exports.MultiSelectPropsContext=N;exports.MultiSelectWithoutContext=F;
@@ -191,7 +191,9 @@ const { sizeMap: T, roundedMap: yt } = ot, xt = "Please enter a valid value!", $
191
191
  It,
192
192
  {
193
193
  value: a,
194
- ref: (r) => this._adaptiveInput = r && r.element,
194
+ ref: (r) => {
195
+ this._adaptiveInput = r && r.element;
196
+ },
195
197
  onChange: this.onChangeHandler,
196
198
  onKeyDown: this.onInputKeyDown,
197
199
  size: this.props.size,
@@ -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";const v=require("react"),n=require("prop-types"),y=require("./VirtualScrollStatic.js"),S=require("./Navigation.js"),c=require("./utils.js");function b(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const P=b(v),a=class a{constructor(e){this.wrapper=null,this.list=null,this.vs=new y.VirtualScroll,this.navigation=new S.Navigation,this.handleItemClick=(t,s)=>{const i=this.initState();i.syntheticEvent=s,s.stopPropagation(),this.component.handleItemSelect(t,i),this.togglePopup(i),this.applyState(i)},this.handleFocus=t=>{if(!this.component.state.focused){const s=this.initState();s.data.focused=!0,s.events.push({type:"onFocus"}),s.syntheticEvent=t,this.applyState(s)}},this.filterChanged=(t,s)=>{const{textField:i,filterable:o}=this.component.props;o&&s.events.push({type:"onFilterChange",filter:{field:i,operator:"contains",ignoreCase:!0,value:t}})},this.togglePopup=t=>{const s=this.component.props,i=s.opened!==void 0?s.opened:this.component.state.opened;s.opened===void 0&&(t.data.opened=!i),i?t.events.push({type:"onClose"}):(t.events.push({type:"onOpen"}),this.calculatePopupWidth())},this.pageChange=(t,s)=>{const i=this.initState();i.syntheticEvent=s,this.triggerOnPageChange(i,t.skip,t.take),this.applyState(i)},this.scrollToVirtualItem=(t,s)=>{const i=this.vs;if(t.skip===0)i.reset();else{let o=i.translate;o===0&&(i.calcScrollElementHeight(),o=i.itemHeight*t.skip,i.translateTo(o,!0)),s<0&&o>0&&(o+=i.itemHeight*(t.pageSize/4)),i.container&&(i.container.scrollTop=o),this.scrollToItem(s,!0)}},this.scrollPopupByPageSize=t=>{var p,u,d,g,f,m;const s=this.vs,i=(u=(p=this.list)==null?void 0:p.parentElement)==null?void 0:u.scrollTop,o=s.enabled&&s.itemHeight?s.itemHeight:this.list?this.list.children[0].offsetHeight:0,r=(g=(d=this.list)==null?void 0:d.parentElement)==null?void 0:g.offsetHeight;i!==void 0&&r!==void 0&&((m=(f=this.list)==null?void 0:f.parentElement)==null||m.scroll({top:i+t*Math.floor(r/o)*o}))},this.renderScrollElement=()=>{const t=this.vs;return t.enabled&&P.createElement("div",{ref:s=>t.scrollElement=s,key:"scrollElementKey"})},this.resetGroupStickyHeader=(t,s)=>{t!==s.state.group&&s.setState({group:t})},this.listBoxId=e.props.id+"list",this.guid=e.props.id,this.component=e,this.vs.PageChange=this.pageChange}didUpdate(){this.vs.listTransform&&this.vs.list&&(this.vs.list.style.transform=this.vs.listTransform,this.vs.listTransform="")}didMount(){const e=this.component.props,t=e.popupSettings||{},s=e.style||{},i=t.width;let o=e.opened===!0;i===void 0&&this.calculatePopupWidth(),e.dir===void 0&&s.direction===void 0&&(this.calculateDir(),o=!0),o&&this.component.forceUpdate()}calculateDir(){const e=this.component.element;e&&e.ownerDocument&&e.ownerDocument.defaultView&&(this.dirCalculated=e.ownerDocument.defaultView.getComputedStyle(e).direction||void 0)}calculatePopupWidth(){this.wrapper&&(this.popupWidth=this.wrapper.offsetWidth+"px")}scrollToItem(e,t,s){const i=this.list||this.vs.list;if(!i&&!s&&setTimeout(()=>{this.scrollToItem(e,t,!0)},10),e===0&&t&&this.vs.skip===0){this.vs.reset();return}if(i&&e>=0){const o=this.vs,r=o.container||i.parentNode,p=t!==void 0?t:o.enabled;c.scrollToItem(r,i,e,o.translate,p)}}updateComponentArgs(e){for(let t in e)Object.hasOwnProperty.call(e,t)&&(this.component[t]=e[t])}initState(){return{data:{},events:[],syntheticEvent:void 0}}applyState(e){Object.keys(e.data).length>0&&this.component.setState(e.data);const t={syntheticEvent:e.syntheticEvent,nativeEvent:e.syntheticEvent?e.syntheticEvent.nativeEvent:void 0,target:this.component,value:this.component.value};e.events.forEach(s=>{const i=s.type;delete s.type;const o=i&&this.component.props[i];o&&o.call(void 0,{...t,...s})})}triggerOnPageChange(e,t,s){const i=this.component.props.virtual;if(i){const o=Math.min(Math.max(0,t),Math.max(0,i.total-s));o!==i.skip&&e.events.push({type:"onPageChange",page:{skip:o,take:s}})}}triggerPageChangeCornerItems(e,t){const s=this.component.props,{data:i=[],dataItemKey:o,virtual:r}=s,p=s.opened!==void 0?s.opened:this.component.state.opened;e&&r&&this.vs.enabled&&(r.skip>0&&c.areSame(e,i[0],o)?this.triggerOnPageChange(t,r.skip-1,r.pageSize):!p&&r.skip+r.pageSize<r.total&&c.areSame(e,i[i.length-1],o)&&this.triggerOnPageChange(t,r.skip+1,r.pageSize))}getPopupSettings(){return Object.assign({},a.defaultProps.popupSettings,this.component.props.popupSettings)}getAdaptiveAnimation(){const e=this.getPopupSettings();return e.animate!==void 0?e.animate:!0}getGroupedDataModernMode(e,t){const s=[];return e.forEach((i,o)=>{e[o-1]&&i[t]!==e[o-1][t]&&s.push({[t]:i[t]}),s.push(e[o])}),s}};a.basicPropTypes={opened:n.bool,disabled:n.bool,dir:n.string,tabIndex:n.number,accessKey:n.string,data:n.array,textField:n.string,className:n.string,label:n.string,loading:n.bool,popupSettings:n.shape({animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),popupClass:n.string,className:n.string,appendTo:n.any,width:n.oneOfType([n.string,n.number]),height:n.oneOfType([n.string,n.number])}),onOpen:n.func,onClose:n.func,onFocus:n.func,onBlur:n.func,onChange:n.func,itemRender:n.func,listNoDataRender:n.func,focusedItemIndex:n.func,header:n.node,footer:n.node},a.propTypes={...a.basicPropTypes,value:n.any,defaultValue:n.any,filterable:n.bool,filter:n.string,virtual:n.shape({pageSize:n.number.isRequired,skip:n.number.isRequired,total:n.number.isRequired}),onFilterChange:n.func,onPageChange:n.func},a.defaultProps={popupSettings:{height:"200px"},required:!1,validityStyles:!0};let h=a;module.exports=h;
8
+ "use strict";const v=require("react"),n=require("prop-types"),y=require("./VirtualScrollStatic.js"),S=require("./Navigation.js"),c=require("./utils.js");function b(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const P=b(v),a=class a{constructor(e){this.wrapper=null,this.list=null,this.vs=new y.VirtualScroll,this.navigation=new S.Navigation,this.handleItemClick=(t,s)=>{const i=this.initState();i.syntheticEvent=s,s.stopPropagation(),this.component.handleItemSelect(t,i),this.togglePopup(i),this.applyState(i)},this.handleFocus=t=>{if(!this.component.state.focused){const s=this.initState();s.data.focused=!0,s.events.push({type:"onFocus"}),s.syntheticEvent=t,this.applyState(s)}},this.filterChanged=(t,s)=>{const{textField:i,filterable:o}=this.component.props;o&&s.events.push({type:"onFilterChange",filter:{field:i,operator:"contains",ignoreCase:!0,value:t}})},this.togglePopup=t=>{const s=this.component.props,i=s.opened!==void 0?s.opened:this.component.state.opened;s.opened===void 0&&(t.data.opened=!i),i?t.events.push({type:"onClose"}):(t.events.push({type:"onOpen"}),this.calculatePopupWidth())},this.pageChange=(t,s)=>{const i=this.initState();i.syntheticEvent=s,this.triggerOnPageChange(i,t.skip,t.take),this.applyState(i)},this.scrollToVirtualItem=(t,s)=>{const i=this.vs;if(t.skip===0)i.reset();else{let o=i.translate;o===0&&(i.calcScrollElementHeight(),o=i.itemHeight*t.skip,i.translateTo(o,!0)),s<0&&o>0&&(o+=i.itemHeight*(t.pageSize/4)),i.container&&(i.container.scrollTop=o),this.scrollToItem(s,!0)}},this.scrollPopupByPageSize=t=>{var p,u,d,g,f,m;const s=this.vs,i=(u=(p=this.list)==null?void 0:p.parentElement)==null?void 0:u.scrollTop,o=s.enabled&&s.itemHeight?s.itemHeight:this.list?this.list.children[0].offsetHeight:0,r=(g=(d=this.list)==null?void 0:d.parentElement)==null?void 0:g.offsetHeight;i!==void 0&&r!==void 0&&((m=(f=this.list)==null?void 0:f.parentElement)==null||m.scroll({top:i+t*Math.floor(r/o)*o}))},this.renderScrollElement=()=>{const t=this.vs;return t.enabled&&P.createElement("div",{ref:s=>{t.scrollElement=s},key:"scrollElementKey"})},this.resetGroupStickyHeader=(t,s)=>{t!==s.state.group&&s.setState({group:t})},this.listBoxId=e.props.id+"list",this.guid=e.props.id,this.component=e,this.vs.PageChange=this.pageChange}didUpdate(){this.vs.listTransform&&this.vs.list&&(this.vs.list.style.transform=this.vs.listTransform,this.vs.listTransform="")}didMount(){const e=this.component.props,t=e.popupSettings||{},s=e.style||{},i=t.width;let o=e.opened===!0;i===void 0&&this.calculatePopupWidth(),e.dir===void 0&&s.direction===void 0&&(this.calculateDir(),o=!0),o&&this.component.forceUpdate()}calculateDir(){const e=this.component.element;e&&e.ownerDocument&&e.ownerDocument.defaultView&&(this.dirCalculated=e.ownerDocument.defaultView.getComputedStyle(e).direction||void 0)}calculatePopupWidth(){this.wrapper&&(this.popupWidth=this.wrapper.offsetWidth+"px")}scrollToItem(e,t,s){const i=this.list||this.vs.list;if(!i&&!s&&setTimeout(()=>{this.scrollToItem(e,t,!0)},10),e===0&&t&&this.vs.skip===0){this.vs.reset();return}if(i&&e>=0){const o=this.vs,r=o.container||i.parentNode,p=t!==void 0?t:o.enabled;c.scrollToItem(r,i,e,o.translate,p)}}updateComponentArgs(e){for(let t in e)Object.hasOwnProperty.call(e,t)&&(this.component[t]=e[t])}initState(){return{data:{},events:[],syntheticEvent:void 0}}applyState(e){Object.keys(e.data).length>0&&this.component.setState(e.data);const t={syntheticEvent:e.syntheticEvent,nativeEvent:e.syntheticEvent?e.syntheticEvent.nativeEvent:void 0,target:this.component,value:this.component.value};e.events.forEach(s=>{const i=s.type;delete s.type;const o=i&&this.component.props[i];o&&o.call(void 0,{...t,...s})})}triggerOnPageChange(e,t,s){const i=this.component.props.virtual;if(i){const o=Math.min(Math.max(0,t),Math.max(0,i.total-s));o!==i.skip&&e.events.push({type:"onPageChange",page:{skip:o,take:s}})}}triggerPageChangeCornerItems(e,t){const s=this.component.props,{data:i=[],dataItemKey:o,virtual:r}=s,p=s.opened!==void 0?s.opened:this.component.state.opened;e&&r&&this.vs.enabled&&(r.skip>0&&c.areSame(e,i[0],o)?this.triggerOnPageChange(t,r.skip-1,r.pageSize):!p&&r.skip+r.pageSize<r.total&&c.areSame(e,i[i.length-1],o)&&this.triggerOnPageChange(t,r.skip+1,r.pageSize))}getPopupSettings(){return Object.assign({},a.defaultProps.popupSettings,this.component.props.popupSettings)}getAdaptiveAnimation(){const e=this.getPopupSettings();return e.animate!==void 0?e.animate:!0}getGroupedDataModernMode(e,t){const s=[];return e.forEach((i,o)=>{e[o-1]&&i[t]!==e[o-1][t]&&s.push({[t]:i[t]}),s.push(e[o])}),s}};a.basicPropTypes={opened:n.bool,disabled:n.bool,dir:n.string,tabIndex:n.number,accessKey:n.string,data:n.array,textField:n.string,className:n.string,label:n.string,loading:n.bool,popupSettings:n.shape({animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),popupClass:n.string,className:n.string,appendTo:n.any,width:n.oneOfType([n.string,n.number]),height:n.oneOfType([n.string,n.number])}),onOpen:n.func,onClose:n.func,onFocus:n.func,onBlur:n.func,onChange:n.func,itemRender:n.func,listNoDataRender:n.func,focusedItemIndex:n.func,header:n.node,footer:n.node},a.propTypes={...a.basicPropTypes,value:n.any,defaultValue:n.any,filterable:n.bool,filter:n.string,virtual:n.shape({pageSize:n.number.isRequired,skip:n.number.isRequired,total:n.number.isRequired}),onFilterChange:n.func,onPageChange:n.func},a.defaultProps={popupSettings:{height:"200px"},required:!1,validityStyles:!0};let h=a;module.exports=h;
@@ -53,7 +53,9 @@ const a = class a {
53
53
  }));
54
54
  }, this.renderScrollElement = () => {
55
55
  const t = this.vs;
56
- return t.enabled && /* @__PURE__ */ m.createElement("div", { ref: (e) => t.scrollElement = e, key: "scrollElementKey" });
56
+ return t.enabled && /* @__PURE__ */ m.createElement("div", { ref: (e) => {
57
+ t.scrollElement = e;
58
+ }, key: "scrollElementKey" });
57
59
  }, this.resetGroupStickyHeader = (t, e) => {
58
60
  t !== e.state.group && e.setState({ group: t });
59
61
  }, this.listBoxId = s.props.id + "list", this.guid = s.props.id, this.component = s, this.vs.PageChange = this.pageChange;