@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/dist/index.js
CHANGED
|
@@ -3830,8 +3830,7 @@ var DeckContent = function (_React$Component) {
|
|
|
3830
3830
|
currentPage: _this.props.currentPage || 1
|
|
3831
3831
|
}, _this.loadMore = debounce_1(function () {
|
|
3832
3832
|
_this.setState(function (state) {
|
|
3833
|
-
var
|
|
3834
|
-
page = state.page,
|
|
3833
|
+
var page = state.page,
|
|
3835
3834
|
from = state.from,
|
|
3836
3835
|
per = state.per,
|
|
3837
3836
|
to = state.to;
|
|
@@ -3852,10 +3851,10 @@ var DeckContent = function (_React$Component) {
|
|
|
3852
3851
|
var client = _this.props.client;
|
|
3853
3852
|
|
|
3854
3853
|
|
|
3855
|
-
var params = { from: from, to: to
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
client.fetch(
|
|
3854
|
+
var params = _extends({}, _this.params, { from: from, to: to
|
|
3855
|
+
// const queryUpdated = query.replace('$from', params.from).replace('$to', params.to)
|
|
3856
|
+
// const query = '*[_type == "article" && defined(title) && defined(thumbnail)][$from...$to] { title, summary, thumbnail { asset-> }, url }'
|
|
3857
|
+
});client.fetch(query, params).then(function (dataArr) {
|
|
3859
3858
|
if (_this.pointer && _this.pointerArray) {
|
|
3860
3859
|
var pointer = _this.pointer;
|
|
3861
3860
|
dataArr = dataArr[_this.pointerArray][pointer];
|
|
@@ -3885,8 +3884,8 @@ var DeckContent = function (_React$Component) {
|
|
|
3885
3884
|
var builder = imageUrlBuilder(client);
|
|
3886
3885
|
return builder.image(source);
|
|
3887
3886
|
}, _this.renderCardImage = function (row, page) {
|
|
3888
|
-
if (row.thumbnail
|
|
3889
|
-
return _this.urlFor(row.thumbnail
|
|
3887
|
+
if (row.thumbnail) {
|
|
3888
|
+
return _this.urlFor(row.thumbnail).url();
|
|
3890
3889
|
} else {
|
|
3891
3890
|
return _this.defaultImage;
|
|
3892
3891
|
}
|
|
@@ -3898,7 +3897,6 @@ var DeckContent = function (_React$Component) {
|
|
|
3898
3897
|
var currentPage = _this.state.currentPage;
|
|
3899
3898
|
|
|
3900
3899
|
if (seoPaginate) {
|
|
3901
|
-
|
|
3902
3900
|
var path = router$$1.asPath;
|
|
3903
3901
|
var qrIndex = path.indexOf('?');
|
|
3904
3902
|
var pathname = router$$1.pathname;
|
|
@@ -3910,7 +3908,7 @@ var DeckContent = function (_React$Component) {
|
|
|
3910
3908
|
var partialQS = router$$1.asPath.substring(qrIndex + 1);
|
|
3911
3909
|
var partialQSArr = partialQS.split('&');
|
|
3912
3910
|
|
|
3913
|
-
// exclude page=xxx from query string
|
|
3911
|
+
// exclude page=xxx from query string
|
|
3914
3912
|
partialQSArr.map(function (item) {
|
|
3915
3913
|
var itemArr = item.split('=');
|
|
3916
3914
|
var key = itemArr[0];
|
|
@@ -3929,7 +3927,6 @@ var DeckContent = function (_React$Component) {
|
|
|
3929
3927
|
pageNumber = parseInt(pageNumber);
|
|
3930
3928
|
|
|
3931
3929
|
if (currentPage !== pageNumber) {
|
|
3932
|
-
|
|
3933
3930
|
lib_3.refresh();
|
|
3934
3931
|
if (pageview) {
|
|
3935
3932
|
_this.setState({
|
|
@@ -3942,15 +3939,15 @@ var DeckContent = function (_React$Component) {
|
|
|
3942
3939
|
var newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
|
|
3943
3940
|
|
|
3944
3941
|
// please leave this for later debug purpose : Yong Jun.
|
|
3945
|
-
/*console.log('page change reported', {
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
})*/
|
|
3942
|
+
/* console.log('page change reported', {
|
|
3943
|
+
currentPage: currentPage,
|
|
3944
|
+
pageNumber: pageNumber,
|
|
3945
|
+
pathname: pathname,
|
|
3946
|
+
path: path,
|
|
3947
|
+
newPath: newPath,
|
|
3948
|
+
firstPage: pageNumber === 1,
|
|
3949
|
+
queryString: queryString
|
|
3950
|
+
}) */
|
|
3954
3951
|
|
|
3955
3952
|
pageview(newPath);
|
|
3956
3953
|
|
|
@@ -5169,12 +5166,12 @@ var DeckQueue = function (_React$Component) {
|
|
|
5169
5166
|
var client = _this.props.client;
|
|
5170
5167
|
|
|
5171
5168
|
|
|
5172
|
-
var params = { from: from, to: to
|
|
5173
|
-
|
|
5169
|
+
var params = _extends({}, _this.params, { from: from, to: to
|
|
5170
|
+
// const queryUpdated = query.replace('$from', params.from).replace('$to', params.to)
|
|
5174
5171
|
|
|
5175
|
-
if (_this.pointer && _this.pointerArray) {
|
|
5172
|
+
});if (_this.pointer && _this.pointerArray) {
|
|
5176
5173
|
var pointer = _this.pointer;
|
|
5177
|
-
client.fetch(
|
|
5174
|
+
client.fetch(query, params).then(function (dataArr) {
|
|
5178
5175
|
_this.setState(function (state, props) {
|
|
5179
5176
|
if (dataArr[_this.pointerArray][pointer].length > 0) {
|
|
5180
5177
|
return {
|
|
@@ -5189,7 +5186,7 @@ var DeckQueue = function (_React$Component) {
|
|
|
5189
5186
|
});
|
|
5190
5187
|
});
|
|
5191
5188
|
} else {
|
|
5192
|
-
client.fetch(
|
|
5189
|
+
client.fetch(query, params).then(function (dataArr) {
|
|
5193
5190
|
_this.setState(function (state, props) {
|
|
5194
5191
|
if (dataArr.length > 0) {
|
|
5195
5192
|
return {
|
|
@@ -5225,7 +5222,7 @@ var DeckQueue = function (_React$Component) {
|
|
|
5225
5222
|
null,
|
|
5226
5223
|
this.state.data && this.state.data.map(function (row, index) {
|
|
5227
5224
|
// const thumbnailURL = get(row, 'thumbnail.asset.url', this.props.defaultImage)
|
|
5228
|
-
var thumbnailURL = row.thumbnail
|
|
5225
|
+
var thumbnailURL = row.thumbnail ? _this2.urlFor(row.thumbnail).url() : _this2.props.defaultImage;
|
|
5229
5226
|
return React__default.createElement(
|
|
5230
5227
|
Col,
|
|
5231
5228
|
{ key: index, md: 12, lg: lgVar, style: { display: 'flex', flex: '1 0 auto' } },
|
|
@@ -5342,13 +5339,7 @@ var ThumbnailCard = function ThumbnailCard(_ref) {
|
|
|
5342
5339
|
return React__default.createElement(
|
|
5343
5340
|
Media,
|
|
5344
5341
|
{ className: 'mb-3 thumbnail-card' },
|
|
5345
|
-
React__default.createElement('img', {
|
|
5346
|
-
width: size,
|
|
5347
|
-
height: size,
|
|
5348
|
-
className: 'mr-3',
|
|
5349
|
-
src: item.thumbnail && item.thumbnail.asset ? urlFor(item.thumbnail.asset).url() : defaultImage,
|
|
5350
|
-
alt: 'Generic placeholder'
|
|
5351
|
-
}),
|
|
5342
|
+
React__default.createElement('img', { width: size, height: size, className: 'mr-3', src: item.thumbnail ? urlFor(item.thumbnail).url() : defaultImage, alt: 'Generic placeholder' }),
|
|
5352
5343
|
React__default.createElement(
|
|
5353
5344
|
Media.Body,
|
|
5354
5345
|
null,
|
|
@@ -7393,14 +7384,17 @@ var AD300x250x600 = function AD300x250x600(_ref) {
|
|
|
7393
7384
|
};
|
|
7394
7385
|
|
|
7395
7386
|
var FigureComponent = function FigureComponent(_ref) {
|
|
7396
|
-
var
|
|
7397
|
-
_ref$widthP = _ref.widthP,
|
|
7398
|
-
widthP = _ref$widthP === undefined ? '100' : _ref$widthP,
|
|
7399
|
-
_ref$alignment = _ref.alignment,
|
|
7400
|
-
alignment = _ref$alignment === undefined ? 'center' : _ref$alignment,
|
|
7401
|
-
asset = _ref.asset,
|
|
7387
|
+
var node$$1 = _ref.node,
|
|
7402
7388
|
client = _ref.client;
|
|
7403
|
-
|
|
7389
|
+
var caption = node$$1.caption,
|
|
7390
|
+
asset = node$$1.asset,
|
|
7391
|
+
alt = node$$1.alt,
|
|
7392
|
+
blank = node$$1.blank,
|
|
7393
|
+
link = node$$1.link,
|
|
7394
|
+
_node$widthP = node$$1.widthP,
|
|
7395
|
+
widthP = _node$widthP === undefined ? '100' : _node$widthP,
|
|
7396
|
+
_node$alignment = node$$1.alignment,
|
|
7397
|
+
alignment = _node$alignment === undefined ? 'center' : _node$alignment;
|
|
7404
7398
|
|
|
7405
7399
|
var builder = imageUrlBuilder(client);
|
|
7406
7400
|
|
|
@@ -7408,13 +7402,33 @@ var FigureComponent = function FigureComponent(_ref) {
|
|
|
7408
7402
|
return builder.image(source);
|
|
7409
7403
|
};
|
|
7410
7404
|
var imgWidth = widthP + '%';
|
|
7405
|
+
var imgFloat = alignment.toLowerCase() === 'center' ? 'none' : alignment.toLowerCase();
|
|
7406
|
+
var figureMargin = void 0;
|
|
7407
|
+
if (imgFloat === 'none') {
|
|
7408
|
+
figureMargin = '0 auto 2rem';
|
|
7409
|
+
}
|
|
7410
|
+
if (imgFloat === 'left') {
|
|
7411
|
+
figureMargin = '0 2rem 2rem 0';
|
|
7412
|
+
}
|
|
7413
|
+
if (imgFloat === 'right') {
|
|
7414
|
+
figureMargin = '0 0 2rem 2rem';
|
|
7415
|
+
}
|
|
7411
7416
|
return React__default.createElement(
|
|
7412
|
-
|
|
7413
|
-
{ style: {
|
|
7414
|
-
React__default.createElement(
|
|
7415
|
-
|
|
7416
|
-
{
|
|
7417
|
-
React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(asset).url() }),
|
|
7417
|
+
reactBootstrap.Figure,
|
|
7418
|
+
{ className: 'd-block text-center mb-3', style: { width: imgWidth, float: imgFloat, margin: figureMargin } },
|
|
7419
|
+
link ? React__default.createElement(
|
|
7420
|
+
'a',
|
|
7421
|
+
{ href: link, target: blank ? '_blank' : '_self' },
|
|
7422
|
+
React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(asset).url(), alt: alt && alt }),
|
|
7423
|
+
caption && React__default.createElement(
|
|
7424
|
+
reactBootstrap.Figure.Caption,
|
|
7425
|
+
null,
|
|
7426
|
+
caption
|
|
7427
|
+
)
|
|
7428
|
+
) : React__default.createElement(
|
|
7429
|
+
React__default.Fragment,
|
|
7430
|
+
null,
|
|
7431
|
+
React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(asset).url(), alt: alt && alt }),
|
|
7418
7432
|
caption && React__default.createElement(
|
|
7419
7433
|
reactBootstrap.Figure.Caption,
|
|
7420
7434
|
null,
|
|
@@ -7443,7 +7457,7 @@ var Slideshow = function Slideshow(_ref) {
|
|
|
7443
7457
|
return React__default.createElement(
|
|
7444
7458
|
reactBootstrap.Carousel.Item,
|
|
7445
7459
|
{ key: slide._key },
|
|
7446
|
-
React__default.createElement('img', { src: urlFor(slide
|
|
7460
|
+
React__default.createElement('img', { src: urlFor(slide).url(), style: { width: '100%' } })
|
|
7447
7461
|
);
|
|
7448
7462
|
})
|
|
7449
7463
|
)
|
|
@@ -11093,17 +11107,43 @@ var Media$1 = function Media$$1(_ref) {
|
|
|
11093
11107
|
return builder.image(source);
|
|
11094
11108
|
};
|
|
11095
11109
|
|
|
11110
|
+
var renderFigure = function renderFigure(uploadDoc, poster, blank, caption) {
|
|
11111
|
+
if (uploadDoc && uploadDoc.asset && poster && poster.asset) {
|
|
11112
|
+
return React__default.createElement(
|
|
11113
|
+
reactBootstrap.Figure,
|
|
11114
|
+
{ className: 'd-block text-center mb-3' },
|
|
11115
|
+
React__default.createElement(
|
|
11116
|
+
'a',
|
|
11117
|
+
{ href: uploadDoc.asset.url, target: blank ? '_blank' : '_self' },
|
|
11118
|
+
React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(poster.asset).url(), fluid: true }),
|
|
11119
|
+
caption && React__default.createElement(
|
|
11120
|
+
reactBootstrap.Figure.Caption,
|
|
11121
|
+
null,
|
|
11122
|
+
caption
|
|
11123
|
+
)
|
|
11124
|
+
)
|
|
11125
|
+
);
|
|
11126
|
+
} else if (poster && poster.asset) {
|
|
11127
|
+
return React__default.createElement(
|
|
11128
|
+
reactBootstrap.Figure,
|
|
11129
|
+
{ className: 'd-block text-center mb-3' },
|
|
11130
|
+
React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(poster.asset).url() }),
|
|
11131
|
+
caption && React__default.createElement(
|
|
11132
|
+
reactBootstrap.Figure.Caption,
|
|
11133
|
+
null,
|
|
11134
|
+
caption
|
|
11135
|
+
)
|
|
11136
|
+
);
|
|
11137
|
+
}
|
|
11138
|
+
};
|
|
11139
|
+
|
|
11096
11140
|
return React__default.createElement(
|
|
11097
|
-
|
|
11141
|
+
React__default.Fragment,
|
|
11098
11142
|
null,
|
|
11099
|
-
uploadDoc
|
|
11143
|
+
renderFigure(uploadDoc, poster, blank, caption),
|
|
11144
|
+
!poster && uploadDoc && uploadDoc.asset && React__default.createElement(
|
|
11100
11145
|
'a',
|
|
11101
11146
|
{ href: uploadDoc.asset.url, target: blank ? '_blank' : '_self' },
|
|
11102
|
-
React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(poster.asset).url() })
|
|
11103
|
-
) : React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(poster.asset).url() }),
|
|
11104
|
-
caption && React__default.createElement(
|
|
11105
|
-
reactBootstrap.Figure.Caption,
|
|
11106
|
-
null,
|
|
11107
11147
|
caption
|
|
11108
11148
|
)
|
|
11109
11149
|
);
|
|
@@ -11120,12 +11160,8 @@ var getSerializers$1 = function getSerializers(client) {
|
|
|
11120
11160
|
},
|
|
11121
11161
|
figure: function figure(_ref2) {
|
|
11122
11162
|
var node = _ref2.node;
|
|
11123
|
-
var asset = node.asset,
|
|
11124
|
-
caption = node.caption,
|
|
11125
|
-
widthP = node.widthP,
|
|
11126
|
-
alignment = node.alignment;
|
|
11127
11163
|
|
|
11128
|
-
return React__default.createElement(FigureComponent, {
|
|
11164
|
+
return React__default.createElement(FigureComponent, { node: node, client: client });
|
|
11129
11165
|
},
|
|
11130
11166
|
slideshow: function slideshow(_ref3) {
|
|
11131
11167
|
var node = _ref3.node;
|