From e43f6905bef4b6d4c6397d0dae8f7fa29bad7cf5 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Sat, 22 Feb 2020 13:22:24 +0800 Subject: [PATCH] feat: modal add closeIcon support --- build/config.js | 2 +- components/modal/ActionButton.jsx | 5 +- components/modal/ConfirmDialog.jsx | 7 ++- components/modal/Modal.jsx | 71 ++++++++++++++---------- components/modal/__tests__/Modal.test.js | 6 +- components/modal/demo/confirm.md | 2 +- components/modal/demo/manual.md | 2 +- components/modal/index.en-US.md | 49 ++++++++-------- components/modal/index.js | 4 +- components/modal/index.zh-CN.md | 51 ++++++++--------- components/modal/locale.js | 2 +- types/modal.d.ts | 2 + 12 files changed, 113 insertions(+), 90 deletions(-) diff --git a/build/config.js b/build/config.js index 7498a5ca0..6ad118ad5 100644 --- a/build/config.js +++ b/build/config.js @@ -1,5 +1,5 @@ module.exports = { dev: { - componentName: 'message', // dev components + componentName: 'modal', // dev components }, }; diff --git a/components/modal/ActionButton.jsx b/components/modal/ActionButton.jsx index 264214aa8..882a4a0fa 100644 --- a/components/modal/ActionButton.jsx +++ b/components/modal/ActionButton.jsx @@ -48,7 +48,10 @@ export default { // this.setState({ loading: false }); closeModal(...args); }, - () => { + e => { + // Emit error when catch promise reject + // eslint-disable-next-line no-console + console.error(e); // See: https://github.com/ant-design/ant-design/issues/6183 this.setState({ loading: false }); }, diff --git a/components/modal/ConfirmDialog.jsx b/components/modal/ConfirmDialog.jsx index 154a0b3b1..4fd38e848 100644 --- a/components/modal/ConfirmDialog.jsx +++ b/components/modal/ConfirmDialog.jsx @@ -27,6 +27,7 @@ export default { } = props; warning( !('iconType' in props), + 'Modal', `The property 'iconType' is deprecated. Use the property 'icon' instead.`, ); const icon = props.icon ? props.icon : iconType; @@ -92,9 +93,9 @@ export default {