primevue 3.22.0 → 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 +61 -51
  36. package/sidebar/sidebar.cjs.js +124 -103
  37. package/sidebar/sidebar.cjs.min.js +1 -1
  38. package/sidebar/sidebar.esm.js +125 -104
  39. package/sidebar/sidebar.esm.min.js +1 -1
  40. package/sidebar/sidebar.js +124 -103
  41. package/sidebar/sidebar.min.js +1 -1
  42. package/web-types.json +1 -1
@@ -2,11 +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
- emits: ['update:visible', 'show', 'hide'],
9
+ inheritAttrs: false,
10
+ emits: ['update:visible', 'show', 'hide', 'after-hide'],
10
11
  props: {
11
12
  visible: {
12
13
  type: Boolean,
@@ -42,67 +43,70 @@ var script = {
42
43
  },
43
44
  blockScroll: {
44
45
  type: Boolean,
45
- default: true
46
+ default: false
46
47
  }
47
48
  },
49
+ data() {
50
+ return {
51
+ containerVisible: this.visible
52
+ };
53
+ },
48
54
  container: null,
55
+ mask: null,
49
56
  content: null,
50
57
  headerContainer: null,
51
58
  closeButton: null,
52
59
  outsideClickListener: null,
53
- data() {
54
- return {
55
- maskVisible: false
56
- };
57
- },
58
- watch: {
59
- visible(newValue) {
60
- this.maskVisible = newValue ? newValue : this.maskVisible;
60
+ updated() {
61
+ if (this.visible) {
62
+ this.containerVisible = this.visible;
61
63
  }
62
64
  },
63
65
  beforeUnmount() {
64
- if (this.container && this.autoZIndex) {
65
- ZIndexUtils.clear(this.container);
66
+ this.disableDocumentSettings();
67
+
68
+ if (this.mask && this.autoZIndex) {
69
+ ZIndexUtils.clear(this.mask);
66
70
  }
67
71
 
68
- this.unbindOutsideClickListener();
69
72
  this.container = null;
73
+ this.mask = null;
70
74
  },
71
75
  methods: {
72
76
  hide() {
73
77
  this.$emit('update:visible', false);
74
-
75
- this.unbindOutsideClickListener();
76
- this.blockScroll && DomHandler.removeClass(document.body, 'p-overflow-hidden');
77
78
  },
78
79
  onEnter() {
79
80
  this.$emit('show');
81
+ this.focus();
80
82
 
81
83
  if (this.autoZIndex) {
82
- 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');
83
93
  }
84
-
85
- this.maskVisible = true;
86
- this.focus();
87
94
  },
88
95
  onLeave() {
89
- DomHandler.addClass(this.$refs.mask, 'p-component-overlay-leave');
90
-
91
96
  this.$emit('hide');
92
- this.unbindOutsideClickListener();
93
97
  },
94
98
  onAfterLeave() {
95
99
  if (this.autoZIndex) {
96
100
  ZIndexUtils.clear(this.mask);
97
101
  }
98
102
 
99
- this.maskVisible = false;
103
+ this.containerVisible = false;
104
+ this.disableDocumentSettings();
105
+ this.$emit('after-hide');
100
106
  },
101
- onAfterEnter() {
102
- this.bindOutsideClickListener();
103
-
104
- if (this.blockScroll) {
105
- DomHandler.addClass(document.body, 'p-overflow-hidden');
107
+ onMaskClick(event) {
108
+ if (this.dismissable && this.modal && this.mask === event.target) {
109
+ this.hide();
106
110
  }
107
111
  },
108
112
  focus() {
@@ -122,19 +126,33 @@ var script = {
122
126
 
123
127
  focusTarget && focusTarget.focus();
124
128
  },
125
- onKeydown(event) {
126
- if (event.code === 'Escape') {
127
- 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');
128
136
  }
129
137
  },
130
- onMaskClick(event) {
131
- 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') {
132
147
  this.hide();
133
148
  }
134
149
  },
135
150
  containerRef(el) {
136
151
  this.container = el;
137
152
  },
153
+ maskRef(el) {
154
+ this.mask = el;
155
+ },
138
156
  contentRef(el) {
139
157
  this.content = el;
140
158
  },
@@ -153,7 +171,7 @@ var script = {
153
171
  bindOutsideClickListener() {
154
172
  if (!this.outsideClickListener) {
155
173
  this.outsideClickListener = (event) => {
156
- if (!this.modal && this.isOutsideClicked(event) && this.dismissable) {
174
+ if (this.isOutsideClicked(event)) {
157
175
  this.hide();
158
176
  }
159
177
  };
@@ -188,14 +206,14 @@ var script = {
188
206
  closeAriaLabel() {
189
207
  return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : undefined;
190
208
  },
191
- maskClasses() {
209
+ maskClass() {
192
210
  return [
193
211
  'p-sidebar-mask',
194
212
  this.getPositionClass(),
195
213
  {
196
214
  'p-component-overlay p-component-overlay-enter': this.modal,
197
215
  'p-sidebar-mask-scrollblocker': this.blockScroll,
198
- 'p-sidebar-visible': this.maskVisible,
216
+ 'p-sidebar-visible': this.containerVisible,
199
217
  'p-sidebar-full': this.fullScreen
200
218
  }
201
219
  ];
@@ -224,71 +242,74 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
224
242
 
225
243
  return (openBlock(), createBlock(_component_Portal, null, {
226
244
  default: withCtx(() => [
227
- createElementVNode("div", {
228
- ref: "mask",
229
- style: {},
230
- class: normalizeClass($options.maskClasses),
231
- onMousedown: _cache[2] || (_cache[2] = (...args) => ($options.onMaskClick && $options.onMaskClick(...args)))
232
- }, [
233
- createVNode(Transition, {
234
- name: "p-sidebar",
235
- onAfterEnter: $options.onAfterEnter,
236
- onEnter: $options.onEnter,
237
- onLeave: $options.onLeave,
238
- onAfterLeave: $options.onAfterLeave,
239
- appear: ""
240
- }, {
241
- default: withCtx(() => [
242
- ($props.visible)
243
- ? withDirectives((openBlock(), createElementBlock("div", mergeProps({
244
- key: 0,
245
- ref: $options.containerRef,
246
- class: $options.containerClass,
247
- role: "complementary",
248
- "aria-modal": $props.modal,
249
- onKeydown: _cache[1] || (_cache[1] = (...args) => ($options.onKeydown && $options.onKeydown(...args)))
250
- }, _ctx.$attrs), [
251
- createElementVNode("div", {
252
- ref: $options.headerContainerRef,
253
- class: "p-sidebar-header"
254
- }, [
255
- (_ctx.$slots.header)
256
- ? (openBlock(), createElementBlock("div", _hoisted_2, [
257
- renderSlot(_ctx.$slots, "header")
258
- ]))
259
- : createCommentVNode("", true),
260
- ($props.showCloseIcon)
261
- ? withDirectives((openBlock(), createElementBlock("button", {
262
- key: 1,
263
- ref: $options.closeButtonRef,
264
- autofocus: "",
265
- type: "button",
266
- class: "p-sidebar-close p-sidebar-icon p-link",
267
- "aria-label": $options.closeAriaLabel,
268
- onClick: _cache[0] || (_cache[0] = (...args) => ($options.hide && $options.hide(...args)))
269
- }, [
270
- createElementVNode("span", {
271
- class: normalizeClass(['p-sidebar-close-icon', $props.closeIcon])
272
- }, null, 2)
273
- ], 8, _hoisted_3)), [
274
- [_directive_ripple]
275
- ])
276
- : createCommentVNode("", true)
277
- ], 512),
278
- createElementVNode("div", {
279
- ref: $options.contentRef,
280
- class: "p-sidebar-content"
281
- }, [
282
- renderSlot(_ctx.$slots, "default")
283
- ], 512)
284
- ], 16, _hoisted_1)), [
285
- [_directive_focustrap]
286
- ])
287
- : createCommentVNode("", true)
288
- ]),
289
- _: 3
290
- }, 8, ["onAfterEnter", "onEnter", "onLeave", "onAfterLeave"])
291
- ], 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)
292
313
  ]),
293
314
  _: 3
294
315
  }))
@@ -321,7 +342,7 @@ function styleInject(css, ref) {
321
342
  }
322
343
  }
323
344
 
324
- 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";
325
346
  styleInject(css_248z);
326
347
 
327
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",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};