@hpcc-js/layout 3.5.1 → 3.5.4

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.
package/src/Border2.ts CHANGED
@@ -1,391 +1,391 @@
1
- import { BBox, HTMLWidget, Platform, Widget } from "@hpcc-js/common";
2
-
3
- import "../src/Border2.css";
4
-
5
- export type OverflowT = "hidden" | "scroll" | "visible" | "auto";
6
- export type ChartPanelSectionT = "top" | "right" | "bottom" | "left" | "center";
7
- export class WidgetDiv {
8
- private _div;
9
- private _overlay: boolean = false;
10
- private _overflowX: OverflowT = "visible";
11
- private _overflowY: OverflowT = "visible";
12
- private _widget: Widget;
13
-
14
- constructor(div) {
15
- this._div = div;
16
- }
17
-
18
- overlay(): boolean;
19
- overlay(_: boolean): this;
20
- overlay(_?: boolean): boolean | this {
21
- if (!arguments.length) return this._overlay;
22
- this._overlay = _;
23
- return this;
24
- }
25
-
26
- overflowX(): OverflowT;
27
- overflowX(_: OverflowT): this;
28
- overflowX(_?: OverflowT): OverflowT | this {
29
- if (!arguments.length) return this._overflowX;
30
- this._overflowX = _;
31
- this._div.style("overflow-x", _);
32
- return this;
33
- }
34
- overflowY(): OverflowT;
35
- overflowY(_: OverflowT): this;
36
- overflowY(_?: OverflowT): OverflowT | this {
37
- if (!arguments.length) return this._overflowY;
38
- this._overflowY = _;
39
- this._div.style("overflow-y", _);
40
- return this;
41
- }
42
-
43
- element() {
44
- return this._div;
45
- }
46
-
47
- node(): SVGElement | HTMLElement {
48
- return this._div.node();
49
- }
50
-
51
- widget(): Widget;
52
- widget(_: Widget): this;
53
- widget(_?: Widget): Widget | this {
54
- if (!arguments.length) return this._widget;
55
- if (this._widget !== _) {
56
- if (this._widget) {
57
- this._widget.target(null);
58
- }
59
- this._widget = _;
60
- if (this._widget) {
61
- this._widget.target(this._div.node());
62
- }
63
- }
64
- return this;
65
- }
66
-
67
- resize(size: { width: number, height: number }) {
68
- if (this._widget) {
69
- this._div
70
- .style("width", `${size.width}px`)
71
- .style("height", `${size.height}px`)
72
- ;
73
- this._widget.resize(size);
74
- }
75
- return this;
76
- }
77
-
78
- async render(getBBox?, availableHeight?: number, availableWidth?: number): Promise<BBox | undefined> {
79
- let overflowX = this.overflowX();
80
- if(!this.overlay() && overflowX === "visible") {
81
- overflowX = null;
82
- }
83
- let overflowY = this.overflowY();
84
- if(!this.overlay() && overflowY === "visible") {
85
- overflowY = null;
86
- }
87
- this._div
88
- .style("height", this.overlay() ? "0px" : null)
89
- .style("overflow-x", overflowX)
90
- .style("overflow-y", overflowY)
91
- ;
92
- if (this._widget) {
93
- return this._widget.renderPromise().then(w => {
94
- if (getBBox && this._widget.visible()) {
95
- const retVal = this._widget.getBBox();
96
- retVal.width += 8;
97
- if (availableHeight !== undefined && retVal.height > availableHeight) {
98
- retVal.width += Platform.getScrollbarWidth();
99
- }
100
- if (availableWidth !== undefined && retVal.width > availableWidth) {
101
- retVal.height += Platform.getScrollbarWidth();
102
- }
103
- if (this.overlay()) {
104
- retVal.height = 0;
105
- } else {
106
- retVal.height += 4;
107
- }
108
- return retVal;
109
- }
110
- return getBBox ? { x: 0, y: 0, width: 0, height: 0 } : undefined;
111
- });
112
- } else {
113
- return Promise.resolve(getBBox ? { x: 0, y: 0, width: 0, height: 0 } : undefined);
114
- }
115
- }
116
- }
117
-
118
- export class Border2 extends HTMLWidget {
119
-
120
- protected _bodyElement;
121
-
122
- protected _topWA: WidgetDiv;
123
- protected _leftWA: WidgetDiv;
124
- protected _centerWA: WidgetDiv;
125
- protected _rightWA: WidgetDiv;
126
- protected _bottomWA: WidgetDiv;
127
- protected _topPrevOverflow: OverflowT;
128
- protected _leftPrevOverflow: OverflowT;
129
- protected _rightPrevOverflow: OverflowT;
130
- protected _bottomPrevOverflow: OverflowT;
131
-
132
- constructor() {
133
- super();
134
- this._tag = "div";
135
- }
136
-
137
- enter(domNode, element) {
138
- super.enter(domNode, element);
139
-
140
- const topElement = element.append("header");
141
-
142
- this._bodyElement = element.append("div").attr("class", "body");
143
- const centerElement = this._bodyElement.append("div").attr("class", "center");
144
- const leftElement = this._bodyElement.append("div").attr("class", "lhs");
145
- const rightElement = this._bodyElement.append("div").attr("class", "rhs");
146
-
147
- const bottomElement = element.append("div").attr("class", "footer");
148
-
149
- this._topWA = new WidgetDiv(topElement);
150
- this._centerWA = new WidgetDiv(centerElement);
151
- this._leftWA = new WidgetDiv(leftElement);
152
- this._rightWA = new WidgetDiv(rightElement);
153
- this._bottomWA = new WidgetDiv(bottomElement);
154
- }
155
-
156
- update(domNode, element) {
157
- super.update(domNode, element);
158
- this._topWA.element().style("display", this.showTop() ? null : "none");
159
- this._rightWA.element().style("display", this.showRight() ? null : "none");
160
- this._bottomWA.element().style("display", this.showBottom() ? null : "none");
161
- this._leftWA.element().style("display", this.showLeft() ? null : "none");
162
- if(this.topOverflowX() !== this._topWA.overflowX()) {
163
- this._topWA.overflowX(this.topOverflowX());
164
- }
165
- if(this.rightOverflowX() !== this._rightWA.overflowX()) {
166
- this._rightWA.overflowX(this.rightOverflowX());
167
- }
168
- if(this.bottomOverflowX() !== this._bottomWA.overflowX()) {
169
- this._bottomWA.overflowX(this.bottomOverflowX());
170
- }
171
- if(this.leftOverflowX() !== this._leftWA.overflowX()) {
172
- this._leftWA.overflowX(this.leftOverflowX());
173
- }
174
- if(this.topOverflowY() !== this._topWA.overflowY()) {
175
- this._topWA.overflowY(this.topOverflowY());
176
- }
177
- if(this.rightOverflowY() !== this._rightWA.overflowY()) {
178
- this._rightWA.overflowY(this.rightOverflowY());
179
- }
180
- if(this.bottomOverflowY() !== this._bottomWA.overflowY()) {
181
- this._bottomWA.overflowY(this.bottomOverflowY());
182
- }
183
- if(this.leftOverflowY() !== this._leftWA.overflowY()) {
184
- this._leftWA.overflowY(this.leftOverflowY());
185
- }
186
- this.element()
187
- .style("width", `${this.width()}px`)
188
- .style("height", `${this.height()}px`)
189
- ;
190
- }
191
-
192
- private targetNull(w?: Widget) {
193
- if (w) {
194
- w.target(null);
195
- }
196
- }
197
-
198
- exit(domNode, element) {
199
- this.targetNull(this.center());
200
- this.targetNull(this.bottom());
201
- this.targetNull(this.right());
202
- this.targetNull(this.left());
203
- this.targetNull(this.top());
204
- super.exit(domNode, element);
205
- }
206
-
207
- swap(sectionA: ChartPanelSectionT, sectionB: ChartPanelSectionT): this {
208
- const a = this[sectionA]();
209
- const b = this[sectionB]();
210
- this.targetNull(a);
211
- this.targetNull(b);
212
- this[`_${sectionA}WA`].widget(null);
213
- this[`_${sectionB}WA`].widget(null);
214
- this[sectionA](b);
215
- this[sectionB](a);
216
- return this;
217
- }
218
-
219
- render(callback?: (w: Widget) => void): this {
220
- const retVal = super.render(w => {
221
- if (this._topWA) {
222
- this._topWA
223
- .widget(this.top())
224
- .overlay(this.topOverlay())
225
- .render(true).then(async topBBox => {
226
- const bottomBBox: BBox = await this._bottomWA.widget(this.bottom()).render(true, undefined, this.width()) as BBox;
227
- const availableHeight = this.height() - (topBBox.height + bottomBBox.height);
228
- const leftBBox: BBox = await this._leftWA.widget(this.left()).render(true, availableHeight) as BBox;
229
- const rightBBox: BBox = await this._rightWA.widget(this.right()).render(true, availableHeight) as BBox;
230
-
231
- if (this.bottomHeight_exists()) {
232
- bottomBBox.height = this.bottomHeight();
233
- }
234
- const bodyWidth = this.width() - (leftBBox.width + rightBBox.width);
235
- const bodyHeight = this.height() - (topBBox.height + bottomBBox.height);
236
-
237
- const centerOverflowX = this.centerOverflowX();
238
- const centerOverflowY = this.centerOverflowY();
239
-
240
- const scrollCenterX = ["auto", "scroll"].indexOf(centerOverflowX) !== -1;
241
- const scrollCenterY = ["auto", "scroll"].indexOf(centerOverflowY) !== -1;
242
- if(scrollCenterX || scrollCenterY) {
243
- this._centerWA
244
- .overflowX(this.centerOverflowX())
245
- .overflowY(this.centerOverflowY())
246
- .widget(this.center())
247
- .resize({
248
- width: bodyWidth,
249
- height: bodyHeight
250
- })
251
- .render()
252
- ;
253
- }
254
- this._bodyElement.style("height", `${bodyHeight}px`);
255
- const promises = [
256
- this._topWA
257
- .overflowX(this.topOverflowX())
258
- .overflowY(this.topOverflowY())
259
- .resize({
260
- width: this.width(),
261
- height: topBBox.height
262
- })
263
- .render(),
264
- this._leftWA
265
- .overflowX(this.leftOverflowX())
266
- .overflowY(this.leftOverflowY())
267
- .resize({
268
- width: leftBBox.width,
269
- height: bodyHeight
270
- })
271
- .render(),
272
- this._rightWA
273
- .overflowX(this.rightOverflowX())
274
- .overflowY(this.rightOverflowY())
275
- .resize({
276
- width: rightBBox.width,
277
- height: bodyHeight
278
- })
279
- .render(),
280
- this._centerWA
281
- .overflowX(this.centerOverflowX())
282
- .overflowY(this.centerOverflowY())
283
- .widget(this.center())
284
- .resize({
285
- width: bodyWidth,
286
- height: bodyHeight
287
- })
288
- .render(),
289
- this._bottomWA
290
- .overflowX(this.bottomOverflowX())
291
- .overflowY(this.bottomOverflowY())
292
- .resize({
293
- width: this.width(),
294
- height: bottomBBox.height
295
- })
296
- .render()
297
- ];
298
- Promise.all(promises).then(promises => {
299
- if (callback) {
300
- callback(this);
301
- }
302
- });
303
- })
304
- ;
305
- } else {
306
- if (callback) {
307
- callback(this);
308
- }
309
- }
310
- });
311
- return retVal;
312
- }
313
- }
314
- Border2.prototype._class += " layout_Border2";
315
-
316
- export interface Border2 {
317
- top(): Widget;
318
- top(_: Widget): this;
319
- topOverlay(): boolean;
320
- topOverlay(_: boolean): this;
321
- left(): Widget;
322
- left(_: Widget): this;
323
- center(): Widget;
324
- center(_: Widget): this;
325
- right(): Widget;
326
- right(_: Widget): this;
327
- bottom(): Widget;
328
- bottom(_: Widget): this;
329
- bottomHeight(): number;
330
- bottomHeight(_: number): this;
331
- bottomHeight_exists(): boolean;
332
- topOverflowX(): OverflowT;
333
- topOverflowX(_: OverflowT): this;
334
- rightOverflowX(): OverflowT;
335
- rightOverflowX(_: OverflowT): this;
336
- bottomOverflowX(): OverflowT;
337
- bottomOverflowX(_: OverflowT): this;
338
- leftOverflowX(): OverflowT;
339
- leftOverflowX(_: OverflowT): this;
340
- centerOverflowX(): OverflowT;
341
- centerOverflowX(_: OverflowT): this;
342
- topOverflowY(): OverflowT;
343
- topOverflowY(_: OverflowT): this;
344
- rightOverflowY(): OverflowT;
345
- rightOverflowY(_: OverflowT): this;
346
- bottomOverflowY(): OverflowT;
347
- bottomOverflowY(_: OverflowT): this;
348
- leftOverflowY(): OverflowT;
349
- leftOverflowY(_: OverflowT): this;
350
- centerOverflowY(): OverflowT;
351
- centerOverflowY(_: OverflowT): this;
352
- showTop(): boolean;
353
- showTop(_: boolean): this;
354
- showRight(): boolean;
355
- showRight(_: boolean): this;
356
- showBottom(): boolean;
357
- showBottom(_: boolean): this;
358
- showLeft(): boolean;
359
- showLeft(_: boolean): this;
360
- topOverflowX_default(_: OverflowT);
361
- rightOverflowX_default(_: OverflowT);
362
- bottomOverflowX_default(_: OverflowT);
363
- leftOverflowX_default(_: OverflowT);
364
- centerOverflowX_default(_: OverflowT);
365
- topOverflowY_default(_: OverflowT);
366
- rightOverflowY_default(_: OverflowT);
367
- bottomOverflowY_default(_: OverflowT);
368
- leftOverflowY_default(_: OverflowT);
369
- centerOverflowY_default(_: OverflowT);
370
- }
371
- Border2.prototype.publish("showTop", true, "boolean", "If true, top widget adapter will display");
372
- Border2.prototype.publish("showRight", true, "boolean", "If true, right widget adapter will display");
373
- Border2.prototype.publish("showBottom", true, "boolean", "If true, bottom widget adapter will display");
374
- Border2.prototype.publish("showLeft", true, "boolean", "If true, left widget adapter will display");
375
- Border2.prototype.publish("topOverflowX", "visible", "set", "Sets the overflow-x css style for the top widget adapter", ["hidden", "scroll", "visible", "auto"]);
376
- Border2.prototype.publish("rightOverflowX", "visible", "set", "Sets the overflow-x css style for the right widget adapter", ["hidden", "scroll", "visible", "auto"]);
377
- Border2.prototype.publish("bottomOverflowX", "visible", "set", "Sets the overflow-x css style for the bottom widget adapter", ["hidden", "scroll", "visible", "auto"]);
378
- Border2.prototype.publish("leftOverflowX", "visible", "set", "Sets the overflow-x css style for the left widget adapter", ["hidden", "scroll", "visible", "auto"]);
379
- Border2.prototype.publish("centerOverflowX", "visible", "set", "Sets the overflow-x css style for the center widget adapter", ["hidden", "scroll", "visible", "auto"]);
380
- Border2.prototype.publish("topOverflowY", "visible", "set", "Sets the overflow-y css style for the top widget adapter", ["hidden", "scroll", "visible", "auto"]);
381
- Border2.prototype.publish("rightOverflowY", "visible", "set", "Sets the overflow-y css style for the right widget adapter", ["hidden", "scroll", "visible", "auto"]);
382
- Border2.prototype.publish("bottomOverflowY", "visible", "set", "Sets the overflow-y css style for the bottom widget adapter", ["hidden", "scroll", "visible", "auto"]);
383
- Border2.prototype.publish("leftOverflowY", "visible", "set", "Sets the overflow-y css style for the left widget adapter", ["hidden", "scroll", "visible", "auto"]);
384
- Border2.prototype.publish("centerOverflowY", "visible", "set", "Sets the overflow-y css style for the center widget adapter", ["hidden", "scroll", "visible", "auto"]);
385
- Border2.prototype.publish("top", null, "widget", "Top Widget", undefined, { render: false });
386
- Border2.prototype.publish("topOverlay", false, "boolean", "Overlay Top Widget");
387
- Border2.prototype.publish("left", null, "widget", "Left Widget", undefined, { render: false });
388
- Border2.prototype.publish("center", null, "widget", "Center Widget", undefined, { render: false });
389
- Border2.prototype.publish("right", null, "widget", "Right Widget", undefined, { render: false });
390
- Border2.prototype.publish("bottom", null, "widget", "Bottom Widget", undefined, { render: false });
391
- Border2.prototype.publish("bottomHeight", null, "number", "Bottom Fixed Height", undefined, { optional: true });
1
+ import { BBox, HTMLWidget, Platform, Widget } from "@hpcc-js/common";
2
+
3
+ import "../src/Border2.css";
4
+
5
+ export type OverflowT = "hidden" | "scroll" | "visible" | "auto";
6
+ export type ChartPanelSectionT = "top" | "right" | "bottom" | "left" | "center";
7
+ export class WidgetDiv {
8
+ private _div;
9
+ private _overlay: boolean = false;
10
+ private _overflowX: OverflowT = "visible";
11
+ private _overflowY: OverflowT = "visible";
12
+ private _widget: Widget;
13
+
14
+ constructor(div) {
15
+ this._div = div;
16
+ }
17
+
18
+ overlay(): boolean;
19
+ overlay(_: boolean): this;
20
+ overlay(_?: boolean): boolean | this {
21
+ if (!arguments.length) return this._overlay;
22
+ this._overlay = _;
23
+ return this;
24
+ }
25
+
26
+ overflowX(): OverflowT;
27
+ overflowX(_: OverflowT): this;
28
+ overflowX(_?: OverflowT): OverflowT | this {
29
+ if (!arguments.length) return this._overflowX;
30
+ this._overflowX = _;
31
+ this._div.style("overflow-x", _);
32
+ return this;
33
+ }
34
+ overflowY(): OverflowT;
35
+ overflowY(_: OverflowT): this;
36
+ overflowY(_?: OverflowT): OverflowT | this {
37
+ if (!arguments.length) return this._overflowY;
38
+ this._overflowY = _;
39
+ this._div.style("overflow-y", _);
40
+ return this;
41
+ }
42
+
43
+ element() {
44
+ return this._div;
45
+ }
46
+
47
+ node(): SVGElement | HTMLElement {
48
+ return this._div.node();
49
+ }
50
+
51
+ widget(): Widget;
52
+ widget(_: Widget): this;
53
+ widget(_?: Widget): Widget | this {
54
+ if (!arguments.length) return this._widget;
55
+ if (this._widget !== _) {
56
+ if (this._widget) {
57
+ this._widget.target(null);
58
+ }
59
+ this._widget = _;
60
+ if (this._widget) {
61
+ this._widget.target(this._div.node());
62
+ }
63
+ }
64
+ return this;
65
+ }
66
+
67
+ resize(size: { width: number, height: number }) {
68
+ if (this._widget) {
69
+ this._div
70
+ .style("width", `${size.width}px`)
71
+ .style("height", `${size.height}px`)
72
+ ;
73
+ this._widget.resize(size);
74
+ }
75
+ return this;
76
+ }
77
+
78
+ async render(getBBox?, availableHeight?: number, availableWidth?: number): Promise<BBox | undefined> {
79
+ let overflowX = this.overflowX();
80
+ if(!this.overlay() && overflowX === "visible") {
81
+ overflowX = null;
82
+ }
83
+ let overflowY = this.overflowY();
84
+ if(!this.overlay() && overflowY === "visible") {
85
+ overflowY = null;
86
+ }
87
+ this._div
88
+ .style("height", this.overlay() ? "0px" : null)
89
+ .style("overflow-x", overflowX)
90
+ .style("overflow-y", overflowY)
91
+ ;
92
+ if (this._widget) {
93
+ return this._widget.renderPromise().then(w => {
94
+ if (getBBox && this._widget.visible()) {
95
+ const retVal = this._widget.getBBox();
96
+ retVal.width += 8;
97
+ if (availableHeight !== undefined && retVal.height > availableHeight) {
98
+ retVal.width += Platform.getScrollbarWidth();
99
+ }
100
+ if (availableWidth !== undefined && retVal.width > availableWidth) {
101
+ retVal.height += Platform.getScrollbarWidth();
102
+ }
103
+ if (this.overlay()) {
104
+ retVal.height = 0;
105
+ } else {
106
+ retVal.height += 4;
107
+ }
108
+ return retVal;
109
+ }
110
+ return getBBox ? { x: 0, y: 0, width: 0, height: 0 } : undefined;
111
+ });
112
+ } else {
113
+ return Promise.resolve(getBBox ? { x: 0, y: 0, width: 0, height: 0 } : undefined);
114
+ }
115
+ }
116
+ }
117
+
118
+ export class Border2 extends HTMLWidget {
119
+
120
+ protected _bodyElement;
121
+
122
+ protected _topWA: WidgetDiv;
123
+ protected _leftWA: WidgetDiv;
124
+ protected _centerWA: WidgetDiv;
125
+ protected _rightWA: WidgetDiv;
126
+ protected _bottomWA: WidgetDiv;
127
+ protected _topPrevOverflow: OverflowT;
128
+ protected _leftPrevOverflow: OverflowT;
129
+ protected _rightPrevOverflow: OverflowT;
130
+ protected _bottomPrevOverflow: OverflowT;
131
+
132
+ constructor() {
133
+ super();
134
+ this._tag = "div";
135
+ }
136
+
137
+ enter(domNode, element) {
138
+ super.enter(domNode, element);
139
+
140
+ const topElement = element.append("header");
141
+
142
+ this._bodyElement = element.append("div").attr("class", "body");
143
+ const centerElement = this._bodyElement.append("div").attr("class", "center");
144
+ const leftElement = this._bodyElement.append("div").attr("class", "lhs");
145
+ const rightElement = this._bodyElement.append("div").attr("class", "rhs");
146
+
147
+ const bottomElement = element.append("div").attr("class", "footer");
148
+
149
+ this._topWA = new WidgetDiv(topElement);
150
+ this._centerWA = new WidgetDiv(centerElement);
151
+ this._leftWA = new WidgetDiv(leftElement);
152
+ this._rightWA = new WidgetDiv(rightElement);
153
+ this._bottomWA = new WidgetDiv(bottomElement);
154
+ }
155
+
156
+ update(domNode, element) {
157
+ super.update(domNode, element);
158
+ this._topWA.element().style("display", this.showTop() ? null : "none");
159
+ this._rightWA.element().style("display", this.showRight() ? null : "none");
160
+ this._bottomWA.element().style("display", this.showBottom() ? null : "none");
161
+ this._leftWA.element().style("display", this.showLeft() ? null : "none");
162
+ if(this.topOverflowX() !== this._topWA.overflowX()) {
163
+ this._topWA.overflowX(this.topOverflowX());
164
+ }
165
+ if(this.rightOverflowX() !== this._rightWA.overflowX()) {
166
+ this._rightWA.overflowX(this.rightOverflowX());
167
+ }
168
+ if(this.bottomOverflowX() !== this._bottomWA.overflowX()) {
169
+ this._bottomWA.overflowX(this.bottomOverflowX());
170
+ }
171
+ if(this.leftOverflowX() !== this._leftWA.overflowX()) {
172
+ this._leftWA.overflowX(this.leftOverflowX());
173
+ }
174
+ if(this.topOverflowY() !== this._topWA.overflowY()) {
175
+ this._topWA.overflowY(this.topOverflowY());
176
+ }
177
+ if(this.rightOverflowY() !== this._rightWA.overflowY()) {
178
+ this._rightWA.overflowY(this.rightOverflowY());
179
+ }
180
+ if(this.bottomOverflowY() !== this._bottomWA.overflowY()) {
181
+ this._bottomWA.overflowY(this.bottomOverflowY());
182
+ }
183
+ if(this.leftOverflowY() !== this._leftWA.overflowY()) {
184
+ this._leftWA.overflowY(this.leftOverflowY());
185
+ }
186
+ this.element()
187
+ .style("width", `${this.width()}px`)
188
+ .style("height", `${this.height()}px`)
189
+ ;
190
+ }
191
+
192
+ private targetNull(w?: Widget) {
193
+ if (w) {
194
+ w.target(null);
195
+ }
196
+ }
197
+
198
+ exit(domNode, element) {
199
+ this.targetNull(this.center());
200
+ this.targetNull(this.bottom());
201
+ this.targetNull(this.right());
202
+ this.targetNull(this.left());
203
+ this.targetNull(this.top());
204
+ super.exit(domNode, element);
205
+ }
206
+
207
+ swap(sectionA: ChartPanelSectionT, sectionB: ChartPanelSectionT): this {
208
+ const a = this[sectionA]();
209
+ const b = this[sectionB]();
210
+ this.targetNull(a);
211
+ this.targetNull(b);
212
+ this[`_${sectionA}WA`].widget(null);
213
+ this[`_${sectionB}WA`].widget(null);
214
+ this[sectionA](b);
215
+ this[sectionB](a);
216
+ return this;
217
+ }
218
+
219
+ render(callback?: (w: Widget) => void): this {
220
+ const retVal = super.render(w => {
221
+ if (this._topWA) {
222
+ this._topWA
223
+ .widget(this.top())
224
+ .overlay(this.topOverlay())
225
+ .render(true).then(async topBBox => {
226
+ const bottomBBox: BBox = await this._bottomWA.widget(this.bottom()).render(true, undefined, this.width()) as BBox;
227
+ const availableHeight = this.height() - (topBBox.height + bottomBBox.height);
228
+ const leftBBox: BBox = await this._leftWA.widget(this.left()).render(true, availableHeight) as BBox;
229
+ const rightBBox: BBox = await this._rightWA.widget(this.right()).render(true, availableHeight) as BBox;
230
+
231
+ if (this.bottomHeight_exists()) {
232
+ bottomBBox.height = this.bottomHeight();
233
+ }
234
+ const bodyWidth = this.width() - (leftBBox.width + rightBBox.width);
235
+ const bodyHeight = this.height() - (topBBox.height + bottomBBox.height);
236
+
237
+ const centerOverflowX = this.centerOverflowX();
238
+ const centerOverflowY = this.centerOverflowY();
239
+
240
+ const scrollCenterX = ["auto", "scroll"].indexOf(centerOverflowX) !== -1;
241
+ const scrollCenterY = ["auto", "scroll"].indexOf(centerOverflowY) !== -1;
242
+ if(scrollCenterX || scrollCenterY) {
243
+ this._centerWA
244
+ .overflowX(this.centerOverflowX())
245
+ .overflowY(this.centerOverflowY())
246
+ .widget(this.center())
247
+ .resize({
248
+ width: bodyWidth,
249
+ height: bodyHeight
250
+ })
251
+ .render()
252
+ ;
253
+ }
254
+ this._bodyElement.style("height", `${bodyHeight}px`);
255
+ const promises = [
256
+ this._topWA
257
+ .overflowX(this.topOverflowX())
258
+ .overflowY(this.topOverflowY())
259
+ .resize({
260
+ width: this.width(),
261
+ height: topBBox.height
262
+ })
263
+ .render(),
264
+ this._leftWA
265
+ .overflowX(this.leftOverflowX())
266
+ .overflowY(this.leftOverflowY())
267
+ .resize({
268
+ width: leftBBox.width,
269
+ height: bodyHeight
270
+ })
271
+ .render(),
272
+ this._rightWA
273
+ .overflowX(this.rightOverflowX())
274
+ .overflowY(this.rightOverflowY())
275
+ .resize({
276
+ width: rightBBox.width,
277
+ height: bodyHeight
278
+ })
279
+ .render(),
280
+ this._centerWA
281
+ .overflowX(this.centerOverflowX())
282
+ .overflowY(this.centerOverflowY())
283
+ .widget(this.center())
284
+ .resize({
285
+ width: bodyWidth,
286
+ height: bodyHeight
287
+ })
288
+ .render(),
289
+ this._bottomWA
290
+ .overflowX(this.bottomOverflowX())
291
+ .overflowY(this.bottomOverflowY())
292
+ .resize({
293
+ width: this.width(),
294
+ height: bottomBBox.height
295
+ })
296
+ .render()
297
+ ];
298
+ Promise.all(promises).then(promises => {
299
+ if (callback) {
300
+ callback(this);
301
+ }
302
+ });
303
+ })
304
+ ;
305
+ } else {
306
+ if (callback) {
307
+ callback(this);
308
+ }
309
+ }
310
+ });
311
+ return retVal;
312
+ }
313
+ }
314
+ Border2.prototype._class += " layout_Border2";
315
+
316
+ export interface Border2 {
317
+ top(): Widget;
318
+ top(_: Widget): this;
319
+ topOverlay(): boolean;
320
+ topOverlay(_: boolean): this;
321
+ left(): Widget;
322
+ left(_: Widget): this;
323
+ center(): Widget;
324
+ center(_: Widget): this;
325
+ right(): Widget;
326
+ right(_: Widget): this;
327
+ bottom(): Widget;
328
+ bottom(_: Widget): this;
329
+ bottomHeight(): number;
330
+ bottomHeight(_: number): this;
331
+ bottomHeight_exists(): boolean;
332
+ topOverflowX(): OverflowT;
333
+ topOverflowX(_: OverflowT): this;
334
+ rightOverflowX(): OverflowT;
335
+ rightOverflowX(_: OverflowT): this;
336
+ bottomOverflowX(): OverflowT;
337
+ bottomOverflowX(_: OverflowT): this;
338
+ leftOverflowX(): OverflowT;
339
+ leftOverflowX(_: OverflowT): this;
340
+ centerOverflowX(): OverflowT;
341
+ centerOverflowX(_: OverflowT): this;
342
+ topOverflowY(): OverflowT;
343
+ topOverflowY(_: OverflowT): this;
344
+ rightOverflowY(): OverflowT;
345
+ rightOverflowY(_: OverflowT): this;
346
+ bottomOverflowY(): OverflowT;
347
+ bottomOverflowY(_: OverflowT): this;
348
+ leftOverflowY(): OverflowT;
349
+ leftOverflowY(_: OverflowT): this;
350
+ centerOverflowY(): OverflowT;
351
+ centerOverflowY(_: OverflowT): this;
352
+ showTop(): boolean;
353
+ showTop(_: boolean): this;
354
+ showRight(): boolean;
355
+ showRight(_: boolean): this;
356
+ showBottom(): boolean;
357
+ showBottom(_: boolean): this;
358
+ showLeft(): boolean;
359
+ showLeft(_: boolean): this;
360
+ topOverflowX_default(_: OverflowT);
361
+ rightOverflowX_default(_: OverflowT);
362
+ bottomOverflowX_default(_: OverflowT);
363
+ leftOverflowX_default(_: OverflowT);
364
+ centerOverflowX_default(_: OverflowT);
365
+ topOverflowY_default(_: OverflowT);
366
+ rightOverflowY_default(_: OverflowT);
367
+ bottomOverflowY_default(_: OverflowT);
368
+ leftOverflowY_default(_: OverflowT);
369
+ centerOverflowY_default(_: OverflowT);
370
+ }
371
+ Border2.prototype.publish("showTop", true, "boolean", "If true, top widget adapter will display");
372
+ Border2.prototype.publish("showRight", true, "boolean", "If true, right widget adapter will display");
373
+ Border2.prototype.publish("showBottom", true, "boolean", "If true, bottom widget adapter will display");
374
+ Border2.prototype.publish("showLeft", true, "boolean", "If true, left widget adapter will display");
375
+ Border2.prototype.publish("topOverflowX", "visible", "set", "Sets the overflow-x css style for the top widget adapter", ["hidden", "scroll", "visible", "auto"]);
376
+ Border2.prototype.publish("rightOverflowX", "visible", "set", "Sets the overflow-x css style for the right widget adapter", ["hidden", "scroll", "visible", "auto"]);
377
+ Border2.prototype.publish("bottomOverflowX", "visible", "set", "Sets the overflow-x css style for the bottom widget adapter", ["hidden", "scroll", "visible", "auto"]);
378
+ Border2.prototype.publish("leftOverflowX", "visible", "set", "Sets the overflow-x css style for the left widget adapter", ["hidden", "scroll", "visible", "auto"]);
379
+ Border2.prototype.publish("centerOverflowX", "visible", "set", "Sets the overflow-x css style for the center widget adapter", ["hidden", "scroll", "visible", "auto"]);
380
+ Border2.prototype.publish("topOverflowY", "visible", "set", "Sets the overflow-y css style for the top widget adapter", ["hidden", "scroll", "visible", "auto"]);
381
+ Border2.prototype.publish("rightOverflowY", "visible", "set", "Sets the overflow-y css style for the right widget adapter", ["hidden", "scroll", "visible", "auto"]);
382
+ Border2.prototype.publish("bottomOverflowY", "visible", "set", "Sets the overflow-y css style for the bottom widget adapter", ["hidden", "scroll", "visible", "auto"]);
383
+ Border2.prototype.publish("leftOverflowY", "visible", "set", "Sets the overflow-y css style for the left widget adapter", ["hidden", "scroll", "visible", "auto"]);
384
+ Border2.prototype.publish("centerOverflowY", "visible", "set", "Sets the overflow-y css style for the center widget adapter", ["hidden", "scroll", "visible", "auto"]);
385
+ Border2.prototype.publish("top", null, "widget", "Top Widget", undefined, { render: false });
386
+ Border2.prototype.publish("topOverlay", false, "boolean", "Overlay Top Widget");
387
+ Border2.prototype.publish("left", null, "widget", "Left Widget", undefined, { render: false });
388
+ Border2.prototype.publish("center", null, "widget", "Center Widget", undefined, { render: false });
389
+ Border2.prototype.publish("right", null, "widget", "Right Widget", undefined, { render: false });
390
+ Border2.prototype.publish("bottom", null, "widget", "Bottom Widget", undefined, { render: false });
391
+ Border2.prototype.publish("bottomHeight", null, "number", "Bottom Fixed Height", undefined, { optional: true });