Commit b8ff5b9b authored by zhangwenshuai's avatar zhangwenshuai

update first cell

parent a18fde7a
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
align-items: center; align-items: center;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
max-width: 66px; //max-width: 66px;
margin-left: @marginLg; margin-left: @marginLg;
.num { .num {
min-width: 30px; min-width: 30px;
max-width: 100px; max-width: 100px;
margin-right: 10px; margin-right: @marginSmX;
font-size: @textFontGen; font-size: @textFontGen;
.icon { .icon {
width: 22px; width: 22px;
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
.checkbox { .checkbox {
min-width: 30px; min-width: 30px;
max-width: 100px; max-width: 100px;
margin-right: 10px; margin-right: @marginSmX;
&.hasNum { &.hasNum {
display: none; display: none;
} }
...@@ -33,21 +33,19 @@ ...@@ -33,21 +33,19 @@
} }
} }
.expand { .expand {
text-align: center;
width: 20px;
border-radius: 50%;
height: 20px;
display: flex; display: flex;
align-items: center; width: 16px;
justify-content: center; margin-right: @marginSmX;
margin-right: @marginSm;
cursor: pointer; cursor: pointer;
visibility: hidden; visibility: hidden;
&:hover {
background: #d0f0fd;
}
.expandIcon { .expandIcon {
border-radius: 50%;
width: 16px; width: 16px;
height: 16px;
&:hover {
background: #d0f0fd;
}
} }
} }
} }
...@@ -55,9 +53,9 @@ ...@@ -55,9 +53,9 @@
background: @tableHoverBgColor; background: @tableHoverBgColor;
.firstArea { .firstArea {
.checkbox { .checkbox {
display: block; display: flex;
&.hasNum { &.hasNum {
display: block; display: flex;
} }
} }
.num { .num {
......
...@@ -37,6 +37,8 @@ const Cell = (props: CellProps) => { ...@@ -37,6 +37,8 @@ const Cell = (props: CellProps) => {
onEmitMsg, onEmitMsg,
tableId, tableId,
maxPopHeight, maxPopHeight,
renderFirstLeft,
position,
} = props; } = props;
const { const {
columnType, columnType,
...@@ -180,12 +182,12 @@ const Cell = (props: CellProps) => { ...@@ -180,12 +182,12 @@ const Cell = (props: CellProps) => {
}; };
return ( return (
<div className={s.firstArea}> <div className={s.firstArea}>
{rowSelection && columnIndex === 0 && ( {rowSelection && (
<div className={classNames(s.checkbox, showIndex && s.hasNum, getCheckedIndex() > -1 && s.checked)}> <div className={classNames(s.checkbox, showIndex && s.hasNum, getCheckedIndex() > -1 && s.checked)}>
{getCheckbox()} {getCheckbox()}
</div> </div>
)} )}
{showIndex && columnIndex === 0 && ( {showIndex && (
<div <div
className={classNames( className={classNames(
s.num, s.num,
...@@ -196,7 +198,7 @@ const Cell = (props: CellProps) => { ...@@ -196,7 +198,7 @@ const Cell = (props: CellProps) => {
{getIndex()} {getIndex()}
</div> </div>
)} )}
{showExpand && columnIndex === 0 && ( {showExpand && (
<div className={s.expand}> <div className={s.expand}>
<img <img
onClick={showExpand.bind(null, { rowId: record.id, historyGroupId: record.historyGroupId })} onClick={showExpand.bind(null, { rowId: record.id, historyGroupId: record.historyGroupId })}
...@@ -206,6 +208,9 @@ const Cell = (props: CellProps) => { ...@@ -206,6 +208,9 @@ const Cell = (props: CellProps) => {
/> />
</div> </div>
)} )}
{
renderFirstLeft&&renderFirstLeft({record})
}
</div> </div>
); );
}; };
...@@ -390,7 +395,7 @@ const Cell = (props: CellProps) => { ...@@ -390,7 +395,7 @@ const Cell = (props: CellProps) => {
onMouseEnter={onMouseEnter} onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave} onMouseLeave={onMouseLeave}
> >
{columnIndex === 0 && (rowSelection || showExpand || showIndex) && renderFirst()} {columnIndex === 0 && position!=='right' && renderFirst()}
<div <div
id={`cellUnit_${tableId}_${record.id}_${columnName}`} id={`cellUnit_${tableId}_${record.id}_${columnName}`}
className={classNames( className={classNames(
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
padding: 0 @paddingLg; padding: 0 @paddingLg;
overflow: hidden; overflow: hidden;
.checkbox { .checkbox {
margin-right: 10px; width: 30px;
margin-right: @marginSmX;
} }
.colBrief { .colBrief {
display: flex; display: flex;
......
...@@ -84,9 +84,9 @@ export default class TableColumn extends PureComponent<ColumnProps> { ...@@ -84,9 +84,9 @@ export default class TableColumn extends PureComponent<ColumnProps> {
const { sortType }: { sortType: string } = sort || {}; const { sortType }: { sortType: string } = sort || {};
let marginLeft:any = 0; let marginLeft:any = 0;
if (columnIndex === 0 && (rowSelection || showIndex)) { if (columnIndex === 0 && (rowSelection || showIndex)) {
marginLeft = '56px'; marginLeft = '72px';
if (!rowSelection) { if (!rowSelection) {
marginLeft = '82px'; marginLeft = '91px';
} }
} }
return ( return (
......
...@@ -329,6 +329,7 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -329,6 +329,7 @@ export default class AirTable extends Component<TableProps, TableState> {
rowStyle, rowStyle,
onEmitMsg, onEmitMsg,
tableId, tableId,
renderFirstLeft,
} = this.props; } = this.props;
if (showColumns.length === 0 || showData.length === 0) { if (showColumns.length === 0 || showData.length === 0) {
return; return;
...@@ -366,6 +367,7 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -366,6 +367,7 @@ export default class AirTable extends Component<TableProps, TableState> {
columnConfig, columnConfig,
columnData, columnData,
cellData, cellData,
record,
}); });
const cellStyleObj = getMergeStyle({ ...style, ...cellBorderStyle }, cellStyle, { const cellStyleObj = getMergeStyle({ ...style, ...cellBorderStyle }, cellStyle, {
columnIndex, columnIndex,
...@@ -404,6 +406,7 @@ export default class AirTable extends Component<TableProps, TableState> { ...@@ -404,6 +406,7 @@ export default class AirTable extends Component<TableProps, TableState> {
onEmitMsg={onEmitMsg} onEmitMsg={onEmitMsg}
tableId={tableId} tableId={tableId}
maxPopHeight={maxPopHeight} maxPopHeight={maxPopHeight}
renderFirstLeft={renderFirstLeft}
/> />
); );
}; };
......
...@@ -91,6 +91,7 @@ class AirTable extends React.Component<CommonProps, CommonState> { ...@@ -91,6 +91,7 @@ class AirTable extends React.Component<CommonProps, CommonState> {
onEmitMsg, onEmitMsg,
tableId, tableId,
cachedFeAttr, cachedFeAttr,
renderFirstLeft,
} = this.props; } = this.props;
const sortConfig = operateConfig const sortConfig = operateConfig
&& operateConfig.menusGroup && operateConfig.menusGroup
...@@ -154,6 +155,7 @@ class AirTable extends React.Component<CommonProps, CommonState> { ...@@ -154,6 +155,7 @@ class AirTable extends React.Component<CommonProps, CommonState> {
onDragFixed={onDragFixed} onDragFixed={onDragFixed}
canSorted={canSorted} canSorted={canSorted}
onDragSorted={onDragSorted} onDragSorted={onDragSorted}
renderFirstLeft={renderFirstLeft}
/> />
</div> </div>
</div> </div>
......
...@@ -84,6 +84,7 @@ export interface TableProps extends LoadConfigProps { ...@@ -84,6 +84,7 @@ export interface TableProps extends LoadConfigProps {
onDragResized?: Function; // 拖拽更改列伸缩回调 onDragResized?: Function; // 拖拽更改列伸缩回调
onEmitMsg?: Function; // 是否支持消息协同 onEmitMsg?: Function; // 是否支持消息协同
cachedFeAttr?: boolean; // 是否启用前端缓存 cachedFeAttr?: boolean; // 是否启用前端缓存
renderFirstLeft?:Function; // 第一个单元格特殊渲染
} }
export interface TableState { export interface TableState {
columns: ColumnProps[]; columns: ColumnProps[];
...@@ -137,6 +138,7 @@ export interface CellProps { ...@@ -137,6 +138,7 @@ export interface CellProps {
onEmitMsg?: Function; onEmitMsg?: Function;
tableId?: string | number; tableId?: string | number;
maxPopHeight?: string | number; maxPopHeight?: string | number;
renderFirstLeft?: Function;
} }
export interface EditCellProps { export interface EditCellProps {
......
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