@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.
@@ -1,7 +1,7 @@
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";
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 y(e) {
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 b(e, t) {
12
+ function T(e, t) {
13
13
  let n = e;
14
14
  for (let e of t) {
15
- let t = y(n)?.get(e);
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 x(e) {
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 S(e, t) {
27
+ function D(e, t) {
28
28
  let n = t.split(".");
29
- return t === "" || n.includes("") ? null : b(e, n)?.items ?? 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 C(e) {
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 w = " \n\r\0\v", T = " \n\r", E = `()',.${w}`;
64
- function D(e) {
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 && w.includes(e[t]);) t += 1;
67
- for (; n > t && w.includes(e[n - 1]);) --n;
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 O(e, t) {
71
- for (; t < e.length && T.includes(e[t]);) t += 1;
70
+ function N(e, t) {
71
+ for (; t < e.length && A.includes(e[t]);) t += 1;
72
72
  return t;
73
73
  }
74
- function k(e, t, n) {
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 A(e) {
85
+ function F(e) {
86
86
  let t = 0;
87
- for (; t < e.length && !E.includes(e[t]);) t += 1;
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 && w.includes(e[n]);) n += 1;
90
+ for (; n < e.length && k.includes(e[n]);) n += 1;
91
91
  return e[n] === "(";
92
92
  }
93
- function j(e) {
93
+ function I(e) {
94
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);
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 = O(e, r + 1);
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 k("unbalanced_paren", i, e.length);
105
- let t = M(e, r);
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 = O(e, t.end), r >= e.length) return k("unbalanced_paren", i, e.length);
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 = O(e, r + 1), r < e.length && e[r] === ")") return k("empty_arg_slot", t + 1, 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 k("bad_arg_syntax", r, r + 1);
120
+ return P("bad_arg_syntax", r, r + 1);
121
121
  }
122
- if (r = O(e, r), r !== e.length) return k("trailing_after_call", r, e.length);
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 k("first_arg_not_path", e.start, e.end);
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" && !C(t.value).ok) return k("invalid_path_arg", n.start, n.end);
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 M(e, t) {
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 = D(e.slice(r, t));
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 N(e) {
208
+ function R(e) {
209
209
  let t = 0;
210
- for (; t < e.length && !E.includes(e[t]);) t += 1;
210
+ for (; t < e.length && !j.includes(e[t]);) t += 1;
211
211
  if (t === 0) return null;
212
- let n = O(e, t);
212
+ let n = N(e, t);
213
213
  if (n >= e.length || e[n] !== "(") return null;
214
- n = O(e, n + 1);
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: D(e.slice(i)),
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 = O(e, n + 1);
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 P = " \n\r\0\v";
267
- function F(e) {
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 I(e) {
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 (A(e)) {
282
- let t = j(e);
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 C(e).ok ? null : {
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 L(e) {
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 R(e) {
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: F(i.slice(2))
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 = F(a), s = null, c = 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 + L(a);
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 z(e, t) {
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 B(e) {
369
+ function G(e) {
370
370
  return e.type === "array" || e.items !== void 0;
371
371
  }
372
- function V(e) {
373
- return !B(e) && e.properties === void 0;
372
+ function K(e) {
373
+ return !G(e) && e.properties === void 0;
374
374
  }
375
- function H(e, t) {
375
+ function q(e, t) {
376
376
  return e === "" ? t : `${e}.${t}`;
377
377
  }
378
- function U(e, t) {
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 W(e, t) {
381
+ function Y(e, t) {
382
382
  let n = e;
383
383
  for (let e of t) {
384
- if (B(n)) return null;
385
- let t = b(n, [e]);
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 B(n) || V(n) ? null : n;
389
+ return G(n) || K(n) ? null : n;
390
390
  }
391
- function G(e, t, n) {
392
- let r = U({
393
- path: H(n, e),
391
+ function X(e, t, n) {
392
+ let r = J({
393
+ path: q(n, e),
394
394
  segment: e
395
395
  }, t);
396
- return B(t) && (r.type = "array"), r;
396
+ return G(t) && (r.type = "array"), r;
397
397
  }
398
- function K(e, t) {
398
+ function ee(e, t) {
399
399
  let n = [];
400
- if (e.properties !== void 0) for (let [r, i] of e.properties) V(i) || n.push(G(r, i, t));
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 q(e, t) {
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 = W(e, i);
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: K(a, i.join("."))
408
+ candidates: ee(a, i.join("."))
409
409
  };
410
410
  }
411
- function J(e) {
412
- if (B(e)) return !0;
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 (J(t)) return !0;
414
+ for (let t of e.properties.values()) if (Z(t)) return !0;
415
415
  return !1;
416
416
  }
417
- function Y(e, t, n) {
418
- return U({
419
- path: H(n, e),
417
+ function ne(e, t, n) {
418
+ return J({
419
+ path: q(n, e),
420
420
  segment: e,
421
- isArray: B(t)
421
+ isArray: G(t)
422
422
  }, t);
423
423
  }
424
- function X(e, t) {
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 = W(e, n);
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) J(n) && i.push(Y(e, n, t));
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 re(t, n, r) {
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 = S(i ?? r, o.rowsPath), i === null)) return null;
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/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 = "行数组";
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: X(e, t.endsWith(".") ? t.slice(0, -1) : t).map((e) => ({
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 = q(e, t);
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 Z(e, t, n = "resource") {
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 Q(e) {
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
- ], ye = {
526
+ ], be = {
541
527
  key: 0,
542
528
  class: "cn-pathpicker__prefix min-w-0 truncate font-mono text-cn-muted"
543
- }, be = {
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
- }, xe = {
532
+ }, Se = {
547
533
  key: 2,
548
534
  class: "min-w-0 flex-1 truncate text-[10px] leading-none text-cn-muted"
549
- }, Se = {
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
- }, Ce = /* @__PURE__ */ c({
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: 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];
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
- }), T = r(() => l.mode === "rowsPath" ? "声明中未发现行数组,请检查数据源绑定" : "无可选字段");
569
- function E(e) {
554
+ }), O = i(() => l.mode === "rowsPath" ? "声明中未发现行数组,请检查数据源绑定" : "无可选字段");
555
+ function k(e) {
570
556
  return l.mode === "rowsPath" && e === "array" ? ae : e;
571
557
  }
572
- let D = r(() => (C.value?.entries ?? []).map((e) => ({
558
+ let A = i(() => (E.value?.entries ?? []).map((e) => ({
573
559
  entry: e,
574
560
  prefix: de(e.path)
575
561
  })));
576
- function O(e, t) {
562
+ function j(e, t) {
577
563
  return {
578
564
  prefix: e,
579
565
  label: t,
580
- entries: l.source === null ? [] : Z(l.source, e, l.mode)
566
+ entries: l.source === null ? [] : Q(l.source, e, l.mode)
581
567
  };
582
568
  }
583
- function k() {
584
- y.value && !b.value && (x.value = [O("", "")], S.value = 0, b.value = !0, u(() => {
585
- U(), B.value?.focus();
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 A() {
589
- b.value && (j(), z.value?.focus());
574
+ function N() {
575
+ y.value && (P(), H.value?.focus());
590
576
  }
591
- function j() {
592
- b.value = !1, x.value = [], S.value = 0;
577
+ function P() {
578
+ y.value = !1, w.value = [], T.value = 0;
593
579
  }
594
- function M() {
595
- b.value ? A() : k();
580
+ function F() {
581
+ y.value ? N() : M();
596
582
  }
597
- function N(e) {
598
- l.source !== null && (x.value.push(O(`${e.path}.`, e.path)), S.value = 0, u(U));
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 P() {
601
- x.value.length <= 1 || (x.value.pop(), S.value = 0, u(U));
586
+ function L() {
587
+ w.value.length <= 1 || (w.value.pop(), T.value = 0, d(K));
602
588
  }
603
- function F(e) {
589
+ function R(e) {
604
590
  if (e.drillable) {
605
- N(e);
591
+ I(e);
606
592
  return;
607
593
  }
608
- e.activatable && (h("update:modelValue", e.path), h("change", e.path), A());
594
+ e.activatable && (u("update:modelValue", e.path), u("change", e.path), N());
609
595
  }
610
- function I() {
611
- return C.value?.entries[S.value] ?? null;
596
+ function z() {
597
+ return E.value?.entries[T.value] ?? null;
612
598
  }
613
- function L(e) {
599
+ function B(e) {
614
600
  if (e.key === "Escape") {
615
- e.preventDefault(), A();
601
+ e.preventDefault(), N();
616
602
  return;
617
603
  }
618
604
  if (e.key === "Tab") {
619
- A();
605
+ N();
620
606
  return;
621
607
  }
622
- let t = C.value?.entries ?? [];
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 && (S.value = (S.value + (e.key === "ArrowDown" ? 1 : n - 1)) % n);
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 = I();
631
- t?.drillable && (e.preventDefault(), N(t));
616
+ let t = z();
617
+ t?.drillable && (e.preventDefault(), I(t));
632
618
  return;
633
619
  }
634
620
  if (e.key === "ArrowLeft") {
635
- x.value.length > 1 && (e.preventDefault(), P());
621
+ w.value.length > 1 && (e.preventDefault(), L());
636
622
  return;
637
623
  }
638
624
  if (e.key === "Enter" || e.key === " ") {
639
- let t = I();
640
- t !== null && (e.preventDefault(), F(t));
625
+ let t = z();
626
+ t !== null && (e.preventDefault(), R(t));
641
627
  }
642
628
  }
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;
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 = Q({
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
- V.value = n.top, H.value = n.left;
641
+ W.value = n.top, G.value = n.left;
656
642
  }
657
- function W() {
658
- U();
643
+ function q() {
644
+ K();
659
645
  }
660
- ne(b, (e) => {
661
- e ? (window.addEventListener("pointerdown", G), window.addEventListener("keydown", K), window.addEventListener("scroll", W, !0), window.addEventListener("resize", W)) : q();
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 G(e) {
649
+ function J(e) {
664
650
  let t = e.target;
665
- t instanceof Node && (R.value?.contains(t) || B.value?.contains(t) || j());
651
+ t instanceof Node && (V.value?.contains(t) || U.value?.contains(t) || P());
666
652
  }
667
- function K(e) {
668
- e.key === "Escape" && A();
653
+ function Y(e) {
654
+ e.key === "Escape" && N();
669
655
  }
670
- function q() {
671
- window.removeEventListener("pointerdown", G), window.removeEventListener("keydown", K), window.removeEventListener("scroll", W, !0), window.removeEventListener("resize", W);
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 ee(q, !0), (r, c) => (p(), o("div", {
659
+ return m(X, !0), (t, i) => (g(), s("div", {
674
660
  ref_key: "rootRef",
675
- ref: R,
661
+ ref: V,
676
662
  class: "cn-pathpicker flex w-full items-center gap-1.5"
677
663
  }, [
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" : ""]),
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
- }, g(e.modelValue === "" ? e.placeholder ?? "点击右侧按钮选择字段" : e.modelValue), 11, me),
683
- y.value ? (p(), o("button", {
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: z,
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": b.value,
676
+ "aria-expanded": y.value,
691
677
  "aria-label": e.ariaLabel === void 0 ? "选择字段路径" : `选择字段路径(${e.ariaLabel})`,
692
678
  title: "选择字段路径",
693
- onClick: M
694
- }, "▾", 8, he)) : a("", !0),
695
- (p(), i(n, { to: "body" }, [b.value && C.value !== null ? (p(), o("div", {
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: B,
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: f({
701
- top: `${V.value}px`,
702
- left: `${H.value}px`
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: v(L, ["stop"]),
708
- onPointerdown: c[0] ||= v(() => {}, ["stop"])
693
+ onKeydown: C(B, ["stop"]),
694
+ onPointerdown: i[0] ||= C(() => {}, ["stop"])
709
695
  }, [
710
- x.value.length > 1 ? (p(), o("button", {
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: 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", {
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: 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" : ""]),
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) => F(e.entry),
726
- onMousemove: (e) => S.value = t
711
+ onClick: (t) => R(e.entry),
712
+ onMousemove: (e) => T.value = t
727
713
  }, [
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)]))
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 { 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 };
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 };