@hankchen/canvas-editor-vue 0.6.1 → 0.8.0
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/{useDataSourceSchema-CG9EGzwc.js → DropdownMenu-CeUNKMDQ.js} +70 -84
- package/dist/ExpressionPathPicker-DchGsK70.js +739 -0
- package/dist/{canvas-CptBzpwT.js → canvas-DuvO27sj.js} +506 -485
- package/dist/canvas.js +1 -1
- package/dist/index.js +14 -15
- package/dist/layer-panel/TemplateTableForm.d.ts +1 -27
- package/dist/{layer-panel-Cz-tmbJJ.js → layer-panel-BouAYiDq.js} +231 -257
- package/dist/layer-panel.js +1 -1
- package/dist/property-panel/PropertyField.d.ts +9 -2
- package/dist/property-panel/fieldSchema.d.ts +28 -10
- package/dist/property-panel/fields/RowsPathField.d.ts +17 -0
- package/dist/property-panel/fields/index.d.ts +1 -0
- package/dist/property-panel/fields/intrinsicSize.d.ts +9 -0
- package/dist/property-panel/usePropertyPanel.d.ts +11 -2
- package/dist/{property-panel-OBqd6D8W.js → property-panel-BkfqRva4.js} +371 -271
- package/dist/property-panel.js +2 -2
- package/dist/resourceTemplate-D-DKEo7Z.js +33 -0
- package/dist/shared/ExpressionPathPicker.d.ts +9 -2
- package/dist/shared/index.d.ts +13 -10
- package/dist/shared/pathPickerModel.d.ts +16 -3
- package/dist/shared/popupPosition.d.ts +2 -2
- package/dist/shared/rowsPathPickerSource.d.ts +15 -0
- package/dist/shared/useDataSourceSchema.d.ts +6 -0
- package/dist/{shared-wuupBoZg.js → shared-CRDKDSpa.js} +22 -22
- package/dist/shared.js +9 -10
- package/dist/{status-bar-DCuK2R88.js → status-bar-DBf5kIXY.js} +6 -6
- package/dist/status-bar.js +1 -1
- package/dist/style.css +1 -1
- package/dist/uploadFile-mXJVPEzm.js +653 -0
- package/dist/{useTransientFeedback-CTjmMmFF.js → useTransientFeedback-BN_O7V2w.js} +43 -28
- package/package.json +2 -2
- package/dist/popupPosition-Ck5Gsvjy.js +0 -526
- package/dist/resourceTemplate-cdcQtp9a.js +0 -246
- package/dist/shared/rowsPathCompletionSource.d.ts +0 -3
- package/dist/shared/usePathCompletion.d.ts +0 -18
- package/dist/uploadFile-DbB-KhII.js +0 -520
- package/dist/usePathCompletion-Do17CQ6l.js +0 -220
|
@@ -0,0 +1,739 @@
|
|
|
1
|
+
import { a as e } from "./layerPath-uy2ywyld.js";
|
|
2
|
+
import { Fragment as t, Teleport as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, defineComponent as c, mergeProps as l, nextTick as u, normalizeClass as d, normalizeStyle as f, onScopeDispose as ee, openBlock as p, ref as m, renderList as te, resolveDynamicComponent as h, toDisplayString as g, unref as _, watch as ne, withModifiers as v } from "vue";
|
|
3
|
+
//#region ../canvas-editor/src/shared/expressionSchema.ts
|
|
4
|
+
function y(e) {
|
|
5
|
+
let t = e;
|
|
6
|
+
for (; t !== void 0;) {
|
|
7
|
+
if (t.properties !== void 0) return t.properties;
|
|
8
|
+
t = t.items;
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
function b(e, t) {
|
|
13
|
+
let n = e;
|
|
14
|
+
for (let e of t) {
|
|
15
|
+
let t = y(n)?.get(e);
|
|
16
|
+
if (t === void 0) return null;
|
|
17
|
+
n = t;
|
|
18
|
+
}
|
|
19
|
+
return n;
|
|
20
|
+
}
|
|
21
|
+
function x(e) {
|
|
22
|
+
return e.type === "array" || e.items !== void 0 ? { entries: [] } : { entries: e.properties === void 0 ? [] : [...e.properties].map(([e, t]) => ({
|
|
23
|
+
key: e,
|
|
24
|
+
node: t
|
|
25
|
+
})) };
|
|
26
|
+
}
|
|
27
|
+
function S(e, t) {
|
|
28
|
+
let n = t.split(".");
|
|
29
|
+
return t === "" || n.includes("") ? null : b(e, n)?.items ?? null;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region ../canvas-editor/src/shared/expressionPath.ts
|
|
33
|
+
function C(e) {
|
|
34
|
+
if (e === "") return {
|
|
35
|
+
ok: !1,
|
|
36
|
+
error: "expression_syntax_error"
|
|
37
|
+
};
|
|
38
|
+
let t = e.split(".");
|
|
39
|
+
if (t.includes("")) return {
|
|
40
|
+
ok: !1,
|
|
41
|
+
error: "expression_syntax_error"
|
|
42
|
+
};
|
|
43
|
+
let n = t[0], r = t.slice(1);
|
|
44
|
+
return n === "row" ? {
|
|
45
|
+
ok: !0,
|
|
46
|
+
head: { kind: "row" },
|
|
47
|
+
rest: r
|
|
48
|
+
} : n === "$root" ? {
|
|
49
|
+
ok: !0,
|
|
50
|
+
head: { kind: "root" },
|
|
51
|
+
rest: r
|
|
52
|
+
} : {
|
|
53
|
+
ok: !0,
|
|
54
|
+
head: {
|
|
55
|
+
kind: "bare",
|
|
56
|
+
name: n
|
|
57
|
+
},
|
|
58
|
+
rest: r
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region ../canvas-editor/src/shared/expressionCall.ts
|
|
63
|
+
var w = " \n\r\0\v", T = " \n\r", E = `()',.${w}`;
|
|
64
|
+
function D(e) {
|
|
65
|
+
let t = 0, n = e.length;
|
|
66
|
+
for (; t < n && w.includes(e[t]);) t += 1;
|
|
67
|
+
for (; n > t && w.includes(e[n - 1]);) --n;
|
|
68
|
+
return e.slice(t, n);
|
|
69
|
+
}
|
|
70
|
+
function O(e, t) {
|
|
71
|
+
for (; t < e.length && T.includes(e[t]);) t += 1;
|
|
72
|
+
return t;
|
|
73
|
+
}
|
|
74
|
+
function k(e, t, n) {
|
|
75
|
+
return {
|
|
76
|
+
ok: !1,
|
|
77
|
+
error: "expression_syntax_error",
|
|
78
|
+
kind: e,
|
|
79
|
+
at: {
|
|
80
|
+
start: t,
|
|
81
|
+
end: n
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function A(e) {
|
|
86
|
+
let t = 0;
|
|
87
|
+
for (; t < e.length && !E.includes(e[t]);) t += 1;
|
|
88
|
+
if (t === 0) return !1;
|
|
89
|
+
let n = t;
|
|
90
|
+
for (; n < e.length && w.includes(e[n]);) n += 1;
|
|
91
|
+
return e[n] === "(";
|
|
92
|
+
}
|
|
93
|
+
function j(e) {
|
|
94
|
+
let t = 0;
|
|
95
|
+
for (; t < e.length && !E.includes(e[t]);) t += 1;
|
|
96
|
+
if (t === 0) return k("invalid_path", 0, e.length);
|
|
97
|
+
let n = e.slice(0, t), r = O(e, t);
|
|
98
|
+
if (r >= e.length || e[r] !== "(") return k("missing_open_paren", t, e.length);
|
|
99
|
+
let i = r;
|
|
100
|
+
r = O(e, r + 1);
|
|
101
|
+
let a = [], o = [];
|
|
102
|
+
if (r < e.length && e[r] === ")") r += 1;
|
|
103
|
+
else for (;;) {
|
|
104
|
+
if (r >= e.length) return k("unbalanced_paren", i, e.length);
|
|
105
|
+
let t = M(e, r);
|
|
106
|
+
if (!t.ok) return t;
|
|
107
|
+
if (a.push(t.value), o.push({
|
|
108
|
+
start: t.start,
|
|
109
|
+
end: t.end
|
|
110
|
+
}), r = O(e, t.end), r >= e.length) return k("unbalanced_paren", i, e.length);
|
|
111
|
+
if (e[r] === ",") {
|
|
112
|
+
let t = r;
|
|
113
|
+
if (r = O(e, r + 1), r < e.length && e[r] === ")") return k("empty_arg_slot", t + 1, r);
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (e[r] === ")") {
|
|
117
|
+
r += 1;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
return k("bad_arg_syntax", r, r + 1);
|
|
121
|
+
}
|
|
122
|
+
if (r = O(e, r), r !== e.length) return k("trailing_after_call", r, e.length);
|
|
123
|
+
if (a[0] !== void 0 && a[0].type !== "path") {
|
|
124
|
+
let e = o[0];
|
|
125
|
+
return k("first_arg_not_path", e.start, e.end);
|
|
126
|
+
}
|
|
127
|
+
for (let e = 0; e < a.length; e += 1) {
|
|
128
|
+
let t = a[e], n = o[e];
|
|
129
|
+
if (t.type === "path" && !C(t.value).ok) return k("invalid_path_arg", n.start, n.end);
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
ok: !0,
|
|
133
|
+
name: n,
|
|
134
|
+
args: a
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function M(e, t) {
|
|
138
|
+
let n = e.length, r = t, i = e[t];
|
|
139
|
+
if (i === "'") {
|
|
140
|
+
let i = t + 1, a = "";
|
|
141
|
+
for (;;) {
|
|
142
|
+
if (i >= n) return {
|
|
143
|
+
ok: !1,
|
|
144
|
+
error: "expression_syntax_error",
|
|
145
|
+
kind: "unterminated_string",
|
|
146
|
+
at: {
|
|
147
|
+
start: r,
|
|
148
|
+
end: n
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
if (e[i] === "'") {
|
|
152
|
+
if (i + 1 < n && e[i + 1] === "'") {
|
|
153
|
+
a += "'", i += 2;
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
i += 1;
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
a += e[i], i += 1;
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
ok: !0,
|
|
163
|
+
value: {
|
|
164
|
+
type: "string",
|
|
165
|
+
value: a
|
|
166
|
+
},
|
|
167
|
+
start: r,
|
|
168
|
+
end: i
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
if (i >= "0" && i <= "9") {
|
|
172
|
+
let i = (t) => {
|
|
173
|
+
let n = e[t];
|
|
174
|
+
return n !== void 0 && n >= "0" && n <= "9";
|
|
175
|
+
};
|
|
176
|
+
for (; i(t);) t += 1;
|
|
177
|
+
if (t < n && e[t] === "." && i(t + 1)) for (t += 1; i(t);) t += 1;
|
|
178
|
+
return {
|
|
179
|
+
ok: !0,
|
|
180
|
+
value: {
|
|
181
|
+
type: "number",
|
|
182
|
+
value: e.slice(r, t)
|
|
183
|
+
},
|
|
184
|
+
start: r,
|
|
185
|
+
end: t
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
for (; t < n && e[t] !== "," && e[t] !== ")";) t += 1;
|
|
189
|
+
let a = D(e.slice(r, t));
|
|
190
|
+
return a === "" ? {
|
|
191
|
+
ok: !1,
|
|
192
|
+
error: "expression_syntax_error",
|
|
193
|
+
kind: "empty_arg_slot",
|
|
194
|
+
at: {
|
|
195
|
+
start: r,
|
|
196
|
+
end: t
|
|
197
|
+
}
|
|
198
|
+
} : {
|
|
199
|
+
ok: !0,
|
|
200
|
+
value: {
|
|
201
|
+
type: "path",
|
|
202
|
+
value: a
|
|
203
|
+
},
|
|
204
|
+
start: r,
|
|
205
|
+
end: t
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function N(e) {
|
|
209
|
+
let t = 0;
|
|
210
|
+
for (; t < e.length && !E.includes(e[t]);) t += 1;
|
|
211
|
+
if (t === 0) return null;
|
|
212
|
+
let n = O(e, t);
|
|
213
|
+
if (n >= e.length || e[n] !== "(") return null;
|
|
214
|
+
n = O(e, n + 1);
|
|
215
|
+
let r = 0;
|
|
216
|
+
for (;;) {
|
|
217
|
+
if (n >= e.length) return {
|
|
218
|
+
name: e.slice(0, t),
|
|
219
|
+
index: r,
|
|
220
|
+
text: "",
|
|
221
|
+
stringSlot: !1
|
|
222
|
+
};
|
|
223
|
+
let i = e[n];
|
|
224
|
+
if (i === "'") {
|
|
225
|
+
let i = n + 1;
|
|
226
|
+
for (;;) {
|
|
227
|
+
if (i >= e.length) return {
|
|
228
|
+
name: e.slice(0, t),
|
|
229
|
+
index: r,
|
|
230
|
+
text: e.slice(n + 1),
|
|
231
|
+
stringSlot: !0
|
|
232
|
+
};
|
|
233
|
+
if (e[i] === "'") {
|
|
234
|
+
if (i + 1 < e.length && e[i + 1] === "'") {
|
|
235
|
+
i += 2;
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
i += 1;
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
i += 1;
|
|
242
|
+
}
|
|
243
|
+
n = i;
|
|
244
|
+
} else if (i !== "," && i !== ")") {
|
|
245
|
+
let i = n;
|
|
246
|
+
for (; n < e.length && e[n] !== "," && e[n] !== ")";) n += 1;
|
|
247
|
+
if (n >= e.length) return {
|
|
248
|
+
name: e.slice(0, t),
|
|
249
|
+
index: r,
|
|
250
|
+
text: D(e.slice(i)),
|
|
251
|
+
stringSlot: !1
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
if (n >= e.length) return {
|
|
255
|
+
name: e.slice(0, t),
|
|
256
|
+
index: r + 1,
|
|
257
|
+
text: "",
|
|
258
|
+
stringSlot: !1
|
|
259
|
+
};
|
|
260
|
+
if (e[n] === ")") return null;
|
|
261
|
+
r += 1, n = O(e, n + 1);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region ../canvas-editor/src/shared/expressionScan.ts
|
|
266
|
+
var P = " \n\r\0\v";
|
|
267
|
+
function F(e) {
|
|
268
|
+
let t = 0, n = e.length;
|
|
269
|
+
for (; t < n && " \n\r\0\v".includes(e[t]);) t += 1;
|
|
270
|
+
for (; n > t && " \n\r\0\v".includes(e[n - 1]);) --n;
|
|
271
|
+
return e.slice(t, n);
|
|
272
|
+
}
|
|
273
|
+
function I(e) {
|
|
274
|
+
if (e === "") return {
|
|
275
|
+
kind: "empty_fragment",
|
|
276
|
+
at: {
|
|
277
|
+
start: 0,
|
|
278
|
+
end: 0
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
if (A(e)) {
|
|
282
|
+
let t = j(e);
|
|
283
|
+
return t.ok ? null : {
|
|
284
|
+
kind: t.kind,
|
|
285
|
+
at: t.at
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
return C(e).ok ? null : {
|
|
289
|
+
kind: "invalid_path",
|
|
290
|
+
at: {
|
|
291
|
+
start: 0,
|
|
292
|
+
end: e.length
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
function L(e) {
|
|
297
|
+
let t = 0;
|
|
298
|
+
for (; t < e.length && " \n\r\0\v".includes(e[t]);) t += 1;
|
|
299
|
+
return t;
|
|
300
|
+
}
|
|
301
|
+
function R(e) {
|
|
302
|
+
let t = [], n = 0, r = e.indexOf("{{");
|
|
303
|
+
for (; r !== -1;) {
|
|
304
|
+
let i = e.indexOf("}}", r + 2);
|
|
305
|
+
if (i === -1) {
|
|
306
|
+
r > n && t.push({
|
|
307
|
+
kind: "literal",
|
|
308
|
+
start: n,
|
|
309
|
+
end: r,
|
|
310
|
+
text: e.slice(n, r)
|
|
311
|
+
});
|
|
312
|
+
let i = e.slice(r);
|
|
313
|
+
return t.push({
|
|
314
|
+
kind: "open",
|
|
315
|
+
start: r,
|
|
316
|
+
end: e.length,
|
|
317
|
+
text: i,
|
|
318
|
+
expr: F(i.slice(2))
|
|
319
|
+
}), {
|
|
320
|
+
template: e,
|
|
321
|
+
parts: t
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
r > n && t.push({
|
|
325
|
+
kind: "literal",
|
|
326
|
+
start: n,
|
|
327
|
+
end: r,
|
|
328
|
+
text: e.slice(n, r)
|
|
329
|
+
});
|
|
330
|
+
let a = e.slice(r + 2, i), o = F(a), s = null, c = I(o);
|
|
331
|
+
if (c) {
|
|
332
|
+
let e = r + 2 + L(a);
|
|
333
|
+
s = {
|
|
334
|
+
kind: c.kind,
|
|
335
|
+
start: r,
|
|
336
|
+
end: i + 2,
|
|
337
|
+
at: {
|
|
338
|
+
start: e + c.at.start,
|
|
339
|
+
end: e + c.at.end
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
t.push({
|
|
344
|
+
kind: "fragment",
|
|
345
|
+
start: r,
|
|
346
|
+
end: i + 2,
|
|
347
|
+
raw: a,
|
|
348
|
+
expr: o,
|
|
349
|
+
error: s === null ? null : "expression_syntax_error",
|
|
350
|
+
diagnostic: s
|
|
351
|
+
}), n = i + 2, r = e.indexOf("{{", n);
|
|
352
|
+
}
|
|
353
|
+
return n < e.length && t.push({
|
|
354
|
+
kind: "literal",
|
|
355
|
+
start: n,
|
|
356
|
+
end: e.length,
|
|
357
|
+
text: e.slice(n)
|
|
358
|
+
}), {
|
|
359
|
+
template: e,
|
|
360
|
+
parts: t
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
function z(e, t) {
|
|
364
|
+
for (let n of e.parts) if (n.kind !== "literal" && (n.kind === "open" ? t > n.start && t <= n.end : t > n.start && t < n.end)) return n;
|
|
365
|
+
return null;
|
|
366
|
+
}
|
|
367
|
+
//#endregion
|
|
368
|
+
//#region ../canvas-editor/src/shared/rowsPathCandidates.ts
|
|
369
|
+
function B(e) {
|
|
370
|
+
return e.type === "array" || e.items !== void 0;
|
|
371
|
+
}
|
|
372
|
+
function V(e) {
|
|
373
|
+
return !B(e) && e.properties === void 0;
|
|
374
|
+
}
|
|
375
|
+
function H(e, t) {
|
|
376
|
+
return e === "" ? t : `${e}.${t}`;
|
|
377
|
+
}
|
|
378
|
+
function U(e, t) {
|
|
379
|
+
return t.description !== void 0 && (e.description = t.description), t.title !== void 0 && (e.title = t.title), e;
|
|
380
|
+
}
|
|
381
|
+
function W(e, t) {
|
|
382
|
+
let n = e;
|
|
383
|
+
for (let e of t) {
|
|
384
|
+
if (B(n)) return null;
|
|
385
|
+
let t = b(n, [e]);
|
|
386
|
+
if (t === null) return null;
|
|
387
|
+
n = t;
|
|
388
|
+
}
|
|
389
|
+
return B(n) || V(n) ? null : n;
|
|
390
|
+
}
|
|
391
|
+
function G(e, t, n) {
|
|
392
|
+
let r = U({
|
|
393
|
+
path: H(n, e),
|
|
394
|
+
segment: e
|
|
395
|
+
}, t);
|
|
396
|
+
return B(t) && (r.type = "array"), r;
|
|
397
|
+
}
|
|
398
|
+
function K(e, t) {
|
|
399
|
+
let n = [];
|
|
400
|
+
if (e.properties !== void 0) for (let [r, i] of e.properties) V(i) || n.push(G(r, i, t));
|
|
401
|
+
return n;
|
|
402
|
+
}
|
|
403
|
+
function q(e, t) {
|
|
404
|
+
if (e === null) return null;
|
|
405
|
+
let n = t.split("."), r = t.endsWith(".") ? "" : n[n.length - 1], i = n.slice(0, -1), a = W(e, i);
|
|
406
|
+
return a === null ? null : {
|
|
407
|
+
partial: r,
|
|
408
|
+
candidates: K(a, i.join("."))
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
function J(e) {
|
|
412
|
+
if (B(e)) return !0;
|
|
413
|
+
if (e.properties === void 0) return !1;
|
|
414
|
+
for (let t of e.properties.values()) if (J(t)) return !0;
|
|
415
|
+
return !1;
|
|
416
|
+
}
|
|
417
|
+
function Y(e, t, n) {
|
|
418
|
+
return U({
|
|
419
|
+
path: H(n, e),
|
|
420
|
+
segment: e,
|
|
421
|
+
isArray: B(t)
|
|
422
|
+
}, t);
|
|
423
|
+
}
|
|
424
|
+
function X(e, t) {
|
|
425
|
+
if (e === null) return [];
|
|
426
|
+
let n = t === "" ? [] : t.split(".");
|
|
427
|
+
if (n.includes("")) return [];
|
|
428
|
+
let r = W(e, n);
|
|
429
|
+
if (r === null) return [];
|
|
430
|
+
let i = [];
|
|
431
|
+
if (r.properties !== void 0) for (let [e, n] of r.properties) J(n) && i.push(Y(e, n, t));
|
|
432
|
+
return i;
|
|
433
|
+
}
|
|
434
|
+
function re(t, n, r) {
|
|
435
|
+
if (r === null) return null;
|
|
436
|
+
if (t === null || n === null) return r;
|
|
437
|
+
let i = null;
|
|
438
|
+
for (let a = 0; a < n.length; a += 1) {
|
|
439
|
+
if (n[a] !== "template") continue;
|
|
440
|
+
let o = e(t, n.slice(0, a));
|
|
441
|
+
if (o === null || o.type !== "TableLayer" || (i = S(i ?? r, o.rowsPath), i === null)) return null;
|
|
442
|
+
}
|
|
443
|
+
return i ?? r;
|
|
444
|
+
}
|
|
445
|
+
//#endregion
|
|
446
|
+
//#region src/shared/PanelIcon.vue
|
|
447
|
+
var ie = /* @__PURE__ */ c({
|
|
448
|
+
inheritAttrs: !1,
|
|
449
|
+
__name: "PanelIcon",
|
|
450
|
+
props: {
|
|
451
|
+
icon: {},
|
|
452
|
+
size: { default: 14 },
|
|
453
|
+
strokeWidth: { default: 2 }
|
|
454
|
+
},
|
|
455
|
+
setup(e) {
|
|
456
|
+
return (t, n) => (p(), i(h(e.icon), l({
|
|
457
|
+
size: e.size,
|
|
458
|
+
"stroke-width": e.strokeWidth
|
|
459
|
+
}, t.$attrs), null, 16, ["size", "stroke-width"]));
|
|
460
|
+
}
|
|
461
|
+
}), ae = "行数组";
|
|
462
|
+
function oe(e) {
|
|
463
|
+
return e === null ? null : (t) => ({
|
|
464
|
+
partial: "",
|
|
465
|
+
candidates: X(e, t.endsWith(".") ? t.slice(0, -1) : t).map((e) => ({
|
|
466
|
+
path: e.path,
|
|
467
|
+
segment: e.segment,
|
|
468
|
+
kind: "path",
|
|
469
|
+
...e.description === void 0 ? {} : { description: e.description },
|
|
470
|
+
...e.title === void 0 ? {} : { title: e.title },
|
|
471
|
+
...e.isArray ? { type: "array" } : {}
|
|
472
|
+
}))
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
function se(e, t) {
|
|
476
|
+
if (e === null) return !1;
|
|
477
|
+
let n = q(e, t);
|
|
478
|
+
return n === null || !n.candidates.some((e) => e.path === t && e.type === "array");
|
|
479
|
+
}
|
|
480
|
+
//#endregion
|
|
481
|
+
//#region src/shared/pathPickerModel.ts
|
|
482
|
+
function Z(e, t, n = "resource") {
|
|
483
|
+
let r = e(t);
|
|
484
|
+
if (r === null) return [];
|
|
485
|
+
let i = [];
|
|
486
|
+
for (let t of r.candidates) t.kind === "path" && t.path !== void 0 && i.push(n === "rowsPath" ? le(t.path, t) : ce(e, t.path, t));
|
|
487
|
+
return i;
|
|
488
|
+
}
|
|
489
|
+
function ce(e, t, n) {
|
|
490
|
+
let r = ue(e, t);
|
|
491
|
+
return {
|
|
492
|
+
path: t,
|
|
493
|
+
item: n,
|
|
494
|
+
drillable: r,
|
|
495
|
+
activatable: !r
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
function le(e, t) {
|
|
499
|
+
let n = t.type === "array";
|
|
500
|
+
return {
|
|
501
|
+
path: e,
|
|
502
|
+
item: t,
|
|
503
|
+
drillable: !n,
|
|
504
|
+
activatable: n
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
function ue(e, t) {
|
|
508
|
+
let n = e(`${t}.`);
|
|
509
|
+
return n !== null && n.candidates.some((e) => e.kind === "path");
|
|
510
|
+
}
|
|
511
|
+
function de(e) {
|
|
512
|
+
let t = e.lastIndexOf(".");
|
|
513
|
+
return t === -1 ? "" : e.slice(0, t);
|
|
514
|
+
}
|
|
515
|
+
//#endregion
|
|
516
|
+
//#region src/shared/popupPosition.ts
|
|
517
|
+
var fe = 4, pe = 4;
|
|
518
|
+
function Q(e) {
|
|
519
|
+
let { anchor: t, popupWidth: n, popupHeight: r, viewportWidth: i, viewportHeight: a } = e, o = e.gap ?? 4, s = e.margin ?? 4, c = t.bottom + o;
|
|
520
|
+
if (r > 0 && c + r > a - s) {
|
|
521
|
+
let e = t.top - o - r;
|
|
522
|
+
c = e >= s ? e : Math.max(s, Math.min(c, a - s - r));
|
|
523
|
+
}
|
|
524
|
+
let l = t.left;
|
|
525
|
+
return n > 0 && (l = Math.max(s, Math.min(l, i - s - n))), {
|
|
526
|
+
top: c,
|
|
527
|
+
left: l
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
//#endregion
|
|
531
|
+
//#region src/shared/ExpressionPathPicker.vue?vue&type=script&setup=true&lang.ts
|
|
532
|
+
var me = ["title", "aria-label"], he = ["aria-expanded", "aria-label"], ge = ["aria-label"], _e = { class: "truncate font-mono" }, ve = {
|
|
533
|
+
key: 1,
|
|
534
|
+
class: "cn-pathpicker__empty px-2 py-2 text-cn-muted"
|
|
535
|
+
}, $ = [
|
|
536
|
+
"aria-label",
|
|
537
|
+
"title",
|
|
538
|
+
"onClick",
|
|
539
|
+
"onMousemove"
|
|
540
|
+
], ye = {
|
|
541
|
+
key: 0,
|
|
542
|
+
class: "cn-pathpicker__prefix min-w-0 truncate font-mono text-cn-muted"
|
|
543
|
+
}, be = {
|
|
544
|
+
key: 1,
|
|
545
|
+
class: "shrink-0 rounded-sm bg-cn-field px-1 py-0.5 text-[9px] leading-none text-cn-muted"
|
|
546
|
+
}, xe = {
|
|
547
|
+
key: 2,
|
|
548
|
+
class: "min-w-0 flex-1 truncate text-[10px] leading-none text-cn-muted"
|
|
549
|
+
}, Se = {
|
|
550
|
+
key: 3,
|
|
551
|
+
class: "cn-pathpicker__drill ml-auto shrink-0 text-cn-muted",
|
|
552
|
+
"aria-hidden": "true"
|
|
553
|
+
}, Ce = /* @__PURE__ */ c({
|
|
554
|
+
__name: "ExpressionPathPicker",
|
|
555
|
+
props: {
|
|
556
|
+
modelValue: {},
|
|
557
|
+
source: { type: [Function, null] },
|
|
558
|
+
disabled: { type: Boolean },
|
|
559
|
+
ariaLabel: {},
|
|
560
|
+
placeholder: {},
|
|
561
|
+
mode: {}
|
|
562
|
+
},
|
|
563
|
+
emits: ["update:modelValue", "change"],
|
|
564
|
+
setup(e, { emit: c }) {
|
|
565
|
+
let l = e, h = c, y = r(() => !l.disabled && l.source !== null), b = m(!1), x = m([]), S = m(0), C = r(() => x.value[x.value.length - 1] ?? null), w = r(() => {
|
|
566
|
+
let e = x.value[x.value.length - 2];
|
|
567
|
+
return e === void 0 ? "" : e.label === "" ? "根级字段" : e.label;
|
|
568
|
+
}), T = r(() => l.mode === "rowsPath" ? "声明中未发现行数组,请检查数据源绑定" : "无可选字段");
|
|
569
|
+
function E(e) {
|
|
570
|
+
return l.mode === "rowsPath" && e === "array" ? ae : e;
|
|
571
|
+
}
|
|
572
|
+
let D = r(() => (C.value?.entries ?? []).map((e) => ({
|
|
573
|
+
entry: e,
|
|
574
|
+
prefix: de(e.path)
|
|
575
|
+
})));
|
|
576
|
+
function O(e, t) {
|
|
577
|
+
return {
|
|
578
|
+
prefix: e,
|
|
579
|
+
label: t,
|
|
580
|
+
entries: l.source === null ? [] : Z(l.source, e, l.mode)
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
function k() {
|
|
584
|
+
y.value && !b.value && (x.value = [O("", "")], S.value = 0, b.value = !0, u(() => {
|
|
585
|
+
U(), B.value?.focus();
|
|
586
|
+
}));
|
|
587
|
+
}
|
|
588
|
+
function A() {
|
|
589
|
+
b.value && (j(), z.value?.focus());
|
|
590
|
+
}
|
|
591
|
+
function j() {
|
|
592
|
+
b.value = !1, x.value = [], S.value = 0;
|
|
593
|
+
}
|
|
594
|
+
function M() {
|
|
595
|
+
b.value ? A() : k();
|
|
596
|
+
}
|
|
597
|
+
function N(e) {
|
|
598
|
+
l.source !== null && (x.value.push(O(`${e.path}.`, e.path)), S.value = 0, u(U));
|
|
599
|
+
}
|
|
600
|
+
function P() {
|
|
601
|
+
x.value.length <= 1 || (x.value.pop(), S.value = 0, u(U));
|
|
602
|
+
}
|
|
603
|
+
function F(e) {
|
|
604
|
+
if (e.drillable) {
|
|
605
|
+
N(e);
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
e.activatable && (h("update:modelValue", e.path), h("change", e.path), A());
|
|
609
|
+
}
|
|
610
|
+
function I() {
|
|
611
|
+
return C.value?.entries[S.value] ?? null;
|
|
612
|
+
}
|
|
613
|
+
function L(e) {
|
|
614
|
+
if (e.key === "Escape") {
|
|
615
|
+
e.preventDefault(), A();
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
if (e.key === "Tab") {
|
|
619
|
+
A();
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
let t = C.value?.entries ?? [];
|
|
623
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
624
|
+
e.preventDefault();
|
|
625
|
+
let n = t.length;
|
|
626
|
+
n > 0 && (S.value = (S.value + (e.key === "ArrowDown" ? 1 : n - 1)) % n);
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
if (e.key === "ArrowRight") {
|
|
630
|
+
let t = I();
|
|
631
|
+
t?.drillable && (e.preventDefault(), N(t));
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
if (e.key === "ArrowLeft") {
|
|
635
|
+
x.value.length > 1 && (e.preventDefault(), P());
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
639
|
+
let t = I();
|
|
640
|
+
t !== null && (e.preventDefault(), F(t));
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
let R = m(null), z = m(null), B = m(null), V = m(0), H = m(0);
|
|
644
|
+
function U() {
|
|
645
|
+
if (!b.value) return;
|
|
646
|
+
let e = R.value, t = B.value;
|
|
647
|
+
if (e === null) return;
|
|
648
|
+
let n = Q({
|
|
649
|
+
anchor: e.getBoundingClientRect(),
|
|
650
|
+
popupWidth: t?.offsetWidth ?? 0,
|
|
651
|
+
popupHeight: t?.offsetHeight ?? 0,
|
|
652
|
+
viewportWidth: window.innerWidth,
|
|
653
|
+
viewportHeight: window.innerHeight
|
|
654
|
+
});
|
|
655
|
+
V.value = n.top, H.value = n.left;
|
|
656
|
+
}
|
|
657
|
+
function W() {
|
|
658
|
+
U();
|
|
659
|
+
}
|
|
660
|
+
ne(b, (e) => {
|
|
661
|
+
e ? (window.addEventListener("pointerdown", G), window.addEventListener("keydown", K), window.addEventListener("scroll", W, !0), window.addEventListener("resize", W)) : q();
|
|
662
|
+
});
|
|
663
|
+
function G(e) {
|
|
664
|
+
let t = e.target;
|
|
665
|
+
t instanceof Node && (R.value?.contains(t) || B.value?.contains(t) || j());
|
|
666
|
+
}
|
|
667
|
+
function K(e) {
|
|
668
|
+
e.key === "Escape" && A();
|
|
669
|
+
}
|
|
670
|
+
function q() {
|
|
671
|
+
window.removeEventListener("pointerdown", G), window.removeEventListener("keydown", K), window.removeEventListener("scroll", W, !0), window.removeEventListener("resize", W);
|
|
672
|
+
}
|
|
673
|
+
return ee(q, !0), (r, c) => (p(), o("div", {
|
|
674
|
+
ref_key: "rootRef",
|
|
675
|
+
ref: R,
|
|
676
|
+
class: "cn-pathpicker flex w-full items-center gap-1.5"
|
|
677
|
+
}, [
|
|
678
|
+
s("div", {
|
|
679
|
+
class: d(["cn-pathpicker__value min-w-0 flex-1 truncate rounded-md border border-cn-field-line bg-cn-field px-2 py-1.5 font-mono text-[11px] leading-none text-cn-fg", e.modelValue === "" ? "text-cn-muted" : ""]),
|
|
680
|
+
title: e.modelValue,
|
|
681
|
+
"aria-label": e.ariaLabel
|
|
682
|
+
}, g(e.modelValue === "" ? e.placeholder ?? "点击右侧按钮选择字段" : e.modelValue), 11, me),
|
|
683
|
+
y.value ? (p(), o("button", {
|
|
684
|
+
key: 0,
|
|
685
|
+
ref_key: "toggleButton",
|
|
686
|
+
ref: z,
|
|
687
|
+
type: "button",
|
|
688
|
+
class: "cn-pathpicker__toggle h-7 shrink-0 rounded-md border border-cn-field-line bg-cn-field px-1.5 text-[11px] leading-none text-cn-muted transition-colors duration-100 hover:border-cn-muted/40 hover:text-cn-fg",
|
|
689
|
+
"aria-haspopup": "menu",
|
|
690
|
+
"aria-expanded": b.value,
|
|
691
|
+
"aria-label": e.ariaLabel === void 0 ? "选择字段路径" : `选择字段路径(${e.ariaLabel})`,
|
|
692
|
+
title: "选择字段路径",
|
|
693
|
+
onClick: M
|
|
694
|
+
}, "▾", 8, he)) : a("", !0),
|
|
695
|
+
(p(), i(n, { to: "body" }, [b.value && C.value !== null ? (p(), o("div", {
|
|
696
|
+
key: 0,
|
|
697
|
+
ref_key: "menuRoot",
|
|
698
|
+
ref: B,
|
|
699
|
+
class: "cn-props cn-pathpicker__menu fixed z-50 max-h-[240px] min-w-[180px] max-w-[280px] overflow-y-auto rounded-md border border-cn-field-line py-1 text-[11px] leading-none",
|
|
700
|
+
style: f({
|
|
701
|
+
top: `${V.value}px`,
|
|
702
|
+
left: `${H.value}px`
|
|
703
|
+
}),
|
|
704
|
+
role: "menu",
|
|
705
|
+
"aria-label": e.ariaLabel === void 0 ? "字段路径菜单" : `${e.ariaLabel} 字段路径菜单`,
|
|
706
|
+
tabindex: "-1",
|
|
707
|
+
onKeydown: v(L, ["stop"]),
|
|
708
|
+
onPointerdown: c[0] ||= v(() => {}, ["stop"])
|
|
709
|
+
}, [
|
|
710
|
+
x.value.length > 1 ? (p(), o("button", {
|
|
711
|
+
key: 0,
|
|
712
|
+
type: "button",
|
|
713
|
+
role: "menuitem",
|
|
714
|
+
class: "cn-pathpicker__back flex w-full items-center gap-1 border-b border-cn-line/70 px-2 py-1.5 text-left text-cn-muted",
|
|
715
|
+
onClick: P
|
|
716
|
+
}, [c[1] ||= s("span", { "aria-hidden": "true" }, "‹", -1), s("span", _e, g(w.value), 1)])) : a("", !0),
|
|
717
|
+
C.value.entries.length === 0 ? (p(), o("div", ve, g(T.value), 1)) : a("", !0),
|
|
718
|
+
(p(!0), o(t, null, te(D.value, (e, t) => (p(), o("button", {
|
|
719
|
+
key: `${e.entry.path}`,
|
|
720
|
+
type: "button",
|
|
721
|
+
role: "menuitem",
|
|
722
|
+
class: d(["cn-pathpicker__option flex w-full items-center gap-1.5 px-2 py-1.5 text-left", t === S.value ? "cn-pathpicker__option--active" : ""]),
|
|
723
|
+
"aria-label": e.entry.path,
|
|
724
|
+
title: e.entry.path,
|
|
725
|
+
onClick: (t) => F(e.entry),
|
|
726
|
+
onMousemove: (e) => S.value = t
|
|
727
|
+
}, [
|
|
728
|
+
e.prefix === "" ? a("", !0) : (p(), o("span", ye, g(e.prefix) + " " + g(_("›")), 1)),
|
|
729
|
+
s("span", { class: d(["cn-pathpicker__segment truncate font-mono text-cn-fg", e.prefix === "" ? "min-w-0" : "shrink-0 max-w-full"]) }, g(e.entry.item.segment), 3),
|
|
730
|
+
e.entry.item.type ? (p(), o("span", be, g(E(e.entry.item.type)), 1)) : a("", !0),
|
|
731
|
+
e.entry.item.description ?? e.entry.item.title ? (p(), o("span", xe, g(e.entry.item.description ?? e.entry.item.title), 1)) : a("", !0),
|
|
732
|
+
e.entry.drillable ? (p(), o("span", Se, "›")) : a("", !0)
|
|
733
|
+
], 42, $))), 128))
|
|
734
|
+
], 44, ge)) : a("", !0)]))
|
|
735
|
+
], 512));
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
//#endregion
|
|
739
|
+
export { S as _, Z as a, ie as c, z as d, F as f, C as g, A as h, Q as i, re as l, N as m, fe as n, oe as o, R as p, pe as r, se as s, Ce as t, P as u, x as v, b as y };
|