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.
Files changed (222) hide show
  1. package/es/grid-component/TempTable.d.ts +2 -2
  2. package/es/grid-component/TempTable.js +5 -5
  3. package/es/grid-component/hooks/index.js +0 -1
  4. package/es/grid-component/hooks/useLazyKVMap.d.ts +1 -1
  5. package/es/grid-component/hooks/useLazyKVMap.js +0 -4
  6. package/es/grid-component/hooks/utils.d.ts +1 -8
  7. package/es/grid-component/hooks/utils.js +176 -144
  8. package/es/grid-component/index.d.ts +1 -1
  9. package/es/grid-component/index.js +0 -4
  10. package/es/grid-component/styles.scss +1394 -1394
  11. package/es/grid-component/type.d.ts +0 -407
  12. package/es/grid-component/type.js +490 -1
  13. package/es/table-component/type.d.ts +10 -0
  14. package/es/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.js +4 -3
  15. package/es/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
  16. package/es/table-virtuoso/InternalTable.js +391 -0
  17. package/es/table-virtuoso/body/TableBodyCell.d.ts +14 -0
  18. package/es/table-virtuoso/body/TableBodyCell.js +457 -0
  19. package/es/table-virtuoso/body/TableBodyRow.d.ts +13 -0
  20. package/es/table-virtuoso/body/TableBodyRow.js +112 -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 +12 -0
  41. package/es/table-virtuoso/style.scss +1441 -0
  42. package/es/table-virtuoso/table/Grid.d.ts +37 -0
  43. package/es/table-virtuoso/table/Grid.js +298 -0
  44. package/es/table-virtuoso/table/TableContainer.d.ts +49 -0
  45. package/es/table-virtuoso/table/TableContainer.js +292 -0
  46. package/es/table-virtuoso/table/TableWrapper.d.ts +22 -0
  47. package/es/table-virtuoso/table/TableWrapper.js +161 -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/TempTable.d.ts +2 -2
  53. package/lib/grid-component/TempTable.js +5 -7
  54. package/lib/grid-component/hooks/useLazyKVMap.d.ts +1 -1
  55. package/lib/grid-component/hooks/useLazyKVMap.js +0 -3
  56. package/lib/grid-component/hooks/utils.d.ts +1 -8
  57. package/lib/grid-component/hooks/utils.js +179 -152
  58. package/lib/grid-component/index.d.ts +1 -1
  59. package/lib/grid-component/index.js +0 -3
  60. package/lib/grid-component/styles.scss +1394 -1394
  61. package/lib/grid-component/type.d.ts +0 -407
  62. package/lib/grid-component/type.js +490 -4
  63. package/lib/table-component/type.d.ts +10 -0
  64. package/lib/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.js +4 -3
  65. package/lib/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
  66. package/lib/table-virtuoso/InternalTable.js +400 -0
  67. package/lib/table-virtuoso/body/TableBodyCell.d.ts +14 -0
  68. package/lib/table-virtuoso/body/TableBodyCell.js +464 -0
  69. package/lib/table-virtuoso/body/TableBodyRow.d.ts +13 -0
  70. package/lib/table-virtuoso/body/TableBodyRow.js +119 -0
  71. package/lib/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
  72. package/lib/table-virtuoso/footer/TableFooterCell.js +63 -0
  73. package/lib/table-virtuoso/header/TableHeadCell.d.ts +14 -0
  74. package/lib/table-virtuoso/header/TableHeadCell.js +274 -0
  75. package/lib/table-virtuoso/header/renderFilter.d.ts +20 -0
  76. package/lib/table-virtuoso/header/renderFilter.js +299 -0
  77. package/lib/table-virtuoso/hook/constant.d.ts +73 -0
  78. package/lib/table-virtuoso/hook/constant.js +247 -0
  79. package/lib/table-virtuoso/hook/convert.d.ts +1 -0
  80. package/lib/table-virtuoso/hook/convert.js +34 -0
  81. package/lib/table-virtuoso/hook/useColumns.d.ts +28 -0
  82. package/lib/table-virtuoso/hook/useColumns.js +315 -0
  83. package/lib/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
  84. package/lib/table-virtuoso/hook/useFilterOperator.js +40 -0
  85. package/lib/table-virtuoso/hook/utils.d.ts +159 -0
  86. package/lib/table-virtuoso/hook/utils.js +2389 -0
  87. package/lib/table-virtuoso/index.d.ts +2 -0
  88. package/lib/table-virtuoso/index.js +9 -0
  89. package/lib/table-virtuoso/style.d.ts +22 -0
  90. package/lib/table-virtuoso/style.js +19 -0
  91. package/lib/table-virtuoso/style.scss +1441 -0
  92. package/lib/table-virtuoso/table/Grid.d.ts +37 -0
  93. package/lib/table-virtuoso/table/Grid.js +307 -0
  94. package/lib/table-virtuoso/table/TableContainer.d.ts +49 -0
  95. package/lib/table-virtuoso/table/TableContainer.js +300 -0
  96. package/lib/table-virtuoso/table/TableWrapper.d.ts +22 -0
  97. package/lib/table-virtuoso/table/TableWrapper.js +166 -0
  98. package/lib/table-virtuoso/type.d.ts +0 -0
  99. package/lib/table-virtuoso/type.js +786 -0
  100. package/lib/table-virtuoso/useContext.d.ts +97 -0
  101. package/lib/table-virtuoso/useContext.js +27 -0
  102. package/package.json +2 -1
  103. package/es/grid-component/AdvanceFilter.d.ts +0 -14
  104. package/es/grid-component/AdvanceFilter.js +0 -454
  105. package/es/grid-component/CheckboxFilter.d.ts +0 -20
  106. package/es/grid-component/CheckboxFilter.js +0 -244
  107. package/es/grid-component/CheckboxFilter2.d.ts +0 -20
  108. package/es/grid-component/CheckboxFilter2.js +0 -244
  109. package/es/grid-component/ColumnsChoose.d.ts +0 -10
  110. package/es/grid-component/ColumnsChoose.js +0 -230
  111. package/es/grid-component/Command.d.ts +0 -8
  112. package/es/grid-component/Command.js +0 -80
  113. package/es/grid-component/ContextMenu.d.ts +0 -20
  114. package/es/grid-component/ContextMenu.js +0 -130
  115. package/es/grid-component/ConvertColumnTable.d.ts +0 -7
  116. package/es/grid-component/ConvertColumnTable.js +0 -144
  117. package/es/grid-component/EditForm/EditForm.d.ts +0 -27
  118. package/es/grid-component/EditForm/EditForm.js +0 -394
  119. package/es/grid-component/EditForm/index.d.ts +0 -1
  120. package/es/grid-component/EditForm/index.js +0 -1
  121. package/es/grid-component/EditableCell.d.ts +0 -20
  122. package/es/grid-component/EditableCell.js +0 -1030
  123. package/es/grid-component/FilterSearch.d.ts +0 -12
  124. package/es/grid-component/FilterSearch.js +0 -33
  125. package/es/grid-component/GridStyle.d.ts +0 -8
  126. package/es/grid-component/GridStyle.js +0 -5
  127. package/es/grid-component/InternalTable.js +0 -1170
  128. package/es/grid-component/TableGrid.d.ts +0 -21
  129. package/es/grid-component/TableGrid.js +0 -493
  130. package/es/grid-component/async-select/index.d.ts +0 -11
  131. package/es/grid-component/async-select/index.js +0 -38
  132. package/es/grid-component/async-table-select/index.d.ts +0 -11
  133. package/es/grid-component/async-table-select/index.js +0 -40
  134. package/es/grid-component/checkbox-control/index.d.ts +0 -13
  135. package/es/grid-component/checkbox-control/index.js +0 -40
  136. package/es/grid-component/hooks/columns/index.d.ts +0 -10
  137. package/es/grid-component/hooks/columns/index.js +0 -503
  138. package/es/grid-component/hooks/content/ControlCheckbox.d.ts +0 -13
  139. package/es/grid-component/hooks/content/ControlCheckbox.js +0 -87
  140. package/es/grid-component/hooks/content/HeaderContent.d.ts +0 -14
  141. package/es/grid-component/hooks/content/HeaderContent.js +0 -44
  142. package/es/grid-component/hooks/content/TooltipContent.d.ts +0 -13
  143. package/es/grid-component/hooks/content/TooltipContent.js +0 -74
  144. package/es/grid-component/hooks/useColumns.d.ts +0 -19
  145. package/es/grid-component/hooks/useColumns.js +0 -317
  146. package/es/grid-component/number/index.d.ts +0 -10
  147. package/es/grid-component/number/index.js +0 -39
  148. package/es/grid-component/number-range/index.d.ts +0 -11
  149. package/es/grid-component/number-range/index.js +0 -63
  150. package/es/grid-component/table/Grid.d.ts +0 -23
  151. package/es/grid-component/table/Grid.js +0 -49
  152. package/es/grid-component/table/GridEdit.d.ts +0 -23
  153. package/es/grid-component/table/GridEdit.js +0 -2726
  154. package/es/grid-component/table/Group.d.ts +0 -21
  155. package/es/grid-component/table/Group.js +0 -195
  156. package/es/grid-component/table/InfiniteTable.d.ts +0 -23
  157. package/es/grid-component/table/InfiniteTable.js +0 -101
  158. package/es/grid-component/useContext.d.ts +0 -34
  159. package/es/grid-component/useContext.js +0 -8
  160. package/lib/grid-component/AdvanceFilter.d.ts +0 -14
  161. package/lib/grid-component/AdvanceFilter.js +0 -463
  162. package/lib/grid-component/CheckboxFilter.d.ts +0 -20
  163. package/lib/grid-component/CheckboxFilter.js +0 -253
  164. package/lib/grid-component/CheckboxFilter2.d.ts +0 -20
  165. package/lib/grid-component/CheckboxFilter2.js +0 -253
  166. package/lib/grid-component/ColumnsChoose.d.ts +0 -10
  167. package/lib/grid-component/ColumnsChoose.js +0 -240
  168. package/lib/grid-component/Command.d.ts +0 -8
  169. package/lib/grid-component/Command.js +0 -88
  170. package/lib/grid-component/ContextMenu.d.ts +0 -20
  171. package/lib/grid-component/ContextMenu.js +0 -140
  172. package/lib/grid-component/ConvertColumnTable.d.ts +0 -7
  173. package/lib/grid-component/ConvertColumnTable.js +0 -153
  174. package/lib/grid-component/EditForm/EditForm.d.ts +0 -27
  175. package/lib/grid-component/EditForm/EditForm.js +0 -404
  176. package/lib/grid-component/EditForm/index.d.ts +0 -1
  177. package/lib/grid-component/EditForm/index.js +0 -16
  178. package/lib/grid-component/EditableCell.d.ts +0 -20
  179. package/lib/grid-component/EditableCell.js +0 -1032
  180. package/lib/grid-component/FilterSearch.d.ts +0 -12
  181. package/lib/grid-component/FilterSearch.js +0 -42
  182. package/lib/grid-component/GridStyle.d.ts +0 -8
  183. package/lib/grid-component/GridStyle.js +0 -12
  184. package/lib/grid-component/InternalTable.js +0 -1178
  185. package/lib/grid-component/TableGrid.d.ts +0 -21
  186. package/lib/grid-component/TableGrid.js +0 -493
  187. package/lib/grid-component/async-select/index.d.ts +0 -11
  188. package/lib/grid-component/async-select/index.js +0 -47
  189. package/lib/grid-component/async-table-select/index.d.ts +0 -11
  190. package/lib/grid-component/async-table-select/index.js +0 -49
  191. package/lib/grid-component/checkbox-control/index.d.ts +0 -13
  192. package/lib/grid-component/checkbox-control/index.js +0 -48
  193. package/lib/grid-component/hooks/columns/index.d.ts +0 -10
  194. package/lib/grid-component/hooks/columns/index.js +0 -518
  195. package/lib/grid-component/hooks/content/ControlCheckbox.d.ts +0 -13
  196. package/lib/grid-component/hooks/content/ControlCheckbox.js +0 -95
  197. package/lib/grid-component/hooks/content/HeaderContent.d.ts +0 -14
  198. package/lib/grid-component/hooks/content/HeaderContent.js +0 -53
  199. package/lib/grid-component/hooks/content/TooltipContent.d.ts +0 -13
  200. package/lib/grid-component/hooks/content/TooltipContent.js +0 -81
  201. package/lib/grid-component/hooks/useColumns.d.ts +0 -19
  202. package/lib/grid-component/hooks/useColumns.js +0 -328
  203. package/lib/grid-component/number/index.d.ts +0 -10
  204. package/lib/grid-component/number/index.js +0 -47
  205. package/lib/grid-component/number-range/index.d.ts +0 -11
  206. package/lib/grid-component/number-range/index.js +0 -71
  207. package/lib/grid-component/table/Grid.d.ts +0 -23
  208. package/lib/grid-component/table/Grid.js +0 -58
  209. package/lib/grid-component/table/GridEdit.d.ts +0 -23
  210. package/lib/grid-component/table/GridEdit.js +0 -2723
  211. package/lib/grid-component/table/Group.d.ts +0 -21
  212. package/lib/grid-component/table/Group.js +0 -204
  213. package/lib/grid-component/table/InfiniteTable.d.ts +0 -23
  214. package/lib/grid-component/table/InfiniteTable.js +0 -109
  215. package/lib/grid-component/useContext.d.ts +0 -34
  216. package/lib/grid-component/useContext.js +0 -13
  217. /package/es/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.d.ts +0 -0
  218. /package/es/{grid-component → table-virtuoso}/ColumnsGroup/index.d.ts +0 -0
  219. /package/es/{grid-component → table-virtuoso}/ColumnsGroup/index.js +0 -0
  220. /package/lib/{grid-component → table-virtuoso}/ColumnsGroup/ColumnsGroup.d.ts +0 -0
  221. /package/lib/{grid-component → table-virtuoso}/ColumnsGroup/index.d.ts +0 -0
  222. /package/lib/{grid-component → table-virtuoso}/ColumnsGroup/index.js +0 -0
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import type { GridTableProps } from "./type";
3
- declare const TempTable: <RecordType extends object>(props: GridTableProps<RecordType>) => React.JSX.Element;
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, { Fragment } from 'react';
2
+ import React 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;
12
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(TabComponent, _extends({}, rest, {
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,5 +1,4 @@
1
1
  export * from "./constant";
2
- // export * from './isNullOrUndefined'
3
2
  export * from "./useIsOverflow";
4
3
  export * from "./useOnClickOutside";
5
4
  export * from "./utils";
@@ -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 { Table } from "rc-master-ui";
6
- import { flatColumns2 } from "./columns";
7
- import { SELECTION_COLUMN } from "./useColumns";
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
- 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
- };
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 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
- // 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
- });
1161
+ // export const transformColumns = <RecordType, >(cols: ColumnsTable<RecordType>, convertColumns: any[], t?: any): ColumnsTable<RecordType> => {
1199
1162
 
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
- }
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
- 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
- };
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 './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;