tsgrid-ui 2.7.1 → 2.9.0

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +173 -0
  2. package/dist/base.d.ts +148 -0
  3. package/dist/base.es6.js +11 -0
  4. package/dist/base.es6.js.map +1 -0
  5. package/dist/chunks/chunk-26XP2XU3.js +1795 -0
  6. package/dist/chunks/chunk-26XP2XU3.js.map +1 -0
  7. package/dist/chunks/chunk-3NYH6545.js +2423 -0
  8. package/dist/chunks/chunk-3NYH6545.js.map +1 -0
  9. package/dist/chunks/chunk-BIB3X2TW.js +1638 -0
  10. package/dist/chunks/chunk-BIB3X2TW.js.map +1 -0
  11. package/dist/chunks/chunk-DXZJHS4M.js +1283 -0
  12. package/dist/chunks/chunk-DXZJHS4M.js.map +1 -0
  13. package/dist/chunks/chunk-EVZMMVXO.js +1212 -0
  14. package/dist/chunks/chunk-EVZMMVXO.js.map +1 -0
  15. package/dist/chunks/chunk-GJD5NFWQ.js +2305 -0
  16. package/dist/chunks/chunk-GJD5NFWQ.js.map +1 -0
  17. package/dist/chunks/chunk-IYF3Q7GX.js +127 -0
  18. package/dist/chunks/chunk-IYF3Q7GX.js.map +1 -0
  19. package/dist/chunks/chunk-OFASTA2A.js +2980 -0
  20. package/dist/chunks/chunk-OFASTA2A.js.map +1 -0
  21. package/dist/chunks/chunk-OMLGN735.js +677 -0
  22. package/dist/chunks/chunk-OMLGN735.js.map +1 -0
  23. package/dist/chunks/chunk-WKSLGUB3.js +1127 -0
  24. package/dist/chunks/chunk-WKSLGUB3.js.map +1 -0
  25. package/dist/chunks/chunk-YBY52G2U.js +849 -0
  26. package/dist/chunks/chunk-YBY52G2U.js.map +1 -0
  27. package/dist/field.d.ts +329 -0
  28. package/dist/field.es6.js +11 -0
  29. package/dist/field.es6.js.map +1 -0
  30. package/dist/form.d.ts +162 -0
  31. package/dist/form.es6.js +14 -0
  32. package/dist/form.es6.js.map +1 -0
  33. package/dist/layout.d.ts +108 -0
  34. package/dist/layout.es6.js +13 -0
  35. package/dist/layout.es6.js.map +1 -0
  36. package/dist/locale.d.ts +30 -0
  37. package/dist/locale.es6.js +7 -0
  38. package/dist/locale.es6.js.map +1 -0
  39. package/dist/metafile-esm.json +1 -0
  40. package/dist/popup.d.ts +92 -0
  41. package/dist/popup.es6.js +18 -0
  42. package/dist/popup.es6.js.map +1 -0
  43. package/dist/query-CKGg5Ugv.d.ts +81 -0
  44. package/dist/sidebar.d.ts +138 -0
  45. package/dist/sidebar.es6.js +11 -0
  46. package/dist/sidebar.es6.js.map +1 -0
  47. package/dist/tabs.d.ts +63 -0
  48. package/dist/tabs.es6.js +11 -0
  49. package/dist/tabs.es6.js.map +1 -0
  50. package/dist/toolbar.d.ts +97 -0
  51. package/dist/toolbar.es6.js +11 -0
  52. package/dist/toolbar.es6.js.map +1 -0
  53. package/dist/tooltip.d.ts +322 -0
  54. package/dist/tooltip.es6.js +18 -0
  55. package/dist/tooltip.es6.js.map +1 -0
  56. package/dist/tsgrid-ui.css +2 -2
  57. package/dist/tsgrid-ui.d.ts +16 -2004
  58. package/dist/tsgrid-ui.es6.js +7750 -23830
  59. package/dist/tsgrid-ui.es6.js.map +1 -1
  60. package/dist/tsgrid-ui.es6.min.js +28 -28
  61. package/dist/tsgrid-ui.js +96 -17
  62. package/dist/tsgrid-ui.min.css +2 -2
  63. package/dist/tsgrid-ui.min.js +24 -24
  64. package/dist/tsutils-message-CogFtVtO.d.ts +82 -0
  65. package/dist/utils.d.ts +418 -0
  66. package/dist/utils.es6.js +14 -0
  67. package/dist/utils.es6.js.map +1 -0
  68. package/package.json +26 -5
@@ -0,0 +1,1127 @@
1
+ import {
2
+ TsTabs
3
+ } from "./chunk-OMLGN735.js";
4
+ import {
5
+ TsToolbar
6
+ } from "./chunk-EVZMMVXO.js";
7
+ import {
8
+ TsUtils
9
+ } from "./chunk-3NYH6545.js";
10
+ import {
11
+ TsBase,
12
+ TsUi,
13
+ query
14
+ } from "./chunk-DXZJHS4M.js";
15
+
16
+ // src/tslayout.ts
17
+ var query2 = query;
18
+ var _TsUiRegistry = () => TsUi;
19
+ var w2panels = ["top", "left", "main", "preview", "right", "bottom"];
20
+ var TsLayout = class extends TsBase {
21
+ panels;
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
+ last;
24
+ // any: accumulates resize state, observeResize, events dict
25
+ padding;
26
+ resizer;
27
+ style;
28
+ onShow;
29
+ onHide;
30
+ onResizing;
31
+ onResizerClick;
32
+ onRender;
33
+ onRefresh;
34
+ onChange;
35
+ onResize;
36
+ onDestroy;
37
+ panel_template;
38
+ // any: TsBase dynamic event handlers
39
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
40
+ constructor(options) {
41
+ super(options.name);
42
+ this.box = null;
43
+ this.name = "";
44
+ this.panels = [];
45
+ this.last = {};
46
+ this.padding = 1;
47
+ this.resizer = 4;
48
+ this.style = "";
49
+ this.onShow = null;
50
+ this.onHide = null;
51
+ this.onResizing = null;
52
+ this.onResizerClick = null;
53
+ this.onRender = null;
54
+ this.onRefresh = null;
55
+ this.onChange = null;
56
+ this.onResize = null;
57
+ this.onDestroy = null;
58
+ this.panel_template = {
59
+ type: null,
60
+ // left, right, top, bottom
61
+ title: "",
62
+ size: 100,
63
+ // width or height depending on panel name
64
+ minSize: 20,
65
+ maxSize: false,
66
+ hidden: false,
67
+ resizable: false,
68
+ overflow: "auto",
69
+ style: "",
70
+ html: "",
71
+ // can be String or Object with .render(box) method
72
+ tabs: null,
73
+ toolbar: null,
74
+ width: null,
75
+ // read only
76
+ height: null,
77
+ // read only
78
+ show: {
79
+ toolbar: false,
80
+ tabs: false
81
+ },
82
+ removed: null,
83
+ // function to call when content is overwritten
84
+ onRefresh: null,
85
+ onShow: null,
86
+ onHide: null
87
+ };
88
+ Object.assign(this, options);
89
+ if (!Array.isArray(this.panels)) this.panels = [];
90
+ this.panels.forEach((panel, ind) => {
91
+ this.panels[ind] = TsUtils.extend({}, this.panel_template, panel);
92
+ if (TsUtils.isPlainObject(panel.tabs) || Array.isArray(panel.tabs)) initTabs(this, panel.type);
93
+ if (TsUtils.isPlainObject(panel.toolbar) || Array.isArray(panel.toolbar)) initToolbar(this, panel.type);
94
+ });
95
+ w2panels.forEach((tab) => {
96
+ if (this.get(tab) != null) return;
97
+ this.panels.push(TsUtils.extend({}, this.panel_template, { type: tab, hidden: tab !== "main", size: 50 }));
98
+ });
99
+ if (typeof this.box == "string") this.box = query2(this.box).get(0);
100
+ if (this.box) this.render(this.box);
101
+ function initTabs(object, panel, tabs) {
102
+ const pan = panel != null ? object.get(panel) : null;
103
+ if (pan != null && tabs == null) tabs = pan.tabs;
104
+ if (pan == null || tabs == null) return false;
105
+ if (Array.isArray(tabs)) tabs = { tabs };
106
+ const name = object.name + "_" + (panel ?? "") + "_tabs";
107
+ if (_TsUiRegistry()[name]) _TsUiRegistry()[name].destroy();
108
+ pan.tabs = new TsTabs(TsUtils.extend({}, tabs, { owner: object, name: object.name + "_" + (panel ?? "") + "_tabs" }));
109
+ pan.show.tabs = true;
110
+ return true;
111
+ }
112
+ function initToolbar(object, panel, toolbar) {
113
+ const pan = panel != null ? object.get(panel) : null;
114
+ if (pan != null && toolbar == null) toolbar = pan.toolbar;
115
+ if (pan == null || toolbar == null) return false;
116
+ if (Array.isArray(toolbar)) toolbar = { items: toolbar };
117
+ const name = object.name + "_" + (panel ?? "") + "_toolbar";
118
+ if (_TsUiRegistry()[name]) _TsUiRegistry()[name].destroy();
119
+ pan.toolbar = new TsToolbar(TsUtils.extend({}, toolbar, { owner: object, name: object.name + "_" + (panel ?? "") + "_toolbar" }));
120
+ pan.show.toolbar = true;
121
+ return true;
122
+ }
123
+ }
124
+ html(panel, data, transition) {
125
+ const p = this.get(panel);
126
+ const promise = {
127
+ panel,
128
+ html: p.html,
129
+ error: false,
130
+ cancelled: false,
131
+ removed(cb) {
132
+ if (typeof cb == "function") {
133
+ p.removed = cb;
134
+ }
135
+ }
136
+ };
137
+ if (typeof p.removed == "function") {
138
+ p.removed({ panel, html: p.html, html_new: data, transition: transition || "none" });
139
+ p.removed = null;
140
+ }
141
+ if (panel == "css") {
142
+ query2(this.box).find("#layout_" + this.name + "_panel_css").html("<style>" + data + "</style>");
143
+ promise.status = true;
144
+ return promise;
145
+ }
146
+ if (p == null) {
147
+ console.log("ERROR: incorrect panel name. Panel name can be main, left, right, top, bottom, preview or css");
148
+ promise.error = true;
149
+ return promise;
150
+ }
151
+ if (data == null) {
152
+ return promise;
153
+ }
154
+ const edata = this.trigger("change", { target: panel, panel: p, html_new: data, transition });
155
+ if (edata.isCancelled === true) {
156
+ promise.cancelled = true;
157
+ return promise;
158
+ }
159
+ const pname = "#layout_" + this.name + "_panel_" + p.type;
160
+ const current = query2(this.box).find(pname + '> [data-role="panel-content"]');
161
+ let panelTop = 0;
162
+ if (current.length > 0) {
163
+ ;
164
+ query2(this.box).find(pname).get(0).scrollTop = 0;
165
+ panelTop = query2(current).css("top");
166
+ }
167
+ if (typeof p.html.unmount == "function") p.html.unmount();
168
+ current.addClass("tsg-panel-content");
169
+ current.removeAttr("style");
170
+ this.resizeBoxes(panel);
171
+ if (p.html === "") {
172
+ p.html = data;
173
+ this.refresh(panel);
174
+ } else {
175
+ p.html = data;
176
+ if (!p.hidden) {
177
+ if (transition != null && transition !== "") {
178
+ query2(this.box).addClass("animating");
179
+ const div1 = query2(this.box).find(pname + '> [data-role="panel-content"]');
180
+ div1.after('<div class="tsg-panel-content new-panel" data-role="panel-content" style="' + div1[0].style.cssText + '"></div>');
181
+ const div2 = query2(this.box).find(pname + '> [data-role="panel-content"].new-panel');
182
+ div1.css("top", panelTop);
183
+ div2.css("top", panelTop);
184
+ if (typeof data == "object") {
185
+ data.box = div2[0];
186
+ data.render();
187
+ } else {
188
+ div2.hide().html(data);
189
+ }
190
+ let style1, style2;
191
+ switch (transition) {
192
+ case "slide-left":
193
+ style1 = "left: -" + TsUtils.getSize(query2(this.box), "width") + "px";
194
+ style2 = "left: 0px";
195
+ break;
196
+ case "slide-right":
197
+ style1 = "left: " + TsUtils.getSize(query2(this.box), "width") + "px";
198
+ style2 = "left: 0px";
199
+ break;
200
+ case "slide-down":
201
+ style1 = "top: -" + TsUtils.getSize(query2(this.box), "height") + "px";
202
+ style2 = "top: " + panelTop + "px";
203
+ break;
204
+ case "slide-up":
205
+ style1 = "top: " + TsUtils.getSize(query2(this.box), "height") + "px";
206
+ style2 = "top: " + panelTop + "px";
207
+ break;
208
+ case "flip-left":
209
+ style1 = "transform: rotate(90deg)";
210
+ style2 = "transform: rotate(0deg)";
211
+ break;
212
+ case "flip-right":
213
+ style1 = "transform: rotate(-90deg)";
214
+ style2 = "transform: rotate(0deg)";
215
+ break;
216
+ case "flip-down":
217
+ style1 = "transform: rotate(-180deg)";
218
+ style2 = "transform: rotate(0deg)";
219
+ break;
220
+ case "flip-up":
221
+ style1 = "transform: rotate(180deg)";
222
+ style2 = "transform: rotate(0deg)";
223
+ break;
224
+ case "pop-in":
225
+ style1 = "transform: scale(.5); opacity: 0;";
226
+ style2 = "transform: scale(1); opacity: 1;";
227
+ break;
228
+ case "pop-out":
229
+ style1 = "transform: scale(1); opacity: 1;";
230
+ style2 = "transform: scale(.5); opacity: 0;";
231
+ break;
232
+ default:
233
+ style1 = "";
234
+ style2 = "";
235
+ }
236
+ div1.addClass("previous").css({ "cssText": "transition: .5s; " + style1 });
237
+ div2.addClass("current").css({ "cssText": "transition: .5s; " + style2 });
238
+ setTimeout(() => {
239
+ query2(this.box).removeClass("animating");
240
+ div1.remove();
241
+ div2.removeClass("new-panel current");
242
+ query2(this.box).find(pname + '> [data-role="panel-content"]').css({ "cssText": "" });
243
+ edata.finish();
244
+ }, 500);
245
+ } else {
246
+ this.refresh(panel);
247
+ edata.finish();
248
+ }
249
+ } else {
250
+ edata.finish();
251
+ }
252
+ }
253
+ return promise;
254
+ }
255
+ message(panel, options) {
256
+ const p = this.get(panel);
257
+ const box = query2(this.box).find("#layout_" + this.name + "_panel_" + p.type);
258
+ const oldOverflow = box.css("overflow");
259
+ box.css("overflow", "hidden");
260
+ const prom = TsUtils.message({
261
+ owner: this,
262
+ // any: query().get(0) returns Node|Node[]; panel element is HTMLElement
263
+ box: box.get(0),
264
+ after: ".tsg-panel-title",
265
+ param: panel
266
+ // any: cast-to-any for dynamic dispatch; TsLayout panel shape is user-defined at runtime
267
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
268
+ }, options);
269
+ if (prom) {
270
+ prom.self.on("close:after", () => {
271
+ box.css("overflow", oldOverflow);
272
+ });
273
+ }
274
+ return prom;
275
+ }
276
+ confirm(panel, options) {
277
+ const p = this.get(panel);
278
+ const box = query2(this.box).find("#layout_" + this.name + "_panel_" + p.type);
279
+ const oldOverflow = box.css("overflow");
280
+ box.css("overflow", "hidden");
281
+ const prom = TsUtils.confirm({
282
+ owner: this,
283
+ // any: query().get(0) returns Node|Node[]; panel element is HTMLElement
284
+ box: box.get(0),
285
+ after: ".tsg-panel-title",
286
+ param: panel
287
+ // any: cast-to-any for dynamic dispatch; TsLayout panel shape is user-defined at runtime
288
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
289
+ }, options);
290
+ if (prom) {
291
+ prom.self.on("close:after", () => {
292
+ box.css("overflow", oldOverflow);
293
+ });
294
+ }
295
+ return prom;
296
+ }
297
+ load(panel, url, transition) {
298
+ return new Promise((resolve, reject) => {
299
+ if ((panel == "css" || this.get(panel) != null) && url != null) {
300
+ fetch(url).then((resp) => resp.text()).then((text) => {
301
+ this.resize();
302
+ resolve(this.html(panel, text, transition));
303
+ });
304
+ } else {
305
+ reject();
306
+ }
307
+ });
308
+ }
309
+ sizeTo(panel, size, instant) {
310
+ const pan = this.get(panel);
311
+ if (pan == null) return false;
312
+ query2(this.box).find(":scope > div > .tsg-panel").css("transition", instant !== true ? ".2s" : "0s");
313
+ setTimeout(() => {
314
+ this.set(panel, { size });
315
+ }, 1);
316
+ setTimeout(() => {
317
+ query2(this.box).find(":scope > div > .tsg-panel").css("transition", "0s");
318
+ this.resize();
319
+ }, 300);
320
+ return true;
321
+ }
322
+ show(panel, immediate) {
323
+ const edata = this.trigger("show", { target: panel, thisect: this.get(panel), immediate });
324
+ if (edata.isCancelled === true) return;
325
+ const p = this.get(panel);
326
+ if (p == null) return false;
327
+ p.hidden = false;
328
+ if (immediate === true) {
329
+ query2(this.box).find("#layout_" + this.name + "_panel_" + panel).css({ "opacity": "1" });
330
+ edata.finish();
331
+ this.resize();
332
+ } else {
333
+ query2(this.box).addClass("animating");
334
+ query2(this.box).find("#layout_" + this.name + "_panel_" + panel).css({ "opacity": "0" });
335
+ query2(this.box).find(":scope > div > .tsg-panel").css("transition", ".2s");
336
+ setTimeout(() => {
337
+ this.resize();
338
+ }, 1);
339
+ setTimeout(() => {
340
+ query2(this.box).find("#layout_" + this.name + "_panel_" + panel).css({ "opacity": "1" });
341
+ }, 250);
342
+ setTimeout(() => {
343
+ query2(this.box).find(":scope > div > .tsg-panel").css("transition", "0s");
344
+ query2(this.box).removeClass("animating");
345
+ edata.finish();
346
+ this.resize();
347
+ }, 300);
348
+ }
349
+ return true;
350
+ }
351
+ hide(panel, immediate) {
352
+ const edata = this.trigger("hide", { target: panel, object: this.get(panel), immediate });
353
+ if (edata.isCancelled === true) return;
354
+ const p = this.get(panel);
355
+ if (p == null) return false;
356
+ p.hidden = true;
357
+ if (immediate === true) {
358
+ query2(this.box).find("#layout_" + this.name + "_panel_" + panel).css({ "opacity": "0" });
359
+ edata.finish();
360
+ this.resize();
361
+ } else {
362
+ query2(this.box).addClass("animating");
363
+ query2(this.box).find(":scope > div > .tsg-panel").css("transition", ".2s");
364
+ query2(this.box).find("#layout_" + this.name + "_panel_" + panel).css({ "opacity": "0" });
365
+ setTimeout(() => {
366
+ this.resize();
367
+ }, 1);
368
+ setTimeout(() => {
369
+ query2(this.box).find(":scope > div > .tsg-panel").css("transition", "0s");
370
+ query2(this.box).removeClass("animating");
371
+ edata.finish();
372
+ this.resize();
373
+ }, 300);
374
+ }
375
+ return true;
376
+ }
377
+ toggle(panel, immediate) {
378
+ const p = this.get(panel);
379
+ if (p == null) return false;
380
+ if (p.hidden) return this.show(panel, immediate);
381
+ else return this.hide(panel, immediate);
382
+ }
383
+ set(panel, options) {
384
+ const ind = this.get(panel, true);
385
+ if (ind == null) return false;
386
+ TsUtils.extend(this.panels[ind], options);
387
+ if (options.html != null || options.resizable != null) {
388
+ this.refresh(panel);
389
+ }
390
+ this.resize();
391
+ return true;
392
+ }
393
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
394
+ get(panel, returnIndex) {
395
+ for (let p = 0; p < this.panels.length; p++) {
396
+ const pan = this.panels[p];
397
+ if (pan != null && pan.type == panel) {
398
+ if (returnIndex === true) return p;
399
+ else return pan;
400
+ }
401
+ }
402
+ return null;
403
+ }
404
+ el(panel) {
405
+ const el = query2(this.box).find("#layout_" + this.name + "_panel_" + panel + '> [data-role="panel-content"]');
406
+ if (el.length != 1) return null;
407
+ return el[0];
408
+ }
409
+ hideToolbar(panel) {
410
+ const pan = this.get(panel);
411
+ if (!pan) return;
412
+ pan.show.toolbar = false;
413
+ query2(this.box).find(`#layout_${this.name}_panel_${panel} > [data-role="panel-toolbar"]`).hide();
414
+ this.resize();
415
+ }
416
+ showToolbar(panel) {
417
+ const pan = this.get(panel);
418
+ if (!pan) return;
419
+ pan.show.toolbar = true;
420
+ query2(this.box).find(`#layout_${this.name}_panel_${panel} > [data-role="panel-toolbar"]`).show();
421
+ this.resize();
422
+ }
423
+ toggleToolbar(panel) {
424
+ const pan = this.get(panel);
425
+ if (!pan) return;
426
+ if (pan.show.toolbar) this.hideToolbar(panel);
427
+ else this.showToolbar(panel);
428
+ }
429
+ assignToolbar(panel, toolbar) {
430
+ if (typeof toolbar == "string" && _TsUiRegistry()[toolbar] != null) toolbar = _TsUiRegistry()[toolbar];
431
+ const pan = this.get(panel);
432
+ pan.toolbar = toolbar;
433
+ const tmp = query2(this.box).find(panel + '> [data-role="panel-toolbar"]');
434
+ if (pan.toolbar != null) {
435
+ if (tmp.attr("name") != pan.toolbar.name) {
436
+ ;
437
+ pan.toolbar.render(tmp.get(0));
438
+ } else if (pan.toolbar != null) {
439
+ ;
440
+ pan.toolbar.refresh();
441
+ }
442
+ if (typeof toolbar != "string" && toolbar) toolbar["owner"] = this;
443
+ this.showToolbar(panel);
444
+ this.refresh(panel);
445
+ } else {
446
+ tmp.html("");
447
+ this.hideToolbar(panel);
448
+ }
449
+ }
450
+ hideTabs(panel) {
451
+ const pan = this.get(panel);
452
+ if (!pan) return;
453
+ pan.show.tabs = false;
454
+ query2(this.box).find("#layout_" + this.name + "_panel_" + panel + '> [data-role="panel-tabs"]').hide();
455
+ this.resize();
456
+ }
457
+ showTabs(panel) {
458
+ const pan = this.get(panel);
459
+ if (!pan) return;
460
+ pan.show.tabs = true;
461
+ query2(this.box).find("#layout_" + this.name + "_panel_" + panel + '> [data-role="panel-tabs"]').show();
462
+ this.resize();
463
+ }
464
+ toggleTabs(panel) {
465
+ const pan = this.get(panel);
466
+ if (!pan) return;
467
+ if (pan.show.tabs) this.hideTabs(panel);
468
+ else this.showTabs(panel);
469
+ }
470
+ assignTabs(panel, tabs) {
471
+ if (typeof tabs == "string" && _TsUiRegistry()[tabs] != null) tabs = _TsUiRegistry()[tabs];
472
+ const pan = this.get(panel);
473
+ pan.tabs = tabs;
474
+ const tmp = query2(this.box).find(panel + '> [data-role="panel-tabs"]');
475
+ if (pan.tabs != null) {
476
+ if (tmp.attr("name") != pan.tabs.name) {
477
+ ;
478
+ pan.tabs.render(tmp.get(0));
479
+ } else if (pan.tabs != null) {
480
+ ;
481
+ pan.tabs.refresh();
482
+ }
483
+ if (typeof tabs != "string" && tabs) tabs["owner"] = this;
484
+ this.showTabs(panel);
485
+ this.refresh(panel);
486
+ } else {
487
+ tmp.html("");
488
+ this.hideTabs(panel);
489
+ }
490
+ }
491
+ render(box) {
492
+ const time = Date.now();
493
+ const self = this;
494
+ if (typeof box == "string") box = query2(box).get(0);
495
+ const edata = this.trigger("render", { target: this.name, box: box ?? this.box });
496
+ if (edata.isCancelled === true) return;
497
+ if (box != null) {
498
+ this.unmount();
499
+ this.box = box;
500
+ }
501
+ if (!this.box) return false;
502
+ query2(this.box).attr("name", this.name).addClass("tsg-layout").html("<div></div>");
503
+ if (query2(this.box).length > 0) {
504
+ ;
505
+ query2(this.box)[0].style.cssText += this.style;
506
+ }
507
+ for (let p1 = 0; p1 < w2panels.length; p1++) {
508
+ const html = '<div id="layout_' + this.name + "_panel_" + w2panels[p1] + '" class="tsg-panel"> <div class="tsg-panel-title"></div> <div class="tsg-panel-tabs" data-role="panel-tabs"></div> <div class="tsg-panel-toolbar" data-role="panel-toolbar"></div> <div class="tsg-panel-content" data-role="panel-content"></div></div><div id="layout_' + this.name + "_resizer_" + w2panels[p1] + '" class="tsg-resizer"></div>';
509
+ query2(this.box).find(":scope > div").append(html);
510
+ }
511
+ query2(this.box).find(":scope > div").append('<div id="layout_' + this.name + '_panel_css" style="position: absolute; top: 10000px;"></div>');
512
+ this.refresh();
513
+ this.last["observeResize"] = new ResizeObserver(() => {
514
+ this.resize();
515
+ });
516
+ this.last["observeResize"].observe(this.box);
517
+ edata.finish();
518
+ setTimeout(() => {
519
+ self.last["events"] = { resizeStart, mouseMove, mouseUp };
520
+ this.resize();
521
+ }, 0);
522
+ return Date.now() - time;
523
+ function resizeStart(type, evnt) {
524
+ if (!self.box) return;
525
+ if (!evnt) evnt = window.event;
526
+ query2(document).off("mousemove", self.last["events"].mouseMove).on("mousemove", self.last["events"].mouseMove);
527
+ query2(document).off("mouseup", self.last["events"].mouseUp).on("mouseup", self.last["events"].mouseUp);
528
+ self.last["resize"] = {
529
+ type,
530
+ x: evnt.screenX,
531
+ y: evnt.screenY,
532
+ diff_x: 0,
533
+ diff_y: 0,
534
+ value: 0
535
+ };
536
+ w2panels.forEach((panel) => {
537
+ const $tmp = query2(self.el(panel)).find(".tsg-lock");
538
+ if ($tmp.length > 0) {
539
+ $tmp.data("locked", "yes");
540
+ } else {
541
+ self.lock(panel, { opacity: 0 });
542
+ }
543
+ });
544
+ const el = query2(self.box).find("#layout_" + self.name + "_resizer_" + type).get(0);
545
+ if (type == "left" || type == "right") {
546
+ self.last["resize"].value = parseInt(el.style.left);
547
+ }
548
+ if (type == "top" || type == "preview" || type == "bottom") {
549
+ self.last["resize"].value = parseInt(el.style.top);
550
+ }
551
+ }
552
+ function mouseUp(evnt) {
553
+ if (!self.box) return;
554
+ if (!evnt) evnt = window.event;
555
+ query2(document).off("mousemove", self.last["events"].mouseMove);
556
+ query2(document).off("mouseup", self.last["events"].mouseUp);
557
+ if (self.last["resize"] == null) return;
558
+ w2panels.forEach((panel) => {
559
+ const $tmp = query2(self.el(panel)).find(".tsg-lock");
560
+ if ($tmp.data("locked") == "yes") {
561
+ $tmp.removeData("locked");
562
+ } else {
563
+ self.unlock(panel);
564
+ }
565
+ });
566
+ if (self.last["diff_x"] !== 0 || self.last["resize"].diff_y !== 0) {
567
+ const ptop = self.get("top");
568
+ const pbottom = self.get("bottom");
569
+ const panel = self.get(self.last["resize"].type);
570
+ const width = TsUtils.getSize(query2(self.box), "width");
571
+ const height = TsUtils.getSize(query2(self.box), "height");
572
+ const str = String(panel.size);
573
+ let ns, nd;
574
+ switch (self.last["resize"].type) {
575
+ case "top":
576
+ ns = parseInt(panel.sizeCalculated) + self.last["resize"].diff_y;
577
+ nd = 0;
578
+ break;
579
+ case "bottom":
580
+ ns = parseInt(panel.sizeCalculated) - self.last["resize"].diff_y;
581
+ nd = 0;
582
+ break;
583
+ case "preview":
584
+ ns = parseInt(panel.sizeCalculated) - self.last["resize"].diff_y;
585
+ nd = (ptop && !ptop.hidden ? ptop.sizeCalculated : 0) + (pbottom && !pbottom.hidden ? pbottom.sizeCalculated : 0);
586
+ break;
587
+ case "left":
588
+ ns = parseInt(panel.sizeCalculated) + self.last["resize"].diff_x;
589
+ nd = 0;
590
+ break;
591
+ case "right":
592
+ ns = parseInt(panel.sizeCalculated) - self.last["resize"].diff_x;
593
+ nd = 0;
594
+ break;
595
+ default:
596
+ ns = 0;
597
+ nd = 0;
598
+ }
599
+ if (str.substr(str.length - 1) == "%") {
600
+ panel.size = Math.floor(ns * 100 / (panel.type == "left" || panel.type == "right" ? width : height - nd) * 100) / 100 + "%";
601
+ } else {
602
+ if (String(panel.size).substr(0, 1) == "-") {
603
+ panel.size = parseInt(panel.size) - panel.sizeCalculated + ns;
604
+ } else {
605
+ panel.size = ns;
606
+ }
607
+ }
608
+ self.resize();
609
+ }
610
+ query2(self.box).find("#layout_" + self.name + "_resizer_" + self.last["resize"].type).removeClass(null).addClass("active");
611
+ query2(self.box).find("#layout_" + self.name + "_resizer_" + self.last["resize"].type).removeClass("active");
612
+ delete self.last["resize"];
613
+ }
614
+ function mouseMove(evnt) {
615
+ if (!self.box) return;
616
+ if (!evnt) evnt = window.event;
617
+ if (self.last["resize"] == null) return;
618
+ const panel = self.get(self.last["resize"].type);
619
+ const tmp = self.last["resize"];
620
+ const edata2 = self.trigger("resizing", {
621
+ target: self.name,
622
+ object: panel,
623
+ originalEvent: evnt,
624
+ panel: tmp ? tmp.type : "all",
625
+ diff_x: tmp ? tmp.diff_x : 0,
626
+ diff_y: tmp ? tmp.diff_y : 0
627
+ });
628
+ if (edata2.isCancelled === true) return;
629
+ const p = query2(self.box).find("#layout_" + self.name + "_resizer_" + tmp.type);
630
+ const resize_x = evnt.screenX - tmp.x;
631
+ const resize_y = evnt.screenY - tmp.y;
632
+ const mainPanel = self.get("main");
633
+ if (!p.hasClass("active")) p.addClass("active");
634
+ let adjusted_x = resize_x;
635
+ let adjusted_y = resize_y;
636
+ switch (tmp.type) {
637
+ case "left":
638
+ if (panel.minSize - adjusted_x > panel.width) {
639
+ adjusted_x = panel.minSize - panel.width;
640
+ }
641
+ if (panel.maxSize && panel.width + adjusted_x > panel.maxSize) {
642
+ adjusted_x = panel.maxSize - panel.width;
643
+ }
644
+ if (mainPanel.minSize + adjusted_x > mainPanel.width) {
645
+ adjusted_x = mainPanel.width - mainPanel.minSize;
646
+ }
647
+ break;
648
+ case "right":
649
+ if (panel.minSize + adjusted_x > panel.width) {
650
+ adjusted_x = panel.width - panel.minSize;
651
+ }
652
+ if (panel.maxSize && panel.width - adjusted_x > panel.maxSize) {
653
+ adjusted_x = panel.width - panel.maxSize;
654
+ }
655
+ if (mainPanel.minSize - adjusted_x > mainPanel.width) {
656
+ adjusted_x = mainPanel.minSize - mainPanel.width;
657
+ }
658
+ break;
659
+ case "top":
660
+ if (panel.minSize - adjusted_y > panel.height) {
661
+ adjusted_y = panel.minSize - panel.height;
662
+ }
663
+ if (panel.maxSize && panel.height + adjusted_y > panel.maxSize) {
664
+ adjusted_y = panel.maxSize - panel.height;
665
+ }
666
+ if (mainPanel.minSize + adjusted_y > mainPanel.height) {
667
+ adjusted_y = mainPanel.height - mainPanel.minSize;
668
+ }
669
+ break;
670
+ case "preview":
671
+ case "bottom":
672
+ if (panel.minSize + adjusted_y > panel.height) {
673
+ adjusted_y = panel.height - panel.minSize;
674
+ }
675
+ if (panel.maxSize && panel.height - adjusted_y > panel.maxSize) {
676
+ adjusted_y = panel.height - panel.maxSize;
677
+ }
678
+ if (mainPanel.minSize - adjusted_y > mainPanel.height) {
679
+ adjusted_y = mainPanel.minSize - mainPanel.height;
680
+ }
681
+ break;
682
+ }
683
+ tmp.diff_x = adjusted_x;
684
+ tmp.diff_y = adjusted_y;
685
+ switch (tmp.type) {
686
+ case "top":
687
+ case "preview":
688
+ case "bottom":
689
+ tmp.diff_x = 0;
690
+ if (p.length > 0) p[0].style.top = tmp.value + tmp.diff_y + "px";
691
+ break;
692
+ case "left":
693
+ case "right":
694
+ tmp.diff_y = 0;
695
+ if (p.length > 0) p[0].style.left = tmp.value + tmp.diff_x + "px";
696
+ break;
697
+ }
698
+ edata2.finish();
699
+ }
700
+ }
701
+ unmount() {
702
+ super.unmount();
703
+ this.panels.forEach((panel) => {
704
+ ;
705
+ panel.tabs?.unmount?.();
706
+ panel.toolbar?.unmount?.();
707
+ });
708
+ this.last["observeResize"]?.disconnect();
709
+ }
710
+ destroy() {
711
+ const edata = this.trigger("destroy", { target: this.name });
712
+ if (edata.isCancelled === true) return;
713
+ if (_TsUiRegistry()[this.name] == null) return false;
714
+ this.panels.forEach((panel) => {
715
+ ;
716
+ panel.tabs?.destroy?.();
717
+ panel.toolbar?.destroy?.();
718
+ });
719
+ if (query2(this.box).find("#layout_" + this.name + "_panel_main").length > 0) {
720
+ this.unmount();
721
+ }
722
+ delete _TsUiRegistry()[this.name];
723
+ edata.finish();
724
+ if (this.last["events"] && this.last["events"].resize) {
725
+ query2(window).off("resize", this.last["events"].resize);
726
+ }
727
+ return true;
728
+ }
729
+ refresh(panel) {
730
+ const self = this;
731
+ const time = Date.now();
732
+ const edata = self.trigger("refresh", { target: panel != null ? panel : self.name, object: panel != null ? self.get(panel) : null });
733
+ if (edata.isCancelled === true) return;
734
+ if (typeof panel == "string") {
735
+ const p = self.get(panel);
736
+ if (p == null) return;
737
+ const pname = "#layout_" + self.name + "_panel_" + p.type;
738
+ const rname = "#layout_" + self.name + "_resizer_" + p.type;
739
+ query2(self.box).find(pname).css({ display: p.hidden ? "none" : "block" });
740
+ if (p.resizable) {
741
+ query2(self.box).find(rname).show();
742
+ } else {
743
+ query2(self.box).find(rname).hide();
744
+ }
745
+ if (typeof p.html == "object" && typeof p.html.render === "function") {
746
+ ;
747
+ p.html.box = query2(self.box).find(pname + '> [data-role="panel-content"]')[0];
748
+ setTimeout(() => {
749
+ if (query2(self.box).find(pname + '> [data-role="panel-content"]').length > 0) {
750
+ const $content = query2(self.box).find(pname + '> [data-role="panel-content"]').removeClass(null).removeAttr("name").addClass("tsg-panel-content");
751
+ $content.css("overflow", p.overflow)[0].style.cssText += ";" + p.style;
752
+ }
753
+ if (p.html && typeof p.html.render == "function") {
754
+ ;
755
+ p.html.render();
756
+ }
757
+ }, 1);
758
+ } else {
759
+ if (query2(self.box).find(pname + '> [data-role="panel-content"]').length > 0) {
760
+ const $content = query2(self.box).find(pname + '> [data-role="panel-content"]').removeClass(null).removeAttr("name").addClass("tsg-panel-content");
761
+ $content.html(p.html).css("overflow", p.overflow)[0].style.cssText += ";" + p.style;
762
+ }
763
+ }
764
+ let tmp = query2(self.box).find(pname + '> [data-role="panel-tabs"]');
765
+ if (p.show.tabs) {
766
+ if (tmp.attr("name") != p.tabs?.name && p.tabs != null) {
767
+ ;
768
+ p.tabs.render(tmp.get(0));
769
+ } else {
770
+ ;
771
+ p.tabs.refresh();
772
+ }
773
+ tmp.addClass("tsg-panel-tabs");
774
+ } else {
775
+ ;
776
+ tmp.html("").removeAttr("name").removeClass(null);
777
+ tmp.css("display", "none").hide();
778
+ }
779
+ tmp = query2(self.box).find(pname + '> [data-role="panel-toolbar"]');
780
+ if (p.show.toolbar) {
781
+ if (tmp.attr("name") != p.toolbar?.name && p.toolbar != null) {
782
+ ;
783
+ p.toolbar.render(tmp.get(0));
784
+ } else {
785
+ ;
786
+ p.toolbar.refresh();
787
+ }
788
+ tmp.addClass("tsg-panel-toolbar");
789
+ } else {
790
+ ;
791
+ tmp.html("").removeAttr("name").removeClass(null);
792
+ tmp.css("display", "none").hide();
793
+ }
794
+ tmp = query2(self.box).find(pname + "> .tsg-panel-title");
795
+ if (p.title) {
796
+ ;
797
+ tmp.html(p.title).show();
798
+ } else {
799
+ ;
800
+ tmp.html("").hide();
801
+ }
802
+ } else {
803
+ if (query2(self.box).find("#layout_" + self.name + "_panel_main").length === 0) {
804
+ self.render();
805
+ return;
806
+ }
807
+ self.resize();
808
+ for (let p1 = 0; p1 < this.panels.length; p1++) {
809
+ const p = this.panels[p1];
810
+ if (p != null) self.refresh(p.type ?? void 0);
811
+ }
812
+ }
813
+ edata.finish();
814
+ return Date.now() - time;
815
+ }
816
+ resize() {
817
+ if (!this.box) return false;
818
+ const time = Date.now();
819
+ const tmp = this.last["resize"];
820
+ const edata = this.trigger("resize", {
821
+ target: this.name,
822
+ panel: tmp ? tmp.type : "all",
823
+ diff_x: tmp ? tmp.diff_x : 0,
824
+ diff_y: tmp ? tmp.diff_y : 0
825
+ });
826
+ if (edata.isCancelled === true) return;
827
+ if (this.padding < 0) this.padding = 0;
828
+ const width = TsUtils.getSize(query2(this.box), "width");
829
+ const height = TsUtils.getSize(query2(this.box), "height");
830
+ const self = this;
831
+ const pmain = this.get("main");
832
+ const pprev = this.get("preview");
833
+ const pleft = this.get("left");
834
+ const pright = this.get("right");
835
+ const ptop = this.get("top");
836
+ const pbottom = this.get("bottom");
837
+ const sprev = pprev != null && pprev.hidden !== true ? true : false;
838
+ const sleft = pleft != null && pleft.hidden !== true ? true : false;
839
+ const sright = pright != null && pright.hidden !== true ? true : false;
840
+ const stop = ptop != null && ptop.hidden !== true ? true : false;
841
+ const sbottom = pbottom != null && pbottom.hidden !== true ? true : false;
842
+ let l, t, w, h;
843
+ for (let p = 0; p < w2panels.length; p++) {
844
+ const panelType = w2panels[p];
845
+ if (panelType == null || panelType === "main") continue;
846
+ const panTmp = this.get(panelType);
847
+ if (!panTmp) continue;
848
+ const str = String(panTmp.size || 0);
849
+ if (str.substr(str.length - 1) == "%") {
850
+ let tmph = height;
851
+ if (panTmp.type == "preview") {
852
+ tmph = tmph - (ptop && !ptop.hidden ? ptop.sizeCalculated : 0) - (pbottom && !pbottom.hidden ? pbottom.sizeCalculated : 0);
853
+ }
854
+ panTmp.sizeCalculated = parseInt(String((panTmp.type == "left" || panTmp.type == "right" ? width : tmph) * parseFloat(panTmp.size) / 100));
855
+ } else {
856
+ panTmp.sizeCalculated = parseInt(panTmp.size);
857
+ }
858
+ panTmp.sizeCalculated = Math.max(panTmp.sizeCalculated, parseInt(panTmp.minSize));
859
+ }
860
+ if (parseInt(pright.size) < 0) {
861
+ if (sleft && parseInt(pleft.size) < 0) {
862
+ console.log("ERROR: you cannot have both left panel.size and right panel.size be negative.");
863
+ } else {
864
+ pright.sizeCalculated = width - (sleft ? pleft.sizeCalculated : 0) + parseInt(pright.size);
865
+ }
866
+ }
867
+ if (parseInt(pleft.size) < 0) {
868
+ if (sright && parseInt(pright.size) < 0) {
869
+ console.log("ERROR: you cannot have both left panel.size and right panel.size be negative.");
870
+ } else {
871
+ pleft.sizeCalculated = width - (sright ? pright.sizeCalculated : 0) + parseInt(pleft.size);
872
+ }
873
+ }
874
+ if (parseInt(pprev.size) < 0) {
875
+ pprev.sizeCalculated = height + parseInt(pprev.size);
876
+ if (pprev.sizeCalculated > height) pprev.sizeCalculated = height;
877
+ }
878
+ if (ptop != null && ptop.hidden !== true) {
879
+ l = 0;
880
+ t = 0;
881
+ w = width;
882
+ h = ptop.sizeCalculated;
883
+ query2(this.box).find("#layout_" + this.name + "_panel_top").css({
884
+ "display": "block",
885
+ "left": l + "px",
886
+ "top": t + "px",
887
+ "width": w + "px",
888
+ "height": h + "px"
889
+ });
890
+ ptop.width = w;
891
+ ptop.height = h;
892
+ if (ptop.resizable) {
893
+ t = ptop.sizeCalculated - (this.padding === 0 ? this.resizer : 0);
894
+ h = this.resizer > this.padding ? this.resizer : this.padding;
895
+ query2(this.box).find("#layout_" + this.name + "_resizer_top").css({
896
+ "display": "block",
897
+ "left": l + "px",
898
+ "top": t + "px",
899
+ "width": w + "px",
900
+ "height": h + "px",
901
+ "cursor": "ns-resize"
902
+ }).off("mousedown").on("mousedown", function(event) {
903
+ event.preventDefault();
904
+ const edata2 = self.trigger("resizerClick", { target: "top", originalEvent: event });
905
+ if (edata2.isCancelled === true) return;
906
+ _TsUiRegistry()[self.name].last.events.resizeStart("top", event);
907
+ edata2.finish();
908
+ return false;
909
+ });
910
+ }
911
+ } else {
912
+ query2(this.box).find("#layout_" + this.name + "_panel_top").hide();
913
+ query2(this.box).find("#layout_" + this.name + "_resizer_top").hide();
914
+ }
915
+ if (pleft != null && pleft.hidden !== true) {
916
+ l = 0;
917
+ t = 0 + (stop ? ptop.sizeCalculated + this.padding : 0);
918
+ w = pleft.sizeCalculated;
919
+ h = height - (stop ? ptop.sizeCalculated + this.padding : 0) - (sbottom ? pbottom.sizeCalculated + this.padding : 0);
920
+ query2(this.box).find("#layout_" + this.name + "_panel_left").css({
921
+ "display": "block",
922
+ "left": l + "px",
923
+ "top": t + "px",
924
+ "width": w + "px",
925
+ "height": h + "px"
926
+ });
927
+ pleft.width = w;
928
+ pleft.height = h;
929
+ if (pleft.resizable) {
930
+ l = pleft.sizeCalculated - (this.padding === 0 ? this.resizer : 0);
931
+ w = this.resizer > this.padding ? this.resizer : this.padding;
932
+ query2(this.box).find("#layout_" + this.name + "_resizer_left").css({
933
+ "display": "block",
934
+ "left": l + "px",
935
+ "top": t + "px",
936
+ "width": w + "px",
937
+ "height": h + "px",
938
+ "cursor": "ew-resize"
939
+ }).off("mousedown").on("mousedown", function(event) {
940
+ event.preventDefault();
941
+ const edata2 = self.trigger("resizerClick", { target: "left", originalEvent: event });
942
+ if (edata2.isCancelled === true) return;
943
+ _TsUiRegistry()[self.name].last.events.resizeStart("left", event);
944
+ edata2.finish();
945
+ return false;
946
+ });
947
+ }
948
+ } else {
949
+ query2(this.box).find("#layout_" + this.name + "_panel_left").hide();
950
+ query2(this.box).find("#layout_" + this.name + "_resizer_left").hide();
951
+ }
952
+ if (pright != null && pright.hidden !== true) {
953
+ l = width - pright.sizeCalculated;
954
+ t = 0 + (stop ? ptop.sizeCalculated + this.padding : 0);
955
+ w = pright.sizeCalculated;
956
+ h = height - (stop ? ptop.sizeCalculated + this.padding : 0) - (sbottom ? pbottom.sizeCalculated + this.padding : 0);
957
+ query2(this.box).find("#layout_" + this.name + "_panel_right").css({
958
+ "display": "block",
959
+ "left": l + "px",
960
+ "top": t + "px",
961
+ "width": w + "px",
962
+ "height": h + "px"
963
+ });
964
+ pright.width = w;
965
+ pright.height = h;
966
+ if (pright.resizable) {
967
+ l = l - this.padding;
968
+ w = this.resizer > this.padding ? this.resizer : this.padding;
969
+ query2(this.box).find("#layout_" + this.name + "_resizer_right").css({
970
+ "display": "block",
971
+ "left": l + "px",
972
+ "top": t + "px",
973
+ "width": w + "px",
974
+ "height": h + "px",
975
+ "cursor": "ew-resize"
976
+ }).off("mousedown").on("mousedown", function(event) {
977
+ event.preventDefault();
978
+ const edata2 = self.trigger("resizerClick", { target: "right", originalEvent: event });
979
+ if (edata2.isCancelled === true) return;
980
+ _TsUiRegistry()[self.name].last.events.resizeStart("right", event);
981
+ edata2.finish();
982
+ return false;
983
+ });
984
+ }
985
+ } else {
986
+ query2(this.box).find("#layout_" + this.name + "_panel_right").hide();
987
+ query2(this.box).find("#layout_" + this.name + "_resizer_right").hide();
988
+ }
989
+ if (pbottom != null && pbottom.hidden !== true) {
990
+ l = 0;
991
+ t = height - pbottom.sizeCalculated;
992
+ w = width;
993
+ h = pbottom.sizeCalculated;
994
+ query2(this.box).find("#layout_" + this.name + "_panel_bottom").css({
995
+ "display": "block",
996
+ "left": l + "px",
997
+ "top": t + "px",
998
+ "width": w + "px",
999
+ "height": h + "px"
1000
+ });
1001
+ pbottom.width = w;
1002
+ pbottom.height = h;
1003
+ if (pbottom.resizable) {
1004
+ t = t - (this.padding === 0 ? 0 : this.padding);
1005
+ h = this.resizer > this.padding ? this.resizer : this.padding;
1006
+ query2(this.box).find("#layout_" + this.name + "_resizer_bottom").css({
1007
+ "display": "block",
1008
+ "left": l + "px",
1009
+ "top": t + "px",
1010
+ "width": w + "px",
1011
+ "height": h + "px",
1012
+ "cursor": "ns-resize"
1013
+ }).off("mousedown").on("mousedown", function(event) {
1014
+ event.preventDefault();
1015
+ const edata2 = self.trigger("resizerClick", { target: "bottom", originalEvent: event });
1016
+ if (edata2.isCancelled === true) return;
1017
+ _TsUiRegistry()[self.name].last.events.resizeStart("bottom", event);
1018
+ edata2.finish();
1019
+ return false;
1020
+ });
1021
+ }
1022
+ } else {
1023
+ query2(this.box).find("#layout_" + this.name + "_panel_bottom").hide();
1024
+ query2(this.box).find("#layout_" + this.name + "_resizer_bottom").hide();
1025
+ }
1026
+ l = 0 + (sleft ? pleft.sizeCalculated + this.padding : 0);
1027
+ t = 0 + (stop ? ptop.sizeCalculated + this.padding : 0);
1028
+ w = width - (sleft ? pleft.sizeCalculated + this.padding : 0) - (sright ? pright.sizeCalculated + this.padding : 0);
1029
+ h = height - (stop ? ptop.sizeCalculated + this.padding : 0) - (sbottom ? pbottom.sizeCalculated + this.padding : 0) - (sprev ? pprev.sizeCalculated + this.padding : 0);
1030
+ query2(this.box).find("#layout_" + this.name + "_panel_main").css({
1031
+ "display": "block",
1032
+ "left": l + "px",
1033
+ "top": t + "px",
1034
+ "width": w + "px",
1035
+ "height": h + "px"
1036
+ });
1037
+ pmain.width = w;
1038
+ pmain.height = h;
1039
+ if (pprev != null && pprev.hidden !== true) {
1040
+ l = 0 + (sleft ? pleft.sizeCalculated + this.padding : 0);
1041
+ t = height - (sbottom ? pbottom.sizeCalculated + this.padding : 0) - pprev.sizeCalculated;
1042
+ w = width - (sleft ? pleft.sizeCalculated + this.padding : 0) - (sright ? pright.sizeCalculated + this.padding : 0);
1043
+ h = pprev.sizeCalculated;
1044
+ query2(this.box).find("#layout_" + this.name + "_panel_preview").css({
1045
+ "display": "block",
1046
+ "left": l + "px",
1047
+ "top": t + "px",
1048
+ "width": w + "px",
1049
+ "height": h + "px"
1050
+ });
1051
+ pprev.width = w;
1052
+ pprev.height = h;
1053
+ if (pprev.resizable) {
1054
+ t = t - (this.padding === 0 ? 0 : this.padding);
1055
+ h = this.resizer > this.padding ? this.resizer : this.padding;
1056
+ query2(this.box).find("#layout_" + this.name + "_resizer_preview").css({
1057
+ "display": "block",
1058
+ "left": l + "px",
1059
+ "top": t + "px",
1060
+ "width": w + "px",
1061
+ "height": h + "px",
1062
+ "cursor": "ns-resize"
1063
+ }).off("mousedown").on("mousedown", function(event) {
1064
+ event.preventDefault();
1065
+ const edata2 = self.trigger("resizerClick", { target: "preview", originalEvent: event });
1066
+ if (edata2.isCancelled === true) return;
1067
+ _TsUiRegistry()[self.name].last.events.resizeStart("preview", event);
1068
+ edata2.finish();
1069
+ return false;
1070
+ });
1071
+ }
1072
+ } else {
1073
+ query2(this.box).find("#layout_" + this.name + "_panel_preview").hide();
1074
+ query2(this.box).find("#layout_" + this.name + "_resizer_preview").hide();
1075
+ }
1076
+ this.resizeBoxes();
1077
+ edata.finish();
1078
+ return Date.now() - time;
1079
+ }
1080
+ resizeBoxes(panel) {
1081
+ const panels = w2panels;
1082
+ if (!panel && typeof panel == "string") panels.slice();
1083
+ panels.forEach((pname, ind) => {
1084
+ const pan = w2panels[ind] != null ? this.get(w2panels[ind]) : null;
1085
+ const tmp2 = `#layout_${this.name}_panel_${pname} > `;
1086
+ let topHeight = 0;
1087
+ if (pan) {
1088
+ if (pan.title) {
1089
+ const el = query2(this.box).find(tmp2 + ".tsg-panel-title").css({ top: topHeight + "px", display: "block" });
1090
+ topHeight += TsUtils.getSize(el, "height");
1091
+ }
1092
+ if (pan.show.tabs) {
1093
+ const el = query2(this.box).find(tmp2 + '[data-role="panel-tabs"]').css({ top: topHeight + "px", display: "block" });
1094
+ topHeight += TsUtils.getSize(el, "height");
1095
+ }
1096
+ if (pan.show.toolbar) {
1097
+ const el = query2(this.box).find(tmp2 + '[data-role="panel-toolbar"]').css({ top: topHeight + "px", display: "block" });
1098
+ topHeight += TsUtils.getSize(el, "height");
1099
+ }
1100
+ }
1101
+ query2(this.box).find(tmp2 + '[data-role="panel-content"]').css({
1102
+ display: "block",
1103
+ top: topHeight + "px"
1104
+ });
1105
+ });
1106
+ }
1107
+ lock(panel, msg, showSpinner) {
1108
+ if (w2panels.indexOf(panel) == -1) {
1109
+ console.log("ERROR: First parameter needs to be the a valid panel name.");
1110
+ return;
1111
+ }
1112
+ TsUtils.lock("#layout_" + this.name + "_panel_" + panel, msg, showSpinner);
1113
+ }
1114
+ unlock(panel, speed) {
1115
+ if (w2panels.indexOf(panel) == -1) {
1116
+ console.log("ERROR: First parameter needs to be the a valid panel name.");
1117
+ return;
1118
+ }
1119
+ const nm = "#layout_" + this.name + "_panel_" + panel;
1120
+ TsUtils.unlock(nm, speed);
1121
+ }
1122
+ };
1123
+
1124
+ export {
1125
+ TsLayout
1126
+ };
1127
+ //# sourceMappingURL=chunk-WKSLGUB3.js.map