@lemon-fe/kits 1.0.0-80 → 1.0.0-82

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.
@@ -61,6 +61,7 @@ export default class DataGrid<TData extends Record<string, any>> extends Compone
61
61
  private getPagination;
62
62
  componentDidUpdate(prevProps: DataGridProps<TData>): void;
63
63
  componentWillUnmount(): void;
64
+ componentDidMount(): void;
64
65
  private syncColRender;
65
66
  private syncSelection;
66
67
  private syncRowData;
@@ -219,6 +219,12 @@ var DataGrid = /*#__PURE__*/function (_Component) {
219
219
  });
220
220
  });
221
221
 
222
+ _defineProperty(_assertThisInitialized(_this), "NoRowsOverlay", function () {
223
+ return /*#__PURE__*/React.createElement(Empty, {
224
+ description: _this.props.emptyText
225
+ });
226
+ });
227
+
222
228
  _defineProperty(_assertThisInitialized(_this), "getRowId", function (params) {
223
229
  var rowKey = _this.props.rowKey;
224
230
  var result = typeof rowKey === 'function' ? rowKey(params.data) : get(params.data, rowKey);
@@ -438,6 +444,12 @@ var DataGrid = /*#__PURE__*/function (_Component) {
438
444
  key: "componentWillUnmount",
439
445
  value: function componentWillUnmount() {
440
446
  this.isReady = false;
447
+ window.removeEventListener('blur', this.handleFocus);
448
+ }
449
+ }, {
450
+ key: "componentDidMount",
451
+ value: function componentDidMount() {
452
+ window.addEventListener('blur', this.handleFocus);
441
453
  }
442
454
  }, {
443
455
  key: "syncColRender",
@@ -830,6 +842,12 @@ var DataGrid = /*#__PURE__*/function (_Component) {
830
842
 
831
843
  _this4.api.forEachNode(function (node) {
832
844
  if (node.id && _this4.selected.has(node.id)) {
845
+ var rowData = _this4.selected.get(node.id);
846
+
847
+ if (node.data !== undefined && rowData !== node.data) {
848
+ _this4.selected.set(node.id, node.data);
849
+ }
850
+
833
851
  node.setSelected(true, false, true);
834
852
  }
835
853
  });
@@ -908,7 +926,9 @@ var DataGrid = /*#__PURE__*/function (_Component) {
908
926
 
909
927
  _this5.api.setPinnedBottomRowData(pinned);
910
928
 
911
- _this5.api.ensureIndexVisible(0);
929
+ if (res.data.length > 0) {
930
+ _this5.api.ensureIndexVisible(0);
931
+ }
912
932
 
913
933
  if (onLoad) {
914
934
  onLoad(res.extra);
@@ -945,11 +965,6 @@ var DataGrid = /*#__PURE__*/function (_Component) {
945
965
  value: function LoadingOverlay() {
946
966
  return /*#__PURE__*/React.createElement(Spin, null);
947
967
  }
948
- }, {
949
- key: "NoRowsOverlay",
950
- value: function NoRowsOverlay() {
951
- return /*#__PURE__*/React.createElement(Empty, null);
952
- }
953
968
  }, {
954
969
  key: "getMainMenuItems",
955
970
  value: function getMainMenuItems(params) {
@@ -151,12 +151,13 @@
151
151
  padding: 2px;
152
152
  }
153
153
 
154
- .ag-row-inline-editing & {
154
+ .ag-row-focus &,
155
+ .ag-row-hover & {
155
156
  background-color: #fff;
156
157
  box-shadow: 0 0 0 2px var(--ag-border-color) inset;
157
158
  }
158
159
 
159
- .ag-cell-inline-editing & {
160
+ .ag-cell-focus & {
160
161
  padding: 0;
161
162
  box-shadow: 0 0 0 2px ~'var(--@{ant-prefix}-primary-5)' inset;
162
163
  }
@@ -159,4 +159,8 @@ export interface DataGridProps<TData> extends Omit<AgGridReactProps<TData>, 'row
159
159
  * @description 封装后的master-detail使用方式,传了这个参数默认开启master-detai,仅当context和data改变才会重新渲染
160
160
  */
161
161
  detailCell?: DetailCell<TData, any>;
162
+ /**
163
+ * @description 没有行数据时显示的文本
164
+ */
165
+ emptyText?: string;
162
166
  }
@@ -251,10 +251,10 @@ export var Selection = /*#__PURE__*/function () {
251
251
  }();
252
252
  export var columnTypes = {
253
253
  datetime: {
254
- initialWidth: 150
254
+ initialWidth: 159
255
255
  },
256
256
  date: {
257
- initialWidth: 120,
257
+ initialWidth: 129,
258
258
  valueFormatter: function valueFormatter(_ref) {
259
259
  var value = _ref.value;
260
260
 
@@ -16,7 +16,13 @@ export interface BasePopupProps {
16
16
  * 当作为modal使用,请不要传入onOk方法,通过open以及onCancel来控制Modal是否显示
17
17
  */
18
18
  modal?: boolean;
19
+ open?: boolean;
19
20
  readOnly?: boolean;
21
+ /**
22
+ *
23
+ * @description 非modal模式,打开Modal之前
24
+ */
25
+ beforeOpen?: () => boolean;
20
26
  }
21
27
  export interface PopupProps<ValueType> extends BasePopupProps, Omit<ModalProps, 'children' | 'onCancel'> {
22
28
  value?: ValueType;
@@ -38,11 +44,6 @@ export interface PopupProps<ValueType> extends BasePopupProps, Omit<ModalProps,
38
44
  * @description 确认事件之前校验
39
45
  */
40
46
  beforeOkCheck?: (value?: ValueType) => boolean | PromiseLike<boolean>;
41
- /**
42
- *
43
- * @description 非modal模式,打开Modal之前
44
- */
45
- beforeOpen?: () => boolean;
46
47
  children?: ReactElement | null | ((props: {
47
48
  value?: ValueType;
48
49
  disabled?: boolean;
@@ -53,7 +54,6 @@ export interface PopupProps<ValueType> extends BasePopupProps, Omit<ModalProps,
53
54
  * @description 清空后的值
54
55
  */
55
56
  emptyValue?: ValueType;
56
- open?: boolean;
57
57
  autoFocus?: boolean;
58
58
  onCancel?: () => void;
59
59
  renderFooter?: (params: {
package/es/index.d.ts CHANGED
@@ -21,7 +21,7 @@ export { default as DurationPicker } from './components/DurationPicker';
21
21
  export type { DurationPickerValue } from './components/DurationPicker';
22
22
  export { default as ColorPicker } from './components/ColorPicker';
23
23
  export { default as Popup } from './components/Popup';
24
- export type { BasePopupProps } from './components/Popup';
24
+ export type { BasePopupProps, PopupProps } from './components/Popup';
25
25
  export { default as SiderTree } from './components/SiderTree';
26
26
  export type { TreeData } from './components/SiderTree/typings';
27
27
  export { default as Icons } from './components/Icons';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/kits",
3
- "version": "1.0.0-80",
3
+ "version": "1.0.0-82",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",