Commit 94406b3f authored by zhangwenshuai's avatar zhangwenshuai

增加行hover效果

parent 52c7858a
......@@ -5,6 +5,7 @@ import _ from 'lodash';
import { config } from './base/config';
import { getEditComponent, getFormat, setFormat } from './base';
import s from './Cell.less';
import tableStyle from './Table.less';
import { CellProps, CellDataProps } from './interface';
import FormHelper from '../utils/formHelper';
import firstIcon from '../assets/first.png';
......@@ -103,6 +104,20 @@ const Cell = (props: CellProps) => {
}
setStatus('detail');
};
// 添加行hover样式
const onMouseEnter = () => {
const doms = document.querySelectorAll(`.row_${rowIndex}`);
doms.forEach((dom) => {
dom.classList.add(tableStyle.hover);
});
};
// 去除行hover样式
const onMouseLeave = () => {
const doms = document.querySelectorAll(`.row_${rowIndex}`);
doms.forEach((dom) => {
dom.classList.remove(tableStyle.hover);
});
};
const selfRenderDetailCell = () => {
let empty =
......@@ -169,6 +184,8 @@ const Cell = (props: CellProps) => {
const detail = (
<div
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
className={
selectedCell === `${position}_${cellKey}` ? classNames(s.detailCell, s.selected) : s.detailCell
}
......
......@@ -69,7 +69,9 @@
color: @textGeneralColor;
font-weight: @weightRegular;
}
.hover {
background: @tableHoverBgColor;
}
.headerGrid {
width: 100%;
overflow: hidden !important;
......
......@@ -393,7 +393,7 @@ export default class AirTable extends Component<TableProps, TableState> {
columnData={columnData}
record={record}
emitChangeCell={emitChangeCell}
cellClassName={classNames(rowClassNameStr, cellClassNameStr)}
cellClassName={classNames(`row_${rowIndex}`, rowClassNameStr, cellClassNameStr)}
cellStyle={{ ...rowStyleObj, ...cellStyleObj }}
columns={columns}
paginationConfig={paginationConfig}
......
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