rowvia 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/fields.css +1 -1
  2. package/dist/fields.es.js +1167 -1104
  3. package/dist/fields.umd.cjs +1 -1
  4. package/dist/rowvia.css +1 -1
  5. package/dist/rowvia.es.js +5834 -4698
  6. package/dist/rowvia.umd.cjs +71 -55
  7. package/dist/types/components/scrollbars.d.ts +11 -3
  8. package/dist/types/components/table-cell-content.d.ts +9 -0
  9. package/dist/types/components/table-groups.d.ts +32 -0
  10. package/dist/types/components/table-headers.d.ts +11 -0
  11. package/dist/types/components/table-inline-editor.d.ts +13 -0
  12. package/dist/types/components/table-popup.d.ts +3 -0
  13. package/dist/types/components/table-presentation.d.ts +14 -0
  14. package/dist/types/components/table-text-editor.d.ts +29 -0
  15. package/dist/types/conditions/index.d.ts +12 -0
  16. package/dist/types/contracts/work-item.d.ts +1 -1
  17. package/dist/types/fields/internal/anchored-popup.d.ts +23 -0
  18. package/dist/types/fields/popup.d.ts +7 -9
  19. package/dist/types/fields/types.d.ts +3 -0
  20. package/dist/types/index.d.ts +1 -0
  21. package/dist/types/vue/DualPanePicker.d.ts +211 -0
  22. package/dist/types/vue/controls.d.ts +3961 -0
  23. package/dist/types/vue/index.d.ts +6 -0
  24. package/dist/types/vue/registry.d.ts +10 -0
  25. package/dist/types/vue-conditions/ConditionGroup.d.ts +120 -0
  26. package/dist/types/vue-conditions/ConditionRow.d.ts +94 -0
  27. package/dist/types/vue-conditions/ConditionValue.d.ts +56 -0
  28. package/dist/types/vue-conditions/controls.d.ts +12 -0
  29. package/dist/types/vue-conditions/index.d.ts +6 -0
  30. package/dist/types/work-items/index.d.ts +13 -1
  31. package/dist/types/work-items/tool-field-picker.d.ts +14 -0
  32. package/dist/types/work-items/tool-filter.d.ts +14 -0
  33. package/dist/types/work-items/tool-icons.d.ts +1 -0
  34. package/dist/types/work-items/tool-panel.d.ts +17 -0
  35. package/dist/types/work-items/tool-state.d.ts +21 -0
  36. package/dist/types/work-items/toolbar.d.ts +10 -2
  37. package/dist/types/work-items/views/rule-panels.d.ts +2 -0
  38. package/dist/types/work-items/workflow-detail-types.d.ts +20 -0
  39. package/dist/types/work-items/workflow-field-popups.d.ts +4 -0
  40. package/dist/types/work-items/workflow-legend.d.ts +16 -0
  41. package/dist/types/work-items/workflow-presentation.d.ts +3 -0
  42. package/dist/vue.css +1 -0
  43. package/dist/vue.es.js +631 -0
  44. package/dist/vue.umd.cjs +1 -0
  45. package/package.json +27 -7
package/dist/vue.es.js ADDED
@@ -0,0 +1,631 @@
1
+ import { provide as He, inject as $e, defineComponent as q, h as r, ref as Ee, onMounted as De, onUpdated as Ke, onBeforeUnmount as Ue, isVNode as Me, createTextVNode as We, Fragment as Je, computed as H } from "vue";
2
+ import { createFieldRegistry as Ye } from "rowvia/fields";
3
+ const Le = Symbol("rowvia.fieldRegistry");
4
+ function lt(e) {
5
+ He(Le, e);
6
+ }
7
+ function Ze(e) {
8
+ const l = e ?? $e(Le, void 0);
9
+ let n;
10
+ return () => typeof l == "function" ? l() : l ?? n ?? (n = Ye());
11
+ }
12
+ const L = (e) => typeof e == "string" ? e === "" ? "string:" : e : typeof e + ":" + (typeof e == "object" ? JSON.stringify(e) : String(e)), I = (e) => JSON.stringify(e), Qe = (e) => e === "" || e === !0;
13
+ function te(e) {
14
+ if (Array.isArray(e.children)) return e.children.filter(Me);
15
+ if (e.children && typeof e.children == "object" && "default" in e.children) {
16
+ const l = e.children.default();
17
+ return (Array.isArray(l) ? l : [l]).flatMap((n) => Me(n) ? [n] : typeof n == "string" || typeof n == "number" ? [We(String(n))] : []);
18
+ }
19
+ return [];
20
+ }
21
+ function ae(e) {
22
+ return e.map((l) => typeof l.type == "object" && /Avatar|Icon/.test(l.type.name ?? "") ? "" : typeof l.children == "string" ? l.children : ae(te(l))).join("").trim();
23
+ }
24
+ function qe(e) {
25
+ return e.flatMap((l) => {
26
+ var k, g, w;
27
+ const n = typeof l.type == "object" ? l.type.name : l.type;
28
+ return ["RowviaOption", "RowviaRadio", "RowviaCheckbox", "option"].includes(String(n)) ? [{ value: ((k = l.props) == null ? void 0 : k.value) ?? ae(te(l)), label: String(((g = l.props) == null ? void 0 : g.label) ?? (typeof l.children == "string" ? l.children : ae(te(l)))), disabled: Qe((w = l.props) == null ? void 0 : w.disabled) }] : qe(te(l));
29
+ });
30
+ }
31
+ function Ge(e) {
32
+ return e.map((l) => {
33
+ if (l && typeof l == "object") {
34
+ const n = l;
35
+ return { value: n.value ?? n.id, label: String(n.label ?? n.name ?? n.value ?? n.id), description: n.description, color: n.color, disabled: !!n.disabled, children: n.children ? Ge(n.children) : void 0 };
36
+ }
37
+ return { value: l, label: String(l) };
38
+ });
39
+ }
40
+ function Xe(e) {
41
+ function l(P, i, y = !1) {
42
+ return q({
43
+ name: P,
44
+ inheritAttrs: !1,
45
+ props: {
46
+ modelValue: null,
47
+ value: null,
48
+ checked: { type: Boolean, default: void 0 },
49
+ modelModifiers: { type: Object, default: () => ({}) },
50
+ type: String,
51
+ disabled: Boolean,
52
+ readonly: Boolean,
53
+ loading: Boolean,
54
+ required: Boolean,
55
+ multiple: Boolean,
56
+ pathMode: Boolean,
57
+ checkStrictly: Boolean,
58
+ options: Array,
59
+ data: Array,
60
+ placeholder: [String, Array],
61
+ label: String,
62
+ min: [Number, String],
63
+ max: [Number, String],
64
+ step: [Number, String],
65
+ precision: Number,
66
+ maxLength: [Number, String],
67
+ maxlength: [Number, String],
68
+ maxRows: [Number, String],
69
+ maxSelections: [Number, String],
70
+ showTime: [Boolean, Object],
71
+ valueFormat: String,
72
+ autoSize: [Boolean, Object],
73
+ allowClear: Boolean,
74
+ allowSearch: Boolean,
75
+ showPlaceholder: Boolean,
76
+ accept: String,
77
+ maxFiles: [Number, String],
78
+ maxBytes: [Number, String]
79
+ },
80
+ emits: {
81
+ "update:modelValue": (t) => !0,
82
+ "update:checked": (t) => !0,
83
+ input: (t, T) => !0,
84
+ change: (t, T) => !0,
85
+ blur: (t) => !0,
86
+ focus: (t) => !0,
87
+ "press-enter": (t) => !0,
88
+ search: (t) => !0,
89
+ clear: () => !0
90
+ },
91
+ setup(t, { attrs: T, slots: u, emit: V, expose: ze }) {
92
+ const ue = Ze(e), M = Ee();
93
+ let _, d, D, p = "", Y = "", ee = [], oe = "", de = [], se = !1;
94
+ const K = /* @__PURE__ */ new Map(), me = () => t.modelValue !== void 0 ? t.modelValue : t.checked !== void 0 ? t.checked : t.value, N = () => i === "native" ? t.type === "checkbox" ? "switch" : t.type === "number" || t.modelModifiers.number ? "number" : t.type === "date" ? "date" : t.type === "datetime-local" ? "dateTime" : ["url", "email", "tel"].includes(t.type ?? "") ? t.type === "tel" ? "phone" : t.type : "text" : i === "person" ? t.multiple ? "multiPerson" : "person" : i === "select" ? t.multiple ? "multiSelect" : "select" : i === "cascadeSingle" ? t.checkStrictly ? t.multiple ? "multiSelect" : "select" : t.multiple ? "cascadeMulti" : "cascadeSingle" : i, E = () => ["select", "multiSelect", "person", "multiPerson", "radio", "cascadeSingle", "cascadeMulti"].includes(N());
95
+ function ge() {
96
+ if (t.maxSelections != null) return Number(t.maxSelections);
97
+ }
98
+ function we() {
99
+ if (t.maxRows != null) return Number(t.maxRows);
100
+ if (t.autoSize && typeof t.autoSize == "object" && t.autoSize.maxRows) return t.autoSize.maxRows;
101
+ }
102
+ function Re() {
103
+ const a = ee.filter((o) => o.color).map((o) => [L(o.value), o.color]);
104
+ return a.length ? Object.fromEntries(a) : void 0;
105
+ }
106
+ function Se(a) {
107
+ if (i === "cascadeSingle" && t.checkStrictly) {
108
+ const o = (S, s = [], m = []) => S.flatMap((A) => {
109
+ const B = [...s, A.value], U = L(t.pathMode ? B : A.value);
110
+ return K.set(U, t.pathMode ? B : A.value), [{ id: U, label: [...m, A.label].join(" / "), disabled: A.disabled }, ...o(A.children ?? [], B, [...m, A.label])];
111
+ });
112
+ return o(a);
113
+ }
114
+ return a.map((o) => {
115
+ const S = L(o.value);
116
+ return K.set(S, o.value), { id: S, label: o.label, description: o.description, color: o.color, disabled: o.disabled, children: o.children ? Se(o.children) : void 0 };
117
+ });
118
+ }
119
+ function fe(a, o = ee, S = []) {
120
+ for (const s of o) {
121
+ const m = [...S, s.value];
122
+ if (I(s.value) === I(a)) return m;
123
+ const A = fe(a, s.children ?? [], m);
124
+ if (A.length) return A;
125
+ }
126
+ return [];
127
+ }
128
+ function ye(a) {
129
+ if (N() === "switch") return Array.isArray(a) ? a.some((o) => I(o) === I(t.value)) : !!a;
130
+ if (!E()) return a;
131
+ if (i === "cascadeSingle" && t.checkStrictly) return t.multiple ? Array.isArray(a) ? a.map(L) : [] : a == null ? "" : L(a);
132
+ if (N() === "cascadeSingle" || N() === "cascadeMulti") {
133
+ const o = t.pathMode ? a : t.multiple ? Array.isArray(a) ? a.map((s) => fe(s)) : [] : fe(a), S = (s) => s.map(L);
134
+ return t.multiple ? Array.isArray(o) ? o.map((s) => S(Array.isArray(s) ? s : [])) : [] : S(Array.isArray(o) ? o : []);
135
+ }
136
+ return Array.isArray(a) ? a.map(L) : a == null || a === "" && !K.has(L("")) ? "" : L(a);
137
+ }
138
+ function Fe(a) {
139
+ var o, S;
140
+ if (N() === "switch" && Array.isArray(me())) {
141
+ const s = me();
142
+ return a ? [...s.filter((m) => I(m) !== I(t.value)), t.value] : s.filter((m) => I(m) !== I(t.value));
143
+ }
144
+ if (E()) {
145
+ const s = (m) => Array.isArray(m) ? m.map(s) : K.has(String(m)) ? K.get(String(m)) : y ? "" : void 0;
146
+ a = s(a), (N() === "cascadeSingle" || N() === "cascadeMulti") && !t.pathMode && (a = t.multiple ? a.map((m) => m[m.length - 1]) : a[a.length - 1]);
147
+ }
148
+ if (t.modelModifiers.trim && typeof a == "string" && (a = a.trim()), t.modelModifiers.number && typeof a == "string" && a !== "" && !Number.isNaN(Number(a)) && (a = Number(a)), N() === "number" && a === null) return y ? "" : void 0;
149
+ if (["date", "dateTime", "dateRange"].includes(N()) && ((o = t.valueFormat) != null && o.includes("Z"))) {
150
+ const s = (m) => typeof m == "string" && m && !Number.isNaN(Date.parse(m)) ? new Date(m).toISOString() : m;
151
+ a = Array.isArray(a) ? a.map(s) : s(a);
152
+ }
153
+ if (["date", "dateTime", "dateRange"].includes(N()) && ((S = t.valueFormat) != null && S.includes(" "))) {
154
+ const s = (m) => typeof m == "string" ? m.replace("T", " ") : m;
155
+ a = Array.isArray(a) ? a.map(s) : s(a);
156
+ }
157
+ return a;
158
+ }
159
+ function xe() {
160
+ var a, o;
161
+ de.forEach((S) => S()), de = [], D == null || D.destroy(), D = void 0, (a = d == null ? void 0 : d.destroy) == null || a.call(d), _ == null || _.destroy(), d = void 0, _ = void 0, (o = M.value) == null || o.replaceChildren();
162
+ }
163
+ function be(a, o, S) {
164
+ if (!E() && N() !== "switch" && !N().startsWith("date")) return S;
165
+ const s = new Event(a, { bubbles: !0 });
166
+ return Object.defineProperty(s, "target", { value: { value: o, checked: (d == null ? void 0 : d.read()) === !0 } }), s;
167
+ }
168
+ function ve() {
169
+ var Ae, Ce, Ve, Ne, Te, Oe, Pe, Ie, Be;
170
+ if (!M.value || se) return;
171
+ K.clear();
172
+ const a = N(), o = (Ve = (Ce = (Ae = M.value.closest("label")) == null ? void 0 : Ae.querySelector(":scope > span:not(.rowvia-control)")) == null ? void 0 : Ce.textContent) == null ? void 0 : Ve.trim(), s = {
173
+ key: "value",
174
+ label: t.label || String(T["aria-label"] ?? oe ?? "") || String(T.title ?? "") || o || String(t.placeholder ?? "") || ((Oe = (Te = (Ne = M.value.closest(".arco-form-item")) == null ? void 0 : Ne.querySelector(".arco-form-item-label")) == null ? void 0 : Te.textContent) == null ? void 0 : Oe.trim()) || "字段",
175
+ control: a,
176
+ editable: !t.disabled && !t.readonly,
177
+ required: t.required,
178
+ placeholder: Array.isArray(t.placeholder) ? t.placeholder.join(" / ") : t.placeholder,
179
+ maxLength: t.maxLength !== void 0 || t.maxlength !== void 0 ? Number(t.maxLength ?? t.maxlength) : void 0,
180
+ choices: Se(ee.filter((c) => !(c.value === "" && c.disabled))),
181
+ ...ge() !== void 0 ? { maxSelections: ge() } : {},
182
+ ...we() !== void 0 ? { maxRows: we() } : {},
183
+ ...a === "attachment" ? { attachmentOptions: {
184
+ accept: t.accept,
185
+ maxFiles: t.maxFiles == null ? void 0 : Number(t.maxFiles),
186
+ maxBytes: t.maxBytes == null ? void 0 : Number(t.maxBytes)
187
+ } } : {},
188
+ ...Re() ? { colors: Re() } : {},
189
+ numberOptions: { min: t.min == null ? void 0 : Number(t.min), max: t.max == null ? void 0 : Number(t.max), step: t.step == null ? void 0 : Number(t.step), decimals: t.precision },
190
+ dateOptions: { showTime: !!t.showTime || a === "dateTime", showRange: a === "dateRange", showSeconds: (Pe = t.valueFormat) == null ? void 0 : Pe.includes("ss") }
191
+ }, m = I([s, t.loading, t.type, t.allowClear]), A = me(), B = I(A) ?? "";
192
+ if (d && m === p && B === Y) return;
193
+ if (d && m === p && !E() && !["switch", "date", "dateTime", "dateRange"].includes(a)) {
194
+ const c = z();
195
+ c && (c.value = A == null ? "" : String(A)), Y = B;
196
+ return;
197
+ }
198
+ const U = M.value.contains(document.activeElement);
199
+ if (xe(), p = m, Y = B, _ = ue().create({ field: s, value: ye(A), readonly: t.disabled || t.readonly || t.loading, layout: ["text", "number", "textarea", "url", "email", "phone"].includes(a) ? "compact" : "form" }), d = _.createEditor(), M.value.append(d.element), t.showPlaceholder && t.placeholder && E()) {
200
+ const c = d.element.querySelector(".fc-choice-placeholder");
201
+ c && (c.textContent = Array.isArray(t.placeholder) ? t.placeholder.join(" / ") : String(t.placeholder));
202
+ }
203
+ if ((t.disabled || t.readonly || t.loading) && (E() || a.startsWith("date"))) {
204
+ (Ie = d.destroy) == null || Ie.call(d), _.destroy(), _ = ue().create({ field: s, value: ye(A), readonly: !0 });
205
+ const c = _.render();
206
+ d = { ...c, read: () => ye(A) }, M.value.replaceChildren(c.element);
207
+ }
208
+ const W = d.inputRoot ?? d.element, J = (c, x, Z, je = !1) => {
209
+ c.addEventListener(x, Z, je), de.push(() => c.removeEventListener(x, Z, je));
210
+ }, ke = (c) => {
211
+ if (t.disabled || t.readonly || t.loading || c.isComposing) return;
212
+ if (E() && c.type === "input") {
213
+ V("search", c.target.value ?? "");
214
+ return;
215
+ }
216
+ if (E() && c.type === "change" && c.target instanceof HTMLInputElement && !["radio", "checkbox"].includes(c.target.type)) return;
217
+ const x = Fe(d.read()), Z = I(x) ?? "";
218
+ Z !== Y && (Y = Z, V("update:modelValue", x), a === "switch" && V("update:checked", !!d.read())), c.type === "input" && V("input", y ? be("input", x, c) : x, c), c.type === "change" && (V("change", y ? be("change", x, c) : x, c), y && (E() || a === "switch" || a.startsWith("date")) && V("input", be("input", x, c), c), (x === void 0 || x === "" || Array.isArray(x) && !x.length) && V("clear"), a.startsWith("date") && queueMicrotask(() => {
219
+ se || (p = "", ve());
220
+ }));
221
+ };
222
+ J(W, "input", ke), J(W, "change", ke), J(W, "compositionend", (c) => {
223
+ var x;
224
+ (x = c.target) == null || x.dispatchEvent(new Event("input", { bubbles: !0 }));
225
+ }), J(W, "keydown", (c) => {
226
+ c.key === "Enter" && !c.isComposing && (V("press-enter", c), P === "RowviaInputSearch" && V("search", String((d == null ? void 0 : d.read()) ?? "")));
227
+ }), J(W, "focusin", (c) => V("focus", c)), J(W, "focusout", (c) => V("blur", c));
228
+ const j = z(), he = d.element.querySelector("select");
229
+ if (he && T.id != null && (he.id = String(T.id)), j) {
230
+ for (const c of ["id", "name", "autocomplete", "inputmode", "spellcheck", "rows", "aria-label", "aria-describedby", "data-test", "autofocus", "minlength", "pattern", "form"]) T[c] != null && !(c === "id" && he) && j.setAttribute(c, String(T[c]));
231
+ j instanceof HTMLInputElement && ["password", "search", "url", "email", "tel"].includes(t.type ?? "") && (j.type = t.type), t.readonly && (j.readOnly = !0), j instanceof HTMLTextAreaElement && t.autoSize && typeof t.autoSize == "object" && (j.rows = t.autoSize.minRows ?? 1, j.style.minHeight = `${(t.autoSize.minRows ?? 1) * 22 + 12}px`, t.autoSize.maxRows && (j.style.maxHeight = `${t.autoSize.maxRows * 22 + 12}px`, j.style.overflowY = "auto"));
232
+ }
233
+ if (t.allowClear && ["text", "textarea", "number"].includes(a) && !t.disabled && !t.readonly) {
234
+ D = ue().create({
235
+ field: { key: "clear", label: "清空", control: "detail" },
236
+ value: null,
237
+ readonly: !1,
238
+ onAction: () => {
239
+ const x = z();
240
+ x && (x.value = "", x.dispatchEvent(new Event("input", { bubbles: !0 })), x.dispatchEvent(new Event("change", { bubbles: !0 })), x.focus());
241
+ }
242
+ });
243
+ const c = D.render();
244
+ c.element.classList.add("rowvia-control-clear"), M.value.append(c.element);
245
+ }
246
+ U && !t.disabled && ((Be = d.focus) == null || Be.call(d));
247
+ }
248
+ function z() {
249
+ const a = d == null ? void 0 : d.element;
250
+ return a instanceof HTMLInputElement || a instanceof HTMLTextAreaElement ? a : a == null ? void 0 : a.querySelector("input:not([hidden]),textarea");
251
+ }
252
+ return ze({ focus: () => {
253
+ var a;
254
+ return (a = d == null ? void 0 : d.focus) == null ? void 0 : a.call(d);
255
+ }, blur: () => {
256
+ var a;
257
+ return (a = z()) == null ? void 0 : a.blur();
258
+ }, select: () => {
259
+ var a;
260
+ return (a = z()) == null ? void 0 : a.select();
261
+ }, setSelectionRange: (a, o) => {
262
+ var S;
263
+ return (S = z()) == null ? void 0 : S.setSelectionRange(a, o);
264
+ }, get style() {
265
+ var a;
266
+ return (a = z()) == null ? void 0 : a.style;
267
+ }, get scrollHeight() {
268
+ var a;
269
+ return ((a = z()) == null ? void 0 : a.scrollHeight) ?? 0;
270
+ } }), De(ve), Ke(ve), Ue(() => {
271
+ se = !0, xe();
272
+ }), () => {
273
+ var S, s, m, A, B;
274
+ const a = ((S = u.default) == null ? void 0 : S.call(u)) ?? [];
275
+ ee = t.options ? Ge(t.options) : qe(a), oe = N() === "switch" ? ae(a) : "";
276
+ const o = { ...T };
277
+ for (const U of ["id", "name", "autocomplete", "inputmode", "spellcheck", "rows", "aria-label", "aria-describedby", "data-test", "autofocus", "minlength", "pattern", "form"]) delete o[U];
278
+ return r("span", { ...o, class: ["rowvia-control rowvia-field-scope", T.class, { "rowvia-control--toggle": N() === "switch" }], "aria-busy": t.loading || void 0, "data-option-value": N() === "switch" ? String(t.value ?? "") : void 0 }, [
279
+ (s = u.prepend) == null ? void 0 : s.call(u),
280
+ (m = u.prefix) == null ? void 0 : m.call(u),
281
+ r("span", { ref: M, class: "rowvia-control-host" }),
282
+ N() === "switch" && oe ? r("span", { class: "rowvia-control-caption" }, a) : null,
283
+ (A = u.suffix) == null ? void 0 : A.call(u),
284
+ (B = u.append) == null ? void 0 : B.call(u)
285
+ ]);
286
+ };
287
+ }
288
+ });
289
+ }
290
+ const n = l("RowviaInput", "text"), k = l("RowviaInputSearch", "text"), g = l("RowviaTextarea", "textarea"), w = l("RowviaInputNumber", "number"), b = l("RowviaPerson", "person"), v = l("RowviaSelect", "select"), h = l("RowviaCascader", "cascadeSingle"), C = l("RowviaRadioGroup", "radio"), R = l("RowviaCheckboxGroup", "multiSelect"), O = l("RowviaCheckbox", "switch"), G = l("RowviaSwitch", "switch"), $ = l("RowviaDatePicker", "date"), F = l("RowviaRangePicker", "dateRange"), ne = l("RowviaNativeInput", "native", !0), ie = l("RowviaNativeSelect", "select", !0), re = l("RowviaNativeTextarea", "textarea", !0), ce = q({ name: "RowviaOption", props: ["value", "label", "disabled"], setup: () => () => null }), f = q({ name: "RowviaRadio", props: ["value", "disabled"], setup: () => () => null }), Q = q({ name: "RowviaOptgroup", setup: () => () => null }), X = q({
291
+ name: "RowviaAutoComplete",
292
+ inheritAttrs: !1,
293
+ props: { modelValue: String, data: Array, disabled: Boolean, placeholder: String },
294
+ emits: { "update:modelValue": (P) => !0 },
295
+ setup: (P, { attrs: i, emit: y }) => () => r("span", { class: "rowvia-autocomplete" }, [
296
+ r(n, { ...i, modelValue: P.modelValue, disabled: P.disabled, placeholder: P.placeholder, "onUpdate:modelValue": (t) => y("update:modelValue", t) }),
297
+ r(v, { options: P.data, disabled: P.disabled, label: "预设状态", placeholder: "选择预设", "onUpdate:modelValue": (t) => y("update:modelValue", t ?? "") })
298
+ ])
299
+ });
300
+ return { RowviaInput: n, RowviaInputSearch: k, RowviaTextarea: g, RowviaInputNumber: w, RowviaPerson: b, RowviaSelect: v, RowviaCascader: h, RowviaRadioGroup: C, RowviaCheckboxGroup: R, RowviaCheckbox: O, RowviaSwitch: G, RowviaDatePicker: $, RowviaRangePicker: F, RowviaNativeInput: ne, RowviaNativeSelect: ie, RowviaNativeTextarea: re, RowviaOption: ce, RowviaRadio: f, RowviaOptgroup: Q, RowviaAutoComplete: X };
301
+ }
302
+ const { RowviaInput: nt, RowviaInputSearch: pe, RowviaTextarea: it, RowviaInputNumber: rt, RowviaPerson: ct, RowviaSelect: ut, RowviaCascader: ot, RowviaRadioGroup: dt, RowviaCheckboxGroup: st, RowviaCheckbox: mt, RowviaSwitch: ft, RowviaDatePicker: yt, RowviaRangePicker: bt, RowviaNativeInput: vt, RowviaNativeSelect: ht, RowviaNativeTextarea: gt, RowviaOption: wt, RowviaRadio: Rt, RowviaOptgroup: St, RowviaAutoComplete: xt } = Xe();
303
+ function le(e, l, n, k, g = {}) {
304
+ if (e) return r(e, { ...g, options: n, modelValue: l, "onUpdate:modelValue": k });
305
+ const w = !!g.multiple, b = { ...g };
306
+ return delete b.type, delete b.size, r("select", {
307
+ ...b,
308
+ value: w ? void 0 : String(n.findIndex((v) => Object.is(v.value, l))),
309
+ onChange: (v) => {
310
+ var C;
311
+ const h = v.target;
312
+ k(w ? [...h.selectedOptions].map((R) => n[Number(R.value)].value) : (C = n[Number(h.value)]) == null ? void 0 : C.value);
313
+ }
314
+ }, [
315
+ !w && !n.some((v) => Object.is(v.value, l)) ? r("option", { value: "-1", disabled: !0 }, String(g.placeholder ?? "请选择")) : null,
316
+ ...n.map((v, h) => r("option", {
317
+ key: h,
318
+ value: String(h),
319
+ disabled: v.disabled,
320
+ selected: w && Array.isArray(l) ? l.includes(v.value) : void 0
321
+ }, v.label))
322
+ ]);
323
+ }
324
+ const kt = q({
325
+ name: "RowviaConditionGroup",
326
+ props: {
327
+ items: { type: Array, required: !0 },
328
+ combinator: { type: String, required: !0 },
329
+ combinators: { type: Array, default: () => [{ value: "and", label: "和" }, { value: "or", label: "或" }] },
330
+ controls: { type: Object, default: () => ({}) },
331
+ depth: { type: Number, default: 0 },
332
+ maxDepth: { type: Number, default: 2 },
333
+ compact: Boolean,
334
+ showHeader: { type: Boolean, default: !0 },
335
+ removable: Boolean,
336
+ canAddCondition: { type: Boolean, default: !0 },
337
+ classes: { type: Object, default: () => ({}) },
338
+ labels: { type: Object, default: () => ({}) }
339
+ },
340
+ emits: {
341
+ "update:combinator": (e) => !0,
342
+ addCondition: () => !0,
343
+ addGroup: () => !0,
344
+ remove: () => !0
345
+ },
346
+ setup(e, { slots: l, emit: n }) {
347
+ return () => {
348
+ var k, g;
349
+ return r("div", { class: "rv-condition-group" }, [
350
+ e.showHeader ? r("div", { class: e.classes.header ?? "rv-condition-group__header", style: { display: "flex", alignItems: "center", gap: "8px" } }, [
351
+ le(
352
+ e.controls.radioGroup ?? e.controls.select,
353
+ e.combinator,
354
+ e.combinators,
355
+ (w) => n("update:combinator", String(w)),
356
+ { type: "button", size: "small", "aria-label": "条件组关系" }
357
+ ),
358
+ (k = l.header) == null ? void 0 : k.call(l),
359
+ e.removable ? r("button", { type: "button", class: e.classes.remove, "data-condition-action": "remove-group", onClick: () => n("remove") }, e.labels.remove ?? "删除组") : null
360
+ ]) : null,
361
+ ...e.items.map((w, b) => {
362
+ var v, h;
363
+ return e.classes.row ? r("div", { key: b, class: e.classes.row }, (v = l.default) == null ? void 0 : v.call(l, { node: w, index: b })) : r(Je, { key: b }, (h = l.default) == null ? void 0 : h.call(l, { node: w, index: b }));
364
+ }),
365
+ !e.items.length && e.labels.empty !== "" ? r("div", { class: e.classes.empty ?? "rv-condition-group__empty" }, e.labels.empty ?? "暂无条件") : null,
366
+ r("div", { class: e.classes.actions ?? "rv-condition-group__actions", style: { display: "flex", alignItems: "center", gap: "4px" } }, [
367
+ r("button", { type: "button", class: e.classes.button, disabled: !e.canAddCondition, "data-condition-action": "add-condition", onClick: () => n("addCondition") }, e.labels.addCondition ?? "添加条件"),
368
+ !e.compact && e.depth < e.maxDepth ? r("button", { type: "button", class: e.classes.button, "data-condition-action": "add-group", onClick: () => n("addGroup") }, e.labels.addGroup ?? "添加子组") : (g = l.limit) == null ? void 0 : g.call(l)
369
+ ])
370
+ ]);
371
+ };
372
+ }
373
+ });
374
+ function _e(e, l, n) {
375
+ const k = Array.isArray(e) ? [...e] : [void 0, void 0];
376
+ return k[l] = n, k;
377
+ }
378
+ const et = q({
379
+ name: "RowviaConditionValue",
380
+ inheritAttrs: !1,
381
+ props: {
382
+ modelValue: null,
383
+ kind: { type: String, default: "text" },
384
+ controls: { type: Object, default: () => ({}) },
385
+ options: { type: Array, default: () => [] },
386
+ multiple: Boolean,
387
+ controlProps: { type: Object, default: () => ({}) }
388
+ },
389
+ emits: { "update:modelValue": (e) => !0 },
390
+ setup(e, { attrs: l, slots: n, emit: k }) {
391
+ const g = (b) => k("update:modelValue", b);
392
+ function w(b, v, h, C) {
393
+ const R = b === "number" ? e.controls.number : b === "date" ? e.controls.date : e.controls.input;
394
+ return R ? r(R, { ...C, modelValue: v, "onUpdate:modelValue": h }) : r("input", { ...C, type: b, value: v ?? "", onInput: (O) => {
395
+ const G = O.target;
396
+ O.isComposing || h(b === "number" ? G.value === "" ? void 0 : G.valueAsNumber : G.value);
397
+ }, onCompositionend: (O) => h(O.target.value) });
398
+ }
399
+ return () => {
400
+ if (n.default) return n.default({ value: e.modelValue, update: g });
401
+ const b = { ...l, ...e.controlProps };
402
+ if (e.kind === "options" || e.kind === "boolean")
403
+ return le(
404
+ e.controls.select,
405
+ e.modelValue,
406
+ e.kind === "boolean" ? [{ value: !0, label: "是" }, { value: !1, label: "否" }] : e.options,
407
+ g,
408
+ { ...b, multiple: e.multiple }
409
+ );
410
+ if (e.kind === "date-range" && e.controls.dateRange)
411
+ return r(e.controls.dateRange, { ...b, modelValue: e.modelValue, "onUpdate:modelValue": g });
412
+ if (e.kind === "number-range" || e.kind === "date-range") {
413
+ const v = Array.isArray(e.modelValue) ? e.modelValue : [], h = e.kind === "number-range" ? "number" : "date";
414
+ return r("div", { ...l, style: [{ display: "flex", alignItems: "center", gap: "8px" }, l.style] }, [
415
+ w(h, v[0], (C) => g(_e(e.modelValue, 0, C)), { ...e.controlProps, placeholder: "最小值", style: { minWidth: 0, flex: 1 } }),
416
+ r("span", "至"),
417
+ w(h, v[1], (C) => g(_e(e.modelValue, 1, C)), { ...e.controlProps, placeholder: "最大值", style: { minWidth: 0, flex: 1 } })
418
+ ]);
419
+ }
420
+ return w(e.kind, e.modelValue, g, b);
421
+ };
422
+ }
423
+ }), At = q({
424
+ name: "RowviaConditionRow",
425
+ props: {
426
+ field: String,
427
+ operator: String,
428
+ value: null,
429
+ fields: { type: Array, default: () => [] },
430
+ operators: { type: Array, default: () => [] },
431
+ controls: { type: Object, default: () => ({}) },
432
+ noValue: Boolean,
433
+ disabled: Boolean,
434
+ valueKind: { type: String, default: "text" },
435
+ classes: { type: Object, default: () => ({}) },
436
+ fieldProps: { type: Object, default: () => ({}) },
437
+ operatorProps: { type: Object, default: () => ({}) }
438
+ },
439
+ emits: {
440
+ "update:field": (e) => !0,
441
+ "update:operator": (e) => !0,
442
+ "update:value": (e) => !0,
443
+ remove: () => !0
444
+ },
445
+ setup(e, { slots: l, emit: n }) {
446
+ return () => {
447
+ var k, g, w, b, v, h, C;
448
+ return r("div", { class: "rv-condition-row", style: { display: "flex", alignItems: "center", gap: "8px" } }, [
449
+ ((k = l.field) == null ? void 0 : k.call(l, { value: e.field, update: (R) => n("update:field", R) })) ?? le(
450
+ e.controls.select,
451
+ e.field,
452
+ e.fields,
453
+ (R) => n("update:field", String(R ?? "")),
454
+ { class: e.classes.field, placeholder: "选择字段", ...e.fieldProps }
455
+ ),
456
+ ((g = l.operator) == null ? void 0 : g.call(l, { value: e.operator, update: (R) => n("update:operator", R) })) ?? le(
457
+ e.controls.select,
458
+ e.operator,
459
+ e.operators,
460
+ (R) => n("update:operator", String(R ?? "")),
461
+ { class: e.classes.operator, placeholder: "运算符", disabled: e.disabled, ...e.operatorProps }
462
+ ),
463
+ e.noValue || (w = e.operators.find((R) => R.value === e.operator)) != null && w.noValue ? (b = l["no-value"]) == null ? void 0 : b.call(l) : ((v = l.value) == null ? void 0 : v.call(l, { value: e.value, update: (R) => n("update:value", R) })) ?? r(et, { class: e.classes.value, kind: e.valueKind, modelValue: e.value, controls: e.controls, "onUpdate:modelValue": (R) => n("update:value", R) }),
464
+ (h = l.after) == null ? void 0 : h.call(l),
465
+ ((C = l.remove) == null ? void 0 : C.call(l, { remove: () => n("remove") })) ?? r("button", {
466
+ type: "button",
467
+ class: e.classes.remove,
468
+ "aria-label": "删除条件",
469
+ "data-condition-action": "remove",
470
+ onClick: () => n("remove")
471
+ }, "×")
472
+ ]);
473
+ };
474
+ }
475
+ }), Ct = q({
476
+ name: "DualPanePicker",
477
+ props: {
478
+ modelValue: { type: Array, required: !0 },
479
+ items: { type: Array, required: !0 },
480
+ disabled: Boolean,
481
+ disabledKeys: { type: Array, default: () => [] },
482
+ checkedKeys: { type: Array, default: () => [] },
483
+ excludedKeys: { type: Array, default: () => [] },
484
+ searchable: { type: Boolean, default: !0 },
485
+ searchPlaceholder: { type: String, default: "搜索" },
486
+ searchAriaLabel: { type: String, default: "" },
487
+ groupLabel: { type: String, default: "" },
488
+ selectAll: { type: Boolean, default: !0 },
489
+ clearable: { type: Boolean, default: !0 },
490
+ totalText: { type: String, default: "总计" },
491
+ selectedText: { type: String, default: "已选择" },
492
+ selectAllText: { type: String, default: "全选" },
493
+ unselectAllText: { type: String, default: "取消全选" },
494
+ clearText: { type: String, default: "清空" },
495
+ removeText: { type: String, default: "移除" },
496
+ disabledHint: { type: String, default: "不可选" },
497
+ emptyText: { type: String, default: "暂无内容" },
498
+ selectedEmptyText: { type: String, default: "暂无数据" },
499
+ height: { type: String, default: "420px" }
500
+ },
501
+ emits: { "update:modelValue": (e) => !0 },
502
+ setup(e, { emit: l, slots: n }) {
503
+ const k = Ee(""), g = H(() => new Map(e.items.map((i) => [i.key, i]))), w = H(() => new Set(e.modelValue)), b = H(() => new Set(e.excludedKeys)), v = H(() => e.modelValue.map((i) => g.value.get(i) ?? { key: i, label: i })), h = H(() => {
504
+ const i = k.value.trim().toLowerCase();
505
+ return e.items.filter((y) => !b.value.has(y.key)).filter((y) => !i || `${y.label} ${y.sublabel ?? ""} ${y.key}`.toLowerCase().includes(i));
506
+ }), C = H(() => h.value.filter($)), R = H(() => C.value.length > 0 && C.value.every((i) => w.value.has(i.key)));
507
+ function O(i) {
508
+ return w.value.has(i) || e.checkedKeys.includes(i);
509
+ }
510
+ function G(i) {
511
+ return !!i.disabled || e.disabledKeys.includes(i.key);
512
+ }
513
+ function $(i) {
514
+ return !e.disabled && !G(i);
515
+ }
516
+ function F(i) {
517
+ l("update:modelValue", [...new Set(i)]);
518
+ }
519
+ function ne(i) {
520
+ $(i) && F(O(i.key) ? e.modelValue.filter((y) => y !== i.key) : [...e.modelValue, i.key]);
521
+ }
522
+ function ie(i) {
523
+ e.disabled || e.disabledKeys.includes(i) || F(e.modelValue.filter((y) => y !== i));
524
+ }
525
+ function re() {
526
+ e.disabled || F(e.modelValue.filter((i) => e.disabledKeys.includes(i)));
527
+ }
528
+ function ce() {
529
+ if (e.disabled) return;
530
+ const i = C.value.map((y) => y.key);
531
+ if (R.value) {
532
+ const y = new Set(i);
533
+ F(e.modelValue.filter((t) => !y.has(t)));
534
+ } else F([...e.modelValue, ...i]);
535
+ }
536
+ const f = (i) => `dual-pane-picker__${i}`, Q = (i) => i.avatarText || i.avatarColor ? r("span", { class: f("avatar"), style: { background: i.avatarColor || "#8f5cf7" } }, (i.avatarText ?? i.label).slice(0, 1)) : null, X = (i) => r("span", { class: f("body") }, [
537
+ r("span", { class: f("name") }, i.label),
538
+ i.sublabel ? r("small", { class: f("sub") }, i.sublabel) : null
539
+ ]), P = (i, y) => r("button", { type: "button", class: f("link"), disabled: e.disabled, onClick: y }, i);
540
+ return () => {
541
+ var i, y, t, T;
542
+ return r("div", { class: ["dual-pane-picker", { "dual-pane-picker--disabled": e.disabled }], style: { height: e.height } }, [
543
+ r("section", { class: [f("pane"), f("pane--left")] }, [
544
+ e.searchable ? r(pe, { modelValue: k.value, "onUpdate:modelValue": (u) => {
545
+ k.value = u;
546
+ }, class: f("search"), placeholder: e.searchPlaceholder, "aria-label": e.searchAriaLabel || e.searchPlaceholder, disabled: e.disabled }) : null,
547
+ r("div", { class: f("head") }, [
548
+ r("span", { class: f("count") }, ((i = n.total) == null ? void 0 : i.call(n, { count: h.value.length })) ?? `${e.totalText}:${h.value.length}`),
549
+ e.selectAll && C.value.length ? P(R.value ? e.unselectAllText : e.selectAllText, ce) : null
550
+ ]),
551
+ r("div", { class: f("list"), role: "listbox", "aria-multiselectable": "true" }, [
552
+ e.groupLabel ? r("p", { class: f("group") }, e.groupLabel) : null,
553
+ ...h.value.map((u) => {
554
+ var V;
555
+ return r("button", {
556
+ key: u.key,
557
+ type: "button",
558
+ role: "option",
559
+ class: [f("item"), { "is-selected": O(u.key) }],
560
+ "aria-selected": O(u.key),
561
+ disabled: !$(u),
562
+ onClick: () => ne(u)
563
+ }, ((V = n.item) == null ? void 0 : V.call(n, { item: u, selected: O(u.key), disabled: !$(u) })) ?? [
564
+ r("span", { class: [f("check"), { "is-checked": O(u.key) }], "aria-hidden": "true" }),
565
+ Q(u),
566
+ X(u),
567
+ G(u) ? r("small", { class: f("tag") }, e.disabledHint) : null
568
+ ]);
569
+ }),
570
+ h.value.length ? null : r("p", { class: f("empty") }, ((y = n.empty) == null ? void 0 : y.call(n, { side: "candidate" })) ?? e.emptyText)
571
+ ])
572
+ ]),
573
+ r("section", { class: [f("pane"), f("pane--right")] }, [
574
+ r("div", { class: f("head") }, [
575
+ r("span", { class: f("count") }, ((t = n["selected-count"]) == null ? void 0 : t.call(n, { count: e.modelValue.length })) ?? `${e.selectedText}:${e.modelValue.length}`),
576
+ e.clearable && e.modelValue.length ? P(e.clearText, re) : null
577
+ ]),
578
+ r("div", { class: f("list") }, [
579
+ ...v.value.map((u) => {
580
+ var V;
581
+ return r("button", {
582
+ key: u.key,
583
+ type: "button",
584
+ class: [f("item"), f("item--selected")],
585
+ "aria-label": `${e.removeText} ${u.label}`,
586
+ disabled: e.disabled || e.disabledKeys.includes(u.key),
587
+ onClick: () => ie(u.key)
588
+ }, ((V = n["selected-item"]) == null ? void 0 : V.call(n, { item: u, disabled: e.disabled || e.disabledKeys.includes(u.key) })) ?? [
589
+ Q(u),
590
+ X(u),
591
+ !e.disabled && !e.disabledKeys.includes(u.key) ? r("span", { class: f("remove"), "aria-hidden": "true" }, "×") : null
592
+ ]);
593
+ }),
594
+ e.modelValue.length ? null : r("p", { class: f("empty") }, ((T = n["selected-empty"]) == null ? void 0 : T.call(n, { side: "selected" })) ?? e.selectedEmptyText)
595
+ ])
596
+ ])
597
+ ]);
598
+ };
599
+ }
600
+ });
601
+ export {
602
+ Ct as DualPanePicker,
603
+ xt as RowviaAutoComplete,
604
+ ot as RowviaCascader,
605
+ mt as RowviaCheckbox,
606
+ st as RowviaCheckboxGroup,
607
+ kt as RowviaConditionGroup,
608
+ At as RowviaConditionRow,
609
+ et as RowviaConditionValue,
610
+ yt as RowviaDatePicker,
611
+ nt as RowviaInput,
612
+ rt as RowviaInputNumber,
613
+ pe as RowviaInputSearch,
614
+ vt as RowviaNativeInput,
615
+ ht as RowviaNativeSelect,
616
+ gt as RowviaNativeTextarea,
617
+ St as RowviaOptgroup,
618
+ wt as RowviaOption,
619
+ ct as RowviaPerson,
620
+ Rt as RowviaRadio,
621
+ dt as RowviaRadioGroup,
622
+ bt as RowviaRangePicker,
623
+ ut as RowviaSelect,
624
+ ft as RowviaSwitch,
625
+ it as RowviaTextarea,
626
+ Xe as createRowviaControls,
627
+ lt as provideRowviaFieldRegistry,
628
+ Le as rowviaFieldRegistryKey,
629
+ _e as updateConditionRange,
630
+ Ze as useRowviaFieldRegistry
631
+ };