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 ( -
+