From 4cdf37bedbe77dabb871c1129c437fb4c05c43a7 Mon Sep 17 00:00:00 2001 From: zombieJ Date: Wed, 3 Jul 2019 20:14:39 +0800 Subject: [PATCH] feat: New Form (#17327) * init form * first demo * add normal login * add style * webit * support nest errors * beauti form errors * use onReset * modal demo * add list demo * match key of errors logic * date demo * customize component * moving style * add status style * without form create * add demos * add inline style * clean up legacy * fix drawer demo * mention * fix edit-row * editable table cell * update mentions demo * fix some test case * fix upload test * fix lint * part of doc * fix ts * doc update * rm react 15 * rm config * enhance test coverage * clean up * fix FormItem context pass logic * add more demo * en to build * update demo * update demo & snapshot * more doc * update list doc * update doc * update demo to display condition render * update snapshot * add provider doc * support configProvider * more doc about validateMessages * more description * more and more doc * fix typo * en doc * Form.List doc * m v3 -> v4 * add skip --- .circleci/config.yml | 76 - .travis.yml | 18 +- azure-pipelines.yml | 17 - components/_util/__tests__/util.test.js | 3 - components/button/__tests__/index.test.js | 3 - .../__tests__/__snapshots__/demo.test.js.snap | 42 +- .../__snapshots__/components.test.js.snap | 75 +- components/config-provider/index.en-US.md | 1 + components/config-provider/index.tsx | 29 +- components/config-provider/index.zh-CN.md | 1 + components/drawer/demo/form-in-drawer.md | 129 +- components/form-legacy/Form.tsx | 280 - components/form-legacy/FormItem.tsx | 421 -- .../__tests__/__snapshots__/demo.test.js.snap | 5260 ----------------- .../__snapshots__/label.test.js.snap | 149 - .../__snapshots__/message.test.js.snap | 151 - components/form-legacy/__tests__/demo.test.js | 3 - .../form-legacy/__tests__/index.test.js | 45 - .../form-legacy/__tests__/label.test.js | 265 - .../form-legacy/__tests__/message.test.js | 129 - components/form-legacy/__tests__/type.tsx | 91 - components/form-legacy/constants.tsx | 2 - components/form-legacy/context.ts | 16 - .../form-legacy/demo/advanced-search.md | 130 - components/form-legacy/demo/coordinated.md | 73 - .../demo/customized-form-controls.md | 147 - .../form-legacy/demo/dynamic-form-item.md | 144 - components/form-legacy/demo/dynamic-rule.md | 92 - components/form-legacy/demo/form-in-modal.md | 113 - components/form-legacy/demo/global-state.md | 89 - .../form-legacy/demo/horizontal-login.md | 80 - components/form-legacy/demo/layout.md | 72 - components/form-legacy/demo/normal-login.md | 87 - components/form-legacy/demo/register.md | 271 - .../form-legacy/demo/style-check-debug.md | 158 - .../form-legacy/demo/time-related-controls.md | 109 - components/form-legacy/demo/validate-other.md | 217 - .../form-legacy/demo/without-form-create.md | 72 - components/form-legacy/docs/tutorial.md | 98 - components/form-legacy/index.en-US.md | 254 - components/form-legacy/index.tsx | 12 - components/form-legacy/index.zh-CN.md | 256 - components/form-legacy/interface.ts | 89 - components/form-legacy/style/index.less | 681 --- components/form-legacy/style/index.tsx | 5 - components/form-legacy/style/mixin.less | 125 - components/form/Form.tsx | 79 +- components/form/FormItem.tsx | 219 + components/form/FormItemInput.tsx | 110 + components/form/FormItemLabel.tsx | 75 + components/form/FormList.tsx | 33 + .../__tests__/__snapshots__/demo.test.js.snap | 4992 ++++++++++++++++ components/form/__tests__/index.test.js | 126 + components/form/__tests__/type.tsx | 91 - components/form/changelog.md | 5 + components/form/context.tsx | 47 + components/form/demo/advanced-search.md | 129 + components/form/demo/basic.md | 66 + components/form/demo/control-hooks.md | 103 + components/form/demo/control-ref.md | 109 + .../form/demo/customized-form-controls.md | 118 + components/form/demo/dynamic-form-item.md | 123 + components/form/demo/dynamic-rule.md | 92 + components/form/demo/form-context.md | 137 + components/form/demo/form-in-modal.md | 119 + components/form/demo/global-state.md | 82 + components/form/demo/horizontal-login.md | 50 +- components/form/demo/layout.md | 65 + components/form/demo/nest-messages.md | 67 + components/form/demo/normal-login.md | 83 + components/form/demo/register.md | 259 + components/form/demo/time-related-controls.md | 93 + components/form/demo/validate-other.md | 204 + .../demo/validate-static.md | 8 +- components/form/demo/without-form-create.md | 67 + components/form/index.en-US.md | 394 +- components/form/index.tsx | 22 +- components/form/index.zh-CN.md | 387 +- components/form/interface.ts | 1 + components/form/style/components.less | 76 + components/form/style/horizontal.less | 1 + components/form/style/index.less | 446 ++ components/form/style/inline.less | 31 + components/form/style/mixin.less | 124 + components/form/style/vertical.less | 61 + components/form/util.ts | 60 + components/form/v3.en-US.md | 270 + components/form/v3.zh-CN.md | 272 + components/input/__tests__/index.test.js | 39 +- .../__tests__/__snapshots__/demo.test.js.snap | 111 +- components/mention/__tests__/index.test.js | 12 - components/mention/demo/controlled.md | 102 +- .../__tests__/__snapshots__/demo.test.js.snap | 69 +- components/mentions/demo/form.md | 95 +- components/modal/__tests__/confirm.test.js | 20 +- .../__tests__/__snapshots__/demo.test.js.snap | 532 +- components/table/__tests__/demo.test.js | 4 +- components/table/demo/edit-cell.md | 151 +- components/table/demo/edit-row.md | 314 +- components/tabs/__tests__/demo.test.js | 2 +- components/upload/__tests__/upload.test.js | 61 +- .../upload/__tests__/uploadlist.test.js | 88 +- netlify.toml | 4 - package.json | 4 +- scripts/install-react.sh | 7 - site/bisheng.config.js | 1 + site/theme/index.js | 8 + .../template/Content/Demo/CodePreview.jsx | 2 +- site/theme/template/Content/index.jsx | 1 - site/theme/template/utils.jsx | 3 +- tests/__mocks__/rc-trigger.js | 31 +- tests/setup.js | 7 +- typings/custom-typings.d.ts | 4 +- 113 files changed, 10307 insertions(+), 11841 deletions(-) delete mode 100755 components/form-legacy/Form.tsx delete mode 100644 components/form-legacy/FormItem.tsx delete mode 100644 components/form-legacy/__tests__/__snapshots__/demo.test.js.snap delete mode 100644 components/form-legacy/__tests__/__snapshots__/label.test.js.snap delete mode 100644 components/form-legacy/__tests__/__snapshots__/message.test.js.snap delete mode 100644 components/form-legacy/__tests__/demo.test.js delete mode 100644 components/form-legacy/__tests__/index.test.js delete mode 100644 components/form-legacy/__tests__/label.test.js delete mode 100644 components/form-legacy/__tests__/message.test.js delete mode 100644 components/form-legacy/__tests__/type.tsx delete mode 100644 components/form-legacy/constants.tsx delete mode 100644 components/form-legacy/context.ts delete mode 100644 components/form-legacy/demo/advanced-search.md delete mode 100644 components/form-legacy/demo/coordinated.md delete mode 100644 components/form-legacy/demo/customized-form-controls.md delete mode 100644 components/form-legacy/demo/dynamic-form-item.md delete mode 100644 components/form-legacy/demo/dynamic-rule.md delete mode 100644 components/form-legacy/demo/form-in-modal.md delete mode 100644 components/form-legacy/demo/global-state.md delete mode 100644 components/form-legacy/demo/horizontal-login.md delete mode 100644 components/form-legacy/demo/layout.md delete mode 100644 components/form-legacy/demo/normal-login.md delete mode 100644 components/form-legacy/demo/register.md delete mode 100644 components/form-legacy/demo/style-check-debug.md delete mode 100644 components/form-legacy/demo/time-related-controls.md delete mode 100644 components/form-legacy/demo/validate-other.md delete mode 100644 components/form-legacy/demo/without-form-create.md delete mode 100644 components/form-legacy/docs/tutorial.md delete mode 100644 components/form-legacy/index.en-US.md delete mode 100644 components/form-legacy/index.tsx delete mode 100644 components/form-legacy/index.zh-CN.md delete mode 100644 components/form-legacy/interface.ts delete mode 100644 components/form-legacy/style/index.less delete mode 100644 components/form-legacy/style/index.tsx delete mode 100644 components/form-legacy/style/mixin.less create mode 100644 components/form/FormItem.tsx create mode 100644 components/form/FormItemInput.tsx create mode 100644 components/form/FormItemLabel.tsx create mode 100644 components/form/FormList.tsx create mode 100644 components/form/__tests__/__snapshots__/demo.test.js.snap create mode 100644 components/form/__tests__/index.test.js delete mode 100644 components/form/__tests__/type.tsx create mode 100644 components/form/changelog.md create mode 100644 components/form/context.tsx create mode 100644 components/form/demo/advanced-search.md create mode 100644 components/form/demo/basic.md create mode 100644 components/form/demo/control-hooks.md create mode 100644 components/form/demo/control-ref.md create mode 100644 components/form/demo/customized-form-controls.md create mode 100644 components/form/demo/dynamic-form-item.md create mode 100644 components/form/demo/dynamic-rule.md create mode 100644 components/form/demo/form-context.md create mode 100644 components/form/demo/form-in-modal.md create mode 100644 components/form/demo/global-state.md create mode 100644 components/form/demo/layout.md create mode 100644 components/form/demo/nest-messages.md create mode 100644 components/form/demo/normal-login.md create mode 100644 components/form/demo/register.md create mode 100644 components/form/demo/time-related-controls.md create mode 100644 components/form/demo/validate-other.md rename components/{form-legacy => form}/demo/validate-static.md (95%) create mode 100644 components/form/demo/without-form-create.md create mode 100644 components/form/interface.ts create mode 100644 components/form/style/components.less create mode 100644 components/form/style/horizontal.less create mode 100644 components/form/style/inline.less create mode 100644 components/form/style/vertical.less create mode 100644 components/form/util.ts create mode 100644 components/form/v3.en-US.md create mode 100644 components/form/v3.zh-CN.md delete mode 100755 scripts/install-react.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 0372834b02..33dfb660fd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,13 +10,6 @@ references: attach_workspace: at: ~/ant-design - install_react: &install_react - run: REACT=15 ./scripts/install-react.sh - - react_15: &react_15 - environment: - REACT: 15 - react_16: &react_16 environment: REACT: 16 @@ -51,21 +44,6 @@ references: - test_node: requires: - setup - - test_dist_15: - requires: - - dist - - test_lib_15: - requires: - - compile - - test_es_15: - requires: - - compile - - test_dom_15: - requires: - - setup - - test_node_15: - requires: - - setup jobs: setup: @@ -169,60 +147,6 @@ jobs: - *attach_workspace - run: npm run test-node -- -w 1 - test_dist_15: - <<: *container_config - <<: *react_15 - steps: - - checkout - - *attach_workspace - - *install_react - - run: - command: npm test -- -w 1 -u - environment: - LIB_DIR: dist - - test_lib_15: - <<: *container_config - <<: *react_15 - steps: - - checkout - - *attach_workspace - - *install_react - - run: - command: npm test -- -w 1 -u - environment: - LIB_DIR: lib - - test_es_15: - <<: *container_config - <<: *react_15 - steps: - - checkout - - *attach_workspace - - *install_react - - run: - command: npm test -- -w 1 -u - environment: - LIB_DIR: es - - test_dom_15: - <<: *container_config - <<: *react_15 - steps: - - checkout - - *attach_workspace - - *install_react - - run: npm test -- -w 1 -u - - test_node_15: - <<: *container_config - <<: *react_15 - steps: - - checkout - - *attach_workspace - - *install_react - - run: npm run test-node -- -w 1 -u - workflows: version: 2 build_test: diff --git a/.travis.yml b/.travis.yml index 1254d66280..30d62bdbb2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,19 +13,11 @@ matrix: fast_finish: true include: - env: TEST_TYPE=lint - - env: REACT=16 TEST_TYPE=test:dist - - env: REACT=16 TEST_TYPE=test:lib - - env: REACT=16 TEST_TYPE=test:es - - env: REACT=16 TEST_TYPE=test:dom - - env: REACT=16 TEST_TYPE=test:node - - env: REACT=15 TEST_TYPE=test:dist - - env: REACT=15 TEST_TYPE=test:lib - - env: REACT=15 TEST_TYPE=test:es - - env: REACT=15 TEST_TYPE=test:dom - - env: REACT=15 TEST_TYPE=test:node - -before_script: - - scripts/install-react.sh + - env: TEST_TYPE=test:dist + - env: TEST_TYPE=test:lib + - env: TEST_TYPE=test:es + - env: TEST_TYPE=test:dom + - env: TEST_TYPE=test:node script: - scripts/travis-script.sh diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2d77d20ca5..260d7b3ca0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -33,21 +33,6 @@ jobs: node-react@16: REACT: 16 TEST_TYPE: test:node - dist-react@15: - REACT: 15 - TEST_TYPE: test:dist - lib-react@15: - REACT: 15 - TEST_TYPE: test:lib - es-react@15: - REACT: 15 - TEST_TYPE: test:es - dom-react@15: - REACT: 15 - TEST_TYPE: test:dom - node-react@15: - REACT: 15 - TEST_TYPE: test:node steps: - checkout: self fetchDepth: 1 @@ -57,8 +42,6 @@ jobs: versionSpec: '10.x' - script: npm install displayName: install - - script: scripts/install-react.sh - displayName: install-react - script: scripts/travis-script.sh displayName: test - task: PublishBuildArtifacts@1 diff --git a/components/_util/__tests__/util.test.js b/components/_util/__tests__/util.test.js index 2f581d8089..a7a263b3b2 100644 --- a/components/_util/__tests__/util.test.js +++ b/components/_util/__tests__/util.test.js @@ -179,9 +179,6 @@ describe('Test utils function', () => { }); it('should not throw when no children', () => { - if (process.env.REACT === '15') { - return; - } expect(() => mount()).not.toThrow(); }); }); diff --git a/components/button/__tests__/index.test.js b/components/button/__tests__/index.test.js index 4dea37683c..d9cd11a56b 100644 --- a/components/button/__tests__/index.test.js +++ b/components/button/__tests__/index.test.js @@ -11,9 +11,6 @@ describe('Button', () => { }); it('mount correctly', () => { - if (process.env.REACT === '15') { - return; - } expect(() => renderer.create()).not.toThrow(); }); diff --git a/components/comment/__tests__/__snapshots__/demo.test.js.snap b/components/comment/__tests__/__snapshots__/demo.test.js.snap index b006039407..e20b6d6e68 100644 --- a/components/comment/__tests__/__snapshots__/demo.test.js.snap +++ b/components/comment/__tests__/__snapshots__/demo.test.js.snap @@ -150,46 +150,38 @@ exports[`renders ./components/comment/demo/editor.md correctly 1`] = ` >
- -