@mjhls/mjh-framework 1.0.945-nojs-pagination-v1 → 1.0.945-nojs-pagination-v3

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.
@@ -128,7 +128,9 @@ var IssueLanding = function IssueLanding(props) {
128
128
  _props$imageHeight = props.imageHeight,
129
129
  imageHeight = _props$imageHeight === undefined ? 270 : _props$imageHeight,
130
130
  _props$imageWidth = props.imageWidth,
131
- imageWidth = _props$imageWidth === undefined ? 480 : _props$imageWidth;
131
+ imageWidth = _props$imageWidth === undefined ? 480 : _props$imageWidth,
132
+ _props$nextPagePostsC = props.nextPagePostsCount,
133
+ nextPagePostsCount = _props$nextPagePostsC === undefined ? 1 : _props$nextPagePostsC;
132
134
 
133
135
  return React__default['default'].createElement(
134
136
  'div',
@@ -162,7 +164,8 @@ var IssueLanding = function IssueLanding(props) {
162
164
  showPubInfo: showPubInfo,
163
165
  columns: 'rotate',
164
166
  variant: 'top',
165
- contentCategoryMapping: settings.contentCategoryMapping ? settings.contentCategoryMapping : []
167
+ contentCategoryMapping: settings.contentCategoryMapping ? settings.contentCategoryMapping : [],
168
+ nextPagePostsCount: nextPagePostsCount
166
169
  })
167
170
  );
168
171
  };
@@ -246,7 +246,8 @@ var MediaSeriesLanding = function MediaSeriesLanding(props) {
246
246
  pageview = props.pageview,
247
247
  currentPage = props.currentPage,
248
248
  docGroupID = props.docGroupID,
249
- parentUrl = props.parentUrl;
249
+ parentUrl = props.parentUrl,
250
+ nextPagePostsCount = props.nextPagePostsCount;
250
251
 
251
252
  var _useState7 = React.useState(false),
252
253
  _useState8 = slicedToArray._slicedToArray(_useState7, 2),
@@ -374,14 +375,15 @@ var MediaSeriesLanding = function MediaSeriesLanding(props) {
374
375
  currentPage: currentPage,
375
376
  pageview: pageview,
376
377
  autoScroll: true,
377
- seoPaginate: true
378
+ seoPaginate: true,
379
+ nextPagePostsCount: nextPagePostsCount
378
380
  })
379
381
  );
380
382
  };
381
383
 
382
384
  MediaSeriesLanding.getInitialData = function () {
383
385
  var _ref3 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee2(ctx, client, cache) {
384
- var urlQuery, pathname, identifier, itemsPerPage, currentPage, start, statusCode, params, docGroupID, seriesQuery, seriesData, allSeries, buildUsedTopicsArray, usedTopics, taxonomyFilter;
386
+ var urlQuery, pathname, identifier, itemsPerPage, currentPage, start, statusCode, params, docGroupID, seriesQuery, seriesData, nextPagePostsCount, allSeries, buildUsedTopicsArray, usedTopics, taxonomyFilter;
385
387
  return asyncToGenerator.regenerator.wrap(function _callee2$(_context2) {
386
388
  while (1) {
387
389
  switch (_context2.prev = _context2.next) {
@@ -411,9 +413,14 @@ MediaSeriesLanding.getInitialData = function () {
411
413
  case 13:
412
414
  seriesData = _context2.sent;
413
415
  _context2.next = 16;
414
- return client.fetch('*[_type == \'documentGroup\' && references(\'' + docGroupID._id + '\') && isSeries != false && isShow != false && defined(published) && dateTime(published) <= dateTime(now()) ] {\n topicMapping[]->\n }');
416
+ return client.fetch('count(' + seriesQuery + ')', _extends._extends({}, params, { from: params.to, to: params.to + itemsPerPage }));
415
417
 
416
418
  case 16:
419
+ nextPagePostsCount = _context2.sent;
420
+ _context2.next = 19;
421
+ return client.fetch('*[_type == \'documentGroup\' && references(\'' + docGroupID._id + '\') && isSeries != false && isShow != false && defined(published) && dateTime(published) <= dateTime(now()) ] {\n topicMapping[]->\n }');
422
+
423
+ case 19:
417
424
  allSeries = _context2.sent;
418
425
 
419
426
  //Take all series topicMapping and put in an array
@@ -434,10 +441,10 @@ MediaSeriesLanding.getInitialData = function () {
434
441
  };
435
442
 
436
443
  usedTopics = buildUsedTopicsArray(allSeries);
437
- _context2.next = 21;
444
+ _context2.next = 24;
438
445
  return client.fetch('\n *[_type == \'taxonomy\' && !defined(parent) && isMainTopic] | order(name asc) {\n _id,\n identifier,\n name,\n "children": *[_type == \'taxonomy\' && references(^._id)] | order(name asc){\n _id,\n name,\n identifier,\n "grandchildren": *[_type == \'taxonomy\' && references(^._id)] | order(name asc) {...}\n }\t\n }');
439
446
 
440
- case 21:
447
+ case 24:
441
448
  taxonomyFilter = _context2.sent;
442
449
 
443
450
 
@@ -478,10 +485,11 @@ MediaSeriesLanding.getInitialData = function () {
478
485
  docGroupID: docGroupID._id,
479
486
  parentUrl: identifier,
480
487
  statusCode: statusCode,
481
- docGroup: docGroupID
488
+ docGroup: docGroupID,
489
+ nextPagePostsCount: nextPagePostsCount
482
490
  });
483
491
 
484
- case 25:
492
+ case 28:
485
493
  case 'end':
486
494
  return _context2.stop();
487
495
  }
@@ -122,7 +122,9 @@ var IssueLanding = function IssueLanding(props) {
122
122
  _props$imageHeight = props.imageHeight,
123
123
  imageHeight = _props$imageHeight === undefined ? 270 : _props$imageHeight,
124
124
  _props$imageWidth = props.imageWidth,
125
- imageWidth = _props$imageWidth === undefined ? 480 : _props$imageWidth;
125
+ imageWidth = _props$imageWidth === undefined ? 480 : _props$imageWidth,
126
+ _props$nextPagePostsC = props.nextPagePostsCount,
127
+ nextPagePostsCount = _props$nextPagePostsC === undefined ? 1 : _props$nextPagePostsC;
126
128
 
127
129
  return React__default.createElement(
128
130
  'div',
@@ -156,7 +158,8 @@ var IssueLanding = function IssueLanding(props) {
156
158
  showPubInfo: showPubInfo,
157
159
  columns: 'rotate',
158
160
  variant: 'top',
159
- contentCategoryMapping: settings.contentCategoryMapping ? settings.contentCategoryMapping : []
161
+ contentCategoryMapping: settings.contentCategoryMapping ? settings.contentCategoryMapping : [],
162
+ nextPagePostsCount: nextPagePostsCount
160
163
  })
161
164
  );
162
165
  };
@@ -239,7 +239,8 @@ var MediaSeriesLanding = function MediaSeriesLanding(props) {
239
239
  pageview = props.pageview,
240
240
  currentPage = props.currentPage,
241
241
  docGroupID = props.docGroupID,
242
- parentUrl = props.parentUrl;
242
+ parentUrl = props.parentUrl,
243
+ nextPagePostsCount = props.nextPagePostsCount;
243
244
 
244
245
  var _useState7 = useState(false),
245
246
  _useState8 = _slicedToArray(_useState7, 2),
@@ -367,14 +368,15 @@ var MediaSeriesLanding = function MediaSeriesLanding(props) {
367
368
  currentPage: currentPage,
368
369
  pageview: pageview,
369
370
  autoScroll: true,
370
- seoPaginate: true
371
+ seoPaginate: true,
372
+ nextPagePostsCount: nextPagePostsCount
371
373
  })
372
374
  );
373
375
  };
374
376
 
375
377
  MediaSeriesLanding.getInitialData = function () {
376
378
  var _ref3 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(ctx, client, cache) {
377
- var urlQuery, pathname, identifier, itemsPerPage, currentPage, start, statusCode, params, docGroupID, seriesQuery, seriesData, allSeries, buildUsedTopicsArray, usedTopics, taxonomyFilter;
379
+ var urlQuery, pathname, identifier, itemsPerPage, currentPage, start, statusCode, params, docGroupID, seriesQuery, seriesData, nextPagePostsCount, allSeries, buildUsedTopicsArray, usedTopics, taxonomyFilter;
378
380
  return regenerator.wrap(function _callee2$(_context2) {
379
381
  while (1) {
380
382
  switch (_context2.prev = _context2.next) {
@@ -404,9 +406,14 @@ MediaSeriesLanding.getInitialData = function () {
404
406
  case 13:
405
407
  seriesData = _context2.sent;
406
408
  _context2.next = 16;
407
- return client.fetch('*[_type == \'documentGroup\' && references(\'' + docGroupID._id + '\') && isSeries != false && isShow != false && defined(published) && dateTime(published) <= dateTime(now()) ] {\n topicMapping[]->\n }');
409
+ return client.fetch('count(' + seriesQuery + ')', _extends({}, params, { from: params.to, to: params.to + itemsPerPage }));
408
410
 
409
411
  case 16:
412
+ nextPagePostsCount = _context2.sent;
413
+ _context2.next = 19;
414
+ return client.fetch('*[_type == \'documentGroup\' && references(\'' + docGroupID._id + '\') && isSeries != false && isShow != false && defined(published) && dateTime(published) <= dateTime(now()) ] {\n topicMapping[]->\n }');
415
+
416
+ case 19:
410
417
  allSeries = _context2.sent;
411
418
 
412
419
  //Take all series topicMapping and put in an array
@@ -427,10 +434,10 @@ MediaSeriesLanding.getInitialData = function () {
427
434
  };
428
435
 
429
436
  usedTopics = buildUsedTopicsArray(allSeries);
430
- _context2.next = 21;
437
+ _context2.next = 24;
431
438
  return client.fetch('\n *[_type == \'taxonomy\' && !defined(parent) && isMainTopic] | order(name asc) {\n _id,\n identifier,\n name,\n "children": *[_type == \'taxonomy\' && references(^._id)] | order(name asc){\n _id,\n name,\n identifier,\n "grandchildren": *[_type == \'taxonomy\' && references(^._id)] | order(name asc) {...}\n }\t\n }');
432
439
 
433
- case 21:
440
+ case 24:
434
441
  taxonomyFilter = _context2.sent;
435
442
 
436
443
 
@@ -471,10 +478,11 @@ MediaSeriesLanding.getInitialData = function () {
471
478
  docGroupID: docGroupID._id,
472
479
  parentUrl: identifier,
473
480
  statusCode: statusCode,
474
- docGroup: docGroupID
481
+ docGroup: docGroupID,
482
+ nextPagePostsCount: nextPagePostsCount
475
483
  });
476
484
 
477
- case 25:
485
+ case 28:
478
486
  case 'end':
479
487
  return _context2.stop();
480
488
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.945-nojs-pagination-v1",
3
+ "version": "1.0.945-nojs-pagination-v3",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",