golden-logic-ui 1.3.18 → 1.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/components/GeneralComponents/GlCodeMirror.vue.js +137 -90
- package/dist/components/GeneralComponents/GlMultiSelectDropdown.vue.js +104 -102
- package/dist/node_modules/@codemirror/lang-sql/dist/index.js +518 -0
- package/dist/node_modules/@codemirror/view/dist/index.js +434 -404
- package/package.json +2 -1
|
@@ -1,26 +1,47 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { EditorState as
|
|
3
|
-
import {
|
|
4
|
-
import { defaultKeymap as
|
|
5
|
-
import { javascript as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { ref as B, onMounted as C, watch as h, onUnmounted as A, createElementBlock as i, openBlock as s, Fragment as j, createCommentVNode as g, normalizeClass as d, createElementVNode as l, toDisplayString as o } from "vue";
|
|
2
|
+
import { Prec as M, EditorState as D, StateEffect as P } from "../../node_modules/@codemirror/state/dist/index.js";
|
|
3
|
+
import { keymap as y, highlightActiveLineGutter as p, EditorView as c, lineNumbers as Q, placeholder as G } from "../../node_modules/@codemirror/view/dist/index.js";
|
|
4
|
+
import { defaultKeymap as H } from "../../node_modules/@codemirror/commands/dist/index.js";
|
|
5
|
+
import { javascript as K } from "../../node_modules/@codemirror/lang-javascript/dist/index.js";
|
|
6
|
+
import { sql as _, StandardSQL as z, PostgreSQL as F, MySQL as O } from "../../node_modules/@codemirror/lang-sql/dist/index.js";
|
|
7
|
+
import { oneDark as b } from "../../node_modules/@codemirror/theme-one-dark/dist/index.js";
|
|
8
|
+
import { autocompletion as T } from "../../node_modules/@codemirror/autocomplete/dist/index.js";
|
|
8
9
|
/* empty css */
|
|
9
|
-
const
|
|
10
|
+
const U = { class: "font-bold ptext-lg dark:text-white" }, W = ["id"], I = ["for"], J = { class: "gl-span-form-error" }, R = { class: "block mt-1 text-sm font-normal leading-5 text-gray-500" }, oe = {
|
|
10
11
|
__name: "GlCodeMirror",
|
|
11
12
|
props: {
|
|
12
13
|
modelValue: {
|
|
13
14
|
type: String,
|
|
14
15
|
default: ""
|
|
15
16
|
},
|
|
17
|
+
// "javascript" or "sql"; anything else is plain text.
|
|
16
18
|
language: {
|
|
17
19
|
type: String,
|
|
18
20
|
default: "javascript"
|
|
19
21
|
},
|
|
22
|
+
// For SQL: "mysql" or "postgresql" picks the keywords and quoting; empty is standard SQL.
|
|
23
|
+
dialect: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: ""
|
|
26
|
+
},
|
|
27
|
+
// For SQL completion: { tableName: ["column", ...] }.
|
|
28
|
+
sqlSchema: {
|
|
29
|
+
type: Object,
|
|
30
|
+
default: null
|
|
31
|
+
},
|
|
20
32
|
theme: {
|
|
21
33
|
type: String,
|
|
22
34
|
default: ""
|
|
23
35
|
},
|
|
36
|
+
// A CSS height such as "320px"; empty lets the editor grow with its content.
|
|
37
|
+
height: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: ""
|
|
40
|
+
},
|
|
41
|
+
placeholder: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: ""
|
|
44
|
+
},
|
|
24
45
|
is_required: { type: Boolean, default: !1 },
|
|
25
46
|
show: { type: Boolean, default: !1 },
|
|
26
47
|
error_message: { type: String, default: "" },
|
|
@@ -38,115 +59,141 @@ const W = { class: "font-bold ptext-lg dark:text-white" }, z = ["id"], F = ["for
|
|
|
38
59
|
default: !0
|
|
39
60
|
}
|
|
40
61
|
},
|
|
41
|
-
emits: ["update:modelValue", "change"],
|
|
42
|
-
setup(
|
|
43
|
-
const
|
|
44
|
-
let
|
|
45
|
-
const
|
|
46
|
-
|
|
62
|
+
emits: ["update:modelValue", "change", "run"],
|
|
63
|
+
setup(t, { expose: S, emit: w }) {
|
|
64
|
+
const r = t, u = w, m = B(null);
|
|
65
|
+
let a = null;
|
|
66
|
+
const x = (e) => {
|
|
67
|
+
switch ((e || "").toLowerCase()) {
|
|
68
|
+
case "mysql":
|
|
69
|
+
case "mariadb":
|
|
70
|
+
return O;
|
|
71
|
+
case "postgresql":
|
|
72
|
+
case "postgres":
|
|
73
|
+
case "pgsql":
|
|
74
|
+
return F;
|
|
75
|
+
default:
|
|
76
|
+
return z;
|
|
77
|
+
}
|
|
78
|
+
}, v = (e) => {
|
|
79
|
+
switch (e) {
|
|
80
|
+
case "javascript":
|
|
81
|
+
return K();
|
|
82
|
+
case "sql":
|
|
83
|
+
return _({
|
|
84
|
+
dialect: x(r.dialect),
|
|
85
|
+
schema: r.sqlSchema || void 0
|
|
86
|
+
});
|
|
87
|
+
// Add more languages here
|
|
88
|
+
default:
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
}, L = (e) => e === "one-dark" ? b : document.body.classList.contains("dark") ? b : [], k = (e) => e ? [Q()] : [], E = (e) => e ? [p()] : [], q = (e) => e ? [
|
|
92
|
+
c.theme({
|
|
93
|
+
"&": { height: e },
|
|
94
|
+
".cm-scroller": { overflow: "auto" }
|
|
95
|
+
})
|
|
96
|
+
] : [], V = (e) => e ? [G(e)] : [], N = M.highest(
|
|
97
|
+
y.of([
|
|
98
|
+
{
|
|
99
|
+
key: "Mod-Enter",
|
|
100
|
+
run: () => (u("run"), !0)
|
|
101
|
+
}
|
|
102
|
+
])
|
|
103
|
+
), f = () => [
|
|
104
|
+
...k(r.showLineNumbers),
|
|
105
|
+
...E(r.highlightActiveLine),
|
|
106
|
+
p(),
|
|
107
|
+
N,
|
|
108
|
+
y.of(H),
|
|
109
|
+
v(r.language),
|
|
110
|
+
...L(r.theme),
|
|
111
|
+
...q(r.height),
|
|
112
|
+
...V(r.placeholder),
|
|
113
|
+
T(),
|
|
114
|
+
c.updateListener.of((e) => {
|
|
115
|
+
if (e.docChanged) {
|
|
116
|
+
const n = e.state.doc.toString();
|
|
117
|
+
u("update:modelValue", n), u("change", n);
|
|
118
|
+
}
|
|
119
|
+
}),
|
|
120
|
+
c.lineWrapping
|
|
121
|
+
];
|
|
122
|
+
return C(() => {
|
|
47
123
|
if (m.value) {
|
|
48
|
-
const
|
|
49
|
-
doc:
|
|
50
|
-
extensions:
|
|
51
|
-
...p(a.showLineNumbers),
|
|
52
|
-
...b(a.highlightActiveLine),
|
|
53
|
-
f(),
|
|
54
|
-
//
|
|
55
|
-
k.of(L),
|
|
56
|
-
h(a.language),
|
|
57
|
-
...y(a.theme),
|
|
58
|
-
E(),
|
|
59
|
-
l.updateListener.of((n) => {
|
|
60
|
-
if (n.docChanged) {
|
|
61
|
-
const d = n.state.doc.toString();
|
|
62
|
-
s("update:modelValue", d), s("change", d);
|
|
63
|
-
}
|
|
64
|
-
}),
|
|
65
|
-
l.lineWrapping
|
|
66
|
-
]
|
|
124
|
+
const e = D.create({
|
|
125
|
+
doc: r.modelValue,
|
|
126
|
+
extensions: f()
|
|
67
127
|
});
|
|
68
|
-
|
|
69
|
-
state:
|
|
128
|
+
a = new c({
|
|
129
|
+
state: e,
|
|
70
130
|
parent: m.value
|
|
71
131
|
});
|
|
72
132
|
}
|
|
73
|
-
}),
|
|
74
|
-
() =>
|
|
75
|
-
(
|
|
76
|
-
if (
|
|
77
|
-
const n =
|
|
78
|
-
|
|
133
|
+
}), h(
|
|
134
|
+
() => r.modelValue,
|
|
135
|
+
(e) => {
|
|
136
|
+
if (a) {
|
|
137
|
+
const n = a.state.doc.toString();
|
|
138
|
+
e !== n && a.dispatch({
|
|
79
139
|
changes: {
|
|
80
140
|
from: 0,
|
|
81
141
|
to: n.length,
|
|
82
|
-
insert:
|
|
142
|
+
insert: e
|
|
83
143
|
}
|
|
84
144
|
});
|
|
85
145
|
}
|
|
86
146
|
}
|
|
87
|
-
),
|
|
88
|
-
() => [
|
|
89
|
-
(
|
|
90
|
-
|
|
91
|
-
effects:
|
|
92
|
-
...p(d),
|
|
93
|
-
...b(B),
|
|
94
|
-
f(),
|
|
95
|
-
// Ensure it's included if highlightActiveLine is true
|
|
96
|
-
k.of([...L]),
|
|
97
|
-
h(t),
|
|
98
|
-
...y(n),
|
|
99
|
-
E(),
|
|
100
|
-
l.updateListener.of((w) => {
|
|
101
|
-
if (w.docChanged) {
|
|
102
|
-
const v = w.state.doc.toString();
|
|
103
|
-
s("update:modelValue", v), s("change", v);
|
|
104
|
-
}
|
|
105
|
-
}),
|
|
106
|
-
l.lineWrapping
|
|
107
|
-
])
|
|
147
|
+
), h(
|
|
148
|
+
() => [r.language, r.dialect, r.sqlSchema, r.theme, r.showLineNumbers, r.highlightActiveLine, r.height, r.placeholder],
|
|
149
|
+
() => {
|
|
150
|
+
a && a.dispatch({
|
|
151
|
+
effects: P.reconfigure.of(f())
|
|
108
152
|
});
|
|
109
153
|
}
|
|
110
|
-
),
|
|
111
|
-
|
|
112
|
-
}), (
|
|
113
|
-
|
|
154
|
+
), S({ focus: () => {
|
|
155
|
+
a?.focus();
|
|
156
|
+
} }), A(() => {
|
|
157
|
+
a && a.destroy();
|
|
158
|
+
}), (e, n) => (s(), i(j, null, [
|
|
159
|
+
t.show ? (s(), i("div", {
|
|
114
160
|
key: 0,
|
|
115
|
-
class:
|
|
161
|
+
class: d(t.field_name)
|
|
116
162
|
}, [
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
id:
|
|
163
|
+
l("h3", U, o(t.label_name), 1),
|
|
164
|
+
l("p", {
|
|
165
|
+
id: t.field_name,
|
|
120
166
|
class: "mb-4 text-base text-gray-900 input_tr_show dark:text-white"
|
|
121
|
-
}, o(
|
|
122
|
-
n[0] || (n[0] =
|
|
123
|
-
], 2)) :
|
|
124
|
-
|
|
167
|
+
}, o(t.model_value), 9, W),
|
|
168
|
+
n[0] || (n[0] = l("hr", { class: "opacity-100! bg-gray-200 border-0 dark:bg-gray-700" }, null, -1))
|
|
169
|
+
], 2)) : g("", !0),
|
|
170
|
+
t.show ? g("", !0) : (s(), i("div", {
|
|
125
171
|
key: 1,
|
|
126
|
-
class:
|
|
172
|
+
class: d(["mb-4", t.field_name])
|
|
127
173
|
}, [
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
"gl-label-form
|
|
132
|
-
|
|
174
|
+
t.label_name ? (s(), i("label", {
|
|
175
|
+
key: 0,
|
|
176
|
+
class: d({
|
|
177
|
+
"gl-label-form": t.error_message == "",
|
|
178
|
+
"gl-label-form-invalid": t.error_message !== "",
|
|
179
|
+
required: t.is_required
|
|
133
180
|
}),
|
|
134
|
-
for:
|
|
135
|
-
}, o(
|
|
136
|
-
|
|
181
|
+
for: t.field_name
|
|
182
|
+
}, o(t.label_name), 11, I)) : g("", !0),
|
|
183
|
+
l("div", {
|
|
137
184
|
ref_key: "editor",
|
|
138
185
|
ref: m,
|
|
139
|
-
class:
|
|
140
|
-
"gl-input-form":
|
|
141
|
-
"gl-input-form-invalid":
|
|
186
|
+
class: d(["CodeEditor custom-editor", {
|
|
187
|
+
"gl-input-form": t.error_message == "",
|
|
188
|
+
"gl-input-form-invalid": t.error_message !== ""
|
|
142
189
|
}])
|
|
143
190
|
}, null, 2),
|
|
144
|
-
|
|
145
|
-
|
|
191
|
+
l("span", J, o(t.error_message), 1),
|
|
192
|
+
l("small", R, o(t.description), 1)
|
|
146
193
|
], 2))
|
|
147
194
|
], 64));
|
|
148
195
|
}
|
|
149
196
|
};
|
|
150
197
|
export {
|
|
151
|
-
|
|
198
|
+
oe as default
|
|
152
199
|
};
|