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,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TableContext = void 0;
7
+ var _react = require("react");
8
+ const TableContext = exports.TableContext = /*#__PURE__*/(0, _react.createContext)({
9
+ prefix: 'ui-rc',
10
+ id: '',
11
+ isDataTree: false,
12
+ rowKey: 'rowId',
13
+ dataSource: [],
14
+ originData: [],
15
+ expanded: {},
16
+ windowSize: {
17
+ innerHeight: 0,
18
+ innerWidth: 0
19
+ },
20
+ // triggerFilter: () => { },
21
+
22
+ setIsSelectionChange: () => {},
23
+ setSorterChange: () => {},
24
+ setFilterChange: () => {},
25
+ setExpanded: () => {},
26
+ handleCellClick: () => {}
27
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-grid-template",
3
- "version": "1.8.64",
3
+ "version": "1.8.65",
4
4
  "description": "es-grid-template",
5
5
  "keywords": [
6
6
  "react",
@@ -75,6 +75,7 @@
75
75
  "react-numeric-component": "^1.0.7",
76
76
  "react-resizable": "^3.0.5",
77
77
  "react-tooltip": "^5.28.1",
78
+ "react-virtuoso": "^4.17.0",
78
79
  "rimraf": "5.0.10",
79
80
  "sass": "^1.81.0",
80
81
  "styled-components": "^6.1.15",
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import type { GridTableProps } from "./type";
3
- import 'dayjs/locale/es';
4
- import 'dayjs/locale/vi';
5
- import './styles.scss';
6
- declare const ConvertColumnTable: <RecordType extends object>(props: GridTableProps<RecordType>) => React.JSX.Element;
7
- export default ConvertColumnTable;
@@ -1,144 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import React, { useMemo } from 'react';
3
- // import classNames from "classnames";
4
-
5
- import { Resizable } from "react-resizable";
6
- import customParseFormat from 'dayjs/plugin/customParseFormat';
7
- import dayjs from "dayjs";
8
- import 'dayjs/locale/es';
9
- import 'dayjs/locale/vi';
10
- import en from 'rc-master-ui/es/date-picker/locale/en_US';
11
- import vi from 'rc-master-ui/es/date-picker/locale/vi_VN';
12
- import "./styles.scss";
13
- import InternalTable from "./InternalTable";
14
- import useColumns from "./hooks/useColumns";
15
- import { updateArrayByKey } from "./hooks";
16
- // import useMergedState from "rc-util/lib/hooks/useMergedState";
17
-
18
- dayjs.extend(customParseFormat);
19
-
20
- // const ASCEND = 'ascend';
21
- // const DESCEND = 'descend';
22
-
23
- const ResizableTitle = props => {
24
- const {
25
- onResize,
26
- width,
27
- ...restProps
28
- } = props;
29
- if (!width) {
30
- return /*#__PURE__*/React.createElement("th", restProps);
31
- }
32
- return (
33
- /*#__PURE__*/
34
- // @ts-ignore
35
- React.createElement(Resizable, {
36
- width: width,
37
- height: 0,
38
- handle: /*#__PURE__*/React.createElement("span", {
39
- className: "react-resizable-handle",
40
- onClick: e => {
41
- e.stopPropagation();
42
- }
43
- }),
44
- onResize: onResize,
45
- draggableOpts: {
46
- enableUserSelectHack: false
47
- }
48
- }, /*#__PURE__*/React.createElement("th", restProps))
49
- );
50
- };
51
- const ConvertColumnTable = props => {
52
- const {
53
- t,
54
- columns: propsColumns,
55
- dataSource,
56
- lang,
57
- locale,
58
- format,
59
- allowResizing,
60
- dataSourceFilter: propDataSourceFilter,
61
- onFilterClick,
62
- editAble,
63
- rowKey: propRowKey,
64
- sortMultiple,
65
- groupAble,
66
- groupSetting,
67
- groupColumns,
68
- ...rest
69
- } = props;
70
- const local = lang && lang === 'en' ? en : vi;
71
- const buddhistLocale = {
72
- ...local,
73
- lang: {
74
- ...local.lang
75
- }
76
- };
77
- const rowKey = useMemo(() => {
78
- return editAble ? 'rowId' : propRowKey ?? 'id';
79
- }, [editAble, propRowKey]);
80
- const [columns, setColumns] = React.useState([]);
81
-
82
- // ========================= Keys =========================
83
- // const [columns, setColumns] = useMergedState(
84
- // propsColumns || [],
85
- // {
86
- // value: propsColumns,
87
- // },
88
- // );
89
-
90
- React.useEffect(() => {
91
- setColumns(propsColumns);
92
- }, [propsColumns]);
93
- const handleResize = column => (e, {
94
- size
95
- }) => {
96
- const newColumn = {
97
- ...column,
98
- width: size.width
99
- };
100
- const newColumns = updateArrayByKey(columns, newColumn, 'field');
101
- setColumns(newColumns);
102
- };
103
- const [transformSelectionColumns] = useColumns({
104
- locale,
105
- t,
106
- buddhistLocale,
107
- dataSource,
108
- dataSourceFilter: propDataSourceFilter,
109
- format,
110
- sortMultiple,
111
- groupAble,
112
- groupSetting,
113
- groupColumns,
114
- handleResize
115
- });
116
- const mergedColumns = React.useMemo(() => {
117
- return transformSelectionColumns(columns);
118
- }, [columns, transformSelectionColumns]);
119
- const mergerdData = React.useMemo(() => {
120
- return dataSource;
121
- }, [dataSource]);
122
- return /*#__PURE__*/React.createElement(InternalTable, _extends({}, rest, {
123
- t: t,
124
- editAble: editAble,
125
- dataSource: mergerdData,
126
- format: format,
127
- locale: locale,
128
- components: {
129
- header: {
130
- cell: allowResizing ? ResizableTitle : undefined
131
- }
132
- }
133
- // columns={mergedColumns}
134
- ,
135
- columns: mergedColumns ?? [],
136
- showSorterTooltip: {
137
- target: 'sorter-icon'
138
- },
139
- rowKey: rowKey,
140
- groupAble: groupAble,
141
- groupSetting: groupSetting
142
- }));
143
- };
144
- export default ConvertColumnTable;