@alauda/ui 6.0.4-beta.8 → 6.0.4-beta.9

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.
@@ -8083,12 +8083,10 @@
8083
8083
  return this._tab;
8084
8084
  },
8085
8085
  set: function (value) {
8086
- this.selectedIndex = this._tabs
8087
- .toArray()
8088
- .findIndex(function (_b) {
8089
- var name = _b.name;
8090
- return name === value;
8091
- });
8086
+ this._tab = value;
8087
+ if (this._tabs) {
8088
+ this.selectedIndex = this._findIndexByTab(value);
8089
+ }
8092
8090
  },
8093
8091
  enumerable: false,
8094
8092
  configurable: true
@@ -8161,7 +8159,9 @@
8161
8159
  var _this = this;
8162
8160
  // Don't clamp the `indexToSelect` immediately in the setter because it can happen that
8163
8161
  // the amount of tabs changes before the actual change detection runs.
8164
- var indexToSelect = (this._indexToSelect = this._clampTabIndex(this._indexToSelect));
8162
+ var indexToSelect = (this._indexToSelect = this.tab
8163
+ ? this._findIndexByTab(this.tab)
8164
+ : this._clampTabIndex(this._indexToSelect));
8165
8165
  // If there is a change in selected index, emit a change event. Should not trigger if
8166
8166
  // the selected index has not yet been initialized.
8167
8167
  if (this._selectedIndex !== indexToSelect && this._selectedIndex != null) {
@@ -8276,6 +8276,9 @@
8276
8276
  // (since Math.max(NaN, 0) === NaN).
8277
8277
  return Math.min(this._tabs.length - 1, Math.max(index || 0, 0));
8278
8278
  };
8279
+ TabGroupComponent.prototype._findIndexByTab = function (name) {
8280
+ return this._tabs.toArray().findIndex(function (tab) { return tab.name === name; }) || 0;
8281
+ };
8279
8282
  TabGroupComponent.prototype._createChangeEvent = function (index) {
8280
8283
  var _a;
8281
8284
  var event = new TabChangeEvent();