primevue 3.22.1 → 3.22.2

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 (42) hide show
  1. package/core/core.js +15 -12
  2. package/core/core.min.js +2 -2
  3. package/divider/Divider.vue +1 -1
  4. package/divider/divider.cjs.js +1 -1
  5. package/divider/divider.cjs.min.js +1 -1
  6. package/divider/divider.esm.js +1 -1
  7. package/divider/divider.esm.min.js +1 -1
  8. package/divider/divider.js +1 -1
  9. package/divider/divider.min.js +1 -1
  10. package/menu/Menu.vue +1 -1
  11. package/menu/menu.cjs.js +1 -1
  12. package/menu/menu.cjs.min.js +1 -1
  13. package/menu/menu.esm.js +1 -1
  14. package/menu/menu.esm.min.js +1 -1
  15. package/menu/menu.js +1 -1
  16. package/menu/menu.min.js +1 -1
  17. package/package.json +1 -1
  18. package/paginator/JumpToPageInput.vue +11 -8
  19. package/paginator/Paginator.vue +1 -1
  20. package/paginator/paginator.cjs.js +14 -11
  21. package/paginator/paginator.cjs.min.js +1 -1
  22. package/paginator/paginator.esm.js +14 -11
  23. package/paginator/paginator.esm.min.js +1 -1
  24. package/paginator/paginator.js +14 -11
  25. package/paginator/paginator.min.js +1 -1
  26. package/rating/Rating.vue +1 -0
  27. package/rating/rating.cjs.js +1 -1
  28. package/rating/rating.cjs.min.js +1 -1
  29. package/rating/rating.esm.js +1 -1
  30. package/rating/rating.esm.min.js +1 -1
  31. package/rating/rating.js +1 -1
  32. package/rating/rating.min.js +1 -1
  33. package/resources/primevue.css +1 -0
  34. package/resources/primevue.min.css +1 -1
  35. package/sidebar/Sidebar.vue +60 -51
  36. package/sidebar/sidebar.cjs.js +123 -103
  37. package/sidebar/sidebar.cjs.min.js +1 -1
  38. package/sidebar/sidebar.esm.js +124 -104
  39. package/sidebar/sidebar.esm.min.js +1 -1
  40. package/sidebar/sidebar.js +123 -103
  41. package/sidebar/sidebar.min.js +1 -1
  42. package/web-types.json +1 -1
@@ -2,12 +2,12 @@ import FocusTrap from 'primevue/focustrap';
2
2
  import Portal from 'primevue/portal';
3
3
  import Ripple from 'primevue/ripple';
4
4
  import { ZIndexUtils, DomHandler } from 'primevue/utils';
5
- import { resolveComponent, resolveDirective, openBlock, createBlock, withCtx, createElementVNode, normalizeClass, createVNode, Transition, withDirectives, createElementBlock, mergeProps, renderSlot, createCommentVNode } from 'vue';
5
+ import { resolveComponent, resolveDirective, openBlock, createBlock, withCtx, createElementBlock, normalizeClass, createVNode, Transition, withDirectives, mergeProps, createElementVNode, renderSlot, createCommentVNode } from 'vue';
6
6
 
7
7
  var script = {
8
8
  name: 'Sidebar',
9
9
  inheritAttrs: false,
10
- emits: ['update:visible', 'show', 'hide'],
10
+ emits: ['update:visible', 'show', 'hide', 'after-hide'],
11
11
  props: {
12
12
  visible: {
13
13
  type: Boolean,
@@ -43,67 +43,70 @@ var script = {
43
43
  },
44
44
  blockScroll: {
45
45
  type: Boolean,
46
- default: true
46
+ default: false
47
47
  }
48
48
  },
49
+ data() {
50
+ return {
51
+ containerVisible: this.visible
52
+ };
53
+ },
49
54
  container: null,
55
+ mask: null,
50
56
  content: null,
51
57
  headerContainer: null,
52
58
  closeButton: null,
53
59
  outsideClickListener: null,
54
- data() {
55
- return {
56
- maskVisible: false
57
- };
58
- },
59
- watch: {
60
- visible(newValue) {
61
- this.maskVisible = newValue ? newValue : this.maskVisible;
60
+ updated() {
61
+ if (this.visible) {
62
+ this.containerVisible = this.visible;
62
63
  }
63
64
  },
64
65
  beforeUnmount() {
65
- if (this.container && this.autoZIndex) {
66
- ZIndexUtils.clear(this.container);
66
+ this.disableDocumentSettings();
67
+
68
+ if (this.mask && this.autoZIndex) {
69
+ ZIndexUtils.clear(this.mask);
67
70
  }
68
71
 
69
- this.unbindOutsideClickListener();
70
72
  this.container = null;
73
+ this.mask = null;
71
74
  },
72
75
  methods: {
73
76
  hide() {
74
77
  this.$emit('update:visible', false);
75
-
76
- this.unbindOutsideClickListener();
77
- this.blockScroll && DomHandler.removeClass(document.body, 'p-overflow-hidden');
78
78
  },
79
79
  onEnter() {
80
80
  this.$emit('show');
81
+ this.focus();
81
82
 
82
83
  if (this.autoZIndex) {
83
- ZIndexUtils.set('modal', this.$refs.mask, this.baseZIndex || this.$primevue.config.zIndex.modal);
84
+ ZIndexUtils.set('modal', this.mask, this.baseZIndex || this.$primevue.config.zIndex.modal);
85
+ }
86
+ },
87
+ onAfterEnter() {
88
+ this.enableDocumentSettings();
89
+ },
90
+ onBeforeLeave() {
91
+ if (this.modal) {
92
+ DomHandler.addClass(this.mask, 'p-component-overlay-leave');
84
93
  }
85
-
86
- this.maskVisible = true;
87
- this.focus();
88
94
  },
89
95
  onLeave() {
90
- DomHandler.addClass(this.$refs.mask, 'p-component-overlay-leave');
91
-
92
96
  this.$emit('hide');
93
- this.unbindOutsideClickListener();
94
97
  },
95
98
  onAfterLeave() {
96
99
  if (this.autoZIndex) {
97
100
  ZIndexUtils.clear(this.mask);
98
101
  }
99
102
 
100
- this.maskVisible = false;
103
+ this.containerVisible = false;
104
+ this.disableDocumentSettings();
105
+ this.$emit('after-hide');
101
106
  },
102
- onAfterEnter() {
103
- this.bindOutsideClickListener();
104
-
105
- if (this.blockScroll) {
106
- DomHandler.addClass(document.body, 'p-overflow-hidden');
107
+ onMaskClick(event) {
108
+ if (this.dismissable && this.modal && this.mask === event.target) {
109
+ this.hide();
107
110
  }
108
111
  },
109
112
  focus() {
@@ -123,19 +126,33 @@ var script = {
123
126
 
124
127
  focusTarget && focusTarget.focus();
125
128
  },
126
- onKeydown(event) {
127
- if (event.code === 'Escape') {
128
- this.hide();
129
+ enableDocumentSettings() {
130
+ if (this.dismissable && !this.modal) {
131
+ this.bindOutsideClickListener();
132
+ }
133
+
134
+ if (this.blockScroll) {
135
+ DomHandler.addClass(document.body, 'p-overflow-hidden');
129
136
  }
130
137
  },
131
- onMaskClick(event) {
132
- if (this.dismissable && this.modal && this.$refs.mask === event.target) {
138
+ disableDocumentSettings() {
139
+ this.unbindOutsideClickListener();
140
+
141
+ if (this.blockScroll) {
142
+ DomHandler.removeClass(document.body, 'p-overflow-hidden');
143
+ }
144
+ },
145
+ onKeydown(event) {
146
+ if (event.code === 'Escape') {
133
147
  this.hide();
134
148
  }
135
149
  },
136
150
  containerRef(el) {
137
151
  this.container = el;
138
152
  },
153
+ maskRef(el) {
154
+ this.mask = el;
155
+ },
139
156
  contentRef(el) {
140
157
  this.content = el;
141
158
  },
@@ -154,7 +171,7 @@ var script = {
154
171
  bindOutsideClickListener() {
155
172
  if (!this.outsideClickListener) {
156
173
  this.outsideClickListener = (event) => {
157
- if (!this.modal && this.isOutsideClicked(event) && this.dismissable) {
174
+ if (this.isOutsideClicked(event)) {
158
175
  this.hide();
159
176
  }
160
177
  };
@@ -189,14 +206,14 @@ var script = {
189
206
  closeAriaLabel() {
190
207
  return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : undefined;
191
208
  },
192
- maskClasses() {
209
+ maskClass() {
193
210
  return [
194
211
  'p-sidebar-mask',
195
212
  this.getPositionClass(),
196
213
  {
197
214
  'p-component-overlay p-component-overlay-enter': this.modal,
198
215
  'p-sidebar-mask-scrollblocker': this.blockScroll,
199
- 'p-sidebar-visible': this.maskVisible,
216
+ 'p-sidebar-visible': this.containerVisible,
200
217
  'p-sidebar-full': this.fullScreen
201
218
  }
202
219
  ];
@@ -225,71 +242,74 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
225
242
 
226
243
  return (openBlock(), createBlock(_component_Portal, null, {
227
244
  default: withCtx(() => [
228
- createElementVNode("div", {
229
- ref: "mask",
230
- style: {},
231
- class: normalizeClass($options.maskClasses),
232
- onMousedown: _cache[2] || (_cache[2] = (...args) => ($options.onMaskClick && $options.onMaskClick(...args)))
233
- }, [
234
- createVNode(Transition, {
235
- name: "p-sidebar",
236
- onAfterEnter: $options.onAfterEnter,
237
- onEnter: $options.onEnter,
238
- onLeave: $options.onLeave,
239
- onAfterLeave: $options.onAfterLeave,
240
- appear: ""
241
- }, {
242
- default: withCtx(() => [
243
- ($props.visible)
244
- ? withDirectives((openBlock(), createElementBlock("div", mergeProps({
245
- key: 0,
246
- ref: $options.containerRef,
247
- class: $options.containerClass,
248
- role: "complementary",
249
- "aria-modal": $props.modal,
250
- onKeydown: _cache[1] || (_cache[1] = (...args) => ($options.onKeydown && $options.onKeydown(...args)))
251
- }, _ctx.$attrs), [
252
- createElementVNode("div", {
253
- ref: $options.headerContainerRef,
254
- class: "p-sidebar-header"
255
- }, [
256
- (_ctx.$slots.header)
257
- ? (openBlock(), createElementBlock("div", _hoisted_2, [
258
- renderSlot(_ctx.$slots, "header")
259
- ]))
260
- : createCommentVNode("", true),
261
- ($props.showCloseIcon)
262
- ? withDirectives((openBlock(), createElementBlock("button", {
263
- key: 1,
264
- ref: $options.closeButtonRef,
265
- autofocus: "",
266
- type: "button",
267
- class: "p-sidebar-close p-sidebar-icon p-link",
268
- "aria-label": $options.closeAriaLabel,
269
- onClick: _cache[0] || (_cache[0] = (...args) => ($options.hide && $options.hide(...args)))
270
- }, [
271
- createElementVNode("span", {
272
- class: normalizeClass(['p-sidebar-close-icon', $props.closeIcon])
273
- }, null, 2)
274
- ], 8, _hoisted_3)), [
275
- [_directive_ripple]
276
- ])
277
- : createCommentVNode("", true)
278
- ], 512),
279
- createElementVNode("div", {
280
- ref: $options.contentRef,
281
- class: "p-sidebar-content"
282
- }, [
283
- renderSlot(_ctx.$slots, "default")
284
- ], 512)
285
- ], 16, _hoisted_1)), [
286
- [_directive_focustrap]
287
- ])
288
- : createCommentVNode("", true)
289
- ]),
290
- _: 3
291
- }, 8, ["onAfterEnter", "onEnter", "onLeave", "onAfterLeave"])
292
- ], 34)
245
+ ($data.containerVisible)
246
+ ? (openBlock(), createElementBlock("div", {
247
+ key: 0,
248
+ ref: $options.maskRef,
249
+ class: normalizeClass($options.maskClass),
250
+ onMousedown: _cache[2] || (_cache[2] = (...args) => ($options.onMaskClick && $options.onMaskClick(...args)))
251
+ }, [
252
+ createVNode(Transition, {
253
+ name: "p-sidebar",
254
+ onEnter: $options.onEnter,
255
+ onAfterEnter: $options.onAfterEnter,
256
+ onBeforeLeave: $options.onBeforeLeave,
257
+ onLeave: $options.onLeave,
258
+ onAfterLeave: $options.onAfterLeave,
259
+ appear: ""
260
+ }, {
261
+ default: withCtx(() => [
262
+ ($props.visible)
263
+ ? withDirectives((openBlock(), createElementBlock("div", mergeProps({
264
+ key: 0,
265
+ ref: $options.containerRef,
266
+ class: $options.containerClass,
267
+ role: "complementary",
268
+ "aria-modal": $props.modal,
269
+ onKeydown: _cache[1] || (_cache[1] = (...args) => ($options.onKeydown && $options.onKeydown(...args)))
270
+ }, _ctx.$attrs), [
271
+ createElementVNode("div", {
272
+ ref: $options.headerContainerRef,
273
+ class: "p-sidebar-header"
274
+ }, [
275
+ (_ctx.$slots.header)
276
+ ? (openBlock(), createElementBlock("div", _hoisted_2, [
277
+ renderSlot(_ctx.$slots, "header")
278
+ ]))
279
+ : createCommentVNode("", true),
280
+ ($props.showCloseIcon)
281
+ ? withDirectives((openBlock(), createElementBlock("button", {
282
+ key: 1,
283
+ ref: $options.closeButtonRef,
284
+ autofocus: "",
285
+ type: "button",
286
+ class: "p-sidebar-close p-sidebar-icon p-link",
287
+ "aria-label": $options.closeAriaLabel,
288
+ onClick: _cache[0] || (_cache[0] = (...args) => ($options.hide && $options.hide(...args)))
289
+ }, [
290
+ createElementVNode("span", {
291
+ class: normalizeClass(['p-sidebar-close-icon', $props.closeIcon])
292
+ }, null, 2)
293
+ ], 8, _hoisted_3)), [
294
+ [_directive_ripple]
295
+ ])
296
+ : createCommentVNode("", true)
297
+ ], 512),
298
+ createElementVNode("div", {
299
+ ref: $options.contentRef,
300
+ class: "p-sidebar-content"
301
+ }, [
302
+ renderSlot(_ctx.$slots, "default")
303
+ ], 512)
304
+ ], 16, _hoisted_1)), [
305
+ [_directive_focustrap]
306
+ ])
307
+ : createCommentVNode("", true)
308
+ ]),
309
+ _: 3
310
+ }, 8, ["onEnter", "onAfterEnter", "onBeforeLeave", "onLeave", "onAfterLeave"])
311
+ ], 34))
312
+ : createCommentVNode("", true)
293
313
  ]),
294
314
  _: 3
295
315
  }))
@@ -322,7 +342,7 @@ function styleInject(css, ref) {
322
342
  }
323
343
  }
324
344
 
325
- var css_248z = "\n.p-sidebar-mask {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: none;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n background-color: transparent;\n transition-property: background-color;\n}\n.p-sidebar-visible {\n display: flex;\n}\n.p-sidebar-mask.p-component-overlay {\n pointer-events: auto;\n}\n.p-sidebar {\n display: flex;\n flex-direction: column;\n pointer-events: auto;\n transform: translate3d(0px, 0px, 0px);\n position: relative;\n transition: transform 0.3s;\n}\n.p-sidebar-content {\n overflow-y: auto;\n flex-grow: 1;\n}\n.p-sidebar-header {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n flex-shrink: 0;\n}\n.p-sidebar-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n}\n.p-sidebar-full .p-sidebar {\n transition: none;\n transform: none;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px !important;\n left: 0px !important;\n}\n\n/* Animation */\n/* Center */\n.p-sidebar-left .p-sidebar-enter-from,\n.p-sidebar-left .p-sidebar-leave-to {\n transform: translateX(-100%);\n}\n.p-sidebar-right .p-sidebar-enter-from,\n.p-sidebar-right .p-sidebar-leave-to {\n transform: translateX(100%);\n}\n.p-sidebar-top .p-sidebar-enter-from,\n.p-sidebar-top .p-sidebar-leave-to {\n transform: translateY(-100%);\n}\n.p-sidebar-bottom .p-sidebar-enter-from,\n.p-sidebar-bottom .p-sidebar-leave-to {\n transform: translateY(100%);\n}\n.p-sidebar-full .p-sidebar-enter-from,\n.p-sidebar-full .p-sidebar-leave-to {\n opacity: 0;\n}\n.p-sidebar-full .p-sidebar-enter-active,\n.p-sidebar-full .p-sidebar-leave-active {\n transition: opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1);\n}\n\n/* Position */\n.p-sidebar-left {\n justify-content: flex-start;\n}\n.p-sidebar-right {\n justify-content: flex-end;\n}\n.p-sidebar-top {\n align-items: flex-start;\n}\n.p-sidebar-bottom {\n align-items: flex-end;\n}\n\n/* Size */\n.p-sidebar-left .p-sidebar {\n width: 20rem;\n height: 100%;\n}\n.p-sidebar-right .p-sidebar {\n width: 20rem;\n height: 100%;\n}\n.p-sidebar-top .p-sidebar {\n height: 10rem;\n width: 100%;\n}\n.p-sidebar-bottom .p-sidebar {\n height: 10rem;\n width: 100%;\n}\n.p-sidebar-left .p-sidebar-sm,\n.p-sidebar-right .p-sidebar-sm {\n width: 20rem;\n}\n.p-sidebar-left .p-sidebar-md,\n.p-sidebar-right .p-sidebar-md {\n width: 40rem;\n}\n.p-sidebar-left .p-sidebar-lg,\n.p-sidebar-right .p-sidebar-lg {\n width: 60rem;\n}\n.p-sidebar-top .p-sidebar-sm,\n.p-sidebar-bottom .p-sidebar-sm {\n height: 10rem;\n}\n.p-sidebar-top .p-sidebar-md,\n.p-sidebar-bottom .p-sidebar-md {\n height: 20rem;\n}\n.p-sidebar-top .p-sidebar-lg,\n.p-sidebar-bottom .p-sidebar-lg {\n height: 30rem;\n}\n.p-sidebar-left .p-sidebar-view,\n.p-sidebar-right .p-sidebar-view,\n.p-sidebar-top .p-sidebar-view,\n.p-sidebar-bottom .p-sidebar-view {\n width: 100%;\n height: 100%;\n}\n.p-sidebar-left .p-sidebar-content,\n.p-sidebar-right .p-sidebar-content,\n.p-sidebar-top .p-sidebar-content,\n.p-sidebar-bottom .p-sidebar-content {\n width: 100%;\n height: 100%;\n}\n@media screen and (max-width: 64em) {\n.p-sidebar-left .p-sidebar-lg,\n .p-sidebar-left .p-sidebar-md,\n .p-sidebar-right .p-sidebar-lg,\n .p-sidebar-right .p-sidebar-md {\n width: 20rem;\n}\n}\n";
345
+ var css_248z = "\n.p-sidebar-mask {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: none;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n background-color: transparent;\n transition-property: background-color;\n}\n.p-sidebar-mask.p-component-overlay {\n pointer-events: auto;\n}\n.p-sidebar-visible {\n display: flex;\n}\n.p-sidebar {\n display: flex;\n flex-direction: column;\n pointer-events: auto;\n transform: translate3d(0px, 0px, 0px);\n position: relative;\n transition: transform 0.3s;\n}\n.p-sidebar-content {\n overflow-y: auto;\n flex-grow: 1;\n}\n.p-sidebar-header {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n flex-shrink: 0;\n}\n.p-sidebar-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n}\n.p-sidebar-full .p-sidebar {\n transition: none;\n transform: none;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px !important;\n left: 0px !important;\n}\n\n/* Animation */\n/* Center */\n.p-sidebar-left .p-sidebar-enter-from,\n.p-sidebar-left .p-sidebar-leave-to {\n transform: translateX(-100%);\n}\n.p-sidebar-right .p-sidebar-enter-from,\n.p-sidebar-right .p-sidebar-leave-to {\n transform: translateX(100%);\n}\n.p-sidebar-top .p-sidebar-enter-from,\n.p-sidebar-top .p-sidebar-leave-to {\n transform: translateY(-100%);\n}\n.p-sidebar-bottom .p-sidebar-enter-from,\n.p-sidebar-bottom .p-sidebar-leave-to {\n transform: translateY(100%);\n}\n.p-sidebar-full .p-sidebar-enter-from,\n.p-sidebar-full .p-sidebar-leave-to {\n opacity: 0;\n}\n.p-sidebar-full .p-sidebar-enter-active,\n.p-sidebar-full .p-sidebar-leave-active {\n transition: opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1);\n}\n\n/* Position */\n.p-sidebar-left {\n justify-content: flex-start;\n}\n.p-sidebar-right {\n justify-content: flex-end;\n}\n.p-sidebar-top {\n align-items: flex-start;\n}\n.p-sidebar-bottom {\n align-items: flex-end;\n}\n\n/* Size */\n.p-sidebar-left .p-sidebar {\n width: 20rem;\n height: 100%;\n}\n.p-sidebar-right .p-sidebar {\n width: 20rem;\n height: 100%;\n}\n.p-sidebar-top .p-sidebar {\n height: 10rem;\n width: 100%;\n}\n.p-sidebar-bottom .p-sidebar {\n height: 10rem;\n width: 100%;\n}\n.p-sidebar-left .p-sidebar-sm,\n.p-sidebar-right .p-sidebar-sm {\n width: 20rem;\n}\n.p-sidebar-left .p-sidebar-md,\n.p-sidebar-right .p-sidebar-md {\n width: 40rem;\n}\n.p-sidebar-left .p-sidebar-lg,\n.p-sidebar-right .p-sidebar-lg {\n width: 60rem;\n}\n.p-sidebar-top .p-sidebar-sm,\n.p-sidebar-bottom .p-sidebar-sm {\n height: 10rem;\n}\n.p-sidebar-top .p-sidebar-md,\n.p-sidebar-bottom .p-sidebar-md {\n height: 20rem;\n}\n.p-sidebar-top .p-sidebar-lg,\n.p-sidebar-bottom .p-sidebar-lg {\n height: 30rem;\n}\n.p-sidebar-left .p-sidebar-content,\n.p-sidebar-right .p-sidebar-content,\n.p-sidebar-top .p-sidebar-content,\n.p-sidebar-bottom .p-sidebar-content {\n width: 100%;\n height: 100%;\n}\n@media screen and (max-width: 64em) {\n.p-sidebar-left .p-sidebar-lg,\n .p-sidebar-left .p-sidebar-md,\n .p-sidebar-right .p-sidebar-lg,\n .p-sidebar-right .p-sidebar-md {\n width: 20rem;\n}\n}\n";
326
346
  styleInject(css_248z);
327
347
 
328
348
  script.render = render;
@@ -1 +1 @@
1
- import e from"primevue/focustrap";import t from"primevue/portal";import n from"primevue/ripple";import{ZIndexUtils as i,DomHandler as s}from"primevue/utils";import{resolveComponent as r,resolveDirective as a,openBlock as o,createBlock as d,withCtx as l,createElementVNode as p,normalizeClass as b,createVNode as c,Transition as h,withDirectives as m,createElementBlock as f,mergeProps as u,renderSlot as v,createCommentVNode as k}from"vue";var g={name:"Sidebar",inheritAttrs:!1,emits:["update:visible","show","hide"],props:{visible:{type:Boolean,default:!1},position:{type:String,default:"left"},baseZIndex:{type:Number,default:0},autoZIndex:{type:Boolean,default:!0},dismissable:{type:Boolean,default:!0},showCloseIcon:{type:Boolean,default:!0},closeIcon:{type:String,default:"pi pi-times"},modal:{type:Boolean,default:!0},blockScroll:{type:Boolean,default:!0}},container:null,content:null,headerContainer:null,closeButton:null,outsideClickListener:null,data:()=>({maskVisible:!1}),watch:{visible(e){this.maskVisible=e||this.maskVisible}},beforeUnmount(){this.container&&this.autoZIndex&&i.clear(this.container),this.unbindOutsideClickListener(),this.container=null},methods:{hide(){this.$emit("update:visible",!1),this.unbindOutsideClickListener(),this.blockScroll&&s.removeClass(document.body,"p-overflow-hidden")},onEnter(){this.$emit("show"),this.autoZIndex&&i.set("modal",this.$refs.mask,this.baseZIndex||this.$primevue.config.zIndex.modal),this.maskVisible=!0,this.focus()},onLeave(){s.addClass(this.$refs.mask,"p-component-overlay-leave"),this.$emit("hide"),this.unbindOutsideClickListener()},onAfterLeave(){this.autoZIndex&&i.clear(this.mask),this.maskVisible=!1},onAfterEnter(){this.bindOutsideClickListener(),this.blockScroll&&s.addClass(document.body,"p-overflow-hidden")},focus(){const e=e=>e.querySelector("[autofocus]");let t=this.$slots.default&&e(this.content);t||(t=this.$slots.header&&e(this.headerContainer),t||(t=e(this.container))),t&&t.focus()},onKeydown(e){"Escape"===e.code&&this.hide()},onMaskClick(e){this.dismissable&&this.modal&&this.$refs.mask===e.target&&this.hide()},containerRef(e){this.container=e},contentRef(e){this.content=e},headerContainerRef(e){this.headerContainer=e},closeButtonRef(e){this.closeButton=e},getPositionClass(){const e=["left","right","top","bottom"].find((e=>e===this.position));return e?`p-sidebar-${e}`:""},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{!this.modal&&this.isOutsideClicked(e)&&this.dismissable&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},isOutsideClicked(e){return this.container&&!this.container.contains(e.target)}},computed:{containerClass(){return["p-sidebar p-component",{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple,"p-sidebar-full":this.fullScreen}]},fullScreen(){return"full"===this.position},closeAriaLabel(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0},maskClasses(){return["p-sidebar-mask",this.getPositionClass(),{"p-component-overlay p-component-overlay-enter":this.modal,"p-sidebar-mask-scrollblocker":this.blockScroll,"p-sidebar-visible":this.maskVisible,"p-sidebar-full":this.fullScreen}]}},directives:{focustrap:e,ripple:n},components:{Portal:t}};const y=["aria-modal"],C={key:0,class:"p-sidebar-header-content"},w=["aria-label"];!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===n&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}("\n.p-sidebar-mask {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: none;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n background-color: transparent;\n transition-property: background-color;\n}\n.p-sidebar-visible {\n display: flex;\n}\n.p-sidebar-mask.p-component-overlay {\n pointer-events: auto;\n}\n.p-sidebar {\n display: flex;\n flex-direction: column;\n pointer-events: auto;\n transform: translate3d(0px, 0px, 0px);\n position: relative;\n transition: transform 0.3s;\n}\n.p-sidebar-content {\n overflow-y: auto;\n flex-grow: 1;\n}\n.p-sidebar-header {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n flex-shrink: 0;\n}\n.p-sidebar-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n}\n.p-sidebar-full .p-sidebar {\n transition: none;\n transform: none;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px !important;\n left: 0px !important;\n}\n\n/* Animation */\n/* Center */\n.p-sidebar-left .p-sidebar-enter-from,\n.p-sidebar-left .p-sidebar-leave-to {\n transform: translateX(-100%);\n}\n.p-sidebar-right .p-sidebar-enter-from,\n.p-sidebar-right .p-sidebar-leave-to {\n transform: translateX(100%);\n}\n.p-sidebar-top .p-sidebar-enter-from,\n.p-sidebar-top .p-sidebar-leave-to {\n transform: translateY(-100%);\n}\n.p-sidebar-bottom .p-sidebar-enter-from,\n.p-sidebar-bottom .p-sidebar-leave-to {\n transform: translateY(100%);\n}\n.p-sidebar-full .p-sidebar-enter-from,\n.p-sidebar-full .p-sidebar-leave-to {\n opacity: 0;\n}\n.p-sidebar-full .p-sidebar-enter-active,\n.p-sidebar-full .p-sidebar-leave-active {\n transition: opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1);\n}\n\n/* Position */\n.p-sidebar-left {\n justify-content: flex-start;\n}\n.p-sidebar-right {\n justify-content: flex-end;\n}\n.p-sidebar-top {\n align-items: flex-start;\n}\n.p-sidebar-bottom {\n align-items: flex-end;\n}\n\n/* Size */\n.p-sidebar-left .p-sidebar {\n width: 20rem;\n height: 100%;\n}\n.p-sidebar-right .p-sidebar {\n width: 20rem;\n height: 100%;\n}\n.p-sidebar-top .p-sidebar {\n height: 10rem;\n width: 100%;\n}\n.p-sidebar-bottom .p-sidebar {\n height: 10rem;\n width: 100%;\n}\n.p-sidebar-left .p-sidebar-sm,\n.p-sidebar-right .p-sidebar-sm {\n width: 20rem;\n}\n.p-sidebar-left .p-sidebar-md,\n.p-sidebar-right .p-sidebar-md {\n width: 40rem;\n}\n.p-sidebar-left .p-sidebar-lg,\n.p-sidebar-right .p-sidebar-lg {\n width: 60rem;\n}\n.p-sidebar-top .p-sidebar-sm,\n.p-sidebar-bottom .p-sidebar-sm {\n height: 10rem;\n}\n.p-sidebar-top .p-sidebar-md,\n.p-sidebar-bottom .p-sidebar-md {\n height: 20rem;\n}\n.p-sidebar-top .p-sidebar-lg,\n.p-sidebar-bottom .p-sidebar-lg {\n height: 30rem;\n}\n.p-sidebar-left .p-sidebar-view,\n.p-sidebar-right .p-sidebar-view,\n.p-sidebar-top .p-sidebar-view,\n.p-sidebar-bottom .p-sidebar-view {\n width: 100%;\n height: 100%;\n}\n.p-sidebar-left .p-sidebar-content,\n.p-sidebar-right .p-sidebar-content,\n.p-sidebar-top .p-sidebar-content,\n.p-sidebar-bottom .p-sidebar-content {\n width: 100%;\n height: 100%;\n}\n@media screen and (max-width: 64em) {\n.p-sidebar-left .p-sidebar-lg,\n .p-sidebar-left .p-sidebar-md,\n .p-sidebar-right .p-sidebar-lg,\n .p-sidebar-right .p-sidebar-md {\n width: 20rem;\n}\n}\n"),g.render=function(e,t,n,i,s,g){const x=r("Portal"),L=a("ripple"),$=a("focustrap");return o(),d(x,null,{default:l((()=>[p("div",{ref:"mask",style:{},class:b(g.maskClasses),onMousedown:t[2]||(t[2]=(...e)=>g.onMaskClick&&g.onMaskClick(...e))},[c(h,{name:"p-sidebar",onAfterEnter:g.onAfterEnter,onEnter:g.onEnter,onLeave:g.onLeave,onAfterLeave:g.onAfterLeave,appear:""},{default:l((()=>[n.visible?m((o(),f("div",u({key:0,ref:g.containerRef,class:g.containerClass,role:"complementary","aria-modal":n.modal,onKeydown:t[1]||(t[1]=(...e)=>g.onKeydown&&g.onKeydown(...e))},e.$attrs),[p("div",{ref:g.headerContainerRef,class:"p-sidebar-header"},[e.$slots.header?(o(),f("div",C,[v(e.$slots,"header")])):k("",!0),n.showCloseIcon?m((o(),f("button",{key:1,ref:g.closeButtonRef,autofocus:"",type:"button",class:"p-sidebar-close p-sidebar-icon p-link","aria-label":g.closeAriaLabel,onClick:t[0]||(t[0]=(...e)=>g.hide&&g.hide(...e))},[p("span",{class:b(["p-sidebar-close-icon",n.closeIcon])},null,2)],8,w)),[[L]]):k("",!0)],512),p("div",{ref:g.contentRef,class:"p-sidebar-content"},[v(e.$slots,"default")],512)],16,y)),[[$]]):k("",!0)])),_:3},8,["onAfterEnter","onEnter","onLeave","onAfterLeave"])],34)])),_:3})};export{g as default};
1
+ import e from"primevue/focustrap";import t from"primevue/portal";import n from"primevue/ripple";import{ZIndexUtils as i,DomHandler as s}from"primevue/utils";import{resolveComponent as r,resolveDirective as a,openBlock as o,createBlock as l,withCtx as d,createElementBlock as p,normalizeClass as c,createVNode as b,Transition as h,withDirectives as m,mergeProps as f,createElementVNode as u,renderSlot as v,createCommentVNode as g}from"vue";var k={name:"Sidebar",inheritAttrs:!1,emits:["update:visible","show","hide","after-hide"],props:{visible:{type:Boolean,default:!1},position:{type:String,default:"left"},baseZIndex:{type:Number,default:0},autoZIndex:{type:Boolean,default:!0},dismissable:{type:Boolean,default:!0},showCloseIcon:{type:Boolean,default:!0},closeIcon:{type:String,default:"pi pi-times"},modal:{type:Boolean,default:!0},blockScroll:{type:Boolean,default:!1}},data(){return{containerVisible:this.visible}},container:null,mask:null,content:null,headerContainer:null,closeButton:null,outsideClickListener:null,updated(){this.visible&&(this.containerVisible=this.visible)},beforeUnmount(){this.disableDocumentSettings(),this.mask&&this.autoZIndex&&i.clear(this.mask),this.container=null,this.mask=null},methods:{hide(){this.$emit("update:visible",!1)},onEnter(){this.$emit("show"),this.focus(),this.autoZIndex&&i.set("modal",this.mask,this.baseZIndex||this.$primevue.config.zIndex.modal)},onAfterEnter(){this.enableDocumentSettings()},onBeforeLeave(){this.modal&&s.addClass(this.mask,"p-component-overlay-leave")},onLeave(){this.$emit("hide")},onAfterLeave(){this.autoZIndex&&i.clear(this.mask),this.containerVisible=!1,this.disableDocumentSettings(),this.$emit("after-hide")},onMaskClick(e){this.dismissable&&this.modal&&this.mask===e.target&&this.hide()},focus(){const e=e=>e.querySelector("[autofocus]");let t=this.$slots.default&&e(this.content);t||(t=this.$slots.header&&e(this.headerContainer),t||(t=e(this.container))),t&&t.focus()},enableDocumentSettings(){this.dismissable&&!this.modal&&this.bindOutsideClickListener(),this.blockScroll&&s.addClass(document.body,"p-overflow-hidden")},disableDocumentSettings(){this.unbindOutsideClickListener(),this.blockScroll&&s.removeClass(document.body,"p-overflow-hidden")},onKeydown(e){"Escape"===e.code&&this.hide()},containerRef(e){this.container=e},maskRef(e){this.mask=e},contentRef(e){this.content=e},headerContainerRef(e){this.headerContainer=e},closeButtonRef(e){this.closeButton=e},getPositionClass(){const e=["left","right","top","bottom"].find((e=>e===this.position));return e?`p-sidebar-${e}`:""},bindOutsideClickListener(){this.outsideClickListener||(this.outsideClickListener=e=>{this.isOutsideClicked(e)&&this.hide()},document.addEventListener("click",this.outsideClickListener))},unbindOutsideClickListener(){this.outsideClickListener&&(document.removeEventListener("click",this.outsideClickListener),this.outsideClickListener=null)},isOutsideClicked(e){return this.container&&!this.container.contains(e.target)}},computed:{containerClass(){return["p-sidebar p-component",{"p-input-filled":"filled"===this.$primevue.config.inputStyle,"p-ripple-disabled":!1===this.$primevue.config.ripple,"p-sidebar-full":this.fullScreen}]},fullScreen(){return"full"===this.position},closeAriaLabel(){return this.$primevue.config.locale.aria?this.$primevue.config.locale.aria.close:void 0},maskClass(){return["p-sidebar-mask",this.getPositionClass(),{"p-component-overlay p-component-overlay-enter":this.modal,"p-sidebar-mask-scrollblocker":this.blockScroll,"p-sidebar-visible":this.containerVisible,"p-sidebar-full":this.fullScreen}]}},directives:{focustrap:e,ripple:n},components:{Portal:t}};const y=["aria-modal"],C={key:0,class:"p-sidebar-header-content"},x=["aria-label"];!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===n&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}("\n.p-sidebar-mask {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: none;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n background-color: transparent;\n transition-property: background-color;\n}\n.p-sidebar-mask.p-component-overlay {\n pointer-events: auto;\n}\n.p-sidebar-visible {\n display: flex;\n}\n.p-sidebar {\n display: flex;\n flex-direction: column;\n pointer-events: auto;\n transform: translate3d(0px, 0px, 0px);\n position: relative;\n transition: transform 0.3s;\n}\n.p-sidebar-content {\n overflow-y: auto;\n flex-grow: 1;\n}\n.p-sidebar-header {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n flex-shrink: 0;\n}\n.p-sidebar-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n}\n.p-sidebar-full .p-sidebar {\n transition: none;\n transform: none;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px !important;\n left: 0px !important;\n}\n\n/* Animation */\n/* Center */\n.p-sidebar-left .p-sidebar-enter-from,\n.p-sidebar-left .p-sidebar-leave-to {\n transform: translateX(-100%);\n}\n.p-sidebar-right .p-sidebar-enter-from,\n.p-sidebar-right .p-sidebar-leave-to {\n transform: translateX(100%);\n}\n.p-sidebar-top .p-sidebar-enter-from,\n.p-sidebar-top .p-sidebar-leave-to {\n transform: translateY(-100%);\n}\n.p-sidebar-bottom .p-sidebar-enter-from,\n.p-sidebar-bottom .p-sidebar-leave-to {\n transform: translateY(100%);\n}\n.p-sidebar-full .p-sidebar-enter-from,\n.p-sidebar-full .p-sidebar-leave-to {\n opacity: 0;\n}\n.p-sidebar-full .p-sidebar-enter-active,\n.p-sidebar-full .p-sidebar-leave-active {\n transition: opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1);\n}\n\n/* Position */\n.p-sidebar-left {\n justify-content: flex-start;\n}\n.p-sidebar-right {\n justify-content: flex-end;\n}\n.p-sidebar-top {\n align-items: flex-start;\n}\n.p-sidebar-bottom {\n align-items: flex-end;\n}\n\n/* Size */\n.p-sidebar-left .p-sidebar {\n width: 20rem;\n height: 100%;\n}\n.p-sidebar-right .p-sidebar {\n width: 20rem;\n height: 100%;\n}\n.p-sidebar-top .p-sidebar {\n height: 10rem;\n width: 100%;\n}\n.p-sidebar-bottom .p-sidebar {\n height: 10rem;\n width: 100%;\n}\n.p-sidebar-left .p-sidebar-sm,\n.p-sidebar-right .p-sidebar-sm {\n width: 20rem;\n}\n.p-sidebar-left .p-sidebar-md,\n.p-sidebar-right .p-sidebar-md {\n width: 40rem;\n}\n.p-sidebar-left .p-sidebar-lg,\n.p-sidebar-right .p-sidebar-lg {\n width: 60rem;\n}\n.p-sidebar-top .p-sidebar-sm,\n.p-sidebar-bottom .p-sidebar-sm {\n height: 10rem;\n}\n.p-sidebar-top .p-sidebar-md,\n.p-sidebar-bottom .p-sidebar-md {\n height: 20rem;\n}\n.p-sidebar-top .p-sidebar-lg,\n.p-sidebar-bottom .p-sidebar-lg {\n height: 30rem;\n}\n.p-sidebar-left .p-sidebar-content,\n.p-sidebar-right .p-sidebar-content,\n.p-sidebar-top .p-sidebar-content,\n.p-sidebar-bottom .p-sidebar-content {\n width: 100%;\n height: 100%;\n}\n@media screen and (max-width: 64em) {\n.p-sidebar-left .p-sidebar-lg,\n .p-sidebar-left .p-sidebar-md,\n .p-sidebar-right .p-sidebar-lg,\n .p-sidebar-right .p-sidebar-md {\n width: 20rem;\n}\n}\n"),k.render=function(e,t,n,i,s,k){const w=r("Portal"),L=a("ripple"),S=a("focustrap");return o(),l(w,null,{default:d((()=>[s.containerVisible?(o(),p("div",{key:0,ref:k.maskRef,class:c(k.maskClass),onMousedown:t[2]||(t[2]=(...e)=>k.onMaskClick&&k.onMaskClick(...e))},[b(h,{name:"p-sidebar",onEnter:k.onEnter,onAfterEnter:k.onAfterEnter,onBeforeLeave:k.onBeforeLeave,onLeave:k.onLeave,onAfterLeave:k.onAfterLeave,appear:""},{default:d((()=>[n.visible?m((o(),p("div",f({key:0,ref:k.containerRef,class:k.containerClass,role:"complementary","aria-modal":n.modal,onKeydown:t[1]||(t[1]=(...e)=>k.onKeydown&&k.onKeydown(...e))},e.$attrs),[u("div",{ref:k.headerContainerRef,class:"p-sidebar-header"},[e.$slots.header?(o(),p("div",C,[v(e.$slots,"header")])):g("",!0),n.showCloseIcon?m((o(),p("button",{key:1,ref:k.closeButtonRef,autofocus:"",type:"button",class:"p-sidebar-close p-sidebar-icon p-link","aria-label":k.closeAriaLabel,onClick:t[0]||(t[0]=(...e)=>k.hide&&k.hide(...e))},[u("span",{class:c(["p-sidebar-close-icon",n.closeIcon])},null,2)],8,x)),[[L]]):g("",!0)],512),u("div",{ref:k.contentRef,class:"p-sidebar-content"},[v(e.$slots,"default")],512)],16,y)),[[S]]):g("",!0)])),_:3},8,["onEnter","onAfterEnter","onBeforeLeave","onLeave","onAfterLeave"])],34)):g("",!0)])),_:3})};export{k as default};