@mjhls/mjh-framework 1.0.56 → 1.0.58

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.
package/dist/index.js CHANGED
@@ -3821,7 +3821,7 @@ var DeckContent = function (_React$Component) {
3821
3821
  data: _this.data,
3822
3822
  dataKeptToCompareNewDatarecord: _this.data,
3823
3823
  per: _this.params ? _this.params.to : 2,
3824
- page: 1,
3824
+ page: _this.props.currentPage || 1,
3825
3825
  from: _this.params ? _this.params.from : 0,
3826
3826
  to: _this.params ? _this.params.to : 2,
3827
3827
  total_pages: null,
@@ -3839,17 +3839,16 @@ var DeckContent = function (_React$Component) {
3839
3839
  return {
3840
3840
  page: page + 1,
3841
3841
  from: from + per,
3842
- to: to + per,
3843
- currentPage: currentPage + 1
3842
+ to: to + per
3844
3843
  };
3845
3844
  }, _this.loadData);
3846
- }, 500), _this.loadData = function () {
3845
+ }, 0), _this.loadData = function () {
3847
3846
  var _this$state = _this.state,
3848
3847
  from = _this$state.from,
3849
3848
  to = _this$state.to,
3850
3849
  data = _this$state.data,
3851
3850
  query = _this$state.query,
3852
- currentPage = _this$state.currentPage;
3851
+ page = _this$state.page;
3853
3852
  var client = _this.props.client;
3854
3853
 
3855
3854
 
@@ -3863,7 +3862,7 @@ var DeckContent = function (_React$Component) {
3863
3862
  }
3864
3863
  dataArr = dataArr.map(function (item) {
3865
3864
  return _extends({}, item, {
3866
- pageNumber: currentPage
3865
+ pageNumber: page
3867
3866
  });
3868
3867
  });
3869
3868
 
@@ -3899,13 +3898,29 @@ var DeckContent = function (_React$Component) {
3899
3898
  var currentPage = _this.state.currentPage;
3900
3899
 
3901
3900
  if (seoPaginate) {
3901
+
3902
+ var path = router$$1.asPath;
3903
+ var qrIndex = path.indexOf('?');
3904
+ if (qrIndex > 0) {
3905
+ path = path.substring(1, qrIndex);
3906
+ }
3907
+
3908
+ pageNumber = parseInt(pageNumber);
3909
+
3910
+ var newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
3902
3911
  if (currentPage !== pageNumber) {
3912
+
3903
3913
  lib_3.refresh();
3904
3914
  if (pageview) {
3905
- pageview(router$$1.asPath + '?page=' + pageNumber);
3915
+ _this.setState({
3916
+ currentPage: pageNumber
3917
+ }, function () {
3918
+ pageview(newPath);
3919
+ });
3906
3920
  }
3907
3921
  }
3908
- window.history.pushState('page' + pageNumber, '', '?page=' + pageNumber);
3922
+
3923
+ window.history.pushState(newPath, '', newPath);
3909
3924
  }
3910
3925
  }, _this.cardLoader = function (page, columns, variant) {
3911
3926
  var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
@@ -3924,12 +3939,14 @@ var DeckContent = function (_React$Component) {
3924
3939
  lgVar = 6;
3925
3940
  }
3926
3941
 
3942
+ var pageNumber = row.pageNumber || _this.state.page;
3943
+
3927
3944
  return React__default.createElement(
3928
3945
  VisibilitySensor,
3929
3946
  {
3930
3947
  key: itemCounter,
3931
3948
  onChange: function onChange(isVisible) {
3932
- isVisible && _this.changePageNumber(row.pageNumber || _this.props.currentPage);
3949
+ isVisible && _this.changePageNumber(pageNumber);
3933
3950
  } },
3934
3951
  React__default.createElement(
3935
3952
  Col,
@@ -5418,15 +5435,15 @@ var TaxonomyCard = function TaxonomyCard(props) {
5418
5435
  );
5419
5436
  };
5420
5437
 
5421
- /*
5422
- GROQ query -
5423
- *[_type == "article" && references(*[_type == 'documentGroup' && name == 'test']._id)][0...10]{
5424
- title,
5425
- published,
5426
- "thumbnail": thumbnail.asset->url,
5427
- "url": url.current
5428
- }
5429
-
5438
+ /*
5439
+ GROQ query -
5440
+ *[_type == "article" && references(*[_type == 'documentGroup' && name == 'test']._id)][0...10]{
5441
+ title,
5442
+ published,
5443
+ "thumbnail": thumbnail.asset->url,
5444
+ "url": url.current
5445
+ }
5446
+
5430
5447
  */
5431
5448
  var GroupDeck = function GroupDeck(props) {
5432
5449
  // Props should be an array of objects containing Thumbnail, title, and URL