es-grid-template 1.7.26 → 1.7.27
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/table-component/InternalTable.js +69 -4
- package/es/table-component/TableContainerEdit.d.ts +2 -0
- package/es/table-component/TableContainerEdit.js +25 -17
- package/es/table-component/body/TableBody.d.ts +1 -1
- package/es/table-component/body/TableBody.js +27 -0
- package/es/table-component/body/TableBodyCell.js +3 -1
- package/es/table-component/body/TableBodyCellEdit.js +20 -18
- package/es/table-component/footer/TableFooterCell.js +3 -2
- package/es/table-component/header/TableHead.d.ts +1 -1
- package/es/table-component/header/TableHead.js +42 -6
- package/es/table-component/header/TableHeadCell.d.ts +2 -0
- package/es/table-component/header/TableHeadCell.js +16 -47
- package/es/table-component/header/TableHeadRow.d.ts +3 -4
- package/es/table-component/header/TableHeadRow.js +55 -58
- package/es/table-component/hook/convert.d.ts +1 -0
- package/es/table-component/hook/convert.js +28 -0
- package/es/table-component/hook/useColumns.js +1 -0
- package/es/table-component/hook/utils.js +3 -0
- package/es/table-component/style.scss +39 -50
- package/es/table-component/table/Grid.d.ts +2 -0
- package/es/table-component/table/Grid.js +3 -2
- package/es/table-component/type.d.ts +5 -0
- package/lib/table-component/InternalTable.js +69 -4
- package/lib/table-component/TableContainerEdit.d.ts +2 -0
- package/lib/table-component/TableContainerEdit.js +25 -17
- package/lib/table-component/body/TableBody.d.ts +1 -1
- package/lib/table-component/body/TableBody.js +27 -0
- package/lib/table-component/body/TableBodyCell.js +3 -1
- package/lib/table-component/body/TableBodyCellEdit.js +20 -18
- package/lib/table-component/footer/TableFooterCell.js +3 -2
- package/lib/table-component/header/TableHead.d.ts +1 -1
- package/lib/table-component/header/TableHead.js +42 -6
- package/lib/table-component/header/TableHeadCell.d.ts +2 -0
- package/lib/table-component/header/TableHeadCell.js +16 -47
- package/lib/table-component/header/TableHeadRow.d.ts +3 -4
- package/lib/table-component/header/TableHeadRow.js +55 -58
- package/lib/table-component/hook/convert.d.ts +1 -0
- package/lib/table-component/hook/convert.js +34 -0
- package/lib/table-component/hook/useColumns.js +1 -0
- package/lib/table-component/hook/utils.js +3 -0
- package/lib/table-component/style.scss +39 -50
- package/lib/table-component/table/Grid.d.ts +2 -0
- package/lib/table-component/table/Grid.js +3 -2
- package/lib/table-component/type.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,90 +1,87 @@
|
|
|
1
1
|
import { horizontalListSortingStrategy, SortableContext } from '@dnd-kit/sortable';
|
|
2
|
+
import { flexRender } from '@tanstack/react-table';
|
|
2
3
|
// import type { Person } from "../../tanstack-table/makeData"
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { TableContext } from "../useContext";
|
|
5
6
|
import TableHeadCell from "./TableHeadCell";
|
|
7
|
+
import { getCommonPinningStyles } from "../hook/utils";
|
|
6
8
|
const TableHeadRow = ({
|
|
7
9
|
table,
|
|
8
10
|
columnVirtualizer,
|
|
9
11
|
rowHeaderVirtualizer,
|
|
10
|
-
headerGroup
|
|
11
|
-
virtualPaddingLeft,
|
|
12
|
-
virtualPaddingRight,
|
|
13
|
-
fixedLeftColumns,
|
|
14
|
-
fixedRightColumns,
|
|
15
|
-
rowHeaderVirtual
|
|
12
|
+
headerGroup
|
|
13
|
+
// virtualPaddingLeft,
|
|
14
|
+
// virtualPaddingRight,
|
|
15
|
+
// fixedLeftColumns,
|
|
16
|
+
// fixedRightColumns,
|
|
17
|
+
// rowHeaderVirtual
|
|
16
18
|
}) => {
|
|
17
19
|
const {
|
|
18
20
|
prefix
|
|
19
21
|
} = React.useContext(TableContext);
|
|
20
|
-
const virtualColumns = columnVirtualizer.getVirtualItems();
|
|
21
|
-
// const virtualColumns = columnVirtualizer.measurementsCache
|
|
22
22
|
|
|
23
|
-
//
|
|
23
|
+
// const virtualColumns = columnVirtualizer.getVirtualItems()
|
|
24
|
+
// const virtualColumns = columnVirtualizer.measurementsCache
|
|
24
25
|
|
|
25
26
|
const columnOrder = table.getState().columnOrder;
|
|
26
27
|
return /*#__PURE__*/React.createElement("tr", {
|
|
27
|
-
key: headerGroup.id
|
|
28
|
-
ref
|
|
29
|
-
|
|
30
|
-
}
|
|
28
|
+
key: headerGroup.id
|
|
29
|
+
// ref={el => {
|
|
30
|
+
// if (el) rowHeaderVirtualizer.measureElement(el)
|
|
31
|
+
// }}
|
|
31
32
|
// data-index={rowHeaderVirtual?.index}
|
|
32
33
|
,
|
|
33
34
|
"data-index": headerGroup.id,
|
|
34
35
|
className: `${prefix}-grid-row`,
|
|
35
36
|
style: {
|
|
36
|
-
display: 'flex',
|
|
37
|
-
width: '100%'
|
|
38
|
-
minHeight: rowHeaderVirtual?.size
|
|
37
|
+
// display: 'flex',
|
|
38
|
+
width: '100%'
|
|
39
|
+
// minHeight: rowHeaderVirtual?.size
|
|
39
40
|
}
|
|
40
41
|
}, /*#__PURE__*/React.createElement(SortableContext, {
|
|
41
42
|
items: columnOrder,
|
|
42
43
|
strategy: horizontalListSortingStrategy
|
|
43
|
-
},
|
|
44
|
+
}, headerGroup.headers.map(header => {
|
|
45
|
+
const columnRelativeDepth = header.depth - header.column.depth;
|
|
46
|
+
if (columnRelativeDepth > 1) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
let rowSpan = 1;
|
|
50
|
+
if (header.isPlaceholder) {
|
|
51
|
+
const leafs = header.getLeafHeaders();
|
|
52
|
+
rowSpan = leafs[leafs.length - 1].depth - header.depth;
|
|
53
|
+
}
|
|
44
54
|
return /*#__PURE__*/React.createElement(TableHeadCell, {
|
|
55
|
+
key: header.id,
|
|
56
|
+
header: header,
|
|
57
|
+
table: table,
|
|
45
58
|
columnVirtualizer: columnVirtualizer,
|
|
46
59
|
rowHeaderVirtualizer: rowHeaderVirtualizer,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
header: headerGroup.headers.find(h => h.column.id === column.id)
|
|
50
|
-
// column={column as any}
|
|
60
|
+
colSpan: header.colSpan,
|
|
61
|
+
rowSpan: rowSpan
|
|
51
62
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
table: table,
|
|
76
|
-
key: column.id,
|
|
77
|
-
header: headerGroup.headers.find(h => h.column.id === column.id)
|
|
78
|
-
// column={column as any}
|
|
79
|
-
})) : null, virtualPaddingRight ?
|
|
80
|
-
/*#__PURE__*/
|
|
81
|
-
//fake empty column to the right for virtualization scroll padding
|
|
82
|
-
React.createElement("th", {
|
|
83
|
-
className: "nnnnnnnnnnnn",
|
|
84
|
-
style: {
|
|
85
|
-
display: 'flex',
|
|
86
|
-
width: virtualPaddingRight
|
|
87
|
-
}
|
|
88
|
-
}) : null));
|
|
63
|
+
return /*#__PURE__*/React.createElement("th", {
|
|
64
|
+
key: header.id,
|
|
65
|
+
colSpan: header.colSpan,
|
|
66
|
+
rowSpan: rowSpan,
|
|
67
|
+
style: {
|
|
68
|
+
padding: '12px',
|
|
69
|
+
textAlign: 'left',
|
|
70
|
+
fontSize: '0.75rem',
|
|
71
|
+
fontWeight: 'medium',
|
|
72
|
+
color: '#6b7280',
|
|
73
|
+
textTransform: 'uppercase',
|
|
74
|
+
letterSpacing: '0.05em',
|
|
75
|
+
// backgroundColor: '#f9fafb',
|
|
76
|
+
// border: '1px solid #e5e7eb',
|
|
77
|
+
borderLeft: 0,
|
|
78
|
+
width: header.getSize(),
|
|
79
|
+
minWidth: header.getSize(),
|
|
80
|
+
maxWidth: header.getSize(),
|
|
81
|
+
// overflow: 'hidden',
|
|
82
|
+
...getCommonPinningStyles(header.column)
|
|
83
|
+
}
|
|
84
|
+
}, flexRender(header.column.columnDef.header, header.getContext()));
|
|
85
|
+
})));
|
|
89
86
|
};
|
|
90
87
|
export default TableHeadRow;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function convertColumns(columns: any[]): any[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createColumnHelper } from '@tanstack/react-table';
|
|
2
|
+
const columnHelper = createColumnHelper();
|
|
3
|
+
export function convertColumns(columns) {
|
|
4
|
+
return columns.map(col => {
|
|
5
|
+
if (col.columns) {
|
|
6
|
+
// Group column
|
|
7
|
+
return columnHelper.group({
|
|
8
|
+
...col,
|
|
9
|
+
columns: convertColumns(col.columns) // đệ quy
|
|
10
|
+
});
|
|
11
|
+
} else {
|
|
12
|
+
// Accessor column
|
|
13
|
+
let accessor;
|
|
14
|
+
|
|
15
|
+
// Ưu tiên accessorKey nếu có, nếu không thì dùng hàm row => row[col.id]
|
|
16
|
+
if (col.accessorKey) {
|
|
17
|
+
accessor = col.accessorKey;
|
|
18
|
+
} else if (col.id) {
|
|
19
|
+
accessor = row => row[col.id];
|
|
20
|
+
} else {
|
|
21
|
+
throw new Error('Column không có accessorKey hoặc id');
|
|
22
|
+
}
|
|
23
|
+
return columnHelper.accessor(accessor, {
|
|
24
|
+
...col
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -44,6 +44,9 @@ export const getCommonPinningStyles = column => {
|
|
|
44
44
|
position: isPinned ? "sticky" : "relative",
|
|
45
45
|
width: column.getSize(),
|
|
46
46
|
zIndex: isPinned ? 2 : 0
|
|
47
|
+
// border: '1px solid #e5e7eb',
|
|
48
|
+
// borderTop: 0,
|
|
49
|
+
// borderBottom: 0
|
|
47
50
|
};
|
|
48
51
|
};
|
|
49
52
|
export const sumSize = items => {
|
|
@@ -47,44 +47,18 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
47
47
|
.#{$prefix}-grid-cell {
|
|
48
48
|
|
|
49
49
|
padding: 7px 8px;
|
|
50
|
-
border-inline-end: 1px solid $tableBorderColor;
|
|
51
|
-
// border-bottom: 1px solid $tableBorderColor;
|
|
52
|
-
// &.#{$prefix}-grid-cell-fix-left-last {
|
|
53
|
-
// &::after {
|
|
54
|
-
// position: absolute;
|
|
55
|
-
// top: 0;
|
|
56
|
-
// right: 0;
|
|
57
|
-
// bottom: -1px;
|
|
58
|
-
// width: 30px;
|
|
59
|
-
// transform: translateX(100%);
|
|
60
|
-
// transition: box-shadow 0.3s;
|
|
61
|
-
// content: "";
|
|
62
|
-
// pointer-events: none;
|
|
63
|
-
// box-shadow: inset 10px 0 8px -8px rgba(5, 5, 5, 0.09);
|
|
64
|
-
// }
|
|
65
|
-
// }
|
|
66
|
-
// &.#{$prefix}-grid-cell-fix-right-first {
|
|
67
|
-
// &::after {
|
|
68
|
-
// position: absolute;
|
|
69
|
-
// top: 0;
|
|
70
|
-
// bottom: -1px;
|
|
71
|
-
// left: 0;
|
|
72
|
-
// width: 30px;
|
|
73
|
-
// transform: translateX(-100%);
|
|
74
|
-
// transition: box-shadow 0.3s;
|
|
75
|
-
// content: "";
|
|
76
|
-
// pointer-events: none;
|
|
77
|
-
// box-shadow: inset -10px 0 8px -8px rgba(5, 5, 5, 0.09);
|
|
78
|
-
// }
|
|
79
|
-
// &::before {
|
|
80
|
-
// content: "";
|
|
81
|
-
// position: absolute;
|
|
82
|
-
// inset-block: 0;
|
|
83
|
-
// inset-inline-start: -1px;
|
|
84
|
-
// border-inline-start: 1px solid #e0e0e0;
|
|
85
|
-
// }
|
|
86
|
-
// }
|
|
87
50
|
|
|
51
|
+
&.#{$prefix}-grid-cell-text-center {
|
|
52
|
+
text-align: center;
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&.#{$prefix}-grid-cell-text-right {
|
|
57
|
+
justify-content: flex-end;
|
|
58
|
+
text-align: right;
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
88
62
|
|
|
89
63
|
|
|
90
64
|
&.#{$prefix}-grid-cell-ellipsis {
|
|
@@ -152,6 +126,16 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
152
126
|
.#{$prefix}-grid-cell {
|
|
153
127
|
|
|
154
128
|
background-color: $body-color;
|
|
129
|
+
// border-inline-end: 1px solid #e0e0e0;
|
|
130
|
+
|
|
131
|
+
&::before {
|
|
132
|
+
content: "";
|
|
133
|
+
position: absolute;
|
|
134
|
+
inset-block: 0;
|
|
135
|
+
right: 0;
|
|
136
|
+
inset-inline-start: 0px;
|
|
137
|
+
border-inline-end: 1px solid #e0e0e0;
|
|
138
|
+
}
|
|
155
139
|
|
|
156
140
|
&.ui-rc-grid-cell-ellipsis {
|
|
157
141
|
|
|
@@ -195,6 +179,8 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
195
179
|
justify-content: space-between;
|
|
196
180
|
width: 100%;
|
|
197
181
|
align-items: center;
|
|
182
|
+
position: relative;
|
|
183
|
+
z-index: 3;
|
|
198
184
|
}
|
|
199
185
|
|
|
200
186
|
.ui-rc-header-trigger {
|
|
@@ -216,6 +202,7 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
216
202
|
position: absolute;
|
|
217
203
|
right: 0;
|
|
218
204
|
top: 0;
|
|
205
|
+
z-index: 3;
|
|
219
206
|
touch-action: none;
|
|
220
207
|
user-select: none;
|
|
221
208
|
width: 5px;
|
|
@@ -267,6 +254,7 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
267
254
|
|
|
268
255
|
.#{$prefix}-grid-cell {
|
|
269
256
|
outline: none;
|
|
257
|
+
border-inline-end: 1px solid $tableBorderColor;
|
|
270
258
|
|
|
271
259
|
background-color: $body-color;
|
|
272
260
|
|
|
@@ -519,19 +507,19 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
519
507
|
}
|
|
520
508
|
|
|
521
509
|
|
|
522
|
-
&.isValid {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
}
|
|
510
|
+
// &.isValid {
|
|
511
|
+
// &::after {
|
|
512
|
+
// content: "";
|
|
513
|
+
// position: absolute;
|
|
514
|
+
// top: 0;
|
|
515
|
+
// right: 0;
|
|
516
|
+
// width: 0;
|
|
517
|
+
// height: 0;
|
|
518
|
+
// border-top: 0 solid transparent;
|
|
519
|
+
// border-right: 8px solid red;
|
|
520
|
+
// border-bottom: 8px solid transparent;
|
|
521
|
+
// }
|
|
522
|
+
// }
|
|
535
523
|
}
|
|
536
524
|
|
|
537
525
|
}
|
|
@@ -539,6 +527,7 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
539
527
|
.#{$prefix}-grid-tfoot {
|
|
540
528
|
.#{$prefix}-grid-cell {
|
|
541
529
|
background-color: $body-color;
|
|
530
|
+
border-inline-end: 1px solid $tableBorderColor;
|
|
542
531
|
}
|
|
543
532
|
}
|
|
544
533
|
|
|
@@ -15,6 +15,8 @@ type Props<T> = Omit<TableProps<T>, 'columns'> & {
|
|
|
15
15
|
originData: T[];
|
|
16
16
|
mergedFilterKeys: any;
|
|
17
17
|
setMergedFilterKeys: any;
|
|
18
|
+
isFullScreen: boolean;
|
|
19
|
+
setIsFullScreen: Dispatch<SetStateAction<boolean>>;
|
|
18
20
|
triggerFilter: Dispatch<SetStateAction<any>>;
|
|
19
21
|
triggerSorter: Dispatch<SetStateAction<Sorter[]>>;
|
|
20
22
|
onContextMenu?: (data: T) => (event: any) => void;
|
|
@@ -121,11 +121,12 @@ const Grid = props => {
|
|
|
121
121
|
// onExpandedChange: setExpanded,
|
|
122
122
|
getExpandedRowModel: getExpandedRowModel(),
|
|
123
123
|
getPaginationRowModel: pagination ? getPaginationRowModel() : undefined,
|
|
124
|
-
onPaginationChange: setPagination
|
|
124
|
+
onPaginationChange: setPagination
|
|
125
|
+
|
|
125
126
|
// onColumnVisibilityChange: setColumnVisibility,
|
|
126
127
|
// onColumnPinningChange,
|
|
127
128
|
|
|
128
|
-
debugTable: true
|
|
129
|
+
// debugTable: true
|
|
129
130
|
});
|
|
130
131
|
React.useEffect(() => {
|
|
131
132
|
if (isSelectionChange.isChange) {
|
|
@@ -5,6 +5,11 @@ import type { ReactElement, ReactNode } from 'react';
|
|
|
5
5
|
import type { IOperator } from './hook/constant';
|
|
6
6
|
import type { ColorPickerProps } from 'antd';
|
|
7
7
|
import type { TableLocale } from "rc-master-ui/lib/table/interface";
|
|
8
|
+
declare module "@tanstack/table-core" {
|
|
9
|
+
interface ColumnMeta<any, any> extends ColumnTable {
|
|
10
|
+
rowSpan?: number;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
8
13
|
export type ExtendedColumnFilter = {
|
|
9
14
|
id: string;
|
|
10
15
|
value: string;
|
|
@@ -20,6 +20,8 @@ var _reactTooltip = require("react-tooltip");
|
|
|
20
20
|
var _ContextMenu = _interopRequireDefault(require("./ContextMenu"));
|
|
21
21
|
var _utils = require("./hook/utils");
|
|
22
22
|
var _useColumns = require("./hook/useColumns");
|
|
23
|
+
var _convert = require("./hook/convert");
|
|
24
|
+
var _antd = require("antd");
|
|
23
25
|
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); }
|
|
24
26
|
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; }
|
|
25
27
|
// import en from "rc-master-ui/es/date-picker/locale/en_US"
|
|
@@ -72,6 +74,7 @@ const InternalTable = props => {
|
|
|
72
74
|
contextMenuHidden,
|
|
73
75
|
contextMenuClick,
|
|
74
76
|
contextMenuOpen,
|
|
77
|
+
height,
|
|
75
78
|
...rest
|
|
76
79
|
} = props;
|
|
77
80
|
const id = _react.default.useMemo(() => {
|
|
@@ -126,6 +129,7 @@ const InternalTable = props => {
|
|
|
126
129
|
|
|
127
130
|
const [filterStates, setFilterState] = _react.default.useState(null);
|
|
128
131
|
const [sorterStates, setSorterStates] = _react.default.useState([]);
|
|
132
|
+
const [isFullScreen, setIsFullScreen] = _react.default.useState(false);
|
|
129
133
|
const [expanded, setExpanded] = _react.default.useState({});
|
|
130
134
|
const convertData = _react.default.useMemo(() => {
|
|
131
135
|
if (groupAble && groupSetting && groupSetting.client !== false) {
|
|
@@ -146,7 +150,6 @@ const InternalTable = props => {
|
|
|
146
150
|
|
|
147
151
|
// return convertToTanStackColumns<RecordType>(columns, expanded, setExpanded, expandable)
|
|
148
152
|
}, [t, columns, format, editAble]);
|
|
149
|
-
console.log('mergedColumns', mergedColumns);
|
|
150
153
|
const columnPinning = _react.default.useMemo(() => {
|
|
151
154
|
return {
|
|
152
155
|
left: (0, _utils.getFixedFields)(columns, 'left'),
|
|
@@ -277,7 +280,7 @@ const InternalTable = props => {
|
|
|
277
280
|
format: format
|
|
278
281
|
// columns={columns111 as any}
|
|
279
282
|
,
|
|
280
|
-
columns: mergedColumns,
|
|
283
|
+
columns: (0, _convert.convertColumns)(mergedColumns),
|
|
281
284
|
propsColumns: columns,
|
|
282
285
|
rowKey: rowKey,
|
|
283
286
|
groupSetting: groupSetting,
|
|
@@ -294,8 +297,70 @@ const InternalTable = props => {
|
|
|
294
297
|
contextMenuItems: contextMenuItems,
|
|
295
298
|
editAble: editAble,
|
|
296
299
|
triggerChangeColumns: triggerChangeColumns,
|
|
297
|
-
setExpanded: setExpanded
|
|
298
|
-
|
|
300
|
+
setExpanded: setExpanded,
|
|
301
|
+
isFullScreen: isFullScreen,
|
|
302
|
+
setIsFullScreen: setIsFullScreen
|
|
303
|
+
})), /*#__PURE__*/_react.default.createElement(_antd.Modal, {
|
|
304
|
+
open: isFullScreen,
|
|
305
|
+
footer: null,
|
|
306
|
+
centered: true,
|
|
307
|
+
closable: true,
|
|
308
|
+
width: '100%',
|
|
309
|
+
style: {
|
|
310
|
+
maxWidth: '100%',
|
|
311
|
+
height: '100%'
|
|
312
|
+
},
|
|
313
|
+
onClose: () => setIsFullScreen(false),
|
|
314
|
+
onCancel: () => setIsFullScreen(false)
|
|
315
|
+
|
|
316
|
+
// destroyOnClose
|
|
317
|
+
,
|
|
318
|
+
styles: {
|
|
319
|
+
content: {
|
|
320
|
+
height: '100vh',
|
|
321
|
+
borderRadius: 0,
|
|
322
|
+
padding: '15px 10px'
|
|
323
|
+
},
|
|
324
|
+
wrapper: {
|
|
325
|
+
zIndex: 1050
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
329
|
+
style: {
|
|
330
|
+
paddingTop: 40
|
|
331
|
+
}
|
|
332
|
+
}, /*#__PURE__*/_react.default.createElement(_Grid.default, (0, _extends2.default)({}, rest, {
|
|
333
|
+
t: t,
|
|
334
|
+
id: isFullScreen ? _faker.faker.string.alpha(20) : id,
|
|
335
|
+
prefix: prefix,
|
|
336
|
+
originData: convertData,
|
|
337
|
+
dataSource: mergedData,
|
|
338
|
+
locale: locale,
|
|
339
|
+
format: format
|
|
340
|
+
// columns={columns111 as any}
|
|
341
|
+
,
|
|
342
|
+
columns: (0, _convert.convertColumns)(mergedColumns),
|
|
343
|
+
propsColumns: columns,
|
|
344
|
+
rowKey: rowKey,
|
|
345
|
+
groupSetting: groupSetting,
|
|
346
|
+
groupAble: groupAble,
|
|
347
|
+
groupColumns: groupColumns,
|
|
348
|
+
columnPinning: columnPinning,
|
|
349
|
+
columnHidden: columnsHiddenKeys ? (0, _utils.convertToObj)(columnsHiddenKeys) : columnVisibility,
|
|
350
|
+
triggerFilter: setFilterState,
|
|
351
|
+
triggerSorter: setSorterStates,
|
|
352
|
+
setMergedFilterKeys: setMergedFilterKeys,
|
|
353
|
+
mergedFilterKeys: mergedFilterKeys,
|
|
354
|
+
expanded: expanded,
|
|
355
|
+
onContextMenu: onContextMenu,
|
|
356
|
+
contextMenuItems: contextMenuItems,
|
|
357
|
+
editAble: editAble,
|
|
358
|
+
triggerChangeColumns: triggerChangeColumns,
|
|
359
|
+
setExpanded: setExpanded,
|
|
360
|
+
isFullScreen: isFullScreen,
|
|
361
|
+
setIsFullScreen: setIsFullScreen,
|
|
362
|
+
height: windowSize.innerHeight - 70
|
|
363
|
+
})))), menuVisible && /*#__PURE__*/_react.default.createElement(_ContextMenu.default, {
|
|
299
364
|
open: menuVisible,
|
|
300
365
|
pos: position,
|
|
301
366
|
setOpen: setMenuVisible,
|
|
@@ -26,6 +26,8 @@ type TableContainerProps<T> = Omit<TableProps<T>, 'columns'> & {
|
|
|
26
26
|
columns: ColumnDef<T>[];
|
|
27
27
|
triggerChangeColumns: any;
|
|
28
28
|
columnHidden: any;
|
|
29
|
+
isFullScreen: boolean;
|
|
30
|
+
setIsFullScreen: Dispatch<SetStateAction<boolean>>;
|
|
29
31
|
};
|
|
30
32
|
declare const TableContainerEdit: <RecordType extends object>(props: TableContainerProps<RecordType>) => React.JSX.Element;
|
|
31
33
|
export default TableContainerEdit;
|
|
@@ -109,8 +109,13 @@ const TableContainerEdit = props => {
|
|
|
109
109
|
propsColumns,
|
|
110
110
|
triggerChangeColumns,
|
|
111
111
|
columnHidden,
|
|
112
|
-
showEmptyText
|
|
112
|
+
showEmptyText,
|
|
113
|
+
isFullScreen,
|
|
114
|
+
setIsFullScreen
|
|
113
115
|
} = props;
|
|
116
|
+
|
|
117
|
+
// console.log('setIsFullScreen', setIsFullScreen)
|
|
118
|
+
|
|
114
119
|
const containerRef = _react.default.useRef(null);
|
|
115
120
|
const bottomToolbarRef = _react.default.useRef(null);
|
|
116
121
|
const topToolbarRef = _react.default.useRef(null);
|
|
@@ -215,7 +220,7 @@ const TableContainerEdit = props => {
|
|
|
215
220
|
const [endPasteCell, setEndPasteCell] = _react.default.useState(undefined);
|
|
216
221
|
const [isSelecting, setIsSelecting] = _react.default.useState(false);
|
|
217
222
|
const [isPasting, setIsPasting] = _react.default.useState(false);
|
|
218
|
-
const [isFullScreen] =
|
|
223
|
+
// const [isFullScreen] = React.useState(false);
|
|
219
224
|
const [tableHeight, settableHeight] = _react.default.useState(0);
|
|
220
225
|
const rowsFocus = _react.default.useMemo(() => {
|
|
221
226
|
return startCell && endCell ? (0, _utils.getRowIdsBetween)(table, startCell.rowId, endCell.rowId) : [];
|
|
@@ -1118,7 +1123,7 @@ const TableContainerEdit = props => {
|
|
|
1118
1123
|
alignItems: 'center',
|
|
1119
1124
|
gap: '.75rem'
|
|
1120
1125
|
}
|
|
1121
|
-
},
|
|
1126
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
1122
1127
|
style: {
|
|
1123
1128
|
flex: 1,
|
|
1124
1129
|
overflow: 'hidden'
|
|
@@ -1126,18 +1131,6 @@ const TableContainerEdit = props => {
|
|
|
1126
1131
|
}, /*#__PURE__*/_react.default.createElement(_rcMasterUi.Toolbar, {
|
|
1127
1132
|
items: (toolbarItems ?? []).filter(it => it.position !== 'Bottom'),
|
|
1128
1133
|
mode: 'scroll'
|
|
1129
|
-
})), fullScreen !== false && (isFullScreen ? /*#__PURE__*/_react.default.createElement(_becoxyIcons.Minimize, {
|
|
1130
|
-
fontSize: 16
|
|
1131
|
-
// onClick={() => handleFullScreen?.()}
|
|
1132
|
-
,
|
|
1133
|
-
"data-tooltip-id": "tooltip-icon",
|
|
1134
|
-
"data-tooltip-content": t ? t('Minimized') : 'Minimized'
|
|
1135
|
-
}) : /*#__PURE__*/_react.default.createElement(_becoxyIcons.Maximize, {
|
|
1136
|
-
fontSize: 16
|
|
1137
|
-
// onClick={() => handleFullScreen?.()}
|
|
1138
|
-
,
|
|
1139
|
-
"data-tooltip-id": "tooltip-icon",
|
|
1140
|
-
"data-tooltip-content": t ? t('Full screen') : 'Full screen'
|
|
1141
1134
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
1142
1135
|
style: {
|
|
1143
1136
|
display: 'flex',
|
|
@@ -1153,7 +1146,21 @@ const TableContainerEdit = props => {
|
|
|
1153
1146
|
showTotal: (total, range) =>
|
|
1154
1147
|
// @ts-ignore
|
|
1155
1148
|
`${range[0]}-${range[1]} / ${total} ${t ? t(pagination?.locale?.items ?? 'items') : 'items'}`
|
|
1156
|
-
}, pagination)), typeof actionTemplate === 'function' ? actionTemplate() : actionTemplate,
|
|
1149
|
+
}, pagination)), typeof actionTemplate === 'function' ? actionTemplate() : actionTemplate, fullScreen !== false && (isFullScreen ? /*#__PURE__*/_react.default.createElement(_becoxyIcons.Minimize, {
|
|
1150
|
+
fontSize: 16,
|
|
1151
|
+
onClick: () => {
|
|
1152
|
+
setIsFullScreen(!isFullScreen);
|
|
1153
|
+
},
|
|
1154
|
+
"data-tooltip-id": `${id}-tooltip-content`,
|
|
1155
|
+
"data-tooltip-content": t ? t('Minimized') : 'Minimized'
|
|
1156
|
+
}) : /*#__PURE__*/_react.default.createElement(_becoxyIcons.Maximize, {
|
|
1157
|
+
fontSize: 16,
|
|
1158
|
+
onClick: () => {
|
|
1159
|
+
setIsFullScreen(!isFullScreen);
|
|
1160
|
+
},
|
|
1161
|
+
"data-tooltip-id": `${id}-tooltip-content`,
|
|
1162
|
+
"data-tooltip-content": t ? t('Full screen') : 'Full screen'
|
|
1163
|
+
})), showColumnChoose && /*#__PURE__*/_react.default.createElement(_ColumnsChoose.ColumnsChoose, {
|
|
1157
1164
|
columns: columns,
|
|
1158
1165
|
originColumns: propsColumns,
|
|
1159
1166
|
t: t,
|
|
@@ -1232,8 +1239,9 @@ const TableContainerEdit = props => {
|
|
|
1232
1239
|
}, /*#__PURE__*/_react.default.createElement("table", {
|
|
1233
1240
|
// className={`${prefix}-grid-container`}
|
|
1234
1241
|
style: {
|
|
1235
|
-
display: 'grid'
|
|
1242
|
+
display: 'grid',
|
|
1236
1243
|
// minWidth: table.getTotalSize()
|
|
1244
|
+
width: table.getTotalSize()
|
|
1237
1245
|
}
|
|
1238
1246
|
}, /*#__PURE__*/_react.default.createElement(_TableHead.default, {
|
|
1239
1247
|
tableContainerRef: tableContainerRef,
|
|
@@ -74,6 +74,33 @@ const TableBody = ({
|
|
|
74
74
|
})))) : /*#__PURE__*/_react.default.createElement(_react.Fragment, null, virtualRows.map(virtualRow => {
|
|
75
75
|
const row = rows[virtualRow.index];
|
|
76
76
|
const isEditing = row.id === editingKey;
|
|
77
|
+
|
|
78
|
+
// return (
|
|
79
|
+
// <tr key={row.id}>
|
|
80
|
+
// {row.getVisibleCells().map((cell) => (
|
|
81
|
+
// <td
|
|
82
|
+
// key={cell.id}
|
|
83
|
+
// style={{
|
|
84
|
+
// padding: '12px',
|
|
85
|
+
// whiteSpace: 'nowrap',
|
|
86
|
+
// fontSize: '0.875rem',
|
|
87
|
+
// color: '#6b7280',
|
|
88
|
+
// border: '1px solid #e5e7eb',
|
|
89
|
+
// width: cell.column.getSize(),
|
|
90
|
+
// maxWidth: cell.column.getSize(),
|
|
91
|
+
// overflow: "hidden",
|
|
92
|
+
// ...getCommonPinningStyles(cell.column)
|
|
93
|
+
// }}>
|
|
94
|
+
|
|
95
|
+
// {cell.column.id}
|
|
96
|
+
|
|
97
|
+
// {/* {flexRender(cell.column.columnDef.cell, cell.getContext())} */}
|
|
98
|
+
|
|
99
|
+
// </td>
|
|
100
|
+
// ))}
|
|
101
|
+
// </tr>
|
|
102
|
+
// )
|
|
103
|
+
|
|
77
104
|
return /*#__PURE__*/_react.default.createElement(_TableBodyRow.default, (0, _extends2.default)({}, rest, {
|
|
78
105
|
table: table,
|
|
79
106
|
tableId: tableId,
|
|
@@ -107,11 +107,12 @@ const TableBodyCell = props => {
|
|
|
107
107
|
selectionSettings,
|
|
108
108
|
id
|
|
109
109
|
} = (0, _react.useContext)(_useContext.TableContext);
|
|
110
|
+
const columnMeta = cell.column.columnDef.meta ?? {};
|
|
110
111
|
const parrents = cell.row.getParentRows();
|
|
111
112
|
const isPinned = cell.column.getIsPinned();
|
|
112
113
|
const isLastLeftPinnedColumn = isPinned === "left" && cell.column.getIsLastColumn("left");
|
|
113
114
|
const isFirstRightPinnedColumn = isPinned === "right" && cell.column.getIsFirstColumn("right");
|
|
114
|
-
const cellContent = (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext());
|
|
115
|
+
const cellContent = columnMeta.type === 'checkbox' ? '' : (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext());
|
|
115
116
|
const html = _server.default.renderToStaticMarkup( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, cellContent));
|
|
116
117
|
const hasValue = html.trim().length > 0;
|
|
117
118
|
return /*#__PURE__*/_react.default.createElement("td", {
|
|
@@ -124,6 +125,7 @@ const TableBodyCell = props => {
|
|
|
124
125
|
style: {
|
|
125
126
|
display: 'flex',
|
|
126
127
|
width: cell.column.getSize(),
|
|
128
|
+
// border: '1px solid #e5e7eb',
|
|
127
129
|
...(0, _utils.getCommonPinningStyles)(cell.column)
|
|
128
130
|
},
|
|
129
131
|
"data-tooltip-id": `${id}-tooltip-content`,
|