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.
- package/es/grid-component/ColumnsGroup/ColumnsGroup.js +4 -1
- package/es/grid-component/TempTable.js +2 -2
- package/es/grid-component/hooks/utils.d.ts +2 -8
- package/es/grid-component/hooks/utils.js +175 -144
- package/es/grid-component/index.d.ts +1 -1
- package/es/grid-component/index.js +0 -4
- package/es/grid-component/type.d.ts +7 -0
- package/es/table-component/type.d.ts +8 -0
- package/es/table-virtuoso/ColumnsGroup/ColumnsGroup.d.ts +12 -0
- package/es/table-virtuoso/ColumnsGroup/ColumnsGroup.js +232 -0
- package/es/table-virtuoso/ColumnsGroup/index.d.ts +1 -0
- package/es/table-virtuoso/ColumnsGroup/index.js +1 -0
- package/es/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
- package/es/table-virtuoso/InternalTable.js +413 -0
- package/es/table-virtuoso/body/TableBody.d.ts +14 -0
- package/es/table-virtuoso/body/TableBody.js +84 -0
- package/es/table-virtuoso/body/TableBodyCell.d.ts +14 -0
- package/es/table-virtuoso/body/TableBodyCell.js +466 -0
- package/es/table-virtuoso/body/TableBodyRow.d.ts +13 -0
- package/es/table-virtuoso/body/TableBodyRow.js +116 -0
- package/es/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
- package/es/table-virtuoso/footer/TableFooterCell.js +54 -0
- package/es/table-virtuoso/header/TableHeadCell.d.ts +14 -0
- package/es/table-virtuoso/header/TableHeadCell.js +265 -0
- package/es/table-virtuoso/header/renderFilter.d.ts +20 -0
- package/es/table-virtuoso/header/renderFilter.js +289 -0
- package/es/table-virtuoso/hook/constant.d.ts +73 -0
- package/es/table-virtuoso/hook/constant.js +240 -0
- package/es/table-virtuoso/hook/convert.d.ts +1 -0
- package/es/table-virtuoso/hook/convert.js +28 -0
- package/es/table-virtuoso/hook/useColumns.d.ts +28 -0
- package/es/table-virtuoso/hook/useColumns.js +302 -0
- package/es/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
- package/es/table-virtuoso/hook/useFilterOperator.js +33 -0
- package/es/table-virtuoso/hook/utils.d.ts +159 -0
- package/es/table-virtuoso/hook/utils.js +2263 -0
- package/es/table-virtuoso/index.d.ts +2 -0
- package/es/table-virtuoso/index.js +2 -0
- package/es/table-virtuoso/style.d.ts +22 -0
- package/es/table-virtuoso/style.js +11 -0
- package/es/table-virtuoso/style.scss +1440 -0
- package/es/table-virtuoso/table/Grid.d.ts +37 -0
- package/es/table-virtuoso/table/Grid.js +302 -0
- package/es/table-virtuoso/table/TableContainer.d.ts +49 -0
- package/es/table-virtuoso/table/TableContainer.js +305 -0
- package/es/table-virtuoso/table/TableWrapper.d.ts +20 -0
- package/es/table-virtuoso/table/TableWrapper.js +158 -0
- package/es/table-virtuoso/type.d.ts +0 -0
- package/es/table-virtuoso/type.js +785 -0
- package/es/table-virtuoso/useContext.d.ts +97 -0
- package/es/table-virtuoso/useContext.js +21 -0
- package/lib/grid-component/ColumnsGroup/ColumnsGroup.js +4 -1
- package/lib/grid-component/TempTable.js +2 -2
- package/lib/grid-component/hooks/utils.d.ts +2 -8
- package/lib/grid-component/hooks/utils.js +176 -152
- package/lib/grid-component/index.d.ts +1 -1
- package/lib/grid-component/index.js +0 -3
- package/lib/grid-component/type.d.ts +7 -0
- package/lib/table-component/type.d.ts +8 -0
- package/lib/table-virtuoso/ColumnsGroup/ColumnsGroup.d.ts +12 -0
- package/lib/table-virtuoso/ColumnsGroup/ColumnsGroup.js +243 -0
- package/lib/table-virtuoso/ColumnsGroup/index.d.ts +1 -0
- package/lib/table-virtuoso/ColumnsGroup/index.js +16 -0
- package/lib/{grid-component → table-virtuoso}/InternalTable.d.ts +2 -3
- package/lib/table-virtuoso/InternalTable.js +422 -0
- package/lib/table-virtuoso/body/TableBody.d.ts +14 -0
- package/lib/table-virtuoso/body/TableBody.js +95 -0
- package/lib/table-virtuoso/body/TableBodyCell.d.ts +14 -0
- package/lib/table-virtuoso/body/TableBodyCell.js +473 -0
- package/lib/table-virtuoso/body/TableBodyRow.d.ts +13 -0
- package/lib/table-virtuoso/body/TableBodyRow.js +124 -0
- package/lib/table-virtuoso/footer/TableFooterCell.d.ts +7 -0
- package/lib/table-virtuoso/footer/TableFooterCell.js +63 -0
- package/lib/table-virtuoso/header/TableHeadCell.d.ts +14 -0
- package/lib/table-virtuoso/header/TableHeadCell.js +274 -0
- package/lib/table-virtuoso/header/renderFilter.d.ts +20 -0
- package/lib/table-virtuoso/header/renderFilter.js +299 -0
- package/lib/table-virtuoso/hook/constant.d.ts +73 -0
- package/lib/table-virtuoso/hook/constant.js +247 -0
- package/lib/table-virtuoso/hook/convert.d.ts +1 -0
- package/lib/table-virtuoso/hook/convert.js +34 -0
- package/lib/table-virtuoso/hook/useColumns.d.ts +28 -0
- package/lib/table-virtuoso/hook/useColumns.js +315 -0
- package/lib/table-virtuoso/hook/useFilterOperator.d.ts +7 -0
- package/lib/table-virtuoso/hook/useFilterOperator.js +40 -0
- package/lib/table-virtuoso/hook/utils.d.ts +159 -0
- package/lib/table-virtuoso/hook/utils.js +2389 -0
- package/lib/table-virtuoso/index.d.ts +2 -0
- package/lib/table-virtuoso/index.js +9 -0
- package/lib/table-virtuoso/style.d.ts +22 -0
- package/lib/table-virtuoso/style.js +18 -0
- package/lib/table-virtuoso/style.scss +1440 -0
- package/lib/table-virtuoso/table/Grid.d.ts +37 -0
- package/lib/table-virtuoso/table/Grid.js +311 -0
- package/lib/table-virtuoso/table/TableContainer.d.ts +49 -0
- package/lib/table-virtuoso/table/TableContainer.js +313 -0
- package/lib/table-virtuoso/table/TableWrapper.d.ts +20 -0
- package/lib/table-virtuoso/table/TableWrapper.js +164 -0
- package/lib/table-virtuoso/type.d.ts +0 -0
- package/lib/table-virtuoso/type.js +786 -0
- package/lib/table-virtuoso/useContext.d.ts +97 -0
- package/lib/table-virtuoso/useContext.js +27 -0
- package/package.json +2 -1
- package/es/grid-component/ConvertColumnTable.d.ts +0 -7
- package/es/grid-component/ConvertColumnTable.js +0 -144
- package/es/grid-component/InternalTable.js +0 -1170
- package/es/grid-component/table/Grid.d.ts +0 -23
- package/es/grid-component/table/Grid.js +0 -49
- package/es/grid-component/table/GridEdit.d.ts +0 -23
- package/es/grid-component/table/GridEdit.js +0 -2726
- package/es/grid-component/table/Group.d.ts +0 -21
- package/es/grid-component/table/Group.js +0 -195
- package/es/grid-component/table/InfiniteTable.d.ts +0 -23
- package/es/grid-component/table/InfiniteTable.js +0 -101
- package/lib/grid-component/ConvertColumnTable.d.ts +0 -7
- package/lib/grid-component/ConvertColumnTable.js +0 -153
- package/lib/grid-component/InternalTable.js +0 -1178
- package/lib/grid-component/table/Grid.d.ts +0 -23
- package/lib/grid-component/table/Grid.js +0 -58
- package/lib/grid-component/table/GridEdit.d.ts +0 -23
- package/lib/grid-component/table/GridEdit.js +0 -2723
- package/lib/grid-component/table/Group.d.ts +0 -21
- package/lib/grid-component/table/Group.js +0 -204
- package/lib/grid-component/table/InfiniteTable.d.ts +0 -23
- 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
|