@mjhls/mjh-framework 1.0.357 → 1.0.359

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.357
2
+ # mjh-framework v. 1.0.359
3
3
 
4
4
 
5
5
  > Foundation Framework
@@ -164,8 +164,14 @@ var MasterDeck = function (_React$Component) {
164
164
  if (path[0] !== '/') {
165
165
  path = '/' + path;
166
166
  }
167
-
168
167
  var newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
168
+ if (window.location.href.includes('?')) {
169
+ if (window.location.href.includes('?page')) {
170
+ newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
171
+ } else {
172
+ newPath = pageNumber === 1 ? '' + path : path + '&page=' + pageNumber;
173
+ }
174
+ }
169
175
 
170
176
  // please leave this for later debug purpose : Yong Jun.
171
177
  /* console.log('page change reported', {
package/dist/cjs/index.js CHANGED
@@ -5879,7 +5879,13 @@ var Media = function Media(_ref) {
5879
5879
  var uploadDoc = node.upload_doc,
5880
5880
  poster = node.poster,
5881
5881
  blank = node.blank,
5882
- caption = node.caption;
5882
+ caption = node.caption,
5883
+ _node$alignment = node.alignment,
5884
+ alignment = _node$alignment === undefined ? 'center' : _node$alignment,
5885
+ alt = node.alt,
5886
+ className = node.class,
5887
+ _node$widthP = node.widthP,
5888
+ widthP = _node$widthP === undefined ? 'auto' : _node$widthP;
5883
5889
 
5884
5890
  var builder = index.imageUrlBuilder(client);
5885
5891
 
@@ -5887,64 +5893,85 @@ var Media = function Media(_ref) {
5887
5893
  return builder.image(source).auto('format');
5888
5894
  };
5889
5895
 
5890
- var renderFigure = function renderFigure(uploadDoc, poster, blank, caption) {
5891
- if (uploadDoc && uploadDoc.asset) {
5892
- if (poster && poster.asset && caption && caption !== '') {
5893
- return React__default.createElement(
5894
- reactBootstrap.Figure,
5895
- { className: 'mb-3' },
5896
- React__default.createElement(
5897
- 'a',
5898
- { href: uploadDoc.asset.url, target: blank ? '_blank' : '_self' },
5899
- React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(poster).url(), fluid: true }),
5900
- React__default.createElement(
5901
- reactBootstrap.Figure.Caption,
5902
- { className: 'text-center' },
5903
- caption
5904
- )
5905
- )
5906
- );
5907
- } else if (poster && poster.asset) {
5908
- return React__default.createElement(
5909
- reactBootstrap.Figure,
5910
- { className: 'mb-3' },
5911
- React__default.createElement(
5912
- 'a',
5913
- { href: uploadDoc.asset.url, target: blank ? '_blank' : '_self' },
5914
- React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(poster).url(), fluid: true })
5915
- )
5916
- );
5917
- } else if (caption && caption !== '') {
5918
- if (uploadDoc.downloadMedia) {
5919
- return React__default.createElement(
5920
- 'a',
5921
- {
5922
- href: uploadDoc.asset.url,
5923
- target: '_blank',
5924
- rel: 'noopener noreferrer',
5925
- className: 'd-block',
5926
- onClick: function onClick() {
5927
- download(uploadDoc.asset.url, uploadDoc.asset.originalFilename);
5928
- } },
5929
- caption
5930
- );
5931
- }
5932
- return React__default.createElement(
5933
- 'a',
5934
- { href: uploadDoc.asset.url, target: blank ? '_blank' : '_self', className: 'd-block text-center' },
5935
- caption
5936
- );
5896
+ if (typeof window === 'undefined') {
5897
+ return null;
5898
+ }
5899
+
5900
+ React.useEffect(function () {
5901
+ var mediaLink = document.getElementById('media-link');
5902
+ if (mediaLink) {
5903
+ var prevSibling = mediaLink.previousSibling;
5904
+ if (prevSibling) prevSibling.style.display = 'inline';
5905
+ var nextSibling = mediaLink.nextSibling;
5906
+ if (nextSibling) nextSibling.style.display = 'inline';
5907
+ }
5908
+ }, []);
5909
+
5910
+ var screenWidth = window.innerWidth;
5911
+ var imageFloat = 'none';
5912
+ if (screenWidth > 1000) {
5913
+ var align = ['center', 'top'].includes(alignment.toLowerCase()) ? 'none' : alignment.toLowerCase();
5914
+ imageFloat = align;
5915
+ }
5916
+
5917
+ var imageMargin = null;
5918
+ if (imageFloat === 'none') {
5919
+ imageMargin = '0 auto 1rem';
5920
+ }
5921
+ if (imageFloat === 'left') {
5922
+ imageMargin = '0 1.5rem 1.5rem 0';
5923
+ }
5924
+ if (imageFloat === 'right') {
5925
+ imageMargin = '0 0 1.5rem 1.5rem';
5926
+ }
5927
+
5928
+ var imageWidth = null;
5929
+ if (screenWidth > 1000) {
5930
+ if (widthP === 'auto') {
5931
+ if (imageFloat === 'none') {
5932
+ imageWidth = 'auto';
5933
+ } else {
5934
+ imageWidth = '30%';
5937
5935
  }
5938
- return null;
5936
+ } else {
5937
+ imageWidth = widthP + '%';
5939
5938
  }
5940
- return null;
5941
- };
5939
+ } else {
5940
+ imageWidth = '100%';
5941
+ }
5942
5942
 
5943
- return React__default.createElement(
5944
- React__default.Fragment,
5945
- null,
5946
- renderFigure(uploadDoc, poster, blank, caption)
5947
- );
5943
+ if (!uploadDoc || !uploadDoc.asset) return null;
5944
+
5945
+ if (poster && poster.asset && imageFloat && imageMargin && imageWidth) {
5946
+ return React__default.createElement(
5947
+ reactBootstrap.Figure,
5948
+ { className: 'd-block ' + className, style: { width: imageWidth, maxWidth: '100%', clear: 'both', float: imageFloat, margin: imageMargin } },
5949
+ React__default.createElement(
5950
+ 'a',
5951
+ { href: uploadDoc.asset.url, target: blank ? '_blank' : '_self' },
5952
+ React__default.createElement(reactBootstrap.Figure.Image, _extends$2._extends({ className: 'media-image', style: { width: '100%' }, src: urlFor(poster).url() }, alt && { alt: alt })),
5953
+ caption && React__default.createElement(
5954
+ reactBootstrap.Figure.Caption,
5955
+ { className: 'media-caption' },
5956
+ caption
5957
+ )
5958
+ )
5959
+ );
5960
+ } else if (caption && caption !== '') {
5961
+ return React__default.createElement(
5962
+ 'a',
5963
+ _extends$2._extends({}, uploadDoc.downloadMedia ? {
5964
+ onClick: function onClick() {
5965
+ download(uploadDoc.asset.url, uploadDoc.asset.originalFilename);
5966
+ }
5967
+ } : { href: uploadDoc.asset.url, target: '_blank', rel: 'noopener noreferrer' }, {
5968
+ style: { paddingLeft: '4px', paddingRight: '4px' },
5969
+ id: 'media-link' }),
5970
+ caption
5971
+ );
5972
+ } else {
5973
+ return null;
5974
+ }
5948
5975
  };
5949
5976
 
5950
5977
  var IFrame = function IFrame(_ref) {
@@ -158,8 +158,14 @@ var MasterDeck = function (_React$Component) {
158
158
  if (path[0] !== '/') {
159
159
  path = '/' + path;
160
160
  }
161
-
162
161
  var newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
162
+ if (window.location.href.includes('?')) {
163
+ if (window.location.href.includes('?page')) {
164
+ newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
165
+ } else {
166
+ newPath = pageNumber === 1 ? '' + path : path + '&page=' + pageNumber;
167
+ }
168
+ }
163
169
 
164
170
  // please leave this for later debug purpose : Yong Jun.
165
171
  /* console.log('page change reported', {
package/dist/esm/index.js CHANGED
@@ -5876,7 +5876,13 @@ var Media = function Media(_ref) {
5876
5876
  var uploadDoc = node.upload_doc,
5877
5877
  poster = node.poster,
5878
5878
  blank = node.blank,
5879
- caption = node.caption;
5879
+ caption = node.caption,
5880
+ _node$alignment = node.alignment,
5881
+ alignment = _node$alignment === undefined ? 'center' : _node$alignment,
5882
+ alt = node.alt,
5883
+ className = node.class,
5884
+ _node$widthP = node.widthP,
5885
+ widthP = _node$widthP === undefined ? 'auto' : _node$widthP;
5880
5886
 
5881
5887
  var builder = imageUrlBuilder(client);
5882
5888
 
@@ -5884,64 +5890,85 @@ var Media = function Media(_ref) {
5884
5890
  return builder.image(source).auto('format');
5885
5891
  };
5886
5892
 
5887
- var renderFigure = function renderFigure(uploadDoc, poster, blank, caption) {
5888
- if (uploadDoc && uploadDoc.asset) {
5889
- if (poster && poster.asset && caption && caption !== '') {
5890
- return React__default.createElement(
5891
- Figure$1,
5892
- { className: 'mb-3' },
5893
- React__default.createElement(
5894
- 'a',
5895
- { href: uploadDoc.asset.url, target: blank ? '_blank' : '_self' },
5896
- React__default.createElement(Figure$1.Image, { src: urlFor(poster).url(), fluid: true }),
5897
- React__default.createElement(
5898
- Figure$1.Caption,
5899
- { className: 'text-center' },
5900
- caption
5901
- )
5902
- )
5903
- );
5904
- } else if (poster && poster.asset) {
5905
- return React__default.createElement(
5906
- Figure$1,
5907
- { className: 'mb-3' },
5908
- React__default.createElement(
5909
- 'a',
5910
- { href: uploadDoc.asset.url, target: blank ? '_blank' : '_self' },
5911
- React__default.createElement(Figure$1.Image, { src: urlFor(poster).url(), fluid: true })
5912
- )
5913
- );
5914
- } else if (caption && caption !== '') {
5915
- if (uploadDoc.downloadMedia) {
5916
- return React__default.createElement(
5917
- 'a',
5918
- {
5919
- href: uploadDoc.asset.url,
5920
- target: '_blank',
5921
- rel: 'noopener noreferrer',
5922
- className: 'd-block',
5923
- onClick: function onClick() {
5924
- download(uploadDoc.asset.url, uploadDoc.asset.originalFilename);
5925
- } },
5926
- caption
5927
- );
5928
- }
5929
- return React__default.createElement(
5930
- 'a',
5931
- { href: uploadDoc.asset.url, target: blank ? '_blank' : '_self', className: 'd-block text-center' },
5932
- caption
5933
- );
5893
+ if (typeof window === 'undefined') {
5894
+ return null;
5895
+ }
5896
+
5897
+ useEffect(function () {
5898
+ var mediaLink = document.getElementById('media-link');
5899
+ if (mediaLink) {
5900
+ var prevSibling = mediaLink.previousSibling;
5901
+ if (prevSibling) prevSibling.style.display = 'inline';
5902
+ var nextSibling = mediaLink.nextSibling;
5903
+ if (nextSibling) nextSibling.style.display = 'inline';
5904
+ }
5905
+ }, []);
5906
+
5907
+ var screenWidth = window.innerWidth;
5908
+ var imageFloat = 'none';
5909
+ if (screenWidth > 1000) {
5910
+ var align = ['center', 'top'].includes(alignment.toLowerCase()) ? 'none' : alignment.toLowerCase();
5911
+ imageFloat = align;
5912
+ }
5913
+
5914
+ var imageMargin = null;
5915
+ if (imageFloat === 'none') {
5916
+ imageMargin = '0 auto 1rem';
5917
+ }
5918
+ if (imageFloat === 'left') {
5919
+ imageMargin = '0 1.5rem 1.5rem 0';
5920
+ }
5921
+ if (imageFloat === 'right') {
5922
+ imageMargin = '0 0 1.5rem 1.5rem';
5923
+ }
5924
+
5925
+ var imageWidth = null;
5926
+ if (screenWidth > 1000) {
5927
+ if (widthP === 'auto') {
5928
+ if (imageFloat === 'none') {
5929
+ imageWidth = 'auto';
5930
+ } else {
5931
+ imageWidth = '30%';
5934
5932
  }
5935
- return null;
5933
+ } else {
5934
+ imageWidth = widthP + '%';
5936
5935
  }
5937
- return null;
5938
- };
5936
+ } else {
5937
+ imageWidth = '100%';
5938
+ }
5939
5939
 
5940
- return React__default.createElement(
5941
- React__default.Fragment,
5942
- null,
5943
- renderFigure(uploadDoc, poster, blank, caption)
5944
- );
5940
+ if (!uploadDoc || !uploadDoc.asset) return null;
5941
+
5942
+ if (poster && poster.asset && imageFloat && imageMargin && imageWidth) {
5943
+ return React__default.createElement(
5944
+ Figure$1,
5945
+ { className: 'd-block ' + className, style: { width: imageWidth, maxWidth: '100%', clear: 'both', float: imageFloat, margin: imageMargin } },
5946
+ React__default.createElement(
5947
+ 'a',
5948
+ { href: uploadDoc.asset.url, target: blank ? '_blank' : '_self' },
5949
+ React__default.createElement(Figure$1.Image, _extends$2({ className: 'media-image', style: { width: '100%' }, src: urlFor(poster).url() }, alt && { alt: alt })),
5950
+ caption && React__default.createElement(
5951
+ Figure$1.Caption,
5952
+ { className: 'media-caption' },
5953
+ caption
5954
+ )
5955
+ )
5956
+ );
5957
+ } else if (caption && caption !== '') {
5958
+ return React__default.createElement(
5959
+ 'a',
5960
+ _extends$2({}, uploadDoc.downloadMedia ? {
5961
+ onClick: function onClick() {
5962
+ download(uploadDoc.asset.url, uploadDoc.asset.originalFilename);
5963
+ }
5964
+ } : { href: uploadDoc.asset.url, target: '_blank', rel: 'noopener noreferrer' }, {
5965
+ style: { paddingLeft: '4px', paddingRight: '4px' },
5966
+ id: 'media-link' }),
5967
+ caption
5968
+ );
5969
+ } else {
5970
+ return null;
5971
+ }
5945
5972
  };
5946
5973
 
5947
5974
  var IFrame = function IFrame(_ref) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.357",
3
+ "version": "1.0.359",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",