golden-logic-ui 1.3.11 → 1.3.13
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/components/GeneralComponents/ConfirmationModal.vue.js +118 -41
- package/dist/components/GeneralComponents/DataTable/GLDataTable.vue.js +124 -114
- package/dist/components/GeneralComponents/DataTable/GLDataTableServerSide.vue.js +339 -243
- package/dist/components/GeneralComponents/DataTable/GlDataTableComponent.vue.js +117 -91
- package/dist/components/GeneralComponents/DeleteConfirmationModal.vue.js +107 -42
- package/dist/components/GeneralComponents/GlLogViewer.vue.js +237 -0
- package/dist/components/GeneralComponents/GlModal.vue.js +58 -35
- package/dist/components/GeneralComponents/GlStatusBadge.vue.js +69 -0
- package/dist/components/GeneralComponents/GlTabsWrapper.vue.js +78 -52
- package/dist/components/GeneralComponents/GlTextCopy.vue.js +27 -27
- package/dist/components/GeneralComponents/glStatusMap.js +255 -0
- package/dist/components/GeneralComponents/useGlFocusTrap.js +67 -0
- package/dist/golden-logic-ui.css +1 -1
- package/dist/main.js +114 -103
- package/package.json +1 -1
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { ref as w, computed as c, watch as H, nextTick as b, onMounted as z, createElementBlock as s, openBlock as a, createElementVNode as o, createBlock as U, createCommentVNode as f, renderSlot as T, toDisplayString as i, normalizeClass as O, normalizeStyle as L, Fragment as W, renderList as G } from "vue";
|
|
2
|
+
import I from "./GlStatusBadge.vue.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import Z from "../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
+
const P = ["aria-label"], q = { class: "flex flex-wrap items-center gap-2 px-3 py-2 text-xs border-b border-white/10 bg-gray-900" }, J = {
|
|
6
|
+
key: 1,
|
|
7
|
+
class: "font-semibold text-gray-200 truncate"
|
|
8
|
+
}, K = {
|
|
9
|
+
key: 2,
|
|
10
|
+
class: "text-gray-500"
|
|
11
|
+
}, Q = { class: "flex items-center gap-1 ms-auto" }, X = ["aria-pressed", "title"], Y = { class: "hidden sm:inline" }, _ = ["title", "disabled"], ee = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "w-3.5 h-3.5",
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
16
|
+
fill: "none",
|
|
17
|
+
viewBox: "0 0 24 24"
|
|
18
|
+
}, te = {
|
|
19
|
+
key: 1,
|
|
20
|
+
class: "w-3.5 h-3.5 text-green-300",
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
23
|
+
fill: "none",
|
|
24
|
+
viewBox: "0 0 24 24"
|
|
25
|
+
}, le = { class: "hidden sm:inline" }, oe = ["title", "disabled"], ne = { class: "hidden sm:inline" }, ae = ["aria-busy"], se = {
|
|
26
|
+
key: 0,
|
|
27
|
+
class: "p-4 space-y-2 animate-pulse",
|
|
28
|
+
role: "status"
|
|
29
|
+
}, ie = { class: "sr-only" }, re = {
|
|
30
|
+
key: 1,
|
|
31
|
+
class: "flex items-center justify-center p-8 text-center text-gray-500"
|
|
32
|
+
}, de = {
|
|
33
|
+
key: 2,
|
|
34
|
+
class: "py-3"
|
|
35
|
+
}, ue = { class: "whitespace-pre-wrap break-all" }, ce = {
|
|
36
|
+
key: 3,
|
|
37
|
+
class: "px-4 py-3 whitespace-pre-wrap break-words"
|
|
38
|
+
}, ge = {
|
|
39
|
+
__name: "GlLogViewer",
|
|
40
|
+
props: {
|
|
41
|
+
/** The whole log as one string. */
|
|
42
|
+
content: { type: String, default: "" },
|
|
43
|
+
/** Alias of `content` (RunOutput's name). */
|
|
44
|
+
text: { type: String, default: "" },
|
|
45
|
+
/** The log as an array of lines; used when no content/text is given. */
|
|
46
|
+
lines: { type: Array, default: null },
|
|
47
|
+
/** Keep scrolled to the newest line. Supports v-model:follow. */
|
|
48
|
+
follow: { type: Boolean, default: !0 },
|
|
49
|
+
/** Re-enable follow when the user scrolls back to the bottom. */
|
|
50
|
+
autoFollow: { type: Boolean, default: !0 },
|
|
51
|
+
lineNumbers: { type: Boolean, default: !1 },
|
|
52
|
+
title: { type: String, default: "" },
|
|
53
|
+
status: { type: [String, Number], default: "" },
|
|
54
|
+
domain: { type: String, default: "run" },
|
|
55
|
+
showStatus: { type: Boolean, default: !0 },
|
|
56
|
+
loading: { type: Boolean, default: !1 },
|
|
57
|
+
emptyText: { type: String, default: "" },
|
|
58
|
+
showDownload: { type: Boolean, default: !0 },
|
|
59
|
+
filename: { type: String, default: "log.txt" },
|
|
60
|
+
maxHeight: { type: String, default: "32rem" },
|
|
61
|
+
minHeight: { type: String, default: "8rem" },
|
|
62
|
+
language: { type: Object, default: () => ({}) }
|
|
63
|
+
},
|
|
64
|
+
emits: ["update:follow", "copy"],
|
|
65
|
+
setup(t, { expose: A, emit: j }) {
|
|
66
|
+
const N = /\u001b\[[0-?]*[ -/]*[@-~]|\u001b\][^\u0007\u001b]*(?:\u0007|\u001b\\)|\u001b[@-Z\\-_]/g, n = t, x = j, p = w(null), r = w(n.follow && n.autoFollow), y = w(!1), F = (e) => String(e ?? "").replace(N, ""), d = c(() => {
|
|
67
|
+
const e = n.content || n.text || (Array.isArray(n.lines) ? n.lines.map((l) => String(l ?? "")).join(`
|
|
68
|
+
`) : "");
|
|
69
|
+
return F(e).replace(/\r\n/g, `
|
|
70
|
+
`).replace(/\r(?!\n)/g, `
|
|
71
|
+
`);
|
|
72
|
+
}), g = c(() => d.value.trim().length > 0), k = c(() => g.value ? d.value.split(`
|
|
73
|
+
`) : []), h = c(() => k.value.length), E = c(() => `${String(h.value).length + 1}ch`), M = c(() => n.status !== "" && n.status !== null && n.status !== void 0), m = () => {
|
|
74
|
+
const e = p.value;
|
|
75
|
+
e && r.value && (e.scrollTop = e.scrollHeight);
|
|
76
|
+
}, v = (e) => {
|
|
77
|
+
r.value !== e && (r.value = e, x("update:follow", e));
|
|
78
|
+
}, V = () => {
|
|
79
|
+
v(!r.value), m();
|
|
80
|
+
}, D = () => {
|
|
81
|
+
const e = p.value;
|
|
82
|
+
if (!e)
|
|
83
|
+
return;
|
|
84
|
+
const l = e.scrollHeight - e.scrollTop - e.clientHeight < 24;
|
|
85
|
+
!l && r.value ? v(!1) : l && !r.value && n.autoFollow && v(!0);
|
|
86
|
+
}, S = () => {
|
|
87
|
+
y.value = !0, x("copy", d.value), setTimeout(() => y.value = !1, 1500);
|
|
88
|
+
}, R = () => {
|
|
89
|
+
const e = document.createElement("textarea");
|
|
90
|
+
e.value = d.value, e.setAttribute("readonly", ""), e.style.position = "absolute", e.style.left = "-9999px", document.body.appendChild(e), e.select();
|
|
91
|
+
try {
|
|
92
|
+
document.execCommand("copy") && S();
|
|
93
|
+
} finally {
|
|
94
|
+
document.body.removeChild(e);
|
|
95
|
+
}
|
|
96
|
+
}, C = async () => {
|
|
97
|
+
try {
|
|
98
|
+
await navigator.clipboard.writeText(d.value), S();
|
|
99
|
+
} catch {
|
|
100
|
+
R();
|
|
101
|
+
}
|
|
102
|
+
}, $ = () => {
|
|
103
|
+
const e = new Blob([d.value], { type: "text/plain;charset=utf-8" }), l = URL.createObjectURL(e), u = document.createElement("a");
|
|
104
|
+
u.href = l, u.download = n.filename.endsWith(".txt") ? n.filename : `${n.filename}.txt`, document.body.appendChild(u), u.click(), document.body.removeChild(u), setTimeout(() => URL.revokeObjectURL(l), 1e3);
|
|
105
|
+
};
|
|
106
|
+
return H(d, () => b(m)), H(
|
|
107
|
+
() => n.follow,
|
|
108
|
+
(e) => {
|
|
109
|
+
r.value = e, b(m);
|
|
110
|
+
}
|
|
111
|
+
), z(() => b(m)), A({ scrollToEnd: m, copyAll: C }), (e, l) => (a(), s("section", {
|
|
112
|
+
class: "flex flex-col overflow-hidden border border-gray-200 rounded-xl dark:border-gray-700 bg-gray-950 text-gray-100",
|
|
113
|
+
"aria-label": t.title || "Log output"
|
|
114
|
+
}, [
|
|
115
|
+
o("header", q, [
|
|
116
|
+
t.showStatus && M.value ? (a(), U(I, {
|
|
117
|
+
key: 0,
|
|
118
|
+
value: t.status,
|
|
119
|
+
domain: t.domain,
|
|
120
|
+
size: "xs"
|
|
121
|
+
}, null, 8, ["value", "domain"])) : f("", !0),
|
|
122
|
+
t.title ? (a(), s("span", J, i(t.title), 1)) : f("", !0),
|
|
123
|
+
h.value ? (a(), s("span", K, i(h.value) + " " + i(h.value === 1 ? "line" : "lines"), 1)) : f("", !0),
|
|
124
|
+
T(e.$slots, "header", {}, void 0, !0),
|
|
125
|
+
o("div", Q, [
|
|
126
|
+
o("button", {
|
|
127
|
+
type: "button",
|
|
128
|
+
class: O(["inline-flex items-center gap-1 px-2 py-1 rounded-md hover:bg-white/10 focus:outline-hidden focus-visible:ring-2 focus-visible:ring-primary", r.value ? "text-green-300" : "text-gray-300"]),
|
|
129
|
+
"aria-pressed": r.value ? "true" : "false",
|
|
130
|
+
title: t.language?.follow_title ?? "Auto-scroll to the newest line",
|
|
131
|
+
onClick: V
|
|
132
|
+
}, [
|
|
133
|
+
l[0] || (l[0] = o("svg", {
|
|
134
|
+
class: "w-3.5 h-3.5",
|
|
135
|
+
"aria-hidden": "true",
|
|
136
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
137
|
+
fill: "none",
|
|
138
|
+
viewBox: "0 0 24 24"
|
|
139
|
+
}, [
|
|
140
|
+
o("path", {
|
|
141
|
+
stroke: "currentColor",
|
|
142
|
+
"stroke-linecap": "round",
|
|
143
|
+
"stroke-linejoin": "round",
|
|
144
|
+
"stroke-width": "2",
|
|
145
|
+
d: "m19 9-7 7-7-7M19 3l-7 7-7-7M5 21h14"
|
|
146
|
+
})
|
|
147
|
+
], -1)),
|
|
148
|
+
o("span", Y, i(t.language?.follow ?? "Follow"), 1)
|
|
149
|
+
], 10, X),
|
|
150
|
+
o("button", {
|
|
151
|
+
type: "button",
|
|
152
|
+
class: "inline-flex items-center gap-1 px-2 py-1 text-gray-300 rounded-md hover:bg-white/10 focus:outline-hidden focus-visible:ring-2 focus-visible:ring-primary disabled:opacity-50",
|
|
153
|
+
title: t.language?.copy_title ?? "Copy everything to the clipboard",
|
|
154
|
+
disabled: !g.value,
|
|
155
|
+
onClick: C
|
|
156
|
+
}, [
|
|
157
|
+
y.value ? (a(), s("svg", te, l[2] || (l[2] = [
|
|
158
|
+
o("path", {
|
|
159
|
+
stroke: "currentColor",
|
|
160
|
+
"stroke-linecap": "round",
|
|
161
|
+
"stroke-linejoin": "round",
|
|
162
|
+
"stroke-width": "2",
|
|
163
|
+
d: "M5 11.917 9.724 16.5 19 7.5"
|
|
164
|
+
}, null, -1)
|
|
165
|
+
]))) : (a(), s("svg", ee, l[1] || (l[1] = [
|
|
166
|
+
o("path", {
|
|
167
|
+
stroke: "currentColor",
|
|
168
|
+
"stroke-linejoin": "round",
|
|
169
|
+
"stroke-width": "2",
|
|
170
|
+
d: "M9 8v3a1 1 0 0 1-1 1H5m11 4h2a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1h-7a1 1 0 0 0-1 1v1m4 3v10a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-7.13a1 1 0 0 1 .24-.65L7.7 8.35A1 1 0 0 1 8.46 8H13a1 1 0 0 1 1 1Z"
|
|
171
|
+
}, null, -1)
|
|
172
|
+
]))),
|
|
173
|
+
o("span", le, i(y.value ? t.language?.copied ?? "Copied" : t.language?.copy ?? "Copy"), 1)
|
|
174
|
+
], 8, _),
|
|
175
|
+
t.showDownload ? (a(), s("button", {
|
|
176
|
+
key: 0,
|
|
177
|
+
type: "button",
|
|
178
|
+
class: "inline-flex items-center gap-1 px-2 py-1 text-gray-300 rounded-md hover:bg-white/10 focus:outline-hidden focus-visible:ring-2 focus-visible:ring-primary disabled:opacity-50",
|
|
179
|
+
title: t.language?.download_title ?? "Download as .txt",
|
|
180
|
+
disabled: !g.value,
|
|
181
|
+
onClick: $
|
|
182
|
+
}, [
|
|
183
|
+
l[3] || (l[3] = o("svg", {
|
|
184
|
+
class: "w-3.5 h-3.5",
|
|
185
|
+
"aria-hidden": "true",
|
|
186
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
187
|
+
fill: "none",
|
|
188
|
+
viewBox: "0 0 24 24"
|
|
189
|
+
}, [
|
|
190
|
+
o("path", {
|
|
191
|
+
stroke: "currentColor",
|
|
192
|
+
"stroke-linecap": "round",
|
|
193
|
+
"stroke-linejoin": "round",
|
|
194
|
+
"stroke-width": "2",
|
|
195
|
+
d: "M4 15v2a3 3 0 0 0 3 3h10a3 3 0 0 0 3-3v-2m-8 1V4m0 12-4-4m4 4 4-4"
|
|
196
|
+
})
|
|
197
|
+
], -1)),
|
|
198
|
+
o("span", ne, i(t.language?.download ?? "Download"), 1)
|
|
199
|
+
], 8, oe)) : f("", !0),
|
|
200
|
+
T(e.$slots, "actions", {}, void 0, !0)
|
|
201
|
+
])
|
|
202
|
+
]),
|
|
203
|
+
o("div", {
|
|
204
|
+
ref_key: "scroller",
|
|
205
|
+
ref: p,
|
|
206
|
+
class: "overflow-auto font-mono text-xs leading-5 gl-log-viewer-body",
|
|
207
|
+
style: L({ maxHeight: t.maxHeight, minHeight: t.minHeight }),
|
|
208
|
+
tabindex: "0",
|
|
209
|
+
role: "log",
|
|
210
|
+
"aria-busy": t.loading ? "true" : "false",
|
|
211
|
+
onScroll: D
|
|
212
|
+
}, [
|
|
213
|
+
t.loading && !g.value ? (a(), s("div", se, [
|
|
214
|
+
l[4] || (l[4] = o("div", { class: "w-2/3 h-3 rounded-sm bg-white/10" }, null, -1)),
|
|
215
|
+
l[5] || (l[5] = o("div", { class: "w-1/2 h-3 rounded-sm bg-white/10" }, null, -1)),
|
|
216
|
+
l[6] || (l[6] = o("div", { class: "w-3/4 h-3 rounded-sm bg-white/10" }, null, -1)),
|
|
217
|
+
o("span", ie, i(t.language?.loading ?? "Loading output…"), 1)
|
|
218
|
+
])) : g.value ? t.lineNumbers ? (a(), s("div", de, [
|
|
219
|
+
(a(!0), s(W, null, G(k.value, (u, B) => (a(), s("div", {
|
|
220
|
+
key: B,
|
|
221
|
+
class: "flex px-4 hover:bg-white/5"
|
|
222
|
+
}, [
|
|
223
|
+
o("span", {
|
|
224
|
+
class: "pe-4 text-end text-gray-500 select-none shrink-0",
|
|
225
|
+
style: L({ minWidth: E.value }),
|
|
226
|
+
"aria-hidden": "true"
|
|
227
|
+
}, i(B + 1), 5),
|
|
228
|
+
o("span", ue, i(u === "" ? "" : u), 1)
|
|
229
|
+
]))), 128))
|
|
230
|
+
])) : (a(), s("pre", ce, i(d.value), 1)) : (a(), s("div", re, i(t.emptyText || (t.language?.empty ?? "No output yet.")), 1))
|
|
231
|
+
], 44, ae)
|
|
232
|
+
], 8, P));
|
|
233
|
+
}
|
|
234
|
+
}, pe = /* @__PURE__ */ Z(ge, [["__scopeId", "data-v-a83c0a5d"]]);
|
|
235
|
+
export {
|
|
236
|
+
pe as default
|
|
237
|
+
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
|
|
1
|
+
import { ref as k, computed as _, watch as C, createElementBlock as g, createCommentVNode as c, openBlock as m, normalizeClass as s, createElementVNode as e, unref as f, withDirectives as h, toDisplayString as y, createStaticVNode as B, renderSlot as v, vShow as b } from "vue";
|
|
2
|
+
import { useGlFocusTrap as M, nextGlId as S } from "./useGlFocusTrap.js";
|
|
3
|
+
const E = { class: "w-full bg-white rounded-[20px] shadow-sm dark:border md:mt-0 p-2 dark:bg-gray-900 dark:border-gray-800" }, Z = ["aria-labelledby"], z = { class: "flex items-center justify-between shrink-0 pt-3 pb-3 pl-3 pr-3" }, A = ["id"], V = {
|
|
3
4
|
key: 0,
|
|
4
5
|
role: "status",
|
|
5
6
|
class: "max-w-full p-4 border border-gray-200 rounded-sm shadow-sm animate-pulse md:p-6 dark:border-gray-700"
|
|
6
|
-
},
|
|
7
|
+
}, j = { class: "flex flex-wrap items-center justify-end shrink-0 p-4 rounded-b-md gap-2" }, G = {
|
|
7
8
|
__name: "GlModal",
|
|
8
9
|
props: {
|
|
9
10
|
language: {
|
|
@@ -39,39 +40,61 @@ const k = { class: "w-full bg-white rounded-[20px] shadow-sm dark:border md:mt-0
|
|
|
39
40
|
bodyClass: {
|
|
40
41
|
type: String,
|
|
41
42
|
default: "p-4"
|
|
43
|
+
},
|
|
44
|
+
// Escape closes the modal (emits closeModal). Set false for a modal that
|
|
45
|
+
// must only close through its own buttons.
|
|
46
|
+
close_on_escape: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: !0
|
|
42
49
|
}
|
|
43
50
|
},
|
|
44
51
|
emits: ["closeModal"],
|
|
45
|
-
setup(t, { emit:
|
|
46
|
-
const l = t,
|
|
52
|
+
setup(t, { emit: p }) {
|
|
53
|
+
const l = t, x = p, n = k(null), i = S("gl-modal-title");
|
|
54
|
+
M(n, () => l.is_open, {
|
|
55
|
+
closeOnEscape: () => l.close_on_escape,
|
|
56
|
+
onEscape: () => r()
|
|
57
|
+
});
|
|
58
|
+
const w = () => {
|
|
47
59
|
document.documentElement.style.overflow = "hidden", document.documentElement.style.paddingRight = "0px";
|
|
48
|
-
},
|
|
60
|
+
}, u = () => {
|
|
49
61
|
document.documentElement.style.overflow = "", document.documentElement.style.paddingRight = "";
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
return
|
|
62
|
+
}, r = () => {
|
|
63
|
+
x("closeModal"), u();
|
|
64
|
+
}, d = _(() => l.is_loading);
|
|
65
|
+
return C(
|
|
54
66
|
() => l.is_open,
|
|
55
|
-
(
|
|
56
|
-
|
|
67
|
+
(o, a) => {
|
|
68
|
+
o ? w() : u();
|
|
57
69
|
},
|
|
58
70
|
{ immediate: !0, deep: !0 }
|
|
59
|
-
), (
|
|
71
|
+
), (o, a) => t.is_open ? (m(), g("div", {
|
|
60
72
|
key: 0,
|
|
61
|
-
class:
|
|
73
|
+
class: s(["fixed h-full w-full overflow-y-auto overflow-x-hidden outline-hidden inset-0 bg-black/80! min-w-full", t.has_large_z_index ? "z-9999" : "z-1055"]),
|
|
62
74
|
tabindex: "-1"
|
|
63
75
|
}, [
|
|
64
76
|
e("div", {
|
|
65
|
-
class:
|
|
77
|
+
class: s(["pointer-events-none relative w-auto transition-all duration-300 ease-in-out min-[576px]:mx-auto mt-2", t.max_width])
|
|
66
78
|
}, [
|
|
67
|
-
e("div",
|
|
68
|
-
e("div",
|
|
69
|
-
|
|
70
|
-
|
|
79
|
+
e("div", E, [
|
|
80
|
+
e("div", {
|
|
81
|
+
ref_key: "dialogPanel",
|
|
82
|
+
ref: n,
|
|
83
|
+
role: "dialog",
|
|
84
|
+
"aria-modal": "true",
|
|
85
|
+
"aria-labelledby": t.title ? f(i) : void 0,
|
|
86
|
+
tabindex: "-1",
|
|
87
|
+
class: "pointer-events-auto relative flex max-h-full w-full flex-col text-current shadow-4 outline-hidden bg-white border rounded-xl dark:bg-gray-900 dark:border-gray-800"
|
|
88
|
+
}, [
|
|
89
|
+
e("div", z, [
|
|
90
|
+
e("h5", {
|
|
91
|
+
id: f(i),
|
|
92
|
+
class: "text-xl font-medium leading-normal text-surface dark:text-white"
|
|
93
|
+
}, y(t.title), 9, A),
|
|
71
94
|
e("button", {
|
|
72
95
|
type: "button",
|
|
73
96
|
class: "box-content border-none rounded-none text-neutral-500 hover:text-neutral-800 hover:no-underline focus:text-neutral-800 focus:opacity-100 focus:shadow-none focus:outline-hidden dark:text-neutral-400 dark:hover:text-neutral-300 dark:focus:text-neutral-300",
|
|
74
|
-
onClick:
|
|
97
|
+
onClick: r,
|
|
75
98
|
"aria-label": "Close"
|
|
76
99
|
}, a[0] || (a[0] = [
|
|
77
100
|
e("span", { class: "[&>svg]:h-6 [&>svg]:w-6" }, [
|
|
@@ -91,32 +114,32 @@ const k = { class: "w-full bg-white rounded-[20px] shadow-sm dark:border md:mt-0
|
|
|
91
114
|
], -1)
|
|
92
115
|
]))
|
|
93
116
|
]),
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
]))) :
|
|
97
|
-
|
|
98
|
-
class:
|
|
117
|
+
d.value ? (m(), g("div", V, a[1] || (a[1] = [
|
|
118
|
+
B('<div class="flex items-center justify-center h-48 mb-4 bg-gray-300 rounded-sm dark:bg-gray-700"><svg class="w-10 h-10 text-gray-200 dark:text-gray-600" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 20"><path d="M14.066 0H7v5a2 2 0 0 1-2 2H0v11a1.97 1.97 0 0 0 1.934 2h12.132A1.97 1.97 0 0 0 16 18V2a1.97 1.97 0 0 0-1.934-2ZM10.5 6a1.5 1.5 0 1 1 0 2.999A1.5 1.5 0 0 1 10.5 6Zm2.221 10.515a1 1 0 0 1-.858.485h-8a1 1 0 0 1-.9-1.43L5.6 10.039a.978.978 0 0 1 .936-.57 1 1 0 0 1 .9.632l1.181 2.981.541-1a.945.945 0 0 1 .883-.522 1 1 0 0 1 .879.529l1.832 3.438a1 1 0 0 1-.031.988Z"></path><path d="M5 5V.13a2.96 2.96 0 0 0-1.293.749L.879 3.707A2.98 2.98 0 0 0 .13 5H5Z"></path></svg></div><div class="h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 w-48 mb-4"></div><div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 mb-2.5"></div><div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700 mb-2.5"></div><div class="h-2 bg-gray-200 rounded-full dark:bg-gray-700"></div><div class="flex items-center mt-4"><svg class="w-10 h-10 text-gray-200 me-3 dark:text-gray-700" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20"><path d="M10 0a10 10 0 1 0 10 10A10.011 10.011 0 0 0 10 0Zm0 5a3 3 0 1 1 0 6 3 3 0 0 1 0-6Zm0 13a8.949 8.949 0 0 1-4.951-1.488A3.987 3.987 0 0 1 9 13h2a3.987 3.987 0 0 1 3.951 3.512A8.949 8.949 0 0 1 10 18Z"></path></svg><div><div class="h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 w-32 mb-2"></div><div class="w-48 h-2 bg-gray-200 rounded-full dark:bg-gray-700"></div></div></div><span class="sr-only">Loading...</span>', 7)
|
|
119
|
+
]))) : c("", !0),
|
|
120
|
+
h(e("div", {
|
|
121
|
+
class: s(["relative gl_modal_body", t.bodyClass])
|
|
99
122
|
}, [
|
|
100
|
-
|
|
123
|
+
v(o.$slots, "body")
|
|
101
124
|
], 2), [
|
|
102
|
-
[
|
|
125
|
+
[b, !d.value]
|
|
103
126
|
]),
|
|
104
|
-
|
|
105
|
-
|
|
127
|
+
h(e("div", j, [
|
|
128
|
+
v(o.$slots, "buttons"),
|
|
106
129
|
e("button", {
|
|
107
|
-
onClick:
|
|
130
|
+
onClick: r,
|
|
108
131
|
type: "button",
|
|
109
132
|
class: "px-5 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-200 rounded-lg ms-3 hover:bg-gray-100 focus:ring-4 focus:outline-hidden focus:ring-blue-300 hover:text-gray-900 focus:z-10 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700 dark:hover:text-white dark:hover:bg-gray-700 dark:focus:ring-gray-700"
|
|
110
|
-
},
|
|
133
|
+
}, y(t.language?.close ?? "Close"), 1)
|
|
111
134
|
], 512), [
|
|
112
|
-
[
|
|
135
|
+
[b, !d.value && !t.hide_model_footer]
|
|
113
136
|
])
|
|
114
|
-
])
|
|
137
|
+
], 8, Z)
|
|
115
138
|
])
|
|
116
139
|
], 2)
|
|
117
|
-
], 2)) :
|
|
140
|
+
], 2)) : c("", !0);
|
|
118
141
|
}
|
|
119
142
|
};
|
|
120
143
|
export {
|
|
121
|
-
|
|
144
|
+
G as default
|
|
122
145
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { computed as l, createElementBlock as i, openBlock as r, normalizeClass as o, createCommentVNode as c, createElementVNode as f, toDisplayString as S } from "vue";
|
|
2
|
+
import { resolveStatus as v, variantState as m, STATES as d } from "./glStatusMap.js";
|
|
3
|
+
const h = ["title"], w = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "relative flex w-2 h-2 shrink-0",
|
|
6
|
+
"aria-hidden": "true"
|
|
7
|
+
}, k = {
|
|
8
|
+
__name: "GlStatusBadge",
|
|
9
|
+
props: {
|
|
10
|
+
/** Raw backend value; mapped through the vocabulary for the given domain. */
|
|
11
|
+
value: { type: [String, Number, Boolean], default: null },
|
|
12
|
+
/** Alias of `value`. */
|
|
13
|
+
status: { type: [String, Number, Boolean], default: null },
|
|
14
|
+
/** Domain table used to map the value (auto, general, server, availability, deployment, backup, restore, ai, invoice, toggle, docker, run). */
|
|
15
|
+
domain: { type: String, default: "auto" },
|
|
16
|
+
/** Force a vocabulary state directly (healthy|running|queued|attention|failed|disabled); wins over value/status. */
|
|
17
|
+
state: { type: String, default: "" },
|
|
18
|
+
/** Word to show instead of the mapped label. */
|
|
19
|
+
label: { type: String, default: "" },
|
|
20
|
+
title: { type: String, default: "" },
|
|
21
|
+
/** xs | sm | md */
|
|
22
|
+
size: { type: String, default: "sm" },
|
|
23
|
+
/** Colour override: a state name or success|info|warning|danger|error|neutral|muted (and colour names). */
|
|
24
|
+
variant: { type: String, default: "" },
|
|
25
|
+
/** Show a dot instead of the icon. */
|
|
26
|
+
dot: { type: Boolean, default: !1 },
|
|
27
|
+
/** Pulse the dot; by default it pulses for running states. */
|
|
28
|
+
pulse: { type: Boolean, default: null },
|
|
29
|
+
/** Show the state icon (Font Awesome classes) when no dot is shown. */
|
|
30
|
+
show_icon: { type: Boolean, default: !0 }
|
|
31
|
+
},
|
|
32
|
+
setup(a) {
|
|
33
|
+
const e = a, n = l(() => e.value !== null && e.value !== void 0 ? e.value : e.status), u = l(() => {
|
|
34
|
+
if (e.state)
|
|
35
|
+
return v(e.state);
|
|
36
|
+
if ((n.value === null || n.value === void 0 || n.value === "") && e.variant) {
|
|
37
|
+
const t = m(e.variant) || "queued";
|
|
38
|
+
return { state: t, label: d[t].word, raw: null, ...d[t] };
|
|
39
|
+
}
|
|
40
|
+
return v(n.value, e.domain);
|
|
41
|
+
}), s = l(() => {
|
|
42
|
+
const t = e.variant ? m(e.variant) : null;
|
|
43
|
+
return t ? d[t] : u.value;
|
|
44
|
+
}), p = l(() => e.label || u.value.label), x = l(() => e.pulse === null ? !!s.value.pulse : e.pulse), y = l(() => e.size === "xs" ? "gap-1 px-2 py-0.5 text-xs" : e.size === "md" ? "gap-2 px-3 py-1.5 text-sm" : "gap-1.5 px-2.5 py-1 text-xs"), g = l(() => e.size === "md" ? "text-sm" : "text-[11px]");
|
|
45
|
+
return (t, B) => (r(), i("span", {
|
|
46
|
+
class: o(["inline-flex items-center font-medium rounded-full ring-1 ring-inset whitespace-nowrap", [s.value.pill, y.value]]),
|
|
47
|
+
role: "status",
|
|
48
|
+
title: a.title || p.value
|
|
49
|
+
}, [
|
|
50
|
+
a.dot ? (r(), i("span", w, [
|
|
51
|
+
x.value ? (r(), i("span", {
|
|
52
|
+
key: 0,
|
|
53
|
+
class: o(["absolute inline-flex w-full h-full rounded-full opacity-75 animate-ping", s.value.dot])
|
|
54
|
+
}, null, 2)) : c("", !0),
|
|
55
|
+
f("span", {
|
|
56
|
+
class: o(["relative inline-flex w-2 h-2 rounded-full", s.value.dot])
|
|
57
|
+
}, null, 2)
|
|
58
|
+
])) : a.show_icon && u.value.icon ? (r(), i("i", {
|
|
59
|
+
key: 1,
|
|
60
|
+
class: o([u.value.icon, g.value]),
|
|
61
|
+
"aria-hidden": "true"
|
|
62
|
+
}, null, 2)) : c("", !0),
|
|
63
|
+
f("span", null, S(p.value), 1)
|
|
64
|
+
], 10, h));
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
export {
|
|
68
|
+
k as default
|
|
69
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { useSlots as
|
|
2
|
-
|
|
1
|
+
import { useSlots as $, ref as x, Comment as K, provide as M, computed as N, watch as _, onMounted as U, onBeforeUnmount as V, createElementBlock as s, openBlock as i, Fragment as C, createElementVNode as c, withDirectives as W, normalizeClass as u, renderList as G, createCommentVNode as j, createTextVNode as z, toDisplayString as q, renderSlot as J, vShow as O } from "vue";
|
|
2
|
+
import { nextGlId as P } from "./useGlFocusTrap.js";
|
|
3
|
+
const Q = ["onClick"], X = ["id", "aria-selected", "tabindex", "onKeydown"], Y = ["innerHTML"], Z = { class: "relative flex flex-col w-full min-w-0 mb-6 wrap-break-word rounded-[20px] border border-gray-200 dark:border-gray-700" }, ee = { class: "flex-auto px-4 py-5" }, te = ["aria-labelledby"], oe = {
|
|
3
4
|
__name: "GlTabsWrapper",
|
|
4
5
|
props: {
|
|
5
6
|
autoFlexTabs: {
|
|
@@ -16,77 +17,102 @@ const U = ["onClick"], V = ["innerHTML"], W = { class: "relative flex flex-col w
|
|
|
16
17
|
}
|
|
17
18
|
},
|
|
18
19
|
emits: ["TabChange"],
|
|
19
|
-
setup(
|
|
20
|
-
const
|
|
21
|
-
(
|
|
22
|
-
),
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
setup(p, { expose: L, emit: I }) {
|
|
21
|
+
const f = p, S = I, E = $(), l = x(
|
|
22
|
+
(E.default?.() ?? []).filter((e) => e.type !== K && e.props !== null).map((e) => e.props)
|
|
23
|
+
), H = (e) => typeof e == "string" && /<\s*(svg|path|g|circle|rect)\b/i.test(e), r = x("");
|
|
24
|
+
M("selectedTitle", r);
|
|
25
|
+
const w = P("gl-tabs"), k = `${w}-panel`, b = (e) => `${w}-tab-${e}`, g = x(null), h = N(() => l.value.findIndex((e) => e.title === r.value)), A = (e, a) => h.value >= 0 ? e.title === r.value : a === 0, B = (e) => {
|
|
26
|
+
const a = l.value[e];
|
|
27
|
+
a && (r.value = a.title, document.getElementById(b(e))?.focus());
|
|
28
|
+
}, D = (e, a) => {
|
|
29
|
+
const t = l.value.length;
|
|
30
|
+
if (t === 0) return;
|
|
31
|
+
const n = g.value ? getComputedStyle(g.value).direction === "rtl" : !1, d = n ? "ArrowLeft" : "ArrowRight", R = n ? "ArrowRight" : "ArrowLeft";
|
|
32
|
+
let o = null;
|
|
33
|
+
e.key === d ? o = (a + 1) % t : e.key === R ? o = (a - 1 + t) % t : e.key === "Home" ? o = 0 : e.key === "End" ? o = t - 1 : (e.key === "Enter" || e.key === " ") && (o = a), o !== null && (e.preventDefault(), B(o));
|
|
34
|
+
}, T = (e) => e.trim().toLowerCase().replace(/\s+/g, "-");
|
|
35
|
+
let m = !1;
|
|
36
|
+
const F = (e) => {
|
|
37
|
+
const a = T(e), t = encodeURIComponent(a);
|
|
38
|
+
window.location.hash.replace("#", "") !== t && (m = !0, window.location.hash = t), S("TabChange", e);
|
|
39
|
+
}, y = (e) => {
|
|
30
40
|
if (typeof e != "string") return;
|
|
31
|
-
|
|
41
|
+
l.value.find((t) => t.title === e) && (r.value = e);
|
|
32
42
|
};
|
|
33
|
-
|
|
34
|
-
setActiveTab:
|
|
43
|
+
L({
|
|
44
|
+
setActiveTab: y
|
|
35
45
|
});
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
38
|
-
|
|
46
|
+
const v = () => {
|
|
47
|
+
if (m) {
|
|
48
|
+
m = !1;
|
|
39
49
|
return;
|
|
40
50
|
}
|
|
41
|
-
const e = decodeURIComponent(window.location.hash.replace("#", "")),
|
|
42
|
-
|
|
51
|
+
const e = decodeURIComponent(window.location.hash.replace("#", "")), a = l.value.find((t) => T(t.title) === e);
|
|
52
|
+
a && (r.value = a.title);
|
|
43
53
|
};
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
}),
|
|
47
|
-
e && e !==
|
|
48
|
-
}),
|
|
49
|
-
|
|
50
|
-
}),
|
|
51
|
-
window.removeEventListener("hashchange",
|
|
52
|
-
}), (e,
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
return _(r, (e) => {
|
|
55
|
+
F(e);
|
|
56
|
+
}), _(() => f.activeTab, (e) => {
|
|
57
|
+
e && e !== r.value && y(e);
|
|
58
|
+
}), U(() => {
|
|
59
|
+
v(), !r.value && f.activeTab && y(f.activeTab), window.addEventListener("hashchange", v);
|
|
60
|
+
}), V(() => {
|
|
61
|
+
window.removeEventListener("hashchange", v);
|
|
62
|
+
}), (e, a) => (i(), s(C, null, [
|
|
63
|
+
c("ul", {
|
|
64
|
+
ref_key: "tabList",
|
|
65
|
+
ref: g,
|
|
66
|
+
role: "tablist",
|
|
67
|
+
class: u(["flex flex-row flex-wrap gap-2 pt-3 pb-4 mb-0 list-none text-gray-500 dark:text-gray-400", p.tabsWrapperClass])
|
|
55
68
|
}, [
|
|
56
|
-
(
|
|
69
|
+
(i(!0), s(C, null, G(l.value, (t, n) => (i(), s("li", {
|
|
57
70
|
key: t.title,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
71
|
+
role: "presentation",
|
|
72
|
+
onClick: (d) => r.value = t.title,
|
|
73
|
+
class: u(["-mb-px text-center", {
|
|
74
|
+
"flex-auto ": p.autoFlexTabs
|
|
61
75
|
}])
|
|
62
76
|
}, [
|
|
63
|
-
|
|
64
|
-
|
|
77
|
+
c("a", {
|
|
78
|
+
id: b(n),
|
|
79
|
+
role: "tab",
|
|
80
|
+
"aria-selected": r.value === t.title ? "true" : "false",
|
|
81
|
+
"aria-controls": k,
|
|
82
|
+
tabindex: A(t, n) ? 0 : -1,
|
|
83
|
+
onKeydown: (d) => D(d, n),
|
|
84
|
+
class: u([{ " bg-gray-50 dark:bg-gray-900 hover:text-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 dark:hover:text-white border border-gray-300 dark:border-gray-700 hover:border-primary dark:hover:border-primaryDark": r.value != t.title, "text-white bg-primary dark:bg-primaryDark": r.value === t.title }, "block px-5 py-3 text-xs font-bold leading-normal rounded-xl tabs_buttons"])
|
|
65
85
|
}, [
|
|
66
|
-
t.icon &&
|
|
86
|
+
t.icon && H(t.icon) ? (i(), s("span", {
|
|
67
87
|
key: 0,
|
|
68
88
|
class: "inline-flex items-center justify-center me-2 align-middle",
|
|
69
89
|
innerHTML: t.icon
|
|
70
|
-
}, null, 8,
|
|
90
|
+
}, null, 8, Y)) : t.icon ? (i(), s("i", {
|
|
71
91
|
key: 1,
|
|
72
|
-
class:
|
|
73
|
-
}, null, 2)) :
|
|
74
|
-
|
|
75
|
-
],
|
|
76
|
-
], 10,
|
|
92
|
+
class: u([t.icon, "me-2 text-sm"])
|
|
93
|
+
}, null, 2)) : j("", !0),
|
|
94
|
+
z(q(t.title), 1)
|
|
95
|
+
], 42, X)
|
|
96
|
+
], 10, Q))), 128))
|
|
77
97
|
], 2),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
98
|
+
W(c("div", Z, [
|
|
99
|
+
c("div", ee, [
|
|
100
|
+
c("div", {
|
|
101
|
+
id: k,
|
|
102
|
+
role: "tabpanel",
|
|
103
|
+
"aria-labelledby": h.value >= 0 ? b(h.value) : void 0,
|
|
104
|
+
tabindex: "0",
|
|
105
|
+
class: "tab-content tab-space"
|
|
106
|
+
}, [
|
|
107
|
+
J(e.$slots, "default")
|
|
108
|
+
], 8, te)
|
|
83
109
|
])
|
|
84
110
|
], 512), [
|
|
85
|
-
[
|
|
111
|
+
[O, r.value]
|
|
86
112
|
])
|
|
87
113
|
], 64));
|
|
88
114
|
}
|
|
89
115
|
};
|
|
90
116
|
export {
|
|
91
|
-
|
|
117
|
+
oe as default
|
|
92
118
|
};
|