@hankchen/canvas-editor-vue 2.0.0 → 2.2.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/README.md +43 -2
- package/dist/{ExpressionPathPicker-DchGsK70.js → Tooltip-9lQOwB7r.js} +260 -195
- package/dist/_plugin-vue_export-helper-CBNdHDnS.js +98 -0
- package/dist/canvas/EditOverlayToolbar.d.ts +1 -1
- package/dist/{canvas-DuvO27sj.js → canvas-DIcS64ZV.js} +614 -554
- package/dist/canvas.js +1 -1
- package/dist/index.js +14 -14
- package/dist/{layer-panel-BouAYiDq.js → layer-panel-DPhB8OJp.js} +246 -240
- package/dist/layer-panel.js +1 -1
- package/dist/panel-theme.css +6 -276
- package/dist/property-panel/fieldSchema.d.ts +4 -2
- package/dist/{property-panel-ns-OHICS.js → property-panel-BzpaxWLB.js} +268 -253
- package/dist/property-panel.js +2 -2
- package/dist/{resourceTemplate-D-DKEo7Z.js → resourceTemplate-DLEZMwZl.js} +1 -1
- package/dist/shared/Tooltip.d.ts +24 -0
- package/dist/shared/index.d.ts +8 -1
- package/dist/shared/useCnTheme.d.ts +12 -0
- package/dist/shared/useDropdownMenu.d.ts +13 -1
- package/dist/{shared-CRDKDSpa.js → shared-5EY0LNSa.js} +76 -31
- package/dist/shared.js +9 -9
- package/dist/{status-bar-DBf5kIXY.js → status-bar-CJJSr9Ua.js} +9 -10
- package/dist/status-bar.js +1 -1
- package/dist/style.css +1 -1
- package/dist/theme.css +428 -0
- package/dist/{uploadFile-mXJVPEzm.js → uploadFile-DnW3L-8J.js} +33 -33
- package/dist/useTransientFeedback-CI3j6r7y.js +956 -0
- package/package.json +4 -3
- package/dist/DropdownMenu-CeUNKMDQ.js +0 -450
- package/dist/layerPath-uy2ywyld.js +0 -76
- package/dist/useTransientFeedback-BN_O7V2w.js +0 -498
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Fragment as
|
|
1
|
+
import { s as e, t } from "./_plugin-vue_export-helper-CBNdHDnS.js";
|
|
2
|
+
import { Fragment as n, Teleport as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, defineComponent as l, mergeProps as u, nextTick as d, normalizeClass as f, normalizeStyle as p, onScopeDispose as m, onUnmounted as h, openBlock as g, ref as _, renderList as v, renderSlot as y, toDisplayString as b, unref as x, watch as S, withModifiers as C } from "vue";
|
|
3
3
|
//#region ../canvas-editor/src/shared/expressionSchema.ts
|
|
4
|
-
function
|
|
4
|
+
function w(e) {
|
|
5
5
|
let t = e;
|
|
6
6
|
for (; t !== void 0;) {
|
|
7
7
|
if (t.properties !== void 0) return t.properties;
|
|
@@ -9,28 +9,28 @@ function y(e) {
|
|
|
9
9
|
}
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function T(e, t) {
|
|
13
13
|
let n = e;
|
|
14
14
|
for (let e of t) {
|
|
15
|
-
let t =
|
|
15
|
+
let t = w(n)?.get(e);
|
|
16
16
|
if (t === void 0) return null;
|
|
17
17
|
n = t;
|
|
18
18
|
}
|
|
19
19
|
return n;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function E(e) {
|
|
22
22
|
return e.type === "array" || e.items !== void 0 ? { entries: [] } : { entries: e.properties === void 0 ? [] : [...e.properties].map(([e, t]) => ({
|
|
23
23
|
key: e,
|
|
24
24
|
node: t
|
|
25
25
|
})) };
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function D(e, t) {
|
|
28
28
|
let n = t.split(".");
|
|
29
|
-
return t === "" || n.includes("") ? null :
|
|
29
|
+
return t === "" || n.includes("") ? null : T(e, n)?.items ?? null;
|
|
30
30
|
}
|
|
31
31
|
//#endregion
|
|
32
32
|
//#region ../canvas-editor/src/shared/expressionPath.ts
|
|
33
|
-
function
|
|
33
|
+
function O(e) {
|
|
34
34
|
if (e === "") return {
|
|
35
35
|
ok: !1,
|
|
36
36
|
error: "expression_syntax_error"
|
|
@@ -60,18 +60,18 @@ function C(e) {
|
|
|
60
60
|
}
|
|
61
61
|
//#endregion
|
|
62
62
|
//#region ../canvas-editor/src/shared/expressionCall.ts
|
|
63
|
-
var
|
|
64
|
-
function
|
|
63
|
+
var k = " \n\r\0\v", A = " \n\r", j = `()',.${k}`;
|
|
64
|
+
function M(e) {
|
|
65
65
|
let t = 0, n = e.length;
|
|
66
|
-
for (; t < n &&
|
|
67
|
-
for (; n > t &&
|
|
66
|
+
for (; t < n && k.includes(e[t]);) t += 1;
|
|
67
|
+
for (; n > t && k.includes(e[n - 1]);) --n;
|
|
68
68
|
return e.slice(t, n);
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
for (; t < e.length &&
|
|
70
|
+
function N(e, t) {
|
|
71
|
+
for (; t < e.length && A.includes(e[t]);) t += 1;
|
|
72
72
|
return t;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function P(e, t, n) {
|
|
75
75
|
return {
|
|
76
76
|
ok: !1,
|
|
77
77
|
error: "expression_syntax_error",
|
|
@@ -82,51 +82,51 @@ function k(e, t, n) {
|
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function F(e) {
|
|
86
86
|
let t = 0;
|
|
87
|
-
for (; t < e.length && !
|
|
87
|
+
for (; t < e.length && !j.includes(e[t]);) t += 1;
|
|
88
88
|
if (t === 0) return !1;
|
|
89
89
|
let n = t;
|
|
90
|
-
for (; n < e.length &&
|
|
90
|
+
for (; n < e.length && k.includes(e[n]);) n += 1;
|
|
91
91
|
return e[n] === "(";
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function I(e) {
|
|
94
94
|
let t = 0;
|
|
95
|
-
for (; t < e.length && !
|
|
96
|
-
if (t === 0) return
|
|
97
|
-
let n = e.slice(0, t), r =
|
|
98
|
-
if (r >= e.length || e[r] !== "(") return
|
|
95
|
+
for (; t < e.length && !j.includes(e[t]);) t += 1;
|
|
96
|
+
if (t === 0) return P("invalid_path", 0, e.length);
|
|
97
|
+
let n = e.slice(0, t), r = N(e, t);
|
|
98
|
+
if (r >= e.length || e[r] !== "(") return P("missing_open_paren", t, e.length);
|
|
99
99
|
let i = r;
|
|
100
|
-
r =
|
|
100
|
+
r = N(e, r + 1);
|
|
101
101
|
let a = [], o = [];
|
|
102
102
|
if (r < e.length && e[r] === ")") r += 1;
|
|
103
103
|
else for (;;) {
|
|
104
|
-
if (r >= e.length) return
|
|
105
|
-
let t =
|
|
104
|
+
if (r >= e.length) return P("unbalanced_paren", i, e.length);
|
|
105
|
+
let t = L(e, r);
|
|
106
106
|
if (!t.ok) return t;
|
|
107
107
|
if (a.push(t.value), o.push({
|
|
108
108
|
start: t.start,
|
|
109
109
|
end: t.end
|
|
110
|
-
}), r =
|
|
110
|
+
}), r = N(e, t.end), r >= e.length) return P("unbalanced_paren", i, e.length);
|
|
111
111
|
if (e[r] === ",") {
|
|
112
112
|
let t = r;
|
|
113
|
-
if (r =
|
|
113
|
+
if (r = N(e, r + 1), r < e.length && e[r] === ")") return P("empty_arg_slot", t + 1, r);
|
|
114
114
|
continue;
|
|
115
115
|
}
|
|
116
116
|
if (e[r] === ")") {
|
|
117
117
|
r += 1;
|
|
118
118
|
break;
|
|
119
119
|
}
|
|
120
|
-
return
|
|
120
|
+
return P("bad_arg_syntax", r, r + 1);
|
|
121
121
|
}
|
|
122
|
-
if (r =
|
|
122
|
+
if (r = N(e, r), r !== e.length) return P("trailing_after_call", r, e.length);
|
|
123
123
|
if (a[0] !== void 0 && a[0].type !== "path") {
|
|
124
124
|
let e = o[0];
|
|
125
|
-
return
|
|
125
|
+
return P("first_arg_not_path", e.start, e.end);
|
|
126
126
|
}
|
|
127
127
|
for (let e = 0; e < a.length; e += 1) {
|
|
128
128
|
let t = a[e], n = o[e];
|
|
129
|
-
if (t.type === "path" && !
|
|
129
|
+
if (t.type === "path" && !O(t.value).ok) return P("invalid_path_arg", n.start, n.end);
|
|
130
130
|
}
|
|
131
131
|
return {
|
|
132
132
|
ok: !0,
|
|
@@ -134,7 +134,7 @@ function j(e) {
|
|
|
134
134
|
args: a
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function L(e, t) {
|
|
138
138
|
let n = e.length, r = t, i = e[t];
|
|
139
139
|
if (i === "'") {
|
|
140
140
|
let i = t + 1, a = "";
|
|
@@ -186,7 +186,7 @@ function M(e, t) {
|
|
|
186
186
|
};
|
|
187
187
|
}
|
|
188
188
|
for (; t < n && e[t] !== "," && e[t] !== ")";) t += 1;
|
|
189
|
-
let a =
|
|
189
|
+
let a = M(e.slice(r, t));
|
|
190
190
|
return a === "" ? {
|
|
191
191
|
ok: !1,
|
|
192
192
|
error: "expression_syntax_error",
|
|
@@ -205,13 +205,13 @@ function M(e, t) {
|
|
|
205
205
|
end: t
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function R(e) {
|
|
209
209
|
let t = 0;
|
|
210
|
-
for (; t < e.length && !
|
|
210
|
+
for (; t < e.length && !j.includes(e[t]);) t += 1;
|
|
211
211
|
if (t === 0) return null;
|
|
212
|
-
let n =
|
|
212
|
+
let n = N(e, t);
|
|
213
213
|
if (n >= e.length || e[n] !== "(") return null;
|
|
214
|
-
n =
|
|
214
|
+
n = N(e, n + 1);
|
|
215
215
|
let r = 0;
|
|
216
216
|
for (;;) {
|
|
217
217
|
if (n >= e.length) return {
|
|
@@ -247,7 +247,7 @@ function N(e) {
|
|
|
247
247
|
if (n >= e.length) return {
|
|
248
248
|
name: e.slice(0, t),
|
|
249
249
|
index: r,
|
|
250
|
-
text:
|
|
250
|
+
text: M(e.slice(i)),
|
|
251
251
|
stringSlot: !1
|
|
252
252
|
};
|
|
253
253
|
}
|
|
@@ -258,19 +258,19 @@ function N(e) {
|
|
|
258
258
|
stringSlot: !1
|
|
259
259
|
};
|
|
260
260
|
if (e[n] === ")") return null;
|
|
261
|
-
r += 1, n =
|
|
261
|
+
r += 1, n = N(e, n + 1);
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
//#endregion
|
|
265
265
|
//#region ../canvas-editor/src/shared/expressionScan.ts
|
|
266
|
-
var
|
|
267
|
-
function
|
|
266
|
+
var z = " \n\r\0\v";
|
|
267
|
+
function B(e) {
|
|
268
268
|
let t = 0, n = e.length;
|
|
269
269
|
for (; t < n && " \n\r\0\v".includes(e[t]);) t += 1;
|
|
270
270
|
for (; n > t && " \n\r\0\v".includes(e[n - 1]);) --n;
|
|
271
271
|
return e.slice(t, n);
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function V(e) {
|
|
274
274
|
if (e === "") return {
|
|
275
275
|
kind: "empty_fragment",
|
|
276
276
|
at: {
|
|
@@ -278,14 +278,14 @@ function I(e) {
|
|
|
278
278
|
end: 0
|
|
279
279
|
}
|
|
280
280
|
};
|
|
281
|
-
if (
|
|
282
|
-
let t =
|
|
281
|
+
if (F(e)) {
|
|
282
|
+
let t = I(e);
|
|
283
283
|
return t.ok ? null : {
|
|
284
284
|
kind: t.kind,
|
|
285
285
|
at: t.at
|
|
286
286
|
};
|
|
287
287
|
}
|
|
288
|
-
return
|
|
288
|
+
return O(e).ok ? null : {
|
|
289
289
|
kind: "invalid_path",
|
|
290
290
|
at: {
|
|
291
291
|
start: 0,
|
|
@@ -293,12 +293,12 @@ function I(e) {
|
|
|
293
293
|
}
|
|
294
294
|
};
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function H(e) {
|
|
297
297
|
let t = 0;
|
|
298
298
|
for (; t < e.length && " \n\r\0\v".includes(e[t]);) t += 1;
|
|
299
299
|
return t;
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function U(e) {
|
|
302
302
|
let t = [], n = 0, r = e.indexOf("{{");
|
|
303
303
|
for (; r !== -1;) {
|
|
304
304
|
let i = e.indexOf("}}", r + 2);
|
|
@@ -315,7 +315,7 @@ function R(e) {
|
|
|
315
315
|
start: r,
|
|
316
316
|
end: e.length,
|
|
317
317
|
text: i,
|
|
318
|
-
expr:
|
|
318
|
+
expr: B(i.slice(2))
|
|
319
319
|
}), {
|
|
320
320
|
template: e,
|
|
321
321
|
parts: t
|
|
@@ -327,9 +327,9 @@ function R(e) {
|
|
|
327
327
|
end: r,
|
|
328
328
|
text: e.slice(n, r)
|
|
329
329
|
});
|
|
330
|
-
let a = e.slice(r + 2, i), o =
|
|
330
|
+
let a = e.slice(r + 2, i), o = B(a), s = null, c = V(o);
|
|
331
331
|
if (c) {
|
|
332
|
-
let e = r + 2 +
|
|
332
|
+
let e = r + 2 + H(a);
|
|
333
333
|
s = {
|
|
334
334
|
kind: c.kind,
|
|
335
335
|
start: r,
|
|
@@ -360,109 +360,95 @@ function R(e) {
|
|
|
360
360
|
parts: t
|
|
361
361
|
};
|
|
362
362
|
}
|
|
363
|
-
function
|
|
363
|
+
function W(e, t) {
|
|
364
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
365
|
return null;
|
|
366
366
|
}
|
|
367
367
|
//#endregion
|
|
368
368
|
//#region ../canvas-editor/src/shared/rowsPathCandidates.ts
|
|
369
|
-
function
|
|
369
|
+
function G(e) {
|
|
370
370
|
return e.type === "array" || e.items !== void 0;
|
|
371
371
|
}
|
|
372
|
-
function
|
|
373
|
-
return !
|
|
372
|
+
function K(e) {
|
|
373
|
+
return !G(e) && e.properties === void 0;
|
|
374
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function q(e, t) {
|
|
376
376
|
return e === "" ? t : `${e}.${t}`;
|
|
377
377
|
}
|
|
378
|
-
function
|
|
378
|
+
function J(e, t) {
|
|
379
379
|
return t.description !== void 0 && (e.description = t.description), t.title !== void 0 && (e.title = t.title), e;
|
|
380
380
|
}
|
|
381
|
-
function
|
|
381
|
+
function Y(e, t) {
|
|
382
382
|
let n = e;
|
|
383
383
|
for (let e of t) {
|
|
384
|
-
if (
|
|
385
|
-
let t =
|
|
384
|
+
if (G(n)) return null;
|
|
385
|
+
let t = T(n, [e]);
|
|
386
386
|
if (t === null) return null;
|
|
387
387
|
n = t;
|
|
388
388
|
}
|
|
389
|
-
return
|
|
389
|
+
return G(n) || K(n) ? null : n;
|
|
390
390
|
}
|
|
391
|
-
function
|
|
392
|
-
let r =
|
|
393
|
-
path:
|
|
391
|
+
function X(e, t, n) {
|
|
392
|
+
let r = J({
|
|
393
|
+
path: q(n, e),
|
|
394
394
|
segment: e
|
|
395
395
|
}, t);
|
|
396
|
-
return
|
|
396
|
+
return G(t) && (r.type = "array"), r;
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function ee(e, t) {
|
|
399
399
|
let n = [];
|
|
400
|
-
if (e.properties !== void 0) for (let [r, i] of e.properties)
|
|
400
|
+
if (e.properties !== void 0) for (let [r, i] of e.properties) K(i) || n.push(X(r, i, t));
|
|
401
401
|
return n;
|
|
402
402
|
}
|
|
403
|
-
function
|
|
403
|
+
function te(e, t) {
|
|
404
404
|
if (e === null) return null;
|
|
405
|
-
let n = t.split("."), r = t.endsWith(".") ? "" : n[n.length - 1], i = n.slice(0, -1), a =
|
|
405
|
+
let n = t.split("."), r = t.endsWith(".") ? "" : n[n.length - 1], i = n.slice(0, -1), a = Y(e, i);
|
|
406
406
|
return a === null ? null : {
|
|
407
407
|
partial: r,
|
|
408
|
-
candidates:
|
|
408
|
+
candidates: ee(a, i.join("."))
|
|
409
409
|
};
|
|
410
410
|
}
|
|
411
|
-
function
|
|
412
|
-
if (
|
|
411
|
+
function Z(e) {
|
|
412
|
+
if (G(e)) return !0;
|
|
413
413
|
if (e.properties === void 0) return !1;
|
|
414
|
-
for (let t of e.properties.values()) if (
|
|
414
|
+
for (let t of e.properties.values()) if (Z(t)) return !0;
|
|
415
415
|
return !1;
|
|
416
416
|
}
|
|
417
|
-
function
|
|
418
|
-
return
|
|
419
|
-
path:
|
|
417
|
+
function ne(e, t, n) {
|
|
418
|
+
return J({
|
|
419
|
+
path: q(n, e),
|
|
420
420
|
segment: e,
|
|
421
|
-
isArray:
|
|
421
|
+
isArray: G(t)
|
|
422
422
|
}, t);
|
|
423
423
|
}
|
|
424
|
-
function
|
|
424
|
+
function re(e, t) {
|
|
425
425
|
if (e === null) return [];
|
|
426
426
|
let n = t === "" ? [] : t.split(".");
|
|
427
427
|
if (n.includes("")) return [];
|
|
428
|
-
let r =
|
|
428
|
+
let r = Y(e, n);
|
|
429
429
|
if (r === null) return [];
|
|
430
430
|
let i = [];
|
|
431
|
-
if (r.properties !== void 0) for (let [e, n] of r.properties)
|
|
431
|
+
if (r.properties !== void 0) for (let [e, n] of r.properties) Z(n) && i.push(ne(e, n, t));
|
|
432
432
|
return i;
|
|
433
433
|
}
|
|
434
|
-
function
|
|
434
|
+
function ie(t, n, r) {
|
|
435
435
|
if (r === null) return null;
|
|
436
436
|
if (t === null || n === null) return r;
|
|
437
437
|
let i = null;
|
|
438
438
|
for (let a = 0; a < n.length; a += 1) {
|
|
439
439
|
if (n[a] !== "template") continue;
|
|
440
440
|
let o = e(t, n.slice(0, a));
|
|
441
|
-
if (o === null || o.type !== "TableLayer" || (i =
|
|
441
|
+
if (o === null || o.type !== "TableLayer" || (i = D(i ?? r, o.rowsPath), i === null)) return null;
|
|
442
442
|
}
|
|
443
443
|
return i ?? r;
|
|
444
444
|
}
|
|
445
445
|
//#endregion
|
|
446
|
-
//#region src/shared/
|
|
447
|
-
var
|
|
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 = "行数组";
|
|
446
|
+
//#region src/shared/rowsPathPickerSource.ts
|
|
447
|
+
var ae = "行数组";
|
|
462
448
|
function oe(e) {
|
|
463
449
|
return e === null ? null : (t) => ({
|
|
464
450
|
partial: "",
|
|
465
|
-
candidates:
|
|
451
|
+
candidates: re(e, t.endsWith(".") ? t.slice(0, -1) : t).map((e) => ({
|
|
466
452
|
path: e.path,
|
|
467
453
|
segment: e.segment,
|
|
468
454
|
kind: "path",
|
|
@@ -474,12 +460,12 @@ function oe(e) {
|
|
|
474
460
|
}
|
|
475
461
|
function se(e, t) {
|
|
476
462
|
if (e === null) return !1;
|
|
477
|
-
let n =
|
|
463
|
+
let n = te(e, t);
|
|
478
464
|
return n === null || !n.candidates.some((e) => e.path === t && e.type === "array");
|
|
479
465
|
}
|
|
480
466
|
//#endregion
|
|
481
467
|
//#region src/shared/pathPickerModel.ts
|
|
482
|
-
function
|
|
468
|
+
function Q(e, t, n = "resource") {
|
|
483
469
|
let r = e(t);
|
|
484
470
|
if (r === null) return [];
|
|
485
471
|
let i = [];
|
|
@@ -515,7 +501,7 @@ function de(e) {
|
|
|
515
501
|
//#endregion
|
|
516
502
|
//#region src/shared/popupPosition.ts
|
|
517
503
|
var fe = 4, pe = 4;
|
|
518
|
-
function
|
|
504
|
+
function $(e) {
|
|
519
505
|
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
506
|
if (r > 0 && c + r > a - s) {
|
|
521
507
|
let e = t.top - o - r;
|
|
@@ -532,25 +518,25 @@ function Q(e) {
|
|
|
532
518
|
var me = ["title", "aria-label"], he = ["aria-expanded", "aria-label"], ge = ["aria-label"], _e = { class: "truncate font-mono" }, ve = {
|
|
533
519
|
key: 1,
|
|
534
520
|
class: "cn-pathpicker__empty px-2 py-2 text-cn-muted"
|
|
535
|
-
},
|
|
521
|
+
}, ye = [
|
|
536
522
|
"aria-label",
|
|
537
523
|
"title",
|
|
538
524
|
"onClick",
|
|
539
525
|
"onMousemove"
|
|
540
|
-
],
|
|
526
|
+
], be = {
|
|
541
527
|
key: 0,
|
|
542
528
|
class: "cn-pathpicker__prefix min-w-0 truncate font-mono text-cn-muted"
|
|
543
|
-
},
|
|
529
|
+
}, xe = {
|
|
544
530
|
key: 1,
|
|
545
531
|
class: "shrink-0 rounded-sm bg-cn-field px-1 py-0.5 text-[9px] leading-none text-cn-muted"
|
|
546
|
-
},
|
|
532
|
+
}, Se = {
|
|
547
533
|
key: 2,
|
|
548
534
|
class: "min-w-0 flex-1 truncate text-[10px] leading-none text-cn-muted"
|
|
549
|
-
},
|
|
535
|
+
}, Ce = {
|
|
550
536
|
key: 3,
|
|
551
537
|
class: "cn-pathpicker__drill ml-auto shrink-0 text-cn-muted",
|
|
552
538
|
"aria-hidden": "true"
|
|
553
|
-
},
|
|
539
|
+
}, we = /* @__PURE__ */ l({
|
|
554
540
|
__name: "ExpressionPathPicker",
|
|
555
541
|
props: {
|
|
556
542
|
modelValue: {},
|
|
@@ -561,179 +547,258 @@ var me = ["title", "aria-label"], he = ["aria-expanded", "aria-label"], ge = ["a
|
|
|
561
547
|
mode: {}
|
|
562
548
|
},
|
|
563
549
|
emits: ["update:modelValue", "change"],
|
|
564
|
-
setup(e, { emit:
|
|
565
|
-
let l = e,
|
|
566
|
-
let e =
|
|
550
|
+
setup(e, { emit: t }) {
|
|
551
|
+
let l = e, u = t, h = i(() => !l.disabled && l.source !== null), y = _(!1), w = _([]), T = _(0), E = i(() => w.value[w.value.length - 1] ?? null), D = i(() => {
|
|
552
|
+
let e = w.value[w.value.length - 2];
|
|
567
553
|
return e === void 0 ? "" : e.label === "" ? "根级字段" : e.label;
|
|
568
|
-
}),
|
|
569
|
-
function
|
|
554
|
+
}), O = i(() => l.mode === "rowsPath" ? "声明中未发现行数组,请检查数据源绑定" : "无可选字段");
|
|
555
|
+
function k(e) {
|
|
570
556
|
return l.mode === "rowsPath" && e === "array" ? ae : e;
|
|
571
557
|
}
|
|
572
|
-
let
|
|
558
|
+
let A = i(() => (E.value?.entries ?? []).map((e) => ({
|
|
573
559
|
entry: e,
|
|
574
560
|
prefix: de(e.path)
|
|
575
561
|
})));
|
|
576
|
-
function
|
|
562
|
+
function j(e, t) {
|
|
577
563
|
return {
|
|
578
564
|
prefix: e,
|
|
579
565
|
label: t,
|
|
580
|
-
entries: l.source === null ? [] :
|
|
566
|
+
entries: l.source === null ? [] : Q(l.source, e, l.mode)
|
|
581
567
|
};
|
|
582
568
|
}
|
|
583
|
-
function
|
|
584
|
-
|
|
585
|
-
|
|
569
|
+
function M() {
|
|
570
|
+
h.value && !y.value && (w.value = [j("", "")], T.value = 0, y.value = !0, d(() => {
|
|
571
|
+
K(), U.value?.focus();
|
|
586
572
|
}));
|
|
587
573
|
}
|
|
588
|
-
function
|
|
589
|
-
|
|
574
|
+
function N() {
|
|
575
|
+
y.value && (P(), H.value?.focus());
|
|
590
576
|
}
|
|
591
|
-
function
|
|
592
|
-
|
|
577
|
+
function P() {
|
|
578
|
+
y.value = !1, w.value = [], T.value = 0;
|
|
593
579
|
}
|
|
594
|
-
function
|
|
595
|
-
|
|
580
|
+
function F() {
|
|
581
|
+
y.value ? N() : M();
|
|
596
582
|
}
|
|
597
|
-
function
|
|
598
|
-
l.source !== null && (
|
|
583
|
+
function I(e) {
|
|
584
|
+
l.source !== null && (w.value.push(j(`${e.path}.`, e.path)), T.value = 0, d(K));
|
|
599
585
|
}
|
|
600
|
-
function
|
|
601
|
-
|
|
586
|
+
function L() {
|
|
587
|
+
w.value.length <= 1 || (w.value.pop(), T.value = 0, d(K));
|
|
602
588
|
}
|
|
603
|
-
function
|
|
589
|
+
function R(e) {
|
|
604
590
|
if (e.drillable) {
|
|
605
|
-
|
|
591
|
+
I(e);
|
|
606
592
|
return;
|
|
607
593
|
}
|
|
608
|
-
e.activatable && (
|
|
594
|
+
e.activatable && (u("update:modelValue", e.path), u("change", e.path), N());
|
|
609
595
|
}
|
|
610
|
-
function
|
|
611
|
-
return
|
|
596
|
+
function z() {
|
|
597
|
+
return E.value?.entries[T.value] ?? null;
|
|
612
598
|
}
|
|
613
|
-
function
|
|
599
|
+
function B(e) {
|
|
614
600
|
if (e.key === "Escape") {
|
|
615
|
-
e.preventDefault(),
|
|
601
|
+
e.preventDefault(), N();
|
|
616
602
|
return;
|
|
617
603
|
}
|
|
618
604
|
if (e.key === "Tab") {
|
|
619
|
-
|
|
605
|
+
N();
|
|
620
606
|
return;
|
|
621
607
|
}
|
|
622
|
-
let t =
|
|
608
|
+
let t = E.value?.entries ?? [];
|
|
623
609
|
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
624
610
|
e.preventDefault();
|
|
625
611
|
let n = t.length;
|
|
626
|
-
n > 0 && (
|
|
612
|
+
n > 0 && (T.value = (T.value + (e.key === "ArrowDown" ? 1 : n - 1)) % n);
|
|
627
613
|
return;
|
|
628
614
|
}
|
|
629
615
|
if (e.key === "ArrowRight") {
|
|
630
|
-
let t =
|
|
631
|
-
t?.drillable && (e.preventDefault(),
|
|
616
|
+
let t = z();
|
|
617
|
+
t?.drillable && (e.preventDefault(), I(t));
|
|
632
618
|
return;
|
|
633
619
|
}
|
|
634
620
|
if (e.key === "ArrowLeft") {
|
|
635
|
-
|
|
621
|
+
w.value.length > 1 && (e.preventDefault(), L());
|
|
636
622
|
return;
|
|
637
623
|
}
|
|
638
624
|
if (e.key === "Enter" || e.key === " ") {
|
|
639
|
-
let t =
|
|
640
|
-
t !== null && (e.preventDefault(),
|
|
625
|
+
let t = z();
|
|
626
|
+
t !== null && (e.preventDefault(), R(t));
|
|
641
627
|
}
|
|
642
628
|
}
|
|
643
|
-
let
|
|
644
|
-
function
|
|
645
|
-
if (!
|
|
646
|
-
let e =
|
|
629
|
+
let V = _(null), H = _(null), U = _(null), W = _(0), G = _(0);
|
|
630
|
+
function K() {
|
|
631
|
+
if (!y.value) return;
|
|
632
|
+
let e = V.value, t = U.value;
|
|
647
633
|
if (e === null) return;
|
|
648
|
-
let n =
|
|
634
|
+
let n = $({
|
|
649
635
|
anchor: e.getBoundingClientRect(),
|
|
650
636
|
popupWidth: t?.offsetWidth ?? 0,
|
|
651
637
|
popupHeight: t?.offsetHeight ?? 0,
|
|
652
638
|
viewportWidth: window.innerWidth,
|
|
653
639
|
viewportHeight: window.innerHeight
|
|
654
640
|
});
|
|
655
|
-
|
|
641
|
+
W.value = n.top, G.value = n.left;
|
|
656
642
|
}
|
|
657
|
-
function
|
|
658
|
-
|
|
643
|
+
function q() {
|
|
644
|
+
K();
|
|
659
645
|
}
|
|
660
|
-
|
|
661
|
-
e ? (window.addEventListener("pointerdown",
|
|
646
|
+
S(y, (e) => {
|
|
647
|
+
e ? (window.addEventListener("pointerdown", J), window.addEventListener("keydown", Y), window.addEventListener("scroll", q, !0), window.addEventListener("resize", q)) : X();
|
|
662
648
|
});
|
|
663
|
-
function
|
|
649
|
+
function J(e) {
|
|
664
650
|
let t = e.target;
|
|
665
|
-
t instanceof Node && (
|
|
651
|
+
t instanceof Node && (V.value?.contains(t) || U.value?.contains(t) || P());
|
|
666
652
|
}
|
|
667
|
-
function
|
|
668
|
-
e.key === "Escape" &&
|
|
653
|
+
function Y(e) {
|
|
654
|
+
e.key === "Escape" && N();
|
|
669
655
|
}
|
|
670
|
-
function
|
|
671
|
-
window.removeEventListener("pointerdown",
|
|
656
|
+
function X() {
|
|
657
|
+
window.removeEventListener("pointerdown", J), window.removeEventListener("keydown", Y), window.removeEventListener("scroll", q, !0), window.removeEventListener("resize", q);
|
|
672
658
|
}
|
|
673
|
-
return
|
|
659
|
+
return m(X, !0), (t, i) => (g(), s("div", {
|
|
674
660
|
ref_key: "rootRef",
|
|
675
|
-
ref:
|
|
661
|
+
ref: V,
|
|
676
662
|
class: "cn-pathpicker flex w-full items-center gap-1.5"
|
|
677
663
|
}, [
|
|
678
|
-
|
|
679
|
-
class:
|
|
664
|
+
c("div", {
|
|
665
|
+
class: f(["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
666
|
title: e.modelValue,
|
|
681
667
|
"aria-label": e.ariaLabel
|
|
682
|
-
},
|
|
683
|
-
|
|
668
|
+
}, b(e.modelValue === "" ? e.placeholder ?? "点击右侧按钮选择字段" : e.modelValue), 11, me),
|
|
669
|
+
h.value ? (g(), s("button", {
|
|
684
670
|
key: 0,
|
|
685
671
|
ref_key: "toggleButton",
|
|
686
|
-
ref:
|
|
672
|
+
ref: H,
|
|
687
673
|
type: "button",
|
|
688
674
|
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
675
|
"aria-haspopup": "menu",
|
|
690
|
-
"aria-expanded":
|
|
676
|
+
"aria-expanded": y.value,
|
|
691
677
|
"aria-label": e.ariaLabel === void 0 ? "选择字段路径" : `选择字段路径(${e.ariaLabel})`,
|
|
692
678
|
title: "选择字段路径",
|
|
693
|
-
onClick:
|
|
694
|
-
}, "▾", 8, he)) :
|
|
695
|
-
(
|
|
679
|
+
onClick: F
|
|
680
|
+
}, "▾", 8, he)) : o("", !0),
|
|
681
|
+
(g(), a(r, { to: "body" }, [y.value && E.value !== null ? (g(), s("div", {
|
|
696
682
|
key: 0,
|
|
697
683
|
ref_key: "menuRoot",
|
|
698
|
-
ref:
|
|
684
|
+
ref: U,
|
|
699
685
|
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:
|
|
701
|
-
top: `${
|
|
702
|
-
left: `${
|
|
686
|
+
style: p({
|
|
687
|
+
top: `${W.value}px`,
|
|
688
|
+
left: `${G.value}px`
|
|
703
689
|
}),
|
|
704
690
|
role: "menu",
|
|
705
691
|
"aria-label": e.ariaLabel === void 0 ? "字段路径菜单" : `${e.ariaLabel} 字段路径菜单`,
|
|
706
692
|
tabindex: "-1",
|
|
707
|
-
onKeydown:
|
|
708
|
-
onPointerdown:
|
|
693
|
+
onKeydown: C(B, ["stop"]),
|
|
694
|
+
onPointerdown: i[0] ||= C(() => {}, ["stop"])
|
|
709
695
|
}, [
|
|
710
|
-
|
|
696
|
+
w.value.length > 1 ? (g(), s("button", {
|
|
711
697
|
key: 0,
|
|
712
698
|
type: "button",
|
|
713
699
|
role: "menuitem",
|
|
714
700
|
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:
|
|
716
|
-
}, [
|
|
717
|
-
|
|
718
|
-
(
|
|
701
|
+
onClick: L
|
|
702
|
+
}, [i[1] ||= c("span", { "aria-hidden": "true" }, "‹", -1), c("span", _e, b(D.value), 1)])) : o("", !0),
|
|
703
|
+
E.value.entries.length === 0 ? (g(), s("div", ve, b(O.value), 1)) : o("", !0),
|
|
704
|
+
(g(!0), s(n, null, v(A.value, (e, t) => (g(), s("button", {
|
|
719
705
|
key: `${e.entry.path}`,
|
|
720
706
|
type: "button",
|
|
721
707
|
role: "menuitem",
|
|
722
|
-
class:
|
|
708
|
+
class: f(["cn-pathpicker__option flex w-full items-center gap-1.5 px-2 py-1.5 text-left", t === T.value ? "cn-pathpicker__option--active" : ""]),
|
|
723
709
|
"aria-label": e.entry.path,
|
|
724
710
|
title: e.entry.path,
|
|
725
|
-
onClick: (t) =>
|
|
726
|
-
onMousemove: (e) =>
|
|
711
|
+
onClick: (t) => R(e.entry),
|
|
712
|
+
onMousemove: (e) => T.value = t
|
|
727
713
|
}, [
|
|
728
|
-
e.prefix === "" ?
|
|
729
|
-
|
|
730
|
-
e.entry.item.type ? (
|
|
731
|
-
e.entry.item.description ?? e.entry.item.title ? (
|
|
732
|
-
e.entry.drillable ? (
|
|
733
|
-
], 42,
|
|
734
|
-
], 44, ge)) :
|
|
714
|
+
e.prefix === "" ? o("", !0) : (g(), s("span", be, b(e.prefix) + " " + b(x("›")), 1)),
|
|
715
|
+
c("span", { class: f(["cn-pathpicker__segment truncate font-mono text-cn-fg", e.prefix === "" ? "min-w-0" : "shrink-0 max-w-full"]) }, b(e.entry.item.segment), 3),
|
|
716
|
+
e.entry.item.type ? (g(), s("span", xe, b(k(e.entry.item.type)), 1)) : o("", !0),
|
|
717
|
+
e.entry.item.description ?? e.entry.item.title ? (g(), s("span", Se, b(e.entry.item.description ?? e.entry.item.title), 1)) : o("", !0),
|
|
718
|
+
e.entry.drillable ? (g(), s("span", Ce, "›")) : o("", !0)
|
|
719
|
+
], 42, ye))), 128))
|
|
720
|
+
], 44, ge)) : o("", !0)]))
|
|
735
721
|
], 512));
|
|
736
722
|
}
|
|
737
|
-
})
|
|
723
|
+
}), Te = 300, Ee = 0, De = /*#__PURE__*/ t(/* @__PURE__ */ l({
|
|
724
|
+
inheritAttrs: !1,
|
|
725
|
+
__name: "Tooltip",
|
|
726
|
+
props: {
|
|
727
|
+
label: {},
|
|
728
|
+
delay: { default: Te }
|
|
729
|
+
},
|
|
730
|
+
setup(e) {
|
|
731
|
+
let t = e, n = _(null), i = _(null), c = _(!1), l = _({
|
|
732
|
+
top: 0,
|
|
733
|
+
left: 0
|
|
734
|
+
}), f = `cn-tooltip-${++Ee}`, m = null;
|
|
735
|
+
function v() {
|
|
736
|
+
m !== null && (clearTimeout(m), m = null);
|
|
737
|
+
}
|
|
738
|
+
function x() {
|
|
739
|
+
return n.value?.firstElementChild ?? null;
|
|
740
|
+
}
|
|
741
|
+
async function S() {
|
|
742
|
+
let e = n.value?.getBoundingClientRect();
|
|
743
|
+
if (e && (l.value = $({
|
|
744
|
+
anchor: {
|
|
745
|
+
top: e.top,
|
|
746
|
+
bottom: e.bottom,
|
|
747
|
+
left: e.left
|
|
748
|
+
},
|
|
749
|
+
popupWidth: 0,
|
|
750
|
+
popupHeight: 0,
|
|
751
|
+
viewportWidth: window.innerWidth,
|
|
752
|
+
viewportHeight: window.innerHeight
|
|
753
|
+
})), c.value = !0, x()?.setAttribute("aria-describedby", f), await d(), !c.value || e === void 0) return;
|
|
754
|
+
let t = i.value?.getBoundingClientRect();
|
|
755
|
+
t !== void 0 && (l.value = $({
|
|
756
|
+
anchor: {
|
|
757
|
+
top: e.top,
|
|
758
|
+
bottom: e.bottom,
|
|
759
|
+
left: e.left
|
|
760
|
+
},
|
|
761
|
+
popupWidth: t.width,
|
|
762
|
+
popupHeight: t.height,
|
|
763
|
+
viewportWidth: window.innerWidth,
|
|
764
|
+
viewportHeight: window.innerHeight
|
|
765
|
+
}));
|
|
766
|
+
}
|
|
767
|
+
function C() {
|
|
768
|
+
v(), c.value && (c.value = !1, x()?.removeAttribute("aria-describedby"));
|
|
769
|
+
}
|
|
770
|
+
function w() {
|
|
771
|
+
v(), m = setTimeout(() => {
|
|
772
|
+
m = null, S();
|
|
773
|
+
}, t.delay);
|
|
774
|
+
}
|
|
775
|
+
function T() {
|
|
776
|
+
v(), S();
|
|
777
|
+
}
|
|
778
|
+
return h(v), (t, d) => (g(), s("div", u({
|
|
779
|
+
ref_key: "wrapperEl",
|
|
780
|
+
ref: n,
|
|
781
|
+
class: "cn-tooltip"
|
|
782
|
+
}, t.$attrs, {
|
|
783
|
+
onMouseenter: w,
|
|
784
|
+
onMouseleave: d[0] ||= (e) => C(),
|
|
785
|
+
onFocusin: T,
|
|
786
|
+
onFocusout: d[1] ||= (e) => C(),
|
|
787
|
+
onPointerdownCapture: d[2] ||= (e) => C()
|
|
788
|
+
}), [y(t.$slots, "default", {}, void 0, !0), (g(), a(r, { to: "body" }, [c.value ? (g(), s("div", {
|
|
789
|
+
key: 0,
|
|
790
|
+
id: f,
|
|
791
|
+
ref_key: "bubbleEl",
|
|
792
|
+
ref: i,
|
|
793
|
+
role: "tooltip",
|
|
794
|
+
class: "cn-tooltip__bubble",
|
|
795
|
+
"data-tooltip": "",
|
|
796
|
+
style: p({
|
|
797
|
+
top: `${l.value.top}px`,
|
|
798
|
+
left: `${l.value.left}px`
|
|
799
|
+
})
|
|
800
|
+
}, b(e.label), 5)) : o("", !0)]))], 16));
|
|
801
|
+
}
|
|
802
|
+
}), [["__scopeId", "data-v-829a3860"]]);
|
|
738
803
|
//#endregion
|
|
739
|
-
export {
|
|
804
|
+
export { D as _, $ as a, se as c, W as d, B as f, O as g, F as h, pe as i, ie as l, R as m, we as n, Q as o, U as p, fe as r, oe as s, De as t, z as u, E as v, T as y };
|