@progress/kendo-react-dropdowns 8.3.0-develop.11 → 8.3.0-develop.13
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 +58 -79
- package/ComboBox/ComboBox.mjs +87 -37
- package/DropDownList/DropDownList.mjs +34 -36
- package/DropDownTree/DropDownTree.mjs +62 -84
- package/MultiSelect/MultiSelect.mjs +34 -24
- package/MultiSelectTree/MultiSelectTree.js +1 -1
- package/MultiSelectTree/MultiSelectTree.mjs +428 -434
- package/common/DropDownBase.mjs +11 -12
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/index.d.mts +2 -4
- package/index.d.ts +2 -4
- package/package-metadata.mjs +1 -1
- package/package.json +9 -9
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react"),f=require("prop-types"),q=require("../common/SearchBar.js"),E=require("../common/ListContainer.js"),T=require("../common/List.js"),k=require("../common/DropDownBase.js"),N=require("../common/GroupStickyHeader.js"),g=require("../common/utils.js"),l=require("@progress/kendo-react-common"),L=require("@progress/kendo-react-labels"),R=require("../package-metadata.js"),H=require("../common/ClearButton.js"),F=require("../common/withCustomComponent.js");function z(x){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(x){for(const e in x)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(x,e);Object.defineProperty(a,e,s.get?s:{enumerable:!0,get:()=>x[e]})}}return a.default=x,Object.freeze(a)}const I=z(B),A="Please enter a valid value!",{sizeMap:_,roundedMap:G}=l.kendoThemeMaps,b=class b extends I.Component{constructor(a){super(a),this.state={},this.base=new k(this),this._element=null,this._suggested="",this._input=null,this._isScrolling=!1,this.itemHeight=0,this.focus=()=>{this._input&&this._input.focus()},this.handleItemSelect=(e,s)=>{const i=g.getFilteredData(this.props),t=g.getItemValue(i[e],this.props.textField);this.triggerOnChange(t,s)},this.itemFocus=(e,s)=>{const{textField:i}=this.props,o=g.getFilteredData(this.props)[e];g.areSame(this.state.focusedItem,o,i)||(s.data.focusedItem=o)},this.togglePopup=e=>{this.base.togglePopup(e)},this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||A)},this.onScroll=e=>{this._isScrolling=!0;const{list:s}=this.base,{groupField:i}=this.props;let t=g.getFilteredData(this.props);if(!i||!t.length)return;const o=this.itemHeight||(s?s.children[0].offsetHeight:0),p=e.target.scrollTop;i&&(t=this.base.getGroupedDataModernMode(t,i));let n=t[0][i];for(let r=1;r<t.length&&!(o*r>p);r++)t[r]&&t[r][i]&&(n=t[r][i]);n!==this.state.group&&this.setState({group:n})},this.handleItemClick=(e,s)=>{this.base.handleItemClick(e,s),this._valueDuringOnChange=void 0},this.onChangeHandler=e=>{const i=this.base.initState(),t=e.currentTarget,o=t.value,d=t.selectionEnd===o.length;i.syntheticEvent=e;const p=this._suggested,n=this.value,r=n&&n.substring(0,n.length-p.length),v=r&&r===o,h=r&&r.length>o.length,{suggest:m}=this.props,u=this.props.opened!==void 0?this.props.opened:this.state.opened;if(m!==void 0&&m!==!1){v||h||!d?this._suggested="":this.suggestValue(o);const c=o+this._suggested,y={userInput:o,value:this._suggested};this.triggerOnChange(c,i,{suggestion:y})}else this._suggested="",this.triggerOnChange(o,i);(!u&&o||u&&!o)&&this.togglePopup(i),i.data.focusedItem=void 0,this.applyState(i),this.setState({group:void 0})},this.clearButtonClick=e=>{const i=this.base.initState(),t=this.props.opened!==void 0?this.props.opened:this.state.opened;i.syntheticEvent=e;const o="";this._suggested="",this.triggerOnChange(o,i),this.state.focusedItem!==void 0&&(i.data.focusedItem=void 0),t&&this.togglePopup(i),this.applyState(i)},this.onInputKeyDown=e=>{const{skipDisabledItems:s,groupField:i,textField:t}=this.props,o=g.getFilteredData(this.props);this._isScrolling&&(this._isScrolling=!1);const d=this.focusedIndex(),p=o[d],n=e.keyCode,r=e.altKey,v=this.props.opened!==void 0?this.props.opened:this.state.opened,h=this.base.initState();h.syntheticEvent=e;const m=()=>{v&&e.preventDefault()};if(r&&n===l.Keys.down)this.setState({opened:!0});else if(r&&n===l.Keys.up)this.setState({opened:!1});else if(v&&n===l.Keys.pageUp)m(),this.base.scrollPopupByPageSize(-1);else if(v&&n===l.Keys.pageDown)m(),this.base.scrollPopupByPageSize(1);else if(v&&(n===l.Keys.enter||n===l.Keys.esc))m(),s===!1&&p&&p.disabled?(v&&this.togglePopup(h),this.applyState(h)):this.applyInputValue(e.currentTarget.value,h,e.keyCode);else if(!v&&n===l.Keys.esc){const u="";this._suggested="",this.triggerOnChange(u,h),this.state.focusedItem!==void 0&&(h.data.focusedItem=void 0),this.applyState(h)}else if(n===l.Keys.up||n===l.Keys.down){if(i!==""&&t)if(!this.props.skipDisabledItems&&v)this.onNavigate(h,n);else{let u=0;if(n===l.Keys.down||n===l.Keys.right){const c=o.slice(d+1).find(y=>!y.disabled&&y[t]);u=c&&o.findIndex(y=>y[t]===c[t])}else if(n===l.Keys.up||n===l.Keys.left){let c;if(d===-1)c=o,u=o.findIndex(y=>!y.disabled&&y[t]);else{c=o.slice(0,d);let y=c.pop();for(;y&&y.disabled;)y=c.pop();u=y&&o.findIndex(C=>C[t]===y[t])}}if(u!==void 0){const c=u-d;this.onNavigate(h,n,c)}else u===void 0&&o.findIndex(c=>c[t])===o.length-1&&this.onNavigate(h,n)}else if(!this.props.skipDisabledItems&&v)this.onNavigate(h,n);else{let u=null;if(n===l.Keys.down||n===l.Keys.right)u=o.slice(d+1).find(c=>!c.disabled);else if(n===l.Keys.up||n===l.Keys.left){const c=o.slice(0,d);for(u=c.pop();u&&u.disabled;)u=c.pop()}if(u){const c=u.id-d-1;this.onNavigate(h,n,c)}else this.onNavigate(h,n)}this.applyState(h),m()}},this.handleBlur=e=>{if(this.state.focused){const s=this.base.initState();s.data.focused=!1,s.events.push({type:"onBlur"}),s.syntheticEvent=e,this.applyInputValue(e.currentTarget.value,s)}},l.validatePackage(R.packageMetadata)}get _inputId(){return this.props.id+"-accessibility-id"}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 a=this.props.validationMessage!==void 0,e=!this.required||this.value!=="",s=this.props.valid!==void 0?this.props.valid:e;return{customError:a,valid:s,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:b.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:b.defaultProps.required}componentDidUpdate(a,e){var m;const{groupField:s=""}=this.props,i=g.getFilteredData(this.props),{data:t=[]}=a,o=this.focusedIndex(),d=i[o],p=t!==i,n=d!==void 0&&e.focusedItem!==d,r=this.props.opened!==void 0?this.props.opened:this.state.opened,v=a.opened!==void 0?a.opened:e.opened,h=!v&&r;if(s==="")(r&&(n||p)||h)&&this.base.scrollToItem(o);else if(!this._isScrolling){const u=(m=this.base.getGroupedDataModernMode(i,s))==null?void 0:m.indexOf(d);h&&(i&&i.length!==0&&this.base.resetGroupStickyHeader(i[0][s],this),this.base.scrollToItem(u)),r&&v&&n&&this.base.scrollToItem(u)}this.setValidity()}componentDidMount(){this.base.didMount(),this.setValidity()}render(){const{dir:a,disabled:e,label:s,className:i,style:t,loading:o,suggest:d,size:p,rounded:n,fillMode:r}=this.props,v=!this.validityStyles||this.validity.valid,h=this.base,m=this.value,u=this.props.clearButton!==!1&&!o&&!!m,c=this.props.id||this._inputId,y=this.state.focused;typeof d=="string"&&(this._suggested=d);const[C,K]=F(this.props.prefix||I.Fragment),[V,M]=F(this.props.suffix||I.Fragment),D=I.createElement("span",{className:l.classNames("k-autocomplete k-input",i,{[`k-input-${_[p]||p}`]:p,[`k-rounded-${G[n]||n}`]:n,[`k-input-${r}`]:r,"k-invalid":!v,"k-focus":y&&!e,"k-loading":o,"k-required":this.required,"k-disabled":e}),ref:w=>{this._element=w,h.wrapper=w},style:s?{...t,width:void 0}:t,dir:a},this.props.prefix&&I.createElement(C,{...K}),this.renderSearchBar(m||"",c),o&&I.createElement(l.IconWrap,{className:"k-input-loading-icon",name:"loading"}),u&&!o&&I.createElement(H,{onClick:this.clearButtonClick,key:"clearbutton"}),this.props.suffix&&I.createElement(V,{...M}),this.renderListContainer());return s?I.createElement(L.FloatingLabel,{label:s,editorId:c,editorValue:m,editorValid:v,editorDisabled:e,style:{width:t?t.width:void 0},children:D}):D}onNavigate(a,e,s){const i=this.value,{textField:t,focusedItemIndex:o}=this.props,d=g.getFilteredData(this.props),p=this.state.focusedItem!==void 0?d.findIndex(r=>g.areSame(r,this.state.focusedItem,t)):o?o(d,i,t):d.indexOf(g.getFocusedItem(d,i,t)),n=this.base.navigation.navigate({keyCode:e,current:p,max:d.length-1,min:0,skipItems:s||void 0});n!==void 0&&this.itemFocus(n,a),this.applyState(a)}applyInputValue(a,e,s){const i=this.props.opened!==void 0?this.props.opened:this.state.opened,{textField:t}=this.props,o=g.getFilteredData(this.props),d=this.focusedIndex(),p=o[d];if(this._suggested="",i&&s===l.Keys.enter&&p&&!p.disabled){const n=g.getItemValue(o[this.focusedIndex(a)],t);this.triggerOnChange(n,e)}i&&this.togglePopup(e),this.applyState(e)}renderSearchBar(a,e){const s=this.base,{placeholder:i,tabIndex:t,disabled:o,readonly:d}=this.props,{focused:p}=this.state,n=this.props.opened!==void 0?this.props.opened:this.state.opened;return I.createElement(q,{id:e,placeholder:i,tabIndex:t,accessKey:this.props.accessKey,value:a,suggestedText:this._suggested,focused:p,name:this.props.name,ref:r=>this._input=r&&r.input,onKeyDown:this.onInputKeyDown,onChange:this.onChangeHandler,onFocus:s.handleFocus,onBlur:this.handleBlur,disabled:o,readOnly:d,expanded:n,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})}renderListContainer(){const a=this.base,{dir:e,header:s,footer:i,size:t,groupField:o,list:d,groupStickyHeaderItemRender:p}=this.props,n=g.getFilteredData(this.props),r=a.getPopupSettings(),v=this.props.opened!==void 0?this.props.opened:this.state.opened,h=r.width!==void 0?r.width:a.popupWidth;let{group:m}=this.state;return m===void 0&&o!==void 0&&(m=g.getItemValue(n[0],o)),I.createElement(E,{width:h,popupSettings:{...r,anchor:r.anchor||this.element,show:v,popupClass:l.classNames(r.popupClass,"k-list-container","k-autocomplete-popup")},dir:e!==void 0?e:this.base.dirCalculated,itemsCount:[n.length]},s&&I.createElement("div",{className:"k-list-header"},s),I.createElement("div",{className:l.classNames("k-list",{[`k-list-${_[t]||t}`]:t})},!d&&m&&n.length!==0&&I.createElement(N,{group:m,groupMode:"modern",render:p}),this.renderList()),i&&I.createElement("div",{className:"k-list-footer"},i))}renderList(){const a=this.base,e=a.getPopupSettings(),{textField:s,listNoDataRender:i,itemRender:t,groupHeaderItemRender:o}=this.props,d=g.getFilteredData(this.props),p=this.value,n=this.props.opened!==void 0?this.props.opened:this.state.opened;return I.createElement(T,{id:a.listBoxId,show:n,data:d.slice(),focusedIndex:this.focusedIndex(),value:p,textField:s,valueField:s,highlightSelected:!1,optionsGuid:a.guid,groupField:this.props.groupField,groupMode:"modern",listRef:r=>a.list=r,wrapperStyle:{maxHeight:e.height},wrapperCssClass:"k-list-content",onClick:this.handleItemClick,itemRender:t,groupHeaderItemRender:o,noDataRender:i,onMouseDown:r=>r.preventDefault(),onScroll:this.onScroll})}triggerOnChange(a,e,s){this.value===a&&!s||(e.data.value=a,this._valueDuringOnChange=a,e.events.push({type:"onChange",...s||{}}))}applyState(a){this.base.applyState(a),this._valueDuringOnChange=void 0}suggestValue(a){if(this._suggested="",a){const{textField:e}=this.props,s=g.getFilteredData(this.props),i=s[g.itemIndexStartsWith(s,a,e)];if(i){const t=g.getItemValue(i,e);a.toLowerCase()!==t.toLowerCase()&&(this._suggested=t.substring(a.length))}}}focusedIndex(a){const{textField:e,focusedItemIndex:s,skipDisabledItems:i}=this.props,t=g.getFilteredData(this.props),o=a!==void 0?a:this.value;if(this.state.focusedItem!==void 0)return t.findIndex(d=>g.areSame(d,this.state.focusedItem,e));if(s)return s(t,o,e);{const d=t.indexOf(g.getFocusedItem(t,o,e));return i&&e&&d===-1?t.findIndex(p=>!p.disabled&&p[e]):Math.max(0,d)}}};b.displayName="AutoComplete",b.propTypes={...k.basicPropTypes,size:f.oneOf([null,"small","medium","large"]),rounded:f.oneOf([null,"small","medium","large","full"]),fillMode:f.oneOf([null,"solid","flat","outline"]),groupField:f.string,suggest:f.oneOfType([f.bool,f.string]),placeholder:f.string,value:f.string,defaultValue:f.string,validationMessage:f.string,required:f.bool,readonly:f.bool,clearButton:f.bool,valueRender:f.func,id:f.string,ariaLabelledBy:f.string,ariaDescribedBy:f.string,list:f.any,skipDisabledItems:f.bool},b.defaultProps={...k.defaultProps,size:"medium",rounded:"medium",fillMode:"solid",skipDisabledItems:!0,prefix:void 0,suffix:void 0};let S=b;const O=l.createPropsContext(),P=l.withIdHOC(l.withPropsContext(O,S));P.displayName="KendoReactAutoComplete";exports.AutoComplete=P;exports.AutoCompletePropsContext=O;exports.AutoCompleteWithoutContext=S;
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const B=require("react"),f=require("prop-types"),q=require("../common/SearchBar.js"),E=require("../common/ListContainer.js"),T=require("../common/List.js"),k=require("../common/DropDownBase.js"),N=require("../common/GroupStickyHeader.js"),g=require("../common/utils.js"),p=require("@progress/kendo-react-common"),L=require("@progress/kendo-react-labels"),R=require("../package-metadata.js"),H=require("../common/ClearButton.js"),F=require("../common/withCustomComponent.js");function z(x){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(x){for(const e in x)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(x,e);Object.defineProperty(a,e,s.get?s:{enumerable:!0,get:()=>x[e]})}}return a.default=x,Object.freeze(a)}const I=z(B),A="Please enter a valid value!",{sizeMap:_,roundedMap:G}=p.kendoThemeMaps,b=class b extends I.Component{constructor(a){super(a),this.state={},this.base=new k(this),this._element=null,this._suggested="",this._input=null,this._isScrolling=!1,this.itemHeight=0,this.focus=()=>{this._input&&this._input.focus()},this.handleItemSelect=(e,s)=>{const i=g.getFilteredData(this.props),t=g.getItemValue(i[e],this.props.textField);this.triggerOnChange(t,s)},this.itemFocus=(e,s)=>{const{textField:i}=this.props,o=g.getFilteredData(this.props)[e];g.areSame(this.state.focusedItem,o,i)||(s.data.focusedItem=o)},this.togglePopup=e=>{this.base.togglePopup(e)},this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||A)},this.onScroll=e=>{this._isScrolling=!0;const{list:s}=this.base,{groupField:i}=this.props;let t=g.getFilteredData(this.props);if(!i||!t.length)return;const o=this.itemHeight||(s?s.children[0].offsetHeight:0),l=e.target.scrollTop;i&&(t=this.base.getGroupedDataModernMode(t,i));let n=t[0][i];for(let d=1;d<t.length&&!(o*d>l);d++)t[d]&&t[d][i]&&(n=t[d][i]);n!==this.state.group&&this.setState({group:n})},this.handleItemClick=(e,s)=>{this.base.handleItemClick(e,s),this._valueDuringOnChange=void 0},this.onChangeHandler=e=>{const i=this.base.initState(),t=e.currentTarget,o=t.value,r=t.selectionEnd===o.length;i.syntheticEvent=e;const l=this._suggested,n=this.value,d=n&&n.substring(0,n.length-l.length),v=d&&d===o,h=d&&d.length>o.length,{suggest:m}=this.props,u=this.props.opened!==void 0?this.props.opened:this.state.opened;if(m!==void 0&&m!==!1){v||h||!r?this._suggested="":this.suggestValue(o);const c=o+this._suggested,y={userInput:o,value:this._suggested};this.triggerOnChange(c,i,{suggestion:y})}else this._suggested="",this.triggerOnChange(o,i);(!u&&o||u&&!o)&&this.togglePopup(i),i.data.focusedItem=void 0,this.applyState(i),this.setState({group:void 0})},this.clearButtonClick=e=>{const i=this.base.initState(),t=this.props.opened!==void 0?this.props.opened:this.state.opened;i.syntheticEvent=e;const o="";this._suggested="",this.triggerOnChange(o,i),this.state.focusedItem!==void 0&&(i.data.focusedItem=void 0),t&&this.togglePopup(i),this.applyState(i)},this.onInputKeyDown=e=>{const{skipDisabledItems:s,groupField:i,textField:t}=this.props,o=g.getFilteredData(this.props);this._isScrolling&&(this._isScrolling=!1);const r=this.focusedIndex(),l=o[r],n=e.keyCode,d=e.altKey,v=this.props.opened!==void 0?this.props.opened:this.state.opened,h=this.base.initState();h.syntheticEvent=e;const m=()=>{v&&e.preventDefault()};if(d&&n===p.Keys.down)this.setState({opened:!0});else if(d&&n===p.Keys.up)this.setState({opened:!1});else if(v&&n===p.Keys.pageUp)m(),this.base.scrollPopupByPageSize(-1);else if(v&&n===p.Keys.pageDown)m(),this.base.scrollPopupByPageSize(1);else if(v&&(n===p.Keys.enter||n===p.Keys.esc))m(),s===!1&&l&&l.disabled?(v&&this.togglePopup(h),this.applyState(h)):this.applyInputValue(e.currentTarget.value,h,e.keyCode);else if(!v&&n===p.Keys.esc){const u="";this._suggested="",this.triggerOnChange(u,h),this.state.focusedItem!==void 0&&(h.data.focusedItem=void 0),this.applyState(h)}else if(n===p.Keys.up||n===p.Keys.down){if(i!==""&&t)if(!this.props.skipDisabledItems&&v)this.onNavigate(h,n);else{let u=0;if(n===p.Keys.down||n===p.Keys.right){const c=o.slice(r+1).find(y=>!y.disabled&&y[t]);u=c&&o.findIndex(y=>y[t]===c[t])}else if(n===p.Keys.up||n===p.Keys.left){let c;if(r===-1)c=o,u=o.findIndex(y=>!y.disabled&&y[t]);else{c=o.slice(0,r);let y=c.pop();for(;y&&y.disabled;)y=c.pop();u=y&&o.findIndex(C=>C[t]===y[t])}}if(u!==void 0){const c=u-r;this.onNavigate(h,n,c)}else u===void 0&&o.findIndex(c=>c[t])===o.length-1&&this.onNavigate(h,n)}else if(!this.props.skipDisabledItems&&v)this.onNavigate(h,n);else{let u=null;if(n===p.Keys.down||n===p.Keys.right)u=o.slice(r+1).find(c=>!c.disabled);else if(n===p.Keys.up||n===p.Keys.left){const c=o.slice(0,r);for(u=c.pop();u&&u.disabled;)u=c.pop()}if(u){const c=u.id-r-1;this.onNavigate(h,n,c)}else this.onNavigate(h,n)}this.applyState(h),m()}},this.handleBlur=e=>{if(this.state.focused){const s=this.base.initState();s.data.focused=!1,s.events.push({type:"onBlur"}),s.syntheticEvent=e,this.applyInputValue(e.currentTarget.value,s)}},p.validatePackage(R.packageMetadata)}get _inputId(){return this.props.id+"-accessibility-id"}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 a=this.props.validationMessage!==void 0,e=!this.required||this.value!=="",s=this.props.valid!==void 0?this.props.valid:e;return{customError:a,valid:s,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:b.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:b.defaultProps.required}componentDidUpdate(a,e){var m;const{groupField:s=""}=this.props,i=g.getFilteredData(this.props),{data:t=[]}=a,o=this.focusedIndex(),r=i[o],l=t!==i,n=r!==void 0&&e.focusedItem!==r,d=this.props.opened!==void 0?this.props.opened:this.state.opened,v=a.opened!==void 0?a.opened:e.opened,h=!v&&d;if(s==="")(d&&(n||l)||h)&&this.base.scrollToItem(o);else if(!this._isScrolling){const u=(m=this.base.getGroupedDataModernMode(i,s))==null?void 0:m.indexOf(r);h&&(i&&i.length!==0&&this.base.resetGroupStickyHeader(i[0][s],this),this.base.scrollToItem(u)),d&&v&&n&&this.base.scrollToItem(u)}this.setValidity()}componentDidMount(){this.base.didMount(),this.setValidity()}render(){const{dir:a,disabled:e,label:s,className:i,style:t,loading:o,suggest:r,size:l,rounded:n,fillMode:d}=this.props,v=!this.validityStyles||this.validity.valid,h=this.base,m=this.value,u=this.props.clearButton!==!1&&!o&&!!m,c=this.props.id||this._inputId,y=this.state.focused;typeof r=="string"&&(this._suggested=r);const[C,K]=F(this.props.prefix||I.Fragment),[V,M]=F(this.props.suffix||I.Fragment),D=I.createElement("span",{className:p.classNames("k-autocomplete k-input",i,{[`k-input-${_[l]||l}`]:l,[`k-rounded-${G[n]||n}`]:n,[`k-input-${d}`]:d,"k-invalid":!v,"k-focus":y&&!e,"k-loading":o,"k-required":this.required,"k-disabled":e}),ref:w=>{this._element=w,h.wrapper=w},style:s?{...t,width:void 0}:t,dir:a},this.props.prefix&&I.createElement(C,{...K}),this.renderSearchBar(m||"",c),o&&I.createElement(p.IconWrap,{className:"k-input-loading-icon",name:"loading"}),u&&!o&&I.createElement(H,{onClick:this.clearButtonClick,key:"clearbutton"}),this.props.suffix&&I.createElement(V,{...M}),this.renderListContainer());return s?I.createElement(L.FloatingLabel,{label:s,editorId:c,editorValue:m,editorValid:v,editorDisabled:e,style:{width:t?t.width:void 0},children:D}):D}onNavigate(a,e,s){const i=this.value,{textField:t,focusedItemIndex:o}=this.props,r=g.getFilteredData(this.props),l=this.state.focusedItem!==void 0?r.findIndex(d=>g.areSame(d,this.state.focusedItem,t)):o?o(r,i,t):r.indexOf(g.getFocusedItem(r,i,t)),n=this.base.navigation.navigate({keyCode:e,current:l,max:r.length-1,min:0,skipItems:s||void 0});n!==void 0&&this.itemFocus(n,a),this.applyState(a)}applyInputValue(a,e,s){const i=this.props.opened!==void 0?this.props.opened:this.state.opened,{textField:t}=this.props,o=g.getFilteredData(this.props),r=this.focusedIndex(),l=o[r];if(this._suggested="",i&&s===p.Keys.enter&&l&&!l.disabled){const n=g.getItemValue(o[this.focusedIndex(a)],t);this.triggerOnChange(n,e)}i&&this.togglePopup(e),this.applyState(e)}renderSearchBar(a,e){const s=this.base,{placeholder:i,tabIndex:t,disabled:o,readonly:r}=this.props,{focused:l}=this.state,n=this.props.opened!==void 0?this.props.opened:this.state.opened;return I.createElement(q,{id:e,placeholder:i,tabIndex:t,accessKey:this.props.accessKey,value:a,suggestedText:this._suggested,focused:l,name:this.props.name,ref:d=>this._input=d&&d.input,onKeyDown:this.onInputKeyDown,onChange:this.onChangeHandler,onFocus:s.handleFocus,onBlur:this.handleBlur,disabled:o,readOnly:r,expanded:n,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})}renderListContainer(){const a=this.base,{dir:e,header:s,footer:i,size:t,groupField:o,list:r,groupStickyHeaderItemRender:l}=this.props,n=g.getFilteredData(this.props),d=a.getPopupSettings(),v=this.props.opened!==void 0?this.props.opened:this.state.opened,h=d.width!==void 0?d.width:a.popupWidth;let{group:m}=this.state;return m===void 0&&o!==void 0&&(m=g.getItemValue(n[0],o)),I.createElement(E,{width:h,popupSettings:{...d,anchor:d.anchor||this.element,show:v,popupClass:p.classNames(d.popupClass,"k-list-container","k-autocomplete-popup")},dir:e!==void 0?e:this.base.dirCalculated,itemsCount:[n.length]},s&&I.createElement("div",{className:"k-list-header"},s),I.createElement("div",{className:p.classNames("k-list",{[`k-list-${_[t]||t}`]:t})},!r&&m&&n.length!==0&&I.createElement(N,{group:m,groupMode:"modern",render:l}),this.renderList()),i&&I.createElement("div",{className:"k-list-footer"},i))}renderList(){const a=this.base,e=a.getPopupSettings(),{textField:s,listNoDataRender:i,itemRender:t,groupHeaderItemRender:o}=this.props,r=g.getFilteredData(this.props),l=this.value,n=this.props.opened!==void 0?this.props.opened:this.state.opened;return I.createElement(T,{id:a.listBoxId,show:n,data:r.slice(),focusedIndex:this.focusedIndex(),value:l,textField:s,valueField:s,highlightSelected:!1,optionsGuid:a.guid,groupField:this.props.groupField,groupMode:"modern",listRef:d=>a.list=d,wrapperStyle:{maxHeight:e.height},wrapperCssClass:"k-list-content",onClick:this.handleItemClick,itemRender:t,groupHeaderItemRender:o,noDataRender:i,onMouseDown:d=>d.preventDefault(),onScroll:this.onScroll})}triggerOnChange(a,e,s){this.value===a&&!s||(e.data.value=a,this._valueDuringOnChange=a,e.events.push({type:"onChange",...s||{}}))}applyState(a){this.base.applyState(a),this._valueDuringOnChange=void 0}suggestValue(a){if(this._suggested="",a){const{textField:e}=this.props,s=g.getFilteredData(this.props),i=s[g.itemIndexStartsWith(s,a,e)];if(i){const t=g.getItemValue(i,e);a.toLowerCase()!==t.toLowerCase()&&(this._suggested=t.substring(a.length))}}}focusedIndex(a){const{textField:e,focusedItemIndex:s,skipDisabledItems:i}=this.props,t=g.getFilteredData(this.props),o=a!==void 0?a:this.value;if(this.state.focusedItem!==void 0)return t.findIndex(l=>g.areSame(l,this.state.focusedItem,e));if(s)return s(t,o,e);const r=t.indexOf(g.getFocusedItem(t,o,e));return i&&e&&r===-1?t.findIndex(l=>!l.disabled&&l[e]):Math.max(0,r)}};b.displayName="AutoComplete",b.propTypes={...k.basicPropTypes,size:f.oneOf([null,"small","medium","large"]),rounded:f.oneOf([null,"small","medium","large","full"]),fillMode:f.oneOf([null,"solid","flat","outline"]),groupField:f.string,suggest:f.oneOfType([f.bool,f.string]),placeholder:f.string,value:f.string,defaultValue:f.string,validationMessage:f.string,required:f.bool,readonly:f.bool,clearButton:f.bool,valueRender:f.func,id:f.string,ariaLabelledBy:f.string,ariaDescribedBy:f.string,list:f.any,skipDisabledItems:f.bool},b.defaultProps={...k.defaultProps,size:"medium",rounded:"medium",fillMode:"solid",skipDisabledItems:!0,prefix:void 0,suffix:void 0};let S=b;const O=p.createPropsContext(),P=p.withIdHOC(p.withPropsContext(O,S));P.displayName="KendoReactAutoComplete";exports.AutoComplete=P;exports.AutoCompletePropsContext=O;exports.AutoCompleteWithoutContext=S;
|
|
@@ -44,19 +44,19 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
|
|
|
44
44
|
const i = this.itemHeight || (o ? o.children[0].offsetHeight : 0), p = e.target.scrollTop;
|
|
45
45
|
s && (t = this.base.getGroupedDataModernMode(t, s));
|
|
46
46
|
let n = t[0][s];
|
|
47
|
-
for (let
|
|
48
|
-
t[
|
|
47
|
+
for (let d = 1; d < t.length && !(i * d > p); d++)
|
|
48
|
+
t[d] && t[d][s] && (n = t[d][s]);
|
|
49
49
|
n !== this.state.group && this.setState({
|
|
50
50
|
group: n
|
|
51
51
|
});
|
|
52
52
|
}, this.handleItemClick = (e, o) => {
|
|
53
53
|
this.base.handleItemClick(e, o), this._valueDuringOnChange = void 0;
|
|
54
54
|
}, this.onChangeHandler = (e) => {
|
|
55
|
-
const s = this.base.initState(), t = e.currentTarget, i = t.value,
|
|
55
|
+
const s = this.base.initState(), t = e.currentTarget, i = t.value, r = t.selectionEnd === i.length;
|
|
56
56
|
s.syntheticEvent = e;
|
|
57
|
-
const p = this._suggested, n = this.value,
|
|
57
|
+
const p = this._suggested, n = this.value, d = n && n.substring(0, n.length - p.length), f = d && d === i, h = d && d.length > i.length, { suggest: g } = this.props, l = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
|
|
58
58
|
if (g !== void 0 && g !== !1) {
|
|
59
|
-
f || h || !
|
|
59
|
+
f || h || !r ? this._suggested = "" : this.suggestValue(i);
|
|
60
60
|
const u = i + this._suggested, v = { userInput: i, value: this._suggested };
|
|
61
61
|
this.triggerOnChange(u, s, { suggestion: v });
|
|
62
62
|
} else
|
|
@@ -70,16 +70,16 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
|
|
|
70
70
|
}, this.onInputKeyDown = (e) => {
|
|
71
71
|
const { skipDisabledItems: o, groupField: s, textField: t } = this.props, i = y(this.props);
|
|
72
72
|
this._isScrolling && (this._isScrolling = !1);
|
|
73
|
-
const
|
|
73
|
+
const r = this.focusedIndex(), p = i[r], n = e.keyCode, d = e.altKey, f = this.props.opened !== void 0 ? this.props.opened : this.state.opened, h = this.base.initState();
|
|
74
74
|
h.syntheticEvent = e;
|
|
75
75
|
const g = () => {
|
|
76
76
|
f && e.preventDefault();
|
|
77
77
|
};
|
|
78
|
-
if (
|
|
78
|
+
if (d && n === m.down)
|
|
79
79
|
this.setState({
|
|
80
80
|
opened: !0
|
|
81
81
|
});
|
|
82
|
-
else if (
|
|
82
|
+
else if (d && n === m.up)
|
|
83
83
|
this.setState({
|
|
84
84
|
opened: !1
|
|
85
85
|
});
|
|
@@ -99,14 +99,14 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
|
|
|
99
99
|
else {
|
|
100
100
|
let l = 0;
|
|
101
101
|
if (n === m.down || n === m.right) {
|
|
102
|
-
const u = i.slice(
|
|
102
|
+
const u = i.slice(r + 1).find((v) => !v.disabled && v[t]);
|
|
103
103
|
l = u && i.findIndex((v) => v[t] === u[t]);
|
|
104
104
|
} else if (n === m.up || n === m.left) {
|
|
105
105
|
let u;
|
|
106
|
-
if (
|
|
106
|
+
if (r === -1)
|
|
107
107
|
u = i, l = i.findIndex((v) => !v.disabled && v[t]);
|
|
108
108
|
else {
|
|
109
|
-
u = i.slice(0,
|
|
109
|
+
u = i.slice(0, r);
|
|
110
110
|
let v = u.pop();
|
|
111
111
|
for (; v && v.disabled; )
|
|
112
112
|
v = u.pop();
|
|
@@ -114,7 +114,7 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
if (l !== void 0) {
|
|
117
|
-
const u = l -
|
|
117
|
+
const u = l - r;
|
|
118
118
|
this.onNavigate(h, n, u);
|
|
119
119
|
} else
|
|
120
120
|
l === void 0 && i.findIndex((u) => u[t]) === i.length - 1 && this.onNavigate(h, n);
|
|
@@ -124,14 +124,14 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
|
|
|
124
124
|
else {
|
|
125
125
|
let l = null;
|
|
126
126
|
if (n === m.down || n === m.right)
|
|
127
|
-
l = i.slice(
|
|
127
|
+
l = i.slice(r + 1).find((u) => !u.disabled);
|
|
128
128
|
else if (n === m.up || n === m.left) {
|
|
129
|
-
const u = i.slice(0,
|
|
129
|
+
const u = i.slice(0, r);
|
|
130
130
|
for (l = u.pop(); l && l.disabled; )
|
|
131
131
|
l = u.pop();
|
|
132
132
|
}
|
|
133
133
|
if (l) {
|
|
134
|
-
const u = l.id -
|
|
134
|
+
const u = l.id - r - 1;
|
|
135
135
|
this.onNavigate(h, n, u);
|
|
136
136
|
} else
|
|
137
137
|
this.onNavigate(h, n);
|
|
@@ -194,12 +194,12 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
|
|
|
194
194
|
*/
|
|
195
195
|
componentDidUpdate(a, e) {
|
|
196
196
|
var g;
|
|
197
|
-
const { groupField: o = "" } = this.props, s = y(this.props), { data: t = [] } = a, i = this.focusedIndex(),
|
|
197
|
+
const { groupField: o = "" } = this.props, s = y(this.props), { data: t = [] } = a, i = this.focusedIndex(), r = s[i], p = t !== s, n = r !== void 0 && e.focusedItem !== r, d = this.props.opened !== void 0 ? this.props.opened : this.state.opened, f = a.opened !== void 0 ? a.opened : e.opened, h = !f && d;
|
|
198
198
|
if (o === "")
|
|
199
|
-
(
|
|
199
|
+
(d && (n || p) || h) && this.base.scrollToItem(i);
|
|
200
200
|
else if (!this._isScrolling) {
|
|
201
|
-
const l = (g = this.base.getGroupedDataModernMode(s, o)) == null ? void 0 : g.indexOf(
|
|
202
|
-
h && (s && s.length !== 0 && this.base.resetGroupStickyHeader(s[0][o], this), this.base.scrollToItem(l)),
|
|
201
|
+
const l = (g = this.base.getGroupedDataModernMode(s, o)) == null ? void 0 : g.indexOf(r);
|
|
202
|
+
h && (s && s.length !== 0 && this.base.resetGroupStickyHeader(s[0][o], this), this.base.scrollToItem(l)), d && f && n && this.base.scrollToItem(l);
|
|
203
203
|
}
|
|
204
204
|
this.setValidity();
|
|
205
205
|
}
|
|
@@ -213,25 +213,21 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
|
|
|
213
213
|
* @hidden
|
|
214
214
|
*/
|
|
215
215
|
render() {
|
|
216
|
-
const { dir: a, disabled: e, label: o, className: s, style: t, loading: i, suggest:
|
|
217
|
-
typeof
|
|
216
|
+
const { dir: a, disabled: e, label: o, className: s, style: t, loading: i, suggest: r, size: p, rounded: n, fillMode: d } = this.props, f = !this.validityStyles || this.validity.valid, h = this.base, g = this.value, l = this.props.clearButton !== !1 && !i && !!g, u = this.props.id || this._inputId, v = this.state.focused;
|
|
217
|
+
typeof r == "string" && (this._suggested = r);
|
|
218
218
|
const [S, V] = P(this.props.prefix || I.Fragment), [E, M] = P(this.props.suffix || I.Fragment), _ = /* @__PURE__ */ I.createElement(
|
|
219
219
|
"span",
|
|
220
220
|
{
|
|
221
|
-
className: w(
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
{
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
"k-required": this.required,
|
|
232
|
-
"k-disabled": e
|
|
233
|
-
}
|
|
234
|
-
),
|
|
221
|
+
className: w("k-autocomplete k-input", s, {
|
|
222
|
+
[`k-input-${B[p] || p}`]: p,
|
|
223
|
+
[`k-rounded-${W[n] || n}`]: n,
|
|
224
|
+
[`k-input-${d}`]: d,
|
|
225
|
+
"k-invalid": !f,
|
|
226
|
+
"k-focus": v && !e,
|
|
227
|
+
"k-loading": i,
|
|
228
|
+
"k-required": this.required,
|
|
229
|
+
"k-disabled": e
|
|
230
|
+
}),
|
|
235
231
|
ref: (F) => {
|
|
236
232
|
this._element = F, h.wrapper = F;
|
|
237
233
|
},
|
|
@@ -262,10 +258,10 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
|
|
|
262
258
|
* @hidden
|
|
263
259
|
*/
|
|
264
260
|
onNavigate(a, e, o) {
|
|
265
|
-
const s = this.value, { textField: t, focusedItemIndex: i } = this.props,
|
|
261
|
+
const s = this.value, { textField: t, focusedItemIndex: i } = this.props, r = y(this.props), p = this.state.focusedItem !== void 0 ? r.findIndex((d) => k(d, this.state.focusedItem, t)) : i ? i(r, s, t) : r.indexOf(O(r, s, t)), n = this.base.navigation.navigate({
|
|
266
262
|
keyCode: e,
|
|
267
263
|
current: p,
|
|
268
|
-
max:
|
|
264
|
+
max: r.length - 1,
|
|
269
265
|
min: 0,
|
|
270
266
|
skipItems: o || void 0
|
|
271
267
|
});
|
|
@@ -275,7 +271,7 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
|
|
|
275
271
|
* @hidden
|
|
276
272
|
*/
|
|
277
273
|
applyInputValue(a, e, o) {
|
|
278
|
-
const s = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { textField: t } = this.props, i = y(this.props),
|
|
274
|
+
const s = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { textField: t } = this.props, i = y(this.props), r = this.focusedIndex(), p = i[r];
|
|
279
275
|
if (this._suggested = "", s && o === m.enter && p && !p.disabled) {
|
|
280
276
|
const n = x(i[this.focusedIndex(a)], t);
|
|
281
277
|
this.triggerOnChange(n, e);
|
|
@@ -283,7 +279,7 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
|
|
|
283
279
|
s && this.togglePopup(e), this.applyState(e);
|
|
284
280
|
}
|
|
285
281
|
renderSearchBar(a, e) {
|
|
286
|
-
const o = this.base, { placeholder: s, tabIndex: t, disabled: i, readonly:
|
|
282
|
+
const o = this.base, { placeholder: s, tabIndex: t, disabled: i, readonly: r } = this.props, { focused: p } = this.state, n = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
|
|
287
283
|
return /* @__PURE__ */ I.createElement(
|
|
288
284
|
T,
|
|
289
285
|
{
|
|
@@ -295,13 +291,13 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
|
|
|
295
291
|
suggestedText: this._suggested,
|
|
296
292
|
focused: p,
|
|
297
293
|
name: this.props.name,
|
|
298
|
-
ref: (
|
|
294
|
+
ref: (d) => this._input = d && d.input,
|
|
299
295
|
onKeyDown: this.onInputKeyDown,
|
|
300
296
|
onChange: this.onChangeHandler,
|
|
301
297
|
onFocus: o.handleFocus,
|
|
302
298
|
onBlur: this.handleBlur,
|
|
303
299
|
disabled: i,
|
|
304
|
-
readOnly:
|
|
300
|
+
readOnly: r,
|
|
305
301
|
expanded: n,
|
|
306
302
|
owns: o.listBoxId,
|
|
307
303
|
activedescendant: "option-" + o.guid + "-" + this.focusedIndex(),
|
|
@@ -314,29 +310,17 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
|
|
|
314
310
|
);
|
|
315
311
|
}
|
|
316
312
|
renderListContainer() {
|
|
317
|
-
const a = this.base, {
|
|
318
|
-
dir: e,
|
|
319
|
-
header: o,
|
|
320
|
-
footer: s,
|
|
321
|
-
size: t,
|
|
322
|
-
groupField: i,
|
|
323
|
-
list: d,
|
|
324
|
-
groupStickyHeaderItemRender: p
|
|
325
|
-
} = this.props, n = y(this.props), r = a.getPopupSettings(), f = this.props.opened !== void 0 ? this.props.opened : this.state.opened, h = r.width !== void 0 ? r.width : a.popupWidth;
|
|
313
|
+
const a = this.base, { dir: e, header: o, footer: s, size: t, groupField: i, list: r, groupStickyHeaderItemRender: p } = this.props, n = y(this.props), d = a.getPopupSettings(), f = this.props.opened !== void 0 ? this.props.opened : this.state.opened, h = d.width !== void 0 ? d.width : a.popupWidth;
|
|
326
314
|
let { group: g } = this.state;
|
|
327
315
|
return g === void 0 && i !== void 0 && (g = x(n[0], i)), /* @__PURE__ */ I.createElement(
|
|
328
316
|
N,
|
|
329
317
|
{
|
|
330
318
|
width: h,
|
|
331
319
|
popupSettings: {
|
|
332
|
-
...
|
|
333
|
-
anchor:
|
|
320
|
+
...d,
|
|
321
|
+
anchor: d.anchor || this.element,
|
|
334
322
|
show: f,
|
|
335
|
-
popupClass: w(
|
|
336
|
-
r.popupClass,
|
|
337
|
-
"k-list-container",
|
|
338
|
-
"k-autocomplete-popup"
|
|
339
|
-
)
|
|
323
|
+
popupClass: w(d.popupClass, "k-list-container", "k-autocomplete-popup")
|
|
340
324
|
},
|
|
341
325
|
dir: e !== void 0 ? e : this.base.dirCalculated,
|
|
342
326
|
itemsCount: [n.length]
|
|
@@ -345,32 +329,24 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
|
|
|
345
329
|
/* @__PURE__ */ I.createElement(
|
|
346
330
|
"div",
|
|
347
331
|
{
|
|
348
|
-
className: w(
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
[`k-list-${B[t] || t}`]: t
|
|
352
|
-
}
|
|
353
|
-
)
|
|
332
|
+
className: w("k-list", {
|
|
333
|
+
[`k-list-${B[t] || t}`]: t
|
|
334
|
+
})
|
|
354
335
|
},
|
|
355
|
-
!
|
|
336
|
+
!r && g && n.length !== 0 && /* @__PURE__ */ I.createElement(H, { group: g, groupMode: "modern", render: p }),
|
|
356
337
|
this.renderList()
|
|
357
338
|
),
|
|
358
339
|
s && /* @__PURE__ */ I.createElement("div", { className: "k-list-footer" }, s)
|
|
359
340
|
);
|
|
360
341
|
}
|
|
361
342
|
renderList() {
|
|
362
|
-
const a = this.base, e = a.getPopupSettings(), {
|
|
363
|
-
textField: o,
|
|
364
|
-
listNoDataRender: s,
|
|
365
|
-
itemRender: t,
|
|
366
|
-
groupHeaderItemRender: i
|
|
367
|
-
} = this.props, d = y(this.props), p = this.value, n = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
|
|
343
|
+
const a = this.base, e = a.getPopupSettings(), { textField: o, listNoDataRender: s, itemRender: t, groupHeaderItemRender: i } = this.props, r = y(this.props), p = this.value, n = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
|
|
368
344
|
return /* @__PURE__ */ I.createElement(
|
|
369
345
|
L,
|
|
370
346
|
{
|
|
371
347
|
id: a.listBoxId,
|
|
372
348
|
show: n,
|
|
373
|
-
data:
|
|
349
|
+
data: r.slice(),
|
|
374
350
|
focusedIndex: this.focusedIndex(),
|
|
375
351
|
value: p,
|
|
376
352
|
textField: o,
|
|
@@ -379,14 +355,14 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
|
|
|
379
355
|
optionsGuid: a.guid,
|
|
380
356
|
groupField: this.props.groupField,
|
|
381
357
|
groupMode: "modern",
|
|
382
|
-
listRef: (
|
|
358
|
+
listRef: (d) => a.list = d,
|
|
383
359
|
wrapperStyle: { maxHeight: e.height },
|
|
384
360
|
wrapperCssClass: "k-list-content",
|
|
385
361
|
onClick: this.handleItemClick,
|
|
386
362
|
itemRender: t,
|
|
387
363
|
groupHeaderItemRender: i,
|
|
388
364
|
noDataRender: s,
|
|
389
|
-
onMouseDown: (
|
|
365
|
+
onMouseDown: (d) => d.preventDefault(),
|
|
390
366
|
onScroll: this.onScroll
|
|
391
367
|
}
|
|
392
368
|
);
|
|
@@ -409,13 +385,11 @@ const Q = "Please enter a valid value!", { sizeMap: B, roundedMap: W } = A, b =
|
|
|
409
385
|
focusedIndex(a) {
|
|
410
386
|
const { textField: e, focusedItemIndex: o, skipDisabledItems: s } = this.props, t = y(this.props), i = a !== void 0 ? a : this.value;
|
|
411
387
|
if (this.state.focusedItem !== void 0)
|
|
412
|
-
return t.findIndex((
|
|
388
|
+
return t.findIndex((p) => k(p, this.state.focusedItem, e));
|
|
413
389
|
if (o)
|
|
414
390
|
return o(t, i, e);
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
return s && e && d === -1 ? t.findIndex((p) => !p.disabled && p[e]) : Math.max(0, d);
|
|
418
|
-
}
|
|
391
|
+
const r = t.indexOf(O(t, i, e));
|
|
392
|
+
return s && e && r === -1 ? t.findIndex((p) => !p.disabled && p[e]) : Math.max(0, r);
|
|
419
393
|
}
|
|
420
394
|
};
|
|
421
395
|
b.displayName = "AutoComplete", b.propTypes = {
|
|
@@ -448,7 +422,12 @@ b.displayName = "AutoComplete", b.propTypes = {
|
|
|
448
422
|
suffix: void 0
|
|
449
423
|
};
|
|
450
424
|
let D = b;
|
|
451
|
-
const X = z(), Y = G(
|
|
425
|
+
const X = z(), Y = G(
|
|
426
|
+
$(
|
|
427
|
+
X,
|
|
428
|
+
D
|
|
429
|
+
)
|
|
430
|
+
);
|
|
452
431
|
Y.displayName = "KendoReactAutoComplete";
|
|
453
432
|
export {
|
|
454
433
|
Y as AutoComplete,
|
package/ComboBox/ComboBox.mjs
CHANGED
|
@@ -100,7 +100,10 @@ const Se = "Please enter a valid value!", { sizeMap: O, roundedMap: De } = de, E
|
|
|
100
100
|
n.syntheticEvent = e, this.base.togglePopup(n), this.base.filterChanged(o, n), this.applyState(n);
|
|
101
101
|
}
|
|
102
102
|
}, this.onInputKeyDown = (e) => {
|
|
103
|
-
const { skipDisabledItems: t, textField: o, dataItemKey: n, groupField: l } = this.props, a = y(this.props), r = this.value, d = Math.max(
|
|
103
|
+
const { skipDisabledItems: t, textField: o, dataItemKey: n, groupField: l } = this.props, a = y(this.props), r = this.value, d = Math.max(
|
|
104
|
+
0,
|
|
105
|
+
a.findIndex((u) => S(u, r, n))
|
|
106
|
+
), i = e.keyCode, c = this.props.opened !== void 0 ? this.props.opened : this.state.opened, h = this.base.initState();
|
|
104
107
|
if (h.syntheticEvent = e, !e.altKey && (i === I.up || i === I.down)) {
|
|
105
108
|
if (e.preventDefault(), l !== "" && o)
|
|
106
109
|
if (!this.props.skipDisabledItems && c)
|
|
@@ -271,7 +274,10 @@ const Se = "Please enter a valid value!", { sizeMap: O, roundedMap: De } = de, E
|
|
|
271
274
|
}
|
|
272
275
|
/** @hidden */
|
|
273
276
|
render() {
|
|
274
|
-
const s = U(this).toLanguageString(
|
|
277
|
+
const s = U(this).toLanguageString(
|
|
278
|
+
q,
|
|
279
|
+
$[q]
|
|
280
|
+
), e = U(this).toLanguageString(
|
|
275
281
|
G,
|
|
276
282
|
$[G]
|
|
277
283
|
), {
|
|
@@ -402,7 +408,17 @@ const Se = "Please enter a valid value!", { sizeMap: O, roundedMap: De } = de, E
|
|
|
402
408
|
return d !== -1 ? this.handleItemSelect(d + r, e) : (this.triggerOnChange(null, e), this.state.text !== void 0 && (e.data.text = void 0)), t && this.base.togglePopup(e), this.applyState(e);
|
|
403
409
|
}
|
|
404
410
|
renderAdaptiveListContainer() {
|
|
405
|
-
const { windowWidth: s = 0 } = this.state, {
|
|
411
|
+
const { windowWidth: s = 0 } = this.state, {
|
|
412
|
+
header: e,
|
|
413
|
+
footer: t,
|
|
414
|
+
size: o,
|
|
415
|
+
groupField: n,
|
|
416
|
+
groupMode: l,
|
|
417
|
+
list: a,
|
|
418
|
+
virtual: r,
|
|
419
|
+
adaptiveTitle: d,
|
|
420
|
+
groupStickyHeaderItemRender: i
|
|
421
|
+
} = this.props, c = y(this.props), h = this.props.opened !== void 0 ? this.props.opened : this.state.opened, g = this.base.getAdaptiveAnimation();
|
|
406
422
|
let { group: v } = this.state;
|
|
407
423
|
v === void 0 && n !== void 0 && (v = D(c[0], n));
|
|
408
424
|
const m = {
|
|
@@ -428,15 +444,29 @@ const Se = "Please enter a valid value!", { sizeMap: O, roundedMap: De } = de, E
|
|
|
428
444
|
icon: "x",
|
|
429
445
|
svgIcon: Ie
|
|
430
446
|
}
|
|
431
|
-
))), /* @__PURE__ */ p.createElement("div", { className: "k-actionsheet-titlebar-group k-actionsheet-filter" }, this.renderMobileListFilter())), /* @__PURE__ */ p.createElement(Ce, { overflowHidden: !0 }, /* @__PURE__ */ p.createElement("div", { className: "k-list-container" }, /* @__PURE__ */ p.createElement(
|
|
447
|
+
))), /* @__PURE__ */ p.createElement("div", { className: "k-actionsheet-titlebar-group k-actionsheet-filter" }, this.renderMobileListFilter())), /* @__PURE__ */ p.createElement(Ce, { overflowHidden: !0 }, /* @__PURE__ */ p.createElement("div", { className: "k-list-container" }, /* @__PURE__ */ p.createElement(
|
|
448
|
+
"div",
|
|
432
449
|
{
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
450
|
+
className: w({
|
|
451
|
+
"k-list": !a,
|
|
452
|
+
"k-list-lg": !0,
|
|
453
|
+
"k-virtual-list": r,
|
|
454
|
+
"k-data-table": a,
|
|
455
|
+
[`k-table-${O[o] || o}`]: a && o
|
|
456
|
+
})
|
|
457
|
+
},
|
|
458
|
+
e && /* @__PURE__ */ p.createElement("div", { className: "k-table-header" }, e),
|
|
459
|
+
!a && v && c.length !== 0 && /* @__PURE__ */ p.createElement(
|
|
460
|
+
z,
|
|
461
|
+
{
|
|
462
|
+
group: v,
|
|
463
|
+
groupMode: l,
|
|
464
|
+
render: i
|
|
465
|
+
}
|
|
466
|
+
),
|
|
467
|
+
this.renderList(),
|
|
468
|
+
t && /* @__PURE__ */ p.createElement("div", { className: "k-list-footer" }, t)
|
|
469
|
+
))));
|
|
440
470
|
}
|
|
441
471
|
renderListContainer() {
|
|
442
472
|
const s = this.base, { dir: e, header: t, footer: o, groupField: n, groupMode: l, size: a, list: r, virtual: d, groupStickyHeaderItemRender: i } = this.props, c = y(this.props), h = this.props.opened !== void 0 ? this.props.opened : this.state.opened, g = s.getPopupSettings(), v = g.width !== void 0 ? g.width : s.popupWidth;
|
|
@@ -449,29 +479,38 @@ const Se = "Please enter a valid value!", { sizeMap: O, roundedMap: De } = de, E
|
|
|
449
479
|
...g,
|
|
450
480
|
anchor: g.anchor || this.element,
|
|
451
481
|
show: h,
|
|
452
|
-
popupClass: w(
|
|
453
|
-
g.popupClass,
|
|
454
|
-
"k-list-container",
|
|
455
|
-
"k-combobox-popup"
|
|
456
|
-
)
|
|
482
|
+
popupClass: w(g.popupClass, "k-list-container", "k-combobox-popup")
|
|
457
483
|
},
|
|
458
484
|
dir: e !== void 0 ? e : this.base.dirCalculated,
|
|
459
485
|
itemsCount: [c.length]
|
|
460
486
|
},
|
|
461
|
-
/* @__PURE__ */ p.createElement(
|
|
462
|
-
|
|
463
|
-
"k-list": !r,
|
|
464
|
-
[`k-list-${O[a] || a}`]: !r && a,
|
|
465
|
-
"k-virtual-list": d,
|
|
466
|
-
"k-data-table": r,
|
|
467
|
-
[`k-table-${O[a] || a}`]: r && a
|
|
468
|
-
}
|
|
469
|
-
) }, t && /* @__PURE__ */ p.createElement("div", { className: "k-table-header" }, t), !r && m && c.length !== 0 && /* @__PURE__ */ p.createElement(z, { group: m, groupMode: l, render: i }), this.renderList(), o && /* @__PURE__ */ p.createElement("div", { className: w(
|
|
487
|
+
/* @__PURE__ */ p.createElement(
|
|
488
|
+
"div",
|
|
470
489
|
{
|
|
471
|
-
|
|
490
|
+
className: w({
|
|
491
|
+
"k-list": !r,
|
|
492
|
+
[`k-list-${O[a] || a}`]: !r && a,
|
|
493
|
+
"k-virtual-list": d,
|
|
494
|
+
"k-data-table": r,
|
|
495
|
+
[`k-table-${O[a] || a}`]: r && a
|
|
496
|
+
})
|
|
472
497
|
},
|
|
473
|
-
|
|
474
|
-
|
|
498
|
+
t && /* @__PURE__ */ p.createElement("div", { className: "k-table-header" }, t),
|
|
499
|
+
!r && m && c.length !== 0 && /* @__PURE__ */ p.createElement(z, { group: m, groupMode: l, render: i }),
|
|
500
|
+
this.renderList(),
|
|
501
|
+
o && /* @__PURE__ */ p.createElement(
|
|
502
|
+
"div",
|
|
503
|
+
{
|
|
504
|
+
className: w(
|
|
505
|
+
{
|
|
506
|
+
"k-list-footer": !this.props.footerClassName
|
|
507
|
+
},
|
|
508
|
+
this.props.footerClassName
|
|
509
|
+
)
|
|
510
|
+
},
|
|
511
|
+
o
|
|
512
|
+
)
|
|
513
|
+
)
|
|
475
514
|
);
|
|
476
515
|
}
|
|
477
516
|
renderList() {
|
|
@@ -503,12 +542,9 @@ const Se = "Please enter a valid value!", { sizeMap: O, roundedMap: De } = de, E
|
|
|
503
542
|
i.list = this.base.list = x, this.itemHeight = 0;
|
|
504
543
|
},
|
|
505
544
|
wrapperStyle: this.state.windowWidth && this.state.windowWidth > W ? { maxHeight: d.height } : {},
|
|
506
|
-
wrapperCssClass: w(
|
|
507
|
-
"k-list-
|
|
508
|
-
|
|
509
|
-
"k-list-scroller": !a
|
|
510
|
-
}
|
|
511
|
-
),
|
|
545
|
+
wrapperCssClass: w("k-list-content", {
|
|
546
|
+
"k-list-scroller": !a
|
|
547
|
+
}),
|
|
512
548
|
listStyle: i.enabled ? { transform: g } : void 0,
|
|
513
549
|
key: "listkey",
|
|
514
550
|
skip: c,
|
|
@@ -534,7 +570,10 @@ const Se = "Please enter a valid value!", { sizeMap: O, roundedMap: De } = de, E
|
|
|
534
570
|
dataItemKey: d,
|
|
535
571
|
virtual: i = { skip: 0 },
|
|
536
572
|
accessKey: c
|
|
537
|
-
} = this.props, h = y(this.props), g = this.props.opened !== void 0 ? this.props.opened : this.state.opened, v = this.value, m = Math.max(
|
|
573
|
+
} = this.props, h = y(this.props), g = this.props.opened !== void 0 ? this.props.opened : this.state.opened, v = this.value, m = Math.max(
|
|
574
|
+
0,
|
|
575
|
+
h.findIndex((u) => S(u, v, d))
|
|
576
|
+
);
|
|
538
577
|
this._suggested && !S(this._valueOnDidUpdate, v, d) && (this._suggested = "");
|
|
539
578
|
const k = {
|
|
540
579
|
accessKey: c
|
|
@@ -581,7 +620,13 @@ const Se = "Please enter a valid value!", { sizeMap: O, roundedMap: De } = de, E
|
|
|
581
620
|
!this.hasDuplicates && (!C(t) && !C(s) || S(t, s, this.props.dataItemKey)) || (this.props.value === void 0 && (e.data.value = s), this._valueDuringOnChange = s, e.events.push({ type: "onChange" }));
|
|
582
621
|
}
|
|
583
622
|
getFocusedIndex(s) {
|
|
584
|
-
const e = this.value, {
|
|
623
|
+
const e = this.value, {
|
|
624
|
+
textField: t,
|
|
625
|
+
dataItemKey: o,
|
|
626
|
+
virtual: n = { skip: 0 },
|
|
627
|
+
focusedItemIndex: l = K,
|
|
628
|
+
skipDisabledItems: a
|
|
629
|
+
} = this.props, r = y(this.props), d = this.props.filter ? this.props.filter : this.state.text;
|
|
585
630
|
return s && this.navigationIndex !== void 0 ? this.navigationIndex : C(e) && d === void 0 ? r.findIndex((i) => S(i, e, o)) : d ? l(r, d, t) : a && t && !d && n.skip === 0 ? r.findIndex((i) => !i.disabled && i[t]) : n.skip === 0 ? 0 : -1;
|
|
586
631
|
}
|
|
587
632
|
suggestValue(s) {
|
|
@@ -636,7 +681,12 @@ E.displayName = "ComboBox", E.propTypes = {
|
|
|
636
681
|
suffix: void 0
|
|
637
682
|
};
|
|
638
683
|
let T = E;
|
|
639
|
-
const Ee = ne(), we = le(
|
|
684
|
+
const Ee = ne(), we = le(
|
|
685
|
+
re(
|
|
686
|
+
Ee,
|
|
687
|
+
T
|
|
688
|
+
)
|
|
689
|
+
);
|
|
640
690
|
we.displayName = "KendoReactComboBox";
|
|
641
691
|
export {
|
|
642
692
|
we as ComboBox,
|