bwin 0.2.5 → 0.2.6
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/dist/bwin.js +34 -22
- package/package.json +1 -1
package/dist/bwin.js
CHANGED
|
@@ -21,13 +21,13 @@ function C(i = 2, t = 3) {
|
|
|
21
21
|
}
|
|
22
22
|
return s;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function R(i, t) {
|
|
25
25
|
for (; t.firstChild; )
|
|
26
26
|
i.append(t.firstChild);
|
|
27
27
|
}
|
|
28
28
|
function W(i, t) {
|
|
29
29
|
const e = document.createElement("div");
|
|
30
|
-
|
|
30
|
+
R(e, i), R(i, t), R(t, e);
|
|
31
31
|
}
|
|
32
32
|
function b(i) {
|
|
33
33
|
if (typeof i == "number" && !isNaN(i))
|
|
@@ -124,14 +124,14 @@ function Y(i, { clientX: t, clientY: e }) {
|
|
|
124
124
|
const d = 0.3, a = F({ width: s, height: o, x: h }), c = k({ width: s, height: o, x: h }), p = _({ width: s, height: o, y: l }), u = U({ width: s, height: o, y: l });
|
|
125
125
|
return h < s * (0.5 - d / 2) && l > a && l < c ? r.Left : h > s * (0.5 + d / 2) && l < a && l > c ? r.Right : l < o * (0.5 - d / 2) && h > p && h < u ? r.Top : l > o * (0.5 + d / 2) && h < p && h > u ? r.Bottom : h > s * (0.5 - d / 2) && h < s * (0.5 + d / 2) && l > o * (0.5 - d / 2) && l < o * (0.5 + d / 2) ? r.Center : r.Unknown;
|
|
126
126
|
}
|
|
127
|
-
const
|
|
127
|
+
const q = 100, X = 100, w = {
|
|
128
128
|
left: 0,
|
|
129
129
|
top: 0,
|
|
130
130
|
width: 150,
|
|
131
131
|
height: 150,
|
|
132
132
|
// Initial min values, real min width/height is calculated based on children
|
|
133
|
-
minWidth:
|
|
134
|
-
minHeight:
|
|
133
|
+
minWidth: q,
|
|
134
|
+
minHeight: X
|
|
135
135
|
};
|
|
136
136
|
class g {
|
|
137
137
|
constructor({
|
|
@@ -291,8 +291,8 @@ class g {
|
|
|
291
291
|
if (h && s) {
|
|
292
292
|
const l = h.width + s.width, d = e * (h.width / l), a = l + e;
|
|
293
293
|
let c = h.width + d, p = a - c, u = s.left + d;
|
|
294
|
-
const
|
|
295
|
-
e < 0 && (c <
|
|
294
|
+
const E = h.calcMinWidth(), y = s.calcMinWidth();
|
|
295
|
+
e < 0 && (c < E && p > y ? (c = h.width, p = a - c, u = h.left + c) : p < y && c > E && (p = s.width, c = a - p, u = h.left + c)), h.width = c, s.width = p, s.left = u;
|
|
296
296
|
}
|
|
297
297
|
n && o && (n.width += e, o.width += e);
|
|
298
298
|
}
|
|
@@ -307,8 +307,8 @@ class g {
|
|
|
307
307
|
const l = n.height + o.height, d = e * (n.height / l), a = l + e;
|
|
308
308
|
let c = n.height + d, p = a - c, u = o.top + d;
|
|
309
309
|
if (e < 0) {
|
|
310
|
-
const
|
|
311
|
-
c <
|
|
310
|
+
const E = n.calcMinHeight(), y = o.calcMinHeight();
|
|
311
|
+
c < E && p > y ? (c = n.height, p = a - c, u = n.top + c) : p < y && c > E && (p = o.height, c = a - p, u = n.top + c);
|
|
312
312
|
}
|
|
313
313
|
n.height = c, o.height = p, o.top = u;
|
|
314
314
|
}
|
|
@@ -460,23 +460,23 @@ class A {
|
|
|
460
460
|
)), s && o && (t.children.push(s.buildSashTree()), t.children.push(o.buildSashTree())), t;
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
const
|
|
463
|
+
const S = {
|
|
464
464
|
width: 333,
|
|
465
465
|
height: 333
|
|
466
|
-
},
|
|
466
|
+
}, D = {
|
|
467
467
|
fitContainer: !1
|
|
468
468
|
};
|
|
469
469
|
class j extends A {
|
|
470
470
|
constructor({
|
|
471
471
|
id: t,
|
|
472
472
|
children: e,
|
|
473
|
-
width: n =
|
|
474
|
-
height: s =
|
|
475
|
-
fitContainer: o =
|
|
473
|
+
width: n = S.width,
|
|
474
|
+
height: s = S.height,
|
|
475
|
+
fitContainer: o = D.fitContainer,
|
|
476
476
|
...h
|
|
477
477
|
} = {
|
|
478
|
-
...
|
|
479
|
-
...
|
|
478
|
+
...S,
|
|
479
|
+
...D
|
|
480
480
|
}) {
|
|
481
481
|
super({
|
|
482
482
|
id: t,
|
|
@@ -490,7 +490,7 @@ class j extends A {
|
|
|
490
490
|
}
|
|
491
491
|
class K extends g {
|
|
492
492
|
constructor(t = w) {
|
|
493
|
-
super({ ...t, position: r.Root }), Object.assign(this,
|
|
493
|
+
super({ ...t, position: r.Root }), Object.assign(this, D);
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
496
|
function V(i) {
|
|
@@ -599,7 +599,7 @@ function et(i, { position: t, size: e, id: n, minWidth: s, minHeight: o }) {
|
|
|
599
599
|
if (t === r.Bottom)
|
|
600
600
|
return it(i, { size: e, id: n });
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function z(i) {
|
|
603
603
|
if (i.tagName === "BW-PANE")
|
|
604
604
|
return i.getAttribute("sash-id");
|
|
605
605
|
const t = i.closest("bw-pane");
|
|
@@ -649,7 +649,7 @@ const nt = {
|
|
|
649
649
|
e.children.length === 0 ? (t.id = e.id, t.domNode = e.domNode, t.domNode.setAttribute("sash-id", e.id), t.children = []) : (t.id = C(), t.children = e.children, e.position === r.Left ? e.width = t.width : e.position === r.Right ? (e.width = t.width, e.left = t.left) : e.position === r.Top ? e.height = t.height : e.position === r.Bottom && (e.height = t.height, e.top = t.top)), this.update();
|
|
650
650
|
},
|
|
651
651
|
swapPanes(i, t) {
|
|
652
|
-
const e =
|
|
652
|
+
const e = z(i), n = z(t), s = i.getAttribute("can-drop") !== "false", o = t.getAttribute("can-drop") !== "false";
|
|
653
653
|
this.rootSash.swapIds(e, n), W(i, this.activeDropPaneEl), i.setAttribute("sash-id", n), t.setAttribute("sash-id", e), i.setAttribute("can-drop", o), t.setAttribute("can-drop", s);
|
|
654
654
|
}
|
|
655
655
|
};
|
|
@@ -802,7 +802,7 @@ const at = {
|
|
|
802
802
|
label: "",
|
|
803
803
|
className: "bw-glass-action--close",
|
|
804
804
|
onClick: (i, t) => {
|
|
805
|
-
const e =
|
|
805
|
+
const e = z(i.target);
|
|
806
806
|
t.removePane(e);
|
|
807
807
|
}
|
|
808
808
|
}, ct = {
|
|
@@ -885,6 +885,10 @@ const ft = [ct, pt, at], gt = {
|
|
|
885
885
|
e.removeAttribute("disabled");
|
|
886
886
|
});
|
|
887
887
|
},
|
|
888
|
+
getMinimizedGlassElementBySashId(i) {
|
|
889
|
+
const t = this.windowElement.querySelectorAll(".bw-minimized-glass");
|
|
890
|
+
return Array.from(t).find((e) => e.bwOriginalSashId === i);
|
|
891
|
+
},
|
|
888
892
|
observeActionButtons() {
|
|
889
893
|
this.updateDisabledStateOfActionButtons(), new MutationObserver((t) => {
|
|
890
894
|
t.forEach((e) => {
|
|
@@ -962,7 +966,7 @@ const wt = {
|
|
|
962
966
|
this.swapPanes(n, this.activeDropPaneEl);
|
|
963
967
|
return;
|
|
964
968
|
} else {
|
|
965
|
-
const n =
|
|
969
|
+
const n = z(this.activeDragGlassEl);
|
|
966
970
|
this.removePane(n), this.addPane(t.id, { position: e, id: n }).domNode.append(this.activeDragGlassEl);
|
|
967
971
|
}
|
|
968
972
|
},
|
|
@@ -1020,7 +1024,7 @@ class bt extends B {
|
|
|
1020
1024
|
/**
|
|
1021
1025
|
* Add a pane with glass into the target pane.
|
|
1022
1026
|
*
|
|
1023
|
-
* @param {string}
|
|
1027
|
+
* @param {string} targetPaneSashId - The Sash ID of the target pane
|
|
1024
1028
|
* @param {Object} props - The pane and glass properties grouped together
|
|
1025
1029
|
* @returns {Sash} - The newly created Sash
|
|
1026
1030
|
*/
|
|
@@ -1028,6 +1032,14 @@ class bt extends B {
|
|
|
1028
1032
|
const { position: s, size: o, id: h, ...l } = n, d = super.addPane(e, { position: s, size: o, id: h }), a = new T({ ...l, sash: d, binaryWindow: this });
|
|
1029
1033
|
return d.domNode.append(a.domNode), d;
|
|
1030
1034
|
}
|
|
1035
|
+
removePane(e) {
|
|
1036
|
+
if (this.windowElement.querySelector(`[sash-id="${e}"]`)) {
|
|
1037
|
+
super.removePane(e);
|
|
1038
|
+
return;
|
|
1039
|
+
}
|
|
1040
|
+
const s = this.getMinimizedGlassElementBySashId(e);
|
|
1041
|
+
s && s.remove();
|
|
1042
|
+
}
|
|
1031
1043
|
}
|
|
1032
1044
|
bt.assemble(wt, mt, gt);
|
|
1033
1045
|
export {
|