@lemon-fe/kits 1.0.0-136 → 1.0.0-138

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.
@@ -44,10 +44,10 @@ export default class DataGrid<TData extends Record<string, any>> extends Compone
44
44
  };
45
45
  static EmptyCol: ColType<any>;
46
46
  static Editors: {
47
- Text: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & import("./typings").TextEditorParams & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
47
+ Text: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & import("./typings").TextEditorParams<any> & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
48
48
  Date: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & import("./typings").DateEditorParams & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
49
49
  Number: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & import("./typings").NumberEditorParams<any> & React.RefAttributes<import("@ag-grid-community/react").ICellEditorReactComp>>;
50
- Select: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "mode" | "allowClear" | "options" | "virtual" | "showSearch" | "listHeight"> & {
50
+ Select: React.ForwardRefExoticComponent<import("@ag-grid-community/core").ICellEditorParams<any, any, any> & Pick<import("antd").SelectProps<any, import("antd/lib/select").BaseOptionType>, "disabled" | "allowClear" | "mode" | "options" | "virtual" | "showSearch" | "listHeight"> & {
51
51
  fieldNames?: {
52
52
  label: string;
53
53
  value: string;
@@ -65,7 +65,7 @@ export default class DataGrid<TData extends Record<string, any>> extends Compone
65
65
  private syncColRender;
66
66
  private syncSelection;
67
67
  private syncRowData;
68
- private getColumDefs;
68
+ private getColumnDefs;
69
69
  private isClientMode;
70
70
  private clearReadyQueue;
71
71
  private afterReady;
@@ -100,6 +100,10 @@ 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;
103
107
  /**
104
108
  * 在表格失去焦点后,聚焦失去焦点的单元格
105
109
  * @returns
@@ -286,9 +286,12 @@ var DataGrid = /*#__PURE__*/function (_Component) {
286
286
  });
287
287
 
288
288
  _defineProperty(_assertThisInitialized(_this), "cellEditingStop", function (evt) {
289
+ var onCellEditingStopped = _this.props.onCellEditingStopped;
289
290
  var data = evt.data;
290
291
 
291
292
  _this.validateRecord(data);
293
+
294
+ onCellEditingStopped === null || onCellEditingStopped === void 0 ? void 0 : onCellEditingStopped(evt);
292
295
  });
293
296
 
294
297
  _defineProperty(_assertThisInitialized(_this), "blurTimer", null);
@@ -394,8 +397,23 @@ var DataGrid = /*#__PURE__*/function (_Component) {
394
397
  };
395
398
  });
396
399
 
400
+ _defineProperty(_assertThisInitialized(_this), "cellClicked", function (evt) {
401
+ var _this$props4 = _this.props,
402
+ onCellClicked = _this$props4.onCellClicked,
403
+ suppressRowClickSelection = _this$props4.suppressRowClickSelection;
404
+ onCellClicked === null || onCellClicked === void 0 ? void 0 : onCellClicked(evt);
405
+
406
+ if (!suppressRowClickSelection && evt.node.selectable) {
407
+ if (evt.column.getColId() !== '__selection__') {
408
+ evt.node.setSelected(true, true);
409
+ } else if (!evt.node.isSelected()) {
410
+ evt.node.setSelected(true, false);
411
+ }
412
+ }
413
+ });
414
+
397
415
  _this.state = _objectSpread({
398
- colDefs: _this.getColumDefs(),
416
+ colDefs: _this.getColumnDefs(),
399
417
  loading: false
400
418
  }, _this.getPagination());
401
419
  _this.store = new Store({
@@ -417,9 +435,9 @@ var DataGrid = /*#__PURE__*/function (_Component) {
417
435
  _createClass(DataGrid, [{
418
436
  key: "getPagination",
419
437
  value: function getPagination() {
420
- var _this$props4 = this.props,
421
- pagination = _this$props4.pagination,
422
- fetch = _this$props4.fetch;
438
+ var _this$props5 = this.props,
439
+ pagination = _this$props5.pagination,
440
+ fetch = _this$props5.fetch;
423
441
  var page = 1;
424
442
  var pageSize = 50;
425
443
  var total = 0;
@@ -452,16 +470,16 @@ var DataGrid = /*#__PURE__*/function (_Component) {
452
470
  value: function componentDidUpdate(prevProps) {
453
471
  var _prevProps$rowSelecti;
454
472
 
455
- var _this$props5 = this.props,
456
- columns = _this$props5.columns,
457
- rowSelection = _this$props5.rowSelection,
458
- dataSource = _this$props5.dataSource,
459
- context = _this$props5.context;
473
+ var _this$props6 = this.props,
474
+ columns = _this$props6.columns,
475
+ rowSelection = _this$props6.rowSelection,
476
+ dataSource = _this$props6.dataSource,
477
+ context = _this$props6.context;
460
478
 
461
479
  if (columns !== prevProps.columns) {
462
480
  this.syncColRender();
463
481
  this.setState({
464
- colDefs: this.getColumDefs()
482
+ colDefs: this.getColumnDefs()
465
483
  });
466
484
  }
467
485
 
@@ -595,17 +613,17 @@ var DataGrid = /*#__PURE__*/function (_Component) {
595
613
  }
596
614
  }
597
615
  }, {
598
- key: "getColumDefs",
599
- value: function getColumDefs() {
616
+ key: "getColumnDefs",
617
+ value: function getColumnDefs() {
600
618
  var _this3 = this;
601
619
 
602
- var _this$props6 = this.props,
603
- _this$props6$columns = _this$props6.columns,
604
- columns = _this$props6$columns === void 0 ? [] : _this$props6$columns,
605
- rowActions = _this$props6.rowActions,
606
- rowSelection = _this$props6.rowSelection,
607
- _this$props6$defaultC = _this$props6.defaultColDef,
608
- defaultCol = _this$props6$defaultC === void 0 ? {} : _this$props6$defaultC;
620
+ var _this$props7 = this.props,
621
+ _this$props7$columns = _this$props7.columns,
622
+ columns = _this$props7$columns === void 0 ? [] : _this$props7$columns,
623
+ rowActions = _this$props7.rowActions,
624
+ rowSelection = _this$props7.rowSelection,
625
+ _this$props7$defaultC = _this$props7.defaultColDef,
626
+ defaultCol = _this$props7$defaultC === void 0 ? {} : _this$props7$defaultC;
609
627
 
610
628
  var map = function map(cols) {
611
629
  return cols.map(function (item) {
@@ -800,6 +818,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
800
818
  checkboxSelection: checkboxSelection,
801
819
  showDisabledCheckboxes: true,
802
820
  headerCheckboxSelection: rowSelection.type !== 'radio',
821
+ spanHeaderHeight: true,
803
822
  resizable: false,
804
823
  sortable: false,
805
824
  suppressAutoSize: true,
@@ -1254,25 +1273,25 @@ var DataGrid = /*#__PURE__*/function (_Component) {
1254
1273
  value: function render() {
1255
1274
  var _this10 = this;
1256
1275
 
1257
- var _this$props7 = this.props,
1258
- rowKey = _this$props7.rowKey,
1259
- fetch = _this$props7.fetch,
1260
- dataSource = _this$props7.dataSource,
1261
- rowActions = _this$props7.rowActions,
1262
- columns = _this$props7.columns,
1263
- autoLoad = _this$props7.autoLoad,
1264
- loadingProp = _this$props7.loading,
1265
- summary = _this$props7.summary,
1266
- detailCell = _this$props7.detailCell,
1267
- pagination = _this$props7.pagination,
1268
- rowSelection = _this$props7.rowSelection,
1269
- columnTypesProp = _this$props7.columnTypes,
1270
- defaultColDefProp = _this$props7.defaultColDef,
1271
- componentsProp = _this$props7.components,
1272
- sideBarProp = _this$props7.sideBar,
1273
- detailCellRendererParams = _this$props7.detailCellRendererParams,
1274
- context = _this$props7.context,
1275
- restProps = _objectWithoutProperties(_this$props7, _excluded4);
1276
+ var _this$props8 = this.props,
1277
+ rowKey = _this$props8.rowKey,
1278
+ fetch = _this$props8.fetch,
1279
+ dataSource = _this$props8.dataSource,
1280
+ rowActions = _this$props8.rowActions,
1281
+ columns = _this$props8.columns,
1282
+ autoLoad = _this$props8.autoLoad,
1283
+ loadingProp = _this$props8.loading,
1284
+ summary = _this$props8.summary,
1285
+ detailCell = _this$props8.detailCell,
1286
+ pagination = _this$props8.pagination,
1287
+ rowSelection = _this$props8.rowSelection,
1288
+ columnTypesProp = _this$props8.columnTypes,
1289
+ defaultColDefProp = _this$props8.defaultColDef,
1290
+ componentsProp = _this$props8.components,
1291
+ sideBarProp = _this$props8.sideBar,
1292
+ detailCellRendererParams = _this$props8.detailCellRendererParams,
1293
+ context = _this$props8.context,
1294
+ restProps = _objectWithoutProperties(_this$props8, _excluded4);
1276
1295
 
1277
1296
  var _this$state2 = this.state,
1278
1297
  colDefs = _this$state2.colDefs,
@@ -1327,12 +1346,19 @@ var DataGrid = /*#__PURE__*/function (_Component) {
1327
1346
  style: restProps.domLayout === 'autoHeight' ? {
1328
1347
  height: 'auto'
1329
1348
  } : undefined,
1330
- onBlur: this.handleBlur,
1349
+ onBlur: function onBlur(e) {
1350
+ if (e.currentTarget.contains(e.relatedTarget)) {
1351
+ return;
1352
+ }
1353
+
1354
+ _this10.handleBlur();
1355
+ },
1331
1356
  onFocus: this.handleFocus
1332
1357
  }, /*#__PURE__*/React.createElement(AgGridReact, _extends({
1333
1358
  singleClickEdit: true,
1334
1359
  suppressPaginationPanel: true,
1335
1360
  suppressCopyRowsToClipboard: true,
1361
+ suppressRowClickSelection: true,
1336
1362
  loadingOverlayComponent: this.LoadingOverlay,
1337
1363
  noRowsOverlayComponent: this.NoRowsOverlay,
1338
1364
  getMainMenuItems: this.getMainMenuItems,
@@ -1350,6 +1376,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
1350
1376
  onCellValueChanged: this.cellValueChanged,
1351
1377
  onCellEditingStopped: this.cellEditingStop,
1352
1378
  onCellFocused: this.cellFocused,
1379
+ onCellClicked: this.cellClicked,
1353
1380
  pagination: enablePagination,
1354
1381
  paginationPageSize: pageSize,
1355
1382
  columnDefs: colDefs,
@@ -6,6 +6,7 @@
6
6
  background: #fff;
7
7
 
8
8
  .@{ant-prefix}-modal-body & {
9
+ margin: -@padding-md;
9
10
  background: transparent;
10
11
  }
11
12
 
@@ -44,7 +45,6 @@
44
45
 
45
46
  &-body {
46
47
  height: 100%;
47
- padding: @padding-md 0 @padding-md @padding-md;
48
48
  overflow-x: hidden;
49
49
  }
50
50
 
@@ -154,8 +154,4 @@
154
154
  & + .@{prefixCls}-section {
155
155
  padding-top: 0;
156
156
  }
157
-
158
- .@{ant-prefix}-modal-body & {
159
- margin: -@padding-md;
160
- }
161
157
  }
@@ -1,5 +1,5 @@
1
- import type { ReactElement, ReactNode } from 'react';
2
1
  import type { ModalProps } from 'antd/lib/modal';
2
+ import type { ReactElement, ReactNode } from 'react';
3
3
  export interface BasePopupProps {
4
4
  allowClear?: boolean;
5
5
  disabled?: boolean;
@@ -26,11 +26,11 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
26
26
 
27
27
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
28
28
 
29
- import React, { useState, cloneElement, useRef, useEffect, useContext } from 'react';
30
29
  import { Modal, Input, message, ConfigProvider } from 'antd';
31
- import { prefixClassName } from "../utils";
32
- import SearchIcon from "../Icons/Search";
30
+ import React, { useState, cloneElement, useRef, useEffect, useContext } from 'react';
33
31
  import Icons from "../Icons";
32
+ import SearchIcon from "../Icons/Search";
33
+ import { prefixClassName } from "../utils";
34
34
  var prefix = prefixClassName('popup');
35
35
 
36
36
  function Popup(props) {
@@ -2,9 +2,6 @@
2
2
  cursor: pointer;
3
3
 
4
4
  &-wrapper {
5
- width: 100%;
6
- height: 100%;
7
-
8
5
  .@{ant-prefix}-input-suffix {
9
6
  position: relative;
10
7
 
@@ -7,6 +7,15 @@
7
7
  flex-direction: column;
8
8
  box-sizing: border-box;
9
9
  height: 100%;
10
+
11
+ .@{ant-prefix}-tree-list-scrollbar {
12
+ right: -@padding-md !important;
13
+ display: block !important;
14
+ }
15
+
16
+ .@{ant-prefix}-tree-list-scrollbar-thumb {
17
+ background: #ddd !important;
18
+ }
10
19
  }
11
20
 
12
21
  &-menu-popover {
@@ -114,8 +123,7 @@
114
123
  }
115
124
 
116
125
  &-footer {
117
- margin-top: 12px;
118
- padding: 0 12px;
126
+ margin-top: @padding-md;
119
127
  }
120
128
 
121
129
  &-empty {
@@ -139,6 +147,25 @@
139
147
  }
140
148
  }
141
149
 
142
- .@{prefixCls}-layout-left .@{prefixCls}-tree-wrapper:first-child .@{prefixCls}-tree-header {
143
- padding-right: 12px + @space-h;
150
+ .@{prefixCls}-layout-left {
151
+ .@{prefixCls}-tree-wrapper {
152
+ padding: @padding-md;
153
+
154
+ &:first-child .@{prefixCls}-tree-header {
155
+ margin-right: @padding-md;
156
+ }
157
+ }
158
+
159
+ .@{prefixCls}-tree-tabs {
160
+ padding: @padding-md;
161
+ }
162
+
163
+ .@{ant-prefix}-tabs-tabpane > .@{prefixCls}-tree-wrapper {
164
+ padding: 0;
165
+ }
166
+
167
+ .@{prefixCls}-tree-body {
168
+ margin-right: -@padding-md;
169
+ padding-right: @padding-md;
170
+ }
144
171
  }
@@ -459,12 +459,10 @@ export default function useBatchOperate(options) {
459
459
  var otherOpts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
460
460
  var root = document.createDocumentFragment();
461
461
  var getPrefixCls = ctx.getPrefixCls,
462
- iconPrefixCls = ctx.iconPrefixCls,
463
- locale = ctx.locale;
462
+ iconPrefixCls = ctx.iconPrefixCls;
464
463
  render( /*#__PURE__*/React.createElement(ConfigProvider, {
465
464
  prefixCls: getPrefixCls(),
466
- iconPrefixCls: iconPrefixCls,
467
- locale: locale
465
+ iconPrefixCls: iconPrefixCls
468
466
  }, /*#__PURE__*/React.createElement(BatchOperate, _extends({
469
467
  rows: rows
470
468
  }, options, otherOpts, {
package/es/index.d.ts CHANGED
@@ -4,8 +4,8 @@ export * from '@lemon-fe/utils';
4
4
  export { default as zhCN } from 'antd/es/locale/zh_CN';
5
5
  export * from './constants';
6
6
  export { default as init } from './init';
7
- export { default as BaseTable, } from './components/BaseTable';
8
- export type { BaseTableProps, ColumnsType, ColumnGroupType, ColumnType } from './components/BaseTable/typings';
7
+ export { default as BaseTable } from './components/BaseTable';
8
+ export type { BaseTableProps, ColumnsType, ColumnGroupType, ColumnType, } from './components/BaseTable/typings';
9
9
  export { default as EditableTable } from './components/EditableTable';
10
10
  export { default as EditableCell } from './components/EditableTable/EditableCell';
11
11
  export { default as EditableTableFormItem } from './components/EditableTable/EditableTableFormItem';
@@ -68,6 +68,7 @@ a[title='站长统计'] {
68
68
  @modal-header-padding-horizontal: 0;
69
69
  @modal-header-padding-vertical: 0;
70
70
  @modal-header-border-width: 0;
71
+ @modal-header-title-line-height: 24px;
71
72
  @modal-body-padding: 0;
72
73
  @modal-footer-padding-horizontal: 0;
73
74
  @modal-footer-padding-vertical: 0;
@@ -79,16 +80,16 @@ a[title='站长统计'] {
79
80
  padding: @padding-md;
80
81
  }
81
82
 
82
- .@{ant-prefix}-modal-header {
83
- margin-bottom: @padding-md;
83
+ .@{ant-prefix}-modal-confirm .@{ant-prefix}-modal-content {
84
+ padding: 20px;
84
85
  }
85
86
 
86
- .@{ant-prefix}-modal-footer {
87
- margin-top: @padding-md;
87
+ .@{ant-prefix}-modal-header {
88
+ padding-bottom: @padding-md;
88
89
  }
89
90
 
90
- .@{ant-prefix}-confirm .@{ant-prefix}-body {
91
- padding: 20px;
91
+ .@{ant-prefix}-modal-footer {
92
+ padding-top: @padding-md;
92
93
  }
93
94
 
94
95
  .@{ant-prefix}-modal-confirm-body > .anticon {
@@ -232,6 +233,7 @@ a[title='站长统计'] {
232
233
  &-indent {
233
234
  &-unit {
234
235
  width: @tree-node-indent-width;
236
+ vertical-align: top;
235
237
  }
236
238
  }
237
239
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/kits",
3
- "version": "1.0.0-136",
3
+ "version": "1.0.0-138",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",