@progress/kendo-vue-dropdowns 9.3.0-develop.1 → 9.3.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.
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { FormComponentValidity } from '@progress/kendo-vue-common';
9
9
  import { TagData } from './TagList';
10
- import { MultiSelectChangeEvent, MultiSelectOpenEvent, MultiSelectCloseEvent, MultiSelectFocusEvent, MultiSelectBlurEvent, MultiSelectFilterChangeEvent, MultiSelectPageChangeEvent } from './MultiSelectProps';
10
+ import { MultiSelectChangeEvent, MultiSelectOpenEvent, MultiSelectCloseEvent, MultiSelectFocusEvent, MultiSelectBlurEvent, MultiSelectFilterChangeEvent, MultiSelectPageChangeEvent, MultiSelectSelectAllChangeEvent } from './MultiSelectProps';
11
11
  import { DropDownStateBase, InternalState, ActiveDescendant } from './../common/settings';
12
12
  import { PropType } from 'vue';
13
13
  declare enum FocusedItemType {
@@ -39,6 +39,7 @@ export interface MultiSelectData extends DropDownStateBase {
39
39
  currentOpened?: boolean;
40
40
  currentFocusedTag?: any;
41
41
  currentValue?: Array<any>;
42
+ currentSelectAllFocused?: boolean;
42
43
  activedescendant?: ActiveDescendant;
43
44
  _skipFocusEvent: boolean;
44
45
  }
@@ -155,6 +156,12 @@ declare const MultiSelect: import('vue').DefineComponent<import('vue').ExtractPr
155
156
  default: any;
156
157
  };
157
158
  inputAttributes: PropType<Object>;
159
+ selectAll: PropType<boolean>;
160
+ checkboxes: PropType<boolean>;
161
+ summarizeAfter: {
162
+ type: PropType<number>;
163
+ default: number;
164
+ };
158
165
  }>, {
159
166
  inputRef: import('vue').Ref<any, any>;
160
167
  kendoAnchorRef: import('vue').Ref<any, any>;
@@ -167,6 +174,7 @@ declare const MultiSelect: import('vue').DefineComponent<import('vue').ExtractPr
167
174
  currentOpened: boolean;
168
175
  currentFocusedIndex: any;
169
176
  currentFocusedTag: any;
177
+ currentSelectAllFocused: boolean;
170
178
  searchState: {
171
179
  word: string;
172
180
  last: string;
@@ -179,6 +187,7 @@ declare const MultiSelect: import('vue').DefineComponent<import('vue').ExtractPr
179
187
  windowWidth: number;
180
188
  popupWidth: any;
181
189
  initialAdaptiveRenderingValues: any;
190
+ stickyHeadersHeight: number;
182
191
  }, {
183
192
  spanClassNames(): object;
184
193
  isOpen(): boolean;
@@ -203,6 +212,7 @@ declare const MultiSelect: import('vue').DefineComponent<import('vue').ExtractPr
203
212
  triggerOnChange(items: Array<any>, state: MultiSelectInternalState): void;
204
213
  selectFocusedItem(event: any): void;
205
214
  setItems(srcItems: Array<any>, destItems: Array<any>): void;
215
+ shouldKeepNoFocusOnOpen(text: string | undefined, focusedIndex: number | undefined): boolean;
206
216
  getFocusedState(): ListFocusedState;
207
217
  customItemSelect(event: any): void;
208
218
  handleWrapperClick(event: MouseEvent): void;
@@ -212,6 +222,7 @@ declare const MultiSelect: import('vue').DefineComponent<import('vue').ExtractPr
212
222
  handleFocus(event: any): void;
213
223
  onPopupOpened(): void;
214
224
  onPopupClosed(): void;
225
+ measureStickyHeadersHeight(): void;
215
226
  focusElement(element: any): void;
216
227
  applyState(state: MultiSelectInternalState): void;
217
228
  setValidity(): void;
@@ -219,12 +230,19 @@ declare const MultiSelect: import('vue').DefineComponent<import('vue').ExtractPr
219
230
  calculateMedia(entries: ResizeObserverEntry[]): void;
220
231
  repositionPopup(): void;
221
232
  onScroll(event: any): void;
233
+ getSelectableItems(): Array<any>;
234
+ areAllSelectableItemsSelected(): boolean;
235
+ areSomeSelectableItemsSelected(): boolean;
236
+ handleSelectAllItemClick(event: any): void;
237
+ handleSelectAllItemKeyDown(event: any): void;
238
+ toggleSelectAll(event?: any): void;
222
239
  }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
223
240
  changemodel: (value: any) => true;
224
241
  'update:modelValue': (value: any) => true;
225
242
  filterchange: (event: MultiSelectFilterChangeEvent) => true;
226
243
  change: (event: MultiSelectChangeEvent) => true;
227
244
  pagechange: (event: MultiSelectPageChangeEvent) => true;
245
+ selectallchange: (event: MultiSelectSelectAllChangeEvent) => true;
228
246
  focus: (event: MultiSelectFocusEvent) => true;
229
247
  blur: (event: MultiSelectBlurEvent) => true;
230
248
  open: (event: MultiSelectOpenEvent) => true;
@@ -340,6 +358,12 @@ declare const MultiSelect: import('vue').DefineComponent<import('vue').ExtractPr
340
358
  default: any;
341
359
  };
342
360
  inputAttributes: PropType<Object>;
361
+ selectAll: PropType<boolean>;
362
+ checkboxes: PropType<boolean>;
363
+ summarizeAfter: {
364
+ type: PropType<number>;
365
+ default: number;
366
+ };
343
367
  }>> & Readonly<{
344
368
  onScroll?: (event: Event) => any;
345
369
  onBlur?: (event: MultiSelectBlurEvent) => any;
@@ -351,6 +375,7 @@ declare const MultiSelect: import('vue').DefineComponent<import('vue').ExtractPr
351
375
  "onUpdate:modelValue"?: (value: any) => any;
352
376
  onPagechange?: (event: MultiSelectPageChangeEvent) => any;
353
377
  onFilterchange?: (event: MultiSelectFilterChangeEvent) => any;
378
+ onSelectallchange?: (event: MultiSelectSelectAllChangeEvent) => any;
354
379
  }>, {
355
380
  filter: string;
356
381
  required: boolean;
@@ -364,6 +389,7 @@ declare const MultiSelect: import('vue').DefineComponent<import('vue').ExtractPr
364
389
  validationMessage: string;
365
390
  validityStyles: boolean;
366
391
  adaptiveTitle: string;
392
+ summarizeAfter: number;
367
393
  autoClose: boolean;
368
394
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
369
395
  export { MultiSelect };
@@ -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 l=require("vue"),a=require("@progress/kendo-vue-common"),ve=require("../common/ListContainer.js"),Ie=require("../common/List.js"),be=require("./TagList.js"),ye=require("../common/SearchBar.js"),Se=require("../common/DropDownBase.js"),G=require("../common/GroupStickyHeader.js"),ke=require("../common/ClearButton.js"),L=require("../common/settings.js"),m=require("../common/utils.js"),U=require("@progress/kendo-svg-icons"),H=require("@progress/kendo-vue-buttons"),Y=require("../common/constants.js"),Ce=require("@progress/kendo-vue-layout"),xe=require("../common/ListFilter.js"),$e=require("@progress/kendo-vue-intl"),T=require("../messages/main.js"),{sizeMap:E,roundedMap:Fe}=a.kendoThemeMaps;function M(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!l.isVNode(e)}const Ve="Please enter a valid value!",Te=e=>e.preventDefault(),J=(e,t,s)=>!!e!=!!t||e.text!==t.text?!1:e===t||m.matchDataCollections(e.data,t.data,s),Q=e=>e===b.CustomItem;var b=(function(e){return e[e.None=0]="None",e[e.ListItem=1]="ListItem",e[e.CustomItem=2]="CustomItem",e})(b||{});const Oe=l.defineComponent({name:"KendoMultiSelect",emits:{changemodel:e=>!0,"update:modelValue":e=>!0,filterchange:e=>!0,change:e=>!0,pagechange:e=>!0,focus:e=>!0,blur:e=>!0,open:e=>!0,close:e=>!0,scroll:e=>!0},model:{event:"changemodel"},props:{autoClose:{type:Boolean,default:!0},removeTagIcon:String,allowCustom:Boolean,modelValue:Array,opened:{type:Boolean,default:void 0},disabled:Boolean,dir:String,tabIndex:{type:Number,default:0},accessKey:String,dataItems:Array,textField:String,label:String,loading:Boolean,name:String,value:Array,defaultValue:Array,valueField:String,valuePrimitive:Boolean,dataItemKey:String,placeholder:String,tags:Array,required:{type:Boolean,default:!1},valid:{type:Boolean,default:void 0},validate:{type:Boolean},validationMessage:{type:String,default:void 0},validityStyles:{type:Boolean,default:!0},tagRender:[String,Function,Object],id:String,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,virtual:{type:Object,default:void 0},header:[String,Function,Object],footer:[String,Function,Object],filterable:Boolean,filter:{type:String,default:void 0},ariaLabel:{type:String,default:void 0},ariaLabelledBy:String,ariaDescribedBy:String,rounded:{type:String,validator:function(e){return["none","small","medium","large","full"].includes(e)}},tagsRounded:{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["none","small","medium","large"].includes(e)}},groupField:{type:String},adaptive:{type:Boolean,default:void 0},adaptiveTitle:{type:String,default:void 0},inputAttributes:Object},setup(){const e=l.ref(null),t=l.ref(null),s=l.inject("kendoLocalizationService",{});return{inputRef:e,kendoAnchorRef:t,kendoLocalizationService:s}},computed:{spanClassNames(){const e=!this.hasMounted||!this.$props.validityStyles||this.validity().valid,t=this.currentText||m.getItemValue(this.computedValue()[0],this.$props.textField);return{"k-floating-label-container":!0,"k-focus":this.currentFocused,"k-empty":!(t&&t!==0),"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}},created(){this.observer=null,this.valuesItemsDuringOnChange=null,this._tags=[],this._skipFocusEvent=!1,this.scrollToFocused=!1,this.base=new Se(this),this.anchor=a.guid(),this.inputId=a.guid()},inject:{kendoLocalizationService:{default:null},adaptiveModeBreakpoints:{default:{small:Y.MOBILE_SMALL_DEVICE,medium:Y.MOBILE_MEDIUM_DEVICE}}},data(){return{hasMounted:!1,currentText:"",currentValue:"",currentFocused:!1,currentOpened:!1,currentFocusedIndex:void 0,currentFocusedTag:void 0,searchState:{word:"",last:""},suggested:"",activedescendant:L.ActiveDescendant.PopupList,group:void 0,isScrolling:!1,itemHeight:0,windowWidth:0,popupWidth:void 0,initialAdaptiveRenderingValues:void 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)},isOpen:function(e){e?this.initialAdaptiveRenderingValues=this.base.component.currentValue:this.initialAdaptiveRenderingValues=void 0,setTimeout(()=>{const t=document.querySelector(".k-list-item");this.itemHeight=this.base.getListItemHeight(t)},100)}},updated(){var g;const{virtual:e,groupField:t="",dataItems:s=[]}=this.$props,i=e?e.skip:0,n=this.isOpen,r=this.prevOpened!==void 0?this.prevOpened:this.prevCurrentOpened,d=!r&&n,u=r&&!n,p=Object.assign({},{animate:!0,height:"200px"},this.$props.popupSettings),o=this.$refs.list,f=this.$refs.scrollElement;if(o&&(this.base.vs.list=o.list,this.base.list=o.list),f&&(this.base.vs.scrollElement=f),o&&s.length&&this.base.vs.scrollerRef(o.$el),!p.animate&&u&&this.onPopupClosed(),!this.isScrolling)if(e&&this.virtualTotalHasChanged)this.base.vs.calcScrollElementHeight(),this.base.vs.reset(),this.virtualTotalHasChanged=!1;else{let{focusedItem:v,focusedIndex:C}=this.getFocusedState();t!==""&&(C=(g=this.base.getGroupedDataModernMode(s,t))==null?void 0:g.indexOf(v)),d&&e?(this.base.scrollToVirtualItem(e,C-i),this.prevCurrentOpened=!0):d&&!e?(s&&s.length!==0&&this.base.resetGroupStickyHeader(s[0][t],this),this.base.scrollToItem(C),this.prevCurrentOpened=!0):n&&r&&v&&this.base.scrollToItem(C-i)}this.scrollToFocused=!1,this.searchBarRef(),this.setValidity()},mounted(){this.observer=a.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=a.getRef(this,"kendoAnchor"),this.element=a.getRef(this,"kendoAnchor"),this.base.didMount(),this.searchBarRef(),this.setValidity()},methods:{clearFilter(e){this.currentText&&(e.data.currentText=""),this.base.filterChanged("",e)},computedValue(){const e=[];return this.valuesItemsDuringOnChange?e.push(...this.valuesItemsDuringOnChange):this.$props.value?e.push(...this.$props.value):this.$props.modelValue!==void 0?e.push(...this.$props.modelValue):this.currentValue?e.push(...this.currentValue):this.$props.defaultValue&&e.push(...this.$props.defaultValue),this.valuePrimitive&&this.findByFieldValue(this.valueField,e)||e},findByFieldValue(e,t){return t.map(i=>{const n=this.dataItems.findIndex(r=>m.getItemValue(r,e)===i);return this.dataItems[n]||i})},primitiveValue(){const e=this.computedValue(),t=e.map(s=>m.getItemValue(s,this.valueField));return this.valuePrimitive?t:e},validity(){const e=this.$props.validationMessage!==void 0,t=this.computedValue(),s=!this.$props.required||t!==null&&t.length>0&&t!==void 0,i=this.$props.valid!==void 0?this.$props.valid:s;return{customError:e,valid:i,valueMissing:t===null}},handleItemSelect(e,t){const{dataItems:s=[],dataItemKey:i,virtual:n}=this.$props,r=this.computedValue(),d=n?n.skip:0,u=s[e-d],p=r.findIndex(g=>m.areSame(g,u,i));let o=[];p!==-1?(o=r,o.splice(p,1)):o=[...r,u],(this.$props.filter!==void 0?this.$props.filter:this.currentText)&&!this.adaptiveState&&this.clearFilter(t),this.currentFocusedIndex!==void 0&&(t.data.currentFocusedIndex=void 0),this.triggerOnChange(o,t),this.base.triggerPageChangeCornerItems(u,t)},onTagDelete(e,t){const s=this.isOpen,i=this.base.initState();i.event=t,s&&this.base.togglePopup(i),this.currentFocused||(i.data.currentFocused=!0);const n=this.computedValue();m.removeDataItems(n,e,this.$props.dataItemKey),this.triggerOnChange(n,i),this.applyState(i)},onNavigate(e,t){const{allowCustom:s,dataItems:i=[]}=this.$props,n=this.isOpen,r=this.$props.filter!==void 0?this.$props.filter:this.currentText,{focusedType:d,focusedIndex:u}=this.getFocusedState(),p=s&&r,o=Q(d),f=this.base,g=f.vs;if(n&&t===a.Keys.up&&o)this.currentFocusedIndex!==void 0&&(e.data.currentFocusedIndex=void 0);else{const v=f.navigation.navigate({keyCode:t,current:u,max:(g.enabled?g.total:i.length)-1,min:p?-1:0});v!==void 0&&(this.itemFocus(v,e),this.scrollToFocused=!0)}this.applyState(e)},itemFocus(e,t){const{dataItems:s=[],allowCustom:i,virtual:n}=this.$props,r=n?n.skip:0,d=this.$props.filter!==void 0?this.$props.filter:this.currentText,{focusedIndex:u}=this.getFocusedState(),p=i&&d,o=s[e-r];o&&u!==e?this.currentFocusedIndex!==e&&(t.data.currentFocusedIndex=e,t.data.activedescendant=L.ActiveDescendant.PopupList):p&&e===-1&&this.currentFocusedIndex!==void 0&&(t.data.currentFocusedIndex=void 0),this.base.triggerPageChangeCornerItems(o,t)},searchBarRef(){this.input&&this.currentFocused&&setTimeout(()=>this.input.focus(),0)},onChangeHandler(e){const t=this.base.initState(),s=e&&(e.currentTarget&&e.currentTarget.value||e.value),i=this.isOpen;t.event=e,this.$props.filter===void 0&&(t.data.currentText=s),t.data.currentFocusedIndex=void 0,i||this.base.togglePopup(t),this.base.filterChanged(s,t),this.$props.filterable&&(t.data.group=void 0),this.applyState(t)},clearButtonClick(e){const t=this.isOpen,s=this.base.initState();s.event=e,e.stopPropagation(),this.computedValue().length>0&&this.triggerOnChange([],s),this.currentFocusedIndex!==void 0&&(s.data.currentFocusedIndex=void 0),t&&this.base.togglePopup(s);const i=this.$props.filter!==void 0?this.$props.filter:this.currentText;m.isPresent(i)&&i!==""&&this.base.filterChanged("",s),this.currentText&&(s.data.currentText=""),this.applyState(s)},onInputKeyDown(e){this.isScrolling&&(this.isScrolling=!1);const t=e.keyCode,s=this.$props.filter!==void 0?this.$props.filter:this.currentText,i=this.isOpen,{focusedItem:n}=this.getFocusedState(),r=this.base.initState();if(r.event=e,!s&&this.computedValue().length>0&&(t===a.Keys.left||t===a.Keys.right||t===a.Keys.home||t===a.Keys.end||t===a.Keys.delete||t===a.Keys.backspace))return this.onTagsNavigate(e,r);const d=()=>{e.preventDefault(),this.base.togglePopup(r),this.applyState(r)};i?e.altKey&&t===a.Keys.up?d():t===a.Keys.up||t===a.Keys.down?(e.preventDefault(),this.onNavigate(r,t)):t===a.Keys.enter?(e.preventDefault(),this.$props.allowCustom&&s&&n===null?this.customItemSelect(e):this.selectFocusedItem(e)):t===a.Keys.esc&&(this.adaptiveState&&this.handleWrapperClick(e),d()):e.altKey&&t===a.Keys.down&&d()},onTagsNavigate(e,t){const s=e.keyCode,i=this.currentFocusedTag,n=this._tags,r=this.$props.dataItemKey;let d=i?n.findIndex(o=>J(o,i,r)):-1,u;const p=d!==-1;if(s===a.Keys.left)p?d=Math.max(0,d-1):d=n.length-1,u=n[d];else if(s===a.Keys.right)d===n.length-1?u=void 0:p&&(d=Math.min(n.length-1,d+1),u=n[d]);else if(s===a.Keys.home)u=n[0];else if(s===a.Keys.end)u=n[n.length-1];else if(s===a.Keys.delete){if(p){const o=this.computedValue();m.removeDataItems(o,n[d].data,r),this.triggerOnChange(o,t)}}else if(s===a.Keys.backspace){const o=this.computedValue();if(p)m.removeDataItems(o,n[d].data,r),this.triggerOnChange(o,t);else if(!p&&n.length){const f=n.pop();m.removeDataItems(o,f.data,r),this.triggerOnChange(o,t)}}u!==i&&(t.data.currentFocusedTag=u,t.data.activedescendant=L.ActiveDescendant.TagsList),this.applyState(t)},triggerOnChange(e,t){this.$props.value===void 0&&(t.data.currentValue=[...e]),this.valuesItemsDuringOnChange=[],this.setItems(e,this.valuesItemsDuringOnChange),t.events.push({type:"change"})},selectFocusedItem(e){const{dataItems:t=[],virtual:s}=this.$props,{focusedIndex:i}=this.getFocusedState(),n=s?s.skip:0;t[i-n]!==void 0&&this.handleItemClick(i,e)},setItems(e,t){t.length=0,t.push(...e)},getFocusedState(){const e=this.currentFocusedIndex,t=this.$props.filter!==void 0?this.$props.filter:this.currentText,{allowCustom:s,dataItems:i=[],dataItemKey:n,virtual:r,textField:d,focusedItemIndex:u=m.itemIndexStartsWith}=this.$props,p=r&&r.skip||0;let o;if(e!==void 0)return{focusedIndex:e,focusedItem:i[e-p],focusedType:b.ListItem};const f=this.computedValue();if(s&&t)return{focusedItem:null,focusedIndex:-1,focusedType:b.CustomItem};if(t)return o=u(i,t,d),{focusedItem:i[o],focusedIndex:o+p,focusedType:b.ListItem};if(f.length){const g=f[f.length-1];return o=i.findIndex(v=>m.areSame(v,g,n)),i[o]!==void 0?{focusedIndex:o+p,focusedItem:i[o],focusedType:b.ListItem}:{focusedType:b.None,focusedIndex:-1}}return p===0?{focusedItem:i[0],focusedIndex:0,focusedType:b.ListItem}:{focusedType:b.None,focusedIndex:-1}},customItemSelect(e){const t=this.$props.filter!==void 0?this.$props.filter:this.currentText,{textField:s}=this.$props;if(!t)return;const i=this.base.initState();i.event=e;const n=s?{[s]:t}:t;this.currentText!==void 0&&(i.data.currentText=""),i.data.currentFocusedIndex=void 0,this.base.filterChanged("",i);const r=[...this.computedValue(),n];this.triggerOnChange(r,i),this.base.togglePopup(i),this.applyState(i)},handleWrapperClick(e){const t=this.isOpen,s=this.input;!t&&s&&this.focusElement(s);const i=this.base.initState();i.event=e,this.currentFocused||(i.events.push({type:"focus"}),i.data.currentFocused=!0),this.clearFilter(i),this.base.togglePopup(i),this.applyState(i)},onCancel(e){const t=this.base.initState();t.event=e,e.stopPropagation();const s=this.isOpen;t.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),s&&this.base.togglePopup(t),t.events.push({type:"onCancel"}),this.clearFilter(t),this.triggerOnChange([...this.initialAdaptiveRenderingValues],t),this.base.triggerPageChangeCornerItems([...this.initialAdaptiveRenderingValues],t),this.applyState(t)},handleItemClick(e,t){const s=this.base.initState();s.event=t,this.handleItemSelect(e,s),this.$props.autoClose&&!this.adaptiveState&&this.base.togglePopup(s),this.applyState(s)},handleBlur(e){if(!this.currentFocused||this._skipFocusEvent)return;const t=this.isOpen,s=this.base.initState(),{allowCustom:i,filterable:n}=this.$props;s.event=e,s.data.currentFocused=!1,s.events.push({type:"blur"}),t&&!this.adaptiveState&&(this.currentOpened&&(s.data.currentOpened=!1),s.events.push({type:"close"})),!i&&!n&&this.currentText&&(s.data.currentText=""),this.applyState(s)},handleFocus(e){this._skipFocusEvent||this.base.handleFocus(e)},onPopupOpened(){this.input&&this.currentFocused&&this.focusElement(this.input)},onPopupClosed(){this.currentFocused&&setTimeout(()=>{this.currentFocused&&this.focusElement(this.input)},0)},focusElement(e){this._skipFocusEvent=!0,e.focus(),setTimeout(()=>this._skipFocusEvent=!1,30)},applyState(e){this.base.applyState(e),this.valuesItemsDuringOnChange=null},setValidity(){this.input&&this.input.setCustomValidity&&this.input.setCustomValidity(this.validity().valid?"":this.$props.validationMessage||Ve)},focus(){this.input&&this.input.focus()},calculateMedia(e){for(let t of e)this.windowWidth=t.target.clientWidth},repositionPopup(){this.base.repositionPopup()},onScroll(e){var g;this.isScrolling=!0;const{vs:t,list:s}=this.base;t.scrollHandler(e);const i=this.base.initState(),{groupField:n}=this.$props;let{dataItems:r=[]}=this.$props,d;if(!n||!r.length)return;const u=s&&((g=s.querySelector(".k-list-item"))==null?void 0:g.offsetHeight)||0,p=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:u),f=e.target.scrollTop-t.skip*p;n&&(r=this.base.getGroupedDataModernMode(r,n),r=this.base.getGroupedDataModernMode(r,n),d=r[0][n]);for(let v=1;v<r.length&&!(p*v>f);v++)r[v]&&r[v][n]&&(d=r[v][n]);d!==this.group&&(i.data.group=d,this.applyState(i))}},render(){const{style:e,label:t,dir:s,disabled:i,tags:n,textField:r,dataItemKey:d,virtual:u,loading:p,size:o,fillMode:f,rounded:g,tagsRounded:v,removeTagIcon:C,adaptiveTitle:X,header:w,footer:P,inputAttributes:Z,groupStickyHeaderItemRender:ee,dataItems:x=[]}=this.$props,te=this.currentFocused,N=Object.assign({},{animate:!0,height:"200px"},this.$props.popupSettings),R=this.currentFocusedTag,q=this.computedValue(),D=(this.$props.filter!==void 0?this.$props.filter:this.currentText)||"",se=!p&&(!!D||q.length>0),y=this.base.vs,A=this.$props.id||this.inputId,ie=a.templateRendering.call(this,this.$props.tagRender,a.getListeners.call(this)),B=this.isOpen,$=this.adaptiveState,j=$e.provideLocalizationService(this);this.group===void 0&&this.$props.groupField!==void 0&&(this.group=m.getItemValue(this.$props.dataItems[0],this.$props.groupField)),y.enabled=u!==void 0,u!==void 0&&(y.skip=u.skip,y.total=u.total,y.pageSize=u.pageSize);let I=[];this.initialAdaptiveRenderingValues?[...this.initialAdaptiveRenderingValues].forEach(h=>{I.push({text:m.getItemValue(h,r),data:[h]})}):n===void 0?this.computedValue().forEach(c=>{I.push({text:m.getItemValue(c,r),data:[c]})}):I.push(...n),I.length>0&&this.setItems(I,this._tags);const ne=!this.$props.validityStyles||this.validity().valid,ae=function(c){const h=this.activedescendant,{placeholder:S}=this.$props,{focusedIndex:F}=this.getFocusedState(),k=I.length===0||q.length===0&&!D?S:void 0,V=h===L.ActiveDescendant.TagsList&&R!==void 0?`tag-${this.base.guid}-${R.text.replace(/\s+/g,"-")}`:`option-${this.base.guid}-${F}`;return l.createVNode(ye.SearchBar,{id:c,size:Math.max((k||"").length,D.length,1),tabIndex:this.$props.tabIndex,accessKey:this.$props.accessKey,placeholder:k,value:$?"":D,onChange:this.onChangeHandler,onBlur:this.handleBlur,onKeydown:this.onInputKeyDown,ref:O=>{this.inputRef=O},disabled:i,expanded:B,owns:this.base.listBoxId,activedescendant:V,"aria-describedBy":`tagslist-${this.base.guid}${this.$props.ariaDescribedBy?" "+this.$props.ariaDescribedBy:""}`,"aria-labelledBy":this.$props.ariaLabelledBy,"aria-label":this.$props.ariaLabel,inputAttributes:Z},null)},_=function(){let c;const{groupField:h}=this.$props,S=a.templateRendering.call(this,this.$props.itemRender,a.getListeners.call(this)),F=a.templateRendering.call(this,this.$props.groupHeaderItemRender,a.getListeners.call(this)),k=a.templateRendering.call(this,this.$props.listNoDataRender,a.getListeners.call(this)),V=u?u.skip:0,{focusedIndex:O}=this.getFocusedState(),K=`translateY(${y.translate}px)`;let W=x;return h&&(W=this.base.getGroupedDataModernMode(x,h)),l.createVNode(Ie.List,{id:this.base.listBoxId,show:B,dataItems:W.slice(),focusedIndex:O,value:this.computedValue(),textField:r,valueField:d,optionsGuid:this.base.guid,ref:"list",wrapperStyle:{maxHeight:$?void 0:N.height},wrapperCssClass:"k-list-content",listStyle:y.enabled?{transform:K}:void 0,key:"listKey",skip:V,onListclick:this.handleItemClick,itemRender:S,groupHeaderItemRender:F,noDataRender:k,groupField:h,onScroll:this.onScroll},M(c=oe.call(this))?c:{default:()=>[c]})},oe=function(){return y.enabled&&l.createVNode("div",{ref:"scrollElement",key:"scrollElementKey"},null)},re=function(){const c=this.base,{allowCustom:h}=this.$props,S=a.templateRendering.call(this,this.$props.groupStickyHeaderItemRender,a.getListeners.call(this)),F=c.getTemplateDef.call(this,w),k=c.getTemplateDef.call(this,P),V=this.$props.filter!==void 0?this.$props.filter:this.currentText,{focusedType:O}=this.getFocusedState(),K=h&&V&&l.createVNode("div",{class:"k-list",key:"customitem",onClick:this.customItemSelect},[l.createVNode("div",{class:a.classNames("k-item k-custom-item",{"k-focus":Q(O)})},[V,l.createVNode(a.Icon,{name:"plus",icon:U.plusIcon,style:{float:"right"}},null)])]);return this.group===void 0&&this.$props.groupField!==void 0&&(this.group=m.getItemValue(x[0],this.$props.groupField)),l.createVNode(ve.ListContainer,{ref:"container",onMousedown:Te,dir:s!==void 0?s:c.dirCalculated,onBlur:this.handleBlur,width:this.popupWidth,popupSettings:{...N,anchor:this.anchor,show:B,onOpen:this.onPopupOpened,onClose:this.onPopupClosed,popupClass:a.classNames(N.popupClass,"k-list",{[`k-list-${E[o]||o}`]:o,"k-virtual-list":this.base.vs.enabled}),className:a.classNames("k-list-container",N.className)},itemsCount:x.length},{default:()=>[F&&l.createVNode("div",{class:"k-list-header"},[F]),K,this.group&&x.length!==0&&l.createVNode(G.GroupStickyHeader,{group:this.group,render:S},null),_.call(this),k&&l.createVNode("div",{class:"k-list-footer"},[k]),u&&w]})},le=function(){const c=this.$props.filter!==void 0?this.$props.filter:this.currentText;return this.$props.filterable&&l.createVNode(xe.ListFilter,{value:c,ref:"filterInput",onChange:this.onChangeHandler,onKeydown:this.onInputKeyDown,size:o,rounded:g,fillMode:f},null)},de=()=>[l.createVNode("div",{class:"k-actionsheet-titlebar-group k-hbox"},[l.createVNode("div",{class:"k-actionsheet-title"},[l.createVNode("div",{class:"k-text-center"},[X]),l.createVNode("div",{class:"k-actionsheet-subtitle k-text-center"},null)]),l.createVNode("div",{class:"k-actionsheet-actions"},[l.createVNode(H.Button,{tabIndex:5,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:this.onCancel,icon:"x",svgIcon:U.xIcon},null)])]),l.createVNode("div",{class:"k-actionsheet-titlebar-group k-actionsheet-filter"},[le.call(this)])],ue=a.templateRendering.call(this,de,a.getListeners.call(this)),ce=()=>{const c=j.toLanguageString(T.adaptiveModeFooterCancel,T.messages[T.adaptiveModeFooterCancel]),h=j.toLanguageString(T.adaptiveModeFooterApply,T.messages[T.adaptiveModeFooterApply]);return[l.createVNode(H.Button,{size:"large","aria-label":c,"aria-disabled":"false",type:"button",onClick:this.onCancel},M(c)?c:{default:()=>[c]}),l.createVNode(H.Button,{themeColor:"primary",size:"large","aria-label":h,"aria-disabled":"false",type:"button",onClick:this.handleWrapperClick},M(h)?h:{default:()=>[h]})]},pe=a.templateRendering.call(this,ce,a.getListeners.call(this)),he=()=>{const c=this.base.getTemplateDef.call(this,w,l.h),h=this.base.getTemplateDef.call(this,P,l.h),S=a.templateRendering.call(this,ee,a.getListeners.call(this));return l.createVNode("div",{class:"k-list-container"},[c&&l.createVNode("div",{class:"k-list-header"},[c]),l.createVNode("div",{class:a.classNames("k-list",{[`k-list-${E[o]||o}`]:$?!1:o,"k-list-lg":!!$,"k-virtual-list":y.enabled})},[this.group&&x.length!==0&&l.createVNode(G.GroupStickyHeader,{group:this.group,render:S},null),_.call(this),h&&l.createVNode("div",{class:"k-list-footer"},[h])])])},fe=a.templateRendering.call(this,he,a.getListeners.call(this)),ge=function(){return l.createVNode(Ce.ActionSheet,{expand:B,animation:!0,animationStyles:this.animationStyles,className:this.classNameAdaptive,contentClassName:"!k-overflow-hidden",footerClassName:"k-actions k-actions-stretched",header:ue,content:fe,footer:pe,onClose:this.onCancel,navigatableElements:["input.k-input-inner",".k-actionsheet-actions > button"]},null)},me=function(){let c;return l.createVNode("span",{ref:a.setRef(this,"kendoAnchor"),class:a.classNames("k-multiselect","k-input",{[`k-input-${E[o]||o}`]:o,[`k-rounded-${Fe[g]||g}`]:g,[`k-input-${f}`]:f,"k-focus":te&&!i,"k-disabled":i,"k-invalid":!ne,"k-loading":p,"k-required":this.required}),style:t?{...e,width:void 0}:e,dir:s,onFocusin:this.handleFocus,onClick:this.handleWrapperClick,onMousedown:m.preventDefaultNonInputs},[l.createVNode(be.TagList,{removeTagIcon:C,tagsRounded:v,size:o,fillMode:f,tagRender:ie,onTagdelete:this.onTagDelete,dataItems:I,guid:this.base.guid,focused:R?I.find(h=>J(h,R,d)):void 0},M(c=ae.call(this,A))?c:{default:()=>[c]}),I.length>0&&se&&l.createVNode(ke.ClearButton,{onClearclick:this.clearButtonClick},null),l.createVNode("span",{class:p?"k-input-loading-icon k-icon k-i-loading":void 0},null),!$&&re.call(this)])},z=[l.h(me.call(this),{...this.$attrs}),$&&ge.call(this)];return t?l.createVNode("span",{class:this.spanClassNames,dir:this.$props.dir},[z,this.$props.label?A?l.createVNode("label",{for:A,class:"k-floating-label"},[this.$props.label]):l.createVNode("span",{class:"k-label"},[this.$props.label]):null]):z}});exports.MultiSelect=Oe;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue"),l=require("@progress/kendo-vue-common"),Se=require("../common/ListContainer.js"),Ie=require("../common/List.js"),ye=require("./TagList.js"),be=require("../common/SearchBar.js"),ke=require("../common/DropDownBase.js"),U=require("../common/GroupStickyHeader.js"),xe=require("../common/ClearButton.js"),K=require("../common/settings.js"),f=require("../common/utils.js"),$e=require("@progress/kendo-svg-icons"),E=require("@progress/kendo-vue-buttons"),Ce=require("@progress/kendo-vue-inputs"),Y=require("../common/constants.js"),Fe=require("@progress/kendo-vue-layout"),Te=require("../common/ListFilter.js"),Ve=require("@progress/kendo-vue-intl"),y=require("../messages/main.js"),{sizeMap:q,roundedMap:Ae}=l.kendoThemeMaps;function B(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!r.isVNode(e)}const Ne="Please enter a valid value!",J=e=>e.preventDefault(),Q=(e,t,s)=>!!e!=!!t||e.text!==t.text?!1:e===t||f.matchDataCollections(e.data,t.data,s),X=e=>e===$.CustomItem;var $=(function(e){return e[e.None=0]="None",e[e.ListItem=1]="ListItem",e[e.CustomItem=2]="CustomItem",e})($||{});const Oe=r.defineComponent({name:"KendoMultiSelect",emits:{changemodel:e=>!0,"update:modelValue":e=>!0,filterchange:e=>!0,change:e=>!0,pagechange:e=>!0,selectallchange:e=>!0,focus:e=>!0,blur:e=>!0,open:e=>!0,close:e=>!0,scroll:e=>!0},model:{event:"changemodel"},props:{autoClose:{type:Boolean,default:!0},removeTagIcon:String,allowCustom:Boolean,modelValue:Array,opened:{type:Boolean,default:void 0},disabled:Boolean,dir:String,tabIndex:{type:Number,default:0},accessKey:String,dataItems:Array,textField:String,label:String,loading:Boolean,name:String,value:Array,defaultValue:Array,valueField:String,valuePrimitive:Boolean,dataItemKey:String,placeholder:String,tags:Array,required:{type:Boolean,default:!1},valid:{type:Boolean,default:void 0},validate:{type:Boolean},validationMessage:{type:String,default:void 0},validityStyles:{type:Boolean,default:!0},tagRender:[String,Function,Object],id:String,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,virtual:{type:Object,default:void 0},header:[String,Function,Object],footer:[String,Function,Object],filterable:Boolean,filter:{type:String,default:void 0},ariaLabel:{type:String,default:void 0},ariaLabelledBy:String,ariaDescribedBy:String,rounded:{type:String,validator:function(e){return["none","small","medium","large","full"].includes(e)}},tagsRounded:{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["none","small","medium","large"].includes(e)}},groupField:{type:String},adaptive:{type:Boolean,default:void 0},adaptiveTitle:{type:String,default:void 0},inputAttributes:Object,selectAll:Boolean,checkboxes:Boolean,summarizeAfter:{type:Number,default:10}},setup(){const e=r.ref(null),t=r.ref(null),s=r.inject("kendoLocalizationService",{});return{inputRef:e,kendoAnchorRef:t,kendoLocalizationService:s}},computed:{spanClassNames(){const e=!this.hasMounted||!this.$props.validityStyles||this.validity().valid,t=this.currentText||f.getItemValue(this.computedValue()[0],this.$props.textField);return{"k-floating-label-container":!0,"k-focus":this.currentFocused,"k-empty":!(t&&t!==0),"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}},created(){this.observer=null,this.valuesItemsDuringOnChange=null,this._tags=[],this._skipFocusEvent=!1,this.scrollToFocused=!1,this.base=new ke(this),this.anchor=l.guid(),this.inputId=l.guid()},inject:{kendoLocalizationService:{default:null},adaptiveModeBreakpoints:{default:{small:Y.MOBILE_SMALL_DEVICE,medium:Y.MOBILE_MEDIUM_DEVICE}}},data(){return{hasMounted:!1,currentText:"",currentValue:"",currentFocused:!1,currentOpened:!1,currentFocusedIndex:void 0,currentFocusedTag:void 0,currentSelectAllFocused:!1,searchState:{word:"",last:""},suggested:"",activedescendant:K.ActiveDescendant.PopupList,group:void 0,isScrolling:!1,itemHeight:0,windowWidth:0,popupWidth:void 0,initialAdaptiveRenderingValues:void 0,stickyHeadersHeight: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)},isOpen:function(e){e?(this.initialAdaptiveRenderingValues=this.base.component.currentValue,this.isScrolling=!1):(this.initialAdaptiveRenderingValues=void 0,this.currentSelectAllFocused=!1),setTimeout(()=>{const t=document.querySelector(".k-list-item");this.itemHeight=this.base.getListItemHeight(t)},100)}},updated(){var m;const{virtual:e,groupField:t="",dataItems:s=[]}=this.$props,i=e?e.skip:0,n=this.isOpen,a=this.prevOpened!==void 0?this.prevOpened:this.prevCurrentOpened,d=!a&&n,c=a&&!n,u=Object.assign({},{animate:!0,height:"200px"},this.$props.popupSettings),o=this.$refs.list,g=this.$refs.scrollElement;if(o&&(this.base.vs.list=o.list,this.base.list=o.list),g&&(this.base.vs.scrollElement=g),o&&s.length&&this.base.vs.scrollerRef(o.$el),n&&this.stickyHeadersHeight===0&&this.measureStickyHeadersHeight(),!u.animate&&c&&this.onPopupClosed(),!this.isScrolling)if(e&&this.virtualTotalHasChanged)this.base.vs.calcScrollElementHeight(),this.base.vs.reset(),this.virtualTotalHasChanged=!1;else{let{focusedItem:v,focusedIndex:I}=this.getFocusedState();t!==""&&(I=(m=this.base.getGroupedDataModernMode(s,t))==null?void 0:m.indexOf(v)),d&&e?(this.base.vs.container?(this.base.scrollToVirtualItem(e,I-i),this.base.vs.translate>0&&I-i<0&&(this.base.vs.container.scrollTop=this.base.vs.translate)):this.$nextTick(()=>{const T=this.$refs.list;T&&(this.base.vs.list=T.list,this.base.list=T.list,this.base.vs.scrollerRef(T.$el));const A=this.$refs.scrollElement;A&&(this.base.vs.scrollElement=A),this.base.scrollToVirtualItem(e,I-i),this.base.vs.translate>0&&I-i<0&&(this.base.vs.container.scrollTop=this.base.vs.translate)}),this.prevCurrentOpened=!0):d&&!e?(s&&s.length!==0&&this.base.resetGroupStickyHeader(s[0][t],this),this.base.scrollToItem(I),this.prevCurrentOpened=!0):n&&a&&v&&this.scrollToFocused&&this.base.scrollToItem(I-i)}this.scrollToFocused=!1,this.searchBarRef(),this.setValidity()},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.searchBarRef(),this.setValidity()},methods:{clearFilter(e){this.currentText&&(e.data.currentText=""),this.base.filterChanged("",e)},computedValue(){const e=[];return this.valuesItemsDuringOnChange?e.push(...this.valuesItemsDuringOnChange):this.$props.value?e.push(...this.$props.value):this.$props.modelValue!==void 0?e.push(...this.$props.modelValue):this.currentValue?e.push(...this.currentValue):this.$props.defaultValue&&e.push(...this.$props.defaultValue),this.valuePrimitive&&this.findByFieldValue(this.valueField,e)||e},findByFieldValue(e,t){return t.map(i=>{const n=this.dataItems.findIndex(a=>f.getItemValue(a,e)===i);return this.dataItems[n]||i})},primitiveValue(){const e=this.computedValue(),t=e.map(s=>f.getItemValue(s,this.valueField));return this.valuePrimitive?t:e},validity(){const e=this.$props.validationMessage!==void 0,t=this.computedValue(),s=!this.$props.required||t!==null&&t.length>0&&t!==void 0,i=this.$props.valid!==void 0?this.$props.valid:s;return{customError:e,valid:i,valueMissing:t===null}},handleItemSelect(e,t){this.currentSelectAllFocused&&(t.data.currentSelectAllFocused=!1);const{dataItems:s=[],dataItemKey:i,virtual:n}=this.$props,a=this.computedValue(),d=n?n.skip:0,c=s[e-d],u=a.findIndex(m=>f.areSame(m,c,i));this._lastSelectedOrDeselectedItemIndex=s.findIndex(m=>f.areSame(m,c,i));let o=[];u!==-1?(o=a,o.splice(u,1)):o=[...a,c],(this.$props.filter!==void 0?this.$props.filter:this.currentText)&&!this.adaptiveState&&!this.$props.checkboxes&&this.clearFilter(t),t.data.currentFocusedIndex=e,this.triggerOnChange(o,t),this.base.triggerPageChangeCornerItems(c,t)},onTagDelete(e,t){const s=this.isOpen,i=this.base.initState();i.event=t,s&&this.base.togglePopup(i),this.currentFocused||(i.data.currentFocused=!0);const n=this.computedValue();f.removeDataItems(n,e,this.$props.dataItemKey),this.triggerOnChange(n,i),this.applyState(i)},onNavigate(e,t){const{allowCustom:s,dataItems:i=[],selectAll:n}=this.$props,a=this.isOpen,d=this.$props.filter!==void 0?this.$props.filter:this.currentText,{focusedType:c,focusedIndex:u}=this.getFocusedState(),o=s&&d,g=X(c),m=this.base,v=m.vs;if(this.currentSelectAllFocused){t===l.Keys.down&&(e.data.currentSelectAllFocused=!1,o||(this.itemFocus(0,e),this.scrollToFocused=!0)),this.applyState(e);return}if(n&&a&&u===-1&&!g){t===l.Keys.down&&(e.data.currentSelectAllFocused=!0),this.applyState(e);return}if(n&&a&&t===l.Keys.up&&u===0&&!o){e.data.currentSelectAllFocused=!0,e.data.currentFocusedIndex=void 0,this.applyState(e);return}if(a&&t===l.Keys.up&&g)n&&(e.data.currentSelectAllFocused=!0),this.currentFocusedIndex!==void 0&&(e.data.currentFocusedIndex=void 0);else{const I=m.navigation.navigate({keyCode:t,current:u,max:(v.enabled?v.total:i.length)-1,min:o?-1:0});I!==void 0&&(this.itemFocus(I,e),this.scrollToFocused=!0)}this.applyState(e)},itemFocus(e,t){const{dataItems:s=[],allowCustom:i,virtual:n}=this.$props,a=n?n.skip:0,d=this.$props.filter!==void 0?this.$props.filter:this.currentText,{focusedIndex:c}=this.getFocusedState(),u=i&&d,o=s[e-a];o&&c!==e?this.currentFocusedIndex!==e&&(t.data.currentFocusedIndex=e,t.data.activedescendant=K.ActiveDescendant.PopupList):u&&e===-1&&this.currentFocusedIndex!==void 0&&(t.data.currentFocusedIndex=void 0),this.base.triggerPageChangeCornerItems(o,t)},searchBarRef(){this.input&&this.currentFocused&&setTimeout(()=>this.input.focus(),0)},onChangeHandler(e){const t=this.base.initState(),s=e&&(e.currentTarget&&e.currentTarget.value||e.value),i=this.isOpen;t.event=e,this.$props.filter===void 0&&(t.data.currentText=s),t.data.currentFocusedIndex=void 0,i?this.scrollToFocused=!0:this.base.togglePopup(t),this.base.filterChanged(s,t),this.$props.filterable&&(t.data.group=void 0),this.applyState(t)},clearButtonClick(e){const t=this.isOpen,s=this.base.initState();s.event=e,e.stopPropagation(),this.computedValue().length>0&&this.triggerOnChange([],s),this.currentFocusedIndex!==void 0&&(s.data.currentFocusedIndex=void 0),t&&this.base.togglePopup(s);const i=this.$props.filter!==void 0?this.$props.filter:this.currentText;f.isPresent(i)&&i!==""&&this.base.filterChanged("",s),this.currentText&&(s.data.currentText=""),this.applyState(s)},onInputKeyDown(e){this.isScrolling&&(this.isScrolling=!1);const t=e.keyCode,s=this.$props.filter!==void 0?this.$props.filter:this.currentText,i=this.isOpen,{focusedItem:n}=this.getFocusedState(),a=this.base.initState();if(a.event=e,!s&&this.computedValue().length>0&&(t===l.Keys.left||t===l.Keys.right||t===l.Keys.home||t===l.Keys.end||t===l.Keys.delete||t===l.Keys.backspace))return this.onTagsNavigate(e,a);const d=()=>{e.preventDefault(),this.base.togglePopup(a),this.applyState(a)};i?e.altKey&&t===l.Keys.up?d():t===l.Keys.up||t===l.Keys.down?(e.preventDefault(),this.onNavigate(a,t)):t===l.Keys.enter||t===l.Keys.space&&this.currentSelectAllFocused?(e.preventDefault(),this.currentSelectAllFocused?this.toggleSelectAll(e):this.$props.allowCustom&&s&&n===null?this.customItemSelect(e):this.selectFocusedItem(e)):t===l.Keys.esc&&(this.adaptiveState&&this.handleWrapperClick(e),d()):(e.altKey&&t===l.Keys.down||t===l.Keys.space&&this.$props.selectAll)&&d()},onTagsNavigate(e,t){const s=e.keyCode,i=this.currentFocusedTag,n=this._tags,a=this.$props.dataItemKey;let d=i?n.findIndex(o=>Q(o,i,a)):-1,c;const u=d!==-1;if(s===l.Keys.left)u?d=Math.max(0,d-1):d=n.length-1,c=n[d];else if(s===l.Keys.right)d===n.length-1?c=void 0:u&&(d=Math.min(n.length-1,d+1),c=n[d]);else if(s===l.Keys.home)c=n[0];else if(s===l.Keys.end)c=n[n.length-1];else if(s===l.Keys.delete){if(u){const o=this.computedValue();f.removeDataItems(o,n[d].data,a),this.triggerOnChange(o,t)}}else if(s===l.Keys.backspace){const o=this.computedValue();if(u)f.removeDataItems(o,n[d].data,a),this.triggerOnChange(o,t);else if(!u&&n.length){const g=n.pop();f.removeDataItems(o,g.data,a),this.triggerOnChange(o,t)}}c!==i&&(t.data.currentFocusedTag=c,t.data.activedescendant=K.ActiveDescendant.TagsList),this.applyState(t)},triggerOnChange(e,t){this.$props.value===void 0&&(t.data.currentValue=[...e]),this.valuesItemsDuringOnChange=[],this.setItems(e,this.valuesItemsDuringOnChange),t.events.push({type:"change"}),this.base.repositionPopup()},selectFocusedItem(e){const{dataItems:t=[],virtual:s}=this.$props,{focusedIndex:i}=this.getFocusedState(),n=s?s.skip:0;t[i-n]!==void 0&&this.handleItemClick(i,e)},setItems(e,t){t.length=0,t.push(...e)},shouldKeepNoFocusOnOpen(e,t){return this.$props.selectAll&&t===void 0&&this.computedValue().length===0&&!(this.$props.allowCustom&&e)},getFocusedState(){if(this.currentSelectAllFocused)return{focusedType:$.None,focusedIndex:-1};const e=this.currentFocusedIndex,t=this.$props.filter!==void 0?this.$props.filter:this.currentText;if(this.shouldKeepNoFocusOnOpen(t,e))return{focusedType:$.None,focusedIndex:-1};const{allowCustom:s,dataItems:i=[],dataItemKey:n,virtual:a,textField:d,focusedItemIndex:c=f.itemIndexStartsWith}=this.$props,u=a&&a.skip||0;let o;if(e!==void 0)return{focusedIndex:e,focusedItem:i[e-u],focusedType:$.ListItem};const g=this.computedValue();if(s&&t)return{focusedItem:null,focusedIndex:-1,focusedType:$.CustomItem};if(t)return o=c(i,t,d),{focusedItem:i[o],focusedIndex:o+u,focusedType:$.ListItem};if(g.length){if(this.$props.selectAll){const v=g[g.length-1],I=i.findIndex(T=>f.areSame(T,v,n));return I!==-1?{focusedIndex:I+u,focusedItem:i[I],focusedType:$.ListItem}:u===0?{focusedItem:i[0],focusedIndex:0,focusedType:$.ListItem}:{focusedType:$.None,focusedIndex:-1}}const m=g[g.length-1];return o=i.findIndex(v=>f.areSame(v,m,n)),i[o]!==void 0?{focusedIndex:o+u,focusedItem:i[o],focusedType:$.ListItem}:{focusedType:$.None,focusedIndex:-1}}return u===0?{focusedItem:i[0],focusedIndex:0,focusedType:$.ListItem}:{focusedType:$.None,focusedIndex:-1}},customItemSelect(e){const t=this.$props.filter!==void 0?this.$props.filter:this.currentText,{textField:s}=this.$props;if(!t)return;const i=this.base.initState();i.event=e;const n=s?{[s]:t}:t;this.currentText!==void 0&&(i.data.currentText=""),i.data.currentFocusedIndex=void 0,this.base.filterChanged("",i);const a=[...this.computedValue(),n];this.triggerOnChange(a,i),this.base.togglePopup(i),this.applyState(i)},handleWrapperClick(e){const t=this.isOpen,s=this.input;!t&&s&&this.focusElement(s);const i=this.base.initState();i.event=e,this.currentFocused||(i.events.push({type:"focus"}),i.data.currentFocused=!0),this.base.togglePopup(i),this.applyState(i)},onCancel(e){const t=this.base.initState();t.event=e,e.stopPropagation();const s=this.isOpen;t.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),s&&this.base.togglePopup(t),t.events.push({type:"onCancel"}),this.clearFilter(t),this.triggerOnChange([...this.initialAdaptiveRenderingValues],t),this.base.triggerPageChangeCornerItems([...this.initialAdaptiveRenderingValues],t),this.applyState(t)},handleItemClick(e,t){const s=this.base.initState();s.event=t,this.handleItemSelect(e,s),this.$props.autoClose&&!this.$props.checkboxes&&!this.adaptiveState&&this.base.togglePopup(s),this.applyState(s)},handleBlur(e){if(!this.currentFocused||this._skipFocusEvent)return;const t=this.isOpen,s=this.base.initState(),{allowCustom:i,filterable:n}=this.$props;s.event=e,s.data.currentFocused=!1,s.data.currentSelectAllFocused=!1,s.events.push({type:"blur"}),t&&!this.adaptiveState&&(this.currentOpened&&(s.data.currentOpened=!1),s.events.push({type:"close"})),!i&&!n&&this.currentText&&(s.data.currentText=""),this.applyState(s)},handleFocus(e){this._skipFocusEvent||this.base.handleFocus(e)},onPopupOpened(){this.input&&this.currentFocused&&this.focusElement(this.input),this.measureStickyHeadersHeight()},onPopupClosed(){this.currentFocused&&setTimeout(()=>{this.currentFocused&&this.focusElement(this.input)},0),this.stickyHeadersHeight=0},measureStickyHeadersHeight(){let e=0;const t=document.getElementById(this.base.listBoxId),s=t==null?void 0:t.closest(".k-list");if(s){const i=s.querySelector(".k-list-sticky-header"),n=s.querySelector(".k-list-group-sticky-header");i&&(e+=i.offsetHeight),n&&(e+=n.offsetHeight)}this.stickyHeadersHeight=e},focusElement(e){this._skipFocusEvent=!0,e.focus(),setTimeout(()=>this._skipFocusEvent=!1,30)},applyState(e){this.base.applyState(e),this.valuesItemsDuringOnChange=null},setValidity(){this.input&&this.input.setCustomValidity&&this.input.setCustomValidity(this.validity().valid?"":this.$props.validationMessage||Ne)},focus(){this.input&&this.input.focus()},calculateMedia(e){for(let t of e)this.windowWidth=t.target.clientWidth},repositionPopup(){this.base.repositionPopup()},onScroll(e){var m;this.isScrolling=!0;const{vs:t,list:s}=this.base;t.scrollHandler(e);const i=this.base.initState(),{groupField:n}=this.$props;let{dataItems:a=[]}=this.$props,d;if(!n||!a.length)return;const c=s&&((m=s.querySelector(".k-list-item"))==null?void 0:m.offsetHeight)||0,u=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:c),g=e.target.scrollTop-t.skip*u;n&&(a=this.base.getGroupedDataModernMode(a,n),a=this.base.getGroupedDataModernMode(a,n),d=a[0][n]);for(let v=1;v<a.length&&!(u*v>g);v++)a[v]&&a[v][n]&&(d=a[v][n]);d!==this.group&&(i.data.group=d,this.applyState(i))},getSelectableItems(){return(this.$props.dataItems||[]).filter(t=>!(t!=null&&t.disabled))},areAllSelectableItemsSelected(){const e=this.getSelectableItems();if(e.length===0||!e.every(n=>this.computedValue().some(a=>f.areSame(a,n,this.$props.dataItemKey))))return!1;const{virtual:s,dataItemKey:i}=this.$props;return!(s&&s.total!==void 0&&(i?this.computedValue().filter(a=>(a==null?void 0:a[i])!==void 0).length:this.computedValue().length)<s.total)},areSomeSelectableItemsSelected(){return this.computedValue().length>0},handleSelectAllItemClick(e){e.stopPropagation(),this.toggleSelectAll(e)},handleSelectAllItemKeyDown(e){e.keyCode!==l.Keys.enter&&e.keyCode!==l.Keys.space||(e.preventDefault(),this.toggleSelectAll(e))},toggleSelectAll(e){if(this.$props.disabled)return;const t=this.areAllSelectableItemsSelected(),s=this.getSelectableItems();if(s.length===0)return;const i={event:e,target:this,allSelected:!t,defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(this.$emit("selectallchange",i),i.defaultPrevented)return;const n=this.base.initState();n.data.currentFocusedIndex=void 0;let a=[];t?a=this.computedValue().filter(d=>!s.some(c=>f.areSame(c,d,this.$props.dataItemKey))):(a=[...this.computedValue()],s.forEach(d=>{a.some(u=>f.areSame(u,d,this.$props.dataItemKey))||a.push(d)})),n.data.currentSelectAllFocused=!0,this.triggerOnChange(a,n),this.applyState(n)}},render(){const{style:e,label:t,dir:s,disabled:i,tags:n,textField:a,dataItemKey:d,virtual:c,loading:u,size:o,fillMode:g,rounded:m,tagsRounded:v,removeTagIcon:I,adaptiveTitle:T,header:A,footer:z,inputAttributes:Z,groupStickyHeaderItemRender:ee,dataItems:N=[]}=this.$props,te=this.currentFocused,O=Object.assign({},{animate:!0,height:"200px"},this.$props.popupSettings),D=this.currentFocusedTag,_=this.computedValue(),L=(this.$props.filter!==void 0?this.$props.filter:this.currentText)||"",se=!u&&(!!L||_.length>0),V=this.base.vs,M=this.$props.id||this.inputId,ie=l.templateRendering.call(this,this.$props.tagRender,l.getListeners.call(this)),H=this.isOpen,R=this.adaptiveState,w=Ve.provideLocalizationService(this);this.group===void 0&&this.$props.groupField!==void 0&&(this.group=f.getItemValue(this.$props.dataItems[0],this.$props.groupField)),V.enabled=c!==void 0,c!==void 0&&(V.skip=c.skip,V.total=c.total,V.pageSize=c.pageSize);let C=[];if(this.initialAdaptiveRenderingValues)[...this.initialAdaptiveRenderingValues].forEach(p=>{C.push({text:f.getItemValue(p,a),data:[p]})});else if(n===void 0){const{allowCustom:h,selectAll:p,dataItemKey:S}=this.$props;if(h&&p&&S){const b=this.computedValue(),k=b.filter(x=>x[S]!==void 0),F=b.filter(x=>x[S]===void 0);if(k.length>0){const x=w.toLanguageString(y.itemsSelectedText,y.messages[y.itemsSelectedText]).replace("{0}",k.length.toString());C.push({text:x,data:[...k]})}F.forEach(x=>{C.push({text:f.getItemValue(x,a),data:[x]})})}else this.computedValue().forEach(b=>{C.push({text:f.getItemValue(b,a),data:[b]})})}else C.push(...n);C.length>0&&this.setItems(C,this._tags);const ne=!this.$props.validityStyles||this.validity().valid,ae=function(h){const p=this.activedescendant,{placeholder:S}=this.$props,{focusedIndex:b}=this.getFocusedState(),k=C.length===0||_.length===0&&!L?S:void 0,F=p===K.ActiveDescendant.TagsList&&D!==void 0?`tag-${this.base.guid}-${D.text.replace(/\s+/g,"-")}`:`option-${this.base.guid}-${b}`;return r.createVNode(be.SearchBar,{id:h,size:Math.max((k||"").length,L.length,1),tabIndex:this.$props.tabIndex,accessKey:this.$props.accessKey,placeholder:k,value:R?"":L,onChange:this.onChangeHandler,onBlur:this.handleBlur,onKeydown:this.onInputKeyDown,ref:x=>{this.inputRef=x},disabled:i,expanded:H,owns:this.base.listBoxId,activedescendant:F,"aria-describedBy":`tagslist-${this.base.guid}${this.$props.ariaDescribedBy?" "+this.$props.ariaDescribedBy:""}`,"aria-labelledBy":this.$props.ariaLabelledBy,"aria-label":this.$props.ariaLabel,inputAttributes:Z},null)},le=()=>{const{checkboxes:h,selectAll:p}=this.$props;if(!p)return null;const S=this.areAllSelectableItemsSelected(),b=!S&&this.areSomeSelectableItemsSelected(),k=w.toLanguageString(y.selectAllText,y.messages[y.selectAllText]),F=this.currentSelectAllFocused;return r.createVNode("div",{class:"k-list-sticky-header"},[r.createVNode("div",r.mergeProps({class:l.classNames("k-list-sticky-header-item",{"k-selected":!h&&S,"k-focus":F}),"aria-label":k},!h&&{tabindex:0,"aria-selected":S},{onClick:this.handleSelectAllItemClick,onKeydown:this.handleSelectAllItemKeyDown}),[h&&r.createVNode(Ce.Checkbox,{checked:S,value:b?null:S,tabIndex:-1},null),r.createVNode("span",{class:"k-list-item-text"},[k])])])},j=function(){let h;const{groupField:p}=this.$props,S=l.templateRendering.call(this,this.$props.itemRender,l.getListeners.call(this)),b=l.templateRendering.call(this,this.$props.groupHeaderItemRender,l.getListeners.call(this)),k=l.templateRendering.call(this,this.$props.listNoDataRender,l.getListeners.call(this)),F=c?c.skip:0,{focusedIndex:x}=this.getFocusedState(),P=`translateY(${V.translate}px)`;let G=N;return p&&(G=this.base.getGroupedDataModernMode(N,p)),r.createVNode(Ie.List,{id:this.base.listBoxId,show:H,dataItems:G.slice(),focusedIndex:x,value:this.computedValue(),textField:a,valueField:d,optionsGuid:this.base.guid,ref:"list",wrapperStyle:{maxHeight:R?void 0:this.stickyHeadersHeight>0&&O.height?`calc(${O.height} - ${this.stickyHeadersHeight}px)`:O.height},wrapperCssClass:"k-list-content",listStyle:V.enabled?{transform:P}:void 0,key:"listKey",skip:F,onListclick:this.handleItemClick,itemRender:S,groupHeaderItemRender:b,noDataRender:k,groupField:p,onScroll:this.onScroll,showSelectionCheckbox:this.$props.checkboxes},B(h=oe.call(this))?h:{default:()=>[h]})},oe=function(){return V.enabled&&r.createVNode("div",{ref:"scrollElement",key:"scrollElementKey"},null)},re=function(){const h=this.base,{allowCustom:p}=this.$props,S=l.templateRendering.call(this,this.$props.groupStickyHeaderItemRender,l.getListeners.call(this)),b=h.getTemplateDef.call(this,A),k=h.getTemplateDef.call(this,z),F=this.$props.filter!==void 0?this.$props.filter:this.currentText,{focusedType:x}=this.getFocusedState(),P=p&&F&&r.createVNode("div",{class:l.classNames("k-list-custom-value",{"k-focus":X(x)}),key:"customitem",onClick:this.customItemSelect,onMousedown:J},[F]);return this.group===void 0&&this.$props.groupField!==void 0&&(this.group=f.getItemValue(N[0],this.$props.groupField)),r.createVNode(Se.ListContainer,{ref:"container",onMousedown:J,dir:s!==void 0?s:h.dirCalculated,onBlur:this.handleBlur,width:this.popupWidth,popupSettings:{...O,anchor:this.anchor,show:H,onOpen:this.onPopupOpened,onClose:this.onPopupClosed,popupClass:l.classNames(O.popupClass,"k-list",{[`k-list-${q[o]||o}`]:o,"k-virtual-list":this.base.vs.enabled}),className:l.classNames("k-list-container",O.className)},itemsCount:N.length},{default:()=>[b&&r.createVNode("div",{class:"k-list-header"},[b]),le.call(this),this.group&&N.length!==0&&r.createVNode(U.GroupStickyHeader,{group:this.group,render:S},null),P,j.call(this),k&&r.createVNode("div",{class:"k-list-footer"},[k]),c&&A]})},de=function(){const h=this.$props.filter!==void 0?this.$props.filter:this.currentText;return this.$props.filterable&&r.createVNode(Te.ListFilter,{value:h,ref:"filterInput",onChange:this.onChangeHandler,onKeydown:this.onInputKeyDown,size:o,rounded:m,fillMode:g},null)},ce=()=>[r.createVNode("div",{class:"k-actionsheet-titlebar-group k-hbox"},[r.createVNode("div",{class:"k-actionsheet-title"},[r.createVNode("div",{class:"k-text-center"},[T]),r.createVNode("div",{class:"k-actionsheet-subtitle k-text-center"},null)]),r.createVNode("div",{class:"k-actionsheet-actions"},[r.createVNode(E.Button,{tabIndex:5,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",onClick:this.onCancel,icon:"x",svgIcon:$e.xIcon},null)])]),r.createVNode("div",{class:"k-actionsheet-titlebar-group k-actionsheet-filter"},[de.call(this)])],ue=l.templateRendering.call(this,ce,l.getListeners.call(this)),he=()=>{const h=w.toLanguageString(y.adaptiveModeFooterCancel,y.messages[y.adaptiveModeFooterCancel]),p=w.toLanguageString(y.adaptiveModeFooterApply,y.messages[y.adaptiveModeFooterApply]);return[r.createVNode(E.Button,{size:"large","aria-label":h,"aria-disabled":"false",type:"button",onClick:this.onCancel},B(h)?h:{default:()=>[h]}),r.createVNode(E.Button,{themeColor:"primary",size:"large","aria-label":p,"aria-disabled":"false",type:"button",onClick:this.handleWrapperClick},B(p)?p:{default:()=>[p]})]},pe=l.templateRendering.call(this,he,l.getListeners.call(this)),fe=()=>{const h=this.base.getTemplateDef.call(this,A,r.h),p=this.base.getTemplateDef.call(this,z,r.h),S=l.templateRendering.call(this,ee,l.getListeners.call(this));return r.createVNode("div",{class:"k-list-container"},[h&&r.createVNode("div",{class:"k-list-header"},[h]),r.createVNode("div",{class:l.classNames("k-list",{[`k-list-${q[o]||o}`]:R?!1:o,"k-list-lg":!!R,"k-virtual-list":V.enabled})},[this.group&&N.length!==0&&r.createVNode(U.GroupStickyHeader,{group:this.group,render:S},null),j.call(this),p&&r.createVNode("div",{class:"k-list-footer"},[p])])])},ge=l.templateRendering.call(this,fe,l.getListeners.call(this)),me=function(){return r.createVNode(Fe.ActionSheet,{expand:H,animation:!0,animationStyles:this.animationStyles,className:this.classNameAdaptive,contentClassName:"!k-overflow-hidden",footerClassName:"k-actions k-actions-stretched",header:ue,content:ge,footer:pe,onClose:this.onCancel,navigatableElements:["input.k-input-inner",".k-actionsheet-actions > button"]},null)},ve=function(){let h;return r.createVNode("span",{ref:l.setRef(this,"kendoAnchor"),class:l.classNames("k-multiselect","k-input",{[`k-input-${q[o]||o}`]:o,[`k-rounded-${Ae[m]||m}`]:m,[`k-input-${g}`]:g,"k-focus":te&&!i,"k-disabled":i,"k-invalid":!ne,"k-loading":u,"k-required":this.required}),style:t?{...e,width:void 0}:e,dir:s,onFocusin:this.handleFocus,onClick:this.handleWrapperClick,onMousedown:f.preventDefaultNonInputs},[r.createVNode(ye.TagList,{removeTagIcon:I,tagsRounded:v,size:o,fillMode:g,tagRender:ie,onTagdelete:this.onTagDelete,dataItems:C,guid:this.base.guid,summarizeAfter:this.$props.summarizeAfter,summaryText:this.$props.summarizeAfter&&C.length>this.$props.summarizeAfter?w.toLanguageString(y.summaryTagText,y.messages[y.summaryTagText]).replace("{0}",(C.length-this.$props.summarizeAfter).toString()):void 0,focused:D?C.find(p=>Q(p,D,d)):void 0},B(h=ae.call(this,M))?h:{default:()=>[h]}),C.length>0&&se&&r.createVNode(xe.ClearButton,{onClearclick:this.clearButtonClick},null),r.createVNode("span",{class:u?"k-input-loading-icon k-icon k-i-loading":void 0},null),!R&&re.call(this)])},W=[r.h(ve.call(this),{...this.$attrs}),R&&me.call(this)];return t?r.createVNode("span",{class:this.spanClassNames,dir:this.$props.dir},[W,this.$props.label?M?r.createVNode("label",{for:M,class:"k-floating-label"},[this.$props.label]):r.createVNode("span",{class:"k-label"},[this.$props.label]):null]):W}});exports.MultiSelect=Oe;