@mjhls/mjh-framework 1.0.123 → 1.0.125

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.122
2
+ # mjh-framework v. 1.0.125
3
3
 
4
4
 
5
5
  > Foundation Framework
package/dist/index.es.js CHANGED
@@ -12646,6 +12646,363 @@ var VideoSeriesListing = function (_React$Component) {
12646
12646
  }(React__default.Component);
12647
12647
  var VideoSeriesListing$1 = withRouter(VideoSeriesListing);
12648
12648
 
12649
+ var MasterDeck = function (_React$Component) {
12650
+ inherits(MasterDeck, _React$Component);
12651
+
12652
+ function MasterDeck() {
12653
+ var _ref,
12654
+ _this2 = this;
12655
+
12656
+ var _temp, _this, _ret;
12657
+
12658
+ classCallCheck(this, MasterDeck);
12659
+
12660
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
12661
+ args[_key] = arguments[_key];
12662
+ }
12663
+
12664
+ return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref = MasterDeck.__proto__ || Object.getPrototypeOf(MasterDeck)).call.apply(_ref, [this].concat(args))), _this), _this.Deck = _this.props.deck, _this.variant = _this.props.variant, _this.mapping = _this.props.mapping, _this.data = _this.props.dataRecord || [], _this.query = _this.props.query, _this.params = _this.props.params, _this.pointer = _this.props.pointer ? _this.props.pointer : false, _this.pointerArray = _this.props.pointerArray ? _this.props.pointerArray : false, _this.defaultImage = _this.props.defaultImage ? _this.props.defaultImage : '/placeholder.jpg', _this.state = {
12665
+ data: _this.data,
12666
+ dataKeptToCompareNewDatarecord: _this.data,
12667
+ per: _this.params ? _this.params.to : 2,
12668
+ page: _this.props.currentPage || 1,
12669
+ from: _this.params ? _this.params.from : 0,
12670
+ to: _this.params ? _this.params.to : 2,
12671
+ total_pages: null,
12672
+ scrolling: true,
12673
+ query: _this.query,
12674
+ currentPage: _this.props.currentPage || 1
12675
+ }, _this.loadMore = debounce_1(function () {
12676
+ _this.setState(function (state) {
12677
+ var page = state.page,
12678
+ from = state.from,
12679
+ per = state.per,
12680
+ to = state.to;
12681
+
12682
+ return {
12683
+ page: page + 1,
12684
+ from: from + per,
12685
+ to: to + per
12686
+ };
12687
+ }, _this.loadData);
12688
+ }, 0), _this.loadData = function () {
12689
+ var _this$state = _this.state,
12690
+ from = _this$state.from,
12691
+ to = _this$state.to,
12692
+ data = _this$state.data,
12693
+ query = _this$state.query,
12694
+ page = _this$state.page;
12695
+ var client = _this.props.client;
12696
+
12697
+
12698
+ var params = _extends({}, _this.params, { from: from, to: to
12699
+ // const queryUpdated = query.replace('$from', params.from).replace('$to', params.to)
12700
+ // const query = '*[_type == "article" && defined(title) && defined(thumbnail)][$from...$to] { title, summary, thumbnail { asset-> }, url }'
12701
+ });client.fetch(query, params).then(function (dataArr) {
12702
+ if (_this.pointer && _this.pointerArray) {
12703
+ var pointer = _this.pointer;
12704
+ dataArr = dataArr[_this.pointerArray][pointer];
12705
+ }
12706
+ dataArr = dataArr.map(function (item) {
12707
+ return _extends({}, item, {
12708
+ pageNumber: page
12709
+ });
12710
+ });
12711
+
12712
+ _this.setState(function () {
12713
+ if (dataArr.length > 0) {
12714
+ return {
12715
+ data: [].concat(toConsumableArray(data), toConsumableArray(dataArr)),
12716
+ scrolling: true
12717
+ };
12718
+ } else {
12719
+ return {
12720
+ scrolling: false
12721
+ };
12722
+ }
12723
+ });
12724
+ });
12725
+ }, _this.urlFor = function (source) {
12726
+ var client = _this.props.client;
12727
+
12728
+ var builder = imageUrlBuilder(client);
12729
+ return builder.image(source);
12730
+ }, _this.renderCardImage = function (row, page) {
12731
+ if (row.thumbnail && row.thumbnail.asset) {
12732
+ var url = _this.urlFor(row.thumbnail);
12733
+ if (_this.props.imageHeight) url = url.height(_this.props.imageHeight);
12734
+ if (_this.props.imageWidth) url = url.width(_this.props.imageWidth);
12735
+ return url.url();
12736
+ } else {
12737
+ return _this.defaultImage;
12738
+ }
12739
+ }, _this.changePageNumber = function (pageNumber) {
12740
+ console.log(pageNumber);
12741
+ var _this$props = _this.props,
12742
+ seoPaginate = _this$props.seoPaginate,
12743
+ pageview = _this$props.pageview,
12744
+ router = _this$props.router;
12745
+ var currentPage = _this.state.currentPage;
12746
+
12747
+ if (seoPaginate) {
12748
+ var path = router.asPath;
12749
+ var qrIndex = path.indexOf('?');
12750
+ var pathname = router.pathname;
12751
+ var queryString = '';
12752
+
12753
+ if (qrIndex > 0) {
12754
+ path = path.substring(1, qrIndex);
12755
+
12756
+ var partialQS = router.asPath.substring(qrIndex + 1);
12757
+ var partialQSArr = partialQS.split('&');
12758
+
12759
+ // exclude page=xxx from query string
12760
+ partialQSArr.map(function (item) {
12761
+ var itemArr = item.split('=');
12762
+ var key = itemArr[0];
12763
+ var val = itemArr[1];
12764
+
12765
+ if (key !== 'page') {
12766
+ queryString += (queryString.length === 0 ? '' : '&') + key + '=' + val;
12767
+ }
12768
+ });
12769
+ }
12770
+
12771
+ if (queryString.length > 0) {
12772
+ path += '?' + queryString;
12773
+ }
12774
+
12775
+ pageNumber = parseInt(pageNumber);
12776
+
12777
+ if (currentPage !== pageNumber) {
12778
+ lib_3.refresh();
12779
+ if (pageview) {
12780
+ _this.setState({
12781
+ currentPage: pageNumber
12782
+ }, function () {
12783
+ if (path[0] !== '/') {
12784
+ path = '/' + path;
12785
+ }
12786
+
12787
+ var newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
12788
+
12789
+ // please leave this for later debug purpose : Yong Jun.
12790
+ /* console.log('page change reported', {
12791
+ currentPage: currentPage,
12792
+ pageNumber: pageNumber,
12793
+ pathname: pathname,
12794
+ path: path,
12795
+ newPath: newPath,
12796
+ firstPage: pageNumber === 1,
12797
+ queryString: queryString
12798
+ }) */
12799
+
12800
+ pageview(newPath);
12801
+
12802
+ router.push(pathname, newPath, {
12803
+ shallow: true
12804
+ });
12805
+ });
12806
+ }
12807
+ }
12808
+ }
12809
+ }, _this.renderAuthor = function (authorDetail, index$$1, length) {
12810
+ if (authorDetail) {
12811
+ var _id = authorDetail._id,
12812
+ displayName = authorDetail.displayName,
12813
+ url = authorDetail.url;
12814
+
12815
+ if (displayName && url && url.current) {
12816
+ return React__default.createElement(
12817
+ 'div',
12818
+ { key: _id },
12819
+ index$$1 === 0 && React__default.createElement(
12820
+ 'span',
12821
+ { className: 'pr-1' },
12822
+ 'By'
12823
+ ),
12824
+ React__default.createElement(
12825
+ Link,
12826
+ { href: '/authors/[url]', as: '/authors/' + url.current },
12827
+ React__default.createElement(
12828
+ 'a',
12829
+ { className: 'text-muted' },
12830
+ displayName,
12831
+ length !== index$$1 + 1 && React__default.createElement('br', null)
12832
+ )
12833
+ )
12834
+ );
12835
+ } else if (displayName) {
12836
+ return React__default.createElement(
12837
+ 'div',
12838
+ { key: _id },
12839
+ index$$1 === 0 && React__default.createElement(
12840
+ 'span',
12841
+ { className: 'pr-1' },
12842
+ 'By'
12843
+ ),
12844
+ React__default.createElement(
12845
+ 'span',
12846
+ { className: 'text-muted' },
12847
+ displayName,
12848
+ length !== index$$1 + 1 && React__default.createElement('br', null)
12849
+ )
12850
+ );
12851
+ }
12852
+ } else return null;
12853
+ }, _this.cardLoader = function (page, columns, variant) {
12854
+
12855
+ var itemCounter = 0;
12856
+ return React__default.createElement(
12857
+ Row,
12858
+ null,
12859
+ _this.state.data && _this.state.data.map(function (row, index$$1) {
12860
+
12861
+ var pageNumber = row.pageNumber || _this.state.page;
12862
+ var contentCategoryName = row.contentCategory && row.contentCategory.name && _this.mapping[row.contentCategory.name] ? row.contentCategory.name : 'Articles';
12863
+
12864
+ return React__default.createElement(
12865
+ React__default.Fragment,
12866
+ null,
12867
+ React__default.createElement(
12868
+ VisibilitySensor,
12869
+ {
12870
+ key: itemCounter,
12871
+ onChange: function onChange(isVisible) {
12872
+ isVisible && _this.changePageNumber(pageNumber);
12873
+ } },
12874
+ React__default.createElement(_this2.Deck, { data: row, variant: variant, index: index$$1 })
12875
+ )
12876
+ );
12877
+ })
12878
+ );
12879
+ }, _this.renderMobileAd = function (index$$1, numberOfItemsBeforeAd) {
12880
+ var rightItems = _this.props.rightItems;
12881
+
12882
+ var i = ((index$$1 + 1) / numberOfItemsBeforeAd - 1) % rightItems.length;
12883
+ return React__default.createElement(
12884
+ 'div',
12885
+ null,
12886
+ rightItems[i].component
12887
+ );
12888
+ }, _this.renderManualPagination = function () {
12889
+ var currentPage = _this.state.currentPage;
12890
+
12891
+ return React__default.createElement(
12892
+ 'div',
12893
+ { className: 'd-flex justify-content-between' },
12894
+ currentPage && currentPage > 1 && React__default.createElement(
12895
+ 'a',
12896
+ { href: '?page=' + (currentPage - 1) },
12897
+ '<< Previous'
12898
+ ),
12899
+ React__default.createElement(
12900
+ 'a',
12901
+ { href: '?page=' + (currentPage + 1) },
12902
+ 'Next >>'
12903
+ )
12904
+ );
12905
+ }, _temp), possibleConstructorReturn(_this, _ret);
12906
+ }
12907
+
12908
+ createClass(MasterDeck, [{
12909
+ key: 'componentDidUpdate',
12910
+ value: function componentDidUpdate(prevProps, prevState) {
12911
+ if (this.state.dataKeptToCompareNewDatarecord !== this.props.dataRecord) {
12912
+ // eslint-disable-next-line react/no-did-update-set-state
12913
+ this.setState({
12914
+ data: this.props.dataRecord,
12915
+ dataKeptToCompareNewDatarecord: this.props.dataRecord,
12916
+ per: this.props.params ? this.props.params.to : 2,
12917
+ page: 1,
12918
+ from: this.props.params ? this.props.params.from : 0,
12919
+ to: this.props.params ? this.props.params.to : 2,
12920
+ total_pages: null,
12921
+ scrolling: true,
12922
+ query: this.props.query
12923
+ });
12924
+ }
12925
+ }
12926
+ }, {
12927
+ key: 'componentDidMount',
12928
+ value: function componentDidMount() {
12929
+ // this.loadData();
12930
+ }
12931
+ }, {
12932
+ key: 'render',
12933
+ value: function render() {
12934
+ var _this3 = this;
12935
+
12936
+ var _props = this.props,
12937
+ columns = _props.columns,
12938
+ variant = _props.variant,
12939
+ autoScroll = _props.autoScroll,
12940
+ page = _props.page;
12941
+
12942
+
12943
+ return React__default.createElement(
12944
+ 'div',
12945
+ { className: 'contentDeck' },
12946
+ autoScroll ? React__default.createElement(
12947
+ React__default.Fragment,
12948
+ null,
12949
+ React__default.createElement(
12950
+ InfiniteScroll,
12951
+ { dataLength: this.state.data.length, next: this.loadMore, hasMore: this.state.scrolling, scrollThreshold: 0.9 },
12952
+ React__default.createElement(
12953
+ Container,
12954
+ null,
12955
+ this.cardLoader(page, columns, variant)
12956
+ )
12957
+ ),
12958
+ React__default.createElement(
12959
+ 'noscript',
12960
+ null,
12961
+ this.renderManualPagination()
12962
+ )
12963
+ ) : React__default.createElement(
12964
+ React__default.Fragment,
12965
+ null,
12966
+ React__default.createElement(
12967
+ Container,
12968
+ null,
12969
+ this.cardLoader(page, columns, variant)
12970
+ ),
12971
+ React__default.createElement(
12972
+ 'div',
12973
+ { style: { padding: '0px 10px' } },
12974
+ this.state.scrolling ? React__default.createElement(
12975
+ 'button',
12976
+ {
12977
+ style: { margin: 'auto', width: '100%' },
12978
+ onClick: function onClick(e) {
12979
+ _this3.loadMore();
12980
+ } },
12981
+ 'Load More'
12982
+ ) : React__default.createElement(
12983
+ 'p',
12984
+ { style: { textAlign: 'center' } },
12985
+ React__default.createElement(
12986
+ 'b',
12987
+ null,
12988
+ 'End of data'
12989
+ )
12990
+ )
12991
+ ),
12992
+ React__default.createElement(
12993
+ 'noscript',
12994
+ null,
12995
+ this.renderManualPagination()
12996
+ )
12997
+ )
12998
+ );
12999
+ }
13000
+ }]);
13001
+ return MasterDeck;
13002
+ }(React__default.Component);
13003
+
13004
+ var MasterDeck$1 = withRouter(MasterDeck);
13005
+
12649
13006
  var PublicationDeck = function PublicationDeck(props) {
12650
13007
  var data = props.data,
12651
13008
  imageHeight = props.imageHeight,
@@ -18014,7 +18371,8 @@ var BlockContent = SanityBlockContent;
18014
18371
 
18015
18372
  var Sidebar = function Sidebar(_ref) {
18016
18373
  var caption = _ref.caption,
18017
- content = _ref.content;
18374
+ content = _ref.content,
18375
+ serializerArguments = _ref.serializerArguments;
18018
18376
 
18019
18377
  return React__default.createElement(
18020
18378
  'article',
@@ -18027,12 +18385,12 @@ var Sidebar = function Sidebar(_ref) {
18027
18385
  null,
18028
18386
  caption
18029
18387
  ),
18030
- React__default.createElement(BlockContent, { blocks: content })
18388
+ React__default.createElement(BlockContent, { blocks: content, serializers: getSerializers$1(serializerArguments) })
18031
18389
  ),
18032
18390
  React__default.createElement(
18033
18391
  'style',
18034
18392
  { jsx: 'true' },
18035
- '\n .sidebar {\n width: 40%;\n padding: 1rem 0 0;\n margin-left: 1rem;\n margin-right: 10%;\n }\n @media screen and (max-width: 991px) {\n .sidebar {\n width: unset;\n padding: 1.25rem;\n margin-left: 1rem;\n margin-right: 1rem;\n }\n }\n '
18393
+ '\n .sidebar {\n width: 40%;\n padding: 1rem 0 0;\n margin-left: 1rem;\n margin-right: 10%;\n }\n @media screen and (max-width: 991px) {\n .sidebar {\n width: unset;\n padding: 1.25rem;\n margin-left: 1rem;\n margin-right: 1rem;\n }\n }\n '
18036
18394
  )
18037
18395
  );
18038
18396
  };
@@ -25508,7 +25866,6 @@ var html_decode = function html_decode(string) {
25508
25866
  var html_decode_1 = html_decode;
25509
25867
 
25510
25868
  var convertEntities = function convertEntities(props) {
25511
-
25512
25869
  if (typeof props === 'string' || props instanceof String) {
25513
25870
  props = html_decode_1(props);
25514
25871
  }
@@ -25558,7 +25915,7 @@ var getSerializers$1 = function getSerializers(client, pageview, videoAccountIDs
25558
25915
  var caption = node.caption,
25559
25916
  content = node.content;
25560
25917
 
25561
- return React__default.createElement(Sidebar, { caption: caption, content: content });
25918
+ return React__default.createElement(Sidebar, { caption: caption, content: content, serializerArguments: (drupalLeadSettings) });
25562
25919
  },
25563
25920
  datatable: function datatable(_ref6) {
25564
25921
  var node = _ref6.node;
@@ -25678,9 +26035,14 @@ var getSerializers$1 = function getSerializers(client, pageview, videoAccountIDs
25678
26035
  // feature_img { asset-> {url} }
25679
26036
  // }`
25680
26037
 
26038
+ //Update* Added control toggle for features. Will default to off -
26039
+ //<Feature controls dataset={props.features} /></div>
25681
26040
 
25682
26041
  var Feature = function Feature(props) {
25683
26042
  var dataset = props.dataset;
26043
+ var _props$controls = props.controls,
26044
+ controls = _props$controls === undefined ? false : _props$controls;
26045
+
25684
26046
 
25685
26047
  var checkUrlIsExternal = function checkUrlIsExternal(url) {
25686
26048
  if (/(http|https?)([^\s]+)/g.test(url)) {
@@ -25736,7 +26098,7 @@ var Feature = function Feature(props) {
25736
26098
  null,
25737
26099
  React__default.createElement(
25738
26100
  Carousel$1,
25739
- { touch: true },
26101
+ { touch: true, controls: controls },
25740
26102
  dataset.map(function (feature, index) {
25741
26103
  var feature_title = feature.feature_title,
25742
26104
  feature_body = feature.feature_body,
@@ -26181,5 +26543,5 @@ var PdfDownload = function PdfDownload(props) {
26181
26543
  );
26182
26544
  };
26183
26545
 
26184
- export { ContentCard as DeckContent, GridContent$1 as GridContent, Queue as DeckQueue, ThumbnailCard, TaxonomyCard, GroupDeck, YoutubeGroup, QueueDeckExpanded, VideoSeriesListing$1 as VideoSeriesListing, PublicationDeck, IssueDeck, IssueContentDeck, Column1, Column2, Column3, Header, LeftNav, AccordionPanel, SocialShare, PageFilter, NavMagazine, NavNative, NavNormal, NavDvm, TemplateNormal, AD, AD300x250, AD300x250x600, AD728x90, ADFooter, getSerializers$1 as getSerializers, Search, Feature, Breadcrumbs, SetCookie, Hero, AlphabeticList, PdfDownload };
26546
+ export { ContentCard as DeckContent, GridContent$1 as GridContent, Queue as DeckQueue, ThumbnailCard, TaxonomyCard, GroupDeck, YoutubeGroup, QueueDeckExpanded, VideoSeriesListing$1 as VideoSeriesListing, MasterDeck$1 as MasterDeck, PublicationDeck, IssueDeck, IssueContentDeck, Column1, Column2, Column3, Header, LeftNav, AccordionPanel, SocialShare, PageFilter, NavMagazine, NavNative, NavNormal, NavDvm, TemplateNormal, AD, AD300x250, AD300x250x600, AD728x90, ADFooter, getSerializers$1 as getSerializers, Search, Feature, Breadcrumbs, SetCookie, Hero, AlphabeticList, PdfDownload };
26185
26547
  //# sourceMappingURL=index.es.js.map