knt-shared 1.1.7 → 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/components/Form/componentMap.d.ts +572 -1
- package/dist/components/Form/componentMap.d.ts.map +1 -1
- package/dist/components/Modal/BasicModal.vue.d.ts +1 -1
- package/dist/components/Upload/BasicUpload.vue.d.ts +140 -0
- package/dist/components/Upload/BasicUpload.vue.d.ts.map +1 -0
- package/dist/components/Upload/index.d.ts +7 -0
- package/dist/components/Upload/index.d.ts.map +1 -0
- package/dist/components/Upload/types.d.ts +201 -0
- package/dist/components/Upload/types.d.ts.map +1 -0
- package/dist/components/Upload/useUpload.d.ts +27 -0
- package/dist/components/Upload/useUpload.d.ts.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.cjs.js +1786 -1081
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1789 -1084
- package/dist/index.esm.js.map +1 -1
- package/dist/style.css +33 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,1151 +1,1765 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Transfer, Mention, Upload, Rate, Slider, Switch, RangePicker, TimePicker, DatePicker, TreeSelect, Cascader, CheckboxGroup, Checkbox, RadioGroup, Radio, Select, AutoComplete, Textarea, InputPassword, InputNumber, Input
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
14
|
+
};
|
|
15
|
+
const opt = Object.prototype.toString;
|
|
16
|
+
function isNumber(obj) {
|
|
17
|
+
return opt.call(obj) === "[object Number]" && obj === obj;
|
|
38
18
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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$
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
strokeLinejoin: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: "miter",
|
|
45
|
+
validator: (value) => {
|
|
46
|
+
return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
rotate: Number,
|
|
50
|
+
spin: Boolean
|
|
88
51
|
},
|
|
89
|
-
emits:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
};
|
|
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;
|
|
62
|
+
}
|
|
63
|
+
if (props.rotate) {
|
|
64
|
+
styles.transform = `rotate(${props.rotate}deg)`;
|
|
65
|
+
}
|
|
66
|
+
return styles;
|
|
130
67
|
});
|
|
131
|
-
const
|
|
132
|
-
|
|
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
|
-
});
|
|
68
|
+
const onClick = (ev) => {
|
|
69
|
+
emit("click", ev);
|
|
145
70
|
};
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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 };
|
|
71
|
+
return {
|
|
72
|
+
cls,
|
|
73
|
+
innerStyle,
|
|
74
|
+
onClick
|
|
157
75
|
};
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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);
|
|
163
118
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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;
|
|
119
|
+
},
|
|
120
|
+
strokeLinejoin: {
|
|
121
|
+
type: String,
|
|
122
|
+
default: "miter",
|
|
123
|
+
validator: (value) => {
|
|
124
|
+
return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
|
|
183
125
|
}
|
|
184
|
-
|
|
185
|
-
|
|
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;
|
|
186
140
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
};
|
|
190
|
-
const handleSubmit = async (data) => {
|
|
191
|
-
try {
|
|
192
|
-
submitLoading.value = true;
|
|
193
|
-
if (!data) {
|
|
194
|
-
try {
|
|
195
|
-
await validate();
|
|
196
|
-
const values = getFieldsValue();
|
|
197
|
-
emit("submit", values);
|
|
198
|
-
return values;
|
|
199
|
-
} catch (error) {
|
|
200
|
-
console.warn("表单验证失败:", error);
|
|
201
|
-
throw error;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
if (data.errors) {
|
|
205
|
-
console.warn("表单验证失败:", data.errors);
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
emit("submit", data.values);
|
|
209
|
-
return data.values;
|
|
210
|
-
} finally {
|
|
211
|
-
submitLoading.value = false;
|
|
141
|
+
if (props.rotate) {
|
|
142
|
+
styles.transform = `rotate(${props.rotate}deg)`;
|
|
212
143
|
}
|
|
144
|
+
return styles;
|
|
145
|
+
});
|
|
146
|
+
const onClick = (ev) => {
|
|
147
|
+
emit("click", ev);
|
|
213
148
|
};
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
};
|
|
219
|
-
const getFieldsValue = () => {
|
|
220
|
-
return { ...formModel };
|
|
221
|
-
};
|
|
222
|
-
const setFieldsValue = (values) => {
|
|
223
|
-
Object.keys(values).forEach((key) => {
|
|
224
|
-
const schemas = internalSchemas.value.length > 0 ? internalSchemas.value : props.schemas || [];
|
|
225
|
-
const hasField = schemas.some((s) => s.field === key);
|
|
226
|
-
if (hasField) {
|
|
227
|
-
formModel[key] = values[key];
|
|
228
|
-
} else {
|
|
229
|
-
console.warn(`字段 "${key}" 不在表单 schema 中`);
|
|
230
|
-
}
|
|
231
|
-
});
|
|
149
|
+
return {
|
|
150
|
+
cls,
|
|
151
|
+
innerStyle,
|
|
152
|
+
onClick
|
|
232
153
|
};
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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);
|
|
236
227
|
};
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
228
|
+
return {
|
|
229
|
+
cls,
|
|
230
|
+
innerStyle,
|
|
231
|
+
onClick
|
|
240
232
|
};
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
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);
|
|
244
305
|
};
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
(s) => s.field === item.field
|
|
250
|
-
);
|
|
251
|
-
if (index !== -1) {
|
|
252
|
-
const oldSchema = internalSchemas.value[index];
|
|
253
|
-
internalSchemas.value[index] = { ...oldSchema, ...item };
|
|
254
|
-
if (item.defaultValue !== void 0 && formModel[item.field] === oldSchema.defaultValue) {
|
|
255
|
-
formModel[item.field] = item.defaultValue;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
});
|
|
306
|
+
return {
|
|
307
|
+
cls,
|
|
308
|
+
innerStyle,
|
|
309
|
+
onClick
|
|
259
310
|
};
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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);
|
|
269
384
|
};
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
385
|
+
return {
|
|
386
|
+
cls,
|
|
387
|
+
innerStyle,
|
|
388
|
+
onClick
|
|
274
389
|
};
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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;
|
|
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);
|
|
278
462
|
};
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
463
|
+
return {
|
|
464
|
+
cls,
|
|
465
|
+
innerStyle,
|
|
466
|
+
onClick
|
|
467
|
+
};
|
|
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)`;
|
|
284
541
|
}
|
|
542
|
+
return styles;
|
|
543
|
+
});
|
|
544
|
+
const onClick = (ev) => {
|
|
545
|
+
emit("click", ev);
|
|
285
546
|
};
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
element.scrollIntoView(options);
|
|
291
|
-
}
|
|
292
|
-
});
|
|
547
|
+
return {
|
|
548
|
+
cls,
|
|
549
|
+
innerStyle,
|
|
550
|
+
onClick
|
|
293
551
|
};
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
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;
|
|
313
621
|
});
|
|
314
|
-
const
|
|
315
|
-
()
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
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);
|
|
320
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);
|
|
321
1021
|
},
|
|
322
1022
|
{ immediate: true }
|
|
323
1023
|
);
|
|
324
1024
|
onMounted(() => {
|
|
325
1025
|
nextTick(() => {
|
|
326
1026
|
emit("register", {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
validate,
|
|
333
|
-
clearValidate,
|
|
334
|
-
updateSchema,
|
|
335
|
-
removeSchema,
|
|
336
|
-
getSchema,
|
|
337
|
-
resetSchema,
|
|
1027
|
+
submit,
|
|
1028
|
+
abort,
|
|
1029
|
+
clearFiles,
|
|
1030
|
+
getFileList,
|
|
1031
|
+
upload,
|
|
338
1032
|
setProps,
|
|
339
|
-
|
|
340
|
-
|
|
1033
|
+
setFileList,
|
|
1034
|
+
addFile,
|
|
1035
|
+
removeFile,
|
|
1036
|
+
updateFile
|
|
341
1037
|
});
|
|
342
1038
|
});
|
|
343
1039
|
});
|
|
344
|
-
onBeforeUnmount(() => {
|
|
345
|
-
stopSchemasWatch();
|
|
346
|
-
Object.keys(formModel).forEach((key) => {
|
|
347
|
-
delete formModel[key];
|
|
348
|
-
});
|
|
349
|
-
internalSchemas.value = [];
|
|
350
|
-
dynamicProps.value = {};
|
|
351
|
-
});
|
|
352
1040
|
return (_ctx, _cache) => {
|
|
353
|
-
const _component_a_form_item = resolveComponent("a-form-item");
|
|
354
|
-
const _component_a_col = resolveComponent("a-col");
|
|
355
1041
|
const _component_a_button = resolveComponent("a-button");
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
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
|
+
]),
|
|
376
1069
|
default: withCtx(() => [
|
|
377
|
-
|
|
378
|
-
key: 1,
|
|
379
|
-
ref_for: true
|
|
380
|
-
}, getFormItemBindValue(schema)), {
|
|
381
|
-
default: withCtx(() => [
|
|
382
|
-
schema.renderComponentContent ? (openBlock(), createBlock(resolveDynamicComponent(schema.renderComponentContent(schema, formModel)), { key: 0 })) : (openBlock(), createBlock(resolveDynamicComponent(unref(getComponent)(schema.component)), mergeProps({
|
|
383
|
-
key: 1,
|
|
384
|
-
modelValue: formModel[schema.field],
|
|
385
|
-
"onUpdate:modelValue": ($event) => formModel[schema.field] = $event,
|
|
386
|
-
placeholder: getPlaceholderText(schema)
|
|
387
|
-
}, { ref_for: true }, schema.componentProps), null, 16, ["modelValue", "onUpdate:modelValue", "placeholder"]))
|
|
388
|
-
]),
|
|
389
|
-
_: 2
|
|
390
|
-
}, 1040))
|
|
1070
|
+
createTextVNode(" " + toDisplayString(getProps.value.uploadButtonText || "上传文件"), 1)
|
|
391
1071
|
]),
|
|
392
|
-
_:
|
|
393
|
-
},
|
|
394
|
-
|
|
395
|
-
getActionProps.value.showActionButtons ? (openBlock(), createBlock(_component_a_col, normalizeProps(mergeProps({ key: 0 }, getActionProps.value.actionColOptions)), {
|
|
396
|
-
default: withCtx(() => [
|
|
397
|
-
createVNode(_component_a_form_item, normalizeProps(guardReactiveProps(getActionProps.value.actionFormItemProps)), {
|
|
398
|
-
default: withCtx(() => [
|
|
399
|
-
createVNode(_component_a_space, null, {
|
|
400
|
-
default: withCtx(() => [
|
|
401
|
-
getActionProps.value.showSubmitButton ? (openBlock(), createBlock(_component_a_button, {
|
|
402
|
-
key: 0,
|
|
403
|
-
type: "primary",
|
|
404
|
-
"html-type": "submit",
|
|
405
|
-
loading: submitLoading.value
|
|
406
|
-
}, {
|
|
407
|
-
default: withCtx(() => [
|
|
408
|
-
createTextVNode(toDisplayString(getActionProps.value.submitButtonText), 1)
|
|
409
|
-
]),
|
|
410
|
-
_: 1
|
|
411
|
-
}, 8, ["loading"])) : createCommentVNode("", true),
|
|
412
|
-
getActionProps.value.showResetButton ? (openBlock(), createBlock(_component_a_button, {
|
|
413
|
-
key: 1,
|
|
414
|
-
onClick: handleReset
|
|
415
|
-
}, {
|
|
416
|
-
default: withCtx(() => [
|
|
417
|
-
createTextVNode(toDisplayString(getActionProps.value.resetButtonText), 1)
|
|
418
|
-
]),
|
|
419
|
-
_: 1
|
|
420
|
-
})) : createCommentVNode("", true),
|
|
421
|
-
renderSlot(_ctx.$slots, "actions")
|
|
422
|
-
]),
|
|
423
|
-
_: 3
|
|
424
|
-
})
|
|
425
|
-
]),
|
|
426
|
-
_: 3
|
|
427
|
-
}, 16)
|
|
428
|
-
]),
|
|
429
|
-
_: 3
|
|
430
|
-
}, 16)) : createCommentVNode("", true)
|
|
1072
|
+
_: 1
|
|
1073
|
+
}, 8, ["type"]))
|
|
1074
|
+
], true)
|
|
431
1075
|
]),
|
|
432
|
-
|
|
433
|
-
},
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
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
|
+
]);
|
|
437
1103
|
};
|
|
438
1104
|
}
|
|
439
1105
|
});
|
|
440
|
-
|
|
441
|
-
const
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
if (
|
|
479
|
-
return
|
|
480
|
-
}
|
|
481
|
-
return { ...formModel };
|
|
482
|
-
};
|
|
483
|
-
const setFieldsValue = async (values) => {
|
|
484
|
-
const form = getFormSafe();
|
|
485
|
-
if (!form) return;
|
|
486
|
-
if (form.setFieldsValue) {
|
|
487
|
-
await form.setFieldsValue(values);
|
|
488
|
-
} else {
|
|
489
|
-
Object.keys(values).forEach((key) => {
|
|
490
|
-
formModel[key] = values[key];
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
};
|
|
494
|
-
const resetFields = async () => {
|
|
495
|
-
var _a;
|
|
496
|
-
const form = getFormSafe();
|
|
497
|
-
if (!form) return;
|
|
498
|
-
if (form.resetFields) {
|
|
499
|
-
await form.resetFields();
|
|
500
|
-
} else if ((_a = form.formRef) == null ? void 0 : _a.value) {
|
|
501
|
-
await form.formRef.value.resetFields();
|
|
502
|
-
}
|
|
503
|
-
};
|
|
504
|
-
const validate = async (nameList) => {
|
|
505
|
-
var _a;
|
|
506
|
-
const form = getFormSafe();
|
|
507
|
-
if (!form) return Promise.reject("表单实例不存在");
|
|
508
|
-
if (form.validate) {
|
|
509
|
-
return await form.validate(nameList);
|
|
510
|
-
} else if ((_a = form.formRef) == null ? void 0 : _a.value) {
|
|
511
|
-
return await form.formRef.value.validate(nameList);
|
|
512
|
-
}
|
|
513
|
-
return Promise.resolve(void 0);
|
|
514
|
-
};
|
|
515
|
-
const validateFields = async (nameList) => {
|
|
516
|
-
return await validate(nameList);
|
|
517
|
-
};
|
|
518
|
-
const clearValidate = async (field) => {
|
|
519
|
-
var _a;
|
|
520
|
-
const form = getFormSafe();
|
|
521
|
-
if (!form) return;
|
|
522
|
-
if (form.clearValidate) {
|
|
523
|
-
await form.clearValidate(field);
|
|
524
|
-
} else if ((_a = form.formRef) == null ? void 0 : _a.value) {
|
|
525
|
-
await form.formRef.value.clearValidate(field);
|
|
526
|
-
}
|
|
527
|
-
};
|
|
528
|
-
const submit = async () => {
|
|
529
|
-
const form = getFormSafe();
|
|
530
|
-
if (!form) return;
|
|
531
|
-
if (form.handleSubmit) {
|
|
532
|
-
return await form.handleSubmit();
|
|
533
|
-
}
|
|
534
|
-
await validate();
|
|
535
|
-
return getFieldsValue();
|
|
536
|
-
};
|
|
537
|
-
const updateSchema = async (schema) => {
|
|
538
|
-
const form = getFormSafe();
|
|
539
|
-
if (!form) return;
|
|
540
|
-
const schemaList = Array.isArray(schema) ? schema : [schema];
|
|
541
|
-
if (form.updateSchema) {
|
|
542
|
-
await form.updateSchema(schemaList);
|
|
543
|
-
}
|
|
544
|
-
};
|
|
545
|
-
const resetSchema = async (schemas) => {
|
|
546
|
-
const form = getFormSafe();
|
|
547
|
-
if (!form) return;
|
|
548
|
-
if (form.resetSchema) {
|
|
549
|
-
await form.resetSchema(schemas);
|
|
550
|
-
}
|
|
551
|
-
};
|
|
552
|
-
const removeSchemaByField = async (field) => {
|
|
553
|
-
const form = getFormSafe();
|
|
554
|
-
if (!form) return;
|
|
555
|
-
const fields = Array.isArray(field) ? field : [field];
|
|
556
|
-
if (form.removeSchema) {
|
|
557
|
-
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];
|
|
558
1146
|
}
|
|
559
|
-
|
|
560
|
-
if (f in formModel) {
|
|
561
|
-
delete formModel[f];
|
|
562
|
-
}
|
|
563
|
-
});
|
|
564
|
-
};
|
|
565
|
-
const appendSchemaByField = async (schema, prefixField, first = false) => {
|
|
566
|
-
var _a;
|
|
567
|
-
const form = getFormSafe();
|
|
568
|
-
if (!form) return;
|
|
569
|
-
const currentSchemas = ((_a = form.getSchema) == null ? void 0 : _a.call(form)) || [];
|
|
570
|
-
const schemas = Array.isArray(currentSchemas) ? [...currentSchemas] : [];
|
|
571
|
-
const schemaList = Array.isArray(schema) ? schema : [schema];
|
|
572
|
-
if (prefixField) {
|
|
573
|
-
const index = schemas.findIndex((s) => s.field === prefixField);
|
|
574
|
-
if (index === -1) {
|
|
575
|
-
console.warn(`字段 "${prefixField}" 不存在,无法插入 schema`);
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
578
|
-
const insertIndex = first ? index : index + 1;
|
|
579
|
-
schemas.splice(insertIndex, 0, ...schemaList);
|
|
580
|
-
} else {
|
|
581
|
-
if (first) {
|
|
582
|
-
schemas.unshift(...schemaList);
|
|
583
|
-
} else {
|
|
584
|
-
schemas.push(...schemaList);
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
if (form.resetSchema) {
|
|
588
|
-
await form.resetSchema(schemas);
|
|
589
|
-
}
|
|
590
|
-
schemaList.forEach((s) => {
|
|
591
|
-
if (s.defaultValue !== void 0) {
|
|
592
|
-
formModel[s.field] = s.defaultValue;
|
|
593
|
-
}
|
|
594
|
-
});
|
|
595
|
-
};
|
|
596
|
-
const getSchema = (field) => {
|
|
597
|
-
const form = getFormSafe();
|
|
598
|
-
if (!form) return void 0;
|
|
599
|
-
if (form.getSchema) {
|
|
600
|
-
return form.getSchema(field);
|
|
601
|
-
}
|
|
602
|
-
return void 0;
|
|
603
|
-
};
|
|
604
|
-
const setProps = async (formProps) => {
|
|
605
|
-
propsRef.value = { ...propsRef.value, ...formProps };
|
|
606
|
-
const form = getFormSafe();
|
|
607
|
-
if (!form) {
|
|
608
|
-
return;
|
|
609
|
-
}
|
|
610
|
-
if (form.setProps) {
|
|
611
|
-
await form.setProps(formProps);
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
|
-
const scrollToField = async (name, options2) => {
|
|
615
|
-
const form = getFormSafe();
|
|
616
|
-
if (!form) return;
|
|
617
|
-
if (form.scrollToField) {
|
|
618
|
-
await form.scrollToField(name, options2);
|
|
619
|
-
}
|
|
620
|
-
};
|
|
621
|
-
const formMethods = {
|
|
622
|
-
getFieldsValue,
|
|
623
|
-
setFieldsValue,
|
|
624
|
-
resetFields,
|
|
625
|
-
validate,
|
|
626
|
-
validateFields,
|
|
627
|
-
clearValidate,
|
|
628
|
-
submit,
|
|
629
|
-
updateSchema,
|
|
630
|
-
resetSchema,
|
|
631
|
-
removeSchemaByField,
|
|
632
|
-
appendSchemaByField,
|
|
633
|
-
getSchema,
|
|
634
|
-
setProps,
|
|
635
|
-
scrollToField,
|
|
636
|
-
formModel,
|
|
637
|
-
formRef,
|
|
638
|
-
getForm
|
|
639
|
-
};
|
|
640
|
-
return [register, formMethods];
|
|
641
|
-
}
|
|
642
|
-
function createFormSchema(schemas) {
|
|
643
|
-
return schemas.map((schema, index) => ({
|
|
644
|
-
key: schema.key || `${schema.field}_${index}`,
|
|
645
|
-
...schema
|
|
646
|
-
}));
|
|
647
|
-
}
|
|
648
|
-
function mergeFormSchemas(...schemas) {
|
|
649
|
-
return schemas.flat();
|
|
650
|
-
}
|
|
651
|
-
const configProviderInjectionKey = Symbol("ArcoConfigProvider");
|
|
652
|
-
const CLASS_PREFIX = "arco";
|
|
653
|
-
const GLOBAL_CONFIG_NAME = "$arco";
|
|
654
|
-
const getPrefixCls = (componentName) => {
|
|
655
|
-
var _a, _b, _c;
|
|
656
|
-
const instance = getCurrentInstance();
|
|
657
|
-
const configProvider = inject(configProviderInjectionKey, void 0);
|
|
658
|
-
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;
|
|
659
|
-
{
|
|
660
|
-
return `${prefix}-${componentName}`;
|
|
1147
|
+
return customComponentMap.get(name);
|
|
661
1148
|
}
|
|
662
|
-
|
|
663
|
-
const opt = Object.prototype.toString;
|
|
664
|
-
function isNumber(obj) {
|
|
665
|
-
return opt.call(obj) === "[object Number]" && obj === obj;
|
|
1149
|
+
return name;
|
|
666
1150
|
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
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}`;
|
|
670
1168
|
}
|
|
671
|
-
|
|
672
|
-
}
|
|
673
|
-
const _sfc_main$8 = defineComponent({
|
|
674
|
-
name: "IconQuestionCircle",
|
|
675
|
-
props: {
|
|
676
|
-
size: {
|
|
677
|
-
type: [Number, String]
|
|
678
|
-
},
|
|
679
|
-
strokeWidth: {
|
|
680
|
-
type: Number,
|
|
681
|
-
default: 4
|
|
682
|
-
},
|
|
683
|
-
strokeLinecap: {
|
|
684
|
-
type: String,
|
|
685
|
-
default: "butt",
|
|
686
|
-
validator: (value) => {
|
|
687
|
-
return ["butt", "round", "square"].includes(value);
|
|
688
|
-
}
|
|
689
|
-
},
|
|
690
|
-
strokeLinejoin: {
|
|
691
|
-
type: String,
|
|
692
|
-
default: "miter",
|
|
693
|
-
validator: (value) => {
|
|
694
|
-
return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
|
|
695
|
-
}
|
|
696
|
-
},
|
|
697
|
-
rotate: Number,
|
|
698
|
-
spin: Boolean
|
|
699
|
-
},
|
|
700
|
-
emits: {
|
|
701
|
-
click: (ev) => true
|
|
702
|
-
},
|
|
703
|
-
setup(props, { emit }) {
|
|
704
|
-
const prefixCls = getPrefixCls("icon");
|
|
705
|
-
const cls = computed(() => [prefixCls, `${prefixCls}-question-circle`, { [`${prefixCls}-spin`]: props.spin }]);
|
|
706
|
-
const innerStyle = computed(() => {
|
|
707
|
-
const styles = {};
|
|
708
|
-
if (props.size) {
|
|
709
|
-
styles.fontSize = isNumber(props.size) ? `${props.size}px` : props.size;
|
|
710
|
-
}
|
|
711
|
-
if (props.rotate) {
|
|
712
|
-
styles.transform = `rotate(${props.rotate}deg)`;
|
|
713
|
-
}
|
|
714
|
-
return styles;
|
|
715
|
-
});
|
|
716
|
-
const onClick = (ev) => {
|
|
717
|
-
emit("click", ev);
|
|
718
|
-
};
|
|
719
|
-
return {
|
|
720
|
-
cls,
|
|
721
|
-
innerStyle,
|
|
722
|
-
onClick
|
|
723
|
-
};
|
|
1169
|
+
if (componentsNeedSelectPlaceholder.has(component)) {
|
|
1170
|
+
return `请选择${label}`;
|
|
724
1171
|
}
|
|
725
|
-
|
|
726
|
-
const _hoisted_1$8 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
|
|
727
|
-
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
728
|
-
return openBlock(), createElementBlock("svg", {
|
|
729
|
-
viewBox: "0 0 48 48",
|
|
730
|
-
fill: "none",
|
|
731
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
732
|
-
stroke: "currentColor",
|
|
733
|
-
class: normalizeClass(_ctx.cls),
|
|
734
|
-
style: normalizeStyle(_ctx.innerStyle),
|
|
735
|
-
"stroke-width": _ctx.strokeWidth,
|
|
736
|
-
"stroke-linecap": _ctx.strokeLinecap,
|
|
737
|
-
"stroke-linejoin": _ctx.strokeLinejoin,
|
|
738
|
-
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
|
|
739
|
-
}, _cache[1] || (_cache[1] = [
|
|
740
|
-
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),
|
|
741
|
-
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)
|
|
742
|
-
]), 14, _hoisted_1$8);
|
|
1172
|
+
return "";
|
|
743
1173
|
}
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
|
|
749
|
-
app.component(iconPrefix + _IconQuestionCircle.name, _IconQuestionCircle);
|
|
750
|
-
}
|
|
751
|
-
});
|
|
752
|
-
const _sfc_main$7 = defineComponent({
|
|
753
|
-
name: "IconRefresh",
|
|
754
|
-
props: {
|
|
755
|
-
size: {
|
|
756
|
-
type: [Number, String]
|
|
757
|
-
},
|
|
758
|
-
strokeWidth: {
|
|
759
|
-
type: Number,
|
|
760
|
-
default: 4
|
|
761
|
-
},
|
|
762
|
-
strokeLinecap: {
|
|
763
|
-
type: String,
|
|
764
|
-
default: "butt",
|
|
765
|
-
validator: (value) => {
|
|
766
|
-
return ["butt", "round", "square"].includes(value);
|
|
767
|
-
}
|
|
768
|
-
},
|
|
769
|
-
strokeLinejoin: {
|
|
770
|
-
type: String,
|
|
771
|
-
default: "miter",
|
|
772
|
-
validator: (value) => {
|
|
773
|
-
return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
|
|
774
|
-
}
|
|
775
|
-
},
|
|
776
|
-
rotate: Number,
|
|
777
|
-
spin: Boolean
|
|
1174
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
1175
|
+
...{
|
|
1176
|
+
name: "BasicForm",
|
|
1177
|
+
inheritAttrs: false
|
|
778
1178
|
},
|
|
779
|
-
|
|
780
|
-
|
|
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 }
|
|
781
1200
|
},
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
const
|
|
785
|
-
const
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
}
|
|
793
|
-
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 };
|
|
794
1212
|
});
|
|
795
|
-
const
|
|
796
|
-
|
|
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
|
+
});
|
|
797
1257
|
};
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
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 };
|
|
802
1269
|
};
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
viewBox: "0 0 48 48",
|
|
809
|
-
fill: "none",
|
|
810
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
811
|
-
stroke: "currentColor",
|
|
812
|
-
class: normalizeClass(_ctx.cls),
|
|
813
|
-
style: normalizeStyle(_ctx.innerStyle),
|
|
814
|
-
"stroke-width": _ctx.strokeWidth,
|
|
815
|
-
"stroke-linecap": _ctx.strokeLinecap,
|
|
816
|
-
"stroke-linejoin": _ctx.strokeLinejoin,
|
|
817
|
-
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
|
|
818
|
-
}, _cache[1] || (_cache[1] = [
|
|
819
|
-
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)
|
|
820
|
-
]), 14, _hoisted_1$7);
|
|
821
|
-
}
|
|
822
|
-
var _IconRefresh = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["render", _sfc_render$4]]);
|
|
823
|
-
const IconRefresh = Object.assign(_IconRefresh, {
|
|
824
|
-
install: (app, options) => {
|
|
825
|
-
var _a;
|
|
826
|
-
const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
|
|
827
|
-
app.component(iconPrefix + _IconRefresh.name, _IconRefresh);
|
|
828
|
-
}
|
|
829
|
-
});
|
|
830
|
-
const _sfc_main$6 = defineComponent({
|
|
831
|
-
name: "IconSettings",
|
|
832
|
-
props: {
|
|
833
|
-
size: {
|
|
834
|
-
type: [Number, String]
|
|
835
|
-
},
|
|
836
|
-
strokeWidth: {
|
|
837
|
-
type: Number,
|
|
838
|
-
default: 4
|
|
839
|
-
},
|
|
840
|
-
strokeLinecap: {
|
|
841
|
-
type: String,
|
|
842
|
-
default: "butt",
|
|
843
|
-
validator: (value) => {
|
|
844
|
-
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);
|
|
845
1275
|
}
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
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;
|
|
852
1295
|
}
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
spin: Boolean
|
|
856
|
-
},
|
|
857
|
-
emits: {
|
|
858
|
-
click: (ev) => true
|
|
859
|
-
},
|
|
860
|
-
setup(props, { emit }) {
|
|
861
|
-
const prefixCls = getPrefixCls("icon");
|
|
862
|
-
const cls = computed(() => [prefixCls, `${prefixCls}-settings`, { [`${prefixCls}-spin`]: props.spin }]);
|
|
863
|
-
const innerStyle = computed(() => {
|
|
864
|
-
const styles = {};
|
|
865
|
-
if (props.size) {
|
|
866
|
-
styles.fontSize = isNumber(props.size) ? `${props.size}px` : props.size;
|
|
1296
|
+
if (!propsData.autoSetPlaceHolder) {
|
|
1297
|
+
return "";
|
|
867
1298
|
}
|
|
868
|
-
|
|
869
|
-
|
|
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;
|
|
870
1324
|
}
|
|
871
|
-
return styles;
|
|
872
|
-
});
|
|
873
|
-
const onClick = (ev) => {
|
|
874
|
-
emit("click", ev);
|
|
875
1325
|
};
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
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"]);
|
|
880
1549
|
};
|
|
881
1550
|
}
|
|
882
1551
|
});
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
"stroke-linejoin": _ctx.strokeLinejoin,
|
|
895
|
-
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
|
|
896
|
-
}, _cache[1] || (_cache[1] = [
|
|
897
|
-
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),
|
|
898
|
-
createElementVNode("path", { d: "M30 24a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z" }, null, -1)
|
|
899
|
-
]), 14, _hoisted_1$6);
|
|
900
|
-
}
|
|
901
|
-
var _IconSettings = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["render", _sfc_render$3]]);
|
|
902
|
-
const IconSettings = Object.assign(_IconSettings, {
|
|
903
|
-
install: (app, options) => {
|
|
904
|
-
var _a;
|
|
905
|
-
const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
|
|
906
|
-
app.component(iconPrefix + _IconSettings.name, _IconSettings);
|
|
907
|
-
}
|
|
908
|
-
});
|
|
909
|
-
const _sfc_main$5 = defineComponent({
|
|
910
|
-
name: "IconLineHeight",
|
|
911
|
-
props: {
|
|
912
|
-
size: {
|
|
913
|
-
type: [Number, String]
|
|
914
|
-
},
|
|
915
|
-
strokeWidth: {
|
|
916
|
-
type: Number,
|
|
917
|
-
default: 4
|
|
918
|
-
},
|
|
919
|
-
strokeLinecap: {
|
|
920
|
-
type: String,
|
|
921
|
-
default: "butt",
|
|
922
|
-
validator: (value) => {
|
|
923
|
-
return ["butt", "round", "square"].includes(value);
|
|
924
|
-
}
|
|
925
|
-
},
|
|
926
|
-
strokeLinejoin: {
|
|
927
|
-
type: String,
|
|
928
|
-
default: "miter",
|
|
929
|
-
validator: (value) => {
|
|
930
|
-
return ["arcs", "bevel", "miter", "miter-clip", "round"].includes(value);
|
|
931
|
-
}
|
|
932
|
-
},
|
|
933
|
-
rotate: Number,
|
|
934
|
-
spin: Boolean
|
|
935
|
-
},
|
|
936
|
-
emits: {
|
|
937
|
-
click: (ev) => true
|
|
938
|
-
},
|
|
939
|
-
setup(props, { emit }) {
|
|
940
|
-
const prefixCls = getPrefixCls("icon");
|
|
941
|
-
const cls = computed(() => [prefixCls, `${prefixCls}-line-height`, { [`${prefixCls}-spin`]: props.spin }]);
|
|
942
|
-
const innerStyle = computed(() => {
|
|
943
|
-
const styles = {};
|
|
944
|
-
if (props.size) {
|
|
945
|
-
styles.fontSize = isNumber(props.size) ? `${props.size}px` : props.size;
|
|
946
|
-
}
|
|
947
|
-
if (props.rotate) {
|
|
948
|
-
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;
|
|
949
1563
|
}
|
|
950
|
-
return styles;
|
|
951
1564
|
});
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
}
|
|
962
|
-
const
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
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 () => {
|
|
988
1607
|
var _a;
|
|
989
|
-
const
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
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];
|
|
1033
1674
|
}
|
|
1034
|
-
return styles;
|
|
1035
1675
|
});
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
};
|
|
1039
|
-
return {
|
|
1040
|
-
cls,
|
|
1041
|
-
innerStyle,
|
|
1042
|
-
onClick
|
|
1043
|
-
};
|
|
1044
|
-
}
|
|
1045
|
-
});
|
|
1046
|
-
const _hoisted_1$4 = ["stroke-width", "stroke-linecap", "stroke-linejoin"];
|
|
1047
|
-
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1048
|
-
return openBlock(), createElementBlock("svg", {
|
|
1049
|
-
viewBox: "0 0 48 48",
|
|
1050
|
-
fill: "none",
|
|
1051
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1052
|
-
stroke: "currentColor",
|
|
1053
|
-
class: normalizeClass(_ctx.cls),
|
|
1054
|
-
style: normalizeStyle(_ctx.innerStyle),
|
|
1055
|
-
"stroke-width": _ctx.strokeWidth,
|
|
1056
|
-
"stroke-linecap": _ctx.strokeLinecap,
|
|
1057
|
-
"stroke-linejoin": _ctx.strokeLinejoin,
|
|
1058
|
-
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
|
|
1059
|
-
}, _cache[1] || (_cache[1] = [
|
|
1060
|
-
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)
|
|
1061
|
-
]), 14, _hoisted_1$4);
|
|
1062
|
-
}
|
|
1063
|
-
var _IconFullscreenExit = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["render", _sfc_render$1]]);
|
|
1064
|
-
const IconFullscreenExit = Object.assign(_IconFullscreenExit, {
|
|
1065
|
-
install: (app, options) => {
|
|
1676
|
+
};
|
|
1677
|
+
const appendSchemaByField = async (schema, prefixField, first = false) => {
|
|
1066
1678
|
var _a;
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
const
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
strokeWidth: {
|
|
1078
|
-
type: Number,
|
|
1079
|
-
default: 4
|
|
1080
|
-
},
|
|
1081
|
-
strokeLinecap: {
|
|
1082
|
-
type: String,
|
|
1083
|
-
default: "butt",
|
|
1084
|
-
validator: (value) => {
|
|
1085
|
-
return ["butt", "round", "square"].includes(value);
|
|
1086
|
-
}
|
|
1087
|
-
},
|
|
1088
|
-
strokeLinejoin: {
|
|
1089
|
-
type: String,
|
|
1090
|
-
default: "miter",
|
|
1091
|
-
validator: (value) => {
|
|
1092
|
-
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;
|
|
1093
1689
|
}
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
setup(props, { emit }) {
|
|
1102
|
-
const prefixCls = getPrefixCls("icon");
|
|
1103
|
-
const cls = computed(() => [prefixCls, `${prefixCls}-fullscreen`, { [`${prefixCls}-spin`]: props.spin }]);
|
|
1104
|
-
const innerStyle = computed(() => {
|
|
1105
|
-
const styles = {};
|
|
1106
|
-
if (props.size) {
|
|
1107
|
-
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);
|
|
1108
1697
|
}
|
|
1109
|
-
|
|
1110
|
-
|
|
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;
|
|
1111
1705
|
}
|
|
1112
|
-
return styles;
|
|
1113
1706
|
});
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
return
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
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();
|
|
1140
1762
|
}
|
|
1141
|
-
var _IconFullscreen = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["render", _sfc_render]]);
|
|
1142
|
-
const IconFullscreen = Object.assign(_IconFullscreen, {
|
|
1143
|
-
install: (app, options) => {
|
|
1144
|
-
var _a;
|
|
1145
|
-
const iconPrefix = (_a = options == null ? void 0 : options.iconPrefix) != null ? _a : "";
|
|
1146
|
-
app.component(iconPrefix + _IconFullscreen.name, _IconFullscreen);
|
|
1147
|
-
}
|
|
1148
|
-
});
|
|
1149
1763
|
function debounce(func, wait = 300, immediate = false) {
|
|
1150
1764
|
let timeout = null;
|
|
1151
1765
|
const debounced = function(...args) {
|
|
@@ -2095,7 +2709,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
2095
2709
|
const _component_a_table = resolveComponent("a-table");
|
|
2096
2710
|
return openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
2097
2711
|
getSearchConfig.value.show ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
|
|
2098
|
-
createVNode(unref(_sfc_main$
|
|
2712
|
+
createVNode(unref(_sfc_main$3), mergeProps({
|
|
2099
2713
|
ref_key: "searchFormRef",
|
|
2100
2714
|
ref: searchFormRef
|
|
2101
2715
|
}, getSearchFormProps.value, {
|
|
@@ -2381,13 +2995,6 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
2381
2995
|
};
|
|
2382
2996
|
}
|
|
2383
2997
|
});
|
|
2384
|
-
const _export_sfc = (sfc, props) => {
|
|
2385
|
-
const target = sfc.__vccOpts || sfc;
|
|
2386
|
-
for (const [key, val] of props) {
|
|
2387
|
-
target[key] = val;
|
|
2388
|
-
}
|
|
2389
|
-
return target;
|
|
2390
|
-
};
|
|
2391
2998
|
const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-f0b71ff8"]]);
|
|
2392
2999
|
function useTable(options = {}) {
|
|
2393
3000
|
const tableRef = ref(null);
|
|
@@ -3418,6 +4025,102 @@ function useDescription(props) {
|
|
|
3418
4025
|
}
|
|
3419
4026
|
];
|
|
3420
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
|
+
}
|
|
3421
4124
|
function formatDate(date, format = "YYYY-MM-DD HH:mm:ss") {
|
|
3422
4125
|
const d = typeof date === "number" ? new Date(date) : date;
|
|
3423
4126
|
const year = d.getFullYear();
|
|
@@ -3498,9 +4201,10 @@ function useToggle(initialValue = false) {
|
|
|
3498
4201
|
}
|
|
3499
4202
|
export {
|
|
3500
4203
|
BasicDescription,
|
|
3501
|
-
_sfc_main$
|
|
4204
|
+
_sfc_main$3 as BasicForm,
|
|
3502
4205
|
BasicModal,
|
|
3503
4206
|
BasicTable,
|
|
4207
|
+
BasicUpload,
|
|
3504
4208
|
componentMap,
|
|
3505
4209
|
createFormSchema,
|
|
3506
4210
|
createTableColumns,
|
|
@@ -3524,6 +4228,7 @@ export {
|
|
|
3524
4228
|
useModal,
|
|
3525
4229
|
useModalInner,
|
|
3526
4230
|
useTable,
|
|
3527
|
-
useToggle
|
|
4231
|
+
useToggle,
|
|
4232
|
+
useUpload
|
|
3528
4233
|
};
|
|
3529
4234
|
//# sourceMappingURL=index.esm.js.map
|