Refactor #4953 - For Dialog

pull/5206/head
mertsincan 2024-02-02 15:47:03 +00:00
parent d4e825beeb
commit db53a48d12
1 changed files with 9 additions and 5 deletions

View File

@ -80,12 +80,18 @@ export default {
}, },
data() { data() {
return { return {
id: this.$attrs.id,
containerVisible: this.visible, containerVisible: this.visible,
maximized: false, maximized: false,
focusableMax: null, focusableMax: null,
focusableClose: null focusableClose: null
}; };
}, },
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
documentKeydownListener: null, documentKeydownListener: null,
container: null, container: null,
mask: null, mask: null,
@ -118,6 +124,8 @@ export default {
this.mask = null; this.mask = null;
}, },
mounted() { mounted() {
this.id = this.id || UniqueComponentId();
if (this.breakpoints) { if (this.breakpoints) {
this.createStyle(); this.createStyle();
} }
@ -380,12 +388,8 @@ export default {
maximizeIconComponent() { maximizeIconComponent() {
return this.maximized ? (this.minimizeIcon ? 'span' : 'WindowMinimizeIcon') : this.maximizeIcon ? 'span' : 'WindowMaximizeIcon'; return this.maximized ? (this.minimizeIcon ? 'span' : 'WindowMinimizeIcon') : this.maximizeIcon ? 'span' : 'WindowMaximizeIcon';
}, },
ariaId() {
return UniqueComponentId();
},
ariaLabelledById() { ariaLabelledById() {
return this.header != null || this.$attrs['aria-labelledby'] !== null ? this.ariaId + '_header' : null; return this.header != null || this.$attrs['aria-labelledby'] !== null ? this.id + '_header' : null;
}, },
closeAriaLabel() { closeAriaLabel() {
return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : undefined; return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : undefined;