@sunny-base-web/ui 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/basic/icon/icon.d.ts +8 -0
- package/dist/basic/icon/icon.d.ts.map +1 -0
- package/dist/basic/icon/index.d.ts +2 -0
- package/dist/basic/icon/index.d.ts.map +1 -0
- package/dist/basic/scrollbar/components/ScrollArea.d.ts +28 -0
- package/dist/basic/scrollbar/components/ScrollArea.d.ts.map +1 -0
- package/dist/basic/scrollbar/components/ScrollBar.d.ts +9 -0
- package/dist/basic/scrollbar/components/ScrollBar.d.ts.map +1 -0
- package/dist/basic/scrollbar/components/index.d.ts +3 -0
- package/dist/basic/scrollbar/components/index.d.ts.map +1 -0
- package/dist/basic/scrollbar/index.d.ts +2 -0
- package/dist/basic/scrollbar/index.d.ts.map +1 -0
- package/dist/basic/scrollbar/scrollbar.d.ts +53 -0
- package/dist/basic/scrollbar/scrollbar.d.ts.map +1 -0
- package/dist/data/edit-grid/api.d.ts +21 -0
- package/dist/data/edit-grid/api.d.ts.map +1 -0
- package/dist/data/edit-grid/index.d.ts +2 -0
- package/dist/data/edit-grid/index.d.ts.map +1 -0
- package/dist/data/edit-grid/use-vxe-grid.d.ts +29 -0
- package/dist/data/edit-grid/use-vxe-grid.d.ts.map +1 -0
- package/dist/data/query-grid/api.d.ts +21 -0
- package/dist/data/query-grid/api.d.ts.map +1 -0
- package/dist/data/query-grid/index.d.ts +2 -0
- package/dist/data/query-grid/index.d.ts.map +1 -0
- package/dist/data/query-grid/renderer/FilterComplex.d.ts +11 -0
- package/dist/data/query-grid/renderer/FilterComplex.d.ts.map +1 -0
- package/dist/data/query-grid/renderer/index.d.ts +2 -0
- package/dist/data/query-grid/renderer/index.d.ts.map +1 -0
- package/dist/data/query-grid/sticky.d.ts +4 -0
- package/dist/data/query-grid/sticky.d.ts.map +1 -0
- package/dist/data/query-grid/use-query-grid.d.ts +29 -0
- package/dist/data/query-grid/use-query-grid.d.ts.map +1 -0
- package/dist/data/upload/index.d.ts +48 -0
- package/dist/data/upload/index.d.ts.map +1 -0
- package/dist/entry/form/SunnyForm.d.ts +30 -0
- package/dist/entry/form/SunnyForm.d.ts.map +1 -0
- package/dist/entry/form/SunnyUseForm.d.ts +29 -0
- package/dist/entry/form/SunnyUseForm.d.ts.map +1 -0
- package/dist/entry/form/components/form-actions.d.ts +55 -0
- package/dist/entry/form/components/form-actions.d.ts.map +1 -0
- package/dist/entry/form/config.d.ts +13 -0
- package/dist/entry/form/config.d.ts.map +1 -0
- package/dist/entry/form/form-api.d.ts +191 -0
- package/dist/entry/form/form-api.d.ts.map +1 -0
- package/dist/entry/form/form-render/Form.d.ts +20 -0
- package/dist/entry/form/form-render/Form.d.ts.map +1 -0
- package/dist/entry/form/form-render/FormField.d.ts +7 -0
- package/dist/entry/form/form-render/FormField.d.ts.map +1 -0
- package/dist/entry/form/form-render/context.d.ts +41 -0
- package/dist/entry/form/form-render/context.d.ts.map +1 -0
- package/dist/entry/form/form-render/dependencies.d.ts +19 -0
- package/dist/entry/form/form-render/dependencies.d.ts.map +1 -0
- package/dist/entry/form/form-render/expandable.d.ts +11 -0
- package/dist/entry/form/form-render/expandable.d.ts.map +1 -0
- package/dist/entry/form/form-render/helper.d.ts +33 -0
- package/dist/entry/form/form-render/helper.d.ts.map +1 -0
- package/dist/entry/form/index.d.ts +7 -0
- package/dist/entry/form/index.d.ts.map +1 -0
- package/dist/entry/form/store.d.ts +46 -0
- package/dist/entry/form/store.d.ts.map +1 -0
- package/dist/entry/form/types.d.ts +337 -0
- package/dist/entry/form/types.d.ts.map +1 -0
- package/dist/entry/form/use-form-context.d.ts +29 -0
- package/dist/entry/form/use-form-context.d.ts.map +1 -0
- package/dist/entry/form/use-sunny-form.d.ts +6 -0
- package/dist/entry/form/use-sunny-form.d.ts.map +1 -0
- package/dist/entry/index.d.ts +4 -0
- package/dist/entry/index.d.ts.map +1 -0
- package/dist/entry/search-input-tag/SearchInputTag.d.ts +32 -0
- package/dist/entry/search-input-tag/SearchInputTag.d.ts.map +1 -0
- package/dist/entry/search-input-tag/index.d.ts +5 -0
- package/dist/entry/search-input-tag/index.d.ts.map +1 -0
- package/dist/entry/search-input-tag/types.d.ts +12 -0
- package/dist/entry/search-input-tag/types.d.ts.map +1 -0
- package/dist/entry/select/BatchSelect.d.ts +28 -0
- package/dist/entry/select/BatchSelect.d.ts.map +1 -0
- package/dist/entry/select/Select.d.ts +37 -0
- package/dist/entry/select/Select.d.ts.map +1 -0
- package/dist/entry/select/index.d.ts +6 -0
- package/dist/entry/select/index.d.ts.map +1 -0
- package/dist/entry/select/types.d.ts +66 -0
- package/dist/entry/select/types.d.ts.map +1 -0
- package/dist/feedback/modal/Modal.d.ts +40 -0
- package/dist/feedback/modal/Modal.d.ts.map +1 -0
- package/dist/feedback/modal/index.d.ts +7 -0
- package/dist/feedback/modal/index.d.ts.map +1 -0
- package/dist/feedback/modal/modal-api.d.ts +9 -0
- package/dist/feedback/modal/modal-api.d.ts.map +1 -0
- package/dist/feedback/modal/types.d.ts +60 -0
- package/dist/feedback/modal/types.d.ts.map +1 -0
- package/dist/feedback/modal/use-sunny-modal.d.ts +3 -0
- package/dist/feedback/modal/use-sunny-modal.d.ts.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +3133 -0
- package/dist/navigation/nprogress/index.d.ts +12 -0
- package/dist/navigation/nprogress/index.d.ts.map +1 -0
- package/dist/ui.css +1 -0
- package/package.json +55 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,3133 @@
|
|
|
1
|
+
import { getCurrentInstance as Tt, inject as Me, defineComponent as O, computed as b, openBlock as w, createElementBlock as R, normalizeStyle as X, normalizeClass as N, createElementVNode as _, useAttrs as ft, ref as M, createBlock as V, unref as p, mergeProps as L, withCtx as $, renderSlot as j, createTextVNode as D, toDisplayString as T, createCommentVNode as z, createVNode as E, withModifiers as Ee, reactive as pt, h as ye, resolveDynamicComponent as mt, normalizeProps as Y, watch as U, withDirectives as qe, vShow as Ye, Fragment as ce, renderList as Z, resolveComponent as W, createSlots as de, guardReactiveProps as fe, isRef as Ke, toRaw as G, provide as ze, useSlots as jt, nextTick as ge, onMounted as Le, onBeforeUnmount as ht, withKeys as vt, isReactive as Mt } from "vue";
|
|
2
|
+
import { Modal as Be, Button as le, Tooltip as zt, Upload as Ae, Checkbox as ve, Progress as Lt, Message as H, Select as Re, Option as Nt, TimePicker as Xe, DatePicker as Ze, Switch as Qe, Radio as Je, TreeSelect as It, Cascader as Dt, Slider as Ut, Rate as Ht, RangePicker as Wt, RadioGroup as Gt, CheckboxGroup as qt, Textarea as Yt, InputNumber as Kt, InputPassword as Xt, Input as Zt } from "@arco-design/web-vue";
|
|
3
|
+
import { IconifyIcon as Qt, IconDefault as Jt, Paperclip as eo, CloudUpload as to, Trash2 as oo } from "@sunny-base-web/icons";
|
|
4
|
+
import { isString as ie, isHttpUrl as no, isObject as q, isFunction as I, cn as Ne, cloneDeep as me, isBoolean as ke, get as et, isEqual as ro, set as so } from "@sunny-base-web/utils";
|
|
5
|
+
import { patterns as Js } from "@sunny-base-web/utils";
|
|
6
|
+
import { ScrollAreaScrollbar as ao, ScrollAreaThumb as lo, ScrollAreaRoot as io, ScrollAreaViewport as co, ScrollAreaCorner as uo } from "reka-ui";
|
|
7
|
+
import xe from "axios";
|
|
8
|
+
import { useStore as fo } from "@tanstack/vue-store";
|
|
9
|
+
import { Store as po } from "@tanstack/store";
|
|
10
|
+
import { useBreakpoints as mo, useDebounceFn as ho } from "@vueuse/core";
|
|
11
|
+
import { useForm as yt, defineRule as vo, useFormValues as gt, Field as yo, useFormContext as go } from "vee-validate";
|
|
12
|
+
import { toTypedSchema as bo } from "@vee-validate/zod";
|
|
13
|
+
import * as Rs from "zod";
|
|
14
|
+
import { VxeGrid as bt, VxeUI as wo } from "vxe-table";
|
|
15
|
+
import { VxeSelect as So, VxeInput as ko, VxeButton as Te, VxePager as xo } from "vxe-pc-ui";
|
|
16
|
+
const Co = /* @__PURE__ */ Symbol("ArcoConfigProvider"), $o = "arco", _o = "$arco", ee = (e) => {
|
|
17
|
+
var t, o, n;
|
|
18
|
+
const r = Tt(), s = Me(Co, void 0);
|
|
19
|
+
return `${(n = (o = s?.prefixCls) != null ? o : (t = r?.appContext.config.globalProperties[_o]) == null ? void 0 : t.classPrefix) != null ? n : $o}-${e}`;
|
|
20
|
+
}, Fo = Object.prototype.toString;
|
|
21
|
+
function te(e) {
|
|
22
|
+
return Fo.call(e) === "[object Number]" && e === e;
|
|
23
|
+
}
|
|
24
|
+
var oe = (e, t) => {
|
|
25
|
+
for (const [o, n] of t)
|
|
26
|
+
e[o] = n;
|
|
27
|
+
return e;
|
|
28
|
+
};
|
|
29
|
+
const Po = O({
|
|
30
|
+
name: "IconClose",
|
|
31
|
+
props: {
|
|
32
|
+
size: {
|
|
33
|
+
type: [Number, String]
|
|
34
|
+
},
|
|
35
|
+
strokeWidth: {
|
|
36
|
+
type: Number,
|
|
37
|
+
default: 4
|
|
38
|
+
},
|
|
39
|
+
strokeLinecap: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: "butt",
|
|
42
|
+
validator: (e) => ["butt", "round", "square"].includes(e)
|
|
43
|
+
},
|
|
44
|
+
strokeLinejoin: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: "miter",
|
|
47
|
+
validator: (e) => ["arcs", "bevel", "miter", "miter-clip", "round"].includes(e)
|
|
48
|
+
},
|
|
49
|
+
rotate: Number,
|
|
50
|
+
spin: Boolean
|
|
51
|
+
},
|
|
52
|
+
emits: {
|
|
53
|
+
click: (e) => !0
|
|
54
|
+
},
|
|
55
|
+
setup(e, { emit: t }) {
|
|
56
|
+
const o = ee("icon"), n = b(() => [o, `${o}-close`, { [`${o}-spin`]: e.spin }]), r = b(() => {
|
|
57
|
+
const a = {};
|
|
58
|
+
return e.size && (a.fontSize = te(e.size) ? `${e.size}px` : e.size), e.rotate && (a.transform = `rotate(${e.rotate}deg)`), a;
|
|
59
|
+
});
|
|
60
|
+
return {
|
|
61
|
+
cls: n,
|
|
62
|
+
innerStyle: r,
|
|
63
|
+
onClick: (a) => {
|
|
64
|
+
t("click", a);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}), Vo = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
|
|
69
|
+
function Oo(e, t, o, n, r, s) {
|
|
70
|
+
return w(), R("svg", {
|
|
71
|
+
viewBox: "0 0 48 48",
|
|
72
|
+
fill: "none",
|
|
73
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
74
|
+
stroke: "currentColor",
|
|
75
|
+
class: N(e.cls),
|
|
76
|
+
style: X(e.innerStyle),
|
|
77
|
+
"stroke-width": e.strokeWidth,
|
|
78
|
+
"stroke-linecap": e.strokeLinecap,
|
|
79
|
+
"stroke-linejoin": e.strokeLinejoin,
|
|
80
|
+
onClick: t[0] || (t[0] = (...a) => e.onClick && e.onClick(...a))
|
|
81
|
+
}, t[1] || (t[1] = [
|
|
82
|
+
_("path", { d: "M9.857 9.858 24 24m0 0 14.142 14.142M24 24 38.142 9.858M24 24 9.857 38.142" }, null, -1)
|
|
83
|
+
]), 14, Vo);
|
|
84
|
+
}
|
|
85
|
+
var Ce = /* @__PURE__ */ oe(Po, [["render", Oo]]);
|
|
86
|
+
const Eo = Object.assign(Ce, {
|
|
87
|
+
install: (e, t) => {
|
|
88
|
+
var o;
|
|
89
|
+
const n = (o = t?.iconPrefix) != null ? o : "";
|
|
90
|
+
e.component(n + Ce.name, Ce);
|
|
91
|
+
}
|
|
92
|
+
}), Bo = O({
|
|
93
|
+
name: "IconQuestionCircle",
|
|
94
|
+
props: {
|
|
95
|
+
size: {
|
|
96
|
+
type: [Number, String]
|
|
97
|
+
},
|
|
98
|
+
strokeWidth: {
|
|
99
|
+
type: Number,
|
|
100
|
+
default: 4
|
|
101
|
+
},
|
|
102
|
+
strokeLinecap: {
|
|
103
|
+
type: String,
|
|
104
|
+
default: "butt",
|
|
105
|
+
validator: (e) => ["butt", "round", "square"].includes(e)
|
|
106
|
+
},
|
|
107
|
+
strokeLinejoin: {
|
|
108
|
+
type: String,
|
|
109
|
+
default: "miter",
|
|
110
|
+
validator: (e) => ["arcs", "bevel", "miter", "miter-clip", "round"].includes(e)
|
|
111
|
+
},
|
|
112
|
+
rotate: Number,
|
|
113
|
+
spin: Boolean
|
|
114
|
+
},
|
|
115
|
+
emits: {
|
|
116
|
+
click: (e) => !0
|
|
117
|
+
},
|
|
118
|
+
setup(e, { emit: t }) {
|
|
119
|
+
const o = ee("icon"), n = b(() => [o, `${o}-question-circle`, { [`${o}-spin`]: e.spin }]), r = b(() => {
|
|
120
|
+
const a = {};
|
|
121
|
+
return e.size && (a.fontSize = te(e.size) ? `${e.size}px` : e.size), e.rotate && (a.transform = `rotate(${e.rotate}deg)`), a;
|
|
122
|
+
});
|
|
123
|
+
return {
|
|
124
|
+
cls: n,
|
|
125
|
+
innerStyle: r,
|
|
126
|
+
onClick: (a) => {
|
|
127
|
+
t("click", a);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
}), Ao = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
|
|
132
|
+
function Ro(e, t, o, n, r, s) {
|
|
133
|
+
return w(), R("svg", {
|
|
134
|
+
viewBox: "0 0 48 48",
|
|
135
|
+
fill: "none",
|
|
136
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
137
|
+
stroke: "currentColor",
|
|
138
|
+
class: N(e.cls),
|
|
139
|
+
style: X(e.innerStyle),
|
|
140
|
+
"stroke-width": e.strokeWidth,
|
|
141
|
+
"stroke-linecap": e.strokeLinecap,
|
|
142
|
+
"stroke-linejoin": e.strokeLinejoin,
|
|
143
|
+
onClick: t[0] || (t[0] = (...a) => e.onClick && e.onClick(...a))
|
|
144
|
+
}, t[1] || (t[1] = [
|
|
145
|
+
_("path", { d: "M42 24c0 9.941-8.059 18-18 18S6 33.941 6 24 14.059 6 24 6s18 8.059 18 18Z" }, null, -1),
|
|
146
|
+
_("path", { d: "M24.006 31v4.008m0-6.008L24 28c0-3 3-4 4.78-6.402C30.558 19.195 28.288 15 23.987 15c-4.014 0-5.382 2.548-5.388 4.514v.465" }, null, -1)
|
|
147
|
+
]), 14, Ao);
|
|
148
|
+
}
|
|
149
|
+
var $e = /* @__PURE__ */ oe(Bo, [["render", Ro]]);
|
|
150
|
+
const wt = Object.assign($e, {
|
|
151
|
+
install: (e, t) => {
|
|
152
|
+
var o;
|
|
153
|
+
const n = (o = t?.iconPrefix) != null ? o : "";
|
|
154
|
+
e.component(n + $e.name, $e);
|
|
155
|
+
}
|
|
156
|
+
}), To = O({
|
|
157
|
+
name: "IconSearch",
|
|
158
|
+
props: {
|
|
159
|
+
size: {
|
|
160
|
+
type: [Number, String]
|
|
161
|
+
},
|
|
162
|
+
strokeWidth: {
|
|
163
|
+
type: Number,
|
|
164
|
+
default: 4
|
|
165
|
+
},
|
|
166
|
+
strokeLinecap: {
|
|
167
|
+
type: String,
|
|
168
|
+
default: "butt",
|
|
169
|
+
validator: (e) => ["butt", "round", "square"].includes(e)
|
|
170
|
+
},
|
|
171
|
+
strokeLinejoin: {
|
|
172
|
+
type: String,
|
|
173
|
+
default: "miter",
|
|
174
|
+
validator: (e) => ["arcs", "bevel", "miter", "miter-clip", "round"].includes(e)
|
|
175
|
+
},
|
|
176
|
+
rotate: Number,
|
|
177
|
+
spin: Boolean
|
|
178
|
+
},
|
|
179
|
+
emits: {
|
|
180
|
+
click: (e) => !0
|
|
181
|
+
},
|
|
182
|
+
setup(e, { emit: t }) {
|
|
183
|
+
const o = ee("icon"), n = b(() => [o, `${o}-search`, { [`${o}-spin`]: e.spin }]), r = b(() => {
|
|
184
|
+
const a = {};
|
|
185
|
+
return e.size && (a.fontSize = te(e.size) ? `${e.size}px` : e.size), e.rotate && (a.transform = `rotate(${e.rotate}deg)`), a;
|
|
186
|
+
});
|
|
187
|
+
return {
|
|
188
|
+
cls: n,
|
|
189
|
+
innerStyle: r,
|
|
190
|
+
onClick: (a) => {
|
|
191
|
+
t("click", a);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}), jo = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
|
|
196
|
+
function Mo(e, t, o, n, r, s) {
|
|
197
|
+
return w(), R("svg", {
|
|
198
|
+
viewBox: "0 0 48 48",
|
|
199
|
+
fill: "none",
|
|
200
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
201
|
+
stroke: "currentColor",
|
|
202
|
+
class: N(e.cls),
|
|
203
|
+
style: X(e.innerStyle),
|
|
204
|
+
"stroke-width": e.strokeWidth,
|
|
205
|
+
"stroke-linecap": e.strokeLinecap,
|
|
206
|
+
"stroke-linejoin": e.strokeLinejoin,
|
|
207
|
+
onClick: t[0] || (t[0] = (...a) => e.onClick && e.onClick(...a))
|
|
208
|
+
}, t[1] || (t[1] = [
|
|
209
|
+
_("path", { d: "M33.072 33.071c6.248-6.248 6.248-16.379 0-22.627-6.249-6.249-16.38-6.249-22.628 0-6.248 6.248-6.248 16.379 0 22.627 6.248 6.248 16.38 6.248 22.628 0Zm0 0 8.485 8.485" }, null, -1)
|
|
210
|
+
]), 14, jo);
|
|
211
|
+
}
|
|
212
|
+
var _e = /* @__PURE__ */ oe(To, [["render", Mo]]);
|
|
213
|
+
const zo = Object.assign(_e, {
|
|
214
|
+
install: (e, t) => {
|
|
215
|
+
var o;
|
|
216
|
+
const n = (o = t?.iconPrefix) != null ? o : "";
|
|
217
|
+
e.component(n + _e.name, _e);
|
|
218
|
+
}
|
|
219
|
+
}), Lo = O({
|
|
220
|
+
name: "IconDelete",
|
|
221
|
+
props: {
|
|
222
|
+
size: {
|
|
223
|
+
type: [Number, String]
|
|
224
|
+
},
|
|
225
|
+
strokeWidth: {
|
|
226
|
+
type: Number,
|
|
227
|
+
default: 4
|
|
228
|
+
},
|
|
229
|
+
strokeLinecap: {
|
|
230
|
+
type: String,
|
|
231
|
+
default: "butt",
|
|
232
|
+
validator: (e) => ["butt", "round", "square"].includes(e)
|
|
233
|
+
},
|
|
234
|
+
strokeLinejoin: {
|
|
235
|
+
type: String,
|
|
236
|
+
default: "miter",
|
|
237
|
+
validator: (e) => ["arcs", "bevel", "miter", "miter-clip", "round"].includes(e)
|
|
238
|
+
},
|
|
239
|
+
rotate: Number,
|
|
240
|
+
spin: Boolean
|
|
241
|
+
},
|
|
242
|
+
emits: {
|
|
243
|
+
click: (e) => !0
|
|
244
|
+
},
|
|
245
|
+
setup(e, { emit: t }) {
|
|
246
|
+
const o = ee("icon"), n = b(() => [o, `${o}-delete`, { [`${o}-spin`]: e.spin }]), r = b(() => {
|
|
247
|
+
const a = {};
|
|
248
|
+
return e.size && (a.fontSize = te(e.size) ? `${e.size}px` : e.size), e.rotate && (a.transform = `rotate(${e.rotate}deg)`), a;
|
|
249
|
+
});
|
|
250
|
+
return {
|
|
251
|
+
cls: n,
|
|
252
|
+
innerStyle: r,
|
|
253
|
+
onClick: (a) => {
|
|
254
|
+
t("click", a);
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
}), No = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
|
|
259
|
+
function Io(e, t, o, n, r, s) {
|
|
260
|
+
return w(), R("svg", {
|
|
261
|
+
viewBox: "0 0 48 48",
|
|
262
|
+
fill: "none",
|
|
263
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
264
|
+
stroke: "currentColor",
|
|
265
|
+
class: N(e.cls),
|
|
266
|
+
style: X(e.innerStyle),
|
|
267
|
+
"stroke-width": e.strokeWidth,
|
|
268
|
+
"stroke-linecap": e.strokeLinecap,
|
|
269
|
+
"stroke-linejoin": e.strokeLinejoin,
|
|
270
|
+
onClick: t[0] || (t[0] = (...a) => e.onClick && e.onClick(...a))
|
|
271
|
+
}, t[1] || (t[1] = [
|
|
272
|
+
_("path", { d: "M5 11h5.5m0 0v29a1 1 0 0 0 1 1h25a1 1 0 0 0 1-1V11m-27 0H16m21.5 0H43m-5.5 0H32m-16 0V7h16v4m-16 0h16M20 18v15m8-15v15" }, null, -1)
|
|
273
|
+
]), 14, No);
|
|
274
|
+
}
|
|
275
|
+
var Fe = /* @__PURE__ */ oe(Lo, [["render", Io]]);
|
|
276
|
+
const Do = Object.assign(Fe, {
|
|
277
|
+
install: (e, t) => {
|
|
278
|
+
var o;
|
|
279
|
+
const n = (o = t?.iconPrefix) != null ? o : "";
|
|
280
|
+
e.component(n + Fe.name, Fe);
|
|
281
|
+
}
|
|
282
|
+
}), Uo = O({
|
|
283
|
+
name: "IconFullscreenExit",
|
|
284
|
+
props: {
|
|
285
|
+
size: {
|
|
286
|
+
type: [Number, String]
|
|
287
|
+
},
|
|
288
|
+
strokeWidth: {
|
|
289
|
+
type: Number,
|
|
290
|
+
default: 4
|
|
291
|
+
},
|
|
292
|
+
strokeLinecap: {
|
|
293
|
+
type: String,
|
|
294
|
+
default: "butt",
|
|
295
|
+
validator: (e) => ["butt", "round", "square"].includes(e)
|
|
296
|
+
},
|
|
297
|
+
strokeLinejoin: {
|
|
298
|
+
type: String,
|
|
299
|
+
default: "miter",
|
|
300
|
+
validator: (e) => ["arcs", "bevel", "miter", "miter-clip", "round"].includes(e)
|
|
301
|
+
},
|
|
302
|
+
rotate: Number,
|
|
303
|
+
spin: Boolean
|
|
304
|
+
},
|
|
305
|
+
emits: {
|
|
306
|
+
click: (e) => !0
|
|
307
|
+
},
|
|
308
|
+
setup(e, { emit: t }) {
|
|
309
|
+
const o = ee("icon"), n = b(() => [o, `${o}-fullscreen-exit`, { [`${o}-spin`]: e.spin }]), r = b(() => {
|
|
310
|
+
const a = {};
|
|
311
|
+
return e.size && (a.fontSize = te(e.size) ? `${e.size}px` : e.size), e.rotate && (a.transform = `rotate(${e.rotate}deg)`), a;
|
|
312
|
+
});
|
|
313
|
+
return {
|
|
314
|
+
cls: n,
|
|
315
|
+
innerStyle: r,
|
|
316
|
+
onClick: (a) => {
|
|
317
|
+
t("click", a);
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
}), Ho = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
|
|
322
|
+
function Wo(e, t, o, n, r, s) {
|
|
323
|
+
return w(), R("svg", {
|
|
324
|
+
viewBox: "0 0 48 48",
|
|
325
|
+
fill: "none",
|
|
326
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
327
|
+
stroke: "currentColor",
|
|
328
|
+
class: N(e.cls),
|
|
329
|
+
style: X(e.innerStyle),
|
|
330
|
+
"stroke-width": e.strokeWidth,
|
|
331
|
+
"stroke-linecap": e.strokeLinecap,
|
|
332
|
+
"stroke-linejoin": e.strokeLinejoin,
|
|
333
|
+
onClick: t[0] || (t[0] = (...a) => e.onClick && e.onClick(...a))
|
|
334
|
+
}, t[1] || (t[1] = [
|
|
335
|
+
_("path", { d: "M35 6v8a1 1 0 0 0 1 1h8M13 6v8a1 1 0 0 1-1 1H4m31 27v-8a1 1 0 0 1 1-1h8m-31 9v-8a1 1 0 0 0-1-1H4" }, null, -1)
|
|
336
|
+
]), 14, Ho);
|
|
337
|
+
}
|
|
338
|
+
var Pe = /* @__PURE__ */ oe(Uo, [["render", Wo]]);
|
|
339
|
+
const Go = Object.assign(Pe, {
|
|
340
|
+
install: (e, t) => {
|
|
341
|
+
var o;
|
|
342
|
+
const n = (o = t?.iconPrefix) != null ? o : "";
|
|
343
|
+
e.component(n + Pe.name, Pe);
|
|
344
|
+
}
|
|
345
|
+
}), qo = O({
|
|
346
|
+
name: "IconFullscreen",
|
|
347
|
+
props: {
|
|
348
|
+
size: {
|
|
349
|
+
type: [Number, String]
|
|
350
|
+
},
|
|
351
|
+
strokeWidth: {
|
|
352
|
+
type: Number,
|
|
353
|
+
default: 4
|
|
354
|
+
},
|
|
355
|
+
strokeLinecap: {
|
|
356
|
+
type: String,
|
|
357
|
+
default: "butt",
|
|
358
|
+
validator: (e) => ["butt", "round", "square"].includes(e)
|
|
359
|
+
},
|
|
360
|
+
strokeLinejoin: {
|
|
361
|
+
type: String,
|
|
362
|
+
default: "miter",
|
|
363
|
+
validator: (e) => ["arcs", "bevel", "miter", "miter-clip", "round"].includes(e)
|
|
364
|
+
},
|
|
365
|
+
rotate: Number,
|
|
366
|
+
spin: Boolean
|
|
367
|
+
},
|
|
368
|
+
emits: {
|
|
369
|
+
click: (e) => !0
|
|
370
|
+
},
|
|
371
|
+
setup(e, { emit: t }) {
|
|
372
|
+
const o = ee("icon"), n = b(() => [o, `${o}-fullscreen`, { [`${o}-spin`]: e.spin }]), r = b(() => {
|
|
373
|
+
const a = {};
|
|
374
|
+
return e.size && (a.fontSize = te(e.size) ? `${e.size}px` : e.size), e.rotate && (a.transform = `rotate(${e.rotate}deg)`), a;
|
|
375
|
+
});
|
|
376
|
+
return {
|
|
377
|
+
cls: n,
|
|
378
|
+
innerStyle: r,
|
|
379
|
+
onClick: (a) => {
|
|
380
|
+
t("click", a);
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
}), Yo = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
|
|
385
|
+
function Ko(e, t, o, n, r, s) {
|
|
386
|
+
return w(), R("svg", {
|
|
387
|
+
viewBox: "0 0 48 48",
|
|
388
|
+
fill: "none",
|
|
389
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
390
|
+
stroke: "currentColor",
|
|
391
|
+
class: N(e.cls),
|
|
392
|
+
style: X(e.innerStyle),
|
|
393
|
+
"stroke-width": e.strokeWidth,
|
|
394
|
+
"stroke-linecap": e.strokeLinecap,
|
|
395
|
+
"stroke-linejoin": e.strokeLinejoin,
|
|
396
|
+
onClick: t[0] || (t[0] = (...a) => e.onClick && e.onClick(...a))
|
|
397
|
+
}, t[1] || (t[1] = [
|
|
398
|
+
_("path", { d: "M42 17V9a1 1 0 0 0-1-1h-8M6 17V9a1 1 0 0 1 1-1h8m27 23v8a1 1 0 0 1-1 1h-8M6 31v8a1 1 0 0 0 1 1h8" }, null, -1)
|
|
399
|
+
]), 14, Yo);
|
|
400
|
+
}
|
|
401
|
+
var Ve = /* @__PURE__ */ oe(qo, [["render", Ko]]);
|
|
402
|
+
const Xo = Object.assign(Ve, {
|
|
403
|
+
install: (e, t) => {
|
|
404
|
+
var o;
|
|
405
|
+
const n = (o = t?.iconPrefix) != null ? o : "";
|
|
406
|
+
e.component(n + Ve.name, Ve);
|
|
407
|
+
}
|
|
408
|
+
}), Zo = { class: "flex-1 font-semibold text-base text-[var(--color-text-1)] overflow-hidden text-ellipsis whitespace-nowrap" }, Qo = { class: "flex items-center gap-3 ml-3" }, Jo = { class: "cursor-pointer text-[var(--color-text-2)] flex items-center justify-center transition-colors duration-200 text-base hover:text-[var(--color-text-1)]" }, en = {
|
|
409
|
+
key: 1,
|
|
410
|
+
class: "flex items-center justify-end gap-2"
|
|
411
|
+
}, tn = /* @__PURE__ */ O({
|
|
412
|
+
__name: "Modal",
|
|
413
|
+
props: {
|
|
414
|
+
modelValue: { type: Boolean, default: !1 },
|
|
415
|
+
title: { default: "Title" },
|
|
416
|
+
width: { default: "50%" },
|
|
417
|
+
top: {},
|
|
418
|
+
zIndex: { default: 1e3 },
|
|
419
|
+
helpMessage: { default: "双击标题栏可最大化/还原,按 ESC 可关闭弹窗" },
|
|
420
|
+
closeOnEsc: { type: Boolean, default: !0 },
|
|
421
|
+
closeOnClickModal: { type: Boolean, default: !0 },
|
|
422
|
+
okText: {},
|
|
423
|
+
cancelText: {},
|
|
424
|
+
okLoading: { type: Boolean },
|
|
425
|
+
confirmLoading: { type: Boolean },
|
|
426
|
+
hideCancel: { type: Boolean },
|
|
427
|
+
okButtonProps: {},
|
|
428
|
+
cancelButtonProps: {},
|
|
429
|
+
onVisibleChange: {},
|
|
430
|
+
onBeforeOk: {},
|
|
431
|
+
onBeforeCancel: {},
|
|
432
|
+
onClose: {},
|
|
433
|
+
onOk: {}
|
|
434
|
+
},
|
|
435
|
+
emits: ["update:modelValue", "close", "ok"],
|
|
436
|
+
setup(e, { emit: t }) {
|
|
437
|
+
const o = e, n = t, r = ft(), s = M(!1), a = b({
|
|
438
|
+
get: () => o.modelValue,
|
|
439
|
+
set: (u) => n("update:modelValue", u)
|
|
440
|
+
}), l = M(!1), m = () => {
|
|
441
|
+
l.value = !l.value;
|
|
442
|
+
}, y = async () => {
|
|
443
|
+
const u = o.onBeforeCancel;
|
|
444
|
+
typeof u == "function" && await u() === !1 || (a.value = !1, n("close"));
|
|
445
|
+
}, v = y, i = async () => {
|
|
446
|
+
const u = o.onBeforeOk;
|
|
447
|
+
if (typeof u == "function")
|
|
448
|
+
try {
|
|
449
|
+
s.value = !0, await u() !== !1 && (n("ok"), a.value = !1);
|
|
450
|
+
} catch (c) {
|
|
451
|
+
console.error(c);
|
|
452
|
+
} finally {
|
|
453
|
+
s.value = !1;
|
|
454
|
+
}
|
|
455
|
+
else
|
|
456
|
+
n("ok"), a.value = !1;
|
|
457
|
+
};
|
|
458
|
+
return (u, c) => (w(), V(p(Be), L({
|
|
459
|
+
visible: a.value,
|
|
460
|
+
"onUpdate:visible": c[0] || (c[0] = (h) => a.value = h),
|
|
461
|
+
title: e.title,
|
|
462
|
+
width: e.width,
|
|
463
|
+
top: e.top,
|
|
464
|
+
"z-index": e.zIndex,
|
|
465
|
+
"mask-closable": e.closeOnClickModal,
|
|
466
|
+
"esc-to-close": e.closeOnEsc,
|
|
467
|
+
fullscreen: l.value,
|
|
468
|
+
closable: !1
|
|
469
|
+
}, u.$attrs, { class: "k-modal-custom" }), {
|
|
470
|
+
title: $(() => [
|
|
471
|
+
_("div", {
|
|
472
|
+
class: "flex items-center justify-between w-full",
|
|
473
|
+
onDblclick: m
|
|
474
|
+
}, [
|
|
475
|
+
_("div", Zo, [
|
|
476
|
+
j(u.$slots, "title", {}, () => [
|
|
477
|
+
D(T(e.title), 1)
|
|
478
|
+
])
|
|
479
|
+
]),
|
|
480
|
+
_("div", Qo, [
|
|
481
|
+
e.helpMessage ? (w(), V(p(zt), {
|
|
482
|
+
key: 0,
|
|
483
|
+
content: e.helpMessage
|
|
484
|
+
}, {
|
|
485
|
+
default: $(() => [
|
|
486
|
+
_("div", Jo, [
|
|
487
|
+
E(p(wt))
|
|
488
|
+
])
|
|
489
|
+
]),
|
|
490
|
+
_: 1
|
|
491
|
+
}, 8, ["content"])) : z("", !0),
|
|
492
|
+
_("div", {
|
|
493
|
+
class: "cursor-pointer text-[var(--color-text-2)] flex items-center justify-center transition-colors duration-200 text-base hover:text-[var(--color-text-1)]",
|
|
494
|
+
onClick: Ee(m, ["stop"])
|
|
495
|
+
}, [
|
|
496
|
+
l.value ? (w(), V(p(Go), { key: 0 })) : (w(), V(p(Xo), { key: 1 }))
|
|
497
|
+
]),
|
|
498
|
+
_("div", {
|
|
499
|
+
class: "cursor-pointer text-[var(--color-text-2)] flex items-center justify-center transition-colors duration-200 text-base hover:text-[rgb(var(--red-6))]",
|
|
500
|
+
onClick: Ee(y, ["stop"])
|
|
501
|
+
}, [
|
|
502
|
+
E(p(Eo))
|
|
503
|
+
])
|
|
504
|
+
])
|
|
505
|
+
], 32)
|
|
506
|
+
]),
|
|
507
|
+
footer: $(() => [
|
|
508
|
+
u.$slots.footer ? j(u.$slots, "footer", { key: 0 }) : (w(), R("div", en, [
|
|
509
|
+
j(u.$slots, "insertFooter"),
|
|
510
|
+
p(r).hideCancel ? z("", !0) : (w(), V(p(le), L({ key: 0 }, p(r).cancelButtonProps, { onClick: p(v) }), {
|
|
511
|
+
default: $(() => [
|
|
512
|
+
D(T(p(r).cancelText || "取消"), 1)
|
|
513
|
+
]),
|
|
514
|
+
_: 1
|
|
515
|
+
}, 16, ["onClick"])),
|
|
516
|
+
j(u.$slots, "centerFooter"),
|
|
517
|
+
E(p(le), L({
|
|
518
|
+
type: "primary",
|
|
519
|
+
loading: s.value || p(r).okLoading || p(r).confirmLoading
|
|
520
|
+
}, p(r).okButtonProps, { onClick: i }), {
|
|
521
|
+
default: $(() => [
|
|
522
|
+
D(T(p(r).okText || "确定"), 1)
|
|
523
|
+
]),
|
|
524
|
+
_: 1
|
|
525
|
+
}, 16, ["loading"]),
|
|
526
|
+
j(u.$slots, "appendFooter")
|
|
527
|
+
]))
|
|
528
|
+
]),
|
|
529
|
+
default: $(() => [
|
|
530
|
+
j(u.$slots, "default")
|
|
531
|
+
]),
|
|
532
|
+
_: 3
|
|
533
|
+
}, 16, ["visible", "title", "width", "top", "z-index", "mask-closable", "esc-to-close", "fullscreen"]));
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
class on {
|
|
537
|
+
state;
|
|
538
|
+
constructor(t = {}) {
|
|
539
|
+
this.state = pt({
|
|
540
|
+
modelValue: !1,
|
|
541
|
+
...t
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
open = () => {
|
|
545
|
+
this.setState({ modelValue: !0 }), this.state.onVisibleChange?.(!0);
|
|
546
|
+
};
|
|
547
|
+
close = () => {
|
|
548
|
+
this.setState({ modelValue: !1 }), this.state.onVisibleChange?.(!1);
|
|
549
|
+
};
|
|
550
|
+
setState(t) {
|
|
551
|
+
if (typeof t == "function") {
|
|
552
|
+
const o = t(this.state);
|
|
553
|
+
Object.assign(this.state, o);
|
|
554
|
+
} else
|
|
555
|
+
Object.assign(this.state, t);
|
|
556
|
+
return this;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
function Ms(e = {}) {
|
|
560
|
+
const t = new on(e);
|
|
561
|
+
return [O({
|
|
562
|
+
name: "SunnyConnectedModal",
|
|
563
|
+
inheritAttrs: !1,
|
|
564
|
+
setup(n, { attrs: r, slots: s }) {
|
|
565
|
+
return () => ye(
|
|
566
|
+
tn,
|
|
567
|
+
{
|
|
568
|
+
...t.state,
|
|
569
|
+
...r,
|
|
570
|
+
"onUpdate:modelValue": (a) => {
|
|
571
|
+
t.setState({ modelValue: a }), t.state.onVisibleChange?.(a), typeof r["onUpdate:modelValue"] == "function" && r["onUpdate:modelValue"](a);
|
|
572
|
+
}
|
|
573
|
+
},
|
|
574
|
+
s
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
}), t];
|
|
578
|
+
}
|
|
579
|
+
const zs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
580
|
+
__proto__: null
|
|
581
|
+
}, Symbol.toStringTag, { value: "Module" })), nn = ["src"], tt = /* @__PURE__ */ O({
|
|
582
|
+
__name: "icon",
|
|
583
|
+
props: {
|
|
584
|
+
fallback: { type: Boolean },
|
|
585
|
+
icon: { type: [Function, String] }
|
|
586
|
+
},
|
|
587
|
+
setup(e) {
|
|
588
|
+
const t = e, o = b(() => ie(t.icon) && no(t.icon)), n = b(() => {
|
|
589
|
+
const { icon: r } = t;
|
|
590
|
+
return !ie(r) && (q(r) || I(r));
|
|
591
|
+
});
|
|
592
|
+
return (r, s) => n.value ? (w(), V(mt(e.icon), Y(L({ key: 0 }, r.$attrs)), null, 16)) : o.value ? (w(), R("img", L({
|
|
593
|
+
key: 1,
|
|
594
|
+
src: e.icon
|
|
595
|
+
}, r.$attrs), null, 16, nn)) : e.icon ? (w(), V(p(Qt), L({ key: 2 }, r.$attrs, {
|
|
596
|
+
icon: e.icon
|
|
597
|
+
}), null, 16, ["icon"])) : e.fallback ? (w(), V(p(Jt), Y(L({ key: 3 }, r.$attrs)), null, 16)) : z("", !0);
|
|
598
|
+
}
|
|
599
|
+
}), St = /* @__PURE__ */ O({
|
|
600
|
+
__name: "ScrollBar",
|
|
601
|
+
props: {
|
|
602
|
+
orientation: { default: "vertical" },
|
|
603
|
+
forceMount: { type: Boolean },
|
|
604
|
+
asChild: { type: Boolean },
|
|
605
|
+
as: {},
|
|
606
|
+
class: {}
|
|
607
|
+
},
|
|
608
|
+
setup(e) {
|
|
609
|
+
const t = e, o = b(() => {
|
|
610
|
+
const { class: n, ...r } = t;
|
|
611
|
+
return r;
|
|
612
|
+
});
|
|
613
|
+
return (n, r) => (w(), V(p(ao), L(o.value, {
|
|
614
|
+
class: p(Ne)(
|
|
615
|
+
"flex touch-none select-none transition-colors",
|
|
616
|
+
e.orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-px",
|
|
617
|
+
e.orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-px",
|
|
618
|
+
t.class
|
|
619
|
+
)
|
|
620
|
+
}), {
|
|
621
|
+
default: $(() => [
|
|
622
|
+
E(p(lo), { class: "relative flex-1 rounded-full bg-border" })
|
|
623
|
+
]),
|
|
624
|
+
_: 1
|
|
625
|
+
}, 16, ["class"]));
|
|
626
|
+
}
|
|
627
|
+
}), rn = /* @__PURE__ */ O({
|
|
628
|
+
__name: "ScrollArea",
|
|
629
|
+
props: {
|
|
630
|
+
type: {},
|
|
631
|
+
dir: {},
|
|
632
|
+
scrollHideDelay: {},
|
|
633
|
+
asChild: { type: Boolean },
|
|
634
|
+
as: {},
|
|
635
|
+
class: {},
|
|
636
|
+
onScroll: { type: Function, default: () => {
|
|
637
|
+
} },
|
|
638
|
+
viewportProps: {}
|
|
639
|
+
},
|
|
640
|
+
setup(e) {
|
|
641
|
+
const t = e, o = b(() => {
|
|
642
|
+
const { class: n, ...r } = t;
|
|
643
|
+
return r;
|
|
644
|
+
});
|
|
645
|
+
return (n, r) => (w(), V(p(io), L(o.value, {
|
|
646
|
+
class: p(Ne)("relative overflow-hidden", t.class)
|
|
647
|
+
}), {
|
|
648
|
+
default: $(() => [
|
|
649
|
+
E(p(co), {
|
|
650
|
+
"as-child": "",
|
|
651
|
+
class: "h-full w-full rounded-[inherit] focus:outline-none",
|
|
652
|
+
onScroll: e.onScroll
|
|
653
|
+
}, {
|
|
654
|
+
default: $(() => [
|
|
655
|
+
j(n.$slots, "default")
|
|
656
|
+
]),
|
|
657
|
+
_: 3
|
|
658
|
+
}, 8, ["onScroll"]),
|
|
659
|
+
E(St),
|
|
660
|
+
E(p(uo))
|
|
661
|
+
]),
|
|
662
|
+
_: 3
|
|
663
|
+
}, 16, ["class"]));
|
|
664
|
+
}
|
|
665
|
+
}), ot = 1, sn = /* @__PURE__ */ O({
|
|
666
|
+
__name: "scrollbar",
|
|
667
|
+
props: {
|
|
668
|
+
class: { default: "" },
|
|
669
|
+
horizontal: { type: Boolean, default: !1 },
|
|
670
|
+
scrollBarClass: {},
|
|
671
|
+
shadow: { type: Boolean, default: !1 },
|
|
672
|
+
shadowBorder: { type: Boolean, default: !1 },
|
|
673
|
+
shadowBottom: { type: Boolean, default: !0 },
|
|
674
|
+
shadowLeft: { type: Boolean, default: !1 },
|
|
675
|
+
shadowRight: { type: Boolean, default: !1 },
|
|
676
|
+
shadowTop: { type: Boolean, default: !0 }
|
|
677
|
+
},
|
|
678
|
+
emits: ["scrollAt"],
|
|
679
|
+
setup(e, { emit: t }) {
|
|
680
|
+
const o = e, n = t, r = M(!0), s = M(!1), a = M(!1), l = M(!0), m = b(() => o.shadow && o.shadowTop), y = b(() => o.shadow && o.shadowBottom), v = b(() => o.shadow && o.shadowLeft), i = b(() => o.shadow && o.shadowRight), u = b(() => ({
|
|
681
|
+
"both-shadow": !l.value && !s.value && v.value && i.value,
|
|
682
|
+
"left-shadow": !l.value && v.value,
|
|
683
|
+
"right-shadow": !s.value && i.value
|
|
684
|
+
}));
|
|
685
|
+
function c(h) {
|
|
686
|
+
const g = h.target, S = g?.scrollTop ?? 0, F = g?.scrollLeft ?? 0, C = g?.clientHeight ?? 0, x = g?.clientWidth ?? 0, B = g?.scrollHeight ?? 0, d = g?.scrollWidth ?? 0;
|
|
687
|
+
r.value = S <= 0, l.value = F <= 0, a.value = Math.abs(S) + C >= B - ot, s.value = Math.abs(F) + x >= d - ot, n("scrollAt", {
|
|
688
|
+
bottom: a.value,
|
|
689
|
+
left: l.value,
|
|
690
|
+
right: s.value,
|
|
691
|
+
top: r.value
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
return (h, g) => (w(), V(p(rn), {
|
|
695
|
+
class: N([[p(Ne)(o.class), u.value], "sunny-scrollbar relative"]),
|
|
696
|
+
"on-scroll": c
|
|
697
|
+
}, {
|
|
698
|
+
default: $(() => [
|
|
699
|
+
m.value ? (w(), R("div", {
|
|
700
|
+
key: 0,
|
|
701
|
+
class: N([{
|
|
702
|
+
"opacity-100": !r.value,
|
|
703
|
+
"border-t border-border": e.shadowBorder && !r.value
|
|
704
|
+
}, "scrollbar-top-shadow pointer-events-none absolute top-0 z-10 h-12 w-full opacity-0 transition-opacity duration-300 ease-in-out will-change-[opacity]"])
|
|
705
|
+
}, null, 2)) : z("", !0),
|
|
706
|
+
j(h.$slots, "default", {}, void 0, !0),
|
|
707
|
+
y.value ? (w(), R("div", {
|
|
708
|
+
key: 1,
|
|
709
|
+
class: N([{
|
|
710
|
+
"opacity-100": !r.value && !a.value,
|
|
711
|
+
"border-b border-border": e.shadowBorder && !r.value && !a.value
|
|
712
|
+
}, "scrollbar-bottom-shadow pointer-events-none absolute bottom-0 z-10 h-12 w-full opacity-0 transition-opacity duration-300 ease-in-out will-change-[opacity]"])
|
|
713
|
+
}, null, 2)) : z("", !0),
|
|
714
|
+
e.horizontal ? (w(), V(p(St), {
|
|
715
|
+
key: 2,
|
|
716
|
+
class: N(e.scrollBarClass),
|
|
717
|
+
orientation: "horizontal"
|
|
718
|
+
}, null, 8, ["class"])) : z("", !0)
|
|
719
|
+
]),
|
|
720
|
+
_: 3
|
|
721
|
+
}, 8, ["class"]));
|
|
722
|
+
}
|
|
723
|
+
}), kt = (e, t) => {
|
|
724
|
+
const o = e.__vccOpts || e;
|
|
725
|
+
for (const [n, r] of t)
|
|
726
|
+
o[n] = r;
|
|
727
|
+
return o;
|
|
728
|
+
}, Ls = /* @__PURE__ */ kt(sn, [["__scopeId", "data-v-913bc4ec"]]), an = { class: "sunny-file-upload" }, ln = { class: "font-bold text-gray-700 mb-2" }, cn = { class: "flex flex-wrap items-center text-sm mb-3 select-none" }, un = { class: "cursor-pointer text-blue-600 hover:text-blue-700 flex items-center mr-4 transition-colors" }, dn = { class: "text-xs text-blue-600" }, fn = { class: "text-xs text-gray-400" }, pn = { class: "border border-dashed border-gray-300 rounded-lg p-4 transition-all duration-300" }, mn = { class: "grid grid-cols-1 sm:grid-cols-2 gap-4" }, hn = { class: "flex-1 min-w-0 pr-8" }, vn = ["title"], yn = { class: "flex items-center text-xs text-gray-500" }, gn = { class: "mr-3 min-w-[3em]" }, bn = { class: "ml-2 w-8 text-right" }, nt = 1024, Ns = /* @__PURE__ */ O({
|
|
729
|
+
__name: "index",
|
|
730
|
+
props: {
|
|
731
|
+
modelValue: { default: "" },
|
|
732
|
+
action: { default: "" },
|
|
733
|
+
delAction: { default: "" },
|
|
734
|
+
accept: { default: ".csv,.pdf,.xls,.xlsx" },
|
|
735
|
+
limit: { default: 10 },
|
|
736
|
+
maxSize: { default: 10 },
|
|
737
|
+
storeType: { default: "amazon" },
|
|
738
|
+
s3FileDir: { default: "" },
|
|
739
|
+
preSigned: { default: "" },
|
|
740
|
+
preSignedExpire: { default: "" },
|
|
741
|
+
readonly: { type: Boolean, default: !1 },
|
|
742
|
+
showEncrypt: { type: Boolean, default: !1 }
|
|
743
|
+
},
|
|
744
|
+
emits: ["update:modelValue", "change"],
|
|
745
|
+
setup(e, { emit: t }) {
|
|
746
|
+
const o = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], n = e, r = t, s = M(!0), a = M(!1), l = M([]), m = M(!1), y = b(() => l.value.every((d) => !!d.url)), v = b(() => l.value.filter((d) => d.checked).length);
|
|
747
|
+
U(() => n.modelValue, (d) => {
|
|
748
|
+
try {
|
|
749
|
+
l.value = JSON.parse(d || "[]");
|
|
750
|
+
} catch (f) {
|
|
751
|
+
console.warn("Failed to parse modelValue:", f), l.value = [];
|
|
752
|
+
}
|
|
753
|
+
}, { immediate: !0, deep: !0 });
|
|
754
|
+
const i = (d) => d, u = (d) => {
|
|
755
|
+
if (d === 0) return "0 B";
|
|
756
|
+
const f = Math.floor(Math.log(d) / Math.log(nt));
|
|
757
|
+
return (d / Math.pow(nt, f)).toPrecision(3) + " " + o[f];
|
|
758
|
+
}, c = (d) => {
|
|
759
|
+
const f = d.type || "", P = (d.name || "").split(".").pop()?.toLowerCase() || "", A = {
|
|
760
|
+
"vscode-icons:file-type-excel": ["xls", "xlsx", "csv"],
|
|
761
|
+
"vscode-icons:file-type-powerpoint": ["ppt", "pptx"],
|
|
762
|
+
"vscode-icons:file-type-text": ["txt"],
|
|
763
|
+
"vscode-icons:file-type-word": ["doc", "docx"],
|
|
764
|
+
"vscode-icons:file-type-zip": ["zip", "rar", "7z", "tar", "gz"],
|
|
765
|
+
"vscode-icons:file-type-pdf": ["pdf"]
|
|
766
|
+
};
|
|
767
|
+
for (const [re, pe] of Object.entries(A))
|
|
768
|
+
if (pe.includes(P) || pe.some((Rt) => f.includes(Rt)))
|
|
769
|
+
return re;
|
|
770
|
+
return f.includes("excel") || f.includes("spreadsheet") ? "vscode-icons:file-type-excel" : f.includes("powerpoint") || f.includes("presentation") ? "vscode-icons:file-type-powerpoint" : f.includes("text/plain") ? "vscode-icons:file-type-text" : f.includes("word") || f.includes("document") ? "vscode-icons:file-type-word" : f.includes("zip") || f.includes("compressed") ? "vscode-icons:file-type-zip" : f.includes("pdf") ? "vscode-icons:file-type-pdf" : "vscode-icons:default-file";
|
|
771
|
+
}, h = () => {
|
|
772
|
+
const d = JSON.stringify(l.value);
|
|
773
|
+
r("update:modelValue", d), r("change", d);
|
|
774
|
+
}, g = (d, f) => {
|
|
775
|
+
if (f.status !== "init") return;
|
|
776
|
+
if (l.value.length >= n.limit) {
|
|
777
|
+
H.error(`最多上传${n.limit}个文件`);
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
780
|
+
const k = n.maxSize * 1024 * 1024;
|
|
781
|
+
if (f.file.size > k) {
|
|
782
|
+
H.error(`文件最大限制${u(k)}`);
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
785
|
+
l.value.push({
|
|
786
|
+
uid: f.uid,
|
|
787
|
+
name: f.name,
|
|
788
|
+
size: f.file?.size,
|
|
789
|
+
type: f.file?.type,
|
|
790
|
+
file: f.file,
|
|
791
|
+
percentage: 0,
|
|
792
|
+
checked: !1
|
|
793
|
+
});
|
|
794
|
+
}, S = async () => {
|
|
795
|
+
if (l.value.length === 0) return;
|
|
796
|
+
const d = l.value.filter((f) => !f.url);
|
|
797
|
+
for (const f of d) {
|
|
798
|
+
const k = new FormData();
|
|
799
|
+
k.append("fileName", f.file), k.append("encryptFile", a.value ? "1" : "0"), n.storeType && k.append("storeType", n.storeType), n.s3FileDir && k.append("s3FileDir", n.s3FileDir), n.preSigned && k.append("preSigned", n.preSigned), n.preSignedExpire && k.append("preSignedExpire", n.preSignedExpire);
|
|
800
|
+
try {
|
|
801
|
+
const P = await xe.post(n.action, k, {
|
|
802
|
+
onUploadProgress: (re) => {
|
|
803
|
+
if (re.total) {
|
|
804
|
+
const pe = Math.floor(re.loaded / re.total * 100);
|
|
805
|
+
f.percentage = pe;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
}), { data: A } = P;
|
|
809
|
+
A.code === 200 ? (Object.assign(f, A.result), H.success(A.message || "上传成功")) : (H.error(A.message || "上传失败"), F(f.uid));
|
|
810
|
+
} catch {
|
|
811
|
+
H.error("上传失败"), F(f.uid);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
h();
|
|
815
|
+
}, F = (d) => {
|
|
816
|
+
const f = l.value.findIndex((k) => k.uid === d);
|
|
817
|
+
f > -1 && l.value.splice(f, 1);
|
|
818
|
+
}, C = (d, f) => {
|
|
819
|
+
d.url ? Be.confirm({
|
|
820
|
+
title: i("提示"),
|
|
821
|
+
content: i("是否删除该文件?"),
|
|
822
|
+
onOk: () => {
|
|
823
|
+
xe.post(n.delAction, {
|
|
824
|
+
filePathList: [d.url],
|
|
825
|
+
storeType: n.storeType
|
|
826
|
+
}).then((k) => {
|
|
827
|
+
const { data: P } = k;
|
|
828
|
+
H[P.success ? "success" : "error"](P.message), P.code === 200 && (l.value.splice(f, 1), h());
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
}) : (l.value.splice(f, 1), h());
|
|
832
|
+
}, x = () => {
|
|
833
|
+
const d = l.value.every((f) => f.checked);
|
|
834
|
+
l.value.forEach((f) => f.checked = !d);
|
|
835
|
+
}, B = () => {
|
|
836
|
+
const d = l.value.filter((f) => f.checked);
|
|
837
|
+
d.length !== 0 && Be.confirm({
|
|
838
|
+
title: i("提示"),
|
|
839
|
+
content: i("是否删除选中的文件?"),
|
|
840
|
+
onOk: () => {
|
|
841
|
+
m.value = !0;
|
|
842
|
+
const f = d.map((k) => k.url).filter(Boolean);
|
|
843
|
+
f.length > 0 ? xe.post(n.delAction, {
|
|
844
|
+
filePathList: f,
|
|
845
|
+
storeType: n.storeType
|
|
846
|
+
}).then((k) => {
|
|
847
|
+
const { data: P } = k;
|
|
848
|
+
H[P.success ? "success" : "error"](P.message), P.code === 200 && (l.value = l.value.filter((A) => !A.checked), h());
|
|
849
|
+
}).finally(() => {
|
|
850
|
+
m.value = !1;
|
|
851
|
+
}) : (l.value = l.value.filter((k) => !k.checked), h(), m.value = !1);
|
|
852
|
+
}
|
|
853
|
+
});
|
|
854
|
+
};
|
|
855
|
+
return (d, f) => (w(), R("div", an, [
|
|
856
|
+
_("div", ln, T(i("附件")), 1),
|
|
857
|
+
qe(_("div", cn, [
|
|
858
|
+
E(p(Ae), {
|
|
859
|
+
"show-file-list": !1,
|
|
860
|
+
"auto-upload": !1,
|
|
861
|
+
multiple: "",
|
|
862
|
+
accept: e.accept,
|
|
863
|
+
onChange: g
|
|
864
|
+
}, {
|
|
865
|
+
"upload-button": $(() => [
|
|
866
|
+
_("span", un, [
|
|
867
|
+
E(p(eo), { class: "mr-1 w-4 h-4" }),
|
|
868
|
+
D(" " + T(i("选择附件")), 1)
|
|
869
|
+
])
|
|
870
|
+
]),
|
|
871
|
+
_: 1
|
|
872
|
+
}, 8, ["accept"]),
|
|
873
|
+
_("span", {
|
|
874
|
+
class: N(["flex items-center mr-4 transition-colors", y.value ? "text-gray-300 cursor-not-allowed" : "cursor-pointer text-gray-600 hover:text-gray-800"]),
|
|
875
|
+
onClick: f[0] || (f[0] = (k) => !y.value && S())
|
|
876
|
+
}, [
|
|
877
|
+
E(p(tt), {
|
|
878
|
+
icon: p(to),
|
|
879
|
+
class: "mr-1 w-4 h-4"
|
|
880
|
+
}, null, 8, ["icon"]),
|
|
881
|
+
D(" " + T(i("上传附件")), 1)
|
|
882
|
+
], 2),
|
|
883
|
+
_("span", {
|
|
884
|
+
class: "cursor-pointer text-blue-600 hover:text-blue-700 mr-4 transition-colors",
|
|
885
|
+
onClick: x
|
|
886
|
+
}, T(i("全选")), 1),
|
|
887
|
+
_("span", {
|
|
888
|
+
class: N(["mr-4 transition-colors", v.value === 0 ? "text-gray-300 cursor-not-allowed" : "cursor-pointer text-gray-500 hover:text-red-500"]),
|
|
889
|
+
onClick: B
|
|
890
|
+
}, T(i("删除")), 3),
|
|
891
|
+
e.showEncrypt ? (w(), V(p(ve), {
|
|
892
|
+
key: 0,
|
|
893
|
+
modelValue: a.value,
|
|
894
|
+
"onUpdate:modelValue": f[1] || (f[1] = (k) => a.value = k),
|
|
895
|
+
class: "mr-4"
|
|
896
|
+
}, {
|
|
897
|
+
default: $(() => [
|
|
898
|
+
_("span", dn, T(i("是否加密")), 1)
|
|
899
|
+
]),
|
|
900
|
+
_: 1
|
|
901
|
+
}, 8, ["modelValue"])) : z("", !0),
|
|
902
|
+
_("span", fn, " (" + T(i("单个文件最大")) + T(e.maxSize) + "MB," + T(i("最多上传")) + T(e.limit) + T(i("个")) + ") ", 1),
|
|
903
|
+
_("span", {
|
|
904
|
+
class: "ml-auto cursor-pointer text-blue-600 text-xs hover:text-blue-700 transition-colors",
|
|
905
|
+
onClick: f[2] || (f[2] = (k) => s.value = !s.value)
|
|
906
|
+
}, T(s.value ? i("隐藏") : i("展开")), 1)
|
|
907
|
+
], 512), [
|
|
908
|
+
[Ye, !e.readonly]
|
|
909
|
+
]),
|
|
910
|
+
qe(_("div", pn, [
|
|
911
|
+
_("div", mn, [
|
|
912
|
+
(w(!0), R(ce, null, Z(l.value, (k, P) => (w(), R("div", {
|
|
913
|
+
key: k.uid || P,
|
|
914
|
+
class: "bg-gray-50 hover:bg-gray-100 rounded p-3 relative flex items-center border border-transparent hover:border-gray-200 transition-colors group"
|
|
915
|
+
}, [
|
|
916
|
+
E(p(tt), {
|
|
917
|
+
icon: c(k),
|
|
918
|
+
class: "w-10 h-10 mr-3 flex-shrink-0"
|
|
919
|
+
}, null, 8, ["icon"]),
|
|
920
|
+
_("div", hn, [
|
|
921
|
+
_("div", {
|
|
922
|
+
class: "text-sm truncate font-medium text-gray-700 mb-1",
|
|
923
|
+
title: k.name
|
|
924
|
+
}, T(k.name), 9, vn),
|
|
925
|
+
_("div", yn, [
|
|
926
|
+
_("span", gn, T(u(k.size)), 1),
|
|
927
|
+
E(p(Lt), {
|
|
928
|
+
percent: k.percentage / 100,
|
|
929
|
+
size: "small",
|
|
930
|
+
"show-text": !1,
|
|
931
|
+
color: k.percentage === 100 ? "#00b42a" : "#165dff",
|
|
932
|
+
class: "flex-1"
|
|
933
|
+
}, null, 8, ["percent", "color"]),
|
|
934
|
+
_("span", bn, T(k.percentage) + "%", 1)
|
|
935
|
+
])
|
|
936
|
+
]),
|
|
937
|
+
e.readonly ? z("", !0) : (w(), V(p(ve), {
|
|
938
|
+
key: 0,
|
|
939
|
+
modelValue: k.checked,
|
|
940
|
+
"onUpdate:modelValue": (A) => k.checked = A,
|
|
941
|
+
class: "absolute top-3 right-3"
|
|
942
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue"])),
|
|
943
|
+
e.readonly ? z("", !0) : (w(), V(p(oo), {
|
|
944
|
+
key: 1,
|
|
945
|
+
class: "absolute bottom-3 right-3 w-4 h-4 cursor-pointer text-gray-400 hover:text-red-500 transition-colors",
|
|
946
|
+
onClick: (A) => C(k, P)
|
|
947
|
+
}, null, 8, ["onClick"]))
|
|
948
|
+
]))), 128))
|
|
949
|
+
])
|
|
950
|
+
], 512), [
|
|
951
|
+
[Ye, l.value.length > 0 && s.value]
|
|
952
|
+
])
|
|
953
|
+
]));
|
|
954
|
+
}
|
|
955
|
+
}), wn = O({
|
|
956
|
+
name: "SunnySelect",
|
|
957
|
+
inheritAttrs: !1,
|
|
958
|
+
props: {
|
|
959
|
+
modelValue: {
|
|
960
|
+
type: [String, Number, Boolean, Object, Array],
|
|
961
|
+
default: void 0
|
|
962
|
+
},
|
|
963
|
+
options: {
|
|
964
|
+
type: Array,
|
|
965
|
+
default: () => []
|
|
966
|
+
},
|
|
967
|
+
filterModel: {
|
|
968
|
+
type: Object,
|
|
969
|
+
default: void 0
|
|
970
|
+
}
|
|
971
|
+
},
|
|
972
|
+
emits: ["update:modelValue"],
|
|
973
|
+
setup(e, { emit: t, slots: o, attrs: n }) {
|
|
974
|
+
const r = (l) => {
|
|
975
|
+
const m = l.cMeta;
|
|
976
|
+
return !m || Object.keys(m).length === 0 ? !0 : !e.filterModel || Object.keys(e.filterModel).length === 0 ? !1 : Object.entries(m).every(([y, v]) => {
|
|
977
|
+
const i = e.filterModel[y];
|
|
978
|
+
return i == null ? !1 : String(i) === String(v);
|
|
979
|
+
});
|
|
980
|
+
}, s = b(() => {
|
|
981
|
+
const l = e.modelValue;
|
|
982
|
+
if (l == null || l === "" || n["allow-create"] === !0 || n["allow-create"] === "")
|
|
983
|
+
return l;
|
|
984
|
+
const m = (y) => e.options.some((v) => r(v) ? v.value == y || typeof y == "object" && y !== null && "value" in y && v.value == y.value : !1);
|
|
985
|
+
if (Array.isArray(l)) {
|
|
986
|
+
const y = l.filter((v) => m(v));
|
|
987
|
+
return y.length === l.length ? l : y;
|
|
988
|
+
} else
|
|
989
|
+
return m(l) ? l : void 0;
|
|
990
|
+
});
|
|
991
|
+
U(s, (l) => {
|
|
992
|
+
l !== e.modelValue && t("update:modelValue", l);
|
|
993
|
+
});
|
|
994
|
+
const a = (l) => {
|
|
995
|
+
t("update:modelValue", l);
|
|
996
|
+
};
|
|
997
|
+
return () => /* @__PURE__ */ React.createElement(
|
|
998
|
+
Re,
|
|
999
|
+
{
|
|
1000
|
+
...n,
|
|
1001
|
+
modelValue: s.value,
|
|
1002
|
+
"onUpdate:modelValue": a
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
default: () => e.options.map((l) => r(l) ? /* @__PURE__ */ React.createElement(Nt, { key: l.value, ...l }, {
|
|
1006
|
+
default: () => o.option ? o.option({ data: l }) : l.label
|
|
1007
|
+
}) : null),
|
|
1008
|
+
...Object.fromEntries(
|
|
1009
|
+
Object.entries(o).filter(
|
|
1010
|
+
([l]) => l !== "option" && l !== "default"
|
|
1011
|
+
)
|
|
1012
|
+
)
|
|
1013
|
+
}
|
|
1014
|
+
);
|
|
1015
|
+
}
|
|
1016
|
+
}), Sn = { class: "flex items-center justify-between px-3 py-2 border-b border-[var(--color-neutral-3)] bg-[var(--color-bg-popup)] select-none" }, kn = { class: "flex items-center gap-1" }, xn = { class: "w-6 h-6 flex items-center justify-center rounded cursor-help text-[var(--color-text-3)] hover:text-[var(--color-text-1)] hover:bg-[var(--color-fill-3)] transition-all" }, Is = /* @__PURE__ */ O({
|
|
1017
|
+
name: "SunnyBatchSelect",
|
|
1018
|
+
inheritAttrs: !1,
|
|
1019
|
+
__name: "BatchSelect",
|
|
1020
|
+
props: {
|
|
1021
|
+
modelValue: { default: () => [] },
|
|
1022
|
+
options: { default: () => [] },
|
|
1023
|
+
matchStrategy: { default: "both" },
|
|
1024
|
+
filterModel: { default: void 0 }
|
|
1025
|
+
},
|
|
1026
|
+
emits: ["update:modelValue", "change"],
|
|
1027
|
+
setup(e, { emit: t }) {
|
|
1028
|
+
const o = e, n = t, r = b(
|
|
1029
|
+
() => o.options.filter((i) => !i.disabled)
|
|
1030
|
+
), s = b(() => r.value.length === 0 ? !1 : r.value.every(
|
|
1031
|
+
(i) => o.modelValue.includes(i.value)
|
|
1032
|
+
)), a = b(() => {
|
|
1033
|
+
if (r.value.length === 0) return !1;
|
|
1034
|
+
const i = r.value.filter(
|
|
1035
|
+
(u) => o.modelValue.includes(u.value)
|
|
1036
|
+
).length;
|
|
1037
|
+
return i > 0 && i < r.value.length;
|
|
1038
|
+
}), l = (i) => {
|
|
1039
|
+
n("update:modelValue", i), n("change", i);
|
|
1040
|
+
}, m = (i) => {
|
|
1041
|
+
if (i === !0) {
|
|
1042
|
+
const c = r.value.map((S) => S.value), h = o.modelValue.filter((S) => {
|
|
1043
|
+
const F = o.options.find((C) => C.value === S);
|
|
1044
|
+
return F && F.disabled;
|
|
1045
|
+
}), g = Array.from(/* @__PURE__ */ new Set([...h, ...c]));
|
|
1046
|
+
n("update:modelValue", g), n("change", g);
|
|
1047
|
+
} else {
|
|
1048
|
+
const c = o.modelValue.filter((h) => {
|
|
1049
|
+
const g = o.options.find((S) => S.value === h);
|
|
1050
|
+
return g && g.disabled;
|
|
1051
|
+
});
|
|
1052
|
+
n("update:modelValue", c), n("change", c);
|
|
1053
|
+
}
|
|
1054
|
+
}, y = () => {
|
|
1055
|
+
const i = o.modelValue.filter((u) => {
|
|
1056
|
+
const c = o.options.find((h) => h.value === u);
|
|
1057
|
+
return c && c.disabled;
|
|
1058
|
+
});
|
|
1059
|
+
n("update:modelValue", i), n("change", i);
|
|
1060
|
+
}, v = (i) => {
|
|
1061
|
+
const u = i.clipboardData || window.clipboardData;
|
|
1062
|
+
if (!u) return;
|
|
1063
|
+
const c = u.getData("text");
|
|
1064
|
+
if (!c) return;
|
|
1065
|
+
const h = c.split(/\r?\n/).map((C) => C.trim()).filter((C) => C);
|
|
1066
|
+
if (h.length === 0) return;
|
|
1067
|
+
const g = [];
|
|
1068
|
+
let S = 0;
|
|
1069
|
+
const F = (C) => {
|
|
1070
|
+
const x = C.cMeta;
|
|
1071
|
+
return !x || Object.keys(x).length === 0 ? !0 : !o.filterModel || Object.keys(o.filterModel).length === 0 ? !1 : Object.entries(x).every(([B, d]) => {
|
|
1072
|
+
const f = o.filterModel[B];
|
|
1073
|
+
return f == null ? !1 : String(f) === String(d);
|
|
1074
|
+
});
|
|
1075
|
+
};
|
|
1076
|
+
if (h.forEach((C) => {
|
|
1077
|
+
if (o.matchStrategy === "value" || o.matchStrategy === "both") {
|
|
1078
|
+
const x = o.options.find((B) => String(B.value) === C);
|
|
1079
|
+
if (x && !x.disabled && F(x)) {
|
|
1080
|
+
g.push(x.value), S++;
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
if (o.matchStrategy === "label" || o.matchStrategy === "both") {
|
|
1085
|
+
const x = o.options.find((B) => B.label === C);
|
|
1086
|
+
x && !x.disabled && F(x) && (g.push(x.value), S++);
|
|
1087
|
+
}
|
|
1088
|
+
}), g.length > 0) {
|
|
1089
|
+
i.preventDefault();
|
|
1090
|
+
const C = Array.from(/* @__PURE__ */ new Set([...o.modelValue, ...g]));
|
|
1091
|
+
n("update:modelValue", C), n("change", C), H.success(`成功识别并选中 ${S} 项 (Matched ${S} items)`);
|
|
1092
|
+
}
|
|
1093
|
+
};
|
|
1094
|
+
return (i, u) => {
|
|
1095
|
+
const c = W("a-checkbox"), h = W("a-tooltip");
|
|
1096
|
+
return w(), V(p(wn), L(i.$attrs, {
|
|
1097
|
+
"model-value": e.modelValue,
|
|
1098
|
+
options: e.options,
|
|
1099
|
+
"filter-model": e.filterModel,
|
|
1100
|
+
multiple: "",
|
|
1101
|
+
"allow-search": "",
|
|
1102
|
+
"onUpdate:modelValue": l,
|
|
1103
|
+
onPaste: v
|
|
1104
|
+
}), de({
|
|
1105
|
+
header: $(() => [
|
|
1106
|
+
_("div", Sn, [
|
|
1107
|
+
E(c, {
|
|
1108
|
+
"model-value": s.value,
|
|
1109
|
+
indeterminate: a.value,
|
|
1110
|
+
onChange: m,
|
|
1111
|
+
class: "pl-1"
|
|
1112
|
+
}, {
|
|
1113
|
+
default: $(() => [...u[0] || (u[0] = [
|
|
1114
|
+
_("span", { class: "text-[var(--color-text-1)]" }, "全选", -1)
|
|
1115
|
+
])]),
|
|
1116
|
+
_: 1
|
|
1117
|
+
}, 8, ["model-value", "indeterminate"]),
|
|
1118
|
+
_("div", kn, [
|
|
1119
|
+
E(h, { content: "清除所有选中项" }, {
|
|
1120
|
+
default: $(() => [
|
|
1121
|
+
_("div", {
|
|
1122
|
+
class: "w-6 h-6 flex items-center justify-center rounded cursor-pointer text-[var(--color-text-3)] hover:bg-[var(--color-fill-3)] transition-all",
|
|
1123
|
+
onClick: y
|
|
1124
|
+
}, [
|
|
1125
|
+
E(p(Do))
|
|
1126
|
+
])
|
|
1127
|
+
]),
|
|
1128
|
+
_: 1
|
|
1129
|
+
}),
|
|
1130
|
+
u[1] || (u[1] = _("div", { class: "w-[1px] h-3 bg-[var(--color-neutral-3)] mx-1" }, null, -1)),
|
|
1131
|
+
E(h, {
|
|
1132
|
+
content: "支持从 Excel 或文本编辑器(↓列数据)复制多行数据,粘贴至搜索框即可自动匹配并选中。",
|
|
1133
|
+
position: "left"
|
|
1134
|
+
}, {
|
|
1135
|
+
default: $(() => [
|
|
1136
|
+
_("div", xn, [
|
|
1137
|
+
E(p(wt))
|
|
1138
|
+
])
|
|
1139
|
+
]),
|
|
1140
|
+
_: 1
|
|
1141
|
+
})
|
|
1142
|
+
])
|
|
1143
|
+
])
|
|
1144
|
+
]),
|
|
1145
|
+
_: 2
|
|
1146
|
+
}, [
|
|
1147
|
+
Z(i.$slots, (g, S) => ({
|
|
1148
|
+
name: S,
|
|
1149
|
+
fn: $((F) => [
|
|
1150
|
+
j(i.$slots, S, Y(fe(F || {})))
|
|
1151
|
+
])
|
|
1152
|
+
}))
|
|
1153
|
+
]), 1040, ["model-value", "options", "filter-model"]);
|
|
1154
|
+
};
|
|
1155
|
+
}
|
|
1156
|
+
}), Ds = /* @__PURE__ */ O({
|
|
1157
|
+
name: "SunnySearchInputTag",
|
|
1158
|
+
inheritAttrs: !1,
|
|
1159
|
+
__name: "SearchInputTag",
|
|
1160
|
+
props: {
|
|
1161
|
+
modelValue: { default: () => [] },
|
|
1162
|
+
fieldNames: { default: () => ({ label: "label", value: "value" }) },
|
|
1163
|
+
placeholder: { default: "请选择..." },
|
|
1164
|
+
disabled: { type: Boolean, default: !1 },
|
|
1165
|
+
maxTagCount: {}
|
|
1166
|
+
},
|
|
1167
|
+
emits: ["update:modelValue", "search", "change", "clear"],
|
|
1168
|
+
setup(e, { emit: t }) {
|
|
1169
|
+
const o = e, n = t, r = b(() => o.fieldNames?.label || "label"), s = b(() => o.fieldNames?.value || "value"), a = b(() => o.modelValue.map((i) => ({
|
|
1170
|
+
label: i[r.value],
|
|
1171
|
+
value: i[s.value],
|
|
1172
|
+
closable: !o.disabled,
|
|
1173
|
+
tagProps: i.tagProps
|
|
1174
|
+
// 透传可能存在的 tagProps
|
|
1175
|
+
}))), l = (i) => {
|
|
1176
|
+
o.disabled || ["Backspace", "Delete", "Tab", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"].includes(i.key) || i.preventDefault();
|
|
1177
|
+
}, m = (i, u) => {
|
|
1178
|
+
const c = [...o.modelValue];
|
|
1179
|
+
c.splice(u, 1), n("update:modelValue", c), n("change", c);
|
|
1180
|
+
}, y = () => {
|
|
1181
|
+
n("update:modelValue", []), n("change", []), n("clear");
|
|
1182
|
+
}, v = () => {
|
|
1183
|
+
o.disabled || n("search");
|
|
1184
|
+
};
|
|
1185
|
+
return (i, u) => {
|
|
1186
|
+
const c = W("a-input-tag");
|
|
1187
|
+
return w(), V(c, L(i.$attrs, {
|
|
1188
|
+
"model-value": a.value,
|
|
1189
|
+
"input-value": "",
|
|
1190
|
+
disabled: e.disabled,
|
|
1191
|
+
placeholder: e.placeholder,
|
|
1192
|
+
"max-tag-count": e.maxTagCount,
|
|
1193
|
+
"allow-create": !1,
|
|
1194
|
+
class: "w-full group",
|
|
1195
|
+
onRemove: m,
|
|
1196
|
+
onClear: y,
|
|
1197
|
+
onKeydown: l
|
|
1198
|
+
}), de({
|
|
1199
|
+
suffix: $(() => [
|
|
1200
|
+
_("div", {
|
|
1201
|
+
class: N(["flex items-center h-full px-2 border-l border-[var(--color-neutral-3)] group-hover:border-[var(--color-neutral-4)] -mr-3", [
|
|
1202
|
+
e.disabled ? "cursor-not-allowed text-[var(--color-text-4)]" : "cursor-pointer text-[var(--color-text-2)] group"
|
|
1203
|
+
]]),
|
|
1204
|
+
onClick: Ee(v, ["stop"])
|
|
1205
|
+
}, [
|
|
1206
|
+
E(p(zo), { class: "transition-colors group-hover:text-[var(--color-primary-6)]" })
|
|
1207
|
+
], 2)
|
|
1208
|
+
]),
|
|
1209
|
+
_: 2
|
|
1210
|
+
}, [
|
|
1211
|
+
Z(i.$slots, (h, g) => ({
|
|
1212
|
+
name: g,
|
|
1213
|
+
fn: $((S) => [
|
|
1214
|
+
j(i.$slots, g, Y(fe(S || {})))
|
|
1215
|
+
])
|
|
1216
|
+
}))
|
|
1217
|
+
]), 1040, ["model-value", "disabled", "placeholder", "max-tag-count"]);
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
});
|
|
1221
|
+
class Cn {
|
|
1222
|
+
// 核心 TanStack Store 实例 / Core TanStack Store instance
|
|
1223
|
+
store;
|
|
1224
|
+
/**
|
|
1225
|
+
* 初始化 Store
|
|
1226
|
+
* Initialize Store
|
|
1227
|
+
*
|
|
1228
|
+
* @param initialState 初始状态 / Initial state
|
|
1229
|
+
* @param options 配置项 / Configuration options
|
|
1230
|
+
*/
|
|
1231
|
+
constructor(t, o) {
|
|
1232
|
+
this.store = new po(t), o?.onUpdate && this.store.subscribe(() => {
|
|
1233
|
+
o.onUpdate?.();
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
/**
|
|
1237
|
+
* 更新状态
|
|
1238
|
+
* Update state
|
|
1239
|
+
*
|
|
1240
|
+
* 支持传入部分状态对象或更新函数。
|
|
1241
|
+
* Supports passing a partial state object or an update function.
|
|
1242
|
+
*
|
|
1243
|
+
* @param partialState 部分状态或更新函数 / Partial state or update function
|
|
1244
|
+
*/
|
|
1245
|
+
setState(t) {
|
|
1246
|
+
this.store.setState((o) => {
|
|
1247
|
+
const n = typeof t == "function" ? t(o) : t;
|
|
1248
|
+
return { ...o, ...n };
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* 获取当前状态快照
|
|
1253
|
+
* Get current state snapshot
|
|
1254
|
+
*
|
|
1255
|
+
* @returns 当前状态对象 / Current state object
|
|
1256
|
+
*/
|
|
1257
|
+
getState() {
|
|
1258
|
+
return this.store.state;
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
function rt(e, t = "YYYY-MM-DD") {
|
|
1262
|
+
if (!e) return e;
|
|
1263
|
+
if (I(e.format))
|
|
1264
|
+
return e.format(t);
|
|
1265
|
+
if (e instanceof Date) {
|
|
1266
|
+
const o = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), r = String(e.getDate()).padStart(2, "0"), s = String(e.getHours()).padStart(2, "0"), a = String(e.getMinutes()).padStart(2, "0"), l = String(e.getSeconds()).padStart(2, "0");
|
|
1267
|
+
return t.replace("YYYY", String(o)).replace("MM", n).replace("DD", r).replace("HH", s).replace("mm", a).replace("ss", l);
|
|
1268
|
+
}
|
|
1269
|
+
return String(e);
|
|
1270
|
+
}
|
|
1271
|
+
function st(e) {
|
|
1272
|
+
return is(e, "Date");
|
|
1273
|
+
}
|
|
1274
|
+
function at(e) {
|
|
1275
|
+
return q(e) && "$d" in e && "$y" in e && "$M" in e;
|
|
1276
|
+
}
|
|
1277
|
+
function he(e, t) {
|
|
1278
|
+
if (!q(e) || !q(t) || Array.isArray(t)) return t;
|
|
1279
|
+
const o = { ...e };
|
|
1280
|
+
return Object.keys(t).forEach((n) => {
|
|
1281
|
+
const r = o[n], s = t[n];
|
|
1282
|
+
q(r) && q(s) ? o[n] = he(r, s) : o[n] = s;
|
|
1283
|
+
}), o;
|
|
1284
|
+
}
|
|
1285
|
+
class $n {
|
|
1286
|
+
condition = !1;
|
|
1287
|
+
resolveFn = null;
|
|
1288
|
+
promise = null;
|
|
1289
|
+
setConditionTrue() {
|
|
1290
|
+
this.condition = !0, this.resolveFn && (this.resolveFn(), this.resolveFn = null);
|
|
1291
|
+
}
|
|
1292
|
+
reset() {
|
|
1293
|
+
this.condition = !1, this.promise = null, this.resolveFn = null;
|
|
1294
|
+
}
|
|
1295
|
+
async waitForCondition() {
|
|
1296
|
+
this.condition || (this.promise || (this.promise = new Promise((t) => {
|
|
1297
|
+
this.resolveFn = t;
|
|
1298
|
+
})), await this.promise);
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
function _n(e) {
|
|
1302
|
+
const t = Object.getPrototypeOf(e), o = Object.getOwnPropertyNames(t);
|
|
1303
|
+
for (const n of o) {
|
|
1304
|
+
const r = e[n];
|
|
1305
|
+
n !== "constructor" && typeof r == "function" && (e[n] = r.bind(e));
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
function Fn() {
|
|
1309
|
+
return {
|
|
1310
|
+
actionWrapperClass: "",
|
|
1311
|
+
collapsed: !1,
|
|
1312
|
+
collapsedRows: 1,
|
|
1313
|
+
collapseTriggerResize: !1,
|
|
1314
|
+
commonConfig: {},
|
|
1315
|
+
handleReset: void 0,
|
|
1316
|
+
handleSubmit: void 0,
|
|
1317
|
+
handleValuesChange: void 0,
|
|
1318
|
+
handleCollapsedChange: void 0,
|
|
1319
|
+
layout: "horizontal",
|
|
1320
|
+
resetButtonOptions: {},
|
|
1321
|
+
schema: [],
|
|
1322
|
+
scrollToFirstError: !1,
|
|
1323
|
+
showCollapseButton: !1,
|
|
1324
|
+
showDefaultActions: !0,
|
|
1325
|
+
submitButtonOptions: {},
|
|
1326
|
+
submitOnChange: !1,
|
|
1327
|
+
submitOnEnter: !1,
|
|
1328
|
+
wrapperClass: "grid-cols-1",
|
|
1329
|
+
values: {}
|
|
1330
|
+
};
|
|
1331
|
+
}
|
|
1332
|
+
class Pn {
|
|
1333
|
+
// vee-validate 表单上下文
|
|
1334
|
+
form = {};
|
|
1335
|
+
// 是否已挂载
|
|
1336
|
+
isMounted = !1;
|
|
1337
|
+
// 当前状态 (快捷访问)
|
|
1338
|
+
state = null;
|
|
1339
|
+
// 状态同步处理器
|
|
1340
|
+
stateHandler;
|
|
1341
|
+
// TanStack Store 实例
|
|
1342
|
+
store;
|
|
1343
|
+
/**
|
|
1344
|
+
* 组件实例映射
|
|
1345
|
+
* Component Ref Map
|
|
1346
|
+
* 用于存储每个字段对应的组件实例,以便直接操作组件 (如 focus, scroll)
|
|
1347
|
+
*/
|
|
1348
|
+
componentRefMap = /* @__PURE__ */ new Map();
|
|
1349
|
+
// 最后一次点击提交时的表单值
|
|
1350
|
+
latestSubmissionValues = null;
|
|
1351
|
+
// 上一次的状态 (用于 Diff)
|
|
1352
|
+
prevState = null;
|
|
1353
|
+
constructor(t = {}) {
|
|
1354
|
+
const { ...o } = t, n = Fn();
|
|
1355
|
+
this.store = new Cn(
|
|
1356
|
+
{
|
|
1357
|
+
...n,
|
|
1358
|
+
...o
|
|
1359
|
+
},
|
|
1360
|
+
{
|
|
1361
|
+
onUpdate: () => {
|
|
1362
|
+
this.prevState = this.state, this.state = this.store.getState(), this.updateState();
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
), this.state = this.store.getState(), this.stateHandler = new $n(), _n(this);
|
|
1366
|
+
}
|
|
1367
|
+
/**
|
|
1368
|
+
* 获取字段组件实例
|
|
1369
|
+
* Get field component instance
|
|
1370
|
+
*
|
|
1371
|
+
* @param fieldName 字段名
|
|
1372
|
+
* @returns 组件实例
|
|
1373
|
+
*/
|
|
1374
|
+
getFieldComponentRef(t) {
|
|
1375
|
+
let o = this.componentRefMap.has(t) ? this.componentRefMap.get(t) : void 0;
|
|
1376
|
+
if (o && o.$ && o.$.type && o.$.type.name === "AsyncComponentWrapper" && o.$.subTree && o.$.subTree.ref) {
|
|
1377
|
+
const n = o.$.subTree.ref;
|
|
1378
|
+
Array.isArray(n) ? n.length > 0 && n[0] && Ke(n[0].r) && (o = n[0].r.value) : Ke(n.r) && (o = n.r.value);
|
|
1379
|
+
}
|
|
1380
|
+
return o;
|
|
1381
|
+
}
|
|
1382
|
+
/**
|
|
1383
|
+
* 获取当前聚焦的字段
|
|
1384
|
+
* Get currently focused field
|
|
1385
|
+
*
|
|
1386
|
+
* @returns 字段名或 undefined
|
|
1387
|
+
*/
|
|
1388
|
+
getFocusedField() {
|
|
1389
|
+
for (const t of this.componentRefMap.keys()) {
|
|
1390
|
+
const o = this.getFieldComponentRef(t);
|
|
1391
|
+
if (o) {
|
|
1392
|
+
let n = null;
|
|
1393
|
+
if (o instanceof HTMLElement ? n = o : o.$el instanceof HTMLElement && (n = o.$el), !n)
|
|
1394
|
+
continue;
|
|
1395
|
+
if (n === document.activeElement || n.contains(document.activeElement))
|
|
1396
|
+
return t;
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
/**
|
|
1401
|
+
* 获取最后一次提交的值
|
|
1402
|
+
* Get latest submission values
|
|
1403
|
+
*/
|
|
1404
|
+
getLatestSubmissionValues() {
|
|
1405
|
+
return this.latestSubmissionValues || {};
|
|
1406
|
+
}
|
|
1407
|
+
/**
|
|
1408
|
+
* 获取当前状态
|
|
1409
|
+
* Get current state
|
|
1410
|
+
*/
|
|
1411
|
+
getState() {
|
|
1412
|
+
return this.state;
|
|
1413
|
+
}
|
|
1414
|
+
/**
|
|
1415
|
+
* 获取表单值 (经过处理)
|
|
1416
|
+
* Get form values (Processed)
|
|
1417
|
+
*/
|
|
1418
|
+
async getValues() {
|
|
1419
|
+
const t = await this.getForm();
|
|
1420
|
+
return t.values ? this.handleRangeTimeValue(t.values) : {};
|
|
1421
|
+
}
|
|
1422
|
+
/**
|
|
1423
|
+
* 检查字段是否有效
|
|
1424
|
+
* Check if field is valid
|
|
1425
|
+
*/
|
|
1426
|
+
async isFieldValid(t) {
|
|
1427
|
+
return (await this.getForm()).isFieldValid(t);
|
|
1428
|
+
}
|
|
1429
|
+
/**
|
|
1430
|
+
* 合并多个 FormApi (链式调用)
|
|
1431
|
+
* Merge multiple FormApis (Chaining)
|
|
1432
|
+
*/
|
|
1433
|
+
merge(t) {
|
|
1434
|
+
const o = [this, t], n = new Proxy(t, {
|
|
1435
|
+
get(r, s) {
|
|
1436
|
+
return s === "merge" ? (a) => (o.push(a), n) : s === "submitAllForm" ? async (a = !0) => {
|
|
1437
|
+
try {
|
|
1438
|
+
const l = await Promise.all(
|
|
1439
|
+
o.map(async (m) => (await m.validate()).valid ? G(await m.getValues() || {}) : void 0)
|
|
1440
|
+
);
|
|
1441
|
+
return l.some((m) => !m) ? void 0 : a ? Object.assign({}, ...l) : l;
|
|
1442
|
+
} catch (l) {
|
|
1443
|
+
console.error("Validation error:", l);
|
|
1444
|
+
}
|
|
1445
|
+
} : r[s];
|
|
1446
|
+
}
|
|
1447
|
+
});
|
|
1448
|
+
return n;
|
|
1449
|
+
}
|
|
1450
|
+
/**
|
|
1451
|
+
* 挂载表单
|
|
1452
|
+
* Mount form
|
|
1453
|
+
*
|
|
1454
|
+
* @param formActions vee-validate 上下文
|
|
1455
|
+
* @param componentRefMap 组件引用映射
|
|
1456
|
+
*/
|
|
1457
|
+
mount(t, o) {
|
|
1458
|
+
this.isMounted || (Object.assign(this.form, t), this.stateHandler.setConditionTrue(), this.setLatestSubmissionValues({
|
|
1459
|
+
...G(this.handleRangeTimeValue(this.form.values))
|
|
1460
|
+
}), o && (this.componentRefMap = o), this.isMounted = !0);
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* 根据字段名移除 Schema
|
|
1464
|
+
* Remove schema by fields
|
|
1465
|
+
*/
|
|
1466
|
+
async removeSchemaByFields(t) {
|
|
1467
|
+
const o = new Set(t), r = (this.state?.schema ?? []).filter((s) => !o.has(s.fieldName));
|
|
1468
|
+
this.setState({
|
|
1469
|
+
schema: r
|
|
1470
|
+
});
|
|
1471
|
+
}
|
|
1472
|
+
/**
|
|
1473
|
+
* 重置表单
|
|
1474
|
+
* Reset form
|
|
1475
|
+
*/
|
|
1476
|
+
async resetForm(t, o) {
|
|
1477
|
+
return (await this.getForm()).resetForm(t, o);
|
|
1478
|
+
}
|
|
1479
|
+
/**
|
|
1480
|
+
* 重置验证状态
|
|
1481
|
+
* Reset validation
|
|
1482
|
+
*/
|
|
1483
|
+
async resetValidate() {
|
|
1484
|
+
const t = await this.getForm();
|
|
1485
|
+
Object.keys(t.errors.value).forEach((n) => {
|
|
1486
|
+
t.setFieldError(n, void 0);
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
/**
|
|
1490
|
+
* 滚动到第一个错误字段
|
|
1491
|
+
* Scroll to first error field
|
|
1492
|
+
*/
|
|
1493
|
+
scrollToFirstError(t) {
|
|
1494
|
+
const o = typeof t == "string" ? t : Object.keys(t)[0];
|
|
1495
|
+
if (!o)
|
|
1496
|
+
return;
|
|
1497
|
+
let n = document.querySelector(
|
|
1498
|
+
`[name="${o}"]`
|
|
1499
|
+
);
|
|
1500
|
+
if (!n) {
|
|
1501
|
+
const r = this.getFieldComponentRef(o);
|
|
1502
|
+
r && r.$el instanceof HTMLElement ? n = r.$el : r instanceof HTMLElement && (n = r);
|
|
1503
|
+
}
|
|
1504
|
+
n && n.scrollIntoView({
|
|
1505
|
+
behavior: "smooth",
|
|
1506
|
+
block: "center",
|
|
1507
|
+
inline: "nearest"
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
/**
|
|
1511
|
+
* 设置单个字段值
|
|
1512
|
+
* Set field value
|
|
1513
|
+
*/
|
|
1514
|
+
async setFieldValue(t, o, n) {
|
|
1515
|
+
(await this.getForm()).setFieldValue(t, o, n);
|
|
1516
|
+
}
|
|
1517
|
+
/**
|
|
1518
|
+
* 设置最后一次提交的值
|
|
1519
|
+
* Set latest submission values
|
|
1520
|
+
*/
|
|
1521
|
+
setLatestSubmissionValues(t) {
|
|
1522
|
+
this.latestSubmissionValues = { ...G(t) };
|
|
1523
|
+
}
|
|
1524
|
+
/**
|
|
1525
|
+
* 更新状态
|
|
1526
|
+
* Update state
|
|
1527
|
+
*/
|
|
1528
|
+
setState(t) {
|
|
1529
|
+
I(t) ? this.store.setState((o) => he(o, t(o))) : this.store.setState((o) => he(o, t));
|
|
1530
|
+
}
|
|
1531
|
+
/**
|
|
1532
|
+
* 设置表单值
|
|
1533
|
+
* Set form values
|
|
1534
|
+
*
|
|
1535
|
+
* @param fields 值对象
|
|
1536
|
+
* @param filterFields 是否过滤不在 schema 中的字段 (默认 true)
|
|
1537
|
+
* @param shouldValidate 是否触发验证 (默认 false)
|
|
1538
|
+
*/
|
|
1539
|
+
async setValues(t, o = !0, n = !1) {
|
|
1540
|
+
const r = await this.getForm();
|
|
1541
|
+
if (!o) {
|
|
1542
|
+
r.setValues(t, n);
|
|
1543
|
+
return;
|
|
1544
|
+
}
|
|
1545
|
+
const s = r.values || {}, a = (m, y) => {
|
|
1546
|
+
const v = {};
|
|
1547
|
+
for (const i in m)
|
|
1548
|
+
if (Object.prototype.hasOwnProperty.call(m, i) && i in y) {
|
|
1549
|
+
const u = m[i], c = y[i];
|
|
1550
|
+
q(u) && !Array.isArray(u) && !st(u) && !at(u) && q(c) && !Array.isArray(c) && !st(c) && !at(c) ? v[i] = a(u, c) : v[i] = u;
|
|
1551
|
+
}
|
|
1552
|
+
return v;
|
|
1553
|
+
}, l = a(t, s);
|
|
1554
|
+
r.setValues(l, n);
|
|
1555
|
+
}
|
|
1556
|
+
/**
|
|
1557
|
+
* 提交表单
|
|
1558
|
+
* Submit form
|
|
1559
|
+
*/
|
|
1560
|
+
async submitForm(t) {
|
|
1561
|
+
t?.preventDefault(), t?.stopPropagation();
|
|
1562
|
+
const o = await this.getForm(), { valid: n, errors: r } = await o.validate(), s = G(await this.getValues());
|
|
1563
|
+
return n ? await this.state?.handleSubmit?.(s) : this.state?.scrollToFirstError && this.scrollToFirstError(r), { valid: n, values: s, errors: r };
|
|
1564
|
+
}
|
|
1565
|
+
/**
|
|
1566
|
+
* 卸载表单
|
|
1567
|
+
* Unmount form
|
|
1568
|
+
*/
|
|
1569
|
+
unmount() {
|
|
1570
|
+
this.form?.resetForm?.(), this.latestSubmissionValues = null, this.isMounted = !1, this.stateHandler.reset();
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* 更新 Schema
|
|
1574
|
+
* Update schema
|
|
1575
|
+
*/
|
|
1576
|
+
updateSchema(t) {
|
|
1577
|
+
const o = [...t];
|
|
1578
|
+
if (!o.every(
|
|
1579
|
+
(a) => Reflect.has(a, "fieldName") && a.fieldName
|
|
1580
|
+
)) {
|
|
1581
|
+
console.error(
|
|
1582
|
+
"All items in the schema array must have a valid `fieldName` property to be updated"
|
|
1583
|
+
);
|
|
1584
|
+
return;
|
|
1585
|
+
}
|
|
1586
|
+
const r = me(this.state?.schema ?? []), s = {};
|
|
1587
|
+
o.forEach((a) => {
|
|
1588
|
+
a.fieldName && (s[a.fieldName] = a);
|
|
1589
|
+
}), r.forEach((a, l) => {
|
|
1590
|
+
const m = s[a.fieldName];
|
|
1591
|
+
m && (r[l] = he(
|
|
1592
|
+
a,
|
|
1593
|
+
m
|
|
1594
|
+
));
|
|
1595
|
+
}), this.setState({ schema: r });
|
|
1596
|
+
}
|
|
1597
|
+
/**
|
|
1598
|
+
* 验证表单
|
|
1599
|
+
* Validate form
|
|
1600
|
+
*/
|
|
1601
|
+
async validate(t) {
|
|
1602
|
+
const n = await (await this.getForm()).validate(t);
|
|
1603
|
+
return Object.keys(n?.errors ?? {}).length > 0 && (console.error("validate error", n?.errors), this.state?.scrollToFirstError && this.scrollToFirstError(n.errors)), n;
|
|
1604
|
+
}
|
|
1605
|
+
/**
|
|
1606
|
+
* 验证并提交表单
|
|
1607
|
+
* Validate and submit form
|
|
1608
|
+
*/
|
|
1609
|
+
async validateAndSubmitForm() {
|
|
1610
|
+
const t = await this.getForm(), { valid: o, errors: n } = await t.validate();
|
|
1611
|
+
if (!o) {
|
|
1612
|
+
this.state?.scrollToFirstError && this.scrollToFirstError(n);
|
|
1613
|
+
return;
|
|
1614
|
+
}
|
|
1615
|
+
return await this.submitForm();
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1618
|
+
* 验证单个字段
|
|
1619
|
+
* Validate single field
|
|
1620
|
+
*/
|
|
1621
|
+
async validateField(t, o) {
|
|
1622
|
+
const r = await (await this.getForm()).validateField(t, o);
|
|
1623
|
+
return Object.keys(r?.errors ?? {}).length > 0 && (console.error("validate error", r?.errors), this.state?.scrollToFirstError && this.scrollToFirstError(t)), r;
|
|
1624
|
+
}
|
|
1625
|
+
// ==========================================
|
|
1626
|
+
// 私有方法 (Private Methods)
|
|
1627
|
+
// ==========================================
|
|
1628
|
+
/**
|
|
1629
|
+
* 获取表单实例 (内部使用,自动等待挂载)
|
|
1630
|
+
* Get form instance (Internal, waits for mount)
|
|
1631
|
+
*/
|
|
1632
|
+
async getForm() {
|
|
1633
|
+
if (this.isMounted || await this.stateHandler.waitForCondition(), !this.form?.meta)
|
|
1634
|
+
throw new Error("<SunnyUseForm /> is not mounted");
|
|
1635
|
+
return this.form;
|
|
1636
|
+
}
|
|
1637
|
+
/**
|
|
1638
|
+
* 处理多字段 (Array to String)
|
|
1639
|
+
* Handle multi-fields
|
|
1640
|
+
*/
|
|
1641
|
+
handleMultiFields = (t) => {
|
|
1642
|
+
const o = this.state?.arrayToStringFields;
|
|
1643
|
+
if (!o || !Array.isArray(o))
|
|
1644
|
+
return;
|
|
1645
|
+
const n = (r, s = ",") => {
|
|
1646
|
+
this.processFields(r, s, t, (a, l) => {
|
|
1647
|
+
if (Array.isArray(a))
|
|
1648
|
+
return a.join(l);
|
|
1649
|
+
if (typeof a == "string") {
|
|
1650
|
+
if (a === "")
|
|
1651
|
+
return [];
|
|
1652
|
+
const m = l.replaceAll(
|
|
1653
|
+
/[.*+?^${}()|[\]\\]/g,
|
|
1654
|
+
String.raw`\$&`
|
|
1655
|
+
);
|
|
1656
|
+
return a.split(new RegExp(m));
|
|
1657
|
+
} else
|
|
1658
|
+
return a;
|
|
1659
|
+
});
|
|
1660
|
+
};
|
|
1661
|
+
if (o.every((r) => typeof r == "string")) {
|
|
1662
|
+
const r = o[o.length - 1] || "", s = r.length === 1 ? o.slice(0, -1) : o, a = r.length === 1 ? r : ",";
|
|
1663
|
+
n(s, a);
|
|
1664
|
+
return;
|
|
1665
|
+
}
|
|
1666
|
+
o.forEach((r) => {
|
|
1667
|
+
if (Array.isArray(r)) {
|
|
1668
|
+
const [s, a = ","] = r;
|
|
1669
|
+
if (!Array.isArray(s)) {
|
|
1670
|
+
console.warn(
|
|
1671
|
+
`Invalid field configuration: fields should be an array of strings, got ${typeof s}`
|
|
1672
|
+
);
|
|
1673
|
+
return;
|
|
1674
|
+
}
|
|
1675
|
+
n(s, a);
|
|
1676
|
+
}
|
|
1677
|
+
});
|
|
1678
|
+
};
|
|
1679
|
+
/**
|
|
1680
|
+
* 处理时间范围值 (Range Time Value)
|
|
1681
|
+
* Handle range time value
|
|
1682
|
+
*/
|
|
1683
|
+
handleRangeTimeValue = (t) => {
|
|
1684
|
+
const o = { ...t }, n = this.state?.fieldMappingTime;
|
|
1685
|
+
return this.handleMultiFields(o), !n || !Array.isArray(n) || n.forEach(
|
|
1686
|
+
([r, [s, a], l = "YYYY-MM-DD"]) => {
|
|
1687
|
+
if (s && a && o[r] === null && (Reflect.deleteProperty(o, s), Reflect.deleteProperty(o, a)), !o[r]) {
|
|
1688
|
+
Reflect.deleteProperty(o, r);
|
|
1689
|
+
return;
|
|
1690
|
+
}
|
|
1691
|
+
const [m, y] = o[r];
|
|
1692
|
+
if (l === null)
|
|
1693
|
+
o[s] = m, o[a] = y;
|
|
1694
|
+
else if (I(l))
|
|
1695
|
+
o[s] = l(m), o[a] = l(y);
|
|
1696
|
+
else {
|
|
1697
|
+
const [v, i] = Array.isArray(l) ? l : [l, l];
|
|
1698
|
+
o[s] = m ? rt(m, v) : void 0, o[a] = y ? rt(y, i) : void 0;
|
|
1699
|
+
}
|
|
1700
|
+
Reflect.deleteProperty(o, r);
|
|
1701
|
+
}
|
|
1702
|
+
), o;
|
|
1703
|
+
};
|
|
1704
|
+
/**
|
|
1705
|
+
* 字段处理通用逻辑
|
|
1706
|
+
* Process fields helper
|
|
1707
|
+
*/
|
|
1708
|
+
processFields = (t, o, n, r) => {
|
|
1709
|
+
t.forEach((s) => {
|
|
1710
|
+
const a = n[s];
|
|
1711
|
+
a != null && (n[s] = r(a, o));
|
|
1712
|
+
});
|
|
1713
|
+
};
|
|
1714
|
+
/**
|
|
1715
|
+
* 更新状态 (Diff 处理)
|
|
1716
|
+
* Update State (Diff logic)
|
|
1717
|
+
*/
|
|
1718
|
+
updateState() {
|
|
1719
|
+
const t = this.state?.schema ?? [], o = this.prevState?.schema ?? [];
|
|
1720
|
+
if (t.length < o.length) {
|
|
1721
|
+
const n = new Set(
|
|
1722
|
+
t.map((s) => s.fieldName)
|
|
1723
|
+
), r = o.filter(
|
|
1724
|
+
(s) => !n.has(s.fieldName)
|
|
1725
|
+
);
|
|
1726
|
+
for (const s of r)
|
|
1727
|
+
this.form?.setFieldValue?.(s.fieldName, void 0);
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
// 类型定义占位,实际在 useSunnyForm 中注入实现
|
|
1731
|
+
// Type definition placeholder, actual implementation injected in useSunnyForm
|
|
1732
|
+
useStore;
|
|
1733
|
+
}
|
|
1734
|
+
const xt = /* @__PURE__ */ Symbol("FormRenderProps"), Vn = /* @__PURE__ */ Symbol("ComponentRefMap"), On = (e) => {
|
|
1735
|
+
ze(xt, e);
|
|
1736
|
+
}, Ie = () => {
|
|
1737
|
+
const e = Me(xt);
|
|
1738
|
+
if (!e)
|
|
1739
|
+
throw new Error(
|
|
1740
|
+
"injectRenderFormProps must be used within provideFormRenderProps"
|
|
1741
|
+
);
|
|
1742
|
+
return e;
|
|
1743
|
+
}, En = (e) => {
|
|
1744
|
+
ze(Vn, e);
|
|
1745
|
+
}, Ct = () => {
|
|
1746
|
+
const e = Ie(), t = b(
|
|
1747
|
+
() => e.layout === "vertical"
|
|
1748
|
+
);
|
|
1749
|
+
return {
|
|
1750
|
+
props: e,
|
|
1751
|
+
isVertical: t,
|
|
1752
|
+
// 转发配置中的映射,方便子组件使用
|
|
1753
|
+
// Forward mappings from config for child components
|
|
1754
|
+
componentBindEventMap: b(() => e.config?.modelPropNameMap)
|
|
1755
|
+
// 这里如果需要 componentMap,通常从 config.ts 或 props 传递,
|
|
1756
|
+
// 但在原参考代码中是通过 import 的。为了解耦,这里可以不返回,
|
|
1757
|
+
// 或者在 Form.vue 中处理。
|
|
1758
|
+
// In reference code, componentMap is imported. We can stick to that.
|
|
1759
|
+
};
|
|
1760
|
+
}, $t = /* @__PURE__ */ Symbol("FormPropsKey");
|
|
1761
|
+
function _t(e) {
|
|
1762
|
+
ze($t, e);
|
|
1763
|
+
}
|
|
1764
|
+
function Bn() {
|
|
1765
|
+
const e = Me($t);
|
|
1766
|
+
if (!e)
|
|
1767
|
+
throw new Error("Form context not found (表单上下文未找到,请确保在 SunnyForm 或 SunnyUseForm 内部使用)");
|
|
1768
|
+
return e;
|
|
1769
|
+
}
|
|
1770
|
+
function An(e) {
|
|
1771
|
+
const t = jt(), o = b(() => {
|
|
1772
|
+
const s = p(e), a = {};
|
|
1773
|
+
return (s.schema || []).forEach((l) => {
|
|
1774
|
+
l.defaultValue !== void 0 && (a[l.fieldName] = l.defaultValue);
|
|
1775
|
+
}), s.values && Object.assign(a, s.values), a;
|
|
1776
|
+
}), n = yt({
|
|
1777
|
+
initialValues: o.value
|
|
1778
|
+
}), r = b(() => {
|
|
1779
|
+
const s = [];
|
|
1780
|
+
for (const a of Object.keys(t))
|
|
1781
|
+
a !== "default" && s.push(a);
|
|
1782
|
+
return s;
|
|
1783
|
+
});
|
|
1784
|
+
return {
|
|
1785
|
+
form: n,
|
|
1786
|
+
delegatedSlots: r
|
|
1787
|
+
};
|
|
1788
|
+
}
|
|
1789
|
+
const Rn = {
|
|
1790
|
+
Input: Zt,
|
|
1791
|
+
InputPassword: Xt,
|
|
1792
|
+
InputNumber: Kt,
|
|
1793
|
+
Textarea: Yt,
|
|
1794
|
+
Select: Re,
|
|
1795
|
+
Checkbox: ve,
|
|
1796
|
+
CheckboxGroup: qt,
|
|
1797
|
+
Radio: Je,
|
|
1798
|
+
RadioGroup: Gt,
|
|
1799
|
+
Switch: Qe,
|
|
1800
|
+
DatePicker: Ze,
|
|
1801
|
+
RangePicker: Wt,
|
|
1802
|
+
TimePicker: Xe,
|
|
1803
|
+
Upload: Ae,
|
|
1804
|
+
Rate: Ht,
|
|
1805
|
+
Slider: Ut,
|
|
1806
|
+
Cascader: Dt,
|
|
1807
|
+
TreeSelect: It,
|
|
1808
|
+
// Mentions,
|
|
1809
|
+
// Alias for prefix if needed, or map to same
|
|
1810
|
+
SunnySelect: Re,
|
|
1811
|
+
SunnyCheckbox: ve,
|
|
1812
|
+
SunnyRadio: Je,
|
|
1813
|
+
SunnySwitch: Qe,
|
|
1814
|
+
SunnyDatePicker: Ze,
|
|
1815
|
+
SunnyTimePicker: Xe,
|
|
1816
|
+
SunnyUpload: Ae
|
|
1817
|
+
}, Tn = {};
|
|
1818
|
+
function Us(e) {
|
|
1819
|
+
const { config: t, defineRules: o } = e, {
|
|
1820
|
+
// 默认禁用 change 事件监听 (Arco 组件通常不需要手动监听 change)
|
|
1821
|
+
// Default disable change listener (Arco components usually don't need manual change listener)
|
|
1822
|
+
disabledOnChangeListener: n = !0,
|
|
1823
|
+
// 默认禁用 input 事件监听 (避免频繁触发)
|
|
1824
|
+
// Default disable input listener (Avoid frequent triggering)
|
|
1825
|
+
disabledOnInputListener: r = !0,
|
|
1826
|
+
// 空状态时的默认值 (通常为 undefined)
|
|
1827
|
+
// Default value for empty state (Usually undefined)
|
|
1828
|
+
emptyStateValue: s = void 0
|
|
1829
|
+
} = t || {};
|
|
1830
|
+
if (Object.assign(Tn, {
|
|
1831
|
+
disabledOnChangeListener: n,
|
|
1832
|
+
disabledOnInputListener: r,
|
|
1833
|
+
emptyStateValue: s
|
|
1834
|
+
}), o)
|
|
1835
|
+
for (const a of Object.keys(o))
|
|
1836
|
+
vo(a, o[a]);
|
|
1837
|
+
}
|
|
1838
|
+
function jn(e) {
|
|
1839
|
+
const t = gt(), n = Ie().form;
|
|
1840
|
+
if (!t)
|
|
1841
|
+
throw new Error("useDependencies should be used within <SunnyForm> (VeeValidate Form)");
|
|
1842
|
+
const r = M(!0), s = M(!1), a = M(!0), l = M(!1), m = M({}), y = M(), v = b(() => (e()?.triggerFields ?? []).map((c) => t.value[c])), i = () => {
|
|
1843
|
+
s.value = !1, r.value = !0, a.value = !0, l.value = !1, y.value = void 0, m.value = {};
|
|
1844
|
+
};
|
|
1845
|
+
return U(
|
|
1846
|
+
[v, e],
|
|
1847
|
+
async ([u, c]) => {
|
|
1848
|
+
if (!c || !c?.triggerFields?.length)
|
|
1849
|
+
return;
|
|
1850
|
+
i();
|
|
1851
|
+
const {
|
|
1852
|
+
componentProps: h,
|
|
1853
|
+
disabled: g,
|
|
1854
|
+
if: S,
|
|
1855
|
+
required: F,
|
|
1856
|
+
rules: C,
|
|
1857
|
+
show: x,
|
|
1858
|
+
trigger: B
|
|
1859
|
+
// 自定义触发器
|
|
1860
|
+
} = c, d = t.value;
|
|
1861
|
+
if (I(S)) {
|
|
1862
|
+
if (r.value = !!await S(d, n), !r.value) return;
|
|
1863
|
+
} else if (ke(S) && (r.value = S, !r.value))
|
|
1864
|
+
return;
|
|
1865
|
+
if (I(x)) {
|
|
1866
|
+
if (a.value = !!await x(d, n), !a.value) return;
|
|
1867
|
+
} else if (ke(x) && (a.value = x, !a.value))
|
|
1868
|
+
return;
|
|
1869
|
+
I(h) && (m.value = await h(d, n)), I(C) && (y.value = await C(d, n)), I(g) ? s.value = !!await g(d, n) : ke(g) && (s.value = g), I(F) && (l.value = !!await F(d, n)), I(B) && await B(d, n);
|
|
1870
|
+
},
|
|
1871
|
+
{ deep: !0, immediate: !0 }
|
|
1872
|
+
), {
|
|
1873
|
+
dynamicComponentProps: m,
|
|
1874
|
+
dynamicRules: y,
|
|
1875
|
+
isDisabled: s,
|
|
1876
|
+
isIf: r,
|
|
1877
|
+
isRequired: l,
|
|
1878
|
+
isShow: a
|
|
1879
|
+
};
|
|
1880
|
+
}
|
|
1881
|
+
const Mn = /* @__PURE__ */ O({
|
|
1882
|
+
__name: "FormField",
|
|
1883
|
+
props: {
|
|
1884
|
+
schema: {}
|
|
1885
|
+
},
|
|
1886
|
+
setup(e) {
|
|
1887
|
+
const t = e, o = gt(), n = Ie(), { isVertical: r } = Ct(), s = n.form, {
|
|
1888
|
+
dynamicComponentProps: a,
|
|
1889
|
+
// 动态组件属性
|
|
1890
|
+
dynamicRules: l,
|
|
1891
|
+
// 动态验证规则
|
|
1892
|
+
isDisabled: m,
|
|
1893
|
+
// 是否禁用
|
|
1894
|
+
isIf: y,
|
|
1895
|
+
// 是否渲染 (v-if)
|
|
1896
|
+
isRequired: v,
|
|
1897
|
+
// 是否必填
|
|
1898
|
+
isShow: i
|
|
1899
|
+
// 是否显示 (v-show)
|
|
1900
|
+
} = jn(() => t.schema.dependencies), u = b(() => {
|
|
1901
|
+
const { component: d } = t.schema;
|
|
1902
|
+
return ie(d) && Rn[d] || d;
|
|
1903
|
+
}), c = b(() => t.schema.hidden ? !1 : y.value && i.value), h = b(() => l.value || t.schema.rules), g = b(() => {
|
|
1904
|
+
if (!c.value)
|
|
1905
|
+
return !1;
|
|
1906
|
+
if (!h.value)
|
|
1907
|
+
return v.value;
|
|
1908
|
+
if (v.value)
|
|
1909
|
+
return !0;
|
|
1910
|
+
if (ie(h.value))
|
|
1911
|
+
return h.value.split("|").some(
|
|
1912
|
+
(P) => ["required", "selectRequired"].includes(P)
|
|
1913
|
+
);
|
|
1914
|
+
const d = G(h.value);
|
|
1915
|
+
let f = d?.isOptional?.();
|
|
1916
|
+
if (d?._def?.typeName === "ZodDefault") {
|
|
1917
|
+
const P = d?._def.innerType;
|
|
1918
|
+
P && (f = P.isOptional?.());
|
|
1919
|
+
}
|
|
1920
|
+
return !f;
|
|
1921
|
+
}), S = b(() => {
|
|
1922
|
+
if (!c.value)
|
|
1923
|
+
return null;
|
|
1924
|
+
let d = G(h.value);
|
|
1925
|
+
if (!d)
|
|
1926
|
+
return v.value ? "required" : null;
|
|
1927
|
+
if (ie(d))
|
|
1928
|
+
return d;
|
|
1929
|
+
if (!!g.value) {
|
|
1930
|
+
const k = d?.unwrap?.();
|
|
1931
|
+
k && (d = k);
|
|
1932
|
+
}
|
|
1933
|
+
return bo(d);
|
|
1934
|
+
}), F = b(() => {
|
|
1935
|
+
const { componentProps: d, commonComponentProps: f } = t.schema, k = I(d) ? d(o.value, s) : d;
|
|
1936
|
+
return {
|
|
1937
|
+
...f,
|
|
1938
|
+
...k,
|
|
1939
|
+
...a.value
|
|
1940
|
+
};
|
|
1941
|
+
});
|
|
1942
|
+
U(
|
|
1943
|
+
() => F.value?.autofocus,
|
|
1944
|
+
(d) => {
|
|
1945
|
+
d === !0 && ge(() => {
|
|
1946
|
+
});
|
|
1947
|
+
},
|
|
1948
|
+
{ immediate: !0 }
|
|
1949
|
+
);
|
|
1950
|
+
const C = b(() => m.value || t.schema.disabled || F.value?.disabled), x = b(() => {
|
|
1951
|
+
if (!(r.value || !t.schema.labelWidth))
|
|
1952
|
+
return {
|
|
1953
|
+
style: {
|
|
1954
|
+
flex: 1
|
|
1955
|
+
}
|
|
1956
|
+
};
|
|
1957
|
+
}), B = b(() => {
|
|
1958
|
+
if (r.value || !t.schema.labelWidth)
|
|
1959
|
+
return;
|
|
1960
|
+
const d = t.schema.labelWidth, f = typeof d == "number" ? `${d}px` : d;
|
|
1961
|
+
return {
|
|
1962
|
+
style: {
|
|
1963
|
+
width: f,
|
|
1964
|
+
minWidth: f,
|
|
1965
|
+
maxWidth: f,
|
|
1966
|
+
flex: `0 0 ${f}`
|
|
1967
|
+
}
|
|
1968
|
+
};
|
|
1969
|
+
});
|
|
1970
|
+
return (d, f) => {
|
|
1971
|
+
const k = W("a-form-item");
|
|
1972
|
+
return c.value ? (w(), V(p(yo), {
|
|
1973
|
+
key: 0,
|
|
1974
|
+
name: e.schema.fieldName,
|
|
1975
|
+
rules: S.value,
|
|
1976
|
+
label: e.schema.label
|
|
1977
|
+
}, {
|
|
1978
|
+
default: $(({ field: P, errorMessage: A }) => [
|
|
1979
|
+
E(k, L({
|
|
1980
|
+
label: e.schema.label,
|
|
1981
|
+
help: A || e.schema.help,
|
|
1982
|
+
"validate-status": A ? "error" : void 0,
|
|
1983
|
+
required: g.value,
|
|
1984
|
+
"label-col-props": B.value,
|
|
1985
|
+
"wrapper-col-props": x.value
|
|
1986
|
+
}, e.schema.formFieldProps), {
|
|
1987
|
+
default: $(() => [
|
|
1988
|
+
(w(), V(mt(u.value), L({ ...F.value, ...P }, {
|
|
1989
|
+
disabled: C.value,
|
|
1990
|
+
"model-value": P.value,
|
|
1991
|
+
"onUpdate:modelValue": P.onInput
|
|
1992
|
+
}), null, 16, ["disabled", "model-value", "onUpdate:modelValue"]))
|
|
1993
|
+
]),
|
|
1994
|
+
_: 2
|
|
1995
|
+
}, 1040, ["label", "help", "validate-status", "required", "label-col-props", "wrapper-col-props"])
|
|
1996
|
+
]),
|
|
1997
|
+
_: 1
|
|
1998
|
+
}, 8, ["name", "rules", "label"])) : z("", !0);
|
|
1999
|
+
};
|
|
2000
|
+
}
|
|
2001
|
+
}), je = /* @__PURE__ */ O({
|
|
2002
|
+
__name: "form-actions",
|
|
2003
|
+
props: {
|
|
2004
|
+
modelValue: { type: Boolean },
|
|
2005
|
+
formApi: {}
|
|
2006
|
+
},
|
|
2007
|
+
emits: ["update:modelValue"],
|
|
2008
|
+
setup(e, { expose: t, emit: o }) {
|
|
2009
|
+
const n = e, r = o, { props: s } = Ct(), a = go(), l = b({
|
|
2010
|
+
get: () => n.modelValue ?? !1,
|
|
2011
|
+
set: (c) => r("update:modelValue", c)
|
|
2012
|
+
}), m = b(() => ({
|
|
2013
|
+
content: "重置",
|
|
2014
|
+
show: !0,
|
|
2015
|
+
type: "outline",
|
|
2016
|
+
...p(s).resetButtonOptions
|
|
2017
|
+
})), y = b(() => ({
|
|
2018
|
+
content: "查询",
|
|
2019
|
+
show: !0,
|
|
2020
|
+
// 如果有 formApi,使用普通按钮类型,手动触发提交逻辑
|
|
2021
|
+
// 否则使用 submit 类型,利用表单的原生提交机制
|
|
2022
|
+
htmlType: n.formApi ? "button" : "submit",
|
|
2023
|
+
...p(s).submitButtonOptions
|
|
2024
|
+
}));
|
|
2025
|
+
async function v(c) {
|
|
2026
|
+
if (n.formApi) {
|
|
2027
|
+
c?.preventDefault(), c?.stopPropagation();
|
|
2028
|
+
const h = p(s), { valid: g } = await n.formApi.validate();
|
|
2029
|
+
if (!g)
|
|
2030
|
+
return;
|
|
2031
|
+
const S = G(await n.formApi.getValues()) ?? {};
|
|
2032
|
+
await h.handleSubmit?.(S);
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
async function i(c) {
|
|
2036
|
+
c?.preventDefault(), c?.stopPropagation();
|
|
2037
|
+
const h = p(s);
|
|
2038
|
+
if (n.formApi) {
|
|
2039
|
+
const g = G(await n.formApi.getValues()) ?? {};
|
|
2040
|
+
h.handleReset ? await h.handleReset(g) : n.formApi.resetForm();
|
|
2041
|
+
} else if (a)
|
|
2042
|
+
if (h.handleReset) {
|
|
2043
|
+
const g = a.values;
|
|
2044
|
+
await h.handleReset(g);
|
|
2045
|
+
} else
|
|
2046
|
+
a.resetForm();
|
|
2047
|
+
}
|
|
2048
|
+
U(
|
|
2049
|
+
() => l.value,
|
|
2050
|
+
() => {
|
|
2051
|
+
p(s).collapseTriggerResize && window.dispatchEvent(new Event("resize"));
|
|
2052
|
+
}
|
|
2053
|
+
);
|
|
2054
|
+
const u = b(() => {
|
|
2055
|
+
const c = p(s), h = c.actionPosition || "right", g = [
|
|
2056
|
+
"flex",
|
|
2057
|
+
"items-center",
|
|
2058
|
+
"gap-3",
|
|
2059
|
+
// 垂直布局时靠右,水平布局时靠左 (默认)
|
|
2060
|
+
c.layout === "vertical" ? "self-end" : "self-start",
|
|
2061
|
+
// 行内布局不需要宽度,其他情况占满
|
|
2062
|
+
c.layout === "inline" ? "" : "w-full",
|
|
2063
|
+
// 用户自定义类名
|
|
2064
|
+
c.actionWrapperClass
|
|
2065
|
+
];
|
|
2066
|
+
switch (h) {
|
|
2067
|
+
case "center": {
|
|
2068
|
+
g.push("justify-center");
|
|
2069
|
+
break;
|
|
2070
|
+
}
|
|
2071
|
+
case "left": {
|
|
2072
|
+
g.push("justify-start");
|
|
2073
|
+
break;
|
|
2074
|
+
}
|
|
2075
|
+
default: {
|
|
2076
|
+
g.push("justify-end");
|
|
2077
|
+
break;
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
return g.join(" ");
|
|
2081
|
+
});
|
|
2082
|
+
return t({
|
|
2083
|
+
handleReset: i,
|
|
2084
|
+
handleSubmit: v
|
|
2085
|
+
}), (c, h) => (w(), R("div", {
|
|
2086
|
+
class: N(u.value)
|
|
2087
|
+
}, [
|
|
2088
|
+
p(p(s)).actionButtonsReverse ? z("", !0) : (w(), R(ce, { key: 0 }, [
|
|
2089
|
+
j(c.$slots, "submit-before"),
|
|
2090
|
+
y.value.show ? (w(), V(p(le), L({
|
|
2091
|
+
key: 0,
|
|
2092
|
+
type: "primary",
|
|
2093
|
+
size: p(p(s)).size,
|
|
2094
|
+
onClick: v
|
|
2095
|
+
}, y.value), {
|
|
2096
|
+
default: $(() => [
|
|
2097
|
+
D(T(y.value.content), 1)
|
|
2098
|
+
]),
|
|
2099
|
+
_: 1
|
|
2100
|
+
}, 16, ["size"])) : z("", !0)
|
|
2101
|
+
], 64)),
|
|
2102
|
+
j(c.$slots, "reset-before"),
|
|
2103
|
+
m.value.show ? (w(), V(p(le), L({
|
|
2104
|
+
key: 1,
|
|
2105
|
+
size: p(p(s)).size,
|
|
2106
|
+
onClick: i
|
|
2107
|
+
}, m.value), {
|
|
2108
|
+
default: $(() => [
|
|
2109
|
+
D(T(m.value.content), 1)
|
|
2110
|
+
]),
|
|
2111
|
+
_: 1
|
|
2112
|
+
}, 16, ["size"])) : z("", !0),
|
|
2113
|
+
p(p(s)).actionButtonsReverse ? (w(), R(ce, { key: 2 }, [
|
|
2114
|
+
j(c.$slots, "submit-before"),
|
|
2115
|
+
y.value.show ? (w(), V(p(le), L({
|
|
2116
|
+
key: 0,
|
|
2117
|
+
type: "primary",
|
|
2118
|
+
size: p(p(s)).size,
|
|
2119
|
+
onClick: v
|
|
2120
|
+
}, y.value), {
|
|
2121
|
+
default: $(() => [
|
|
2122
|
+
D(T(y.value.content), 1)
|
|
2123
|
+
]),
|
|
2124
|
+
_: 1
|
|
2125
|
+
}, 16, ["size"])) : z("", !0)
|
|
2126
|
+
], 64)) : z("", !0),
|
|
2127
|
+
j(c.$slots, "expand-before"),
|
|
2128
|
+
p(p(s)).showCollapseButton ? (w(), R("div", {
|
|
2129
|
+
key: 3,
|
|
2130
|
+
class: "cursor-pointer ml-2 text-primary hover:opacity-80 transition-opacity select-none",
|
|
2131
|
+
onClick: h[0] || (h[0] = (g) => l.value = !l.value)
|
|
2132
|
+
}, [
|
|
2133
|
+
_("span", null, T(l.value ? "展开" : "收起"), 1)
|
|
2134
|
+
])) : z("", !0),
|
|
2135
|
+
j(c.$slots, "expand-after")
|
|
2136
|
+
], 2));
|
|
2137
|
+
}
|
|
2138
|
+
});
|
|
2139
|
+
function zn(e) {
|
|
2140
|
+
const o = mo({
|
|
2141
|
+
xs: 576,
|
|
2142
|
+
sm: 576,
|
|
2143
|
+
md: 768,
|
|
2144
|
+
lg: 992,
|
|
2145
|
+
xl: 1200,
|
|
2146
|
+
xxl: 1600
|
|
2147
|
+
}), n = b(() => {
|
|
2148
|
+
const l = {}, m = e.schema || [], y = s(), v = e.commonConfig?.colProps;
|
|
2149
|
+
return m.forEach((i) => {
|
|
2150
|
+
if (!i.fieldName) return;
|
|
2151
|
+
const u = i.colProps || v;
|
|
2152
|
+
l[i.fieldName] = a(u, i.colSpan, y);
|
|
2153
|
+
}), l;
|
|
2154
|
+
}), r = b(() => {
|
|
2155
|
+
const l = s();
|
|
2156
|
+
if (e.layout !== "inline") {
|
|
2157
|
+
if (e.actionColProps)
|
|
2158
|
+
return a(e.actionColProps, void 0, l);
|
|
2159
|
+
if (e.showCollapseButton) {
|
|
2160
|
+
const m = e.commonConfig?.colProps;
|
|
2161
|
+
return a(m || { xs: 12, sm: 12, md: 8, lg: 6 }, void 0, l);
|
|
2162
|
+
}
|
|
2163
|
+
return 24;
|
|
2164
|
+
}
|
|
2165
|
+
});
|
|
2166
|
+
function s() {
|
|
2167
|
+
return o.greaterOrEqual("xxl").value ? "xxl" : o.greaterOrEqual("xl").value ? "xl" : o.greaterOrEqual("lg").value ? "lg" : o.greaterOrEqual("md").value ? "md" : o.greaterOrEqual("sm").value ? "sm" : "xs";
|
|
2168
|
+
}
|
|
2169
|
+
function a(l, m, y) {
|
|
2170
|
+
if (l) {
|
|
2171
|
+
const v = ["xxl", "xl", "lg", "md", "sm", "xs"], i = v.indexOf(y);
|
|
2172
|
+
for (let u = i; u < v.length; u++) {
|
|
2173
|
+
const c = v[u], h = l[c];
|
|
2174
|
+
if (h !== void 0)
|
|
2175
|
+
return typeof h == "object" ? h.span ?? 24 : h;
|
|
2176
|
+
}
|
|
2177
|
+
if (l.span !== void 0)
|
|
2178
|
+
return l.span;
|
|
2179
|
+
}
|
|
2180
|
+
return m !== void 0 ? m : 24;
|
|
2181
|
+
}
|
|
2182
|
+
return { spans: n, actionSpan: r };
|
|
2183
|
+
}
|
|
2184
|
+
const Ft = /* @__PURE__ */ O({
|
|
2185
|
+
__name: "Form",
|
|
2186
|
+
props: {
|
|
2187
|
+
formApi: {},
|
|
2188
|
+
form: {}
|
|
2189
|
+
},
|
|
2190
|
+
setup(e) {
|
|
2191
|
+
const t = e, o = Bn(), n = pt({ ...o.value });
|
|
2192
|
+
U(
|
|
2193
|
+
() => o.value,
|
|
2194
|
+
(C) => {
|
|
2195
|
+
Object.assign(n, C);
|
|
2196
|
+
},
|
|
2197
|
+
{ deep: !0 }
|
|
2198
|
+
// 深度监听,确保对象内部属性变化也能捕获
|
|
2199
|
+
), On(n);
|
|
2200
|
+
const { spans: r, actionSpan: s } = zn(n), a = b(() => {
|
|
2201
|
+
const {
|
|
2202
|
+
commonConfig: C = {},
|
|
2203
|
+
labelWidth: x,
|
|
2204
|
+
schema: B = []
|
|
2205
|
+
} = n, {
|
|
2206
|
+
componentProps: d = {},
|
|
2207
|
+
formFieldProps: f = {},
|
|
2208
|
+
...k
|
|
2209
|
+
} = C, P = { ...k };
|
|
2210
|
+
return x !== void 0 && Object.assign(P, { labelWidth: x }), B.map((A) => ({
|
|
2211
|
+
// 合并策略:全局配置 (Global) < 表单项自身配置 (Item)
|
|
2212
|
+
...P,
|
|
2213
|
+
...A,
|
|
2214
|
+
// 显隐逻辑:只处理 Item 自身配置的 hide 属性
|
|
2215
|
+
// (v-if/v-show 的动态逻辑由 dependencies.ts 处理)
|
|
2216
|
+
hidden: A.hide,
|
|
2217
|
+
// 注入通用组件属性
|
|
2218
|
+
// 注意:这里只是透传,最终合并逻辑在 FormField 组件内部进行
|
|
2219
|
+
commonComponentProps: d,
|
|
2220
|
+
// 合并表单项容器属性 (Wrapper Props)
|
|
2221
|
+
// 直接在此处合并全局配置和局部配置,减少下层组件的计算负担
|
|
2222
|
+
formFieldProps: {
|
|
2223
|
+
...f,
|
|
2224
|
+
...A.formFieldProps || {}
|
|
2225
|
+
},
|
|
2226
|
+
// 显式保留组件原本的 props,防止在合并过程中被意外覆盖
|
|
2227
|
+
componentProps: A.componentProps
|
|
2228
|
+
}));
|
|
2229
|
+
}), l = b(() => n.layout === "inline"), { handleSubmit: m, resetForm: y, setValues: v, values: i, validate: u, errors: c, meta: h } = t.form || yt({
|
|
2230
|
+
// 提取默认值构建初始状态
|
|
2231
|
+
initialValues: a.value.reduce((C, x) => ({ ...C, [x.fieldName]: x.defaultValue }), {})
|
|
2232
|
+
});
|
|
2233
|
+
Le(() => {
|
|
2234
|
+
t.formApi && t.formApi.mount({
|
|
2235
|
+
handleSubmit: m,
|
|
2236
|
+
resetForm: y,
|
|
2237
|
+
setValues: v,
|
|
2238
|
+
values: i,
|
|
2239
|
+
validate: u,
|
|
2240
|
+
errors: c,
|
|
2241
|
+
meta: h
|
|
2242
|
+
});
|
|
2243
|
+
});
|
|
2244
|
+
const g = m((C) => {
|
|
2245
|
+
n.handleSubmit ? n.handleSubmit(C) : console.log("Form submitted:", C);
|
|
2246
|
+
}), S = (C) => {
|
|
2247
|
+
n.collapsed = C, n.handleCollapsedChange?.(C), t.formApi && t.formApi.setState({ collapsed: C });
|
|
2248
|
+
}, F = b(() => {
|
|
2249
|
+
const { compact: C, gridProps: x } = n, B = C ? 8 : 16, d = x?.xGap ?? x?.["x-gap"] ?? B, f = x?.yGap ?? x?.["y-gap"] ?? B;
|
|
2250
|
+
return { x: d, y: f };
|
|
2251
|
+
});
|
|
2252
|
+
return (C, x) => {
|
|
2253
|
+
const B = W("a-col"), d = W("a-form-item"), f = W("a-row"), k = W("a-form");
|
|
2254
|
+
return w(), V(k, {
|
|
2255
|
+
model: {},
|
|
2256
|
+
layout: p(o).layout || "horizontal",
|
|
2257
|
+
size: p(o).size,
|
|
2258
|
+
class: "arco-form",
|
|
2259
|
+
onSubmit: x[0] || (x[0] = (P, A) => p(g)(A))
|
|
2260
|
+
}, {
|
|
2261
|
+
default: $(() => [
|
|
2262
|
+
E(f, {
|
|
2263
|
+
gutter: [F.value.x, F.value.y],
|
|
2264
|
+
class: N(n.wrapperClass)
|
|
2265
|
+
}, {
|
|
2266
|
+
default: $(() => [
|
|
2267
|
+
(w(!0), R(ce, null, Z(a.value, (P, A) => (w(), R(ce, {
|
|
2268
|
+
key: P.fieldName
|
|
2269
|
+
}, [
|
|
2270
|
+
!P.hidden && (!n.collapsed || A < 24 / (p(r)[P.fieldName] ?? 24) * (n.collapsedRows ?? 1) - 1) ? (w(), V(B, {
|
|
2271
|
+
key: 0,
|
|
2272
|
+
span: p(r)[P.fieldName] ?? (l.value ? void 0 : 24)
|
|
2273
|
+
}, {
|
|
2274
|
+
default: $(() => [
|
|
2275
|
+
E(Mn, { schema: P }, null, 8, ["schema"])
|
|
2276
|
+
]),
|
|
2277
|
+
_: 2
|
|
2278
|
+
}, 1032, ["span"])) : z("", !0)
|
|
2279
|
+
], 64))), 128)),
|
|
2280
|
+
n.showDefaultActions ? (w(), V(B, {
|
|
2281
|
+
key: 0,
|
|
2282
|
+
span: p(s),
|
|
2283
|
+
style: X(l.value ? { marginLeft: "16px" } : { flex: 1, textAlign: "right", marginBottom: F.value.y + "px" })
|
|
2284
|
+
}, {
|
|
2285
|
+
default: $(() => [
|
|
2286
|
+
(n.layout || "horizontal") === "vertical" ? (w(), V(d, {
|
|
2287
|
+
key: 0,
|
|
2288
|
+
class: "mb-0",
|
|
2289
|
+
"hide-asterisk": !0
|
|
2290
|
+
}, {
|
|
2291
|
+
label: $(() => [...x[1] || (x[1] = [
|
|
2292
|
+
_("span", { style: { display: "inline-block", width: "100%" } }, " ", -1)
|
|
2293
|
+
])]),
|
|
2294
|
+
default: $(() => [
|
|
2295
|
+
E(je, {
|
|
2296
|
+
"model-value": n.collapsed,
|
|
2297
|
+
"onUpdate:modelValue": S,
|
|
2298
|
+
"form-api": t.formApi
|
|
2299
|
+
}, null, 8, ["model-value", "form-api"])
|
|
2300
|
+
]),
|
|
2301
|
+
_: 1
|
|
2302
|
+
})) : (w(), V(je, {
|
|
2303
|
+
key: 1,
|
|
2304
|
+
"model-value": n.collapsed,
|
|
2305
|
+
"onUpdate:modelValue": S,
|
|
2306
|
+
"form-api": t.formApi
|
|
2307
|
+
}, null, 8, ["model-value", "form-api"]))
|
|
2308
|
+
]),
|
|
2309
|
+
_: 1
|
|
2310
|
+
}, 8, ["span", "style"])) : z("", !0)
|
|
2311
|
+
]),
|
|
2312
|
+
_: 1
|
|
2313
|
+
}, 8, ["gutter", "class"])
|
|
2314
|
+
]),
|
|
2315
|
+
_: 1
|
|
2316
|
+
}, 8, ["layout", "size"]);
|
|
2317
|
+
};
|
|
2318
|
+
}
|
|
2319
|
+
}), Ln = /* @__PURE__ */ O({
|
|
2320
|
+
__name: "SunnyUseForm",
|
|
2321
|
+
props: {
|
|
2322
|
+
layout: {},
|
|
2323
|
+
size: {},
|
|
2324
|
+
schema: {},
|
|
2325
|
+
labelWidth: {},
|
|
2326
|
+
wrapperClass: {},
|
|
2327
|
+
gridProps: {},
|
|
2328
|
+
actionWrapperClass: {},
|
|
2329
|
+
commonConfig: {},
|
|
2330
|
+
showDefaultActions: { type: Boolean, default: void 0 },
|
|
2331
|
+
submitButtonOptions: {},
|
|
2332
|
+
resetButtonOptions: {},
|
|
2333
|
+
submitOnEnter: { type: Boolean, default: void 0 },
|
|
2334
|
+
submitOnChange: { type: Boolean, default: void 0 },
|
|
2335
|
+
handleValuesChange: {},
|
|
2336
|
+
handleCollapsedChange: {},
|
|
2337
|
+
handleSubmit: {},
|
|
2338
|
+
scrollToFirstError: { type: Boolean },
|
|
2339
|
+
handleReset: {},
|
|
2340
|
+
collapsed: { type: Boolean, default: void 0 },
|
|
2341
|
+
showCollapseButton: { type: Boolean, default: void 0 },
|
|
2342
|
+
collapsedRows: {},
|
|
2343
|
+
collapseTriggerResize: { type: Boolean, default: void 0 },
|
|
2344
|
+
compact: { type: Boolean, default: void 0 },
|
|
2345
|
+
actionLayout: {},
|
|
2346
|
+
actionPosition: {},
|
|
2347
|
+
actionColProps: {},
|
|
2348
|
+
values: {},
|
|
2349
|
+
fieldMappingTime: {},
|
|
2350
|
+
arrayToStringFields: {},
|
|
2351
|
+
formApi: {}
|
|
2352
|
+
},
|
|
2353
|
+
setup(e) {
|
|
2354
|
+
const t = e, o = t.formApi.useStore?.() || b(() => ({})), n = b(() => {
|
|
2355
|
+
const v = Object.entries(t).reduce((i, [u, c]) => (c !== void 0 && (i[u] = c), i), {});
|
|
2356
|
+
return { ...o.value, ...v };
|
|
2357
|
+
}), r = /* @__PURE__ */ new Map(), { delegatedSlots: s, form: a } = An(n);
|
|
2358
|
+
_t(n), En(r), ht(() => {
|
|
2359
|
+
t.formApi.unmount();
|
|
2360
|
+
});
|
|
2361
|
+
const l = {};
|
|
2362
|
+
Le(async () => {
|
|
2363
|
+
t.formApi.mount(a, r), t.formApi.setState({ values: me(a.values) }), await ge(), U(
|
|
2364
|
+
() => a.values,
|
|
2365
|
+
async (v) => {
|
|
2366
|
+
if (t.formApi.setState({ values: me(v) }), m(), !n.value.handleValuesChange) return;
|
|
2367
|
+
const i = n.value.schema?.map((c) => c.fieldName) || [];
|
|
2368
|
+
if (i.length === 0) return;
|
|
2369
|
+
const u = [];
|
|
2370
|
+
for (const c of i) {
|
|
2371
|
+
const h = et(v, c), g = et(l, c);
|
|
2372
|
+
ro(h, g) || (u.push(c), so(l, c, h));
|
|
2373
|
+
}
|
|
2374
|
+
if (u.length > 0) {
|
|
2375
|
+
const c = await t.formApi.getValues();
|
|
2376
|
+
n.value.handleValuesChange(
|
|
2377
|
+
me(c ?? {}),
|
|
2378
|
+
u
|
|
2379
|
+
);
|
|
2380
|
+
}
|
|
2381
|
+
},
|
|
2382
|
+
{ deep: !0 }
|
|
2383
|
+
);
|
|
2384
|
+
});
|
|
2385
|
+
const m = ho(async () => {
|
|
2386
|
+
o.value.submitOnChange && await t.formApi.submitForm();
|
|
2387
|
+
}, 300);
|
|
2388
|
+
function y(v) {
|
|
2389
|
+
o.value.submitOnEnter && (v.target instanceof HTMLTextAreaElement || (v.preventDefault(), t.formApi.submitForm()));
|
|
2390
|
+
}
|
|
2391
|
+
return (v, i) => (w(), R("div", {
|
|
2392
|
+
class: N(n.value.wrapperClass)
|
|
2393
|
+
}, [
|
|
2394
|
+
E(Ft, L(n.value, {
|
|
2395
|
+
form: p(a),
|
|
2396
|
+
"form-api": t.formApi,
|
|
2397
|
+
onKeydown: vt(y, ["enter"])
|
|
2398
|
+
}), de({
|
|
2399
|
+
default: $(() => []),
|
|
2400
|
+
_: 2
|
|
2401
|
+
}, [
|
|
2402
|
+
Z(p(s), (u) => ({
|
|
2403
|
+
name: u,
|
|
2404
|
+
fn: $((c) => [
|
|
2405
|
+
j(v.$slots, u, Y(fe(c)))
|
|
2406
|
+
])
|
|
2407
|
+
}))
|
|
2408
|
+
]), 1040, ["form", "form-api"])
|
|
2409
|
+
], 2));
|
|
2410
|
+
}
|
|
2411
|
+
});
|
|
2412
|
+
function Hs(e = {}) {
|
|
2413
|
+
const t = new Pn(e);
|
|
2414
|
+
return t.useStore = (n) => fo(t.store.store, n), Mt(e) && U(
|
|
2415
|
+
() => e.schema,
|
|
2416
|
+
() => {
|
|
2417
|
+
e.schema && t.setState({ schema: e.schema });
|
|
2418
|
+
},
|
|
2419
|
+
{
|
|
2420
|
+
// 性能优化 / Performance Optimization:
|
|
2421
|
+
// 关闭 deep: true 以避免大表单时的性能损耗。
|
|
2422
|
+
// Disable deep: true to avoid performance cost on large forms.
|
|
2423
|
+
//
|
|
2424
|
+
// 变更检测 / Change Detection:
|
|
2425
|
+
// 如果需要更新 schema,请使用不可变数据模式(替换整个数组)或调用 api.updateSchema()。
|
|
2426
|
+
// If you need to update schema, use immutable pattern (replace array) or call api.updateSchema().
|
|
2427
|
+
immediate: !0
|
|
2428
|
+
}
|
|
2429
|
+
), [O({
|
|
2430
|
+
name: "useSunnyFormWrapper",
|
|
2431
|
+
setup(n, { attrs: r, slots: s }) {
|
|
2432
|
+
return t.setState({ ...n, ...r }), () => ye(Ln, {
|
|
2433
|
+
// 1. ...props & ...attrs: 注入组件接收到的属性
|
|
2434
|
+
// Inject props and attrs received by the component
|
|
2435
|
+
...n,
|
|
2436
|
+
...r,
|
|
2437
|
+
// 2. formApi: 注入 API 实例,供子组件调用
|
|
2438
|
+
// Inject API instance for child components to call
|
|
2439
|
+
formApi: t
|
|
2440
|
+
}, s);
|
|
2441
|
+
}
|
|
2442
|
+
}), t];
|
|
2443
|
+
}
|
|
2444
|
+
const Ws = /* @__PURE__ */ O({
|
|
2445
|
+
__name: "SunnyForm",
|
|
2446
|
+
props: {
|
|
2447
|
+
layout: {},
|
|
2448
|
+
size: {},
|
|
2449
|
+
schema: {},
|
|
2450
|
+
labelWidth: {},
|
|
2451
|
+
wrapperClass: {},
|
|
2452
|
+
gridProps: {},
|
|
2453
|
+
actionWrapperClass: {},
|
|
2454
|
+
commonConfig: {},
|
|
2455
|
+
showDefaultActions: { type: Boolean },
|
|
2456
|
+
submitButtonOptions: {},
|
|
2457
|
+
resetButtonOptions: {},
|
|
2458
|
+
submitOnEnter: { type: Boolean },
|
|
2459
|
+
submitOnChange: { type: Boolean },
|
|
2460
|
+
handleValuesChange: { type: Function },
|
|
2461
|
+
handleCollapsedChange: { type: Function },
|
|
2462
|
+
handleSubmit: { type: Function },
|
|
2463
|
+
scrollToFirstError: { type: Boolean },
|
|
2464
|
+
handleReset: { type: Function },
|
|
2465
|
+
collapsed: { type: Boolean },
|
|
2466
|
+
showCollapseButton: { type: Boolean },
|
|
2467
|
+
collapsedRows: {},
|
|
2468
|
+
collapseTriggerResize: { type: Boolean },
|
|
2469
|
+
compact: { type: Boolean },
|
|
2470
|
+
actionLayout: {},
|
|
2471
|
+
actionPosition: {},
|
|
2472
|
+
actionColProps: {},
|
|
2473
|
+
values: {},
|
|
2474
|
+
fieldMappingTime: {},
|
|
2475
|
+
arrayToStringFields: {}
|
|
2476
|
+
},
|
|
2477
|
+
emits: ["submit", "reset", "update:collapsed"],
|
|
2478
|
+
setup(e, { emit: t }) {
|
|
2479
|
+
const o = e, n = t, r = b(() => o);
|
|
2480
|
+
_t(r);
|
|
2481
|
+
const s = (l) => {
|
|
2482
|
+
n("update:collapsed", l), o.handleCollapsedChange?.(l);
|
|
2483
|
+
}, a = (l) => {
|
|
2484
|
+
n("submit", l), o.handleSubmit?.(l);
|
|
2485
|
+
};
|
|
2486
|
+
return (l, m) => (w(), R("div", {
|
|
2487
|
+
class: N(o.wrapperClass)
|
|
2488
|
+
}, [
|
|
2489
|
+
E(Ft, { onSubmit: a }, {
|
|
2490
|
+
default: $(() => [
|
|
2491
|
+
o.showDefaultActions ? (w(), V(je, {
|
|
2492
|
+
key: 0,
|
|
2493
|
+
"model-value": o.collapsed,
|
|
2494
|
+
"onUpdate:modelValue": s
|
|
2495
|
+
}, {
|
|
2496
|
+
"reset-before": $(() => [
|
|
2497
|
+
j(l.$slots, "reset-before")
|
|
2498
|
+
]),
|
|
2499
|
+
"submit-before": $(() => [
|
|
2500
|
+
j(l.$slots, "submit-before")
|
|
2501
|
+
]),
|
|
2502
|
+
"expand-before": $(() => [
|
|
2503
|
+
j(l.$slots, "expand-before")
|
|
2504
|
+
]),
|
|
2505
|
+
"expand-after": $(() => [
|
|
2506
|
+
j(l.$slots, "expand-after")
|
|
2507
|
+
]),
|
|
2508
|
+
_: 3
|
|
2509
|
+
}, 8, ["model-value"])) : z("", !0)
|
|
2510
|
+
]),
|
|
2511
|
+
_: 3
|
|
2512
|
+
})
|
|
2513
|
+
], 2));
|
|
2514
|
+
}
|
|
2515
|
+
});
|
|
2516
|
+
let Nn = class {
|
|
2517
|
+
gridRef;
|
|
2518
|
+
options;
|
|
2519
|
+
constructor(t, o) {
|
|
2520
|
+
this.gridRef = t, this.options = o;
|
|
2521
|
+
}
|
|
2522
|
+
get grid() {
|
|
2523
|
+
return this.gridRef.value?.getGrid?.() || this.gridRef.value;
|
|
2524
|
+
}
|
|
2525
|
+
/**
|
|
2526
|
+
* 新增数据
|
|
2527
|
+
* @param params
|
|
2528
|
+
* @returns
|
|
2529
|
+
*/
|
|
2530
|
+
async addEvent(t = {}) {
|
|
2531
|
+
const o = this.grid;
|
|
2532
|
+
if (o) {
|
|
2533
|
+
const { record: n = {}, index: r = -1 } = t, { row: s } = await o.insertAt(n, r);
|
|
2534
|
+
await ge(), o.setEditRow(s);
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
/**
|
|
2538
|
+
* 删除选中行
|
|
2539
|
+
*/
|
|
2540
|
+
async deleteSelection() {
|
|
2541
|
+
const t = this.grid;
|
|
2542
|
+
if (t) {
|
|
2543
|
+
const o = t.getCheckboxRecords();
|
|
2544
|
+
o.length > 0 && await t.remove(o);
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
};
|
|
2548
|
+
const In = /* @__PURE__ */ O({
|
|
2549
|
+
__name: "use-vxe-grid",
|
|
2550
|
+
setup(e, { expose: t }) {
|
|
2551
|
+
const o = M();
|
|
2552
|
+
return t({
|
|
2553
|
+
getGrid: () => o.value
|
|
2554
|
+
}), (n, r) => (w(), V(p(bt), L({
|
|
2555
|
+
ref_key: "gridRef",
|
|
2556
|
+
ref: o
|
|
2557
|
+
}, n.$attrs), de({ _: 2 }, [
|
|
2558
|
+
Z(n.$slots, (s, a) => ({
|
|
2559
|
+
name: a,
|
|
2560
|
+
fn: $((l) => [
|
|
2561
|
+
j(n.$slots, a, Y(fe(l || {})))
|
|
2562
|
+
])
|
|
2563
|
+
}))
|
|
2564
|
+
]), 1040));
|
|
2565
|
+
}
|
|
2566
|
+
});
|
|
2567
|
+
function qs(e) {
|
|
2568
|
+
const t = M(), o = new Nn(t, e);
|
|
2569
|
+
return [O(
|
|
2570
|
+
(r, { attrs: s, slots: a }) => {
|
|
2571
|
+
const { gridEvents: l, gridOptions: m } = e, y = Object.entries(l || {}).reduce((v, [i, u]) => {
|
|
2572
|
+
const c = `on${i.charAt(0).toUpperCase() + i.slice(1)}`;
|
|
2573
|
+
return v[c] = u, v;
|
|
2574
|
+
}, {});
|
|
2575
|
+
return () => ye(In, { ref: t, ...r, ...s, ...m, ...y }, a);
|
|
2576
|
+
}
|
|
2577
|
+
), o];
|
|
2578
|
+
}
|
|
2579
|
+
class Dn {
|
|
2580
|
+
gridRef;
|
|
2581
|
+
options;
|
|
2582
|
+
constructor(t, o) {
|
|
2583
|
+
this.gridRef = t, this.options = o;
|
|
2584
|
+
}
|
|
2585
|
+
get grid() {
|
|
2586
|
+
return this.gridRef.value?.getGrid?.() || this.gridRef.value;
|
|
2587
|
+
}
|
|
2588
|
+
/**
|
|
2589
|
+
* 新增数据
|
|
2590
|
+
* @param params
|
|
2591
|
+
* @returns
|
|
2592
|
+
*/
|
|
2593
|
+
async addEvent(t = {}) {
|
|
2594
|
+
const o = this.grid;
|
|
2595
|
+
if (o) {
|
|
2596
|
+
const { record: n = {}, index: r = -1 } = t, { row: s } = await o.insertAt(n, r);
|
|
2597
|
+
await ge(), o.setEditRow(s);
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2600
|
+
/**
|
|
2601
|
+
* 删除选中行
|
|
2602
|
+
*/
|
|
2603
|
+
async deleteSelection() {
|
|
2604
|
+
const t = this.grid;
|
|
2605
|
+
if (t) {
|
|
2606
|
+
const o = t.getCheckboxRecords();
|
|
2607
|
+
o.length > 0 && await t.remove(o);
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
}
|
|
2611
|
+
function Un(e, t) {
|
|
2612
|
+
let o = null, n = null, r = null, s = null, a = null, l = !1, m = !1;
|
|
2613
|
+
const y = (g) => {
|
|
2614
|
+
if (!g) return window;
|
|
2615
|
+
let S = g.parentElement;
|
|
2616
|
+
for (; S; ) {
|
|
2617
|
+
const F = window.getComputedStyle(S);
|
|
2618
|
+
if (/(auto|scroll)/.test(F.overflow + F.overflowY + F.overflowX))
|
|
2619
|
+
return S;
|
|
2620
|
+
S = S.parentElement;
|
|
2621
|
+
}
|
|
2622
|
+
return window;
|
|
2623
|
+
}, v = () => {
|
|
2624
|
+
o && o.classList.contains("is-sticky") && (o.style.position = "", o.style.top = "", o.style.left = "", o.style.zIndex = "", o.style.width = "", o.classList.remove("is-sticky"), n && n.parentNode && (n.parentNode.removeChild(n), n = null)), s && (s.style.display = "none");
|
|
2625
|
+
}, i = (g) => {
|
|
2626
|
+
m || s && r && (l = !0, s.scrollLeft = r.scrollLeft, requestAnimationFrame(() => {
|
|
2627
|
+
l = !1;
|
|
2628
|
+
}));
|
|
2629
|
+
}, u = (g) => {
|
|
2630
|
+
l || s && r && (m = !0, r.scrollLeft = s.scrollLeft, requestAnimationFrame(() => {
|
|
2631
|
+
m = !1;
|
|
2632
|
+
}));
|
|
2633
|
+
}, c = () => {
|
|
2634
|
+
!e.value || s || (s = document.createElement("div"), s.className = "vxe-table--sticky-scrollbar", s.style.position = "fixed", s.style.bottom = "0", s.style.overflowX = "auto", s.style.overflowY = "hidden", s.style.zIndex = "101", s.style.display = "none", a = document.createElement("div"), s.appendChild(a), s.addEventListener("scroll", u), document.body.appendChild(s), r = e.value.$el.querySelector(".vxe-table--body-wrapper"), r && r.addEventListener("scroll", i));
|
|
2635
|
+
}, h = () => {
|
|
2636
|
+
if (!e.value || !o) return;
|
|
2637
|
+
if (!t.sticky) {
|
|
2638
|
+
v();
|
|
2639
|
+
return;
|
|
2640
|
+
}
|
|
2641
|
+
const g = e.value.$el, S = g.getBoundingClientRect(), F = o.getBoundingClientRect(), C = y(g);
|
|
2642
|
+
let x = { top: 0, bottom: window.innerHeight };
|
|
2643
|
+
if (C !== window && C instanceof HTMLElement && (x = C.getBoundingClientRect()), x.bottom > 0 && x.top < window.innerHeight && S.top < x.top && S.bottom > F.height) {
|
|
2644
|
+
const d = Math.max(0, x.top);
|
|
2645
|
+
S.bottom - F.height > d ? (!o.classList.contains("is-sticky") || o.style.top !== `${d}px` || o.style.left !== `${S.left}px`) && (o.style.position = "fixed", o.style.top = `${d}px`, o.style.left = `${S.left}px`, o.style.width = `${S.width}px`, o.style.zIndex = "100", o.classList.add("is-sticky"), n || (n = document.createElement("div"), o.parentNode?.insertBefore(n, o)), n.style.height = `${F.height}px`) : v();
|
|
2646
|
+
} else
|
|
2647
|
+
o.classList.contains("is-sticky") && (o.style.position = "", o.style.top = "", o.style.left = "", o.style.width = "", o.classList.remove("is-sticky"), n && n.parentNode && (n.parentNode.removeChild(n), n = null));
|
|
2648
|
+
if ((!s || !r) && c(), s && r && a) {
|
|
2649
|
+
const d = r.scrollWidth, f = r.clientWidth;
|
|
2650
|
+
if (d > f) {
|
|
2651
|
+
const k = window.innerHeight;
|
|
2652
|
+
S.bottom > k && S.top < k ? (s.style.display = "block", s.style.width = `${S.width}px`, s.style.left = `${S.left}px`, a.style.width = `${d}px`, Math.abs(s.scrollLeft - r.scrollLeft) > 1 && (s.scrollLeft = r.scrollLeft)) : s.style.display = "none";
|
|
2653
|
+
} else
|
|
2654
|
+
s.style.display = "none";
|
|
2655
|
+
}
|
|
2656
|
+
};
|
|
2657
|
+
U(() => t.sticky, () => {
|
|
2658
|
+
h();
|
|
2659
|
+
}), Le(() => {
|
|
2660
|
+
setTimeout(() => {
|
|
2661
|
+
e.value && (o = e.value.$el.querySelector(".vxe-table--header-wrapper"), o && (window.addEventListener("scroll", h, !0), window.addEventListener("resize", h)), c());
|
|
2662
|
+
}, 100);
|
|
2663
|
+
}), ht(() => {
|
|
2664
|
+
window.removeEventListener("scroll", h, !0), window.removeEventListener("resize", h), n && n.parentNode && n.parentNode.removeChild(n), s && s.parentNode && s.parentNode.removeChild(s), r && r.removeEventListener("scroll", i);
|
|
2665
|
+
});
|
|
2666
|
+
}
|
|
2667
|
+
var Hn = typeof global == "object" && global && global.Object === Object && global, Wn = typeof self == "object" && self && self.Object === Object && self, De = Hn || Wn || Function("return this")(), J = De.Symbol, Pt = Object.prototype, Gn = Pt.hasOwnProperty, qn = Pt.toString, se = J ? J.toStringTag : void 0;
|
|
2668
|
+
function Yn(e) {
|
|
2669
|
+
var t = Gn.call(e, se), o = e[se];
|
|
2670
|
+
try {
|
|
2671
|
+
e[se] = void 0;
|
|
2672
|
+
var n = !0;
|
|
2673
|
+
} catch {
|
|
2674
|
+
}
|
|
2675
|
+
var r = qn.call(e);
|
|
2676
|
+
return n && (t ? e[se] = o : delete e[se]), r;
|
|
2677
|
+
}
|
|
2678
|
+
var Kn = Object.prototype, Xn = Kn.toString;
|
|
2679
|
+
function Zn(e) {
|
|
2680
|
+
return Xn.call(e);
|
|
2681
|
+
}
|
|
2682
|
+
var Qn = "[object Null]", Jn = "[object Undefined]", lt = J ? J.toStringTag : void 0;
|
|
2683
|
+
function Ue(e) {
|
|
2684
|
+
return e == null ? e === void 0 ? Jn : Qn : lt && lt in Object(e) ? Yn(e) : Zn(e);
|
|
2685
|
+
}
|
|
2686
|
+
function He(e) {
|
|
2687
|
+
return e != null && typeof e == "object";
|
|
2688
|
+
}
|
|
2689
|
+
var er = "[object Symbol]";
|
|
2690
|
+
function We(e) {
|
|
2691
|
+
return typeof e == "symbol" || He(e) && Ue(e) == er;
|
|
2692
|
+
}
|
|
2693
|
+
function tr(e, t) {
|
|
2694
|
+
for (var o = -1, n = e == null ? 0 : e.length, r = Array(n); ++o < n; )
|
|
2695
|
+
r[o] = t(e[o], o, e);
|
|
2696
|
+
return r;
|
|
2697
|
+
}
|
|
2698
|
+
var be = Array.isArray, it = J ? J.prototype : void 0, ct = it ? it.toString : void 0;
|
|
2699
|
+
function Vt(e) {
|
|
2700
|
+
if (typeof e == "string")
|
|
2701
|
+
return e;
|
|
2702
|
+
if (be(e))
|
|
2703
|
+
return tr(e, Vt) + "";
|
|
2704
|
+
if (We(e))
|
|
2705
|
+
return ct ? ct.call(e) : "";
|
|
2706
|
+
var t = e + "";
|
|
2707
|
+
return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
|
|
2708
|
+
}
|
|
2709
|
+
function Ot(e) {
|
|
2710
|
+
var t = typeof e;
|
|
2711
|
+
return e != null && (t == "object" || t == "function");
|
|
2712
|
+
}
|
|
2713
|
+
var or = "[object AsyncFunction]", nr = "[object Function]", rr = "[object GeneratorFunction]", sr = "[object Proxy]";
|
|
2714
|
+
function ar(e) {
|
|
2715
|
+
if (!Ot(e))
|
|
2716
|
+
return !1;
|
|
2717
|
+
var t = Ue(e);
|
|
2718
|
+
return t == nr || t == rr || t == or || t == sr;
|
|
2719
|
+
}
|
|
2720
|
+
var Oe = De["__core-js_shared__"], ut = (function() {
|
|
2721
|
+
var e = /[^.]+$/.exec(Oe && Oe.keys && Oe.keys.IE_PROTO || "");
|
|
2722
|
+
return e ? "Symbol(src)_1." + e : "";
|
|
2723
|
+
})();
|
|
2724
|
+
function lr(e) {
|
|
2725
|
+
return !!ut && ut in e;
|
|
2726
|
+
}
|
|
2727
|
+
var ir = Function.prototype, cr = ir.toString;
|
|
2728
|
+
function ur(e) {
|
|
2729
|
+
if (e != null) {
|
|
2730
|
+
try {
|
|
2731
|
+
return cr.call(e);
|
|
2732
|
+
} catch {
|
|
2733
|
+
}
|
|
2734
|
+
try {
|
|
2735
|
+
return e + "";
|
|
2736
|
+
} catch {
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
return "";
|
|
2740
|
+
}
|
|
2741
|
+
var dr = /[\\^$.*+?()[\]{}|]/g, fr = /^\[object .+?Constructor\]$/, pr = Function.prototype, mr = Object.prototype, hr = pr.toString, vr = mr.hasOwnProperty, yr = RegExp(
|
|
2742
|
+
"^" + hr.call(vr).replace(dr, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
2743
|
+
);
|
|
2744
|
+
function gr(e) {
|
|
2745
|
+
if (!Ot(e) || lr(e))
|
|
2746
|
+
return !1;
|
|
2747
|
+
var t = ar(e) ? yr : fr;
|
|
2748
|
+
return t.test(ur(e));
|
|
2749
|
+
}
|
|
2750
|
+
function br(e, t) {
|
|
2751
|
+
return e?.[t];
|
|
2752
|
+
}
|
|
2753
|
+
function Et(e, t) {
|
|
2754
|
+
var o = br(e, t);
|
|
2755
|
+
return gr(o) ? o : void 0;
|
|
2756
|
+
}
|
|
2757
|
+
var wr = 9007199254740991, Sr = /^(?:0|[1-9]\d*)$/;
|
|
2758
|
+
function kr(e, t) {
|
|
2759
|
+
var o = typeof e;
|
|
2760
|
+
return t = t ?? wr, !!t && (o == "number" || o != "symbol" && Sr.test(e)) && e > -1 && e % 1 == 0 && e < t;
|
|
2761
|
+
}
|
|
2762
|
+
function xr(e, t) {
|
|
2763
|
+
return e === t || e !== e && t !== t;
|
|
2764
|
+
}
|
|
2765
|
+
var Cr = 9007199254740991;
|
|
2766
|
+
function $r(e) {
|
|
2767
|
+
return typeof e == "number" && e > -1 && e % 1 == 0 && e <= Cr;
|
|
2768
|
+
}
|
|
2769
|
+
var _r = "[object Arguments]";
|
|
2770
|
+
function dt(e) {
|
|
2771
|
+
return He(e) && Ue(e) == _r;
|
|
2772
|
+
}
|
|
2773
|
+
var Bt = Object.prototype, Fr = Bt.hasOwnProperty, Pr = Bt.propertyIsEnumerable, Vr = dt(/* @__PURE__ */ (function() {
|
|
2774
|
+
return arguments;
|
|
2775
|
+
})()) ? dt : function(e) {
|
|
2776
|
+
return He(e) && Fr.call(e, "callee") && !Pr.call(e, "callee");
|
|
2777
|
+
}, Or = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Er = /^\w*$/;
|
|
2778
|
+
function Br(e, t) {
|
|
2779
|
+
if (be(e))
|
|
2780
|
+
return !1;
|
|
2781
|
+
var o = typeof e;
|
|
2782
|
+
return o == "number" || o == "symbol" || o == "boolean" || e == null || We(e) ? !0 : Er.test(e) || !Or.test(e) || t != null && e in Object(t);
|
|
2783
|
+
}
|
|
2784
|
+
var ue = Et(Object, "create");
|
|
2785
|
+
function Ar() {
|
|
2786
|
+
this.__data__ = ue ? ue(null) : {}, this.size = 0;
|
|
2787
|
+
}
|
|
2788
|
+
function Rr(e) {
|
|
2789
|
+
var t = this.has(e) && delete this.__data__[e];
|
|
2790
|
+
return this.size -= t ? 1 : 0, t;
|
|
2791
|
+
}
|
|
2792
|
+
var Tr = "__lodash_hash_undefined__", jr = Object.prototype, Mr = jr.hasOwnProperty;
|
|
2793
|
+
function zr(e) {
|
|
2794
|
+
var t = this.__data__;
|
|
2795
|
+
if (ue) {
|
|
2796
|
+
var o = t[e];
|
|
2797
|
+
return o === Tr ? void 0 : o;
|
|
2798
|
+
}
|
|
2799
|
+
return Mr.call(t, e) ? t[e] : void 0;
|
|
2800
|
+
}
|
|
2801
|
+
var Lr = Object.prototype, Nr = Lr.hasOwnProperty;
|
|
2802
|
+
function Ir(e) {
|
|
2803
|
+
var t = this.__data__;
|
|
2804
|
+
return ue ? t[e] !== void 0 : Nr.call(t, e);
|
|
2805
|
+
}
|
|
2806
|
+
var Dr = "__lodash_hash_undefined__";
|
|
2807
|
+
function Ur(e, t) {
|
|
2808
|
+
var o = this.__data__;
|
|
2809
|
+
return this.size += this.has(e) ? 0 : 1, o[e] = ue && t === void 0 ? Dr : t, this;
|
|
2810
|
+
}
|
|
2811
|
+
function K(e) {
|
|
2812
|
+
var t = -1, o = e == null ? 0 : e.length;
|
|
2813
|
+
for (this.clear(); ++t < o; ) {
|
|
2814
|
+
var n = e[t];
|
|
2815
|
+
this.set(n[0], n[1]);
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
K.prototype.clear = Ar;
|
|
2819
|
+
K.prototype.delete = Rr;
|
|
2820
|
+
K.prototype.get = zr;
|
|
2821
|
+
K.prototype.has = Ir;
|
|
2822
|
+
K.prototype.set = Ur;
|
|
2823
|
+
function Hr() {
|
|
2824
|
+
this.__data__ = [], this.size = 0;
|
|
2825
|
+
}
|
|
2826
|
+
function we(e, t) {
|
|
2827
|
+
for (var o = e.length; o--; )
|
|
2828
|
+
if (xr(e[o][0], t))
|
|
2829
|
+
return o;
|
|
2830
|
+
return -1;
|
|
2831
|
+
}
|
|
2832
|
+
var Wr = Array.prototype, Gr = Wr.splice;
|
|
2833
|
+
function qr(e) {
|
|
2834
|
+
var t = this.__data__, o = we(t, e);
|
|
2835
|
+
if (o < 0)
|
|
2836
|
+
return !1;
|
|
2837
|
+
var n = t.length - 1;
|
|
2838
|
+
return o == n ? t.pop() : Gr.call(t, o, 1), --this.size, !0;
|
|
2839
|
+
}
|
|
2840
|
+
function Yr(e) {
|
|
2841
|
+
var t = this.__data__, o = we(t, e);
|
|
2842
|
+
return o < 0 ? void 0 : t[o][1];
|
|
2843
|
+
}
|
|
2844
|
+
function Kr(e) {
|
|
2845
|
+
return we(this.__data__, e) > -1;
|
|
2846
|
+
}
|
|
2847
|
+
function Xr(e, t) {
|
|
2848
|
+
var o = this.__data__, n = we(o, e);
|
|
2849
|
+
return n < 0 ? (++this.size, o.push([e, t])) : o[n][1] = t, this;
|
|
2850
|
+
}
|
|
2851
|
+
function ne(e) {
|
|
2852
|
+
var t = -1, o = e == null ? 0 : e.length;
|
|
2853
|
+
for (this.clear(); ++t < o; ) {
|
|
2854
|
+
var n = e[t];
|
|
2855
|
+
this.set(n[0], n[1]);
|
|
2856
|
+
}
|
|
2857
|
+
}
|
|
2858
|
+
ne.prototype.clear = Hr;
|
|
2859
|
+
ne.prototype.delete = qr;
|
|
2860
|
+
ne.prototype.get = Yr;
|
|
2861
|
+
ne.prototype.has = Kr;
|
|
2862
|
+
ne.prototype.set = Xr;
|
|
2863
|
+
var Zr = Et(De, "Map");
|
|
2864
|
+
function Qr() {
|
|
2865
|
+
this.size = 0, this.__data__ = {
|
|
2866
|
+
hash: new K(),
|
|
2867
|
+
map: new (Zr || ne)(),
|
|
2868
|
+
string: new K()
|
|
2869
|
+
};
|
|
2870
|
+
}
|
|
2871
|
+
function Jr(e) {
|
|
2872
|
+
var t = typeof e;
|
|
2873
|
+
return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null;
|
|
2874
|
+
}
|
|
2875
|
+
function Se(e, t) {
|
|
2876
|
+
var o = e.__data__;
|
|
2877
|
+
return Jr(t) ? o[typeof t == "string" ? "string" : "hash"] : o.map;
|
|
2878
|
+
}
|
|
2879
|
+
function es(e) {
|
|
2880
|
+
var t = Se(this, e).delete(e);
|
|
2881
|
+
return this.size -= t ? 1 : 0, t;
|
|
2882
|
+
}
|
|
2883
|
+
function ts(e) {
|
|
2884
|
+
return Se(this, e).get(e);
|
|
2885
|
+
}
|
|
2886
|
+
function os(e) {
|
|
2887
|
+
return Se(this, e).has(e);
|
|
2888
|
+
}
|
|
2889
|
+
function ns(e, t) {
|
|
2890
|
+
var o = Se(this, e), n = o.size;
|
|
2891
|
+
return o.set(e, t), this.size += o.size == n ? 0 : 1, this;
|
|
2892
|
+
}
|
|
2893
|
+
function Q(e) {
|
|
2894
|
+
var t = -1, o = e == null ? 0 : e.length;
|
|
2895
|
+
for (this.clear(); ++t < o; ) {
|
|
2896
|
+
var n = e[t];
|
|
2897
|
+
this.set(n[0], n[1]);
|
|
2898
|
+
}
|
|
2899
|
+
}
|
|
2900
|
+
Q.prototype.clear = Qr;
|
|
2901
|
+
Q.prototype.delete = es;
|
|
2902
|
+
Q.prototype.get = ts;
|
|
2903
|
+
Q.prototype.has = os;
|
|
2904
|
+
Q.prototype.set = ns;
|
|
2905
|
+
var rs = "Expected a function";
|
|
2906
|
+
function Ge(e, t) {
|
|
2907
|
+
if (typeof e != "function" || t != null && typeof t != "function")
|
|
2908
|
+
throw new TypeError(rs);
|
|
2909
|
+
var o = function() {
|
|
2910
|
+
var n = arguments, r = t ? t.apply(this, n) : n[0], s = o.cache;
|
|
2911
|
+
if (s.has(r))
|
|
2912
|
+
return s.get(r);
|
|
2913
|
+
var a = e.apply(this, n);
|
|
2914
|
+
return o.cache = s.set(r, a) || s, a;
|
|
2915
|
+
};
|
|
2916
|
+
return o.cache = new (Ge.Cache || Q)(), o;
|
|
2917
|
+
}
|
|
2918
|
+
Ge.Cache = Q;
|
|
2919
|
+
var ss = 500;
|
|
2920
|
+
function as(e) {
|
|
2921
|
+
var t = Ge(e, function(n) {
|
|
2922
|
+
return o.size === ss && o.clear(), n;
|
|
2923
|
+
}), o = t.cache;
|
|
2924
|
+
return t;
|
|
2925
|
+
}
|
|
2926
|
+
var ls = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, cs = /\\(\\)?/g, us = as(function(e) {
|
|
2927
|
+
var t = [];
|
|
2928
|
+
return e.charCodeAt(0) === 46 && t.push(""), e.replace(ls, function(o, n, r, s) {
|
|
2929
|
+
t.push(r ? s.replace(cs, "$1") : n || o);
|
|
2930
|
+
}), t;
|
|
2931
|
+
});
|
|
2932
|
+
function ds(e) {
|
|
2933
|
+
return e == null ? "" : Vt(e);
|
|
2934
|
+
}
|
|
2935
|
+
function fs(e, t) {
|
|
2936
|
+
return be(e) ? e : Br(e, t) ? [e] : us(ds(e));
|
|
2937
|
+
}
|
|
2938
|
+
function ps(e) {
|
|
2939
|
+
if (typeof e == "string" || We(e))
|
|
2940
|
+
return e;
|
|
2941
|
+
var t = e + "";
|
|
2942
|
+
return t == "0" && 1 / e == -1 / 0 ? "-0" : t;
|
|
2943
|
+
}
|
|
2944
|
+
function ms(e, t) {
|
|
2945
|
+
return e != null && t in Object(e);
|
|
2946
|
+
}
|
|
2947
|
+
function hs(e, t, o) {
|
|
2948
|
+
t = fs(t, e);
|
|
2949
|
+
for (var n = -1, r = t.length, s = !1; ++n < r; ) {
|
|
2950
|
+
var a = ps(t[n]);
|
|
2951
|
+
if (!(s = e != null && o(e, a)))
|
|
2952
|
+
break;
|
|
2953
|
+
e = e[a];
|
|
2954
|
+
}
|
|
2955
|
+
return s || ++n != r ? s : (r = e == null ? 0 : e.length, !!r && $r(r) && kr(a, r) && (be(e) || Vr(e)));
|
|
2956
|
+
}
|
|
2957
|
+
function vs(e, t) {
|
|
2958
|
+
return e != null && hs(e, t, ms);
|
|
2959
|
+
}
|
|
2960
|
+
const ys = { class: "my-filter-complex" }, gs = {
|
|
2961
|
+
key: 0,
|
|
2962
|
+
class: "my-filter-input"
|
|
2963
|
+
}, bs = { class: "my-fc-footer" }, ws = /* @__PURE__ */ O({
|
|
2964
|
+
__name: "FilterComplex",
|
|
2965
|
+
props: {
|
|
2966
|
+
renderOpts: Object,
|
|
2967
|
+
renderParams: Object
|
|
2968
|
+
},
|
|
2969
|
+
setup(e) {
|
|
2970
|
+
const t = e, o = M(), n = b(() => {
|
|
2971
|
+
const { column: i } = t.renderParams || {};
|
|
2972
|
+
return i ? i.field : "";
|
|
2973
|
+
}), r = () => {
|
|
2974
|
+
const { renderParams: i } = t;
|
|
2975
|
+
if (i) {
|
|
2976
|
+
const { column: u } = i, c = u.filters[0];
|
|
2977
|
+
o.value = c;
|
|
2978
|
+
}
|
|
2979
|
+
};
|
|
2980
|
+
U(n, () => {
|
|
2981
|
+
r();
|
|
2982
|
+
}), r();
|
|
2983
|
+
const s = b(() => t.renderParams.column), a = b(() => vs(s.value.params, "optionlist") ? "select" : "input"), l = () => {
|
|
2984
|
+
const { renderParams: i } = t, u = o.value;
|
|
2985
|
+
if (i && u) {
|
|
2986
|
+
const { $table: c } = i, h = !!u.data;
|
|
2987
|
+
c.updateFilterOptionStatus(u, h);
|
|
2988
|
+
}
|
|
2989
|
+
}, m = () => {
|
|
2990
|
+
const { renderParams: i } = t, u = {};
|
|
2991
|
+
if (i) {
|
|
2992
|
+
const { $table: c } = i;
|
|
2993
|
+
c.getColumns().forEach((g) => {
|
|
2994
|
+
const { field: S, filters: F } = g;
|
|
2995
|
+
if (S && F && F.length) {
|
|
2996
|
+
const C = F[0];
|
|
2997
|
+
C.data && (u[S] = C.data);
|
|
2998
|
+
}
|
|
2999
|
+
});
|
|
3000
|
+
}
|
|
3001
|
+
return u;
|
|
3002
|
+
}, y = () => {
|
|
3003
|
+
const { renderParams: i } = t;
|
|
3004
|
+
if (i) {
|
|
3005
|
+
const { $table: u, $grid: c } = i, h = o.value;
|
|
3006
|
+
h && u.updateFilterOptionStatus(h, !!h.data);
|
|
3007
|
+
const g = m();
|
|
3008
|
+
c.commitProxy("query", g), c.closeFilter();
|
|
3009
|
+
}
|
|
3010
|
+
}, v = () => {
|
|
3011
|
+
const { renderParams: i } = t, u = o.value;
|
|
3012
|
+
if (i && u) {
|
|
3013
|
+
const { $table: c, $grid: h } = i;
|
|
3014
|
+
u.data = "", c.updateFilterOptionStatus(u, !1);
|
|
3015
|
+
const g = m();
|
|
3016
|
+
h.commitProxy("query", g), h.closeFilter();
|
|
3017
|
+
}
|
|
3018
|
+
};
|
|
3019
|
+
return (i, u) => (w(), R("div", ys, [
|
|
3020
|
+
o.value ? (w(), R("div", gs, [
|
|
3021
|
+
a.value === "select" ? (w(), V(p(So), {
|
|
3022
|
+
key: 0,
|
|
3023
|
+
modelValue: o.value.data,
|
|
3024
|
+
"onUpdate:modelValue": u[0] || (u[0] = (c) => o.value.data = c),
|
|
3025
|
+
options: s.value.params.optionlist,
|
|
3026
|
+
clearable: "",
|
|
3027
|
+
onChange: l
|
|
3028
|
+
}, null, 8, ["modelValue", "options"])) : (w(), V(p(ko), {
|
|
3029
|
+
key: 1,
|
|
3030
|
+
modelValue: o.value.data,
|
|
3031
|
+
"onUpdate:modelValue": u[1] || (u[1] = (c) => o.value.data = c),
|
|
3032
|
+
clearable: "",
|
|
3033
|
+
onKeyup: vt(y, ["enter"]),
|
|
3034
|
+
onInput: l
|
|
3035
|
+
}, null, 8, ["modelValue"]))
|
|
3036
|
+
])) : z("", !0),
|
|
3037
|
+
_("div", bs, [
|
|
3038
|
+
E(p(Te), { onClick: v }, {
|
|
3039
|
+
default: $(() => [...u[2] || (u[2] = [
|
|
3040
|
+
D("重置", -1)
|
|
3041
|
+
])]),
|
|
3042
|
+
_: 1
|
|
3043
|
+
}),
|
|
3044
|
+
E(p(Te), {
|
|
3045
|
+
status: "primary",
|
|
3046
|
+
onClick: y
|
|
3047
|
+
}, {
|
|
3048
|
+
default: $(() => [...u[3] || (u[3] = [
|
|
3049
|
+
D("确认", -1)
|
|
3050
|
+
])]),
|
|
3051
|
+
_: 1
|
|
3052
|
+
})
|
|
3053
|
+
])
|
|
3054
|
+
]));
|
|
3055
|
+
}
|
|
3056
|
+
}), Ss = /* @__PURE__ */ kt(ws, [["__scopeId", "data-v-98a6f5eb"]]);
|
|
3057
|
+
wo.renderer.add("MyFilterComplex", {
|
|
3058
|
+
// 不显示底部按钮,使用自定义的按钮
|
|
3059
|
+
showTableFilterFooter: !1,
|
|
3060
|
+
// 自定义筛选模板
|
|
3061
|
+
renderTableFilter(e, t) {
|
|
3062
|
+
return /* @__PURE__ */ React.createElement(Ss, { renderOpts: e, renderParams: t });
|
|
3063
|
+
}
|
|
3064
|
+
});
|
|
3065
|
+
const ks = /* @__PURE__ */ O({
|
|
3066
|
+
components: {
|
|
3067
|
+
VxePager: xo,
|
|
3068
|
+
VxeButton: Te
|
|
3069
|
+
},
|
|
3070
|
+
__name: "use-query-grid",
|
|
3071
|
+
setup(e, { expose: t }) {
|
|
3072
|
+
const o = M(), n = ft();
|
|
3073
|
+
return Un(o, n), t({
|
|
3074
|
+
getGrid: () => o.value
|
|
3075
|
+
}), (r, s) => (w(), V(p(bt), L({
|
|
3076
|
+
ref_key: "gridRef",
|
|
3077
|
+
ref: o
|
|
3078
|
+
}, r.$attrs), de({ _: 2 }, [
|
|
3079
|
+
Z(r.$slots, (a, l) => ({
|
|
3080
|
+
name: l,
|
|
3081
|
+
fn: $((m) => [
|
|
3082
|
+
j(r.$slots, l, Y(fe(m || {})))
|
|
3083
|
+
])
|
|
3084
|
+
}))
|
|
3085
|
+
]), 1040));
|
|
3086
|
+
}
|
|
3087
|
+
});
|
|
3088
|
+
function Ys(e) {
|
|
3089
|
+
const t = M(), o = new Dn(t, e);
|
|
3090
|
+
return [O(
|
|
3091
|
+
(r, { attrs: s, slots: a }) => {
|
|
3092
|
+
const { gridEvents: l, gridOptions: m } = e, y = Object.entries(l || {}).reduce((v, [i, u]) => {
|
|
3093
|
+
const c = `on${i.charAt(0).toUpperCase() + i.slice(1)}`;
|
|
3094
|
+
return v[c] = u, v;
|
|
3095
|
+
}, {});
|
|
3096
|
+
return () => ye(ks, { ref: t, ...r, ...s, ...m, ...y }, a);
|
|
3097
|
+
}
|
|
3098
|
+
), o];
|
|
3099
|
+
}
|
|
3100
|
+
let ae = null;
|
|
3101
|
+
async function At() {
|
|
3102
|
+
return ae || (ae = await import("nprogress"), ae.configure({
|
|
3103
|
+
showSpinner: !0,
|
|
3104
|
+
speed: 300
|
|
3105
|
+
}), ae);
|
|
3106
|
+
}
|
|
3107
|
+
async function Ks() {
|
|
3108
|
+
(await At())?.start();
|
|
3109
|
+
}
|
|
3110
|
+
async function Xs() {
|
|
3111
|
+
(await At())?.done();
|
|
3112
|
+
}
|
|
3113
|
+
export {
|
|
3114
|
+
Pn as FormApi,
|
|
3115
|
+
tn as Modal,
|
|
3116
|
+
zs as ModalTypes,
|
|
3117
|
+
Is as SunnyBatchSelect,
|
|
3118
|
+
Ws as SunnyForm,
|
|
3119
|
+
tt as SunnyIcon,
|
|
3120
|
+
Ls as SunnyScrollbar,
|
|
3121
|
+
Ds as SunnySearchInputTag,
|
|
3122
|
+
wn as SunnySelect,
|
|
3123
|
+
Ns as SunnyUpload,
|
|
3124
|
+
Js as patterns,
|
|
3125
|
+
Us as setupSunnyForm,
|
|
3126
|
+
Ks as startProgress,
|
|
3127
|
+
Xs as stopProgress,
|
|
3128
|
+
qs as useSunnyEditGrid,
|
|
3129
|
+
Hs as useSunnyForm,
|
|
3130
|
+
Ms as useSunnyModal,
|
|
3131
|
+
Ys as useSunnyQueryGrid,
|
|
3132
|
+
Rs as z
|
|
3133
|
+
};
|