rowvia 0.3.2 → 0.3.3

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