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