UNPKG

primevue

Version:

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/primevue.svg)](https://badge.fury.io/js/primevue) [![Discord Chat](https://img.shields.io/discord/55794023

2 lines (1 loc) 35.8 kB
this.primevue=this.primevue||{},this.primevue.dropdown=function(e,t,n,i,o,r,l,s,a,c,d,p,u){"use strict";function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=h(t),y=h(n),b=h(i),m=h(o),v=h(r),g=h(l),O=h(s),x=h(c),I=h(d),w=p.useStyle("\n.p-dropdown {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n}\n\n.p-dropdown-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n}\n\n.p-dropdown-trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n}\n\n.p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n}\n\n.p-dropdown-label-empty {\n overflow: hidden;\n opacity: 0;\n}\n\ninput.p-dropdown-label {\n cursor: default;\n}\n\n.p-dropdown .p-dropdown-panel {\n min-width: 100%;\n}\n\n.p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n\n.p-dropdown-items-wrapper {\n overflow: auto;\n}\n\n.p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n\n.p-dropdown-item-group {\n cursor: auto;\n}\n\n.p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n\n.p-dropdown-filter {\n width: 100%;\n}\n\n.p-dropdown-filter-container {\n position: relative;\n}\n\n.p-dropdown-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n}\n\n.p-fluid .p-dropdown {\n display: flex;\n}\n\n.p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n}\n",{name:"dropdown",manual:!0});function S(e){return S="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},S(e)}function k(){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 V(e,t){if(e){if("string"==typeof e)return L(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?L(e,t):void 0}}function F(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function D(e){if(Array.isArray(e))return L(e)}function L(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C(Object(n),!0).forEach((function(t){P(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function P(e,t,n){return(t=M(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function M(e){var t=K(e,"string");return"symbol"===S(t)?t:String(t)}function K(e,t){if("object"!==S(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==S(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var B={name:"Dropdown",extends:{name:"BaseDropdown",extends:I.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},"aria-label":{type:String,default:null},"aria-labelledby":{type:String,default:null}},css:{classes:{root:function(e){var t=e.props,n=e.state;return["p-dropdown p-component p-inputwrapper",{"p-disabled":t.disabled,"p-dropdown-clearable":t.showClear&&!t.disabled,"p-focus":n.focused,"p-inputwrapper-filled":e.instance.hasSelectedOption,"p-inputwrapper-focus":n.focused||n.overlayVisible,"p-overlay-open":n.overlayVisible}]},input:function(e){var t=e.instance,n=e.props;return["p-dropdown-label p-inputtext",{"p-placeholder":!n.editable&&t.label===n.placeholder,"p-dropdown-label-empty":!(n.editable||t.$slots.value||"p-emptylabel"!==t.label&&0!==t.label.length)}]},clearIcon:"p-dropdown-clear-icon",trigger:"p-dropdown-trigger",loadingicon:"p-dropdown-trigger-icon",dropdownIcon:"p-dropdown-trigger-icon",panel:function(e){var t=e.instance;return["p-dropdown-panel p-component",{"p-input-filled":"filled"===t.$primevue.config.inputStyle,"p-ripple-disabled":!1===t.$primevue.config.ripple}]},header:"p-dropdown-header",filterContainer:"p-dropdown-filter-container",filterInput:"p-dropdown-filter p-inputtext p-component",filterIcon:"p-dropdown-filter-icon",wrapper:"p-dropdown-items-wrapper",list:"p-dropdown-items",itemGroup:"p-dropdown-item-group",item:function(e){var t=e.instance,n=e.state,i=e.option,o=e.focusedOption;return["p-dropdown-item",{"p-highlight":t.isSelected(i),"p-focus":n.focusedOptionIndex===o,"p-disabled":t.isOptionDisabled(i)}]},emptyMessage:"p-dropdown-empty-message"},loadStyle:w.load},provide:function(){return{$parentInstance:this}}},emits:["update:modelValue","change","focus","blur","before-show","before-hide","show","hide","filter"],outsideClickListener:null,scrollHandler:null,resizeListener: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()},updated:function(){this.overlayVisible&&this.isModelValueChanged&&this.scrollInView(this.findSelectedOptionIndex()),this.isModelValueChanged=!1},beforeUnmount:function(){this.unbindOutsideClickListener(),this.unbindResizeListener(),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},getPTOptions:function(e,t,n,i){return this.ptm(i,{context:{selected:this.isSelected(e),focused:this.focusedOptionIndex===this.getOptionIndex(n,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)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"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)},onContainerClick:function(e){this.disabled||this.loading||"INPUT"!==e.target.tagName&&"clearicon"!==e.target.getAttribute("data-pc-section")&&"path"!==e.target.tagName&&(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 n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=this.getOptionValue(t);this.updateModel(e,i),n&&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":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){v.default.emit("overlay-click",{originalEvent:e,target:this.$el})},onOverlayKeyDown:function(e){if("Escape"===e.code)this.onEscapeKey(e)},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,n=t.value.length;t.setSelectionRange(n,n),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)},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 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,n=e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((function(e){return t.isValidOption(e)})):-1;return n>-1?n+e+1:e},findPrevOptionIndex:function(e){var t=this,n=e>0?a.ObjectUtils.findLastIndex(this.visibleOptions.slice(0,e),(function(e){return t.isValidOption(e)})):-1;return n>-1?n: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 n=this;this.searchValue=(this.searchValue||"")+t;var i=-1,o=!1;return-1!==(i=-1!==this.focusedOptionIndex?-1===(i=this.visibleOptions.slice(this.focusedOptionIndex).findIndex((function(e){return n.isOptionMatched(e)})))?this.visibleOptions.slice(0,this.focusedOptionIndex).findIndex((function(e){return n.isOptionMatched(e)})):i+this.focusedOptionIndex:this.visibleOptions.findIndex((function(e){return n.isOptionMatched(e)})))&&(o=!0),-1===i&&-1===this.focusedOptionIndex&&(i=this.findFirstFocusedOptionIndex()),-1!==i&&this.changeFocusedOptionIndex(e,i),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((function(){n.searchValue="",n.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,n=-1!==t?"".concat(this.id,"_").concat(t):this.focusedOptionId,i=a.DomHandler.findSingle(this.list,'li[id="'.concat(n,'"]'));i?i.scrollIntoView&&i.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,n,i){e.push({optionGroup:n,group:!0,index:i});var o=t.getOptionGroupChildren(n);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,n=this.optionGroupLabel?this.flatOptions(this.options):this.options||[];if(this.filterValue){var i=e.FilterService.filter(n,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);if(this.optionGroupLabel){var o=[];return(this.options||[]).forEach((function(e){var n,r=t.getOptionGroupChildren(e).filter((function(e){return i.includes(e)}));r.length>0&&o.push(E(E({},e),{},P({},"string"==typeof t.optionGroupChildren?t.optionGroupChildren:"items",D(n=r)||F(n)||V(n)||k())))})),this.flatOptions(o)}return i}return n},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:O.default},components:{VirtualScroller:x.default,Portal:g.default,TimesIcon:m.default,ChevronDownIcon:f.default,SpinnerIcon:b.default,FilterIcon:y.default}};function T(e){return T="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},T(e)}function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function $(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach((function(t){H(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function H(e,t,n){return(t=A(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e){var t=U(e,"string");return"symbol"===T(t)?t:String(t)}function U(e,t){if("object"!==T(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==T(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var N=["id"],G=["id","value","placeholder","tabindex","disabled","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant"],z=["id","tabindex","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant","aria-disabled"],R=["value","placeholder","aria-owns","aria-activedescendant"],_=["id"],q=["id"],W=["id","aria-label","aria-selected","aria-disabled","aria-setsize","aria-posinset","onClick","onMousemove","data-p-highlight","data-p-focused","data-p-disabled"];return B.render=function(e,t,n,i,o,r){var l=u.resolveComponent("SpinnerIcon"),s=u.resolveComponent("VirtualScroller"),a=u.resolveComponent("Portal"),c=u.resolveDirective("ripple");return u.openBlock(),u.createElementBlock("div",u.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?(u.openBlock(),u.createElementBlock("input",u.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)})},$($({},e.inputProps),e.ptm("input"))),null,16,G)):(u.openBlock(),u.createElementBlock("span",u.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)})},$($({},e.inputProps),e.ptm("input"))),[u.renderSlot(e.$slots,"value",{value:e.modelValue,placeholder:e.placeholder},(function(){return[u.createTextVNode(u.toDisplayString("p-emptylabel"===r.label?" ":r.label||"empty"),1)]}))],16,z)),e.showClear&&null!=e.modelValue?u.renderSlot(e.$slots,"clearicon",{key:2,class:u.normalizeClass(e.cx("clearIcon")),onClick:r.onClearClick},(function(){return[(u.openBlock(),u.createBlock(u.resolveDynamicComponent(e.clearIcon?"i":"TimesIcon"),u.mergeProps({ref:"clearIcon",class:[e.cx("clearIcon"),e.clearIcon],onClick:r.onClearClick},$($({},e.clearIconProps),e.ptm("clearIcon")),{"data-pc-section":"clearicon"}),null,16,["class","onClick"]))]})):u.createCommentVNode("",!0),u.createElementVNode("div",u.mergeProps({class:e.cx("trigger")},e.ptm("trigger")),[e.loading?u.renderSlot(e.$slots,"loadingicon",{key:0,class:u.normalizeClass(e.cx("loadingIcon"))},(function(){return[e.loadingIcon?(u.openBlock(),u.createElementBlock("span",u.mergeProps({key:0,class:[e.cx("loadingIcon"),"pi-spin",e.loadingIcon],"aria-hidden":"true"},e.ptm("loadingIcon")),null,16)):(u.openBlock(),u.createBlock(l,u.mergeProps({key:1,class:e.cx("loadingIcon"),spin:"","aria-hidden":"true"},e.ptm("loadingIcon")),null,16,["class"]))]})):u.renderSlot(e.$slots,"dropdownicon",{key:1,class:u.normalizeClass(e.cx("dropdownIcon"))},(function(){return[(u.openBlock(),u.createBlock(u.resolveDynamicComponent(e.dropdownIcon?"span":"ChevronDownIcon"),u.mergeProps({class:[e.cx("dropdownIcon"),e.dropdownIcon],"aria-hidden":"true"},e.ptm("dropdownIcon")),null,16,["class"]))]}))],16),u.createVNode(a,{appendTo:e.appendTo},{default:u.withCtx((function(){return[u.createVNode(u.Transition,{name:"p-connected-overlay",onEnter:r.onOverlayEnter,onAfterEnter:r.onOverlayAfterEnter,onLeave:r.onOverlayLeave,onAfterLeave:r.onOverlayAfterLeave},{default:u.withCtx((function(){return[o.overlayVisible?(u.openBlock(),u.createElementBlock("div",u.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)})},$($({},e.panelProps),e.ptm("panel"))),[u.createElementVNode("span",u.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),u.renderSlot(e.$slots,"header",{value:e.modelValue,options:r.visibleOptions}),e.filter?(u.openBlock(),u.createElementBlock("div",u.mergeProps({key:0,class:e.cx("header")},e.ptm("header")),[u.createElementVNode("div",u.mergeProps({class:e.cx("filterContainer")},e.ptm("filterContainer")),[u.createElementVNode("input",u.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)})},$($({},e.filterInputProps),e.ptm("filterInput"))),null,16,R),u.renderSlot(e.$slots,"filtericon",{class:u.normalizeClass(e.cx("filterIcon"))},(function(){return[(u.openBlock(),u.createBlock(u.resolveDynamicComponent(e.filterIcon?"span":"FilterIcon"),u.mergeProps({class:[e.cx("filterIcon"),e.filterIcon]},e.ptm("filterIcon")),null,16,["class"]))]}))],16),u.createElementVNode("span",u.mergeProps({role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenFilterResult"),{"data-p-hidden-accessible":!0}),u.toDisplayString(r.filterResultMessageText),17)],16)):u.createCommentVNode("",!0),u.createElementVNode("div",u.mergeProps({class:e.cx("wrapper"),style:{"max-height":r.virtualScrollerDisabled?e.scrollHeight:""}},e.ptm("wrapper")),[u.createVNode(s,u.mergeProps({ref:r.virtualScrollerRef},e.virtualScrollerOptions,{items:r.visibleOptions,style:{height:e.scrollHeight},tabindex:-1,disabled:r.virtualScrollerDisabled,pt:e.ptm("virtualScroller")}),u.createSlots({content:u.withCtx((function(t){var n=t.styleClass,i=t.contentRef,l=t.items,s=t.getItemOptions,a=t.contentStyle,d=t.itemSize;return[u.createElementVNode("ul",u.mergeProps({ref:function(e){return r.listRef(e,i)},id:o.id+"_list",class:[e.cx("list"),n],style:a,role:"listbox"},e.ptm("list")),[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(l,(function(t,n){return u.openBlock(),u.createElementBlock(u.Fragment,{key:r.getOptionRenderKey(t,r.getOptionIndex(n,s))},[r.isOptionGroup(t)?(u.openBlock(),u.createElementBlock("li",u.mergeProps({key:0,id:o.id+"_"+r.getOptionIndex(n,s),style:{height:d?d+"px":void 0},class:e.cx("itemGroup"),role:"option"},e.ptm("itemGroup")),[u.renderSlot(e.$slots,"optiongroup",{option:t.optionGroup,index:r.getOptionIndex(n,s)},(function(){return[u.createTextVNode(u.toDisplayString(r.getOptionGroupLabel(t.optionGroup)),1)]}))],16,q)):u.withDirectives((u.openBlock(),u.createElementBlock("li",u.mergeProps({key:1,id:o.id+"_"+r.getOptionIndex(n,s),class:e.cx("item",{option:t,focusedOption:r.getOptionIndex(n,s)}),style:{height:d?d+"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(n,s)),onClick:function(e){return r.onOptionSelect(e,t)},onMousemove:function(e){return r.onOptionMouseMove(e,r.getOptionIndex(n,s))},"data-p-highlight":r.isSelected(t),"data-p-focused":o.focusedOptionIndex===r.getOptionIndex(n,s),"data-p-disabled":r.isOptionDisabled(t)},r.getPTOptions(t,s,n,"item")),[u.renderSlot(e.$slots,"option",{option:t,index:r.getOptionIndex(n,s)},(function(){return[u.createTextVNode(u.toDisplayString(r.getOptionLabel(t)),1)]}))],16,W)),[[c]])],64)})),128)),o.filterValue&&(!l||l&&0===l.length)?(u.openBlock(),u.createElementBlock("li",u.mergeProps({key:0,class:e.cx("emptyMessage"),role:"option"},e.ptm("emptyMessage"),{"data-p-hidden-accessible":!0}),[u.renderSlot(e.$slots,"emptyfilter",{},(function(){return[u.createTextVNode(u.toDisplayString(r.emptyFilterMessageText),1)]}))],16)):!e.options||e.options&&0===e.options.length?(u.openBlock(),u.createElementBlock("li",u.mergeProps({key:1,class:e.cx("emptyMessage"),role:"option"},e.ptm("emptyMessage"),{"data-p-hidden-accessible":!0}),[u.renderSlot(e.$slots,"empty",{},(function(){return[u.createTextVNode(u.toDisplayString(r.emptyMessageText),1)]}))],16)):u.createCommentVNode("",!0)],16,_)]})),_:2},[e.$slots.loader?{name:"loader",fn:u.withCtx((function(t){return[u.renderSlot(e.$slots,"loader",{options:t.options})]})),key:"0"}:void 0]),1040,["items","style","disabled","pt"])],16),u.renderSlot(e.$slots,"footer",{value:e.modelValue,options:r.visibleOptions}),!e.options||e.options&&0===e.options.length?(u.openBlock(),u.createElementBlock("span",u.mergeProps({key:1,role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenEmptyMessage"),{"data-p-hidden-accessible":!0}),u.toDisplayString(r.emptyMessageText),17)):u.createCommentVNode("",!0),u.createElementVNode("span",u.mergeProps({role:"status","aria-live":"polite",class:"p-hidden-accessible"},e.ptm("hiddenSelectedMessage"),{"data-p-hidden-accessible":!0}),u.toDisplayString(r.selectedMessageText),17),u.createElementVNode("span",u.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)):u.createCommentVNode("",!0)]})),_:3},8,["onEnter","onAfterEnter","onLeave","onAfterLeave"])]})),_:3},8,["appendTo"])],16,N)},B}(primevue.api,primevue.icons.chevrondown,primevue.icons.filter,primevue.icons.spinner,primevue.icons.times,primevue.overlayeventbus,primevue.portal,primevue.ripple,primevue.utils,primevue.virtualscroller,primevue.basecomponent,primevue.usestyle,Vue);