fix: add hover style for table rows
This commit is contained in:
parent
eac7734f07
commit
b6e41a6e45
@ -3,3 +3,7 @@
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding-top: 100px;
|
padding-top: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ant-form-item-with-help {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
@ -144,6 +144,7 @@ export function SimpleTable(props: SimpleTableProps) {
|
|||||||
data,
|
data,
|
||||||
mutate,
|
mutate,
|
||||||
rowKey,
|
rowKey,
|
||||||
|
isFieldComponent,
|
||||||
onMoved: async ({resourceKey, target}) => {
|
onMoved: async ({resourceKey, target}) => {
|
||||||
await api.resource(name).sort({
|
await api.resource(name).sort({
|
||||||
associatedKey,
|
associatedKey,
|
||||||
|
@ -21,9 +21,10 @@ interface Props {
|
|||||||
mutate: any,
|
mutate: any,
|
||||||
rowKey: any,
|
rowKey: any,
|
||||||
onMoved: any,
|
onMoved: any,
|
||||||
|
isFieldComponent?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const components = ({data = {}, rowKey, mutate, onMoved}: Props) => {
|
export const components = ({data = {}, rowKey, mutate, onMoved, isFieldComponent}: Props) => {
|
||||||
return {
|
return {
|
||||||
body: {
|
body: {
|
||||||
wrapper: props => (
|
wrapper: props => (
|
||||||
@ -51,7 +52,7 @@ export const components = ({data = {}, rowKey, mutate, onMoved}: Props) => {
|
|||||||
row: ({ className, style, ...restProps }) => {
|
row: ({ className, style, ...restProps }) => {
|
||||||
// function findIndex base on Table rowKey props and should always be a right array index
|
// function findIndex base on Table rowKey props and should always be a right array index
|
||||||
const index = findIndex(data.list, (x: any) => x[rowKey] === restProps['data-row-key']);
|
const index = findIndex(data.list, (x: any) => x[rowKey] === restProps['data-row-key']);
|
||||||
return <SortableItem index={index} {...restProps} />;
|
return <SortableItem index={index} className={`${className}${isFieldComponent ? '': ' row-clickable'}`} style={style} {...restProps} />;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -138,6 +138,7 @@ export function Table(props: TableProps) {
|
|||||||
data,
|
data,
|
||||||
mutate,
|
mutate,
|
||||||
rowKey,
|
rowKey,
|
||||||
|
isFieldComponent,
|
||||||
onMoved: async ({resourceKey, target}) => {
|
onMoved: async ({resourceKey, target}) => {
|
||||||
await api.resource(name).sort({
|
await api.resource(name).sort({
|
||||||
associatedKey,
|
associatedKey,
|
||||||
|
@ -22,3 +22,13 @@
|
|||||||
.ant-form-item-label {
|
.ant-form-item-label {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.row-clickable {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-table-tbody > tr.row-clickable:hover > td {
|
||||||
|
background: #e6f7ff;
|
||||||
|
border-color: rgba(0, 0, 0, 0.03);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user