Skip to content

Commit 894f954

Browse files
committed
feat: update form
1 parent e8f5b5a commit 894f954

13 files changed

+228
-199
lines changed

build/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
22
dev: {
3-
componentName: 'empty', // dev components
3+
componentName: 'form', // dev components
44
},
55
};

components/form/Form.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ export const FormProps = {
6262
layout: PropTypes.oneOf(['horizontal', 'inline', 'vertical']),
6363
labelCol: PropTypes.shape(ColProps).loose,
6464
wrapperCol: PropTypes.shape(ColProps).loose,
65+
colon: PropTypes.bool,
66+
labelAlign: PropTypes.oneOf(['left', 'right']),
6567
form: PropTypes.object,
6668
// onSubmit: React.FormEventHandler<any>;
6769
prefixCls: PropTypes.string,
@@ -128,6 +130,7 @@ const Form = {
128130
props: initDefaultProps(FormProps, {
129131
layout: 'horizontal',
130132
hideRequiredMark: false,
133+
colon: true,
131134
}),
132135
Item: FormItem,
133136
createFormField: createFormField,
@@ -148,7 +151,7 @@ const Form = {
148151
},
149152
provide() {
150153
return {
151-
FormProps: this.$props,
154+
FormContextProps: this,
152155
// https://github.com/vueComponent/ant-design-vue/issues/446
153156
collectFormItemContext:
154157
this.form && this.form.templateContext
@@ -178,6 +181,11 @@ const Form = {
178181
this.$forceUpdate();
179182
},
180183
},
184+
computed: {
185+
vertical() {
186+
return this.layout === 'vertical';
187+
},
188+
},
181189
beforeUpdate() {
182190
this.formItemContexts.forEach((number, c) => {
183191
if (c.$forceUpdate) {
@@ -220,7 +228,7 @@ const Form = {
220228
[`${prefixCls}-hide-required-mark`]: hideRequiredMark,
221229
});
222230
if (autoFormCreate) {
223-
warning(false, '`autoFormCreate` is deprecated. please use `form` instead.');
231+
warning(false, 'Form', '`autoFormCreate` is deprecated. please use `form` instead.');
224232
const DomForm =
225233
this.DomForm ||
226234
createDOMForm({

0 commit comments

Comments
 (0)