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
@@ -0,0 +1,97 @@
1
+ import type { Dispatch, SetStateAction } from 'react';
2
+ import type { ColumnTable, ExpandableConfig, IFormat, IGroupSetting, IWrapSettings, Locale, PaginationConfig, RangeState, RecordDoubleClickEventArgs, RowClassName, SelectionSettings } from "../table-component/type";
3
+ import type { SubmitHandler } from "react-hook-form";
4
+ import type { ExpandedState, Row, Table } from '@tanstack/react-table';
5
+ export type IPositionCell = {
6
+ rowId: string;
7
+ colId: string;
8
+ } | undefined;
9
+ export interface IContext<T> {
10
+ t?: any;
11
+ prefix: string;
12
+ id: string;
13
+ rowKey: string;
14
+ originData: any[];
15
+ dataSource: any[];
16
+ format?: IFormat;
17
+ expandable?: ExpandableConfig<T>;
18
+ wrapSettings?: IWrapSettings;
19
+ setExpanded: Dispatch<SetStateAction<ExpandedState>>;
20
+ expanded: ExpandedState;
21
+ recordDoubleClick?: (args: RecordDoubleClickEventArgs<T>) => void;
22
+ selectionSettings?: SelectionSettings;
23
+ isSelectionChange?: {
24
+ isChange: boolean;
25
+ type: string;
26
+ rowData: T;
27
+ rowsData: T[];
28
+ };
29
+ setIsSelectionChange: Dispatch<SetStateAction<{
30
+ isChange: boolean;
31
+ type: string;
32
+ rowData: T;
33
+ rowsData: T[];
34
+ }>>;
35
+ setSorterChange: Dispatch<SetStateAction<boolean>>;
36
+ setFilterChange: Dispatch<SetStateAction<boolean>>;
37
+ onContextMenu?: (data: T) => (event: any) => void;
38
+ locale?: Locale;
39
+ windowSize: {
40
+ innerHeight: number;
41
+ innerWidth: number;
42
+ };
43
+ control?: any;
44
+ errors?: any;
45
+ handleSubmit?: any;
46
+ onSubmit?: SubmitHandler<any>;
47
+ getValues?: any;
48
+ reset?: any;
49
+ setValue?: any;
50
+ handleCellChange?: (args: ContextCellChange) => void;
51
+ editingKey?: string;
52
+ setEditingKey?: Dispatch<SetStateAction<string>>;
53
+ rangeState?: RangeState;
54
+ setRangeState?: Dispatch<SetStateAction<RangeState | undefined>>;
55
+ rangePasteState?: RangeState;
56
+ setRangePasteState?: Dispatch<SetStateAction<RangeState | undefined>>;
57
+ startCell?: IPositionCell;
58
+ setStartCell?: Dispatch<SetStateAction<IPositionCell | undefined>>;
59
+ endCell?: IPositionCell;
60
+ setEndCell?: Dispatch<SetStateAction<IPositionCell | undefined>>;
61
+ startPasteCell?: IPositionCell;
62
+ setStartPasteCell?: Dispatch<SetStateAction<IPositionCell | undefined>>;
63
+ endPasteCell?: IPositionCell;
64
+ setEndPasteCell?: Dispatch<SetStateAction<IPositionCell | undefined>>;
65
+ isSelecting?: boolean;
66
+ setIsSelecting?: Dispatch<SetStateAction<boolean>>;
67
+ isPasting?: boolean;
68
+ setIsPasting?: Dispatch<SetStateAction<boolean>>;
69
+ focusedCell?: IPositionCell;
70
+ setFocusedCell?: Dispatch<SetStateAction<IPositionCell | undefined>>;
71
+ triggerPaste?: (pastedRows: T[], pastedColumnsArray: string[], newData: T[], copyRows: T[]) => void;
72
+ handleDeleteContent?: () => void;
73
+ handleAddMulti?: (item: any, n: number, id?: string) => void;
74
+ dataErrors?: any[];
75
+ isDataTree: boolean;
76
+ handleCellClick?: (rowNumber: number, record: T, column: ColumnTable, rowId: string, cellValue: any) => void;
77
+ pagination?: false | PaginationConfig;
78
+ rowClassName?: string | RowClassName<T>;
79
+ table?: Table<T>;
80
+ rowEditable?: (rowData: T) => boolean;
81
+ onRowStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | ((data: T, row: Row<T>) => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
82
+ onRowHeaderStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
83
+ onRowFooterStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
84
+ groupSetting?: IGroupSetting;
85
+ }
86
+ export declare const TableContext: import("react").Context<IContext<any>>;
87
+ export type ContextCellChange = {
88
+ key: string;
89
+ record: any;
90
+ field: string | undefined;
91
+ option: any;
92
+ indexRow: number;
93
+ indexCol: number;
94
+ newState?: any;
95
+ prevState?: any;
96
+ type: 'enter' | 'blur' | 'outClick';
97
+ };
@@ -0,0 +1,21 @@
1
+ import { createContext } from 'react';
2
+ export const TableContext = /*#__PURE__*/createContext({
3
+ prefix: 'ui-rc',
4
+ id: '',
5
+ isDataTree: false,
6
+ rowKey: 'rowId',
7
+ dataSource: [],
8
+ originData: [],
9
+ expanded: {},
10
+ windowSize: {
11
+ innerHeight: 0,
12
+ innerWidth: 0
13
+ },
14
+ // triggerFilter: () => { },
15
+
16
+ setIsSelectionChange: () => {},
17
+ setSorterChange: () => {},
18
+ setFilterChange: () => {},
19
+ setExpanded: () => {},
20
+ handleCellClick: () => {}
21
+ });
@@ -37,9 +37,12 @@ const ColumnsGroup = props => {
37
37
  const menuRef = (0, _react.useRef)();
38
38
  const [tempGroup, setTempGroup] = (0, _react.useState)([]);
39
39
  const [clicked, setClicked] = (0, _react.useState)(false);
40
+ console.log('columns', columns);
41
+ console.log('columnsGrouped', columnsGrouped);
40
42
  const rsCol = _react.default.useMemo(() => {
41
- return columns.filter(it => it.hidden !== true && !tempGroup.includes(it.field) && it.field !== '#' && it.field !== 'command');
43
+ return columns.filter(it => it.visible !== false && !tempGroup.includes(it.field) && it.field !== '#' && it.field !== 'selection_column' && it.field !== 'command');
42
44
  }, [columns, tempGroup]);
45
+ console.log('rsCol', rsCol);
43
46
  const options = _react.default.useMemo(() => {
44
47
  return rsCol.map(it => ({
45
48
  ...it,
@@ -8,7 +8,7 @@ exports.default = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _tableComponent = _interopRequireDefault(require("../table-component"));
11
- var _InternalTable = _interopRequireDefault(require("./InternalTable"));
11
+ var _tableVirtuoso = _interopRequireDefault(require("../table-virtuoso"));
12
12
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
13
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
14
  const TempTable = props => {
@@ -17,7 +17,7 @@ const TempTable = props => {
17
17
  editAble,
18
18
  ...rest
19
19
  } = props;
20
- const TabComponent = groupAble ? _InternalTable.default : _tableComponent.default;
20
+ const TabComponent = groupAble ? _tableVirtuoso.default : _tableComponent.default;
21
21
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(TabComponent, (0, _extends2.default)({}, rest, {
22
22
  groupAble: groupAble,
23
23
  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[];
@@ -12,7 +12,7 @@ exports.addRowsUpWithCtrl = addRowsUpWithCtrl;
12
12
  exports.checkThousandSeparator = exports.checkFieldKey = exports.checkDecimalSeparator = exports.checkChild = exports.buildConnectedRegions = void 0;
13
13
  exports.compareDate = compareDate;
14
14
  exports.compareDates = compareDates;
15
- exports.convertFlatColumn = exports.convertFilters = exports.convertDayjsToDate = exports.convertDateToDayjs = exports.convertColumns = exports.convertArrayWithIndent = void 0;
15
+ exports.convertFlatColumn = exports.convertFilters = exports.convertDayjsToDate = exports.convertDateToDayjs = exports.convertArrayWithIndent = void 0;
16
16
  exports.convertFormat = convertFormat;
17
17
  exports.filterDataByColumns3 = exports.filterDataByColumns2 = exports.filterDataByColumns = exports.editAbleColumns = exports.detectSeparators = exports.customWeekStartEndFormat = exports.customFilterOption = exports.countItemsBeforeIndex = exports.convertLabelToTitle = void 0;
18
18
  exports.filterDataByColumns4 = filterDataByColumns4;
@@ -40,17 +40,20 @@ exports.isRightMostInRegion = isRightMostInRegion;
40
40
  exports.isTopMostInRegion = exports.isSelectedCell = void 0;
41
41
  exports.mergeWithFilter = mergeWithFilter;
42
42
  exports.mergeWithFilter2 = mergeWithFilter2;
43
- exports.removeColumns = exports.removeClassCellIndexSelected = exports.removeClassBorderPasteCell = exports.removeBorderPasteClass = exports.removeBorderClass2 = exports.removeBorderClass = exports.parseCells = exports.parseBooleanToValue = exports.onRemoveBorderSelectedCell = exports.onRemoveBgSelectedCell = exports.onRemoveBgCellIndex = exports.onAddBorderSelectedCell = exports.onAddBgSelectedCell = exports.onAddBgCellIndex = exports.newGuid = exports.mergedSets = void 0;
44
- exports.updateData = exports.updateColumnsByGroup = exports.updateColumns = exports.updateArrayByKey = exports.unFlattenData = exports.transformColumns1 = exports.transformColumns = exports.totalFixedWidth = exports.sumDataByField = exports.sumByField = exports.sortedSetDSC = exports.sortedSetASC = exports.showDraggingPoint = exports.shouldInclude = exports.removeVietnameseTones = exports.removeInvisibleColumns = exports.removeFieldRecursive = void 0;
43
+ exports.removeInvisibleColumns = exports.removeFieldRecursive = exports.removeClassCellIndexSelected = exports.removeClassBorderPasteCell = exports.removeBorderPasteClass = exports.removeBorderClass2 = exports.removeBorderClass = exports.parseCells = exports.parseBooleanToValue = exports.onRemoveBorderSelectedCell = exports.onRemoveBgSelectedCell = exports.onRemoveBgCellIndex = exports.onAddBorderSelectedCell = exports.onAddBgSelectedCell = exports.onAddBgCellIndex = exports.newGuid = exports.mergedSets = void 0;
44
+ exports.updateData = exports.updateColumnsByGroup = exports.updateColumns = exports.updateArrayByKey = exports.unFlattenData = exports.sumDataByField = exports.sumByField = exports.sortedSetDSC = exports.sortedSetASC = exports.showDraggingPoint = exports.shouldInclude = exports.removeVietnameseTones = void 0;
45
45
  exports.updateDataByFilter = updateDataByFilter;
46
46
  exports.updateOrInsert = updateOrInsert;
47
47
  var _dayjs = _interopRequireDefault(require("dayjs"));
48
48
  var _moment = _interopRequireDefault(require("moment/moment"));
49
49
  var _uuid = require("uuid");
50
50
  var _colors = require("@ant-design/colors");
51
- var _rcMasterUi = require("rc-master-ui");
52
- var _columns = require("./columns");
53
- var _useColumns = require("./useColumns");
51
+ // import type {SelectionSettings} from "../type"
52
+
53
+ // import {Table} from "rc-master-ui"
54
+ // import {flatColumns2} from "./columns"
55
+ // import {SELECTION_COLUMN} from "./useColumns"
56
+
54
57
  const newGuid = () => {
55
58
  for (let i = 0; i < 20; i++) {
56
59
  // @ts-ignore
@@ -460,17 +463,22 @@ const getTemplate = (template, column) => {
460
463
  }
461
464
  return template;
462
465
  };
466
+
467
+ // export const totalFixedWidth = <T, >(columns: ColumnsTable<T>, type: 'left' | 'right', selectionSettings?: SelectionSettings) => {
468
+ // const totalFixedLeftWidth: number = columns
469
+ // .filter(column => column.fixed === type) // Lọc các cột có fixed
470
+ // .reduce((sum, column) => {
471
+ // 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
472
+ // return sum + width
473
+ // }, 0)
474
+
475
+ // const selectColumnWidth: number = !selectionSettings?.mode ? 0 : (
476
+ // typeof selectionSettings?.columnWidth === 'number' ? selectionSettings?.columnWidth : parseInt(selectionSettings?.columnWidth as string, 10) || 50)
477
+
478
+ // return totalFixedLeftWidth + selectColumnWidth
479
+
480
+ // }
463
481
  exports.getTemplate = getTemplate;
464
- const totalFixedWidth = (columns, type, selectionSettings) => {
465
- const totalFixedLeftWidth = columns.filter(column => column.fixed === type) // Lọc các cột có fixed
466
- .reduce((sum, column) => {
467
- 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
468
- return sum + width;
469
- }, 0);
470
- const selectColumnWidth = !selectionSettings?.mode ? 0 : typeof selectionSettings?.columnWidth === 'number' ? selectionSettings?.columnWidth : parseInt(selectionSettings?.columnWidth, 10) || 50;
471
- return totalFixedLeftWidth + selectColumnWidth;
472
- };
473
- exports.totalFixedWidth = totalFixedWidth;
474
482
  const isObjEmpty = obj => {
475
483
  if (isNullOrUndefined(obj)) {
476
484
  return true;
@@ -1237,96 +1245,112 @@ function addRowsUp(array, n) {
1237
1245
  addedRows
1238
1246
  };
1239
1247
  }
1240
- const transformColumns = (cols, convertColumns, t) => {
1241
- // @ts-ignore
1242
- return cols.map(column => {
1243
- const find = convertColumns.find(it => it.key === column.field);
1244
- if (!column?.field && !column?.key) {
1245
- return _rcMasterUi.Table.SELECTION_COLUMN;
1246
- }
1247
- if (find) {
1248
- return {
1249
- ...find
1250
- };
1251
- }
1252
1248
 
1253
- // Xử đệ quy cho children
1254
- if (column.children?.length) {
1255
- return {
1256
- ...column,
1257
- key: column.field ?? column.dataIndex ?? column.key,
1258
- title: t ? t(column.headerText) : column.headerText,
1259
- ellipsis: column.ellipsis !== false,
1260
- align: column.textAlign ?? column.align,
1261
- children: transformColumns(column.children, convertColumns)
1262
- };
1263
- }
1264
- });
1265
- };
1266
- exports.transformColumns = transformColumns;
1267
- const transformColumns1 = (cols, sortMultiple) => {
1268
- const convertColumns = (0, _columns.flatColumns2)(cols).map((column, colIndex) => {
1269
- if (!column?.field && !column?.key) {
1270
- return _rcMasterUi.Table.SELECTION_COLUMN;
1271
- }
1272
- if (column.dataIndex === '#' || column.dataIndex === '#') {
1273
- return {
1274
- ...column
1275
- };
1276
- }
1277
- if ((column.key || column.field) === 'command') {
1278
- return {
1279
- ...column
1280
- };
1281
- }
1282
- return {
1283
- ...column,
1284
- key: column.field ?? column.dataIndex ?? column.key,
1285
- sorter: column.sorter === false ? undefined : {
1286
- compare: a => a,
1287
- multiple: sortMultiple ? colIndex : undefined
1288
- }
1289
- };
1290
- });
1249
+ // export const transformColumns = <RecordType, >(cols: ColumnsTable<RecordType>, convertColumns: any[], t?: any): ColumnsTable<RecordType> => {
1291
1250
 
1292
- // @ts-ignore
1293
- return cols.map(column => {
1294
- const find = convertColumns.find(it => it.key === column.field);
1295
- if (!column?.field && !column?.key) {
1296
- return _rcMasterUi.Table.SELECTION_COLUMN;
1297
- }
1298
- if (find) {
1299
- return {
1300
- ...find
1301
- };
1302
- }
1251
+ // // @ts-ignore
1252
+ // return cols.map((column) => {
1253
+
1254
+ // const find = convertColumns.find((it) => it.key === column.field)
1255
+
1256
+ // if (!column?.field && !column?.key) {
1257
+ // return Table.SELECTION_COLUMN
1258
+ // }
1259
+
1260
+ // if (find) {
1261
+ // return {...find}
1262
+ // }
1263
+
1264
+ // // Xử lý đệ quy cho children
1265
+ // if (column.children?.length) {
1266
+ // return {
1267
+ // ...column,
1268
+ // key: column.field ?? column.dataIndex ?? column.key,
1269
+ // title: t ? t(column.headerText) : column.headerText,
1270
+ // ellipsis: column.ellipsis !== false,
1271
+ // align: column.textAlign ?? column.align,
1272
+ // children: transformColumns(column.children, convertColumns)
1273
+ // }
1274
+ // }
1275
+
1276
+ // })
1277
+
1278
+ // }
1279
+
1280
+ // export const transformColumns1 = <RecordType, >(cols: ColumnsTable<RecordType>, sortMultiple?: boolean): ColumnsTable<RecordType> => {
1281
+
1282
+ // const convertColumns = flatColumns2(cols).map((column: any, colIndex) => {
1283
+
1284
+ // if (!column?.field && !column?.key) {
1285
+ // return Table.SELECTION_COLUMN
1286
+ // }
1287
+
1288
+ // if (column.dataIndex === '#' || column.dataIndex === '#') {
1289
+ // return {
1290
+ // ...column
1291
+
1292
+ // }
1293
+ // }
1294
+
1295
+ // if ((column.key || column.field) === 'command') {
1296
+ // return {
1297
+ // ...column
1298
+ // }
1299
+ // }
1300
+
1301
+ // return {
1302
+ // ...column,
1303
+ // key: column.field ?? column.dataIndex ?? column.key,
1304
+ // sorter: (column.sorter === false ? undefined : {
1305
+ // compare: (a: any) => a,
1306
+ // multiple: sortMultiple ? colIndex : undefined
1307
+ // })
1308
+ // }
1309
+
1310
+ // })
1311
+
1312
+ // // @ts-ignore
1313
+ // return cols.map((column) => {
1314
+
1315
+ // const find = convertColumns.find((it) => it.key === column.field)
1316
+
1317
+ // if (!column?.field && !column?.key) {
1318
+ // return Table.SELECTION_COLUMN
1319
+ // }
1320
+
1321
+ // if (find) {
1322
+ // return {...find}
1323
+ // }
1324
+
1325
+ // // Xử lý đệ quy cho children
1326
+ // if (column.children?.length) {
1327
+ // return {
1328
+ // ...column,
1329
+ // key: column.field ?? column.dataIndex ?? column.key,
1330
+ // ellipsis: column.ellipsis !== false,
1331
+ // align: column.textAlign ?? column.align,
1332
+ // children: transformColumns(column.children, convertColumns)
1333
+ // }
1334
+ // }
1335
+
1336
+ // })
1337
+
1338
+ // }
1339
+
1340
+ // export const removeColumns = <RecordType, >(columns: ColumnTable<RecordType>[], groupColumns: string[]): ColumnsTable<RecordType> => {
1341
+
1342
+ // const ttt: ColumnTable<RecordType>[] = [...columns]
1343
+
1344
+ // return ttt.filter(column => !groupColumns.includes(column.field as string)).map((column) => {
1345
+ // const newCol = {...column}
1346
+ // if (newCol?.children && newCol?.children.length > 0) {
1347
+ // newCol.children = removeColumns(newCol.children, groupColumns) as any[]
1348
+ // }
1349
+ // return newCol
1350
+ // })
1351
+
1352
+ // }
1303
1353
 
1304
- // Xử lý đệ quy cho children
1305
- if (column.children?.length) {
1306
- return {
1307
- ...column,
1308
- key: column.field ?? column.dataIndex ?? column.key,
1309
- ellipsis: column.ellipsis !== false,
1310
- align: column.textAlign ?? column.align,
1311
- children: transformColumns(column.children, convertColumns)
1312
- };
1313
- }
1314
- });
1315
- };
1316
- exports.transformColumns1 = transformColumns1;
1317
- const removeColumns = (columns, groupColumns) => {
1318
- const ttt = [...columns];
1319
- return ttt.filter(column => !groupColumns.includes(column.field)).map(column => {
1320
- const newCol = {
1321
- ...column
1322
- };
1323
- if (newCol?.children && newCol?.children.length > 0) {
1324
- newCol.children = removeColumns(newCol.children, groupColumns);
1325
- }
1326
- return newCol;
1327
- });
1328
- };
1329
- exports.removeColumns = removeColumns;
1330
1354
  const convertFlatColumn = array => {
1331
1355
  const tmp = [...array];
1332
1356
  let result = [];
@@ -1339,56 +1363,56 @@ const convertFlatColumn = array => {
1339
1363
  });
1340
1364
  return result;
1341
1365
  };
1366
+
1367
+ // export const convertColumns = <RecordType, >(cols: ColumnsTable<RecordType>): ColumnsTable<RecordType> => {
1368
+
1369
+ // return cols.map((col) => {
1370
+
1371
+ // if (col === SELECTION_COLUMN) {
1372
+ // return SELECTION_COLUMN
1373
+ // }
1374
+
1375
+ // const transformedColumn = {
1376
+ // ...col,
1377
+ // dataIndex: col.field ?? col.dataIndex,
1378
+ // key: col.field ?? col.dataIndex ?? col.key,
1379
+ // // title: t ? t(col.columnGroupText ?? col.headerText ?? col.title) : col.columnGroupText ?? col.headerText ?? col.title,
1380
+ // // title: () => (<span>aaa</span>),
1381
+ // // title: () => (<HeaderContent column={{...col} as any} t={t}/>),
1382
+ // // title: () => (<span>{t ? t(col.columnGroupText ?? col.headerText ?? col.title) : col.columnGroupText ?? col.headerText ?? col.title}</span>),
1383
+ // ellipsis: col.ellipsis !== false,
1384
+ // align: col.textAlign ?? col.align,
1385
+ // fixed: col.fixedType ?? col.fixed
1386
+ // }
1387
+
1388
+ // if (transformedColumn.children && transformedColumn.children?.length) {
1389
+ // return {
1390
+ // ...transformedColumn,
1391
+ // children: convertColumns(transformedColumn.children)
1392
+ // }
1393
+ // }
1394
+
1395
+ // if (["index", "#"].includes(col.field as string)) {
1396
+ // return {
1397
+ // ...transformedColumn,
1398
+ // onCell: () => ({className: 'cell-number'}),
1399
+ // render: (_: any, __: any, rowIndex: number) => rowIndex + 1
1400
+ // }
1401
+ // }
1402
+
1403
+ // if (col.key === 'command') {
1404
+ // return {
1405
+ // ...transformedColumn,
1406
+ // onCell: () => ({className: 'cell-number', style: {padding: '2px 8px'}})
1407
+ // }
1408
+ // }
1409
+
1410
+ // return {
1411
+ // ...transformedColumn
1412
+ // }
1413
+ // })
1414
+ // }
1342
1415
  exports.convertFlatColumn = convertFlatColumn;
1343
- const convertColumns = cols => {
1344
- return cols.map(col => {
1345
- if (col === _useColumns.SELECTION_COLUMN) {
1346
- return _useColumns.SELECTION_COLUMN;
1347
- }
1348
- const transformedColumn = {
1349
- ...col,
1350
- dataIndex: col.field ?? col.dataIndex,
1351
- key: col.field ?? col.dataIndex ?? col.key,
1352
- // title: t ? t(col.columnGroupText ?? col.headerText ?? col.title) : col.columnGroupText ?? col.headerText ?? col.title,
1353
- // title: () => (<span>aaa</span>),
1354
- // title: () => (<HeaderContent column={{...col} as any} t={t}/>),
1355
- // title: () => (<span>{t ? t(col.columnGroupText ?? col.headerText ?? col.title) : col.columnGroupText ?? col.headerText ?? col.title}</span>),
1356
- ellipsis: col.ellipsis !== false,
1357
- align: col.textAlign ?? col.align,
1358
- fixed: col.fixedType ?? col.fixed
1359
- };
1360
- if (transformedColumn.children && transformedColumn.children?.length) {
1361
- return {
1362
- ...transformedColumn,
1363
- children: convertColumns(transformedColumn.children)
1364
- };
1365
- }
1366
- if (["index", "#"].includes(col.field)) {
1367
- return {
1368
- ...transformedColumn,
1369
- onCell: () => ({
1370
- className: 'cell-number'
1371
- }),
1372
- render: (_, __, rowIndex) => rowIndex + 1
1373
- };
1374
- }
1375
- if (col.key === 'command') {
1376
- return {
1377
- ...transformedColumn,
1378
- onCell: () => ({
1379
- className: 'cell-number',
1380
- style: {
1381
- padding: '2px 8px'
1382
- }
1383
- })
1384
- };
1385
- }
1386
- return {
1387
- ...transformedColumn
1388
- };
1389
- });
1390
- };
1391
- exports.convertColumns = convertColumns;
1392
1416
  const checkChild = inputArray => {
1393
1417
  return inputArray.some(item => item.children && item.children.length > 0);
1394
1418
  };
@@ -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;
@@ -6,7 +6,4 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _TempTable = _interopRequireDefault(require("./TempTable"));
9
- // import InternalTable from './InternalTable'
10
- //
11
- // export default InternalTable
12
9
  var _default = exports.default = _TempTable.default;
@@ -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 {};