@ardium-ui/ui 5.0.0-alpha.20 → 5.0.0-alpha.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14094,6 +14094,7 @@ class ArdiumTabberComponent {
|
|
|
14094
14094
|
this.focusedTabId = signal(null);
|
|
14095
14095
|
this.focusedTab = computed(() => this.tabs().find(tab => tab.tabId() === this.focusedTabId()) ?? null);
|
|
14096
14096
|
this.focusedTabIdChange = output();
|
|
14097
|
+
this._selectedTabIdToCheck = null;
|
|
14097
14098
|
this.initialTab = input(undefined);
|
|
14098
14099
|
this.focusEvent = output({ alias: 'focus' });
|
|
14099
14100
|
this.blurEvent = output({ alias: 'blur' });
|
|
@@ -14125,19 +14126,32 @@ class ArdiumTabberComponent {
|
|
|
14125
14126
|
}
|
|
14126
14127
|
ngOnChanges(changes) {
|
|
14127
14128
|
if (changes['selectedTabId']) {
|
|
14129
|
+
// make sure the tab exists
|
|
14128
14130
|
const newTabId = changes['selectedTabId'].currentValue;
|
|
14129
|
-
if (
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
return;
|
|
14134
|
-
}
|
|
14131
|
+
if (this.tabs().some(tab => !tab._isTabIdInitialized)) {
|
|
14132
|
+
this._selectedTabIdToCheck = newTabId;
|
|
14133
|
+
}
|
|
14134
|
+
else {
|
|
14135
14135
|
const oldTabId = changes['selectedTabId'].previousValue;
|
|
14136
|
+
this._validateSelectedTabId(newTabId, oldTabId);
|
|
14137
|
+
}
|
|
14138
|
+
}
|
|
14139
|
+
}
|
|
14140
|
+
_validateSelectedTabId(newTabId, oldTabId) {
|
|
14141
|
+
if (newTabId !== null) {
|
|
14142
|
+
const newTab = this.tabs().find(tab => tab._isTabIdInitialized && tab.tabId() === newTabId);
|
|
14143
|
+
if (!newTab) {
|
|
14144
|
+
// tabs are initialized but the tab does not exist, show error
|
|
14145
|
+
console.error(`ARD-NF6000: Trying to select a tab with id '${newTabId}' that does not exist.`);
|
|
14146
|
+
return;
|
|
14147
|
+
}
|
|
14148
|
+
// tab exists, select it and unselect the old one
|
|
14149
|
+
if (oldTabId !== null) {
|
|
14136
14150
|
const oldTab = this.tabs().find(tab => tab._isTabIdInitialized && tab.tabId() === oldTabId);
|
|
14137
14151
|
if (oldTab)
|
|
14138
14152
|
this._unselectSpecificTab(oldTab);
|
|
14139
|
-
this._selectNewTab(newTab);
|
|
14140
14153
|
}
|
|
14154
|
+
this._selectNewTab(newTab);
|
|
14141
14155
|
}
|
|
14142
14156
|
}
|
|
14143
14157
|
ngAfterContentInit() {
|
|
@@ -14165,6 +14179,11 @@ class ArdiumTabberComponent {
|
|
|
14165
14179
|
this.selectTab(cmp);
|
|
14166
14180
|
});
|
|
14167
14181
|
}
|
|
14182
|
+
// if there was a pending selectedTabId to check, do it now
|
|
14183
|
+
if (this._selectedTabIdToCheck !== null) {
|
|
14184
|
+
this._validateSelectedTabId(this._selectedTabIdToCheck, null);
|
|
14185
|
+
this._selectedTabIdToCheck = null;
|
|
14186
|
+
}
|
|
14168
14187
|
// if no tab is selected, select the initial tab or the first tab
|
|
14169
14188
|
if (!selectedCmp) {
|
|
14170
14189
|
const initiallySelectedTab = this.tabs().find(tab => tab.tabId() === this.initialTab());
|