@mjhls/mjh-framework 1.0.63 → 1.0.65
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 +1 -1
- package/dist/index.es.js +96 -60
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +95 -59
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React__default, { Component, useState,
|
|
1
|
+
import React__default, { Component, useState, createContext, createElement } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import reactDom from 'react-dom';
|
|
4
4
|
import Row from 'react-bootstrap/Row';
|
|
@@ -3823,8 +3823,7 @@ var DeckContent = function (_React$Component) {
|
|
|
3823
3823
|
currentPage: _this.props.currentPage || 1
|
|
3824
3824
|
}, _this.loadMore = debounce_1(function () {
|
|
3825
3825
|
_this.setState(function (state) {
|
|
3826
|
-
var
|
|
3827
|
-
page = state.page,
|
|
3826
|
+
var page = state.page,
|
|
3828
3827
|
from = state.from,
|
|
3829
3828
|
per = state.per,
|
|
3830
3829
|
to = state.to;
|
|
@@ -3845,10 +3844,10 @@ var DeckContent = function (_React$Component) {
|
|
|
3845
3844
|
var client = _this.props.client;
|
|
3846
3845
|
|
|
3847
3846
|
|
|
3848
|
-
var params = { from: from, to: to
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
client.fetch(
|
|
3847
|
+
var params = _extends({}, _this.params, { from: from, to: to
|
|
3848
|
+
// const queryUpdated = query.replace('$from', params.from).replace('$to', params.to)
|
|
3849
|
+
// const query = '*[_type == "article" && defined(title) && defined(thumbnail)][$from...$to] { title, summary, thumbnail { asset-> }, url }'
|
|
3850
|
+
});client.fetch(query, params).then(function (dataArr) {
|
|
3852
3851
|
if (_this.pointer && _this.pointerArray) {
|
|
3853
3852
|
var pointer = _this.pointer;
|
|
3854
3853
|
dataArr = dataArr[_this.pointerArray][pointer];
|
|
@@ -3878,8 +3877,8 @@ var DeckContent = function (_React$Component) {
|
|
|
3878
3877
|
var builder = imageUrlBuilder(client);
|
|
3879
3878
|
return builder.image(source);
|
|
3880
3879
|
}, _this.renderCardImage = function (row, page) {
|
|
3881
|
-
if (row.thumbnail
|
|
3882
|
-
return _this.urlFor(row.thumbnail
|
|
3880
|
+
if (row.thumbnail) {
|
|
3881
|
+
return _this.urlFor(row.thumbnail).url();
|
|
3883
3882
|
} else {
|
|
3884
3883
|
return _this.defaultImage;
|
|
3885
3884
|
}
|
|
@@ -3891,7 +3890,6 @@ var DeckContent = function (_React$Component) {
|
|
|
3891
3890
|
var currentPage = _this.state.currentPage;
|
|
3892
3891
|
|
|
3893
3892
|
if (seoPaginate) {
|
|
3894
|
-
|
|
3895
3893
|
var path = router.asPath;
|
|
3896
3894
|
var qrIndex = path.indexOf('?');
|
|
3897
3895
|
var pathname = router.pathname;
|
|
@@ -3903,7 +3901,7 @@ var DeckContent = function (_React$Component) {
|
|
|
3903
3901
|
var partialQS = router.asPath.substring(qrIndex + 1);
|
|
3904
3902
|
var partialQSArr = partialQS.split('&');
|
|
3905
3903
|
|
|
3906
|
-
// exclude page=xxx from query string
|
|
3904
|
+
// exclude page=xxx from query string
|
|
3907
3905
|
partialQSArr.map(function (item) {
|
|
3908
3906
|
var itemArr = item.split('=');
|
|
3909
3907
|
var key = itemArr[0];
|
|
@@ -3922,7 +3920,6 @@ var DeckContent = function (_React$Component) {
|
|
|
3922
3920
|
pageNumber = parseInt(pageNumber);
|
|
3923
3921
|
|
|
3924
3922
|
if (currentPage !== pageNumber) {
|
|
3925
|
-
|
|
3926
3923
|
lib_3.refresh();
|
|
3927
3924
|
if (pageview) {
|
|
3928
3925
|
_this.setState({
|
|
@@ -3935,15 +3932,15 @@ var DeckContent = function (_React$Component) {
|
|
|
3935
3932
|
var newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
|
|
3936
3933
|
|
|
3937
3934
|
// please leave this for later debug purpose : Yong Jun.
|
|
3938
|
-
/*console.log('page change reported', {
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
})*/
|
|
3935
|
+
/* console.log('page change reported', {
|
|
3936
|
+
currentPage: currentPage,
|
|
3937
|
+
pageNumber: pageNumber,
|
|
3938
|
+
pathname: pathname,
|
|
3939
|
+
path: path,
|
|
3940
|
+
newPath: newPath,
|
|
3941
|
+
firstPage: pageNumber === 1,
|
|
3942
|
+
queryString: queryString
|
|
3943
|
+
}) */
|
|
3947
3944
|
|
|
3948
3945
|
pageview(newPath);
|
|
3949
3946
|
|
|
@@ -5162,12 +5159,12 @@ var DeckQueue = function (_React$Component) {
|
|
|
5162
5159
|
var client = _this.props.client;
|
|
5163
5160
|
|
|
5164
5161
|
|
|
5165
|
-
var params = { from: from, to: to
|
|
5166
|
-
|
|
5162
|
+
var params = _extends({}, _this.params, { from: from, to: to
|
|
5163
|
+
// const queryUpdated = query.replace('$from', params.from).replace('$to', params.to)
|
|
5167
5164
|
|
|
5168
|
-
if (_this.pointer && _this.pointerArray) {
|
|
5165
|
+
});if (_this.pointer && _this.pointerArray) {
|
|
5169
5166
|
var pointer = _this.pointer;
|
|
5170
|
-
client.fetch(
|
|
5167
|
+
client.fetch(query, params).then(function (dataArr) {
|
|
5171
5168
|
_this.setState(function (state, props) {
|
|
5172
5169
|
if (dataArr[_this.pointerArray][pointer].length > 0) {
|
|
5173
5170
|
return {
|
|
@@ -5182,7 +5179,7 @@ var DeckQueue = function (_React$Component) {
|
|
|
5182
5179
|
});
|
|
5183
5180
|
});
|
|
5184
5181
|
} else {
|
|
5185
|
-
client.fetch(
|
|
5182
|
+
client.fetch(query, params).then(function (dataArr) {
|
|
5186
5183
|
_this.setState(function (state, props) {
|
|
5187
5184
|
if (dataArr.length > 0) {
|
|
5188
5185
|
return {
|
|
@@ -5218,7 +5215,7 @@ var DeckQueue = function (_React$Component) {
|
|
|
5218
5215
|
null,
|
|
5219
5216
|
this.state.data && this.state.data.map(function (row, index) {
|
|
5220
5217
|
// const thumbnailURL = get(row, 'thumbnail.asset.url', this.props.defaultImage)
|
|
5221
|
-
var thumbnailURL = row.thumbnail
|
|
5218
|
+
var thumbnailURL = row.thumbnail ? _this2.urlFor(row.thumbnail).url() : _this2.props.defaultImage;
|
|
5222
5219
|
return React__default.createElement(
|
|
5223
5220
|
Col,
|
|
5224
5221
|
{ key: index, md: 12, lg: lgVar, style: { display: 'flex', flex: '1 0 auto' } },
|
|
@@ -5335,13 +5332,7 @@ var ThumbnailCard = function ThumbnailCard(_ref) {
|
|
|
5335
5332
|
return React__default.createElement(
|
|
5336
5333
|
Media,
|
|
5337
5334
|
{ className: 'mb-3 thumbnail-card' },
|
|
5338
|
-
React__default.createElement('img', {
|
|
5339
|
-
width: size,
|
|
5340
|
-
height: size,
|
|
5341
|
-
className: 'mr-3',
|
|
5342
|
-
src: item.thumbnail && item.thumbnail.asset ? urlFor(item.thumbnail.asset).url() : defaultImage,
|
|
5343
|
-
alt: 'Generic placeholder'
|
|
5344
|
-
}),
|
|
5335
|
+
React__default.createElement('img', { width: size, height: size, className: 'mr-3', src: item.thumbnail ? urlFor(item.thumbnail).url() : defaultImage, alt: 'Generic placeholder' }),
|
|
5345
5336
|
React__default.createElement(
|
|
5346
5337
|
Media.Body,
|
|
5347
5338
|
null,
|
|
@@ -7386,14 +7377,17 @@ var AD300x250x600 = function AD300x250x600(_ref) {
|
|
|
7386
7377
|
};
|
|
7387
7378
|
|
|
7388
7379
|
var FigureComponent = function FigureComponent(_ref) {
|
|
7389
|
-
var
|
|
7390
|
-
_ref$widthP = _ref.widthP,
|
|
7391
|
-
widthP = _ref$widthP === undefined ? '100' : _ref$widthP,
|
|
7392
|
-
_ref$alignment = _ref.alignment,
|
|
7393
|
-
alignment = _ref$alignment === undefined ? 'center' : _ref$alignment,
|
|
7394
|
-
asset = _ref.asset,
|
|
7380
|
+
var node$$1 = _ref.node,
|
|
7395
7381
|
client = _ref.client;
|
|
7396
|
-
|
|
7382
|
+
var caption = node$$1.caption,
|
|
7383
|
+
asset = node$$1.asset,
|
|
7384
|
+
alt = node$$1.alt,
|
|
7385
|
+
blank = node$$1.blank,
|
|
7386
|
+
link = node$$1.link,
|
|
7387
|
+
_node$widthP = node$$1.widthP,
|
|
7388
|
+
widthP = _node$widthP === undefined ? '100' : _node$widthP,
|
|
7389
|
+
_node$alignment = node$$1.alignment,
|
|
7390
|
+
alignment = _node$alignment === undefined ? 'center' : _node$alignment;
|
|
7397
7391
|
|
|
7398
7392
|
var builder = imageUrlBuilder(client);
|
|
7399
7393
|
|
|
@@ -7401,13 +7395,33 @@ var FigureComponent = function FigureComponent(_ref) {
|
|
|
7401
7395
|
return builder.image(source);
|
|
7402
7396
|
};
|
|
7403
7397
|
var imgWidth = widthP + '%';
|
|
7398
|
+
var imgFloat = alignment.toLowerCase() === 'center' ? 'none' : alignment.toLowerCase();
|
|
7399
|
+
var figureMargin = void 0;
|
|
7400
|
+
if (imgFloat === 'none') {
|
|
7401
|
+
figureMargin = '0 auto 2rem';
|
|
7402
|
+
}
|
|
7403
|
+
if (imgFloat === 'left') {
|
|
7404
|
+
figureMargin = '0 2rem 2rem 0';
|
|
7405
|
+
}
|
|
7406
|
+
if (imgFloat === 'right') {
|
|
7407
|
+
figureMargin = '0 0 2rem 2rem';
|
|
7408
|
+
}
|
|
7404
7409
|
return React__default.createElement(
|
|
7405
|
-
|
|
7406
|
-
{ style: {
|
|
7407
|
-
React__default.createElement(
|
|
7408
|
-
|
|
7409
|
-
{
|
|
7410
|
-
React__default.createElement(Figure.Image, { src: urlFor(asset).url() }),
|
|
7410
|
+
Figure,
|
|
7411
|
+
{ className: 'd-block text-center mb-3', style: { width: imgWidth, float: imgFloat, margin: figureMargin } },
|
|
7412
|
+
link ? React__default.createElement(
|
|
7413
|
+
'a',
|
|
7414
|
+
{ href: link, target: blank ? '_blank' : '_self' },
|
|
7415
|
+
React__default.createElement(Figure.Image, { src: urlFor(asset).url(), alt: alt && alt }),
|
|
7416
|
+
caption && React__default.createElement(
|
|
7417
|
+
Figure.Caption,
|
|
7418
|
+
null,
|
|
7419
|
+
caption
|
|
7420
|
+
)
|
|
7421
|
+
) : React__default.createElement(
|
|
7422
|
+
React__default.Fragment,
|
|
7423
|
+
null,
|
|
7424
|
+
React__default.createElement(Figure.Image, { src: urlFor(asset).url(), alt: alt && alt }),
|
|
7411
7425
|
caption && React__default.createElement(
|
|
7412
7426
|
Figure.Caption,
|
|
7413
7427
|
null,
|
|
@@ -7436,7 +7450,7 @@ var Slideshow = function Slideshow(_ref) {
|
|
|
7436
7450
|
return React__default.createElement(
|
|
7437
7451
|
Carousel.Item,
|
|
7438
7452
|
{ key: slide._key },
|
|
7439
|
-
React__default.createElement('img', { src: urlFor(slide
|
|
7453
|
+
React__default.createElement('img', { src: urlFor(slide).url(), style: { width: '100%' } })
|
|
7440
7454
|
);
|
|
7441
7455
|
})
|
|
7442
7456
|
)
|
|
@@ -11086,17 +11100,43 @@ var Media$1 = function Media$$1(_ref) {
|
|
|
11086
11100
|
return builder.image(source);
|
|
11087
11101
|
};
|
|
11088
11102
|
|
|
11103
|
+
var renderFigure = function renderFigure(uploadDoc, poster, blank, caption) {
|
|
11104
|
+
if (uploadDoc && uploadDoc.asset && poster && poster.asset) {
|
|
11105
|
+
return React__default.createElement(
|
|
11106
|
+
Figure,
|
|
11107
|
+
{ className: 'd-block text-center mb-3' },
|
|
11108
|
+
React__default.createElement(
|
|
11109
|
+
'a',
|
|
11110
|
+
{ href: uploadDoc.asset.url, target: blank ? '_blank' : '_self' },
|
|
11111
|
+
React__default.createElement(Figure.Image, { src: urlFor(poster.asset).url(), fluid: true }),
|
|
11112
|
+
caption && React__default.createElement(
|
|
11113
|
+
Figure.Caption,
|
|
11114
|
+
null,
|
|
11115
|
+
caption
|
|
11116
|
+
)
|
|
11117
|
+
)
|
|
11118
|
+
);
|
|
11119
|
+
} else if (poster && poster.asset) {
|
|
11120
|
+
return React__default.createElement(
|
|
11121
|
+
Figure,
|
|
11122
|
+
{ className: 'd-block text-center mb-3' },
|
|
11123
|
+
React__default.createElement(Figure.Image, { src: urlFor(poster.asset).url() }),
|
|
11124
|
+
caption && React__default.createElement(
|
|
11125
|
+
Figure.Caption,
|
|
11126
|
+
null,
|
|
11127
|
+
caption
|
|
11128
|
+
)
|
|
11129
|
+
);
|
|
11130
|
+
}
|
|
11131
|
+
};
|
|
11132
|
+
|
|
11089
11133
|
return React__default.createElement(
|
|
11090
|
-
|
|
11134
|
+
React__default.Fragment,
|
|
11091
11135
|
null,
|
|
11092
|
-
uploadDoc
|
|
11136
|
+
renderFigure(uploadDoc, poster, blank, caption),
|
|
11137
|
+
!poster && uploadDoc && uploadDoc.asset && React__default.createElement(
|
|
11093
11138
|
'a',
|
|
11094
11139
|
{ href: uploadDoc.asset.url, target: blank ? '_blank' : '_self' },
|
|
11095
|
-
React__default.createElement(Figure.Image, { src: urlFor(poster.asset).url() })
|
|
11096
|
-
) : React__default.createElement(Figure.Image, { src: urlFor(poster.asset).url() }),
|
|
11097
|
-
caption && React__default.createElement(
|
|
11098
|
-
Figure.Caption,
|
|
11099
|
-
null,
|
|
11100
11140
|
caption
|
|
11101
11141
|
)
|
|
11102
11142
|
);
|
|
@@ -11113,12 +11153,8 @@ var getSerializers$1 = function getSerializers(client) {
|
|
|
11113
11153
|
},
|
|
11114
11154
|
figure: function figure(_ref2) {
|
|
11115
11155
|
var node = _ref2.node;
|
|
11116
|
-
var asset = node.asset,
|
|
11117
|
-
caption = node.caption,
|
|
11118
|
-
widthP = node.widthP,
|
|
11119
|
-
alignment = node.alignment;
|
|
11120
11156
|
|
|
11121
|
-
return React__default.createElement(FigureComponent, {
|
|
11157
|
+
return React__default.createElement(FigureComponent, { node: node, client: client });
|
|
11122
11158
|
},
|
|
11123
11159
|
slideshow: function slideshow(_ref3) {
|
|
11124
11160
|
var node = _ref3.node;
|