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: { watch: {
'$attrs.id': function (newValue) { '$attrs.id': {
this.id = newValue || UniqueComponentId(); immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
}, },
activeIndex(newValue) { activeIndex(newValue) {
this.d_activeIndex = newValue; this.d_activeIndex = newValue;
} }
}, },
mounted() {
this.id = this.id || UniqueComponentId();
},
methods: { methods: {
isAccordionTab(child) { isAccordionTab(child) {
return child.type.name === 'AccordionTab'; return child.type.name === 'AccordionTab';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -88,8 +88,11 @@ export default {
}; };
}, },
watch: { watch: {
'$attrs.id': function (newValue) { '$attrs.id': {
this.id = newValue || UniqueComponentId(); immediate: true,
handler: function (newValue) {
this.id = newValue || UniqueComponentId();
}
} }
}, },
documentKeydownListener: null, documentKeydownListener: null,
@ -124,8 +127,6 @@ 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();
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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