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,20 @@
1
+ import React from 'react';
2
+ import type { ColumnDef, Table } from "@tanstack/react-table";
3
+ type Props<T> = {
4
+ tableContainerRef: React.RefObject<HTMLDivElement>;
5
+ table: Table<T>;
6
+ prefix: string;
7
+ id: string;
8
+ columns: ColumnDef<T>[];
9
+ height: number;
10
+ minHeight?: number;
11
+ dataSource: T[];
12
+ summary?: boolean;
13
+ loading?: boolean;
14
+ editAble?: boolean;
15
+ showEmptyText?: boolean;
16
+ contextMenuClick?: any;
17
+ next?: () => void;
18
+ };
19
+ declare const TableWrapper: <RecordType extends object>(props: Props<RecordType>) => React.JSX.Element;
20
+ export default TableWrapper;
@@ -0,0 +1,158 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ /* eslint-disable @typescript-eslint/no-shadow */
3
+
4
+ // import type { Dispatch, SetStateAction } from 'react';
5
+ import React, { useContext, useRef } from 'react';
6
+ import { TableVirtuoso } from "react-virtuoso";
7
+ import "@tanstack/react-table"; // useReactTable,
8
+ // getCoreRowModel,
9
+ // flexRender,
10
+ // getGroupedRowModel,
11
+ // getExpandedRowModel
12
+ import TableHeadCell from "../header/TableHeadCell";
13
+ import { TableContext } from "../useContext";
14
+ import classNames from 'classnames';
15
+ import TableBodyRow from "../body/TableBodyRow";
16
+ import TableFooterCell from "../footer/TableFooterCell";
17
+ // import type { ColumnsTable, TableProps } from '../type';
18
+
19
+ // type TableContainerProps<T> = Omit<TableProps<T>, 'columns'> & {
20
+
21
+ const TableWrapper = props => {
22
+ const {
23
+ table,
24
+ // columns,
25
+ height,
26
+ id
27
+ } = props;
28
+ const {
29
+ prefix
30
+ } = useContext(TableContext); //onRowHeaderStyles
31
+
32
+ // ref cho scroll container
33
+ const scrollRef = useRef(null);
34
+ const {
35
+ rows
36
+ } = table.getRowModel();
37
+ return /*#__PURE__*/React.createElement("div", {
38
+ className: classNames(`${prefix}-grid-container`, {})
39
+ }, /*#__PURE__*/React.createElement("div", {
40
+ ref: scrollRef,
41
+ style: {
42
+ overflow: "auto",
43
+ // border: "1px solid #ccc",
44
+ height,
45
+ position: "relative"
46
+ }
47
+ }, /*#__PURE__*/React.createElement(TableVirtuoso, {
48
+ data: table.getRowModel().rows,
49
+ totalCount: rows.length,
50
+ components: {
51
+ Table: ({
52
+ style,
53
+ ...props
54
+ }) => {
55
+ return /*#__PURE__*/React.createElement("table", _extends({}, props, {
56
+ style: {
57
+ ...style,
58
+ width: "100%",
59
+ tableLayout: "fixed"
60
+ // borderCollapse: "collapse",
61
+ // borderSpacing: 0
62
+ }
63
+ // className={classNames(`${prefix}-grid-container`, {
64
+ // 'ui-rc-table-ping-right':
65
+ // tableContainerRef &&
66
+ // (tableContainerRef.current?.scrollLeft ?? 0) >= 0 &&
67
+ // (tableContainerRef.current?.scrollLeft ?? 0) + (tableContainerRef.current?.clientWidth ?? 0) <
68
+ // (tableContainerRef.current?.scrollWidth ?? 0),
69
+
70
+ // 'ui-rc-table-ping-left': tableContainerRef && (tableContainerRef.current?.scrollLeft ?? 0) > 0
71
+ // })}
72
+ }));
73
+ },
74
+ TableHead: props => /*#__PURE__*/React.createElement("thead", _extends({}, props, {
75
+ className: `${prefix}-grid-thead`
76
+ })),
77
+ TableFoot: props => /*#__PURE__*/React.createElement("tfoot", _extends({}, props, {
78
+ className: `${prefix}-grid-tfoot`
79
+ })),
80
+ TableRow: props => {
81
+ const index = props["data-index"];
82
+ const row = rows[index];
83
+ return /*#__PURE__*/React.createElement(TableBodyRow, _extends({
84
+ tableId: id,
85
+ row: row,
86
+ table: table
87
+ }, props));
88
+ }
89
+ }
90
+
91
+ // overscan={{
92
+ // main: 10,
93
+ // reverse: 20
94
+ // }}
95
+
96
+ // atBottomThreshold={200}
97
+ // atTopThreshold={200}
98
+ ,
99
+ increaseViewportBy: {
100
+ top: 200,
101
+ bottom: 200
102
+ },
103
+ fixedHeaderContent: () => {
104
+ return table.getHeaderGroups().map((headerGroup, index) => {
105
+ return /*#__PURE__*/React.createElement("tr", {
106
+ key: headerGroup.id,
107
+ "data-index": headerGroup.id
108
+ }, headerGroup.headers.map(header => {
109
+ const columnRelativeDepth = header.depth - header.column.depth;
110
+ if (columnRelativeDepth > 1) {
111
+ return null;
112
+ }
113
+ let rowSpan = 1;
114
+ if (header.isPlaceholder) {
115
+ const leafs = header.getLeafHeaders();
116
+ rowSpan = leafs[leafs.length - 1].depth - header.depth;
117
+ }
118
+ return /*#__PURE__*/React.createElement(TableHeadCell, {
119
+ key: header.id,
120
+ header: header,
121
+ table: table,
122
+ colSpan: header.colSpan,
123
+ rowSpan: rowSpan,
124
+ rowIndex: index
125
+ });
126
+ }));
127
+ });
128
+ },
129
+ fixedFooterContent: () => {
130
+ const visibleColumns = table.getVisibleLeafColumns();
131
+ return /*#__PURE__*/React.createElement("tr", {
132
+ className: "ui-rc-grid-footer-row"
133
+ }, visibleColumns.map(header => {
134
+ return /*#__PURE__*/React.createElement(TableFooterCell, {
135
+ key: header.id,
136
+ column: header
137
+ });
138
+ }));
139
+ }
140
+
141
+ // itemContent={(index) => {
142
+
143
+ // const row = rows[index]
144
+ // return (
145
+
146
+ // <TableBodyRow
147
+ // tableId={id}
148
+ // row={row}
149
+ // table={table}
150
+ // // {...props}
151
+
152
+ // />
153
+
154
+ // )
155
+ // }}
156
+ })));
157
+ };
158
+ export default TableWrapper;
File without changes