From 7e55bda19706295376e8ed388565cebc48863610 Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Thu, 20 Feb 2025 10:23:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E4=BB=B6size=E5=8F=82=E6=95=B0=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=97=A0=E7=94=A8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/.storybook/preview.tsx | 11 +++++ react-ui/package.json | 10 ++-- react-ui/src/components/CodeSelect/index.tsx | 22 +++++++-- .../src/components/ParameterInput/index.less | 21 +++++++-- .../src/components/ParameterInput/index.tsx | 1 + .../src/components/ResourceSelect/index.tsx | 23 +++++++-- react-ui/src/stories/CodeSelect.stories.tsx | 21 ++++++++- react-ui/src/stories/KFEmpty.stories.tsx | 2 +- .../src/stories/ResourceSelect.stories.tsx | 47 ++++++++++++++----- 9 files changed, 127 insertions(+), 31 deletions(-) diff --git a/react-ui/.storybook/preview.tsx b/react-ui/.storybook/preview.tsx index af81cc5c..61e82aaa 100644 --- a/react-ui/.storybook/preview.tsx +++ b/react-ui/.storybook/preview.tsx @@ -17,14 +17,25 @@ initialize(); const preview: Preview = { parameters: { controls: { + expanded: true, + sort: 'requiredFirst', matchers: { color: /(background|color)$/i, date: /Date$/i, }, }, + backgrounds: { + values: [ + { name: 'Dark', value: '#000' }, + { name: 'Gray', value: '#f9fafb' }, + { name: 'Light', value: '#FFF' }, + ], + default: 'Light', + }, options: { storySort: { method: 'alphabetical', + order: ['Documentation', 'Components'], }, }, }, diff --git a/react-ui/package.json b/react-ui/package.json index c98f0286..818d2144 100644 --- a/react-ui/package.json +++ b/react-ui/package.json @@ -36,12 +36,14 @@ "start:mock": "cross-env REACT_APP_ENV=dev UMI_ENV=dev max dev", "start:pre": "cross-env REACT_APP_ENV=pre UMI_ENV=dev max dev", "start:test": "cross-env REACT_APP_ENV=test MOCK=none UMI_ENV=dev max dev", + "storybook": "storybook dev -p 6006", + "storybook-build": "storybook build", + "storybook-docs": "storybook dev --docs", + "storybook-docs-build": "storybook build --docs", "test": "jest", "test:coverage": "npm run jest -- --coverage", "test:update": "npm run jest -- -u", - "tsc": "tsc --noEmit", - "storybook": "storybook dev -p 6006", - "build-storybook": "storybook build" + "tsc": "tsc --noEmit" }, "lint-staged": { "**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js", @@ -166,4 +168,4 @@ "public" ] } -} \ No newline at end of file +} diff --git a/react-ui/src/components/CodeSelect/index.tsx b/react-ui/src/components/CodeSelect/index.tsx index 242183e1..d2afbb94 100644 --- a/react-ui/src/components/CodeSelect/index.tsx +++ b/react-ui/src/components/CodeSelect/index.tsx @@ -8,15 +8,28 @@ import CodeSelectorModal from '@/components/CodeSelectorModal'; import KFIcon from '@/components/KFIcon'; import { openAntdModal } from '@/utils/modal'; import { Button } from 'antd'; +import classNames from 'classnames'; import ParameterInput, { type ParameterInputProps } from '../ParameterInput'; import './index.less'; -export { requiredValidator, type ParameterInputObject } from '../ParameterInput'; +export { + requiredValidator, + type ParameterInputObject, + type ParameterInputValue, +} from '../ParameterInput'; type CodeSelectProps = ParameterInputProps; /** 代码配置选择表单组件 */ -function CodeSelect({ value, onChange, disabled, ...rest }: CodeSelectProps) { +function CodeSelect({ + value, + size, + disabled, + className, + style, + onChange, + ...rest +}: CodeSelectProps) { const selectResource = () => { const { close } = openAntdModal(CodeSelectorModal, { onOk: (res) => { @@ -47,9 +60,10 @@ function CodeSelect({ value, onChange, disabled, ...rest }: CodeSelectProps) { }; return ( -
+