es-grid-template 1.8.63 → 1.8.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/grid-component/ColumnsGroup/ColumnsGroup.js +4 -1
- package/es/grid-component/TempTable.js +2 -2
- package/es/grid-component/hooks/utils.d.ts +2 -8
- package/es/grid-component/hooks/utils.js +175 -144
- package/es/grid-component/index.d.ts +1 -1
- package/es/grid-component/index.js +0 -4
- package/es/grid-component/type.d.ts +8 -0
- package/es/table-component/InternalTable.js +1 -4
- package/es/table-component/TableContainer.js +5 -5
- package/es/table-component/TableContainerEdit.js +158 -29
- package/es/table-component/body/TableBodyCellEdit.js +69 -31
- package/es/table-component/hook/utils.d.ts +2 -0
- package/es/table-component/hook/utils.js +39 -2
- package/es/table-component/table/Grid.js +10 -7
- package/es/table-component/table/TableWrapper.js +0 -2
- package/es/table-component/type.d.ts +9 -0
- package/es/table-component/useContext.d.ts +3 -1
- package/es/table-virtuoso/ColumnsGroup/ColumnsGroup.d.ts +12 -0
- package/es/table-virtuoso/ColumnsGroup/ColumnsGroup.js +232 -0
- package/es/table-virtuoso/ColumnsGroup/index.d.ts +1 -0
- package/es/table-virtuoso/ColumnsGroup/index.js +1 -0
- package/es/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
- package/es/table-virtuoso/InternalTable.js +413 -0
- package/es/table-virtuoso/body/TableBody.d.ts +14 -0
- package/es/table-virtuoso/body/TableBody.js +84 -0
- package/es/table-virtuoso/body/TableBodyCell.d.ts +14 -0
- package/es/table-virtuoso/body/TableBodyCell.js +466 -0
- package/es/table-virtuoso/body/TableBodyRow.d.ts +13 -0
- package/es/table-virtuoso/body/TableBodyRow.js +116 -0
- package/es/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
- package/es/table-virtuoso/footer/TableFooterCell.js +54 -0
- package/es/table-virtuoso/header/TableHeadCell.d.ts +14 -0
- package/es/table-virtuoso/header/TableHeadCell.js +265 -0
- package/es/table-virtuoso/header/renderFilter.d.ts +20 -0
- package/es/table-virtuoso/header/renderFilter.js +289 -0
- package/es/table-virtuoso/hook/constant.d.ts +73 -0
- package/es/table-virtuoso/hook/constant.js +240 -0
- package/es/table-virtuoso/hook/convert.d.ts +1 -0
- package/es/table-virtuoso/hook/convert.js +28 -0
- package/es/table-virtuoso/hook/useColumns.d.ts +28 -0
- package/es/table-virtuoso/hook/useColumns.js +302 -0
- package/es/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
- package/es/table-virtuoso/hook/useFilterOperator.js +33 -0
- package/es/table-virtuoso/hook/utils.d.ts +159 -0
- package/es/table-virtuoso/hook/utils.js +2263 -0
- package/es/table-virtuoso/index.d.ts +2 -0
- package/es/table-virtuoso/index.js +2 -0
- package/es/table-virtuoso/style.d.ts +22 -0
- package/es/table-virtuoso/style.js +11 -0
- package/es/table-virtuoso/style.scss +1440 -0
- package/es/table-virtuoso/table/Grid.d.ts +37 -0
- package/es/table-virtuoso/table/Grid.js +302 -0
- package/es/table-virtuoso/table/TableContainer.d.ts +49 -0
- package/es/table-virtuoso/table/TableContainer.js +305 -0
- package/es/table-virtuoso/table/TableWrapper.d.ts +20 -0
- package/es/table-virtuoso/table/TableWrapper.js +158 -0
- package/es/table-virtuoso/type.d.ts +0 -0
- package/es/table-virtuoso/type.js +785 -0
- package/es/table-virtuoso/useContext.d.ts +97 -0
- package/es/table-virtuoso/useContext.js +21 -0
- package/lib/grid-component/ColumnsGroup/ColumnsGroup.js +4 -1
- package/lib/grid-component/TempTable.js +2 -2
- package/lib/grid-component/hooks/utils.d.ts +2 -8
- package/lib/grid-component/hooks/utils.js +176 -152
- package/lib/grid-component/index.d.ts +1 -1
- package/lib/grid-component/index.js +0 -3
- package/lib/grid-component/type.d.ts +8 -0
- package/lib/table-component/InternalTable.js +1 -4
- package/lib/table-component/TableContainer.js +5 -5
- package/lib/table-component/TableContainerEdit.js +158 -29
- package/lib/table-component/body/TableBodyCellEdit.js +69 -31
- package/lib/table-component/hook/utils.d.ts +2 -0
- package/lib/table-component/hook/utils.js +45 -4
- package/lib/table-component/table/Grid.js +10 -7
- package/lib/table-component/table/TableWrapper.js +0 -2
- package/lib/table-component/type.d.ts +9 -0
- package/lib/table-component/useContext.d.ts +3 -1
- package/lib/table-virtuoso/ColumnsGroup/ColumnsGroup.d.ts +12 -0
- package/lib/table-virtuoso/ColumnsGroup/ColumnsGroup.js +243 -0
- package/lib/table-virtuoso/ColumnsGroup/index.d.ts +1 -0
- package/lib/table-virtuoso/ColumnsGroup/index.js +16 -0
- package/lib/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
- package/lib/table-virtuoso/InternalTable.js +422 -0
- package/lib/table-virtuoso/body/TableBody.d.ts +14 -0
- package/lib/table-virtuoso/body/TableBody.js +95 -0
- package/lib/table-virtuoso/body/TableBodyCell.d.ts +14 -0
- package/lib/table-virtuoso/body/TableBodyCell.js +473 -0
- package/lib/table-virtuoso/body/TableBodyRow.d.ts +13 -0
- package/lib/table-virtuoso/body/TableBodyRow.js +124 -0
- package/lib/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
- package/lib/table-virtuoso/footer/TableFooterCell.js +63 -0
- package/lib/table-virtuoso/header/TableHeadCell.d.ts +14 -0
- package/lib/table-virtuoso/header/TableHeadCell.js +274 -0
- package/lib/table-virtuoso/header/renderFilter.d.ts +20 -0
- package/lib/table-virtuoso/header/renderFilter.js +299 -0
- package/lib/table-virtuoso/hook/constant.d.ts +73 -0
- package/lib/table-virtuoso/hook/constant.js +247 -0
- package/lib/table-virtuoso/hook/convert.d.ts +1 -0
- package/lib/table-virtuoso/hook/convert.js +34 -0
- package/lib/table-virtuoso/hook/useColumns.d.ts +28 -0
- package/lib/table-virtuoso/hook/useColumns.js +315 -0
- package/lib/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
- package/lib/table-virtuoso/hook/useFilterOperator.js +40 -0
- package/lib/table-virtuoso/hook/utils.d.ts +159 -0
- package/lib/table-virtuoso/hook/utils.js +2389 -0
- package/lib/table-virtuoso/index.d.ts +2 -0
- package/lib/table-virtuoso/index.js +9 -0
- package/lib/table-virtuoso/style.d.ts +22 -0
- package/lib/table-virtuoso/style.js +18 -0
- package/lib/table-virtuoso/style.scss +1440 -0
- package/lib/table-virtuoso/table/Grid.d.ts +37 -0
- package/lib/table-virtuoso/table/Grid.js +311 -0
- package/lib/table-virtuoso/table/TableContainer.d.ts +49 -0
- package/lib/table-virtuoso/table/TableContainer.js +313 -0
- package/lib/table-virtuoso/table/TableWrapper.d.ts +20 -0
- package/lib/table-virtuoso/table/TableWrapper.js +164 -0
- package/lib/table-virtuoso/type.d.ts +0 -0
- package/lib/table-virtuoso/type.js +786 -0
- package/lib/table-virtuoso/useContext.d.ts +97 -0
- package/lib/table-virtuoso/useContext.js +27 -0
- package/package.json +2 -1
- package/es/grid-component/ConvertColumnTable.d.ts +0 -7
- package/es/grid-component/ConvertColumnTable.js +0 -144
- package/es/grid-component/InternalTable.js +0 -1170
- package/es/grid-component/table/Grid.d.ts +0 -23
- package/es/grid-component/table/Grid.js +0 -49
- package/es/grid-component/table/GridEdit.d.ts +0 -23
- package/es/grid-component/table/GridEdit.js +0 -2726
- package/es/grid-component/table/Group.d.ts +0 -21
- package/es/grid-component/table/Group.js +0 -195
- package/es/grid-component/table/InfiniteTable.d.ts +0 -23
- package/es/grid-component/table/InfiniteTable.js +0 -101
- package/lib/grid-component/ConvertColumnTable.d.ts +0 -7
- package/lib/grid-component/ConvertColumnTable.js +0 -153
- package/lib/grid-component/InternalTable.js +0 -1178
- package/lib/grid-component/table/Grid.d.ts +0 -23
- package/lib/grid-component/table/Grid.js +0 -58
- package/lib/grid-component/table/GridEdit.d.ts +0 -23
- package/lib/grid-component/table/GridEdit.js +0 -2723
- package/lib/grid-component/table/Group.d.ts +0 -21
- package/lib/grid-component/table/Group.js +0 -204
- package/lib/grid-component/table/InfiniteTable.d.ts +0 -23
- package/lib/grid-component/table/InfiniteTable.js +0 -109
|
@@ -27,9 +27,12 @@ export const ColumnsGroup = props => {
|
|
|
27
27
|
const menuRef = useRef();
|
|
28
28
|
const [tempGroup, setTempGroup] = useState([]);
|
|
29
29
|
const [clicked, setClicked] = useState(false);
|
|
30
|
+
console.log('columns', columns);
|
|
31
|
+
console.log('columnsGrouped', columnsGrouped);
|
|
30
32
|
const rsCol = React.useMemo(() => {
|
|
31
|
-
return columns.filter(it => it.
|
|
33
|
+
return columns.filter(it => it.visible !== false && !tempGroup.includes(it.field) && it.field !== '#' && it.field !== 'selection_column' && it.field !== 'command');
|
|
32
34
|
}, [columns, tempGroup]);
|
|
35
|
+
console.log('rsCol', rsCol);
|
|
33
36
|
const options = React.useMemo(() => {
|
|
34
37
|
return rsCol.map(it => ({
|
|
35
38
|
...it,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import React, { Fragment } from 'react';
|
|
3
3
|
import Table from "../table-component";
|
|
4
|
-
import
|
|
4
|
+
import TableGroup from "../table-virtuoso";
|
|
5
5
|
const TempTable = props => {
|
|
6
6
|
const {
|
|
7
7
|
groupAble,
|
|
8
8
|
editAble,
|
|
9
9
|
...rest
|
|
10
10
|
} = props;
|
|
11
|
-
const TabComponent = groupAble ?
|
|
11
|
+
const TabComponent = groupAble ? TableGroup : Table;
|
|
12
12
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(TabComponent, _extends({}, rest, {
|
|
13
13
|
groupAble: groupAble,
|
|
14
14
|
editAble: editAble
|
|
@@ -2,7 +2,6 @@ import type * as React from "react";
|
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
import type { EditType, IColumnType, TypeFilter } from "rc-master-ui";
|
|
4
4
|
import type { ColumnTable, GetRowKey, IFormat } from "../type";
|
|
5
|
-
import type { SelectionSettings } from "../type";
|
|
6
5
|
import type { AnyObject } from "../type";
|
|
7
6
|
import type { Key } from "react";
|
|
8
7
|
import type { ColumnsTable } from "./../index";
|
|
@@ -50,9 +49,8 @@ export declare const checkFieldKey: (key: string | undefined) => string;
|
|
|
50
49
|
export declare const convertLabelToTitle: (data: any[]) => any[];
|
|
51
50
|
export declare const convertArrayWithIndent: (inputArray: any[], parentIndent?: number) => any[];
|
|
52
51
|
export declare const getTemplate: (template: any, column?: ColumnTable) => React.ReactNode | React.ReactElement;
|
|
53
|
-
export declare const totalFixedWidth: <T>(columns: ColumnsTable<T>, type: 'left' | 'right', selectionSettings?: SelectionSettings) => number;
|
|
54
52
|
export declare const isObjEmpty: (obj: any) => boolean;
|
|
55
|
-
export declare const getColumnsVisible: <T>(columns: ColumnsTable<T>, index: number) => ColumnTable<T>[];
|
|
53
|
+
export declare const getColumnsVisible: <T>(columns: ColumnsTable<T>, index: number) => import("../../table-component/type").ColumnTable<T>[];
|
|
56
54
|
export declare const updateData: <Record = AnyObject>(initData: Record[], rows: Record[], key: keyof Record) => Record[];
|
|
57
55
|
export declare const parseBooleanToValue: (value: boolean, type: 'boolean' | 'number') => number | boolean;
|
|
58
56
|
export declare const genPresets: (presets?: import("@ant-design/colors").PalettesProps) => import("antd/es/color-picker/interface").PresetsItem[];
|
|
@@ -103,15 +101,11 @@ export declare function addRowsUp(array: any, n: number): {
|
|
|
103
101
|
combined: any[];
|
|
104
102
|
addedRows: any[];
|
|
105
103
|
};
|
|
106
|
-
export declare const transformColumns: <RecordType>(cols: ColumnsTable<RecordType>, convertColumns: any[], t?: any) => ColumnsTable<RecordType>;
|
|
107
|
-
export declare const transformColumns1: <RecordType>(cols: ColumnsTable<RecordType>, sortMultiple?: boolean) => ColumnsTable<RecordType>;
|
|
108
|
-
export declare const removeColumns: <RecordType>(columns: ColumnTable<RecordType>[], groupColumns: string[]) => ColumnsTable<RecordType>;
|
|
109
104
|
export declare const convertFlatColumn: (array: ColumnsTable) => ColumnsTable[];
|
|
110
|
-
export declare const convertColumns: <RecordType>(cols: ColumnsTable<RecordType>) => ColumnsTable<RecordType>;
|
|
111
105
|
export declare const checkChild: (inputArray: any[]) => boolean;
|
|
112
106
|
export declare const isEditable: <RecordType>(column: ColumnTable, rowData: RecordType) => boolean | ((rowData: any) => boolean);
|
|
113
107
|
export declare const isArraysEqual: (arr1: any[], arr2: any[]) => boolean;
|
|
114
|
-
export declare const editAbleColumns: <T>(columns: ColumnsTable<T>) => ColumnTable<T>[];
|
|
108
|
+
export declare const editAbleColumns: <T>(columns: ColumnsTable<T>) => import("../../table-component/type").ColumnTable<T>[];
|
|
115
109
|
export declare const findItemPath: (tree: any[], targetItem: any, rowKey: any, currentPage?: number, pageSize?: number) => any;
|
|
116
110
|
export declare const filterDataByColumns: (data: any[], queries: any) => any[];
|
|
117
111
|
export declare const filterDataByColumns2: (data: any[], queries: any) => any[];
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import dayjs from "dayjs";
|
|
2
2
|
import moment from "moment/moment";
|
|
3
|
+
// import type {SelectionSettings} from "../type"
|
|
4
|
+
|
|
3
5
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
6
|
import { presetPalettes } from "@ant-design/colors";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
7
|
+
// import {Table} from "rc-master-ui"
|
|
8
|
+
// import {flatColumns2} from "./columns"
|
|
9
|
+
// import {SELECTION_COLUMN} from "./useColumns"
|
|
10
|
+
|
|
8
11
|
export const newGuid = () => {
|
|
9
12
|
for (let i = 0; i < 20; i++) {
|
|
10
13
|
// @ts-ignore
|
|
@@ -387,15 +390,22 @@ export const getTemplate = (template, column) => {
|
|
|
387
390
|
}
|
|
388
391
|
return template;
|
|
389
392
|
};
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
393
|
+
|
|
394
|
+
// export const totalFixedWidth = <T, >(columns: ColumnsTable<T>, type: 'left' | 'right', selectionSettings?: SelectionSettings) => {
|
|
395
|
+
// const totalFixedLeftWidth: number = columns
|
|
396
|
+
// .filter(column => column.fixed === type) // Lọc các cột có fixed
|
|
397
|
+
// .reduce((sum, column) => {
|
|
398
|
+
// const width = typeof column.width === 'number' ? column.width : parseInt(column.width as string, 10) || 0 // Chuyển từ chuỗi sang số, nếu không hợp lệ thì lấy 0
|
|
399
|
+
// return sum + width
|
|
400
|
+
// }, 0)
|
|
401
|
+
|
|
402
|
+
// const selectColumnWidth: number = !selectionSettings?.mode ? 0 : (
|
|
403
|
+
// typeof selectionSettings?.columnWidth === 'number' ? selectionSettings?.columnWidth : parseInt(selectionSettings?.columnWidth as string, 10) || 50)
|
|
404
|
+
|
|
405
|
+
// return totalFixedLeftWidth + selectColumnWidth
|
|
406
|
+
|
|
407
|
+
// }
|
|
408
|
+
|
|
399
409
|
export const isObjEmpty = obj => {
|
|
400
410
|
if (isNullOrUndefined(obj)) {
|
|
401
411
|
return true;
|
|
@@ -1146,93 +1156,112 @@ export function addRowsUp(array, n) {
|
|
|
1146
1156
|
addedRows
|
|
1147
1157
|
};
|
|
1148
1158
|
}
|
|
1149
|
-
export const transformColumns = (cols, convertColumns, t) => {
|
|
1150
|
-
// @ts-ignore
|
|
1151
|
-
return cols.map(column => {
|
|
1152
|
-
const find = convertColumns.find(it => it.key === column.field);
|
|
1153
|
-
if (!column?.field && !column?.key) {
|
|
1154
|
-
return Table.SELECTION_COLUMN;
|
|
1155
|
-
}
|
|
1156
|
-
if (find) {
|
|
1157
|
-
return {
|
|
1158
|
-
...find
|
|
1159
|
-
};
|
|
1160
|
-
}
|
|
1161
1159
|
|
|
1162
|
-
|
|
1163
|
-
if (column.children?.length) {
|
|
1164
|
-
return {
|
|
1165
|
-
...column,
|
|
1166
|
-
key: column.field ?? column.dataIndex ?? column.key,
|
|
1167
|
-
title: t ? t(column.headerText) : column.headerText,
|
|
1168
|
-
ellipsis: column.ellipsis !== false,
|
|
1169
|
-
align: column.textAlign ?? column.align,
|
|
1170
|
-
children: transformColumns(column.children, convertColumns)
|
|
1171
|
-
};
|
|
1172
|
-
}
|
|
1173
|
-
});
|
|
1174
|
-
};
|
|
1175
|
-
export const transformColumns1 = (cols, sortMultiple) => {
|
|
1176
|
-
const convertColumns = flatColumns2(cols).map((column, colIndex) => {
|
|
1177
|
-
if (!column?.field && !column?.key) {
|
|
1178
|
-
return Table.SELECTION_COLUMN;
|
|
1179
|
-
}
|
|
1180
|
-
if (column.dataIndex === '#' || column.dataIndex === '#') {
|
|
1181
|
-
return {
|
|
1182
|
-
...column
|
|
1183
|
-
};
|
|
1184
|
-
}
|
|
1185
|
-
if ((column.key || column.field) === 'command') {
|
|
1186
|
-
return {
|
|
1187
|
-
...column
|
|
1188
|
-
};
|
|
1189
|
-
}
|
|
1190
|
-
return {
|
|
1191
|
-
...column,
|
|
1192
|
-
key: column.field ?? column.dataIndex ?? column.key,
|
|
1193
|
-
sorter: column.sorter === false ? undefined : {
|
|
1194
|
-
compare: a => a,
|
|
1195
|
-
multiple: sortMultiple ? colIndex : undefined
|
|
1196
|
-
}
|
|
1197
|
-
};
|
|
1198
|
-
});
|
|
1160
|
+
// export const transformColumns = <RecordType, >(cols: ColumnsTable<RecordType>, convertColumns: any[], t?: any): ColumnsTable<RecordType> => {
|
|
1199
1161
|
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1162
|
+
// // @ts-ignore
|
|
1163
|
+
// return cols.map((column) => {
|
|
1164
|
+
|
|
1165
|
+
// const find = convertColumns.find((it) => it.key === column.field)
|
|
1166
|
+
|
|
1167
|
+
// if (!column?.field && !column?.key) {
|
|
1168
|
+
// return Table.SELECTION_COLUMN
|
|
1169
|
+
// }
|
|
1170
|
+
|
|
1171
|
+
// if (find) {
|
|
1172
|
+
// return {...find}
|
|
1173
|
+
// }
|
|
1174
|
+
|
|
1175
|
+
// // Xử lý đệ quy cho children
|
|
1176
|
+
// if (column.children?.length) {
|
|
1177
|
+
// return {
|
|
1178
|
+
// ...column,
|
|
1179
|
+
// key: column.field ?? column.dataIndex ?? column.key,
|
|
1180
|
+
// title: t ? t(column.headerText) : column.headerText,
|
|
1181
|
+
// ellipsis: column.ellipsis !== false,
|
|
1182
|
+
// align: column.textAlign ?? column.align,
|
|
1183
|
+
// children: transformColumns(column.children, convertColumns)
|
|
1184
|
+
// }
|
|
1185
|
+
// }
|
|
1186
|
+
|
|
1187
|
+
// })
|
|
1188
|
+
|
|
1189
|
+
// }
|
|
1190
|
+
|
|
1191
|
+
// export const transformColumns1 = <RecordType, >(cols: ColumnsTable<RecordType>, sortMultiple?: boolean): ColumnsTable<RecordType> => {
|
|
1192
|
+
|
|
1193
|
+
// const convertColumns = flatColumns2(cols).map((column: any, colIndex) => {
|
|
1194
|
+
|
|
1195
|
+
// if (!column?.field && !column?.key) {
|
|
1196
|
+
// return Table.SELECTION_COLUMN
|
|
1197
|
+
// }
|
|
1198
|
+
|
|
1199
|
+
// if (column.dataIndex === '#' || column.dataIndex === '#') {
|
|
1200
|
+
// return {
|
|
1201
|
+
// ...column
|
|
1202
|
+
|
|
1203
|
+
// }
|
|
1204
|
+
// }
|
|
1205
|
+
|
|
1206
|
+
// if ((column.key || column.field) === 'command') {
|
|
1207
|
+
// return {
|
|
1208
|
+
// ...column
|
|
1209
|
+
// }
|
|
1210
|
+
// }
|
|
1211
|
+
|
|
1212
|
+
// return {
|
|
1213
|
+
// ...column,
|
|
1214
|
+
// key: column.field ?? column.dataIndex ?? column.key,
|
|
1215
|
+
// sorter: (column.sorter === false ? undefined : {
|
|
1216
|
+
// compare: (a: any) => a,
|
|
1217
|
+
// multiple: sortMultiple ? colIndex : undefined
|
|
1218
|
+
// })
|
|
1219
|
+
// }
|
|
1220
|
+
|
|
1221
|
+
// })
|
|
1222
|
+
|
|
1223
|
+
// // @ts-ignore
|
|
1224
|
+
// return cols.map((column) => {
|
|
1225
|
+
|
|
1226
|
+
// const find = convertColumns.find((it) => it.key === column.field)
|
|
1227
|
+
|
|
1228
|
+
// if (!column?.field && !column?.key) {
|
|
1229
|
+
// return Table.SELECTION_COLUMN
|
|
1230
|
+
// }
|
|
1231
|
+
|
|
1232
|
+
// if (find) {
|
|
1233
|
+
// return {...find}
|
|
1234
|
+
// }
|
|
1235
|
+
|
|
1236
|
+
// // Xử lý đệ quy cho children
|
|
1237
|
+
// if (column.children?.length) {
|
|
1238
|
+
// return {
|
|
1239
|
+
// ...column,
|
|
1240
|
+
// key: column.field ?? column.dataIndex ?? column.key,
|
|
1241
|
+
// ellipsis: column.ellipsis !== false,
|
|
1242
|
+
// align: column.textAlign ?? column.align,
|
|
1243
|
+
// children: transformColumns(column.children, convertColumns)
|
|
1244
|
+
// }
|
|
1245
|
+
// }
|
|
1246
|
+
|
|
1247
|
+
// })
|
|
1248
|
+
|
|
1249
|
+
// }
|
|
1250
|
+
|
|
1251
|
+
// export const removeColumns = <RecordType, >(columns: ColumnTable<RecordType>[], groupColumns: string[]): ColumnsTable<RecordType> => {
|
|
1252
|
+
|
|
1253
|
+
// const ttt: ColumnTable<RecordType>[] = [...columns]
|
|
1254
|
+
|
|
1255
|
+
// return ttt.filter(column => !groupColumns.includes(column.field as string)).map((column) => {
|
|
1256
|
+
// const newCol = {...column}
|
|
1257
|
+
// if (newCol?.children && newCol?.children.length > 0) {
|
|
1258
|
+
// newCol.children = removeColumns(newCol.children, groupColumns) as any[]
|
|
1259
|
+
// }
|
|
1260
|
+
// return newCol
|
|
1261
|
+
// })
|
|
1262
|
+
|
|
1263
|
+
// }
|
|
1211
1264
|
|
|
1212
|
-
// Xử lý đệ quy cho children
|
|
1213
|
-
if (column.children?.length) {
|
|
1214
|
-
return {
|
|
1215
|
-
...column,
|
|
1216
|
-
key: column.field ?? column.dataIndex ?? column.key,
|
|
1217
|
-
ellipsis: column.ellipsis !== false,
|
|
1218
|
-
align: column.textAlign ?? column.align,
|
|
1219
|
-
children: transformColumns(column.children, convertColumns)
|
|
1220
|
-
};
|
|
1221
|
-
}
|
|
1222
|
-
});
|
|
1223
|
-
};
|
|
1224
|
-
export const removeColumns = (columns, groupColumns) => {
|
|
1225
|
-
const ttt = [...columns];
|
|
1226
|
-
return ttt.filter(column => !groupColumns.includes(column.field)).map(column => {
|
|
1227
|
-
const newCol = {
|
|
1228
|
-
...column
|
|
1229
|
-
};
|
|
1230
|
-
if (newCol?.children && newCol?.children.length > 0) {
|
|
1231
|
-
newCol.children = removeColumns(newCol.children, groupColumns);
|
|
1232
|
-
}
|
|
1233
|
-
return newCol;
|
|
1234
|
-
});
|
|
1235
|
-
};
|
|
1236
1265
|
export const convertFlatColumn = array => {
|
|
1237
1266
|
const tmp = [...array];
|
|
1238
1267
|
let result = [];
|
|
@@ -1245,54 +1274,56 @@ export const convertFlatColumn = array => {
|
|
|
1245
1274
|
});
|
|
1246
1275
|
return result;
|
|
1247
1276
|
};
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
}
|
|
1277
|
+
|
|
1278
|
+
// export const convertColumns = <RecordType, >(cols: ColumnsTable<RecordType>): ColumnsTable<RecordType> => {
|
|
1279
|
+
|
|
1280
|
+
// return cols.map((col) => {
|
|
1281
|
+
|
|
1282
|
+
// if (col === SELECTION_COLUMN) {
|
|
1283
|
+
// return SELECTION_COLUMN
|
|
1284
|
+
// }
|
|
1285
|
+
|
|
1286
|
+
// const transformedColumn = {
|
|
1287
|
+
// ...col,
|
|
1288
|
+
// dataIndex: col.field ?? col.dataIndex,
|
|
1289
|
+
// key: col.field ?? col.dataIndex ?? col.key,
|
|
1290
|
+
// // title: t ? t(col.columnGroupText ?? col.headerText ?? col.title) : col.columnGroupText ?? col.headerText ?? col.title,
|
|
1291
|
+
// // title: () => (<span>aaa</span>),
|
|
1292
|
+
// // title: () => (<HeaderContent column={{...col} as any} t={t}/>),
|
|
1293
|
+
// // title: () => (<span>{t ? t(col.columnGroupText ?? col.headerText ?? col.title) : col.columnGroupText ?? col.headerText ?? col.title}</span>),
|
|
1294
|
+
// ellipsis: col.ellipsis !== false,
|
|
1295
|
+
// align: col.textAlign ?? col.align,
|
|
1296
|
+
// fixed: col.fixedType ?? col.fixed
|
|
1297
|
+
// }
|
|
1298
|
+
|
|
1299
|
+
// if (transformedColumn.children && transformedColumn.children?.length) {
|
|
1300
|
+
// return {
|
|
1301
|
+
// ...transformedColumn,
|
|
1302
|
+
// children: convertColumns(transformedColumn.children)
|
|
1303
|
+
// }
|
|
1304
|
+
// }
|
|
1305
|
+
|
|
1306
|
+
// if (["index", "#"].includes(col.field as string)) {
|
|
1307
|
+
// return {
|
|
1308
|
+
// ...transformedColumn,
|
|
1309
|
+
// onCell: () => ({className: 'cell-number'}),
|
|
1310
|
+
// render: (_: any, __: any, rowIndex: number) => rowIndex + 1
|
|
1311
|
+
// }
|
|
1312
|
+
// }
|
|
1313
|
+
|
|
1314
|
+
// if (col.key === 'command') {
|
|
1315
|
+
// return {
|
|
1316
|
+
// ...transformedColumn,
|
|
1317
|
+
// onCell: () => ({className: 'cell-number', style: {padding: '2px 8px'}})
|
|
1318
|
+
// }
|
|
1319
|
+
// }
|
|
1320
|
+
|
|
1321
|
+
// return {
|
|
1322
|
+
// ...transformedColumn
|
|
1323
|
+
// }
|
|
1324
|
+
// })
|
|
1325
|
+
// }
|
|
1326
|
+
|
|
1296
1327
|
export const checkChild = inputArray => {
|
|
1297
1328
|
return inputArray.some(item => item.children && item.children.length > 0);
|
|
1298
1329
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import TempTable from './TempTable';
|
|
2
|
-
import type { ColumnsTable, TableProps, ColumnTable, CommandItem, ContextMenuItem } from '
|
|
2
|
+
import type { ColumnsTable, TableProps, ColumnTable, CommandItem, ContextMenuItem } from '../table-component/type';
|
|
3
3
|
import type { ToolbarItem } from "rc-master-ui/es/toolbar";
|
|
4
4
|
export type { ColumnsTable, TableProps, ColumnTable, ToolbarItem, CommandItem, ContextMenuItem };
|
|
5
5
|
export default TempTable;
|
|
@@ -285,6 +285,7 @@ export interface TableProps<RecordType = AnyObject> extends Omit<RcTableProps<Re
|
|
|
285
285
|
onRowStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | ((data: RecordType, row: Row<RecordType>) => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
|
|
286
286
|
onRowHeaderStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
|
|
287
287
|
onRowFooterStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
|
|
288
|
+
fullScreenTitle?: ReactNode | (() => ReactNode);
|
|
288
289
|
}
|
|
289
290
|
export type PaginationConfig = TablePaginationConfig & {
|
|
290
291
|
currentPage?: number;
|
|
@@ -311,14 +312,21 @@ export interface CommandItem {
|
|
|
311
312
|
client?: boolean;
|
|
312
313
|
confirmDialog?: boolean;
|
|
313
314
|
}
|
|
315
|
+
export type GroupTemplate = {
|
|
316
|
+
rowData: any;
|
|
317
|
+
value: any;
|
|
318
|
+
column: ColumnTable;
|
|
319
|
+
};
|
|
314
320
|
export type IGroupSetting = {
|
|
315
321
|
client?: boolean;
|
|
316
322
|
onGroup?: (props: IOnGroup) => void;
|
|
317
323
|
groupColumnSpan?: number;
|
|
318
324
|
hiddenColumnGroup?: boolean;
|
|
325
|
+
showHeaderColumn?: boolean;
|
|
319
326
|
showGroupIcon?: boolean;
|
|
320
327
|
unClearableLevel?: 1 | 2 | 3 | undefined;
|
|
321
328
|
sumGroup?: boolean;
|
|
329
|
+
groupTemplate?: React.ReactNode | React.ReactElement | ((args: GroupTemplate) => React.ReactNode | React.ReactElement);
|
|
322
330
|
};
|
|
323
331
|
type IOnGroup = {
|
|
324
332
|
columnGrouped: string[];
|
|
@@ -200,10 +200,7 @@ const InternalTable = props => {
|
|
|
200
200
|
triggerSorter: setSorterStates,
|
|
201
201
|
setMergedFilterKeys: setMergedFilterKeys,
|
|
202
202
|
mergedFilterKeys: mergedFilterKeys,
|
|
203
|
-
expanded: expanded
|
|
204
|
-
// onContextMenu={onContextMenu}
|
|
205
|
-
// contextMenuItems={contextMenuItems}
|
|
206
|
-
,
|
|
203
|
+
expanded: expanded,
|
|
207
204
|
editAble: isFullScreen ? false : editAble,
|
|
208
205
|
triggerChangeColumns: triggerChangeColumns,
|
|
209
206
|
setExpanded: setExpanded,
|
|
@@ -185,10 +185,6 @@ const TableContainer = props => {
|
|
|
185
185
|
ref: topToolbarRef,
|
|
186
186
|
className: classNames(`${prefix}-grid-top-toolbar`, {})
|
|
187
187
|
}, /*#__PURE__*/React.createElement("div", {
|
|
188
|
-
style: {
|
|
189
|
-
textAlign: 'center'
|
|
190
|
-
}
|
|
191
|
-
}, typeof title === 'function' ? title?.(originData) : title), /*#__PURE__*/React.createElement("div", {
|
|
192
188
|
style: {
|
|
193
189
|
display: 'flex',
|
|
194
190
|
justifyContent: 'space-between',
|
|
@@ -239,7 +235,11 @@ const TableContainer = props => {
|
|
|
239
235
|
t: t,
|
|
240
236
|
columnsGroup: groupColumns,
|
|
241
237
|
triggerChangeColumns: triggerChangeColumns
|
|
242
|
-
})))
|
|
238
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
239
|
+
style: {
|
|
240
|
+
textAlign: 'center'
|
|
241
|
+
}
|
|
242
|
+
}, typeof title === 'function' ? title?.(originData) : title)), /*#__PURE__*/React.createElement(TableContext.Provider, {
|
|
243
243
|
value: {
|
|
244
244
|
t,
|
|
245
245
|
locale,
|