primevue 3.25.0 → 3.26.0

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.
Files changed (60) hide show
  1. package/README.md +60 -178
  2. package/api/Api.d.ts +4 -12
  3. package/confirmdialog/ConfirmDialog.d.ts +5 -0
  4. package/confirmdialog/ConfirmDialog.vue +17 -1
  5. package/confirmdialog/confirmdialog.cjs.js +7 -2
  6. package/confirmdialog/confirmdialog.cjs.min.js +1 -1
  7. package/confirmdialog/confirmdialog.esm.js +7 -2
  8. package/confirmdialog/confirmdialog.esm.min.js +1 -1
  9. package/confirmdialog/confirmdialog.js +7 -2
  10. package/confirmdialog/confirmdialog.min.js +1 -1
  11. package/core/core.js +1 -1
  12. package/core/core.min.js +1 -1
  13. package/dropdown/Dropdown.vue +1 -1
  14. package/dropdown/dropdown.cjs.js +1 -1
  15. package/dropdown/dropdown.cjs.min.js +1 -1
  16. package/dropdown/dropdown.esm.js +1 -1
  17. package/dropdown/dropdown.esm.min.js +1 -1
  18. package/dropdown/dropdown.js +1 -1
  19. package/dropdown/dropdown.min.js +1 -1
  20. package/inplace/Inplace.vue +5 -1
  21. package/inplace/inplace.cjs.js +10 -2
  22. package/inplace/inplace.cjs.min.js +1 -1
  23. package/inplace/inplace.esm.js +10 -3
  24. package/inplace/inplace.esm.min.js +1 -1
  25. package/inplace/inplace.js +11 -4
  26. package/inplace/inplace.min.js +1 -1
  27. package/package.json +1 -1
  28. package/panel/Panel.d.ts +2 -2
  29. package/slider/Slider.vue +3 -14
  30. package/slider/slider.cjs.js +3 -14
  31. package/slider/slider.cjs.min.js +1 -1
  32. package/slider/slider.esm.js +3 -14
  33. package/slider/slider.esm.min.js +1 -1
  34. package/slider/slider.js +3 -14
  35. package/slider/slider.min.js +1 -1
  36. package/splitbutton/SplitButton.vue +4 -2
  37. package/splitbutton/splitbutton.cjs.js +6 -4
  38. package/splitbutton/splitbutton.cjs.min.js +1 -1
  39. package/splitbutton/splitbutton.esm.js +6 -4
  40. package/splitbutton/splitbutton.esm.min.js +1 -1
  41. package/splitbutton/splitbutton.js +6 -4
  42. package/splitbutton/splitbutton.min.js +1 -1
  43. package/toast/Toast.d.ts +0 -1
  44. package/treetable/TreeTable.vue +3 -3
  45. package/treetable/treetable.cjs.js +3 -3
  46. package/treetable/treetable.cjs.min.js +1 -1
  47. package/treetable/treetable.esm.js +3 -3
  48. package/treetable/treetable.esm.min.js +1 -1
  49. package/treetable/treetable.js +3 -3
  50. package/treetable/treetable.min.js +1 -1
  51. package/tristatecheckbox/TriStateCheckbox.vue +1 -1
  52. package/tristatecheckbox/tristatecheckbox.cjs.js +1 -1
  53. package/tristatecheckbox/tristatecheckbox.cjs.min.js +1 -1
  54. package/tristatecheckbox/tristatecheckbox.esm.js +1 -1
  55. package/tristatecheckbox/tristatecheckbox.esm.min.js +1 -1
  56. package/tristatecheckbox/tristatecheckbox.js +1 -1
  57. package/tristatecheckbox/tristatecheckbox.min.js +1 -1
  58. package/vetur-attributes.json +4 -0
  59. package/vetur-tags.json +2 -1
  60. package/web-types.json +11 -1
@@ -1 +1 @@
1
- this.primevue=this.primevue||{},this.primevue.dropdown=function(e,t,i,n,o,s,l){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=r(t),d=r(i),p=r(n),c=r(s),u={name:"Dropdown",emits:["update:modelValue","change","focus","blur","before-show","before-hide","show","hide","filter"],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:{type:String,default:null},disabled:{type:Boolean,default:!1},dataKey:null,showClear:{type:Boolean,default:!1},inputId:{type:String,default:null},inputClass:{type:[String,Object],default:null},inputStyle:{type:Object,default:null},inputProps:{type:null,default:null},panelClass:{type:[String,Object],default:null},panelStyle:{type:Object,default:null},panelProps:{type:null,default:null},filterInputProps:{type:null,default:null},clearIconProps:{type:null,default:null},appendTo:{type:String,default:"body"},loading:{type:Boolean,default:!1},clearIcon:{type:String,default:"pi pi-times"},dropdownIcon:{type:String,default:"pi pi-chevron-down"},filterIcon:{type:String,default:"pi pi-search"},loadingIcon:{type:String,default:"pi pi-spinner pi-spin"},resetFilterOnHide:{type:Boolean,default:!1},virtualScrollerOptions:{type:Object,default:null},autoOptionFocus:{type:Boolean,default:!0},autoFilterFocus:{type:Boolean,default:!1},selectOnFocus:{type:Boolean,default:!1},filterMessage:{type:String,default:null},selectionMessage:{type:String,default:null},emptySelectionMessage:{type:String,default:null},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},tabindex:{type:Number,default:0},"aria-label":{type:String,default:null},"aria-labelledby":{type:String,default:null}},outsideClickListener:null,scrollHandler:null,resizeListener:null,overlay:null,list:null,virtualScroller:null,searchTimeout:null,searchValue:null,isModelValueChanged:!1,focusOnHover:!1,data(){return{id:this.$attrs.id,focused:!1,focusedOptionIndex:-1,filterValue:null,overlayVisible:!1}},watch:{"$attrs.id":function(e){this.id=e||o.UniqueComponentId()},modelValue(){this.isModelValueChanged=!0},options(){this.autoUpdateModel()}},mounted(){this.id=this.id||o.UniqueComponentId(),this.autoUpdateModel()},updated(){this.overlayVisible&&this.isModelValueChanged&&this.scrollInView(this.findSelectedOptionIndex()),this.isModelValueChanged=!1},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.overlay&&(o.ZIndexUtils.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(e){return this.optionLabel?o.ObjectUtils.resolveFieldData(e,this.optionLabel):e},getOptionValue(e){return this.optionValue?o.ObjectUtils.resolveFieldData(e,this.optionValue):e},getOptionRenderKey(e,t){return(this.dataKey?o.ObjectUtils.resolveFieldData(e,this.dataKey):this.getOptionLabel(e))+"_"+t},isOptionDisabled(e){return!!this.optionDisabled&&o.ObjectUtils.resolveFieldData(e,this.optionDisabled)},isOptionGroup(e){return this.optionGroupLabel&&e.optionGroup&&e.group},getOptionGroupLabel(e){return o.ObjectUtils.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren(e){return o.ObjectUtils.resolveFieldData(e,this.optionGroupChildren)},getAriaPosInset(e){return(this.optionGroupLabel?e-this.visibleOptions.slice(0,e).filter((e=>this.isOptionGroup(e))).length:e)+1},show(e){this.$emit("before-show"),this.overlayVisible=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,e&&o.DomHandler.focus(this.$refs.focusInput)},hide(e){const t=()=>{this.$emit("before-hide"),this.overlayVisible=!1,this.focusedOptionIndex=-1,this.searchValue="",this.resetFilterOnHide&&(this.filterValue=null),e&&o.DomHandler.focus(this.$refs.focusInput)};setTimeout((()=>{t()}),0)},onFocus(e){this.disabled||(this.focused=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.overlayVisible&&this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.overlayVisible&&this.scrollInView(this.focusedOptionIndex),this.$emit("focus",e))},onBlur(e){this.focused=!1,this.focusedOptionIndex=-1,this.searchValue="",this.$emit("blur",e)},onKeyDown(e){if(this.disabled)return void e.preventDefault();const t=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e,this.editable);break;case"ArrowLeft":case"ArrowRight":this.onArrowLeftKey(e,this.editable);break;case"Home":this.onHomeKey(e,this.editable);break;case"End":this.onEndKey(e,this.editable);break;case"PageDown":this.onPageDownKey(e);break;case"PageUp":this.onPageUpKey(e);break;case"Space":this.onSpaceKey(e,this.editable);break;case"Enter":case"NumpadEnter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"Backspace":this.onBackspaceKey(e,this.editable);break;case"ShiftLeft":case"ShiftRight":break;default:!t&&o.ObjectUtils.isPrintableCharacter(e.key)&&(!this.overlayVisible&&this.show(),!this.editable&&this.searchOptions(e,e.key))}},onEditableInput(e){const t=e.target.value;this.searchValue="";!this.searchOptions(e,t)&&(this.focusedOptionIndex=-1),this.updateModel(e,t)},onContainerClick(e){this.disabled||this.loading||o.DomHandler.hasClass(e.target,"p-dropdown-clear-icon")||"INPUT"===e.target.tagName||this.overlay&&this.overlay.contains(e.target)||(this.overlayVisible?this.hide(!0):this.show(!0))},onClearClick(e){this.updateModel(e,null)},onFirstHiddenFocus(e){const t=e.relatedTarget===this.$refs.focusInput?o.DomHandler.getFirstFocusableElement(this.overlay,":not(.p-hidden-focusable)"):this.$refs.focusInput;o.DomHandler.focus(t)},onLastHiddenFocus(e){const t=e.relatedTarget===this.$refs.focusInput?o.DomHandler.getLastFocusableElement(this.overlay,":not(.p-hidden-focusable)"):this.$refs.focusInput;o.DomHandler.focus(t)},onOptionSelect(e,t,i=!0){const n=this.getOptionValue(t);this.updateModel(e,n),i&&this.hide(!0)},onOptionMouseMove(e,t){this.focusOnHover&&this.changeFocusedOptionIndex(e,t)},onFilterChange(e){const t=e.target.value;this.filterValue=t,this.focusedOptionIndex=-1,this.$emit("filter",{originalEvent:e,value:t}),!this.virtualScrollerDisabled&&this.virtualScroller.scrollToIndex(0)},onFilterKeyDown(e){switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e,!0);break;case"ArrowLeft":case"ArrowRight":this.onArrowLeftKey(e,!0);break;case"Home":this.onHomeKey(e,!0);break;case"End":this.onEndKey(e,!0);break;case"Enter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e,!0)}},onFilterBlur(){this.focusedOptionIndex=-1},onFilterUpdated(){this.overlayVisible&&this.alignOverlay()},onOverlayClick(e){a.default.emit("overlay-click",{originalEvent:e,target:this.$el})},onOverlayKeyDown(e){if("Escape"===e.code)this.onEscapeKey(e)},onArrowDownKey(e){const t=-1!==this.focusedOptionIndex?this.findNextOptionIndex(this.focusedOptionIndex):this.findFirstFocusedOptionIndex();this.changeFocusedOptionIndex(e,t),!this.overlayVisible&&this.show(),e.preventDefault()},onArrowUpKey(e,t=!1){if(e.altKey&&!t)-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide(),e.preventDefault();else{const t=-1!==this.focusedOptionIndex?this.findPrevOptionIndex(this.focusedOptionIndex):this.findLastFocusedOptionIndex();this.changeFocusedOptionIndex(e,t),!this.overlayVisible&&this.show(),e.preventDefault()}},onArrowLeftKey(e,t=!1){t&&(this.focusedOptionIndex=-1)},onHomeKey(e,t=!1){t?(e.currentTarget.setSelectionRange(0,0),this.focusedOptionIndex=-1):(this.changeFocusedOptionIndex(e,this.findFirstOptionIndex()),!this.overlayVisible&&this.show()),e.preventDefault()},onEndKey(e,t=!1){if(t){const t=e.currentTarget,i=t.value.length;t.setSelectionRange(i,i),this.focusedOptionIndex=-1}else this.changeFocusedOptionIndex(e,this.findLastOptionIndex()),!this.overlayVisible&&this.show();e.preventDefault()},onPageUpKey(e){this.scrollInView(0),e.preventDefault()},onPageDownKey(e){this.scrollInView(this.visibleOptions.length-1),e.preventDefault()},onEnterKey(e){this.overlayVisible?(-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.hide()):this.onArrowDownKey(e),e.preventDefault()},onSpaceKey(e,t=!1){!t&&this.onEnterKey(e)},onEscapeKey(e){this.overlayVisible&&this.hide(!0),e.preventDefault()},onTabKey(e,t=!1){t||(this.overlayVisible&&this.hasFocusableElements()?(o.DomHandler.focus(this.$refs.firstHiddenFocusableElementOnOverlay),e.preventDefault()):(-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide(this.filter)))},onBackspaceKey(e,t=!1){t&&!this.overlayVisible&&this.show()},onOverlayEnter(e){o.ZIndexUtils.set("overlay",e,this.$primevue.config.zIndex.overlay),this.alignOverlay(),this.scrollInView(),this.autoFilterFocus&&o.DomHandler.focus(this.$refs.filterInput)},onOverlayAfterEnter(){this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.overlay=null},onOverlayAfterLeave(e){o.ZIndexUtils.clear(e)},alignOverlay(){"self"===this.appendTo?o.DomHandler.relativePosition(this.overlay,this.$el):(this.overlay.style.minWidth=o.DomHandler.getOuterWidth(this.$el)+"px",o.DomHandler.absolutePosition(this.overlay,this.$el))},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 o.ConnectedOverlayScrollHandler(this.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!o.DomHandler.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},hasFocusableElements(){return o.DomHandler.getFocusableElements(this.overlay,":not(.p-hidden-focusable)").length>0},isOptionMatched(e){return this.isValidOption(e)&&this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},isValidOption(e){return e&&!(this.isOptionDisabled(e)||this.isOptionGroup(e))},isValidSelectedOption(e){return this.isValidOption(e)&&this.isSelected(e)},isSelected(e){return o.ObjectUtils.equals(this.modelValue,this.getOptionValue(e),this.equalityKey)},findFirstOptionIndex(){return this.visibleOptions.findIndex((e=>this.isValidOption(e)))},findLastOptionIndex(){return o.ObjectUtils.findLastIndex(this.visibleOptions,(e=>this.isValidOption(e)))},findNextOptionIndex(e){const t=e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((e=>this.isValidOption(e))):-1;return t>-1?t+e+1:e},findPrevOptionIndex(e){const t=e>0?o.ObjectUtils.findLastIndex(this.visibleOptions.slice(0,e),(e=>this.isValidOption(e))):-1;return t>-1?t:e},findSelectedOptionIndex(){return this.hasSelectedOption?this.visibleOptions.findIndex((e=>this.isValidSelectedOption(e))):-1},findFirstFocusedOptionIndex(){const e=this.findSelectedOptionIndex();return e<0?this.findFirstOptionIndex():e},findLastFocusedOptionIndex(){const e=this.findSelectedOptionIndex();return e<0?this.findLastOptionIndex():e},searchOptions(e,t){this.searchValue=(this.searchValue||"")+t;let i=-1,n=!1;return-1!==this.focusedOptionIndex?(i=this.visibleOptions.slice(this.focusedOptionIndex).findIndex((e=>this.isOptionMatched(e))),i=-1===i?this.visibleOptions.slice(0,this.focusedOptionIndex).findIndex((e=>this.isOptionMatched(e))):i+this.focusedOptionIndex):i=this.visibleOptions.findIndex((e=>this.isOptionMatched(e))),-1!==i&&(n=!0),-1===i&&-1===this.focusedOptionIndex&&(i=this.findFirstFocusedOptionIndex()),-1!==i&&this.changeFocusedOptionIndex(e,i),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((()=>{this.searchValue="",this.searchTimeout=null}),500),n},changeFocusedOptionIndex(e,t){this.focusedOptionIndex!==t&&(this.focusedOptionIndex=t,this.scrollInView(),this.selectOnFocus&&this.onOptionSelect(e,this.visibleOptions[t],!1))},scrollInView(e=-1){const t=-1!==e?`${this.id}_${e}`:this.focusedOptionId,i=o.DomHandler.findSingle(this.list,`li[id="${t}"]`);i?i.scrollIntoView&&i.scrollIntoView({block:"nearest",inline:"start"}):this.virtualScrollerDisabled||setTimeout((()=>{this.virtualScroller&&this.virtualScroller.scrollToIndex(-1!==e?e:this.focusedOptionIndex)}),0)},autoUpdateModel(){this.selectOnFocus&&this.autoOptionFocus&&!this.hasSelectedOption&&(this.focusedOptionIndex=this.findFirstFocusedOptionIndex(),this.onOptionSelect(null,this.visibleOptions[this.focusedOptionIndex],!1))},updateModel(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},flatOptions(e){return(e||[]).reduce(((e,t,i)=>{e.push({optionGroup:t,group:!0,index:i});const n=this.getOptionGroupChildren(t);return n&&n.forEach((t=>e.push(t))),e}),[])},overlayRef(e){this.overlay=e},listRef(e,t){this.list=e,t&&t(e)},virtualScrollerRef(e){this.virtualScroller=e}},computed:{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,"p-overlay-open":this.overlayVisible}]},inputStyleClass(){return["p-dropdown-label p-inputtext",this.inputClass,{"p-placeholder":!this.editable&&this.label===this.placeholder,"p-dropdown-label-empty":!(this.editable||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}]},dropdownIconClass(){return["p-dropdown-trigger-icon",this.loading?this.loadingIcon:this.dropdownIcon]},visibleOptions(){const t=this.optionGroupLabel?this.flatOptions(this.options):this.options||[];if(this.filterValue){const i=e.FilterService.filter(t,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);if(this.optionGroupLabel){const e=this.options||[],t=[];return e.forEach((e=>{const n=e.items.filter((e=>i.includes(e)));n.length>0&&t.push({...e,items:[...n]})})),this.flatOptions(t)}return i}return t},hasSelectedOption(){return o.ObjectUtils.isNotEmpty(this.modelValue)},label(){const e=this.findSelectedOptionIndex();return-1!==e?this.getOptionLabel(this.visibleOptions[e]):this.placeholder||"p-emptylabel"},editableInputValue(){const e=this.findSelectedOptionIndex();return-1!==e?this.getOptionLabel(this.visibleOptions[e]):this.modelValue||""},equalityKey(){return this.optionValue?null:this.dataKey},searchFields(){return this.filterFields||[this.optionLabel]},filterResultMessageText(){return o.ObjectUtils.isNotEmpty(this.visibleOptions)?this.filterMessageText.replaceAll("{0}",this.visibleOptions.length):this.emptyFilterMessageText},filterMessageText(){return this.filterMessage||this.$primevue.config.locale.searchMessage||""},emptyFilterMessageText(){return this.emptyFilterMessage||this.$primevue.config.locale.emptySearchMessage||this.$primevue.config.locale.emptyFilterMessage||""},emptyMessageText(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage||""},selectionMessageText(){return this.selectionMessage||this.$primevue.config.locale.selectionMessage||""},emptySelectionMessageText(){return this.emptySelectionMessage||this.$primevue.config.locale.emptySelectionMessage||""},selectedMessageText(){return this.hasSelectedOption?this.selectionMessageText.replaceAll("{0}","1"):this.emptySelectionMessageText},focusedOptionId(){return-1!==this.focusedOptionIndex?`${this.id}_${this.focusedOptionIndex}`:null},ariaSetSize(){return this.visibleOptions.filter((e=>!this.isOptionGroup(e))).length},virtualScrollerDisabled(){return!this.virtualScrollerOptions}},directives:{ripple:p.default},components:{VirtualScroller:c.default,Portal:d.default}};const h=["id"],f=["id","value","placeholder","tabindex","disabled","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant"],y=["id","tabindex","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant","aria-disabled"],b={class:"p-dropdown-trigger"},v={key:0,class:"p-dropdown-header"},O={class:"p-dropdown-filter-container"},m=["value","placeholder","aria-owns","aria-activedescendant"],g={role:"status","aria-live":"polite",class:"p-hidden-accessible"},x=["id"],w=["id"],I=["id","aria-label","aria-selected","aria-disabled","aria-setsize","aria-posinset","onClick","onMousemove"],S={key:0,class:"p-dropdown-empty-message",role:"option"},V={key:1,class:"p-dropdown-empty-message",role:"option"},k={key:1,role:"status","aria-live":"polite",class:"p-hidden-accessible"},F={role:"status","aria-live":"polite",class:"p-hidden-accessible"};return function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-dropdown {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n}\n.p-dropdown-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n}\n.p-dropdown-trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n}\n.p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n}\n.p-dropdown-label-empty {\n overflow: hidden;\n opacity: 0;\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: -0.5rem;\n}\n.p-fluid .p-dropdown {\n display: flex;\n}\n.p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n}\n"),u.render=function(e,t,i,n,o,s){const r=l.resolveComponent("VirtualScroller"),a=l.resolveComponent("Portal"),d=l.resolveDirective("ripple");return l.openBlock(),l.createElementBlock("div",{ref:"container",id:o.id,class:l.normalizeClass(s.containerClass),onClick:t[16]||(t[16]=(...e)=>s.onContainerClick&&s.onContainerClick(...e))},[i.editable?(l.openBlock(),l.createElementBlock("input",l.mergeProps({key:0,ref:"focusInput",id:i.inputId,type:"text",style:i.inputStyle,class:s.inputStyleClass,value:s.editableInputValue,placeholder:i.placeholder,tabindex:i.disabled?-1:i.tabindex,disabled:i.disabled,autocomplete:"off",role:"combobox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-expanded":o.overlayVisible,"aria-controls":o.id+"_list","aria-activedescendant":o.focused?s.focusedOptionId:void 0,onFocus:t[0]||(t[0]=(...e)=>s.onFocus&&s.onFocus(...e)),onBlur:t[1]||(t[1]=(...e)=>s.onBlur&&s.onBlur(...e)),onKeydown:t[2]||(t[2]=(...e)=>s.onKeyDown&&s.onKeyDown(...e)),onInput:t[3]||(t[3]=(...e)=>s.onEditableInput&&s.onEditableInput(...e))},i.inputProps),null,16,f)):(l.openBlock(),l.createElementBlock("span",l.mergeProps({key:1,ref:"focusInput",id:i.inputId,style:i.inputStyle,class:s.inputStyleClass,tabindex:i.disabled?-1:i.tabindex,role:"combobox","aria-label":e.ariaLabel||("p-emptylabel"===s.label?void 0:s.label),"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-expanded":o.overlayVisible,"aria-controls":o.id+"_list","aria-activedescendant":o.focused?s.focusedOptionId:void 0,"aria-disabled":i.disabled,onFocus:t[4]||(t[4]=(...e)=>s.onFocus&&s.onFocus(...e)),onBlur:t[5]||(t[5]=(...e)=>s.onBlur&&s.onBlur(...e)),onKeydown:t[6]||(t[6]=(...e)=>s.onKeyDown&&s.onKeyDown(...e))},i.inputProps),[l.renderSlot(e.$slots,"value",{value:i.modelValue,placeholder:i.placeholder},(()=>[l.createTextVNode(l.toDisplayString("p-emptylabel"===s.label?" ":s.label||"empty"),1)]))],16,y)),i.showClear&&null!=i.modelValue?(l.openBlock(),l.createElementBlock("i",l.mergeProps({key:2,class:["p-dropdown-clear-icon",i.clearIcon],onClick:t[7]||(t[7]=(...e)=>s.onClearClick&&s.onClearClick(...e))},i.clearIconProps),null,16)):l.createCommentVNode("",!0),l.createElementVNode("div",b,[l.renderSlot(e.$slots,"indicator",{},(()=>[l.createElementVNode("span",{class:l.normalizeClass(s.dropdownIconClass),"aria-hidden":"true"},null,2)]))]),l.createVNode(a,{appendTo:i.appendTo},{default:l.withCtx((()=>[l.createVNode(l.Transition,{name:"p-connected-overlay",onEnter:s.onOverlayEnter,onAfterEnter:s.onOverlayAfterEnter,onLeave:s.onOverlayLeave,onAfterLeave:s.onOverlayAfterLeave},{default:l.withCtx((()=>[o.overlayVisible?(l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,ref:s.overlayRef,style:i.panelStyle,class:s.panelStyleClass,onClick:t[14]||(t[14]=(...e)=>s.onOverlayClick&&s.onOverlayClick(...e)),onKeydown:t[15]||(t[15]=(...e)=>s.onOverlayKeyDown&&s.onOverlayKeyDown(...e))},i.panelProps),[l.createElementVNode("span",{ref:"firstHiddenFocusableElementOnOverlay",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:0,onFocus:t[8]||(t[8]=(...e)=>s.onFirstHiddenFocus&&s.onFirstHiddenFocus(...e))},null,544),l.renderSlot(e.$slots,"header",{value:i.modelValue,options:s.visibleOptions}),i.filter?(l.openBlock(),l.createElementBlock("div",v,[l.createElementVNode("div",O,[l.createElementVNode("input",l.mergeProps({ref:"filterInput",type:"text",value:o.filterValue,onVnodeUpdated:t[9]||(t[9]=(...e)=>s.onFilterUpdated&&s.onFilterUpdated(...e)),class:"p-dropdown-filter p-inputtext p-component",placeholder:i.filterPlaceholder,role:"searchbox",autocomplete:"off","aria-owns":o.id+"_list","aria-activedescendant":s.focusedOptionId,onKeydown:t[10]||(t[10]=(...e)=>s.onFilterKeyDown&&s.onFilterKeyDown(...e)),onBlur:t[11]||(t[11]=(...e)=>s.onFilterBlur&&s.onFilterBlur(...e)),onInput:t[12]||(t[12]=(...e)=>s.onFilterChange&&s.onFilterChange(...e))},i.filterInputProps),null,16,m),l.createElementVNode("span",{class:l.normalizeClass(["p-dropdown-filter-icon",i.filterIcon])},null,2)]),l.createElementVNode("span",g,l.toDisplayString(s.filterResultMessageText),1)])):l.createCommentVNode("",!0),l.createElementVNode("div",{class:"p-dropdown-items-wrapper",style:l.normalizeStyle({"max-height":s.virtualScrollerDisabled?i.scrollHeight:""})},[l.createVNode(r,l.mergeProps({ref:s.virtualScrollerRef},i.virtualScrollerOptions,{items:s.visibleOptions,style:{height:i.scrollHeight},tabindex:-1,disabled:s.virtualScrollerDisabled}),l.createSlots({content:l.withCtx((({styleClass:t,contentRef:n,items:r,getItemOptions:a,contentStyle:p,itemSize:c})=>[l.createElementVNode("ul",{ref:e=>s.listRef(e,n),id:o.id+"_list",class:l.normalizeClass(["p-dropdown-items",t]),style:l.normalizeStyle(p),role:"listbox"},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(r,((t,i)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:s.getOptionRenderKey(t,s.getOptionIndex(i,a))},[s.isOptionGroup(t)?(l.openBlock(),l.createElementBlock("li",{key:0,id:o.id+"_"+s.getOptionIndex(i,a),style:l.normalizeStyle({height:c?c+"px":void 0}),class:"p-dropdown-item-group",role:"option"},[l.renderSlot(e.$slots,"optiongroup",{option:t.optionGroup,index:s.getOptionIndex(i,a)},(()=>[l.createTextVNode(l.toDisplayString(s.getOptionGroupLabel(t.optionGroup)),1)]))],12,w)):l.withDirectives((l.openBlock(),l.createElementBlock("li",{key:1,id:o.id+"_"+s.getOptionIndex(i,a),style:l.normalizeStyle({height:c?c+"px":void 0}),class:l.normalizeClass(["p-dropdown-item",{"p-highlight":s.isSelected(t),"p-focus":o.focusedOptionIndex===s.getOptionIndex(i,a),"p-disabled":s.isOptionDisabled(t)}]),role:"option","aria-label":s.getOptionLabel(t),"aria-selected":s.isSelected(t),"aria-disabled":s.isOptionDisabled(t),"aria-setsize":s.ariaSetSize,"aria-posinset":s.getAriaPosInset(s.getOptionIndex(i,a)),onClick:e=>s.onOptionSelect(e,t),onMousemove:e=>s.onOptionMouseMove(e,s.getOptionIndex(i,a))},[l.renderSlot(e.$slots,"option",{option:t,index:s.getOptionIndex(i,a)},(()=>[l.createTextVNode(l.toDisplayString(s.getOptionLabel(t)),1)]))],46,I)),[[d]])],64)))),128)),o.filterValue&&(!r||r&&0===r.length)?(l.openBlock(),l.createElementBlock("li",S,[l.renderSlot(e.$slots,"emptyfilter",{},(()=>[l.createTextVNode(l.toDisplayString(s.emptyFilterMessageText),1)]))])):!i.options||i.options&&0===i.options.length?(l.openBlock(),l.createElementBlock("li",V,[l.renderSlot(e.$slots,"empty",{},(()=>[l.createTextVNode(l.toDisplayString(s.emptyMessageText),1)]))])):l.createCommentVNode("",!0)],14,x)])),_:2},[e.$slots.loader?{name:"loader",fn:l.withCtx((({options:t})=>[l.renderSlot(e.$slots,"loader",{options:t})])),key:"0"}:void 0]),1040,["items","style","disabled"])],4),l.renderSlot(e.$slots,"footer",{value:i.modelValue,options:s.visibleOptions}),!i.options||i.options&&0===i.options.length?(l.openBlock(),l.createElementBlock("span",k,l.toDisplayString(s.emptyMessageText),1)):l.createCommentVNode("",!0),l.createElementVNode("span",F,l.toDisplayString(s.selectedMessageText),1),l.createElementVNode("span",{ref:"lastHiddenFocusableElementOnOverlay",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:0,onFocus:t[13]||(t[13]=(...e)=>s.onLastHiddenFocus&&s.onLastHiddenFocus(...e))},null,544)],16)):l.createCommentVNode("",!0)])),_:3},8,["onEnter","onAfterEnter","onLeave","onAfterLeave"])])),_:3},8,["appendTo"])],10,h)},u}(primevue.api,primevue.overlayeventbus,primevue.portal,primevue.ripple,primevue.utils,primevue.virtualscroller,Vue);
1
+ this.primevue=this.primevue||{},this.primevue.dropdown=function(e,t,i,n,o,s,l){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=r(t),d=r(i),p=r(n),c=r(s),u={name:"Dropdown",emits:["update:modelValue","change","focus","blur","before-show","before-hide","show","hide","filter"],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:{type:String,default:null},disabled:{type:Boolean,default:!1},dataKey:null,showClear:{type:Boolean,default:!1},inputId:{type:String,default:null},inputClass:{type:[String,Object],default:null},inputStyle:{type:Object,default:null},inputProps:{type:null,default:null},panelClass:{type:[String,Object],default:null},panelStyle:{type:Object,default:null},panelProps:{type:null,default:null},filterInputProps:{type:null,default:null},clearIconProps:{type:null,default:null},appendTo:{type:String,default:"body"},loading:{type:Boolean,default:!1},clearIcon:{type:String,default:"pi pi-times"},dropdownIcon:{type:String,default:"pi pi-chevron-down"},filterIcon:{type:String,default:"pi pi-search"},loadingIcon:{type:String,default:"pi pi-spinner pi-spin"},resetFilterOnHide:{type:Boolean,default:!1},virtualScrollerOptions:{type:Object,default:null},autoOptionFocus:{type:Boolean,default:!0},autoFilterFocus:{type:Boolean,default:!1},selectOnFocus:{type:Boolean,default:!1},filterMessage:{type:String,default:null},selectionMessage:{type:String,default:null},emptySelectionMessage:{type:String,default:null},emptyFilterMessage:{type:String,default:null},emptyMessage:{type:String,default:null},tabindex:{type:Number,default:0},"aria-label":{type:String,default:null},"aria-labelledby":{type:String,default:null}},outsideClickListener:null,scrollHandler:null,resizeListener:null,overlay:null,list:null,virtualScroller:null,searchTimeout:null,searchValue:null,isModelValueChanged:!1,focusOnHover:!1,data(){return{id:this.$attrs.id,focused:!1,focusedOptionIndex:-1,filterValue:null,overlayVisible:!1}},watch:{"$attrs.id":function(e){this.id=e||o.UniqueComponentId()},modelValue(){this.isModelValueChanged=!0},options(){this.autoUpdateModel()}},mounted(){this.id=this.id||o.UniqueComponentId(),this.autoUpdateModel()},updated(){this.overlayVisible&&this.isModelValueChanged&&this.scrollInView(this.findSelectedOptionIndex()),this.isModelValueChanged=!1},beforeUnmount(){this.unbindOutsideClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.overlay&&(o.ZIndexUtils.clear(this.overlay),this.overlay=null)},methods:{getOptionIndex(e,t){return this.virtualScrollerDisabled?e:t&&t(e).index},getOptionLabel(e){return this.optionLabel?o.ObjectUtils.resolveFieldData(e,this.optionLabel):e},getOptionValue(e){return this.optionValue?o.ObjectUtils.resolveFieldData(e,this.optionValue):e},getOptionRenderKey(e,t){return(this.dataKey?o.ObjectUtils.resolveFieldData(e,this.dataKey):this.getOptionLabel(e))+"_"+t},isOptionDisabled(e){return!!this.optionDisabled&&o.ObjectUtils.resolveFieldData(e,this.optionDisabled)},isOptionGroup(e){return this.optionGroupLabel&&e.optionGroup&&e.group},getOptionGroupLabel(e){return o.ObjectUtils.resolveFieldData(e,this.optionGroupLabel)},getOptionGroupChildren(e){return o.ObjectUtils.resolveFieldData(e,this.optionGroupChildren)},getAriaPosInset(e){return(this.optionGroupLabel?e-this.visibleOptions.slice(0,e).filter((e=>this.isOptionGroup(e))).length:e)+1},show(e){this.$emit("before-show"),this.overlayVisible=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,e&&o.DomHandler.focus(this.$refs.focusInput)},hide(e){const t=()=>{this.$emit("before-hide"),this.overlayVisible=!1,this.focusedOptionIndex=-1,this.searchValue="",this.resetFilterOnHide&&(this.filterValue=null),e&&o.DomHandler.focus(this.$refs.focusInput)};setTimeout((()=>{t()}),0)},onFocus(e){this.disabled||(this.focused=!0,this.focusedOptionIndex=-1!==this.focusedOptionIndex?this.focusedOptionIndex:this.overlayVisible&&this.autoOptionFocus?this.findFirstFocusedOptionIndex():-1,this.overlayVisible&&this.scrollInView(this.focusedOptionIndex),this.$emit("focus",e))},onBlur(e){this.focused=!1,this.focusedOptionIndex=-1,this.searchValue="",this.$emit("blur",e)},onKeyDown(e){if(this.disabled)return void e.preventDefault();const t=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e,this.editable);break;case"ArrowLeft":case"ArrowRight":this.onArrowLeftKey(e,this.editable);break;case"Home":this.onHomeKey(e,this.editable);break;case"End":this.onEndKey(e,this.editable);break;case"PageDown":this.onPageDownKey(e);break;case"PageUp":this.onPageUpKey(e);break;case"Space":this.onSpaceKey(e,this.editable);break;case"Enter":case"NumpadEnter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"Backspace":this.onBackspaceKey(e,this.editable);break;case"ShiftLeft":case"ShiftRight":break;default:!t&&o.ObjectUtils.isPrintableCharacter(e.key)&&(!this.overlayVisible&&this.show(),!this.editable&&this.searchOptions(e,e.key))}},onEditableInput(e){const t=e.target.value;this.searchValue="";!this.searchOptions(e,t)&&(this.focusedOptionIndex=-1),this.updateModel(e,t)},onContainerClick(e){this.disabled||this.loading||o.DomHandler.hasClass(e.target,"p-dropdown-clear-icon")||"INPUT"===e.target.tagName||this.overlay&&this.overlay.contains(e.target)||(this.overlayVisible?this.hide(!0):this.show(!0))},onClearClick(e){this.updateModel(e,null)},onFirstHiddenFocus(e){const t=e.relatedTarget===this.$refs.focusInput?o.DomHandler.getFirstFocusableElement(this.overlay,":not(.p-hidden-focusable)"):this.$refs.focusInput;o.DomHandler.focus(t)},onLastHiddenFocus(e){const t=e.relatedTarget===this.$refs.focusInput?o.DomHandler.getLastFocusableElement(this.overlay,":not(.p-hidden-focusable)"):this.$refs.focusInput;o.DomHandler.focus(t)},onOptionSelect(e,t,i=!0){const n=this.getOptionValue(t);this.updateModel(e,n),i&&this.hide(!0)},onOptionMouseMove(e,t){this.focusOnHover&&this.changeFocusedOptionIndex(e,t)},onFilterChange(e){const t=e.target.value;this.filterValue=t,this.focusedOptionIndex=-1,this.$emit("filter",{originalEvent:e,value:t}),!this.virtualScrollerDisabled&&this.virtualScroller.scrollToIndex(0)},onFilterKeyDown(e){switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e,!0);break;case"ArrowLeft":case"ArrowRight":this.onArrowLeftKey(e,!0);break;case"Home":this.onHomeKey(e,!0);break;case"End":this.onEndKey(e,!0);break;case"Enter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e,!0)}},onFilterBlur(){this.focusedOptionIndex=-1},onFilterUpdated(){this.overlayVisible&&this.alignOverlay()},onOverlayClick(e){a.default.emit("overlay-click",{originalEvent:e,target:this.$el})},onOverlayKeyDown(e){if("Escape"===e.code)this.onEscapeKey(e)},onArrowDownKey(e){const t=-1!==this.focusedOptionIndex?this.findNextOptionIndex(this.focusedOptionIndex):this.findFirstFocusedOptionIndex();this.changeFocusedOptionIndex(e,t),!this.overlayVisible&&this.show(),e.preventDefault()},onArrowUpKey(e,t=!1){if(e.altKey&&!t)-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide(),e.preventDefault();else{const t=-1!==this.focusedOptionIndex?this.findPrevOptionIndex(this.focusedOptionIndex):this.findLastFocusedOptionIndex();this.changeFocusedOptionIndex(e,t),!this.overlayVisible&&this.show(),e.preventDefault()}},onArrowLeftKey(e,t=!1){t&&(this.focusedOptionIndex=-1)},onHomeKey(e,t=!1){t?(e.currentTarget.setSelectionRange(0,0),this.focusedOptionIndex=-1):(this.changeFocusedOptionIndex(e,this.findFirstOptionIndex()),!this.overlayVisible&&this.show()),e.preventDefault()},onEndKey(e,t=!1){if(t){const t=e.currentTarget,i=t.value.length;t.setSelectionRange(i,i),this.focusedOptionIndex=-1}else this.changeFocusedOptionIndex(e,this.findLastOptionIndex()),!this.overlayVisible&&this.show();e.preventDefault()},onPageUpKey(e){this.scrollInView(0),e.preventDefault()},onPageDownKey(e){this.scrollInView(this.visibleOptions.length-1),e.preventDefault()},onEnterKey(e){this.overlayVisible?(-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.hide()):this.onArrowDownKey(e),e.preventDefault()},onSpaceKey(e,t=!1){!t&&this.onEnterKey(e)},onEscapeKey(e){this.overlayVisible&&this.hide(!0),e.preventDefault()},onTabKey(e,t=!1){t||(this.overlayVisible&&this.hasFocusableElements()?(o.DomHandler.focus(this.$refs.firstHiddenFocusableElementOnOverlay),e.preventDefault()):(-1!==this.focusedOptionIndex&&this.onOptionSelect(e,this.visibleOptions[this.focusedOptionIndex]),this.overlayVisible&&this.hide(this.filter)))},onBackspaceKey(e,t=!1){t&&!this.overlayVisible&&this.show()},onOverlayEnter(e){o.ZIndexUtils.set("overlay",e,this.$primevue.config.zIndex.overlay),this.alignOverlay(),this.scrollInView(),this.autoFilterFocus&&o.DomHandler.focus(this.$refs.filterInput)},onOverlayAfterEnter(){this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.$emit("show")},onOverlayLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.$emit("hide"),this.overlay=null},onOverlayAfterLeave(e){o.ZIndexUtils.clear(e)},alignOverlay(){"self"===this.appendTo?o.DomHandler.relativePosition(this.overlay,this.$el):(this.overlay.style.minWidth=o.DomHandler.getOuterWidth(this.$el)+"px",o.DomHandler.absolutePosition(this.overlay,this.$el))},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 o.ConnectedOverlayScrollHandler(this.$refs.container,(()=>{this.overlayVisible&&this.hide()}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.overlayVisible&&!o.DomHandler.isTouchDevice()&&this.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},hasFocusableElements(){return o.DomHandler.getFocusableElements(this.overlay,":not(.p-hidden-focusable)").length>0},isOptionMatched(e){return this.isValidOption(e)&&this.getOptionLabel(e).toLocaleLowerCase(this.filterLocale).startsWith(this.searchValue.toLocaleLowerCase(this.filterLocale))},isValidOption(e){return e&&!(this.isOptionDisabled(e)||this.isOptionGroup(e))},isValidSelectedOption(e){return this.isValidOption(e)&&this.isSelected(e)},isSelected(e){return this.isValidOption(e)&&o.ObjectUtils.equals(this.modelValue,this.getOptionValue(e),this.equalityKey)},findFirstOptionIndex(){return this.visibleOptions.findIndex((e=>this.isValidOption(e)))},findLastOptionIndex(){return o.ObjectUtils.findLastIndex(this.visibleOptions,(e=>this.isValidOption(e)))},findNextOptionIndex(e){const t=e<this.visibleOptions.length-1?this.visibleOptions.slice(e+1).findIndex((e=>this.isValidOption(e))):-1;return t>-1?t+e+1:e},findPrevOptionIndex(e){const t=e>0?o.ObjectUtils.findLastIndex(this.visibleOptions.slice(0,e),(e=>this.isValidOption(e))):-1;return t>-1?t:e},findSelectedOptionIndex(){return this.hasSelectedOption?this.visibleOptions.findIndex((e=>this.isValidSelectedOption(e))):-1},findFirstFocusedOptionIndex(){const e=this.findSelectedOptionIndex();return e<0?this.findFirstOptionIndex():e},findLastFocusedOptionIndex(){const e=this.findSelectedOptionIndex();return e<0?this.findLastOptionIndex():e},searchOptions(e,t){this.searchValue=(this.searchValue||"")+t;let i=-1,n=!1;return-1!==this.focusedOptionIndex?(i=this.visibleOptions.slice(this.focusedOptionIndex).findIndex((e=>this.isOptionMatched(e))),i=-1===i?this.visibleOptions.slice(0,this.focusedOptionIndex).findIndex((e=>this.isOptionMatched(e))):i+this.focusedOptionIndex):i=this.visibleOptions.findIndex((e=>this.isOptionMatched(e))),-1!==i&&(n=!0),-1===i&&-1===this.focusedOptionIndex&&(i=this.findFirstFocusedOptionIndex()),-1!==i&&this.changeFocusedOptionIndex(e,i),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((()=>{this.searchValue="",this.searchTimeout=null}),500),n},changeFocusedOptionIndex(e,t){this.focusedOptionIndex!==t&&(this.focusedOptionIndex=t,this.scrollInView(),this.selectOnFocus&&this.onOptionSelect(e,this.visibleOptions[t],!1))},scrollInView(e=-1){const t=-1!==e?`${this.id}_${e}`:this.focusedOptionId,i=o.DomHandler.findSingle(this.list,`li[id="${t}"]`);i?i.scrollIntoView&&i.scrollIntoView({block:"nearest",inline:"start"}):this.virtualScrollerDisabled||setTimeout((()=>{this.virtualScroller&&this.virtualScroller.scrollToIndex(-1!==e?e:this.focusedOptionIndex)}),0)},autoUpdateModel(){this.selectOnFocus&&this.autoOptionFocus&&!this.hasSelectedOption&&(this.focusedOptionIndex=this.findFirstFocusedOptionIndex(),this.onOptionSelect(null,this.visibleOptions[this.focusedOptionIndex],!1))},updateModel(e,t){this.$emit("update:modelValue",t),this.$emit("change",{originalEvent:e,value:t})},flatOptions(e){return(e||[]).reduce(((e,t,i)=>{e.push({optionGroup:t,group:!0,index:i});const n=this.getOptionGroupChildren(t);return n&&n.forEach((t=>e.push(t))),e}),[])},overlayRef(e){this.overlay=e},listRef(e,t){this.list=e,t&&t(e)},virtualScrollerRef(e){this.virtualScroller=e}},computed:{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,"p-overlay-open":this.overlayVisible}]},inputStyleClass(){return["p-dropdown-label p-inputtext",this.inputClass,{"p-placeholder":!this.editable&&this.label===this.placeholder,"p-dropdown-label-empty":!(this.editable||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}]},dropdownIconClass(){return["p-dropdown-trigger-icon",this.loading?this.loadingIcon:this.dropdownIcon]},visibleOptions(){const t=this.optionGroupLabel?this.flatOptions(this.options):this.options||[];if(this.filterValue){const i=e.FilterService.filter(t,this.searchFields,this.filterValue,this.filterMatchMode,this.filterLocale);if(this.optionGroupLabel){const e=this.options||[],t=[];return e.forEach((e=>{const n=e.items.filter((e=>i.includes(e)));n.length>0&&t.push({...e,items:[...n]})})),this.flatOptions(t)}return i}return t},hasSelectedOption(){return o.ObjectUtils.isNotEmpty(this.modelValue)},label(){const e=this.findSelectedOptionIndex();return-1!==e?this.getOptionLabel(this.visibleOptions[e]):this.placeholder||"p-emptylabel"},editableInputValue(){const e=this.findSelectedOptionIndex();return-1!==e?this.getOptionLabel(this.visibleOptions[e]):this.modelValue||""},equalityKey(){return this.optionValue?null:this.dataKey},searchFields(){return this.filterFields||[this.optionLabel]},filterResultMessageText(){return o.ObjectUtils.isNotEmpty(this.visibleOptions)?this.filterMessageText.replaceAll("{0}",this.visibleOptions.length):this.emptyFilterMessageText},filterMessageText(){return this.filterMessage||this.$primevue.config.locale.searchMessage||""},emptyFilterMessageText(){return this.emptyFilterMessage||this.$primevue.config.locale.emptySearchMessage||this.$primevue.config.locale.emptyFilterMessage||""},emptyMessageText(){return this.emptyMessage||this.$primevue.config.locale.emptyMessage||""},selectionMessageText(){return this.selectionMessage||this.$primevue.config.locale.selectionMessage||""},emptySelectionMessageText(){return this.emptySelectionMessage||this.$primevue.config.locale.emptySelectionMessage||""},selectedMessageText(){return this.hasSelectedOption?this.selectionMessageText.replaceAll("{0}","1"):this.emptySelectionMessageText},focusedOptionId(){return-1!==this.focusedOptionIndex?`${this.id}_${this.focusedOptionIndex}`:null},ariaSetSize(){return this.visibleOptions.filter((e=>!this.isOptionGroup(e))).length},virtualScrollerDisabled(){return!this.virtualScrollerOptions}},directives:{ripple:p.default},components:{VirtualScroller:c.default,Portal:d.default}};const h=["id"],f=["id","value","placeholder","tabindex","disabled","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant"],y=["id","tabindex","aria-label","aria-labelledby","aria-expanded","aria-controls","aria-activedescendant","aria-disabled"],b={class:"p-dropdown-trigger"},v={key:0,class:"p-dropdown-header"},O={class:"p-dropdown-filter-container"},m=["value","placeholder","aria-owns","aria-activedescendant"],g={role:"status","aria-live":"polite",class:"p-hidden-accessible"},x=["id"],w=["id"],I=["id","aria-label","aria-selected","aria-disabled","aria-setsize","aria-posinset","onClick","onMousemove"],S={key:0,class:"p-dropdown-empty-message",role:"option"},V={key:1,class:"p-dropdown-empty-message",role:"option"},k={key:1,role:"status","aria-live":"polite",class:"p-hidden-accessible"},F={role:"status","aria-live":"polite",class:"p-hidden-accessible"};return function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-dropdown {\n display: inline-flex;\n cursor: pointer;\n position: relative;\n user-select: none;\n}\n.p-dropdown-clear-icon {\n position: absolute;\n top: 50%;\n margin-top: -0.5rem;\n}\n.p-dropdown-trigger {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n}\n.p-dropdown-label {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n flex: 1 1 auto;\n width: 1%;\n text-overflow: ellipsis;\n cursor: pointer;\n}\n.p-dropdown-label-empty {\n overflow: hidden;\n opacity: 0;\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: -0.5rem;\n}\n.p-fluid .p-dropdown {\n display: flex;\n}\n.p-fluid .p-dropdown .p-dropdown-label {\n width: 1%;\n}\n"),u.render=function(e,t,i,n,o,s){const r=l.resolveComponent("VirtualScroller"),a=l.resolveComponent("Portal"),d=l.resolveDirective("ripple");return l.openBlock(),l.createElementBlock("div",{ref:"container",id:o.id,class:l.normalizeClass(s.containerClass),onClick:t[16]||(t[16]=(...e)=>s.onContainerClick&&s.onContainerClick(...e))},[i.editable?(l.openBlock(),l.createElementBlock("input",l.mergeProps({key:0,ref:"focusInput",id:i.inputId,type:"text",style:i.inputStyle,class:s.inputStyleClass,value:s.editableInputValue,placeholder:i.placeholder,tabindex:i.disabled?-1:i.tabindex,disabled:i.disabled,autocomplete:"off",role:"combobox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-expanded":o.overlayVisible,"aria-controls":o.id+"_list","aria-activedescendant":o.focused?s.focusedOptionId:void 0,onFocus:t[0]||(t[0]=(...e)=>s.onFocus&&s.onFocus(...e)),onBlur:t[1]||(t[1]=(...e)=>s.onBlur&&s.onBlur(...e)),onKeydown:t[2]||(t[2]=(...e)=>s.onKeyDown&&s.onKeyDown(...e)),onInput:t[3]||(t[3]=(...e)=>s.onEditableInput&&s.onEditableInput(...e))},i.inputProps),null,16,f)):(l.openBlock(),l.createElementBlock("span",l.mergeProps({key:1,ref:"focusInput",id:i.inputId,style:i.inputStyle,class:s.inputStyleClass,tabindex:i.disabled?-1:i.tabindex,role:"combobox","aria-label":e.ariaLabel||("p-emptylabel"===s.label?void 0:s.label),"aria-labelledby":e.ariaLabelledby,"aria-haspopup":"listbox","aria-expanded":o.overlayVisible,"aria-controls":o.id+"_list","aria-activedescendant":o.focused?s.focusedOptionId:void 0,"aria-disabled":i.disabled,onFocus:t[4]||(t[4]=(...e)=>s.onFocus&&s.onFocus(...e)),onBlur:t[5]||(t[5]=(...e)=>s.onBlur&&s.onBlur(...e)),onKeydown:t[6]||(t[6]=(...e)=>s.onKeyDown&&s.onKeyDown(...e))},i.inputProps),[l.renderSlot(e.$slots,"value",{value:i.modelValue,placeholder:i.placeholder},(()=>[l.createTextVNode(l.toDisplayString("p-emptylabel"===s.label?" ":s.label||"empty"),1)]))],16,y)),i.showClear&&null!=i.modelValue?(l.openBlock(),l.createElementBlock("i",l.mergeProps({key:2,class:["p-dropdown-clear-icon",i.clearIcon],onClick:t[7]||(t[7]=(...e)=>s.onClearClick&&s.onClearClick(...e))},i.clearIconProps),null,16)):l.createCommentVNode("",!0),l.createElementVNode("div",b,[l.renderSlot(e.$slots,"indicator",{},(()=>[l.createElementVNode("span",{class:l.normalizeClass(s.dropdownIconClass),"aria-hidden":"true"},null,2)]))]),l.createVNode(a,{appendTo:i.appendTo},{default:l.withCtx((()=>[l.createVNode(l.Transition,{name:"p-connected-overlay",onEnter:s.onOverlayEnter,onAfterEnter:s.onOverlayAfterEnter,onLeave:s.onOverlayLeave,onAfterLeave:s.onOverlayAfterLeave},{default:l.withCtx((()=>[o.overlayVisible?(l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,ref:s.overlayRef,style:i.panelStyle,class:s.panelStyleClass,onClick:t[14]||(t[14]=(...e)=>s.onOverlayClick&&s.onOverlayClick(...e)),onKeydown:t[15]||(t[15]=(...e)=>s.onOverlayKeyDown&&s.onOverlayKeyDown(...e))},i.panelProps),[l.createElementVNode("span",{ref:"firstHiddenFocusableElementOnOverlay",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:0,onFocus:t[8]||(t[8]=(...e)=>s.onFirstHiddenFocus&&s.onFirstHiddenFocus(...e))},null,544),l.renderSlot(e.$slots,"header",{value:i.modelValue,options:s.visibleOptions}),i.filter?(l.openBlock(),l.createElementBlock("div",v,[l.createElementVNode("div",O,[l.createElementVNode("input",l.mergeProps({ref:"filterInput",type:"text",value:o.filterValue,onVnodeUpdated:t[9]||(t[9]=(...e)=>s.onFilterUpdated&&s.onFilterUpdated(...e)),class:"p-dropdown-filter p-inputtext p-component",placeholder:i.filterPlaceholder,role:"searchbox",autocomplete:"off","aria-owns":o.id+"_list","aria-activedescendant":s.focusedOptionId,onKeydown:t[10]||(t[10]=(...e)=>s.onFilterKeyDown&&s.onFilterKeyDown(...e)),onBlur:t[11]||(t[11]=(...e)=>s.onFilterBlur&&s.onFilterBlur(...e)),onInput:t[12]||(t[12]=(...e)=>s.onFilterChange&&s.onFilterChange(...e))},i.filterInputProps),null,16,m),l.createElementVNode("span",{class:l.normalizeClass(["p-dropdown-filter-icon",i.filterIcon])},null,2)]),l.createElementVNode("span",g,l.toDisplayString(s.filterResultMessageText),1)])):l.createCommentVNode("",!0),l.createElementVNode("div",{class:"p-dropdown-items-wrapper",style:l.normalizeStyle({"max-height":s.virtualScrollerDisabled?i.scrollHeight:""})},[l.createVNode(r,l.mergeProps({ref:s.virtualScrollerRef},i.virtualScrollerOptions,{items:s.visibleOptions,style:{height:i.scrollHeight},tabindex:-1,disabled:s.virtualScrollerDisabled}),l.createSlots({content:l.withCtx((({styleClass:t,contentRef:n,items:r,getItemOptions:a,contentStyle:p,itemSize:c})=>[l.createElementVNode("ul",{ref:e=>s.listRef(e,n),id:o.id+"_list",class:l.normalizeClass(["p-dropdown-items",t]),style:l.normalizeStyle(p),role:"listbox"},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(r,((t,i)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:s.getOptionRenderKey(t,s.getOptionIndex(i,a))},[s.isOptionGroup(t)?(l.openBlock(),l.createElementBlock("li",{key:0,id:o.id+"_"+s.getOptionIndex(i,a),style:l.normalizeStyle({height:c?c+"px":void 0}),class:"p-dropdown-item-group",role:"option"},[l.renderSlot(e.$slots,"optiongroup",{option:t.optionGroup,index:s.getOptionIndex(i,a)},(()=>[l.createTextVNode(l.toDisplayString(s.getOptionGroupLabel(t.optionGroup)),1)]))],12,w)):l.withDirectives((l.openBlock(),l.createElementBlock("li",{key:1,id:o.id+"_"+s.getOptionIndex(i,a),style:l.normalizeStyle({height:c?c+"px":void 0}),class:l.normalizeClass(["p-dropdown-item",{"p-highlight":s.isSelected(t),"p-focus":o.focusedOptionIndex===s.getOptionIndex(i,a),"p-disabled":s.isOptionDisabled(t)}]),role:"option","aria-label":s.getOptionLabel(t),"aria-selected":s.isSelected(t),"aria-disabled":s.isOptionDisabled(t),"aria-setsize":s.ariaSetSize,"aria-posinset":s.getAriaPosInset(s.getOptionIndex(i,a)),onClick:e=>s.onOptionSelect(e,t),onMousemove:e=>s.onOptionMouseMove(e,s.getOptionIndex(i,a))},[l.renderSlot(e.$slots,"option",{option:t,index:s.getOptionIndex(i,a)},(()=>[l.createTextVNode(l.toDisplayString(s.getOptionLabel(t)),1)]))],46,I)),[[d]])],64)))),128)),o.filterValue&&(!r||r&&0===r.length)?(l.openBlock(),l.createElementBlock("li",S,[l.renderSlot(e.$slots,"emptyfilter",{},(()=>[l.createTextVNode(l.toDisplayString(s.emptyFilterMessageText),1)]))])):!i.options||i.options&&0===i.options.length?(l.openBlock(),l.createElementBlock("li",V,[l.renderSlot(e.$slots,"empty",{},(()=>[l.createTextVNode(l.toDisplayString(s.emptyMessageText),1)]))])):l.createCommentVNode("",!0)],14,x)])),_:2},[e.$slots.loader?{name:"loader",fn:l.withCtx((({options:t})=>[l.renderSlot(e.$slots,"loader",{options:t})])),key:"0"}:void 0]),1040,["items","style","disabled"])],4),l.renderSlot(e.$slots,"footer",{value:i.modelValue,options:s.visibleOptions}),!i.options||i.options&&0===i.options.length?(l.openBlock(),l.createElementBlock("span",k,l.toDisplayString(s.emptyMessageText),1)):l.createCommentVNode("",!0),l.createElementVNode("span",F,l.toDisplayString(s.selectedMessageText),1),l.createElementVNode("span",{ref:"lastHiddenFocusableElementOnOverlay",role:"presentation","aria-hidden":"true",class:"p-hidden-accessible p-hidden-focusable",tabindex:0,onFocus:t[13]||(t[13]=(...e)=>s.onLastHiddenFocus&&s.onLastHiddenFocus(...e))},null,544)],16)):l.createCommentVNode("",!0)])),_:3},8,["onEnter","onAfterEnter","onLeave","onAfterLeave"])])),_:3},8,["appendTo"])],10,h)},u}(primevue.api,primevue.overlayeventbus,primevue.portal,primevue.ripple,primevue.utils,primevue.virtualscroller,Vue);
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :class="containerClass" aria-live="polite">
2
+ <div v-focustrap :class="containerClass" aria-live="polite">
3
3
  <div v-if="!d_active" ref="display" :class="displayClass" :tabindex="$attrs.tabindex || '0'" role="button" @click="open" @keydown.enter="open" v-bind="displayProps">
4
4
  <slot name="display"></slot>
5
5
  </div>
@@ -12,6 +12,7 @@
12
12
 
13
13
  <script>
14
14
  import Button from 'primevue/button';
15
+ import FocusTrap from 'primevue/focustrap';
15
16
 
16
17
  export default {
17
18
  name: 'Inplace',
@@ -84,6 +85,9 @@ export default {
84
85
  },
85
86
  components: {
86
87
  IPButton: Button
88
+ },
89
+ directives: {
90
+ focustrap: FocusTrap
87
91
  }
88
92
  };
89
93
  </script>
@@ -1,11 +1,13 @@
1
1
  'use strict';
2
2
 
3
3
  var Button = require('primevue/button');
4
+ var FocusTrap = require('primevue/focustrap');
4
5
  var vue = require('vue');
5
6
 
6
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
7
8
 
8
9
  var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
10
+ var FocusTrap__default = /*#__PURE__*/_interopDefaultLegacy(FocusTrap);
9
11
 
10
12
  var script = {
11
13
  name: 'Inplace',
@@ -78,6 +80,9 @@ var script = {
78
80
  },
79
81
  components: {
80
82
  IPButton: Button__default["default"]
83
+ },
84
+ directives: {
85
+ focustrap: FocusTrap__default["default"]
81
86
  }
82
87
  };
83
88
 
@@ -89,8 +94,9 @@ const _hoisted_2 = {
89
94
 
90
95
  function render(_ctx, _cache, $props, $setup, $data, $options) {
91
96
  const _component_IPButton = vue.resolveComponent("IPButton");
97
+ const _directive_focustrap = vue.resolveDirective("focustrap");
92
98
 
93
- return (vue.openBlock(), vue.createElementBlock("div", {
99
+ return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
94
100
  class: vue.normalizeClass($options.containerClass),
95
101
  "aria-live": "polite"
96
102
  }, [
@@ -117,7 +123,9 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
117
123
  }, $props.closeButtonProps), null, 16, ["icon", "aria-label", "onClick"]))
118
124
  : vue.createCommentVNode("", true)
119
125
  ]))
120
- ], 2))
126
+ ], 2)), [
127
+ [_directive_focustrap]
128
+ ])
121
129
  }
122
130
 
123
131
  function styleInject(css, ref) {
@@ -1 +1 @@
1
- "use strict";var e=require("primevue/button"),t=require("vue");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l={name:"Inplace",emits:["open","close","update:active"],props:{closable:{type:Boolean,default:!1},active:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},closeIcon:{type:String,default:"pi pi-times"},displayProps:{type:null,default:null},closeButtonProps:{type:null,default:null}},data(){return{d_active:this.active}},watch:{active(e){this.d_active=e}},methods:{open(e){this.disabled||(this.$emit("open",e),this.d_active=!0,this.$emit("update:active",!0))},close(e){this.$emit("close",e),this.d_active=!1,this.$emit("update:active",!1),setTimeout((()=>{this.$refs.display.focus()}),0)}},computed:{containerClass(){return["p-inplace p-component",{"p-inplace-closable":this.closable}]},displayClass(){return["p-inplace-display",{"p-disabled":this.disabled}]},closeAriaLabel(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0}},components:{IPButton:n(e).default}};const i=["tabindex"],a={key:1,class:"p-inplace-content"};!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&l.firstChild?l.insertBefore(i,l.firstChild):l.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}("\n.p-inplace .p-inplace-display {\n display: inline;\n cursor: pointer;\n}\n.p-inplace .p-inplace-content {\n display: inline;\n}\n.p-fluid .p-inplace.p-inplace-closable .p-inplace-content {\n display: flex;\n}\n.p-fluid .p-inplace.p-inplace-closable .p-inplace-content > .p-inputtext {\n flex: 1 1 auto;\n width: 1%;\n}\n"),l.render=function(e,n,l,o,s,c){const p=t.resolveComponent("IPButton");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(c.containerClass),"aria-live":"polite"},[s.d_active?(t.openBlock(),t.createElementBlock("div",a,[t.renderSlot(e.$slots,"content"),l.closable?(t.openBlock(),t.createBlock(p,t.mergeProps({key:0,icon:l.closeIcon,"aria-label":c.closeAriaLabel,onClick:c.close},l.closeButtonProps),null,16,["icon","aria-label","onClick"])):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("div",t.mergeProps({key:0,ref:"display",class:c.displayClass,tabindex:e.$attrs.tabindex||"0",role:"button",onClick:n[0]||(n[0]=(...e)=>c.open&&c.open(...e)),onKeydown:n[1]||(n[1]=t.withKeys(((...e)=>c.open&&c.open(...e)),["enter"]))},l.displayProps),[t.renderSlot(e.$slots,"display")],16,i))],2)},module.exports=l;
1
+ "use strict";var e=require("primevue/button"),t=require("primevue/focustrap"),l=require("vue");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(e),a=n(t),o={name:"Inplace",emits:["open","close","update:active"],props:{closable:{type:Boolean,default:!1},active:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},closeIcon:{type:String,default:"pi pi-times"},displayProps:{type:null,default:null},closeButtonProps:{type:null,default:null}},data(){return{d_active:this.active}},watch:{active(e){this.d_active=e}},methods:{open(e){this.disabled||(this.$emit("open",e),this.d_active=!0,this.$emit("update:active",!0))},close(e){this.$emit("close",e),this.d_active=!1,this.$emit("update:active",!1),setTimeout((()=>{this.$refs.display.focus()}),0)}},computed:{containerClass(){return["p-inplace p-component",{"p-inplace-closable":this.closable}]},displayClass(){return["p-inplace-display",{"p-disabled":this.disabled}]},closeAriaLabel(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0}},components:{IPButton:i.default},directives:{focustrap:a.default}};const s=["tabindex"],c={key:1,class:"p-inplace-content"};!function(e,t){void 0===t&&(t={});var l=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===l&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}("\n.p-inplace .p-inplace-display {\n display: inline;\n cursor: pointer;\n}\n.p-inplace .p-inplace-content {\n display: inline;\n}\n.p-fluid .p-inplace.p-inplace-closable .p-inplace-content {\n display: flex;\n}\n.p-fluid .p-inplace.p-inplace-closable .p-inplace-content > .p-inputtext {\n flex: 1 1 auto;\n width: 1%;\n}\n"),o.render=function(e,t,n,i,a,o){const p=l.resolveComponent("IPButton"),r=l.resolveDirective("focustrap");return l.withDirectives((l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(o.containerClass),"aria-live":"polite"},[a.d_active?(l.openBlock(),l.createElementBlock("div",c,[l.renderSlot(e.$slots,"content"),n.closable?(l.openBlock(),l.createBlock(p,l.mergeProps({key:0,icon:n.closeIcon,"aria-label":o.closeAriaLabel,onClick:o.close},n.closeButtonProps),null,16,["icon","aria-label","onClick"])):l.createCommentVNode("",!0)])):(l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,ref:"display",class:o.displayClass,tabindex:e.$attrs.tabindex||"0",role:"button",onClick:t[0]||(t[0]=(...e)=>o.open&&o.open(...e)),onKeydown:t[1]||(t[1]=l.withKeys(((...e)=>o.open&&o.open(...e)),["enter"]))},n.displayProps),[l.renderSlot(e.$slots,"display")],16,s))],2)),[[r]])},module.exports=o;
@@ -1,5 +1,6 @@
1
1
  import Button from 'primevue/button';
2
- import { resolveComponent, openBlock, createElementBlock, normalizeClass, mergeProps, withKeys, renderSlot, createBlock, createCommentVNode } from 'vue';
2
+ import FocusTrap from 'primevue/focustrap';
3
+ import { resolveComponent, resolveDirective, withDirectives, openBlock, createElementBlock, normalizeClass, mergeProps, withKeys, renderSlot, createBlock, createCommentVNode } from 'vue';
3
4
 
4
5
  var script = {
5
6
  name: 'Inplace',
@@ -72,6 +73,9 @@ var script = {
72
73
  },
73
74
  components: {
74
75
  IPButton: Button
76
+ },
77
+ directives: {
78
+ focustrap: FocusTrap
75
79
  }
76
80
  };
77
81
 
@@ -83,8 +87,9 @@ const _hoisted_2 = {
83
87
 
84
88
  function render(_ctx, _cache, $props, $setup, $data, $options) {
85
89
  const _component_IPButton = resolveComponent("IPButton");
90
+ const _directive_focustrap = resolveDirective("focustrap");
86
91
 
87
- return (openBlock(), createElementBlock("div", {
92
+ return withDirectives((openBlock(), createElementBlock("div", {
88
93
  class: normalizeClass($options.containerClass),
89
94
  "aria-live": "polite"
90
95
  }, [
@@ -111,7 +116,9 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
111
116
  }, $props.closeButtonProps), null, 16, ["icon", "aria-label", "onClick"]))
112
117
  : createCommentVNode("", true)
113
118
  ]))
114
- ], 2))
119
+ ], 2)), [
120
+ [_directive_focustrap]
121
+ ])
115
122
  }
116
123
 
117
124
  function styleInject(css, ref) {
@@ -1 +1 @@
1
- import e from"primevue/button";import{resolveComponent as t,openBlock as i,createElementBlock as n,normalizeClass as l,mergeProps as a,withKeys as o,renderSlot as s,createBlock as p,createCommentVNode as c}from"vue";var d={name:"Inplace",emits:["open","close","update:active"],props:{closable:{type:Boolean,default:!1},active:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},closeIcon:{type:String,default:"pi pi-times"},displayProps:{type:null,default:null},closeButtonProps:{type:null,default:null}},data(){return{d_active:this.active}},watch:{active(e){this.d_active=e}},methods:{open(e){this.disabled||(this.$emit("open",e),this.d_active=!0,this.$emit("update:active",!0))},close(e){this.$emit("close",e),this.d_active=!1,this.$emit("update:active",!1),setTimeout((()=>{this.$refs.display.focus()}),0)}},computed:{containerClass(){return["p-inplace p-component",{"p-inplace-closable":this.closable}]},displayClass(){return["p-inplace-display",{"p-disabled":this.disabled}]},closeAriaLabel(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0}},components:{IPButton:e}};const r=["tabindex"],u={key:1,class:"p-inplace-content"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===i&&n.firstChild?n.insertBefore(l,n.firstChild):n.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}("\n.p-inplace .p-inplace-display {\n display: inline;\n cursor: pointer;\n}\n.p-inplace .p-inplace-content {\n display: inline;\n}\n.p-fluid .p-inplace.p-inplace-closable .p-inplace-content {\n display: flex;\n}\n.p-fluid .p-inplace.p-inplace-closable .p-inplace-content > .p-inputtext {\n flex: 1 1 auto;\n width: 1%;\n}\n"),d.render=function(e,d,y,m,f,h){const v=t("IPButton");return i(),n("div",{class:l(h.containerClass),"aria-live":"polite"},[f.d_active?(i(),n("div",u,[s(e.$slots,"content"),y.closable?(i(),p(v,a({key:0,icon:y.closeIcon,"aria-label":h.closeAriaLabel,onClick:h.close},y.closeButtonProps),null,16,["icon","aria-label","onClick"])):c("",!0)])):(i(),n("div",a({key:0,ref:"display",class:h.displayClass,tabindex:e.$attrs.tabindex||"0",role:"button",onClick:d[0]||(d[0]=(...e)=>h.open&&h.open(...e)),onKeydown:d[1]||(d[1]=o(((...e)=>h.open&&h.open(...e)),["enter"]))},y.displayProps),[s(e.$slots,"display")],16,r))],2)};export{d as default};
1
+ import e from"primevue/button";import t from"primevue/focustrap";import{resolveComponent as i,resolveDirective as n,withDirectives as l,openBlock as a,createElementBlock as o,normalizeClass as s,mergeProps as p,withKeys as c,renderSlot as d,createBlock as r,createCommentVNode as u}from"vue";var f={name:"Inplace",emits:["open","close","update:active"],props:{closable:{type:Boolean,default:!1},active:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},closeIcon:{type:String,default:"pi pi-times"},displayProps:{type:null,default:null},closeButtonProps:{type:null,default:null}},data(){return{d_active:this.active}},watch:{active(e){this.d_active=e}},methods:{open(e){this.disabled||(this.$emit("open",e),this.d_active=!0,this.$emit("update:active",!0))},close(e){this.$emit("close",e),this.d_active=!1,this.$emit("update:active",!1),setTimeout((()=>{this.$refs.display.focus()}),0)}},computed:{containerClass(){return["p-inplace p-component",{"p-inplace-closable":this.closable}]},displayClass(){return["p-inplace-display",{"p-disabled":this.disabled}]},closeAriaLabel(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0}},components:{IPButton:e},directives:{focustrap:t}};const m=["tabindex"],y={key:1,class:"p-inplace-content"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===i&&n.firstChild?n.insertBefore(l,n.firstChild):n.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}("\n.p-inplace .p-inplace-display {\n display: inline;\n cursor: pointer;\n}\n.p-inplace .p-inplace-content {\n display: inline;\n}\n.p-fluid .p-inplace.p-inplace-closable .p-inplace-content {\n display: flex;\n}\n.p-fluid .p-inplace.p-inplace-closable .p-inplace-content > .p-inputtext {\n flex: 1 1 auto;\n width: 1%;\n}\n"),f.render=function(e,t,f,v,h,b){const C=i("IPButton"),x=n("focustrap");return l((a(),o("div",{class:s(b.containerClass),"aria-live":"polite"},[h.d_active?(a(),o("div",y,[d(e.$slots,"content"),f.closable?(a(),r(C,p({key:0,icon:f.closeIcon,"aria-label":b.closeAriaLabel,onClick:b.close},f.closeButtonProps),null,16,["icon","aria-label","onClick"])):u("",!0)])):(a(),o("div",p({key:0,ref:"display",class:b.displayClass,tabindex:e.$attrs.tabindex||"0",role:"button",onClick:t[0]||(t[0]=(...e)=>b.open&&b.open(...e)),onKeydown:t[1]||(t[1]=c(((...e)=>b.open&&b.open(...e)),["enter"]))},f.displayProps),[d(e.$slots,"display")],16,m))],2)),[[x]])};export{f as default};
@@ -1,10 +1,11 @@
1
1
  this.primevue = this.primevue || {};
2
- this.primevue.inplace = (function (Button, vue) {
2
+ this.primevue.inplace = (function (Button, FocusTrap, vue) {
3
3
  'use strict';
4
4
 
5
5
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
6
6
 
7
7
  var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
8
+ var FocusTrap__default = /*#__PURE__*/_interopDefaultLegacy(FocusTrap);
8
9
 
9
10
  var script = {
10
11
  name: 'Inplace',
@@ -77,6 +78,9 @@ this.primevue.inplace = (function (Button, vue) {
77
78
  },
78
79
  components: {
79
80
  IPButton: Button__default["default"]
81
+ },
82
+ directives: {
83
+ focustrap: FocusTrap__default["default"]
80
84
  }
81
85
  };
82
86
 
@@ -88,8 +92,9 @@ this.primevue.inplace = (function (Button, vue) {
88
92
 
89
93
  function render(_ctx, _cache, $props, $setup, $data, $options) {
90
94
  const _component_IPButton = vue.resolveComponent("IPButton");
95
+ const _directive_focustrap = vue.resolveDirective("focustrap");
91
96
 
92
- return (vue.openBlock(), vue.createElementBlock("div", {
97
+ return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
93
98
  class: vue.normalizeClass($options.containerClass),
94
99
  "aria-live": "polite"
95
100
  }, [
@@ -116,7 +121,9 @@ this.primevue.inplace = (function (Button, vue) {
116
121
  }, $props.closeButtonProps), null, 16, ["icon", "aria-label", "onClick"]))
117
122
  : vue.createCommentVNode("", true)
118
123
  ]))
119
- ], 2))
124
+ ], 2)), [
125
+ [_directive_focustrap]
126
+ ])
120
127
  }
121
128
 
122
129
  function styleInject(css, ref) {
@@ -153,4 +160,4 @@ this.primevue.inplace = (function (Button, vue) {
153
160
 
154
161
  return script;
155
162
 
156
- })(primevue.button, Vue);
163
+ })(primevue.button, primevue.focustrap, Vue);
@@ -1 +1 @@
1
- this.primevue=this.primevue||{},this.primevue.inplace=function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l={name:"Inplace",emits:["open","close","update:active"],props:{closable:{type:Boolean,default:!1},active:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},closeIcon:{type:String,default:"pi pi-times"},displayProps:{type:null,default:null},closeButtonProps:{type:null,default:null}},data(){return{d_active:this.active}},watch:{active(e){this.d_active=e}},methods:{open(e){this.disabled||(this.$emit("open",e),this.d_active=!0,this.$emit("update:active",!0))},close(e){this.$emit("close",e),this.d_active=!1,this.$emit("update:active",!1),setTimeout((()=>{this.$refs.display.focus()}),0)}},computed:{containerClass(){return["p-inplace p-component",{"p-inplace-closable":this.closable}]},displayClass(){return["p-inplace-display",{"p-disabled":this.disabled}]},closeAriaLabel(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0}},components:{IPButton:n(e).default}};const i=["tabindex"],a={key:1,class:"p-inplace-content"};return function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&l.firstChild?l.insertBefore(i,l.firstChild):l.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}("\n.p-inplace .p-inplace-display {\n display: inline;\n cursor: pointer;\n}\n.p-inplace .p-inplace-content {\n display: inline;\n}\n.p-fluid .p-inplace.p-inplace-closable .p-inplace-content {\n display: flex;\n}\n.p-fluid .p-inplace.p-inplace-closable .p-inplace-content > .p-inputtext {\n flex: 1 1 auto;\n width: 1%;\n}\n"),l.render=function(e,n,l,o,s,c){const p=t.resolveComponent("IPButton");return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(c.containerClass),"aria-live":"polite"},[s.d_active?(t.openBlock(),t.createElementBlock("div",a,[t.renderSlot(e.$slots,"content"),l.closable?(t.openBlock(),t.createBlock(p,t.mergeProps({key:0,icon:l.closeIcon,"aria-label":c.closeAriaLabel,onClick:c.close},l.closeButtonProps),null,16,["icon","aria-label","onClick"])):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("div",t.mergeProps({key:0,ref:"display",class:c.displayClass,tabindex:e.$attrs.tabindex||"0",role:"button",onClick:n[0]||(n[0]=(...e)=>c.open&&c.open(...e)),onKeydown:n[1]||(n[1]=t.withKeys(((...e)=>c.open&&c.open(...e)),["enter"]))},l.displayProps),[t.renderSlot(e.$slots,"display")],16,i))],2)},l}(primevue.button,Vue);
1
+ this.primevue=this.primevue||{},this.primevue.inplace=function(e,t,n){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=i(e),a=i(t),o={name:"Inplace",emits:["open","close","update:active"],props:{closable:{type:Boolean,default:!1},active:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},closeIcon:{type:String,default:"pi pi-times"},displayProps:{type:null,default:null},closeButtonProps:{type:null,default:null}},data(){return{d_active:this.active}},watch:{active(e){this.d_active=e}},methods:{open(e){this.disabled||(this.$emit("open",e),this.d_active=!0,this.$emit("update:active",!0))},close(e){this.$emit("close",e),this.d_active=!1,this.$emit("update:active",!1),setTimeout((()=>{this.$refs.display.focus()}),0)}},computed:{containerClass(){return["p-inplace p-component",{"p-inplace-closable":this.closable}]},displayClass(){return["p-inplace-display",{"p-disabled":this.disabled}]},closeAriaLabel(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0}},components:{IPButton:l.default},directives:{focustrap:a.default}};const s=["tabindex"],c={key:1,class:"p-inplace-content"};return function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===n&&i.firstChild?i.insertBefore(l,i.firstChild):i.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}("\n.p-inplace .p-inplace-display {\n display: inline;\n cursor: pointer;\n}\n.p-inplace .p-inplace-content {\n display: inline;\n}\n.p-fluid .p-inplace.p-inplace-closable .p-inplace-content {\n display: flex;\n}\n.p-fluid .p-inplace.p-inplace-closable .p-inplace-content > .p-inputtext {\n flex: 1 1 auto;\n width: 1%;\n}\n"),o.render=function(e,t,i,l,a,o){const p=n.resolveComponent("IPButton"),r=n.resolveDirective("focustrap");return n.withDirectives((n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(o.containerClass),"aria-live":"polite"},[a.d_active?(n.openBlock(),n.createElementBlock("div",c,[n.renderSlot(e.$slots,"content"),i.closable?(n.openBlock(),n.createBlock(p,n.mergeProps({key:0,icon:i.closeIcon,"aria-label":o.closeAriaLabel,onClick:o.close},i.closeButtonProps),null,16,["icon","aria-label","onClick"])):n.createCommentVNode("",!0)])):(n.openBlock(),n.createElementBlock("div",n.mergeProps({key:0,ref:"display",class:o.displayClass,tabindex:e.$attrs.tabindex||"0",role:"button",onClick:t[0]||(t[0]=(...e)=>o.open&&o.open(...e)),onKeydown:t[1]||(t[1]=n.withKeys(((...e)=>o.open&&o.open(...e)),["enter"]))},i.displayProps),[n.renderSlot(e.$slots,"display")],16,s))],2)),[[r]])},o}(primevue.button,primevue.focustrap,Vue);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "primevue",
3
- "version": "3.25.0",
3
+ "version": "3.26.0",
4
4
  "homepage": "https://primevue.org/",
5
5
  "repository": {
6
6
  "type": "git",
package/panel/Panel.d.ts CHANGED
@@ -75,12 +75,12 @@ export interface PanelEmits {
75
75
  * Emitted when the collapsed changes.
76
76
  * @param {boolean} value - New value.
77
77
  */
78
- 'update:collapsed': (value: boolean) => void;
78
+ 'update:collapsed'(value: boolean): void;
79
79
  /**
80
80
  * Callback to invoke when a tab toggle.
81
81
  * @param {PanelToggleEvent} event - Custom toggle event.
82
82
  */
83
- toggle: (event: PanelToggleEvent) => void;
83
+ toggle(event: PanelToggleEvent): void;
84
84
  }
85
85
 
86
86
  /**
package/slider/Slider.vue CHANGED
@@ -155,24 +155,12 @@ export default {
155
155
  if (newValue < this.min) newValue = this.min;
156
156
  else if (newValue >= this.max) newValue = this.max;
157
157
 
158
- if (newValue > modelValue[1]) {
159
- modelValue[1] = newValue;
160
-
161
- this.handleIndex = 1;
162
- } else {
163
- modelValue[0] = newValue;
164
- }
158
+ modelValue[0] = newValue;
165
159
  } else {
166
160
  if (newValue > this.max) newValue = this.max;
167
161
  else if (newValue <= this.min) newValue = this.min;
168
162
 
169
- if (newValue < modelValue[0]) {
170
- modelValue[0] = newValue;
171
-
172
- this.handleIndex = 0;
173
- } else {
174
- modelValue[1] = newValue;
175
- }
163
+ modelValue[1] = newValue;
176
164
  }
177
165
  } else {
178
166
  if (newValue < this.min) newValue = this.min;
@@ -199,6 +187,7 @@ export default {
199
187
  this.handleIndex = index;
200
188
  }
201
189
 
190
+ event.currentTarget.focus();
202
191
  event.preventDefault();
203
192
  },
204
193
  onDrag(event) {
@@ -97,24 +97,12 @@ var script = {
97
97
  if (newValue < this.min) newValue = this.min;
98
98
  else if (newValue >= this.max) newValue = this.max;
99
99
 
100
- if (newValue > modelValue[1]) {
101
- modelValue[1] = newValue;
102
-
103
- this.handleIndex = 1;
104
- } else {
105
- modelValue[0] = newValue;
106
- }
100
+ modelValue[0] = newValue;
107
101
  } else {
108
102
  if (newValue > this.max) newValue = this.max;
109
103
  else if (newValue <= this.min) newValue = this.min;
110
104
 
111
- if (newValue < modelValue[0]) {
112
- modelValue[0] = newValue;
113
-
114
- this.handleIndex = 0;
115
- } else {
116
- modelValue[1] = newValue;
117
- }
105
+ modelValue[1] = newValue;
118
106
  }
119
107
  } else {
120
108
  if (newValue < this.min) newValue = this.min;
@@ -141,6 +129,7 @@ var script = {
141
129
  this.handleIndex = index;
142
130
  }
143
131
 
132
+ event.currentTarget.focus();
144
133
  event.preventDefault();
145
134
  },
146
135
  onDrag(event) {
@@ -1 +1 @@
1
- "use strict";var e=require("primevue/utils"),t=require("vue"),i={name:"Slider",emits:["update:modelValue","change","slideend"],props:{modelValue:[Number,Array],min:{type:Number,default:0},max:{type:Number,default:100},orientation:{type:String,default:"horizontal"},step:{type:Number,default:null},range:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},tabindex:{type:Number,default:0},"aria-labelledby":{type:String,default:null},"aria-label":{type:String,default:null}},dragging:!1,handleIndex:null,initX:null,initY:null,barWidth:null,barHeight:null,dragListener:null,dragEndListener:null,beforeUnmount(){this.unbindDragListeners()},methods:{updateDomData(){let t=this.$el.getBoundingClientRect();this.initX=t.left+e.DomHandler.getWindowScrollLeft(),this.initY=t.top+e.DomHandler.getWindowScrollTop(),this.barWidth=this.$el.offsetWidth,this.barHeight=this.$el.offsetHeight},setValue(e){let t,i=e.touches?e.touches[0].pageX:e.pageX,a=e.touches?e.touches[0].pageY:e.pageY;t="horizontal"===this.orientation?100*(i-this.initX)/this.barWidth:100*(this.initY+this.barHeight-a)/this.barHeight;let n=(this.max-this.min)*(t/100)+this.min;if(this.step){const e=this.range?this.modelValue[this.handleIndex]:this.modelValue,t=n-e;t<0?n=e+Math.ceil(n/this.step-e/this.step)*this.step:t>0&&(n=e+Math.floor(n/this.step-e/this.step)*this.step)}else n=Math.floor(n);this.updateModel(e,n)},updateModel(e,t){let i,a=parseFloat(t.toFixed(10));this.range?(i=this.modelValue?[...this.modelValue]:[],0==this.handleIndex?(a<this.min?a=this.min:a>=this.max&&(a=this.max),a>i[1]?(i[1]=a,this.handleIndex=1):i[0]=a):(a>this.max?a=this.max:a<=this.min&&(a=this.min),a<i[0]?(i[0]=a,this.handleIndex=0):i[1]=a)):(a<this.min?a=this.min:a>this.max&&(a=this.max),i=a),this.$emit("update:modelValue",i),this.$emit("change",i)},onDragStart(t,i){this.disabled||(e.DomHandler.addClass(this.$el,"p-slider-sliding"),this.dragging=!0,this.updateDomData(),this.range&&this.modelValue[0]===this.max?this.handleIndex=0:this.handleIndex=i,t.preventDefault())},onDrag(e){this.dragging&&(this.setValue(e),e.preventDefault())},onDragEnd(t){this.dragging&&(this.dragging=!1,e.DomHandler.removeClass(this.$el,"p-slider-sliding"),this.$emit("slideend",{originalEvent:t,value:this.modelValue}))},onBarClick(t){this.disabled||e.DomHandler.hasClass(t.target,"p-slider-handle")||(this.updateDomData(),this.setValue(t))},onMouseDown(e,t){this.bindDragListeners(),this.onDragStart(e,t)},onKeyDown(e,t){switch(this.handleIndex=t,e.code){case"ArrowDown":case"ArrowLeft":this.decrementValue(e,t),e.preventDefault();break;case"ArrowUp":case"ArrowRight":this.incrementValue(e,t),e.preventDefault();break;case"PageDown":this.decrementValue(e,t,!0),e.preventDefault();break;case"PageUp":this.incrementValue(e,t,!0),e.preventDefault();break;case"Home":this.updateModel(e,this.min),e.preventDefault();break;case"End":this.updateModel(e,this.max),e.preventDefault()}},decrementValue(e,t,i=!1){let a;a=this.range?this.step?this.modelValue[t]-this.step:this.modelValue[t]-1:this.step?this.modelValue-this.step:!this.step&&i?this.modelValue-10:this.modelValue-1,this.updateModel(e,a),e.preventDefault()},incrementValue(e,t,i=!1){let a;a=this.range?this.step?this.modelValue[t]+this.step:this.modelValue[t]+1:this.step?this.modelValue+this.step:!this.step&&i?this.modelValue+10:this.modelValue+1,this.updateModel(e,a),e.preventDefault()},bindDragListeners(){this.dragListener||(this.dragListener=this.onDrag.bind(this),document.addEventListener("mousemove",this.dragListener)),this.dragEndListener||(this.dragEndListener=this.onDragEnd.bind(this),document.addEventListener("mouseup",this.dragEndListener))},unbindDragListeners(){this.dragListener&&(document.removeEventListener("mousemove",this.dragListener),this.dragListener=null),this.dragEndListener&&(document.removeEventListener("mouseup",this.dragEndListener),this.dragEndListener=null)}},computed:{containerClass(){return["p-slider p-component",{"p-disabled":this.disabled,"p-slider-horizontal":"horizontal"===this.orientation,"p-slider-vertical":"vertical"===this.orientation}]},horizontal(){return"horizontal"===this.orientation},vertical(){return"vertical"===this.orientation},rangeStyle(){if(this.range){const e=this.rangeEndPosition>this.rangeStartPosition?this.rangeEndPosition-this.rangeStartPosition:this.rangeStartPosition-this.rangeEndPosition,t=this.rangeEndPosition>this.rangeStartPosition?this.rangeStartPosition:this.rangeEndPosition;return this.horizontal?{left:t+"%",width:e+"%"}:{bottom:t+"%",height:e+"%"}}return this.horizontal?{width:this.handlePosition+"%"}:{height:this.handlePosition+"%"}},handleStyle(){return this.horizontal?{left:this.handlePosition+"%"}:{bottom:this.handlePosition+"%"}},handlePosition(){return this.modelValue<this.min?0:this.modelValue>this.max?100:100*(this.modelValue-this.min)/(this.max-this.min)},rangeStartPosition(){return this.modelValue&&this.modelValue[0]?100*(this.modelValue[0]<this.min?0:this.modelValue[0]-this.min)/(this.max-this.min):0},rangeEndPosition(){return this.modelValue&&2===this.modelValue.length?100*(this.modelValue[1]>this.max?100:this.modelValue[1]-this.min)/(this.max-this.min):100},rangeStartHandleStyle(){return this.horizontal?{left:this.rangeStartPosition+"%"}:{bottom:this.rangeStartPosition+"%"}},rangeEndHandleStyle(){return this.horizontal?{left:this.rangeEndPosition+"%"}:{bottom:this.rangeEndPosition+"%"}}}};const a=["tabindex","aria-valuemin","aria-valuenow","aria-valuemax","aria-labelledby","aria-label","aria-orientation"],n=["tabindex","aria-valuemin","aria-valuenow","aria-valuemax","aria-labelledby","aria-label","aria-orientation"],l=["tabindex","aria-valuemin","aria-valuenow","aria-valuemax","aria-labelledby","aria-label","aria-orientation"];!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&a.firstChild?a.insertBefore(n,a.firstChild):a.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-slider {\n position: relative;\n}\n.p-slider .p-slider-handle {\n position: absolute;\n cursor: grab;\n touch-action: none;\n display: block;\n}\n.p-slider-range {\n position: absolute;\n display: block;\n}\n.p-slider-horizontal .p-slider-range {\n top: 0;\n left: 0;\n height: 100%;\n}\n.p-slider-horizontal .p-slider-handle {\n top: 50%;\n}\n.p-slider-vertical {\n height: 100px;\n}\n.p-slider-vertical .p-slider-handle {\n left: 50%;\n}\n.p-slider-vertical .p-slider-range {\n bottom: 0;\n left: 0;\n width: 100%;\n}\n"),i.render=function(e,i,s,o,r,d){return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(d.containerClass),onClick:i[15]||(i[15]=(...e)=>d.onBarClick&&d.onBarClick(...e))},[t.createElementVNode("span",{class:"p-slider-range",style:t.normalizeStyle(d.rangeStyle)},null,4),s.range?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",{key:0,class:"p-slider-handle",style:t.normalizeStyle(d.handleStyle),onTouchstart:i[0]||(i[0]=e=>d.onDragStart(e)),onTouchmove:i[1]||(i[1]=e=>d.onDrag(e)),onTouchend:i[2]||(i[2]=e=>d.onDragEnd(e)),onMousedown:i[3]||(i[3]=e=>d.onMouseDown(e)),onKeydown:i[4]||(i[4]=e=>d.onKeyDown(e)),tabindex:s.tabindex,role:"slider","aria-valuemin":s.min,"aria-valuenow":s.modelValue,"aria-valuemax":s.max,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,"aria-orientation":s.orientation},null,44,a)),s.range?(t.openBlock(),t.createElementBlock("span",{key:1,class:"p-slider-handle",style:t.normalizeStyle(d.rangeStartHandleStyle),onTouchstart:i[5]||(i[5]=e=>d.onDragStart(e,0)),onTouchmove:i[6]||(i[6]=e=>d.onDrag(e)),onTouchend:i[7]||(i[7]=e=>d.onDragEnd(e)),onMousedown:i[8]||(i[8]=e=>d.onMouseDown(e,0)),onKeydown:i[9]||(i[9]=e=>d.onKeyDown(e,0)),tabindex:s.tabindex,role:"slider","aria-valuemin":s.min,"aria-valuenow":s.modelValue?s.modelValue[0]:null,"aria-valuemax":s.max,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,"aria-orientation":s.orientation},null,44,n)):t.createCommentVNode("",!0),s.range?(t.openBlock(),t.createElementBlock("span",{key:2,class:"p-slider-handle",style:t.normalizeStyle(d.rangeEndHandleStyle),onTouchstart:i[10]||(i[10]=e=>d.onDragStart(e,1)),onTouchmove:i[11]||(i[11]=e=>d.onDrag(e)),onTouchend:i[12]||(i[12]=e=>d.onDragEnd(e)),onMousedown:i[13]||(i[13]=e=>d.onMouseDown(e,1)),onKeydown:i[14]||(i[14]=e=>d.onKeyDown(e,1)),tabindex:s.tabindex,role:"slider","aria-valuemin":s.min,"aria-valuenow":s.modelValue?s.modelValue[1]:null,"aria-valuemax":s.max,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,"aria-orientation":s.orientation},null,44,l)):t.createCommentVNode("",!0)],2)},module.exports=i;
1
+ "use strict";var e=require("primevue/utils"),t=require("vue"),i={name:"Slider",emits:["update:modelValue","change","slideend"],props:{modelValue:[Number,Array],min:{type:Number,default:0},max:{type:Number,default:100},orientation:{type:String,default:"horizontal"},step:{type:Number,default:null},range:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},tabindex:{type:Number,default:0},"aria-labelledby":{type:String,default:null},"aria-label":{type:String,default:null}},dragging:!1,handleIndex:null,initX:null,initY:null,barWidth:null,barHeight:null,dragListener:null,dragEndListener:null,beforeUnmount(){this.unbindDragListeners()},methods:{updateDomData(){let t=this.$el.getBoundingClientRect();this.initX=t.left+e.DomHandler.getWindowScrollLeft(),this.initY=t.top+e.DomHandler.getWindowScrollTop(),this.barWidth=this.$el.offsetWidth,this.barHeight=this.$el.offsetHeight},setValue(e){let t,i=e.touches?e.touches[0].pageX:e.pageX,a=e.touches?e.touches[0].pageY:e.pageY;t="horizontal"===this.orientation?100*(i-this.initX)/this.barWidth:100*(this.initY+this.barHeight-a)/this.barHeight;let n=(this.max-this.min)*(t/100)+this.min;if(this.step){const e=this.range?this.modelValue[this.handleIndex]:this.modelValue,t=n-e;t<0?n=e+Math.ceil(n/this.step-e/this.step)*this.step:t>0&&(n=e+Math.floor(n/this.step-e/this.step)*this.step)}else n=Math.floor(n);this.updateModel(e,n)},updateModel(e,t){let i,a=parseFloat(t.toFixed(10));this.range?(i=this.modelValue?[...this.modelValue]:[],0==this.handleIndex?(a<this.min?a=this.min:a>=this.max&&(a=this.max),i[0]=a):(a>this.max?a=this.max:a<=this.min&&(a=this.min),i[1]=a)):(a<this.min?a=this.min:a>this.max&&(a=this.max),i=a),this.$emit("update:modelValue",i),this.$emit("change",i)},onDragStart(t,i){this.disabled||(e.DomHandler.addClass(this.$el,"p-slider-sliding"),this.dragging=!0,this.updateDomData(),this.range&&this.modelValue[0]===this.max?this.handleIndex=0:this.handleIndex=i,t.currentTarget.focus(),t.preventDefault())},onDrag(e){this.dragging&&(this.setValue(e),e.preventDefault())},onDragEnd(t){this.dragging&&(this.dragging=!1,e.DomHandler.removeClass(this.$el,"p-slider-sliding"),this.$emit("slideend",{originalEvent:t,value:this.modelValue}))},onBarClick(t){this.disabled||e.DomHandler.hasClass(t.target,"p-slider-handle")||(this.updateDomData(),this.setValue(t))},onMouseDown(e,t){this.bindDragListeners(),this.onDragStart(e,t)},onKeyDown(e,t){switch(this.handleIndex=t,e.code){case"ArrowDown":case"ArrowLeft":this.decrementValue(e,t),e.preventDefault();break;case"ArrowUp":case"ArrowRight":this.incrementValue(e,t),e.preventDefault();break;case"PageDown":this.decrementValue(e,t,!0),e.preventDefault();break;case"PageUp":this.incrementValue(e,t,!0),e.preventDefault();break;case"Home":this.updateModel(e,this.min),e.preventDefault();break;case"End":this.updateModel(e,this.max),e.preventDefault()}},decrementValue(e,t,i=!1){let a;a=this.range?this.step?this.modelValue[t]-this.step:this.modelValue[t]-1:this.step?this.modelValue-this.step:!this.step&&i?this.modelValue-10:this.modelValue-1,this.updateModel(e,a),e.preventDefault()},incrementValue(e,t,i=!1){let a;a=this.range?this.step?this.modelValue[t]+this.step:this.modelValue[t]+1:this.step?this.modelValue+this.step:!this.step&&i?this.modelValue+10:this.modelValue+1,this.updateModel(e,a),e.preventDefault()},bindDragListeners(){this.dragListener||(this.dragListener=this.onDrag.bind(this),document.addEventListener("mousemove",this.dragListener)),this.dragEndListener||(this.dragEndListener=this.onDragEnd.bind(this),document.addEventListener("mouseup",this.dragEndListener))},unbindDragListeners(){this.dragListener&&(document.removeEventListener("mousemove",this.dragListener),this.dragListener=null),this.dragEndListener&&(document.removeEventListener("mouseup",this.dragEndListener),this.dragEndListener=null)}},computed:{containerClass(){return["p-slider p-component",{"p-disabled":this.disabled,"p-slider-horizontal":"horizontal"===this.orientation,"p-slider-vertical":"vertical"===this.orientation}]},horizontal(){return"horizontal"===this.orientation},vertical(){return"vertical"===this.orientation},rangeStyle(){if(this.range){const e=this.rangeEndPosition>this.rangeStartPosition?this.rangeEndPosition-this.rangeStartPosition:this.rangeStartPosition-this.rangeEndPosition,t=this.rangeEndPosition>this.rangeStartPosition?this.rangeStartPosition:this.rangeEndPosition;return this.horizontal?{left:t+"%",width:e+"%"}:{bottom:t+"%",height:e+"%"}}return this.horizontal?{width:this.handlePosition+"%"}:{height:this.handlePosition+"%"}},handleStyle(){return this.horizontal?{left:this.handlePosition+"%"}:{bottom:this.handlePosition+"%"}},handlePosition(){return this.modelValue<this.min?0:this.modelValue>this.max?100:100*(this.modelValue-this.min)/(this.max-this.min)},rangeStartPosition(){return this.modelValue&&this.modelValue[0]?100*(this.modelValue[0]<this.min?0:this.modelValue[0]-this.min)/(this.max-this.min):0},rangeEndPosition(){return this.modelValue&&2===this.modelValue.length?100*(this.modelValue[1]>this.max?100:this.modelValue[1]-this.min)/(this.max-this.min):100},rangeStartHandleStyle(){return this.horizontal?{left:this.rangeStartPosition+"%"}:{bottom:this.rangeStartPosition+"%"}},rangeEndHandleStyle(){return this.horizontal?{left:this.rangeEndPosition+"%"}:{bottom:this.rangeEndPosition+"%"}}}};const a=["tabindex","aria-valuemin","aria-valuenow","aria-valuemax","aria-labelledby","aria-label","aria-orientation"],n=["tabindex","aria-valuemin","aria-valuenow","aria-valuemax","aria-labelledby","aria-label","aria-orientation"],l=["tabindex","aria-valuemin","aria-valuenow","aria-valuemax","aria-labelledby","aria-label","aria-orientation"];!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&a.firstChild?a.insertBefore(n,a.firstChild):a.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-slider {\n position: relative;\n}\n.p-slider .p-slider-handle {\n position: absolute;\n cursor: grab;\n touch-action: none;\n display: block;\n}\n.p-slider-range {\n position: absolute;\n display: block;\n}\n.p-slider-horizontal .p-slider-range {\n top: 0;\n left: 0;\n height: 100%;\n}\n.p-slider-horizontal .p-slider-handle {\n top: 50%;\n}\n.p-slider-vertical {\n height: 100px;\n}\n.p-slider-vertical .p-slider-handle {\n left: 50%;\n}\n.p-slider-vertical .p-slider-range {\n bottom: 0;\n left: 0;\n width: 100%;\n}\n"),i.render=function(e,i,s,r,o,d){return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(d.containerClass),onClick:i[15]||(i[15]=(...e)=>d.onBarClick&&d.onBarClick(...e))},[t.createElementVNode("span",{class:"p-slider-range",style:t.normalizeStyle(d.rangeStyle)},null,4),s.range?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",{key:0,class:"p-slider-handle",style:t.normalizeStyle(d.handleStyle),onTouchstart:i[0]||(i[0]=e=>d.onDragStart(e)),onTouchmove:i[1]||(i[1]=e=>d.onDrag(e)),onTouchend:i[2]||(i[2]=e=>d.onDragEnd(e)),onMousedown:i[3]||(i[3]=e=>d.onMouseDown(e)),onKeydown:i[4]||(i[4]=e=>d.onKeyDown(e)),tabindex:s.tabindex,role:"slider","aria-valuemin":s.min,"aria-valuenow":s.modelValue,"aria-valuemax":s.max,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,"aria-orientation":s.orientation},null,44,a)),s.range?(t.openBlock(),t.createElementBlock("span",{key:1,class:"p-slider-handle",style:t.normalizeStyle(d.rangeStartHandleStyle),onTouchstart:i[5]||(i[5]=e=>d.onDragStart(e,0)),onTouchmove:i[6]||(i[6]=e=>d.onDrag(e)),onTouchend:i[7]||(i[7]=e=>d.onDragEnd(e)),onMousedown:i[8]||(i[8]=e=>d.onMouseDown(e,0)),onKeydown:i[9]||(i[9]=e=>d.onKeyDown(e,0)),tabindex:s.tabindex,role:"slider","aria-valuemin":s.min,"aria-valuenow":s.modelValue?s.modelValue[0]:null,"aria-valuemax":s.max,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,"aria-orientation":s.orientation},null,44,n)):t.createCommentVNode("",!0),s.range?(t.openBlock(),t.createElementBlock("span",{key:2,class:"p-slider-handle",style:t.normalizeStyle(d.rangeEndHandleStyle),onTouchstart:i[10]||(i[10]=e=>d.onDragStart(e,1)),onTouchmove:i[11]||(i[11]=e=>d.onDrag(e)),onTouchend:i[12]||(i[12]=e=>d.onDragEnd(e)),onMousedown:i[13]||(i[13]=e=>d.onMouseDown(e,1)),onKeydown:i[14]||(i[14]=e=>d.onKeyDown(e,1)),tabindex:s.tabindex,role:"slider","aria-valuemin":s.min,"aria-valuenow":s.modelValue?s.modelValue[1]:null,"aria-valuemax":s.max,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,"aria-orientation":s.orientation},null,44,l)):t.createCommentVNode("",!0)],2)},module.exports=i;
@@ -95,24 +95,12 @@ var script = {
95
95
  if (newValue < this.min) newValue = this.min;
96
96
  else if (newValue >= this.max) newValue = this.max;
97
97
 
98
- if (newValue > modelValue[1]) {
99
- modelValue[1] = newValue;
100
-
101
- this.handleIndex = 1;
102
- } else {
103
- modelValue[0] = newValue;
104
- }
98
+ modelValue[0] = newValue;
105
99
  } else {
106
100
  if (newValue > this.max) newValue = this.max;
107
101
  else if (newValue <= this.min) newValue = this.min;
108
102
 
109
- if (newValue < modelValue[0]) {
110
- modelValue[0] = newValue;
111
-
112
- this.handleIndex = 0;
113
- } else {
114
- modelValue[1] = newValue;
115
- }
103
+ modelValue[1] = newValue;
116
104
  }
117
105
  } else {
118
106
  if (newValue < this.min) newValue = this.min;
@@ -139,6 +127,7 @@ var script = {
139
127
  this.handleIndex = index;
140
128
  }
141
129
 
130
+ event.currentTarget.focus();
142
131
  event.preventDefault();
143
132
  },
144
133
  onDrag(event) {
@@ -1 +1 @@
1
- import{DomHandler as e}from"primevue/utils";import{openBlock as t,createElementBlock as i,normalizeClass as a,createElementVNode as n,normalizeStyle as l,createCommentVNode as s}from"vue";var r={name:"Slider",emits:["update:modelValue","change","slideend"],props:{modelValue:[Number,Array],min:{type:Number,default:0},max:{type:Number,default:100},orientation:{type:String,default:"horizontal"},step:{type:Number,default:null},range:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},tabindex:{type:Number,default:0},"aria-labelledby":{type:String,default:null},"aria-label":{type:String,default:null}},dragging:!1,handleIndex:null,initX:null,initY:null,barWidth:null,barHeight:null,dragListener:null,dragEndListener:null,beforeUnmount(){this.unbindDragListeners()},methods:{updateDomData(){let t=this.$el.getBoundingClientRect();this.initX=t.left+e.getWindowScrollLeft(),this.initY=t.top+e.getWindowScrollTop(),this.barWidth=this.$el.offsetWidth,this.barHeight=this.$el.offsetHeight},setValue(e){let t,i=e.touches?e.touches[0].pageX:e.pageX,a=e.touches?e.touches[0].pageY:e.pageY;t="horizontal"===this.orientation?100*(i-this.initX)/this.barWidth:100*(this.initY+this.barHeight-a)/this.barHeight;let n=(this.max-this.min)*(t/100)+this.min;if(this.step){const e=this.range?this.modelValue[this.handleIndex]:this.modelValue,t=n-e;t<0?n=e+Math.ceil(n/this.step-e/this.step)*this.step:t>0&&(n=e+Math.floor(n/this.step-e/this.step)*this.step)}else n=Math.floor(n);this.updateModel(e,n)},updateModel(e,t){let i,a=parseFloat(t.toFixed(10));this.range?(i=this.modelValue?[...this.modelValue]:[],0==this.handleIndex?(a<this.min?a=this.min:a>=this.max&&(a=this.max),a>i[1]?(i[1]=a,this.handleIndex=1):i[0]=a):(a>this.max?a=this.max:a<=this.min&&(a=this.min),a<i[0]?(i[0]=a,this.handleIndex=0):i[1]=a)):(a<this.min?a=this.min:a>this.max&&(a=this.max),i=a),this.$emit("update:modelValue",i),this.$emit("change",i)},onDragStart(t,i){this.disabled||(e.addClass(this.$el,"p-slider-sliding"),this.dragging=!0,this.updateDomData(),this.range&&this.modelValue[0]===this.max?this.handleIndex=0:this.handleIndex=i,t.preventDefault())},onDrag(e){this.dragging&&(this.setValue(e),e.preventDefault())},onDragEnd(t){this.dragging&&(this.dragging=!1,e.removeClass(this.$el,"p-slider-sliding"),this.$emit("slideend",{originalEvent:t,value:this.modelValue}))},onBarClick(t){this.disabled||e.hasClass(t.target,"p-slider-handle")||(this.updateDomData(),this.setValue(t))},onMouseDown(e,t){this.bindDragListeners(),this.onDragStart(e,t)},onKeyDown(e,t){switch(this.handleIndex=t,e.code){case"ArrowDown":case"ArrowLeft":this.decrementValue(e,t),e.preventDefault();break;case"ArrowUp":case"ArrowRight":this.incrementValue(e,t),e.preventDefault();break;case"PageDown":this.decrementValue(e,t,!0),e.preventDefault();break;case"PageUp":this.incrementValue(e,t,!0),e.preventDefault();break;case"Home":this.updateModel(e,this.min),e.preventDefault();break;case"End":this.updateModel(e,this.max),e.preventDefault()}},decrementValue(e,t,i=!1){let a;a=this.range?this.step?this.modelValue[t]-this.step:this.modelValue[t]-1:this.step?this.modelValue-this.step:!this.step&&i?this.modelValue-10:this.modelValue-1,this.updateModel(e,a),e.preventDefault()},incrementValue(e,t,i=!1){let a;a=this.range?this.step?this.modelValue[t]+this.step:this.modelValue[t]+1:this.step?this.modelValue+this.step:!this.step&&i?this.modelValue+10:this.modelValue+1,this.updateModel(e,a),e.preventDefault()},bindDragListeners(){this.dragListener||(this.dragListener=this.onDrag.bind(this),document.addEventListener("mousemove",this.dragListener)),this.dragEndListener||(this.dragEndListener=this.onDragEnd.bind(this),document.addEventListener("mouseup",this.dragEndListener))},unbindDragListeners(){this.dragListener&&(document.removeEventListener("mousemove",this.dragListener),this.dragListener=null),this.dragEndListener&&(document.removeEventListener("mouseup",this.dragEndListener),this.dragEndListener=null)}},computed:{containerClass(){return["p-slider p-component",{"p-disabled":this.disabled,"p-slider-horizontal":"horizontal"===this.orientation,"p-slider-vertical":"vertical"===this.orientation}]},horizontal(){return"horizontal"===this.orientation},vertical(){return"vertical"===this.orientation},rangeStyle(){if(this.range){const e=this.rangeEndPosition>this.rangeStartPosition?this.rangeEndPosition-this.rangeStartPosition:this.rangeStartPosition-this.rangeEndPosition,t=this.rangeEndPosition>this.rangeStartPosition?this.rangeStartPosition:this.rangeEndPosition;return this.horizontal?{left:t+"%",width:e+"%"}:{bottom:t+"%",height:e+"%"}}return this.horizontal?{width:this.handlePosition+"%"}:{height:this.handlePosition+"%"}},handleStyle(){return this.horizontal?{left:this.handlePosition+"%"}:{bottom:this.handlePosition+"%"}},handlePosition(){return this.modelValue<this.min?0:this.modelValue>this.max?100:100*(this.modelValue-this.min)/(this.max-this.min)},rangeStartPosition(){return this.modelValue&&this.modelValue[0]?100*(this.modelValue[0]<this.min?0:this.modelValue[0]-this.min)/(this.max-this.min):0},rangeEndPosition(){return this.modelValue&&2===this.modelValue.length?100*(this.modelValue[1]>this.max?100:this.modelValue[1]-this.min)/(this.max-this.min):100},rangeStartHandleStyle(){return this.horizontal?{left:this.rangeStartPosition+"%"}:{bottom:this.rangeStartPosition+"%"}},rangeEndHandleStyle(){return this.horizontal?{left:this.rangeEndPosition+"%"}:{bottom:this.rangeEndPosition+"%"}}}};const o=["tabindex","aria-valuemin","aria-valuenow","aria-valuemax","aria-labelledby","aria-label","aria-orientation"],d=["tabindex","aria-valuemin","aria-valuenow","aria-valuemax","aria-labelledby","aria-label","aria-orientation"],h=["tabindex","aria-valuemin","aria-valuenow","aria-valuemax","aria-labelledby","aria-label","aria-orientation"];!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&a.firstChild?a.insertBefore(n,a.firstChild):a.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-slider {\n position: relative;\n}\n.p-slider .p-slider-handle {\n position: absolute;\n cursor: grab;\n touch-action: none;\n display: block;\n}\n.p-slider-range {\n position: absolute;\n display: block;\n}\n.p-slider-horizontal .p-slider-range {\n top: 0;\n left: 0;\n height: 100%;\n}\n.p-slider-horizontal .p-slider-handle {\n top: 50%;\n}\n.p-slider-vertical {\n height: 100px;\n}\n.p-slider-vertical .p-slider-handle {\n left: 50%;\n}\n.p-slider-vertical .p-slider-range {\n bottom: 0;\n left: 0;\n width: 100%;\n}\n"),r.render=function(e,r,u,m,g,p){return t(),i("div",{class:a(p.containerClass),onClick:r[15]||(r[15]=(...e)=>p.onBarClick&&p.onBarClick(...e))},[n("span",{class:"p-slider-range",style:l(p.rangeStyle)},null,4),u.range?s("",!0):(t(),i("span",{key:0,class:"p-slider-handle",style:l(p.handleStyle),onTouchstart:r[0]||(r[0]=e=>p.onDragStart(e)),onTouchmove:r[1]||(r[1]=e=>p.onDrag(e)),onTouchend:r[2]||(r[2]=e=>p.onDragEnd(e)),onMousedown:r[3]||(r[3]=e=>p.onMouseDown(e)),onKeydown:r[4]||(r[4]=e=>p.onKeyDown(e)),tabindex:u.tabindex,role:"slider","aria-valuemin":u.min,"aria-valuenow":u.modelValue,"aria-valuemax":u.max,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,"aria-orientation":u.orientation},null,44,o)),u.range?(t(),i("span",{key:1,class:"p-slider-handle",style:l(p.rangeStartHandleStyle),onTouchstart:r[5]||(r[5]=e=>p.onDragStart(e,0)),onTouchmove:r[6]||(r[6]=e=>p.onDrag(e)),onTouchend:r[7]||(r[7]=e=>p.onDragEnd(e)),onMousedown:r[8]||(r[8]=e=>p.onMouseDown(e,0)),onKeydown:r[9]||(r[9]=e=>p.onKeyDown(e,0)),tabindex:u.tabindex,role:"slider","aria-valuemin":u.min,"aria-valuenow":u.modelValue?u.modelValue[0]:null,"aria-valuemax":u.max,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,"aria-orientation":u.orientation},null,44,d)):s("",!0),u.range?(t(),i("span",{key:2,class:"p-slider-handle",style:l(p.rangeEndHandleStyle),onTouchstart:r[10]||(r[10]=e=>p.onDragStart(e,1)),onTouchmove:r[11]||(r[11]=e=>p.onDrag(e)),onTouchend:r[12]||(r[12]=e=>p.onDragEnd(e)),onMousedown:r[13]||(r[13]=e=>p.onMouseDown(e,1)),onKeydown:r[14]||(r[14]=e=>p.onKeyDown(e,1)),tabindex:u.tabindex,role:"slider","aria-valuemin":u.min,"aria-valuenow":u.modelValue?u.modelValue[1]:null,"aria-valuemax":u.max,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,"aria-orientation":u.orientation},null,44,h)):s("",!0)],2)};export{r as default};
1
+ import{DomHandler as e}from"primevue/utils";import{openBlock as t,createElementBlock as i,normalizeClass as a,createElementVNode as n,normalizeStyle as l,createCommentVNode as s}from"vue";var r={name:"Slider",emits:["update:modelValue","change","slideend"],props:{modelValue:[Number,Array],min:{type:Number,default:0},max:{type:Number,default:100},orientation:{type:String,default:"horizontal"},step:{type:Number,default:null},range:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},tabindex:{type:Number,default:0},"aria-labelledby":{type:String,default:null},"aria-label":{type:String,default:null}},dragging:!1,handleIndex:null,initX:null,initY:null,barWidth:null,barHeight:null,dragListener:null,dragEndListener:null,beforeUnmount(){this.unbindDragListeners()},methods:{updateDomData(){let t=this.$el.getBoundingClientRect();this.initX=t.left+e.getWindowScrollLeft(),this.initY=t.top+e.getWindowScrollTop(),this.barWidth=this.$el.offsetWidth,this.barHeight=this.$el.offsetHeight},setValue(e){let t,i=e.touches?e.touches[0].pageX:e.pageX,a=e.touches?e.touches[0].pageY:e.pageY;t="horizontal"===this.orientation?100*(i-this.initX)/this.barWidth:100*(this.initY+this.barHeight-a)/this.barHeight;let n=(this.max-this.min)*(t/100)+this.min;if(this.step){const e=this.range?this.modelValue[this.handleIndex]:this.modelValue,t=n-e;t<0?n=e+Math.ceil(n/this.step-e/this.step)*this.step:t>0&&(n=e+Math.floor(n/this.step-e/this.step)*this.step)}else n=Math.floor(n);this.updateModel(e,n)},updateModel(e,t){let i,a=parseFloat(t.toFixed(10));this.range?(i=this.modelValue?[...this.modelValue]:[],0==this.handleIndex?(a<this.min?a=this.min:a>=this.max&&(a=this.max),i[0]=a):(a>this.max?a=this.max:a<=this.min&&(a=this.min),i[1]=a)):(a<this.min?a=this.min:a>this.max&&(a=this.max),i=a),this.$emit("update:modelValue",i),this.$emit("change",i)},onDragStart(t,i){this.disabled||(e.addClass(this.$el,"p-slider-sliding"),this.dragging=!0,this.updateDomData(),this.range&&this.modelValue[0]===this.max?this.handleIndex=0:this.handleIndex=i,t.currentTarget.focus(),t.preventDefault())},onDrag(e){this.dragging&&(this.setValue(e),e.preventDefault())},onDragEnd(t){this.dragging&&(this.dragging=!1,e.removeClass(this.$el,"p-slider-sliding"),this.$emit("slideend",{originalEvent:t,value:this.modelValue}))},onBarClick(t){this.disabled||e.hasClass(t.target,"p-slider-handle")||(this.updateDomData(),this.setValue(t))},onMouseDown(e,t){this.bindDragListeners(),this.onDragStart(e,t)},onKeyDown(e,t){switch(this.handleIndex=t,e.code){case"ArrowDown":case"ArrowLeft":this.decrementValue(e,t),e.preventDefault();break;case"ArrowUp":case"ArrowRight":this.incrementValue(e,t),e.preventDefault();break;case"PageDown":this.decrementValue(e,t,!0),e.preventDefault();break;case"PageUp":this.incrementValue(e,t,!0),e.preventDefault();break;case"Home":this.updateModel(e,this.min),e.preventDefault();break;case"End":this.updateModel(e,this.max),e.preventDefault()}},decrementValue(e,t,i=!1){let a;a=this.range?this.step?this.modelValue[t]-this.step:this.modelValue[t]-1:this.step?this.modelValue-this.step:!this.step&&i?this.modelValue-10:this.modelValue-1,this.updateModel(e,a),e.preventDefault()},incrementValue(e,t,i=!1){let a;a=this.range?this.step?this.modelValue[t]+this.step:this.modelValue[t]+1:this.step?this.modelValue+this.step:!this.step&&i?this.modelValue+10:this.modelValue+1,this.updateModel(e,a),e.preventDefault()},bindDragListeners(){this.dragListener||(this.dragListener=this.onDrag.bind(this),document.addEventListener("mousemove",this.dragListener)),this.dragEndListener||(this.dragEndListener=this.onDragEnd.bind(this),document.addEventListener("mouseup",this.dragEndListener))},unbindDragListeners(){this.dragListener&&(document.removeEventListener("mousemove",this.dragListener),this.dragListener=null),this.dragEndListener&&(document.removeEventListener("mouseup",this.dragEndListener),this.dragEndListener=null)}},computed:{containerClass(){return["p-slider p-component",{"p-disabled":this.disabled,"p-slider-horizontal":"horizontal"===this.orientation,"p-slider-vertical":"vertical"===this.orientation}]},horizontal(){return"horizontal"===this.orientation},vertical(){return"vertical"===this.orientation},rangeStyle(){if(this.range){const e=this.rangeEndPosition>this.rangeStartPosition?this.rangeEndPosition-this.rangeStartPosition:this.rangeStartPosition-this.rangeEndPosition,t=this.rangeEndPosition>this.rangeStartPosition?this.rangeStartPosition:this.rangeEndPosition;return this.horizontal?{left:t+"%",width:e+"%"}:{bottom:t+"%",height:e+"%"}}return this.horizontal?{width:this.handlePosition+"%"}:{height:this.handlePosition+"%"}},handleStyle(){return this.horizontal?{left:this.handlePosition+"%"}:{bottom:this.handlePosition+"%"}},handlePosition(){return this.modelValue<this.min?0:this.modelValue>this.max?100:100*(this.modelValue-this.min)/(this.max-this.min)},rangeStartPosition(){return this.modelValue&&this.modelValue[0]?100*(this.modelValue[0]<this.min?0:this.modelValue[0]-this.min)/(this.max-this.min):0},rangeEndPosition(){return this.modelValue&&2===this.modelValue.length?100*(this.modelValue[1]>this.max?100:this.modelValue[1]-this.min)/(this.max-this.min):100},rangeStartHandleStyle(){return this.horizontal?{left:this.rangeStartPosition+"%"}:{bottom:this.rangeStartPosition+"%"}},rangeEndHandleStyle(){return this.horizontal?{left:this.rangeEndPosition+"%"}:{bottom:this.rangeEndPosition+"%"}}}};const o=["tabindex","aria-valuemin","aria-valuenow","aria-valuemax","aria-labelledby","aria-label","aria-orientation"],d=["tabindex","aria-valuemin","aria-valuenow","aria-valuemax","aria-labelledby","aria-label","aria-orientation"],h=["tabindex","aria-valuemin","aria-valuenow","aria-valuemax","aria-labelledby","aria-label","aria-orientation"];!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===i&&a.firstChild?a.insertBefore(n,a.firstChild):a.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-slider {\n position: relative;\n}\n.p-slider .p-slider-handle {\n position: absolute;\n cursor: grab;\n touch-action: none;\n display: block;\n}\n.p-slider-range {\n position: absolute;\n display: block;\n}\n.p-slider-horizontal .p-slider-range {\n top: 0;\n left: 0;\n height: 100%;\n}\n.p-slider-horizontal .p-slider-handle {\n top: 50%;\n}\n.p-slider-vertical {\n height: 100px;\n}\n.p-slider-vertical .p-slider-handle {\n left: 50%;\n}\n.p-slider-vertical .p-slider-range {\n bottom: 0;\n left: 0;\n width: 100%;\n}\n"),r.render=function(e,r,u,m,g,p){return t(),i("div",{class:a(p.containerClass),onClick:r[15]||(r[15]=(...e)=>p.onBarClick&&p.onBarClick(...e))},[n("span",{class:"p-slider-range",style:l(p.rangeStyle)},null,4),u.range?s("",!0):(t(),i("span",{key:0,class:"p-slider-handle",style:l(p.handleStyle),onTouchstart:r[0]||(r[0]=e=>p.onDragStart(e)),onTouchmove:r[1]||(r[1]=e=>p.onDrag(e)),onTouchend:r[2]||(r[2]=e=>p.onDragEnd(e)),onMousedown:r[3]||(r[3]=e=>p.onMouseDown(e)),onKeydown:r[4]||(r[4]=e=>p.onKeyDown(e)),tabindex:u.tabindex,role:"slider","aria-valuemin":u.min,"aria-valuenow":u.modelValue,"aria-valuemax":u.max,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,"aria-orientation":u.orientation},null,44,o)),u.range?(t(),i("span",{key:1,class:"p-slider-handle",style:l(p.rangeStartHandleStyle),onTouchstart:r[5]||(r[5]=e=>p.onDragStart(e,0)),onTouchmove:r[6]||(r[6]=e=>p.onDrag(e)),onTouchend:r[7]||(r[7]=e=>p.onDragEnd(e)),onMousedown:r[8]||(r[8]=e=>p.onMouseDown(e,0)),onKeydown:r[9]||(r[9]=e=>p.onKeyDown(e,0)),tabindex:u.tabindex,role:"slider","aria-valuemin":u.min,"aria-valuenow":u.modelValue?u.modelValue[0]:null,"aria-valuemax":u.max,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,"aria-orientation":u.orientation},null,44,d)):s("",!0),u.range?(t(),i("span",{key:2,class:"p-slider-handle",style:l(p.rangeEndHandleStyle),onTouchstart:r[10]||(r[10]=e=>p.onDragStart(e,1)),onTouchmove:r[11]||(r[11]=e=>p.onDrag(e)),onTouchend:r[12]||(r[12]=e=>p.onDragEnd(e)),onMousedown:r[13]||(r[13]=e=>p.onMouseDown(e,1)),onKeydown:r[14]||(r[14]=e=>p.onKeyDown(e,1)),tabindex:u.tabindex,role:"slider","aria-valuemin":u.min,"aria-valuenow":u.modelValue?u.modelValue[1]:null,"aria-valuemax":u.max,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,"aria-orientation":u.orientation},null,44,h)):s("",!0)],2)};export{r as default};