2023-05-25 13:22:28 +00:00
|
|
|
<script>
|
|
|
|
import BaseComponent from 'primevue/basecomponent';
|
|
|
|
import { useStyle } from 'primevue/usestyle';
|
|
|
|
|
|
|
|
const styles = `
|
|
|
|
.p-message-wrapper {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
2023-08-18 01:35:43 +00:00
|
|
|
.p-message-icon {
|
|
|
|
flex-shrink: 0;
|
|
|
|
}
|
|
|
|
|
2023-05-25 13:22:28 +00:00
|
|
|
.p-message-close {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
2023-08-18 01:35:43 +00:00
|
|
|
flex-shrink: 0;
|
2023-05-25 13:22:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-close.p-link {
|
|
|
|
margin-left: auto;
|
|
|
|
overflow: hidden;
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-enter-from {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-enter-active {
|
|
|
|
transition: opacity 0.3s;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-message.p-message-leave-from {
|
|
|
|
max-height: 1000px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-message.p-message-leave-to {
|
|
|
|
max-height: 0;
|
|
|
|
opacity: 0;
|
|
|
|
margin: 0 !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-leave-active {
|
|
|
|
overflow: hidden;
|
|
|
|
transition: max-height 0.3s cubic-bezier(0, 1, 0, 1), opacity 0.3s, margin 0.15s;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-message-leave-active .p-message-close {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const classes = {
|
|
|
|
root: ({ props }) => 'p-message p-component p-message-' + props.severity,
|
|
|
|
wrapper: 'p-message-wrapper',
|
2023-07-06 12:13:28 +00:00
|
|
|
icon: 'p-message-icon',
|
2023-05-25 13:22:28 +00:00
|
|
|
text: 'p-message-text',
|
2023-07-19 08:21:09 +00:00
|
|
|
closeButton: 'p-message-close p-link',
|
|
|
|
closeIcon: 'p-message-close-icon'
|
2023-05-25 13:22:28 +00:00
|
|
|
};
|
|
|
|
|
2023-07-03 22:20:35 +00:00
|
|
|
const { load: loadStyle } = useStyle(styles, { name: 'message', manual: true });
|
2023-05-25 13:22:28 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'BaseMessage',
|
|
|
|
extends: BaseComponent,
|
|
|
|
props: {
|
|
|
|
severity: {
|
|
|
|
type: String,
|
|
|
|
default: 'info'
|
|
|
|
},
|
|
|
|
closable: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
sticky: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true
|
|
|
|
},
|
|
|
|
life: {
|
|
|
|
type: Number,
|
|
|
|
default: 3000
|
|
|
|
},
|
|
|
|
icon: {
|
|
|
|
type: String,
|
|
|
|
default: undefined
|
|
|
|
},
|
|
|
|
closeIcon: {
|
|
|
|
type: String,
|
|
|
|
default: undefined
|
|
|
|
},
|
|
|
|
closeButtonProps: {
|
|
|
|
type: null,
|
|
|
|
default: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
css: {
|
2023-06-02 14:28:59 +00:00
|
|
|
classes,
|
|
|
|
loadStyle
|
2023-05-25 13:22:28 +00:00
|
|
|
},
|
2023-06-02 14:28:59 +00:00
|
|
|
provide() {
|
|
|
|
return {
|
|
|
|
$parentInstance: this
|
|
|
|
};
|
2023-05-25 13:22:28 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|