mirror of
https://github.com/VisActor/VTable
synced 2024-11-22 01:52:03 +00:00
fix: fix originCol/Row in custom computation
This commit is contained in:
parent
7c471456f8
commit
3cc65b46bc
@ -31,7 +31,7 @@ export const CustomLayout: React.FC<CustomLayoutProps> = (props: PropsWithChildr
|
||||
// customLayout function for vtable
|
||||
const createGraphic: ICustomLayoutFuc = useCallback(
|
||||
args => {
|
||||
const key = `${(args as any).originCol}-${(args as any).originRow}`;
|
||||
const key = `${args.originCol ?? args.col}-${args.originRow ?? args.row}`;
|
||||
let group;
|
||||
if (container.current.has(key)) {
|
||||
const currentContainer = container.current.get(key);
|
||||
|
@ -456,21 +456,24 @@ function computeCustomRenderWidth(col: number, row: number, table: BaseTableAPI)
|
||||
let width = 0;
|
||||
let renderDefault = false;
|
||||
let enableCellPadding = false;
|
||||
let cellRange;
|
||||
if (
|
||||
table.isHeader(col, row) ||
|
||||
(table.getBodyColumnDefine(col, row) as TextColumnDefine)?.mergeCell ||
|
||||
table.hasCustomMerge()
|
||||
) {
|
||||
const cellRange = table.getCellRange(col, row);
|
||||
cellRange = table.getCellRange(col, row);
|
||||
spanCol = cellRange.end.col - cellRange.start.col + 1;
|
||||
}
|
||||
const arg = {
|
||||
col,
|
||||
row,
|
||||
col: cellRange?.start.col ?? col,
|
||||
row: cellRange?.start.row ?? row,
|
||||
dataValue: table.getCellOriginValue(col, row),
|
||||
value: table.getCellValue(col, row) || '',
|
||||
rect: getCellRect(col, row, table),
|
||||
table
|
||||
table,
|
||||
originCol: col,
|
||||
originRow: row
|
||||
};
|
||||
if (customLayout === 'react-custom-layout') {
|
||||
// customLayout = table._reactCreateGraphic;
|
||||
|
@ -549,21 +549,24 @@ function computeCustomRenderHeight(col: number, row: number, table: BaseTableAPI
|
||||
let height = 0;
|
||||
let renderDefault = false;
|
||||
let enableCellPadding = false;
|
||||
let cellRange;
|
||||
if (
|
||||
table.isHeader(col, row) ||
|
||||
(table.getBodyColumnDefine(col, row) as TextColumnDefine)?.mergeCell ||
|
||||
table.hasCustomMerge()
|
||||
) {
|
||||
const cellRange = table.getCellRange(col, row);
|
||||
cellRange = table.getCellRange(col, row);
|
||||
spanRow = cellRange.end.row - cellRange.start.row + 1;
|
||||
}
|
||||
const arg = {
|
||||
col,
|
||||
row,
|
||||
col: cellRange?.start.col ?? col,
|
||||
row: cellRange?.start.row ?? row,
|
||||
dataValue: table.getCellOriginValue(col, row),
|
||||
value: table.getCellValue(col, row) || '',
|
||||
rect: getCellRect(col, row, table),
|
||||
table
|
||||
table,
|
||||
originCol: col,
|
||||
originRow: row
|
||||
};
|
||||
if (customLayout === 'react-custom-layout') {
|
||||
// customLayout = table._reactCreateGraphic;
|
||||
|
@ -11,6 +11,8 @@ export interface CustomRenderFunctionArg {
|
||||
/**原始值 */
|
||||
dataValue: FieldData;
|
||||
rect?: RectProps;
|
||||
originCol?: number;
|
||||
originRow?: number;
|
||||
}
|
||||
interface baseElement {
|
||||
elementKey?: string;
|
||||
|
Loading…
Reference in New Issue
Block a user