es-grid-template 1.8.56 → 1.8.58
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/InternalTable.js +12 -5
- package/es/grid-component/TableGrid.js +2 -2
- package/es/grid-component/hooks/useColumns.d.ts +3 -1
- package/es/grid-component/hooks/useColumns.js +2 -1
- package/es/grid-component/hooks/utils.d.ts +1 -1
- package/es/grid-component/hooks/utils.js +4 -9
- package/es/grid-component/type.d.ts +13 -0
- package/es/table-component/InternalTable.js +0 -5
- package/es/table-component/TableContainer.js +10 -11
- package/es/table-component/TableContainerEdit.js +4 -2
- package/es/table-component/body/TableBodyCell.js +12 -53
- package/es/table-component/body/TableBodyRow.js +7 -12
- package/es/table-component/footer/TableFooterCell.js +0 -4
- package/es/table-component/footer/TableFooterRow.js +6 -3
- package/es/table-component/header/TableHead.js +4 -1
- package/es/table-component/header/TableHeadCell2.js +7 -48
- package/es/table-component/header/TableHeadGroupCell.js +13 -225
- package/es/table-component/header/TableHeadRow.js +7 -19
- package/es/table-component/hook/useColumns.js +17 -3
- package/es/table-component/hook/utils.js +0 -17
- package/es/table-component/style.d.ts +22 -0
- package/es/table-component/style.js +48 -0
- package/es/table-component/style.scss +33 -71
- package/es/table-component/table/Grid.js +14 -7
- package/es/table-component/type.d.ts +13 -2
- package/es/table-component/useContext.d.ts +4 -1
- package/lib/grid-component/InternalTable.js +11 -5
- package/lib/grid-component/TableGrid.js +2 -2
- package/lib/grid-component/hooks/useColumns.js +2 -1
- package/lib/grid-component/hooks/utils.d.ts +1 -1
- package/lib/grid-component/hooks/utils.js +4 -9
- package/lib/grid-component/type.d.ts +13 -0
- package/lib/table-component/InternalTable.js +0 -6
- package/lib/table-component/TableContainer.js +10 -14
- package/lib/table-component/TableContainerEdit.js +4 -2
- package/lib/table-component/body/TableBodyCell.js +12 -53
- package/lib/table-component/body/TableBodyRow.js +7 -12
- package/lib/table-component/footer/TableFooterCell.js +0 -6
- package/lib/table-component/footer/TableFooterRow.js +6 -3
- package/lib/table-component/header/TableHead.js +4 -1
- package/lib/table-component/header/TableHeadCell2.js +7 -48
- package/lib/table-component/header/TableHeadGroupCell.js +11 -223
- package/lib/table-component/header/TableHeadRow.js +7 -20
- package/lib/table-component/hook/useColumns.js +17 -3
- package/lib/table-component/hook/utils.js +0 -17
- package/lib/table-component/style.d.ts +22 -0
- package/lib/table-component/style.js +55 -0
- package/lib/table-component/style.scss +33 -71
- package/lib/table-component/table/Grid.js +14 -7
- package/lib/table-component/type.d.ts +13 -2
- package/lib/table-component/useContext.d.ts +4 -1
- package/package.json +1 -1
|
@@ -9,40 +9,29 @@ var _sortable = require("@dnd-kit/sortable");
|
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _useContext = require("../useContext");
|
|
11
11
|
var _TableHeadCell = _interopRequireDefault(require("./TableHeadCell"));
|
|
12
|
-
// import type { Virtualizer } from '@tanstack/react-virtual'
|
|
13
|
-
// import type { Person } from "../../tanstack-table/makeData"
|
|
14
|
-
|
|
15
|
-
// import { getCommonPinningStyles } from '../hook/utils'
|
|
16
|
-
|
|
17
12
|
const TableHeadRow = ({
|
|
18
13
|
table,
|
|
19
14
|
headerGroup,
|
|
20
15
|
columnVirtualizer
|
|
21
|
-
// virtualPaddingLeft,
|
|
22
|
-
// virtualPaddingRight,
|
|
23
|
-
// fixedLeftColumns,
|
|
24
|
-
// fixedRightColumns
|
|
25
16
|
}) => {
|
|
26
17
|
const {
|
|
27
|
-
prefix
|
|
18
|
+
prefix,
|
|
19
|
+
onRowHeaderStyles
|
|
28
20
|
} = _react.default.useContext(_useContext.TableContext);
|
|
29
|
-
|
|
30
|
-
// const virtualColumns = columnVirtualizer.getVirtualItems()
|
|
31
|
-
|
|
32
21
|
const columnOrder = table.getState().columnOrder;
|
|
22
|
+
const rowStyles = typeof onRowHeaderStyles === 'function' ? onRowHeaderStyles() : onRowHeaderStyles;
|
|
33
23
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
34
24
|
key: headerGroup.id
|
|
35
25
|
// ref={el => {
|
|
36
26
|
// if (el) rowHeaderVirtualizer.measureElement(el)
|
|
37
27
|
// }}
|
|
38
|
-
// data-index={rowHeaderVirtual?.index}
|
|
39
28
|
,
|
|
29
|
+
|
|
40
30
|
"data-index": headerGroup.id,
|
|
41
|
-
className: `${prefix}-grid-row`,
|
|
31
|
+
className: `${prefix}-grid-row ${prefix}-grid-header`,
|
|
42
32
|
style: {
|
|
43
|
-
|
|
33
|
+
...rowStyles,
|
|
44
34
|
width: '100%'
|
|
45
|
-
// minHeight: rowHeaderVirtual?.size
|
|
46
35
|
}
|
|
47
36
|
}, /*#__PURE__*/_react.default.createElement(_sortable.SortableContext, {
|
|
48
37
|
items: columnOrder,
|
|
@@ -61,9 +50,7 @@ const TableHeadRow = ({
|
|
|
61
50
|
key: header.id,
|
|
62
51
|
header: header,
|
|
63
52
|
table: table,
|
|
64
|
-
columnVirtualizer: columnVirtualizer
|
|
65
|
-
// rowHeaderVirtualizer={rowHeaderVirtualizer}
|
|
66
|
-
,
|
|
53
|
+
columnVirtualizer: columnVirtualizer,
|
|
67
54
|
colSpan: header.colSpan,
|
|
68
55
|
rowSpan: rowSpan
|
|
69
56
|
});
|
|
@@ -225,6 +225,8 @@ const toggleRowSelection = props => {
|
|
|
225
225
|
return;
|
|
226
226
|
}
|
|
227
227
|
if (row.subRows && row.subRows.length > 0) {
|
|
228
|
+
// click vào row cha
|
|
229
|
+
|
|
228
230
|
const allChild = (0, _utils.getAllChildren)(row);
|
|
229
231
|
(0, _utils.toggleRowAndChildren)(row, !row.getIsSelected());
|
|
230
232
|
if (row.getIsSelected()) {
|
|
@@ -256,17 +258,29 @@ const toggleRowSelection = props => {
|
|
|
256
258
|
});
|
|
257
259
|
}
|
|
258
260
|
} else {
|
|
261
|
+
// click vào row không có cha
|
|
262
|
+
|
|
259
263
|
row.getToggleSelectedHandler()(e);
|
|
260
264
|
if (row.getIsSelected()) {
|
|
261
265
|
// đã chọn
|
|
262
266
|
|
|
263
|
-
|
|
264
|
-
const
|
|
267
|
+
const rowParent = row.getParentRow();
|
|
268
|
+
// const rowParent1 = row.getParentRows()
|
|
269
|
+
|
|
270
|
+
let newCheckedRows = [];
|
|
271
|
+
if (rowParent) {}
|
|
272
|
+
if (rowParent && (0, _utils.countUnselectedChildren)(row) === 1) {
|
|
273
|
+
newCheckedRows = prevSelected.filter(it => it.id !== row.id && it.id !== rowParent.id);
|
|
274
|
+
} else {
|
|
275
|
+
// xóa row ra list selected
|
|
276
|
+
// const newRowsSelected = prevSelected.filter((it) => it.id !== row.id)
|
|
277
|
+
newCheckedRows = prevSelected.filter(it => it.id !== row.id);
|
|
278
|
+
}
|
|
265
279
|
setIsSelectionChange({
|
|
266
280
|
isChange: true,
|
|
267
281
|
type: 'rowSelected',
|
|
268
282
|
rowData: row.original,
|
|
269
|
-
rowsData:
|
|
283
|
+
rowsData: newCheckedRows ?? []
|
|
270
284
|
});
|
|
271
285
|
} else {
|
|
272
286
|
// chưa selected
|
|
@@ -94,25 +94,13 @@ const convertDateToDayjs = (date, format) => {
|
|
|
94
94
|
exports.convertDateToDayjs = convertDateToDayjs;
|
|
95
95
|
const getCommonPinningStyles = column => {
|
|
96
96
|
const isPinned = column.getIsPinned();
|
|
97
|
-
// const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left");
|
|
98
|
-
// const isFirstRightPinnedColumn =isPinned === "right" && column.getIsFirstColumn("right");
|
|
99
|
-
|
|
100
97
|
return {
|
|
101
|
-
// boxShadow: isFirstRightPinnedColumn
|
|
102
|
-
// ? "#e0e0e0 2px 0px 1px -1px inset"
|
|
103
|
-
// : undefined,
|
|
104
|
-
|
|
105
98
|
left: isPinned === "left" ? `${column.getStart("left")}px` : undefined,
|
|
106
99
|
right: isPinned === "right" ? `${column.getAfter("right")}px` : undefined,
|
|
107
|
-
// opacity: isPinned ? 0.5 : 1,
|
|
108
100
|
opacity: 1,
|
|
109
101
|
position: isPinned ? "sticky" : "relative",
|
|
110
|
-
// width: column.getSize(),
|
|
111
102
|
width: 'auto',
|
|
112
103
|
zIndex: isPinned ? 2 : 0
|
|
113
|
-
// border: '1px solid #e5e7eb',
|
|
114
|
-
// borderTop: 0,
|
|
115
|
-
// borderBottom: 0
|
|
116
104
|
};
|
|
117
105
|
};
|
|
118
106
|
exports.getCommonPinningStyles = getCommonPinningStyles;
|
|
@@ -128,15 +116,10 @@ const getCommonPinningStyles2 = header => {
|
|
|
128
116
|
|
|
129
117
|
left: isPinned === "left" ? `${header.getStart("left")}px` : undefined,
|
|
130
118
|
right: isPinned === "right" ? `${header.getAfter("right")}px` : undefined,
|
|
131
|
-
// opacity: isPinned ? 0.5 : 1,
|
|
132
119
|
opacity: 1,
|
|
133
120
|
position: isPinned ? "sticky" : "relative",
|
|
134
|
-
// width: column.getSize(),
|
|
135
121
|
width: 'auto',
|
|
136
122
|
zIndex: isPinned ? 2 : 0
|
|
137
|
-
// border: '1px solid #e5e7eb',
|
|
138
|
-
// borderTop: 0,
|
|
139
|
-
// borderBottom: 0
|
|
140
123
|
};
|
|
141
124
|
};
|
|
142
125
|
exports.getCommonPinningStyles2 = getCommonPinningStyles2;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type GridProps = {
|
|
3
|
+
$theme: {
|
|
4
|
+
theme?: 'light' | 'dark';
|
|
5
|
+
backgroundColor?: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
};
|
|
8
|
+
$prefix: string;
|
|
9
|
+
$borderColor?: string;
|
|
10
|
+
$cellFontSize?: number;
|
|
11
|
+
$cellPaddingInline?: number;
|
|
12
|
+
$cellPaddingBlock?: number;
|
|
13
|
+
$headerBg?: string;
|
|
14
|
+
$headerColor?: string;
|
|
15
|
+
$footerBg?: string;
|
|
16
|
+
$footerColor?: string;
|
|
17
|
+
$rowHoverBg?: string;
|
|
18
|
+
$rowSelectedBg?: string;
|
|
19
|
+
$rowSelectedHoverBg?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const GridStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, GridProps>> & string;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.GridStyle = void 0;
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
// const prefix = "ui-rc";
|
|
10
|
+
// const antdPrefix = "ant";
|
|
11
|
+
// const fontFamily = "Montserrat, Helvetica, Arial, serif ";
|
|
12
|
+
// const borderRadius = "6px";
|
|
13
|
+
|
|
14
|
+
// const boxShadowColor = "rgba(220, 0, 0, 0.09)";
|
|
15
|
+
const color = "#000000de";
|
|
16
|
+
const BgColor = "#ffffff ";
|
|
17
|
+
|
|
18
|
+
// const primary = "#eb4619";
|
|
19
|
+
|
|
20
|
+
// const rowHoverBg = "#FBDED6";
|
|
21
|
+
// const rowSelectedBg = "#FEF2EF";
|
|
22
|
+
|
|
23
|
+
const tableBorderColor = "#e0e0e0";
|
|
24
|
+
|
|
25
|
+
// const borderSelectedColor = "#0550C5";
|
|
26
|
+
// const cellSelectedBg = "#F3F8FF";
|
|
27
|
+
// const cellIndexSelectedBg = "#1869E6";
|
|
28
|
+
// const cellIndexFocusBg = "#E6EFFD";
|
|
29
|
+
|
|
30
|
+
// 404071
|
|
31
|
+
|
|
32
|
+
// dark
|
|
33
|
+
const tableBorderColorDark = "#44485E";
|
|
34
|
+
|
|
35
|
+
// const rowHoverBgDark = "#404071 ";
|
|
36
|
+
|
|
37
|
+
// const rowSelectedBgDark = "#25293C";
|
|
38
|
+
|
|
39
|
+
// const borderSelectedColorDark = "#538ff1 ";
|
|
40
|
+
// const cellIndexSelectedBgDark = "#1869E6 ";
|
|
41
|
+
|
|
42
|
+
// const bodyColorDark = "#343e59";
|
|
43
|
+
|
|
44
|
+
const BgColorDark = "#343e59 ";
|
|
45
|
+
const colorDark = "#e6e4f3e6 ";
|
|
46
|
+
|
|
47
|
+
// const cellSelectedBgDark = " #F3F8FF ";
|
|
48
|
+
// const cellIndexFocusBgDark = "#E6EFFD ";
|
|
49
|
+
|
|
50
|
+
/* height: const {props => (props.const heightTable ? `const {props.const heightTable}px` : undefined)}; */
|
|
51
|
+
|
|
52
|
+
const GridStyle = exports.GridStyle = _styledComponents.default.div.withConfig({
|
|
53
|
+
displayName: "GridStyle",
|
|
54
|
+
componentId: "es-grid-template__sc-hdqm5k-0"
|
|
55
|
+
})(["&.", "-grid{color:", ";font-size:13px;background-color:", ";table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";border-right:0;&::after{position:absolute;top:0px;right:0;z-index:1;height:100%;border-right:1px solid ", ";content:\"\";pointer-events:none;}.", "-grid-tbody{.", "-grid-row{}}}&.", "-grid-light{.", "-grid-container{.", "-grid-thead{background-color:", ";font-weight:500;.", "-grid-cell{font-weight:inherit;color:", ";background-color:inherit;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-ellipsis{.ui-rc-table-column-title,.", "-grid-cell-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}&.ui-rc-grid-cell-wrap{.ui-rc-table-column-title,.", "-grid-cell-text-wrap{white-space:normal;word-break:break-word;overflow:hidden;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "-grid-filter-column{display:flex;justify-content:space-between;width:100%;align-items:center;position:relative;z-index:3;}.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;z-index:3;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";}}.", "-grid-tfoot{.", "-grid-footer-row{border-bottom-width:1px;border-bottom-color:", ";border-bottom-style:solid;border-top-width:1px;border-top-color:", ";border-top-style:solid;background-color:#fafafa;}.", "-grid-cell{background-color:inherit;border-inline-end:1px solid ", ";}}}}&.", "-grid-dark{background-color:", ";color:", ";.", "-grid-container{border-color:", ";&::after{border-right-color:", ";}}}}"], props => props.$prefix, color, BgColor, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => props.$prefix, props => `${props.$theme.color ? props.$theme.color : color}`, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
|
|
@@ -27,7 +27,7 @@ $rowSelectedBg-Dark: #25293C !default;
|
|
|
27
27
|
$border-selected-color-Dark: #538ff1 !default;
|
|
28
28
|
$cell-index-selected-bg-Dark: #1869E6 !default;
|
|
29
29
|
|
|
30
|
-
$body-color-Dark: #
|
|
30
|
+
$body-color-Dark: #343e59 !default;
|
|
31
31
|
|
|
32
32
|
$cell-selected-bg-Dark: #F3F8FF !default;
|
|
33
33
|
$cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
@@ -46,6 +46,7 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
46
46
|
// border: 1px solid $tableBorderColor;
|
|
47
47
|
|
|
48
48
|
color: #000000de;
|
|
49
|
+
background-color: #ffffff;
|
|
49
50
|
|
|
50
51
|
font-size: 14px;
|
|
51
52
|
|
|
@@ -59,22 +60,20 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
59
60
|
|
|
60
61
|
.#{$prefix}-grid-container {
|
|
61
62
|
|
|
62
|
-
border: 1px solid $tableBorderColor;
|
|
63
|
-
// border-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
z-index: 1;
|
|
77
|
-
}
|
|
63
|
+
// border: 1px solid $tableBorderColor;
|
|
64
|
+
// border-right: 0;
|
|
65
|
+
// font-size: 13px;
|
|
66
|
+
|
|
67
|
+
// &::after {
|
|
68
|
+
// content: "";
|
|
69
|
+
// position: absolute;
|
|
70
|
+
// top: 0px;
|
|
71
|
+
// right: 0;
|
|
72
|
+
// height: 100%;
|
|
73
|
+
// border-right: 1px solid $tableBorderColor;
|
|
74
|
+
// pointer-events: none;
|
|
75
|
+
// z-index: 1;
|
|
76
|
+
// }
|
|
78
77
|
|
|
79
78
|
.#{$prefix}-grid-cell {
|
|
80
79
|
|
|
@@ -92,8 +91,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
92
91
|
|
|
93
92
|
}
|
|
94
93
|
|
|
95
|
-
|
|
96
|
-
|
|
97
94
|
&.#{$prefix}-grid-cell-ellipsis {
|
|
98
95
|
|
|
99
96
|
|
|
@@ -132,8 +129,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
132
129
|
|
|
133
130
|
}
|
|
134
131
|
|
|
135
|
-
|
|
136
|
-
|
|
137
132
|
&.#{$prefix}-grid-cell-wrap {
|
|
138
133
|
white-space: normal;
|
|
139
134
|
// overflow: hidden;
|
|
@@ -141,7 +136,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
141
136
|
word-break: break-word;
|
|
142
137
|
}
|
|
143
138
|
|
|
144
|
-
|
|
145
139
|
.#{$prefix}-grid-header-text-wrap {
|
|
146
140
|
white-space: normal;
|
|
147
141
|
overflow: hidden;
|
|
@@ -151,29 +145,19 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
151
145
|
|
|
152
146
|
}
|
|
153
147
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
148
|
.#{$prefix}-grid-thead {
|
|
158
|
-
background-color: #ffffff;
|
|
149
|
+
// background-color: #ffffff;
|
|
150
|
+
background-color: inherit;
|
|
151
|
+
font-weight: 500;
|
|
159
152
|
|
|
160
153
|
.#{$prefix}-grid-cell {
|
|
161
|
-
font-weight:
|
|
154
|
+
font-weight: inherit;
|
|
162
155
|
color: #000000E0;
|
|
163
156
|
|
|
164
|
-
background-color:
|
|
157
|
+
background-color: inherit;
|
|
165
158
|
border-inline-end: 1px solid $tableBorderColor;
|
|
166
159
|
border-bottom: 1px solid $tableBorderColor;
|
|
167
160
|
|
|
168
|
-
// &::before {
|
|
169
|
-
// content: "";
|
|
170
|
-
// position: absolute;
|
|
171
|
-
// inset-block: 0;
|
|
172
|
-
// right: 0;
|
|
173
|
-
// inset-inline-start: 0px;
|
|
174
|
-
// border-inline-end: 1px solid #e0e0e0;
|
|
175
|
-
// }
|
|
176
|
-
|
|
177
161
|
&.ui-rc-grid-cell-ellipsis {
|
|
178
162
|
|
|
179
163
|
.ui-rc-table-column-title,
|
|
@@ -192,7 +176,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
192
176
|
.ui-rc-table-column-title,
|
|
193
177
|
.#{$prefix}-grid-cell-text-wrap {
|
|
194
178
|
white-space: normal;
|
|
195
|
-
// text-overflow: ellipsis;
|
|
196
179
|
word-break: break-word;
|
|
197
180
|
overflow: hidden;
|
|
198
181
|
}
|
|
@@ -282,6 +265,8 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
282
265
|
display: flex;
|
|
283
266
|
position: absolute;
|
|
284
267
|
width: 100%;
|
|
268
|
+
// background-color: #ffffff;
|
|
269
|
+
background-color: inherit;
|
|
285
270
|
|
|
286
271
|
&:hover {
|
|
287
272
|
.#{$prefix}-grid-cell:not(.editable) {
|
|
@@ -321,7 +306,8 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
321
306
|
outline: none;
|
|
322
307
|
border-inline-end: 1px solid $tableBorderColor;
|
|
323
308
|
|
|
324
|
-
background-color: $body-color;
|
|
309
|
+
// background-color: $body-color;
|
|
310
|
+
background-color: inherit;
|
|
325
311
|
|
|
326
312
|
&.#{$prefix}-grid-cell-ellipsis:not(:has(>.ui-rc_cell-content)) {
|
|
327
313
|
overflow: hidden;
|
|
@@ -617,7 +603,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
617
603
|
|
|
618
604
|
.#{$prefix}-grid-tfoot {
|
|
619
605
|
// background-color: rgb(250, 250, 250);
|
|
620
|
-
// background-color: #fafafa;
|
|
621
606
|
|
|
622
607
|
.#{$prefix}-grid-footer-row {
|
|
623
608
|
border-bottom-width: 1px;
|
|
@@ -628,13 +613,13 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
628
613
|
border-top-color: $tableBorderColor;
|
|
629
614
|
border-top-style: solid;
|
|
630
615
|
|
|
631
|
-
|
|
616
|
+
background-color: #fafafa;
|
|
632
617
|
|
|
633
618
|
}
|
|
634
619
|
|
|
635
620
|
.#{$prefix}-grid-cell {
|
|
636
621
|
|
|
637
|
-
background-color:
|
|
622
|
+
background-color: inherit;
|
|
638
623
|
|
|
639
624
|
border-inline-end: 1px solid $tableBorderColor;
|
|
640
625
|
}
|
|
@@ -656,39 +641,15 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
656
641
|
|
|
657
642
|
|
|
658
643
|
&.cell-border-top {
|
|
659
|
-
|
|
660
|
-
//border-bottom: 1px solid $border-selected-color;
|
|
661
|
-
// &::after {
|
|
662
|
-
// content: "";
|
|
663
|
-
// position: absolute;
|
|
664
|
-
// top: 0px;
|
|
665
|
-
// left: 0;
|
|
666
|
-
// //right: 0;
|
|
667
|
-
// //bottom: 0;
|
|
668
|
-
// height: 1px;
|
|
669
|
-
// width: 100%;
|
|
670
|
-
// border-top: 1px solid $border-selected-color;
|
|
671
|
-
// /* line đè lên border gốc */
|
|
672
|
-
// pointer-events: none;
|
|
673
|
-
// /* không ảnh hưởng đến tương tác */
|
|
674
|
-
// z-index: 1;
|
|
675
|
-
// }
|
|
676
|
-
|
|
644
|
+
|
|
677
645
|
&.ui-rc-grid-cell-fix-left-last {
|
|
678
646
|
&::after {
|
|
679
647
|
left: -100%;
|
|
680
648
|
}
|
|
681
649
|
}
|
|
682
650
|
|
|
683
|
-
// &.ui-rc-grid-cell-fix-right-first {
|
|
684
|
-
// &::after {
|
|
685
|
-
// left: 100%;
|
|
686
|
-
// }
|
|
687
|
-
// }
|
|
688
|
-
|
|
689
651
|
}
|
|
690
652
|
|
|
691
|
-
|
|
692
653
|
&.cell-paste-border-top {
|
|
693
654
|
|
|
694
655
|
|
|
@@ -705,7 +666,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
705
666
|
}
|
|
706
667
|
}
|
|
707
668
|
|
|
708
|
-
|
|
709
669
|
}
|
|
710
670
|
|
|
711
671
|
|
|
@@ -738,8 +698,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
738
698
|
|
|
739
699
|
.#{$prefix}-grid-cell {
|
|
740
700
|
|
|
741
|
-
|
|
742
|
-
|
|
743
701
|
&.#{$prefix}-grid-cell-fix-right-first {
|
|
744
702
|
&::after {
|
|
745
703
|
position: absolute;
|
|
@@ -1379,9 +1337,13 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
1379
1337
|
}
|
|
1380
1338
|
}
|
|
1381
1339
|
|
|
1340
|
+
&.ui-rc-grid .ui-rc-grid-container::after {
|
|
1341
|
+
border-right-color: $tableBorderColorDark;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1382
1344
|
&.ui-rc-grid {
|
|
1383
1345
|
.ui-rc-grid-container {
|
|
1384
|
-
border-bottom: 0;
|
|
1346
|
+
// border-bottom: 0;
|
|
1385
1347
|
border-color: $tableBorderColorDark;
|
|
1386
1348
|
|
|
1387
1349
|
.ui-rc-grid-tbody {
|
|
@@ -18,6 +18,7 @@ var _operator = require("../features/operator");
|
|
|
18
18
|
var _utils = require("../hook/utils");
|
|
19
19
|
var _TableContainerEdit = _interopRequireDefault(require("../TableContainerEdit"));
|
|
20
20
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
|
+
var _style = require("../style");
|
|
21
22
|
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); }
|
|
22
23
|
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; }
|
|
23
24
|
// import { makeData } from "../default/makeData";
|
|
@@ -28,7 +29,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
28
29
|
|
|
29
30
|
const Grid = props => {
|
|
30
31
|
const {
|
|
31
|
-
theme
|
|
32
|
+
theme,
|
|
32
33
|
t,
|
|
33
34
|
id,
|
|
34
35
|
prefix,
|
|
@@ -259,14 +260,20 @@ const Grid = props => {
|
|
|
259
260
|
}
|
|
260
261
|
const sensors = (0, _core.useSensors)((0, _core.useSensor)(_core.MouseSensor, {}), (0, _core.useSensor)(_core.TouchSensor, {}), (0, _core.useSensor)(_core.KeyboardSensor, {}));
|
|
261
262
|
const ContainerComponent = editAble ? _TableContainerEdit.default : _TableContainer.default;
|
|
262
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(
|
|
263
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_style.GridStyle, {
|
|
264
|
+
$prefix: prefix,
|
|
265
|
+
$theme: {
|
|
266
|
+
theme: theme?.theme,
|
|
267
|
+
...theme
|
|
268
|
+
},
|
|
263
269
|
className: (0, _classnames.default)(`${prefix}-grid`, {
|
|
264
|
-
[`${prefix}-grid-light`]: theme === 'light',
|
|
265
|
-
[`${prefix}-grid-dark`]: theme === 'dark'
|
|
270
|
+
[`${prefix}-grid-light`]: !theme || theme.theme === 'light',
|
|
271
|
+
[`${prefix}-grid-dark`]: theme?.theme === 'dark'
|
|
266
272
|
}),
|
|
267
273
|
style: {
|
|
268
274
|
minHeight: minHeight ?? undefined,
|
|
269
|
-
maxHeight: height ?? undefined
|
|
275
|
+
maxHeight: height ?? undefined,
|
|
276
|
+
backgroundColor: theme?.backgroundColor ?? undefined
|
|
270
277
|
}
|
|
271
278
|
}, /*#__PURE__*/_react.default.createElement(_core.DndContext, {
|
|
272
279
|
collisionDetection: _core.closestCenter,
|
|
@@ -337,8 +344,8 @@ const Grid = props => {
|
|
|
337
344
|
}
|
|
338
345
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
339
346
|
className: (0, _classnames.default)(`${prefix}-grid`, {
|
|
340
|
-
[`${prefix}-grid-light`]: theme === 'light',
|
|
341
|
-
[`${prefix}-grid-dark`]: theme === 'dark'
|
|
347
|
+
[`${prefix}-grid-light`]: !theme || theme.theme === 'light',
|
|
348
|
+
[`${prefix}-grid-dark`]: theme?.theme === 'dark'
|
|
342
349
|
}),
|
|
343
350
|
style: {
|
|
344
351
|
// minHeight: minHeight ?? undefined,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CheckboxProps, TablePaginationConfig } from 'rc-master-ui';
|
|
2
2
|
import type { ItemType } from 'rc-master-ui/es/menu/interface';
|
|
3
|
-
import type { OnChangeFn } from '@tanstack/react-table';
|
|
3
|
+
import type { Cell, Header, OnChangeFn, Row } from '@tanstack/react-table';
|
|
4
4
|
import type { ReactElement, ReactNode } from 'react';
|
|
5
5
|
import type { IOperator } from './hook/constant';
|
|
6
6
|
import type { ColorPickerProps } from 'antd';
|
|
@@ -154,6 +154,10 @@ export type ColumnTable<RecordType = AnyObject> = {
|
|
|
154
154
|
headerTextWrap?: boolean;
|
|
155
155
|
ellipsis?: boolean;
|
|
156
156
|
allowResizing?: boolean;
|
|
157
|
+
allowSelection?: boolean | ((rowData: RecordType) => boolean);
|
|
158
|
+
onCellStyles?: Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'> | ((cellValue: any, cell: Cell<RecordType, unknown>) => Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'>);
|
|
159
|
+
onCellHeaderStyles?: Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'> | ((cell: Header<RecordType, unknown>) => Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'>);
|
|
160
|
+
onCellFooterStyles?: Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'> | ((cellValue: any, cell: Header<RecordType, unknown>) => Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'>);
|
|
157
161
|
};
|
|
158
162
|
export type Locale = TableLocale & {
|
|
159
163
|
ok_btn?: string;
|
|
@@ -188,7 +192,11 @@ export type Locale = TableLocale & {
|
|
|
188
192
|
};
|
|
189
193
|
export type ColumnsTable<RecordType = AnyObject> = ColumnTable<RecordType>[];
|
|
190
194
|
export type TableProps<RecordType = AnyObject> = {
|
|
191
|
-
theme?:
|
|
195
|
+
theme?: {
|
|
196
|
+
theme?: 'dark' | 'light';
|
|
197
|
+
backgroundColor?: string;
|
|
198
|
+
color?: string;
|
|
199
|
+
};
|
|
192
200
|
title?: ReactNode | ((data: RecordType) => ReactNode);
|
|
193
201
|
editAble?: boolean;
|
|
194
202
|
infiniteScroll?: boolean;
|
|
@@ -261,6 +269,9 @@ export type TableProps<RecordType = AnyObject> = {
|
|
|
261
269
|
commandClick?: (args: CommandClick<RecordType>) => void;
|
|
262
270
|
expandable?: ExpandableConfig<RecordType>;
|
|
263
271
|
fullScreen?: boolean;
|
|
272
|
+
onRowStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | ((data: RecordType, row: Row<RecordType>) => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
|
|
273
|
+
onRowHeaderStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
|
|
274
|
+
onRowFooterStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
|
|
264
275
|
};
|
|
265
276
|
export type ExpandableConfig<RecordType> = {
|
|
266
277
|
expandedRowKeys?: readonly Key[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import type { ColumnTable, ExpandableConfig, IFormat, IWrapSettings, Locale, PaginationConfig, RangeState, RecordDoubleClickEventArgs, RowClassName, SelectionSettings } from "./type";
|
|
3
3
|
import type { SubmitHandler } from "react-hook-form";
|
|
4
|
-
import type { ExpandedState, Table } from '@tanstack/react-table';
|
|
4
|
+
import type { ExpandedState, Row, Table } from '@tanstack/react-table';
|
|
5
5
|
export type IPositionCell = {
|
|
6
6
|
rowId: string;
|
|
7
7
|
colId: string;
|
|
@@ -78,6 +78,9 @@ export interface IContext<T> {
|
|
|
78
78
|
rowClassName?: string | RowClassName<T>;
|
|
79
79
|
table?: Table<T>;
|
|
80
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'>);
|
|
81
84
|
}
|
|
82
85
|
export declare const TableContext: import("react").Context<IContext<any>>;
|
|
83
86
|
export type ContextCellChange = {
|