es-grid-template 1.8.64 → 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.
Files changed (125) hide show
  1. package/es/grid-component/ColumnsGroup/ColumnsGroup.js +4 -1
  2. package/es/grid-component/TempTable.js +2 -2
  3. package/es/grid-component/hooks/utils.d.ts +2 -8
  4. package/es/grid-component/hooks/utils.js +175 -144
  5. package/es/grid-component/index.d.ts +1 -1
  6. package/es/grid-component/index.js +0 -4
  7. package/es/grid-component/type.d.ts +7 -0
  8. package/es/table-component/type.d.ts +8 -0
  9. package/es/table-virtuoso/ColumnsGroup/ColumnsGroup.d.ts +12 -0
  10. package/es/table-virtuoso/ColumnsGroup/ColumnsGroup.js +232 -0
  11. package/es/table-virtuoso/ColumnsGroup/index.d.ts +1 -0
  12. package/es/table-virtuoso/ColumnsGroup/index.js +1 -0
  13. package/es/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
  14. package/es/table-virtuoso/InternalTable.js +413 -0
  15. package/es/table-virtuoso/body/TableBody.d.ts +14 -0
  16. package/es/table-virtuoso/body/TableBody.js +84 -0
  17. package/es/table-virtuoso/body/TableBodyCell.d.ts +14 -0
  18. package/es/table-virtuoso/body/TableBodyCell.js +466 -0
  19. package/es/table-virtuoso/body/TableBodyRow.d.ts +13 -0
  20. package/es/table-virtuoso/body/TableBodyRow.js +116 -0
  21. package/es/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
  22. package/es/table-virtuoso/footer/TableFooterCell.js +54 -0
  23. package/es/table-virtuoso/header/TableHeadCell.d.ts +14 -0
  24. package/es/table-virtuoso/header/TableHeadCell.js +265 -0
  25. package/es/table-virtuoso/header/renderFilter.d.ts +20 -0
  26. package/es/table-virtuoso/header/renderFilter.js +289 -0
  27. package/es/table-virtuoso/hook/constant.d.ts +73 -0
  28. package/es/table-virtuoso/hook/constant.js +240 -0
  29. package/es/table-virtuoso/hook/convert.d.ts +1 -0
  30. package/es/table-virtuoso/hook/convert.js +28 -0
  31. package/es/table-virtuoso/hook/useColumns.d.ts +28 -0
  32. package/es/table-virtuoso/hook/useColumns.js +302 -0
  33. package/es/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
  34. package/es/table-virtuoso/hook/useFilterOperator.js +33 -0
  35. package/es/table-virtuoso/hook/utils.d.ts +159 -0
  36. package/es/table-virtuoso/hook/utils.js +2263 -0
  37. package/es/table-virtuoso/index.d.ts +2 -0
  38. package/es/table-virtuoso/index.js +2 -0
  39. package/es/table-virtuoso/style.d.ts +22 -0
  40. package/es/table-virtuoso/style.js +11 -0
  41. package/es/table-virtuoso/style.scss +1440 -0
  42. package/es/table-virtuoso/table/Grid.d.ts +37 -0
  43. package/es/table-virtuoso/table/Grid.js +302 -0
  44. package/es/table-virtuoso/table/TableContainer.d.ts +49 -0
  45. package/es/table-virtuoso/table/TableContainer.js +305 -0
  46. package/es/table-virtuoso/table/TableWrapper.d.ts +20 -0
  47. package/es/table-virtuoso/table/TableWrapper.js +158 -0
  48. package/es/table-virtuoso/type.d.ts +0 -0
  49. package/es/table-virtuoso/type.js +785 -0
  50. package/es/table-virtuoso/useContext.d.ts +97 -0
  51. package/es/table-virtuoso/useContext.js +21 -0
  52. package/lib/grid-component/ColumnsGroup/ColumnsGroup.js +4 -1
  53. package/lib/grid-component/TempTable.js +2 -2
  54. package/lib/grid-component/hooks/utils.d.ts +2 -8
  55. package/lib/grid-component/hooks/utils.js +176 -152
  56. package/lib/grid-component/index.d.ts +1 -1
  57. package/lib/grid-component/index.js +0 -3
  58. package/lib/grid-component/type.d.ts +7 -0
  59. package/lib/table-component/type.d.ts +8 -0
  60. package/lib/table-virtuoso/ColumnsGroup/ColumnsGroup.d.ts +12 -0
  61. package/lib/table-virtuoso/ColumnsGroup/ColumnsGroup.js +243 -0
  62. package/lib/table-virtuoso/ColumnsGroup/index.d.ts +1 -0
  63. package/lib/table-virtuoso/ColumnsGroup/index.js +16 -0
  64. package/lib/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
  65. package/lib/table-virtuoso/InternalTable.js +422 -0
  66. package/lib/table-virtuoso/body/TableBody.d.ts +14 -0
  67. package/lib/table-virtuoso/body/TableBody.js +95 -0
  68. package/lib/table-virtuoso/body/TableBodyCell.d.ts +14 -0
  69. package/lib/table-virtuoso/body/TableBodyCell.js +473 -0
  70. package/lib/table-virtuoso/body/TableBodyRow.d.ts +13 -0
  71. package/lib/table-virtuoso/body/TableBodyRow.js +124 -0
  72. package/lib/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
  73. package/lib/table-virtuoso/footer/TableFooterCell.js +63 -0
  74. package/lib/table-virtuoso/header/TableHeadCell.d.ts +14 -0
  75. package/lib/table-virtuoso/header/TableHeadCell.js +274 -0
  76. package/lib/table-virtuoso/header/renderFilter.d.ts +20 -0
  77. package/lib/table-virtuoso/header/renderFilter.js +299 -0
  78. package/lib/table-virtuoso/hook/constant.d.ts +73 -0
  79. package/lib/table-virtuoso/hook/constant.js +247 -0
  80. package/lib/table-virtuoso/hook/convert.d.ts +1 -0
  81. package/lib/table-virtuoso/hook/convert.js +34 -0
  82. package/lib/table-virtuoso/hook/useColumns.d.ts +28 -0
  83. package/lib/table-virtuoso/hook/useColumns.js +315 -0
  84. package/lib/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
  85. package/lib/table-virtuoso/hook/useFilterOperator.js +40 -0
  86. package/lib/table-virtuoso/hook/utils.d.ts +159 -0
  87. package/lib/table-virtuoso/hook/utils.js +2389 -0
  88. package/lib/table-virtuoso/index.d.ts +2 -0
  89. package/lib/table-virtuoso/index.js +9 -0
  90. package/lib/table-virtuoso/style.d.ts +22 -0
  91. package/lib/table-virtuoso/style.js +18 -0
  92. package/lib/table-virtuoso/style.scss +1440 -0
  93. package/lib/table-virtuoso/table/Grid.d.ts +37 -0
  94. package/lib/table-virtuoso/table/Grid.js +311 -0
  95. package/lib/table-virtuoso/table/TableContainer.d.ts +49 -0
  96. package/lib/table-virtuoso/table/TableContainer.js +313 -0
  97. package/lib/table-virtuoso/table/TableWrapper.d.ts +20 -0
  98. package/lib/table-virtuoso/table/TableWrapper.js +164 -0
  99. package/lib/table-virtuoso/type.d.ts +0 -0
  100. package/lib/table-virtuoso/type.js +786 -0
  101. package/lib/table-virtuoso/useContext.d.ts +97 -0
  102. package/lib/table-virtuoso/useContext.js +27 -0
  103. package/package.json +2 -1
  104. package/es/grid-component/ConvertColumnTable.d.ts +0 -7
  105. package/es/grid-component/ConvertColumnTable.js +0 -144
  106. package/es/grid-component/InternalTable.js +0 -1170
  107. package/es/grid-component/table/Grid.d.ts +0 -23
  108. package/es/grid-component/table/Grid.js +0 -49
  109. package/es/grid-component/table/GridEdit.d.ts +0 -23
  110. package/es/grid-component/table/GridEdit.js +0 -2726
  111. package/es/grid-component/table/Group.d.ts +0 -21
  112. package/es/grid-component/table/Group.js +0 -195
  113. package/es/grid-component/table/InfiniteTable.d.ts +0 -23
  114. package/es/grid-component/table/InfiniteTable.js +0 -101
  115. package/lib/grid-component/ConvertColumnTable.d.ts +0 -7
  116. package/lib/grid-component/ConvertColumnTable.js +0 -153
  117. package/lib/grid-component/InternalTable.js +0 -1178
  118. package/lib/grid-component/table/Grid.d.ts +0 -23
  119. package/lib/grid-component/table/Grid.js +0 -58
  120. package/lib/grid-component/table/GridEdit.d.ts +0 -23
  121. package/lib/grid-component/table/GridEdit.js +0 -2723
  122. package/lib/grid-component/table/Group.d.ts +0 -21
  123. package/lib/grid-component/table/Group.js +0 -204
  124. package/lib/grid-component/table/InfiniteTable.d.ts +0 -23
  125. 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.hidden !== true && !tempGroup.includes(it.field) && it.field !== '#' && it.field !== 'command');
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 InternalTable from "./InternalTable";
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 ? InternalTable : Table;
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 { Table } from "rc-master-ui";
6
- import { flatColumns2 } from "./columns";
7
- import { SELECTION_COLUMN } from "./useColumns";
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
- export const totalFixedWidth = (columns, type, selectionSettings) => {
391
- const totalFixedLeftWidth = columns.filter(column => column.fixed === type) // Lọc các cột có fixed
392
- .reduce((sum, column) => {
393
- const width = typeof column.width === 'number' ? column.width : parseInt(column.width, 10) || 0; // Chuyển từ chuỗi sang số, nếu không hợp lệ thì lấy 0
394
- return sum + width;
395
- }, 0);
396
- const selectColumnWidth = !selectionSettings?.mode ? 0 : typeof selectionSettings?.columnWidth === 'number' ? selectionSettings?.columnWidth : parseInt(selectionSettings?.columnWidth, 10) || 50;
397
- return totalFixedLeftWidth + selectColumnWidth;
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 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
- // Xử đệ quy cho children
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
- // @ts-ignore
1201
- return cols.map(column => {
1202
- const find = convertColumns.find(it => it.key === column.field);
1203
- if (!column?.field && !column?.key) {
1204
- return Table.SELECTION_COLUMN;
1205
- }
1206
- if (find) {
1207
- return {
1208
- ...find
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
- export const convertColumns = cols => {
1249
- return cols.map(col => {
1250
- if (col === SELECTION_COLUMN) {
1251
- return SELECTION_COLUMN;
1252
- }
1253
- const transformedColumn = {
1254
- ...col,
1255
- dataIndex: col.field ?? col.dataIndex,
1256
- key: col.field ?? col.dataIndex ?? col.key,
1257
- // title: t ? t(col.columnGroupText ?? col.headerText ?? col.title) : col.columnGroupText ?? col.headerText ?? col.title,
1258
- // title: () => (<span>aaa</span>),
1259
- // title: () => (<HeaderContent column={{...col} as any} t={t}/>),
1260
- // title: () => (<span>{t ? t(col.columnGroupText ?? col.headerText ?? col.title) : col.columnGroupText ?? col.headerText ?? col.title}</span>),
1261
- ellipsis: col.ellipsis !== false,
1262
- align: col.textAlign ?? col.align,
1263
- fixed: col.fixedType ?? col.fixed
1264
- };
1265
- if (transformedColumn.children && transformedColumn.children?.length) {
1266
- return {
1267
- ...transformedColumn,
1268
- children: convertColumns(transformedColumn.children)
1269
- };
1270
- }
1271
- if (["index", "#"].includes(col.field)) {
1272
- return {
1273
- ...transformedColumn,
1274
- onCell: () => ({
1275
- className: 'cell-number'
1276
- }),
1277
- render: (_, __, rowIndex) => rowIndex + 1
1278
- };
1279
- }
1280
- if (col.key === 'command') {
1281
- return {
1282
- ...transformedColumn,
1283
- onCell: () => ({
1284
- className: 'cell-number',
1285
- style: {
1286
- padding: '2px 8px'
1287
- }
1288
- })
1289
- };
1290
- }
1291
- return {
1292
- ...transformedColumn
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 './type';
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;
@@ -1,6 +1,2 @@
1
1
  import TempTable from "./TempTable";
2
- // import InternalTable from './InternalTable'
3
-
4
- //
5
- // export default InternalTable
6
2
  export default TempTable;
@@ -312,14 +312,21 @@ export interface CommandItem {
312
312
  client?: boolean;
313
313
  confirmDialog?: boolean;
314
314
  }
315
+ export type GroupTemplate = {
316
+ rowData: any;
317
+ value: any;
318
+ column: ColumnTable;
319
+ };
315
320
  export type IGroupSetting = {
316
321
  client?: boolean;
317
322
  onGroup?: (props: IOnGroup) => void;
318
323
  groupColumnSpan?: number;
319
324
  hiddenColumnGroup?: boolean;
325
+ showHeaderColumn?: boolean;
320
326
  showGroupIcon?: boolean;
321
327
  unClearableLevel?: 1 | 2 | 3 | undefined;
322
328
  sumGroup?: boolean;
329
+ groupTemplate?: React.ReactNode | React.ReactElement | ((args: GroupTemplate) => React.ReactNode | React.ReactElement);
323
330
  };
324
331
  type IOnGroup = {
325
332
  columnGrouped: string[];
@@ -425,13 +425,21 @@ export type ToolbarItem = {
425
425
  export type LoadOptionsArgs = {
426
426
  rowData?: any;
427
427
  };
428
+ export type GroupTemplate = {
429
+ rowData: any;
430
+ value: any;
431
+ column: ColumnTable;
432
+ };
428
433
  export type IGroupSetting = {
429
434
  client?: boolean;
430
435
  onGroup?: (props: IOnGroup) => void;
436
+ groupColumnSpan?: number;
431
437
  hiddenColumnGroup?: boolean;
438
+ showHeaderColumn?: boolean;
432
439
  showGroupIcon?: boolean;
433
440
  unClearableLevel?: 1 | 2 | 3 | undefined;
434
441
  sumGroup?: boolean;
442
+ groupTemplate?: React.ReactNode | React.ReactElement | ((args: GroupTemplate) => React.ReactNode | React.ReactElement);
435
443
  };
436
444
  type IOnGroup = {
437
445
  columnGrouped: string[];
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ type IColumnsGroup = {
3
+ columns: any[];
4
+ dataSource?: string[];
5
+ onSubmit: (value: any) => void;
6
+ t?: any;
7
+ columnsGrouped?: string[];
8
+ unClearableLevel?: number;
9
+ defaultGroupColumns?: string[];
10
+ };
11
+ export declare const ColumnsGroup: (props: IColumnsGroup) => React.JSX.Element;
12
+ export {};