Fixed #5046 - DataTable: Hydration attribute mismatch with sortable columns

This commit is contained in:
tugcekucukoglu 2024-01-23 12:33:54 +03:00
parent 088d3409de
commit 19cd180575
28 changed files with 42 additions and 55 deletions

View file

@ -1,11 +1,16 @@
<script>
import BaseComponent from 'primevue/basecomponent';
import BaseIconStyle from 'primevue/baseicon/style';
import { ObjectUtils } from 'primevue/utils';
import { ObjectUtils, UniqueComponentId } from 'primevue/utils';
export default {
name: 'BaseIcon',
extends: BaseComponent,
data() {
return {
id: this.$attrs.id
};
},
props: {
label: {
type: String,
@ -17,6 +22,14 @@ export default {
}
},
style: BaseIconStyle,
mounted() {
this.id = this.id || UniqueComponentId();
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
methods: {
pti() {
const isLabelEmpty = ObjectUtils.isEmpty(this.label);
@ -30,6 +43,7 @@ export default {
}
]
}),
id: this.id,
role: !isLabelEmpty ? 'img' : undefined,
'aria-label': !isLabelEmpty ? this.label : undefined,
'aria-hidden': isLabelEmpty