diff --git a/src/components/tableColumns/index.tsx b/src/components/tableColumns/index.tsx index 7f8b9428cf14d92cedd43c02a9cf520b9a7c026d..c63475ac1b68c0a41721e2e3ab4a54759b4f17d6 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 0000000000000000000000000000000000000000..0ca70ad22e1bdb96c29f47b2a91cd42f8b573b22 --- /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 ( + + ) + } +}