knt-shared 1.1.6 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,1139 +1,1765 @@
1
- import { defineComponent, ref, reactive, computed, unref, watch, onMounted, nextTick, onBeforeUnmount, resolveComponent, createBlock, openBlock, mergeProps, withCtx, createVNode, normalizeProps, guardReactiveProps, createElementBlock, createCommentVNode, Fragment, renderList, resolveDynamicComponent, renderSlot, createTextVNode, toDisplayString, getCurrentInstance, inject, normalizeStyle, normalizeClass, createElementVNode, withDirectives, createSlots, vShow, withModifiers, h, onUnmounted } from "vue";
2
- import { Transfer, Mention, Upload, Rate, Slider, Switch, RangePicker, TimePicker, DatePicker, TreeSelect, Cascader, CheckboxGroup, Checkbox, RadioGroup, Radio, Select, AutoComplete, Textarea, InputPassword, InputNumber, Input, Message } from "@arco-design/web-vue";
3
- const componentMap = {
4
- Input,
5
- InputNumber,
6
- InputPassword,
7
- Textarea,
8
- AutoComplete,
9
- Select,
10
- Radio,
11
- RadioGroup,
12
- Checkbox,
13
- CheckboxGroup,
14
- Cascader,
15
- TreeSelect,
16
- DatePicker,
17
- TimePicker,
18
- RangePicker,
19
- Switch,
20
- Slider,
21
- Rate,
22
- Upload,
23
- Mention,
24
- Transfer
25
- };
26
- const customComponentMap = /* @__PURE__ */ new Map();
27
- function registerComponent(name, component) {
28
- customComponentMap.set(name, component);
29
- }
30
- function getComponent(name) {
31
- if (typeof name === "string") {
32
- if (name in componentMap) {
33
- return componentMap[name];
34
- }
35
- return customComponentMap.get(name);
1
+ import { getCurrentInstance, inject, defineComponent, computed, createElementBlock, openBlock, normalizeStyle, normalizeClass, createElementVNode, ref, unref, watch, onMounted, nextTick, resolveComponent, createVNode, mergeProps, createSlots, withCtx, renderSlot, createBlock, createCommentVNode, toDisplayString, createTextVNode, reactive, onBeforeUnmount, normalizeProps, guardReactiveProps, Fragment, renderList, resolveDynamicComponent, withDirectives, vShow, withModifiers, h, onUnmounted } from "vue";
2
+ import { Message, Transfer, Mention, Upload, Rate, Slider, Switch, RangePicker, TimePicker, DatePicker, TreeSelect, Cascader, CheckboxGroup, Checkbox, RadioGroup, Radio, Select, AutoComplete, Textarea, InputPassword, InputNumber, Input } from "@arco-design/web-vue";
3
+ const configProviderInjectionKey = Symbol("ArcoConfigProvider");
4
+ const CLASS_PREFIX = "arco";
5
+ const GLOBAL_CONFIG_NAME = "$arco";
6
+ const getPrefixCls = (componentName) => {
7
+ var _a, _b, _c;
8
+ const instance = getCurrentInstance();
9
+ const configProvider = inject(configProviderInjectionKey, void 0);
10
+ const prefix = (_c = (_b = configProvider == null ? void 0 : configProvider.prefixCls) != null ? _b : (_a = instance == null ? void 0 : instance.appContext.config.globalProperties[GLOBAL_CONFIG_NAME]) == null ? void 0 : _a.classPrefix) != null ? _c : CLASS_PREFIX;
11
+ {
12
+ return `${prefix}-${componentName}`;
36
13
  }
37
- return name;
14
+ };
15
+ const opt = Object.prototype.toString;
16
+ function isNumber(obj) {
17
+ return opt.call(obj) === "[object Number]" && obj === obj;
38
18
  }
39
- const componentsNeedPlaceholder = /* @__PURE__ */ new Set([
40
- "Input",
41
- "InputPassword",
42
- "Textarea",
43
- "AutoComplete"
44
- ]);
45
- const componentsNeedSelectPlaceholder = /* @__PURE__ */ new Set([
46
- "Select",
47
- "DatePicker",
48
- "TimePicker",
49
- "RangePicker",
50
- "Cascader",
51
- "TreeSelect"
52
- ]);
53
- function getPlaceholder(component, label) {
54
- if (componentsNeedPlaceholder.has(component)) {
55
- return `请输入${label}`;
56
- }
57
- if (componentsNeedSelectPlaceholder.has(component)) {
58
- return `请选择${label}`;
19
+ var _export_sfc$1 = (sfc, props) => {
20
+ for (const [key, val] of props) {
21
+ sfc[key] = val;
59
22
  }
60
- return "";
61
- }
62
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
63
- ...{
64
- name: "BasicForm",
65
- inheritAttrs: false
66
- },
67
- __name: "BasicForm",
23
+ return sfc;
24
+ };
25
+ const _sfc_main$c = defineComponent({
26
+ name: "IconPlus",
68
27
  props: {
69
- schemas: { default: () => [] },
70
- layout: { default: "horizontal" },
71
- size: {},
72
- disabled: { type: Boolean, default: false },
73
- labelAlign: { default: "right" },
74
- autoLabelWidth: { type: Boolean },
75
- labelWidth: {},
76
- labelColProps: {},
77
- wrapperColProps: {},
78
- baseColProps: { default: () => ({ span: 24 }) },
79
- baseFormItemProps: {},
80
- actionColOptions: { default: () => ({ span: 24 }) },
81
- actionFormItemProps: {},
82
- autoSetPlaceHolder: { type: Boolean, default: true },
83
- showSubmitButton: { type: Boolean, default: true },
84
- showResetButton: { type: Boolean, default: true },
85
- submitButtonText: { default: "提交" },
86
- resetButtonText: { default: "重置" },
87
- showActionButtons: { type: Boolean, default: true }
88
- },
89
- emits: ["register", "submit", "reset", "validate"],
90
- setup(__props, { expose: __expose, emit: __emit }) {
91
- const props = __props;
92
- const emit = __emit;
93
- const formRef = ref();
94
- const formModel = reactive({});
95
- const submitLoading = ref(false);
96
- const internalSchemas = ref([]);
97
- const dynamicProps = ref({});
98
- const getProps = computed(() => {
99
- return { ...props, ...dynamicProps.value };
100
- });
101
- const getBindValue = computed(() => {
102
- const propsData = unref(getProps);
103
- return {
104
- layout: propsData.layout,
105
- size: propsData.size,
106
- disabled: propsData.disabled,
107
- labelAlign: propsData.labelAlign,
108
- autoLabelWidth: propsData.autoLabelWidth,
109
- labelWidth: propsData.labelWidth,
110
- labelColProps: propsData.labelColProps,
111
- wrapperColProps: propsData.wrapperColProps
112
- };
113
- });
114
- const getRow = computed(() => {
115
- return {
116
- gutter: 24
117
- };
118
- });
119
- const getActionProps = computed(() => {
120
- const propsData = unref(getProps);
121
- return {
122
- showActionButtons: propsData.showActionButtons !== false,
123
- showSubmitButton: propsData.showSubmitButton !== false,
124
- showResetButton: propsData.showResetButton !== false,
125
- submitButtonText: propsData.submitButtonText || "提交",
126
- resetButtonText: propsData.resetButtonText || "重置",
127
- actionColOptions: propsData.actionColOptions || { span: 24 },
128
- actionFormItemProps: propsData.actionFormItemProps || {}
129
- };
130
- });
131
- const initFormModel = () => {
132
- const schemas = internalSchemas.value.length > 0 ? internalSchemas.value : props.schemas || [];
133
- if (!schemas.length) return;
134
- const schemaFields = new Set(schemas.map((s) => s.field));
135
- Object.keys(formModel).forEach((key) => {
136
- if (!schemaFields.has(key)) {
137
- delete formModel[key];
138
- }
139
- });
140
- schemas.forEach((schema) => {
141
- if (!(schema.field in formModel)) {
142
- formModel[schema.field] = schema.defaultValue !== void 0 ? schema.defaultValue : void 0;
143
- }
144
- });
145
- };
146
- const getVisibleSchemas = computed(() => {
147
- const schemas = internalSchemas.value.length > 0 ? internalSchemas.value : props.schemas || [];
148
- return schemas.filter((schema) => {
149
- if (schema.show === void 0) return true;
150
- if (typeof schema.show === "boolean") return schema.show;
151
- return schema.show(formModel);
152
- });
153
- });
154
- const getColProps = (schema) => {
155
- const propsData = unref(getProps);
156
- return schema.colProps || propsData.baseColProps || { span: 24 };
157
- };
158
- const getFormItemBindValue = (schema) => {
159
- const propsData = unref(getProps);
160
- let disabled = propsData.disabled;
161
- if (schema.disabled !== void 0) {
162
- disabled = typeof schema.disabled === "boolean" ? schema.disabled : schema.disabled(formModel);
28
+ size: {
29
+ type: [Number, String]
30
+ },
31
+ strokeWidth: {
32
+ type: Number,
33
+ default: 4
34
+ },
35
+ strokeLinecap: {
36
+ type: String,
37
+ default: "butt",
38
+ validator: (value) => {
39
+ return ["butt", "round", "square"].includes(value);
163
40
  }
164
- return {
165
- field: schema.field,
166
- label: schema.label,
167
- labelColProps: schema.labelColProps || propsData.labelColProps,
168
- wrapperColProps: schema.wrapperColProps || propsData.wrapperColProps,
169
- rules: schema.rules,
170
- disabled,
171
- help: schema.help,
172
- extra: schema.extra,
173
- required: schema.required,
174
- ...propsData.baseFormItemProps || {},
175
- ...schema.formItemProps || {}
176
- };
177
- };
178
- const getPlaceholderText = (schema) => {
179
- var _a;
180
- const propsData = unref(getProps);
181
- if ((_a = schema.componentProps) == null ? void 0 : _a.placeholder) {
182
- return schema.componentProps.placeholder;
41
+ },
42
+ strokeLinejoin: {
43
+ type: String,
44
+ default: "miter",
45
+ validator: (value) => {
46
+ return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
183
47
  }
184
- if (!propsData.autoSetPlaceHolder) {
185
- return "";
48
+ },
49
+ rotate: Number,
50
+ spin: Boolean
51
+ },
52
+ emits: {
53
+ click: (ev) => true
54
+ },
55
+ setup(props, { emit }) {
56
+ const prefixCls = getPrefixCls("icon");
57
+ const cls = computed(() => [prefixCls, `${prefixCls}-plus`, { [`${prefixCls}-spin`]: props.spin }]);
58
+ const innerStyle = computed(() => {
59
+ const styles = {};
60
+ if (props.size) {
61
+ styles.fontSize = isNumber(props.size) ? `${props.size}px` : props.size;
186
62
  }
187
- const componentType = typeof schema.component === "string" ? schema.component : "";
188
- return getPlaceholder(componentType, schema.label);
189
- };
190
- const handleSubmit = async (data) => {
191
- try {
192
- submitLoading.value = true;
193
- if (data.errors) {
194
- console.warn("表单验证失败:", data.errors);
195
- return;
196
- }
197
- emit("submit", data.values);
198
- } finally {
199
- submitLoading.value = false;
63
+ if (props.rotate) {
64
+ styles.transform = `rotate(${props.rotate}deg)`;
200
65
  }
66
+ return styles;
67
+ });
68
+ const onClick = (ev) => {
69
+ emit("click", ev);
201
70
  };
202
- const handleReset = () => {
203
- var _a;
204
- (_a = formRef.value) == null ? void 0 : _a.resetFields();
205
- emit("reset");
206
- };
207
- const getFieldsValue = () => {
208
- return { ...formModel };
71
+ return {
72
+ cls,
73
+ innerStyle,
74
+ onClick
209
75
  };
210
- const setFieldsValue = (values) => {
211
- Object.keys(values).forEach((key) => {
212
- const schemas = internalSchemas.value.length > 0 ? internalSchemas.value : props.schemas || [];
213
- const hasField = schemas.some((s) => s.field === key);
214
- if (hasField) {
215
- formModel[key] = values[key];
216
- } else {
217
- console.warn(`字段 "${key}" 不在表单 schema 中`);
218
- }
219
- });
76
+ }
77
+ });
78
+ const _hoisted_1$b = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
79
+ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
80
+ return openBlock(), createElementBlock("svg", {
81
+ viewBox: "0 0 48 48",
82
+ fill: "none",
83
+ xmlns: "http://www.w3.org/2000/svg",
84
+ stroke: "currentColor",
85
+ class: normalizeClass(_ctx.cls),
86
+ style: normalizeStyle(_ctx.innerStyle),
87
+ "stroke-width": _ctx.strokeWidth,
88
+ "stroke-linecap": _ctx.strokeLinecap,
89
+ "stroke-linejoin": _ctx.strokeLinejoin,
90
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
91
+ }, _cache[1] || (_cache[1] = [
92
+ createElementVNode("path", { d: "M5 24h38M24 5v38" }, null, -1)
93
+ ]), 14, _hoisted_1$b);
94
+ }
95
+ var _IconPlus = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["render", _sfc_render$7]]);
96
+ const IconPlus = Object.assign(_IconPlus, {
97
+ install: (app, options) => {
98
+ var _a;
99
+ const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
100
+ app.component(iconPrefix + _IconPlus.name, _IconPlus);
101
+ }
102
+ });
103
+ const _sfc_main$b = defineComponent({
104
+ name: "IconQuestionCircle",
105
+ props: {
106
+ size: {
107
+ type: [Number, String]
108
+ },
109
+ strokeWidth: {
110
+ type: Number,
111
+ default: 4
112
+ },
113
+ strokeLinecap: {
114
+ type: String,
115
+ default: "butt",
116
+ validator: (value) => {
117
+ return ["butt", "round", "square"].includes(value);
118
+ }
119
+ },
120
+ strokeLinejoin: {
121
+ type: String,
122
+ default: "miter",
123
+ validator: (value) => {
124
+ return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
125
+ }
126
+ },
127
+ rotate: Number,
128
+ spin: Boolean
129
+ },
130
+ emits: {
131
+ click: (ev) => true
132
+ },
133
+ setup(props, { emit }) {
134
+ const prefixCls = getPrefixCls("icon");
135
+ const cls = computed(() => [prefixCls, `${prefixCls}-question-circle`, { [`${prefixCls}-spin`]: props.spin }]);
136
+ const innerStyle = computed(() => {
137
+ const styles = {};
138
+ if (props.size) {
139
+ styles.fontSize = isNumber(props.size) ? `${props.size}px` : props.size;
140
+ }
141
+ if (props.rotate) {
142
+ styles.transform = `rotate(${props.rotate}deg)`;
143
+ }
144
+ return styles;
145
+ });
146
+ const onClick = (ev) => {
147
+ emit("click", ev);
220
148
  };
221
- const resetFields = () => {
222
- var _a;
223
- (_a = formRef.value) == null ? void 0 : _a.resetFields();
149
+ return {
150
+ cls,
151
+ innerStyle,
152
+ onClick
224
153
  };
225
- const validate = async () => {
226
- var _a;
227
- return (_a = formRef.value) == null ? void 0 : _a.validate();
154
+ }
155
+ });
156
+ const _hoisted_1$a = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
157
+ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
158
+ return openBlock(), createElementBlock("svg", {
159
+ viewBox: "0 0 48 48",
160
+ fill: "none",
161
+ xmlns: "http://www.w3.org/2000/svg",
162
+ stroke: "currentColor",
163
+ class: normalizeClass(_ctx.cls),
164
+ style: normalizeStyle(_ctx.innerStyle),
165
+ "stroke-width": _ctx.strokeWidth,
166
+ "stroke-linecap": _ctx.strokeLinecap,
167
+ "stroke-linejoin": _ctx.strokeLinejoin,
168
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
169
+ }, _cache[1] || (_cache[1] = [
170
+ createElementVNode("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),
171
+ createElementVNode("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)
172
+ ]), 14, _hoisted_1$a);
173
+ }
174
+ var _IconQuestionCircle = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["render", _sfc_render$6]]);
175
+ const IconQuestionCircle = Object.assign(_IconQuestionCircle, {
176
+ install: (app, options) => {
177
+ var _a;
178
+ const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
179
+ app.component(iconPrefix + _IconQuestionCircle.name, _IconQuestionCircle);
180
+ }
181
+ });
182
+ const _sfc_main$a = defineComponent({
183
+ name: "IconRefresh",
184
+ props: {
185
+ size: {
186
+ type: [Number, String]
187
+ },
188
+ strokeWidth: {
189
+ type: Number,
190
+ default: 4
191
+ },
192
+ strokeLinecap: {
193
+ type: String,
194
+ default: "butt",
195
+ validator: (value) => {
196
+ return ["butt", "round", "square"].includes(value);
197
+ }
198
+ },
199
+ strokeLinejoin: {
200
+ type: String,
201
+ default: "miter",
202
+ validator: (value) => {
203
+ return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
204
+ }
205
+ },
206
+ rotate: Number,
207
+ spin: Boolean
208
+ },
209
+ emits: {
210
+ click: (ev) => true
211
+ },
212
+ setup(props, { emit }) {
213
+ const prefixCls = getPrefixCls("icon");
214
+ const cls = computed(() => [prefixCls, `${prefixCls}-refresh`, { [`${prefixCls}-spin`]: props.spin }]);
215
+ const innerStyle = computed(() => {
216
+ const styles = {};
217
+ if (props.size) {
218
+ styles.fontSize = isNumber(props.size) ? `${props.size}px` : props.size;
219
+ }
220
+ if (props.rotate) {
221
+ styles.transform = `rotate(${props.rotate}deg)`;
222
+ }
223
+ return styles;
224
+ });
225
+ const onClick = (ev) => {
226
+ emit("click", ev);
228
227
  };
229
- const clearValidate = (field) => {
230
- var _a;
231
- (_a = formRef.value) == null ? void 0 : _a.clearValidate(field);
228
+ return {
229
+ cls,
230
+ innerStyle,
231
+ onClick
232
232
  };
233
- const updateSchema = (schema) => {
234
- const schemas = Array.isArray(schema) ? schema : [schema];
235
- schemas.forEach((item) => {
236
- const index = internalSchemas.value.findIndex(
237
- (s) => s.field === item.field
238
- );
239
- if (index !== -1) {
240
- const oldSchema = internalSchemas.value[index];
241
- internalSchemas.value[index] = { ...oldSchema, ...item };
242
- if (item.defaultValue !== void 0 && formModel[item.field] === oldSchema.defaultValue) {
243
- formModel[item.field] = item.defaultValue;
244
- }
245
- }
246
- });
233
+ }
234
+ });
235
+ const _hoisted_1$9 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
236
+ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
237
+ return openBlock(), createElementBlock("svg", {
238
+ viewBox: "0 0 48 48",
239
+ fill: "none",
240
+ xmlns: "http://www.w3.org/2000/svg",
241
+ stroke: "currentColor",
242
+ class: normalizeClass(_ctx.cls),
243
+ style: normalizeStyle(_ctx.innerStyle),
244
+ "stroke-width": _ctx.strokeWidth,
245
+ "stroke-linecap": _ctx.strokeLinecap,
246
+ "stroke-linejoin": _ctx.strokeLinejoin,
247
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
248
+ }, _cache[1] || (_cache[1] = [
249
+ createElementVNode("path", { d: "M38.837 18C36.463 12.136 30.715 8 24 8 15.163 8 8 15.163 8 24s7.163 16 16 16c7.455 0 13.72-5.1 15.496-12M40 8v10H30" }, null, -1)
250
+ ]), 14, _hoisted_1$9);
251
+ }
252
+ var _IconRefresh = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["render", _sfc_render$5]]);
253
+ const IconRefresh = Object.assign(_IconRefresh, {
254
+ install: (app, options) => {
255
+ var _a;
256
+ const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
257
+ app.component(iconPrefix + _IconRefresh.name, _IconRefresh);
258
+ }
259
+ });
260
+ const _sfc_main$9 = defineComponent({
261
+ name: "IconSettings",
262
+ props: {
263
+ size: {
264
+ type: [Number, String]
265
+ },
266
+ strokeWidth: {
267
+ type: Number,
268
+ default: 4
269
+ },
270
+ strokeLinecap: {
271
+ type: String,
272
+ default: "butt",
273
+ validator: (value) => {
274
+ return ["butt", "round", "square"].includes(value);
275
+ }
276
+ },
277
+ strokeLinejoin: {
278
+ type: String,
279
+ default: "miter",
280
+ validator: (value) => {
281
+ return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
282
+ }
283
+ },
284
+ rotate: Number,
285
+ spin: Boolean
286
+ },
287
+ emits: {
288
+ click: (ev) => true
289
+ },
290
+ setup(props, { emit }) {
291
+ const prefixCls = getPrefixCls("icon");
292
+ const cls = computed(() => [prefixCls, `${prefixCls}-settings`, { [`${prefixCls}-spin`]: props.spin }]);
293
+ const innerStyle = computed(() => {
294
+ const styles = {};
295
+ if (props.size) {
296
+ styles.fontSize = isNumber(props.size) ? `${props.size}px` : props.size;
297
+ }
298
+ if (props.rotate) {
299
+ styles.transform = `rotate(${props.rotate}deg)`;
300
+ }
301
+ return styles;
302
+ });
303
+ const onClick = (ev) => {
304
+ emit("click", ev);
247
305
  };
248
- const removeSchema = (field) => {
249
- const fields = Array.isArray(field) ? field : [field];
250
- fields.forEach((f) => {
251
- const index = internalSchemas.value.findIndex((s) => s.field === f);
252
- if (index !== -1) {
253
- internalSchemas.value.splice(index, 1);
254
- delete formModel[f];
255
- }
256
- });
306
+ return {
307
+ cls,
308
+ innerStyle,
309
+ onClick
257
310
  };
258
- const getSchema = (field) => {
259
- const schemas = internalSchemas.value.length > 0 ? internalSchemas.value : props.schemas || [];
260
- if (!field) return schemas;
261
- return schemas.find((s) => s.field === field);
311
+ }
312
+ });
313
+ const _hoisted_1$8 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
314
+ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
315
+ return openBlock(), createElementBlock("svg", {
316
+ viewBox: "0 0 48 48",
317
+ fill: "none",
318
+ xmlns: "http://www.w3.org/2000/svg",
319
+ stroke: "currentColor",
320
+ class: normalizeClass(_ctx.cls),
321
+ style: normalizeStyle(_ctx.innerStyle),
322
+ "stroke-width": _ctx.strokeWidth,
323
+ "stroke-linecap": _ctx.strokeLinecap,
324
+ "stroke-linejoin": _ctx.strokeLinejoin,
325
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
326
+ }, _cache[1] || (_cache[1] = [
327
+ createElementVNode("path", { d: "M18.797 6.732A1 1 0 0 1 19.76 6h8.48a1 1 0 0 1 .964.732l1.285 4.628a1 1 0 0 0 1.213.7l4.651-1.2a1 1 0 0 1 1.116.468l4.24 7.344a1 1 0 0 1-.153 1.2L38.193 23.3a1 1 0 0 0 0 1.402l3.364 3.427a1 1 0 0 1 .153 1.2l-4.24 7.344a1 1 0 0 1-1.116.468l-4.65-1.2a1 1 0 0 0-1.214.7l-1.285 4.628a1 1 0 0 1-.964.732h-8.48a1 1 0 0 1-.963-.732L17.51 36.64a1 1 0 0 0-1.213-.7l-4.65 1.2a1 1 0 0 1-1.116-.468l-4.24-7.344a1 1 0 0 1 .153-1.2L9.809 24.7a1 1 0 0 0 0-1.402l-3.364-3.427a1 1 0 0 1-.153-1.2l4.24-7.344a1 1 0 0 1 1.116-.468l4.65 1.2a1 1 0 0 0 1.213-.7l1.286-4.628Z" }, null, -1),
328
+ createElementVNode("path", { d: "M30 24a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z" }, null, -1)
329
+ ]), 14, _hoisted_1$8);
330
+ }
331
+ var _IconSettings = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["render", _sfc_render$4]]);
332
+ const IconSettings = Object.assign(_IconSettings, {
333
+ install: (app, options) => {
334
+ var _a;
335
+ const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
336
+ app.component(iconPrefix + _IconSettings.name, _IconSettings);
337
+ }
338
+ });
339
+ const _sfc_main$8 = defineComponent({
340
+ name: "IconUpload",
341
+ props: {
342
+ size: {
343
+ type: [Number, String]
344
+ },
345
+ strokeWidth: {
346
+ type: Number,
347
+ default: 4
348
+ },
349
+ strokeLinecap: {
350
+ type: String,
351
+ default: "butt",
352
+ validator: (value) => {
353
+ return ["butt", "round", "square"].includes(value);
354
+ }
355
+ },
356
+ strokeLinejoin: {
357
+ type: String,
358
+ default: "miter",
359
+ validator: (value) => {
360
+ return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
361
+ }
362
+ },
363
+ rotate: Number,
364
+ spin: Boolean
365
+ },
366
+ emits: {
367
+ click: (ev) => true
368
+ },
369
+ setup(props, { emit }) {
370
+ const prefixCls = getPrefixCls("icon");
371
+ const cls = computed(() => [prefixCls, `${prefixCls}-upload`, { [`${prefixCls}-spin`]: props.spin }]);
372
+ const innerStyle = computed(() => {
373
+ const styles = {};
374
+ if (props.size) {
375
+ styles.fontSize = isNumber(props.size) ? `${props.size}px` : props.size;
376
+ }
377
+ if (props.rotate) {
378
+ styles.transform = `rotate(${props.rotate}deg)`;
379
+ }
380
+ return styles;
381
+ });
382
+ const onClick = (ev) => {
383
+ emit("click", ev);
262
384
  };
263
- const resetSchema = (schemas) => {
264
- internalSchemas.value = [...schemas];
265
- initFormModel();
385
+ return {
386
+ cls,
387
+ innerStyle,
388
+ onClick
266
389
  };
267
- const setProps = (formProps) => {
268
- dynamicProps.value = { ...dynamicProps.value, ...formProps };
269
- if (formProps.schemas && Array.isArray(formProps.schemas)) {
270
- internalSchemas.value = [...formProps.schemas];
271
- initFormModel();
390
+ }
391
+ });
392
+ const _hoisted_1$7 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
393
+ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
394
+ return openBlock(), createElementBlock("svg", {
395
+ viewBox: "0 0 48 48",
396
+ fill: "none",
397
+ xmlns: "http://www.w3.org/2000/svg",
398
+ stroke: "currentColor",
399
+ class: normalizeClass(_ctx.cls),
400
+ style: normalizeStyle(_ctx.innerStyle),
401
+ "stroke-width": _ctx.strokeWidth,
402
+ "stroke-linecap": _ctx.strokeLinecap,
403
+ "stroke-linejoin": _ctx.strokeLinejoin,
404
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
405
+ }, _cache[1] || (_cache[1] = [
406
+ createElementVNode("path", { d: "M14.93 17.071 24.001 8l9.071 9.071m-9.07 16.071v-25M40 35v6H8v-6" }, null, -1)
407
+ ]), 14, _hoisted_1$7);
408
+ }
409
+ var _IconUpload = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["render", _sfc_render$3]]);
410
+ const IconUpload = Object.assign(_IconUpload, {
411
+ install: (app, options) => {
412
+ var _a;
413
+ const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
414
+ app.component(iconPrefix + _IconUpload.name, _IconUpload);
415
+ }
416
+ });
417
+ const _sfc_main$7 = defineComponent({
418
+ name: "IconLineHeight",
419
+ props: {
420
+ size: {
421
+ type: [Number, String]
422
+ },
423
+ strokeWidth: {
424
+ type: Number,
425
+ default: 4
426
+ },
427
+ strokeLinecap: {
428
+ type: String,
429
+ default: "butt",
430
+ validator: (value) => {
431
+ return ["butt", "round", "square"].includes(value);
432
+ }
433
+ },
434
+ strokeLinejoin: {
435
+ type: String,
436
+ default: "miter",
437
+ validator: (value) => {
438
+ return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
439
+ }
440
+ },
441
+ rotate: Number,
442
+ spin: Boolean
443
+ },
444
+ emits: {
445
+ click: (ev) => true
446
+ },
447
+ setup(props, { emit }) {
448
+ const prefixCls = getPrefixCls("icon");
449
+ const cls = computed(() => [prefixCls, `${prefixCls}-line-height`, { [`${prefixCls}-spin`]: props.spin }]);
450
+ const innerStyle = computed(() => {
451
+ const styles = {};
452
+ if (props.size) {
453
+ styles.fontSize = isNumber(props.size) ? `${props.size}px` : props.size;
272
454
  }
455
+ if (props.rotate) {
456
+ styles.transform = `rotate(${props.rotate}deg)`;
457
+ }
458
+ return styles;
459
+ });
460
+ const onClick = (ev) => {
461
+ emit("click", ev);
273
462
  };
274
- const scrollToField = (name, options) => {
275
- nextTick(() => {
276
- const element = document.querySelector(`[data-field="${name}"]`);
277
- if (element) {
278
- element.scrollIntoView(options);
279
- }
280
- });
463
+ return {
464
+ cls,
465
+ innerStyle,
466
+ onClick
281
467
  };
282
- __expose({
283
- formRef,
284
- formModel,
285
- handleSubmit,
286
- getVisibleSchemas: () => getVisibleSchemas.value,
287
- getColProps,
288
- getFormItemBindValue,
289
- getPlaceholderText,
290
- getFieldsValue,
291
- setFieldsValue,
292
- resetFields,
293
- validate,
294
- clearValidate,
295
- updateSchema,
296
- removeSchema,
297
- getSchema,
298
- resetSchema,
299
- setProps,
300
- scrollToField
468
+ }
469
+ });
470
+ const _hoisted_1$6 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
471
+ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
472
+ return openBlock(), createElementBlock("svg", {
473
+ viewBox: "0 0 48 48",
474
+ fill: "none",
475
+ xmlns: "http://www.w3.org/2000/svg",
476
+ stroke: "currentColor",
477
+ class: normalizeClass(_ctx.cls),
478
+ style: normalizeStyle(_ctx.innerStyle),
479
+ "stroke-width": _ctx.strokeWidth,
480
+ "stroke-linecap": _ctx.strokeLinecap,
481
+ "stroke-linejoin": _ctx.strokeLinejoin,
482
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
483
+ }, _cache[1] || (_cache[1] = [
484
+ createElementVNode("path", { d: "M4 8h14.5M33 8H18.5m0 0v34" }, null, -1),
485
+ createElementVNode("path", {
486
+ d: "M39 9.5 37 13h4l-2-3.5ZM39 38.5 37 35h4l-2 3.5Z",
487
+ fill: "currentColor",
488
+ stroke: "none"
489
+ }, null, -1),
490
+ createElementVNode("path", { d: "M39 13h2l-2-3.5-2 3.5h2Zm0 0v22m0 0h2l-2 3.5-2-3.5h2Z" }, null, -1)
491
+ ]), 14, _hoisted_1$6);
492
+ }
493
+ var _IconLineHeight = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["render", _sfc_render$2]]);
494
+ const IconLineHeight = Object.assign(_IconLineHeight, {
495
+ install: (app, options) => {
496
+ var _a;
497
+ const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
498
+ app.component(iconPrefix + _IconLineHeight.name, _IconLineHeight);
499
+ }
500
+ });
501
+ const _sfc_main$6 = defineComponent({
502
+ name: "IconFullscreenExit",
503
+ props: {
504
+ size: {
505
+ type: [Number, String]
506
+ },
507
+ strokeWidth: {
508
+ type: Number,
509
+ default: 4
510
+ },
511
+ strokeLinecap: {
512
+ type: String,
513
+ default: "butt",
514
+ validator: (value) => {
515
+ return ["butt", "round", "square"].includes(value);
516
+ }
517
+ },
518
+ strokeLinejoin: {
519
+ type: String,
520
+ default: "miter",
521
+ validator: (value) => {
522
+ return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
523
+ }
524
+ },
525
+ rotate: Number,
526
+ spin: Boolean
527
+ },
528
+ emits: {
529
+ click: (ev) => true
530
+ },
531
+ setup(props, { emit }) {
532
+ const prefixCls = getPrefixCls("icon");
533
+ const cls = computed(() => [prefixCls, `${prefixCls}-fullscreen-exit`, { [`${prefixCls}-spin`]: props.spin }]);
534
+ const innerStyle = computed(() => {
535
+ const styles = {};
536
+ if (props.size) {
537
+ styles.fontSize = isNumber(props.size) ? `${props.size}px` : props.size;
538
+ }
539
+ if (props.rotate) {
540
+ styles.transform = `rotate(${props.rotate}deg)`;
541
+ }
542
+ return styles;
301
543
  });
302
- const stopSchemasWatch = watch(
303
- () => props.schemas,
304
- (newSchemas) => {
305
- if (newSchemas) {
306
- internalSchemas.value = [...newSchemas];
307
- initFormModel();
544
+ const onClick = (ev) => {
545
+ emit("click", ev);
546
+ };
547
+ return {
548
+ cls,
549
+ innerStyle,
550
+ onClick
551
+ };
552
+ }
553
+ });
554
+ const _hoisted_1$5 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
555
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
556
+ return openBlock(), createElementBlock("svg", {
557
+ viewBox: "0 0 48 48",
558
+ fill: "none",
559
+ xmlns: "http://www.w3.org/2000/svg",
560
+ stroke: "currentColor",
561
+ class: normalizeClass(_ctx.cls),
562
+ style: normalizeStyle(_ctx.innerStyle),
563
+ "stroke-width": _ctx.strokeWidth,
564
+ "stroke-linecap": _ctx.strokeLinecap,
565
+ "stroke-linejoin": _ctx.strokeLinejoin,
566
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
567
+ }, _cache[1] || (_cache[1] = [
568
+ createElementVNode("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)
569
+ ]), 14, _hoisted_1$5);
570
+ }
571
+ var _IconFullscreenExit = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["render", _sfc_render$1]]);
572
+ const IconFullscreenExit = Object.assign(_IconFullscreenExit, {
573
+ install: (app, options) => {
574
+ var _a;
575
+ const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
576
+ app.component(iconPrefix + _IconFullscreenExit.name, _IconFullscreenExit);
577
+ }
578
+ });
579
+ const _sfc_main$5 = defineComponent({
580
+ name: "IconFullscreen",
581
+ props: {
582
+ size: {
583
+ type: [Number, String]
584
+ },
585
+ strokeWidth: {
586
+ type: Number,
587
+ default: 4
588
+ },
589
+ strokeLinecap: {
590
+ type: String,
591
+ default: "butt",
592
+ validator: (value) => {
593
+ return ["butt", "round", "square"].includes(value);
594
+ }
595
+ },
596
+ strokeLinejoin: {
597
+ type: String,
598
+ default: "miter",
599
+ validator: (value) => {
600
+ return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
601
+ }
602
+ },
603
+ rotate: Number,
604
+ spin: Boolean
605
+ },
606
+ emits: {
607
+ click: (ev) => true
608
+ },
609
+ setup(props, { emit }) {
610
+ const prefixCls = getPrefixCls("icon");
611
+ const cls = computed(() => [prefixCls, `${prefixCls}-fullscreen`, { [`${prefixCls}-spin`]: props.spin }]);
612
+ const innerStyle = computed(() => {
613
+ const styles = {};
614
+ if (props.size) {
615
+ styles.fontSize = isNumber(props.size) ? `${props.size}px` : props.size;
616
+ }
617
+ if (props.rotate) {
618
+ styles.transform = `rotate(${props.rotate}deg)`;
619
+ }
620
+ return styles;
621
+ });
622
+ const onClick = (ev) => {
623
+ emit("click", ev);
624
+ };
625
+ return {
626
+ cls,
627
+ innerStyle,
628
+ onClick
629
+ };
630
+ }
631
+ });
632
+ const _hoisted_1$4 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
633
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
634
+ return openBlock(), createElementBlock("svg", {
635
+ viewBox: "0 0 48 48",
636
+ fill: "none",
637
+ xmlns: "http://www.w3.org/2000/svg",
638
+ stroke: "currentColor",
639
+ class: normalizeClass(_ctx.cls),
640
+ style: normalizeStyle(_ctx.innerStyle),
641
+ "stroke-width": _ctx.strokeWidth,
642
+ "stroke-linecap": _ctx.strokeLinecap,
643
+ "stroke-linejoin": _ctx.strokeLinejoin,
644
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
645
+ }, _cache[1] || (_cache[1] = [
646
+ createElementVNode("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)
647
+ ]), 14, _hoisted_1$4);
648
+ }
649
+ var _IconFullscreen = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["render", _sfc_render]]);
650
+ const IconFullscreen = Object.assign(_IconFullscreen, {
651
+ install: (app, options) => {
652
+ var _a;
653
+ const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
654
+ app.component(iconPrefix + _IconFullscreen.name, _IconFullscreen);
655
+ }
656
+ });
657
+ const _hoisted_1$3 = { class: "basic-upload" };
658
+ const _hoisted_2$3 = {
659
+ key: 0,
660
+ class: "upload-card-button"
661
+ };
662
+ const _hoisted_3$2 = {
663
+ key: 0,
664
+ class: "upload-text"
665
+ };
666
+ const _hoisted_4$2 = { class: "upload-tip" };
667
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
668
+ ...{
669
+ name: "BasicUpload",
670
+ inheritAttrs: false
671
+ },
672
+ __name: "BasicUpload",
673
+ props: {
674
+ modelValue: {},
675
+ accept: { default: "" },
676
+ maxSize: { default: 10 },
677
+ maxCount: { default: 1 },
678
+ multiple: { type: Boolean, default: false },
679
+ disabled: { type: Boolean, default: false },
680
+ readonly: { type: Boolean, default: false },
681
+ listType: { default: "picture-card" },
682
+ action: {},
683
+ headers: {},
684
+ data: {},
685
+ name: { default: "file" },
686
+ withCredentials: { type: Boolean, default: false },
687
+ customRequest: {},
688
+ beforeUpload: {},
689
+ onSuccess: {},
690
+ onError: {},
691
+ onProgress: {},
692
+ onRemove: {},
693
+ onPreview: {},
694
+ showFileList: { type: Boolean, default: true },
695
+ showRemoveButton: { type: Boolean, default: true },
696
+ showDownloadButton: { type: Boolean, default: false },
697
+ showPreviewButton: { type: Boolean, default: true },
698
+ showUploadButton: { type: Boolean, default: true },
699
+ tip: {},
700
+ imagePreview: { type: Boolean, default: true },
701
+ imageCrop: { type: Boolean, default: false },
702
+ imageCompress: { type: Boolean, default: false },
703
+ compressOptions: {},
704
+ draggable: { type: Boolean, default: false },
705
+ directory: { type: Boolean, default: false },
706
+ autoUpload: { type: Boolean, default: true },
707
+ resultType: { default: "url" },
708
+ uploadButtonText: {},
709
+ uploadButtonType: { default: "primary" }
710
+ },
711
+ emits: ["register", "update:modelValue", "change", "success", "error", "progress", "remove", "preview", "exceed"],
712
+ setup(__props, { expose: __expose, emit: __emit }) {
713
+ const props = __props;
714
+ const emit = __emit;
715
+ const uploadRef = ref();
716
+ const fileListRef = ref([]);
717
+ const propsRef = ref({});
718
+ const getProps = computed(() => {
719
+ return { ...props, ...unref(propsRef) };
720
+ });
721
+ const hideUploadButton = computed(() => {
722
+ const propsData = unref(getProps);
723
+ if (!propsData.showUploadButton) return true;
724
+ if (propsData.readonly) return true;
725
+ if (propsData.maxCount && fileListRef.value.length >= propsData.maxCount) {
726
+ return true;
727
+ }
728
+ return false;
729
+ });
730
+ const getBindValue = computed(() => {
731
+ const propsData = unref(getProps);
732
+ return {
733
+ ...propsData,
734
+ disabled: propsData.disabled || propsData.readonly,
735
+ showRemoveButton: propsData.showRemoveButton && !propsData.readonly,
736
+ showUploadButton: !hideUploadButton.value,
737
+ // 只有在没有自定义预览时才启用 imagePreview
738
+ imagePreview: propsData.imagePreview && !propsData.onPreview
739
+ };
740
+ });
741
+ const validateFileSize = (file) => {
742
+ const propsData = unref(getProps);
743
+ if (!propsData.maxSize) return true;
744
+ const maxSizeInBytes = propsData.maxSize * 1024 * 1024;
745
+ if (file.size > maxSizeInBytes) {
746
+ Message.error(`文件大小不能超过 ${propsData.maxSize}MB`);
747
+ return false;
748
+ }
749
+ return true;
750
+ };
751
+ const validateFileType = (file) => {
752
+ var _a;
753
+ const propsData = unref(getProps);
754
+ if (!propsData.accept) return true;
755
+ const acceptTypes = propsData.accept.split(",").map((type) => type.trim());
756
+ const fileExtension = `.${(_a = file.name.split(".").pop()) == null ? void 0 : _a.toLowerCase()}`;
757
+ const fileMimeType = file.type;
758
+ const isValid = acceptTypes.some((type) => {
759
+ if (type.startsWith(".")) {
760
+ return fileExtension === type.toLowerCase();
761
+ }
762
+ if (type.includes("*")) {
763
+ const [mainType] = type.split("/");
764
+ return fileMimeType.startsWith(mainType);
765
+ }
766
+ return fileMimeType === type;
767
+ });
768
+ if (!isValid) {
769
+ Message.error(`不支持的文件类型: ${file.name}`);
770
+ return false;
771
+ }
772
+ return true;
773
+ };
774
+ const handleBeforeUpload = async (file) => {
775
+ const propsData = unref(getProps);
776
+ if (!validateFileSize(file)) {
777
+ return false;
778
+ }
779
+ if (!validateFileType(file)) {
780
+ return false;
781
+ }
782
+ if (propsData.maxCount && fileListRef.value.length >= propsData.maxCount) {
783
+ Message.error(`最多只能上传 ${propsData.maxCount} 个文件`);
784
+ emit("exceed", [file], fileListRef.value);
785
+ return false;
786
+ }
787
+ if (propsData.beforeUpload) {
788
+ try {
789
+ const result = await propsData.beforeUpload(file);
790
+ return result;
791
+ } catch (error) {
792
+ console.error("beforeUpload error:", error);
793
+ return false;
794
+ }
795
+ }
796
+ return true;
797
+ };
798
+ const handleCustomRequest = (options) => {
799
+ const propsData = unref(getProps);
800
+ if (propsData.customRequest) {
801
+ const customOptions = {
802
+ file: options.fileItem.file,
803
+ fileItem: options.fileItem,
804
+ onProgress: (percent, event) => {
805
+ options.onProgress(percent, event);
806
+ },
807
+ onSuccess: (response) => {
808
+ options.onSuccess(response);
809
+ },
810
+ onError: (error) => {
811
+ options.onError(error);
812
+ },
813
+ headers: propsData.headers,
814
+ data: propsData.data,
815
+ name: propsData.name,
816
+ action: propsData.action,
817
+ withCredentials: propsData.withCredentials
818
+ };
819
+ propsData.customRequest(customOptions);
820
+ } else {
821
+ defaultUpload(options);
822
+ }
823
+ };
824
+ const defaultUpload = (options) => {
825
+ const propsData = unref(getProps);
826
+ const { fileItem, onProgress, onSuccess, onError } = options;
827
+ if (!propsData.action) {
828
+ Message.error("请配置上传地址 action");
829
+ onError(new Error("上传地址未配置"));
830
+ return;
831
+ }
832
+ const formData = new FormData();
833
+ formData.append(propsData.name || "file", fileItem.file);
834
+ if (propsData.data) {
835
+ Object.keys(propsData.data).forEach((key) => {
836
+ formData.append(key, propsData.data[key]);
837
+ });
838
+ }
839
+ const xhr = new XMLHttpRequest();
840
+ xhr.upload.addEventListener("progress", (e) => {
841
+ if (e.lengthComputable) {
842
+ const percent = Math.round(e.loaded / e.total * 100);
843
+ onProgress(percent, e);
844
+ }
845
+ });
846
+ xhr.addEventListener("load", () => {
847
+ if (xhr.status >= 200 && xhr.status < 300) {
848
+ try {
849
+ const response = JSON.parse(xhr.responseText);
850
+ onSuccess(response);
851
+ } catch (error) {
852
+ onSuccess(xhr.responseText);
853
+ }
854
+ } else {
855
+ onError(new Error(`上传失败: ${xhr.status}`));
856
+ }
857
+ });
858
+ xhr.addEventListener("error", () => {
859
+ onError(new Error("网络错误"));
860
+ });
861
+ xhr.addEventListener("abort", () => {
862
+ onError(new Error("上传已取消"));
863
+ });
864
+ xhr.open("POST", propsData.action);
865
+ if (propsData.headers) {
866
+ Object.keys(propsData.headers).forEach((key) => {
867
+ xhr.setRequestHeader(key, propsData.headers[key]);
868
+ });
869
+ }
870
+ if (propsData.withCredentials) {
871
+ xhr.withCredentials = true;
872
+ }
873
+ xhr.send(formData);
874
+ };
875
+ const handleChange = (fileList, currentFile) => {
876
+ fileListRef.value = fileList;
877
+ emit("change", fileList);
878
+ if (currentFile.status === "done") {
879
+ Message.success(`${currentFile.name} 上传成功`);
880
+ emit("success", currentFile.response, currentFile);
881
+ if (getProps.value.onSuccess) {
882
+ getProps.value.onSuccess(currentFile.response, currentFile);
308
883
  }
884
+ } else if (currentFile.status === "error") {
885
+ Message.error(`${currentFile.name} 上传失败`);
886
+ const error = new Error("上传失败");
887
+ emit("error", error, currentFile);
888
+ if (getProps.value.onError) {
889
+ getProps.value.onError(error, currentFile);
890
+ }
891
+ }
892
+ updateModelValue(fileList);
893
+ };
894
+ const handleProgress = (currentFile, event) => {
895
+ const percent = currentFile.percent || 0;
896
+ emit("progress", percent, currentFile);
897
+ if (getProps.value.onProgress) {
898
+ getProps.value.onProgress(percent, currentFile);
899
+ }
900
+ };
901
+ const handlePreview = (fileItem) => {
902
+ const propsData = unref(getProps);
903
+ if (propsData.onPreview) {
904
+ propsData.onPreview(fileItem);
905
+ return;
906
+ }
907
+ };
908
+ const updateModelValue = (fileList) => {
909
+ var _a;
910
+ const propsData = unref(getProps);
911
+ switch (propsData.resultType) {
912
+ case "fileList":
913
+ emit("update:modelValue", fileList);
914
+ break;
915
+ case "url":
916
+ if (propsData.multiple) {
917
+ const urls2 = fileList.filter((file) => file.status === "done" && file.url).map((file) => file.url);
918
+ emit("update:modelValue", urls2);
919
+ } else {
920
+ const url = ((_a = fileList.find((file) => file.status === "done")) == null ? void 0 : _a.url) || "";
921
+ emit("update:modelValue", url);
922
+ }
923
+ break;
924
+ case "string":
925
+ const urls = fileList.filter((file) => file.status === "done" && file.url).map((file) => file.url);
926
+ emit("update:modelValue", urls.join(","));
927
+ break;
928
+ default:
929
+ emit("update:modelValue", fileList);
930
+ }
931
+ };
932
+ const parseModelValue = (value) => {
933
+ if (!value) return [];
934
+ if (Array.isArray(value) && value.length > 0 && typeof value[0] === "object") {
935
+ return value;
936
+ }
937
+ if (Array.isArray(value)) {
938
+ return value.map((url, index) => ({
939
+ uid: `${Date.now()}-${index}`,
940
+ name: url.split("/").pop() || `file-${index}`,
941
+ url,
942
+ status: "done"
943
+ }));
944
+ }
945
+ if (typeof value === "string") {
946
+ const urls = value.split(",").filter(Boolean);
947
+ return urls.map((url, index) => ({
948
+ uid: `${Date.now()}-${index}`,
949
+ name: url.split("/").pop() || `file-${index}`,
950
+ url: url.trim(),
951
+ status: "done"
952
+ }));
953
+ }
954
+ return [];
955
+ };
956
+ const submit = () => {
957
+ var _a, _b;
958
+ (_b = (_a = uploadRef.value) == null ? void 0 : _a.submit) == null ? void 0 : _b.call(_a);
959
+ };
960
+ const abort = (fileItem) => {
961
+ var _a, _b;
962
+ (_b = (_a = uploadRef.value) == null ? void 0 : _a.abort) == null ? void 0 : _b.call(_a, fileItem);
963
+ };
964
+ const clearFiles = () => {
965
+ fileListRef.value = [];
966
+ emit("update:modelValue", []);
967
+ emit("change", []);
968
+ };
969
+ const getFileList = () => {
970
+ return fileListRef.value;
971
+ };
972
+ const upload = (fileItem) => {
973
+ var _a, _b;
974
+ (_b = (_a = uploadRef.value) == null ? void 0 : _a.upload) == null ? void 0 : _b.call(_a, fileItem);
975
+ };
976
+ const setProps = (uploadProps) => {
977
+ propsRef.value = { ...unref(propsRef), ...uploadProps };
978
+ };
979
+ const setFileList = (files) => {
980
+ fileListRef.value = files;
981
+ updateModelValue(files);
982
+ };
983
+ const addFile = (file) => {
984
+ fileListRef.value.push(file);
985
+ updateModelValue(fileListRef.value);
986
+ };
987
+ const removeFile = (fileItem) => {
988
+ const index = fileListRef.value.findIndex(
989
+ (item) => item.uid === fileItem.uid
990
+ );
991
+ if (index !== -1) {
992
+ fileListRef.value.splice(index, 1);
993
+ updateModelValue(fileListRef.value);
994
+ }
995
+ };
996
+ const updateFile = (fileItem) => {
997
+ const index = fileListRef.value.findIndex(
998
+ (item) => item.uid === fileItem.uid
999
+ );
1000
+ if (index !== -1) {
1001
+ fileListRef.value[index] = { ...fileListRef.value[index], ...fileItem };
1002
+ updateModelValue(fileListRef.value);
1003
+ }
1004
+ };
1005
+ __expose({
1006
+ submit,
1007
+ abort,
1008
+ clearFiles,
1009
+ getFileList,
1010
+ upload,
1011
+ setProps,
1012
+ setFileList,
1013
+ addFile,
1014
+ removeFile,
1015
+ updateFile
1016
+ });
1017
+ watch(
1018
+ () => props.modelValue,
1019
+ (val) => {
1020
+ fileListRef.value = parseModelValue(val);
309
1021
  },
310
1022
  { immediate: true }
311
1023
  );
312
1024
  onMounted(() => {
313
1025
  nextTick(() => {
314
1026
  emit("register", {
315
- formRef,
316
- formModel,
317
- getFieldsValue,
318
- setFieldsValue,
319
- resetFields,
320
- validate,
321
- clearValidate,
322
- updateSchema,
323
- removeSchema,
324
- getSchema,
325
- resetSchema,
1027
+ submit,
1028
+ abort,
1029
+ clearFiles,
1030
+ getFileList,
1031
+ upload,
326
1032
  setProps,
327
- scrollToField,
328
- handleSubmit
1033
+ setFileList,
1034
+ addFile,
1035
+ removeFile,
1036
+ updateFile
329
1037
  });
330
1038
  });
331
1039
  });
332
- onBeforeUnmount(() => {
333
- stopSchemasWatch();
334
- Object.keys(formModel).forEach((key) => {
335
- delete formModel[key];
336
- });
337
- internalSchemas.value = [];
338
- dynamicProps.value = {};
339
- });
340
1040
  return (_ctx, _cache) => {
341
- const _component_a_form_item = resolveComponent("a-form-item");
342
- const _component_a_col = resolveComponent("a-col");
343
1041
  const _component_a_button = resolveComponent("a-button");
344
- const _component_a_space = resolveComponent("a-space");
345
- const _component_a_row = resolveComponent("a-row");
346
- const _component_a_form = resolveComponent("a-form");
347
- return openBlock(), createBlock(_component_a_form, mergeProps({
348
- ref_key: "formRef",
349
- ref: formRef
350
- }, getBindValue.value, {
351
- model: formModel,
352
- onSubmit: handleSubmit
353
- }), {
354
- default: withCtx(() => [
355
- createVNode(_component_a_row, normalizeProps(guardReactiveProps(getRow.value)), {
356
- default: withCtx(() => [
357
- (openBlock(true), createElementBlock(Fragment, null, renderList(getVisibleSchemas.value, (schema) => {
358
- return openBlock(), createBlock(_component_a_col, mergeProps({
359
- key: schema.key || schema.field,
360
- ref_for: true
361
- }, getColProps(schema), {
362
- "data-field": schema.field
363
- }), {
1042
+ const _component_a_upload = resolveComponent("a-upload");
1043
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
1044
+ createVNode(_component_a_upload, mergeProps({
1045
+ ref_key: "uploadRef",
1046
+ ref: uploadRef
1047
+ }, getBindValue.value, {
1048
+ "file-list": fileListRef.value,
1049
+ "custom-request": handleCustomRequest,
1050
+ "before-upload": handleBeforeUpload,
1051
+ onChange: handleChange,
1052
+ onProgress: handleProgress,
1053
+ onPreview: handlePreview
1054
+ }), createSlots({ _: 2 }, [
1055
+ !hideUploadButton.value ? {
1056
+ name: "upload-button",
1057
+ fn: withCtx(() => [
1058
+ renderSlot(_ctx.$slots, "upload-button", {}, () => [
1059
+ getProps.value.listType === "picture-card" ? (openBlock(), createElementBlock("div", _hoisted_2$3, [
1060
+ createVNode(unref(IconPlus), { size: 16 }),
1061
+ getProps.value.uploadButtonText ? (openBlock(), createElementBlock("div", _hoisted_3$2, toDisplayString(getProps.value.uploadButtonText), 1)) : createCommentVNode("", true)
1062
+ ])) : (openBlock(), createBlock(_component_a_button, {
1063
+ key: 1,
1064
+ type: getProps.value.uploadButtonType || "primary"
1065
+ }, {
1066
+ icon: withCtx(() => [
1067
+ createVNode(unref(IconUpload))
1068
+ ]),
364
1069
  default: withCtx(() => [
365
- schema.render ? (openBlock(), createBlock(resolveDynamicComponent(schema.render(schema, formModel)), { key: 0 })) : (openBlock(), createBlock(_component_a_form_item, mergeProps({
366
- key: 1,
367
- ref_for: true
368
- }, getFormItemBindValue(schema)), {
369
- default: withCtx(() => [
370
- schema.renderComponentContent ? (openBlock(), createBlock(resolveDynamicComponent(schema.renderComponentContent(schema, formModel)), { key: 0 })) : (openBlock(), createBlock(resolveDynamicComponent(unref(getComponent)(schema.component)), mergeProps({
371
- key: 1,
372
- modelValue: formModel[schema.field],
373
- "onUpdate:modelValue": ($event) => formModel[schema.field] = $event,
374
- placeholder: getPlaceholderText(schema)
375
- }, { ref_for: true }, schema.componentProps), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder"]))
376
- ]),
377
- _: 2
378
- }, 1040))
1070
+ createTextVNode(" " + toDisplayString(getProps.value.uploadButtonText || "上传文件"), 1)
379
1071
  ]),
380
- _: 2
381
- }, 1040, ["data-field"]);
382
- }), 128)),
383
- getActionProps.value.showActionButtons ? (openBlock(), createBlock(_component_a_col, normalizeProps(mergeProps({ key: 0 }, getActionProps.value.actionColOptions)), {
384
- default: withCtx(() => [
385
- createVNode(_component_a_form_item, normalizeProps(guardReactiveProps(getActionProps.value.actionFormItemProps)), {
386
- default: withCtx(() => [
387
- createVNode(_component_a_space, null, {
388
- default: withCtx(() => [
389
- getActionProps.value.showSubmitButton ? (openBlock(), createBlock(_component_a_button, {
390
- key: 0,
391
- type: "primary",
392
- "html-type": "submit",
393
- loading: submitLoading.value
394
- }, {
395
- default: withCtx(() => [
396
- createTextVNode(toDisplayString(getActionProps.value.submitButtonText), 1)
397
- ]),
398
- _: 1
399
- }, 8, ["loading"])) : createCommentVNode("", true),
400
- getActionProps.value.showResetButton ? (openBlock(), createBlock(_component_a_button, {
401
- key: 1,
402
- onClick: handleReset
403
- }, {
404
- default: withCtx(() => [
405
- createTextVNode(toDisplayString(getActionProps.value.resetButtonText), 1)
406
- ]),
407
- _: 1
408
- })) : createCommentVNode("", true),
409
- renderSlot(_ctx.$slots, "actions")
410
- ]),
411
- _: 3
412
- })
413
- ]),
414
- _: 3
415
- }, 16)
416
- ]),
417
- _: 3
418
- }, 16)) : createCommentVNode("", true)
1072
+ _: 1
1073
+ }, 8, ["type"]))
1074
+ ], true)
419
1075
  ]),
420
- _: 3
421
- }, 16)
422
- ]),
423
- _: 3
424
- }, 16, ["model"]);
1076
+ key: "0"
1077
+ } : void 0,
1078
+ _ctx.$slots.default ? {
1079
+ name: "default",
1080
+ fn: withCtx(() => [
1081
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
1082
+ ]),
1083
+ key: "1"
1084
+ } : void 0,
1085
+ getProps.value.tip || _ctx.$slots.tip ? {
1086
+ name: "tip",
1087
+ fn: withCtx(() => [
1088
+ renderSlot(_ctx.$slots, "tip", {}, () => [
1089
+ createElementVNode("div", _hoisted_4$2, toDisplayString(getProps.value.tip), 1)
1090
+ ], true)
1091
+ ]),
1092
+ key: "2"
1093
+ } : void 0,
1094
+ _ctx.$slots.file ? {
1095
+ name: "file",
1096
+ fn: withCtx(({ file }) => [
1097
+ renderSlot(_ctx.$slots, "file", { file }, void 0, true)
1098
+ ]),
1099
+ key: "3"
1100
+ } : void 0
1101
+ ]), 1040, ["file-list"])
1102
+ ]);
425
1103
  };
426
1104
  }
427
1105
  });
428
- function useForm(options = {}) {
429
- const formRef = ref(null);
430
- const formModel = reactive({});
431
- const loadedRef = ref(false);
432
- const propsRef = ref({});
433
- const initFormModel = () => {
434
- var _a, _b;
435
- const schemas = unref(((_b = (_a = formRef.value) == null ? void 0 : _a.getSchema) == null ? void 0 : _b.call(_a)) || options.schemas || []);
436
- schemas.forEach((schema) => {
437
- if (schema.defaultValue !== void 0) {
438
- formModel[schema.field] = schema.defaultValue;
439
- }
440
- });
441
- };
442
- const register = async (formInstance) => {
443
- await nextTick();
444
- formRef.value = formInstance;
445
- loadedRef.value = true;
446
- if (options && Object.keys(options).length > 0) {
447
- await setProps(options);
448
- }
449
- initFormModel();
450
- };
451
- const getForm = () => {
452
- const form = unref(formRef);
453
- if (!form) {
454
- const error = "表单实例尚未注册,请确保组件已挂载并正确使用 @register";
455
- console.error(error);
456
- throw new Error(error);
457
- }
458
- return form;
459
- };
460
- const getFormSafe = () => {
461
- return unref(formRef);
462
- };
463
- const getFieldsValue = () => {
464
- const form = getFormSafe();
465
- if (!form) return {};
466
- if (form.getFieldsValue) {
467
- return form.getFieldsValue();
468
- }
469
- return { ...formModel };
470
- };
471
- const setFieldsValue = async (values) => {
472
- const form = getFormSafe();
473
- if (!form) return;
474
- if (form.setFieldsValue) {
475
- await form.setFieldsValue(values);
476
- } else {
477
- Object.keys(values).forEach((key) => {
478
- formModel[key] = values[key];
479
- });
480
- }
481
- };
482
- const resetFields = async () => {
483
- var _a;
484
- const form = getFormSafe();
485
- if (!form) return;
486
- if (form.resetFields) {
487
- await form.resetFields();
488
- } else if ((_a = form.formRef) == null ? void 0 : _a.value) {
489
- await form.formRef.value.resetFields();
490
- }
491
- };
492
- const validate = async (nameList) => {
493
- var _a;
494
- const form = getFormSafe();
495
- if (!form) return Promise.reject("表单实例不存在");
496
- if (form.validate) {
497
- return await form.validate(nameList);
498
- } else if ((_a = form.formRef) == null ? void 0 : _a.value) {
499
- return await form.formRef.value.validate(nameList);
500
- }
501
- return Promise.resolve(void 0);
502
- };
503
- const validateFields = async (nameList) => {
504
- return await validate(nameList);
505
- };
506
- const clearValidate = async (field) => {
507
- var _a;
508
- const form = getFormSafe();
509
- if (!form) return;
510
- if (form.clearValidate) {
511
- await form.clearValidate(field);
512
- } else if ((_a = form.formRef) == null ? void 0 : _a.value) {
513
- await form.formRef.value.clearValidate(field);
514
- }
515
- };
516
- const submit = async () => {
517
- const form = getFormSafe();
518
- if (!form) return;
519
- if (form.handleSubmit) {
520
- return await form.handleSubmit();
521
- }
522
- await validate();
523
- return getFieldsValue();
524
- };
525
- const updateSchema = async (schema) => {
526
- const form = getFormSafe();
527
- if (!form) return;
528
- const schemaList = Array.isArray(schema) ? schema : [schema];
529
- if (form.updateSchema) {
530
- await form.updateSchema(schemaList);
531
- }
532
- };
533
- const resetSchema = async (schemas) => {
534
- const form = getFormSafe();
535
- if (!form) return;
536
- if (form.resetSchema) {
537
- await form.resetSchema(schemas);
538
- }
539
- };
540
- const removeSchemaByField = async (field) => {
541
- const form = getFormSafe();
542
- if (!form) return;
543
- const fields = Array.isArray(field) ? field : [field];
544
- if (form.removeSchema) {
545
- await form.removeSchema(fields);
1106
+ const _export_sfc = (sfc, props) => {
1107
+ const target = sfc.__vccOpts || sfc;
1108
+ for (const [key, val] of props) {
1109
+ target[key] = val;
1110
+ }
1111
+ return target;
1112
+ };
1113
+ const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-179e6d71"]]);
1114
+ const componentMap = {
1115
+ Input,
1116
+ InputNumber,
1117
+ InputPassword,
1118
+ Textarea,
1119
+ AutoComplete,
1120
+ Select,
1121
+ Radio,
1122
+ RadioGroup,
1123
+ Checkbox,
1124
+ CheckboxGroup,
1125
+ Cascader,
1126
+ TreeSelect,
1127
+ DatePicker,
1128
+ TimePicker,
1129
+ RangePicker,
1130
+ Switch,
1131
+ Slider,
1132
+ Rate,
1133
+ Upload,
1134
+ BasicUpload,
1135
+ Mention,
1136
+ Transfer
1137
+ };
1138
+ const customComponentMap = /* @__PURE__ */ new Map();
1139
+ function registerComponent(name, component) {
1140
+ customComponentMap.set(name, component);
1141
+ }
1142
+ function getComponent(name) {
1143
+ if (typeof name === "string") {
1144
+ if (name in componentMap) {
1145
+ return componentMap[name];
546
1146
  }
547
- fields.forEach((f) => {
548
- if (f in formModel) {
549
- delete formModel[f];
550
- }
551
- });
552
- };
553
- const appendSchemaByField = async (schema, prefixField, first = false) => {
554
- var _a;
555
- const form = getFormSafe();
556
- if (!form) return;
557
- const currentSchemas = ((_a = form.getSchema) == null ? void 0 : _a.call(form)) || [];
558
- const schemas = Array.isArray(currentSchemas) ? [...currentSchemas] : [];
559
- const schemaList = Array.isArray(schema) ? schema : [schema];
560
- if (prefixField) {
561
- const index = schemas.findIndex((s) => s.field === prefixField);
562
- if (index === -1) {
563
- console.warn(`字段 "${prefixField}" 不存在,无法插入 schema`);
564
- return;
565
- }
566
- const insertIndex = first ? index : index + 1;
567
- schemas.splice(insertIndex, 0, ...schemaList);
568
- } else {
569
- if (first) {
570
- schemas.unshift(...schemaList);
571
- } else {
572
- schemas.push(...schemaList);
573
- }
574
- }
575
- if (form.resetSchema) {
576
- await form.resetSchema(schemas);
577
- }
578
- schemaList.forEach((s) => {
579
- if (s.defaultValue !== void 0) {
580
- formModel[s.field] = s.defaultValue;
581
- }
582
- });
583
- };
584
- const getSchema = (field) => {
585
- const form = getFormSafe();
586
- if (!form) return void 0;
587
- if (form.getSchema) {
588
- return form.getSchema(field);
589
- }
590
- return void 0;
591
- };
592
- const setProps = async (formProps) => {
593
- propsRef.value = { ...propsRef.value, ...formProps };
594
- const form = getFormSafe();
595
- if (!form) {
596
- return;
597
- }
598
- if (form.setProps) {
599
- await form.setProps(formProps);
600
- }
601
- };
602
- const scrollToField = async (name, options2) => {
603
- const form = getFormSafe();
604
- if (!form) return;
605
- if (form.scrollToField) {
606
- await form.scrollToField(name, options2);
607
- }
608
- };
609
- const formMethods = {
610
- getFieldsValue,
611
- setFieldsValue,
612
- resetFields,
613
- validate,
614
- validateFields,
615
- clearValidate,
616
- submit,
617
- updateSchema,
618
- resetSchema,
619
- removeSchemaByField,
620
- appendSchemaByField,
621
- getSchema,
622
- setProps,
623
- scrollToField,
624
- formModel,
625
- formRef,
626
- getForm
627
- };
628
- return [register, formMethods];
629
- }
630
- function createFormSchema(schemas) {
631
- return schemas.map((schema, index) => ({
632
- key: schema.key || `${schema.field}_${index}`,
633
- ...schema
634
- }));
635
- }
636
- function mergeFormSchemas(...schemas) {
637
- return schemas.flat();
638
- }
639
- const configProviderInjectionKey = Symbol("ArcoConfigProvider");
640
- const CLASS_PREFIX = "arco";
641
- const GLOBAL_CONFIG_NAME = "$arco";
642
- const getPrefixCls = (componentName) => {
643
- var _a, _b, _c;
644
- const instance = getCurrentInstance();
645
- const configProvider = inject(configProviderInjectionKey, void 0);
646
- const prefix = (_c = (_b = configProvider == null ? void 0 : configProvider.prefixCls) != null ? _b : (_a = instance == null ? void 0 : instance.appContext.config.globalProperties[GLOBAL_CONFIG_NAME]) == null ? void 0 : _a.classPrefix) != null ? _c : CLASS_PREFIX;
647
- {
648
- return `${prefix}-${componentName}`;
1147
+ return customComponentMap.get(name);
649
1148
  }
650
- };
651
- const opt = Object.prototype.toString;
652
- function isNumber(obj) {
653
- return opt.call(obj) === "[object Number]" && obj === obj;
1149
+ return name;
654
1150
  }
655
- var _export_sfc$1 = (sfc, props) => {
656
- for (const [key, val] of props) {
657
- sfc[key] = val;
1151
+ const componentsNeedPlaceholder = /* @__PURE__ */ new Set([
1152
+ "Input",
1153
+ "InputPassword",
1154
+ "Textarea",
1155
+ "AutoComplete"
1156
+ ]);
1157
+ const componentsNeedSelectPlaceholder = /* @__PURE__ */ new Set([
1158
+ "Select",
1159
+ "DatePicker",
1160
+ "TimePicker",
1161
+ "RangePicker",
1162
+ "Cascader",
1163
+ "TreeSelect"
1164
+ ]);
1165
+ function getPlaceholder(component, label) {
1166
+ if (componentsNeedPlaceholder.has(component)) {
1167
+ return `请输入${label}`;
658
1168
  }
659
- return sfc;
660
- };
661
- const _sfc_main$8 = defineComponent({
662
- name: "IconQuestionCircle",
663
- props: {
664
- size: {
665
- type: [Number, String]
666
- },
667
- strokeWidth: {
668
- type: Number,
669
- default: 4
670
- },
671
- strokeLinecap: {
672
- type: String,
673
- default: "butt",
674
- validator: (value) => {
675
- return ["butt", "round", "square"].includes(value);
676
- }
677
- },
678
- strokeLinejoin: {
679
- type: String,
680
- default: "miter",
681
- validator: (value) => {
682
- return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
683
- }
684
- },
685
- rotate: Number,
686
- spin: Boolean
687
- },
688
- emits: {
689
- click: (ev) => true
690
- },
691
- setup(props, { emit }) {
692
- const prefixCls = getPrefixCls("icon");
693
- const cls = computed(() => [prefixCls, `${prefixCls}-question-circle`, { [`${prefixCls}-spin`]: props.spin }]);
694
- const innerStyle = computed(() => {
695
- const styles = {};
696
- if (props.size) {
697
- styles.fontSize = isNumber(props.size) ? `${props.size}px` : props.size;
698
- }
699
- if (props.rotate) {
700
- styles.transform = `rotate(${props.rotate}deg)`;
701
- }
702
- return styles;
703
- });
704
- const onClick = (ev) => {
705
- emit("click", ev);
706
- };
707
- return {
708
- cls,
709
- innerStyle,
710
- onClick
711
- };
1169
+ if (componentsNeedSelectPlaceholder.has(component)) {
1170
+ return `请选择${label}`;
712
1171
  }
713
- });
714
- const _hoisted_1$8 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
715
- function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
716
- return openBlock(), createElementBlock("svg", {
717
- viewBox: "0 0 48 48",
718
- fill: "none",
719
- xmlns: "http://www.w3.org/2000/svg",
720
- stroke: "currentColor",
721
- class: normalizeClass(_ctx.cls),
722
- style: normalizeStyle(_ctx.innerStyle),
723
- "stroke-width": _ctx.strokeWidth,
724
- "stroke-linecap": _ctx.strokeLinecap,
725
- "stroke-linejoin": _ctx.strokeLinejoin,
726
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
727
- }, _cache[1] || (_cache[1] = [
728
- createElementVNode("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),
729
- createElementVNode("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)
730
- ]), 14, _hoisted_1$8);
1172
+ return "";
731
1173
  }
732
- var _IconQuestionCircle = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["render", _sfc_render$5]]);
733
- const IconQuestionCircle = Object.assign(_IconQuestionCircle, {
734
- install: (app, options) => {
735
- var _a;
736
- const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
737
- app.component(iconPrefix + _IconQuestionCircle.name, _IconQuestionCircle);
738
- }
739
- });
740
- const _sfc_main$7 = defineComponent({
741
- name: "IconRefresh",
742
- props: {
743
- size: {
744
- type: [Number, String]
745
- },
746
- strokeWidth: {
747
- type: Number,
748
- default: 4
749
- },
750
- strokeLinecap: {
751
- type: String,
752
- default: "butt",
753
- validator: (value) => {
754
- return ["butt", "round", "square"].includes(value);
755
- }
756
- },
757
- strokeLinejoin: {
758
- type: String,
759
- default: "miter",
760
- validator: (value) => {
761
- return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
762
- }
763
- },
764
- rotate: Number,
765
- spin: Boolean
1174
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1175
+ ...{
1176
+ name: "BasicForm",
1177
+ inheritAttrs: false
766
1178
  },
767
- emits: {
768
- click: (ev) => true
1179
+ __name: "BasicForm",
1180
+ props: {
1181
+ schemas: { default: () => [] },
1182
+ layout: { default: "horizontal" },
1183
+ size: {},
1184
+ disabled: { type: Boolean, default: false },
1185
+ labelAlign: { default: "right" },
1186
+ autoLabelWidth: { type: Boolean },
1187
+ labelWidth: {},
1188
+ labelColProps: {},
1189
+ wrapperColProps: {},
1190
+ baseColProps: { default: () => ({ span: 24 }) },
1191
+ baseFormItemProps: {},
1192
+ actionColOptions: { default: () => ({ span: 24 }) },
1193
+ actionFormItemProps: {},
1194
+ autoSetPlaceHolder: { type: Boolean, default: true },
1195
+ showSubmitButton: { type: Boolean, default: true },
1196
+ showResetButton: { type: Boolean, default: true },
1197
+ submitButtonText: { default: "提交" },
1198
+ resetButtonText: { default: "重置" },
1199
+ showActionButtons: { type: Boolean, default: true }
769
1200
  },
770
- setup(props, { emit }) {
771
- const prefixCls = getPrefixCls("icon");
772
- const cls = computed(() => [prefixCls, `${prefixCls}-refresh`, { [`${prefixCls}-spin`]: props.spin }]);
773
- const innerStyle = computed(() => {
774
- const styles = {};
775
- if (props.size) {
776
- styles.fontSize = isNumber(props.size) ? `${props.size}px` : props.size;
777
- }
778
- if (props.rotate) {
779
- styles.transform = `rotate(${props.rotate}deg)`;
780
- }
781
- return styles;
1201
+ emits: ["register", "submit", "reset", "validate"],
1202
+ setup(__props, { expose: __expose, emit: __emit }) {
1203
+ const props = __props;
1204
+ const emit = __emit;
1205
+ const formRef = ref();
1206
+ const formModel = reactive({});
1207
+ const submitLoading = ref(false);
1208
+ const internalSchemas = ref([]);
1209
+ const dynamicProps = ref({});
1210
+ const getProps = computed(() => {
1211
+ return { ...props, ...dynamicProps.value };
782
1212
  });
783
- const onClick = (ev) => {
784
- emit("click", ev);
1213
+ const getBindValue = computed(() => {
1214
+ const propsData = unref(getProps);
1215
+ return {
1216
+ layout: propsData.layout,
1217
+ size: propsData.size,
1218
+ disabled: propsData.disabled,
1219
+ labelAlign: propsData.labelAlign,
1220
+ autoLabelWidth: propsData.autoLabelWidth,
1221
+ labelWidth: propsData.labelWidth,
1222
+ labelColProps: propsData.labelColProps,
1223
+ wrapperColProps: propsData.wrapperColProps
1224
+ };
1225
+ });
1226
+ const getRow = computed(() => {
1227
+ return {
1228
+ gutter: 24
1229
+ };
1230
+ });
1231
+ const getActionProps = computed(() => {
1232
+ const propsData = unref(getProps);
1233
+ return {
1234
+ showActionButtons: propsData.showActionButtons !== false,
1235
+ showSubmitButton: propsData.showSubmitButton !== false,
1236
+ showResetButton: propsData.showResetButton !== false,
1237
+ submitButtonText: propsData.submitButtonText || "提交",
1238
+ resetButtonText: propsData.resetButtonText || "重置",
1239
+ actionColOptions: propsData.actionColOptions || { span: 24 },
1240
+ actionFormItemProps: propsData.actionFormItemProps || {}
1241
+ };
1242
+ });
1243
+ const initFormModel = () => {
1244
+ const schemas = internalSchemas.value.length > 0 ? internalSchemas.value : props.schemas || [];
1245
+ if (!schemas.length) return;
1246
+ const schemaFields = new Set(schemas.map((s) => s.field));
1247
+ Object.keys(formModel).forEach((key) => {
1248
+ if (!schemaFields.has(key)) {
1249
+ delete formModel[key];
1250
+ }
1251
+ });
1252
+ schemas.forEach((schema) => {
1253
+ if (!(schema.field in formModel)) {
1254
+ formModel[schema.field] = schema.defaultValue !== void 0 ? schema.defaultValue : void 0;
1255
+ }
1256
+ });
785
1257
  };
786
- return {
787
- cls,
788
- innerStyle,
789
- onClick
1258
+ const getVisibleSchemas = computed(() => {
1259
+ const schemas = internalSchemas.value.length > 0 ? internalSchemas.value : props.schemas || [];
1260
+ return schemas.filter((schema) => {
1261
+ if (schema.show === void 0) return true;
1262
+ if (typeof schema.show === "boolean") return schema.show;
1263
+ return schema.show(formModel);
1264
+ });
1265
+ });
1266
+ const getColProps = (schema) => {
1267
+ const propsData = unref(getProps);
1268
+ return schema.colProps || propsData.baseColProps || { span: 24 };
790
1269
  };
791
- }
792
- });
793
- const _hoisted_1$7 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
794
- function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
795
- return openBlock(), createElementBlock("svg", {
796
- viewBox: "0 0 48 48",
797
- fill: "none",
798
- xmlns: "http://www.w3.org/2000/svg",
799
- stroke: "currentColor",
800
- class: normalizeClass(_ctx.cls),
801
- style: normalizeStyle(_ctx.innerStyle),
802
- "stroke-width": _ctx.strokeWidth,
803
- "stroke-linecap": _ctx.strokeLinecap,
804
- "stroke-linejoin": _ctx.strokeLinejoin,
805
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
806
- }, _cache[1] || (_cache[1] = [
807
- createElementVNode("path", { d: "M38.837 18C36.463 12.136 30.715 8 24 8 15.163 8 8 15.163 8 24s7.163 16 16 16c7.455 0 13.72-5.1 15.496-12M40 8v10H30" }, null, -1)
808
- ]), 14, _hoisted_1$7);
809
- }
810
- var _IconRefresh = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["render", _sfc_render$4]]);
811
- const IconRefresh = Object.assign(_IconRefresh, {
812
- install: (app, options) => {
813
- var _a;
814
- const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
815
- app.component(iconPrefix + _IconRefresh.name, _IconRefresh);
816
- }
817
- });
818
- const _sfc_main$6 = defineComponent({
819
- name: "IconSettings",
820
- props: {
821
- size: {
822
- type: [Number, String]
823
- },
824
- strokeWidth: {
825
- type: Number,
826
- default: 4
827
- },
828
- strokeLinecap: {
829
- type: String,
830
- default: "butt",
831
- validator: (value) => {
832
- return ["butt", "round", "square"].includes(value);
1270
+ const getFormItemBindValue = (schema) => {
1271
+ const propsData = unref(getProps);
1272
+ let disabled = propsData.disabled;
1273
+ if (schema.disabled !== void 0) {
1274
+ disabled = typeof schema.disabled === "boolean" ? schema.disabled : schema.disabled(formModel);
833
1275
  }
834
- },
835
- strokeLinejoin: {
836
- type: String,
837
- default: "miter",
838
- validator: (value) => {
839
- return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
1276
+ return {
1277
+ field: schema.field,
1278
+ label: schema.label,
1279
+ labelColProps: schema.labelColProps || propsData.labelColProps,
1280
+ wrapperColProps: schema.wrapperColProps || propsData.wrapperColProps,
1281
+ rules: schema.rules,
1282
+ disabled,
1283
+ help: schema.help,
1284
+ extra: schema.extra,
1285
+ required: schema.required,
1286
+ ...propsData.baseFormItemProps || {},
1287
+ ...schema.formItemProps || {}
1288
+ };
1289
+ };
1290
+ const getPlaceholderText = (schema) => {
1291
+ var _a;
1292
+ const propsData = unref(getProps);
1293
+ if ((_a = schema.componentProps) == null ? void 0 : _a.placeholder) {
1294
+ return schema.componentProps.placeholder;
840
1295
  }
841
- },
842
- rotate: Number,
843
- spin: Boolean
844
- },
845
- emits: {
846
- click: (ev) => true
847
- },
848
- setup(props, { emit }) {
849
- const prefixCls = getPrefixCls("icon");
850
- const cls = computed(() => [prefixCls, `${prefixCls}-settings`, { [`${prefixCls}-spin`]: props.spin }]);
851
- const innerStyle = computed(() => {
852
- const styles = {};
853
- if (props.size) {
854
- styles.fontSize = isNumber(props.size) ? `${props.size}px` : props.size;
1296
+ if (!propsData.autoSetPlaceHolder) {
1297
+ return "";
855
1298
  }
856
- if (props.rotate) {
857
- styles.transform = `rotate(${props.rotate}deg)`;
1299
+ const componentType = typeof schema.component === "string" ? schema.component : "";
1300
+ return getPlaceholder(componentType, schema.label);
1301
+ };
1302
+ const handleSubmit = async (data) => {
1303
+ try {
1304
+ submitLoading.value = true;
1305
+ if (!data) {
1306
+ try {
1307
+ await validate();
1308
+ const values = getFieldsValue();
1309
+ emit("submit", values);
1310
+ return values;
1311
+ } catch (error) {
1312
+ console.warn("表单验证失败:", error);
1313
+ throw error;
1314
+ }
1315
+ }
1316
+ if (data.errors) {
1317
+ console.warn("表单验证失败:", data.errors);
1318
+ return;
1319
+ }
1320
+ emit("submit", data.values);
1321
+ return data.values;
1322
+ } finally {
1323
+ submitLoading.value = false;
858
1324
  }
859
- return styles;
860
- });
861
- const onClick = (ev) => {
862
- emit("click", ev);
863
1325
  };
864
- return {
865
- cls,
866
- innerStyle,
867
- onClick
1326
+ const handleReset = () => {
1327
+ var _a;
1328
+ (_a = formRef.value) == null ? void 0 : _a.resetFields();
1329
+ emit("reset");
1330
+ };
1331
+ const getFieldsValue = () => {
1332
+ return { ...formModel };
1333
+ };
1334
+ const setFieldsValue = (values) => {
1335
+ Object.keys(values).forEach((key) => {
1336
+ const schemas = internalSchemas.value.length > 0 ? internalSchemas.value : props.schemas || [];
1337
+ const hasField = schemas.some((s) => s.field === key);
1338
+ if (hasField) {
1339
+ formModel[key] = values[key];
1340
+ } else {
1341
+ console.warn(`字段 "${key}" 不在表单 schema 中`);
1342
+ }
1343
+ });
1344
+ };
1345
+ const resetFields = () => {
1346
+ var _a;
1347
+ (_a = formRef.value) == null ? void 0 : _a.resetFields();
1348
+ };
1349
+ const validate = async () => {
1350
+ var _a;
1351
+ return (_a = formRef.value) == null ? void 0 : _a.validate();
1352
+ };
1353
+ const clearValidate = (field) => {
1354
+ var _a;
1355
+ (_a = formRef.value) == null ? void 0 : _a.clearValidate(field);
1356
+ };
1357
+ const updateSchema = (schema) => {
1358
+ const schemas = Array.isArray(schema) ? schema : [schema];
1359
+ schemas.forEach((item) => {
1360
+ const index = internalSchemas.value.findIndex(
1361
+ (s) => s.field === item.field
1362
+ );
1363
+ if (index !== -1) {
1364
+ const oldSchema = internalSchemas.value[index];
1365
+ internalSchemas.value[index] = { ...oldSchema, ...item };
1366
+ if (item.defaultValue !== void 0 && formModel[item.field] === oldSchema.defaultValue) {
1367
+ formModel[item.field] = item.defaultValue;
1368
+ }
1369
+ }
1370
+ });
1371
+ };
1372
+ const removeSchema = (field) => {
1373
+ const fields = Array.isArray(field) ? field : [field];
1374
+ fields.forEach((f) => {
1375
+ const index = internalSchemas.value.findIndex((s) => s.field === f);
1376
+ if (index !== -1) {
1377
+ internalSchemas.value.splice(index, 1);
1378
+ delete formModel[f];
1379
+ }
1380
+ });
1381
+ };
1382
+ const getSchema = (field) => {
1383
+ const schemas = internalSchemas.value.length > 0 ? internalSchemas.value : props.schemas || [];
1384
+ if (!field) return schemas;
1385
+ return schemas.find((s) => s.field === field);
1386
+ };
1387
+ const resetSchema = (schemas) => {
1388
+ internalSchemas.value = [...schemas];
1389
+ initFormModel();
1390
+ };
1391
+ const setProps = (formProps) => {
1392
+ dynamicProps.value = { ...dynamicProps.value, ...formProps };
1393
+ if (formProps.schemas && Array.isArray(formProps.schemas)) {
1394
+ internalSchemas.value = [...formProps.schemas];
1395
+ initFormModel();
1396
+ }
1397
+ };
1398
+ const scrollToField = (name, options) => {
1399
+ nextTick(() => {
1400
+ const element = document.querySelector(`[data-field="${name}"]`);
1401
+ if (element) {
1402
+ element.scrollIntoView(options);
1403
+ }
1404
+ });
1405
+ };
1406
+ __expose({
1407
+ formRef,
1408
+ formModel,
1409
+ handleSubmit,
1410
+ getVisibleSchemas: () => getVisibleSchemas.value,
1411
+ getColProps,
1412
+ getFormItemBindValue,
1413
+ getPlaceholderText,
1414
+ getFieldsValue,
1415
+ setFieldsValue,
1416
+ resetFields,
1417
+ validate,
1418
+ clearValidate,
1419
+ updateSchema,
1420
+ removeSchema,
1421
+ getSchema,
1422
+ resetSchema,
1423
+ setProps,
1424
+ scrollToField
1425
+ });
1426
+ const stopSchemasWatch = watch(
1427
+ () => props.schemas,
1428
+ (newSchemas) => {
1429
+ if (newSchemas) {
1430
+ internalSchemas.value = [...newSchemas];
1431
+ initFormModel();
1432
+ }
1433
+ },
1434
+ { immediate: true }
1435
+ );
1436
+ onMounted(() => {
1437
+ nextTick(() => {
1438
+ emit("register", {
1439
+ formRef,
1440
+ formModel,
1441
+ getFieldsValue,
1442
+ setFieldsValue,
1443
+ resetFields,
1444
+ validate,
1445
+ clearValidate,
1446
+ updateSchema,
1447
+ removeSchema,
1448
+ getSchema,
1449
+ resetSchema,
1450
+ setProps,
1451
+ scrollToField,
1452
+ handleSubmit
1453
+ });
1454
+ });
1455
+ });
1456
+ onBeforeUnmount(() => {
1457
+ stopSchemasWatch();
1458
+ Object.keys(formModel).forEach((key) => {
1459
+ delete formModel[key];
1460
+ });
1461
+ internalSchemas.value = [];
1462
+ dynamicProps.value = {};
1463
+ });
1464
+ return (_ctx, _cache) => {
1465
+ const _component_a_form_item = resolveComponent("a-form-item");
1466
+ const _component_a_col = resolveComponent("a-col");
1467
+ const _component_a_button = resolveComponent("a-button");
1468
+ const _component_a_space = resolveComponent("a-space");
1469
+ const _component_a_row = resolveComponent("a-row");
1470
+ const _component_a_form = resolveComponent("a-form");
1471
+ return openBlock(), createBlock(_component_a_form, mergeProps({
1472
+ ref_key: "formRef",
1473
+ ref: formRef
1474
+ }, getBindValue.value, {
1475
+ model: formModel,
1476
+ onSubmit: handleSubmit
1477
+ }), {
1478
+ default: withCtx(() => [
1479
+ createVNode(_component_a_row, normalizeProps(guardReactiveProps(getRow.value)), {
1480
+ default: withCtx(() => [
1481
+ (openBlock(true), createElementBlock(Fragment, null, renderList(getVisibleSchemas.value, (schema) => {
1482
+ return openBlock(), createBlock(_component_a_col, mergeProps({
1483
+ key: schema.key || schema.field,
1484
+ ref_for: true
1485
+ }, getColProps(schema), {
1486
+ "data-field": schema.field
1487
+ }), {
1488
+ default: withCtx(() => [
1489
+ schema.render ? (openBlock(), createBlock(resolveDynamicComponent(schema.render(schema, formModel)), { key: 0 })) : (openBlock(), createBlock(_component_a_form_item, mergeProps({
1490
+ key: 1,
1491
+ ref_for: true
1492
+ }, getFormItemBindValue(schema)), {
1493
+ default: withCtx(() => [
1494
+ schema.renderComponentContent ? (openBlock(), createBlock(resolveDynamicComponent(schema.renderComponentContent(schema, formModel)), { key: 0 })) : (openBlock(), createBlock(resolveDynamicComponent(unref(getComponent)(schema.component)), mergeProps({
1495
+ key: 1,
1496
+ modelValue: formModel[schema.field],
1497
+ "onUpdate:modelValue": ($event) => formModel[schema.field] = $event,
1498
+ placeholder: getPlaceholderText(schema)
1499
+ }, { ref_for: true }, schema.componentProps), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder"]))
1500
+ ]),
1501
+ _: 2
1502
+ }, 1040))
1503
+ ]),
1504
+ _: 2
1505
+ }, 1040, ["data-field"]);
1506
+ }), 128)),
1507
+ getActionProps.value.showActionButtons ? (openBlock(), createBlock(_component_a_col, normalizeProps(mergeProps({ key: 0 }, getActionProps.value.actionColOptions)), {
1508
+ default: withCtx(() => [
1509
+ createVNode(_component_a_form_item, normalizeProps(guardReactiveProps(getActionProps.value.actionFormItemProps)), {
1510
+ default: withCtx(() => [
1511
+ createVNode(_component_a_space, null, {
1512
+ default: withCtx(() => [
1513
+ getActionProps.value.showSubmitButton ? (openBlock(), createBlock(_component_a_button, {
1514
+ key: 0,
1515
+ type: "primary",
1516
+ "html-type": "submit",
1517
+ loading: submitLoading.value
1518
+ }, {
1519
+ default: withCtx(() => [
1520
+ createTextVNode(toDisplayString(getActionProps.value.submitButtonText), 1)
1521
+ ]),
1522
+ _: 1
1523
+ }, 8, ["loading"])) : createCommentVNode("", true),
1524
+ getActionProps.value.showResetButton ? (openBlock(), createBlock(_component_a_button, {
1525
+ key: 1,
1526
+ onClick: handleReset
1527
+ }, {
1528
+ default: withCtx(() => [
1529
+ createTextVNode(toDisplayString(getActionProps.value.resetButtonText), 1)
1530
+ ]),
1531
+ _: 1
1532
+ })) : createCommentVNode("", true),
1533
+ renderSlot(_ctx.$slots, "actions")
1534
+ ]),
1535
+ _: 3
1536
+ })
1537
+ ]),
1538
+ _: 3
1539
+ }, 16)
1540
+ ]),
1541
+ _: 3
1542
+ }, 16)) : createCommentVNode("", true)
1543
+ ]),
1544
+ _: 3
1545
+ }, 16)
1546
+ ]),
1547
+ _: 3
1548
+ }, 16, ["model"]);
868
1549
  };
869
1550
  }
870
1551
  });
871
- const _hoisted_1$6 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
872
- function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
873
- return openBlock(), createElementBlock("svg", {
874
- viewBox: "0 0 48 48",
875
- fill: "none",
876
- xmlns: "http://www.w3.org/2000/svg",
877
- stroke: "currentColor",
878
- class: normalizeClass(_ctx.cls),
879
- style: normalizeStyle(_ctx.innerStyle),
880
- "stroke-width": _ctx.strokeWidth,
881
- "stroke-linecap": _ctx.strokeLinecap,
882
- "stroke-linejoin": _ctx.strokeLinejoin,
883
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
884
- }, _cache[1] || (_cache[1] = [
885
- createElementVNode("path", { d: "M18.797 6.732A1 1 0 0 1 19.76 6h8.48a1 1 0 0 1 .964.732l1.285 4.628a1 1 0 0 0 1.213.7l4.651-1.2a1 1 0 0 1 1.116.468l4.24 7.344a1 1 0 0 1-.153 1.2L38.193 23.3a1 1 0 0 0 0 1.402l3.364 3.427a1 1 0 0 1 .153 1.2l-4.24 7.344a1 1 0 0 1-1.116.468l-4.65-1.2a1 1 0 0 0-1.214.7l-1.285 4.628a1 1 0 0 1-.964.732h-8.48a1 1 0 0 1-.963-.732L17.51 36.64a1 1 0 0 0-1.213-.7l-4.65 1.2a1 1 0 0 1-1.116-.468l-4.24-7.344a1 1 0 0 1 .153-1.2L9.809 24.7a1 1 0 0 0 0-1.402l-3.364-3.427a1 1 0 0 1-.153-1.2l4.24-7.344a1 1 0 0 1 1.116-.468l4.65 1.2a1 1 0 0 0 1.213-.7l1.286-4.628Z" }, null, -1),
886
- createElementVNode("path", { d: "M30 24a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z" }, null, -1)
887
- ]), 14, _hoisted_1$6);
888
- }
889
- var _IconSettings = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["render", _sfc_render$3]]);
890
- const IconSettings = Object.assign(_IconSettings, {
891
- install: (app, options) => {
892
- var _a;
893
- const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
894
- app.component(iconPrefix + _IconSettings.name, _IconSettings);
895
- }
896
- });
897
- const _sfc_main$5 = defineComponent({
898
- name: "IconLineHeight",
899
- props: {
900
- size: {
901
- type: [Number, String]
902
- },
903
- strokeWidth: {
904
- type: Number,
905
- default: 4
906
- },
907
- strokeLinecap: {
908
- type: String,
909
- default: "butt",
910
- validator: (value) => {
911
- return ["butt", "round", "square"].includes(value);
912
- }
913
- },
914
- strokeLinejoin: {
915
- type: String,
916
- default: "miter",
917
- validator: (value) => {
918
- return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
919
- }
920
- },
921
- rotate: Number,
922
- spin: Boolean
923
- },
924
- emits: {
925
- click: (ev) => true
926
- },
927
- setup(props, { emit }) {
928
- const prefixCls = getPrefixCls("icon");
929
- const cls = computed(() => [prefixCls, `${prefixCls}-line-height`, { [`${prefixCls}-spin`]: props.spin }]);
930
- const innerStyle = computed(() => {
931
- const styles = {};
932
- if (props.size) {
933
- styles.fontSize = isNumber(props.size) ? `${props.size}px` : props.size;
934
- }
935
- if (props.rotate) {
936
- styles.transform = `rotate(${props.rotate}deg)`;
1552
+ function useForm(options = {}) {
1553
+ const formRef = ref(null);
1554
+ const formModel = reactive({});
1555
+ const loadedRef = ref(false);
1556
+ const propsRef = ref({});
1557
+ const initFormModel = () => {
1558
+ var _a, _b;
1559
+ const schemas = unref(((_b = (_a = formRef.value) == null ? void 0 : _a.getSchema) == null ? void 0 : _b.call(_a)) || options.schemas || []);
1560
+ schemas.forEach((schema) => {
1561
+ if (schema.defaultValue !== void 0) {
1562
+ formModel[schema.field] = schema.defaultValue;
937
1563
  }
938
- return styles;
939
1564
  });
940
- const onClick = (ev) => {
941
- emit("click", ev);
942
- };
943
- return {
944
- cls,
945
- innerStyle,
946
- onClick
947
- };
948
- }
949
- });
950
- const _hoisted_1$5 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
951
- function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
952
- return openBlock(), createElementBlock("svg", {
953
- viewBox: "0 0 48 48",
954
- fill: "none",
955
- xmlns: "http://www.w3.org/2000/svg",
956
- stroke: "currentColor",
957
- class: normalizeClass(_ctx.cls),
958
- style: normalizeStyle(_ctx.innerStyle),
959
- "stroke-width": _ctx.strokeWidth,
960
- "stroke-linecap": _ctx.strokeLinecap,
961
- "stroke-linejoin": _ctx.strokeLinejoin,
962
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
963
- }, _cache[1] || (_cache[1] = [
964
- createElementVNode("path", { d: "M4 8h14.5M33 8H18.5m0 0v34" }, null, -1),
965
- createElementVNode("path", {
966
- d: "M39 9.5 37 13h4l-2-3.5ZM39 38.5 37 35h4l-2 3.5Z",
967
- fill: "currentColor",
968
- stroke: "none"
969
- }, null, -1),
970
- createElementVNode("path", { d: "M39 13h2l-2-3.5-2 3.5h2Zm0 0v22m0 0h2l-2 3.5-2-3.5h2Z" }, null, -1)
971
- ]), 14, _hoisted_1$5);
972
- }
973
- var _IconLineHeight = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["render", _sfc_render$2]]);
974
- const IconLineHeight = Object.assign(_IconLineHeight, {
975
- install: (app, options) => {
1565
+ };
1566
+ const register = async (formInstance) => {
1567
+ await nextTick();
1568
+ formRef.value = formInstance;
1569
+ loadedRef.value = true;
1570
+ if (options && Object.keys(options).length > 0) {
1571
+ await setProps(options);
1572
+ }
1573
+ initFormModel();
1574
+ };
1575
+ const getForm = () => {
1576
+ const form = unref(formRef);
1577
+ if (!form) {
1578
+ const error = "表单实例尚未注册,请确保组件已挂载并正确使用 @register";
1579
+ console.error(error);
1580
+ throw new Error(error);
1581
+ }
1582
+ return form;
1583
+ };
1584
+ const getFormSafe = () => {
1585
+ return unref(formRef);
1586
+ };
1587
+ const getFieldsValue = () => {
1588
+ const form = getFormSafe();
1589
+ if (!form) return {};
1590
+ if (form.getFieldsValue) {
1591
+ return form.getFieldsValue();
1592
+ }
1593
+ return { ...formModel };
1594
+ };
1595
+ const setFieldsValue = async (values) => {
1596
+ const form = getFormSafe();
1597
+ if (!form) return;
1598
+ if (form.setFieldsValue) {
1599
+ await form.setFieldsValue(values);
1600
+ } else {
1601
+ Object.keys(values).forEach((key) => {
1602
+ formModel[key] = values[key];
1603
+ });
1604
+ }
1605
+ };
1606
+ const resetFields = async () => {
976
1607
  var _a;
977
- const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
978
- app.component(iconPrefix + _IconLineHeight.name, _IconLineHeight);
979
- }
980
- });
981
- const _sfc_main$4 = defineComponent({
982
- name: "IconFullscreenExit",
983
- props: {
984
- size: {
985
- type: [Number, String]
986
- },
987
- strokeWidth: {
988
- type: Number,
989
- default: 4
990
- },
991
- strokeLinecap: {
992
- type: String,
993
- default: "butt",
994
- validator: (value) => {
995
- return ["butt", "round", "square"].includes(value);
996
- }
997
- },
998
- strokeLinejoin: {
999
- type: String,
1000
- default: "miter",
1001
- validator: (value) => {
1002
- return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
1003
- }
1004
- },
1005
- rotate: Number,
1006
- spin: Boolean
1007
- },
1008
- emits: {
1009
- click: (ev) => true
1010
- },
1011
- setup(props, { emit }) {
1012
- const prefixCls = getPrefixCls("icon");
1013
- const cls = computed(() => [prefixCls, `${prefixCls}-fullscreen-exit`, { [`${prefixCls}-spin`]: props.spin }]);
1014
- const innerStyle = computed(() => {
1015
- const styles = {};
1016
- if (props.size) {
1017
- styles.fontSize = isNumber(props.size) ? `${props.size}px` : props.size;
1018
- }
1019
- if (props.rotate) {
1020
- styles.transform = `rotate(${props.rotate}deg)`;
1608
+ const form = getFormSafe();
1609
+ if (!form) return;
1610
+ if (form.resetFields) {
1611
+ await form.resetFields();
1612
+ } else if ((_a = form.formRef) == null ? void 0 : _a.value) {
1613
+ await form.formRef.value.resetFields();
1614
+ }
1615
+ };
1616
+ const validate = async (nameList) => {
1617
+ var _a;
1618
+ const form = getFormSafe();
1619
+ if (!form) return Promise.reject("表单实例不存在");
1620
+ if (form.validate) {
1621
+ return await form.validate(nameList);
1622
+ } else if ((_a = form.formRef) == null ? void 0 : _a.value) {
1623
+ return await form.formRef.value.validate(nameList);
1624
+ }
1625
+ return Promise.resolve(void 0);
1626
+ };
1627
+ const validateFields = async (nameList) => {
1628
+ return await validate(nameList);
1629
+ };
1630
+ const clearValidate = async (field) => {
1631
+ var _a;
1632
+ const form = getFormSafe();
1633
+ if (!form) return;
1634
+ if (form.clearValidate) {
1635
+ await form.clearValidate(field);
1636
+ } else if ((_a = form.formRef) == null ? void 0 : _a.value) {
1637
+ await form.formRef.value.clearValidate(field);
1638
+ }
1639
+ };
1640
+ const submit = async () => {
1641
+ const form = getFormSafe();
1642
+ if (!form) return;
1643
+ if (form.handleSubmit) {
1644
+ return await form.handleSubmit();
1645
+ }
1646
+ await validate();
1647
+ return getFieldsValue();
1648
+ };
1649
+ const updateSchema = async (schema) => {
1650
+ const form = getFormSafe();
1651
+ if (!form) return;
1652
+ const schemaList = Array.isArray(schema) ? schema : [schema];
1653
+ if (form.updateSchema) {
1654
+ await form.updateSchema(schemaList);
1655
+ }
1656
+ };
1657
+ const resetSchema = async (schemas) => {
1658
+ const form = getFormSafe();
1659
+ if (!form) return;
1660
+ if (form.resetSchema) {
1661
+ await form.resetSchema(schemas);
1662
+ }
1663
+ };
1664
+ const removeSchemaByField = async (field) => {
1665
+ const form = getFormSafe();
1666
+ if (!form) return;
1667
+ const fields = Array.isArray(field) ? field : [field];
1668
+ if (form.removeSchema) {
1669
+ await form.removeSchema(fields);
1670
+ }
1671
+ fields.forEach((f) => {
1672
+ if (f in formModel) {
1673
+ delete formModel[f];
1021
1674
  }
1022
- return styles;
1023
1675
  });
1024
- const onClick = (ev) => {
1025
- emit("click", ev);
1026
- };
1027
- return {
1028
- cls,
1029
- innerStyle,
1030
- onClick
1031
- };
1032
- }
1033
- });
1034
- const _hoisted_1$4 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
1035
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
1036
- return openBlock(), createElementBlock("svg", {
1037
- viewBox: "0 0 48 48",
1038
- fill: "none",
1039
- xmlns: "http://www.w3.org/2000/svg",
1040
- stroke: "currentColor",
1041
- class: normalizeClass(_ctx.cls),
1042
- style: normalizeStyle(_ctx.innerStyle),
1043
- "stroke-width": _ctx.strokeWidth,
1044
- "stroke-linecap": _ctx.strokeLinecap,
1045
- "stroke-linejoin": _ctx.strokeLinejoin,
1046
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
1047
- }, _cache[1] || (_cache[1] = [
1048
- createElementVNode("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)
1049
- ]), 14, _hoisted_1$4);
1050
- }
1051
- var _IconFullscreenExit = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["render", _sfc_render$1]]);
1052
- const IconFullscreenExit = Object.assign(_IconFullscreenExit, {
1053
- install: (app, options) => {
1676
+ };
1677
+ const appendSchemaByField = async (schema, prefixField, first = false) => {
1054
1678
  var _a;
1055
- const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
1056
- app.component(iconPrefix + _IconFullscreenExit.name, _IconFullscreenExit);
1057
- }
1058
- });
1059
- const _sfc_main$3 = defineComponent({
1060
- name: "IconFullscreen",
1061
- props: {
1062
- size: {
1063
- type: [Number, String]
1064
- },
1065
- strokeWidth: {
1066
- type: Number,
1067
- default: 4
1068
- },
1069
- strokeLinecap: {
1070
- type: String,
1071
- default: "butt",
1072
- validator: (value) => {
1073
- return ["butt", "round", "square"].includes(value);
1074
- }
1075
- },
1076
- strokeLinejoin: {
1077
- type: String,
1078
- default: "miter",
1079
- validator: (value) => {
1080
- return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
1679
+ const form = getFormSafe();
1680
+ if (!form) return;
1681
+ const currentSchemas = ((_a = form.getSchema) == null ? void 0 : _a.call(form)) || [];
1682
+ const schemas = Array.isArray(currentSchemas) ? [...currentSchemas] : [];
1683
+ const schemaList = Array.isArray(schema) ? schema : [schema];
1684
+ if (prefixField) {
1685
+ const index = schemas.findIndex((s) => s.field === prefixField);
1686
+ if (index === -1) {
1687
+ console.warn(`字段 "${prefixField}" 不存在,无法插入 schema`);
1688
+ return;
1081
1689
  }
1082
- },
1083
- rotate: Number,
1084
- spin: Boolean
1085
- },
1086
- emits: {
1087
- click: (ev) => true
1088
- },
1089
- setup(props, { emit }) {
1090
- const prefixCls = getPrefixCls("icon");
1091
- const cls = computed(() => [prefixCls, `${prefixCls}-fullscreen`, { [`${prefixCls}-spin`]: props.spin }]);
1092
- const innerStyle = computed(() => {
1093
- const styles = {};
1094
- if (props.size) {
1095
- styles.fontSize = isNumber(props.size) ? `${props.size}px` : props.size;
1690
+ const insertIndex = first ? index : index + 1;
1691
+ schemas.splice(insertIndex, 0, ...schemaList);
1692
+ } else {
1693
+ if (first) {
1694
+ schemas.unshift(...schemaList);
1695
+ } else {
1696
+ schemas.push(...schemaList);
1096
1697
  }
1097
- if (props.rotate) {
1098
- styles.transform = `rotate(${props.rotate}deg)`;
1698
+ }
1699
+ if (form.resetSchema) {
1700
+ await form.resetSchema(schemas);
1701
+ }
1702
+ schemaList.forEach((s) => {
1703
+ if (s.defaultValue !== void 0) {
1704
+ formModel[s.field] = s.defaultValue;
1099
1705
  }
1100
- return styles;
1101
1706
  });
1102
- const onClick = (ev) => {
1103
- emit("click", ev);
1104
- };
1105
- return {
1106
- cls,
1107
- innerStyle,
1108
- onClick
1109
- };
1110
- }
1111
- });
1112
- const _hoisted_1$3 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
1113
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
1114
- return openBlock(), createElementBlock("svg", {
1115
- viewBox: "0 0 48 48",
1116
- fill: "none",
1117
- xmlns: "http://www.w3.org/2000/svg",
1118
- stroke: "currentColor",
1119
- class: normalizeClass(_ctx.cls),
1120
- style: normalizeStyle(_ctx.innerStyle),
1121
- "stroke-width": _ctx.strokeWidth,
1122
- "stroke-linecap": _ctx.strokeLinecap,
1123
- "stroke-linejoin": _ctx.strokeLinejoin,
1124
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
1125
- }, _cache[1] || (_cache[1] = [
1126
- createElementVNode("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)
1127
- ]), 14, _hoisted_1$3);
1707
+ };
1708
+ const getSchema = (field) => {
1709
+ const form = getFormSafe();
1710
+ if (!form) return void 0;
1711
+ if (form.getSchema) {
1712
+ return form.getSchema(field);
1713
+ }
1714
+ return void 0;
1715
+ };
1716
+ const setProps = async (formProps) => {
1717
+ propsRef.value = { ...propsRef.value, ...formProps };
1718
+ const form = getFormSafe();
1719
+ if (!form) {
1720
+ return;
1721
+ }
1722
+ if (form.setProps) {
1723
+ await form.setProps(formProps);
1724
+ }
1725
+ };
1726
+ const scrollToField = async (name, options2) => {
1727
+ const form = getFormSafe();
1728
+ if (!form) return;
1729
+ if (form.scrollToField) {
1730
+ await form.scrollToField(name, options2);
1731
+ }
1732
+ };
1733
+ const formMethods = {
1734
+ getFieldsValue,
1735
+ setFieldsValue,
1736
+ resetFields,
1737
+ validate,
1738
+ validateFields,
1739
+ clearValidate,
1740
+ submit,
1741
+ updateSchema,
1742
+ resetSchema,
1743
+ removeSchemaByField,
1744
+ appendSchemaByField,
1745
+ getSchema,
1746
+ setProps,
1747
+ scrollToField,
1748
+ formModel,
1749
+ formRef,
1750
+ getForm
1751
+ };
1752
+ return [register, formMethods];
1753
+ }
1754
+ function createFormSchema(schemas) {
1755
+ return schemas.map((schema, index) => ({
1756
+ key: schema.key || `${schema.field}_${index}`,
1757
+ ...schema
1758
+ }));
1759
+ }
1760
+ function mergeFormSchemas(...schemas) {
1761
+ return schemas.flat();
1128
1762
  }
1129
- var _IconFullscreen = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["render", _sfc_render]]);
1130
- const IconFullscreen = Object.assign(_IconFullscreen, {
1131
- install: (app, options) => {
1132
- var _a;
1133
- const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
1134
- app.component(iconPrefix + _IconFullscreen.name, _IconFullscreen);
1135
- }
1136
- });
1137
1763
  function debounce(func, wait = 300, immediate = false) {
1138
1764
  let timeout = null;
1139
1765
  const debounced = function(...args) {
@@ -2083,7 +2709,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2083
2709
  const _component_a_table = resolveComponent("a-table");
2084
2710
  return openBlock(), createElementBlock("div", _hoisted_1$2, [
2085
2711
  getSearchConfig.value.show ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
2086
- createVNode(unref(_sfc_main$9), mergeProps({
2712
+ createVNode(unref(_sfc_main$3), mergeProps({
2087
2713
  ref_key: "searchFormRef",
2088
2714
  ref: searchFormRef
2089
2715
  }, getSearchFormProps.value, {
@@ -2369,13 +2995,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
2369
2995
  };
2370
2996
  }
2371
2997
  });
2372
- const _export_sfc = (sfc, props) => {
2373
- const target = sfc.__vccOpts || sfc;
2374
- for (const [key, val] of props) {
2375
- target[key] = val;
2376
- }
2377
- return target;
2378
- };
2379
2998
  const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-f0b71ff8"]]);
2380
2999
  function useTable(options = {}) {
2381
3000
  const tableRef = ref(null);
@@ -3406,6 +4025,102 @@ function useDescription(props) {
3406
4025
  }
3407
4026
  ];
3408
4027
  }
4028
+ function useUpload(props) {
4029
+ const uploadRef = ref(null);
4030
+ const fileListRef = ref((props == null ? void 0 : props.defaultFileList) || []);
4031
+ const register = (uploadInstance) => {
4032
+ uploadRef.value = uploadInstance;
4033
+ if ((props == null ? void 0 : props.defaultFileList) && props.defaultFileList.length > 0) {
4034
+ uploadInstance.setFileList(props.defaultFileList);
4035
+ }
4036
+ if (props && Object.keys(props).length > 0) {
4037
+ const { defaultFileList, ...restProps } = props;
4038
+ if (Object.keys(restProps).length > 0) {
4039
+ setProps(restProps);
4040
+ }
4041
+ }
4042
+ };
4043
+ const getUpload = () => {
4044
+ const upload2 = unref(uploadRef);
4045
+ if (!upload2) {
4046
+ throw new Error('Upload 实例未注册,请确保在组件上使用 @register="register"');
4047
+ }
4048
+ return upload2;
4049
+ };
4050
+ const submit = () => {
4051
+ getUpload().submit();
4052
+ };
4053
+ const abort = (fileItem) => {
4054
+ getUpload().abort(fileItem);
4055
+ };
4056
+ const clearFiles = () => {
4057
+ getUpload().clearFiles();
4058
+ fileListRef.value = [];
4059
+ };
4060
+ const getFileList = () => {
4061
+ return getUpload().getFileList();
4062
+ };
4063
+ const upload = (fileItem) => {
4064
+ getUpload().upload(fileItem);
4065
+ };
4066
+ const setFileList = (files) => {
4067
+ fileListRef.value = files;
4068
+ const upload2 = getUpload();
4069
+ if (upload2.setFileList) {
4070
+ upload2.setFileList(files);
4071
+ }
4072
+ };
4073
+ const addFile = (file) => {
4074
+ fileListRef.value.push(file);
4075
+ const upload2 = getUpload();
4076
+ if (upload2.addFile) {
4077
+ upload2.addFile(file);
4078
+ }
4079
+ };
4080
+ const removeFile = (fileItem) => {
4081
+ const index = fileListRef.value.findIndex(
4082
+ (item) => item.uid === fileItem.uid
4083
+ );
4084
+ if (index !== -1) {
4085
+ fileListRef.value.splice(index, 1);
4086
+ }
4087
+ const upload2 = getUpload();
4088
+ if (upload2.removeFile) {
4089
+ upload2.removeFile(fileItem);
4090
+ }
4091
+ };
4092
+ const updateFile = (fileItem) => {
4093
+ const index = fileListRef.value.findIndex(
4094
+ (item) => item.uid === fileItem.uid
4095
+ );
4096
+ if (index !== -1) {
4097
+ fileListRef.value[index] = { ...fileListRef.value[index], ...fileItem };
4098
+ }
4099
+ const upload2 = getUpload();
4100
+ if (upload2.updateFile) {
4101
+ upload2.updateFile(fileItem);
4102
+ }
4103
+ };
4104
+ const setProps = (uploadProps) => {
4105
+ getUpload().setProps(uploadProps);
4106
+ };
4107
+ const methods = {
4108
+ get fileList() {
4109
+ return fileListRef.value;
4110
+ },
4111
+ submit,
4112
+ abort,
4113
+ upload,
4114
+ clearFiles,
4115
+ getFileList,
4116
+ setFileList,
4117
+ addFile,
4118
+ removeFile,
4119
+ updateFile,
4120
+ setProps
4121
+ };
4122
+ return [register, methods];
4123
+ }
3409
4124
  function formatDate(date, format = "YYYY-MM-DD HH:mm:ss") {
3410
4125
  const d = typeof date === "number" ? new Date(date) : date;
3411
4126
  const year = d.getFullYear();
@@ -3486,9 +4201,10 @@ function useToggle(initialValue = false) {
3486
4201
  }
3487
4202
  export {
3488
4203
  BasicDescription,
3489
- _sfc_main$9 as BasicForm,
4204
+ _sfc_main$3 as BasicForm,
3490
4205
  BasicModal,
3491
4206
  BasicTable,
4207
+ BasicUpload,
3492
4208
  componentMap,
3493
4209
  createFormSchema,
3494
4210
  createTableColumns,
@@ -3512,6 +4228,7 @@ export {
3512
4228
  useModal,
3513
4229
  useModalInner,
3514
4230
  useTable,
3515
- useToggle
4231
+ useToggle,
4232
+ useUpload
3516
4233
  };
3517
4234
  //# sourceMappingURL=index.esm.js.map