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.
- package/README.md +1 -1
- package/api/Api.d.ts +58 -6
- package/api/api.cjs.js +58 -6
- package/api/api.cjs.min.js +1 -1
- package/api/api.esm.js +58 -6
- package/api/api.esm.min.js +1 -1
- package/api/api.js +58 -6
- package/api/api.min.js +1 -1
- package/autocomplete/AutoComplete.vue +1 -1
- package/autocomplete/autocomplete.cjs.js +2 -2
- package/autocomplete/autocomplete.cjs.min.js +1 -1
- package/autocomplete/autocomplete.esm.js +2 -2
- package/autocomplete/autocomplete.esm.min.js +1 -1
- package/autocomplete/autocomplete.js +2 -2
- package/autocomplete/autocomplete.min.js +1 -1
- package/basecomponent/BaseComponent.vue +11 -11
- package/basecomponent/basecomponent.cjs.js +20 -20
- package/basecomponent/basecomponent.cjs.min.js +1 -1
- package/basecomponent/basecomponent.esm.js +20 -20
- package/basecomponent/basecomponent.esm.min.js +1 -1
- package/basecomponent/basecomponent.js +20 -20
- package/basecomponent/basecomponent.min.js +1 -1
- package/basedirective/basedirective.cjs.js +5 -5
- package/basedirective/basedirective.cjs.min.js +1 -1
- package/basedirective/basedirective.esm.js +5 -5
- package/basedirective/basedirective.esm.min.js +1 -1
- package/basedirective/basedirective.js +5 -5
- package/basedirective/basedirective.min.js +1 -1
- package/calendar/BaseCalendar.vue +4 -0
- package/calendar/Calendar.d.ts +4 -0
- package/calendar/Calendar.vue +3 -2
- package/calendar/calendar.cjs.js +8 -8
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.esm.js +8 -8
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +8 -8
- package/calendar/calendar.min.js +1 -1
- package/colorpicker/ColorPicker.vue +0 -23
- package/colorpicker/colorpicker.cjs.js +0 -19
- package/colorpicker/colorpicker.cjs.min.js +1 -1
- package/colorpicker/colorpicker.esm.js +0 -19
- package/colorpicker/colorpicker.esm.min.js +1 -1
- package/colorpicker/colorpicker.js +0 -19
- package/colorpicker/colorpicker.min.js +1 -1
- package/column/Column.d.ts +1 -1
- package/confirmpopup/ConfirmPopup.vue +6 -1
- package/confirmpopup/confirmpopup.cjs.js +5 -1
- package/confirmpopup/confirmpopup.cjs.min.js +1 -1
- package/confirmpopup/confirmpopup.esm.js +5 -1
- package/confirmpopup/confirmpopup.esm.min.js +1 -1
- package/confirmpopup/confirmpopup.js +5 -1
- package/confirmpopup/confirmpopup.min.js +1 -1
- package/contextmenu/ContextMenu.vue +3 -1
- package/contextmenu/contextmenu.cjs.js +3 -1
- package/contextmenu/contextmenu.cjs.min.js +1 -1
- package/contextmenu/contextmenu.esm.js +3 -1
- package/contextmenu/contextmenu.esm.min.js +1 -1
- package/contextmenu/contextmenu.js +3 -1
- package/contextmenu/contextmenu.min.js +1 -1
- package/core/core.js +137 -55
- package/core/core.min.js +11 -9
- package/datatable/BodyCell.vue +8 -16
- package/datatable/DataTable.d.ts +1 -1
- package/datatable/DataTable.vue +3 -1
- package/datatable/datatable.cjs.js +10 -15
- package/datatable/datatable.cjs.min.js +1 -1
- package/datatable/datatable.esm.js +10 -15
- package/datatable/datatable.esm.min.js +1 -1
- package/datatable/datatable.js +10 -15
- package/datatable/datatable.min.js +1 -1
- package/dialog/Dialog.vue +5 -1
- package/dialog/dialog.cjs.js +5 -1
- package/dialog/dialog.cjs.min.js +1 -1
- package/dialog/dialog.esm.js +5 -1
- package/dialog/dialog.esm.min.js +1 -1
- package/dialog/dialog.js +5 -1
- package/dialog/dialog.min.js +1 -1
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.vue +17 -15
- package/dropdown/dropdown.cjs.js +15 -15
- package/dropdown/dropdown.cjs.min.js +1 -1
- package/dropdown/dropdown.esm.js +15 -15
- package/dropdown/dropdown.esm.min.js +1 -1
- package/dropdown/dropdown.js +15 -15
- package/dropdown/dropdown.min.js +1 -1
- package/floatlabel/floatlabel.js +1 -1
- package/floatlabel/floatlabel.min.js +1 -1
- package/inplace/Inplace.vue +2 -2
- package/inplace/inplace.cjs.js +3 -3
- package/inplace/inplace.cjs.min.js +1 -1
- package/inplace/inplace.esm.js +4 -4
- package/inplace/inplace.esm.min.js +1 -1
- package/inplace/inplace.js +3 -3
- package/inplace/inplace.min.js +1 -1
- package/inputnumber/InputNumber.vue +7 -2
- package/inputnumber/inputnumber.cjs.js +6 -2
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.esm.js +6 -2
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +6 -2
- package/inputnumber/inputnumber.min.js +1 -1
- package/inputotp/InputOtp.vue +8 -0
- package/inputotp/inputotp.cjs.js +6 -0
- package/inputotp/inputotp.cjs.min.js +1 -1
- package/inputotp/inputotp.esm.js +6 -0
- package/inputotp/inputotp.esm.min.js +1 -1
- package/inputotp/inputotp.js +6 -0
- package/inputotp/inputotp.min.js +1 -1
- package/listbox/Listbox.d.ts +1 -1
- package/listbox/Listbox.vue +16 -5
- package/listbox/listbox.cjs.js +14 -5
- package/listbox/listbox.cjs.min.js +1 -1
- package/listbox/listbox.esm.js +14 -5
- package/listbox/listbox.esm.min.js +1 -1
- package/listbox/listbox.js +14 -5
- package/listbox/listbox.min.js +1 -1
- package/multiselect/MultiSelect.d.ts +1 -1
- package/multiselect/MultiSelect.vue +16 -10
- package/multiselect/multiselect.cjs.js +15 -8
- package/multiselect/multiselect.cjs.min.js +1 -1
- package/multiselect/multiselect.esm.js +15 -8
- package/multiselect/multiselect.esm.min.js +1 -1
- package/multiselect/multiselect.js +15 -8
- package/multiselect/multiselect.min.js +1 -1
- package/package.json +1 -1
- package/password/BasePassword.vue +2 -2
- package/password/Password.d.ts +2 -2
- package/password/password.cjs.js +2 -2
- package/password/password.cjs.min.js +1 -1
- package/password/password.esm.js +2 -2
- package/password/password.esm.min.js +1 -1
- package/password/password.js +2 -2
- package/password/password.min.js +1 -1
- package/ripple/ripple.cjs.js +1 -1
- package/ripple/ripple.cjs.min.js +1 -1
- package/ripple/ripple.esm.js +1 -1
- package/ripple/ripple.esm.min.js +1 -1
- package/ripple/ripple.js +1 -1
- package/ripple/ripple.min.js +1 -1
- package/splitbutton/SplitButton.vue +1 -0
- package/splitbutton/splitbutton.cjs.js +2 -1
- package/splitbutton/splitbutton.cjs.min.js +1 -1
- package/splitbutton/splitbutton.esm.js +2 -1
- package/splitbutton/splitbutton.esm.min.js +1 -1
- package/splitbutton/splitbutton.js +2 -1
- package/splitbutton/splitbutton.min.js +1 -1
- package/tieredmenu/TieredMenu.vue +3 -2
- package/tieredmenu/tieredmenu.cjs.js +4 -3
- package/tieredmenu/tieredmenu.cjs.min.js +1 -1
- package/tieredmenu/tieredmenu.esm.js +4 -3
- package/tieredmenu/tieredmenu.esm.min.js +1 -1
- package/tieredmenu/tieredmenu.js +4 -3
- package/tieredmenu/tieredmenu.min.js +1 -1
- package/treenode/TreeNode.d.ts +1 -1
- package/treeselect/TreeSelect.d.ts +1 -1
- package/virtualscroller/BaseVirtualScroller.vue +1 -1
- package/virtualscroller/virtualscroller.cjs.js +2 -2
- package/virtualscroller/virtualscroller.cjs.min.js +1 -1
- package/virtualscroller/virtualscroller.esm.js +2 -2
- package/virtualscroller/virtualscroller.esm.min.js +1 -1
- package/virtualscroller/virtualscroller.js +2 -2
- package/virtualscroller/virtualscroller.min.js +1 -1
- package/web-types.json +1 -1
package/dialog/Dialog.vue
CHANGED
|
@@ -84,7 +84,8 @@ export default {
|
|
|
84
84
|
containerVisible: this.visible,
|
|
85
85
|
maximized: false,
|
|
86
86
|
focusableMax: null,
|
|
87
|
-
focusableClose: null
|
|
87
|
+
focusableClose: null,
|
|
88
|
+
target: null
|
|
88
89
|
};
|
|
89
90
|
},
|
|
90
91
|
watch: {
|
|
@@ -139,6 +140,7 @@ export default {
|
|
|
139
140
|
},
|
|
140
141
|
onEnter() {
|
|
141
142
|
this.$emit('show');
|
|
143
|
+
this.target = document.activeElement;
|
|
142
144
|
this.focus();
|
|
143
145
|
this.enableDocumentSettings();
|
|
144
146
|
this.bindGlobalListeners();
|
|
@@ -154,6 +156,8 @@ export default {
|
|
|
154
156
|
},
|
|
155
157
|
onLeave() {
|
|
156
158
|
this.$emit('hide');
|
|
159
|
+
DomHandler.focus(this.target);
|
|
160
|
+
this.target = null;
|
|
157
161
|
this.focusableClose = null;
|
|
158
162
|
this.focusableMax = null;
|
|
159
163
|
},
|
package/dialog/dialog.cjs.js
CHANGED
|
@@ -163,7 +163,8 @@ var script = {
|
|
|
163
163
|
containerVisible: this.visible,
|
|
164
164
|
maximized: false,
|
|
165
165
|
focusableMax: null,
|
|
166
|
-
focusableClose: null
|
|
166
|
+
focusableClose: null,
|
|
167
|
+
target: null
|
|
167
168
|
};
|
|
168
169
|
},
|
|
169
170
|
watch: {
|
|
@@ -215,6 +216,7 @@ var script = {
|
|
|
215
216
|
},
|
|
216
217
|
onEnter: function onEnter() {
|
|
217
218
|
this.$emit('show');
|
|
219
|
+
this.target = document.activeElement;
|
|
218
220
|
this.focus();
|
|
219
221
|
this.enableDocumentSettings();
|
|
220
222
|
this.bindGlobalListeners();
|
|
@@ -229,6 +231,8 @@ var script = {
|
|
|
229
231
|
},
|
|
230
232
|
onLeave: function onLeave() {
|
|
231
233
|
this.$emit('hide');
|
|
234
|
+
utils.DomHandler.focus(this.target);
|
|
235
|
+
this.target = null;
|
|
232
236
|
this.focusableClose = null;
|
|
233
237
|
this.focusableMax = null;
|
|
234
238
|
},
|
package/dialog/dialog.cjs.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("primevue/focustrap"),t=require("primevue/icons/times"),n=require("primevue/icons/windowmaximize"),o=require("primevue/icons/windowminimize"),i=require("primevue/portal"),a=require("primevue/ripple"),l=require("primevue/utils"),r=require("vue"),s=require("primevue/basecomponent"),c=require("primevue/dialog/style");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=u(e),d=u(t),p=u(n),f=u(o),h=u(i),b=u(a),y={name:"Dialog",extends:{name:"BaseDialog",extends:u(s).default,props:{header:{type:null,default:null},footer:{type:null,default:null},visible:{type:Boolean,default:!1},modal:{type:Boolean,default:null},contentStyle:{type:null,default:null},contentClass:{type:String,default:null},contentProps:{type:null,default:null},rtl:{type:Boolean,default:null},maximizable:{type:Boolean,default:!1},dismissableMask:{type:Boolean,default:!1},closable:{type:Boolean,default:!0},closeOnEscape:{type:Boolean,default:!0},showHeader:{type:Boolean,default:!0},blockScroll:{type:Boolean,default:!1},baseZIndex:{type:Number,default:0},autoZIndex:{type:Boolean,default:!0},position:{type:String,default:"center"},breakpoints:{type:Object,default:null},draggable:{type:Boolean,default:!0},keepInViewport:{type:Boolean,default:!0},minX:{type:Number,default:0},minY:{type:Number,default:0},appendTo:{type:[String,Object],default:"body"},closeIcon:{type:String,default:void 0},maximizeIcon:{type:String,default:void 0},minimizeIcon:{type:String,default:void 0},closeButtonProps:{type:null,default:null},_instance:null},style:u(c).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,emits:["update:visible","show","hide","after-hide","maximize","unmaximize","dragend"],provide:function(){var e=this;return{dialogRef:r.computed((function(){return e._instance}))}},data:function(){return{id:this.$attrs.id,containerVisible:this.visible,maximized:!1,focusableMax:null,focusableClose:null}},watch:{"$attrs.id":function(e){this.id=e||l.UniqueComponentId()}},documentKeydownListener:null,container:null,mask:null,content:null,headerContainer:null,footerContainer:null,maximizableButton:null,closeButton:null,styleElement:null,dragging:null,documentDragListener:null,documentDragEndListener:null,lastPageX:null,lastPageY:null,updated:function(){this.visible&&(this.containerVisible=this.visible)},beforeUnmount:function(){this.unbindDocumentState(),this.unbindGlobalListeners(),this.destroyStyle(),this.mask&&this.autoZIndex&&l.ZIndexUtils.clear(this.mask),this.container=null,this.mask=null},mounted:function(){this.id=this.id||l.UniqueComponentId(),this.breakpoints&&this.createStyle()},methods:{close:function(){this.$emit("update:visible",!1)},onBeforeEnter:function(e){e.setAttribute(this.attributeSelector,"")},onEnter:function(){this.$emit("show"),this.focus(),this.enableDocumentSettings(),this.bindGlobalListeners(),this.autoZIndex&&l.ZIndexUtils.set("modal",this.mask,this.baseZIndex+this.$primevue.config.zIndex.modal)},onBeforeLeave:function(){this.modal&&!this.isUnstyled&&l.DomHandler.addClass(this.mask,"p-component-overlay-leave")},onLeave:function(){this.$emit("hide"),this.focusableClose=null,this.focusableMax=null},onAfterLeave:function(){this.autoZIndex&&l.ZIndexUtils.clear(this.mask),this.containerVisible=!1,this.unbindDocumentState(),this.unbindGlobalListeners(),this.$emit("after-hide")},onMaskClick:function(e){this.dismissableMask&&this.modal&&this.mask===e.target&&this.close()},focus:function(){var e=function(e){return e&&e.querySelector("[autofocus]")},t=this.$slots.footer&&e(this.footerContainer);t||(t=this.$slots.header&&e(this.headerContainer))||(t=this.$slots.default&&e(this.content))||(this.maximizable?(this.focusableMax=!0,t=this.maximizableButton):(this.focusableClose=!0,t=this.closeButton)),t&&l.DomHandler.focus(t,{focusVisible:!0})},maximize:function(e){this.maximized?(this.maximized=!1,this.$emit("unmaximize",e)):(this.maximized=!0,this.$emit("maximize",e)),this.modal||(this.maximized?l.DomHandler.blockBodyScroll():l.DomHandler.unblockBodyScroll())},enableDocumentSettings:function(){(this.modal||!this.modal&&this.blockScroll||this.maximizable&&this.maximized)&&l.DomHandler.blockBodyScroll()},unbindDocumentState:function(){(this.modal||!this.modal&&this.blockScroll||this.maximizable&&this.maximized)&&l.DomHandler.unblockBodyScroll()},onKeyDown:function(e){"Escape"===e.code&&this.closeOnEscape&&this.close()},bindDocumentKeyDownListener:function(){this.documentKeydownListener||(this.documentKeydownListener=this.onKeyDown.bind(this),window.document.addEventListener("keydown",this.documentKeydownListener))},unbindDocumentKeyDownListener:function(){this.documentKeydownListener&&(window.document.removeEventListener("keydown",this.documentKeydownListener),this.documentKeydownListener=null)},containerRef:function(e){this.container=e},maskRef:function(e){this.mask=e},contentRef:function(e){this.content=e},headerContainerRef:function(e){this.headerContainer=e},footerContainerRef:function(e){this.footerContainer=e},maximizableRef:function(e){this.maximizableButton=e},closeButtonRef:function(e){this.closeButton=e},createStyle:function(){if(!this.styleElement&&!this.isUnstyled){var e;this.styleElement=document.createElement("style"),this.styleElement.type="text/css",l.DomHandler.setAttribute(this.styleElement,"nonce",null===(e=this.$primevue)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.csp)||void 0===e?void 0:e.nonce),document.head.appendChild(this.styleElement);var t="";for(var n in this.breakpoints)t+="\n @media screen and (max-width: ".concat(n,") {\n .p-dialog[").concat(this.attributeSelector,"] {\n width: ").concat(this.breakpoints[n]," !important;\n }\n }\n ");this.styleElement.innerHTML=t}},destroyStyle:function(){this.styleElement&&(document.head.removeChild(this.styleElement),this.styleElement=null)},initDrag:function(e){"icons"!==e.target.closest("div").getAttribute("data-pc-section")&&this.draggable&&(this.dragging=!0,this.lastPageX=e.pageX,this.lastPageY=e.pageY,this.container.style.margin="0",document.body.setAttribute("data-p-unselectable-text","true"),!this.isUnstyled&&l.DomHandler.addClass(document.body,"p-unselectable-text"))},bindGlobalListeners:function(){this.draggable&&(this.bindDocumentDragListener(),this.bindDocumentDragEndListener()),this.closeOnEscape&&this.closable&&this.bindDocumentKeyDownListener()},unbindGlobalListeners:function(){this.unbindDocumentDragListener(),this.unbindDocumentDragEndListener(),this.unbindDocumentKeyDownListener()},bindDocumentDragListener:function(){var e=this;this.documentDragListener=function(t){if(e.dragging){var n=l.DomHandler.getOuterWidth(e.container),o=l.DomHandler.getOuterHeight(e.container),i=t.pageX-e.lastPageX,a=t.pageY-e.lastPageY,r=e.container.getBoundingClientRect(),s=r.left+i,c=r.top+a,u=l.DomHandler.getViewport(),m=getComputedStyle(e.container),d=parseFloat(m.marginLeft),p=parseFloat(m.marginTop);e.container.style.position="fixed",e.keepInViewport?(s>=e.minX&&s+n<u.width&&(e.lastPageX=t.pageX,e.container.style.left=s-d+"px"),c>=e.minY&&c+o<u.height&&(e.lastPageY=t.pageY,e.container.style.top=c-p+"px")):(e.lastPageX=t.pageX,e.container.style.left=s-d+"px",e.lastPageY=t.pageY,e.container.style.top=c-p+"px")}},window.document.addEventListener("mousemove",this.documentDragListener)},unbindDocumentDragListener:function(){this.documentDragListener&&(window.document.removeEventListener("mousemove",this.documentDragListener),this.documentDragListener=null)},bindDocumentDragEndListener:function(){var e=this;this.documentDragEndListener=function(t){e.dragging&&(e.dragging=!1,document.body.removeAttribute("data-p-unselectable-text"),!e.isUnstyled&&l.DomHandler.removeClass(document.body,"p-unselectable-text"),e.$emit("dragend",t))},window.document.addEventListener("mouseup",this.documentDragEndListener)},unbindDocumentDragEndListener:function(){this.documentDragEndListener&&(window.document.removeEventListener("mouseup",this.documentDragEndListener),this.documentDragEndListener=null)}},computed:{maximizeIconComponent:function(){return this.maximized?this.minimizeIcon?"span":"WindowMinimizeIcon":this.maximizeIcon?"span":"WindowMaximizeIcon"},ariaLabelledById:function(){return null!=this.header||null!==this.$attrs["aria-labelledby"]?this.id+"_header":null},closeAriaLabel:function(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0},attributeSelector:function(){return l.UniqueComponentId()}},directives:{ripple:b.default,focustrap:m.default},components:{Portal:h.default,WindowMinimizeIcon:f.default,WindowMaximizeIcon:p.default,TimesIcon:d.default}};function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach((function(t){k(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function k(e,t,n){var o;return(t="symbol"==g(o=D(t,"string"))?o:String(o))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e,t){if("object"!=g(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=g(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var B=["aria-labelledby","aria-modal"],w=["id"],L=["autofocus","tabindex"],z=["autofocus","aria-label"];y.render=function(e,t,n,o,i,a){var l=r.resolveComponent("Portal"),s=r.resolveDirective("ripple"),c=r.resolveDirective("focustrap");return r.openBlock(),r.createBlock(l,{appendTo:e.appendTo},{default:r.withCtx((function(){return[i.containerVisible?(r.openBlock(),r.createElementBlock("div",r.mergeProps({key:0,ref:a.maskRef,class:e.cx("mask"),style:e.sx("mask",!0,{position:e.position,modal:e.modal}),onClick:t[3]||(t[3]=function(){return a.onMaskClick&&a.onMaskClick.apply(a,arguments)})},e.ptm("mask")),[r.createVNode(r.Transition,r.mergeProps({name:"p-dialog",onBeforeEnter:a.onBeforeEnter,onEnter:a.onEnter,onBeforeLeave:a.onBeforeLeave,onLeave:a.onLeave,onAfterLeave:a.onAfterLeave,appear:""},e.ptm("transition")),{default:r.withCtx((function(){return[e.visible?r.withDirectives((r.openBlock(),r.createElementBlock("div",r.mergeProps({key:0,ref:a.containerRef,class:e.cx("root"),style:e.sx("root"),role:"dialog","aria-labelledby":a.ariaLabelledById,"aria-modal":e.modal},e.ptmi("root")),[e.$slots.container?r.renderSlot(e.$slots,"container",{key:0,onClose:a.close,onMaximize:function(e){return a.maximize(e)},closeCallback:a.close,maximizeCallback:function(e){return a.maximize(e)}}):(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[e.showHeader?(r.openBlock(),r.createElementBlock("div",r.mergeProps({key:0,ref:a.headerContainerRef,class:e.cx("header"),onMousedown:t[2]||(t[2]=function(){return a.initDrag&&a.initDrag.apply(a,arguments)})},e.ptm("header")),[r.renderSlot(e.$slots,"header",{class:r.normalizeClass(e.cx("title"))},(function(){return[e.header?(r.openBlock(),r.createElementBlock("span",r.mergeProps({key:0,id:a.ariaLabelledById,class:e.cx("title")},e.ptm("title")),r.toDisplayString(e.header),17,w)):r.createCommentVNode("",!0)]})),r.createElementVNode("div",r.mergeProps({class:e.cx("icons")},e.ptm("icons")),[e.maximizable?r.withDirectives((r.openBlock(),r.createElementBlock("button",r.mergeProps({key:0,ref:a.maximizableRef,autofocus:i.focusableMax,class:e.cx("maximizableButton"),onClick:t[0]||(t[0]=function(){return a.maximize&&a.maximize.apply(a,arguments)}),type:"button",tabindex:e.maximizable?"0":"-1"},e.ptm("maximizableButton"),{"data-pc-group-section":"headericon"}),[r.renderSlot(e.$slots,"maximizeicon",{maximized:i.maximized,class:r.normalizeClass(e.cx("maximizableIcon"))},(function(){return[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(a.maximizeIconComponent),r.mergeProps({class:[e.cx("maximizableIcon"),i.maximized?e.minimizeIcon:e.maximizeIcon]},e.ptm("maximizableIcon")),null,16,["class"]))]}))],16,L)),[[s]]):r.createCommentVNode("",!0),e.closable?r.withDirectives((r.openBlock(),r.createElementBlock("button",r.mergeProps({key:1,ref:a.closeButtonRef,autofocus:i.focusableClose,class:e.cx("closeButton"),onClick:t[1]||(t[1]=function(){return a.close&&a.close.apply(a,arguments)}),"aria-label":a.closeAriaLabel,type:"button"},x(x({},e.closeButtonProps),e.ptm("closeButton")),{"data-pc-group-section":"headericon"}),[r.renderSlot(e.$slots,"closeicon",{class:r.normalizeClass(e.cx("closeButtonIcon"))},(function(){return[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(e.closeIcon?"span":"TimesIcon"),r.mergeProps({class:[e.cx("closeButtonIcon"),e.closeIcon]},e.ptm("closeButtonIcon")),null,16,["class"]))]}))],16,z)),[[s]]):r.createCommentVNode("",!0)],16)],16)):r.createCommentVNode("",!0),r.createElementVNode("div",r.mergeProps({ref:a.contentRef,class:[e.cx("content"),e.contentClass],style:e.contentStyle},x(x({},e.contentProps),e.ptm("content"))),[r.renderSlot(e.$slots,"default")],16),e.footer||e.$slots.footer?(r.openBlock(),r.createElementBlock("div",r.mergeProps({key:1,ref:a.footerContainerRef,class:e.cx("footer")},e.ptm("footer")),[r.renderSlot(e.$slots,"footer",{},(function(){return[r.createTextVNode(r.toDisplayString(e.footer),1)]}))],16)):r.createCommentVNode("",!0)],64))],16,B)),[[c,{disabled:!e.modal}]]):r.createCommentVNode("",!0)]})),_:3},16,["onBeforeEnter","onEnter","onBeforeLeave","onLeave","onAfterLeave"])],16)):r.createCommentVNode("",!0)]})),_:3},8,["appendTo"])},module.exports=y;
|
|
1
|
+
"use strict";var e=require("primevue/focustrap"),t=require("primevue/icons/times"),n=require("primevue/icons/windowmaximize"),o=require("primevue/icons/windowminimize"),i=require("primevue/portal"),a=require("primevue/ripple"),l=require("primevue/utils"),r=require("vue"),s=require("primevue/basecomponent"),c=require("primevue/dialog/style");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=u(e),d=u(t),p=u(n),f=u(o),h=u(i),b=u(a),y={name:"Dialog",extends:{name:"BaseDialog",extends:u(s).default,props:{header:{type:null,default:null},footer:{type:null,default:null},visible:{type:Boolean,default:!1},modal:{type:Boolean,default:null},contentStyle:{type:null,default:null},contentClass:{type:String,default:null},contentProps:{type:null,default:null},rtl:{type:Boolean,default:null},maximizable:{type:Boolean,default:!1},dismissableMask:{type:Boolean,default:!1},closable:{type:Boolean,default:!0},closeOnEscape:{type:Boolean,default:!0},showHeader:{type:Boolean,default:!0},blockScroll:{type:Boolean,default:!1},baseZIndex:{type:Number,default:0},autoZIndex:{type:Boolean,default:!0},position:{type:String,default:"center"},breakpoints:{type:Object,default:null},draggable:{type:Boolean,default:!0},keepInViewport:{type:Boolean,default:!0},minX:{type:Number,default:0},minY:{type:Number,default:0},appendTo:{type:[String,Object],default:"body"},closeIcon:{type:String,default:void 0},maximizeIcon:{type:String,default:void 0},minimizeIcon:{type:String,default:void 0},closeButtonProps:{type:null,default:null},_instance:null},style:u(c).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,emits:["update:visible","show","hide","after-hide","maximize","unmaximize","dragend"],provide:function(){var e=this;return{dialogRef:r.computed((function(){return e._instance}))}},data:function(){return{id:this.$attrs.id,containerVisible:this.visible,maximized:!1,focusableMax:null,focusableClose:null,target:null}},watch:{"$attrs.id":function(e){this.id=e||l.UniqueComponentId()}},documentKeydownListener:null,container:null,mask:null,content:null,headerContainer:null,footerContainer:null,maximizableButton:null,closeButton:null,styleElement:null,dragging:null,documentDragListener:null,documentDragEndListener:null,lastPageX:null,lastPageY:null,updated:function(){this.visible&&(this.containerVisible=this.visible)},beforeUnmount:function(){this.unbindDocumentState(),this.unbindGlobalListeners(),this.destroyStyle(),this.mask&&this.autoZIndex&&l.ZIndexUtils.clear(this.mask),this.container=null,this.mask=null},mounted:function(){this.id=this.id||l.UniqueComponentId(),this.breakpoints&&this.createStyle()},methods:{close:function(){this.$emit("update:visible",!1)},onBeforeEnter:function(e){e.setAttribute(this.attributeSelector,"")},onEnter:function(){this.$emit("show"),this.target=document.activeElement,this.focus(),this.enableDocumentSettings(),this.bindGlobalListeners(),this.autoZIndex&&l.ZIndexUtils.set("modal",this.mask,this.baseZIndex+this.$primevue.config.zIndex.modal)},onBeforeLeave:function(){this.modal&&!this.isUnstyled&&l.DomHandler.addClass(this.mask,"p-component-overlay-leave")},onLeave:function(){this.$emit("hide"),l.DomHandler.focus(this.target),this.target=null,this.focusableClose=null,this.focusableMax=null},onAfterLeave:function(){this.autoZIndex&&l.ZIndexUtils.clear(this.mask),this.containerVisible=!1,this.unbindDocumentState(),this.unbindGlobalListeners(),this.$emit("after-hide")},onMaskClick:function(e){this.dismissableMask&&this.modal&&this.mask===e.target&&this.close()},focus:function(){var e=function(e){return e&&e.querySelector("[autofocus]")},t=this.$slots.footer&&e(this.footerContainer);t||(t=this.$slots.header&&e(this.headerContainer))||(t=this.$slots.default&&e(this.content))||(this.maximizable?(this.focusableMax=!0,t=this.maximizableButton):(this.focusableClose=!0,t=this.closeButton)),t&&l.DomHandler.focus(t,{focusVisible:!0})},maximize:function(e){this.maximized?(this.maximized=!1,this.$emit("unmaximize",e)):(this.maximized=!0,this.$emit("maximize",e)),this.modal||(this.maximized?l.DomHandler.blockBodyScroll():l.DomHandler.unblockBodyScroll())},enableDocumentSettings:function(){(this.modal||!this.modal&&this.blockScroll||this.maximizable&&this.maximized)&&l.DomHandler.blockBodyScroll()},unbindDocumentState:function(){(this.modal||!this.modal&&this.blockScroll||this.maximizable&&this.maximized)&&l.DomHandler.unblockBodyScroll()},onKeyDown:function(e){"Escape"===e.code&&this.closeOnEscape&&this.close()},bindDocumentKeyDownListener:function(){this.documentKeydownListener||(this.documentKeydownListener=this.onKeyDown.bind(this),window.document.addEventListener("keydown",this.documentKeydownListener))},unbindDocumentKeyDownListener:function(){this.documentKeydownListener&&(window.document.removeEventListener("keydown",this.documentKeydownListener),this.documentKeydownListener=null)},containerRef:function(e){this.container=e},maskRef:function(e){this.mask=e},contentRef:function(e){this.content=e},headerContainerRef:function(e){this.headerContainer=e},footerContainerRef:function(e){this.footerContainer=e},maximizableRef:function(e){this.maximizableButton=e},closeButtonRef:function(e){this.closeButton=e},createStyle:function(){if(!this.styleElement&&!this.isUnstyled){var e;this.styleElement=document.createElement("style"),this.styleElement.type="text/css",l.DomHandler.setAttribute(this.styleElement,"nonce",null===(e=this.$primevue)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.csp)||void 0===e?void 0:e.nonce),document.head.appendChild(this.styleElement);var t="";for(var n in this.breakpoints)t+="\n @media screen and (max-width: ".concat(n,") {\n .p-dialog[").concat(this.attributeSelector,"] {\n width: ").concat(this.breakpoints[n]," !important;\n }\n }\n ");this.styleElement.innerHTML=t}},destroyStyle:function(){this.styleElement&&(document.head.removeChild(this.styleElement),this.styleElement=null)},initDrag:function(e){"icons"!==e.target.closest("div").getAttribute("data-pc-section")&&this.draggable&&(this.dragging=!0,this.lastPageX=e.pageX,this.lastPageY=e.pageY,this.container.style.margin="0",document.body.setAttribute("data-p-unselectable-text","true"),!this.isUnstyled&&l.DomHandler.addClass(document.body,"p-unselectable-text"))},bindGlobalListeners:function(){this.draggable&&(this.bindDocumentDragListener(),this.bindDocumentDragEndListener()),this.closeOnEscape&&this.closable&&this.bindDocumentKeyDownListener()},unbindGlobalListeners:function(){this.unbindDocumentDragListener(),this.unbindDocumentDragEndListener(),this.unbindDocumentKeyDownListener()},bindDocumentDragListener:function(){var e=this;this.documentDragListener=function(t){if(e.dragging){var n=l.DomHandler.getOuterWidth(e.container),o=l.DomHandler.getOuterHeight(e.container),i=t.pageX-e.lastPageX,a=t.pageY-e.lastPageY,r=e.container.getBoundingClientRect(),s=r.left+i,c=r.top+a,u=l.DomHandler.getViewport(),m=getComputedStyle(e.container),d=parseFloat(m.marginLeft),p=parseFloat(m.marginTop);e.container.style.position="fixed",e.keepInViewport?(s>=e.minX&&s+n<u.width&&(e.lastPageX=t.pageX,e.container.style.left=s-d+"px"),c>=e.minY&&c+o<u.height&&(e.lastPageY=t.pageY,e.container.style.top=c-p+"px")):(e.lastPageX=t.pageX,e.container.style.left=s-d+"px",e.lastPageY=t.pageY,e.container.style.top=c-p+"px")}},window.document.addEventListener("mousemove",this.documentDragListener)},unbindDocumentDragListener:function(){this.documentDragListener&&(window.document.removeEventListener("mousemove",this.documentDragListener),this.documentDragListener=null)},bindDocumentDragEndListener:function(){var e=this;this.documentDragEndListener=function(t){e.dragging&&(e.dragging=!1,document.body.removeAttribute("data-p-unselectable-text"),!e.isUnstyled&&l.DomHandler.removeClass(document.body,"p-unselectable-text"),e.$emit("dragend",t))},window.document.addEventListener("mouseup",this.documentDragEndListener)},unbindDocumentDragEndListener:function(){this.documentDragEndListener&&(window.document.removeEventListener("mouseup",this.documentDragEndListener),this.documentDragEndListener=null)}},computed:{maximizeIconComponent:function(){return this.maximized?this.minimizeIcon?"span":"WindowMinimizeIcon":this.maximizeIcon?"span":"WindowMaximizeIcon"},ariaLabelledById:function(){return null!=this.header||null!==this.$attrs["aria-labelledby"]?this.id+"_header":null},closeAriaLabel:function(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0},attributeSelector:function(){return l.UniqueComponentId()}},directives:{ripple:b.default,focustrap:m.default},components:{Portal:h.default,WindowMinimizeIcon:f.default,WindowMaximizeIcon:p.default,TimesIcon:d.default}};function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach((function(t){k(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function k(e,t,n){var o;return(t="symbol"==g(o=D(t,"string"))?o:String(o))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e,t){if("object"!=g(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=g(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var B=["aria-labelledby","aria-modal"],w=["id"],L=["autofocus","tabindex"],z=["autofocus","aria-label"];y.render=function(e,t,n,o,i,a){var l=r.resolveComponent("Portal"),s=r.resolveDirective("ripple"),c=r.resolveDirective("focustrap");return r.openBlock(),r.createBlock(l,{appendTo:e.appendTo},{default:r.withCtx((function(){return[i.containerVisible?(r.openBlock(),r.createElementBlock("div",r.mergeProps({key:0,ref:a.maskRef,class:e.cx("mask"),style:e.sx("mask",!0,{position:e.position,modal:e.modal}),onClick:t[3]||(t[3]=function(){return a.onMaskClick&&a.onMaskClick.apply(a,arguments)})},e.ptm("mask")),[r.createVNode(r.Transition,r.mergeProps({name:"p-dialog",onBeforeEnter:a.onBeforeEnter,onEnter:a.onEnter,onBeforeLeave:a.onBeforeLeave,onLeave:a.onLeave,onAfterLeave:a.onAfterLeave,appear:""},e.ptm("transition")),{default:r.withCtx((function(){return[e.visible?r.withDirectives((r.openBlock(),r.createElementBlock("div",r.mergeProps({key:0,ref:a.containerRef,class:e.cx("root"),style:e.sx("root"),role:"dialog","aria-labelledby":a.ariaLabelledById,"aria-modal":e.modal},e.ptmi("root")),[e.$slots.container?r.renderSlot(e.$slots,"container",{key:0,onClose:a.close,onMaximize:function(e){return a.maximize(e)},closeCallback:a.close,maximizeCallback:function(e){return a.maximize(e)}}):(r.openBlock(),r.createElementBlock(r.Fragment,{key:1},[e.showHeader?(r.openBlock(),r.createElementBlock("div",r.mergeProps({key:0,ref:a.headerContainerRef,class:e.cx("header"),onMousedown:t[2]||(t[2]=function(){return a.initDrag&&a.initDrag.apply(a,arguments)})},e.ptm("header")),[r.renderSlot(e.$slots,"header",{class:r.normalizeClass(e.cx("title"))},(function(){return[e.header?(r.openBlock(),r.createElementBlock("span",r.mergeProps({key:0,id:a.ariaLabelledById,class:e.cx("title")},e.ptm("title")),r.toDisplayString(e.header),17,w)):r.createCommentVNode("",!0)]})),r.createElementVNode("div",r.mergeProps({class:e.cx("icons")},e.ptm("icons")),[e.maximizable?r.withDirectives((r.openBlock(),r.createElementBlock("button",r.mergeProps({key:0,ref:a.maximizableRef,autofocus:i.focusableMax,class:e.cx("maximizableButton"),onClick:t[0]||(t[0]=function(){return a.maximize&&a.maximize.apply(a,arguments)}),type:"button",tabindex:e.maximizable?"0":"-1"},e.ptm("maximizableButton"),{"data-pc-group-section":"headericon"}),[r.renderSlot(e.$slots,"maximizeicon",{maximized:i.maximized,class:r.normalizeClass(e.cx("maximizableIcon"))},(function(){return[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(a.maximizeIconComponent),r.mergeProps({class:[e.cx("maximizableIcon"),i.maximized?e.minimizeIcon:e.maximizeIcon]},e.ptm("maximizableIcon")),null,16,["class"]))]}))],16,L)),[[s]]):r.createCommentVNode("",!0),e.closable?r.withDirectives((r.openBlock(),r.createElementBlock("button",r.mergeProps({key:1,ref:a.closeButtonRef,autofocus:i.focusableClose,class:e.cx("closeButton"),onClick:t[1]||(t[1]=function(){return a.close&&a.close.apply(a,arguments)}),"aria-label":a.closeAriaLabel,type:"button"},x(x({},e.closeButtonProps),e.ptm("closeButton")),{"data-pc-group-section":"headericon"}),[r.renderSlot(e.$slots,"closeicon",{class:r.normalizeClass(e.cx("closeButtonIcon"))},(function(){return[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(e.closeIcon?"span":"TimesIcon"),r.mergeProps({class:[e.cx("closeButtonIcon"),e.closeIcon]},e.ptm("closeButtonIcon")),null,16,["class"]))]}))],16,z)),[[s]]):r.createCommentVNode("",!0)],16)],16)):r.createCommentVNode("",!0),r.createElementVNode("div",r.mergeProps({ref:a.contentRef,class:[e.cx("content"),e.contentClass],style:e.contentStyle},x(x({},e.contentProps),e.ptm("content"))),[r.renderSlot(e.$slots,"default")],16),e.footer||e.$slots.footer?(r.openBlock(),r.createElementBlock("div",r.mergeProps({key:1,ref:a.footerContainerRef,class:e.cx("footer")},e.ptm("footer")),[r.renderSlot(e.$slots,"footer",{},(function(){return[r.createTextVNode(r.toDisplayString(e.footer),1)]}))],16)):r.createCommentVNode("",!0)],64))],16,B)),[[c,{disabled:!e.modal}]]):r.createCommentVNode("",!0)]})),_:3},16,["onBeforeEnter","onEnter","onBeforeLeave","onLeave","onAfterLeave"])],16)):r.createCommentVNode("",!0)]})),_:3},8,["appendTo"])},module.exports=y;
|
package/dialog/dialog.esm.js
CHANGED
|
@@ -150,7 +150,8 @@ var script = {
|
|
|
150
150
|
containerVisible: this.visible,
|
|
151
151
|
maximized: false,
|
|
152
152
|
focusableMax: null,
|
|
153
|
-
focusableClose: null
|
|
153
|
+
focusableClose: null,
|
|
154
|
+
target: null
|
|
154
155
|
};
|
|
155
156
|
},
|
|
156
157
|
watch: {
|
|
@@ -202,6 +203,7 @@ var script = {
|
|
|
202
203
|
},
|
|
203
204
|
onEnter: function onEnter() {
|
|
204
205
|
this.$emit('show');
|
|
206
|
+
this.target = document.activeElement;
|
|
205
207
|
this.focus();
|
|
206
208
|
this.enableDocumentSettings();
|
|
207
209
|
this.bindGlobalListeners();
|
|
@@ -216,6 +218,8 @@ var script = {
|
|
|
216
218
|
},
|
|
217
219
|
onLeave: function onLeave() {
|
|
218
220
|
this.$emit('hide');
|
|
221
|
+
DomHandler.focus(this.target);
|
|
222
|
+
this.target = null;
|
|
219
223
|
this.focusableClose = null;
|
|
220
224
|
this.focusableMax = null;
|
|
221
225
|
},
|
package/dialog/dialog.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"primevue/focustrap";import t from"primevue/icons/times";import n from"primevue/icons/windowmaximize";import i from"primevue/icons/windowminimize";import o from"primevue/portal";import a from"primevue/ripple";import{UniqueComponentId as s,ZIndexUtils as l,DomHandler as r}from"primevue/utils";import{computed as c,resolveComponent as u,resolveDirective as m,openBlock as d,createBlock as f,withCtx as p,createElementBlock as h,mergeProps as b,createVNode as y,Transition as g,withDirectives as v,renderSlot as x,Fragment as L,normalizeClass as w,toDisplayString as z,createCommentVNode as k,createElementVNode as D,resolveDynamicComponent as B,createTextVNode as E}from"vue";import S from"primevue/basecomponent";import I from"primevue/dialog/style";var C={name:"Dialog",extends:{name:"BaseDialog",extends:S,props:{header:{type:null,default:null},footer:{type:null,default:null},visible:{type:Boolean,default:!1},modal:{type:Boolean,default:null},contentStyle:{type:null,default:null},contentClass:{type:String,default:null},contentProps:{type:null,default:null},rtl:{type:Boolean,default:null},maximizable:{type:Boolean,default:!1},dismissableMask:{type:Boolean,default:!1},closable:{type:Boolean,default:!0},closeOnEscape:{type:Boolean,default:!0},showHeader:{type:Boolean,default:!0},blockScroll:{type:Boolean,default:!1},baseZIndex:{type:Number,default:0},autoZIndex:{type:Boolean,default:!0},position:{type:String,default:"center"},breakpoints:{type:Object,default:null},draggable:{type:Boolean,default:!0},keepInViewport:{type:Boolean,default:!0},minX:{type:Number,default:0},minY:{type:Number,default:0},appendTo:{type:[String,Object],default:"body"},closeIcon:{type:String,default:void 0},maximizeIcon:{type:String,default:void 0},minimizeIcon:{type:String,default:void 0},closeButtonProps:{type:null,default:null},_instance:null},style:I,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,emits:["update:visible","show","hide","after-hide","maximize","unmaximize","dragend"],provide:function(){var e=this;return{dialogRef:c((function(){return e._instance}))}},data:function(){return{id:this.$attrs.id,containerVisible:this.visible,maximized:!1,focusableMax:null,focusableClose:null}},watch:{"$attrs.id":function(e){this.id=e||s()}},documentKeydownListener:null,container:null,mask:null,content:null,headerContainer:null,footerContainer:null,maximizableButton:null,closeButton:null,styleElement:null,dragging:null,documentDragListener:null,documentDragEndListener:null,lastPageX:null,lastPageY:null,updated:function(){this.visible&&(this.containerVisible=this.visible)},beforeUnmount:function(){this.unbindDocumentState(),this.unbindGlobalListeners(),this.destroyStyle(),this.mask&&this.autoZIndex&&l.clear(this.mask),this.container=null,this.mask=null},mounted:function(){this.id=this.id||s(),this.breakpoints&&this.createStyle()},methods:{close:function(){this.$emit("update:visible",!1)},onBeforeEnter:function(e){e.setAttribute(this.attributeSelector,"")},onEnter:function(){this.$emit("show"),this.focus(),this.enableDocumentSettings(),this.bindGlobalListeners(),this.autoZIndex&&l.set("modal",this.mask,this.baseZIndex+this.$primevue.config.zIndex.modal)},onBeforeLeave:function(){this.modal&&!this.isUnstyled&&r.addClass(this.mask,"p-component-overlay-leave")},onLeave:function(){this.$emit("hide"),this.focusableClose=null,this.focusableMax=null},onAfterLeave:function(){this.autoZIndex&&l.clear(this.mask),this.containerVisible=!1,this.unbindDocumentState(),this.unbindGlobalListeners(),this.$emit("after-hide")},onMaskClick:function(e){this.dismissableMask&&this.modal&&this.mask===e.target&&this.close()},focus:function(){var e=function(e){return e&&e.querySelector("[autofocus]")},t=this.$slots.footer&&e(this.footerContainer);t||(t=this.$slots.header&&e(this.headerContainer))||(t=this.$slots.default&&e(this.content))||(this.maximizable?(this.focusableMax=!0,t=this.maximizableButton):(this.focusableClose=!0,t=this.closeButton)),t&&r.focus(t,{focusVisible:!0})},maximize:function(e){this.maximized?(this.maximized=!1,this.$emit("unmaximize",e)):(this.maximized=!0,this.$emit("maximize",e)),this.modal||(this.maximized?r.blockBodyScroll():r.unblockBodyScroll())},enableDocumentSettings:function(){(this.modal||!this.modal&&this.blockScroll||this.maximizable&&this.maximized)&&r.blockBodyScroll()},unbindDocumentState:function(){(this.modal||!this.modal&&this.blockScroll||this.maximizable&&this.maximized)&&r.unblockBodyScroll()},onKeyDown:function(e){"Escape"===e.code&&this.closeOnEscape&&this.close()},bindDocumentKeyDownListener:function(){this.documentKeydownListener||(this.documentKeydownListener=this.onKeyDown.bind(this),window.document.addEventListener("keydown",this.documentKeydownListener))},unbindDocumentKeyDownListener:function(){this.documentKeydownListener&&(window.document.removeEventListener("keydown",this.documentKeydownListener),this.documentKeydownListener=null)},containerRef:function(e){this.container=e},maskRef:function(e){this.mask=e},contentRef:function(e){this.content=e},headerContainerRef:function(e){this.headerContainer=e},footerContainerRef:function(e){this.footerContainer=e},maximizableRef:function(e){this.maximizableButton=e},closeButtonRef:function(e){this.closeButton=e},createStyle:function(){if(!this.styleElement&&!this.isUnstyled){var e;this.styleElement=document.createElement("style"),this.styleElement.type="text/css",r.setAttribute(this.styleElement,"nonce",null===(e=this.$primevue)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.csp)||void 0===e?void 0:e.nonce),document.head.appendChild(this.styleElement);var t="";for(var n in this.breakpoints)t+="\n @media screen and (max-width: ".concat(n,") {\n .p-dialog[").concat(this.attributeSelector,"] {\n width: ").concat(this.breakpoints[n]," !important;\n }\n }\n ");this.styleElement.innerHTML=t}},destroyStyle:function(){this.styleElement&&(document.head.removeChild(this.styleElement),this.styleElement=null)},initDrag:function(e){"icons"!==e.target.closest("div").getAttribute("data-pc-section")&&this.draggable&&(this.dragging=!0,this.lastPageX=e.pageX,this.lastPageY=e.pageY,this.container.style.margin="0",document.body.setAttribute("data-p-unselectable-text","true"),!this.isUnstyled&&r.addClass(document.body,"p-unselectable-text"))},bindGlobalListeners:function(){this.draggable&&(this.bindDocumentDragListener(),this.bindDocumentDragEndListener()),this.closeOnEscape&&this.closable&&this.bindDocumentKeyDownListener()},unbindGlobalListeners:function(){this.unbindDocumentDragListener(),this.unbindDocumentDragEndListener(),this.unbindDocumentKeyDownListener()},bindDocumentDragListener:function(){var e=this;this.documentDragListener=function(t){if(e.dragging){var n=r.getOuterWidth(e.container),i=r.getOuterHeight(e.container),o=t.pageX-e.lastPageX,a=t.pageY-e.lastPageY,s=e.container.getBoundingClientRect(),l=s.left+o,c=s.top+a,u=r.getViewport(),m=getComputedStyle(e.container),d=parseFloat(m.marginLeft),f=parseFloat(m.marginTop);e.container.style.position="fixed",e.keepInViewport?(l>=e.minX&&l+n<u.width&&(e.lastPageX=t.pageX,e.container.style.left=l-d+"px"),c>=e.minY&&c+i<u.height&&(e.lastPageY=t.pageY,e.container.style.top=c-f+"px")):(e.lastPageX=t.pageX,e.container.style.left=l-d+"px",e.lastPageY=t.pageY,e.container.style.top=c-f+"px")}},window.document.addEventListener("mousemove",this.documentDragListener)},unbindDocumentDragListener:function(){this.documentDragListener&&(window.document.removeEventListener("mousemove",this.documentDragListener),this.documentDragListener=null)},bindDocumentDragEndListener:function(){var e=this;this.documentDragEndListener=function(t){e.dragging&&(e.dragging=!1,document.body.removeAttribute("data-p-unselectable-text"),!e.isUnstyled&&r.removeClass(document.body,"p-unselectable-text"),e.$emit("dragend",t))},window.document.addEventListener("mouseup",this.documentDragEndListener)},unbindDocumentDragEndListener:function(){this.documentDragEndListener&&(window.document.removeEventListener("mouseup",this.documentDragEndListener),this.documentDragEndListener=null)}},computed:{maximizeIconComponent:function(){return this.maximized?this.minimizeIcon?"span":"WindowMinimizeIcon":this.maximizeIcon?"span":"WindowMaximizeIcon"},ariaLabelledById:function(){return null!=this.header||null!==this.$attrs["aria-labelledby"]?this.id+"_header":null},closeAriaLabel:function(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0},attributeSelector:function(){return s()}},directives:{ripple:a,focustrap:e},components:{Portal:o,WindowMinimizeIcon:i,WindowMaximizeIcon:n,TimesIcon:t}};function P(e){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P(e)}function $(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$(Object(n),!0).forEach((function(t){j(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function j(e,t,n){var i;return(t="symbol"==P(i=M(t,"string"))?i:String(i))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function M(e,t){if("object"!=P(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=P(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var R=["aria-labelledby","aria-modal"],K=["id"],A=["autofocus","tabindex"],X=["autofocus","aria-label"];C.render=function(e,t,n,i,o,a){var s=u("Portal"),l=m("ripple"),r=m("focustrap");return d(),f(s,{appendTo:e.appendTo},{default:p((function(){return[o.containerVisible?(d(),h("div",b({key:0,ref:a.maskRef,class:e.cx("mask"),style:e.sx("mask",!0,{position:e.position,modal:e.modal}),onClick:t[3]||(t[3]=function(){return a.onMaskClick&&a.onMaskClick.apply(a,arguments)})},e.ptm("mask")),[y(g,b({name:"p-dialog",onBeforeEnter:a.onBeforeEnter,onEnter:a.onEnter,onBeforeLeave:a.onBeforeLeave,onLeave:a.onLeave,onAfterLeave:a.onAfterLeave,appear:""},e.ptm("transition")),{default:p((function(){return[e.visible?v((d(),h("div",b({key:0,ref:a.containerRef,class:e.cx("root"),style:e.sx("root"),role:"dialog","aria-labelledby":a.ariaLabelledById,"aria-modal":e.modal},e.ptmi("root")),[e.$slots.container?x(e.$slots,"container",{key:0,onClose:a.close,onMaximize:function(e){return a.maximize(e)},closeCallback:a.close,maximizeCallback:function(e){return a.maximize(e)}}):(d(),h(L,{key:1},[e.showHeader?(d(),h("div",b({key:0,ref:a.headerContainerRef,class:e.cx("header"),onMousedown:t[2]||(t[2]=function(){return a.initDrag&&a.initDrag.apply(a,arguments)})},e.ptm("header")),[x(e.$slots,"header",{class:w(e.cx("title"))},(function(){return[e.header?(d(),h("span",b({key:0,id:a.ariaLabelledById,class:e.cx("title")},e.ptm("title")),z(e.header),17,K)):k("",!0)]})),D("div",b({class:e.cx("icons")},e.ptm("icons")),[e.maximizable?v((d(),h("button",b({key:0,ref:a.maximizableRef,autofocus:o.focusableMax,class:e.cx("maximizableButton"),onClick:t[0]||(t[0]=function(){return a.maximize&&a.maximize.apply(a,arguments)}),type:"button",tabindex:e.maximizable?"0":"-1"},e.ptm("maximizableButton"),{"data-pc-group-section":"headericon"}),[x(e.$slots,"maximizeicon",{maximized:o.maximized,class:w(e.cx("maximizableIcon"))},(function(){return[(d(),f(B(a.maximizeIconComponent),b({class:[e.cx("maximizableIcon"),o.maximized?e.minimizeIcon:e.maximizeIcon]},e.ptm("maximizableIcon")),null,16,["class"]))]}))],16,A)),[[l]]):k("",!0),e.closable?v((d(),h("button",b({key:1,ref:a.closeButtonRef,autofocus:o.focusableClose,class:e.cx("closeButton"),onClick:t[1]||(t[1]=function(){return a.close&&a.close.apply(a,arguments)}),"aria-label":a.closeAriaLabel,type:"button"},O(O({},e.closeButtonProps),e.ptm("closeButton")),{"data-pc-group-section":"headericon"}),[x(e.$slots,"closeicon",{class:w(e.cx("closeButtonIcon"))},(function(){return[(d(),f(B(e.closeIcon?"span":"TimesIcon"),b({class:[e.cx("closeButtonIcon"),e.closeIcon]},e.ptm("closeButtonIcon")),null,16,["class"]))]}))],16,X)),[[l]]):k("",!0)],16)],16)):k("",!0),D("div",b({ref:a.contentRef,class:[e.cx("content"),e.contentClass],style:e.contentStyle},O(O({},e.contentProps),e.ptm("content"))),[x(e.$slots,"default")],16),e.footer||e.$slots.footer?(d(),h("div",b({key:1,ref:a.footerContainerRef,class:e.cx("footer")},e.ptm("footer")),[x(e.$slots,"footer",{},(function(){return[E(z(e.footer),1)]}))],16)):k("",!0)],64))],16,R)),[[r,{disabled:!e.modal}]]):k("",!0)]})),_:3},16,["onBeforeEnter","onEnter","onBeforeLeave","onLeave","onAfterLeave"])],16)):k("",!0)]})),_:3},8,["appendTo"])};export{C as default};
|
|
1
|
+
import e from"primevue/focustrap";import t from"primevue/icons/times";import n from"primevue/icons/windowmaximize";import i from"primevue/icons/windowminimize";import o from"primevue/portal";import a from"primevue/ripple";import{UniqueComponentId as s,ZIndexUtils as l,DomHandler as r}from"primevue/utils";import{computed as c,resolveComponent as u,resolveDirective as m,openBlock as d,createBlock as f,withCtx as p,createElementBlock as h,mergeProps as b,createVNode as y,Transition as g,withDirectives as v,renderSlot as x,Fragment as L,normalizeClass as w,toDisplayString as z,createCommentVNode as k,createElementVNode as D,resolveDynamicComponent as B,createTextVNode as E}from"vue";import S from"primevue/basecomponent";import I from"primevue/dialog/style";var C={name:"Dialog",extends:{name:"BaseDialog",extends:S,props:{header:{type:null,default:null},footer:{type:null,default:null},visible:{type:Boolean,default:!1},modal:{type:Boolean,default:null},contentStyle:{type:null,default:null},contentClass:{type:String,default:null},contentProps:{type:null,default:null},rtl:{type:Boolean,default:null},maximizable:{type:Boolean,default:!1},dismissableMask:{type:Boolean,default:!1},closable:{type:Boolean,default:!0},closeOnEscape:{type:Boolean,default:!0},showHeader:{type:Boolean,default:!0},blockScroll:{type:Boolean,default:!1},baseZIndex:{type:Number,default:0},autoZIndex:{type:Boolean,default:!0},position:{type:String,default:"center"},breakpoints:{type:Object,default:null},draggable:{type:Boolean,default:!0},keepInViewport:{type:Boolean,default:!0},minX:{type:Number,default:0},minY:{type:Number,default:0},appendTo:{type:[String,Object],default:"body"},closeIcon:{type:String,default:void 0},maximizeIcon:{type:String,default:void 0},minimizeIcon:{type:String,default:void 0},closeButtonProps:{type:null,default:null},_instance:null},style:I,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,emits:["update:visible","show","hide","after-hide","maximize","unmaximize","dragend"],provide:function(){var e=this;return{dialogRef:c((function(){return e._instance}))}},data:function(){return{id:this.$attrs.id,containerVisible:this.visible,maximized:!1,focusableMax:null,focusableClose:null,target:null}},watch:{"$attrs.id":function(e){this.id=e||s()}},documentKeydownListener:null,container:null,mask:null,content:null,headerContainer:null,footerContainer:null,maximizableButton:null,closeButton:null,styleElement:null,dragging:null,documentDragListener:null,documentDragEndListener:null,lastPageX:null,lastPageY:null,updated:function(){this.visible&&(this.containerVisible=this.visible)},beforeUnmount:function(){this.unbindDocumentState(),this.unbindGlobalListeners(),this.destroyStyle(),this.mask&&this.autoZIndex&&l.clear(this.mask),this.container=null,this.mask=null},mounted:function(){this.id=this.id||s(),this.breakpoints&&this.createStyle()},methods:{close:function(){this.$emit("update:visible",!1)},onBeforeEnter:function(e){e.setAttribute(this.attributeSelector,"")},onEnter:function(){this.$emit("show"),this.target=document.activeElement,this.focus(),this.enableDocumentSettings(),this.bindGlobalListeners(),this.autoZIndex&&l.set("modal",this.mask,this.baseZIndex+this.$primevue.config.zIndex.modal)},onBeforeLeave:function(){this.modal&&!this.isUnstyled&&r.addClass(this.mask,"p-component-overlay-leave")},onLeave:function(){this.$emit("hide"),r.focus(this.target),this.target=null,this.focusableClose=null,this.focusableMax=null},onAfterLeave:function(){this.autoZIndex&&l.clear(this.mask),this.containerVisible=!1,this.unbindDocumentState(),this.unbindGlobalListeners(),this.$emit("after-hide")},onMaskClick:function(e){this.dismissableMask&&this.modal&&this.mask===e.target&&this.close()},focus:function(){var e=function(e){return e&&e.querySelector("[autofocus]")},t=this.$slots.footer&&e(this.footerContainer);t||(t=this.$slots.header&&e(this.headerContainer))||(t=this.$slots.default&&e(this.content))||(this.maximizable?(this.focusableMax=!0,t=this.maximizableButton):(this.focusableClose=!0,t=this.closeButton)),t&&r.focus(t,{focusVisible:!0})},maximize:function(e){this.maximized?(this.maximized=!1,this.$emit("unmaximize",e)):(this.maximized=!0,this.$emit("maximize",e)),this.modal||(this.maximized?r.blockBodyScroll():r.unblockBodyScroll())},enableDocumentSettings:function(){(this.modal||!this.modal&&this.blockScroll||this.maximizable&&this.maximized)&&r.blockBodyScroll()},unbindDocumentState:function(){(this.modal||!this.modal&&this.blockScroll||this.maximizable&&this.maximized)&&r.unblockBodyScroll()},onKeyDown:function(e){"Escape"===e.code&&this.closeOnEscape&&this.close()},bindDocumentKeyDownListener:function(){this.documentKeydownListener||(this.documentKeydownListener=this.onKeyDown.bind(this),window.document.addEventListener("keydown",this.documentKeydownListener))},unbindDocumentKeyDownListener:function(){this.documentKeydownListener&&(window.document.removeEventListener("keydown",this.documentKeydownListener),this.documentKeydownListener=null)},containerRef:function(e){this.container=e},maskRef:function(e){this.mask=e},contentRef:function(e){this.content=e},headerContainerRef:function(e){this.headerContainer=e},footerContainerRef:function(e){this.footerContainer=e},maximizableRef:function(e){this.maximizableButton=e},closeButtonRef:function(e){this.closeButton=e},createStyle:function(){if(!this.styleElement&&!this.isUnstyled){var e;this.styleElement=document.createElement("style"),this.styleElement.type="text/css",r.setAttribute(this.styleElement,"nonce",null===(e=this.$primevue)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.csp)||void 0===e?void 0:e.nonce),document.head.appendChild(this.styleElement);var t="";for(var n in this.breakpoints)t+="\n @media screen and (max-width: ".concat(n,") {\n .p-dialog[").concat(this.attributeSelector,"] {\n width: ").concat(this.breakpoints[n]," !important;\n }\n }\n ");this.styleElement.innerHTML=t}},destroyStyle:function(){this.styleElement&&(document.head.removeChild(this.styleElement),this.styleElement=null)},initDrag:function(e){"icons"!==e.target.closest("div").getAttribute("data-pc-section")&&this.draggable&&(this.dragging=!0,this.lastPageX=e.pageX,this.lastPageY=e.pageY,this.container.style.margin="0",document.body.setAttribute("data-p-unselectable-text","true"),!this.isUnstyled&&r.addClass(document.body,"p-unselectable-text"))},bindGlobalListeners:function(){this.draggable&&(this.bindDocumentDragListener(),this.bindDocumentDragEndListener()),this.closeOnEscape&&this.closable&&this.bindDocumentKeyDownListener()},unbindGlobalListeners:function(){this.unbindDocumentDragListener(),this.unbindDocumentDragEndListener(),this.unbindDocumentKeyDownListener()},bindDocumentDragListener:function(){var e=this;this.documentDragListener=function(t){if(e.dragging){var n=r.getOuterWidth(e.container),i=r.getOuterHeight(e.container),o=t.pageX-e.lastPageX,a=t.pageY-e.lastPageY,s=e.container.getBoundingClientRect(),l=s.left+o,c=s.top+a,u=r.getViewport(),m=getComputedStyle(e.container),d=parseFloat(m.marginLeft),f=parseFloat(m.marginTop);e.container.style.position="fixed",e.keepInViewport?(l>=e.minX&&l+n<u.width&&(e.lastPageX=t.pageX,e.container.style.left=l-d+"px"),c>=e.minY&&c+i<u.height&&(e.lastPageY=t.pageY,e.container.style.top=c-f+"px")):(e.lastPageX=t.pageX,e.container.style.left=l-d+"px",e.lastPageY=t.pageY,e.container.style.top=c-f+"px")}},window.document.addEventListener("mousemove",this.documentDragListener)},unbindDocumentDragListener:function(){this.documentDragListener&&(window.document.removeEventListener("mousemove",this.documentDragListener),this.documentDragListener=null)},bindDocumentDragEndListener:function(){var e=this;this.documentDragEndListener=function(t){e.dragging&&(e.dragging=!1,document.body.removeAttribute("data-p-unselectable-text"),!e.isUnstyled&&r.removeClass(document.body,"p-unselectable-text"),e.$emit("dragend",t))},window.document.addEventListener("mouseup",this.documentDragEndListener)},unbindDocumentDragEndListener:function(){this.documentDragEndListener&&(window.document.removeEventListener("mouseup",this.documentDragEndListener),this.documentDragEndListener=null)}},computed:{maximizeIconComponent:function(){return this.maximized?this.minimizeIcon?"span":"WindowMinimizeIcon":this.maximizeIcon?"span":"WindowMaximizeIcon"},ariaLabelledById:function(){return null!=this.header||null!==this.$attrs["aria-labelledby"]?this.id+"_header":null},closeAriaLabel:function(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0},attributeSelector:function(){return s()}},directives:{ripple:a,focustrap:e},components:{Portal:o,WindowMinimizeIcon:i,WindowMaximizeIcon:n,TimesIcon:t}};function P(e){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P(e)}function $(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$(Object(n),!0).forEach((function(t){j(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function j(e,t,n){var i;return(t="symbol"==P(i=M(t,"string"))?i:String(i))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function M(e,t){if("object"!=P(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=P(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var R=["aria-labelledby","aria-modal"],K=["id"],A=["autofocus","tabindex"],X=["autofocus","aria-label"];C.render=function(e,t,n,i,o,a){var s=u("Portal"),l=m("ripple"),r=m("focustrap");return d(),f(s,{appendTo:e.appendTo},{default:p((function(){return[o.containerVisible?(d(),h("div",b({key:0,ref:a.maskRef,class:e.cx("mask"),style:e.sx("mask",!0,{position:e.position,modal:e.modal}),onClick:t[3]||(t[3]=function(){return a.onMaskClick&&a.onMaskClick.apply(a,arguments)})},e.ptm("mask")),[y(g,b({name:"p-dialog",onBeforeEnter:a.onBeforeEnter,onEnter:a.onEnter,onBeforeLeave:a.onBeforeLeave,onLeave:a.onLeave,onAfterLeave:a.onAfterLeave,appear:""},e.ptm("transition")),{default:p((function(){return[e.visible?v((d(),h("div",b({key:0,ref:a.containerRef,class:e.cx("root"),style:e.sx("root"),role:"dialog","aria-labelledby":a.ariaLabelledById,"aria-modal":e.modal},e.ptmi("root")),[e.$slots.container?x(e.$slots,"container",{key:0,onClose:a.close,onMaximize:function(e){return a.maximize(e)},closeCallback:a.close,maximizeCallback:function(e){return a.maximize(e)}}):(d(),h(L,{key:1},[e.showHeader?(d(),h("div",b({key:0,ref:a.headerContainerRef,class:e.cx("header"),onMousedown:t[2]||(t[2]=function(){return a.initDrag&&a.initDrag.apply(a,arguments)})},e.ptm("header")),[x(e.$slots,"header",{class:w(e.cx("title"))},(function(){return[e.header?(d(),h("span",b({key:0,id:a.ariaLabelledById,class:e.cx("title")},e.ptm("title")),z(e.header),17,K)):k("",!0)]})),D("div",b({class:e.cx("icons")},e.ptm("icons")),[e.maximizable?v((d(),h("button",b({key:0,ref:a.maximizableRef,autofocus:o.focusableMax,class:e.cx("maximizableButton"),onClick:t[0]||(t[0]=function(){return a.maximize&&a.maximize.apply(a,arguments)}),type:"button",tabindex:e.maximizable?"0":"-1"},e.ptm("maximizableButton"),{"data-pc-group-section":"headericon"}),[x(e.$slots,"maximizeicon",{maximized:o.maximized,class:w(e.cx("maximizableIcon"))},(function(){return[(d(),f(B(a.maximizeIconComponent),b({class:[e.cx("maximizableIcon"),o.maximized?e.minimizeIcon:e.maximizeIcon]},e.ptm("maximizableIcon")),null,16,["class"]))]}))],16,A)),[[l]]):k("",!0),e.closable?v((d(),h("button",b({key:1,ref:a.closeButtonRef,autofocus:o.focusableClose,class:e.cx("closeButton"),onClick:t[1]||(t[1]=function(){return a.close&&a.close.apply(a,arguments)}),"aria-label":a.closeAriaLabel,type:"button"},O(O({},e.closeButtonProps),e.ptm("closeButton")),{"data-pc-group-section":"headericon"}),[x(e.$slots,"closeicon",{class:w(e.cx("closeButtonIcon"))},(function(){return[(d(),f(B(e.closeIcon?"span":"TimesIcon"),b({class:[e.cx("closeButtonIcon"),e.closeIcon]},e.ptm("closeButtonIcon")),null,16,["class"]))]}))],16,X)),[[l]]):k("",!0)],16)],16)):k("",!0),D("div",b({ref:a.contentRef,class:[e.cx("content"),e.contentClass],style:e.contentStyle},O(O({},e.contentProps),e.ptm("content"))),[x(e.$slots,"default")],16),e.footer||e.$slots.footer?(d(),h("div",b({key:1,ref:a.footerContainerRef,class:e.cx("footer")},e.ptm("footer")),[x(e.$slots,"footer",{},(function(){return[E(z(e.footer),1)]}))],16)):k("",!0)],64))],16,R)),[[r,{disabled:!e.modal}]]):k("",!0)]})),_:3},16,["onBeforeEnter","onEnter","onBeforeLeave","onLeave","onAfterLeave"])],16)):k("",!0)]})),_:3},8,["appendTo"])};export{C as default};
|
package/dialog/dialog.js
CHANGED
|
@@ -154,7 +154,8 @@ this.primevue.dialog = (function (FocusTrap, TimesIcon, WindowMaximizeIcon, Wind
|
|
|
154
154
|
containerVisible: this.visible,
|
|
155
155
|
maximized: false,
|
|
156
156
|
focusableMax: null,
|
|
157
|
-
focusableClose: null
|
|
157
|
+
focusableClose: null,
|
|
158
|
+
target: null
|
|
158
159
|
};
|
|
159
160
|
},
|
|
160
161
|
watch: {
|
|
@@ -206,6 +207,7 @@ this.primevue.dialog = (function (FocusTrap, TimesIcon, WindowMaximizeIcon, Wind
|
|
|
206
207
|
},
|
|
207
208
|
onEnter: function onEnter() {
|
|
208
209
|
this.$emit('show');
|
|
210
|
+
this.target = document.activeElement;
|
|
209
211
|
this.focus();
|
|
210
212
|
this.enableDocumentSettings();
|
|
211
213
|
this.bindGlobalListeners();
|
|
@@ -220,6 +222,8 @@ this.primevue.dialog = (function (FocusTrap, TimesIcon, WindowMaximizeIcon, Wind
|
|
|
220
222
|
},
|
|
221
223
|
onLeave: function onLeave() {
|
|
222
224
|
this.$emit('hide');
|
|
225
|
+
utils.DomHandler.focus(this.target);
|
|
226
|
+
this.target = null;
|
|
223
227
|
this.focusableClose = null;
|
|
224
228
|
this.focusableMax = null;
|
|
225
229
|
},
|
package/dialog/dialog.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
this.primevue=this.primevue||{},this.primevue.dialog=function(e,t,n,o,i,a,l,s,r,c){"use strict";function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=u(e),d=u(t),p=u(n),f=u(o),h=u(i),b=u(a),y={name:"Dialog",extends:{name:"BaseDialog",extends:u(r).default,props:{header:{type:null,default:null},footer:{type:null,default:null},visible:{type:Boolean,default:!1},modal:{type:Boolean,default:null},contentStyle:{type:null,default:null},contentClass:{type:String,default:null},contentProps:{type:null,default:null},rtl:{type:Boolean,default:null},maximizable:{type:Boolean,default:!1},dismissableMask:{type:Boolean,default:!1},closable:{type:Boolean,default:!0},closeOnEscape:{type:Boolean,default:!0},showHeader:{type:Boolean,default:!0},blockScroll:{type:Boolean,default:!1},baseZIndex:{type:Number,default:0},autoZIndex:{type:Boolean,default:!0},position:{type:String,default:"center"},breakpoints:{type:Object,default:null},draggable:{type:Boolean,default:!0},keepInViewport:{type:Boolean,default:!0},minX:{type:Number,default:0},minY:{type:Number,default:0},appendTo:{type:[String,Object],default:"body"},closeIcon:{type:String,default:void 0},maximizeIcon:{type:String,default:void 0},minimizeIcon:{type:String,default:void 0},closeButtonProps:{type:null,default:null},_instance:null},style:u(c).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,emits:["update:visible","show","hide","after-hide","maximize","unmaximize","dragend"],provide:function(){var e=this;return{dialogRef:s.computed((function(){return e._instance}))}},data:function(){return{id:this.$attrs.id,containerVisible:this.visible,maximized:!1,focusableMax:null,focusableClose:null}},watch:{"$attrs.id":function(e){this.id=e||l.UniqueComponentId()}},documentKeydownListener:null,container:null,mask:null,content:null,headerContainer:null,footerContainer:null,maximizableButton:null,closeButton:null,styleElement:null,dragging:null,documentDragListener:null,documentDragEndListener:null,lastPageX:null,lastPageY:null,updated:function(){this.visible&&(this.containerVisible=this.visible)},beforeUnmount:function(){this.unbindDocumentState(),this.unbindGlobalListeners(),this.destroyStyle(),this.mask&&this.autoZIndex&&l.ZIndexUtils.clear(this.mask),this.container=null,this.mask=null},mounted:function(){this.id=this.id||l.UniqueComponentId(),this.breakpoints&&this.createStyle()},methods:{close:function(){this.$emit("update:visible",!1)},onBeforeEnter:function(e){e.setAttribute(this.attributeSelector,"")},onEnter:function(){this.$emit("show"),this.focus(),this.enableDocumentSettings(),this.bindGlobalListeners(),this.autoZIndex&&l.ZIndexUtils.set("modal",this.mask,this.baseZIndex+this.$primevue.config.zIndex.modal)},onBeforeLeave:function(){this.modal&&!this.isUnstyled&&l.DomHandler.addClass(this.mask,"p-component-overlay-leave")},onLeave:function(){this.$emit("hide"),this.focusableClose=null,this.focusableMax=null},onAfterLeave:function(){this.autoZIndex&&l.ZIndexUtils.clear(this.mask),this.containerVisible=!1,this.unbindDocumentState(),this.unbindGlobalListeners(),this.$emit("after-hide")},onMaskClick:function(e){this.dismissableMask&&this.modal&&this.mask===e.target&&this.close()},focus:function(){var e=function(e){return e&&e.querySelector("[autofocus]")},t=this.$slots.footer&&e(this.footerContainer);t||(t=this.$slots.header&&e(this.headerContainer))||(t=this.$slots.default&&e(this.content))||(this.maximizable?(this.focusableMax=!0,t=this.maximizableButton):(this.focusableClose=!0,t=this.closeButton)),t&&l.DomHandler.focus(t,{focusVisible:!0})},maximize:function(e){this.maximized?(this.maximized=!1,this.$emit("unmaximize",e)):(this.maximized=!0,this.$emit("maximize",e)),this.modal||(this.maximized?l.DomHandler.blockBodyScroll():l.DomHandler.unblockBodyScroll())},enableDocumentSettings:function(){(this.modal||!this.modal&&this.blockScroll||this.maximizable&&this.maximized)&&l.DomHandler.blockBodyScroll()},unbindDocumentState:function(){(this.modal||!this.modal&&this.blockScroll||this.maximizable&&this.maximized)&&l.DomHandler.unblockBodyScroll()},onKeyDown:function(e){"Escape"===e.code&&this.closeOnEscape&&this.close()},bindDocumentKeyDownListener:function(){this.documentKeydownListener||(this.documentKeydownListener=this.onKeyDown.bind(this),window.document.addEventListener("keydown",this.documentKeydownListener))},unbindDocumentKeyDownListener:function(){this.documentKeydownListener&&(window.document.removeEventListener("keydown",this.documentKeydownListener),this.documentKeydownListener=null)},containerRef:function(e){this.container=e},maskRef:function(e){this.mask=e},contentRef:function(e){this.content=e},headerContainerRef:function(e){this.headerContainer=e},footerContainerRef:function(e){this.footerContainer=e},maximizableRef:function(e){this.maximizableButton=e},closeButtonRef:function(e){this.closeButton=e},createStyle:function(){if(!this.styleElement&&!this.isUnstyled){var e;this.styleElement=document.createElement("style"),this.styleElement.type="text/css",l.DomHandler.setAttribute(this.styleElement,"nonce",null===(e=this.$primevue)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.csp)||void 0===e?void 0:e.nonce),document.head.appendChild(this.styleElement);var t="";for(var n in this.breakpoints)t+="\n @media screen and (max-width: ".concat(n,") {\n .p-dialog[").concat(this.attributeSelector,"] {\n width: ").concat(this.breakpoints[n]," !important;\n }\n }\n ");this.styleElement.innerHTML=t}},destroyStyle:function(){this.styleElement&&(document.head.removeChild(this.styleElement),this.styleElement=null)},initDrag:function(e){"icons"!==e.target.closest("div").getAttribute("data-pc-section")&&this.draggable&&(this.dragging=!0,this.lastPageX=e.pageX,this.lastPageY=e.pageY,this.container.style.margin="0",document.body.setAttribute("data-p-unselectable-text","true"),!this.isUnstyled&&l.DomHandler.addClass(document.body,"p-unselectable-text"))},bindGlobalListeners:function(){this.draggable&&(this.bindDocumentDragListener(),this.bindDocumentDragEndListener()),this.closeOnEscape&&this.closable&&this.bindDocumentKeyDownListener()},unbindGlobalListeners:function(){this.unbindDocumentDragListener(),this.unbindDocumentDragEndListener(),this.unbindDocumentKeyDownListener()},bindDocumentDragListener:function(){var e=this;this.documentDragListener=function(t){if(e.dragging){var n=l.DomHandler.getOuterWidth(e.container),o=l.DomHandler.getOuterHeight(e.container),i=t.pageX-e.lastPageX,a=t.pageY-e.lastPageY,s=e.container.getBoundingClientRect(),r=s.left+i,c=s.top+a,u=l.DomHandler.getViewport(),m=getComputedStyle(e.container),d=parseFloat(m.marginLeft),p=parseFloat(m.marginTop);e.container.style.position="fixed",e.keepInViewport?(r>=e.minX&&r+n<u.width&&(e.lastPageX=t.pageX,e.container.style.left=r-d+"px"),c>=e.minY&&c+o<u.height&&(e.lastPageY=t.pageY,e.container.style.top=c-p+"px")):(e.lastPageX=t.pageX,e.container.style.left=r-d+"px",e.lastPageY=t.pageY,e.container.style.top=c-p+"px")}},window.document.addEventListener("mousemove",this.documentDragListener)},unbindDocumentDragListener:function(){this.documentDragListener&&(window.document.removeEventListener("mousemove",this.documentDragListener),this.documentDragListener=null)},bindDocumentDragEndListener:function(){var e=this;this.documentDragEndListener=function(t){e.dragging&&(e.dragging=!1,document.body.removeAttribute("data-p-unselectable-text"),!e.isUnstyled&&l.DomHandler.removeClass(document.body,"p-unselectable-text"),e.$emit("dragend",t))},window.document.addEventListener("mouseup",this.documentDragEndListener)},unbindDocumentDragEndListener:function(){this.documentDragEndListener&&(window.document.removeEventListener("mouseup",this.documentDragEndListener),this.documentDragEndListener=null)}},computed:{maximizeIconComponent:function(){return this.maximized?this.minimizeIcon?"span":"WindowMinimizeIcon":this.maximizeIcon?"span":"WindowMaximizeIcon"},ariaLabelledById:function(){return null!=this.header||null!==this.$attrs["aria-labelledby"]?this.id+"_header":null},closeAriaLabel:function(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0},attributeSelector:function(){return l.UniqueComponentId()}},directives:{ripple:b.default,focustrap:m.default},components:{Portal:h.default,WindowMinimizeIcon:f.default,WindowMaximizeIcon:p.default,TimesIcon:d.default}};function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach((function(t){k(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function k(e,t,n){var o;return(t="symbol"==g(o=D(t,"string"))?o:String(o))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e,t){if("object"!=g(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=g(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var B=["aria-labelledby","aria-modal"],w=["id"],L=["autofocus","tabindex"],z=["autofocus","aria-label"];return y.render=function(e,t,n,o,i,a){var l=s.resolveComponent("Portal"),r=s.resolveDirective("ripple"),c=s.resolveDirective("focustrap");return s.openBlock(),s.createBlock(l,{appendTo:e.appendTo},{default:s.withCtx((function(){return[i.containerVisible?(s.openBlock(),s.createElementBlock("div",s.mergeProps({key:0,ref:a.maskRef,class:e.cx("mask"),style:e.sx("mask",!0,{position:e.position,modal:e.modal}),onClick:t[3]||(t[3]=function(){return a.onMaskClick&&a.onMaskClick.apply(a,arguments)})},e.ptm("mask")),[s.createVNode(s.Transition,s.mergeProps({name:"p-dialog",onBeforeEnter:a.onBeforeEnter,onEnter:a.onEnter,onBeforeLeave:a.onBeforeLeave,onLeave:a.onLeave,onAfterLeave:a.onAfterLeave,appear:""},e.ptm("transition")),{default:s.withCtx((function(){return[e.visible?s.withDirectives((s.openBlock(),s.createElementBlock("div",s.mergeProps({key:0,ref:a.containerRef,class:e.cx("root"),style:e.sx("root"),role:"dialog","aria-labelledby":a.ariaLabelledById,"aria-modal":e.modal},e.ptmi("root")),[e.$slots.container?s.renderSlot(e.$slots,"container",{key:0,onClose:a.close,onMaximize:function(e){return a.maximize(e)},closeCallback:a.close,maximizeCallback:function(e){return a.maximize(e)}}):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[e.showHeader?(s.openBlock(),s.createElementBlock("div",s.mergeProps({key:0,ref:a.headerContainerRef,class:e.cx("header"),onMousedown:t[2]||(t[2]=function(){return a.initDrag&&a.initDrag.apply(a,arguments)})},e.ptm("header")),[s.renderSlot(e.$slots,"header",{class:s.normalizeClass(e.cx("title"))},(function(){return[e.header?(s.openBlock(),s.createElementBlock("span",s.mergeProps({key:0,id:a.ariaLabelledById,class:e.cx("title")},e.ptm("title")),s.toDisplayString(e.header),17,w)):s.createCommentVNode("",!0)]})),s.createElementVNode("div",s.mergeProps({class:e.cx("icons")},e.ptm("icons")),[e.maximizable?s.withDirectives((s.openBlock(),s.createElementBlock("button",s.mergeProps({key:0,ref:a.maximizableRef,autofocus:i.focusableMax,class:e.cx("maximizableButton"),onClick:t[0]||(t[0]=function(){return a.maximize&&a.maximize.apply(a,arguments)}),type:"button",tabindex:e.maximizable?"0":"-1"},e.ptm("maximizableButton"),{"data-pc-group-section":"headericon"}),[s.renderSlot(e.$slots,"maximizeicon",{maximized:i.maximized,class:s.normalizeClass(e.cx("maximizableIcon"))},(function(){return[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(a.maximizeIconComponent),s.mergeProps({class:[e.cx("maximizableIcon"),i.maximized?e.minimizeIcon:e.maximizeIcon]},e.ptm("maximizableIcon")),null,16,["class"]))]}))],16,L)),[[r]]):s.createCommentVNode("",!0),e.closable?s.withDirectives((s.openBlock(),s.createElementBlock("button",s.mergeProps({key:1,ref:a.closeButtonRef,autofocus:i.focusableClose,class:e.cx("closeButton"),onClick:t[1]||(t[1]=function(){return a.close&&a.close.apply(a,arguments)}),"aria-label":a.closeAriaLabel,type:"button"},x(x({},e.closeButtonProps),e.ptm("closeButton")),{"data-pc-group-section":"headericon"}),[s.renderSlot(e.$slots,"closeicon",{class:s.normalizeClass(e.cx("closeButtonIcon"))},(function(){return[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(e.closeIcon?"span":"TimesIcon"),s.mergeProps({class:[e.cx("closeButtonIcon"),e.closeIcon]},e.ptm("closeButtonIcon")),null,16,["class"]))]}))],16,z)),[[r]]):s.createCommentVNode("",!0)],16)],16)):s.createCommentVNode("",!0),s.createElementVNode("div",s.mergeProps({ref:a.contentRef,class:[e.cx("content"),e.contentClass],style:e.contentStyle},x(x({},e.contentProps),e.ptm("content"))),[s.renderSlot(e.$slots,"default")],16),e.footer||e.$slots.footer?(s.openBlock(),s.createElementBlock("div",s.mergeProps({key:1,ref:a.footerContainerRef,class:e.cx("footer")},e.ptm("footer")),[s.renderSlot(e.$slots,"footer",{},(function(){return[s.createTextVNode(s.toDisplayString(e.footer),1)]}))],16)):s.createCommentVNode("",!0)],64))],16,B)),[[c,{disabled:!e.modal}]]):s.createCommentVNode("",!0)]})),_:3},16,["onBeforeEnter","onEnter","onBeforeLeave","onLeave","onAfterLeave"])],16)):s.createCommentVNode("",!0)]})),_:3},8,["appendTo"])},y}(primevue.focustrap,primevue.icons.times,primevue.icons.windowmaximize,primevue.icons.windowminimize,primevue.portal,primevue.ripple,primevue.utils,Vue,primevue.basecomponent,primevue.dialog.style);
|
|
1
|
+
this.primevue=this.primevue||{},this.primevue.dialog=function(e,t,n,o,i,a,l,s,r,c){"use strict";function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=u(e),d=u(t),p=u(n),f=u(o),h=u(i),b=u(a),y={name:"Dialog",extends:{name:"BaseDialog",extends:u(r).default,props:{header:{type:null,default:null},footer:{type:null,default:null},visible:{type:Boolean,default:!1},modal:{type:Boolean,default:null},contentStyle:{type:null,default:null},contentClass:{type:String,default:null},contentProps:{type:null,default:null},rtl:{type:Boolean,default:null},maximizable:{type:Boolean,default:!1},dismissableMask:{type:Boolean,default:!1},closable:{type:Boolean,default:!0},closeOnEscape:{type:Boolean,default:!0},showHeader:{type:Boolean,default:!0},blockScroll:{type:Boolean,default:!1},baseZIndex:{type:Number,default:0},autoZIndex:{type:Boolean,default:!0},position:{type:String,default:"center"},breakpoints:{type:Object,default:null},draggable:{type:Boolean,default:!0},keepInViewport:{type:Boolean,default:!0},minX:{type:Number,default:0},minY:{type:Number,default:0},appendTo:{type:[String,Object],default:"body"},closeIcon:{type:String,default:void 0},maximizeIcon:{type:String,default:void 0},minimizeIcon:{type:String,default:void 0},closeButtonProps:{type:null,default:null},_instance:null},style:u(c).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,emits:["update:visible","show","hide","after-hide","maximize","unmaximize","dragend"],provide:function(){var e=this;return{dialogRef:s.computed((function(){return e._instance}))}},data:function(){return{id:this.$attrs.id,containerVisible:this.visible,maximized:!1,focusableMax:null,focusableClose:null,target:null}},watch:{"$attrs.id":function(e){this.id=e||l.UniqueComponentId()}},documentKeydownListener:null,container:null,mask:null,content:null,headerContainer:null,footerContainer:null,maximizableButton:null,closeButton:null,styleElement:null,dragging:null,documentDragListener:null,documentDragEndListener:null,lastPageX:null,lastPageY:null,updated:function(){this.visible&&(this.containerVisible=this.visible)},beforeUnmount:function(){this.unbindDocumentState(),this.unbindGlobalListeners(),this.destroyStyle(),this.mask&&this.autoZIndex&&l.ZIndexUtils.clear(this.mask),this.container=null,this.mask=null},mounted:function(){this.id=this.id||l.UniqueComponentId(),this.breakpoints&&this.createStyle()},methods:{close:function(){this.$emit("update:visible",!1)},onBeforeEnter:function(e){e.setAttribute(this.attributeSelector,"")},onEnter:function(){this.$emit("show"),this.target=document.activeElement,this.focus(),this.enableDocumentSettings(),this.bindGlobalListeners(),this.autoZIndex&&l.ZIndexUtils.set("modal",this.mask,this.baseZIndex+this.$primevue.config.zIndex.modal)},onBeforeLeave:function(){this.modal&&!this.isUnstyled&&l.DomHandler.addClass(this.mask,"p-component-overlay-leave")},onLeave:function(){this.$emit("hide"),l.DomHandler.focus(this.target),this.target=null,this.focusableClose=null,this.focusableMax=null},onAfterLeave:function(){this.autoZIndex&&l.ZIndexUtils.clear(this.mask),this.containerVisible=!1,this.unbindDocumentState(),this.unbindGlobalListeners(),this.$emit("after-hide")},onMaskClick:function(e){this.dismissableMask&&this.modal&&this.mask===e.target&&this.close()},focus:function(){var e=function(e){return e&&e.querySelector("[autofocus]")},t=this.$slots.footer&&e(this.footerContainer);t||(t=this.$slots.header&&e(this.headerContainer))||(t=this.$slots.default&&e(this.content))||(this.maximizable?(this.focusableMax=!0,t=this.maximizableButton):(this.focusableClose=!0,t=this.closeButton)),t&&l.DomHandler.focus(t,{focusVisible:!0})},maximize:function(e){this.maximized?(this.maximized=!1,this.$emit("unmaximize",e)):(this.maximized=!0,this.$emit("maximize",e)),this.modal||(this.maximized?l.DomHandler.blockBodyScroll():l.DomHandler.unblockBodyScroll())},enableDocumentSettings:function(){(this.modal||!this.modal&&this.blockScroll||this.maximizable&&this.maximized)&&l.DomHandler.blockBodyScroll()},unbindDocumentState:function(){(this.modal||!this.modal&&this.blockScroll||this.maximizable&&this.maximized)&&l.DomHandler.unblockBodyScroll()},onKeyDown:function(e){"Escape"===e.code&&this.closeOnEscape&&this.close()},bindDocumentKeyDownListener:function(){this.documentKeydownListener||(this.documentKeydownListener=this.onKeyDown.bind(this),window.document.addEventListener("keydown",this.documentKeydownListener))},unbindDocumentKeyDownListener:function(){this.documentKeydownListener&&(window.document.removeEventListener("keydown",this.documentKeydownListener),this.documentKeydownListener=null)},containerRef:function(e){this.container=e},maskRef:function(e){this.mask=e},contentRef:function(e){this.content=e},headerContainerRef:function(e){this.headerContainer=e},footerContainerRef:function(e){this.footerContainer=e},maximizableRef:function(e){this.maximizableButton=e},closeButtonRef:function(e){this.closeButton=e},createStyle:function(){if(!this.styleElement&&!this.isUnstyled){var e;this.styleElement=document.createElement("style"),this.styleElement.type="text/css",l.DomHandler.setAttribute(this.styleElement,"nonce",null===(e=this.$primevue)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.csp)||void 0===e?void 0:e.nonce),document.head.appendChild(this.styleElement);var t="";for(var n in this.breakpoints)t+="\n @media screen and (max-width: ".concat(n,") {\n .p-dialog[").concat(this.attributeSelector,"] {\n width: ").concat(this.breakpoints[n]," !important;\n }\n }\n ");this.styleElement.innerHTML=t}},destroyStyle:function(){this.styleElement&&(document.head.removeChild(this.styleElement),this.styleElement=null)},initDrag:function(e){"icons"!==e.target.closest("div").getAttribute("data-pc-section")&&this.draggable&&(this.dragging=!0,this.lastPageX=e.pageX,this.lastPageY=e.pageY,this.container.style.margin="0",document.body.setAttribute("data-p-unselectable-text","true"),!this.isUnstyled&&l.DomHandler.addClass(document.body,"p-unselectable-text"))},bindGlobalListeners:function(){this.draggable&&(this.bindDocumentDragListener(),this.bindDocumentDragEndListener()),this.closeOnEscape&&this.closable&&this.bindDocumentKeyDownListener()},unbindGlobalListeners:function(){this.unbindDocumentDragListener(),this.unbindDocumentDragEndListener(),this.unbindDocumentKeyDownListener()},bindDocumentDragListener:function(){var e=this;this.documentDragListener=function(t){if(e.dragging){var n=l.DomHandler.getOuterWidth(e.container),o=l.DomHandler.getOuterHeight(e.container),i=t.pageX-e.lastPageX,a=t.pageY-e.lastPageY,s=e.container.getBoundingClientRect(),r=s.left+i,c=s.top+a,u=l.DomHandler.getViewport(),m=getComputedStyle(e.container),d=parseFloat(m.marginLeft),p=parseFloat(m.marginTop);e.container.style.position="fixed",e.keepInViewport?(r>=e.minX&&r+n<u.width&&(e.lastPageX=t.pageX,e.container.style.left=r-d+"px"),c>=e.minY&&c+o<u.height&&(e.lastPageY=t.pageY,e.container.style.top=c-p+"px")):(e.lastPageX=t.pageX,e.container.style.left=r-d+"px",e.lastPageY=t.pageY,e.container.style.top=c-p+"px")}},window.document.addEventListener("mousemove",this.documentDragListener)},unbindDocumentDragListener:function(){this.documentDragListener&&(window.document.removeEventListener("mousemove",this.documentDragListener),this.documentDragListener=null)},bindDocumentDragEndListener:function(){var e=this;this.documentDragEndListener=function(t){e.dragging&&(e.dragging=!1,document.body.removeAttribute("data-p-unselectable-text"),!e.isUnstyled&&l.DomHandler.removeClass(document.body,"p-unselectable-text"),e.$emit("dragend",t))},window.document.addEventListener("mouseup",this.documentDragEndListener)},unbindDocumentDragEndListener:function(){this.documentDragEndListener&&(window.document.removeEventListener("mouseup",this.documentDragEndListener),this.documentDragEndListener=null)}},computed:{maximizeIconComponent:function(){return this.maximized?this.minimizeIcon?"span":"WindowMinimizeIcon":this.maximizeIcon?"span":"WindowMaximizeIcon"},ariaLabelledById:function(){return null!=this.header||null!==this.$attrs["aria-labelledby"]?this.id+"_header":null},closeAriaLabel:function(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0},attributeSelector:function(){return l.UniqueComponentId()}},directives:{ripple:b.default,focustrap:m.default},components:{Portal:h.default,WindowMinimizeIcon:f.default,WindowMaximizeIcon:p.default,TimesIcon:d.default}};function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach((function(t){k(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function k(e,t,n){var o;return(t="symbol"==g(o=D(t,"string"))?o:String(o))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e,t){if("object"!=g(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t||"default");if("object"!=g(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var B=["aria-labelledby","aria-modal"],w=["id"],L=["autofocus","tabindex"],z=["autofocus","aria-label"];return y.render=function(e,t,n,o,i,a){var l=s.resolveComponent("Portal"),r=s.resolveDirective("ripple"),c=s.resolveDirective("focustrap");return s.openBlock(),s.createBlock(l,{appendTo:e.appendTo},{default:s.withCtx((function(){return[i.containerVisible?(s.openBlock(),s.createElementBlock("div",s.mergeProps({key:0,ref:a.maskRef,class:e.cx("mask"),style:e.sx("mask",!0,{position:e.position,modal:e.modal}),onClick:t[3]||(t[3]=function(){return a.onMaskClick&&a.onMaskClick.apply(a,arguments)})},e.ptm("mask")),[s.createVNode(s.Transition,s.mergeProps({name:"p-dialog",onBeforeEnter:a.onBeforeEnter,onEnter:a.onEnter,onBeforeLeave:a.onBeforeLeave,onLeave:a.onLeave,onAfterLeave:a.onAfterLeave,appear:""},e.ptm("transition")),{default:s.withCtx((function(){return[e.visible?s.withDirectives((s.openBlock(),s.createElementBlock("div",s.mergeProps({key:0,ref:a.containerRef,class:e.cx("root"),style:e.sx("root"),role:"dialog","aria-labelledby":a.ariaLabelledById,"aria-modal":e.modal},e.ptmi("root")),[e.$slots.container?s.renderSlot(e.$slots,"container",{key:0,onClose:a.close,onMaximize:function(e){return a.maximize(e)},closeCallback:a.close,maximizeCallback:function(e){return a.maximize(e)}}):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[e.showHeader?(s.openBlock(),s.createElementBlock("div",s.mergeProps({key:0,ref:a.headerContainerRef,class:e.cx("header"),onMousedown:t[2]||(t[2]=function(){return a.initDrag&&a.initDrag.apply(a,arguments)})},e.ptm("header")),[s.renderSlot(e.$slots,"header",{class:s.normalizeClass(e.cx("title"))},(function(){return[e.header?(s.openBlock(),s.createElementBlock("span",s.mergeProps({key:0,id:a.ariaLabelledById,class:e.cx("title")},e.ptm("title")),s.toDisplayString(e.header),17,w)):s.createCommentVNode("",!0)]})),s.createElementVNode("div",s.mergeProps({class:e.cx("icons")},e.ptm("icons")),[e.maximizable?s.withDirectives((s.openBlock(),s.createElementBlock("button",s.mergeProps({key:0,ref:a.maximizableRef,autofocus:i.focusableMax,class:e.cx("maximizableButton"),onClick:t[0]||(t[0]=function(){return a.maximize&&a.maximize.apply(a,arguments)}),type:"button",tabindex:e.maximizable?"0":"-1"},e.ptm("maximizableButton"),{"data-pc-group-section":"headericon"}),[s.renderSlot(e.$slots,"maximizeicon",{maximized:i.maximized,class:s.normalizeClass(e.cx("maximizableIcon"))},(function(){return[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(a.maximizeIconComponent),s.mergeProps({class:[e.cx("maximizableIcon"),i.maximized?e.minimizeIcon:e.maximizeIcon]},e.ptm("maximizableIcon")),null,16,["class"]))]}))],16,L)),[[r]]):s.createCommentVNode("",!0),e.closable?s.withDirectives((s.openBlock(),s.createElementBlock("button",s.mergeProps({key:1,ref:a.closeButtonRef,autofocus:i.focusableClose,class:e.cx("closeButton"),onClick:t[1]||(t[1]=function(){return a.close&&a.close.apply(a,arguments)}),"aria-label":a.closeAriaLabel,type:"button"},x(x({},e.closeButtonProps),e.ptm("closeButton")),{"data-pc-group-section":"headericon"}),[s.renderSlot(e.$slots,"closeicon",{class:s.normalizeClass(e.cx("closeButtonIcon"))},(function(){return[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(e.closeIcon?"span":"TimesIcon"),s.mergeProps({class:[e.cx("closeButtonIcon"),e.closeIcon]},e.ptm("closeButtonIcon")),null,16,["class"]))]}))],16,z)),[[r]]):s.createCommentVNode("",!0)],16)],16)):s.createCommentVNode("",!0),s.createElementVNode("div",s.mergeProps({ref:a.contentRef,class:[e.cx("content"),e.contentClass],style:e.contentStyle},x(x({},e.contentProps),e.ptm("content"))),[s.renderSlot(e.$slots,"default")],16),e.footer||e.$slots.footer?(s.openBlock(),s.createElementBlock("div",s.mergeProps({key:1,ref:a.footerContainerRef,class:e.cx("footer")},e.ptm("footer")),[s.renderSlot(e.$slots,"footer",{},(function(){return[s.createTextVNode(s.toDisplayString(e.footer),1)]}))],16)):s.createCommentVNode("",!0)],64))],16,B)),[[c,{disabled:!e.modal}]]):s.createCommentVNode("",!0)]})),_:3},16,["onBeforeEnter","onEnter","onBeforeLeave","onLeave","onAfterLeave"])],16)):s.createCommentVNode("",!0)]})),_:3},8,["appendTo"])},y}(primevue.focustrap,primevue.icons.times,primevue.icons.windowmaximize,primevue.icons.windowminimize,primevue.portal,primevue.ripple,primevue.utils,Vue,primevue.basecomponent,primevue.dialog.style);
|
package/dropdown/Dropdown.d.ts
CHANGED
|
@@ -484,7 +484,7 @@ export interface DropdownProps {
|
|
|
484
484
|
emptyFilterMessage?: string | undefined;
|
|
485
485
|
/**
|
|
486
486
|
* Text to display when there are no options available. Defaults to value from PrimeVue locale configuration.
|
|
487
|
-
* @defaultValue No
|
|
487
|
+
* @defaultValue No available options
|
|
488
488
|
*/
|
|
489
489
|
emptyMessage?: string | undefined;
|
|
490
490
|
/**
|
package/dropdown/Dropdown.vue
CHANGED
|
@@ -361,9 +361,6 @@ export default {
|
|
|
361
361
|
this.onArrowLeftKey(event, this.editable);
|
|
362
362
|
break;
|
|
363
363
|
|
|
364
|
-
case 'Delete':
|
|
365
|
-
this.onDeleteKey(event);
|
|
366
|
-
|
|
367
364
|
case 'Home':
|
|
368
365
|
this.onHomeKey(event, this.editable);
|
|
369
366
|
break;
|
|
@@ -540,12 +537,6 @@ export default {
|
|
|
540
537
|
break;
|
|
541
538
|
}
|
|
542
539
|
},
|
|
543
|
-
onDeleteKey(event) {
|
|
544
|
-
if (this.showClear) {
|
|
545
|
-
this.updateModel(event, null);
|
|
546
|
-
event.preventDefault();
|
|
547
|
-
}
|
|
548
|
-
},
|
|
549
540
|
onArrowDownKey(event) {
|
|
550
541
|
if (!this.overlayVisible) {
|
|
551
542
|
this.show();
|
|
@@ -580,8 +571,14 @@ export default {
|
|
|
580
571
|
},
|
|
581
572
|
onHomeKey(event, pressedInInputText = false) {
|
|
582
573
|
if (pressedInInputText) {
|
|
583
|
-
event.currentTarget
|
|
584
|
-
|
|
574
|
+
const target = event.currentTarget;
|
|
575
|
+
|
|
576
|
+
if (event.shiftKey) {
|
|
577
|
+
target.setSelectionRange(0, event.target.selectionStart);
|
|
578
|
+
} else {
|
|
579
|
+
target.setSelectionRange(0, 0);
|
|
580
|
+
this.focusedOptionIndex = -1;
|
|
581
|
+
}
|
|
585
582
|
} else {
|
|
586
583
|
this.changeFocusedOptionIndex(event, this.findFirstOptionIndex());
|
|
587
584
|
|
|
@@ -593,10 +590,15 @@ export default {
|
|
|
593
590
|
onEndKey(event, pressedInInputText = false) {
|
|
594
591
|
if (pressedInInputText) {
|
|
595
592
|
const target = event.currentTarget;
|
|
596
|
-
const len = target.value.length;
|
|
597
593
|
|
|
598
|
-
|
|
599
|
-
|
|
594
|
+
if (event.shiftKey) {
|
|
595
|
+
target.setSelectionRange(event.target.selectionStart, target.value.length);
|
|
596
|
+
} else {
|
|
597
|
+
const len = target.value.length;
|
|
598
|
+
|
|
599
|
+
target.setSelectionRange(len, len);
|
|
600
|
+
this.focusedOptionIndex = -1;
|
|
601
|
+
}
|
|
600
602
|
} else {
|
|
601
603
|
this.changeFocusedOptionIndex(event, this.findLastOptionIndex());
|
|
602
604
|
|
|
@@ -860,7 +862,7 @@ export default {
|
|
|
860
862
|
const element = DomHandler.findSingle(this.list, `li[id="${id}"]`);
|
|
861
863
|
|
|
862
864
|
if (element) {
|
|
863
|
-
element.scrollIntoView && element.scrollIntoView({ block: 'nearest'
|
|
865
|
+
element.scrollIntoView && element.scrollIntoView({ block: 'nearest' });
|
|
864
866
|
} else if (!this.virtualScrollerDisabled) {
|
|
865
867
|
this.virtualScroller && this.virtualScroller.scrollToIndex(index !== -1 ? index : this.focusedOptionIndex);
|
|
866
868
|
}
|
package/dropdown/dropdown.cjs.js
CHANGED
|
@@ -386,8 +386,6 @@ var script = {
|
|
|
386
386
|
case 'ArrowRight':
|
|
387
387
|
this.onArrowLeftKey(event, this.editable);
|
|
388
388
|
break;
|
|
389
|
-
case 'Delete':
|
|
390
|
-
this.onDeleteKey(event);
|
|
391
389
|
case 'Home':
|
|
392
390
|
this.onHomeKey(event, this.editable);
|
|
393
391
|
break;
|
|
@@ -532,12 +530,6 @@ var script = {
|
|
|
532
530
|
break;
|
|
533
531
|
}
|
|
534
532
|
},
|
|
535
|
-
onDeleteKey: function onDeleteKey(event) {
|
|
536
|
-
if (this.showClear) {
|
|
537
|
-
this.updateModel(event, null);
|
|
538
|
-
event.preventDefault();
|
|
539
|
-
}
|
|
540
|
-
},
|
|
541
533
|
onArrowDownKey: function onArrowDownKey(event) {
|
|
542
534
|
if (!this.overlayVisible) {
|
|
543
535
|
this.show();
|
|
@@ -570,8 +562,13 @@ var script = {
|
|
|
570
562
|
onHomeKey: function onHomeKey(event) {
|
|
571
563
|
var pressedInInputText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
572
564
|
if (pressedInInputText) {
|
|
573
|
-
event.currentTarget
|
|
574
|
-
|
|
565
|
+
var target = event.currentTarget;
|
|
566
|
+
if (event.shiftKey) {
|
|
567
|
+
target.setSelectionRange(0, event.target.selectionStart);
|
|
568
|
+
} else {
|
|
569
|
+
target.setSelectionRange(0, 0);
|
|
570
|
+
this.focusedOptionIndex = -1;
|
|
571
|
+
}
|
|
575
572
|
} else {
|
|
576
573
|
this.changeFocusedOptionIndex(event, this.findFirstOptionIndex());
|
|
577
574
|
!this.overlayVisible && this.show();
|
|
@@ -582,9 +579,13 @@ var script = {
|
|
|
582
579
|
var pressedInInputText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
583
580
|
if (pressedInInputText) {
|
|
584
581
|
var target = event.currentTarget;
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
582
|
+
if (event.shiftKey) {
|
|
583
|
+
target.setSelectionRange(event.target.selectionStart, target.value.length);
|
|
584
|
+
} else {
|
|
585
|
+
var len = target.value.length;
|
|
586
|
+
target.setSelectionRange(len, len);
|
|
587
|
+
this.focusedOptionIndex = -1;
|
|
588
|
+
}
|
|
588
589
|
} else {
|
|
589
590
|
this.changeFocusedOptionIndex(event, this.findLastOptionIndex());
|
|
590
591
|
!this.overlayVisible && this.show();
|
|
@@ -855,8 +856,7 @@ var script = {
|
|
|
855
856
|
var element = utils.DomHandler.findSingle(_this13.list, "li[id=\"".concat(id, "\"]"));
|
|
856
857
|
if (element) {
|
|
857
858
|
element.scrollIntoView && element.scrollIntoView({
|
|
858
|
-
block: 'nearest'
|
|
859
|
-
inline: 'start'
|
|
859
|
+
block: 'nearest'
|
|
860
860
|
});
|
|
861
861
|
} else if (!_this13.virtualScrollerDisabled) {
|
|
862
862
|
_this13.virtualScroller && _this13.virtualScroller.scrollToIndex(index !== -1 ? index : _this13.focusedOptionIndex);
|