From 131f7a693ebaa89b4bfcb3300a456a5e722957b6 Mon Sep 17 00:00:00 2001 From: wanghong Date: Fri, 27 Oct 2023 14:28:42 +0800 Subject: [PATCH] chore: move OrderIdStyleWrapper to shared --- packages/shared/lib/styleWrapper/element.ts | 16 ++++++++++++++++ .../sqle/src/page/AuditPlan/PlanList/column.tsx | 6 +++--- packages/sqle/src/page/Order/List/column.tsx | 6 +++--- .../Overview/component/OrderRiskList/index.tsx | 14 +++++++------- .../Overview/component/ScanRiskList/index.tsx | 12 +++++------- packages/sqle/src/style/order.ts | 14 -------------- 6 files changed, 34 insertions(+), 34 deletions(-) delete mode 100644 packages/sqle/src/style/order.ts diff --git a/packages/shared/lib/styleWrapper/element.ts b/packages/shared/lib/styleWrapper/element.ts index 15c9d20b7..62a4234f1 100644 --- a/packages/shared/lib/styleWrapper/element.ts +++ b/packages/shared/lib/styleWrapper/element.ts @@ -121,3 +121,19 @@ export const ConsolidatedListStyleWrapper = styled('section')` } } `; + +/** + * 功能: 用于带Icon的表格列,如工单号 + */ +export const TableColumnWithIconStyleWrapper = styled('div')` + display: flex; + align-items: center; + + span { + margin-right: 12px; + + &:last-child { + margin-right: 0; + } + } +`; diff --git a/packages/sqle/src/page/AuditPlan/PlanList/column.tsx b/packages/sqle/src/page/AuditPlan/PlanList/column.tsx index d2a1ae96e..61f22bc44 100644 --- a/packages/sqle/src/page/AuditPlan/PlanList/column.tsx +++ b/packages/sqle/src/page/AuditPlan/PlanList/column.tsx @@ -13,13 +13,13 @@ import { import { Link } from 'react-router-dom'; import { t } from '../../../locale'; import DatabaseTypeLogo from '../../../components/DatabaseTypeLogo'; -import { OrderIdStyleWrapper } from '../../../style/order'; import { IconOrderId } from '../../../icon/Order'; import { RuleUrlParamKey } from '../../Rule/useRuleFilterForm'; import TokenCom from './TableTaskTypeFilter/component/TokenCom'; import { ModalName } from '../../../data/ModalName'; import { BasicToolTips } from '@actiontech/shared'; import { IconTipGray } from '@actiontech/shared/lib/Icon'; +import { TableColumnWithIconStyleWrapper } from '@actiontech/shared/lib/styleWrapper/element'; export type PlanListTableFilterParamType = PageInfoWithoutIndexAndSize< IGetAuditPlansV2Params, @@ -107,12 +107,12 @@ const PlanListColumn: ( fixed: 'left', render: (text: string) => { return ( - + {text} - + ); } }, diff --git a/packages/sqle/src/page/Order/List/column.tsx b/packages/sqle/src/page/Order/List/column.tsx index f244a4347..fcebf8c12 100644 --- a/packages/sqle/src/page/Order/List/column.tsx +++ b/packages/sqle/src/page/Order/List/column.tsx @@ -10,10 +10,10 @@ import OrderDesc from './components/OrderDesc'; import OrderStatus from './components/OrderStatus'; import { OrderNameStyleWrapper } from './style'; import { IconOrderId } from '../../../icon/Order'; -import { OrderIdStyleWrapper } from '../../../style/order'; import { IWorkflowDetailResV1 } from '@actiontech/shared/lib/api/sqle/service/common'; import { IGetWorkflowsV1Params } from '@actiontech/shared/lib/api/sqle/service/workflow/index.d'; import { AvatarCom } from '@actiontech/shared'; +import { TableColumnWithIconStyleWrapper } from '@actiontech/shared/lib/styleWrapper/element'; export type OrderListTableFilterParamType = PageInfoWithoutIndexAndSize< IGetWorkflowsV1Params, @@ -72,10 +72,10 @@ const OrderListColumn: ( title: () => t('order.order.id'), render: (id: string) => { return ( - + {id} - + ); }, fixed: 'left' diff --git a/packages/sqle/src/page/ProjectManage/Overview/component/OrderRiskList/index.tsx b/packages/sqle/src/page/ProjectManage/Overview/component/OrderRiskList/index.tsx index 562452562..b4676c8e3 100644 --- a/packages/sqle/src/page/ProjectManage/Overview/component/OrderRiskList/index.tsx +++ b/packages/sqle/src/page/ProjectManage/Overview/component/OrderRiskList/index.tsx @@ -1,23 +1,21 @@ import { useTranslation } from 'react-i18next'; import { useState } from 'react'; -import { useNavigate } from 'react-router-dom'; - +import { Link, useNavigate } from 'react-router-dom'; import ChartWrapper from '../../../../../components/ChartCom/ChartWrapper'; import CardWrapper from '../../../../../components/CardWrapper'; import TableTopList, { ITableTopList } from '../../../../../components/ChartCom/TableTopList'; import { AvatarCom, BasicButton } from '@actiontech/shared'; -import { OrderIdStyleWrapper } from '../../../../../style/order'; import OrderStatus from '../../../../Order/List/components/OrderStatus'; import { IconOrderId } from '../../../../../icon/Order'; -import { Link } from '../../../../../components/Link'; import { useCurrentProject } from '@actiontech/shared/lib/global'; import { formatTime } from '@actiontech/shared/lib/utils/Common'; import useChatsDataByAPI from '../../hooks/useChatsDataByAPI'; import { IRiskWorkflow } from '@actiontech/shared/lib/api/sqle/service/common'; import { WorkflowDetailResV1StatusEnum } from '@actiontech/shared/lib/api/sqle/service/common.enum'; import statistic from '@actiontech/shared/lib/api/sqle/service/statistic'; +import { TableColumnWithIconStyleWrapper } from '@actiontech/shared/lib/styleWrapper/element'; const OrderRiskList = () => { const { t } = useTranslation(); @@ -53,12 +51,14 @@ const OrderRiskList = () => { render: (name: string, record: IRiskWorkflow) => { if (!name) return '-'; return ( - + - + {name} - + ); } }, diff --git a/packages/sqle/src/page/ProjectManage/Overview/component/ScanRiskList/index.tsx b/packages/sqle/src/page/ProjectManage/Overview/component/ScanRiskList/index.tsx index 7e773d191..66943150f 100644 --- a/packages/sqle/src/page/ProjectManage/Overview/component/ScanRiskList/index.tsx +++ b/packages/sqle/src/page/ProjectManage/Overview/component/ScanRiskList/index.tsx @@ -1,7 +1,6 @@ import { useTranslation } from 'react-i18next'; import { useState } from 'react'; -import { useNavigate } from 'react-router-dom'; - +import { Link, useNavigate } from 'react-router-dom'; import { Typography } from 'antd5'; import ChartWrapper from '../../../../../components/ChartCom/ChartWrapper'; import CardWrapper from '../../../../../components/CardWrapper'; @@ -9,15 +8,14 @@ import { BasicButton } from '@actiontech/shared'; import TableTopList, { ITableTopList } from '../../../../../components/ChartCom/TableTopList'; -import { Link } from '../../../../../components/Link'; import { useCurrentProject } from '@actiontech/shared/lib/global'; import useChatsDataByAPI from '../../hooks/useChatsDataByAPI'; import { formatTime } from '@actiontech/shared/lib/utils/Common'; import { IcoScanId } from '../../../../../icon/Scan'; -import { OrderIdStyleWrapper } from '../../../../../style/order'; import { formatParamsBySeparator } from '@actiontech/shared/lib/utils/Tool'; import { IRiskAuditPlan } from '@actiontech/shared/lib/api/sqle/service/common'; import statistic from '@actiontech/shared/lib/api/sqle/service/statistic'; +import { TableColumnWithIconStyleWrapper } from '@actiontech/shared/lib/styleWrapper/element'; const ScanRiskList = () => { const { t } = useTranslation(); @@ -59,17 +57,17 @@ const ScanRiskList = () => { render: (name: string, record: IRiskAuditPlan) => { if (!name) return '-'; return ( - + {name} - + ); } }, diff --git a/packages/sqle/src/style/order.ts b/packages/sqle/src/style/order.ts deleted file mode 100644 index 2bb010689..000000000 --- a/packages/sqle/src/style/order.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { styled } from '@mui/material/styles'; - -export const OrderIdStyleWrapper = styled('div')` - display: flex; - align-items: center; - - span { - margin-right: 12px; - - &:last-child { - margin-right: 0; - } - } -`;