@tellaro/tql 0.1.0 → 0.1.1
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/index.js +61 -31
- package/dist/src/completionProvider.js +226 -178
- package/dist/src/complexityAnalyzer.d.ts +55 -0
- package/dist/src/complexityAnalyzer.js +209 -0
- package/dist/src/fuzzyMatcher.d.ts +71 -0
- package/dist/src/fuzzyMatcher.js +110 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/parser.d.ts +10 -0
- package/dist/src/parser.js +101 -48
- package/dist/src/schemaCache.d.ts +75 -0
- package/dist/src/schemaCache.js +104 -0
- package/dist/src/semanticPreview.d.ts +72 -0
- package/dist/src/semanticPreview.js +242 -0
- package/dist/src/types.d.ts +116 -0
- package/dist/style.css +1 -1
- package/dist/vue/TqlAutocomplete.vue.js +2 -2
- package/dist/vue/TqlAutocomplete.vue2.js +62 -56
- package/dist/vue/TqlInput.vue.js +2 -2
- package/dist/vue/TqlInput.vue2.js +421 -199
- package/dist/vue/components/TqlPreview.vue.d.ts +4 -0
- package/dist/vue/components/TqlPreview.vue.js +9 -0
- package/dist/vue/components/TqlPreview.vue2.js +264 -0
- package/dist/vue/composables/useQueryHistory.d.ts +35 -0
- package/dist/vue/composables/useQueryHistory.js +176 -0
- package/dist/vue/index.d.ts +2 -0
- package/dist/vue/index.js +10 -6
- package/dist/vue/useTqlInput.js +79 -77
- package/package.json +3 -1
|
@@ -1,23 +1,47 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { defineComponent as Ae, ref as g, toRef as J, computed as I, watch as Fe, onMounted as Le, onUnmounted as Oe, openBlock as o, createElementBlock as i, normalizeClass as w, unref as c, Fragment as B, renderList as M, toDisplayString as h, createCommentVNode as v, withDirectives as W, vModelText as X, createElementVNode as r, withModifiers as D, withKeys as ce, createVNode as de, nextTick as Q } from "vue";
|
|
2
|
+
import Ne from "./TqlAutocomplete.vue.js";
|
|
3
|
+
import Ue from "./components/TqlPreview.vue.js";
|
|
4
|
+
import { useTqlInput as ze } from "./useTqlInput.js";
|
|
5
|
+
import { useQueryHistory as je } from "./composables/useQueryHistory.js";
|
|
6
|
+
import { analyzeComplexity as Ge } from "../src/complexityAnalyzer.js";
|
|
7
|
+
const Je = {
|
|
5
8
|
key: 0,
|
|
6
9
|
class: "tql-highlight-layer",
|
|
7
10
|
"aria-hidden": "true"
|
|
8
|
-
},
|
|
9
|
-
key: 3,
|
|
10
|
-
class: "tql-validation-icon"
|
|
11
|
-
}, Be = {
|
|
11
|
+
}, We = ["placeholder", "disabled", "readonly", "rows", "aria-expanded", "aria-invalid", "aria-describedby"], Xe = ["placeholder", "disabled", "readonly", "aria-expanded", "aria-invalid", "aria-describedby"], Ye = { class: "tql-toolbar" }, Ze = ["title"], _e = { class: "tql-complexity-label" }, et = {
|
|
12
12
|
key: 0,
|
|
13
|
-
class: "
|
|
14
|
-
},
|
|
15
|
-
key:
|
|
16
|
-
class: "tql-validation-
|
|
17
|
-
},
|
|
13
|
+
class: "tql-complexity-count"
|
|
14
|
+
}, tt = {
|
|
15
|
+
key: 4,
|
|
16
|
+
class: "tql-validation-status"
|
|
17
|
+
}, lt = {
|
|
18
|
+
key: 0,
|
|
19
|
+
class: "pi pi-check-circle tql-icon-valid",
|
|
20
|
+
"aria-label": "Query is valid"
|
|
21
|
+
}, ot = ["aria-label", "aria-expanded"], it = { class: "tql-history-header" }, at = { class: "tql-history-list" }, st = ["onClick"], nt = ["title", "onClick"], ut = { class: "tql-history-content" }, rt = {
|
|
22
|
+
key: 0,
|
|
23
|
+
class: "tql-history-label"
|
|
24
|
+
}, ct = { class: "tql-history-query" }, dt = { class: "tql-history-time" }, vt = {
|
|
25
|
+
key: 0,
|
|
26
|
+
class: "tql-history-empty"
|
|
27
|
+
}, pt = {
|
|
18
28
|
key: 0,
|
|
19
29
|
class: "tql-error-suggestion"
|
|
20
|
-
},
|
|
30
|
+
}, ft = {
|
|
31
|
+
key: 5,
|
|
32
|
+
class: "tql-complexity-warnings"
|
|
33
|
+
}, yt = {
|
|
34
|
+
key: 0,
|
|
35
|
+
class: "tql-complexity-suggestions"
|
|
36
|
+
}, ht = {
|
|
37
|
+
key: 6,
|
|
38
|
+
class: "tql-preview-panel"
|
|
39
|
+
}, mt = { class: "tql-preview-header" }, gt = {
|
|
40
|
+
class: "sr-only",
|
|
41
|
+
role: "status",
|
|
42
|
+
"aria-live": "polite",
|
|
43
|
+
"aria-atomic": "true"
|
|
44
|
+
}, wt = { key: 0 }, bt = { key: 1 }, Pt = /* @__PURE__ */ Ae({
|
|
21
45
|
__name: "TqlInput",
|
|
22
46
|
props: {
|
|
23
47
|
modelValue: {},
|
|
@@ -34,293 +58,491 @@ const Se = {
|
|
|
34
58
|
snippets: {},
|
|
35
59
|
showSnippetButton: { type: Boolean, default: !1 },
|
|
36
60
|
autocomplete: { type: Boolean, default: !0 },
|
|
37
|
-
syntaxHighlighting: { type: Boolean, default: !0 }
|
|
61
|
+
syntaxHighlighting: { type: Boolean, default: !0 },
|
|
62
|
+
alwaysShowErrors: { type: Boolean },
|
|
63
|
+
showComplexity: { type: Boolean, default: !1 },
|
|
64
|
+
showHistory: { type: Boolean, default: !1 },
|
|
65
|
+
showPreview: { type: Boolean, default: !1 },
|
|
66
|
+
complexityThresholds: {},
|
|
67
|
+
historyOptions: {},
|
|
68
|
+
historyStorageKey: {}
|
|
38
69
|
},
|
|
39
70
|
emits: ["update:modelValue", "validation", "parse", "submit"],
|
|
40
|
-
setup(a, { expose:
|
|
41
|
-
const
|
|
42
|
-
tokens:
|
|
43
|
-
cursorPosition:
|
|
44
|
-
completionItems:
|
|
45
|
-
showAutocomplete:
|
|
71
|
+
setup(a, { expose: ve, emit: pe }) {
|
|
72
|
+
const d = a, b = pe, u = g(null), K = g(null), E = g(null), n = g(d.modelValue), S = g(!1), f = g(!1), q = g(!1), k = g(!1), P = g(""), O = `tql-input-${Math.random().toString(36).substring(2, 9)}`, Y = `${O}-input`, N = `${O}-autocomplete`, U = `${O}-errors`, H = g([]), R = g(-1), fe = J(d, "modelValue"), ye = J(d, "fieldSchema"), he = J(d, "snippets"), {
|
|
73
|
+
tokens: me,
|
|
74
|
+
cursorPosition: z,
|
|
75
|
+
completionItems: j,
|
|
76
|
+
showAutocomplete: x,
|
|
46
77
|
isValid: Z,
|
|
47
|
-
errors:
|
|
48
|
-
hasErrors:
|
|
49
|
-
validate:
|
|
50
|
-
handleInput:
|
|
51
|
-
handleCursorChange:
|
|
52
|
-
insertCompletion:
|
|
53
|
-
insertSnippet:
|
|
54
|
-
triggerAutocomplete:
|
|
55
|
-
hideAutocomplete:
|
|
56
|
-
getTokenAtCursor:
|
|
57
|
-
} =
|
|
58
|
-
modelValue:
|
|
59
|
-
fieldSchema:
|
|
60
|
-
snippets:
|
|
61
|
-
validateOnInput:
|
|
62
|
-
debounceMs:
|
|
63
|
-
autocomplete:
|
|
64
|
-
onValidation: (e) =>
|
|
65
|
-
onParse: (e) =>
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
|
|
78
|
+
errors: $,
|
|
79
|
+
hasErrors: T,
|
|
80
|
+
validate: ge,
|
|
81
|
+
handleInput: _,
|
|
82
|
+
handleCursorChange: V,
|
|
83
|
+
insertCompletion: we,
|
|
84
|
+
insertSnippet: be,
|
|
85
|
+
triggerAutocomplete: qe,
|
|
86
|
+
hideAutocomplete: A,
|
|
87
|
+
getTokenAtCursor: ke
|
|
88
|
+
} = ze({
|
|
89
|
+
modelValue: fe,
|
|
90
|
+
fieldSchema: ye,
|
|
91
|
+
snippets: he,
|
|
92
|
+
validateOnInput: d.validateOnInput,
|
|
93
|
+
debounceMs: d.debounceMs,
|
|
94
|
+
autocomplete: d.autocomplete,
|
|
95
|
+
onValidation: (e) => b("validation", e),
|
|
96
|
+
onParse: (e) => b("parse", e)
|
|
97
|
+
}), C = d.showHistory ? je({
|
|
98
|
+
storageKey: d.historyStorageKey || "tql-history",
|
|
99
|
+
...d.historyOptions
|
|
100
|
+
}) : null, y = I(() => !d.showComplexity || !n.value.trim() ? null : Ge(n.value, d.complexityThresholds)), xe = I(() => y.value ? `tql-complexity-${y.value.score}` : ""), ee = I(() => y.value && {
|
|
101
|
+
low: "Low",
|
|
102
|
+
medium: "Medium",
|
|
103
|
+
high: "High"
|
|
104
|
+
}[y.value.score] || ""), te = I(() => C ? P.value.trim() ? C.searchHistory(P.value).slice(0, 10) : C.getRecentQueries(10) : []);
|
|
105
|
+
function Ce(e) {
|
|
106
|
+
n.value = e.query, b("update:modelValue", e.query), _(e.query), q.value = !1, P.value = "", Q(() => {
|
|
107
|
+
var t;
|
|
108
|
+
return (t = u.value) == null ? void 0 : t.focus();
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function Se(e, t) {
|
|
112
|
+
t.stopPropagation(), C == null || C.toggleFavorite(e.id);
|
|
113
|
+
}
|
|
114
|
+
function le() {
|
|
115
|
+
C && n.value.trim() && C.addQuery(n.value);
|
|
116
|
+
}
|
|
117
|
+
function Ve() {
|
|
118
|
+
q.value = !q.value, q.value && (k.value = !1);
|
|
119
|
+
}
|
|
120
|
+
function Pe() {
|
|
121
|
+
k.value = !k.value, k.value && (q.value = !1);
|
|
122
|
+
}
|
|
123
|
+
Fe(
|
|
124
|
+
() => d.modelValue,
|
|
69
125
|
(e) => {
|
|
70
|
-
e !==
|
|
126
|
+
e !== n.value && (n.value = e);
|
|
71
127
|
}
|
|
72
128
|
);
|
|
73
|
-
const
|
|
74
|
-
if (!
|
|
129
|
+
const Re = I(() => {
|
|
130
|
+
if (!u.value || !K.value)
|
|
75
131
|
return { top: 0, left: 0 };
|
|
76
|
-
const e =
|
|
132
|
+
const e = K.value.getBoundingClientRect();
|
|
77
133
|
return {
|
|
78
134
|
top: e.bottom + 4,
|
|
79
135
|
left: e.left
|
|
80
136
|
};
|
|
81
137
|
});
|
|
82
|
-
function
|
|
138
|
+
function $e(e) {
|
|
83
139
|
const t = `tql-token tql-token-${e.type}`;
|
|
84
|
-
return
|
|
140
|
+
return $.value.some((s) => e.start >= s.start && e.end <= s.end) ? `${t} tql-token-error-range` : t;
|
|
85
141
|
}
|
|
86
|
-
function
|
|
142
|
+
function oe(e) {
|
|
87
143
|
const t = e.target;
|
|
88
|
-
|
|
89
|
-
|
|
144
|
+
n.value = t.value, b("update:modelValue", t.value), _(t.value), Q(() => {
|
|
145
|
+
u.value && V(u.value.selectionStart || 0);
|
|
90
146
|
});
|
|
91
147
|
}
|
|
92
|
-
function
|
|
93
|
-
if (
|
|
94
|
-
const e =
|
|
95
|
-
e !==
|
|
148
|
+
function F() {
|
|
149
|
+
if (u.value) {
|
|
150
|
+
const e = u.value.selectionStart || 0;
|
|
151
|
+
e !== z.value && V(e);
|
|
96
152
|
}
|
|
97
153
|
}
|
|
98
|
-
function
|
|
99
|
-
var t, l,
|
|
154
|
+
function ie(e) {
|
|
155
|
+
var t, l, s, p, m;
|
|
100
156
|
if (e.key === "Tab" && !e.shiftKey) {
|
|
101
|
-
if (
|
|
102
|
-
e.preventDefault(),
|
|
157
|
+
if (H.value.length > 0 && R.value >= 0) {
|
|
158
|
+
e.preventDefault(), Te();
|
|
103
159
|
return;
|
|
104
160
|
}
|
|
105
|
-
if (
|
|
106
|
-
e.preventDefault(),
|
|
161
|
+
if (Be()) {
|
|
162
|
+
e.preventDefault(), De();
|
|
107
163
|
return;
|
|
108
164
|
}
|
|
109
165
|
}
|
|
110
|
-
if (
|
|
166
|
+
if (x.value && j.value.length > 0)
|
|
111
167
|
switch (e.key) {
|
|
112
168
|
case "ArrowDown":
|
|
113
|
-
e.preventDefault(), (t =
|
|
169
|
+
e.preventDefault(), (t = E.value) == null || t.moveDown();
|
|
114
170
|
return;
|
|
115
171
|
case "ArrowUp":
|
|
116
|
-
e.preventDefault(), (l =
|
|
172
|
+
e.preventDefault(), (l = E.value) == null || l.moveUp();
|
|
117
173
|
return;
|
|
118
174
|
case "Tab":
|
|
175
|
+
e.preventDefault(), V(((s = u.value) == null ? void 0 : s.selectionStart) || 0), j.value.length > 0 && ((p = E.value) == null || p.selectCurrent());
|
|
176
|
+
return;
|
|
119
177
|
case "Enter":
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
} else {
|
|
126
|
-
e.preventDefault(), (c = g.value) == null || c.selectCurrent();
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
break;
|
|
178
|
+
if (!d.multiline)
|
|
179
|
+
break;
|
|
180
|
+
e.preventDefault(), (m = E.value) == null || m.selectCurrent();
|
|
181
|
+
return;
|
|
130
182
|
case "Escape":
|
|
131
|
-
e.preventDefault(),
|
|
183
|
+
e.preventDefault(), A(), G();
|
|
132
184
|
return;
|
|
133
185
|
}
|
|
134
186
|
if (e.key === " " && e.ctrlKey) {
|
|
135
|
-
e.preventDefault(),
|
|
187
|
+
e.preventDefault(), qe();
|
|
136
188
|
return;
|
|
137
189
|
}
|
|
138
|
-
e.key === "Enter" && (
|
|
190
|
+
e.key === "Enter" && (d.multiline && e.ctrlKey || !d.multiline && !x.value) && (e.preventDefault(), le(), b("submit", n.value));
|
|
139
191
|
}
|
|
140
|
-
function
|
|
141
|
-
if (
|
|
142
|
-
|
|
192
|
+
function Te() {
|
|
193
|
+
if (R.value++, R.value >= H.value.length) {
|
|
194
|
+
G();
|
|
143
195
|
return;
|
|
144
196
|
}
|
|
145
|
-
const e =
|
|
146
|
-
|
|
197
|
+
const e = H.value[R.value];
|
|
198
|
+
u.value && (u.value.setSelectionRange(e.start, e.end), u.value.focus(), V(e.start));
|
|
147
199
|
}
|
|
148
|
-
function
|
|
149
|
-
|
|
200
|
+
function G() {
|
|
201
|
+
H.value = [], R.value = -1;
|
|
150
202
|
}
|
|
151
|
-
function
|
|
152
|
-
const e =
|
|
153
|
-
let l = !1,
|
|
154
|
-
for (let
|
|
155
|
-
const
|
|
156
|
-
(
|
|
203
|
+
function Be() {
|
|
204
|
+
const e = z.value, t = n.value;
|
|
205
|
+
let l = !1, s = null;
|
|
206
|
+
for (let p = 0; p < e; p++) {
|
|
207
|
+
const m = t[p], L = p > 0 ? t[p - 1] : "";
|
|
208
|
+
(m === '"' || m === "'") && L !== "\\" && (l ? m === s && (l = !1, s = null) : (l = !0, s = m));
|
|
157
209
|
}
|
|
158
210
|
return l;
|
|
159
211
|
}
|
|
160
|
-
function
|
|
161
|
-
const e =
|
|
212
|
+
function De() {
|
|
213
|
+
const e = z.value, t = n.value;
|
|
162
214
|
for (let l = e; l < t.length; l++)
|
|
163
215
|
if (t[l] === '"' || t[l] === "'") {
|
|
164
|
-
const
|
|
165
|
-
|
|
216
|
+
const s = l + 1;
|
|
217
|
+
u.value && (u.value.setSelectionRange(s, s), V(s));
|
|
166
218
|
return;
|
|
167
219
|
}
|
|
168
220
|
}
|
|
169
|
-
function
|
|
170
|
-
|
|
221
|
+
function ae() {
|
|
222
|
+
S.value = !0;
|
|
171
223
|
}
|
|
172
|
-
function
|
|
173
|
-
|
|
174
|
-
|
|
224
|
+
function se(e) {
|
|
225
|
+
const l = e.relatedTarget;
|
|
226
|
+
if (l != null && l.closest(".tql-autocomplete-dropdown")) {
|
|
227
|
+
setTimeout(() => {
|
|
228
|
+
S.value || (A(), f.value = !1);
|
|
229
|
+
}, 300);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
S.value = !1, setTimeout(() => {
|
|
233
|
+
S.value || (A(), f.value = !1);
|
|
175
234
|
}, 200);
|
|
176
235
|
}
|
|
177
|
-
function
|
|
178
|
-
const t =
|
|
179
|
-
|
|
180
|
-
|
|
236
|
+
function Ee(e) {
|
|
237
|
+
const t = we(e);
|
|
238
|
+
n.value = t.query, b("update:modelValue", t.query), t.placeholders.length > 0 ? (H.value = t.placeholders, R.value = 0) : G(), Q(() => {
|
|
239
|
+
u.value && (u.value.focus(), u.value.setSelectionRange(t.newCursorPosition, t.newCursorPosition), V(t.newCursorPosition));
|
|
181
240
|
});
|
|
182
241
|
}
|
|
183
|
-
function
|
|
184
|
-
const t =
|
|
185
|
-
|
|
186
|
-
|
|
242
|
+
function He(e) {
|
|
243
|
+
const t = be(e);
|
|
244
|
+
n.value = t, b("update:modelValue", t), Q(() => {
|
|
245
|
+
u.value && u.value.focus();
|
|
187
246
|
});
|
|
188
247
|
}
|
|
189
|
-
function
|
|
248
|
+
function Ie() {
|
|
190
249
|
var e;
|
|
191
|
-
(e =
|
|
250
|
+
(e = u.value) == null || e.focus();
|
|
192
251
|
}
|
|
193
|
-
function
|
|
252
|
+
function Me() {
|
|
194
253
|
var e;
|
|
195
|
-
(e =
|
|
254
|
+
(e = u.value) == null || e.blur();
|
|
196
255
|
}
|
|
197
|
-
function
|
|
256
|
+
function ne() {
|
|
198
257
|
var e;
|
|
199
|
-
return ((e =
|
|
258
|
+
return ((e = u.value) == null ? void 0 : e.selectionStart) || 0;
|
|
200
259
|
}
|
|
201
|
-
function
|
|
202
|
-
|
|
260
|
+
function ue(e) {
|
|
261
|
+
u.value && (u.value.setSelectionRange(e, e), V(e));
|
|
203
262
|
}
|
|
204
|
-
function
|
|
205
|
-
const t =
|
|
206
|
-
|
|
207
|
-
|
|
263
|
+
function Qe(e) {
|
|
264
|
+
const t = ne(), l = n.value.substring(0, t), s = n.value.substring(t), p = l + e + s;
|
|
265
|
+
n.value = p, b("update:modelValue", p), Q(() => {
|
|
266
|
+
ue(t + e.length);
|
|
208
267
|
});
|
|
209
268
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
269
|
+
function Ke(e) {
|
|
270
|
+
const l = Date.now() - e, s = Math.floor(l / 1e3), p = Math.floor(s / 60), m = Math.floor(p / 60), L = Math.floor(m / 24);
|
|
271
|
+
return L > 0 ? `${L}d ago` : m > 0 ? `${m}h ago` : p > 0 ? `${p}m ago` : "just now";
|
|
272
|
+
}
|
|
273
|
+
function re(e) {
|
|
274
|
+
var l;
|
|
275
|
+
const t = e.target;
|
|
276
|
+
(l = K.value) != null && l.contains(t) || (q.value = !1, k.value = !1);
|
|
277
|
+
}
|
|
278
|
+
return ve({
|
|
279
|
+
focus: Ie,
|
|
280
|
+
blur: Me,
|
|
281
|
+
validate: ge,
|
|
282
|
+
insertText: Qe,
|
|
283
|
+
insertSnippet: He,
|
|
284
|
+
getTokenAtPosition: ke,
|
|
285
|
+
getCursorPosition: ne,
|
|
286
|
+
setCursorPosition: ue
|
|
287
|
+
}), Le(() => {
|
|
288
|
+
document.addEventListener("selectionchange", F), document.addEventListener("click", re);
|
|
289
|
+
}), Oe(() => {
|
|
290
|
+
document.removeEventListener("selectionchange", F), document.removeEventListener("click", re);
|
|
291
|
+
}), (e, t) => (o(), i("div", {
|
|
222
292
|
ref_key: "wrapperRef",
|
|
223
|
-
ref:
|
|
224
|
-
class:
|
|
293
|
+
ref: K,
|
|
294
|
+
class: w([
|
|
225
295
|
"tql-input-wrapper",
|
|
226
296
|
{
|
|
227
|
-
"tql-input-focused":
|
|
228
|
-
"tql-input-invalid":
|
|
297
|
+
"tql-input-focused": S.value,
|
|
298
|
+
"tql-input-invalid": c(T) && a.showValidation,
|
|
229
299
|
"tql-input-disabled": a.disabled,
|
|
230
|
-
"tql-input-multiline": a.multiline
|
|
300
|
+
"tql-input-multiline": a.multiline,
|
|
301
|
+
"tql-input-autocomplete-active": c(x)
|
|
231
302
|
}
|
|
232
303
|
])
|
|
233
304
|
}, [
|
|
234
|
-
a.syntaxHighlighting ? (
|
|
235
|
-
(
|
|
236
|
-
key:
|
|
237
|
-
class:
|
|
238
|
-
},
|
|
239
|
-
])) :
|
|
240
|
-
a.multiline ?
|
|
305
|
+
a.syntaxHighlighting ? (o(), i("div", Je, [
|
|
306
|
+
(o(!0), i(B, null, M(c(me), (l, s) => (o(), i("span", {
|
|
307
|
+
key: s,
|
|
308
|
+
class: w($e(l))
|
|
309
|
+
}, h(l.raw || l.value), 3))), 128))
|
|
310
|
+
])) : v("", !0),
|
|
311
|
+
a.multiline ? W((o(), i("textarea", {
|
|
241
312
|
key: 1,
|
|
313
|
+
id: Y,
|
|
242
314
|
ref_key: "inputRef",
|
|
243
|
-
ref:
|
|
244
|
-
"onUpdate:modelValue": t[0] || (t[0] = (l) =>
|
|
245
|
-
class:
|
|
315
|
+
ref: u,
|
|
316
|
+
"onUpdate:modelValue": t[0] || (t[0] = (l) => n.value = l),
|
|
317
|
+
class: w(["tql-input", { "tql-input-highlighted": a.syntaxHighlighting }]),
|
|
246
318
|
placeholder: a.placeholder,
|
|
247
319
|
disabled: a.disabled,
|
|
248
320
|
readonly: a.readonly,
|
|
249
321
|
rows: a.rows,
|
|
322
|
+
role: "combobox",
|
|
323
|
+
"aria-expanded": c(x) && S.value,
|
|
324
|
+
"aria-controls": N,
|
|
325
|
+
"aria-invalid": c(T) && a.showValidation,
|
|
326
|
+
"aria-describedby": c(T) && f.value ? U : void 0,
|
|
327
|
+
"aria-autocomplete": "list",
|
|
328
|
+
"aria-haspopup": "listbox",
|
|
250
329
|
spellcheck: "false",
|
|
251
330
|
autocomplete: "off",
|
|
252
331
|
autocapitalize: "off",
|
|
253
|
-
onInput:
|
|
254
|
-
onKeydown:
|
|
255
|
-
onFocus:
|
|
256
|
-
onBlur:
|
|
257
|
-
onClick:
|
|
258
|
-
}, null, 42,
|
|
259
|
-
[
|
|
260
|
-
]) :
|
|
332
|
+
onInput: oe,
|
|
333
|
+
onKeydown: ie,
|
|
334
|
+
onFocus: ae,
|
|
335
|
+
onBlur: se,
|
|
336
|
+
onClick: F
|
|
337
|
+
}, null, 42, We)), [
|
|
338
|
+
[X, n.value]
|
|
339
|
+
]) : W((o(), i("input", {
|
|
261
340
|
key: 2,
|
|
341
|
+
id: Y,
|
|
262
342
|
ref_key: "inputRef",
|
|
263
|
-
ref:
|
|
264
|
-
"onUpdate:modelValue": t[1] || (t[1] = (l) =>
|
|
343
|
+
ref: u,
|
|
344
|
+
"onUpdate:modelValue": t[1] || (t[1] = (l) => n.value = l),
|
|
265
345
|
type: "text",
|
|
266
|
-
class:
|
|
346
|
+
class: w(["tql-input", { "tql-input-highlighted": a.syntaxHighlighting }]),
|
|
267
347
|
placeholder: a.placeholder,
|
|
268
348
|
disabled: a.disabled,
|
|
269
349
|
readonly: a.readonly,
|
|
350
|
+
role: "combobox",
|
|
351
|
+
"aria-expanded": c(x) && S.value,
|
|
352
|
+
"aria-controls": N,
|
|
353
|
+
"aria-invalid": c(T) && a.showValidation,
|
|
354
|
+
"aria-describedby": c(T) && f.value ? U : void 0,
|
|
355
|
+
"aria-autocomplete": "list",
|
|
356
|
+
"aria-haspopup": "listbox",
|
|
270
357
|
spellcheck: "false",
|
|
271
358
|
autocomplete: "off",
|
|
272
359
|
autocapitalize: "off",
|
|
273
|
-
onInput:
|
|
274
|
-
onKeydown:
|
|
275
|
-
onFocus:
|
|
276
|
-
onBlur:
|
|
277
|
-
onClick:
|
|
278
|
-
}, null, 42,
|
|
279
|
-
[
|
|
360
|
+
onInput: oe,
|
|
361
|
+
onKeydown: ie,
|
|
362
|
+
onFocus: ae,
|
|
363
|
+
onBlur: se,
|
|
364
|
+
onClick: F
|
|
365
|
+
}, null, 42, Xe)), [
|
|
366
|
+
[X, n.value]
|
|
280
367
|
]),
|
|
281
|
-
|
|
282
|
-
|
|
368
|
+
r("div", Ye, [
|
|
369
|
+
a.showComplexity && y.value && n.value.trim() ? (o(), i("div", {
|
|
370
|
+
key: 0,
|
|
371
|
+
class: w(["tql-complexity-badge", xe.value]),
|
|
372
|
+
title: `${ee.value} complexity - ${y.value.warnings.length} warning(s)`
|
|
373
|
+
}, [
|
|
374
|
+
r("span", _e, h(ee.value), 1),
|
|
375
|
+
y.value.warnings.length > 0 ? (o(), i("span", et, h(y.value.warnings.length), 1)) : v("", !0)
|
|
376
|
+
], 10, Ze)) : v("", !0),
|
|
377
|
+
a.showHistory ? (o(), i("button", {
|
|
283
378
|
key: 1,
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
379
|
+
type: "button",
|
|
380
|
+
class: w(["tql-toolbar-button", { "tql-toolbar-button--active": q.value }]),
|
|
381
|
+
title: "Query history",
|
|
382
|
+
onClick: D(Ve, ["stop"])
|
|
383
|
+
}, [...t[10] || (t[10] = [
|
|
384
|
+
r("i", { class: "pi pi-history" }, null, -1)
|
|
385
|
+
])], 2)) : v("", !0),
|
|
386
|
+
a.showPreview ? (o(), i("button", {
|
|
387
|
+
key: 2,
|
|
388
|
+
type: "button",
|
|
389
|
+
class: w(["tql-toolbar-button", { "tql-toolbar-button--active": k.value }]),
|
|
390
|
+
title: "Preview query structure",
|
|
391
|
+
onClick: D(Pe, ["stop"])
|
|
392
|
+
}, [...t[11] || (t[11] = [
|
|
393
|
+
r("i", { class: "pi pi-sitemap" }, null, -1)
|
|
394
|
+
])], 2)) : v("", !0),
|
|
395
|
+
a.showSnippetButton && a.snippets && a.snippets.length > 0 ? (o(), i("button", {
|
|
396
|
+
key: 3,
|
|
397
|
+
type: "button",
|
|
398
|
+
class: "tql-toolbar-button tql-snippet-button",
|
|
399
|
+
title: "Insert snippet",
|
|
400
|
+
onClick: t[2] || (t[2] = D(() => {
|
|
401
|
+
}, ["stop"]))
|
|
402
|
+
}, [...t[12] || (t[12] = [
|
|
403
|
+
r("i", { class: "pi pi-code" }, null, -1)
|
|
404
|
+
])])) : v("", !0),
|
|
405
|
+
a.showValidation && n.value ? (o(), i("div", tt, [
|
|
406
|
+
c(Z) ? (o(), i("i", lt)) : (o(), i("i", {
|
|
407
|
+
key: 1,
|
|
408
|
+
class: "pi pi-exclamation-circle tql-icon-invalid tql-icon-clickable",
|
|
409
|
+
role: "button",
|
|
410
|
+
tabindex: "0",
|
|
411
|
+
title: "Click to show/hide errors",
|
|
412
|
+
"aria-label": `Query has ${c($).length} error${c($).length === 1 ? "" : "s"}. Click to ${f.value ? "hide" : "show"} details.`,
|
|
413
|
+
"aria-expanded": f.value,
|
|
414
|
+
onClick: t[3] || (t[3] = (l) => f.value = !f.value),
|
|
415
|
+
onKeydown: [
|
|
416
|
+
t[4] || (t[4] = ce((l) => f.value = !f.value, ["enter"])),
|
|
417
|
+
t[5] || (t[5] = ce(D((l) => f.value = !f.value, ["prevent"]), ["space"]))
|
|
418
|
+
]
|
|
419
|
+
}, null, 40, ot))
|
|
420
|
+
])) : v("", !0)
|
|
421
|
+
]),
|
|
422
|
+
a.showHistory && q.value ? (o(), i("div", {
|
|
423
|
+
key: 3,
|
|
424
|
+
class: "tql-history-dropdown",
|
|
425
|
+
onClick: t[8] || (t[8] = D(() => {
|
|
298
426
|
}, ["stop"]))
|
|
299
|
-
}, [
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
427
|
+
}, [
|
|
428
|
+
r("div", it, [
|
|
429
|
+
W(r("input", {
|
|
430
|
+
"onUpdate:modelValue": t[6] || (t[6] = (l) => P.value = l),
|
|
431
|
+
type: "text",
|
|
432
|
+
class: "tql-history-search",
|
|
433
|
+
placeholder: "Search history...",
|
|
434
|
+
onKeydown: t[7] || (t[7] = D(() => {
|
|
435
|
+
}, ["stop"]))
|
|
436
|
+
}, null, 544), [
|
|
437
|
+
[X, P.value]
|
|
438
|
+
])
|
|
439
|
+
]),
|
|
440
|
+
r("div", at, [
|
|
441
|
+
(o(!0), i(B, null, M(te.value, (l) => (o(), i("div", {
|
|
442
|
+
key: l.id,
|
|
443
|
+
class: w(["tql-history-item", { "tql-history-item--favorite": l.isFavorite }]),
|
|
444
|
+
onClick: (s) => Ce(l)
|
|
445
|
+
}, [
|
|
446
|
+
r("button", {
|
|
447
|
+
type: "button",
|
|
448
|
+
class: "tql-history-favorite",
|
|
449
|
+
title: l.isFavorite ? "Remove from favorites" : "Add to favorites",
|
|
450
|
+
onClick: (s) => Se(l, s)
|
|
451
|
+
}, [
|
|
452
|
+
r("i", {
|
|
453
|
+
class: w(l.isFavorite ? "pi pi-star-fill" : "pi pi-star")
|
|
454
|
+
}, null, 2)
|
|
455
|
+
], 8, nt),
|
|
456
|
+
r("div", ut, [
|
|
457
|
+
l.label ? (o(), i("div", rt, h(l.label), 1)) : v("", !0),
|
|
458
|
+
r("div", ct, h(l.query), 1)
|
|
459
|
+
]),
|
|
460
|
+
r("div", dt, h(Ke(l.timestamp)), 1)
|
|
461
|
+
], 10, st))), 128)),
|
|
462
|
+
te.value.length === 0 ? (o(), i("div", vt, h(P.value ? "No matching queries" : "No query history"), 1)) : v("", !0)
|
|
463
|
+
])
|
|
464
|
+
])) : v("", !0),
|
|
465
|
+
de(Ne, {
|
|
466
|
+
id: N,
|
|
303
467
|
ref_key: "autocompleteRef",
|
|
304
|
-
ref:
|
|
305
|
-
items:
|
|
306
|
-
visible:
|
|
307
|
-
position:
|
|
308
|
-
onSelect:
|
|
309
|
-
onClose:
|
|
468
|
+
ref: E,
|
|
469
|
+
items: c(j),
|
|
470
|
+
visible: c(x),
|
|
471
|
+
position: Re.value,
|
|
472
|
+
onSelect: Ee,
|
|
473
|
+
onClose: c(A)
|
|
310
474
|
}, null, 8, ["items", "visible", "position", "onClose"]),
|
|
311
|
-
a.showValidation &&
|
|
312
|
-
|
|
313
|
-
|
|
475
|
+
a.showValidation && c(T) && f.value && n.value && !c(x) ? (o(), i("div", {
|
|
476
|
+
key: 4,
|
|
477
|
+
id: U,
|
|
478
|
+
class: "tql-validation-messages",
|
|
479
|
+
role: "alert",
|
|
480
|
+
"aria-live": "polite"
|
|
481
|
+
}, [
|
|
482
|
+
(o(!0), i(B, null, M(c($).slice(0, 3), (l, s) => (o(), i("div", {
|
|
483
|
+
key: s,
|
|
314
484
|
class: "tql-error-message"
|
|
315
485
|
}, [
|
|
316
|
-
t[
|
|
317
|
-
|
|
318
|
-
|
|
486
|
+
t[13] || (t[13] = r("i", {
|
|
487
|
+
class: "pi pi-exclamation-triangle",
|
|
488
|
+
"aria-hidden": "true"
|
|
489
|
+
}, null, -1)),
|
|
490
|
+
r("span", null, h(l.message), 1),
|
|
491
|
+
l.suggestion ? (o(), i("span", pt, h(l.suggestion), 1)) : v("", !0)
|
|
319
492
|
]))), 128))
|
|
320
|
-
])) :
|
|
493
|
+
])) : v("", !0),
|
|
494
|
+
a.showComplexity && y.value && y.value.warnings.length > 0 && !c(x) ? (o(), i("div", ft, [
|
|
495
|
+
(o(!0), i(B, null, M(y.value.warnings.slice(0, 3), (l, s) => (o(), i("div", {
|
|
496
|
+
key: s,
|
|
497
|
+
class: w(["tql-complexity-warning", `tql-complexity-warning--${l.severity}`])
|
|
498
|
+
}, [
|
|
499
|
+
t[14] || (t[14] = r("i", {
|
|
500
|
+
class: "pi pi-info-circle",
|
|
501
|
+
"aria-hidden": "true"
|
|
502
|
+
}, null, -1)),
|
|
503
|
+
r("span", null, h(l.message), 1)
|
|
504
|
+
], 2))), 128)),
|
|
505
|
+
y.value.suggestions.length > 0 ? (o(), i("div", yt, [
|
|
506
|
+
(o(!0), i(B, null, M(y.value.suggestions.slice(0, 2), (l, s) => (o(), i("div", {
|
|
507
|
+
key: s,
|
|
508
|
+
class: "tql-complexity-suggestion"
|
|
509
|
+
}, [
|
|
510
|
+
t[15] || (t[15] = r("i", {
|
|
511
|
+
class: "pi pi-lightbulb",
|
|
512
|
+
"aria-hidden": "true"
|
|
513
|
+
}, null, -1)),
|
|
514
|
+
r("span", null, h(l), 1)
|
|
515
|
+
]))), 128))
|
|
516
|
+
])) : v("", !0)
|
|
517
|
+
])) : v("", !0),
|
|
518
|
+
a.showPreview && k.value && n.value.trim() ? (o(), i("div", ht, [
|
|
519
|
+
r("div", mt, [
|
|
520
|
+
t[17] || (t[17] = r("span", null, "Query Structure", -1)),
|
|
521
|
+
r("button", {
|
|
522
|
+
type: "button",
|
|
523
|
+
class: "tql-preview-close",
|
|
524
|
+
title: "Close preview",
|
|
525
|
+
onClick: t[9] || (t[9] = (l) => k.value = !1)
|
|
526
|
+
}, [...t[16] || (t[16] = [
|
|
527
|
+
r("i", { class: "pi pi-times" }, null, -1)
|
|
528
|
+
])])
|
|
529
|
+
]),
|
|
530
|
+
de(Ue, {
|
|
531
|
+
query: n.value,
|
|
532
|
+
"show-complexity": !1,
|
|
533
|
+
"show-field-usage": !0,
|
|
534
|
+
"show-logic-tree": !0,
|
|
535
|
+
compact: ""
|
|
536
|
+
}, null, 8, ["query"])
|
|
537
|
+
])) : v("", !0),
|
|
538
|
+
r("div", gt, [
|
|
539
|
+
a.showValidation && n.value ? (o(), i(B, { key: 0 }, [
|
|
540
|
+
c(Z) ? (o(), i("span", wt, "Query syntax is valid")) : (o(), i("span", bt, "Query has " + h(c($).length) + " validation error" + h(c($).length === 1 ? "" : "s"), 1))
|
|
541
|
+
], 64)) : v("", !0)
|
|
542
|
+
])
|
|
321
543
|
], 2));
|
|
322
544
|
}
|
|
323
545
|
});
|
|
324
546
|
export {
|
|
325
|
-
|
|
547
|
+
Pt as default
|
|
326
548
|
};
|