jsl-ui 9.20.1 → 9.20.2

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.
@@ -31,7 +31,7 @@ export declare class TabsComponent implements IJSLComponent {
31
31
  EnableAll(): void;
32
32
  DisableAll(): void;
33
33
  GetByID(id: string): ITabItemOption;
34
- closeTabIndex(index: number): boolean;
34
+ closeTabIndex(index: number, raiseSelectEvent?: boolean): boolean;
35
35
  onInit(renderer: JSLRender): void;
36
36
  SetSelectedTab(index: number): void;
37
37
  private toNode;
@@ -81,17 +81,10 @@ var TabsComponent = /** @class */ (function () {
81
81
  {
82
82
  tag: "div", attr: {
83
83
  class: "close-button", click: function (evt) {
84
- var _a, _b, _c;
84
+ var _a;
85
85
  if ((_a = _this.options.tabs[currIndex].enabled) !== null && _a !== void 0 ? _a : true) {
86
86
  evt.stopPropagation();
87
- if (_this.closeTabIndex(currIndex)) {
88
- if (_this.options.tabs.length <= ((_b = _this.State.selectedIndex) !== null && _b !== void 0 ? _b : _this.options.selectedIndex)) {
89
- _this.SetSelectedTab(((_c = _this.State.selectedIndex) !== null && _c !== void 0 ? _c : _this.options.selectedIndex) - 1);
90
- }
91
- if (_this.options.onSelect) {
92
- _this.options.onSelect(currIndex);
93
- }
94
- }
87
+ _this.closeTabIndex(currIndex, true);
95
88
  }
96
89
  }
97
90
  }, content: "X"
@@ -137,7 +130,7 @@ var TabsComponent = /** @class */ (function () {
137
130
  TabsComponent.prototype.GetByID = function (id) {
138
131
  return this.options.tabs.filter(function (f) { return f.id === id; })[0];
139
132
  };
140
- TabsComponent.prototype.closeTabIndex = function (index) {
133
+ TabsComponent.prototype.closeTabIndex = function (index, raiseSelectEvent) {
141
134
  var _a, _b;
142
135
  // console.log("closing tab index " + index);
143
136
  if (this.options.tabs[index].onClosing) {
@@ -145,10 +138,16 @@ var TabsComponent = /** @class */ (function () {
145
138
  return false;
146
139
  }
147
140
  }
148
- var currIdx = 0;
149
- this.options.tabs = this.options.tabs.filter(function (x) { return currIdx++ !== index; });
150
- if (this.options.tabs.length <= ((_a = this.State.selectedIndex) !== null && _a !== void 0 ? _a : this.options.selectedIndex)) {
151
- this.SetSelectedTab(((_b = this.State.selectedIndex) !== null && _b !== void 0 ? _b : this.options.selectedIndex) - 1);
141
+ this.options.tabs = this.options.tabs.filter(function (_, currIdx) { return currIdx !== index; });
142
+ var newSelectedIndex = (_b = (_a = this.State.selectedIndex) !== null && _a !== void 0 ? _a : this.options.selectedIndex) !== null && _b !== void 0 ? _b : 0;
143
+ if (this.options.tabs.length <= newSelectedIndex) {
144
+ newSelectedIndex--;
145
+ this.SetSelectedTab(newSelectedIndex);
146
+ }
147
+ if (raiseSelectEvent) {
148
+ if (this.options.onSelect) {
149
+ this.options.onSelect(newSelectedIndex);
150
+ }
152
151
  }
153
152
  return true;
154
153
  };