jsl-ui 9.20.0 → 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):
|
|
34
|
+
closeTabIndex(index: number, raiseSelectEvent?: boolean): boolean;
|
|
35
35
|
onInit(renderer: JSLRender): void;
|
|
36
36
|
SetSelectedTab(index: number): void;
|
|
37
37
|
private toNode;
|
|
@@ -8,6 +8,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
8
8
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
9
|
};
|
|
10
10
|
import "./TabsStyle.scss";
|
|
11
|
+
import { refresh } from "jsl-render";
|
|
11
12
|
import { helper } from "../../core/helper";
|
|
12
13
|
var TabsComponent = /** @class */ (function () {
|
|
13
14
|
function TabsComponent(options) {
|
|
@@ -83,7 +84,7 @@ var TabsComponent = /** @class */ (function () {
|
|
|
83
84
|
var _a;
|
|
84
85
|
if ((_a = _this.options.tabs[currIndex].enabled) !== null && _a !== void 0 ? _a : true) {
|
|
85
86
|
evt.stopPropagation();
|
|
86
|
-
_this.closeTabIndex(currIndex);
|
|
87
|
+
_this.closeTabIndex(currIndex, true);
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
}, content: "X"
|
|
@@ -108,30 +109,47 @@ var TabsComponent = /** @class */ (function () {
|
|
|
108
109
|
for (var i = 0; i < this.options.tabs.length; i++) {
|
|
109
110
|
this.options.tabs[i].enabled = true;
|
|
110
111
|
}
|
|
111
|
-
this.renderer
|
|
112
|
+
if (this.renderer != null) {
|
|
113
|
+
this.renderer.refresh();
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
refresh();
|
|
117
|
+
}
|
|
112
118
|
};
|
|
113
119
|
TabsComponent.prototype.DisableAll = function () {
|
|
114
120
|
for (var i = 0; i < this.options.tabs.length; i++) {
|
|
115
121
|
this.options.tabs[i].enabled = false;
|
|
116
122
|
}
|
|
117
|
-
this.renderer
|
|
123
|
+
if (this.renderer != null) {
|
|
124
|
+
this.renderer.refresh();
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
refresh();
|
|
128
|
+
}
|
|
118
129
|
};
|
|
119
130
|
TabsComponent.prototype.GetByID = function (id) {
|
|
120
131
|
return this.options.tabs.filter(function (f) { return f.id === id; })[0];
|
|
121
132
|
};
|
|
122
|
-
TabsComponent.prototype.closeTabIndex = function (index) {
|
|
133
|
+
TabsComponent.prototype.closeTabIndex = function (index, raiseSelectEvent) {
|
|
123
134
|
var _a, _b;
|
|
124
135
|
// console.log("closing tab index " + index);
|
|
125
136
|
if (this.options.tabs[index].onClosing) {
|
|
126
137
|
if (this.options.tabs[index].onClosing() === false) {
|
|
127
|
-
return;
|
|
138
|
+
return false;
|
|
128
139
|
}
|
|
129
140
|
}
|
|
130
|
-
|
|
131
|
-
this.
|
|
132
|
-
if (this.options.tabs.length <=
|
|
133
|
-
|
|
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);
|
|
134
146
|
}
|
|
147
|
+
if (raiseSelectEvent) {
|
|
148
|
+
if (this.options.onSelect) {
|
|
149
|
+
this.options.onSelect(newSelectedIndex);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return true;
|
|
135
153
|
};
|
|
136
154
|
// public onCreate(node: IJSLVNode) {
|
|
137
155
|
// this.ref = node.dom as HTMLDivElement;
|
|
@@ -149,7 +167,12 @@ var TabsComponent = /** @class */ (function () {
|
|
|
149
167
|
}
|
|
150
168
|
this.options.selectedIndex = index;
|
|
151
169
|
this.State.selectedIndex = index;
|
|
152
|
-
this.renderer
|
|
170
|
+
if (this.renderer != null) {
|
|
171
|
+
this.renderer.refresh();
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
refresh();
|
|
175
|
+
}
|
|
153
176
|
};
|
|
154
177
|
TabsComponent.prototype.toNode = function (content, tag) {
|
|
155
178
|
if (content == null) {
|