@lemon-fe/kits 1.0.0-193 → 1.0.0-195

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.
@@ -667,9 +667,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
667
667
  key: "componentDidMount",
668
668
  value: function () {
669
669
  var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
670
- var _this2 = this;
671
-
672
- var _this$props5, customColumnPanelStorage, autoLoad, done, data;
670
+ var _this$props5, customColumnPanelStorage, autoLoad, state, data;
673
671
 
674
672
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
675
673
  while (1) {
@@ -678,16 +676,14 @@ var DataGrid = /*#__PURE__*/function (_Component) {
678
676
  window.addEventListener('blur', this.handleFocus);
679
677
  _this$props5 = this.props, customColumnPanelStorage = _this$props5.customColumnPanelStorage, autoLoad = _this$props5.autoLoad;
680
678
 
681
- done = function done() {
682
- if (_this2.isClientMode()) {
683
- _this2.syncRowData();
684
- } else if (autoLoad) {
685
- _this2.getDataFromServer();
686
- }
687
- };
679
+ if (this.isClientMode()) {
680
+ this.syncRowData();
681
+ } else if (autoLoad) {
682
+ this.getDataFromServer();
683
+ }
688
684
 
689
685
  if (!customColumnPanelStorage) {
690
- _context3.next = 18;
686
+ _context3.next = 19;
691
687
  break;
692
688
  }
693
689
 
@@ -703,11 +699,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
703
699
 
704
700
  if (data) {
705
701
  this.fields = data.fields;
706
- this.afterReady(function () {
707
- _this2.updateColumnDefs(data.columState);
708
- });
709
- } else {
710
- this.updateColumnDefs();
702
+ state = data.columState;
711
703
  }
712
704
 
713
705
  _context3.next = 15;
@@ -719,15 +711,15 @@ var DataGrid = /*#__PURE__*/function (_Component) {
719
711
  console.log('获取列定制失败', _context3.t0.message);
720
712
 
721
713
  case 15:
714
+ this.updateColumnDefs(state);
722
715
  this.setState({
723
716
  loading: false
724
717
  });
725
718
  _context3.next = 20;
726
719
  break;
727
720
 
728
- case 18:
721
+ case 19:
729
722
  this.updateColumnDefs();
730
- done();
731
723
 
732
724
  case 20:
733
725
  case "end":
@@ -799,18 +791,18 @@ var DataGrid = /*#__PURE__*/function (_Component) {
799
791
  }, {
800
792
  key: "syncSelection",
801
793
  value: function syncSelection() {
802
- var _this3 = this;
794
+ var _this2 = this;
803
795
 
804
796
  this.afterReady(function () {
805
- var _this3$props$rowSelec = _this3.props.rowSelection;
806
- _this3$props$rowSelec = _this3$props$rowSelec === void 0 ? {} : _this3$props$rowSelec;
807
- var selectedRowKeys = _this3$props$rowSelec.selectedRowKeys;
797
+ var _this2$props$rowSelec = _this2.props.rowSelection;
798
+ _this2$props$rowSelec = _this2$props$rowSelec === void 0 ? {} : _this2$props$rowSelec;
799
+ var selectedRowKeys = _this2$props$rowSelec.selectedRowKeys;
808
800
 
809
- if (selectedRowKeys !== undefined && !_this3.selected.isSameKeys(selectedRowKeys)) {
801
+ if (selectedRowKeys !== undefined && !_this2.selected.isSameKeys(selectedRowKeys)) {
810
802
  var newSelected = new Map();
811
803
 
812
- _this3.selected.forEach(function (id) {
813
- var node = _this3.api.getRowNode(id);
804
+ _this2.selected.forEach(function (id) {
805
+ var node = _this2.api.getRowNode(id);
814
806
 
815
807
  if (node !== undefined) {
816
808
  node.setSelected(false, false, true);
@@ -818,7 +810,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
818
810
  });
819
811
 
820
812
  selectedRowKeys.forEach(function (id) {
821
- var node = _this3.api.getRowNode(id);
813
+ var node = _this2.api.getRowNode(id);
822
814
 
823
815
  var data;
824
816
 
@@ -827,12 +819,12 @@ var DataGrid = /*#__PURE__*/function (_Component) {
827
819
  data = node.data;
828
820
  }
829
821
 
830
- newSelected.set(id, data || _this3.selected.get(id) || null);
822
+ newSelected.set(id, data || _this2.selected.get(id) || null);
831
823
  });
832
824
 
833
- _this3.selected.clone(newSelected);
825
+ _this2.selected.clone(newSelected);
834
826
 
835
- _this3.api.dispatchEvent({
827
+ _this2.api.dispatchEvent({
836
828
  type: 'selectionChanged'
837
829
  });
838
830
  }
@@ -841,7 +833,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
841
833
  }, {
842
834
  key: "syncRowData",
843
835
  value: function syncRowData() {
844
- var _this4 = this;
836
+ var _this3 = this;
845
837
 
846
838
  var dataSource = this.props.dataSource;
847
839
 
@@ -856,8 +848,8 @@ var DataGrid = /*#__PURE__*/function (_Component) {
856
848
  total: dataSource.length,
857
849
  page: newPage
858
850
  }, function () {
859
- if (newPage !== page && _this4.isClientMode()) {
860
- _this4.api.paginationGoToPage(newPage - 1);
851
+ if (newPage !== page && _this3.isClientMode()) {
852
+ _this3.api.paginationGoToPage(newPage - 1);
861
853
  }
862
854
  });
863
855
  }
@@ -865,36 +857,41 @@ var DataGrid = /*#__PURE__*/function (_Component) {
865
857
  }, {
866
858
  key: "updateColumnDefs",
867
859
  value: function updateColumnDefs(state) {
860
+ var _this4 = this;
861
+
868
862
  var _this$getColumnDefs = this.getColumnDefs(),
869
863
  _this$getColumnDefs2 = _slicedToArray(_this$getColumnDefs, 2),
870
864
  defs = _this$getColumnDefs2[0],
871
865
  leafColIds = _this$getColumnDefs2[1];
872
866
 
873
- this.api.setColumnDefs(defs);
867
+ this.afterReady(function () {
868
+ _this4.api.setColumnDefs(defs);
874
869
 
875
- if (state) {
876
- var newState = _toConsumableArray(state);
870
+ if (state) {
871
+ var newState = _toConsumableArray(state);
877
872
 
878
- leafColIds.forEach(function (colId, index) {
879
- if (!colId) {
880
- return;
881
- }
873
+ leafColIds.forEach(function (colId, index) {
874
+ if (!colId) {
875
+ return;
876
+ }
882
877
 
883
- var idx = state.findIndex(function (item) {
884
- return item.colId === colId;
878
+ var idx = state.findIndex(function (item) {
879
+ return item.colId === colId;
880
+ });
881
+
882
+ if (idx < 0) {
883
+ newState.splice(index, 0, {
884
+ colId: colId
885
+ });
886
+ }
885
887
  });
886
888
 
887
- if (idx < 0) {
888
- newState.splice(index, 0, {
889
- colId: colId
890
- });
891
- }
892
- });
893
- this.columnApi.applyColumnState({
894
- state: newState,
895
- applyOrder: true
896
- });
897
- }
889
+ _this4.columnApi.applyColumnState({
890
+ state: newState,
891
+ applyOrder: true
892
+ });
893
+ }
894
+ });
898
895
  }
899
896
  }, {
900
897
  key: "getColumnDefs",
@@ -1802,6 +1799,7 @@ var DataGrid = /*#__PURE__*/function (_Component) {
1802
1799
  suppressClipboardPaste: true,
1803
1800
  enableCellEditingOnBackspace: true,
1804
1801
  maintainColumnOrder: true,
1802
+ suppressCsvExport: true,
1805
1803
  noRowsOverlayComponent: this.NoRowsOverlay,
1806
1804
  getMainMenuItems: this.getMainMenuItems,
1807
1805
  rowBuffer: 20,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/kits",
3
- "version": "1.0.0-193",
3
+ "version": "1.0.0-195",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",