@progress/kendo-vue-dropdowns 5.3.0-dev.202409130647 → 5.3.0-develop.1
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 +8 -0
- package/AutoComplete/AutoComplete.mjs +526 -0
- package/ComboBox/ComboBox.js +8 -0
- package/ComboBox/ComboBox.mjs +776 -0
- package/DropDownList/DropDownList.js +8 -0
- package/DropDownList/DropDownList.mjs +781 -0
- package/DropDownTree/DropDownTree.js +8 -0
- package/DropDownTree/DropDownTree.mjs +709 -0
- package/DropDownTree/ListNoData.js +8 -0
- package/DropDownTree/ListNoData.mjs +21 -0
- package/MultiSelect/MultiSelect.js +8 -0
- package/MultiSelect/MultiSelect.mjs +872 -0
- package/MultiSelect/TagList.js +8 -0
- package/MultiSelect/TagList.mjs +119 -0
- package/MultiSelectTree/MultiSelectTree.js +8 -0
- package/MultiSelectTree/MultiSelectTree.mjs +759 -0
- package/MultiSelectTree/utils.js +8 -0
- package/MultiSelectTree/utils.mjs +73 -0
- package/README.md +28 -43
- package/common/ClearButton.js +8 -0
- package/common/ClearButton.mjs +54 -0
- package/common/DropDownBase.js +8 -0
- package/common/DropDownBase.mjs +193 -0
- package/common/GroupStickyHeader.js +8 -0
- package/common/GroupStickyHeader.mjs +38 -0
- package/common/List.js +8 -0
- package/common/List.mjs +139 -0
- package/common/ListContainer.js +8 -0
- package/common/ListContainer.mjs +103 -0
- package/common/ListDefaultItem.js +8 -0
- package/common/ListDefaultItem.mjs +47 -0
- package/common/ListFilter.js +8 -0
- package/common/ListFilter.mjs +147 -0
- package/common/ListGroupItem.js +8 -0
- package/common/ListGroupItem.mjs +46 -0
- package/common/ListItem.js +8 -0
- package/common/ListItem.mjs +73 -0
- package/common/Navigation.js +8 -0
- package/common/Navigation.mjs +28 -0
- package/common/SearchBar.js +8 -0
- package/common/SearchBar.mjs +129 -0
- package/common/VirtualScroll.js +8 -0
- package/common/VirtualScroll.mjs +95 -0
- package/common/constants.js +8 -0
- package/common/constants.mjs +12 -0
- package/common/settings.js +8 -0
- package/common/settings.mjs +11 -0
- package/common/utils.js +8 -0
- package/common/utils.mjs +104 -0
- package/dist/cdn/js/kendo-vue-dropdowns.js +8 -1
- package/index.d.mts +4037 -0
- package/index.d.ts +4037 -0
- package/index.js +8 -0
- package/index.mjs +25 -0
- package/messages/main.js +8 -0
- package/messages/main.mjs +26 -0
- package/package-metadata.js +8 -0
- package/package-metadata.mjs +18 -0
- package/package.json +24 -58
- package/dist/es/AutoComplete/AutoComplete.d.ts +0 -107
- package/dist/es/AutoComplete/AutoComplete.js +0 -825
- package/dist/es/AutoComplete/AutoCompleteProps.d.ts +0 -234
- package/dist/es/AutoComplete/AutoCompleteProps.js +0 -2
- package/dist/es/ComboBox/ComboBox.d.ts +0 -99
- package/dist/es/ComboBox/ComboBox.js +0 -1315
- package/dist/es/ComboBox/ComboBoxProps.d.ts +0 -277
- package/dist/es/ComboBox/ComboBoxProps.js +0 -2
- package/dist/es/DropDownList/DropDownList.d.ts +0 -103
- package/dist/es/DropDownList/DropDownList.js +0 -1314
- package/dist/es/DropDownList/DropDownListProps.d.ts +0 -307
- package/dist/es/DropDownList/DropDownListProps.js +0 -2
- package/dist/es/DropDownTree/DropDownTree.d.ts +0 -49
- package/dist/es/DropDownTree/DropDownTree.js +0 -1090
- package/dist/es/DropDownTree/DropDownTreeProps.d.ts +0 -301
- package/dist/es/DropDownTree/DropDownTreeProps.js +0 -2
- package/dist/es/DropDownTree/ListNoData.d.ts +0 -42
- package/dist/es/DropDownTree/ListNoData.js +0 -32
- package/dist/es/MultiSelect/MultiSelect.d.ts +0 -115
- package/dist/es/MultiSelect/MultiSelect.js +0 -1515
- package/dist/es/MultiSelect/MultiSelectProps.d.ts +0 -290
- package/dist/es/MultiSelect/MultiSelectProps.js +0 -2
- package/dist/es/MultiSelect/TagList.d.ts +0 -54
- package/dist/es/MultiSelect/TagList.js +0 -176
- package/dist/es/MultiSelectTree/MultiSelectTree.d.ts +0 -48
- package/dist/es/MultiSelectTree/MultiSelectTree.js +0 -1220
- package/dist/es/MultiSelectTree/MultiSelectTreeProps.d.ts +0 -322
- package/dist/es/MultiSelectTree/MultiSelectTreeProps.js +0 -2
- package/dist/es/MultiSelectTree/utils.d.ts +0 -17
- package/dist/es/MultiSelectTree/utils.js +0 -109
- package/dist/es/additionalTypes.ts +0 -21
- package/dist/es/common/ClearButton.d.ts +0 -21
- package/dist/es/common/ClearButton.js +0 -73
- package/dist/es/common/DropDownBase.d.ts +0 -95
- package/dist/es/common/DropDownBase.js +0 -298
- package/dist/es/common/GroupStickyHeader.d.ts +0 -32
- package/dist/es/common/GroupStickyHeader.js +0 -60
- package/dist/es/common/List.d.ts +0 -60
- package/dist/es/common/List.js +0 -201
- package/dist/es/common/ListContainer.d.ts +0 -40
- package/dist/es/common/ListContainer.js +0 -161
- package/dist/es/common/ListDefaultItem.d.ts +0 -29
- package/dist/es/common/ListDefaultItem.js +0 -60
- package/dist/es/common/ListFilter.d.ts +0 -49
- package/dist/es/common/ListFilter.js +0 -175
- package/dist/es/common/ListGroupItem.d.ts +0 -41
- package/dist/es/common/ListGroupItem.js +0 -71
- package/dist/es/common/ListItem.d.ts +0 -71
- package/dist/es/common/ListItem.js +0 -101
- package/dist/es/common/Navigation.d.ts +0 -12
- package/dist/es/common/Navigation.js +0 -34
- package/dist/es/common/SearchBar.d.ts +0 -66
- package/dist/es/common/SearchBar.js +0 -177
- package/dist/es/common/VirtualScroll.d.ts +0 -42
- package/dist/es/common/VirtualScroll.js +0 -163
- package/dist/es/common/constants.d.ts +0 -4
- package/dist/es/common/constants.js +0 -4
- package/dist/es/common/events.d.ts +0 -63
- package/dist/es/common/events.js +0 -1
- package/dist/es/common/filterDescriptor.d.ts +0 -41
- package/dist/es/common/filterDescriptor.js +0 -2
- package/dist/es/common/settings.d.ts +0 -107
- package/dist/es/common/settings.js +0 -8
- package/dist/es/common/utils.d.ts +0 -70
- package/dist/es/common/utils.js +0 -202
- package/dist/es/main.d.ts +0 -18
- package/dist/es/main.js +0 -10
- package/dist/es/messages/main.d.ts +0 -40
- package/dist/es/messages/main.js +0 -41
- package/dist/es/package-metadata.d.ts +0 -5
- package/dist/es/package-metadata.js +0 -11
- package/dist/esm/AutoComplete/AutoComplete.d.ts +0 -107
- package/dist/esm/AutoComplete/AutoComplete.js +0 -825
- package/dist/esm/AutoComplete/AutoCompleteProps.d.ts +0 -234
- package/dist/esm/AutoComplete/AutoCompleteProps.js +0 -2
- package/dist/esm/ComboBox/ComboBox.d.ts +0 -99
- package/dist/esm/ComboBox/ComboBox.js +0 -1315
- package/dist/esm/ComboBox/ComboBoxProps.d.ts +0 -277
- package/dist/esm/ComboBox/ComboBoxProps.js +0 -2
- package/dist/esm/DropDownList/DropDownList.d.ts +0 -103
- package/dist/esm/DropDownList/DropDownList.js +0 -1314
- package/dist/esm/DropDownList/DropDownListProps.d.ts +0 -307
- package/dist/esm/DropDownList/DropDownListProps.js +0 -2
- package/dist/esm/DropDownTree/DropDownTree.d.ts +0 -49
- package/dist/esm/DropDownTree/DropDownTree.js +0 -1090
- package/dist/esm/DropDownTree/DropDownTreeProps.d.ts +0 -301
- package/dist/esm/DropDownTree/DropDownTreeProps.js +0 -2
- package/dist/esm/DropDownTree/ListNoData.d.ts +0 -42
- package/dist/esm/DropDownTree/ListNoData.js +0 -32
- package/dist/esm/MultiSelect/MultiSelect.d.ts +0 -115
- package/dist/esm/MultiSelect/MultiSelect.js +0 -1515
- package/dist/esm/MultiSelect/MultiSelectProps.d.ts +0 -290
- package/dist/esm/MultiSelect/MultiSelectProps.js +0 -2
- package/dist/esm/MultiSelect/TagList.d.ts +0 -54
- package/dist/esm/MultiSelect/TagList.js +0 -176
- package/dist/esm/MultiSelectTree/MultiSelectTree.d.ts +0 -48
- package/dist/esm/MultiSelectTree/MultiSelectTree.js +0 -1220
- package/dist/esm/MultiSelectTree/MultiSelectTreeProps.d.ts +0 -322
- package/dist/esm/MultiSelectTree/MultiSelectTreeProps.js +0 -2
- package/dist/esm/MultiSelectTree/utils.d.ts +0 -17
- package/dist/esm/MultiSelectTree/utils.js +0 -109
- package/dist/esm/additionalTypes.ts +0 -21
- package/dist/esm/common/ClearButton.d.ts +0 -21
- package/dist/esm/common/ClearButton.js +0 -73
- package/dist/esm/common/DropDownBase.d.ts +0 -95
- package/dist/esm/common/DropDownBase.js +0 -298
- package/dist/esm/common/GroupStickyHeader.d.ts +0 -32
- package/dist/esm/common/GroupStickyHeader.js +0 -60
- package/dist/esm/common/List.d.ts +0 -60
- package/dist/esm/common/List.js +0 -201
- package/dist/esm/common/ListContainer.d.ts +0 -40
- package/dist/esm/common/ListContainer.js +0 -161
- package/dist/esm/common/ListDefaultItem.d.ts +0 -29
- package/dist/esm/common/ListDefaultItem.js +0 -60
- package/dist/esm/common/ListFilter.d.ts +0 -49
- package/dist/esm/common/ListFilter.js +0 -175
- package/dist/esm/common/ListGroupItem.d.ts +0 -41
- package/dist/esm/common/ListGroupItem.js +0 -71
- package/dist/esm/common/ListItem.d.ts +0 -71
- package/dist/esm/common/ListItem.js +0 -101
- package/dist/esm/common/Navigation.d.ts +0 -12
- package/dist/esm/common/Navigation.js +0 -34
- package/dist/esm/common/SearchBar.d.ts +0 -66
- package/dist/esm/common/SearchBar.js +0 -177
- package/dist/esm/common/VirtualScroll.d.ts +0 -42
- package/dist/esm/common/VirtualScroll.js +0 -163
- package/dist/esm/common/constants.d.ts +0 -4
- package/dist/esm/common/constants.js +0 -4
- package/dist/esm/common/events.d.ts +0 -63
- package/dist/esm/common/events.js +0 -1
- package/dist/esm/common/filterDescriptor.d.ts +0 -41
- package/dist/esm/common/filterDescriptor.js +0 -2
- package/dist/esm/common/settings.d.ts +0 -107
- package/dist/esm/common/settings.js +0 -8
- package/dist/esm/common/utils.d.ts +0 -70
- package/dist/esm/common/utils.js +0 -202
- package/dist/esm/main.d.ts +0 -18
- package/dist/esm/main.js +0 -10
- package/dist/esm/messages/main.d.ts +0 -40
- package/dist/esm/messages/main.js +0 -41
- package/dist/esm/package-metadata.d.ts +0 -5
- package/dist/esm/package-metadata.js +0 -11
- package/dist/esm/package.json +0 -3
- package/dist/npm/AutoComplete/AutoComplete.d.ts +0 -107
- package/dist/npm/AutoComplete/AutoComplete.js +0 -832
- package/dist/npm/AutoComplete/AutoCompleteProps.d.ts +0 -234
- package/dist/npm/AutoComplete/AutoCompleteProps.js +0 -3
- package/dist/npm/ComboBox/ComboBox.d.ts +0 -99
- package/dist/npm/ComboBox/ComboBox.js +0 -1322
- package/dist/npm/ComboBox/ComboBoxProps.d.ts +0 -277
- package/dist/npm/ComboBox/ComboBoxProps.js +0 -3
- package/dist/npm/DropDownList/DropDownList.d.ts +0 -103
- package/dist/npm/DropDownList/DropDownList.js +0 -1321
- package/dist/npm/DropDownList/DropDownListProps.d.ts +0 -307
- package/dist/npm/DropDownList/DropDownListProps.js +0 -3
- package/dist/npm/DropDownTree/DropDownTree.d.ts +0 -49
- package/dist/npm/DropDownTree/DropDownTree.js +0 -1095
- package/dist/npm/DropDownTree/DropDownTreeProps.d.ts +0 -301
- package/dist/npm/DropDownTree/DropDownTreeProps.js +0 -3
- package/dist/npm/DropDownTree/ListNoData.d.ts +0 -42
- package/dist/npm/DropDownTree/ListNoData.js +0 -39
- package/dist/npm/MultiSelect/MultiSelect.d.ts +0 -115
- package/dist/npm/MultiSelect/MultiSelect.js +0 -1522
- package/dist/npm/MultiSelect/MultiSelectProps.d.ts +0 -290
- package/dist/npm/MultiSelect/MultiSelectProps.js +0 -3
- package/dist/npm/MultiSelect/TagList.d.ts +0 -54
- package/dist/npm/MultiSelect/TagList.js +0 -183
- package/dist/npm/MultiSelectTree/MultiSelectTree.d.ts +0 -48
- package/dist/npm/MultiSelectTree/MultiSelectTree.js +0 -1227
- package/dist/npm/MultiSelectTree/MultiSelectTreeProps.d.ts +0 -322
- package/dist/npm/MultiSelectTree/MultiSelectTreeProps.js +0 -3
- package/dist/npm/MultiSelectTree/utils.d.ts +0 -17
- package/dist/npm/MultiSelectTree/utils.js +0 -114
- package/dist/npm/additionalTypes.ts +0 -21
- package/dist/npm/common/ClearButton.d.ts +0 -21
- package/dist/npm/common/ClearButton.js +0 -80
- package/dist/npm/common/DropDownBase.d.ts +0 -95
- package/dist/npm/common/DropDownBase.js +0 -303
- package/dist/npm/common/GroupStickyHeader.d.ts +0 -32
- package/dist/npm/common/GroupStickyHeader.js +0 -67
- package/dist/npm/common/List.d.ts +0 -60
- package/dist/npm/common/List.js +0 -208
- package/dist/npm/common/ListContainer.d.ts +0 -40
- package/dist/npm/common/ListContainer.js +0 -168
- package/dist/npm/common/ListDefaultItem.d.ts +0 -29
- package/dist/npm/common/ListDefaultItem.js +0 -67
- package/dist/npm/common/ListFilter.d.ts +0 -49
- package/dist/npm/common/ListFilter.js +0 -182
- package/dist/npm/common/ListGroupItem.d.ts +0 -41
- package/dist/npm/common/ListGroupItem.js +0 -78
- package/dist/npm/common/ListItem.d.ts +0 -71
- package/dist/npm/common/ListItem.js +0 -108
- package/dist/npm/common/Navigation.d.ts +0 -12
- package/dist/npm/common/Navigation.js +0 -37
- package/dist/npm/common/SearchBar.d.ts +0 -66
- package/dist/npm/common/SearchBar.js +0 -184
- package/dist/npm/common/VirtualScroll.d.ts +0 -42
- package/dist/npm/common/VirtualScroll.js +0 -168
- package/dist/npm/common/constants.d.ts +0 -4
- package/dist/npm/common/constants.js +0 -10
- package/dist/npm/common/events.d.ts +0 -63
- package/dist/npm/common/events.js +0 -2
- package/dist/npm/common/filterDescriptor.d.ts +0 -41
- package/dist/npm/common/filterDescriptor.js +0 -3
- package/dist/npm/common/settings.d.ts +0 -107
- package/dist/npm/common/settings.js +0 -11
- package/dist/npm/common/utils.d.ts +0 -70
- package/dist/npm/common/utils.js +0 -221
- package/dist/npm/main.d.ts +0 -18
- package/dist/npm/main.js +0 -36
- package/dist/npm/messages/main.d.ts +0 -40
- package/dist/npm/messages/main.js +0 -44
- package/dist/npm/package-metadata.d.ts +0 -5
- package/dist/npm/package-metadata.js +0 -14
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue"),N=require("../common/SearchBar.js"),w=require("../common/ListContainer.js"),M=require("../common/List.js"),L=require("../common/DropDownBase.js"),T=require("../common/GroupStickyHeader.js"),K=require("../common/ClearButton.js"),h=require("../common/utils.js"),a=require("@progress/kendo-vue-common"),{sizeMap:x,roundedMap:H}=a.kendoThemeMaps,q="Please enter a valid value!",A=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,default:"medium",validator:function(e){return["small","medium","large","full"].includes(e)}},fillMode:{type:String,default:"solid",validator:function(e){return["solid","flat","outline"].includes(e)}},size:{type:String,default:"medium",validator:function(e){return["small","medium","large"].includes(e)}},groupField:{type:String}},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 L(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 g;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,p=this.$refs.list;if(p&&(this.base.vs.list=p.list,this.base.list=p.list),e==="")(l&&(o||n)||u)&&this.base.scrollToItem(i);else if(!this.isScrolling){let c=(g=this.base.getGroupedDataModernMode(t,e))==null?void 0:g.indexOf(s);u&&(t&&t.length!==0&&this.base.resetGroupStickyHeader(t[0][e],this),this.base.scrollToItem(c)),l&&d&&o&&this.base.scrollToItem(c)}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?h.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=h.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];h.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=>h.areSame(u,this.$data.focusedItem,n)):o?o(s,i,n):s.indexOf(h.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=h.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||q)},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),p=u&&u===n,g=u&&u.length>n.length,{suggest:c}=this.$props,y=this.$props.opened!==void 0?this.$props.opened:this.currentOpened;if(c!==void 0&&c!==!1){p||g||!o?this.suggested="":this.suggestValue(n);const k=n+this.suggested,b={userInput:n,value:this.suggested};this.triggerOnChange(k,i,{suggestion:b})}else this.suggested="",this.triggerOnChange(n,i);(!y&&n||y&&!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[h.itemIndexStartsWith(t,e,i)];if(s){const n=h.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=>h.areSame(o,this.$data.focusedItem,i)):s?s(t,n,i):Math.max(0,t.indexOf(h.getFocusedItem(t,n,i)))},repositionPopup(){this.base.repositionPopup()},onScroll(e){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?i.children[0].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}=this.$props,p=!this.$props.validityStyles||this.validity().valid,g=this.currentFocused,c=this.base,y=this.computedValue(),k=!d&&!!y,b=this.$props.id||this.inputId,C=Object.assign({},{animate:!0,height:"200px"},this.$props.popupSettings);typeof u=="string"&&(this.suggested=u);const F=function(I,f){const{placeholder:m,tabIndex:S,readonly:$}=this.$props,V=this.$props.opened!==void 0?this.$props.opened:this.currentOpened;return r.createVNode(N.SearchBar,{id:f,placeholder:m,tabIndex:S,accessKey:this.$props.accessKey,value:I,suggestedText:this.suggested,focused:g,name:this.$props.name,ref:v=>{this.inputRef=v},onKeydown:this.onInputKeyDown,onChange:this.onChangeHandler,onFocus:c.handleFocus,onBlur:this.handleBlur,disabled:t,readOnly:$,expanded:V,owns:c.listBoxId,activedescendant:"option-"+c.guid+"-"+this.focusedIndex(),onClearbuttonclick:this.clearButtonClick,ariaLabelledBy:this.$props.ariaLabelledBy,ariaDescribedBy:this.$props.ariaDescribedBy,ariaLabel:this.$props.ariaLabel},null)},B=function(){const{textField:I,groupField:f}=this.$props;let m=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)),v=this.$props.opened!==void 0?this.$props.opened:this.currentOpened;return f&&(m=this.base.getGroupedDataModernMode(m,f)),r.createVNode(M.List,{id:c.listBoxId,show:v,dataItems:m.slice(),focusedIndex:this.focusedIndex(),value:y,textField:I,valueField:I,highlightSelected:!1,optionsGuid:c.guid,ref:"list",wrapperStyle:{maxHeight:C.height},wrapperCssClass:"k-list-content",onListclick:this.handleItemClick,itemRender:S,groupHeaderItemRender:$,noDataRender:V,groupField:f,onScroll:this.onScroll},null)},D=function(){const I=a.templateRendering.call(this,this.$props.header,a.getListeners.call(this)),f=a.templateRendering.call(this,this.$props.footer,a.getListeners.call(this)),m=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:f}),V=this.$props.opened!==void 0?this.$props.opened:this.currentOpened,v=this.$props.dataItems||[];return this.group===void 0&&this.$props.groupField!==void 0&&(this.group=h.getItemValue(v[0],this.$props.groupField)),r.createVNode(w.ListContainer,{onMousedown:R=>R.preventDefault(),width:this.popupWidth,ref:"container",popupSettings:{...C,anchor:this.anchor,show:V,popupClass:a.classNames(C.popupClass,"k-list",{[`k-list-${x[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&&v.length!==0&&r.createVNode(T.GroupStickyHeader,{group:this.group,render:m},null),B.call(this),$&&r.createVNode("div",{class:"k-list-footer"},[$])]})},O=r.createVNode("span",{class:a.classNames("k-autocomplete k-input",{[`k-input-${x[s]||s}`]:s,[`k-rounded-${H[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},[F.call(this,y||"",b),k&&!d&&r.createVNode(K.ClearButton,{onClearclick:this.clearButtonClick},null),r.createVNode("span",{class:d?"k-input-loading-icon k-icon k-i-loading":void 0},null),D.call(this)]);return i?r.createVNode("span",{class:this.spanClassNames,dir:this.$props.dir},[O,this.$props.label?b?r.createVNode("label",{for:b,class:"k-floating-label"},[this.$props.label]):r.createVNode("span",{class:"k-label"},[this.$props.label]):null]):O}});exports.AutoComplete=A;
|
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { defineComponent as G, ref as w, createVNode as u, h as M } from "vue";
|
|
9
|
+
import { SearchBar as E } from "../common/SearchBar.mjs";
|
|
10
|
+
import { ListContainer as _ } from "../common/ListContainer.mjs";
|
|
11
|
+
import { List as q } from "../common/List.mjs";
|
|
12
|
+
import z from "../common/DropDownBase.mjs";
|
|
13
|
+
import { GroupStickyHeader as W } from "../common/GroupStickyHeader.mjs";
|
|
14
|
+
import { ClearButton as U } from "../common/ClearButton.mjs";
|
|
15
|
+
import { getItemValue as O, areSame as F, getFocusedItem as R, itemIndexStartsWith as J } from "../common/utils.mjs";
|
|
16
|
+
import { guid as T, getRef as H, Keys as h, classNames as D, setRef as Q, kendoThemeMaps as X, templateRendering as v, getListeners as b, getTemplate as L } from "@progress/kendo-vue-common";
|
|
17
|
+
const {
|
|
18
|
+
sizeMap: N,
|
|
19
|
+
roundedMap: Y
|
|
20
|
+
} = X, Z = "Please enter a valid value!", le = /* @__PURE__ */ G({
|
|
21
|
+
name: "KendoAutoComplete",
|
|
22
|
+
model: {
|
|
23
|
+
event: "changemodel"
|
|
24
|
+
},
|
|
25
|
+
props: {
|
|
26
|
+
id: String,
|
|
27
|
+
defaultValue: {
|
|
28
|
+
type: [String],
|
|
29
|
+
default: void 0
|
|
30
|
+
},
|
|
31
|
+
name: String,
|
|
32
|
+
modelValue: {
|
|
33
|
+
type: [String],
|
|
34
|
+
default: void 0
|
|
35
|
+
},
|
|
36
|
+
value: {
|
|
37
|
+
type: [String],
|
|
38
|
+
default: void 0
|
|
39
|
+
},
|
|
40
|
+
label: {
|
|
41
|
+
type: String
|
|
42
|
+
},
|
|
43
|
+
placeholder: String,
|
|
44
|
+
required: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: !1
|
|
47
|
+
},
|
|
48
|
+
valid: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: void 0
|
|
51
|
+
},
|
|
52
|
+
validationMessage: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: void 0
|
|
55
|
+
},
|
|
56
|
+
validityStyles: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: !0
|
|
59
|
+
},
|
|
60
|
+
opened: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: void 0
|
|
63
|
+
},
|
|
64
|
+
disabled: Boolean,
|
|
65
|
+
dir: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: void 0
|
|
68
|
+
},
|
|
69
|
+
tabIndex: {
|
|
70
|
+
type: Number,
|
|
71
|
+
default: void 0
|
|
72
|
+
},
|
|
73
|
+
readonly: Boolean,
|
|
74
|
+
accessKey: String,
|
|
75
|
+
dataItems: Array,
|
|
76
|
+
textField: String,
|
|
77
|
+
loading: Boolean,
|
|
78
|
+
popupSettings: {
|
|
79
|
+
type: Object,
|
|
80
|
+
default: function() {
|
|
81
|
+
return {
|
|
82
|
+
animate: !0,
|
|
83
|
+
height: "200px",
|
|
84
|
+
anchor: ""
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
itemRender: [String, Function, Object],
|
|
89
|
+
groupHeaderItemRender: [String, Function, Object],
|
|
90
|
+
groupStickyHeaderItemRender: [String, Function, Object],
|
|
91
|
+
listNoDataRender: [String, Function, Object],
|
|
92
|
+
focusedItemIndex: Function,
|
|
93
|
+
header: [String, Function, Object],
|
|
94
|
+
footer: [String, Function, Object],
|
|
95
|
+
suggest: {
|
|
96
|
+
type: [Boolean, String],
|
|
97
|
+
default: !1
|
|
98
|
+
},
|
|
99
|
+
ariaLabel: {
|
|
100
|
+
type: String,
|
|
101
|
+
default: void 0
|
|
102
|
+
},
|
|
103
|
+
ariaLabelledBy: String,
|
|
104
|
+
ariaDescribedBy: String,
|
|
105
|
+
rounded: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: "medium",
|
|
108
|
+
validator: function(e) {
|
|
109
|
+
return ["small", "medium", "large", "full"].includes(e);
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
fillMode: {
|
|
113
|
+
type: String,
|
|
114
|
+
default: "solid",
|
|
115
|
+
validator: function(e) {
|
|
116
|
+
return ["solid", "flat", "outline"].includes(e);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
size: {
|
|
120
|
+
type: String,
|
|
121
|
+
default: "medium",
|
|
122
|
+
validator: function(e) {
|
|
123
|
+
return ["small", "medium", "large"].includes(e);
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
groupField: {
|
|
127
|
+
type: String
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
data() {
|
|
131
|
+
return {
|
|
132
|
+
hasMounted: !1,
|
|
133
|
+
currentText: "",
|
|
134
|
+
currentValue: "",
|
|
135
|
+
currentFocused: !1,
|
|
136
|
+
currentOpened: !1,
|
|
137
|
+
focusedItem: void 0,
|
|
138
|
+
searchState: {
|
|
139
|
+
word: "",
|
|
140
|
+
last: ""
|
|
141
|
+
},
|
|
142
|
+
valueDuringOnChange: {},
|
|
143
|
+
suggested: "",
|
|
144
|
+
group: void 0,
|
|
145
|
+
isScrolling: !1,
|
|
146
|
+
popupWidth: void 0,
|
|
147
|
+
itemHeight: 0
|
|
148
|
+
};
|
|
149
|
+
},
|
|
150
|
+
created() {
|
|
151
|
+
this.valueDuringOnChange = void 0, this.currentText = void 0, this.currentValue = void 0, this.currentFocused = void 0, this.currentOpened = void 0, this.base = new z(this), this.anchor = T(), this.inputId = T();
|
|
152
|
+
},
|
|
153
|
+
setup() {
|
|
154
|
+
const e = w(null), t = w(null);
|
|
155
|
+
return {
|
|
156
|
+
inputRef: e,
|
|
157
|
+
kendoAnchorRef: t
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
mounted() {
|
|
161
|
+
this.hasMounted = !0, this.input = this.inputRef.input, this.base.wrapper = H(this, "kendoAnchor"), this.element = H(this, "kendoAnchor"), this.base.didMount(), this.setValidity();
|
|
162
|
+
},
|
|
163
|
+
watch: {
|
|
164
|
+
currentOpened: function(e, t) {
|
|
165
|
+
this.prevCurrentOpened = t;
|
|
166
|
+
},
|
|
167
|
+
opened: function(e, t) {
|
|
168
|
+
this.prevOpened = t;
|
|
169
|
+
},
|
|
170
|
+
dataItems: function(e, t) {
|
|
171
|
+
this.prevData = t;
|
|
172
|
+
},
|
|
173
|
+
focusedItem: function(e, t) {
|
|
174
|
+
this.prevFocusedItem = t;
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
updated() {
|
|
178
|
+
var c;
|
|
179
|
+
const {
|
|
180
|
+
groupField: e = "",
|
|
181
|
+
dataItems: t = []
|
|
182
|
+
} = this.$props, i = this.focusedIndex(), s = t[i], n = this.prevData !== t, o = s !== void 0 && this.prevFocusedItem !== s, d = this.$props.opened !== void 0 ? this.$props.opened : this.currentOpened, a = this.prevOpened !== void 0 ? this.prevOpened : this.prevCurrentOpened, r = !a && d, l = this.$refs.list;
|
|
183
|
+
if (l && (this.base.vs.list = l.list, this.base.list = l.list), e === "")
|
|
184
|
+
(d && (o || n) || r) && this.base.scrollToItem(i);
|
|
185
|
+
else if (!this.isScrolling) {
|
|
186
|
+
let p = (c = this.base.getGroupedDataModernMode(t, e)) == null ? void 0 : c.indexOf(s);
|
|
187
|
+
r && (t && t.length !== 0 && this.base.resetGroupStickyHeader(t[0][e], this), this.base.scrollToItem(p)), d && a && o && this.base.scrollToItem(p);
|
|
188
|
+
}
|
|
189
|
+
this.setValidity();
|
|
190
|
+
},
|
|
191
|
+
computed: {
|
|
192
|
+
spanClassNames() {
|
|
193
|
+
const e = !this.hasMounted || !this.$props.validityStyles || this.validity().valid;
|
|
194
|
+
return {
|
|
195
|
+
"k-floating-label-container": !0,
|
|
196
|
+
"k-focus": this.currentFocused,
|
|
197
|
+
"k-empty": !this.computedValue(),
|
|
198
|
+
"k-invalid": !e && e !== void 0,
|
|
199
|
+
"k-rtl": this.$props.dir === "rtl"
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
methods: {
|
|
204
|
+
focus() {
|
|
205
|
+
this.input && this.input.focus();
|
|
206
|
+
},
|
|
207
|
+
computedValue() {
|
|
208
|
+
let e;
|
|
209
|
+
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;
|
|
210
|
+
},
|
|
211
|
+
primitiveValue() {
|
|
212
|
+
const e = this.computedValue();
|
|
213
|
+
return this.valuePrimitive ? O(e, this.valueField) : e;
|
|
214
|
+
},
|
|
215
|
+
validity() {
|
|
216
|
+
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;
|
|
217
|
+
return {
|
|
218
|
+
customError: e,
|
|
219
|
+
valid: i,
|
|
220
|
+
valueMissing: this.computedValue() === null
|
|
221
|
+
};
|
|
222
|
+
},
|
|
223
|
+
handleItemSelect(e, t) {
|
|
224
|
+
const {
|
|
225
|
+
dataItems: i = []
|
|
226
|
+
} = this.$props, s = i[e], n = O(s, this.$props.textField);
|
|
227
|
+
this.triggerOnChange(n, t, {
|
|
228
|
+
item: s
|
|
229
|
+
}), this.triggerOnSelect(t, {
|
|
230
|
+
item: s
|
|
231
|
+
});
|
|
232
|
+
},
|
|
233
|
+
itemFocus(e, t) {
|
|
234
|
+
const {
|
|
235
|
+
dataItems: i = [],
|
|
236
|
+
textField: s
|
|
237
|
+
} = this.$props, n = i[e];
|
|
238
|
+
F(this.$data.focusedItem, n, s) || (t.data.focusedItem = n);
|
|
239
|
+
},
|
|
240
|
+
togglePopup(e) {
|
|
241
|
+
this.base.togglePopup(e);
|
|
242
|
+
},
|
|
243
|
+
onNavigate(e, t) {
|
|
244
|
+
const i = this.computedValue(), {
|
|
245
|
+
dataItems: s = [],
|
|
246
|
+
textField: n,
|
|
247
|
+
focusedItemIndex: o
|
|
248
|
+
} = this.$props, d = this.$data.focusedItem !== void 0 ? s.findIndex((r) => F(r, this.$data.focusedItem, n)) : o ? o(s, i, n) : s.indexOf(R(s, i, n)), a = this.base.navigation.navigate({
|
|
249
|
+
keyCode: t,
|
|
250
|
+
current: d,
|
|
251
|
+
max: s.length - 1,
|
|
252
|
+
min: 0
|
|
253
|
+
});
|
|
254
|
+
a !== void 0 && this.itemFocus(a, e), this.applyState(e);
|
|
255
|
+
},
|
|
256
|
+
/**
|
|
257
|
+
* @hidden
|
|
258
|
+
*/
|
|
259
|
+
applyInputValue(e, t, i) {
|
|
260
|
+
const s = this.$props.opened !== void 0 ? this.$props.opened : this.currentOpened, {
|
|
261
|
+
dataItems: n = [],
|
|
262
|
+
textField: o
|
|
263
|
+
} = this.$props;
|
|
264
|
+
if (this.suggested = "", s && i === h.enter) {
|
|
265
|
+
const d = n[this.focusedIndex(e)], a = O(d, o);
|
|
266
|
+
this.triggerOnChange(a, t, {
|
|
267
|
+
item: d
|
|
268
|
+
}), this.triggerOnSelect(t, {
|
|
269
|
+
item: d
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
s && this.togglePopup(t), this.applyState(t);
|
|
273
|
+
},
|
|
274
|
+
setValidity() {
|
|
275
|
+
this.input && this.input.setCustomValidity && this.input.setCustomValidity(this.validity().valid ? "" : this.$props.validationMessage || Z);
|
|
276
|
+
},
|
|
277
|
+
handleItemClick(e, t) {
|
|
278
|
+
this.base.handleItemClick(e, t), this.valueDuringOnChange = void 0;
|
|
279
|
+
},
|
|
280
|
+
onChangeHandler(e) {
|
|
281
|
+
const i = this.base.initState(), s = e.target, n = s.value, o = s.selectionEnd === n.length;
|
|
282
|
+
i.event = e;
|
|
283
|
+
const d = this.suggested, a = this.computedValue(), r = a && d && a.substring(0, a.length - d.length), l = r && r === n, c = r && r.length > n.length, {
|
|
284
|
+
suggest: p
|
|
285
|
+
} = this.$props, m = this.$props.opened !== void 0 ? this.$props.opened : this.currentOpened;
|
|
286
|
+
if (p !== void 0 && p !== !1) {
|
|
287
|
+
l || c || !o ? this.suggested = "" : this.suggestValue(n);
|
|
288
|
+
const V = n + this.suggested, k = {
|
|
289
|
+
userInput: n,
|
|
290
|
+
value: this.suggested
|
|
291
|
+
};
|
|
292
|
+
this.triggerOnChange(V, i, {
|
|
293
|
+
suggestion: k
|
|
294
|
+
});
|
|
295
|
+
} else
|
|
296
|
+
this.suggested = "", this.triggerOnChange(n, i);
|
|
297
|
+
(!m && n || m && !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);
|
|
298
|
+
},
|
|
299
|
+
clearButtonClick(e) {
|
|
300
|
+
const i = this.base.initState(), s = this.$props.opened !== void 0 ? this.$props.opened : this.currentOpened;
|
|
301
|
+
i.event = e;
|
|
302
|
+
const n = "";
|
|
303
|
+
this.suggested = "", this.triggerOnChange(n, i), this.$data.focusedItem !== void 0 && (i.data.focusedItem = void 0), s && this.togglePopup(i), this.applyState(i);
|
|
304
|
+
},
|
|
305
|
+
onInputKeyDown(e) {
|
|
306
|
+
this.isScrolling && (this.isScrolling = !1);
|
|
307
|
+
const t = e.keyCode, i = this.$props.opened !== void 0 ? this.$props.opened : this.currentOpened, s = this.base.initState(), n = this.computedValue();
|
|
308
|
+
s.event = e;
|
|
309
|
+
const o = () => {
|
|
310
|
+
i && e.preventDefault();
|
|
311
|
+
};
|
|
312
|
+
t === h.enter || i && t === h.esc || e.altKey && t === h.up ? (o(), this.applyInputValue(e.currentTarget.value, s, e.keyCode)) : !e.altKey && (t === h.up || t === h.down) ? (o(), this.onNavigate(s, t)) : !i && t === h.esc ? this.clearButtonClick(e) : !i && n && e.altKey && t === h.down && (this.togglePopup(s), this.applyState(s));
|
|
313
|
+
},
|
|
314
|
+
handleBlur(e) {
|
|
315
|
+
if (this.currentFocused) {
|
|
316
|
+
const t = this.base.initState();
|
|
317
|
+
t.data.focused = !1, t.events.push({
|
|
318
|
+
type: "blur"
|
|
319
|
+
}), t.event = e, this.applyInputValue(e.currentTarget.value, t), this.currentFocused = !1;
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
triggerOnChange(e, t, i) {
|
|
323
|
+
this.computedValue() === e && !i || (t.data.currentValue = e, this.valueDuringOnChange = e, t.events.push({
|
|
324
|
+
type: "change",
|
|
325
|
+
...i || {}
|
|
326
|
+
}));
|
|
327
|
+
},
|
|
328
|
+
triggerOnSelect(e, t) {
|
|
329
|
+
e.events.push({
|
|
330
|
+
type: "select",
|
|
331
|
+
...t || {}
|
|
332
|
+
});
|
|
333
|
+
},
|
|
334
|
+
applyState(e) {
|
|
335
|
+
this.base.applyState(e), this.valueDuringOnChange = void 0;
|
|
336
|
+
},
|
|
337
|
+
suggestValue(e) {
|
|
338
|
+
if (this.suggested = "", e) {
|
|
339
|
+
const {
|
|
340
|
+
dataItems: t = [],
|
|
341
|
+
textField: i
|
|
342
|
+
} = this.$props, s = t[J(t, e, i)];
|
|
343
|
+
if (s) {
|
|
344
|
+
const n = O(s, i);
|
|
345
|
+
e.toLowerCase() !== n.toLowerCase() && (this.suggested = n.substring(e.length));
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
focusedIndex(e) {
|
|
350
|
+
const {
|
|
351
|
+
dataItems: t = [],
|
|
352
|
+
textField: i,
|
|
353
|
+
focusedItemIndex: s
|
|
354
|
+
} = this.$props, n = e !== void 0 ? e : this.computedValue();
|
|
355
|
+
return this.$data.focusedItem !== void 0 ? t.findIndex((o) => F(o, this.$data.focusedItem, i)) : s ? s(t, n, i) : Math.max(0, t.indexOf(R(t, n, i)));
|
|
356
|
+
},
|
|
357
|
+
repositionPopup() {
|
|
358
|
+
this.base.repositionPopup();
|
|
359
|
+
},
|
|
360
|
+
onScroll(e) {
|
|
361
|
+
this.isScrolling = !0;
|
|
362
|
+
const t = this.base.initState(), {
|
|
363
|
+
list: i
|
|
364
|
+
} = this.base, {
|
|
365
|
+
groupField: s
|
|
366
|
+
} = this.$props;
|
|
367
|
+
let {
|
|
368
|
+
dataItems: n = []
|
|
369
|
+
} = this.$props;
|
|
370
|
+
if (!s || !n.length)
|
|
371
|
+
return;
|
|
372
|
+
let o = this.itemHeight || (i.children ? i.children[0].offsetHeight : 0);
|
|
373
|
+
const a = e.target.scrollTop;
|
|
374
|
+
s && (n = this.base.getGroupedDataModernMode(n, s));
|
|
375
|
+
let r = n[0][s];
|
|
376
|
+
o === 0 && (o = 28);
|
|
377
|
+
for (let l = 1; l < n.length && !(o * l > a); l++)
|
|
378
|
+
n[l] && n[l][s] && (r = n[l][s]);
|
|
379
|
+
r !== this.group && (t.data.group = r, this.applyState(t));
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
render() {
|
|
383
|
+
const {
|
|
384
|
+
dir: e,
|
|
385
|
+
disabled: t,
|
|
386
|
+
label: i,
|
|
387
|
+
size: s,
|
|
388
|
+
rounded: n,
|
|
389
|
+
fillMode: o,
|
|
390
|
+
style: d,
|
|
391
|
+
loading: a,
|
|
392
|
+
suggest: r
|
|
393
|
+
} = this.$props, l = !this.$props.validityStyles || this.validity().valid, c = this.currentFocused, p = this.base, m = this.computedValue(), V = !a && !!m, k = this.$props.id || this.inputId, x = Object.assign({}, {
|
|
394
|
+
animate: !0,
|
|
395
|
+
height: "200px"
|
|
396
|
+
}, this.$props.popupSettings);
|
|
397
|
+
typeof r == "string" && (this.suggested = r);
|
|
398
|
+
const K = function(I, g) {
|
|
399
|
+
const {
|
|
400
|
+
placeholder: f,
|
|
401
|
+
tabIndex: y,
|
|
402
|
+
readonly: $
|
|
403
|
+
} = this.$props, C = this.$props.opened !== void 0 ? this.$props.opened : this.currentOpened;
|
|
404
|
+
return u(E, {
|
|
405
|
+
id: g,
|
|
406
|
+
placeholder: f,
|
|
407
|
+
tabIndex: y,
|
|
408
|
+
accessKey: this.$props.accessKey,
|
|
409
|
+
value: I,
|
|
410
|
+
suggestedText: this.suggested,
|
|
411
|
+
focused: c,
|
|
412
|
+
name: this.$props.name,
|
|
413
|
+
ref: (S) => {
|
|
414
|
+
this.inputRef = S;
|
|
415
|
+
},
|
|
416
|
+
onKeydown: this.onInputKeyDown,
|
|
417
|
+
onChange: this.onChangeHandler,
|
|
418
|
+
onFocus: p.handleFocus,
|
|
419
|
+
onBlur: this.handleBlur,
|
|
420
|
+
disabled: t,
|
|
421
|
+
readOnly: $,
|
|
422
|
+
expanded: C,
|
|
423
|
+
owns: p.listBoxId,
|
|
424
|
+
activedescendant: "option-" + p.guid + "-" + this.focusedIndex(),
|
|
425
|
+
onClearbuttonclick: this.clearButtonClick,
|
|
426
|
+
ariaLabelledBy: this.$props.ariaLabelledBy,
|
|
427
|
+
ariaDescribedBy: this.$props.ariaDescribedBy,
|
|
428
|
+
ariaLabel: this.$props.ariaLabel
|
|
429
|
+
}, null);
|
|
430
|
+
}, A = function() {
|
|
431
|
+
const {
|
|
432
|
+
textField: I,
|
|
433
|
+
groupField: g
|
|
434
|
+
} = this.$props;
|
|
435
|
+
let f = this.$props.dataItems || [];
|
|
436
|
+
const y = v.call(this, this.$props.itemRender, b.call(this)), $ = v.call(this, this.$props.groupHeaderItemRender, b.call(this)), C = v.call(this, this.$props.listNoDataRender, b.call(this)), S = this.$props.opened !== void 0 ? this.$props.opened : this.currentOpened;
|
|
437
|
+
return g && (f = this.base.getGroupedDataModernMode(f, g)), u(q, {
|
|
438
|
+
id: p.listBoxId,
|
|
439
|
+
show: S,
|
|
440
|
+
dataItems: f.slice(),
|
|
441
|
+
focusedIndex: this.focusedIndex(),
|
|
442
|
+
value: m,
|
|
443
|
+
textField: I,
|
|
444
|
+
valueField: I,
|
|
445
|
+
highlightSelected: !1,
|
|
446
|
+
optionsGuid: p.guid,
|
|
447
|
+
ref: "list",
|
|
448
|
+
wrapperStyle: {
|
|
449
|
+
maxHeight: x.height
|
|
450
|
+
},
|
|
451
|
+
wrapperCssClass: "k-list-content",
|
|
452
|
+
onListclick: this.handleItemClick,
|
|
453
|
+
itemRender: y,
|
|
454
|
+
groupHeaderItemRender: $,
|
|
455
|
+
noDataRender: C,
|
|
456
|
+
groupField: g,
|
|
457
|
+
onScroll: this.onScroll
|
|
458
|
+
}, null);
|
|
459
|
+
}, P = function() {
|
|
460
|
+
const I = v.call(this, this.$props.header, b.call(this)), g = v.call(this, this.$props.footer, b.call(this)), f = v.call(this, this.$props.groupStickyHeaderItemRender, b.call(this)), y = L.call(this, {
|
|
461
|
+
h: M,
|
|
462
|
+
template: I
|
|
463
|
+
}), $ = L.call(this, {
|
|
464
|
+
h: M,
|
|
465
|
+
template: g
|
|
466
|
+
}), C = this.$props.opened !== void 0 ? this.$props.opened : this.currentOpened, S = this.$props.dataItems || [];
|
|
467
|
+
return this.group === void 0 && this.$props.groupField !== void 0 && (this.group = O(S[0], this.$props.groupField)), u(_, {
|
|
468
|
+
onMousedown: (j) => j.preventDefault(),
|
|
469
|
+
width: this.popupWidth,
|
|
470
|
+
ref: "container",
|
|
471
|
+
popupSettings: {
|
|
472
|
+
...x,
|
|
473
|
+
anchor: this.anchor,
|
|
474
|
+
show: C,
|
|
475
|
+
popupClass: D(x.popupClass, "k-list", {
|
|
476
|
+
[`k-list-${N[s] || s}`]: s
|
|
477
|
+
}),
|
|
478
|
+
className: D("k-list-container", x.className)
|
|
479
|
+
},
|
|
480
|
+
dir: e !== void 0 ? e : this.base.dirCalculated
|
|
481
|
+
}, {
|
|
482
|
+
default: () => [y && u("div", {
|
|
483
|
+
class: "k-list-header"
|
|
484
|
+
}, [y]), this.group && S.length !== 0 && u(W, {
|
|
485
|
+
group: this.group,
|
|
486
|
+
render: f
|
|
487
|
+
}, null), A.call(this), $ && u("div", {
|
|
488
|
+
class: "k-list-footer"
|
|
489
|
+
}, [$])]
|
|
490
|
+
});
|
|
491
|
+
}, B = u("span", {
|
|
492
|
+
class: D("k-autocomplete k-input", {
|
|
493
|
+
[`k-input-${N[s] || s}`]: s,
|
|
494
|
+
[`k-rounded-${Y[n] || n}`]: n,
|
|
495
|
+
[`k-input-${o}`]: o,
|
|
496
|
+
"k-invalid": !l,
|
|
497
|
+
"k-focus": c && !t,
|
|
498
|
+
"k-loading": a,
|
|
499
|
+
"k-required": this.required,
|
|
500
|
+
"k-disabled": t
|
|
501
|
+
}),
|
|
502
|
+
ref: Q(this, "kendoAnchor"),
|
|
503
|
+
style: i ? {
|
|
504
|
+
...d,
|
|
505
|
+
width: void 0
|
|
506
|
+
} : d,
|
|
507
|
+
dir: e
|
|
508
|
+
}, [K.call(this, m || "", k), V && !a && u(U, {
|
|
509
|
+
onClearclick: this.clearButtonClick
|
|
510
|
+
}, null), u("span", {
|
|
511
|
+
class: a ? "k-input-loading-icon k-icon k-i-loading" : void 0
|
|
512
|
+
}, null), P.call(this)]);
|
|
513
|
+
return i ? u("span", {
|
|
514
|
+
class: this.spanClassNames,
|
|
515
|
+
dir: this.$props.dir
|
|
516
|
+
}, [B, this.$props.label ? k ? u("label", {
|
|
517
|
+
for: k,
|
|
518
|
+
class: "k-floating-label"
|
|
519
|
+
}, [this.$props.label]) : u("span", {
|
|
520
|
+
class: "k-label"
|
|
521
|
+
}, [this.$props.label]) : null]) : B;
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
export {
|
|
525
|
+
le as AutoComplete
|
|
526
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),pe=require("../common/DropDownBase.js"),_=require("../common/GroupStickyHeader.js"),o=require("@progress/kendo-vue-common"),G=require("@progress/kendo-vue-buttons"),d=require("../common/utils.js"),he=require("../common/SearchBar.js"),ge=require("../common/ListContainer.js"),fe=require("../common/List.js"),me=require("../common/ClearButton.js"),ve=require("@progress/kendo-vue-intl"),E=require("../messages/main.js"),W=require("@progress/kendo-svg-icons"),K=require("../common/constants.js"),be=require("@progress/kendo-vue-layout"),Se=require("../common/ListFilter.js"),{sizeMap:P,roundedMap:Ie}=o.kendoThemeMaps;function ye(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!n.isVNode(e)}const ke="Please enter a valid value!",Ve=n.defineComponent({name:"KendoComboBox",model:{event:"changemodel"},emits:{changemodel:null,"update:modelValue":null,filterchange:null,pagechange:null,change:null,focus:null,blur:null,open:null,close:null,scroll:null},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,default:"medium",validator:function(e){return["small","medium","large","full"].includes(e)}},fillMode:{type:String,default:"solid",validator:function(e){return["solid","flat","outline"].includes(e)}},size:{type:String,default:"medium",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},inject:{kendoLocalizationService:{default:null}},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 pe(this),this.anchor=o.guid(),this.inputId=o.guid()},setup(){const e=n.ref(null),t=n.ref(null),s=n.ref(null),i=n.inject("kendoLocalizationService",{});return{inputRef:e,elementRef:t,kendoAnchorRef:s,kendoLocalizationService:i}},mounted(){this.observer=o.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=o.getRef(this,"kendoAnchor"),this.element=o.getRef(this,"kendoAnchor"),this.base.didMount(),this.setValidity()},updated(){var v;const{dataItems:e=[],dataItemKey:t,virtual:s,groupField:i,textField:a}=this.$props,r=this.isOpen,l=this.prevOpened!==void 0?this.prevOpened:this.prevCurrentOpened,u=!l&&r,c=this.$refs.list,p=this.$refs.scrollElement,f=this.computedValue();if(this.valueOnDidUpdate=f,c&&(this.base.vs.list=c.list,this.base.list=c.list),p&&(this.base.vs.scrollElement=p),c&&e.length&&this.base.vs.scrollerRef(c.$el),s&&this.virtualTotalHasChanged)this.base.vs.calcScrollElementHeight(),this.base.vs.reset(),this.virtualTotalHasChanged=!1;else{const b=this.prevCurrentValue;let I=e.findIndex(x=>d.areSame(x,f,t));i&&(I=(v=this.base.getGroupedDataModernMode(e,i))==null?void 0:v.indexOf(f));const O=!d.areSame(b,f,t);if(u&&s)this.base.scrollToVirtualItem(s,I),this.prevCurrentOpened=!0;else if(u&&!s)e&&e.length!==0&&this.base.resetGroupStickyHeader(e[0][i],this),this.base.scrollToItem(I),this.prevCurrentOpened=!0;else if(r&&l&&f&&O)this.base.scrollToItem(I);else if(r&&!f&&!this.isScrolling){let x=0;if(i&&this.getFocusedIndex()!==-1&&e.length>0){const C=e[this.getFocusedIndex()][a],B=this.base.getGroupedDataModernMode(e,i),L=B.findIndex(k=>k[a]===C);x=B.slice(0,L).filter(k=>Object.keys(k).length===1).length}this.base.scrollToItem(this.getFocusedIndex()+x)}}u&&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,s=this.computedValue();return e.findIndex(i=>d.areSame(i,s,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<=K.MOBILE_SMALL_DEVICE?{top:0,width:"100%",height:"100%"}:void 0},classNameAdaptive(){return this.windowWidth<=K.MOBILE_SMALL_DEVICE?"k-adaptive-actionsheet k-actionsheet-fullscreen":"k-adaptive-actionsheet k-actionsheet-bottom"},adaptiveState(){return this.windowWidth<=K.MOBILE_MEDIUM_DEVICE&&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 s=this.dataItems.findIndex(i=>d.getItemValue(i,e)===t);return this.dataItems[s]},primitiveValue(){const e=this.computedValue();return this.valuePrimitive?d.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,s=this.$props.valid!==void 0?this.$props.valid:t;return{customError:e,valid:s,valueMissing:this.computedValue()===null}},handleItemSelect(e,t){const{dataItems:s=[],virtual:i,dataItemKey:a}=this.$props,r=i?i.skip:0,l=s[e-r],u=!d.areSame(l,this.computedValue(),a);this.triggerOnChange(l,t),this.currentText!==void 0&&(t.data.currentText=void 0),u&&this.base.triggerPageChangeCornerItems(l,t)},onNavigate(e,t){const{dataItems:s=[],virtual:i={skip:0}}=this.$props,a=this.$props.filter?this.$props.filter:this.currentText,r=this.getFocusedIndex(),l=this.base.vs,u=this.computedValue();if(this.suggested="",r!==-1&&!d.isPresent(u))this.handleItemSelect(r,e);else if(a==="")this.handleItemSelect(0,e);else{let c=i.skip+r;const p=this.base.navigation.navigate({keyCode:t,current:c,max:(l.enabled?l.total:s.length)-1,min:0});p!==void 0&&this.handleItemSelect(p,e)}},toggleBtnClick(e){const t=this.base.initState(),s=this.isOpen,i=this.adaptiveState;t.event=e,this.base.togglePopup(t),!s&&i&&this.base.filterChanged("",t),this.applyState(t)},applyValueOnEnter(e,t){const{dataItems:s=[],textField:i,allowCustom:a}=this.$props,r=this.isOpen,u=d.getItemValue(this.computedValue(),i)===e?this.index:d.getItemIndexByText(s,e,i),c=u!==-1;let p;if(this.suggested="",c)p=s[u];else if(a)p=i!==void 0?{[i]:e}:e;else return this.selectFocusedItem(e,t);this.triggerOnChange(p,t),r&&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:s=[],textField:i,allowCustom:a}=this.$props,r=this.isOpen,l=d.getItemValue(this.computedValue(),i);if(this.suggested="",e===l||e===""&&!d.isPresent(l))return r&&!this.adaptiveState&&this.base.togglePopup(t),this.applyState(t);const u=d.getItemIndexByText(s,e,i,!0),c=u!==-1;let p=null;c?p=s[u]:a&&(p=e?i?{[i]:e}:e:null),this.triggerOnChange(p,t),this.currentText!==void 0&&(t.data.currentText=void 0,this.base.filterChanged("",t)),r&&!this.adaptiveState&&this.base.togglePopup(t),this.applyState(t)},selectFocusedItem(e,t){const s=this.isOpen,{dataItems:i=[],textField:a,virtual:r={skip:0},focusedItemIndex:l=d.itemIndexStartsWith}=this.$props,u=r.skip,c=e===""&&u===0?0:l(i,e,a);return c!==-1?this.handleItemSelect(c+u,t):(this.triggerOnChange(null,t),this.currentText!==void 0&&(t.data.currentText=void 0)),s&&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,s=this.isOpen,i=this.base.initState();if(i.event=e,!e.altKey&&(t===o.Keys.up||t===o.Keys.down)){e.preventDefault(),this.onNavigate(i,t),this.applyState(i);return}const a=()=>{e.preventDefault(),this.base.togglePopup(i),this.applyState(i)};s?e.altKey&&t===o.Keys.up?a():t===o.Keys.enter?(e.preventDefault(),this.applyValueOnEnter(e.currentTarget.value,i)):t===o.Keys.esc&&(this.adaptiveState&&this.toggleBtnClick(e),a()):e.altKey&&t===o.Keys.down?a():t===o.Keys.esc&&this.applyValueOnRejectSuggestions(e.currentTarget.value,i)},inputOnChange(e){const t=this.base.initState();t.event=e;const s=this.isOpen,i=e.currentTarget,a=i.value;if(this.$props.suggest){const r=i.selectionEnd===a.length;let l=this.$props.filter!==void 0?this.$props.filter:this.currentText;d.isPresent(l)||(l=d.getItemValue(this.computedValue(),this.$props.textField)||"");const u=l&&l===a,c=l&&l.length>a.length;u||c||!r?this.suggested="":this.suggestValue(a)}this.$props.filter===void 0&&(t.data.currentText=a),this.currentFocusedItem!==void 0&&(t.data.focusedItem=void 0),s||this.base.togglePopup(t),this.base.filterChanged(a,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:s,dataItemKey:i,virtual:a={skip:0},focusedItemIndex:r=d.itemIndexStartsWith}=this.$props,l=this.$props.filter?this.$props.filter:this.currentText;return d.isPresent(e)&&l===void 0?t.findIndex(u=>d.areSame(u,e,i)):l?r(t,l,s):a.skip===0?0:-1},suggestValue(e){const{dataItems:t,textField:s}=this.$props;this.suggested=d.suggestValue(e,t,s)},setValidity(){this.input&&this.input.setCustomValidity&&this.input.setCustomValidity(this.validity().valid?"":this.$props.validationMessage||ke)},triggerOnChange(e,t){const s=this.computedValue();!d.isPresent(s)&&!d.isPresent(e)||d.areSame(s,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){this.isScrolling=!0;const{vs:t,list:s}=this.base;t.scrollHandler(e);const i=this.base.initState(),{groupField:a}=this.$props;let{dataItems:r=[]}=this.$props,l;if(!a||!r.length)return;const u=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:s?s.children[0].offsetHeight:0),p=e.target.scrollTop-t.skip*u;a&&(r=this.base.getGroupedDataModernMode(r,a),l=r[0][a]);for(let f=1;f<r.length&&!(u*f>p);f++)r[f]&&r[f][a]&&(l=r[f][a]);l!==this.group&&(i.data.group=l,this.applyState(i))}},render(){let{dir:e,disabled:t,clearButton:s,label:i,textField:a,className:r,style:l,loading:u,icon:c,svgIcon:p,iconClassName:f,virtual:v,size:b,fillMode:I,rounded:O,adaptiveTitle:x,header:C,footer:B,groupStickyHeaderItemRender:L,placeholder:k}=this.$props;const U=this.currentFocused,Y=!this.$props.validityStyles||this.validity().valid,D=this.$props.filter!==void 0?this.$props.filter:this.currentText,j=d.getItemValue(this.computedValue(),a),A=d.isPresent(D)?D:j,J=s&&(!!A||d.isPresent(this.computedValue())),V=this.base,y=V.vs,R=this.$props.id||this.inputId,w=Object.assign({},{animate:!0,height:"200px"},this.$props.popupSettings),Q=ve.provideLocalizationService(this).toLanguageString(E.expandButton,E.messages[E.expandButton]),F=this.isOpen,T=this.adaptiveState;y.enabled=v!==void 0,v!==void 0&&(y.skip=v.skip,y.total=v.total,y.pageSize=v.pageSize),this.group===void 0&&this.$props.groupField!==void 0&&(this.group=d.getItemValue(this.$props.dataItems[0],this.$props.groupField));const X=h=>{const g=this.base.initState();g.event=h;const m=h.event.target.value;g.data.text=m,this.base.filterChanged(m,g),this.applyState(g)},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"},[x]),k&&n.createVNode("div",{class:"k-actionsheet-subtitle k-text-center"},[k])]),n.createVNode("div",{class:"k-actionsheet-actions"},[n.createVNode(G.Button,{tabIndex:5,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:this.toggleBtnClick,icon:"x",svgIcon:W.xIcon},null)])]),n.createVNode("div",{class:"k-actionsheet-titlebar-group k-actionsheet-filter"},[ne.call(this)])],ee=o.templateRendering.call(this,Z,o.getListeners.call(this)),te=()=>{const h=V.getTemplateDef.call(this,C,n.h),g=V.getTemplateDef.call(this,B,n.h),m=o.templateRendering.call(this,L,o.getListeners.call(this)),S=this.$props.dataItems||[];return n.createVNode("div",{class:"k-list-container"},[h&&n.createVNode("div",{class:"k-list-header"},[h]),n.createVNode("div",{class:o.classNames("k-list",{[`k-list-${P[b]||b}`]:T?!1:b,"k-list-lg":!!T,"k-virtual-list":y.enabled})},[C&&n.createVNode("div",{class:"k-list-header"},[C]),this.group&&S.length!==0&&n.createVNode(_.GroupStickyHeader,{group:this.group,render:m},null),q.call(this),g&&n.createVNode("div",{class:"k-list-footer"},[g])])])},ie=o.templateRendering.call(this,te,o.getListeners.call(this)),se=function(){return n.createVNode(be.ActionSheet,{expand:F,animation:!0,animationStyles:this.animationStyles,className:this.classNameAdaptive,contentClassName:"!k-overflow-hidden",header:ee,content:ie,onClose:this.toggleBtnClick,navigatableElements:["input.k-input-inner",".k-actionsheet-actions > button"]},null)},ne=function(){const g=this.base.initState().data.text;return n.createVNode(Se.ListFilter,{adaptiveMode:!0,value:g,ref:"filterInput",onChange:m=>X(m),onKeydown:this.onInputKeyDown,size:this.$props.size,rounded:this.$props.rounded,fillMode:this.$props.fillMode},null)},q=function(){let h;const{dataItemKey:g,groupField:m}=this.$props;let S=this.$props.dataItems||[];const $=o.templateRendering.call(this,this.$props.itemRender,o.getListeners.call(this)),M=o.templateRendering.call(this,this.$props.groupHeaderItemRender,o.getListeners.call(this)),H=o.templateRendering.call(this,this.$props.listNoDataRender,o.getListeners.call(this));v||(v={skip:0});const N=v.skip,de=`translateY(${y.translate}px)`,ue=F?this.getFocusedIndex():void 0,ce=d.isPresent(D)&&D!==j?null:this.computedValue();return m&&(S=this.base.getGroupedDataModernMode(S,m)),n.createVNode(fe.List,{id:V.listBoxId,show:F,dataItems:S,focusedIndex:ue,value:ce,textField:a,valueField:g,optionsGuid:V.guid,ref:"list",wrapperStyle:{maxHeight:T?void 0:w.height},wrapperCssClass:o.classNames("k-list-content",{"k-list-scroller":!this.$props.virtual}),listStyle:y.enabled?{transform:de}:void 0,key:"listkey",skip:N,onListclick:this.handleItemClick,itemRender:$,groupHeaderItemRender:M,noDataRender:H,groupField:m,onScroll:this.onScroll},ye(h=ae.call(this))?h:{default:()=>[h]})},ae=function(){return y.enabled&&n.createVNode("div",{ref:"scrollElement",key:"scrollElementKey"},null)},le=function(){const h=o.templateRendering.call(this,this.$props.groupStickyHeaderItemRender,o.getListeners.call(this)),g=V.getTemplateDef.call(this,C),m=V.getTemplateDef.call(this,B),S=this.$props.dataItems||[];return this.group===void 0&&this.$props.groupField!==void 0&&(this.group=d.getItemValue(S[0],this.$props.groupField)),n.createVNode(ge.ListContainer,{ref:"container",onMousedown:$=>$.preventDefault(),width:this.popupWidth,popupSettings:{...w,anchor:this.anchor,show:F,popupClass:o.classNames(w.popupClass,"k-list",{[`k-list-${P[b]||b}`]:b,"k-virtual-list":this.base.vs.enabled}),className:o.classNames("k-list-container",w.className)},dir:e!==void 0?e:this.base.dirCalculated},{default:()=>[g&&n.createVNode("div",{class:"k-list-header"},[g]),this.group&&S.length!==0&&n.createVNode(_.GroupStickyHeader,{group:this.group,render:h},null),q.call(this),m&&n.createVNode("div",{class:"k-list-footer"},[m])]})},oe=function(h,g){const{tabIndex:m,dataItems:S=[],dataItemKey:$}=this.$props;v||(v={skip:0});const M=this.computedValue(),H=Math.max(0,S.findIndex(N=>d.areSame(N,M,$)));return this.suggested&&!d.areSame(this.valueOnDidUpdate,M,$)&&(this.suggested=""),n.createVNode(he.SearchBar,{id:g,placeholder:k,tabIndex:m||void 0,accessKey:this.$props.accessKey,value:h+this.suggested,suggestedText:this.suggested,ref:N=>{this.inputRef=N},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+v.skip),ariaLabelledBy:this.$props.ariaLabelledBy,ariaDescribedBy:this.$props.ariaDescribedBy,ariaLabel:this.$props.ariaLabel},null)},re=function(){return n.createVNode("span",{class:o.classNames("k-combobox k-input",{[`k-input-${P[b]||b}`]:b,[`k-rounded-${Ie[O]||O}`]:O,[`k-input-${I}`]:I,"k-invalid":!Y,"k-loading":u,"k-required":this.required,"k-disabled":t,"k-focus":U&&!t},r),ref:o.setRef(this,"kendoAnchor"),style:i?{...l,width:void 0}:l,dir:e},[oe.call(this,A||"",R),J&&!u&&n.createVNode(me.ClearButton,{onClearclick:this.clearButtonClick,key:"clearbutton"},null),u&&n.createVNode(o.Icon,{name:"loading",class:"k-input-loading-icon",key:"loading"},null),n.createVNode(G.Button,{type:"button",tabIndex:-1,"aria-label":Q,size:b,fillMode:I,rounded:null,class:"k-input-button",icon:c||"caret-alt-down",svgIcon:p||W.caretAltDownIcon,iconClass:f,onClick:this.toggleBtnClick,onMousedown:h=>h.preventDefault()},null),!T&&le.call(this)])},z=[n.h(re.call(this),{...this.$attrs}),T&&se.call(this)];return i?n.createVNode("span",{class:this.spanClassNames,onFocusin:this.handleFocus,dir:this.$props.dir},[z,this.$props.label?R?n.createVNode("label",{for:R,class:"k-floating-label"},[this.$props.label]):n.createVNode("span",{class:"k-label"},[this.$props.label]):null]):z}});exports.ComboBox=Ve;
|