@lemon-fe/kits 1.0.0-140 → 1.0.0-141

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.
@@ -100,10 +100,6 @@ export default class DataGrid<TData extends Record<string, any>> extends Compone
100
100
  private getMemoizedDetailCellParams;
101
101
  private getRowStyle;
102
102
  private cellFocused;
103
- /**
104
- * 防止点击checkbox之外的地方,导致其他行清空选中
105
- */
106
- private cellClicked;
107
103
  /**
108
104
  * 在表格失去焦点后,聚焦失去焦点的单元格
109
105
  * @returns
@@ -402,21 +402,6 @@ var DataGrid = /*#__PURE__*/function (_Component) {
402
402
  };
403
403
  });
404
404
 
405
- _defineProperty(_assertThisInitialized(_this), "cellClicked", function (evt) {
406
- var _this$props4 = _this.props,
407
- onCellClicked = _this$props4.onCellClicked,
408
- suppressRowClickSelection = _this$props4.suppressRowClickSelection;
409
- onCellClicked === null || onCellClicked === void 0 ? void 0 : onCellClicked(evt);
410
-
411
- if (!suppressRowClickSelection && evt.node.selectable) {
412
- if (evt.column.getColId() !== '__selection__') {
413
- evt.node.setSelected(true, true);
414
- } else if (!evt.node.isSelected()) {
415
- evt.node.setSelected(true, false);
416
- }
417
- }
418
- });
419
-
420
405
  _this.state = _objectSpread({
421
406
  colDefs: _this.getColumnDefs(),
422
407
  loading: false
@@ -440,9 +425,9 @@ var DataGrid = /*#__PURE__*/function (_Component) {
440
425
  _createClass(DataGrid, [{
441
426
  key: "getPagination",
442
427
  value: function getPagination() {
443
- var _this$props5 = this.props,
444
- pagination = _this$props5.pagination,
445
- fetch = _this$props5.fetch;
428
+ var _this$props4 = this.props,
429
+ pagination = _this$props4.pagination,
430
+ fetch = _this$props4.fetch;
446
431
  var page = 1;
447
432
  var pageSize = 50;
448
433
  var total = 0;
@@ -475,11 +460,11 @@ var DataGrid = /*#__PURE__*/function (_Component) {
475
460
  value: function componentDidUpdate(prevProps) {
476
461
  var _prevProps$rowSelecti;
477
462
 
478
- var _this$props6 = this.props,
479
- columns = _this$props6.columns,
480
- rowSelection = _this$props6.rowSelection,
481
- dataSource = _this$props6.dataSource,
482
- context = _this$props6.context;
463
+ var _this$props5 = this.props,
464
+ columns = _this$props5.columns,
465
+ rowSelection = _this$props5.rowSelection,
466
+ dataSource = _this$props5.dataSource,
467
+ context = _this$props5.context;
483
468
 
484
469
  if (columns !== prevProps.columns) {
485
470
  this.syncColRender();
@@ -622,13 +607,13 @@ var DataGrid = /*#__PURE__*/function (_Component) {
622
607
  value: function getColumnDefs() {
623
608
  var _this3 = this;
624
609
 
625
- var _this$props7 = this.props,
626
- _this$props7$columns = _this$props7.columns,
627
- columns = _this$props7$columns === void 0 ? [] : _this$props7$columns,
628
- rowActions = _this$props7.rowActions,
629
- rowSelection = _this$props7.rowSelection,
630
- _this$props7$defaultC = _this$props7.defaultColDef,
631
- defaultCol = _this$props7$defaultC === void 0 ? {} : _this$props7$defaultC;
610
+ var _this$props6 = this.props,
611
+ _this$props6$columns = _this$props6.columns,
612
+ columns = _this$props6$columns === void 0 ? [] : _this$props6$columns,
613
+ rowActions = _this$props6.rowActions,
614
+ rowSelection = _this$props6.rowSelection,
615
+ _this$props6$defaultC = _this$props6.defaultColDef,
616
+ defaultCol = _this$props6$defaultC === void 0 ? {} : _this$props6$defaultC;
632
617
 
633
618
  var map = function map(cols) {
634
619
  return cols.map(function (item) {
@@ -830,6 +815,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
830
815
  suppressMovable: true,
831
816
  lockPinned: true,
832
817
  lockVisible: true,
818
+ cellClass: prefix('cell-selection'),
833
819
  pinned: rowSelection.fixed
834
820
  });
835
821
  }
@@ -1278,25 +1264,25 @@ var DataGrid = /*#__PURE__*/function (_Component) {
1278
1264
  value: function render() {
1279
1265
  var _this10 = this;
1280
1266
 
1281
- var _this$props8 = this.props,
1282
- rowKey = _this$props8.rowKey,
1283
- fetch = _this$props8.fetch,
1284
- dataSource = _this$props8.dataSource,
1285
- rowActions = _this$props8.rowActions,
1286
- columns = _this$props8.columns,
1287
- autoLoad = _this$props8.autoLoad,
1288
- loadingProp = _this$props8.loading,
1289
- summary = _this$props8.summary,
1290
- detailCell = _this$props8.detailCell,
1291
- pagination = _this$props8.pagination,
1292
- rowSelection = _this$props8.rowSelection,
1293
- columnTypesProp = _this$props8.columnTypes,
1294
- defaultColDefProp = _this$props8.defaultColDef,
1295
- componentsProp = _this$props8.components,
1296
- sideBarProp = _this$props8.sideBar,
1297
- detailCellRendererParams = _this$props8.detailCellRendererParams,
1298
- context = _this$props8.context,
1299
- restProps = _objectWithoutProperties(_this$props8, _excluded4);
1267
+ var _this$props7 = this.props,
1268
+ rowKey = _this$props7.rowKey,
1269
+ fetch = _this$props7.fetch,
1270
+ dataSource = _this$props7.dataSource,
1271
+ rowActions = _this$props7.rowActions,
1272
+ columns = _this$props7.columns,
1273
+ autoLoad = _this$props7.autoLoad,
1274
+ loadingProp = _this$props7.loading,
1275
+ summary = _this$props7.summary,
1276
+ detailCell = _this$props7.detailCell,
1277
+ pagination = _this$props7.pagination,
1278
+ rowSelection = _this$props7.rowSelection,
1279
+ columnTypesProp = _this$props7.columnTypes,
1280
+ defaultColDefProp = _this$props7.defaultColDef,
1281
+ componentsProp = _this$props7.components,
1282
+ sideBarProp = _this$props7.sideBar,
1283
+ detailCellRendererParams = _this$props7.detailCellRendererParams,
1284
+ context = _this$props7.context,
1285
+ restProps = _objectWithoutProperties(_this$props7, _excluded4);
1300
1286
 
1301
1287
  var _this$state2 = this.state,
1302
1288
  colDefs = _this$state2.colDefs,
@@ -1363,7 +1349,6 @@ var DataGrid = /*#__PURE__*/function (_Component) {
1363
1349
  singleClickEdit: true,
1364
1350
  suppressPaginationPanel: true,
1365
1351
  suppressCopyRowsToClipboard: true,
1366
- suppressRowClickSelection: true,
1367
1352
  enableCellEditingOnBackspace: true,
1368
1353
  loadingOverlayComponent: this.LoadingOverlay,
1369
1354
  noRowsOverlayComponent: this.NoRowsOverlay,
@@ -1380,7 +1365,6 @@ var DataGrid = /*#__PURE__*/function (_Component) {
1380
1365
  onCellValueChanged: this.cellValueChanged,
1381
1366
  onCellEditingStopped: this.cellEditingStop,
1382
1367
  onCellFocused: this.cellFocused,
1383
- onCellClicked: this.cellClicked,
1384
1368
  pagination: enablePagination,
1385
1369
  paginationPageSize: pageSize,
1386
1370
  columnDefs: colDefs,
@@ -35,6 +35,24 @@
35
35
  text-align: center;
36
36
  }
37
37
 
38
+ &-cell-selection .ag-checkbox-input-wrapper {
39
+ position: absolute;
40
+ top: 0;
41
+ right: 0;
42
+ bottom: 0;
43
+ left: 0;
44
+ width: auto;
45
+ height: auto;
46
+ background-color: transparent;
47
+
48
+ &::after {
49
+ top: 50%;
50
+ left: 50%;
51
+ background-color: #fff;
52
+ transform: translate(-50%, -50%);
53
+ }
54
+ }
55
+
38
56
  &-editable-cell {
39
57
  padding-right: 0;
40
58
  padding-left: 0;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@lemon-fe/kits",
3
- "version": "1.0.0-140",
3
+ "version": "1.0.0-141",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
7
- "docs:deploy": "scp -r kits-docs-next dev@47.111.99.207:/opt/app/",
7
+ "docs:deploy": "scp -r kits-docs-next root@47.111.99.207:/opt/app/",
8
8
  "build": "father build",
9
9
  "deploy": "npm run docs:build && npm run docs:deploy",
10
10
  "prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",