rowvia 0.3.4 → 0.3.5

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.
Files changed (45) hide show
  1. package/dist/fields.css +1 -1
  2. package/dist/fields.es.js +1167 -1104
  3. package/dist/fields.umd.cjs +1 -1
  4. package/dist/rowvia.css +1 -1
  5. package/dist/rowvia.es.js +5835 -4705
  6. package/dist/rowvia.umd.cjs +71 -55
  7. package/dist/types/components/scrollbars.d.ts +11 -3
  8. package/dist/types/components/table-cell-content.d.ts +9 -0
  9. package/dist/types/components/table-groups.d.ts +32 -0
  10. package/dist/types/components/table-headers.d.ts +11 -0
  11. package/dist/types/components/table-inline-editor.d.ts +13 -0
  12. package/dist/types/components/table-popup.d.ts +3 -0
  13. package/dist/types/components/table-presentation.d.ts +14 -0
  14. package/dist/types/components/table-text-editor.d.ts +29 -0
  15. package/dist/types/conditions/index.d.ts +12 -0
  16. package/dist/types/contracts/work-item.d.ts +1 -1
  17. package/dist/types/fields/internal/anchored-popup.d.ts +23 -0
  18. package/dist/types/fields/popup.d.ts +7 -9
  19. package/dist/types/fields/types.d.ts +3 -0
  20. package/dist/types/index.d.ts +1 -0
  21. package/dist/types/vue/DualPanePicker.d.ts +211 -0
  22. package/dist/types/vue/controls.d.ts +3961 -0
  23. package/dist/types/vue/index.d.ts +6 -0
  24. package/dist/types/vue/registry.d.ts +10 -0
  25. package/dist/types/vue-conditions/ConditionGroup.d.ts +120 -0
  26. package/dist/types/vue-conditions/ConditionRow.d.ts +94 -0
  27. package/dist/types/vue-conditions/ConditionValue.d.ts +56 -0
  28. package/dist/types/vue-conditions/controls.d.ts +12 -0
  29. package/dist/types/vue-conditions/index.d.ts +6 -0
  30. package/dist/types/work-items/index.d.ts +13 -1
  31. package/dist/types/work-items/tool-field-picker.d.ts +14 -0
  32. package/dist/types/work-items/tool-filter.d.ts +14 -0
  33. package/dist/types/work-items/tool-icons.d.ts +1 -0
  34. package/dist/types/work-items/tool-panel.d.ts +17 -0
  35. package/dist/types/work-items/tool-state.d.ts +21 -0
  36. package/dist/types/work-items/toolbar.d.ts +10 -2
  37. package/dist/types/work-items/views/rule-panels.d.ts +2 -0
  38. package/dist/types/work-items/workflow-detail-types.d.ts +16 -0
  39. package/dist/types/work-items/workflow-field-popups.d.ts +4 -0
  40. package/dist/types/work-items/workflow-legend.d.ts +16 -0
  41. package/dist/types/work-items/workflow-presentation.d.ts +3 -0
  42. package/dist/vue.css +1 -0
  43. package/dist/vue.es.js +631 -0
  44. package/dist/vue.umd.cjs +1 -0
  45. package/package.json +26 -7
package/dist/fields.es.js CHANGED
@@ -1,10 +1,10 @@
1
- var Ge = Object.defineProperty;
2
- var Je = (t, e, n) => e in t ? Ge(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var _ = (t, e, n) => Je(t, typeof e != "symbol" ? e + "" : e, n);
1
+ var ot = Object.defineProperty;
2
+ var rt = (t, e, n) => e in t ? ot(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
+ var z = (t, e, n) => rt(t, typeof e != "symbol" ? e + "" : e, n);
4
4
  class he {
5
5
  constructor() {
6
- _(this, "cleanups", /* @__PURE__ */ new Set());
7
- _(this, "stopped", !1);
6
+ z(this, "cleanups", /* @__PURE__ */ new Set());
7
+ z(this, "stopped", !1);
8
8
  }
9
9
  get destroyed() {
10
10
  return this.stopped;
@@ -14,22 +14,22 @@ class he {
14
14
  this.cleanups.delete(e) && e();
15
15
  };
16
16
  }
17
- listen(e, n, i, o) {
18
- return e.addEventListener(n, i, o), this.add(() => e.removeEventListener(n, i, o));
17
+ listen(e, n, s, i) {
18
+ return e.addEventListener(n, s, i), this.add(() => e.removeEventListener(n, s, i));
19
19
  }
20
20
  timeout(e, n) {
21
21
  if (this.stopped) return 0;
22
- const i = window.setTimeout(() => {
23
- o(), this.stopped || e();
24
- }, n), o = this.add(() => window.clearTimeout(i));
25
- return i;
22
+ const s = window.setTimeout(() => {
23
+ i(), this.stopped || e();
24
+ }, n), i = this.add(() => window.clearTimeout(s));
25
+ return s;
26
26
  }
27
27
  interval(e, n) {
28
28
  if (this.stopped) return 0;
29
- const i = window.setInterval(() => {
29
+ const s = window.setInterval(() => {
30
30
  this.stopped || e();
31
31
  }, n);
32
- return this.add(() => window.clearInterval(i)), i;
32
+ return this.add(() => window.clearInterval(s)), s;
33
33
  }
34
34
  destroy() {
35
35
  if (this.stopped) return;
@@ -37,151 +37,197 @@ class he {
37
37
  const e = [...this.cleanups].reverse();
38
38
  this.cleanups.clear();
39
39
  let n;
40
- for (const i of e)
40
+ for (const s of e)
41
41
  try {
42
- i();
43
- } catch (o) {
44
- n ?? (n = o);
42
+ s();
43
+ } catch (i) {
44
+ n ?? (n = i);
45
45
  }
46
46
  if (n !== void 0) throw n;
47
47
  }
48
48
  }
49
- function Qe(t, e, n = {}, i = []) {
50
- const o = new he(), r = /* @__PURE__ */ new Set(), s = (p) => [...r].some((b) => b.contains(p)), c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new WeakMap(), f = (p) => {
51
- const b = p.target;
52
- if (!(b != null && b.closest)) return;
53
- const h = b.closest('button,input,select,textarea,a,[data-action],[contenteditable],[role="button"],[role="tab"],[data-node-id],[data-rowid],[data-viewport],canvas');
54
- if (!h || !s(h)) return;
55
- const E = {};
56
- for (let m = h; m && s(m); m = m.parentElement)
57
- for (const [L, V] of Object.entries(m.dataset))
58
- V !== void 0 && !(L in E) && (E[L] = V);
59
- const M = h;
49
+ function at(t, e, n = {}, s = []) {
50
+ const i = new he(), r = /* @__PURE__ */ new Set(), o = (p) => [...r].some((g) => g.contains(p)), c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new WeakMap(), m = (p) => {
51
+ const g = p.target;
52
+ if (!(g != null && g.closest)) return;
53
+ const f = g.closest('button,input,select,textarea,a,[data-action],[contenteditable],[role="button"],[role="tab"],[data-node-id],[data-rowid],[data-viewport],canvas');
54
+ if (!f || !o(f)) return;
55
+ const y = {};
56
+ for (let w = f; w && o(w); w = w.parentElement)
57
+ for (const [x, N] of Object.entries(w.dataset))
58
+ N !== void 0 && !(x in y) && (y[x] = N);
59
+ const D = f;
60
60
  u.has(p) || (u.set(p, {
61
61
  component: e,
62
62
  type: p.type,
63
- action: E.action ?? E.control,
64
- value: "value" in h ? M.value : void 0,
65
- checked: M.type === "checkbox" || M.type === "radio" ? M.checked : void 0,
66
- data: E,
63
+ action: y.action ?? y.control,
64
+ value: "value" in f ? D.value : void 0,
65
+ checked: D.type === "checkbox" || D.type === "radio" ? D.checked : void 0,
66
+ data: y,
67
67
  originalEvent: p
68
- }), queueMicrotask(() => y(p)));
69
- }, y = (p) => {
70
- var E;
71
- const b = u.get(p);
72
- if (!b || o.destroyed) return;
73
- u.delete(p), (E = n.onInteraction) == null || E.call(n, b);
74
- for (const M of [...c]) M(b);
75
- const h = t.ownerDocument.defaultView.CustomEvent;
76
- t.dispatchEvent(new h("rowvia:interaction", { detail: b, bubbles: !0 }));
77
- }, T = (p) => {
78
- if (o.destroyed || r.has(p)) return () => {
68
+ }), queueMicrotask(() => E(p)));
69
+ }, E = (p) => {
70
+ var y;
71
+ const g = u.get(p);
72
+ if (!g || i.destroyed) return;
73
+ u.delete(p), (y = n.onInteraction) == null || y.call(n, g);
74
+ for (const D of [...c]) D(g);
75
+ const f = t.ownerDocument.defaultView.CustomEvent;
76
+ t.dispatchEvent(new f("rowvia:interaction", { detail: g, bubbles: !0 }));
77
+ }, M = (p) => {
78
+ if (i.destroyed || r.has(p)) return () => {
79
79
  };
80
80
  r.add(p);
81
- const b = [];
82
- for (const h of ["click", "dblclick", "contextmenu", "input", "change", "submit", "keydown", "pointerdown", "pointerup", "wheel"])
83
- b.push(o.listen(p, h, f, { capture: !0, passive: !0 }));
81
+ const g = [];
82
+ for (const f of ["click", "dblclick", "contextmenu", "input", "change", "submit", "keydown", "pointerdown", "pointerup", "wheel"])
83
+ g.push(i.listen(p, f, m, { capture: !0, passive: !0 }));
84
84
  return () => {
85
- r.delete(p), b.forEach((h) => h());
85
+ r.delete(p), g.forEach((f) => f());
86
86
  };
87
87
  };
88
- for (const p of [t, ...i]) T(p);
88
+ for (const p of [t, ...s]) M(p);
89
89
  return {
90
- addRoot: T,
90
+ addRoot: M,
91
91
  onInteraction(p) {
92
- return o.destroyed ? () => {
92
+ return i.destroyed ? () => {
93
93
  } : (c.add(p), () => {
94
94
  c.delete(p);
95
95
  });
96
96
  },
97
97
  destroy() {
98
- o.destroy(), c.clear(), r.clear();
98
+ i.destroy(), c.clear(), r.clear();
99
99
  }
100
100
  };
101
101
  }
102
- const ae = /* @__PURE__ */ new Map();
102
+ function lt(t) {
103
+ for (let e = t.parentElement; e; e = (e == null ? void 0 : e.parentElement) ?? null) {
104
+ const n = (t.ownerDocument.defaultView || window).getComputedStyle(e), s = (r) => !!r && r !== "none";
105
+ if (!s(n.transform) && !s(n.filter) && !s(n.perspective) && !/transform|filter|perspective/.test(n.willChange ?? "")) continue;
106
+ const i = e.getBoundingClientRect();
107
+ return { x: i.left + (parseFloat(n.borderLeftWidth) || 0), y: i.top + (parseFloat(n.borderTopWidth) || 0) };
108
+ }
109
+ return { x: 0, y: 0 };
110
+ }
111
+ function dt(t, e, n, s, i = {}) {
112
+ var x, N;
113
+ const r = e.ownerDocument, o = r.defaultView || window;
114
+ let c = !1, u = !1, m = 0;
115
+ const E = ((x = o.requestAnimationFrame) == null ? void 0 : x.bind(o)) ?? ((S) => o.setTimeout(() => S(0), 0)), M = ((N = o.cancelAnimationFrame) == null ? void 0 : N.bind(o)) ?? o.clearTimeout.bind(o), p = () => {
116
+ var k;
117
+ if (c) return;
118
+ if (!e.isConnected || !t.isConnected) {
119
+ u || (u = !0, w(), s());
120
+ return;
121
+ }
122
+ if ((k = i.paused) != null && k.call(i)) return;
123
+ (!t.style.left || t.style.left === "auto") && (t.style.left = "0px"), (!t.style.top || t.style.top === "auto") && (t.style.top = "0px");
124
+ const S = e.getBoundingClientRect(), b = i.sizeElement ?? t, C = r.documentElement.clientWidth || o.innerWidth, V = r.documentElement.clientHeight || o.innerHeight;
125
+ if (i.width !== void 0) {
126
+ const $ = b.getBoundingClientRect(), U = b.offsetWidth && $.width / b.offsetWidth || 1, _ = i.width === "anchor" ? S.width + (i.widthOffset ?? 0) : typeof i.width == "function" ? i.width() : i.width;
127
+ b.style.width = _ === "auto" ? "max-content" : `${Math.min(_, C - 16) / U}px`;
128
+ }
129
+ const A = t.getBoundingClientRect(), B = b.getBoundingClientRect(), Y = A.width || B.width, q = A.height || B.height, P = t.offsetWidth && A.width / t.offsetWidth || 1, I = t.offsetHeight && A.height / t.offsetHeight || 1, R = !A.width && !A.height && !t.offsetWidth && !t.offsetHeight ? lt(t) : void 0, H = (R == null ? void 0 : R.x) ?? A.left - (parseFloat(t.style.left) || 0) * P, j = (R == null ? void 0 : R.y) ?? A.top - (parseFloat(t.style.top) || 0) * I, l = ($, U, _) => Math.max(8, Math.min($, _ - U - 8)), d = l(i.align === "end" || n === "cell" ? S.right - Y : S.left, Y, C), L = i.gap ?? 4;
130
+ let h = S.bottom + L;
131
+ h + q > V - 8 && S.top - q - L >= 8 && (h = S.top - q - L), t.style.left = `${(d - H) / P}px`, t.style.top = `${(l(h, q, V) - j) / I}px`;
132
+ }, g = () => {
133
+ !c && !m && (m = E(() => {
134
+ m = 0, p();
135
+ }));
136
+ }, f = o.ResizeObserver ?? (typeof ResizeObserver > "u" ? void 0 : ResizeObserver), y = f ? new f(g) : void 0;
137
+ y == null || y.observe(t), y == null || y.observe(e), i.sizeElement && (y == null || y.observe(i.sizeElement));
138
+ const D = new o.MutationObserver(() => {
139
+ (!e.isConnected || !t.isConnected) && g();
140
+ });
141
+ D.observe(r.documentElement, { childList: !0, subtree: !0 }), o.addEventListener("scroll", g, !0), o.addEventListener("resize", g);
142
+ function w() {
143
+ c = !0, M(m), y == null || y.disconnect(), D.disconnect(), o.removeEventListener("scroll", g, !0), o.removeEventListener("resize", g);
144
+ }
145
+ return p(), { update: p, destroy: w };
146
+ }
147
+ const we = Symbol.for("rowvia.field-popup.registry");
148
+ function Ce(t) {
149
+ const e = t;
150
+ return e[we] ?? (e[we] = { live: /* @__PURE__ */ new Map(), presentations: /* @__PURE__ */ new WeakMap() });
151
+ }
103
152
  function be(t, e) {
104
153
  if (!t) return !1;
105
- const n = e ? [e] : [], i = /* @__PURE__ */ new Set();
106
- for (let o = 0; o < Math.max(1, n.length); o++)
107
- for (const [r, s] of ae)
108
- if (!(i.has(r) || e && !n[o].contains(s))) {
109
- if (r.element.contains(t)) return !0;
110
- i.add(r), n.push(r.element);
154
+ const { live: n } = Ce(t.ownerDocument ?? document), s = e ? [e] : [], i = /* @__PURE__ */ new Set();
155
+ for (let r = 0; r < Math.max(1, s.length); r++)
156
+ for (const [o, c] of n)
157
+ if (!(i.has(o) || e && !s[r].contains(c))) {
158
+ if (o.element.contains(t)) return !0;
159
+ i.add(o), s.push(o.element);
111
160
  }
112
161
  return !1;
113
162
  }
114
- function Ze(t) {
115
- for (const [e, n] of [...ae])
116
- (!t || t.contains(n)) && e.close();
163
+ function ct(t) {
164
+ const { live: e } = Ce((t == null ? void 0 : t.ownerDocument) ?? document);
165
+ for (const [n, s] of [...e])
166
+ (!t || t.contains(s)) && n.close();
117
167
  }
118
168
  function ce(t) {
119
- const { anchor: e, content: n, width: i = "anchor", gap: o = 4, onDismiss: r } = t, s = e.ownerDocument, c = s.defaultView || window, u = t.anchorMode === "element" ? e : e.closest(".fc-focus-body") || e, f = s.createElement("div");
120
- f.className = "rowvia-field-scope rowvia-field-popup-layer";
121
- const y = s.createElement("div");
122
- y.className = "rowvia-field-popup", y.append(n), f.append(y), (e.closest("dialog[open]") || s.body || s.documentElement).append(f);
123
- let T = !1;
124
- const p = () => {
125
- if (T || !f.isConnected) return;
126
- const m = u.getBoundingClientRect(), L = s.documentElement.clientWidth || c.innerWidth, V = s.documentElement.clientHeight || c.innerHeight, N = i === "anchor" ? m.width + 2 : i === "auto" ? y.getBoundingClientRect().width : i;
127
- y.style.width = i === "auto" ? "max-content" : N + "px";
128
- const x = y.getBoundingClientRect().height;
129
- let A = m.bottom + o;
130
- const R = m.top - o - x;
131
- A + x > V - 8 && R >= 8 && (A = R), A = Math.max(8, Math.min(A, Math.max(8, V - x - 8)));
132
- const C = Math.max(8, Math.min(t.align === "end" ? m.right - N : m.left, Math.max(8, L - N - 8)));
133
- f.style.top = Math.round(A) + "px", f.style.left = Math.round(C) + "px";
134
- }, b = () => {
135
- T || (T = !0, Ze(f), ae.delete(M), s.removeEventListener("pointerdown", h, !0), s.removeEventListener("keydown", E, !0), c.removeEventListener("resize", p), c.removeEventListener("scroll", p, !0), f.remove(), r == null || r());
136
- }, h = (m) => {
137
- const L = m.target;
138
- L && (f.contains(L) || u.contains(L) || e.contains(L) || be(L, f)) || b();
139
- }, E = (m) => {
140
- if (m.key !== "Escape" || [...ae.keys()][ae.size - 1] !== M) return;
141
- if (m.preventDefault(), m.stopPropagation(), b(), t.onEscape) {
169
+ var S;
170
+ const { live: e, presentations: n } = Ce(t.anchor.ownerDocument);
171
+ let s;
172
+ for (let b = t.anchor; b && (s = (S = n.get(b)) == null ? void 0 : S(t.anchor), !s); b = b.parentElement)
173
+ ;
174
+ t = { ...t, ...s };
175
+ const { anchor: i, content: r, width: o = "anchor", gap: c = 4, onDismiss: u } = t, m = i.ownerDocument, E = t.anchorMode === "element" ? i : i.closest(".fc-focus-body") || i, M = m.createElement("div");
176
+ M.className = "rowvia-field-scope rowvia-field-popup-layer", s != null && s.className && M.classList.add(...s.className.split(/\s+/).filter(Boolean));
177
+ const p = m.createElement("div");
178
+ p.className = "rowvia-field-popup", p.append(r), M.append(p), (i.closest("dialog[open]") || m.body || m.documentElement).append(M);
179
+ let g = !1, f;
180
+ const y = () => f == null ? void 0 : f.update(), D = () => {
181
+ g || (g = !0, ct(M), e.delete(N), m.removeEventListener("pointerdown", w, !0), m.removeEventListener("keydown", x, !0), f == null || f.destroy(), M.remove(), u == null || u());
182
+ }, w = (b) => {
183
+ const C = b.target;
184
+ C && (M.contains(C) || E.contains(C) || i.contains(C) || be(C, M)) || D();
185
+ }, x = (b) => {
186
+ if (b.key !== "Escape" || [...e.keys()][e.size - 1] !== N) return;
187
+ if (b.preventDefault(), b.stopPropagation(), D(), t.onEscape) {
142
188
  t.onEscape();
143
189
  return;
144
190
  }
145
- const L = s.defaultView.CustomEvent;
146
- e.dispatchEvent(new L("fc-collapse", { bubbles: !0, detail: { reason: "escape" } }));
147
- }, M = { element: f, reposition: p, close: b };
148
- return ae.set(M, e), s.addEventListener("pointerdown", h, !0), s.addEventListener("keydown", E, !0), c.addEventListener("resize", p), c.addEventListener("scroll", p, !0), p(), M;
149
- }
150
- const ye = /* @__PURE__ */ new WeakMap();
151
- function Xe(t, e) {
152
- let n = ye.get(t);
191
+ const C = m.defaultView.CustomEvent;
192
+ i.dispatchEvent(new C("fc-collapse", { bubbles: !0, detail: { reason: "escape" } }));
193
+ }, N = { element: M, reposition: y, close: D };
194
+ return e.set(N, i), m.addEventListener("pointerdown", w, !0), m.addEventListener("keydown", x, !0), f = dt(M, E, "below", D, { sizeElement: p, width: o, widthOffset: 2, gap: c, align: t.align }), N;
195
+ }
196
+ const ke = /* @__PURE__ */ new WeakMap();
197
+ function ut(t, e) {
198
+ let n = ke.get(t);
153
199
  if (!n) {
154
- const o = /* @__PURE__ */ new Set(), r = (s) => {
155
- for (const c of [...o])
156
- o.has(c) && !c.contains(s.target, s) && c.leave(s);
200
+ const i = /* @__PURE__ */ new Set(), r = (o) => {
201
+ for (const c of [...i])
202
+ i.has(c) && !c.contains(o.target, o) && c.leave(o);
157
203
  };
158
- t.addEventListener("pointerdown", r, !0), t.addEventListener("focusin", r, !0), n = { boundaries: o, stop: () => {
204
+ t.addEventListener("pointerdown", r, !0), t.addEventListener("focusin", r, !0), n = { boundaries: i, stop: () => {
159
205
  t.removeEventListener("pointerdown", r, !0), t.removeEventListener("focusin", r, !0);
160
- } }, ye.set(t, n);
206
+ } }, ke.set(t, n);
161
207
  }
162
208
  n.boundaries.add(e);
163
- const i = n;
209
+ const s = n;
164
210
  return () => {
165
- !i.boundaries.delete(e) || i.boundaries.size || (i.stop(), ye.delete(t));
211
+ !s.boundaries.delete(e) || s.boundaries.size || (s.stop(), ke.delete(t));
166
212
  };
167
213
  }
168
- class K {
214
+ class Q {
169
215
  constructor(e) {
170
- _(this, "root");
171
- _(this, "destroying", !1);
172
- _(this, "feedback");
173
- _(this, "options");
174
- _(this, "value");
175
- _(this, "committedValue");
176
- _(this, "state");
177
- _(this, "view");
178
- _(this, "viewLife", new he());
179
- _(this, "life", new he());
180
- _(this, "listeners", /* @__PURE__ */ new Set());
181
- _(this, "interactions");
182
- _(this, "interactionListeners", /* @__PURE__ */ new Set());
183
- _(this, "mounted", !1);
184
- _(this, "handled", /* @__PURE__ */ new WeakSet());
216
+ z(this, "root");
217
+ z(this, "destroying", !1);
218
+ z(this, "feedback");
219
+ z(this, "options");
220
+ z(this, "value");
221
+ z(this, "committedValue");
222
+ z(this, "state");
223
+ z(this, "view");
224
+ z(this, "viewLife", new he());
225
+ z(this, "life", new he());
226
+ z(this, "listeners", /* @__PURE__ */ new Set());
227
+ z(this, "interactions");
228
+ z(this, "interactionListeners", /* @__PURE__ */ new Set());
229
+ z(this, "mounted", !1);
230
+ z(this, "handled", /* @__PURE__ */ new WeakSet());
185
231
  this.options = { ...e }, this.value = e.value, this.committedValue = e.value, this.state = e.readonly || e.canEdit === !1 ? "display" : e.state ?? "display";
186
232
  }
187
233
  get element() {
@@ -204,10 +250,10 @@ class K {
204
250
  ((n = e.detail) == null ? void 0 : n.reason) === "escape" ? this.cancel("user") : this.commit("user");
205
251
  }), this.life.listen(this.element, "focusout", () => {
206
252
  queueMicrotask(() => {
207
- var n, i;
253
+ var n, s;
208
254
  if (this.life.destroyed || !this.element.isConnected || this.state !== "editing") return;
209
255
  const e = this.element.ownerDocument.activeElement;
210
- this.element.contains(e) || (i = (n = this.view) == null ? void 0 : n.content) != null && i.contains(e) || be(e, this.element) || this.commit("user");
256
+ this.element.contains(e) || (s = (n = this.view) == null ? void 0 : n.content) != null && s.contains(e) || be(e, this.element) || this.commit("user");
211
257
  });
212
258
  });
213
259
  }
@@ -256,11 +302,11 @@ class K {
256
302
  this.interactionListeners.delete(e);
257
303
  });
258
304
  }
259
- input(e, n = "api", i) {
305
+ input(e, n = "api", s) {
260
306
  var c;
261
307
  if (this.life.destroyed || this.snapshot.readonly) return;
262
- const o = this.value, r = this.snapshot, s = this.beforeInput(e);
263
- this.value = (c = this.options.hooks) != null && c.beforeInput ? this.options.hooks.beforeInput(s, r) : s, (n === "api" || !Object.is(e, this.value)) && this.draw(), this.emit("input", n, { previousValue: o, originalEvent: i });
308
+ const i = this.value, r = this.snapshot, o = this.beforeInput(e);
309
+ this.value = (c = this.options.hooks) != null && c.beforeInput ? this.options.hooks.beforeInput(o, r) : o, (n === "api" || !Object.is(e, this.value)) && this.draw(), this.emit("input", n, { previousValue: i, originalEvent: s });
264
310
  }
265
311
  /** External synchronization is distinct from user input; it resets the draft. */
266
312
  setValue(e) {
@@ -272,44 +318,44 @@ class K {
272
318
  this.life.destroyed || (this.value = this.read(), this.options = { ...this.options, ...e }, "value" in e && (this.value = this.committedValue = e.value), e.state && (this.state = e.state), this.isReadonly() && (this.state = "display"), this.draw());
273
319
  }
274
320
  validate() {
275
- var i, o, r, s;
321
+ var s, i, r, o;
276
322
  const e = this.read(), n = e == null || e === "" || Array.isArray(e) && e.length === 0;
277
- return (this.options.field.required && n ? "此项必填" : void 0) || this.validateValue(e) || ((o = (i = this.view) == null ? void 0 : i.validate) == null ? void 0 : o.call(i)) || ((s = (r = this.options.hooks) == null ? void 0 : r.validate) == null ? void 0 : s.call(r, e));
323
+ return (this.options.field.required && n ? "此项必填" : void 0) || this.validateValue(e) || ((i = (s = this.view) == null ? void 0 : s.validate) == null ? void 0 : i.call(s)) || ((o = (r = this.options.hooks) == null ? void 0 : r.validate) == null ? void 0 : o.call(r, e));
278
324
  }
279
325
  commit(e = "api") {
280
- var o, r;
326
+ var i, r;
281
327
  if (this.life.destroyed || this.snapshot.readonly) return !1;
282
328
  const n = this.validate();
283
329
  if (this.showValidation(n), n)
284
330
  return this.emit("invalid", e, { message: n }), !1;
285
- const i = this.event("commit", e, { previousValue: this.committedValue });
286
- return !this.beforeCommit(i) || ((r = (o = this.options.hooks) == null ? void 0 : o.beforeCommit) == null ? void 0 : r.call(o, i)) === !1 ? !1 : (this.value = this.read(), this.committedValue = this.value, this.element.removeAttribute("aria-invalid"), this.emit("commit", e, { previousValue: i.previousValue }), this.setState("display", e), !0);
331
+ const s = this.event("commit", e, { previousValue: this.committedValue });
332
+ return !this.beforeCommit(s) || ((r = (i = this.options.hooks) == null ? void 0 : i.beforeCommit) == null ? void 0 : r.call(i, s)) === !1 ? !1 : (this.value = this.read(), this.committedValue = this.value, this.element.removeAttribute("aria-invalid"), this.emit("commit", e, { previousValue: s.previousValue }), this.setState("display", e), !0);
287
333
  }
288
334
  cancel(e = "api") {
289
- var o, r, s, c;
335
+ var i, r, o, c;
290
336
  if (this.life.destroyed) return;
291
337
  const n = this.event("cancel", e);
292
- if (!this.beforeCancel(n) || ((r = (o = this.options.hooks) == null ? void 0 : o.beforeCancel) == null ? void 0 : r.call(o, n)) === !1) return;
293
- const i = this.event("state", e, { previousState: this.state, state: "display", value: this.committedValue });
294
- this.state !== "display" && (!this.beforeStateChange(i) || ((c = (s = this.options.hooks) == null ? void 0 : s.beforeStateChange) == null ? void 0 : c.call(s, i)) === !1) || (this.value = this.committedValue, this.disposeView(), this.state = "display", this.draw(), this.emit("cancel", e), i.previousState !== "display" && this.publish(i));
338
+ if (!this.beforeCancel(n) || ((r = (i = this.options.hooks) == null ? void 0 : i.beforeCancel) == null ? void 0 : r.call(i, n)) === !1) return;
339
+ const s = this.event("state", e, { previousState: this.state, state: "display", value: this.committedValue });
340
+ this.state !== "display" && (!this.beforeStateChange(s) || ((c = (o = this.options.hooks) == null ? void 0 : o.beforeStateChange) == null ? void 0 : c.call(o, s)) === !1) || (this.value = this.committedValue, this.disposeView(), this.state = "display", this.draw(), this.emit("cancel", e), s.previousState !== "display" && this.publish(s));
295
341
  }
296
342
  edit(e = "api") {
297
- var n, i;
298
- this.life.destroyed || (this.setState("editing", e), this.state === "editing" && ((i = (n = this.view) == null ? void 0 : n.focus) == null || i.call(n)));
343
+ var n, s;
344
+ this.life.destroyed || (this.setState("editing", e), this.state === "editing" && ((s = (n = this.view) == null ? void 0 : n.focus) == null || s.call(n)));
299
345
  }
300
346
  setState(e, n = "api") {
301
- var r, s, c, u;
347
+ var r, o, c, u;
302
348
  if (this.life.destroyed || e === this.state || e === "editing" && this.snapshot.readonly) return;
303
- const i = this.event("state", n, { previousState: this.state });
304
- if (i.state = e, !this.beforeStateChange(i) || ((s = (r = this.options.hooks) == null ? void 0 : r.beforeStateChange) == null ? void 0 : s.call(r, i)) === !1) return;
305
- const o = this.state !== "editing" && e !== "editing" && !((c = this.options.renderers) != null && c.display) && !((u = this.options.renderers) != null && u.hover) && this.renderHover === K.prototype.renderHover;
306
- this.value = this.read(), this.state = e, o && this.view ? this.element.dataset.state = e : this.draw(), this.publish(i);
349
+ const s = this.event("state", n, { previousState: this.state });
350
+ if (s.state = e, !this.beforeStateChange(s) || ((o = (r = this.options.hooks) == null ? void 0 : r.beforeStateChange) == null ? void 0 : o.call(r, s)) === !1) return;
351
+ const i = this.state !== "editing" && e !== "editing" && !((c = this.options.renderers) != null && c.display) && !((u = this.options.renderers) != null && u.hover) && this.renderHover === Q.prototype.renderHover;
352
+ this.value = this.read(), this.state = e, i && this.view ? this.element.dataset.state = e : this.draw(), this.publish(s);
307
353
  }
308
354
  action(e, n) {
309
- var o, r;
355
+ var i, r;
310
356
  if (this.life.destroyed) return;
311
- const i = { type: e, value: n };
312
- (r = (o = this.options).onAction) == null || r.call(o, i), this.emit("action", "api", { action: i });
357
+ const s = { type: e, value: n };
358
+ (r = (i = this.options).onAction) == null || r.call(i, s), this.emit("action", "api", { action: s });
313
359
  }
314
360
  destroy() {
315
361
  var e, n;
@@ -358,55 +404,55 @@ class K {
358
404
  }
359
405
  }
360
406
  draw() {
361
- var y, T, p, b, h, E, M;
407
+ var E, M, p, g, f, y, D;
362
408
  if (!this.mounted || this.life.destroyed) return;
363
- const e = this.element.ownerDocument.activeElement, n = this.state === "editing" && !!e && (!!((y = this.view) != null && y.element.contains(e)) || !!((p = (T = this.view) == null ? void 0 : T.content) != null && p.contains(e))), i = e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement ? { start: e.selectionStart, end: e.selectionEnd } : void 0;
409
+ const e = this.element.ownerDocument.activeElement, n = this.state === "editing" && !!e && (!!((E = this.view) != null && E.element.contains(e)) || !!((p = (M = this.view) == null ? void 0 : M.content) != null && p.contains(e))), s = e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement ? { start: e.selectionStart, end: e.selectionEnd } : void 0;
364
410
  this.disposeView(), this.isReadonly() && (this.state = "display");
365
- const o = this.snapshot, r = this.options.content, s = typeof r == "function" ? r(o) : r ?? { kind: "text", text: this.value == null ? "" : String(this.value) }, c = this.context(), u = () => this.state === "editing" ? this.renderEditing(c) : r ? Re(s) : this.state === "hover" ? this.renderHover(c) : this.renderDisplay(c), f = {
366
- ...o,
411
+ const i = this.snapshot, r = this.options.content, o = typeof r == "function" ? r(i) : r ?? { kind: "text", text: this.value == null ? "" : String(this.value) }, c = this.context(), u = () => this.state === "editing" ? this.renderEditing(c) : r ? Be(o) : this.state === "hover" ? this.renderHover(c) : this.renderDisplay(c), m = {
412
+ ...i,
367
413
  element: this.element,
368
414
  field: this.options.field,
369
- content: s,
415
+ content: o,
370
416
  renderDefault: u,
371
- input: (m) => this.input(m),
417
+ input: (w) => this.input(w),
372
418
  commit: () => this.commit(),
373
419
  cancel: () => this.cancel(),
374
420
  edit: () => this.edit(),
375
- action: (m, L) => this.action(m, L)
421
+ action: (w, x) => this.action(w, x)
376
422
  };
377
- if (this.view = ((h = (b = this.options.renderers) == null ? void 0 : b[this.state]) == null ? void 0 : h.call(b, f)) ?? u(), this.element.setAttribute("aria-label", this.options.field.label), this.element.dataset.state = this.state, this.element.dataset.readonly = String(o.readonly), this.element.replaceChildren(this.view.element), this.element.removeAttribute("aria-invalid"), this.watch(this.view), n) {
378
- (M = (E = this.view).focus) == null || M.call(E);
379
- const m = this.element.ownerDocument.activeElement;
380
- if ((i == null ? void 0 : i.start) != null && i.end != null && (m instanceof HTMLInputElement || m instanceof HTMLTextAreaElement))
423
+ if (this.view = ((f = (g = this.options.renderers) == null ? void 0 : g[this.state]) == null ? void 0 : f.call(g, m)) ?? u(), this.element.setAttribute("aria-label", this.options.field.label), this.element.dataset.state = this.state, this.element.dataset.readonly = String(i.readonly), this.element.replaceChildren(this.view.element), this.element.removeAttribute("aria-invalid"), this.watch(this.view), n) {
424
+ (D = (y = this.view).focus) == null || D.call(y);
425
+ const w = this.element.ownerDocument.activeElement;
426
+ if ((s == null ? void 0 : s.start) != null && s.end != null && (w instanceof HTMLInputElement || w instanceof HTMLTextAreaElement))
381
427
  try {
382
- m.setSelectionRange(i.start, i.end);
428
+ w.setSelectionRange(s.start, s.end);
383
429
  } catch {
384
430
  }
385
431
  }
386
432
  }
387
433
  watch(e) {
388
434
  if (this.mounted && this.state === "editing") {
389
- const i = () => [this.element, e.content, this.options.focusBoundary].filter((o) => !!o);
390
- this.viewLife.add(Xe(this.element.ownerDocument, {
391
- contains: (o, r) => i().some((s) => r.composedPath().includes(s) || !!o && s.contains(o) || be(o, s)),
435
+ const s = () => [this.element, e.content, this.options.focusBoundary].filter((i) => !!i);
436
+ this.viewLife.add(ut(this.element.ownerDocument, {
437
+ contains: (i, r) => s().some((o) => r.composedPath().includes(o) || !!i && o.contains(i) || be(i, o)),
392
438
  leave: () => {
393
439
  this.element.isConnected && this.commit("user");
394
440
  }
395
441
  }));
396
442
  }
397
- this.interactions ?? (this.interactions = Qe(this.mounted ? this.element : e.element, `field:${this.options.field.key}`, {
398
- onInteraction: (i) => {
399
- var o, r;
400
- (r = (o = this.options).onInteraction) == null || r.call(o, i);
401
- for (const s of this.interactionListeners) s(i);
443
+ this.interactions ?? (this.interactions = at(this.mounted ? this.element : e.element, `field:${this.options.field.key}`, {
444
+ onInteraction: (s) => {
445
+ var i, r;
446
+ (r = (i = this.options).onInteraction) == null || r.call(i, s);
447
+ for (const o of this.interactionListeners) o(s);
402
448
  }
403
449
  }));
404
- const n = [...new Set([e.element, e.content].filter((i) => !!i))];
405
- for (const i of n) this.viewLife.add(this.interactions.addRoot(i));
406
- for (const i of e.inputRoot ? [e.inputRoot] : n)
407
- for (const o of ["input", "change"]) this.viewLife.listen(i, o, (r) => {
408
- var s;
409
- this.handled.has(r) || (this.handled.add(r), this.input(((s = e.read) == null ? void 0 : s.call(e)) ?? this.value, "user", r), o === "change" && this.emit("change", "user", { originalEvent: r }));
450
+ const n = [...new Set([e.element, e.content].filter((s) => !!s))];
451
+ for (const s of n) this.viewLife.add(this.interactions.addRoot(s));
452
+ for (const s of e.inputRoot ? [e.inputRoot] : n)
453
+ for (const i of ["input", "change"]) this.viewLife.listen(s, i, (r) => {
454
+ var o;
455
+ this.handled.has(r) || (this.handled.add(r), this.input(((o = e.read) == null ? void 0 : o.call(e)) ?? this.value, "user", r), i === "change" && this.emit("change", "user", { originalEvent: r }));
410
456
  });
411
457
  }
412
458
  disposeView() {
@@ -415,224 +461,224 @@ class K {
415
461
  const e = this.view;
416
462
  this.view = void 0, (n = e == null ? void 0 : e.destroy) == null || n.call(e);
417
463
  }
418
- event(e, n, i = {}) {
419
- return { ...this.snapshot, type: e, source: n, ...i };
464
+ event(e, n, s = {}) {
465
+ return { ...this.snapshot, type: e, source: n, ...s };
420
466
  }
421
- emit(e, n, i = {}) {
422
- this.publish(this.event(e, n, i));
467
+ emit(e, n, s = {}) {
468
+ this.publish(this.event(e, n, s));
423
469
  }
424
470
  publish(e) {
425
- var o, r, s;
426
- this.onOutput(e), (r = (o = this.options).onEvent) == null || r.call(o, e);
471
+ var i, r, o;
472
+ this.onOutput(e), (r = (i = this.options).onEvent) == null || r.call(i, e);
427
473
  for (const c of [...this.listeners]) c(e);
428
- const n = this.mounted ? this.element : (s = this.view) == null ? void 0 : s.element;
474
+ const n = this.mounted ? this.element : (o = this.view) == null ? void 0 : o.element;
429
475
  if (!n) return;
430
- const i = n.ownerDocument.defaultView.CustomEvent;
431
- n.dispatchEvent(new i(`field:${e.type}`, { detail: e, bubbles: !0 }));
476
+ const s = n.ownerDocument.defaultView.CustomEvent;
477
+ n.dispatchEvent(new s(`field:${e.type}`, { detail: e, bubbles: !0 }));
432
478
  }
433
479
  }
434
- function Re(t) {
480
+ function Be(t) {
435
481
  if (t.kind === "node") return { element: t.node, destroy: t.destroy };
436
482
  const e = document.createElement("div");
437
483
  if (e.className = t.className ?? "", t.kind === "text")
438
484
  return e.textContent = t.text, { element: e };
439
- const n = t.children.map(Re);
440
- return e.append(...n.map((i) => i.element)), { element: e, destroy: () => n.forEach((i) => {
441
- var o;
442
- return (o = i.destroy) == null ? void 0 : o.call(i);
485
+ const n = t.children.map(Be);
486
+ return e.append(...n.map((s) => s.element)), { element: e, destroy: () => n.forEach((s) => {
487
+ var i;
488
+ return (i = s.destroy) == null ? void 0 : i.call(s);
443
489
  }) };
444
490
  }
445
491
  function a(t, e = "", n) {
446
- const i = document.createElement(t);
447
- return i.className = e, n !== void 0 && (i.textContent = n), i;
492
+ const s = document.createElement(t);
493
+ return s.className = e, n !== void 0 && (s.textContent = n), s;
448
494
  }
449
- function Fe(t, e = 312) {
495
+ function ze(t, e = 312) {
450
496
  t.rows = 1, t.style.resize = "none";
451
497
  const n = () => {
452
498
  t.style.height = "auto";
453
- const i = t.scrollHeight;
454
- i > 0 && (t.style.height = Math.min(i, e) + "px"), t.style.overflowY = i > e ? "auto" : "hidden";
499
+ const s = t.scrollHeight;
500
+ s > 0 && (t.style.height = Math.min(s, e) + "px"), t.style.overflowY = s > e ? "auto" : "hidden";
455
501
  };
456
502
  return t.addEventListener("input", n), t.addEventListener("focus", n), queueMicrotask(n), n;
457
503
  }
458
- const Q = (t) => t.choices ?? (t.options || []).map((e) => ({ id: e, label: e })), Se = ["rgba(61, 188, 47, 0.2)", "rgba(0, 184, 159, 0.2)", "rgba(244, 118, 189, 0.2)", "rgba(149, 155, 238, 0.2)", "rgba(184, 143, 255, 0.2)"], Ee = (t, e) => {
459
- var n, i;
460
- return ((n = Q(t).find((o) => o.id === e)) == null ? void 0 : n.color) || ((i = t.colors) == null ? void 0 : i[e]) || Se[Math.max(0, Q(t).findIndex((o) => o.id === e)) % Se.length];
461
- }, He = (t) => (Array.isArray(t) ? t : t == null || t === "" ? [] : [t]).map(String);
462
- function et(t, e) {
504
+ const X = (t) => t.choices ?? (t.options || []).map((e) => ({ id: e, label: e })), Oe = ["rgba(61, 188, 47, 0.2)", "rgba(0, 184, 159, 0.2)", "rgba(244, 118, 189, 0.2)", "rgba(149, 155, 238, 0.2)", "rgba(184, 143, 255, 0.2)"], Ae = (t, e) => {
505
+ var n, s;
506
+ return ((n = X(t).find((i) => i.id === e)) == null ? void 0 : n.color) || ((s = t.colors) == null ? void 0 : s[e]) || Oe[Math.max(0, X(t).findIndex((i) => i.id === e)) % Oe.length];
507
+ }, Ye = (t) => (Array.isArray(t) ? t : t == null || t === "" ? [] : [t]).map(String);
508
+ function ft(t, e) {
463
509
  var n;
464
- return ((n = Q(t).find((i) => i.id === e)) == null ? void 0 : n.label) || e;
510
+ return ((n = X(t).find((s) => s.id === e)) == null ? void 0 : n.label) || e;
465
511
  }
466
- function Ie(t, e = "choice") {
512
+ function _e(t, e = "choice") {
467
513
  const n = a("div", "fc-tags");
468
- for (const i of He(t.value)) {
469
- const o = et(t.field, i), r = a(e === "relation" ? "button" : "span", "fc-tag fc-tag--" + e);
470
- e === "choice" && (r.style.backgroundColor = Ee(t.field, i)), e === "person" && r.append(a("span", "fc-avatar", o.slice(0, 1))), r.append(a("span", "fc-tag-label", o)), r.tagName === "BUTTON" && (r.type = "button", r.onclick = (s) => {
514
+ for (const s of Ye(t.value)) {
515
+ const i = ft(t.field, s), r = a(e === "relation" ? "button" : "span", "fc-tag fc-tag--" + e);
516
+ e === "choice" && (r.style.backgroundColor = Ae(t.field, s)), e === "person" && r.append(a("span", "fc-avatar", i.slice(0, 1))), r.append(a("span", "fc-tag-label", i)), r.tagName === "BUTTON" && (r.type = "button", r.onclick = (o) => {
471
517
  var c;
472
- s.stopPropagation(), (c = t.onAction) == null || c.call(t, { type: "open", value: i });
518
+ o.stopPropagation(), (c = t.onAction) == null || c.call(t, { type: "open", value: s });
473
519
  }), n.append(r);
474
520
  }
475
521
  return n.children.length || n.append(a("span", "fc-empty", "待填")), n;
476
522
  }
477
- function xe(t, e, n = "choice") {
523
+ function Se(t, e, n = "choice") {
478
524
  var l;
479
- const i = a("div", "fc-choice fc-choice--" + n);
480
- let o = He(e.value).slice(0, t ? void 0 : 1);
481
- const r = new Map(Q(e.field).map((d) => [d.id, d]));
482
- let s = Q(e.field);
525
+ const s = a("div", "fc-choice fc-choice--" + n);
526
+ let i = Ye(e.value).slice(0, t ? void 0 : 1);
527
+ const r = new Map(X(e.field).map((d) => [d.id, d]));
528
+ let o = X(e.field);
483
529
  const c = t && (e.field.maxSelections ?? 0) > 0 ? e.field.maxSelections : 1 / 0, u = a("select", "fc-select");
484
530
  u.hidden = !0, u.multiple = t, u.disabled = e.readonly, u.required = !!e.field.required, u.ariaLabel = e.field.label;
485
- const f = a("div", "fc-choice-head"), y = a("div", "fc-choice-selection"), T = a("span", "fc-empty fc-choice-placeholder", "待填"), p = a("input", "fc-choice-search");
531
+ const m = a("div", "fc-choice-head"), E = a("div", "fc-choice-selection"), M = a("span", "fc-empty fc-choice-placeholder", "待填"), p = a("input", "fc-choice-search");
486
532
  p.placeholder = "", p.autocomplete = "off", p.ariaLabel = "输入以搜索" + e.field.label, p.disabled = e.readonly;
487
- const b = () => {
533
+ const g = () => {
488
534
  p.size = Math.max(1, [...p.value].length + 1);
489
535
  };
490
- b();
491
- const h = a("div", "fc-option-list");
492
- h.setAttribute("role", n === "radio" ? "radiogroup" : "group"), h.ariaLabel = e.field.label;
493
- const E = a("div", "fc-error fc-choice-feedback");
494
- E.setAttribute("role", "status");
495
- const M = a("div", "fc-picker-status");
496
- M.setAttribute("role", "status");
497
- const m = a("button", "fc-retry", "重试");
498
- m.type = "button", m.hidden = !0;
499
- let L, V = 0, N = !1, x = !1;
500
- const A = n !== "radio" && !!((l = e.services) != null && l.searchOptions), R = n !== "radio" && e.layout !== "compact" && !e.readonly;
501
- let C;
502
- const j = () => {
503
- const d = C;
504
- C = void 0, d == null || d.close();
505
- }, P = () => {
506
- !R || N || C || e.readonly || (C = ce({ anchor: f, content: h, width: "anchor", onDismiss: () => {
507
- C = void 0;
536
+ g();
537
+ const f = a("div", "fc-option-list");
538
+ f.setAttribute("role", n === "radio" ? "radiogroup" : "group"), f.ariaLabel = e.field.label;
539
+ const y = a("div", "fc-error fc-choice-feedback");
540
+ y.setAttribute("role", "status");
541
+ const D = a("div", "fc-picker-status");
542
+ D.setAttribute("role", "status");
543
+ const w = a("button", "fc-retry", "重试");
544
+ w.type = "button", w.hidden = !0;
545
+ let x, N = 0, S = !1, b = !1;
546
+ const C = n !== "radio" && !!((l = e.services) != null && l.searchOptions), V = n !== "radio" && e.layout !== "compact" && !e.readonly;
547
+ let A;
548
+ const B = () => {
549
+ const d = A;
550
+ A = void 0, d == null || d.close();
551
+ }, Y = () => {
552
+ !V || S || A || e.readonly || (A = ce({ anchor: m, content: f, width: "anchor", onDismiss: () => {
553
+ A = void 0;
508
554
  } }));
509
- }, B = () => {
510
- !R || !C || (j(), i.dispatchEvent(new Event("fc-collapse", { bubbles: !0 })));
511
555
  }, q = () => {
556
+ !V || !A || (B(), s.dispatchEvent(new Event("fc-collapse", { bubbles: !0 })));
557
+ }, P = () => {
512
558
  var d;
513
- (d = e.onSelectedOptions) == null || d.call(e, o.map((w) => r.get(w)).filter((w) => !!w)), i.dispatchEvent(new Event("change", { bubbles: !0 }));
514
- }, O = () => {
559
+ (d = e.onSelectedOptions) == null || d.call(e, i.map((L) => r.get(L)).filter((L) => !!L)), s.dispatchEvent(new Event("change", { bubbles: !0 }));
560
+ }, I = () => {
515
561
  var d;
516
562
  if (u.replaceChildren(), !t) {
517
- const w = a("option");
518
- w.value = "", u.append(w);
563
+ const L = a("option");
564
+ L.value = "", u.append(L);
519
565
  }
520
- for (const w of /* @__PURE__ */ new Set([...s.map((v) => v.id), ...o])) {
521
- const v = a("option", "", ((d = r.get(w)) == null ? void 0 : d.label) || w);
522
- v.value = w, v.selected = o.includes(w), u.append(v);
566
+ for (const L of /* @__PURE__ */ new Set([...o.map((h) => h.id), ...i])) {
567
+ const h = a("option", "", ((d = r.get(L)) == null ? void 0 : d.label) || L);
568
+ h.value = L, h.selected = i.includes(L), u.append(h);
523
569
  }
524
- t || (u.value = o[0] || "");
525
- }, F = () => {
526
- y.replaceChildren(), h.replaceChildren(), O(), !o.length && !p.value && y.append(T);
527
- for (const v of o) {
528
- const k = r.get(v), I = a("span", "fc-tag fc-tag--" + n);
529
- (n === "choice" || n === "radio") && (I.style.backgroundColor = Ee(e.field, v)), n === "person" && I.append(a("span", "fc-avatar", ((k == null ? void 0 : k.label) || v).slice(0, 1))), I.append(a("span", "fc-tag-label", ((k == null ? void 0 : k.label) || v) + (k != null && k.disabled ? "(已停用)" : "")));
530
- const W = a("span", "fc-tag-slot"), U = a("button", "fc-choice-remove", "×");
531
- U.type = "button", U.disabled = e.readonly, U.ariaLabel = "移除" + ((k == null ? void 0 : k.label) || v), U.onclick = (G) => {
532
- G.stopPropagation(), o = o.filter((z) => z !== v), E.textContent = "", F(), p.focus(), q();
533
- }, W.append(U), I.append(W), y.append(I);
570
+ t || (u.value = i[0] || "");
571
+ }, R = () => {
572
+ E.replaceChildren(), f.replaceChildren(), I(), !i.length && !p.value && E.append(M);
573
+ for (const h of i) {
574
+ const k = r.get(h), $ = a("span", "fc-tag fc-tag--" + n);
575
+ (n === "choice" || n === "radio") && ($.style.backgroundColor = Ae(e.field, h)), n === "person" && $.append(a("span", "fc-avatar", ((k == null ? void 0 : k.label) || h).slice(0, 1))), $.append(a("span", "fc-tag-label", ((k == null ? void 0 : k.label) || h) + (k != null && k.disabled ? "(已停用)" : "")));
576
+ const U = a("span", "fc-tag-slot"), _ = a("button", "fc-choice-remove", "×");
577
+ _.type = "button", _.disabled = e.readonly, _.ariaLabel = "移除" + ((k == null ? void 0 : k.label) || h), _.onclick = (te) => {
578
+ te.stopPropagation(), i = i.filter((G) => G !== h), y.textContent = "", R(), p.focus(), P();
579
+ }, U.append(_), $.append(U), E.append($);
534
580
  }
535
- const d = p.value.trim().toLocaleLowerCase(), w = s.filter((v) => !v.disabled && (A || (v.label + " " + v.id + " " + (v.description || "")).toLocaleLowerCase().includes(d)));
536
- for (const v of w) {
581
+ const d = p.value.trim().toLocaleLowerCase(), L = o.filter((h) => !h.disabled && (C || (h.label + " " + h.id + " " + (h.description || "")).toLocaleLowerCase().includes(d)));
582
+ for (const h of L) {
537
583
  const k = a("button", "fc-option");
538
- k.type = "button", k.dataset.value = v.id, k.disabled = e.readonly || x;
539
- const I = o.includes(v.id);
540
- k.classList.toggle("selected", I), k.setAttribute(n === "radio" ? "aria-checked" : "aria-pressed", String(I)), n === "radio" && k.setAttribute("role", "radio");
541
- const W = a("span", "fc-option-label" + (n === "choice" ? " fc-tag" : ""), v.label);
542
- n === "choice" && (W.style.backgroundColor = Ee(e.field, v.id)), n === "person" && k.append(a("span", "fc-avatar", v.label.slice(0, 1))), n === "relation" && k.append(a("span", "fc-relation-icon", "↗"));
543
- const U = a("span", "fc-option-copy");
544
- U.append(W), v.description && U.append(a("small", "fc-option-description", v.description)), k.append(U, a("span", "fc-option-mark", I ? "✓" : "")), k.onclick = (G) => {
545
- if (G.stopPropagation(), !e.readonly) {
546
- if (!t) o = [v.id];
547
- else if (I) o = o.filter((z) => z !== v.id);
584
+ k.type = "button", k.dataset.value = h.id, k.disabled = e.readonly || b;
585
+ const $ = i.includes(h.id);
586
+ k.classList.toggle("selected", $), k.setAttribute(n === "radio" ? "aria-checked" : "aria-pressed", String($)), n === "radio" && k.setAttribute("role", "radio");
587
+ const U = a("span", "fc-option-label" + (n === "choice" ? " fc-tag" : ""), h.label);
588
+ n === "choice" && (U.style.backgroundColor = Ae(e.field, h.id)), n === "person" && k.append(a("span", "fc-avatar", h.label.slice(0, 1))), n === "relation" && k.append(a("span", "fc-relation-icon", "↗"));
589
+ const _ = a("span", "fc-option-copy");
590
+ _.append(U), h.description && _.append(a("small", "fc-option-description", h.description)), k.append(_, a("span", "fc-option-mark", $ ? "✓" : "")), k.onclick = (te) => {
591
+ if (te.stopPropagation(), !e.readonly) {
592
+ if (!t) i = [h.id];
593
+ else if ($) i = i.filter((G) => G !== h.id);
548
594
  else {
549
- const z = v.exclusive ? [] : o.filter((J) => {
550
- var ee;
551
- return !((ee = r.get(J)) != null && ee.exclusive);
595
+ const G = h.exclusive ? [] : i.filter((Z) => {
596
+ var W;
597
+ return !((W = r.get(Z)) != null && W.exclusive);
552
598
  });
553
- if (z.length >= c) {
554
- E.textContent = "最多可选择 " + c + " 项";
599
+ if (G.length >= c) {
600
+ y.textContent = "最多可选择 " + c + " 项";
555
601
  return;
556
602
  }
557
- o = [...z, v.id];
603
+ i = [...G, h.id];
558
604
  }
559
- E.textContent = "", t || (p.value = "", b()), F(), h.querySelectorAll("button").forEach((z) => {
560
- z.dataset.value === v.id && z.focus();
561
- }), q(), !t && R && B();
605
+ y.textContent = "", t || (p.value = "", g()), R(), f.querySelectorAll("button").forEach((G) => {
606
+ G.dataset.value === h.id && G.focus();
607
+ }), P(), !t && V && q();
562
608
  }
563
- }, h.append(k);
609
+ }, f.append(k);
564
610
  }
565
- !w.length && !x && h.append(a("p", "fc-empty fc-choice-empty", "暂无匹配选项"));
566
- }, $ = async () => {
567
- L == null || L.abort();
568
- const d = ++V;
569
- L = new AbortController(), x = !0, m.hidden = !0, M.textContent = "加载中…", i.setAttribute("aria-busy", "true"), F();
611
+ !L.length && !b && f.append(a("p", "fc-empty fc-choice-empty", "暂无匹配选项"));
612
+ }, H = async () => {
613
+ x == null || x.abort();
614
+ const d = ++N;
615
+ x = new AbortController(), b = !0, w.hidden = !0, D.textContent = "加载中…", s.setAttribute("aria-busy", "true"), R();
570
616
  try {
571
- const w = await e.services.searchOptions(e.field, p.value.trim(), L.signal);
572
- if (N || d !== V) return;
573
- s = w, w.forEach((v) => r.set(v.id, v)), M.textContent = "";
617
+ const L = await e.services.searchOptions(e.field, p.value.trim(), x.signal);
618
+ if (S || d !== N) return;
619
+ o = L, L.forEach((h) => r.set(h.id, h)), D.textContent = "";
574
620
  } catch {
575
- if (N || d !== V) return;
576
- s = [], M.textContent = "加载失败,请重试", m.hidden = !1;
621
+ if (S || d !== N) return;
622
+ o = [], D.textContent = "加载失败,请重试", w.hidden = !1;
577
623
  } finally {
578
- !N && d === V && (x = !1, i.setAttribute("aria-busy", "false"), F());
624
+ !S && d === N && (b = !1, s.setAttribute("aria-busy", "false"), R());
579
625
  }
580
626
  };
581
627
  p.oninput = () => {
582
- b(), A ? $() : F();
583
- }, p.onfocus = () => P(), f.onclick = (d) => {
628
+ g(), C ? H() : R();
629
+ }, p.onfocus = () => Y(), m.onclick = (d) => {
584
630
  d.target.closest("button") || p.focus();
585
- }, m.onclick = () => void $();
586
- const Y = (d) => {
631
+ }, w.onclick = () => void H();
632
+ const j = (d) => {
587
633
  if (!["ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight", "Home", "End"].includes(d.key)) return;
588
- const w = [...h.querySelectorAll("button:not(:disabled)")];
589
- if (!w.length) return;
634
+ const L = [...f.querySelectorAll("button:not(:disabled)")];
635
+ if (!L.length) return;
590
636
  d.preventDefault();
591
- const v = w.indexOf(document.activeElement), k = d.key === "Home" ? 0 : d.key === "End" ? w.length - 1 : (v + (d.key === "ArrowUp" || d.key === "ArrowLeft" ? -1 : 1) + w.length) % w.length;
592
- w[k].focus();
637
+ const h = L.indexOf(document.activeElement), k = d.key === "Home" ? 0 : d.key === "End" ? L.length - 1 : (h + (d.key === "ArrowUp" || d.key === "ArrowLeft" ? -1 : 1) + L.length) % L.length;
638
+ L[k].focus();
593
639
  };
594
- if (h.onkeydown = Y, p.onkeydown = (d) => {
595
- d.key === "ArrowDown" && (P(), Y(d));
640
+ if (f.onkeydown = j, p.onkeydown = (d) => {
641
+ d.key === "ArrowDown" && (Y(), j(d));
596
642
  }, u.onchange = () => {
597
- o = [...u.selectedOptions].map((d) => d.value).filter(Boolean), F();
598
- }, f.append(y), n !== "radio" && f.append(p), R) {
643
+ i = [...u.selectedOptions].map((d) => d.value).filter(Boolean), R();
644
+ }, m.append(E), n !== "radio" && m.append(p), V) {
599
645
  const d = a("span", "fc-field-chevron");
600
- d.setAttribute("aria-hidden", "true"), f.append(d), i.append(u, f, M, m, E);
601
- } else i.append(u, f, M, h, m, E);
602
- return F(), A && !e.readonly && $(), {
603
- element: i,
604
- content: R ? h : void 0,
605
- read: () => t ? [...o] : o[0] || "",
606
- validate: () => e.field.required && !o.length ? "请选择一个选项" : o.length > c ? "最多可选择 " + c + " 项" : void 0,
646
+ d.setAttribute("aria-hidden", "true"), m.append(d), s.append(u, m, D, w, y);
647
+ } else s.append(u, m, D, f, w, y);
648
+ return R(), C && !e.readonly && H(), {
649
+ element: s,
650
+ content: V ? f : void 0,
651
+ read: () => t ? [...i] : i[0] || "",
652
+ validate: () => e.field.required && !i.length ? "请选择一个选项" : i.length > c ? "最多可选择 " + c + " 项" : void 0,
607
653
  focus: () => {
608
654
  var d;
609
655
  if (n === "radio") {
610
- (d = h.querySelector("button")) == null || d.focus();
656
+ (d = f.querySelector("button")) == null || d.focus();
611
657
  return;
612
658
  }
613
- p.focus(), P();
659
+ p.focus(), Y();
614
660
  },
615
661
  deactivate: () => {
616
- p.value = "", b(), j();
662
+ p.value = "", g(), B();
617
663
  },
618
664
  destroy: () => {
619
- N = !0, ++V, L == null || L.abort(), j();
665
+ S = !0, ++N, x == null || x.abort(), B();
620
666
  }
621
667
  };
622
668
  }
623
- const tt = new Set("P DIV BR STRONG B EM I U S STRIKE UL OL LI BLOCKQUOTE H1 H2 H3 H4 H5 SPAN FONT A IMG PRE CODE HR TABLE THEAD TBODY TR TH TD INPUT".split(" ")), $e = (t) => /^(https?:\/\/|mailto:)/i.test(t.trim());
669
+ const pt = new Set("P DIV BR STRONG B EM I U S STRIKE UL OL LI BLOCKQUOTE H1 H2 H3 H4 H5 SPAN FONT A IMG PRE CODE HR TABLE THEAD TBODY TR TH TD INPUT".split(" ")), je = (t) => /^(https?:\/\/|mailto:)/i.test(t.trim());
624
670
  function me(t) {
625
671
  const e = document.createElement("template");
626
672
  e.innerHTML = String(t ?? "");
627
- const n = (i) => {
628
- for (const o of [...i.childNodes]) {
629
- if (o.nodeType !== 1) continue;
630
- const r = o;
673
+ const n = (s) => {
674
+ for (const i of [...s.childNodes]) {
675
+ if (i.nodeType !== 1) continue;
676
+ const r = i;
631
677
  if (["SCRIPT", "STYLE", "IFRAME", "OBJECT", "SVG", "MATH"].includes(r.tagName)) {
632
678
  r.remove();
633
679
  continue;
634
680
  }
635
- if (n(r), !tt.has(r.tagName)) {
681
+ if (n(r), !pt.has(r.tagName)) {
636
682
  r.replaceWith(...r.childNodes);
637
683
  continue;
638
684
  }
@@ -640,23 +686,23 @@ function me(t) {
640
686
  r.remove();
641
687
  continue;
642
688
  }
643
- const s = r.getAttribute("href") || "", c = r.getAttribute("src") || "", u = r.getAttribute("alt") || "", f = r.getAttribute("data-person-id"), y = r.hasAttribute("checked"), T = r.getAttribute("data-task") === "true", p = ["color", "background-color", "text-align", "margin-left", "font-weight", "font-style", "text-decoration-line"].map((h) => [h, r.style.getPropertyValue(h)]), b = r.tagName === "FONT" ? r.getAttribute("color") : null;
644
- for (const h of [...r.attributes]) r.removeAttribute(h.name);
645
- for (const [h, E] of p)
646
- (h === "color" || h === "background-color" ? /^(#[a-f\d]{3,8}|rgba?\([\d.,%\s]+\)|[a-z]+)$/i.test(E) : h === "text-align" ? /^(left|center|right|justify)$/.test(E) : h === "margin-left" ? /^\d{1,3}px$/.test(E) : /^(bold|normal|italic|underline|line-through|[1-9]00)$/.test(E)) && r.style.setProperty(h, E);
647
- if (b && /^(#[a-f\d]{3,8}|[a-z]+)$/i.test(b) && (r.style.color = b), r.tagName === "A" && $e(s) && (r.setAttribute("href", s.trim()), r.setAttribute("target", "_blank"), r.setAttribute("rel", "noopener noreferrer")), r.tagName === "IMG") {
689
+ const o = r.getAttribute("href") || "", c = r.getAttribute("src") || "", u = r.getAttribute("alt") || "", m = r.getAttribute("data-person-id"), E = r.hasAttribute("checked"), M = r.getAttribute("data-task") === "true", p = ["color", "background-color", "text-align", "margin-left", "font-weight", "font-style", "text-decoration-line"].map((f) => [f, r.style.getPropertyValue(f)]), g = r.tagName === "FONT" ? r.getAttribute("color") : null;
690
+ for (const f of [...r.attributes]) r.removeAttribute(f.name);
691
+ for (const [f, y] of p)
692
+ (f === "color" || f === "background-color" ? /^(#[a-f\d]{3,8}|rgba?\([\d.,%\s]+\)|[a-z]+)$/i.test(y) : f === "text-align" ? /^(left|center|right|justify)$/.test(y) : f === "margin-left" ? /^\d{1,3}px$/.test(y) : /^(bold|normal|italic|underline|line-through|[1-9]00)$/.test(y)) && r.style.setProperty(f, y);
693
+ if (g && /^(#[a-f\d]{3,8}|[a-z]+)$/i.test(g) && (r.style.color = g), r.tagName === "A" && je(o) && (r.setAttribute("href", o.trim()), r.setAttribute("target", "_blank"), r.setAttribute("rel", "noopener noreferrer")), r.tagName === "IMG") {
648
694
  if (!/^https?:\/\//i.test(c.trim())) {
649
695
  r.remove();
650
696
  continue;
651
697
  }
652
698
  r.setAttribute("src", c.trim()), r.setAttribute("alt", u), r.setAttribute("loading", "lazy"), r.setAttribute("referrerpolicy", "no-referrer");
653
699
  }
654
- r.tagName === "SPAN" && f && (r.setAttribute("data-person-id", f), r.setAttribute("contenteditable", "false")), r.tagName === "INPUT" && (r.setAttribute("type", "checkbox"), r.setAttribute("contenteditable", "false"), y && r.setAttribute("checked", "")), T && r.tagName === "LI" && r.setAttribute("data-task", "true");
700
+ r.tagName === "SPAN" && m && (r.setAttribute("data-person-id", m), r.setAttribute("contenteditable", "false")), r.tagName === "INPUT" && (r.setAttribute("type", "checkbox"), r.setAttribute("contenteditable", "false"), E && r.setAttribute("checked", "")), M && r.tagName === "LI" && r.setAttribute("data-task", "true");
655
701
  }
656
702
  };
657
703
  return n(e.content), e.innerHTML;
658
704
  }
659
- const we = {
705
+ const Ee = {
660
706
  undo: '<path d="M9 5 4 10l5 5M4 10h10a6 6 0 0 1 0 12"/>',
661
707
  redo: '<path d="m15 5 5 5-5 5m5-5H10a6 6 0 0 0 0 12"/>',
662
708
  expand: '<path d="M14 3h7v7m0-7-7 7M10 21H3v-7m0 7 7-7"/>',
@@ -669,945 +715,962 @@ const we = {
669
715
  indent: '<path d="M10 5h11M10 12h11M10 19h11M2 8l4 4-4 4"/>',
670
716
  line: '<path d="M3 12h18M3 5h3m3 0h3m3 0h3M3 19h3m3 0h3m3 0h3"/>'
671
717
  };
672
- function nt(t) {
718
+ function ht(t) {
673
719
  const e = a("div", `fc-rich${t.layout === "compact" ? " fc-rich-compact" : ""}`), n = a("div", "fc-rich-toolbar");
674
720
  n.setAttribute("role", "toolbar"), n.ariaLabel = "文本格式";
675
- const i = a("div", "fc-rich-tools");
676
- n.append(i);
677
- const o = a("div", "fc-rich-content");
678
- o.contentEditable = String(!t.readonly), o.setAttribute("role", "textbox"), o.setAttribute("aria-multiline", "true"), o.ariaLabel = t.field.label, o.tabIndex = t.readonly ? -1 : 0, o.innerHTML = me(t.value);
721
+ const s = a("div", "fc-rich-tools");
722
+ n.append(s);
723
+ const i = a("div", "fc-rich-content");
724
+ i.contentEditable = String(!t.readonly), i.setAttribute("role", "textbox"), i.setAttribute("aria-multiline", "true"), i.ariaLabel = t.field.label, i.tabIndex = t.readonly ? -1 : 0, i.innerHTML = me(t.value);
679
725
  const r = a("div", "fc-rich-menu");
680
726
  r.hidden = !0;
681
- let s = null, c = !1, u = [o.innerHTML], f = 0, y = !1, T = null, p, b;
682
- const h = () => {
727
+ let o = null, c = !1, u = [i.innerHTML], m = 0, E = !1, M = null, p, g;
728
+ const f = () => {
683
729
  const l = window.getSelection();
684
- l != null && l.rangeCount && o.contains(l.anchorNode) && o.contains(l.focusNode) && (s = l.getRangeAt(0).cloneRange());
685
- }, E = () => {
686
- o.focus();
730
+ l != null && l.rangeCount && i.contains(l.anchorNode) && i.contains(l.focusNode) && (o = l.getRangeAt(0).cloneRange());
731
+ }, y = () => {
732
+ i.focus();
687
733
  const l = window.getSelection();
688
734
  if (!l) return;
689
- const d = s && o.contains(s.commonAncestorContainer) ? s : document.createRange();
690
- d !== s && (d.selectNodeContents(o), d.collapse(!1)), l.removeAllRanges(), l.addRange(d), s = d;
691
- }, M = () => {
735
+ const d = o && i.contains(o.commonAncestorContainer) ? o : document.createRange();
736
+ d !== o && (d.selectNodeContents(i), d.collapse(!1)), l.removeAllRanges(), l.addRange(d), o = d;
737
+ }, D = () => {
692
738
  var d;
693
- const l = b;
694
- b = void 0, l == null || l.close(), (d = p == null ? void 0 : p.destroy) == null || d.call(p), p = void 0, r.hidden = !0, r.replaceChildren();
695
- }, m = /* @__PURE__ */ new Map(), L = () => {
739
+ const l = g;
740
+ g = void 0, l == null || l.close(), (d = p == null ? void 0 : p.destroy) == null || d.call(p), p = void 0, r.hidden = !0, r.replaceChildren();
741
+ }, w = /* @__PURE__ */ new Map(), x = () => {
696
742
  var l;
697
- m.get("撤销").disabled = t.readonly || f === 0, m.get("重做").disabled = t.readonly || f === u.length - 1;
698
- for (const [d, w] of [["加粗", "bold"], ["斜体", "italic"], ["下划线", "underline"], ["删除线", "strikeThrough"], ["有序列表", "insertOrderedList"], ["无序列表", "insertUnorderedList"]]) {
699
- const v = m.get(d);
700
- if (!v) continue;
701
- const k = !!((l = document.queryCommandState) != null && l.call(document, w));
702
- v.classList.toggle("active", k), v.setAttribute("aria-pressed", String(k));
743
+ w.get("撤销").disabled = t.readonly || m === 0, w.get("重做").disabled = t.readonly || m === u.length - 1;
744
+ for (const [d, L] of [["加粗", "bold"], ["斜体", "italic"], ["下划线", "underline"], ["删除线", "strikeThrough"], ["有序列表", "insertOrderedList"], ["无序列表", "insertUnorderedList"]]) {
745
+ const h = w.get(d);
746
+ if (!h) continue;
747
+ const k = !!((l = document.queryCommandState) != null && l.call(document, L));
748
+ h.classList.toggle("active", k), h.setAttribute("aria-pressed", String(k));
703
749
  }
704
- }, V = () => {
705
- y || (o.innerHTML !== u[f] && (u = u.slice(0, f + 1), u.push(o.innerHTML), u.length > 100 && u.shift(), f = u.length - 1), h(), L());
706
750
  }, N = () => {
707
- V(), o.dispatchEvent(new Event("change", { bubbles: !0 }));
708
- }, x = (l) => {
709
- const d = f + l;
710
- d < 0 || d >= u.length || (f = d, y = !0, o.innerHTML = u[f], s = null, E(), y = !1, L(), o.dispatchEvent(new Event("change", { bubbles: !0 })));
711
- }, A = (l, d) => {
712
- t.readonly || (E(), document.execCommand(l, !1, d), h(), M(), N());
713
- }, R = (l) => {
751
+ E || (i.innerHTML !== u[m] && (u = u.slice(0, m + 1), u.push(i.innerHTML), u.length > 100 && u.shift(), m = u.length - 1), f(), x());
752
+ }, S = () => {
753
+ N(), i.dispatchEvent(new Event("change", { bubbles: !0 }));
754
+ }, b = (l) => {
755
+ const d = m + l;
756
+ d < 0 || d >= u.length || (m = d, E = !0, i.innerHTML = u[m], o = null, y(), E = !1, x(), i.dispatchEvent(new Event("change", { bubbles: !0 })));
757
+ }, C = (l, d) => {
758
+ t.readonly || (y(), document.execCommand(l, !1, d), f(), D(), S());
759
+ }, V = (l) => {
714
760
  if (t.readonly) return;
715
- E();
761
+ y();
716
762
  const d = window.getSelection().getRangeAt(0);
717
- d.deleteContents(), d.insertNode(l), d.setStartAfter(l), d.collapse(!0), s = d.cloneRange(), M(), N();
718
- }, C = (l, d, w, v = !0) => {
719
- const k = a("button", v ? "fc-rich-tool fc-rich-advanced" : "fc-rich-tool");
720
- return k.type = "button", k.ariaLabel = l, k.title = l, k.disabled = t.readonly, we[d] ? k.innerHTML = `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${we[d]}</svg>` : k.textContent = d, k.onmousedown = (I) => {
721
- I.preventDefault(), h();
722
- }, k.onclick = (I) => {
723
- I.stopPropagation(), w();
724
- }, i.append(k), m.set(l, k), k;
725
- }, j = (l, d) => {
763
+ d.deleteContents(), d.insertNode(l), d.setStartAfter(l), d.collapse(!0), o = d.cloneRange(), D(), S();
764
+ }, A = (l, d, L, h = !0) => {
765
+ const k = a("button", h ? "fc-rich-tool fc-rich-advanced" : "fc-rich-tool");
766
+ return k.type = "button", k.ariaLabel = l, k.title = l, k.disabled = t.readonly, Ee[d] ? k.innerHTML = `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${Ee[d]}</svg>` : k.textContent = d, k.onmousedown = ($) => {
767
+ $.preventDefault(), f();
768
+ }, k.onclick = ($) => {
769
+ $.stopPropagation(), L();
770
+ }, s.append(k), w.set(l, k), k;
771
+ }, B = (l, d) => {
726
772
  if (!t.readonly) {
727
- if (h(), !r.hidden && r.ariaLabel === l) {
728
- M();
773
+ if (f(), !r.hidden && r.ariaLabel === l) {
774
+ D();
729
775
  return;
730
776
  }
731
- M(), r.className = "fc-rich-menu", r.ariaLabel = l, r.hidden = !1, b = ce({ anchor: m.get(l), anchorMode: "element", content: r, width: "auto", onDismiss: M, onEscape: E }), d(), b == null || b.reposition();
777
+ D(), r.className = "fc-rich-menu", r.ariaLabel = l, r.hidden = !1, g = ce({ anchor: w.get(l), anchorMode: "element", content: r, width: "auto", onDismiss: D, onEscape: y }), d(), g == null || g.reposition();
732
778
  }
733
- }, P = (l, d) => {
734
- const w = a("button", "fc-rich-menu-option", l);
735
- return w.type = "button", w.onmousedown = (v) => v.preventDefault(), w.onclick = (v) => {
736
- v.stopPropagation(), d();
737
- }, r.append(w), w;
779
+ }, Y = (l, d) => {
780
+ const L = a("button", "fc-rich-menu-option", l);
781
+ return L.type = "button", L.onmousedown = (h) => h.preventDefault(), L.onclick = (h) => {
782
+ h.stopPropagation(), d();
783
+ }, r.append(L), L;
738
784
  };
739
- C("撤销", "undo", () => x(-1), !1), C("重做", "redo", () => x(1), !1), C("格式刷", "paint", () => {
740
- h();
741
- const l = s == null ? void 0 : s.startContainer, d = (l == null ? void 0 : l.nodeType) === 1 ? l : l == null ? void 0 : l.parentElement;
742
- !d || !o.contains(d) || (T = { tag: /^(B|STRONG|I|EM|U|S)$/.test(d.tagName) ? d.tagName.toLowerCase() : "span", css: d.getAttribute("style") || "" }, m.get("格式刷").classList.add("active"));
743
- }), C("正文样式", "Aa⌄", () => j("正文样式", () => {
744
- for (const [l, d] of [["正文", "p"], ["标题 1", "h1"], ["标题 2", "h2"], ["标题 3", "h3"], ["标题 4", "h4"], ["标题 5", "h5"]]) P(l, () => A("formatBlock", d));
785
+ A("撤销", "undo", () => b(-1), !1), A("重做", "redo", () => b(1), !1), A("格式刷", "paint", () => {
786
+ f();
787
+ const l = o == null ? void 0 : o.startContainer, d = (l == null ? void 0 : l.nodeType) === 1 ? l : l == null ? void 0 : l.parentElement;
788
+ !d || !i.contains(d) || (M = { tag: /^(B|STRONG|I|EM|U|S)$/.test(d.tagName) ? d.tagName.toLowerCase() : "span", css: d.getAttribute("style") || "" }, w.get("格式刷").classList.add("active"));
789
+ }), A("正文样式", "Aa⌄", () => B("正文样式", () => {
790
+ for (const [l, d] of [["正文", "p"], ["标题 1", "h1"], ["标题 2", "h2"], ["标题 3", "h3"], ["标题 4", "h4"], ["标题 5", "h5"]]) Y(l, () => C("formatBlock", d));
745
791
  }));
746
- const B = ["#1f2329", "#8f959e", "#ffffff", "#f54a45", "#ff8800", "#ffc60a", "#34c724", "#14b8a6", "#3370ff", "#7f3bf5", "#f7cdd9", "#fce2cf", "#fff3b8", "#d9f5d6", "#d6e8ff", "#e9ddfa"];
747
- for (const [l, d, w] of [["文字颜色", "A⌄", "foreColor"], ["背景高亮", "▰⌄", "hiliteColor"]])
748
- C(l, d, () => j(l, () => {
792
+ const q = ["#1f2329", "#8f959e", "#ffffff", "#f54a45", "#ff8800", "#ffc60a", "#34c724", "#14b8a6", "#3370ff", "#7f3bf5", "#f7cdd9", "#fce2cf", "#fff3b8", "#d9f5d6", "#d6e8ff", "#e9ddfa"];
793
+ for (const [l, d, L] of [["文字颜色", "A⌄", "foreColor"], ["背景高亮", "▰⌄", "hiliteColor"]])
794
+ A(l, d, () => B(l, () => {
749
795
  r.classList.add("fc-rich-colors");
750
- for (const v of B) {
751
- const k = P(v, () => A(w, v));
752
- k.textContent = "", k.style.backgroundColor = v, k.ariaLabel = `${l} ${v}`;
796
+ for (const h of q) {
797
+ const k = Y(h, () => C(L, h));
798
+ k.textContent = "", k.style.backgroundColor = h, k.ariaLabel = `${l} ${h}`;
753
799
  }
754
- P("清除", () => A(w, w === "foreColor" ? "#1f2329" : "transparent"));
800
+ Y("清除", () => C(L, L === "foreColor" ? "#1f2329" : "transparent"));
755
801
  }));
756
- for (const [l, d, w] of [["加粗", "B", "bold"], ["斜体", "I", "italic"], ["下划线", "U", "underline"], ["删除线", "S", "strikeThrough"]]) C(l, d, () => A(w));
757
- C("对齐", "☰⌄", () => j("对齐", () => {
758
- for (const [l, d] of [["左对齐", "justifyLeft"], ["居中对齐", "justifyCenter"], ["右对齐", "justifyRight"], ["两端对齐", "justifyFull"]]) P(l, () => A(d));
759
- })), C("有序列表", "1≡", () => A("insertOrderedList")), C("无序列表", "•≡", () => A("insertUnorderedList")), C("任务列表", "task", () => {
760
- E();
761
- const l = window.getSelection().getRangeAt(0), d = a("ul"), w = a("li");
762
- w.dataset.task = "true";
763
- const v = a("input");
764
- v.type = "checkbox", v.contentEditable = "false", w.append(v, l.extractContents()), w.textContent || w.append(document.createTextNode("待办事项")), d.append(w), R(d);
765
- }), C("引用", "quote", () => A("formatBlock", "blockquote")), C("缩进", "indent", () => j("缩进", () => {
766
- P("增加缩进", () => A("indent")), P("减少缩进", () => A("outdent"));
767
- })), C("分隔线", "line", () => R(a("hr"))), C("表格", "table", () => j("表格", () => {
802
+ for (const [l, d, L] of [["加粗", "B", "bold"], ["斜体", "I", "italic"], ["下划线", "U", "underline"], ["删除线", "S", "strikeThrough"]]) A(l, d, () => C(L));
803
+ A("对齐", "☰⌄", () => B("对齐", () => {
804
+ for (const [l, d] of [["左对齐", "justifyLeft"], ["居中对齐", "justifyCenter"], ["右对齐", "justifyRight"], ["两端对齐", "justifyFull"]]) Y(l, () => C(d));
805
+ })), A("有序列表", "1≡", () => C("insertOrderedList")), A("无序列表", "•≡", () => C("insertUnorderedList")), A("任务列表", "task", () => {
806
+ y();
807
+ const l = window.getSelection().getRangeAt(0), d = a("ul"), L = a("li");
808
+ L.dataset.task = "true";
809
+ const h = a("input");
810
+ h.type = "checkbox", h.contentEditable = "false", L.append(h, l.extractContents()), L.textContent || L.append(document.createTextNode("待办事项")), d.append(L), V(d);
811
+ }), A("引用", "quote", () => C("formatBlock", "blockquote")), A("缩进", "indent", () => B("缩进", () => {
812
+ Y("增加缩进", () => C("indent")), Y("减少缩进", () => C("outdent"));
813
+ })), A("分隔线", "line", () => V(a("hr"))), A("表格", "table", () => B("表格", () => {
768
814
  const l = a("p", "", "选择行列"), d = a("div", "fc-rich-table-grid");
769
815
  r.append(l, d);
770
- for (let w = 1; w <= 6; w++) for (let v = 1; v <= 6; v++) {
816
+ for (let L = 1; L <= 6; L++) for (let h = 1; h <= 6; h++) {
771
817
  const k = a("button");
772
- k.type = "button", k.ariaLabel = `${w}行${v}列表格`, k.dataset.row = String(w), k.dataset.col = String(v), k.onmousedown = (I) => I.preventDefault(), k.onmouseenter = () => {
773
- l.textContent = `${w} × ${v}`, d.querySelectorAll("button").forEach((I) => I.classList.toggle("active", Number(I.dataset.row) <= w && Number(I.dataset.col) <= v));
818
+ k.type = "button", k.ariaLabel = `${L}行${h}列表格`, k.dataset.row = String(L), k.dataset.col = String(h), k.onmousedown = ($) => $.preventDefault(), k.onmouseenter = () => {
819
+ l.textContent = `${L} × ${h}`, d.querySelectorAll("button").forEach(($) => $.classList.toggle("active", Number($.dataset.row) <= L && Number($.dataset.col) <= h));
774
820
  }, k.onclick = () => {
775
- const I = a("table"), W = a("tbody");
776
- for (let G = 0; G < w; G++) {
777
- const z = a("tr");
778
- for (let J = 0; J < v; J++) {
779
- const ee = a("td");
780
- ee.append(a("br")), z.append(ee);
821
+ const $ = a("table"), U = a("tbody");
822
+ for (let te = 0; te < L; te++) {
823
+ const G = a("tr");
824
+ for (let Z = 0; Z < h; Z++) {
825
+ const W = a("td");
826
+ W.append(a("br")), G.append(W);
781
827
  }
782
- W.append(z);
828
+ U.append(G);
783
829
  }
784
- I.append(W), R(I);
785
- const U = document.createRange();
786
- U.selectNodeContents(I.querySelector("td")), U.collapse(!0), s = U, E();
830
+ $.append(U), V($);
831
+ const _ = document.createRange();
832
+ _.selectNodeContents($.querySelector("td")), _.collapse(!0), o = _, y();
787
833
  }, d.append(k);
788
834
  }
789
835
  }));
790
- const q = () => j("链接", () => {
836
+ const P = () => B("链接", () => {
791
837
  const l = a("input", "fc-input");
792
- l.ariaLabel = "链接文本", l.placeholder = "输入文本", l.value = (s == null ? void 0 : s.toString()) || "";
838
+ l.ariaLabel = "链接文本", l.placeholder = "输入文本", l.value = (o == null ? void 0 : o.toString()) || "";
793
839
  const d = a("input", "fc-input");
794
840
  d.ariaLabel = "链接地址", d.placeholder = "粘贴或输入超链接";
795
- const w = a("div", "fc-error"), v = a("button", "primary", "确定");
796
- v.type = "button", v.onclick = () => {
841
+ const L = a("div", "fc-error"), h = a("button", "primary", "确定");
842
+ h.type = "button", h.onclick = () => {
797
843
  const k = d.value.trim();
798
- if (!$e(k)) {
799
- w.textContent = "请输入 http、https 或 mailto 链接";
844
+ if (!je(k)) {
845
+ L.textContent = "请输入 http、https 或 mailto 链接";
800
846
  return;
801
847
  }
802
- const I = a("a", "", l.value || k);
803
- I.href = k, I.target = "_blank", I.rel = "noopener noreferrer", R(I);
804
- }, r.append(a("span", "", "文本"), l, a("span", "", "链接"), d, w, v), l.focus();
848
+ const $ = a("a", "", l.value || k);
849
+ $.href = k, $.target = "_blank", $.rel = "noopener noreferrer", V($);
850
+ }, r.append(a("span", "", "文本"), l, a("span", "", "链接"), d, L, h), l.focus();
805
851
  });
806
- C("链接", "link", q), C("插入图片", "▧", () => j("插入图片", () => {
852
+ A("链接", "link", P), A("插入图片", "▧", () => B("插入图片", () => {
807
853
  const l = a("input", "fc-input");
808
854
  l.type = "url", l.ariaLabel = "图片地址", l.placeholder = "https:// 图片地址";
809
855
  const d = a("input", "fc-input");
810
856
  d.ariaLabel = "图片说明", d.placeholder = "图片说明";
811
- const w = a("div", "fc-error"), v = a("button", "primary", "插入");
812
- v.type = "button", v.onclick = () => {
857
+ const L = a("div", "fc-error"), h = a("button", "primary", "插入");
858
+ h.type = "button", h.onclick = () => {
813
859
  if (!/^https?:\/\//i.test(l.value.trim()) || !l.checkValidity()) {
814
- w.textContent = "请输入有效的 http 或 https 图片地址";
860
+ L.textContent = "请输入有效的 http 或 https 图片地址";
815
861
  return;
816
862
  }
817
863
  const k = a("img");
818
- k.src = l.value.trim(), k.alt = d.value, k.referrerPolicy = "no-referrer", R(k);
819
- }, r.append(l, d, w, v), l.focus();
820
- })), C("提及人员", "@", () => j("提及人员", () => {
864
+ k.src = l.value.trim(), k.alt = d.value, k.referrerPolicy = "no-referrer", V(k);
865
+ }, r.append(l, d, L, h), l.focus();
866
+ })), A("提及人员", "@", () => B("提及人员", () => {
821
867
  var d;
822
- const l = xe(!1, { ...t, value: "", field: { ...t.field, label: "人员" } }, "person");
823
- p = l, r.append(l.element), l.element.addEventListener("change", (w) => {
824
- var I, W;
825
- w.stopPropagation();
826
- const v = String(l.read());
827
- if (!v) return;
828
- const k = a("span", "", "@" + (((I = Q(t.field).find((U) => U.id === v)) == null ? void 0 : I.label) || ((W = l.element.querySelector("option:checked")) == null ? void 0 : W.textContent) || v));
829
- k.dataset.personId = v, k.contentEditable = "false", R(k);
868
+ const l = Se(!1, { ...t, value: "", field: { ...t.field, label: "人员" } }, "person");
869
+ p = l, r.append(l.element), l.element.addEventListener("change", (L) => {
870
+ var $, U;
871
+ L.stopPropagation();
872
+ const h = String(l.read());
873
+ if (!h) return;
874
+ const k = a("span", "", "@" + ((($ = X(t.field).find((_) => _.id === h)) == null ? void 0 : $.label) || ((U = l.element.querySelector("option:checked")) == null ? void 0 : U.textContent) || h));
875
+ k.dataset.personId = h, k.contentEditable = "false", V(k);
830
876
  }), (d = l.focus) == null || d.call(l);
831
- })), C("代码块", "{ }", () => A("formatBlock", "pre")), C("表情", "☺", () => j("表情", () => {
877
+ })), A("代码块", "{ }", () => C("formatBlock", "pre")), A("表情", "☺", () => B("表情", () => {
832
878
  r.classList.add("fc-rich-emojis");
833
- for (const l of ["😀", "😊", "😂", "👍", "👏", "🎉", "❤️", "🔥", "✅", "💡", "🚀", "👀", "🤔", "🙏", "💪", "⭐"]) P(l, () => R(document.createTextNode(l)));
879
+ for (const l of ["😀", "😊", "😂", "👍", "👏", "🎉", "❤️", "🔥", "✅", "💡", "🚀", "👀", "🤔", "🙏", "💪", "⭐"]) Y(l, () => V(document.createTextNode(l)));
834
880
  }));
835
- const O = C("全屏编辑", "expand", () => {
836
- h(), c = !c, e.classList.toggle("is-fullscreen", c), M(), O.ariaLabel = O.title = c ? "收起全屏" : "全屏编辑", O.innerHTML = `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">${we[c ? "collapse" : "expand"]}</svg>`, E();
881
+ const I = A("全屏编辑", "expand", () => {
882
+ f(), c = !c, e.classList.toggle("is-fullscreen", c), D(), I.ariaLabel = I.title = c ? "收起全屏" : "全屏编辑", I.innerHTML = `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7">${Ee[c ? "collapse" : "expand"]}</svg>`, y();
837
883
  }, !1);
838
- O.disabled = !1, O.classList.add("fc-rich-expand"), n.append(O);
839
- const F = () => {
840
- for (const l of i.children) l.inert = l.offsetTop >= i.clientHeight;
841
- }, $ = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(F);
842
- $ == null || $.observe(i);
843
- const Y = (l) => {
884
+ I.disabled = !1, I.classList.add("fc-rich-expand"), n.append(I);
885
+ const R = () => {
886
+ for (const l of s.children) l.inert = l.offsetTop >= s.clientHeight;
887
+ }, H = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(R);
888
+ H == null || H.observe(s);
889
+ const j = (l) => {
844
890
  const d = l.target;
845
- o.contains(d) || d.closest("input,textarea,select,[contenteditable=true]") || (l.preventDefault(), !e.contains(document.activeElement) && !r.contains(document.activeElement) && E());
891
+ i.contains(d) || d.closest("input,textarea,select,[contenteditable=true]") || (l.preventDefault(), !e.contains(document.activeElement) && !r.contains(document.activeElement) && y());
846
892
  };
847
- return e.addEventListener("mousedown", Y), r.addEventListener("mousedown", Y), o.addEventListener("input", V), o.addEventListener("mouseup", () => {
848
- if (h(), L(), T && s && !s.collapsed) {
849
- const l = s, d = a(T.tag);
850
- d.style.cssText = T.css, d.append(l.extractContents()), l.insertNode(d), T = null, m.get("格式刷").classList.remove("active"), N();
893
+ return e.addEventListener("mousedown", j), r.addEventListener("mousedown", j), i.addEventListener("input", N), i.addEventListener("mouseup", () => {
894
+ if (f(), x(), M && o && !o.collapsed) {
895
+ const l = o, d = a(M.tag);
896
+ d.style.cssText = M.css, d.append(l.extractContents()), l.insertNode(d), M = null, w.get("格式刷").classList.remove("active"), S();
851
897
  }
852
- }), o.addEventListener("keyup", () => {
853
- h(), L();
854
- }), o.addEventListener("click", (l) => {
898
+ }), i.addEventListener("keyup", () => {
899
+ f(), x();
900
+ }), i.addEventListener("click", (l) => {
855
901
  const d = l.target;
856
902
  if (d.tagName === "A" && l.preventDefault(), d instanceof HTMLInputElement && d.type === "checkbox") {
857
903
  if (t.readonly) {
858
904
  l.preventDefault();
859
905
  return;
860
906
  }
861
- d.toggleAttribute("checked", d.checked), N();
907
+ d.toggleAttribute("checked", d.checked), S();
862
908
  }
863
- M();
864
- }), o.addEventListener("drop", (l) => l.preventDefault()), o.addEventListener("paste", (l) => {
865
- var w, v;
909
+ D();
910
+ }), i.addEventListener("drop", (l) => l.preventDefault()), i.addEventListener("paste", (l) => {
911
+ var L, h;
866
912
  if (t.readonly) {
867
913
  l.preventDefault();
868
914
  return;
869
915
  }
870
- l.preventDefault(), h();
871
- const d = (w = l.clipboardData) == null ? void 0 : w.getData("text/html");
916
+ l.preventDefault(), f();
917
+ const d = (L = l.clipboardData) == null ? void 0 : L.getData("text/html");
872
918
  if (d) {
873
919
  const k = document.createElement("template");
874
920
  k.innerHTML = me(d);
875
- const I = k.content, W = document.createTextNode("");
876
- I.append(W), E();
877
- const U = window.getSelection().getRangeAt(0);
878
- U.deleteContents(), U.insertNode(I), U.setStartAfter(W), U.collapse(!0), s = U.cloneRange(), N();
879
- } else R(document.createTextNode(((v = l.clipboardData) == null ? void 0 : v.getData("text/plain")) || ""));
921
+ const $ = k.content, U = document.createTextNode("");
922
+ $.append(U), y();
923
+ const _ = window.getSelection().getRangeAt(0);
924
+ _.deleteContents(), _.insertNode($), _.setStartAfter(U), _.collapse(!0), o = _.cloneRange(), S();
925
+ } else V(document.createTextNode(((h = l.clipboardData) == null ? void 0 : h.getData("text/plain")) || ""));
880
926
  }), e.addEventListener("keydown", (l) => {
881
- l.key === "Escape" && !r.hidden ? (l.preventDefault(), l.stopPropagation(), M(), E()) : l.key === "Escape" && c ? (l.preventDefault(), l.stopPropagation(), O.click()) : !t.readonly && (l.metaKey || l.ctrlKey) && l.key.toLowerCase() === "z" ? (l.preventDefault(), x(l.shiftKey ? 1 : -1)) : (l.metaKey || l.ctrlKey) && l.key.toLowerCase() === "k" && (l.preventDefault(), h(), q());
882
- }), e.append(n, o), L(), { element: e, content: r, inputRoot: e, read: () => me(o.innerHTML), validate: () => {
927
+ l.key === "Escape" && !r.hidden ? (l.preventDefault(), l.stopPropagation(), D(), y()) : l.key === "Escape" && c ? (l.preventDefault(), l.stopPropagation(), I.click()) : !t.readonly && (l.metaKey || l.ctrlKey) && l.key.toLowerCase() === "z" ? (l.preventDefault(), b(l.shiftKey ? 1 : -1)) : (l.metaKey || l.ctrlKey) && l.key.toLowerCase() === "k" && (l.preventDefault(), f(), P());
928
+ }), e.append(n, i), x(), { element: e, content: r, inputRoot: e, read: () => me(i.innerHTML), validate: () => {
883
929
  var l;
884
- return t.field.required && !((l = o.textContent) != null && l.trim()) && !o.querySelector("img") ? "请填写内容" : void 0;
885
- }, focus: () => o.focus(), deactivate: () => {
886
- M(), c = !1, e.classList.remove("is-fullscreen"), O.ariaLabel = O.title = "全屏编辑";
930
+ return t.field.required && !((l = i.textContent) != null && l.trim()) && !i.querySelector("img") ? "请填写内容" : void 0;
931
+ }, focus: () => i.focus(), deactivate: () => {
932
+ D(), c = !1, e.classList.remove("is-fullscreen"), I.ariaLabel = I.title = "全屏编辑";
887
933
  }, destroy: () => {
888
- $ == null || $.disconnect(), M();
934
+ H == null || H.disconnect(), D();
889
935
  } };
890
936
  }
891
- const Oe = (t) => t == null ? "" : String(t);
892
- function it(t) {
937
+ const Ue = (t) => t == null ? "" : String(t);
938
+ function mt(t) {
893
939
  var n;
894
940
  const e = a("div", `fc-value fc-${t.className || ""}`);
895
941
  if (t.field.kind === "richText" || t.field.kind === "richtext" || t.field.kind === "longText" || t.field.control === "richText") e.innerHTML = me(t.value);
896
942
  else if (t.field.kind === "number" && typeof t.value == "number") {
897
- const i = t.field.numberOptions;
898
- e.textContent = t.value.toLocaleString("zh-CN", { useGrouping: (i == null ? void 0 : i.thousandsSeparator) ?? !1, maximumFractionDigits: (i == null ? void 0 : i.decimals) ?? 10 }) + ((i == null ? void 0 : i.suffix) || ""), e.classList.add("fc-plain");
943
+ const s = t.field.numberOptions;
944
+ e.textContent = t.value.toLocaleString("zh-CN", { useGrouping: (s == null ? void 0 : s.thousandsSeparator) ?? !1, maximumFractionDigits: (s == null ? void 0 : s.decimals) ?? 10 }) + ((s == null ? void 0 : s.suffix) || ""), e.classList.add("fc-plain");
899
945
  } else
900
- e.textContent = Oe(t.value), e.classList.add("fc-plain");
946
+ e.textContent = Ue(t.value), e.classList.add("fc-plain");
901
947
  return (n = e.textContent) != null && n.trim() || (e.textContent = "待填", e.classList.add("fc-empty")), e;
902
948
  }
903
- function Pe(t, e) {
904
- const i = t === "text" && e.layout !== "compact" ? a("textarea", "fc-input fc-textarea") : a("input", "fc-input");
905
- if (i instanceof HTMLInputElement && (i.type = t), i.value = Oe(e.value), i.disabled = e.readonly, i.required = !!e.field.required, i.ariaLabel = e.field.label, i.placeholder = e.field.placeholder || (e.layout !== "compact" ? "待填" : `请输入${e.field.label}`), e.field.maxLength !== void 0 && (i.maxLength = e.field.maxLength), t === "number" && i instanceof HTMLInputElement) {
906
- const o = e.field.numberOptions;
907
- i.step = String((o == null ? void 0 : o.step) ?? "any"), (o == null ? void 0 : o.min) !== void 0 && (i.min = String(o.min)), (o == null ? void 0 : o.max) !== void 0 && (i.max = String(o.max));
949
+ function We(t, e) {
950
+ const s = t === "text" && e.layout !== "compact" ? a("textarea", "fc-input fc-textarea") : a("input", "fc-input");
951
+ if (s instanceof HTMLInputElement && (s.type = t), s.value = Ue(e.value), s.disabled = e.readonly, s.required = !!e.field.required, s.ariaLabel = e.field.label, s.placeholder = e.field.placeholder || (e.layout !== "compact" ? "待填" : `请输入${e.field.label}`), e.field.maxLength !== void 0 && (s.maxLength = e.field.maxLength), t === "number" && s instanceof HTMLInputElement) {
952
+ const i = e.field.numberOptions;
953
+ s.step = String((i == null ? void 0 : i.step) ?? "any"), (i == null ? void 0 : i.min) !== void 0 && (s.min = String(i.min)), (i == null ? void 0 : i.max) !== void 0 && (s.max = String(i.max));
908
954
  }
909
- return i instanceof HTMLTextAreaElement && Fe(i), t === "text" && e.layout !== "compact" && i.addEventListener("keydown", (o) => {
910
- o.key === "Enter" && (o.preventDefault(), i.dispatchEvent(new Event("fc-collapse", { bubbles: !0 })));
955
+ return s instanceof HTMLTextAreaElement && ze(s), t === "text" && e.layout !== "compact" && s.addEventListener("keydown", (i) => {
956
+ i.key === "Enter" && (i.preventDefault(), s.dispatchEvent(new Event("fc-collapse", { bubbles: !0 })));
911
957
  }), {
912
- element: i,
913
- read: () => t === "number" ? i.value === "" ? null : Number(i.value) : i.value,
914
- validate: () => e.field.required && !i.value.trim() ? "此项必填" : i.checkValidity() ? void 0 : i.validationMessage || "请填写有效值",
915
- focus: () => i.focus()
958
+ element: s,
959
+ read: () => t === "number" ? s.value === "" ? null : Number(s.value) : s.value,
960
+ validate: () => e.field.required && !s.value.trim() ? "此项必填" : s.checkValidity() ? void 0 : s.validationMessage || "请填写有效值",
961
+ focus: () => s.focus()
916
962
  };
917
963
  }
918
- const oe = (t) => t == null ? "" : String(t), ie = (t) => t.dispatchEvent(new Event("change", { bubbles: !0 }));
919
- function Ae(t) {
964
+ const re = (t) => t == null ? "" : String(t), oe = (t) => t.dispatchEvent(new Event("change", { bubbles: !0 }));
965
+ function De(t) {
920
966
  try {
921
- const e = new URL(oe(t));
967
+ const e = new URL(re(t));
922
968
  return ["http:", "https:"].includes(e.protocol) ? e.href : void 0;
923
969
  } catch {
924
970
  return;
925
971
  }
926
972
  }
927
973
  function ue(t) {
928
- return a("div", "fc-value fc-plain fc-" + (t.className || "") + (t.value == null || t.value === "" ? " fc-empty" : ""), oe(t.value) || "待填");
974
+ return a("div", "fc-value fc-plain fc-" + (t.className || "") + (t.value == null || t.value === "" ? " fc-empty" : ""), re(t.value) || "待填");
929
975
  }
930
976
  function ve(t, e) {
931
977
  const n = e === "textarea" ? a("textarea", "fc-input fc-textarea") : a("input", "fc-input");
932
- return n instanceof HTMLInputElement && (n.type = e), n instanceof HTMLTextAreaElement && Fe(n), n.value = oe(t.value), n.disabled = t.readonly, n.required = !!t.field.required, n.ariaLabel = t.field.label, n.placeholder = t.field.placeholder || "请输入" + t.field.label, t.field.maxLength !== void 0 && (n.maxLength = t.field.maxLength), {
978
+ return n instanceof HTMLInputElement && (n.type = e), n instanceof HTMLTextAreaElement && ze(n), n.value = re(t.value), n.disabled = t.readonly, n.required = !!t.field.required, n.ariaLabel = t.field.label, n.placeholder = t.field.placeholder || "请输入" + t.field.label, t.field.maxLength !== void 0 && (n.maxLength = t.field.maxLength), {
933
979
  element: n,
934
980
  read: () => n.value,
935
981
  focus: () => n.focus(),
936
- validate: () => e === "url" && n.value && !Ae(n.value) ? "请输入 http 或 https 链接" : n.checkValidity() ? void 0 : "请填写有效的" + t.field.label
982
+ validate: () => e === "url" && n.value && !De(n.value) ? "请输入 http 或 https 链接" : n.checkValidity() ? void 0 : "请填写有效的" + t.field.label
937
983
  };
938
984
  }
939
- function ot(t) {
940
- const e = a("div", "fc-link-value"), n = Ae(t.value);
985
+ function bt(t) {
986
+ const e = a("div", "fc-link-value"), n = De(t.value);
941
987
  if (!n) return ue(t);
942
- const i = a("a", "fc-link", oe(t.value));
943
- return i.href = n, i.target = "_blank", i.rel = "noopener noreferrer", i.onclick = (o) => o.stopPropagation(), e.append(a("span", "fc-link-icon", "↗"), i), e;
988
+ const s = a("a", "fc-link", re(t.value));
989
+ return s.href = n, s.target = "_blank", s.rel = "noopener noreferrer", s.onclick = (i) => i.stopPropagation(), e.append(a("span", "fc-link-icon", "↗"), s), e;
944
990
  }
945
- function qe(t) {
991
+ function Ke(t) {
946
992
  let e = t.value == null || t.value === "" ? null : t.value === !0;
947
- const n = a("div", "fc-switch-field"), i = a("button", "fc-switch");
948
- i.type = "button", i.setAttribute("role", "switch"), i.ariaLabel = t.field.label, i.disabled = t.readonly;
949
- const o = a("span"), r = () => {
950
- i.setAttribute("aria-checked", String(e === !0)), n.dataset.empty = String(e === null), o.textContent = e === null ? "待填" : e ? "是" : "否";
993
+ const n = a("div", "fc-switch-field"), s = a("button", "fc-switch");
994
+ s.type = "button", s.setAttribute("role", "switch"), s.ariaLabel = t.field.label, s.disabled = t.readonly;
995
+ const i = a("span"), r = () => {
996
+ s.setAttribute("aria-checked", String(e === !0)), n.dataset.empty = String(e === null), i.textContent = e === null ? "待填" : e ? "是" : "否";
951
997
  };
952
- return i.onclick = () => {
953
- t.readonly || (e = !e, r(), ie(n));
954
- }, n.append(i, o), r(), { element: n, read: () => e, focus: () => i.focus() };
998
+ return s.onclick = () => {
999
+ t.readonly || (e = !e, r(), oe(n));
1000
+ }, n.append(s, i), r(), { element: n, read: () => e, focus: () => s.focus() };
955
1001
  }
956
- function st(t) {
957
- return qe({ ...t, readonly: !0 }).element;
1002
+ function vt(t) {
1003
+ return Ke({ ...t, readonly: !0 }).element;
958
1004
  }
959
- function rt(t) {
1005
+ function gt(t) {
960
1006
  const e = a("div", "fc-signals"), n = Array.isArray(t.value) ? t.value : [t.value];
961
- for (const i of n.filter((o) => o != null && o !== "")) {
962
- const o = typeof i == "object" ? i : { status: i }, r = o.status ?? o.value, s = r === !0 || r === "passed" || r === "success", c = a("span", "fc-signal " + (s ? "is-success" : "is-pending"), (s ? "● " : "○ ") + oe(o.label || o.name || (s ? "已满足" : r === !1 ? "未满足" : r || "等待信号")));
1007
+ for (const s of n.filter((i) => i != null && i !== "")) {
1008
+ const i = typeof s == "object" ? s : { status: s }, r = i.status ?? i.value, o = r === !0 || r === "passed" || r === "success", c = a("span", "fc-signal " + (o ? "is-success" : "is-pending"), (o ? "● " : "○ ") + re(i.label || i.name || (o ? "已满足" : r === !1 ? "未满足" : r || "等待信号")));
963
1009
  e.append(c);
964
1010
  }
965
1011
  return e.children.length || e.append(a("span", "fc-empty", "等待外部信号")), e;
966
1012
  }
967
- function at(t) {
1013
+ function yt(t) {
968
1014
  const e = t.value && typeof t.value == "object" ? t.value.display ?? t.value.value : t.value;
969
1015
  return ue({ ...t, value: e != null && typeof e != "object" ? e : "" });
970
1016
  }
971
- function lt(t, e) {
1017
+ function wt(t, e) {
972
1018
  const n = a("div", "fc-readonly");
973
1019
  return n.append(e(t), a("small", "fc-service-note", "由系统更新 · 只读")), { element: n, read: () => t.value };
974
1020
  }
975
- function Me(t) {
1021
+ function He(t) {
976
1022
  const e = t.field.radioValueType === "boolean";
977
1023
  let n = t.value == null ? "" : String(t.value);
978
- const i = a("div", "fc-radio-group fc-choice--radio");
979
- i.setAttribute("role", "radiogroup"), i.ariaLabel = t.field.label;
980
- const o = [], r = () => {
981
- const s = o.find((c) => c.dataset.value === n && !c.disabled) ?? o.find((c) => !c.disabled);
982
- for (const c of o) {
1024
+ const s = a("div", "fc-radio-group fc-choice--radio");
1025
+ s.setAttribute("role", "radiogroup"), s.ariaLabel = t.field.label;
1026
+ const i = [], r = () => {
1027
+ const o = i.find((c) => c.dataset.value === n && !c.disabled) ?? i.find((c) => !c.disabled);
1028
+ for (const c of i) {
983
1029
  const u = c.dataset.value === n;
984
- c.setAttribute("aria-checked", String(u)), c.classList.toggle("selected", u), c.tabIndex = c === s ? 0 : -1;
1030
+ c.setAttribute("aria-checked", String(u)), c.classList.toggle("selected", u), c.tabIndex = c === o ? 0 : -1;
985
1031
  }
986
1032
  };
987
- for (const s of Q(t.field)) {
1033
+ for (const o of X(t.field)) {
988
1034
  const c = a("button", "fc-option fc-radio-option");
989
- c.type = "button", c.dataset.value = s.id, c.setAttribute("role", "radio"), c.disabled = t.readonly || !!s.disabled;
1035
+ c.type = "button", c.dataset.value = o.id, c.setAttribute("role", "radio"), c.disabled = t.readonly || !!o.disabled;
990
1036
  const u = a("span", "fc-radio-dot");
991
- u.ariaHidden = "true", c.append(u, a("span", "fc-option-label", s.label)), c.onclick = (f) => {
992
- f.stopPropagation(), !(c.disabled || n === s.id) && (n = s.id, r(), ie(i));
993
- }, c.onkeydown = (f) => {
994
- var h, E;
995
- if (!["ArrowRight", "ArrowDown", "ArrowLeft", "ArrowUp", "Home", "End"].includes(f.key) || t.readonly) return;
996
- f.preventDefault(), f.stopPropagation();
997
- const T = o.filter((M) => !M.disabled), p = T.indexOf(c), b = f.key === "Home" ? 0 : f.key === "End" ? T.length - 1 : (p + (["ArrowLeft", "ArrowUp"].includes(f.key) ? -1 : 1) + T.length) % T.length;
998
- (h = T[b]) == null || h.focus(), (E = T[b]) == null || E.click();
999
- }, o.push(c), i.append(c);
1000
- }
1001
- return o.length ? n && !o.some((s) => s.dataset.value === n) && i.append(a("span", "fc-empty", "已选选项不可用")) : i.append(a("span", "fc-empty", "暂无选项")), r(), {
1002
- element: i,
1037
+ u.ariaHidden = "true", c.append(u, a("span", "fc-option-label", o.label)), c.onclick = (m) => {
1038
+ m.stopPropagation(), !(c.disabled || n === o.id) && (n = o.id, r(), oe(s));
1039
+ }, c.onkeydown = (m) => {
1040
+ var f, y;
1041
+ if (!["ArrowRight", "ArrowDown", "ArrowLeft", "ArrowUp", "Home", "End"].includes(m.key) || t.readonly) return;
1042
+ m.preventDefault(), m.stopPropagation();
1043
+ const M = i.filter((D) => !D.disabled), p = M.indexOf(c), g = m.key === "Home" ? 0 : m.key === "End" ? M.length - 1 : (p + (["ArrowLeft", "ArrowUp"].includes(m.key) ? -1 : 1) + M.length) % M.length;
1044
+ (f = M[g]) == null || f.focus(), (y = M[g]) == null || y.click();
1045
+ }, i.push(c), s.append(c);
1046
+ }
1047
+ return i.length ? n && !i.some((o) => o.dataset.value === n) && s.append(a("span", "fc-empty", "已选选项不可用")) : s.append(a("span", "fc-empty", "暂无选项")), r(), {
1048
+ element: s,
1003
1049
  read: () => e ? n === "" ? null : n === "true" : n,
1004
1050
  focus: () => {
1005
- var s;
1006
- return (s = o.find((c) => c.tabIndex === 0)) == null ? void 0 : s.focus();
1051
+ var o;
1052
+ return (o = i.find((c) => c.tabIndex === 0)) == null ? void 0 : o.focus();
1007
1053
  },
1008
1054
  validate: () => t.field.required && !n ? "请选择一个选项" : void 0
1009
1055
  };
1010
1056
  }
1011
- const Be = (t) => !Array.isArray(t) || !t.length ? [] : Array.isArray(t[0]) ? t.map((e) => e.map(String)) : [t.map(String)];
1057
+ const Ge = (t) => !Array.isArray(t) || !t.length ? [] : Array.isArray(t[0]) ? t.map((e) => e.map(String)) : [t.map(String)];
1012
1058
  function le(t, e) {
1013
1059
  const n = [];
1014
- for (const i of e) {
1015
- const o = t.find((r) => r.id === i);
1016
- n.push((o == null ? void 0 : o.label) || i), t = (o == null ? void 0 : o.children) || [];
1060
+ for (const s of e) {
1061
+ const i = t.find((r) => r.id === s);
1062
+ n.push((i == null ? void 0 : i.label) || s), t = (i == null ? void 0 : i.children) || [];
1017
1063
  }
1018
1064
  return n.join(" / ");
1019
1065
  }
1020
- function dt(t) {
1066
+ function kt(t) {
1021
1067
  const e = a("div", "fc-tags");
1022
- for (const n of Be(t.value)) {
1023
- const i = a("span", "fc-tag");
1024
- i.append(a("span", "fc-tag-label", le(Q(t.field), n))), e.append(i);
1068
+ for (const n of Ge(t.value)) {
1069
+ const s = a("span", "fc-tag");
1070
+ s.append(a("span", "fc-tag-label", le(X(t.field), n))), e.append(s);
1025
1071
  }
1026
1072
  return e.children.length || e.append(a("span", "fc-empty", "待填")), e;
1027
1073
  }
1028
- function ct(t, e) {
1029
- const n = a("div", "fc-cascade"), i = a("div", "fc-choice-selection"), o = a("input", "fc-choice-search");
1030
- o.placeholder = "", o.autocomplete = "off", o.ariaLabel = "输入以搜索" + e.field.label, o.disabled = e.readonly;
1074
+ function Et(t, e) {
1075
+ const n = a("div", "fc-cascade"), s = a("div", "fc-choice-selection"), i = a("input", "fc-choice-search");
1076
+ i.placeholder = "", i.autocomplete = "off", i.ariaLabel = "输入以搜索" + e.field.label, i.disabled = e.readonly;
1031
1077
  const r = () => {
1032
- o.size = Math.max(1, [...o.value].length + 1);
1078
+ i.size = Math.max(1, [...i.value].length + 1);
1033
1079
  };
1034
1080
  r();
1035
- const s = a("div", "fc-cascade-columns"), c = a("div", "fc-error");
1081
+ const o = a("div", "fc-cascade-columns"), c = a("div", "fc-error");
1036
1082
  c.setAttribute("role", "status");
1037
- const u = Q(e.field);
1038
- let f = Be(e.value), y = [];
1039
- const T = [], p = (x, A, R = !1) => x.forEach((C) => {
1040
- var j;
1041
- (j = C.children) != null && j.length ? p(C.children, [...A, C.id], R || !!C.disabled) : T.push({ path: [...A, C.id], disabled: R || !!C.disabled });
1083
+ const u = X(e.field);
1084
+ let m = Ge(e.value), E = [];
1085
+ const M = [], p = (b, C, V = !1) => b.forEach((A) => {
1086
+ var B;
1087
+ (B = A.children) != null && B.length ? p(A.children, [...C, A.id], V || !!A.disabled) : M.push({ path: [...C, A.id], disabled: V || !!A.disabled });
1042
1088
  });
1043
1089
  p(u, []);
1044
- const b = (x, A) => JSON.stringify(x) === JSON.stringify(A), h = e.layout !== "compact" && !e.readonly;
1045
- let E;
1046
- const M = () => {
1047
- const x = E;
1048
- E = void 0, x == null || x.close();
1049
- }, m = () => {
1050
- !h || E || e.readonly || (E = ce({ anchor: o.parentElement || n, content: s, width: "anchor", gap: 4, onDismiss: () => {
1051
- E = void 0;
1090
+ const g = (b, C) => JSON.stringify(b) === JSON.stringify(C), f = e.layout !== "compact" && !e.readonly;
1091
+ let y;
1092
+ const D = () => {
1093
+ const b = y;
1094
+ y = void 0, b == null || b.close();
1095
+ }, w = () => {
1096
+ !f || y || e.readonly || (y = ce({ anchor: i.parentElement || n, content: o, width: "anchor", gap: 4, onDismiss: () => {
1097
+ y = void 0;
1052
1098
  } }));
1053
- }, L = () => {
1054
- !h || !E || (M(), n.dispatchEvent(new Event("fc-collapse", { bubbles: !0 })));
1055
- }, V = (x) => {
1099
+ }, x = () => {
1100
+ !f || !y || (D(), n.dispatchEvent(new Event("fc-collapse", { bubbles: !0 })));
1101
+ }, N = (b) => {
1056
1102
  if (e.readonly) return;
1057
- const A = f.findIndex((R) => b(R, x));
1058
- if (t && A >= 0) f.splice(A, 1);
1103
+ const C = m.findIndex((V) => g(V, b));
1104
+ if (t && C >= 0) m.splice(C, 1);
1059
1105
  else {
1060
- if (t && e.field.maxSelections && f.length >= e.field.maxSelections) {
1106
+ if (t && e.field.maxSelections && m.length >= e.field.maxSelections) {
1061
1107
  c.textContent = "最多可选择 " + e.field.maxSelections + " 项";
1062
1108
  return;
1063
1109
  }
1064
- f = t ? [...f, x] : [x];
1110
+ m = t ? [...m, b] : [b];
1065
1111
  }
1066
- c.textContent = "", N(), n.dispatchEvent(new Event("change", { bubbles: !0 })), t || L();
1067
- }, N = () => {
1068
- var C, j;
1069
- if (i.replaceChildren(), s.replaceChildren(), f.forEach((P) => {
1070
- const B = a("span", "fc-tag");
1071
- B.append(a("span", "fc-tag-label", le(u, P)));
1072
- const q = a("span", "fc-tag-slot"), O = a("button", "fc-choice-remove", "×");
1073
- O.type = "button", O.disabled = e.readonly, O.ariaLabel = "移除" + le(u, P), O.onclick = () => {
1074
- f = f.filter((F) => !b(P, F)), N(), n.dispatchEvent(new Event("change", { bubbles: !0 }));
1075
- }, q.append(O), B.append(q), i.append(B);
1076
- }), o.value.trim()) {
1077
- const P = T.filter((B) => !B.disabled && le(u, B.path).toLocaleLowerCase().includes(o.value.trim().toLocaleLowerCase()));
1078
- for (const { path: B } of P) {
1079
- const q = a("button", "fc-option", le(u, B));
1080
- q.type = "button", q.disabled = e.readonly, q.setAttribute("aria-pressed", String(f.some((O) => b(O, B)))), q.onclick = () => V(B), s.append(q);
1112
+ c.textContent = "", S(), n.dispatchEvent(new Event("change", { bubbles: !0 })), t || x();
1113
+ }, S = () => {
1114
+ var A, B;
1115
+ if (s.replaceChildren(), o.replaceChildren(), m.forEach((Y) => {
1116
+ const q = a("span", "fc-tag");
1117
+ q.append(a("span", "fc-tag-label", le(u, Y)));
1118
+ const P = a("span", "fc-tag-slot"), I = a("button", "fc-choice-remove", "×");
1119
+ I.type = "button", I.disabled = e.readonly, I.ariaLabel = "移除" + le(u, Y), I.onclick = () => {
1120
+ m = m.filter((R) => !g(Y, R)), S(), n.dispatchEvent(new Event("change", { bubbles: !0 }));
1121
+ }, P.append(I), q.append(P), s.append(q);
1122
+ }), i.value.trim()) {
1123
+ const Y = M.filter((q) => !q.disabled && le(u, q.path).toLocaleLowerCase().includes(i.value.trim().toLocaleLowerCase()));
1124
+ for (const { path: q } of Y) {
1125
+ const P = a("button", "fc-option", le(u, q));
1126
+ P.type = "button", P.disabled = e.readonly, P.setAttribute("aria-pressed", String(m.some((I) => g(I, q)))), P.onclick = () => N(q), o.append(P);
1081
1127
  }
1082
- s.classList.add("is-search"), P.length || s.append(a("p", "fc-empty", "暂无匹配路径"));
1128
+ o.classList.add("is-search"), Y.length || o.append(a("p", "fc-empty", "暂无匹配路径"));
1083
1129
  return;
1084
1130
  }
1085
- s.classList.remove("is-search");
1086
- let x = u, A = [], R = 0;
1087
- for (; x.length; ) {
1088
- const P = a("div", "fc-cascade-column");
1089
- P.setAttribute("role", "group"), P.ariaLabel = "第" + (R + 1) + "级";
1090
- for (const q of x.filter((O) => !O.disabled)) {
1091
- const O = [...A, q.id], F = !!((C = q.children) != null && C.length), $ = a("button", "fc-option", q.label + (F ? " ›" : ""));
1092
- $.type = "button", $.disabled = e.readonly, $.classList.toggle("selected", F ? y[R] === q.id : f.some((Y) => b(Y, O))), $.setAttribute(F ? "aria-expanded" : "aria-pressed", String(F ? y[R] === q.id : f.some((Y) => b(Y, O)))), $.onclick = () => {
1093
- var Y, l;
1094
- F ? (y = O, N(), (l = (Y = s.lastElementChild) == null ? void 0 : Y.querySelector("button")) == null || l.focus()) : V(O);
1095
- }, P.append($);
1131
+ o.classList.remove("is-search");
1132
+ let b = u, C = [], V = 0;
1133
+ for (; b.length; ) {
1134
+ const Y = a("div", "fc-cascade-column");
1135
+ Y.setAttribute("role", "group"), Y.ariaLabel = "第" + (V + 1) + "级";
1136
+ for (const P of b.filter((I) => !I.disabled)) {
1137
+ const I = [...C, P.id], R = !!((A = P.children) != null && A.length), H = a("button", "fc-option", P.label + (R ? " ›" : ""));
1138
+ H.type = "button", H.disabled = e.readonly, H.classList.toggle("selected", R ? E[V] === P.id : m.some((j) => g(j, I))), H.setAttribute(R ? "aria-expanded" : "aria-pressed", String(R ? E[V] === P.id : m.some((j) => g(j, I)))), H.onclick = () => {
1139
+ var j, l;
1140
+ R ? (E = I, S(), (l = (j = o.lastElementChild) == null ? void 0 : j.querySelector("button")) == null || l.focus()) : N(I);
1141
+ }, Y.append(H);
1096
1142
  }
1097
- s.append(P);
1098
- const B = x.find((q) => q.id === y[R] && !q.disabled);
1099
- if (!((j = B == null ? void 0 : B.children) != null && j.length)) break;
1100
- A = [...A, B.id], x = B.children, R++;
1143
+ o.append(Y);
1144
+ const q = b.find((P) => P.id === E[V] && !P.disabled);
1145
+ if (!((B = q == null ? void 0 : q.children) != null && B.length)) break;
1146
+ C = [...C, q.id], b = q.children, V++;
1101
1147
  }
1102
- u.length || s.append(a("p", "fc-empty", "暂无可选分类"));
1148
+ u.length || o.append(a("p", "fc-empty", "暂无可选分类"));
1103
1149
  };
1104
- if (o.oninput = () => {
1105
- r(), N();
1106
- }, o.onfocus = m, s.onkeydown = (x) => {
1107
- if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(x.key)) return;
1108
- const A = x.target, C = [...(A.closest(".fc-cascade-column") || s).querySelectorAll("button:not(:disabled)")];
1109
- if (!C.length) return;
1110
- x.preventDefault();
1111
- const j = C.indexOf(A);
1112
- C[x.key === "Home" ? 0 : x.key === "End" ? C.length - 1 : (j + (x.key === "ArrowDown" ? 1 : -1) + C.length) % C.length].focus();
1113
- }, n.append(i, o, c), h) {
1114
- const x = a("span", "fc-field-chevron");
1115
- x.setAttribute("aria-hidden", "true"), n.append(x), n.addEventListener("click", () => m());
1116
- } else n.append(s);
1117
- return N(), {
1150
+ if (i.oninput = () => {
1151
+ r(), S();
1152
+ }, i.onfocus = w, o.onkeydown = (b) => {
1153
+ if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(b.key)) return;
1154
+ const C = b.target, A = [...(C.closest(".fc-cascade-column") || o).querySelectorAll("button:not(:disabled)")];
1155
+ if (!A.length) return;
1156
+ b.preventDefault();
1157
+ const B = A.indexOf(C);
1158
+ A[b.key === "Home" ? 0 : b.key === "End" ? A.length - 1 : (B + (b.key === "ArrowDown" ? 1 : -1) + A.length) % A.length].focus();
1159
+ }, n.append(s, i, c), f) {
1160
+ const b = a("span", "fc-field-chevron");
1161
+ b.setAttribute("aria-hidden", "true"), n.append(b), n.addEventListener("click", () => w());
1162
+ } else n.append(o);
1163
+ return S(), {
1118
1164
  element: n,
1119
- content: h ? s : void 0,
1120
- read: () => t ? f.map((x) => [...x]) : [...f[0] || []],
1165
+ content: f ? o : void 0,
1166
+ read: () => t ? m.map((b) => [...b]) : [...m[0] || []],
1121
1167
  focus: () => {
1122
- o.focus(), m();
1168
+ i.focus(), w();
1123
1169
  },
1124
1170
  deactivate: () => {
1125
- o.value = "", r(), M();
1171
+ i.value = "", r(), D();
1126
1172
  },
1127
- destroy: () => M(),
1128
- validate: () => e.field.required && !f.length ? "请选择分类" : void 0
1173
+ destroy: () => D(),
1174
+ validate: () => e.field.required && !m.length ? "请选择分类" : void 0
1129
1175
  };
1130
1176
  }
1131
- const te = (t) => String(t).padStart(2, "0"), Le = (t) => `${t.getFullYear()}-${te(t.getMonth() + 1)}-${te(t.getDate())}`;
1177
+ const ne = (t) => String(t).padStart(2, "0"), xe = (t) => `${t.getFullYear()}-${ne(t.getMonth() + 1)}-${ne(t.getDate())}`;
1132
1178
  function pe(t) {
1133
1179
  if (!/^(\d{4})-(\d{2})-(\d{2})$/.exec(t)) return !1;
1134
1180
  const n = /* @__PURE__ */ new Date(`${t}T12:00:00`);
1135
- return !Number.isNaN(n.getTime()) && Le(n) === t;
1181
+ return !Number.isNaN(n.getTime()) && xe(n) === t;
1136
1182
  }
1137
- const _e = (t) => {
1138
- var e, n, i;
1183
+ const Je = (t) => {
1184
+ var e, n, s;
1139
1185
  return {
1140
1186
  time: ((e = t.field.dateOptions) == null ? void 0 : e.showTime) ?? t.field.kind !== "date",
1141
1187
  range: ((n = t.field.dateOptions) == null ? void 0 : n.showRange) ?? !1,
1142
- seconds: ((i = t.field.dateOptions) == null ? void 0 : i.showSeconds) ?? t.field.kind === "datetime"
1188
+ seconds: ((s = t.field.dateOptions) == null ? void 0 : s.showSeconds) ?? t.field.kind === "datetime"
1143
1189
  };
1144
1190
  };
1145
- function je(t) {
1146
- const { time: e, range: n, seconds: i } = _e(t), r = (Array.isArray(t.value) ? t.value : [t.value]).slice(0, n ? 2 : 1).filter(Boolean).map((s) => e ? String(s).slice(0, i ? 19 : 16).replace("T", " ") : String(s).slice(0, 10)).join(" 至 ");
1191
+ function Qe(t) {
1192
+ const { time: e, range: n, seconds: s } = Je(t), r = (Array.isArray(t.value) ? t.value : [t.value]).slice(0, n ? 2 : 1).filter(Boolean).map((o) => e ? String(o).slice(0, s ? 19 : 16).replace("T", " ") : String(o).slice(0, 10)).join(" 至 ");
1147
1193
  return a("div", `fc-value fc-${t.className || ""}${r ? "" : " fc-empty"}`, r || "待填");
1148
1194
  }
1149
- function ut(t) {
1150
- const { time: e, range: n, seconds: i } = _e(t), o = a("div", "fc-calendar"), r = Array.isArray(t.value) ? t.value : [t.value], s = [0, 1].map((g) => String(r[g] || "").slice(0, 10)), c = [0, 1].map((g) => (String(r[g] || "").slice(11, 16) || "00:00") + (i ? ":" + (String(r[g] || "").slice(17, 19) || "00") : ""));
1151
- let u = 0, f = !1, y = pe(s[0]) ? /* @__PURE__ */ new Date(`${s[0]}T12:00:00`) : /* @__PURE__ */ new Date();
1152
- y = new Date(y.getFullYear(), y.getMonth(), 1);
1153
- const T = a("div", "fc-calendar-panel"), p = a("div", "fc-calendar-inputs"), b = [], h = () => o.dispatchEvent(new Event("change", { bubbles: !0 })), E = a("div", "fc-error");
1154
- E.setAttribute("role", "status");
1155
- const M = () => {
1156
- if (s.some((g) => g && !pe(g))) return "请输入有效日期,格式为 YYYY-MM-DD";
1157
- if (t.field.required && !s[0]) return "请选择日期";
1158
- if (n && !!s[0] != !!s[1]) return "请选择完整的日期范围";
1159
- if (e && c.slice(0, n ? 2 : 1).some((g) => !(i ? /^([01]\d|2[0-3]):[0-5]\d:[0-5]\d$/ : /^([01]\d|2[0-3]):[0-5]\d$/).test(g))) return "请输入有效时间";
1160
- if (n && s[0] && `${s[0]}T${e ? c[0] : ""}` > `${s[1]}T${e ? c[1] : ""}`) return "结束日期时间不能早于开始日期时间";
1161
- }, m = () => {
1162
- E.textContent = M() || "", E.textContent || h();
1195
+ function Lt(t) {
1196
+ var Te, Fe, Re, Ne;
1197
+ const { time: e, range: n, seconds: s } = Je(t), i = a("div", "fc-calendar"), r = Array.isArray(t.value) ? t.value : [t.value], o = [0, 1].map((v) => String(r[v] || "").slice(0, 10)), c = [0, 1].map((v) => (String(r[v] || "").slice(11, 16) || "00:00") + (s ? ":" + (String(r[v] || "").slice(17, 19) || "00") : ""));
1198
+ let u = 0, m = !1, E = pe(o[0]) ? /* @__PURE__ */ new Date(`${o[0]}T12:00:00`) : /* @__PURE__ */ new Date();
1199
+ E = new Date(E.getFullYear(), E.getMonth(), 1);
1200
+ const M = a("div", "fc-calendar-panel"), p = n && ((Te = t.field.dateOptions) == null ? void 0 : Te.months) === 2 ? a("div", "fc-calendar-panel detail-node-second-month") : void 0;
1201
+ p && i.classList.add("fc-calendar-two-months");
1202
+ const g = a("div", "fc-calendar-inputs"), f = [], y = () => i.dispatchEvent(new Event("change", { bubbles: !0 })), D = a("div", "fc-error");
1203
+ D.setAttribute("role", "status");
1204
+ const w = () => {
1205
+ if (o.some((v) => v && !pe(v))) return "请输入有效日期,格式为 YYYY-MM-DD";
1206
+ if (t.field.required && !o[0]) return "请选择日期";
1207
+ if (n && !!o[0] != !!o[1]) return "请选择完整的日期范围";
1208
+ if (e && c.slice(0, n ? 2 : 1).some((v) => !(s ? /^([01]\d|2[0-3]):[0-5]\d:[0-5]\d$/ : /^([01]\d|2[0-3]):[0-5]\d$/).test(v))) return "请输入有效时间";
1209
+ if (n && o[0] && `${o[0]}T${e ? c[0] : ""}` > `${o[1]}T${e ? c[1] : ""}`) return "结束日期时间不能早于开始日期时间";
1210
+ }, x = () => {
1211
+ D.textContent = w() || "", D.textContent || y();
1163
1212
  };
1164
- for (let g = 0; g < (n ? 2 : 1); g++) {
1165
- const D = a("input", "fc-input fc-calendar-date");
1166
- D.type = "text", D.value = s[g], D.placeholder = n ? g ? "结束日期" : "开始日期" : "YYYY-MM-DD", D.ariaLabel = n ? D.placeholder : t.field.label, D.disabled = t.readonly, D.onfocus = () => {
1167
- if (u = g, f = g === 1, pe(s[g])) {
1168
- const S = /* @__PURE__ */ new Date(`${s[g]}T12:00:00`);
1169
- y = new Date(S.getFullYear(), S.getMonth(), 1);
1213
+ for (let v = 0; v < (n ? 2 : 1); v++) {
1214
+ const T = a("input", "fc-input fc-calendar-date");
1215
+ T.type = "text", T.value = o[v], T.placeholder = n ? ((Re = (Fe = t.field.dateOptions) == null ? void 0 : Fe.rangeLabels) == null ? void 0 : Re[v]) ?? (v ? "结束日期" : "开始日期") : "YYYY-MM-DD", T.ariaLabel = n ? T.placeholder : t.field.label, T.disabled = t.readonly, T.onfocus = () => {
1216
+ if (u = v, m = v === 1, pe(o[v])) {
1217
+ const F = /* @__PURE__ */ new Date(`${o[v]}T12:00:00`);
1218
+ E = new Date(F.getFullYear(), F.getMonth(), 1);
1170
1219
  }
1171
- w();
1172
- }, D.addEventListener("change", (S) => {
1173
- if (S.stopPropagation(), s[g] = D.value.trim(), pe(s[g])) {
1174
- const H = /* @__PURE__ */ new Date(`${s[g]}T12:00:00`);
1175
- y = new Date(H.getFullYear(), H.getMonth(), 1);
1220
+ h();
1221
+ }, T.addEventListener("change", (F) => {
1222
+ if (F.stopPropagation(), o[v] = T.value.trim(), pe(o[v])) {
1223
+ const O = /* @__PURE__ */ new Date(`${o[v]}T12:00:00`);
1224
+ E = new Date(O.getFullYear(), O.getMonth(), 1);
1176
1225
  }
1177
- w(), m();
1178
- }), p.append(D), b.push(D);
1179
- }
1180
- const L = a("div", "fc-calendar-header"), V = a("button", "fc-calendar-month");
1181
- V.type = "button", V.ariaLabel = "选择年份和月份", V.setAttribute("aria-expanded", "false"), V.setAttribute("aria-live", "polite");
1182
- const N = (g, D, S) => {
1183
- const H = a("button", "fc-calendar-nav");
1184
- return H.type = "button", H.ariaLabel = g, H.innerHTML = `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${S ? "M10 6l-6 6 6 6M19 6l-6 6 6 6" : "M15 6l-6 6 6 6"}"/></svg>`, D > 0 && H.classList.add("next"), H.onclick = () => {
1185
- y = new Date(y.getFullYear(), y.getMonth() + D, 1), w();
1186
- }, H;
1226
+ h(), x();
1227
+ }), g.append(T), f.push(T);
1228
+ }
1229
+ const N = a("div", "fc-calendar-header"), S = a("button", "fc-calendar-month");
1230
+ S.type = "button", S.ariaLabel = "选择年份和月份", S.setAttribute("aria-expanded", "false"), S.setAttribute("aria-live", "polite");
1231
+ const b = (v, T, F) => {
1232
+ const O = a("button", "fc-calendar-nav");
1233
+ return O.type = "button", O.ariaLabel = v, O.innerHTML = `<svg viewBox="0 0 24 24" aria-hidden="true"><path d="${F ? "M10 6l-6 6 6 6M19 6l-6 6 6 6" : "M15 6l-6 6 6 6"}"/></svg>`, T > 0 && O.classList.add("next"), O.onclick = () => {
1234
+ E = new Date(E.getFullYear(), E.getMonth() + T, 1), h();
1235
+ }, O;
1187
1236
  };
1188
- L.append(N("上一年", -12, !0), N("上个月", -1, !1), V, N("下个月", 1, !1), N("下一年", 12, !0));
1189
- const x = a("div", "fc-calendar-weekdays");
1190
- for (const g of ["日", "一", "二", "三", "四", "五", "六"]) x.append(a("span", "", g));
1191
- const A = a("div", "fc-calendar-days");
1192
- A.setAttribute("role", "group"), A.ariaLabel = "选择日期";
1193
- const R = a("div", "fc-calendar-period");
1194
- R.hidden = !0;
1195
- const C = a("button", "fc-calendar-back", "‹ 返回选择日期");
1196
- C.type = "button";
1197
- const j = a("div", "fc-calendar-period-columns"), P = a("div", "fc-calendar-period-list");
1198
- P.setAttribute("role", "group"), P.ariaLabel = "年份";
1199
- const B = a("div", "fc-calendar-period-list");
1200
- B.setAttribute("role", "group"), B.ariaLabel = "月份";
1201
- const q = a("div", "fc-calendar-period-list");
1202
- q.ariaLabel = "秒", q.hidden = !0, j.append(P, B, q), R.append(C, j);
1203
- let O = "period", F = 0;
1204
- const $ = [], Y = (g = !1) => {
1205
- const D = c[F].split(":").map(Number), S = O === "period" ? [[P, y.getFullYear(), "年"], [B, y.getMonth() + 1, "月"]] : [[P, D[0], "时"], [B, D[1], "分"], [q, D[2], "秒"]];
1206
- for (const [H, Z, se] of S)
1207
- for (const X of H.querySelectorAll("button")) {
1208
- const re = Number(X.dataset.value) === Z;
1209
- X.classList.toggle("selected", re), X.setAttribute("aria-pressed", String(re)), X.textContent = `${O === "time" ? te(Number(X.dataset.value)) : X.dataset.value}${re ? se : ""}`, re && g && (H.scrollTop = Math.max(0, X.offsetTop - 108));
1237
+ N.append(b("上一年", -12, !0), b("上个月", -1, !1), S, b("下个月", 1, !1), b("下一年", 12, !0));
1238
+ const C = a("div", "fc-calendar-weekdays");
1239
+ for (const v of ["日", "一", "二", "三", "四", "五", "六"]) C.append(a("span", "", v));
1240
+ const V = a("div", "fc-calendar-days");
1241
+ V.setAttribute("role", "group"), V.ariaLabel = "选择日期";
1242
+ const A = a("div", "fc-calendar-period");
1243
+ A.hidden = !0;
1244
+ const B = a("button", "fc-calendar-back", "‹ 返回选择日期");
1245
+ B.type = "button";
1246
+ const Y = a("div", "fc-calendar-period-columns"), q = a("div", "fc-calendar-period-list");
1247
+ q.setAttribute("role", "group"), q.ariaLabel = "年份";
1248
+ const P = a("div", "fc-calendar-period-list");
1249
+ P.setAttribute("role", "group"), P.ariaLabel = "月份";
1250
+ const I = a("div", "fc-calendar-period-list");
1251
+ I.ariaLabel = "秒", I.hidden = !0, Y.append(q, P, I), A.append(B, Y);
1252
+ let R = "period", H = 0;
1253
+ const j = [], l = (v = !1) => {
1254
+ const T = c[H].split(":").map(Number), F = R === "period" ? [[q, E.getFullYear(), "年"], [P, E.getMonth() + 1, "月"]] : [[q, T[0], "时"], [P, T[1], "分"], [I, T[2], "秒"]];
1255
+ for (const [O, K, J] of F)
1256
+ for (const ee of O.querySelectorAll("button")) {
1257
+ const se = Number(ee.dataset.value) === K;
1258
+ ee.classList.toggle("selected", se), ee.setAttribute("aria-pressed", String(se)), ee.textContent = `${R === "time" ? ne(Number(ee.dataset.value)) : ee.dataset.value}${se ? J : ""}`, se && v && (O.scrollTop = Math.max(0, ee.offsetTop - 108));
1210
1259
  }
1211
- }, l = (g, D) => {
1212
- const S = a("button", "fc-calendar-period-option", String(g));
1213
- return S.type = "button", S.dataset.value = String(g), S.ariaLabel = `${O === "time" ? te(g) : g}${O === "time" ? D ? "时" : "分" : D ? "年" : "月"}`, S.disabled = O === "time" && t.readonly, S.onclick = () => {
1214
- if (O === "time") {
1215
- const H = c[F].split(":");
1216
- H[D ? 0 : 1] = te(g), c[F] = H.join(":"), $[F].textContent = c[F], Y(), m();
1260
+ }, d = (v, T) => {
1261
+ const F = a("button", "fc-calendar-period-option", String(v));
1262
+ return F.type = "button", F.dataset.value = String(v), F.ariaLabel = `${R === "time" ? ne(v) : v}${R === "time" ? T ? "时" : "分" : T ? "年" : "月"}`, F.disabled = R === "time" && t.readonly, F.onclick = () => {
1263
+ if (R === "time") {
1264
+ const O = c[H].split(":");
1265
+ O[T ? 0 : 1] = ne(v), c[H] = O.join(":"), j[H].textContent = c[H], l(), x();
1217
1266
  return;
1218
1267
  }
1219
- y.setFullYear(D ? g : y.getFullYear(), D ? y.getMonth() : g - 1, 1), Y(), w();
1220
- }, S;
1221
- }, d = (g, D = 0) => {
1222
- if (O = g, F = D, P.replaceChildren(), B.replaceChildren(), q.replaceChildren(), q.hidden = g !== "time" || !i, P.ariaLabel = g === "period" ? "年份" : "小时", B.ariaLabel = g === "period" ? "月份" : "分钟", g === "period") {
1223
- for (let S = Math.max(1, y.getFullYear() - 100); S <= Math.min(9999, y.getFullYear() + 100); S++) P.append(l(S, !0));
1224
- for (let S = 1; S <= 12; S++) B.append(l(S, !1));
1268
+ E.setFullYear(T ? v : E.getFullYear(), T ? E.getMonth() : v - 1, 1), l(), h();
1269
+ }, F;
1270
+ }, L = (v, T = 0) => {
1271
+ if (R = v, H = T, q.replaceChildren(), P.replaceChildren(), I.replaceChildren(), I.hidden = v !== "time" || !s, q.ariaLabel = v === "period" ? "年份" : "小时", P.ariaLabel = v === "period" ? "月份" : "分钟", v === "period") {
1272
+ for (let F = Math.max(1, E.getFullYear() - 100); F <= Math.min(9999, E.getFullYear() + 100); F++) q.append(d(F, !0));
1273
+ for (let F = 1; F <= 12; F++) P.append(d(F, !1));
1225
1274
  } else {
1226
- for (let S = 0; S < 24; S++) P.append(l(S, !0));
1227
- for (let S = 0; S < 60; S++) B.append(l(S, !1));
1228
- if (i) for (let S = 0; S < 60; S++) {
1229
- const H = a("button", "fc-calendar-period-option", te(S));
1230
- H.type = "button", H.dataset.value = String(S), H.ariaLabel = te(S) + "秒", H.disabled = t.readonly, H.onclick = () => {
1231
- const Z = c[F].split(":");
1232
- Z[2] = te(S), c[F] = Z.join(":"), $[F].textContent = c[F], Y(), m();
1233
- }, q.append(H);
1275
+ for (let F = 0; F < 24; F++) q.append(d(F, !0));
1276
+ for (let F = 0; F < 60; F++) P.append(d(F, !1));
1277
+ if (s) for (let F = 0; F < 60; F++) {
1278
+ const O = a("button", "fc-calendar-period-option", ne(F));
1279
+ O.type = "button", O.dataset.value = String(F), O.ariaLabel = ne(F) + "秒", O.disabled = t.readonly, O.onclick = () => {
1280
+ const K = c[H].split(":");
1281
+ K[2] = ne(F), c[H] = K.join(":"), j[H].textContent = c[H], l(), x();
1282
+ }, I.append(O);
1234
1283
  }
1235
1284
  }
1236
- o.classList.add("choosing-period"), R.hidden = !1, (g === "period" ? V : $[D]).setAttribute("aria-expanded", "true"), Y(!0), C.focus();
1285
+ i.classList.add("choosing-period"), A.hidden = !1, (v === "period" ? S : j[T]).setAttribute("aria-expanded", "true"), l(!0), B.focus();
1237
1286
  };
1238
- V.onclick = () => d("period"), C.onclick = () => {
1239
- o.classList.remove("choosing-period"), R.hidden = !0;
1240
- const g = O === "period" ? V : $[F];
1241
- g.setAttribute("aria-expanded", "false"), w(), g.focus();
1242
- }, R.addEventListener("keydown", (g) => {
1243
- if (g.key === "Escape" && (g.preventDefault(), g.stopPropagation(), C.click()), !["ArrowUp", "ArrowDown", "Home", "End"].includes(g.key)) return;
1244
- const D = g.target, S = D.closest(".fc-calendar-period-list");
1245
- if (!S) return;
1246
- const H = [...S.querySelectorAll("button")], Z = H.indexOf(D), se = g.key === "Home" ? 0 : g.key === "End" ? H.length - 1 : Math.max(0, Math.min(H.length - 1, Z + (g.key === "ArrowDown" ? 1 : -1)));
1247
- g.preventDefault(), H[se].focus();
1287
+ S.onclick = () => L("period"), B.onclick = () => {
1288
+ i.classList.remove("choosing-period"), A.hidden = !0;
1289
+ const v = R === "period" ? S : j[H];
1290
+ v.setAttribute("aria-expanded", "false"), h(), v.focus();
1291
+ }, A.addEventListener("keydown", (v) => {
1292
+ if (v.key === "Escape" && (v.preventDefault(), v.stopPropagation(), B.click()), !["ArrowUp", "ArrowDown", "Home", "End"].includes(v.key)) return;
1293
+ const T = v.target, F = T.closest(".fc-calendar-period-list");
1294
+ if (!F) return;
1295
+ const O = [...F.querySelectorAll("button")], K = O.indexOf(T), J = v.key === "Home" ? 0 : v.key === "End" ? O.length - 1 : Math.max(0, Math.min(O.length - 1, K + (v.key === "ArrowDown" ? 1 : -1)));
1296
+ v.preventDefault(), O[J].focus();
1248
1297
  });
1249
- function w() {
1250
- V.textContent = `${y.getFullYear()}年 ${y.getMonth() + 1}月`, b.forEach((D, S) => D.classList.toggle("active", S === u)), A.replaceChildren();
1251
- for (let D = 0; D < y.getDay(); D++) A.append(a("span", "fc-calendar-blank"));
1252
- const g = new Date(y.getFullYear(), y.getMonth() + 1, 0).getDate();
1253
- for (let D = 1; D <= g; D++) {
1254
- const S = Le(new Date(y.getFullYear(), y.getMonth(), D)), H = a("button", "fc-calendar-day", String(D));
1255
- H.type = "button", H.ariaLabel = S, H.disabled = t.readonly;
1256
- const Z = s[0] === S || n && s[1] === S;
1257
- H.classList.toggle("selected", Z), H.setAttribute("aria-pressed", String(Z)), H.classList.toggle("in-range", n && !!s[0] && !!s[1] && S > s[0] && S < s[1]), S === Le(/* @__PURE__ */ new Date()) && (H.classList.add("today"), H.setAttribute("aria-current", "date")), H.onclick = () => {
1258
- var se;
1259
- n ? f ? (s[1] = S, s[0] && s[1] < s[0] && ([s[0], s[1]] = [s[1], s[0]]), u = 0, f = !1) : (s[0] = S, s[1] = "", u = 1, f = !0) : s[0] = S, b.forEach((X, re) => X.value = s[re]), w(), !n || s[1] ? m() : E.textContent = "", (se = A.querySelector(`[aria-label="${S}"]`)) == null || se.focus(), (!n || s[1]) && o.dispatchEvent(new Event("fc-collapse", { bubbles: !0 }));
1260
- }, A.append(H);
1298
+ function h() {
1299
+ if (S.textContent = `${E.getFullYear()}年 ${E.getMonth() + 1}月`, f.forEach((v, T) => v.classList.toggle("active", T === u)), k(V, E), p) {
1300
+ const v = new Date(E.getFullYear(), E.getMonth() + 1, 1), T = a("div", "fc-calendar-header"), F = a("button", "fc-calendar-month", `${v.getFullYear()}年 ${v.getMonth() + 1}月`);
1301
+ F.type = "button", F.ariaLabel = "选择下月年份和月份", F.onclick = () => {
1302
+ E = v, L("period"), h();
1303
+ }, T.append(b("上一年", -12, !0), b("上个月", -1, !1), F, b("下个月", 1, !1), b("下一年", 12, !0));
1304
+ const O = a("div", "fc-calendar-days");
1305
+ O.role = "group", O.ariaLabel = "选择下月日期", p.replaceChildren(T, C.cloneNode(!0), O), k(O, v), U.hidden = !o.some(Boolean);
1261
1306
  }
1262
1307
  }
1263
- T.append(L, x, A, R);
1264
- const v = a("div", "fc-calendar-time");
1308
+ function k(v, T) {
1309
+ v.replaceChildren();
1310
+ for (let O = 0; O < T.getDay(); O++) v.append(a("span", "fc-calendar-blank"));
1311
+ const F = new Date(T.getFullYear(), T.getMonth() + 1, 0).getDate();
1312
+ for (let O = 1; O <= F; O++) {
1313
+ const K = xe(new Date(T.getFullYear(), T.getMonth(), O)), J = a("button", "fc-calendar-day", String(O));
1314
+ J.type = "button", J.ariaLabel = K, J.disabled = t.readonly;
1315
+ const ee = o[0] === K || n && o[1] === K;
1316
+ J.classList.toggle("selected", ee), J.setAttribute("aria-pressed", String(ee)), J.classList.toggle("in-range", n && !!o[0] && !!o[1] && K > o[0] && K < o[1]), K === xe(/* @__PURE__ */ new Date()) && (J.classList.add("today"), J.setAttribute("aria-current", "date")), J.onclick = () => {
1317
+ var se, Ve;
1318
+ n ? m ? (o[1] = K, o[0] && o[1] < o[0] && ([o[0], o[1]] = [o[1], o[0]]), u = 0, m = !1) : (o[0] = K, o[1] = "", u = 1, m = !0) : o[0] = K, f.forEach((it, st) => it.value = o[st]), h(), !n || o[1] ? x() : D.textContent = "", (se = i.querySelector(`[aria-label="${K}"]`)) == null || se.focus(), (Ve = t.field.dateOptions) != null && Ve.collapseOnSelect && (!n || o[1]) && !w() && i.dispatchEvent(new Event("fc-collapse", { bubbles: !0 }));
1319
+ }, v.append(J);
1320
+ }
1321
+ }
1322
+ M.append(N, C, V, A);
1323
+ const $ = a("div", "fc-calendar-time");
1265
1324
  if (e) {
1266
- for (let g = 0; g < (n ? 2 : 1); g++) {
1267
- const D = a("div", "fc-calendar-time-field"), S = n ? g ? "结束时间" : "开始时间" : "时间", H = a("button", "fc-input fc-calendar-time-trigger", c[g]);
1268
- H.type = "button", H.disabled = t.readonly, H.ariaLabel = S, H.setAttribute("aria-expanded", "false"), H.onclick = () => d("time", g), $.push(H), D.append(a("span", "", S), H), v.append(D);
1325
+ for (let v = 0; v < (n ? 2 : 1); v++) {
1326
+ const T = a("div", "fc-calendar-time-field"), F = n ? v ? "结束时间" : "开始时间" : "时间", O = a("button", "fc-input fc-calendar-time-trigger", c[v]);
1327
+ O.type = "button", O.disabled = t.readonly, O.ariaLabel = F, O.setAttribute("aria-expanded", "false"), O.onclick = () => L("time", v), j.push(O), T.append(a("span", "", F), O), $.append(T);
1269
1328
  }
1270
- T.append(v);
1271
- }
1272
- const k = a("button", "fc-calendar-clear", "清空");
1273
- k.type = "button", k.disabled = t.readonly, k.onclick = () => {
1274
- s.fill(""), b.forEach((g) => g.value = ""), u = 0, f = !1, w(), m();
1275
- }, o.append(p, T, k, E);
1276
- const I = () => {
1277
- const g = s.slice(0, n ? 2 : 1).map((D, S) => D ? D + (e ? `T${c[S]}` : "") : "");
1278
- return n ? g.some(Boolean) ? g : [] : g[0];
1329
+ M.append($);
1330
+ }
1331
+ const U = a("button", "fc-calendar-clear", "清空");
1332
+ U.type = "button", U.disabled = t.readonly, U.onclick = () => {
1333
+ o.fill(""), f.forEach((v) => v.value = ""), u = 0, m = !1, h(), x();
1334
+ }, i.append(g, M, ...p ? [p] : [], U, D);
1335
+ const _ = () => {
1336
+ const v = o.slice(0, n ? 2 : 1).map((T, F) => T ? T + (e ? `T${c[F]}` : "") : "");
1337
+ return n ? v.some(Boolean) ? v : [] : v[0];
1279
1338
  };
1280
1339
  if (t.layout === "compact" || t.readonly)
1281
- return w(), {
1282
- element: o,
1283
- read: I,
1284
- validate: M,
1340
+ return h(), {
1341
+ element: i,
1342
+ read: _,
1343
+ validate: w,
1285
1344
  focus: () => {
1286
- b[0].focus();
1345
+ f[0].focus();
1287
1346
  },
1288
1347
  deactivate: () => {
1289
- o.classList.remove("choosing-period"), R.hidden = !0;
1348
+ i.classList.remove("choosing-period"), A.hidden = !0;
1290
1349
  }
1291
1350
  };
1292
- const W = a("div", "fc-date-mirror"), U = () => W.replaceChildren(je({ ...t, value: I() })), G = a("span", "fc-field-chevron");
1293
- G.setAttribute("aria-hidden", "true");
1294
- const z = a("div", "fc-date-trigger");
1295
- z.tabIndex = 0, z.setAttribute("role", "button"), z.ariaLabel = `编辑${t.field.label}`, z.append(W, G);
1296
- let J;
1297
- const ee = () => {
1298
- const g = J;
1299
- J = void 0;
1300
- const D = !!g && g.element.contains(document.activeElement);
1301
- g == null || g.close(), G.classList.remove("is-open"), D && queueMicrotask(() => {
1302
- J || !z.isConnected || z.dispatchEvent(new Event("fc-collapse", { bubbles: !0 }));
1351
+ const te = a("div", "fc-date-mirror"), G = () => te.replaceChildren(Qe({ ...t, value: _() })), Z = a("span", "fc-field-chevron");
1352
+ Z.setAttribute("aria-hidden", "true");
1353
+ const W = a("div", "fc-date-trigger");
1354
+ W.tabIndex = 0, W.setAttribute("role", "button"), W.ariaLabel = `编辑${t.field.label}`, W.append(te, Z);
1355
+ let ae;
1356
+ const ge = (v = !0) => {
1357
+ const T = ae;
1358
+ ae = void 0;
1359
+ const F = !!T && T.element.contains(document.activeElement);
1360
+ T == null || T.close(), Z.classList.remove("is-open"), v && F && queueMicrotask(() => {
1361
+ ae || !W.isConnected || W.dispatchEvent(new Event("fc-collapse", { bubbles: !0 }));
1303
1362
  });
1304
- }, ge = () => {
1305
- J || t.readonly || (U(), J = ce({ anchor: z, content: o, width: 320, gap: 4, onDismiss: () => {
1306
- J = void 0, G.classList.remove("is-open");
1307
- } }), G.classList.add("is-open"));
1363
+ }, ye = () => {
1364
+ ae || t.readonly || (G(), ae = ce({ anchor: W, content: i, width: p ? 570 : 320, align: p ? "end" : "start", gap: 4, onDismiss: () => {
1365
+ ae = void 0, Z.classList.remove("is-open");
1366
+ } }), Z.classList.add("is-open"));
1308
1367
  };
1309
- return z.onclick = () => ge(), z.onkeydown = (g) => {
1310
- (g.key === "Enter" || g.key === " ") && (g.preventDefault(), ge());
1311
- }, o.addEventListener("focusout", (g) => {
1312
- const D = g.relatedTarget;
1313
- if (D && (o.contains(D) || z.contains(D) || be(D))) return;
1314
- const S = new Event("focusout", { bubbles: !0 });
1315
- D && Object.defineProperty(S, "relatedTarget", { value: D }), z.dispatchEvent(S);
1316
- }), o.addEventListener("change", () => z.dispatchEvent(new Event("change", { bubbles: !0 }))), w(), U(), {
1317
- element: z,
1318
- content: o,
1319
- inputRoot: z,
1320
- read: I,
1321
- validate: M,
1368
+ return W.onclick = () => ye(), W.onkeydown = (v) => {
1369
+ (v.key === "Enter" || v.key === " ") && (v.preventDefault(), ye());
1370
+ }, i.addEventListener("focusout", (v) => {
1371
+ const T = v.relatedTarget;
1372
+ if (T && (i.contains(T) || W.contains(T) || be(T))) return;
1373
+ const F = new Event("focusout", { bubbles: !0 });
1374
+ T && Object.defineProperty(F, "relatedTarget", { value: T }), W.dispatchEvent(F);
1375
+ }), i.addEventListener("change", () => {
1376
+ G(), W.dispatchEvent(new Event("change", { bubbles: !0 }));
1377
+ }), (Ne = t.field.dateOptions) != null && Ne.collapseOnSelect && i.addEventListener("fc-collapse", () => {
1378
+ ge(!1), W.dispatchEvent(new Event("fc-collapse", { bubbles: !0 }));
1379
+ }), h(), G(), {
1380
+ element: W,
1381
+ content: i,
1382
+ inputRoot: W,
1383
+ read: _,
1384
+ validate: w,
1322
1385
  focus: () => {
1323
- ge(), b[0].focus();
1386
+ ye(), f[0].focus();
1324
1387
  },
1325
- deactivate: ee,
1326
- destroy: ee
1388
+ deactivate: ge,
1389
+ destroy: ge
1327
1390
  };
1328
1391
  }
1329
- function De(t) {
1330
- var h, E, M;
1392
+ function $e(t) {
1393
+ var f, y, D;
1331
1394
  let e = Array.isArray(t.value) ? structuredClone(t.value) : [];
1332
- const n = a("div", "fc-attachments"), i = a("div", "fc-file-list"), o = a("label", "fc-upload-zone", "+ 上传附件"), r = a("input");
1333
- r.type = "file", r.multiple = !0, r.ariaLabel = "上传" + t.field.label, r.accept = ((h = t.field.attachmentOptions) == null ? void 0 : h.accept) || "", r.disabled = t.readonly || !((E = t.services) != null && E.upload);
1334
- const s = a("p", "fc-error");
1335
- s.setAttribute("role", "status");
1395
+ const n = a("div", "fc-attachments"), s = a("div", "fc-file-list"), i = a("label", "fc-upload-zone", "+ 上传附件"), r = a("input");
1396
+ r.type = "file", r.multiple = !0, r.ariaLabel = "上传" + t.field.label, r.accept = ((f = t.field.attachmentOptions) == null ? void 0 : f.accept) || "", r.disabled = t.readonly || !((y = t.services) != null && y.upload);
1397
+ const o = a("p", "fc-error");
1398
+ o.setAttribute("role", "status");
1336
1399
  const c = a("button", "fc-retry", "重试上传");
1337
1400
  c.type = "button", c.hidden = !0;
1338
- let u = [], f = !1, y = !1, T;
1401
+ let u = [], m = !1, E = !1, M;
1339
1402
  const p = () => {
1340
- i.replaceChildren(), e.forEach((m, L) => {
1341
- const V = a("div", "fc-file-row"), N = Ae(m.url), x = N ? a("a", "fc-link", m.name) : a("span", "", m.name);
1342
- if (x.tagName === "A") {
1343
- const A = x;
1344
- A.href = N, A.target = "_blank", A.rel = "noopener noreferrer";
1403
+ s.replaceChildren(), e.forEach((w, x) => {
1404
+ const N = a("div", "fc-file-row"), S = De(w.url), b = S ? a("a", "fc-link", w.name) : a("span", "", w.name);
1405
+ if (b.tagName === "A") {
1406
+ const C = b;
1407
+ C.href = S, C.target = "_blank", C.rel = "noopener noreferrer";
1345
1408
  }
1346
- if (V.append(a("span", "fc-file-icon", "▤"), x), m.size != null && V.append(a("small", "fc-file-size", Math.ceil(m.size / 1024) + " KB")), !t.readonly) {
1347
- const A = a("button", "fc-file-remove", "×");
1348
- A.type = "button", A.disabled = f, A.ariaLabel = "移除" + m.name, A.onclick = () => {
1349
- e.splice(L, 1), p(), ie(n);
1350
- }, V.append(A);
1409
+ if (N.append(a("span", "fc-file-icon", "▤"), b), w.size != null && N.append(a("small", "fc-file-size", Math.ceil(w.size / 1024) + " KB")), !t.readonly) {
1410
+ const C = a("button", "fc-file-remove", "×");
1411
+ C.type = "button", C.disabled = m, C.ariaLabel = "移除" + w.name, C.onclick = () => {
1412
+ e.splice(x, 1), p(), oe(n);
1413
+ }, N.append(C);
1351
1414
  }
1352
- i.append(V);
1353
- }), e.length || i.append(a("span", "fc-empty", "暂无附件"));
1354
- }, b = async () => {
1355
- var V;
1356
- if (!((V = t.services) != null && V.upload) || t.readonly || f || !u.length) return;
1357
- const m = t.field.attachmentOptions;
1358
- if (m != null && m.maxFiles && e.length + u.length > m.maxFiles) {
1359
- s.textContent = "最多上传 " + m.maxFiles + " 个文件";
1415
+ s.append(N);
1416
+ }), e.length || s.append(a("span", "fc-empty", "暂无附件"));
1417
+ }, g = async () => {
1418
+ var N;
1419
+ if (!((N = t.services) != null && N.upload) || t.readonly || m || !u.length) return;
1420
+ const w = t.field.attachmentOptions;
1421
+ if (w != null && w.maxFiles && e.length + u.length > w.maxFiles) {
1422
+ o.textContent = "最多上传 " + w.maxFiles + " 个文件";
1360
1423
  return;
1361
1424
  }
1362
- if (m != null && m.maxBytes && u.some((N) => N.size > m.maxBytes)) {
1363
- s.textContent = "文件大小超过限制";
1425
+ if (w != null && w.maxBytes && u.some((S) => S.size > w.maxBytes)) {
1426
+ o.textContent = "文件大小超过限制";
1364
1427
  return;
1365
1428
  }
1366
- const L = ((m == null ? void 0 : m.accept) || "").split(",").map((N) => N.trim().toLowerCase()).filter(Boolean);
1367
- if (L.length && u.some((N) => !L.some((x) => x.startsWith(".") ? N.name.toLowerCase().endsWith(x) : x.endsWith("/*") ? N.type.toLowerCase().startsWith(x.slice(0, -1)) : N.type.toLowerCase() === x))) {
1368
- s.textContent = "文件类型不符合要求";
1429
+ const x = ((w == null ? void 0 : w.accept) || "").split(",").map((S) => S.trim().toLowerCase()).filter(Boolean);
1430
+ if (x.length && u.some((S) => !x.some((b) => b.startsWith(".") ? S.name.toLowerCase().endsWith(b) : b.endsWith("/*") ? S.type.toLowerCase().startsWith(b.slice(0, -1)) : S.type.toLowerCase() === b))) {
1431
+ o.textContent = "文件类型不符合要求";
1369
1432
  return;
1370
1433
  }
1371
- T = new AbortController(), f = !0, r.disabled = !0, c.hidden = !0, s.textContent = "上传中…", n.setAttribute("aria-busy", "true"), p();
1434
+ M = new AbortController(), m = !0, r.disabled = !0, c.hidden = !0, o.textContent = "上传中…", n.setAttribute("aria-busy", "true"), p();
1372
1435
  try {
1373
- const N = await t.services.upload(t.field, u, T.signal);
1374
- if (y) return;
1375
- if (N.length !== u.length || N.some((x) => !x.id || !x.name)) throw new Error("Invalid file references");
1376
- e = [...e, ...N], u = [], s.textContent = "", r.value = "";
1436
+ const S = await t.services.upload(t.field, u, M.signal);
1437
+ if (E) return;
1438
+ if (S.length !== u.length || S.some((b) => !b.id || !b.name)) throw new Error("Invalid file references");
1439
+ e = [...e, ...S], u = [], o.textContent = "", r.value = "";
1377
1440
  } catch {
1378
- y || (s.textContent = "上传失败,已保留原有附件", c.hidden = !1);
1441
+ E || (o.textContent = "上传失败,已保留原有附件", c.hidden = !1);
1379
1442
  } finally {
1380
- y || (f = !1, r.disabled = !1, n.setAttribute("aria-busy", "false"), p(), u.length || ie(n));
1443
+ E || (m = !1, r.disabled = !1, n.setAttribute("aria-busy", "false"), p(), u.length || oe(n));
1381
1444
  }
1382
1445
  };
1383
- return r.onchange = (m) => {
1384
- m.stopPropagation(), u = Array.from(r.files || []), b();
1385
- }, c.onclick = () => void b(), o.append(r), n.append(i), t.readonly || (n.append(o), (M = t.services) != null && M.upload || n.append(a("p", "fc-service-note", "上传服务未接入"))), n.append(s, c), p(), {
1446
+ return r.onchange = (w) => {
1447
+ w.stopPropagation(), u = Array.from(r.files || []), g();
1448
+ }, c.onclick = () => void g(), i.append(r), n.append(s), t.readonly || (n.append(i), (D = t.services) != null && D.upload || n.append(a("p", "fc-service-note", "上传服务未接入"))), n.append(o, c), p(), {
1386
1449
  element: n,
1387
1450
  read: () => structuredClone(e),
1388
1451
  focus: () => r.focus(),
1389
- validate: () => f ? "请等待上传完成" : u.length ? "请完成或重新选择上传文件" : t.field.required && !e.length ? "请上传附件" : void 0,
1452
+ validate: () => m ? "请等待上传完成" : u.length ? "请完成或重新选择上传文件" : t.field.required && !e.length ? "请上传附件" : void 0,
1390
1453
  destroy: () => {
1391
- y = !0, T == null || T.abort();
1454
+ E = !0, M == null || M.abort();
1392
1455
  }
1393
1456
  };
1394
1457
  }
1395
- function ke(t) {
1458
+ function Le(t) {
1396
1459
  if (t && typeof t == "object" && !Array.isArray(t)) {
1397
1460
  const e = t;
1398
1461
  return { selected: Array.isArray(e.selected) ? [...e.selected] : [], counts: { ...e.counts }, total: e.total };
1399
1462
  }
1400
1463
  return { selected: [], counts: {} };
1401
1464
  }
1402
- function Te(t, e) {
1403
- var q, O;
1404
- let n = ke(t.value), i = [...n.selected];
1405
- const o = e === "attitude" ? [{ id: "like", label: "赞同" }] : Q(t.field), r = a("div", "fc-vote"), s = a("button", "fc-vote-trigger");
1406
- s.type = "button", s.setAttribute("aria-haspopup", "dialog"), s.setAttribute("aria-expanded", "false");
1465
+ function Ie(t, e) {
1466
+ var P, I;
1467
+ let n = Le(t.value), s = [...n.selected];
1468
+ const i = e === "attitude" ? [{ id: "like", label: "赞同" }] : X(t.field), r = a("div", "fc-vote"), o = a("button", "fc-vote-trigger");
1469
+ o.type = "button", o.setAttribute("aria-haspopup", "dialog"), o.setAttribute("aria-expanded", "false");
1407
1470
  const c = a("span", "fc-vote-icon", "+");
1408
1471
  c.ariaHidden = "true";
1409
1472
  const u = a("span");
1410
- s.append(c, u);
1411
- const f = a("section", "fc-vote-panel");
1412
- f.setAttribute("role", "dialog"), f.ariaLabel = t.field.label;
1413
- const y = a("div", "fc-vote-header"), T = a("span", "fc-vote-total");
1414
- y.append(a("strong", "", e === "attitude" ? "表态投票" : e === "multi" ? "投票-多选" : "投票-单选"), T);
1473
+ o.append(c, u);
1474
+ const m = a("section", "fc-vote-panel");
1475
+ m.setAttribute("role", "dialog"), m.ariaLabel = t.field.label;
1476
+ const E = a("div", "fc-vote-header"), M = a("span", "fc-vote-total");
1477
+ E.append(a("strong", "", e === "attitude" ? "表态投票" : e === "multi" ? "投票-多选" : "投票-单选"), M);
1415
1478
  const p = a("div", "fc-vote-list");
1416
1479
  p.setAttribute("role", e === "multi" ? "group" : "radiogroup"), p.ariaLabel = t.field.label;
1417
- const b = a("p", "fc-error");
1418
- b.setAttribute("role", "status");
1419
- const h = a("button", "fc-vote-submit", "确认投票");
1420
- h.type = "button";
1421
- const E = a("button", "fc-vote-withdraw", "撤回投票");
1422
- E.type = "button";
1423
- const M = a("button", "fc-vote-withdraw", "重新加载");
1424
- M.type = "button", M.hidden = !0;
1425
- const m = a("div", "fc-vote-actions");
1426
- m.append(h, E);
1427
- let L = !1, V = !1, N = !1, x = !((q = t.services) != null && q.loadVote), A, R;
1428
- const C = () => {
1429
- var F, $, Y;
1430
- u.textContent = n.selected.length ? "已投票" : "投票", s.classList.toggle("is-voted", !!n.selected.length), s.ariaLabel = `${t.field.label},${u.textContent}`, T.textContent = V ? "加载中…" : x ? `${n.total ?? Object.values(n.counts).reduce((l, d) => l + d, 0)}人已投` : "待加载", f.setAttribute("aria-busy", String(L || V)), p.replaceChildren();
1431
- for (const l of o) {
1480
+ const g = a("p", "fc-error");
1481
+ g.setAttribute("role", "status");
1482
+ const f = a("button", "fc-vote-submit", "确认投票");
1483
+ f.type = "button";
1484
+ const y = a("button", "fc-vote-withdraw", "撤回投票");
1485
+ y.type = "button";
1486
+ const D = a("button", "fc-vote-withdraw", "重新加载");
1487
+ D.type = "button", D.hidden = !0;
1488
+ const w = a("div", "fc-vote-actions");
1489
+ w.append(f, y);
1490
+ let x = !1, N = !1, S = !1, b = !((P = t.services) != null && P.loadVote), C, V;
1491
+ const A = () => {
1492
+ var R, H, j;
1493
+ u.textContent = n.selected.length ? "已投票" : "投票", o.classList.toggle("is-voted", !!n.selected.length), o.ariaLabel = `${t.field.label},${u.textContent}`, M.textContent = N ? "加载中…" : b ? `${n.total ?? Object.values(n.counts).reduce((l, d) => l + d, 0)}人已投` : "待加载", m.setAttribute("aria-busy", String(x || N)), p.replaceChildren();
1494
+ for (const l of i) {
1432
1495
  const d = a("button", "fc-vote-option");
1433
- d.type = "button", d.dataset.value = l.id, d.disabled = t.readonly || L || V || !x || !((F = t.services) != null && F.vote) || !!l.disabled;
1434
- const w = i.includes(l.id);
1435
- d.classList.toggle("selected", w), d.setAttribute("role", e === "multi" ? "checkbox" : "radio"), d.setAttribute("aria-checked", String(w));
1436
- const v = a("span", e === "multi" ? "fc-vote-check" : "fc-radio-dot");
1437
- v.ariaHidden = "true", d.append(v, a("span", "fc-vote-label", l.label)), x && Object.keys(n.counts).length && d.append(a("span", "fc-vote-count", `${n.counts[l.id] ?? 0} 票`)), d.onclick = () => {
1496
+ d.type = "button", d.dataset.value = l.id, d.disabled = t.readonly || x || N || !b || !((R = t.services) != null && R.vote) || !!l.disabled;
1497
+ const L = s.includes(l.id);
1498
+ d.classList.toggle("selected", L), d.setAttribute("role", e === "multi" ? "checkbox" : "radio"), d.setAttribute("aria-checked", String(L));
1499
+ const h = a("span", e === "multi" ? "fc-vote-check" : "fc-radio-dot");
1500
+ h.ariaHidden = "true", d.append(h, a("span", "fc-vote-label", l.label)), b && Object.keys(n.counts).length && d.append(a("span", "fc-vote-count", `${n.counts[l.id] ?? 0} 票`)), d.onclick = () => {
1438
1501
  var k;
1439
- d.disabled || (i = e === "multi" ? w ? i.filter((I) => I !== l.id) : [...i, l.id] : [l.id], C(), (k = p.querySelector(`[data-index="${o.indexOf(l)}"]`)) == null || k.focus());
1440
- }, d.dataset.index = String(o.indexOf(l)), p.append(d);
1502
+ d.disabled || (s = e === "multi" ? L ? s.filter(($) => $ !== l.id) : [...s, l.id] : [l.id], A(), (k = p.querySelector(`[data-index="${i.indexOf(l)}"]`)) == null || k.focus());
1503
+ }, d.dataset.index = String(i.indexOf(l)), p.append(d);
1441
1504
  }
1442
- o.length || p.append(a("p", "fc-empty", "暂无投票选项")), h.disabled = L || V || !x || !(($ = t.services) != null && $.vote) || !i.length, h.textContent = L ? "提交中…" : n.selected.length ? "确认改票" : "确认投票", E.hidden = !n.selected.length, E.disabled = L || V || !x, m.hidden = t.readonly || !((Y = t.services) != null && Y.vote), R == null || R.reposition();
1505
+ i.length || p.append(a("p", "fc-empty", "暂无投票选项")), f.disabled = x || N || !b || !((H = t.services) != null && H.vote) || !s.length, f.textContent = x ? "提交中…" : n.selected.length ? "确认改票" : "确认投票", y.hidden = !n.selected.length, y.disabled = x || N || !b, w.hidden = t.readonly || !((j = t.services) != null && j.vote), V == null || V.reposition();
1443
1506
  };
1444
- p.onkeydown = (F) => {
1445
- if (!["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Home", "End"].includes(F.key)) return;
1446
- const $ = [...p.querySelectorAll("button:not(:disabled)")];
1447
- if (!$.length) return;
1448
- F.preventDefault(), F.stopPropagation();
1449
- const Y = $.indexOf(document.activeElement), l = F.key === "Home" ? 0 : F.key === "End" ? $.length - 1 : (Y + (["ArrowUp", "ArrowLeft"].includes(F.key) ? -1 : 1) + $.length) % $.length;
1450
- $[l].focus(), e !== "multi" && $[l].click();
1507
+ p.onkeydown = (R) => {
1508
+ if (!["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Home", "End"].includes(R.key)) return;
1509
+ const H = [...p.querySelectorAll("button:not(:disabled)")];
1510
+ if (!H.length) return;
1511
+ R.preventDefault(), R.stopPropagation();
1512
+ const j = H.indexOf(document.activeElement), l = R.key === "Home" ? 0 : R.key === "End" ? H.length - 1 : (j + (["ArrowUp", "ArrowLeft"].includes(R.key) ? -1 : 1) + H.length) % H.length;
1513
+ H[l].focus(), e !== "multi" && H[l].click();
1451
1514
  };
1452
- const j = () => {
1453
- R == null || R.close(), R = void 0;
1454
- }, P = async () => {
1455
- var F;
1456
- if (!(!((F = t.services) != null && F.loadVote) || V || L)) {
1457
- V = !0, b.textContent = "", M.hidden = !0, A = new AbortController(), C();
1515
+ const B = () => {
1516
+ V == null || V.close(), V = void 0;
1517
+ }, Y = async () => {
1518
+ var R;
1519
+ if (!(!((R = t.services) != null && R.loadVote) || N || x)) {
1520
+ N = !0, g.textContent = "", D.hidden = !0, C = new AbortController(), A();
1458
1521
  try {
1459
- const $ = await t.services.loadVote(t.field, A.signal);
1460
- if (N || A.signal.aborted) return;
1461
- n = ke($), i = [...n.selected], x = !0;
1522
+ const H = await t.services.loadVote(t.field, C.signal);
1523
+ if (S || C.signal.aborted) return;
1524
+ n = Le(H), s = [...n.selected], b = !0;
1462
1525
  } catch {
1463
- N || (x = !1, b.textContent = "加载失败,请重试", M.hidden = !1);
1526
+ S || (b = !1, g.textContent = "加载失败,请重试", D.hidden = !1);
1464
1527
  } finally {
1465
- N || (V = !1, C());
1528
+ S || (N = !1, A());
1466
1529
  }
1467
1530
  }
1468
- }, B = async (F) => {
1469
- var $;
1470
- if (!(L || V || !x || t.readonly || !(($ = t.services) != null && $.vote))) {
1471
- L = !0, b.textContent = "", A = new AbortController(), C();
1531
+ }, q = async (R) => {
1532
+ var H;
1533
+ if (!(x || N || !b || t.readonly || !((H = t.services) != null && H.vote))) {
1534
+ x = !0, g.textContent = "", C = new AbortController(), A();
1472
1535
  try {
1473
- const Y = await t.services.vote(t.field, [...F], A.signal);
1474
- if (N || A.signal.aborted) return;
1475
- n = ke(Y), i = [...n.selected], L = !1, ie(r), j(), s.focus();
1536
+ const j = await t.services.vote(t.field, [...R], C.signal);
1537
+ if (S || C.signal.aborted) return;
1538
+ n = Le(j), s = [...n.selected], x = !1, oe(r), B(), o.focus();
1476
1539
  } catch {
1477
- N || (b.textContent = "投票失败,请重试");
1540
+ S || (g.textContent = "投票失败,请重试");
1478
1541
  } finally {
1479
- N || (L = !1, C());
1542
+ S || (x = !1, A());
1480
1543
  }
1481
1544
  }
1482
1545
  };
1483
- return s.onclick = (F) => {
1484
- if (F.stopPropagation(), R) {
1485
- j();
1546
+ return o.onclick = (R) => {
1547
+ if (R.stopPropagation(), V) {
1548
+ B();
1486
1549
  return;
1487
1550
  }
1488
- i = [...n.selected], b.textContent = "", C(), R = ce({
1489
- anchor: s,
1551
+ s = [...n.selected], g.textContent = "", A(), V = ce({
1552
+ anchor: o,
1490
1553
  anchorMode: "element",
1491
- content: f,
1554
+ content: m,
1492
1555
  width: 360,
1493
1556
  onDismiss: () => {
1494
- R = void 0, s.setAttribute("aria-expanded", "false"), L || (i = [...n.selected]);
1557
+ V = void 0, o.setAttribute("aria-expanded", "false"), x || (s = [...n.selected]);
1495
1558
  },
1496
- onEscape: () => s.focus()
1497
- }), s.setAttribute("aria-expanded", "true"), f.tabIndex = -1, f.focus(), P();
1498
- }, h.onclick = () => {
1499
- i.length && B(i);
1500
- }, E.onclick = () => void B([]), M.onclick = () => void P(), f.append(y, p, b, M, m), !t.readonly && !((O = t.services) != null && O.vote) && f.append(a("p", "fc-service-note", "创建工作项后可投票")), r.append(s), C(), {
1559
+ onEscape: () => o.focus()
1560
+ }), o.setAttribute("aria-expanded", "true"), m.tabIndex = -1, m.focus(), Y();
1561
+ }, f.onclick = () => {
1562
+ s.length && q(s);
1563
+ }, y.onclick = () => void q([]), D.onclick = () => void Y(), m.append(E, p, g, D, w), !t.readonly && !((I = t.services) != null && I.vote) && m.append(a("p", "fc-service-note", "创建工作项后可投票")), r.append(o), A(), {
1501
1564
  element: r,
1502
- content: f,
1565
+ content: m,
1503
1566
  read: () => structuredClone(n),
1504
- focus: () => s.focus(),
1505
- validate: () => L ? "请等待投票完成" : void 0,
1506
- deactivate: j,
1567
+ focus: () => o.focus(),
1568
+ validate: () => x ? "请等待投票完成" : void 0,
1569
+ deactivate: B,
1507
1570
  destroy: () => {
1508
- N = !0, A == null || A.abort(), j();
1571
+ S = !0, C == null || C.abort(), B();
1509
1572
  }
1510
1573
  };
1511
1574
  }
1512
- function ft(t) {
1513
- const e = t.value && typeof t.value == "object" ? t.value : {}, n = a("div", "fc-location"), o = [["address", "地址", "text"], ["longitude", "经度", "number"], ["latitude", "纬度", "number"]].map(([s, c, u]) => {
1514
- const f = a("label", "fc-location-part", c), y = a("input", "fc-input");
1515
- return y.type = u, y.value = oe(e[s]), y.disabled = t.readonly, y.ariaLabel = c, y.placeholder = c, u === "number" && (y.step = "any", y.min = s === "longitude" ? "-180" : "-90", y.max = s === "longitude" ? "180" : "90"), f.append(y), n.append(f), y;
1516
- }), r = () => o.every((s) => !s.value) ? null : { address: o[0].value, longitude: o[1].value ? Number(o[1].value) : null, latitude: o[2].value ? Number(o[2].value) : null };
1517
- return { element: n, read: r, focus: () => o[0].focus(), validate: () => {
1575
+ function At(t) {
1576
+ const e = t.value && typeof t.value == "object" ? t.value : {}, n = a("div", "fc-location"), i = [["address", "地址", "text"], ["longitude", "经度", "number"], ["latitude", "纬度", "number"]].map(([o, c, u]) => {
1577
+ const m = a("label", "fc-location-part", c), E = a("input", "fc-input");
1578
+ return E.type = u, E.value = re(e[o]), E.disabled = t.readonly, E.ariaLabel = c, E.placeholder = c, u === "number" && (E.step = "any", E.min = o === "longitude" ? "-180" : "-90", E.max = o === "longitude" ? "180" : "90"), m.append(E), n.append(m), E;
1579
+ }), r = () => i.every((o) => !o.value) ? null : { address: i[0].value, longitude: i[1].value ? Number(i[1].value) : null, latitude: i[2].value ? Number(i[2].value) : null };
1580
+ return { element: n, read: r, focus: () => i[0].focus(), validate: () => {
1518
1581
  if (!r()) return t.field.required ? "请填写位置" : void 0;
1519
- if (o.slice(1).some((s) => s.value === "" || !s.checkValidity())) return "请填写有效的经纬度";
1582
+ if (i.slice(1).some((o) => o.value === "" || !o.checkValidity())) return "请填写有效的经纬度";
1520
1583
  } };
1521
1584
  }
1522
- function pt(t) {
1585
+ function xt(t) {
1523
1586
  const e = t.value;
1524
- return ue({ ...t, value: e && typeof e == "object" ? oe(e.address) || [e.longitude, e.latitude].filter((n) => n != null).join(", ") : "" });
1587
+ return ue({ ...t, value: e && typeof e == "object" ? re(e.address) || [e.longitude, e.latitude].filter((n) => n != null).join(", ") : "" });
1525
1588
  }
1526
- function ht(t, e) {
1527
- const n = a("div", "fc-composite"), i = a("div", "fc-composite-rows"), o = a("button", "fc-composite-add", "+ 添加一组");
1528
- o.type = "button";
1529
- const r = t.field.compositeFields || [], s = [];
1589
+ function Ct(t, e) {
1590
+ const n = a("div", "fc-composite"), s = a("div", "fc-composite-rows"), i = a("button", "fc-composite-add", "+ 添加一组");
1591
+ i.type = "button";
1592
+ const r = t.field.compositeFields || [], o = [];
1530
1593
  let c = !1;
1531
- const u = (b) => ({ ...b.value, ...Object.fromEntries(b.editors.map(({ field: h, editor: E }) => [h.key, E.read()])) }), f = (b) => {
1532
- b.editors.forEach(({ editor: h }) => {
1533
- var E;
1534
- return (E = h.destroy) == null ? void 0 : E.call(h);
1535
- }), b.remove && (b.remove.onclick = null), b.element.remove();
1536
- }, y = a("p", "fc-empty", "暂无记录"), T = () => {
1537
- s.forEach((b, h) => {
1538
- b.legend.textContent = "第 " + (h + 1) + " 组";
1539
- }), o.disabled = t.readonly || !r.length || s.length >= (t.field.maxRows || 100), s.length ? y.remove() : i.append(y);
1540
- }, p = (b) => {
1541
- const h = a("fieldset", "fc-composite-row"), E = a("legend");
1542
- h.append(E);
1543
- const M = r.map((L) => {
1544
- const V = e(L), N = V.createEditor({
1594
+ const u = (g) => ({ ...g.value, ...Object.fromEntries(g.editors.map(({ field: f, editor: y }) => [f.key, y.read()])) }), m = (g) => {
1595
+ g.editors.forEach(({ editor: f }) => {
1596
+ var y;
1597
+ return (y = f.destroy) == null ? void 0 : y.call(f);
1598
+ }), g.remove && (g.remove.onclick = null), g.element.remove();
1599
+ }, E = a("p", "fc-empty", "暂无记录"), M = () => {
1600
+ o.forEach((g, f) => {
1601
+ g.legend.textContent = "第 " + (f + 1) + " 组";
1602
+ }), i.disabled = t.readonly || !r.length || o.length >= (t.field.maxRows || 100), o.length ? E.remove() : s.append(E);
1603
+ }, p = (g) => {
1604
+ const f = a("fieldset", "fc-composite-row"), y = a("legend");
1605
+ f.append(y);
1606
+ const D = r.map((x) => {
1607
+ const N = e(x), S = N.createEditor({
1545
1608
  ...t,
1546
- field: L,
1547
- value: b[L.key],
1548
- readonly: t.readonly || L.editable === !1 || !!V.readonly,
1609
+ field: x,
1610
+ value: g[x.key],
1611
+ readonly: t.readonly || x.editable === !1 || !!N.readonly,
1549
1612
  focusBoundary: void 0,
1550
- onSelectedOptions: (A) => {
1551
- var R;
1552
- (R = t.services) != null && R.searchOptions && (L.choices = [...new Map([...Q(L), ...A].map((C) => [C.id, C])).values()]);
1613
+ onSelectedOptions: (C) => {
1614
+ var V;
1615
+ (V = t.services) != null && V.searchOptions && (x.choices = [...new Map([...X(x), ...C].map((A) => [A.id, A])).values()]);
1553
1616
  }
1554
- }), x = a("div", "fc-composite-field");
1555
- return x.append(a("label", "", L.label + (L.required ? " *" : "")), N.element), h.append(x), { field: L, editor: N };
1556
- }), m = { value: b, element: h, legend: E, editors: M };
1617
+ }), b = a("div", "fc-composite-field");
1618
+ return b.append(a("label", "", x.label + (x.required ? " *" : "")), S.element), f.append(b), { field: x, editor: S };
1619
+ }), w = { value: g, element: f, legend: y, editors: D };
1557
1620
  if (!t.readonly) {
1558
- const L = a("button", "fc-composite-remove", "删除此组");
1559
- L.type = "button", L.onclick = () => {
1621
+ const x = a("button", "fc-composite-remove", "删除此组");
1622
+ x.type = "button", x.onclick = () => {
1560
1623
  if (c) return;
1561
- const V = s.indexOf(m);
1562
- V < 0 || (f(m), s.splice(V, 1), T(), ie(n));
1563
- }, m.remove = L, h.append(L);
1624
+ const N = o.indexOf(w);
1625
+ N < 0 || (m(w), o.splice(N, 1), M(), oe(n));
1626
+ }, w.remove = x, f.append(x);
1564
1627
  }
1565
- s.push(m), i.append(h), T();
1628
+ o.push(w), s.append(f), M();
1566
1629
  };
1567
- for (const b of Array.isArray(t.value) ? t.value : []) p(structuredClone(b));
1568
- return o.onclick = () => {
1569
- c || o.disabled || (p({}), ie(n));
1570
- }, n.append(i), t.readonly || n.append(o), r.length || n.append(a("p", "fc-service-note", "请配置复合子字段")), T(), {
1630
+ for (const g of Array.isArray(t.value) ? t.value : []) p(structuredClone(g));
1631
+ return i.onclick = () => {
1632
+ c || i.disabled || (p({}), oe(n));
1633
+ }, n.append(s), t.readonly || n.append(i), r.length || n.append(a("p", "fc-service-note", "请配置复合子字段")), M(), {
1571
1634
  element: n,
1572
- read: () => s.map(u),
1635
+ read: () => o.map(u),
1573
1636
  validate: () => {
1574
- var b;
1575
- if (t.field.required && !s.length) return "请至少添加一组";
1576
- for (const [h, E] of s.entries()) for (const { field: M, editor: m } of E.editors) {
1577
- const L = (b = m.validate) == null ? void 0 : b.call(m);
1578
- if (L) return "第 " + (h + 1) + " 组 · " + M.label + ":" + L;
1637
+ var g;
1638
+ if (t.field.required && !o.length) return "请至少添加一组";
1639
+ for (const [f, y] of o.entries()) for (const { field: D, editor: w } of y.editors) {
1640
+ const x = (g = w.validate) == null ? void 0 : g.call(w);
1641
+ if (x) return "第 " + (f + 1) + " 组 · " + D.label + ":" + x;
1579
1642
  }
1580
1643
  },
1581
1644
  destroy: () => {
1582
- c || (c = !0, o.onclick = null, s.forEach(f));
1645
+ c || (c = !0, i.onclick = null, o.forEach(m));
1583
1646
  }
1584
1647
  };
1585
1648
  }
1586
- class ne extends K {
1649
+ class ie extends Q {
1587
1650
  renderDisplay(e) {
1588
- return { element: it(e) };
1651
+ return { element: mt(e) };
1589
1652
  }
1590
1653
  renderEditing(e) {
1591
- return Pe("text", e);
1654
+ return We("text", e);
1592
1655
  }
1593
1656
  }
1594
- class mt extends ne {
1657
+ class St extends ie {
1595
1658
  renderDisplay(e) {
1596
1659
  return super.renderDisplay({ ...e, field: { ...e.field, kind: "number" } });
1597
1660
  }
1598
1661
  renderEditing(e) {
1599
- return Pe("number", e);
1662
+ return We("number", e);
1600
1663
  }
1601
1664
  }
1602
- class bt extends ne {
1665
+ class Dt extends ie {
1603
1666
  renderDisplay(e) {
1604
1667
  return super.renderDisplay({ ...e, field: { ...e.field, control: "richText" } });
1605
1668
  }
1606
1669
  renderEditing(e) {
1607
- return nt(e);
1670
+ return ht(e);
1608
1671
  }
1609
1672
  }
1610
- class vt extends ne {
1673
+ class Mt extends ie {
1611
1674
  renderDisplay(e) {
1612
1675
  return { element: ue(e) };
1613
1676
  }
@@ -1615,177 +1678,177 @@ class vt extends ne {
1615
1678
  return ve(e, "textarea");
1616
1679
  }
1617
1680
  }
1618
- class Ne extends ne {
1681
+ class Pe extends ie {
1619
1682
  renderDisplay(e) {
1620
- return { element: ot(e) };
1683
+ return { element: bt(e) };
1621
1684
  }
1622
1685
  renderEditing(e) {
1623
1686
  return ve(e, "url");
1624
1687
  }
1625
1688
  }
1626
- class gt extends ne {
1689
+ class Tt extends ie {
1627
1690
  renderEditing(e) {
1628
1691
  return ve(e, "email");
1629
1692
  }
1630
1693
  }
1631
- class yt extends ne {
1694
+ class Ft extends ie {
1632
1695
  renderEditing(e) {
1633
1696
  return ve(e, "tel");
1634
1697
  }
1635
1698
  }
1636
- class fe extends K {
1699
+ class fe extends Q {
1637
1700
  constructor() {
1638
1701
  super(...arguments);
1639
- _(this, "multiple", !1);
1640
- _(this, "variant", "choice");
1702
+ z(this, "multiple", !1);
1703
+ z(this, "variant", "choice");
1641
1704
  }
1642
1705
  renderDisplay(n) {
1643
- return { element: Ie(n, this.variant === "radio" ? "choice" : this.variant) };
1706
+ return { element: _e(n, this.variant === "radio" ? "choice" : this.variant) };
1644
1707
  }
1645
1708
  renderEditing(n) {
1646
- return xe(this.multiple, n, this.variant);
1709
+ return Se(this.multiple, n, this.variant);
1647
1710
  }
1648
1711
  }
1649
- class wt extends fe {
1712
+ class Rt extends fe {
1650
1713
  constructor() {
1651
1714
  super(...arguments);
1652
- _(this, "multiple", !0);
1715
+ z(this, "multiple", !0);
1653
1716
  }
1654
1717
  }
1655
- class kt extends fe {
1718
+ class Nt extends fe {
1656
1719
  constructor() {
1657
1720
  super(...arguments);
1658
- _(this, "variant", "radio");
1721
+ z(this, "variant", "radio");
1659
1722
  }
1660
1723
  renderDisplay(n) {
1661
- return n.layout === "compact" ? { element: Ie(n) } : Me({ ...n, readonly: !0 });
1724
+ return n.layout === "compact" ? { element: _e(n) } : He({ ...n, readonly: !0 });
1662
1725
  }
1663
1726
  renderEditing(n) {
1664
- if (n.layout !== "compact") return Me(n);
1665
- const i = xe(!1, n, "choice");
1666
- return n.field.radioValueType !== "boolean" ? i : { ...i, read: () => {
1667
- const o = i.read();
1668
- return o === "" ? null : o === "true";
1727
+ if (n.layout !== "compact") return He(n);
1728
+ const s = Se(!1, n, "choice");
1729
+ return n.field.radioValueType !== "boolean" ? s : { ...s, read: () => {
1730
+ const i = s.read();
1731
+ return i === "" ? null : i === "true";
1669
1732
  } };
1670
1733
  }
1671
1734
  }
1672
- class ze extends fe {
1735
+ class Xe extends fe {
1673
1736
  constructor() {
1674
1737
  super(...arguments);
1675
- _(this, "variant", "person");
1738
+ z(this, "variant", "person");
1676
1739
  }
1677
1740
  }
1678
- class Et extends ze {
1741
+ class Vt extends Xe {
1679
1742
  constructor() {
1680
1743
  super(...arguments);
1681
- _(this, "multiple", !0);
1744
+ z(this, "multiple", !0);
1682
1745
  }
1683
1746
  }
1684
- class Ye extends fe {
1747
+ class Ze extends fe {
1685
1748
  constructor() {
1686
1749
  super(...arguments);
1687
- _(this, "variant", "relation");
1750
+ z(this, "variant", "relation");
1688
1751
  }
1689
1752
  }
1690
- class Lt extends Ye {
1753
+ class Ot extends Ze {
1691
1754
  constructor() {
1692
1755
  super(...arguments);
1693
- _(this, "multiple", !0);
1756
+ z(this, "multiple", !0);
1694
1757
  }
1695
1758
  }
1696
- class Ue extends K {
1759
+ class et extends Q {
1697
1760
  constructor() {
1698
1761
  super(...arguments);
1699
- _(this, "multiple", !1);
1762
+ z(this, "multiple", !1);
1700
1763
  }
1701
1764
  renderDisplay(n) {
1702
- return { element: dt(n) };
1765
+ return { element: kt(n) };
1703
1766
  }
1704
1767
  renderEditing(n) {
1705
- return ct(this.multiple, n);
1768
+ return Et(this.multiple, n);
1706
1769
  }
1707
1770
  }
1708
- class xt extends Ue {
1771
+ class Ht extends et {
1709
1772
  constructor() {
1710
1773
  super(...arguments);
1711
- _(this, "multiple", !0);
1774
+ z(this, "multiple", !0);
1712
1775
  }
1713
1776
  }
1714
- class We extends K {
1777
+ class tt extends Q {
1715
1778
  normalize(e) {
1716
1779
  return e;
1717
1780
  }
1718
1781
  renderDisplay(e) {
1719
- return { element: je(this.normalize(e)) };
1782
+ return { element: Qe(this.normalize(e)) };
1720
1783
  }
1721
1784
  renderEditing(e) {
1722
- return ut(this.normalize(e));
1785
+ return Lt(this.normalize(e));
1723
1786
  }
1724
1787
  }
1725
- class Ke extends We {
1788
+ class nt extends tt {
1726
1789
  constructor() {
1727
1790
  super(...arguments);
1728
- _(this, "range", !1);
1791
+ z(this, "range", !1);
1729
1792
  }
1730
1793
  normalize(n) {
1731
1794
  return { ...n, field: { ...n.field, dateOptions: { showTime: !1, showRange: this.range, ...n.field.dateOptions } } };
1732
1795
  }
1733
1796
  }
1734
- class At extends Ke {
1797
+ class $t extends nt {
1735
1798
  constructor() {
1736
1799
  super(...arguments);
1737
- _(this, "range", !0);
1800
+ z(this, "range", !0);
1738
1801
  }
1739
1802
  }
1740
- class Ct extends K {
1803
+ class It extends Q {
1741
1804
  renderDisplay(e) {
1742
- return { element: st(e) };
1805
+ return { element: vt(e) };
1743
1806
  }
1744
1807
  renderEditing(e) {
1745
- return qe(e);
1808
+ return Ke(e);
1746
1809
  }
1747
1810
  }
1748
- class St extends K {
1811
+ class Pt extends Q {
1749
1812
  renderDisplay(e) {
1750
- return De({ ...e, readonly: !0 });
1813
+ return $e({ ...e, readonly: !0 });
1751
1814
  }
1752
1815
  renderEditing(e) {
1753
- return De(e);
1816
+ return $e(e);
1754
1817
  }
1755
1818
  }
1756
- class Mt extends K {
1819
+ class qt extends Q {
1757
1820
  renderDisplay(e) {
1758
- return { element: pt(e) };
1821
+ return { element: xt(e) };
1759
1822
  }
1760
1823
  renderEditing(e) {
1761
- return ft(e);
1824
+ return At(e);
1762
1825
  }
1763
1826
  }
1764
- class Ce extends K {
1827
+ class Me extends Q {
1765
1828
  constructor() {
1766
1829
  super(...arguments);
1767
- _(this, "mode", "attitude");
1830
+ z(this, "mode", "attitude");
1768
1831
  }
1769
1832
  renderDisplay(n) {
1770
- return Te({ ...n, readonly: !0 }, this.mode);
1833
+ return Ie({ ...n, readonly: !0 }, this.mode);
1771
1834
  }
1772
1835
  renderEditing(n) {
1773
- return Te(n, this.mode);
1836
+ return Ie(n, this.mode);
1774
1837
  }
1775
1838
  }
1776
- class Dt extends Ce {
1839
+ class Bt extends Me {
1777
1840
  constructor() {
1778
1841
  super(...arguments);
1779
- _(this, "mode", "single");
1842
+ z(this, "mode", "single");
1780
1843
  }
1781
1844
  }
1782
- class Tt extends Ce {
1845
+ class zt extends Me {
1783
1846
  constructor() {
1784
1847
  super(...arguments);
1785
- _(this, "mode", "multi");
1848
+ z(this, "mode", "multi");
1786
1849
  }
1787
1850
  }
1788
- class de extends K {
1851
+ class de extends Q {
1789
1852
  isReadonly() {
1790
1853
  return !0;
1791
1854
  }
@@ -1793,59 +1856,59 @@ class de extends K {
1793
1856
  super({ ...e, readonly: !0 });
1794
1857
  }
1795
1858
  renderDisplay(e) {
1796
- return { element: at(e) };
1859
+ return { element: yt(e) };
1797
1860
  }
1798
1861
  renderEditing(e) {
1799
- return lt(e, (n) => this.renderDisplay(n).element);
1862
+ return wt(e, (n) => this.renderDisplay(n).element);
1800
1863
  }
1801
1864
  }
1802
- class Ve extends de {
1865
+ class qe extends de {
1803
1866
  renderDisplay(e) {
1804
- return { element: rt(e) };
1867
+ return { element: gt(e) };
1805
1868
  }
1806
1869
  }
1807
- class Nt extends ne {
1870
+ class Yt extends ie {
1808
1871
  renderDisplay(e) {
1809
1872
  const n = document.createElement("button");
1810
- return n.type = "button", n.className = "fc-detail-link", n.textContent = e.field.label, n.onclick = (i) => {
1811
- var o;
1812
- i.stopPropagation(), (o = e.onAction) == null || o.call(e, { type: "open", value: e.value });
1873
+ return n.type = "button", n.className = "fc-detail-link", n.textContent = e.field.label, n.onclick = (s) => {
1874
+ var i;
1875
+ s.stopPropagation(), (i = e.onAction) == null || i.call(e, { type: "open", value: e.value });
1813
1876
  }, { element: n, destroy: () => {
1814
1877
  n.onclick = null;
1815
1878
  } };
1816
1879
  }
1817
1880
  }
1818
- class Vt extends K {
1881
+ class _t extends Q {
1819
1882
  constructor(e, n) {
1820
1883
  super(e), this.resolve = n;
1821
1884
  }
1822
1885
  renderDisplay(e) {
1823
- var o;
1886
+ var i;
1824
1887
  if (e.layout === "compact") return { element: ue({ ...e, value: Array.isArray(e.value) && e.value.length ? e.value.length + " 组记录" : "" }) };
1825
1888
  const n = document.createElement("div");
1826
1889
  n.className = "fc-composite";
1827
- const i = [];
1890
+ const s = [];
1828
1891
  for (const r of Array.isArray(e.value) ? e.value : []) {
1829
- const s = document.createElement("fieldset");
1830
- s.className = "fc-composite-row";
1892
+ const o = document.createElement("fieldset");
1893
+ o.className = "fc-composite-row";
1831
1894
  for (const c of e.field.compositeFields ?? []) {
1832
1895
  const u = document.createElement("label");
1833
1896
  u.textContent = c.label;
1834
- const f = { ...e, field: c, value: r[c.key], readonly: !0 }, y = this.resolve(c), T = ((o = y.renderView) == null ? void 0 : o.call(y, f)) ?? { element: y.render(f) };
1835
- i.push(T), s.append(u, T.element);
1897
+ const m = { ...e, field: c, value: r[c.key], readonly: !0 }, E = this.resolve(c), M = ((i = E.renderView) == null ? void 0 : i.call(E, m)) ?? { element: E.render(m) };
1898
+ s.push(M), o.append(u, M.element);
1836
1899
  }
1837
- n.append(s);
1900
+ n.append(o);
1838
1901
  }
1839
- return { element: n, destroy: () => i.forEach((r) => {
1840
- var s;
1841
- return (s = r.destroy) == null ? void 0 : s.call(r);
1902
+ return { element: n, destroy: () => s.forEach((r) => {
1903
+ var o;
1904
+ return (o = r.destroy) == null ? void 0 : o.call(r);
1842
1905
  }) };
1843
1906
  }
1844
1907
  renderEditing(e) {
1845
- return ht(e, this.resolve);
1908
+ return Ct(e, this.resolve);
1846
1909
  }
1847
1910
  }
1848
- const Rt = {
1911
+ const jt = {
1849
1912
  textarea: "保留换行的纯文本,支持长度限制",
1850
1913
  radio: "平铺选项,一次选择一项",
1851
1914
  cascadeSingle: "逐级浏览分类,选择完整路径",
@@ -1881,7 +1944,7 @@ const Rt = {
1881
1944
  number: "支持小数和负数,空值与零分别保存",
1882
1945
  dateTime: "日历、时间与日期范围",
1883
1946
  detail: "由调用方处理关联内容导航"
1884
- }, Ft = {
1947
+ }, Ut = {
1885
1948
  title: "text",
1886
1949
  longText: "richText",
1887
1950
  status: "select",
@@ -1906,52 +1969,52 @@ const Rt = {
1906
1969
  external_multi_signal: "externalMultiSignal",
1907
1970
  multi_person_composite: "multiPersonComposite",
1908
1971
  cloud_document: "cloudDocument"
1909
- }, Ht = [
1910
- ["text", "单行文本", ne, "文本", "T"],
1911
- ["richText", "富文本", bt, "文本", "¶"],
1972
+ }, Wt = [
1973
+ ["text", "单行文本", ie, "文本", "T"],
1974
+ ["richText", "富文本", Dt, "文本", "¶"],
1912
1975
  ["select", "单选", fe, "选择", "◉"],
1913
- ["multiSelect", "多选", wt, "选择", "☑"],
1914
- ["number", "数字", mt, "其他", "#"],
1915
- ["dateTime", "日期时间", We, "日期", "◷"],
1916
- ["detail", "详情页查看", Nt, "关联工作项", "↗"],
1917
- ["textarea", "多行文本", vt, "文本", "≡"],
1918
- ["radio", "单选按钮", kt, "选择", "◉"],
1919
- ["cascadeSingle", "级联单选", Ue, "选择", "⑂"],
1920
- ["cascadeMulti", "级联多选", xt, "选择", "⑂"],
1921
- ["person", "单选人员", ze, "人员", "♙"],
1922
- ["multiPerson", "多选人员", Et, "人员", "♙"],
1923
- ["date", "日期", Ke, "日期", "▦"],
1924
- ["dateRange", "日期区间", At, "日期", "▦"],
1925
- ["url", "URL 链接", Ne, "其他", "↗"],
1926
- ["cloudDocument", "关联云文档", Ne, "其他", "▤"],
1927
- ["email", "邮箱", gt, "其他", "@"],
1928
- ["phone", "电话", yt, "其他", "☎"],
1929
- ["switch", "开关", Ct, "其他", "◐"],
1930
- ["attachment", "附件", St, "其他", "⌑"],
1931
- ["location", "地理位置", Mt, "其他", "⌖"],
1932
- ["relation", "单选关联工作项", Ye, "关联工作项", "↗"],
1933
- ["multiRelation", "多选关联工作项", Lt, "关联工作项", "↗"],
1934
- ["attitudeVote", "表态投票", Ce, "投票", "♡"],
1935
- ["singleVote", "单选投票", Dt, "投票", "♡"],
1936
- ["multiVote", "多选投票", Tt, "投票", "♡"],
1937
- ["externalSignal", "系统外信号", Ve, "系统", "◌", !0],
1938
- ["externalMultiSignal", "多值系统外信号", Ve, "系统", "◌", !0],
1976
+ ["multiSelect", "多选", Rt, "选择", "☑"],
1977
+ ["number", "数字", St, "其他", "#"],
1978
+ ["dateTime", "日期时间", tt, "日期", "◷"],
1979
+ ["detail", "详情页查看", Yt, "关联工作项", "↗"],
1980
+ ["textarea", "多行文本", Mt, "文本", "≡"],
1981
+ ["radio", "单选按钮", Nt, "选择", "◉"],
1982
+ ["cascadeSingle", "级联单选", et, "选择", "⑂"],
1983
+ ["cascadeMulti", "级联多选", Ht, "选择", "⑂"],
1984
+ ["person", "单选人员", Xe, "人员", "♙"],
1985
+ ["multiPerson", "多选人员", Vt, "人员", "♙"],
1986
+ ["date", "日期", nt, "日期", "▦"],
1987
+ ["dateRange", "日期区间", $t, "日期", "▦"],
1988
+ ["url", "URL 链接", Pe, "其他", "↗"],
1989
+ ["cloudDocument", "关联云文档", Pe, "其他", "▤"],
1990
+ ["email", "邮箱", Tt, "其他", "@"],
1991
+ ["phone", "电话", Ft, "其他", "☎"],
1992
+ ["switch", "开关", It, "其他", "◐"],
1993
+ ["attachment", "附件", Pt, "其他", "⌑"],
1994
+ ["location", "地理位置", qt, "其他", "⌖"],
1995
+ ["relation", "单选关联工作项", Ze, "关联工作项", "↗"],
1996
+ ["multiRelation", "多选关联工作项", Ot, "关联工作项", "↗"],
1997
+ ["attitudeVote", "表态投票", Me, "投票", "♡"],
1998
+ ["singleVote", "单选投票", Bt, "投票", "♡"],
1999
+ ["multiVote", "多选投票", zt, "投票", "♡"],
2000
+ ["externalSignal", "系统外信号", qe, "系统", "◌", !0],
2001
+ ["externalMultiSignal", "多值系统外信号", qe, "系统", "◌", !0],
1939
2002
  ["formula", "公式计算", de, "系统", "ƒ", !0],
1940
2003
  ["aggregate", "聚合计算", de, "系统", "ƒ", !0],
1941
2004
  ["ai", "AI 字段", de, "系统", "ƒ", !0],
1942
2005
  ["system", "系统字段", de, "系统", "ƒ", !0]
1943
2006
  ];
1944
- function $t(t = []) {
1945
- const e = /* @__PURE__ */ new Map(), n = (s) => {
1946
- if (!/^[A-Za-z][\w-]*$/.test(s.id)) throw new Error("Invalid control id");
1947
- if (e.has(s.id)) throw new Error(`Control already registered: ${s.id}`);
1948
- e.set(s.id, s);
1949
- }, i = (s) => {
1950
- const c = s.control || Ft[s.kind || "text"] || s.kind || "text", u = e.get(c);
2007
+ function Gt(t = []) {
2008
+ const e = /* @__PURE__ */ new Map(), n = (o) => {
2009
+ if (!/^[A-Za-z][\w-]*$/.test(o.id)) throw new Error("Invalid control id");
2010
+ if (e.has(o.id)) throw new Error(`Control already registered: ${o.id}`);
2011
+ e.set(o.id, o);
2012
+ }, s = (o) => {
2013
+ const c = o.control || Ut[o.kind || "text"] || o.kind || "text", u = e.get(c);
1951
2014
  if (!u) throw new Error(`Unknown control: ${c}`);
1952
2015
  return u;
1953
- }, o = (s) => i(s.field).create(s), r = (s) => {
1954
- const c = i(s);
2016
+ }, i = (o) => s(o.field).create(o), r = (o) => {
2017
+ const c = s(o);
1955
2018
  return {
1956
2019
  ...c,
1957
2020
  render: (u) => c.create(u).render().element,
@@ -1959,22 +2022,22 @@ function $t(t = []) {
1959
2022
  createEditor: (u) => c.create(u).createEditor()
1960
2023
  };
1961
2024
  };
1962
- for (const [s, c, u, f, y, T] of Ht)
2025
+ for (const [o, c, u, m, E, M] of Wt)
1963
2026
  n({
1964
- id: s,
2027
+ id: o,
1965
2028
  label: c,
1966
- description: Rt[s] || c,
1967
- glyph: y,
1968
- group: f,
1969
- readonly: T,
1970
- action: s === "detail" ? "view" : s === "select" || s === "multiSelect" ? "select" : void 0,
1971
- create: (p) => new u({ ...p, readonly: T || p.readonly })
2029
+ description: jt[o] || c,
2030
+ glyph: E,
2031
+ group: m,
2032
+ readonly: M,
2033
+ action: o === "detail" ? "view" : o === "select" || o === "multiSelect" ? "select" : void 0,
2034
+ create: (p) => new u({ ...p, readonly: M || p.readonly })
1972
2035
  });
1973
- for (const [s, c] of [["composite", "复合字段"], ["multiPersonComposite", "多人复合字段"]])
1974
- n({ id: s, label: c, description: "组合多个已注册字段", glyph: "▦", group: "其他", create: (u) => new Vt(u, r) });
1975
- return t.forEach(n), { register: n, resolve: i, create: o, list: () => [...e.values()] };
2036
+ for (const [o, c] of [["composite", "复合字段"], ["multiPersonComposite", "多人复合字段"]])
2037
+ n({ id: o, label: c, description: "组合多个已注册字段", glyph: "▦", group: "其他", create: (u) => new _t(u, r) });
2038
+ return t.forEach(n), { register: n, resolve: s, create: i, list: () => [...e.values()] };
1976
2039
  }
1977
- class Ot extends K {
2040
+ class Jt extends Q {
1978
2041
  constructor(e, n) {
1979
2042
  super(e), this.control = n;
1980
2043
  }
@@ -1986,40 +2049,40 @@ class Ot extends K {
1986
2049
  }
1987
2050
  }
1988
2051
  export {
1989
- Nt as ActionField,
1990
- St as AttachmentField,
1991
- K as BaseField,
1992
- Ue as CascadeField,
2052
+ Yt as ActionField,
2053
+ Pt as AttachmentField,
2054
+ Q as BaseField,
2055
+ et as CascadeField,
1993
2056
  fe as ChoiceField,
1994
- Vt as CompositeField,
2057
+ _t as CompositeField,
1995
2058
  de as ComputedField,
1996
- Ot as CustomField,
1997
- Ke as DateField,
1998
- At as DateRangeField,
1999
- We as DateTimeField,
2000
- gt as EmailField,
2001
- Ne as LinkField,
2002
- Mt as LocationField,
2003
- xt as MultiCascadeField,
2004
- wt as MultiChoiceField,
2005
- Et as MultiPersonField,
2006
- Lt as MultiRelationField,
2007
- Tt as MultiVoteField,
2008
- mt as NumberField,
2009
- ze as PersonField,
2010
- yt as PhoneField,
2011
- kt as RadioField,
2012
- Ye as RelationField,
2013
- bt as RichTextField,
2014
- Ve as SignalField,
2015
- Dt as SingleVoteField,
2016
- Ct as SwitchField,
2017
- ne as TextField,
2018
- vt as TextareaField,
2019
- Ce as VoteField,
2020
- Ze as closeAllFieldPopups,
2021
- $t as createFieldRegistry,
2059
+ Jt as CustomField,
2060
+ nt as DateField,
2061
+ $t as DateRangeField,
2062
+ tt as DateTimeField,
2063
+ Tt as EmailField,
2064
+ Pe as LinkField,
2065
+ qt as LocationField,
2066
+ Ht as MultiCascadeField,
2067
+ Rt as MultiChoiceField,
2068
+ Vt as MultiPersonField,
2069
+ Ot as MultiRelationField,
2070
+ zt as MultiVoteField,
2071
+ St as NumberField,
2072
+ Xe as PersonField,
2073
+ Ft as PhoneField,
2074
+ Nt as RadioField,
2075
+ Ze as RelationField,
2076
+ Dt as RichTextField,
2077
+ qe as SignalField,
2078
+ Bt as SingleVoteField,
2079
+ It as SwitchField,
2080
+ ie as TextField,
2081
+ Mt as TextareaField,
2082
+ Me as VoteField,
2083
+ ct as closeAllFieldPopups,
2084
+ Gt as createFieldRegistry,
2022
2085
  ce as openFieldPopup,
2023
- Re as renderContent,
2086
+ Be as renderContent,
2024
2087
  me as sanitizeRichText
2025
2088
  };