@mjhls/mjh-framework 1.0.104 → 1.0.105

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
@@ -11251,6 +11251,203 @@ var QueueDeckExpanded = function QueueDeckExpanded(props) {
11251
11251
  );
11252
11252
  };
11253
11253
 
11254
+ var VideoSeriesListing = function (_React$Component) {
11255
+ inherits(VideoSeriesListing, _React$Component);
11256
+
11257
+ function VideoSeriesListing() {
11258
+ var _ref;
11259
+
11260
+ var _temp, _this, _ret;
11261
+
11262
+ classCallCheck(this, VideoSeriesListing);
11263
+
11264
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
11265
+ args[_key] = arguments[_key];
11266
+ }
11267
+
11268
+ return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref = VideoSeriesListing.__proto__ || Object.getPrototypeOf(VideoSeriesListing)).call.apply(_ref, [this].concat(args))), _this), _this.page = _this.props.page, _this.mapping = _this.props.mapping, _this.data = _this.props.dataRecord, _this.query = _this.props.query, _this.params = _this.props.params, _this.defaultImage = _this.props.defaultImage ? _this.props.defaultImage : '/placeholder.jpg', _this.state = {
11269
+ data: _this.data,
11270
+ per: _this.params ? _this.params.to : 2,
11271
+ page: _this.props.currentPage || 1,
11272
+ from: _this.params ? _this.params.from : 0,
11273
+ to: _this.params ? _this.params.to : 2,
11274
+ total_pages: null,
11275
+ scrolling: true,
11276
+ query: _this.query,
11277
+ currentPage: _this.props.currentPage || 1
11278
+ }, _this.loadMore = debounce_1(function () {
11279
+ _this.setState(function (state) {
11280
+ var page = state.page,
11281
+ from = state.from,
11282
+ per = state.per,
11283
+ to = state.to;
11284
+
11285
+ return {
11286
+ page: page + 1,
11287
+ from: from + per,
11288
+ to: to + per
11289
+ };
11290
+ }, _this.loadData);
11291
+ }, 0), _this.loadData = function () {
11292
+ var _this$state = _this.state,
11293
+ from = _this$state.from,
11294
+ to = _this$state.to,
11295
+ data = _this$state.data,
11296
+ query = _this$state.query,
11297
+ page = _this$state.page;
11298
+ var client = _this.props.client;
11299
+
11300
+ _this.changePageNumber(page);
11301
+ var params = _extends({}, _this.params, { from: from, to: to
11302
+ // const queryUpdated = query.replace('$from', params.from).replace('$to', params.to)
11303
+ // const query = '*[_type == "article" && defined(title) && defined(thumbnail)][$from...$to] { title, summary, thumbnail { asset-> }, url }'
11304
+ });client.fetch(query, params).then(function (dataArr) {
11305
+ if (_this.pointer && _this.pointerArray) {
11306
+ var pointer = _this.pointer;
11307
+ dataArr = dataArr[_this.pointerArray][pointer];
11308
+ }
11309
+ dataArr = dataArr.map(function (item) {
11310
+ return _extends({}, item, {
11311
+ pageNumber: page
11312
+ });
11313
+ });
11314
+
11315
+ _this.setState(function () {
11316
+ if (dataArr.length > 0) {
11317
+ return {
11318
+ data: [].concat(toConsumableArray(data), toConsumableArray(dataArr)),
11319
+ scrolling: true
11320
+ };
11321
+ } else {
11322
+ return {
11323
+ scrolling: false
11324
+ };
11325
+ }
11326
+ });
11327
+ });
11328
+ }, _this.changePageNumber = function (pageNumber) {
11329
+ var _this$props = _this.props,
11330
+ seoPaginate = _this$props.seoPaginate,
11331
+ pageview = _this$props.pageview,
11332
+ router$$1 = _this$props.router;
11333
+ var currentPage = _this.state.currentPage;
11334
+
11335
+ if (seoPaginate) {
11336
+ var path = router$$1.asPath;
11337
+ var qrIndex = path.indexOf('?');
11338
+ var pathname = router$$1.pathname;
11339
+ var queryString = '';
11340
+
11341
+ if (qrIndex > 0) {
11342
+ path = path.substring(1, qrIndex);
11343
+
11344
+ var partialQS = router$$1.asPath.substring(qrIndex + 1);
11345
+ var partialQSArr = partialQS.split('&');
11346
+
11347
+ // exclude page=xxx from query string
11348
+ partialQSArr.map(function (item) {
11349
+ var itemArr = item.split('=');
11350
+ var key = itemArr[0];
11351
+ var val = itemArr[1];
11352
+
11353
+ if (key !== 'page') {
11354
+ queryString += (queryString.length === 0 ? '' : '&') + key + '=' + val;
11355
+ }
11356
+ });
11357
+ }
11358
+
11359
+ if (queryString.length > 0) {
11360
+ path += '?' + queryString;
11361
+ }
11362
+
11363
+ pageNumber = parseInt(pageNumber);
11364
+
11365
+ if (currentPage !== pageNumber) {
11366
+ lib_3.refresh();
11367
+ if (pageview) {
11368
+ _this.setState({
11369
+ currentPage: pageNumber
11370
+ }, function () {
11371
+ if (path[0] !== '/') {
11372
+ path = '/' + path;
11373
+ }
11374
+
11375
+ var newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
11376
+
11377
+ pageview(newPath);
11378
+
11379
+ router$$1.push(pathname, newPath, {
11380
+ shallow: true
11381
+ });
11382
+ });
11383
+ }
11384
+ }
11385
+ }
11386
+ }, _this.renderManualPagination = function () {
11387
+ var currentPage = _this.state.currentPage;
11388
+
11389
+ return React__default.createElement(
11390
+ 'div',
11391
+ { className: 'd-flex justify-content-between' },
11392
+ currentPage && currentPage > 1 && React__default.createElement(
11393
+ 'a',
11394
+ { href: '?page=' + (currentPage - 1) },
11395
+ '<< Previous'
11396
+ ),
11397
+ React__default.createElement(
11398
+ 'a',
11399
+ { href: '?page=' + (currentPage + 1) },
11400
+ 'Next >>'
11401
+ )
11402
+ );
11403
+ }, _temp), possibleConstructorReturn(_this, _ret);
11404
+ }
11405
+
11406
+ createClass(VideoSeriesListing, [{
11407
+ key: 'render',
11408
+ value: function render() {
11409
+ return React__default.createElement(
11410
+ InfiniteScroll,
11411
+ { dataLength: this.state.data.length, next: this.loadMore, hasMore: this.state.scrolling, scrollThreshold: 0.9 },
11412
+ React__default.createElement(
11413
+ Container,
11414
+ null,
11415
+ this.state.data && this.state.data.map(function (docSeries, index$$1) {
11416
+ docSeries.body[0].videos && docSeries.body[0].videos.map(function (singleVideo, indexInner) {
11417
+ singleVideo.link = '/view/' + docSeries.url.current + '?seriesVid=' + (indexInner + 1);
11418
+ });
11419
+ return React__default.createElement(
11420
+ 'div',
11421
+ null,
11422
+ React__default.createElement(
11423
+ 'h4',
11424
+ { className: 'video-title-banner', style: { fontWeight: 'bold', color: 'var(--primary)', padding: '.25rem 0', borderBottom: '2px solid var(--gold)' } },
11425
+ React__default.createElement(
11426
+ Link,
11427
+ { href: '/case-based-peer-perspectives/' + docSeries.url.current },
11428
+ React__default.createElement(
11429
+ 'a',
11430
+ null,
11431
+ docSeries.title,
11432
+ React__default.createElement(
11433
+ 'span',
11434
+ { style: { fontSize: '.9rem', color: 'grey', marginLeft: '1rem' } },
11435
+ 'View Topic'
11436
+ )
11437
+ )
11438
+ )
11439
+ ),
11440
+ React__default.createElement(YoutubeGroup, { key: index$$1, dataset: docSeries.body[0].videos })
11441
+ );
11442
+ })
11443
+ )
11444
+ );
11445
+ }
11446
+ }]);
11447
+ return VideoSeriesListing;
11448
+ }(React__default.Component);
11449
+ var VideoSeriesListing$1 = router.withRouter(VideoSeriesListing);
11450
+
11254
11451
  var Column1 = function Column1(props) {
11255
11452
  var title = props.title;
11256
11453
 
@@ -19928,6 +20125,7 @@ exports.TaxonomyCard = TaxonomyCard;
19928
20125
  exports.GroupDeck = GroupDeck;
19929
20126
  exports.YoutubeGroup = YoutubeGroup;
19930
20127
  exports.QueueDeckExpanded = QueueDeckExpanded;
20128
+ exports.VideoSeriesListing = VideoSeriesListing$1;
19931
20129
  exports.Column1 = Column1;
19932
20130
  exports.Column2 = Column2;
19933
20131
  exports.Column3 = Column3;