@form-create/element-ui 2.5.17 → 3.0.1
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 +5932 -0
- package/dist/form-create.esm.min.js +7 -0
- package/dist/form-create.js +1592 -1772
- package/dist/form-create.min.js +2 -3
- package/package.json +33 -18
- package/src/core/alias.js +29 -29
- package/src/core/api.js +40 -78
- package/src/core/index.js +2 -2
- package/src/core/manager.js +45 -38
- package/src/index.js +0 -3
- package/src/parsers/datePicker.js +7 -8
- package/src/parsers/row.js +6 -4
- package/src/style/index.css +1 -1
- package/types/config.d.ts +41 -16
- package/types/index.d.ts +4 -7
- package/dist/form-create.min.js.map +0 -1
package/src/core/alias.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
const PRE = 'el';
|
|
2
2
|
export default {
|
|
3
|
-
button: PRE + '
|
|
3
|
+
button: PRE + '-button',
|
|
4
4
|
icon: 'i',
|
|
5
|
-
slider: PRE + '
|
|
6
|
-
rate: PRE + '
|
|
7
|
-
upload: '
|
|
8
|
-
cascader: PRE + '
|
|
9
|
-
popover: PRE + '
|
|
10
|
-
tooltip: PRE + '
|
|
11
|
-
colorPicker: PRE + '
|
|
12
|
-
timePicker: PRE + '
|
|
13
|
-
timeSelect: PRE + '
|
|
14
|
-
datePicker: PRE + '
|
|
15
|
-
'switch': PRE + '
|
|
16
|
-
select: '
|
|
17
|
-
checkbox: '
|
|
18
|
-
radio: '
|
|
19
|
-
inputNumber: PRE + '
|
|
20
|
-
number: PRE + '
|
|
21
|
-
input: PRE + '
|
|
22
|
-
formItem: PRE + '
|
|
23
|
-
form: PRE + '
|
|
24
|
-
frame: '
|
|
25
|
-
col: PRE + '
|
|
26
|
-
row: PRE + '
|
|
27
|
-
tree: '
|
|
28
|
-
autoComplete: PRE + '
|
|
29
|
-
auto: PRE + '
|
|
30
|
-
group: '
|
|
31
|
-
object: '
|
|
32
|
-
subForm: '
|
|
5
|
+
slider: PRE + '-slider',
|
|
6
|
+
rate: PRE + '-rate',
|
|
7
|
+
upload: 'fc-upload',
|
|
8
|
+
cascader: PRE + '-cascader',
|
|
9
|
+
popover: PRE + '-popover',
|
|
10
|
+
tooltip: PRE + '-tooltip',
|
|
11
|
+
colorPicker: PRE + '-colorPicker',
|
|
12
|
+
timePicker: PRE + '-time-picker',
|
|
13
|
+
timeSelect: PRE + '-time-select',
|
|
14
|
+
datePicker: PRE + '-date-picker',
|
|
15
|
+
'switch': PRE + '-switch',
|
|
16
|
+
select: 'fc-select',
|
|
17
|
+
checkbox: 'fc-checkbox',
|
|
18
|
+
radio: 'fc-radio',
|
|
19
|
+
inputNumber: PRE + '-input-number',
|
|
20
|
+
number: PRE + '-input-number',
|
|
21
|
+
input: PRE + '-input',
|
|
22
|
+
formItem: PRE + '-form-item',
|
|
23
|
+
form: PRE + '-form',
|
|
24
|
+
frame: 'fc-frame',
|
|
25
|
+
col: PRE + '-col',
|
|
26
|
+
row: PRE + '-row',
|
|
27
|
+
tree: 'fc-tree',
|
|
28
|
+
autoComplete: PRE + '-autocomplete',
|
|
29
|
+
auto: PRE + '-autocomplete',
|
|
30
|
+
group: 'fc-group',
|
|
31
|
+
object: 'fc-sub-form',
|
|
32
|
+
subForm: 'fc-sub-form',
|
|
33
33
|
}
|
package/src/core/api.js
CHANGED
|
@@ -13,75 +13,38 @@ function tidyBtnProp(btn, def) {
|
|
|
13
13
|
export default function extendApi(api, h) {
|
|
14
14
|
extend(api, {
|
|
15
15
|
validate(callback) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
callback && callback(
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (!args[0]) {
|
|
31
|
-
if (!flag) {
|
|
32
|
-
flag = args;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
if (!--len) {
|
|
36
|
-
validate();
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
forms.forEach(form => {
|
|
42
|
-
form.validate((...args) => validFn(args))
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
if (!len) {
|
|
46
|
-
validate();
|
|
47
|
-
}
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
const forms = api.children;
|
|
18
|
+
const all = [h.$manager.validate()];
|
|
19
|
+
forms.forEach(v => {
|
|
20
|
+
all.push(v.validate());
|
|
21
|
+
})
|
|
22
|
+
Promise.all(all).then(() => {
|
|
23
|
+
resolve(true);
|
|
24
|
+
callback && callback(true);
|
|
25
|
+
}).catch((e) => {
|
|
26
|
+
reject(e);
|
|
27
|
+
callback && callback(e);
|
|
28
|
+
})
|
|
29
|
+
});
|
|
48
30
|
},
|
|
49
|
-
validateField
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const validFn = (args) => {
|
|
66
|
-
setTimeout(() => {
|
|
67
|
-
if (!args[0]) {
|
|
68
|
-
if (!flag) {
|
|
69
|
-
flag = args;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (!--len) {
|
|
73
|
-
validate();
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
sub && toArray(sub).forEach(form => {
|
|
78
|
-
len++;
|
|
79
|
-
form.validate((...args) => validFn(args))
|
|
31
|
+
validateField(field, callback) {
|
|
32
|
+
return new Promise((resolve, reject) => {
|
|
33
|
+
const ctx = h.getFieldCtx(field);
|
|
34
|
+
if (!ctx) return;
|
|
35
|
+
const sub = h.subForm[ctx.id];
|
|
36
|
+
const all = [h.$manager.validateField(ctx.id)];
|
|
37
|
+
toArray(sub).forEach(v => {
|
|
38
|
+
all.push(v.validate());
|
|
39
|
+
})
|
|
40
|
+
Promise.all(all).then(() => {
|
|
41
|
+
resolve(null);
|
|
42
|
+
callback && callback(null);
|
|
43
|
+
}).catch((e) => {
|
|
44
|
+
reject(e);
|
|
45
|
+
callback && callback(e);
|
|
46
|
+
})
|
|
80
47
|
});
|
|
81
|
-
|
|
82
|
-
if (!len) {
|
|
83
|
-
validate();
|
|
84
|
-
}
|
|
85
48
|
},
|
|
86
49
|
clearValidateState(fields, clearSub = true) {
|
|
87
50
|
api.helper.tidyFields(fields).forEach(field => {
|
|
@@ -141,18 +104,17 @@ export default function extendApi(api, h) {
|
|
|
141
104
|
api.refreshOptions();
|
|
142
105
|
},
|
|
143
106
|
submit(successFn, failFn) {
|
|
144
|
-
|
|
145
|
-
|
|
107
|
+
return new Promise((resolve, reject) => {
|
|
108
|
+
api.validate().then(() => {
|
|
146
109
|
let formData = api.formData();
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
110
|
+
is.Function(successFn) && invoke(() => successFn(formData, api));
|
|
111
|
+
is.Function(h.options.onSubmit) && invoke(() => h.options.onSubmit(formData, api));
|
|
112
|
+
h.vm.emit('submit', formData, api);
|
|
113
|
+
resolve(formData);
|
|
114
|
+
}).catch((...args) => {
|
|
115
|
+
is.Function(failFn) && invoke(() => failFn(api, ...args));
|
|
116
|
+
reject(...args)
|
|
117
|
+
})
|
|
156
118
|
});
|
|
157
119
|
},
|
|
158
120
|
});
|
package/src/core/index.js
CHANGED
|
@@ -25,8 +25,8 @@ function install(FormCreate) {
|
|
|
25
25
|
|
|
26
26
|
export default function elmFormCreate() {
|
|
27
27
|
return FormCreateFactory({
|
|
28
|
-
ui:
|
|
29
|
-
version:
|
|
28
|
+
ui:'process.env.UI',
|
|
29
|
+
version: 'process.env.VERSION',
|
|
30
30
|
manager,
|
|
31
31
|
extendApi,
|
|
32
32
|
install,
|
package/src/core/manager.js
CHANGED
|
@@ -8,12 +8,6 @@ function isTooltip(info) {
|
|
|
8
8
|
return info.type === 'tooltip';
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
const upperCaseReg = /[A-Z]/;
|
|
12
|
-
|
|
13
|
-
export function isAttr(name, value) {
|
|
14
|
-
return (!upperCaseReg.test(name) && (is.String(value) || is.Number(value)))
|
|
15
|
-
}
|
|
16
|
-
|
|
17
11
|
function tidy(props, name) {
|
|
18
12
|
if (!hasProperty(props, name)) return;
|
|
19
13
|
if (is.String(props[name])) {
|
|
@@ -32,17 +26,30 @@ function tidyBool(opt, name) {
|
|
|
32
26
|
}
|
|
33
27
|
|
|
34
28
|
export default {
|
|
35
|
-
validate(
|
|
36
|
-
this.form()
|
|
29
|
+
validate() {
|
|
30
|
+
const form = this.form();
|
|
31
|
+
if (form) {
|
|
32
|
+
return form.validate();
|
|
33
|
+
} else {
|
|
34
|
+
return new Promise(v => v());
|
|
35
|
+
}
|
|
37
36
|
},
|
|
38
|
-
validateField(field
|
|
39
|
-
|
|
37
|
+
validateField(field) {
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
const form = this.form();
|
|
40
|
+
if (form) {
|
|
41
|
+
form.validateField(field, (res) => {
|
|
42
|
+
res ? reject(res) : resolve(null);
|
|
43
|
+
});
|
|
44
|
+
} else {
|
|
45
|
+
resolve();
|
|
46
|
+
}
|
|
47
|
+
});
|
|
40
48
|
},
|
|
41
49
|
clearValidateState(ctx) {
|
|
42
|
-
const fItem = this.vm
|
|
50
|
+
const fItem = this.vm.refs[ctx.wrapRef];
|
|
43
51
|
if (fItem) {
|
|
44
|
-
fItem.
|
|
45
|
-
fItem.validateState = '';
|
|
52
|
+
fItem.clearValidate();
|
|
46
53
|
}
|
|
47
54
|
},
|
|
48
55
|
tidyOptions(options) {
|
|
@@ -57,13 +64,7 @@ export default {
|
|
|
57
64
|
return prop;
|
|
58
65
|
},
|
|
59
66
|
mergeProp(ctx) {
|
|
60
|
-
let props = ctx.prop.props;
|
|
61
67
|
ctx.prop = mergeProps([{
|
|
62
|
-
attrs: Object.keys(props).reduce((initial, val) => {
|
|
63
|
-
if (isAttr(val, props[val]))
|
|
64
|
-
initial[val] = props[val];
|
|
65
|
-
return initial;
|
|
66
|
-
}, {}),
|
|
67
68
|
info: this.options.info || {},
|
|
68
69
|
wrap: this.options.wrap || {},
|
|
69
70
|
col: this.options.col || {},
|
|
@@ -85,7 +86,7 @@ export default {
|
|
|
85
86
|
const form = this.options.form;
|
|
86
87
|
this.rule = {
|
|
87
88
|
props: {...form},
|
|
88
|
-
|
|
89
|
+
on: {
|
|
89
90
|
submit: (e) => {
|
|
90
91
|
e.preventDefault();
|
|
91
92
|
}
|
|
@@ -100,14 +101,13 @@ export default {
|
|
|
100
101
|
extend(this.rule, {key, ref});
|
|
101
102
|
extend(this.rule.props, {
|
|
102
103
|
model: $handle.formData,
|
|
103
|
-
rules: $handle.validate(),
|
|
104
104
|
});
|
|
105
105
|
},
|
|
106
106
|
render(children) {
|
|
107
|
-
if (children.
|
|
108
|
-
children.
|
|
107
|
+
if (children.slotLen()) {
|
|
108
|
+
children.setSlot(undefined, () => this.makeFormBtn());
|
|
109
109
|
}
|
|
110
|
-
return this.$r(this.rule, isFalse(this.options.row.show) ? children : [this.makeRow(children)]);
|
|
110
|
+
return this.$r(this.rule, isFalse(this.options.row.show) ? children.getSlots() : [this.makeRow(children)]);
|
|
111
111
|
},
|
|
112
112
|
makeWrap(ctx, children) {
|
|
113
113
|
const rule = ctx.prop;
|
|
@@ -128,7 +128,7 @@ export default {
|
|
|
128
128
|
key: `${uni}fi`,
|
|
129
129
|
ref: ctx.wrapRef,
|
|
130
130
|
type: 'formItem',
|
|
131
|
-
}]),
|
|
131
|
+
}]), {default: () => children, ...(isTitle ? {label: () => this.makeInfo(rule, uni)} : {})});
|
|
132
132
|
return (inline === true || isFalse(_col) || isFalse(col.show)) ? item : this.makeCol(rule, uni, [item]);
|
|
133
133
|
},
|
|
134
134
|
isTitle(rule) {
|
|
@@ -147,25 +147,29 @@ export default {
|
|
|
147
147
|
const prop = {
|
|
148
148
|
type: infoProp.type || 'popover',
|
|
149
149
|
props: {...infoProp},
|
|
150
|
-
key: `${uni}pop
|
|
151
|
-
slot: 'label'
|
|
150
|
+
key: `${uni}pop`
|
|
152
151
|
};
|
|
152
|
+
|
|
153
|
+
delete prop.props.icon;
|
|
154
|
+
delete prop.props.show;
|
|
155
|
+
delete prop.props.info;
|
|
156
|
+
|
|
153
157
|
const field = 'content';
|
|
154
158
|
if (infoProp.info && !hasProperty(prop.props, field)) {
|
|
155
159
|
prop.props[field] = infoProp.info;
|
|
156
160
|
}
|
|
157
|
-
|
|
158
|
-
|
|
161
|
+
|
|
162
|
+
children[infoProp.align !== 'left' ? 'unshift' : 'push'](this.$r(mergeProps([infoProp, prop]), {
|
|
163
|
+
[titleProp.slot || (isTip ? 'default' : 'reference')]: () => this.$r({
|
|
159
164
|
type: 'i',
|
|
160
|
-
slot: isTip ? 'default' : 'reference',
|
|
161
165
|
class: infoProp.icon === true ? 'el-icon-warning' : infoProp.icon,
|
|
162
166
|
key: `${uni}i`
|
|
163
|
-
})
|
|
164
|
-
|
|
167
|
+
}, {}, true)
|
|
168
|
+
}));
|
|
165
169
|
}
|
|
170
|
+
|
|
166
171
|
return this.$r(mergeProps([titleProp, {
|
|
167
172
|
props: titleProp,
|
|
168
|
-
slot: titleProp.slot || 'label',
|
|
169
173
|
key: `${uni}tit`,
|
|
170
174
|
type: titleProp.type || 'span',
|
|
171
175
|
}]), children);
|
|
@@ -213,7 +217,9 @@ export default {
|
|
|
213
217
|
}, [item]);
|
|
214
218
|
},
|
|
215
219
|
makeResetBtn() {
|
|
216
|
-
const resetBtn = this.options.resetBtn;
|
|
220
|
+
const resetBtn = {...this.options.resetBtn};
|
|
221
|
+
const innerText = resetBtn.innerText;
|
|
222
|
+
delete resetBtn.innerText;
|
|
217
223
|
return this.$r({
|
|
218
224
|
type: 'button',
|
|
219
225
|
props: resetBtn,
|
|
@@ -227,11 +233,12 @@ export default {
|
|
|
227
233
|
}
|
|
228
234
|
},
|
|
229
235
|
key: `${this.key}b2`,
|
|
230
|
-
}, [
|
|
236
|
+
}, [innerText]);
|
|
231
237
|
},
|
|
232
238
|
makeSubmitBtn() {
|
|
233
|
-
const submitBtn = this.options.submitBtn;
|
|
234
|
-
|
|
239
|
+
const submitBtn = {...this.options.submitBtn};
|
|
240
|
+
const innerText = submitBtn.innerText;
|
|
241
|
+
delete submitBtn.innerText;
|
|
235
242
|
return this.$r({
|
|
236
243
|
type: 'button',
|
|
237
244
|
props: submitBtn,
|
|
@@ -245,6 +252,6 @@ export default {
|
|
|
245
252
|
}
|
|
246
253
|
},
|
|
247
254
|
key: `${this.key}b1`,
|
|
248
|
-
}, [
|
|
255
|
+
}, [innerText]);
|
|
249
256
|
}
|
|
250
257
|
}
|
package/src/index.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import {creatorFactory} from '@form-create/core/src/index';
|
|
2
2
|
|
|
3
3
|
const DEFAULT_FORMATS = {
|
|
4
|
-
date: '
|
|
5
|
-
month: '
|
|
6
|
-
datetime: '
|
|
7
|
-
week: 'yyyywWW',
|
|
4
|
+
date: 'YYYY-MM-DD',
|
|
5
|
+
month: 'YYYY-MM',
|
|
6
|
+
datetime: 'YYYY-MM-DD HH:mm:ss',
|
|
8
7
|
timerange: 'HH:mm:ss',
|
|
9
|
-
daterange: '
|
|
10
|
-
monthrange: '
|
|
11
|
-
datetimerange: '
|
|
12
|
-
year: '
|
|
8
|
+
daterange: 'YYYY-MM-DD',
|
|
9
|
+
monthrange: 'YYYY-MM',
|
|
10
|
+
datetimerange: 'YYYY-MM-DD HH:mm:ss',
|
|
11
|
+
year: 'YYYY'
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
const name = 'datePicker';
|
package/src/parsers/row.js
CHANGED
package/src/style/index.css
CHANGED
package/types/config.d.ts
CHANGED
|
@@ -1,18 +1,43 @@
|
|
|
1
|
-
import {Button, Col, Popover, Row, Tooltip} from "element-ui";
|
|
2
1
|
import {FormData, VNodeData} from "@form-create/core";
|
|
3
|
-
import {
|
|
4
|
-
import {FormItemLabelPosition, ValidateCallback, ValidateFieldCallback} from "element-ui/types/form";
|
|
2
|
+
import {ButtonProps, ValidateFieldCallback} from "element-plus";
|
|
5
3
|
import {Api} from "./index";
|
|
6
4
|
|
|
5
|
+
type SizeObject = {
|
|
6
|
+
span: number
|
|
7
|
+
offset: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type ComponentSize = 'large' | 'default' | 'small'
|
|
11
|
+
|
|
12
|
+
type ColProps = {
|
|
13
|
+
tag: string | 'div';
|
|
14
|
+
span: number | 24;
|
|
15
|
+
offset: number | 0;
|
|
16
|
+
pull: number | 0;
|
|
17
|
+
push: number | 0;
|
|
18
|
+
xs: number | SizeObject;
|
|
19
|
+
sm: number | SizeObject;
|
|
20
|
+
md: number | SizeObject;
|
|
21
|
+
lg: number | SizeObject;
|
|
22
|
+
xl: number | SizeObject;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
type RowProps = {
|
|
26
|
+
tag: string | 'div',
|
|
27
|
+
gutter: number | 0,
|
|
28
|
+
justify: string | 'start',
|
|
29
|
+
align: string | 'top',
|
|
30
|
+
}
|
|
31
|
+
|
|
7
32
|
export interface OptionAttrs {
|
|
8
|
-
col?: Boolean |
|
|
33
|
+
col?: Boolean | ColProps & {
|
|
9
34
|
labelWidth?: number | string;
|
|
10
35
|
show?: Boolean;
|
|
11
36
|
};
|
|
12
|
-
row?: Boolean |
|
|
37
|
+
row?: Boolean | RowProps & {
|
|
13
38
|
show?: Boolean;
|
|
14
39
|
};
|
|
15
|
-
info?: Boolean |
|
|
40
|
+
info?: Boolean | VNodeData & {
|
|
16
41
|
show?: Boolean;
|
|
17
42
|
native?: Boolean;
|
|
18
43
|
icon?: string;
|
|
@@ -25,31 +50,31 @@ export interface OptionAttrs {
|
|
|
25
50
|
error?: string
|
|
26
51
|
showMessage?: boolean
|
|
27
52
|
inlineMessage?: boolean
|
|
28
|
-
size?:
|
|
53
|
+
size?: ComponentSize
|
|
29
54
|
show?: Boolean;
|
|
30
55
|
};
|
|
31
56
|
form?: {
|
|
32
57
|
inline?: boolean
|
|
33
58
|
disabled?: boolean
|
|
34
|
-
labelPosition?:
|
|
59
|
+
labelPosition?: string
|
|
35
60
|
labelWidth?: string
|
|
36
61
|
labelSuffix?: string
|
|
37
62
|
showMessage?: boolean
|
|
38
63
|
inlineMessage?: boolean
|
|
39
64
|
statusIcon?: boolean
|
|
40
65
|
validateOnRuleChange?: boolean
|
|
41
|
-
size?:
|
|
66
|
+
size?: ComponentSize
|
|
42
67
|
className?: any;
|
|
43
68
|
col?: Boolean;
|
|
44
69
|
};
|
|
45
70
|
|
|
46
|
-
submitBtn?: Boolean |
|
|
71
|
+
submitBtn?: Boolean | ButtonProps & {
|
|
47
72
|
click?: Function;
|
|
48
73
|
innerText?: string;
|
|
49
74
|
show?: Boolean;
|
|
50
75
|
};
|
|
51
76
|
|
|
52
|
-
resetBtn?: Boolean |
|
|
77
|
+
resetBtn?: Boolean | ButtonProps & {
|
|
53
78
|
click?: Function;
|
|
54
79
|
innerText?: string;
|
|
55
80
|
show?: Boolean;
|
|
@@ -102,18 +127,18 @@ export interface ApiAttrs {
|
|
|
102
127
|
show(show: boolean): void;
|
|
103
128
|
}
|
|
104
129
|
|
|
105
|
-
submit(success: (formData: FormData,
|
|
130
|
+
submit(success: (formData: FormData, $f: Api) => void, fail: ($f: Api) => void): Promise<any>;
|
|
106
131
|
|
|
107
132
|
clearValidateState(fields?: string | string[], clearSub?: Boolean): void;
|
|
108
133
|
|
|
109
134
|
clearSubValidateState(fields?: string | string[]): void;
|
|
110
135
|
|
|
111
|
-
validate(callback?:
|
|
136
|
+
validate(callback?: (callback?: (boolean: boolean, object: Object) => void) => void): Promise<any>;
|
|
112
137
|
|
|
113
|
-
validateField(field: string, callback?: ValidateFieldCallback):
|
|
138
|
+
validateField(field: string, callback?: ValidateFieldCallback): Promise<any>;
|
|
114
139
|
|
|
115
|
-
submitBtnProps(props:
|
|
140
|
+
submitBtnProps(props: ButtonProps): void;
|
|
116
141
|
|
|
117
|
-
resetBtnProps(props:
|
|
142
|
+
resetBtnProps(props: ButtonProps): void;
|
|
118
143
|
|
|
119
144
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FormCreate,
|
|
3
|
+
FormCreateProps as $FormCreateProps,
|
|
3
4
|
FormRule as $FormRule,
|
|
4
5
|
Options as $Options,
|
|
5
6
|
Rule as $Rule,
|
|
@@ -7,16 +8,11 @@ import {
|
|
|
7
8
|
Control as $Control,
|
|
8
9
|
Api as $Api,
|
|
9
10
|
Effect as $Effect,
|
|
10
|
-
Parser as $Parser
|
|
11
|
+
Parser as $Parser,
|
|
11
12
|
} from "@form-create/core";
|
|
12
13
|
import Maker from "./maker";
|
|
13
14
|
import {ApiAttrs, CreatorAttrs, OptionAttrs, RuleAttrs} from "./config";
|
|
14
|
-
|
|
15
|
-
declare module 'vue/types/vue' {
|
|
16
|
-
interface Vue {
|
|
17
|
-
$formCreate: FormCreate<Maker, OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
15
|
+
import {ExtractPropTypes} from "vue";
|
|
20
16
|
|
|
21
17
|
declare const formCreate: FormCreate<Maker, OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>;
|
|
22
18
|
export default formCreate;
|
|
@@ -28,4 +24,5 @@ export type Effect = $Effect<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>
|
|
|
28
24
|
export type Creator = $Creator<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>
|
|
29
25
|
export type Control = $Control<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>
|
|
30
26
|
export type Api = $Api<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>
|
|
27
|
+
export type FormCreateProps = ExtractPropTypes<$FormCreateProps<OptionAttrs, CreatorAttrs, RuleAttrs, ApiAttrs>>
|
|
31
28
|
export type Parser = $Parser
|