@progress/kendo-vue-dropdowns 8.4.0-develop.1 → 8.4.0-develop.3
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 +1 -1
- package/ComboBox/ComboBox.js +1 -1
- package/ComboBox/ComboBox.mjs +4 -3
- package/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +25 -25
- package/DropDownTree/DropDownTree.js +1 -1
- package/DropDownTree/DropDownTree.mjs +17 -17
- package/MultiSelect/MultiSelect.js +1 -1
- package/MultiSelect/MultiSelect.mjs +88 -88
- package/MultiSelect/TagList.js +1 -1
- package/MultiSelect/TagList.mjs +24 -22
- package/MultiSelectTree/MultiSelectTree.js +1 -1
- package/MultiSelectTree/MultiSelectTree.mjs +2 -2
- package/common/SearchBar.js +1 -1
- package/common/SearchBar.mjs +1 -1
- package/dist/cdn/js/kendo-vue-dropdowns.js +1 -1
- 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 r=require("vue"),w=require("../common/SearchBar.js"),M=require("../common/ListContainer.js"),L=require("../common/List.js"),T=require("../common/DropDownBase.js"),K=require("../common/GroupStickyHeader.js"),H=require("../common/ClearButton.js"),c=require("../common/utils.js"),a=require("@progress/kendo-vue-common"),{sizeMap:F,roundedMap:q}=a.kendoThemeMaps,A="Please enter a valid value!",P=r.defineComponent({name:"KendoAutoComplete",model:{event:"changemodel"},props:{id:String,defaultValue:{type:[String],default:void 0},name:String,modelValue:{type:[String],default:void 0},value:{type:[String],default:void 0},label:{type:String},placeholder:String,required:{type:Boolean,default:!1},valid:{type:Boolean,default:void 0},validationMessage:{type:String,default:void 0},validityStyles:{type:Boolean,default:!0},opened:{type:Boolean,default:void 0},disabled:Boolean,dir:{type:String,default:void 0},tabIndex:{type:Number,default:void 0},readonly:Boolean,accessKey:String,dataItems:Array,textField:String,loading:Boolean,popupSettings:{type:Object,default:function(){return{animate:!0,height:"200px",anchor:""}}},itemRender:[String,Function,Object],groupHeaderItemRender:[String,Function,Object],groupStickyHeaderItemRender:[String,Function,Object],listNoDataRender:[String,Function,Object],focusedItemIndex:Function,header:[String,Function,Object],footer:[String,Function,Object],suggest:{type:[Boolean,String],default:!1},ariaLabel:{type:String,default:void 0},ariaLabelledBy:String,ariaDescribedBy:String,rounded:{type:String,validator:function(e){return["none","small","medium","large","full"].includes(e)}},fillMode:{type:String,validator:function(e){return["solid","flat","outline"].includes(e)}},size:{type:String,validator:function(e){return["small","medium","large"].includes(e)}},groupField:{type:String},inputAttributes:Object},data(){return{hasMounted:!1,currentText:"",currentValue:"",currentFocused:!1,currentOpened:!1,focusedItem:void 0,searchState:{word:"",last:""},valueDuringOnChange:{},suggested:"",group:void 0,isScrolling:!1,popupWidth:void 0,itemHeight:0}},created(){this.valueDuringOnChange=void 0,this.currentText=void 0,this.currentValue=void 0,this.currentFocused=void 0,this.currentOpened=void 0,this.base=new T(this),this.anchor=a.guid(),this.inputId=a.guid()},setup(){const e=r.ref(null),t=r.ref(null);return{inputRef:e,kendoAnchorRef:t}},mounted(){this.hasMounted=!0,this.input=this.inputRef.input,this.base.wrapper=a.getRef(this,"kendoAnchor"),this.element=a.getRef(this,"kendoAnchor"),this.base.didMount(),this.setValidity()},watch:{currentOpened:function(e,t){this.prevCurrentOpened=t},opened:function(e,t){this.prevOpened=t},dataItems:function(e,t){this.prevData=t},focusedItem:function(e,t){this.prevFocusedItem=t}},updated(){var p;const{groupField:e="",dataItems:t=[]}=this.$props,i=this.focusedIndex(),s=t[i],n=this.prevData!==t,o=s!==void 0&&this.prevFocusedItem!==s,l=this.$props.opened!==void 0?this.$props.opened:this.currentOpened,d=this.prevOpened!==void 0?this.prevOpened:this.prevCurrentOpened,u=!d&&l,h=this.$refs.list;if(h&&(this.base.vs.list=h.list,this.base.list=h.list),e==="")(l&&(o||n)||u)&&this.base.scrollToItem(i);else if(!this.isScrolling){let g=(p=this.base.getGroupedDataModernMode(t,e))==null?void 0:p.indexOf(s);u&&(t&&t.length!==0&&this.base.resetGroupStickyHeader(t[0][e],this),this.base.scrollToItem(g)),l&&d&&o&&this.base.scrollToItem(g)}this.setValidity()},computed:{spanClassNames(){const e=!this.hasMounted||!this.$props.validityStyles||this.validity().valid;return{"k-floating-label-container":!0,"k-focus":this.currentFocused,"k-empty":!this.computedValue(),"k-invalid":!e&&e!==void 0,"k-rtl":this.$props.dir==="rtl"}}},methods:{focus(){this.input&&this.input.focus()},computedValue(){let e;return this.valueDuringOnChange!==void 0?e=this.valueDuringOnChange:this.$props.value!==void 0?e=this.$props.value:this.$props.modelValue!==void 0?e=this.$props.modelValue:this.currentValue!==void 0?e=this.currentValue:this.$props.defaultValue!==void 0&&(e=this.$props.defaultValue),e},primitiveValue(){const e=this.computedValue();return this.valuePrimitive?c.getItemValue(e,this.valueField):e},validity(){const e=this.$props.validationMessage!==void 0,t=!this.$props.required||this.computedValue()!==null&&this.computedValue()!==""&&this.computedValue()!==void 0,i=this.$props.valid!==void 0?this.$props.valid:t;return{customError:e,valid:i,valueMissing:this.computedValue()===null}},handleItemSelect(e,t){const{dataItems:i=[]}=this.$props,s=i[e],n=c.getItemValue(s,this.$props.textField);this.triggerOnChange(n,t,{item:s}),this.triggerOnSelect(t,{item:s})},itemFocus(e,t){const{dataItems:i=[],textField:s}=this.$props,n=i[e];c.areSame(this.$data.focusedItem,n,s)||(t.data.focusedItem=n)},togglePopup(e){this.base.togglePopup(e)},onNavigate(e,t){const i=this.computedValue(),{dataItems:s=[],textField:n,focusedItemIndex:o}=this.$props,l=this.$data.focusedItem!==void 0?s.findIndex(u=>c.areSame(u,this.$data.focusedItem,n)):o?o(s,i,n):s.indexOf(c.getFocusedItem(s,i,n)),d=this.base.navigation.navigate({keyCode:t,current:l,max:s.length-1,min:0});d!==void 0&&this.itemFocus(d,e),this.applyState(e)},applyInputValue(e,t,i){const s=this.$props.opened!==void 0?this.$props.opened:this.currentOpened,{dataItems:n=[],textField:o}=this.$props;if(this.suggested="",s&&i===a.Keys.enter){const l=n[this.focusedIndex(e)],d=c.getItemValue(l,o);this.triggerOnChange(d,t,{item:l}),this.triggerOnSelect(t,{item:l})}s&&this.togglePopup(t),this.applyState(t)},setValidity(){this.input&&this.input.setCustomValidity&&this.input.setCustomValidity(this.validity().valid?"":this.$props.validationMessage||A)},handleItemClick(e,t){this.base.handleItemClick(e,t),this.valueDuringOnChange=void 0},onChangeHandler(e){const i=this.base.initState(),s=e.target,n=s.value,o=s.selectionEnd===n.length;i.event=e;const l=this.suggested,d=this.computedValue(),u=d&&l&&d.substring(0,d.length-l.length),h=u&&u===n,p=u&&u.length>n.length,{suggest:g}=this.$props,f=this.$props.opened!==void 0?this.$props.opened:this.currentOpened;if(g!==void 0&&g!==!1){h||p||!o?this.suggested="":this.suggestValue(n);const v=n+this.suggested,k={userInput:n,value:this.suggested};this.triggerOnChange(v,i,{suggestion:k})}else this.suggested="",this.triggerOnChange(n,i);(!f&&n||f&&!n)&&this.togglePopup(i),i.data.focusedItem=void 0,this.prevData&&this.prevData.length!==this.$props.dataItems&&(i.data.group=void 0),this.applyState(i)},clearButtonClick(e){const i=this.base.initState(),s=this.$props.opened!==void 0?this.$props.opened:this.currentOpened;i.event=e;const n="";this.suggested="",this.triggerOnChange(n,i),this.$data.focusedItem!==void 0&&(i.data.focusedItem=void 0),s&&this.togglePopup(i),this.applyState(i)},onInputKeyDown(e){this.isScrolling&&(this.isScrolling=!1);const t=e.keyCode,i=this.$props.opened!==void 0?this.$props.opened:this.currentOpened,s=this.base.initState(),n=this.computedValue();s.event=e;const o=()=>{i&&e.preventDefault()};t===a.Keys.enter||i&&t===a.Keys.esc||e.altKey&&t===a.Keys.up?(o(),this.applyInputValue(e.currentTarget.value,s,e.keyCode)):!e.altKey&&(t===a.Keys.up||t===a.Keys.down)?(o(),this.onNavigate(s,t)):!i&&t===a.Keys.esc?this.clearButtonClick(e):!i&&n&&e.altKey&&t===a.Keys.down&&(this.togglePopup(s),this.applyState(s))},handleBlur(e){if(this.currentFocused){const t=this.base.initState();t.data.focused=!1,t.events.push({type:"blur"}),t.event=e,this.applyInputValue(e.currentTarget.value,t),this.currentFocused=!1}},triggerOnChange(e,t,i){this.computedValue()===e&&!i||(t.data.currentValue=e,this.valueDuringOnChange=e,t.events.push({type:"change",...i||{}}))},triggerOnSelect(e,t){e.events.push({type:"select",...t||{}})},applyState(e){this.base.applyState(e),this.valueDuringOnChange=void 0},suggestValue(e){if(this.suggested="",e){const{dataItems:t=[],textField:i}=this.$props,s=t[c.itemIndexStartsWith(t,e,i)];if(s){const n=c.getItemValue(s,i);e.toLowerCase()!==n.toLowerCase()&&(this.suggested=n.substring(e.length))}}},focusedIndex(e){const{dataItems:t=[],textField:i,focusedItemIndex:s}=this.$props,n=e!==void 0?e:this.computedValue();return this.$data.focusedItem!==void 0?t.findIndex(o=>c.areSame(o,this.$data.focusedItem,i)):s?s(t,n,i):Math.max(0,t.indexOf(c.getFocusedItem(t,n,i)))},repositionPopup(){this.base.repositionPopup()},onScroll(e){var h;this.isScrolling=!0;const t=this.base.initState(),{list:i}=this.base,{groupField:s}=this.$props;let{dataItems:n=[]}=this.$props;if(!s||!n.length)return;let o=this.itemHeight||i.children&&((h=i.querySelector(".k-list-item"))==null?void 0:h.offsetHeight)||0;const d=e.target.scrollTop;s&&(n=this.base.getGroupedDataModernMode(n,s));let u=n[0][s];o===0&&(o=28);for(let p=1;p<n.length&&!(o*p>d);p++)n[p]&&n[p][s]&&(u=n[p][s]);u!==this.group&&(t.data.group=u,this.applyState(t))}},render(){const{dir:e,disabled:t,label:i,size:s,rounded:n,fillMode:o,style:l,loading:d,suggest:u,inputAttributes:h}=this.$props,p=!this.$props.validityStyles||this.validity().valid,g=this.currentFocused,f=this.base,v=this.computedValue(),k=!d&&!!v,O=this.$props.id||this.inputId,C=Object.assign({},{animate:!0,height:"200px"},this.$props.popupSettings);typeof u=="string"&&(this.suggested=u);const B=function(I,m){const{placeholder:y,tabIndex:S,readonly:$}=this.$props,V=this.$props.opened!==void 0?this.$props.opened:this.currentOpened;return r.createVNode(w.SearchBar,{id:m,placeholder:y,tabIndex:S,accessKey:this.$props.accessKey,value:I,suggestedText:this.suggested,focused:g,name:this.$props.name,ref:b=>{this.inputRef=b},onKeydown:this.onInputKeyDown,onChange:this.onChangeHandler,onFocus:f.handleFocus,onBlur:this.handleBlur,disabled:t,readOnly:$,expanded:V,owns:f.listBoxId,activedescendant:"option-"+f.guid+"-"+this.focusedIndex(),onClearbuttonclick:this.clearButtonClick,ariaLabelledBy:this.$props.ariaLabelledBy,ariaDescribedBy:this.$props.ariaDescribedBy,ariaLabel:this.$props.ariaLabel,inputAttributes:h},null)},D=function(){const{textField:I,groupField:m}=this.$props;let y=this.$props.dataItems||[];const S=a.templateRendering.call(this,this.$props.itemRender,a.getListeners.call(this)),$=a.templateRendering.call(this,this.$props.groupHeaderItemRender,a.getListeners.call(this)),V=a.templateRendering.call(this,this.$props.listNoDataRender,a.getListeners.call(this)),b=this.$props.opened!==void 0?this.$props.opened:this.currentOpened;return m&&(y=this.base.getGroupedDataModernMode(y,m)),r.createVNode(L.List,{id:f.listBoxId,show:b,dataItems:y.slice(),focusedIndex:this.focusedIndex(),value:v,textField:I,valueField:I,highlightSelected:!1,optionsGuid:f.guid,ref:"list",wrapperStyle:{maxHeight:C.height},wrapperCssClass:"k-list-content",onListclick:this.handleItemClick,itemRender:S,groupHeaderItemRender:$,noDataRender:V,groupField:m,onScroll:this.onScroll},null)},R=function(){const I=a.templateRendering.call(this,this.$props.header,a.getListeners.call(this)),m=a.templateRendering.call(this,this.$props.footer,a.getListeners.call(this)),y=a.templateRendering.call(this,this.$props.groupStickyHeaderItemRender,a.getListeners.call(this)),S=a.getTemplate.call(this,{h:r.h,template:I}),$=a.getTemplate.call(this,{h:r.h,template:m}),V=this.$props.opened!==void 0?this.$props.opened:this.currentOpened,b=this.$props.dataItems||[];return this.group===void 0&&this.$props.groupField!==void 0&&(this.group=c.getItemValue(b[0],this.$props.groupField)),r.createVNode(M.ListContainer,{onMousedown:N=>N.preventDefault(),width:this.popupWidth,ref:"container",popupSettings:{...C,anchor:this.anchor,show:V,popupClass:a.classNames(C.popupClass,"k-list",{[`k-list-${F[s]||s}`]:s}),className:a.classNames("k-list-container",C.className)},dir:e!==void 0?e:this.base.dirCalculated},{default:()=>[S&&r.createVNode("div",{class:"k-list-header"},[S]),this.group&&b.length!==0&&r.createVNode(K.GroupStickyHeader,{group:this.group,render:y},null),D.call(this),$&&r.createVNode("div",{class:"k-list-footer"},[$])]})},x=r.createVNode("span",{class:a.classNames("k-autocomplete k-input",{[`k-input-${F[s]||s}`]:s,[`k-rounded-${q[n]||n}`]:n,[`k-input-${o}`]:o,"k-invalid":!p,"k-focus":g&&!t,"k-loading":d,"k-required":this.required,"k-disabled":t}),ref:a.setRef(this,"kendoAnchor"),style:i?{...l,width:void 0}:l,dir:e},[B.call(this,v||"",O),k&&!d&&r.createVNode(H.ClearButton,{onClearclick:this.clearButtonClick},null),r.createVNode("span",{class:d?"k-input-loading-icon k-icon k-i-loading":void 0},null),R.call(this)]);return i?r.createVNode("span",{class:this.spanClassNames,dir:this.$props.dir},[x,this.$props.label?O?r.createVNode("label",{for:O,class:"k-floating-label"},[this.$props.label]):r.createVNode("span",{class:"k-label"},[this.$props.label]):null]):x}});exports.AutoComplete=P;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue"),w=require("../common/SearchBar.js"),M=require("../common/ListContainer.js"),L=require("../common/List.js"),T=require("../common/DropDownBase.js"),K=require("../common/GroupStickyHeader.js"),H=require("../common/ClearButton.js"),c=require("../common/utils.js"),a=require("@progress/kendo-vue-common"),{sizeMap:F,roundedMap:q}=a.kendoThemeMaps,A="Please enter a valid value!",P=r.defineComponent({name:"KendoAutoComplete",model:{event:"changemodel"},props:{id:String,defaultValue:{type:[String],default:void 0},name:String,modelValue:{type:[String],default:void 0},value:{type:[String],default:void 0},label:{type:String},placeholder:String,required:{type:Boolean,default:!1},valid:{type:Boolean,default:void 0},validationMessage:{type:String,default:void 0},validityStyles:{type:Boolean,default:!0},opened:{type:Boolean,default:void 0},disabled:Boolean,dir:{type:String,default:void 0},tabIndex:{type:Number,default:void 0},readonly:Boolean,accessKey:String,dataItems:Array,textField:String,loading:Boolean,popupSettings:{type:Object,default:function(){return{animate:!0,height:"200px",anchor:""}}},itemRender:[String,Function,Object],groupHeaderItemRender:[String,Function,Object],groupStickyHeaderItemRender:[String,Function,Object],listNoDataRender:[String,Function,Object],focusedItemIndex:Function,header:[String,Function,Object],footer:[String,Function,Object],suggest:{type:[Boolean,String],default:!1},ariaLabel:{type:String,default:void 0},ariaLabelledBy:String,ariaDescribedBy:String,rounded:{type:String,validator:function(e){return["none","small","medium","large","full"].includes(e)}},fillMode:{type:String,validator:function(e){return["solid","flat","outline"].includes(e)}},size:{type:String,validator:function(e){return["small","medium","large"].includes(e)}},groupField:{type:String},inputAttributes:Object},data(){return{hasMounted:!1,currentText:"",currentValue:"",currentFocused:!1,currentOpened:!1,focusedItem:void 0,searchState:{word:"",last:""},valueDuringOnChange:{},suggested:"",group:void 0,isScrolling:!1,popupWidth:void 0,itemHeight:0}},created(){this.valueDuringOnChange=void 0,this.currentText=void 0,this.currentValue=void 0,this.currentFocused=void 0,this.currentOpened=void 0,this.base=new T(this),this.anchor=a.guid(),this.inputId=a.guid()},setup(){const e=r.ref(null),t=r.ref(null);return{inputRef:e,kendoAnchorRef:t}},mounted(){this.hasMounted=!0,this.input=this.inputRef.input,this.base.wrapper=a.getRef(this,"kendoAnchor"),this.element=a.getRef(this,"kendoAnchor"),this.base.didMount(),this.setValidity()},watch:{currentOpened:function(e,t){this.prevCurrentOpened=t},opened:function(e,t){this.prevOpened=t},dataItems:function(e,t){this.prevData=t},focusedItem:function(e,t){this.prevFocusedItem=t}},updated(){var p;const{groupField:e="",dataItems:t=[]}=this.$props,i=this.focusedIndex(),s=t[i],n=this.prevData!==t,o=s!==void 0&&this.prevFocusedItem!==s,l=this.$props.opened!==void 0?this.$props.opened:this.currentOpened,d=this.prevOpened!==void 0?this.prevOpened:this.prevCurrentOpened,u=!d&&l,h=this.$refs.list;if(h&&(this.base.vs.list=h.list,this.base.list=h.list),e==="")(l&&(o||n)||u)&&this.base.scrollToItem(i);else if(!this.isScrolling){let g=(p=this.base.getGroupedDataModernMode(t,e))==null?void 0:p.indexOf(s);u&&(t&&t.length!==0&&this.base.resetGroupStickyHeader(t[0][e],this),this.base.scrollToItem(g)),l&&d&&o&&this.base.scrollToItem(g)}this.setValidity()},computed:{spanClassNames(){const e=!this.hasMounted||!this.$props.validityStyles||this.validity().valid;return{"k-floating-label-container":!0,"k-focus":this.currentFocused,"k-empty":!this.computedValue(),"k-invalid":!e&&e!==void 0,"k-rtl":this.$props.dir==="rtl"}}},methods:{focus(){this.input&&this.input.focus()},computedValue(){let e;return this.valueDuringOnChange!==void 0?e=this.valueDuringOnChange:this.$props.value!==void 0?e=this.$props.value:this.$props.modelValue!==void 0?e=this.$props.modelValue:this.currentValue!==void 0?e=this.currentValue:this.$props.defaultValue!==void 0&&(e=this.$props.defaultValue),e},primitiveValue(){const e=this.computedValue();return this.valuePrimitive?c.getItemValue(e,this.valueField):e},validity(){const e=this.$props.validationMessage!==void 0,t=!this.$props.required||this.computedValue()!==null&&this.computedValue()!==""&&this.computedValue()!==void 0,i=this.$props.valid!==void 0?this.$props.valid:t;return{customError:e,valid:i,valueMissing:this.computedValue()===null}},handleItemSelect(e,t){const{dataItems:i=[]}=this.$props,s=i[e],n=c.getItemValue(s,this.$props.textField);this.triggerOnChange(n,t,{item:s}),this.triggerOnSelect(t,{item:s})},itemFocus(e,t){const{dataItems:i=[],textField:s}=this.$props,n=i[e];c.areSame(this.$data.focusedItem,n,s)||(t.data.focusedItem=n)},togglePopup(e){this.base.togglePopup(e)},onNavigate(e,t){const i=this.computedValue(),{dataItems:s=[],textField:n,focusedItemIndex:o}=this.$props,l=this.$data.focusedItem!==void 0?s.findIndex(u=>c.areSame(u,this.$data.focusedItem,n)):o?o(s,i,n):s.indexOf(c.getFocusedItem(s,i,n)),d=this.base.navigation.navigate({keyCode:t,current:l,max:s.length-1,min:0});d!==void 0&&this.itemFocus(d,e),this.applyState(e)},applyInputValue(e,t,i){const s=this.$props.opened!==void 0?this.$props.opened:this.currentOpened,{dataItems:n=[],textField:o}=this.$props;if(this.suggested="",s&&i===a.Keys.enter){const l=n[this.focusedIndex(e)],d=c.getItemValue(l,o);this.triggerOnChange(d,t,{item:l}),this.triggerOnSelect(t,{item:l})}s&&this.togglePopup(t),this.applyState(t)},setValidity(){this.input&&this.input.setCustomValidity&&this.input.setCustomValidity(this.validity().valid?"":this.$props.validationMessage||A)},handleItemClick(e,t){this.base.handleItemClick(e,t),this.valueDuringOnChange=void 0},onChangeHandler(e){const i=this.base.initState(),s=e.target,n=s.value,o=s.selectionEnd===n.length;i.event=e;const l=this.suggested,d=this.computedValue(),u=d&&l&&d.substring(0,d.length-l.length),h=u&&u===n,p=u&&u.length>n.length,{suggest:g}=this.$props,f=this.$props.opened!==void 0?this.$props.opened:this.currentOpened;if(g!==void 0&&g!==!1){h||p||!o?this.suggested="":this.suggestValue(n);const v=n+this.suggested,k={userInput:n,value:this.suggested};this.triggerOnChange(v,i,{suggestion:k})}else this.suggested="",this.triggerOnChange(n,i);(!f&&n||f&&!n)&&this.togglePopup(i),i.data.focusedItem=void 0,this.prevData&&this.prevData.length!==this.$props.dataItems&&(i.data.group=void 0),this.applyState(i)},clearButtonClick(e){const i=this.base.initState(),s=this.$props.opened!==void 0?this.$props.opened:this.currentOpened;i.event=e;const n="";this.suggested="",this.triggerOnChange(n,i),this.$data.focusedItem!==void 0&&(i.data.focusedItem=void 0),s&&this.togglePopup(i),this.applyState(i)},onInputKeyDown(e){this.isScrolling&&(this.isScrolling=!1);const t=e.keyCode,i=this.$props.opened!==void 0?this.$props.opened:this.currentOpened,s=this.base.initState(),n=this.computedValue();s.event=e;const o=()=>{i&&e.preventDefault()};t===a.Keys.enter||i&&t===a.Keys.esc||e.altKey&&t===a.Keys.up?(o(),this.applyInputValue(e.currentTarget.value,s,e.keyCode)):!e.altKey&&(t===a.Keys.up||t===a.Keys.down)?(o(),this.onNavigate(s,t)):!i&&t===a.Keys.esc?this.clearButtonClick(e):!i&&n&&e.altKey&&t===a.Keys.down&&(this.togglePopup(s),this.applyState(s))},handleBlur(e){if(this.currentFocused){const t=this.base.initState();t.data.focused=!1,t.events.push({type:"blur"}),t.event=e,this.applyInputValue(e.currentTarget.value,t),this.currentFocused=!1}},triggerOnChange(e,t,i){this.computedValue()===e&&!i||(t.data.currentValue=e,this.valueDuringOnChange=e,t.events.push({type:"change",...i||{}}))},triggerOnSelect(e,t){e.events.push({type:"select",...t||{}})},applyState(e){this.base.applyState(e),this.valueDuringOnChange=void 0},suggestValue(e){if(this.suggested="",e){const{dataItems:t=[],textField:i}=this.$props,s=t[c.itemIndexStartsWith(t,e,i)];if(s){const n=c.getItemValue(s,i);e.toLowerCase()!==n.toLowerCase()&&(this.suggested=n.substring(e.length))}}},focusedIndex(e){const{dataItems:t=[],textField:i,focusedItemIndex:s}=this.$props,n=e!==void 0?e:this.computedValue();return this.$data.focusedItem!==void 0?t.findIndex(o=>c.areSame(o,this.$data.focusedItem,i)):s?s(t,n,i):Math.max(0,t.indexOf(c.getFocusedItem(t,n,i)))},repositionPopup(){this.base.repositionPopup()},onScroll(e){var h;this.isScrolling=!0;const t=this.base.initState(),{list:i}=this.base,{groupField:s}=this.$props;let{dataItems:n=[]}=this.$props;if(!s||!n.length)return;let o=this.itemHeight||i.children&&((h=i.querySelector(".k-list-item"))==null?void 0:h.offsetHeight)||0;const d=e.target.scrollTop;s&&(n=this.base.getGroupedDataModernMode(n,s));let u=n[0][s];o===0&&(o=28);for(let p=1;p<n.length&&!(o*p>d);p++)n[p]&&n[p][s]&&(u=n[p][s]);u!==this.group&&(t.data.group=u,this.applyState(t))}},render(){const{dir:e,disabled:t,label:i,size:s,rounded:n,fillMode:o,style:l,loading:d,suggest:u,inputAttributes:h}=this.$props,p=!this.$props.validityStyles||this.validity().valid,g=this.currentFocused,f=this.base,v=this.computedValue(),k=!d&&!!v&&!t,O=this.$props.id||this.inputId,C=Object.assign({},{animate:!0,height:"200px"},this.$props.popupSettings);typeof u=="string"&&(this.suggested=u);const B=function(I,m){const{placeholder:y,tabIndex:S,readonly:$}=this.$props,V=this.$props.opened!==void 0?this.$props.opened:this.currentOpened;return r.createVNode(w.SearchBar,{id:m,placeholder:y,tabIndex:S,accessKey:this.$props.accessKey,value:I,suggestedText:this.suggested,focused:g,name:this.$props.name,ref:b=>{this.inputRef=b},onKeydown:this.onInputKeyDown,onChange:this.onChangeHandler,onFocus:f.handleFocus,onBlur:this.handleBlur,disabled:t,readOnly:$,expanded:V,owns:f.listBoxId,activedescendant:"option-"+f.guid+"-"+this.focusedIndex(),onClearbuttonclick:this.clearButtonClick,ariaLabelledBy:this.$props.ariaLabelledBy,ariaDescribedBy:this.$props.ariaDescribedBy,ariaLabel:this.$props.ariaLabel,inputAttributes:h},null)},D=function(){const{textField:I,groupField:m}=this.$props;let y=this.$props.dataItems||[];const S=a.templateRendering.call(this,this.$props.itemRender,a.getListeners.call(this)),$=a.templateRendering.call(this,this.$props.groupHeaderItemRender,a.getListeners.call(this)),V=a.templateRendering.call(this,this.$props.listNoDataRender,a.getListeners.call(this)),b=this.$props.opened!==void 0?this.$props.opened:this.currentOpened;return m&&(y=this.base.getGroupedDataModernMode(y,m)),r.createVNode(L.List,{id:f.listBoxId,show:b,dataItems:y.slice(),focusedIndex:this.focusedIndex(),value:v,textField:I,valueField:I,highlightSelected:!1,optionsGuid:f.guid,ref:"list",wrapperStyle:{maxHeight:C.height},wrapperCssClass:"k-list-content",onListclick:this.handleItemClick,itemRender:S,groupHeaderItemRender:$,noDataRender:V,groupField:m,onScroll:this.onScroll},null)},R=function(){const I=a.templateRendering.call(this,this.$props.header,a.getListeners.call(this)),m=a.templateRendering.call(this,this.$props.footer,a.getListeners.call(this)),y=a.templateRendering.call(this,this.$props.groupStickyHeaderItemRender,a.getListeners.call(this)),S=a.getTemplate.call(this,{h:r.h,template:I}),$=a.getTemplate.call(this,{h:r.h,template:m}),V=this.$props.opened!==void 0?this.$props.opened:this.currentOpened,b=this.$props.dataItems||[];return this.group===void 0&&this.$props.groupField!==void 0&&(this.group=c.getItemValue(b[0],this.$props.groupField)),r.createVNode(M.ListContainer,{onMousedown:N=>N.preventDefault(),width:this.popupWidth,ref:"container",popupSettings:{...C,anchor:this.anchor,show:V,popupClass:a.classNames(C.popupClass,"k-list",{[`k-list-${F[s]||s}`]:s}),className:a.classNames("k-list-container",C.className)},dir:e!==void 0?e:this.base.dirCalculated},{default:()=>[S&&r.createVNode("div",{class:"k-list-header"},[S]),this.group&&b.length!==0&&r.createVNode(K.GroupStickyHeader,{group:this.group,render:y},null),D.call(this),$&&r.createVNode("div",{class:"k-list-footer"},[$])]})},x=r.createVNode("span",{class:a.classNames("k-autocomplete k-input",{[`k-input-${F[s]||s}`]:s,[`k-rounded-${q[n]||n}`]:n,[`k-input-${o}`]:o,"k-invalid":!p,"k-focus":g&&!t,"k-loading":d,"k-required":this.required,"k-disabled":t}),ref:a.setRef(this,"kendoAnchor"),style:i?{...l,width:void 0}:l,dir:e},[B.call(this,v||"",O),k&&!d&&r.createVNode(H.ClearButton,{onClearclick:this.clearButtonClick},null),r.createVNode("span",{class:d?"k-input-loading-icon k-icon k-i-loading":void 0},null),R.call(this)]);return i?r.createVNode("span",{class:this.spanClassNames,dir:this.$props.dir},[x,this.$props.label?O?r.createVNode("label",{for:O,class:"k-floating-label"},[this.$props.label]):r.createVNode("span",{class:"k-label"},[this.$props.label]):null]):x}});exports.AutoComplete=P;
|
|
@@ -390,7 +390,7 @@ const {
|
|
|
390
390
|
loading: a,
|
|
391
391
|
suggest: r,
|
|
392
392
|
inputAttributes: p
|
|
393
|
-
} = this.$props, l = !this.$props.validityStyles || this.validity().valid, h = this.currentFocused, c = this.base, k = this.computedValue(), V = !a && !!k, F = this.$props.id || this.inputId, x = Object.assign({}, {
|
|
393
|
+
} = this.$props, l = !this.$props.validityStyles || this.validity().valid, h = this.currentFocused, c = this.base, k = this.computedValue(), V = !a && !!k && !t, F = this.$props.id || this.inputId, x = Object.assign({}, {
|
|
394
394
|
animate: !0,
|
|
395
395
|
height: "200px"
|
|
396
396
|
}, this.$props.popupSettings);
|
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 r=require("vue"),ge=require("../common/DropDownBase.js"),G=require("../common/GroupStickyHeader.js"),l=require("@progress/kendo-vue-common"),_=require("@progress/kendo-vue-buttons"),a=require("../common/utils.js"),me=require("../common/SearchBar.js"),ve=require("../common/ListContainer.js"),be=require("../common/List.js"),Ie=require("../common/ClearButton.js"),Se=require("@progress/kendo-vue-intl"),K=require("../messages/main.js"),W=require("@progress/kendo-svg-icons"),U=require("../common/constants.js"),ye=require("@progress/kendo-vue-layout"),ke=require("../common/ListFilter.js"),{sizeMap:j,roundedMap:xe}=l.kendoThemeMaps;function Ve(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!r.isVNode(e)}const $e="Please enter a valid value!",Ce=r.defineComponent({name:"KendoComboBox",model:{event:"changemodel"},emits:{changemodel:e=>!0,"update:modelValue":e=>!0,filterchange:e=>!0,pagechange:e=>!0,change:e=>!0,focus:e=>!0,blur:e=>!0,open:e=>!0,close:e=>!0,scroll:e=>!0},props:{id:String,dataItemKey:{type:[Object,String]},defaultValue:{type:[String,Object,Number,Boolean],default:void 0},name:String,modelValue:{type:[String,Object,Number,Boolean],default:void 0},value:{type:[String,Object,Number,Boolean],default:void 0},label:{type:String},placeholder:String,required:{type:Boolean,default:!1},valid:{type:Boolean,default:void 0},validationMessage:{type:String,default:void 0},validityStyles:{type:Boolean,default:!0},iconClassName:String,opened:{type:Boolean,default:void 0},disabled:Boolean,dir:{type:String,default:void 0},tabIndex:{type:Number,default:0},accessKey:String,dataItems:Array,textField:String,className:String,loading:Boolean,popupSettings:{type:Object,default:function(){return{animate:!0,height:"200px",anchor:""}}},itemRender:[String,Function,Object],groupHeaderItemRender:[String,Function,Object],groupStickyHeaderItemRender:[String,Function,Object],listNoDataRender:[String,Function,Object],focusedItemIndex:Function,header:[String,Function,Object],footer:[String,Function,Object],filterable:Boolean,filter:{type:String,default:void 0},virtual:{type:Object,default:void 0},suggest:{type:Boolean,default:!1},allowCustom:{type:Boolean,default:!1},clearButton:{type:Boolean,default:!0},ariaLabel:{type:String,default:void 0},ariaLabelledBy:String,ariaDescribedBy:String,valueField:String,valuePrimitive:Boolean,rounded:{type:String,validator:function(e){return["none","small","medium","large","full"].includes(e)}},fillMode:{type:String,validator:function(e){return["solid","flat","outline"].includes(e)}},size:{type:String,validator:function(e){return["small","medium","large"].includes(e)}},groupField:{type:String},adaptive:{type:Boolean,default:void 0},adaptiveTitle:{type:String,default:void 0},onFilterchange:Function,inputAttributes:Object},inject:{kendoLocalizationService:{default:null},adaptiveModeBreakpoints:{default:{small:U.MOBILE_SMALL_DEVICE,medium:U.MOBILE_MEDIUM_DEVICE}}},data(){return{hasMounted:!1,currentText:"",currentValue:"",currentFocused:!1,currentOpened:!1,searchState:{word:"",last:""},_skipFocusEvent:!1,valueDuringOnChange:{},_navigated:!1,suggested:"",group:void 0,isScrolling:!1,itemHeight:0,state:void 0,popupWidth:void 0,windowWidth:0}},created(){this.observer=null,this.valueDuringOnChange=void 0,this.currentText=void 0,this.currentValue=void 0,this.currentFocused=void 0,this.currentOpened=void 0,this.prevCurrentValue=this.computedValue(),this.base=new ge(this),this.anchor=l.guid(),this.inputId=l.guid()},setup(){const e=r.ref(null),t=r.ref(null),i=r.ref(null),s=r.inject("kendoLocalizationService",{});return{inputRef:e,elementRef:t,kendoAnchorRef:i,kendoLocalizationService:s}},mounted(){this.observer=l.canUseDOM&&window.ResizeObserver&&new ResizeObserver(this.calculateMedia),document!=null&&document.body&&this.observer&&this.observer.observe(document.body),this.hasMounted=!0,this.input=this.inputRef.input,this.base.wrapper=l.getRef(this,"kendoAnchor"),this.element=l.getRef(this,"kendoAnchor"),this.base.didMount(),this.setValidity()},updated(){var g;const{dataItems:e=[],dataItemKey:t,virtual:i,groupField:s,textField:n}=this.$props,p=this.isOpen,o=this.prevOpened!==void 0?this.prevOpened:this.prevCurrentOpened,c=!o&&p,h=this.$refs.list,v=this.$refs.scrollElement,d=this.computedValue();if(this.valueOnDidUpdate=d,h&&(this.base.vs.list=h.list,this.base.list=h.list),v&&(this.base.vs.scrollElement=v),h&&e.length&&this.base.vs.scrollerRef(h.$el),i&&this.virtualTotalHasChanged)this.base.vs.calcScrollElementHeight(),this.base.vs.reset(),this.virtualTotalHasChanged=!1;else{const f=this.prevCurrentValue;let u=e.findIndex(m=>a.areSame(m,d,t));if(u===-1&&!t&&n&&d){const m=a.getItemValue(d,n);u=e.findIndex(y=>a.getItemValue(y,n)===m)}if(s&&u!==-1){const m=this.base.getGroupedDataModernMode(e,s),y=a.getItemValue(d,n);u=(g=m==null?void 0:m.findIndex($=>a.getItemValue($,n)===y))!=null?g:u}const k=!a.areSame(f,d,t);if(c&&i)this.base.scrollToVirtualItem(i,u),this.prevCurrentOpened=!0;else if(c&&!i)e&&e.length!==0&&this.base.resetGroupStickyHeader(e[0][s],this),this.base.scrollToItem(u),this.prevCurrentOpened=!0;else if(p&&o&&d&&k)this.base.scrollToItem(u);else if(p&&!d&&!this.isScrolling){let m=this.getFocusedIndex();if(s&&m!==-1&&e.length>0){const y=e[m][n];m=this.base.getGroupedDataModernMode(e,s).findIndex(O=>O[n]===y)}this.base.scrollToItem(m)}}c&&this.input&&this.input.focus(),this.prevCurrentValue=this.computedValue(),this.setValidity()},watch:{currentOpened:function(e,t){this.prevCurrentOpened=t},opened:function(e,t){this.prevOpened=t},virtual:function(e,t){e&&t&&e.total!==t.total&&(this.virtualTotalHasChanged=!0),this.virtualHasChanged=!0},isOpen:function(){setTimeout(()=>{const e=document.querySelector(".k-list-item");this.itemHeight=this.base.getListItemHeight(e)},100)}},computed:{index(){const{dataItems:e=[],dataItemKey:t}=this.$props,i=this.computedValue();return e.findIndex(s=>a.areSame(s,i,t))},spanClassNames(){const e=!this.hasMounted||!this.$props.validityStyles||this.validity().valid;return{"k-floating-label-container":!0,"k-focus":this.currentFocused,"k-empty":!this.computedValue(),"k-invalid":!e&&e!==void 0,"k-rtl":this.$props.dir==="rtl"}},isOpen(){return this.$props.opened!==void 0?this.$props.opened:this.currentOpened},animationStyles(){return this.windowWidth<=this.adaptiveModeBreakpoints.small?{top:0,width:"100%",height:"100%"}:void 0},classNameAdaptive(){return this.windowWidth<=this.adaptiveModeBreakpoints.small?"k-adaptive-actionsheet k-actionsheet-fullscreen":"k-adaptive-actionsheet k-actionsheet-bottom"},adaptiveState(){return this.windowWidth<=this.adaptiveModeBreakpoints.medium&&this.$props.adaptive}},methods:{focus(){this.input&&this.input.focus()},computedValue(){let e;return this.valueDuringOnChange!==void 0?e=this.valueDuringOnChange:this.$props.value!==void 0?e=this.$props.value:this.$props.modelValue!==void 0?e=this.$props.modelValue:this.currentValue!==void 0?e=this.currentValue:this.$props.defaultValue!==void 0&&(e=this.$props.defaultValue),this.valuePrimitive&&this.findByFieldValue(this.valueField,e)||e},findByFieldValue(e,t){const i=this.dataItems.findIndex(s=>a.getItemValue(s,e)===t);return this.dataItems[i]},primitiveValue(){const e=this.computedValue();return this.valuePrimitive&&e&&typeof e=="object"?a.getItemValue(e,this.valueField):e},validity(){const e=this.$props.validationMessage!==void 0,t=!this.$props.required||this.computedValue()!==null&&this.computedValue()!==""&&this.computedValue()!==void 0,i=this.$props.valid!==void 0?this.$props.valid:t;return{customError:e,valid:i,valueMissing:this.computedValue()===null}},handleItemSelect(e,t){const{dataItems:i=[],virtual:s,dataItemKey:n}=this.$props,p=s?s.skip:0,o=i[e-p],c=!a.areSame(o,this.computedValue(),n);this.triggerOnChange(o,t),this.currentText!==void 0&&(t.data.currentText=void 0),c&&this.base.triggerPageChangeCornerItems(o,t)},onNavigate(e,t){const{dataItems:i=[],virtual:s={skip:0},groupField:n,textField:p}=this.$props,o=this.$props.filter?this.$props.filter:this.currentText;let c=this.getFocusedIndex();const h=this.base.vs,v=this.computedValue();this.suggested="";const d=n?this.base.getGroupedDataModernMode(i,n):i;let g=c;if(n&&c!==-1&&c<i.length){const f=i[c];f&&(g=d.findIndex(u=>u[p]===f[p]))}if(c!==-1&&!a.isPresent(v))this.handleItemSelect(c,e);else if(o===""&&!a.isPresent(v))this.handleItemSelect(0,e);else{let f=s.skip+g,u=this.base.navigation.navigate({keyCode:t,current:f,max:(h.enabled?h.total:d.length)-1,min:0});if(u!==void 0&&n){const k=t===l.Keys.down||t===l.Keys.right||t===l.Keys.pageDown||t===l.Keys.end?1:-1;let m=0;for(;m<d.length;){const y=d[u-s.skip];if(y&&Object.keys(y).length===1&&y[n]!==void 0){if(u+=k,u<0||u>=d.length)return}else{const $=d[u-s.skip],O=i.findIndex(B=>B[p]===$[p]);O!==-1&&this.handleItemSelect(O+s.skip,e);return}m++}}else u!==void 0&&this.handleItemSelect(u,e)}},toggleBtnClick(e){const t=this.base.initState(),i=this.isOpen,s=this.adaptiveState;t.event=e,this.base.togglePopup(t),!i&&s&&this.base.filterChanged("",t),this.applyState(t)},applyValueOnEnter(e,t){const{dataItems:i=[],textField:s,allowCustom:n,valuePrimitive:p}=this.$props,o=this.isOpen,h=this.getSelectedItemText()===e?this.index:a.getItemIndexByText(i,e,s),v=h!==-1;let d;if(this.suggested="",v)d=i[h];else if(n)d=s!==void 0&&!p?{[s]:e}:e;else return this.selectFocusedItem(e,t);this.triggerOnChange(d,t),o&&this.base.togglePopup(t),this.$props.filter===void 0&&this.currentText!==void 0&&(t.data.currentText=void 0),this.applyState(t)},applyValueOnRejectSuggestions(e,t){const{dataItems:i=[],textField:s,allowCustom:n,valuePrimitive:p}=this.$props,o=this.isOpen,c=this.getSelectedItemText();if(this.suggested="",e===c||e===""&&!a.isPresent(c))return o&&!this.adaptiveState&&this.base.togglePopup(t),this.applyState(t);const h=a.getItemIndexByText(i,e,s,!0),v=h!==-1;let d=null;v?d=i[h]:n&&e&&(s&&!p?d={[s]:e}:d=e),this.triggerOnChange(d,t),this.currentText!==void 0&&(t.data.currentText=void 0,this.base.filterChanged("",t)),o&&!this.adaptiveState&&this.base.togglePopup(t),this.applyState(t)},selectFocusedItem(e,t){const i=this.isOpen,{dataItems:s=[],textField:n,virtual:p={skip:0},focusedItemIndex:o=a.itemIndexStartsWith}=this.$props,c=p.skip,h=e===""&&c===0?0:o(s,e,n);return h!==-1?this.handleItemSelect(h+c,t):(this.triggerOnChange(null,t),this.currentText!==void 0&&(t.data.currentText=void 0)),i&&this.base.togglePopup(t),this.applyState(t)},handleItemClick(e,t){this.base.handleItemClick(e,t),this.valueDuringOnChange=void 0},handleFocus(e){this.$emit("focus",e)},handleBlur(e){if(this.currentFocused){const t=this.base.initState();t.data.currentFocused=!1,t.events.push({type:"blur"}),t.event=e,this.applyValueOnRejectSuggestions(e.currentTarget.value,t)}},onInputKeyDown(e){this.isScrolling&&(this.isScrolling=!1);const t=e.keyCode,i=this.isOpen,s=this.base.initState();if(s.event=e,!e.altKey&&(t===l.Keys.up||t===l.Keys.down)){e.preventDefault(),this.onNavigate(s,t),this.applyState(s);return}const n=()=>{e.preventDefault(),this.base.togglePopup(s),this.applyState(s)};i?e.altKey&&t===l.Keys.up?n():t===l.Keys.enter?(e.preventDefault(),this.applyValueOnEnter(e.currentTarget.value,s)):t===l.Keys.esc&&(this.adaptiveState&&this.toggleBtnClick(e),n()):e.altKey&&t===l.Keys.down?n():t===l.Keys.esc&&this.applyValueOnRejectSuggestions(e.currentTarget.value,s)},inputOnChange(e){const t=this.base.initState();t.event=e;const i=this.isOpen,s=e.currentTarget,n=s.value;if(this.$props.suggest){const p=s.selectionEnd===n.length;let o=this.$props.filter!==void 0?this.$props.filter:this.currentText;a.isPresent(o)||(o=a.getItemValue(this.computedValue(),this.$props.textField)||"");const c=o&&o===n,h=o&&o.length>n.length;c||h||!p?this.suggested="":this.suggestValue(n)}this.$props.filter===void 0&&(t.data.currentText=n),this.currentFocusedItem!==void 0&&(t.data.focusedItem=void 0),i||this.base.togglePopup(t),this.base.filterChanged(n,t),this.$props.filterable&&(t.data.group=void 0),this.applyState(t)},clearButtonClick(e){const t=this.base.initState();t.event=e,e.stopPropagation(),this.suggested="",this.base.filterChanged("",t),this.$props.filter===void 0&&this.currentText!==void 0&&(t.data.currentText=void 0),this.triggerOnChange(null,t),this.isOpen&&this.base.togglePopup(t),this.applyState(t)},getFocusedIndex(){const e=this.computedValue(),{dataItems:t=[],textField:i,dataItemKey:s,virtual:n={skip:0},focusedItemIndex:p=a.itemIndexStartsWith}=this.$props,o=this.$props.filter?this.$props.filter:this.currentText;if(a.isPresent(e)&&o===void 0){let c=t.findIndex(h=>a.areSame(h,e,s));if(c===-1&&!s&&i){const h=a.getItemValue(e,i);c=t.findIndex(v=>a.getItemValue(v,i)===h)}return c}else return o?p(t,o,i):n.skip===0?0:-1},suggestValue(e){const{dataItems:t,textField:i}=this.$props;this.suggested=a.suggestValue(e,t,i)},setValidity(){this.input&&this.input.setCustomValidity&&this.input.setCustomValidity(this.validity().valid?"":this.$props.validationMessage||$e)},compareValues(e,t){return this.$props.valuePrimitive&&(typeof e!="object"||e===null)&&(typeof t!="object"||t===null)?e===t:a.areSame(e,t,this.$props.dataItemKey)},triggerOnChange(e,t){const i=this.computedValue();!a.isPresent(i)&&!a.isPresent(e)||this.compareValues(i,e)||(this.$props.value===void 0&&(this.currentValue=e),this.valueDuringOnChange=e,t.events.push({type:"change"}))},applyState(e){this.base.applyState(e),this.valueDuringOnChange=void 0},calculateMedia(e){for(let t of e)this.windowWidth=t.target.clientWidth},repositionPopup(){this.base.repositionPopup()},onScroll(e){this.isScrolling=!0;const{vs:t,list:i}=this.base;t.scrollHandler(e);const s=this.base.initState(),{groupField:n}=this.$props;let{dataItems:p=[]}=this.$props,o;if(!n||!p.length)return;const h=e.target.scrollTop-t.skip*(t.itemHeight||0);if(n){p=this.base.getGroupedDataModernMode(p,n),o=p[0][n];let v=0,d=0,g=0;if(i&&!t.enabled){const f=i.querySelector(".k-list-item"),u=i.querySelector(".k-list-group-item");d=(f==null?void 0:f.offsetHeight)||0,g=(u==null?void 0:u.offsetHeight)||d}else d=t.itemHeight||0,g=d;for(let f=0;f<p.length;f++){const u=p[f],k=u&&Object.keys(u).length===1&&u[n]!==void 0,m=k?g:d;if(k&&v<=h&&(o=u[n]),v+=m,v>h)break}}o!==this.group&&(s.data.group=o,this.applyState(s))},getInputText(e,t){return a.isPresent(e)&&e!==""?String(e):a.isPresent(t)?String(t):""},getSelectedItemText(){const{textField:e,valuePrimitive:t}=this.$props,i=this.computedValue();if(a.isPresent(i))return t?i&&typeof i=="object"?a.getItemValue(i,e):typeof i=="string"?i!==""?i:void 0:typeof i=="number"||typeof i=="boolean"?String(i):void 0:a.getItemValue(i,e)}},render(){let{dir:e,disabled:t,clearButton:i,label:s,textField:n,className:p,style:o,loading:c,icon:h,svgIcon:v,iconClassName:d,virtual:g,size:f,fillMode:u,rounded:k,adaptiveTitle:m,header:y,footer:$,groupStickyHeaderItemRender:O,placeholder:B,inputAttributes:Y}=this.$props;const J=this.currentFocused,Q=!this.$props.validityStyles||this.validity().valid,R=this.$props.filter!==void 0?this.$props.filter:this.currentText,E=this.getSelectedItemText(),A=this.getInputText(R,E),D=this.computedValue(),X=this.$props.valuePrimitive?!!this.findByFieldValue(this.valueField,D)||this.$props.allowCustom&&a.isPresent(D)&&D!=="":a.isPresent(D),Z=i&&(!!A||X),C=this.base,V=C.vs,P=this.$props.id||this.inputId,M=Object.assign({},{animate:!0,height:"200px"},this.$props.popupSettings),ee=Se.provideLocalizationService(this).toLanguageString(K.expandButton,K.messages[K.expandButton]),F=this.isOpen,N=this.adaptiveState;V.enabled=g!==void 0,g!==void 0&&(V.skip=g.skip,V.total=g.total,V.pageSize=g.pageSize),this.group===void 0&&this.$props.groupField!==void 0&&(this.group=a.getItemValue(this.$props.dataItems[0],this.$props.groupField));const te=b=>{const I=this.base.initState();I.event=b;const S=b.event.target.value;I.data.text=S,this.base.filterChanged(S,I),this.applyState(I)},ie=()=>[r.createVNode("div",{class:"k-actionsheet-titlebar-group k-hbox"},[r.createVNode("div",{class:"k-actionsheet-title"},[r.createVNode("div",{class:"k-text-center"},[m]),B&&r.createVNode("div",{class:"k-actionsheet-subtitle k-text-center"},[B])]),r.createVNode("div",{class:"k-actionsheet-actions"},[r.createVNode(_.Button,{tabIndex:5,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:this.toggleBtnClick,icon:"x",svgIcon:W.xIcon},null)])]),r.createVNode("div",{class:"k-actionsheet-titlebar-group k-actionsheet-filter"},[le.call(this)])],se=l.templateRendering.call(this,ie,l.getListeners.call(this)),ne=()=>{const b=C.getTemplateDef.call(this,y,r.h),I=C.getTemplateDef.call(this,$,r.h),S=l.templateRendering.call(this,O,l.getListeners.call(this)),x=this.$props.dataItems||[];return r.createVNode("div",{class:"k-list-container"},[b&&r.createVNode("div",{class:"k-list-header"},[b]),r.createVNode("div",{class:l.classNames("k-list",{[`k-list-${j[f]||f}`]:N?!1:f,"k-list-lg":!!N,"k-virtual-list":V.enabled})},[y&&r.createVNode("div",{class:"k-list-header"},[y]),this.group&&x.length!==0&&r.createVNode(G.GroupStickyHeader,{group:this.group,render:S},null),q.call(this),I&&r.createVNode("div",{class:"k-list-footer"},[I])])])},ae=l.templateRendering.call(this,ne,l.getListeners.call(this)),re=function(){return r.createVNode(ye.ActionSheet,{expand:F,animation:!0,animationStyles:this.animationStyles,className:this.classNameAdaptive,contentClassName:"!k-overflow-hidden",header:se,content:ae,onClose:this.toggleBtnClick,navigatableElements:["input.k-input-inner",".k-actionsheet-actions > button"]},null)},le=function(){const I=this.base.initState().data.text;return r.createVNode(ke.ListFilter,{adaptiveMode:!0,value:I,ref:"filterInput",onChange:S=>te(S),onKeydown:this.onInputKeyDown,size:this.$props.size,rounded:this.$props.rounded,fillMode:this.$props.fillMode},null)},q=function(){let b;const{dataItemKey:I,groupField:S}=this.$props;let x=this.$props.dataItems||[];const T=l.templateRendering.call(this,this.$props.itemRender,l.getListeners.call(this)),L=l.templateRendering.call(this,this.$props.groupHeaderItemRender,l.getListeners.call(this)),H=l.templateRendering.call(this,this.$props.listNoDataRender,l.getListeners.call(this));g||(g={skip:0});const w=g.skip,pe=`translateY(${V.translate}px)`,he=F?this.getFocusedIndex():void 0,fe=a.isPresent(R)&&R!==E?null:this.computedValue();return S&&(x=this.base.getGroupedDataModernMode(x,S)),r.createVNode(be.List,{id:C.listBoxId,show:F,dataItems:x,focusedIndex:he,value:fe,textField:n,valueField:I,optionsGuid:C.guid,ref:"list",wrapperStyle:{maxHeight:N?void 0:M.height},wrapperCssClass:l.classNames("k-list-content",{"k-list-scroller":!this.$props.virtual}),listStyle:V.enabled?{transform:pe}:void 0,key:"listkey",skip:w,onListclick:this.handleItemClick,itemRender:T,groupHeaderItemRender:L,noDataRender:H,groupField:S,onScroll:this.onScroll},Ve(b=oe.call(this))?b:{default:()=>[b]})},oe=function(){return V.enabled&&r.createVNode("div",{ref:"scrollElement",key:"scrollElementKey"},null)},de=function(){const b=l.templateRendering.call(this,this.$props.groupStickyHeaderItemRender,l.getListeners.call(this)),I=C.getTemplateDef.call(this,y),S=C.getTemplateDef.call(this,$),x=this.$props.dataItems||[];return this.group===void 0&&this.$props.groupField!==void 0&&(this.group=a.getItemValue(x[0],this.$props.groupField)),r.createVNode(ve.ListContainer,{ref:"container",onMousedown:T=>T.preventDefault(),width:this.popupWidth,popupSettings:{...M,anchor:this.anchor,show:F,popupClass:l.classNames(M.popupClass,"k-list",{[`k-list-${j[f]||f}`]:f,"k-virtual-list":this.base.vs.enabled}),className:l.classNames("k-list-container",M.className)},dir:e!==void 0?e:this.base.dirCalculated},{default:()=>[I&&r.createVNode("div",{class:"k-list-header"},[I]),this.group&&x.length!==0&&r.createVNode(G.GroupStickyHeader,{group:this.group,render:b},null),q.call(this),S&&r.createVNode("div",{class:"k-list-footer"},[S])]})},ue=function(b,I){const{tabIndex:S,dataItems:x=[],dataItemKey:T}=this.$props;g||(g={skip:0});const L=this.computedValue(),H=Math.max(0,x.findIndex(w=>a.areSame(w,L,T)));return this.suggested&&!a.areSame(this.valueOnDidUpdate,L,T)&&(this.suggested=""),r.createVNode(me.SearchBar,{id:I,placeholder:B,tabIndex:S||void 0,accessKey:this.$props.accessKey,value:b+this.suggested,suggestedText:this.suggested,ref:w=>{this.inputRef=w},onKeydown:this.onInputKeyDown,onChange:this.inputOnChange,onFocus:this.base.handleFocus,onBlur:this.handleBlur,disabled:t,expanded:F,owns:this.base.listBoxId,activedescendant:this.base.guid+"-"+(H+g.skip),ariaLabelledBy:this.$props.ariaLabelledBy,ariaDescribedBy:this.$props.ariaDescribedBy,ariaLabel:this.$props.ariaLabel,inputAttributes:Y},null)},ce=function(){return r.createVNode("span",{class:l.classNames("k-combobox k-input",{[`k-input-${j[f]||f}`]:f,[`k-rounded-${xe[k]||k}`]:k,[`k-input-${u}`]:u,"k-invalid":!Q,"k-loading":c,"k-required":this.required,"k-disabled":t,"k-focus":J&&!t},p),ref:l.setRef(this,"kendoAnchor"),style:s?{...o,width:void 0}:o,dir:e},[ue.call(this,A||"",P),Z&&!c&&r.createVNode(Ie.ClearButton,{onClearclick:this.clearButtonClick,key:"clearbutton"},null),c&&r.createVNode(l.Icon,{name:"loading",class:"k-input-loading-icon",key:"loading"},null),r.createVNode(_.Button,{type:"button",tabIndex:-1,"aria-label":ee,size:f,fillMode:u,rounded:null,class:"k-input-button",icon:h||"caret-alt-down",svgIcon:v||W.caretAltDownIcon,iconClass:d,onClick:this.toggleBtnClick,onMousedown:b=>b.preventDefault()},null),!N&&de.call(this)])},z=[r.h(ce.call(this),{...this.$attrs}),N&&re.call(this)];return s?r.createVNode("span",{class:this.spanClassNames,onFocusin:this.handleFocus,dir:this.$props.dir},[z,this.$props.label?P?r.createVNode("label",{for:P,class:"k-floating-label"},[this.$props.label]):r.createVNode("span",{class:"k-label"},[this.$props.label]):null]):z}});exports.ComboBox=Ce;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue"),ge=require("../common/DropDownBase.js"),G=require("../common/GroupStickyHeader.js"),l=require("@progress/kendo-vue-common"),_=require("@progress/kendo-vue-buttons"),a=require("../common/utils.js"),me=require("../common/SearchBar.js"),ve=require("../common/ListContainer.js"),be=require("../common/List.js"),Ie=require("../common/ClearButton.js"),Se=require("@progress/kendo-vue-intl"),K=require("../messages/main.js"),W=require("@progress/kendo-svg-icons"),U=require("../common/constants.js"),ye=require("@progress/kendo-vue-layout"),ke=require("../common/ListFilter.js"),{sizeMap:j,roundedMap:xe}=l.kendoThemeMaps;function Ve(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!r.isVNode(e)}const $e="Please enter a valid value!",Ce=r.defineComponent({name:"KendoComboBox",model:{event:"changemodel"},emits:{changemodel:e=>!0,"update:modelValue":e=>!0,filterchange:e=>!0,pagechange:e=>!0,change:e=>!0,focus:e=>!0,blur:e=>!0,open:e=>!0,close:e=>!0,scroll:e=>!0},props:{id:String,dataItemKey:{type:[Object,String]},defaultValue:{type:[String,Object,Number,Boolean],default:void 0},name:String,modelValue:{type:[String,Object,Number,Boolean],default:void 0},value:{type:[String,Object,Number,Boolean],default:void 0},label:{type:String},placeholder:String,required:{type:Boolean,default:!1},valid:{type:Boolean,default:void 0},validationMessage:{type:String,default:void 0},validityStyles:{type:Boolean,default:!0},iconClassName:String,opened:{type:Boolean,default:void 0},disabled:Boolean,dir:{type:String,default:void 0},tabIndex:{type:Number,default:0},accessKey:String,dataItems:Array,textField:String,className:String,loading:Boolean,popupSettings:{type:Object,default:function(){return{animate:!0,height:"200px",anchor:""}}},itemRender:[String,Function,Object],groupHeaderItemRender:[String,Function,Object],groupStickyHeaderItemRender:[String,Function,Object],listNoDataRender:[String,Function,Object],focusedItemIndex:Function,header:[String,Function,Object],footer:[String,Function,Object],filterable:Boolean,filter:{type:String,default:void 0},virtual:{type:Object,default:void 0},suggest:{type:Boolean,default:!1},allowCustom:{type:Boolean,default:!1},clearButton:{type:Boolean,default:!0},ariaLabel:{type:String,default:void 0},ariaLabelledBy:String,ariaDescribedBy:String,valueField:String,valuePrimitive:Boolean,rounded:{type:String,validator:function(e){return["none","small","medium","large","full"].includes(e)}},fillMode:{type:String,validator:function(e){return["solid","flat","outline"].includes(e)}},size:{type:String,validator:function(e){return["small","medium","large"].includes(e)}},groupField:{type:String},adaptive:{type:Boolean,default:void 0},adaptiveTitle:{type:String,default:void 0},onFilterchange:Function,inputAttributes:Object},inject:{kendoLocalizationService:{default:null},adaptiveModeBreakpoints:{default:{small:U.MOBILE_SMALL_DEVICE,medium:U.MOBILE_MEDIUM_DEVICE}}},data(){return{hasMounted:!1,currentText:"",currentValue:"",currentFocused:!1,currentOpened:!1,searchState:{word:"",last:""},_skipFocusEvent:!1,valueDuringOnChange:{},_navigated:!1,suggested:"",group:void 0,isScrolling:!1,itemHeight:0,state:void 0,popupWidth:void 0,windowWidth:0}},created(){this.observer=null,this.valueDuringOnChange=void 0,this.currentText=void 0,this.currentValue=void 0,this.currentFocused=void 0,this.currentOpened=void 0,this.prevCurrentValue=this.computedValue(),this.base=new ge(this),this.anchor=l.guid(),this.inputId=l.guid()},setup(){const e=r.ref(null),t=r.ref(null),i=r.ref(null),s=r.inject("kendoLocalizationService",{});return{inputRef:e,elementRef:t,kendoAnchorRef:i,kendoLocalizationService:s}},mounted(){this.observer=l.canUseDOM&&window.ResizeObserver&&new ResizeObserver(this.calculateMedia),document!=null&&document.body&&this.observer&&this.observer.observe(document.body),this.hasMounted=!0,this.input=this.inputRef.input,this.base.wrapper=l.getRef(this,"kendoAnchor"),this.element=l.getRef(this,"kendoAnchor"),this.base.didMount(),this.setValidity()},updated(){var g;const{dataItems:e=[],dataItemKey:t,virtual:i,groupField:s,textField:n}=this.$props,p=this.isOpen,o=this.prevOpened!==void 0?this.prevOpened:this.prevCurrentOpened,c=!o&&p,h=this.$refs.list,v=this.$refs.scrollElement,d=this.computedValue();if(this.valueOnDidUpdate=d,h&&(this.base.vs.list=h.list,this.base.list=h.list),v&&(this.base.vs.scrollElement=v),h&&e.length&&this.base.vs.scrollerRef(h.$el),i&&this.virtualTotalHasChanged)this.base.vs.calcScrollElementHeight(),this.base.vs.reset(),this.virtualTotalHasChanged=!1;else{const f=this.prevCurrentValue;let u=e.findIndex(m=>a.areSame(m,d,t));if(u===-1&&!t&&n&&d){const m=a.getItemValue(d,n);u=e.findIndex(y=>a.getItemValue(y,n)===m)}if(s&&u!==-1){const m=this.base.getGroupedDataModernMode(e,s),y=a.getItemValue(d,n);u=(g=m==null?void 0:m.findIndex($=>a.getItemValue($,n)===y))!=null?g:u}const k=!a.areSame(f,d,t);if(c&&i)this.base.scrollToVirtualItem(i,u),this.prevCurrentOpened=!0;else if(c&&!i)e&&e.length!==0&&this.base.resetGroupStickyHeader(e[0][s],this),this.base.scrollToItem(u),this.prevCurrentOpened=!0;else if(p&&o&&d&&k)this.base.scrollToItem(u);else if(p&&!d&&!this.isScrolling){let m=this.getFocusedIndex();if(s&&m!==-1&&e.length>0){const y=e[m][n];m=this.base.getGroupedDataModernMode(e,s).findIndex(O=>O[n]===y)}this.base.scrollToItem(m)}}c&&this.input&&this.input.focus(),this.prevCurrentValue=this.computedValue(),this.setValidity()},watch:{currentOpened:function(e,t){this.prevCurrentOpened=t},opened:function(e,t){this.prevOpened=t},virtual:function(e,t){e&&t&&e.total!==t.total&&(this.virtualTotalHasChanged=!0),this.virtualHasChanged=!0},isOpen:function(){setTimeout(()=>{const e=document.querySelector(".k-list-item");this.itemHeight=this.base.getListItemHeight(e)},100)}},computed:{index(){const{dataItems:e=[],dataItemKey:t}=this.$props,i=this.computedValue();return e.findIndex(s=>a.areSame(s,i,t))},spanClassNames(){const e=!this.hasMounted||!this.$props.validityStyles||this.validity().valid;return{"k-floating-label-container":!0,"k-focus":this.currentFocused,"k-empty":!this.computedValue(),"k-invalid":!e&&e!==void 0,"k-rtl":this.$props.dir==="rtl"}},isOpen(){return this.$props.opened!==void 0?this.$props.opened:this.currentOpened},animationStyles(){return this.windowWidth<=this.adaptiveModeBreakpoints.small?{top:0,width:"100%",height:"100%"}:void 0},classNameAdaptive(){return this.windowWidth<=this.adaptiveModeBreakpoints.small?"k-adaptive-actionsheet k-actionsheet-fullscreen":"k-adaptive-actionsheet k-actionsheet-bottom"},adaptiveState(){return this.windowWidth<=this.adaptiveModeBreakpoints.medium&&this.$props.adaptive}},methods:{focus(){this.input&&this.input.focus()},computedValue(){let e;return this.valueDuringOnChange!==void 0?e=this.valueDuringOnChange:this.$props.value!==void 0?e=this.$props.value:this.$props.modelValue!==void 0?e=this.$props.modelValue:this.currentValue!==void 0?e=this.currentValue:this.$props.defaultValue!==void 0&&(e=this.$props.defaultValue),this.valuePrimitive&&this.findByFieldValue(this.valueField,e)||e},findByFieldValue(e,t){const i=this.dataItems.findIndex(s=>a.getItemValue(s,e)===t);return this.dataItems[i]},primitiveValue(){const e=this.computedValue();return this.valuePrimitive&&e&&typeof e=="object"?a.getItemValue(e,this.valueField):e},validity(){const e=this.$props.validationMessage!==void 0,t=!this.$props.required||this.computedValue()!==null&&this.computedValue()!==""&&this.computedValue()!==void 0,i=this.$props.valid!==void 0?this.$props.valid:t;return{customError:e,valid:i,valueMissing:this.computedValue()===null}},handleItemSelect(e,t){const{dataItems:i=[],virtual:s,dataItemKey:n}=this.$props,p=s?s.skip:0,o=i[e-p],c=!a.areSame(o,this.computedValue(),n);this.triggerOnChange(o,t),this.currentText!==void 0&&(t.data.currentText=void 0),c&&this.base.triggerPageChangeCornerItems(o,t)},onNavigate(e,t){const{dataItems:i=[],virtual:s={skip:0},groupField:n,textField:p}=this.$props,o=this.$props.filter?this.$props.filter:this.currentText;let c=this.getFocusedIndex();const h=this.base.vs,v=this.computedValue();this.suggested="";const d=n?this.base.getGroupedDataModernMode(i,n):i;let g=c;if(n&&c!==-1&&c<i.length){const f=i[c];f&&(g=d.findIndex(u=>u[p]===f[p]))}if(c!==-1&&!a.isPresent(v))this.handleItemSelect(c,e);else if(o===""&&!a.isPresent(v))this.handleItemSelect(0,e);else{let f=s.skip+g,u=this.base.navigation.navigate({keyCode:t,current:f,max:(h.enabled?h.total:d.length)-1,min:0});if(u!==void 0&&n){const k=t===l.Keys.down||t===l.Keys.right||t===l.Keys.pageDown||t===l.Keys.end?1:-1;let m=0;for(;m<d.length;){const y=d[u-s.skip];if(y&&Object.keys(y).length===1&&y[n]!==void 0){if(u+=k,u<0||u>=d.length)return}else{const $=d[u-s.skip],O=i.findIndex(B=>B[p]===$[p]);O!==-1&&this.handleItemSelect(O+s.skip,e);return}m++}}else u!==void 0&&this.handleItemSelect(u,e)}},toggleBtnClick(e){const t=this.base.initState(),i=this.isOpen,s=this.adaptiveState;t.event=e,this.base.togglePopup(t),!i&&s&&this.base.filterChanged("",t),this.applyState(t)},applyValueOnEnter(e,t){const{dataItems:i=[],textField:s,allowCustom:n,valuePrimitive:p}=this.$props,o=this.isOpen,h=this.getSelectedItemText()===e?this.index:a.getItemIndexByText(i,e,s),v=h!==-1;let d;if(this.suggested="",v)d=i[h];else if(n)d=s!==void 0&&!p?{[s]:e}:e;else return this.selectFocusedItem(e,t);this.triggerOnChange(d,t),o&&this.base.togglePopup(t),this.$props.filter===void 0&&this.currentText!==void 0&&(t.data.currentText=void 0),this.applyState(t)},applyValueOnRejectSuggestions(e,t){const{dataItems:i=[],textField:s,allowCustom:n,valuePrimitive:p}=this.$props,o=this.isOpen,c=this.getSelectedItemText();if(this.suggested="",e===c||e===""&&!a.isPresent(c))return o&&!this.adaptiveState&&this.base.togglePopup(t),this.applyState(t);const h=a.getItemIndexByText(i,e,s,!0),v=h!==-1;let d=null;v?d=i[h]:n&&e&&(s&&!p?d={[s]:e}:d=e),this.triggerOnChange(d,t),this.currentText!==void 0&&(t.data.currentText=void 0,this.base.filterChanged("",t)),o&&!this.adaptiveState&&this.base.togglePopup(t),this.applyState(t)},selectFocusedItem(e,t){const i=this.isOpen,{dataItems:s=[],textField:n,virtual:p={skip:0},focusedItemIndex:o=a.itemIndexStartsWith}=this.$props,c=p.skip,h=e===""&&c===0?0:o(s,e,n);return h!==-1?this.handleItemSelect(h+c,t):(this.triggerOnChange(null,t),this.currentText!==void 0&&(t.data.currentText=void 0)),i&&this.base.togglePopup(t),this.applyState(t)},handleItemClick(e,t){this.base.handleItemClick(e,t),this.valueDuringOnChange=void 0},handleFocus(e){this.$emit("focus",e)},handleBlur(e){if(this.currentFocused){const t=this.base.initState();t.data.currentFocused=!1,t.events.push({type:"blur"}),t.event=e,this.applyValueOnRejectSuggestions(e.currentTarget.value,t)}},onInputKeyDown(e){this.isScrolling&&(this.isScrolling=!1);const t=e.keyCode,i=this.isOpen,s=this.base.initState();if(s.event=e,!e.altKey&&(t===l.Keys.up||t===l.Keys.down)){e.preventDefault(),this.onNavigate(s,t),this.applyState(s);return}const n=()=>{e.preventDefault(),this.base.togglePopup(s),this.applyState(s)};i?e.altKey&&t===l.Keys.up?n():t===l.Keys.enter?(e.preventDefault(),this.applyValueOnEnter(e.currentTarget.value,s)):t===l.Keys.esc&&(this.adaptiveState&&this.toggleBtnClick(e),n()):e.altKey&&t===l.Keys.down?n():t===l.Keys.esc&&this.applyValueOnRejectSuggestions(e.currentTarget.value,s)},inputOnChange(e){const t=this.base.initState();t.event=e;const i=this.isOpen,s=e.currentTarget,n=s.value;if(this.$props.suggest){const p=s.selectionEnd===n.length;let o=this.$props.filter!==void 0?this.$props.filter:this.currentText;a.isPresent(o)||(o=a.getItemValue(this.computedValue(),this.$props.textField)||"");const c=o&&o===n,h=o&&o.length>n.length;c||h||!p?this.suggested="":this.suggestValue(n)}this.$props.filter===void 0&&(t.data.currentText=n),this.currentFocusedItem!==void 0&&(t.data.focusedItem=void 0),i||this.base.togglePopup(t),this.base.filterChanged(n,t),this.$props.filterable&&(t.data.group=void 0),this.applyState(t)},clearButtonClick(e){const t=this.base.initState();t.event=e,e.stopPropagation(),this.suggested="",this.base.filterChanged("",t),this.$props.filter===void 0&&this.currentText!==void 0&&(t.data.currentText=void 0),this.triggerOnChange(null,t),this.isOpen&&this.base.togglePopup(t),this.applyState(t)},getFocusedIndex(){const e=this.computedValue(),{dataItems:t=[],textField:i,dataItemKey:s,virtual:n={skip:0},focusedItemIndex:p=a.itemIndexStartsWith}=this.$props,o=this.$props.filter?this.$props.filter:this.currentText;if(a.isPresent(e)&&o===void 0){let c=t.findIndex(h=>a.areSame(h,e,s));if(c===-1&&!s&&i){const h=a.getItemValue(e,i);c=t.findIndex(v=>a.getItemValue(v,i)===h)}return c}else return o?p(t,o,i):n.skip===0?0:-1},suggestValue(e){const{dataItems:t,textField:i}=this.$props;this.suggested=a.suggestValue(e,t,i)},setValidity(){this.input&&this.input.setCustomValidity&&this.input.setCustomValidity(this.validity().valid?"":this.$props.validationMessage||$e)},compareValues(e,t){return this.$props.valuePrimitive&&(typeof e!="object"||e===null)&&(typeof t!="object"||t===null)?e===t:a.areSame(e,t,this.$props.dataItemKey)},triggerOnChange(e,t){const i=this.computedValue();!a.isPresent(i)&&!a.isPresent(e)||this.compareValues(i,e)||(this.$props.value===void 0&&(this.currentValue=e),this.valueDuringOnChange=e,t.events.push({type:"change"}))},applyState(e){this.base.applyState(e),this.valueDuringOnChange=void 0},calculateMedia(e){for(let t of e)this.windowWidth=t.target.clientWidth},repositionPopup(){this.base.repositionPopup()},onScroll(e){this.isScrolling=!0;const{vs:t,list:i}=this.base;t.scrollHandler(e);const s=this.base.initState(),{groupField:n}=this.$props;let{dataItems:p=[]}=this.$props,o;if(!n||!p.length)return;const h=e.target.scrollTop-t.skip*(t.itemHeight||0);if(n){p=this.base.getGroupedDataModernMode(p,n),o=p[0][n];let v=0,d=0,g=0;if(i&&!t.enabled){const f=i.querySelector(".k-list-item"),u=i.querySelector(".k-list-group-item");d=(f==null?void 0:f.offsetHeight)||0,g=(u==null?void 0:u.offsetHeight)||d}else d=t.itemHeight||0,g=d;for(let f=0;f<p.length;f++){const u=p[f],k=u&&Object.keys(u).length===1&&u[n]!==void 0,m=k?g:d;if(k&&v<=h&&(o=u[n]),v+=m,v>h)break}}o!==this.group&&(s.data.group=o,this.applyState(s))},getInputText(e,t){return a.isPresent(e)&&e!==""?String(e):a.isPresent(t)?String(t):""},getSelectedItemText(){const{textField:e,valuePrimitive:t}=this.$props,i=this.computedValue();if(a.isPresent(i))return t?i&&typeof i=="object"?a.getItemValue(i,e):typeof i=="string"?i!==""?i:void 0:typeof i=="number"||typeof i=="boolean"?String(i):void 0:a.getItemValue(i,e)}},render(){let{dir:e,disabled:t,clearButton:i,label:s,textField:n,className:p,style:o,loading:c,icon:h,svgIcon:v,iconClassName:d,virtual:g,size:f,fillMode:u,rounded:k,adaptiveTitle:m,header:y,footer:$,groupStickyHeaderItemRender:O,placeholder:B,inputAttributes:Y}=this.$props;const J=this.currentFocused,Q=!this.$props.validityStyles||this.validity().valid,R=this.$props.filter!==void 0?this.$props.filter:this.currentText,E=this.getSelectedItemText(),q=this.getInputText(R,E),D=this.computedValue(),X=this.$props.valuePrimitive?!!this.findByFieldValue(this.valueField,D)||this.$props.allowCustom&&a.isPresent(D)&&D!=="":a.isPresent(D),Z=i&&!t&&(!!q||X),C=this.base,V=C.vs,P=this.$props.id||this.inputId,M=Object.assign({},{animate:!0,height:"200px"},this.$props.popupSettings),ee=Se.provideLocalizationService(this).toLanguageString(K.expandButton,K.messages[K.expandButton]),F=this.isOpen,N=this.adaptiveState;V.enabled=g!==void 0,g!==void 0&&(V.skip=g.skip,V.total=g.total,V.pageSize=g.pageSize),this.group===void 0&&this.$props.groupField!==void 0&&(this.group=a.getItemValue(this.$props.dataItems[0],this.$props.groupField));const te=b=>{const I=this.base.initState();I.event=b;const S=b.event.target.value;I.data.text=S,this.base.filterChanged(S,I),this.applyState(I)},ie=()=>[r.createVNode("div",{class:"k-actionsheet-titlebar-group k-hbox"},[r.createVNode("div",{class:"k-actionsheet-title"},[r.createVNode("div",{class:"k-text-center"},[m]),B&&r.createVNode("div",{class:"k-actionsheet-subtitle k-text-center"},[B])]),r.createVNode("div",{class:"k-actionsheet-actions"},[r.createVNode(_.Button,{tabIndex:5,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:this.toggleBtnClick,icon:"x",svgIcon:W.xIcon},null)])]),r.createVNode("div",{class:"k-actionsheet-titlebar-group k-actionsheet-filter"},[le.call(this)])],se=l.templateRendering.call(this,ie,l.getListeners.call(this)),ne=()=>{const b=C.getTemplateDef.call(this,y,r.h),I=C.getTemplateDef.call(this,$,r.h),S=l.templateRendering.call(this,O,l.getListeners.call(this)),x=this.$props.dataItems||[];return r.createVNode("div",{class:"k-list-container"},[b&&r.createVNode("div",{class:"k-list-header"},[b]),r.createVNode("div",{class:l.classNames("k-list",{[`k-list-${j[f]||f}`]:N?!1:f,"k-list-lg":!!N,"k-virtual-list":V.enabled})},[y&&r.createVNode("div",{class:"k-list-header"},[y]),this.group&&x.length!==0&&r.createVNode(G.GroupStickyHeader,{group:this.group,render:S},null),A.call(this),I&&r.createVNode("div",{class:"k-list-footer"},[I])])])},ae=l.templateRendering.call(this,ne,l.getListeners.call(this)),re=function(){return r.createVNode(ye.ActionSheet,{expand:F,animation:!0,animationStyles:this.animationStyles,className:this.classNameAdaptive,contentClassName:"!k-overflow-hidden",header:se,content:ae,onClose:this.toggleBtnClick,navigatableElements:["input.k-input-inner",".k-actionsheet-actions > button"]},null)},le=function(){const I=this.base.initState().data.text;return r.createVNode(ke.ListFilter,{adaptiveMode:!0,value:I,ref:"filterInput",onChange:S=>te(S),onKeydown:this.onInputKeyDown,size:this.$props.size,rounded:this.$props.rounded,fillMode:this.$props.fillMode},null)},A=function(){let b;const{dataItemKey:I,groupField:S}=this.$props;let x=this.$props.dataItems||[];const T=l.templateRendering.call(this,this.$props.itemRender,l.getListeners.call(this)),L=l.templateRendering.call(this,this.$props.groupHeaderItemRender,l.getListeners.call(this)),H=l.templateRendering.call(this,this.$props.listNoDataRender,l.getListeners.call(this));g||(g={skip:0});const w=g.skip,pe=`translateY(${V.translate}px)`,he=F?this.getFocusedIndex():void 0,fe=a.isPresent(R)&&R!==E?null:this.computedValue();return S&&(x=this.base.getGroupedDataModernMode(x,S)),r.createVNode(be.List,{id:C.listBoxId,show:F,dataItems:x,focusedIndex:he,value:fe,textField:n,valueField:I,optionsGuid:C.guid,ref:"list",wrapperStyle:{maxHeight:N?void 0:M.height},wrapperCssClass:l.classNames("k-list-content",{"k-list-scroller":!this.$props.virtual}),listStyle:V.enabled?{transform:pe}:void 0,key:"listkey",skip:w,onListclick:this.handleItemClick,itemRender:T,groupHeaderItemRender:L,noDataRender:H,groupField:S,onScroll:this.onScroll},Ve(b=oe.call(this))?b:{default:()=>[b]})},oe=function(){return V.enabled&&r.createVNode("div",{ref:"scrollElement",key:"scrollElementKey"},null)},de=function(){const b=l.templateRendering.call(this,this.$props.groupStickyHeaderItemRender,l.getListeners.call(this)),I=C.getTemplateDef.call(this,y),S=C.getTemplateDef.call(this,$),x=this.$props.dataItems||[];return this.group===void 0&&this.$props.groupField!==void 0&&(this.group=a.getItemValue(x[0],this.$props.groupField)),r.createVNode(ve.ListContainer,{ref:"container",onMousedown:T=>T.preventDefault(),width:this.popupWidth,popupSettings:{...M,anchor:this.anchor,show:F,popupClass:l.classNames(M.popupClass,"k-list",{[`k-list-${j[f]||f}`]:f,"k-virtual-list":this.base.vs.enabled}),className:l.classNames("k-list-container",M.className)},dir:e!==void 0?e:this.base.dirCalculated},{default:()=>[I&&r.createVNode("div",{class:"k-list-header"},[I]),this.group&&x.length!==0&&r.createVNode(G.GroupStickyHeader,{group:this.group,render:b},null),A.call(this),S&&r.createVNode("div",{class:"k-list-footer"},[S])]})},ue=function(b,I){const{tabIndex:S,dataItems:x=[],dataItemKey:T}=this.$props;g||(g={skip:0});const L=this.computedValue(),H=Math.max(0,x.findIndex(w=>a.areSame(w,L,T)));return this.suggested&&!a.areSame(this.valueOnDidUpdate,L,T)&&(this.suggested=""),r.createVNode(me.SearchBar,{id:I,placeholder:B,tabIndex:S||void 0,accessKey:this.$props.accessKey,value:b+this.suggested,suggestedText:this.suggested,ref:w=>{this.inputRef=w},onKeydown:this.onInputKeyDown,onChange:this.inputOnChange,onFocus:this.base.handleFocus,onBlur:this.handleBlur,disabled:t,expanded:F,owns:this.base.listBoxId,activedescendant:this.base.guid+"-"+(H+g.skip),ariaLabelledBy:this.$props.ariaLabelledBy,ariaDescribedBy:this.$props.ariaDescribedBy,ariaLabel:this.$props.ariaLabel,inputAttributes:Y},null)},ce=function(){return r.createVNode("span",{class:l.classNames("k-combobox k-input",{[`k-input-${j[f]||f}`]:f,[`k-rounded-${xe[k]||k}`]:k,[`k-input-${u}`]:u,"k-invalid":!Q,"k-loading":c,"k-required":this.required,"k-disabled":t,"k-focus":J&&!t},p),ref:l.setRef(this,"kendoAnchor"),style:s?{...o,width:void 0}:o,dir:e},[ue.call(this,q||"",P),Z&&!c&&r.createVNode(Ie.ClearButton,{onClearclick:this.clearButtonClick,key:"clearbutton"},null),c&&r.createVNode(l.Icon,{name:"loading",class:"k-input-loading-icon",key:"loading"},null),r.createVNode(_.Button,{type:"button",tabIndex:-1,"aria-label":ee,size:f,fillMode:u,rounded:null,disabled:t,class:"k-input-button",icon:h||"chevron-down",svgIcon:v||W.chevronDownIcon,iconClass:d,onClick:this.toggleBtnClick,onMousedown:b=>b.preventDefault()},null),!N&&de.call(this)])},z=[r.h(ce.call(this),{...this.$attrs}),N&&re.call(this)];return s?r.createVNode("span",{class:this.spanClassNames,onFocusin:this.handleFocus,dir:this.$props.dir},[z,this.$props.label?P?r.createVNode("label",{for:P,class:"k-floating-label"},[this.$props.label]):r.createVNode("span",{class:"k-label"},[this.$props.label]):null]):z}});exports.ComboBox=Ce;
|
package/ComboBox/ComboBox.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import { List as He } from "../common/List.mjs";
|
|
|
17
17
|
import { ClearButton as Re } from "../common/ClearButton.mjs";
|
|
18
18
|
import { provideLocalizationService as Le } from "@progress/kendo-vue-intl";
|
|
19
19
|
import { expandButton as se, messages as je } from "../messages/main.mjs";
|
|
20
|
-
import { xIcon as Ee,
|
|
20
|
+
import { xIcon as Ee, chevronDownIcon as Ne } from "@progress/kendo-svg-icons";
|
|
21
21
|
import { MOBILE_MEDIUM_DEVICE as Ae, MOBILE_SMALL_DEVICE as Pe } from "../common/constants.mjs";
|
|
22
22
|
import { ActionSheet as Ke } from "@progress/kendo-vue-layout";
|
|
23
23
|
import { ListFilter as ze } from "../common/ListFilter.mjs";
|
|
@@ -607,7 +607,7 @@ const We = "Please enter a valid value!", ut = /* @__PURE__ */ xe({
|
|
|
607
607
|
placeholder: M,
|
|
608
608
|
inputAttributes: ne
|
|
609
609
|
} = this.$props;
|
|
610
|
-
const ae = this.currentFocused, le = !this.$props.validityStyles || this.validity().valid, P = this.$props.filter !== void 0 ? this.$props.filter : this.currentText, q = this.getSelectedItemText(), U = this.getInputText(P, q), E = this.computedValue(), oe = this.$props.valuePrimitive ? !!this.findByFieldValue(this.valueField, E) || this.$props.allowCustom && S(E) && E !== "" : S(E), re = i && (!!U || oe), T = this.base, C = T.vs, K = this.$props.id || this.inputId, N = Object.assign({}, {
|
|
610
|
+
const ae = this.currentFocused, le = !this.$props.validityStyles || this.validity().valid, P = this.$props.filter !== void 0 ? this.$props.filter : this.currentText, q = this.getSelectedItemText(), U = this.getInputText(P, q), E = this.computedValue(), oe = this.$props.valuePrimitive ? !!this.findByFieldValue(this.valueField, E) || this.$props.allowCustom && S(E) && E !== "" : S(E), re = i && !t && (!!U || oe), T = this.base, C = T.vs, K = this.$props.id || this.inputId, N = Object.assign({}, {
|
|
611
611
|
animate: !0,
|
|
612
612
|
height: "200px"
|
|
613
613
|
}, this.$props.popupSettings), de = Le(this).toLanguageString(se, je[se]), H = this.isOpen, R = this.adaptiveState;
|
|
@@ -821,8 +821,9 @@ const We = "Please enter a valid value!", ut = /* @__PURE__ */ xe({
|
|
|
821
821
|
size: c,
|
|
822
822
|
fillMode: o,
|
|
823
823
|
rounded: null,
|
|
824
|
+
disabled: t,
|
|
824
825
|
class: "k-input-button",
|
|
825
|
-
icon: p || "
|
|
826
|
+
icon: p || "chevron-down",
|
|
826
827
|
svgIcon: g || Ne,
|
|
827
828
|
iconClass: l,
|
|
828
829
|
onClick: this.toggleBtnClick,
|
|
@@ -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 n=require("vue"),i=require("@progress/kendo-vue-common"),E=require("@progress/kendo-vue-buttons"),ce=require("../common/ListContainer.js"),he=require("../common/ListFilter.js"),fe=require("../common/ListDefaultItem.js"),ge=require("../common/List.js"),me=require("../common/DropDownBase.js"),P=require("../common/GroupStickyHeader.js"),F=require("../messages/main.js"),ve=require("@progress/kendo-vue-intl"),_=require("../common/constants.js"),be=require("@progress/kendo-vue-layout"),p=require("../common/utils.js"),j=require("@progress/kendo-svg-icons"),{sizeMap:L,roundedMap:ye}=i.kendoThemeMaps;function Ie(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!n.isVNode(e)}const Se="Please select a value from the list!",ke=n.defineComponent({name:"KendoDropDownList",model:{event:"changemodel"},props:{id:String,title:String,dataItemKey:{type:[Object,String]},defaultValue:{type:[String,Object,Number,Boolean],default:void 0},name:String,modelValue:{type:[String,Object,Number,Boolean],default:void 0},value:{type:[String,Object,Number,Boolean],default:void 0},label:{type:String},required:{type:Boolean,default:!1},leftRightKeysNavigation:{type:Boolean,default:!0},valid:{type:Boolean,default:void 0},validate:{type:Boolean},validationMessage:{type:String,default:void 0},validityStyles:{type:Boolean,default:!0},delay:{type:Number,default:500},ignoreCase:{type:Boolean,default:!0},icon:String,svgIcon:Object,iconClassName:String,defaultItem:[Object,String],valueRender:[String,Function,Object],valueMap:Function,opened:{type:Boolean,default:void 0},disabled:Boolean,dir:{type:String,default:void 0},tabIndex:{type:Number,default:0},accessKey:String,dataItems:Array,textField:String,valueField:String,valuePrimitive:Boolean,className:String,loading:Boolean,popupSettings:{type:Object,default:{animate:!0,height:"200px",anchor:""}},itemRender:[String,Function,Object],groupHeaderItemRender:[String,Function,Object],groupStickyHeaderItemRender:[String,Function,Object],listNoDataRender:[String,Function,Object],focusedItemIndex:Function,header:[String,Function,Object],footer:[String,Function,Object],filterable:Boolean,filter:{type:String,default:void 0},virtual:{type:Object,default:void 0},ariaLabelledBy:String,ariaLabel:String,ariaDescribedBy:String,rounded:{type:String,validator:function(e){return["none","small","medium","large","full"].includes(e)}},fillMode:{type:String,validator:function(e){return["solid","flat","outline"].includes(e)}},size:{type:String,validator:function(e){return["small","medium","large"].includes(e)}},groupField:{type:String},adaptive:{type:Boolean,default:void 0},adaptiveTitle:{type:String,default:void 0},onChange:Function},inject:{kendoLocalizationService:{default:null},adaptiveModeBreakpoints:{default:{small:_.MOBILE_SMALL_DEVICE,medium:_.MOBILE_MEDIUM_DEVICE}}},data(){return{hasMounted:!1,currentText:"",currentValue:"",currentFocused:!1,currentOpened:!1,searchState:{word:"",last:""},_skipFocusEvent:!1,valueDuringOnChange:{},_navigated:!1,group:void 0,isScrolling:!1,itemHeight:0,state:void 0,popupWidth:void 0,windowWidth:0}},watch:{currentOpened:function(e,t){this.prevCurrentOpened=t},opened:function(e,t){this.prevOpened=t},virtual:function(e,t){e&&t&&e.total!==t.total&&(this.virtualTotalHasChanged=!0),this.virtualHasChanged=!0},isOpen:function(){setTimeout(()=>{const e=document.querySelector(".k-list-item");this.itemHeight=this.base.getListItemHeight(e)},100)}},created(){this.observer=null,this.valueDuringOnChange=void 0,this.currentText=void 0,this.currentValue=void 0,this.prevCurrentValue=this.computedValue(),this.currentFocused=void 0,this.currentOpened=void 0,this.base=new me(this),this.anchor=i.guid(),this.inputId=i.guid()},setup(){const e=n.ref(null),t=n.ref(null),a=n.ref(null);return{selectRef:e,baseWrapperRef:t,kendoAnchorRef:a}},mounted(){this.observer=i.canUseDOM&&window.ResizeObserver&&new ResizeObserver(this.calculateMedia),document!=null&&document.body&&this.observer&&this.observer.observe(document.body),this.hasMounted=!0,this.select=i.getRef(this,"select"),this.base.wrapper=i.getRef(this,"kendoAnchor"),this.base.didMount(),this.setValidity()},updated(){var b;const{dataItems:e=[],dataItemKey:t,virtual:a,groupField:r,textField:o}=this.$props,s=this.isOpen,u=this.prevOpened!==void 0?this.prevOpened:this.prevCurrentOpened,l=!u&&s,d=this.$refs.list,f=this.$refs.filterInput,g=this.$refs.scrollElement;if(this.$refs.scroller,d&&(this.base.vs.list=d.list,this.base.list=d.list),g&&(this.base.vs.scrollElement=g),f&&(this.filterInput=f),d&&e.length&&this.base.vs.scrollerRef(d.$el),this.$props.popupSettings.animate||l&&this.onPopupOpened(),a&&this.virtualTotalHasChanged)this.base.vs.calcScrollElementHeight(),this.base.vs.reset(),this.virtualTotalHasChanged=!1;else{const c=this.computedValue(),v=this.prevCurrentValue;let h=e.findIndex(y=>p.areSame(y,c,t));r&&(h=(b=this.base.getGroupedDataModernMode(e,r))==null?void 0:b.indexOf(c));const S=!p.areSame(v,c,t);l&&a?(this.base.scrollToVirtualItem(a,h),this.prevCurrentOpened=!0):l&&!a?(e&&e.length!==0&&this.base.resetGroupStickyHeader(e[0][r],this),this.base.scrollToItem(h),this.prevCurrentOpened=!0):s&&u&&c&&S&&!this._navigated?this.base.scrollToItem(h):s&&u&&this._navigated&&(this._navigated&&a&&a.skip===0?this.base.vs.reset():this._navigated&&a&&a.skip===a.total-a.pageSize&&this.base.vs.scrollToEnd())}this._navigated=!1,this.prevCurrentValue=this.computedValue(),this.setValidity()},computed:{index(){const{dataItems:e=[],dataItemKey:t}=this.$props,a=this.computedValue();return e.findIndex(r=>p.areSame(r,a,t))},spanClassNames(){const e=!this.hasMounted||!this.$props.validityStyles||this.validity().valid;return{"k-floating-label-container":!0,"k-focus":this.currentFocused,"k-empty":!this.computedValue(),"k-invalid":!e&&e!==void 0,"k-rtl":this.$props.dir==="rtl"}},dropDownListId(){return`value-${this.base.guid}${this.$props.ariaDescribedBy?" "+this.$props.ariaDescribedBy:""}`},isOpen(){return this.$props.opened!==void 0?this.$props.opened:this.currentOpened},animationStyles(){return this.windowWidth<=this.adaptiveModeBreakpoints.small?{top:0,width:"100%",height:"100%"}:void 0},classNameAdaptive(){return this.windowWidth<=this.adaptiveModeBreakpoints.small?"k-adaptive-actionsheet k-actionsheet-fullscreen":"k-adaptive-actionsheet k-actionsheet-bottom"},adaptiveState(){return this.windowWidth<=this.adaptiveModeBreakpoints.medium&&this.$props.adaptive}},methods:{focus(){this.base.wrapper&&this.base.wrapper.focus()},computedValue(){let e;return this.valueDuringOnChange!==void 0?e=this.valueDuringOnChange:this.$props.value!==void 0?e=this.$props.value:this.$props.modelValue!==void 0?e=this.$props.modelValue:this.currentValue!==void 0?e=this.currentValue:this.$props.defaultValue!==void 0&&(e=this.$props.defaultValue),!p.isPresent(e)&&this.$props.defaultItem!==void 0&&(e=this.$props.defaultItem),this.valuePrimitive&&this.findByFieldValue(this.valueField,e)||e},findByFieldValue(e,t){const a=this.dataItems.findIndex(r=>p.getItemValue(r,e)===t);return this.dataItems[a]},primitiveValue(){const e=this.computedValue();return this.valuePrimitive?p.getItemValue(e,this.valueField):e},validity(){const e=this.$props.validationMessage!==void 0,t=!this.$props.required||this.computedValue()!==null&&this.computedValue()!==""&&this.computedValue()!==void 0,a=this.$props.valid!==void 0?this.$props.valid:t;return{customError:e,valid:a,valueMissing:this.computedValue()===null}},handleItemSelect(e,t){const{dataItems:a=[],virtual:r,dataItemKey:o,defaultItem:s}=this.$props,u=r?r.skip:0,l=e===-1&&s!==void 0?s:a[e-u],d=!p.areSame(l,this.computedValue(),o);this.triggerOnChange(l,t),d&&this.base.triggerPageChangeCornerItems(l,t)},onNavigate(e,t){const{dataItems:a=[],defaultItem:r,dataItemKey:o,virtual:s={skip:0,total:0,pageSize:0}}=this.$props,u=this.base.vs,l=this.computedValue(),d=a.findIndex(g=>p.areSame(g,l,o)),f=this.base.navigation.navigate({current:s.skip+d,max:(u.enabled?s.total:a.length)-1,min:r!==void 0?-1:0,keyCode:t});f!==void 0&&this.handleItemSelect(f,e),this.applyState(e)},search(e){clearTimeout(this.typingTimeout),this.$props.filterable||(this.typingTimeout=setTimeout(()=>this.searchState.word="",this.$props.delay),this.selectNext(e))},selectNext(e){const{dataItems:t=[],dataItemKey:a}=this.$props;let r=t.map((y,x)=>({item:y,itemIndex:x}));const o=this.searchState.word,s=this.searchState.last,u=p.sameCharsOnly(o,s);let l=r.length,d=Math.max(0,t.findIndex(y=>p.areSame(y,this.computedValue(),a))),f;this.$props.defaultItem&&(f={item:this.$props.defaultItem,itemIndex:-1},l+=1,d+=1),d+=u?1:0,r=p.shuffleData(r,d,f);let g,b,c,v=0;const{textField:h,ignoreCase:S}=this.$props;for(;v<l;){if(g=p.getItemValue(r[v].item,h),b=u&&p.matchText(g,s,S),c=p.matchText(g,o,S),b||c){v=r[v].itemIndex;break}v++}if(v!==l){const y=this.base.initState();y.event=e,this.handleItemSelect(v,y),this.applyState(y),this.valueDuringOnChange=void 0}},handleKeyDown(e){this.isScrolling&&(this.isScrolling=!1);const{dataItems:t=[],leftRightKeysNavigation:a,filterable:r,disabled:o,virtual:s={skip:0,total:0,pageSize:0}}=this.$props,u=this.isOpen,l=e.keyCode,d=l===i.Keys.home||l===i.Keys.end,f=l===i.Keys.up||l===i.Keys.down,g=!u&&(e.altKey&&l===i.Keys.down||l===i.Keys.enter||l===i.Keys.space),b=u&&(e.altKey&&l===i.Keys.up||l===i.Keys.esc),c=a&&(l===i.Keys.left||l===i.Keys.right),v=f||!r&&(c||d),h=this.base.initState();if(h.event=e,!o){if(d&&this.base.vs.enabled)l===i.Keys.home?s.skip!==0?(this.base.triggerOnPageChange(h,0,s.pageSize),this._navigated=!0):this.triggerOnChange(t[0],h):s.skip<s.total-s.pageSize?(this.base.triggerOnPageChange(h,s.total-s.pageSize,s.pageSize),this._navigated=!0):this.triggerOnChange(t[t.length-1],h);else if(u&&l===i.Keys.enter){const S=this.focusedIndex();S!==void 0&&this.handleItemSelect(S,h),this.base.togglePopup(h),e.preventDefault()}else g||b?(this.adaptiveState&&this.handleWrapperClick(e),this.base.togglePopup(h),e.preventDefault()):v&&(this.onNavigate(h,l),e.preventDefault());this.applyState(h)}},handleItemClick(e,t){this.base.handleItemClick(e,t),this.valueDuringOnChange=void 0},handleFocus(e){this._skipFocusEvent||this.base.handleFocus(e)},handleBlur(e){if(this._skipFocusEvent||!this.currentFocused)return;const t=this.isOpen,a=this.base.initState();a.event=e,a.data.currentFocused=!1,a.events.push({type:"blur"}),t&&!this.adaptiveState&&this.base.togglePopup(a),this.applyState(a)},handleDefaultItemClick(e){const t=this.base.initState();t.event=e,this.base.togglePopup(t),this.triggerOnChange(this.$props.defaultItem,t),this.applyState(t)},handleWrapperClick(e){const t=this.base.initState();t.event=e,this.currentFocused||(t.data.currentFocused=!0),this.base.togglePopup(t),this.applyState(t)},handleKeyPress(e){if(this.$props.filterable||e.keyCode===i.Keys.enter)return;let t=String.fromCharCode(e.charCode||e.keyCode);this.$props.ignoreCase&&(t=t.toLowerCase()),t===" "&&e.preventDefault(),this.searchState={word:this.searchState.word+t,last:this.searchState.last+t},this.search(e)},handleListFilterChange(e){const t=this.base.initState();t.event=e,this.$props.filter===void 0&&(t.data.currentText=e.target.value),this.base.filterChanged(e.target.value,t),t.data.group=void 0,this.applyState(t)},onPopupOpened(){this.filterInput&&this.focusElement(this.filterInput.input)},onPopupClosed(){this.currentFocused&&setTimeout(()=>{this.currentFocused&&this.base.wrapper&&this.focusElement(this.base.wrapper)})},focusedIndex(){const e=p.isPresent(this.$props.filter)?this.$props.filter:this.currentText,{dataItems:t=[],virtual:a={skip:0},dataItemKey:r,textField:o,focusedItemIndex:s}=this.$props,u=this.computedValue(),d=!(t.findIndex(f=>p.areSame(f,u,r))<0&&!this.$props.defaultItem);return!d&&e&&a.skip===0?s?s(t,e,o):t.indexOf(p.getFocusedItem(t,e,o)):!d&&a.skip===0?0:void 0},focusElement(e){this._skipFocusEvent=!0,e.focus(),setTimeout(()=>this._skipFocusEvent=!1,30)},setValidity(){this.select&&this.select.setCustomValidity&&this.select.setCustomValidity(this.validity().valid?"":this.$props.validationMessage||Se)},triggerOnChange(e,t){p.areSame(this.computedValue(),e,this.$props.dataItemKey)||(this.$props.value===void 0&&(this.currentValue=e),this.valueDuringOnChange=e,t.events.push({type:"change"}))},applyState(e){this.base.applyState(e),this.valueDuringOnChange=void 0},calculateMedia(e){for(let t of e)this.windowWidth=t.target.clientWidth},repositionPopup(){this.base.repositionPopup()},onScroll(e){var b;this.isScrolling=!0;const{vs:t,list:a}=this.base;t.scrollHandler(e);const r=this.base.initState(),{groupField:o}=this.$props;let{dataItems:s=[]}=this.$props,u;if(!o||!s.length)return;const l=a&&((b=a.querySelector(".k-list-item"))==null?void 0:b.offsetHeight)||0,d=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:l),g=e.target.scrollTop-t.skip*d;o&&(s=this.base.getGroupedDataModernMode(s,o),u=s[0][o]);for(let c=1;c<s.length&&!(d*c>g);c++)s[c]&&s[c][o]&&(u=s[c][o]);u!==this.group&&(r.data.group=u,this.applyState(r))}},render(){const{style:e,className:t,label:a,dir:r,virtual:o={skip:0},size:s,rounded:u,fillMode:l,dataItemKey:d,dataItems:f=[],disabled:g,tabIndex:b,loading:c,icon:v,svgIcon:h,iconClassName:S,adaptiveTitle:y,header:x,footer:M,groupStickyHeaderItemRender:q}=this.$props,C=this.isOpen,z=p.getItemValue(this.computedValue(),this.$props.textField),A=!this.$props.validityStyles||this.validity().valid,k=this.base,V=k.vs,w=this.$props.id||this.inputId;V.enabled=this.$props.virtual!==void 0;const O=Object.assign({},{animate:!0,height:"200px"},this.$props.popupSettings),W=ve.provideLocalizationService(this).toLanguageString(F.selectButton,F.messages[F.selectButton]),N=this.adaptiveState;this.group===void 0&&this.$props.groupField!==void 0&&(this.group=p.getItemValue(this.$props.dataItems[0],this.$props.groupField));const G=i.templateRendering.call(this,this.$props.valueRender,i.getListeners.call(this)),U=this.currentFocused,T=this.primitiveValue(),Y=f.findIndex(m=>p.areSame(m,T,d)),J=n.createVNode("span",{class:"k-input-inner",id:this.dropDownListId},[n.createVNode("span",{class:"k-input-value-text"},[z])]);let Q=i.getTemplate.call(this,{h:n.h,template:G,defaultRendering:J,additionalProps:{value:this.computedValue(),...this.$data}});const X=function(m){return n.createVNode("select",{name:this.$props.name,id:w,ref:i.setRef(this,"select"),tabindex:-1,"aria-hidden":!0,title:this.$props.label,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},[n.createVNode("option",{value:this.$props.valueMap?this.$props.valueMap.call(void 0,m):m},null)])},Z=()=>[n.createVNode("div",{class:"k-actionsheet-titlebar-group k-hbox"},[n.createVNode("div",{class:"k-actionsheet-title"},[n.createVNode("div",{class:"k-text-center"},[y]),n.createVNode("div",{class:"k-actionsheet-subtitle k-text-center"},null)]),n.createVNode("div",{class:"k-actionsheet-actions"},[n.createVNode(E.Button,{tabIndex:5,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:this.handleWrapperClick,icon:"x",svgIcon:j.xIcon},null)])]),n.createVNode("div",{class:"k-actionsheet-titlebar-group k-actionsheet-filter"},[K.call(this)])],ee=i.templateRendering.call(this,Z,i.getListeners.call(this)),te=()=>{const m=k.getTemplateDef.call(this,x,n.h),I=k.getTemplateDef.call(this,M,n.h),$=i.templateRendering.call(this,q,i.getListeners.call(this));return n.createVNode("div",{class:"k-list-container"},[m&&n.createVNode("div",{class:"k-list-header"},[m]),n.createVNode("div",{class:i.classNames("k-list",{[`k-list-${L[s]||s}`]:N?!1:s,"k-list-lg":!!N,"k-virtual-list":V.enabled})},[B.call(this),this.group&&f.length!==0&&n.createVNode(P.GroupStickyHeader,{group:this.group,render:$},null),R.call(this),I&&n.createVNode("div",{class:"k-list-footer"},[I])])])},ie=i.templateRendering.call(this,te,i.getListeners.call(this)),se=function(){return n.createVNode(be.ActionSheet,{expand:C,animation:!0,animationStyles:this.animationStyles,className:this.classNameAdaptive,contentClassName:"!k-overflow-hidden",header:ee,content:ie,onClose:this.handleWrapperClick,navigatableElements:["input.k-input-inner",".k-actionsheet-actions > button"]},null)},B=function(){const{textField:m,defaultItem:I}=this.$props;return I!==void 0&&n.createVNode(fe.ListDefaultItem,{defaultItem:I,textField:m,selected:p.areSame(this.computedValue(),I,d),key:"defaultitemkey",onDefaultitemclick:this.handleDefaultItemClick},null)},R=function(){let m;const{textField:I,groupField:$}=this.$props;let D=this.$props.dataItems||[];const re=i.templateRendering.call(this,this.$props.itemRender,i.getListeners.call(this)),oe=i.templateRendering.call(this,this.$props.groupHeaderItemRender,i.getListeners.call(this)),de=i.templateRendering.call(this,this.$props.listNoDataRender,i.getListeners.call(this)),ue=o.skip,pe=`translateY(${V.translate}px)`;return $&&(D=this.base.getGroupedDataModernMode(D,$)),n.createVNode(ge.List,{id:this.base.listBoxId,show:C,dataItems:D.slice(),focusedIndex:this.focusedIndex(),value:this.computedValue(),textField:I,valueField:d,optionsGuid:this.base.guid,ref:"list",wrapperStyle:{maxHeight:O.height},wrapperCssClass:"k-list-content",listStyle:V.enabled?{transform:pe}:void 0,key:"listkey",skip:ue,onListclick:this.handleItemClick,itemRender:re,groupHeaderItemRender:oe,noDataRender:de,groupField:$,onScroll:this.onScroll},Ie(m=ae.call(this))?m:{default:()=>[m]})},K=function(){const m=this.$props.filter!==void 0?this.$props.filter:this.currentText;return this.$props.filterable&&n.createVNode(he.ListFilter,{value:m,ref:"filterInput",onChange:this.handleListFilterChange,onKeydown:this.handleKeyDown,size:this.$props.size,rounded:this.$props.rounded,fillMode:this.$props.fillMode,ariaControlsId:this.base.listBoxId,ariaActivedescendantId:`option-${this.base.guid}-${this.focusedIndex()}`},null)},ae=function(){return V.enabled&&n.createVNode("div",{ref:"scrollElement",key:"scrollElementKey"},null)},ne=function(){const m=i.templateRendering.call(this,this.$props.groupStickyHeaderItemRender,i.getListeners.call(this)),I=k.getTemplateDef.call(this,x),$=k.getTemplateDef.call(this,M);return n.createVNode(ce.ListContainer,{ref:"container",onMousedown:p.preventDefaultNonInputs,dir:r!==void 0?r:k.dirCalculated,width:this.popupWidth,popupSettings:{...O,popupClass:i.classNames(O.popupClass,"k-list",{[`k-list-${L[s]||s}`]:s,"k-virtual-list":this.base.vs.enabled}),className:i.classNames("k-list-container",O.className),anchor:this.anchor,show:C},onOpen:this.onPopupOpened,onClose:this.onPopupClosed,onBlur:this.handleBlur},{default:()=>[K.call(this),B.call(this),this.group&&f.length!==0&&n.createVNode(P.GroupStickyHeader,{group:this.group,render:m},null),I&&n.createVNode("div",{class:"k-list-header"},[I]),R.call(this),$&&n.createVNode("div",{class:"k-list-footer"},[$])]})};this.$props.virtual!==void 0&&(k.vs.skip=o.skip,k.vs.total=o.total,k.vs.pageSize=o.pageSize);const le=function(){return n.createVNode("span",{ref:i.setRef(this,"kendoAnchor"),class:i.classNames("k-dropdownlist k-picker",t,{[`k-picker-${L[s]||s}`]:s,[`k-rounded-${ye[u]||u}`]:u,[`k-picker-${l}`]:l,"k-focus":U,"k-disabled":g,"k-invalid":!A,"k-loading":c,"k-required":this.required}),style:a?{...e,width:void 0}:e,dir:r,onMousedown:C?p.preventDefaultNonInputs:i.noop,onFocusin:this.handleFocus,onFocusout:this.handleBlur,tabindex:i.getTabIndex(b,g),accesskey:this.$props.accessKey,onKeydown:this.handleKeyDown,onKeypress:this.handleKeyPress,role:"combobox",onClick:g?i.noop:this.handleWrapperClick,"aria-disabled":g||void 0,"aria-haspopup":!0,"aria-expanded":C||!1,"aria-owns":this.base.listBoxId,"aria-activedescendant":C?"option-"+this.base.guid+"-"+(Y+(o?o.skip:0)):void 0,"aria-label":this.$props.ariaLabel||this.$props.label,"aria-labelledby":this.$props.ariaLabelledBy,"aria-describedBy":this.dropDownListId,title:this.$props.title},[Q,c&&n.createVNode(i.Icon,{name:"loading",class:"k-input-loading-icon",key:"loading"},null),n.createVNode(E.Button,{type:"button",tabIndex:-1,size:s,fillMode:l,rounded:null,ariaLabel:W,class:"k-input-button",icon:v||"caret-alt-down",svgIcon:h||j.caretAltDownIcon,iconClass:S},null),X.call(this,T),!N&&ne.call(this)])},H=[n.h(le.call(this),{...this.$attrs}),N&&se.call(this)];return a?n.createVNode("span",{class:this.spanClassNames,onFocusin:this.handleFocus,onFocusout:this.handleBlur,dir:this.$props.dir},[H,this.$props.label?w?n.createVNode("label",{for:w,class:"k-floating-label"},[this.$props.label]):n.createVNode("span",{class:"k-label"},[this.$props.label]):null]):H}});exports.DropDownList=ke;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),i=require("@progress/kendo-vue-common"),E=require("@progress/kendo-vue-buttons"),ce=require("../common/ListContainer.js"),he=require("../common/ListFilter.js"),fe=require("../common/ListDefaultItem.js"),ge=require("../common/List.js"),me=require("../common/DropDownBase.js"),P=require("../common/GroupStickyHeader.js"),w=require("../messages/main.js"),ve=require("@progress/kendo-vue-intl"),_=require("../common/constants.js"),be=require("@progress/kendo-vue-layout"),p=require("../common/utils.js"),j=require("@progress/kendo-svg-icons"),{sizeMap:L,roundedMap:ye}=i.kendoThemeMaps;function Ie(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!n.isVNode(e)}const Se="Please select a value from the list!",ke=n.defineComponent({name:"KendoDropDownList",model:{event:"changemodel"},props:{id:String,title:String,dataItemKey:{type:[Object,String]},defaultValue:{type:[String,Object,Number,Boolean],default:void 0},name:String,modelValue:{type:[String,Object,Number,Boolean],default:void 0},value:{type:[String,Object,Number,Boolean],default:void 0},label:{type:String},required:{type:Boolean,default:!1},leftRightKeysNavigation:{type:Boolean,default:!0},valid:{type:Boolean,default:void 0},validate:{type:Boolean},validationMessage:{type:String,default:void 0},validityStyles:{type:Boolean,default:!0},delay:{type:Number,default:500},ignoreCase:{type:Boolean,default:!0},icon:String,svgIcon:Object,iconClassName:String,defaultItem:[Object,String],valueRender:[String,Function,Object],valueMap:Function,opened:{type:Boolean,default:void 0},disabled:Boolean,dir:{type:String,default:void 0},tabIndex:{type:Number,default:0},accessKey:String,dataItems:Array,textField:String,valueField:String,valuePrimitive:Boolean,className:String,loading:Boolean,popupSettings:{type:Object,default:{animate:!0,height:"200px",anchor:""}},itemRender:[String,Function,Object],groupHeaderItemRender:[String,Function,Object],groupStickyHeaderItemRender:[String,Function,Object],listNoDataRender:[String,Function,Object],focusedItemIndex:Function,header:[String,Function,Object],footer:[String,Function,Object],filterable:Boolean,filter:{type:String,default:void 0},virtual:{type:Object,default:void 0},ariaLabelledBy:String,ariaLabel:String,ariaDescribedBy:String,rounded:{type:String,validator:function(e){return["none","small","medium","large","full"].includes(e)}},fillMode:{type:String,validator:function(e){return["solid","flat","outline"].includes(e)}},size:{type:String,validator:function(e){return["small","medium","large"].includes(e)}},groupField:{type:String},adaptive:{type:Boolean,default:void 0},adaptiveTitle:{type:String,default:void 0},onChange:Function},inject:{kendoLocalizationService:{default:null},adaptiveModeBreakpoints:{default:{small:_.MOBILE_SMALL_DEVICE,medium:_.MOBILE_MEDIUM_DEVICE}}},data(){return{hasMounted:!1,currentText:"",currentValue:"",currentFocused:!1,currentOpened:!1,searchState:{word:"",last:""},_skipFocusEvent:!1,valueDuringOnChange:{},_navigated:!1,group:void 0,isScrolling:!1,itemHeight:0,state:void 0,popupWidth:void 0,windowWidth:0}},watch:{currentOpened:function(e,t){this.prevCurrentOpened=t},opened:function(e,t){this.prevOpened=t},virtual:function(e,t){e&&t&&e.total!==t.total&&(this.virtualTotalHasChanged=!0),this.virtualHasChanged=!0},isOpen:function(){setTimeout(()=>{const e=document.querySelector(".k-list-item");this.itemHeight=this.base.getListItemHeight(e)},100)}},created(){this.observer=null,this.valueDuringOnChange=void 0,this.currentText=void 0,this.currentValue=void 0,this.prevCurrentValue=this.computedValue(),this.currentFocused=void 0,this.currentOpened=void 0,this.base=new me(this),this.anchor=i.guid(),this.inputId=i.guid()},setup(){const e=n.ref(null),t=n.ref(null),a=n.ref(null);return{selectRef:e,baseWrapperRef:t,kendoAnchorRef:a}},mounted(){this.observer=i.canUseDOM&&window.ResizeObserver&&new ResizeObserver(this.calculateMedia),document!=null&&document.body&&this.observer&&this.observer.observe(document.body),this.hasMounted=!0,this.select=i.getRef(this,"select"),this.base.wrapper=i.getRef(this,"kendoAnchor"),this.base.didMount(),this.setValidity()},updated(){var b;const{dataItems:e=[],dataItemKey:t,virtual:a,groupField:r,textField:o}=this.$props,s=this.isOpen,u=this.prevOpened!==void 0?this.prevOpened:this.prevCurrentOpened,l=!u&&s,d=this.$refs.list,f=this.$refs.filterInput,g=this.$refs.scrollElement;if(this.$refs.scroller,d&&(this.base.vs.list=d.list,this.base.list=d.list),g&&(this.base.vs.scrollElement=g),f&&(this.filterInput=f),d&&e.length&&this.base.vs.scrollerRef(d.$el),this.$props.popupSettings.animate||l&&this.onPopupOpened(),a&&this.virtualTotalHasChanged)this.base.vs.calcScrollElementHeight(),this.base.vs.reset(),this.virtualTotalHasChanged=!1;else{const c=this.computedValue(),v=this.prevCurrentValue;let h=e.findIndex(y=>p.areSame(y,c,t));r&&(h=(b=this.base.getGroupedDataModernMode(e,r))==null?void 0:b.indexOf(c));const S=!p.areSame(v,c,t);l&&a?(this.base.scrollToVirtualItem(a,h),this.prevCurrentOpened=!0):l&&!a?(e&&e.length!==0&&this.base.resetGroupStickyHeader(e[0][r],this),this.base.scrollToItem(h),this.prevCurrentOpened=!0):s&&u&&c&&S&&!this._navigated?this.base.scrollToItem(h):s&&u&&this._navigated&&(this._navigated&&a&&a.skip===0?this.base.vs.reset():this._navigated&&a&&a.skip===a.total-a.pageSize&&this.base.vs.scrollToEnd())}this._navigated=!1,this.prevCurrentValue=this.computedValue(),this.setValidity()},computed:{index(){const{dataItems:e=[],dataItemKey:t}=this.$props,a=this.computedValue();return e.findIndex(r=>p.areSame(r,a,t))},spanClassNames(){const e=!this.hasMounted||!this.$props.validityStyles||this.validity().valid;return{"k-floating-label-container":!0,"k-focus":this.currentFocused,"k-empty":!this.computedValue(),"k-invalid":!e&&e!==void 0,"k-rtl":this.$props.dir==="rtl"}},dropDownListId(){return`value-${this.base.guid}${this.$props.ariaDescribedBy?" "+this.$props.ariaDescribedBy:""}`},isOpen(){return this.$props.opened!==void 0?this.$props.opened:this.currentOpened},animationStyles(){return this.windowWidth<=this.adaptiveModeBreakpoints.small?{top:0,width:"100%",height:"100%"}:void 0},classNameAdaptive(){return this.windowWidth<=this.adaptiveModeBreakpoints.small?"k-adaptive-actionsheet k-actionsheet-fullscreen":"k-adaptive-actionsheet k-actionsheet-bottom"},adaptiveState(){return this.windowWidth<=this.adaptiveModeBreakpoints.medium&&this.$props.adaptive}},methods:{focus(){this.base.wrapper&&this.base.wrapper.focus()},computedValue(){let e;return this.valueDuringOnChange!==void 0?e=this.valueDuringOnChange:this.$props.value!==void 0?e=this.$props.value:this.$props.modelValue!==void 0?e=this.$props.modelValue:this.currentValue!==void 0?e=this.currentValue:this.$props.defaultValue!==void 0&&(e=this.$props.defaultValue),!p.isPresent(e)&&this.$props.defaultItem!==void 0&&(e=this.$props.defaultItem),this.valuePrimitive&&this.findByFieldValue(this.valueField,e)||e},findByFieldValue(e,t){const a=this.dataItems.findIndex(r=>p.getItemValue(r,e)===t);return this.dataItems[a]},primitiveValue(){const e=this.computedValue();return this.valuePrimitive?p.getItemValue(e,this.valueField):e},validity(){const e=this.$props.validationMessage!==void 0,t=!this.$props.required||this.computedValue()!==null&&this.computedValue()!==""&&this.computedValue()!==void 0,a=this.$props.valid!==void 0?this.$props.valid:t;return{customError:e,valid:a,valueMissing:this.computedValue()===null}},handleItemSelect(e,t){const{dataItems:a=[],virtual:r,dataItemKey:o,defaultItem:s}=this.$props,u=r?r.skip:0,l=e===-1&&s!==void 0?s:a[e-u],d=!p.areSame(l,this.computedValue(),o);this.triggerOnChange(l,t),d&&this.base.triggerPageChangeCornerItems(l,t)},onNavigate(e,t){const{dataItems:a=[],defaultItem:r,dataItemKey:o,virtual:s={skip:0,total:0,pageSize:0}}=this.$props,u=this.base.vs,l=this.computedValue(),d=a.findIndex(g=>p.areSame(g,l,o)),f=this.base.navigation.navigate({current:s.skip+d,max:(u.enabled?s.total:a.length)-1,min:r!==void 0?-1:0,keyCode:t});f!==void 0&&this.handleItemSelect(f,e),this.applyState(e)},search(e){clearTimeout(this.typingTimeout),this.$props.filterable||(this.typingTimeout=setTimeout(()=>this.searchState.word="",this.$props.delay),this.selectNext(e))},selectNext(e){const{dataItems:t=[],dataItemKey:a}=this.$props;let r=t.map((y,x)=>({item:y,itemIndex:x}));const o=this.searchState.word,s=this.searchState.last,u=p.sameCharsOnly(o,s);let l=r.length,d=Math.max(0,t.findIndex(y=>p.areSame(y,this.computedValue(),a))),f;this.$props.defaultItem&&(f={item:this.$props.defaultItem,itemIndex:-1},l+=1,d+=1),d+=u?1:0,r=p.shuffleData(r,d,f);let g,b,c,v=0;const{textField:h,ignoreCase:S}=this.$props;for(;v<l;){if(g=p.getItemValue(r[v].item,h),b=u&&p.matchText(g,s,S),c=p.matchText(g,o,S),b||c){v=r[v].itemIndex;break}v++}if(v!==l){const y=this.base.initState();y.event=e,this.handleItemSelect(v,y),this.applyState(y),this.valueDuringOnChange=void 0}},handleKeyDown(e){this.isScrolling&&(this.isScrolling=!1);const{dataItems:t=[],leftRightKeysNavigation:a,filterable:r,disabled:o,virtual:s={skip:0,total:0,pageSize:0}}=this.$props,u=this.isOpen,l=e.keyCode,d=l===i.Keys.home||l===i.Keys.end,f=l===i.Keys.up||l===i.Keys.down,g=!u&&(e.altKey&&l===i.Keys.down||l===i.Keys.enter||l===i.Keys.space),b=u&&(e.altKey&&l===i.Keys.up||l===i.Keys.esc),c=a&&(l===i.Keys.left||l===i.Keys.right),v=f||!r&&(c||d),h=this.base.initState();if(h.event=e,!o){if(d&&this.base.vs.enabled)l===i.Keys.home?s.skip!==0?(this.base.triggerOnPageChange(h,0,s.pageSize),this._navigated=!0):this.triggerOnChange(t[0],h):s.skip<s.total-s.pageSize?(this.base.triggerOnPageChange(h,s.total-s.pageSize,s.pageSize),this._navigated=!0):this.triggerOnChange(t[t.length-1],h);else if(u&&l===i.Keys.enter){const S=this.focusedIndex();S!==void 0&&this.handleItemSelect(S,h),this.base.togglePopup(h),e.preventDefault()}else g||b?(this.adaptiveState&&this.handleWrapperClick(e),this.base.togglePopup(h),e.preventDefault()):v&&(this.onNavigate(h,l),e.preventDefault());this.applyState(h)}},handleItemClick(e,t){this.base.handleItemClick(e,t),this.valueDuringOnChange=void 0},handleFocus(e){this._skipFocusEvent||this.base.handleFocus(e)},handleBlur(e){if(this._skipFocusEvent||!this.currentFocused)return;const t=this.isOpen,a=this.base.initState();a.event=e,a.data.currentFocused=!1,a.events.push({type:"blur"}),t&&!this.adaptiveState&&this.base.togglePopup(a),this.applyState(a)},handleDefaultItemClick(e){const t=this.base.initState();t.event=e,this.base.togglePopup(t),this.triggerOnChange(this.$props.defaultItem,t),this.applyState(t)},handleWrapperClick(e){const t=this.base.initState();t.event=e,this.currentFocused||(t.data.currentFocused=!0),this.base.togglePopup(t),this.applyState(t)},handleKeyPress(e){if(this.$props.filterable||e.keyCode===i.Keys.enter)return;let t=String.fromCharCode(e.charCode||e.keyCode);this.$props.ignoreCase&&(t=t.toLowerCase()),t===" "&&e.preventDefault(),this.searchState={word:this.searchState.word+t,last:this.searchState.last+t},this.search(e)},handleListFilterChange(e){const t=this.base.initState();t.event=e,this.$props.filter===void 0&&(t.data.currentText=e.target.value),this.base.filterChanged(e.target.value,t),t.data.group=void 0,this.applyState(t)},onPopupOpened(){this.filterInput&&this.focusElement(this.filterInput.input)},onPopupClosed(){this.currentFocused&&setTimeout(()=>{this.currentFocused&&this.base.wrapper&&this.focusElement(this.base.wrapper)})},focusedIndex(){const e=p.isPresent(this.$props.filter)?this.$props.filter:this.currentText,{dataItems:t=[],virtual:a={skip:0},dataItemKey:r,textField:o,focusedItemIndex:s}=this.$props,u=this.computedValue(),d=!(t.findIndex(f=>p.areSame(f,u,r))<0&&!this.$props.defaultItem);return!d&&e&&a.skip===0?s?s(t,e,o):t.indexOf(p.getFocusedItem(t,e,o)):!d&&a.skip===0?0:void 0},focusElement(e){this._skipFocusEvent=!0,e.focus(),setTimeout(()=>this._skipFocusEvent=!1,30)},setValidity(){this.select&&this.select.setCustomValidity&&this.select.setCustomValidity(this.validity().valid?"":this.$props.validationMessage||Se)},triggerOnChange(e,t){p.areSame(this.computedValue(),e,this.$props.dataItemKey)||(this.$props.value===void 0&&(this.currentValue=e),this.valueDuringOnChange=e,t.events.push({type:"change"}))},applyState(e){this.base.applyState(e),this.valueDuringOnChange=void 0},calculateMedia(e){for(let t of e)this.windowWidth=t.target.clientWidth},repositionPopup(){this.base.repositionPopup()},onScroll(e){var b;this.isScrolling=!0;const{vs:t,list:a}=this.base;t.scrollHandler(e);const r=this.base.initState(),{groupField:o}=this.$props;let{dataItems:s=[]}=this.$props,u;if(!o||!s.length)return;const l=a&&((b=a.querySelector(".k-list-item"))==null?void 0:b.offsetHeight)||0,d=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:l),g=e.target.scrollTop-t.skip*d;o&&(s=this.base.getGroupedDataModernMode(s,o),u=s[0][o]);for(let c=1;c<s.length&&!(d*c>g);c++)s[c]&&s[c][o]&&(u=s[c][o]);u!==this.group&&(r.data.group=u,this.applyState(r))}},render(){const{style:e,className:t,label:a,dir:r,virtual:o={skip:0},size:s,rounded:u,fillMode:l,dataItemKey:d,dataItems:f=[],disabled:g,tabIndex:b,loading:c,icon:v,svgIcon:h,iconClassName:S,adaptiveTitle:y,header:x,footer:M,groupStickyHeaderItemRender:q}=this.$props,$=this.isOpen,z=p.getItemValue(this.computedValue(),this.$props.textField),A=!this.$props.validityStyles||this.validity().valid,k=this.base,V=k.vs,D=this.$props.id||this.inputId;V.enabled=this.$props.virtual!==void 0;const O=Object.assign({},{animate:!0,height:"200px"},this.$props.popupSettings),W=ve.provideLocalizationService(this).toLanguageString(w.selectButton,w.messages[w.selectButton]),N=this.adaptiveState;this.group===void 0&&this.$props.groupField!==void 0&&(this.group=p.getItemValue(this.$props.dataItems[0],this.$props.groupField));const G=i.templateRendering.call(this,this.$props.valueRender,i.getListeners.call(this)),U=this.currentFocused,T=this.primitiveValue(),Y=f.findIndex(m=>p.areSame(m,T,d)),J=n.createVNode("span",{class:"k-input-inner",id:this.dropDownListId},[n.createVNode("span",{class:"k-input-value-text"},[z])]);let Q=i.getTemplate.call(this,{h:n.h,template:G,defaultRendering:J,additionalProps:{value:this.computedValue(),...this.$data}});const X=function(m){return n.createVNode("select",{name:this.$props.name,id:D,ref:i.setRef(this,"select"),tabindex:-1,"aria-hidden":!0,title:this.$props.label,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},[n.createVNode("option",{value:this.$props.valueMap?this.$props.valueMap.call(void 0,m):m},null)])},Z=()=>[n.createVNode("div",{class:"k-actionsheet-titlebar-group k-hbox"},[n.createVNode("div",{class:"k-actionsheet-title"},[n.createVNode("div",{class:"k-text-center"},[y]),n.createVNode("div",{class:"k-actionsheet-subtitle k-text-center"},null)]),n.createVNode("div",{class:"k-actionsheet-actions"},[n.createVNode(E.Button,{tabIndex:5,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:this.handleWrapperClick,icon:"x",svgIcon:j.xIcon},null)])]),n.createVNode("div",{class:"k-actionsheet-titlebar-group k-actionsheet-filter"},[K.call(this)])],ee=i.templateRendering.call(this,Z,i.getListeners.call(this)),te=()=>{const m=k.getTemplateDef.call(this,x,n.h),I=k.getTemplateDef.call(this,M,n.h),C=i.templateRendering.call(this,q,i.getListeners.call(this));return n.createVNode("div",{class:"k-list-container"},[m&&n.createVNode("div",{class:"k-list-header"},[m]),n.createVNode("div",{class:i.classNames("k-list",{[`k-list-${L[s]||s}`]:N?!1:s,"k-list-lg":!!N,"k-virtual-list":V.enabled})},[R.call(this),this.group&&f.length!==0&&n.createVNode(P.GroupStickyHeader,{group:this.group,render:C},null),B.call(this),I&&n.createVNode("div",{class:"k-list-footer"},[I])])])},ie=i.templateRendering.call(this,te,i.getListeners.call(this)),se=function(){return n.createVNode(be.ActionSheet,{expand:$,animation:!0,animationStyles:this.animationStyles,className:this.classNameAdaptive,contentClassName:"!k-overflow-hidden",header:ee,content:ie,onClose:this.handleWrapperClick,navigatableElements:["input.k-input-inner",".k-actionsheet-actions > button"]},null)},R=function(){const{textField:m,defaultItem:I}=this.$props;return I!==void 0&&n.createVNode(fe.ListDefaultItem,{defaultItem:I,textField:m,selected:p.areSame(this.computedValue(),I,d),key:"defaultitemkey",onDefaultitemclick:this.handleDefaultItemClick},null)},B=function(){let m;const{textField:I,groupField:C}=this.$props;let F=this.$props.dataItems||[];const re=i.templateRendering.call(this,this.$props.itemRender,i.getListeners.call(this)),oe=i.templateRendering.call(this,this.$props.groupHeaderItemRender,i.getListeners.call(this)),de=i.templateRendering.call(this,this.$props.listNoDataRender,i.getListeners.call(this)),ue=o.skip,pe=`translateY(${V.translate}px)`;return C&&(F=this.base.getGroupedDataModernMode(F,C)),n.createVNode(ge.List,{id:this.base.listBoxId,show:$,dataItems:F.slice(),focusedIndex:this.focusedIndex(),value:this.computedValue(),textField:I,valueField:d,optionsGuid:this.base.guid,ref:"list",wrapperStyle:{maxHeight:O.height},wrapperCssClass:"k-list-content",listStyle:V.enabled?{transform:pe}:void 0,key:"listkey",skip:ue,onListclick:this.handleItemClick,itemRender:re,groupHeaderItemRender:oe,noDataRender:de,groupField:C,onScroll:this.onScroll},Ie(m=ae.call(this))?m:{default:()=>[m]})},K=function(){const m=this.$props.filter!==void 0?this.$props.filter:this.currentText;return this.$props.filterable&&n.createVNode(he.ListFilter,{value:m,ref:"filterInput",onChange:this.handleListFilterChange,onKeydown:this.handleKeyDown,size:this.$props.size,rounded:this.$props.rounded,fillMode:this.$props.fillMode,ariaControlsId:this.base.listBoxId,ariaActivedescendantId:`option-${this.base.guid}-${this.focusedIndex()}`},null)},ae=function(){return V.enabled&&n.createVNode("div",{ref:"scrollElement",key:"scrollElementKey"},null)},ne=function(){const m=i.templateRendering.call(this,this.$props.groupStickyHeaderItemRender,i.getListeners.call(this)),I=k.getTemplateDef.call(this,x),C=k.getTemplateDef.call(this,M);return n.createVNode(ce.ListContainer,{ref:"container",onMousedown:p.preventDefaultNonInputs,dir:r!==void 0?r:k.dirCalculated,width:this.popupWidth,popupSettings:{...O,popupClass:i.classNames(O.popupClass,"k-list",{[`k-list-${L[s]||s}`]:s,"k-virtual-list":this.base.vs.enabled}),className:i.classNames("k-list-container",O.className),anchor:this.anchor,show:$},onOpen:this.onPopupOpened,onClose:this.onPopupClosed,onBlur:this.handleBlur},{default:()=>[K.call(this),R.call(this),this.group&&f.length!==0&&n.createVNode(P.GroupStickyHeader,{group:this.group,render:m},null),I&&n.createVNode("div",{class:"k-list-header"},[I]),B.call(this),C&&n.createVNode("div",{class:"k-list-footer"},[C])]})};this.$props.virtual!==void 0&&(k.vs.skip=o.skip,k.vs.total=o.total,k.vs.pageSize=o.pageSize);const le=function(){return n.createVNode("span",{ref:i.setRef(this,"kendoAnchor"),class:i.classNames("k-dropdownlist k-picker",t,{[`k-picker-${L[s]||s}`]:s,[`k-rounded-${ye[u]||u}`]:u,[`k-picker-${l}`]:l,"k-focus":U,"k-disabled":g,"k-invalid":!A,"k-loading":c,"k-required":this.required}),style:a?{...e,width:void 0}:e,dir:r,onMousedown:$?p.preventDefaultNonInputs:i.noop,onFocusin:this.handleFocus,onFocusout:this.handleBlur,tabindex:i.getTabIndex(b,g),accesskey:this.$props.accessKey,onKeydown:this.handleKeyDown,onKeypress:this.handleKeyPress,role:"combobox",onClick:g?i.noop:this.handleWrapperClick,"aria-disabled":g||void 0,"aria-haspopup":"listbox","aria-expanded":$||!1,"aria-controls":$?this.base.listBoxId:void 0,"aria-activedescendant":$?"option-"+this.base.guid+"-"+(Y+(o?o.skip:0)):void 0,"aria-label":this.$props.ariaLabel||this.$props.label,"aria-labelledby":this.$props.ariaLabelledBy,"aria-describedby":$?this.dropDownListId:void 0,title:this.$props.title},[Q,c&&n.createVNode(i.Icon,{name:"loading",class:"k-input-loading-icon",key:"loading"},null),n.createVNode(E.Button,{type:"button",tabIndex:-1,size:s,fillMode:l,rounded:null,ariaLabel:W,class:"k-input-button",icon:v||"chevron-down",svgIcon:h||j.chevronDownIcon,iconClass:S},null),X.call(this,T),!N&&ne.call(this)])},H=[n.h(le.call(this),{...this.$attrs}),N&&se.call(this)];return a?n.createVNode("span",{class:this.spanClassNames,onFocusin:this.handleFocus,onFocusout:this.handleBlur,dir:this.$props.dir},[H,this.$props.label?D?n.createVNode("label",{for:D,class:"k-floating-label"},[this.$props.label]):n.createVNode("span",{class:"k-label"},[this.$props.label]):null]):H}});exports.DropDownList=ke;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import { defineComponent as Se, createVNode as n, h as T, ref as N, isVNode as $e } from "vue";
|
|
9
|
-
import { kendoThemeMaps as Ce, templateRendering as
|
|
9
|
+
import { kendoThemeMaps as Ce, templateRendering as x, getListeners as O, getTemplate as xe, Keys as m, canUseDOM as Oe, getRef as A, guid as W, classNames as B, noop as G, getTabIndex as we, setRef as q, Icon as Fe } from "@progress/kendo-vue-common";
|
|
10
10
|
import { Button as U } from "@progress/kendo-vue-buttons";
|
|
11
11
|
import { ListContainer as De } from "../common/ListContainer.mjs";
|
|
12
12
|
import { ListFilter as Ve } from "../common/ListFilter.mjs";
|
|
@@ -19,7 +19,7 @@ import { provideLocalizationService as Re } from "@progress/kendo-vue-intl";
|
|
|
19
19
|
import { MOBILE_MEDIUM_DEVICE as Ne, MOBILE_SMALL_DEVICE as Ee } from "../common/constants.mjs";
|
|
20
20
|
import { ActionSheet as He } from "@progress/kendo-vue-layout";
|
|
21
21
|
import { getItemValue as F, areSame as I, isPresent as Q, getFocusedItem as Ke, sameCharsOnly as Pe, shuffleData as _e, matchText as X, preventDefaultNonInputs as Z } from "../common/utils.mjs";
|
|
22
|
-
import { xIcon as je,
|
|
22
|
+
import { xIcon as je, chevronDownIcon as ze } from "@progress/kendo-svg-icons";
|
|
23
23
|
const {
|
|
24
24
|
sizeMap: E,
|
|
25
25
|
roundedMap: Ae
|
|
@@ -523,14 +523,14 @@ const Ge = "Please select a value from the list!", dt = /* @__PURE__ */ Se({
|
|
|
523
523
|
header: D,
|
|
524
524
|
footer: H,
|
|
525
525
|
groupStickyHeaderItemRender: ee
|
|
526
|
-
} = this.$props,
|
|
526
|
+
} = this.$props, $ = this.isOpen, te = F(this.computedValue(), this.$props.textField), ie = !this.$props.validityStyles || this.validity().valid, S = this.base, w = S.vs, L = this.$props.id || this.inputId;
|
|
527
527
|
w.enabled = this.$props.virtual !== void 0;
|
|
528
528
|
const V = Object.assign({}, {
|
|
529
529
|
animate: !0,
|
|
530
530
|
height: "200px"
|
|
531
531
|
}, this.$props.popupSettings), se = Re(this).toLanguageString(J, Le[J]), M = this.adaptiveState;
|
|
532
532
|
this.group === void 0 && this.$props.groupField !== void 0 && (this.group = F(this.$props.dataItems[0], this.$props.groupField));
|
|
533
|
-
const ae =
|
|
533
|
+
const ae = x.call(this, this.$props.valueRender, O.call(this)), ne = this.currentFocused, K = this.primitiveValue(), le = h.findIndex((f) => I(f, K, r)), oe = n("span", {
|
|
534
534
|
class: "k-input-inner",
|
|
535
535
|
id: this.dropDownListId
|
|
536
536
|
}, [n("span", {
|
|
@@ -585,8 +585,8 @@ const Ge = "Please select a value from the list!", dt = /* @__PURE__ */ Se({
|
|
|
585
585
|
svgIcon: je
|
|
586
586
|
}, null)])]), n("div", {
|
|
587
587
|
class: "k-actionsheet-titlebar-group k-actionsheet-filter"
|
|
588
|
-
}, [j.call(this)])], ue =
|
|
589
|
-
const f = S.getTemplateDef.call(this, D, T), y = S.getTemplateDef.call(this, H, T),
|
|
588
|
+
}, [j.call(this)])], ue = x.call(this, pe, O.call(this)), he = () => {
|
|
589
|
+
const f = S.getTemplateDef.call(this, D, T), y = S.getTemplateDef.call(this, H, T), C = x.call(this, ee, O.call(this));
|
|
590
590
|
return n("div", {
|
|
591
591
|
class: "k-list-container"
|
|
592
592
|
}, [f && n("div", {
|
|
@@ -599,13 +599,13 @@ const Ge = "Please select a value from the list!", dt = /* @__PURE__ */ Se({
|
|
|
599
599
|
})
|
|
600
600
|
}, [P.call(this), this.group && h.length !== 0 && n(Y, {
|
|
601
601
|
group: this.group,
|
|
602
|
-
render:
|
|
602
|
+
render: C
|
|
603
603
|
}, null), _.call(this), y && n("div", {
|
|
604
604
|
class: "k-list-footer"
|
|
605
605
|
}, [y])])]);
|
|
606
|
-
}, ce =
|
|
606
|
+
}, ce = x.call(this, he, O.call(this)), fe = function() {
|
|
607
607
|
return n(He, {
|
|
608
|
-
expand:
|
|
608
|
+
expand: $,
|
|
609
609
|
animation: !0,
|
|
610
610
|
animationStyles: this.animationStyles,
|
|
611
611
|
className: this.classNameAdaptive,
|
|
@@ -631,13 +631,13 @@ const Ge = "Please select a value from the list!", dt = /* @__PURE__ */ Se({
|
|
|
631
631
|
let f;
|
|
632
632
|
const {
|
|
633
633
|
textField: y,
|
|
634
|
-
groupField:
|
|
634
|
+
groupField: C
|
|
635
635
|
} = this.$props;
|
|
636
636
|
let R = this.$props.dataItems || [];
|
|
637
|
-
const ve =
|
|
638
|
-
return
|
|
637
|
+
const ve = x.call(this, this.$props.itemRender, O.call(this)), be = x.call(this, this.$props.groupHeaderItemRender, O.call(this)), ye = x.call(this, this.$props.listNoDataRender, O.call(this)), Ie = o.skip, ke = `translateY(${w.translate}px)`;
|
|
638
|
+
return C && (R = this.base.getGroupedDataModernMode(R, C)), n(Te, {
|
|
639
639
|
id: this.base.listBoxId,
|
|
640
|
-
show:
|
|
640
|
+
show: $,
|
|
641
641
|
dataItems: R.slice(),
|
|
642
642
|
focusedIndex: this.focusedIndex(),
|
|
643
643
|
value: this.computedValue(),
|
|
@@ -658,7 +658,7 @@ const Ge = "Please select a value from the list!", dt = /* @__PURE__ */ Se({
|
|
|
658
658
|
itemRender: ve,
|
|
659
659
|
groupHeaderItemRender: be,
|
|
660
660
|
noDataRender: ye,
|
|
661
|
-
groupField:
|
|
661
|
+
groupField: C,
|
|
662
662
|
onScroll: this.onScroll
|
|
663
663
|
}, We(f = me.call(this)) ? f : {
|
|
664
664
|
default: () => [f]
|
|
@@ -682,7 +682,7 @@ const Ge = "Please select a value from the list!", dt = /* @__PURE__ */ Se({
|
|
|
682
682
|
key: "scrollElementKey"
|
|
683
683
|
}, null);
|
|
684
684
|
}, ge = function() {
|
|
685
|
-
const f =
|
|
685
|
+
const f = x.call(this, this.$props.groupStickyHeaderItemRender, O.call(this)), y = S.getTemplateDef.call(this, D), C = S.getTemplateDef.call(this, H);
|
|
686
686
|
return n(De, {
|
|
687
687
|
ref: "container",
|
|
688
688
|
onMousedown: Z,
|
|
@@ -696,7 +696,7 @@ const Ge = "Please select a value from the list!", dt = /* @__PURE__ */ Se({
|
|
|
696
696
|
}),
|
|
697
697
|
className: B("k-list-container", V.className),
|
|
698
698
|
anchor: this.anchor,
|
|
699
|
-
show:
|
|
699
|
+
show: $
|
|
700
700
|
},
|
|
701
701
|
onOpen: this.onPopupOpened,
|
|
702
702
|
onClose: this.onPopupClosed,
|
|
@@ -707,9 +707,9 @@ const Ge = "Please select a value from the list!", dt = /* @__PURE__ */ Se({
|
|
|
707
707
|
render: f
|
|
708
708
|
}, null), y && n("div", {
|
|
709
709
|
class: "k-list-header"
|
|
710
|
-
}, [y]), _.call(this),
|
|
710
|
+
}, [y]), _.call(this), C && n("div", {
|
|
711
711
|
class: "k-list-footer"
|
|
712
|
-
}, [
|
|
712
|
+
}, [C])]
|
|
713
713
|
});
|
|
714
714
|
};
|
|
715
715
|
this.$props.virtual !== void 0 && (S.vs.skip = o.skip, S.vs.total = o.total, S.vs.pageSize = o.pageSize);
|
|
@@ -731,7 +731,7 @@ const Ge = "Please select a value from the list!", dt = /* @__PURE__ */ Se({
|
|
|
731
731
|
width: void 0
|
|
732
732
|
} : e,
|
|
733
733
|
dir: l,
|
|
734
|
-
onMousedown:
|
|
734
|
+
onMousedown: $ ? Z : G,
|
|
735
735
|
onFocusin: this.handleFocus,
|
|
736
736
|
onFocusout: this.handleBlur,
|
|
737
737
|
tabindex: we(v, c),
|
|
@@ -741,13 +741,13 @@ const Ge = "Please select a value from the list!", dt = /* @__PURE__ */ Se({
|
|
|
741
741
|
role: "combobox",
|
|
742
742
|
onClick: c ? G : this.handleWrapperClick,
|
|
743
743
|
"aria-disabled": c || void 0,
|
|
744
|
-
"aria-haspopup":
|
|
745
|
-
"aria-expanded":
|
|
746
|
-
"aria-
|
|
747
|
-
"aria-activedescendant":
|
|
744
|
+
"aria-haspopup": "listbox",
|
|
745
|
+
"aria-expanded": $ || !1,
|
|
746
|
+
"aria-controls": $ ? this.base.listBoxId : void 0,
|
|
747
|
+
"aria-activedescendant": $ ? "option-" + this.base.guid + "-" + (le + (o ? o.skip : 0)) : void 0,
|
|
748
748
|
"aria-label": this.$props.ariaLabel || this.$props.label,
|
|
749
749
|
"aria-labelledby": this.$props.ariaLabelledBy,
|
|
750
|
-
"aria-
|
|
750
|
+
"aria-describedby": $ ? this.dropDownListId : void 0,
|
|
751
751
|
title: this.$props.title
|
|
752
752
|
}, [re, p && n(Fe, {
|
|
753
753
|
name: "loading",
|
|
@@ -761,7 +761,7 @@ const Ge = "Please select a value from the list!", dt = /* @__PURE__ */ Se({
|
|
|
761
761
|
rounded: null,
|
|
762
762
|
ariaLabel: se,
|
|
763
763
|
class: "k-input-button",
|
|
764
|
-
icon: g || "
|
|
764
|
+
icon: g || "chevron-down",
|
|
765
765
|
svgIcon: u || ze,
|
|
766
766
|
iconClass: k
|
|
767
767
|
}, null), de.call(this, K), !M && ge.call(this)]);
|
|
@@ -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 s=require("vue"),t=require("@progress/kendo-vue-common"),ne=require("@progress/kendo-vue-popup"),ae=require("@progress/kendo-vue-intl"),O=require("@progress/kendo-vue-treeview"),b=require("../package-metadata.js"),k=require("../common/utils.js"),oe=require("./ListNoData.js"),c=require("../messages/main.js"),le=require("@progress/kendo-vue-labels"),T=require("../common/ListFilter.js"),B=require("@progress/kendo-vue-buttons"),w=require("@progress/kendo-svg-icons"),K=require("../common/constants.js"),re=require("@progress/kendo-vue-layout"),de=require("../common/DropDownBase.js");function L(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!s.isVNode(e)}const{sizeMap:ue,roundedMap:ce}=t.kendoThemeMaps,pe="Please select a value from the list!",E=e=>e.split("_").map(i=>parseInt(i,10)),S=(e,i)=>{const{validationMessage:n,valid:a,required:o}=e;return{customError:n!==void 0,valid:!!(a!==void 0?a:!o||i),valueMissing:!i}},he=s.defineComponent({name:"KendoDropDownTree",model:{event:"changemodel"},emits:{open:e=>!0,close:e=>!0,focus:e=>!0,blur:e=>!0,change:e=>!0,filterchange:e=>!0,expandchange:e=>!0,changemodel:e=>!0,"update:modelValue":e=>!0},props:{opened:{type:Boolean,default:void 0},disabled:Boolean,dir:String,tabIndex:Number,accessKey:String,dataItems:{type:Array,default:function(){return[]}},value:{type:[Object,String,Number,Boolean],default:function(){}},modelValue:{type:[Object,String,Number,Boolean],default:function(){}},valueMap:Function,placeholder:String,dataItemKey:{type:String,required:!0},textField:{type:String,required:!0},selectField:{type:String,default:"selected"},expandField:String,subItemsField:{type:String,default:"items"},className:String,label:String,validationMessage:String,validityStyles:{type:Boolean,default:!0},valid:{type:Boolean,default:void 0},required:Boolean,name:String,id:String,ariaLabel:{type:String,default:void 0},ariaLabelledBy:String,ariaDescribedBy:String,filterable:Boolean,filter:String,loading:Boolean,popupSettings:{type:Object,default:function(){return{animate:!0,height:"200px",anchor:""}}},size:{type:String,validator:function(e){return["small","medium","large"].includes(e)}},rounded:{type:String,validator:function(e){return["none","small","medium","large","full"].includes(e)}},fillMode:{type:String,validator:function(e){return["flat","outline","solid"].includes(e)}},item:[String,Function,Object],header:[String,Function,Object],footer:[String,Function,Object],valueRender:[String,Function,Object],listNoData:[String,Function,Object],adaptive:{type:Boolean,default:void 0},adaptiveTitle:{type:String,default:void 0}},inject:{kendoLocalizationService:{default:null},adaptiveModeBreakpoints:{default:{small:K.MOBILE_SMALL_DEVICE,medium:K.MOBILE_MEDIUM_DEVICE}}},created(){this.observer=null,t.validatePackage(b.packageMetadata),this.showLicenseWatermark=t.shouldShowValidationUI(b.packageMetadata),this.licenseMessage=t.getLicenseMessage(b.packageMetadata),this.base=new de(this),this.componentGuid=t.guid(),this.anchor=t.guid()},data(){return{showLicenseWatermark:!1,licenseMessage:void 0,currentOpened:!1,focused:!1,filterState:"",currentValue:void 0,popupWidth:"200px",windowWidth:0,initialAdaptiveRenderingValues:void 0}},computed:{wrapperClass(){const{validationMessage:e,valid:i,required:n,validityStyles:a}=this.$props,o=S({validationMessage:e,valid:i,required:n},this.hasValue),d=!a||o.valid,{size:r,rounded:l,fillMode:u}=this.$props;return{"k-dropdowntree":!0,"k-picker":!0,[this.$props.className]:this.$props.className,[`k-picker-${ue[r]||r}`]:r,[`k-rounded-${ce[l]||l}`]:l,[`k-picker-${u}`]:u,"k-focus":this.focused,"k-invalid":!d,"k-loading":this.$props.loading,"k-required":n,"k-disabled":this.$props.disabled}},animationStyles(){return this.windowWidth<=this.adaptiveModeBreakpoints.small?{top:0,width:"100%",height:"100%"}:void 0},classNameAdaptive(){return this.windowWidth<=this.adaptiveModeBreakpoints.small?"k-adaptive-actionsheet k-actionsheet-fullscreen":"k-adaptive-actionsheet k-actionsheet-bottom"},adaptiveState(){return this.windowWidth<=this.adaptiveModeBreakpoints.medium&&this.$props.adaptive},isOpen(){return this.opened!==void 0?this.opened:this.currentOpened},computedValue(){return this.value!==void 0?this.value:this.$props.modelValue!==void 0?this.$props.modelValue:this.currentValue},hasValue(){return k.isPresent(this.computedValue)},currentValueText(){return this.hasValue?k.getItemValue(this.computedValue,this.$props.textField):""}},watch:{isOpen:function(e){e&&this.value?this.initialAdaptiveRenderingValues=[this.value]:this.initialAdaptiveRenderingValues=void 0}},mounted(){this.observer=t.canUseDOM&&window.ResizeObserver&&new ResizeObserver(this.calculateMedia),document!=null&&document.body&&this.observer&&this.observer.observe(document.body),this.elementRef=t.getRef(this,"kendoAnchor"),this.inputRef=t.getRef(this,"input"),this.selectRef=t.getRef(this,"select"),this.treeViewRef=t.getRef(this,"treeView"),this.skipFocusRef=!1,this.popupRef=t.getRef(this,"popup"),this.calculatePopupWidth()},updated(){this.inputRef=t.getRef(this,"input"),this.treeViewRef=t.getRef(this,"treeView"),this.popupRef&&this.isOpen&&this.hasValue&&this.popupRef.reposition(),this.setValidity(),this.calculatePopupWidth()},render(){let e;const i=this.$props.id||this.componentGuid,{dataItems:n,dataItemKey:a,popupSettings:o,disabled:d,placeholder:r,label:l,name:u,selectField:R,subItemsField:$,validationMessage:q,valid:W,required:F,validityStyles:P,adaptiveTitle:A}=this.$props,g=t.getTabIndex(this.$props.tabIndex,d),x=ae.provideLocalizationService(this),z=S({validationMessage:q,valid:W,required:F},this.hasValue),I=this.adaptiveState,p=this.$props.dir,N=t.templateRendering.call(this,this.item,t.getListeners.call(this)),j=t.templateRendering.call(this,this.valueRender,t.getListeners.call(this)),_=t.templateRendering.call(this,this.$props.header,t.getListeners.call(this)),G=t.templateRendering.call(this,this.$props.footer,t.getListeners.call(this)),v=t.getTemplate.call(this,{h:s.h,template:_}),y=t.getTemplate.call(this,{h:s.h,template:G}),H=t.templateRendering.call(this,this.$props.listNoData,t.getListeners.call(this)),U=s.createVNode(oe.ListNoData,null,L(e=x.toLanguageString(c.nodata,c.messages[c.nodata]))?e:{default:()=>[e]}),M=t.getTemplate.call(this,{h:s.h,defaultRendering:U,template:H}),J=s.createVNode("span",{class:"k-input-value-text"},[this.currentValueText||r]),Q=t.getTemplate.call(this,{h:s.h,defaultRendering:J,template:j,additionalProps:{value:this.computedValue}}),X=()=>[s.createVNode("div",{class:"k-actionsheet-titlebar-group k-hbox"},[s.createVNode("div",{class:"k-actionsheet-title"},[s.createVNode("div",{class:"k-text-center"},[A]),s.createVNode("div",{class:"k-actionsheet-subtitle k-text-center"},[r])]),s.createVNode("div",{class:"k-actionsheet-actions"},[s.createVNode(B.Button,{tabIndex:1,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:this.onWrapperClick,icon:"x",svgIcon:w.xIcon},null)])]),s.createVNode("div",{class:"k-actionsheet-titlebar-group k-actionsheet-filter"},[this.$props.filterable&&s.createVNode(T.ListFilter,{tabIndex:0,value:this.$props.filter===void 0?this.filterState:this.$props.filter,ref:t.setRef(this,"input"),onChange:this.onFilterChange,onKeydown:this.onInputKeyDown,size:h,rounded:D,fillMode:V,onFocus:this.onFocus,onBlur:this.onBlur},null)])],Y=t.templateRendering.call(this,X,t.getListeners.call(this)),Z=()=>{const m=this.base.getTemplateDef.call(this,v,s.h),C=this.base.getTemplateDef.call(this,y,s.h);return[m&&s.createVNode("div",{class:"k-list-header"},[m]),n.length>0?s.createVNode(O.TreeView,{ref:t.setRef(this,"treeView"),tabIndex:g,dataItems:n,focusIdField:a,textField:this.$props.textField,selectField:R,expandField:this.$props.expandField,childrenField:$,expandIcons:!0,onItemclick:this.onChange,onExpandchange:this.onExpand,onFocus:this.onFocus,onBlur:this.onBlur,onKeydown:this.onWrapperKeyDown,size:"large",item:N},null):M,C&&s.createVNode("div",{class:"k-list-footer"},[C])]},ee=t.templateRendering.call(this,Z,t.getListeners.call(this)),te=function(){return s.createVNode(re.ActionSheet,{expand:this.isOpen,animation:!0,animationStyles:this.animationStyles,className:this.classNameAdaptive,header:Y,content:ee,contentClassName:"!k-overflow-hidden",onClose:this.onWrapperClick,navigatableElements:["input.k-input-inner",".k-actionsheet-actions > button"]},null)},ie=!P||z.valid,{size:h,rounded:D,fillMode:V}=this.$props,se=function(){return s.createVNode("span",{class:this.wrapperClass,tabindex:g,accesskey:this.$props.accessKey,id:i,dir:p,ref:t.setRef(this,"kendoAnchor"),onKeydown:this.onWrapperKeyDown,onClick:this.onWrapperClick,onMousedown:this.onWrapperMouseDown,onFocusin:this.onFocus,onFocusout:this.onBlur,role:"combobox","aria-haspopup":"tree","aria-expanded":this.isOpen,"aria-disabled":d,"aria-label":l||this.$props.ariaLabel,"aria-labelledby":this.$props.ariaLabelledBy,"aria-describedby":this.$props.ariaDescribedBy,"aria-required":F},[s.createVNode("span",{class:"k-input-inner"},[Q]),this.$props.loading&&s.createVNode(t.Icon,{class:"k-input-loading-icon",name:"loading"},null),this.hasValue&&!d&&s.createVNode("span",{onClick:this.onClear,class:"k-clear-value",title:x.toLanguageString(c.clear,c.messages[c.clear]),role:"button",tabindex:-1,onMousedown:m=>m.preventDefault()},[s.createVNode(t.Icon,{name:"x",icon:w.xIcon},null)]),s.createVNode(B.Button,{tabIndex:-1,type:"button","aria-label":"select",class:"k-input-button",size:h,fillMode:V,themeColor:"base",rounded:null,icon:"caret-alt-down",svgIcon:w.caretAltDownIcon},null),s.createVNode("select",{name:u,ref:t.setRef(this,"select"),tabindex:-1,"aria-hidden":!0,title:l,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},[s.createVNode("option",{value:this.$props.valueMap?this.$props.valueMap.call(void 0,this.computedValue):this.computedValue},null)]),this.showLicenseWatermark?s.createVNode(t.WatermarkOverlay,{message:this.licenseMessage},null):null,!I&&s.createVNode(ne.Popup,{style:{width:this.popupWidth,direction:p},ref:t.setRef(this,"popup"),class:t.classNames(o.className,{"k-rtl":p==="rtl"}),popupClass:t.classNames(o.popupClass,"k-dropdowntree-popup","popup-"+this.componentGuid),animate:o.animate,anchor:this.anchor,show:this.isOpen,onOpen:this.onPopupOpened,onClose:this.onPopupClosed,appendTo:o.appendTo},{default:()=>[this.$props.filterable&&s.createVNode(T.ListFilter,{value:this.$props.filter===void 0?this.filterState:this.$props.filter,ref:t.setRef(this,"input"),onChange:this.onFilterChange,onKeydown:this.onInputKeyDown,onBlur:this.onBlur,size:h,rounded:D,fillMode:V},null),v&&s.createVNode("div",{class:"k-list-header"},[v]),n.length>0?s.createVNode(O.TreeView,{ref:t.setRef(this,"treeView"),tabIndex:g,dataItems:n,focusIdField:a,textField:this.$props.textField,selectField:R,expandField:this.$props.expandField,childrenField:$,expandIcons:!0,onItemclick:this.onChange,onExpandchange:this.onExpand,onFocus:this.onFocus,onBlur:this.onBlur,onKeydown:this.onWrapperKeyDown,size:h,item:N},null):M,y&&s.createVNode("div",{class:"k-list-footer"},[y])]})])},f=[s.h(se.call(this),{...this.$attrs}),I&&te.call(this)];return l?s.createVNode(le.FloatingLabel,{label:l,editorValue:this.currentValueText,editorPlaceholder:r,editorValid:ie,editorDisabled:d,editorId:i,focused:this.focused,dir:p},L(f)?f:{default:()=>[f]}):f},methods:{calculateMedia(e){for(let i of e)this.windowWidth=i.target.clientWidth},calculatePopupWidth(){this.elementRef&&(this.popupWidth=this.popupSettings.width!==void 0?this.popupSettings.width:this.elementRef.offsetWidth+"px")},focus(){this.$el&&this.$el.focus()},setValidity(){if(this.selectRef&&this.selectRef.setCustomValidity){const{validationMessage:e,valid:i,required:n}=this.$props,a=S({validationMessage:e,valid:i,required:n},this.hasValue);this.selectRef.setCustomValidity(a.valid?"":this.validationMessage===void 0?pe:this.validationMessage)}},openPopup(e){if(!this.isOpen){const i={...e};this.$emit("open",i),this.currentOpened=!0}},closePopup(e){if(this.isOpen){const i={...e};this.$emit("close",i),this.currentOpened=!1}},onWrapperClick(e){if(this.onFilterChange({...e,target:{value:""}}),!e.defaultPrevented&&this.$el){this.focused=!0;const i={event:e,target:this};(this.isOpen?this.closePopup:this.openPopup)(i)}},switchFocus(e){this.skipFocusRef=!0,e(),window.setTimeout(()=>this.skipFocusRef=!1,0)},onWrapperKeyDown(e){const{keyCode:i,altKey:n}=e,a=this.treeViewRef&&this.treeViewRef.$el,o=this.inputRef&&this.inputRef.input;if(this.$props.disabled||e.defaultPrevented&&o===e.target)return;const d={event:e,target:this};if(this.isOpen)if(i===t.Keys.esc||n&&i===t.Keys.up)e.preventDefault(),this.closePopup(d);else if(a&&a.querySelector(".k-focus")&&(i===t.Keys.up||i===t.Keys.down||i===t.Keys.left||i===t.Keys.right||i===t.Keys.home||i===t.Keys.end)){if(i===t.Keys.up&&o){const r=Array.from(a.querySelectorAll(".k-treeview-item")),l=[...r].reverse().find(u=>!!(u&&u.querySelector(".k-focus")));if(l&&r.indexOf(l)===0)return this.switchFocus(()=>{this.focusElement(o)})}this.switchFocus(t.noop)}else i===t.Keys.down&&this.switchFocus(()=>{this.focusElement(o||a)});else n&&i===t.Keys.down&&(e.preventDefault(),this.openPopup(d))},onInputKeyDown(e){const{keyCode:i,altKey:n}=e;if(i===t.Keys.esc)this.onWrapperClick(e);else if(n||i!==t.Keys.up&&i!==t.Keys.down)return;e.preventDefault(),this.switchFocus(i===t.Keys.up?()=>{this.focusElement(this.elementRef)}:()=>{this.focusElement(this.treeViewRef&&this.treeViewRef.$el)})},focusElement(e){e&&this.switchFocus(()=>e.focus())},onPopupOpened(){if(!this.focused&&this.isOpen&&!this.currentOpened)this.closePopup({target:this});else if(this.$props.filterable){const e=this.inputRef&&this.inputRef.input;this.focusElement(e)}else this.focusElement(this.treeViewRef&&this.treeViewRef.$el)},onPopupClosed(){this.focused&&this.focusElement(this.elementRef)},onFocus(e){if(!this.focused&&!this.skipFocusRef){this.focused=!0;const i={event:e,target:this};this.$emit("focus",i)}},onBlur(e){var i;if(this.focused&&!this.skipFocusRef){this.focused=!1;const n={event:e,target:this},a={...n},o=e.relatedTarget||((i=e.event)==null?void 0:i.relatedTarget);!(o!=null&&o.closest(".popup-"+this.componentGuid))&&!this.adaptiveState&&(this.$emit("blur",a),this.closePopup(n))}},onWrapperMouseDown(){this.focused&&this.switchFocus(t.noop)},changeValue(e,i,n){const a={value:i,level:n?E(n):[],...e};this.$emit("changemodel",i),this.$emit("update:modelValue",i),this.$emit("change",a),this.currentValue=i},onChange(e){if(k.areSame(e.item,this.computedValue,this.dataItemKey)||!this.$el)return;const{item:i,itemHierarchicalIndex:n,event:a}=e,o={event:a,target:this};this.changeValue(o,i,n),this.closePopup(o)},onClear(e){const i={event:e,target:this};this.changeValue(i,null),this.closePopup(i),e.preventDefault()},onExpand(e){const{item:i,itemHierarchicalIndex:n,event:a}=e,o={level:E(n),item:i,event:a,target:this};this.$emit("expandchange",o)},onFilterChange(e){const n={filter:{field:this.$props.textField,operator:"contains",value:e.target.value},event:e,target:this};this.$emit("filterchange",n),this.$props.filter===void 0&&(this.filterState=e.target.value)}}});exports.DropDownTree=he;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("vue"),t=require("@progress/kendo-vue-common"),ne=require("@progress/kendo-vue-popup"),ae=require("@progress/kendo-vue-intl"),O=require("@progress/kendo-vue-treeview"),b=require("../package-metadata.js"),k=require("../common/utils.js"),oe=require("./ListNoData.js"),c=require("../messages/main.js"),le=require("@progress/kendo-vue-labels"),T=require("../common/ListFilter.js"),B=require("@progress/kendo-vue-buttons"),w=require("@progress/kendo-svg-icons"),K=require("../common/constants.js"),re=require("@progress/kendo-vue-layout"),de=require("../common/DropDownBase.js");function L(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!s.isVNode(e)}const{sizeMap:ue,roundedMap:ce}=t.kendoThemeMaps,pe="Please select a value from the list!",E=e=>e.split("_").map(i=>parseInt(i,10)),S=(e,i)=>{const{validationMessage:n,valid:a,required:o}=e;return{customError:n!==void 0,valid:!!(a!==void 0?a:!o||i),valueMissing:!i}},he=s.defineComponent({name:"KendoDropDownTree",model:{event:"changemodel"},emits:{open:e=>!0,close:e=>!0,focus:e=>!0,blur:e=>!0,change:e=>!0,filterchange:e=>!0,expandchange:e=>!0,changemodel:e=>!0,"update:modelValue":e=>!0},props:{opened:{type:Boolean,default:void 0},disabled:Boolean,dir:String,tabIndex:Number,accessKey:String,dataItems:{type:Array,default:function(){return[]}},value:{type:[Object,String,Number,Boolean],default:function(){}},modelValue:{type:[Object,String,Number,Boolean],default:function(){}},valueMap:Function,placeholder:String,dataItemKey:{type:String,required:!0},textField:{type:String,required:!0},selectField:{type:String,default:"selected"},expandField:String,subItemsField:{type:String,default:"items"},className:String,label:String,validationMessage:String,validityStyles:{type:Boolean,default:!0},valid:{type:Boolean,default:void 0},required:Boolean,name:String,id:String,ariaLabel:{type:String,default:void 0},ariaLabelledBy:String,ariaDescribedBy:String,filterable:Boolean,filter:String,loading:Boolean,popupSettings:{type:Object,default:function(){return{animate:!0,height:"200px",anchor:""}}},size:{type:String,validator:function(e){return["small","medium","large"].includes(e)}},rounded:{type:String,validator:function(e){return["none","small","medium","large","full"].includes(e)}},fillMode:{type:String,validator:function(e){return["flat","outline","solid"].includes(e)}},item:[String,Function,Object],header:[String,Function,Object],footer:[String,Function,Object],valueRender:[String,Function,Object],listNoData:[String,Function,Object],adaptive:{type:Boolean,default:void 0},adaptiveTitle:{type:String,default:void 0}},inject:{kendoLocalizationService:{default:null},adaptiveModeBreakpoints:{default:{small:K.MOBILE_SMALL_DEVICE,medium:K.MOBILE_MEDIUM_DEVICE}}},created(){this.observer=null,t.validatePackage(b.packageMetadata),this.showLicenseWatermark=t.shouldShowValidationUI(b.packageMetadata),this.licenseMessage=t.getLicenseMessage(b.packageMetadata),this.base=new de(this),this.componentGuid=t.guid(),this.anchor=t.guid()},data(){return{showLicenseWatermark:!1,licenseMessage:void 0,currentOpened:!1,focused:!1,filterState:"",currentValue:void 0,popupWidth:"200px",windowWidth:0,initialAdaptiveRenderingValues:void 0}},computed:{wrapperClass(){const{validationMessage:e,valid:i,required:n,validityStyles:a}=this.$props,o=S({validationMessage:e,valid:i,required:n},this.hasValue),d=!a||o.valid,{size:r,rounded:l,fillMode:u}=this.$props;return{"k-dropdowntree":!0,"k-picker":!0,[this.$props.className]:this.$props.className,[`k-picker-${ue[r]||r}`]:r,[`k-rounded-${ce[l]||l}`]:l,[`k-picker-${u}`]:u,"k-focus":this.focused,"k-invalid":!d,"k-loading":this.$props.loading,"k-required":n,"k-disabled":this.$props.disabled}},animationStyles(){return this.windowWidth<=this.adaptiveModeBreakpoints.small?{top:0,width:"100%",height:"100%"}:void 0},classNameAdaptive(){return this.windowWidth<=this.adaptiveModeBreakpoints.small?"k-adaptive-actionsheet k-actionsheet-fullscreen":"k-adaptive-actionsheet k-actionsheet-bottom"},adaptiveState(){return this.windowWidth<=this.adaptiveModeBreakpoints.medium&&this.$props.adaptive},isOpen(){return this.opened!==void 0?this.opened:this.currentOpened},computedValue(){return this.value!==void 0?this.value:this.$props.modelValue!==void 0?this.$props.modelValue:this.currentValue},hasValue(){return k.isPresent(this.computedValue)},currentValueText(){return this.hasValue?k.getItemValue(this.computedValue,this.$props.textField):""}},watch:{isOpen:function(e){e&&this.value?this.initialAdaptiveRenderingValues=[this.value]:this.initialAdaptiveRenderingValues=void 0}},mounted(){this.observer=t.canUseDOM&&window.ResizeObserver&&new ResizeObserver(this.calculateMedia),document!=null&&document.body&&this.observer&&this.observer.observe(document.body),this.elementRef=t.getRef(this,"kendoAnchor"),this.inputRef=t.getRef(this,"input"),this.selectRef=t.getRef(this,"select"),this.treeViewRef=t.getRef(this,"treeView"),this.skipFocusRef=!1,this.popupRef=t.getRef(this,"popup"),this.calculatePopupWidth()},updated(){this.inputRef=t.getRef(this,"input"),this.treeViewRef=t.getRef(this,"treeView"),this.popupRef&&this.isOpen&&this.hasValue&&this.popupRef.reposition(),this.setValidity(),this.calculatePopupWidth()},render(){let e;const i=this.$props.id||this.componentGuid,{dataItems:n,dataItemKey:a,popupSettings:o,disabled:d,placeholder:r,label:l,name:u,selectField:R,subItemsField:$,validationMessage:q,valid:W,required:F,validityStyles:P,adaptiveTitle:A}=this.$props,g=t.getTabIndex(this.$props.tabIndex,d),x=ae.provideLocalizationService(this),z=S({validationMessage:q,valid:W,required:F},this.hasValue),I=this.adaptiveState,p=this.$props.dir,N=t.templateRendering.call(this,this.item,t.getListeners.call(this)),j=t.templateRendering.call(this,this.valueRender,t.getListeners.call(this)),_=t.templateRendering.call(this,this.$props.header,t.getListeners.call(this)),G=t.templateRendering.call(this,this.$props.footer,t.getListeners.call(this)),v=t.getTemplate.call(this,{h:s.h,template:_}),y=t.getTemplate.call(this,{h:s.h,template:G}),H=t.templateRendering.call(this,this.$props.listNoData,t.getListeners.call(this)),U=s.createVNode(oe.ListNoData,null,L(e=x.toLanguageString(c.nodata,c.messages[c.nodata]))?e:{default:()=>[e]}),M=t.getTemplate.call(this,{h:s.h,defaultRendering:U,template:H}),J=s.createVNode("span",{class:"k-input-value-text"},[this.currentValueText||r]),Q=t.getTemplate.call(this,{h:s.h,defaultRendering:J,template:j,additionalProps:{value:this.computedValue}}),X=()=>[s.createVNode("div",{class:"k-actionsheet-titlebar-group k-hbox"},[s.createVNode("div",{class:"k-actionsheet-title"},[s.createVNode("div",{class:"k-text-center"},[A]),s.createVNode("div",{class:"k-actionsheet-subtitle k-text-center"},[r])]),s.createVNode("div",{class:"k-actionsheet-actions"},[s.createVNode(B.Button,{tabIndex:1,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:this.onWrapperClick,icon:"x",svgIcon:w.xIcon},null)])]),s.createVNode("div",{class:"k-actionsheet-titlebar-group k-actionsheet-filter"},[this.$props.filterable&&s.createVNode(T.ListFilter,{tabIndex:0,value:this.$props.filter===void 0?this.filterState:this.$props.filter,ref:t.setRef(this,"input"),onChange:this.onFilterChange,onKeydown:this.onInputKeyDown,size:h,rounded:D,fillMode:V,onFocus:this.onFocus,onBlur:this.onBlur},null)])],Y=t.templateRendering.call(this,X,t.getListeners.call(this)),Z=()=>{const m=this.base.getTemplateDef.call(this,v,s.h),C=this.base.getTemplateDef.call(this,y,s.h);return[m&&s.createVNode("div",{class:"k-list-header"},[m]),n.length>0?s.createVNode(O.TreeView,{ref:t.setRef(this,"treeView"),tabIndex:g,dataItems:n,focusIdField:a,textField:this.$props.textField,selectField:R,expandField:this.$props.expandField,childrenField:$,expandIcons:!0,onItemclick:this.onChange,onExpandchange:this.onExpand,onFocus:this.onFocus,onBlur:this.onBlur,onKeydown:this.onWrapperKeyDown,size:"large",item:N},null):M,C&&s.createVNode("div",{class:"k-list-footer"},[C])]},ee=t.templateRendering.call(this,Z,t.getListeners.call(this)),te=function(){return s.createVNode(re.ActionSheet,{expand:this.isOpen,animation:!0,animationStyles:this.animationStyles,className:this.classNameAdaptive,header:Y,content:ee,contentClassName:"!k-overflow-hidden",onClose:this.onWrapperClick,navigatableElements:["input.k-input-inner",".k-actionsheet-actions > button"]},null)},ie=!P||z.valid,{size:h,rounded:D,fillMode:V}=this.$props,se=function(){return s.createVNode("span",{class:this.wrapperClass,tabindex:g,accesskey:this.$props.accessKey,id:i,dir:p,ref:t.setRef(this,"kendoAnchor"),onKeydown:this.onWrapperKeyDown,onClick:this.onWrapperClick,onMousedown:this.onWrapperMouseDown,onFocusin:this.onFocus,onFocusout:this.onBlur,role:"combobox","aria-haspopup":"tree","aria-expanded":this.isOpen,"aria-disabled":d||void 0,"aria-label":l||this.$props.ariaLabel,"aria-labelledby":this.$props.ariaLabelledBy,"aria-describedby":this.$props.ariaDescribedBy,"aria-required":F||void 0},[s.createVNode("span",{class:"k-input-inner"},[Q]),this.$props.loading&&s.createVNode(t.Icon,{class:"k-input-loading-icon",name:"loading"},null),this.hasValue&&!d&&s.createVNode("span",{onClick:this.onClear,class:"k-clear-value",title:x.toLanguageString(c.clear,c.messages[c.clear]),role:"button",tabindex:-1,onMousedown:m=>m.preventDefault()},[s.createVNode(t.Icon,{name:"x",icon:w.xIcon},null)]),s.createVNode(B.Button,{tabIndex:-1,type:"button","aria-label":"select",class:"k-input-button",size:h,fillMode:V,themeColor:"base",rounded:null,icon:"chevron-down",svgIcon:w.chevronDownIcon},null),s.createVNode("select",{name:u,ref:t.setRef(this,"select"),tabindex:-1,"aria-hidden":!0,title:l,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},[s.createVNode("option",{value:this.$props.valueMap?this.$props.valueMap.call(void 0,this.computedValue):this.computedValue},null)]),this.showLicenseWatermark?s.createVNode(t.WatermarkOverlay,{message:this.licenseMessage},null):null,!I&&s.createVNode(ne.Popup,{style:{width:this.popupWidth,direction:p},ref:t.setRef(this,"popup"),class:t.classNames(o.className,{"k-rtl":p==="rtl"}),popupClass:t.classNames(o.popupClass,"k-dropdowntree-popup","popup-"+this.componentGuid),animate:o.animate,anchor:this.anchor,show:this.isOpen,onOpen:this.onPopupOpened,onClose:this.onPopupClosed,appendTo:o.appendTo},{default:()=>[this.$props.filterable&&s.createVNode(T.ListFilter,{value:this.$props.filter===void 0?this.filterState:this.$props.filter,ref:t.setRef(this,"input"),onChange:this.onFilterChange,onKeydown:this.onInputKeyDown,onBlur:this.onBlur,size:h,rounded:D,fillMode:V},null),v&&s.createVNode("div",{class:"k-list-header"},[v]),n.length>0?s.createVNode(O.TreeView,{ref:t.setRef(this,"treeView"),tabIndex:g,dataItems:n,focusIdField:a,textField:this.$props.textField,selectField:R,expandField:this.$props.expandField,childrenField:$,expandIcons:!0,onItemclick:this.onChange,onExpandchange:this.onExpand,onFocus:this.onFocus,onBlur:this.onBlur,onKeydown:this.onWrapperKeyDown,size:h,item:N},null):M,y&&s.createVNode("div",{class:"k-list-footer"},[y])]})])},f=[s.h(se.call(this),{...this.$attrs}),I&&te.call(this)];return l?s.createVNode(le.FloatingLabel,{label:l,editorValue:this.currentValueText,editorPlaceholder:r,editorValid:ie,editorDisabled:d,editorId:i,focused:this.focused,dir:p},L(f)?f:{default:()=>[f]}):f},methods:{calculateMedia(e){for(let i of e)this.windowWidth=i.target.clientWidth},calculatePopupWidth(){this.elementRef&&(this.popupWidth=this.popupSettings.width!==void 0?this.popupSettings.width:this.elementRef.offsetWidth+"px")},focus(){this.$el&&this.$el.focus()},setValidity(){if(this.selectRef&&this.selectRef.setCustomValidity){const{validationMessage:e,valid:i,required:n}=this.$props,a=S({validationMessage:e,valid:i,required:n},this.hasValue);this.selectRef.setCustomValidity(a.valid?"":this.validationMessage===void 0?pe:this.validationMessage)}},openPopup(e){if(!this.isOpen){const i={...e};this.$emit("open",i),this.currentOpened=!0}},closePopup(e){if(this.isOpen){const i={...e};this.$emit("close",i),this.currentOpened=!1}},onWrapperClick(e){if(this.onFilterChange({...e,target:{value:""}}),!e.defaultPrevented&&this.$el){this.focused=!0;const i={event:e,target:this};(this.isOpen?this.closePopup:this.openPopup)(i)}},switchFocus(e){this.skipFocusRef=!0,e(),window.setTimeout(()=>this.skipFocusRef=!1,0)},onWrapperKeyDown(e){const{keyCode:i,altKey:n}=e,a=this.treeViewRef&&this.treeViewRef.$el,o=this.inputRef&&this.inputRef.input;if(this.$props.disabled||e.defaultPrevented&&o===e.target)return;const d={event:e,target:this};if(this.isOpen)if(i===t.Keys.esc||n&&i===t.Keys.up)e.preventDefault(),this.closePopup(d);else if(a&&a.querySelector(".k-focus")&&(i===t.Keys.up||i===t.Keys.down||i===t.Keys.left||i===t.Keys.right||i===t.Keys.home||i===t.Keys.end)){if(i===t.Keys.up&&o){const r=Array.from(a.querySelectorAll(".k-treeview-item")),l=[...r].reverse().find(u=>!!(u&&u.querySelector(".k-focus")));if(l&&r.indexOf(l)===0)return this.switchFocus(()=>{this.focusElement(o)})}this.switchFocus(t.noop)}else i===t.Keys.down&&this.switchFocus(()=>{this.focusElement(o||a)});else n&&i===t.Keys.down&&(e.preventDefault(),this.openPopup(d))},onInputKeyDown(e){const{keyCode:i,altKey:n}=e;if(i===t.Keys.esc)this.onWrapperClick(e);else if(n||i!==t.Keys.up&&i!==t.Keys.down)return;e.preventDefault(),this.switchFocus(i===t.Keys.up?()=>{this.focusElement(this.elementRef)}:()=>{this.focusElement(this.treeViewRef&&this.treeViewRef.$el)})},focusElement(e){e&&this.switchFocus(()=>e.focus())},onPopupOpened(){if(!this.focused&&this.isOpen&&!this.currentOpened)this.closePopup({target:this});else if(this.$props.filterable){const e=this.inputRef&&this.inputRef.input;this.focusElement(e)}else this.focusElement(this.treeViewRef&&this.treeViewRef.$el)},onPopupClosed(){this.focused&&this.focusElement(this.elementRef)},onFocus(e){if(!this.focused&&!this.skipFocusRef){this.focused=!0;const i={event:e,target:this};this.$emit("focus",i)}},onBlur(e){var i;if(this.focused&&!this.skipFocusRef){this.focused=!1;const n={event:e,target:this},a={...n},o=e.relatedTarget||((i=e.event)==null?void 0:i.relatedTarget);!(o!=null&&o.closest(".popup-"+this.componentGuid))&&!this.adaptiveState&&(this.$emit("blur",a),this.closePopup(n))}},onWrapperMouseDown(){this.focused&&this.switchFocus(t.noop)},changeValue(e,i,n){const a={value:i,level:n?E(n):[],...e};this.$emit("changemodel",i),this.$emit("update:modelValue",i),this.$emit("change",a),this.currentValue=i},onChange(e){if(k.areSame(e.item,this.computedValue,this.dataItemKey)||!this.$el)return;const{item:i,itemHierarchicalIndex:n,event:a}=e,o={event:a,target:this};this.changeValue(o,i,n),this.closePopup(o)},onClear(e){const i={event:e,target:this};this.changeValue(i,null),this.closePopup(i),e.preventDefault()},onExpand(e){const{item:i,itemHierarchicalIndex:n,event:a}=e,o={level:E(n),item:i,event:a,target:this};this.$emit("expandchange",o)},onFilterChange(e){const n={filter:{field:this.$props.textField,operator:"contains",value:e.target.value},event:e,target:this};this.$emit("filterchange",n),this.$props.filter===void 0&&(this.filterState=e.target.value)}}});exports.DropDownTree=he;
|