Merge pull request #5486 from i7slegend/fix/5412-twice-render

Fix #5412 - Twice render if attribute id not defined
pull/5523/head
Tuğçe Küçükoğlu 2024-04-03 17:45:37 +03:00 committed by GitHub
commit 52fc48780a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
30 changed files with 151 additions and 120 deletions

View File

@ -73,16 +73,16 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
activeIndex(newValue) {
this.d_activeIndex = newValue;
}
},
mounted() {
this.id = this.id || UniqueComponentId();
},
methods: {
isAccordionTab(child) {
return child.type.name === 'AccordionTab';

View File

@ -201,8 +201,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
suggestions() {
if (this.searching) {
@ -215,7 +218,6 @@ export default {
}
},
mounted() {
this.id = this.id || UniqueComponentId();
this.autoUpdateModel();
},
updated() {

View File

@ -560,8 +560,11 @@ export default {
};
},
watch: {
id: function (newValue) {
this.d_id = newValue || UniqueComponentId();
id: {
immediate: true,
handler: function (newValue) {
this.d_id = newValue || UniqueComponentId();
}
},
modelValue(newValue) {
this.updateCurrentMetaData();
@ -611,7 +614,6 @@ export default {
this.updateCurrentMetaData();
},
mounted() {
this.d_id = this.d_id || UniqueComponentId();
this.createResponsiveStyle();
this.bindMatchMediaListener();

View File

@ -110,15 +110,17 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
options() {
this.autoUpdateModel();
}
},
mounted() {
this.id = this.id || UniqueComponentId();
this.autoUpdateModel();
},
beforeUnmount() {

View File

@ -76,13 +76,13 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
}
},
mounted() {
this.id = this.id || UniqueComponentId();
},
methods: {
onWrapperClick() {
this.$refs.input.focus();

View File

@ -64,8 +64,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
activeItemPath(newPath) {
if (ObjectUtils.isNotEmpty(newPath)) {
@ -78,8 +81,6 @@ export default {
}
},
mounted() {
this.id = this.id || UniqueComponentId();
if (this.global) {
this.bindDocumentContextMenuListener();
}

View File

@ -286,8 +286,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
}
},
overlay: null,
@ -305,8 +308,6 @@ export default {
}
},
mounted() {
this.id = this.id || UniqueComponentId();
if (this.filters && this.filters[this.field]) {
let fieldFilters = this.filters[this.field];

View File

@ -88,8 +88,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
}
},
documentKeydownListener: null,
@ -124,8 +127,6 @@ export default {
this.mask = null;
},
mounted() {
this.id = this.id || UniqueComponentId();
if (this.breakpoints) {
this.createStyle();
}

View File

@ -106,13 +106,13 @@ export default {
};
},
watch: {
menuId(newValue) {
this.id = newValue || UniqueComponentId();
menuId: {
immediate: true,
handler(newValue) {
this.id = newValue || UniqueComponentId();
}
}
},
mounted() {
this.id = this.id || UniqueComponentId();
},
methods: {
getItemId(index) {
return `${this.id}_${index}`;

View File

@ -218,8 +218,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
modelValue() {
this.isModelValueChanged = true;
@ -229,7 +232,6 @@ export default {
}
},
mounted() {
this.id = this.id || UniqueComponentId();
this.autoUpdateModel();
this.bindLabelClickListener();
},

View File

@ -54,16 +54,16 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
collapsed(newValue) {
this.d_collapsed = newValue;
}
},
mounted() {
this.id = this.id || UniqueComponentId();
},
methods: {
toggle(event) {
this.d_collapsed = !this.d_collapsed;

View File

@ -76,15 +76,18 @@ export default {
emits: ['activeitem-change', 'mask-hide'],
data() {
return {
id: this.$attrs.id || UniqueComponentId(),
id: this.$attrs.id,
activeIndex: this.$attrs.activeIndex,
numVisible: this.$attrs.numVisible,
slideShowActive: false
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
'$attrs.value': function (newVal) {
if (newVal && newVal.length < this.numVisible) {
@ -101,9 +104,6 @@ export default {
newVal ? this.startSlideShow() : this.stopSlideShow();
}
},
mounted() {
this.id = this.id || UniqueComponentId();
},
updated() {
this.$emit('activeitem-change', this.activeIndex);
},

View File

@ -149,15 +149,17 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
options() {
this.autoUpdateModel();
}
},
mounted() {
this.id = this.id || UniqueComponentId();
this.autoUpdateModel();
},
methods: {

View File

@ -86,8 +86,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
activeItem(newItem) {
if (ObjectUtils.isNotEmpty(newItem)) {
@ -100,7 +103,6 @@ export default {
}
},
mounted() {
this.id = this.id || UniqueComponentId();
this.bindMatchMediaListener();
},
beforeUnmount() {

View File

@ -72,8 +72,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
}
},
target: null,
@ -83,8 +86,6 @@ export default {
container: null,
list: null,
mounted() {
this.id = this.id || UniqueComponentId();
if (!this.popup) {
this.bindResizeListener();
this.bindOutsideClickListener();

View File

@ -79,8 +79,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
activeItemPath(newPath) {
if (ObjectUtils.isNotEmpty(newPath)) {
@ -96,7 +99,6 @@ export default {
container: null,
menubar: null,
mounted() {
this.id = this.id || UniqueComponentId();
this.bindMatchMediaListener();
},
beforeUnmount() {

View File

@ -238,15 +238,17 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
options() {
this.autoUpdateModel();
}
},
mounted() {
this.id = this.id || UniqueComponentId();
this.autoUpdateModel();
},
beforeUnmount() {

View File

@ -105,8 +105,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
}
},
beforeUnmount() {
@ -119,8 +122,6 @@ export default {
}
},
mounted() {
this.id = this.id || UniqueComponentId();
if (this.responsive) {
this.createStyle();
}

View File

@ -58,16 +58,16 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
collapsed(newValue) {
this.d_collapsed = newValue;
}
},
mounted() {
this.id = this.id || UniqueComponentId();
},
methods: {
toggle(event) {
this.d_collapsed = !this.d_collapsed;

View File

@ -73,13 +73,13 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
}
},
mounted() {
this.id = this.id || UniqueComponentId();
},
methods: {
getItemProp(item, name) {
return item ? ObjectUtils.getItemValue(item[name]) : undefined;

View File

@ -77,8 +77,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
}
},
mediumCheckRegExp: null,
@ -87,7 +90,6 @@ export default {
scrollHandler: null,
overlay: null,
mounted() {
this.id = this.id || UniqueComponentId();
this.infoText = this.promptText;
this.mediumCheckRegExp = new RegExp(this.mediumRegex);
this.strongCheckRegExp = new RegExp(this.strongRegex);

View File

@ -221,8 +221,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
selection(newValue) {
this.d_selection = newValue;
@ -244,8 +247,6 @@ export default {
this.destroyMedia();
},
mounted() {
this.id = this.id || UniqueComponentId();
if (this.responsive) {
this.createStyle();
this.initMedia();

View File

@ -68,13 +68,13 @@ export default {
};
},
watch: {
'$attrs.name': function (newValue) {
this.name = newValue || UniqueComponentId();
'$attrs.name': {
immediate: true,
handler: function (newValue) {
this.name = newValue || UniqueComponentId();
}
}
},
mounted() {
this.name = this.name || UniqueComponentId();
},
methods: {
getPTOptions(key, value) {
return this.ptm(key, {

View File

@ -69,13 +69,14 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
}
},
mounted() {
this.id = this.id || UniqueComponentId();
if (this.$el.offsetParent) {
this.initialize();
}

View File

@ -78,16 +78,17 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
visible(newValue) {
this.d_visible = newValue;
}
},
mounted() {
this.id = this.id || UniqueComponentId();
if (this.type !== 'linear') {
const button = DomHandler.findSingle(this.container, '[data-pc-name="button"]');
const firstItem = DomHandler.findSingle(this.list, '[data-pc-section="menuitem"]');

View File

@ -78,13 +78,14 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
}
},
mounted() {
this.id = this.id || UniqueComponentId();
this.$watch('$refs.menu.visible', (newValue) => {
this.isExpanded = newValue;
});

View File

@ -154,16 +154,16 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
activeStep(newValue) {
this.d_activeStep = newValue;
}
},
mounted() {
this.id = this.id || UniqueComponentId();
},
methods: {
isStep(child) {
return child.type.name === 'StepperPanel';

View File

@ -113,8 +113,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
activeIndex(newValue) {
this.d_activeIndex = newValue;
@ -123,7 +126,6 @@ export default {
}
},
mounted() {
this.id = this.id || UniqueComponentId();
this.updateInkBar();
this.scrollable && this.updateButtonState();
},

View File

@ -71,8 +71,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
activeItemPath(newPath) {
if (!this.popup) {
@ -86,9 +89,6 @@ export default {
}
}
},
mounted() {
this.id = this.id || UniqueComponentId();
},
beforeUnmount() {
this.unbindOutsideClickListener();
this.unbindResizeListener();

View File

@ -128,8 +128,11 @@ export default {
};
},
watch: {
'$attrs.id': function (newValue) {
this.id = newValue || UniqueComponentId();
'$attrs.id': {
immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
},
modelValue: {
handler: function () {
@ -166,7 +169,6 @@ export default {
}
},
mounted() {
this.id = this.id || UniqueComponentId();
this.updateTreeState();
},
methods: {