es-grid-template 1.8.64 → 1.8.66
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/TempTable.d.ts +2 -2
- package/es/grid-component/TempTable.js +5 -5
- package/es/grid-component/hooks/index.js +0 -1
- package/es/grid-component/hooks/useLazyKVMap.d.ts +1 -1
- package/es/grid-component/hooks/useLazyKVMap.js +0 -4
- package/es/grid-component/hooks/utils.d.ts +1 -8
- package/es/grid-component/hooks/utils.js +176 -144
- package/es/grid-component/index.d.ts +1 -1
- package/es/grid-component/index.js +0 -4
- package/es/grid-component/styles.scss +1394 -1394
- package/es/grid-component/type.d.ts +0 -407
- package/es/grid-component/type.js +490 -1
- package/es/table-component/type.d.ts +10 -0
- package/es/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.js +4 -3
- package/es/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
- package/es/table-virtuoso/InternalTable.js +391 -0
- package/es/table-virtuoso/body/TableBodyCell.d.ts +14 -0
- package/es/table-virtuoso/body/TableBodyCell.js +457 -0
- package/es/table-virtuoso/body/TableBodyRow.d.ts +13 -0
- package/es/table-virtuoso/body/TableBodyRow.js +112 -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 +12 -0
- package/es/table-virtuoso/style.scss +1441 -0
- package/es/table-virtuoso/table/Grid.d.ts +37 -0
- package/es/table-virtuoso/table/Grid.js +298 -0
- package/es/table-virtuoso/table/TableContainer.d.ts +49 -0
- package/es/table-virtuoso/table/TableContainer.js +292 -0
- package/es/table-virtuoso/table/TableWrapper.d.ts +22 -0
- package/es/table-virtuoso/table/TableWrapper.js +161 -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/TempTable.d.ts +2 -2
- package/lib/grid-component/TempTable.js +5 -7
- package/lib/grid-component/hooks/useLazyKVMap.d.ts +1 -1
- package/lib/grid-component/hooks/useLazyKVMap.js +0 -3
- package/lib/grid-component/hooks/utils.d.ts +1 -8
- package/lib/grid-component/hooks/utils.js +179 -152
- package/lib/grid-component/index.d.ts +1 -1
- package/lib/grid-component/index.js +0 -3
- package/lib/grid-component/styles.scss +1394 -1394
- package/lib/grid-component/type.d.ts +0 -407
- package/lib/grid-component/type.js +490 -4
- package/lib/table-component/type.d.ts +10 -0
- package/lib/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.js +4 -3
- package/lib/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
- package/lib/table-virtuoso/InternalTable.js +400 -0
- package/lib/table-virtuoso/body/TableBodyCell.d.ts +14 -0
- package/lib/table-virtuoso/body/TableBodyCell.js +464 -0
- package/lib/table-virtuoso/body/TableBodyRow.d.ts +13 -0
- package/lib/table-virtuoso/body/TableBodyRow.js +119 -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 +19 -0
- package/lib/table-virtuoso/style.scss +1441 -0
- package/lib/table-virtuoso/table/Grid.d.ts +37 -0
- package/lib/table-virtuoso/table/Grid.js +307 -0
- package/lib/table-virtuoso/table/TableContainer.d.ts +49 -0
- package/lib/table-virtuoso/table/TableContainer.js +300 -0
- package/lib/table-virtuoso/table/TableWrapper.d.ts +22 -0
- package/lib/table-virtuoso/table/TableWrapper.js +166 -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/AdvanceFilter.d.ts +0 -14
- package/es/grid-component/AdvanceFilter.js +0 -454
- package/es/grid-component/CheckboxFilter.d.ts +0 -20
- package/es/grid-component/CheckboxFilter.js +0 -244
- package/es/grid-component/CheckboxFilter2.d.ts +0 -20
- package/es/grid-component/CheckboxFilter2.js +0 -244
- package/es/grid-component/ColumnsChoose.d.ts +0 -10
- package/es/grid-component/ColumnsChoose.js +0 -230
- package/es/grid-component/Command.d.ts +0 -8
- package/es/grid-component/Command.js +0 -80
- package/es/grid-component/ContextMenu.d.ts +0 -20
- package/es/grid-component/ContextMenu.js +0 -130
- package/es/grid-component/ConvertColumnTable.d.ts +0 -7
- package/es/grid-component/ConvertColumnTable.js +0 -144
- package/es/grid-component/EditForm/EditForm.d.ts +0 -27
- package/es/grid-component/EditForm/EditForm.js +0 -394
- package/es/grid-component/EditForm/index.d.ts +0 -1
- package/es/grid-component/EditForm/index.js +0 -1
- package/es/grid-component/EditableCell.d.ts +0 -20
- package/es/grid-component/EditableCell.js +0 -1030
- package/es/grid-component/FilterSearch.d.ts +0 -12
- package/es/grid-component/FilterSearch.js +0 -33
- package/es/grid-component/GridStyle.d.ts +0 -8
- package/es/grid-component/GridStyle.js +0 -5
- package/es/grid-component/InternalTable.js +0 -1170
- package/es/grid-component/TableGrid.d.ts +0 -21
- package/es/grid-component/TableGrid.js +0 -493
- package/es/grid-component/async-select/index.d.ts +0 -11
- package/es/grid-component/async-select/index.js +0 -38
- package/es/grid-component/async-table-select/index.d.ts +0 -11
- package/es/grid-component/async-table-select/index.js +0 -40
- package/es/grid-component/checkbox-control/index.d.ts +0 -13
- package/es/grid-component/checkbox-control/index.js +0 -40
- package/es/grid-component/hooks/columns/index.d.ts +0 -10
- package/es/grid-component/hooks/columns/index.js +0 -503
- package/es/grid-component/hooks/content/ControlCheckbox.d.ts +0 -13
- package/es/grid-component/hooks/content/ControlCheckbox.js +0 -87
- package/es/grid-component/hooks/content/HeaderContent.d.ts +0 -14
- package/es/grid-component/hooks/content/HeaderContent.js +0 -44
- package/es/grid-component/hooks/content/TooltipContent.d.ts +0 -13
- package/es/grid-component/hooks/content/TooltipContent.js +0 -74
- package/es/grid-component/hooks/useColumns.d.ts +0 -19
- package/es/grid-component/hooks/useColumns.js +0 -317
- package/es/grid-component/number/index.d.ts +0 -10
- package/es/grid-component/number/index.js +0 -39
- package/es/grid-component/number-range/index.d.ts +0 -11
- package/es/grid-component/number-range/index.js +0 -63
- 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/es/grid-component/useContext.d.ts +0 -34
- package/es/grid-component/useContext.js +0 -8
- package/lib/grid-component/AdvanceFilter.d.ts +0 -14
- package/lib/grid-component/AdvanceFilter.js +0 -463
- package/lib/grid-component/CheckboxFilter.d.ts +0 -20
- package/lib/grid-component/CheckboxFilter.js +0 -253
- package/lib/grid-component/CheckboxFilter2.d.ts +0 -20
- package/lib/grid-component/CheckboxFilter2.js +0 -253
- package/lib/grid-component/ColumnsChoose.d.ts +0 -10
- package/lib/grid-component/ColumnsChoose.js +0 -240
- package/lib/grid-component/Command.d.ts +0 -8
- package/lib/grid-component/Command.js +0 -88
- package/lib/grid-component/ContextMenu.d.ts +0 -20
- package/lib/grid-component/ContextMenu.js +0 -140
- package/lib/grid-component/ConvertColumnTable.d.ts +0 -7
- package/lib/grid-component/ConvertColumnTable.js +0 -153
- package/lib/grid-component/EditForm/EditForm.d.ts +0 -27
- package/lib/grid-component/EditForm/EditForm.js +0 -404
- package/lib/grid-component/EditForm/index.d.ts +0 -1
- package/lib/grid-component/EditForm/index.js +0 -16
- package/lib/grid-component/EditableCell.d.ts +0 -20
- package/lib/grid-component/EditableCell.js +0 -1032
- package/lib/grid-component/FilterSearch.d.ts +0 -12
- package/lib/grid-component/FilterSearch.js +0 -42
- package/lib/grid-component/GridStyle.d.ts +0 -8
- package/lib/grid-component/GridStyle.js +0 -12
- package/lib/grid-component/InternalTable.js +0 -1178
- package/lib/grid-component/TableGrid.d.ts +0 -21
- package/lib/grid-component/TableGrid.js +0 -493
- package/lib/grid-component/async-select/index.d.ts +0 -11
- package/lib/grid-component/async-select/index.js +0 -47
- package/lib/grid-component/async-table-select/index.d.ts +0 -11
- package/lib/grid-component/async-table-select/index.js +0 -49
- package/lib/grid-component/checkbox-control/index.d.ts +0 -13
- package/lib/grid-component/checkbox-control/index.js +0 -48
- package/lib/grid-component/hooks/columns/index.d.ts +0 -10
- package/lib/grid-component/hooks/columns/index.js +0 -518
- package/lib/grid-component/hooks/content/ControlCheckbox.d.ts +0 -13
- package/lib/grid-component/hooks/content/ControlCheckbox.js +0 -95
- package/lib/grid-component/hooks/content/HeaderContent.d.ts +0 -14
- package/lib/grid-component/hooks/content/HeaderContent.js +0 -53
- package/lib/grid-component/hooks/content/TooltipContent.d.ts +0 -13
- package/lib/grid-component/hooks/content/TooltipContent.js +0 -81
- package/lib/grid-component/hooks/useColumns.d.ts +0 -19
- package/lib/grid-component/hooks/useColumns.js +0 -328
- package/lib/grid-component/number/index.d.ts +0 -10
- package/lib/grid-component/number/index.js +0 -47
- package/lib/grid-component/number-range/index.d.ts +0 -11
- package/lib/grid-component/number-range/index.js +0 -71
- 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
- package/lib/grid-component/useContext.d.ts +0 -34
- package/lib/grid-component/useContext.js +0 -13
- /package/es/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.d.ts +0 -0
- /package/es/{grid-component → table-virtuoso}/ColumnsGroup/index.d.ts +0 -0
- /package/es/{grid-component → table-virtuoso}/ColumnsGroup/index.js +0 -0
- /package/lib/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.d.ts +0 -0
- /package/lib/{grid-component → table-virtuoso}/ColumnsGroup/index.d.ts +0 -0
- /package/lib/{grid-component → table-virtuoso}/ColumnsGroup/index.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
declare const TempTable: <RecordType extends object>(props:
|
|
2
|
+
import type { TableProps } from "../table-component";
|
|
3
|
+
declare const TempTable: <RecordType extends object>(props: TableProps<RecordType>) => React.JSX.Element;
|
|
4
4
|
export default TempTable;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import React
|
|
2
|
+
import React 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 ?
|
|
12
|
-
return /*#__PURE__*/React.createElement(
|
|
11
|
+
const TabComponent = groupAble ? TableGroup : Table;
|
|
12
|
+
return /*#__PURE__*/React.createElement(TabComponent, _extends({}, rest, {
|
|
13
13
|
groupAble: groupAble,
|
|
14
14
|
editAble: editAble
|
|
15
|
-
}))
|
|
15
|
+
}));
|
|
16
16
|
};
|
|
17
17
|
export default TempTable;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyObject, GetRowKey } from "../type";
|
|
2
1
|
import type { Key } from "react";
|
|
2
|
+
import type { AnyObject, GetRowKey } from '../../table-component/type';
|
|
3
3
|
declare const useLazyKVMap: <RecordType extends AnyObject = AnyObject>(data: readonly RecordType[], childrenColumnName: string, getRowKey: GetRowKey<RecordType>) => readonly [(key: Key) => RecordType];
|
|
4
4
|
export default useLazyKVMap;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
// import type { AnyObject } from '../../_util/type';
|
|
5
|
-
// import type { GetRowKey, Key } from '../interface';
|
|
6
|
-
|
|
7
3
|
const useLazyKVMap = (data, childrenColumnName, getRowKey) => {
|
|
8
4
|
const mapCacheRef = React.useRef({});
|
|
9
5
|
function getRecordByKey(key) {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type * as React from "react";
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
import type { EditType, IColumnType, TypeFilter } from "rc-master-ui";
|
|
4
|
-
import type { ColumnTable, GetRowKey, IFormat } from "../type";
|
|
5
|
-
import type { SelectionSettings } from "../type";
|
|
6
|
-
import type { AnyObject } from "../type";
|
|
7
4
|
import type { Key } from "react";
|
|
8
5
|
import type { ColumnsTable } from "./../index";
|
|
6
|
+
import type { AnyObject, ColumnTable, GetRowKey, IFormat } from "../../table-component/type";
|
|
9
7
|
export declare const newGuid: () => any;
|
|
10
8
|
export declare const sumDataByField: (data: any[], field: string) => any;
|
|
11
9
|
export declare const checkThousandSeparator: (thousandSeparator: string | undefined, decimalSeparator: string | undefined) => string;
|
|
@@ -50,7 +48,6 @@ export declare const checkFieldKey: (key: string | undefined) => string;
|
|
|
50
48
|
export declare const convertLabelToTitle: (data: any[]) => any[];
|
|
51
49
|
export declare const convertArrayWithIndent: (inputArray: any[], parentIndent?: number) => any[];
|
|
52
50
|
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
51
|
export declare const isObjEmpty: (obj: any) => boolean;
|
|
55
52
|
export declare const getColumnsVisible: <T>(columns: ColumnsTable<T>, index: number) => ColumnTable<T>[];
|
|
56
53
|
export declare const updateData: <Record = AnyObject>(initData: Record[], rows: Record[], key: keyof Record) => Record[];
|
|
@@ -103,11 +100,7 @@ export declare function addRowsUp(array: any, n: number): {
|
|
|
103
100
|
combined: any[];
|
|
104
101
|
addedRows: any[];
|
|
105
102
|
};
|
|
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
103
|
export declare const convertFlatColumn: (array: ColumnsTable) => ColumnsTable[];
|
|
110
|
-
export declare const convertColumns: <RecordType>(cols: ColumnsTable<RecordType>) => ColumnsTable<RecordType>;
|
|
111
104
|
export declare const checkChild: (inputArray: any[]) => boolean;
|
|
112
105
|
export declare const isEditable: <RecordType>(column: ColumnTable, rowData: RecordType) => boolean | ((rowData: any) => boolean);
|
|
113
106
|
export declare const isArraysEqual: (arr1: any[], arr2: any[]) => boolean;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import dayjs from "dayjs";
|
|
2
|
+
// import type {ColumnTable, GetRowKey, IFormat, Presets} from "./../ type"
|
|
2
3
|
import moment from "moment/moment";
|
|
4
|
+
// import type {SelectionSettings} from "../type"
|
|
5
|
+
// import type {AnyObject} from "../type"
|
|
3
6
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
7
|
import { presetPalettes } from "@ant-design/colors";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
+
// import {Table} from "rc-master-ui"
|
|
9
|
+
// import {flatColumns2} from "./columns"
|
|
10
|
+
// import {SELECTION_COLUMN} from "./useColumns"
|
|
11
|
+
|
|
8
12
|
export const newGuid = () => {
|
|
9
13
|
for (let i = 0; i < 20; i++) {
|
|
10
14
|
// @ts-ignore
|
|
@@ -387,15 +391,22 @@ export const getTemplate = (template, column) => {
|
|
|
387
391
|
}
|
|
388
392
|
return template;
|
|
389
393
|
};
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
394
|
+
|
|
395
|
+
// export const totalFixedWidth = <T, >(columns: ColumnsTable<T>, type: 'left' | 'right', selectionSettings?: SelectionSettings) => {
|
|
396
|
+
// const totalFixedLeftWidth: number = columns
|
|
397
|
+
// .filter(column => column.fixed === type) // Lọc các cột có fixed
|
|
398
|
+
// .reduce((sum, column) => {
|
|
399
|
+
// 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
|
|
400
|
+
// return sum + width
|
|
401
|
+
// }, 0)
|
|
402
|
+
|
|
403
|
+
// const selectColumnWidth: number = !selectionSettings?.mode ? 0 : (
|
|
404
|
+
// typeof selectionSettings?.columnWidth === 'number' ? selectionSettings?.columnWidth : parseInt(selectionSettings?.columnWidth as string, 10) || 50)
|
|
405
|
+
|
|
406
|
+
// return totalFixedLeftWidth + selectColumnWidth
|
|
407
|
+
|
|
408
|
+
// }
|
|
409
|
+
|
|
399
410
|
export const isObjEmpty = obj => {
|
|
400
411
|
if (isNullOrUndefined(obj)) {
|
|
401
412
|
return true;
|
|
@@ -1146,93 +1157,112 @@ export function addRowsUp(array, n) {
|
|
|
1146
1157
|
addedRows
|
|
1147
1158
|
};
|
|
1148
1159
|
}
|
|
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
1160
|
|
|
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
|
-
});
|
|
1161
|
+
// export const transformColumns = <RecordType, >(cols: ColumnsTable<RecordType>, convertColumns: any[], t?: any): ColumnsTable<RecordType> => {
|
|
1199
1162
|
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1163
|
+
// // @ts-ignore
|
|
1164
|
+
// return cols.map((column) => {
|
|
1165
|
+
|
|
1166
|
+
// const find = convertColumns.find((it) => it.key === column.field)
|
|
1167
|
+
|
|
1168
|
+
// if (!column?.field && !column?.key) {
|
|
1169
|
+
// return Table.SELECTION_COLUMN
|
|
1170
|
+
// }
|
|
1171
|
+
|
|
1172
|
+
// if (find) {
|
|
1173
|
+
// return {...find}
|
|
1174
|
+
// }
|
|
1175
|
+
|
|
1176
|
+
// // Xử lý đệ quy cho children
|
|
1177
|
+
// if (column.children?.length) {
|
|
1178
|
+
// return {
|
|
1179
|
+
// ...column,
|
|
1180
|
+
// key: column.field ?? column.dataIndex ?? column.key,
|
|
1181
|
+
// title: t ? t(column.headerText) : column.headerText,
|
|
1182
|
+
// ellipsis: column.ellipsis !== false,
|
|
1183
|
+
// align: column.textAlign ?? column.align,
|
|
1184
|
+
// children: transformColumns(column.children, convertColumns)
|
|
1185
|
+
// }
|
|
1186
|
+
// }
|
|
1187
|
+
|
|
1188
|
+
// })
|
|
1189
|
+
|
|
1190
|
+
// }
|
|
1191
|
+
|
|
1192
|
+
// export const transformColumns1 = <RecordType, >(cols: ColumnsTable<RecordType>, sortMultiple?: boolean): ColumnsTable<RecordType> => {
|
|
1193
|
+
|
|
1194
|
+
// const convertColumns = flatColumns2(cols).map((column: any, colIndex) => {
|
|
1195
|
+
|
|
1196
|
+
// if (!column?.field && !column?.key) {
|
|
1197
|
+
// return Table.SELECTION_COLUMN
|
|
1198
|
+
// }
|
|
1199
|
+
|
|
1200
|
+
// if (column.dataIndex === '#' || column.dataIndex === '#') {
|
|
1201
|
+
// return {
|
|
1202
|
+
// ...column
|
|
1203
|
+
|
|
1204
|
+
// }
|
|
1205
|
+
// }
|
|
1206
|
+
|
|
1207
|
+
// if ((column.key || column.field) === 'command') {
|
|
1208
|
+
// return {
|
|
1209
|
+
// ...column
|
|
1210
|
+
// }
|
|
1211
|
+
// }
|
|
1212
|
+
|
|
1213
|
+
// return {
|
|
1214
|
+
// ...column,
|
|
1215
|
+
// key: column.field ?? column.dataIndex ?? column.key,
|
|
1216
|
+
// sorter: (column.sorter === false ? undefined : {
|
|
1217
|
+
// compare: (a: any) => a,
|
|
1218
|
+
// multiple: sortMultiple ? colIndex : undefined
|
|
1219
|
+
// })
|
|
1220
|
+
// }
|
|
1221
|
+
|
|
1222
|
+
// })
|
|
1223
|
+
|
|
1224
|
+
// // @ts-ignore
|
|
1225
|
+
// return cols.map((column) => {
|
|
1226
|
+
|
|
1227
|
+
// const find = convertColumns.find((it) => it.key === column.field)
|
|
1228
|
+
|
|
1229
|
+
// if (!column?.field && !column?.key) {
|
|
1230
|
+
// return Table.SELECTION_COLUMN
|
|
1231
|
+
// }
|
|
1232
|
+
|
|
1233
|
+
// if (find) {
|
|
1234
|
+
// return {...find}
|
|
1235
|
+
// }
|
|
1236
|
+
|
|
1237
|
+
// // Xử lý đệ quy cho children
|
|
1238
|
+
// if (column.children?.length) {
|
|
1239
|
+
// return {
|
|
1240
|
+
// ...column,
|
|
1241
|
+
// key: column.field ?? column.dataIndex ?? column.key,
|
|
1242
|
+
// ellipsis: column.ellipsis !== false,
|
|
1243
|
+
// align: column.textAlign ?? column.align,
|
|
1244
|
+
// children: transformColumns(column.children, convertColumns)
|
|
1245
|
+
// }
|
|
1246
|
+
// }
|
|
1247
|
+
|
|
1248
|
+
// })
|
|
1249
|
+
|
|
1250
|
+
// }
|
|
1251
|
+
|
|
1252
|
+
// export const removeColumns = <RecordType, >(columns: ColumnTable<RecordType>[], groupColumns: string[]): ColumnsTable<RecordType> => {
|
|
1253
|
+
|
|
1254
|
+
// const ttt: ColumnTable<RecordType>[] = [...columns]
|
|
1255
|
+
|
|
1256
|
+
// return ttt.filter(column => !groupColumns.includes(column.field as string)).map((column) => {
|
|
1257
|
+
// const newCol = {...column}
|
|
1258
|
+
// if (newCol?.children && newCol?.children.length > 0) {
|
|
1259
|
+
// newCol.children = removeColumns(newCol.children, groupColumns) as any[]
|
|
1260
|
+
// }
|
|
1261
|
+
// return newCol
|
|
1262
|
+
// })
|
|
1263
|
+
|
|
1264
|
+
// }
|
|
1211
1265
|
|
|
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
1266
|
export const convertFlatColumn = array => {
|
|
1237
1267
|
const tmp = [...array];
|
|
1238
1268
|
let result = [];
|
|
@@ -1245,54 +1275,56 @@ export const convertFlatColumn = array => {
|
|
|
1245
1275
|
});
|
|
1246
1276
|
return result;
|
|
1247
1277
|
};
|
|
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
|
-
}
|
|
1278
|
+
|
|
1279
|
+
// export const convertColumns = <RecordType, >(cols: ColumnsTable<RecordType>): ColumnsTable<RecordType> => {
|
|
1280
|
+
|
|
1281
|
+
// return cols.map((col) => {
|
|
1282
|
+
|
|
1283
|
+
// if (col === SELECTION_COLUMN) {
|
|
1284
|
+
// return SELECTION_COLUMN
|
|
1285
|
+
// }
|
|
1286
|
+
|
|
1287
|
+
// const transformedColumn = {
|
|
1288
|
+
// ...col,
|
|
1289
|
+
// dataIndex: col.field ?? col.dataIndex,
|
|
1290
|
+
// key: col.field ?? col.dataIndex ?? col.key,
|
|
1291
|
+
// // title: t ? t(col.columnGroupText ?? col.headerText ?? col.title) : col.columnGroupText ?? col.headerText ?? col.title,
|
|
1292
|
+
// // title: () => (<span>aaa</span>),
|
|
1293
|
+
// // title: () => (<HeaderContent column={{...col} as any} t={t}/>),
|
|
1294
|
+
// // title: () => (<span>{t ? t(col.columnGroupText ?? col.headerText ?? col.title) : col.columnGroupText ?? col.headerText ?? col.title}</span>),
|
|
1295
|
+
// ellipsis: col.ellipsis !== false,
|
|
1296
|
+
// align: col.textAlign ?? col.align,
|
|
1297
|
+
// fixed: col.fixedType ?? col.fixed
|
|
1298
|
+
// }
|
|
1299
|
+
|
|
1300
|
+
// if (transformedColumn.children && transformedColumn.children?.length) {
|
|
1301
|
+
// return {
|
|
1302
|
+
// ...transformedColumn,
|
|
1303
|
+
// children: convertColumns(transformedColumn.children)
|
|
1304
|
+
// }
|
|
1305
|
+
// }
|
|
1306
|
+
|
|
1307
|
+
// if (["index", "#"].includes(col.field as string)) {
|
|
1308
|
+
// return {
|
|
1309
|
+
// ...transformedColumn,
|
|
1310
|
+
// onCell: () => ({className: 'cell-number'}),
|
|
1311
|
+
// render: (_: any, __: any, rowIndex: number) => rowIndex + 1
|
|
1312
|
+
// }
|
|
1313
|
+
// }
|
|
1314
|
+
|
|
1315
|
+
// if (col.key === 'command') {
|
|
1316
|
+
// return {
|
|
1317
|
+
// ...transformedColumn,
|
|
1318
|
+
// onCell: () => ({className: 'cell-number', style: {padding: '2px 8px'}})
|
|
1319
|
+
// }
|
|
1320
|
+
// }
|
|
1321
|
+
|
|
1322
|
+
// return {
|
|
1323
|
+
// ...transformedColumn
|
|
1324
|
+
// }
|
|
1325
|
+
// })
|
|
1326
|
+
// }
|
|
1327
|
+
|
|
1296
1328
|
export const checkChild = inputArray => {
|
|
1297
1329
|
return inputArray.some(item => item.children && item.children.length > 0);
|
|
1298
1330
|
};
|
|
@@ -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;
|