@lemon-fe/kits 1.0.0-4 → 1.0.0-5

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.
@@ -9,6 +9,7 @@ export default class DataGrid<TData> extends Component<DataGridProps<TData>, {
9
9
  page: number;
10
10
  pageSize: number;
11
11
  total: number;
12
+ loading: boolean;
12
13
  }> {
13
14
  api: GridApi<any>;
14
15
  private selected;
@@ -195,7 +195,8 @@ var DataGrid = /*#__PURE__*/function (_Component) {
195
195
  });
196
196
 
197
197
  _this.state = _objectSpread({
198
- colDefs: _this.getColumDefs()
198
+ colDefs: _this.getColumDefs(),
199
+ loading: false
199
200
  }, _this.getPagination());
200
201
  _this.store = new Store({
201
202
  errors: new Map(),
@@ -665,7 +666,9 @@ var DataGrid = /*#__PURE__*/function (_Component) {
665
666
  pageSize = _this$state.pageSize;
666
667
  var columnState = this.columnApi.getColumnState();
667
668
  var id = this.requestId;
668
- this.api.showLoadingOverlay();
669
+ this.setState({
670
+ loading: true
671
+ });
669
672
  fetch({
670
673
  current: page,
671
674
  pageSize: pageSize,
@@ -678,7 +681,9 @@ var DataGrid = /*#__PURE__*/function (_Component) {
678
681
  };
679
682
  })
680
683
  }).then(function (res) {
681
- _this6.api.hideOverlay();
684
+ _this6.setState({
685
+ loading: false
686
+ });
682
687
 
683
688
  if (id !== _this6.requestId) {
684
689
  return;
@@ -710,7 +715,9 @@ var DataGrid = /*#__PURE__*/function (_Component) {
710
715
  } // 重置滚动条
711
716
 
712
717
 
713
- _this6.api.setRowData([]);
718
+ var bean = _this6.api.__getContext().getBean('ctrlsService');
719
+
720
+ bean.getGridBodyCtrl().getScrollFeature().scrollToTop();
714
721
 
715
722
  _this6.api.setPinnedBottomRowData(pinned);
716
723
 
@@ -720,7 +727,9 @@ var DataGrid = /*#__PURE__*/function (_Component) {
720
727
  onLoad(res.extra);
721
728
  }
722
729
  }).catch(function () {
723
- _this6.api.hideOverlay();
730
+ _this6.setState({
731
+ loading: false
732
+ });
724
733
  });
725
734
  }
726
735
  }
@@ -944,7 +953,8 @@ var DataGrid = /*#__PURE__*/function (_Component) {
944
953
  enablePagination = _this$state2.pagination,
945
954
  page = _this$state2.page,
946
955
  pageSize = _this$state2.pageSize,
947
- total = _this$state2.total;
956
+ total = _this$state2.total,
957
+ loading = _this$state2.loading;
948
958
  var mPage = _typeof(pagination) === 'object' ? pagination : {};
949
959
  return /*#__PURE__*/React.createElement(GridContext.Provider, {
950
960
  value: this.store
@@ -999,7 +1009,9 @@ var DataGrid = /*#__PURE__*/function (_Component) {
999
1009
  mPage.onChange(page, pageSize);
1000
1010
  }
1001
1011
  }
1002
- })))));
1012
+ }))), loading && /*#__PURE__*/React.createElement(Spin, {
1013
+ className: prefix('spin')
1014
+ })));
1003
1015
  }
1004
1016
  }]);
1005
1017
 
@@ -151,7 +151,7 @@
151
151
 
152
152
  .ag-cell-inline-editing & {
153
153
  padding: 0;
154
- box-shadow: 0 0 0 2px var(--ant-primary-5) inset;
154
+ box-shadow: 0 0 0 2px ~'var(--@{ant-prefix}-primary-5)' inset;
155
155
  }
156
156
 
157
157
  &-text {
@@ -181,7 +181,7 @@
181
181
  left: -6px;
182
182
  z-index: 10;
183
183
  border: 6px solid transparent;
184
- border-top-color: var(--ant-error-color-active);
184
+ border-top-color: ~'var(--@{ant-prefix}-error-color-active)';
185
185
  transform: rotate(135deg);
186
186
  }
187
187
 
@@ -196,6 +196,18 @@
196
196
  vertical-align: top;
197
197
  }
198
198
  }
199
+
200
+ &-spin {
201
+ position: absolute;
202
+ top: 0;
203
+ right: 0;
204
+ bottom: 0;
205
+ left: 0;
206
+ display: flex;
207
+ justify-content: center;
208
+ align-items: center;
209
+ background-color: rgba(255, 255, 255, 0.6);
210
+ }
199
211
  }
200
212
 
201
213
  .ag-theme-@{prefixCls} {
@@ -217,13 +229,13 @@
217
229
  --ag-header-column-resize-handle-color: #bbb;
218
230
  --ag-cell-horizontal-padding: 8px;
219
231
  --ag-icon-font-family: agGridAlpine;
220
- --ag-selected-row-background-color: var(--ant-primary-1);
232
+ --ag-selected-row-background-color: ~'var(--@{ant-prefix}-primary-1)';
221
233
  --ag-selected-tab-underline-width: 2px;
222
- --ag-range-selection-border-color: var(--ant-primary-5);
223
- --ag-range-selection-highlight-color: var(--ant-primary-1);
234
+ --ag-range-selection-border-color: ~'var(--@{ant-prefix}-primary-5)';
235
+ --ag-range-selection-highlight-color: ~'var(--@{ant-prefix}-primary-1)';
224
236
  --ag-checkbox-unchecked-color: #ccc;
225
237
  --ag-checkbox-background-color: var(--ag-background-color);
226
- --ag-checkbox-checked-color: var(--ant-primary-color);
238
+ --ag-checkbox-checked-color: 'var(--@{ant-prefix}-primary-color)';
227
239
  --ag-input-border-color: transparent;
228
240
  --ag-input-focus-border-color: transparent;
229
241
 
@@ -263,7 +275,7 @@
263
275
  bottom: 0;
264
276
  left: 0;
265
277
  display: block;
266
- border: 2px solid var(--ant-primary-5);
278
+ border: 2px solid ~'var(--@{ant-prefix}-primary-5)';
267
279
  border-radius: 4px;
268
280
  content: '';
269
281
  pointer-events: none;
@@ -291,7 +303,7 @@
291
303
  }
292
304
 
293
305
  .ag-tab-selected {
294
- color: var(--ant-primary-color);
306
+ color: ~'var(--@{ant-prefix}-primary-color)';
295
307
  }
296
308
 
297
309
  .ag-tabs-header {
@@ -2,6 +2,7 @@ import type { AgGridReactProps } from '@ag-grid-community/react';
2
2
  import type { ColDef, ColGroupDef, ICellRendererParams, IHeaderParams } from '@ag-grid-community/core';
3
3
  import type { RuleItem } from 'async-validator/dist-types/interface';
4
4
  import type { ReactElement, ReactNode, RefObject } from 'react';
5
+ export type { ColDef, ColGroupDef, ColumnState } from '@ag-grid-community/core';
5
6
  export declare type GetRowKey<T> = string | ((data: T) => string);
6
7
  export declare type PathType = string | (string | number)[];
7
8
  export declare type ValidateRule<T> = Pick<RuleItem, 'required' | 'message' | 'pattern' | 'min' | 'max' | 'len' | 'type'> & {
@@ -28,6 +28,7 @@ declare namespace Layout {
28
28
  children?: React.ReactNode;
29
29
  left?: React.ReactNode;
30
30
  tab?: string | undefined;
31
+ forceRender?: boolean | undefined;
31
32
  } & Pick<Props, "onCollapse">) => JSX.Element;
32
33
  }
33
34
  export default Layout;
@@ -156,7 +156,8 @@ function LayoutTabs(props) {
156
156
  var tab = tabs[index];
157
157
  return /*#__PURE__*/React.createElement(Tabs.TabPane, {
158
158
  tab: (_get = get(node, ['props', 'tab'])) !== null && _get !== void 0 ? _get : tab.title,
159
- key: (_get2 = get(node, 'key')) !== null && _get2 !== void 0 ? _get2 : getKey(tab)
159
+ key: (_get2 = get(node, 'key')) !== null && _get2 !== void 0 ? _get2 : getKey(tab),
160
+ forceRender: get(node, ['props', 'forceRender'])
160
161
  }, node);
161
162
  });
162
163
  return /*#__PURE__*/React.createElement(Layout, _extends({
@@ -32,6 +32,7 @@ interface Props extends Pick<TabsProps, 'activeKey' | 'onTabClick'> {
32
32
  tabs?: {
33
33
  title?: string;
34
34
  key: string;
35
+ forceRender?: boolean;
35
36
  }[];
36
37
  /**
37
38
  * @description body元素的样式
@@ -66,12 +66,14 @@ export default function Section(props) {
66
66
  }, mapChildren(children, function (child, index) {
67
67
  var _tabs$index = tabs[index],
68
68
  tab = _tabs$index.title,
69
- key = _tabs$index.key;
69
+ key = _tabs$index.key,
70
+ forceRender = _tabs$index.forceRender;
70
71
  return /*#__PURE__*/React.createElement(Tabs.TabPane, {
71
72
  tab: tab,
72
73
  key: key,
73
74
  className: "".concat(prefixCls, "-body"),
74
- style: bodyStyle
75
+ style: bodyStyle,
76
+ forceRender: true
75
77
  }, child);
76
78
  })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TabBar, {
77
79
  activeKey: activeKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/kits",
3
- "version": "1.0.0-4",
3
+ "version": "1.0.0-5",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",