@alauda/ui 6.0.4-beta.5 → 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.
@@ -8023,6 +8023,7 @@
8023
8023
  { type: TabContextService }
8024
8024
  ]; };
8025
8025
  TabComponent.propDecorators = {
8026
+ name: [{ type: i0.Input }],
8026
8027
  textLabel: [{ type: i0.Input, args: ['label',] }],
8027
8028
  closeable: [{ type: i0.Input }],
8028
8029
  disabled: [{ type: i0.Input }],
@@ -8048,15 +8049,17 @@
8048
8049
  this._tabsSubscription = rxjs.Subscription.EMPTY;
8049
8050
  /** Subscription to changes in the tab labels. */
8050
8051
  this._tabLabelSubscription = rxjs.Subscription.EMPTY;
8052
+ this._selectedIndex = null;
8053
+ this._tab = null;
8051
8054
  this._type = TabType.Line;
8052
8055
  this._size = TabSize.Medium;
8053
8056
  /** Emits whenever the type changes */
8054
8057
  this._typeChange = new rxjs.Subject();
8055
8058
  /** Emits whenever the size changes */
8056
8059
  this._sizeChange = new rxjs.Subject();
8057
- this._selectedIndex = null;
8058
8060
  /** Output to enable support for two-way binding on `[(selectedIndex)]` */
8059
8061
  this.selectedIndexChange = new i0.EventEmitter();
8062
+ this.tabChange = new i0.EventEmitter();
8060
8063
  /** Event emitted when the tab selection has changed. */
8061
8064
  this.selectedTabChange = new i0.EventEmitter(true);
8062
8065
  /** Event emitted when focus has changed within a tab group. */
@@ -8075,6 +8078,19 @@
8075
8078
  enumerable: false,
8076
8079
  configurable: true
8077
8080
  });
8081
+ Object.defineProperty(TabGroupComponent.prototype, "tab", {
8082
+ get: function () {
8083
+ return this._tab;
8084
+ },
8085
+ set: function (value) {
8086
+ this._tab = value;
8087
+ if (this._tabs) {
8088
+ this.selectedIndex = this._findIndexByTab(value);
8089
+ }
8090
+ },
8091
+ enumerable: false,
8092
+ configurable: true
8093
+ });
8078
8094
  Object.defineProperty(TabGroupComponent.prototype, "type", {
8079
8095
  get: function () {
8080
8096
  return this._type;
@@ -8143,7 +8159,9 @@
8143
8159
  var _this = this;
8144
8160
  // Don't clamp the `indexToSelect` immediately in the setter because it can happen that
8145
8161
  // the amount of tabs changes before the actual change detection runs.
8146
- 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));
8147
8165
  // If there is a change in selected index, emit a change event. Should not trigger if
8148
8166
  // the selected index has not yet been initialized.
8149
8167
  if (this._selectedIndex !== indexToSelect && this._selectedIndex != null) {
@@ -8152,7 +8170,10 @@
8152
8170
  this.selectedTabChange.emit(tabChangeEvent);
8153
8171
  // Emitting this value after change detection has run
8154
8172
  // since the checked content may contain this variable'
8155
- Promise.resolve().then(function () { return _this.selectedIndexChange.emit(indexToSelect); });
8173
+ Promise.resolve().then(function () {
8174
+ _this.selectedIndexChange.emit(indexToSelect);
8175
+ _this.tabChange.emit(_this._tabs.get(indexToSelect).name);
8176
+ });
8156
8177
  }
8157
8178
  // Setup the position for each tab and optionally setup an origin on the next selected tab.
8158
8179
  this._tabs.forEach(function (tab, index) {
@@ -8255,6 +8276,9 @@
8255
8276
  // (since Math.max(NaN, 0) === NaN).
8256
8277
  return Math.min(this._tabs.length - 1, Math.max(index || 0, 0));
8257
8278
  };
8279
+ TabGroupComponent.prototype._findIndexByTab = function (name) {
8280
+ return this._tabs.toArray().findIndex(function (tab) { return tab.name === name; }) || 0;
8281
+ };
8258
8282
  TabGroupComponent.prototype._createChangeEvent = function (index) {
8259
8283
  var _a;
8260
8284
  var event = new TabChangeEvent();
@@ -8309,11 +8333,13 @@
8309
8333
  _tabHeader: [{ type: i0.ViewChild, args: [TabHeaderComponent, { static: false },] }],
8310
8334
  _tabTitle: [{ type: i0.ContentChild, args: [TabTitleDirective, { static: false },] }],
8311
8335
  selectedIndex: [{ type: i0.Input }],
8336
+ tab: [{ type: i0.Input }],
8312
8337
  type: [{ type: i0.Input }],
8313
8338
  title: [{ type: i0.Input }],
8314
8339
  size: [{ type: i0.Input }],
8315
8340
  lazy: [{ type: i0.Input }],
8316
8341
  selectedIndexChange: [{ type: i0.Output }],
8342
+ tabChange: [{ type: i0.Output }],
8317
8343
  selectedTabChange: [{ type: i0.Output }],
8318
8344
  focusChange: [{ type: i0.Output }]
8319
8345
  };