diff --git a/.gitignore b/.gitignore index 10d7d838..2797765a 100644 --- a/.gitignore +++ b/.gitignore @@ -63,3 +63,5 @@ mvnw /react-ui/docs /react-ui/types/tsconfig.tsbuildinfo +/react-ui/storybook-static +/react-ui/.storybook/deploy.sh diff --git a/react-ui/.storybook/babel-plugin-auto-css-modules.js b/react-ui/.storybook/babel-plugin-auto-css-modules.js index 9c7709ff..660744b4 100644 --- a/react-ui/.storybook/babel-plugin-auto-css-modules.js +++ b/react-ui/.storybook/babel-plugin-auto-css-modules.js @@ -4,7 +4,6 @@ export default function(babel) { visitor: { ImportDeclaration(path) { const source = path.node.source.value; - // console.log("zzzz", source); if (source.endsWith('.less')) { if (path.node.specifiers.length > 0) { path.node.source.value += "?modules"; diff --git a/react-ui/.storybook/main.ts b/react-ui/.storybook/main.ts index 1512aa48..c21ab45b 100644 --- a/react-ui/.storybook/main.ts +++ b/react-ui/.storybook/main.ts @@ -16,7 +16,11 @@ const config: StorybookConfig = { name: '@storybook/react-webpack5', options: {}, }, - staticDirs: ['../public', { from: '../docs', to: '/docs' }], + staticDirs: [ + '../public', + { from: '../docs', to: '/docs' }, + { from: '../docs/index.html', to: '/docs/index.html' }, + ], docs: { defaultName: 'Documentation', }, diff --git a/react-ui/package.json b/react-ui/package.json index 2c7b13a1..c49cda16 100644 --- a/react-ui/package.json +++ b/react-ui/package.json @@ -40,6 +40,7 @@ "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-deploy": "./.storybook/deploy.sh", "storybook-docs": "storybook dev --docs", "storybook-docs-build": "storybook build --docs", "test": "jest", diff --git a/react-ui/public/fonts/TaoBaoMaiCaiTi-Regular.otf b/react-ui/public/fonts/TaoBaoMaiCaiTi-Regular.otf deleted file mode 100644 index 21ba9622..00000000 Binary files a/react-ui/public/fonts/TaoBaoMaiCaiTi-Regular.otf and /dev/null differ diff --git a/react-ui/public/fonts/TaoBaoMaiCaiTi-Regular.ttf b/react-ui/public/fonts/TaoBaoMaiCaiTi-Regular.ttf deleted file mode 100644 index 31ab5e30..00000000 Binary files a/react-ui/public/fonts/TaoBaoMaiCaiTi-Regular.ttf and /dev/null differ diff --git a/react-ui/public/fonts/TaoBaoMaiCaiTi-Regular.woff b/react-ui/public/fonts/TaoBaoMaiCaiTi-Regular.woff deleted file mode 100644 index 0abc0f0e..00000000 Binary files a/react-ui/public/fonts/TaoBaoMaiCaiTi-Regular.woff and /dev/null differ diff --git a/react-ui/public/fonts/TaoBaoMaiCaiTi-Regular.woff2 b/react-ui/public/fonts/TaoBaoMaiCaiTi-Regular.woff2 deleted file mode 100644 index f4433e2e..00000000 Binary files a/react-ui/public/fonts/TaoBaoMaiCaiTi-Regular.woff2 and /dev/null differ diff --git a/react-ui/src/components/IFramePage/index.tsx b/react-ui/src/components/IFramePage/index.tsx index b57869d3..cd08c7b7 100644 --- a/react-ui/src/components/IFramePage/index.tsx +++ b/react-ui/src/components/IFramePage/index.tsx @@ -44,7 +44,7 @@ type IframePageProps = { /** 子系统 */ type: IframePageType; /** 是否可以在页签上打开 */ - openInTab: boolean; + openInTab?: boolean; /** 自定义样式类名 */ className?: string; /** 自定义样式 */ diff --git a/react-ui/src/stories/FullScreenFrame.stories.tsx b/react-ui/src/stories/FullScreenFrame.stories.tsx index 74dae50a..93ce8891 100644 --- a/react-ui/src/stories/FullScreenFrame.stories.tsx +++ b/react-ui/src/stories/FullScreenFrame.stories.tsx @@ -4,7 +4,7 @@ import { fn } from '@storybook/test'; // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export const meta = { - title: 'Components/FullScreenFrame 全屏iframe', + title: 'Components/FullScreenFrame 全屏 iframe', component: FullScreenFrame, parameters: { // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout diff --git a/react-ui/src/stories/IFramePage.stories.tsx b/react-ui/src/stories/IFramePage.stories.tsx index d5c6725b..2b40330f 100644 --- a/react-ui/src/stories/IFramePage.stories.tsx +++ b/react-ui/src/stories/IFramePage.stories.tsx @@ -3,7 +3,7 @@ import type { Meta, StoryObj } from '@storybook/react'; // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export const meta = { - title: 'Components/IFramePage iframe页面', + title: 'Components/IFramePage iframe 页面', component: IFramePage, parameters: { // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout diff --git a/react-ui/src/utils/functional.ts b/react-ui/src/utils/functional.ts index 6128c897..0c806998 100644 --- a/react-ui/src/utils/functional.ts +++ b/react-ui/src/utils/functional.ts @@ -5,14 +5,10 @@ */ /** - * Safely invokes a function with a given value, returning the result of the - * function or the provided value if it is `undefined` or `null`. + * 安全调用函数,如果参数是 `undefined` 或 `null`,直接返回 `undefined` 或 `null`,而不会导致异常 * - * @template T - The type of the input value. - * @template M - The type of the output value. - * @param {function} fn - The function to be invoked with the input value. - * @returns {function} A function that takes a value, invokes `fn` with it if - * it's not `undefined` or `null`, and returns the result or the original value. + * @param fn - 要调用的函数 + * @returns 封装后的函数,该函数的参数如果是 `undefined` 或 `null`,结果直接返回 `undefined` 或 `null`,而不会导致异常 */ export function safeInvoke( fn: (value: T) => M | undefined | null,