es-grid-template 1.8.55 → 1.8.56

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.
@@ -93,6 +93,15 @@ const TableContainer = props => {
93
93
  settableHeight(totalHeight - topHeight - bottomHeight);
94
94
  }
95
95
  }, [id, height, editAble, minHeight]);
96
+ React.useEffect(() => {
97
+ const handleClickOutside = () => {
98
+ setFocusedCell(undefined);
99
+ };
100
+ document.addEventListener('mousedown', handleClickOutside);
101
+ return () => {
102
+ document.removeEventListener('mousedown', handleClickOutside);
103
+ };
104
+ }, []);
96
105
  const visibleColumns = table.getVisibleLeafColumns();
97
106
  const fixedLeftColumns = table.getState().columnPinning.left ? visibleColumns.filter(vc => table.getState().columnPinning.left?.includes(vc.id)) : [];
98
107
  const fixedRightColumns = table.getState().columnPinning.right ? visibleColumns.filter(vc => table.getState().columnPinning.right?.includes(vc.id)) : [];
@@ -1924,14 +1924,15 @@ const TableContainerEdit = props => {
1924
1924
  }))), /*#__PURE__*/React.createElement("div", {
1925
1925
  ref: bottomToolbarRef
1926
1926
  }, toolbarItemsBottom && toolbarItemsBottom.length > 0 && /*#__PURE__*/React.createElement("div", {
1927
- className: 'ui-rc-toolbar-bottom'
1927
+ className: classNames('ui-rc-toolbar-bottom', {
1928
+ 'ui-rc-toolbar-bottom_border-bottom': !pagination || infiniteScroll
1929
+ })
1928
1930
  // style={{ border: '0 1px 1px 1px solid #e0e0e0' }}
1929
- ,
1930
- style: {
1931
- borderBottom: '1px solid #e0e0e0',
1932
- borderRight: '1px solid #e0e0e0',
1933
- borderLeft: '1px solid #e0e0e0'
1934
- }
1931
+ // style={{
1932
+ // borderBottom: '1px solid #e0e0e0',
1933
+ // borderRight: '1px solid #e0e0e0',
1934
+ // borderLeft: '1px solid #e0e0e0'
1935
+ // }}
1935
1936
  }, /*#__PURE__*/React.createElement(Toolbar, {
1936
1937
  style: {
1937
1938
  width: '100%'
@@ -1941,9 +1942,7 @@ const TableContainerEdit = props => {
1941
1942
  onClick: ({}) => {
1942
1943
  setEditingKey('');
1943
1944
  }
1944
- })), pagination && !infiniteScroll && /*#__PURE__*/React.createElement(Pagination
1945
- // style={{padding: '0.75rem 1rem'}}
1946
- , _extends({}, pagination, {
1945
+ })), pagination && !infiniteScroll && /*#__PURE__*/React.createElement(Pagination, _extends({}, pagination, {
1947
1946
  rootClassName: 'pagination-template',
1948
1947
  showSizeChanger: true,
1949
1948
  responsive: true,
@@ -466,24 +466,29 @@ const TableBodyCell = props => {
466
466
  // })
467
467
  // }
468
468
  }
469
- }
469
+ },
470
+ onKeyUp: () => {}
470
471
 
471
472
  // onDoubleClick={() => { }}
472
473
  ,
473
474
 
474
475
  onClick: e => {
475
- if (!selectionSettings || selectionSettings.checkboxOnly !== true) {
476
- toggleRowSelection({
477
- e,
478
- cell,
479
- setIsSelectionChange,
480
- isSelectionChange,
481
- selectionSettings
482
- });
483
- setFocusedCell?.({
484
- colId: cell.column.id,
485
- rowId: cell.row.id
486
- });
476
+ const selection = window.getSelection();
477
+ const text = selection ? selection.toString() : "";
478
+ if (text.length > 0) {} else {
479
+ if (!selectionSettings || selectionSettings.checkboxOnly !== true) {
480
+ toggleRowSelection({
481
+ e,
482
+ cell,
483
+ setIsSelectionChange,
484
+ isSelectionChange,
485
+ selectionSettings
486
+ });
487
+ setFocusedCell?.({
488
+ colId: cell.column.id,
489
+ rowId: cell.row.id
490
+ });
491
+ }
487
492
  }
488
493
  }
489
494
  }, /*#__PURE__*/React.createElement("div", {
@@ -242,12 +242,18 @@ const TableBodyCellEdit = props => {
242
242
  const expandIconColumnIndex = expandable?.expandIconColumnIndex;
243
243
  const record = cell.row.original;
244
244
  const columnMeta = cell.column.columnDef.meta ?? {};
245
- const cellContent = columnMeta.type === 'checkbox' ? '' : flexRender(cell.column.columnDef.cell, cell.getContext());
245
+ const [isOpenTooltip, setIsOpenTooltip] = React.useState(false);
246
+
247
+ // const cellContent = columnMeta.type === 'checkbox' ? '' : flexRender(cell.column.columnDef.cell, cell.getContext());
246
248
  // const html = ReactDOMServer.renderToStaticMarkup(<>{cellContent}</>);
247
249
  // const hasValue = html.trim().length > 0;
248
250
 
249
251
  const rowError = dataErrors ? dataErrors.find(it => it.id === cell.row.id) : undefined;
250
252
  const message = rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : undefined;
253
+ const tooltipContent = isOpenTooltip === false ? '' : columnMeta?.tooltipDescription ? typeof columnMeta.tooltipDescription === 'function' ? columnMeta.tooltipDescription({
254
+ value: cell.getValue(),
255
+ record
256
+ }) : columnMeta.tooltipDescription : columnMeta.template && typeof columnMeta.template !== 'function' ? columnMeta.template : cell.getValue();
251
257
  const canEdit = isEditable(cell.column.columnDef.meta, record) && isRowEditable !== false;
252
258
 
253
259
  // const allRows = table.getRowModel().rows;
@@ -429,7 +435,10 @@ const TableBodyCellEdit = props => {
429
435
  const rs = unFlattenData(rsFilterData);
430
436
  triggerPaste?.(pastedRows, colPasteds, rs, copyRows);
431
437
  };
432
- function handleMouseEnter(rowId, colId) {
438
+ function handleMouseEnter(e, rowId, colId) {
439
+ if (e.target.firstChild?.clientWidth < e.target.firstChild?.scrollWidth) {
440
+ setIsOpenTooltip(true);
441
+ }
433
442
  if (isSelecting) {
434
443
  setEndCell?.({
435
444
  rowId,
@@ -1044,12 +1053,8 @@ const TableBodyCellEdit = props => {
1044
1053
  "data-col-key": cell.column.id,
1045
1054
  "data-row-key": cell.row.id,
1046
1055
  "data-tooltip-id": `${id}-tooltip-content`,
1047
- "data-tooltip-delay-show": 500
1048
- // data-tooltip-html={!isEditing && !hasValue && !message ? undefined : ReactDOMServer.renderToStaticMarkup(<>{rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : cellContent}</>)}
1049
- // data-tooltip-content={!isEditing && !message ? undefined : rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : record[columnMeta.field ?? '']}
1050
- // data-tooltip-content={isEditing && message ? message : rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : record[columnMeta.field ?? '']}
1051
- ,
1052
- "data-tooltip-html": isEditing && message ? message : rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : ReactDOMServer.renderToStaticMarkup( /*#__PURE__*/React.createElement(React.Fragment, null, cellContent)),
1056
+ "data-tooltip-delay-show": 500,
1057
+ "data-tooltip-html": isEditing && message ? message : rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : ReactDOMServer.renderToStaticMarkup( /*#__PURE__*/React.createElement(React.Fragment, null, tooltipContent)),
1053
1058
  className: classNames(`${prefix}-grid-cell cell-editable editable `, {
1054
1059
  [`${prefix}-grid-cell-ellipsis`]: true,
1055
1060
  'cell-editing': isEditing,
@@ -1099,7 +1104,7 @@ const TableBodyCellEdit = props => {
1099
1104
  }
1100
1105
  }
1101
1106
  },
1102
- onMouseEnter: () => handleMouseEnter(cell.row.id, cell.column.id),
1107
+ onMouseEnter: e => handleMouseEnter(e, cell.row.id, cell.column.id),
1103
1108
  onMouseUp: e => handleMouseUp(e),
1104
1109
  onKeyDown: e => {
1105
1110
  if (!isEditing) {
@@ -62,8 +62,8 @@ const TableFooterCell = ({
62
62
  display: 'flex',
63
63
  ...getCommonPinningStyles(column),
64
64
  // width: column?.getSize() ?? column.getSize(),
65
- minWidth: column?.getSize(),
66
- backgroundColor: "#fafafa"
65
+ minWidth: column?.getSize()
66
+ // backgroundColor: "#fafafa",
67
67
  }
68
68
  }, column.id !== "id" && column.id !== "selection_column" ? /*#__PURE__*/React.createElement(React.Fragment, null, col.summaryTemplate ? col.summaryTemplate(numberValue, col.field) : numericFormatter(cellValue, numericFormatProps)) : '');
69
69
  };
@@ -29,11 +29,12 @@ const TableFooterRow = ({
29
29
  style: {
30
30
  display: "grid",
31
31
  width: "100%",
32
- borderBottom: "1px solid #e0e0e0",
33
- borderTop: "1px solid #e0e0e0",
32
+ // borderBottom: "1px solid #e0e0e0",
33
+ // borderTop: "1px solid #e0e0e0",
34
34
  height: 37,
35
35
  gridTemplateColumns: `${table.getVisibleLeafColumns().map(n => `${n.getSize()}fr`).join(" ")}`
36
- }
36
+ },
37
+ className: "ui-rc-grid-footer-row"
37
38
  }, visibleColumns.map(header => {
38
39
  return /*#__PURE__*/React.createElement(TableFooterCell, {
39
40
  key: header.id
@@ -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
- // $rowSelectedHoverBg: 'ui-rc' !default;
20
- $boxShadowColor: rgba(5, 5, 5, 0.09) !default;
21
- $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
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
 
@@ -271,7 +287,9 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
271
287
  .#{$prefix}-grid-cell:not(.editable) {
272
288
  // background-color: $rowHoverBg;
273
289
 
274
- &.cell-editable, &.#{$prefix}-grid-cell-index, &.#{$prefix}-grid-cell-selection {
290
+ &.cell-editable,
291
+ &.#{$prefix}-grid-cell-index,
292
+ &.#{$prefix}-grid-cell-selection {
275
293
  // background-color: transparent;
276
294
  }
277
295
 
@@ -598,10 +616,26 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
598
616
  }
599
617
 
600
618
  .#{$prefix}-grid-tfoot {
601
- background-color: rgb(250, 250, 250);
619
+ // background-color: rgb(250, 250, 250);
620
+ // background-color: #fafafa;
621
+
622
+ .#{$prefix}-grid-footer-row {
623
+ border-bottom-width: 1px;
624
+ border-bottom-color: $tableBorderColor;
625
+ border-bottom-style: solid;
626
+
627
+ border-top-width: 1px;
628
+ border-top-color: $tableBorderColor;
629
+ border-top-style: solid;
630
+
631
+
632
+
633
+ }
602
634
 
603
635
  .#{$prefix}-grid-cell {
604
- background-color: $body-color;
636
+
637
+ background-color: #fafafa;
638
+
605
639
  border-inline-end: 1px solid $tableBorderColor;
606
640
  }
607
641
  }
@@ -796,6 +830,10 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
796
830
 
797
831
  // bottom toolbar
798
832
  .ui-rc-toolbar-bottom {
833
+ // border-bottom: 1px solid #e0e0e0;
834
+ border-right: 1px solid #e0e0e0;
835
+ border-left: 1px solid #e0e0e0;
836
+
799
837
  .be-toolbar-item {
800
838
  .toolbar-dropdown-button {
801
839
  .ant-btn.ant-btn-default.ant-btn-variant-outlined.ant-btn-compact-item.ant-btn-compact-first-item {
@@ -814,6 +852,10 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
814
852
  }
815
853
  }
816
854
 
855
+ .ui-rc-toolbar-bottom_border-bottom {
856
+ border-bottom: 1px solid #e0e0e0;
857
+ }
858
+
817
859
  .ui-rc-toolbar-bottom {
818
860
  position: relative;
819
861
  padding: .25rem 1rem;
@@ -1219,4 +1261,216 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
1219
1261
 
1220
1262
 
1221
1263
 
1264
+ }
1265
+
1266
+
1267
+ // #region theme
1268
+ // theme
1269
+
1270
+ // ------------light-----------
1271
+
1272
+ .#{$prefix}-grid-light {
1273
+ background-color: #ffffff;
1274
+
1275
+ &.ui-rc-grid .ui-rc-grid-container .ui-rc-grid-thead .ui-rc-grid-cell {}
1276
+ }
1277
+
1278
+
1279
+ // rgb(225 222 245 / 0.12
1280
+
1281
+ .#{$prefix}-grid-dark {
1282
+ background-color: $body-color-Dark;
1283
+ color: #ffffff;
1284
+
1285
+ &.ui-rc-grid .ui-rc-grid-container .ui-rc-grid-thead .ui-rc-grid-cell {
1286
+ background-color: $body-color-Dark;
1287
+ color: #E1DEF5E6;
1288
+ }
1289
+
1290
+ &.ui-rc-grid .ui-rc-grid-container .ui-rc-grid-tbody .ui-rc-grid-cell {
1291
+ // background-color: $body-color-Dark;
1292
+ // color: #E1DEF5E6;
1293
+ }
1294
+
1295
+ &.ui-rc-grid .ui-rc-grid-container .ui-rc-grid-tfoot .ui-rc-grid-cell {
1296
+ background-color: #25293C;
1297
+ color: #E1DEF5E6;
1298
+ }
1299
+
1300
+ &.ui-rc-grid {
1301
+ .ui-rc-toolbar-bottom {
1302
+ background-color: $body-color-Dark;
1303
+ color: #E1DEF5E6;
1304
+ border-color: $tableBorderColorDark;
1305
+ }
1306
+ }
1307
+
1308
+ &.ui-rc-grid .ui-rc-grid-container.ui-rc-table-ping-right .ui-rc-grid-cell.ui-rc-grid-cell-fix-right-first::before {
1309
+ border-inline-start-color: $tableBorderColorDark;
1310
+ }
1311
+
1312
+ &.ui-rc-grid .ui-rc-grid-container .ui-rc-grid-tbody .ui-rc-grid-cell.cell-editable {
1313
+
1314
+
1315
+ &.cell-border-right {
1316
+ border-right-color: $border-selected-color-Dark;
1317
+ }
1318
+
1319
+ &.cell-border-bottom {
1320
+ border-bottom-color: $border-selected-color-Dark;
1321
+ }
1322
+
1323
+ &.cell-border-left::before {
1324
+ border-color: $border-selected-color-Dark;
1325
+ }
1326
+
1327
+ &.cell-border-top::after {
1328
+ border-color: $border-selected-color-Dark;
1329
+ }
1330
+ }
1331
+
1332
+ .ui-rc-pagination {
1333
+ background-color: $body-color-Dark;
1334
+ color: #E1DEF5E6;
1335
+
1336
+ border-bottom: 1px solid $tableBorderColorDark;
1337
+ border-top: 1px solid $tableBorderColorDark;
1338
+ border-inline-color: $tableBorderColorDark;
1339
+
1340
+ .ui-rc-pagination-prev {
1341
+ .anticon.anticon-left {
1342
+ color: #ffffff;
1343
+ }
1344
+ }
1345
+
1346
+ .ui-rc-pagination-disabled {
1347
+ .anticon.anticon-left {
1348
+ color: #7d7a7a;
1349
+ }
1350
+ }
1351
+
1352
+ .ui-rc-pagination-next {
1353
+ .anticon.anticon-right {
1354
+ color: #ffffff;
1355
+ }
1356
+
1357
+ &.ui-rc-pagination-disabled {
1358
+ .anticon.anticon-right {
1359
+ color: #7d7a7a;
1360
+ }
1361
+ }
1362
+
1363
+ }
1364
+ }
1365
+
1366
+ .ui-rc-toolbar {
1367
+ .ui-rc-toolbar-selection-item {
1368
+ background-color: #25293C;
1369
+ color: #E1DEF5E6;
1370
+ }
1371
+
1372
+ }
1373
+
1374
+ &.ui-rc-grid {
1375
+ .ui-rc-grid-top-toolbar {
1376
+ border-top-color: $tableBorderColorDark;
1377
+ border-inline-color: $tableBorderColorDark;
1378
+
1379
+ }
1380
+ }
1381
+
1382
+ &.ui-rc-grid {
1383
+ .ui-rc-grid-container {
1384
+ border-bottom: 0;
1385
+ border-color: $tableBorderColorDark;
1386
+
1387
+ .ui-rc-grid-tbody {
1388
+ .ui-rc-grid-row {
1389
+ border-bottom-color: $tableBorderColorDark;
1390
+
1391
+
1392
+ }
1393
+
1394
+ .ui-rc-grid-cell {
1395
+ border-inline-end-color: $tableBorderColorDark;
1396
+ background-color: $body-color-Dark;
1397
+ color: #E1DEF5E6;
1398
+
1399
+ &.ui-rc-grid-cell-selected {
1400
+
1401
+ background-color: #33335d !important;
1402
+
1403
+ }
1404
+
1405
+ &.disable {
1406
+ background-color: #272A2F;
1407
+ }
1408
+
1409
+ // input
1410
+ // .ui-rc-table-select-selector,
1411
+ // .ui-rc-select-selector,
1412
+ // .ant-input-outlined,
1413
+ // .ant-picker-outlined {
1414
+ // background-color: #272933;
1415
+ // color: #ffffff;
1416
+
1417
+ // .ui-rc-table-select-selection-placeholder,
1418
+ // .ui-rc-select-selection-placeholder {
1419
+ // color: #797171;
1420
+ // }
1421
+ // }
1422
+ // .ant-picker-input {
1423
+
1424
+ // input {
1425
+ // &::placeholder {
1426
+ // color: #797171;
1427
+ // }
1428
+ // }
1429
+ // }
1430
+ // .ant-input-outlined::placeholder {
1431
+ // color: #797171;
1432
+ // }
1433
+
1434
+
1435
+ }
1436
+
1437
+ .ui-rc-grid-row-selected {
1438
+ .ui-rc-grid-cell {
1439
+ background-color: $rowSelectedBg-Dark;
1440
+
1441
+ // &.disable {
1442
+ // background-color: #272A2F;
1443
+ // }
1444
+ }
1445
+ }
1446
+
1447
+ }
1448
+
1449
+ .ui-rc-grid-thead {
1450
+ .ui-rc-grid-cell {
1451
+ border-inline-end-color: $tableBorderColorDark;
1452
+ border-bottom-color: $tableBorderColorDark;
1453
+ }
1454
+ }
1455
+
1456
+ .ui-rc-grid-tfoot {
1457
+ .#{$prefix}-grid-footer-row {
1458
+ border-bottom-color: $tableBorderColorDark;
1459
+
1460
+ border-top-color: $tableBorderColorDark;
1461
+
1462
+
1463
+
1464
+ }
1465
+
1466
+ .ui-rc-grid-cell {
1467
+ border-inline-end-color: $tableBorderColorDark;
1468
+ }
1469
+ }
1470
+ }
1471
+ }
1472
+
1473
+ .ui-rc-toolbar-bottom_border-bottom {
1474
+ border-bottom-color: $tableBorderColorDark;
1475
+ }
1222
1476
  }
@@ -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(convertToObjTrue(mergedSelectedKeys));
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
@@ -188,6 +188,7 @@ export type Locale = TableLocale & {
188
188
  };
189
189
  export type ColumnsTable<RecordType = AnyObject> = ColumnTable<RecordType>[];
190
190
  export type TableProps<RecordType = AnyObject> = {
191
+ theme?: 'dark' | 'light';
191
192
  title?: ReactNode | ((data: RecordType) => ReactNode);
192
193
  editAble?: boolean;
193
194
  infiniteScroll?: boolean;
@@ -103,6 +103,15 @@ const TableContainer = props => {
103
103
  settableHeight(totalHeight - topHeight - bottomHeight);
104
104
  }
105
105
  }, [id, height, editAble, minHeight]);
106
+ _react.default.useEffect(() => {
107
+ const handleClickOutside = () => {
108
+ setFocusedCell(undefined);
109
+ };
110
+ document.addEventListener('mousedown', handleClickOutside);
111
+ return () => {
112
+ document.removeEventListener('mousedown', handleClickOutside);
113
+ };
114
+ }, []);
106
115
  const visibleColumns = table.getVisibleLeafColumns();
107
116
  const fixedLeftColumns = table.getState().columnPinning.left ? visibleColumns.filter(vc => table.getState().columnPinning.left?.includes(vc.id)) : [];
108
117
  const fixedRightColumns = table.getState().columnPinning.right ? visibleColumns.filter(vc => table.getState().columnPinning.right?.includes(vc.id)) : [];
@@ -1931,14 +1931,15 @@ const TableContainerEdit = props => {
1931
1931
  }))), /*#__PURE__*/_react.default.createElement("div", {
1932
1932
  ref: bottomToolbarRef
1933
1933
  }, toolbarItemsBottom && toolbarItemsBottom.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
1934
- className: 'ui-rc-toolbar-bottom'
1934
+ className: (0, _classnames.default)('ui-rc-toolbar-bottom', {
1935
+ 'ui-rc-toolbar-bottom_border-bottom': !pagination || infiniteScroll
1936
+ })
1935
1937
  // style={{ border: '0 1px 1px 1px solid #e0e0e0' }}
1936
- ,
1937
- style: {
1938
- borderBottom: '1px solid #e0e0e0',
1939
- borderRight: '1px solid #e0e0e0',
1940
- borderLeft: '1px solid #e0e0e0'
1941
- }
1938
+ // style={{
1939
+ // borderBottom: '1px solid #e0e0e0',
1940
+ // borderRight: '1px solid #e0e0e0',
1941
+ // borderLeft: '1px solid #e0e0e0'
1942
+ // }}
1942
1943
  }, /*#__PURE__*/_react.default.createElement(_rcMasterUi.Toolbar, {
1943
1944
  style: {
1944
1945
  width: '100%'
@@ -1948,9 +1949,7 @@ const TableContainerEdit = props => {
1948
1949
  onClick: ({}) => {
1949
1950
  setEditingKey('');
1950
1951
  }
1951
- })), pagination && !infiniteScroll && /*#__PURE__*/_react.default.createElement(_pagination.default
1952
- // style={{padding: '0.75rem 1rem'}}
1953
- , (0, _extends2.default)({}, pagination, {
1952
+ })), pagination && !infiniteScroll && /*#__PURE__*/_react.default.createElement(_pagination.default, (0, _extends2.default)({}, pagination, {
1954
1953
  rootClassName: 'pagination-template',
1955
1954
  showSizeChanger: true,
1956
1955
  responsive: true,
@@ -473,24 +473,29 @@ const TableBodyCell = props => {
473
473
  // })
474
474
  // }
475
475
  }
476
- }
476
+ },
477
+ onKeyUp: () => {}
477
478
 
478
479
  // onDoubleClick={() => { }}
479
480
  ,
480
481
 
481
482
  onClick: e => {
482
- if (!selectionSettings || selectionSettings.checkboxOnly !== true) {
483
- (0, _useColumns.toggleRowSelection)({
484
- e,
485
- cell,
486
- setIsSelectionChange,
487
- isSelectionChange,
488
- selectionSettings
489
- });
490
- setFocusedCell?.({
491
- colId: cell.column.id,
492
- rowId: cell.row.id
493
- });
483
+ const selection = window.getSelection();
484
+ const text = selection ? selection.toString() : "";
485
+ if (text.length > 0) {} else {
486
+ if (!selectionSettings || selectionSettings.checkboxOnly !== true) {
487
+ (0, _useColumns.toggleRowSelection)({
488
+ e,
489
+ cell,
490
+ setIsSelectionChange,
491
+ isSelectionChange,
492
+ selectionSettings
493
+ });
494
+ setFocusedCell?.({
495
+ colId: cell.column.id,
496
+ rowId: cell.row.id
497
+ });
498
+ }
494
499
  }
495
500
  }
496
501
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -248,12 +248,18 @@ const TableBodyCellEdit = props => {
248
248
  const expandIconColumnIndex = expandable?.expandIconColumnIndex;
249
249
  const record = cell.row.original;
250
250
  const columnMeta = cell.column.columnDef.meta ?? {};
251
- const cellContent = columnMeta.type === 'checkbox' ? '' : (0, _reactTable.flexRender)(cell.column.columnDef.cell, cell.getContext());
251
+ const [isOpenTooltip, setIsOpenTooltip] = _react.default.useState(false);
252
+
253
+ // const cellContent = columnMeta.type === 'checkbox' ? '' : flexRender(cell.column.columnDef.cell, cell.getContext());
252
254
  // const html = ReactDOMServer.renderToStaticMarkup(<>{cellContent}</>);
253
255
  // const hasValue = html.trim().length > 0;
254
256
 
255
257
  const rowError = dataErrors ? dataErrors.find(it => it.id === cell.row.id) : undefined;
256
258
  const message = rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : undefined;
259
+ const tooltipContent = isOpenTooltip === false ? '' : columnMeta?.tooltipDescription ? typeof columnMeta.tooltipDescription === 'function' ? columnMeta.tooltipDescription({
260
+ value: cell.getValue(),
261
+ record
262
+ }) : columnMeta.tooltipDescription : columnMeta.template && typeof columnMeta.template !== 'function' ? columnMeta.template : cell.getValue();
257
263
  const canEdit = (0, _utils.isEditable)(cell.column.columnDef.meta, record) && isRowEditable !== false;
258
264
 
259
265
  // const allRows = table.getRowModel().rows;
@@ -435,7 +441,10 @@ const TableBodyCellEdit = props => {
435
441
  const rs = (0, _utils.unFlattenData)(rsFilterData);
436
442
  triggerPaste?.(pastedRows, colPasteds, rs, copyRows);
437
443
  };
438
- function handleMouseEnter(rowId, colId) {
444
+ function handleMouseEnter(e, rowId, colId) {
445
+ if (e.target.firstChild?.clientWidth < e.target.firstChild?.scrollWidth) {
446
+ setIsOpenTooltip(true);
447
+ }
439
448
  if (isSelecting) {
440
449
  setEndCell?.({
441
450
  rowId,
@@ -1050,12 +1059,8 @@ const TableBodyCellEdit = props => {
1050
1059
  "data-col-key": cell.column.id,
1051
1060
  "data-row-key": cell.row.id,
1052
1061
  "data-tooltip-id": `${id}-tooltip-content`,
1053
- "data-tooltip-delay-show": 500
1054
- // data-tooltip-html={!isEditing && !hasValue && !message ? undefined : ReactDOMServer.renderToStaticMarkup(<>{rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : cellContent}</>)}
1055
- // data-tooltip-content={!isEditing && !message ? undefined : rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : record[columnMeta.field ?? '']}
1056
- // data-tooltip-content={isEditing && message ? message : rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : record[columnMeta.field ?? '']}
1057
- ,
1058
- "data-tooltip-html": isEditing && message ? message : rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : _server.default.renderToStaticMarkup( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, cellContent)),
1062
+ "data-tooltip-delay-show": 500,
1063
+ "data-tooltip-html": isEditing && message ? message : rowError && rowError[cell.column.id]?.field === cell.column.id ? rowError[cell.column.id].message : _server.default.renderToStaticMarkup( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, tooltipContent)),
1059
1064
  className: (0, _classnames.default)(`${prefix}-grid-cell cell-editable editable `, {
1060
1065
  [`${prefix}-grid-cell-ellipsis`]: true,
1061
1066
  'cell-editing': isEditing,
@@ -1105,7 +1110,7 @@ const TableBodyCellEdit = props => {
1105
1110
  }
1106
1111
  }
1107
1112
  },
1108
- onMouseEnter: () => handleMouseEnter(cell.row.id, cell.column.id),
1113
+ onMouseEnter: e => handleMouseEnter(e, cell.row.id, cell.column.id),
1109
1114
  onMouseUp: e => handleMouseUp(e),
1110
1115
  onKeyDown: e => {
1111
1116
  if (!isEditing) {
@@ -73,8 +73,8 @@ const TableFooterCell = ({
73
73
  display: 'flex',
74
74
  ...(0, _utils.getCommonPinningStyles)(column),
75
75
  // width: column?.getSize() ?? column.getSize(),
76
- minWidth: column?.getSize(),
77
- backgroundColor: "#fafafa"
76
+ minWidth: column?.getSize()
77
+ // backgroundColor: "#fafafa",
78
78
  }
79
79
  }, column.id !== "id" && column.id !== "selection_column" ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, col.summaryTemplate ? col.summaryTemplate(numberValue, col.field) : (0, _reactNumericComponent.numericFormatter)(cellValue, numericFormatProps)) : '');
80
80
  };
@@ -37,11 +37,12 @@ const TableFooterRow = ({
37
37
  style: {
38
38
  display: "grid",
39
39
  width: "100%",
40
- borderBottom: "1px solid #e0e0e0",
41
- borderTop: "1px solid #e0e0e0",
40
+ // borderBottom: "1px solid #e0e0e0",
41
+ // borderTop: "1px solid #e0e0e0",
42
42
  height: 37,
43
43
  gridTemplateColumns: `${table.getVisibleLeafColumns().map(n => `${n.getSize()}fr`).join(" ")}`
44
- }
44
+ },
45
+ className: "ui-rc-grid-footer-row"
45
46
  }, visibleColumns.map(header => {
46
47
  return /*#__PURE__*/_react.default.createElement(_TableFooterCell.default, {
47
48
  key: header.id
@@ -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
- // $rowSelectedHoverBg: 'ui-rc' !default;
20
- $boxShadowColor: rgba(5, 5, 5, 0.09) !default;
21
- $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
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
 
@@ -271,7 +287,9 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
271
287
  .#{$prefix}-grid-cell:not(.editable) {
272
288
  // background-color: $rowHoverBg;
273
289
 
274
- &.cell-editable, &.#{$prefix}-grid-cell-index, &.#{$prefix}-grid-cell-selection {
290
+ &.cell-editable,
291
+ &.#{$prefix}-grid-cell-index,
292
+ &.#{$prefix}-grid-cell-selection {
275
293
  // background-color: transparent;
276
294
  }
277
295
 
@@ -598,10 +616,26 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
598
616
  }
599
617
 
600
618
  .#{$prefix}-grid-tfoot {
601
- background-color: rgb(250, 250, 250);
619
+ // background-color: rgb(250, 250, 250);
620
+ // background-color: #fafafa;
621
+
622
+ .#{$prefix}-grid-footer-row {
623
+ border-bottom-width: 1px;
624
+ border-bottom-color: $tableBorderColor;
625
+ border-bottom-style: solid;
626
+
627
+ border-top-width: 1px;
628
+ border-top-color: $tableBorderColor;
629
+ border-top-style: solid;
630
+
631
+
632
+
633
+ }
602
634
 
603
635
  .#{$prefix}-grid-cell {
604
- background-color: $body-color;
636
+
637
+ background-color: #fafafa;
638
+
605
639
  border-inline-end: 1px solid $tableBorderColor;
606
640
  }
607
641
  }
@@ -796,6 +830,10 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
796
830
 
797
831
  // bottom toolbar
798
832
  .ui-rc-toolbar-bottom {
833
+ // border-bottom: 1px solid #e0e0e0;
834
+ border-right: 1px solid #e0e0e0;
835
+ border-left: 1px solid #e0e0e0;
836
+
799
837
  .be-toolbar-item {
800
838
  .toolbar-dropdown-button {
801
839
  .ant-btn.ant-btn-default.ant-btn-variant-outlined.ant-btn-compact-item.ant-btn-compact-first-item {
@@ -814,6 +852,10 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
814
852
  }
815
853
  }
816
854
 
855
+ .ui-rc-toolbar-bottom_border-bottom {
856
+ border-bottom: 1px solid #e0e0e0;
857
+ }
858
+
817
859
  .ui-rc-toolbar-bottom {
818
860
  position: relative;
819
861
  padding: .25rem 1rem;
@@ -1219,4 +1261,216 @@ $fontFamily: "Montserrat", Helvetica, Arial, serif !default;
1219
1261
 
1220
1262
 
1221
1263
 
1264
+ }
1265
+
1266
+
1267
+ // #region theme
1268
+ // theme
1269
+
1270
+ // ------------light-----------
1271
+
1272
+ .#{$prefix}-grid-light {
1273
+ background-color: #ffffff;
1274
+
1275
+ &.ui-rc-grid .ui-rc-grid-container .ui-rc-grid-thead .ui-rc-grid-cell {}
1276
+ }
1277
+
1278
+
1279
+ // rgb(225 222 245 / 0.12
1280
+
1281
+ .#{$prefix}-grid-dark {
1282
+ background-color: $body-color-Dark;
1283
+ color: #ffffff;
1284
+
1285
+ &.ui-rc-grid .ui-rc-grid-container .ui-rc-grid-thead .ui-rc-grid-cell {
1286
+ background-color: $body-color-Dark;
1287
+ color: #E1DEF5E6;
1288
+ }
1289
+
1290
+ &.ui-rc-grid .ui-rc-grid-container .ui-rc-grid-tbody .ui-rc-grid-cell {
1291
+ // background-color: $body-color-Dark;
1292
+ // color: #E1DEF5E6;
1293
+ }
1294
+
1295
+ &.ui-rc-grid .ui-rc-grid-container .ui-rc-grid-tfoot .ui-rc-grid-cell {
1296
+ background-color: #25293C;
1297
+ color: #E1DEF5E6;
1298
+ }
1299
+
1300
+ &.ui-rc-grid {
1301
+ .ui-rc-toolbar-bottom {
1302
+ background-color: $body-color-Dark;
1303
+ color: #E1DEF5E6;
1304
+ border-color: $tableBorderColorDark;
1305
+ }
1306
+ }
1307
+
1308
+ &.ui-rc-grid .ui-rc-grid-container.ui-rc-table-ping-right .ui-rc-grid-cell.ui-rc-grid-cell-fix-right-first::before {
1309
+ border-inline-start-color: $tableBorderColorDark;
1310
+ }
1311
+
1312
+ &.ui-rc-grid .ui-rc-grid-container .ui-rc-grid-tbody .ui-rc-grid-cell.cell-editable {
1313
+
1314
+
1315
+ &.cell-border-right {
1316
+ border-right-color: $border-selected-color-Dark;
1317
+ }
1318
+
1319
+ &.cell-border-bottom {
1320
+ border-bottom-color: $border-selected-color-Dark;
1321
+ }
1322
+
1323
+ &.cell-border-left::before {
1324
+ border-color: $border-selected-color-Dark;
1325
+ }
1326
+
1327
+ &.cell-border-top::after {
1328
+ border-color: $border-selected-color-Dark;
1329
+ }
1330
+ }
1331
+
1332
+ .ui-rc-pagination {
1333
+ background-color: $body-color-Dark;
1334
+ color: #E1DEF5E6;
1335
+
1336
+ border-bottom: 1px solid $tableBorderColorDark;
1337
+ border-top: 1px solid $tableBorderColorDark;
1338
+ border-inline-color: $tableBorderColorDark;
1339
+
1340
+ .ui-rc-pagination-prev {
1341
+ .anticon.anticon-left {
1342
+ color: #ffffff;
1343
+ }
1344
+ }
1345
+
1346
+ .ui-rc-pagination-disabled {
1347
+ .anticon.anticon-left {
1348
+ color: #7d7a7a;
1349
+ }
1350
+ }
1351
+
1352
+ .ui-rc-pagination-next {
1353
+ .anticon.anticon-right {
1354
+ color: #ffffff;
1355
+ }
1356
+
1357
+ &.ui-rc-pagination-disabled {
1358
+ .anticon.anticon-right {
1359
+ color: #7d7a7a;
1360
+ }
1361
+ }
1362
+
1363
+ }
1364
+ }
1365
+
1366
+ .ui-rc-toolbar {
1367
+ .ui-rc-toolbar-selection-item {
1368
+ background-color: #25293C;
1369
+ color: #E1DEF5E6;
1370
+ }
1371
+
1372
+ }
1373
+
1374
+ &.ui-rc-grid {
1375
+ .ui-rc-grid-top-toolbar {
1376
+ border-top-color: $tableBorderColorDark;
1377
+ border-inline-color: $tableBorderColorDark;
1378
+
1379
+ }
1380
+ }
1381
+
1382
+ &.ui-rc-grid {
1383
+ .ui-rc-grid-container {
1384
+ border-bottom: 0;
1385
+ border-color: $tableBorderColorDark;
1386
+
1387
+ .ui-rc-grid-tbody {
1388
+ .ui-rc-grid-row {
1389
+ border-bottom-color: $tableBorderColorDark;
1390
+
1391
+
1392
+ }
1393
+
1394
+ .ui-rc-grid-cell {
1395
+ border-inline-end-color: $tableBorderColorDark;
1396
+ background-color: $body-color-Dark;
1397
+ color: #E1DEF5E6;
1398
+
1399
+ &.ui-rc-grid-cell-selected {
1400
+
1401
+ background-color: #33335d !important;
1402
+
1403
+ }
1404
+
1405
+ &.disable {
1406
+ background-color: #272A2F;
1407
+ }
1408
+
1409
+ // input
1410
+ // .ui-rc-table-select-selector,
1411
+ // .ui-rc-select-selector,
1412
+ // .ant-input-outlined,
1413
+ // .ant-picker-outlined {
1414
+ // background-color: #272933;
1415
+ // color: #ffffff;
1416
+
1417
+ // .ui-rc-table-select-selection-placeholder,
1418
+ // .ui-rc-select-selection-placeholder {
1419
+ // color: #797171;
1420
+ // }
1421
+ // }
1422
+ // .ant-picker-input {
1423
+
1424
+ // input {
1425
+ // &::placeholder {
1426
+ // color: #797171;
1427
+ // }
1428
+ // }
1429
+ // }
1430
+ // .ant-input-outlined::placeholder {
1431
+ // color: #797171;
1432
+ // }
1433
+
1434
+
1435
+ }
1436
+
1437
+ .ui-rc-grid-row-selected {
1438
+ .ui-rc-grid-cell {
1439
+ background-color: $rowSelectedBg-Dark;
1440
+
1441
+ // &.disable {
1442
+ // background-color: #272A2F;
1443
+ // }
1444
+ }
1445
+ }
1446
+
1447
+ }
1448
+
1449
+ .ui-rc-grid-thead {
1450
+ .ui-rc-grid-cell {
1451
+ border-inline-end-color: $tableBorderColorDark;
1452
+ border-bottom-color: $tableBorderColorDark;
1453
+ }
1454
+ }
1455
+
1456
+ .ui-rc-grid-tfoot {
1457
+ .#{$prefix}-grid-footer-row {
1458
+ border-bottom-color: $tableBorderColorDark;
1459
+
1460
+ border-top-color: $tableBorderColorDark;
1461
+
1462
+
1463
+
1464
+ }
1465
+
1466
+ .ui-rc-grid-cell {
1467
+ border-inline-end-color: $tableBorderColorDark;
1468
+ }
1469
+ }
1470
+ }
1471
+ }
1472
+
1473
+ .ui-rc-toolbar-bottom_border-bottom {
1474
+ border-bottom-color: $tableBorderColorDark;
1475
+ }
1222
1476
  }
@@ -17,6 +17,7 @@ var _TableContainer = _interopRequireDefault(require("../TableContainer"));
17
17
  var _operator = require("../features/operator");
18
18
  var _utils = require("../hook/utils");
19
19
  var _TableContainerEdit = _interopRequireDefault(require("../TableContainerEdit"));
20
+ var _classnames = _interopRequireDefault(require("classnames"));
20
21
  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); }
21
22
  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; }
22
23
  // import { makeData } from "../default/makeData";
@@ -27,6 +28,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
27
28
 
28
29
  const Grid = props => {
29
30
  const {
31
+ theme = 'light',
30
32
  t,
31
33
  id,
32
34
  prefix,
@@ -72,7 +74,7 @@ const Grid = props => {
72
74
  // const [rowSelection, setRowSelection] = React.useState<RowSelectionState>({})
73
75
 
74
76
  // const [rowSelection, setRowSelection] = React.useState<RowSelectionState>(convertToObjTrue(selectionSettings?.selectedRowKeys ?? []))
75
- const [rowSelection, setRowSelection] = _react.default.useState((0, _utils.convertToObjTrue)(mergedSelectedKeys));
77
+ const [rowSelection, setRowSelection] = _react.default.useState({});
76
78
  // const [rowsSelected, setRowsSelected] = React.useState<RecordType[]>([])
77
79
 
78
80
  const [grouping, setGrouping] = _react.default.useState([]);
@@ -126,6 +128,9 @@ const Grid = props => {
126
128
  }
127
129
  return true;
128
130
  },
131
+ initialState: {
132
+ rowSelection: {}
133
+ },
129
134
  onRowSelectionChange: setRowSelection,
130
135
  // RowSelection
131
136
 
@@ -173,31 +178,9 @@ const Grid = props => {
173
178
  }
174
179
  }
175
180
  }, [columnHidden, columnSizingInfo]);
176
-
177
- // React.useEffect(() => {
178
- // if (columnSizingInfo.isResizingColumn === false) {
179
-
180
- // const aa = updateColumnWidthsRecursive(propsColumns, columnSizing)
181
-
182
- // setColumns(aa)
183
-
184
- // }
185
-
186
- // }, [columnSizingInfo])
187
-
188
181
  _react.default.useEffect(() => {
189
- // if (Object.keys(rowSelection) !== Object.keys(mergedSelectedKeys) && !isSelectionChange.isChange) {
190
- // setRowSelection(convertToObjTrue(mergedSelectedKeys))
191
-
192
- // }
193
-
194
182
  const isEqual = (0, _utils.isObjEqual)((0, _utils.convertToObjTrue)(mergedSelectedKeys), rowSelection);
195
183
  if (!isEqual) {
196
- // setIsSelectionChange((prev) => ({
197
- // ...prev,
198
- // isChange: false
199
- // }))
200
-
201
184
  setRowSelection((0, _utils.convertToObjTrue)(mergedSelectedKeys));
202
185
  }
203
186
  }, [mergedSelectedKeys]);
@@ -277,7 +260,10 @@ const Grid = props => {
277
260
  const sensors = (0, _core.useSensors)((0, _core.useSensor)(_core.MouseSensor, {}), (0, _core.useSensor)(_core.TouchSensor, {}), (0, _core.useSensor)(_core.KeyboardSensor, {}));
278
261
  const ContainerComponent = editAble ? _TableContainerEdit.default : _TableContainer.default;
279
262
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
280
- className: `${prefix}-grid`,
263
+ className: (0, _classnames.default)(`${prefix}-grid`, {
264
+ [`${prefix}-grid-light`]: theme === 'light',
265
+ [`${prefix}-grid-dark`]: theme === 'dark'
266
+ }),
281
267
  style: {
282
268
  minHeight: minHeight ?? undefined,
283
269
  maxHeight: height ?? undefined
@@ -350,7 +336,10 @@ const Grid = props => {
350
336
  paddingTop: 40
351
337
  }
352
338
  }, /*#__PURE__*/_react.default.createElement("div", {
353
- className: `${prefix}-grid`,
339
+ className: (0, _classnames.default)(`${prefix}-grid`, {
340
+ [`${prefix}-grid-light`]: theme === 'light',
341
+ [`${prefix}-grid-dark`]: theme === 'dark'
342
+ }),
354
343
  style: {
355
344
  // minHeight: minHeight ?? undefined,
356
345
  maxHeight: windowSize.innerHeight - 70
@@ -188,6 +188,7 @@ export type Locale = TableLocale & {
188
188
  };
189
189
  export type ColumnsTable<RecordType = AnyObject> = ColumnTable<RecordType>[];
190
190
  export type TableProps<RecordType = AnyObject> = {
191
+ theme?: 'dark' | 'light';
191
192
  title?: ReactNode | ((data: RecordType) => ReactNode);
192
193
  editAble?: boolean;
193
194
  infiniteScroll?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-grid-template",
3
- "version": "1.8.55",
3
+ "version": "1.8.56",
4
4
  "description": "es-grid-template",
5
5
  "keywords": [
6
6
  "react",