diff --git a/components/lib/accordion/Accordion.vue b/components/lib/accordion/Accordion.vue index e9fb3fa53..534e9b37f 100755 --- a/components/lib/accordion/Accordion.vue +++ b/components/lib/accordion/Accordion.vue @@ -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'; diff --git a/components/lib/autocomplete/AutoComplete.vue b/components/lib/autocomplete/AutoComplete.vue index 0f79b35af..ee5b848a7 100755 --- a/components/lib/autocomplete/AutoComplete.vue +++ b/components/lib/autocomplete/AutoComplete.vue @@ -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() { diff --git a/components/lib/calendar/Calendar.vue b/components/lib/calendar/Calendar.vue index d63588b2e..82dabdba3 100755 --- a/components/lib/calendar/Calendar.vue +++ b/components/lib/calendar/Calendar.vue @@ -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(); diff --git a/components/lib/cascadeselect/CascadeSelect.vue b/components/lib/cascadeselect/CascadeSelect.vue index 07762eaf3..f154895d8 100644 --- a/components/lib/cascadeselect/CascadeSelect.vue +++ b/components/lib/cascadeselect/CascadeSelect.vue @@ -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() { diff --git a/components/lib/chips/Chips.vue b/components/lib/chips/Chips.vue index f3ab1305f..ddce4478e 100755 --- a/components/lib/chips/Chips.vue +++ b/components/lib/chips/Chips.vue @@ -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(); diff --git a/components/lib/contextmenu/ContextMenu.vue b/components/lib/contextmenu/ContextMenu.vue index b066a0a6a..ddd0c4624 100755 --- a/components/lib/contextmenu/ContextMenu.vue +++ b/components/lib/contextmenu/ContextMenu.vue @@ -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(); } diff --git a/components/lib/datatable/ColumnFilter.vue b/components/lib/datatable/ColumnFilter.vue index 3dc30d850..6f7d23b8e 100644 --- a/components/lib/datatable/ColumnFilter.vue +++ b/components/lib/datatable/ColumnFilter.vue @@ -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]; diff --git a/components/lib/dialog/Dialog.vue b/components/lib/dialog/Dialog.vue index 762db37f9..708044f70 100755 --- a/components/lib/dialog/Dialog.vue +++ b/components/lib/dialog/Dialog.vue @@ -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(); } diff --git a/components/lib/dock/DockSub.vue b/components/lib/dock/DockSub.vue index ad1732f39..2b4cb368e 100644 --- a/components/lib/dock/DockSub.vue +++ b/components/lib/dock/DockSub.vue @@ -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}`; diff --git a/components/lib/dropdown/Dropdown.vue b/components/lib/dropdown/Dropdown.vue index cb3d13e78..9a223bac1 100755 --- a/components/lib/dropdown/Dropdown.vue +++ b/components/lib/dropdown/Dropdown.vue @@ -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(); }, diff --git a/components/lib/fieldset/Fieldset.vue b/components/lib/fieldset/Fieldset.vue index 95fb7c7ec..22ecc2303 100755 --- a/components/lib/fieldset/Fieldset.vue +++ b/components/lib/fieldset/Fieldset.vue @@ -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; diff --git a/components/lib/galleria/GalleriaContent.vue b/components/lib/galleria/GalleriaContent.vue index 6ab095b66..de8e91df0 100755 --- a/components/lib/galleria/GalleriaContent.vue +++ b/components/lib/galleria/GalleriaContent.vue @@ -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); }, diff --git a/components/lib/listbox/Listbox.vue b/components/lib/listbox/Listbox.vue index 97b62dc2a..0134c3f49 100755 --- a/components/lib/listbox/Listbox.vue +++ b/components/lib/listbox/Listbox.vue @@ -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: { diff --git a/components/lib/megamenu/MegaMenu.vue b/components/lib/megamenu/MegaMenu.vue index a34d0d55c..4e9ee6879 100755 --- a/components/lib/megamenu/MegaMenu.vue +++ b/components/lib/megamenu/MegaMenu.vue @@ -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() { diff --git a/components/lib/menu/Menu.vue b/components/lib/menu/Menu.vue index 87f8b928e..ece3fa078 100644 --- a/components/lib/menu/Menu.vue +++ b/components/lib/menu/Menu.vue @@ -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(); diff --git a/components/lib/menubar/Menubar.vue b/components/lib/menubar/Menubar.vue index 92aa2e410..be2aece2d 100755 --- a/components/lib/menubar/Menubar.vue +++ b/components/lib/menubar/Menubar.vue @@ -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() { diff --git a/components/lib/multiselect/MultiSelect.vue b/components/lib/multiselect/MultiSelect.vue index 5175103c5..dffaf637a 100755 --- a/components/lib/multiselect/MultiSelect.vue +++ b/components/lib/multiselect/MultiSelect.vue @@ -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() { diff --git a/components/lib/orderlist/OrderList.vue b/components/lib/orderlist/OrderList.vue index bb45e4b60..4e649f94e 100755 --- a/components/lib/orderlist/OrderList.vue +++ b/components/lib/orderlist/OrderList.vue @@ -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(); } diff --git a/components/lib/panel/Panel.vue b/components/lib/panel/Panel.vue index 1e831fc09..91aaff1ba 100755 --- a/components/lib/panel/Panel.vue +++ b/components/lib/panel/Panel.vue @@ -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; diff --git a/components/lib/panelmenu/PanelMenu.vue b/components/lib/panelmenu/PanelMenu.vue index 950969a10..03f7573df 100644 --- a/components/lib/panelmenu/PanelMenu.vue +++ b/components/lib/panelmenu/PanelMenu.vue @@ -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; diff --git a/components/lib/password/Password.vue b/components/lib/password/Password.vue index 7645e6bdc..c0fd068dd 100755 --- a/components/lib/password/Password.vue +++ b/components/lib/password/Password.vue @@ -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); diff --git a/components/lib/picklist/PickList.vue b/components/lib/picklist/PickList.vue index 3bcd65978..85df8dee2 100755 --- a/components/lib/picklist/PickList.vue +++ b/components/lib/picklist/PickList.vue @@ -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(); diff --git a/components/lib/rating/Rating.vue b/components/lib/rating/Rating.vue index 9d53191de..485fb0bc0 100755 --- a/components/lib/rating/Rating.vue +++ b/components/lib/rating/Rating.vue @@ -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, { diff --git a/components/lib/scrollpanel/ScrollPanel.vue b/components/lib/scrollpanel/ScrollPanel.vue index 99f315991..1adef1ee6 100644 --- a/components/lib/scrollpanel/ScrollPanel.vue +++ b/components/lib/scrollpanel/ScrollPanel.vue @@ -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(); } diff --git a/components/lib/speeddial/SpeedDial.vue b/components/lib/speeddial/SpeedDial.vue index 20f82334f..79b8107a1 100644 --- a/components/lib/speeddial/SpeedDial.vue +++ b/components/lib/speeddial/SpeedDial.vue @@ -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"]'); diff --git a/components/lib/splitbutton/SplitButton.vue b/components/lib/splitbutton/SplitButton.vue index 1efd3c116..fcd0a1c4c 100755 --- a/components/lib/splitbutton/SplitButton.vue +++ b/components/lib/splitbutton/SplitButton.vue @@ -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; }); diff --git a/components/lib/stepper/Stepper.vue b/components/lib/stepper/Stepper.vue index 7ba3d49cf..532108d0f 100644 --- a/components/lib/stepper/Stepper.vue +++ b/components/lib/stepper/Stepper.vue @@ -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'; diff --git a/components/lib/tabview/TabView.vue b/components/lib/tabview/TabView.vue index 5528c38b9..39ea5b461 100755 --- a/components/lib/tabview/TabView.vue +++ b/components/lib/tabview/TabView.vue @@ -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(); }, diff --git a/components/lib/tieredmenu/TieredMenu.vue b/components/lib/tieredmenu/TieredMenu.vue index 1b4cb52d1..2ccedef02 100755 --- a/components/lib/tieredmenu/TieredMenu.vue +++ b/components/lib/tieredmenu/TieredMenu.vue @@ -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(); diff --git a/components/lib/treeselect/TreeSelect.vue b/components/lib/treeselect/TreeSelect.vue index 26f63e9ea..ffe72d09e 100644 --- a/components/lib/treeselect/TreeSelect.vue +++ b/components/lib/treeselect/TreeSelect.vue @@ -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: {