From 29629111840bd68a142b4f49e083ba2a23e97355 Mon Sep 17 00:00:00 2001 From: LuckyFBB <38368040+LuckyFBB@users.noreply.github.com> Date: Fri, 30 Dec 2022 11:47:32 +0800 Subject: [PATCH 1/4] feat: update blockHeader margin-bottom (#281) --- .../blockHeader/__tests__/blockHeader.test.tsx | 14 ++++++++++++++ src/components/blockHeader/index.tsx | 9 ++++++++- src/stories/blockHeader.stories.tsx | 14 ++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/components/blockHeader/__tests__/blockHeader.test.tsx b/src/components/blockHeader/__tests__/blockHeader.test.tsx index 4b4b2af73..123d0733b 100644 --- a/src/components/blockHeader/__tests__/blockHeader.test.tsx +++ b/src/components/blockHeader/__tests__/blockHeader.test.tsx @@ -121,4 +121,18 @@ describe('test BlockHeader render', () => { const titleBoxWrap1 = container1.firstChild.firstChild.firstChild; expect(titleBoxWrap1.childNodes.length).toEqual(3); }); + test('should render BlockHeader correct margin-bottom', () => { + const { container: noStyle } = render(); + expect(noStyle.querySelector('.dtc-block-header')).not.toHaveAttribute('style'); + const { container: defaultBottom } = render( + + ); + expect(defaultBottom.querySelector('.dtc-block-header')).toHaveStyle({ marginBottom: 16 }); + const { container: customizeBottom } = render( + + ); + expect(customizeBottom.querySelector('.dtc-block-header')).toHaveStyle({ + marginBottom: 10, + }); + }); }); diff --git a/src/components/blockHeader/index.tsx b/src/components/blockHeader/index.tsx index 19ae06769..7e1e8a47a 100644 --- a/src/components/blockHeader/index.tsx +++ b/src/components/blockHeader/index.tsx @@ -19,6 +19,8 @@ export interface BlockHeaderProps { * 默认 false */ isSmall?: boolean; + hasBottom?: boolean; + spaceBottom?: number; // 标题一行的样式类名 titleRowClassName?: string; // 标题的样式类名 @@ -38,6 +40,8 @@ const BlockHeader: React.FC = function (props) { afterTitle = '', tooltip = '', isSmall = false, + hasBottom = false, + spaceBottom = 0, titleRowClassName = '', titleClassName = '', showBackground = true, @@ -53,6 +57,9 @@ const BlockHeader: React.FC = function (props) { ); const newAfterTitle = afterTitle || questionTooltip; + let bottomStyle; + if (hasBottom) bottomStyle = { marginBottom: 16 }; + if (spaceBottom) bottomStyle = { marginBottom: spaceBottom }; const [expand, setExpand] = useState(defaultExpand); const handleExpand = (expand) => { @@ -61,7 +68,7 @@ const BlockHeader: React.FC = function (props) { onChange?.(expand); }; return ( -
+
Date: Wed, 11 Jan 2023 13:54:39 +0800 Subject: [PATCH 2/4] fix: fix ModalProps for modalWithForm (#283) * fix: fix ModalProps for modalWithForm * feat: update React.ReactNode | string to React.ReactNode --- src/components/modalWithForm/index.tsx | 4 ++-- src/components/renderFormItem/index.tsx | 2 +- src/components/textMark/index.tsx | 2 +- src/components/toolModal/index.tsx | 2 +- src/stories/modalWithForm.stories.tsx | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/modalWithForm/index.tsx b/src/components/modalWithForm/index.tsx index 61c4426c0..3cda8151b 100644 --- a/src/components/modalWithForm/index.tsx +++ b/src/components/modalWithForm/index.tsx @@ -9,7 +9,7 @@ export interface IProps { okType?: ButtonType; record?: string | number | object; visible?: boolean; - title?: React.ReactNode | string; + title?: React.ReactNode; width?: string | number; modelClass?: string; footer?: React.ReactNode; @@ -26,7 +26,7 @@ export interface IProps { maskClosable?: boolean; } -type ModalProps = IProps & FormProps; +type ModalProps = IProps & Omit; export const FORM_PROPS = [ 'colon', diff --git a/src/components/renderFormItem/index.tsx b/src/components/renderFormItem/index.tsx index f0ac55af2..02e8c26a8 100644 --- a/src/components/renderFormItem/index.tsx +++ b/src/components/renderFormItem/index.tsx @@ -10,7 +10,7 @@ interface ItemType { key: string | number | (string | number)[]; required?: boolean; component?: React.ReactNode; - tooltip?: React.ReactNode | string; + tooltip?: React.ReactNode; extra?: React.ReactNode; options?: { className?: string; diff --git a/src/components/textMark/index.tsx b/src/components/textMark/index.tsx index 6bc5a7eb5..224830017 100644 --- a/src/components/textMark/index.tsx +++ b/src/components/textMark/index.tsx @@ -7,7 +7,7 @@ export interface TextMarkProps { [propName: string]: any; } class TextMark extends React.Component { - renderMark(text = '', markText = ''): React.ReactNode | string { + renderMark(text = '', markText = ''): React.ReactNode { const markTextIndex = text.indexOf(markText); if (markTextIndex !== -1) { return ( diff --git a/src/components/toolModal/index.tsx b/src/components/toolModal/index.tsx index 942342bbd..5f7b56219 100644 --- a/src/components/toolModal/index.tsx +++ b/src/components/toolModal/index.tsx @@ -5,7 +5,7 @@ import Fullscreen from '../fullscreen'; export interface ToolModalProps { visible: boolean; - toolbox?: React.ReactNode | string; + toolbox?: React.ReactNode; fullscreen?: boolean | undefined; [propName: string]: any; } diff --git a/src/stories/modalWithForm.stories.tsx b/src/stories/modalWithForm.stories.tsx index cd1d7c139..af5c7f9af 100644 --- a/src/stories/modalWithForm.stories.tsx +++ b/src/stories/modalWithForm.stories.tsx @@ -60,7 +60,7 @@ const propDefinitions = [ }, { property: 'title', - propType: 'React.ReactNode | string', + propType: 'React.ReactNode', required: false, description: '标题', defaultValue: '--', From 6f3fca7f9297973daf2931486b687c77ebb49125 Mon Sep 17 00:00:00 2001 From: mumiao <1270865802zl@gmail.com> Date: Wed, 11 Jan 2023 14:09:45 +0800 Subject: [PATCH 3/4] chore(release): 3.1.0 --- CHANGELOG.md | 12 ++++++++++++ package.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b8c210f3..ae088f3d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [3.1.0](https://github.com/DTStack/dt-react-component/compare/v3.0.7...v3.1.0) (2023-01-11) + + +### Features + +* update blockHeader margin-bottom ([#281](https://github.com/DTStack/dt-react-component/issues/281)) ([2962911](https://github.com/DTStack/dt-react-component/commit/29629111840bd68a142b4f49e083ba2a23e97355)) + + +### Bug Fixes + +* fix ModalProps for modalWithForm ([#283](https://github.com/DTStack/dt-react-component/issues/283)) ([f0c813a](https://github.com/DTStack/dt-react-component/commit/f0c813a306dc2cadd495ce15cae7b4328b155ad4)) + ### [3.0.7](https://github.com/DTStack/dt-react-component/compare/v3.0.6...v3.0.7) (2022-12-16) diff --git a/package.json b/package.json index 9b512c90e..c496a81d6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dt-react-component", - "version": "3.0.7", + "version": "3.1.0", "description": "react-component", "repository": "https://github.com/DTStack/dt-react-component", "sideEffects": [ From abc0627f13d4cd3529b9f40391895ac7f5608f93 Mon Sep 17 00:00:00 2001 From: mumiao <1270865802zl@gmail.com> Date: Wed, 11 Jan 2023 14:14:57 +0800 Subject: [PATCH 4/4] chore(release): 3.0.8 --- CHANGELOG.md | 12 ++++++++++++ package.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae088f3d1..9a7473226 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [3.0.8](https://github.com/DTStack/dt-react-component/compare/v3.0.7...v3.0.8) (2023-01-11) + + +### Features + +* update blockHeader margin-bottom ([#281](https://github.com/DTStack/dt-react-component/issues/281)) ([2962911](https://github.com/DTStack/dt-react-component/commit/29629111840bd68a142b4f49e083ba2a23e97355)) + + +### Bug Fixes + +* fix ModalProps for modalWithForm ([#283](https://github.com/DTStack/dt-react-component/issues/283)) ([f0c813a](https://github.com/DTStack/dt-react-component/commit/f0c813a306dc2cadd495ce15cae7b4328b155ad4)) + ## [3.1.0](https://github.com/DTStack/dt-react-component/compare/v3.0.7...v3.1.0) (2023-01-11) diff --git a/package.json b/package.json index c496a81d6..6a762beaf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dt-react-component", - "version": "3.1.0", + "version": "3.0.8", "description": "react-component", "repository": "https://github.com/DTStack/dt-react-component", "sideEffects": [