修复 Table 图片放大,图片位置可能不对应的问题

This commit is contained in:
2betop 2020-01-09 11:54:50 +08:00
parent 263dc9c9ee
commit 309fcb3a91
3 changed files with 24 additions and 9 deletions

View File

@ -95,6 +95,8 @@ export interface ImageFieldProps extends RendererProps {
imageClassName?: string;
placeholder: string;
description?: string;
enlargeTitle?: string;
enlargeCaption?: string;
thumbMode: 'w-full' | 'h-full' | 'contain' | 'cover';
thumbRatio: '1:1' | '4:3' | '16:9';
originalSrc?: string; // 原图
@ -134,15 +136,15 @@ export class ImageField extends React.Component<ImageFieldProps, object> {
thumbMode,
thumbRatio
}: ImageThumbProps) {
const {onImageEnlarge} = this.props;
const {onImageEnlarge, enlargeTitle, enlargeCaption} = this.props;
onImageEnlarge &&
onImageEnlarge(
{
src,
originalSrc: originalSrc || src,
title,
caption,
title: enlargeTitle || title,
caption: enlargeCaption || caption,
thumbMode,
thumbRatio
},

View File

@ -66,8 +66,9 @@ export class ImagesField extends React.Component<ImagesProps> {
originalSrc: originalSrc
? filter(originalSrc, item, '| raw')
: item && item.src,
title: item && item.title,
caption: item && (item.description || item.caption)
title: item && (item.enlargeTitle || item.title),
caption:
item && (item.enlargeCaption || item.description || item.caption)
}))
},
this.props

View File

@ -878,11 +878,15 @@ export default class Table extends React.Component<TableProps, object> {
const store = this.props.store;
const column = store.filteredColumns[target.colIndex].pristine;
let index = target.rowIndex;
const list: Array<any> = [];
store.rows.forEach(row => {
store.rows.forEach((row, i) => {
const src = resolveVariable(column.name, row.data);
if (!src) {
if (i < target.rowIndex) {
index--;
}
return;
}
@ -891,8 +895,16 @@ export default class Table extends React.Component<TableProps, object> {
originalSrc: column.originalSrc
? filter(column.originalSrc, row.data)
: src,
title: column.title ? filter(column.title, row.data) : undefined,
caption: column.caption ? filter(column.caption, row.data) : undefined
title: column.enlargeTitle
? filter(column.enlargeTitle, row.data)
: column.title
? filter(column.title, row.data)
: undefined,
caption: column.enlargeCaption
? filter(column.enlargeCaption, row.data)
: column.caption
? filter(column.caption, row.data)
: undefined
});
});
@ -902,7 +914,7 @@ export default class Table extends React.Component<TableProps, object> {
{
...info,
list,
index: target.rowIndex
index
},
target
);