From 6b6ab0d95ee4e724aef62491e1ec010edc3f29d7 Mon Sep 17 00:00:00 2001 From: zjt Date: Sat, 7 May 2022 16:05:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A1=A8=E6=A0=BC=E5=88=97=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=93=8D=E4=BD=9C=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc | 24 ++++++--- src/components/tableColumns/index.tsx | 4 +- .../tableColumns/operation/index.tsx | 49 +++++++++++++++++++ 3 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 src/components/tableColumns/operation/index.tsx diff --git a/.eslintrc b/.eslintrc index f574bbc..cff24b5 100644 --- a/.eslintrc +++ b/.eslintrc @@ -39,15 +39,27 @@ ] }, "rules": { - "import/no-unresolved": 1, - "import/no-cycle": 1, - "import/no-extraneous-dependencies": 1, - "@typescript-eslint/no-empty-function": 1, - "typescript-eslint/no-explicit-any": 0, "react/jsx-props-no-spreading": 0, - "no-use-before-define": "off", + "no-use-before-define": 0, "react/display-name": 0, "import/extensions": 0, + "import/no-cycle": 0, + "consistent-return": 0, + "no-restricted-syntax": 0, + "import/no-extraneous-dependencies": 1, + "@typescript-eslint/no-empty-function": 1, + "typescript-eslint/no-explicit-any": 0, + "no-underscore-dangle": 0, + "no-unused-expressions": 0, + "no-plusplus": 0, + "no-continue": 0, + "react/no-array-index-key": 1, + "no-return-await": 1, + "import/no-unresolved": 1, + "no-await-in-loop": 1, + "no-nested-ternary": 1, + "react/jsx-no-useless-fragment": 1, + "no-shadow": 1, "comma-dangle": [ "error", "never" diff --git a/src/components/tableColumns/index.tsx b/src/components/tableColumns/index.tsx index 7f8b942..c63475a 100644 --- a/src/components/tableColumns/index.tsx +++ b/src/components/tableColumns/index.tsx @@ -7,6 +7,7 @@ import MultirowColumn from './multirowText' import EnumColumn from './enum' import ImageColumn from './image' import CustomColumn from './custom' +import OperationColumn from './operation' export default { text: TextColumns, @@ -17,5 +18,6 @@ export default { multirowText: MultirowColumn, Aenum: EnumColumn, image: ImageColumn, - custom: CustomColumn + custom: CustomColumn, + operation: OperationColumn } diff --git a/src/components/tableColumns/operation/index.tsx b/src/components/tableColumns/operation/index.tsx new file mode 100644 index 0000000..0ca70ad --- /dev/null +++ b/src/components/tableColumns/operation/index.tsx @@ -0,0 +1,49 @@ +import React from 'react' +import { OperationColumn } from 'ccms' +import { OperationColumnConfig, IButtonProps, IOperationColumn } from 'ccms/dist/src/components/tableColumns/operation' +import { Button, Space } from 'antd' +import OperationHelper from '../../../util/operation' + +export const PropsType = (props: OperationColumnConfig) => {} + +export default class OperationColumnComponent extends OperationColumn { + OperationHelper = OperationHelper + + renderComponent = (props: IOperationColumn) => { + const { actions } = props + return {Array.isArray(actions) && actions} + } + + renderButtonComponent = (props: IButtonProps) => { + const { level, label, onClick } = props + let type + let danger + if (level === 'danger') { + type = 'default' + danger = true + } else { + danger = false + if (level === 'normal') { + type = 'default' + } else { + type = level + } + } + return ( + + ) + } + + renderLinkComponent = (props: IButtonProps) => { + const { level, label, onClick } = props + const danger = level === 'danger' + const style = level === 'primary' ? { fontWeight: 'bold' } : {} + return ( + + ) + } +} -- Gitee