primevue 3.53.0 → 3.53.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/calendar/Calendar.vue +29 -16
- package/calendar/calendar.cjs.js +36 -18
- package/calendar/calendar.cjs.min.js +1 -1
- package/calendar/calendar.esm.js +36 -18
- package/calendar/calendar.esm.min.js +1 -1
- package/calendar/calendar.js +36 -18
- package/calendar/calendar.min.js +1 -1
- package/config/PrimeVue.d.ts +1 -10
- package/confirmationservice/ConfirmationService.d.ts +1 -7
- package/core/core.js +13 -4
- package/core/core.min.js +3 -3
- package/dialog/Dialog.vue +4 -2
- package/dialog/dialog.cjs.js +5 -2
- package/dialog/dialog.cjs.min.js +1 -1
- package/dialog/dialog.esm.js +5 -2
- package/dialog/dialog.esm.min.js +1 -1
- package/dialog/dialog.js +5 -2
- package/dialog/dialog.min.js +1 -1
- package/dialogservice/DialogService.d.ts +1 -7
- package/inputnumber/InputNumber.vue +5 -0
- package/inputnumber/inputnumber.cjs.js +4 -0
- package/inputnumber/inputnumber.cjs.min.js +1 -1
- package/inputnumber/inputnumber.esm.js +4 -0
- package/inputnumber/inputnumber.esm.min.js +1 -1
- package/inputnumber/inputnumber.js +4 -0
- package/inputnumber/inputnumber.min.js +1 -1
- package/package.json +1 -1
- package/toastservice/ToastService.d.ts +1 -7
- package/tree/TreeNode.vue +4 -2
- package/tree/tree.cjs.js +4 -2
- package/tree/tree.cjs.min.js +1 -1
- package/tree/tree.esm.js +4 -2
- package/tree/tree.esm.min.js +1 -1
- package/tree/tree.js +4 -2
- package/tree/tree.min.js +1 -1
- package/web-types.json +1 -1
package/dialog/dialog.cjs.js
CHANGED
|
@@ -217,13 +217,15 @@ var script = {
|
|
|
217
217
|
onEnter: function onEnter() {
|
|
218
218
|
this.$emit('show');
|
|
219
219
|
this.target = document.activeElement;
|
|
220
|
-
this.focus();
|
|
221
220
|
this.enableDocumentSettings();
|
|
222
221
|
this.bindGlobalListeners();
|
|
223
222
|
if (this.autoZIndex) {
|
|
224
223
|
utils.ZIndexUtils.set('modal', this.mask, this.baseZIndex + this.$primevue.config.zIndex.modal);
|
|
225
224
|
}
|
|
226
225
|
},
|
|
226
|
+
onAfterEnter: function onAfterEnter() {
|
|
227
|
+
this.focus();
|
|
228
|
+
},
|
|
227
229
|
onBeforeLeave: function onBeforeLeave() {
|
|
228
230
|
if (this.modal) {
|
|
229
231
|
!this.isUnstyled && utils.DomHandler.addClass(this.mask, 'p-component-overlay-leave');
|
|
@@ -502,6 +504,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
502
504
|
name: "p-dialog",
|
|
503
505
|
onBeforeEnter: $options.onBeforeEnter,
|
|
504
506
|
onEnter: $options.onEnter,
|
|
507
|
+
onAfterEnter: $options.onAfterEnter,
|
|
505
508
|
onBeforeLeave: $options.onBeforeLeave,
|
|
506
509
|
onLeave: $options.onLeave,
|
|
507
510
|
onAfterLeave: $options.onAfterLeave,
|
|
@@ -597,7 +600,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
597
600
|
}]]) : vue.createCommentVNode("", true)];
|
|
598
601
|
}),
|
|
599
602
|
_: 3
|
|
600
|
-
}, 16, ["onBeforeEnter", "onEnter", "onBeforeLeave", "onLeave", "onAfterLeave"])], 16)) : vue.createCommentVNode("", true)];
|
|
603
|
+
}, 16, ["onBeforeEnter", "onEnter", "onAfterEnter", "onBeforeLeave", "onLeave", "onAfterLeave"])], 16)) : vue.createCommentVNode("", true)];
|
|
601
604
|
}),
|
|
602
605
|
_: 3
|
|
603
606
|
}, 8, ["appendTo"]);
|
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,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;
|
|
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"),r=require("primevue/utils"),l=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),f=u(n),p=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:l.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||r.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&&r.ZIndexUtils.clear(this.mask),this.container=null,this.mask=null},mounted:function(){this.id=this.id||r.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.enableDocumentSettings(),this.bindGlobalListeners(),this.autoZIndex&&r.ZIndexUtils.set("modal",this.mask,this.baseZIndex+this.$primevue.config.zIndex.modal)},onAfterEnter:function(){this.focus()},onBeforeLeave:function(){this.modal&&!this.isUnstyled&&r.DomHandler.addClass(this.mask,"p-component-overlay-leave")},onLeave:function(){this.$emit("hide"),r.DomHandler.focus(this.target),this.target=null,this.focusableClose=null,this.focusableMax=null},onAfterLeave:function(){this.autoZIndex&&r.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&&r.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?r.DomHandler.blockBodyScroll():r.DomHandler.unblockBodyScroll())},enableDocumentSettings:function(){(this.modal||!this.modal&&this.blockScroll||this.maximizable&&this.maximized)&&r.DomHandler.blockBodyScroll()},unbindDocumentState:function(){(this.modal||!this.modal&&this.blockScroll||this.maximizable&&this.maximized)&&r.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",r.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&&r.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=r.DomHandler.getOuterWidth(e.container),o=r.DomHandler.getOuterHeight(e.container),i=t.pageX-e.lastPageX,a=t.pageY-e.lastPageY,l=e.container.getBoundingClientRect(),s=l.left+i,c=l.top+a,u=r.DomHandler.getViewport(),m=getComputedStyle(e.container),d=parseFloat(m.marginLeft),f=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-f+"px")):(e.lastPageX=t.pageX,e.container.style.left=s-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.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 r.UniqueComponentId()}},directives:{ripple:b.default,focustrap:m.default},components:{Portal:h.default,WindowMinimizeIcon:p.default,WindowMaximizeIcon:f.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 r=l.resolveComponent("Portal"),s=l.resolveDirective("ripple"),c=l.resolveDirective("focustrap");return l.openBlock(),l.createBlock(r,{appendTo:e.appendTo},{default:l.withCtx((function(){return[i.containerVisible?(l.openBlock(),l.createElementBlock("div",l.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")),[l.createVNode(l.Transition,l.mergeProps({name:"p-dialog",onBeforeEnter:a.onBeforeEnter,onEnter:a.onEnter,onAfterEnter:a.onAfterEnter,onBeforeLeave:a.onBeforeLeave,onLeave:a.onLeave,onAfterLeave:a.onAfterLeave,appear:""},e.ptm("transition")),{default:l.withCtx((function(){return[e.visible?l.withDirectives((l.openBlock(),l.createElementBlock("div",l.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?l.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)}}):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[e.showHeader?(l.openBlock(),l.createElementBlock("div",l.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")),[l.renderSlot(e.$slots,"header",{class:l.normalizeClass(e.cx("title"))},(function(){return[e.header?(l.openBlock(),l.createElementBlock("span",l.mergeProps({key:0,id:a.ariaLabelledById,class:e.cx("title")},e.ptm("title")),l.toDisplayString(e.header),17,w)):l.createCommentVNode("",!0)]})),l.createElementVNode("div",l.mergeProps({class:e.cx("icons")},e.ptm("icons")),[e.maximizable?l.withDirectives((l.openBlock(),l.createElementBlock("button",l.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"}),[l.renderSlot(e.$slots,"maximizeicon",{maximized:i.maximized,class:l.normalizeClass(e.cx("maximizableIcon"))},(function(){return[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(a.maximizeIconComponent),l.mergeProps({class:[e.cx("maximizableIcon"),i.maximized?e.minimizeIcon:e.maximizeIcon]},e.ptm("maximizableIcon")),null,16,["class"]))]}))],16,L)),[[s]]):l.createCommentVNode("",!0),e.closable?l.withDirectives((l.openBlock(),l.createElementBlock("button",l.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"}),[l.renderSlot(e.$slots,"closeicon",{class:l.normalizeClass(e.cx("closeButtonIcon"))},(function(){return[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.closeIcon?"span":"TimesIcon"),l.mergeProps({class:[e.cx("closeButtonIcon"),e.closeIcon]},e.ptm("closeButtonIcon")),null,16,["class"]))]}))],16,z)),[[s]]):l.createCommentVNode("",!0)],16)],16)):l.createCommentVNode("",!0),l.createElementVNode("div",l.mergeProps({ref:a.contentRef,class:[e.cx("content"),e.contentClass],style:e.contentStyle},x(x({},e.contentProps),e.ptm("content"))),[l.renderSlot(e.$slots,"default")],16),e.footer||e.$slots.footer?(l.openBlock(),l.createElementBlock("div",l.mergeProps({key:1,ref:a.footerContainerRef,class:e.cx("footer")},e.ptm("footer")),[l.renderSlot(e.$slots,"footer",{},(function(){return[l.createTextVNode(l.toDisplayString(e.footer),1)]}))],16)):l.createCommentVNode("",!0)],64))],16,B)),[[c,{disabled:!e.modal}]]):l.createCommentVNode("",!0)]})),_:3},16,["onBeforeEnter","onEnter","onAfterEnter","onBeforeLeave","onLeave","onAfterLeave"])],16)):l.createCommentVNode("",!0)]})),_:3},8,["appendTo"])},module.exports=y;
|
package/dialog/dialog.esm.js
CHANGED
|
@@ -204,13 +204,15 @@ var script = {
|
|
|
204
204
|
onEnter: function onEnter() {
|
|
205
205
|
this.$emit('show');
|
|
206
206
|
this.target = document.activeElement;
|
|
207
|
-
this.focus();
|
|
208
207
|
this.enableDocumentSettings();
|
|
209
208
|
this.bindGlobalListeners();
|
|
210
209
|
if (this.autoZIndex) {
|
|
211
210
|
ZIndexUtils.set('modal', this.mask, this.baseZIndex + this.$primevue.config.zIndex.modal);
|
|
212
211
|
}
|
|
213
212
|
},
|
|
213
|
+
onAfterEnter: function onAfterEnter() {
|
|
214
|
+
this.focus();
|
|
215
|
+
},
|
|
214
216
|
onBeforeLeave: function onBeforeLeave() {
|
|
215
217
|
if (this.modal) {
|
|
216
218
|
!this.isUnstyled && DomHandler.addClass(this.mask, 'p-component-overlay-leave');
|
|
@@ -489,6 +491,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
489
491
|
name: "p-dialog",
|
|
490
492
|
onBeforeEnter: $options.onBeforeEnter,
|
|
491
493
|
onEnter: $options.onEnter,
|
|
494
|
+
onAfterEnter: $options.onAfterEnter,
|
|
492
495
|
onBeforeLeave: $options.onBeforeLeave,
|
|
493
496
|
onLeave: $options.onLeave,
|
|
494
497
|
onAfterLeave: $options.onAfterLeave,
|
|
@@ -584,7 +587,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
584
587
|
}]]) : createCommentVNode("", true)];
|
|
585
588
|
}),
|
|
586
589
|
_: 3
|
|
587
|
-
}, 16, ["onBeforeEnter", "onEnter", "onBeforeLeave", "onLeave", "onAfterLeave"])], 16)) : createCommentVNode("", true)];
|
|
590
|
+
}, 16, ["onBeforeEnter", "onEnter", "onAfterEnter", "onBeforeLeave", "onLeave", "onAfterLeave"])], 16)) : createCommentVNode("", true)];
|
|
588
591
|
}),
|
|
589
592
|
_: 3
|
|
590
593
|
}, 8, ["appendTo"]);
|
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,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};
|
|
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 E,createTextVNode as B}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.enableDocumentSettings(),this.bindGlobalListeners(),this.autoZIndex&&l.set("modal",this.mask,this.baseZIndex+this.$primevue.config.zIndex.modal)},onAfterEnter:function(){this.focus()},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=A(t,"string"))?i:String(i))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(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 M=["aria-labelledby","aria-modal"],R=["id"],K=["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,onAfterEnter:a.onAfterEnter,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,R)):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(E(a.maximizeIconComponent),b({class:[e.cx("maximizableIcon"),o.maximized?e.minimizeIcon:e.maximizeIcon]},e.ptm("maximizableIcon")),null,16,["class"]))]}))],16,K)),[[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(E(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[B(z(e.footer),1)]}))],16)):k("",!0)],64))],16,M)),[[r,{disabled:!e.modal}]]):k("",!0)]})),_:3},16,["onBeforeEnter","onEnter","onAfterEnter","onBeforeLeave","onLeave","onAfterLeave"])],16)):k("",!0)]})),_:3},8,["appendTo"])};export{C as default};
|
package/dialog/dialog.js
CHANGED
|
@@ -208,13 +208,15 @@ this.primevue.dialog = (function (FocusTrap, TimesIcon, WindowMaximizeIcon, Wind
|
|
|
208
208
|
onEnter: function onEnter() {
|
|
209
209
|
this.$emit('show');
|
|
210
210
|
this.target = document.activeElement;
|
|
211
|
-
this.focus();
|
|
212
211
|
this.enableDocumentSettings();
|
|
213
212
|
this.bindGlobalListeners();
|
|
214
213
|
if (this.autoZIndex) {
|
|
215
214
|
utils.ZIndexUtils.set('modal', this.mask, this.baseZIndex + this.$primevue.config.zIndex.modal);
|
|
216
215
|
}
|
|
217
216
|
},
|
|
217
|
+
onAfterEnter: function onAfterEnter() {
|
|
218
|
+
this.focus();
|
|
219
|
+
},
|
|
218
220
|
onBeforeLeave: function onBeforeLeave() {
|
|
219
221
|
if (this.modal) {
|
|
220
222
|
!this.isUnstyled && utils.DomHandler.addClass(this.mask, 'p-component-overlay-leave');
|
|
@@ -493,6 +495,7 @@ this.primevue.dialog = (function (FocusTrap, TimesIcon, WindowMaximizeIcon, Wind
|
|
|
493
495
|
name: "p-dialog",
|
|
494
496
|
onBeforeEnter: $options.onBeforeEnter,
|
|
495
497
|
onEnter: $options.onEnter,
|
|
498
|
+
onAfterEnter: $options.onAfterEnter,
|
|
496
499
|
onBeforeLeave: $options.onBeforeLeave,
|
|
497
500
|
onLeave: $options.onLeave,
|
|
498
501
|
onAfterLeave: $options.onAfterLeave,
|
|
@@ -588,7 +591,7 @@ this.primevue.dialog = (function (FocusTrap, TimesIcon, WindowMaximizeIcon, Wind
|
|
|
588
591
|
}]]) : vue.createCommentVNode("", true)];
|
|
589
592
|
}),
|
|
590
593
|
_: 3
|
|
591
|
-
}, 16, ["onBeforeEnter", "onEnter", "onBeforeLeave", "onLeave", "onAfterLeave"])], 16)) : vue.createCommentVNode("", true)];
|
|
594
|
+
}, 16, ["onBeforeEnter", "onEnter", "onAfterEnter", "onBeforeLeave", "onLeave", "onAfterLeave"])], 16)) : vue.createCommentVNode("", true)];
|
|
592
595
|
}),
|
|
593
596
|
_: 3
|
|
594
597
|
}, 8, ["appendTo"]);
|
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,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);
|
|
1
|
+
this.primevue=this.primevue||{},this.primevue.dialog=function(e,t,n,o,i,a,l,r,s,c){"use strict";function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=u(e),d=u(t),f=u(n),p=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.enableDocumentSettings(),this.bindGlobalListeners(),this.autoZIndex&&l.ZIndexUtils.set("modal",this.mask,this.baseZIndex+this.$primevue.config.zIndex.modal)},onAfterEnter:function(){this.focus()},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),f=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-f+"px")):(e.lastPageX=t.pageX,e.container.style.left=s-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&&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:p.default,WindowMaximizeIcon:f.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=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,onAfterEnter:a.onAfterEnter,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","onAfterEnter","onBeforeLeave","onLeave","onAfterLeave"])],16)):r.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);
|
|
@@ -25,13 +25,7 @@ export interface DialogServiceMethods {
|
|
|
25
25
|
open(content: any, options?: DynamicDialogOptions): DynamicDialogInstance;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
declare module 'vue
|
|
29
|
-
interface Vue {
|
|
30
|
-
$dialog: DialogServiceMethods;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
declare module '@vue/runtime-core' {
|
|
28
|
+
declare module 'vue' {
|
|
35
29
|
interface ComponentCustomProperties {
|
|
36
30
|
$dialog: DialogServiceMethods;
|
|
37
31
|
}
|
|
@@ -540,6 +540,11 @@ export default {
|
|
|
540
540
|
let isDecimalSign = this.isDecimalSign(char);
|
|
541
541
|
const isMinusSign = this.isMinusSign(char);
|
|
542
542
|
|
|
543
|
+
if (this.locale === 'fr-FR' && (event.code === 'Comma' || event.code === 'NumpadDecimal') && !isDecimalSign) {
|
|
544
|
+
isDecimalSign = true;
|
|
545
|
+
char = decimalSign;
|
|
546
|
+
}
|
|
547
|
+
|
|
543
548
|
if (event.code !== 'Enter') {
|
|
544
549
|
event.preventDefault();
|
|
545
550
|
}
|
|
@@ -608,6 +608,10 @@ var script = {
|
|
|
608
608
|
var _char = event.key;
|
|
609
609
|
var isDecimalSign = this.isDecimalSign(_char);
|
|
610
610
|
var isMinusSign = this.isMinusSign(_char);
|
|
611
|
+
if (this.locale === 'fr-FR' && (event.code === 'Comma' || event.code === 'NumpadDecimal') && !isDecimalSign) {
|
|
612
|
+
isDecimalSign = true;
|
|
613
|
+
_char = decimalSign;
|
|
614
|
+
}
|
|
611
615
|
if (event.code !== 'Enter') {
|
|
612
616
|
event.preventDefault();
|
|
613
617
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("primevue/button"),t=require("primevue/icons/angledown"),n=require("primevue/icons/angleup"),i=require("primevue/inputtext"),r=require("primevue/utils"),s=require("primevue/basecomponent"),a=require("primevue/inputnumber/style"),l=require("vue");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=u(e),c=u(t),h=u(n),p=u(i);function d(e){return d="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},d(e)}function m(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 f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach((function(t){g(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function g(e,t,n){var i;return(t="symbol"==d(i=y(t,"string"))?i:String(i))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e,t){if("object"!=d(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=d(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function v(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function x(e,t){if(e){if("string"==typeof e)return B(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?B(e,t):void 0}}function b(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function I(e){if(Array.isArray(e))return B(e)}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var S={name:"InputNumber",extends:{name:"BaseInputNumber",extends:u(s).default,props:{modelValue:{type:Number,default:null},format:{type:Boolean,default:!0},showButtons:{type:Boolean,default:!1},buttonLayout:{type:String,default:"stacked"},incrementButtonClass:{type:String,default:null},decrementButtonClass:{type:String,default:null},incrementButtonIcon:{type:String,default:void 0},decrementButtonIcon:{type:String,default:void 0},locale:{type:String,default:void 0},localeMatcher:{type:String,default:void 0},mode:{type:String,default:"decimal"},prefix:{type:String,default:null},suffix:{type:String,default:null},currency:{type:String,default:void 0},currencyDisplay:{type:String,default:void 0},useGrouping:{type:Boolean,default:!0},minFractionDigits:{type:Number,default:void 0},maxFractionDigits:{type:Number,default:void 0},roundingMode:{type:String,default:"halfExpand",validator:function(e){return["ceil","floor","expand","trunc","halfCeil","halfFloor","halfExpand","halfTrunc","halfEven"].includes(e)}},min:{type:Number,default:null},max:{type:Number,default:null},step:{type:Number,default:1},allowEmpty:{type:Boolean,default:!0},highlightOnFocus:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},variant:{type:String,default:null},invalid:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:null},inputId:{type:String,default:null},inputClass:{type:[String,Object],default:null},inputStyle:{type:Object,default:null},inputProps:{type:null,default:null},incrementButtonProps:{type:null,default:null},decrementButtonProps:{type:null,default:null},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null}},style:u(a).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,emits:["update:modelValue","input","focus","blur"],numberFormat:null,_numeral:null,_decimal:null,_group:null,_minusSign:null,_currency:null,_suffix:null,_prefix:null,_index:null,groupChar:"",isSpecialChar:null,prefixChar:null,suffixChar:null,timer:null,data:function(){return{d_modelValue:this.modelValue,focused:!1}},watch:{modelValue:function(e){this.d_modelValue=e},locale:function(e,t){this.updateConstructParser(e,t)},localeMatcher:function(e,t){this.updateConstructParser(e,t)},mode:function(e,t){this.updateConstructParser(e,t)},currency:function(e,t){this.updateConstructParser(e,t)},currencyDisplay:function(e,t){this.updateConstructParser(e,t)},useGrouping:function(e,t){this.updateConstructParser(e,t)},minFractionDigits:function(e,t){this.updateConstructParser(e,t)},maxFractionDigits:function(e,t){this.updateConstructParser(e,t)},suffix:function(e,t){this.updateConstructParser(e,t)},prefix:function(e,t){this.updateConstructParser(e,t)}},created:function(){this.constructParser()},methods:{getOptions:function(){var e,t;return{localeMatcher:this.localeMatcher,style:this.mode,currency:this.currency,currencyDisplay:this.currencyDisplay,useGrouping:this.useGrouping,minimumFractionDigits:null!==(e=this.minFractionDigits)&&void 0!==e?e:void 0,maximumFractionDigits:null!==(t=this.maxFractionDigits)&&void 0!==t?t:void 0,roundingMode:this.roundingMode}},constructParser:function(){this.numberFormat=new Intl.NumberFormat(this.locale,this.getOptions());var e,t=(e=new Intl.NumberFormat(this.locale,{useGrouping:!1}).format(9876543210),I(e)||b(e)||x(e)||v()).reverse(),n=new Map(t.map((function(e,t){return[e,t]})));this._numeral=new RegExp("[".concat(t.join(""),"]"),"g"),this._group=this.getGroupingExpression(),this._minusSign=this.getMinusSignExpression(),this._currency=this.getCurrencyExpression(),this._decimal=this.getDecimalExpression(),this._suffix=this.getSuffixExpression(),this._prefix=this.getPrefixExpression(),this._index=function(e){return n.get(e)}},updateConstructParser:function(e,t){e!==t&&this.constructParser()},escapeRegExp:function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},getDecimalExpression:function(){var e=new Intl.NumberFormat(this.locale,f(f({},this.getOptions()),{},{useGrouping:!1}));return new RegExp("[".concat(e.format(1.1).replace(this._currency,"").trim().replace(this._numeral,""),"]"),"g")},getGroupingExpression:function(){var e=new Intl.NumberFormat(this.locale,{useGrouping:!0});return this.groupChar=e.format(1e6).trim().replace(this._numeral,"").charAt(0),new RegExp("[".concat(this.groupChar,"]"),"g")},getMinusSignExpression:function(){var e=new Intl.NumberFormat(this.locale,{useGrouping:!1});return new RegExp("[".concat(e.format(-1).trim().replace(this._numeral,""),"]"),"g")},getCurrencyExpression:function(){if(this.currency){var e=new Intl.NumberFormat(this.locale,{style:"currency",currency:this.currency,currencyDisplay:this.currencyDisplay,minimumFractionDigits:0,maximumFractionDigits:0,roundingMode:this.roundingMode});return new RegExp("[".concat(e.format(1).replace(/\s/g,"").replace(this._numeral,"").replace(this._group,""),"]"),"g")}return new RegExp("[]","g")},getPrefixExpression:function(){if(this.prefix)this.prefixChar=this.prefix;else{var e=new Intl.NumberFormat(this.locale,{style:this.mode,currency:this.currency,currencyDisplay:this.currencyDisplay});this.prefixChar=e.format(1).split("1")[0]}return new RegExp("".concat(this.escapeRegExp(this.prefixChar||"")),"g")},getSuffixExpression:function(){if(this.suffix)this.suffixChar=this.suffix;else{var e=new Intl.NumberFormat(this.locale,{style:this.mode,currency:this.currency,currencyDisplay:this.currencyDisplay,minimumFractionDigits:0,maximumFractionDigits:0,roundingMode:this.roundingMode});this.suffixChar=e.format(1).split("1")[1]}return new RegExp("".concat(this.escapeRegExp(this.suffixChar||"")),"g")},formatValue:function(e){if(null!=e){if("-"===e)return e;if(this.format){var t=new Intl.NumberFormat(this.locale,this.getOptions()).format(e);return this.prefix&&(t=this.prefix+t),this.suffix&&(t+=this.suffix),t}return e.toString()}return""},parseValue:function(e){var t=e.replace(this._suffix,"").replace(this._prefix,"").trim().replace(/\s/g,"").replace(this._currency,"").replace(this._group,"").replace(this._minusSign,"-").replace(this._decimal,".").replace(this._numeral,this._index);if(t){if("-"===t)return t;var n=+t;return isNaN(n)?null:n}return null},repeat:function(e,t,n){var i=this;if(!this.readonly){var r=t||500;this.clearTimer(),this.timer=setTimeout((function(){i.repeat(e,40,n)}),r),this.spin(e,n)}},spin:function(e,t){if(this.$refs.input){var n=this.step*t,i=this.parseValue(this.$refs.input.$el.value)||0,r=this.validateValue(i+n);this.updateInput(r,null,"spin"),this.updateModel(e,r),this.handleOnInput(e,i,r)}},onUpButtonMouseDown:function(e){this.disabled||(this.$refs.input.$el.focus(),this.repeat(e,null,1),e.preventDefault())},onUpButtonMouseUp:function(){this.disabled||this.clearTimer()},onUpButtonMouseLeave:function(){this.disabled||this.clearTimer()},onUpButtonKeyUp:function(){this.disabled||this.clearTimer()},onUpButtonKeyDown:function(e){"Space"!==e.code&&"Enter"!==e.code&&"NumpadEnter"!==e.code||this.repeat(e,null,1)},onDownButtonMouseDown:function(e){this.disabled||(this.$refs.input.$el.focus(),this.repeat(e,null,-1),e.preventDefault())},onDownButtonMouseUp:function(){this.disabled||this.clearTimer()},onDownButtonMouseLeave:function(){this.disabled||this.clearTimer()},onDownButtonKeyUp:function(){this.disabled||this.clearTimer()},onDownButtonKeyDown:function(e){"Space"!==e.code&&"Enter"!==e.code&&"NumpadEnter"!==e.code||this.repeat(e,null,-1)},onUserInput:function(){this.isSpecialChar&&(this.$refs.input.$el.value=this.lastValue),this.isSpecialChar=!1},onInputKeyDown:function(e){if(!this.readonly){if(e.altKey||e.ctrlKey||e.metaKey)return this.isSpecialChar=!0,void(this.lastValue=this.$refs.input.$el.value);this.lastValue=e.target.value;var t=e.target.selectionStart,n=e.target.selectionEnd,i=e.target.value,s=null;switch(e.code){case"ArrowUp":this.spin(e,1),e.preventDefault();break;case"ArrowDown":this.spin(e,-1),e.preventDefault();break;case"ArrowLeft":this.isNumeralChar(i.charAt(t-1))||e.preventDefault();break;case"ArrowRight":this.isNumeralChar(i.charAt(t))||e.preventDefault();break;case"Tab":case"Enter":case"NumpadEnter":s=this.validateValue(this.parseValue(i)),this.$refs.input.$el.value=this.formatValue(s),this.$refs.input.$el.setAttribute("aria-valuenow",s),this.updateModel(e,s);break;case"Backspace":if(e.preventDefault(),t===n){var a=i.charAt(t-1),l=this.getDecimalCharIndexes(i),u=l.decimalCharIndex,o=l.decimalCharIndexWithoutPrefix;if(this.isNumeralChar(a)){var c=this.getDecimalLength(i);if(this._group.test(a))this._group.lastIndex=0,s=i.slice(0,t-2)+i.slice(t-1);else if(this._decimal.test(a))this._decimal.lastIndex=0,c?this.$refs.input.$el.setSelectionRange(t-1,t-1):s=i.slice(0,t-1)+i.slice(t);else if(u>0&&t>u){var h=this.isDecimalMode()&&(this.minFractionDigits||0)<c?"":"0";s=i.slice(0,t-1)+h+i.slice(t)}else 1===o?(s=i.slice(0,t-1)+"0"+i.slice(t),s=this.parseValue(s)>0?s:""):s=i.slice(0,t-1)+i.slice(t)}this.updateValue(e,s,null,"delete-single")}else s=this.deleteRange(i,t,n),this.updateValue(e,s,null,"delete-range");break;case"Delete":if(e.preventDefault(),t===n){var p=i.charAt(t),d=this.getDecimalCharIndexes(i),m=d.decimalCharIndex,f=d.decimalCharIndexWithoutPrefix;if(this.isNumeralChar(p)){var g=this.getDecimalLength(i);if(this._group.test(p))this._group.lastIndex=0,s=i.slice(0,t)+i.slice(t+2);else if(this._decimal.test(p))this._decimal.lastIndex=0,g?this.$refs.input.$el.setSelectionRange(t+1,t+1):s=i.slice(0,t)+i.slice(t+1);else if(m>0&&t>m){var y=this.isDecimalMode()&&(this.minFractionDigits||0)<g?"":"0";s=i.slice(0,t)+y+i.slice(t+1)}else 1===f?(s=i.slice(0,t)+"0"+i.slice(t+1),s=this.parseValue(s)>0?s:""):s=i.slice(0,t)+i.slice(t+1)}this.updateValue(e,s,null,"delete-back-single")}else s=this.deleteRange(i,t,n),this.updateValue(e,s,null,"delete-range");break;case"Home":e.preventDefault(),r.ObjectUtils.isEmpty(this.min)||this.updateModel(e,this.min);break;case"End":e.preventDefault(),r.ObjectUtils.isEmpty(this.max)||this.updateModel(e,this.max)}}},onInputKeyPress:function(e){if(!this.readonly){var t=e.key,n=this.isDecimalSign(t),i=this.isMinusSign(t);"Enter"!==e.code&&e.preventDefault(),(Number(t)>=0&&Number(t)<=9||i||n)&&this.insert(e,t,{isDecimalSign:n,isMinusSign:i})}},onPaste:function(e){if(!this.readonly&&!this.disabled){e.preventDefault();var t=(e.clipboardData||window.clipboardData).getData("Text");if(t){var n=this.parseValue(t);null!=n&&this.insert(e,n.toString())}}},allowMinusSign:function(){return null===this.min||this.min<0},isMinusSign:function(e){return!(!this._minusSign.test(e)&&"-"!==e)&&(this._minusSign.lastIndex=0,!0)},isDecimalSign:function(e){return!!this._decimal.test(e)&&(this._decimal.lastIndex=0,!0)},isDecimalMode:function(){return"decimal"===this.mode},getDecimalCharIndexes:function(e){var t=e.search(this._decimal);this._decimal.lastIndex=0;var n=e.replace(this._prefix,"").trim().replace(/\s/g,"").replace(this._currency,"").search(this._decimal);return this._decimal.lastIndex=0,{decimalCharIndex:t,decimalCharIndexWithoutPrefix:n}},getCharIndexes:function(e){var t=e.search(this._decimal);this._decimal.lastIndex=0;var n=e.search(this._minusSign);this._minusSign.lastIndex=0;var i=e.search(this._suffix);this._suffix.lastIndex=0;var r=e.search(this._currency);return this._currency.lastIndex=0,{decimalCharIndex:t,minusCharIndex:n,suffixCharIndex:i,currencyCharIndex:r}},insert:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{isDecimalSign:!1,isMinusSign:!1},i=t.search(this._minusSign);if(this._minusSign.lastIndex=0,this.allowMinusSign()||-1===i){var r,s=this.$refs.input.$el.selectionStart,a=this.$refs.input.$el.selectionEnd,l=this.$refs.input.$el.value.trim(),u=this.getCharIndexes(l),o=u.decimalCharIndex,c=u.suffixCharIndex,h=u.currencyCharIndex;if(n.isMinusSign)0===s&&(r=l,-1!==u.minusCharIndex&&0===a||(r=this.insertText(l,t,0,a)),this.updateValue(e,r,t,"insert"));else if(n.isDecimalSign)o>0&&s===o?this.updateValue(e,l,t,"insert"):(o>s&&o<a||-1===o&&this.maxFractionDigits)&&(r=this.insertText(l,t,s,a),this.updateValue(e,r,t,"insert"));else{var p=this.numberFormat.resolvedOptions().maximumFractionDigits,d=s!==a?"range-insert":"insert";if(o>0&&s>o){if(s+t.length-(o+1)<=p){var m=h>=s?h-1:c>=s?c:l.length;r=l.slice(0,s)+t+l.slice(s+t.length,m)+l.slice(m),this.updateValue(e,r,t,d)}}else r=this.insertText(l,t,s,a),this.updateValue(e,r,t,d)}}},insertText:function(e,t,n,i){if(2===("."===t?t:t.split(".")).length){var r=e.slice(n,i).search(this._decimal);return this._decimal.lastIndex=0,r>0?e.slice(0,n)+this.formatValue(t)+e.slice(i):this.formatValue(t)||e}return i-n===e.length?this.formatValue(t):0===n?t+e.slice(i):i===e.length?e.slice(0,n)+t:e.slice(0,n)+t+e.slice(i)},deleteRange:function(e,t,n){return n-t===e.length?"":0===t?e.slice(n):n===e.length?e.slice(0,t):e.slice(0,t)+e.slice(n)},initCursor:function(){var e=this.$refs.input.$el.selectionStart,t=this.$refs.input.$el.value,n=t.length,i=null,r=(this.prefixChar||"").length,s=(t=t.replace(this._prefix,"")).charAt(e-=r);if(this.isNumeralChar(s))return e+r;for(var a=e-1;a>=0;){if(s=t.charAt(a),this.isNumeralChar(s)){i=a+r;break}a--}if(null!==i)this.$refs.input.$el.setSelectionRange(i+1,i+1);else{for(a=e;a<n;){if(s=t.charAt(a),this.isNumeralChar(s)){i=a+r;break}a++}null!==i&&this.$refs.input.$el.setSelectionRange(i,i)}return i||0},onInputClick:function(){this.readonly||this.$refs.input.$el.value===r.DomHandler.getSelection()||this.initCursor()},isNumeralChar:function(e){return!(1!==e.length||!(this._numeral.test(e)||this._decimal.test(e)||this._group.test(e)||this._minusSign.test(e)))&&(this.resetRegex(),!0)},resetRegex:function(){this._numeral.lastIndex=0,this._decimal.lastIndex=0,this._group.lastIndex=0,this._minusSign.lastIndex=0},updateValue:function(e,t,n,i){var r=this.$refs.input.$el.value,s=null;null!=t&&(s=this.parseValue(t),this.updateInput(s=s||this.allowEmpty?s:0,n,i,t),this.handleOnInput(e,r,s))},handleOnInput:function(e,t,n){this.isValueChanged(t,n)&&this.$emit("input",{originalEvent:e,value:n,formattedValue:t})},isValueChanged:function(e,t){return null===t&&null!==e||null!=t&&t!==("string"==typeof e?this.parseValue(e):e)},validateValue:function(e){return"-"===e||null==e?null:null!=this.min&&e<this.min?this.min:null!=this.max&&e>this.max?this.max:e},updateInput:function(e,t,n,i){t=t||"";var r=this.$refs.input.$el.value,s=this.formatValue(e),a=r.length;if(s!==i&&(s=this.concatValues(s,i)),0===a){this.$refs.input.$el.value=s,this.$refs.input.$el.setSelectionRange(0,0);var l=this.initCursor()+t.length;this.$refs.input.$el.setSelectionRange(l,l)}else{var u=this.$refs.input.$el.selectionStart,o=this.$refs.input.$el.selectionEnd;this.$refs.input.$el.value=s;var c=s.length;if("range-insert"===n){var h=this.parseValue((r||"").slice(0,u)),p=(null!==h?h.toString():"").split("").join("(".concat(this.groupChar,")?")),d=new RegExp(p,"g");d.test(s);var m=t.split("").join("(".concat(this.groupChar,")?")),f=new RegExp(m,"g");f.test(s.slice(d.lastIndex)),this.$refs.input.$el.setSelectionRange(o=d.lastIndex+f.lastIndex,o)}else if(c===a)"insert"===n||"delete-back-single"===n?this.$refs.input.$el.setSelectionRange(o+1,o+1):"delete-single"===n?this.$refs.input.$el.setSelectionRange(o-1,o-1):"delete-range"!==n&&"spin"!==n||this.$refs.input.$el.setSelectionRange(o,o);else if("delete-back-single"===n){var g=r.charAt(o-1),y=r.charAt(o),v=a-c,x=this._group.test(y);x&&1===v?o+=1:!x&&this.isNumeralChar(g)&&(o+=-1*v+1),this._group.lastIndex=0,this.$refs.input.$el.setSelectionRange(o,o)}else if("-"===r&&"insert"===n){this.$refs.input.$el.setSelectionRange(0,0);var b=this.initCursor()+t.length+1;this.$refs.input.$el.setSelectionRange(b,b)}else this.$refs.input.$el.setSelectionRange(o+=c-a,o)}this.$refs.input.$el.setAttribute("aria-valuenow",e)},concatValues:function(e,t){if(e&&t){var n=t.search(this._decimal);return this._decimal.lastIndex=0,this.suffixChar?-1!==n?e.replace(this.suffixChar,"").split(this._decimal)[0]+t.replace(this.suffixChar,"").slice(n)+this.suffixChar:e:-1!==n?e.split(this._decimal)[0]+t.slice(n):e}return e},getDecimalLength:function(e){if(e){var t=e.split(this._decimal);if(2===t.length)return t[1].replace(this._suffix,"").trim().replace(/\s/g,"").replace(this._currency,"").length}return 0},updateModel:function(e,t){this.d_modelValue=t,this.$emit("update:modelValue",t)},onInputFocus:function(e){this.focused=!0,this.disabled||this.readonly||this.$refs.input.$el.value===r.DomHandler.getSelection()||!this.highlightOnFocus||e.target.select(),this.$emit("focus",e)},onInputBlur:function(e){this.focused=!1;var t=e.target,n=this.validateValue(this.parseValue(t.value));this.$emit("blur",{originalEvent:e,value:t.value}),t.value=this.formatValue(n),t.setAttribute("aria-valuenow",n),this.updateModel(e,n),this.disabled||this.readonly||!this.highlightOnFocus||r.DomHandler.clearSelection()},clearTimer:function(){this.timer&&clearInterval(this.timer)},maxBoundry:function(){return this.d_modelValue>=this.max},minBoundry:function(){return this.d_modelValue<=this.min}},computed:{filled:function(){return null!=this.modelValue&&this.modelValue.toString().length>0},upButtonListeners:function(){var e=this;return{mousedown:function(t){return e.onUpButtonMouseDown(t)},mouseup:function(t){return e.onUpButtonMouseUp(t)},mouseleave:function(t){return e.onUpButtonMouseLeave(t)},keydown:function(t){return e.onUpButtonKeyDown(t)},keyup:function(t){return e.onUpButtonKeyUp(t)}}},downButtonListeners:function(){var e=this;return{mousedown:function(t){return e.onDownButtonMouseDown(t)},mouseup:function(t){return e.onDownButtonMouseUp(t)},mouseleave:function(t){return e.onDownButtonMouseLeave(t)},keydown:function(t){return e.onDownButtonKeyDown(t)},keyup:function(t){return e.onDownButtonKeyUp(t)}}},formattedValue:function(){return this.formatValue(this.modelValue||this.allowEmpty?this.modelValue:0)},getFormatter:function(){return this.numberFormat}},components:{INInputText:p.default,INButton:o.default,AngleUpIcon:h.default,AngleDownIcon:c.default}};S.render=function(e,t,n,i,r,s){var a=l.resolveComponent("INInputText"),u=l.resolveComponent("INButton");return l.openBlock(),l.createElementBlock("span",l.mergeProps({class:e.cx("root")},e.ptmi("root")),[l.createVNode(a,l.mergeProps({ref:"input",id:e.inputId,role:"spinbutton",class:[e.cx("input"),e.inputClass],style:e.inputStyle,value:s.formattedValue,"aria-valuemin":e.min,"aria-valuemax":e.max,"aria-valuenow":e.modelValue,inputmode:"decimal"!==e.mode||e.minFractionDigits?"decimal":"numeric",disabled:e.disabled,readonly:e.readonly,placeholder:e.placeholder,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,"aria-invalid":e.invalid||void 0,onInput:s.onUserInput,onKeydown:s.onInputKeyDown,onKeypress:s.onInputKeyPress,onPaste:s.onPaste,onClick:s.onInputClick,onFocus:s.onInputFocus,onBlur:s.onInputBlur},e.inputProps,{pt:e.ptm("input"),unstyled:e.unstyled}),null,16,["id","class","style","value","aria-valuemin","aria-valuemax","aria-valuenow","inputmode","disabled","readonly","placeholder","aria-labelledby","aria-label","aria-invalid","onInput","onKeydown","onKeypress","onPaste","onClick","onFocus","onBlur","pt","unstyled"]),e.showButtons&&"stacked"===e.buttonLayout?(l.openBlock(),l.createElementBlock("span",l.mergeProps({key:0,class:e.cx("buttonGroup")},e.ptm("buttonGroup")),[l.createVNode(u,l.mergeProps({class:[e.cx("incrementButton"),e.incrementButtonClass]},l.toHandlers(s.upButtonListeners),{disabled:e.disabled,tabindex:-1,"aria-hidden":"true"},e.incrementButtonProps,{pt:e.ptm("incrementButton"),unstyled:e.unstyled}),{icon:l.withCtx((function(){return[l.renderSlot(e.$slots,"incrementbuttonicon",{},(function(){return[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.incrementButtonIcon?"span":"AngleUpIcon"),l.mergeProps({class:e.incrementButtonIcon},e.ptm("incrementButton").icon,{"data-pc-section":"incrementbuttonicon"}),null,16,["class"]))]}))]})),_:3},16,["class","disabled","pt","unstyled"]),l.createVNode(u,l.mergeProps({class:[e.cx("decrementButton"),e.decrementButtonClass]},l.toHandlers(s.downButtonListeners),{disabled:e.disabled,tabindex:-1,"aria-hidden":"true"},e.decrementButtonProps,{pt:e.ptm("decrementButton"),unstyled:e.unstyled}),{icon:l.withCtx((function(){return[l.renderSlot(e.$slots,"decrementbuttonicon",{},(function(){return[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.decrementButtonIcon?"span":"AngleDownIcon"),l.mergeProps({class:e.decrementButtonIcon},e.ptm("decrementButton").icon,{"data-pc-section":"decrementbuttonicon"}),null,16,["class"]))]}))]})),_:3},16,["class","disabled","pt","unstyled"])],16)):l.createCommentVNode("",!0),e.showButtons&&"stacked"!==e.buttonLayout?(l.openBlock(),l.createBlock(u,l.mergeProps({key:1,class:[e.cx("incrementButton"),e.incrementButtonClass]},l.toHandlers(s.upButtonListeners),{disabled:e.disabled,tabindex:-1,"aria-hidden":"true"},e.incrementButtonProps,{pt:e.ptm("incrementButton"),unstyled:e.unstyled}),{icon:l.withCtx((function(){return[l.renderSlot(e.$slots,"incrementbuttonicon",{},(function(){return[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.incrementButtonIcon?"span":"AngleUpIcon"),l.mergeProps({class:e.incrementButtonIcon},e.ptm("incrementButton").icon,{"data-pc-section":"incrementbuttonicon"}),null,16,["class"]))]}))]})),_:3},16,["class","disabled","pt","unstyled"])):l.createCommentVNode("",!0),e.showButtons&&"stacked"!==e.buttonLayout?(l.openBlock(),l.createBlock(u,l.mergeProps({key:2,class:[e.cx("decrementButton"),e.decrementButtonClass]},l.toHandlers(s.downButtonListeners),{disabled:e.disabled,tabindex:-1,"aria-hidden":"true"},e.decrementButtonProps,{pt:e.ptm("decrementButton"),unstyled:e.unstyled}),{icon:l.withCtx((function(){return[l.renderSlot(e.$slots,"decrementbuttonicon",{},(function(){return[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.decrementButtonIcon?"span":"AngleDownIcon"),l.mergeProps({class:e.decrementButtonIcon},e.ptm("decrementButton").icon,{"data-pc-section":"decrementbuttonicon"}),null,16,["class"]))]}))]})),_:3},16,["class","disabled","pt","unstyled"])):l.createCommentVNode("",!0)],16)},module.exports=S;
|
|
1
|
+
"use strict";var e=require("primevue/button"),t=require("primevue/icons/angledown"),n=require("primevue/icons/angleup"),i=require("primevue/inputtext"),r=require("primevue/utils"),s=require("primevue/basecomponent"),a=require("primevue/inputnumber/style"),l=require("vue");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=u(e),c=u(t),h=u(n),p=u(i);function d(e){return d="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},d(e)}function m(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 f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach((function(t){g(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function g(e,t,n){var i;return(t="symbol"==d(i=y(t,"string"))?i:String(i))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function y(e,t){if("object"!=d(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=d(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function v(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function x(e,t){if(e){if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,t):void 0}}function b(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function I(e){if(Array.isArray(e))return S(e)}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}var B={name:"InputNumber",extends:{name:"BaseInputNumber",extends:u(s).default,props:{modelValue:{type:Number,default:null},format:{type:Boolean,default:!0},showButtons:{type:Boolean,default:!1},buttonLayout:{type:String,default:"stacked"},incrementButtonClass:{type:String,default:null},decrementButtonClass:{type:String,default:null},incrementButtonIcon:{type:String,default:void 0},decrementButtonIcon:{type:String,default:void 0},locale:{type:String,default:void 0},localeMatcher:{type:String,default:void 0},mode:{type:String,default:"decimal"},prefix:{type:String,default:null},suffix:{type:String,default:null},currency:{type:String,default:void 0},currencyDisplay:{type:String,default:void 0},useGrouping:{type:Boolean,default:!0},minFractionDigits:{type:Number,default:void 0},maxFractionDigits:{type:Number,default:void 0},roundingMode:{type:String,default:"halfExpand",validator:function(e){return["ceil","floor","expand","trunc","halfCeil","halfFloor","halfExpand","halfTrunc","halfEven"].includes(e)}},min:{type:Number,default:null},max:{type:Number,default:null},step:{type:Number,default:1},allowEmpty:{type:Boolean,default:!0},highlightOnFocus:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},variant:{type:String,default:null},invalid:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:null},inputId:{type:String,default:null},inputClass:{type:[String,Object],default:null},inputStyle:{type:Object,default:null},inputProps:{type:null,default:null},incrementButtonProps:{type:null,default:null},decrementButtonProps:{type:null,default:null},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null}},style:u(a).default,provide:function(){return{$parentInstance:this}}},inheritAttrs:!1,emits:["update:modelValue","input","focus","blur"],numberFormat:null,_numeral:null,_decimal:null,_group:null,_minusSign:null,_currency:null,_suffix:null,_prefix:null,_index:null,groupChar:"",isSpecialChar:null,prefixChar:null,suffixChar:null,timer:null,data:function(){return{d_modelValue:this.modelValue,focused:!1}},watch:{modelValue:function(e){this.d_modelValue=e},locale:function(e,t){this.updateConstructParser(e,t)},localeMatcher:function(e,t){this.updateConstructParser(e,t)},mode:function(e,t){this.updateConstructParser(e,t)},currency:function(e,t){this.updateConstructParser(e,t)},currencyDisplay:function(e,t){this.updateConstructParser(e,t)},useGrouping:function(e,t){this.updateConstructParser(e,t)},minFractionDigits:function(e,t){this.updateConstructParser(e,t)},maxFractionDigits:function(e,t){this.updateConstructParser(e,t)},suffix:function(e,t){this.updateConstructParser(e,t)},prefix:function(e,t){this.updateConstructParser(e,t)}},created:function(){this.constructParser()},methods:{getOptions:function(){var e,t;return{localeMatcher:this.localeMatcher,style:this.mode,currency:this.currency,currencyDisplay:this.currencyDisplay,useGrouping:this.useGrouping,minimumFractionDigits:null!==(e=this.minFractionDigits)&&void 0!==e?e:void 0,maximumFractionDigits:null!==(t=this.maxFractionDigits)&&void 0!==t?t:void 0,roundingMode:this.roundingMode}},constructParser:function(){this.numberFormat=new Intl.NumberFormat(this.locale,this.getOptions());var e,t=(e=new Intl.NumberFormat(this.locale,{useGrouping:!1}).format(9876543210),I(e)||b(e)||x(e)||v()).reverse(),n=new Map(t.map((function(e,t){return[e,t]})));this._numeral=new RegExp("[".concat(t.join(""),"]"),"g"),this._group=this.getGroupingExpression(),this._minusSign=this.getMinusSignExpression(),this._currency=this.getCurrencyExpression(),this._decimal=this.getDecimalExpression(),this._suffix=this.getSuffixExpression(),this._prefix=this.getPrefixExpression(),this._index=function(e){return n.get(e)}},updateConstructParser:function(e,t){e!==t&&this.constructParser()},escapeRegExp:function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")},getDecimalExpression:function(){var e=new Intl.NumberFormat(this.locale,f(f({},this.getOptions()),{},{useGrouping:!1}));return new RegExp("[".concat(e.format(1.1).replace(this._currency,"").trim().replace(this._numeral,""),"]"),"g")},getGroupingExpression:function(){var e=new Intl.NumberFormat(this.locale,{useGrouping:!0});return this.groupChar=e.format(1e6).trim().replace(this._numeral,"").charAt(0),new RegExp("[".concat(this.groupChar,"]"),"g")},getMinusSignExpression:function(){var e=new Intl.NumberFormat(this.locale,{useGrouping:!1});return new RegExp("[".concat(e.format(-1).trim().replace(this._numeral,""),"]"),"g")},getCurrencyExpression:function(){if(this.currency){var e=new Intl.NumberFormat(this.locale,{style:"currency",currency:this.currency,currencyDisplay:this.currencyDisplay,minimumFractionDigits:0,maximumFractionDigits:0,roundingMode:this.roundingMode});return new RegExp("[".concat(e.format(1).replace(/\s/g,"").replace(this._numeral,"").replace(this._group,""),"]"),"g")}return new RegExp("[]","g")},getPrefixExpression:function(){if(this.prefix)this.prefixChar=this.prefix;else{var e=new Intl.NumberFormat(this.locale,{style:this.mode,currency:this.currency,currencyDisplay:this.currencyDisplay});this.prefixChar=e.format(1).split("1")[0]}return new RegExp("".concat(this.escapeRegExp(this.prefixChar||"")),"g")},getSuffixExpression:function(){if(this.suffix)this.suffixChar=this.suffix;else{var e=new Intl.NumberFormat(this.locale,{style:this.mode,currency:this.currency,currencyDisplay:this.currencyDisplay,minimumFractionDigits:0,maximumFractionDigits:0,roundingMode:this.roundingMode});this.suffixChar=e.format(1).split("1")[1]}return new RegExp("".concat(this.escapeRegExp(this.suffixChar||"")),"g")},formatValue:function(e){if(null!=e){if("-"===e)return e;if(this.format){var t=new Intl.NumberFormat(this.locale,this.getOptions()).format(e);return this.prefix&&(t=this.prefix+t),this.suffix&&(t+=this.suffix),t}return e.toString()}return""},parseValue:function(e){var t=e.replace(this._suffix,"").replace(this._prefix,"").trim().replace(/\s/g,"").replace(this._currency,"").replace(this._group,"").replace(this._minusSign,"-").replace(this._decimal,".").replace(this._numeral,this._index);if(t){if("-"===t)return t;var n=+t;return isNaN(n)?null:n}return null},repeat:function(e,t,n){var i=this;if(!this.readonly){var r=t||500;this.clearTimer(),this.timer=setTimeout((function(){i.repeat(e,40,n)}),r),this.spin(e,n)}},spin:function(e,t){if(this.$refs.input){var n=this.step*t,i=this.parseValue(this.$refs.input.$el.value)||0,r=this.validateValue(i+n);this.updateInput(r,null,"spin"),this.updateModel(e,r),this.handleOnInput(e,i,r)}},onUpButtonMouseDown:function(e){this.disabled||(this.$refs.input.$el.focus(),this.repeat(e,null,1),e.preventDefault())},onUpButtonMouseUp:function(){this.disabled||this.clearTimer()},onUpButtonMouseLeave:function(){this.disabled||this.clearTimer()},onUpButtonKeyUp:function(){this.disabled||this.clearTimer()},onUpButtonKeyDown:function(e){"Space"!==e.code&&"Enter"!==e.code&&"NumpadEnter"!==e.code||this.repeat(e,null,1)},onDownButtonMouseDown:function(e){this.disabled||(this.$refs.input.$el.focus(),this.repeat(e,null,-1),e.preventDefault())},onDownButtonMouseUp:function(){this.disabled||this.clearTimer()},onDownButtonMouseLeave:function(){this.disabled||this.clearTimer()},onDownButtonKeyUp:function(){this.disabled||this.clearTimer()},onDownButtonKeyDown:function(e){"Space"!==e.code&&"Enter"!==e.code&&"NumpadEnter"!==e.code||this.repeat(e,null,-1)},onUserInput:function(){this.isSpecialChar&&(this.$refs.input.$el.value=this.lastValue),this.isSpecialChar=!1},onInputKeyDown:function(e){if(!this.readonly){if(e.altKey||e.ctrlKey||e.metaKey)return this.isSpecialChar=!0,void(this.lastValue=this.$refs.input.$el.value);this.lastValue=e.target.value;var t=e.target.selectionStart,n=e.target.selectionEnd,i=e.target.value,s=null;switch(e.code){case"ArrowUp":this.spin(e,1),e.preventDefault();break;case"ArrowDown":this.spin(e,-1),e.preventDefault();break;case"ArrowLeft":this.isNumeralChar(i.charAt(t-1))||e.preventDefault();break;case"ArrowRight":this.isNumeralChar(i.charAt(t))||e.preventDefault();break;case"Tab":case"Enter":case"NumpadEnter":s=this.validateValue(this.parseValue(i)),this.$refs.input.$el.value=this.formatValue(s),this.$refs.input.$el.setAttribute("aria-valuenow",s),this.updateModel(e,s);break;case"Backspace":if(e.preventDefault(),t===n){var a=i.charAt(t-1),l=this.getDecimalCharIndexes(i),u=l.decimalCharIndex,o=l.decimalCharIndexWithoutPrefix;if(this.isNumeralChar(a)){var c=this.getDecimalLength(i);if(this._group.test(a))this._group.lastIndex=0,s=i.slice(0,t-2)+i.slice(t-1);else if(this._decimal.test(a))this._decimal.lastIndex=0,c?this.$refs.input.$el.setSelectionRange(t-1,t-1):s=i.slice(0,t-1)+i.slice(t);else if(u>0&&t>u){var h=this.isDecimalMode()&&(this.minFractionDigits||0)<c?"":"0";s=i.slice(0,t-1)+h+i.slice(t)}else 1===o?(s=i.slice(0,t-1)+"0"+i.slice(t),s=this.parseValue(s)>0?s:""):s=i.slice(0,t-1)+i.slice(t)}this.updateValue(e,s,null,"delete-single")}else s=this.deleteRange(i,t,n),this.updateValue(e,s,null,"delete-range");break;case"Delete":if(e.preventDefault(),t===n){var p=i.charAt(t),d=this.getDecimalCharIndexes(i),m=d.decimalCharIndex,f=d.decimalCharIndexWithoutPrefix;if(this.isNumeralChar(p)){var g=this.getDecimalLength(i);if(this._group.test(p))this._group.lastIndex=0,s=i.slice(0,t)+i.slice(t+2);else if(this._decimal.test(p))this._decimal.lastIndex=0,g?this.$refs.input.$el.setSelectionRange(t+1,t+1):s=i.slice(0,t)+i.slice(t+1);else if(m>0&&t>m){var y=this.isDecimalMode()&&(this.minFractionDigits||0)<g?"":"0";s=i.slice(0,t)+y+i.slice(t+1)}else 1===f?(s=i.slice(0,t)+"0"+i.slice(t+1),s=this.parseValue(s)>0?s:""):s=i.slice(0,t)+i.slice(t+1)}this.updateValue(e,s,null,"delete-back-single")}else s=this.deleteRange(i,t,n),this.updateValue(e,s,null,"delete-range");break;case"Home":e.preventDefault(),r.ObjectUtils.isEmpty(this.min)||this.updateModel(e,this.min);break;case"End":e.preventDefault(),r.ObjectUtils.isEmpty(this.max)||this.updateModel(e,this.max)}}},onInputKeyPress:function(e){if(!this.readonly){var t=e.key,n=this.isDecimalSign(t),i=this.isMinusSign(t);"fr-FR"!==this.locale||"Comma"!==e.code&&"NumpadDecimal"!==e.code||n||(n=!0,t=decimalSign),"Enter"!==e.code&&e.preventDefault(),(Number(t)>=0&&Number(t)<=9||i||n)&&this.insert(e,t,{isDecimalSign:n,isMinusSign:i})}},onPaste:function(e){if(!this.readonly&&!this.disabled){e.preventDefault();var t=(e.clipboardData||window.clipboardData).getData("Text");if(t){var n=this.parseValue(t);null!=n&&this.insert(e,n.toString())}}},allowMinusSign:function(){return null===this.min||this.min<0},isMinusSign:function(e){return!(!this._minusSign.test(e)&&"-"!==e)&&(this._minusSign.lastIndex=0,!0)},isDecimalSign:function(e){return!!this._decimal.test(e)&&(this._decimal.lastIndex=0,!0)},isDecimalMode:function(){return"decimal"===this.mode},getDecimalCharIndexes:function(e){var t=e.search(this._decimal);this._decimal.lastIndex=0;var n=e.replace(this._prefix,"").trim().replace(/\s/g,"").replace(this._currency,"").search(this._decimal);return this._decimal.lastIndex=0,{decimalCharIndex:t,decimalCharIndexWithoutPrefix:n}},getCharIndexes:function(e){var t=e.search(this._decimal);this._decimal.lastIndex=0;var n=e.search(this._minusSign);this._minusSign.lastIndex=0;var i=e.search(this._suffix);this._suffix.lastIndex=0;var r=e.search(this._currency);return this._currency.lastIndex=0,{decimalCharIndex:t,minusCharIndex:n,suffixCharIndex:i,currencyCharIndex:r}},insert:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{isDecimalSign:!1,isMinusSign:!1},i=t.search(this._minusSign);if(this._minusSign.lastIndex=0,this.allowMinusSign()||-1===i){var r,s=this.$refs.input.$el.selectionStart,a=this.$refs.input.$el.selectionEnd,l=this.$refs.input.$el.value.trim(),u=this.getCharIndexes(l),o=u.decimalCharIndex,c=u.suffixCharIndex,h=u.currencyCharIndex;if(n.isMinusSign)0===s&&(r=l,-1!==u.minusCharIndex&&0===a||(r=this.insertText(l,t,0,a)),this.updateValue(e,r,t,"insert"));else if(n.isDecimalSign)o>0&&s===o?this.updateValue(e,l,t,"insert"):(o>s&&o<a||-1===o&&this.maxFractionDigits)&&(r=this.insertText(l,t,s,a),this.updateValue(e,r,t,"insert"));else{var p=this.numberFormat.resolvedOptions().maximumFractionDigits,d=s!==a?"range-insert":"insert";if(o>0&&s>o){if(s+t.length-(o+1)<=p){var m=h>=s?h-1:c>=s?c:l.length;r=l.slice(0,s)+t+l.slice(s+t.length,m)+l.slice(m),this.updateValue(e,r,t,d)}}else r=this.insertText(l,t,s,a),this.updateValue(e,r,t,d)}}},insertText:function(e,t,n,i){if(2===("."===t?t:t.split(".")).length){var r=e.slice(n,i).search(this._decimal);return this._decimal.lastIndex=0,r>0?e.slice(0,n)+this.formatValue(t)+e.slice(i):this.formatValue(t)||e}return i-n===e.length?this.formatValue(t):0===n?t+e.slice(i):i===e.length?e.slice(0,n)+t:e.slice(0,n)+t+e.slice(i)},deleteRange:function(e,t,n){return n-t===e.length?"":0===t?e.slice(n):n===e.length?e.slice(0,t):e.slice(0,t)+e.slice(n)},initCursor:function(){var e=this.$refs.input.$el.selectionStart,t=this.$refs.input.$el.value,n=t.length,i=null,r=(this.prefixChar||"").length,s=(t=t.replace(this._prefix,"")).charAt(e-=r);if(this.isNumeralChar(s))return e+r;for(var a=e-1;a>=0;){if(s=t.charAt(a),this.isNumeralChar(s)){i=a+r;break}a--}if(null!==i)this.$refs.input.$el.setSelectionRange(i+1,i+1);else{for(a=e;a<n;){if(s=t.charAt(a),this.isNumeralChar(s)){i=a+r;break}a++}null!==i&&this.$refs.input.$el.setSelectionRange(i,i)}return i||0},onInputClick:function(){this.readonly||this.$refs.input.$el.value===r.DomHandler.getSelection()||this.initCursor()},isNumeralChar:function(e){return!(1!==e.length||!(this._numeral.test(e)||this._decimal.test(e)||this._group.test(e)||this._minusSign.test(e)))&&(this.resetRegex(),!0)},resetRegex:function(){this._numeral.lastIndex=0,this._decimal.lastIndex=0,this._group.lastIndex=0,this._minusSign.lastIndex=0},updateValue:function(e,t,n,i){var r=this.$refs.input.$el.value,s=null;null!=t&&(s=this.parseValue(t),this.updateInput(s=s||this.allowEmpty?s:0,n,i,t),this.handleOnInput(e,r,s))},handleOnInput:function(e,t,n){this.isValueChanged(t,n)&&this.$emit("input",{originalEvent:e,value:n,formattedValue:t})},isValueChanged:function(e,t){return null===t&&null!==e||null!=t&&t!==("string"==typeof e?this.parseValue(e):e)},validateValue:function(e){return"-"===e||null==e?null:null!=this.min&&e<this.min?this.min:null!=this.max&&e>this.max?this.max:e},updateInput:function(e,t,n,i){t=t||"";var r=this.$refs.input.$el.value,s=this.formatValue(e),a=r.length;if(s!==i&&(s=this.concatValues(s,i)),0===a){this.$refs.input.$el.value=s,this.$refs.input.$el.setSelectionRange(0,0);var l=this.initCursor()+t.length;this.$refs.input.$el.setSelectionRange(l,l)}else{var u=this.$refs.input.$el.selectionStart,o=this.$refs.input.$el.selectionEnd;this.$refs.input.$el.value=s;var c=s.length;if("range-insert"===n){var h=this.parseValue((r||"").slice(0,u)),p=(null!==h?h.toString():"").split("").join("(".concat(this.groupChar,")?")),d=new RegExp(p,"g");d.test(s);var m=t.split("").join("(".concat(this.groupChar,")?")),f=new RegExp(m,"g");f.test(s.slice(d.lastIndex)),this.$refs.input.$el.setSelectionRange(o=d.lastIndex+f.lastIndex,o)}else if(c===a)"insert"===n||"delete-back-single"===n?this.$refs.input.$el.setSelectionRange(o+1,o+1):"delete-single"===n?this.$refs.input.$el.setSelectionRange(o-1,o-1):"delete-range"!==n&&"spin"!==n||this.$refs.input.$el.setSelectionRange(o,o);else if("delete-back-single"===n){var g=r.charAt(o-1),y=r.charAt(o),v=a-c,x=this._group.test(y);x&&1===v?o+=1:!x&&this.isNumeralChar(g)&&(o+=-1*v+1),this._group.lastIndex=0,this.$refs.input.$el.setSelectionRange(o,o)}else if("-"===r&&"insert"===n){this.$refs.input.$el.setSelectionRange(0,0);var b=this.initCursor()+t.length+1;this.$refs.input.$el.setSelectionRange(b,b)}else this.$refs.input.$el.setSelectionRange(o+=c-a,o)}this.$refs.input.$el.setAttribute("aria-valuenow",e)},concatValues:function(e,t){if(e&&t){var n=t.search(this._decimal);return this._decimal.lastIndex=0,this.suffixChar?-1!==n?e.replace(this.suffixChar,"").split(this._decimal)[0]+t.replace(this.suffixChar,"").slice(n)+this.suffixChar:e:-1!==n?e.split(this._decimal)[0]+t.slice(n):e}return e},getDecimalLength:function(e){if(e){var t=e.split(this._decimal);if(2===t.length)return t[1].replace(this._suffix,"").trim().replace(/\s/g,"").replace(this._currency,"").length}return 0},updateModel:function(e,t){this.d_modelValue=t,this.$emit("update:modelValue",t)},onInputFocus:function(e){this.focused=!0,this.disabled||this.readonly||this.$refs.input.$el.value===r.DomHandler.getSelection()||!this.highlightOnFocus||e.target.select(),this.$emit("focus",e)},onInputBlur:function(e){this.focused=!1;var t=e.target,n=this.validateValue(this.parseValue(t.value));this.$emit("blur",{originalEvent:e,value:t.value}),t.value=this.formatValue(n),t.setAttribute("aria-valuenow",n),this.updateModel(e,n),this.disabled||this.readonly||!this.highlightOnFocus||r.DomHandler.clearSelection()},clearTimer:function(){this.timer&&clearInterval(this.timer)},maxBoundry:function(){return this.d_modelValue>=this.max},minBoundry:function(){return this.d_modelValue<=this.min}},computed:{filled:function(){return null!=this.modelValue&&this.modelValue.toString().length>0},upButtonListeners:function(){var e=this;return{mousedown:function(t){return e.onUpButtonMouseDown(t)},mouseup:function(t){return e.onUpButtonMouseUp(t)},mouseleave:function(t){return e.onUpButtonMouseLeave(t)},keydown:function(t){return e.onUpButtonKeyDown(t)},keyup:function(t){return e.onUpButtonKeyUp(t)}}},downButtonListeners:function(){var e=this;return{mousedown:function(t){return e.onDownButtonMouseDown(t)},mouseup:function(t){return e.onDownButtonMouseUp(t)},mouseleave:function(t){return e.onDownButtonMouseLeave(t)},keydown:function(t){return e.onDownButtonKeyDown(t)},keyup:function(t){return e.onDownButtonKeyUp(t)}}},formattedValue:function(){return this.formatValue(this.modelValue||this.allowEmpty?this.modelValue:0)},getFormatter:function(){return this.numberFormat}},components:{INInputText:p.default,INButton:o.default,AngleUpIcon:h.default,AngleDownIcon:c.default}};B.render=function(e,t,n,i,r,s){var a=l.resolveComponent("INInputText"),u=l.resolveComponent("INButton");return l.openBlock(),l.createElementBlock("span",l.mergeProps({class:e.cx("root")},e.ptmi("root")),[l.createVNode(a,l.mergeProps({ref:"input",id:e.inputId,role:"spinbutton",class:[e.cx("input"),e.inputClass],style:e.inputStyle,value:s.formattedValue,"aria-valuemin":e.min,"aria-valuemax":e.max,"aria-valuenow":e.modelValue,inputmode:"decimal"!==e.mode||e.minFractionDigits?"decimal":"numeric",disabled:e.disabled,readonly:e.readonly,placeholder:e.placeholder,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,"aria-invalid":e.invalid||void 0,onInput:s.onUserInput,onKeydown:s.onInputKeyDown,onKeypress:s.onInputKeyPress,onPaste:s.onPaste,onClick:s.onInputClick,onFocus:s.onInputFocus,onBlur:s.onInputBlur},e.inputProps,{pt:e.ptm("input"),unstyled:e.unstyled}),null,16,["id","class","style","value","aria-valuemin","aria-valuemax","aria-valuenow","inputmode","disabled","readonly","placeholder","aria-labelledby","aria-label","aria-invalid","onInput","onKeydown","onKeypress","onPaste","onClick","onFocus","onBlur","pt","unstyled"]),e.showButtons&&"stacked"===e.buttonLayout?(l.openBlock(),l.createElementBlock("span",l.mergeProps({key:0,class:e.cx("buttonGroup")},e.ptm("buttonGroup")),[l.createVNode(u,l.mergeProps({class:[e.cx("incrementButton"),e.incrementButtonClass]},l.toHandlers(s.upButtonListeners),{disabled:e.disabled,tabindex:-1,"aria-hidden":"true"},e.incrementButtonProps,{pt:e.ptm("incrementButton"),unstyled:e.unstyled}),{icon:l.withCtx((function(){return[l.renderSlot(e.$slots,"incrementbuttonicon",{},(function(){return[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.incrementButtonIcon?"span":"AngleUpIcon"),l.mergeProps({class:e.incrementButtonIcon},e.ptm("incrementButton").icon,{"data-pc-section":"incrementbuttonicon"}),null,16,["class"]))]}))]})),_:3},16,["class","disabled","pt","unstyled"]),l.createVNode(u,l.mergeProps({class:[e.cx("decrementButton"),e.decrementButtonClass]},l.toHandlers(s.downButtonListeners),{disabled:e.disabled,tabindex:-1,"aria-hidden":"true"},e.decrementButtonProps,{pt:e.ptm("decrementButton"),unstyled:e.unstyled}),{icon:l.withCtx((function(){return[l.renderSlot(e.$slots,"decrementbuttonicon",{},(function(){return[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.decrementButtonIcon?"span":"AngleDownIcon"),l.mergeProps({class:e.decrementButtonIcon},e.ptm("decrementButton").icon,{"data-pc-section":"decrementbuttonicon"}),null,16,["class"]))]}))]})),_:3},16,["class","disabled","pt","unstyled"])],16)):l.createCommentVNode("",!0),e.showButtons&&"stacked"!==e.buttonLayout?(l.openBlock(),l.createBlock(u,l.mergeProps({key:1,class:[e.cx("incrementButton"),e.incrementButtonClass]},l.toHandlers(s.upButtonListeners),{disabled:e.disabled,tabindex:-1,"aria-hidden":"true"},e.incrementButtonProps,{pt:e.ptm("incrementButton"),unstyled:e.unstyled}),{icon:l.withCtx((function(){return[l.renderSlot(e.$slots,"incrementbuttonicon",{},(function(){return[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.incrementButtonIcon?"span":"AngleUpIcon"),l.mergeProps({class:e.incrementButtonIcon},e.ptm("incrementButton").icon,{"data-pc-section":"incrementbuttonicon"}),null,16,["class"]))]}))]})),_:3},16,["class","disabled","pt","unstyled"])):l.createCommentVNode("",!0),e.showButtons&&"stacked"!==e.buttonLayout?(l.openBlock(),l.createBlock(u,l.mergeProps({key:2,class:[e.cx("decrementButton"),e.decrementButtonClass]},l.toHandlers(s.downButtonListeners),{disabled:e.disabled,tabindex:-1,"aria-hidden":"true"},e.decrementButtonProps,{pt:e.ptm("decrementButton"),unstyled:e.unstyled}),{icon:l.withCtx((function(){return[l.renderSlot(e.$slots,"decrementbuttonicon",{},(function(){return[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(e.decrementButtonIcon?"span":"AngleDownIcon"),l.mergeProps({class:e.decrementButtonIcon},e.ptm("decrementButton").icon,{"data-pc-section":"decrementbuttonicon"}),null,16,["class"]))]}))]})),_:3},16,["class","disabled","pt","unstyled"])):l.createCommentVNode("",!0)],16)},module.exports=B;
|
|
@@ -597,6 +597,10 @@ var script = {
|
|
|
597
597
|
var _char = event.key;
|
|
598
598
|
var isDecimalSign = this.isDecimalSign(_char);
|
|
599
599
|
var isMinusSign = this.isMinusSign(_char);
|
|
600
|
+
if (this.locale === 'fr-FR' && (event.code === 'Comma' || event.code === 'NumpadDecimal') && !isDecimalSign) {
|
|
601
|
+
isDecimalSign = true;
|
|
602
|
+
_char = decimalSign;
|
|
603
|
+
}
|
|
600
604
|
if (event.code !== 'Enter') {
|
|
601
605
|
event.preventDefault();
|
|
602
606
|
}
|