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