diff --git a/components/apolloTable/component/Cell.less b/components/apolloTable/component/Cell.less index 2ca45244d9ec6dd74969004a2bceebabe7dbf781..1748d468b4fec7e5b17a40bd0b20922338b60423 100644 --- a/components/apolloTable/component/Cell.less +++ b/components/apolloTable/component/Cell.less @@ -7,12 +7,12 @@ align-items: center; white-space: nowrap; overflow: hidden; - max-width: 66px; + //max-width: 66px; margin-left: @marginLg; .num { min-width: 30px; max-width: 100px; - margin-right: 10px; + margin-right: @marginSmX; font-size: @textFontGen; .icon { width: 22px; @@ -24,7 +24,7 @@ .checkbox { min-width: 30px; max-width: 100px; - margin-right: 10px; + margin-right: @marginSmX; &.hasNum { display: none; } @@ -33,21 +33,19 @@ } } .expand { - text-align: center; - width: 20px; - border-radius: 50%; - height: 20px; display: flex; - align-items: center; - justify-content: center; - margin-right: @marginSm; + width: 16px; + margin-right: @marginSmX; cursor: pointer; visibility: hidden; - &:hover { - background: #d0f0fd; - } + .expandIcon { + border-radius: 50%; width: 16px; + height: 16px; + &:hover { + background: #d0f0fd; + } } } } @@ -55,9 +53,9 @@ background: @tableHoverBgColor; .firstArea { .checkbox { - display: block; + display: flex; &.hasNum { - display: block; + display: flex; } } .num { diff --git a/components/apolloTable/component/Cell.tsx b/components/apolloTable/component/Cell.tsx index 7f546e7f3d3b62cac13c11a850e764725924f795..be9ebde96447ca1961249d3c110e5a2cf78337c8 100644 --- a/components/apolloTable/component/Cell.tsx +++ b/components/apolloTable/component/Cell.tsx @@ -37,6 +37,8 @@ const Cell = (props: CellProps) => { onEmitMsg, tableId, maxPopHeight, + renderFirstLeft, + position, } = props; const { columnType, @@ -180,12 +182,12 @@ const Cell = (props: CellProps) => { }; return (
- {rowSelection && columnIndex === 0 && ( + {rowSelection && (
-1 && s.checked)}> {getCheckbox()}
)} - {showIndex && columnIndex === 0 && ( + {showIndex && (
{ {getIndex()}
)} - {showExpand && columnIndex === 0 && ( + {showExpand && (
{ />
)} + { + renderFirstLeft&&renderFirstLeft({record}) + }
); }; @@ -390,7 +395,7 @@ const Cell = (props: CellProps) => { onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave} > - {columnIndex === 0 && (rowSelection || showExpand || showIndex) && renderFirst()} + {columnIndex === 0 && position!=='right' && renderFirst()}
{ const { sortType }: { sortType: string } = sort || {}; let marginLeft:any = 0; if (columnIndex === 0 && (rowSelection || showIndex)) { - marginLeft = '56px'; + marginLeft = '72px'; if (!rowSelection) { - marginLeft = '82px'; + marginLeft = '91px'; } } return ( diff --git a/components/apolloTable/component/Table.tsx b/components/apolloTable/component/Table.tsx index ba719efa11f8af41ee9cdcc5d8736ef00b4ddb71..048fac95de16b5bcba1ee2d68c9e826126cab6f9 100644 --- a/components/apolloTable/component/Table.tsx +++ b/components/apolloTable/component/Table.tsx @@ -329,6 +329,7 @@ export default class AirTable extends Component { rowStyle, onEmitMsg, tableId, + renderFirstLeft, } = this.props; if (showColumns.length === 0 || showData.length === 0) { return; @@ -366,6 +367,7 @@ export default class AirTable extends Component { columnConfig, columnData, cellData, + record, }); const cellStyleObj = getMergeStyle({ ...style, ...cellBorderStyle }, cellStyle, { columnIndex, @@ -404,6 +406,7 @@ export default class AirTable extends Component { onEmitMsg={onEmitMsg} tableId={tableId} maxPopHeight={maxPopHeight} + renderFirstLeft={renderFirstLeft} /> ); }; diff --git a/components/apolloTable/component/index.tsx b/components/apolloTable/component/index.tsx index cc61da9bf145d3dc66e2f24c7bf996806d82a677..774c37a2434e4ffffe391afede8f623b57edaee9 100644 --- a/components/apolloTable/component/index.tsx +++ b/components/apolloTable/component/index.tsx @@ -91,6 +91,7 @@ class AirTable extends React.Component { onEmitMsg, tableId, cachedFeAttr, + renderFirstLeft, } = this.props; const sortConfig = operateConfig && operateConfig.menusGroup @@ -154,6 +155,7 @@ class AirTable extends React.Component { onDragFixed={onDragFixed} canSorted={canSorted} onDragSorted={onDragSorted} + renderFirstLeft={renderFirstLeft} />
diff --git a/components/apolloTable/component/interface.tsx b/components/apolloTable/component/interface.tsx index 4b769852452052f62dec3959c1b571a4cca0715b..f1c48391db9a823c9bd88b73b00cefe4e81a3967 100644 --- a/components/apolloTable/component/interface.tsx +++ b/components/apolloTable/component/interface.tsx @@ -84,6 +84,7 @@ export interface TableProps extends LoadConfigProps { onDragResized?: Function; // 拖拽更改列伸缩回调 onEmitMsg?: Function; // 是否支持消息协同 cachedFeAttr?: boolean; // 是否启用前端缓存 + renderFirstLeft?:Function; // 第一个单元格特殊渲染 } export interface TableState { columns: ColumnProps[]; @@ -137,6 +138,7 @@ export interface CellProps { onEmitMsg?: Function; tableId?: string | number; maxPopHeight?: string | number; + renderFirstLeft?: Function; } export interface EditCellProps {