@mjhls/mjh-framework 1.0.59 → 1.0.60

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
@@ -3901,13 +3901,33 @@ var DeckContent = function (_React$Component) {
3901
3901
 
3902
3902
  var path = router$$1.asPath;
3903
3903
  var qrIndex = path.indexOf('?');
3904
+ var pathname = router$$1.pathname;
3905
+ var queryString = '';
3906
+
3904
3907
  if (qrIndex > 0) {
3905
3908
  path = path.substring(1, qrIndex);
3909
+
3910
+ var partialQS = router$$1.asPath.substring(qrIndex + 1);
3911
+ var partialQSArr = partialQS.split('&');
3912
+
3913
+ // exclude page=xxx from query string
3914
+ partialQSArr.map(function (item) {
3915
+ var itemArr = item.split('=');
3916
+ var key = itemArr[0];
3917
+ var val = itemArr[1];
3918
+
3919
+ if (key !== 'page') {
3920
+ queryString += (queryString.length === 0 ? '' : '&') + key + '=' + val;
3921
+ }
3922
+ });
3923
+ }
3924
+
3925
+ if (queryString.length > 0) {
3926
+ path += '?' + queryString;
3906
3927
  }
3907
3928
 
3908
3929
  pageNumber = parseInt(pageNumber);
3909
3930
 
3910
- var newPath = pageNumber === 1 ? '' + path : '?page=' + pageNumber;
3911
3931
  if (currentPage !== pageNumber) {
3912
3932
 
3913
3933
  lib_3.refresh();
@@ -3915,12 +3935,31 @@ var DeckContent = function (_React$Component) {
3915
3935
  _this.setState({
3916
3936
  currentPage: pageNumber
3917
3937
  }, function () {
3938
+ if (path[0] !== '/') {
3939
+ path = '/' + path;
3940
+ }
3941
+
3942
+ var newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
3943
+
3944
+ // please leave this for later debug purpose : Yong Jun.
3945
+ /*console.log('page change reported', {
3946
+ currentPage: currentPage,
3947
+ pageNumber: pageNumber,
3948
+ pathname: pathname,
3949
+ path: path,
3950
+ newPath: newPath,
3951
+ firstPage: pageNumber === 1,
3952
+ queryString: queryString
3953
+ })*/
3954
+
3918
3955
  pageview(newPath);
3956
+
3957
+ router$$1.push(pathname, newPath, {
3958
+ shallow: true
3959
+ });
3919
3960
  });
3920
3961
  }
3921
3962
  }
3922
-
3923
- window.history.pushState(newPath, '', newPath);
3924
3963
  }
3925
3964
  }, _this.cardLoader = function (page, columns, variant) {
3926
3965
  var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
@@ -5435,15 +5474,15 @@ var TaxonomyCard = function TaxonomyCard(props) {
5435
5474
  );
5436
5475
  };
5437
5476
 
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
-
5477
+ /*
5478
+ GROQ query -
5479
+ *[_type == "article" && references(*[_type == 'documentGroup' && name == 'test']._id)][0...10]{
5480
+ title,
5481
+ published,
5482
+ "thumbnail": thumbnail.asset->url,
5483
+ "url": url.current
5484
+ }
5485
+
5447
5486
  */
5448
5487
  var GroupDeck = function GroupDeck(props) {
5449
5488
  // Props should be an array of objects containing Thumbnail, title, and URL