@ardium-ui/ui 5.0.0-alpha.20 → 5.0.0-alpha.21
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,20 +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
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14131
|
+
const oldTabId = changes['selectedTabId'].previousValue;
|
|
14132
|
+
const isValid = this._validateSelectedTabId(newTabId, oldTabId);
|
|
14133
|
+
if (!isValid && this.tabs().some(tab => !tab._isTabIdInitialized)) {
|
|
14134
|
+
this._selectedTabIdToCheck = newTabId;
|
|
14135
|
+
}
|
|
14136
|
+
}
|
|
14137
|
+
}
|
|
14138
|
+
_validateSelectedTabId(newTabId, oldTabId) {
|
|
14139
|
+
if (newTabId !== null) {
|
|
14140
|
+
const newTab = this.tabs().find(tab => tab._isTabIdInitialized && tab.tabId() === newTabId);
|
|
14141
|
+
if (!newTab) {
|
|
14142
|
+
// tabs are initialized but the tab does not exist, show error
|
|
14143
|
+
console.error(`ARD-NF6000: Trying to select a tab with id '${newTabId}' that does not exist.`);
|
|
14144
|
+
return false;
|
|
14145
|
+
}
|
|
14146
|
+
// tab exists, select it and unselect the old one
|
|
14147
|
+
if (oldTabId !== null) {
|
|
14136
14148
|
const oldTab = this.tabs().find(tab => tab._isTabIdInitialized && tab.tabId() === oldTabId);
|
|
14137
14149
|
if (oldTab)
|
|
14138
14150
|
this._unselectSpecificTab(oldTab);
|
|
14139
|
-
this._selectNewTab(newTab);
|
|
14140
14151
|
}
|
|
14152
|
+
this._selectNewTab(newTab);
|
|
14141
14153
|
}
|
|
14154
|
+
return true;
|
|
14142
14155
|
}
|
|
14143
14156
|
ngAfterContentInit() {
|
|
14144
14157
|
let selectedCmp = null;
|
|
@@ -14165,6 +14178,11 @@ class ArdiumTabberComponent {
|
|
|
14165
14178
|
this.selectTab(cmp);
|
|
14166
14179
|
});
|
|
14167
14180
|
}
|
|
14181
|
+
// if there was a pending selectedTabId to check, do it now
|
|
14182
|
+
if (this._selectedTabIdToCheck !== null) {
|
|
14183
|
+
this._validateSelectedTabId(this._selectedTabIdToCheck, null);
|
|
14184
|
+
this._selectedTabIdToCheck = null;
|
|
14185
|
+
}
|
|
14168
14186
|
// if no tab is selected, select the initial tab or the first tab
|
|
14169
14187
|
if (!selectedCmp) {
|
|
14170
14188
|
const initiallySelectedTab = this.tabs().find(tab => tab.tabId() === this.initialTab());
|