diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index f4f13a38e..4a9d1f93d 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -19,7 +19,7 @@ - 🔥🔥🔥 [Descriptions](https://antdv.com/components/descriptions/) Display multiple read-only fields in groups. - 🔥🔥🔥 [PageHeader](https://antdv.com/components/page-header/) can be used to declare the topic of the page, display important information about the page that the user is concerned about, and carry the operation items related to the current page. - 🔥🔥🔥 [Result](https://antdv.com/components/result) is used to feedback the processing results of a series of operation tasks. - - 🔥🔥🔥 [NewForm](https://antdv.com/components/n-form) Form components that use v-model for automatic validation are more concise than v-decorator forms. + - 🔥🔥🔥 [FormModel](https://antdv.com/components/form-model) Form components that use v-model for automatic validation are more concise than v-decorator forms. - 🔥 Descriptions supports vertical layout. - 🔥 Progress.Circle supports gradient colors. - 🔥 Progress.Line supports gradient colors. diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index f7c6390cc..f0ba5a49b 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -19,7 +19,7 @@ - 🔥🔥🔥 [Descriptions](https://antdv.com/components/descriptions-cn/) 成组展示多个只读字段。 - 🔥🔥🔥 [PageHeader](https://antdv.com/components/page-header-cn/) 可用于声明页面主题、展示用户所关注的页面重要信息,以及承载与当前页相关的操作项。 - 🔥🔥🔥 [Result](https://antdv.com/components/result) 用于反馈一系列操作任务的处理结果。 - - 🔥🔥🔥 [NewForm](https://antdv.com/components/n-form) 使用 v-model 进行自动校验的表单组件,相较于 v-decorator 形式的表单,更加简洁。 + - 🔥🔥🔥 [FormModel](https://antdv.com/components/form-model) 使用 v-model 进行自动校验的表单组件,相较于 v-decorator 形式的表单,更加简洁。 - 🔥 Descriptions 支持垂直布局。 - 🔥 Progress.Circle 支持渐变色。 - 🔥 Progress.Line 支持渐变色。 diff --git a/antdv-demo b/antdv-demo index a7bf651da..8c9dee7ff 160000 --- a/antdv-demo +++ b/antdv-demo @@ -1 +1 @@ -Subproject commit a7bf651dafd694e8390c57e86eff2a2592000e86 +Subproject commit 8c9dee7ff6a3a18f335fba08073f14178fffb8b0 diff --git a/components/n-form/Form.jsx b/components/form-model/Form.jsx similarity index 94% rename from components/n-form/Form.jsx rename to components/form-model/Form.jsx index 2e2c15edc..e87be7cd3 100755 --- a/components/n-form/Form.jsx +++ b/components/form-model/Form.jsx @@ -46,7 +46,7 @@ export const ValidationRule = { }; const Form = { - name: 'ANForm', + name: 'AFormModel', props: initDefaultProps(FormProps, { layout: 'horizontal', hideRequiredMark: false, @@ -58,7 +58,7 @@ const Form = { }, provide() { return { - FormContext: this, + FormModelContext: this, }; }, inject: { @@ -96,7 +96,7 @@ const Form = { }, resetFields() { if (!this.model) { - warning(false, 'NewForm', 'model is required for resetFields to work.'); + warning(false, 'FormModel', 'model is required for resetFields to work.'); return; } this.fields.forEach(field => { @@ -115,7 +115,7 @@ const Form = { }, validate(callback) { if (!this.model) { - warning(false, 'NewForm', 'model is required for resetFields to work.'); + warning(false, 'FormModel', 'model is required for resetFields to work.'); return; } let promise; @@ -153,7 +153,7 @@ const Form = { props = [].concat(props); const fields = this.fields.filter(field => props.indexOf(field.prop) !== -1); if (!fields.length) { - warning(false, 'NewForm', 'please pass correct props!'); + warning(false, 'FormModel', 'please pass correct props!'); return; } fields.forEach(field => { diff --git a/components/n-form/FormItem.jsx b/components/form-model/FormItem.jsx similarity index 92% rename from components/n-form/FormItem.jsx rename to components/form-model/FormItem.jsx index fd293def6..d8afe3d77 100644 --- a/components/n-form/FormItem.jsx +++ b/components/form-model/FormItem.jsx @@ -62,7 +62,7 @@ export const FormItemProps = { }; export default { - name: 'ANFormItem', + name: 'AFormModelItem', __ANT_NEW_FORM_ITEM: true, mixins: [BaseMixin], props: initDefaultProps(FormItemProps, { @@ -71,12 +71,12 @@ export default { }), provide() { return { - NewFormItemContext: this, + FormModelItemContext: this, }; }, inject: { configProvider: { default: () => ConfigConsumerProps }, - FormContext: { default: () => ({}) }, + FormModelContext: { default: () => ({}) }, }, data() { return { @@ -89,7 +89,7 @@ export default { computed: { fieldValue() { - const model = this.FormContext.model; + const model = this.FormModelContext.model; if (!model || !this.prop) { return; } @@ -121,13 +121,13 @@ export default { }, mounted() { if (this.prop) { - const { addField } = this.FormContext; + const { addField } = this.FormModelContext; addField && addField(this); this.initialValue = cloneDeep(this.fieldValue); } }, beforeDestroy() { - const { removeField } = this.FormContext; + const { removeField } = this.FormModelContext; removeField && removeField(this); }, methods: { @@ -153,13 +153,13 @@ export default { this.validateState = errors ? 'error' : 'success'; this.validateMessage = errors ? errors[0].message : ''; callback(this.validateMessage, invalidFields); - this.FormContext && - this.FormContext.$emit && - this.FormContext.$emit('validate', this.prop, !errors, this.validateMessage || null); + this.FormModelContext && + this.FormModelContext.$emit && + this.FormModelContext.$emit('validate', this.prop, !errors, this.validateMessage || null); }); }, getRules() { - let formRules = this.FormContext.rules; + let formRules = this.FormModelContext.rules; const selfRules = this.rules; const requiredRule = this.required !== undefined ? { required: !!this.required, trigger: 'change' } : []; @@ -198,7 +198,7 @@ export default { resetField() { this.validateState = ''; this.validateMessage = ''; - let model = this.FormContext.model || {}; + let model = this.FormModelContext.model || {}; let value = this.fieldValue; let path = this.prop; if (path.indexOf(':') !== -1) { diff --git a/components/n-form/__tests__/__snapshots__/demo.test.js.snap b/components/form-model/__tests__/__snapshots__/demo.test.js.snap similarity index 79% rename from components/n-form/__tests__/__snapshots__/demo.test.js.snap rename to components/form-model/__tests__/__snapshots__/demo.test.js.snap index 94c017595..82cbde718 100644 --- a/components/n-form/__tests__/__snapshots__/demo.test.js.snap +++ b/components/form-model/__tests__/__snapshots__/demo.test.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`renders ./antdv-demo/docs/n-form/demo/basic.md correctly 1`] = ` +exports[`renders ./antdv-demo/docs/form-model/demo/basic.md correctly 1`] = `
-
-
+
+
-
-
+
+
please select your zone
@@ -20,24 +20,24 @@ exports[`renders ./antdv-demo/docs/n-form/demo/basic.md correctly 1`] = `
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
@@ -79,27 +79,27 @@ exports[`renders ./antdv-demo/docs/n-form/demo/basic.md correctly 1`] = ` `; -exports[`renders ./antdv-demo/docs/n-form/demo/custom-validation.md correctly 1`] = ` +exports[`renders ./antdv-demo/docs/form-model/demo/custom-validation.md correctly 1`] = `
-
-
+
+
-
-
+
+
-
-
+
+
@@ -115,7 +115,7 @@ exports[`renders ./antdv-demo/docs/n-form/demo/custom-validation.md correctly 1` `; -exports[`renders ./antdv-demo/docs/n-form/demo/dynamic-form-item.md correctly 1`] = ` +exports[`renders ./antdv-demo/docs/form-model/demo/dynamic-form-item.md correctly 1`] = `
@@ -134,7 +134,7 @@ exports[`renders ./antdv-demo/docs/n-form/demo/dynamic-form-item.md correctly 1` `; -exports[`renders ./antdv-demo/docs/n-form/demo/horizontal-login.md correctly 1`] = ` +exports[`renders ./antdv-demo/docs/form-model/demo/horizontal-login.md correctly 1`] = `
@@ -160,11 +160,11 @@ exports[`renders ./antdv-demo/docs/n-form/demo/horizontal-login.md correctly 1`] `; -exports[`renders ./antdv-demo/docs/n-form/demo/layout.md correctly 1`] = ` +exports[`renders ./antdv-demo/docs/form-model/demo/layout.md correctly 1`] = `
-
-
+
+
-
-
+
+
-
-
+
+
@@ -202,19 +202,19 @@ exports[`renders ./antdv-demo/docs/n-form/demo/layout.md correctly 1`] = ` `; -exports[`renders ./antdv-demo/docs/n-form/demo/validation.md correctly 1`] = ` +exports[`renders ./antdv-demo/docs/form-model/demo/validation.md correctly 1`] = `
-
-
+
+
-
-
+
+
please select your zone
@@ -222,24 +222,24 @@ exports[`renders ./antdv-demo/docs/n-form/demo/validation.md correctly 1`] = `
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
diff --git a/components/n-form/__tests__/demo.test.js b/components/form-model/__tests__/demo.test.js similarity index 70% rename from components/n-form/__tests__/demo.test.js rename to components/form-model/__tests__/demo.test.js index 8f8e33928..22a74f8a8 100644 --- a/components/n-form/__tests__/demo.test.js +++ b/components/form-model/__tests__/demo.test.js @@ -1,3 +1,3 @@ import demoTest from '../../../tests/shared/demoTest'; -demoTest('n-form'); +demoTest('form-model'); diff --git a/components/n-form/index.jsx b/components/form-model/index.jsx similarity index 100% rename from components/n-form/index.jsx rename to components/form-model/index.jsx diff --git a/components/n-form/style/index.js b/components/form-model/style/index.js similarity index 100% rename from components/n-form/style/index.js rename to components/form-model/style/index.js diff --git a/components/n-form/style/index.less b/components/form-model/style/index.less similarity index 100% rename from components/n-form/style/index.less rename to components/form-model/style/index.less diff --git a/components/n-form/style/mixin.less b/components/form-model/style/mixin.less similarity index 100% rename from components/n-form/style/mixin.less rename to components/form-model/style/mixin.less diff --git a/components/index.js b/components/index.js index 5a1f03384..2afea9c2f 100644 --- a/components/index.js +++ b/components/index.js @@ -56,7 +56,7 @@ import { default as Divider } from './divider'; import { default as Dropdown } from './dropdown'; import { default as Form } from './form'; -import { default as NewForm } from './n-form'; +import { default as FormModel } from './form-model'; import { default as Icon } from './icon'; @@ -167,7 +167,7 @@ const components = [ Divider, Dropdown, Form, - NewForm, + FormModel, Icon, Input, InputNumber, @@ -256,7 +256,7 @@ export { Divider, Dropdown, Form, - NewForm, + FormModel, Icon, Input, InputNumber, diff --git a/components/style.js b/components/style.js index 7ef3a4e5d..b9c6f1ff7 100644 --- a/components/style.js +++ b/components/style.js @@ -59,4 +59,4 @@ import './statistic/style'; import './result/style'; import './descriptions/style'; import './page-header/style'; -import './n-form/style'; +import './form-model/style'; diff --git a/package.json b/package.json index 864fc944c..e6478e102 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ant-design-vue", - "version": "1.5.0-rc.1", + "version": "1.5.0-rc.2", "title": "Ant Design Vue", "description": "An enterprise-class UI design language and Vue-based implementation", "keywords": [ diff --git a/tests/__snapshots__/index.test.js.snap b/tests/__snapshots__/index.test.js.snap index 7e20e436b..a5f701213 100644 --- a/tests/__snapshots__/index.test.js.snap +++ b/tests/__snapshots__/index.test.js.snap @@ -27,7 +27,7 @@ Array [ "Divider", "Dropdown", "Form", - "NewForm", + "FormModel", "Icon", "Input", "InputNumber",