primevue 3.52.0 → 3.53.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 (163) hide show
  1. package/README.md +1 -1
  2. package/api/Api.d.ts +58 -6
  3. package/api/api.cjs.js +58 -6
  4. package/api/api.cjs.min.js +1 -1
  5. package/api/api.esm.js +58 -6
  6. package/api/api.esm.min.js +1 -1
  7. package/api/api.js +58 -6
  8. package/api/api.min.js +1 -1
  9. package/autocomplete/AutoComplete.vue +1 -1
  10. package/autocomplete/autocomplete.cjs.js +2 -2
  11. package/autocomplete/autocomplete.cjs.min.js +1 -1
  12. package/autocomplete/autocomplete.esm.js +2 -2
  13. package/autocomplete/autocomplete.esm.min.js +1 -1
  14. package/autocomplete/autocomplete.js +2 -2
  15. package/autocomplete/autocomplete.min.js +1 -1
  16. package/basecomponent/BaseComponent.vue +11 -11
  17. package/basecomponent/basecomponent.cjs.js +20 -20
  18. package/basecomponent/basecomponent.cjs.min.js +1 -1
  19. package/basecomponent/basecomponent.esm.js +20 -20
  20. package/basecomponent/basecomponent.esm.min.js +1 -1
  21. package/basecomponent/basecomponent.js +20 -20
  22. package/basecomponent/basecomponent.min.js +1 -1
  23. package/basedirective/basedirective.cjs.js +5 -5
  24. package/basedirective/basedirective.cjs.min.js +1 -1
  25. package/basedirective/basedirective.esm.js +5 -5
  26. package/basedirective/basedirective.esm.min.js +1 -1
  27. package/basedirective/basedirective.js +5 -5
  28. package/basedirective/basedirective.min.js +1 -1
  29. package/calendar/BaseCalendar.vue +4 -0
  30. package/calendar/Calendar.d.ts +4 -0
  31. package/calendar/Calendar.vue +3 -2
  32. package/calendar/calendar.cjs.js +8 -8
  33. package/calendar/calendar.cjs.min.js +1 -1
  34. package/calendar/calendar.esm.js +8 -8
  35. package/calendar/calendar.esm.min.js +1 -1
  36. package/calendar/calendar.js +8 -8
  37. package/calendar/calendar.min.js +1 -1
  38. package/colorpicker/ColorPicker.vue +0 -23
  39. package/colorpicker/colorpicker.cjs.js +0 -19
  40. package/colorpicker/colorpicker.cjs.min.js +1 -1
  41. package/colorpicker/colorpicker.esm.js +0 -19
  42. package/colorpicker/colorpicker.esm.min.js +1 -1
  43. package/colorpicker/colorpicker.js +0 -19
  44. package/colorpicker/colorpicker.min.js +1 -1
  45. package/column/Column.d.ts +1 -1
  46. package/confirmpopup/ConfirmPopup.vue +6 -1
  47. package/confirmpopup/confirmpopup.cjs.js +5 -1
  48. package/confirmpopup/confirmpopup.cjs.min.js +1 -1
  49. package/confirmpopup/confirmpopup.esm.js +5 -1
  50. package/confirmpopup/confirmpopup.esm.min.js +1 -1
  51. package/confirmpopup/confirmpopup.js +5 -1
  52. package/confirmpopup/confirmpopup.min.js +1 -1
  53. package/contextmenu/ContextMenu.vue +3 -1
  54. package/contextmenu/contextmenu.cjs.js +3 -1
  55. package/contextmenu/contextmenu.cjs.min.js +1 -1
  56. package/contextmenu/contextmenu.esm.js +3 -1
  57. package/contextmenu/contextmenu.esm.min.js +1 -1
  58. package/contextmenu/contextmenu.js +3 -1
  59. package/contextmenu/contextmenu.min.js +1 -1
  60. package/core/core.js +137 -55
  61. package/core/core.min.js +11 -9
  62. package/datatable/BodyCell.vue +8 -16
  63. package/datatable/DataTable.d.ts +1 -1
  64. package/datatable/DataTable.vue +3 -1
  65. package/datatable/datatable.cjs.js +10 -15
  66. package/datatable/datatable.cjs.min.js +1 -1
  67. package/datatable/datatable.esm.js +10 -15
  68. package/datatable/datatable.esm.min.js +1 -1
  69. package/datatable/datatable.js +10 -15
  70. package/datatable/datatable.min.js +1 -1
  71. package/dialog/Dialog.vue +5 -1
  72. package/dialog/dialog.cjs.js +5 -1
  73. package/dialog/dialog.cjs.min.js +1 -1
  74. package/dialog/dialog.esm.js +5 -1
  75. package/dialog/dialog.esm.min.js +1 -1
  76. package/dialog/dialog.js +5 -1
  77. package/dialog/dialog.min.js +1 -1
  78. package/dropdown/Dropdown.d.ts +1 -1
  79. package/dropdown/Dropdown.vue +17 -15
  80. package/dropdown/dropdown.cjs.js +15 -15
  81. package/dropdown/dropdown.cjs.min.js +1 -1
  82. package/dropdown/dropdown.esm.js +15 -15
  83. package/dropdown/dropdown.esm.min.js +1 -1
  84. package/dropdown/dropdown.js +15 -15
  85. package/dropdown/dropdown.min.js +1 -1
  86. package/floatlabel/floatlabel.js +1 -1
  87. package/floatlabel/floatlabel.min.js +1 -1
  88. package/inplace/Inplace.vue +2 -2
  89. package/inplace/inplace.cjs.js +3 -3
  90. package/inplace/inplace.cjs.min.js +1 -1
  91. package/inplace/inplace.esm.js +4 -4
  92. package/inplace/inplace.esm.min.js +1 -1
  93. package/inplace/inplace.js +3 -3
  94. package/inplace/inplace.min.js +1 -1
  95. package/inputnumber/InputNumber.vue +7 -2
  96. package/inputnumber/inputnumber.cjs.js +6 -2
  97. package/inputnumber/inputnumber.cjs.min.js +1 -1
  98. package/inputnumber/inputnumber.esm.js +6 -2
  99. package/inputnumber/inputnumber.esm.min.js +1 -1
  100. package/inputnumber/inputnumber.js +6 -2
  101. package/inputnumber/inputnumber.min.js +1 -1
  102. package/inputotp/InputOtp.vue +8 -0
  103. package/inputotp/inputotp.cjs.js +6 -0
  104. package/inputotp/inputotp.cjs.min.js +1 -1
  105. package/inputotp/inputotp.esm.js +6 -0
  106. package/inputotp/inputotp.esm.min.js +1 -1
  107. package/inputotp/inputotp.js +6 -0
  108. package/inputotp/inputotp.min.js +1 -1
  109. package/listbox/Listbox.d.ts +1 -1
  110. package/listbox/Listbox.vue +16 -5
  111. package/listbox/listbox.cjs.js +14 -5
  112. package/listbox/listbox.cjs.min.js +1 -1
  113. package/listbox/listbox.esm.js +14 -5
  114. package/listbox/listbox.esm.min.js +1 -1
  115. package/listbox/listbox.js +14 -5
  116. package/listbox/listbox.min.js +1 -1
  117. package/multiselect/MultiSelect.d.ts +1 -1
  118. package/multiselect/MultiSelect.vue +16 -10
  119. package/multiselect/multiselect.cjs.js +15 -8
  120. package/multiselect/multiselect.cjs.min.js +1 -1
  121. package/multiselect/multiselect.esm.js +15 -8
  122. package/multiselect/multiselect.esm.min.js +1 -1
  123. package/multiselect/multiselect.js +15 -8
  124. package/multiselect/multiselect.min.js +1 -1
  125. package/package.json +1 -1
  126. package/password/BasePassword.vue +2 -2
  127. package/password/Password.d.ts +2 -2
  128. package/password/password.cjs.js +2 -2
  129. package/password/password.cjs.min.js +1 -1
  130. package/password/password.esm.js +2 -2
  131. package/password/password.esm.min.js +1 -1
  132. package/password/password.js +2 -2
  133. package/password/password.min.js +1 -1
  134. package/ripple/ripple.cjs.js +1 -1
  135. package/ripple/ripple.cjs.min.js +1 -1
  136. package/ripple/ripple.esm.js +1 -1
  137. package/ripple/ripple.esm.min.js +1 -1
  138. package/ripple/ripple.js +1 -1
  139. package/ripple/ripple.min.js +1 -1
  140. package/splitbutton/SplitButton.vue +1 -0
  141. package/splitbutton/splitbutton.cjs.js +2 -1
  142. package/splitbutton/splitbutton.cjs.min.js +1 -1
  143. package/splitbutton/splitbutton.esm.js +2 -1
  144. package/splitbutton/splitbutton.esm.min.js +1 -1
  145. package/splitbutton/splitbutton.js +2 -1
  146. package/splitbutton/splitbutton.min.js +1 -1
  147. package/tieredmenu/TieredMenu.vue +3 -2
  148. package/tieredmenu/tieredmenu.cjs.js +4 -3
  149. package/tieredmenu/tieredmenu.cjs.min.js +1 -1
  150. package/tieredmenu/tieredmenu.esm.js +4 -3
  151. package/tieredmenu/tieredmenu.esm.min.js +1 -1
  152. package/tieredmenu/tieredmenu.js +4 -3
  153. package/tieredmenu/tieredmenu.min.js +1 -1
  154. package/treenode/TreeNode.d.ts +1 -1
  155. package/treeselect/TreeSelect.d.ts +1 -1
  156. package/virtualscroller/BaseVirtualScroller.vue +1 -1
  157. package/virtualscroller/virtualscroller.cjs.js +2 -2
  158. package/virtualscroller/virtualscroller.cjs.min.js +1 -1
  159. package/virtualscroller/virtualscroller.esm.js +2 -2
  160. package/virtualscroller/virtualscroller.esm.min.js +1 -1
  161. package/virtualscroller/virtualscroller.js +2 -2
  162. package/virtualscroller/virtualscroller.min.js +1 -1
  163. package/web-types.json +1 -1
@@ -1 +1 @@
1
- import e from"primevue/overlayeventbus";import t from"primevue/portal";import{ZIndexUtils as n,DomHandler as i,ConnectedOverlayScrollHandler as o}from"primevue/utils";import r from"primevue/basecomponent";import s from"primevue/colorpicker/style";import{resolveComponent as l,openBlock as a,createElementBlock as u,mergeProps as c,createCommentVNode as h,createVNode as d,withCtx as p,Transition as f,createElementVNode as b}from"vue";var m={name:"ColorPicker",extends:{name:"BaseColorPicker",extends:r,props:{modelValue:{type:null,default:null},defaultColor:{type:null,default:"ff0000"},inline:{type:Boolean,default:!1},format:{type:String,default:"hex"},disabled:{type:Boolean,default:!1},tabindex:{type:String,default:null},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},appendTo:{type:[String,Object],default:"body"},panelClass:null},style:s,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,emits:["update:modelValue","change","show","hide"],data:function(){return{overlayVisible:!1}},hsbValue:null,outsideClickListener:null,documentMouseMoveListener:null,documentMouseUpListener:null,scrollHandler:null,resizeListener:null,hueDragging:null,colorDragging:null,selfUpdate:null,picker:null,colorSelector:null,colorHandle:null,hueView:null,hueHandle:null,watch:{modelValue:{immediate:!0,handler:function(e){this.hsbValue=this.toHSB(e),this.selfUpdate?this.selfUpdate=!1:this.updateUI()}}},beforeUnmount:function(){this.unbindOutsideClickListener(),this.unbindDragListeners(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.picker&&this.autoZIndex&&n.clear(this.picker),this.clearRefs()},mounted:function(){this.updateUI()},methods:{pickColor:function(e){var t=this.colorSelector.getBoundingClientRect(),n=t.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),i=t.left+document.body.scrollLeft,o=Math.floor(100*Math.max(0,Math.min(150,(e.pageX||e.changedTouches[0].pageX)-i))/150),r=Math.floor(100*(150-Math.max(0,Math.min(150,(e.pageY||e.changedTouches[0].pageY)-n)))/150);this.hsbValue=this.validateHSB({h:this.hsbValue.h,s:o,b:r}),this.selfUpdate=!0,this.updateColorHandle(),this.updateInput(),this.updateModel(e)},pickHue:function(e){var t=this.hueView.getBoundingClientRect().top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0);this.hsbValue=this.validateHSB({h:Math.floor(360*(150-Math.max(0,Math.min(150,(e.pageY||e.changedTouches[0].pageY)-t)))/150),s:100,b:100}),this.selfUpdate=!0,this.updateColorSelector(),this.updateHue(),this.updateModel(e),this.updateInput()},updateModel:function(e){var t=this.modelValue;switch(this.format){case"hex":t=this.HSBtoHEX(this.hsbValue);break;case"rgb":t=this.HSBtoRGB(this.hsbValue);break;case"hsb":t=this.hsbValue}this.$emit("update:modelValue",t),this.$emit("change",{event:e,value:t})},updateColorSelector:function(){if(this.colorSelector){var e=this.validateHSB({h:this.hsbValue.h,s:100,b:100});this.colorSelector.style.backgroundColor="#"+this.HSBtoHEX(e)}},updateColorHandle:function(){this.colorHandle&&(this.colorHandle.style.left=Math.floor(150*this.hsbValue.s/100)+"px",this.colorHandle.style.top=Math.floor(150*(100-this.hsbValue.b)/100)+"px")},updateHue:function(){this.hueHandle&&(this.hueHandle.style.top=Math.floor(150-150*this.hsbValue.h/360)+"px")},updateInput:function(){this.$refs.input&&(this.$refs.input.style.backgroundColor="#"+this.HSBtoHEX(this.hsbValue))},updateUI:function(){this.updateHue(),this.updateColorHandle(),this.updateInput(),this.updateColorSelector()},validateHSB:function(e){return{h:Math.min(360,Math.max(0,e.h)),s:Math.min(100,Math.max(0,e.s)),b:Math.min(100,Math.max(0,e.b))}},validateRGB:function(e){return{r:Math.min(255,Math.max(0,e.r)),g:Math.min(255,Math.max(0,e.g)),b:Math.min(255,Math.max(0,e.b))}},validateHEX:function(e){var t=6-e.length;if(t>0){for(var n=[],i=0;i<t;i++)n.push("0");n.push(e),e=n.join("")}return e},HEXtoRGB:function(e){var t=parseInt(e.indexOf("#")>-1?e.substring(1):e,16);return{r:t>>16,g:(65280&t)>>8,b:255&t}},HEXtoHSB:function(e){return this.RGBtoHSB(this.HEXtoRGB(e))},RGBtoHSB:function(e){var t={h:0,s:0,b:0},n=Math.min(e.r,e.g,e.b),i=Math.max(e.r,e.g,e.b),o=i-n;return t.b=i,t.s=0!==i?255*o/i:0,t.h=0!==t.s?e.r===i?(e.g-e.b)/o:e.g===i?2+(e.b-e.r)/o:4+(e.r-e.g)/o:-1,t.h*=60,t.h<0&&(t.h+=360),t.s*=100/255,t.b*=100/255,t},HSBtoRGB:function(e){var t={r:null,g:null,b:null},n=Math.round(e.h),i=Math.round(255*e.s/100),o=Math.round(255*e.b/100);if(0===i)t={r:o,g:o,b:o};else{var r=o,s=(255-i)*o/255,l=n%60*(r-s)/60;360===n&&(n=0),n<60?(t.r=r,t.b=s,t.g=s+l):n<120?(t.g=r,t.b=s,t.r=r-l):n<180?(t.g=r,t.r=s,t.b=s+l):n<240?(t.b=r,t.r=s,t.g=r-l):n<300?(t.b=r,t.g=s,t.r=s+l):n<360?(t.r=r,t.g=s,t.b=r-l):(t.r=0,t.g=0,t.b=0)}return{r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)}},RGBtoHEX:function(e){var t=[e.r.toString(16),e.g.toString(16),e.b.toString(16)];for(var n in t)1===t[n].length&&(t[n]="0"+t[n]);return t.join("")},HSBtoHEX:function(e){return this.RGBtoHEX(this.HSBtoRGB(e))},toHSB:function(e){var t;if(e)switch(this.format){case"hex":t=this.HEXtoHSB(e);break;case"rgb":t=this.RGBtoHSB(e);break;case"hsb":t=e}else t=this.HEXtoHSB(this.defaultColor);return t},onOverlayEnter:function(e){this.updateUI(),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.autoZIndex&&n.set("overlay",e,this.baseZIndex,this.$primevue.config.zIndex.overlay),this.$emit("show")},onOverlayLeave:function(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.clearRefs(),this.$emit("hide")},onOverlayAfterLeave:function(e){this.autoZIndex&&n.clear(e)},alignOverlay:function(){"self"===this.appendTo?i.relativePosition(this.picker,this.$refs.input):i.absolutePosition(this.picker,this.$refs.input)},onInputClick:function(){this.disabled||(this.overlayVisible=!this.overlayVisible)},onInputKeydown:function(e){switch(e.code){case"Space":this.overlayVisible=!this.overlayVisible,e.preventDefault();break;case"Escape":case"Tab":this.overlayVisible=!1}},onColorMousedown:function(e){this.disabled||(this.bindDragListeners(),this.onColorDragStart(e))},onColorDragStart:function(e){this.disabled||(this.colorDragging=!0,this.pickColor(e),this.$el.setAttribute("p-colorpicker-dragging","true"),!this.isUnstyled&&i.addClass(this.$el,"p-colorpicker-dragging"),e.preventDefault())},onDrag:function(e){this.colorDragging&&(this.pickColor(e),e.preventDefault()),this.hueDragging&&(this.pickHue(e),e.preventDefault())},onDragEnd:function(){this.colorDragging=!1,this.hueDragging=!1,this.$el.setAttribute("p-colorpicker-dragging","false"),!this.isUnstyled&&i.removeClass(this.$el,"p-colorpicker-dragging"),this.unbindDragListeners()},onHueMousedown:function(e){this.disabled||(this.bindDragListeners(),this.onHueDragStart(e))},onHueDragStart:function(e){this.disabled||(this.hueDragging=!0,this.pickHue(e),!this.isUnstyled&&i.addClass(this.$el,"p-colorpicker-dragging"))},isInputClicked:function(e){return this.$refs.input&&this.$refs.input.isSameNode(e.target)},bindDragListeners:function(){this.bindDocumentMouseMoveListener(),this.bindDocumentMouseUpListener()},unbindDragListeners:function(){this.unbindDocumentMouseMoveListener(),this.unbindDocumentMouseUpListener()},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){e.overlayVisible&&e.picker&&!e.picker.contains(t.target)&&!e.isInputClicked(t)&&(e.overlayVisible=!1)},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener:function(){var e=this;this.scrollHandler||(this.scrollHandler=new o(this.$refs.container,(function(){e.overlayVisible&&(e.overlayVisible=!1)}))),this.scrollHandler.bindScrollListener()},unbindScrollListener:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.overlayVisible&&!i.isTouchDevice()&&(e.overlayVisible=!1)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},bindDocumentMouseMoveListener:function(){this.documentMouseMoveListener||(this.documentMouseMoveListener=this.onDrag.bind(this),document.addEventListener("mousemove",this.documentMouseMoveListener))},unbindDocumentMouseMoveListener:function(){this.documentMouseMoveListener&&(document.removeEventListener("mousemove",this.documentMouseMoveListener),this.documentMouseMoveListener=null)},bindDocumentMouseUpListener:function(){this.documentMouseUpListener||(this.documentMouseUpListener=this.onDragEnd.bind(this),document.addEventListener("mouseup",this.documentMouseUpListener))},unbindDocumentMouseUpListener:function(){this.documentMouseUpListener&&(document.removeEventListener("mouseup",this.documentMouseUpListener),this.documentMouseUpListener=null)},pickerRef:function(e){this.picker=e},colorSelectorRef:function(e){this.colorSelector=e},colorHandleRef:function(e){this.colorHandle=e},hueViewRef:function(e){this.hueView=e},hueHandleRef:function(e){this.hueHandle=e},clearRefs:function(){this.picker=null,this.colorSelector=null,this.colorHandle=null,this.hueView=null,this.hueHandle=null},onOverlayClick:function(t){e.emit("overlay-click",{originalEvent:t,target:this.$el})}},components:{Portal:t}},g=["tabindex","disabled"];!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-colorpicker {\n display: inline-block;\n}\n.p-colorpicker-dragging {\n cursor: pointer;\n}\n.p-colorpicker-overlay {\n position: relative;\n}\n.p-colorpicker-panel {\n position: relative;\n width: 193px;\n height: 166px;\n}\n.p-colorpicker-overlay-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-colorpicker-preview {\n cursor: pointer;\n}\n.p-colorpicker-panel .p-colorpicker-content {\n position: relative;\n}\n.p-colorpicker-panel .p-colorpicker-color-selector {\n width: 150px;\n height: 150px;\n top: 8px;\n left: 8px;\n position: absolute;\n}\n.p-colorpicker-panel .p-colorpicker-color {\n width: 150px;\n height: 150px;\n}\n.p-colorpicker-panel .p-colorpicker-color-handle {\n position: absolute;\n top: 0px;\n left: 150px;\n border-radius: 100%;\n width: 10px;\n height: 10px;\n border-width: 1px;\n border-style: solid;\n margin: -5px 0 0 -5px;\n cursor: pointer;\n opacity: 0.85;\n}\n.p-colorpicker-panel .p-colorpicker-hue {\n width: 17px;\n height: 150px;\n top: 8px;\n left: 167px;\n position: absolute;\n opacity: 0.85;\n}\n.p-colorpicker-panel .p-colorpicker-hue-handle {\n position: absolute;\n top: 150px;\n left: 0px;\n width: 21px;\n margin-left: -2px;\n margin-top: -5px;\n height: 10px;\n border-width: 2px;\n border-style: solid;\n opacity: 0.85;\n cursor: pointer;\n}\n"),m.render=function(e,t,n,i,o,r){var s=l("Portal");return a(),u("div",c({ref:"container",class:e.cx("root")},e.ptmi("root")),[e.inline?h("",!0):(a(),u("input",c({key:0,ref:"input",type:"text",class:e.cx("input"),readonly:"readonly",tabindex:e.tabindex,disabled:e.disabled,onClick:t[0]||(t[0]=function(){return r.onInputClick&&r.onInputClick.apply(r,arguments)}),onKeydown:t[1]||(t[1]=function(){return r.onInputKeydown&&r.onInputKeydown.apply(r,arguments)})},e.ptm("input")),null,16,g)),d(s,{appendTo:e.appendTo,disabled:e.inline},{default:p((function(){return[d(f,c({name:"p-connected-overlay",onEnter:r.onOverlayEnter,onLeave:r.onOverlayLeave,onAfterLeave:r.onOverlayAfterLeave},e.ptm("transition")),{default:p((function(){return[e.inline||o.overlayVisible?(a(),u("div",c({key:0,ref:r.pickerRef,class:[e.cx("panel"),e.panelClass],onClick:t[10]||(t[10]=function(){return r.onOverlayClick&&r.onOverlayClick.apply(r,arguments)})},e.ptm("panel")),[b("div",c({class:e.cx("content")},e.ptm("content")),[b("div",c({ref:r.colorSelectorRef,class:e.cx("selector"),onMousedown:t[2]||(t[2]=function(e){return r.onColorMousedown(e)}),onTouchstart:t[3]||(t[3]=function(e){return r.onColorDragStart(e)}),onTouchmove:t[4]||(t[4]=function(e){return r.onDrag(e)}),onTouchend:t[5]||(t[5]=function(e){return r.onDragEnd()})},e.ptm("selector")),[b("div",c({class:e.cx("color")},e.ptm("color")),[b("div",c({ref:r.colorHandleRef,class:e.cx("colorHandle")},e.ptm("colorHandle")),null,16)],16)],16),b("div",c({ref:r.hueViewRef,class:e.cx("hue"),onMousedown:t[6]||(t[6]=function(e){return r.onHueMousedown(e)}),onTouchstart:t[7]||(t[7]=function(e){return r.onHueDragStart(e)}),onTouchmove:t[8]||(t[8]=function(e){return r.onDrag(e)}),onTouchend:t[9]||(t[9]=function(e){return r.onDragEnd()})},e.ptm("hue")),[b("div",c({ref:r.hueHandleRef,class:e.cx("hueHandle")},e.ptm("hueHandle")),null,16)],16)],16)],16)):h("",!0)]})),_:1},16,["onEnter","onLeave","onAfterLeave"])]})),_:1},8,["appendTo","disabled"])],16)};export{m as default};
1
+ import e from"primevue/overlayeventbus";import t from"primevue/portal";import{ZIndexUtils as n,DomHandler as i,ConnectedOverlayScrollHandler as o}from"primevue/utils";import r from"primevue/basecomponent";import s from"primevue/colorpicker/style";import{resolveComponent as l,openBlock as u,createElementBlock as a,mergeProps as c,createCommentVNode as h,createVNode as d,withCtx as p,Transition as f,createElementVNode as b}from"vue";var m={name:"ColorPicker",extends:{name:"BaseColorPicker",extends:r,props:{modelValue:{type:null,default:null},defaultColor:{type:null,default:"ff0000"},inline:{type:Boolean,default:!1},format:{type:String,default:"hex"},disabled:{type:Boolean,default:!1},tabindex:{type:String,default:null},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},appendTo:{type:[String,Object],default:"body"},panelClass:null},style:s,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,emits:["update:modelValue","change","show","hide"],data:function(){return{overlayVisible:!1}},hsbValue:null,outsideClickListener:null,documentMouseMoveListener:null,documentMouseUpListener:null,scrollHandler:null,resizeListener:null,hueDragging:null,colorDragging:null,selfUpdate:null,picker:null,colorSelector:null,colorHandle:null,hueView:null,hueHandle:null,watch:{modelValue:{immediate:!0,handler:function(e){this.hsbValue=this.toHSB(e),this.selfUpdate?this.selfUpdate=!1:this.updateUI()}}},beforeUnmount:function(){this.unbindOutsideClickListener(),this.unbindDragListeners(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.picker&&this.autoZIndex&&n.clear(this.picker),this.clearRefs()},mounted:function(){this.updateUI()},methods:{pickColor:function(e){var t=this.colorSelector.getBoundingClientRect(),n=t.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),i=t.left+document.body.scrollLeft,o=Math.floor(100*Math.max(0,Math.min(150,(e.pageX||e.changedTouches[0].pageX)-i))/150),r=Math.floor(100*(150-Math.max(0,Math.min(150,(e.pageY||e.changedTouches[0].pageY)-n)))/150);this.hsbValue=this.validateHSB({h:this.hsbValue.h,s:o,b:r}),this.selfUpdate=!0,this.updateColorHandle(),this.updateInput(),this.updateModel(e)},pickHue:function(e){var t=this.hueView.getBoundingClientRect().top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0);this.hsbValue=this.validateHSB({h:Math.floor(360*(150-Math.max(0,Math.min(150,(e.pageY||e.changedTouches[0].pageY)-t)))/150),s:100,b:100}),this.selfUpdate=!0,this.updateColorSelector(),this.updateHue(),this.updateModel(e),this.updateInput()},updateModel:function(e){var t=this.modelValue;switch(this.format){case"hex":t=this.HSBtoHEX(this.hsbValue);break;case"rgb":t=this.HSBtoRGB(this.hsbValue);break;case"hsb":t=this.hsbValue}this.$emit("update:modelValue",t),this.$emit("change",{event:e,value:t})},updateColorSelector:function(){if(this.colorSelector){var e=this.validateHSB({h:this.hsbValue.h,s:100,b:100});this.colorSelector.style.backgroundColor="#"+this.HSBtoHEX(e)}},updateColorHandle:function(){this.colorHandle&&(this.colorHandle.style.left=Math.floor(150*this.hsbValue.s/100)+"px",this.colorHandle.style.top=Math.floor(150*(100-this.hsbValue.b)/100)+"px")},updateHue:function(){this.hueHandle&&(this.hueHandle.style.top=Math.floor(150-150*this.hsbValue.h/360)+"px")},updateInput:function(){this.$refs.input&&(this.$refs.input.style.backgroundColor="#"+this.HSBtoHEX(this.hsbValue))},updateUI:function(){this.updateHue(),this.updateColorHandle(),this.updateInput(),this.updateColorSelector()},validateHSB:function(e){return{h:Math.min(360,Math.max(0,e.h)),s:Math.min(100,Math.max(0,e.s)),b:Math.min(100,Math.max(0,e.b))}},HEXtoRGB:function(e){var t=parseInt(e.indexOf("#")>-1?e.substring(1):e,16);return{r:t>>16,g:(65280&t)>>8,b:255&t}},HEXtoHSB:function(e){return this.RGBtoHSB(this.HEXtoRGB(e))},RGBtoHSB:function(e){var t={h:0,s:0,b:0},n=Math.min(e.r,e.g,e.b),i=Math.max(e.r,e.g,e.b),o=i-n;return t.b=i,t.s=0!==i?255*o/i:0,t.h=0!==t.s?e.r===i?(e.g-e.b)/o:e.g===i?2+(e.b-e.r)/o:4+(e.r-e.g)/o:-1,t.h*=60,t.h<0&&(t.h+=360),t.s*=100/255,t.b*=100/255,t},HSBtoRGB:function(e){var t={r:null,g:null,b:null},n=Math.round(e.h),i=Math.round(255*e.s/100),o=Math.round(255*e.b/100);if(0===i)t={r:o,g:o,b:o};else{var r=o,s=(255-i)*o/255,l=n%60*(r-s)/60;360===n&&(n=0),n<60?(t.r=r,t.b=s,t.g=s+l):n<120?(t.g=r,t.b=s,t.r=r-l):n<180?(t.g=r,t.r=s,t.b=s+l):n<240?(t.b=r,t.r=s,t.g=r-l):n<300?(t.b=r,t.g=s,t.r=s+l):n<360?(t.r=r,t.g=s,t.b=r-l):(t.r=0,t.g=0,t.b=0)}return{r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)}},RGBtoHEX:function(e){var t=[e.r.toString(16),e.g.toString(16),e.b.toString(16)];for(var n in t)1===t[n].length&&(t[n]="0"+t[n]);return t.join("")},HSBtoHEX:function(e){return this.RGBtoHEX(this.HSBtoRGB(e))},toHSB:function(e){var t;if(e)switch(this.format){case"hex":t=this.HEXtoHSB(e);break;case"rgb":t=this.RGBtoHSB(e);break;case"hsb":t=e}else t=this.HEXtoHSB(this.defaultColor);return t},onOverlayEnter:function(e){this.updateUI(),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.autoZIndex&&n.set("overlay",e,this.baseZIndex,this.$primevue.config.zIndex.overlay),this.$emit("show")},onOverlayLeave:function(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.clearRefs(),this.$emit("hide")},onOverlayAfterLeave:function(e){this.autoZIndex&&n.clear(e)},alignOverlay:function(){"self"===this.appendTo?i.relativePosition(this.picker,this.$refs.input):i.absolutePosition(this.picker,this.$refs.input)},onInputClick:function(){this.disabled||(this.overlayVisible=!this.overlayVisible)},onInputKeydown:function(e){switch(e.code){case"Space":this.overlayVisible=!this.overlayVisible,e.preventDefault();break;case"Escape":case"Tab":this.overlayVisible=!1}},onColorMousedown:function(e){this.disabled||(this.bindDragListeners(),this.onColorDragStart(e))},onColorDragStart:function(e){this.disabled||(this.colorDragging=!0,this.pickColor(e),this.$el.setAttribute("p-colorpicker-dragging","true"),!this.isUnstyled&&i.addClass(this.$el,"p-colorpicker-dragging"),e.preventDefault())},onDrag:function(e){this.colorDragging&&(this.pickColor(e),e.preventDefault()),this.hueDragging&&(this.pickHue(e),e.preventDefault())},onDragEnd:function(){this.colorDragging=!1,this.hueDragging=!1,this.$el.setAttribute("p-colorpicker-dragging","false"),!this.isUnstyled&&i.removeClass(this.$el,"p-colorpicker-dragging"),this.unbindDragListeners()},onHueMousedown:function(e){this.disabled||(this.bindDragListeners(),this.onHueDragStart(e))},onHueDragStart:function(e){this.disabled||(this.hueDragging=!0,this.pickHue(e),!this.isUnstyled&&i.addClass(this.$el,"p-colorpicker-dragging"))},isInputClicked:function(e){return this.$refs.input&&this.$refs.input.isSameNode(e.target)},bindDragListeners:function(){this.bindDocumentMouseMoveListener(),this.bindDocumentMouseUpListener()},unbindDragListeners:function(){this.unbindDocumentMouseMoveListener(),this.unbindDocumentMouseUpListener()},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){e.overlayVisible&&e.picker&&!e.picker.contains(t.target)&&!e.isInputClicked(t)&&(e.overlayVisible=!1)},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener:function(){var e=this;this.scrollHandler||(this.scrollHandler=new o(this.$refs.container,(function(){e.overlayVisible&&(e.overlayVisible=!1)}))),this.scrollHandler.bindScrollListener()},unbindScrollListener:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.overlayVisible&&!i.isTouchDevice()&&(e.overlayVisible=!1)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},bindDocumentMouseMoveListener:function(){this.documentMouseMoveListener||(this.documentMouseMoveListener=this.onDrag.bind(this),document.addEventListener("mousemove",this.documentMouseMoveListener))},unbindDocumentMouseMoveListener:function(){this.documentMouseMoveListener&&(document.removeEventListener("mousemove",this.documentMouseMoveListener),this.documentMouseMoveListener=null)},bindDocumentMouseUpListener:function(){this.documentMouseUpListener||(this.documentMouseUpListener=this.onDragEnd.bind(this),document.addEventListener("mouseup",this.documentMouseUpListener))},unbindDocumentMouseUpListener:function(){this.documentMouseUpListener&&(document.removeEventListener("mouseup",this.documentMouseUpListener),this.documentMouseUpListener=null)},pickerRef:function(e){this.picker=e},colorSelectorRef:function(e){this.colorSelector=e},colorHandleRef:function(e){this.colorHandle=e},hueViewRef:function(e){this.hueView=e},hueHandleRef:function(e){this.hueHandle=e},clearRefs:function(){this.picker=null,this.colorSelector=null,this.colorHandle=null,this.hueView=null,this.hueHandle=null},onOverlayClick:function(t){e.emit("overlay-click",{originalEvent:t,target:this.$el})}},components:{Portal:t}},g=["tabindex","disabled"];!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-colorpicker {\n display: inline-block;\n}\n.p-colorpicker-dragging {\n cursor: pointer;\n}\n.p-colorpicker-overlay {\n position: relative;\n}\n.p-colorpicker-panel {\n position: relative;\n width: 193px;\n height: 166px;\n}\n.p-colorpicker-overlay-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-colorpicker-preview {\n cursor: pointer;\n}\n.p-colorpicker-panel .p-colorpicker-content {\n position: relative;\n}\n.p-colorpicker-panel .p-colorpicker-color-selector {\n width: 150px;\n height: 150px;\n top: 8px;\n left: 8px;\n position: absolute;\n}\n.p-colorpicker-panel .p-colorpicker-color {\n width: 150px;\n height: 150px;\n}\n.p-colorpicker-panel .p-colorpicker-color-handle {\n position: absolute;\n top: 0px;\n left: 150px;\n border-radius: 100%;\n width: 10px;\n height: 10px;\n border-width: 1px;\n border-style: solid;\n margin: -5px 0 0 -5px;\n cursor: pointer;\n opacity: 0.85;\n}\n.p-colorpicker-panel .p-colorpicker-hue {\n width: 17px;\n height: 150px;\n top: 8px;\n left: 167px;\n position: absolute;\n opacity: 0.85;\n}\n.p-colorpicker-panel .p-colorpicker-hue-handle {\n position: absolute;\n top: 150px;\n left: 0px;\n width: 21px;\n margin-left: -2px;\n margin-top: -5px;\n height: 10px;\n border-width: 2px;\n border-style: solid;\n opacity: 0.85;\n cursor: pointer;\n}\n"),m.render=function(e,t,n,i,o,r){var s=l("Portal");return u(),a("div",c({ref:"container",class:e.cx("root")},e.ptmi("root")),[e.inline?h("",!0):(u(),a("input",c({key:0,ref:"input",type:"text",class:e.cx("input"),readonly:"readonly",tabindex:e.tabindex,disabled:e.disabled,onClick:t[0]||(t[0]=function(){return r.onInputClick&&r.onInputClick.apply(r,arguments)}),onKeydown:t[1]||(t[1]=function(){return r.onInputKeydown&&r.onInputKeydown.apply(r,arguments)})},e.ptm("input")),null,16,g)),d(s,{appendTo:e.appendTo,disabled:e.inline},{default:p((function(){return[d(f,c({name:"p-connected-overlay",onEnter:r.onOverlayEnter,onLeave:r.onOverlayLeave,onAfterLeave:r.onOverlayAfterLeave},e.ptm("transition")),{default:p((function(){return[e.inline||o.overlayVisible?(u(),a("div",c({key:0,ref:r.pickerRef,class:[e.cx("panel"),e.panelClass],onClick:t[10]||(t[10]=function(){return r.onOverlayClick&&r.onOverlayClick.apply(r,arguments)})},e.ptm("panel")),[b("div",c({class:e.cx("content")},e.ptm("content")),[b("div",c({ref:r.colorSelectorRef,class:e.cx("selector"),onMousedown:t[2]||(t[2]=function(e){return r.onColorMousedown(e)}),onTouchstart:t[3]||(t[3]=function(e){return r.onColorDragStart(e)}),onTouchmove:t[4]||(t[4]=function(e){return r.onDrag(e)}),onTouchend:t[5]||(t[5]=function(e){return r.onDragEnd()})},e.ptm("selector")),[b("div",c({class:e.cx("color")},e.ptm("color")),[b("div",c({ref:r.colorHandleRef,class:e.cx("colorHandle")},e.ptm("colorHandle")),null,16)],16)],16),b("div",c({ref:r.hueViewRef,class:e.cx("hue"),onMousedown:t[6]||(t[6]=function(e){return r.onHueMousedown(e)}),onTouchstart:t[7]||(t[7]=function(e){return r.onHueDragStart(e)}),onTouchmove:t[8]||(t[8]=function(e){return r.onDrag(e)}),onTouchend:t[9]||(t[9]=function(e){return r.onDragEnd()})},e.ptm("hue")),[b("div",c({ref:r.hueHandleRef,class:e.cx("hueHandle")},e.ptm("hueHandle")),null,16)],16)],16)],16)):h("",!0)]})),_:1},16,["onEnter","onLeave","onAfterLeave"])]})),_:1},8,["appendTo","disabled"])],16)};export{m as default};
@@ -196,25 +196,6 @@ this.primevue.colorpicker = (function (OverlayEventBus, Portal, utils, BaseCompo
196
196
  b: Math.min(100, Math.max(0, hsb.b))
197
197
  };
198
198
  },
199
- validateRGB: function validateRGB(rgb) {
200
- return {
201
- r: Math.min(255, Math.max(0, rgb.r)),
202
- g: Math.min(255, Math.max(0, rgb.g)),
203
- b: Math.min(255, Math.max(0, rgb.b))
204
- };
205
- },
206
- validateHEX: function validateHEX(hex) {
207
- var len = 6 - hex.length;
208
- if (len > 0) {
209
- var o = [];
210
- for (var i = 0; i < len; i++) {
211
- o.push('0');
212
- }
213
- o.push(hex);
214
- hex = o.join('');
215
- }
216
- return hex;
217
- },
218
199
  HEXtoRGB: function HEXtoRGB(hex) {
219
200
  var hexValue = parseInt(hex.indexOf('#') > -1 ? hex.substring(1) : hex, 16);
220
201
  return {
@@ -1 +1 @@
1
- this.primevue=this.primevue||{},this.primevue.colorpicker=function(e,t,n,i,o,r){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=s(e),a=s(t),u={name:"ColorPicker",extends:{name:"BaseColorPicker",extends:s(i).default,props:{modelValue:{type:null,default:null},defaultColor:{type:null,default:"ff0000"},inline:{type:Boolean,default:!1},format:{type:String,default:"hex"},disabled:{type:Boolean,default:!1},tabindex:{type:String,default:null},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},appendTo:{type:[String,Object],default:"body"},panelClass:null},style:s(o).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,emits:["update:modelValue","change","show","hide"],data:function(){return{overlayVisible:!1}},hsbValue:null,outsideClickListener:null,documentMouseMoveListener:null,documentMouseUpListener:null,scrollHandler:null,resizeListener:null,hueDragging:null,colorDragging:null,selfUpdate:null,picker:null,colorSelector:null,colorHandle:null,hueView:null,hueHandle:null,watch:{modelValue:{immediate:!0,handler:function(e){this.hsbValue=this.toHSB(e),this.selfUpdate?this.selfUpdate=!1:this.updateUI()}}},beforeUnmount:function(){this.unbindOutsideClickListener(),this.unbindDragListeners(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.picker&&this.autoZIndex&&n.ZIndexUtils.clear(this.picker),this.clearRefs()},mounted:function(){this.updateUI()},methods:{pickColor:function(e){var t=this.colorSelector.getBoundingClientRect(),n=t.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),i=t.left+document.body.scrollLeft,o=Math.floor(100*Math.max(0,Math.min(150,(e.pageX||e.changedTouches[0].pageX)-i))/150),r=Math.floor(100*(150-Math.max(0,Math.min(150,(e.pageY||e.changedTouches[0].pageY)-n)))/150);this.hsbValue=this.validateHSB({h:this.hsbValue.h,s:o,b:r}),this.selfUpdate=!0,this.updateColorHandle(),this.updateInput(),this.updateModel(e)},pickHue:function(e){var t=this.hueView.getBoundingClientRect().top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0);this.hsbValue=this.validateHSB({h:Math.floor(360*(150-Math.max(0,Math.min(150,(e.pageY||e.changedTouches[0].pageY)-t)))/150),s:100,b:100}),this.selfUpdate=!0,this.updateColorSelector(),this.updateHue(),this.updateModel(e),this.updateInput()},updateModel:function(e){var t=this.modelValue;switch(this.format){case"hex":t=this.HSBtoHEX(this.hsbValue);break;case"rgb":t=this.HSBtoRGB(this.hsbValue);break;case"hsb":t=this.hsbValue}this.$emit("update:modelValue",t),this.$emit("change",{event:e,value:t})},updateColorSelector:function(){if(this.colorSelector){var e=this.validateHSB({h:this.hsbValue.h,s:100,b:100});this.colorSelector.style.backgroundColor="#"+this.HSBtoHEX(e)}},updateColorHandle:function(){this.colorHandle&&(this.colorHandle.style.left=Math.floor(150*this.hsbValue.s/100)+"px",this.colorHandle.style.top=Math.floor(150*(100-this.hsbValue.b)/100)+"px")},updateHue:function(){this.hueHandle&&(this.hueHandle.style.top=Math.floor(150-150*this.hsbValue.h/360)+"px")},updateInput:function(){this.$refs.input&&(this.$refs.input.style.backgroundColor="#"+this.HSBtoHEX(this.hsbValue))},updateUI:function(){this.updateHue(),this.updateColorHandle(),this.updateInput(),this.updateColorSelector()},validateHSB:function(e){return{h:Math.min(360,Math.max(0,e.h)),s:Math.min(100,Math.max(0,e.s)),b:Math.min(100,Math.max(0,e.b))}},validateRGB:function(e){return{r:Math.min(255,Math.max(0,e.r)),g:Math.min(255,Math.max(0,e.g)),b:Math.min(255,Math.max(0,e.b))}},validateHEX:function(e){var t=6-e.length;if(t>0){for(var n=[],i=0;i<t;i++)n.push("0");n.push(e),e=n.join("")}return e},HEXtoRGB:function(e){var t=parseInt(e.indexOf("#")>-1?e.substring(1):e,16);return{r:t>>16,g:(65280&t)>>8,b:255&t}},HEXtoHSB:function(e){return this.RGBtoHSB(this.HEXtoRGB(e))},RGBtoHSB:function(e){var t={h:0,s:0,b:0},n=Math.min(e.r,e.g,e.b),i=Math.max(e.r,e.g,e.b),o=i-n;return t.b=i,t.s=0!==i?255*o/i:0,t.h=0!==t.s?e.r===i?(e.g-e.b)/o:e.g===i?2+(e.b-e.r)/o:4+(e.r-e.g)/o:-1,t.h*=60,t.h<0&&(t.h+=360),t.s*=100/255,t.b*=100/255,t},HSBtoRGB:function(e){var t={r:null,g:null,b:null},n=Math.round(e.h),i=Math.round(255*e.s/100),o=Math.round(255*e.b/100);if(0===i)t={r:o,g:o,b:o};else{var r=o,s=(255-i)*o/255,l=n%60*(r-s)/60;360===n&&(n=0),n<60?(t.r=r,t.b=s,t.g=s+l):n<120?(t.g=r,t.b=s,t.r=r-l):n<180?(t.g=r,t.r=s,t.b=s+l):n<240?(t.b=r,t.r=s,t.g=r-l):n<300?(t.b=r,t.g=s,t.r=s+l):n<360?(t.r=r,t.g=s,t.b=r-l):(t.r=0,t.g=0,t.b=0)}return{r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)}},RGBtoHEX:function(e){var t=[e.r.toString(16),e.g.toString(16),e.b.toString(16)];for(var n in t)1===t[n].length&&(t[n]="0"+t[n]);return t.join("")},HSBtoHEX:function(e){return this.RGBtoHEX(this.HSBtoRGB(e))},toHSB:function(e){var t;if(e)switch(this.format){case"hex":t=this.HEXtoHSB(e);break;case"rgb":t=this.RGBtoHSB(e);break;case"hsb":t=e}else t=this.HEXtoHSB(this.defaultColor);return t},onOverlayEnter:function(e){this.updateUI(),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.autoZIndex&&n.ZIndexUtils.set("overlay",e,this.baseZIndex,this.$primevue.config.zIndex.overlay),this.$emit("show")},onOverlayLeave:function(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.clearRefs(),this.$emit("hide")},onOverlayAfterLeave:function(e){this.autoZIndex&&n.ZIndexUtils.clear(e)},alignOverlay:function(){"self"===this.appendTo?n.DomHandler.relativePosition(this.picker,this.$refs.input):n.DomHandler.absolutePosition(this.picker,this.$refs.input)},onInputClick:function(){this.disabled||(this.overlayVisible=!this.overlayVisible)},onInputKeydown:function(e){switch(e.code){case"Space":this.overlayVisible=!this.overlayVisible,e.preventDefault();break;case"Escape":case"Tab":this.overlayVisible=!1}},onColorMousedown:function(e){this.disabled||(this.bindDragListeners(),this.onColorDragStart(e))},onColorDragStart:function(e){this.disabled||(this.colorDragging=!0,this.pickColor(e),this.$el.setAttribute("p-colorpicker-dragging","true"),!this.isUnstyled&&n.DomHandler.addClass(this.$el,"p-colorpicker-dragging"),e.preventDefault())},onDrag:function(e){this.colorDragging&&(this.pickColor(e),e.preventDefault()),this.hueDragging&&(this.pickHue(e),e.preventDefault())},onDragEnd:function(){this.colorDragging=!1,this.hueDragging=!1,this.$el.setAttribute("p-colorpicker-dragging","false"),!this.isUnstyled&&n.DomHandler.removeClass(this.$el,"p-colorpicker-dragging"),this.unbindDragListeners()},onHueMousedown:function(e){this.disabled||(this.bindDragListeners(),this.onHueDragStart(e))},onHueDragStart:function(e){this.disabled||(this.hueDragging=!0,this.pickHue(e),!this.isUnstyled&&n.DomHandler.addClass(this.$el,"p-colorpicker-dragging"))},isInputClicked:function(e){return this.$refs.input&&this.$refs.input.isSameNode(e.target)},bindDragListeners:function(){this.bindDocumentMouseMoveListener(),this.bindDocumentMouseUpListener()},unbindDragListeners:function(){this.unbindDocumentMouseMoveListener(),this.unbindDocumentMouseUpListener()},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){e.overlayVisible&&e.picker&&!e.picker.contains(t.target)&&!e.isInputClicked(t)&&(e.overlayVisible=!1)},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener:function(){var e=this;this.scrollHandler||(this.scrollHandler=new n.ConnectedOverlayScrollHandler(this.$refs.container,(function(){e.overlayVisible&&(e.overlayVisible=!1)}))),this.scrollHandler.bindScrollListener()},unbindScrollListener:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.overlayVisible&&!n.DomHandler.isTouchDevice()&&(e.overlayVisible=!1)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},bindDocumentMouseMoveListener:function(){this.documentMouseMoveListener||(this.documentMouseMoveListener=this.onDrag.bind(this),document.addEventListener("mousemove",this.documentMouseMoveListener))},unbindDocumentMouseMoveListener:function(){this.documentMouseMoveListener&&(document.removeEventListener("mousemove",this.documentMouseMoveListener),this.documentMouseMoveListener=null)},bindDocumentMouseUpListener:function(){this.documentMouseUpListener||(this.documentMouseUpListener=this.onDragEnd.bind(this),document.addEventListener("mouseup",this.documentMouseUpListener))},unbindDocumentMouseUpListener:function(){this.documentMouseUpListener&&(document.removeEventListener("mouseup",this.documentMouseUpListener),this.documentMouseUpListener=null)},pickerRef:function(e){this.picker=e},colorSelectorRef:function(e){this.colorSelector=e},colorHandleRef:function(e){this.colorHandle=e},hueViewRef:function(e){this.hueView=e},hueHandleRef:function(e){this.hueHandle=e},clearRefs:function(){this.picker=null,this.colorSelector=null,this.colorHandle=null,this.hueView=null,this.hueHandle=null},onOverlayClick:function(e){l.default.emit("overlay-click",{originalEvent:e,target:this.$el})}},components:{Portal:a.default}},c=["tabindex","disabled"];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],o=document.createElement("style");o.type="text/css","top"===n&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-colorpicker {\n display: inline-block;\n}\n.p-colorpicker-dragging {\n cursor: pointer;\n}\n.p-colorpicker-overlay {\n position: relative;\n}\n.p-colorpicker-panel {\n position: relative;\n width: 193px;\n height: 166px;\n}\n.p-colorpicker-overlay-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-colorpicker-preview {\n cursor: pointer;\n}\n.p-colorpicker-panel .p-colorpicker-content {\n position: relative;\n}\n.p-colorpicker-panel .p-colorpicker-color-selector {\n width: 150px;\n height: 150px;\n top: 8px;\n left: 8px;\n position: absolute;\n}\n.p-colorpicker-panel .p-colorpicker-color {\n width: 150px;\n height: 150px;\n}\n.p-colorpicker-panel .p-colorpicker-color-handle {\n position: absolute;\n top: 0px;\n left: 150px;\n border-radius: 100%;\n width: 10px;\n height: 10px;\n border-width: 1px;\n border-style: solid;\n margin: -5px 0 0 -5px;\n cursor: pointer;\n opacity: 0.85;\n}\n.p-colorpicker-panel .p-colorpicker-hue {\n width: 17px;\n height: 150px;\n top: 8px;\n left: 167px;\n position: absolute;\n opacity: 0.85;\n}\n.p-colorpicker-panel .p-colorpicker-hue-handle {\n position: absolute;\n top: 150px;\n left: 0px;\n width: 21px;\n margin-left: -2px;\n margin-top: -5px;\n height: 10px;\n border-width: 2px;\n border-style: solid;\n opacity: 0.85;\n cursor: pointer;\n}\n"),u.render=function(e,t,n,i,o,s){var l=r.resolveComponent("Portal");return r.openBlock(),r.createElementBlock("div",r.mergeProps({ref:"container",class:e.cx("root")},e.ptmi("root")),[e.inline?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("input",r.mergeProps({key:0,ref:"input",type:"text",class:e.cx("input"),readonly:"readonly",tabindex:e.tabindex,disabled:e.disabled,onClick:t[0]||(t[0]=function(){return s.onInputClick&&s.onInputClick.apply(s,arguments)}),onKeydown:t[1]||(t[1]=function(){return s.onInputKeydown&&s.onInputKeydown.apply(s,arguments)})},e.ptm("input")),null,16,c)),r.createVNode(l,{appendTo:e.appendTo,disabled:e.inline},{default:r.withCtx((function(){return[r.createVNode(r.Transition,r.mergeProps({name:"p-connected-overlay",onEnter:s.onOverlayEnter,onLeave:s.onOverlayLeave,onAfterLeave:s.onOverlayAfterLeave},e.ptm("transition")),{default:r.withCtx((function(){return[e.inline||o.overlayVisible?(r.openBlock(),r.createElementBlock("div",r.mergeProps({key:0,ref:s.pickerRef,class:[e.cx("panel"),e.panelClass],onClick:t[10]||(t[10]=function(){return s.onOverlayClick&&s.onOverlayClick.apply(s,arguments)})},e.ptm("panel")),[r.createElementVNode("div",r.mergeProps({class:e.cx("content")},e.ptm("content")),[r.createElementVNode("div",r.mergeProps({ref:s.colorSelectorRef,class:e.cx("selector"),onMousedown:t[2]||(t[2]=function(e){return s.onColorMousedown(e)}),onTouchstart:t[3]||(t[3]=function(e){return s.onColorDragStart(e)}),onTouchmove:t[4]||(t[4]=function(e){return s.onDrag(e)}),onTouchend:t[5]||(t[5]=function(e){return s.onDragEnd()})},e.ptm("selector")),[r.createElementVNode("div",r.mergeProps({class:e.cx("color")},e.ptm("color")),[r.createElementVNode("div",r.mergeProps({ref:s.colorHandleRef,class:e.cx("colorHandle")},e.ptm("colorHandle")),null,16)],16)],16),r.createElementVNode("div",r.mergeProps({ref:s.hueViewRef,class:e.cx("hue"),onMousedown:t[6]||(t[6]=function(e){return s.onHueMousedown(e)}),onTouchstart:t[7]||(t[7]=function(e){return s.onHueDragStart(e)}),onTouchmove:t[8]||(t[8]=function(e){return s.onDrag(e)}),onTouchend:t[9]||(t[9]=function(e){return s.onDragEnd()})},e.ptm("hue")),[r.createElementVNode("div",r.mergeProps({ref:s.hueHandleRef,class:e.cx("hueHandle")},e.ptm("hueHandle")),null,16)],16)],16)],16)):r.createCommentVNode("",!0)]})),_:1},16,["onEnter","onLeave","onAfterLeave"])]})),_:1},8,["appendTo","disabled"])],16)},u}(primevue.overlayeventbus,primevue.portal,primevue.utils,primevue.basecomponent,primevue.colorpicker.style,Vue);
1
+ this.primevue=this.primevue||{},this.primevue.colorpicker=function(e,t,n,i,o,r){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=s(e),a=s(t),u={name:"ColorPicker",extends:{name:"BaseColorPicker",extends:s(i).default,props:{modelValue:{type:null,default:null},defaultColor:{type:null,default:"ff0000"},inline:{type:Boolean,default:!1},format:{type:String,default:"hex"},disabled:{type:Boolean,default:!1},tabindex:{type:String,default:null},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},appendTo:{type:[String,Object],default:"body"},panelClass:null},style:s(o).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,emits:["update:modelValue","change","show","hide"],data:function(){return{overlayVisible:!1}},hsbValue:null,outsideClickListener:null,documentMouseMoveListener:null,documentMouseUpListener:null,scrollHandler:null,resizeListener:null,hueDragging:null,colorDragging:null,selfUpdate:null,picker:null,colorSelector:null,colorHandle:null,hueView:null,hueHandle:null,watch:{modelValue:{immediate:!0,handler:function(e){this.hsbValue=this.toHSB(e),this.selfUpdate?this.selfUpdate=!1:this.updateUI()}}},beforeUnmount:function(){this.unbindOutsideClickListener(),this.unbindDragListeners(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.picker&&this.autoZIndex&&n.ZIndexUtils.clear(this.picker),this.clearRefs()},mounted:function(){this.updateUI()},methods:{pickColor:function(e){var t=this.colorSelector.getBoundingClientRect(),n=t.top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0),i=t.left+document.body.scrollLeft,o=Math.floor(100*Math.max(0,Math.min(150,(e.pageX||e.changedTouches[0].pageX)-i))/150),r=Math.floor(100*(150-Math.max(0,Math.min(150,(e.pageY||e.changedTouches[0].pageY)-n)))/150);this.hsbValue=this.validateHSB({h:this.hsbValue.h,s:o,b:r}),this.selfUpdate=!0,this.updateColorHandle(),this.updateInput(),this.updateModel(e)},pickHue:function(e){var t=this.hueView.getBoundingClientRect().top+(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0);this.hsbValue=this.validateHSB({h:Math.floor(360*(150-Math.max(0,Math.min(150,(e.pageY||e.changedTouches[0].pageY)-t)))/150),s:100,b:100}),this.selfUpdate=!0,this.updateColorSelector(),this.updateHue(),this.updateModel(e),this.updateInput()},updateModel:function(e){var t=this.modelValue;switch(this.format){case"hex":t=this.HSBtoHEX(this.hsbValue);break;case"rgb":t=this.HSBtoRGB(this.hsbValue);break;case"hsb":t=this.hsbValue}this.$emit("update:modelValue",t),this.$emit("change",{event:e,value:t})},updateColorSelector:function(){if(this.colorSelector){var e=this.validateHSB({h:this.hsbValue.h,s:100,b:100});this.colorSelector.style.backgroundColor="#"+this.HSBtoHEX(e)}},updateColorHandle:function(){this.colorHandle&&(this.colorHandle.style.left=Math.floor(150*this.hsbValue.s/100)+"px",this.colorHandle.style.top=Math.floor(150*(100-this.hsbValue.b)/100)+"px")},updateHue:function(){this.hueHandle&&(this.hueHandle.style.top=Math.floor(150-150*this.hsbValue.h/360)+"px")},updateInput:function(){this.$refs.input&&(this.$refs.input.style.backgroundColor="#"+this.HSBtoHEX(this.hsbValue))},updateUI:function(){this.updateHue(),this.updateColorHandle(),this.updateInput(),this.updateColorSelector()},validateHSB:function(e){return{h:Math.min(360,Math.max(0,e.h)),s:Math.min(100,Math.max(0,e.s)),b:Math.min(100,Math.max(0,e.b))}},HEXtoRGB:function(e){var t=parseInt(e.indexOf("#")>-1?e.substring(1):e,16);return{r:t>>16,g:(65280&t)>>8,b:255&t}},HEXtoHSB:function(e){return this.RGBtoHSB(this.HEXtoRGB(e))},RGBtoHSB:function(e){var t={h:0,s:0,b:0},n=Math.min(e.r,e.g,e.b),i=Math.max(e.r,e.g,e.b),o=i-n;return t.b=i,t.s=0!==i?255*o/i:0,t.h=0!==t.s?e.r===i?(e.g-e.b)/o:e.g===i?2+(e.b-e.r)/o:4+(e.r-e.g)/o:-1,t.h*=60,t.h<0&&(t.h+=360),t.s*=100/255,t.b*=100/255,t},HSBtoRGB:function(e){var t={r:null,g:null,b:null},n=Math.round(e.h),i=Math.round(255*e.s/100),o=Math.round(255*e.b/100);if(0===i)t={r:o,g:o,b:o};else{var r=o,s=(255-i)*o/255,l=n%60*(r-s)/60;360===n&&(n=0),n<60?(t.r=r,t.b=s,t.g=s+l):n<120?(t.g=r,t.b=s,t.r=r-l):n<180?(t.g=r,t.r=s,t.b=s+l):n<240?(t.b=r,t.r=s,t.g=r-l):n<300?(t.b=r,t.g=s,t.r=s+l):n<360?(t.r=r,t.g=s,t.b=r-l):(t.r=0,t.g=0,t.b=0)}return{r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)}},RGBtoHEX:function(e){var t=[e.r.toString(16),e.g.toString(16),e.b.toString(16)];for(var n in t)1===t[n].length&&(t[n]="0"+t[n]);return t.join("")},HSBtoHEX:function(e){return this.RGBtoHEX(this.HSBtoRGB(e))},toHSB:function(e){var t;if(e)switch(this.format){case"hex":t=this.HEXtoHSB(e);break;case"rgb":t=this.RGBtoHSB(e);break;case"hsb":t=e}else t=this.HEXtoHSB(this.defaultColor);return t},onOverlayEnter:function(e){this.updateUI(),this.alignOverlay(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.autoZIndex&&n.ZIndexUtils.set("overlay",e,this.baseZIndex,this.$primevue.config.zIndex.overlay),this.$emit("show")},onOverlayLeave:function(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener(),this.clearRefs(),this.$emit("hide")},onOverlayAfterLeave:function(e){this.autoZIndex&&n.ZIndexUtils.clear(e)},alignOverlay:function(){"self"===this.appendTo?n.DomHandler.relativePosition(this.picker,this.$refs.input):n.DomHandler.absolutePosition(this.picker,this.$refs.input)},onInputClick:function(){this.disabled||(this.overlayVisible=!this.overlayVisible)},onInputKeydown:function(e){switch(e.code){case"Space":this.overlayVisible=!this.overlayVisible,e.preventDefault();break;case"Escape":case"Tab":this.overlayVisible=!1}},onColorMousedown:function(e){this.disabled||(this.bindDragListeners(),this.onColorDragStart(e))},onColorDragStart:function(e){this.disabled||(this.colorDragging=!0,this.pickColor(e),this.$el.setAttribute("p-colorpicker-dragging","true"),!this.isUnstyled&&n.DomHandler.addClass(this.$el,"p-colorpicker-dragging"),e.preventDefault())},onDrag:function(e){this.colorDragging&&(this.pickColor(e),e.preventDefault()),this.hueDragging&&(this.pickHue(e),e.preventDefault())},onDragEnd:function(){this.colorDragging=!1,this.hueDragging=!1,this.$el.setAttribute("p-colorpicker-dragging","false"),!this.isUnstyled&&n.DomHandler.removeClass(this.$el,"p-colorpicker-dragging"),this.unbindDragListeners()},onHueMousedown:function(e){this.disabled||(this.bindDragListeners(),this.onHueDragStart(e))},onHueDragStart:function(e){this.disabled||(this.hueDragging=!0,this.pickHue(e),!this.isUnstyled&&n.DomHandler.addClass(this.$el,"p-colorpicker-dragging"))},isInputClicked:function(e){return this.$refs.input&&this.$refs.input.isSameNode(e.target)},bindDragListeners:function(){this.bindDocumentMouseMoveListener(),this.bindDocumentMouseUpListener()},unbindDragListeners:function(){this.unbindDocumentMouseMoveListener(),this.unbindDocumentMouseUpListener()},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){e.overlayVisible&&e.picker&&!e.picker.contains(t.target)&&!e.isInputClicked(t)&&(e.overlayVisible=!1)},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener:function(){var e=this;this.scrollHandler||(this.scrollHandler=new n.ConnectedOverlayScrollHandler(this.$refs.container,(function(){e.overlayVisible&&(e.overlayVisible=!1)}))),this.scrollHandler.bindScrollListener()},unbindScrollListener:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.overlayVisible&&!n.DomHandler.isTouchDevice()&&(e.overlayVisible=!1)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},bindDocumentMouseMoveListener:function(){this.documentMouseMoveListener||(this.documentMouseMoveListener=this.onDrag.bind(this),document.addEventListener("mousemove",this.documentMouseMoveListener))},unbindDocumentMouseMoveListener:function(){this.documentMouseMoveListener&&(document.removeEventListener("mousemove",this.documentMouseMoveListener),this.documentMouseMoveListener=null)},bindDocumentMouseUpListener:function(){this.documentMouseUpListener||(this.documentMouseUpListener=this.onDragEnd.bind(this),document.addEventListener("mouseup",this.documentMouseUpListener))},unbindDocumentMouseUpListener:function(){this.documentMouseUpListener&&(document.removeEventListener("mouseup",this.documentMouseUpListener),this.documentMouseUpListener=null)},pickerRef:function(e){this.picker=e},colorSelectorRef:function(e){this.colorSelector=e},colorHandleRef:function(e){this.colorHandle=e},hueViewRef:function(e){this.hueView=e},hueHandleRef:function(e){this.hueHandle=e},clearRefs:function(){this.picker=null,this.colorSelector=null,this.colorHandle=null,this.hueView=null,this.hueHandle=null},onOverlayClick:function(e){l.default.emit("overlay-click",{originalEvent:e,target:this.$el})}},components:{Portal:a.default}},c=["tabindex","disabled"];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],o=document.createElement("style");o.type="text/css","top"===n&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-colorpicker {\n display: inline-block;\n}\n.p-colorpicker-dragging {\n cursor: pointer;\n}\n.p-colorpicker-overlay {\n position: relative;\n}\n.p-colorpicker-panel {\n position: relative;\n width: 193px;\n height: 166px;\n}\n.p-colorpicker-overlay-panel {\n position: absolute;\n top: 0;\n left: 0;\n}\n.p-colorpicker-preview {\n cursor: pointer;\n}\n.p-colorpicker-panel .p-colorpicker-content {\n position: relative;\n}\n.p-colorpicker-panel .p-colorpicker-color-selector {\n width: 150px;\n height: 150px;\n top: 8px;\n left: 8px;\n position: absolute;\n}\n.p-colorpicker-panel .p-colorpicker-color {\n width: 150px;\n height: 150px;\n}\n.p-colorpicker-panel .p-colorpicker-color-handle {\n position: absolute;\n top: 0px;\n left: 150px;\n border-radius: 100%;\n width: 10px;\n height: 10px;\n border-width: 1px;\n border-style: solid;\n margin: -5px 0 0 -5px;\n cursor: pointer;\n opacity: 0.85;\n}\n.p-colorpicker-panel .p-colorpicker-hue {\n width: 17px;\n height: 150px;\n top: 8px;\n left: 167px;\n position: absolute;\n opacity: 0.85;\n}\n.p-colorpicker-panel .p-colorpicker-hue-handle {\n position: absolute;\n top: 150px;\n left: 0px;\n width: 21px;\n margin-left: -2px;\n margin-top: -5px;\n height: 10px;\n border-width: 2px;\n border-style: solid;\n opacity: 0.85;\n cursor: pointer;\n}\n"),u.render=function(e,t,n,i,o,s){var l=r.resolveComponent("Portal");return r.openBlock(),r.createElementBlock("div",r.mergeProps({ref:"container",class:e.cx("root")},e.ptmi("root")),[e.inline?r.createCommentVNode("",!0):(r.openBlock(),r.createElementBlock("input",r.mergeProps({key:0,ref:"input",type:"text",class:e.cx("input"),readonly:"readonly",tabindex:e.tabindex,disabled:e.disabled,onClick:t[0]||(t[0]=function(){return s.onInputClick&&s.onInputClick.apply(s,arguments)}),onKeydown:t[1]||(t[1]=function(){return s.onInputKeydown&&s.onInputKeydown.apply(s,arguments)})},e.ptm("input")),null,16,c)),r.createVNode(l,{appendTo:e.appendTo,disabled:e.inline},{default:r.withCtx((function(){return[r.createVNode(r.Transition,r.mergeProps({name:"p-connected-overlay",onEnter:s.onOverlayEnter,onLeave:s.onOverlayLeave,onAfterLeave:s.onOverlayAfterLeave},e.ptm("transition")),{default:r.withCtx((function(){return[e.inline||o.overlayVisible?(r.openBlock(),r.createElementBlock("div",r.mergeProps({key:0,ref:s.pickerRef,class:[e.cx("panel"),e.panelClass],onClick:t[10]||(t[10]=function(){return s.onOverlayClick&&s.onOverlayClick.apply(s,arguments)})},e.ptm("panel")),[r.createElementVNode("div",r.mergeProps({class:e.cx("content")},e.ptm("content")),[r.createElementVNode("div",r.mergeProps({ref:s.colorSelectorRef,class:e.cx("selector"),onMousedown:t[2]||(t[2]=function(e){return s.onColorMousedown(e)}),onTouchstart:t[3]||(t[3]=function(e){return s.onColorDragStart(e)}),onTouchmove:t[4]||(t[4]=function(e){return s.onDrag(e)}),onTouchend:t[5]||(t[5]=function(e){return s.onDragEnd()})},e.ptm("selector")),[r.createElementVNode("div",r.mergeProps({class:e.cx("color")},e.ptm("color")),[r.createElementVNode("div",r.mergeProps({ref:s.colorHandleRef,class:e.cx("colorHandle")},e.ptm("colorHandle")),null,16)],16)],16),r.createElementVNode("div",r.mergeProps({ref:s.hueViewRef,class:e.cx("hue"),onMousedown:t[6]||(t[6]=function(e){return s.onHueMousedown(e)}),onTouchstart:t[7]||(t[7]=function(e){return s.onHueDragStart(e)}),onTouchmove:t[8]||(t[8]=function(e){return s.onDrag(e)}),onTouchend:t[9]||(t[9]=function(e){return s.onDragEnd()})},e.ptm("hue")),[r.createElementVNode("div",r.mergeProps({ref:s.hueHandleRef,class:e.cx("hueHandle")},e.ptm("hueHandle")),null,16)],16)],16)],16)):r.createCommentVNode("",!0)]})),_:1},16,["onEnter","onLeave","onAfterLeave"])]})),_:1},8,["appendTo","disabled"])],16)},u}(primevue.overlayeventbus,primevue.portal,primevue.utils,primevue.basecomponent,primevue.colorpicker.style,Vue);
@@ -689,7 +689,7 @@ export interface ColumnSlots {
689
689
  */
690
690
  editorInitCallback: (event: Event) => void;
691
691
  /**
692
- * Row toggler callback unction
692
+ * Row toggler callback function
693
693
  * @param {Event} event - Browser event
694
694
  */
695
695
  rowTogglerCallback: (event: Event) => void;
@@ -54,7 +54,8 @@ export default {
54
54
  visible: false,
55
55
  confirmation: null,
56
56
  autoFocusAccept: null,
57
- autoFocusReject: null
57
+ autoFocusReject: null,
58
+ target: null
58
59
  };
59
60
  },
60
61
  target: null,
@@ -150,6 +151,7 @@ export default {
150
151
  onEnter(el) {
151
152
  this.autoFocusAccept = this.confirmation.defaultFocus === undefined || this.confirmation.defaultFocus === 'accept' ? true : false;
152
153
  this.autoFocusReject = this.confirmation.defaultFocus === 'reject' ? true : false;
154
+ this.target = document.activeElement;
153
155
 
154
156
  this.bindOutsideClickListener();
155
157
  this.bindScrollListener();
@@ -164,6 +166,9 @@ export default {
164
166
  this.autoFocusAccept = null;
165
167
  this.autoFocusReject = null;
166
168
 
169
+ DomHandler.focus(this.target);
170
+ this.target = null;
171
+
167
172
  this.unbindOutsideClickListener();
168
173
  this.unbindScrollListener();
169
174
  this.unbindResizeListener();
@@ -43,7 +43,8 @@ var script = {
43
43
  visible: false,
44
44
  confirmation: null,
45
45
  autoFocusAccept: null,
46
- autoFocusReject: null
46
+ autoFocusReject: null,
47
+ target: null
47
48
  };
48
49
  },
49
50
  target: null,
@@ -127,6 +128,7 @@ var script = {
127
128
  onEnter: function onEnter(el) {
128
129
  this.autoFocusAccept = this.confirmation.defaultFocus === undefined || this.confirmation.defaultFocus === 'accept' ? true : false;
129
130
  this.autoFocusReject = this.confirmation.defaultFocus === 'reject' ? true : false;
131
+ this.target = document.activeElement;
130
132
  this.bindOutsideClickListener();
131
133
  this.bindScrollListener();
132
134
  this.bindResizeListener();
@@ -138,6 +140,8 @@ var script = {
138
140
  onLeave: function onLeave() {
139
141
  this.autoFocusAccept = null;
140
142
  this.autoFocusReject = null;
143
+ utils.DomHandler.focus(this.target);
144
+ this.target = null;
141
145
  this.unbindOutsideClickListener();
142
146
  this.unbindScrollListener();
143
147
  this.unbindResizeListener();
@@ -1 +1 @@
1
- "use strict";var e=require("primevue/button"),t=require("primevue/confirmationeventbus"),n=require("primevue/focustrap"),i=require("primevue/overlayeventbus"),o=require("primevue/portal"),r=require("primevue/utils"),c=require("primevue/basecomponent"),s=require("primevue/confirmpopup/style"),l=require("vue");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(e),f=a(t),d=a(n),m=a(i),p=a(o),h={name:"ConfirmPopup",extends:{name:"BaseConfirmPopup",extends:a(c).default,props:{group:String},style:a(s).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,data:function(){return{visible:!1,confirmation:null,autoFocusAccept:null,autoFocusReject:null}},target:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,container:null,confirmListener:null,closeListener:null,mounted:function(){var e=this;this.confirmListener=function(t){t&&t.group===e.group&&(e.confirmation=t,e.target=t.target,e.confirmation.onShow&&e.confirmation.onShow(),e.visible=!0)},this.closeListener=function(){e.visible=!1,e.confirmation=null},f.default.on("confirm",this.confirmListener),f.default.on("close",this.closeListener)},beforeUnmount:function(){f.default.off("confirm",this.confirmListener),f.default.off("close",this.closeListener),this.unbindOutsideClickListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.unbindResizeListener(),this.container&&(r.ZIndexUtils.clear(this.container),this.container=null),this.target=null,this.confirmation=null},methods:{accept:function(){this.confirmation.accept&&this.confirmation.accept(),this.visible=!1},reject:function(){this.confirmation.reject&&this.confirmation.reject(),this.visible=!1},onHide:function(){this.confirmation.onHide&&this.confirmation.onHide(),this.visible=!1},onAcceptKeydown:function(e){"Space"!==e.code&&"Enter"!==e.code&&"NumpadEnter"!==e.code||(this.accept(),r.DomHandler.focus(this.target),e.preventDefault())},onRejectKeydown:function(e){"Space"!==e.code&&"Enter"!==e.code&&"NumpadEnter"!==e.code||(this.reject(),r.DomHandler.focus(this.target),e.preventDefault())},onEnter:function(e){this.autoFocusAccept=void 0===this.confirmation.defaultFocus||"accept"===this.confirmation.defaultFocus,this.autoFocusReject="reject"===this.confirmation.defaultFocus,this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),r.ZIndexUtils.set("overlay",e,this.$primevue.config.zIndex.overlay)},onAfterEnter:function(){this.focus()},onLeave:function(){this.autoFocusAccept=null,this.autoFocusReject=null,this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener()},onAfterLeave:function(e){r.ZIndexUtils.clear(e)},alignOverlay:function(){r.DomHandler.absolutePosition(this.container,this.target,!1);var e=r.DomHandler.getOffset(this.container),t=r.DomHandler.getOffset(this.target),n=0;e.left<t.left&&(n=t.left-e.left),this.container.style.setProperty("--overlayArrowLeft","".concat(n,"px")),e.top<t.top&&(this.container.setAttribute("data-p-confirm-popup-flipped","true"),!this.isUnstyled&&r.DomHandler.addClass(this.container,"p-confirm-popup-flipped"))},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){e.visible&&e.container&&!e.container.contains(t.target)&&!e.isTargetClicked(t)?(e.confirmation.onHide&&e.confirmation.onHide(),e.visible=!1):e.alignOverlay()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener:function(){var e=this;this.scrollHandler||(this.scrollHandler=new r.ConnectedOverlayScrollHandler(this.target,(function(){e.visible&&(e.visible=!1)}))),this.scrollHandler.bindScrollListener()},unbindScrollListener:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.visible&&!r.DomHandler.isTouchDevice()&&(e.visible=!1)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},focus:function(){var e=this.container.querySelector("[autofocus]");e&&e.focus({preventScroll:!0})},isTargetClicked:function(e){return this.target&&(this.target===e.target||this.target.contains(e.target))},containerRef:function(e){this.container=e},onOverlayClick:function(e){m.default.emit("overlay-click",{originalEvent:e,target:this.target})},onOverlayKeydown:function(e){"Escape"===e.code&&(f.default.emit("close",this.closeListener),r.DomHandler.focus(this.target))},getCXOptions:function(e,t){return{contenxt:{icon:e,iconClass:t.class}}}},computed:{message:function(){return this.confirmation?this.confirmation.message:null},acceptLabel:function(){return this.confirmation?this.confirmation.acceptLabel||this.$primevue.config.locale.accept:null},rejectLabel:function(){return this.confirmation?this.confirmation.rejectLabel||this.$primevue.config.locale.reject:null},acceptIcon:function(){return this.confirmation?this.confirmation.acceptIcon:null},rejectIcon:function(){return this.confirmation?this.confirmation.rejectIcon:null}},components:{CPButton:u.default,Portal:p.default},directives:{focustrap:d.default}},v=["aria-modal"];h.render=function(e,t,n,i,o,r){var c=l.resolveComponent("CPButton"),s=l.resolveComponent("Portal"),a=l.resolveDirective("focustrap");return l.openBlock(),l.createBlock(s,null,{default:l.withCtx((function(){return[l.createVNode(l.Transition,l.mergeProps({name:"p-confirm-popup",onEnter:r.onEnter,onAfterEnter:r.onAfterEnter,onLeave:r.onLeave,onAfterLeave:r.onAfterLeave},e.ptm("transition")),{default:l.withCtx((function(){return[o.visible?l.withDirectives((l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,ref:r.containerRef,role:"alertdialog",class:e.cx("root"),"aria-modal":o.visible,onClick:t[2]||(t[2]=function(){return r.onOverlayClick&&r.onOverlayClick.apply(r,arguments)}),onKeydown:t[3]||(t[3]=function(){return r.onOverlayKeydown&&r.onOverlayKeydown.apply(r,arguments)})},e.ptmi("root")),[e.$slots.container?l.renderSlot(e.$slots,"container",{key:0,message:o.confirmation,onAccept:r.accept,onReject:r.reject,acceptCallback:r.accept,rejectCallback:r.reject}):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[e.$slots.message?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.$slots.message),{key:1,message:o.confirmation},null,8,["message"])):(l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,class:e.cx("content")},e.ptm("content")),[l.renderSlot(e.$slots,"icon",{},(function(){return[e.$slots.icon?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.$slots.icon),{key:0,class:l.normalizeClass(e.cx("icon"))},null,8,["class"])):o.confirmation.icon?(l.openBlock(),l.createElementBlock("span",l.mergeProps({key:1,class:[o.confirmation.icon,e.cx("icon")]},e.ptm("icon")),null,16)):l.createCommentVNode("",!0)]})),l.createElementVNode("span",l.mergeProps({class:e.cx("message")},e.ptm("message")),l.toDisplayString(o.confirmation.message),17)],16)),l.createElementVNode("div",l.mergeProps({class:e.cx("footer")},e.ptm("footer")),[l.createVNode(c,{label:r.rejectLabel,onClick:t[0]||(t[0]=function(e){return r.reject()}),onKeydown:r.onRejectKeydown,autofocus:o.autoFocusReject,class:l.normalizeClass([e.cx("rejectButton"),o.confirmation.rejectClass]),unstyled:e.unstyled,pt:e.ptm("rejectButton")},l.createSlots({_:2},[r.rejectIcon||e.$slots.rejecticon?{name:"icon",fn:l.withCtx((function(t){return[l.renderSlot(e.$slots,"rejecticon",{},(function(){return[l.createElementVNode("span",l.mergeProps({class:[r.rejectIcon,t.class]},e.ptm("rejectButton").icon,{"data-pc-section":"rejectbuttonicon"}),null,16)]}))]})),key:"0"}:void 0]),1032,["label","onKeydown","autofocus","class","unstyled","pt"]),l.createVNode(c,{label:r.acceptLabel,onClick:t[1]||(t[1]=function(e){return r.accept()}),onKeydown:r.onAcceptKeydown,autofocus:o.autoFocusAccept,class:l.normalizeClass([e.cx("acceptButton"),o.confirmation.acceptClass]),unstyled:e.unstyled,pt:e.ptm("acceptButton")},l.createSlots({_:2},[r.acceptIcon||e.$slots.accepticon?{name:"icon",fn:l.withCtx((function(t){return[l.renderSlot(e.$slots,"accepticon",{},(function(){return[l.createElementVNode("span",l.mergeProps({class:[r.acceptIcon,t.class]},e.ptm("acceptButton").icon,{"data-pc-section":"acceptbuttonicon"}),null,16)]}))]})),key:"0"}:void 0]),1032,["label","onKeydown","autofocus","class","unstyled","pt"])],16)],64))],16,v)),[[a]]):l.createCommentVNode("",!0)]})),_:3},16,["onEnter","onAfterEnter","onLeave","onAfterLeave"])]})),_:3})},module.exports=h;
1
+ "use strict";var e=require("primevue/button"),t=require("primevue/confirmationeventbus"),n=require("primevue/focustrap"),i=require("primevue/overlayeventbus"),o=require("primevue/portal"),r=require("primevue/utils"),c=require("primevue/basecomponent"),s=require("primevue/confirmpopup/style"),l=require("vue");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(e),f=a(t),d=a(n),m=a(i),p=a(o),h={name:"ConfirmPopup",extends:{name:"BaseConfirmPopup",extends:a(c).default,props:{group:String},style:a(s).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,data:function(){return{visible:!1,confirmation:null,autoFocusAccept:null,autoFocusReject:null,target:null}},target:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,container:null,confirmListener:null,closeListener:null,mounted:function(){var e=this;this.confirmListener=function(t){t&&t.group===e.group&&(e.confirmation=t,e.target=t.target,e.confirmation.onShow&&e.confirmation.onShow(),e.visible=!0)},this.closeListener=function(){e.visible=!1,e.confirmation=null},f.default.on("confirm",this.confirmListener),f.default.on("close",this.closeListener)},beforeUnmount:function(){f.default.off("confirm",this.confirmListener),f.default.off("close",this.closeListener),this.unbindOutsideClickListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.unbindResizeListener(),this.container&&(r.ZIndexUtils.clear(this.container),this.container=null),this.target=null,this.confirmation=null},methods:{accept:function(){this.confirmation.accept&&this.confirmation.accept(),this.visible=!1},reject:function(){this.confirmation.reject&&this.confirmation.reject(),this.visible=!1},onHide:function(){this.confirmation.onHide&&this.confirmation.onHide(),this.visible=!1},onAcceptKeydown:function(e){"Space"!==e.code&&"Enter"!==e.code&&"NumpadEnter"!==e.code||(this.accept(),r.DomHandler.focus(this.target),e.preventDefault())},onRejectKeydown:function(e){"Space"!==e.code&&"Enter"!==e.code&&"NumpadEnter"!==e.code||(this.reject(),r.DomHandler.focus(this.target),e.preventDefault())},onEnter:function(e){this.autoFocusAccept=void 0===this.confirmation.defaultFocus||"accept"===this.confirmation.defaultFocus,this.autoFocusReject="reject"===this.confirmation.defaultFocus,this.target=document.activeElement,this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),r.ZIndexUtils.set("overlay",e,this.$primevue.config.zIndex.overlay)},onAfterEnter:function(){this.focus()},onLeave:function(){this.autoFocusAccept=null,this.autoFocusReject=null,r.DomHandler.focus(this.target),this.target=null,this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener()},onAfterLeave:function(e){r.ZIndexUtils.clear(e)},alignOverlay:function(){r.DomHandler.absolutePosition(this.container,this.target,!1);var e=r.DomHandler.getOffset(this.container),t=r.DomHandler.getOffset(this.target),n=0;e.left<t.left&&(n=t.left-e.left),this.container.style.setProperty("--overlayArrowLeft","".concat(n,"px")),e.top<t.top&&(this.container.setAttribute("data-p-confirm-popup-flipped","true"),!this.isUnstyled&&r.DomHandler.addClass(this.container,"p-confirm-popup-flipped"))},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){e.visible&&e.container&&!e.container.contains(t.target)&&!e.isTargetClicked(t)?(e.confirmation.onHide&&e.confirmation.onHide(),e.visible=!1):e.alignOverlay()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener:function(){var e=this;this.scrollHandler||(this.scrollHandler=new r.ConnectedOverlayScrollHandler(this.target,(function(){e.visible&&(e.visible=!1)}))),this.scrollHandler.bindScrollListener()},unbindScrollListener:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.visible&&!r.DomHandler.isTouchDevice()&&(e.visible=!1)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},focus:function(){var e=this.container.querySelector("[autofocus]");e&&e.focus({preventScroll:!0})},isTargetClicked:function(e){return this.target&&(this.target===e.target||this.target.contains(e.target))},containerRef:function(e){this.container=e},onOverlayClick:function(e){m.default.emit("overlay-click",{originalEvent:e,target:this.target})},onOverlayKeydown:function(e){"Escape"===e.code&&(f.default.emit("close",this.closeListener),r.DomHandler.focus(this.target))},getCXOptions:function(e,t){return{contenxt:{icon:e,iconClass:t.class}}}},computed:{message:function(){return this.confirmation?this.confirmation.message:null},acceptLabel:function(){return this.confirmation?this.confirmation.acceptLabel||this.$primevue.config.locale.accept:null},rejectLabel:function(){return this.confirmation?this.confirmation.rejectLabel||this.$primevue.config.locale.reject:null},acceptIcon:function(){return this.confirmation?this.confirmation.acceptIcon:null},rejectIcon:function(){return this.confirmation?this.confirmation.rejectIcon:null}},components:{CPButton:u.default,Portal:p.default},directives:{focustrap:d.default}},v=["aria-modal"];h.render=function(e,t,n,i,o,r){var c=l.resolveComponent("CPButton"),s=l.resolveComponent("Portal"),a=l.resolveDirective("focustrap");return l.openBlock(),l.createBlock(s,null,{default:l.withCtx((function(){return[l.createVNode(l.Transition,l.mergeProps({name:"p-confirm-popup",onEnter:r.onEnter,onAfterEnter:r.onAfterEnter,onLeave:r.onLeave,onAfterLeave:r.onAfterLeave},e.ptm("transition")),{default:l.withCtx((function(){return[o.visible?l.withDirectives((l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,ref:r.containerRef,role:"alertdialog",class:e.cx("root"),"aria-modal":o.visible,onClick:t[2]||(t[2]=function(){return r.onOverlayClick&&r.onOverlayClick.apply(r,arguments)}),onKeydown:t[3]||(t[3]=function(){return r.onOverlayKeydown&&r.onOverlayKeydown.apply(r,arguments)})},e.ptmi("root")),[e.$slots.container?l.renderSlot(e.$slots,"container",{key:0,message:o.confirmation,onAccept:r.accept,onReject:r.reject,acceptCallback:r.accept,rejectCallback:r.reject}):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[e.$slots.message?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.$slots.message),{key:1,message:o.confirmation},null,8,["message"])):(l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,class:e.cx("content")},e.ptm("content")),[l.renderSlot(e.$slots,"icon",{},(function(){return[e.$slots.icon?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.$slots.icon),{key:0,class:l.normalizeClass(e.cx("icon"))},null,8,["class"])):o.confirmation.icon?(l.openBlock(),l.createElementBlock("span",l.mergeProps({key:1,class:[o.confirmation.icon,e.cx("icon")]},e.ptm("icon")),null,16)):l.createCommentVNode("",!0)]})),l.createElementVNode("span",l.mergeProps({class:e.cx("message")},e.ptm("message")),l.toDisplayString(o.confirmation.message),17)],16)),l.createElementVNode("div",l.mergeProps({class:e.cx("footer")},e.ptm("footer")),[l.createVNode(c,{label:r.rejectLabel,onClick:t[0]||(t[0]=function(e){return r.reject()}),onKeydown:r.onRejectKeydown,autofocus:o.autoFocusReject,class:l.normalizeClass([e.cx("rejectButton"),o.confirmation.rejectClass]),unstyled:e.unstyled,pt:e.ptm("rejectButton")},l.createSlots({_:2},[r.rejectIcon||e.$slots.rejecticon?{name:"icon",fn:l.withCtx((function(t){return[l.renderSlot(e.$slots,"rejecticon",{},(function(){return[l.createElementVNode("span",l.mergeProps({class:[r.rejectIcon,t.class]},e.ptm("rejectButton").icon,{"data-pc-section":"rejectbuttonicon"}),null,16)]}))]})),key:"0"}:void 0]),1032,["label","onKeydown","autofocus","class","unstyled","pt"]),l.createVNode(c,{label:r.acceptLabel,onClick:t[1]||(t[1]=function(e){return r.accept()}),onKeydown:r.onAcceptKeydown,autofocus:o.autoFocusAccept,class:l.normalizeClass([e.cx("acceptButton"),o.confirmation.acceptClass]),unstyled:e.unstyled,pt:e.ptm("acceptButton")},l.createSlots({_:2},[r.acceptIcon||e.$slots.accepticon?{name:"icon",fn:l.withCtx((function(t){return[l.renderSlot(e.$slots,"accepticon",{},(function(){return[l.createElementVNode("span",l.mergeProps({class:[r.acceptIcon,t.class]},e.ptm("acceptButton").icon,{"data-pc-section":"acceptbuttonicon"}),null,16)]}))]})),key:"0"}:void 0]),1032,["label","onKeydown","autofocus","class","unstyled","pt"])],16)],64))],16,v)),[[a]]):l.createCommentVNode("",!0)]})),_:3},16,["onEnter","onAfterEnter","onLeave","onAfterLeave"])]})),_:3})},module.exports=h;
@@ -31,7 +31,8 @@ var script = {
31
31
  visible: false,
32
32
  confirmation: null,
33
33
  autoFocusAccept: null,
34
- autoFocusReject: null
34
+ autoFocusReject: null,
35
+ target: null
35
36
  };
36
37
  },
37
38
  target: null,
@@ -115,6 +116,7 @@ var script = {
115
116
  onEnter: function onEnter(el) {
116
117
  this.autoFocusAccept = this.confirmation.defaultFocus === undefined || this.confirmation.defaultFocus === 'accept' ? true : false;
117
118
  this.autoFocusReject = this.confirmation.defaultFocus === 'reject' ? true : false;
119
+ this.target = document.activeElement;
118
120
  this.bindOutsideClickListener();
119
121
  this.bindScrollListener();
120
122
  this.bindResizeListener();
@@ -126,6 +128,8 @@ var script = {
126
128
  onLeave: function onLeave() {
127
129
  this.autoFocusAccept = null;
128
130
  this.autoFocusReject = null;
131
+ DomHandler.focus(this.target);
132
+ this.target = null;
129
133
  this.unbindOutsideClickListener();
130
134
  this.unbindScrollListener();
131
135
  this.unbindResizeListener();
@@ -1 +1 @@
1
- import t from"primevue/button";import e from"primevue/confirmationeventbus";import n from"primevue/focustrap";import i from"primevue/overlayeventbus";import o from"primevue/portal";import{ZIndexUtils as c,DomHandler as s,ConnectedOverlayScrollHandler as r}from"primevue/utils";import a from"primevue/basecomponent";import l from"primevue/confirmpopup/style";import{resolveComponent as u,resolveDirective as f,openBlock as p,createBlock as m,withCtx as d,createVNode as h,Transition as v,mergeProps as L,withDirectives as b,createElementBlock as y,renderSlot as g,Fragment as k,resolveDynamicComponent as j,normalizeClass as C,createCommentVNode as w,createElementVNode as A,toDisplayString as E,createSlots as O}from"vue";var z={name:"ConfirmPopup",extends:{name:"BaseConfirmPopup",extends:a,props:{group:String},style:l,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,data:function(){return{visible:!1,confirmation:null,autoFocusAccept:null,autoFocusReject:null}},target:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,container:null,confirmListener:null,closeListener:null,mounted:function(){var t=this;this.confirmListener=function(e){e&&e.group===t.group&&(t.confirmation=e,t.target=e.target,t.confirmation.onShow&&t.confirmation.onShow(),t.visible=!0)},this.closeListener=function(){t.visible=!1,t.confirmation=null},e.on("confirm",this.confirmListener),e.on("close",this.closeListener)},beforeUnmount:function(){e.off("confirm",this.confirmListener),e.off("close",this.closeListener),this.unbindOutsideClickListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.unbindResizeListener(),this.container&&(c.clear(this.container),this.container=null),this.target=null,this.confirmation=null},methods:{accept:function(){this.confirmation.accept&&this.confirmation.accept(),this.visible=!1},reject:function(){this.confirmation.reject&&this.confirmation.reject(),this.visible=!1},onHide:function(){this.confirmation.onHide&&this.confirmation.onHide(),this.visible=!1},onAcceptKeydown:function(t){"Space"!==t.code&&"Enter"!==t.code&&"NumpadEnter"!==t.code||(this.accept(),s.focus(this.target),t.preventDefault())},onRejectKeydown:function(t){"Space"!==t.code&&"Enter"!==t.code&&"NumpadEnter"!==t.code||(this.reject(),s.focus(this.target),t.preventDefault())},onEnter:function(t){this.autoFocusAccept=void 0===this.confirmation.defaultFocus||"accept"===this.confirmation.defaultFocus,this.autoFocusReject="reject"===this.confirmation.defaultFocus,this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),c.set("overlay",t,this.$primevue.config.zIndex.overlay)},onAfterEnter:function(){this.focus()},onLeave:function(){this.autoFocusAccept=null,this.autoFocusReject=null,this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener()},onAfterLeave:function(t){c.clear(t)},alignOverlay:function(){s.absolutePosition(this.container,this.target,!1);var t=s.getOffset(this.container),e=s.getOffset(this.target),n=0;t.left<e.left&&(n=e.left-t.left),this.container.style.setProperty("--overlayArrowLeft","".concat(n,"px")),t.top<e.top&&(this.container.setAttribute("data-p-confirm-popup-flipped","true"),!this.isUnstyled&&s.addClass(this.container,"p-confirm-popup-flipped"))},bindOutsideClickListener:function(){var t=this;this.outsideClickListener||(this.outsideClickListener=function(e){t.visible&&t.container&&!t.container.contains(e.target)&&!t.isTargetClicked(e)?(t.confirmation.onHide&&t.confirmation.onHide(),t.visible=!1):t.alignOverlay()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener:function(){var t=this;this.scrollHandler||(this.scrollHandler=new r(this.target,(function(){t.visible&&(t.visible=!1)}))),this.scrollHandler.bindScrollListener()},unbindScrollListener:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener:function(){var t=this;this.resizeListener||(this.resizeListener=function(){t.visible&&!s.isTouchDevice()&&(t.visible=!1)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},focus:function(){var t=this.container.querySelector("[autofocus]");t&&t.focus({preventScroll:!0})},isTargetClicked:function(t){return this.target&&(this.target===t.target||this.target.contains(t.target))},containerRef:function(t){this.container=t},onOverlayClick:function(t){i.emit("overlay-click",{originalEvent:t,target:this.target})},onOverlayKeydown:function(t){"Escape"===t.code&&(e.emit("close",this.closeListener),s.focus(this.target))},getCXOptions:function(t,e){return{contenxt:{icon:t,iconClass:e.class}}}},computed:{message:function(){return this.confirmation?this.confirmation.message:null},acceptLabel:function(){return this.confirmation?this.confirmation.acceptLabel||this.$primevue.config.locale.accept:null},rejectLabel:function(){return this.confirmation?this.confirmation.rejectLabel||this.$primevue.config.locale.reject:null},acceptIcon:function(){return this.confirmation?this.confirmation.acceptIcon:null},rejectIcon:function(){return this.confirmation?this.confirmation.rejectIcon:null}},components:{CPButton:t,Portal:o},directives:{focustrap:n}},$=["aria-modal"];z.render=function(t,e,n,i,o,c){var s=u("CPButton"),r=u("Portal"),a=f("focustrap");return p(),m(r,null,{default:d((function(){return[h(v,L({name:"p-confirm-popup",onEnter:c.onEnter,onAfterEnter:c.onAfterEnter,onLeave:c.onLeave,onAfterLeave:c.onAfterLeave},t.ptm("transition")),{default:d((function(){return[o.visible?b((p(),y("div",L({key:0,ref:c.containerRef,role:"alertdialog",class:t.cx("root"),"aria-modal":o.visible,onClick:e[2]||(e[2]=function(){return c.onOverlayClick&&c.onOverlayClick.apply(c,arguments)}),onKeydown:e[3]||(e[3]=function(){return c.onOverlayKeydown&&c.onOverlayKeydown.apply(c,arguments)})},t.ptmi("root")),[t.$slots.container?g(t.$slots,"container",{key:0,message:o.confirmation,onAccept:c.accept,onReject:c.reject,acceptCallback:c.accept,rejectCallback:c.reject}):(p(),y(k,{key:1},[t.$slots.message?(p(),m(j(t.$slots.message),{key:1,message:o.confirmation},null,8,["message"])):(p(),y("div",L({key:0,class:t.cx("content")},t.ptm("content")),[g(t.$slots,"icon",{},(function(){return[t.$slots.icon?(p(),m(j(t.$slots.icon),{key:0,class:C(t.cx("icon"))},null,8,["class"])):o.confirmation.icon?(p(),y("span",L({key:1,class:[o.confirmation.icon,t.cx("icon")]},t.ptm("icon")),null,16)):w("",!0)]})),A("span",L({class:t.cx("message")},t.ptm("message")),E(o.confirmation.message),17)],16)),A("div",L({class:t.cx("footer")},t.ptm("footer")),[h(s,{label:c.rejectLabel,onClick:e[0]||(e[0]=function(t){return c.reject()}),onKeydown:c.onRejectKeydown,autofocus:o.autoFocusReject,class:C([t.cx("rejectButton"),o.confirmation.rejectClass]),unstyled:t.unstyled,pt:t.ptm("rejectButton")},O({_:2},[c.rejectIcon||t.$slots.rejecticon?{name:"icon",fn:d((function(e){return[g(t.$slots,"rejecticon",{},(function(){return[A("span",L({class:[c.rejectIcon,e.class]},t.ptm("rejectButton").icon,{"data-pc-section":"rejectbuttonicon"}),null,16)]}))]})),key:"0"}:void 0]),1032,["label","onKeydown","autofocus","class","unstyled","pt"]),h(s,{label:c.acceptLabel,onClick:e[1]||(e[1]=function(t){return c.accept()}),onKeydown:c.onAcceptKeydown,autofocus:o.autoFocusAccept,class:C([t.cx("acceptButton"),o.confirmation.acceptClass]),unstyled:t.unstyled,pt:t.ptm("acceptButton")},O({_:2},[c.acceptIcon||t.$slots.accepticon?{name:"icon",fn:d((function(e){return[g(t.$slots,"accepticon",{},(function(){return[A("span",L({class:[c.acceptIcon,e.class]},t.ptm("acceptButton").icon,{"data-pc-section":"acceptbuttonicon"}),null,16)]}))]})),key:"0"}:void 0]),1032,["label","onKeydown","autofocus","class","unstyled","pt"])],16)],64))],16,$)),[[a]]):w("",!0)]})),_:3},16,["onEnter","onAfterEnter","onLeave","onAfterLeave"])]})),_:3})};export{z as default};
1
+ import t from"primevue/button";import e from"primevue/confirmationeventbus";import n from"primevue/focustrap";import i from"primevue/overlayeventbus";import o from"primevue/portal";import{ZIndexUtils as c,DomHandler as s,ConnectedOverlayScrollHandler as r}from"primevue/utils";import a from"primevue/basecomponent";import l from"primevue/confirmpopup/style";import{resolveComponent as u,resolveDirective as f,openBlock as p,createBlock as m,withCtx as d,createVNode as h,Transition as v,mergeProps as L,withDirectives as b,createElementBlock as y,renderSlot as g,Fragment as k,resolveDynamicComponent as j,normalizeClass as C,createCommentVNode as w,createElementVNode as E,toDisplayString as A,createSlots as O}from"vue";var z={name:"ConfirmPopup",extends:{name:"BaseConfirmPopup",extends:a,props:{group:String},style:l,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,data:function(){return{visible:!1,confirmation:null,autoFocusAccept:null,autoFocusReject:null,target:null}},target:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,container:null,confirmListener:null,closeListener:null,mounted:function(){var t=this;this.confirmListener=function(e){e&&e.group===t.group&&(t.confirmation=e,t.target=e.target,t.confirmation.onShow&&t.confirmation.onShow(),t.visible=!0)},this.closeListener=function(){t.visible=!1,t.confirmation=null},e.on("confirm",this.confirmListener),e.on("close",this.closeListener)},beforeUnmount:function(){e.off("confirm",this.confirmListener),e.off("close",this.closeListener),this.unbindOutsideClickListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.unbindResizeListener(),this.container&&(c.clear(this.container),this.container=null),this.target=null,this.confirmation=null},methods:{accept:function(){this.confirmation.accept&&this.confirmation.accept(),this.visible=!1},reject:function(){this.confirmation.reject&&this.confirmation.reject(),this.visible=!1},onHide:function(){this.confirmation.onHide&&this.confirmation.onHide(),this.visible=!1},onAcceptKeydown:function(t){"Space"!==t.code&&"Enter"!==t.code&&"NumpadEnter"!==t.code||(this.accept(),s.focus(this.target),t.preventDefault())},onRejectKeydown:function(t){"Space"!==t.code&&"Enter"!==t.code&&"NumpadEnter"!==t.code||(this.reject(),s.focus(this.target),t.preventDefault())},onEnter:function(t){this.autoFocusAccept=void 0===this.confirmation.defaultFocus||"accept"===this.confirmation.defaultFocus,this.autoFocusReject="reject"===this.confirmation.defaultFocus,this.target=document.activeElement,this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),c.set("overlay",t,this.$primevue.config.zIndex.overlay)},onAfterEnter:function(){this.focus()},onLeave:function(){this.autoFocusAccept=null,this.autoFocusReject=null,s.focus(this.target),this.target=null,this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener()},onAfterLeave:function(t){c.clear(t)},alignOverlay:function(){s.absolutePosition(this.container,this.target,!1);var t=s.getOffset(this.container),e=s.getOffset(this.target),n=0;t.left<e.left&&(n=e.left-t.left),this.container.style.setProperty("--overlayArrowLeft","".concat(n,"px")),t.top<e.top&&(this.container.setAttribute("data-p-confirm-popup-flipped","true"),!this.isUnstyled&&s.addClass(this.container,"p-confirm-popup-flipped"))},bindOutsideClickListener:function(){var t=this;this.outsideClickListener||(this.outsideClickListener=function(e){t.visible&&t.container&&!t.container.contains(e.target)&&!t.isTargetClicked(e)?(t.confirmation.onHide&&t.confirmation.onHide(),t.visible=!1):t.alignOverlay()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener:function(){var t=this;this.scrollHandler||(this.scrollHandler=new r(this.target,(function(){t.visible&&(t.visible=!1)}))),this.scrollHandler.bindScrollListener()},unbindScrollListener:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener:function(){var t=this;this.resizeListener||(this.resizeListener=function(){t.visible&&!s.isTouchDevice()&&(t.visible=!1)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},focus:function(){var t=this.container.querySelector("[autofocus]");t&&t.focus({preventScroll:!0})},isTargetClicked:function(t){return this.target&&(this.target===t.target||this.target.contains(t.target))},containerRef:function(t){this.container=t},onOverlayClick:function(t){i.emit("overlay-click",{originalEvent:t,target:this.target})},onOverlayKeydown:function(t){"Escape"===t.code&&(e.emit("close",this.closeListener),s.focus(this.target))},getCXOptions:function(t,e){return{contenxt:{icon:t,iconClass:e.class}}}},computed:{message:function(){return this.confirmation?this.confirmation.message:null},acceptLabel:function(){return this.confirmation?this.confirmation.acceptLabel||this.$primevue.config.locale.accept:null},rejectLabel:function(){return this.confirmation?this.confirmation.rejectLabel||this.$primevue.config.locale.reject:null},acceptIcon:function(){return this.confirmation?this.confirmation.acceptIcon:null},rejectIcon:function(){return this.confirmation?this.confirmation.rejectIcon:null}},components:{CPButton:t,Portal:o},directives:{focustrap:n}},$=["aria-modal"];z.render=function(t,e,n,i,o,c){var s=u("CPButton"),r=u("Portal"),a=f("focustrap");return p(),m(r,null,{default:d((function(){return[h(v,L({name:"p-confirm-popup",onEnter:c.onEnter,onAfterEnter:c.onAfterEnter,onLeave:c.onLeave,onAfterLeave:c.onAfterLeave},t.ptm("transition")),{default:d((function(){return[o.visible?b((p(),y("div",L({key:0,ref:c.containerRef,role:"alertdialog",class:t.cx("root"),"aria-modal":o.visible,onClick:e[2]||(e[2]=function(){return c.onOverlayClick&&c.onOverlayClick.apply(c,arguments)}),onKeydown:e[3]||(e[3]=function(){return c.onOverlayKeydown&&c.onOverlayKeydown.apply(c,arguments)})},t.ptmi("root")),[t.$slots.container?g(t.$slots,"container",{key:0,message:o.confirmation,onAccept:c.accept,onReject:c.reject,acceptCallback:c.accept,rejectCallback:c.reject}):(p(),y(k,{key:1},[t.$slots.message?(p(),m(j(t.$slots.message),{key:1,message:o.confirmation},null,8,["message"])):(p(),y("div",L({key:0,class:t.cx("content")},t.ptm("content")),[g(t.$slots,"icon",{},(function(){return[t.$slots.icon?(p(),m(j(t.$slots.icon),{key:0,class:C(t.cx("icon"))},null,8,["class"])):o.confirmation.icon?(p(),y("span",L({key:1,class:[o.confirmation.icon,t.cx("icon")]},t.ptm("icon")),null,16)):w("",!0)]})),E("span",L({class:t.cx("message")},t.ptm("message")),A(o.confirmation.message),17)],16)),E("div",L({class:t.cx("footer")},t.ptm("footer")),[h(s,{label:c.rejectLabel,onClick:e[0]||(e[0]=function(t){return c.reject()}),onKeydown:c.onRejectKeydown,autofocus:o.autoFocusReject,class:C([t.cx("rejectButton"),o.confirmation.rejectClass]),unstyled:t.unstyled,pt:t.ptm("rejectButton")},O({_:2},[c.rejectIcon||t.$slots.rejecticon?{name:"icon",fn:d((function(e){return[g(t.$slots,"rejecticon",{},(function(){return[E("span",L({class:[c.rejectIcon,e.class]},t.ptm("rejectButton").icon,{"data-pc-section":"rejectbuttonicon"}),null,16)]}))]})),key:"0"}:void 0]),1032,["label","onKeydown","autofocus","class","unstyled","pt"]),h(s,{label:c.acceptLabel,onClick:e[1]||(e[1]=function(t){return c.accept()}),onKeydown:c.onAcceptKeydown,autofocus:o.autoFocusAccept,class:C([t.cx("acceptButton"),o.confirmation.acceptClass]),unstyled:t.unstyled,pt:t.ptm("acceptButton")},O({_:2},[c.acceptIcon||t.$slots.accepticon?{name:"icon",fn:d((function(e){return[g(t.$slots,"accepticon",{},(function(){return[E("span",L({class:[c.acceptIcon,e.class]},t.ptm("acceptButton").icon,{"data-pc-section":"acceptbuttonicon"}),null,16)]}))]})),key:"0"}:void 0]),1032,["label","onKeydown","autofocus","class","unstyled","pt"])],16)],64))],16,$)),[[a]]):w("",!0)]})),_:3},16,["onEnter","onAfterEnter","onLeave","onAfterLeave"])]})),_:3})};export{z as default};
@@ -35,7 +35,8 @@ this.primevue.confirmpopup = (function (Button, ConfirmationEventBus, FocusTrap,
35
35
  visible: false,
36
36
  confirmation: null,
37
37
  autoFocusAccept: null,
38
- autoFocusReject: null
38
+ autoFocusReject: null,
39
+ target: null
39
40
  };
40
41
  },
41
42
  target: null,
@@ -119,6 +120,7 @@ this.primevue.confirmpopup = (function (Button, ConfirmationEventBus, FocusTrap,
119
120
  onEnter: function onEnter(el) {
120
121
  this.autoFocusAccept = this.confirmation.defaultFocus === undefined || this.confirmation.defaultFocus === 'accept' ? true : false;
121
122
  this.autoFocusReject = this.confirmation.defaultFocus === 'reject' ? true : false;
123
+ this.target = document.activeElement;
122
124
  this.bindOutsideClickListener();
123
125
  this.bindScrollListener();
124
126
  this.bindResizeListener();
@@ -130,6 +132,8 @@ this.primevue.confirmpopup = (function (Button, ConfirmationEventBus, FocusTrap,
130
132
  onLeave: function onLeave() {
131
133
  this.autoFocusAccept = null;
132
134
  this.autoFocusReject = null;
135
+ utils.DomHandler.focus(this.target);
136
+ this.target = null;
133
137
  this.unbindOutsideClickListener();
134
138
  this.unbindScrollListener();
135
139
  this.unbindResizeListener();
@@ -1 +1 @@
1
- this.primevue=this.primevue||{},this.primevue.confirmpopup=function(e,t,n,i,o,c,r,s,l){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(e),f=a(t),d=a(n),p=a(i),m=a(o),h={name:"ConfirmPopup",extends:{name:"BaseConfirmPopup",extends:a(r).default,props:{group:String},style:a(s).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,data:function(){return{visible:!1,confirmation:null,autoFocusAccept:null,autoFocusReject:null}},target:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,container:null,confirmListener:null,closeListener:null,mounted:function(){var e=this;this.confirmListener=function(t){t&&t.group===e.group&&(e.confirmation=t,e.target=t.target,e.confirmation.onShow&&e.confirmation.onShow(),e.visible=!0)},this.closeListener=function(){e.visible=!1,e.confirmation=null},f.default.on("confirm",this.confirmListener),f.default.on("close",this.closeListener)},beforeUnmount:function(){f.default.off("confirm",this.confirmListener),f.default.off("close",this.closeListener),this.unbindOutsideClickListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.unbindResizeListener(),this.container&&(c.ZIndexUtils.clear(this.container),this.container=null),this.target=null,this.confirmation=null},methods:{accept:function(){this.confirmation.accept&&this.confirmation.accept(),this.visible=!1},reject:function(){this.confirmation.reject&&this.confirmation.reject(),this.visible=!1},onHide:function(){this.confirmation.onHide&&this.confirmation.onHide(),this.visible=!1},onAcceptKeydown:function(e){"Space"!==e.code&&"Enter"!==e.code&&"NumpadEnter"!==e.code||(this.accept(),c.DomHandler.focus(this.target),e.preventDefault())},onRejectKeydown:function(e){"Space"!==e.code&&"Enter"!==e.code&&"NumpadEnter"!==e.code||(this.reject(),c.DomHandler.focus(this.target),e.preventDefault())},onEnter:function(e){this.autoFocusAccept=void 0===this.confirmation.defaultFocus||"accept"===this.confirmation.defaultFocus,this.autoFocusReject="reject"===this.confirmation.defaultFocus,this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),c.ZIndexUtils.set("overlay",e,this.$primevue.config.zIndex.overlay)},onAfterEnter:function(){this.focus()},onLeave:function(){this.autoFocusAccept=null,this.autoFocusReject=null,this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener()},onAfterLeave:function(e){c.ZIndexUtils.clear(e)},alignOverlay:function(){c.DomHandler.absolutePosition(this.container,this.target,!1);var e=c.DomHandler.getOffset(this.container),t=c.DomHandler.getOffset(this.target),n=0;e.left<t.left&&(n=t.left-e.left),this.container.style.setProperty("--overlayArrowLeft","".concat(n,"px")),e.top<t.top&&(this.container.setAttribute("data-p-confirm-popup-flipped","true"),!this.isUnstyled&&c.DomHandler.addClass(this.container,"p-confirm-popup-flipped"))},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){e.visible&&e.container&&!e.container.contains(t.target)&&!e.isTargetClicked(t)?(e.confirmation.onHide&&e.confirmation.onHide(),e.visible=!1):e.alignOverlay()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener:function(){var e=this;this.scrollHandler||(this.scrollHandler=new c.ConnectedOverlayScrollHandler(this.target,(function(){e.visible&&(e.visible=!1)}))),this.scrollHandler.bindScrollListener()},unbindScrollListener:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.visible&&!c.DomHandler.isTouchDevice()&&(e.visible=!1)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},focus:function(){var e=this.container.querySelector("[autofocus]");e&&e.focus({preventScroll:!0})},isTargetClicked:function(e){return this.target&&(this.target===e.target||this.target.contains(e.target))},containerRef:function(e){this.container=e},onOverlayClick:function(e){p.default.emit("overlay-click",{originalEvent:e,target:this.target})},onOverlayKeydown:function(e){"Escape"===e.code&&(f.default.emit("close",this.closeListener),c.DomHandler.focus(this.target))},getCXOptions:function(e,t){return{contenxt:{icon:e,iconClass:t.class}}}},computed:{message:function(){return this.confirmation?this.confirmation.message:null},acceptLabel:function(){return this.confirmation?this.confirmation.acceptLabel||this.$primevue.config.locale.accept:null},rejectLabel:function(){return this.confirmation?this.confirmation.rejectLabel||this.$primevue.config.locale.reject:null},acceptIcon:function(){return this.confirmation?this.confirmation.acceptIcon:null},rejectIcon:function(){return this.confirmation?this.confirmation.rejectIcon:null}},components:{CPButton:u.default,Portal:m.default},directives:{focustrap:d.default}},v=["aria-modal"];return h.render=function(e,t,n,i,o,c){var r=l.resolveComponent("CPButton"),s=l.resolveComponent("Portal"),a=l.resolveDirective("focustrap");return l.openBlock(),l.createBlock(s,null,{default:l.withCtx((function(){return[l.createVNode(l.Transition,l.mergeProps({name:"p-confirm-popup",onEnter:c.onEnter,onAfterEnter:c.onAfterEnter,onLeave:c.onLeave,onAfterLeave:c.onAfterLeave},e.ptm("transition")),{default:l.withCtx((function(){return[o.visible?l.withDirectives((l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,ref:c.containerRef,role:"alertdialog",class:e.cx("root"),"aria-modal":o.visible,onClick:t[2]||(t[2]=function(){return c.onOverlayClick&&c.onOverlayClick.apply(c,arguments)}),onKeydown:t[3]||(t[3]=function(){return c.onOverlayKeydown&&c.onOverlayKeydown.apply(c,arguments)})},e.ptmi("root")),[e.$slots.container?l.renderSlot(e.$slots,"container",{key:0,message:o.confirmation,onAccept:c.accept,onReject:c.reject,acceptCallback:c.accept,rejectCallback:c.reject}):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[e.$slots.message?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.$slots.message),{key:1,message:o.confirmation},null,8,["message"])):(l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,class:e.cx("content")},e.ptm("content")),[l.renderSlot(e.$slots,"icon",{},(function(){return[e.$slots.icon?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.$slots.icon),{key:0,class:l.normalizeClass(e.cx("icon"))},null,8,["class"])):o.confirmation.icon?(l.openBlock(),l.createElementBlock("span",l.mergeProps({key:1,class:[o.confirmation.icon,e.cx("icon")]},e.ptm("icon")),null,16)):l.createCommentVNode("",!0)]})),l.createElementVNode("span",l.mergeProps({class:e.cx("message")},e.ptm("message")),l.toDisplayString(o.confirmation.message),17)],16)),l.createElementVNode("div",l.mergeProps({class:e.cx("footer")},e.ptm("footer")),[l.createVNode(r,{label:c.rejectLabel,onClick:t[0]||(t[0]=function(e){return c.reject()}),onKeydown:c.onRejectKeydown,autofocus:o.autoFocusReject,class:l.normalizeClass([e.cx("rejectButton"),o.confirmation.rejectClass]),unstyled:e.unstyled,pt:e.ptm("rejectButton")},l.createSlots({_:2},[c.rejectIcon||e.$slots.rejecticon?{name:"icon",fn:l.withCtx((function(t){return[l.renderSlot(e.$slots,"rejecticon",{},(function(){return[l.createElementVNode("span",l.mergeProps({class:[c.rejectIcon,t.class]},e.ptm("rejectButton").icon,{"data-pc-section":"rejectbuttonicon"}),null,16)]}))]})),key:"0"}:void 0]),1032,["label","onKeydown","autofocus","class","unstyled","pt"]),l.createVNode(r,{label:c.acceptLabel,onClick:t[1]||(t[1]=function(e){return c.accept()}),onKeydown:c.onAcceptKeydown,autofocus:o.autoFocusAccept,class:l.normalizeClass([e.cx("acceptButton"),o.confirmation.acceptClass]),unstyled:e.unstyled,pt:e.ptm("acceptButton")},l.createSlots({_:2},[c.acceptIcon||e.$slots.accepticon?{name:"icon",fn:l.withCtx((function(t){return[l.renderSlot(e.$slots,"accepticon",{},(function(){return[l.createElementVNode("span",l.mergeProps({class:[c.acceptIcon,t.class]},e.ptm("acceptButton").icon,{"data-pc-section":"acceptbuttonicon"}),null,16)]}))]})),key:"0"}:void 0]),1032,["label","onKeydown","autofocus","class","unstyled","pt"])],16)],64))],16,v)),[[a]]):l.createCommentVNode("",!0)]})),_:3},16,["onEnter","onAfterEnter","onLeave","onAfterLeave"])]})),_:3})},h}(primevue.button,primevue.confirmationeventbus,primevue.focustrap,primevue.overlayeventbus,primevue.portal,primevue.utils,primevue.basecomponent,primevue.confirmpopup.style,Vue);
1
+ this.primevue=this.primevue||{},this.primevue.confirmpopup=function(e,t,n,i,o,c,r,s,l){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(e),f=a(t),d=a(n),m=a(i),p=a(o),h={name:"ConfirmPopup",extends:{name:"BaseConfirmPopup",extends:a(r).default,props:{group:String},style:a(s).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,data:function(){return{visible:!1,confirmation:null,autoFocusAccept:null,autoFocusReject:null,target:null}},target:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,container:null,confirmListener:null,closeListener:null,mounted:function(){var e=this;this.confirmListener=function(t){t&&t.group===e.group&&(e.confirmation=t,e.target=t.target,e.confirmation.onShow&&e.confirmation.onShow(),e.visible=!0)},this.closeListener=function(){e.visible=!1,e.confirmation=null},f.default.on("confirm",this.confirmListener),f.default.on("close",this.closeListener)},beforeUnmount:function(){f.default.off("confirm",this.confirmListener),f.default.off("close",this.closeListener),this.unbindOutsideClickListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.unbindResizeListener(),this.container&&(c.ZIndexUtils.clear(this.container),this.container=null),this.target=null,this.confirmation=null},methods:{accept:function(){this.confirmation.accept&&this.confirmation.accept(),this.visible=!1},reject:function(){this.confirmation.reject&&this.confirmation.reject(),this.visible=!1},onHide:function(){this.confirmation.onHide&&this.confirmation.onHide(),this.visible=!1},onAcceptKeydown:function(e){"Space"!==e.code&&"Enter"!==e.code&&"NumpadEnter"!==e.code||(this.accept(),c.DomHandler.focus(this.target),e.preventDefault())},onRejectKeydown:function(e){"Space"!==e.code&&"Enter"!==e.code&&"NumpadEnter"!==e.code||(this.reject(),c.DomHandler.focus(this.target),e.preventDefault())},onEnter:function(e){this.autoFocusAccept=void 0===this.confirmation.defaultFocus||"accept"===this.confirmation.defaultFocus,this.autoFocusReject="reject"===this.confirmation.defaultFocus,this.target=document.activeElement,this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),c.ZIndexUtils.set("overlay",e,this.$primevue.config.zIndex.overlay)},onAfterEnter:function(){this.focus()},onLeave:function(){this.autoFocusAccept=null,this.autoFocusReject=null,c.DomHandler.focus(this.target),this.target=null,this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener()},onAfterLeave:function(e){c.ZIndexUtils.clear(e)},alignOverlay:function(){c.DomHandler.absolutePosition(this.container,this.target,!1);var e=c.DomHandler.getOffset(this.container),t=c.DomHandler.getOffset(this.target),n=0;e.left<t.left&&(n=t.left-e.left),this.container.style.setProperty("--overlayArrowLeft","".concat(n,"px")),e.top<t.top&&(this.container.setAttribute("data-p-confirm-popup-flipped","true"),!this.isUnstyled&&c.DomHandler.addClass(this.container,"p-confirm-popup-flipped"))},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){e.visible&&e.container&&!e.container.contains(t.target)&&!e.isTargetClicked(t)?(e.confirmation.onHide&&e.confirmation.onHide(),e.visible=!1):e.alignOverlay()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener:function(){var e=this;this.scrollHandler||(this.scrollHandler=new c.ConnectedOverlayScrollHandler(this.target,(function(){e.visible&&(e.visible=!1)}))),this.scrollHandler.bindScrollListener()},unbindScrollListener:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.visible&&!c.DomHandler.isTouchDevice()&&(e.visible=!1)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},focus:function(){var e=this.container.querySelector("[autofocus]");e&&e.focus({preventScroll:!0})},isTargetClicked:function(e){return this.target&&(this.target===e.target||this.target.contains(e.target))},containerRef:function(e){this.container=e},onOverlayClick:function(e){m.default.emit("overlay-click",{originalEvent:e,target:this.target})},onOverlayKeydown:function(e){"Escape"===e.code&&(f.default.emit("close",this.closeListener),c.DomHandler.focus(this.target))},getCXOptions:function(e,t){return{contenxt:{icon:e,iconClass:t.class}}}},computed:{message:function(){return this.confirmation?this.confirmation.message:null},acceptLabel:function(){return this.confirmation?this.confirmation.acceptLabel||this.$primevue.config.locale.accept:null},rejectLabel:function(){return this.confirmation?this.confirmation.rejectLabel||this.$primevue.config.locale.reject:null},acceptIcon:function(){return this.confirmation?this.confirmation.acceptIcon:null},rejectIcon:function(){return this.confirmation?this.confirmation.rejectIcon:null}},components:{CPButton:u.default,Portal:p.default},directives:{focustrap:d.default}},v=["aria-modal"];return h.render=function(e,t,n,i,o,c){var r=l.resolveComponent("CPButton"),s=l.resolveComponent("Portal"),a=l.resolveDirective("focustrap");return l.openBlock(),l.createBlock(s,null,{default:l.withCtx((function(){return[l.createVNode(l.Transition,l.mergeProps({name:"p-confirm-popup",onEnter:c.onEnter,onAfterEnter:c.onAfterEnter,onLeave:c.onLeave,onAfterLeave:c.onAfterLeave},e.ptm("transition")),{default:l.withCtx((function(){return[o.visible?l.withDirectives((l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,ref:c.containerRef,role:"alertdialog",class:e.cx("root"),"aria-modal":o.visible,onClick:t[2]||(t[2]=function(){return c.onOverlayClick&&c.onOverlayClick.apply(c,arguments)}),onKeydown:t[3]||(t[3]=function(){return c.onOverlayKeydown&&c.onOverlayKeydown.apply(c,arguments)})},e.ptmi("root")),[e.$slots.container?l.renderSlot(e.$slots,"container",{key:0,message:o.confirmation,onAccept:c.accept,onReject:c.reject,acceptCallback:c.accept,rejectCallback:c.reject}):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[e.$slots.message?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.$slots.message),{key:1,message:o.confirmation},null,8,["message"])):(l.openBlock(),l.createElementBlock("div",l.mergeProps({key:0,class:e.cx("content")},e.ptm("content")),[l.renderSlot(e.$slots,"icon",{},(function(){return[e.$slots.icon?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.$slots.icon),{key:0,class:l.normalizeClass(e.cx("icon"))},null,8,["class"])):o.confirmation.icon?(l.openBlock(),l.createElementBlock("span",l.mergeProps({key:1,class:[o.confirmation.icon,e.cx("icon")]},e.ptm("icon")),null,16)):l.createCommentVNode("",!0)]})),l.createElementVNode("span",l.mergeProps({class:e.cx("message")},e.ptm("message")),l.toDisplayString(o.confirmation.message),17)],16)),l.createElementVNode("div",l.mergeProps({class:e.cx("footer")},e.ptm("footer")),[l.createVNode(r,{label:c.rejectLabel,onClick:t[0]||(t[0]=function(e){return c.reject()}),onKeydown:c.onRejectKeydown,autofocus:o.autoFocusReject,class:l.normalizeClass([e.cx("rejectButton"),o.confirmation.rejectClass]),unstyled:e.unstyled,pt:e.ptm("rejectButton")},l.createSlots({_:2},[c.rejectIcon||e.$slots.rejecticon?{name:"icon",fn:l.withCtx((function(t){return[l.renderSlot(e.$slots,"rejecticon",{},(function(){return[l.createElementVNode("span",l.mergeProps({class:[c.rejectIcon,t.class]},e.ptm("rejectButton").icon,{"data-pc-section":"rejectbuttonicon"}),null,16)]}))]})),key:"0"}:void 0]),1032,["label","onKeydown","autofocus","class","unstyled","pt"]),l.createVNode(r,{label:c.acceptLabel,onClick:t[1]||(t[1]=function(e){return c.accept()}),onKeydown:c.onAcceptKeydown,autofocus:o.autoFocusAccept,class:l.normalizeClass([e.cx("acceptButton"),o.confirmation.acceptClass]),unstyled:e.unstyled,pt:e.ptm("acceptButton")},l.createSlots({_:2},[c.acceptIcon||e.$slots.accepticon?{name:"icon",fn:l.withCtx((function(t){return[l.renderSlot(e.$slots,"accepticon",{},(function(){return[l.createElementVNode("span",l.mergeProps({class:[c.acceptIcon,t.class]},e.ptm("acceptButton").icon,{"data-pc-section":"acceptbuttonicon"}),null,16)]}))]})),key:"0"}:void 0]),1032,["label","onKeydown","autofocus","class","unstyled","pt"])],16)],64))],16,v)),[[a]]):l.createCommentVNode("",!0)]})),_:3},16,["onEnter","onAfterEnter","onLeave","onAfterLeave"])]})),_:3})},h}(primevue.button,primevue.confirmationeventbus,primevue.focustrap,primevue.overlayeventbus,primevue.portal,primevue.utils,primevue.basecomponent,primevue.confirmpopup.style,Vue);
@@ -44,7 +44,7 @@ export default {
44
44
  name: 'ContextMenu',
45
45
  extends: BaseContextMenu,
46
46
  inheritAttrs: false,
47
- emits: ['focus', 'blur', 'show', 'hide'],
47
+ emits: ['focus', 'blur', 'show', 'hide', 'before-hide', 'before-show'],
48
48
  target: null,
49
49
  outsideClickListener: null,
50
50
  resizeListener: null,
@@ -125,6 +125,7 @@ export default {
125
125
  this.visible ? this.hide() : this.show(event);
126
126
  },
127
127
  show(event) {
128
+ this.$emit('before-show');
128
129
  this.activeItemPath = [];
129
130
  this.focusedItemInfo = { index: -1, level: 0, parentKey: '' };
130
131
  DomHandler.focus(this.list);
@@ -137,6 +138,7 @@ export default {
137
138
  event.preventDefault();
138
139
  },
139
140
  hide() {
141
+ this.$emit('before-hide');
140
142
  this.visible = false;
141
143
  this.activeItemPath = [];
142
144
  this.focusedItemInfo = { index: -1, level: 0, parentKey: '' };
@@ -341,7 +341,7 @@ var script = {
341
341
  name: 'ContextMenu',
342
342
  "extends": script$2,
343
343
  inheritAttrs: false,
344
- emits: ['focus', 'blur', 'show', 'hide'],
344
+ emits: ['focus', 'blur', 'show', 'hide', 'before-hide', 'before-show'],
345
345
  target: null,
346
346
  outsideClickListener: null,
347
347
  resizeListener: null,
@@ -423,6 +423,7 @@ var script = {
423
423
  this.visible ? this.hide() : this.show(event);
424
424
  },
425
425
  show: function show(event) {
426
+ this.$emit('before-show');
426
427
  this.activeItemPath = [];
427
428
  this.focusedItemInfo = {
428
429
  index: -1,
@@ -437,6 +438,7 @@ var script = {
437
438
  event.preventDefault();
438
439
  },
439
440
  hide: function hide() {
441
+ this.$emit('before-hide');
440
442
  this.visible = false;
441
443
  this.activeItemPath = [];
442
444
  this.focusedItemInfo = {
@@ -1 +1 @@
1
- "use strict";var e=require("primevue/portal"),t=require("primevue/utils"),i=require("primevue/basecomponent"),n=require("primevue/contextmenu/style"),s=require("primevue/icons/angleright"),o=require("primevue/ripple"),r=require("vue");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(e),u=a(i),l={name:"BaseContextMenu",extends:u.default,props:{model:{type:Array,default:null},appendTo:{type:[String,Object],default:"body"},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},global:{type:Boolean,default:!1},tabindex:{type:Number,default:0},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null}},style:a(n).default,provide:function(){return{$parentInstance:this}}},m={name:"ContextMenuSub",hostName:"ContextMenu",extends:u.default,emits:["item-click","item-mouseenter","item-mousemove"],props:{items:{type:Array,default:null},menuId:{type:String,default:null},focusedItemId:{type:String,default:null},root:{type:Boolean,default:!1},visible:{type:Boolean,default:!1},level:{type:Number,default:0},templates:{type:Object,default:null},activeItemPath:{type:Object,default:null},tabindex:{type:Number,default:0}},methods:{getItemId:function(e){return"".concat(this.menuId,"_").concat(e.key)},getItemKey:function(e){return this.getItemId(e)},getItemProp:function(e,i,n){return e&&e.item?t.ObjectUtils.getItemValue(e.item[i],n):void 0},getItemLabel:function(e){return this.getItemProp(e,"label")},getItemLabelId:function(e){return"".concat(this.menuId,"_").concat(e.key,"_label")},getPTOptions:function(e,t,i){return this.ptm(e,{context:{item:t,active:this.isItemActive(t),focused:this.isItemFocused(t),disabled:this.isItemDisabled(t),index:i}})},isItemActive:function(e){return this.activeItemPath.some((function(t){return t.key===e.key}))},isItemVisible:function(e){return!1!==this.getItemProp(e,"visible")},isItemDisabled:function(e){return this.getItemProp(e,"disabled")},isItemFocused:function(e){return this.focusedItemId===this.getItemId(e)},isItemGroup:function(e){return t.ObjectUtils.isNotEmpty(e.items)},onItemClick:function(e,t){this.getItemProp(t,"command",{originalEvent:e,item:t.item}),this.$emit("item-click",{originalEvent:e,processedItem:t,isFocus:!0})},onItemMouseEnter:function(e,t){this.$emit("item-mouseenter",{originalEvent:e,processedItem:t})},onItemMouseMove:function(e,t){this.$emit("item-mousemove",{originalEvent:e,processedItem:t,isFocus:!0})},getAriaSetSize:function(){var e=this;return this.items.filter((function(t){return e.isItemVisible(t)&&!e.getItemProp(t,"separator")})).length},getAriaPosInset:function(e){var t=this;return e-this.items.slice(0,e).filter((function(e){return t.isItemVisible(e)&&t.getItemProp(e,"separator")})).length+1},onEnter:function(){t.DomHandler.nestedPosition(this.$refs.container,this.level)},getMenuItemProps:function(e,t){return{action:r.mergeProps({class:this.cx("action"),tabindex:-1,"aria-hidden":!0},this.getPTOptions("action",e,t)),icon:r.mergeProps({class:[this.cx("icon"),this.getItemProp(e,"icon")]},this.getPTOptions("icon",e,t)),label:r.mergeProps({class:this.cx("label")},this.getPTOptions("label",e,t)),submenuicon:r.mergeProps({class:this.cx("submenuIcon")},this.getPTOptions("submenuicon",e,t))}}},components:{AngleRightIcon:a(s).default},directives:{ripple:a(o).default}},d=["tabindex"],h=["id","aria-label","aria-disabled","aria-expanded","aria-haspopup","aria-level","aria-setsize","aria-posinset","data-p-highlight","data-p-focused","data-p-disabled"],I=["onClick","onMouseenter","onMousemove"],f=["href","target"],p=["id"],v=["id"];m.render=function(e,t,i,n,s,o){var a=r.resolveComponent("AngleRightIcon"),c=r.resolveComponent("ContextMenuSub",!0),u=r.resolveDirective("ripple");return r.openBlock(),r.createBlock(r.Transition,r.mergeProps({name:"p-contextmenusub",onEnter:o.onEnter},e.ptm("menu.transition")),{default:r.withCtx((function(){return[i.root||i.visible?(r.openBlock(),r.createElementBlock("ul",r.mergeProps({key:0,ref:"container",tabindex:i.tabindex},e.ptm("menu")),[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(i.items,(function(n,s){return r.openBlock(),r.createElementBlock(r.Fragment,{key:o.getItemKey(n)},[o.isItemVisible(n)&&!o.getItemProp(n,"separator")?(r.openBlock(),r.createElementBlock("li",r.mergeProps({key:0,id:o.getItemId(n),style:o.getItemProp(n,"style"),class:[e.cx("menuitem",{processedItem:n}),o.getItemProp(n,"class")],role:"menuitem","aria-label":o.getItemLabel(n),"aria-disabled":o.isItemDisabled(n)||void 0,"aria-expanded":o.isItemGroup(n)?o.isItemActive(n):void 0,"aria-haspopup":o.isItemGroup(n)&&!o.getItemProp(n,"to")?"menu":void 0,"aria-level":i.level+1,"aria-setsize":o.getAriaSetSize(),"aria-posinset":o.getAriaPosInset(s)},o.getPTOptions("menuitem",n,s),{"data-p-highlight":o.isItemActive(n),"data-p-focused":o.isItemFocused(n),"data-p-disabled":o.isItemDisabled(n)}),[r.createElementVNode("div",r.mergeProps({class:e.cx("content"),onClick:function(e){return o.onItemClick(e,n)},onMouseenter:function(e){return o.onItemMouseEnter(e,n)},onMousemove:function(e){return o.onItemMouseMove(e,n)}},o.getPTOptions("content",n,s)),[i.templates.item?(r.openBlock(),r.createBlock(r.resolveDynamicComponent(i.templates.item),{key:1,item:n.item,hasSubmenu:o.getItemProp(n,"items"),label:o.getItemLabel(n),props:o.getMenuItemProps(n,s)},null,8,["item","hasSubmenu","label","props"])):r.withDirectives((r.openBlock(),r.createElementBlock("a",r.mergeProps({key:0,href:o.getItemProp(n,"url"),class:e.cx("action"),target:o.getItemProp(n,"target"),tabindex:"-1","aria-hidden":"true"},o.getPTOptions("action",n,s)),[i.templates.itemicon?(r.openBlock(),r.createBlock(r.resolveDynamicComponent(i.templates.itemicon),{key:0,item:n.item,class:r.normalizeClass(e.cx("icon"))},null,8,["item","class"])):o.getItemProp(n,"icon")?(r.openBlock(),r.createElementBlock("span",r.mergeProps({key:1,class:[e.cx("icon"),o.getItemProp(n,"icon")]},o.getPTOptions("icon",n,s)),null,16)):r.createCommentVNode("",!0),r.createElementVNode("span",r.mergeProps({id:o.getItemLabelId(n),class:e.cx("label")},o.getPTOptions("label",n,s)),r.toDisplayString(o.getItemLabel(n)),17,p),o.getItemProp(n,"items")?(r.openBlock(),r.createElementBlock(r.Fragment,{key:2},[i.templates.submenuicon?(r.openBlock(),r.createBlock(r.resolveDynamicComponent(i.templates.submenuicon),{key:0,active:o.isItemActive(n),class:r.normalizeClass(e.cx("submenuIcon"))},null,8,["active","class"])):(r.openBlock(),r.createBlock(a,r.mergeProps({key:1,class:e.cx("submenuIcon")},o.getPTOptions("submenuicon",n,s)),null,16,["class"]))],64)):r.createCommentVNode("",!0)],16,f)),[[u]])],16,I),o.isItemVisible(n)&&o.isItemGroup(n)?(r.openBlock(),r.createBlock(c,r.mergeProps({key:0,id:o.getItemId(n)+"_list",role:"menu",class:e.cx("submenu"),menuId:i.menuId,focusedItemId:i.focusedItemId,items:n.items,templates:i.templates,activeItemPath:i.activeItemPath,level:i.level+1,visible:o.isItemActive(n)&&o.isItemGroup(n),pt:e.pt,unstyled:e.unstyled,onItemClick:t[0]||(t[0]=function(t){return e.$emit("item-click",t)}),onItemMouseenter:t[1]||(t[1]=function(t){return e.$emit("item-mouseenter",t)}),onItemMousemove:t[2]||(t[2]=function(t){return e.$emit("item-mousemove",t)}),"aria-labelledby":o.getItemLabelId(n)},e.ptm("submenu")),null,16,["id","class","menuId","focusedItemId","items","templates","activeItemPath","level","visible","pt","unstyled","aria-labelledby"])):r.createCommentVNode("",!0)],16,h)):r.createCommentVNode("",!0),o.isItemVisible(n)&&o.getItemProp(n,"separator")?(r.openBlock(),r.createElementBlock("li",r.mergeProps({key:1,id:o.getItemId(n),style:o.getItemProp(n,"style"),class:[e.cx("separator"),o.getItemProp(n,"class")],role:"separator"},e.ptm("separator")),null,16,v)):r.createCommentVNode("",!0)],64)})),128))],16,d)):r.createCommentVNode("",!0)]})),_:1},16,["onEnter"])};var b={name:"ContextMenu",extends:l,inheritAttrs:!1,emits:["focus","blur","show","hide"],target:null,outsideClickListener:null,resizeListener:null,documentContextMenuListener:null,pageX:null,pageY:null,container:null,list:null,data:function(){return{id:this.$attrs.id,focused:!1,focusedItemInfo:{index:-1,level:0,parentKey:""},activeItemPath:[],visible:!1,submenuVisible:!1}},watch:{"$attrs.id":function(e){this.id=e||t.UniqueComponentId()},activeItemPath:function(e){t.ObjectUtils.isNotEmpty(e)?(this.bindOutsideClickListener(),this.bindResizeListener()):this.visible||(this.unbindOutsideClickListener(),this.unbindResizeListener())}},mounted:function(){this.id=this.id||t.UniqueComponentId(),this.global&&this.bindDocumentContextMenuListener()},beforeUnmount:function(){this.unbindResizeListener(),this.unbindOutsideClickListener(),this.unbindDocumentContextMenuListener(),this.container&&this.autoZIndex&&t.ZIndexUtils.clear(this.container),this.target=null,this.container=null},methods:{getItemProp:function(e,i){return e?t.ObjectUtils.getItemValue(e[i]):void 0},getItemLabel:function(e){return this.getItemProp(e,"label")},isItemDisabled:function(e){return this.getItemProp(e,"disabled")},isItemVisible:function(e){return!1!==this.getItemProp(e,"visible")},isItemGroup:function(e){return t.ObjectUtils.isNotEmpty(this.getItemProp(e,"items"))},isItemSeparator:function(e){return this.getItemProp(e,"separator")},getProccessedItemLabel:function(e){return e?this.getItemLabel(e.item):void 0},isProccessedItemGroup:function(e){return e&&t.ObjectUtils.isNotEmpty(e.items)},toggle:function(e){this.visible?this.hide():this.show(e)},show:function(e){this.activeItemPath=[],this.focusedItemInfo={index:-1,level:0,parentKey:""},t.DomHandler.focus(this.list),this.pageX=e.pageX,this.pageY=e.pageY,this.visible?this.position():this.visible=!0,e.stopPropagation(),e.preventDefault()},hide:function(){this.visible=!1,this.activeItemPath=[],this.focusedItemInfo={index:-1,level:0,parentKey:""}},onFocus:function(e){this.focused=!0,this.focusedItemInfo=-1!==this.focusedItemInfo.index?this.focusedItemInfo:{index:-1,level:0,parentKey:""},this.$emit("focus",e)},onBlur:function(e){this.focused=!1,this.focusedItemInfo={index:-1,level:0,parentKey:""},this.searchValue="",this.$emit("blur",e)},onKeyDown:function(e){var i=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":this.onArrowLeftKey(e);break;case"ArrowRight":this.onArrowRightKey(e);break;case"Home":this.onHomeKey(e);break;case"End":this.onEndKey(e);break;case"Space":this.onSpaceKey(e);break;case"Enter":case"NumpadEnter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"PageDown":case"PageUp":case"Backspace":case"ShiftLeft":case"ShiftRight":break;default:!i&&t.ObjectUtils.isPrintableCharacter(e.key)&&this.searchItems(e,e.key)}},onItemChange:function(e){var i=e.processedItem,n=e.isFocus;if(!t.ObjectUtils.isEmpty(i)){var s=i.index,o=i.key,r=i.level,a=i.parentKey,c=t.ObjectUtils.isNotEmpty(i.items),u=this.activeItemPath.filter((function(e){return e.parentKey!==a&&e.parentKey!==o}));c&&(u.push(i),this.submenuVisible=!0),this.focusedItemInfo={index:s,level:r,parentKey:a},this.activeItemPath=u,n&&t.DomHandler.focus(this.list)}},onItemClick:function(e){var i=e.processedItem,n=this.isProccessedItemGroup(i);if(this.isSelected(i)){var s=i.index,o=i.key,r=i.level,a=i.parentKey;this.activeItemPath=this.activeItemPath.filter((function(e){return o!==e.key&&o.startsWith(e.key)})),this.focusedItemInfo={index:s,level:r,parentKey:a},t.DomHandler.focus(this.list)}else n?this.onItemChange(e):this.hide()},onItemMouseEnter:function(e){this.onItemChange(e)},onItemMouseMove:function(e){this.focused&&this.changeFocusedItemIndex(e,e.processedItem.index)},onArrowDownKey:function(e){var t=-1!==this.focusedItemInfo.index?this.findNextItemIndex(this.focusedItemInfo.index):this.findFirstFocusedItemIndex();this.changeFocusedItemIndex(e,t),e.preventDefault()},onArrowUpKey:function(e){if(e.altKey){if(-1!==this.focusedItemInfo.index){var t=this.visibleItems[this.focusedItemInfo.index];!this.isProccessedItemGroup(t)&&this.onItemChange({originalEvent:e,processedItem:t})}this.popup&&this.hide(),e.preventDefault()}else{var i=-1!==this.focusedItemInfo.index?this.findPrevItemIndex(this.focusedItemInfo.index):this.findLastFocusedItemIndex();this.changeFocusedItemIndex(e,i),e.preventDefault()}},onArrowLeftKey:function(e){var i=this,n=this.visibleItems[this.focusedItemInfo.index],s=this.activeItemPath.find((function(e){return e.key===n.parentKey}));t.ObjectUtils.isEmpty(n.parent)||(this.focusedItemInfo={index:-1,parentKey:s?s.parentKey:""},this.searchValue="",this.onArrowDownKey(e)),this.activeItemPath=this.activeItemPath.filter((function(e){return e.parentKey!==i.focusedItemInfo.parentKey})),e.preventDefault()},onArrowRightKey:function(e){var t=this.visibleItems[this.focusedItemInfo.index];this.isProccessedItemGroup(t)&&(this.onItemChange({originalEvent:e,processedItem:t}),this.focusedItemInfo={index:-1,parentKey:t.key},this.searchValue="",this.onArrowDownKey(e)),e.preventDefault()},onHomeKey:function(e){this.changeFocusedItemIndex(e,this.findFirstItemIndex()),e.preventDefault()},onEndKey:function(e){this.changeFocusedItemIndex(e,this.findLastItemIndex()),e.preventDefault()},onEnterKey:function(e){if(-1!==this.focusedItemInfo.index){var i=t.DomHandler.findSingle(this.list,'li[id="'.concat("".concat(this.focusedItemIdx),'"]')),n=i&&t.DomHandler.findSingle(i,'a[data-pc-section="action"]');n?n.click():i&&i.click(),!this.isProccessedItemGroup(this.visibleItems[this.focusedItemInfo.index])&&(this.focusedItemInfo.index=this.findFirstFocusedItemIndex())}e.preventDefault()},onSpaceKey:function(e){this.onEnterKey(e)},onEscapeKey:function(e){this.hide(),!this.popup&&(this.focusedItemInfo.index=this.findFirstFocusedItemIndex()),e.preventDefault()},onTabKey:function(e){if(-1!==this.focusedItemInfo.index){var t=this.visibleItems[this.focusedItemInfo.index];!this.isProccessedItemGroup(t)&&this.onItemChange({originalEvent:e,processedItem:t})}this.hide()},onEnter:function(e){t.DomHandler.addStyles(e,{position:"absolute"}),this.position(),this.autoZIndex&&t.ZIndexUtils.set("menu",e,this.baseZIndex+this.$primevue.config.zIndex.menu)},onAfterEnter:function(){this.bindOutsideClickListener(),this.bindResizeListener(),this.$emit("show"),t.DomHandler.focus(this.list)},onLeave:function(){this.$emit("hide"),this.container=null},onAfterLeave:function(e){this.autoZIndex&&t.ZIndexUtils.clear(e),this.unbindOutsideClickListener(),this.unbindResizeListener()},position:function(){var e=this.pageX+1,i=this.pageY+1,n=this.container.offsetParent?this.container.offsetWidth:t.DomHandler.getHiddenElementOuterWidth(this.container),s=this.container.offsetParent?this.container.offsetHeight:t.DomHandler.getHiddenElementOuterHeight(this.container),o=t.DomHandler.getViewport();e+n-document.body.scrollLeft>o.width&&(e-=n),i+s-document.body.scrollTop>o.height&&(i-=s),e<document.body.scrollLeft&&(e=document.body.scrollLeft),i<document.body.scrollTop&&(i=document.body.scrollTop),this.container.style.left=e+"px",this.container.style.top=i+"px"},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){var i=e.container&&!e.container.contains(t.target),n=!e.visible||!(e.target&&(e.target===t.target||e.target.contains(t.target)));i&&n&&e.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.visible&&!t.DomHandler.isTouchDevice()&&e.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},bindDocumentContextMenuListener:function(){var e=this;this.documentContextMenuListener||(this.documentContextMenuListener=function(t){2===t.button&&e.show(t)},document.addEventListener("contextmenu",this.documentContextMenuListener))},unbindDocumentContextMenuListener:function(){this.documentContextMenuListener&&(document.removeEventListener("contextmenu",this.documentContextMenuListener),this.documentContextMenuListener=null)},isItemMatched:function(e){var t;return this.isValidItem(e)&&(null===(t=this.getProccessedItemLabel(e))||void 0===t?void 0:t.toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase()))},isValidItem:function(e){return!!e&&!this.isItemDisabled(e.item)&&!this.isItemSeparator(e.item)&&this.isItemVisible(e.item)},isValidSelectedItem:function(e){return this.isValidItem(e)&&this.isSelected(e)},isSelected:function(e){return this.activeItemPath.some((function(t){return t.key===e.key}))},findFirstItemIndex:function(){var e=this;return this.visibleItems.findIndex((function(t){return e.isValidItem(t)}))},findLastItemIndex:function(){var e=this;return t.ObjectUtils.findLastIndex(this.visibleItems,(function(t){return e.isValidItem(t)}))},findNextItemIndex:function(e){var t=this,i=e<this.visibleItems.length-1?this.visibleItems.slice(e+1).findIndex((function(e){return t.isValidItem(e)})):-1;return i>-1?i+e+1:e},findPrevItemIndex:function(e){var i=this,n=e>0?t.ObjectUtils.findLastIndex(this.visibleItems.slice(0,e),(function(e){return i.isValidItem(e)})):-1;return n>-1?n:e},findSelectedItemIndex:function(){var e=this;return this.visibleItems.findIndex((function(t){return e.isValidSelectedItem(t)}))},findFirstFocusedItemIndex:function(){var e=this.findSelectedItemIndex();return e<0?this.findFirstItemIndex():e},findLastFocusedItemIndex:function(){var e=this.findSelectedItemIndex();return e<0?this.findLastItemIndex():e},searchItems:function(e,t){var i=this;this.searchValue=(this.searchValue||"")+t;var n=-1,s=!1;return-1!==(n=-1!==this.focusedItemInfo.index?-1===(n=this.visibleItems.slice(this.focusedItemInfo.index).findIndex((function(e){return i.isItemMatched(e)})))?this.visibleItems.slice(0,this.focusedItemInfo.index).findIndex((function(e){return i.isItemMatched(e)})):n+this.focusedItemInfo.index:this.visibleItems.findIndex((function(e){return i.isItemMatched(e)})))&&(s=!0),-1===n&&-1===this.focusedItemInfo.index&&(n=this.findFirstFocusedItemIndex()),-1!==n&&this.changeFocusedItemIndex(e,n),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((function(){i.searchValue="",i.searchTimeout=null}),500),s},changeFocusedItemIndex:function(e,t){this.focusedItemInfo.index!==t&&(this.focusedItemInfo.index=t,this.scrollInView())},scrollInView:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,i=-1!==e?"".concat(this.id,"_").concat(e):this.focusedItemIdx,n=t.DomHandler.findSingle(this.list,'li[id="'.concat(i,'"]'));n&&n.scrollIntoView&&n.scrollIntoView({block:"nearest",inline:"start"})},createProcessedItems:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=[];return e&&e.forEach((function(e,r){var a=(""!==s?s+"_":"")+r,c={item:e,index:r,level:i,key:a,parent:n,parentKey:s};c.items=t.createProcessedItems(e.items,i+1,c,a),o.push(c)})),o},containerRef:function(e){this.container=e},listRef:function(e){this.list=e?e.$el:void 0}},computed:{processedItems:function(){return this.createProcessedItems(this.model||[])},visibleItems:function(){var e=this,t=this.activeItemPath.find((function(t){return t.key===e.focusedItemInfo.parentKey}));return t?t.items:this.processedItems},focusedItemIdx:function(){return-1!==this.focusedItemInfo.index?"".concat(this.id).concat(t.ObjectUtils.isNotEmpty(this.focusedItemInfo.parentKey)?"_"+this.focusedItemInfo.parentKey:"","_").concat(this.focusedItemInfo.index):null}},components:{ContextMenuSub:m,Portal:c.default}};b.render=function(e,t,i,n,s,o){var a=r.resolveComponent("ContextMenuSub"),c=r.resolveComponent("Portal");return r.openBlock(),r.createBlock(c,{appendTo:e.appendTo},{default:r.withCtx((function(){return[r.createVNode(r.Transition,r.mergeProps({name:"p-contextmenu",onEnter:o.onEnter,onAfterEnter:o.onAfterEnter,onLeave:o.onLeave,onAfterLeave:o.onAfterLeave},e.ptm("transition")),{default:r.withCtx((function(){return[s.visible?(r.openBlock(),r.createElementBlock("div",r.mergeProps({key:0,ref:o.containerRef,class:e.cx("root")},e.ptmi("root")),[r.createVNode(a,{ref:o.listRef,id:s.id+"_list",class:r.normalizeClass(e.cx("menu")),role:"menubar",root:!0,tabindex:e.tabindex,"aria-orientation":"vertical","aria-activedescendant":s.focused?o.focusedItemIdx:void 0,menuId:s.id,focusedItemId:s.focused?o.focusedItemIdx:void 0,items:o.processedItems,templates:e.$slots,activeItemPath:s.activeItemPath,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,level:0,visible:s.submenuVisible,pt:e.pt,unstyled:e.unstyled,onFocus:o.onFocus,onBlur:o.onBlur,onKeydown:o.onKeyDown,onItemClick:o.onItemClick,onItemMouseenter:o.onItemMouseEnter,onItemMousemove:o.onItemMouseMove},null,8,["id","class","tabindex","aria-activedescendant","menuId","focusedItemId","items","templates","activeItemPath","aria-labelledby","aria-label","visible","pt","unstyled","onFocus","onBlur","onKeydown","onItemClick","onItemMouseenter","onItemMousemove"])],16)):r.createCommentVNode("",!0)]})),_:1},16,["onEnter","onAfterEnter","onLeave","onAfterLeave"])]})),_:1},8,["appendTo"])},module.exports=b;
1
+ "use strict";var e=require("primevue/portal"),t=require("primevue/utils"),i=require("primevue/basecomponent"),n=require("primevue/contextmenu/style"),s=require("primevue/icons/angleright"),o=require("primevue/ripple"),r=require("vue");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=a(e),u=a(i),l={name:"BaseContextMenu",extends:u.default,props:{model:{type:Array,default:null},appendTo:{type:[String,Object],default:"body"},autoZIndex:{type:Boolean,default:!0},baseZIndex:{type:Number,default:0},global:{type:Boolean,default:!1},tabindex:{type:Number,default:0},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null}},style:a(n).default,provide:function(){return{$parentInstance:this}}},m={name:"ContextMenuSub",hostName:"ContextMenu",extends:u.default,emits:["item-click","item-mouseenter","item-mousemove"],props:{items:{type:Array,default:null},menuId:{type:String,default:null},focusedItemId:{type:String,default:null},root:{type:Boolean,default:!1},visible:{type:Boolean,default:!1},level:{type:Number,default:0},templates:{type:Object,default:null},activeItemPath:{type:Object,default:null},tabindex:{type:Number,default:0}},methods:{getItemId:function(e){return"".concat(this.menuId,"_").concat(e.key)},getItemKey:function(e){return this.getItemId(e)},getItemProp:function(e,i,n){return e&&e.item?t.ObjectUtils.getItemValue(e.item[i],n):void 0},getItemLabel:function(e){return this.getItemProp(e,"label")},getItemLabelId:function(e){return"".concat(this.menuId,"_").concat(e.key,"_label")},getPTOptions:function(e,t,i){return this.ptm(e,{context:{item:t,active:this.isItemActive(t),focused:this.isItemFocused(t),disabled:this.isItemDisabled(t),index:i}})},isItemActive:function(e){return this.activeItemPath.some((function(t){return t.key===e.key}))},isItemVisible:function(e){return!1!==this.getItemProp(e,"visible")},isItemDisabled:function(e){return this.getItemProp(e,"disabled")},isItemFocused:function(e){return this.focusedItemId===this.getItemId(e)},isItemGroup:function(e){return t.ObjectUtils.isNotEmpty(e.items)},onItemClick:function(e,t){this.getItemProp(t,"command",{originalEvent:e,item:t.item}),this.$emit("item-click",{originalEvent:e,processedItem:t,isFocus:!0})},onItemMouseEnter:function(e,t){this.$emit("item-mouseenter",{originalEvent:e,processedItem:t})},onItemMouseMove:function(e,t){this.$emit("item-mousemove",{originalEvent:e,processedItem:t,isFocus:!0})},getAriaSetSize:function(){var e=this;return this.items.filter((function(t){return e.isItemVisible(t)&&!e.getItemProp(t,"separator")})).length},getAriaPosInset:function(e){var t=this;return e-this.items.slice(0,e).filter((function(e){return t.isItemVisible(e)&&t.getItemProp(e,"separator")})).length+1},onEnter:function(){t.DomHandler.nestedPosition(this.$refs.container,this.level)},getMenuItemProps:function(e,t){return{action:r.mergeProps({class:this.cx("action"),tabindex:-1,"aria-hidden":!0},this.getPTOptions("action",e,t)),icon:r.mergeProps({class:[this.cx("icon"),this.getItemProp(e,"icon")]},this.getPTOptions("icon",e,t)),label:r.mergeProps({class:this.cx("label")},this.getPTOptions("label",e,t)),submenuicon:r.mergeProps({class:this.cx("submenuIcon")},this.getPTOptions("submenuicon",e,t))}}},components:{AngleRightIcon:a(s).default},directives:{ripple:a(o).default}},d=["tabindex"],h=["id","aria-label","aria-disabled","aria-expanded","aria-haspopup","aria-level","aria-setsize","aria-posinset","data-p-highlight","data-p-focused","data-p-disabled"],I=["onClick","onMouseenter","onMousemove"],f=["href","target"],p=["id"],v=["id"];m.render=function(e,t,i,n,s,o){var a=r.resolveComponent("AngleRightIcon"),c=r.resolveComponent("ContextMenuSub",!0),u=r.resolveDirective("ripple");return r.openBlock(),r.createBlock(r.Transition,r.mergeProps({name:"p-contextmenusub",onEnter:o.onEnter},e.ptm("menu.transition")),{default:r.withCtx((function(){return[i.root||i.visible?(r.openBlock(),r.createElementBlock("ul",r.mergeProps({key:0,ref:"container",tabindex:i.tabindex},e.ptm("menu")),[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(i.items,(function(n,s){return r.openBlock(),r.createElementBlock(r.Fragment,{key:o.getItemKey(n)},[o.isItemVisible(n)&&!o.getItemProp(n,"separator")?(r.openBlock(),r.createElementBlock("li",r.mergeProps({key:0,id:o.getItemId(n),style:o.getItemProp(n,"style"),class:[e.cx("menuitem",{processedItem:n}),o.getItemProp(n,"class")],role:"menuitem","aria-label":o.getItemLabel(n),"aria-disabled":o.isItemDisabled(n)||void 0,"aria-expanded":o.isItemGroup(n)?o.isItemActive(n):void 0,"aria-haspopup":o.isItemGroup(n)&&!o.getItemProp(n,"to")?"menu":void 0,"aria-level":i.level+1,"aria-setsize":o.getAriaSetSize(),"aria-posinset":o.getAriaPosInset(s)},o.getPTOptions("menuitem",n,s),{"data-p-highlight":o.isItemActive(n),"data-p-focused":o.isItemFocused(n),"data-p-disabled":o.isItemDisabled(n)}),[r.createElementVNode("div",r.mergeProps({class:e.cx("content"),onClick:function(e){return o.onItemClick(e,n)},onMouseenter:function(e){return o.onItemMouseEnter(e,n)},onMousemove:function(e){return o.onItemMouseMove(e,n)}},o.getPTOptions("content",n,s)),[i.templates.item?(r.openBlock(),r.createBlock(r.resolveDynamicComponent(i.templates.item),{key:1,item:n.item,hasSubmenu:o.getItemProp(n,"items"),label:o.getItemLabel(n),props:o.getMenuItemProps(n,s)},null,8,["item","hasSubmenu","label","props"])):r.withDirectives((r.openBlock(),r.createElementBlock("a",r.mergeProps({key:0,href:o.getItemProp(n,"url"),class:e.cx("action"),target:o.getItemProp(n,"target"),tabindex:"-1","aria-hidden":"true"},o.getPTOptions("action",n,s)),[i.templates.itemicon?(r.openBlock(),r.createBlock(r.resolveDynamicComponent(i.templates.itemicon),{key:0,item:n.item,class:r.normalizeClass(e.cx("icon"))},null,8,["item","class"])):o.getItemProp(n,"icon")?(r.openBlock(),r.createElementBlock("span",r.mergeProps({key:1,class:[e.cx("icon"),o.getItemProp(n,"icon")]},o.getPTOptions("icon",n,s)),null,16)):r.createCommentVNode("",!0),r.createElementVNode("span",r.mergeProps({id:o.getItemLabelId(n),class:e.cx("label")},o.getPTOptions("label",n,s)),r.toDisplayString(o.getItemLabel(n)),17,p),o.getItemProp(n,"items")?(r.openBlock(),r.createElementBlock(r.Fragment,{key:2},[i.templates.submenuicon?(r.openBlock(),r.createBlock(r.resolveDynamicComponent(i.templates.submenuicon),{key:0,active:o.isItemActive(n),class:r.normalizeClass(e.cx("submenuIcon"))},null,8,["active","class"])):(r.openBlock(),r.createBlock(a,r.mergeProps({key:1,class:e.cx("submenuIcon")},o.getPTOptions("submenuicon",n,s)),null,16,["class"]))],64)):r.createCommentVNode("",!0)],16,f)),[[u]])],16,I),o.isItemVisible(n)&&o.isItemGroup(n)?(r.openBlock(),r.createBlock(c,r.mergeProps({key:0,id:o.getItemId(n)+"_list",role:"menu",class:e.cx("submenu"),menuId:i.menuId,focusedItemId:i.focusedItemId,items:n.items,templates:i.templates,activeItemPath:i.activeItemPath,level:i.level+1,visible:o.isItemActive(n)&&o.isItemGroup(n),pt:e.pt,unstyled:e.unstyled,onItemClick:t[0]||(t[0]=function(t){return e.$emit("item-click",t)}),onItemMouseenter:t[1]||(t[1]=function(t){return e.$emit("item-mouseenter",t)}),onItemMousemove:t[2]||(t[2]=function(t){return e.$emit("item-mousemove",t)}),"aria-labelledby":o.getItemLabelId(n)},e.ptm("submenu")),null,16,["id","class","menuId","focusedItemId","items","templates","activeItemPath","level","visible","pt","unstyled","aria-labelledby"])):r.createCommentVNode("",!0)],16,h)):r.createCommentVNode("",!0),o.isItemVisible(n)&&o.getItemProp(n,"separator")?(r.openBlock(),r.createElementBlock("li",r.mergeProps({key:1,id:o.getItemId(n),style:o.getItemProp(n,"style"),class:[e.cx("separator"),o.getItemProp(n,"class")],role:"separator"},e.ptm("separator")),null,16,v)):r.createCommentVNode("",!0)],64)})),128))],16,d)):r.createCommentVNode("",!0)]})),_:1},16,["onEnter"])};var b={name:"ContextMenu",extends:l,inheritAttrs:!1,emits:["focus","blur","show","hide","before-hide","before-show"],target:null,outsideClickListener:null,resizeListener:null,documentContextMenuListener:null,pageX:null,pageY:null,container:null,list:null,data:function(){return{id:this.$attrs.id,focused:!1,focusedItemInfo:{index:-1,level:0,parentKey:""},activeItemPath:[],visible:!1,submenuVisible:!1}},watch:{"$attrs.id":function(e){this.id=e||t.UniqueComponentId()},activeItemPath:function(e){t.ObjectUtils.isNotEmpty(e)?(this.bindOutsideClickListener(),this.bindResizeListener()):this.visible||(this.unbindOutsideClickListener(),this.unbindResizeListener())}},mounted:function(){this.id=this.id||t.UniqueComponentId(),this.global&&this.bindDocumentContextMenuListener()},beforeUnmount:function(){this.unbindResizeListener(),this.unbindOutsideClickListener(),this.unbindDocumentContextMenuListener(),this.container&&this.autoZIndex&&t.ZIndexUtils.clear(this.container),this.target=null,this.container=null},methods:{getItemProp:function(e,i){return e?t.ObjectUtils.getItemValue(e[i]):void 0},getItemLabel:function(e){return this.getItemProp(e,"label")},isItemDisabled:function(e){return this.getItemProp(e,"disabled")},isItemVisible:function(e){return!1!==this.getItemProp(e,"visible")},isItemGroup:function(e){return t.ObjectUtils.isNotEmpty(this.getItemProp(e,"items"))},isItemSeparator:function(e){return this.getItemProp(e,"separator")},getProccessedItemLabel:function(e){return e?this.getItemLabel(e.item):void 0},isProccessedItemGroup:function(e){return e&&t.ObjectUtils.isNotEmpty(e.items)},toggle:function(e){this.visible?this.hide():this.show(e)},show:function(e){this.$emit("before-show"),this.activeItemPath=[],this.focusedItemInfo={index:-1,level:0,parentKey:""},t.DomHandler.focus(this.list),this.pageX=e.pageX,this.pageY=e.pageY,this.visible?this.position():this.visible=!0,e.stopPropagation(),e.preventDefault()},hide:function(){this.$emit("before-hide"),this.visible=!1,this.activeItemPath=[],this.focusedItemInfo={index:-1,level:0,parentKey:""}},onFocus:function(e){this.focused=!0,this.focusedItemInfo=-1!==this.focusedItemInfo.index?this.focusedItemInfo:{index:-1,level:0,parentKey:""},this.$emit("focus",e)},onBlur:function(e){this.focused=!1,this.focusedItemInfo={index:-1,level:0,parentKey:""},this.searchValue="",this.$emit("blur",e)},onKeyDown:function(e){var i=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":this.onArrowLeftKey(e);break;case"ArrowRight":this.onArrowRightKey(e);break;case"Home":this.onHomeKey(e);break;case"End":this.onEndKey(e);break;case"Space":this.onSpaceKey(e);break;case"Enter":case"NumpadEnter":this.onEnterKey(e);break;case"Escape":this.onEscapeKey(e);break;case"Tab":this.onTabKey(e);break;case"PageDown":case"PageUp":case"Backspace":case"ShiftLeft":case"ShiftRight":break;default:!i&&t.ObjectUtils.isPrintableCharacter(e.key)&&this.searchItems(e,e.key)}},onItemChange:function(e){var i=e.processedItem,n=e.isFocus;if(!t.ObjectUtils.isEmpty(i)){var s=i.index,o=i.key,r=i.level,a=i.parentKey,c=t.ObjectUtils.isNotEmpty(i.items),u=this.activeItemPath.filter((function(e){return e.parentKey!==a&&e.parentKey!==o}));c&&(u.push(i),this.submenuVisible=!0),this.focusedItemInfo={index:s,level:r,parentKey:a},this.activeItemPath=u,n&&t.DomHandler.focus(this.list)}},onItemClick:function(e){var i=e.processedItem,n=this.isProccessedItemGroup(i);if(this.isSelected(i)){var s=i.index,o=i.key,r=i.level,a=i.parentKey;this.activeItemPath=this.activeItemPath.filter((function(e){return o!==e.key&&o.startsWith(e.key)})),this.focusedItemInfo={index:s,level:r,parentKey:a},t.DomHandler.focus(this.list)}else n?this.onItemChange(e):this.hide()},onItemMouseEnter:function(e){this.onItemChange(e)},onItemMouseMove:function(e){this.focused&&this.changeFocusedItemIndex(e,e.processedItem.index)},onArrowDownKey:function(e){var t=-1!==this.focusedItemInfo.index?this.findNextItemIndex(this.focusedItemInfo.index):this.findFirstFocusedItemIndex();this.changeFocusedItemIndex(e,t),e.preventDefault()},onArrowUpKey:function(e){if(e.altKey){if(-1!==this.focusedItemInfo.index){var t=this.visibleItems[this.focusedItemInfo.index];!this.isProccessedItemGroup(t)&&this.onItemChange({originalEvent:e,processedItem:t})}this.popup&&this.hide(),e.preventDefault()}else{var i=-1!==this.focusedItemInfo.index?this.findPrevItemIndex(this.focusedItemInfo.index):this.findLastFocusedItemIndex();this.changeFocusedItemIndex(e,i),e.preventDefault()}},onArrowLeftKey:function(e){var i=this,n=this.visibleItems[this.focusedItemInfo.index],s=this.activeItemPath.find((function(e){return e.key===n.parentKey}));t.ObjectUtils.isEmpty(n.parent)||(this.focusedItemInfo={index:-1,parentKey:s?s.parentKey:""},this.searchValue="",this.onArrowDownKey(e)),this.activeItemPath=this.activeItemPath.filter((function(e){return e.parentKey!==i.focusedItemInfo.parentKey})),e.preventDefault()},onArrowRightKey:function(e){var t=this.visibleItems[this.focusedItemInfo.index];this.isProccessedItemGroup(t)&&(this.onItemChange({originalEvent:e,processedItem:t}),this.focusedItemInfo={index:-1,parentKey:t.key},this.searchValue="",this.onArrowDownKey(e)),e.preventDefault()},onHomeKey:function(e){this.changeFocusedItemIndex(e,this.findFirstItemIndex()),e.preventDefault()},onEndKey:function(e){this.changeFocusedItemIndex(e,this.findLastItemIndex()),e.preventDefault()},onEnterKey:function(e){if(-1!==this.focusedItemInfo.index){var i=t.DomHandler.findSingle(this.list,'li[id="'.concat("".concat(this.focusedItemIdx),'"]')),n=i&&t.DomHandler.findSingle(i,'a[data-pc-section="action"]');n?n.click():i&&i.click(),!this.isProccessedItemGroup(this.visibleItems[this.focusedItemInfo.index])&&(this.focusedItemInfo.index=this.findFirstFocusedItemIndex())}e.preventDefault()},onSpaceKey:function(e){this.onEnterKey(e)},onEscapeKey:function(e){this.hide(),!this.popup&&(this.focusedItemInfo.index=this.findFirstFocusedItemIndex()),e.preventDefault()},onTabKey:function(e){if(-1!==this.focusedItemInfo.index){var t=this.visibleItems[this.focusedItemInfo.index];!this.isProccessedItemGroup(t)&&this.onItemChange({originalEvent:e,processedItem:t})}this.hide()},onEnter:function(e){t.DomHandler.addStyles(e,{position:"absolute"}),this.position(),this.autoZIndex&&t.ZIndexUtils.set("menu",e,this.baseZIndex+this.$primevue.config.zIndex.menu)},onAfterEnter:function(){this.bindOutsideClickListener(),this.bindResizeListener(),this.$emit("show"),t.DomHandler.focus(this.list)},onLeave:function(){this.$emit("hide"),this.container=null},onAfterLeave:function(e){this.autoZIndex&&t.ZIndexUtils.clear(e),this.unbindOutsideClickListener(),this.unbindResizeListener()},position:function(){var e=this.pageX+1,i=this.pageY+1,n=this.container.offsetParent?this.container.offsetWidth:t.DomHandler.getHiddenElementOuterWidth(this.container),s=this.container.offsetParent?this.container.offsetHeight:t.DomHandler.getHiddenElementOuterHeight(this.container),o=t.DomHandler.getViewport();e+n-document.body.scrollLeft>o.width&&(e-=n),i+s-document.body.scrollTop>o.height&&(i-=s),e<document.body.scrollLeft&&(e=document.body.scrollLeft),i<document.body.scrollTop&&(i=document.body.scrollTop),this.container.style.left=e+"px",this.container.style.top=i+"px"},bindOutsideClickListener:function(){var e=this;this.outsideClickListener||(this.outsideClickListener=function(t){var i=e.container&&!e.container.contains(t.target),n=!e.visible||!(e.target&&(e.target===t.target||e.target.contains(t.target)));i&&n&&e.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener:function(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindResizeListener:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.visible&&!t.DomHandler.isTouchDevice()&&e.hide()},window.addEventListener("resize",this.resizeListener))},unbindResizeListener:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},bindDocumentContextMenuListener:function(){var e=this;this.documentContextMenuListener||(this.documentContextMenuListener=function(t){2===t.button&&e.show(t)},document.addEventListener("contextmenu",this.documentContextMenuListener))},unbindDocumentContextMenuListener:function(){this.documentContextMenuListener&&(document.removeEventListener("contextmenu",this.documentContextMenuListener),this.documentContextMenuListener=null)},isItemMatched:function(e){var t;return this.isValidItem(e)&&(null===(t=this.getProccessedItemLabel(e))||void 0===t?void 0:t.toLocaleLowerCase().startsWith(this.searchValue.toLocaleLowerCase()))},isValidItem:function(e){return!!e&&!this.isItemDisabled(e.item)&&!this.isItemSeparator(e.item)&&this.isItemVisible(e.item)},isValidSelectedItem:function(e){return this.isValidItem(e)&&this.isSelected(e)},isSelected:function(e){return this.activeItemPath.some((function(t){return t.key===e.key}))},findFirstItemIndex:function(){var e=this;return this.visibleItems.findIndex((function(t){return e.isValidItem(t)}))},findLastItemIndex:function(){var e=this;return t.ObjectUtils.findLastIndex(this.visibleItems,(function(t){return e.isValidItem(t)}))},findNextItemIndex:function(e){var t=this,i=e<this.visibleItems.length-1?this.visibleItems.slice(e+1).findIndex((function(e){return t.isValidItem(e)})):-1;return i>-1?i+e+1:e},findPrevItemIndex:function(e){var i=this,n=e>0?t.ObjectUtils.findLastIndex(this.visibleItems.slice(0,e),(function(e){return i.isValidItem(e)})):-1;return n>-1?n:e},findSelectedItemIndex:function(){var e=this;return this.visibleItems.findIndex((function(t){return e.isValidSelectedItem(t)}))},findFirstFocusedItemIndex:function(){var e=this.findSelectedItemIndex();return e<0?this.findFirstItemIndex():e},findLastFocusedItemIndex:function(){var e=this.findSelectedItemIndex();return e<0?this.findLastItemIndex():e},searchItems:function(e,t){var i=this;this.searchValue=(this.searchValue||"")+t;var n=-1,s=!1;return-1!==(n=-1!==this.focusedItemInfo.index?-1===(n=this.visibleItems.slice(this.focusedItemInfo.index).findIndex((function(e){return i.isItemMatched(e)})))?this.visibleItems.slice(0,this.focusedItemInfo.index).findIndex((function(e){return i.isItemMatched(e)})):n+this.focusedItemInfo.index:this.visibleItems.findIndex((function(e){return i.isItemMatched(e)})))&&(s=!0),-1===n&&-1===this.focusedItemInfo.index&&(n=this.findFirstFocusedItemIndex()),-1!==n&&this.changeFocusedItemIndex(e,n),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((function(){i.searchValue="",i.searchTimeout=null}),500),s},changeFocusedItemIndex:function(e,t){this.focusedItemInfo.index!==t&&(this.focusedItemInfo.index=t,this.scrollInView())},scrollInView:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,i=-1!==e?"".concat(this.id,"_").concat(e):this.focusedItemIdx,n=t.DomHandler.findSingle(this.list,'li[id="'.concat(i,'"]'));n&&n.scrollIntoView&&n.scrollIntoView({block:"nearest",inline:"start"})},createProcessedItems:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=[];return e&&e.forEach((function(e,r){var a=(""!==s?s+"_":"")+r,c={item:e,index:r,level:i,key:a,parent:n,parentKey:s};c.items=t.createProcessedItems(e.items,i+1,c,a),o.push(c)})),o},containerRef:function(e){this.container=e},listRef:function(e){this.list=e?e.$el:void 0}},computed:{processedItems:function(){return this.createProcessedItems(this.model||[])},visibleItems:function(){var e=this,t=this.activeItemPath.find((function(t){return t.key===e.focusedItemInfo.parentKey}));return t?t.items:this.processedItems},focusedItemIdx:function(){return-1!==this.focusedItemInfo.index?"".concat(this.id).concat(t.ObjectUtils.isNotEmpty(this.focusedItemInfo.parentKey)?"_"+this.focusedItemInfo.parentKey:"","_").concat(this.focusedItemInfo.index):null}},components:{ContextMenuSub:m,Portal:c.default}};b.render=function(e,t,i,n,s,o){var a=r.resolveComponent("ContextMenuSub"),c=r.resolveComponent("Portal");return r.openBlock(),r.createBlock(c,{appendTo:e.appendTo},{default:r.withCtx((function(){return[r.createVNode(r.Transition,r.mergeProps({name:"p-contextmenu",onEnter:o.onEnter,onAfterEnter:o.onAfterEnter,onLeave:o.onLeave,onAfterLeave:o.onAfterLeave},e.ptm("transition")),{default:r.withCtx((function(){return[s.visible?(r.openBlock(),r.createElementBlock("div",r.mergeProps({key:0,ref:o.containerRef,class:e.cx("root")},e.ptmi("root")),[r.createVNode(a,{ref:o.listRef,id:s.id+"_list",class:r.normalizeClass(e.cx("menu")),role:"menubar",root:!0,tabindex:e.tabindex,"aria-orientation":"vertical","aria-activedescendant":s.focused?o.focusedItemIdx:void 0,menuId:s.id,focusedItemId:s.focused?o.focusedItemIdx:void 0,items:o.processedItems,templates:e.$slots,activeItemPath:s.activeItemPath,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,level:0,visible:s.submenuVisible,pt:e.pt,unstyled:e.unstyled,onFocus:o.onFocus,onBlur:o.onBlur,onKeydown:o.onKeyDown,onItemClick:o.onItemClick,onItemMouseenter:o.onItemMouseEnter,onItemMousemove:o.onItemMouseMove},null,8,["id","class","tabindex","aria-activedescendant","menuId","focusedItemId","items","templates","activeItemPath","aria-labelledby","aria-label","visible","pt","unstyled","onFocus","onBlur","onKeydown","onItemClick","onItemMouseenter","onItemMousemove"])],16)):r.createCommentVNode("",!0)]})),_:1},16,["onEnter","onAfterEnter","onLeave","onAfterLeave"])]})),_:1},8,["appendTo"])},module.exports=b;