react-bwin 0.2.4 → 0.3.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.
- package/README.md +2 -0
- package/dist/react-bwin.css +1 -1
- package/dist/react-bwin.d.ts +95 -81
- package/dist/react-bwin.js +231 -233
- package/dist/react-bwin.umd.js +2 -2
- package/package.json +55 -54
package/dist/react-bwin.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import f, { useRef as A, useEffect as W, forwardRef as Y, useState as j, useImperativeHandle as K, useMemo as V } from "react";
|
|
2
|
+
import { createPortal as Z } from "react-dom";
|
|
3
|
+
var J = Object.defineProperty, Q = (e, t, i) => t in e ? J(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i, E = (e, t, i) => Q(e, typeof t != "symbol" ? t + "" : t, i);
|
|
4
|
+
function tt(e = 0.7, t = 128) {
|
|
4
5
|
const i = 256 - t, n = Math.floor(Math.random() * i + t), s = Math.floor(Math.random() * i + t), o = Math.floor(Math.random() * i + t), h = Math.max(0.5, Math.random() * e);
|
|
5
6
|
return `rgba(${n}, ${s}, ${o}, ${h})`;
|
|
6
7
|
}
|
|
7
|
-
function
|
|
8
|
+
function B(e = 2, t = 3) {
|
|
8
9
|
if (e < 0 || t < 0)
|
|
9
10
|
throw new Error("Parameters must be non-negative numbers");
|
|
10
11
|
const i = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", n = "0123456789";
|
|
@@ -20,15 +21,15 @@ function D(e = 2, t = 3) {
|
|
|
20
21
|
}
|
|
21
22
|
return s;
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
+
function z(e, t) {
|
|
24
25
|
for (; t.firstChild; )
|
|
25
26
|
e.append(t.firstChild);
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function et(e, t) {
|
|
28
29
|
const i = document.createElement("div");
|
|
29
|
-
|
|
30
|
+
z(i, e), z(e, t), z(t, i);
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
+
function C(e) {
|
|
32
33
|
if (typeof e == "number" && !isNaN(e))
|
|
33
34
|
return e;
|
|
34
35
|
if (typeof e == "string") {
|
|
@@ -49,10 +50,10 @@ function z(e) {
|
|
|
49
50
|
}
|
|
50
51
|
return NaN;
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
+
function it(e) {
|
|
53
54
|
return e !== null && typeof e == "object" && !Array.isArray(e) && Object.getPrototypeOf(e) === Object.prototype;
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
+
function nt(e, t) {
|
|
56
57
|
for (const i in t) {
|
|
57
58
|
if (Object.hasOwn(e, i))
|
|
58
59
|
throw new Error(`Key "${i}" already exists in target object`);
|
|
@@ -60,16 +61,16 @@ function Z(e, t) {
|
|
|
60
61
|
}
|
|
61
62
|
return e;
|
|
62
63
|
}
|
|
63
|
-
function
|
|
64
|
+
function st(e) {
|
|
64
65
|
const t = document.createElement("template");
|
|
65
66
|
return t.innerHTML = e.trim(), t.content;
|
|
66
67
|
}
|
|
67
|
-
function
|
|
68
|
+
function N(e) {
|
|
68
69
|
if (e == null || e === "")
|
|
69
70
|
return null;
|
|
70
71
|
if (typeof e == "string")
|
|
71
72
|
try {
|
|
72
|
-
const t =
|
|
73
|
+
const t = st(e);
|
|
73
74
|
return t.childNodes.length === 1 ? t.firstChild : t;
|
|
74
75
|
} catch {
|
|
75
76
|
return document.createTextNode(e);
|
|
@@ -90,7 +91,7 @@ const r = {
|
|
|
90
91
|
Unknown: "unknown",
|
|
91
92
|
Outside: "outside"
|
|
92
93
|
};
|
|
93
|
-
function
|
|
94
|
+
function ot(e) {
|
|
94
95
|
switch (e) {
|
|
95
96
|
case r.Top:
|
|
96
97
|
return r.Bottom;
|
|
@@ -104,50 +105,50 @@ function Q(e) {
|
|
|
104
105
|
throw new Error(`[bwin] Invalid position: ${e}`);
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
|
-
function
|
|
108
|
+
function ht({ width: e, height: t, x: i }) {
|
|
108
109
|
return t / e * i;
|
|
109
110
|
}
|
|
110
|
-
function
|
|
111
|
+
function rt({ width: e, height: t, y: i }) {
|
|
111
112
|
return e / t * i;
|
|
112
113
|
}
|
|
113
|
-
function
|
|
114
|
+
function at({ width: e, height: t, x: i }) {
|
|
114
115
|
return t - t / e * i;
|
|
115
116
|
}
|
|
116
|
-
function
|
|
117
|
+
function lt({ width: e, height: t, y: i }) {
|
|
117
118
|
return e - e / t * i;
|
|
118
119
|
}
|
|
119
|
-
function
|
|
120
|
+
function dt(e, { clientX: t, clientY: i }) {
|
|
120
121
|
const n = e.getBoundingClientRect(), { width: s, height: o } = n, h = t - n.left, a = i - n.top;
|
|
121
122
|
if (h < 0 || h > s || a < 0 || a > o)
|
|
122
123
|
return r.Outside;
|
|
123
|
-
const d = 0.3,
|
|
124
|
-
return h < s * (0.5 - d / 2) && a >
|
|
124
|
+
const d = 0.3, l = ht({ width: s, height: o, x: h }), c = at({ width: s, height: o, x: h }), u = rt({ width: s, height: o, y: a }), g = lt({ width: s, height: o, y: a });
|
|
125
|
+
return h < s * (0.5 - d / 2) && a > l && a < c ? r.Left : h > s * (0.5 + d / 2) && a < l && a > c ? r.Right : a < o * (0.5 - d / 2) && h > u && h < g ? r.Top : a > o * (0.5 + d / 2) && h < u && h > g ? r.Bottom : h > s * (0.5 - d / 2) && h < s * (0.5 + d / 2) && a > o * (0.5 - d / 2) && a < o * (0.5 + d / 2) ? r.Center : r.Unknown;
|
|
125
126
|
}
|
|
126
|
-
const
|
|
127
|
+
const ct = 100, pt = 100, v = {
|
|
127
128
|
left: 0,
|
|
128
129
|
top: 0,
|
|
129
130
|
width: 150,
|
|
130
131
|
height: 150,
|
|
131
132
|
// Initial min values, real min width/height is calculated based on children
|
|
132
|
-
minWidth:
|
|
133
|
-
minHeight:
|
|
133
|
+
minWidth: ct,
|
|
134
|
+
minHeight: pt
|
|
134
135
|
};
|
|
135
|
-
class
|
|
136
|
+
class b {
|
|
136
137
|
constructor({
|
|
137
|
-
left: t =
|
|
138
|
-
top: i =
|
|
139
|
-
width: n =
|
|
140
|
-
height: s =
|
|
141
|
-
minWidth: o =
|
|
142
|
-
minHeight: h =
|
|
138
|
+
left: t = v.left,
|
|
139
|
+
top: i = v.top,
|
|
140
|
+
width: n = v.width,
|
|
141
|
+
height: s = v.height,
|
|
142
|
+
minWidth: o = v.minWidth,
|
|
143
|
+
minHeight: h = v.minHeight,
|
|
143
144
|
domNode: a = null,
|
|
144
145
|
store: d = {},
|
|
145
|
-
position:
|
|
146
|
-
id:
|
|
147
|
-
} =
|
|
148
|
-
if (this.id =
|
|
146
|
+
position: l,
|
|
147
|
+
id: c
|
|
148
|
+
} = v) {
|
|
149
|
+
if (this.id = c ?? B(), !l)
|
|
149
150
|
throw new Error("[bwin] Sash position is required");
|
|
150
|
-
this.position =
|
|
151
|
+
this.position = l, this.domNode = a, this._top = i, this._left = t, this._width = n, this._height = s, this.children = [], this.minWidth = o, this.minHeight = h, this.store = d;
|
|
151
152
|
}
|
|
152
153
|
walk(t) {
|
|
153
154
|
this.children.forEach((i) => i.walk(t)), t(this);
|
|
@@ -281,10 +282,10 @@ class m {
|
|
|
281
282
|
this._width = t;
|
|
282
283
|
const [n, s, o, h] = this.getChildren();
|
|
283
284
|
if (h && s) {
|
|
284
|
-
const a = h.width + s.width, d = i * (h.width / a),
|
|
285
|
-
let
|
|
286
|
-
const
|
|
287
|
-
|
|
285
|
+
const a = h.width + s.width, d = i * (h.width / a), l = a + i;
|
|
286
|
+
let c = h.width + d, u = l - c, g = s.left + d;
|
|
287
|
+
const m = h.calcMinWidth(), w = s.calcMinWidth();
|
|
288
|
+
c < m && u > w ? (c = m, u = l - c, g = h.left + c) : u < w && c > m && (u = w, c = l - u, g = h.left + c), h.width = c, s.width = u, s.left = g;
|
|
288
289
|
}
|
|
289
290
|
n && o && (n.width += i, o.width += i);
|
|
290
291
|
}
|
|
@@ -296,15 +297,15 @@ class m {
|
|
|
296
297
|
this._height = t;
|
|
297
298
|
const [n, s, o, h] = this.getChildren();
|
|
298
299
|
if (n && o) {
|
|
299
|
-
const a = n.height + o.height, d = i * (n.height / a),
|
|
300
|
-
let
|
|
301
|
-
const
|
|
302
|
-
|
|
300
|
+
const a = n.height + o.height, d = i * (n.height / a), l = a + i;
|
|
301
|
+
let c = n.height + d, u = l - c, g = o.top + d;
|
|
302
|
+
const m = n.calcMinHeight(), w = o.calcMinHeight();
|
|
303
|
+
c < m && u > w ? (c = m, u = l - c, g = n.top + c) : u < w && c > m && (u = w, c = l - u, g = n.top + c), n.height = c, o.height = u, o.top = g;
|
|
303
304
|
}
|
|
304
305
|
h && s && (h.height += i, s.height += i);
|
|
305
306
|
}
|
|
306
307
|
}
|
|
307
|
-
const
|
|
308
|
+
const H = {
|
|
308
309
|
size: "50%",
|
|
309
310
|
position: r.Left
|
|
310
311
|
};
|
|
@@ -318,14 +319,14 @@ class P {
|
|
|
318
319
|
minHeight: h,
|
|
319
320
|
position: a,
|
|
320
321
|
size: d,
|
|
321
|
-
...
|
|
322
|
+
...l
|
|
322
323
|
}) {
|
|
323
|
-
|
|
324
|
+
E(this, "left"), E(this, "top"), E(this, "width"), E(this, "height"), this.parentRect = t, this.children = i, this.siblingConfigNode = n, this.id = s, this.minWidth = o, this.minHeight = h, this.position = this.getPosition(a), this.size = this.getSize(d), this.nonCoreData = l, this.setBounds();
|
|
324
325
|
}
|
|
325
326
|
getPosition(t) {
|
|
326
327
|
if (!this.siblingConfigNode)
|
|
327
328
|
return t;
|
|
328
|
-
const i =
|
|
329
|
+
const i = ot(this.siblingConfigNode.position);
|
|
329
330
|
if (!t)
|
|
330
331
|
return i;
|
|
331
332
|
if (t !== i)
|
|
@@ -334,7 +335,7 @@ class P {
|
|
|
334
335
|
}
|
|
335
336
|
getSize(t) {
|
|
336
337
|
if (!this.siblingConfigNode)
|
|
337
|
-
return
|
|
338
|
+
return C(t);
|
|
338
339
|
if (!t) {
|
|
339
340
|
if (this.siblingConfigNode.size < 1)
|
|
340
341
|
return 1 - this.siblingConfigNode.size;
|
|
@@ -343,7 +344,7 @@ class P {
|
|
|
343
344
|
if (this.siblingConfigNode.position === r.Top || this.siblingConfigNode.position === r.Bottom)
|
|
344
345
|
return this.parentRect.height - this.siblingConfigNode.height;
|
|
345
346
|
}
|
|
346
|
-
const i =
|
|
347
|
+
const i = C(t);
|
|
347
348
|
if (i < 1) {
|
|
348
349
|
if (i + this.siblingConfigNode.size !== 1)
|
|
349
350
|
throw new Error("[bwin] Sum of sibling sizes is not equal to 1");
|
|
@@ -373,7 +374,7 @@ class P {
|
|
|
373
374
|
}
|
|
374
375
|
}
|
|
375
376
|
createSash() {
|
|
376
|
-
return new
|
|
377
|
+
return new b({
|
|
377
378
|
left: this.left,
|
|
378
379
|
top: this.top,
|
|
379
380
|
width: this.width,
|
|
@@ -386,14 +387,14 @@ class P {
|
|
|
386
387
|
});
|
|
387
388
|
}
|
|
388
389
|
normConfig(t) {
|
|
389
|
-
if (
|
|
390
|
+
if (it(t))
|
|
390
391
|
return t;
|
|
391
392
|
if (Array.isArray(t))
|
|
392
393
|
return {
|
|
393
394
|
children: t
|
|
394
395
|
};
|
|
395
396
|
if (typeof t == "string" || typeof t == "number") {
|
|
396
|
-
const i =
|
|
397
|
+
const i = C(t);
|
|
397
398
|
if (isNaN(i))
|
|
398
399
|
throw new Error(`[bwin] Invalid size value: ${i}`);
|
|
399
400
|
return {
|
|
@@ -408,8 +409,8 @@ class P {
|
|
|
408
409
|
createPrimaryConfigNode({ size: t, position: i, children: n, id: s, minWidth: o, minHeight: h, ...a }) {
|
|
409
410
|
return new P({
|
|
410
411
|
parentRect: this,
|
|
411
|
-
size: t ??
|
|
412
|
-
position: i ??
|
|
412
|
+
size: t ?? H.size,
|
|
413
|
+
position: i ?? H.position,
|
|
413
414
|
children: n,
|
|
414
415
|
id: s,
|
|
415
416
|
minWidth: o,
|
|
@@ -445,23 +446,23 @@ class P {
|
|
|
445
446
|
)), s && o && (t.children.push(s.buildSashTree()), t.children.push(o.buildSashTree())), t;
|
|
446
447
|
}
|
|
447
448
|
}
|
|
448
|
-
const
|
|
449
|
+
const L = {
|
|
449
450
|
width: 333,
|
|
450
451
|
height: 333
|
|
451
|
-
},
|
|
452
|
+
}, T = {
|
|
452
453
|
fitContainer: !1
|
|
453
454
|
};
|
|
454
|
-
class
|
|
455
|
+
class ut extends P {
|
|
455
456
|
constructor({
|
|
456
457
|
id: t,
|
|
457
458
|
children: i,
|
|
458
|
-
width: n =
|
|
459
|
-
height: s =
|
|
460
|
-
fitContainer: o =
|
|
459
|
+
width: n = L.width,
|
|
460
|
+
height: s = L.height,
|
|
461
|
+
fitContainer: o = T.fitContainer,
|
|
461
462
|
...h
|
|
462
463
|
} = {
|
|
463
|
-
...
|
|
464
|
-
|
|
464
|
+
...L,
|
|
465
|
+
...T
|
|
465
466
|
}) {
|
|
466
467
|
super({
|
|
467
468
|
id: t,
|
|
@@ -473,120 +474,120 @@ class rt extends P {
|
|
|
473
474
|
}), this.fitContainer = o;
|
|
474
475
|
}
|
|
475
476
|
}
|
|
476
|
-
class
|
|
477
|
-
constructor(t =
|
|
478
|
-
super({ ...t, position: r.Root }), Object.assign(this,
|
|
477
|
+
class gt extends b {
|
|
478
|
+
constructor(t = v) {
|
|
479
|
+
super({ ...t, position: r.Root }), Object.assign(this, T);
|
|
479
480
|
}
|
|
480
481
|
}
|
|
481
|
-
function
|
|
482
|
+
function M(e) {
|
|
482
483
|
const t = document.createElement("bw-pane");
|
|
483
484
|
return t.style.top = `${e.top}px`, t.style.left = `${e.left}px`, t.style.width = `${e.width}px`, t.style.height = `${e.height}px`, t.setAttribute("sash-id", e.id), t.setAttribute("position", e.position), t;
|
|
484
485
|
}
|
|
485
|
-
function
|
|
486
|
+
function ft(e) {
|
|
486
487
|
const t = e.domNode;
|
|
487
488
|
return t.style.top = `${e.top}px`, t.style.left = `${e.left}px`, t.style.width = `${e.width}px`, t.style.height = `${e.height}px`, t.setAttribute("position", e.position), t;
|
|
488
489
|
}
|
|
489
|
-
function
|
|
490
|
-
const i =
|
|
490
|
+
function mt(e, { size: t }) {
|
|
491
|
+
const i = C(t);
|
|
491
492
|
let n = e.width / 2;
|
|
492
493
|
i && (i < 1 ? n = e.width * i : n = i);
|
|
493
|
-
const s = new
|
|
494
|
+
const s = new b({
|
|
494
495
|
top: e.top,
|
|
495
496
|
left: e.left,
|
|
496
497
|
width: n,
|
|
497
498
|
height: e.height,
|
|
498
499
|
position: r.Left
|
|
499
|
-
}), o = new
|
|
500
|
+
}), o = new b({
|
|
500
501
|
top: e.top,
|
|
501
502
|
left: e.left + s.width,
|
|
502
503
|
width: e.width - n,
|
|
503
504
|
height: e.height,
|
|
504
505
|
position: r.Right
|
|
505
|
-
}), h =
|
|
506
|
-
return o.domNode = h,
|
|
506
|
+
}), h = M(o);
|
|
507
|
+
return o.domNode = h, z(h, e.domNode), e.addChild(s), e.addChild(o), s;
|
|
507
508
|
}
|
|
508
|
-
function
|
|
509
|
-
const i =
|
|
509
|
+
function wt(e, { size: t }) {
|
|
510
|
+
const i = C(t);
|
|
510
511
|
let n = e.width / 2;
|
|
511
512
|
i && (i < 1 ? n = e.width * i : n = i);
|
|
512
|
-
const s = new
|
|
513
|
+
const s = new b({
|
|
513
514
|
left: e.left,
|
|
514
515
|
top: e.top,
|
|
515
516
|
width: e.width - n,
|
|
516
517
|
height: e.height,
|
|
517
518
|
position: r.Left
|
|
518
|
-
}), o = new
|
|
519
|
+
}), o = new b({
|
|
519
520
|
left: e.left + s.width,
|
|
520
521
|
top: e.top,
|
|
521
522
|
width: n,
|
|
522
523
|
height: e.height,
|
|
523
524
|
position: r.Right
|
|
524
|
-
}), h =
|
|
525
|
-
return s.domNode = h,
|
|
525
|
+
}), h = M(s);
|
|
526
|
+
return s.domNode = h, z(h, e.domNode), e.addChild(s), e.addChild(o), o;
|
|
526
527
|
}
|
|
527
|
-
function
|
|
528
|
-
const i =
|
|
528
|
+
function bt(e, { size: t }) {
|
|
529
|
+
const i = C(t);
|
|
529
530
|
let n = e.height / 2;
|
|
530
531
|
i && (i < 1 ? n = e.height * i : n = i);
|
|
531
|
-
const s = new
|
|
532
|
+
const s = new b({
|
|
532
533
|
left: e.left,
|
|
533
534
|
top: e.top,
|
|
534
535
|
width: e.width,
|
|
535
536
|
height: n,
|
|
536
537
|
position: r.Top
|
|
537
|
-
}), o = new
|
|
538
|
+
}), o = new b({
|
|
538
539
|
left: e.left,
|
|
539
540
|
top: e.top + s.height,
|
|
540
541
|
width: e.width,
|
|
541
542
|
height: e.height - n,
|
|
542
543
|
position: r.Bottom
|
|
543
|
-
}), h =
|
|
544
|
-
return o.domNode = h,
|
|
544
|
+
}), h = M(o);
|
|
545
|
+
return o.domNode = h, z(h, e.domNode), e.addChild(s), e.addChild(o), s;
|
|
545
546
|
}
|
|
546
|
-
function
|
|
547
|
-
const i =
|
|
547
|
+
function Et(e, { size: t }) {
|
|
548
|
+
const i = C(t);
|
|
548
549
|
let n = e.height / 2;
|
|
549
550
|
i && (i < 1 ? n = e.height * i : n = i);
|
|
550
|
-
const s = new
|
|
551
|
+
const s = new b({
|
|
551
552
|
top: e.top,
|
|
552
553
|
left: e.left,
|
|
553
554
|
width: e.width,
|
|
554
555
|
height: e.height - n,
|
|
555
556
|
position: r.Top
|
|
556
|
-
}), o = new
|
|
557
|
+
}), o = new b({
|
|
557
558
|
top: e.top + s.height,
|
|
558
559
|
left: e.left,
|
|
559
560
|
width: e.width,
|
|
560
561
|
height: n,
|
|
561
562
|
position: r.Bottom
|
|
562
|
-
}), h =
|
|
563
|
-
return s.domNode = h,
|
|
563
|
+
}), h = M(s);
|
|
564
|
+
return s.domNode = h, z(h, e.domNode), e.addChild(s), e.addChild(o), o;
|
|
564
565
|
}
|
|
565
|
-
function
|
|
566
|
+
function yt(e, { position: t, size: i, minWidth: n, minHeight: s }) {
|
|
566
567
|
if (t === r.Left)
|
|
567
|
-
return
|
|
568
|
+
return mt(e, { size: i });
|
|
568
569
|
if (t === r.Right)
|
|
569
|
-
return
|
|
570
|
+
return wt(e, { size: i });
|
|
570
571
|
if (t === r.Top)
|
|
571
|
-
return
|
|
572
|
+
return bt(e, { size: i });
|
|
572
573
|
if (t === r.Bottom)
|
|
573
|
-
return
|
|
574
|
+
return Et(e, { size: i });
|
|
574
575
|
}
|
|
575
|
-
const
|
|
576
|
+
const vt = {
|
|
576
577
|
createPane(e) {
|
|
577
|
-
const t =
|
|
578
|
+
const t = M(e);
|
|
578
579
|
return e.store.droppable === !1 && t.setAttribute("can-drop", "false"), t;
|
|
579
580
|
},
|
|
580
581
|
// Intended to be overridden
|
|
581
582
|
onPaneCreate(e, t) {
|
|
582
|
-
t.store.content && e.append(
|
|
583
|
+
t.store.content && e.append(N(t.store.content)), this != null && this.debug && (e.style.backgroundColor = tt(), e.innerHTML = "", e.append(G(e)));
|
|
583
584
|
},
|
|
584
585
|
updatePane(e) {
|
|
585
|
-
return
|
|
586
|
+
return ft(e);
|
|
586
587
|
},
|
|
587
588
|
// Intended to be overridden
|
|
588
589
|
onPaneUpdate(e, t) {
|
|
589
|
-
this != null && this.debug && (e.innerHTML = "", e.append(
|
|
590
|
+
this != null && this.debug && (e.innerHTML = "", e.append(G(e)));
|
|
590
591
|
},
|
|
591
592
|
/**
|
|
592
593
|
* Add a pane into the target pane. The two panes become next to each other
|
|
@@ -599,8 +600,8 @@ const ft = {
|
|
|
599
600
|
if (!t) throw new Error("[bwin] Position is required when adding pane");
|
|
600
601
|
const n = this.rootSash.getById(e);
|
|
601
602
|
if (!n) throw new Error("[bwin] Parent sash not found when adding pane");
|
|
602
|
-
const s =
|
|
603
|
-
return n.id =
|
|
603
|
+
const s = yt(n, { position: t, size: i });
|
|
604
|
+
return n.id = B(), this.update(), s;
|
|
604
605
|
},
|
|
605
606
|
/**
|
|
606
607
|
* Remove a pane
|
|
@@ -611,10 +612,10 @@ const ft = {
|
|
|
611
612
|
const t = this.rootSash.getDescendantParentById(e);
|
|
612
613
|
if (!t) throw new Error("[bwin] Parent sash not found when removing pane");
|
|
613
614
|
const i = t.getChildSiblingById(e);
|
|
614
|
-
t.id =
|
|
615
|
+
t.id = B(), i.children.length === 0 ? (t.domNode = i.domNode, t.domNode.setAttribute("sash-id", t.id), t.children = []) : (t.children = i.children, i.position === r.Left ? i.width = t.width : i.position === r.Right ? (i.width = t.width, i.left = t.left) : i.position === r.Top ? i.height = t.height : i.position === r.Bottom && (i.height = t.height, i.top = t.top)), this.update();
|
|
615
616
|
}
|
|
616
617
|
};
|
|
617
|
-
function
|
|
618
|
+
function G(e) {
|
|
618
619
|
const t = document.createElement("pre");
|
|
619
620
|
t.style.fontSize = "10px";
|
|
620
621
|
const i = `
|
|
@@ -627,10 +628,10 @@ height: ${e.style.height}
|
|
|
627
628
|
`;
|
|
628
629
|
return t.innerHTML = i.trim(), t;
|
|
629
630
|
}
|
|
630
|
-
const
|
|
631
|
+
const Nt = {
|
|
631
632
|
createWindow() {
|
|
632
633
|
const e = document.createElement("bw-window");
|
|
633
|
-
return e.style.width = `${this.rootSash.width}px`, e.style.height = `${this.rootSash.height}px`, e.setAttribute("sash-id", this.rootSash.id), e;
|
|
634
|
+
return e.style.width = `${this.rootSash.width}px`, e.style.height = `${this.rootSash.height}px`, e.setAttribute("root-sash-id", this.rootSash.id), e;
|
|
634
635
|
},
|
|
635
636
|
glaze() {
|
|
636
637
|
this.rootSash.walk((e) => {
|
|
@@ -648,7 +649,7 @@ const wt = {
|
|
|
648
649
|
i.children.length > 0 ? t.includes(i.id) ? (this.updateMuntin(i), this.onMuntinUpdate(i.domNode, i)) : (i.domNode = this.createMuntin(i), this.windowElement.append(i.domNode)) : t.includes(i.id) ? (this.updatePane(i), this.onPaneUpdate(i.domNode, i)) : (i.domNode || (i.domNode = this.createPane(i)), this.windowElement.prepend(i.domNode));
|
|
649
650
|
});
|
|
650
651
|
}
|
|
651
|
-
},
|
|
652
|
+
}, zt = {
|
|
652
653
|
muntinSize: 4,
|
|
653
654
|
createMuntin(e) {
|
|
654
655
|
const t = document.createElement("bw-muntin"), i = e.leftChild, n = e.topChild;
|
|
@@ -662,7 +663,7 @@ const wt = {
|
|
|
662
663
|
},
|
|
663
664
|
onMuntinUpdate(e, t) {
|
|
664
665
|
}
|
|
665
|
-
},
|
|
666
|
+
}, Ct = {
|
|
666
667
|
fitContainer: !1,
|
|
667
668
|
fit() {
|
|
668
669
|
this.rootSash.width = this.containerElement.clientWidth, this.rootSash.height = this.containerElement.clientHeight, this.update();
|
|
@@ -673,7 +674,7 @@ const wt = {
|
|
|
673
674
|
t.target === this.containerElement && this.fitContainer && this.fit();
|
|
674
675
|
}).observe(this.containerElement);
|
|
675
676
|
}
|
|
676
|
-
},
|
|
677
|
+
}, St = {
|
|
677
678
|
activeMuntinSash: null,
|
|
678
679
|
isResizeStarted: !1,
|
|
679
680
|
isDropStarted: !1,
|
|
@@ -694,21 +695,21 @@ const wt = {
|
|
|
694
695
|
if (!this.isResizeStarted || !this.activeMuntinSash) return;
|
|
695
696
|
const [t, i, n, s] = this.activeMuntinSash.getChildren(), o = this.activeMuntinSash.isLeftRightSplit(), h = this.activeMuntinSash.isTopBottomSplit();
|
|
696
697
|
if (o && s && i) {
|
|
697
|
-
const a = e.pageX - this.lastX, d = s.width + a,
|
|
698
|
-
if (d <= s.calcMinWidth() ||
|
|
698
|
+
const a = e.pageX - this.lastX, d = s.width + a, l = i.width - a;
|
|
699
|
+
if (d <= s.calcMinWidth() || l <= i.calcMinWidth())
|
|
699
700
|
return;
|
|
700
|
-
s.width = d, i.width =
|
|
701
|
+
s.width = d, i.width = l, i.left = i.left + a, this.update(), this.lastX = e.pageX;
|
|
701
702
|
} else if (h && t && n) {
|
|
702
|
-
const a = e.pageY - this.lastY, d = t.height + a,
|
|
703
|
-
if (d <= t.calcMinHeight() ||
|
|
703
|
+
const a = e.pageY - this.lastY, d = t.height + a, l = n.height - a;
|
|
704
|
+
if (d <= t.calcMinHeight() || l <= n.calcMinHeight())
|
|
704
705
|
return;
|
|
705
|
-
t.height = d, n.height =
|
|
706
|
+
t.height = d, n.height = l, n.top = n.top + a, this.update(), this.lastY = e.pageY;
|
|
706
707
|
}
|
|
707
708
|
}), document.addEventListener("mouseup", () => {
|
|
708
709
|
this.isResizeStarted = !1, this.activeMuntinSash = null, this.revertResizeStyles();
|
|
709
710
|
});
|
|
710
711
|
}
|
|
711
|
-
},
|
|
712
|
+
}, Mt = {
|
|
712
713
|
activeDropPaneEl: null,
|
|
713
714
|
// Intended to be overridden in `BinaryWindow` class
|
|
714
715
|
onPaneDrop(e, t) {
|
|
@@ -718,7 +719,7 @@ const wt = {
|
|
|
718
719
|
e.preventDefault();
|
|
719
720
|
const t = e.target.matches("bw-pane") ? e.target : e.target.closest("bw-pane");
|
|
720
721
|
if (!t || (t !== this.activeDropPaneEl && (this.activeDropPaneEl && this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = t), t.getAttribute("can-drop") === "false")) return;
|
|
721
|
-
const i =
|
|
722
|
+
const i = dt(t, e);
|
|
722
723
|
t.setAttribute("drop-area", i);
|
|
723
724
|
}), this.windowElement.addEventListener("dragleave", (e) => {
|
|
724
725
|
e.currentTarget.contains(e.relatedTarget) && e.currentTarget !== e.relatedTarget || this.activeDropPaneEl && (this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = null);
|
|
@@ -728,12 +729,12 @@ const wt = {
|
|
|
728
729
|
this.onPaneDrop(e, i), typeof i.store.onDrop == "function" && i.store.onDrop(e, i), this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = null;
|
|
729
730
|
});
|
|
730
731
|
}
|
|
731
|
-
},
|
|
732
|
-
class
|
|
732
|
+
}, At = !1;
|
|
733
|
+
class O {
|
|
733
734
|
constructor(t) {
|
|
734
|
-
|
|
735
|
+
E(this, "windowElement", null), E(this, "containerElement", null), E(this, "debug", At);
|
|
735
736
|
let i = null;
|
|
736
|
-
t instanceof
|
|
737
|
+
t instanceof gt ? (i = t, this.rootSash = t) : (i = new ut(t), this.rootSash = i.buildSashTree()), this.fitContainer = i.fitContainer;
|
|
737
738
|
}
|
|
738
739
|
frame(t) {
|
|
739
740
|
this.containerElement = t, this.windowElement = this.createWindow(), this.glaze(), this.containerElement.append(this.windowElement);
|
|
@@ -747,19 +748,19 @@ class H {
|
|
|
747
748
|
}
|
|
748
749
|
static assemble(...t) {
|
|
749
750
|
t.forEach((i) => {
|
|
750
|
-
|
|
751
|
+
nt(this.prototype, i);
|
|
751
752
|
});
|
|
752
753
|
}
|
|
753
754
|
}
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
755
|
+
O.assemble(
|
|
756
|
+
Nt,
|
|
757
|
+
zt,
|
|
758
|
+
vt,
|
|
759
|
+
Ct,
|
|
760
|
+
Mt,
|
|
761
|
+
St
|
|
761
762
|
);
|
|
762
|
-
function
|
|
763
|
+
function k(e) {
|
|
763
764
|
if (e.tagName === "BW-PANE")
|
|
764
765
|
return e.getAttribute("sash-id");
|
|
765
766
|
const t = e.closest("bw-pane");
|
|
@@ -767,25 +768,25 @@ function G(e) {
|
|
|
767
768
|
throw new Error("[bwin] Pane element not found");
|
|
768
769
|
return t.getAttribute("sash-id");
|
|
769
770
|
}
|
|
770
|
-
const
|
|
771
|
+
const Rt = {
|
|
771
772
|
label: "",
|
|
772
773
|
className: "bw-glass-action--close",
|
|
773
774
|
onClick: (e, t) => {
|
|
774
|
-
const i =
|
|
775
|
+
const i = k(e.target);
|
|
775
776
|
t.removePane(i);
|
|
776
777
|
}
|
|
777
|
-
},
|
|
778
|
+
}, Pt = {
|
|
778
779
|
label: "",
|
|
779
780
|
className: "bw-glass-action--minimize",
|
|
780
781
|
onClick: (e, t) => {
|
|
781
782
|
const i = t.sillElement;
|
|
782
783
|
if (!i) throw new Error("[bwin] Sill element not found when minimizing");
|
|
783
|
-
const n =
|
|
784
|
+
const n = N('<button class="bw-minimized-glass" />');
|
|
784
785
|
i.append(n);
|
|
785
786
|
const s = e.target.closest("bw-pane"), o = e.target.closest("bw-glass"), h = s.getAttribute("sash-id"), a = s.getAttribute("position");
|
|
786
787
|
n.bwGlassElement = o, n.bwOriginalPosition = a, n.bwOriginalBoundingRect = R(s), t.removePane(h);
|
|
787
788
|
}
|
|
788
|
-
},
|
|
789
|
+
}, xt = {
|
|
789
790
|
label: "",
|
|
790
791
|
className: "bw-glass-action--maximize",
|
|
791
792
|
onClick: (e) => {
|
|
@@ -793,19 +794,19 @@ const Nt = {
|
|
|
793
794
|
t.hasAttribute("maximized") ? (t.removeAttribute("maximized"), t.style.left = `${t.bwOriginalBoundingRect.left}px`, t.style.top = `${t.bwOriginalBoundingRect.top}px`, t.style.width = `${t.bwOriginalBoundingRect.width}px`, t.style.height = `${t.bwOriginalBoundingRect.height}px`) : (t.setAttribute("maximized", ""), t.bwOriginalBoundingRect = R(t), t.style.left = "0", t.style.top = "0", t.style.width = "100%", t.style.height = "100%");
|
|
794
795
|
}
|
|
795
796
|
};
|
|
796
|
-
function
|
|
797
|
+
function Dt(e, t) {
|
|
797
798
|
const i = e.left + e.width, n = e.top + e.height, s = t.left + t.width, o = t.top + t.height;
|
|
798
799
|
if (e.left >= s || t.left >= i || e.top >= o || t.top >= n)
|
|
799
800
|
return null;
|
|
800
|
-
const h = Math.max(e.left, t.left), a = Math.max(e.top, t.top), d = Math.min(i, s),
|
|
801
|
+
const h = Math.max(e.left, t.left), a = Math.max(e.top, t.top), d = Math.min(i, s), l = Math.min(n, o);
|
|
801
802
|
return {
|
|
802
803
|
left: h,
|
|
803
804
|
top: a,
|
|
804
805
|
width: d - h,
|
|
805
|
-
height:
|
|
806
|
+
height: l - a
|
|
806
807
|
};
|
|
807
808
|
}
|
|
808
|
-
const
|
|
809
|
+
const F = [Pt, xt, Rt], $t = {
|
|
809
810
|
enableActions() {
|
|
810
811
|
this.handleMinimizedGlassClick(), this.observeActionButtons();
|
|
811
812
|
},
|
|
@@ -813,7 +814,7 @@ const I = [zt, Ct, Nt], At = {
|
|
|
813
814
|
const t = e.bwOriginalBoundingRect;
|
|
814
815
|
let i = 0, n = null;
|
|
815
816
|
if (this.windowElement.querySelectorAll("bw-pane").forEach((s) => {
|
|
816
|
-
const o = R(s), h =
|
|
817
|
+
const o = R(s), h = Dt(t, o);
|
|
817
818
|
if (h) {
|
|
818
819
|
const a = h.width * h.height;
|
|
819
820
|
a > i && (i = a, n = s);
|
|
@@ -861,24 +862,24 @@ const I = [zt, Ct, Nt], At = {
|
|
|
861
862
|
childList: !0
|
|
862
863
|
});
|
|
863
864
|
}
|
|
864
|
-
},
|
|
865
|
+
}, S = {
|
|
865
866
|
title: null,
|
|
866
867
|
content: null,
|
|
867
868
|
tabs: [],
|
|
868
869
|
actions: void 0,
|
|
869
870
|
draggable: !0
|
|
870
871
|
};
|
|
871
|
-
class
|
|
872
|
+
class I {
|
|
872
873
|
constructor({
|
|
873
|
-
title: t =
|
|
874
|
-
content: i =
|
|
875
|
-
tabs: n =
|
|
876
|
-
actions: s =
|
|
877
|
-
draggable: o =
|
|
874
|
+
title: t = S.title,
|
|
875
|
+
content: i = S.content,
|
|
876
|
+
tabs: n = S.tabs,
|
|
877
|
+
actions: s = S.actions,
|
|
878
|
+
draggable: o = S.draggable,
|
|
878
879
|
sash: h,
|
|
879
880
|
binaryWindow: a
|
|
880
881
|
}) {
|
|
881
|
-
|
|
882
|
+
E(this, "domNode"), this.title = t, this.content = i, this.tabs = n, this.actions = s, this.sash = h, this.draggable = o, this.binaryWindow = a, this.build();
|
|
882
883
|
}
|
|
883
884
|
build() {
|
|
884
885
|
const t = document.createElement("bw-glass-header");
|
|
@@ -886,24 +887,24 @@ class W {
|
|
|
886
887
|
t.append(this.createTabs());
|
|
887
888
|
else if (this.title) {
|
|
888
889
|
const s = document.createElement("bw-glass-title");
|
|
889
|
-
s.append(
|
|
890
|
+
s.append(N(this.title)), t.append(s);
|
|
890
891
|
}
|
|
891
892
|
t.setAttribute("can-drag", this.draggable), t.append(this.createActions());
|
|
892
|
-
const i = document.createElement("bw-glass-content"), n =
|
|
893
|
+
const i = document.createElement("bw-glass-content"), n = N(this.content);
|
|
893
894
|
n && i.append(n), this.domNode = document.createElement("bw-glass"), this.domNode.append(t, i);
|
|
894
895
|
}
|
|
895
896
|
createTabs() {
|
|
896
897
|
const t = document.createElement("bw-glass-tab-container");
|
|
897
898
|
for (const i of this.tabs) {
|
|
898
|
-
const n = (i == null ? void 0 : i.label) ?? i, s =
|
|
899
|
+
const n = (i == null ? void 0 : i.label) ?? i, s = N(`<button class="bw-glass-tab">${n}</button>`);
|
|
899
900
|
t.append(s);
|
|
900
901
|
}
|
|
901
902
|
return t;
|
|
902
903
|
}
|
|
903
904
|
createActions() {
|
|
904
|
-
const t = document.createElement("bw-glass-action-container"), i = this.actions === void 0 ?
|
|
905
|
+
const t = document.createElement("bw-glass-action-container"), i = this.actions === void 0 ? F : Array.isArray(this.actions) ? this.actions : [];
|
|
905
906
|
for (const n of i) {
|
|
906
|
-
const s = (n == null ? void 0 : n.label) ?? n, o = n.className ? `bw-glass-action ${n.className}` : "bw-glass-action", h =
|
|
907
|
+
const s = (n == null ? void 0 : n.label) ?? n, o = n.className ? `bw-glass-action ${n.className}` : "bw-glass-action", h = N(`<button class="${o}">${s}</button>`);
|
|
907
908
|
typeof n.onClick == "function" && h.addEventListener("click", (a) => {
|
|
908
909
|
n.onClick(a, this.binaryWindow);
|
|
909
910
|
}), t.append(h);
|
|
@@ -917,7 +918,7 @@ class W {
|
|
|
917
918
|
return this.domNode.querySelector("bw-glass-header");
|
|
918
919
|
}
|
|
919
920
|
}
|
|
920
|
-
const
|
|
921
|
+
const Lt = {
|
|
921
922
|
activeDragGlassEl: null,
|
|
922
923
|
activeDragGlassPaneCanDrop: !1,
|
|
923
924
|
onPaneDrop(e, t) {
|
|
@@ -925,10 +926,10 @@ const Mt = {
|
|
|
925
926
|
const i = this.activeDropPaneEl.getAttribute("drop-area");
|
|
926
927
|
if (i === "center") {
|
|
927
928
|
const n = this.activeDragGlassEl.closest("bw-pane"), s = this.activeDropPaneEl.getAttribute("can-drop") !== "false";
|
|
928
|
-
|
|
929
|
+
et(n, this.activeDropPaneEl), n.setAttribute("can-drop", s);
|
|
929
930
|
return;
|
|
930
931
|
} else {
|
|
931
|
-
const n =
|
|
932
|
+
const n = k(this.activeDragGlassEl);
|
|
932
933
|
this.addPane(t.id, { position: i }).domNode.append(this.activeDragGlassEl), this.removePane(n);
|
|
933
934
|
}
|
|
934
935
|
},
|
|
@@ -953,7 +954,7 @@ const Mt = {
|
|
|
953
954
|
this.activeDragGlassEl && (this.activeDragGlassEl.removeAttribute("draggable"), this.activeDragGlassEl.closest("bw-pane").setAttribute("can-drop", this.activeDragGlassPaneCanDrop), this.activeDragGlassEl = null);
|
|
954
955
|
});
|
|
955
956
|
}
|
|
956
|
-
},
|
|
957
|
+
}, Bt = {
|
|
957
958
|
trimMuntin(e) {
|
|
958
959
|
e.hasAttribute("vertical") ? (e.style.top = `${parseFloat(e.style.top) + this.muntinSize / 2}px`, e.style.height = `${parseFloat(e.style.height) - this.muntinSize}px`) : e.hasAttribute("horizontal") && (e.style.left = `${parseFloat(e.style.left) + this.muntinSize / 2}px`, e.style.width = `${parseFloat(e.style.width) - this.muntinSize}px`);
|
|
959
960
|
},
|
|
@@ -964,62 +965,45 @@ const Mt = {
|
|
|
964
965
|
this.trimMuntin(e);
|
|
965
966
|
}
|
|
966
967
|
};
|
|
967
|
-
class
|
|
968
|
+
class _ extends O {
|
|
968
969
|
constructor() {
|
|
969
|
-
super(...arguments),
|
|
970
|
+
super(...arguments), E(this, "sillElement", null);
|
|
970
971
|
}
|
|
971
972
|
frame() {
|
|
972
973
|
super.frame(...arguments);
|
|
973
|
-
const t =
|
|
974
|
+
const t = N("<bw-sill />");
|
|
974
975
|
this.windowElement.append(t), this.sillElement = t;
|
|
975
976
|
}
|
|
976
977
|
enableFeatures() {
|
|
977
978
|
super.enableFeatures(), this.enableDrag(), this.enableActions();
|
|
978
979
|
}
|
|
979
980
|
onPaneCreate(t, i) {
|
|
980
|
-
const n = new
|
|
981
|
+
const n = new I({ ...i.store, sash: i, binaryWindow: this });
|
|
981
982
|
t.innerHTML = "", t.append(n.domNode), this.debug && n.contentElement.prepend(`${i.id}`);
|
|
982
983
|
}
|
|
983
984
|
onPaneUpdate() {
|
|
984
985
|
}
|
|
985
986
|
/**
|
|
986
|
-
* Add glass into the target pane.
|
|
987
|
-
*
|
|
988
|
-
* @param {string} paneSashId - The Sash ID of the pane that the glass moves into
|
|
989
|
-
* @param {'top'|'right'|'bottom'|'left'} position - The position of the glass relative to the target pane
|
|
990
|
-
* @param {Object} glassProps - The glass properties
|
|
991
|
-
*
|
|
992
|
-
*/
|
|
993
|
-
addGlass(t, i, n) {
|
|
994
|
-
const s = this.addPane(t, { position: i }), o = new W({ ...n, sash: s, binaryWindow: this });
|
|
995
|
-
s.domNode.append(o.domNode);
|
|
996
|
-
}
|
|
997
|
-
/**
|
|
998
|
-
* Remove glass from or together with the pane
|
|
987
|
+
* Add a pane with glass into the target pane.
|
|
999
988
|
*
|
|
1000
|
-
* @param {string}
|
|
1001
|
-
* @param {
|
|
989
|
+
* @param {string} targetPaneId - The Sash ID of the target pane
|
|
990
|
+
* @param {Object} props - The pane and glass properties grouped together
|
|
991
|
+
* @returns {Sash} - The newly created Sash
|
|
1002
992
|
*/
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
else {
|
|
1007
|
-
const n = this.rootSash.getById(t);
|
|
1008
|
-
if (!n) throw new Error("[bwin] Pane not found when removing glass");
|
|
1009
|
-
const s = n.domNode.querySelector("bw-glass");
|
|
1010
|
-
s && s.remove();
|
|
1011
|
-
}
|
|
993
|
+
addPane(t, i) {
|
|
994
|
+
const { position: n, size: s, ...o } = i, h = super.addPane(t, { position: n, size: s }), a = new I({ ...o, sash: h, binaryWindow: this });
|
|
995
|
+
return h.domNode.append(a.domNode), h;
|
|
1012
996
|
}
|
|
1013
997
|
}
|
|
1014
|
-
|
|
998
|
+
_.assemble(Lt, Bt, $t);
|
|
1015
999
|
const y = 4;
|
|
1016
|
-
function
|
|
1017
|
-
var
|
|
1018
|
-
const t =
|
|
1019
|
-
let s, o, h, a, d,
|
|
1020
|
-
return i ? (s = y, o = e.height - y, h = e.top + y / 2, a = e.left + i.width - y / 2, d = !0) : n && (s = e.width - y, o = y, h = e.top + n.height - y / 2, a = e.left + y / 2,
|
|
1000
|
+
function Tt({ sash: e }) {
|
|
1001
|
+
var c;
|
|
1002
|
+
const t = A(), i = e.leftChild, n = e.topChild;
|
|
1003
|
+
let s, o, h, a, d, l;
|
|
1004
|
+
return i ? (s = y, o = e.height - y, h = e.top + y / 2, a = e.left + i.width - y / 2, d = !0) : n && (s = e.width - y, o = y, h = e.top + n.height - y / 2, a = e.left + y / 2, l = !0), W(() => {
|
|
1021
1005
|
e.domNode = t.current;
|
|
1022
|
-
}, []), /* @__PURE__ */
|
|
1006
|
+
}, []), /* @__PURE__ */ f.createElement(
|
|
1023
1007
|
"bw-muntin",
|
|
1024
1008
|
{
|
|
1025
1009
|
"sash-id": e.id,
|
|
@@ -1030,78 +1014,92 @@ function Pt({ sash: e }) {
|
|
|
1030
1014
|
left: a
|
|
1031
1015
|
},
|
|
1032
1016
|
vertical: d,
|
|
1033
|
-
horizontal:
|
|
1034
|
-
resizable: ((
|
|
1017
|
+
horizontal: l,
|
|
1018
|
+
resizable: ((c = e.store) == null ? void 0 : c.resizable) === !1 ? "false" : "true",
|
|
1035
1019
|
ref: t
|
|
1036
1020
|
}
|
|
1037
1021
|
);
|
|
1038
1022
|
}
|
|
1039
|
-
function
|
|
1023
|
+
function Wt({
|
|
1040
1024
|
sash: e,
|
|
1041
1025
|
bwin: t
|
|
1042
1026
|
}) {
|
|
1043
|
-
var
|
|
1044
|
-
const i =
|
|
1045
|
-
|
|
1027
|
+
var c, u, g, m, w;
|
|
1028
|
+
const i = A(), { left: n, top: s, width: o, height: h, id: a, position: d } = e;
|
|
1029
|
+
W(() => {
|
|
1046
1030
|
e.domNode = i.current;
|
|
1047
1031
|
}, []);
|
|
1048
|
-
const
|
|
1049
|
-
return /* @__PURE__ */
|
|
1032
|
+
const l = ((c = e.store) == null ? void 0 : c.actions) === void 0 ? F : Array.isArray(e.store.actions) ? e.store.actions : [];
|
|
1033
|
+
return /* @__PURE__ */ f.createElement(
|
|
1050
1034
|
"bw-pane",
|
|
1051
1035
|
{
|
|
1052
1036
|
"sash-id": a,
|
|
1053
1037
|
position: d,
|
|
1054
1038
|
style: { left: n, top: s, width: o, height: h },
|
|
1055
|
-
"can-drop": ((
|
|
1039
|
+
"can-drop": ((u = e.store) == null ? void 0 : u.droppable) === !1 ? "false" : "true",
|
|
1056
1040
|
ref: i
|
|
1057
1041
|
},
|
|
1058
|
-
/* @__PURE__ */
|
|
1042
|
+
/* @__PURE__ */ f.createElement("bw-glass", null, /* @__PURE__ */ f.createElement(
|
|
1059
1043
|
"bw-glass-header",
|
|
1060
1044
|
{
|
|
1061
|
-
"can-drag": ((
|
|
1045
|
+
"can-drag": ((g = e.store) == null ? void 0 : g.draggable) === !1 ? "false" : "true"
|
|
1062
1046
|
},
|
|
1063
|
-
((
|
|
1064
|
-
|
|
1065
|
-
const
|
|
1066
|
-
return /* @__PURE__ */
|
|
1047
|
+
((m = e.store) == null ? void 0 : m.title) && /* @__PURE__ */ f.createElement("bw-glass-title", null, e.store.title),
|
|
1048
|
+
l.length > 0 && /* @__PURE__ */ f.createElement("bw-glass-action-container", null, l.map((p, x) => {
|
|
1049
|
+
const D = p.className ? `bw-glass-action ${p.className}` : "bw-glass-action";
|
|
1050
|
+
return /* @__PURE__ */ f.createElement(
|
|
1067
1051
|
"button",
|
|
1068
1052
|
{
|
|
1069
|
-
className:
|
|
1070
|
-
key:
|
|
1071
|
-
onClick: (
|
|
1053
|
+
className: D,
|
|
1054
|
+
key: x,
|
|
1055
|
+
onClick: ($) => p.onClick($, t)
|
|
1072
1056
|
},
|
|
1073
|
-
|
|
1057
|
+
p.label
|
|
1074
1058
|
);
|
|
1075
1059
|
}))
|
|
1076
|
-
), /* @__PURE__ */
|
|
1060
|
+
), /* @__PURE__ */ f.createElement("bw-glass-content", null, (w = e.store) == null ? void 0 : w.content))
|
|
1077
1061
|
);
|
|
1078
1062
|
}
|
|
1079
|
-
const
|
|
1080
|
-
const i =
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
}),
|
|
1084
|
-
const
|
|
1085
|
-
|
|
1086
|
-
}, []),
|
|
1063
|
+
const It = Y((e, t) => {
|
|
1064
|
+
const i = A(), n = A(), [s, o] = j(), { panes: h, ...a } = e, d = { ...a, children: h }, l = new _(d), c = [], u = [];
|
|
1065
|
+
l.rootSash.walk((p) => {
|
|
1066
|
+
p.children.length > 0 ? c.push(p) : u.push(p);
|
|
1067
|
+
}), W(() => {
|
|
1068
|
+
const p = i.current;
|
|
1069
|
+
p != null && p.parentElement && (l.windowElement = p, l.containerElement = p.parentElement, l.sillElement = n.current, l.enableFeatures());
|
|
1070
|
+
}, []), K(
|
|
1087
1071
|
t,
|
|
1088
1072
|
() => ({
|
|
1089
|
-
|
|
1073
|
+
fit: l.fit.bind(l),
|
|
1074
|
+
removePane: l.removePane.bind(l),
|
|
1075
|
+
addPane: w
|
|
1090
1076
|
}),
|
|
1091
1077
|
[]
|
|
1092
|
-
)
|
|
1078
|
+
);
|
|
1079
|
+
const g = /* @__PURE__ */ f.createElement(
|
|
1093
1080
|
"bw-window",
|
|
1094
1081
|
{
|
|
1095
|
-
"sash-id":
|
|
1096
|
-
style: { width:
|
|
1082
|
+
"root-sash-id": l.rootSash.id,
|
|
1083
|
+
style: { width: l.rootSash.width, height: l.rootSash.height },
|
|
1097
1084
|
ref: i
|
|
1098
1085
|
},
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
/* @__PURE__ */
|
|
1102
|
-
);
|
|
1103
|
-
|
|
1086
|
+
u.map((p) => /* @__PURE__ */ f.createElement(Wt, { key: p.id, sash: p, bwin: l })),
|
|
1087
|
+
c.map((p) => /* @__PURE__ */ f.createElement(Tt, { key: p.id, sash: p })),
|
|
1088
|
+
/* @__PURE__ */ f.createElement("bw-sill", { ref: n })
|
|
1089
|
+
), m = V(() => g, []);
|
|
1090
|
+
function w(p, x) {
|
|
1091
|
+
const { content: D, ...$ } = x, q = l.addPane(p, $), U = document.querySelector(
|
|
1092
|
+
`bw-pane[sash-id="${q.id}"] bw-glass-content`
|
|
1093
|
+
);
|
|
1094
|
+
o((X) => [
|
|
1095
|
+
...X || [],
|
|
1096
|
+
{ node: D, container: U }
|
|
1097
|
+
]);
|
|
1098
|
+
}
|
|
1099
|
+
return /* @__PURE__ */ f.createElement(f.Fragment, null, m, s == null ? void 0 : s.map((p) => Z(p.node, p.container)));
|
|
1100
|
+
}), Ot = "0.3.0";
|
|
1104
1101
|
export {
|
|
1105
|
-
|
|
1106
|
-
|
|
1102
|
+
F as BUILTIN_ACTIONS,
|
|
1103
|
+
It as Window,
|
|
1104
|
+
Ot as version
|
|
1107
1105
|
};
|