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