From f4afbf142373b8443e4cd9a30eea2c7c12e8eb5f Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Sun, 7 Apr 2024 14:03:22 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/.eslintrc.js | 4 +- react-ui/package.json | 28 +- react-ui/src/components/DictTag/index.tsx | 160 +-- .../src/components/HeaderDropdown/index.tsx | 4 +- .../src/components/IconSelector/Category.tsx | 19 +- .../components/IconSelector/CopyableIcon.tsx | 17 +- .../IconSelector/IconPicSearcher.tsx | 57 +- .../src/components/IconSelector/fields.ts | 4 +- .../src/components/IconSelector/index.tsx | 32 +- .../components/IconSelector/themeIcons.tsx | 7 +- .../RightContent/AvatarDropdown.tsx | 10 +- react-ui/src/enums/pagesEnums.ts | 5 +- react-ui/src/enums/status.d.ts | 1 - react-ui/src/global.less | 56 +- react-ui/src/locales/en-US/app.ts | 48 +- react-ui/src/locales/zh-CN.ts | 24 +- react-ui/src/locales/zh-CN/monitor/job-log.ts | 20 +- react-ui/src/locales/zh-CN/monitor/job.ts | 34 +- .../src/locales/zh-CN/monitor/logininfor.ts | 22 +- .../src/locales/zh-CN/monitor/onlineUser.ts | 3 +- react-ui/src/locales/zh-CN/monitor/operlog.ts | 34 +- react-ui/src/locales/zh-CN/monitor/server.ts | 3 +- react-ui/src/locales/zh-CN/system/config.ts | 24 +- react-ui/src/locales/zh-CN/system/dept.ts | 32 +- react-ui/src/locales/zh-CN/system/menu.ts | 40 +- react-ui/src/locales/zh-CN/system/notice.ts | 22 +- react-ui/src/locales/zh-CN/system/post.ts | 22 +- react-ui/src/locales/zh-CN/system/role.ts | 38 +- react-ui/src/locales/zh-CN/system/user.ts | 58 +- react-ui/src/pages/Dataset/index.jsx | 116 +- react-ui/src/pages/Dataset/personalData.jsx | 572 ++++---- react-ui/src/pages/Dataset/publicData.jsx | 363 ++--- .../experimentText/editPipeline.less | 78 +- .../pages/Experiment/experimentText/props.jsx | 7 +- react-ui/src/pages/Monitor/Job/detail.tsx | 10 +- react-ui/src/pages/Monitor/Job/edit.tsx | 47 +- react-ui/src/pages/Monitor/Job/index.tsx | 60 +- react-ui/src/pages/Monitor/JobLog/detail.tsx | 13 +- react-ui/src/pages/Monitor/JobLog/index.tsx | 40 +- react-ui/src/pages/Monitor/Online/index.tsx | 66 +- .../Pipeline/editPipeline/editPipeline.less | 50 +- .../src/pages/Pipeline/editPipeline/index.jsx | 1255 +++++++++-------- .../Pipeline/editPipeline/modelMenus.jsx | 132 +- .../Pipeline/editPipeline/modelMenus.less | 78 +- .../src/pages/Pipeline/editPipeline/props.jsx | 270 ++-- react-ui/src/pages/Pipeline/index.less | 116 +- react-ui/src/pages/System/Config/edit.tsx | 53 +- react-ui/src/pages/System/Config/index.tsx | 42 +- react-ui/src/pages/System/Dept/edit.tsx | 17 +- react-ui/src/pages/System/Dept/index.tsx | 47 +- react-ui/src/pages/System/Dict/edit.tsx | 35 +- react-ui/src/pages/System/Dict/index.tsx | 42 +- react-ui/src/pages/System/DictData/edit.tsx | 31 +- react-ui/src/pages/System/DictData/index.tsx | 61 +- react-ui/src/pages/System/Logininfor/edit.tsx | 62 +- .../src/pages/System/Logininfor/index.tsx | 41 +- react-ui/src/pages/System/Menu/edit.tsx | 54 +- react-ui/src/pages/System/Menu/index.tsx | 37 +- react-ui/src/pages/System/Notice/edit.tsx | 57 +- react-ui/src/pages/System/Notice/index.tsx | 48 +- react-ui/src/pages/System/Operlog/detail.tsx | 11 +- react-ui/src/pages/System/Operlog/index.tsx | 41 +- react-ui/src/pages/System/Post/edit.tsx | 53 +- react-ui/src/pages/System/Post/index.tsx | 36 +- react-ui/src/pages/System/Role/authUser.tsx | 505 +++---- .../System/Role/components/DataScope.tsx | 418 +++--- .../Role/components/UserSelectorModal.tsx | 26 +- react-ui/src/pages/System/Role/edit.tsx | 28 +- react-ui/src/pages/System/Role/index.tsx | 88 +- .../pages/System/User/components/AuthRole.tsx | 122 +- .../pages/System/User/components/DeptTree.tsx | 7 +- .../pages/System/User/components/ResetPwd.tsx | 10 +- react-ui/src/pages/System/User/edit.tsx | 42 +- react-ui/src/pages/System/User/index.tsx | 108 +- .../pages/Tool/Gen/components/BaseInfo.tsx | 11 +- .../pages/Tool/Gen/components/ColumnInfo.tsx | 8 +- .../src/pages/Tool/Gen/components/GenInfo.tsx | 12 +- .../pages/Tool/Gen/components/PreviewCode.tsx | 14 +- react-ui/src/pages/Tool/Gen/edit.tsx | 40 +- react-ui/src/pages/Tool/Gen/import.tsx | 10 +- react-ui/src/pages/Tool/Gen/index.tsx | 24 +- react-ui/src/pages/Tool/Gen/service.ts | 4 +- react-ui/src/pages/User/Center/Center.less | 7 +- .../components/AvatarCropper/index.less | 18 +- .../Center/components/AvatarCropper/index.tsx | 14 +- .../User/Center/components/BaseInfo/index.tsx | 9 +- .../Center/components/ResetPassword/index.tsx | 102 +- react-ui/src/pages/User/Login/index.tsx | 573 ++++---- react-ui/src/pages/User/Login/login.less | 49 +- react-ui/src/pages/User/Settings/index.tsx | 1 - .../src/services/ant-design-pro/typings.d.ts | 2 +- react-ui/src/services/dataset/index.js | 85 +- .../services/developmentEnvironment/index.js | 12 +- react-ui/src/services/experiment/index.js | 6 +- react-ui/src/services/monitor/cache.ts | 6 +- react-ui/src/services/monitor/cachelist.ts | 34 +- react-ui/src/services/monitor/job.ts | 18 +- react-ui/src/services/monitor/jobLog.ts | 19 +- react-ui/src/services/monitor/logininfor.ts | 20 +- react-ui/src/services/monitor/online.ts | 6 +- react-ui/src/services/monitor/operlog.ts | 12 +- react-ui/src/services/monitor/server.ts | 5 +- react-ui/src/services/pipeline/index.js | 75 +- react-ui/src/services/system/config.ts | 21 +- react-ui/src/services/system/dept.ts | 16 +- react-ui/src/services/system/dict.ts | 24 +- react-ui/src/services/system/dictdata.ts | 5 +- react-ui/src/services/system/index.ts | 2 +- react-ui/src/services/system/menu.ts | 19 +- react-ui/src/services/system/notice.ts | 16 +- react-ui/src/services/system/post.ts | 16 +- react-ui/src/services/system/role.ts | 46 +- react-ui/src/services/system/user.ts | 62 +- react-ui/src/types/monitor/cache.d.ts | 7 +- react-ui/src/types/monitor/cacheList.d.ts | 7 +- react-ui/src/types/monitor/job.d.ts | 12 +- react-ui/src/types/monitor/jobLog.d.ts | 12 +- react-ui/src/types/monitor/logininfor.d.ts | 11 +- react-ui/src/types/monitor/online.d.ts | 11 +- react-ui/src/types/monitor/operlog.d.ts | 11 +- react-ui/src/types/monitor/server.d.ts | 8 +- react-ui/src/types/system/config.d.ts | 11 +- react-ui/src/types/system/dept.d.ts | 11 +- react-ui/src/types/system/menu.d.ts | 11 +- react-ui/src/types/system/notice.d.ts | 11 +- react-ui/src/types/system/post.d.ts | 11 +- react-ui/src/types/system/role.d.ts | 17 +- react-ui/src/types/system/user.d.ts | 11 +- react-ui/src/utils/downloadfile.ts | 3 +- react-ui/src/utils/index.js | 20 +- react-ui/src/utils/options.ts | 22 +- 131 files changed, 4117 insertions(+), 3736 deletions(-) diff --git a/react-ui/.eslintrc.js b/react-ui/.eslintrc.js index ad3e7590..564a28d2 100644 --- a/react-ui/.eslintrc.js +++ b/react-ui/.eslintrc.js @@ -5,6 +5,6 @@ module.exports = { REACT_APP_ENV: true, }, rules: { - "@typescript-eslint/no-use-before-define": "off" - } + '@typescript-eslint/no-use-before-define': 'off', + }, }; diff --git a/react-ui/package.json b/react-ui/package.json index 0a55edde..a3ad6812 100644 --- a/react-ui/package.json +++ b/react-ui/package.json @@ -4,19 +4,10 @@ "private": true, "description": "An out-of-box UI solution for enterprise applications", "scripts": { - "dev": "npm run start:dev", + "analyze": "cross-env ANALYZE=1 max build", "build": "max build", "deploy": "npm run build && npm run gh-pages", - "preview": "npm run build && max preview --port 8000", - "serve": "umi-serve", - "start": "cross-env UMI_ENV=dev max dev", - "start:dev": "cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev max dev", - "start:no-mock": "cross-env MOCK=none 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", - "test": "jest", - "test:coverage": "npm run jest -- --coverage", - "test:update": "npm run jest -- -u", + "dev": "npm run start:dev", "docker-hub:build": "docker build -f Dockerfile.hub -t ant-design-pro ./", "docker-prod:build": "docker-compose -f ./docker/docker-compose.yml build", "docker-prod:dev": "docker-compose -f ./docker/docker-compose.yml up", @@ -24,7 +15,6 @@ "docker:dev": "docker-compose -f ./docker/docker-compose.dev.yml up", "docker:push": "npm run docker-hub:build && npm run docker:tag && docker push antdesign/ant-design-pro", "docker:tag": "docker tag ant-design-pro antdesign/ant-design-pro", - "analyze": "cross-env ANALYZE=1 max build", "gh-pages": "gh-pages -d dist", "i18n-remove": "pro i18n-remove --locale=zh-CN --write", "postinstall": "max setup", @@ -38,8 +28,18 @@ "openapi": "max openapi", "prepare": "cd .. && husky install", "prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\"", - "tsc": "tsc --noEmit", - "record": "cross-env NODE_ENV=development REACT_APP_ENV=test max record --scene=login" + "preview": "npm run build && max preview --port 8000", + "record": "cross-env NODE_ENV=development REACT_APP_ENV=test max record --scene=login", + "serve": "umi-serve", + "start": "cross-env UMI_ENV=dev max dev", + "start:dev": "cross-env REACT_APP_ENV=dev MOCK=none UMI_ENV=dev max dev", + "start:no-mock": "cross-env MOCK=none 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", + "test": "jest", + "test:coverage": "npm run jest -- --coverage", + "test:update": "npm run jest -- -u", + "tsc": "tsc --noEmit" }, "lint-staged": { "**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js", diff --git a/react-ui/src/components/DictTag/index.tsx b/react-ui/src/components/DictTag/index.tsx index 2b2a7910..cd5bce07 100644 --- a/react-ui/src/components/DictTag/index.tsx +++ b/react-ui/src/components/DictTag/index.tsx @@ -1,7 +1,7 @@ -import React from 'react'; -import { Tag } from 'antd'; import { ProSchemaValueEnumType } from '@ant-design/pro-components'; +import { Tag } from 'antd'; import { DefaultOptionType } from 'antd/es/select'; +import React from 'react'; /* * * @@ -11,105 +11,101 @@ import { DefaultOptionType } from 'antd/es/select'; * */ export interface DictValueEnumType extends ProSchemaValueEnumType { - id?: string | number; - key?: string | number; - value: string | number; - label: string; - listClass?: string; + id?: string | number; + key?: string | number; + value: string | number; + label: string; + listClass?: string; } export interface DictOptionType extends DefaultOptionType { - id?: string | number; - key?: string | number; - text: string; - listClass?: string; + id?: string | number; + key?: string | number; + text: string; + listClass?: string; } - export type DictValueEnumObj = Record; export type DictTagProps = { - key?: string; - value?: string | number; - enums?: DictValueEnumObj; - options?: DictOptionType[]; + key?: string; + value?: string | number; + enums?: DictValueEnumObj; + options?: DictOptionType[]; }; const DictTag: React.FC = (props) => { - function getDictColor(type?: string) { - switch (type) { - case 'primary': - return 'blue'; - case 'success': - return 'success'; - case 'info': - return 'green'; - case 'warning': - return 'warning'; - case 'danger': - return 'error'; - case 'default': - default: - return 'default'; - } + function getDictColor(type?: string) { + switch (type) { + case 'primary': + return 'blue'; + case 'success': + return 'success'; + case 'info': + return 'green'; + case 'warning': + return 'warning'; + case 'danger': + return 'error'; + case 'default': + default: + return 'default'; } + } - function getDictLabelByValue(value: string | number | undefined): string { - if (value === undefined) { - return ''; - } - if (props.enums) { - const item = props.enums[value]; - return item.label; - } - if (props.options) { - if (!Array.isArray(props.options)) { - console.log('DictTag options is no array!') - return ''; - } - for (const item of props.options) { - if (item.value === value) { - return item.text; - } - } + function getDictLabelByValue(value: string | number | undefined): string { + if (value === undefined) { + return ''; + } + if (props.enums) { + const item = props.enums[value]; + return item.label; + } + if (props.options) { + if (!Array.isArray(props.options)) { + console.log('DictTag options is no array!'); + return ''; + } + for (const item of props.options) { + if (item.value === value) { + return item.text; } - return String(props.value); + } } + return String(props.value); + } - function getDictListClassByValue(value: string | number | undefined): string { - if (value === undefined) { - return 'default'; - } - if (props.enums) { - const item = props.enums[value]; - return item.listClass || 'default'; - } - if (props.options) { - if (!Array.isArray(props.options)) { - console.log('DictTag options is no array!') - return 'default'; - } - for (const item of props.options) { - if (item.value === value) { - return item.listClass || 'default'; - } - } + function getDictListClassByValue(value: string | number | undefined): string { + if (value === undefined) { + return 'default'; + } + if (props.enums) { + const item = props.enums[value]; + return item.listClass || 'default'; + } + if (props.options) { + if (!Array.isArray(props.options)) { + console.log('DictTag options is no array!'); + return 'default'; + } + for (const item of props.options) { + if (item.value === value) { + return item.listClass || 'default'; } - return String(props.value); + } } + return String(props.value); + } - const getTagColor = () => { - return getDictColor(getDictListClassByValue(props.value).toLowerCase()); - }; - - const getTagText = (): string => { - return getDictLabelByValue(props.value); - }; + const getTagColor = () => { + return getDictColor(getDictListClassByValue(props.value).toLowerCase()); + }; - return ( - {getTagText()} - ) -} + const getTagText = (): string => { + return getDictLabelByValue(props.value); + }; + return {getTagText()}; +}; -export default DictTag; \ No newline at end of file +export default DictTag; diff --git a/react-ui/src/components/HeaderDropdown/index.tsx b/react-ui/src/components/HeaderDropdown/index.tsx index 8474be51..ae560fd2 100644 --- a/react-ui/src/components/HeaderDropdown/index.tsx +++ b/react-ui/src/components/HeaderDropdown/index.tsx @@ -1,8 +1,8 @@ +import { useEmotionCss } from '@ant-design/use-emotion-css'; import { Dropdown } from 'antd'; import type { DropDownProps } from 'antd/es/dropdown'; -import React from 'react'; -import { useEmotionCss } from '@ant-design/use-emotion-css'; import classNames from 'classnames'; +import React from 'react'; export type HeaderDropdownProps = { overlayClassName?: string; diff --git a/react-ui/src/components/IconSelector/Category.tsx b/react-ui/src/components/IconSelector/Category.tsx index dd0e93f7..5f683276 100644 --- a/react-ui/src/components/IconSelector/Category.tsx +++ b/react-ui/src/components/IconSelector/Category.tsx @@ -1,8 +1,8 @@ +import { useIntl } from '@umijs/max'; import * as React from 'react'; import CopyableIcon from './CopyableIcon'; -import type { ThemeType } from './index'; import type { CategoriesKeys } from './fields'; -import { useIntl } from '@umijs/max'; +import type { ThemeType } from './index'; import styles from './style.less'; interface CategoryProps { @@ -13,8 +13,7 @@ interface CategoryProps { onSelect: (type: string, name: string) => any; } -const Category: React.FC = props => { - +const Category: React.FC = (props) => { const { icons, title, newIcons, theme } = props; const intl = useIntl(); const [justCopied, setJustCopied] = React.useState(null); @@ -40,12 +39,14 @@ const Category: React.FC = props => { return (
-

{intl.formatMessage({ - id: `app.docs.components.icon.category.${title}`, - defaultMessage: '信息', - })}

+

+ {intl.formatMessage({ + id: `app.docs.components.icon.category.${title}`, + defaultMessage: '信息', + })} +