@mjhls/mjh-framework 1.0.59 → 1.0.61

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
@@ -6202,8 +6241,9 @@ var Search = function Search(_ref) {
6202
6241
  var _ref$placeholder = _ref.placeholder,
6203
6242
  placeholder = _ref$placeholder === undefined ? 'Search' : _ref$placeholder,
6204
6243
  _ref$btnText = _ref.btnText,
6205
- btnText = _ref$btnText === undefined ? 'Search' : _ref$btnText,
6206
- router$$1 = _ref.router;
6244
+ btnText = _ref$btnText === undefined ? 'Search' : _ref$btnText;
6245
+
6246
+ var router$$1 = router.useRouter();
6207
6247
 
6208
6248
  var _useState = React.useState(''),
6209
6249
  _useState2 = slicedToArray(_useState, 2),
@@ -6238,8 +6278,6 @@ var Search = function Search(_ref) {
6238
6278
  );
6239
6279
  };
6240
6280
 
6241
- var Search$1 = router.withRouter(Search);
6242
-
6243
6281
  var NavDvm = function NavDvm(props) {
6244
6282
  var logo = props.logo,
6245
6283
  mobileLogo = props.mobileLogo,
@@ -6334,7 +6372,7 @@ var NavDvm = function NavDvm(props) {
6334
6372
  }
6335
6373
  })
6336
6374
  ),
6337
- React__default.createElement(Search$1, null)
6375
+ React__default.createElement(Search, null)
6338
6376
  )
6339
6377
  )
6340
6378
  ),
@@ -10075,7 +10113,15 @@ var YouTubePlayer$1 = function YouTubePlayer(_ref) {
10075
10113
  var url = _ref.url;
10076
10114
 
10077
10115
  var id = getYoutubeId(url);
10078
- return React__default.createElement(YouTube, { videoId: id, opts: { width: '100%' } });
10116
+
10117
+ var opts = {
10118
+ width: '100%',
10119
+ playerVars: {
10120
+ rel: 0
10121
+ }
10122
+ };
10123
+
10124
+ return React__default.createElement(YouTube, { videoId: id, opts: opts });
10079
10125
  };
10080
10126
 
10081
10127
  /*
@@ -11141,5 +11187,5 @@ exports.AD300x250 = AD300x250;
11141
11187
  exports.AD300x250x600 = AD300x250x600;
11142
11188
  exports.AD728x90 = AD728x90;
11143
11189
  exports.getSerializers = getSerializers$1;
11144
- exports.Search = Search$1;
11190
+ exports.Search = Search;
11145
11191
  //# sourceMappingURL=index.js.map