es-grid-template 1.7.28 → 1.7.29
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/TableContainer.d.ts +0 -1
- package/es/table-component/TableContainer.js +8 -4
- package/es/table-component/TableContainerEdit.js +17 -4
- package/es/table-component/body/TableBodyCell.js +2 -1
- package/es/table-component/body/TableBodyCellEdit.js +21 -10
- package/es/table-component/header/TableHeadCell.js +1 -0
- package/es/table-component/hook/utils.js +1 -1
- package/es/table-component/style.scss +2 -0
- package/es/table-component/table/Grid.js +6 -3
- package/es/table-component/table/TableWrapper.d.ts +1 -0
- package/es/table-component/table/TableWrapper.js +4 -1
- package/es/table-component/type.d.ts +1 -0
- package/lib/table-component/TableContainer.d.ts +0 -1
- package/lib/table-component/TableContainer.js +8 -4
- package/lib/table-component/TableContainerEdit.js +17 -4
- package/lib/table-component/body/TableBodyCell.js +2 -1
- package/lib/table-component/body/TableBodyCellEdit.js +20 -10
- package/lib/table-component/header/TableHeadCell.js +1 -0
- package/lib/table-component/hook/utils.js +1 -1
- package/lib/table-component/style.scss +2 -0
- package/lib/table-component/table/Grid.js +6 -3
- package/lib/table-component/table/TableWrapper.d.ts +1 -0
- package/lib/table-component/table/TableWrapper.js +4 -1
- package/lib/table-component/type.d.ts +1 -0
- package/package.json +1 -1
|
@@ -16,7 +16,6 @@ type TableContainerProps<T> = Omit<TableProps<T>, 'columns'> & {
|
|
|
16
16
|
setSorterChange: Dispatch<SetStateAction<boolean>>;
|
|
17
17
|
setFilterChange: Dispatch<SetStateAction<boolean>>;
|
|
18
18
|
onContextMenu?: (data: T) => (event: any) => void;
|
|
19
|
-
tableHeight?: number;
|
|
20
19
|
windowSize: {
|
|
21
20
|
innerHeight: number;
|
|
22
21
|
innerWidth: number;
|
|
@@ -44,6 +44,7 @@ const TableContainer = props => {
|
|
|
44
44
|
setSorterChange,
|
|
45
45
|
setFilterChange,
|
|
46
46
|
height,
|
|
47
|
+
minHeight,
|
|
47
48
|
showToolbar,
|
|
48
49
|
toolbarItems,
|
|
49
50
|
actionTemplate,
|
|
@@ -76,11 +77,13 @@ const TableContainer = props => {
|
|
|
76
77
|
const topToolbarRef = React.useRef(null);
|
|
77
78
|
const [tableHeight, settableHeight] = React.useState(0);
|
|
78
79
|
React.useEffect(() => {
|
|
79
|
-
const totalHeight = height;
|
|
80
|
-
if (totalHeight
|
|
81
|
-
|
|
80
|
+
const totalHeight = minHeight ?? height;
|
|
81
|
+
if (totalHeight) {
|
|
82
|
+
const topHeight = topToolbarRef.current ? topToolbarRef.current.offsetHeight : 0;
|
|
83
|
+
const bottomHeight = bottomToolbarRef.current ? bottomToolbarRef.current.offsetHeight : 0;
|
|
84
|
+
settableHeight(totalHeight - topHeight - bottomHeight);
|
|
82
85
|
}
|
|
83
|
-
}, [id, height, editAble]);
|
|
86
|
+
}, [id, height, editAble, minHeight]);
|
|
84
87
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
85
88
|
const fixedLeftColumns = table.getState().columnPinning.left ? visibleColumns.filter(vc => table.getState().columnPinning.left?.includes(vc.id)) : [];
|
|
86
89
|
const fixedRightColumns = table.getState().columnPinning.right ? visibleColumns.filter(vc => table.getState().columnPinning.right?.includes(vc.id)) : [];
|
|
@@ -202,6 +205,7 @@ const TableContainer = props => {
|
|
|
202
205
|
}, /*#__PURE__*/React.createElement(TableWrapper, {
|
|
203
206
|
contextMenuItems: contextMenuItems,
|
|
204
207
|
height: tableHeight,
|
|
208
|
+
minHeight: minHeight,
|
|
205
209
|
id: id,
|
|
206
210
|
prefix: prefix,
|
|
207
211
|
table: table,
|
|
@@ -96,6 +96,7 @@ const TableContainerEdit = props => {
|
|
|
96
96
|
actionTemplate,
|
|
97
97
|
showColumnChoose,
|
|
98
98
|
height,
|
|
99
|
+
minHeight,
|
|
99
100
|
summary,
|
|
100
101
|
locale,
|
|
101
102
|
groupColumns,
|
|
@@ -653,12 +654,23 @@ const TableContainerEdit = props => {
|
|
|
653
654
|
// document.removeEventListener('touchstart', handleClickOutside)
|
|
654
655
|
};
|
|
655
656
|
}, [dataSource, editingKey, id, onBlur]);
|
|
657
|
+
|
|
658
|
+
// React.useEffect(() => {
|
|
659
|
+
// const totalHeight = height
|
|
660
|
+
|
|
661
|
+
// if (totalHeight && topToolbarRef.current && bottomToolbarRef.current) {
|
|
662
|
+
// settableHeight(totalHeight - topToolbarRef.current.offsetHeight - bottomToolbarRef.current.offsetHeight)
|
|
663
|
+
// }
|
|
664
|
+
// }, [id, height, editAble])
|
|
665
|
+
|
|
656
666
|
React.useEffect(() => {
|
|
657
|
-
const totalHeight = height;
|
|
658
|
-
if (totalHeight
|
|
659
|
-
|
|
667
|
+
const totalHeight = minHeight ?? height;
|
|
668
|
+
if (totalHeight) {
|
|
669
|
+
const topHeight = topToolbarRef.current ? topToolbarRef.current.offsetHeight : 0;
|
|
670
|
+
const bottomHeight = bottomToolbarRef.current ? bottomToolbarRef.current.offsetHeight : 0;
|
|
671
|
+
settableHeight(totalHeight - topHeight - bottomHeight);
|
|
660
672
|
}
|
|
661
|
-
}, [id, height, editAble]);
|
|
673
|
+
}, [id, height, editAble, minHeight]);
|
|
662
674
|
const {
|
|
663
675
|
control,
|
|
664
676
|
handleSubmit,
|
|
@@ -1514,6 +1526,7 @@ const TableContainerEdit = props => {
|
|
|
1514
1526
|
}, /*#__PURE__*/React.createElement(TableWrapper, {
|
|
1515
1527
|
contextMenuItems: contextMenuItems,
|
|
1516
1528
|
height: tableHeight,
|
|
1529
|
+
minHeight: minHeight,
|
|
1517
1530
|
id: id,
|
|
1518
1531
|
prefix: prefix,
|
|
1519
1532
|
table: table,
|
|
@@ -123,7 +123,8 @@ const TableBodyCell = props => {
|
|
|
123
123
|
[`${prefix}-grid-cell-text-right`]: columnMeta?.headerTextAlign === 'right' || columnMeta.type === 'number'
|
|
124
124
|
}),
|
|
125
125
|
style: {
|
|
126
|
-
|
|
126
|
+
display: 'flex',
|
|
127
|
+
// flex: 1,
|
|
127
128
|
width: cell.column.getSize(),
|
|
128
129
|
// border: '1px solid #e5e7eb',
|
|
129
130
|
...getCommonPinningStyles(cell.column)
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { flexRender } from "@tanstack/react-table";
|
|
2
2
|
import Space from "rc-master-ui/es/space";
|
|
3
3
|
import Command from "../components/command/Command";
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
// import ReactDOMServer from 'react-dom/server'
|
|
6
|
+
|
|
5
7
|
import { addRowsDown, addRowsDownWithCtrl, addRowsUp, addRowsUpWithCtrl, flattenArray, flattenData,
|
|
6
8
|
// getCellsByPosition,
|
|
7
9
|
getColIdsBetween, getCommonPinningStyles, getEditType, getRowIdsBetween, getSelectedCellMatrix, isEditable, isObjEmpty, isObjEqual, newGuid, unFlattenData, updateOrInsert } from "../hook/utils";
|
|
@@ -20,7 +22,9 @@ const renderCellIndex = props => {
|
|
|
20
22
|
parrents,
|
|
21
23
|
cell
|
|
22
24
|
} = props;
|
|
23
|
-
return /*#__PURE__*/React.createElement("span",
|
|
25
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
26
|
+
className: "ui-rc_cell-content"
|
|
27
|
+
}, parrents.map(pr => {
|
|
24
28
|
return `${pr.index + 1}.`;
|
|
25
29
|
}), cell.row.index + 1);
|
|
26
30
|
};
|
|
@@ -42,7 +46,9 @@ const renderCommand = args => {
|
|
|
42
46
|
visible: typeof it.visible === 'function' ? it.visible?.(record) : it.visible
|
|
43
47
|
};
|
|
44
48
|
}) : [];
|
|
45
|
-
return /*#__PURE__*/React.createElement(
|
|
49
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
50
|
+
className: "ui-rc_cell-content"
|
|
51
|
+
}, /*#__PURE__*/React.createElement(Space, null, commands.filter(it => it.visible !== false).map(item => {
|
|
46
52
|
return /*#__PURE__*/React.createElement(Command, {
|
|
47
53
|
id: id,
|
|
48
54
|
key: item.id,
|
|
@@ -59,13 +65,14 @@ const renderCommand = args => {
|
|
|
59
65
|
});
|
|
60
66
|
}
|
|
61
67
|
});
|
|
62
|
-
}));
|
|
68
|
+
})));
|
|
63
69
|
};
|
|
64
70
|
const renderSelection = args => {
|
|
65
71
|
const {
|
|
66
72
|
row
|
|
67
73
|
} = args.cell;
|
|
68
74
|
return /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
className: "ui-rc_cell-content",
|
|
69
76
|
style: {
|
|
70
77
|
|
|
71
78
|
// paddingLeft: `${row.depth * 2}rem`,
|
|
@@ -125,9 +132,11 @@ const TableBodyCellEdit = props => {
|
|
|
125
132
|
const expandIconColumnIndex = expandable?.expandIconColumnIndex ?? 0;
|
|
126
133
|
const record = cell.row.original;
|
|
127
134
|
const columnMeta = cell.column.columnDef.meta ?? {};
|
|
128
|
-
|
|
129
|
-
const
|
|
130
|
-
const
|
|
135
|
+
|
|
136
|
+
// const cellContent = columnMeta.type === 'checkbox' ? '' : flexRender(cell.column.columnDef.cell, cell.getContext());
|
|
137
|
+
// const html = ReactDOMServer.renderToStaticMarkup(<>{cellContent}</>);
|
|
138
|
+
// const hasValue = html.trim().length > 0;
|
|
139
|
+
|
|
131
140
|
const rowError = dataErrors ? dataErrors.find(it => it.id === cell.row.id) : undefined;
|
|
132
141
|
const message = rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : undefined;
|
|
133
142
|
const canEdit = isEditable(cell.column.columnDef.meta, record);
|
|
@@ -438,7 +447,6 @@ const TableBodyCellEdit = props => {
|
|
|
438
447
|
triggerPaste?.(pastedRows, colPasteds, rs, copyRows);
|
|
439
448
|
};
|
|
440
449
|
function handleMouseDown(rowId, colId) {
|
|
441
|
-
console.log('aaaaaa');
|
|
442
450
|
setIsSelecting?.(true);
|
|
443
451
|
if (startCell?.rowId !== rowId || startCell?.colId !== colId || endCell?.rowId !== rowId || endCell?.colId !== colId) {
|
|
444
452
|
setStartCell?.({
|
|
@@ -745,8 +753,11 @@ const TableBodyCellEdit = props => {
|
|
|
745
753
|
"data-row-index": rowNumber,
|
|
746
754
|
"data-col-key": cell.column.id,
|
|
747
755
|
"data-row-key": cell.row.id,
|
|
748
|
-
"data-tooltip-id": `${id}-tooltip-content
|
|
749
|
-
|
|
756
|
+
"data-tooltip-id": `${id}-tooltip-content`
|
|
757
|
+
// data-tooltip-html={!isEditing && !hasValue && !message ? undefined : ReactDOMServer.renderToStaticMarkup(<>{rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : cellContent}</>)}
|
|
758
|
+
// data-tooltip-content={!isEditing && !message ? undefined : rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : record[columnMeta.field ?? '']}
|
|
759
|
+
,
|
|
760
|
+
"data-tooltip-content": isEditing && message ? message : rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : record[columnMeta.field ?? ''],
|
|
750
761
|
className: classNames(`${prefix}-grid-cell cell-editable `, {
|
|
751
762
|
[`${prefix}-grid-cell-ellipsis`]: true,
|
|
752
763
|
'cell-editing': isEditing,
|
|
@@ -42,7 +42,7 @@ export const getCommonPinningStyles = column => {
|
|
|
42
42
|
// opacity: isPinned ? 0.5 : 1,
|
|
43
43
|
opacity: 1,
|
|
44
44
|
position: isPinned ? "sticky" : "relative",
|
|
45
|
-
width: column.getSize(),
|
|
45
|
+
// width: column.getSize(),
|
|
46
46
|
zIndex: isPinned ? 2 : 0
|
|
47
47
|
// border: '1px solid #e5e7eb',
|
|
48
48
|
// borderTop: 0,
|
|
@@ -124,6 +124,7 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
124
124
|
|
|
125
125
|
|
|
126
126
|
.#{$prefix}-grid-thead {
|
|
127
|
+
background-color: #ffffff;
|
|
127
128
|
|
|
128
129
|
.#{$prefix}-grid-cell {
|
|
129
130
|
|
|
@@ -537,6 +538,7 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
537
538
|
}
|
|
538
539
|
|
|
539
540
|
.#{$prefix}-grid-tfoot {
|
|
541
|
+
background-color: rgb(250, 250, 250);
|
|
540
542
|
.#{$prefix}-grid-cell {
|
|
541
543
|
background-color: $body-color;
|
|
542
544
|
border-inline-end: 1px solid $tableBorderColor;
|
|
@@ -42,7 +42,9 @@ const Grid = props => {
|
|
|
42
42
|
onSorter,
|
|
43
43
|
onFilter,
|
|
44
44
|
groupColumns,
|
|
45
|
-
height
|
|
45
|
+
// height= 700,
|
|
46
|
+
height,
|
|
47
|
+
minHeight,
|
|
46
48
|
editAble,
|
|
47
49
|
triggerChangeColumns,
|
|
48
50
|
infiniteScroll,
|
|
@@ -206,7 +208,7 @@ const Grid = props => {
|
|
|
206
208
|
return /*#__PURE__*/React.createElement("div", {
|
|
207
209
|
className: `${prefix}-grid`,
|
|
208
210
|
style: {
|
|
209
|
-
|
|
211
|
+
minHeight: minHeight ?? undefined,
|
|
210
212
|
maxHeight: height ?? undefined
|
|
211
213
|
}
|
|
212
214
|
}, /*#__PURE__*/React.createElement(DndContext, {
|
|
@@ -225,7 +227,8 @@ const Grid = props => {
|
|
|
225
227
|
setIsSelectionChange: setIsSelectionChange,
|
|
226
228
|
setSorterChange: setSorterChange,
|
|
227
229
|
setFilterChange: setFilterChange,
|
|
228
|
-
height: height,
|
|
230
|
+
height: minHeight ?? height ?? 700,
|
|
231
|
+
minHeight: minHeight,
|
|
229
232
|
pagination: pagination,
|
|
230
233
|
columns: columns,
|
|
231
234
|
propsColumns: propsColumns,
|
|
@@ -13,6 +13,7 @@ const TableWrapper = props => {
|
|
|
13
13
|
prefix,
|
|
14
14
|
tableContainerRef,
|
|
15
15
|
height,
|
|
16
|
+
minHeight,
|
|
16
17
|
summary,
|
|
17
18
|
table,
|
|
18
19
|
loading,
|
|
@@ -180,7 +181,9 @@ const TableWrapper = props => {
|
|
|
180
181
|
position: 'relative',
|
|
181
182
|
//needed for sticky header
|
|
182
183
|
// height: tableHeight ?? '500px' //should be a fixed height
|
|
183
|
-
maxHeight: height
|
|
184
|
+
maxHeight: height,
|
|
185
|
+
//should be a fixed height
|
|
186
|
+
height: minHeight ? height : undefined //should be a fixed height
|
|
184
187
|
// minWidth: table.getTotalSize()
|
|
185
188
|
}
|
|
186
189
|
// onScroll={infiniteScroll ? handleScroll : undefined}
|
|
@@ -16,7 +16,6 @@ type TableContainerProps<T> = Omit<TableProps<T>, 'columns'> & {
|
|
|
16
16
|
setSorterChange: Dispatch<SetStateAction<boolean>>;
|
|
17
17
|
setFilterChange: Dispatch<SetStateAction<boolean>>;
|
|
18
18
|
onContextMenu?: (data: T) => (event: any) => void;
|
|
19
|
-
tableHeight?: number;
|
|
20
19
|
windowSize: {
|
|
21
20
|
innerHeight: number;
|
|
22
21
|
innerWidth: number;
|
|
@@ -54,6 +54,7 @@ const TableContainer = props => {
|
|
|
54
54
|
setSorterChange,
|
|
55
55
|
setFilterChange,
|
|
56
56
|
height,
|
|
57
|
+
minHeight,
|
|
57
58
|
showToolbar,
|
|
58
59
|
toolbarItems,
|
|
59
60
|
actionTemplate,
|
|
@@ -86,11 +87,13 @@ const TableContainer = props => {
|
|
|
86
87
|
const topToolbarRef = _react.default.useRef(null);
|
|
87
88
|
const [tableHeight, settableHeight] = _react.default.useState(0);
|
|
88
89
|
_react.default.useEffect(() => {
|
|
89
|
-
const totalHeight = height;
|
|
90
|
-
if (totalHeight
|
|
91
|
-
|
|
90
|
+
const totalHeight = minHeight ?? height;
|
|
91
|
+
if (totalHeight) {
|
|
92
|
+
const topHeight = topToolbarRef.current ? topToolbarRef.current.offsetHeight : 0;
|
|
93
|
+
const bottomHeight = bottomToolbarRef.current ? bottomToolbarRef.current.offsetHeight : 0;
|
|
94
|
+
settableHeight(totalHeight - topHeight - bottomHeight);
|
|
92
95
|
}
|
|
93
|
-
}, [id, height, editAble]);
|
|
96
|
+
}, [id, height, editAble, minHeight]);
|
|
94
97
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
95
98
|
const fixedLeftColumns = table.getState().columnPinning.left ? visibleColumns.filter(vc => table.getState().columnPinning.left?.includes(vc.id)) : [];
|
|
96
99
|
const fixedRightColumns = table.getState().columnPinning.right ? visibleColumns.filter(vc => table.getState().columnPinning.right?.includes(vc.id)) : [];
|
|
@@ -212,6 +215,7 @@ const TableContainer = props => {
|
|
|
212
215
|
}, /*#__PURE__*/_react.default.createElement(_TableWrapper.default, {
|
|
213
216
|
contextMenuItems: contextMenuItems,
|
|
214
217
|
height: tableHeight,
|
|
218
|
+
minHeight: minHeight,
|
|
215
219
|
id: id,
|
|
216
220
|
prefix: prefix,
|
|
217
221
|
table: table,
|
|
@@ -103,6 +103,7 @@ const TableContainerEdit = props => {
|
|
|
103
103
|
actionTemplate,
|
|
104
104
|
showColumnChoose,
|
|
105
105
|
height,
|
|
106
|
+
minHeight,
|
|
106
107
|
summary,
|
|
107
108
|
locale,
|
|
108
109
|
groupColumns,
|
|
@@ -660,12 +661,23 @@ const TableContainerEdit = props => {
|
|
|
660
661
|
// document.removeEventListener('touchstart', handleClickOutside)
|
|
661
662
|
};
|
|
662
663
|
}, [dataSource, editingKey, id, onBlur]);
|
|
664
|
+
|
|
665
|
+
// React.useEffect(() => {
|
|
666
|
+
// const totalHeight = height
|
|
667
|
+
|
|
668
|
+
// if (totalHeight && topToolbarRef.current && bottomToolbarRef.current) {
|
|
669
|
+
// settableHeight(totalHeight - topToolbarRef.current.offsetHeight - bottomToolbarRef.current.offsetHeight)
|
|
670
|
+
// }
|
|
671
|
+
// }, [id, height, editAble])
|
|
672
|
+
|
|
663
673
|
_react.default.useEffect(() => {
|
|
664
|
-
const totalHeight = height;
|
|
665
|
-
if (totalHeight
|
|
666
|
-
|
|
674
|
+
const totalHeight = minHeight ?? height;
|
|
675
|
+
if (totalHeight) {
|
|
676
|
+
const topHeight = topToolbarRef.current ? topToolbarRef.current.offsetHeight : 0;
|
|
677
|
+
const bottomHeight = bottomToolbarRef.current ? bottomToolbarRef.current.offsetHeight : 0;
|
|
678
|
+
settableHeight(totalHeight - topHeight - bottomHeight);
|
|
667
679
|
}
|
|
668
|
-
}, [id, height, editAble]);
|
|
680
|
+
}, [id, height, editAble, minHeight]);
|
|
669
681
|
const {
|
|
670
682
|
control,
|
|
671
683
|
handleSubmit,
|
|
@@ -1521,6 +1533,7 @@ const TableContainerEdit = props => {
|
|
|
1521
1533
|
}, /*#__PURE__*/_react.default.createElement(_TableWrapper.default, {
|
|
1522
1534
|
contextMenuItems: contextMenuItems,
|
|
1523
1535
|
height: tableHeight,
|
|
1536
|
+
minHeight: minHeight,
|
|
1524
1537
|
id: id,
|
|
1525
1538
|
prefix: prefix,
|
|
1526
1539
|
table: table,
|
|
@@ -132,7 +132,8 @@ const TableBodyCell = props => {
|
|
|
132
132
|
[`${prefix}-grid-cell-text-right`]: columnMeta?.headerTextAlign === 'right' || columnMeta.type === 'number'
|
|
133
133
|
}),
|
|
134
134
|
style: {
|
|
135
|
-
|
|
135
|
+
display: 'flex',
|
|
136
|
+
// flex: 1,
|
|
136
137
|
width: cell.column.getSize(),
|
|
137
138
|
// border: '1px solid #e5e7eb',
|
|
138
139
|
...(0, _utils.getCommonPinningStyles)(cell.column)
|
|
@@ -8,7 +8,6 @@ exports.default = void 0;
|
|
|
8
8
|
var _reactTable = require("@tanstack/react-table");
|
|
9
9
|
var _space = _interopRequireDefault(require("rc-master-ui/es/space"));
|
|
10
10
|
var _Command = _interopRequireDefault(require("../components/command/Command"));
|
|
11
|
-
var _server = _interopRequireDefault(require("react-dom/server"));
|
|
12
11
|
var _utils = require("../hook/utils");
|
|
13
12
|
var _Checkbox = _interopRequireDefault(require("rc-master-ui/lib/checkbox/Checkbox"));
|
|
14
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
@@ -16,6 +15,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
16
15
|
var _useContext = require("../useContext");
|
|
17
16
|
var _EditableCell = _interopRequireDefault(require("./EditableCell"));
|
|
18
17
|
var _constant = require("../hook/constant");
|
|
18
|
+
// import ReactDOMServer from 'react-dom/server'
|
|
19
|
+
|
|
19
20
|
// import { nonActionColumn } from "../hook/constant";
|
|
20
21
|
|
|
21
22
|
// import type { Dispatch, SetStateAction } from "react";
|
|
@@ -27,7 +28,9 @@ const renderCellIndex = props => {
|
|
|
27
28
|
parrents,
|
|
28
29
|
cell
|
|
29
30
|
} = props;
|
|
30
|
-
return /*#__PURE__*/_react.default.createElement("span",
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
32
|
+
className: "ui-rc_cell-content"
|
|
33
|
+
}, parrents.map(pr => {
|
|
31
34
|
return `${pr.index + 1}.`;
|
|
32
35
|
}), cell.row.index + 1);
|
|
33
36
|
};
|
|
@@ -49,7 +52,9 @@ const renderCommand = args => {
|
|
|
49
52
|
visible: typeof it.visible === 'function' ? it.visible?.(record) : it.visible
|
|
50
53
|
};
|
|
51
54
|
}) : [];
|
|
52
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
55
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
56
|
+
className: "ui-rc_cell-content"
|
|
57
|
+
}, /*#__PURE__*/_react.default.createElement(_space.default, null, commands.filter(it => it.visible !== false).map(item => {
|
|
53
58
|
return /*#__PURE__*/_react.default.createElement(_Command.default, {
|
|
54
59
|
id: id,
|
|
55
60
|
key: item.id,
|
|
@@ -66,13 +71,14 @@ const renderCommand = args => {
|
|
|
66
71
|
});
|
|
67
72
|
}
|
|
68
73
|
});
|
|
69
|
-
}));
|
|
74
|
+
})));
|
|
70
75
|
};
|
|
71
76
|
const renderSelection = args => {
|
|
72
77
|
const {
|
|
73
78
|
row
|
|
74
79
|
} = args.cell;
|
|
75
80
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
81
|
+
className: "ui-rc_cell-content",
|
|
76
82
|
style: {
|
|
77
83
|
|
|
78
84
|
// paddingLeft: `${row.depth * 2}rem`,
|
|
@@ -132,9 +138,11 @@ const TableBodyCellEdit = props => {
|
|
|
132
138
|
const expandIconColumnIndex = expandable?.expandIconColumnIndex ?? 0;
|
|
133
139
|
const record = cell.row.original;
|
|
134
140
|
const columnMeta = cell.column.columnDef.meta ?? {};
|
|
135
|
-
|
|
136
|
-
const
|
|
137
|
-
const
|
|
141
|
+
|
|
142
|
+
// const cellContent = columnMeta.type === 'checkbox' ? '' : flexRender(cell.column.columnDef.cell, cell.getContext());
|
|
143
|
+
// const html = ReactDOMServer.renderToStaticMarkup(<>{cellContent}</>);
|
|
144
|
+
// const hasValue = html.trim().length > 0;
|
|
145
|
+
|
|
138
146
|
const rowError = dataErrors ? dataErrors.find(it => it.id === cell.row.id) : undefined;
|
|
139
147
|
const message = rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : undefined;
|
|
140
148
|
const canEdit = (0, _utils.isEditable)(cell.column.columnDef.meta, record);
|
|
@@ -445,7 +453,6 @@ const TableBodyCellEdit = props => {
|
|
|
445
453
|
triggerPaste?.(pastedRows, colPasteds, rs, copyRows);
|
|
446
454
|
};
|
|
447
455
|
function handleMouseDown(rowId, colId) {
|
|
448
|
-
console.log('aaaaaa');
|
|
449
456
|
setIsSelecting?.(true);
|
|
450
457
|
if (startCell?.rowId !== rowId || startCell?.colId !== colId || endCell?.rowId !== rowId || endCell?.colId !== colId) {
|
|
451
458
|
setStartCell?.({
|
|
@@ -752,8 +759,11 @@ const TableBodyCellEdit = props => {
|
|
|
752
759
|
"data-row-index": rowNumber,
|
|
753
760
|
"data-col-key": cell.column.id,
|
|
754
761
|
"data-row-key": cell.row.id,
|
|
755
|
-
"data-tooltip-id": `${id}-tooltip-content
|
|
756
|
-
|
|
762
|
+
"data-tooltip-id": `${id}-tooltip-content`
|
|
763
|
+
// data-tooltip-html={!isEditing && !hasValue && !message ? undefined : ReactDOMServer.renderToStaticMarkup(<>{rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : cellContent}</>)}
|
|
764
|
+
// data-tooltip-content={!isEditing && !message ? undefined : rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : record[columnMeta.field ?? '']}
|
|
765
|
+
,
|
|
766
|
+
"data-tooltip-content": isEditing && message ? message : rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : record[columnMeta.field ?? ''],
|
|
757
767
|
className: (0, _classnames.default)(`${prefix}-grid-cell cell-editable `, {
|
|
758
768
|
[`${prefix}-grid-cell-ellipsis`]: true,
|
|
759
769
|
'cell-editing': isEditing,
|
|
@@ -89,7 +89,7 @@ const getCommonPinningStyles = column => {
|
|
|
89
89
|
// opacity: isPinned ? 0.5 : 1,
|
|
90
90
|
opacity: 1,
|
|
91
91
|
position: isPinned ? "sticky" : "relative",
|
|
92
|
-
width: column.getSize(),
|
|
92
|
+
// width: column.getSize(),
|
|
93
93
|
zIndex: isPinned ? 2 : 0
|
|
94
94
|
// border: '1px solid #e5e7eb',
|
|
95
95
|
// borderTop: 0,
|
|
@@ -124,6 +124,7 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
124
124
|
|
|
125
125
|
|
|
126
126
|
.#{$prefix}-grid-thead {
|
|
127
|
+
background-color: #ffffff;
|
|
127
128
|
|
|
128
129
|
.#{$prefix}-grid-cell {
|
|
129
130
|
|
|
@@ -537,6 +538,7 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
537
538
|
}
|
|
538
539
|
|
|
539
540
|
.#{$prefix}-grid-tfoot {
|
|
541
|
+
background-color: rgb(250, 250, 250);
|
|
540
542
|
.#{$prefix}-grid-cell {
|
|
541
543
|
background-color: $body-color;
|
|
542
544
|
border-inline-end: 1px solid $tableBorderColor;
|
|
@@ -44,7 +44,9 @@ const Grid = props => {
|
|
|
44
44
|
onSorter,
|
|
45
45
|
onFilter,
|
|
46
46
|
groupColumns,
|
|
47
|
-
height
|
|
47
|
+
// height= 700,
|
|
48
|
+
height,
|
|
49
|
+
minHeight,
|
|
48
50
|
editAble,
|
|
49
51
|
triggerChangeColumns,
|
|
50
52
|
infiniteScroll,
|
|
@@ -208,7 +210,7 @@ const Grid = props => {
|
|
|
208
210
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
209
211
|
className: `${prefix}-grid`,
|
|
210
212
|
style: {
|
|
211
|
-
|
|
213
|
+
minHeight: minHeight ?? undefined,
|
|
212
214
|
maxHeight: height ?? undefined
|
|
213
215
|
}
|
|
214
216
|
}, /*#__PURE__*/_react.default.createElement(_core.DndContext, {
|
|
@@ -227,7 +229,8 @@ const Grid = props => {
|
|
|
227
229
|
setIsSelectionChange: setIsSelectionChange,
|
|
228
230
|
setSorterChange: setSorterChange,
|
|
229
231
|
setFilterChange: setFilterChange,
|
|
230
|
-
height: height,
|
|
232
|
+
height: minHeight ?? height ?? 700,
|
|
233
|
+
minHeight: minHeight,
|
|
231
234
|
pagination: pagination,
|
|
232
235
|
columns: columns,
|
|
233
236
|
propsColumns: propsColumns,
|
|
@@ -22,6 +22,7 @@ const TableWrapper = props => {
|
|
|
22
22
|
prefix,
|
|
23
23
|
tableContainerRef,
|
|
24
24
|
height,
|
|
25
|
+
minHeight,
|
|
25
26
|
summary,
|
|
26
27
|
table,
|
|
27
28
|
loading,
|
|
@@ -189,7 +190,9 @@ const TableWrapper = props => {
|
|
|
189
190
|
position: 'relative',
|
|
190
191
|
//needed for sticky header
|
|
191
192
|
// height: tableHeight ?? '500px' //should be a fixed height
|
|
192
|
-
maxHeight: height
|
|
193
|
+
maxHeight: height,
|
|
194
|
+
//should be a fixed height
|
|
195
|
+
height: minHeight ? height : undefined //should be a fixed height
|
|
193
196
|
// minWidth: table.getTotalSize()
|
|
194
197
|
}
|
|
195
198
|
// onScroll={infiniteScroll ? handleScroll : undefined}
|