Commit 2c82bb10 authored by zhangwenshuai's avatar zhangwenshuai

add expand

parent 602ab98f
...@@ -21,6 +21,23 @@ ...@@ -21,6 +21,23 @@
.checkbox { .checkbox {
margin-right: 10px; 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 { .content {
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
......
...@@ -9,6 +9,7 @@ import FormHelper from '../utils/formHelper'; ...@@ -9,6 +9,7 @@ import FormHelper from '../utils/formHelper';
import firstIcon from '../assets/first.png'; import firstIcon from '../assets/first.png';
import secondIcon from '../assets/second.png'; import secondIcon from '../assets/second.png';
import thirdIcon from '../assets/third.png'; import thirdIcon from '../assets/third.png';
import expandIcon from '../assets/extend.png';
import { transferAttr } from './base/_utils/transferAttr'; import { transferAttr } from './base/_utils/transferAttr';
const Cell = (props: CellProps) => { const Cell = (props: CellProps) => {
...@@ -36,6 +37,7 @@ const Cell = (props: CellProps) => { ...@@ -36,6 +37,7 @@ const Cell = (props: CellProps) => {
renderEditCell, renderEditCell,
cellRenderProps, cellRenderProps,
readOnlyFlag, readOnlyFlag,
showExpand,
} = columnConfig; } = columnConfig;
const [status, setStatus] = useState('detail'); const [status, setStatus] = useState('detail');
...@@ -111,23 +113,23 @@ const Cell = (props: CellProps) => { ...@@ -111,23 +113,23 @@ const Cell = (props: CellProps) => {
const { current = 1, pageSize = 20 } = paginationConfig || {}; const { current = 1, pageSize = 20 } = paginationConfig || {};
const getIndex = () => { const getIndex = () => {
if (current === 1) { // if (current === 1) {
let src = ''; // let src = '';
switch (rowIndex) { // switch (rowIndex) {
case 0: // case 0:
src = firstIcon; // src = firstIcon;
break; // break;
case 1: // case 1:
src = secondIcon; // src = secondIcon;
break; // break;
case 2: // case 2:
src = thirdIcon; // src = thirdIcon;
break; // break;
default: // default:
return rowIndex + 1; // return rowIndex + 1;
} // }
return <img className={s.icon} alt="" src={src} />; // return <img className={s.icon} alt="" src={src} />;
} // }
return (current - 1) * pageSize + rowIndex + 1; return (current - 1) * pageSize + rowIndex + 1;
}; };
const getCheckbox = () => { const getCheckbox = () => {
...@@ -160,6 +162,7 @@ const Cell = (props: CellProps) => { ...@@ -160,6 +162,7 @@ const Cell = (props: CellProps) => {
> >
{rowSelection && columnIndex === 0 && <div className={s.checkbox}>{getCheckbox()}</div>} {rowSelection && columnIndex === 0 && <div className={s.checkbox}>{getCheckbox()}</div>}
{showIndex && columnIndex === 0 && <div className={s.num}>{getIndex()}</div>} {showIndex && columnIndex === 0 && <div className={s.num}>{getIndex()}</div>}
{showExpand && columnIndex === 0 && <div className={s.expand}><img onClick={showExpand.bind(null,{rowId:record.id})} className={s.expandIcon} alt="" src={expandIcon}/></div>}
{empty ? ( {empty ? (
emptyPlaceholder || '-' emptyPlaceholder || '-'
) : ( ) : (
......
...@@ -44,15 +44,15 @@ ...@@ -44,15 +44,15 @@
.sideGrid { .sideGrid {
overflow: hidden !important; overflow: hidden !important;
outline: none; outline: none;
.bodyCell {
font-size: 20px;
color: @textGeneralColor;
font-weight: @weightRegular;
}
} }
.centerGrid { .centerGrid {
outline: none; outline: none;
} }
.bodyCell {
font-size: 20px;
color: @textGeneralColor;
font-weight: @weightRegular;
}
.headerGrid { .headerGrid {
width: 100%; width: 100%;
......
...@@ -278,8 +278,8 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -278,8 +278,8 @@ export default class AirTable extends Component<TableProps, TableState> {
) => { ) => {
const columnConfig = showColumns[columnIndex]; const columnConfig = showColumns[columnIndex];
const { cellClassName, cellStyle } = columnConfig; const { cellClassName, cellStyle } = columnConfig;
const className = getMergeClassName(rowClassName, cellClassName, { columnIndex }); const className = getMergeClassName(rowClassName, cellClassName, { columnIndex, columnConfig });
const mergedCellStyle = getMergeStyle(rowStyle, cellStyle, { columnIndex }); const mergedCellStyle = getMergeStyle(rowStyle, cellStyle, { columnIndex, columnConfig });
return this.renderBodyCell( return this.renderBodyCell(
{ showColumns, showData, position }, { showColumns, showData, position },
{ {
......
...@@ -93,7 +93,10 @@ export function getMergeClassName( ...@@ -93,7 +93,10 @@ export function getMergeClassName(
mergeClassName = ''; mergeClassName = '';
} }
if (typeof mergeClassName === 'function') { if (typeof mergeClassName === 'function') {
className = `${className} ${mergeClassName(mergeData)}`; const mergeClass = mergeClassName(mergeData);
if (mergeClass) {
className = `${className} ${mergeClass}`;
}
} else { } else {
className = `${className} ${mergeClassName}`; className = `${className} ${mergeClassName}`;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment