@mjhls/mjh-framework 1.0.56 → 1.0.57

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,21 @@ var DeckContent = function (_React$Component) {
3899
3898
  var currentPage = _this.state.currentPage;
3900
3899
 
3901
3900
  if (seoPaginate) {
3901
+ var newPath = pageNumber === 1 ? '' + router$$1.pathname : router$$1.pathname + '?page=' + pageNumber;
3902
3902
  if (currentPage !== pageNumber) {
3903
+ console.error('currentPage:', currentPage);
3904
+ console.error('pageNumber:', pageNumber);
3903
3905
  lib_3.refresh();
3904
3906
  if (pageview) {
3905
- pageview(router$$1.asPath + '?page=' + pageNumber);
3907
+ _this.setState({
3908
+ currentPage: pageNumber
3909
+ }, function () {
3910
+ pageview(newPath);
3911
+ });
3906
3912
  }
3907
3913
  }
3908
- window.history.pushState('page' + pageNumber, '', '?page=' + pageNumber);
3914
+
3915
+ window.history.pushState(newPath, '', newPath);
3909
3916
  }
3910
3917
  }, _this.cardLoader = function (page, columns, variant) {
3911
3918
  var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
@@ -3924,12 +3931,14 @@ var DeckContent = function (_React$Component) {
3924
3931
  lgVar = 6;
3925
3932
  }
3926
3933
 
3934
+ var pageNumber = row.pageNumber || _this.state.page;
3935
+
3927
3936
  return React__default.createElement(
3928
3937
  VisibilitySensor,
3929
3938
  {
3930
3939
  key: itemCounter,
3931
3940
  onChange: function onChange(isVisible) {
3932
- isVisible && _this.changePageNumber(row.pageNumber || _this.props.currentPage);
3941
+ isVisible && _this.changePageNumber(pageNumber);
3933
3942
  } },
3934
3943
  React__default.createElement(
3935
3944
  Col,
@@ -5418,15 +5427,15 @@ var TaxonomyCard = function TaxonomyCard(props) {
5418
5427
  );
5419
5428
  };
5420
5429
 
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
-
5430
+ /*
5431
+ GROQ query -
5432
+ *[_type == "article" && references(*[_type == 'documentGroup' && name == 'test']._id)][0...10]{
5433
+ title,
5434
+ published,
5435
+ "thumbnail": thumbnail.asset->url,
5436
+ "url": url.current
5437
+ }
5438
+
5430
5439
  */
5431
5440
  var GroupDeck = function GroupDeck(props) {
5432
5441
  // Props should be an array of objects containing Thumbnail, title, and URL