@kong-ui-public/split-pane 0.5.13 → 0.5.14
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/split-pane.es.js +268 -263
- package/dist/split-pane.umd.js +1 -1
- package/package.json +2 -2
package/dist/split-pane.es.js
CHANGED
|
@@ -1,259 +1,264 @@
|
|
|
1
|
-
import { watch as
|
|
1
|
+
import { watch as Y, onMounted as ee, nextTick as G, getCurrentScope as xe, onScopeDispose as Ce, getCurrentInstance as he, computed as R, toValue as B, shallowRef as Q, watchEffect as We, unref as u, ref as P, readonly as te, defineComponent as ge, useCssVars as be, resolveComponent as oe, openBlock as x, createElementBlock as L, createElementVNode as C, Fragment as we, renderList as ye, createBlock as K, withCtx as Z, createVNode as le, withModifiers as ne, normalizeClass as N, resolveDynamicComponent as re, createCommentVNode as E, useSlots as Le, useTemplateRef as $, renderSlot as T, withDirectives as ue, vShow as de } from "vue";
|
|
2
2
|
import { ChevronDoubleLeftIcon as _e, ChevronDoubleRightIcon as ke } from "@kong/icons";
|
|
3
3
|
import { useRouter as ze } from "vue-router";
|
|
4
4
|
import { createI18n as De, i18nTComponent as $e } from "@kong-ui-public/i18n";
|
|
5
|
-
const Ie = "260px", ae = "500px",
|
|
6
|
-
function ie(e,
|
|
7
|
-
return xe() ? (Ce(e,
|
|
5
|
+
const Ie = "260px", ae = "500px", ce = "50%", fe = "50%";
|
|
6
|
+
function ie(e, a) {
|
|
7
|
+
return xe() ? (Ce(e, a), !0) : !1;
|
|
8
8
|
}
|
|
9
|
-
const
|
|
9
|
+
const Ne = typeof window < "u" && typeof document < "u";
|
|
10
10
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
11
|
-
const
|
|
11
|
+
const Ee = (e) => e != null, Te = Object.prototype.toString, Se = (e) => Te.call(e) === "[object Object]", Me = () => {
|
|
12
12
|
};
|
|
13
13
|
function U(e) {
|
|
14
14
|
return Array.isArray(e) ? e : [e];
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function Be(e) {
|
|
17
17
|
return he();
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
19
|
+
function Oe(e, a = !0, r) {
|
|
20
|
+
Be() ? ee(e, r) : a ? e() : G(e);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
return
|
|
24
|
-
...
|
|
22
|
+
function Ae(e, a, r) {
|
|
23
|
+
return Y(e, a, {
|
|
24
|
+
...r,
|
|
25
25
|
immediate: !0
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const O = Ne ? window : void 0;
|
|
29
29
|
function _(e) {
|
|
30
|
-
var
|
|
31
|
-
const
|
|
32
|
-
return (
|
|
30
|
+
var a;
|
|
31
|
+
const r = B(e);
|
|
32
|
+
return (a = r?.$el) !== null && a !== void 0 ? a : r;
|
|
33
33
|
}
|
|
34
34
|
function j(...e) {
|
|
35
|
-
const
|
|
36
|
-
const t = U(
|
|
37
|
-
return t.every((
|
|
35
|
+
const a = (t, n, o, s) => (t.addEventListener(n, o, s), () => t.removeEventListener(n, o, s)), r = R(() => {
|
|
36
|
+
const t = U(B(e[0])).filter((n) => n != null);
|
|
37
|
+
return t.every((n) => typeof n != "string") ? t : void 0;
|
|
38
38
|
});
|
|
39
|
-
return
|
|
40
|
-
var t,
|
|
39
|
+
return Ae(() => {
|
|
40
|
+
var t, n;
|
|
41
41
|
return [
|
|
42
|
-
(t = (
|
|
43
|
-
U(
|
|
44
|
-
U(r
|
|
45
|
-
|
|
42
|
+
(t = (n = r.value) === null || n === void 0 ? void 0 : n.map((o) => _(o))) !== null && t !== void 0 ? t : [O].filter((o) => o != null),
|
|
43
|
+
U(B(r.value ? e[1] : e[0])),
|
|
44
|
+
U(u(r.value ? e[2] : e[1])),
|
|
45
|
+
B(r.value ? e[3] : e[2])
|
|
46
46
|
];
|
|
47
|
-
}, ([t,
|
|
48
|
-
if (!t?.length || !
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
c.forEach((
|
|
47
|
+
}, ([t, n, o, s], l, p) => {
|
|
48
|
+
if (!t?.length || !n?.length || !o?.length) return;
|
|
49
|
+
const h = Se(s) ? { ...s } : s, c = t.flatMap((i) => n.flatMap((d) => o.map((v) => a(i, d, v, h))));
|
|
50
|
+
p(() => {
|
|
51
|
+
c.forEach((i) => i());
|
|
52
52
|
});
|
|
53
53
|
}, { flush: "post" });
|
|
54
54
|
}
|
|
55
55
|
// @__NO_SIDE_EFFECTS__
|
|
56
|
-
function
|
|
57
|
-
const e =
|
|
58
|
-
return
|
|
56
|
+
function Fe() {
|
|
57
|
+
const e = Q(!1), a = he();
|
|
58
|
+
return a && ee(() => {
|
|
59
59
|
e.value = !0;
|
|
60
|
-
},
|
|
60
|
+
}, a), e;
|
|
61
61
|
}
|
|
62
62
|
// @__NO_SIDE_EFFECTS__
|
|
63
63
|
function me(e) {
|
|
64
|
-
const
|
|
65
|
-
return R(() => (
|
|
64
|
+
const a = /* @__PURE__ */ Fe();
|
|
65
|
+
return R(() => (a.value, !!e()));
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
const { window: t =
|
|
67
|
+
function He(e, a, r = {}) {
|
|
68
|
+
const { window: t = O, ...n } = r;
|
|
69
69
|
let o;
|
|
70
|
-
const
|
|
70
|
+
const s = /* @__PURE__ */ me(() => t && "MutationObserver" in t), l = () => {
|
|
71
71
|
o && (o.disconnect(), o = void 0);
|
|
72
|
-
},
|
|
73
|
-
const
|
|
74
|
-
return new Set(
|
|
75
|
-
}), (
|
|
76
|
-
|
|
72
|
+
}, p = Y(R(() => {
|
|
73
|
+
const i = U(B(e)).map(_).filter(Ee);
|
|
74
|
+
return new Set(i);
|
|
75
|
+
}), (i) => {
|
|
76
|
+
l(), s.value && i.size && (o = new MutationObserver(a), i.forEach((d) => o.observe(d, n)));
|
|
77
77
|
}, {
|
|
78
78
|
immediate: !0,
|
|
79
79
|
flush: "post"
|
|
80
|
-
}),
|
|
81
|
-
|
|
80
|
+
}), h = () => o?.takeRecords(), c = () => {
|
|
81
|
+
p(), l();
|
|
82
82
|
};
|
|
83
83
|
return ie(c), {
|
|
84
|
-
isSupported:
|
|
84
|
+
isSupported: s,
|
|
85
85
|
stop: c,
|
|
86
|
-
takeRecords:
|
|
86
|
+
takeRecords: h
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
const { window: t =
|
|
91
|
-
if (!t || !
|
|
92
|
-
let
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
},
|
|
89
|
+
function Xe(e, a, r = {}) {
|
|
90
|
+
const { window: t = O, document: n = t?.document, flush: o = "sync" } = r;
|
|
91
|
+
if (!t || !n) return Me;
|
|
92
|
+
let s;
|
|
93
|
+
const l = (c) => {
|
|
94
|
+
s?.(), s = c;
|
|
95
|
+
}, p = We(() => {
|
|
96
96
|
const c = _(e);
|
|
97
97
|
if (c) {
|
|
98
|
-
const { stop:
|
|
99
|
-
d.map((
|
|
98
|
+
const { stop: i } = He(n, (d) => {
|
|
99
|
+
d.map((v) => [...v.removedNodes]).flat().some((v) => v === c || v.contains(c)) && a(d);
|
|
100
100
|
}, {
|
|
101
101
|
window: t,
|
|
102
102
|
childList: !0,
|
|
103
103
|
subtree: !0
|
|
104
104
|
});
|
|
105
|
-
|
|
105
|
+
l(i);
|
|
106
106
|
}
|
|
107
|
-
}, { flush: o }),
|
|
108
|
-
|
|
107
|
+
}, { flush: o }), h = () => {
|
|
108
|
+
p(), l();
|
|
109
109
|
};
|
|
110
|
-
return ie(
|
|
110
|
+
return ie(h), h;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
const { window: t =
|
|
112
|
+
function Ve(e, a, r = {}) {
|
|
113
|
+
const { window: t = O, ...n } = r;
|
|
114
114
|
let o;
|
|
115
|
-
const
|
|
115
|
+
const s = /* @__PURE__ */ me(() => t && "ResizeObserver" in t), l = () => {
|
|
116
116
|
o && (o.disconnect(), o = void 0);
|
|
117
|
-
},
|
|
118
|
-
const c =
|
|
119
|
-
return Array.isArray(c) ? c.map((
|
|
117
|
+
}, p = Y(R(() => {
|
|
118
|
+
const c = B(e);
|
|
119
|
+
return Array.isArray(c) ? c.map((i) => _(i)) : [_(c)];
|
|
120
120
|
}), (c) => {
|
|
121
|
-
if (
|
|
122
|
-
o = new ResizeObserver(
|
|
123
|
-
for (const
|
|
121
|
+
if (l(), s.value && t) {
|
|
122
|
+
o = new ResizeObserver(a);
|
|
123
|
+
for (const i of c) i && o.observe(i, n);
|
|
124
124
|
}
|
|
125
125
|
}, {
|
|
126
126
|
immediate: !0,
|
|
127
127
|
flush: "post"
|
|
128
|
-
}),
|
|
129
|
-
|
|
128
|
+
}), h = () => {
|
|
129
|
+
l(), p();
|
|
130
130
|
};
|
|
131
|
-
return ie(
|
|
132
|
-
isSupported:
|
|
133
|
-
stop:
|
|
131
|
+
return ie(h), {
|
|
132
|
+
isSupported: s,
|
|
133
|
+
stop: h
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
|
-
function ve(e,
|
|
137
|
-
const { delayEnter:
|
|
138
|
-
let
|
|
139
|
-
const
|
|
140
|
-
const c =
|
|
141
|
-
|
|
136
|
+
function ve(e, a = {}) {
|
|
137
|
+
const { delayEnter: r = 0, delayLeave: t = 0, triggerOnRemoval: n = !1, window: o = O } = a, s = Q(!1);
|
|
138
|
+
let l;
|
|
139
|
+
const p = (h) => {
|
|
140
|
+
const c = h ? r : t;
|
|
141
|
+
l && (clearTimeout(l), l = void 0), c ? l = setTimeout(() => s.value = h, c) : s.value = h;
|
|
142
142
|
};
|
|
143
|
-
return o && (j(e, "mouseenter", () =>
|
|
143
|
+
return o && (j(e, "mouseenter", () => p(!0), { passive: !0 }), j(e, "mouseleave", () => p(!1), { passive: !0 }), n && Xe(R(() => _(e)), () => p(!1))), s;
|
|
144
144
|
}
|
|
145
|
-
function Ke(e,
|
|
145
|
+
function Ke(e, a = {
|
|
146
146
|
width: 0,
|
|
147
147
|
height: 0
|
|
148
|
-
},
|
|
149
|
-
const { window: t =
|
|
150
|
-
var
|
|
151
|
-
return (
|
|
152
|
-
}),
|
|
153
|
-
const d =
|
|
148
|
+
}, r = {}) {
|
|
149
|
+
const { window: t = O, box: n = "content-box" } = r, o = R(() => {
|
|
150
|
+
var i;
|
|
151
|
+
return (i = _(e)) === null || i === void 0 || (i = i.namespaceURI) === null || i === void 0 ? void 0 : i.includes("svg");
|
|
152
|
+
}), s = Q(a.width), l = Q(a.height), { stop: p } = Ve(e, ([i]) => {
|
|
153
|
+
const d = n === "border-box" ? i.borderBoxSize : n === "content-box" ? i.contentBoxSize : i.devicePixelContentBoxSize;
|
|
154
154
|
if (t && o.value) {
|
|
155
|
-
const
|
|
156
|
-
if (
|
|
157
|
-
const
|
|
158
|
-
|
|
155
|
+
const v = _(e);
|
|
156
|
+
if (v) {
|
|
157
|
+
const g = v.getBoundingClientRect();
|
|
158
|
+
s.value = g.width, l.value = g.height;
|
|
159
159
|
}
|
|
160
160
|
} else if (d) {
|
|
161
|
-
const
|
|
162
|
-
|
|
161
|
+
const v = U(d);
|
|
162
|
+
s.value = v.reduce((g, { inlineSize: W }) => g + W, 0), l.value = v.reduce((g, { blockSize: W }) => g + W, 0);
|
|
163
163
|
} else
|
|
164
|
-
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
|
|
164
|
+
s.value = i.contentRect.width, l.value = i.contentRect.height;
|
|
165
|
+
}, r);
|
|
166
|
+
Oe(() => {
|
|
167
|
+
const i = _(e);
|
|
168
|
+
if (i && "offsetWidth" in i) if (n === "content-box" && t) {
|
|
169
|
+
const d = t.getComputedStyle(i), v = Number.parseFloat(d.paddingLeft) + Number.parseFloat(d.paddingRight), g = Number.parseFloat(d.paddingTop) + Number.parseFloat(d.paddingBottom), W = Number.parseFloat(d.borderLeftWidth) + Number.parseFloat(d.borderRightWidth), b = Number.parseFloat(d.borderTopWidth) + Number.parseFloat(d.borderBottomWidth);
|
|
170
|
+
s.value = i.offsetWidth - v - W, l.value = i.offsetHeight - g - b;
|
|
171
|
+
} else
|
|
172
|
+
s.value = i.offsetWidth, l.value = i.offsetHeight;
|
|
173
|
+
else i && (s.value = a.width, l.value = a.height);
|
|
169
174
|
});
|
|
170
|
-
const
|
|
171
|
-
|
|
175
|
+
const h = Y(() => _(e), (i) => {
|
|
176
|
+
s.value = i ? a.width : 0, l.value = i ? a.height : 0;
|
|
172
177
|
});
|
|
173
178
|
function c() {
|
|
174
|
-
|
|
179
|
+
p(), h();
|
|
175
180
|
}
|
|
176
181
|
return {
|
|
177
|
-
width:
|
|
178
|
-
height:
|
|
182
|
+
width: s,
|
|
183
|
+
height: l,
|
|
179
184
|
stop: c
|
|
180
185
|
};
|
|
181
186
|
}
|
|
182
|
-
const pe = "20px",
|
|
187
|
+
const pe = "20px", M = P(!1), I = P(!1), J = P(!0), V = P(0);
|
|
183
188
|
function Pe(e) {
|
|
184
|
-
const
|
|
189
|
+
const a = e?.verticalNavRef || P(null), r = e?.innerPanesContainerRef || P(null), t = e?.paneLeftRef || P(null), n = e?.paneCenterRef || P(null), o = e?.paneRightRef || P(null), s = (f) => {
|
|
185
190
|
switch (f) {
|
|
186
191
|
case "verticalNav":
|
|
187
|
-
return
|
|
192
|
+
return a.value?.offsetWidth || 0;
|
|
188
193
|
case "innerPanesContainer":
|
|
189
|
-
return
|
|
194
|
+
return r.value?.offsetWidth || 0;
|
|
190
195
|
case "paneLeft":
|
|
191
196
|
return t.value?.offsetWidth || 0;
|
|
192
197
|
case "paneCenter":
|
|
193
|
-
return
|
|
198
|
+
return n.value?.offsetWidth || 0;
|
|
194
199
|
case "paneRight":
|
|
195
200
|
return o.value?.offsetWidth || 0;
|
|
196
201
|
default:
|
|
197
202
|
return 0;
|
|
198
203
|
}
|
|
199
|
-
},
|
|
200
|
-
if (
|
|
204
|
+
}, l = P(50), p = P(0), h = P(0), c = P(0), i = P(0), d = (f) => {
|
|
205
|
+
if (n.value) {
|
|
201
206
|
if (f) {
|
|
202
|
-
|
|
207
|
+
n.value.style.width = `${f}%`, V.value = s("paneCenter");
|
|
203
208
|
return;
|
|
204
|
-
} else (typeof
|
|
205
|
-
|
|
209
|
+
} else (typeof l.value != "number" || !isFinite(l.value)) && (l.value = 38);
|
|
210
|
+
n.value.style.width = `${l.value}%`, V.value = s("paneCenter");
|
|
206
211
|
}
|
|
207
|
-
},
|
|
208
|
-
|
|
209
|
-
},
|
|
210
|
-
if (!
|
|
211
|
-
const f = 100,
|
|
212
|
-
if (k < f ?
|
|
212
|
+
}, v = () => {
|
|
213
|
+
n.value && o.value?.style.display === "none" ? (n.value.style.flex = "1", d(100)) : (n.value && (n.value.style.flex = ""), d());
|
|
214
|
+
}, g = () => {
|
|
215
|
+
if (!r.value || !n.value) return;
|
|
216
|
+
const f = 100, m = s("innerPanesContainer") - s("verticalNav") - s("paneLeft") - f, k = l.value / 100 * s("innerPanesContainer");
|
|
217
|
+
if (k < f ? l.value = f / s("innerPanesContainer") * 100 : k > m && (l.value = m / s("innerPanesContainer") * 100), n.value && o.value && o.value?.style.display === "none") {
|
|
213
218
|
d(100);
|
|
214
219
|
return;
|
|
215
220
|
}
|
|
216
221
|
d();
|
|
217
|
-
},
|
|
218
|
-
!
|
|
219
|
-
},
|
|
220
|
-
if (!I.value || !
|
|
221
|
-
const
|
|
222
|
-
|
|
222
|
+
}, W = (f) => {
|
|
223
|
+
!n.value || f.button !== 0 || (I.value = !0, p.value = f.clientX, h.value = n.value.offsetWidth || 0);
|
|
224
|
+
}, b = (f) => {
|
|
225
|
+
if (!I.value || !r.value || !n.value) return;
|
|
226
|
+
const m = r.value.offsetWidth, k = f.clientX - p.value, w = (h.value + k) / m * 100, y = 100 / m * 100, X = (m - 100) / m * 100;
|
|
227
|
+
l.value = Math.min(Math.max(y, w), X), d();
|
|
223
228
|
}, z = () => {
|
|
224
229
|
I.value = !1;
|
|
225
|
-
},
|
|
226
|
-
!t.value || !
|
|
227
|
-
},
|
|
228
|
-
if (!
|
|
229
|
-
let
|
|
230
|
-
const k = Number(Ie.replace(/px$/i, "")),
|
|
231
|
-
|
|
230
|
+
}, S = (f) => {
|
|
231
|
+
!t.value || !J.value || f.button !== 0 || (M.value = !0, c.value = f.clientX, i.value = t.value.offsetWidth || 0);
|
|
232
|
+
}, q = (f) => {
|
|
233
|
+
if (!M.value || !t.value) return;
|
|
234
|
+
let m = i.value + (f.clientX - c.value);
|
|
235
|
+
const k = Number(Ie.replace(/px$/i, "")), H = Number(ae.replace(/px$/i, ""));
|
|
236
|
+
m < k && (m = k), m > H && (m = H), t.value.style.width = `${m}px`, c.value = f.clientX, i.value = m, V.value = s("paneCenter");
|
|
232
237
|
}, D = () => {
|
|
233
|
-
|
|
234
|
-
},
|
|
235
|
-
I.value ||
|
|
236
|
-
},
|
|
237
|
-
|
|
238
|
+
M.value = !1;
|
|
239
|
+
}, A = () => {
|
|
240
|
+
I.value || g();
|
|
241
|
+
}, F = async () => {
|
|
242
|
+
J.value = !J.value;
|
|
238
243
|
};
|
|
239
|
-
return j(window, "resize",
|
|
240
|
-
await G(),
|
|
241
|
-
|
|
244
|
+
return j(window, "resize", A), ee(async () => {
|
|
245
|
+
await G(), n.value && (g(), await G(), d(), requestAnimationFrame(() => {
|
|
246
|
+
V.value = s("paneCenter");
|
|
242
247
|
}));
|
|
243
248
|
}), j(document, "mousemove", (f) => {
|
|
244
|
-
I.value &&
|
|
249
|
+
I.value && b(f), M.value && q(f);
|
|
245
250
|
}), j(document, "mouseup", () => {
|
|
246
|
-
I.value && z(),
|
|
251
|
+
I.value && z(), M.value && D();
|
|
247
252
|
}), {
|
|
248
|
-
isDraggingPaneLeft: te(
|
|
253
|
+
isDraggingPaneLeft: te(M),
|
|
249
254
|
isDraggingInnerPanes: te(I),
|
|
250
|
-
startDraggingInnerPanes:
|
|
251
|
-
refreshInnerPaneSizes:
|
|
255
|
+
startDraggingInnerPanes: W,
|
|
256
|
+
refreshInnerPaneSizes: v,
|
|
252
257
|
// Toggle the left pane
|
|
253
|
-
paneLeftExpanded: te(
|
|
254
|
-
togglePaneLeft:
|
|
255
|
-
startDraggingPaneLeft:
|
|
256
|
-
centerPaneWidth:
|
|
258
|
+
paneLeftExpanded: te(J),
|
|
259
|
+
togglePaneLeft: F,
|
|
260
|
+
startDraggingPaneLeft: S,
|
|
261
|
+
centerPaneWidth: V
|
|
257
262
|
};
|
|
258
263
|
}
|
|
259
264
|
const Ue = { return: "Return", collapse_panel: "Collapse panel", expand_panel: "Expand panel", drag_to_resize: "Click and drag to resize" }, je = {
|
|
@@ -267,7 +272,7 @@ function Re() {
|
|
|
267
272
|
// Translation component <i18n-t>
|
|
268
273
|
};
|
|
269
274
|
}
|
|
270
|
-
const Ge = { class: "kong-ui-public-split-pane-vertical-navigation" },
|
|
275
|
+
const Ge = { class: "kong-ui-public-split-pane-vertical-navigation" }, Ye = { class: "split-pane-nav" }, qe = { class: "top" }, Ze = { class: "bottom" }, Je = /* @__PURE__ */ ge({
|
|
271
276
|
__name: "VerticalNavigation",
|
|
272
277
|
props: {
|
|
273
278
|
paneLeftWidth: { default: 0 },
|
|
@@ -278,38 +283,38 @@ const Ge = { class: "kong-ui-public-split-pane-vertical-navigation" }, qe = { cl
|
|
|
278
283
|
be((d) => ({
|
|
279
284
|
eaa86402: c.value
|
|
280
285
|
}));
|
|
281
|
-
const { i18n:
|
|
282
|
-
t.value ||
|
|
286
|
+
const { i18n: a } = Re(), r = ze(), { paneLeftExpanded: t, togglePaneLeft: n, isDraggingPaneLeft: o, isDraggingInnerPanes: s } = Pe(), l = P(!1), p = P(!1), h = R(() => l.value || o.value || s.value), c = R(() => `${e.paneLeftWidth - 8}px`), i = (d) => {
|
|
287
|
+
t.value || n(), !d.active && d.to && r.push(d.to);
|
|
283
288
|
};
|
|
284
289
|
return ee(async () => {
|
|
285
|
-
await G(), await new Promise((d) => setTimeout(d, 500)),
|
|
286
|
-
}), (d,
|
|
287
|
-
const
|
|
288
|
-
return x(),
|
|
289
|
-
C("nav",
|
|
290
|
-
C("div",
|
|
291
|
-
(x(!0),
|
|
292
|
-
key:
|
|
290
|
+
await G(), await new Promise((d) => setTimeout(d, 500)), p.value = !0;
|
|
291
|
+
}), (d, v) => {
|
|
292
|
+
const g = oe("KButton"), W = oe("KTooltip");
|
|
293
|
+
return x(), L("div", Ge, [
|
|
294
|
+
C("nav", Ye, [
|
|
295
|
+
C("div", qe, [
|
|
296
|
+
(x(!0), L(we, null, ye(e.items, (b) => (x(), K(W, {
|
|
297
|
+
key: b.tooltip,
|
|
293
298
|
"kpop-attributes": { offset: "10px" },
|
|
294
|
-
label:
|
|
299
|
+
label: b.tooltip,
|
|
295
300
|
placement: "right"
|
|
296
301
|
}, {
|
|
297
|
-
default:
|
|
298
|
-
le(
|
|
302
|
+
default: Z(() => [
|
|
303
|
+
le(g, {
|
|
299
304
|
appearance: "none",
|
|
300
|
-
"aria-label":
|
|
301
|
-
class:
|
|
302
|
-
"data-testid": `kong-ui-public-split-pane-vertical-navigation-nav-item-${
|
|
305
|
+
"aria-label": b.tooltip,
|
|
306
|
+
class: N(["split-pane-nav-item", { active: b.active }]),
|
|
307
|
+
"data-testid": `kong-ui-public-split-pane-vertical-navigation-nav-item-${b.testid}`,
|
|
303
308
|
icon: "",
|
|
304
309
|
size: "large",
|
|
305
310
|
style: { cursor: "pointer" },
|
|
306
|
-
to:
|
|
307
|
-
onClickCapture: ne((z) =>
|
|
311
|
+
to: b.to,
|
|
312
|
+
onClickCapture: ne((z) => i(b), ["prevent"])
|
|
308
313
|
}, {
|
|
309
|
-
default:
|
|
310
|
-
(x(), K(re(
|
|
314
|
+
default: Z(() => [
|
|
315
|
+
(x(), K(re(b.icon), {
|
|
311
316
|
decorative: "",
|
|
312
|
-
size: `var(--kui-icon-size-40, ${
|
|
317
|
+
size: `var(--kui-icon-size-40, ${u(pe)})`
|
|
313
318
|
}, null, 8, ["size"]))
|
|
314
319
|
]),
|
|
315
320
|
_: 2
|
|
@@ -318,38 +323,38 @@ const Ge = { class: "kong-ui-public-split-pane-vertical-navigation" }, qe = { cl
|
|
|
318
323
|
_: 2
|
|
319
324
|
}, 1032, ["label"]))), 128))
|
|
320
325
|
]),
|
|
321
|
-
C("div",
|
|
322
|
-
e.paneLeftVisible ? (x(),
|
|
326
|
+
C("div", Ze, [
|
|
327
|
+
e.paneLeftVisible ? (x(), L("div", {
|
|
323
328
|
key: 0,
|
|
324
|
-
class:
|
|
325
|
-
expanded:
|
|
326
|
-
"disable-animation": !
|
|
329
|
+
class: N(["toggle-left-panel-control", {
|
|
330
|
+
expanded: u(t),
|
|
331
|
+
"disable-animation": !p.value || u(o) || u(s)
|
|
327
332
|
}]),
|
|
328
|
-
onTransitionend:
|
|
329
|
-
onTransitionstart:
|
|
333
|
+
onTransitionend: v[0] || (v[0] = ne((b) => l.value = !1, ["self"])),
|
|
334
|
+
onTransitionstart: v[1] || (v[1] = ne((b) => l.value = !0, ["self"]))
|
|
330
335
|
}, [
|
|
331
|
-
(x(), K(
|
|
332
|
-
key: String(
|
|
333
|
-
"kpop-attributes":
|
|
334
|
-
label:
|
|
335
|
-
placement:
|
|
336
|
+
(x(), K(W, {
|
|
337
|
+
key: String(u(t)),
|
|
338
|
+
"kpop-attributes": u(t) ? void 0 : { offset: "10px" },
|
|
339
|
+
label: h.value ? void 0 : u(t) ? u(a).t("actions.collapse_panel") : u(a).t("actions.expand_panel"),
|
|
340
|
+
placement: u(t) ? "left" : "right"
|
|
336
341
|
}, {
|
|
337
|
-
default:
|
|
338
|
-
le(
|
|
342
|
+
default: Z(() => [
|
|
343
|
+
le(g, {
|
|
339
344
|
appearance: "none",
|
|
340
345
|
"aria-controls": "left-pane",
|
|
341
|
-
"aria-expanded":
|
|
342
|
-
"aria-label":
|
|
346
|
+
"aria-expanded": u(t),
|
|
347
|
+
"aria-label": u(t) ? u(a).t("actions.collapse_panel") : u(a).t("actions.expand_panel"),
|
|
343
348
|
class: "split-pane-nav-item toggle-left-panel",
|
|
344
349
|
"data-testid": "kong-ui-public-split-pane-toggle-left-panel-button",
|
|
345
350
|
icon: "",
|
|
346
351
|
size: "large",
|
|
347
|
-
onClick:
|
|
352
|
+
onClick: u(n)
|
|
348
353
|
}, {
|
|
349
|
-
default:
|
|
350
|
-
(x(), K(re(
|
|
354
|
+
default: Z(() => [
|
|
355
|
+
(x(), K(re(u(t) ? u(_e) : u(ke)), {
|
|
351
356
|
decorative: "",
|
|
352
|
-
size: `var(--kui-icon-size-40, ${
|
|
357
|
+
size: `var(--kui-icon-size-40, ${u(pe)})`
|
|
353
358
|
}, null, 8, ["size"]))
|
|
354
359
|
]),
|
|
355
360
|
_: 1
|
|
@@ -357,18 +362,18 @@ const Ge = { class: "kong-ui-public-split-pane-vertical-navigation" }, qe = { cl
|
|
|
357
362
|
]),
|
|
358
363
|
_: 1
|
|
359
364
|
}, 8, ["kpop-attributes", "label", "placement"]))
|
|
360
|
-
], 34)) :
|
|
365
|
+
], 34)) : E("", !0)
|
|
361
366
|
])
|
|
362
367
|
])
|
|
363
368
|
]);
|
|
364
369
|
};
|
|
365
370
|
}
|
|
366
|
-
}), se = (e,
|
|
367
|
-
const
|
|
368
|
-
for (const [t,
|
|
369
|
-
|
|
370
|
-
return
|
|
371
|
-
},
|
|
371
|
+
}), se = (e, a) => {
|
|
372
|
+
const r = e.__vccOpts || e;
|
|
373
|
+
for (const [t, n] of a)
|
|
374
|
+
r[t] = n;
|
|
375
|
+
return r;
|
|
376
|
+
}, Qe = /* @__PURE__ */ se(Je, [["__scopeId", "data-v-59e8017f"]]), et = { class: "split-pane-container" }, tt = { class: "split-pane-container-inner" }, nt = { class: "panes" }, at = ["aria-hidden", "tabindex"], it = ["title"], st = { class: "split-pane-container-inner-content" }, ot = ["aria-hidden", "tabindex"], lt = ["title"], rt = ["aria-hidden", "tabindex"], ut = /* @__PURE__ */ ge({
|
|
372
377
|
__name: "SplitPane",
|
|
373
378
|
props: {
|
|
374
379
|
resizable: { type: Boolean, default: !0 },
|
|
@@ -383,7 +388,7 @@ const Ge = { class: "kong-ui-public-split-pane-vertical-navigation" }, qe = { cl
|
|
|
383
388
|
paneCenter: { default: () => ({
|
|
384
389
|
/** Pass false to hide the panel even if it contains slot content */
|
|
385
390
|
visible: !0,
|
|
386
|
-
maxWidth:
|
|
391
|
+
maxWidth: ce
|
|
387
392
|
}) },
|
|
388
393
|
paneRight: { default: () => ({
|
|
389
394
|
/** Pass false to hide the panel even if it contains slot content */
|
|
@@ -394,110 +399,110 @@ const Ge = { class: "kong-ui-public-split-pane-vertical-navigation" }, qe = { cl
|
|
|
394
399
|
setup(e) {
|
|
395
400
|
be((w) => ({
|
|
396
401
|
v1300c9c8: t.value,
|
|
397
|
-
v183c98aa:
|
|
402
|
+
v183c98aa: n.value,
|
|
398
403
|
bf8b5faa: o.value
|
|
399
404
|
}));
|
|
400
|
-
const
|
|
401
|
-
verticalNavRef:
|
|
402
|
-
innerPanesContainerRef:
|
|
403
|
-
paneLeftRef:
|
|
404
|
-
paneCenterRef:
|
|
405
|
+
const a = Le(), r = (w) => w === "left" ? e.paneLeft.maxWidth !== void 0 ? e.paneLeft.maxWidth : ae : w === "center" ? e.resizable ? "none" : e.paneCenter.maxWidth !== void 0 ? e.paneCenter.maxWidth : ce : w === "right" ? e.resizable ? "none" : e.paneRight.maxWidth !== void 0 ? e.paneRight.maxWidth : fe : "none", t = R(() => r("left")), n = R(() => r("center")), o = R(() => r("right")), s = $("verticalNavRef"), l = $("innerPanesContainerRef"), p = $("paneLeftRef"), h = $("paneCenterRef"), c = $("paneRightRef"), i = $("paneLeftDivider"), d = $("innerPanesDivider"), { startDraggingInnerPanes: v, startDraggingPaneLeft: g, refreshInnerPaneSizes: W, paneLeftExpanded: b, isDraggingPaneLeft: z, isDraggingInnerPanes: S } = Pe({
|
|
406
|
+
verticalNavRef: s,
|
|
407
|
+
innerPanesContainerRef: l,
|
|
408
|
+
paneLeftRef: p,
|
|
409
|
+
paneCenterRef: h,
|
|
405
410
|
paneRightRef: c
|
|
406
|
-
}), { i18n:
|
|
407
|
-
return
|
|
408
|
-
e.resizable && (await G(),
|
|
409
|
-
}, { flush: "post" }), (w,
|
|
410
|
-
class:
|
|
411
|
+
}), { i18n: q } = Re(), D = R(() => !!a["pane-left"] && e.paneLeft.visible !== !1 && b.value), A = R(() => !!a["pane-center"] && e.paneCenter.visible !== !1), F = R(() => !!a["pane-right"] && e.paneRight.visible !== !1), f = R(() => e.resizable && e.showResizeHandle && !!a["pane-center"] && e.paneCenter.visible !== !1 && !!a["pane-right"] && e.paneRight.visible !== !1), m = ve(i), k = ve(d), { width: H } = Ke(p);
|
|
412
|
+
return Y(() => e.paneRight.visible, async () => {
|
|
413
|
+
e.resizable && (await G(), W());
|
|
414
|
+
}, { flush: "post" }), (w, y) => (x(), L("div", {
|
|
415
|
+
class: N(["kong-ui-public-split-pane", { "has-navigation": e.showNavigation }]),
|
|
411
416
|
"data-testid": "split-pane"
|
|
412
417
|
}, [
|
|
413
418
|
C("div", et, [
|
|
414
|
-
e.showNavigation ? (x(), K(
|
|
419
|
+
e.showNavigation ? (x(), K(Qe, {
|
|
415
420
|
key: 0,
|
|
416
421
|
ref_key: "verticalNavRef",
|
|
417
|
-
ref:
|
|
422
|
+
ref: s,
|
|
418
423
|
items: e.navigationItems,
|
|
419
424
|
"pane-left-visible": e.paneLeft.visible !== !1,
|
|
420
|
-
"pane-left-width":
|
|
421
|
-
}, null, 8, ["items", "pane-left-visible", "pane-left-width"])) :
|
|
425
|
+
"pane-left-width": u(H)
|
|
426
|
+
}, null, 8, ["items", "pane-left-visible", "pane-left-width"])) : E("", !0),
|
|
422
427
|
C("div", tt, [
|
|
423
428
|
C("div", nt, [
|
|
424
429
|
C("div", {
|
|
425
430
|
ref_key: "paneLeftRef",
|
|
426
|
-
ref:
|
|
431
|
+
ref: p,
|
|
427
432
|
"aria-hidden": D.value ? void 0 : "true",
|
|
428
|
-
class:
|
|
433
|
+
class: N(["split-pane-left", [{ expanded: u(b), "show-resize-border": u(m) }, { "is-dragging-pane-left": u(z) }, { "is-dragging-pane": u(z) || u(S) }]]),
|
|
429
434
|
"data-testid": "split-pane-left",
|
|
430
435
|
tabindex: D.value ? 0 : -1
|
|
431
436
|
}, [
|
|
432
|
-
|
|
437
|
+
T(w.$slots, "pane-left", {}, void 0, !0)
|
|
433
438
|
], 10, at),
|
|
434
|
-
D.value ? (x(),
|
|
439
|
+
D.value ? (x(), L("div", {
|
|
435
440
|
key: 0,
|
|
436
441
|
ref_key: "paneLeftDivider",
|
|
437
|
-
ref:
|
|
442
|
+
ref: i,
|
|
438
443
|
class: "split-pane-resize-divider left",
|
|
439
444
|
"data-testid": "split-pane-resize-divider-left",
|
|
440
445
|
tabindex: "0",
|
|
441
|
-
title:
|
|
442
|
-
onMousedown:
|
|
443
|
-
(...
|
|
444
|
-
}, [...
|
|
446
|
+
title: u(q).t("actions.drag_to_resize"),
|
|
447
|
+
onMousedown: y[0] || (y[0] = //@ts-ignore
|
|
448
|
+
(...X) => u(g) && u(g)(...X))
|
|
449
|
+
}, [...y[2] || (y[2] = [
|
|
445
450
|
C("div", { class: "split-pane-drag-handle" }, null, -1)
|
|
446
|
-
])], 40, it)) :
|
|
451
|
+
])], 40, it)) : E("", !0),
|
|
447
452
|
C("div", st, [
|
|
448
|
-
|
|
453
|
+
a.toolbar ? (x(), L("div", {
|
|
449
454
|
key: 0,
|
|
450
|
-
class:
|
|
455
|
+
class: N(["split-pane-toolbar-container", { "has-resize-divider-left": D.value }]),
|
|
451
456
|
"data-testid": "split-pane-toolbar"
|
|
452
457
|
}, [
|
|
453
|
-
|
|
454
|
-
], 2)) :
|
|
458
|
+
T(w.$slots, "toolbar", {}, void 0, !0)
|
|
459
|
+
], 2)) : E("", !0),
|
|
455
460
|
C("div", {
|
|
456
461
|
ref_key: "innerPanesContainerRef",
|
|
457
|
-
ref:
|
|
462
|
+
ref: l,
|
|
458
463
|
class: "split-pane-inner-panes"
|
|
459
464
|
}, [
|
|
460
465
|
ue(C("div", {
|
|
461
466
|
ref_key: "paneCenterRef",
|
|
462
|
-
ref:
|
|
463
|
-
"aria-hidden":
|
|
464
|
-
class:
|
|
467
|
+
ref: h,
|
|
468
|
+
"aria-hidden": A.value ? void 0 : "true",
|
|
469
|
+
class: N(["split-pane-center", [{ "has-resize-divider-left": D.value }, { "has-resize-divider-right": f.value }, { "is-dragging-pane": u(z) || u(S) }]]),
|
|
465
470
|
"data-testid": "split-pane-center",
|
|
466
|
-
tabindex:
|
|
471
|
+
tabindex: A.value ? 0 : -1
|
|
467
472
|
}, [
|
|
468
|
-
|
|
473
|
+
T(w.$slots, "pane-center", {}, void 0, !0)
|
|
469
474
|
], 10, ot), [
|
|
470
|
-
[
|
|
475
|
+
[de, A.value]
|
|
471
476
|
]),
|
|
472
|
-
f.value ? (x(),
|
|
477
|
+
f.value ? (x(), L("div", {
|
|
473
478
|
key: 0,
|
|
474
479
|
ref_key: "innerPanesDivider",
|
|
475
480
|
ref: d,
|
|
476
481
|
class: "split-pane-resize-divider right",
|
|
477
482
|
"data-testid": "split-pane-resize-divider-right",
|
|
478
483
|
tabindex: "0",
|
|
479
|
-
title:
|
|
480
|
-
onMousedown:
|
|
481
|
-
(...
|
|
482
|
-
}, [...
|
|
484
|
+
title: u(q).t("actions.drag_to_resize"),
|
|
485
|
+
onMousedown: y[1] || (y[1] = //@ts-ignore
|
|
486
|
+
(...X) => u(v) && u(v)(...X))
|
|
487
|
+
}, [...y[3] || (y[3] = [
|
|
483
488
|
C("div", { class: "split-pane-drag-handle" }, null, -1)
|
|
484
|
-
])], 40, lt)) :
|
|
489
|
+
])], 40, lt)) : E("", !0),
|
|
485
490
|
ue(C("div", {
|
|
486
491
|
ref_key: "paneRightRef",
|
|
487
492
|
ref: c,
|
|
488
|
-
"aria-hidden":
|
|
489
|
-
class:
|
|
490
|
-
{ "has-toolbar": !!
|
|
491
|
-
{ "show-resize-border":
|
|
492
|
-
{ "is-dragging-inner-panes":
|
|
493
|
-
{ "is-dragging-pane":
|
|
493
|
+
"aria-hidden": F.value ? void 0 : "true",
|
|
494
|
+
class: N(["split-pane-right", [
|
|
495
|
+
{ "has-toolbar": !!a.toolbar },
|
|
496
|
+
{ "show-resize-border": u(k) },
|
|
497
|
+
{ "is-dragging-inner-panes": u(S) },
|
|
498
|
+
{ "is-dragging-pane": u(z) || u(S) }
|
|
494
499
|
]]),
|
|
495
500
|
"data-testid": "split-pane-right",
|
|
496
|
-
tabindex:
|
|
501
|
+
tabindex: F.value ? 0 : -1
|
|
497
502
|
}, [
|
|
498
|
-
|
|
503
|
+
T(w.$slots, "pane-right", {}, void 0, !0)
|
|
499
504
|
], 10, rt), [
|
|
500
|
-
[
|
|
505
|
+
[de, F.value]
|
|
501
506
|
])
|
|
502
507
|
], 512)
|
|
503
508
|
])
|
|
@@ -506,7 +511,7 @@ const Ge = { class: "kong-ui-public-split-pane-vertical-navigation" }, qe = { cl
|
|
|
506
511
|
])
|
|
507
512
|
], 2));
|
|
508
513
|
}
|
|
509
|
-
}), Rt = /* @__PURE__ */ se(ut, [["__scopeId", "data-v-a19fbade"]]),
|
|
514
|
+
}), Rt = /* @__PURE__ */ se(ut, [["__scopeId", "data-v-a19fbade"]]), dt = {}, ct = {
|
|
510
515
|
class: "kong-ui-public-split-pane-toolbar",
|
|
511
516
|
"data-testid": "kong-ui-public-split-pane-toolbar"
|
|
512
517
|
}, ft = {
|
|
@@ -521,20 +526,20 @@ const Ge = { class: "kong-ui-public-split-pane-vertical-navigation" }, qe = { cl
|
|
|
521
526
|
class: "right",
|
|
522
527
|
"data-testid": "split-toolbar-right"
|
|
523
528
|
};
|
|
524
|
-
function ht(e,
|
|
525
|
-
return x(),
|
|
529
|
+
function ht(e, a) {
|
|
530
|
+
return x(), L("div", ct, [
|
|
526
531
|
C("div", ft, [
|
|
527
|
-
|
|
532
|
+
T(e.$slots, "left", {}, void 0, !0)
|
|
528
533
|
]),
|
|
529
|
-
e.$slots.center ? (x(),
|
|
530
|
-
|
|
531
|
-
])) :
|
|
532
|
-
e.$slots.right ? (x(),
|
|
533
|
-
|
|
534
|
-
])) :
|
|
534
|
+
e.$slots.center ? (x(), L("div", vt, [
|
|
535
|
+
T(e.$slots, "center", {}, void 0, !0)
|
|
536
|
+
])) : E("", !0),
|
|
537
|
+
e.$slots.right ? (x(), L("div", pt, [
|
|
538
|
+
T(e.$slots, "right", {}, void 0, !0)
|
|
539
|
+
])) : E("", !0)
|
|
535
540
|
]);
|
|
536
541
|
}
|
|
537
|
-
const xt = /* @__PURE__ */ se(
|
|
542
|
+
const xt = /* @__PURE__ */ se(dt, [["render", ht], ["__scopeId", "data-v-44b95676"]]);
|
|
538
543
|
export {
|
|
539
544
|
Rt as SplitPane,
|
|
540
545
|
xt as SplitToolbar
|
package/dist/split-pane.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(k,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@kong/icons"),require("vue-router"),require("@kong-ui-public/i18n")):typeof define=="function"&&define.amd?define(["exports","vue","@kong/icons","vue-router","@kong-ui-public/i18n"],e):(k=typeof globalThis<"u"?globalThis:k||self,e(k["kong-ui-public-split-pane"]={},k.Vue,k.KongIcons,k.VueRouter,k["kong-ui-public-i18n"]))})(this,(function(k,e,X,Z,F){"use strict";const J="260px",A="500px";function H(t,a){return e.getCurrentScope()?(e.onScopeDispose(t,a),!0):!1}const Q=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Y=t=>t!=null,ee=Object.prototype.toString,te=t=>ee.call(t)==="[object Object]",ne=()=>{};function W(t){return Array.isArray(t)?t:[t]}function ae(t){return e.getCurrentInstance()}function ie(t,a=!0,r){ae()?e.onMounted(t,r):a?t():e.nextTick(t)}function oe(t,a,r){return e.watch(t,a,{...r,immediate:!0})}const T=Q?window:void 0;function R(t){var a;const r=e.toValue(t);return(a=r?.$el)!==null&&a!==void 0?a:r}function z(...t){const a=(n,i,l,o)=>(n.addEventListener(i,l,o),()=>n.removeEventListener(i,l,o)),r=e.computed(()=>{const n=W(e.toValue(t[0])).filter(i=>i!=null);return n.every(i=>typeof i!="string")?n:void 0});return oe(()=>{var n,i;return[(n=(i=r.value)===null||i===void 0?void 0:i.map(l=>R(l)))!==null&&n!==void 0?n:[T].filter(l=>l!=null),W(e.toValue(r.value?t[1]:t[0])),W(e.unref(r.value?t[2]:t[1])),e.toValue(r.value?t[3]:t[2])]},([n,i,l,o],c,u)=>{if(!n?.length||!i?.length||!l?.length)return;const h=te(o)?{...o}:o,d=n.flatMap(s=>i.flatMap(f=>l.map(g=>a(s,f,g,h))));u(()=>{d.forEach(s=>s())})},{flush:"post"})}function se(){const t=e.shallowRef(!1),a=e.getCurrentInstance();return a&&e.onMounted(()=>{t.value=!0},a),t}function U(t){const a=se();return e.computed(()=>(a.value,!!t()))}function le(t,a,r={}){const{window:n=T,...i}=r;let l;const o=U(()=>n&&"MutationObserver"in n),c=()=>{l&&(l.disconnect(),l=void 0)},u=e.watch(e.computed(()=>{const s=W(e.toValue(t)).map(R).filter(Y);return new Set(s)}),s=>{c(),o.value&&s.size&&(l=new MutationObserver(a),s.forEach(f=>l.observe(f,i)))},{immediate:!0,flush:"post"}),h=()=>l?.takeRecords(),d=()=>{u(),c()};return H(d),{isSupported:o,stop:d,takeRecords:h}}function re(t,a,r={}){const{window:n=T,document:i=n?.document,flush:l="sync"}=r;if(!n||!i)return ne;let o;const c=d=>{o?.(),o=d},u=e.watchEffect(()=>{const d=R(t);if(d){const{stop:s}=le(i,f=>{f.map(g=>[...g.removedNodes]).flat().some(g=>g===d||g.contains(d))&&a(f)},{window:n,childList:!0,subtree:!0});c(s)}},{flush:l}),h=()=>{u(),c()};return H(h),h}function ce(t,a,r={}){const{window:n=T,...i}=r;let l;const o=U(()=>n&&"ResizeObserver"in n),c=()=>{l&&(l.disconnect(),l=void 0)},u=e.watch(e.computed(()=>{const d=e.toValue(t);return Array.isArray(d)?d.map(s=>R(s)):[R(d)]}),d=>{if(c(),o.value&&n){l=new ResizeObserver(a);for(const s of d)s&&l.observe(s,i)}},{immediate:!0,flush:"post"}),h=()=>{c(),u()};return H(h),{isSupported:o,stop:h}}function j(t,a={}){const{delayEnter:r=0,delayLeave:n=0,triggerOnRemoval:i=!1,window:l=T}=a,o=e.shallowRef(!1);let c;const u=h=>{const d=h?r:n;c&&(clearTimeout(c),c=void 0),d?c=setTimeout(()=>o.value=h,d):o.value=h};return l&&(z(t,"mouseenter",()=>u(!0),{passive:!0}),z(t,"mouseleave",()=>u(!1),{passive:!0}),i&&re(e.computed(()=>R(t)),()=>u(!1))),o}function de(t,a={width:0,height:0},r={}){const{window:n=T,box:i="content-box"}=r,l=e.computed(()=>{var s;return(s=R(t))===null||s===void 0||(s=s.namespaceURI)===null||s===void 0?void 0:s.includes("svg")}),o=e.shallowRef(a.width),c=e.shallowRef(a.height),{stop:u}=ce(t,([s])=>{const f=i==="border-box"?s.borderBoxSize:i==="content-box"?s.contentBoxSize:s.devicePixelContentBoxSize;if(n&&l.value){const g=R(t);if(g){const b=g.getBoundingClientRect();o.value=b.width,c.value=b.height}}else if(f){const g=W(f);o.value=g.reduce((b,{inlineSize:P})=>b+P,0),c.value=g.reduce((b,{blockSize:P})=>b+P,0)}else o.value=s.contentRect.width,c.value=s.contentRect.height},r);ie(()=>{const s=R(t);s&&(o.value="offsetWidth"in s?s.offsetWidth:a.width,c.value="offsetHeight"in s?s.offsetHeight:a.height)});const h=e.watch(()=>R(t),s=>{o.value=s?a.width:0,c.value=s?a.height:0});function d(){u(),h()}return{width:o,height:c,stop:d}}const G="20px",L=e.ref(!1),E=e.ref(!1),S=e.ref(!0),D=e.ref(0);function K(t){const a=t?.verticalNavRef||e.ref(null),r=t?.innerPanesContainerRef||e.ref(null),n=t?.paneLeftRef||e.ref(null),i=t?.paneCenterRef||e.ref(null),l=t?.paneRightRef||e.ref(null),o=p=>{switch(p){case"verticalNav":return a.value?.offsetWidth||0;case"innerPanesContainer":return r.value?.offsetWidth||0;case"paneLeft":return n.value?.offsetWidth||0;case"paneCenter":return i.value?.offsetWidth||0;case"paneRight":return l.value?.offsetWidth||0;default:return 0}},c=e.ref(50),u=e.ref(0),h=e.ref(0),d=e.ref(0),s=e.ref(0),f=p=>{if(i.value){if(p){i.value.style.width=`${p}%`,D.value=o("paneCenter");return}else(typeof c.value!="number"||!isFinite(c.value))&&(c.value=38);i.value.style.width=`${c.value}%`,D.value=o("paneCenter")}},g=()=>{i.value&&l.value?.style.display==="none"?(i.value.style.flex="1",f(100)):(i.value&&(i.value.style.flex=""),f())},b=()=>{if(!r.value||!i.value)return;const p=100,m=o("innerPanesContainer")-o("verticalNav")-o("paneLeft")-p,x=c.value/100*o("innerPanesContainer");if(x<p?c.value=p/o("innerPanesContainer")*100:x>m&&(c.value=m/o("innerPanesContainer")*100),i.value&&l.value&&l.value?.style.display==="none"){f(100);return}f()},P=p=>{!i.value||p.button!==0||(E.value=!0,u.value=p.clientX,h.value=i.value.offsetWidth||0)},v=p=>{if(!E.value||!r.value||!i.value)return;const m=r.value.offsetWidth,x=p.clientX-u.value,C=(h.value+x)/m*100,w=100/m*100,$=(m-100)/m*100;c.value=Math.min(Math.max(w,C),$),f()},_=()=>{E.value=!1},N=p=>{!n.value||!S.value||p.button!==0||(L.value=!0,d.value=p.clientX,s.value=n.value.offsetWidth||0)},M=p=>{if(!L.value||!n.value)return;let m=s.value+(p.clientX-d.value);const x=Number(J.replace(/px$/i,"")),V=Number(A.replace(/px$/i,""));m<x&&(m=x),m>V&&(m=V),n.value.style.width=`${m}px`,d.value=p.clientX,s.value=m,D.value=o("paneCenter")},y=()=>{L.value=!1},I=()=>{E.value||b()},B=async()=>{S.value=!S.value};return z(window,"resize",I),e.onMounted(async()=>{await e.nextTick(),i.value&&(b(),await e.nextTick(),f(),requestAnimationFrame(()=>{D.value=o("paneCenter")}))}),z(document,"mousemove",p=>{E.value&&v(p),L.value&&M(p)}),z(document,"mouseup",()=>{E.value&&_(),L.value&&y()}),{isDraggingPaneLeft:e.readonly(L),isDraggingInnerPanes:e.readonly(E),startDraggingInnerPanes:P,refreshInnerPaneSizes:g,paneLeftExpanded:e.readonly(S),togglePaneLeft:B,startDraggingPaneLeft:N,centerPaneWidth:D}}const fe={actions:{return:"Return",collapse_panel:"Collapse panel",expand_panel:"Expand panel",drag_to_resize:"Click and drag to resize"}};function q(){const t=F.createI18n("en-us",fe);return{i18n:t,i18nT:F.i18nTComponent(t)}}const pe={class:"kong-ui-public-split-pane-vertical-navigation"},ue={class:"split-pane-nav"},he={class:"top"},ge={class:"bottom"},me=e.defineComponent({__name:"VerticalNavigation",props:{paneLeftWidth:{default:0},paneLeftVisible:{type:Boolean,default:!0},items:{default:()=>[]}},setup(t){e.useCssVars(f=>({eaa86402:d.value}));const{i18n:a}=q(),r=Z.useRouter(),{paneLeftExpanded:n,togglePaneLeft:i,isDraggingPaneLeft:l,isDraggingInnerPanes:o}=K(),c=e.ref(!1),u=e.ref(!1),h=e.computed(()=>c.value||l.value||o.value),d=e.computed(()=>`${t.paneLeftWidth-8}px`),s=f=>{n.value||i(),!f.active&&f.to&&r.push(f.to)};return e.onMounted(async()=>{await e.nextTick(),await new Promise(f=>setTimeout(f,500)),u.value=!0}),(f,g)=>{const b=e.resolveComponent("KButton"),P=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("div",pe,[e.createElementVNode("nav",ue,[e.createElementVNode("div",he,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,v=>(e.openBlock(),e.createBlock(P,{key:v.tooltip,"kpop-attributes":{offset:"10px"},label:v.tooltip,placement:"right"},{default:e.withCtx(()=>[e.createVNode(b,{appearance:"none","aria-label":v.tooltip,class:e.normalizeClass(["split-pane-nav-item",{active:v.active}]),"data-testid":`kong-ui-public-split-pane-vertical-navigation-nav-item-${v.testid}`,icon:"",size:"large",style:{cursor:"pointer"},to:v.to,onClickCapture:e.withModifiers(_=>s(v),["prevent"])},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(v.icon),{decorative:"",size:`var(--kui-icon-size-40, ${e.unref(G)})`},null,8,["size"]))]),_:2},1032,["aria-label","class","data-testid","to","onClickCapture"])]),_:2},1032,["label"]))),128))]),e.createElementVNode("div",ge,[t.paneLeftVisible?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["toggle-left-panel-control",{expanded:e.unref(n),"disable-animation":!u.value||e.unref(l)||e.unref(o)}]),onTransitionend:g[0]||(g[0]=e.withModifiers(v=>c.value=!1,["self"])),onTransitionstart:g[1]||(g[1]=e.withModifiers(v=>c.value=!0,["self"]))},[(e.openBlock(),e.createBlock(P,{key:String(e.unref(n)),"kpop-attributes":e.unref(n)?void 0:{offset:"10px"},label:h.value?void 0:e.unref(n)?e.unref(a).t("actions.collapse_panel"):e.unref(a).t("actions.expand_panel"),placement:e.unref(n)?"left":"right"},{default:e.withCtx(()=>[e.createVNode(b,{appearance:"none","aria-controls":"left-pane","aria-expanded":e.unref(n),"aria-label":e.unref(n)?e.unref(a).t("actions.collapse_panel"):e.unref(a).t("actions.expand_panel"),class:"split-pane-nav-item toggle-left-panel","data-testid":"kong-ui-public-split-pane-toggle-left-panel-button",icon:"",size:"large",onClick:e.unref(i)},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(n)?e.unref(X.ChevronDoubleLeftIcon):e.unref(X.ChevronDoubleRightIcon)),{decorative:"",size:`var(--kui-icon-size-40, ${e.unref(G)})`},null,8,["size"]))]),_:1},8,["aria-expanded","aria-label","onClick"])]),_:1},8,["kpop-attributes","label","placement"]))],34)):e.createCommentVNode("",!0)])])])}}}),O=(t,a)=>{const r=t.__vccOpts||t;for(const[n,i]of a)r[n]=i;return r},be=O(me,[["__scopeId","data-v-59e8017f"]]),ve={class:"split-pane-container"},ke={class:"split-pane-container-inner"},Ce={class:"panes"},Re=["aria-hidden","tabindex"],Pe=["title"],we={class:"split-pane-container-inner-content"},xe=["aria-hidden","tabindex"],Ee=["title"],_e=["aria-hidden","tabindex"],ye=O(e.defineComponent({__name:"SplitPane",props:{resizable:{type:Boolean,default:!0},showResizeHandle:{type:Boolean,default:!0},showNavigation:{type:Boolean,default:!0},navigationItems:{default:()=>[]},paneLeft:{default:()=>({visible:!0,maxWidth:A})},paneCenter:{default:()=>({visible:!0,maxWidth:"50%"})},paneRight:{default:()=>({visible:!0,maxWidth:"50%"})}},setup(t){e.useCssVars(C=>({v1300c9c8:n.value,v183c98aa:i.value,bf8b5faa:l.value}));const a=e.useSlots(),r=C=>C==="left"?t.paneLeft.maxWidth!==void 0?t.paneLeft.maxWidth:A:C==="center"?t.resizable?"none":t.paneCenter.maxWidth!==void 0?t.paneCenter.maxWidth:"50%":C==="right"?t.resizable?"none":t.paneRight.maxWidth!==void 0?t.paneRight.maxWidth:"50%":"none",n=e.computed(()=>r("left")),i=e.computed(()=>r("center")),l=e.computed(()=>r("right")),o=e.useTemplateRef("verticalNavRef"),c=e.useTemplateRef("innerPanesContainerRef"),u=e.useTemplateRef("paneLeftRef"),h=e.useTemplateRef("paneCenterRef"),d=e.useTemplateRef("paneRightRef"),s=e.useTemplateRef("paneLeftDivider"),f=e.useTemplateRef("innerPanesDivider"),{startDraggingInnerPanes:g,startDraggingPaneLeft:b,refreshInnerPaneSizes:P,paneLeftExpanded:v,isDraggingPaneLeft:_,isDraggingInnerPanes:N}=K({verticalNavRef:o,innerPanesContainerRef:c,paneLeftRef:u,paneCenterRef:h,paneRightRef:d}),{i18n:M}=q(),y=e.computed(()=>!!a["pane-left"]&&t.paneLeft.visible!==!1&&v.value),I=e.computed(()=>!!a["pane-center"]&&t.paneCenter.visible!==!1),B=e.computed(()=>!!a["pane-right"]&&t.paneRight.visible!==!1),p=e.computed(()=>t.resizable&&t.showResizeHandle&&!!a["pane-center"]&&t.paneCenter.visible!==!1&&!!a["pane-right"]&&t.paneRight.visible!==!1),m=j(s),x=j(f),{width:V}=de(u);return e.watch(()=>t.paneRight.visible,async()=>{t.resizable&&(await e.nextTick(),P())},{flush:"post"}),(C,w)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["kong-ui-public-split-pane",{"has-navigation":t.showNavigation}]),"data-testid":"split-pane"},[e.createElementVNode("div",ve,[t.showNavigation?(e.openBlock(),e.createBlock(be,{key:0,ref_key:"verticalNavRef",ref:o,items:t.navigationItems,"pane-left-visible":t.paneLeft.visible!==!1,"pane-left-width":e.unref(V)},null,8,["items","pane-left-visible","pane-left-width"])):e.createCommentVNode("",!0),e.createElementVNode("div",ke,[e.createElementVNode("div",Ce,[e.createElementVNode("div",{ref_key:"paneLeftRef",ref:u,"aria-hidden":y.value?void 0:"true",class:e.normalizeClass(["split-pane-left",[{expanded:e.unref(v),"show-resize-border":e.unref(m)},{"is-dragging-pane-left":e.unref(_)},{"is-dragging-pane":e.unref(_)||e.unref(N)}]]),"data-testid":"split-pane-left",tabindex:y.value?0:-1},[e.renderSlot(C.$slots,"pane-left",{},void 0,!0)],10,Re),y.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"paneLeftDivider",ref:s,class:"split-pane-resize-divider left","data-testid":"split-pane-resize-divider-left",tabindex:"0",title:e.unref(M).t("actions.drag_to_resize"),onMousedown:w[0]||(w[0]=(...$)=>e.unref(b)&&e.unref(b)(...$))},[...w[2]||(w[2]=[e.createElementVNode("div",{class:"split-pane-drag-handle"},null,-1)])],40,Pe)):e.createCommentVNode("",!0),e.createElementVNode("div",we,[a.toolbar?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["split-pane-toolbar-container",{"has-resize-divider-left":y.value}]),"data-testid":"split-pane-toolbar"},[e.renderSlot(C.$slots,"toolbar",{},void 0,!0)],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"innerPanesContainerRef",ref:c,class:"split-pane-inner-panes"},[e.withDirectives(e.createElementVNode("div",{ref_key:"paneCenterRef",ref:h,"aria-hidden":I.value?void 0:"true",class:e.normalizeClass(["split-pane-center",[{"has-resize-divider-left":y.value},{"has-resize-divider-right":p.value},{"is-dragging-pane":e.unref(_)||e.unref(N)}]]),"data-testid":"split-pane-center",tabindex:I.value?0:-1},[e.renderSlot(C.$slots,"pane-center",{},void 0,!0)],10,xe),[[e.vShow,I.value]]),p.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"innerPanesDivider",ref:f,class:"split-pane-resize-divider right","data-testid":"split-pane-resize-divider-right",tabindex:"0",title:e.unref(M).t("actions.drag_to_resize"),onMousedown:w[1]||(w[1]=(...$)=>e.unref(g)&&e.unref(g)(...$))},[...w[3]||(w[3]=[e.createElementVNode("div",{class:"split-pane-drag-handle"},null,-1)])],40,Ee)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",{ref_key:"paneRightRef",ref:d,"aria-hidden":B.value?void 0:"true",class:e.normalizeClass(["split-pane-right",[{"has-toolbar":!!a.toolbar},{"show-resize-border":e.unref(x)},{"is-dragging-inner-panes":e.unref(N)},{"is-dragging-pane":e.unref(_)||e.unref(N)}]]),"data-testid":"split-pane-right",tabindex:B.value?0:-1},[e.renderSlot(C.$slots,"pane-right",{},void 0,!0)],10,_e),[[e.vShow,B.value]])],512)])])])])],2))}}),[["__scopeId","data-v-a19fbade"]]),Te={},Le={class:"kong-ui-public-split-pane-toolbar","data-testid":"kong-ui-public-split-pane-toolbar"},Ne={class:"left","data-testid":"split-toolbar-left"},We={key:0,class:"center","data-testid":"split-toolbar-center"},ze={key:1,class:"right","data-testid":"split-toolbar-right"};function De(t,a){return e.openBlock(),e.createElementBlock("div",Le,[e.createElementVNode("div",Ne,[e.renderSlot(t.$slots,"left",{},void 0,!0)]),t.$slots.center?(e.openBlock(),e.createElementBlock("div",We,[e.renderSlot(t.$slots,"center",{},void 0,!0)])):e.createCommentVNode("",!0),t.$slots.right?(e.openBlock(),e.createElementBlock("div",ze,[e.renderSlot(t.$slots,"right",{},void 0,!0)])):e.createCommentVNode("",!0)])}const Ie=O(Te,[["render",De],["__scopeId","data-v-44b95676"]]);k.SplitPane=ye,k.SplitToolbar=Ie,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(C,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@kong/icons"),require("vue-router"),require("@kong-ui-public/i18n")):typeof define=="function"&&define.amd?define(["exports","vue","@kong/icons","vue-router","@kong-ui-public/i18n"],e):(C=typeof globalThis<"u"?globalThis:C||self,e(C["kong-ui-public-split-pane"]={},C.Vue,C.KongIcons,C.VueRouter,C["kong-ui-public-i18n"]))})(this,(function(C,e,O,Y,X){"use strict";const Z="260px",A="500px";function F(t,i){return e.getCurrentScope()?(e.onScopeDispose(t,i),!0):!1}const J=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Q=t=>t!=null,ee=Object.prototype.toString,te=t=>ee.call(t)==="[object Object]",ne=()=>{};function L(t){return Array.isArray(t)?t:[t]}function ae(t){return e.getCurrentInstance()}function ie(t,i=!0,c){ae()?e.onMounted(t,c):i?t():e.nextTick(t)}function oe(t,i,c){return e.watch(t,i,{...c,immediate:!0})}const y=J?window:void 0;function P(t){var i;const c=e.toValue(t);return(i=c?.$el)!==null&&i!==void 0?i:c}function z(...t){const i=(n,a,l,s)=>(n.addEventListener(a,l,s),()=>n.removeEventListener(a,l,s)),c=e.computed(()=>{const n=L(e.toValue(t[0])).filter(a=>a!=null);return n.every(a=>typeof a!="string")?n:void 0});return oe(()=>{var n,a;return[(n=(a=c.value)===null||a===void 0?void 0:a.map(l=>P(l)))!==null&&n!==void 0?n:[y].filter(l=>l!=null),L(e.toValue(c.value?t[1]:t[0])),L(e.unref(c.value?t[2]:t[1])),e.toValue(c.value?t[3]:t[2])]},([n,a,l,s],r,h)=>{if(!n?.length||!a?.length||!l?.length)return;const g=te(s)?{...s}:s,f=n.flatMap(o=>a.flatMap(d=>l.map(u=>i(o,d,u,g))));h(()=>{f.forEach(o=>o())})},{flush:"post"})}function se(){const t=e.shallowRef(!1),i=e.getCurrentInstance();return i&&e.onMounted(()=>{t.value=!0},i),t}function U(t){const i=se();return e.computed(()=>(i.value,!!t()))}function le(t,i,c={}){const{window:n=y,...a}=c;let l;const s=U(()=>n&&"MutationObserver"in n),r=()=>{l&&(l.disconnect(),l=void 0)},h=e.watch(e.computed(()=>{const o=L(e.toValue(t)).map(P).filter(Q);return new Set(o)}),o=>{r(),s.value&&o.size&&(l=new MutationObserver(i),o.forEach(d=>l.observe(d,a)))},{immediate:!0,flush:"post"}),g=()=>l?.takeRecords(),f=()=>{h(),r()};return F(f),{isSupported:s,stop:f,takeRecords:g}}function re(t,i,c={}){const{window:n=y,document:a=n?.document,flush:l="sync"}=c;if(!n||!a)return ne;let s;const r=f=>{s?.(),s=f},h=e.watchEffect(()=>{const f=P(t);if(f){const{stop:o}=le(a,d=>{d.map(u=>[...u.removedNodes]).flat().some(u=>u===f||u.contains(f))&&i(d)},{window:n,childList:!0,subtree:!0});r(o)}},{flush:l}),g=()=>{h(),r()};return F(g),g}function ce(t,i,c={}){const{window:n=y,...a}=c;let l;const s=U(()=>n&&"ResizeObserver"in n),r=()=>{l&&(l.disconnect(),l=void 0)},h=e.watch(e.computed(()=>{const f=e.toValue(t);return Array.isArray(f)?f.map(o=>P(o)):[P(f)]}),f=>{if(r(),s.value&&n){l=new ResizeObserver(i);for(const o of f)o&&l.observe(o,a)}},{immediate:!0,flush:"post"}),g=()=>{r(),h()};return F(g),{isSupported:s,stop:g}}function j(t,i={}){const{delayEnter:c=0,delayLeave:n=0,triggerOnRemoval:a=!1,window:l=y}=i,s=e.shallowRef(!1);let r;const h=g=>{const f=g?c:n;r&&(clearTimeout(r),r=void 0),f?r=setTimeout(()=>s.value=g,f):s.value=g};return l&&(z(t,"mouseenter",()=>h(!0),{passive:!0}),z(t,"mouseleave",()=>h(!1),{passive:!0}),a&&re(e.computed(()=>P(t)),()=>h(!1))),s}function de(t,i={width:0,height:0},c={}){const{window:n=y,box:a="content-box"}=c,l=e.computed(()=>{var o;return(o=P(t))===null||o===void 0||(o=o.namespaceURI)===null||o===void 0?void 0:o.includes("svg")}),s=e.shallowRef(i.width),r=e.shallowRef(i.height),{stop:h}=ce(t,([o])=>{const d=a==="border-box"?o.borderBoxSize:a==="content-box"?o.contentBoxSize:o.devicePixelContentBoxSize;if(n&&l.value){const u=P(t);if(u){const m=u.getBoundingClientRect();s.value=m.width,r.value=m.height}}else if(d){const u=L(d);s.value=u.reduce((m,{inlineSize:k})=>m+k,0),r.value=u.reduce((m,{blockSize:k})=>m+k,0)}else s.value=o.contentRect.width,r.value=o.contentRect.height},c);ie(()=>{const o=P(t);if(o&&"offsetWidth"in o)if(a==="content-box"&&n){const d=n.getComputedStyle(o),u=Number.parseFloat(d.paddingLeft)+Number.parseFloat(d.paddingRight),m=Number.parseFloat(d.paddingTop)+Number.parseFloat(d.paddingBottom),k=Number.parseFloat(d.borderLeftWidth)+Number.parseFloat(d.borderRightWidth),b=Number.parseFloat(d.borderTopWidth)+Number.parseFloat(d.borderBottomWidth);s.value=o.offsetWidth-u-k,r.value=o.offsetHeight-m-b}else s.value=o.offsetWidth,r.value=o.offsetHeight;else o&&(s.value=i.width,r.value=i.height)});const g=e.watch(()=>P(t),o=>{s.value=o?i.width:0,r.value=o?i.height:0});function f(){h(),g()}return{width:s,height:r,stop:f}}const G="20px",W=e.ref(!1),E=e.ref(!1),S=e.ref(!0),D=e.ref(0);function K(t){const i=t?.verticalNavRef||e.ref(null),c=t?.innerPanesContainerRef||e.ref(null),n=t?.paneLeftRef||e.ref(null),a=t?.paneCenterRef||e.ref(null),l=t?.paneRightRef||e.ref(null),s=p=>{switch(p){case"verticalNav":return i.value?.offsetWidth||0;case"innerPanesContainer":return c.value?.offsetWidth||0;case"paneLeft":return n.value?.offsetWidth||0;case"paneCenter":return a.value?.offsetWidth||0;case"paneRight":return l.value?.offsetWidth||0;default:return 0}},r=e.ref(50),h=e.ref(0),g=e.ref(0),f=e.ref(0),o=e.ref(0),d=p=>{if(a.value){if(p){a.value.style.width=`${p}%`,D.value=s("paneCenter");return}else(typeof r.value!="number"||!isFinite(r.value))&&(r.value=38);a.value.style.width=`${r.value}%`,D.value=s("paneCenter")}},u=()=>{a.value&&l.value?.style.display==="none"?(a.value.style.flex="1",d(100)):(a.value&&(a.value.style.flex=""),d())},m=()=>{if(!c.value||!a.value)return;const p=100,v=s("innerPanesContainer")-s("verticalNav")-s("paneLeft")-p,x=r.value/100*s("innerPanesContainer");if(x<p?r.value=p/s("innerPanesContainer")*100:x>v&&(r.value=v/s("innerPanesContainer")*100),a.value&&l.value&&l.value?.style.display==="none"){d(100);return}d()},k=p=>{!a.value||p.button!==0||(E.value=!0,h.value=p.clientX,g.value=a.value.offsetWidth||0)},b=p=>{if(!E.value||!c.value||!a.value)return;const v=c.value.offsetWidth,x=p.clientX-h.value,R=(g.value+x)/v*100,w=100/v*100,$=(v-100)/v*100;r.value=Math.min(Math.max(w,R),$),d()},_=()=>{E.value=!1},T=p=>{!n.value||!S.value||p.button!==0||(W.value=!0,f.value=p.clientX,o.value=n.value.offsetWidth||0)},M=p=>{if(!W.value||!n.value)return;let v=o.value+(p.clientX-f.value);const x=Number(Z.replace(/px$/i,"")),V=Number(A.replace(/px$/i,""));v<x&&(v=x),v>V&&(v=V),n.value.style.width=`${v}px`,f.value=p.clientX,o.value=v,D.value=s("paneCenter")},N=()=>{W.value=!1},B=()=>{E.value||m()},I=async()=>{S.value=!S.value};return z(window,"resize",B),e.onMounted(async()=>{await e.nextTick(),a.value&&(m(),await e.nextTick(),d(),requestAnimationFrame(()=>{D.value=s("paneCenter")}))}),z(document,"mousemove",p=>{E.value&&b(p),W.value&&M(p)}),z(document,"mouseup",()=>{E.value&&_(),W.value&&N()}),{isDraggingPaneLeft:e.readonly(W),isDraggingInnerPanes:e.readonly(E),startDraggingInnerPanes:k,refreshInnerPaneSizes:u,paneLeftExpanded:e.readonly(S),togglePaneLeft:I,startDraggingPaneLeft:T,centerPaneWidth:D}}const fe={actions:{return:"Return",collapse_panel:"Collapse panel",expand_panel:"Expand panel",drag_to_resize:"Click and drag to resize"}};function q(){const t=X.createI18n("en-us",fe);return{i18n:t,i18nT:X.i18nTComponent(t)}}const pe={class:"kong-ui-public-split-pane-vertical-navigation"},ue={class:"split-pane-nav"},he={class:"top"},ge={class:"bottom"},me=e.defineComponent({__name:"VerticalNavigation",props:{paneLeftWidth:{default:0},paneLeftVisible:{type:Boolean,default:!0},items:{default:()=>[]}},setup(t){e.useCssVars(d=>({eaa86402:f.value}));const{i18n:i}=q(),c=Y.useRouter(),{paneLeftExpanded:n,togglePaneLeft:a,isDraggingPaneLeft:l,isDraggingInnerPanes:s}=K(),r=e.ref(!1),h=e.ref(!1),g=e.computed(()=>r.value||l.value||s.value),f=e.computed(()=>`${t.paneLeftWidth-8}px`),o=d=>{n.value||a(),!d.active&&d.to&&c.push(d.to)};return e.onMounted(async()=>{await e.nextTick(),await new Promise(d=>setTimeout(d,500)),h.value=!0}),(d,u)=>{const m=e.resolveComponent("KButton"),k=e.resolveComponent("KTooltip");return e.openBlock(),e.createElementBlock("div",pe,[e.createElementVNode("nav",ue,[e.createElementVNode("div",he,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,b=>(e.openBlock(),e.createBlock(k,{key:b.tooltip,"kpop-attributes":{offset:"10px"},label:b.tooltip,placement:"right"},{default:e.withCtx(()=>[e.createVNode(m,{appearance:"none","aria-label":b.tooltip,class:e.normalizeClass(["split-pane-nav-item",{active:b.active}]),"data-testid":`kong-ui-public-split-pane-vertical-navigation-nav-item-${b.testid}`,icon:"",size:"large",style:{cursor:"pointer"},to:b.to,onClickCapture:e.withModifiers(_=>o(b),["prevent"])},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(b.icon),{decorative:"",size:`var(--kui-icon-size-40, ${e.unref(G)})`},null,8,["size"]))]),_:2},1032,["aria-label","class","data-testid","to","onClickCapture"])]),_:2},1032,["label"]))),128))]),e.createElementVNode("div",ge,[t.paneLeftVisible?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["toggle-left-panel-control",{expanded:e.unref(n),"disable-animation":!h.value||e.unref(l)||e.unref(s)}]),onTransitionend:u[0]||(u[0]=e.withModifiers(b=>r.value=!1,["self"])),onTransitionstart:u[1]||(u[1]=e.withModifiers(b=>r.value=!0,["self"]))},[(e.openBlock(),e.createBlock(k,{key:String(e.unref(n)),"kpop-attributes":e.unref(n)?void 0:{offset:"10px"},label:g.value?void 0:e.unref(n)?e.unref(i).t("actions.collapse_panel"):e.unref(i).t("actions.expand_panel"),placement:e.unref(n)?"left":"right"},{default:e.withCtx(()=>[e.createVNode(m,{appearance:"none","aria-controls":"left-pane","aria-expanded":e.unref(n),"aria-label":e.unref(n)?e.unref(i).t("actions.collapse_panel"):e.unref(i).t("actions.expand_panel"),class:"split-pane-nav-item toggle-left-panel","data-testid":"kong-ui-public-split-pane-toggle-left-panel-button",icon:"",size:"large",onClick:e.unref(a)},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(n)?e.unref(O.ChevronDoubleLeftIcon):e.unref(O.ChevronDoubleRightIcon)),{decorative:"",size:`var(--kui-icon-size-40, ${e.unref(G)})`},null,8,["size"]))]),_:1},8,["aria-expanded","aria-label","onClick"])]),_:1},8,["kpop-attributes","label","placement"]))],34)):e.createCommentVNode("",!0)])])])}}}),H=(t,i)=>{const c=t.__vccOpts||t;for(const[n,a]of i)c[n]=a;return c},be=H(me,[["__scopeId","data-v-59e8017f"]]),ve={class:"split-pane-container"},ke={class:"split-pane-container-inner"},Ce={class:"panes"},Re=["aria-hidden","tabindex"],Pe=["title"],we={class:"split-pane-container-inner-content"},xe=["aria-hidden","tabindex"],Ee=["title"],_e=["aria-hidden","tabindex"],Ne=H(e.defineComponent({__name:"SplitPane",props:{resizable:{type:Boolean,default:!0},showResizeHandle:{type:Boolean,default:!0},showNavigation:{type:Boolean,default:!0},navigationItems:{default:()=>[]},paneLeft:{default:()=>({visible:!0,maxWidth:A})},paneCenter:{default:()=>({visible:!0,maxWidth:"50%"})},paneRight:{default:()=>({visible:!0,maxWidth:"50%"})}},setup(t){e.useCssVars(R=>({v1300c9c8:n.value,v183c98aa:a.value,bf8b5faa:l.value}));const i=e.useSlots(),c=R=>R==="left"?t.paneLeft.maxWidth!==void 0?t.paneLeft.maxWidth:A:R==="center"?t.resizable?"none":t.paneCenter.maxWidth!==void 0?t.paneCenter.maxWidth:"50%":R==="right"?t.resizable?"none":t.paneRight.maxWidth!==void 0?t.paneRight.maxWidth:"50%":"none",n=e.computed(()=>c("left")),a=e.computed(()=>c("center")),l=e.computed(()=>c("right")),s=e.useTemplateRef("verticalNavRef"),r=e.useTemplateRef("innerPanesContainerRef"),h=e.useTemplateRef("paneLeftRef"),g=e.useTemplateRef("paneCenterRef"),f=e.useTemplateRef("paneRightRef"),o=e.useTemplateRef("paneLeftDivider"),d=e.useTemplateRef("innerPanesDivider"),{startDraggingInnerPanes:u,startDraggingPaneLeft:m,refreshInnerPaneSizes:k,paneLeftExpanded:b,isDraggingPaneLeft:_,isDraggingInnerPanes:T}=K({verticalNavRef:s,innerPanesContainerRef:r,paneLeftRef:h,paneCenterRef:g,paneRightRef:f}),{i18n:M}=q(),N=e.computed(()=>!!i["pane-left"]&&t.paneLeft.visible!==!1&&b.value),B=e.computed(()=>!!i["pane-center"]&&t.paneCenter.visible!==!1),I=e.computed(()=>!!i["pane-right"]&&t.paneRight.visible!==!1),p=e.computed(()=>t.resizable&&t.showResizeHandle&&!!i["pane-center"]&&t.paneCenter.visible!==!1&&!!i["pane-right"]&&t.paneRight.visible!==!1),v=j(o),x=j(d),{width:V}=de(h);return e.watch(()=>t.paneRight.visible,async()=>{t.resizable&&(await e.nextTick(),k())},{flush:"post"}),(R,w)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["kong-ui-public-split-pane",{"has-navigation":t.showNavigation}]),"data-testid":"split-pane"},[e.createElementVNode("div",ve,[t.showNavigation?(e.openBlock(),e.createBlock(be,{key:0,ref_key:"verticalNavRef",ref:s,items:t.navigationItems,"pane-left-visible":t.paneLeft.visible!==!1,"pane-left-width":e.unref(V)},null,8,["items","pane-left-visible","pane-left-width"])):e.createCommentVNode("",!0),e.createElementVNode("div",ke,[e.createElementVNode("div",Ce,[e.createElementVNode("div",{ref_key:"paneLeftRef",ref:h,"aria-hidden":N.value?void 0:"true",class:e.normalizeClass(["split-pane-left",[{expanded:e.unref(b),"show-resize-border":e.unref(v)},{"is-dragging-pane-left":e.unref(_)},{"is-dragging-pane":e.unref(_)||e.unref(T)}]]),"data-testid":"split-pane-left",tabindex:N.value?0:-1},[e.renderSlot(R.$slots,"pane-left",{},void 0,!0)],10,Re),N.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"paneLeftDivider",ref:o,class:"split-pane-resize-divider left","data-testid":"split-pane-resize-divider-left",tabindex:"0",title:e.unref(M).t("actions.drag_to_resize"),onMousedown:w[0]||(w[0]=(...$)=>e.unref(m)&&e.unref(m)(...$))},[...w[2]||(w[2]=[e.createElementVNode("div",{class:"split-pane-drag-handle"},null,-1)])],40,Pe)):e.createCommentVNode("",!0),e.createElementVNode("div",we,[i.toolbar?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["split-pane-toolbar-container",{"has-resize-divider-left":N.value}]),"data-testid":"split-pane-toolbar"},[e.renderSlot(R.$slots,"toolbar",{},void 0,!0)],2)):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"innerPanesContainerRef",ref:r,class:"split-pane-inner-panes"},[e.withDirectives(e.createElementVNode("div",{ref_key:"paneCenterRef",ref:g,"aria-hidden":B.value?void 0:"true",class:e.normalizeClass(["split-pane-center",[{"has-resize-divider-left":N.value},{"has-resize-divider-right":p.value},{"is-dragging-pane":e.unref(_)||e.unref(T)}]]),"data-testid":"split-pane-center",tabindex:B.value?0:-1},[e.renderSlot(R.$slots,"pane-center",{},void 0,!0)],10,xe),[[e.vShow,B.value]]),p.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"innerPanesDivider",ref:d,class:"split-pane-resize-divider right","data-testid":"split-pane-resize-divider-right",tabindex:"0",title:e.unref(M).t("actions.drag_to_resize"),onMousedown:w[1]||(w[1]=(...$)=>e.unref(u)&&e.unref(u)(...$))},[...w[3]||(w[3]=[e.createElementVNode("div",{class:"split-pane-drag-handle"},null,-1)])],40,Ee)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("div",{ref_key:"paneRightRef",ref:f,"aria-hidden":I.value?void 0:"true",class:e.normalizeClass(["split-pane-right",[{"has-toolbar":!!i.toolbar},{"show-resize-border":e.unref(x)},{"is-dragging-inner-panes":e.unref(T)},{"is-dragging-pane":e.unref(_)||e.unref(T)}]]),"data-testid":"split-pane-right",tabindex:I.value?0:-1},[e.renderSlot(R.$slots,"pane-right",{},void 0,!0)],10,_e),[[e.vShow,I.value]])],512)])])])])],2))}}),[["__scopeId","data-v-a19fbade"]]),ye={},We={class:"kong-ui-public-split-pane-toolbar","data-testid":"kong-ui-public-split-pane-toolbar"},Te={class:"left","data-testid":"split-toolbar-left"},Le={key:0,class:"center","data-testid":"split-toolbar-center"},ze={key:1,class:"right","data-testid":"split-toolbar-right"};function De(t,i){return e.openBlock(),e.createElementBlock("div",We,[e.createElementVNode("div",Te,[e.renderSlot(t.$slots,"left",{},void 0,!0)]),t.$slots.center?(e.openBlock(),e.createElementBlock("div",Le,[e.renderSlot(t.$slots,"center",{},void 0,!0)])):e.createCommentVNode("",!0),t.$slots.right?(e.openBlock(),e.createElementBlock("div",ze,[e.renderSlot(t.$slots,"right",{},void 0,!0)])):e.createCommentVNode("",!0)])}const Be=H(ye,[["render",De],["__scopeId","data-v-44b95676"]]);C.SplitPane=Ne,C.SplitToolbar=Be,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kong-ui-public/split-pane",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A shared SplitPane layout component for Vue 3 applications.",
|
|
6
6
|
"main": "./dist/split-pane.umd.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@kong-ui-public/i18n": "^2.5.1"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@vueuse/core": "^14.
|
|
54
|
+
"@vueuse/core": "^14.4.0"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"dev": "cross-env USE_SANDBOX=true vite",
|