@mjhls/mjh-framework 1.0.62 → 1.0.64

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
@@ -3852,10 +3852,10 @@ var DeckContent = function (_React$Component) {
3852
3852
  var client = _this.props.client;
3853
3853
 
3854
3854
 
3855
- var params = { from: from, to: to };
3856
- var queryUpdated = query.replace('$from', params.from).replace('$to', params.to);
3857
- // const query = '*[_type == "article" && defined(title) && defined(thumbnail)][$from...$to] { title, summary, thumbnail { asset-> }, url }'
3858
- client.fetch(queryUpdated).then(function (dataArr) {
3855
+ var params = _extends({}, _this.params, { from: from, to: to
3856
+ // const queryUpdated = query.replace('$from', params.from).replace('$to', params.to)
3857
+ // const query = '*[_type == "article" && defined(title) && defined(thumbnail)][$from...$to] { title, summary, thumbnail { asset-> }, url }'
3858
+ });client.fetch(query, params).then(function (dataArr) {
3859
3859
  if (_this.pointer && _this.pointerArray) {
3860
3860
  var pointer = _this.pointer;
3861
3861
  dataArr = dataArr[_this.pointerArray][pointer];
@@ -3898,7 +3898,6 @@ var DeckContent = function (_React$Component) {
3898
3898
  var currentPage = _this.state.currentPage;
3899
3899
 
3900
3900
  if (seoPaginate) {
3901
-
3902
3901
  var path = router$$1.asPath;
3903
3902
  var qrIndex = path.indexOf('?');
3904
3903
  var pathname = router$$1.pathname;
@@ -3910,7 +3909,7 @@ var DeckContent = function (_React$Component) {
3910
3909
  var partialQS = router$$1.asPath.substring(qrIndex + 1);
3911
3910
  var partialQSArr = partialQS.split('&');
3912
3911
 
3913
- // exclude page=xxx from query string
3912
+ // exclude page=xxx from query string
3914
3913
  partialQSArr.map(function (item) {
3915
3914
  var itemArr = item.split('=');
3916
3915
  var key = itemArr[0];
@@ -3929,7 +3928,6 @@ var DeckContent = function (_React$Component) {
3929
3928
  pageNumber = parseInt(pageNumber);
3930
3929
 
3931
3930
  if (currentPage !== pageNumber) {
3932
-
3933
3931
  lib_3.refresh();
3934
3932
  if (pageview) {
3935
3933
  _this.setState({
@@ -3942,15 +3940,15 @@ var DeckContent = function (_React$Component) {
3942
3940
  var newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
3943
3941
 
3944
3942
  // 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
- })*/
3943
+ /* console.log('page change reported', {
3944
+ currentPage: currentPage,
3945
+ pageNumber: pageNumber,
3946
+ pathname: pathname,
3947
+ path: path,
3948
+ newPath: newPath,
3949
+ firstPage: pageNumber === 1,
3950
+ queryString: queryString
3951
+ }) */
3954
3952
 
3955
3953
  pageview(newPath);
3956
3954
 
@@ -5169,12 +5167,12 @@ var DeckQueue = function (_React$Component) {
5169
5167
  var client = _this.props.client;
5170
5168
 
5171
5169
 
5172
- var params = { from: from, to: to };
5173
- var queryUpdated = query.replace('$from', params.from).replace('$to', params.to);
5170
+ var params = _extends({}, _this.params, { from: from, to: to
5171
+ // const queryUpdated = query.replace('$from', params.from).replace('$to', params.to)
5174
5172
 
5175
- if (_this.pointer && _this.pointerArray) {
5173
+ });if (_this.pointer && _this.pointerArray) {
5176
5174
  var pointer = _this.pointer;
5177
- client.fetch(queryUpdated).then(function (dataArr) {
5175
+ client.fetch(query, params).then(function (dataArr) {
5178
5176
  _this.setState(function (state, props) {
5179
5177
  if (dataArr[_this.pointerArray][pointer].length > 0) {
5180
5178
  return {
@@ -5189,7 +5187,7 @@ var DeckQueue = function (_React$Component) {
5189
5187
  });
5190
5188
  });
5191
5189
  } else {
5192
- client.fetch(queryUpdated).then(function (dataArr) {
5190
+ client.fetch(query, params).then(function (dataArr) {
5193
5191
  _this.setState(function (state, props) {
5194
5192
  if (dataArr.length > 0) {
5195
5193
  return {
@@ -7393,23 +7391,51 @@ var AD300x250x600 = function AD300x250x600(_ref) {
7393
7391
  };
7394
7392
 
7395
7393
  var FigureComponent = function FigureComponent(_ref) {
7396
- var caption = _ref.caption,
7397
- asset = _ref.asset,
7394
+ var node$$1 = _ref.node,
7398
7395
  client = _ref.client;
7396
+ var caption = node$$1.caption,
7397
+ asset = node$$1.asset,
7398
+ alt = node$$1.alt,
7399
+ blank = node$$1.blank,
7400
+ link = node$$1.link,
7401
+ _node$widthP = node$$1.widthP,
7402
+ widthP = _node$widthP === undefined ? '100' : _node$widthP,
7403
+ _node$alignment = node$$1.alignment,
7404
+ alignment = _node$alignment === undefined ? 'center' : _node$alignment;
7399
7405
 
7400
7406
  var builder = imageUrlBuilder(client);
7401
7407
 
7402
7408
  var urlFor = function urlFor(source) {
7403
7409
  return builder.image(source);
7404
7410
  };
7405
-
7411
+ var imgWidth = widthP + '%';
7412
+ var imgFloat = alignment.toLowerCase() === 'center' ? 'none' : alignment.toLowerCase();
7413
+ var figureMargin = void 0;
7414
+ if (imgFloat === 'none') {
7415
+ figureMargin = '0 auto 2rem';
7416
+ }
7417
+ if (imgFloat === 'left') {
7418
+ figureMargin = '0 2rem 2rem 0';
7419
+ }
7420
+ if (imgFloat === 'right') {
7421
+ figureMargin = '0 0 2rem 2rem';
7422
+ }
7406
7423
  return React__default.createElement(
7407
- 'div',
7408
- { style: { textAlign: 'center', marginTop: '1em', marginBottom: '1em' } },
7409
- React__default.createElement(
7410
- reactBootstrap.Figure,
7424
+ reactBootstrap.Figure,
7425
+ { className: 'd-block text-center mb-3', style: { width: imgWidth, float: imgFloat, margin: figureMargin } },
7426
+ link ? React__default.createElement(
7427
+ 'a',
7428
+ { href: link, target: blank ? '_blank' : '_self' },
7429
+ React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(asset).url(), alt: alt && alt }),
7430
+ caption && React__default.createElement(
7431
+ reactBootstrap.Figure.Caption,
7432
+ null,
7433
+ caption
7434
+ )
7435
+ ) : React__default.createElement(
7436
+ React__default.Fragment,
7411
7437
  null,
7412
- React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(asset).url() }),
7438
+ React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(asset).url(), alt: alt && alt }),
7413
7439
  caption && React__default.createElement(
7414
7440
  reactBootstrap.Figure.Caption,
7415
7441
  null,
@@ -11088,17 +11114,43 @@ var Media$1 = function Media$$1(_ref) {
11088
11114
  return builder.image(source);
11089
11115
  };
11090
11116
 
11117
+ var renderFigure = function renderFigure(uploadDoc, poster, blank, caption) {
11118
+ if (uploadDoc && uploadDoc.asset && poster && poster.asset) {
11119
+ return React__default.createElement(
11120
+ reactBootstrap.Figure,
11121
+ { className: 'd-block text-center mb-3' },
11122
+ React__default.createElement(
11123
+ 'a',
11124
+ { href: uploadDoc.asset.url, target: blank ? '_blank' : '_self' },
11125
+ React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(poster.asset).url(), fluid: true }),
11126
+ caption && React__default.createElement(
11127
+ reactBootstrap.Figure.Caption,
11128
+ null,
11129
+ caption
11130
+ )
11131
+ )
11132
+ );
11133
+ } else if (poster && poster.asset) {
11134
+ return React__default.createElement(
11135
+ reactBootstrap.Figure,
11136
+ { className: 'd-block text-center mb-3' },
11137
+ React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(poster.asset).url() }),
11138
+ caption && React__default.createElement(
11139
+ reactBootstrap.Figure.Caption,
11140
+ null,
11141
+ caption
11142
+ )
11143
+ );
11144
+ }
11145
+ };
11146
+
11091
11147
  return React__default.createElement(
11092
- reactBootstrap.Figure,
11148
+ React__default.Fragment,
11093
11149
  null,
11094
- uploadDoc ? React__default.createElement(
11150
+ renderFigure(uploadDoc, poster, blank, caption),
11151
+ !poster && uploadDoc && uploadDoc.asset && React__default.createElement(
11095
11152
  'a',
11096
11153
  { href: uploadDoc.asset.url, target: blank ? '_blank' : '_self' },
11097
- React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(poster.asset).url() })
11098
- ) : React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(poster.asset).url() }),
11099
- caption && React__default.createElement(
11100
- reactBootstrap.Figure.Caption,
11101
- null,
11102
11154
  caption
11103
11155
  )
11104
11156
  );
@@ -11115,10 +11167,8 @@ var getSerializers$1 = function getSerializers(client) {
11115
11167
  },
11116
11168
  figure: function figure(_ref2) {
11117
11169
  var node = _ref2.node;
11118
- var asset = node.asset,
11119
- caption = node.caption;
11120
11170
 
11121
- return React__default.createElement(FigureComponent, { caption: caption, asset: asset, client: client });
11171
+ return React__default.createElement(FigureComponent, { node: node, client: client });
11122
11172
  },
11123
11173
  slideshow: function slideshow(_ref3) {
11124
11174
  var node = _ref3.node;