diff --git a/components/apolloTable/component/Cell.less b/components/apolloTable/component/Cell.less index 20e1af541b3686397009e2b75b4ad730f8ccdbf2..dda1c1c2e07d5336407c393b9b5e0c39f9ff581f 100644 --- a/components/apolloTable/component/Cell.less +++ b/components/apolloTable/component/Cell.less @@ -21,6 +21,23 @@ .checkbox { margin-right: 10px; } + .expand{ + text-align: center; + width: 20px; + border-radius: 50%; + height: 20px; + display: flex; + align-items: center; + justify-content: center; + margin-right: @marginSm; + cursor: pointer; + &:hover{ + background: #d0f0fd; + } + .expandIcon{ + width: 16px; + } + } .content { flex: 1; overflow: hidden; diff --git a/components/apolloTable/component/Cell.tsx b/components/apolloTable/component/Cell.tsx index 0042b7baa483eae05e9c11123826fcdebc6314c1..b5f6360ed7a1bef2c1fd359d1171192a9d1091b5 100644 --- a/components/apolloTable/component/Cell.tsx +++ b/components/apolloTable/component/Cell.tsx @@ -9,6 +9,7 @@ import FormHelper from '../utils/formHelper'; import firstIcon from '../assets/first.png'; import secondIcon from '../assets/second.png'; import thirdIcon from '../assets/third.png'; +import expandIcon from '../assets/extend.png'; import { transferAttr } from './base/_utils/transferAttr'; const Cell = (props: CellProps) => { @@ -36,6 +37,7 @@ const Cell = (props: CellProps) => { renderEditCell, cellRenderProps, readOnlyFlag, + showExpand, } = columnConfig; const [status, setStatus] = useState('detail'); @@ -111,23 +113,23 @@ const Cell = (props: CellProps) => { const { current = 1, pageSize = 20 } = paginationConfig || {}; const getIndex = () => { - if (current === 1) { - let src = ''; - switch (rowIndex) { - case 0: - src = firstIcon; - break; - case 1: - src = secondIcon; - break; - case 2: - src = thirdIcon; - break; - default: - return rowIndex + 1; - } - return ; - } + // if (current === 1) { + // let src = ''; + // switch (rowIndex) { + // case 0: + // src = firstIcon; + // break; + // case 1: + // src = secondIcon; + // break; + // case 2: + // src = thirdIcon; + // break; + // default: + // return rowIndex + 1; + // } + // return ; + // } return (current - 1) * pageSize + rowIndex + 1; }; const getCheckbox = () => { @@ -160,6 +162,7 @@ const Cell = (props: CellProps) => { > {rowSelection && columnIndex === 0 &&
{getCheckbox()}
} {showIndex && columnIndex === 0 &&
{getIndex()}
} + {showExpand && columnIndex === 0 &&
} {empty ? ( emptyPlaceholder || '-' ) : ( diff --git a/components/apolloTable/component/Table.less b/components/apolloTable/component/Table.less index d098167b168db991459066851943b72d666ada1f..18227d4cc70701095e33d96479de78dfb732072f 100644 --- a/components/apolloTable/component/Table.less +++ b/components/apolloTable/component/Table.less @@ -44,15 +44,15 @@ .sideGrid { overflow: hidden !important; outline: none; - .bodyCell { - font-size: 20px; - color: @textGeneralColor; - font-weight: @weightRegular; - } } .centerGrid { outline: none; } +.bodyCell { + font-size: 20px; + color: @textGeneralColor; + font-weight: @weightRegular; +} .headerGrid { width: 100%; diff --git a/components/apolloTable/component/Table.tsx b/components/apolloTable/component/Table.tsx index 2c716e26484b1fe1186f28ec3874719c21b56ea0..1f3b724071efbf350a5302a691783459184da4b6 100644 --- a/components/apolloTable/component/Table.tsx +++ b/components/apolloTable/component/Table.tsx @@ -278,8 +278,8 @@ export default class AirTable extends Component { ) => { const columnConfig = showColumns[columnIndex]; const { cellClassName, cellStyle } = columnConfig; - const className = getMergeClassName(rowClassName, cellClassName, { columnIndex }); - const mergedCellStyle = getMergeStyle(rowStyle, cellStyle, { columnIndex }); + const className = getMergeClassName(rowClassName, cellClassName, { columnIndex, columnConfig }); + const mergedCellStyle = getMergeStyle(rowStyle, cellStyle, { columnIndex, columnConfig }); return this.renderBodyCell( { showColumns, showData, position }, { diff --git a/components/apolloTable/utils/utils.tsx b/components/apolloTable/utils/utils.tsx index 4f27c31ed3fc522a04342bd60e48a0135646d5db..a5d3c7d725d1cda578799ecc8dab497ea680e159 100644 --- a/components/apolloTable/utils/utils.tsx +++ b/components/apolloTable/utils/utils.tsx @@ -93,7 +93,10 @@ export function getMergeClassName( mergeClassName = ''; } if (typeof mergeClassName === 'function') { - className = `${className} ${mergeClassName(mergeData)}`; + const mergeClass = mergeClassName(mergeData); + if (mergeClass) { + className = `${className} ${mergeClass}`; + } } else { className = `${className} ${mergeClassName}`; }