primevue 3.18.1 → 3.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +11 -3
  2. package/calendar/Calendar.vue +1 -1
  3. package/calendar/calendar.cjs.js +1 -1
  4. package/calendar/calendar.cjs.min.js +1 -1
  5. package/calendar/calendar.esm.js +1 -1
  6. package/calendar/calendar.esm.min.js +1 -1
  7. package/calendar/calendar.js +1 -1
  8. package/calendar/calendar.min.js +1 -1
  9. package/chips/Chips.d.ts +2 -2
  10. package/chips/Chips.vue +6 -2
  11. package/chips/chips.cjs.js +6 -2
  12. package/chips/chips.cjs.min.js +1 -1
  13. package/chips/chips.esm.js +6 -2
  14. package/chips/chips.esm.min.js +1 -1
  15. package/chips/chips.js +6 -2
  16. package/chips/chips.min.js +1 -1
  17. package/confirmdialog/ConfirmDialog.vue +6 -1
  18. package/confirmdialog/confirmdialog.cjs.js +7 -1
  19. package/confirmdialog/confirmdialog.cjs.min.js +1 -1
  20. package/confirmdialog/confirmdialog.esm.js +7 -1
  21. package/confirmdialog/confirmdialog.esm.min.js +1 -1
  22. package/confirmdialog/confirmdialog.js +7 -1
  23. package/confirmdialog/confirmdialog.min.js +1 -1
  24. package/confirmpopup/ConfirmPopup.vue +59 -5
  25. package/confirmpopup/confirmpopup.cjs.js +83 -19
  26. package/confirmpopup/confirmpopup.cjs.min.js +1 -1
  27. package/confirmpopup/confirmpopup.esm.js +82 -19
  28. package/confirmpopup/confirmpopup.esm.min.js +1 -1
  29. package/confirmpopup/confirmpopup.js +82 -19
  30. package/confirmpopup/confirmpopup.min.js +1 -1
  31. package/core/core.js +244 -69
  32. package/core/core.min.js +7 -5
  33. package/datatable/DataTable.d.ts +1 -1
  34. package/datatable/DataTable.vue +1 -1
  35. package/datatable/HeaderCell.vue +1 -1
  36. package/datatable/TableBody.vue +1 -1
  37. package/datatable/TableHeader.vue +1 -1
  38. package/datatable/datatable.cjs.js +4 -4
  39. package/datatable/datatable.cjs.min.js +1 -1
  40. package/datatable/datatable.esm.js +4 -4
  41. package/datatable/datatable.esm.min.js +1 -1
  42. package/datatable/datatable.js +4 -4
  43. package/datatable/datatable.min.js +1 -1
  44. package/dialog/Dialog.d.ts +4 -5
  45. package/dialog/Dialog.vue +95 -44
  46. package/dialog/dialog.cjs.js +123 -62
  47. package/dialog/dialog.cjs.min.js +1 -1
  48. package/dialog/dialog.esm.js +123 -63
  49. package/dialog/dialog.esm.min.js +1 -1
  50. package/dialog/dialog.js +124 -64
  51. package/dialog/dialog.min.js +1 -1
  52. package/focustrap/FocusTrap.d.ts +5 -0
  53. package/focustrap/focustrap.cjs.js +94 -0
  54. package/focustrap/focustrap.cjs.min.js +1 -0
  55. package/focustrap/focustrap.esm.js +92 -0
  56. package/focustrap/focustrap.esm.min.js +1 -0
  57. package/focustrap/focustrap.js +96 -0
  58. package/focustrap/focustrap.min.js +1 -0
  59. package/focustrap/package.json +6 -0
  60. package/megamenu/MegaMenu.vue +3 -2
  61. package/megamenu/megamenu.cjs.js +3 -2
  62. package/megamenu/megamenu.cjs.min.js +1 -1
  63. package/megamenu/megamenu.esm.js +3 -2
  64. package/megamenu/megamenu.esm.min.js +1 -1
  65. package/megamenu/megamenu.js +3 -2
  66. package/megamenu/megamenu.min.js +1 -1
  67. package/menu/Menu.vue +2 -2
  68. package/menu/menu.cjs.js +2 -2
  69. package/menu/menu.cjs.min.js +1 -1
  70. package/menu/menu.esm.js +2 -2
  71. package/menu/menu.esm.min.js +1 -1
  72. package/menu/menu.js +2 -2
  73. package/menu/menu.min.js +1 -1
  74. package/menubar/Menubar.vue +1 -0
  75. package/menubar/menubar.cjs.js +16 -13
  76. package/menubar/menubar.cjs.min.js +1 -1
  77. package/menubar/menubar.esm.js +16 -13
  78. package/menubar/menubar.esm.min.js +1 -1
  79. package/menubar/menubar.js +16 -13
  80. package/menubar/menubar.min.js +1 -1
  81. package/overlaypanel/OverlayPanel.vue +31 -5
  82. package/overlaypanel/overlaypanel.cjs.js +49 -17
  83. package/overlaypanel/overlaypanel.cjs.min.js +1 -1
  84. package/overlaypanel/overlaypanel.esm.js +48 -17
  85. package/overlaypanel/overlaypanel.esm.min.js +1 -1
  86. package/overlaypanel/overlaypanel.js +48 -17
  87. package/overlaypanel/overlaypanel.min.js +1 -1
  88. package/package.json +1 -1
  89. package/resources/primevue.css +4 -2
  90. package/resources/primevue.min.css +1 -1
  91. package/sidebar/Sidebar.d.ts +0 -5
  92. package/sidebar/Sidebar.vue +39 -11
  93. package/sidebar/sidebar.cjs.js +62 -23
  94. package/sidebar/sidebar.cjs.min.js +1 -1
  95. package/sidebar/sidebar.esm.js +62 -24
  96. package/sidebar/sidebar.esm.min.js +1 -1
  97. package/sidebar/sidebar.js +63 -25
  98. package/sidebar/sidebar.min.js +1 -1
  99. package/slider/Slider.vue +2 -2
  100. package/slider/slider.cjs.js +2 -2
  101. package/slider/slider.cjs.min.js +1 -1
  102. package/slider/slider.esm.js +2 -2
  103. package/slider/slider.esm.min.js +1 -1
  104. package/slider/slider.js +2 -2
  105. package/slider/slider.min.js +1 -1
  106. package/splitter/Splitter.d.ts +16 -0
  107. package/splitter/Splitter.vue +2 -1
  108. package/splitter/splitter.cjs.js +2 -1
  109. package/splitter/splitter.cjs.min.js +1 -1
  110. package/splitter/splitter.esm.js +2 -1
  111. package/splitter/splitter.esm.min.js +1 -1
  112. package/splitter/splitter.js +2 -1
  113. package/splitter/splitter.min.js +1 -1
  114. package/tieredmenu/TieredMenu.vue +1 -2
  115. package/tieredmenu/tieredmenu.cjs.js +1 -2
  116. package/tieredmenu/tieredmenu.cjs.min.js +1 -1
  117. package/tieredmenu/tieredmenu.esm.js +1 -2
  118. package/tieredmenu/tieredmenu.esm.min.js +1 -1
  119. package/tieredmenu/tieredmenu.js +1 -2
  120. package/tieredmenu/tieredmenu.min.js +1 -1
  121. package/tooltip/tooltip.cjs.js +14 -1
  122. package/tooltip/tooltip.cjs.min.js +1 -1
  123. package/tooltip/tooltip.esm.js +14 -1
  124. package/tooltip/tooltip.esm.min.js +1 -1
  125. package/tooltip/tooltip.js +14 -1
  126. package/tooltip/tooltip.min.js +1 -1
  127. package/utils/Utils.d.ts +1 -0
  128. package/utils/utils.cjs.js +6 -0
  129. package/utils/utils.cjs.min.js +1 -1
  130. package/utils/utils.esm.js +6 -0
  131. package/utils/utils.esm.min.js +1 -1
  132. package/utils/utils.js +6 -0
  133. package/utils/utils.min.js +1 -1
  134. package/vetur-attributes.json +6 -10
  135. package/vetur-tags.json +2 -3
  136. package/web-types.json +55 -23
@@ -1,9 +1,10 @@
1
+ import Button from 'primevue/button';
1
2
  import ConfirmationEventBus from 'primevue/confirmationeventbus';
2
- import { ZIndexUtils, DomHandler, ConnectedOverlayScrollHandler } from 'primevue/utils';
3
+ import FocusTrap from 'primevue/focustrap';
3
4
  import OverlayEventBus from 'primevue/overlayeventbus';
4
- import Button from 'primevue/button';
5
5
  import Portal from 'primevue/portal';
6
- import { resolveComponent, openBlock, createBlock, withCtx, createVNode, Transition, createElementBlock, mergeProps, createElementVNode, normalizeClass, toDisplayString, resolveDynamicComponent, createCommentVNode } from 'vue';
6
+ import { ZIndexUtils, DomHandler, ConnectedOverlayScrollHandler } from 'primevue/utils';
7
+ import { resolveComponent, resolveDirective, openBlock, createBlock, withCtx, createVNode, Transition, withDirectives, createElementBlock, mergeProps, createElementVNode, normalizeClass, toDisplayString, resolveDynamicComponent, createCommentVNode } from 'vue';
7
8
 
8
9
  var script = {
9
10
  name: 'ConfirmPopup',
@@ -33,6 +34,11 @@ var script = {
33
34
  if (options.group === this.group) {
34
35
  this.confirmation = options;
35
36
  this.target = options.target;
37
+
38
+ if (this.confirmation.onShow) {
39
+ this.confirmation.onShow();
40
+ }
41
+
36
42
  this.visible = true;
37
43
  }
38
44
  };
@@ -81,7 +87,29 @@ var script = {
81
87
 
82
88
  this.visible = false;
83
89
  },
90
+ onHide() {
91
+ if (this.confirmation.onHide) {
92
+ this.confirmation.onHide();
93
+ }
94
+
95
+ this.visible = false;
96
+ },
97
+ onAcceptKeydown(event) {
98
+ if (event.code === 'Space' || event.code === 'Enter') {
99
+ this.accept();
100
+ DomHandler.focus(this.target);
101
+ event.preventDefault();
102
+ }
103
+ },
104
+ onRejectKeydown(event) {
105
+ if (event.code === 'Space' || event.code === 'Enter') {
106
+ this.reject();
107
+ DomHandler.focus(this.target);
108
+ event.preventDefault();
109
+ }
110
+ },
84
111
  onEnter(el) {
112
+ this.focus();
85
113
  this.bindOutsideClickListener();
86
114
  this.bindScrollListener();
87
115
  this.bindResizeListener();
@@ -117,6 +145,10 @@ var script = {
117
145
  if (!this.outsideClickListener) {
118
146
  this.outsideClickListener = (event) => {
119
147
  if (this.visible && this.container && !this.container.contains(event.target) && !this.isTargetClicked(event)) {
148
+ if (this.confirmation.onHide) {
149
+ this.confirmation.onHide();
150
+ }
151
+
120
152
  this.visible = false;
121
153
  } else {
122
154
  this.alignOverlay();
@@ -165,6 +197,13 @@ var script = {
165
197
  this.resizeListener = null;
166
198
  }
167
199
  },
200
+ focus() {
201
+ let focusTarget = this.container.querySelector('[autofocus]');
202
+
203
+ if (focusTarget) {
204
+ focusTarget.focus();
205
+ }
206
+ },
168
207
  isTargetClicked(event) {
169
208
  return this.target && (this.target === event.target || this.target.contains(event.target));
170
209
  },
@@ -176,6 +215,12 @@ var script = {
176
215
  originalEvent: event,
177
216
  target: this.target
178
217
  });
218
+ },
219
+ onOverlayKeydown(event) {
220
+ if (event.code === 'Escape') {
221
+ ConfirmationEventBus.emit('close', this.closeListener);
222
+ DomHandler.focus(this.target);
223
+ }
179
224
  }
180
225
  },
181
226
  computed: {
@@ -211,24 +256,35 @@ var script = {
211
256
  },
212
257
  rejectClass() {
213
258
  return ['p-confirm-popup-reject p-button-sm', this.confirmation ? this.confirmation.rejectClass || 'p-button-text' : null];
259
+ },
260
+ autoFocusAccept() {
261
+ return this.confirmation.defaultFocus === undefined || this.confirmation.defaultFocus === 'accept' ? true : false;
262
+ },
263
+ autoFocusReject() {
264
+ return this.confirmation.defaultFocus === 'reject' ? true : false;
214
265
  }
215
266
  },
216
267
  components: {
217
268
  CPButton: Button,
218
269
  Portal: Portal
270
+ },
271
+ directives: {
272
+ focustrap: FocusTrap
219
273
  }
220
274
  };
221
275
 
222
- const _hoisted_1 = {
276
+ const _hoisted_1 = ["aria-modal"];
277
+ const _hoisted_2 = {
223
278
  key: 0,
224
279
  class: "p-confirm-popup-content"
225
280
  };
226
- const _hoisted_2 = { class: "p-confirm-popup-message" };
227
- const _hoisted_3 = { class: "p-confirm-popup-footer" };
281
+ const _hoisted_3 = { class: "p-confirm-popup-message" };
282
+ const _hoisted_4 = { class: "p-confirm-popup-footer" };
228
283
 
229
284
  function render(_ctx, _cache, $props, $setup, $data, $options) {
230
285
  const _component_CPButton = resolveComponent("CPButton");
231
286
  const _component_Portal = resolveComponent("Portal");
287
+ const _directive_focustrap = resolveDirective("focustrap");
232
288
 
233
289
  return (openBlock(), createBlock(_component_Portal, null, {
234
290
  default: withCtx(() => [
@@ -240,40 +296,47 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
240
296
  }, {
241
297
  default: withCtx(() => [
242
298
  ($data.visible)
243
- ? (openBlock(), createElementBlock("div", mergeProps({
299
+ ? withDirectives((openBlock(), createElementBlock("div", mergeProps({
244
300
  key: 0,
245
301
  ref: $options.containerRef,
246
- class: $options.containerClass
247
- }, _ctx.$attrs, {
248
- onClick: _cache[2] || (_cache[2] = (...args) => ($options.onOverlayClick && $options.onOverlayClick(...args)))
249
- }), [
302
+ role: "alertdialog",
303
+ class: $options.containerClass,
304
+ "aria-modal": $data.visible,
305
+ onClick: _cache[2] || (_cache[2] = (...args) => ($options.onOverlayClick && $options.onOverlayClick(...args))),
306
+ onKeydown: _cache[3] || (_cache[3] = (...args) => ($options.onOverlayKeydown && $options.onOverlayKeydown(...args)))
307
+ }, _ctx.$attrs), [
250
308
  (!_ctx.$slots.message)
251
- ? (openBlock(), createElementBlock("div", _hoisted_1, [
309
+ ? (openBlock(), createElementBlock("div", _hoisted_2, [
252
310
  createElementVNode("i", {
253
311
  class: normalizeClass($options.iconClass)
254
312
  }, null, 2),
255
- createElementVNode("span", _hoisted_2, toDisplayString($data.confirmation.message), 1)
313
+ createElementVNode("span", _hoisted_3, toDisplayString($data.confirmation.message), 1)
256
314
  ]))
257
315
  : (openBlock(), createBlock(resolveDynamicComponent(_ctx.$slots.message), {
258
316
  key: 1,
259
317
  message: $data.confirmation
260
318
  }, null, 8, ["message"])),
261
- createElementVNode("div", _hoisted_3, [
319
+ createElementVNode("div", _hoisted_4, [
262
320
  createVNode(_component_CPButton, {
263
321
  label: $options.rejectLabel,
264
322
  icon: $options.rejectIcon,
265
323
  class: normalizeClass($options.rejectClass),
266
- onClick: _cache[0] || (_cache[0] = $event => ($options.reject()))
267
- }, null, 8, ["label", "icon", "class"]),
324
+ onClick: _cache[0] || (_cache[0] = $event => ($options.reject())),
325
+ onKeydown: $options.onRejectKeydown,
326
+ autofocus: $options.autoFocusReject
327
+ }, null, 8, ["label", "icon", "class", "onKeydown", "autofocus"]),
268
328
  createVNode(_component_CPButton, {
269
329
  label: $options.acceptLabel,
270
330
  icon: $options.acceptIcon,
271
331
  class: normalizeClass($options.acceptClass),
272
332
  onClick: _cache[1] || (_cache[1] = $event => ($options.accept())),
273
- autofocus: ""
274
- }, null, 8, ["label", "icon", "class"])
333
+ onKeydown: $options.onAcceptKeydown,
334
+ autofocus: $options.autoFocusAccept
335
+ }, null, 8, ["label", "icon", "class", "onKeydown", "autofocus"])
275
336
  ])
276
- ], 16))
337
+ ], 16, _hoisted_1)), [
338
+ [_directive_focustrap]
339
+ ])
277
340
  : createCommentVNode("", true)
278
341
  ]),
279
342
  _: 1
@@ -1 +1 @@
1
- import e from"primevue/confirmationeventbus";import{ZIndexUtils as i,DomHandler as t,ConnectedOverlayScrollHandler as n}from"primevue/utils";import r from"primevue/overlayeventbus";import o from"primevue/button";import s from"primevue/portal";import{resolveComponent as c,openBlock as l,createBlock as a,withCtx as p,createVNode as u,Transition as f,createElementBlock as m,mergeProps as h,createElementVNode as d,normalizeClass as b,toDisplayString as v,resolveDynamicComponent as L,createCommentVNode as g}from"vue";var C={name:"ConfirmPopup",inheritAttrs:!1,props:{group:String},data:()=>({visible:!1,confirmation:null}),target:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,container:null,confirmListener:null,closeListener:null,mounted(){this.confirmListener=e=>{e&&e.group===this.group&&(this.confirmation=e,this.target=e.target,this.visible=!0)},this.closeListener=()=>{this.visible=!1,this.confirmation=null},e.on("confirm",this.confirmListener),e.on("close",this.closeListener)},beforeUnmount(){e.off("confirm",this.confirmListener),e.off("close",this.closeListener),this.unbindOutsideClickListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.unbindResizeListener(),this.container&&(i.clear(this.container),this.container=null),this.target=null,this.confirmation=null},methods:{accept(){this.confirmation.accept&&this.confirmation.accept(),this.visible=!1},reject(){this.confirmation.reject&&this.confirmation.reject(),this.visible=!1},onEnter(e){this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),i.set("overlay",e,this.$primevue.config.zIndex.overlay)},onLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener()},onAfterLeave(e){i.clear(e)},alignOverlay(){t.absolutePosition(this.container,this.target);const e=t.getOffset(this.container),i=t.getOffset(this.target);let n=0;e.left<i.left&&(n=i.left-e.left),this.container.style.setProperty("--overlayArrowLeft",`${n}px`),e.top<i.top&&t.addClass(this.container,"p-confirm-popup-flipped")},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.visible&&this.container&&!this.container.contains(e.target)&&!this.isTargetClicked(e)?this.visible=!1:this.alignOverlay()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new n(this.target,(()=>{this.visible&&(this.visible=!1)}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.visible&&!t.isTouchDevice()&&(this.visible=!1)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},isTargetClicked(e){return this.target&&(this.target===e.target||this.target.contains(e.target))},containerRef(e){this.container=e},onOverlayClick(e){r.emit("overlay-click",{originalEvent:e,target:this.target})}},computed:{containerClass(){return["p-confirm-popup p-component",{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},message(){return this.confirmation?this.confirmation.message:null},iconClass(){return["p-confirm-popup-icon",this.confirmation?this.confirmation.icon:null]},acceptLabel(){return this.confirmation?this.confirmation.acceptLabel||this.$primevue.config.locale.accept:null},rejectLabel(){return this.confirmation?this.confirmation.rejectLabel||this.$primevue.config.locale.reject:null},acceptIcon(){return this.confirmation?this.confirmation.acceptIcon:null},rejectIcon(){return this.confirmation?this.confirmation.rejectIcon:null},acceptClass(){return["p-confirm-popup-accept p-button-sm",this.confirmation?this.confirmation.acceptClass:null]},rejectClass(){return["p-confirm-popup-reject p-button-sm",this.confirmation?this.confirmation.rejectClass||"p-button-text":null]}},components:{CPButton:o,Portal:s}};const y={key:0,class:"p-confirm-popup-content"},k={class:"p-confirm-popup-message"},z={class:"p-confirm-popup-footer"};!function(e,i){void 0===i&&(i={});var t=i.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}("\n.p-confirm-popup {\n position: absolute;\n margin-top: 10px;\n top: 0;\n left: 0;\n}\n.p-confirm-popup-flipped {\n margin-top: 0;\n margin-bottom: 10px;\n}\n\n/* Animation */\n.p-confirm-popup-enter-from {\n opacity: 0;\n -webkit-transform: scaleY(0.8);\n transform: scaleY(0.8);\n}\n.p-confirm-popup-leave-to {\n opacity: 0;\n}\n.p-confirm-popup-enter-active {\n -webkit-transition: opacity 0.12s cubic-bezier(0, 0, 0.2, 1), -webkit-transform 0.12s cubic-bezier(0, 0, 0.2, 1);\n transition: opacity 0.12s cubic-bezier(0, 0, 0.2, 1), -webkit-transform 0.12s cubic-bezier(0, 0, 0.2, 1);\n transition: transform 0.12s cubic-bezier(0, 0, 0.2, 1), opacity 0.12s cubic-bezier(0, 0, 0.2, 1);\n transition: transform 0.12s cubic-bezier(0, 0, 0.2, 1), opacity 0.12s cubic-bezier(0, 0, 0.2, 1), -webkit-transform 0.12s cubic-bezier(0, 0, 0.2, 1);\n}\n.p-confirm-popup-leave-active {\n -webkit-transition: opacity 0.1s linear;\n transition: opacity 0.1s linear;\n}\n.p-confirm-popup:after,\n.p-confirm-popup:before {\n bottom: 100%;\n left: calc(var(--overlayArrowLeft, 0) + 1.25rem);\n content: ' ';\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n}\n.p-confirm-popup:after {\n border-width: 8px;\n margin-left: -8px;\n}\n.p-confirm-popup:before {\n border-width: 10px;\n margin-left: -10px;\n}\n.p-confirm-popup-flipped:after,\n.p-confirm-popup-flipped:before {\n bottom: auto;\n top: 100%;\n}\n.p-confirm-popup.p-confirm-popup-flipped:after {\n border-bottom-color: transparent;\n}\n.p-confirm-popup.p-confirm-popup-flipped:before {\n border-bottom-color: transparent;\n}\n.p-confirm-popup .p-confirm-popup-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n"),C.render=function(e,i,t,n,r,o){const s=c("CPButton"),C=c("Portal");return l(),a(C,null,{default:p((()=>[u(f,{name:"p-confirm-popup",onEnter:o.onEnter,onLeave:o.onLeave,onAfterLeave:o.onAfterLeave},{default:p((()=>[r.visible?(l(),m("div",h({key:0,ref:o.containerRef,class:o.containerClass},e.$attrs,{onClick:i[2]||(i[2]=(...e)=>o.onOverlayClick&&o.onOverlayClick(...e))}),[e.$slots.message?(l(),a(L(e.$slots.message),{key:1,message:r.confirmation},null,8,["message"])):(l(),m("div",y,[d("i",{class:b(o.iconClass)},null,2),d("span",k,v(r.confirmation.message),1)])),d("div",z,[u(s,{label:o.rejectLabel,icon:o.rejectIcon,class:b(o.rejectClass),onClick:i[0]||(i[0]=e=>o.reject())},null,8,["label","icon","class"]),u(s,{label:o.acceptLabel,icon:o.acceptIcon,class:b(o.acceptClass),onClick:i[1]||(i[1]=e=>o.accept()),autofocus:""},null,8,["label","icon","class"])])],16)):g("",!0)])),_:1},8,["onEnter","onLeave","onAfterLeave"])])),_:1})};export{C as default};
1
+ import e from"primevue/button";import t from"primevue/confirmationeventbus";import i from"primevue/focustrap";import n from"primevue/overlayeventbus";import o from"primevue/portal";import{ZIndexUtils as r,DomHandler as s,ConnectedOverlayScrollHandler as c}from"primevue/utils";import{resolveComponent as a,resolveDirective as l,openBlock as p,createBlock as u,withCtx as f,createVNode as m,Transition as h,withDirectives as d,createElementBlock as b,mergeProps as v,createElementVNode as L,normalizeClass as g,toDisplayString as y,resolveDynamicComponent as C,createCommentVNode as k}from"vue";var w={name:"ConfirmPopup",inheritAttrs:!1,props:{group:String},data:()=>({visible:!1,confirmation:null}),target:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,container:null,confirmListener:null,closeListener:null,mounted(){this.confirmListener=e=>{e&&e.group===this.group&&(this.confirmation=e,this.target=e.target,this.confirmation.onShow&&this.confirmation.onShow(),this.visible=!0)},this.closeListener=()=>{this.visible=!1,this.confirmation=null},t.on("confirm",this.confirmListener),t.on("close",this.closeListener)},beforeUnmount(){t.off("confirm",this.confirmListener),t.off("close",this.closeListener),this.unbindOutsideClickListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.unbindResizeListener(),this.container&&(r.clear(this.container),this.container=null),this.target=null,this.confirmation=null},methods:{accept(){this.confirmation.accept&&this.confirmation.accept(),this.visible=!1},reject(){this.confirmation.reject&&this.confirmation.reject(),this.visible=!1},onHide(){this.confirmation.onHide&&this.confirmation.onHide(),this.visible=!1},onAcceptKeydown(e){"Space"!==e.code&&"Enter"!==e.code||(this.accept(),s.focus(this.target),e.preventDefault())},onRejectKeydown(e){"Space"!==e.code&&"Enter"!==e.code||(this.reject(),s.focus(this.target),e.preventDefault())},onEnter(e){this.focus(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),r.set("overlay",e,this.$primevue.config.zIndex.overlay)},onLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener()},onAfterLeave(e){r.clear(e)},alignOverlay(){s.absolutePosition(this.container,this.target);const e=s.getOffset(this.container),t=s.getOffset(this.target);let i=0;e.left<t.left&&(i=t.left-e.left),this.container.style.setProperty("--overlayArrowLeft",`${i}px`),e.top<t.top&&s.addClass(this.container,"p-confirm-popup-flipped")},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.visible&&this.container&&!this.container.contains(e.target)&&!this.isTargetClicked(e)?(this.confirmation.onHide&&this.confirmation.onHide(),this.visible=!1):this.alignOverlay()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new c(this.target,(()=>{this.visible&&(this.visible=!1)}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.visible&&!s.isTouchDevice()&&(this.visible=!1)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},focus(){let e=this.container.querySelector("[autofocus]");e&&e.focus()},isTargetClicked(e){return this.target&&(this.target===e.target||this.target.contains(e.target))},containerRef(e){this.container=e},onOverlayClick(e){n.emit("overlay-click",{originalEvent:e,target:this.target})},onOverlayKeydown(e){"Escape"===e.code&&(t.emit("close",this.closeListener),s.focus(this.target))}},computed:{containerClass(){return["p-confirm-popup p-component",{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},message(){return this.confirmation?this.confirmation.message:null},iconClass(){return["p-confirm-popup-icon",this.confirmation?this.confirmation.icon:null]},acceptLabel(){return this.confirmation?this.confirmation.acceptLabel||this.$primevue.config.locale.accept:null},rejectLabel(){return this.confirmation?this.confirmation.rejectLabel||this.$primevue.config.locale.reject:null},acceptIcon(){return this.confirmation?this.confirmation.acceptIcon:null},rejectIcon(){return this.confirmation?this.confirmation.rejectIcon:null},acceptClass(){return["p-confirm-popup-accept p-button-sm",this.confirmation?this.confirmation.acceptClass:null]},rejectClass(){return["p-confirm-popup-reject p-button-sm",this.confirmation?this.confirmation.rejectClass||"p-button-text":null]},autoFocusAccept(){return void 0===this.confirmation.defaultFocus||"accept"===this.confirmation.defaultFocus},autoFocusReject(){return"reject"===this.confirmation.defaultFocus}},components:{CPButton:e,Portal:o},directives:{focustrap:i}};const z=["aria-modal"],j={key:0,class:"p-confirm-popup-content"},x={class:"p-confirm-popup-message"},O={class:"p-confirm-popup-footer"};!function(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-confirm-popup {\n position: absolute;\n margin-top: 10px;\n top: 0;\n left: 0;\n}\n.p-confirm-popup-flipped {\n margin-top: 0;\n margin-bottom: 10px;\n}\n\n/* Animation */\n.p-confirm-popup-enter-from {\n opacity: 0;\n -webkit-transform: scaleY(0.8);\n transform: scaleY(0.8);\n}\n.p-confirm-popup-leave-to {\n opacity: 0;\n}\n.p-confirm-popup-enter-active {\n -webkit-transition: opacity 0.12s cubic-bezier(0, 0, 0.2, 1), -webkit-transform 0.12s cubic-bezier(0, 0, 0.2, 1);\n transition: opacity 0.12s cubic-bezier(0, 0, 0.2, 1), -webkit-transform 0.12s cubic-bezier(0, 0, 0.2, 1);\n transition: transform 0.12s cubic-bezier(0, 0, 0.2, 1), opacity 0.12s cubic-bezier(0, 0, 0.2, 1);\n transition: transform 0.12s cubic-bezier(0, 0, 0.2, 1), opacity 0.12s cubic-bezier(0, 0, 0.2, 1), -webkit-transform 0.12s cubic-bezier(0, 0, 0.2, 1);\n}\n.p-confirm-popup-leave-active {\n -webkit-transition: opacity 0.1s linear;\n transition: opacity 0.1s linear;\n}\n.p-confirm-popup:after,\n.p-confirm-popup:before {\n bottom: 100%;\n left: calc(var(--overlayArrowLeft, 0) + 1.25rem);\n content: ' ';\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n}\n.p-confirm-popup:after {\n border-width: 8px;\n margin-left: -8px;\n}\n.p-confirm-popup:before {\n border-width: 10px;\n margin-left: -10px;\n}\n.p-confirm-popup-flipped:after,\n.p-confirm-popup-flipped:before {\n bottom: auto;\n top: 100%;\n}\n.p-confirm-popup.p-confirm-popup-flipped:after {\n border-bottom-color: transparent;\n}\n.p-confirm-popup.p-confirm-popup-flipped:before {\n border-bottom-color: transparent;\n}\n.p-confirm-popup .p-confirm-popup-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n"),w.render=function(e,t,i,n,o,r){const s=a("CPButton"),c=a("Portal"),w=l("focustrap");return p(),u(c,null,{default:f((()=>[m(h,{name:"p-confirm-popup",onEnter:r.onEnter,onLeave:r.onLeave,onAfterLeave:r.onAfterLeave},{default:f((()=>[o.visible?d((p(),b("div",v({key:0,ref:r.containerRef,role:"alertdialog",class:r.containerClass,"aria-modal":o.visible,onClick:t[2]||(t[2]=(...e)=>r.onOverlayClick&&r.onOverlayClick(...e)),onKeydown:t[3]||(t[3]=(...e)=>r.onOverlayKeydown&&r.onOverlayKeydown(...e))},e.$attrs),[e.$slots.message?(p(),u(C(e.$slots.message),{key:1,message:o.confirmation},null,8,["message"])):(p(),b("div",j,[L("i",{class:g(r.iconClass)},null,2),L("span",x,y(o.confirmation.message),1)])),L("div",O,[m(s,{label:r.rejectLabel,icon:r.rejectIcon,class:g(r.rejectClass),onClick:t[0]||(t[0]=e=>r.reject()),onKeydown:r.onRejectKeydown,autofocus:r.autoFocusReject},null,8,["label","icon","class","onKeydown","autofocus"]),m(s,{label:r.acceptLabel,icon:r.acceptIcon,class:g(r.acceptClass),onClick:t[1]||(t[1]=e=>r.accept()),onKeydown:r.onAcceptKeydown,autofocus:r.autoFocusAccept},null,8,["label","icon","class","onKeydown","autofocus"])])],16,z)),[[w]]):k("",!0)])),_:1},8,["onEnter","onLeave","onAfterLeave"])])),_:1})};export{w as default};
@@ -1,12 +1,13 @@
1
1
  this.primevue = this.primevue || {};
2
- this.primevue.confirmpopup = (function (ConfirmationEventBus, utils, OverlayEventBus, Button, Portal, vue) {
2
+ this.primevue.confirmpopup = (function (Button, ConfirmationEventBus, FocusTrap, OverlayEventBus, Portal, utils, vue) {
3
3
  'use strict';
4
4
 
5
5
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
6
6
 
7
+ var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
7
8
  var ConfirmationEventBus__default = /*#__PURE__*/_interopDefaultLegacy(ConfirmationEventBus);
9
+ var FocusTrap__default = /*#__PURE__*/_interopDefaultLegacy(FocusTrap);
8
10
  var OverlayEventBus__default = /*#__PURE__*/_interopDefaultLegacy(OverlayEventBus);
9
- var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
10
11
  var Portal__default = /*#__PURE__*/_interopDefaultLegacy(Portal);
11
12
 
12
13
  var script = {
@@ -37,6 +38,11 @@ this.primevue.confirmpopup = (function (ConfirmationEventBus, utils, OverlayEven
37
38
  if (options.group === this.group) {
38
39
  this.confirmation = options;
39
40
  this.target = options.target;
41
+
42
+ if (this.confirmation.onShow) {
43
+ this.confirmation.onShow();
44
+ }
45
+
40
46
  this.visible = true;
41
47
  }
42
48
  };
@@ -85,7 +91,29 @@ this.primevue.confirmpopup = (function (ConfirmationEventBus, utils, OverlayEven
85
91
 
86
92
  this.visible = false;
87
93
  },
94
+ onHide() {
95
+ if (this.confirmation.onHide) {
96
+ this.confirmation.onHide();
97
+ }
98
+
99
+ this.visible = false;
100
+ },
101
+ onAcceptKeydown(event) {
102
+ if (event.code === 'Space' || event.code === 'Enter') {
103
+ this.accept();
104
+ utils.DomHandler.focus(this.target);
105
+ event.preventDefault();
106
+ }
107
+ },
108
+ onRejectKeydown(event) {
109
+ if (event.code === 'Space' || event.code === 'Enter') {
110
+ this.reject();
111
+ utils.DomHandler.focus(this.target);
112
+ event.preventDefault();
113
+ }
114
+ },
88
115
  onEnter(el) {
116
+ this.focus();
89
117
  this.bindOutsideClickListener();
90
118
  this.bindScrollListener();
91
119
  this.bindResizeListener();
@@ -121,6 +149,10 @@ this.primevue.confirmpopup = (function (ConfirmationEventBus, utils, OverlayEven
121
149
  if (!this.outsideClickListener) {
122
150
  this.outsideClickListener = (event) => {
123
151
  if (this.visible && this.container && !this.container.contains(event.target) && !this.isTargetClicked(event)) {
152
+ if (this.confirmation.onHide) {
153
+ this.confirmation.onHide();
154
+ }
155
+
124
156
  this.visible = false;
125
157
  } else {
126
158
  this.alignOverlay();
@@ -169,6 +201,13 @@ this.primevue.confirmpopup = (function (ConfirmationEventBus, utils, OverlayEven
169
201
  this.resizeListener = null;
170
202
  }
171
203
  },
204
+ focus() {
205
+ let focusTarget = this.container.querySelector('[autofocus]');
206
+
207
+ if (focusTarget) {
208
+ focusTarget.focus();
209
+ }
210
+ },
172
211
  isTargetClicked(event) {
173
212
  return this.target && (this.target === event.target || this.target.contains(event.target));
174
213
  },
@@ -180,6 +219,12 @@ this.primevue.confirmpopup = (function (ConfirmationEventBus, utils, OverlayEven
180
219
  originalEvent: event,
181
220
  target: this.target
182
221
  });
222
+ },
223
+ onOverlayKeydown(event) {
224
+ if (event.code === 'Escape') {
225
+ ConfirmationEventBus__default["default"].emit('close', this.closeListener);
226
+ utils.DomHandler.focus(this.target);
227
+ }
183
228
  }
184
229
  },
185
230
  computed: {
@@ -215,24 +260,35 @@ this.primevue.confirmpopup = (function (ConfirmationEventBus, utils, OverlayEven
215
260
  },
216
261
  rejectClass() {
217
262
  return ['p-confirm-popup-reject p-button-sm', this.confirmation ? this.confirmation.rejectClass || 'p-button-text' : null];
263
+ },
264
+ autoFocusAccept() {
265
+ return this.confirmation.defaultFocus === undefined || this.confirmation.defaultFocus === 'accept' ? true : false;
266
+ },
267
+ autoFocusReject() {
268
+ return this.confirmation.defaultFocus === 'reject' ? true : false;
218
269
  }
219
270
  },
220
271
  components: {
221
272
  CPButton: Button__default["default"],
222
273
  Portal: Portal__default["default"]
274
+ },
275
+ directives: {
276
+ focustrap: FocusTrap__default["default"]
223
277
  }
224
278
  };
225
279
 
226
- const _hoisted_1 = {
280
+ const _hoisted_1 = ["aria-modal"];
281
+ const _hoisted_2 = {
227
282
  key: 0,
228
283
  class: "p-confirm-popup-content"
229
284
  };
230
- const _hoisted_2 = { class: "p-confirm-popup-message" };
231
- const _hoisted_3 = { class: "p-confirm-popup-footer" };
285
+ const _hoisted_3 = { class: "p-confirm-popup-message" };
286
+ const _hoisted_4 = { class: "p-confirm-popup-footer" };
232
287
 
233
288
  function render(_ctx, _cache, $props, $setup, $data, $options) {
234
289
  const _component_CPButton = vue.resolveComponent("CPButton");
235
290
  const _component_Portal = vue.resolveComponent("Portal");
291
+ const _directive_focustrap = vue.resolveDirective("focustrap");
236
292
 
237
293
  return (vue.openBlock(), vue.createBlock(_component_Portal, null, {
238
294
  default: vue.withCtx(() => [
@@ -244,40 +300,47 @@ this.primevue.confirmpopup = (function (ConfirmationEventBus, utils, OverlayEven
244
300
  }, {
245
301
  default: vue.withCtx(() => [
246
302
  ($data.visible)
247
- ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
303
+ ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
248
304
  key: 0,
249
305
  ref: $options.containerRef,
250
- class: $options.containerClass
251
- }, _ctx.$attrs, {
252
- onClick: _cache[2] || (_cache[2] = (...args) => ($options.onOverlayClick && $options.onOverlayClick(...args)))
253
- }), [
306
+ role: "alertdialog",
307
+ class: $options.containerClass,
308
+ "aria-modal": $data.visible,
309
+ onClick: _cache[2] || (_cache[2] = (...args) => ($options.onOverlayClick && $options.onOverlayClick(...args))),
310
+ onKeydown: _cache[3] || (_cache[3] = (...args) => ($options.onOverlayKeydown && $options.onOverlayKeydown(...args)))
311
+ }, _ctx.$attrs), [
254
312
  (!_ctx.$slots.message)
255
- ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
313
+ ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
256
314
  vue.createElementVNode("i", {
257
315
  class: vue.normalizeClass($options.iconClass)
258
316
  }, null, 2),
259
- vue.createElementVNode("span", _hoisted_2, vue.toDisplayString($data.confirmation.message), 1)
317
+ vue.createElementVNode("span", _hoisted_3, vue.toDisplayString($data.confirmation.message), 1)
260
318
  ]))
261
319
  : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.$slots.message), {
262
320
  key: 1,
263
321
  message: $data.confirmation
264
322
  }, null, 8, ["message"])),
265
- vue.createElementVNode("div", _hoisted_3, [
323
+ vue.createElementVNode("div", _hoisted_4, [
266
324
  vue.createVNode(_component_CPButton, {
267
325
  label: $options.rejectLabel,
268
326
  icon: $options.rejectIcon,
269
327
  class: vue.normalizeClass($options.rejectClass),
270
- onClick: _cache[0] || (_cache[0] = $event => ($options.reject()))
271
- }, null, 8, ["label", "icon", "class"]),
328
+ onClick: _cache[0] || (_cache[0] = $event => ($options.reject())),
329
+ onKeydown: $options.onRejectKeydown,
330
+ autofocus: $options.autoFocusReject
331
+ }, null, 8, ["label", "icon", "class", "onKeydown", "autofocus"]),
272
332
  vue.createVNode(_component_CPButton, {
273
333
  label: $options.acceptLabel,
274
334
  icon: $options.acceptIcon,
275
335
  class: vue.normalizeClass($options.acceptClass),
276
336
  onClick: _cache[1] || (_cache[1] = $event => ($options.accept())),
277
- autofocus: ""
278
- }, null, 8, ["label", "icon", "class"])
337
+ onKeydown: $options.onAcceptKeydown,
338
+ autofocus: $options.autoFocusAccept
339
+ }, null, 8, ["label", "icon", "class", "onKeydown", "autofocus"])
279
340
  ])
280
- ], 16))
341
+ ], 16, _hoisted_1)), [
342
+ [_directive_focustrap]
343
+ ])
281
344
  : vue.createCommentVNode("", true)
282
345
  ]),
283
346
  _: 1
@@ -321,4 +384,4 @@ this.primevue.confirmpopup = (function (ConfirmationEventBus, utils, OverlayEven
321
384
 
322
385
  return script;
323
386
 
324
- })(primevue.confirmationeventbus, primevue.utils, primevue.overlayeventbus, primevue.button, primevue.portal, Vue);
387
+ })(primevue.button, primevue.confirmationeventbus, primevue.focustrap, primevue.overlayeventbus, primevue.portal, primevue.utils, Vue);
@@ -1 +1 @@
1
- this.primevue=this.primevue||{},this.primevue.confirmpopup=function(e,t,n,i,o,r){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=s(e),c=s(n),a=s(i),p=s(o),u={name:"ConfirmPopup",inheritAttrs:!1,props:{group:String},data:()=>({visible:!1,confirmation:null}),target:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,container:null,confirmListener:null,closeListener:null,mounted(){this.confirmListener=e=>{e&&e.group===this.group&&(this.confirmation=e,this.target=e.target,this.visible=!0)},this.closeListener=()=>{this.visible=!1,this.confirmation=null},l.default.on("confirm",this.confirmListener),l.default.on("close",this.closeListener)},beforeUnmount(){l.default.off("confirm",this.confirmListener),l.default.off("close",this.closeListener),this.unbindOutsideClickListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.unbindResizeListener(),this.container&&(t.ZIndexUtils.clear(this.container),this.container=null),this.target=null,this.confirmation=null},methods:{accept(){this.confirmation.accept&&this.confirmation.accept(),this.visible=!1},reject(){this.confirmation.reject&&this.confirmation.reject(),this.visible=!1},onEnter(e){this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),t.ZIndexUtils.set("overlay",e,this.$primevue.config.zIndex.overlay)},onLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener()},onAfterLeave(e){t.ZIndexUtils.clear(e)},alignOverlay(){t.DomHandler.absolutePosition(this.container,this.target);const e=t.DomHandler.getOffset(this.container),n=t.DomHandler.getOffset(this.target);let i=0;e.left<n.left&&(i=n.left-e.left),this.container.style.setProperty("--overlayArrowLeft",`${i}px`),e.top<n.top&&t.DomHandler.addClass(this.container,"p-confirm-popup-flipped")},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.visible&&this.container&&!this.container.contains(e.target)&&!this.isTargetClicked(e)?this.visible=!1:this.alignOverlay()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new t.ConnectedOverlayScrollHandler(this.target,(()=>{this.visible&&(this.visible=!1)}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.visible&&!t.DomHandler.isTouchDevice()&&(this.visible=!1)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},isTargetClicked(e){return this.target&&(this.target===e.target||this.target.contains(e.target))},containerRef(e){this.container=e},onOverlayClick(e){c.default.emit("overlay-click",{originalEvent:e,target:this.target})}},computed:{containerClass(){return["p-confirm-popup p-component",{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},message(){return this.confirmation?this.confirmation.message:null},iconClass(){return["p-confirm-popup-icon",this.confirmation?this.confirmation.icon:null]},acceptLabel(){return this.confirmation?this.confirmation.acceptLabel||this.$primevue.config.locale.accept:null},rejectLabel(){return this.confirmation?this.confirmation.rejectLabel||this.$primevue.config.locale.reject:null},acceptIcon(){return this.confirmation?this.confirmation.acceptIcon:null},rejectIcon(){return this.confirmation?this.confirmation.rejectIcon:null},acceptClass(){return["p-confirm-popup-accept p-button-sm",this.confirmation?this.confirmation.acceptClass:null]},rejectClass(){return["p-confirm-popup-reject p-button-sm",this.confirmation?this.confirmation.rejectClass||"p-button-text":null]}},components:{CPButton:a.default,Portal:p.default}};const m={key:0,class:"p-confirm-popup-content"},f={class:"p-confirm-popup-message"},d={class:"p-confirm-popup-footer"};return function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-confirm-popup {\n position: absolute;\n margin-top: 10px;\n top: 0;\n left: 0;\n}\n.p-confirm-popup-flipped {\n margin-top: 0;\n margin-bottom: 10px;\n}\n\n/* Animation */\n.p-confirm-popup-enter-from {\n opacity: 0;\n -webkit-transform: scaleY(0.8);\n transform: scaleY(0.8);\n}\n.p-confirm-popup-leave-to {\n opacity: 0;\n}\n.p-confirm-popup-enter-active {\n -webkit-transition: opacity 0.12s cubic-bezier(0, 0, 0.2, 1), -webkit-transform 0.12s cubic-bezier(0, 0, 0.2, 1);\n transition: opacity 0.12s cubic-bezier(0, 0, 0.2, 1), -webkit-transform 0.12s cubic-bezier(0, 0, 0.2, 1);\n transition: transform 0.12s cubic-bezier(0, 0, 0.2, 1), opacity 0.12s cubic-bezier(0, 0, 0.2, 1);\n transition: transform 0.12s cubic-bezier(0, 0, 0.2, 1), opacity 0.12s cubic-bezier(0, 0, 0.2, 1), -webkit-transform 0.12s cubic-bezier(0, 0, 0.2, 1);\n}\n.p-confirm-popup-leave-active {\n -webkit-transition: opacity 0.1s linear;\n transition: opacity 0.1s linear;\n}\n.p-confirm-popup:after,\n.p-confirm-popup:before {\n bottom: 100%;\n left: calc(var(--overlayArrowLeft, 0) + 1.25rem);\n content: ' ';\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n}\n.p-confirm-popup:after {\n border-width: 8px;\n margin-left: -8px;\n}\n.p-confirm-popup:before {\n border-width: 10px;\n margin-left: -10px;\n}\n.p-confirm-popup-flipped:after,\n.p-confirm-popup-flipped:before {\n bottom: auto;\n top: 100%;\n}\n.p-confirm-popup.p-confirm-popup-flipped:after {\n border-bottom-color: transparent;\n}\n.p-confirm-popup.p-confirm-popup-flipped:before {\n border-bottom-color: transparent;\n}\n.p-confirm-popup .p-confirm-popup-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n"),u.render=function(e,t,n,i,o,s){const l=r.resolveComponent("CPButton"),c=r.resolveComponent("Portal");return r.openBlock(),r.createBlock(c,null,{default:r.withCtx((()=>[r.createVNode(r.Transition,{name:"p-confirm-popup",onEnter:s.onEnter,onLeave:s.onLeave,onAfterLeave:s.onAfterLeave},{default:r.withCtx((()=>[o.visible?(r.openBlock(),r.createElementBlock("div",r.mergeProps({key:0,ref:s.containerRef,class:s.containerClass},e.$attrs,{onClick:t[2]||(t[2]=(...e)=>s.onOverlayClick&&s.onOverlayClick(...e))}),[e.$slots.message?(r.openBlock(),r.createBlock(r.resolveDynamicComponent(e.$slots.message),{key:1,message:o.confirmation},null,8,["message"])):(r.openBlock(),r.createElementBlock("div",m,[r.createElementVNode("i",{class:r.normalizeClass(s.iconClass)},null,2),r.createElementVNode("span",f,r.toDisplayString(o.confirmation.message),1)])),r.createElementVNode("div",d,[r.createVNode(l,{label:s.rejectLabel,icon:s.rejectIcon,class:r.normalizeClass(s.rejectClass),onClick:t[0]||(t[0]=e=>s.reject())},null,8,["label","icon","class"]),r.createVNode(l,{label:s.acceptLabel,icon:s.acceptIcon,class:r.normalizeClass(s.acceptClass),onClick:t[1]||(t[1]=e=>s.accept()),autofocus:""},null,8,["label","icon","class"])])],16)):r.createCommentVNode("",!0)])),_:1},8,["onEnter","onLeave","onAfterLeave"])])),_:1})},u}(primevue.confirmationeventbus,primevue.utils,primevue.overlayeventbus,primevue.button,primevue.portal,Vue);
1
+ this.primevue=this.primevue||{},this.primevue.confirmpopup=function(e,t,n,i,o,r,s){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=c(e),a=c(t),p=c(n),u=c(i),f=c(o),m={name:"ConfirmPopup",inheritAttrs:!1,props:{group:String},data:()=>({visible:!1,confirmation:null}),target:null,outsideClickListener:null,scrollHandler:null,resizeListener:null,container:null,confirmListener:null,closeListener:null,mounted(){this.confirmListener=e=>{e&&e.group===this.group&&(this.confirmation=e,this.target=e.target,this.confirmation.onShow&&this.confirmation.onShow(),this.visible=!0)},this.closeListener=()=>{this.visible=!1,this.confirmation=null},a.default.on("confirm",this.confirmListener),a.default.on("close",this.closeListener)},beforeUnmount(){a.default.off("confirm",this.confirmListener),a.default.off("close",this.closeListener),this.unbindOutsideClickListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.unbindResizeListener(),this.container&&(r.ZIndexUtils.clear(this.container),this.container=null),this.target=null,this.confirmation=null},methods:{accept(){this.confirmation.accept&&this.confirmation.accept(),this.visible=!1},reject(){this.confirmation.reject&&this.confirmation.reject(),this.visible=!1},onHide(){this.confirmation.onHide&&this.confirmation.onHide(),this.visible=!1},onAcceptKeydown(e){"Space"!==e.code&&"Enter"!==e.code||(this.accept(),r.DomHandler.focus(this.target),e.preventDefault())},onRejectKeydown(e){"Space"!==e.code&&"Enter"!==e.code||(this.reject(),r.DomHandler.focus(this.target),e.preventDefault())},onEnter(e){this.focus(),this.bindOutsideClickListener(),this.bindScrollListener(),this.bindResizeListener(),r.ZIndexUtils.set("overlay",e,this.$primevue.config.zIndex.overlay)},onLeave(){this.unbindOutsideClickListener(),this.unbindScrollListener(),this.unbindResizeListener()},onAfterLeave(e){r.ZIndexUtils.clear(e)},alignOverlay(){r.DomHandler.absolutePosition(this.container,this.target);const e=r.DomHandler.getOffset(this.container),t=r.DomHandler.getOffset(this.target);let n=0;e.left<t.left&&(n=t.left-e.left),this.container.style.setProperty("--overlayArrowLeft",`${n}px`),e.top<t.top&&r.DomHandler.addClass(this.container,"p-confirm-popup-flipped")},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.visible&&this.container&&!this.container.contains(e.target)&&!this.isTargetClicked(e)?(this.confirmation.onHide&&this.confirmation.onHide(),this.visible=!1):this.alignOverlay()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},bindScrollListener(){this.scrollHandler||(this.scrollHandler=new r.ConnectedOverlayScrollHandler(this.target,(()=>{this.visible&&(this.visible=!1)}))),this.scrollHandler.bindScrollListener()},unbindScrollListener(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()},bindResizeListener(){this.resizeListener||(this.resizeListener=()=>{this.visible&&!r.DomHandler.isTouchDevice()&&(this.visible=!1)},window.addEventListener("resize",this.resizeListener))},unbindResizeListener(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)},focus(){let e=this.container.querySelector("[autofocus]");e&&e.focus()},isTargetClicked(e){return this.target&&(this.target===e.target||this.target.contains(e.target))},containerRef(e){this.container=e},onOverlayClick(e){u.default.emit("overlay-click",{originalEvent:e,target:this.target})},onOverlayKeydown(e){"Escape"===e.code&&(a.default.emit("close",this.closeListener),r.DomHandler.focus(this.target))}},computed:{containerClass(){return["p-confirm-popup p-component",{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple}]},message(){return this.confirmation?this.confirmation.message:null},iconClass(){return["p-confirm-popup-icon",this.confirmation?this.confirmation.icon:null]},acceptLabel(){return this.confirmation?this.confirmation.acceptLabel||this.$primevue.config.locale.accept:null},rejectLabel(){return this.confirmation?this.confirmation.rejectLabel||this.$primevue.config.locale.reject:null},acceptIcon(){return this.confirmation?this.confirmation.acceptIcon:null},rejectIcon(){return this.confirmation?this.confirmation.rejectIcon:null},acceptClass(){return["p-confirm-popup-accept p-button-sm",this.confirmation?this.confirmation.acceptClass:null]},rejectClass(){return["p-confirm-popup-reject p-button-sm",this.confirmation?this.confirmation.rejectClass||"p-button-text":null]},autoFocusAccept(){return void 0===this.confirmation.defaultFocus||"accept"===this.confirmation.defaultFocus},autoFocusReject(){return"reject"===this.confirmation.defaultFocus}},components:{CPButton:l.default,Portal:f.default},directives:{focustrap:p.default}};const d=["aria-modal"],h={key:0,class:"p-confirm-popup-content"},b={class:"p-confirm-popup-message"},v={class:"p-confirm-popup-footer"};return function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}("\n.p-confirm-popup {\n position: absolute;\n margin-top: 10px;\n top: 0;\n left: 0;\n}\n.p-confirm-popup-flipped {\n margin-top: 0;\n margin-bottom: 10px;\n}\n\n/* Animation */\n.p-confirm-popup-enter-from {\n opacity: 0;\n -webkit-transform: scaleY(0.8);\n transform: scaleY(0.8);\n}\n.p-confirm-popup-leave-to {\n opacity: 0;\n}\n.p-confirm-popup-enter-active {\n -webkit-transition: opacity 0.12s cubic-bezier(0, 0, 0.2, 1), -webkit-transform 0.12s cubic-bezier(0, 0, 0.2, 1);\n transition: opacity 0.12s cubic-bezier(0, 0, 0.2, 1), -webkit-transform 0.12s cubic-bezier(0, 0, 0.2, 1);\n transition: transform 0.12s cubic-bezier(0, 0, 0.2, 1), opacity 0.12s cubic-bezier(0, 0, 0.2, 1);\n transition: transform 0.12s cubic-bezier(0, 0, 0.2, 1), opacity 0.12s cubic-bezier(0, 0, 0.2, 1), -webkit-transform 0.12s cubic-bezier(0, 0, 0.2, 1);\n}\n.p-confirm-popup-leave-active {\n -webkit-transition: opacity 0.1s linear;\n transition: opacity 0.1s linear;\n}\n.p-confirm-popup:after,\n.p-confirm-popup:before {\n bottom: 100%;\n left: calc(var(--overlayArrowLeft, 0) + 1.25rem);\n content: ' ';\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n}\n.p-confirm-popup:after {\n border-width: 8px;\n margin-left: -8px;\n}\n.p-confirm-popup:before {\n border-width: 10px;\n margin-left: -10px;\n}\n.p-confirm-popup-flipped:after,\n.p-confirm-popup-flipped:before {\n bottom: auto;\n top: 100%;\n}\n.p-confirm-popup.p-confirm-popup-flipped:after {\n border-bottom-color: transparent;\n}\n.p-confirm-popup.p-confirm-popup-flipped:before {\n border-bottom-color: transparent;\n}\n.p-confirm-popup .p-confirm-popup-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n"),m.render=function(e,t,n,i,o,r){const c=s.resolveComponent("CPButton"),l=s.resolveComponent("Portal"),a=s.resolveDirective("focustrap");return s.openBlock(),s.createBlock(l,null,{default:s.withCtx((()=>[s.createVNode(s.Transition,{name:"p-confirm-popup",onEnter:r.onEnter,onLeave:r.onLeave,onAfterLeave:r.onAfterLeave},{default:s.withCtx((()=>[o.visible?s.withDirectives((s.openBlock(),s.createElementBlock("div",s.mergeProps({key:0,ref:r.containerRef,role:"alertdialog",class:r.containerClass,"aria-modal":o.visible,onClick:t[2]||(t[2]=(...e)=>r.onOverlayClick&&r.onOverlayClick(...e)),onKeydown:t[3]||(t[3]=(...e)=>r.onOverlayKeydown&&r.onOverlayKeydown(...e))},e.$attrs),[e.$slots.message?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(e.$slots.message),{key:1,message:o.confirmation},null,8,["message"])):(s.openBlock(),s.createElementBlock("div",h,[s.createElementVNode("i",{class:s.normalizeClass(r.iconClass)},null,2),s.createElementVNode("span",b,s.toDisplayString(o.confirmation.message),1)])),s.createElementVNode("div",v,[s.createVNode(c,{label:r.rejectLabel,icon:r.rejectIcon,class:s.normalizeClass(r.rejectClass),onClick:t[0]||(t[0]=e=>r.reject()),onKeydown:r.onRejectKeydown,autofocus:r.autoFocusReject},null,8,["label","icon","class","onKeydown","autofocus"]),s.createVNode(c,{label:r.acceptLabel,icon:r.acceptIcon,class:s.normalizeClass(r.acceptClass),onClick:t[1]||(t[1]=e=>r.accept()),onKeydown:r.onAcceptKeydown,autofocus:r.autoFocusAccept},null,8,["label","icon","class","onKeydown","autofocus"])])],16,d)),[[a]]):s.createCommentVNode("",!0)])),_:1},8,["onEnter","onLeave","onAfterLeave"])])),_:1})},m}(primevue.button,primevue.confirmationeventbus,primevue.focustrap,primevue.overlayeventbus,primevue.portal,primevue.utils,Vue);