|
@@ -4,14 +4,13 @@ import {
|
|
|
getCoreRowModel,
|
|
getCoreRowModel,
|
|
|
} from '@tanstack/react-table';
|
|
} from '@tanstack/react-table';
|
|
|
import {ColumnType} from 'antd/es/table';
|
|
import {ColumnType} from 'antd/es/table';
|
|
|
-import {useMemo, useRef, useState} from 'react';
|
|
|
|
|
|
|
+import {useRef, useState} from 'react';
|
|
|
|
|
|
|
|
function parseColumn<T>(columns: ColumnType<T>[]) {
|
|
function parseColumn<T>(columns: ColumnType<T>[]) {
|
|
|
const hepler = createColumnHelper<Record<string, any>>();
|
|
const hepler = createColumnHelper<Record<string, any>>();
|
|
|
|
|
|
|
|
const tableColumns = columns.map(function (val) {
|
|
const tableColumns = columns.map(function (val) {
|
|
|
- console.log(val);
|
|
|
|
|
- const {dataIndex, title, render} = val;
|
|
|
|
|
|
|
+ const {dataIndex, title, render, align} = val;
|
|
|
if (render) {
|
|
if (render) {
|
|
|
return hepler.display({
|
|
return hepler.display({
|
|
|
id: dataIndex?.toString() ?? 'id',
|
|
id: dataIndex?.toString() ?? 'id',
|
|
@@ -23,11 +22,15 @@ function parseColumn<T>(columns: ColumnType<T>[]) {
|
|
|
props.row.index,
|
|
props.row.index,
|
|
|
);
|
|
);
|
|
|
},
|
|
},
|
|
|
|
|
+ meta: {align},
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
return hepler.accessor(dataIndex!.toString(), {
|
|
return hepler.accessor(dataIndex!.toString(), {
|
|
|
header: title?.toString(),
|
|
header: title?.toString(),
|
|
|
cell: props => props.getValue(),
|
|
cell: props => props.getValue(),
|
|
|
|
|
+ minSize: 0,
|
|
|
|
|
+ meta: {align},
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|