@progress/kendo-react-dropdowns 15.0.0 → 15.0.1-develop.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AutoComplete/AutoComplete.js +1 -1
- package/AutoComplete/AutoComplete.mjs +4 -4
- package/AutoCompleteMcpWrapper.d.ts +3 -1
- package/ComboBox/ComboBox.js +1 -1
- package/ComboBox/ComboBox.mjs +146 -144
- package/ComboBoxMcpWrapper.d.ts +3 -1
- package/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +343 -337
- package/MultiColumnComboBox/MultiColumnComboBox.js +1 -1
- package/MultiColumnComboBox/MultiColumnComboBox.mjs +124 -123
- package/MultiSelectMcpWrapper.d.ts +3 -1
- package/MultiSelectTree/utils.js +1 -1
- package/MultiSelectTree/utils.mjs +17 -17
- package/common/DropDownBase.js +1 -1
- package/common/DropDownBase.mjs +118 -112
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/index.d.mts +7 -10
- package/index.d.ts +7 -10
- package/index.js +1 -1
- package/index.mjs +50 -51
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react"),h=require("prop-types"),q=require("../common/SearchBar.js"),B=require("../common/ListContainer.js"),N=require("../common/List.js"),x=require("../common/DropDownBase.js"),R=require("../common/GroupStickyHeader.js"),g=require("../common/utils.js"),l=require("@progress/kendo-react-common"),z=require("@progress/kendo-react-labels"),_=require("@progress/kendo-react-intl"),w=require("../messages/index.js"),A=require("../common/ClearButton.js"),H=require("../common/AdaptiveMode.js"),F=require("../common/withCustomComponent.js"),W=require("@progress/kendo-react-layout"),j=require("../common/ListFilter.js");function G(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 f=G(T),U="Please enter a valid value!",{sizeMap:D,roundedMap:$}=l.kendoThemeMaps,y=class y extends f.Component{constructor(){super(...arguments),this.state={},this.base=new x(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.handleKendoPasteValue=e=>{const t=e!=null?String(e):"",s=this.base.initState();s.syntheticEvent={target:this._element,currentTarget:this._element,nativeEvent:new Event("change",{bubbles:!0})},this.triggerOnChange(t,s),this.applyState(s)},this.handleItemSelect=(e,t)=>{const s=g.getFilteredData(this.props),n=g.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=g.getFilteredData(this.props)[e];g.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||U)},this.renderAdaptiveListContainer=()=>{const{windowWidth:e=0}=this.state,t=f.createElement(j,{value:this.value,ref:n=>{this._adaptiveInput=n&&n.element},onChange:this.onChangeHandler,onKeyDown:this.onInputKeyDown,size:"large",rounded:this.props.rounded,fillMode:this.props.fillMode,placeholder:this.props.placeholder}),s={title:this.props.adaptiveTitle||this.props.label,subTitle:this.props.adaptiveSubtitle,expand:this.opened,onClose:n=>this.onCancel(n),windowWidth:e,mobileFilter:t};return f.createElement(H.AdaptiveMode,{...s},f.createElement(W.ActionSheetContent,null,f.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;g.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=g.getFilteredData(this.props);let{group:o}=this.state;return o===void 0&&i!==void 0&&(o=g.getItemValue(d[0],i)),f.createElement(f.Fragment,null,e&&f.createElement("div",{className:"k-list-header"},e),f.createElement("div",{className:l.classNames("k-list",{[`k-list-${this.mobileMode?"lg":D[s]||s}`]:this.mobileMode||s})},!a&&o&&d.length!==0&&f.createElement(R,{group:o,render:n}),this.renderList()),t&&f.createElement("div",{className:"k-list-footer"},t))},this.onScroll=e=>{this._isScrolling=!0;const{list:t}=this.base,{groupField:s}=this.props;let n=g.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),c=r&&r===i,p=r&&r.length>i.length,{suggest:b}=this.props,u=this.props.opened!==void 0?this.props.opened:this.state.opened;if(b!==void 0&&b!==!1){c||p||!a?this._suggested="":this.suggestValue(i);const m=i+this._suggested,v={userInput:i,value:this._suggested};this.triggerOnChange(m,s,{suggestion:v})}else this._suggested="",this.triggerOnChange(i,s);(!u&&i||u&&!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=g.getFilteredData(this.props);this._isScrolling&&(this._isScrolling=!1);const a=this.focusedIndex(),d=i[a],o=e.keyCode,r=e.altKey,c=this.props.opened!==void 0?this.props.opened:this.state.opened,p=this.base.initState();p.syntheticEvent=e;const b=()=>{c&&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(c&&o===l.Keys.pageUp)b(),this.base.scrollPopupByPageSize(-1);else if(c&&o===l.Keys.pageDown)b(),this.base.scrollPopupByPageSize(1);else if(c&&(o===l.Keys.enter||o===l.Keys.esc))b(),t===!1&&d&&d.disabled?(c&&this.togglePopup(p),this.applyState(p)):this.applyInputValue(e.currentTarget.value,p,e.keyCode);else if(!c&&o===l.Keys.esc)this._suggested="",this.triggerOnChange("",p),this.state.focusedItem!==void 0&&(p.data.focusedItem=void 0),this.applyState(p);else if(o===l.Keys.up||o===l.Keys.down){if(s!==""&&n)if(!this.props.skipDisabledItems&&c)this.onNavigate(p,o);else{let u=0;if(o===l.Keys.down||o===l.Keys.right){const m=i.slice(a+1).find(v=>!v.disabled);u=m&&i.indexOf(m)}else if(o===l.Keys.up||o===l.Keys.left){let m;if(a===-1)m=i,u=i.findIndex(v=>!v.disabled);else{m=i.slice(0,a);let v=m.pop();for(;v&&v.disabled;)v=m.pop();u=v&&i.indexOf(v)}}if(u!==void 0){const m=u-a;this.onNavigate(p,o,m)}else u===void 0&&a===i.length-1&&this.onNavigate(p,o)}else if(!this.props.skipDisabledItems&&c)this.onNavigate(p,o);else{let u=null;if(o===l.Keys.down||o===l.Keys.right)u=i.slice(a+1).find(m=>!m.disabled);else if(o===l.Keys.up||o===l.Keys.left){const m=i.slice(0,a);for(u=m.pop();u&&u.disabled;)u=m.pop()}if(u){const m=u.id-a-1;this.onNavigate(p,o,m)}else this.onNavigate(p,o)}this.applyState(p),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 u;const{groupField:s=""}=this.props,n=g.getFilteredData(this.props),{data:i=[]}=e,a=this.focusedIndex(),d=n[a],o=i!==n,r=d!==void 0&&t.focusedItem!==d,c=this.props.opened!==void 0?this.props.opened:this.state.opened,p=e.opened!==void 0?e.opened:t.opened,b=!p&&c;if(s==="")(c&&(r||o)||b)&&this.base.scrollToItem(a);else if(!this._isScrolling){const m=(u=this.base.getGroupedDataModernMode(n,s))==null?void 0:u.indexOf(d);b&&(n&&n.length!==0&&this.base.resetGroupStickyHeader(n[0][s],this),this.base.scrollToItem(m)),c&&p&&r&&this.base.scrollToItem(m)}this.setValidity()}componentDidMount(){var t;this.observerResize=l.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.base.didMount(),this.setValidity(),(t=this.document)!=null&&t.body&&this.observerResize&&this.observerResize.observe(this.document.body);const e=this.props.name||this.props.id;this.KendoPasteSubscription=l.subscribeToKendoPaste(this._element,{fieldName:e,onValueChange:s=>{this.handleKendoPasteValue(s)}})}componentWillUnmount(){var e;this.observerResize&&this.observerResize.disconnect(),(e=this.KendoPasteSubscription)==null||e.unsubscribe()}render(){const{dir:e,disabled:t,label:s,className:n,style:i,loading:a,suggest:d,size:o,rounded:r,fillMode:c}=this.props,p=!this.validityStyles||this.validity.valid,b=this.base,u=this.value,m=this.props.clearButton!==!1&&!a&&!!u,v=this.props.id||this._inputId,O=this.state.focused;typeof d=="string"&&(this._suggested=d);const[P,K]=F(this.props.prefix||f.Fragment),[V,L]=F(this.props.suffix||f.Fragment),k=f.createElement(f.Fragment,null,f.createElement("span",{className:l.classNames("k-autocomplete k-input",n,{[`k-input-${D[o]||o}`]:o,[`k-rounded-${$[r]||r}`]:r,[`k-input-${c}`]:c,"k-invalid":!p,"k-focus":O&&!t,"k-loading":a,"k-required":this.required,"k-disabled":t}),ref:S=>{this._element=S,b.wrapper=S},style:s?{...i,width:void 0}:i,dir:e,onFocus:this.mobileMode?S=>this.handleWrapperClick(S):this.handleFocus,onBlur:this.handleBlur,onClick:this.handleWrapperClick},this.props.prefix&&f.createElement(P,{...K}),this.renderSearchBar(u||"",v),a&&f.createElement(l.IconWrap,{className:"k-input-loading-icon",name:"loading"}),m&&!a&&f.createElement(A,{onClick:this.clearButtonClick,key:"clearbutton"}),this.props.suffix&&f.createElement(V,{...L}),!this.mobileMode&&this.renderListContainer()),this.mobileMode&&this.renderAdaptiveListContainer());return s?f.createElement(z.FloatingLabel,{label:s,editorId:v,editorValue:u,editorValid:p,editorDisabled:t,style:{width:i?i.width:void 0},children:k}):k}onNavigate(e,t,s){const n=this.value,{textField:i,focusedItemIndex:a}=this.props,d=g.getFilteredData(this.props),o=this.state.focusedItem!==void 0?d.findIndex(c=>g.areSame(c,this.state.focusedItem,i)):a?a(d,n,i):d.indexOf(g.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=g.getFilteredData(this.props),d=this.focusedIndex(),o=a[d];if(this._suggested="",n&&s===l.Keys.enter&&o&&!o.disabled){const r=g.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,c=this.props.opened!==void 0?this.props.opened:this.state.opened;return f.createElement(q,{id:t,placeholder:n,tabIndex:i,accessKey:this.props.accessKey,value:e,suggestedText:this._suggested,focused:r,name:this.props.name,ref:p=>{this._input=p&&p.input},onKeyDown:this.onInputKeyDown,onChange:this.onChangeHandler,onFocus:s.handleFocus,onBlur:this.handleBlur,disabled:a,readOnly:d,expanded:c,ariaControls:c?s.listBoxId:void 0,activedescendant:`k-${s.guid}-item-${this.focusedIndex()+1}`,role:"combobox",ariaLabelledBy:this.props.ariaLabelledBy,ariaLabel:this.props.ariaLabel,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=g.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=g.getItemValue(n[0],s)),f.createElement(B,{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=_.provideLocalizationService(this),s=e.getPopupSettings(),{textField:n,listNoDataRender:i,itemRender:a,groupHeaderItemRender:d}=this.props,o=g.getFilteredData(this.props),r=this.value,c=this.props.opened!==void 0?this.props.opened:this.state.opened;return f.createElement(N,{id:e.listBoxId,show:c,data:o.slice(),focusedIndex:this.focusedIndex(),value:r,textField:n,valueField:n,highlightSelected:!0,optionsGuid:e.guid,groupField:this.props.groupField,ariaLabel:t.toLanguageString(w.autoCompleteListAriaLabel,w.messages[w.autoCompleteListAriaLabel]),listRef:p=>{e.list=p},wrapperStyle:this.mobileMode?{}:{maxHeight:s.height},wrapperCssClass:"k-list-content",onClick:this.handleItemClick,itemRender:a,groupHeaderItemRender:d,noDataRender:i,onMouseDown:p=>p.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=g.getFilteredData(this.props),n=s[g.itemIndexStartsWith(s,e,t)];if(n){const i=g.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=g.getFilteredData(this.props),a=e!==void 0?e:this.value;if(this.state.focusedItem!==void 0)return i.findIndex(o=>g.areSame(o,this.state.focusedItem,t));if(s)return s(i,a,t);const d=i.indexOf(g.getFocusedItem(i,a,t));return n&&t&&d===-1?i.findIndex(o=>!o.disabled):Math.max(0,d)}calculateMedia(e){for(const t of e)this.setState({windowWidth:t.target.clientWidth})}};y.displayName="AutoComplete",y.propTypes={...x.basicPropTypes,size:h.oneOf(["small","medium","large"]),rounded:h.oneOf(["small","medium","large","full","none"]),fillMode:h.oneOf(["solid","flat","outline"]),groupField:h.string,suggest:h.oneOfType([h.bool,h.string]),placeholder:h.string,value:h.string,defaultValue:h.string,validationMessage:h.string,required:h.bool,readonly:h.bool,clearButton:h.bool,valueRender:h.func,id:h.string,ariaLabelledBy:h.string,ariaLabel:h.string,ariaDescribedBy:h.string,list:h.any,adaptive:h.bool,adaptiveTitle:h.string,adaptiveSubtitle:h.string,onCancel:h.func,skipDisabledItems:h.bool,inputAttributes:h.object},y.defaultProps={...x.defaultProps,size:void 0,rounded:void 0,fillMode:void 0,skipDisabledItems:!0,prefix:void 0,suffix:void 0};let C=y;const M=l.createPropsContext();_.registerForLocalization(C);const E=l.withIdHOC(l.withPropsContext(M,l.withAdaptiveModeContext(C)));E.displayName="KendoReactAutoComplete";exports.AutoComplete=E;exports.AutoCompletePropsContext=M;exports.AutoCompleteWithoutContext=C;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react"),h=require("prop-types"),q=require("../common/SearchBar.js"),B=require("../common/ListContainer.js"),N=require("../common/List.js"),x=require("../common/DropDownBase.js"),R=require("../common/GroupStickyHeader.js"),g=require("../common/utils.js"),l=require("@progress/kendo-react-common"),z=require("@progress/kendo-react-labels"),_=require("@progress/kendo-react-intl"),w=require("../messages/index.js"),A=require("../common/ClearButton.js"),H=require("../common/AdaptiveMode.js"),F=require("../common/withCustomComponent.js"),W=require("@progress/kendo-react-layout"),U=require("../common/ListFilter.js");function j(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 f=j(T),G="Please enter a valid value!",{sizeMap:D,roundedMap:$}=l.kendoThemeMaps,y=class y extends f.Component{constructor(){super(...arguments),this.state={},this.base=new x(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.handleKendoPasteValue=e=>{const t=e!=null?String(e):"",s=this.base.initState();s.syntheticEvent={target:this._element,currentTarget:this._element,nativeEvent:new Event("change",{bubbles:!0})},this.triggerOnChange(t,s),this.applyState(s)},this.handleItemSelect=(e,t)=>{const s=g.getFilteredData(this.props),n=g.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=g.getFilteredData(this.props)[e];g.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||G)},this.renderAdaptiveListContainer=()=>{const{windowWidth:e=0}=this.state,t=f.createElement(U,{value:this.value,ref:n=>{this._adaptiveInput=n&&n.element},onChange:this.onChangeHandler,onKeyDown:this.onInputKeyDown,size:"large",rounded:this.props.rounded,fillMode:this.props.fillMode,placeholder:this.props.placeholder}),s={title:this.props.adaptiveTitle||this.props.label,subTitle:this.props.adaptiveSubtitle,expand:this.opened,onClose:n=>this.onCancel(n),windowWidth:e,mobileFilter:t};return f.createElement(H.AdaptiveMode,{...s},f.createElement(W.ActionSheetContent,null,f.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;g.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=g.getFilteredData(this.props);let{group:o}=this.state;return o===void 0&&i!==void 0&&(o=g.getItemValue(d[0],i)),f.createElement(f.Fragment,null,e&&f.createElement("div",{className:"k-list-header"},e),f.createElement("div",{className:l.classNames("k-list",{[`k-list-${this.mobileMode?"lg":D[s]||s}`]:this.mobileMode||s})},!a&&o&&d.length!==0&&f.createElement(R,{group:o,render:n}),this.renderList()),t&&f.createElement("div",{className:"k-list-footer"},t))},this.onScroll=e=>{this._isScrolling=!0;const{list:t}=this.base,{groupField:s}=this.props;let n=g.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),c=r&&r===i,p=r&&r.length>i.length,{suggest:b}=this.props,u=this.props.opened!==void 0?this.props.opened:this.state.opened;if(b!==void 0&&b!==!1){c||p||!a?this._suggested="":this.suggestValue(i);const m=i+this._suggested,v={userInput:i,value:this._suggested};this.triggerOnChange(m,s,{suggestion:v})}else this._suggested="",this.triggerOnChange(i,s);(!u&&i||u&&!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=g.getFilteredData(this.props);this._isScrolling&&(this._isScrolling=!1);const a=this.focusedIndex(),d=i[a],o=e.keyCode,r=e.altKey,c=this.props.opened!==void 0?this.props.opened:this.state.opened,p=this.base.initState();p.syntheticEvent=e;const b=()=>{c&&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(c&&o===l.Keys.pageUp)b(),this.base.scrollPopupByPageSize(-1);else if(c&&o===l.Keys.pageDown)b(),this.base.scrollPopupByPageSize(1);else if(c&&(o===l.Keys.enter||o===l.Keys.esc))b(),t===!1&&d&&d.disabled?(c&&this.togglePopup(p),this.applyState(p)):this.applyInputValue(e.currentTarget.value,p,e.keyCode);else if(!c&&o===l.Keys.esc)this._suggested="",this.triggerOnChange("",p),this.state.focusedItem!==void 0&&(p.data.focusedItem=void 0),this.applyState(p);else if(o===l.Keys.up||o===l.Keys.down){if(s!==""&&n)if(!this.props.skipDisabledItems&&c)this.onNavigate(p,o);else{let u=0;if(o===l.Keys.down||o===l.Keys.right){const m=i.slice(a+1).find(v=>!v.disabled);u=m&&i.indexOf(m)}else if(o===l.Keys.up||o===l.Keys.left){let m;if(a===-1)m=i,u=i.findIndex(v=>!v.disabled);else{m=i.slice(0,a);let v=m.pop();for(;v&&v.disabled;)v=m.pop();u=v&&i.indexOf(v)}}if(u!==void 0){const m=u-a;this.onNavigate(p,o,m)}else u===void 0&&a===i.length-1&&this.onNavigate(p,o)}else if(!this.props.skipDisabledItems&&c)this.onNavigate(p,o);else{let u=null;if(o===l.Keys.down||o===l.Keys.right)u=i.slice(a+1).find(m=>!m.disabled);else if(o===l.Keys.up||o===l.Keys.left){const m=i.slice(0,a);for(u=m.pop();u&&u.disabled;)u=m.pop()}if(u){const m=u.id-a-1;this.onNavigate(p,o,m)}else this.onNavigate(p,o)}this.applyState(p),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 u;const{groupField:s=""}=this.props,n=g.getFilteredData(this.props),{data:i=[]}=e,a=this.focusedIndex(),d=n[a],o=i!==n,r=d!==void 0&&t.focusedItem!==d,c=this.props.opened!==void 0?this.props.opened:this.state.opened,p=e.opened!==void 0?e.opened:t.opened,b=!p&&c;if(this.base.didUpdate(),s==="")(c&&(r||o)||b)&&this.base.scrollToItem(a);else if(!this._isScrolling){const m=(u=this.base.getGroupedDataModernMode(n,s))==null?void 0:u.indexOf(d);b&&(n&&n.length!==0&&this.base.resetGroupStickyHeader(n[0][s],this),this.base.scrollToItem(m)),c&&p&&r&&this.base.scrollToItem(m)}this.setValidity()}componentDidMount(){var t;this.observerResize=l.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.base.didMount(),this.setValidity(),(t=this.document)!=null&&t.body&&this.observerResize&&this.observerResize.observe(this.document.body);const e=this.props.name||this.props.id;this.KendoPasteSubscription=l.subscribeToKendoPaste(this._element,{fieldName:e,onValueChange:s=>{this.handleKendoPasteValue(s)}})}componentWillUnmount(){var e;this.observerResize&&this.observerResize.disconnect(),(e=this.KendoPasteSubscription)==null||e.unsubscribe()}render(){const{dir:e,disabled:t,label:s,className:n,style:i,loading:a,suggest:d,size:o,rounded:r,fillMode:c}=this.props,p=!this.validityStyles||this.validity.valid,b=this.base,u=this.value,m=this.props.clearButton!==!1&&!a&&!!u,v=this.props.id||this._inputId,O=this.state.focused;typeof d=="string"&&(this._suggested=d);const[P,K]=F(this.props.prefix||f.Fragment),[V,L]=F(this.props.suffix||f.Fragment),k=f.createElement(f.Fragment,null,f.createElement("span",{className:l.classNames("k-autocomplete k-input",n,{[`k-input-${D[o]||o}`]:o,[`k-rounded-${$[r]||r}`]:r,[`k-input-${c}`]:c,"k-invalid":!p,"k-focus":O&&!t,"k-loading":a,"k-required":this.required,"k-disabled":t}),ref:S=>{this._element=S,b.wrapper=S},style:s?{...i,width:void 0}:i,dir:e,onFocus:this.mobileMode?S=>this.handleWrapperClick(S):this.handleFocus,onBlur:this.handleBlur,onClick:this.handleWrapperClick},this.props.prefix&&f.createElement(P,{...K}),this.renderSearchBar(u||"",v),a&&f.createElement(l.IconWrap,{className:"k-input-loading-icon",name:"loading"}),m&&!a&&f.createElement(A,{onClick:this.clearButtonClick,key:"clearbutton"}),this.props.suffix&&f.createElement(V,{...L}),!this.mobileMode&&this.renderListContainer()),this.mobileMode&&this.renderAdaptiveListContainer());return s?f.createElement(z.FloatingLabel,{label:s,editorId:v,editorValue:u,editorValid:p,editorDisabled:t,style:{width:i?i.width:void 0},children:k}):k}onNavigate(e,t,s){const n=this.value,{textField:i,focusedItemIndex:a}=this.props,d=g.getFilteredData(this.props),o=this.state.focusedItem!==void 0?d.findIndex(c=>g.areSame(c,this.state.focusedItem,i)):a?a(d,n,i):d.indexOf(g.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=g.getFilteredData(this.props),d=this.focusedIndex(),o=a[d];if(this._suggested="",n&&s===l.Keys.enter&&o&&!o.disabled){const r=g.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,c=this.props.opened!==void 0?this.props.opened:this.state.opened;return f.createElement(q,{id:t,placeholder:n,tabIndex:i,accessKey:this.props.accessKey,value:e,suggestedText:this._suggested,focused:r,name:this.props.name,ref:p=>{this._input=p&&p.input},onKeyDown:this.onInputKeyDown,onChange:this.onChangeHandler,onFocus:s.handleFocus,onBlur:this.handleBlur,disabled:a,readOnly:d,expanded:c,ariaControls:c?s.listBoxId:void 0,activedescendant:`k-${s.guid}-item-${this.focusedIndex()+1}`,role:"combobox",ariaLabelledBy:this.props.ariaLabelledBy,ariaLabel:this.props.ariaLabel,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=g.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=g.getItemValue(n[0],s)),f.createElement(B,{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=_.provideLocalizationService(this),s=e.getPopupSettings(),{textField:n,listNoDataRender:i,itemRender:a,groupHeaderItemRender:d}=this.props,o=g.getFilteredData(this.props),r=this.value,c=this.props.opened!==void 0?this.props.opened:this.state.opened;return f.createElement(N,{id:e.listBoxId,show:c,data:o.slice(),focusedIndex:this.focusedIndex(),value:r,textField:n,valueField:n,highlightSelected:!0,optionsGuid:e.guid,groupField:this.props.groupField,ariaLabel:t.toLanguageString(w.autoCompleteListAriaLabel,w.messages[w.autoCompleteListAriaLabel]),listRef:p=>{e.list=p},wrapperStyle:this.mobileMode?{}:{maxHeight:s.height},wrapperCssClass:"k-list-content",onClick:this.handleItemClick,itemRender:a,groupHeaderItemRender:d,noDataRender:i,onMouseDown:p=>p.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=g.getFilteredData(this.props),n=s[g.itemIndexStartsWith(s,e,t)];if(n){const i=g.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=g.getFilteredData(this.props),a=e!==void 0?e:this.value;if(this.state.focusedItem!==void 0)return i.findIndex(o=>g.areSame(o,this.state.focusedItem,t));if(s)return s(i,a,t);const d=i.indexOf(g.getFocusedItem(i,a,t));return n&&t&&d===-1?i.findIndex(o=>!o.disabled):Math.max(0,d)}calculateMedia(e){for(const t of e)this.setState({windowWidth:t.target.clientWidth})}};y.displayName="AutoComplete",y.propTypes={...x.basicPropTypes,size:h.oneOf(["small","medium","large"]),rounded:h.oneOf(["small","medium","large","full","none"]),fillMode:h.oneOf(["solid","flat","outline"]),groupField:h.string,suggest:h.oneOfType([h.bool,h.string]),placeholder:h.string,value:h.string,defaultValue:h.string,validationMessage:h.string,required:h.bool,readonly:h.bool,clearButton:h.bool,valueRender:h.func,id:h.string,ariaLabelledBy:h.string,ariaLabel:h.string,ariaDescribedBy:h.string,list:h.any,adaptive:h.bool,adaptiveTitle:h.string,adaptiveSubtitle:h.string,onCancel:h.func,skipDisabledItems:h.bool,inputAttributes:h.object},y.defaultProps={...x.defaultProps,size:void 0,rounded:void 0,fillMode:void 0,skipDisabledItems:!0,prefix:void 0,suffix:void 0};let C=y;const M=l.createPropsContext();_.registerForLocalization(C);const E=l.withIdHOC(l.withPropsContext(M,l.withAdaptiveModeContext(C)));E.displayName="KendoReactAutoComplete";exports.AutoComplete=E;exports.AutoCompletePropsContext=M;exports.AutoCompleteWithoutContext=C;
|
|
@@ -13,7 +13,7 @@ import R from "../common/List.mjs";
|
|
|
13
13
|
import S from "../common/DropDownBase.mjs";
|
|
14
14
|
import K from "../common/GroupStickyHeader.mjs";
|
|
15
15
|
import { getFilteredData as b, getItemValue as I, areSame as w, isPresent as A, getFocusedItem as F, itemIndexStartsWith as H } from "../common/utils.mjs";
|
|
16
|
-
import { createPropsContext as q, classNames as k, kendoThemeMaps as W, Keys as f, canUseDOM as E, subscribeToKendoPaste as G, IconWrap as
|
|
16
|
+
import { createPropsContext as q, classNames as k, kendoThemeMaps as W, Keys as f, canUseDOM as E, subscribeToKendoPaste as G, IconWrap as U, withIdHOC as $, withPropsContext as j, withAdaptiveModeContext as J } from "@progress/kendo-react-common";
|
|
17
17
|
import { FloatingLabel as Q } from "@progress/kendo-react-labels";
|
|
18
18
|
import { provideLocalizationService as X, registerForLocalization as Y } from "@progress/kendo-react-intl";
|
|
19
19
|
import { autoCompleteListAriaLabel as M, messages as Z } from "../messages/index.mjs";
|
|
@@ -265,7 +265,7 @@ const oe = "Please enter a valid value!", { sizeMap: P, roundedMap: ne } = W, y
|
|
|
265
265
|
componentDidUpdate(e, t) {
|
|
266
266
|
var h;
|
|
267
267
|
const { groupField: s = "" } = this.props, n = b(this.props), { data: i = [] } = e, a = this.focusedIndex(), d = n[a], o = i !== n, r = d !== void 0 && t.focusedItem !== d, u = this.props.opened !== void 0 ? this.props.opened : this.state.opened, p = e.opened !== void 0 ? e.opened : t.opened, v = !p && u;
|
|
268
|
-
if (s === "")
|
|
268
|
+
if (this.base.didUpdate(), s === "")
|
|
269
269
|
(u && (r || o) || v) && this.base.scrollToItem(a);
|
|
270
270
|
else if (!this._isScrolling) {
|
|
271
271
|
const g = (h = this.base.getGroupedDataModernMode(n, s)) == null ? void 0 : h.indexOf(d);
|
|
@@ -324,7 +324,7 @@ const oe = "Please enter a valid value!", { sizeMap: P, roundedMap: ne } = W, y
|
|
|
324
324
|
},
|
|
325
325
|
this.props.prefix && /* @__PURE__ */ c.createElement(B, { ...T }),
|
|
326
326
|
this.renderSearchBar(h || "", m),
|
|
327
|
-
a && /* @__PURE__ */ c.createElement(
|
|
327
|
+
a && /* @__PURE__ */ c.createElement(U, { className: "k-input-loading-icon", name: "loading" }),
|
|
328
328
|
g && !a && /* @__PURE__ */ c.createElement(ee, { onClick: this.clearButtonClick, key: "clearbutton" }),
|
|
329
329
|
this.props.suffix && /* @__PURE__ */ c.createElement(V, { ...L }),
|
|
330
330
|
!this.mobileMode && this.renderListContainer()
|
|
@@ -523,7 +523,7 @@ y.displayName = "AutoComplete", y.propTypes = {
|
|
|
523
523
|
let x = y;
|
|
524
524
|
const ae = q();
|
|
525
525
|
Y(x);
|
|
526
|
-
const de =
|
|
526
|
+
const de = $(
|
|
527
527
|
j(
|
|
528
528
|
ae,
|
|
529
529
|
J(x)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { AutoCompleteHandle } from './AutoComplete/AutoComplete.js';
|
|
8
|
+
import { AutoComplete as AutoCompleteOriginal, AutoCompleteHandle } from './AutoComplete/AutoComplete.js';
|
|
9
9
|
import { AutoCompleteProps } from './AutoComplete/AutoCompleteProps';
|
|
10
10
|
/**
|
|
11
11
|
* AutoComplete wrapper that integrates the Web MCP hook.
|
|
@@ -15,3 +15,5 @@ import { AutoCompleteProps } from './AutoComplete/AutoCompleteProps';
|
|
|
15
15
|
import * as React from 'react';
|
|
16
16
|
/** @hidden */
|
|
17
17
|
export declare const AutoCompleteWrapper: React.ForwardRefExoticComponent<AutoCompleteProps & React.RefAttributes<AutoCompleteHandle>>;
|
|
18
|
+
/** @hidden */
|
|
19
|
+
export type AutoCompleteWrapper = AutoCompleteOriginal;
|
package/ComboBox/ComboBox.js
CHANGED
|
@@ -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 Y=require("react"),f=require("prop-types"),T=require("../common/DropDownBase.js"),h=require("@progress/kendo-react-common"),J=require("@progress/kendo-react-labels"),p=require("../common/utils.js"),Q=require("../common/SearchBar.js"),X=require("../common/ListContainer.js"),Z=require("../common/List.js"),ee=require("../common/ListFilter.js"),K=require("../common/GroupStickyHeader.js"),L=require("../package-metadata.js"),te=require("../common/ClearButton.js"),se=require("@progress/kendo-react-buttons"),ie=require("@progress/kendo-svg-icons"),S=require("../messages/index.js"),N=require("@progress/kendo-react-intl"),oe=require("@progress/kendo-react-layout"),R=require("../common/withCustomComponent.js"),ae=require("../common/AdaptiveMode.js");function ne(w){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(w){for(const e in w)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(w,e);Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:()=>w[e]})}}return s.default=w,Object.freeze(s)}const g=ne(Y),le="Please enter a valid value!",F=class F extends g.Component{constructor(s){super(s),this.state={},this.base=new T(this),this._element=null,this._suggested="",this._skipBlur=!1,this._input=null,this._adaptiveFilterInput=null,this._skipFocus=!1,this.itemHeight=0,this.duplicates=[],this.hasDuplicates=!1,this.scrollToFocused=!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 a=this.props.data;this.duplicates=p.getPlainDataDuplicates(a),this.hasDuplicates=this.duplicates.length>0}},this.handleKendoPasteValue=e=>{const{data:t,textField:a,allowCustom:r}=this.props;if(!t)return;const l=e!=null?String(e):"",o=p.getItemIndexByText(t,l,a,!1,!0),d=o!==-1;let n=null;if(d?n=t[o]:r&&(n=a?{[a]:l}:l),n===null)return;const i=this.base.initState();i.syntheticEvent={target:this._element,currentTarget:this._element,nativeEvent:new Event("change",{bubbles:!0})},this.state.text!==void 0&&(i.data.text=void 0),this.triggerOnChange(n,i),this.applyState(i)},this.handleItemSelect=(e,t)=>{const{virtual:a,dataItemKey:r}=this.props,l=p.getFilteredData(this.props),o=a?a.skip:0,d=l[e-o],n=this.hasDuplicates||!p.areSame(d,this.value,r);this.triggerOnChange(d,t),this.state.text!==void 0&&(t.data.text=void 0),n&&this.base.triggerPageChangeCornerItems(d,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=>{this._skipFocus=!0;const{skipDisabledItems:t,textField:a}=this.props,r=p.getFilteredData(this.props),l=this.getFocusedIndex(),o=this.getCurrentValueDisabledStatus(a,r,l),d=this.props.opened!==void 0?this.props.opened:this.state.opened,n=this.base.initState();if(n.syntheticEvent=e,!t&&a&&o&&this.clearValueOnToggleBtnClick(e),this.base.togglePopup(n),!d&&this.mobileMode){const i=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text||null;this.base.filterChanged(i,n)}this.applyState(n),setTimeout(()=>{this._skipFocus=!1},300)},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=p.getItemValue(this.value,this.props.textField),a=p.isPresent(e)?e:t;return g.createElement(ee,{value:a,ref:r=>{this._adaptiveFilterInput=r&&r.element},onChange:this.handleMobileFilterChange,onKeyDown:this.onInputKeyDown,size:"large",rounded:this.props.rounded,fillMode:this.props.fillMode,placeholder:this.props.placeholder})},this.listContainerContent=()=>{const{header:e,footer:t,size:a,groupStickyHeaderItemRender:r,groupField:l,list:o,unstyled:d,virtual:n}=this.props,i=p.getFilteredData(this.props),c=d&&d.uComboBox;let{group:u}=this.state;return u===void 0&&l!==void 0&&(u=p.getItemValue(i[0],l)),g.createElement("div",{className:h.classNames(h.uComboBox.list({c,list:o,size:"large",tableSize:a,virtual:n}))},e&&g.createElement("div",{className:h.classNames(h.uComboBox.listHeader({c}))},e),!o&&u&&i.length!==0&&g.createElement(K,{group:u,render:r}),this.renderList(),t&&g.createElement("div",{className:h.classNames(h.uComboBox.listFooter({c}),this.props.footerClassName)},t))},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:a}=this.base;t.scrollHandler(e);const{groupField:r}=this.props;this.props.onListScroll&&this.props.onListScroll(e);let l=p.getFilteredData(this.props);if(!r||!l.length)return;const o=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:a?a.children[0].offsetHeight:0),n=e.target.scrollTop-t.skip*o;l=this.base.getGroupedDataModernMode(l,r);let i=l[0][r];for(let c=1;c<l.length&&!(o*c>n);c++)l[c]&&l[c][r]&&(i=l[c][r]);i!==this.state.group&&(this.setState({group:i}),this.props.onGroupScroll&&this.props.onGroupScroll.call(void 0,{group:i}))},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:a}=this.props,r=p.getFilteredData(this.props),l=this.getFocusedIndex(),d=!(l===-1)&&this.getCurrentValueDisabledStatus(a,r,l);t.data.focused=!1,t.events.push({type:"onBlur"}),t.syntheticEvent=e,a&&d&&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,a=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text||null;if(!t&&this.mobileMode){const r=this.base.initState();r.syntheticEvent=e,this.base.togglePopup(r),this.base.filterChanged(a,r),this.applyState(r)}},this.onInputKeyDown=e=>{const{skipDisabledItems:t,textField:a,dataItemKey:r,groupField:l}=this.props,o=p.getFilteredData(this.props),d=this.value,n=Math.max(0,o.findIndex(v=>p.areSame(v,d,r))),i=e.keyCode,c=this.props.opened!==void 0?this.props.opened:this.state.opened,u=this.base.initState();if(u.syntheticEvent=e,!e.altKey&&(i===h.Keys.up||i===h.Keys.down)){if(e.preventDefault(),l!==""&&a)if(!this.props.skipDisabledItems&&c)this.onNavigate(u,i);else{let v=0;if(i===h.Keys.down||i===h.Keys.right){const m=o.slice(n+1<o.length?n+1:n).find(C=>!C.disabled);v=m&&o.indexOf(m)}else if(i===h.Keys.up||i===h.Keys.left){let m;if(n===0)m=o,v=o.findIndex(C=>!C.disabled);else{m=o.slice(0,n);let C=m.pop();for(;C&&C.disabled;)C=m.pop();v=C&&o.indexOf(C)}}if(v!==void 0){const m=v-n;this.onNavigate(u,i,m)}else v===void 0&&n===o.length-1&&this.onNavigate(u,i)}else if(!this.props.skipDisabledItems&&c)this.onNavigate(u,i);else{let v=null;if(i===h.Keys.down||i===h.Keys.right)v=o.slice(n+1).find(m=>!m.disabled);else if(i===h.Keys.up||i===h.Keys.left){const m=o.slice(0,n);for(v=m.pop();v&&v.disabled;)v=m.pop()}if(v){const m=v.id-n-1;this.onNavigate(u,i,m)}else this.onNavigate(u,i)}this.applyState(u)}const b=()=>{e.preventDefault(),this.base.togglePopup(u),this.applyState(u)},y=this.getFocusedIndex(),I=y===-1,x=!I&&this.getCurrentValueDisabledStatus(a,o,y);c?i===h.Keys.pageUp?(e.preventDefault(),this.base.scrollPopupByPageSize(-1)):i===h.Keys.pageDown?(e.preventDefault(),this.base.scrollPopupByPageSize(1)):e.altKey&&i===h.Keys.up?b():i===h.Keys.enter?(e.preventDefault(),(a&&!I&&e.currentTarget.value?o[y][a]:void 0)?!t&&a&&x?this.clearValueOnEnterOrEsc(e):x||this.applyValueOnEnter(e.currentTarget.value,u):this.applyValueOnEnter(e.currentTarget.value,u)):i===h.Keys.esc&&(!t&&a&&x&&this.clearValueOnEnterOrEsc(e),this.applyValueOnRejectSuggestions(e.currentTarget.value,u)):!c&&i===h.Keys.esc?this.clearValueOnEnterOrEsc(e):e.altKey&&i===h.Keys.down&&b()},this.inputOnChange=e=>{const t=this.base.initState();t.syntheticEvent=e;const a=this.props.opened!==void 0?this.props.opened:this.state.opened,r=e.currentTarget,l=r.value;if(this.props.suggest){const o=r.selectionEnd===l.length;let d=this.props.filter!==void 0?this.props.filter:this.state.text;p.isPresent(d)||(d=p.getItemValue(this.value,this.props.textField)||"");const n=d&&d===l,i=d&&d.length>l.length;n||i||!o?this._suggested="":this.suggestValue(l)}this.props.filter===void 0&&(t.data.text=l),this.state.focusedItem!==void 0&&(t.data.focusedItem=void 0),a?this.scrollToFocused=!0:this.base.togglePopup(t),this.base.filterChanged(l,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||le)},this.handleFocus=e=>{if(this._skipFocus)return;const t=this.base.initState();t.syntheticEvent=e,this.mobileMode&&!this._skipFocus&&(this._skipFocus=!0,this.base.togglePopup(t),this.applyState(t),setTimeout(()=>{this._skipFocus=!1},300)),this.base.handleFocus(e)},this.showLicenseWatermark=!h.validatePackage(L.packageMetadata,{component:"ComboBox"}),this.licenseMessage=h.getLicenseMessage(L.packageMetadata)}get _inputId(){return this.props.id}get document(){if(h.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=p.getFilteredData(this.props),t=this.value;return e.findIndex(a=>p.areSame(a,t,s))}get name(){return this.props.name}get validity(){const s=this.props.validationMessage!==void 0,e=!this.required||this.value!==null&&this.value!==""&&this.value!==void 0,t=this.props.valid!==void 0?this.props.valid:e;return{customError:s,valid:t,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:F.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:F.defaultProps.required}componentDidUpdate(s,e){var b,y;const{dataItemKey:t,virtual:a,groupField:r="",textField:l}=this.props,o=p.getFilteredData(this.props),d=s.virtual?s.virtual.total:0,n=this.props.opened!==void 0?this.props.opened:this.state.opened,i=s.opened!==void 0?s.opened:e.opened;s.data!==o&&this.checkForDuplicatePlainTextRecords();const c=!i&&n,u=this.value;if(this._valueOnDidUpdate=u,this.base.didUpdate(),a&&a.total!==d)this.base.vs.calcScrollElementHeight(),this.base.vs.reset();else{const I=s.value!==void 0?s.value:e.value;let x=this.hasDuplicates?this.navigationIndex||0:o.findIndex(m=>p.areSame(m,u,t));l&&u&&(x=(b=this.base.getGroupedDataModernMode(o,r))==null?void 0:b.map(m=>m[l]).indexOf(u[l]));const v=!p.areSame(I,u,t);if(c&&a?this.base.scrollToVirtualItem(a,x):c&&!a?(this.onPopupOpened(),o&&o.length!==0&&this.base.resetGroupStickyHeader(o[0][r],this),this.base.scrollToItem(x)):(this.hasDuplicates||n&&i&&u&&v)&&this.base.scrollToItem(x),n&&i&&this.scrollToFocused){const m=(y=this.props.filter?this.props.filter:this.state.text)!=null?y:"";if(m){const{focusedItemIndex:C=p.itemIndexStartsWith}=this.props,D=C(o,m,l);this.base.scrollToItem(D)}else this.base.scrollToItem(0)}}this.scrollToFocused=!1,c&&this._input&&this._input.focus(),this.setValidity()}componentDidMount(){var e;this.observerResize=h.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),this.checkForDuplicatePlainTextRecords();const s=this.props.name||this.props.id;this.KendoPasteSubscription=h.subscribeToKendoPaste(this._element,{fieldName:s,onValueChange:t=>{this.handleKendoPasteValue(t)}})}componentWillUnmount(){var s,e;(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.disconnect(),(e=this.KendoPasteSubscription)==null||e.unsubscribe()}render(){const s=N.provideLocalizationService(this),e=s.toLanguageString(S.comboArrowBtnAriaLabelExpand,S.messages[S.comboArrowBtnAriaLabelExpand]),t=s.toLanguageString(S.comboArrowBtnAriaLabelCollapse,S.messages[S.comboArrowBtnAriaLabelCollapse]),{dir:a,disabled:r,clearButton:l=F.defaultProps.clearButton,label:o,textField:d,className:n,style:i,loading:c,iconClassName:u,virtual:b,size:y,rounded:I,fillMode:x,opened:v=this.state.opened,placeholder:m,svgIcon:C,unstyled:D}=this.props,B=!this.validityStyles||this.validity.valid,k=this.props.filter!==void 0?this.props.filter:this.state.text,z=p.getItemValue(this.value,d),V=p.isPresent(k)?k:z,H=l&&(!!V||p.isPresent(this.value)),O=this.base.vs,P=this.props.id||this._inputId,E=D&&D.uComboBox;O.enabled=b!==void 0,b!==void 0&&(O.skip=b.skip,O.total=b.total,O.pageSize=b.pageSize);const[W,j]=R(this.props.prefix||g.Fragment),[U,G]=R(this.props.suffix||g.Fragment),_=g.createElement(g.Fragment,null,g.createElement("span",{className:h.classNames(h.uComboBox.wrapper({c:E,size:y,rounded:I,fillMode:x,disabled:r,invalid:!B,loading:c,required:this.required}),n),ref:this.componentRef,style:o?{...i,width:void 0}:i,dir:a,onFocus:this.handleFocus},this.props.prefix&&g.createElement(W,{...j}),this.renderSearchBar(V||"",P,m),H&&!c&&g.createElement(te,{onClick:this.clearButtonClick,key:"clearbutton"}),c&&g.createElement(h.IconWrap,{className:h.classNames(h.uComboBox.loadingIcon({c:E})),name:"loading",key:"loading"}),this.props.suffix&&g.createElement(U,{...G}),g.createElement(se.Button,{tabIndex:-1,type:"button","aria-label":v?t:e,svgIcon:C||(u?void 0:ie.chevronDownIcon),iconClass:u,size:y,fillMode:x,className:h.classNames(h.uComboBox.inputButton({c:E})),onClick:this.toggleBtnClick,onMouseDown:$=>$.preventDefault()}),!this.mobileMode&&this.renderListContainer()),this.mobileMode&&this.renderAdaptiveListContainer());return o?g.createElement(J.FloatingLabel,{label:o,editorId:P,editorValue:V,editorValid:B,editorDisabled:r,style:{width:i?i.width:void 0},children:_,unstyled:D}):_}onNavigate(s,e,t){const{virtual:a={skip:0}}=this.props,r=p.getFilteredData(this.props),l=this.props.filter?this.props.filter:this.state.text;let o=-1,d;const n=this.base.vs,i=this.value;this._suggested="";const c=this.hasDuplicates&&this.duplicates.indexOf(i)!==-1;if(o=this.getFocusedIndex(c),o!==-1&&!p.isPresent(i))this.handleItemSelect(o,s);else if(l==="")this.handleItemSelect(0,s);else{const u=a.skip+o;d=this.base.navigation.navigate({keyCode:e,current:u,max:(n.enabled?n.total:r.length)-1,min:0,skipItems:t||void 0}),d!==void 0&&this.handleItemSelect(d,s)}this.navigationIndex=d}getCurrentValueDisabledStatus(s,e,t){return s&&e&&e[t]&&e[t].disabled}applyValueOnEnter(s,e){const{textField:t,allowCustom:a,ignoreCase:r}=this.props,l=p.getFilteredData(this.props),o=this.props.opened!==void 0?this.props.opened:this.state.opened,n=p.getItemValue(this.value,t)===s?this.index:p.getItemIndexByText(l,s,t,!1,r),i=n!==-1;let c;if(this._suggested="",i)c=l[n];else if(a)c=t!==void 0?{[t]:s}:s;else return this.selectFocusedItem(s,e);this.triggerOnChange(c,e),o&&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:a,ignoreCase:r}=this.props,l=p.getFilteredData(this.props),o=this.props.opened!==void 0?this.props.opened:this.state.opened,d=p.getItemValue(this.value,t);if(this._suggested="",s===d||s===""&&!p.isPresent(d))return this.closeOpenedApplyStateNonMobileMode(e,o),this.applyState(e);const n=p.getItemIndexByText(l,s,t,!0,r),i=n!==-1;let c=null;i?c=l[n]:a&&(c=s?t?{[t]:s}:s:null),this.triggerOnChange(c,e),this.state.text!==void 0&&(e.data.text=void 0,this.base.filterChanged("",e)),this.closeOpenedApplyStateNonMobileMode(e,o),this.applyState(e)}selectFocusedItem(s,e){const t=this.props.opened!==void 0?this.props.opened:this.state.opened,{textField:a,virtual:r={skip:0},focusedItemIndex:l=p.itemIndexStartsWith}=this.props,o=p.getFilteredData(this.props),d=r.skip,n=s===""&&d===0?0:l(o,s,a);return n!==-1?this.handleItemSelect(n+d,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,{groupField:e,adaptiveTitle:t=this.props.label,adaptiveSubtitle:a}=this.props,r=p.getFilteredData(this.props),l=this.props.opened!==void 0?this.props.opened:this.state.opened;let{group:o}=this.state;o===void 0&&e!==void 0&&(o=p.getItemValue(r[0],e));const d={title:t||this.props.label,subTitle:a,expand:l,onClose:n=>this.toggleBtnClick(n),windowWidth:s,mobileFilter:this.renderMobileListFilter()};return g.createElement(ae.AdaptiveMode,{...d},g.createElement(oe.ActionSheetContent,null,g.createElement("div",{className:"k-list-container"},this.listContainerContent())))}renderListContainer(){const s=this.base,{dir:e,header:t,footer:a,groupField:r,size:l,list:o,virtual:d,groupStickyHeaderItemRender:n,unstyled:i}=this.props,c=p.getFilteredData(this.props),u=this.props.opened!==void 0?this.props.opened:this.state.opened,b=s.getPopupSettings(),y=b.width!==void 0?b.width:s.popupWidth,I=i&&i.uComboBox;let{group:x}=this.state;return x===void 0&&r!==void 0&&(x=p.getItemValue(c[0],r)),g.createElement(X,{width:y,popupSettings:{...b,anchor:b.anchor||this.element,show:u,popupClass:h.classNames(b.popupClass,h.uComboBox.listContainer({c:I,popup:!0}))},dir:e!==void 0?e:this.base.dirCalculated,itemsCount:[c.length]},g.createElement("div",{className:h.classNames(h.uComboBox.list({c:I,list:o,size:l,tableSize:l,virtual:d}))},t&&g.createElement("div",{className:h.classNames(h.uComboBox.listHeader({c:I}))},t),!o&&x&&c.length!==0&&g.createElement(K,{group:x,render:n}),this.renderList(),a&&g.createElement("div",{className:h.classNames(h.uComboBox.listFooter({c:I}),this.props.footerClassName)},a)),this.showLicenseWatermark&&g.createElement(h.WatermarkOverlay,{message:this.licenseMessage}))}renderList(){const s=this.base,e=N.provideLocalizationService(this),{textField:t,dataItemKey:a,listNoDataRender:r,itemRender:l,groupHeaderItemRender:o,virtual:d={skip:0,total:void 0},unstyled:n}=this.props,i=p.getFilteredData(this.props),c=s.getPopupSettings(),u=s.vs,b=d.skip,y=this.props.opened!==void 0?this.props.opened:this.state.opened,I=`translateY(${u.translate}px)`,x=y?this.getFocusedIndex(this.hasDuplicates):void 0,v=this.props.filter!==void 0?this.props.filter:this.state.text,m=p.getItemValue(this.value,t),C=p.isPresent(v)&&v!==m?null:this.value,D=this.props.list||Z,B=n&&n.uComboBox;return g.createElement(D,{id:s.listBoxId,virtual:!!d,show:y,data:i,focusedIndex:x,value:C,textField:t,valueField:a,groupField:this.props.groupField,isMultiColumn:this.props.isMultiColumn,optionsGuid:s.guid,hasDuplicates:this.hasDuplicates,ariaLabel:e.toLanguageString(S.listAriaLabel,S.messages[S.listAriaLabel]),listRef:k=>{u.list=this.base.list=k,this.itemHeight=0},wrapperStyle:this.mobileMode?{}:{maxHeight:c.height},wrapperCssClass:h.classNames(h.uComboBox.listContent({c:B,virtual:d})),listStyle:u.enabled?{transform:I}:void 0,key:"listkey",skip:b,onClick:this.handleItemClick,itemRender:l,groupHeaderItemRender:o,noDataRender:r,onMouseDown:k=>k.preventDefault(),onScroll:this.onScroll,wrapperRef:u.scrollerRef,scroller:this.base.renderScrollElement(),ariaSetSize:d.total})}renderSearchBar(s,e,t){const{tabIndex:a,accessKey:r,disabled:l,title:o,ariaLabelledBy:d,ariaDescribedBy:n,dataItemKey:i,virtual:c={skip:0},unstyled:u,inputAttributes:b}=this.props;p.getFilteredData(this.props);const y=this.props.opened!==void 0?this.props.opened:this.state.opened,I=y?this.getFocusedIndex(this.hasDuplicates):-1;return this._suggested&&!p.areSame(this._valueOnDidUpdate,this.value,i)&&(this._suggested=""),g.createElement(Q,{id:e,readOnly:y&&this.mobileMode,placeholder:t,tabIndex:a,accessKey:r,title:o,value:s+this._suggested,suggestedText:this._suggested,ref:x=>{this._input=x&&x.input},onClick:this.onInputClick,onKeyDown:this.onInputKeyDown,onChange:this.inputOnChange,onFocus:this.base.handleFocus,onBlur:this.handleBlur,disabled:l,expanded:y,owns:this.base.listBoxId,activedescendant:y&&I>=0?`k-${this.base.guid}-item-${I+c.skip+1}`:void 0,role:"combobox",ariaLabelledBy:d,ariaLabel:this.props.ariaLabel,ariaDescribedBy:n,ariaRequired:this.required,render:this.props.valueRender,ariaControls:y?this.base.listBoxId:void 0,unstyled:u,inputAttributes:b})}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&&(!p.isPresent(t)&&!p.isPresent(s)||p.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:a,virtual:r={skip:0},focusedItemIndex:l=p.itemIndexStartsWith,skipDisabledItems:o}=this.props,d=p.getFilteredData(this.props),n=this.props.filter?this.props.filter:this.state.text;return s&&this.navigationIndex!==void 0?this.navigationIndex:p.isPresent(e)&&n===void 0?d.findIndex(i=>p.areSame(i,e,a)):n?l(d,n,t):o&&t&&!n&&r.skip===0?d.findIndex(i=>!i.disabled):r.skip===0?0:-1}suggestValue(s){const{data:e,textField:t}=this.props;this._suggested=p.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})}};F.displayName="ComboBox",F.propTypes={...T.propTypes,size:f.oneOf(["small","medium","large"]),rounded:f.oneOf(["small","medium","large","full","none"]),fillMode:f.oneOf(["solid","flat","outline"]),dataItemKey:f.string,groupField:f.string,isMultiColumn:f.bool,suggest:f.bool,placeholder:f.string,title:f.string,allowCustom:f.bool,ignoreCase:f.bool,clearButton:f.bool,iconClassName:f.string,svgIcon:h.svgIconPropType,validationMessage:f.string,required:f.bool,id:f.string,ariaLabelledBy:f.string,ariaLabel:f.string,ariaDescribedBy:f.string,list:f.any,valueRender:f.func,skipDisabledItems:f.bool,inputAttributes:f.object},F.defaultProps={...T.defaultProps,size:void 0,rounded:void 0,fillMode:void 0,allowCustom:!1,ignoreCase:!1,clearButton:!0,required:!1,isMultiColumn:!1,skipDisabledItems:!0,prefix:void 0,suffix:void 0};let M=F;const q=h.createPropsContext(),A=h.withIdHOC(h.withPropsContext(q,h.withUnstyledHOC(h.withAdaptiveModeContext(M))));A.displayName="KendoReactComboBox";exports.ComboBox=A;exports.ComboBoxPropsContext=q;exports.ComboBoxWithoutContext=M;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("react"),b=require("prop-types"),T=require("../common/DropDownBase.js"),h=require("@progress/kendo-react-common"),J=require("@progress/kendo-react-labels"),p=require("../common/utils.js"),Q=require("../common/SearchBar.js"),X=require("../common/ListContainer.js"),Z=require("../common/List.js"),ee=require("../common/ListFilter.js"),K=require("../common/GroupStickyHeader.js"),L=require("../package-metadata.js"),te=require("../common/ClearButton.js"),se=require("@progress/kendo-react-buttons"),ie=require("@progress/kendo-svg-icons"),S=require("../messages/index.js"),N=require("@progress/kendo-react-intl"),oe=require("@progress/kendo-react-layout"),R=require("../common/withCustomComponent.js"),ae=require("../common/AdaptiveMode.js");function ne(w){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(w){for(const e in w)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(w,e);Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:()=>w[e]})}}return s.default=w,Object.freeze(s)}const g=ne(Y),le="Please enter a valid value!",F=class F extends g.Component{constructor(s){super(s),this.state={},this.base=new T(this),this._element=null,this._suggested="",this._skipBlur=!1,this._input=null,this._adaptiveFilterInput=null,this._skipFocus=!1,this.itemHeight=0,this.duplicates=[],this.hasDuplicates=!1,this.scrollToFocused=!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 n=this.props.data;this.duplicates=p.getPlainDataDuplicates(n),this.hasDuplicates=this.duplicates.length>0}},this.handleKendoPasteValue=e=>{const{data:t,textField:n,allowCustom:r}=this.props;if(!t)return;const l=e!=null?String(e):"",o=p.getItemIndexByText(t,l,n,!1,!0),d=o!==-1;let a=null;if(d?a=t[o]:r&&(a=n?{[n]:l}:l),a===null)return;const i=this.base.initState();i.syntheticEvent={target:this._element,currentTarget:this._element,nativeEvent:new Event("change",{bubbles:!0})},this.state.text!==void 0&&(i.data.text=void 0),this.triggerOnChange(a,i),this.applyState(i)},this.handleItemSelect=(e,t)=>{const{virtual:n,dataItemKey:r}=this.props,l=p.getFilteredData(this.props),o=n?n.skip:0,d=l[e-o],a=this.hasDuplicates||!p.areSame(d,this.value,r);this.triggerOnChange(d,t),this.state.text!==void 0&&(t.data.text=void 0),a&&this.base.triggerPageChangeCornerItems(d,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=>{this._skipFocus=!0;const{skipDisabledItems:t,textField:n}=this.props,r=p.getFilteredData(this.props),l=this.getFocusedIndex(),o=this.getCurrentValueDisabledStatus(n,r,l),d=this.props.opened!==void 0?this.props.opened:this.state.opened,a=this.base.initState();if(a.syntheticEvent=e,!t&&n&&o&&this.clearValueOnToggleBtnClick(e),this.base.togglePopup(a),!d&&this.mobileMode){const i=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text||null;this.base.filterChanged(i,a)}this.applyState(a),setTimeout(()=>{this._skipFocus=!1},300)},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=p.getItemValue(this.value,this.props.textField),n=p.isPresent(e)?e:t;return g.createElement(ee,{value:n,ref:r=>{this._adaptiveFilterInput=r&&r.element},onChange:this.handleMobileFilterChange,onKeyDown:this.onInputKeyDown,size:"large",rounded:this.props.rounded,fillMode:this.props.fillMode,placeholder:this.props.placeholder})},this.listContainerContent=()=>{const{header:e,footer:t,size:n,groupStickyHeaderItemRender:r,groupField:l,list:o,unstyled:d,virtual:a}=this.props,i=p.getFilteredData(this.props),c=d&&d.uComboBox;let{group:u}=this.state;return u===void 0&&l!==void 0&&(u=p.getItemValue(i[0],l)),g.createElement("div",{className:h.classNames(h.uComboBox.list({c,list:o,size:"large",tableSize:n,virtual:a}))},e&&g.createElement("div",{className:h.classNames(h.uComboBox.listHeader({c}))},e),!o&&u&&i.length!==0&&g.createElement(K,{group:u,render:r}),this.renderList(),t&&g.createElement("div",{className:h.classNames(h.uComboBox.listFooter({c}),this.props.footerClassName)},t))},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:n}=this.base;t.scrollHandler(e);const{groupField:r}=this.props;this.props.onListScroll&&this.props.onListScroll(e);let l=p.getFilteredData(this.props);if(!r||!l.length)return;const o=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:n?n.children[0].offsetHeight:0),a=e.target.scrollTop-t.skip*o;l=this.base.getGroupedDataModernMode(l,r);let i=l[0][r];for(let c=1;c<l.length&&!(o*c>a);c++)l[c]&&l[c][r]&&(i=l[c][r]);i!==this.state.group&&(this.setState({group:i}),this.props.onGroupScroll&&this.props.onGroupScroll.call(void 0,{group:i}))},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:n}=this.props,r=p.getFilteredData(this.props),l=this.getFocusedIndex(),d=!(l===-1)&&this.getCurrentValueDisabledStatus(n,r,l);t.data.focused=!1,t.events.push({type:"onBlur"}),t.syntheticEvent=e,n&&d&&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,n=this.props.adaptiveFilter!==void 0?this.props.adaptiveFilter:this.state.text||null;if(!t&&this.mobileMode){const r=this.base.initState();r.syntheticEvent=e,this.base.togglePopup(r),this.base.filterChanged(n,r),this.applyState(r)}},this.onInputKeyDown=e=>{const{skipDisabledItems:t,textField:n,dataItemKey:r,groupField:l}=this.props,o=p.getFilteredData(this.props),d=this.value,a=Math.max(0,o.findIndex(v=>p.areSame(v,d,r))),i=e.keyCode,c=this.props.opened!==void 0?this.props.opened:this.state.opened,u=this.base.initState();if(u.syntheticEvent=e,!e.altKey&&(i===h.Keys.up||i===h.Keys.down)){if(e.preventDefault(),l!==""&&n)if(!this.props.skipDisabledItems&&c)this.onNavigate(u,i);else{let v=0;if(i===h.Keys.down||i===h.Keys.right){const m=o.slice(a+1<o.length?a+1:a).find(C=>!C.disabled);v=m&&o.indexOf(m)}else if(i===h.Keys.up||i===h.Keys.left){let m;if(a===0)m=o,v=o.findIndex(C=>!C.disabled);else{m=o.slice(0,a);let C=m.pop();for(;C&&C.disabled;)C=m.pop();v=C&&o.indexOf(C)}}if(v!==void 0){const m=v-a;this.onNavigate(u,i,m)}else v===void 0&&a===o.length-1&&this.onNavigate(u,i)}else if(!this.props.skipDisabledItems&&c)this.onNavigate(u,i);else{let v=null;if(i===h.Keys.down||i===h.Keys.right)v=o.slice(a+1).find(m=>!m.disabled);else if(i===h.Keys.up||i===h.Keys.left){const m=o.slice(0,a);for(v=m.pop();v&&v.disabled;)v=m.pop()}if(v){const m=v.id-a-1;this.onNavigate(u,i,m)}else this.onNavigate(u,i)}this.applyState(u)}const f=()=>{e.preventDefault(),this.base.togglePopup(u),this.applyState(u)},y=this.getFocusedIndex(),I=y===-1,x=!I&&this.getCurrentValueDisabledStatus(n,o,y);c?i===h.Keys.pageUp?(e.preventDefault(),this.base.scrollPopupByPageSize(-1)):i===h.Keys.pageDown?(e.preventDefault(),this.base.scrollPopupByPageSize(1)):e.altKey&&i===h.Keys.up?f():i===h.Keys.enter?(e.preventDefault(),(n&&!I&&e.currentTarget.value?o[y][n]:void 0)?!t&&n&&x?this.clearValueOnEnterOrEsc(e):x||this.applyValueOnEnter(e.currentTarget.value,u):this.applyValueOnEnter(e.currentTarget.value,u)):i===h.Keys.esc&&(!t&&n&&x&&this.clearValueOnEnterOrEsc(e),this.applyValueOnRejectSuggestions(e.currentTarget.value,u)):!c&&i===h.Keys.esc?this.clearValueOnEnterOrEsc(e):e.altKey&&i===h.Keys.down&&f()},this.inputOnChange=e=>{const t=this.base.initState();t.syntheticEvent=e;const n=this.props.opened!==void 0?this.props.opened:this.state.opened,r=e.currentTarget,l=r.value;if(this.props.suggest){const o=r.selectionEnd===l.length;let d=this.props.filter!==void 0?this.props.filter:this.state.text;p.isPresent(d)||(d=p.getItemValue(this.value,this.props.textField)||"");const a=d&&d===l,i=d&&d.length>l.length;a||i||!o?this._suggested="":this.suggestValue(l)}this.props.filter===void 0&&(t.data.text=l),this.state.focusedItem!==void 0&&(t.data.focusedItem=void 0),n?this.scrollToFocused=!0:this.base.togglePopup(t),this.base.filterChanged(l,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._skipFocus=!0,this.focus(),setTimeout(()=>{this._skipFocus=!1},300)},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||le)},this.handleFocus=e=>{if(this._skipFocus)return;const t=this.base.initState();t.syntheticEvent=e,this.mobileMode&&!this._skipFocus&&(this._skipFocus=!0,this.base.togglePopup(t),this.applyState(t),setTimeout(()=>{this._skipFocus=!1},300)),this.base.handleFocus(e)},this.showLicenseWatermark=!h.validatePackage(L.packageMetadata,{component:"ComboBox"}),this.licenseMessage=h.getLicenseMessage(L.packageMetadata)}get _inputId(){return this.props.id}get document(){if(h.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=p.getFilteredData(this.props),t=this.value;return e.findIndex(n=>p.areSame(n,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:F.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:F.defaultProps.required}componentDidUpdate(s,e){var f,y;const{dataItemKey:t,virtual:n,groupField:r="",textField:l}=this.props,o=p.getFilteredData(this.props),d=s.virtual?s.virtual.total:0,a=this.props.opened!==void 0?this.props.opened:this.state.opened,i=s.opened!==void 0?s.opened:e.opened;s.data!==o&&this.checkForDuplicatePlainTextRecords();const c=!i&&a,u=this.value;if(this._valueOnDidUpdate=u,this.base.didUpdate(),n&&n.total!==d)this.base.vs.calcScrollElementHeight(),this.base.vs.reset();else{const I=s.value!==void 0?s.value:e.value;let x=this.hasDuplicates?this.navigationIndex||0:o.findIndex(m=>p.areSame(m,u,t));l&&u&&(x=(f=this.base.getGroupedDataModernMode(o,r))==null?void 0:f.map(m=>m[l]).indexOf(u[l]));const v=!p.areSame(I,u,t);if(c&&n?this.base.scrollToVirtualItem(n,x):c&&!n?(this.onPopupOpened(),o&&o.length!==0&&this.base.resetGroupStickyHeader(o[0][r],this),this.base.scrollToItem(x)):(this.hasDuplicates||a&&i&&u&&v)&&this.base.scrollToItem(x),a&&i&&this.scrollToFocused){const m=(y=this.props.filter?this.props.filter:this.state.text)!=null?y:"";if(m){const{focusedItemIndex:C=p.itemIndexStartsWith}=this.props,D=C(o,m,l);this.base.scrollToItem(D)}else this.base.scrollToItem(0)}}this.scrollToFocused=!1,c&&this._input&&this._input.focus(),this.setValidity()}componentDidMount(){var e;this.observerResize=h.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),this.checkForDuplicatePlainTextRecords();const s=this.props.name||this.props.id;this.KendoPasteSubscription=h.subscribeToKendoPaste(this._element,{fieldName:s,onValueChange:t=>{this.handleKendoPasteValue(t)}})}componentWillUnmount(){var s,e;(s=this.document)!=null&&s.body&&this.observerResize&&this.observerResize.disconnect(),(e=this.KendoPasteSubscription)==null||e.unsubscribe()}render(){const s=N.provideLocalizationService(this),e=s.toLanguageString(S.comboArrowBtnAriaLabelExpand,S.messages[S.comboArrowBtnAriaLabelExpand]),t=s.toLanguageString(S.comboArrowBtnAriaLabelCollapse,S.messages[S.comboArrowBtnAriaLabelCollapse]),{dir:n,disabled:r,clearButton:l=F.defaultProps.clearButton,label:o,textField:d,className:a,style:i,loading:c,iconClassName:u,virtual:f,size:y,rounded:I,fillMode:x,opened:v=this.state.opened,placeholder:m,svgIcon:C,unstyled:D}=this.props,B=!this.validityStyles||this.validity.valid,k=this.props.filter!==void 0?this.props.filter:this.state.text,z=p.getItemValue(this.value,d),M=p.isPresent(k)?k:z,H=l&&(!!M||p.isPresent(this.value)),O=this.base.vs,P=this.props.id||this._inputId,E=D&&D.uComboBox;O.enabled=f!==void 0,f!==void 0&&(O.skip=f.skip,O.total=f.total,O.pageSize=f.pageSize);const[W,j]=R(this.props.prefix||g.Fragment),[U,G]=R(this.props.suffix||g.Fragment),_=g.createElement(g.Fragment,null,g.createElement("span",{className:h.classNames(h.uComboBox.wrapper({c:E,size:y,rounded:I,fillMode:x,disabled:r,invalid:!B,loading:c,required:this.required}),a),ref:this.componentRef,style:o?{...i,width:void 0}:i,dir:n,onFocus:this.handleFocus},this.props.prefix&&g.createElement(W,{...j}),this.renderSearchBar(M||"",P,m),H&&!c&&g.createElement(te,{onClick:this.clearButtonClick,key:"clearbutton"}),c&&g.createElement(h.IconWrap,{className:h.classNames(h.uComboBox.loadingIcon({c:E})),name:"loading",key:"loading"}),this.props.suffix&&g.createElement(U,{...G}),g.createElement(se.Button,{tabIndex:-1,type:"button","aria-label":v?t:e,svgIcon:C||(u?void 0:ie.chevronDownIcon),iconClass:u,size:y,fillMode:x,className:h.classNames(h.uComboBox.inputButton({c:E})),onClick:this.toggleBtnClick,onMouseDown:$=>$.preventDefault()}),!this.mobileMode&&this.renderListContainer()),this.mobileMode&&this.renderAdaptiveListContainer());return o?g.createElement(J.FloatingLabel,{label:o,editorId:P,editorValue:M,editorValid:B,editorDisabled:r,style:{width:i?i.width:void 0},children:_,unstyled:D}):_}onNavigate(s,e,t){const{virtual:n={skip:0},textField:r}=this.props,l=p.getFilteredData(this.props),o=this.props.filter?this.props.filter:this.state.text;let d=-1,a;const i=this.base.vs,c=this.value;this._suggested="";const u=this.hasDuplicates&&this.duplicates.indexOf(c)!==-1;if(d=this.getFocusedIndex(u),d!==-1&&(!p.isPresent(c)||o&&o!==p.getItemValue(c,r)))this.handleItemSelect(d,s);else if(o==="")this.handleItemSelect(0,s);else{const f=n.skip+d;a=this.base.navigation.navigate({keyCode:e,current:f,max:(i.enabled?i.total:l.length)-1,min:0,skipItems:t||void 0}),a!==void 0&&this.handleItemSelect(a,s)}this.navigationIndex=a}getCurrentValueDisabledStatus(s,e,t){return s&&e&&e[t]&&e[t].disabled}applyValueOnEnter(s,e){const{textField:t,allowCustom:n,ignoreCase:r}=this.props,l=p.getFilteredData(this.props),o=this.props.opened!==void 0?this.props.opened:this.state.opened,a=p.getItemValue(this.value,t)===s?this.index:p.getItemIndexByText(l,s,t,!1,r),i=a!==-1;let c;if(this._suggested="",i)c=l[a];else if(n)c=t!==void 0?{[t]:s}:s;else return this.selectFocusedItem(s,e);this.triggerOnChange(c,e),o&&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:n,ignoreCase:r}=this.props,l=p.getFilteredData(this.props),o=this.props.opened!==void 0?this.props.opened:this.state.opened,d=p.getItemValue(this.value,t);if(this._suggested="",s===d||s===""&&!p.isPresent(d))return this.closeOpenedApplyStateNonMobileMode(e,o),this.applyState(e);const a=p.getItemIndexByText(l,s,t,!0,r),i=a!==-1;let c=null;i?c=l[a]:n&&(c=s?t?{[t]:s}:s:null),this.triggerOnChange(c,e),this.state.text!==void 0&&(e.data.text=void 0,this.base.filterChanged("",e)),this.closeOpenedApplyStateNonMobileMode(e,o),this.applyState(e)}selectFocusedItem(s,e){const t=this.props.opened!==void 0?this.props.opened:this.state.opened,{textField:n,virtual:r={skip:0},focusedItemIndex:l=p.itemIndexStartsWith}=this.props,o=p.getFilteredData(this.props),d=r.skip,a=s===""&&d===0?0:l(o,s,n);return a!==-1?this.handleItemSelect(a+d,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,{groupField:e,adaptiveTitle:t=this.props.label,adaptiveSubtitle:n}=this.props,r=p.getFilteredData(this.props),l=this.props.opened!==void 0?this.props.opened:this.state.opened;let{group:o}=this.state;o===void 0&&e!==void 0&&(o=p.getItemValue(r[0],e));const d={title:t||this.props.label,subTitle:n,expand:l,onClose:a=>this.toggleBtnClick(a),windowWidth:s,mobileFilter:this.renderMobileListFilter()};return g.createElement(ae.AdaptiveMode,{...d},g.createElement(oe.ActionSheetContent,null,g.createElement("div",{className:"k-list-container"},this.listContainerContent())))}renderListContainer(){const s=this.base,{dir:e,header:t,footer:n,groupField:r,size:l,list:o,virtual:d,groupStickyHeaderItemRender:a,unstyled:i}=this.props,c=p.getFilteredData(this.props),u=this.props.opened!==void 0?this.props.opened:this.state.opened,f=s.getPopupSettings(),y=f.width!==void 0?f.width:s.popupWidth,I=i&&i.uComboBox;let{group:x}=this.state;return x===void 0&&r!==void 0&&(x=p.getItemValue(c[0],r)),g.createElement(X,{width:y,popupSettings:{...f,anchor:f.anchor||this.element,show:u,popupClass:h.classNames(f.popupClass,h.uComboBox.listContainer({c:I,popup:!0}))},dir:e!==void 0?e:this.base.dirCalculated,itemsCount:[c.length]},g.createElement("div",{className:h.classNames(h.uComboBox.list({c:I,list:o,size:l,tableSize:l,virtual:d}))},t&&g.createElement("div",{className:h.classNames(h.uComboBox.listHeader({c:I}))},t),!o&&x&&c.length!==0&&g.createElement(K,{group:x,render:a}),this.renderList(),n&&g.createElement("div",{className:h.classNames(h.uComboBox.listFooter({c:I}),this.props.footerClassName)},n)),this.showLicenseWatermark&&g.createElement(h.WatermarkOverlay,{message:this.licenseMessage}))}renderList(){const s=this.base,e=N.provideLocalizationService(this),{textField:t,dataItemKey:n,listNoDataRender:r,itemRender:l,groupHeaderItemRender:o,virtual:d={skip:0,total:void 0},unstyled:a}=this.props,i=p.getFilteredData(this.props),c=s.getPopupSettings(),u=s.vs,f=d.skip,y=this.props.opened!==void 0?this.props.opened:this.state.opened,I=`translateY(${u.translate}px)`,x=y?this.getFocusedIndex(this.hasDuplicates):void 0,v=this.props.filter!==void 0?this.props.filter:this.state.text,m=p.getItemValue(this.value,t),C=p.isPresent(v)&&v!==m?null:this.value,D=this.props.list||Z,B=a&&a.uComboBox;return g.createElement(D,{id:s.listBoxId,virtual:!!d,show:y,data:i,focusedIndex:x,value:C,textField:t,valueField:n,groupField:this.props.groupField,isMultiColumn:this.props.isMultiColumn,optionsGuid:s.guid,hasDuplicates:this.hasDuplicates,ariaLabel:e.toLanguageString(S.listAriaLabel,S.messages[S.listAriaLabel]),listRef:k=>{u.list=this.base.list=k,this.itemHeight=0},wrapperStyle:this.mobileMode?{}:{maxHeight:c.height},wrapperCssClass:h.classNames(h.uComboBox.listContent({c:B,virtual:d})),listStyle:u.enabled?{transform:I}:void 0,key:"listkey",skip:f,onClick:this.handleItemClick,itemRender:l,groupHeaderItemRender:o,noDataRender:r,onMouseDown:k=>k.preventDefault(),onScroll:this.onScroll,wrapperRef:u.scrollerRef,scroller:this.base.renderScrollElement(),ariaSetSize:d.total})}renderSearchBar(s,e,t){const{tabIndex:n,accessKey:r,disabled:l,title:o,ariaLabelledBy:d,ariaDescribedBy:a,dataItemKey:i,virtual:c={skip:0},unstyled:u,inputAttributes:f}=this.props;p.getFilteredData(this.props);const y=this.props.opened!==void 0?this.props.opened:this.state.opened,I=y?this.getFocusedIndex(this.hasDuplicates):-1;return this._suggested&&!p.areSame(this._valueOnDidUpdate,this.value,i)&&(this._suggested=""),g.createElement(Q,{id:e,readOnly:y&&this.mobileMode,placeholder:t,tabIndex:n,accessKey:r,title:o,value:s+this._suggested,suggestedText:this._suggested,ref:x=>{this._input=x&&x.input},onClick:this.onInputClick,onKeyDown:this.onInputKeyDown,onChange:this.inputOnChange,onFocus:this.base.handleFocus,onBlur:this.handleBlur,disabled:l,expanded:y,owns:this.base.listBoxId,activedescendant:y&&I>=0?`k-${this.base.guid}-item-${I+c.skip+1}`:void 0,role:"combobox",ariaLabelledBy:d,ariaLabel:this.props.ariaLabel,ariaDescribedBy:a,ariaRequired:this.required,render:this.props.valueRender,ariaControls:y?this.base.listBoxId:void 0,unstyled:u,inputAttributes:f})}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&&(!p.isPresent(t)&&!p.isPresent(s)||p.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:n,virtual:r={skip:0},focusedItemIndex:l=p.itemIndexStartsWith,skipDisabledItems:o}=this.props,d=p.getFilteredData(this.props),a=this.props.filter?this.props.filter:this.state.text;return s&&this.navigationIndex!==void 0?this.navigationIndex:p.isPresent(e)&&a===void 0?d.findIndex(i=>p.areSame(i,e,n)):a?l(d,a,t):o&&t&&!a&&r.skip===0?d.findIndex(i=>!i.disabled):r.skip===0?0:-1}suggestValue(s){const{data:e,textField:t}=this.props;this._suggested=p.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})}};F.displayName="ComboBox",F.propTypes={...T.propTypes,size:b.oneOf(["small","medium","large"]),rounded:b.oneOf(["small","medium","large","full","none"]),fillMode:b.oneOf(["solid","flat","outline"]),dataItemKey:b.string,groupField:b.string,isMultiColumn:b.bool,suggest:b.bool,placeholder:b.string,title:b.string,allowCustom:b.bool,ignoreCase:b.bool,clearButton:b.bool,iconClassName:b.string,svgIcon:h.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},F.defaultProps={...T.defaultProps,size:void 0,rounded:void 0,fillMode:void 0,allowCustom:!1,ignoreCase:!1,clearButton:!0,required:!1,isMultiColumn:!1,skipDisabledItems:!0,prefix:void 0,suffix:void 0};let V=F;const q=h.createPropsContext(),A=h.withIdHOC(h.withPropsContext(q,h.withUnstyledHOC(h.withAdaptiveModeContext(V))));A.displayName="KendoReactComboBox";exports.ComboBox=A;exports.ComboBoxPropsContext=q;exports.ComboBoxWithoutContext=V;
|