@tellaro/tql 0.1.5 → 0.1.6
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/vue/useTqlInput.js +39 -39
- package/package.json +1 -1
package/dist/vue/useTqlInput.js
CHANGED
|
@@ -11,15 +11,15 @@ function Te(V) {
|
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12
12
|
snippets: pe,
|
|
13
13
|
// Reserved for future snippet support
|
|
14
|
-
fieldValues:
|
|
14
|
+
fieldValues: w,
|
|
15
15
|
validateOnInput: j = !0,
|
|
16
16
|
debounceMs: Q = 300,
|
|
17
17
|
completionDebounceMs: _ = 50,
|
|
18
18
|
// Faster debounce for completions
|
|
19
|
-
autocomplete:
|
|
20
|
-
onValidation:
|
|
21
|
-
onParse:
|
|
22
|
-
} = V, f = v([]), q = v(null), g = v(null), c = v(0), d = v([]), p = v(!1),
|
|
19
|
+
autocomplete: C = !0,
|
|
20
|
+
onValidation: x,
|
|
21
|
+
onParse: y
|
|
22
|
+
} = V, f = v([]), q = v(null), g = v(null), c = v(0), d = v([]), p = v(!1), A = v(!1);
|
|
23
23
|
let P = 0;
|
|
24
24
|
const $ = T(() => {
|
|
25
25
|
var e;
|
|
@@ -36,12 +36,12 @@ function Te(V) {
|
|
|
36
36
|
}
|
|
37
37
|
function H() {
|
|
38
38
|
const e = ae(i.value);
|
|
39
|
-
return q.value = e,
|
|
39
|
+
return q.value = e, y == null || y(e), e;
|
|
40
40
|
}
|
|
41
41
|
function E() {
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
const e = (
|
|
42
|
+
var o, r;
|
|
43
|
+
A.value = !0;
|
|
44
|
+
const e = (o = u == null ? void 0 : u.value) == null ? void 0 : o.map((l) => l.name), t = (r = u == null ? void 0 : u.value) == null ? void 0 : r.reduce(
|
|
45
45
|
(l, m) => (l[m.name] = m.type, l),
|
|
46
46
|
{}
|
|
47
47
|
), n = ce(i.value, {
|
|
@@ -49,11 +49,11 @@ function Te(V) {
|
|
|
49
49
|
fieldTypes: t,
|
|
50
50
|
strictMode: !1
|
|
51
51
|
});
|
|
52
|
-
return g.value = n,
|
|
52
|
+
return g.value = n, A.value = !1, x == null || x(n), n;
|
|
53
53
|
}
|
|
54
54
|
const J = R(E, Q), K = R(I, _);
|
|
55
55
|
function I() {
|
|
56
|
-
if (!
|
|
56
|
+
if (!C) {
|
|
57
57
|
d.value = [], p.value = !1;
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
@@ -68,7 +68,7 @@ function Te(V) {
|
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
70
|
fields: u == null ? void 0 : u.value,
|
|
71
|
-
fieldValues:
|
|
71
|
+
fieldValues: w == null ? void 0 : w.value,
|
|
72
72
|
includeSnippets: !0,
|
|
73
73
|
maxItems: 15
|
|
74
74
|
}
|
|
@@ -78,50 +78,50 @@ function Te(V) {
|
|
|
78
78
|
function L() {
|
|
79
79
|
I(), p.value = d.value.length > 0;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function O() {
|
|
82
82
|
p.value = !1;
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
M(), j && J(),
|
|
84
|
+
function W(e) {
|
|
85
|
+
M(), j && J(), C && le(e, c.value) && (K(), d.value.length > 0 && (p.value = !0));
|
|
86
86
|
}
|
|
87
87
|
function N(e) {
|
|
88
88
|
c.value = e, I();
|
|
89
89
|
}
|
|
90
90
|
function X(e) {
|
|
91
|
-
const t = i.value, n = c.value,
|
|
91
|
+
const t = i.value, n = c.value, o = U(f.value, n);
|
|
92
92
|
let r = n, l = n;
|
|
93
|
-
if (
|
|
94
|
-
r =
|
|
93
|
+
if (o && o.type !== "whitespace")
|
|
94
|
+
r = o.start, l = o.end;
|
|
95
95
|
else {
|
|
96
|
-
const a = f.value.filter((
|
|
96
|
+
const a = f.value.filter((s) => s.end <= n && s.type !== "whitespace");
|
|
97
97
|
if (a.length > 0) {
|
|
98
|
-
const
|
|
99
|
-
|
|
98
|
+
const s = a[a.length - 1];
|
|
99
|
+
s.end === n && (r = s.start, l = s.end);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
const m = t.substring(0, r), te = t.substring(l),
|
|
102
|
+
const m = t.substring(0, r), te = t.substring(l), k = [];
|
|
103
103
|
let h = e.insertText;
|
|
104
104
|
const ne = [...e.insertText.matchAll(/\$(\d+)/g)].sort(
|
|
105
|
-
(a,
|
|
105
|
+
(a, s) => parseInt(a[1]) - parseInt(s[1])
|
|
106
106
|
);
|
|
107
|
-
let
|
|
107
|
+
let z = 0;
|
|
108
108
|
for (const a of ne) {
|
|
109
|
-
const
|
|
110
|
-
if (
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
start:
|
|
114
|
-
end:
|
|
109
|
+
const s = h.indexOf(a[0]);
|
|
110
|
+
if (s !== -1) {
|
|
111
|
+
const F = r + s - z;
|
|
112
|
+
k.push({
|
|
113
|
+
start: F,
|
|
114
|
+
end: F
|
|
115
115
|
// Zero-width cursor position
|
|
116
|
-
}), h = h.replace(a[0], ""),
|
|
116
|
+
}), h = h.replace(a[0], ""), z += a[0].length;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
const
|
|
120
|
-
return
|
|
119
|
+
const oe = m + h + te, se = k.length > 0 ? k[0].start : r + h.length;
|
|
120
|
+
return O(), e.kind === "logicalOp" && (P = Date.now() + 150), { query: oe, newCursorPosition: se, placeholders: k };
|
|
121
121
|
}
|
|
122
122
|
function Y(e) {
|
|
123
|
-
const t = i.value, n = c.value,
|
|
124
|
-
return
|
|
123
|
+
const t = i.value, n = c.value, o = t.substring(0, n), r = t.substring(n), m = o.length > 0 && !o.endsWith(" ") && !o.endsWith("(") ? " " : "";
|
|
124
|
+
return o + m + e.insertText + r;
|
|
125
125
|
}
|
|
126
126
|
function Z() {
|
|
127
127
|
return U(f.value, c.value);
|
|
@@ -135,7 +135,7 @@ function Te(V) {
|
|
|
135
135
|
return re(
|
|
136
136
|
i,
|
|
137
137
|
(e) => {
|
|
138
|
-
e !== void 0 &&
|
|
138
|
+
e !== void 0 && W(e);
|
|
139
139
|
},
|
|
140
140
|
{ immediate: !0 }
|
|
141
141
|
), {
|
|
@@ -146,7 +146,7 @@ function Te(V) {
|
|
|
146
146
|
cursorPosition: c,
|
|
147
147
|
completionItems: d,
|
|
148
148
|
showAutocomplete: p,
|
|
149
|
-
isValidating:
|
|
149
|
+
isValidating: A,
|
|
150
150
|
// Computed
|
|
151
151
|
isValid: $,
|
|
152
152
|
errors: b,
|
|
@@ -159,8 +159,8 @@ function Te(V) {
|
|
|
159
159
|
validate: E,
|
|
160
160
|
updateCompletions: I,
|
|
161
161
|
triggerAutocomplete: L,
|
|
162
|
-
hideAutocomplete:
|
|
163
|
-
handleInput:
|
|
162
|
+
hideAutocomplete: O,
|
|
163
|
+
handleInput: W,
|
|
164
164
|
handleCursorChange: N,
|
|
165
165
|
insertCompletion: X,
|
|
166
166
|
insertSnippet: Y,
|