golden-logic-ui 1.2.21 → 1.2.23
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/ConfirmationModal-i3ekouBw.js +75 -0
- package/dist/DatatableAction-D-Qdjj2W.js +113 -0
- package/dist/DatatableCommand-BoU5cYJg.js +18 -0
- package/dist/DatatableConvertCronToHuman-Coiaa-wa.js +82 -0
- package/dist/DatatableDate-DtEktp_Z.js +20 -0
- package/dist/DatatableDateTime-PEXV-bY7.js +22 -0
- package/dist/DatatableDeleteAction-BQ6MyhV6.js +104 -0
- package/dist/DatatableDeleteEditAction-Cx324OUt.js +125 -0
- package/dist/DatatableFileDownload-BxP2_lpQ.js +87 -0
- package/dist/DatatableFiles-BROH3vBH.js +80 -0
- package/dist/DatatableHtml-ChZzeapg.js +17 -0
- package/dist/DatatableList-BSVI22pu.js +35 -0
- package/dist/DatatableListNested-BWEqWRCc.js +37 -0
- package/dist/DatatablePicture-DaWD4uIX.js +26 -0
- package/dist/DatatablePictures-xxeghKp3.js +39 -0
- package/dist/DatatableStatus-Dx60sa7s.js +31 -0
- package/dist/DatatableStatusGeneral-UOub65UY.js +59 -0
- package/dist/DatatableStatusServer-Dcq11U5_.js +37 -0
- package/dist/DatatableStatusSpecficColor-BYUuGgEb.js +64 -0
- package/dist/DatatableStatusTextLabelGeneral-J4MytOnh.js +83 -0
- package/dist/DeleteConfirmationModal-CQ07_qiL.js +96 -0
- package/dist/DynamicConfirmation-rEhA3jCe.js +115 -0
- package/dist/FilesUpload-JKyOru3A.js +300 -0
- package/dist/GLButton-ByIDh6vq.js +118 -0
- package/dist/GLDataTable-Bixwkdr4.js +278 -0
- package/dist/GLDataTableServerSide-Ra5AqDGB.js +16336 -0
- package/dist/GLTextarea-j7XXWI7A.js +110 -0
- package/dist/GlAccordion-BIAfvctc.js +91 -0
- package/dist/GlAccordionsWrapper-DsdunDzi.js +31 -0
- package/dist/GlCard-BVXmTv6q.js +37 -0
- package/dist/GlCodeCopy-C068yRcM.js +86 -0
- package/dist/GlCodeMirror-Ow8TJYSN.js +161 -0
- package/dist/GlCodeMirrorTranslate-CFmoM7d6.js +2068 -0
- package/dist/GlDataTableComponent-CSsMcDcX.js +366 -0
- package/dist/GlDataTableServerSideGroupBy-cG4BhXOA.js +260 -0
- package/dist/GlDateRangePicker-BWAEfZTB.js +124 -0
- package/dist/GlDropdown-B_zVkmxO.js +414 -0
- package/dist/GlLanguageSelector-DmWuIxzK.js +68 -0
- package/dist/GlModal-AMtSRssu.js +123 -0
- package/dist/GlModalShow-BzbcLu51.js +120 -0
- package/dist/GlModalWithoutOverflow-vR50Ulka.js +127 -0
- package/dist/GlMultiItemSlide-CxsiUcTr.js +409 -0
- package/dist/GlMultiItemSlideDynamic-BhdHrj3L.js +434 -0
- package/dist/GlMultiSelectDropdown-OaAC5ouZ.js +383 -0
- package/dist/GlTab-CUbU0yit.js +22 -0
- package/dist/GlTabShow-BBU3VU7O.js +21 -0
- package/dist/GlTabsWrapper-Dw7NAgDw.js +54 -0
- package/dist/GlTextCopy-CGgnIqPh.js +93 -0
- package/dist/GlTextInput-CoL8oZSw.js +126 -0
- package/dist/GlTextInputFile-BE2maeRQ.js +95 -0
- package/dist/GlTextInputWithText-C6fzOoYl.js +116 -0
- package/dist/GlTextTranslate-C3DzCK6k.js +125 -0
- package/dist/GlTextareaTranslate-DyU86Wf_.js +126 -0
- package/dist/GlTinymce-CjsbThKo.js +118 -0
- package/dist/GlTinymceTranslate-vp6hYqDK.js +188 -0
- package/dist/GlToastList-eeZ0hUJQ.js +126 -0
- package/dist/GlToggleBox-Dym29cx5.js +120 -0
- package/dist/GlToggleBoxTrueFalse-CjvcXXTw.js +112 -0
- package/dist/StatusConnectingConnectedDisconnected-CK5YzyQH.js +63 -0
- package/dist/StatusRunningSuccessFailed-CxK20462.js +41 -0
- package/dist/TailwindPagination-Dz89aS_l.js +276 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/golden-logic-ui.css +1 -1
- package/dist/golden-logic-ui.js +217 -94352
- package/dist/golden-logic-ui.umd.cjs +94 -94
- package/dist/index-B4V16SEr.js +15668 -0
- package/dist/plugin-D6yBFU6i.js +53226 -0
- package/package.json +1 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { ref as b, onMounted as x, computed as h, createElementBlock as i, openBlock as s, Fragment as v, createCommentVNode as m, normalizeClass as n, createElementVNode as t, toDisplayString as r, withDirectives as k, vModelText as w } from "vue";
|
|
2
|
+
const S = { class: "font-bold ptext-lg dark:text-white" }, V = ["id"], q = ["for"], B = ["required", "name", "id", "type", "placeholder"], N = { class: "gl-span-form-error" }, C = { class: "block mt-1 text-sm font-normal leading-5 text-gray-500" }, E = {
|
|
3
|
+
__name: "GLTextarea",
|
|
4
|
+
props: {
|
|
5
|
+
is_required: {
|
|
6
|
+
type: Boolean,
|
|
7
|
+
default: !1
|
|
8
|
+
},
|
|
9
|
+
show: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: !1
|
|
12
|
+
},
|
|
13
|
+
error_message: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: ""
|
|
16
|
+
},
|
|
17
|
+
model_value: {
|
|
18
|
+
type: [String, Number],
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
modelValue: {
|
|
22
|
+
type: [String, Number],
|
|
23
|
+
default: ""
|
|
24
|
+
},
|
|
25
|
+
type: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "text"
|
|
28
|
+
},
|
|
29
|
+
field_name: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: ""
|
|
32
|
+
},
|
|
33
|
+
label_name: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: ""
|
|
36
|
+
},
|
|
37
|
+
description: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: ""
|
|
40
|
+
},
|
|
41
|
+
placeholder: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: ""
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
emits: ["update:modelValue", "keydown"],
|
|
47
|
+
setup(e, { expose: f, emit: c }) {
|
|
48
|
+
const g = e, y = c, a = b(null);
|
|
49
|
+
x(() => {
|
|
50
|
+
a.value !== null && a.value.hasAttribute("autofocus") && a.value.focus();
|
|
51
|
+
});
|
|
52
|
+
const u = h({
|
|
53
|
+
get() {
|
|
54
|
+
return g.modelValue;
|
|
55
|
+
},
|
|
56
|
+
set(d) {
|
|
57
|
+
y("update:modelValue", d);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
return f({ focus: () => a.value.focus() }), (d, l) => (s(), i(v, null, [
|
|
61
|
+
e.show ? (s(), i("div", {
|
|
62
|
+
key: 0,
|
|
63
|
+
class: n(e.field_name)
|
|
64
|
+
}, [
|
|
65
|
+
t("h3", S, r(e.label_name), 1),
|
|
66
|
+
t("p", {
|
|
67
|
+
id: e.field_name,
|
|
68
|
+
class: "mb-4 text-base text-gray-900 input_tr_show dark:text-white"
|
|
69
|
+
}, r(e.model_value), 9, V),
|
|
70
|
+
l[2] || (l[2] = t("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
|
|
71
|
+
], 2)) : m("", !0),
|
|
72
|
+
e.show ? m("", !0) : (s(), i("div", {
|
|
73
|
+
key: 1,
|
|
74
|
+
class: n(["mb-4", e.field_name])
|
|
75
|
+
}, [
|
|
76
|
+
t("label", {
|
|
77
|
+
class: n({
|
|
78
|
+
"gl-label-form": e.error_message == "",
|
|
79
|
+
"gl-label-form-invalid": e.error_message !== "",
|
|
80
|
+
required: e.is_required
|
|
81
|
+
}),
|
|
82
|
+
for: e.field_name
|
|
83
|
+
}, r(e.label_name), 11, q),
|
|
84
|
+
k(t("textarea", {
|
|
85
|
+
required: e.is_required,
|
|
86
|
+
name: e.field_name,
|
|
87
|
+
id: e.field_name,
|
|
88
|
+
class: n({
|
|
89
|
+
" gl-textarea-form mt-4 ": e.error_message == "",
|
|
90
|
+
" gl-textarea-form-invalid mt-4 ": e.error_message !== ""
|
|
91
|
+
}),
|
|
92
|
+
type: e.type,
|
|
93
|
+
"onUpdate:modelValue": l[0] || (l[0] = (o) => u.value = o),
|
|
94
|
+
onKeydown: l[1] || (l[1] = (o) => d.$emit("keydown", o)),
|
|
95
|
+
ref_key: "input",
|
|
96
|
+
ref: a,
|
|
97
|
+
rows: "4",
|
|
98
|
+
placeholder: e.placeholder
|
|
99
|
+
}, null, 42, B), [
|
|
100
|
+
[w, u.value]
|
|
101
|
+
]),
|
|
102
|
+
t("span", N, r(e.error_message), 1),
|
|
103
|
+
t("small", C, r(e.description), 1)
|
|
104
|
+
], 2))
|
|
105
|
+
], 64));
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
export {
|
|
109
|
+
E as default
|
|
110
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { createElementBlock as a, openBlock as d, createElementVNode as t, createCommentVNode as l, normalizeClass as p, toDisplayString as y, renderSlot as w, ref as b, inject as h, computed as x, onMounted as v, onUnmounted as A } from "vue";
|
|
2
|
+
import { _ } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
3
|
+
const C = {
|
|
4
|
+
props: {
|
|
5
|
+
title: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: !0
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
setup() {
|
|
11
|
+
const n = b(!1), e = h("accordionsWrapper"), r = (() => {
|
|
12
|
+
var s = (/* @__PURE__ */ new Date()).getTime();
|
|
13
|
+
typeof performance < "u" && typeof performance.now == "function" && (s += performance.now());
|
|
14
|
+
var m = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(k) {
|
|
15
|
+
var u = (s + Math.random() * 16) % 16 | 0;
|
|
16
|
+
return s = Math.floor(s / 16), (k === "x" ? u : u & 3 | 8).toString(16);
|
|
17
|
+
});
|
|
18
|
+
return m;
|
|
19
|
+
})(), i = { isOpen: n, id: r }, o = x(() => e.accordions.value), c = x(() => o.value.length > 0 && o.value[0].id === r), f = x(() => o.value.length > 0 && o.value[o.value.length - 1].id === r);
|
|
20
|
+
return v(() => {
|
|
21
|
+
e.registerAccordion(i);
|
|
22
|
+
}), A(() => {
|
|
23
|
+
e.unregisterAccordion(i);
|
|
24
|
+
}), { isOpen: n, isFirstAccordion: c, isLastAccordion: f, toggle: () => {
|
|
25
|
+
e.toggleAccordion(i);
|
|
26
|
+
} };
|
|
27
|
+
}
|
|
28
|
+
}, M = { class: "flex items-center" }, O = {
|
|
29
|
+
key: 0,
|
|
30
|
+
class: "w-3 h-3 rotate-180 shrink-0",
|
|
31
|
+
"aria-hidden": "true",
|
|
32
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
33
|
+
fill: "none",
|
|
34
|
+
viewBox: "0 0 10 6"
|
|
35
|
+
}, U = {
|
|
36
|
+
key: 1,
|
|
37
|
+
class: "w-3 h-3 shrink-0",
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
40
|
+
fill: "none",
|
|
41
|
+
viewBox: "0 0 10 6"
|
|
42
|
+
};
|
|
43
|
+
function j(n, e, g, r, i, o) {
|
|
44
|
+
return d(), a("div", null, [
|
|
45
|
+
t("h2", null, [
|
|
46
|
+
t("button", {
|
|
47
|
+
onClick: e[0] || (e[0] = (...c) => r.toggle && r.toggle(...c)),
|
|
48
|
+
type: "button",
|
|
49
|
+
class: p(["flex items-center justify-between w-full gap-3 p-5 font-medium text-gray-500 border border-gray-200 rtl:text-right dark:border-gray-700 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800", {
|
|
50
|
+
"rounded-t-xl": r.isFirstAccordion,
|
|
51
|
+
"border-b-0": !r.isLastAccordion,
|
|
52
|
+
"bg-gray-100 dark:bg-gray-800": r.isOpen
|
|
53
|
+
}]),
|
|
54
|
+
"aria-expanded": "true"
|
|
55
|
+
}, [
|
|
56
|
+
t("span", M, y(g.title), 1),
|
|
57
|
+
r.isOpen ? l("", !0) : (d(), a("svg", O, e[1] || (e[1] = [
|
|
58
|
+
t("path", {
|
|
59
|
+
stroke: "currentColor",
|
|
60
|
+
"stroke-linecap": "round",
|
|
61
|
+
"stroke-linejoin": "round",
|
|
62
|
+
"stroke-width": "2",
|
|
63
|
+
d: "M9 5 5 1 1 5"
|
|
64
|
+
}, null, -1)
|
|
65
|
+
]))),
|
|
66
|
+
r.isOpen ? (d(), a("svg", U, e[2] || (e[2] = [
|
|
67
|
+
t("path", {
|
|
68
|
+
stroke: "currentColor",
|
|
69
|
+
"stroke-linecap": "round",
|
|
70
|
+
"stroke-linejoin": "round",
|
|
71
|
+
"stroke-width": "2",
|
|
72
|
+
d: "M9 5 5 1 1 5"
|
|
73
|
+
}, null, -1)
|
|
74
|
+
]))) : l("", !0)
|
|
75
|
+
], 2)
|
|
76
|
+
]),
|
|
77
|
+
r.isOpen ? (d(), a("div", {
|
|
78
|
+
key: 0,
|
|
79
|
+
class: p([{
|
|
80
|
+
"border-b-0": !r.isLastAccordion,
|
|
81
|
+
"border-t-0": r.isLastAccordion
|
|
82
|
+
}, "p-5 border border-gray-200 dark:border-gray-700 dark:bg-gray-900"])
|
|
83
|
+
}, [
|
|
84
|
+
w(n.$slots, "default")
|
|
85
|
+
], 2)) : l("", !0)
|
|
86
|
+
]);
|
|
87
|
+
}
|
|
88
|
+
const S = /* @__PURE__ */ _(C, [["render", j]]);
|
|
89
|
+
export {
|
|
90
|
+
S as default
|
|
91
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createElementBlock as t, openBlock as p, renderSlot as l, ref as c, provide as u } from "vue";
|
|
2
|
+
import { _ as d } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
3
|
+
const f = {
|
|
4
|
+
setup() {
|
|
5
|
+
const r = c([]);
|
|
6
|
+
return u("accordionsWrapper", {
|
|
7
|
+
registerAccordion: (e) => {
|
|
8
|
+
r.value.push(e);
|
|
9
|
+
},
|
|
10
|
+
unregisterAccordion: (e) => {
|
|
11
|
+
const n = r.value.indexOf(e);
|
|
12
|
+
n > -1 && r.value.splice(n, 1);
|
|
13
|
+
},
|
|
14
|
+
toggleAccordion: (e) => {
|
|
15
|
+
r.value.forEach((n) => {
|
|
16
|
+
n !== e && n.isOpen && n.isOpen.value !== void 0 && (n.isOpen.value = !1);
|
|
17
|
+
}), e.isOpen && e.isOpen.value !== void 0 && (e.isOpen.value = !e.isOpen.value);
|
|
18
|
+
},
|
|
19
|
+
accordions: r
|
|
20
|
+
}), {};
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
function a(r, o, s, i, e, n) {
|
|
24
|
+
return p(), t("div", null, [
|
|
25
|
+
l(r.$slots, "default")
|
|
26
|
+
]);
|
|
27
|
+
}
|
|
28
|
+
const O = /* @__PURE__ */ d(f, [["render", a]]);
|
|
29
|
+
export {
|
|
30
|
+
O as default
|
|
31
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { computed as o, createElementBlock as t, openBlock as a, normalizeClass as d, createElementVNode as s, createCommentVNode as i, renderSlot as l } from "vue";
|
|
2
|
+
const k = { class: "bg-white border rounded-lg border-stroke shadow-default dark:border-strokeDark dark:bg-boxDark" }, p = { class: "px-3 py-4 border-b border-stroke dark:border-strokeDark" }, u = { class: "font-semibold text-black dark:text-white" }, f = {
|
|
3
|
+
__name: "GlCard",
|
|
4
|
+
props: {
|
|
5
|
+
class: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: ""
|
|
8
|
+
},
|
|
9
|
+
body_class: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: ""
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
setup(c) {
|
|
15
|
+
const r = c, n = o(() => r.class), b = o(() => r.body_class);
|
|
16
|
+
return (e, m) => (a(), t("div", {
|
|
17
|
+
class: d(["flex flex-col gap-9", n.value])
|
|
18
|
+
}, [
|
|
19
|
+
s("div", k, [
|
|
20
|
+
s("div", p, [
|
|
21
|
+
s("h3", u, [
|
|
22
|
+
l(e.$slots, "header")
|
|
23
|
+
])
|
|
24
|
+
]),
|
|
25
|
+
e.$slots.body ? (a(), t("div", {
|
|
26
|
+
key: 0,
|
|
27
|
+
class: d(["p-6", b.value])
|
|
28
|
+
}, [
|
|
29
|
+
l(e.$slots, "body")
|
|
30
|
+
], 2)) : i("", !0)
|
|
31
|
+
])
|
|
32
|
+
], 2));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
f as default
|
|
37
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ref as g, computed as m, createElementBlock as a, openBlock as r, createElementVNode as e, toDisplayString as n, createCommentVNode as d } from "vue";
|
|
2
|
+
const p = { class: "w-full" }, x = { class: "mb-2 flex justify-between items-center" }, h = { class: "text-sm font-medium text-gray-900 dark:text-white" }, y = { class: "relative bg-gray-50 rounded-lg dark:bg-gray-700 p-4 h-auto" }, v = { class: "overflow-auto max-h-32" }, b = { class: "text-sm text-gray-500 dark:text-gray-400" }, f = { class: "absolute top-2 end-2 bg-gray-50 dark:bg-gray-700" }, k = {
|
|
3
|
+
key: 0,
|
|
4
|
+
class: "inline-flex items-center"
|
|
5
|
+
}, w = {
|
|
6
|
+
key: 1,
|
|
7
|
+
class: "inline-flex items-center"
|
|
8
|
+
}, _ = { class: "mt-2 text-sm text-gray-500 dark:text-gray-400" }, B = {
|
|
9
|
+
__name: "GlCodeCopy",
|
|
10
|
+
props: {
|
|
11
|
+
label_name: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: ""
|
|
14
|
+
},
|
|
15
|
+
code: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: ""
|
|
18
|
+
},
|
|
19
|
+
description: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: ""
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
setup(o) {
|
|
25
|
+
const c = o, s = g(!1), u = (i) => {
|
|
26
|
+
navigator.clipboard.writeText(i).then(function() {
|
|
27
|
+
s.value = !0, setTimeout(() => {
|
|
28
|
+
s.value = !1;
|
|
29
|
+
}, 2e3);
|
|
30
|
+
}).catch(function(t) {
|
|
31
|
+
console.error("Error copying to clipboard: ", t);
|
|
32
|
+
});
|
|
33
|
+
}, l = m(() => c.code);
|
|
34
|
+
return (i, t) => (r(), a("div", p, [
|
|
35
|
+
e("div", x, [
|
|
36
|
+
e("p", h, n(o.label_name), 1)
|
|
37
|
+
]),
|
|
38
|
+
e("div", y, [
|
|
39
|
+
e("div", v, [
|
|
40
|
+
e("code", b, n(l.value), 1)
|
|
41
|
+
]),
|
|
42
|
+
e("div", f, [
|
|
43
|
+
e("button", {
|
|
44
|
+
onClick: t[0] || (t[0] = (C) => u(l.value)),
|
|
45
|
+
class: "text-gray-900 dark:text-gray-400 m-1 hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-600 dark:hover:bg-gray-700 rounded-lg py-2 px-3 inline-flex items-center justify-center bg-white border-gray-200 border"
|
|
46
|
+
}, [
|
|
47
|
+
s.value ? d("", !0) : (r(), a("span", k, t[1] || (t[1] = [
|
|
48
|
+
e("svg", {
|
|
49
|
+
class: "w-3 h-3 me-2",
|
|
50
|
+
"aria-hidden": "true",
|
|
51
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
52
|
+
fill: "currentColor",
|
|
53
|
+
viewBox: "0 0 18 20"
|
|
54
|
+
}, [
|
|
55
|
+
e("path", { d: "M16 1h-3.278A1.992 1.992 0 0 0 11 0H7a1.993 1.993 0 0 0-1.722 1H2a2 2 0 0 0-2 2v15a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2Zm-3 14H5a1 1 0 0 1 0-2h8a1 1 0 0 1 0 2Zm0-4H5a1 1 0 0 1 0-2h8a1 1 0 1 1 0 2Zm0-5H5a1 1 0 0 1 0-2h2V2h4v2h2a1 1 0 1 1 0 2Z" })
|
|
56
|
+
], -1),
|
|
57
|
+
e("span", { class: "text-xs font-semibold" }, "Copy", -1)
|
|
58
|
+
]))),
|
|
59
|
+
s.value ? (r(), a("span", w, t[2] || (t[2] = [
|
|
60
|
+
e("svg", {
|
|
61
|
+
class: "w-3 h-3 text-blue-700 dark:text-blue-500 me-2",
|
|
62
|
+
"aria-hidden": "true",
|
|
63
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
64
|
+
fill: "none",
|
|
65
|
+
viewBox: "0 0 16 12"
|
|
66
|
+
}, [
|
|
67
|
+
e("path", {
|
|
68
|
+
stroke: "currentColor",
|
|
69
|
+
"stroke-linecap": "round",
|
|
70
|
+
"stroke-linejoin": "round",
|
|
71
|
+
"stroke-width": "2",
|
|
72
|
+
d: "M1 5.917 5.724 10.5 15 1.5"
|
|
73
|
+
})
|
|
74
|
+
], -1),
|
|
75
|
+
e("span", { class: "text-xs font-semibold text-blue-700 dark:text-blue-500" }, "Copied", -1)
|
|
76
|
+
]))) : d("", !0)
|
|
77
|
+
])
|
|
78
|
+
])
|
|
79
|
+
]),
|
|
80
|
+
e("p", _, n(o.description), 1)
|
|
81
|
+
]));
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
export {
|
|
85
|
+
B as default
|
|
86
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { ref as C, onMounted as A, watch as v, onUnmounted as j, createElementBlock as g, openBlock as m, Fragment as q, createCommentVNode as x, normalizeClass as u, createElementVNode as l, toDisplayString as r } from "vue";
|
|
2
|
+
import { E as _, h as f, k, a as L, b as o, d as V, S as D, l as G, j as M, o as E } from "./index-B4V16SEr.js";
|
|
3
|
+
const W = { class: "font-bold ptext-lg dark:text-white" }, z = ["id"], F = ["for"], H = { class: "gl-span-form-error" }, K = { class: "block mt-1 text-sm font-normal leading-5 text-gray-500" }, I = {
|
|
4
|
+
__name: "GlCodeMirror",
|
|
5
|
+
props: {
|
|
6
|
+
modelValue: {
|
|
7
|
+
type: String,
|
|
8
|
+
default: ""
|
|
9
|
+
},
|
|
10
|
+
language: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: "javascript"
|
|
13
|
+
},
|
|
14
|
+
theme: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: ""
|
|
17
|
+
},
|
|
18
|
+
is_required: { type: Boolean, default: !1 },
|
|
19
|
+
show: { type: Boolean, default: !1 },
|
|
20
|
+
error_message: { type: String, default: "" },
|
|
21
|
+
model_value: { type: [String, Number], default: null },
|
|
22
|
+
type: { type: String, default: "text" },
|
|
23
|
+
field_name: { type: String, default: "" },
|
|
24
|
+
label_name: { type: String, default: "" },
|
|
25
|
+
description: { type: String, default: "" },
|
|
26
|
+
showLineNumbers: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: !0
|
|
29
|
+
},
|
|
30
|
+
highlightActiveLine: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: !0
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
emits: ["update:modelValue", "change"],
|
|
36
|
+
setup(e, { emit: N }) {
|
|
37
|
+
const a = e, s = N, c = C(null);
|
|
38
|
+
let i = null;
|
|
39
|
+
const h = (t) => {
|
|
40
|
+
switch (t) {
|
|
41
|
+
case "javascript":
|
|
42
|
+
return M();
|
|
43
|
+
// Add more languages here
|
|
44
|
+
default:
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
}, y = (t) => {
|
|
48
|
+
switch (t) {
|
|
49
|
+
case "one-dark":
|
|
50
|
+
return E;
|
|
51
|
+
default:
|
|
52
|
+
return document.body.classList.contains("dark") ? E : [];
|
|
53
|
+
}
|
|
54
|
+
}, b = (t) => t ? [G()] : [], p = (t) => t ? [f()] : [];
|
|
55
|
+
return A(() => {
|
|
56
|
+
if (c.value) {
|
|
57
|
+
const t = _.create({
|
|
58
|
+
doc: a.modelValue,
|
|
59
|
+
extensions: [
|
|
60
|
+
...b(a.showLineNumbers),
|
|
61
|
+
...p(a.highlightActiveLine),
|
|
62
|
+
f(),
|
|
63
|
+
//
|
|
64
|
+
k.of(V),
|
|
65
|
+
h(a.language),
|
|
66
|
+
...y(a.theme),
|
|
67
|
+
L(),
|
|
68
|
+
o.updateListener.of((n) => {
|
|
69
|
+
if (n.docChanged) {
|
|
70
|
+
const d = n.state.doc.toString();
|
|
71
|
+
s("update:modelValue", d), s("change", d);
|
|
72
|
+
}
|
|
73
|
+
}),
|
|
74
|
+
o.lineWrapping
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
i = new o({
|
|
78
|
+
state: t,
|
|
79
|
+
parent: c.value
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}), v(
|
|
83
|
+
() => a.modelValue,
|
|
84
|
+
(t) => {
|
|
85
|
+
if (i) {
|
|
86
|
+
const n = i.state.doc.toString();
|
|
87
|
+
t !== n && i.dispatch({
|
|
88
|
+
changes: {
|
|
89
|
+
from: 0,
|
|
90
|
+
to: n.length,
|
|
91
|
+
insert: t
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
), v(
|
|
97
|
+
() => [a.language, a.theme, a.showLineNumbers, a.highlightActiveLine],
|
|
98
|
+
([t, n, d, B]) => {
|
|
99
|
+
i && i.dispatch({
|
|
100
|
+
effects: D.reconfigure.of([
|
|
101
|
+
...b(d),
|
|
102
|
+
...p(B),
|
|
103
|
+
f(),
|
|
104
|
+
// Ensure it's included if highlightActiveLine is true
|
|
105
|
+
k.of([...V]),
|
|
106
|
+
h(t),
|
|
107
|
+
...y(n),
|
|
108
|
+
L(),
|
|
109
|
+
o.updateListener.of((w) => {
|
|
110
|
+
if (w.docChanged) {
|
|
111
|
+
const S = w.state.doc.toString();
|
|
112
|
+
s("update:modelValue", S), s("change", S);
|
|
113
|
+
}
|
|
114
|
+
}),
|
|
115
|
+
o.lineWrapping
|
|
116
|
+
])
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
), j(() => {
|
|
120
|
+
i && i.destroy();
|
|
121
|
+
}), (t, n) => (m(), g(q, null, [
|
|
122
|
+
e.show ? (m(), g("div", {
|
|
123
|
+
key: 0,
|
|
124
|
+
class: u(e.field_name)
|
|
125
|
+
}, [
|
|
126
|
+
l("h3", W, r(e.label_name), 1),
|
|
127
|
+
l("p", {
|
|
128
|
+
id: e.field_name,
|
|
129
|
+
class: "mb-4 text-base text-gray-900 input_tr_show dark:text-white"
|
|
130
|
+
}, r(e.model_value), 9, z),
|
|
131
|
+
n[0] || (n[0] = l("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
|
|
132
|
+
], 2)) : x("", !0),
|
|
133
|
+
e.show ? x("", !0) : (m(), g("div", {
|
|
134
|
+
key: 1,
|
|
135
|
+
class: u(["mb-4", e.field_name])
|
|
136
|
+
}, [
|
|
137
|
+
l("label", {
|
|
138
|
+
class: u({
|
|
139
|
+
"gl-label-form": e.error_message == "",
|
|
140
|
+
"gl-label-form-invalid": e.error_message !== "",
|
|
141
|
+
required: e.is_required
|
|
142
|
+
}),
|
|
143
|
+
for: e.field_name
|
|
144
|
+
}, r(e.label_name), 11, F),
|
|
145
|
+
l("div", {
|
|
146
|
+
ref_key: "editor",
|
|
147
|
+
ref: c,
|
|
148
|
+
class: u(["CodeEditor custom-editor", {
|
|
149
|
+
"gl-input-form": e.error_message == "",
|
|
150
|
+
"gl-input-form-invalid": e.error_message !== ""
|
|
151
|
+
}])
|
|
152
|
+
}, null, 2),
|
|
153
|
+
l("span", H, r(e.error_message), 1),
|
|
154
|
+
l("small", K, r(e.description), 1)
|
|
155
|
+
], 2))
|
|
156
|
+
], 64));
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
export {
|
|
160
|
+
I as default
|
|
161
|
+
};
|