primevue
Version:
PrimeVue is an open source UI library for Vue featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBloc
2 lines (1 loc) • 33.9 kB
JavaScript
"use strict";var e=require("primevue/api"),t=require("primevue/icons/chevrondown"),i=require("primevue/icons/filter"),n=require("primevue/icons/spinner"),o=require("primevue/icons/times"),r=require("primevue/overlayeventbus"),l=require("primevue/portal"),s=require("primevue/ripple"),a=require("primevue/utils"),c=require("primevue/virtualscroller"),u=require("primevue/basecomponent"),d=require("primevue/dropdown/style"),p=require("vue");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=h(t),b=h(i),y=h(n),v=h(o),m=h(r),O=h(l),g=h(s),I=h(c);function x(e){return x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x(e)}function S(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function k(e,t){if(e){if("string"==typeof e)return L(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?L(e,t):void 0}}function w(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function V(e){if(Array.isArray(e))return L(e)}function L(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function F(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function C(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?F(Object(i),!0).forEach((function(t){D(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):F(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function D(e,t,i){var n;return(t="symbol"==x(n=E(t,"string"))?n:String(n))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function E(e,t){if("object"!=x(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=x(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var P={name:"Dropdown",extends:{name:"BaseDropdown",extends:h(u).default,props:{modelValue:null,options:Array,optionLabel:[String,Function],optionValue:[String,Function],optionDisabled:[String,Function],optionGroupLabel:[String,Function],optionGroupChildren:[String,Function],scrollHeight:{type:String,default:"200px"},filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},editable:Boolean,placeholder:{type:String,default:null},disabled:{type:Boolean,default:!1},dataKey:null,showClear:{type:Boolean,default:!1},inputId:{type:String,default:null},inputClass:{type:[String,Object],default:null},inputStyle:{type:Object,default:null},inputProps:{type:null,default:null},panelClass:{type:[String,Object],default:null},panelStyle:{type:Object,default:null},panelProps:{type:null,default:null},filterInputProps:{type:null,default:null},clearIconProps:{type:null,default:null},appendTo:{type:String,default:"body"},loading:{type:Boolean,default:!1},clearIcon:{type:String,default:void 0},dropdownIcon:{type:String,default:void 0},filterIcon:{type:String,default:void 0},loadingIcon:{type:String,default:void 0},resetFilterOnHide:{type:Boolean,default:!1},virtualScrollerOptions:{type:Object,default:null},autoOptionFocus:{type:Boolean,default:!0},autoFilterFocus:{type:Boolean,default:!1},selectOnFocus:{type:Boolean,default:!1},filterMessage:{type:String,default:null},selectionMessage:{type:String,default:null},emptySelectionMessage:{type:String,default:null},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},tabindex:{type:Number,default:0},ariaLabel:{type:String,default:null},ariaLabelledby:{type:String,default:null}},style:h(d).default,provide:function(){return{$parentInstance:this}}},emits:["update:modelValue","change","focus","blur","before-show","before-hide","show","hide","filter"],outsideClickListener:null,scrollHandler:null,resizeListener:null,labelClickListener:null,overlay:null,list:null,virtualScroller:null,searchTimeout:null,searchValue:null,isModelValueChanged:!1,focusOnHover:!1,data:function(){return{id:this.$attrs.id,focused:!1,focusedOptionIndex:-1,filterValue:null,overlayVisible:!1}},watch:{"$attrs.id":function(e){this.id=e||a.UniqueComponentId()},modelValue:function(){this.isModelValueChanged=!0},options:function(){this.autoUpdateModel()}},mounted:function(){this.id=this.id||a.UniqueComponentId(),this.autoUpdateModel(),this.bindLabelClickListener()},updated:function(){this.overlayVisible&&this.isModelValueChanged&&this.scrollInView(this.findSelectedOptionIndex()),this.isModelValueChanged=!1},beforeUnmount:function(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.unbindLabelClickListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.overlay&&(a.ZIndexUtils.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex:function(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel:function(e){return this.optionLabel?a.ObjectUtils.resolveFieldData(e,this.optionLabel):e},getOptionValue:function(e){return this.optionValue?a.ObjectUtils.resolveFieldData(e,this.optionValue):e},getOptionRenderKey:function(e,t){return(this.dataKey?a.ObjectUtils.resolveFieldData(e,this.dataKey):this.getOptionLabel(e))+"_"+t},getPTItemOptions:function(e,t,i,n){return this.ptm(n,{context:{selected:this.isSelected(e),focused:this.focusedOptionIndex===this.getOptionIndex(i,t),disabled:this.isOptionDisabled(e)}})},isOptionDisabled:function(e){return!!this.optionDisabled&&a.ObjectUtils.resolveFieldData(e,this.optionDisabled)},isOptionGroup:function(e){return this.optionGroupLabel&&e.optionGroup&&e.group},getOptionGroupLabel:function(e){return a.ObjectUtils.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren:function(e){return a.ObjectUtils.resolveFieldData(e,this.optionGroupChildren)},getAriaPosInset:function(e){var t=this;return(this.optionGroupLabel?e-this.visibleOptions.slice(0,e).filter((function(e){return t.isOptionGroup(e)})).length:e)+1},show:function(e){this.$emit("before-show"),this.overlayVisible=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,e&&a.DomHandler.focus(this.$refs.focusInput)},hide:function(e){var t=this;setTimeout((function(){t.$emit("before-hide"),t.overlayVisible=!1,t.focusedOptionIndex=-1,t.searchValue="",t.resetFilterOnHide&&(t.filterValue=null),e&&a.DomHandler.focus(t.$refs.focusInput)}),0)},onFocus:function(e){this.disabled||(this.focused=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.overlayVisible&&this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.overlayVisible&&this.scrollInView(this.focusedOptionIndex),this.$emit("focus",e))},onBlur:function(e){this.focused=!1,this.focusedOptionIndex=-1,this.searchValue="",this.$emit("blur",e)},onKeyDown:function(e){if(this.disabled||a.DomHandler.isAndroid())e.preventDefault();else{var t=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e,this.editable);break;case"ArrowLeft":case"ArrowRight":this.onArrowLeftKey(e,this.editable);break;case"Delete":this.onDeleteKey(e);case"Home":this.onHomeKey(e,this.editable);break;case"End":this.onEndKey(e,this.editable);break;case"PageDown":this.onPageDownKey(e);break;case"PageUp":this.onPageUpKey(e);break;case"Space":this.onSpaceKey(e,this.editable);break;case"Enter":case"NumpadEnter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"Backspace":this.onBackspaceKey(e,this.editable);break;case"ShiftLeft":case"ShiftRight":break;default:!t&&a.ObjectUtils.isPrintableCharacter(e.key)&&(!this.overlayVisible&&this.show(),!this.editable&&this.searchOptions(e,e.key))}}},onEditableInput:function(e){var t=e.target.value;this.searchValue="",!this.searchOptions(e,t)&&(this.focusedOptionIndex=-1),this.updateModel(e,t),!this.overlayVisible&&a.ObjectUtils.isNotEmpty(t)&&this.show()},onContainerClick:function(e){this.disabled||this.loading||"INPUT"===e.target.tagName||"clearicon"===e.target.getAttribute("data-pc-section")||e.target.closest('[data-pc-section="clearicon"]')||this.overlay&&this.overlay.contains(e.target)||(this.overlayVisible?this.hide(!0):this.show(!0))},onClearClick:function(e){this.updateModel(e,null)},onFirstHiddenFocus:function(e){var t=e.relatedTarget===this.$refs.focusInput?a.DomHandler.getFirstFocusableElement(this.overlay,':not([data-p-hidden-focusable="true"])'):this.$refs.focusInput;a.DomHandler.focus(t)},onLastHiddenFocus:function(e){var t=e.relatedTarget===this.$refs.focusInput?a.DomHandler.getLastFocusableElement(this.overlay,':not([data-p-hidden-focusable="true"])'):this.$refs.focusInput;a.DomHandler.focus(t)},onOptionSelect:function(e,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=this.getOptionValue(t);this.updateModel(e,n),i&&this.hide(!0)},onOptionMouseMove:function(e,t){this.focusOnHover&&this.changeFocusedOptionIndex(e,t)},onFilterChange:function(e){var t=e.target.value;this.filterValue=t,this.focusedOptionIndex=-1,this.$emit("filter",{originalEvent:e,value:t}),!this.virtualScrollerDisabled&&this.virtualScroller.scrollToIndex(0)},onFilterKeyDown:function(e){switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e,!0);break;case"ArrowLeft":case"ArrowRight":this.onArrowLeftKey(e,!0);break;case"Home":this.onHomeKey(e,!0);break;case"End":this.onEndKey(e,!0);break;case"Enter":case"NumpadEnter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e,!0)}},onFilterBlur:function(){this.focusedOptionIndex=-1},onFilterUpdated:function(){this.overlayVisible&&this.alignOverlay()},onOverlayClick:function(e){m.default.emit("overlay-click",{originalEvent:e,target:this.$el})},onOverlayKeyDown:function(e){if("Escape"===e.code)this.onEscapeKey(e)},onDeleteKey:function(e){this.showClear&&(this.updateModel(e,null),e.preventDefault())},onArrowDownKey:function(e){var t=-1!==this.focusedOptionIndex?this.findNextOptionIndex(this.focusedOptionIndex):this.findFirstFocusedOptionIndex();this.changeFocusedOptionIndex(e,t),!this.overlayVisible&&this.show(),e.preventDefault()},onArrowUpKey:function(e){if(e.altKey&&!(arguments.length>1&&void 0!==arguments[1]&&arguments[1]))-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide(),e.preventDefault();else{var t=-1!==this.focusedOptionIndex?this.findPrevOptionIndex(this.focusedOptionIndex):this.findLastFocusedOptionIndex();this.changeFocusedOptionIndex(e,t),!this.overlayVisible&&this.show(),e.preventDefault()}},onArrowLeftKey:function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(this.focusedOptionIndex=-1)},onHomeKey:function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]?(e.currentTarget.setSelectionRange(0,0),this.focusedOptionIndex=-1):(this.changeFocusedOptionIndex(e,this.findFirstOptionIndex()),!this.overlayVisible&&this.show()),e.preventDefault()},onEndKey:function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){var t=e.currentTarget,i=t.value.length;t.setSelectionRange(i,i),this.focusedOptionIndex=-1}else this.changeFocusedOptionIndex(e,this.findLastOptionIndex()),!this.overlayVisible&&this.show();e.preventDefault()},onPageUpKey:function(e){this.scrollInView(0),e.preventDefault()},onPageDownKey:function(e){this.scrollInView(this.visibleOptions.length-1),e.preventDefault()},onEnterKey:function(e){this.overlayVisible?(-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.hide()):this.onArrowDownKey(e),e.preventDefault()},onSpaceKey:function(e){!(arguments.length>1&&void 0!==arguments[1]&&arguments[1])&&this.onEnterKey(e)},onEscapeKey:function(e){this.overlayVisible&&this.hide(!0),e.preventDefault()},onTabKey:function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]||(this.overlayVisible&&this.hasFocusableElements()?(a.DomHandler.focus(this.$refs.firstHiddenFocusableElementOnOverlay),e.preventDefault()):(-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide(this.filter)))},onBackspaceKey:function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&!this.overlayVisible&&this.show()},onOverlayEnter:function(e){a.ZIndexUtils.set("overlay",e,this.$primevue.config.zIndex.overlay),a.DomHandler.addStyles(e,{position:"absolute",top:"0",left:"0"}),this.alignOverlay(),this.scrollInView(),this.autoFilterFocus&&a.DomHandler.focus(this.$refs.filterInput)},onOverlayAfterEnter:function(){this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.$emit("show")},onOverlayLeave:function(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.overlay=null},onOverlayAfterLeave:function(e){a.ZIndexUtils.clear(e)},alignOverlay:function(){"self"===this.appendTo?a.DomHandler.relativePosition(this.overlay,this.$el):(this.overlay.style.minWidth=a.DomHandler.getOuterWidth(this.$el)+"px",a.DomHandler.absolutePosition(this.overlay,this.$el))},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){e.overlayVisible&&e.overlay&&!e.$el.contains(t.target)&&!e.overlay.contains(t.target)&&e.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener:function(){var e=this;this.scrollHandler||(this.scrollHandler=new a.ConnectedOverlayScrollHandler(this.$refs.container,(function(){e.overlayVisible&&e.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.overlayVisible&&!a.DomHandler.isTouchDevice()&&e.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},bindLabelClickListener:function(){var e=this;if(!this.editable&&!this.labelClickListener){var t=document.querySelector('label[for="'.concat(this.inputId,'"]'));t&&a.DomHandler.isVisible(t)&&(this.labelClickListener=function(){a.DomHandler.focus(e.$refs.focusInput)},t.addEventListener("click",this.labelClickListener))}},unbindLabelClickListener:function(){if(this.labelClickListener){var e=document.querySelector('label[for="'.concat(this.inputId,'"]'));e&&a.DomHandler.isVisible(e)&&e.removeEventListener("click",this.labelClickListener)}},hasFocusableElements:function(){return a.DomHandler.getFocusableElements(this.overlay,':not([data-p-hidden-focusable="true"])').length>0},isOptionMatched:function(e){return this.isValidOption(e)&&this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},isValidOption:function(e){return a.ObjectUtils.isNotEmpty(e)&&!(this.isOptionDisabled(e)||this.isOptionGroup(e))},isValidSelectedOption:function(e){return this.isValidOption(e)&&this.isSelected(e)},isSelected:function(e){return this.isValidOption(e)&&a.ObjectUtils.equals(this.modelValue,this.getOptionValue(e),this.equalityKey)},findFirstOptionIndex:function(){var e=this;return this.visibleOptions.findIndex((function(t){return e.isValidOption(t)}))},findLastOptionIndex:function(){var e=this;return a.ObjectUtils.findLastIndex(this.visibleOptions,(function(t){return e.isValidOption(t)}))},findNextOptionIndex:function(e){var t=this,i=e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((function(e){return t.isValidOption(e)})):-1;return i>-1?i+e+1:e},findPrevOptionIndex:function(e){var t=this,i=e>0?a.ObjectUtils.findLastIndex(this.visibleOptions.slice(0,e),(function(e){return t.isValidOption(e)})):-1;return i>-1?i:e},findSelectedOptionIndex:function(){var e=this;return this.hasSelectedOption?this.visibleOptions.findIndex((function(t){return e.isValidSelectedOption(t)})):-1},findFirstFocusedOptionIndex:function(){var e=this.findSelectedOptionIndex();return e<0?this.findFirstOptionIndex():e},findLastFocusedOptionIndex:function(){var e=this.findSelectedOptionIndex();return e<0?this.findLastOptionIndex():e},searchOptions:function(e,t){var i=this;this.searchValue=(this.searchValue||"")+t;var n=-1,o=!1;return-1!==(n=-1!==this.focusedOptionIndex?-1===(n=this.visibleOptions.slice(this.focusedOptionIndex).findIndex((function(e){return i.isOptionMatched(e)})))?this.visibleOptions.slice(0,this.focusedOptionIndex).findIndex((function(e){return i.isOptionMatched(e)})):n+this.focusedOptionIndex:this.visibleOptions.findIndex((function(e){return i.isOptionMatched(e)})))&&(o=!0),-1===n&&-1===this.focusedOptionIndex&&(n=this.findFirstFocusedOptionIndex()),-1!==n&&this.changeFocusedOptionIndex(e,n),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((function(){i.searchValue="",i.searchTimeout=null}),500),o},changeFocusedOptionIndex:function(e,t){this.focusedOptionIndex!==t&&(this.focusedOptionIndex=t,this.scrollInView(),this.selectOnFocus&&this.onOptionSelect(e,this.visibleOptions[t],!1))},scrollInView:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,i=-1!==t?"".concat(this.id,"_").concat(t):this.focusedOptionId,n=a.DomHandler.findSingle(this.list,'li[id="'.concat(i,'"]'));n?n.scrollIntoView&&n.scrollIntoView({block:"nearest",inline:"start"}):this.virtualScrollerDisabled||setTimeout((function(){e.virtualScroller&&e.virtualScroller.scrollToIndex(-1!==t?t:e.focusedOptionIndex)}),0)},autoUpdateModel:function(){this.selectOnFocus&&this.autoOptionFocus&&!this.hasSelectedOption&&(this.focusedOptionIndex=this.findFirstFocusedOptionIndex(),this.onOptionSelect(null,this.visibleOptions[this.focusedOptionIndex],!1))},updateModel:function(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},flatOptions:function(e){var t=this;return(e||[]).reduce((function(e,i,n){e.push({optionGroup:i,group:!0,index:n});var o=t.getOptionGroupChildren(i);return o&&o.forEach((function(t){return e.push(t)})),e}),[])},overlayRef:function(e){this.overlay=e},listRef:function(e,t){this.list=e,t&&t(e)},virtualScrollerRef:function(e){this.virtualScroller=e}},computed:{visibleOptions:function(){var t=this,i=this.optionGroupLabel?this.flatOptions(this.options):this.options||[];if(this.filterValue){var n=e.FilterService.filter(i,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);if(this.optionGroupLabel){var o=[];return(this.options||[]).forEach((function(e){var i,r=t.getOptionGroupChildren(e).filter((function(e){return n.includes(e)}));r.length>0&&o.push(C(C({},e),{},D({},"string"==typeof t.optionGroupChildren?t.optionGroupChildren:"items",V(i=r)||w(i)||k(i)||S())))})),this.flatOptions(o)}return n}return i},hasSelectedOption:function(){return a.ObjectUtils.isNotEmpty(this.modelValue)},label:function(){var e=this.findSelectedOptionIndex();return-1!==e?this.getOptionLabel(this.visibleOptions[e]):this.placeholder||"p-emptylabel"},editableInputValue:function(){var e=this.findSelectedOptionIndex();return-1!==e?this.getOptionLabel(this.visibleOptions[e]):this.modelValue||""},equalityKey:function(){return this.optionValue?null:this.dataKey},searchFields:function(){return this.filterFields||[this.optionLabel]},filterResultMessageText:function(){return a.ObjectUtils.isNotEmpty(this.visibleOptions)?this.filterMessageText.replaceAll("{0}",this.visibleOptions.length):this.emptyFilterMessageText},filterMessageText:function(){return this.filterMessage||this.$primevue.config.locale.searchMessage||""},emptyFilterMessageText:function(){return this.emptyFilterMessage||this.$primevue.config.locale.emptySearchMessage||this.$primevue.config.locale.emptyFilterMessage||""},emptyMessageText:function(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage||""},selectionMessageText:function(){return this.selectionMessage||this.$primevue.config.locale.selectionMessage||""},emptySelectionMessageText:function(){return this.emptySelectionMessage||this.$primevue.config.locale.emptySelectionMessage||""},selectedMessageText:function(){return this.hasSelectedOption?this.selectionMessageText.replaceAll("{0}","1"):this.emptySelectionMessageText},focusedOptionId:function(){return-1!==this.focusedOptionIndex?"".concat(this.id,"_").concat(this.focusedOptionIndex):null},ariaSetSize:function(){var e=this;return this.visibleOptions.filter((function(t){return!e.isOptionGroup(t)})).length},virtualScrollerDisabled:function(){return!this.virtualScrollerOptions}},directives:{ripple:g.default},components:{VirtualScroller:I.default,Portal:O.default,TimesIcon:v.default,ChevronDownIcon:f.default,SpinnerIcon:y.default,FilterIcon:b.default}};function M(e){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},M(e)}function K(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function B(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?K(Object(i),!0).forEach((function(t){T(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):K(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function T(e,t,i){var n;return(t="symbol"==M(n=j(t,"string"))?n:String(n))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function j(e,t){if("object"!=M(e)||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=M(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var H=["id"],$=["id","value","placeholder","tabindex","disabled","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant"],A=["id","tabindex","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant","aria-disabled"],U=["value","placeholder","aria-owns","aria-activedescendant"],N=["id"],G=["id"],z=["id","aria-label","aria-selected","aria-disabled","aria-setsize","aria-posinset","onClick","onMousemove","data-p-highlight","data-p-focused","data-p-disabled"];P.render=function(e,t,i,n,o,r){var l=p.resolveComponent("SpinnerIcon"),s=p.resolveComponent("VirtualScroller"),a=p.resolveComponent("Portal"),c=p.resolveDirective("ripple");return p.openBlock(),p.createElementBlock("div",p.mergeProps({ref:"container",id:o.id,class:e.cx("root"),onClick:t[15]||(t[15]=function(){return r.onContainerClick&&r.onContainerClick.apply(r,arguments)})},e.ptm("root"),{"data-pc-name":"dropdown"}),[e.editable?(p.openBlock(),p.createElementBlock("input",p.mergeProps({key:0,ref:"focusInput",id:e.inputId,type:"text",class:[e.cx("input"),e.inputClass],style:e.inputStyle,value:r.editableInputValue,placeholder:e.placeholder,tabindex:e.disabled?-1:e.tabindex,disabled:e.disabled,autocomplete:"off",role:"combobox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-expanded":o.overlayVisible,"aria-controls":o.id+"_list","aria-activedescendant":o.focused?r.focusedOptionId:void 0,onFocus:t[0]||(t[0]=function(){return r.onFocus&&r.onFocus.apply(r,arguments)}),onBlur:t[1]||(t[1]=function(){return r.onBlur&&r.onBlur.apply(r,arguments)}),onKeydown:t[2]||(t[2]=function(){return r.onKeyDown&&r.onKeyDown.apply(r,arguments)}),onInput:t[3]||(t[3]=function(){return r.onEditableInput&&r.onEditableInput.apply(r,arguments)})},B(B({},e.inputProps),e.ptm("input"))),null,16,$)):(p.openBlock(),p.createElementBlock("span",p.mergeProps({key:1,ref:"focusInput",id:e.inputId,class:[e.cx("input"),e.inputClass],style:e.inputStyle,tabindex:e.disabled?-1:e.tabindex,role:"combobox","aria-label":e.ariaLabel||("p-emptylabel"===r.label?void 0:r.label),"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-expanded":o.overlayVisible,"aria-controls":o.id+"_list","aria-activedescendant":o.focused?r.focusedOptionId:void 0,"aria-disabled":e.disabled,onFocus:t[4]||(t[4]=function(){return r.onFocus&&r.onFocus.apply(r,arguments)}),onBlur:t[5]||(t[5]=function(){return r.onBlur&&r.onBlur.apply(r,arguments)}),onKeydown:t[6]||(t[6]=function(){return r.onKeyDown&&r.onKeyDown.apply(r,arguments)})},B(B({},e.inputProps),e.ptm("input"))),[p.renderSlot(e.$slots,"value",{value:e.modelValue,placeholder:e.placeholder},(function(){return[p.createTextVNode(p.toDisplayString("p-emptylabel"===r.label?" ":r.label||"empty"),1)]}))],16,A)),e.showClear&&null!=e.modelValue?p.renderSlot(e.$slots,"clearicon",{key:2,class:p.normalizeClass(e.cx("clearIcon")),onClick:r.onClearClick,clearCallback:r.onClearClick},(function(){return[(p.openBlock(),p.createBlock(p.resolveDynamicComponent(e.clearIcon?"i":"TimesIcon"),p.mergeProps({ref:"clearIcon",class:[e.cx("clearIcon"),e.clearIcon],onClick:r.onClearClick},B(B({},e.clearIconProps),e.ptm("clearIcon")),{"data-pc-section":"clearicon"}),null,16,["class","onClick"]))]})):p.createCommentVNode("",!0),p.createElementVNode("div",p.mergeProps({class:e.cx("trigger")},e.ptm("trigger")),[e.loading?p.renderSlot(e.$slots,"loadingicon",{key:0,class:p.normalizeClass(e.cx("loadingIcon"))},(function(){return[e.loadingIcon?(p.openBlock(),p.createElementBlock("span",p.mergeProps({key:0,class:[e.cx("loadingIcon"),"pi-spin",e.loadingIcon],"aria-hidden":"true"},e.ptm("loadingIcon")),null,16)):(p.openBlock(),p.createBlock(l,p.mergeProps({key:1,class:e.cx("loadingIcon"),spin:"","aria-hidden":"true"},e.ptm("loadingIcon")),null,16,["class"]))]})):p.renderSlot(e.$slots,"dropdownicon",{key:1,class:p.normalizeClass(e.cx("dropdownIcon"))},(function(){return[(p.openBlock(),p.createBlock(p.resolveDynamicComponent(e.dropdownIcon?"span":"ChevronDownIcon"),p.mergeProps({class:[e.cx("dropdownIcon"),e.dropdownIcon],"aria-hidden":"true"},e.ptm("dropdownIcon")),null,16,["class"]))]}))],16),p.createVNode(a,{appendTo:e.appendTo},{default:p.withCtx((function(){return[p.createVNode(p.Transition,p.mergeProps({name:"p-connected-overlay",onEnter:r.onOverlayEnter,onAfterEnter:r.onOverlayAfterEnter,onLeave:r.onOverlayLeave,onAfterLeave:r.onOverlayAfterLeave},e.ptm("transition")),{default:p.withCtx((function(){return[o.overlayVisible?(p.openBlock(),p.createElementBlock("div",p.mergeProps({key:0,ref:r.overlayRef,class:[e.cx("panel"),e.panelClass],style:e.panelStyle,onClick:t[13]||(t[13]=function(){return r.onOverlayClick&&r.onOverlayClick.apply(r,arguments)}),onKeydown:t[14]||(t[14]=function(){return r.onOverlayKeyDown&&r.onOverlayKeyDown.apply(r,arguments)})},B(B({},e.panelProps),e.ptm("panel"))),[p.createElementVNode("span",p.mergeProps({ref:"firstHiddenFocusableElementOnOverlay",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:0,onFocus:t[7]||(t[7]=function(){return r.onFirstHiddenFocus&&r.onFirstHiddenFocus.apply(r,arguments)})},e.ptm("hiddenFirstFocusableEl"),{"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0}),null,16),p.renderSlot(e.$slots,"header",{value:e.modelValue,options:r.visibleOptions}),e.filter?(p.openBlock(),p.createElementBlock("div",p.mergeProps({key:0,class:e.cx("header")},e.ptm("header")),[p.createElementVNode("div",p.mergeProps({class:e.cx("filterContainer")},e.ptm("filterContainer")),[p.createElementVNode("input",p.mergeProps({ref:"filterInput",type:"text",value:o.filterValue,onVnodeMounted:t[8]||(t[8]=function(){return r.onFilterUpdated&&r.onFilterUpdated.apply(r,arguments)}),class:e.cx("filterInput"),placeholder:e.filterPlaceholder,role:"searchbox",autocomplete:"off","aria-owns":o.id+"_list","aria-activedescendant":r.focusedOptionId,onKeydown:t[9]||(t[9]=function(){return r.onFilterKeyDown&&r.onFilterKeyDown.apply(r,arguments)}),onBlur:t[10]||(t[10]=function(){return r.onFilterBlur&&r.onFilterBlur.apply(r,arguments)}),onInput:t[11]||(t[11]=function(){return r.onFilterChange&&r.onFilterChange.apply(r,arguments)})},B(B({},e.filterInputProps),e.ptm("filterInput"))),null,16,U),p.renderSlot(e.$slots,"filtericon",{class:p.normalizeClass(e.cx("filterIcon"))},(function(){return[(p.openBlock(),p.createBlock(p.resolveDynamicComponent(e.filterIcon?"span":"FilterIcon"),p.mergeProps({class:[e.cx("filterIcon"),e.filterIcon]},e.ptm("filterIcon")),null,16,["class"]))]}))],16),p.createElementVNode("span",p.mergeProps({role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenFilterResult"),{"data-p-hidden-accessible":!0}),p.toDisplayString(r.filterResultMessageText),17)],16)):p.createCommentVNode("",!0),p.createElementVNode("div",p.mergeProps({class:e.cx("wrapper"),style:{"max-height":r.virtualScrollerDisabled?e.scrollHeight:""}},e.ptm("wrapper")),[p.createVNode(s,p.mergeProps({ref:r.virtualScrollerRef},e.virtualScrollerOptions,{items:r.visibleOptions,style:{height:e.scrollHeight},tabindex:-1,disabled:r.virtualScrollerDisabled,pt:e.ptm("virtualScroller")}),p.createSlots({content:p.withCtx((function(t){var i=t.styleClass,n=t.contentRef,l=t.items,s=t.getItemOptions,a=t.contentStyle,u=t.itemSize;return[p.createElementVNode("ul",p.mergeProps({ref:function(e){return r.listRef(e,n)},id:o.id+"_list",class:[e.cx("list"),i],style:a,role:"listbox"},e.ptm("list")),[(p.openBlock(!0),p.createElementBlock(p.Fragment,null,p.renderList(l,(function(t,i){return p.openBlock(),p.createElementBlock(p.Fragment,{key:r.getOptionRenderKey(t,r.getOptionIndex(i,s))},[r.isOptionGroup(t)?(p.openBlock(),p.createElementBlock("li",p.mergeProps({key:0,id:o.id+"_"+r.getOptionIndex(i,s),style:{height:u?u+"px":void 0},class:e.cx("itemGroup"),role:"option"},e.ptm("itemGroup")),[p.renderSlot(e.$slots,"optiongroup",{option:t.optionGroup,index:r.getOptionIndex(i,s)},(function(){return[p.createTextVNode(p.toDisplayString(r.getOptionGroupLabel(t.optionGroup)),1)]}))],16,G)):p.withDirectives((p.openBlock(),p.createElementBlock("li",p.mergeProps({key:1,id:o.id+"_"+r.getOptionIndex(i,s),class:e.cx("item",{option:t,focusedOption:r.getOptionIndex(i,s)}),style:{height:u?u+"px":void 0},role:"option","aria-label":r.getOptionLabel(t),"aria-selected":r.isSelected(t),"aria-disabled":r.isOptionDisabled(t),"aria-setsize":r.ariaSetSize,"aria-posinset":r.getAriaPosInset(r.getOptionIndex(i,s)),onClick:function(e){return r.onOptionSelect(e,t)},onMousemove:function(e){return r.onOptionMouseMove(e,r.getOptionIndex(i,s))},"data-p-highlight":r.isSelected(t),"data-p-focused":o.focusedOptionIndex===r.getOptionIndex(i,s),"data-p-disabled":r.isOptionDisabled(t)},r.getPTItemOptions(t,s,i,"item")),[p.renderSlot(e.$slots,"option",{option:t,index:r.getOptionIndex(i,s)},(function(){return[p.createTextVNode(p.toDisplayString(r.getOptionLabel(t)),1)]}))],16,z)),[[c]])],64)})),128)),o.filterValue&&(!l||l&&0===l.length)?(p.openBlock(),p.createElementBlock("li",p.mergeProps({key:0,class:e.cx("emptyMessage"),role:"option"},e.ptm("emptyMessage"),{"data-p-hidden-accessible":!0}),[p.renderSlot(e.$slots,"emptyfilter",{},(function(){return[p.createTextVNode(p.toDisplayString(r.emptyFilterMessageText),1)]}))],16)):!e.options||e.options&&0===e.options.length?(p.openBlock(),p.createElementBlock("li",p.mergeProps({key:1,class:e.cx("emptyMessage"),role:"option"},e.ptm("emptyMessage"),{"data-p-hidden-accessible":!0}),[p.renderSlot(e.$slots,"empty",{},(function(){return[p.createTextVNode(p.toDisplayString(r.emptyMessageText),1)]}))],16)):p.createCommentVNode("",!0)],16,N)]})),_:2},[e.$slots.loader?{name:"loader",fn:p.withCtx((function(t){return[p.renderSlot(e.$slots,"loader",{options:t.options})]})),key:"0"}:void 0]),1040,["items","style","disabled","pt"])],16),p.renderSlot(e.$slots,"footer",{value:e.modelValue,options:r.visibleOptions}),!e.options||e.options&&0===e.options.length?(p.openBlock(),p.createElementBlock("span",p.mergeProps({key:1,role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenEmptyMessage"),{"data-p-hidden-accessible":!0}),p.toDisplayString(r.emptyMessageText),17)):p.createCommentVNode("",!0),p.createElementVNode("span",p.mergeProps({role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenSelectedMessage"),{"data-p-hidden-accessible":!0}),p.toDisplayString(r.selectedMessageText),17),p.createElementVNode("span",p.mergeProps({ref:"lastHiddenFocusableElementOnOverlay",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:0,onFocus:t[12]||(t[12]=function(){return r.onLastHiddenFocus&&r.onLastHiddenFocus.apply(r,arguments)})},e.ptm("hiddenLastFocusableEl"),{"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0}),null,16)],16)):p.createCommentVNode("",!0)]})),_:3},16,["onEnter","onAfterEnter","onLeave","onAfterLeave"])]})),_:3},8,["appendTo"])],16,H)},module.exports=P;