2023-05-29 20:37:34 +00:00
|
|
|
<script>
|
|
|
|
import BaseComponent from 'primevue/basecomponent';
|
|
|
|
import { useStyle } from 'primevue/usestyle';
|
|
|
|
|
|
|
|
const styles = `
|
|
|
|
.p-sidebar-mask {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
display: none;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
pointer-events: none;
|
|
|
|
background-color: transparent;
|
|
|
|
transition-property: background-color;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-mask.p-component-overlay {
|
|
|
|
pointer-events: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-visible {
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
pointer-events: auto;
|
|
|
|
transform: translate3d(0px, 0px, 0px);
|
|
|
|
position: relative;
|
|
|
|
transition: transform 0.3s;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-content {
|
|
|
|
overflow-y: auto;
|
|
|
|
flex-grow: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-header {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: flex-end;
|
|
|
|
flex-shrink: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-icon {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
overflow: hidden;
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-full .p-sidebar {
|
|
|
|
transition: none;
|
|
|
|
transform: none;
|
|
|
|
width: 100vw !important;
|
|
|
|
height: 100vh !important;
|
|
|
|
max-height: 100%;
|
|
|
|
top: 0px !important;
|
|
|
|
left: 0px !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Animation */
|
|
|
|
/* Center */
|
|
|
|
.p-sidebar-left .p-sidebar-enter-from,
|
|
|
|
.p-sidebar-left .p-sidebar-leave-to {
|
|
|
|
transform: translateX(-100%);
|
|
|
|
}
|
|
|
|
.p-sidebar-right .p-sidebar-enter-from,
|
|
|
|
.p-sidebar-right .p-sidebar-leave-to {
|
|
|
|
transform: translateX(100%);
|
|
|
|
}
|
|
|
|
.p-sidebar-top .p-sidebar-enter-from,
|
|
|
|
.p-sidebar-top .p-sidebar-leave-to {
|
|
|
|
transform: translateY(-100%);
|
|
|
|
}
|
|
|
|
.p-sidebar-bottom .p-sidebar-enter-from,
|
|
|
|
.p-sidebar-bottom .p-sidebar-leave-to {
|
|
|
|
transform: translateY(100%);
|
|
|
|
}
|
|
|
|
.p-sidebar-full .p-sidebar-enter-from,
|
|
|
|
.p-sidebar-full .p-sidebar-leave-to {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
.p-sidebar-full .p-sidebar-enter-active,
|
|
|
|
.p-sidebar-full .p-sidebar-leave-active {
|
|
|
|
transition: opacity 400ms cubic-bezier(0.25, 0.8, 0.25, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Position */
|
|
|
|
.p-sidebar-left {
|
|
|
|
justify-content: flex-start;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-right {
|
|
|
|
justify-content: flex-end;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-top {
|
|
|
|
align-items: flex-start;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-bottom {
|
|
|
|
align-items: flex-end;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Size */
|
|
|
|
.p-sidebar-left .p-sidebar {
|
|
|
|
width: 20rem;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-right .p-sidebar {
|
|
|
|
width: 20rem;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-top .p-sidebar {
|
|
|
|
height: 10rem;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-bottom .p-sidebar {
|
|
|
|
height: 10rem;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-left .p-sidebar-sm,
|
|
|
|
.p-sidebar-right .p-sidebar-sm {
|
|
|
|
width: 20rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-left .p-sidebar-md,
|
|
|
|
.p-sidebar-right .p-sidebar-md {
|
|
|
|
width: 40rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-left .p-sidebar-lg,
|
|
|
|
.p-sidebar-right .p-sidebar-lg {
|
|
|
|
width: 60rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-top .p-sidebar-sm,
|
|
|
|
.p-sidebar-bottom .p-sidebar-sm {
|
|
|
|
height: 10rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-top .p-sidebar-md,
|
|
|
|
.p-sidebar-bottom .p-sidebar-md {
|
|
|
|
height: 20rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-top .p-sidebar-lg,
|
|
|
|
.p-sidebar-bottom .p-sidebar-lg {
|
|
|
|
height: 30rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-sidebar-left .p-sidebar-content,
|
|
|
|
.p-sidebar-right .p-sidebar-content,
|
|
|
|
.p-sidebar-top .p-sidebar-content,
|
|
|
|
.p-sidebar-bottom .p-sidebar-content {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
@media screen and (max-width: 64em) {
|
|
|
|
.p-sidebar-left .p-sidebar-lg,
|
|
|
|
.p-sidebar-left .p-sidebar-md,
|
|
|
|
.p-sidebar-right .p-sidebar-lg,
|
|
|
|
.p-sidebar-right .p-sidebar-md {
|
|
|
|
width: 20rem;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const classes = {
|
|
|
|
mask: ({ instance, props }) => [
|
|
|
|
'p-sidebar-mask',
|
|
|
|
instance.getPositionClass(),
|
|
|
|
{
|
|
|
|
'p-component-overlay p-component-overlay-enter': props.modal,
|
|
|
|
'p-sidebar-mask-scrollblocker': props.blockScroll,
|
|
|
|
'p-sidebar-visible': instance.containerVisible,
|
|
|
|
'p-sidebar-full': instance.fullScreen
|
|
|
|
}
|
|
|
|
],
|
|
|
|
root: ({ instance }) => [
|
|
|
|
'p-sidebar p-component',
|
|
|
|
{
|
|
|
|
'p-input-filled': instance.$primevue.config.inputStyle === 'filled',
|
|
|
|
'p-ripple-disabled': instance.$primevue.config.ripple === false,
|
|
|
|
'p-sidebar-full': instance.fullScreen
|
|
|
|
}
|
|
|
|
],
|
|
|
|
header: 'p-sidebar-header',
|
|
|
|
headerContent: 'p-sidebar-header-content',
|
|
|
|
closeButton: 'p-sidebar-close p-sidebar-icon p-link',
|
2023-06-09 09:25:46 +00:00
|
|
|
closeIcon: 'p-sidebar-close-icon',
|
2023-05-29 20:37:34 +00:00
|
|
|
content: 'p-sidebar-content'
|
|
|
|
};
|
|
|
|
|
|
|
|
const { load: loadStyle } = useStyle(styles, { id: 'primevue_sidebar_style', manual: true });
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'BaseSidebar',
|
|
|
|
extends: BaseComponent,
|
|
|
|
props: {
|
|
|
|
visible: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
position: {
|
|
|
|
type: String,
|
|
|
|
default: 'left'
|
|
|
|
},
|
|
|
|
baseZIndex: {
|
|
|
|
type: Number,
|
|
|
|
default: 0
|
|
|
|
},
|
|
|
|
autoZIndex: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
dismissable: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
showCloseIcon: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
closeIcon: {
|
|
|
|
type: String,
|
|
|
|
default: undefined
|
|
|
|
},
|
|
|
|
modal: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
blockScroll: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
css: {
|
2023-05-30 12:28:04 +00:00
|
|
|
classes,
|
|
|
|
loadStyle
|
2023-05-29 20:37:34 +00:00
|
|
|
},
|
2023-05-30 12:28:04 +00:00
|
|
|
provide() {
|
|
|
|
return {
|
|
|
|
$parentInstance: this
|
|
|
|
};
|
2023-05-29 20:37:34 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|