primevue 3.7.0 → 3.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/autocomplete/AutoComplete.d.ts +1 -0
- package/autocomplete/AutoComplete.vue +8 -1
- package/autocomplete/autocomplete.cjs.js +8 -1
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.esm.js +8 -1
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +8 -1
- package/autocomplete/autocomplete.min.js +1 -1
- package/blockui/BlockUI.vue +1 -1
- package/blockui/blockui.cjs.js +1 -1
- package/blockui/blockui.cjs.min.js +1 -1
- package/blockui/blockui.esm.js +1 -1
- package/blockui/blockui.esm.min.js +1 -1
- package/blockui/blockui.js +1 -1
- package/blockui/blockui.min.js +1 -1
- package/breadcrumb/Breadcrumb.vue +4 -0
- package/breadcrumb/breadcrumb.cjs.js +1 -1
- package/breadcrumb/breadcrumb.cjs.min.js +1 -1
- package/breadcrumb/breadcrumb.esm.js +1 -1
- package/breadcrumb/breadcrumb.esm.min.js +1 -1
- package/breadcrumb/breadcrumb.js +1 -1
- package/breadcrumb/breadcrumb.min.js +1 -1
- package/confirmationservice/ConfirmationService.d.ts +3 -2
- package/core/core.js +7574 -0
- package/core/core.min.js +47 -0
- package/datatable/BodyCell.vue +36 -17
- package/datatable/ColumnFilter.vue +3 -3
- package/datatable/DataTable.d.ts +1 -1
- package/datatable/DataTable.vue +109 -69
- package/datatable/FooterCell.vue +2 -2
- package/datatable/HeaderCell.vue +2 -2
- package/datatable/TableBody.vue +10 -5
- package/datatable/TableFooter.vue +2 -1
- package/datatable/TableHeader.vue +3 -2
- package/datatable/datatable.cjs.js +192 -122
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.esm.js +192 -122
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +192 -122
- package/datatable/datatable.min.js +1 -1
- package/dock/Dock.d.ts +1 -0
- package/dock/Dock.vue +1 -1
- package/dock/DockSub.vue +13 -8
- package/dock/dock.cjs.js +24 -10
- package/dock/dock.cjs.min.js +1 -1
- package/dock/dock.esm.js +20 -10
- package/dock/dock.esm.min.js +1 -1
- package/dock/dock.js +25 -12
- package/dock/dock.min.js +1 -1
- package/dropdown/Dropdown.vue +9 -8
- package/dropdown/dropdown.cjs.js +13 -11
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.esm.js +13 -11
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +13 -11
- package/dropdown/dropdown.min.js +1 -1
- package/galleria/Galleria.vue +1 -0
- package/galleria/GalleriaContent.vue +10 -1
- package/galleria/galleria.cjs.js +11 -2
- package/galleria/galleria.cjs.min.js +1 -1
- package/galleria/galleria.esm.js +11 -2
- package/galleria/galleria.esm.min.js +1 -1
- package/galleria/galleria.js +11 -2
- package/galleria/galleria.min.js +1 -1
- package/inplace/Inplace.d.ts +1 -0
- package/inplace/Inplace.vue +12 -1
- package/inplace/inplace.cjs.js +13 -2
- package/inplace/inplace.cjs.min.js +1 -1
- package/inplace/inplace.esm.js +13 -2
- package/inplace/inplace.esm.min.js +1 -1
- package/inplace/inplace.js +13 -2
- package/inplace/inplace.min.js +1 -1
- package/inputnumber/InputNumber.d.ts +2 -0
- package/inputnumber/InputNumber.vue +84 -35
- package/inputnumber/inputnumber.cjs.js +84 -35
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.esm.js +84 -35
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +84 -35
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputswitch/InputSwitch.vue +6 -3
- package/inputswitch/inputswitch.cjs.js +6 -3
- package/inputswitch/inputswitch.cjs.min.js +1 -1
- package/inputswitch/inputswitch.esm.js +6 -3
- package/inputswitch/inputswitch.esm.min.js +1 -1
- package/inputswitch/inputswitch.js +6 -3
- package/inputswitch/inputswitch.min.js +1 -1
- package/knob/Knob.vue +1 -1
- package/knob/knob.cjs.js +1 -1
- package/knob/knob.esm.js +1 -1
- package/knob/knob.js +1 -1
- package/overlaypanel/OverlayPanel.d.ts +2 -0
- package/overlaypanel/OverlayPanel.vue +4 -1
- package/overlaypanel/overlaypanel.cjs.js +7 -3
- package/overlaypanel/overlaypanel.cjs.min.js +1 -1
- package/overlaypanel/overlaypanel.esm.js +7 -3
- package/overlaypanel/overlaypanel.esm.min.js +1 -1
- package/overlaypanel/overlaypanel.js +7 -3
- package/overlaypanel/overlaypanel.min.js +1 -1
- package/package.json +1 -1
- package/paginator/CurrentPageReport.vue +5 -1
- package/paginator/JumpToPageInput.vue +1 -1
- package/paginator/Paginator.vue +6 -3
- package/paginator/paginator.cjs.js +12 -4
- package/paginator/paginator.cjs.min.js +1 -1
- package/paginator/paginator.esm.js +12 -4
- package/paginator/paginator.esm.min.js +1 -1
- package/paginator/paginator.js +12 -4
- package/paginator/paginator.min.js +1 -1
- package/panelmenu/PanelMenuSub.vue +4 -4
- package/panelmenu/panelmenu.cjs.js +4 -4
- package/panelmenu/panelmenu.cjs.min.js +1 -1
- package/panelmenu/panelmenu.esm.js +4 -4
- package/panelmenu/panelmenu.esm.min.js +1 -1
- package/panelmenu/panelmenu.js +4 -4
- package/panelmenu/panelmenu.min.js +1 -1
- package/resources/primevue.css +3 -0
- package/resources/primevue.min.css +1 -1
- package/resources/themes/arya-blue/theme.css +6 -1
- package/resources/themes/arya-green/theme.css +6 -1
- package/resources/themes/arya-orange/theme.css +6 -1
- package/resources/themes/arya-purple/theme.css +6 -1
- package/resources/themes/bootstrap4-dark-blue/theme.css +6 -1
- package/resources/themes/bootstrap4-dark-purple/theme.css +6 -1
- package/resources/themes/bootstrap4-light-blue/theme.css +6 -1
- package/resources/themes/bootstrap4-light-purple/theme.css +6 -1
- package/resources/themes/fluent-light/theme.css +6 -1
- package/resources/themes/luna-amber/theme.css +6 -1
- package/resources/themes/luna-blue/theme.css +6 -1
- package/resources/themes/luna-green/theme.css +6 -1
- package/resources/themes/luna-pink/theme.css +6 -1
- package/resources/themes/md-dark-deeppurple/theme.css +6 -1
- package/resources/themes/md-dark-indigo/theme.css +6 -1
- package/resources/themes/md-light-deeppurple/theme.css +6 -1
- package/resources/themes/md-light-indigo/theme.css +6 -1
- package/resources/themes/mdc-dark-deeppurple/theme.css +6 -1
- package/resources/themes/mdc-dark-indigo/theme.css +6 -1
- package/resources/themes/mdc-light-deeppurple/theme.css +6 -1
- package/resources/themes/mdc-light-indigo/theme.css +6 -1
- package/resources/themes/nova/theme.css +6 -1
- package/resources/themes/nova-accent/theme.css +6 -1
- package/resources/themes/nova-alt/theme.css +6 -1
- package/resources/themes/nova-vue/theme.css +6 -1
- package/resources/themes/rhea/theme.css +6 -1
- package/resources/themes/saga-blue/theme.css +6 -1
- package/resources/themes/saga-green/theme.css +6 -1
- package/resources/themes/saga-orange/theme.css +6 -1
- package/resources/themes/saga-purple/theme.css +6 -1
- package/resources/themes/tailwind-light/fonts/Inter-Bold.woff +0 -0
- package/resources/themes/tailwind-light/fonts/Inter-Bold.woff2 +0 -0
- package/resources/themes/tailwind-light/fonts/Inter-Light.woff +0 -0
- package/resources/themes/tailwind-light/fonts/Inter-Light.woff2 +0 -0
- package/resources/themes/tailwind-light/fonts/Inter-Medium.woff +0 -0
- package/resources/themes/tailwind-light/fonts/Inter-Medium.woff2 +0 -0
- package/resources/themes/tailwind-light/fonts/Inter-Regular.woff +0 -0
- package/resources/themes/tailwind-light/fonts/Inter-Regular.woff2 +0 -0
- package/resources/themes/tailwind-light/fonts/Inter-SemiBold.woff +0 -0
- package/resources/themes/tailwind-light/fonts/Inter-SemiBold.woff2 +0 -0
- package/resources/themes/tailwind-light/theme.css +5440 -0
- package/resources/themes/vela-blue/theme.css +6 -1
- package/resources/themes/vela-green/theme.css +6 -1
- package/resources/themes/vela-orange/theme.css +6 -1
- package/resources/themes/vela-purple/theme.css +6 -1
- package/speeddial/SpeedDial.vue +2 -1
- package/speeddial/speeddial.cjs.js +2 -1
- package/speeddial/speeddial.cjs.min.js +1 -1
- package/speeddial/speeddial.esm.js +2 -1
- package/speeddial/speeddial.esm.min.js +1 -1
- package/speeddial/speeddial.js +2 -1
- package/speeddial/speeddial.min.js +1 -1
- package/splitter/Splitter.vue +5 -3
- package/splitter/splitter.cjs.js +4 -2
- package/splitter/splitter.cjs.min.js +1 -1
- package/splitter/splitter.esm.js +5 -3
- package/splitter/splitter.esm.min.js +1 -1
- package/splitter/splitter.js +4 -2
- package/splitter/splitter.min.js +1 -1
- package/tabmenu/TabMenu.vue +4 -0
- package/tabmenu/tabmenu.cjs.js +1 -1
- package/tabmenu/tabmenu.cjs.min.js +1 -1
- package/tabmenu/tabmenu.esm.js +1 -1
- package/tabmenu/tabmenu.esm.min.js +1 -1
- package/tabmenu/tabmenu.js +1 -1
- package/tabmenu/tabmenu.min.js +1 -1
- package/terminal/terminal.js +1 -1
- package/terminal/terminal.min.js +1 -1
- package/tieredmenu/TieredMenuSub.vue +1 -1
- package/tieredmenu/tieredmenu.cjs.js +1 -1
- package/tieredmenu/tieredmenu.cjs.min.js +1 -1
- package/tieredmenu/tieredmenu.esm.js +1 -1
- package/tieredmenu/tieredmenu.esm.min.js +1 -1
- package/tieredmenu/tieredmenu.js +1 -1
- package/tieredmenu/tieredmenu.min.js +1 -1
- package/toastservice/ToastService.d.ts +3 -2
- package/tooltip/tooltip.cjs.js +10 -3
- package/tooltip/tooltip.cjs.min.js +1 -1
- package/tooltip/tooltip.esm.js +10 -3
- package/tooltip/tooltip.esm.min.js +1 -1
- package/tooltip/tooltip.js +10 -3
- package/tooltip/tooltip.min.js +1 -1
- package/treetable/BodyCell.vue +2 -3
- package/treetable/FooterCell.vue +2 -2
- package/treetable/HeaderCell.vue +2 -2
- package/treetable/TreeTable.vue +2 -2
- package/treetable/TreeTableRow.vue +2 -2
- package/treetable/treetable.cjs.js +6 -6
- package/treetable/treetable.cjs.min.js +1 -1
- package/treetable/treetable.esm.js +7 -7
- package/treetable/treetable.esm.min.js +1 -1
- package/treetable/treetable.js +6 -6
- package/treetable/treetable.min.js +1 -1
- package/utils/Utils.d.ts +80 -0
- package/utils/package.json +3 -2
- package/utils/utils.cjs.js +126 -108
- package/utils/utils.cjs.min.js +1 -1
- package/utils/utils.esm.js +126 -108
- package/utils/utils.esm.min.js +1 -1
- package/utils/utils.js +126 -108
- package/utils/utils.min.js +1 -1
- package/vetur-attributes.json +12 -0
- package/vetur-tags.json +4 -1
- package/virtualscroller/VirtualScroller.vue +1 -1
- package/virtualscroller/virtualscroller.cjs.js +1 -1
- package/virtualscroller/virtualscroller.cjs.min.js +1 -1
- package/virtualscroller/virtualscroller.esm.js +1 -1
- package/virtualscroller/virtualscroller.esm.min.js +1 -1
- package/virtualscroller/virtualscroller.js +1 -1
- package/virtualscroller/virtualscroller.min.js +1 -1
- package/web-types.json +88 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("primevue/utils"),t=require("primevue/overlayeventbus"),i=require("primevue/api"),l=require("primevue/ripple"),n=require("primevue/virtualscroller"),o=require("vue");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=r(t),a=r(l),p=r(n),d={name:"Dropdown",emits:["update:modelValue","before-show","before-hide","show","hide","change","filter","focus","blur"],props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},editable:Boolean,placeholder:String,disabled:Boolean,dataKey:null,showClear:Boolean,inputId:String,tabindex:String,ariaLabelledBy:null,appendTo:{type:String,default:"body"},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},panelClass:null,loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:"pi pi-spinner pi-spin"},virtualScrollerOptions:{type:Object,default:null}},data:()=>({focused:!1,filterValue:null,overlayVisible:!1}),watch:{modelValue(){this.isModelValueChanged=!0}},outsideClickListener:null,scrollHandler:null,resizeListener:null,searchTimeout:null,currentSearchChar:null,previousSearchChar:null,searchValue:null,overlay:null,itemsWrapper:null,virtualScroller:null,isModelValueChanged:!1,updated(){this.overlayVisible&&this.isModelValueChanged&&this.scrollValueInView(),this.isModelValueChanged=!1},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.itemsWrapper=null,this.overlay&&(e.ZIndexUtils.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(t){return this.optionLabel?e.ObjectUtils.resolveFieldData(t,this.optionLabel):t},getOptionValue(t){return this.optionValue?e.ObjectUtils.resolveFieldData(t,this.optionValue):t},getOptionRenderKey(t){return this.dataKey?e.ObjectUtils.resolveFieldData(t,this.dataKey):this.getOptionLabel(t)},isOptionDisabled(t){return!!this.optionDisabled&&e.ObjectUtils.resolveFieldData(t,this.optionDisabled)},getOptionGroupRenderKey(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupLabel(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupChildren(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupChildren)},getSelectedOption(){let e=this.getSelectedOptionIndex();return-1!==e?this.optionGroupLabel?this.getOptionGroupChildren(this.options[e.group])[e.option]:this.options[e]:null},getSelectedOptionIndex(){if(null!=this.modelValue&&this.options){if(!this.optionGroupLabel)return this.findOptionIndexInList(this.modelValue,this.options);for(let e=0;e<this.options.length;e++){let t=this.findOptionIndexInList(this.modelValue,this.getOptionGroupChildren(this.options[e]));if(-1!==t)return{group:e,option:t}}}return-1},findOptionIndexInList(t,i){for(let l=0;l<i.length;l++)if(e.ObjectUtils.equals(t,this.getOptionValue(i[l]),this.equalityKey))return l;return-1},isSelected(t){return e.ObjectUtils.equals(this.modelValue,this.getOptionValue(t),this.equalityKey)},show(){this.$emit("before-show"),this.overlayVisible=!0},hide(){this.$emit("before-hide"),this.overlayVisible=!1},onFocus(e){this.focused=!0,this.$emit("focus",e)},onBlur(e){this.focused=!1,this.$emit("blur",e)},onKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 32:this.overlayVisible||(this.show(),e.preventDefault());break;case 13:case 27:this.overlayVisible&&(this.hide(),e.preventDefault());break;case 9:this.hide();break;default:this.search(e)}},onFilterKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 13:case 27:this.overlayVisible=!1,e.preventDefault()}},onDownKey(e){if(this.visibleOptions)if(!this.overlayVisible&&e.altKey)this.show();else{let t=this.visibleOptions&&this.visibleOptions.length>0?this.findNextOption(this.getSelectedOptionIndex()):null;t&&this.updateModel(e,this.getOptionValue(t))}e.preventDefault()},onUpKey(e){if(this.visibleOptions){let t=this.findPrevOption(this.getSelectedOptionIndex());t&&this.updateModel(e,this.getOptionValue(t))}e.preventDefault()},findNextOption(e){if(this.optionGroupLabel){let t=-1===e?0:e.group,i=-1===e?-1:e.option,l=this.findNextOptionInList(this.getOptionGroupChildren(this.visibleOptions[t]),i);return l||(t+1!==this.visibleOptions.length?this.findNextOption({group:t+1,option:-1}):null)}return this.findNextOptionInList(this.visibleOptions,e)},findNextOptionInList(e,t){let i=t+1;if(i===e.length)return null;let l=e[i];return this.isOptionDisabled(l)?this.findNextOptionInList(i):l},findPrevOption(e){if(-1===e)return null;if(this.optionGroupLabel){let t=e.group,i=e.option,l=this.findPrevOptionInList(this.getOptionGroupChildren(this.visibleOptions[t]),i);return l||(t>0?this.findPrevOption({group:t-1,option:this.getOptionGroupChildren(this.visibleOptions[t-1]).length}):null)}return this.findPrevOptionInList(this.visibleOptions,e)},findPrevOptionInList(e,t){let i=t-1;if(i<0)return null;let l=e[i];return this.isOptionDisabled(l)?this.findPrevOption(i):l},onClearClick(e){this.updateModel(e,null)},onClick(t){this.disabled||this.loading||e.DomHandler.hasClass(t.target,"p-dropdown-clear-icon")||"INPUT"===t.target.tagName||this.overlay&&this.overlay.contains(t.target)||(this.overlayVisible?this.hide():this.show(),this.$refs.focusInput.focus())},onOptionSelect(e,t){let i=this.getOptionValue(t);this.updateModel(e,i),this.$refs.focusInput.focus(),setTimeout((()=>{this.hide()}),200)},onEditableInput(e){this.$emit("update:modelValue",e.target.value)},onOverlayEnter(t){if(e.ZIndexUtils.set("overlay",t,this.$primevue.config.zIndex.overlay),this.scrollValueInView(),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.filter&&this.$refs.filterInput.focus(),!this.virtualScrollerDisabled){const e=this.getSelectedOptionIndex();-1!==e&&this.virtualScroller.scrollToIndex(e)}this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.itemsWrapper=null,this.overlay=null},onOverlayAfterLeave(t){e.ZIndexUtils.clear(t)},alignOverlay(){this.appendDisabled?e.DomHandler.relativePosition(this.overlay,this.$el):(this.overlay.style.minWidth=e.DomHandler.getOuterWidth(this.$el)+"px",e.DomHandler.absolutePosition(this.overlay,this.$el))},updateModel(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&!this.$el.contains(e.target)&&!this.overlay.contains(e.target)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new e.ConnectedOverlayScrollHandler(this.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!e.DomHandler.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},search(e){if(!this.visibleOptions)return;this.searchTimeout&&clearTimeout(this.searchTimeout);const t=e.key;if(this.previousSearchChar=this.currentSearchChar,this.currentSearchChar=t,this.previousSearchChar===this.currentSearchChar?this.searchValue=this.currentSearchChar:this.searchValue=this.searchValue?this.searchValue+t:t,this.searchValue){let t=this.getSelectedOptionIndex(),i=this.optionGroupLabel?this.searchOptionInGroup(t):this.searchOption(++t);i&&this.updateModel(e,this.getOptionValue(i))}this.searchTimeout=setTimeout((()=>{this.searchValue=null}),250)},searchOption(e){let t;return this.searchValue&&(t=this.searchOptionInRange(e,this.visibleOptions.length),t||(t=this.searchOptionInRange(0,e))),t},searchOptionInRange(e,t){for(let i=e;i<t;i++){let e=this.visibleOptions[i];if(this.matchesSearchValue(e))return e}return null},searchOptionInGroup(e){let t=-1===e?{group:0,option:-1}:e;for(let e=t.group;e<this.visibleOptions.length;e++){let i=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=t.group===e?t.option+1:0;l<i.length;l++)if(this.matchesSearchValue(i[l]))return i[l]}for(let e=0;e<=t.group;e++){let i=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=0;l<(t.group===e?t.option:i.length);l++)if(this.matchesSearchValue(i[l]))return i[l]}return null},matchesSearchValue(e){return this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},onFilterChange(e){this.$emit("filter",{originalEvent:e,value:e.target.value}),this.overlayVisible&&this.alignOverlay()},overlayRef(e){this.overlay=e},itemsWrapperRef(e){this.itemsWrapper=e},virtualScrollerRef(e){this.virtualScroller=e},scrollValueInView(){if(this.overlay){let t=e.DomHandler.findSingle(this.overlay,"li.p-highlight");t&&t.scrollIntoView({block:"nearest",inline:"start"})}},onOverlayClick(e){s.default.emit("overlay-click",{originalEvent:e,target:this.$el})}},computed:{visibleOptions(){if(this.filterValue){if(this.optionGroupLabel){let e=[];for(let t of this.options){let l=i.FilterService.filter(this.getOptionGroupChildren(t),this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);if(l&&l.length){let i={...t};i[this.optionGroupChildren]=l,e.push(i)}}return e}return i.FilterService.filter(this.options,this.searchFields,this.filterValue,"contains",this.filterLocale)}return this.options},containerClass(){return["p-dropdown p-component p-inputwrapper",{"p-disabled":this.disabled,"p-dropdown-clearable":this.showClear&&!this.disabled,"p-focus":this.focused,"p-inputwrapper-filled":this.modelValue,"p-inputwrapper-focus":this.focused||this.overlayVisible}]},labelClass(){return["p-dropdown-label p-inputtext",{"p-placeholder":this.label===this.placeholder,"p-dropdown-label-empty":!this.$slots.value&&("p-emptylabel"===this.label||0===this.label.length)}]},panelStyleClass(){return["p-dropdown-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},label(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.placeholder||"p-emptylabel"},editableInputValue(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.modelValue},equalityKey(){return this.optionValue?null:this.dataKey},searchFields(){return this.filterFields||[this.optionLabel]},emptyFilterMessageText(){return this.emptyFilterMessage||this.$primevue.config.locale.emptyFilterMessage},emptyMessageText(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage},appendDisabled(){return"self"===this.appendTo},virtualScrollerDisabled(){return!this.virtualScrollerOptions},appendTarget(){return this.appendDisabled?null:this.appendTo},dropdownIconClass(){return["p-dropdown-trigger-icon",this.loading?this.loadingIcon:"pi pi-chevron-down"]}},directives:{ripple:a.default},components:{VirtualScroller:p.default}};const h={class:"p-hidden-accessible"},u={key:0,class:"p-dropdown-header"},c={class:"p-dropdown-filter-container"},b=o.createVNode("span",{class:"p-dropdown-filter-icon pi pi-search"},null,-1),f={class:"p-dropdown-item-group"},v={key:2,class:"p-dropdown-empty-message"},g={key:3,class:"p-dropdown-empty-message"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&l.firstChild?l.insertBefore(n,l.firstChild):l.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-dropdown {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n cursor: pointer;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-dropdown-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-dropdown-trigger {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n}\n.p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n}\n.p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\ninput.p-dropdown-label {\n cursor: default;\n}\n.p-dropdown .p-dropdown-panel {\n min-width: 100%;\n}\n.p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-dropdown-items-wrapper {\n overflow: auto;\n}\n.p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-dropdown-item-group {\n cursor: auto;\n}\n.p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-dropdown-filter {\n width: 100%;\n}\n.p-dropdown-filter-container {\n position: relative;\n}\n.p-dropdown-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-fluid .p-dropdown {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n}\n"),d.render=function(e,t,i,l,n,r){const s=o.resolveComponent("VirtualScroller"),a=o.resolveDirective("ripple");return o.openBlock(),o.createBlock("div",{ref:"container",class:r.containerClass,onClick:t[12]||(t[12]=e=>r.onClick(e))},[o.createVNode("div",h,[o.createVNode("input",{ref:"focusInput",type:"text",id:i.inputId,readonly:"",disabled:i.disabled,onFocus:t[1]||(t[1]=(...e)=>r.onFocus&&r.onFocus(...e)),onBlur:t[2]||(t[2]=(...e)=>r.onBlur&&r.onBlur(...e)),onKeydown:t[3]||(t[3]=(...e)=>r.onKeyDown&&r.onKeyDown(...e)),tabindex:i.tabindex,"aria-haspopup":"true","aria-expanded":n.overlayVisible,"aria-labelledby":i.ariaLabelledBy},null,40,["id","disabled","tabindex","aria-expanded","aria-labelledby"])]),i.editable?(o.openBlock(),o.createBlock("input",{key:0,type:"text",class:"p-dropdown-label p-inputtext",disabled:i.disabled,onFocus:t[4]||(t[4]=(...e)=>r.onFocus&&r.onFocus(...e)),onBlur:t[5]||(t[5]=(...e)=>r.onBlur&&r.onBlur(...e)),placeholder:i.placeholder,value:r.editableInputValue,onInput:t[6]||(t[6]=(...e)=>r.onEditableInput&&r.onEditableInput(...e)),"aria-haspopup":"listbox","aria-expanded":n.overlayVisible},null,40,["disabled","placeholder","value","aria-expanded"])):o.createCommentVNode("",!0),i.editable?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock("span",{key:1,class:r.labelClass},[o.renderSlot(e.$slots,"value",{value:i.modelValue,placeholder:i.placeholder},(()=>[o.createTextVNode(o.toDisplayString(r.label||"empty"),1)]))],2)),i.showClear&&null!=i.modelValue?(o.openBlock(),o.createBlock("i",{key:2,class:"p-dropdown-clear-icon pi pi-times",onClick:t[7]||(t[7]=e=>r.onClearClick(e))})):o.createCommentVNode("",!0),o.createVNode("div",{class:"p-dropdown-trigger",role:"button","aria-haspopup":"listbox","aria-expanded":n.overlayVisible},[o.renderSlot(e.$slots,"indicator",{},(()=>[o.createVNode("span",{class:r.dropdownIconClass},null,2)]))],8,["aria-expanded"]),(o.openBlock(),o.createBlock(o.Teleport,{to:r.appendTarget,disabled:r.appendDisabled},[o.createVNode(o.Transition,{name:"p-connected-overlay",onEnter:r.onOverlayEnter,onLeave:r.onOverlayLeave,onAfterLeave:r.onOverlayAfterLeave},{default:o.withCtx((()=>[n.overlayVisible?(o.openBlock(),o.createBlock("div",{key:0,ref:r.overlayRef,class:r.panelStyleClass,onClick:t[11]||(t[11]=(...e)=>r.onOverlayClick&&r.onOverlayClick(...e))},[o.renderSlot(e.$slots,"header",{value:i.modelValue,options:r.visibleOptions}),i.filter?(o.openBlock(),o.createBlock("div",u,[o.createVNode("div",c,[o.withDirectives(o.createVNode("input",{type:"text",ref:"filterInput","onUpdate:modelValue":t[8]||(t[8]=e=>n.filterValue=e),autoComplete:"off",class:"p-dropdown-filter p-inputtext p-component",placeholder:i.filterPlaceholder,onKeydown:t[9]||(t[9]=(...e)=>r.onFilterKeyDown&&r.onFilterKeyDown(...e)),onInput:t[10]||(t[10]=(...e)=>r.onFilterChange&&r.onFilterChange(...e))},null,40,["placeholder"]),[[o.vModelText,n.filterValue]]),b])])):o.createCommentVNode("",!0),o.createVNode("div",{ref:r.itemsWrapperRef,class:"p-dropdown-items-wrapper",style:{"max-height":r.virtualScrollerDisabled?i.scrollHeight:""}},[o.createVNode(s,o.mergeProps({ref:r.virtualScrollerRef},i.virtualScrollerOptions,{items:r.visibleOptions,style:{height:i.scrollHeight},disabled:r.virtualScrollerDisabled}),o.createSlots({content:o.withCtx((({styleClass:t,contentRef:l,items:s,getItemOptions:p})=>[o.createVNode("ul",{ref:l,class:["p-dropdown-items",t],role:"listbox"},[i.optionGroupLabel?(o.openBlock(!0),o.createBlock(o.Fragment,{key:1},o.renderList(s,((t,i)=>(o.openBlock(),o.createBlock(o.Fragment,{key:r.getOptionGroupRenderKey(t)},[o.createVNode("li",f,[o.renderSlot(e.$slots,"optiongroup",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionGroupLabel(t)),1)]))]),(o.openBlock(!0),o.createBlock(o.Fragment,null,o.renderList(r.getOptionGroupChildren(t),((t,i)=>o.withDirectives((o.openBlock(),o.createBlock("li",{class:["p-dropdown-item",{"p-highlight":r.isSelected(t),"p-disabled":r.isOptionDisabled(t)}],key:r.getOptionRenderKey(t),onClick:e=>r.onOptionSelect(e,t),role:"option","aria-label":r.getOptionLabel(t),"aria-selected":r.isSelected(t)},[o.renderSlot(e.$slots,"option",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionLabel(t)),1)]))],10,["onClick","aria-label","aria-selected"])),[[a]]))),128))],64)))),128)):(o.openBlock(!0),o.createBlock(o.Fragment,{key:0},o.renderList(s,((t,i)=>o.withDirectives((o.openBlock(),o.createBlock("li",{class:["p-dropdown-item",{"p-highlight":r.isSelected(t),"p-disabled":r.isOptionDisabled(t)}],key:r.getOptionRenderKey(t),onClick:e=>r.onOptionSelect(e,t),role:"option","aria-label":r.getOptionLabel(t),"aria-selected":r.isSelected(t)},[o.renderSlot(e.$slots,"option",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionLabel(t)),1)]))],10,["onClick","aria-label","aria-selected"])),[[a]]))),128)),n.filterValue&&(!s||s&&0===s.length)?(o.openBlock(),o.createBlock("li",v,[o.renderSlot(e.$slots,"emptyfilter",{},(()=>[o.createTextVNode(o.toDisplayString(r.emptyFilterMessageText),1)]))])):!i.options||i.options&&0===i.options.length?(o.openBlock(),o.createBlock("li",g,[o.renderSlot(e.$slots,"empty",{},(()=>[o.createTextVNode(o.toDisplayString(r.emptyMessageText),1)]))])):o.createCommentVNode("",!0)],2)])),_:2},[e.$slots.loader?{name:"loader",fn:o.withCtx((({options:t})=>[o.renderSlot(e.$slots,"loader",{options:t})]))}:void 0]),1040,["items","style","disabled"])],4),o.renderSlot(e.$slots,"footer",{value:i.modelValue,options:r.visibleOptions})],2)):o.createCommentVNode("",!0)])),_:3},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"]))],2)},module.exports=d;
|
|
1
|
+
"use strict";var e=require("primevue/utils"),t=require("primevue/overlayeventbus"),i=require("primevue/api"),l=require("primevue/ripple"),n=require("primevue/virtualscroller"),o=require("vue");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=r(t),a=r(l),p=r(n),d={name:"Dropdown",emits:["update:modelValue","before-show","before-hide","show","hide","change","filter","focus","blur"],props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},editable:Boolean,placeholder:String,disabled:Boolean,dataKey:null,showClear:Boolean,inputId:String,tabindex:String,ariaLabelledBy:null,appendTo:{type:String,default:"body"},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},panelClass:null,loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:"pi pi-spinner pi-spin"},virtualScrollerOptions:{type:Object,default:null}},data:()=>({focused:!1,filterValue:null,overlayVisible:!1}),watch:{modelValue(){this.isModelValueChanged=!0}},outsideClickListener:null,scrollHandler:null,resizeListener:null,searchTimeout:null,currentSearchChar:null,previousSearchChar:null,searchValue:null,overlay:null,itemsWrapper:null,virtualScroller:null,isModelValueChanged:!1,updated(){this.overlayVisible&&this.isModelValueChanged&&this.scrollValueInView(),this.isModelValueChanged=!1},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.itemsWrapper=null,this.overlay&&(e.ZIndexUtils.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(t){return this.optionLabel?e.ObjectUtils.resolveFieldData(t,this.optionLabel):t},getOptionValue(t){return this.optionValue?e.ObjectUtils.resolveFieldData(t,this.optionValue):t},getOptionRenderKey(t){return this.dataKey?e.ObjectUtils.resolveFieldData(t,this.dataKey):this.getOptionLabel(t)},isOptionDisabled(t){return!!this.optionDisabled&&e.ObjectUtils.resolveFieldData(t,this.optionDisabled)},getOptionGroupRenderKey(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupLabel(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupChildren(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupChildren)},getSelectedOption(){let e=this.getSelectedOptionIndex();return-1!==e?this.optionGroupLabel?this.getOptionGroupChildren(this.visibleOptions[e.group])[e.option]:this.visibleOptions[e]:null},getSelectedOptionIndex(){if(null!=this.modelValue&&this.visibleOptions){if(!this.optionGroupLabel)return this.findOptionIndexInList(this.modelValue,this.visibleOptions);for(let e=0;e<this.visibleOptions.length;e++){let t=this.findOptionIndexInList(this.modelValue,this.getOptionGroupChildren(this.visibleOptions[e]));if(-1!==t)return{group:e,option:t}}}return-1},findOptionIndexInList(t,i){for(let l=0;l<i.length;l++)if(e.ObjectUtils.equals(t,this.getOptionValue(i[l]),this.equalityKey))return l;return-1},isSelected(t){return e.ObjectUtils.equals(this.modelValue,this.getOptionValue(t),this.equalityKey)},show(){this.$emit("before-show"),this.overlayVisible=!0},hide(){this.$emit("before-hide"),this.overlayVisible=!1},onFocus(e){this.focused=!0,this.$emit("focus",e)},onBlur(e){this.focused=!1,this.$emit("blur",e)},onKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 32:this.overlayVisible||(this.show(),e.preventDefault());break;case 13:case 27:this.overlayVisible&&(this.hide(),e.preventDefault());break;case 9:this.hide();break;default:this.search(e)}},onFilterKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 13:case 27:this.overlayVisible=!1,e.preventDefault()}},onDownKey(e){if(this.visibleOptions)if(!this.overlayVisible&&e.altKey)this.show();else{let t=this.visibleOptions&&this.visibleOptions.length>0?this.findNextOption(this.getSelectedOptionIndex()):null;t&&this.updateModel(e,this.getOptionValue(t))}e.preventDefault()},onUpKey(e){if(this.visibleOptions){let t=this.findPrevOption(this.getSelectedOptionIndex());t&&this.updateModel(e,this.getOptionValue(t))}e.preventDefault()},findNextOption(e){if(this.optionGroupLabel){let t=-1===e?0:e.group,i=-1===e?-1:e.option,l=this.findNextOptionInList(this.getOptionGroupChildren(this.visibleOptions[t]),i);return l||(t+1!==this.visibleOptions.length?this.findNextOption({group:t+1,option:-1}):null)}return this.findNextOptionInList(this.visibleOptions,e)},findNextOptionInList(e,t){let i=t+1;if(i===e.length)return null;let l=e[i];return this.isOptionDisabled(l)?this.findNextOptionInList(i):l},findPrevOption(e){if(-1===e)return null;if(this.optionGroupLabel){let t=e.group,i=e.option,l=this.findPrevOptionInList(this.getOptionGroupChildren(this.visibleOptions[t]),i);return l||(t>0?this.findPrevOption({group:t-1,option:this.getOptionGroupChildren(this.visibleOptions[t-1]).length}):null)}return this.findPrevOptionInList(this.visibleOptions,e)},findPrevOptionInList(e,t){let i=t-1;if(i<0)return null;let l=e[i];return this.isOptionDisabled(l)?this.findPrevOption(i):l},onClearClick(e){this.updateModel(e,null)},onClick(t){this.disabled||this.loading||e.DomHandler.hasClass(t.target,"p-dropdown-clear-icon")||"INPUT"===t.target.tagName||this.overlay&&this.overlay.contains(t.target)||(this.overlayVisible?this.hide():this.show(),this.$refs.focusInput.focus())},onOptionSelect(e,t){let i=this.getOptionValue(t);this.updateModel(e,i),this.$refs.focusInput.focus(),setTimeout((()=>{this.hide()}),200)},onEditableInput(e){this.$emit("update:modelValue",e.target.value)},onOverlayEnter(t){if(e.ZIndexUtils.set("overlay",t,this.$primevue.config.zIndex.overlay),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.filter&&this.$refs.filterInput.focus(),!this.virtualScrollerDisabled){const e=this.getSelectedOptionIndex();-1!==e&&this.virtualScroller.scrollToIndex(e)}this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.itemsWrapper=null,this.overlay=null},onOverlayAfterLeave(t){e.ZIndexUtils.clear(t)},alignOverlay(){this.appendDisabled?e.DomHandler.relativePosition(this.overlay,this.$el):(this.overlay.style.minWidth=e.DomHandler.getOuterWidth(this.$el)+"px",e.DomHandler.absolutePosition(this.overlay,this.$el))},updateModel(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&!this.$el.contains(e.target)&&!this.overlay.contains(e.target)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new e.ConnectedOverlayScrollHandler(this.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!e.DomHandler.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},search(e){if(!this.visibleOptions)return;this.searchTimeout&&clearTimeout(this.searchTimeout);const t=e.key;if(this.previousSearchChar=this.currentSearchChar,this.currentSearchChar=t,this.previousSearchChar===this.currentSearchChar?this.searchValue=this.currentSearchChar:this.searchValue=this.searchValue?this.searchValue+t:t,this.searchValue){let t=this.getSelectedOptionIndex(),i=this.optionGroupLabel?this.searchOptionInGroup(t):this.searchOption(++t);i&&this.updateModel(e,this.getOptionValue(i))}this.searchTimeout=setTimeout((()=>{this.searchValue=null}),250)},searchOption(e){let t;return this.searchValue&&(t=this.searchOptionInRange(e,this.visibleOptions.length),t||(t=this.searchOptionInRange(0,e))),t},searchOptionInRange(e,t){for(let i=e;i<t;i++){let e=this.visibleOptions[i];if(this.matchesSearchValue(e))return e}return null},searchOptionInGroup(e){let t=-1===e?{group:0,option:-1}:e;for(let e=t.group;e<this.visibleOptions.length;e++){let i=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=t.group===e?t.option+1:0;l<i.length;l++)if(this.matchesSearchValue(i[l]))return i[l]}for(let e=0;e<=t.group;e++){let i=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=0;l<(t.group===e?t.option:i.length);l++)if(this.matchesSearchValue(i[l]))return i[l]}return null},matchesSearchValue(e){return this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},onFilterChange(e){this.$emit("filter",{originalEvent:e,value:e.target.value})},onFilterUpdated(){this.overlayVisible&&this.alignOverlay()},overlayRef(e){this.overlay=e},itemsWrapperRef(e){this.itemsWrapper=e},virtualScrollerRef(e){this.virtualScroller=e},scrollValueInView(){if(this.overlay){let t=e.DomHandler.findSingle(this.overlay,"li.p-highlight");t&&t.scrollIntoView({block:"nearest",inline:"start"})}},onOverlayClick(e){s.default.emit("overlay-click",{originalEvent:e,target:this.$el})}},computed:{visibleOptions(){if(this.filterValue){if(this.optionGroupLabel){let e=[];for(let t of this.options){let l=i.FilterService.filter(this.getOptionGroupChildren(t),this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);if(l&&l.length){let i={...t};i[this.optionGroupChildren]=l,e.push(i)}}return e}return i.FilterService.filter(this.options,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale)}return this.options},containerClass(){return["p-dropdown p-component p-inputwrapper",{"p-disabled":this.disabled,"p-dropdown-clearable":this.showClear&&!this.disabled,"p-focus":this.focused,"p-inputwrapper-filled":this.modelValue,"p-inputwrapper-focus":this.focused||this.overlayVisible}]},labelClass(){return["p-dropdown-label p-inputtext",{"p-placeholder":this.label===this.placeholder,"p-dropdown-label-empty":!this.$slots.value&&("p-emptylabel"===this.label||0===this.label.length)}]},panelStyleClass(){return["p-dropdown-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},label(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.placeholder||"p-emptylabel"},editableInputValue(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.modelValue},equalityKey(){return this.optionValue?null:this.dataKey},searchFields(){return this.filterFields||[this.optionLabel]},emptyFilterMessageText(){return this.emptyFilterMessage||this.$primevue.config.locale.emptyFilterMessage},emptyMessageText(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage},appendDisabled(){return"self"===this.appendTo},virtualScrollerDisabled(){return!this.virtualScrollerOptions},appendTarget(){return this.appendDisabled?null:this.appendTo},dropdownIconClass(){return["p-dropdown-trigger-icon",this.loading?this.loadingIcon:"pi pi-chevron-down"]}},directives:{ripple:a.default},components:{VirtualScroller:p.default}};const h={class:"p-hidden-accessible"},u={key:0,class:"p-dropdown-header"},c={class:"p-dropdown-filter-container"},b=o.createVNode("span",{class:"p-dropdown-filter-icon pi pi-search"},null,-1),f={class:"p-dropdown-item-group"},v={key:2,class:"p-dropdown-empty-message"},g={key:3,class:"p-dropdown-empty-message"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&l.firstChild?l.insertBefore(n,l.firstChild):l.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-dropdown {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n cursor: pointer;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-dropdown-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-dropdown-trigger {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n}\n.p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n}\n.p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\ninput.p-dropdown-label {\n cursor: default;\n}\n.p-dropdown .p-dropdown-panel {\n min-width: 100%;\n}\n.p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-dropdown-items-wrapper {\n overflow: auto;\n}\n.p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-dropdown-item-group {\n cursor: auto;\n}\n.p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-dropdown-filter {\n width: 100%;\n}\n.p-dropdown-filter-container {\n position: relative;\n}\n.p-dropdown-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-fluid .p-dropdown {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n}\n"),d.render=function(e,t,i,l,n,r){const s=o.resolveComponent("VirtualScroller"),a=o.resolveDirective("ripple");return o.openBlock(),o.createBlock("div",{ref:"container",class:r.containerClass,onClick:t[13]||(t[13]=e=>r.onClick(e))},[o.createVNode("div",h,[o.createVNode("input",{ref:"focusInput",type:"text",id:i.inputId,readonly:"",disabled:i.disabled,onFocus:t[1]||(t[1]=(...e)=>r.onFocus&&r.onFocus(...e)),onBlur:t[2]||(t[2]=(...e)=>r.onBlur&&r.onBlur(...e)),onKeydown:t[3]||(t[3]=(...e)=>r.onKeyDown&&r.onKeyDown(...e)),tabindex:i.tabindex,"aria-haspopup":"true","aria-expanded":n.overlayVisible,"aria-labelledby":i.ariaLabelledBy},null,40,["id","disabled","tabindex","aria-expanded","aria-labelledby"])]),i.editable?(o.openBlock(),o.createBlock("input",{key:0,type:"text",class:"p-dropdown-label p-inputtext",disabled:i.disabled,onFocus:t[4]||(t[4]=(...e)=>r.onFocus&&r.onFocus(...e)),onBlur:t[5]||(t[5]=(...e)=>r.onBlur&&r.onBlur(...e)),placeholder:i.placeholder,value:r.editableInputValue,onInput:t[6]||(t[6]=(...e)=>r.onEditableInput&&r.onEditableInput(...e)),"aria-haspopup":"listbox","aria-expanded":n.overlayVisible},null,40,["disabled","placeholder","value","aria-expanded"])):o.createCommentVNode("",!0),i.editable?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock("span",{key:1,class:r.labelClass},[o.renderSlot(e.$slots,"value",{value:i.modelValue,placeholder:i.placeholder},(()=>[o.createTextVNode(o.toDisplayString(r.label||"empty"),1)]))],2)),i.showClear&&null!=i.modelValue?(o.openBlock(),o.createBlock("i",{key:2,class:"p-dropdown-clear-icon pi pi-times",onClick:t[7]||(t[7]=e=>r.onClearClick(e))})):o.createCommentVNode("",!0),o.createVNode("div",{class:"p-dropdown-trigger",role:"button","aria-haspopup":"listbox","aria-expanded":n.overlayVisible},[o.renderSlot(e.$slots,"indicator",{},(()=>[o.createVNode("span",{class:r.dropdownIconClass},null,2)]))],8,["aria-expanded"]),(o.openBlock(),o.createBlock(o.Teleport,{to:r.appendTarget,disabled:r.appendDisabled},[o.createVNode(o.Transition,{name:"p-connected-overlay",onEnter:r.onOverlayEnter,onLeave:r.onOverlayLeave,onAfterLeave:r.onOverlayAfterLeave},{default:o.withCtx((()=>[n.overlayVisible?(o.openBlock(),o.createBlock("div",{key:0,ref:r.overlayRef,class:r.panelStyleClass,onClick:t[12]||(t[12]=(...e)=>r.onOverlayClick&&r.onOverlayClick(...e))},[o.renderSlot(e.$slots,"header",{value:i.modelValue,options:r.visibleOptions}),i.filter?(o.openBlock(),o.createBlock("div",u,[o.createVNode("div",c,[o.withDirectives(o.createVNode("input",{type:"text",ref:"filterInput","onUpdate:modelValue":t[8]||(t[8]=e=>n.filterValue=e),onVnodeUpdated:t[9]||(t[9]=(...e)=>r.onFilterUpdated&&r.onFilterUpdated(...e)),autoComplete:"off",class:"p-dropdown-filter p-inputtext p-component",placeholder:i.filterPlaceholder,onKeydown:t[10]||(t[10]=(...e)=>r.onFilterKeyDown&&r.onFilterKeyDown(...e)),onInput:t[11]||(t[11]=(...e)=>r.onFilterChange&&r.onFilterChange(...e))},null,40,["placeholder"]),[[o.vModelText,n.filterValue]]),b])])):o.createCommentVNode("",!0),o.createVNode("div",{ref:r.itemsWrapperRef,class:"p-dropdown-items-wrapper",style:{"max-height":r.virtualScrollerDisabled?i.scrollHeight:""}},[o.createVNode(s,o.mergeProps({ref:r.virtualScrollerRef},i.virtualScrollerOptions,{items:r.visibleOptions,style:{height:i.scrollHeight},disabled:r.virtualScrollerDisabled}),o.createSlots({content:o.withCtx((({styleClass:t,contentRef:l,items:s,getItemOptions:p})=>[o.createVNode("ul",{ref:l,class:["p-dropdown-items",t],role:"listbox"},[i.optionGroupLabel?(o.openBlock(!0),o.createBlock(o.Fragment,{key:1},o.renderList(s,((t,i)=>(o.openBlock(),o.createBlock(o.Fragment,{key:r.getOptionGroupRenderKey(t)},[o.createVNode("li",f,[o.renderSlot(e.$slots,"optiongroup",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionGroupLabel(t)),1)]))]),(o.openBlock(!0),o.createBlock(o.Fragment,null,o.renderList(r.getOptionGroupChildren(t),((t,i)=>o.withDirectives((o.openBlock(),o.createBlock("li",{class:["p-dropdown-item",{"p-highlight":r.isSelected(t),"p-disabled":r.isOptionDisabled(t)}],key:r.getOptionRenderKey(t),onClick:e=>r.onOptionSelect(e,t),role:"option","aria-label":r.getOptionLabel(t),"aria-selected":r.isSelected(t)},[o.renderSlot(e.$slots,"option",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionLabel(t)),1)]))],10,["onClick","aria-label","aria-selected"])),[[a]]))),128))],64)))),128)):(o.openBlock(!0),o.createBlock(o.Fragment,{key:0},o.renderList(s,((t,i)=>o.withDirectives((o.openBlock(),o.createBlock("li",{class:["p-dropdown-item",{"p-highlight":r.isSelected(t),"p-disabled":r.isOptionDisabled(t)}],key:r.getOptionRenderKey(t),onClick:e=>r.onOptionSelect(e,t),role:"option","aria-label":r.getOptionLabel(t),"aria-selected":r.isSelected(t)},[o.renderSlot(e.$slots,"option",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionLabel(t)),1)]))],10,["onClick","aria-label","aria-selected"])),[[a]]))),128)),n.filterValue&&(!s||s&&0===s.length)?(o.openBlock(),o.createBlock("li",v,[o.renderSlot(e.$slots,"emptyfilter",{},(()=>[o.createTextVNode(o.toDisplayString(r.emptyFilterMessageText),1)]))])):!i.options||i.options&&0===i.options.length?(o.openBlock(),o.createBlock("li",g,[o.renderSlot(e.$slots,"empty",{},(()=>[o.createTextVNode(o.toDisplayString(r.emptyMessageText),1)]))])):o.createCommentVNode("",!0)],2)])),_:2},[e.$slots.loader?{name:"loader",fn:o.withCtx((({options:t})=>[o.renderSlot(e.$slots,"loader",{options:t})]))}:void 0]),1040,["items","style","disabled"])],4),o.renderSlot(e.$slots,"footer",{value:i.modelValue,options:r.visibleOptions})],2)):o.createCommentVNode("",!0)])),_:3},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"]))],2)},module.exports=d;
|
package/dropdown/dropdown.esm.js
CHANGED
|
@@ -138,20 +138,20 @@ var script = {
|
|
|
138
138
|
},
|
|
139
139
|
getSelectedOption() {
|
|
140
140
|
let index = this.getSelectedOptionIndex();
|
|
141
|
-
return index !== -1 ? (this.optionGroupLabel ? this.getOptionGroupChildren(this.
|
|
141
|
+
return index !== -1 ? (this.optionGroupLabel ? this.getOptionGroupChildren(this.visibleOptions[index.group])[index.option]: this.visibleOptions[index]) : null;
|
|
142
142
|
},
|
|
143
143
|
getSelectedOptionIndex() {
|
|
144
|
-
if (this.modelValue != null && this.
|
|
144
|
+
if (this.modelValue != null && this.visibleOptions) {
|
|
145
145
|
if (this.optionGroupLabel) {
|
|
146
|
-
for (let i = 0; i < this.
|
|
147
|
-
let selectedOptionIndex = this.findOptionIndexInList(this.modelValue, this.getOptionGroupChildren(this.
|
|
146
|
+
for (let i = 0; i < this.visibleOptions.length; i++) {
|
|
147
|
+
let selectedOptionIndex = this.findOptionIndexInList(this.modelValue, this.getOptionGroupChildren(this.visibleOptions[i]));
|
|
148
148
|
if (selectedOptionIndex !== -1) {
|
|
149
149
|
return {group: i, option: selectedOptionIndex};
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
else {
|
|
154
|
-
return this.findOptionIndexInList(this.modelValue, this.
|
|
154
|
+
return this.findOptionIndexInList(this.modelValue, this.visibleOptions);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
|
|
@@ -365,7 +365,6 @@ var script = {
|
|
|
365
365
|
},
|
|
366
366
|
onOverlayEnter(el) {
|
|
367
367
|
ZIndexUtils.set('overlay', el, this.$primevue.config.zIndex.overlay);
|
|
368
|
-
this.scrollValueInView();
|
|
369
368
|
this.alignOverlay();
|
|
370
369
|
this.bindOutsideClickListener();
|
|
371
370
|
this.bindScrollListener();
|
|
@@ -538,6 +537,8 @@ var script = {
|
|
|
538
537
|
},
|
|
539
538
|
onFilterChange(event) {
|
|
540
539
|
this.$emit('filter', {originalEvent: event, value: event.target.value});
|
|
540
|
+
},
|
|
541
|
+
onFilterUpdated() {
|
|
541
542
|
if (this.overlayVisible) {
|
|
542
543
|
this.alignOverlay();
|
|
543
544
|
}
|
|
@@ -582,7 +583,7 @@ var script = {
|
|
|
582
583
|
return filteredGroups
|
|
583
584
|
}
|
|
584
585
|
else {
|
|
585
|
-
return FilterService.filter(this.options, this.searchFields, this.filterValue,
|
|
586
|
+
return FilterService.filter(this.options, this.searchFields, this.filterValue, this.filterMatchMode, this.filterLocale);
|
|
586
587
|
}
|
|
587
588
|
}
|
|
588
589
|
else {
|
|
@@ -687,7 +688,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
687
688
|
return (openBlock(), createBlock("div", {
|
|
688
689
|
ref: "container",
|
|
689
690
|
class: $options.containerClass,
|
|
690
|
-
onClick: _cache[
|
|
691
|
+
onClick: _cache[13] || (_cache[13] = $event => ($options.onClick($event)))
|
|
691
692
|
}, [
|
|
692
693
|
createVNode("div", _hoisted_1, [
|
|
693
694
|
createVNode("input", {
|
|
@@ -766,7 +767,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
766
767
|
key: 0,
|
|
767
768
|
ref: $options.overlayRef,
|
|
768
769
|
class: $options.panelStyleClass,
|
|
769
|
-
onClick: _cache[
|
|
770
|
+
onClick: _cache[12] || (_cache[12] = (...args) => ($options.onOverlayClick && $options.onOverlayClick(...args)))
|
|
770
771
|
}, [
|
|
771
772
|
renderSlot(_ctx.$slots, "header", {
|
|
772
773
|
value: $props.modelValue,
|
|
@@ -779,11 +780,12 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
779
780
|
type: "text",
|
|
780
781
|
ref: "filterInput",
|
|
781
782
|
"onUpdate:modelValue": _cache[8] || (_cache[8] = $event => ($data.filterValue = $event)),
|
|
783
|
+
onVnodeUpdated: _cache[9] || (_cache[9] = (...args) => ($options.onFilterUpdated && $options.onFilterUpdated(...args))),
|
|
782
784
|
autoComplete: "off",
|
|
783
785
|
class: "p-dropdown-filter p-inputtext p-component",
|
|
784
786
|
placeholder: $props.filterPlaceholder,
|
|
785
|
-
onKeydown: _cache[
|
|
786
|
-
onInput: _cache[
|
|
787
|
+
onKeydown: _cache[10] || (_cache[10] = (...args) => ($options.onFilterKeyDown && $options.onFilterKeyDown(...args))),
|
|
788
|
+
onInput: _cache[11] || (_cache[11] = (...args) => ($options.onFilterChange && $options.onFilterChange(...args)))
|
|
787
789
|
}, null, 40, ["placeholder"]), [
|
|
788
790
|
[vModelText, $data.filterValue]
|
|
789
791
|
]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ZIndexUtils as e,ObjectUtils as t,DomHandler as i,ConnectedOverlayScrollHandler as l}from"primevue/utils";import n from"primevue/overlayeventbus";import{FilterService as o}from"primevue/api";import s from"primevue/ripple";import r from"primevue/virtualscroller";import{resolveComponent as a,resolveDirective as p,openBlock as d,createBlock as h,createVNode as u,createCommentVNode as c,renderSlot as b,createTextVNode as f,toDisplayString as v,Teleport as g,Transition as y,withCtx as m,withDirectives as O,vModelText as w,mergeProps as L,createSlots as V,Fragment as x,renderList as C}from"vue";var S={name:"Dropdown",emits:["update:modelValue","before-show","before-hide","show","hide","change","filter","focus","blur"],props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},editable:Boolean,placeholder:String,disabled:Boolean,dataKey:null,showClear:Boolean,inputId:String,tabindex:String,ariaLabelledBy:null,appendTo:{type:String,default:"body"},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},panelClass:null,loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:"pi pi-spinner pi-spin"},virtualScrollerOptions:{type:Object,default:null}},data:()=>({focused:!1,filterValue:null,overlayVisible:!1}),watch:{modelValue(){this.isModelValueChanged=!0}},outsideClickListener:null,scrollHandler:null,resizeListener:null,searchTimeout:null,currentSearchChar:null,previousSearchChar:null,searchValue:null,overlay:null,itemsWrapper:null,virtualScroller:null,isModelValueChanged:!1,updated(){this.overlayVisible&&this.isModelValueChanged&&this.scrollValueInView(),this.isModelValueChanged=!1},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.itemsWrapper=null,this.overlay&&(e.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(e){return this.optionLabel?t.resolveFieldData(e,this.optionLabel):e},getOptionValue(e){return this.optionValue?t.resolveFieldData(e,this.optionValue):e},getOptionRenderKey(e){return this.dataKey?t.resolveFieldData(e,this.dataKey):this.getOptionLabel(e)},isOptionDisabled(e){return!!this.optionDisabled&&t.resolveFieldData(e,this.optionDisabled)},getOptionGroupRenderKey(e){return t.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupLabel(e){return t.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren(e){return t.resolveFieldData(e,this.optionGroupChildren)},getSelectedOption(){let e=this.getSelectedOptionIndex();return-1!==e?this.optionGroupLabel?this.getOptionGroupChildren(this.options[e.group])[e.option]:this.options[e]:null},getSelectedOptionIndex(){if(null!=this.modelValue&&this.options){if(!this.optionGroupLabel)return this.findOptionIndexInList(this.modelValue,this.options);for(let e=0;e<this.options.length;e++){let t=this.findOptionIndexInList(this.modelValue,this.getOptionGroupChildren(this.options[e]));if(-1!==t)return{group:e,option:t}}}return-1},findOptionIndexInList(e,i){for(let l=0;l<i.length;l++)if(t.equals(e,this.getOptionValue(i[l]),this.equalityKey))return l;return-1},isSelected(e){return t.equals(this.modelValue,this.getOptionValue(e),this.equalityKey)},show(){this.$emit("before-show"),this.overlayVisible=!0},hide(){this.$emit("before-hide"),this.overlayVisible=!1},onFocus(e){this.focused=!0,this.$emit("focus",e)},onBlur(e){this.focused=!1,this.$emit("blur",e)},onKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 32:this.overlayVisible||(this.show(),e.preventDefault());break;case 13:case 27:this.overlayVisible&&(this.hide(),e.preventDefault());break;case 9:this.hide();break;default:this.search(e)}},onFilterKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 13:case 27:this.overlayVisible=!1,e.preventDefault()}},onDownKey(e){if(this.visibleOptions)if(!this.overlayVisible&&e.altKey)this.show();else{let t=this.visibleOptions&&this.visibleOptions.length>0?this.findNextOption(this.getSelectedOptionIndex()):null;t&&this.updateModel(e,this.getOptionValue(t))}e.preventDefault()},onUpKey(e){if(this.visibleOptions){let t=this.findPrevOption(this.getSelectedOptionIndex());t&&this.updateModel(e,this.getOptionValue(t))}e.preventDefault()},findNextOption(e){if(this.optionGroupLabel){let t=-1===e?0:e.group,i=-1===e?-1:e.option,l=this.findNextOptionInList(this.getOptionGroupChildren(this.visibleOptions[t]),i);return l||(t+1!==this.visibleOptions.length?this.findNextOption({group:t+1,option:-1}):null)}return this.findNextOptionInList(this.visibleOptions,e)},findNextOptionInList(e,t){let i=t+1;if(i===e.length)return null;let l=e[i];return this.isOptionDisabled(l)?this.findNextOptionInList(i):l},findPrevOption(e){if(-1===e)return null;if(this.optionGroupLabel){let t=e.group,i=e.option,l=this.findPrevOptionInList(this.getOptionGroupChildren(this.visibleOptions[t]),i);return l||(t>0?this.findPrevOption({group:t-1,option:this.getOptionGroupChildren(this.visibleOptions[t-1]).length}):null)}return this.findPrevOptionInList(this.visibleOptions,e)},findPrevOptionInList(e,t){let i=t-1;if(i<0)return null;let l=e[i];return this.isOptionDisabled(l)?this.findPrevOption(i):l},onClearClick(e){this.updateModel(e,null)},onClick(e){this.disabled||this.loading||i.hasClass(e.target,"p-dropdown-clear-icon")||"INPUT"===e.target.tagName||this.overlay&&this.overlay.contains(e.target)||(this.overlayVisible?this.hide():this.show(),this.$refs.focusInput.focus())},onOptionSelect(e,t){let i=this.getOptionValue(t);this.updateModel(e,i),this.$refs.focusInput.focus(),setTimeout((()=>{this.hide()}),200)},onEditableInput(e){this.$emit("update:modelValue",e.target.value)},onOverlayEnter(t){if(e.set("overlay",t,this.$primevue.config.zIndex.overlay),this.scrollValueInView(),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.filter&&this.$refs.filterInput.focus(),!this.virtualScrollerDisabled){const e=this.getSelectedOptionIndex();-1!==e&&this.virtualScroller.scrollToIndex(e)}this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.itemsWrapper=null,this.overlay=null},onOverlayAfterLeave(t){e.clear(t)},alignOverlay(){this.appendDisabled?i.relativePosition(this.overlay,this.$el):(this.overlay.style.minWidth=i.getOuterWidth(this.$el)+"px",i.absolutePosition(this.overlay,this.$el))},updateModel(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&!this.$el.contains(e.target)&&!this.overlay.contains(e.target)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new l(this.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!i.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},search(e){if(!this.visibleOptions)return;this.searchTimeout&&clearTimeout(this.searchTimeout);const t=e.key;if(this.previousSearchChar=this.currentSearchChar,this.currentSearchChar=t,this.previousSearchChar===this.currentSearchChar?this.searchValue=this.currentSearchChar:this.searchValue=this.searchValue?this.searchValue+t:t,this.searchValue){let t=this.getSelectedOptionIndex(),i=this.optionGroupLabel?this.searchOptionInGroup(t):this.searchOption(++t);i&&this.updateModel(e,this.getOptionValue(i))}this.searchTimeout=setTimeout((()=>{this.searchValue=null}),250)},searchOption(e){let t;return this.searchValue&&(t=this.searchOptionInRange(e,this.visibleOptions.length),t||(t=this.searchOptionInRange(0,e))),t},searchOptionInRange(e,t){for(let i=e;i<t;i++){let e=this.visibleOptions[i];if(this.matchesSearchValue(e))return e}return null},searchOptionInGroup(e){let t=-1===e?{group:0,option:-1}:e;for(let e=t.group;e<this.visibleOptions.length;e++){let i=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=t.group===e?t.option+1:0;l<i.length;l++)if(this.matchesSearchValue(i[l]))return i[l]}for(let e=0;e<=t.group;e++){let i=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=0;l<(t.group===e?t.option:i.length);l++)if(this.matchesSearchValue(i[l]))return i[l]}return null},matchesSearchValue(e){return this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},onFilterChange(e){this.$emit("filter",{originalEvent:e,value:e.target.value}),this.overlayVisible&&this.alignOverlay()},overlayRef(e){this.overlay=e},itemsWrapperRef(e){this.itemsWrapper=e},virtualScrollerRef(e){this.virtualScroller=e},scrollValueInView(){if(this.overlay){let e=i.findSingle(this.overlay,"li.p-highlight");e&&e.scrollIntoView({block:"nearest",inline:"start"})}},onOverlayClick(e){n.emit("overlay-click",{originalEvent:e,target:this.$el})}},computed:{visibleOptions(){if(this.filterValue){if(this.optionGroupLabel){let e=[];for(let t of this.options){let i=o.filter(this.getOptionGroupChildren(t),this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);if(i&&i.length){let l={...t};l[this.optionGroupChildren]=i,e.push(l)}}return e}return o.filter(this.options,this.searchFields,this.filterValue,"contains",this.filterLocale)}return this.options},containerClass(){return["p-dropdown p-component p-inputwrapper",{"p-disabled":this.disabled,"p-dropdown-clearable":this.showClear&&!this.disabled,"p-focus":this.focused,"p-inputwrapper-filled":this.modelValue,"p-inputwrapper-focus":this.focused||this.overlayVisible}]},labelClass(){return["p-dropdown-label p-inputtext",{"p-placeholder":this.label===this.placeholder,"p-dropdown-label-empty":!this.$slots.value&&("p-emptylabel"===this.label||0===this.label.length)}]},panelStyleClass(){return["p-dropdown-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},label(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.placeholder||"p-emptylabel"},editableInputValue(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.modelValue},equalityKey(){return this.optionValue?null:this.dataKey},searchFields(){return this.filterFields||[this.optionLabel]},emptyFilterMessageText(){return this.emptyFilterMessage||this.$primevue.config.locale.emptyFilterMessage},emptyMessageText(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage},appendDisabled(){return"self"===this.appendTo},virtualScrollerDisabled(){return!this.virtualScrollerOptions},appendTarget(){return this.appendDisabled?null:this.appendTo},dropdownIconClass(){return["p-dropdown-trigger-icon",this.loading?this.loadingIcon:"pi pi-chevron-down"]}},directives:{ripple:s},components:{VirtualScroller:r}};const k={class:"p-hidden-accessible"},I={key:0,class:"p-dropdown-header"},D={class:"p-dropdown-filter-container"},$=u("span",{class:"p-dropdown-filter-icon pi pi-search"},null,-1),F={class:"p-dropdown-item-group"},G={key:2,class:"p-dropdown-empty-message"},K={key:3,class:"p-dropdown-empty-message"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&l.firstChild?l.insertBefore(n,l.firstChild):l.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-dropdown {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n cursor: pointer;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-dropdown-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-dropdown-trigger {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n}\n.p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n}\n.p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\ninput.p-dropdown-label {\n cursor: default;\n}\n.p-dropdown .p-dropdown-panel {\n min-width: 100%;\n}\n.p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-dropdown-items-wrapper {\n overflow: auto;\n}\n.p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-dropdown-item-group {\n cursor: auto;\n}\n.p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-dropdown-filter {\n width: 100%;\n}\n.p-dropdown-filter-container {\n position: relative;\n}\n.p-dropdown-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-fluid .p-dropdown {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n}\n"),S.render=function(e,t,i,l,n,o){const s=a("VirtualScroller"),r=p("ripple");return d(),h("div",{ref:"container",class:o.containerClass,onClick:t[12]||(t[12]=e=>o.onClick(e))},[u("div",k,[u("input",{ref:"focusInput",type:"text",id:i.inputId,readonly:"",disabled:i.disabled,onFocus:t[1]||(t[1]=(...e)=>o.onFocus&&o.onFocus(...e)),onBlur:t[2]||(t[2]=(...e)=>o.onBlur&&o.onBlur(...e)),onKeydown:t[3]||(t[3]=(...e)=>o.onKeyDown&&o.onKeyDown(...e)),tabindex:i.tabindex,"aria-haspopup":"true","aria-expanded":n.overlayVisible,"aria-labelledby":i.ariaLabelledBy},null,40,["id","disabled","tabindex","aria-expanded","aria-labelledby"])]),i.editable?(d(),h("input",{key:0,type:"text",class:"p-dropdown-label p-inputtext",disabled:i.disabled,onFocus:t[4]||(t[4]=(...e)=>o.onFocus&&o.onFocus(...e)),onBlur:t[5]||(t[5]=(...e)=>o.onBlur&&o.onBlur(...e)),placeholder:i.placeholder,value:o.editableInputValue,onInput:t[6]||(t[6]=(...e)=>o.onEditableInput&&o.onEditableInput(...e)),"aria-haspopup":"listbox","aria-expanded":n.overlayVisible},null,40,["disabled","placeholder","value","aria-expanded"])):c("",!0),i.editable?c("",!0):(d(),h("span",{key:1,class:o.labelClass},[b(e.$slots,"value",{value:i.modelValue,placeholder:i.placeholder},(()=>[f(v(o.label||"empty"),1)]))],2)),i.showClear&&null!=i.modelValue?(d(),h("i",{key:2,class:"p-dropdown-clear-icon pi pi-times",onClick:t[7]||(t[7]=e=>o.onClearClick(e))})):c("",!0),u("div",{class:"p-dropdown-trigger",role:"button","aria-haspopup":"listbox","aria-expanded":n.overlayVisible},[b(e.$slots,"indicator",{},(()=>[u("span",{class:o.dropdownIconClass},null,2)]))],8,["aria-expanded"]),(d(),h(g,{to:o.appendTarget,disabled:o.appendDisabled},[u(y,{name:"p-connected-overlay",onEnter:o.onOverlayEnter,onLeave:o.onOverlayLeave,onAfterLeave:o.onOverlayAfterLeave},{default:m((()=>[n.overlayVisible?(d(),h("div",{key:0,ref:o.overlayRef,class:o.panelStyleClass,onClick:t[11]||(t[11]=(...e)=>o.onOverlayClick&&o.onOverlayClick(...e))},[b(e.$slots,"header",{value:i.modelValue,options:o.visibleOptions}),i.filter?(d(),h("div",I,[u("div",D,[O(u("input",{type:"text",ref:"filterInput","onUpdate:modelValue":t[8]||(t[8]=e=>n.filterValue=e),autoComplete:"off",class:"p-dropdown-filter p-inputtext p-component",placeholder:i.filterPlaceholder,onKeydown:t[9]||(t[9]=(...e)=>o.onFilterKeyDown&&o.onFilterKeyDown(...e)),onInput:t[10]||(t[10]=(...e)=>o.onFilterChange&&o.onFilterChange(...e))},null,40,["placeholder"]),[[w,n.filterValue]]),$])])):c("",!0),u("div",{ref:o.itemsWrapperRef,class:"p-dropdown-items-wrapper",style:{"max-height":o.virtualScrollerDisabled?i.scrollHeight:""}},[u(s,L({ref:o.virtualScrollerRef},i.virtualScrollerOptions,{items:o.visibleOptions,style:{height:i.scrollHeight},disabled:o.virtualScrollerDisabled}),V({content:m((({styleClass:t,contentRef:l,items:s,getItemOptions:a})=>[u("ul",{ref:l,class:["p-dropdown-items",t],role:"listbox"},[i.optionGroupLabel?(d(!0),h(x,{key:1},C(s,((t,i)=>(d(),h(x,{key:o.getOptionGroupRenderKey(t)},[u("li",F,[b(e.$slots,"optiongroup",{option:t,index:o.getOptionIndex(i,a)},(()=>[f(v(o.getOptionGroupLabel(t)),1)]))]),(d(!0),h(x,null,C(o.getOptionGroupChildren(t),((t,i)=>O((d(),h("li",{class:["p-dropdown-item",{"p-highlight":o.isSelected(t),"p-disabled":o.isOptionDisabled(t)}],key:o.getOptionRenderKey(t),onClick:e=>o.onOptionSelect(e,t),role:"option","aria-label":o.getOptionLabel(t),"aria-selected":o.isSelected(t)},[b(e.$slots,"option",{option:t,index:o.getOptionIndex(i,a)},(()=>[f(v(o.getOptionLabel(t)),1)]))],10,["onClick","aria-label","aria-selected"])),[[r]]))),128))],64)))),128)):(d(!0),h(x,{key:0},C(s,((t,i)=>O((d(),h("li",{class:["p-dropdown-item",{"p-highlight":o.isSelected(t),"p-disabled":o.isOptionDisabled(t)}],key:o.getOptionRenderKey(t),onClick:e=>o.onOptionSelect(e,t),role:"option","aria-label":o.getOptionLabel(t),"aria-selected":o.isSelected(t)},[b(e.$slots,"option",{option:t,index:o.getOptionIndex(i,a)},(()=>[f(v(o.getOptionLabel(t)),1)]))],10,["onClick","aria-label","aria-selected"])),[[r]]))),128)),n.filterValue&&(!s||s&&0===s.length)?(d(),h("li",G,[b(e.$slots,"emptyfilter",{},(()=>[f(v(o.emptyFilterMessageText),1)]))])):!i.options||i.options&&0===i.options.length?(d(),h("li",K,[b(e.$slots,"empty",{},(()=>[f(v(o.emptyMessageText),1)]))])):c("",!0)],2)])),_:2},[e.$slots.loader?{name:"loader",fn:m((({options:t})=>[b(e.$slots,"loader",{options:t})]))}:void 0]),1040,["items","style","disabled"])],4),b(e.$slots,"footer",{value:i.modelValue,options:o.visibleOptions})],2)):c("",!0)])),_:3},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"]))],2)};export default S;
|
|
1
|
+
import{ZIndexUtils as e,ObjectUtils as i,DomHandler as t,ConnectedOverlayScrollHandler as l}from"primevue/utils";import n from"primevue/overlayeventbus";import{FilterService as o}from"primevue/api";import s from"primevue/ripple";import r from"primevue/virtualscroller";import{resolveComponent as a,resolveDirective as p,openBlock as d,createBlock as h,createVNode as u,createCommentVNode as c,renderSlot as b,createTextVNode as f,toDisplayString as v,Teleport as g,Transition as y,withCtx as m,withDirectives as O,vModelText as w,mergeProps as L,createSlots as x,Fragment as V,renderList as C}from"vue";var S={name:"Dropdown",emits:["update:modelValue","before-show","before-hide","show","hide","change","filter","focus","blur"],props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},editable:Boolean,placeholder:String,disabled:Boolean,dataKey:null,showClear:Boolean,inputId:String,tabindex:String,ariaLabelledBy:null,appendTo:{type:String,default:"body"},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},panelClass:null,loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:"pi pi-spinner pi-spin"},virtualScrollerOptions:{type:Object,default:null}},data:()=>({focused:!1,filterValue:null,overlayVisible:!1}),watch:{modelValue(){this.isModelValueChanged=!0}},outsideClickListener:null,scrollHandler:null,resizeListener:null,searchTimeout:null,currentSearchChar:null,previousSearchChar:null,searchValue:null,overlay:null,itemsWrapper:null,virtualScroller:null,isModelValueChanged:!1,updated(){this.overlayVisible&&this.isModelValueChanged&&this.scrollValueInView(),this.isModelValueChanged=!1},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.itemsWrapper=null,this.overlay&&(e.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,i){return this.virtualScrollerDisabled?e:i&&i(e).index},getOptionLabel(e){return this.optionLabel?i.resolveFieldData(e,this.optionLabel):e},getOptionValue(e){return this.optionValue?i.resolveFieldData(e,this.optionValue):e},getOptionRenderKey(e){return this.dataKey?i.resolveFieldData(e,this.dataKey):this.getOptionLabel(e)},isOptionDisabled(e){return!!this.optionDisabled&&i.resolveFieldData(e,this.optionDisabled)},getOptionGroupRenderKey(e){return i.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupLabel(e){return i.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren(e){return i.resolveFieldData(e,this.optionGroupChildren)},getSelectedOption(){let e=this.getSelectedOptionIndex();return-1!==e?this.optionGroupLabel?this.getOptionGroupChildren(this.visibleOptions[e.group])[e.option]:this.visibleOptions[e]:null},getSelectedOptionIndex(){if(null!=this.modelValue&&this.visibleOptions){if(!this.optionGroupLabel)return this.findOptionIndexInList(this.modelValue,this.visibleOptions);for(let e=0;e<this.visibleOptions.length;e++){let i=this.findOptionIndexInList(this.modelValue,this.getOptionGroupChildren(this.visibleOptions[e]));if(-1!==i)return{group:e,option:i}}}return-1},findOptionIndexInList(e,t){for(let l=0;l<t.length;l++)if(i.equals(e,this.getOptionValue(t[l]),this.equalityKey))return l;return-1},isSelected(e){return i.equals(this.modelValue,this.getOptionValue(e),this.equalityKey)},show(){this.$emit("before-show"),this.overlayVisible=!0},hide(){this.$emit("before-hide"),this.overlayVisible=!1},onFocus(e){this.focused=!0,this.$emit("focus",e)},onBlur(e){this.focused=!1,this.$emit("blur",e)},onKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 32:this.overlayVisible||(this.show(),e.preventDefault());break;case 13:case 27:this.overlayVisible&&(this.hide(),e.preventDefault());break;case 9:this.hide();break;default:this.search(e)}},onFilterKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 13:case 27:this.overlayVisible=!1,e.preventDefault()}},onDownKey(e){if(this.visibleOptions)if(!this.overlayVisible&&e.altKey)this.show();else{let i=this.visibleOptions&&this.visibleOptions.length>0?this.findNextOption(this.getSelectedOptionIndex()):null;i&&this.updateModel(e,this.getOptionValue(i))}e.preventDefault()},onUpKey(e){if(this.visibleOptions){let i=this.findPrevOption(this.getSelectedOptionIndex());i&&this.updateModel(e,this.getOptionValue(i))}e.preventDefault()},findNextOption(e){if(this.optionGroupLabel){let i=-1===e?0:e.group,t=-1===e?-1:e.option,l=this.findNextOptionInList(this.getOptionGroupChildren(this.visibleOptions[i]),t);return l||(i+1!==this.visibleOptions.length?this.findNextOption({group:i+1,option:-1}):null)}return this.findNextOptionInList(this.visibleOptions,e)},findNextOptionInList(e,i){let t=i+1;if(t===e.length)return null;let l=e[t];return this.isOptionDisabled(l)?this.findNextOptionInList(t):l},findPrevOption(e){if(-1===e)return null;if(this.optionGroupLabel){let i=e.group,t=e.option,l=this.findPrevOptionInList(this.getOptionGroupChildren(this.visibleOptions[i]),t);return l||(i>0?this.findPrevOption({group:i-1,option:this.getOptionGroupChildren(this.visibleOptions[i-1]).length}):null)}return this.findPrevOptionInList(this.visibleOptions,e)},findPrevOptionInList(e,i){let t=i-1;if(t<0)return null;let l=e[t];return this.isOptionDisabled(l)?this.findPrevOption(t):l},onClearClick(e){this.updateModel(e,null)},onClick(e){this.disabled||this.loading||t.hasClass(e.target,"p-dropdown-clear-icon")||"INPUT"===e.target.tagName||this.overlay&&this.overlay.contains(e.target)||(this.overlayVisible?this.hide():this.show(),this.$refs.focusInput.focus())},onOptionSelect(e,i){let t=this.getOptionValue(i);this.updateModel(e,t),this.$refs.focusInput.focus(),setTimeout((()=>{this.hide()}),200)},onEditableInput(e){this.$emit("update:modelValue",e.target.value)},onOverlayEnter(i){if(e.set("overlay",i,this.$primevue.config.zIndex.overlay),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.filter&&this.$refs.filterInput.focus(),!this.virtualScrollerDisabled){const e=this.getSelectedOptionIndex();-1!==e&&this.virtualScroller.scrollToIndex(e)}this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.itemsWrapper=null,this.overlay=null},onOverlayAfterLeave(i){e.clear(i)},alignOverlay(){this.appendDisabled?t.relativePosition(this.overlay,this.$el):(this.overlay.style.minWidth=t.getOuterWidth(this.$el)+"px",t.absolutePosition(this.overlay,this.$el))},updateModel(e,i){this.$emit("update:modelValue",i),this.$emit("change",{originalEvent:e,value:i})},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&!this.$el.contains(e.target)&&!this.overlay.contains(e.target)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new l(this.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!t.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},search(e){if(!this.visibleOptions)return;this.searchTimeout&&clearTimeout(this.searchTimeout);const i=e.key;if(this.previousSearchChar=this.currentSearchChar,this.currentSearchChar=i,this.previousSearchChar===this.currentSearchChar?this.searchValue=this.currentSearchChar:this.searchValue=this.searchValue?this.searchValue+i:i,this.searchValue){let i=this.getSelectedOptionIndex(),t=this.optionGroupLabel?this.searchOptionInGroup(i):this.searchOption(++i);t&&this.updateModel(e,this.getOptionValue(t))}this.searchTimeout=setTimeout((()=>{this.searchValue=null}),250)},searchOption(e){let i;return this.searchValue&&(i=this.searchOptionInRange(e,this.visibleOptions.length),i||(i=this.searchOptionInRange(0,e))),i},searchOptionInRange(e,i){for(let t=e;t<i;t++){let e=this.visibleOptions[t];if(this.matchesSearchValue(e))return e}return null},searchOptionInGroup(e){let i=-1===e?{group:0,option:-1}:e;for(let e=i.group;e<this.visibleOptions.length;e++){let t=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=i.group===e?i.option+1:0;l<t.length;l++)if(this.matchesSearchValue(t[l]))return t[l]}for(let e=0;e<=i.group;e++){let t=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=0;l<(i.group===e?i.option:t.length);l++)if(this.matchesSearchValue(t[l]))return t[l]}return null},matchesSearchValue(e){return this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},onFilterChange(e){this.$emit("filter",{originalEvent:e,value:e.target.value})},onFilterUpdated(){this.overlayVisible&&this.alignOverlay()},overlayRef(e){this.overlay=e},itemsWrapperRef(e){this.itemsWrapper=e},virtualScrollerRef(e){this.virtualScroller=e},scrollValueInView(){if(this.overlay){let e=t.findSingle(this.overlay,"li.p-highlight");e&&e.scrollIntoView({block:"nearest",inline:"start"})}},onOverlayClick(e){n.emit("overlay-click",{originalEvent:e,target:this.$el})}},computed:{visibleOptions(){if(this.filterValue){if(this.optionGroupLabel){let e=[];for(let i of this.options){let t=o.filter(this.getOptionGroupChildren(i),this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);if(t&&t.length){let l={...i};l[this.optionGroupChildren]=t,e.push(l)}}return e}return o.filter(this.options,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale)}return this.options},containerClass(){return["p-dropdown p-component p-inputwrapper",{"p-disabled":this.disabled,"p-dropdown-clearable":this.showClear&&!this.disabled,"p-focus":this.focused,"p-inputwrapper-filled":this.modelValue,"p-inputwrapper-focus":this.focused||this.overlayVisible}]},labelClass(){return["p-dropdown-label p-inputtext",{"p-placeholder":this.label===this.placeholder,"p-dropdown-label-empty":!this.$slots.value&&("p-emptylabel"===this.label||0===this.label.length)}]},panelStyleClass(){return["p-dropdown-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},label(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.placeholder||"p-emptylabel"},editableInputValue(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.modelValue},equalityKey(){return this.optionValue?null:this.dataKey},searchFields(){return this.filterFields||[this.optionLabel]},emptyFilterMessageText(){return this.emptyFilterMessage||this.$primevue.config.locale.emptyFilterMessage},emptyMessageText(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage},appendDisabled(){return"self"===this.appendTo},virtualScrollerDisabled(){return!this.virtualScrollerOptions},appendTarget(){return this.appendDisabled?null:this.appendTo},dropdownIconClass(){return["p-dropdown-trigger-icon",this.loading?this.loadingIcon:"pi pi-chevron-down"]}},directives:{ripple:s},components:{VirtualScroller:r}};const k={class:"p-hidden-accessible"},I={key:0,class:"p-dropdown-header"},D={class:"p-dropdown-filter-container"},$=u("span",{class:"p-dropdown-filter-icon pi pi-search"},null,-1),F={class:"p-dropdown-item-group"},G={key:2,class:"p-dropdown-empty-message"},K={key:3,class:"p-dropdown-empty-message"};!function(e,i){void 0===i&&(i={});var t=i.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===t&&l.firstChild?l.insertBefore(n,l.firstChild):l.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-dropdown {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n cursor: pointer;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-dropdown-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-dropdown-trigger {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n}\n.p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n}\n.p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\ninput.p-dropdown-label {\n cursor: default;\n}\n.p-dropdown .p-dropdown-panel {\n min-width: 100%;\n}\n.p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-dropdown-items-wrapper {\n overflow: auto;\n}\n.p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-dropdown-item-group {\n cursor: auto;\n}\n.p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-dropdown-filter {\n width: 100%;\n}\n.p-dropdown-filter-container {\n position: relative;\n}\n.p-dropdown-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-fluid .p-dropdown {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n}\n"),S.render=function(e,i,t,l,n,o){const s=a("VirtualScroller"),r=p("ripple");return d(),h("div",{ref:"container",class:o.containerClass,onClick:i[13]||(i[13]=e=>o.onClick(e))},[u("div",k,[u("input",{ref:"focusInput",type:"text",id:t.inputId,readonly:"",disabled:t.disabled,onFocus:i[1]||(i[1]=(...e)=>o.onFocus&&o.onFocus(...e)),onBlur:i[2]||(i[2]=(...e)=>o.onBlur&&o.onBlur(...e)),onKeydown:i[3]||(i[3]=(...e)=>o.onKeyDown&&o.onKeyDown(...e)),tabindex:t.tabindex,"aria-haspopup":"true","aria-expanded":n.overlayVisible,"aria-labelledby":t.ariaLabelledBy},null,40,["id","disabled","tabindex","aria-expanded","aria-labelledby"])]),t.editable?(d(),h("input",{key:0,type:"text",class:"p-dropdown-label p-inputtext",disabled:t.disabled,onFocus:i[4]||(i[4]=(...e)=>o.onFocus&&o.onFocus(...e)),onBlur:i[5]||(i[5]=(...e)=>o.onBlur&&o.onBlur(...e)),placeholder:t.placeholder,value:o.editableInputValue,onInput:i[6]||(i[6]=(...e)=>o.onEditableInput&&o.onEditableInput(...e)),"aria-haspopup":"listbox","aria-expanded":n.overlayVisible},null,40,["disabled","placeholder","value","aria-expanded"])):c("",!0),t.editable?c("",!0):(d(),h("span",{key:1,class:o.labelClass},[b(e.$slots,"value",{value:t.modelValue,placeholder:t.placeholder},(()=>[f(v(o.label||"empty"),1)]))],2)),t.showClear&&null!=t.modelValue?(d(),h("i",{key:2,class:"p-dropdown-clear-icon pi pi-times",onClick:i[7]||(i[7]=e=>o.onClearClick(e))})):c("",!0),u("div",{class:"p-dropdown-trigger",role:"button","aria-haspopup":"listbox","aria-expanded":n.overlayVisible},[b(e.$slots,"indicator",{},(()=>[u("span",{class:o.dropdownIconClass},null,2)]))],8,["aria-expanded"]),(d(),h(g,{to:o.appendTarget,disabled:o.appendDisabled},[u(y,{name:"p-connected-overlay",onEnter:o.onOverlayEnter,onLeave:o.onOverlayLeave,onAfterLeave:o.onOverlayAfterLeave},{default:m((()=>[n.overlayVisible?(d(),h("div",{key:0,ref:o.overlayRef,class:o.panelStyleClass,onClick:i[12]||(i[12]=(...e)=>o.onOverlayClick&&o.onOverlayClick(...e))},[b(e.$slots,"header",{value:t.modelValue,options:o.visibleOptions}),t.filter?(d(),h("div",I,[u("div",D,[O(u("input",{type:"text",ref:"filterInput","onUpdate:modelValue":i[8]||(i[8]=e=>n.filterValue=e),onVnodeUpdated:i[9]||(i[9]=(...e)=>o.onFilterUpdated&&o.onFilterUpdated(...e)),autoComplete:"off",class:"p-dropdown-filter p-inputtext p-component",placeholder:t.filterPlaceholder,onKeydown:i[10]||(i[10]=(...e)=>o.onFilterKeyDown&&o.onFilterKeyDown(...e)),onInput:i[11]||(i[11]=(...e)=>o.onFilterChange&&o.onFilterChange(...e))},null,40,["placeholder"]),[[w,n.filterValue]]),$])])):c("",!0),u("div",{ref:o.itemsWrapperRef,class:"p-dropdown-items-wrapper",style:{"max-height":o.virtualScrollerDisabled?t.scrollHeight:""}},[u(s,L({ref:o.virtualScrollerRef},t.virtualScrollerOptions,{items:o.visibleOptions,style:{height:t.scrollHeight},disabled:o.virtualScrollerDisabled}),x({content:m((({styleClass:i,contentRef:l,items:s,getItemOptions:a})=>[u("ul",{ref:l,class:["p-dropdown-items",i],role:"listbox"},[t.optionGroupLabel?(d(!0),h(V,{key:1},C(s,((i,t)=>(d(),h(V,{key:o.getOptionGroupRenderKey(i)},[u("li",F,[b(e.$slots,"optiongroup",{option:i,index:o.getOptionIndex(t,a)},(()=>[f(v(o.getOptionGroupLabel(i)),1)]))]),(d(!0),h(V,null,C(o.getOptionGroupChildren(i),((i,t)=>O((d(),h("li",{class:["p-dropdown-item",{"p-highlight":o.isSelected(i),"p-disabled":o.isOptionDisabled(i)}],key:o.getOptionRenderKey(i),onClick:e=>o.onOptionSelect(e,i),role:"option","aria-label":o.getOptionLabel(i),"aria-selected":o.isSelected(i)},[b(e.$slots,"option",{option:i,index:o.getOptionIndex(t,a)},(()=>[f(v(o.getOptionLabel(i)),1)]))],10,["onClick","aria-label","aria-selected"])),[[r]]))),128))],64)))),128)):(d(!0),h(V,{key:0},C(s,((i,t)=>O((d(),h("li",{class:["p-dropdown-item",{"p-highlight":o.isSelected(i),"p-disabled":o.isOptionDisabled(i)}],key:o.getOptionRenderKey(i),onClick:e=>o.onOptionSelect(e,i),role:"option","aria-label":o.getOptionLabel(i),"aria-selected":o.isSelected(i)},[b(e.$slots,"option",{option:i,index:o.getOptionIndex(t,a)},(()=>[f(v(o.getOptionLabel(i)),1)]))],10,["onClick","aria-label","aria-selected"])),[[r]]))),128)),n.filterValue&&(!s||s&&0===s.length)?(d(),h("li",G,[b(e.$slots,"emptyfilter",{},(()=>[f(v(o.emptyFilterMessageText),1)]))])):!t.options||t.options&&0===t.options.length?(d(),h("li",K,[b(e.$slots,"empty",{},(()=>[f(v(o.emptyMessageText),1)]))])):c("",!0)],2)])),_:2},[e.$slots.loader?{name:"loader",fn:m((({options:i})=>[b(e.$slots,"loader",{options:i})]))}:void 0]),1040,["items","style","disabled"])],4),b(e.$slots,"footer",{value:t.modelValue,options:o.visibleOptions})],2)):c("",!0)])),_:3},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"]))],2)};export default S;
|
package/dropdown/dropdown.js
CHANGED
|
@@ -141,20 +141,20 @@ this.primevue.dropdown = (function (utils, OverlayEventBus, api, Ripple, Virtual
|
|
|
141
141
|
},
|
|
142
142
|
getSelectedOption() {
|
|
143
143
|
let index = this.getSelectedOptionIndex();
|
|
144
|
-
return index !== -1 ? (this.optionGroupLabel ? this.getOptionGroupChildren(this.
|
|
144
|
+
return index !== -1 ? (this.optionGroupLabel ? this.getOptionGroupChildren(this.visibleOptions[index.group])[index.option]: this.visibleOptions[index]) : null;
|
|
145
145
|
},
|
|
146
146
|
getSelectedOptionIndex() {
|
|
147
|
-
if (this.modelValue != null && this.
|
|
147
|
+
if (this.modelValue != null && this.visibleOptions) {
|
|
148
148
|
if (this.optionGroupLabel) {
|
|
149
|
-
for (let i = 0; i < this.
|
|
150
|
-
let selectedOptionIndex = this.findOptionIndexInList(this.modelValue, this.getOptionGroupChildren(this.
|
|
149
|
+
for (let i = 0; i < this.visibleOptions.length; i++) {
|
|
150
|
+
let selectedOptionIndex = this.findOptionIndexInList(this.modelValue, this.getOptionGroupChildren(this.visibleOptions[i]));
|
|
151
151
|
if (selectedOptionIndex !== -1) {
|
|
152
152
|
return {group: i, option: selectedOptionIndex};
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
else {
|
|
157
|
-
return this.findOptionIndexInList(this.modelValue, this.
|
|
157
|
+
return this.findOptionIndexInList(this.modelValue, this.visibleOptions);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
|
|
@@ -368,7 +368,6 @@ this.primevue.dropdown = (function (utils, OverlayEventBus, api, Ripple, Virtual
|
|
|
368
368
|
},
|
|
369
369
|
onOverlayEnter(el) {
|
|
370
370
|
utils.ZIndexUtils.set('overlay', el, this.$primevue.config.zIndex.overlay);
|
|
371
|
-
this.scrollValueInView();
|
|
372
371
|
this.alignOverlay();
|
|
373
372
|
this.bindOutsideClickListener();
|
|
374
373
|
this.bindScrollListener();
|
|
@@ -541,6 +540,8 @@ this.primevue.dropdown = (function (utils, OverlayEventBus, api, Ripple, Virtual
|
|
|
541
540
|
},
|
|
542
541
|
onFilterChange(event) {
|
|
543
542
|
this.$emit('filter', {originalEvent: event, value: event.target.value});
|
|
543
|
+
},
|
|
544
|
+
onFilterUpdated() {
|
|
544
545
|
if (this.overlayVisible) {
|
|
545
546
|
this.alignOverlay();
|
|
546
547
|
}
|
|
@@ -585,7 +586,7 @@ this.primevue.dropdown = (function (utils, OverlayEventBus, api, Ripple, Virtual
|
|
|
585
586
|
return filteredGroups
|
|
586
587
|
}
|
|
587
588
|
else {
|
|
588
|
-
return api.FilterService.filter(this.options, this.searchFields, this.filterValue,
|
|
589
|
+
return api.FilterService.filter(this.options, this.searchFields, this.filterValue, this.filterMatchMode, this.filterLocale);
|
|
589
590
|
}
|
|
590
591
|
}
|
|
591
592
|
else {
|
|
@@ -690,7 +691,7 @@ this.primevue.dropdown = (function (utils, OverlayEventBus, api, Ripple, Virtual
|
|
|
690
691
|
return (vue.openBlock(), vue.createBlock("div", {
|
|
691
692
|
ref: "container",
|
|
692
693
|
class: $options.containerClass,
|
|
693
|
-
onClick: _cache[
|
|
694
|
+
onClick: _cache[13] || (_cache[13] = $event => ($options.onClick($event)))
|
|
694
695
|
}, [
|
|
695
696
|
vue.createVNode("div", _hoisted_1, [
|
|
696
697
|
vue.createVNode("input", {
|
|
@@ -769,7 +770,7 @@ this.primevue.dropdown = (function (utils, OverlayEventBus, api, Ripple, Virtual
|
|
|
769
770
|
key: 0,
|
|
770
771
|
ref: $options.overlayRef,
|
|
771
772
|
class: $options.panelStyleClass,
|
|
772
|
-
onClick: _cache[
|
|
773
|
+
onClick: _cache[12] || (_cache[12] = (...args) => ($options.onOverlayClick && $options.onOverlayClick(...args)))
|
|
773
774
|
}, [
|
|
774
775
|
vue.renderSlot(_ctx.$slots, "header", {
|
|
775
776
|
value: $props.modelValue,
|
|
@@ -782,11 +783,12 @@ this.primevue.dropdown = (function (utils, OverlayEventBus, api, Ripple, Virtual
|
|
|
782
783
|
type: "text",
|
|
783
784
|
ref: "filterInput",
|
|
784
785
|
"onUpdate:modelValue": _cache[8] || (_cache[8] = $event => ($data.filterValue = $event)),
|
|
786
|
+
onVnodeUpdated: _cache[9] || (_cache[9] = (...args) => ($options.onFilterUpdated && $options.onFilterUpdated(...args))),
|
|
785
787
|
autoComplete: "off",
|
|
786
788
|
class: "p-dropdown-filter p-inputtext p-component",
|
|
787
789
|
placeholder: $props.filterPlaceholder,
|
|
788
|
-
onKeydown: _cache[
|
|
789
|
-
onInput: _cache[
|
|
790
|
+
onKeydown: _cache[10] || (_cache[10] = (...args) => ($options.onFilterKeyDown && $options.onFilterKeyDown(...args))),
|
|
791
|
+
onInput: _cache[11] || (_cache[11] = (...args) => ($options.onFilterChange && $options.onFilterChange(...args)))
|
|
790
792
|
}, null, 40, ["placeholder"]), [
|
|
791
793
|
[vue.vModelText, $data.filterValue]
|
|
792
794
|
]),
|
package/dropdown/dropdown.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primevue=this.primevue||{},this.primevue.dropdown=function(e,t,i,l,n,o){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=r(t),a=r(l),p=r(n),d={name:"Dropdown",emits:["update:modelValue","before-show","before-hide","show","hide","change","filter","focus","blur"],props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},editable:Boolean,placeholder:String,disabled:Boolean,dataKey:null,showClear:Boolean,inputId:String,tabindex:String,ariaLabelledBy:null,appendTo:{type:String,default:"body"},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},panelClass:null,loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:"pi pi-spinner pi-spin"},virtualScrollerOptions:{type:Object,default:null}},data:()=>({focused:!1,filterValue:null,overlayVisible:!1}),watch:{modelValue(){this.isModelValueChanged=!0}},outsideClickListener:null,scrollHandler:null,resizeListener:null,searchTimeout:null,currentSearchChar:null,previousSearchChar:null,searchValue:null,overlay:null,itemsWrapper:null,virtualScroller:null,isModelValueChanged:!1,updated(){this.overlayVisible&&this.isModelValueChanged&&this.scrollValueInView(),this.isModelValueChanged=!1},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.itemsWrapper=null,this.overlay&&(e.ZIndexUtils.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(t){return this.optionLabel?e.ObjectUtils.resolveFieldData(t,this.optionLabel):t},getOptionValue(t){return this.optionValue?e.ObjectUtils.resolveFieldData(t,this.optionValue):t},getOptionRenderKey(t){return this.dataKey?e.ObjectUtils.resolveFieldData(t,this.dataKey):this.getOptionLabel(t)},isOptionDisabled(t){return!!this.optionDisabled&&e.ObjectUtils.resolveFieldData(t,this.optionDisabled)},getOptionGroupRenderKey(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupLabel(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupChildren(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupChildren)},getSelectedOption(){let e=this.getSelectedOptionIndex();return-1!==e?this.optionGroupLabel?this.getOptionGroupChildren(this.options[e.group])[e.option]:this.options[e]:null},getSelectedOptionIndex(){if(null!=this.modelValue&&this.options){if(!this.optionGroupLabel)return this.findOptionIndexInList(this.modelValue,this.options);for(let e=0;e<this.options.length;e++){let t=this.findOptionIndexInList(this.modelValue,this.getOptionGroupChildren(this.options[e]));if(-1!==t)return{group:e,option:t}}}return-1},findOptionIndexInList(t,i){for(let l=0;l<i.length;l++)if(e.ObjectUtils.equals(t,this.getOptionValue(i[l]),this.equalityKey))return l;return-1},isSelected(t){return e.ObjectUtils.equals(this.modelValue,this.getOptionValue(t),this.equalityKey)},show(){this.$emit("before-show"),this.overlayVisible=!0},hide(){this.$emit("before-hide"),this.overlayVisible=!1},onFocus(e){this.focused=!0,this.$emit("focus",e)},onBlur(e){this.focused=!1,this.$emit("blur",e)},onKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 32:this.overlayVisible||(this.show(),e.preventDefault());break;case 13:case 27:this.overlayVisible&&(this.hide(),e.preventDefault());break;case 9:this.hide();break;default:this.search(e)}},onFilterKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 13:case 27:this.overlayVisible=!1,e.preventDefault()}},onDownKey(e){if(this.visibleOptions)if(!this.overlayVisible&&e.altKey)this.show();else{let t=this.visibleOptions&&this.visibleOptions.length>0?this.findNextOption(this.getSelectedOptionIndex()):null;t&&this.updateModel(e,this.getOptionValue(t))}e.preventDefault()},onUpKey(e){if(this.visibleOptions){let t=this.findPrevOption(this.getSelectedOptionIndex());t&&this.updateModel(e,this.getOptionValue(t))}e.preventDefault()},findNextOption(e){if(this.optionGroupLabel){let t=-1===e?0:e.group,i=-1===e?-1:e.option,l=this.findNextOptionInList(this.getOptionGroupChildren(this.visibleOptions[t]),i);return l||(t+1!==this.visibleOptions.length?this.findNextOption({group:t+1,option:-1}):null)}return this.findNextOptionInList(this.visibleOptions,e)},findNextOptionInList(e,t){let i=t+1;if(i===e.length)return null;let l=e[i];return this.isOptionDisabled(l)?this.findNextOptionInList(i):l},findPrevOption(e){if(-1===e)return null;if(this.optionGroupLabel){let t=e.group,i=e.option,l=this.findPrevOptionInList(this.getOptionGroupChildren(this.visibleOptions[t]),i);return l||(t>0?this.findPrevOption({group:t-1,option:this.getOptionGroupChildren(this.visibleOptions[t-1]).length}):null)}return this.findPrevOptionInList(this.visibleOptions,e)},findPrevOptionInList(e,t){let i=t-1;if(i<0)return null;let l=e[i];return this.isOptionDisabled(l)?this.findPrevOption(i):l},onClearClick(e){this.updateModel(e,null)},onClick(t){this.disabled||this.loading||e.DomHandler.hasClass(t.target,"p-dropdown-clear-icon")||"INPUT"===t.target.tagName||this.overlay&&this.overlay.contains(t.target)||(this.overlayVisible?this.hide():this.show(),this.$refs.focusInput.focus())},onOptionSelect(e,t){let i=this.getOptionValue(t);this.updateModel(e,i),this.$refs.focusInput.focus(),setTimeout((()=>{this.hide()}),200)},onEditableInput(e){this.$emit("update:modelValue",e.target.value)},onOverlayEnter(t){if(e.ZIndexUtils.set("overlay",t,this.$primevue.config.zIndex.overlay),this.scrollValueInView(),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.filter&&this.$refs.filterInput.focus(),!this.virtualScrollerDisabled){const e=this.getSelectedOptionIndex();-1!==e&&this.virtualScroller.scrollToIndex(e)}this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.itemsWrapper=null,this.overlay=null},onOverlayAfterLeave(t){e.ZIndexUtils.clear(t)},alignOverlay(){this.appendDisabled?e.DomHandler.relativePosition(this.overlay,this.$el):(this.overlay.style.minWidth=e.DomHandler.getOuterWidth(this.$el)+"px",e.DomHandler.absolutePosition(this.overlay,this.$el))},updateModel(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&!this.$el.contains(e.target)&&!this.overlay.contains(e.target)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new e.ConnectedOverlayScrollHandler(this.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!e.DomHandler.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},search(e){if(!this.visibleOptions)return;this.searchTimeout&&clearTimeout(this.searchTimeout);const t=e.key;if(this.previousSearchChar=this.currentSearchChar,this.currentSearchChar=t,this.previousSearchChar===this.currentSearchChar?this.searchValue=this.currentSearchChar:this.searchValue=this.searchValue?this.searchValue+t:t,this.searchValue){let t=this.getSelectedOptionIndex(),i=this.optionGroupLabel?this.searchOptionInGroup(t):this.searchOption(++t);i&&this.updateModel(e,this.getOptionValue(i))}this.searchTimeout=setTimeout((()=>{this.searchValue=null}),250)},searchOption(e){let t;return this.searchValue&&(t=this.searchOptionInRange(e,this.visibleOptions.length),t||(t=this.searchOptionInRange(0,e))),t},searchOptionInRange(e,t){for(let i=e;i<t;i++){let e=this.visibleOptions[i];if(this.matchesSearchValue(e))return e}return null},searchOptionInGroup(e){let t=-1===e?{group:0,option:-1}:e;for(let e=t.group;e<this.visibleOptions.length;e++){let i=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=t.group===e?t.option+1:0;l<i.length;l++)if(this.matchesSearchValue(i[l]))return i[l]}for(let e=0;e<=t.group;e++){let i=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=0;l<(t.group===e?t.option:i.length);l++)if(this.matchesSearchValue(i[l]))return i[l]}return null},matchesSearchValue(e){return this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},onFilterChange(e){this.$emit("filter",{originalEvent:e,value:e.target.value}),this.overlayVisible&&this.alignOverlay()},overlayRef(e){this.overlay=e},itemsWrapperRef(e){this.itemsWrapper=e},virtualScrollerRef(e){this.virtualScroller=e},scrollValueInView(){if(this.overlay){let t=e.DomHandler.findSingle(this.overlay,"li.p-highlight");t&&t.scrollIntoView({block:"nearest",inline:"start"})}},onOverlayClick(e){s.default.emit("overlay-click",{originalEvent:e,target:this.$el})}},computed:{visibleOptions(){if(this.filterValue){if(this.optionGroupLabel){let e=[];for(let t of this.options){let l=i.FilterService.filter(this.getOptionGroupChildren(t),this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);if(l&&l.length){let i={...t};i[this.optionGroupChildren]=l,e.push(i)}}return e}return i.FilterService.filter(this.options,this.searchFields,this.filterValue,"contains",this.filterLocale)}return this.options},containerClass(){return["p-dropdown p-component p-inputwrapper",{"p-disabled":this.disabled,"p-dropdown-clearable":this.showClear&&!this.disabled,"p-focus":this.focused,"p-inputwrapper-filled":this.modelValue,"p-inputwrapper-focus":this.focused||this.overlayVisible}]},labelClass(){return["p-dropdown-label p-inputtext",{"p-placeholder":this.label===this.placeholder,"p-dropdown-label-empty":!this.$slots.value&&("p-emptylabel"===this.label||0===this.label.length)}]},panelStyleClass(){return["p-dropdown-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},label(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.placeholder||"p-emptylabel"},editableInputValue(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.modelValue},equalityKey(){return this.optionValue?null:this.dataKey},searchFields(){return this.filterFields||[this.optionLabel]},emptyFilterMessageText(){return this.emptyFilterMessage||this.$primevue.config.locale.emptyFilterMessage},emptyMessageText(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage},appendDisabled(){return"self"===this.appendTo},virtualScrollerDisabled(){return!this.virtualScrollerOptions},appendTarget(){return this.appendDisabled?null:this.appendTo},dropdownIconClass(){return["p-dropdown-trigger-icon",this.loading?this.loadingIcon:"pi pi-chevron-down"]}},directives:{ripple:a.default},components:{VirtualScroller:p.default}};const h={class:"p-hidden-accessible"},u={key:0,class:"p-dropdown-header"},c={class:"p-dropdown-filter-container"},b=o.createVNode("span",{class:"p-dropdown-filter-icon pi pi-search"},null,-1),f={class:"p-dropdown-item-group"},v={key:2,class:"p-dropdown-empty-message"},g={key:3,class:"p-dropdown-empty-message"};return function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&l.firstChild?l.insertBefore(n,l.firstChild):l.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-dropdown {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n cursor: pointer;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-dropdown-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-dropdown-trigger {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n}\n.p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n}\n.p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\ninput.p-dropdown-label {\n cursor: default;\n}\n.p-dropdown .p-dropdown-panel {\n min-width: 100%;\n}\n.p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-dropdown-items-wrapper {\n overflow: auto;\n}\n.p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-dropdown-item-group {\n cursor: auto;\n}\n.p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-dropdown-filter {\n width: 100%;\n}\n.p-dropdown-filter-container {\n position: relative;\n}\n.p-dropdown-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-fluid .p-dropdown {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n}\n"),d.render=function(e,t,i,l,n,r){const s=o.resolveComponent("VirtualScroller"),a=o.resolveDirective("ripple");return o.openBlock(),o.createBlock("div",{ref:"container",class:r.containerClass,onClick:t[12]||(t[12]=e=>r.onClick(e))},[o.createVNode("div",h,[o.createVNode("input",{ref:"focusInput",type:"text",id:i.inputId,readonly:"",disabled:i.disabled,onFocus:t[1]||(t[1]=(...e)=>r.onFocus&&r.onFocus(...e)),onBlur:t[2]||(t[2]=(...e)=>r.onBlur&&r.onBlur(...e)),onKeydown:t[3]||(t[3]=(...e)=>r.onKeyDown&&r.onKeyDown(...e)),tabindex:i.tabindex,"aria-haspopup":"true","aria-expanded":n.overlayVisible,"aria-labelledby":i.ariaLabelledBy},null,40,["id","disabled","tabindex","aria-expanded","aria-labelledby"])]),i.editable?(o.openBlock(),o.createBlock("input",{key:0,type:"text",class:"p-dropdown-label p-inputtext",disabled:i.disabled,onFocus:t[4]||(t[4]=(...e)=>r.onFocus&&r.onFocus(...e)),onBlur:t[5]||(t[5]=(...e)=>r.onBlur&&r.onBlur(...e)),placeholder:i.placeholder,value:r.editableInputValue,onInput:t[6]||(t[6]=(...e)=>r.onEditableInput&&r.onEditableInput(...e)),"aria-haspopup":"listbox","aria-expanded":n.overlayVisible},null,40,["disabled","placeholder","value","aria-expanded"])):o.createCommentVNode("",!0),i.editable?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock("span",{key:1,class:r.labelClass},[o.renderSlot(e.$slots,"value",{value:i.modelValue,placeholder:i.placeholder},(()=>[o.createTextVNode(o.toDisplayString(r.label||"empty"),1)]))],2)),i.showClear&&null!=i.modelValue?(o.openBlock(),o.createBlock("i",{key:2,class:"p-dropdown-clear-icon pi pi-times",onClick:t[7]||(t[7]=e=>r.onClearClick(e))})):o.createCommentVNode("",!0),o.createVNode("div",{class:"p-dropdown-trigger",role:"button","aria-haspopup":"listbox","aria-expanded":n.overlayVisible},[o.renderSlot(e.$slots,"indicator",{},(()=>[o.createVNode("span",{class:r.dropdownIconClass},null,2)]))],8,["aria-expanded"]),(o.openBlock(),o.createBlock(o.Teleport,{to:r.appendTarget,disabled:r.appendDisabled},[o.createVNode(o.Transition,{name:"p-connected-overlay",onEnter:r.onOverlayEnter,onLeave:r.onOverlayLeave,onAfterLeave:r.onOverlayAfterLeave},{default:o.withCtx((()=>[n.overlayVisible?(o.openBlock(),o.createBlock("div",{key:0,ref:r.overlayRef,class:r.panelStyleClass,onClick:t[11]||(t[11]=(...e)=>r.onOverlayClick&&r.onOverlayClick(...e))},[o.renderSlot(e.$slots,"header",{value:i.modelValue,options:r.visibleOptions}),i.filter?(o.openBlock(),o.createBlock("div",u,[o.createVNode("div",c,[o.withDirectives(o.createVNode("input",{type:"text",ref:"filterInput","onUpdate:modelValue":t[8]||(t[8]=e=>n.filterValue=e),autoComplete:"off",class:"p-dropdown-filter p-inputtext p-component",placeholder:i.filterPlaceholder,onKeydown:t[9]||(t[9]=(...e)=>r.onFilterKeyDown&&r.onFilterKeyDown(...e)),onInput:t[10]||(t[10]=(...e)=>r.onFilterChange&&r.onFilterChange(...e))},null,40,["placeholder"]),[[o.vModelText,n.filterValue]]),b])])):o.createCommentVNode("",!0),o.createVNode("div",{ref:r.itemsWrapperRef,class:"p-dropdown-items-wrapper",style:{"max-height":r.virtualScrollerDisabled?i.scrollHeight:""}},[o.createVNode(s,o.mergeProps({ref:r.virtualScrollerRef},i.virtualScrollerOptions,{items:r.visibleOptions,style:{height:i.scrollHeight},disabled:r.virtualScrollerDisabled}),o.createSlots({content:o.withCtx((({styleClass:t,contentRef:l,items:s,getItemOptions:p})=>[o.createVNode("ul",{ref:l,class:["p-dropdown-items",t],role:"listbox"},[i.optionGroupLabel?(o.openBlock(!0),o.createBlock(o.Fragment,{key:1},o.renderList(s,((t,i)=>(o.openBlock(),o.createBlock(o.Fragment,{key:r.getOptionGroupRenderKey(t)},[o.createVNode("li",f,[o.renderSlot(e.$slots,"optiongroup",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionGroupLabel(t)),1)]))]),(o.openBlock(!0),o.createBlock(o.Fragment,null,o.renderList(r.getOptionGroupChildren(t),((t,i)=>o.withDirectives((o.openBlock(),o.createBlock("li",{class:["p-dropdown-item",{"p-highlight":r.isSelected(t),"p-disabled":r.isOptionDisabled(t)}],key:r.getOptionRenderKey(t),onClick:e=>r.onOptionSelect(e,t),role:"option","aria-label":r.getOptionLabel(t),"aria-selected":r.isSelected(t)},[o.renderSlot(e.$slots,"option",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionLabel(t)),1)]))],10,["onClick","aria-label","aria-selected"])),[[a]]))),128))],64)))),128)):(o.openBlock(!0),o.createBlock(o.Fragment,{key:0},o.renderList(s,((t,i)=>o.withDirectives((o.openBlock(),o.createBlock("li",{class:["p-dropdown-item",{"p-highlight":r.isSelected(t),"p-disabled":r.isOptionDisabled(t)}],key:r.getOptionRenderKey(t),onClick:e=>r.onOptionSelect(e,t),role:"option","aria-label":r.getOptionLabel(t),"aria-selected":r.isSelected(t)},[o.renderSlot(e.$slots,"option",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionLabel(t)),1)]))],10,["onClick","aria-label","aria-selected"])),[[a]]))),128)),n.filterValue&&(!s||s&&0===s.length)?(o.openBlock(),o.createBlock("li",v,[o.renderSlot(e.$slots,"emptyfilter",{},(()=>[o.createTextVNode(o.toDisplayString(r.emptyFilterMessageText),1)]))])):!i.options||i.options&&0===i.options.length?(o.openBlock(),o.createBlock("li",g,[o.renderSlot(e.$slots,"empty",{},(()=>[o.createTextVNode(o.toDisplayString(r.emptyMessageText),1)]))])):o.createCommentVNode("",!0)],2)])),_:2},[e.$slots.loader?{name:"loader",fn:o.withCtx((({options:t})=>[o.renderSlot(e.$slots,"loader",{options:t})]))}:void 0]),1040,["items","style","disabled"])],4),o.renderSlot(e.$slots,"footer",{value:i.modelValue,options:r.visibleOptions})],2)):o.createCommentVNode("",!0)])),_:3},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"]))],2)},d}(primevue.utils,primevue.overlayeventbus,primevue.api,primevue.ripple,primevue.virtualscroller,Vue);
|
|
1
|
+
this.primevue=this.primevue||{},this.primevue.dropdown=function(e,t,i,l,n,o){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=r(t),a=r(l),p=r(n),d={name:"Dropdown",emits:["update:modelValue","before-show","before-hide","show","hide","change","filter","focus","blur"],props:{modelValue:null,options:Array,optionLabel:null,optionValue:null,optionDisabled:null,optionGroupLabel:null,optionGroupChildren:null,scrollHeight:{type:String,default:"200px"},filter:Boolean,filterPlaceholder:String,filterLocale:String,filterMatchMode:{type:String,default:"contains"},filterFields:{type:Array,default:null},editable:Boolean,placeholder:String,disabled:Boolean,dataKey:null,showClear:Boolean,inputId:String,tabindex:String,ariaLabelledBy:null,appendTo:{type:String,default:"body"},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},panelClass:null,loading:{type:Boolean,default:!1},loadingIcon:{type:String,default:"pi pi-spinner pi-spin"},virtualScrollerOptions:{type:Object,default:null}},data:()=>({focused:!1,filterValue:null,overlayVisible:!1}),watch:{modelValue(){this.isModelValueChanged=!0}},outsideClickListener:null,scrollHandler:null,resizeListener:null,searchTimeout:null,currentSearchChar:null,previousSearchChar:null,searchValue:null,overlay:null,itemsWrapper:null,virtualScroller:null,isModelValueChanged:!1,updated(){this.overlayVisible&&this.isModelValueChanged&&this.scrollValueInView(),this.isModelValueChanged=!1},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.itemsWrapper=null,this.overlay&&(e.ZIndexUtils.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(t){return this.optionLabel?e.ObjectUtils.resolveFieldData(t,this.optionLabel):t},getOptionValue(t){return this.optionValue?e.ObjectUtils.resolveFieldData(t,this.optionValue):t},getOptionRenderKey(t){return this.dataKey?e.ObjectUtils.resolveFieldData(t,this.dataKey):this.getOptionLabel(t)},isOptionDisabled(t){return!!this.optionDisabled&&e.ObjectUtils.resolveFieldData(t,this.optionDisabled)},getOptionGroupRenderKey(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupLabel(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupLabel)},getOptionGroupChildren(t){return e.ObjectUtils.resolveFieldData(t,this.optionGroupChildren)},getSelectedOption(){let e=this.getSelectedOptionIndex();return-1!==e?this.optionGroupLabel?this.getOptionGroupChildren(this.visibleOptions[e.group])[e.option]:this.visibleOptions[e]:null},getSelectedOptionIndex(){if(null!=this.modelValue&&this.visibleOptions){if(!this.optionGroupLabel)return this.findOptionIndexInList(this.modelValue,this.visibleOptions);for(let e=0;e<this.visibleOptions.length;e++){let t=this.findOptionIndexInList(this.modelValue,this.getOptionGroupChildren(this.visibleOptions[e]));if(-1!==t)return{group:e,option:t}}}return-1},findOptionIndexInList(t,i){for(let l=0;l<i.length;l++)if(e.ObjectUtils.equals(t,this.getOptionValue(i[l]),this.equalityKey))return l;return-1},isSelected(t){return e.ObjectUtils.equals(this.modelValue,this.getOptionValue(t),this.equalityKey)},show(){this.$emit("before-show"),this.overlayVisible=!0},hide(){this.$emit("before-hide"),this.overlayVisible=!1},onFocus(e){this.focused=!0,this.$emit("focus",e)},onBlur(e){this.focused=!1,this.$emit("blur",e)},onKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 32:this.overlayVisible||(this.show(),e.preventDefault());break;case 13:case 27:this.overlayVisible&&(this.hide(),e.preventDefault());break;case 9:this.hide();break;default:this.search(e)}},onFilterKeyDown(e){switch(e.which){case 40:this.onDownKey(e);break;case 38:this.onUpKey(e);break;case 13:case 27:this.overlayVisible=!1,e.preventDefault()}},onDownKey(e){if(this.visibleOptions)if(!this.overlayVisible&&e.altKey)this.show();else{let t=this.visibleOptions&&this.visibleOptions.length>0?this.findNextOption(this.getSelectedOptionIndex()):null;t&&this.updateModel(e,this.getOptionValue(t))}e.preventDefault()},onUpKey(e){if(this.visibleOptions){let t=this.findPrevOption(this.getSelectedOptionIndex());t&&this.updateModel(e,this.getOptionValue(t))}e.preventDefault()},findNextOption(e){if(this.optionGroupLabel){let t=-1===e?0:e.group,i=-1===e?-1:e.option,l=this.findNextOptionInList(this.getOptionGroupChildren(this.visibleOptions[t]),i);return l||(t+1!==this.visibleOptions.length?this.findNextOption({group:t+1,option:-1}):null)}return this.findNextOptionInList(this.visibleOptions,e)},findNextOptionInList(e,t){let i=t+1;if(i===e.length)return null;let l=e[i];return this.isOptionDisabled(l)?this.findNextOptionInList(i):l},findPrevOption(e){if(-1===e)return null;if(this.optionGroupLabel){let t=e.group,i=e.option,l=this.findPrevOptionInList(this.getOptionGroupChildren(this.visibleOptions[t]),i);return l||(t>0?this.findPrevOption({group:t-1,option:this.getOptionGroupChildren(this.visibleOptions[t-1]).length}):null)}return this.findPrevOptionInList(this.visibleOptions,e)},findPrevOptionInList(e,t){let i=t-1;if(i<0)return null;let l=e[i];return this.isOptionDisabled(l)?this.findPrevOption(i):l},onClearClick(e){this.updateModel(e,null)},onClick(t){this.disabled||this.loading||e.DomHandler.hasClass(t.target,"p-dropdown-clear-icon")||"INPUT"===t.target.tagName||this.overlay&&this.overlay.contains(t.target)||(this.overlayVisible?this.hide():this.show(),this.$refs.focusInput.focus())},onOptionSelect(e,t){let i=this.getOptionValue(t);this.updateModel(e,i),this.$refs.focusInput.focus(),setTimeout((()=>{this.hide()}),200)},onEditableInput(e){this.$emit("update:modelValue",e.target.value)},onOverlayEnter(t){if(e.ZIndexUtils.set("overlay",t,this.$primevue.config.zIndex.overlay),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.filter&&this.$refs.filterInput.focus(),!this.virtualScrollerDisabled){const e=this.getSelectedOptionIndex();-1!==e&&this.virtualScroller.scrollToIndex(e)}this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.itemsWrapper=null,this.overlay=null},onOverlayAfterLeave(t){e.ZIndexUtils.clear(t)},alignOverlay(){this.appendDisabled?e.DomHandler.relativePosition(this.overlay,this.$el):(this.overlay.style.minWidth=e.DomHandler.getOuterWidth(this.$el)+"px",e.DomHandler.absolutePosition(this.overlay,this.$el))},updateModel(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.overlayVisible&&this.overlay&&!this.$el.contains(e.target)&&!this.overlay.contains(e.target)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new e.ConnectedOverlayScrollHandler(this.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!e.DomHandler.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},search(e){if(!this.visibleOptions)return;this.searchTimeout&&clearTimeout(this.searchTimeout);const t=e.key;if(this.previousSearchChar=this.currentSearchChar,this.currentSearchChar=t,this.previousSearchChar===this.currentSearchChar?this.searchValue=this.currentSearchChar:this.searchValue=this.searchValue?this.searchValue+t:t,this.searchValue){let t=this.getSelectedOptionIndex(),i=this.optionGroupLabel?this.searchOptionInGroup(t):this.searchOption(++t);i&&this.updateModel(e,this.getOptionValue(i))}this.searchTimeout=setTimeout((()=>{this.searchValue=null}),250)},searchOption(e){let t;return this.searchValue&&(t=this.searchOptionInRange(e,this.visibleOptions.length),t||(t=this.searchOptionInRange(0,e))),t},searchOptionInRange(e,t){for(let i=e;i<t;i++){let e=this.visibleOptions[i];if(this.matchesSearchValue(e))return e}return null},searchOptionInGroup(e){let t=-1===e?{group:0,option:-1}:e;for(let e=t.group;e<this.visibleOptions.length;e++){let i=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=t.group===e?t.option+1:0;l<i.length;l++)if(this.matchesSearchValue(i[l]))return i[l]}for(let e=0;e<=t.group;e++){let i=this.getOptionGroupChildren(this.visibleOptions[e]);for(let l=0;l<(t.group===e?t.option:i.length);l++)if(this.matchesSearchValue(i[l]))return i[l]}return null},matchesSearchValue(e){return this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},onFilterChange(e){this.$emit("filter",{originalEvent:e,value:e.target.value})},onFilterUpdated(){this.overlayVisible&&this.alignOverlay()},overlayRef(e){this.overlay=e},itemsWrapperRef(e){this.itemsWrapper=e},virtualScrollerRef(e){this.virtualScroller=e},scrollValueInView(){if(this.overlay){let t=e.DomHandler.findSingle(this.overlay,"li.p-highlight");t&&t.scrollIntoView({block:"nearest",inline:"start"})}},onOverlayClick(e){s.default.emit("overlay-click",{originalEvent:e,target:this.$el})}},computed:{visibleOptions(){if(this.filterValue){if(this.optionGroupLabel){let e=[];for(let t of this.options){let l=i.FilterService.filter(this.getOptionGroupChildren(t),this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);if(l&&l.length){let i={...t};i[this.optionGroupChildren]=l,e.push(i)}}return e}return i.FilterService.filter(this.options,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale)}return this.options},containerClass(){return["p-dropdown p-component p-inputwrapper",{"p-disabled":this.disabled,"p-dropdown-clearable":this.showClear&&!this.disabled,"p-focus":this.focused,"p-inputwrapper-filled":this.modelValue,"p-inputwrapper-focus":this.focused||this.overlayVisible}]},labelClass(){return["p-dropdown-label p-inputtext",{"p-placeholder":this.label===this.placeholder,"p-dropdown-label-empty":!this.$slots.value&&("p-emptylabel"===this.label||0===this.label.length)}]},panelStyleClass(){return["p-dropdown-panel p-component",this.panelClass,{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},label(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.placeholder||"p-emptylabel"},editableInputValue(){let e=this.getSelectedOption();return e?this.getOptionLabel(e):this.modelValue},equalityKey(){return this.optionValue?null:this.dataKey},searchFields(){return this.filterFields||[this.optionLabel]},emptyFilterMessageText(){return this.emptyFilterMessage||this.$primevue.config.locale.emptyFilterMessage},emptyMessageText(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage},appendDisabled(){return"self"===this.appendTo},virtualScrollerDisabled(){return!this.virtualScrollerOptions},appendTarget(){return this.appendDisabled?null:this.appendTo},dropdownIconClass(){return["p-dropdown-trigger-icon",this.loading?this.loadingIcon:"pi pi-chevron-down"]}},directives:{ripple:a.default},components:{VirtualScroller:p.default}};const h={class:"p-hidden-accessible"},u={key:0,class:"p-dropdown-header"},c={class:"p-dropdown-filter-container"},b=o.createVNode("span",{class:"p-dropdown-filter-icon pi pi-search"},null,-1),f={class:"p-dropdown-item-group"},v={key:2,class:"p-dropdown-empty-message"},g={key:3,class:"p-dropdown-empty-message"};return function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&l.firstChild?l.insertBefore(n,l.firstChild):l.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-dropdown {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n cursor: pointer;\n position: relative;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n.p-dropdown-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-dropdown-trigger {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n}\n.p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n}\n.p-dropdown-label-empty {\n overflow: hidden;\n visibility: hidden;\n}\ninput.p-dropdown-label {\n cursor: default;\n}\n.p-dropdown .p-dropdown-panel {\n min-width: 100%;\n}\n.p-dropdown-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-dropdown-items-wrapper {\n overflow: auto;\n}\n.p-dropdown-item {\n cursor: pointer;\n font-weight: normal;\n white-space: nowrap;\n position: relative;\n overflow: hidden;\n}\n.p-dropdown-item-group {\n cursor: auto;\n}\n.p-dropdown-items {\n margin: 0;\n padding: 0;\n list-style-type: none;\n}\n.p-dropdown-filter {\n width: 100%;\n}\n.p-dropdown-filter-container {\n position: relative;\n}\n.p-dropdown-filter-icon {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n}\n.p-fluid .p-dropdown {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n}\n"),d.render=function(e,t,i,l,n,r){const s=o.resolveComponent("VirtualScroller"),a=o.resolveDirective("ripple");return o.openBlock(),o.createBlock("div",{ref:"container",class:r.containerClass,onClick:t[13]||(t[13]=e=>r.onClick(e))},[o.createVNode("div",h,[o.createVNode("input",{ref:"focusInput",type:"text",id:i.inputId,readonly:"",disabled:i.disabled,onFocus:t[1]||(t[1]=(...e)=>r.onFocus&&r.onFocus(...e)),onBlur:t[2]||(t[2]=(...e)=>r.onBlur&&r.onBlur(...e)),onKeydown:t[3]||(t[3]=(...e)=>r.onKeyDown&&r.onKeyDown(...e)),tabindex:i.tabindex,"aria-haspopup":"true","aria-expanded":n.overlayVisible,"aria-labelledby":i.ariaLabelledBy},null,40,["id","disabled","tabindex","aria-expanded","aria-labelledby"])]),i.editable?(o.openBlock(),o.createBlock("input",{key:0,type:"text",class:"p-dropdown-label p-inputtext",disabled:i.disabled,onFocus:t[4]||(t[4]=(...e)=>r.onFocus&&r.onFocus(...e)),onBlur:t[5]||(t[5]=(...e)=>r.onBlur&&r.onBlur(...e)),placeholder:i.placeholder,value:r.editableInputValue,onInput:t[6]||(t[6]=(...e)=>r.onEditableInput&&r.onEditableInput(...e)),"aria-haspopup":"listbox","aria-expanded":n.overlayVisible},null,40,["disabled","placeholder","value","aria-expanded"])):o.createCommentVNode("",!0),i.editable?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock("span",{key:1,class:r.labelClass},[o.renderSlot(e.$slots,"value",{value:i.modelValue,placeholder:i.placeholder},(()=>[o.createTextVNode(o.toDisplayString(r.label||"empty"),1)]))],2)),i.showClear&&null!=i.modelValue?(o.openBlock(),o.createBlock("i",{key:2,class:"p-dropdown-clear-icon pi pi-times",onClick:t[7]||(t[7]=e=>r.onClearClick(e))})):o.createCommentVNode("",!0),o.createVNode("div",{class:"p-dropdown-trigger",role:"button","aria-haspopup":"listbox","aria-expanded":n.overlayVisible},[o.renderSlot(e.$slots,"indicator",{},(()=>[o.createVNode("span",{class:r.dropdownIconClass},null,2)]))],8,["aria-expanded"]),(o.openBlock(),o.createBlock(o.Teleport,{to:r.appendTarget,disabled:r.appendDisabled},[o.createVNode(o.Transition,{name:"p-connected-overlay",onEnter:r.onOverlayEnter,onLeave:r.onOverlayLeave,onAfterLeave:r.onOverlayAfterLeave},{default:o.withCtx((()=>[n.overlayVisible?(o.openBlock(),o.createBlock("div",{key:0,ref:r.overlayRef,class:r.panelStyleClass,onClick:t[12]||(t[12]=(...e)=>r.onOverlayClick&&r.onOverlayClick(...e))},[o.renderSlot(e.$slots,"header",{value:i.modelValue,options:r.visibleOptions}),i.filter?(o.openBlock(),o.createBlock("div",u,[o.createVNode("div",c,[o.withDirectives(o.createVNode("input",{type:"text",ref:"filterInput","onUpdate:modelValue":t[8]||(t[8]=e=>n.filterValue=e),onVnodeUpdated:t[9]||(t[9]=(...e)=>r.onFilterUpdated&&r.onFilterUpdated(...e)),autoComplete:"off",class:"p-dropdown-filter p-inputtext p-component",placeholder:i.filterPlaceholder,onKeydown:t[10]||(t[10]=(...e)=>r.onFilterKeyDown&&r.onFilterKeyDown(...e)),onInput:t[11]||(t[11]=(...e)=>r.onFilterChange&&r.onFilterChange(...e))},null,40,["placeholder"]),[[o.vModelText,n.filterValue]]),b])])):o.createCommentVNode("",!0),o.createVNode("div",{ref:r.itemsWrapperRef,class:"p-dropdown-items-wrapper",style:{"max-height":r.virtualScrollerDisabled?i.scrollHeight:""}},[o.createVNode(s,o.mergeProps({ref:r.virtualScrollerRef},i.virtualScrollerOptions,{items:r.visibleOptions,style:{height:i.scrollHeight},disabled:r.virtualScrollerDisabled}),o.createSlots({content:o.withCtx((({styleClass:t,contentRef:l,items:s,getItemOptions:p})=>[o.createVNode("ul",{ref:l,class:["p-dropdown-items",t],role:"listbox"},[i.optionGroupLabel?(o.openBlock(!0),o.createBlock(o.Fragment,{key:1},o.renderList(s,((t,i)=>(o.openBlock(),o.createBlock(o.Fragment,{key:r.getOptionGroupRenderKey(t)},[o.createVNode("li",f,[o.renderSlot(e.$slots,"optiongroup",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionGroupLabel(t)),1)]))]),(o.openBlock(!0),o.createBlock(o.Fragment,null,o.renderList(r.getOptionGroupChildren(t),((t,i)=>o.withDirectives((o.openBlock(),o.createBlock("li",{class:["p-dropdown-item",{"p-highlight":r.isSelected(t),"p-disabled":r.isOptionDisabled(t)}],key:r.getOptionRenderKey(t),onClick:e=>r.onOptionSelect(e,t),role:"option","aria-label":r.getOptionLabel(t),"aria-selected":r.isSelected(t)},[o.renderSlot(e.$slots,"option",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionLabel(t)),1)]))],10,["onClick","aria-label","aria-selected"])),[[a]]))),128))],64)))),128)):(o.openBlock(!0),o.createBlock(o.Fragment,{key:0},o.renderList(s,((t,i)=>o.withDirectives((o.openBlock(),o.createBlock("li",{class:["p-dropdown-item",{"p-highlight":r.isSelected(t),"p-disabled":r.isOptionDisabled(t)}],key:r.getOptionRenderKey(t),onClick:e=>r.onOptionSelect(e,t),role:"option","aria-label":r.getOptionLabel(t),"aria-selected":r.isSelected(t)},[o.renderSlot(e.$slots,"option",{option:t,index:r.getOptionIndex(i,p)},(()=>[o.createTextVNode(o.toDisplayString(r.getOptionLabel(t)),1)]))],10,["onClick","aria-label","aria-selected"])),[[a]]))),128)),n.filterValue&&(!s||s&&0===s.length)?(o.openBlock(),o.createBlock("li",v,[o.renderSlot(e.$slots,"emptyfilter",{},(()=>[o.createTextVNode(o.toDisplayString(r.emptyFilterMessageText),1)]))])):!i.options||i.options&&0===i.options.length?(o.openBlock(),o.createBlock("li",g,[o.renderSlot(e.$slots,"empty",{},(()=>[o.createTextVNode(o.toDisplayString(r.emptyMessageText),1)]))])):o.createCommentVNode("",!0)],2)])),_:2},[e.$slots.loader?{name:"loader",fn:o.withCtx((({options:t})=>[o.renderSlot(e.$slots,"loader",{options:t})]))}:void 0]),1040,["items","style","disabled"])],4),o.renderSlot(e.$slots,"footer",{value:i.modelValue,options:r.visibleOptions})],2)):o.createCommentVNode("",!0)])),_:3},8,["onEnter","onLeave","onAfterLeave"])],8,["to","disabled"]))],2)},d}(primevue.utils,primevue.overlayeventbus,primevue.api,primevue.ripple,primevue.virtualscroller,Vue);
|
package/galleria/Galleria.vue
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
@start-slideshow="startSlideShow" @stop-slideshow="stopSlideShow" />
|
|
14
14
|
|
|
15
15
|
<GalleriaThumbnails v-if="$attrs.showThumbnails" :containerId="id" :value="$attrs.value" v-model:activeIndex="activeIndex" :templates="$attrs.templates"
|
|
16
|
-
:numVisible="
|
|
16
|
+
:numVisible="numVisible" :responsiveOptions="$attrs.responsiveOptions" :circular="$attrs.circular"
|
|
17
17
|
:isVertical="isVertical()" :contentHeight="$attrs.verticalThumbnailViewPortHeight" :showThumbnailNavigators="$attrs.showThumbnailNavigators"
|
|
18
18
|
v-model:slideShowActive="slideShowActive" @stop-slideshow="stopSlideShow" />
|
|
19
19
|
</div>
|
|
@@ -39,12 +39,21 @@ export default {
|
|
|
39
39
|
return {
|
|
40
40
|
id: this.$attrs.id || UniqueComponentId(),
|
|
41
41
|
activeIndex: this.$attrs.activeIndex,
|
|
42
|
+
numVisible: this.$attrs.numVisible,
|
|
42
43
|
slideShowActive: false
|
|
43
44
|
}
|
|
44
45
|
},
|
|
45
46
|
watch: {
|
|
47
|
+
'$attrs.value': function(newVal) {
|
|
48
|
+
if (newVal && newVal.length < this.numVisible) {
|
|
49
|
+
this.numVisible = newVal.length;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
46
52
|
'$attrs.activeIndex': function(newVal) {
|
|
47
53
|
this.activeIndex = newVal;
|
|
54
|
+
},
|
|
55
|
+
'$attrs.numVisible': function(newVal) {
|
|
56
|
+
this.numVisible = newVal;
|
|
48
57
|
}
|
|
49
58
|
},
|
|
50
59
|
updated() {
|
package/galleria/galleria.cjs.js
CHANGED
|
@@ -757,12 +757,21 @@ var script$1 = {
|
|
|
757
757
|
return {
|
|
758
758
|
id: this.$attrs.id || utils.UniqueComponentId(),
|
|
759
759
|
activeIndex: this.$attrs.activeIndex,
|
|
760
|
+
numVisible: this.$attrs.numVisible,
|
|
760
761
|
slideShowActive: false
|
|
761
762
|
}
|
|
762
763
|
},
|
|
763
764
|
watch: {
|
|
765
|
+
'$attrs.value': function(newVal) {
|
|
766
|
+
if (newVal && newVal.length < this.numVisible) {
|
|
767
|
+
this.numVisible = newVal.length;
|
|
768
|
+
}
|
|
769
|
+
},
|
|
764
770
|
'$attrs.activeIndex': function(newVal) {
|
|
765
771
|
this.activeIndex = newVal;
|
|
772
|
+
},
|
|
773
|
+
'$attrs.numVisible': function(newVal) {
|
|
774
|
+
this.numVisible = newVal;
|
|
766
775
|
}
|
|
767
776
|
},
|
|
768
777
|
updated() {
|
|
@@ -888,7 +897,7 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
888
897
|
activeIndex: $data.activeIndex,
|
|
889
898
|
"onUpdate:activeIndex": _cache[4] || (_cache[4] = $event => ($data.activeIndex = $event)),
|
|
890
899
|
templates: _ctx.$attrs.templates,
|
|
891
|
-
numVisible:
|
|
900
|
+
numVisible: $data.numVisible,
|
|
892
901
|
responsiveOptions: _ctx.$attrs.responsiveOptions,
|
|
893
902
|
circular: _ctx.$attrs.circular,
|
|
894
903
|
isVertical: $options.isVertical(),
|
|
@@ -1152,7 +1161,7 @@ function styleInject(css, ref) {
|
|
|
1152
1161
|
}
|
|
1153
1162
|
}
|
|
1154
1163
|
|
|
1155
|
-
var css_248z = "\n.p-galleria-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.p-galleria-item-wrapper {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n position: relative;\n}\n.p-galleria-item-container {\n position: relative;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n height: 100%;\n}\n.p-galleria-item-nav {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n overflow: hidden;\n}\n.p-galleria-item-prev {\n left: 0;\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n.p-galleria-item-next {\n right: 0;\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.p-galleria-item {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n height: 100%;\n width: 100%;\n}\n.p-galleria-item-nav-onhover .p-galleria-item-nav {\n pointer-events: none;\n opacity: 0;\n -webkit-transition: opacity .2s ease-in-out;\n transition: opacity .2s ease-in-out;\n}\n.p-galleria-item-nav-onhover .p-galleria-item-wrapper:hover .p-galleria-item-nav {\n pointer-events: all;\n opacity: 1;\n}\n.p-galleria-item-nav-onhover .p-galleria-item-wrapper:hover .p-galleria-item-nav.p-disabled {\n pointer-events: none;\n}\n.p-galleria-caption {\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n}\n\n/* Thumbnails */\n.p-galleria-thumbnail-wrapper {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n overflow: auto;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n}\n.p-galleria-thumbnail-prev,\n.p-galleria-thumbnail-next {\n -ms-flex-item-align: center;\n align-self: center;\n -webkit-box-flex: 0;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n overflow: hidden;\n position: relative;\n}\n.p-galleria-thumbnail-prev span,\n.p-galleria-thumbnail-next span {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.p-galleria-thumbnail-container {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n}\n.p-galleria-thumbnail-items-container {\n overflow: hidden;\n}\n.p-galleria-thumbnail-items {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-galleria-thumbnail-item {\n overflow: auto;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n cursor: pointer;\n opacity: .5;\n}\n.p-galleria-thumbnail-item:hover {\n opacity: 1;\n -webkit-transition: opacity .3s;\n transition: opacity .3s;\n}\n.p-galleria-thumbnail-item-current {\n opacity: 1;\n}\n\n/* Positions */\n/* Thumbnails */\n.p-galleria-thumbnails-left .p-galleria-content,\n.p-galleria-thumbnails-right .p-galleria-content {\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n}\n.p-galleria-thumbnails-left .p-galleria-item-wrapper,\n.p-galleria-thumbnails-right .p-galleria-item-wrapper {\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n}\n.p-galleria-thumbnails-left .p-galleria-item-wrapper,\n.p-galleria-thumbnails-top .p-galleria-item-wrapper {\n -webkit-box-ordinal-group: 3;\n -ms-flex-order: 2;\n order: 2;\n}\n.p-galleria-thumbnails-left .p-galleria-thumbnail-wrapper,\n.p-galleria-thumbnails-top .p-galleria-thumbnail-wrapper {\n -webkit-box-ordinal-group: 2;\n -ms-flex-order: 1;\n order: 1;\n}\n.p-galleria-thumbnails-left .p-galleria-thumbnail-container,\n.p-galleria-thumbnails-right .p-galleria-thumbnail-container {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n -webkit-box-flex: 1;\n -ms-flex-positive: 1;\n flex-grow: 1;\n}\n.p-galleria-thumbnails-left .p-galleria-thumbnail-items,\n.p-galleria-thumbnails-right .p-galleria-thumbnail-items {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n height: 100%;\n}\n\n/* Indicators */\n.p-galleria-indicators {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.p-galleria-indicator > button {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.p-galleria-indicators-left .p-galleria-item-wrapper,\n.p-galleria-indicators-right .p-galleria-item-wrapper {\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.p-galleria-indicators-left .p-galleria-item-container,\n.p-galleria-indicators-top .p-galleria-item-container {\n -webkit-box-ordinal-group: 3;\n -ms-flex-order: 2;\n order: 2;\n}\n.p-galleria-indicators-left .p-galleria-indicators,\n.p-galleria-indicators-top .p-galleria-indicators {\n -webkit-box-ordinal-group: 2;\n -ms-flex-order: 1;\n order: 1;\n}\n.p-galleria-indicators-left .p-galleria-indicators,\n.p-galleria-indicators-right .p-galleria-indicators {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.p-galleria-indicator-onitem .p-galleria-indicators {\n position: absolute;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-galleria-indicator-onitem.p-galleria-indicators-top .p-galleria-indicators {\n top: 0;\n left: 0;\n width: 100%;\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n}\n.p-galleria-indicator-onitem.p-galleria-indicators-right .p-galleria-indicators {\n right: 0;\n top: 0;\n height: 100%;\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n}\n.p-galleria-indicator-onitem.p-galleria-indicators-bottom .p-galleria-indicators {\n bottom: 0;\n left: 0;\n width: 100%;\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n}\n.p-galleria-indicator-onitem.p-galleria-indicators-left .p-galleria-indicators {\n left: 0;\n top: 0;\n height: 100%;\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n}\n\n/* FullScreen */\n.p-galleria-mask {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.p-galleria-close {\n position: absolute;\n top: 0;\n right: 0;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n overflow: hidden;\n}\n.p-galleria-mask .p-galleria-item-nav {\n position: fixed;\n top: 50%;\n margin-top: -.5rem;\n}\n\n/* Animation */\n.p-galleria-enter-active {\n -webkit-transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n}\n.p-galleria-leave-active {\n -webkit-transition: all 150ms cubic-bezier(0.4, 0.0, 0.2, 1);\n transition: all 150ms cubic-bezier(0.4, 0.0, 0.2, 1);\n}\n.p-galleria-enter-from,\n.p-galleria-leave-to {\n opacity: 0;\n -webkit-transform: scale(0.7);\n transform: scale(0.7);\n}\n.p-galleria-enter-active .p-galleria-item-nav {\n opacity: 0;\n}\n\n/* Keyboard Support */\n.p-items-hidden .p-galleria-thumbnail-item {\n visibility: hidden;\n}\n.p-items-hidden .p-galleria-thumbnail-item.p-galleria-thumbnail-item-active {\n visibility: visible;\n}\n";
|
|
1164
|
+
var css_248z = "\n.p-galleria-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.p-galleria-item-wrapper {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n position: relative;\n}\n.p-galleria-item-container {\n position: relative;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n height: 100%;\n}\n.p-galleria-item-nav {\n position: absolute;\n top: 50%;\n margin-top: -.5rem;\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n overflow: hidden;\n}\n.p-galleria-item-prev {\n left: 0;\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n}\n.p-galleria-item-next {\n right: 0;\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n}\n.p-galleria-item {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n height: 100%;\n width: 100%;\n}\n.p-galleria-item-nav-onhover .p-galleria-item-nav {\n pointer-events: none;\n opacity: 0;\n -webkit-transition: opacity .2s ease-in-out;\n transition: opacity .2s ease-in-out;\n}\n.p-galleria-item-nav-onhover .p-galleria-item-wrapper:hover .p-galleria-item-nav {\n pointer-events: all;\n opacity: 1;\n}\n.p-galleria-item-nav-onhover .p-galleria-item-wrapper:hover .p-galleria-item-nav.p-disabled {\n pointer-events: none;\n}\n.p-galleria-caption {\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n}\n\n/* Thumbnails */\n.p-galleria-thumbnail-wrapper {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n overflow: auto;\n -ms-flex-negative: 0;\n flex-shrink: 0;\n}\n.p-galleria-thumbnail-prev,\n.p-galleria-thumbnail-next {\n -ms-flex-item-align: center;\n align-self: center;\n -webkit-box-flex: 0;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n overflow: hidden;\n position: relative;\n}\n.p-galleria-thumbnail-prev span,\n.p-galleria-thumbnail-next span {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.p-galleria-thumbnail-container {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n}\n.p-galleria-thumbnail-items-container {\n overflow: hidden;\n width: 100%;\n}\n.p-galleria-thumbnail-items {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-galleria-thumbnail-item {\n overflow: auto;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n cursor: pointer;\n opacity: .5;\n}\n.p-galleria-thumbnail-item:hover {\n opacity: 1;\n -webkit-transition: opacity .3s;\n transition: opacity .3s;\n}\n.p-galleria-thumbnail-item-current {\n opacity: 1;\n}\n\n/* Positions */\n/* Thumbnails */\n.p-galleria-thumbnails-left .p-galleria-content,\n.p-galleria-thumbnails-right .p-galleria-content {\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n}\n.p-galleria-thumbnails-left .p-galleria-item-wrapper,\n.p-galleria-thumbnails-right .p-galleria-item-wrapper {\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n}\n.p-galleria-thumbnails-left .p-galleria-item-wrapper,\n.p-galleria-thumbnails-top .p-galleria-item-wrapper {\n -webkit-box-ordinal-group: 3;\n -ms-flex-order: 2;\n order: 2;\n}\n.p-galleria-thumbnails-left .p-galleria-thumbnail-wrapper,\n.p-galleria-thumbnails-top .p-galleria-thumbnail-wrapper {\n -webkit-box-ordinal-group: 2;\n -ms-flex-order: 1;\n order: 1;\n}\n.p-galleria-thumbnails-left .p-galleria-thumbnail-container,\n.p-galleria-thumbnails-right .p-galleria-thumbnail-container {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n -webkit-box-flex: 1;\n -ms-flex-positive: 1;\n flex-grow: 1;\n}\n.p-galleria-thumbnails-left .p-galleria-thumbnail-items,\n.p-galleria-thumbnails-right .p-galleria-thumbnail-items {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n height: 100%;\n}\n\n/* Indicators */\n.p-galleria-indicators {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.p-galleria-indicator > button {\n display: -webkit-inline-box;\n display: -ms-inline-flexbox;\n display: inline-flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.p-galleria-indicators-left .p-galleria-item-wrapper,\n.p-galleria-indicators-right .p-galleria-item-wrapper {\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n.p-galleria-indicators-left .p-galleria-item-container,\n.p-galleria-indicators-top .p-galleria-item-container {\n -webkit-box-ordinal-group: 3;\n -ms-flex-order: 2;\n order: 2;\n}\n.p-galleria-indicators-left .p-galleria-indicators,\n.p-galleria-indicators-top .p-galleria-indicators {\n -webkit-box-ordinal-group: 2;\n -ms-flex-order: 1;\n order: 1;\n}\n.p-galleria-indicators-left .p-galleria-indicators,\n.p-galleria-indicators-right .p-galleria-indicators {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.p-galleria-indicator-onitem .p-galleria-indicators {\n position: absolute;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.p-galleria-indicator-onitem.p-galleria-indicators-top .p-galleria-indicators {\n top: 0;\n left: 0;\n width: 100%;\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n}\n.p-galleria-indicator-onitem.p-galleria-indicators-right .p-galleria-indicators {\n right: 0;\n top: 0;\n height: 100%;\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n}\n.p-galleria-indicator-onitem.p-galleria-indicators-bottom .p-galleria-indicators {\n bottom: 0;\n left: 0;\n width: 100%;\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n}\n.p-galleria-indicator-onitem.p-galleria-indicators-left .p-galleria-indicators {\n left: 0;\n top: 0;\n height: 100%;\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n}\n\n/* FullScreen */\n.p-galleria-mask {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.p-galleria-close {\n position: absolute;\n top: 0;\n right: 0;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n overflow: hidden;\n}\n.p-galleria-mask .p-galleria-item-nav {\n position: fixed;\n top: 50%;\n margin-top: -.5rem;\n}\n\n/* Animation */\n.p-galleria-enter-active {\n -webkit-transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n}\n.p-galleria-leave-active {\n -webkit-transition: all 150ms cubic-bezier(0.4, 0.0, 0.2, 1);\n transition: all 150ms cubic-bezier(0.4, 0.0, 0.2, 1);\n}\n.p-galleria-enter-from,\n.p-galleria-leave-to {\n opacity: 0;\n -webkit-transform: scale(0.7);\n transform: scale(0.7);\n}\n.p-galleria-enter-active .p-galleria-item-nav {\n opacity: 0;\n}\n\n/* Keyboard Support */\n.p-items-hidden .p-galleria-thumbnail-item {\n visibility: hidden;\n}\n.p-items-hidden .p-galleria-thumbnail-item.p-galleria-thumbnail-item-active {\n visibility: visible;\n}\n";
|
|
1156
1165
|
styleInject(css_248z);
|
|
1157
1166
|
|
|
1158
1167
|
script.render = render;
|