Skip to content

Commit

Permalink
Fixed #5844 - Message props default value changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Jun 6, 2024
1 parent 9f197f0 commit 8d2caf1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 23 deletions.
8 changes: 2 additions & 6 deletions components/lib/message/BaseMessage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@ export default {
},
closable: {
type: Boolean,
default: true
},
sticky: {
type: Boolean,
default: true
default: false
},
life: {
type: Number,
default: 3000
default: null
},
icon: {
type: String,
Expand Down
5 changes: 3 additions & 2 deletions components/lib/message/Message.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,18 @@ export interface MessageProps {
severity?: HintedString<'success' | 'info' | 'warn' | 'error' | 'secondary' | 'contrast'> | undefined;
/**
* Whether the message can be closed manually using the close icon.
* @defaultValue true
* @defaultValue false
*/
closable?: boolean | undefined;
/**
* @deprecated since 4.0.
* When enabled, message is not removed automatically.
* @defaultValue true
*/
sticky?: boolean | undefined;
/**
* Delay in milliseconds to close the message automatically.
* @defaultValue 3000
* @defaultValue null
*/
life?: number | undefined;
/**
Expand Down
20 changes: 5 additions & 15 deletions components/lib/message/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,18 @@ export default {
visible: true
};
},
watch: {
sticky(newValue) {
if (!newValue) {
this.closeAfterDelay();
}
}
},
mounted() {
if (!this.sticky) {
this.closeAfterDelay();
if (this.life) {
setTimeout(() => {
this.visible = false;
this.$emit('life-end');
}, this.life);
}
},
methods: {
close(event) {
this.visible = false;
this.$emit('close', event);
},
closeAfterDelay() {
setTimeout(() => {
this.visible = false;
this.$emit('life-end');
}, this.life);
}
},
computed: {
Expand Down

0 comments on commit 8d2caf1

Please sign in to comment.