@form-create/element-ui 3.1.4 → 3.1.7
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/form-create.esm.js +199 -99
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +198 -98
- package/dist/form-create.min.js +2 -2
- package/package.json +5 -5
- package/src/core/manager.js +22 -9
- package/src/core/provider.js +7 -4
package/src/core/manager.js
CHANGED
|
@@ -137,8 +137,8 @@ export default {
|
|
|
137
137
|
return !((!title.title && !title.native) || isFalse(title.show))
|
|
138
138
|
},
|
|
139
139
|
makeInfo(rule, uni) {
|
|
140
|
-
const titleProp = rule.title;
|
|
141
|
-
const infoProp = rule.info;
|
|
140
|
+
const titleProp = {...rule.title};
|
|
141
|
+
const infoProp = {...rule.info};
|
|
142
142
|
const isTip = isTooltip(infoProp);
|
|
143
143
|
const form = this.options.form;
|
|
144
144
|
const children = [(titleProp.title || '') + (form.labelSuffix || form['label-suffix'] || '')];
|
|
@@ -153,6 +153,8 @@ export default {
|
|
|
153
153
|
delete prop.props.icon;
|
|
154
154
|
delete prop.props.show;
|
|
155
155
|
delete prop.props.info;
|
|
156
|
+
delete prop.props.align;
|
|
157
|
+
delete prop.props.native;
|
|
156
158
|
|
|
157
159
|
const field = 'content';
|
|
158
160
|
if (infoProp.info && !hasProperty(prop.props, field)) {
|
|
@@ -171,12 +173,17 @@ export default {
|
|
|
171
173
|
}, true)
|
|
172
174
|
}));
|
|
173
175
|
}
|
|
174
|
-
|
|
175
|
-
return this.$r(mergeProps([titleProp, {
|
|
176
|
+
const _prop = mergeProps([titleProp, {
|
|
176
177
|
props: titleProp,
|
|
177
178
|
key: `${uni}tit`,
|
|
178
179
|
type: titleProp.type || 'span',
|
|
179
|
-
}])
|
|
180
|
+
}]);
|
|
181
|
+
|
|
182
|
+
delete _prop.props.show;
|
|
183
|
+
delete _prop.props.title;
|
|
184
|
+
delete _prop.props.native;
|
|
185
|
+
|
|
186
|
+
return this.$r(_prop, children);
|
|
180
187
|
},
|
|
181
188
|
makeCol(rule, uni, children) {
|
|
182
189
|
const col = rule.col;
|
|
@@ -225,6 +232,9 @@ export default {
|
|
|
225
232
|
const resetBtn = {...this.options.resetBtn};
|
|
226
233
|
const innerText = resetBtn.innerText;
|
|
227
234
|
delete resetBtn.innerText;
|
|
235
|
+
delete resetBtn.click;
|
|
236
|
+
delete resetBtn.col;
|
|
237
|
+
delete resetBtn.show;
|
|
228
238
|
return this.$r({
|
|
229
239
|
type: 'button',
|
|
230
240
|
props: resetBtn,
|
|
@@ -232,8 +242,8 @@ export default {
|
|
|
232
242
|
on: {
|
|
233
243
|
click: () => {
|
|
234
244
|
const fApi = this.$handle.api;
|
|
235
|
-
resetBtn.click
|
|
236
|
-
? resetBtn.click(fApi)
|
|
245
|
+
this.options.resetBtn.click
|
|
246
|
+
? this.options.resetBtn.click(fApi)
|
|
237
247
|
: fApi.resetFields();
|
|
238
248
|
}
|
|
239
249
|
},
|
|
@@ -244,6 +254,9 @@ export default {
|
|
|
244
254
|
const submitBtn = {...this.options.submitBtn};
|
|
245
255
|
const innerText = submitBtn.innerText;
|
|
246
256
|
delete submitBtn.innerText;
|
|
257
|
+
delete submitBtn.click;
|
|
258
|
+
delete submitBtn.col;
|
|
259
|
+
delete submitBtn.show;
|
|
247
260
|
return this.$r({
|
|
248
261
|
type: 'button',
|
|
249
262
|
props: submitBtn,
|
|
@@ -251,8 +264,8 @@ export default {
|
|
|
251
264
|
on: {
|
|
252
265
|
click: () => {
|
|
253
266
|
const fApi = this.$handle.api;
|
|
254
|
-
submitBtn.click
|
|
255
|
-
? submitBtn.click(fApi)
|
|
267
|
+
this.options.submitBtn.click
|
|
268
|
+
? this.options.submitBtn.click(fApi)
|
|
256
269
|
: fApi.submit();
|
|
257
270
|
}
|
|
258
271
|
},
|
package/src/core/provider.js
CHANGED
|
@@ -3,16 +3,16 @@ import is from '@form-create/utils/lib/type';
|
|
|
3
3
|
const required = {
|
|
4
4
|
name: 'required',
|
|
5
5
|
load(inject, rule, api) {
|
|
6
|
-
const val =
|
|
6
|
+
const val = parseVal(inject.getValue());
|
|
7
7
|
if (val.required === false) {
|
|
8
8
|
inject.clearProp();
|
|
9
9
|
} else {
|
|
10
10
|
const validate = {
|
|
11
|
-
...val,
|
|
12
11
|
required: true,
|
|
13
12
|
validator(_, v, call) {
|
|
14
13
|
is.empty(v) ? call(validate.message) : call();
|
|
15
|
-
}
|
|
14
|
+
},
|
|
15
|
+
...val,
|
|
16
16
|
};
|
|
17
17
|
if (!validate.message) {
|
|
18
18
|
validate.message = rule.title + ' is required';
|
|
@@ -26,11 +26,13 @@ const required = {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
function
|
|
29
|
+
function parseVal(val) {
|
|
30
30
|
if (is.Boolean(val)) {
|
|
31
31
|
return {required: val}
|
|
32
32
|
} else if (is.String(val)) {
|
|
33
33
|
return {message: val};
|
|
34
|
+
} else if (is.Function(val)) {
|
|
35
|
+
return {validator: val};
|
|
34
36
|
} else if (!is.Object(val)) {
|
|
35
37
|
return {};
|
|
36
38
|
} else {
|
|
@@ -38,4 +40,5 @@ function parseVa(val) {
|
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
|
|
43
|
+
|
|
41
44
|
export default required
|