react-bwin 0.2.5 → 0.3.1
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 +6 -0
- package/dist/react-bwin.css +1 -1
- package/dist/react-bwin.d.ts +16 -2
- package/dist/react-bwin.js +234 -236
- package/dist/react-bwin.umd.js +2 -2
- package/package.json +54 -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 w = h.calcMinWidth(), m = s.calcMinWidth();
|
|
288
|
+
i < 0 && (c < w && u > m ? (c = h.width, u = l - c, g = h.left + c) : u < m && c > w && (u = s.width, 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,18 @@ 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
|
-
|
|
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
|
+
if (i < 0) {
|
|
303
|
+
const w = n.calcMinHeight(), m = o.calcMinHeight();
|
|
304
|
+
c < w && u > m ? (c = n.height, u = l - c, g = n.top + c) : u < m && c > w && (u = o.height, c = l - u, g = n.top + c);
|
|
305
|
+
}
|
|
306
|
+
n.height = c, o.height = u, o.top = g;
|
|
303
307
|
}
|
|
304
308
|
h && s && (h.height += i, s.height += i);
|
|
305
309
|
}
|
|
306
310
|
}
|
|
307
|
-
const
|
|
311
|
+
const H = {
|
|
308
312
|
size: "50%",
|
|
309
313
|
position: r.Left
|
|
310
314
|
};
|
|
@@ -318,14 +322,14 @@ class P {
|
|
|
318
322
|
minHeight: h,
|
|
319
323
|
position: a,
|
|
320
324
|
size: d,
|
|
321
|
-
...
|
|
325
|
+
...l
|
|
322
326
|
}) {
|
|
323
|
-
|
|
327
|
+
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
328
|
}
|
|
325
329
|
getPosition(t) {
|
|
326
330
|
if (!this.siblingConfigNode)
|
|
327
331
|
return t;
|
|
328
|
-
const i =
|
|
332
|
+
const i = ot(this.siblingConfigNode.position);
|
|
329
333
|
if (!t)
|
|
330
334
|
return i;
|
|
331
335
|
if (t !== i)
|
|
@@ -334,7 +338,7 @@ class P {
|
|
|
334
338
|
}
|
|
335
339
|
getSize(t) {
|
|
336
340
|
if (!this.siblingConfigNode)
|
|
337
|
-
return
|
|
341
|
+
return C(t);
|
|
338
342
|
if (!t) {
|
|
339
343
|
if (this.siblingConfigNode.size < 1)
|
|
340
344
|
return 1 - this.siblingConfigNode.size;
|
|
@@ -343,7 +347,7 @@ class P {
|
|
|
343
347
|
if (this.siblingConfigNode.position === r.Top || this.siblingConfigNode.position === r.Bottom)
|
|
344
348
|
return this.parentRect.height - this.siblingConfigNode.height;
|
|
345
349
|
}
|
|
346
|
-
const i =
|
|
350
|
+
const i = C(t);
|
|
347
351
|
if (i < 1) {
|
|
348
352
|
if (i + this.siblingConfigNode.size !== 1)
|
|
349
353
|
throw new Error("[bwin] Sum of sibling sizes is not equal to 1");
|
|
@@ -373,7 +377,7 @@ class P {
|
|
|
373
377
|
}
|
|
374
378
|
}
|
|
375
379
|
createSash() {
|
|
376
|
-
return new
|
|
380
|
+
return new b({
|
|
377
381
|
left: this.left,
|
|
378
382
|
top: this.top,
|
|
379
383
|
width: this.width,
|
|
@@ -386,14 +390,14 @@ class P {
|
|
|
386
390
|
});
|
|
387
391
|
}
|
|
388
392
|
normConfig(t) {
|
|
389
|
-
if (
|
|
393
|
+
if (it(t))
|
|
390
394
|
return t;
|
|
391
395
|
if (Array.isArray(t))
|
|
392
396
|
return {
|
|
393
397
|
children: t
|
|
394
398
|
};
|
|
395
399
|
if (typeof t == "string" || typeof t == "number") {
|
|
396
|
-
const i =
|
|
400
|
+
const i = C(t);
|
|
397
401
|
if (isNaN(i))
|
|
398
402
|
throw new Error(`[bwin] Invalid size value: ${i}`);
|
|
399
403
|
return {
|
|
@@ -408,8 +412,8 @@ class P {
|
|
|
408
412
|
createPrimaryConfigNode({ size: t, position: i, children: n, id: s, minWidth: o, minHeight: h, ...a }) {
|
|
409
413
|
return new P({
|
|
410
414
|
parentRect: this,
|
|
411
|
-
size: t ??
|
|
412
|
-
position: i ??
|
|
415
|
+
size: t ?? H.size,
|
|
416
|
+
position: i ?? H.position,
|
|
413
417
|
children: n,
|
|
414
418
|
id: s,
|
|
415
419
|
minWidth: o,
|
|
@@ -445,23 +449,23 @@ class P {
|
|
|
445
449
|
)), s && o && (t.children.push(s.buildSashTree()), t.children.push(o.buildSashTree())), t;
|
|
446
450
|
}
|
|
447
451
|
}
|
|
448
|
-
const
|
|
452
|
+
const L = {
|
|
449
453
|
width: 333,
|
|
450
454
|
height: 333
|
|
451
|
-
},
|
|
455
|
+
}, T = {
|
|
452
456
|
fitContainer: !1
|
|
453
457
|
};
|
|
454
|
-
class
|
|
458
|
+
class ut extends P {
|
|
455
459
|
constructor({
|
|
456
460
|
id: t,
|
|
457
461
|
children: i,
|
|
458
|
-
width: n =
|
|
459
|
-
height: s =
|
|
460
|
-
fitContainer: o =
|
|
462
|
+
width: n = L.width,
|
|
463
|
+
height: s = L.height,
|
|
464
|
+
fitContainer: o = T.fitContainer,
|
|
461
465
|
...h
|
|
462
466
|
} = {
|
|
463
|
-
...
|
|
464
|
-
|
|
467
|
+
...L,
|
|
468
|
+
...T
|
|
465
469
|
}) {
|
|
466
470
|
super({
|
|
467
471
|
id: t,
|
|
@@ -473,120 +477,120 @@ class rt extends P {
|
|
|
473
477
|
}), this.fitContainer = o;
|
|
474
478
|
}
|
|
475
479
|
}
|
|
476
|
-
class
|
|
477
|
-
constructor(t =
|
|
478
|
-
super({ ...t, position: r.Root }), Object.assign(this,
|
|
480
|
+
class gt extends b {
|
|
481
|
+
constructor(t = v) {
|
|
482
|
+
super({ ...t, position: r.Root }), Object.assign(this, T);
|
|
479
483
|
}
|
|
480
484
|
}
|
|
481
|
-
function
|
|
485
|
+
function M(e) {
|
|
482
486
|
const t = document.createElement("bw-pane");
|
|
483
487
|
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
488
|
}
|
|
485
|
-
function
|
|
489
|
+
function ft(e) {
|
|
486
490
|
const t = e.domNode;
|
|
487
491
|
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
492
|
}
|
|
489
|
-
function
|
|
490
|
-
const i =
|
|
493
|
+
function wt(e, { size: t }) {
|
|
494
|
+
const i = C(t);
|
|
491
495
|
let n = e.width / 2;
|
|
492
496
|
i && (i < 1 ? n = e.width * i : n = i);
|
|
493
|
-
const s = new
|
|
497
|
+
const s = new b({
|
|
494
498
|
top: e.top,
|
|
495
499
|
left: e.left,
|
|
496
500
|
width: n,
|
|
497
501
|
height: e.height,
|
|
498
502
|
position: r.Left
|
|
499
|
-
}), o = new
|
|
503
|
+
}), o = new b({
|
|
500
504
|
top: e.top,
|
|
501
505
|
left: e.left + s.width,
|
|
502
506
|
width: e.width - n,
|
|
503
507
|
height: e.height,
|
|
504
508
|
position: r.Right
|
|
505
|
-
}), h =
|
|
506
|
-
return o.domNode = h,
|
|
509
|
+
}), h = M(o);
|
|
510
|
+
return o.domNode = h, z(h, e.domNode), e.addChild(s), e.addChild(o), s;
|
|
507
511
|
}
|
|
508
|
-
function
|
|
509
|
-
const i =
|
|
512
|
+
function mt(e, { size: t }) {
|
|
513
|
+
const i = C(t);
|
|
510
514
|
let n = e.width / 2;
|
|
511
515
|
i && (i < 1 ? n = e.width * i : n = i);
|
|
512
|
-
const s = new
|
|
516
|
+
const s = new b({
|
|
513
517
|
left: e.left,
|
|
514
518
|
top: e.top,
|
|
515
519
|
width: e.width - n,
|
|
516
520
|
height: e.height,
|
|
517
521
|
position: r.Left
|
|
518
|
-
}), o = new
|
|
522
|
+
}), o = new b({
|
|
519
523
|
left: e.left + s.width,
|
|
520
524
|
top: e.top,
|
|
521
525
|
width: n,
|
|
522
526
|
height: e.height,
|
|
523
527
|
position: r.Right
|
|
524
|
-
}), h =
|
|
525
|
-
return s.domNode = h,
|
|
528
|
+
}), h = M(s);
|
|
529
|
+
return s.domNode = h, z(h, e.domNode), e.addChild(s), e.addChild(o), o;
|
|
526
530
|
}
|
|
527
|
-
function
|
|
528
|
-
const i =
|
|
531
|
+
function bt(e, { size: t }) {
|
|
532
|
+
const i = C(t);
|
|
529
533
|
let n = e.height / 2;
|
|
530
534
|
i && (i < 1 ? n = e.height * i : n = i);
|
|
531
|
-
const s = new
|
|
535
|
+
const s = new b({
|
|
532
536
|
left: e.left,
|
|
533
537
|
top: e.top,
|
|
534
538
|
width: e.width,
|
|
535
539
|
height: n,
|
|
536
540
|
position: r.Top
|
|
537
|
-
}), o = new
|
|
541
|
+
}), o = new b({
|
|
538
542
|
left: e.left,
|
|
539
543
|
top: e.top + s.height,
|
|
540
544
|
width: e.width,
|
|
541
545
|
height: e.height - n,
|
|
542
546
|
position: r.Bottom
|
|
543
|
-
}), h =
|
|
544
|
-
return o.domNode = h,
|
|
547
|
+
}), h = M(o);
|
|
548
|
+
return o.domNode = h, z(h, e.domNode), e.addChild(s), e.addChild(o), s;
|
|
545
549
|
}
|
|
546
|
-
function
|
|
547
|
-
const i =
|
|
550
|
+
function Et(e, { size: t }) {
|
|
551
|
+
const i = C(t);
|
|
548
552
|
let n = e.height / 2;
|
|
549
553
|
i && (i < 1 ? n = e.height * i : n = i);
|
|
550
|
-
const s = new
|
|
554
|
+
const s = new b({
|
|
551
555
|
top: e.top,
|
|
552
556
|
left: e.left,
|
|
553
557
|
width: e.width,
|
|
554
558
|
height: e.height - n,
|
|
555
559
|
position: r.Top
|
|
556
|
-
}), o = new
|
|
560
|
+
}), o = new b({
|
|
557
561
|
top: e.top + s.height,
|
|
558
562
|
left: e.left,
|
|
559
563
|
width: e.width,
|
|
560
564
|
height: n,
|
|
561
565
|
position: r.Bottom
|
|
562
|
-
}), h =
|
|
563
|
-
return s.domNode = h,
|
|
566
|
+
}), h = M(s);
|
|
567
|
+
return s.domNode = h, z(h, e.domNode), e.addChild(s), e.addChild(o), o;
|
|
564
568
|
}
|
|
565
|
-
function
|
|
569
|
+
function yt(e, { position: t, size: i, minWidth: n, minHeight: s }) {
|
|
566
570
|
if (t === r.Left)
|
|
567
|
-
return
|
|
571
|
+
return wt(e, { size: i });
|
|
568
572
|
if (t === r.Right)
|
|
569
|
-
return
|
|
573
|
+
return mt(e, { size: i });
|
|
570
574
|
if (t === r.Top)
|
|
571
|
-
return
|
|
575
|
+
return bt(e, { size: i });
|
|
572
576
|
if (t === r.Bottom)
|
|
573
|
-
return
|
|
577
|
+
return Et(e, { size: i });
|
|
574
578
|
}
|
|
575
|
-
const
|
|
579
|
+
const vt = {
|
|
576
580
|
createPane(e) {
|
|
577
|
-
const t =
|
|
581
|
+
const t = M(e);
|
|
578
582
|
return e.store.droppable === !1 && t.setAttribute("can-drop", "false"), t;
|
|
579
583
|
},
|
|
580
584
|
// Intended to be overridden
|
|
581
585
|
onPaneCreate(e, t) {
|
|
582
|
-
t.store.content && e.append(
|
|
586
|
+
t.store.content && e.append(N(t.store.content)), this != null && this.debug && (e.style.backgroundColor = tt(), e.innerHTML = "", e.append(G(e)));
|
|
583
587
|
},
|
|
584
588
|
updatePane(e) {
|
|
585
|
-
return
|
|
589
|
+
return ft(e);
|
|
586
590
|
},
|
|
587
591
|
// Intended to be overridden
|
|
588
592
|
onPaneUpdate(e, t) {
|
|
589
|
-
this != null && this.debug && (e.innerHTML = "", e.append(
|
|
593
|
+
this != null && this.debug && (e.innerHTML = "", e.append(G(e)));
|
|
590
594
|
},
|
|
591
595
|
/**
|
|
592
596
|
* Add a pane into the target pane. The two panes become next to each other
|
|
@@ -599,8 +603,8 @@ const ft = {
|
|
|
599
603
|
if (!t) throw new Error("[bwin] Position is required when adding pane");
|
|
600
604
|
const n = this.rootSash.getById(e);
|
|
601
605
|
if (!n) throw new Error("[bwin] Parent sash not found when adding pane");
|
|
602
|
-
const s =
|
|
603
|
-
return n.id =
|
|
606
|
+
const s = yt(n, { position: t, size: i });
|
|
607
|
+
return n.id = B(), this.update(), s;
|
|
604
608
|
},
|
|
605
609
|
/**
|
|
606
610
|
* Remove a pane
|
|
@@ -611,10 +615,10 @@ const ft = {
|
|
|
611
615
|
const t = this.rootSash.getDescendantParentById(e);
|
|
612
616
|
if (!t) throw new Error("[bwin] Parent sash not found when removing pane");
|
|
613
617
|
const i = t.getChildSiblingById(e);
|
|
614
|
-
t.id =
|
|
618
|
+
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
619
|
}
|
|
616
620
|
};
|
|
617
|
-
function
|
|
621
|
+
function G(e) {
|
|
618
622
|
const t = document.createElement("pre");
|
|
619
623
|
t.style.fontSize = "10px";
|
|
620
624
|
const i = `
|
|
@@ -627,10 +631,10 @@ height: ${e.style.height}
|
|
|
627
631
|
`;
|
|
628
632
|
return t.innerHTML = i.trim(), t;
|
|
629
633
|
}
|
|
630
|
-
const
|
|
634
|
+
const Nt = {
|
|
631
635
|
createWindow() {
|
|
632
636
|
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;
|
|
637
|
+
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
638
|
},
|
|
635
639
|
glaze() {
|
|
636
640
|
this.rootSash.walk((e) => {
|
|
@@ -648,7 +652,7 @@ const wt = {
|
|
|
648
652
|
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
653
|
});
|
|
650
654
|
}
|
|
651
|
-
},
|
|
655
|
+
}, zt = {
|
|
652
656
|
muntinSize: 4,
|
|
653
657
|
createMuntin(e) {
|
|
654
658
|
const t = document.createElement("bw-muntin"), i = e.leftChild, n = e.topChild;
|
|
@@ -662,7 +666,7 @@ const wt = {
|
|
|
662
666
|
},
|
|
663
667
|
onMuntinUpdate(e, t) {
|
|
664
668
|
}
|
|
665
|
-
},
|
|
669
|
+
}, Ct = {
|
|
666
670
|
fitContainer: !1,
|
|
667
671
|
fit() {
|
|
668
672
|
this.rootSash.width = this.containerElement.clientWidth, this.rootSash.height = this.containerElement.clientHeight, this.update();
|
|
@@ -673,7 +677,7 @@ const wt = {
|
|
|
673
677
|
t.target === this.containerElement && this.fitContainer && this.fit();
|
|
674
678
|
}).observe(this.containerElement);
|
|
675
679
|
}
|
|
676
|
-
},
|
|
680
|
+
}, St = {
|
|
677
681
|
activeMuntinSash: null,
|
|
678
682
|
isResizeStarted: !1,
|
|
679
683
|
isDropStarted: !1,
|
|
@@ -694,21 +698,19 @@ const wt = {
|
|
|
694
698
|
if (!this.isResizeStarted || !this.activeMuntinSash) return;
|
|
695
699
|
const [t, i, n, s] = this.activeMuntinSash.getChildren(), o = this.activeMuntinSash.isLeftRightSplit(), h = this.activeMuntinSash.isTopBottomSplit();
|
|
696
700
|
if (o && s && i) {
|
|
697
|
-
const a = e.pageX - this.lastX, d = s.width + a,
|
|
698
|
-
if (
|
|
699
|
-
|
|
700
|
-
s.width = d, i.width = c, i.left = i.left + a, this.update(), this.lastX = e.pageX;
|
|
701
|
+
const a = e.pageX - this.lastX, d = s.width + a, l = i.width - a;
|
|
702
|
+
if (a > 0 && l <= i.calcMinWidth() || a < 0 && d <= s.calcMinWidth()) return;
|
|
703
|
+
s.width = d, i.width = l, i.left = i.left + a, this.update(), this.lastX = e.pageX;
|
|
701
704
|
} else if (h && t && n) {
|
|
702
|
-
const a = e.pageY - this.lastY, d = t.height + a,
|
|
703
|
-
if (
|
|
704
|
-
|
|
705
|
-
t.height = d, n.height = c, n.top = n.top + a, this.update(), this.lastY = e.pageY;
|
|
705
|
+
const a = e.pageY - this.lastY, d = t.height + a, l = n.height - a;
|
|
706
|
+
if (a > 0 && l <= n.calcMinHeight() || a < 0 && d <= t.calcMinHeight()) return;
|
|
707
|
+
t.height = d, n.height = l, n.top = n.top + a, this.update(), this.lastY = e.pageY;
|
|
706
708
|
}
|
|
707
709
|
}), document.addEventListener("mouseup", () => {
|
|
708
710
|
this.isResizeStarted = !1, this.activeMuntinSash = null, this.revertResizeStyles();
|
|
709
711
|
});
|
|
710
712
|
}
|
|
711
|
-
},
|
|
713
|
+
}, Mt = {
|
|
712
714
|
activeDropPaneEl: null,
|
|
713
715
|
// Intended to be overridden in `BinaryWindow` class
|
|
714
716
|
onPaneDrop(e, t) {
|
|
@@ -718,7 +720,7 @@ const wt = {
|
|
|
718
720
|
e.preventDefault();
|
|
719
721
|
const t = e.target.matches("bw-pane") ? e.target : e.target.closest("bw-pane");
|
|
720
722
|
if (!t || (t !== this.activeDropPaneEl && (this.activeDropPaneEl && this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = t), t.getAttribute("can-drop") === "false")) return;
|
|
721
|
-
const i =
|
|
723
|
+
const i = dt(t, e);
|
|
722
724
|
t.setAttribute("drop-area", i);
|
|
723
725
|
}), this.windowElement.addEventListener("dragleave", (e) => {
|
|
724
726
|
e.currentTarget.contains(e.relatedTarget) && e.currentTarget !== e.relatedTarget || this.activeDropPaneEl && (this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = null);
|
|
@@ -728,12 +730,12 @@ const wt = {
|
|
|
728
730
|
this.onPaneDrop(e, i), typeof i.store.onDrop == "function" && i.store.onDrop(e, i), this.activeDropPaneEl.removeAttribute("drop-area"), this.activeDropPaneEl = null;
|
|
729
731
|
});
|
|
730
732
|
}
|
|
731
|
-
},
|
|
732
|
-
class
|
|
733
|
+
}, At = !1;
|
|
734
|
+
class O {
|
|
733
735
|
constructor(t) {
|
|
734
|
-
|
|
736
|
+
E(this, "windowElement", null), E(this, "containerElement", null), E(this, "debug", At);
|
|
735
737
|
let i = null;
|
|
736
|
-
t instanceof
|
|
738
|
+
t instanceof gt ? (i = t, this.rootSash = t) : (i = new ut(t), this.rootSash = i.buildSashTree()), this.fitContainer = i.fitContainer;
|
|
737
739
|
}
|
|
738
740
|
frame(t) {
|
|
739
741
|
this.containerElement = t, this.windowElement = this.createWindow(), this.glaze(), this.containerElement.append(this.windowElement);
|
|
@@ -747,19 +749,19 @@ class H {
|
|
|
747
749
|
}
|
|
748
750
|
static assemble(...t) {
|
|
749
751
|
t.forEach((i) => {
|
|
750
|
-
|
|
752
|
+
nt(this.prototype, i);
|
|
751
753
|
});
|
|
752
754
|
}
|
|
753
755
|
}
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
756
|
+
O.assemble(
|
|
757
|
+
Nt,
|
|
758
|
+
zt,
|
|
759
|
+
vt,
|
|
760
|
+
Ct,
|
|
761
|
+
Mt,
|
|
762
|
+
St
|
|
761
763
|
);
|
|
762
|
-
function
|
|
764
|
+
function k(e) {
|
|
763
765
|
if (e.tagName === "BW-PANE")
|
|
764
766
|
return e.getAttribute("sash-id");
|
|
765
767
|
const t = e.closest("bw-pane");
|
|
@@ -767,25 +769,25 @@ function G(e) {
|
|
|
767
769
|
throw new Error("[bwin] Pane element not found");
|
|
768
770
|
return t.getAttribute("sash-id");
|
|
769
771
|
}
|
|
770
|
-
const
|
|
772
|
+
const Rt = {
|
|
771
773
|
label: "",
|
|
772
774
|
className: "bw-glass-action--close",
|
|
773
775
|
onClick: (e, t) => {
|
|
774
|
-
const i =
|
|
776
|
+
const i = k(e.target);
|
|
775
777
|
t.removePane(i);
|
|
776
778
|
}
|
|
777
|
-
},
|
|
779
|
+
}, Pt = {
|
|
778
780
|
label: "",
|
|
779
781
|
className: "bw-glass-action--minimize",
|
|
780
782
|
onClick: (e, t) => {
|
|
781
783
|
const i = t.sillElement;
|
|
782
784
|
if (!i) throw new Error("[bwin] Sill element not found when minimizing");
|
|
783
|
-
const n =
|
|
785
|
+
const n = N('<button class="bw-minimized-glass" />');
|
|
784
786
|
i.append(n);
|
|
785
787
|
const s = e.target.closest("bw-pane"), o = e.target.closest("bw-glass"), h = s.getAttribute("sash-id"), a = s.getAttribute("position");
|
|
786
788
|
n.bwGlassElement = o, n.bwOriginalPosition = a, n.bwOriginalBoundingRect = R(s), t.removePane(h);
|
|
787
789
|
}
|
|
788
|
-
},
|
|
790
|
+
}, xt = {
|
|
789
791
|
label: "",
|
|
790
792
|
className: "bw-glass-action--maximize",
|
|
791
793
|
onClick: (e) => {
|
|
@@ -793,19 +795,19 @@ const Nt = {
|
|
|
793
795
|
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
796
|
}
|
|
795
797
|
};
|
|
796
|
-
function
|
|
798
|
+
function Dt(e, t) {
|
|
797
799
|
const i = e.left + e.width, n = e.top + e.height, s = t.left + t.width, o = t.top + t.height;
|
|
798
800
|
if (e.left >= s || t.left >= i || e.top >= o || t.top >= n)
|
|
799
801
|
return null;
|
|
800
|
-
const h = Math.max(e.left, t.left), a = Math.max(e.top, t.top), d = Math.min(i, s),
|
|
802
|
+
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
803
|
return {
|
|
802
804
|
left: h,
|
|
803
805
|
top: a,
|
|
804
806
|
width: d - h,
|
|
805
|
-
height:
|
|
807
|
+
height: l - a
|
|
806
808
|
};
|
|
807
809
|
}
|
|
808
|
-
const
|
|
810
|
+
const F = [Pt, xt, Rt], $t = {
|
|
809
811
|
enableActions() {
|
|
810
812
|
this.handleMinimizedGlassClick(), this.observeActionButtons();
|
|
811
813
|
},
|
|
@@ -813,7 +815,7 @@ const I = [zt, Ct, Nt], At = {
|
|
|
813
815
|
const t = e.bwOriginalBoundingRect;
|
|
814
816
|
let i = 0, n = null;
|
|
815
817
|
if (this.windowElement.querySelectorAll("bw-pane").forEach((s) => {
|
|
816
|
-
const o = R(s), h =
|
|
818
|
+
const o = R(s), h = Dt(t, o);
|
|
817
819
|
if (h) {
|
|
818
820
|
const a = h.width * h.height;
|
|
819
821
|
a > i && (i = a, n = s);
|
|
@@ -861,24 +863,24 @@ const I = [zt, Ct, Nt], At = {
|
|
|
861
863
|
childList: !0
|
|
862
864
|
});
|
|
863
865
|
}
|
|
864
|
-
},
|
|
866
|
+
}, S = {
|
|
865
867
|
title: null,
|
|
866
868
|
content: null,
|
|
867
869
|
tabs: [],
|
|
868
870
|
actions: void 0,
|
|
869
871
|
draggable: !0
|
|
870
872
|
};
|
|
871
|
-
class
|
|
873
|
+
class I {
|
|
872
874
|
constructor({
|
|
873
|
-
title: t =
|
|
874
|
-
content: i =
|
|
875
|
-
tabs: n =
|
|
876
|
-
actions: s =
|
|
877
|
-
draggable: o =
|
|
875
|
+
title: t = S.title,
|
|
876
|
+
content: i = S.content,
|
|
877
|
+
tabs: n = S.tabs,
|
|
878
|
+
actions: s = S.actions,
|
|
879
|
+
draggable: o = S.draggable,
|
|
878
880
|
sash: h,
|
|
879
881
|
binaryWindow: a
|
|
880
882
|
}) {
|
|
881
|
-
|
|
883
|
+
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
884
|
}
|
|
883
885
|
build() {
|
|
884
886
|
const t = document.createElement("bw-glass-header");
|
|
@@ -886,24 +888,24 @@ class W {
|
|
|
886
888
|
t.append(this.createTabs());
|
|
887
889
|
else if (this.title) {
|
|
888
890
|
const s = document.createElement("bw-glass-title");
|
|
889
|
-
s.append(
|
|
891
|
+
s.append(N(this.title)), t.append(s);
|
|
890
892
|
}
|
|
891
893
|
t.setAttribute("can-drag", this.draggable), t.append(this.createActions());
|
|
892
|
-
const i = document.createElement("bw-glass-content"), n =
|
|
894
|
+
const i = document.createElement("bw-glass-content"), n = N(this.content);
|
|
893
895
|
n && i.append(n), this.domNode = document.createElement("bw-glass"), this.domNode.append(t, i);
|
|
894
896
|
}
|
|
895
897
|
createTabs() {
|
|
896
898
|
const t = document.createElement("bw-glass-tab-container");
|
|
897
899
|
for (const i of this.tabs) {
|
|
898
|
-
const n = (i == null ? void 0 : i.label) ?? i, s =
|
|
900
|
+
const n = (i == null ? void 0 : i.label) ?? i, s = N(`<button class="bw-glass-tab">${n}</button>`);
|
|
899
901
|
t.append(s);
|
|
900
902
|
}
|
|
901
903
|
return t;
|
|
902
904
|
}
|
|
903
905
|
createActions() {
|
|
904
|
-
const t = document.createElement("bw-glass-action-container"), i = this.actions === void 0 ?
|
|
906
|
+
const t = document.createElement("bw-glass-action-container"), i = this.actions === void 0 ? F : Array.isArray(this.actions) ? this.actions : [];
|
|
905
907
|
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 =
|
|
908
|
+
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
909
|
typeof n.onClick == "function" && h.addEventListener("click", (a) => {
|
|
908
910
|
n.onClick(a, this.binaryWindow);
|
|
909
911
|
}), t.append(h);
|
|
@@ -917,7 +919,7 @@ class W {
|
|
|
917
919
|
return this.domNode.querySelector("bw-glass-header");
|
|
918
920
|
}
|
|
919
921
|
}
|
|
920
|
-
const
|
|
922
|
+
const Lt = {
|
|
921
923
|
activeDragGlassEl: null,
|
|
922
924
|
activeDragGlassPaneCanDrop: !1,
|
|
923
925
|
onPaneDrop(e, t) {
|
|
@@ -925,10 +927,10 @@ const Mt = {
|
|
|
925
927
|
const i = this.activeDropPaneEl.getAttribute("drop-area");
|
|
926
928
|
if (i === "center") {
|
|
927
929
|
const n = this.activeDragGlassEl.closest("bw-pane"), s = this.activeDropPaneEl.getAttribute("can-drop") !== "false";
|
|
928
|
-
|
|
930
|
+
et(n, this.activeDropPaneEl), n.setAttribute("can-drop", s);
|
|
929
931
|
return;
|
|
930
932
|
} else {
|
|
931
|
-
const n =
|
|
933
|
+
const n = k(this.activeDragGlassEl);
|
|
932
934
|
this.addPane(t.id, { position: i }).domNode.append(this.activeDragGlassEl), this.removePane(n);
|
|
933
935
|
}
|
|
934
936
|
},
|
|
@@ -953,7 +955,7 @@ const Mt = {
|
|
|
953
955
|
this.activeDragGlassEl && (this.activeDragGlassEl.removeAttribute("draggable"), this.activeDragGlassEl.closest("bw-pane").setAttribute("can-drop", this.activeDragGlassPaneCanDrop), this.activeDragGlassEl = null);
|
|
954
956
|
});
|
|
955
957
|
}
|
|
956
|
-
},
|
|
958
|
+
}, Bt = {
|
|
957
959
|
trimMuntin(e) {
|
|
958
960
|
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
961
|
},
|
|
@@ -964,62 +966,45 @@ const Mt = {
|
|
|
964
966
|
this.trimMuntin(e);
|
|
965
967
|
}
|
|
966
968
|
};
|
|
967
|
-
class
|
|
969
|
+
class _ extends O {
|
|
968
970
|
constructor() {
|
|
969
|
-
super(...arguments),
|
|
971
|
+
super(...arguments), E(this, "sillElement", null);
|
|
970
972
|
}
|
|
971
973
|
frame() {
|
|
972
974
|
super.frame(...arguments);
|
|
973
|
-
const t =
|
|
975
|
+
const t = N("<bw-sill />");
|
|
974
976
|
this.windowElement.append(t), this.sillElement = t;
|
|
975
977
|
}
|
|
976
978
|
enableFeatures() {
|
|
977
979
|
super.enableFeatures(), this.enableDrag(), this.enableActions();
|
|
978
980
|
}
|
|
979
981
|
onPaneCreate(t, i) {
|
|
980
|
-
const n = new
|
|
982
|
+
const n = new I({ ...i.store, sash: i, binaryWindow: this });
|
|
981
983
|
t.innerHTML = "", t.append(n.domNode), this.debug && n.contentElement.prepend(`${i.id}`);
|
|
982
984
|
}
|
|
983
985
|
onPaneUpdate() {
|
|
984
986
|
}
|
|
985
987
|
/**
|
|
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
|
|
988
|
+
* Add a pane with glass into the target pane.
|
|
991
989
|
*
|
|
990
|
+
* @param {string} targetPaneId - The Sash ID of the target pane
|
|
991
|
+
* @param {Object} props - The pane and glass properties grouped together
|
|
992
|
+
* @returns {Sash} - The newly created Sash
|
|
992
993
|
*/
|
|
993
|
-
|
|
994
|
-
const s =
|
|
995
|
-
|
|
996
|
-
}
|
|
997
|
-
/**
|
|
998
|
-
* Remove glass from or together with the pane
|
|
999
|
-
*
|
|
1000
|
-
* @param {string} paneSashId - The Sash ID of the pane that contains the glass
|
|
1001
|
-
* @param {boolean} removePane - Whether to remove the pane together
|
|
1002
|
-
*/
|
|
1003
|
-
removeGlass(t, i) {
|
|
1004
|
-
if (i)
|
|
1005
|
-
this.removePane(t);
|
|
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
|
-
}
|
|
994
|
+
addPane(t, i) {
|
|
995
|
+
const { position: n, size: s, ...o } = i, h = super.addPane(t, { position: n, size: s }), a = new I({ ...o, sash: h, binaryWindow: this });
|
|
996
|
+
return h.domNode.append(a.domNode), h;
|
|
1012
997
|
}
|
|
1013
998
|
}
|
|
1014
|
-
|
|
999
|
+
_.assemble(Lt, Bt, $t);
|
|
1015
1000
|
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,
|
|
1001
|
+
function Tt({ sash: e }) {
|
|
1002
|
+
var c;
|
|
1003
|
+
const t = A(), i = e.leftChild, n = e.topChild;
|
|
1004
|
+
let s, o, h, a, d, l;
|
|
1005
|
+
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
1006
|
e.domNode = t.current;
|
|
1022
|
-
}, []), /* @__PURE__ */
|
|
1007
|
+
}, []), /* @__PURE__ */ f.createElement(
|
|
1023
1008
|
"bw-muntin",
|
|
1024
1009
|
{
|
|
1025
1010
|
"sash-id": e.id,
|
|
@@ -1030,79 +1015,92 @@ function Pt({ sash: e }) {
|
|
|
1030
1015
|
left: a
|
|
1031
1016
|
},
|
|
1032
1017
|
vertical: d,
|
|
1033
|
-
horizontal:
|
|
1034
|
-
resizable: ((
|
|
1018
|
+
horizontal: l,
|
|
1019
|
+
resizable: ((c = e.store) == null ? void 0 : c.resizable) === !1 ? "false" : "true",
|
|
1035
1020
|
ref: t
|
|
1036
1021
|
}
|
|
1037
1022
|
);
|
|
1038
1023
|
}
|
|
1039
|
-
function
|
|
1024
|
+
function Wt({
|
|
1040
1025
|
sash: e,
|
|
1041
1026
|
bwin: t
|
|
1042
1027
|
}) {
|
|
1043
|
-
var
|
|
1044
|
-
const i =
|
|
1045
|
-
|
|
1028
|
+
var c, u, g, w, m;
|
|
1029
|
+
const i = A(), { left: n, top: s, width: o, height: h, id: a, position: d } = e;
|
|
1030
|
+
W(() => {
|
|
1046
1031
|
e.domNode = i.current;
|
|
1047
1032
|
}, []);
|
|
1048
|
-
const
|
|
1049
|
-
return /* @__PURE__ */
|
|
1033
|
+
const l = ((c = e.store) == null ? void 0 : c.actions) === void 0 ? F : Array.isArray(e.store.actions) ? e.store.actions : [];
|
|
1034
|
+
return /* @__PURE__ */ f.createElement(
|
|
1050
1035
|
"bw-pane",
|
|
1051
1036
|
{
|
|
1052
1037
|
"sash-id": a,
|
|
1053
1038
|
position: d,
|
|
1054
1039
|
style: { left: n, top: s, width: o, height: h },
|
|
1055
|
-
"can-drop": ((
|
|
1040
|
+
"can-drop": ((u = e.store) == null ? void 0 : u.droppable) === !1 ? "false" : "true",
|
|
1056
1041
|
ref: i
|
|
1057
1042
|
},
|
|
1058
|
-
/* @__PURE__ */
|
|
1043
|
+
/* @__PURE__ */ f.createElement("bw-glass", null, /* @__PURE__ */ f.createElement(
|
|
1059
1044
|
"bw-glass-header",
|
|
1060
1045
|
{
|
|
1061
|
-
"can-drag": ((
|
|
1046
|
+
"can-drag": ((g = e.store) == null ? void 0 : g.draggable) === !1 ? "false" : "true"
|
|
1062
1047
|
},
|
|
1063
|
-
((
|
|
1064
|
-
|
|
1065
|
-
const
|
|
1066
|
-
return /* @__PURE__ */
|
|
1048
|
+
((w = e.store) == null ? void 0 : w.title) && /* @__PURE__ */ f.createElement("bw-glass-title", null, e.store.title),
|
|
1049
|
+
l.length > 0 && /* @__PURE__ */ f.createElement("bw-glass-action-container", null, l.map((p, x) => {
|
|
1050
|
+
const D = p.className ? `bw-glass-action ${p.className}` : "bw-glass-action";
|
|
1051
|
+
return /* @__PURE__ */ f.createElement(
|
|
1067
1052
|
"button",
|
|
1068
1053
|
{
|
|
1069
|
-
className:
|
|
1070
|
-
key:
|
|
1071
|
-
onClick: (
|
|
1054
|
+
className: D,
|
|
1055
|
+
key: x,
|
|
1056
|
+
onClick: ($) => p.onClick($, t)
|
|
1072
1057
|
},
|
|
1073
|
-
|
|
1058
|
+
p.label
|
|
1074
1059
|
);
|
|
1075
1060
|
}))
|
|
1076
|
-
), /* @__PURE__ */
|
|
1061
|
+
), /* @__PURE__ */ f.createElement("bw-glass-content", null, (m = e.store) == null ? void 0 : m.content))
|
|
1077
1062
|
);
|
|
1078
1063
|
}
|
|
1079
|
-
const
|
|
1080
|
-
const i =
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
}),
|
|
1084
|
-
const
|
|
1085
|
-
|
|
1086
|
-
}, []),
|
|
1064
|
+
const It = Y((e, t) => {
|
|
1065
|
+
const i = A(), n = A(), [s, o] = j(), { panes: h, ...a } = e, d = { ...a, children: h }, l = new _(d), c = [], u = [];
|
|
1066
|
+
l.rootSash.walk((p) => {
|
|
1067
|
+
p.children.length > 0 ? c.push(p) : u.push(p);
|
|
1068
|
+
}), W(() => {
|
|
1069
|
+
const p = i.current;
|
|
1070
|
+
p != null && p.parentElement && (l.windowElement = p, l.containerElement = p.parentElement, l.sillElement = n.current, l.enableFeatures());
|
|
1071
|
+
}, []), K(
|
|
1087
1072
|
t,
|
|
1088
1073
|
() => ({
|
|
1089
|
-
|
|
1074
|
+
fit: l.fit.bind(l),
|
|
1075
|
+
removePane: l.removePane.bind(l),
|
|
1076
|
+
addPane: m
|
|
1090
1077
|
}),
|
|
1091
1078
|
[]
|
|
1092
|
-
)
|
|
1079
|
+
);
|
|
1080
|
+
const g = /* @__PURE__ */ f.createElement(
|
|
1093
1081
|
"bw-window",
|
|
1094
1082
|
{
|
|
1095
|
-
"sash-id":
|
|
1096
|
-
style: { width:
|
|
1083
|
+
"root-sash-id": l.rootSash.id,
|
|
1084
|
+
style: { width: l.rootSash.width, height: l.rootSash.height },
|
|
1097
1085
|
ref: i
|
|
1098
1086
|
},
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
/* @__PURE__ */
|
|
1102
|
-
);
|
|
1103
|
-
|
|
1087
|
+
u.map((p) => /* @__PURE__ */ f.createElement(Wt, { key: p.id, sash: p, bwin: l })),
|
|
1088
|
+
c.map((p) => /* @__PURE__ */ f.createElement(Tt, { key: p.id, sash: p })),
|
|
1089
|
+
/* @__PURE__ */ f.createElement("bw-sill", { ref: n })
|
|
1090
|
+
), w = V(() => g, []);
|
|
1091
|
+
function m(p, x) {
|
|
1092
|
+
const { content: D, ...$ } = x, q = l.addPane(p, $), U = document.querySelector(
|
|
1093
|
+
`bw-pane[sash-id="${q.id}"] bw-glass-content`
|
|
1094
|
+
);
|
|
1095
|
+
o((X) => [
|
|
1096
|
+
...X || [],
|
|
1097
|
+
{ node: D, container: U }
|
|
1098
|
+
]);
|
|
1099
|
+
}
|
|
1100
|
+
return /* @__PURE__ */ f.createElement(f.Fragment, null, w, s == null ? void 0 : s.map((p) => Z(p.node, p.container)));
|
|
1101
|
+
}), Ot = "0.3.1";
|
|
1104
1102
|
export {
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1103
|
+
F as BUILTIN_ACTIONS,
|
|
1104
|
+
It as Window,
|
|
1105
|
+
Ot as version
|
|
1108
1106
|
};
|