es-grid-template 1.8.55 → 1.8.57
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/type.d.ts +8 -0
- package/es/table-component/TableContainer.js +15 -0
- package/es/table-component/TableContainerEdit.js +13 -12
- package/es/table-component/body/TableBodyCell.js +24 -62
- package/es/table-component/body/TableBodyCellEdit.js +14 -9
- package/es/table-component/body/TableBodyRow.js +7 -12
- package/es/table-component/footer/TableFooterCell.js +2 -2
- package/es/table-component/footer/TableFooterRow.js +8 -4
- 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.scss +270 -15
- package/es/table-component/table/Grid.js +14 -25
- package/es/table-component/type.d.ts +8 -1
- package/es/table-component/useContext.d.ts +4 -1
- package/lib/grid-component/type.d.ts +8 -0
- package/lib/table-component/TableContainer.js +15 -0
- package/lib/table-component/TableContainerEdit.js +13 -12
- package/lib/table-component/body/TableBodyCell.js +24 -62
- package/lib/table-component/body/TableBodyCellEdit.js +14 -9
- package/lib/table-component/body/TableBodyRow.js +7 -12
- package/lib/table-component/footer/TableFooterCell.js +2 -2
- package/lib/table-component/footer/TableFooterRow.js +8 -4
- 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.scss +270 -15
- package/lib/table-component/table/Grid.js +14 -25
- package/lib/table-component/type.d.ts +8 -1
- package/lib/table-component/useContext.d.ts +4 -1
- package/package.json +1 -1
|
@@ -1,24 +1,39 @@
|
|
|
1
1
|
$prefix: 'ui-rc' !default;
|
|
2
2
|
$antdPrefix: 'ant' !default;
|
|
3
|
+
$boxShadowColor: rgba(5, 5, 5, 0.09) !default;
|
|
4
|
+
$fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
5
|
+
$border-radius: 6px !default;
|
|
6
|
+
|
|
3
7
|
$primary: #eb4619 !default;
|
|
8
|
+
|
|
4
9
|
$rowHoverBg: #FBDED6 !default;
|
|
5
10
|
$rowSelectedBg: #FEF2EF !default;
|
|
6
|
-
//$tableBorderColor: red !default;
|
|
7
11
|
$tableBorderColor: #e0e0e0 !default;
|
|
8
|
-
//$tableBorderColor: #C4C4C4 !default;
|
|
9
|
-
//$tableBorderColor: #f0f0f0 !default;
|
|
10
|
-
$border-radius: 6px !default;
|
|
11
12
|
$border-selected-color: #0550C5 !default;
|
|
12
13
|
$body-color: #ffffff !default;
|
|
13
|
-
//$cell-selected-bg: #E6EFFD !default;
|
|
14
14
|
$cell-selected-bg: #F3F8FF !default;
|
|
15
|
-
//$cell-index-selected-bg: #0550C5 !default;
|
|
16
15
|
$cell-index-selected-bg: #1869E6 !default;
|
|
17
|
-
//$cell-index-focus-bg: #CEDBEF !default;
|
|
18
16
|
$cell-index-focus-bg: #E6EFFD !default;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
|
|
18
|
+
// 404071
|
|
19
|
+
|
|
20
|
+
// dark
|
|
21
|
+
$tableBorderColorDark: #44485E !default;
|
|
22
|
+
|
|
23
|
+
$rowHoverBg-Dark: #404071 !default;
|
|
24
|
+
|
|
25
|
+
$rowSelectedBg-Dark: #25293C !default;
|
|
26
|
+
|
|
27
|
+
$border-selected-color-Dark: #538ff1 !default;
|
|
28
|
+
$cell-index-selected-bg-Dark: #1869E6 !default;
|
|
29
|
+
|
|
30
|
+
$body-color-Dark: #2F3349 !default;
|
|
31
|
+
|
|
32
|
+
$cell-selected-bg-Dark: #F3F8FF !default;
|
|
33
|
+
$cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
22
37
|
|
|
23
38
|
|
|
24
39
|
* {
|
|
@@ -45,6 +60,7 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
45
60
|
.#{$prefix}-grid-container {
|
|
46
61
|
|
|
47
62
|
border: 1px solid $tableBorderColor;
|
|
63
|
+
// border-bottom: 0;
|
|
48
64
|
border-right: 0;
|
|
49
65
|
font-size: 13px;
|
|
50
66
|
|
|
@@ -145,7 +161,7 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
145
161
|
font-weight: 500;
|
|
146
162
|
color: #000000E0;
|
|
147
163
|
|
|
148
|
-
background-color:
|
|
164
|
+
background-color: inherit;
|
|
149
165
|
border-inline-end: 1px solid $tableBorderColor;
|
|
150
166
|
border-bottom: 1px solid $tableBorderColor;
|
|
151
167
|
|
|
@@ -266,12 +282,15 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
266
282
|
display: flex;
|
|
267
283
|
position: absolute;
|
|
268
284
|
width: 100%;
|
|
285
|
+
background-color: #ffffff;
|
|
269
286
|
|
|
270
287
|
&:hover {
|
|
271
288
|
.#{$prefix}-grid-cell:not(.editable) {
|
|
272
289
|
// background-color: $rowHoverBg;
|
|
273
290
|
|
|
274
|
-
&.cell-editable,
|
|
291
|
+
&.cell-editable,
|
|
292
|
+
&.#{$prefix}-grid-cell-index,
|
|
293
|
+
&.#{$prefix}-grid-cell-selection {
|
|
275
294
|
// background-color: transparent;
|
|
276
295
|
}
|
|
277
296
|
|
|
@@ -303,7 +322,8 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
303
322
|
outline: none;
|
|
304
323
|
border-inline-end: 1px solid $tableBorderColor;
|
|
305
324
|
|
|
306
|
-
background-color: $body-color;
|
|
325
|
+
// background-color: $body-color;
|
|
326
|
+
background-color: inherit;
|
|
307
327
|
|
|
308
328
|
&.#{$prefix}-grid-cell-ellipsis:not(:has(>.ui-rc_cell-content)) {
|
|
309
329
|
overflow: hidden;
|
|
@@ -598,10 +618,25 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
598
618
|
}
|
|
599
619
|
|
|
600
620
|
.#{$prefix}-grid-tfoot {
|
|
601
|
-
background-color: rgb(250, 250, 250);
|
|
621
|
+
// background-color: rgb(250, 250, 250);
|
|
622
|
+
|
|
623
|
+
.#{$prefix}-grid-footer-row {
|
|
624
|
+
border-bottom-width: 1px;
|
|
625
|
+
border-bottom-color: $tableBorderColor;
|
|
626
|
+
border-bottom-style: solid;
|
|
627
|
+
|
|
628
|
+
border-top-width: 1px;
|
|
629
|
+
border-top-color: $tableBorderColor;
|
|
630
|
+
border-top-style: solid;
|
|
631
|
+
|
|
632
|
+
background-color: #fafafa;
|
|
633
|
+
|
|
634
|
+
}
|
|
602
635
|
|
|
603
636
|
.#{$prefix}-grid-cell {
|
|
604
|
-
|
|
637
|
+
|
|
638
|
+
background-color: inherit;
|
|
639
|
+
|
|
605
640
|
border-inline-end: 1px solid $tableBorderColor;
|
|
606
641
|
}
|
|
607
642
|
}
|
|
@@ -796,6 +831,10 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
796
831
|
|
|
797
832
|
// bottom toolbar
|
|
798
833
|
.ui-rc-toolbar-bottom {
|
|
834
|
+
// border-bottom: 1px solid #e0e0e0;
|
|
835
|
+
border-right: 1px solid #e0e0e0;
|
|
836
|
+
border-left: 1px solid #e0e0e0;
|
|
837
|
+
|
|
799
838
|
.be-toolbar-item {
|
|
800
839
|
.toolbar-dropdown-button {
|
|
801
840
|
.ant-btn.ant-btn-default.ant-btn-variant-outlined.ant-btn-compact-item.ant-btn-compact-first-item {
|
|
@@ -814,6 +853,10 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
814
853
|
}
|
|
815
854
|
}
|
|
816
855
|
|
|
856
|
+
.ui-rc-toolbar-bottom_border-bottom {
|
|
857
|
+
border-bottom: 1px solid #e0e0e0;
|
|
858
|
+
}
|
|
859
|
+
|
|
817
860
|
.ui-rc-toolbar-bottom {
|
|
818
861
|
position: relative;
|
|
819
862
|
padding: .25rem 1rem;
|
|
@@ -1219,4 +1262,216 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
|
|
|
1219
1262
|
|
|
1220
1263
|
|
|
1221
1264
|
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
|
|
1268
|
+
// #region theme
|
|
1269
|
+
// theme
|
|
1270
|
+
|
|
1271
|
+
// ------------light-----------
|
|
1272
|
+
|
|
1273
|
+
.#{$prefix}-grid-light {
|
|
1274
|
+
background-color: #ffffff;
|
|
1275
|
+
|
|
1276
|
+
&.ui-rc-grid .ui-rc-grid-container .ui-rc-grid-thead .ui-rc-grid-cell {}
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
// rgb(225 222 245 / 0.12
|
|
1281
|
+
|
|
1282
|
+
.#{$prefix}-grid-dark {
|
|
1283
|
+
background-color: $body-color-Dark;
|
|
1284
|
+
color: #ffffff;
|
|
1285
|
+
|
|
1286
|
+
&.ui-rc-grid .ui-rc-grid-container .ui-rc-grid-thead .ui-rc-grid-cell {
|
|
1287
|
+
background-color: $body-color-Dark;
|
|
1288
|
+
color: #E1DEF5E6;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
&.ui-rc-grid .ui-rc-grid-container .ui-rc-grid-tbody .ui-rc-grid-cell {
|
|
1292
|
+
// background-color: $body-color-Dark;
|
|
1293
|
+
// color: #E1DEF5E6;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
&.ui-rc-grid .ui-rc-grid-container .ui-rc-grid-tfoot .ui-rc-grid-cell {
|
|
1297
|
+
background-color: #25293C;
|
|
1298
|
+
color: #E1DEF5E6;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
&.ui-rc-grid {
|
|
1302
|
+
.ui-rc-toolbar-bottom {
|
|
1303
|
+
background-color: $body-color-Dark;
|
|
1304
|
+
color: #E1DEF5E6;
|
|
1305
|
+
border-color: $tableBorderColorDark;
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
&.ui-rc-grid .ui-rc-grid-container.ui-rc-table-ping-right .ui-rc-grid-cell.ui-rc-grid-cell-fix-right-first::before {
|
|
1310
|
+
border-inline-start-color: $tableBorderColorDark;
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
&.ui-rc-grid .ui-rc-grid-container .ui-rc-grid-tbody .ui-rc-grid-cell.cell-editable {
|
|
1314
|
+
|
|
1315
|
+
|
|
1316
|
+
&.cell-border-right {
|
|
1317
|
+
border-right-color: $border-selected-color-Dark;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
&.cell-border-bottom {
|
|
1321
|
+
border-bottom-color: $border-selected-color-Dark;
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
&.cell-border-left::before {
|
|
1325
|
+
border-color: $border-selected-color-Dark;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
&.cell-border-top::after {
|
|
1329
|
+
border-color: $border-selected-color-Dark;
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
.ui-rc-pagination {
|
|
1334
|
+
background-color: $body-color-Dark;
|
|
1335
|
+
color: #E1DEF5E6;
|
|
1336
|
+
|
|
1337
|
+
border-bottom: 1px solid $tableBorderColorDark;
|
|
1338
|
+
border-top: 1px solid $tableBorderColorDark;
|
|
1339
|
+
border-inline-color: $tableBorderColorDark;
|
|
1340
|
+
|
|
1341
|
+
.ui-rc-pagination-prev {
|
|
1342
|
+
.anticon.anticon-left {
|
|
1343
|
+
color: #ffffff;
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
.ui-rc-pagination-disabled {
|
|
1348
|
+
.anticon.anticon-left {
|
|
1349
|
+
color: #7d7a7a;
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
.ui-rc-pagination-next {
|
|
1354
|
+
.anticon.anticon-right {
|
|
1355
|
+
color: #ffffff;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
&.ui-rc-pagination-disabled {
|
|
1359
|
+
.anticon.anticon-right {
|
|
1360
|
+
color: #7d7a7a;
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
.ui-rc-toolbar {
|
|
1368
|
+
.ui-rc-toolbar-selection-item {
|
|
1369
|
+
background-color: #25293C;
|
|
1370
|
+
color: #E1DEF5E6;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
&.ui-rc-grid {
|
|
1376
|
+
.ui-rc-grid-top-toolbar {
|
|
1377
|
+
border-top-color: $tableBorderColorDark;
|
|
1378
|
+
border-inline-color: $tableBorderColorDark;
|
|
1379
|
+
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
&.ui-rc-grid {
|
|
1384
|
+
.ui-rc-grid-container {
|
|
1385
|
+
border-bottom: 0;
|
|
1386
|
+
border-color: $tableBorderColorDark;
|
|
1387
|
+
|
|
1388
|
+
.ui-rc-grid-tbody {
|
|
1389
|
+
.ui-rc-grid-row {
|
|
1390
|
+
border-bottom-color: $tableBorderColorDark;
|
|
1391
|
+
|
|
1392
|
+
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
.ui-rc-grid-cell {
|
|
1396
|
+
border-inline-end-color: $tableBorderColorDark;
|
|
1397
|
+
background-color: $body-color-Dark;
|
|
1398
|
+
color: #E1DEF5E6;
|
|
1399
|
+
|
|
1400
|
+
&.ui-rc-grid-cell-selected {
|
|
1401
|
+
|
|
1402
|
+
background-color: #33335d !important;
|
|
1403
|
+
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
&.disable {
|
|
1407
|
+
background-color: #272A2F;
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
// input
|
|
1411
|
+
// .ui-rc-table-select-selector,
|
|
1412
|
+
// .ui-rc-select-selector,
|
|
1413
|
+
// .ant-input-outlined,
|
|
1414
|
+
// .ant-picker-outlined {
|
|
1415
|
+
// background-color: #272933;
|
|
1416
|
+
// color: #ffffff;
|
|
1417
|
+
|
|
1418
|
+
// .ui-rc-table-select-selection-placeholder,
|
|
1419
|
+
// .ui-rc-select-selection-placeholder {
|
|
1420
|
+
// color: #797171;
|
|
1421
|
+
// }
|
|
1422
|
+
// }
|
|
1423
|
+
// .ant-picker-input {
|
|
1424
|
+
|
|
1425
|
+
// input {
|
|
1426
|
+
// &::placeholder {
|
|
1427
|
+
// color: #797171;
|
|
1428
|
+
// }
|
|
1429
|
+
// }
|
|
1430
|
+
// }
|
|
1431
|
+
// .ant-input-outlined::placeholder {
|
|
1432
|
+
// color: #797171;
|
|
1433
|
+
// }
|
|
1434
|
+
|
|
1435
|
+
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
.ui-rc-grid-row-selected {
|
|
1439
|
+
.ui-rc-grid-cell {
|
|
1440
|
+
background-color: $rowSelectedBg-Dark;
|
|
1441
|
+
|
|
1442
|
+
// &.disable {
|
|
1443
|
+
// background-color: #272A2F;
|
|
1444
|
+
// }
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
.ui-rc-grid-thead {
|
|
1451
|
+
.ui-rc-grid-cell {
|
|
1452
|
+
border-inline-end-color: $tableBorderColorDark;
|
|
1453
|
+
border-bottom-color: $tableBorderColorDark;
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
.ui-rc-grid-tfoot {
|
|
1458
|
+
.#{$prefix}-grid-footer-row {
|
|
1459
|
+
border-bottom-color: $tableBorderColorDark;
|
|
1460
|
+
|
|
1461
|
+
border-top-color: $tableBorderColorDark;
|
|
1462
|
+
|
|
1463
|
+
|
|
1464
|
+
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
.ui-rc-grid-cell {
|
|
1468
|
+
border-inline-end-color: $tableBorderColorDark;
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
.ui-rc-toolbar-bottom_border-bottom {
|
|
1475
|
+
border-bottom-color: $tableBorderColorDark;
|
|
1476
|
+
}
|
|
1222
1477
|
}
|
|
@@ -21,8 +21,10 @@ import TableContainer from "../TableContainer";
|
|
|
21
21
|
import { OperatorFeature } from "../features/operator";
|
|
22
22
|
import { convertFilters, convertToObjTrue, filterByIds, filterDataByColumns, getAllRowKey, isObjEqual } from "../hook/utils";
|
|
23
23
|
import TableContainerEdit from "../TableContainerEdit";
|
|
24
|
+
import classNames from 'classnames';
|
|
24
25
|
const Grid = props => {
|
|
25
26
|
const {
|
|
27
|
+
theme = 'light',
|
|
26
28
|
t,
|
|
27
29
|
id,
|
|
28
30
|
prefix,
|
|
@@ -68,7 +70,7 @@ const Grid = props => {
|
|
|
68
70
|
// const [rowSelection, setRowSelection] = React.useState<RowSelectionState>({})
|
|
69
71
|
|
|
70
72
|
// const [rowSelection, setRowSelection] = React.useState<RowSelectionState>(convertToObjTrue(selectionSettings?.selectedRowKeys ?? []))
|
|
71
|
-
const [rowSelection, setRowSelection] = React.useState(
|
|
73
|
+
const [rowSelection, setRowSelection] = React.useState({});
|
|
72
74
|
// const [rowsSelected, setRowsSelected] = React.useState<RecordType[]>([])
|
|
73
75
|
|
|
74
76
|
const [grouping, setGrouping] = React.useState([]);
|
|
@@ -122,6 +124,9 @@ const Grid = props => {
|
|
|
122
124
|
}
|
|
123
125
|
return true;
|
|
124
126
|
},
|
|
127
|
+
initialState: {
|
|
128
|
+
rowSelection: {}
|
|
129
|
+
},
|
|
125
130
|
onRowSelectionChange: setRowSelection,
|
|
126
131
|
// RowSelection
|
|
127
132
|
|
|
@@ -169,31 +174,9 @@ const Grid = props => {
|
|
|
169
174
|
}
|
|
170
175
|
}
|
|
171
176
|
}, [columnHidden, columnSizingInfo]);
|
|
172
|
-
|
|
173
|
-
// React.useEffect(() => {
|
|
174
|
-
// if (columnSizingInfo.isResizingColumn === false) {
|
|
175
|
-
|
|
176
|
-
// const aa = updateColumnWidthsRecursive(propsColumns, columnSizing)
|
|
177
|
-
|
|
178
|
-
// setColumns(aa)
|
|
179
|
-
|
|
180
|
-
// }
|
|
181
|
-
|
|
182
|
-
// }, [columnSizingInfo])
|
|
183
|
-
|
|
184
177
|
React.useEffect(() => {
|
|
185
|
-
// if (Object.keys(rowSelection) !== Object.keys(mergedSelectedKeys) && !isSelectionChange.isChange) {
|
|
186
|
-
// setRowSelection(convertToObjTrue(mergedSelectedKeys))
|
|
187
|
-
|
|
188
|
-
// }
|
|
189
|
-
|
|
190
178
|
const isEqual = isObjEqual(convertToObjTrue(mergedSelectedKeys), rowSelection);
|
|
191
179
|
if (!isEqual) {
|
|
192
|
-
// setIsSelectionChange((prev) => ({
|
|
193
|
-
// ...prev,
|
|
194
|
-
// isChange: false
|
|
195
|
-
// }))
|
|
196
|
-
|
|
197
180
|
setRowSelection(convertToObjTrue(mergedSelectedKeys));
|
|
198
181
|
}
|
|
199
182
|
}, [mergedSelectedKeys]);
|
|
@@ -273,7 +256,10 @@ const Grid = props => {
|
|
|
273
256
|
const sensors = useSensors(useSensor(MouseSensor, {}), useSensor(TouchSensor, {}), useSensor(KeyboardSensor, {}));
|
|
274
257
|
const ContainerComponent = editAble ? TableContainerEdit : TableContainer;
|
|
275
258
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
276
|
-
className: `${prefix}-grid`,
|
|
259
|
+
className: classNames(`${prefix}-grid`, {
|
|
260
|
+
[`${prefix}-grid-light`]: theme === 'light',
|
|
261
|
+
[`${prefix}-grid-dark`]: theme === 'dark'
|
|
262
|
+
}),
|
|
277
263
|
style: {
|
|
278
264
|
minHeight: minHeight ?? undefined,
|
|
279
265
|
maxHeight: height ?? undefined
|
|
@@ -346,7 +332,10 @@ const Grid = props => {
|
|
|
346
332
|
paddingTop: 40
|
|
347
333
|
}
|
|
348
334
|
}, /*#__PURE__*/React.createElement("div", {
|
|
349
|
-
className: `${prefix}-grid`,
|
|
335
|
+
className: classNames(`${prefix}-grid`, {
|
|
336
|
+
[`${prefix}-grid-light`]: theme === 'light',
|
|
337
|
+
[`${prefix}-grid-dark`]: theme === 'dark'
|
|
338
|
+
}),
|
|
350
339
|
style: {
|
|
351
340
|
// minHeight: minHeight ?? undefined,
|
|
352
341
|
maxHeight: windowSize.innerHeight - 70
|
|
@@ -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,9 @@ export type ColumnTable<RecordType = AnyObject> = {
|
|
|
154
154
|
headerTextWrap?: boolean;
|
|
155
155
|
ellipsis?: boolean;
|
|
156
156
|
allowResizing?: boolean;
|
|
157
|
+
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'>);
|
|
158
|
+
onCellHeaderStyles?: Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'> | ((cell: Header<RecordType, unknown>) => Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'>);
|
|
159
|
+
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
160
|
};
|
|
158
161
|
export type Locale = TableLocale & {
|
|
159
162
|
ok_btn?: string;
|
|
@@ -188,6 +191,7 @@ export type Locale = TableLocale & {
|
|
|
188
191
|
};
|
|
189
192
|
export type ColumnsTable<RecordType = AnyObject> = ColumnTable<RecordType>[];
|
|
190
193
|
export type TableProps<RecordType = AnyObject> = {
|
|
194
|
+
theme?: 'dark' | 'light';
|
|
191
195
|
title?: ReactNode | ((data: RecordType) => ReactNode);
|
|
192
196
|
editAble?: boolean;
|
|
193
197
|
infiniteScroll?: boolean;
|
|
@@ -260,6 +264,9 @@ export type TableProps<RecordType = AnyObject> = {
|
|
|
260
264
|
commandClick?: (args: CommandClick<RecordType>) => void;
|
|
261
265
|
expandable?: ExpandableConfig<RecordType>;
|
|
262
266
|
fullScreen?: boolean;
|
|
267
|
+
onRowStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | ((data: RecordType, row: Row<RecordType>) => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
|
|
268
|
+
onRowHeaderStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
|
|
269
|
+
onRowFooterStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
|
|
263
270
|
};
|
|
264
271
|
export type ExpandableConfig<RecordType> = {
|
|
265
272
|
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 = {
|
|
@@ -9,6 +9,7 @@ import type { FieldNames, FilterFunc } from "rc-select/es/Select";
|
|
|
9
9
|
import type { ColorPickerProps } from "antd";
|
|
10
10
|
import type { FixedType } from "rc-base-table/lib/interface";
|
|
11
11
|
import type { TableLocale } from "rc-master-ui/lib/table/interface";
|
|
12
|
+
import type { Cell, Header, Row } from '@tanstack/react-table';
|
|
12
13
|
export type IColumnType = "number" | "time" | "date" | "week" | "month" | "file" | "quarter" | "year" | "datetime" | "string" | "boolean" | "checkbox" | "color" | null | undefined;
|
|
13
14
|
export type AnyObject = Record<PropertyKey, any>;
|
|
14
15
|
export type SelectMode = 'checkbox' | 'radio' | undefined;
|
|
@@ -135,6 +136,9 @@ export type ColumnTable<RecordType = AnyObject> = Omit<RcColumnType<RecordType>,
|
|
|
135
136
|
editFromSettings?: IEditFromSettings;
|
|
136
137
|
fixedType?: FixedType;
|
|
137
138
|
headerTextWrap?: boolean;
|
|
139
|
+
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'>);
|
|
140
|
+
onCellHeaderStyles?: Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'> | ((cell: Header<RecordType, unknown>) => Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'>);
|
|
141
|
+
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'>);
|
|
138
142
|
};
|
|
139
143
|
export type IFormOpen = {
|
|
140
144
|
value?: any;
|
|
@@ -193,6 +197,7 @@ export type Sort = {
|
|
|
193
197
|
export interface TableProps<RecordType = AnyObject> extends Omit<RcTableProps<RecordType>, 'columns' | 'rowSelection' | 'loading' | 'dataSource' | 'summary' | 'pagination' | 'locale'> {
|
|
194
198
|
editAble?: boolean;
|
|
195
199
|
infiniteScroll?: boolean;
|
|
200
|
+
theme?: 'dark' | 'light';
|
|
196
201
|
next?: () => void;
|
|
197
202
|
locale?: Locale;
|
|
198
203
|
groupAble?: boolean;
|
|
@@ -266,6 +271,9 @@ export interface TableProps<RecordType = AnyObject> extends Omit<RcTableProps<Re
|
|
|
266
271
|
wrapSettings?: IWrapSettings;
|
|
267
272
|
actionTemplate?: ReactNode | ReactElement | (() => ReactNode | ReactElement);
|
|
268
273
|
fullScreen?: boolean;
|
|
274
|
+
onRowStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | ((data: RecordType, row: Row<RecordType>) => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
|
|
275
|
+
onRowHeaderStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
|
|
276
|
+
onRowFooterStyles?: Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'> | (() => Omit<React.CSSProperties, 'display' | 'transform' | 'gridTemplateColumns' | 'height' | 'minHeight'>);
|
|
269
277
|
}
|
|
270
278
|
export type PaginationConfig = TablePaginationConfig & {
|
|
271
279
|
currentPage?: number;
|
|
@@ -86,6 +86,9 @@ const TableContainer = props => {
|
|
|
86
86
|
columnSizing,
|
|
87
87
|
columnSizingInfo,
|
|
88
88
|
rowClassName,
|
|
89
|
+
onRowStyles,
|
|
90
|
+
onRowFooterStyles,
|
|
91
|
+
onRowHeaderStyles,
|
|
89
92
|
title
|
|
90
93
|
} = props;
|
|
91
94
|
const tableContainerRef = _react.default.useRef(null);
|
|
@@ -103,6 +106,15 @@ const TableContainer = props => {
|
|
|
103
106
|
settableHeight(totalHeight - topHeight - bottomHeight);
|
|
104
107
|
}
|
|
105
108
|
}, [id, height, editAble, minHeight]);
|
|
109
|
+
_react.default.useEffect(() => {
|
|
110
|
+
const handleClickOutside = () => {
|
|
111
|
+
setFocusedCell(undefined);
|
|
112
|
+
};
|
|
113
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
114
|
+
return () => {
|
|
115
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
116
|
+
};
|
|
117
|
+
}, []);
|
|
106
118
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
107
119
|
const fixedLeftColumns = table.getState().columnPinning.left ? visibleColumns.filter(vc => table.getState().columnPinning.left?.includes(vc.id)) : [];
|
|
108
120
|
const fixedRightColumns = table.getState().columnPinning.right ? visibleColumns.filter(vc => table.getState().columnPinning.right?.includes(vc.id)) : [];
|
|
@@ -271,6 +283,9 @@ const TableContainer = props => {
|
|
|
271
283
|
focusedCell,
|
|
272
284
|
setFocusedCell,
|
|
273
285
|
rowClassName,
|
|
286
|
+
onRowStyles,
|
|
287
|
+
onRowFooterStyles,
|
|
288
|
+
onRowHeaderStyles,
|
|
274
289
|
table,
|
|
275
290
|
pagination
|
|
276
291
|
}
|
|
@@ -132,7 +132,8 @@ const TableContainerEdit = props => {
|
|
|
132
132
|
setColumns,
|
|
133
133
|
columnSizing,
|
|
134
134
|
columnSizingInfo,
|
|
135
|
-
rowClassName
|
|
135
|
+
rowClassName,
|
|
136
|
+
onRowStyles
|
|
136
137
|
} = props;
|
|
137
138
|
const containerRef = _react.default.useRef(null);
|
|
138
139
|
const bottomToolbarRef = _react.default.useRef(null);
|
|
@@ -1902,7 +1903,8 @@ const TableContainerEdit = props => {
|
|
|
1902
1903
|
handleCellClick,
|
|
1903
1904
|
pagination,
|
|
1904
1905
|
rowClassName,
|
|
1905
|
-
rowEditable
|
|
1906
|
+
rowEditable,
|
|
1907
|
+
onRowStyles
|
|
1906
1908
|
}
|
|
1907
1909
|
}, /*#__PURE__*/_react.default.createElement(_TableWrapper.default, {
|
|
1908
1910
|
contextMenuItems: contextMenuItems,
|
|
@@ -1931,14 +1933,15 @@ const TableContainerEdit = props => {
|
|
|
1931
1933
|
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
1932
1934
|
ref: bottomToolbarRef
|
|
1933
1935
|
}, toolbarItemsBottom && toolbarItemsBottom.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
1934
|
-
className: 'ui-rc-toolbar-bottom'
|
|
1936
|
+
className: (0, _classnames.default)('ui-rc-toolbar-bottom', {
|
|
1937
|
+
'ui-rc-toolbar-bottom_border-bottom': !pagination || infiniteScroll
|
|
1938
|
+
})
|
|
1935
1939
|
// style={{ border: '0 1px 1px 1px solid #e0e0e0' }}
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
}
|
|
1940
|
+
// style={{
|
|
1941
|
+
// borderBottom: '1px solid #e0e0e0',
|
|
1942
|
+
// borderRight: '1px solid #e0e0e0',
|
|
1943
|
+
// borderLeft: '1px solid #e0e0e0'
|
|
1944
|
+
// }}
|
|
1942
1945
|
}, /*#__PURE__*/_react.default.createElement(_rcMasterUi.Toolbar, {
|
|
1943
1946
|
style: {
|
|
1944
1947
|
width: '100%'
|
|
@@ -1948,9 +1951,7 @@ const TableContainerEdit = props => {
|
|
|
1948
1951
|
onClick: ({}) => {
|
|
1949
1952
|
setEditingKey('');
|
|
1950
1953
|
}
|
|
1951
|
-
})), pagination && !infiniteScroll && /*#__PURE__*/_react.default.createElement(_pagination.default
|
|
1952
|
-
// style={{padding: '0.75rem 1rem'}}
|
|
1953
|
-
, (0, _extends2.default)({}, pagination, {
|
|
1954
|
+
})), pagination && !infiniteScroll && /*#__PURE__*/_react.default.createElement(_pagination.default, (0, _extends2.default)({}, pagination, {
|
|
1954
1955
|
rootClassName: 'pagination-template',
|
|
1955
1956
|
showSizeChanger: true,
|
|
1956
1957
|
responsive: true,
|