@mjhls/mjh-framework 1.0.660 → 1.0.662

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/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # mjh-framework v. 1.0.660
2
+ # mjh-framework v. 1.0.662
3
3
 
4
4
  > Foundation Framework
5
5
 
@@ -45,7 +45,7 @@ require('./GroupDeck.js');
45
45
  require('react-bootstrap');
46
46
  var Button = _interopDefault(require('react-bootstrap/Button'));
47
47
  var index$3 = require('./index-5be2866f.js');
48
- var getSerializers = require('./index-47e709f6.js');
48
+ var getSerializers = require('./index-2831c002.js');
49
49
  require('./util-f2c1b65b.js');
50
50
  require('./brightcove-react-player-loader.es-156bd4d6.js');
51
51
  require('react-bootstrap/Pagination');
@@ -68,23 +68,23 @@ var MasterDeck = function (_React$Component) {
68
68
  from: _this.params ? _this.params.from : 0,
69
69
  to: _this.params ? _this.params.to : 2,
70
70
  total_pages: null,
71
- scrolling: true,
71
+ scrolling: false,
72
72
  query: _this.query,
73
73
  currentPage: _this.props.currentPage || 1,
74
- dataRemapped: false,
74
+ dataRemapped: !_this.props.showBI || !_this.props.brandInsightAd,
75
75
  lastDataSize: _this.data ? _this.data.length : 0,
76
76
  itemsPerPage: _this.params ? _this.params.to - _this.params.from : 2
77
77
  }, _this.loadMore = debounce.debounce_1(function () {
78
78
  _this.setState(function (state) {
79
79
  var page = state.page,
80
80
  from = state.from,
81
- per = state.per,
82
- to = state.to;
81
+ to = state.to,
82
+ itemsPerPage = state.itemsPerPage;
83
83
 
84
84
  return {
85
85
  page: page + 1,
86
- from: from + per,
87
- to: to + per
86
+ from: from + itemsPerPage,
87
+ to: to + itemsPerPage
88
88
  };
89
89
  }, _this.loadData);
90
90
  }, 0), _this.loadData = function () {
@@ -99,7 +99,7 @@ var MasterDeck = function (_React$Component) {
99
99
  dataHandler = _this$props.dataHandler;
100
100
 
101
101
 
102
- var params = _extends._extends({}, _this.props.params, { from: from, to: to });
102
+ var params = _extends._extends({}, _this.props.params, { from: from, to: to + 1 });
103
103
 
104
104
  if (dataHandler) {
105
105
  var dataHandlerPromise = new asyncToGenerator._Promise(function (resolve, reject) {
@@ -123,31 +123,61 @@ var MasterDeck = function (_React$Component) {
123
123
  var pointer = _this.pointer;
124
124
  dataArr = dataArr[_this.pointerArray][pointer];
125
125
  }
126
- dataArr = dataArr.map(function (item) {
127
- return _extends._extends({}, item, {
128
- pageNumber: page
126
+
127
+ if (dataArr && dataArr.length > 0) {
128
+ var itemsPerPage = _this.state.itemsPerPage;
129
+
130
+ var scrolling = dataArr.length === itemsPerPage + 1;
131
+ dataArr = dataArr.slice(0, itemsPerPage).map(function (item) {
132
+ return _extends._extends({}, item, {
133
+ pageNumber: page
134
+ });
129
135
  });
130
- });
131
136
 
132
- _this.setState(function () {
133
- if (dataArr.length > 0) {
134
- return {
135
- data: [].concat(toConsumableArray._toConsumableArray(data), toConsumableArray._toConsumableArray(dataArr)),
136
- lastDataSize: dataArr.length,
137
- scrolling: true
138
- };
139
- } else {
140
- return {
141
- scrolling: false,
142
- lastDataSize: 0
143
- };
144
- }
145
- });
146
- }, _this.changePageNumber = function (pageNumber) {
137
+ _this.setState({
138
+ data: [].concat(toConsumableArray._toConsumableArray(data), toConsumableArray._toConsumableArray(dataArr)),
139
+ lastDataSize: dataArr.length,
140
+ scrolling: scrolling
141
+ });
142
+ } else {
143
+ _this.setState({
144
+ scrolling: false,
145
+ lastDataSize: 0
146
+ });
147
+ }
148
+ }, _this.checkMoreDataAvailable = function () {
149
+ debugger;
150
+ var _this$state2 = _this.state,
151
+ from = _this$state2.from,
152
+ itemsPerPage = _this$state2.itemsPerPage,
153
+ query = _this$state2.query;
147
154
  var _this$props2 = _this.props,
148
- seoPaginate = _this$props2.seoPaginate,
149
- pageview = _this$props2.pageview,
150
- router = _this$props2.router;
155
+ client = _this$props2.client,
156
+ dataHandler = _this$props2.dataHandler;
157
+
158
+ var params = _extends._extends({}, _this.props.params, { from: from + itemsPerPage, to: from + itemsPerPage + 1 });
159
+ if (dataHandler) {
160
+ var dataHandlerPromise = new asyncToGenerator._Promise(function (resolve, reject) {
161
+ try {
162
+ var result = dataHandler(params);
163
+ resolve(result);
164
+ } catch (e) {
165
+ reject(e);
166
+ }
167
+ });
168
+ dataHandlerPromise.then(function (dataArr) {
169
+ if (dataArr && dataArr.length > 0) _this.setState({ scrolling: true });else _this.setState({ scrolling: false });
170
+ });
171
+ } else {
172
+ client.fetch(query, params).then(function (dataArr) {
173
+ if (dataArr && dataArr.length > 0) _this.setState({ scrolling: true });else _this.setState({ scrolling: false });
174
+ });
175
+ }
176
+ }, _this.changePageNumber = function (pageNumber) {
177
+ var _this$props3 = _this.props,
178
+ seoPaginate = _this$props3.seoPaginate,
179
+ pageview = _this$props3.pageview,
180
+ router = _this$props3.router;
151
181
  var currentPage = _this.state.currentPage;
152
182
 
153
183
  if (seoPaginate) {
@@ -225,9 +255,6 @@ var MasterDeck = function (_React$Component) {
225
255
  var insertBrandInsightAd = function insertBrandInsightAd(arr, index, newElement) {
226
256
  return [].concat(toConsumableArray._toConsumableArray(arr.slice(0, index)), [newElement], toConsumableArray._toConsumableArray(arr.slice(index)));
227
257
  };
228
- _this.componentDidMount = function () {
229
- _this.setState({ dataRemapped: !showBI || !brandInsightAd ? true : false });
230
- };
231
258
  // Need to pass flag "lgInfeedAd={true}" along with brandInsightAd from site level for large infeed-ad to render
232
259
  // Checking lgInfeedAd flag in desktop view ( window >= 1400px ).
233
260
  // Integrating large infeed AD
@@ -372,10 +399,10 @@ var MasterDeck = function (_React$Component) {
372
399
  rightItems[i].component
373
400
  );
374
401
  }, _this.renderManualPagination = function () {
375
- var _this$state2 = _this.state,
376
- currentPage = _this$state2.currentPage,
377
- itemsPerPage = _this$state2.itemsPerPage,
378
- lastDataSize = _this$state2.lastDataSize;
402
+ var _this$state3 = _this.state,
403
+ currentPage = _this$state3.currentPage,
404
+ itemsPerPage = _this$state3.itemsPerPage,
405
+ lastDataSize = _this$state3.lastDataSize;
379
406
 
380
407
  console.log('lastDataSize:', lastDataSize);
381
408
  console.log('itemsPerPage:', itemsPerPage);
@@ -426,7 +453,11 @@ var MasterDeck = function (_React$Component) {
426
453
  }, {
427
454
  key: 'componentDidMount',
428
455
  value: function componentDidMount() {
429
- // this.loadData();
456
+ var _state = this.state,
457
+ data = _state.data,
458
+ itemsPerPage = _state.itemsPerPage;
459
+
460
+ if (!(data.length < itemsPerPage)) this.checkMoreDataAvailable();
430
461
  }
431
462
  // Passing 'brandInsightAd','showBI' and 'lgInfeedAd'
432
463
 
@@ -482,7 +513,16 @@ var MasterDeck = function (_React$Component) {
482
513
  'button',
483
514
  {
484
515
  className: 'btn',
485
- style: { margin: '0 auto 2rem', display: 'block', fontSize: '18px', padding: '.5rem 1.5rem', boxShadow: '1px 2px 4px 4px rgba(0,0,0,.15)', background: 'var(--primary)', color: '#fff', borderRadius: '5px' },
516
+ style: {
517
+ margin: '0 auto 2rem',
518
+ display: 'block',
519
+ fontSize: '18px',
520
+ padding: '.5rem 1.5rem',
521
+ boxShadow: '1px 2px 4px 4px rgba(0,0,0,.15)',
522
+ background: 'var(--primary)',
523
+ color: '#fff',
524
+ borderRadius: '5px'
525
+ },
486
526
  onClick: function onClick(e) {
487
527
  _this3.loadMore();
488
528
  } },
@@ -52,7 +52,7 @@ require('./GroupDeck.js');
52
52
  require('react-bootstrap');
53
53
  var QueueDeckExpanded = require('./QueueDeckExpanded.js');
54
54
  require('react-bootstrap/Button');
55
- var getSerializers = require('./index-47e709f6.js');
55
+ var getSerializers = require('./index-2831c002.js');
56
56
  require('./util-f2c1b65b.js');
57
57
  require('./brightcove-react-player-loader.es-156bd4d6.js');
58
58
  require('react-bootstrap/Pagination');
package/dist/cjs/View.js CHANGED
@@ -47,7 +47,7 @@ require('react-bootstrap');
47
47
  var Button = _interopDefault(require('react-bootstrap/Button'));
48
48
  var defineProperty$1 = require('./defineProperty-55548b25.js');
49
49
  var Form = _interopDefault(require('react-bootstrap/Form'));
50
- var getSerializers = require('./index-47e709f6.js');
50
+ var getSerializers = require('./index-2831c002.js');
51
51
  require('./util-f2c1b65b.js');
52
52
  require('./brightcove-react-player-loader.es-156bd4d6.js');
53
53
  require('react-bootstrap/Pagination');
@@ -40,7 +40,7 @@ require('./smoothscroll-95231a70.js');
40
40
  require('./GroupDeck.js');
41
41
  require('react-bootstrap');
42
42
  require('react-bootstrap/Button');
43
- var getSerializers = require('./index-47e709f6.js');
43
+ var getSerializers = require('./index-2831c002.js');
44
44
  require('./util-f2c1b65b.js');
45
45
  require('./brightcove-react-player-loader.es-156bd4d6.js');
46
46
  require('react-bootstrap/Pagination');
@@ -8391,29 +8391,31 @@ var ArticleSeries = function ArticleSeries(_ref) {
8391
8391
  );
8392
8392
  };
8393
8393
 
8394
- function useOutsideAlerter(ref, container, setOpenImg, setOpenImgSrc) {
8395
- React.useEffect(function () {
8396
- function handleClickOutside(event) {
8397
- if (ref.current && !ref.current.contains(event.target) && container.current && container.current.className.includes('open')) {
8398
- setOpenImgSrc('');
8399
- setOpenImg(false);
8400
- }
8394
+ var LightBox = function LightBox(_ref) {
8395
+ var showLightbox = _ref.showLightbox,
8396
+ lightboxImgSrc = _ref.lightboxImgSrc,
8397
+ closeLightbox = _ref.closeLightbox;
8398
+
8399
+ var lightboxImage = React.useRef(null);
8400
+ var lightboxContainer = React.useRef(null);
8401
+
8402
+ var handleClickOutside = React.useCallback(function (event) {
8403
+ if (lightboxImage.current && !lightboxImage.current.contains(event.target) && lightboxContainer.current && lightboxContainer.current.className.includes('open')) {
8404
+ closeLightbox();
8401
8405
  }
8406
+ }, [lightboxImage, lightboxContainer]);
8407
+
8408
+ React.useEffect(function () {
8402
8409
  document.addEventListener('mousedown', handleClickOutside);
8403
8410
  return function () {
8404
8411
  document.removeEventListener('mousedown', handleClickOutside);
8405
8412
  };
8406
- }, [ref]);
8407
- }
8413
+ }, [handleClickOutside]);
8408
8414
 
8409
- var renderLightbox = function renderLightbox(openImg, openImgSrc, setOpenImg, setOpenImgSrc) {
8410
- var lightboxImage = React.useRef(null);
8411
- var lightboxContainer = React.useRef(null);
8412
- useOutsideAlerter(lightboxImage, lightboxContainer, setOpenImg, setOpenImgSrc);
8413
8415
  return React__default.createElement(
8414
8416
  'div',
8415
- { ref: lightboxContainer, className: 'lightbox-target ' + (openImg ? 'open' : 'close') },
8416
- React__default.createElement('img', { ref: lightboxImage, src: openImgSrc }),
8417
+ { ref: lightboxContainer, className: 'lightbox-target ' + (showLightbox ? 'open' : 'close') },
8418
+ React__default.createElement('img', { ref: lightboxImage, src: lightboxImgSrc }),
8417
8419
  React__default.createElement(
8418
8420
  'style',
8419
8421
  { jsx: 'true' },
@@ -8436,40 +8438,16 @@ var compareProps = function compareProps(prevProps, nextProps) {
8436
8438
  var FigureComponent = function FigureComponent(props) {
8437
8439
  var _useState = React.useState(false),
8438
8440
  _useState2 = slicedToArray._slicedToArray(_useState, 2),
8439
- openImg = _useState2[0],
8440
- setOpenImg = _useState2[1];
8441
+ showLightbox = _useState2[0],
8442
+ setShowLightbox = _useState2[1];
8441
8443
 
8442
8444
  var _useState3 = React.useState(''),
8443
8445
  _useState4 = slicedToArray._slicedToArray(_useState3, 2),
8444
- openImgSrc = _useState4[0],
8445
- setOpenImgSrc = _useState4[1];
8446
+ lightboxImgSrc = _useState4[0],
8447
+ setLightboxImgSrc = _useState4[1];
8446
8448
 
8447
8449
  if (typeof window === 'undefined') return null;
8448
8450
 
8449
- React.useEffect(function () {
8450
- var lightboxCaptions = document.querySelectorAll('.lightbox-caption');
8451
- if (lightboxCaptions && lightboxCaptions.length > 0) {
8452
- lightboxCaptions.forEach(function (mediaLink) {
8453
- var prevSibling = mediaLink.previousSibling;
8454
- if (prevSibling && prevSibling.textContent && prevSibling.textContent !== '') {
8455
- prevSibling.style.display = 'inline';
8456
- prevSibling.style.paddingRight = '0';
8457
- prevSibling.style.marginRight = '0';
8458
- }
8459
- var nextSibling = mediaLink.nextSibling;
8460
- nextSibling.remove();
8461
- var parentNode = mediaLink.parentNode;
8462
- parentNode.appendChild(nextSibling);
8463
- nextSibling = mediaLink.nextSibling;
8464
- if (nextSibling && nextSibling.textContent && nextSibling.textContent !== '') {
8465
- nextSibling.style.display = 'inline';
8466
- nextSibling.style.paddingLeft = '0';
8467
- nextSibling.style.marginLeft = '0';
8468
- }
8469
- });
8470
- }
8471
- }, []);
8472
-
8473
8451
  var node = props.node,
8474
8452
  client = props.client;
8475
8453
 
@@ -8485,9 +8463,7 @@ var FigureComponent = function FigureComponent(props) {
8485
8463
  _node$class_name = node.class_name,
8486
8464
  class_name = _node$class_name === undefined ? 'd-block' : _node$class_name,
8487
8465
  _node$disableTextWrap = node.disableTextWrap,
8488
- disableTextWrap = _node$disableTextWrap === undefined ? false : _node$disableTextWrap,
8489
- _node$lightBoxmode = node.lightBoxmode,
8490
- lightBoxmode = _node$lightBoxmode === undefined ? false : _node$lightBoxmode;
8466
+ disableTextWrap = _node$disableTextWrap === undefined ? false : _node$disableTextWrap;
8491
8467
  var _node$widthP = node.widthP,
8492
8468
  widthP = _node$widthP === undefined ? 'auto' : _node$widthP;
8493
8469
 
@@ -8538,31 +8514,6 @@ var FigureComponent = function FigureComponent(props) {
8538
8514
  margin: figureMargin
8539
8515
  };
8540
8516
 
8541
- if (lightBoxmode) {
8542
- if (link && caption) {
8543
- return React__default.createElement(
8544
- 'a',
8545
- { target: blank ? '_blank' : '_self', href: link },
8546
- React__default.createElement('div', { dangerouslySetInnerHTML: { __html: '<span class=\'figure-caption\'>' + caption + '</span>' } })
8547
- );
8548
- } else if (node && node.asset && node.asset._ref && caption) {
8549
- return React__default.createElement(
8550
- React__default.Fragment,
8551
- null,
8552
- React__default.createElement('div', {
8553
- style: { display: 'inline', cursor: 'pointer', textDecoration: 'underline', paddingLeft: '0.25rem', paddingRight: '0.25rem' },
8554
- className: 'lightbox-caption',
8555
- onClick: function onClick() {
8556
- setOpenImgSrc(urlFor$3(node, client).url());
8557
- setOpenImg(true);
8558
- },
8559
- dangerouslySetInnerHTML: { __html: '<span>' + caption + '</span>' }
8560
- }),
8561
- renderLightbox(openImg, openImgSrc, setOpenImg, setOpenImgSrc)
8562
- );
8563
- }
8564
- }
8565
-
8566
8517
  return React__default.createElement(
8567
8518
  React__default.Fragment,
8568
8519
  null,
@@ -8583,13 +8534,20 @@ var FigureComponent = function FigureComponent(props) {
8583
8534
  src: urlFor$3(node, client).url(),
8584
8535
  alt: alt && alt,
8585
8536
  onClick: function onClick() {
8586
- setOpenImgSrc(urlFor$3(node, client).url());
8587
- setOpenImg(true);
8537
+ setLightboxImgSrc(urlFor$3(node, client).url());
8538
+ setShowLightbox(true);
8588
8539
  }
8589
8540
  }),
8590
8541
  caption && React__default.createElement('div', { dangerouslySetInnerHTML: { __html: '<span class=\'figure-caption\'>' + caption + '</span>' } })
8591
8542
  ),
8592
- renderLightbox(openImg, openImgSrc, setOpenImg, setOpenImgSrc)
8543
+ React__default.createElement(LightBox, {
8544
+ showLightbox: showLightbox,
8545
+ lightboxImgSrc: lightboxImgSrc,
8546
+ closeLightbox: function closeLightbox() {
8547
+ setLightboxImgSrc('');
8548
+ setShowLightbox(false);
8549
+ }
8550
+ })
8593
8551
  ),
8594
8552
  React__default.createElement(
8595
8553
  'style',
@@ -8606,7 +8564,7 @@ var urlFor$4 = function urlFor(source, client) {
8606
8564
  return builder.image(source).auto('format');
8607
8565
  };
8608
8566
 
8609
- function useOutsideAlerter$1(ref, container, setOpenImg, setOpenImgSrc) {
8567
+ function useOutsideAlerter(ref, container, setOpenImg, setOpenImgSrc) {
8610
8568
  React.useEffect(function () {
8611
8569
  function handleClickOutside(event) {
8612
8570
  if (ref.current && !ref.current.contains(event.target) && container.current && container.current.className.includes('open')) {
@@ -8637,7 +8595,7 @@ var MultiFigure = function MultiFigure(props) {
8637
8595
 
8638
8596
  var lightboxImage = React.useRef(null);
8639
8597
  var lightboxContainer = React.useRef(null);
8640
- useOutsideAlerter$1(lightboxImage, lightboxContainer, setOpenImg, setOpenImgSrc);
8598
+ useOutsideAlerter(lightboxImage, lightboxContainer, setOpenImg, setOpenImgSrc);
8641
8599
  if (images && images.length > 0) {
8642
8600
  return React__default.createElement(
8643
8601
  'div',
package/dist/cjs/index.js CHANGED
@@ -79,7 +79,7 @@ require('react-bootstrap/Form');
79
79
  require('./index-5be2866f.js');
80
80
  require('./js.cookie-a511c430.js');
81
81
  var CMEDeck = require('./CMEDeck.js');
82
- var getSerializers = require('./index-47e709f6.js');
82
+ var getSerializers = require('./index-2831c002.js');
83
83
  require('./util-f2c1b65b.js');
84
84
  require('./brightcove-react-player-loader.es-156bd4d6.js');
85
85
  require('react-bootstrap/Pagination');
@@ -39,7 +39,7 @@ import './GroupDeck.js';
39
39
  import 'react-bootstrap';
40
40
  import Button from 'react-bootstrap/Button';
41
41
  import { m as momentTimezone } from './index-d2f90501.js';
42
- import { g as getSerializers } from './index-ed279e5e.js';
42
+ import { g as getSerializers } from './index-e2a6c2d0.js';
43
43
  import './util-7700fc59.js';
44
44
  import './brightcove-react-player-loader.es-83f53e4e.js';
45
45
  import 'react-bootstrap/Pagination';
@@ -62,23 +62,23 @@ var MasterDeck = function (_React$Component) {
62
62
  from: _this.params ? _this.params.from : 0,
63
63
  to: _this.params ? _this.params.to : 2,
64
64
  total_pages: null,
65
- scrolling: true,
65
+ scrolling: false,
66
66
  query: _this.query,
67
67
  currentPage: _this.props.currentPage || 1,
68
- dataRemapped: false,
68
+ dataRemapped: !_this.props.showBI || !_this.props.brandInsightAd,
69
69
  lastDataSize: _this.data ? _this.data.length : 0,
70
70
  itemsPerPage: _this.params ? _this.params.to - _this.params.from : 2
71
71
  }, _this.loadMore = debounce_1(function () {
72
72
  _this.setState(function (state) {
73
73
  var page = state.page,
74
74
  from = state.from,
75
- per = state.per,
76
- to = state.to;
75
+ to = state.to,
76
+ itemsPerPage = state.itemsPerPage;
77
77
 
78
78
  return {
79
79
  page: page + 1,
80
- from: from + per,
81
- to: to + per
80
+ from: from + itemsPerPage,
81
+ to: to + itemsPerPage
82
82
  };
83
83
  }, _this.loadData);
84
84
  }, 0), _this.loadData = function () {
@@ -93,7 +93,7 @@ var MasterDeck = function (_React$Component) {
93
93
  dataHandler = _this$props.dataHandler;
94
94
 
95
95
 
96
- var params = _extends({}, _this.props.params, { from: from, to: to });
96
+ var params = _extends({}, _this.props.params, { from: from, to: to + 1 });
97
97
 
98
98
  if (dataHandler) {
99
99
  var dataHandlerPromise = new _Promise(function (resolve, reject) {
@@ -117,31 +117,61 @@ var MasterDeck = function (_React$Component) {
117
117
  var pointer = _this.pointer;
118
118
  dataArr = dataArr[_this.pointerArray][pointer];
119
119
  }
120
- dataArr = dataArr.map(function (item) {
121
- return _extends({}, item, {
122
- pageNumber: page
120
+
121
+ if (dataArr && dataArr.length > 0) {
122
+ var itemsPerPage = _this.state.itemsPerPage;
123
+
124
+ var scrolling = dataArr.length === itemsPerPage + 1;
125
+ dataArr = dataArr.slice(0, itemsPerPage).map(function (item) {
126
+ return _extends({}, item, {
127
+ pageNumber: page
128
+ });
123
129
  });
124
- });
125
130
 
126
- _this.setState(function () {
127
- if (dataArr.length > 0) {
128
- return {
129
- data: [].concat(_toConsumableArray(data), _toConsumableArray(dataArr)),
130
- lastDataSize: dataArr.length,
131
- scrolling: true
132
- };
133
- } else {
134
- return {
135
- scrolling: false,
136
- lastDataSize: 0
137
- };
138
- }
139
- });
140
- }, _this.changePageNumber = function (pageNumber) {
131
+ _this.setState({
132
+ data: [].concat(_toConsumableArray(data), _toConsumableArray(dataArr)),
133
+ lastDataSize: dataArr.length,
134
+ scrolling: scrolling
135
+ });
136
+ } else {
137
+ _this.setState({
138
+ scrolling: false,
139
+ lastDataSize: 0
140
+ });
141
+ }
142
+ }, _this.checkMoreDataAvailable = function () {
143
+ debugger;
144
+ var _this$state2 = _this.state,
145
+ from = _this$state2.from,
146
+ itemsPerPage = _this$state2.itemsPerPage,
147
+ query = _this$state2.query;
141
148
  var _this$props2 = _this.props,
142
- seoPaginate = _this$props2.seoPaginate,
143
- pageview = _this$props2.pageview,
144
- router = _this$props2.router;
149
+ client = _this$props2.client,
150
+ dataHandler = _this$props2.dataHandler;
151
+
152
+ var params = _extends({}, _this.props.params, { from: from + itemsPerPage, to: from + itemsPerPage + 1 });
153
+ if (dataHandler) {
154
+ var dataHandlerPromise = new _Promise(function (resolve, reject) {
155
+ try {
156
+ var result = dataHandler(params);
157
+ resolve(result);
158
+ } catch (e) {
159
+ reject(e);
160
+ }
161
+ });
162
+ dataHandlerPromise.then(function (dataArr) {
163
+ if (dataArr && dataArr.length > 0) _this.setState({ scrolling: true });else _this.setState({ scrolling: false });
164
+ });
165
+ } else {
166
+ client.fetch(query, params).then(function (dataArr) {
167
+ if (dataArr && dataArr.length > 0) _this.setState({ scrolling: true });else _this.setState({ scrolling: false });
168
+ });
169
+ }
170
+ }, _this.changePageNumber = function (pageNumber) {
171
+ var _this$props3 = _this.props,
172
+ seoPaginate = _this$props3.seoPaginate,
173
+ pageview = _this$props3.pageview,
174
+ router = _this$props3.router;
145
175
  var currentPage = _this.state.currentPage;
146
176
 
147
177
  if (seoPaginate) {
@@ -219,9 +249,6 @@ var MasterDeck = function (_React$Component) {
219
249
  var insertBrandInsightAd = function insertBrandInsightAd(arr, index, newElement) {
220
250
  return [].concat(_toConsumableArray(arr.slice(0, index)), [newElement], _toConsumableArray(arr.slice(index)));
221
251
  };
222
- _this.componentDidMount = function () {
223
- _this.setState({ dataRemapped: !showBI || !brandInsightAd ? true : false });
224
- };
225
252
  // Need to pass flag "lgInfeedAd={true}" along with brandInsightAd from site level for large infeed-ad to render
226
253
  // Checking lgInfeedAd flag in desktop view ( window >= 1400px ).
227
254
  // Integrating large infeed AD
@@ -366,10 +393,10 @@ var MasterDeck = function (_React$Component) {
366
393
  rightItems[i].component
367
394
  );
368
395
  }, _this.renderManualPagination = function () {
369
- var _this$state2 = _this.state,
370
- currentPage = _this$state2.currentPage,
371
- itemsPerPage = _this$state2.itemsPerPage,
372
- lastDataSize = _this$state2.lastDataSize;
396
+ var _this$state3 = _this.state,
397
+ currentPage = _this$state3.currentPage,
398
+ itemsPerPage = _this$state3.itemsPerPage,
399
+ lastDataSize = _this$state3.lastDataSize;
373
400
 
374
401
  console.log('lastDataSize:', lastDataSize);
375
402
  console.log('itemsPerPage:', itemsPerPage);
@@ -420,7 +447,11 @@ var MasterDeck = function (_React$Component) {
420
447
  }, {
421
448
  key: 'componentDidMount',
422
449
  value: function componentDidMount() {
423
- // this.loadData();
450
+ var _state = this.state,
451
+ data = _state.data,
452
+ itemsPerPage = _state.itemsPerPage;
453
+
454
+ if (!(data.length < itemsPerPage)) this.checkMoreDataAvailable();
424
455
  }
425
456
  // Passing 'brandInsightAd','showBI' and 'lgInfeedAd'
426
457
 
@@ -476,7 +507,16 @@ var MasterDeck = function (_React$Component) {
476
507
  'button',
477
508
  {
478
509
  className: 'btn',
479
- style: { margin: '0 auto 2rem', display: 'block', fontSize: '18px', padding: '.5rem 1.5rem', boxShadow: '1px 2px 4px 4px rgba(0,0,0,.15)', background: 'var(--primary)', color: '#fff', borderRadius: '5px' },
510
+ style: {
511
+ margin: '0 auto 2rem',
512
+ display: 'block',
513
+ fontSize: '18px',
514
+ padding: '.5rem 1.5rem',
515
+ boxShadow: '1px 2px 4px 4px rgba(0,0,0,.15)',
516
+ background: 'var(--primary)',
517
+ color: '#fff',
518
+ borderRadius: '5px'
519
+ },
480
520
  onClick: function onClick(e) {
481
521
  _this3.loadMore();
482
522
  } },
@@ -47,7 +47,7 @@ import './GroupDeck.js';
47
47
  import 'react-bootstrap';
48
48
  import QueueDeckExpanded from './QueueDeckExpanded.js';
49
49
  import 'react-bootstrap/Button';
50
- import { g as getSerializers } from './index-ed279e5e.js';
50
+ import { g as getSerializers } from './index-e2a6c2d0.js';
51
51
  import './util-7700fc59.js';
52
52
  import './brightcove-react-player-loader.es-83f53e4e.js';
53
53
  import 'react-bootstrap/Pagination';
package/dist/esm/View.js CHANGED
@@ -41,7 +41,7 @@ import 'react-bootstrap';
41
41
  import Button from 'react-bootstrap/Button';
42
42
  import { _ as _defineProperty } from './defineProperty-b798470d.js';
43
43
  import Form from 'react-bootstrap/Form';
44
- import { I as InscreenSensor, r as renderAuthor, g as getSerializers } from './index-ed279e5e.js';
44
+ import { I as InscreenSensor, r as renderAuthor, g as getSerializers } from './index-e2a6c2d0.js';
45
45
  import './util-7700fc59.js';
46
46
  import './brightcove-react-player-loader.es-83f53e4e.js';
47
47
  import 'react-bootstrap/Pagination';
@@ -38,7 +38,7 @@ import './smoothscroll-4b699764.js';
38
38
  import './GroupDeck.js';
39
39
  import 'react-bootstrap';
40
40
  import 'react-bootstrap/Button';
41
- export { g as default } from './index-ed279e5e.js';
41
+ export { g as default } from './index-e2a6c2d0.js';
42
42
  import './util-7700fc59.js';
43
43
  import './brightcove-react-player-loader.es-83f53e4e.js';
44
44
  import 'react-bootstrap/Pagination';
@@ -3,7 +3,7 @@ import { a as _Array$from, _ as _toConsumableArray } from './toConsumableArray-7
3
3
  import { _ as _extends } from './extends-cc5da797.js';
4
4
  import { _ as _inherits$1, a as _classCallCheck$1, b as _possibleConstructorReturn$1, c as _Object$getPrototypeOf, d as _createClass$1 } from './inherits-7ee3e0c1.js';
5
5
  import { _ as _typeof$1 } from './typeof-08f2c380.js';
6
- import React__default, { useState, useEffect, useRef } from 'react';
6
+ import React__default, { useState, useEffect, useRef, useCallback } from 'react';
7
7
  import { l as lib_3 } from './index-93ec3c59.js';
8
8
  import PropTypes from 'prop-types';
9
9
  import Row from 'react-bootstrap/Row';
@@ -8384,29 +8384,31 @@ var ArticleSeries = function ArticleSeries(_ref) {
8384
8384
  );
8385
8385
  };
8386
8386
 
8387
- function useOutsideAlerter(ref, container, setOpenImg, setOpenImgSrc) {
8388
- useEffect(function () {
8389
- function handleClickOutside(event) {
8390
- if (ref.current && !ref.current.contains(event.target) && container.current && container.current.className.includes('open')) {
8391
- setOpenImgSrc('');
8392
- setOpenImg(false);
8393
- }
8387
+ var LightBox = function LightBox(_ref) {
8388
+ var showLightbox = _ref.showLightbox,
8389
+ lightboxImgSrc = _ref.lightboxImgSrc,
8390
+ closeLightbox = _ref.closeLightbox;
8391
+
8392
+ var lightboxImage = useRef(null);
8393
+ var lightboxContainer = useRef(null);
8394
+
8395
+ var handleClickOutside = useCallback(function (event) {
8396
+ if (lightboxImage.current && !lightboxImage.current.contains(event.target) && lightboxContainer.current && lightboxContainer.current.className.includes('open')) {
8397
+ closeLightbox();
8394
8398
  }
8399
+ }, [lightboxImage, lightboxContainer]);
8400
+
8401
+ useEffect(function () {
8395
8402
  document.addEventListener('mousedown', handleClickOutside);
8396
8403
  return function () {
8397
8404
  document.removeEventListener('mousedown', handleClickOutside);
8398
8405
  };
8399
- }, [ref]);
8400
- }
8406
+ }, [handleClickOutside]);
8401
8407
 
8402
- var renderLightbox = function renderLightbox(openImg, openImgSrc, setOpenImg, setOpenImgSrc) {
8403
- var lightboxImage = useRef(null);
8404
- var lightboxContainer = useRef(null);
8405
- useOutsideAlerter(lightboxImage, lightboxContainer, setOpenImg, setOpenImgSrc);
8406
8408
  return React__default.createElement(
8407
8409
  'div',
8408
- { ref: lightboxContainer, className: 'lightbox-target ' + (openImg ? 'open' : 'close') },
8409
- React__default.createElement('img', { ref: lightboxImage, src: openImgSrc }),
8410
+ { ref: lightboxContainer, className: 'lightbox-target ' + (showLightbox ? 'open' : 'close') },
8411
+ React__default.createElement('img', { ref: lightboxImage, src: lightboxImgSrc }),
8410
8412
  React__default.createElement(
8411
8413
  'style',
8412
8414
  { jsx: 'true' },
@@ -8429,40 +8431,16 @@ var compareProps = function compareProps(prevProps, nextProps) {
8429
8431
  var FigureComponent = function FigureComponent(props) {
8430
8432
  var _useState = useState(false),
8431
8433
  _useState2 = _slicedToArray(_useState, 2),
8432
- openImg = _useState2[0],
8433
- setOpenImg = _useState2[1];
8434
+ showLightbox = _useState2[0],
8435
+ setShowLightbox = _useState2[1];
8434
8436
 
8435
8437
  var _useState3 = useState(''),
8436
8438
  _useState4 = _slicedToArray(_useState3, 2),
8437
- openImgSrc = _useState4[0],
8438
- setOpenImgSrc = _useState4[1];
8439
+ lightboxImgSrc = _useState4[0],
8440
+ setLightboxImgSrc = _useState4[1];
8439
8441
 
8440
8442
  if (typeof window === 'undefined') return null;
8441
8443
 
8442
- useEffect(function () {
8443
- var lightboxCaptions = document.querySelectorAll('.lightbox-caption');
8444
- if (lightboxCaptions && lightboxCaptions.length > 0) {
8445
- lightboxCaptions.forEach(function (mediaLink) {
8446
- var prevSibling = mediaLink.previousSibling;
8447
- if (prevSibling && prevSibling.textContent && prevSibling.textContent !== '') {
8448
- prevSibling.style.display = 'inline';
8449
- prevSibling.style.paddingRight = '0';
8450
- prevSibling.style.marginRight = '0';
8451
- }
8452
- var nextSibling = mediaLink.nextSibling;
8453
- nextSibling.remove();
8454
- var parentNode = mediaLink.parentNode;
8455
- parentNode.appendChild(nextSibling);
8456
- nextSibling = mediaLink.nextSibling;
8457
- if (nextSibling && nextSibling.textContent && nextSibling.textContent !== '') {
8458
- nextSibling.style.display = 'inline';
8459
- nextSibling.style.paddingLeft = '0';
8460
- nextSibling.style.marginLeft = '0';
8461
- }
8462
- });
8463
- }
8464
- }, []);
8465
-
8466
8444
  var node = props.node,
8467
8445
  client = props.client;
8468
8446
 
@@ -8478,9 +8456,7 @@ var FigureComponent = function FigureComponent(props) {
8478
8456
  _node$class_name = node.class_name,
8479
8457
  class_name = _node$class_name === undefined ? 'd-block' : _node$class_name,
8480
8458
  _node$disableTextWrap = node.disableTextWrap,
8481
- disableTextWrap = _node$disableTextWrap === undefined ? false : _node$disableTextWrap,
8482
- _node$lightBoxmode = node.lightBoxmode,
8483
- lightBoxmode = _node$lightBoxmode === undefined ? false : _node$lightBoxmode;
8459
+ disableTextWrap = _node$disableTextWrap === undefined ? false : _node$disableTextWrap;
8484
8460
  var _node$widthP = node.widthP,
8485
8461
  widthP = _node$widthP === undefined ? 'auto' : _node$widthP;
8486
8462
 
@@ -8531,31 +8507,6 @@ var FigureComponent = function FigureComponent(props) {
8531
8507
  margin: figureMargin
8532
8508
  };
8533
8509
 
8534
- if (lightBoxmode) {
8535
- if (link && caption) {
8536
- return React__default.createElement(
8537
- 'a',
8538
- { target: blank ? '_blank' : '_self', href: link },
8539
- React__default.createElement('div', { dangerouslySetInnerHTML: { __html: '<span class=\'figure-caption\'>' + caption + '</span>' } })
8540
- );
8541
- } else if (node && node.asset && node.asset._ref && caption) {
8542
- return React__default.createElement(
8543
- React__default.Fragment,
8544
- null,
8545
- React__default.createElement('div', {
8546
- style: { display: 'inline', cursor: 'pointer', textDecoration: 'underline', paddingLeft: '0.25rem', paddingRight: '0.25rem' },
8547
- className: 'lightbox-caption',
8548
- onClick: function onClick() {
8549
- setOpenImgSrc(urlFor$3(node, client).url());
8550
- setOpenImg(true);
8551
- },
8552
- dangerouslySetInnerHTML: { __html: '<span>' + caption + '</span>' }
8553
- }),
8554
- renderLightbox(openImg, openImgSrc, setOpenImg, setOpenImgSrc)
8555
- );
8556
- }
8557
- }
8558
-
8559
8510
  return React__default.createElement(
8560
8511
  React__default.Fragment,
8561
8512
  null,
@@ -8576,13 +8527,20 @@ var FigureComponent = function FigureComponent(props) {
8576
8527
  src: urlFor$3(node, client).url(),
8577
8528
  alt: alt && alt,
8578
8529
  onClick: function onClick() {
8579
- setOpenImgSrc(urlFor$3(node, client).url());
8580
- setOpenImg(true);
8530
+ setLightboxImgSrc(urlFor$3(node, client).url());
8531
+ setShowLightbox(true);
8581
8532
  }
8582
8533
  }),
8583
8534
  caption && React__default.createElement('div', { dangerouslySetInnerHTML: { __html: '<span class=\'figure-caption\'>' + caption + '</span>' } })
8584
8535
  ),
8585
- renderLightbox(openImg, openImgSrc, setOpenImg, setOpenImgSrc)
8536
+ React__default.createElement(LightBox, {
8537
+ showLightbox: showLightbox,
8538
+ lightboxImgSrc: lightboxImgSrc,
8539
+ closeLightbox: function closeLightbox() {
8540
+ setLightboxImgSrc('');
8541
+ setShowLightbox(false);
8542
+ }
8543
+ })
8586
8544
  ),
8587
8545
  React__default.createElement(
8588
8546
  'style',
@@ -8599,7 +8557,7 @@ var urlFor$4 = function urlFor(source, client) {
8599
8557
  return builder.image(source).auto('format');
8600
8558
  };
8601
8559
 
8602
- function useOutsideAlerter$1(ref, container, setOpenImg, setOpenImgSrc) {
8560
+ function useOutsideAlerter(ref, container, setOpenImg, setOpenImgSrc) {
8603
8561
  useEffect(function () {
8604
8562
  function handleClickOutside(event) {
8605
8563
  if (ref.current && !ref.current.contains(event.target) && container.current && container.current.className.includes('open')) {
@@ -8630,7 +8588,7 @@ var MultiFigure = function MultiFigure(props) {
8630
8588
 
8631
8589
  var lightboxImage = useRef(null);
8632
8590
  var lightboxContainer = useRef(null);
8633
- useOutsideAlerter$1(lightboxImage, lightboxContainer, setOpenImg, setOpenImgSrc);
8591
+ useOutsideAlerter(lightboxImage, lightboxContainer, setOpenImg, setOpenImgSrc);
8634
8592
  if (images && images.length > 0) {
8635
8593
  return React__default.createElement(
8636
8594
  'div',
package/dist/esm/index.js CHANGED
@@ -75,7 +75,7 @@ import 'react-bootstrap/Form';
75
75
  import './index-d2f90501.js';
76
76
  import './js.cookie-6874175c.js';
77
77
  export { default as CMEDeck } from './CMEDeck.js';
78
- export { g as getSerializers } from './index-ed279e5e.js';
78
+ export { g as getSerializers } from './index-e2a6c2d0.js';
79
79
  import './util-7700fc59.js';
80
80
  import './brightcove-react-player-loader.es-83f53e4e.js';
81
81
  import 'react-bootstrap/Pagination';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.660",
3
+ "version": "1.0.662",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",