@lemon-fe/components 1.4.21 → 1.4.22-alpha.1

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.
@@ -81,7 +81,7 @@ declare class InternalDataGrid<TData extends Record<string, any>> extends Compon
81
81
  */
82
82
  private loadingChange;
83
83
  private getDataFromServer;
84
- private pagination;
84
+ pagination(page: number, pageSize: number): void;
85
85
  private init;
86
86
  private NoRowsOverlay;
87
87
  private getMainMenuItems;
@@ -712,15 +712,11 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
712
712
  var enable = false;
713
713
  if (_typeof(pagination) === 'object') {
714
714
  enable = true;
715
- pageSize = pagination.defaultPageSize || pagination.pageSize || 20;
715
+ pageSize = pagination.defaultPageSize || pagination.pageSize || 50;
716
716
  page = pagination.defaultCurrent || pagination.current || 1;
717
717
  total = pagination.total || 0;
718
- } else if (pagination === true) {
719
- enable = true;
720
- } else if (pagination === false) {
721
- enable = false;
722
- total = Number.MAX_SAFE_INTEGER;
723
- pageSize = Number.MAX_SAFE_INTEGER;
718
+ } else if (typeof pagination === 'boolean') {
719
+ enable = pagination;
724
720
  } else if (fetch !== undefined) {
725
721
  enable = true;
726
722
  }
@@ -739,12 +735,19 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
739
735
  columns = _this$props6.columns,
740
736
  rowSelection = _this$props6.rowSelection,
741
737
  dataSource = _this$props6.dataSource,
742
- context = _this$props6.context;
738
+ context = _this$props6.context,
739
+ pagination = _this$props6.pagination;
743
740
  if (!shallowEqual(context, prevProps.context)) {
744
741
  this.store.setState({
745
742
  context: context
746
743
  });
747
744
  }
745
+ if (!shallowEqual(pagination, prevProps.pagination)) {
746
+ var pageData = this.getPagination();
747
+ this.setState({
748
+ pagination: pageData.pagination
749
+ });
750
+ }
748
751
  if (!this.isReady) {
749
752
  return;
750
753
  }
@@ -1482,13 +1485,20 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1482
1485
  }
1483
1486
  var _this$state2 = this.state,
1484
1487
  page = _this$state2.page,
1485
- pageSize = _this$state2.pageSize;
1488
+ pageSize = _this$state2.pageSize,
1489
+ pagination = _this$state2.pagination;
1486
1490
  var columnState = this.columnApi.getColumnState();
1487
1491
  var id = this.requestId;
1488
1492
  this.loadingChange(true);
1489
- fetch({
1493
+ var pageParams = {
1490
1494
  current: page,
1491
- pageSize: pageSize,
1495
+ pageSize: pageSize
1496
+ };
1497
+ if (!pagination) {
1498
+ pageParams.current = 1;
1499
+ pageParams.pageSize = Number.MAX_SAFE_INTEGER;
1500
+ }
1501
+ fetch(_objectSpread(_objectSpread({}, pageParams), {}, {
1492
1502
  sort: columnState.filter(function (item) {
1493
1503
  return item.sort !== undefined && item.sort !== null;
1494
1504
  }).map(function (item) {
@@ -1497,7 +1507,7 @@ var InternalDataGrid = /*#__PURE__*/function (_Component) {
1497
1507
  order: item.sort
1498
1508
  };
1499
1509
  })
1500
- }).then(function (res) {
1510
+ })).then(function (res) {
1501
1511
  if (id !== _this6.requestId) {
1502
1512
  return;
1503
1513
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "1.4.21",
3
+ "version": "1.4.22-alpha.1",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "registry": "https://registry.npmjs.org"
60
60
  },
61
- "gitHead": "15b71c17c9ced5731fb27139384c10ad063929d6"
61
+ "gitHead": "cd26a96e874a81673af79672cb2d3cc06ae48069"
62
62
  }