@mjhls/mjh-framework 1.0.204 → 1.0.206

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.
Files changed (74) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/AD-e2479b7c.js +31 -0
  3. package/dist/cjs/DeckContent.js +430 -0
  4. package/dist/cjs/DeckQueue.js +366 -0
  5. package/dist/cjs/Dfp-d94f7f73.js +97 -0
  6. package/dist/cjs/GridContent.js +613 -0
  7. package/dist/cjs/GroupDeck.js +156 -0
  8. package/dist/cjs/IssueContentDeck.js +81 -0
  9. package/dist/cjs/IssueDeck.js +144 -0
  10. package/dist/cjs/MasterDeck.js +340 -0
  11. package/dist/cjs/Normal-7dd8c339.js +2374 -0
  12. package/dist/cjs/PublicationDeck.js +81 -0
  13. package/dist/cjs/QueueDeckExpanded.js +559 -0
  14. package/dist/cjs/TaxonomyCard-7b5b4298.js +1045 -0
  15. package/dist/cjs/TaxonomyCard.js +18 -0
  16. package/dist/cjs/TemplateNormal.js +29 -0
  17. package/dist/cjs/ThumbnailCard.js +58 -0
  18. package/dist/cjs/Ustream-0d3dd953.js +122 -0
  19. package/dist/cjs/Ustream.js +10 -0
  20. package/dist/cjs/VideoSeriesListing.js +248 -0
  21. package/dist/cjs/YoutubeGroup-4cf7a4aa.js +228 -0
  22. package/dist/cjs/YoutubeGroup.js +13 -0
  23. package/dist/cjs/_babelHelpers-f321c258.js +119 -0
  24. package/dist/cjs/_commonjsHelpers-3fc1f64e.js +20 -0
  25. package/dist/cjs/debounce-286eb3fb.js +279 -0
  26. package/dist/cjs/entities-3e0b4a16.js +506 -0
  27. package/dist/cjs/get-06aac51b.js +992 -0
  28. package/dist/cjs/index-0d0efcfa.js +610 -0
  29. package/dist/cjs/index-a4c53ff4.js +551 -0
  30. package/dist/cjs/index.es-2289df51.js +5028 -0
  31. package/dist/cjs/index.esm-340d3792.js +113 -0
  32. package/dist/cjs/index.js +12044 -0
  33. package/dist/cjs/isSymbol-311eb805.js +209 -0
  34. package/dist/cjs/main-58839f4e.js +858 -0
  35. package/dist/cjs/visibility-sensor-5c5a7302.js +2251 -0
  36. package/dist/esm/AD-1b2a3dd3.js +26 -0
  37. package/dist/esm/DeckContent.js +424 -0
  38. package/dist/esm/DeckQueue.js +360 -0
  39. package/dist/esm/Dfp-ab7941d3.js +92 -0
  40. package/dist/esm/GridContent.js +607 -0
  41. package/dist/esm/GroupDeck.js +151 -0
  42. package/dist/esm/IssueContentDeck.js +76 -0
  43. package/dist/esm/IssueDeck.js +139 -0
  44. package/dist/esm/MasterDeck.js +334 -0
  45. package/dist/esm/Normal-403c5666.js +2354 -0
  46. package/dist/esm/PublicationDeck.js +76 -0
  47. package/dist/esm/QueueDeckExpanded.js +553 -0
  48. package/dist/esm/TaxonomyCard-f9c93953.js +1039 -0
  49. package/dist/esm/TaxonomyCard.js +12 -0
  50. package/dist/esm/TemplateNormal.js +23 -0
  51. package/dist/esm/ThumbnailCard.js +53 -0
  52. package/dist/esm/Ustream-6bb45fe7.js +116 -0
  53. package/dist/esm/Ustream.js +4 -0
  54. package/dist/esm/VideoSeriesListing.js +242 -0
  55. package/dist/esm/YoutubeGroup-dc617e8b.js +222 -0
  56. package/dist/esm/YoutubeGroup.js +7 -0
  57. package/dist/esm/_babelHelpers-67c05996.js +111 -0
  58. package/dist/esm/_commonjsHelpers-ae1b5db5.js +15 -0
  59. package/dist/esm/debounce-a0242b4a.js +277 -0
  60. package/dist/esm/entities-e85d3a4a.js +503 -0
  61. package/dist/esm/get-b684ff61.js +990 -0
  62. package/dist/esm/index-3c1ee9ab.js +605 -0
  63. package/dist/esm/index-ca4ff5cb.js +548 -0
  64. package/dist/esm/index.es-f369b3e8.js +5022 -0
  65. package/dist/esm/index.esm-536609db.js +103 -0
  66. package/dist/esm/index.js +11991 -0
  67. package/dist/esm/isSymbol-c2b7d05a.js +203 -0
  68. package/dist/esm/main-dea495b7.js +851 -0
  69. package/dist/esm/visibility-sensor-3cfe6713.js +2243 -0
  70. package/package.json +8 -7
  71. package/dist/index.es.js +0 -30261
  72. package/dist/index.es.js.map +0 -1
  73. package/dist/index.js +0 -30320
  74. package/dist/index.js.map +0 -1
@@ -0,0 +1,26 @@
1
+ import React__default, { Suspense } from 'react';
2
+
3
+ var Dfp = React__default.lazy(function () {
4
+ return import('./Dfp-ab7941d3.js');
5
+ });
6
+
7
+ var AD = function AD(props) {
8
+ if (typeof window === 'undefined') {
9
+ return null;
10
+ }
11
+ return React__default.createElement(
12
+ 'div',
13
+ null,
14
+ React__default.createElement(
15
+ Suspense,
16
+ { fallback: React__default.createElement(
17
+ 'div',
18
+ null,
19
+ 'Loading...'
20
+ ) },
21
+ React__default.createElement(Dfp, props)
22
+ )
23
+ );
24
+ };
25
+
26
+ export { AD as A };
@@ -0,0 +1,424 @@
1
+ import React__default from 'react';
2
+ import './_commonjsHelpers-ae1b5db5.js';
3
+ import { l as lib_3, V as VisibilitySensor } from './visibility-sensor-3cfe6713.js';
4
+ import 'prop-types';
5
+ import Container from 'react-bootstrap/Container';
6
+ import Row from 'react-bootstrap/Row';
7
+ import Col from 'react-bootstrap/Col';
8
+ import Card from 'react-bootstrap/Card';
9
+ import { I as InfiniteScroll, m as moment } from './index.es-f369b3e8.js';
10
+ import 'next/link';
11
+ import { withRouter } from 'next/router';
12
+ import './isSymbol-c2b7d05a.js';
13
+ import { d as debounce_1 } from './debounce-a0242b4a.js';
14
+ import 'react-dom';
15
+ import { i as imageUrlBuilder } from './index-ca4ff5cb.js';
16
+ import { L as LazyLoad } from './index-3c1ee9ab.js';
17
+ import { a as main_36 } from './main-dea495b7.js';
18
+ import { c as clean_html_1 } from './entities-e85d3a4a.js';
19
+ import { i as inherits, c as createClass, a as classCallCheck, p as possibleConstructorReturn, _ as _extends, t as toConsumableArray } from './_babelHelpers-67c05996.js';
20
+
21
+ var DeckContent = function (_React$Component) {
22
+ inherits(DeckContent, _React$Component);
23
+
24
+ function DeckContent() {
25
+ var _ref;
26
+
27
+ var _temp, _this, _ret;
28
+
29
+ classCallCheck(this, DeckContent);
30
+
31
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
32
+ args[_key] = arguments[_key];
33
+ }
34
+
35
+ return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref = DeckContent.__proto__ || Object.getPrototypeOf(DeckContent)).call.apply(_ref, [this].concat(args))), _this), _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 = {
36
+ data: _this.data,
37
+ dataKeptToCompareNewDatarecord: _this.data,
38
+ per: _this.params ? _this.params.to : 2,
39
+ page: _this.props.currentPage || 1,
40
+ from: _this.params ? _this.params.from : 0,
41
+ to: _this.params ? _this.params.to : 2,
42
+ total_pages: null,
43
+ scrolling: true,
44
+ query: _this.query,
45
+ currentPage: _this.props.currentPage || 1
46
+ }, _this.loadMore = debounce_1(function () {
47
+ _this.setState(function (state) {
48
+ var page = state.page,
49
+ from = state.from,
50
+ per = state.per,
51
+ to = state.to;
52
+
53
+ return {
54
+ page: page + 1,
55
+ from: from + per,
56
+ to: to + per
57
+ };
58
+ }, _this.loadData);
59
+ }, 0), _this.loadData = function () {
60
+ var _this$state = _this.state,
61
+ from = _this$state.from,
62
+ to = _this$state.to,
63
+ data = _this$state.data,
64
+ query = _this$state.query,
65
+ page = _this$state.page;
66
+ var client = _this.props.client;
67
+
68
+
69
+ var params = _extends({}, _this.params, { from: from, to: to
70
+ // const queryUpdated = query.replace('$from', params.from).replace('$to', params.to)
71
+ // const query = '*[_type == "article" && defined(title) && defined(thumbnail)][$from...$to] { title, summary, thumbnail { asset-> }, url }'
72
+ });client.fetch(query, params).then(function (dataArr) {
73
+ if (_this.pointer && _this.pointerArray) {
74
+ var pointer = _this.pointer;
75
+ dataArr = dataArr[_this.pointerArray][pointer];
76
+ }
77
+ dataArr = dataArr.map(function (item) {
78
+ return _extends({}, item, {
79
+ pageNumber: page
80
+ });
81
+ });
82
+
83
+ _this.setState(function () {
84
+ if (dataArr.length > 0) {
85
+ return {
86
+ data: [].concat(toConsumableArray(data), toConsumableArray(dataArr)),
87
+ scrolling: true
88
+ };
89
+ } else {
90
+ return {
91
+ scrolling: false
92
+ };
93
+ }
94
+ });
95
+ });
96
+ }, _this.urlFor = function (source) {
97
+ var client = _this.props.client;
98
+
99
+ var builder = imageUrlBuilder(client);
100
+ return builder.image(source).auto('format');
101
+ }, _this.renderCardImage = function (row, page) {
102
+ if (row.thumbnail && row.thumbnail.asset) {
103
+ var url = _this.urlFor(row.thumbnail);
104
+ if (_this.props.imageHeight) url = url.height(_this.props.imageHeight);
105
+ if (_this.props.imageWidth) url = url.width(_this.props.imageWidth);
106
+ return url.url();
107
+ } else {
108
+ return _this.defaultImage;
109
+ }
110
+ }, _this.changePageNumber = function (pageNumber) {
111
+ var _this$props = _this.props,
112
+ seoPaginate = _this$props.seoPaginate,
113
+ pageview = _this$props.pageview,
114
+ router = _this$props.router;
115
+ var currentPage = _this.state.currentPage;
116
+
117
+ if (seoPaginate) {
118
+ var path = router.asPath;
119
+ var qrIndex = path.indexOf('?');
120
+ var pathname = router.pathname;
121
+ var queryString = '';
122
+
123
+ if (qrIndex > 0) {
124
+ path = path.substring(1, qrIndex);
125
+
126
+ var partialQS = router.asPath.substring(qrIndex + 1);
127
+ var partialQSArr = partialQS.split('&');
128
+
129
+ // exclude page=xxx from query string
130
+ partialQSArr.map(function (item) {
131
+ var itemArr = item.split('=');
132
+ var key = itemArr[0];
133
+ var val = itemArr[1];
134
+
135
+ if (key !== 'page') {
136
+ queryString += (queryString.length === 0 ? '' : '&') + key + '=' + val;
137
+ }
138
+ });
139
+ }
140
+
141
+ if (queryString.length > 0) {
142
+ path += '?' + queryString;
143
+ }
144
+
145
+ pageNumber = parseInt(pageNumber);
146
+
147
+ if (currentPage !== pageNumber) {
148
+ lib_3.refresh();
149
+
150
+ _this.setState({
151
+ currentPage: pageNumber
152
+ }, function () {
153
+ if (path[0] !== '/') {
154
+ path = '/' + path;
155
+ }
156
+
157
+ var newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
158
+
159
+ // please leave this for later debug purpose : Yong Jun.
160
+ /* console.log('page change reported', {
161
+ currentPage: currentPage,
162
+ pageNumber: pageNumber,
163
+ pathname: pathname,
164
+ path: path,
165
+ newPath: newPath,
166
+ firstPage: pageNumber === 1,
167
+ queryString: queryString
168
+ }) */
169
+
170
+ if (pageview) {
171
+ pageview(newPath);
172
+ }
173
+
174
+ router.push(pathname, newPath, {
175
+ shallow: true
176
+ });
177
+ });
178
+ }
179
+ }
180
+ }, _this.renderAuthor = function (authorDetail, index, length) {
181
+ if (authorDetail) {
182
+ var _id = authorDetail._id,
183
+ displayName = authorDetail.displayName,
184
+ url = authorDetail.url;
185
+
186
+ if (displayName && url && url.current) {
187
+ return React__default.createElement(
188
+ 'div',
189
+ { key: _id },
190
+ index === 0 && React__default.createElement(
191
+ 'span',
192
+ { className: 'pr-1' },
193
+ 'By'
194
+ ),
195
+ React__default.createElement(
196
+ 'a',
197
+ { href: '/authors/${url.current}', className: 'text-muted' },
198
+ displayName,
199
+ length !== index + 1 && React__default.createElement('br', null)
200
+ )
201
+ );
202
+ } else if (displayName) {
203
+ return React__default.createElement(
204
+ 'div',
205
+ { key: _id },
206
+ index === 0 && React__default.createElement(
207
+ 'span',
208
+ { className: 'pr-1' },
209
+ 'By'
210
+ ),
211
+ React__default.createElement(
212
+ 'span',
213
+ { className: 'text-muted' },
214
+ displayName,
215
+ length !== index + 1 && React__default.createElement('br', null)
216
+ )
217
+ );
218
+ }
219
+ } else return null;
220
+ }, _this.cardLoader = function (page, columns, variant) {
221
+ var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
222
+
223
+ var itemCounter = 0;
224
+ var lgVar = 12;
225
+ var numberOfItemsBeforeAd = 6;
226
+ return React__default.createElement(
227
+ Row,
228
+ null,
229
+ _this.state.data && _this.state.data.map(function (row, index) {
230
+ if (columns === 'rotate' && itemCounter % 3 === 0) {
231
+ lgVar = 12;
232
+ } else if (columns && columns !== 'rotate') {
233
+ lgVar = Math.floor(12 / columns);
234
+ } else {
235
+ lgVar = 6;
236
+ }
237
+
238
+ var pageNumber = row.pageNumber || _this.state.page;
239
+ var contentCategoryName = row.contentCategory && row.contentCategory.name && _this.mapping[row.contentCategory.name] ? row.contentCategory.name : 'Articles';
240
+ return React__default.createElement(
241
+ React__default.Fragment,
242
+ { key: itemCounter },
243
+ React__default.createElement(
244
+ VisibilitySensor,
245
+ {
246
+ onChange: function onChange(isVisible) {
247
+ isVisible && _this.changePageNumber(pageNumber);
248
+ } },
249
+ React__default.createElement(
250
+ Col,
251
+ { md: 12, lg: lgVar, counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
252
+ React__default.createElement(
253
+ Card,
254
+ { className: 'content-card', style: { flexDirection: mode } },
255
+ (row.thumbnail && row.thumbnail.asset || _this.props.defaultImage) && React__default.createElement(
256
+ 'a',
257
+ { href: _this.mapping[contentCategoryName] + '/' + row.url.current },
258
+ React__default.createElement(
259
+ LazyLoad,
260
+ { height: _this.props.imageHeight },
261
+ React__default.createElement(Card.Img, { variant: 'top', src: _this.renderCardImage(row, page), alt: row.thumbnail && row.thumbnail.asset ? row.thumbnail.asset.originalFilename : '' })
262
+ )
263
+ ),
264
+ React__default.createElement(
265
+ Card.Body,
266
+ null,
267
+ React__default.createElement(
268
+ 'a',
269
+ { href: _this.mapping[contentCategoryName] + '/' + row.url.current },
270
+ React__default.createElement(
271
+ Card.Title,
272
+ null,
273
+ row.title
274
+ )
275
+ ),
276
+ _this.props.showPublished && row.published && React__default.createElement(
277
+ Card.Subtitle,
278
+ null,
279
+ moment(row.published).format('MMMM DD, YYYY')
280
+ ),
281
+ _this.props.showAuthor && row.authorMapping && row.authorMapping.length > 0 && row.authorMapping.map(function (authorDetail, index) {
282
+ return _this.renderAuthor(authorDetail, index, row.authorMapping.length);
283
+ }),
284
+ React__default.createElement(
285
+ Card.Text,
286
+ null,
287
+ clean_html_1(row.summary)
288
+ )
289
+ )
290
+ )
291
+ )
292
+ ),
293
+ main_36 && _this.props.rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && _this.renderMobileAd(index, numberOfItemsBeforeAd)
294
+ );
295
+ })
296
+ );
297
+ }, _this.renderMobileAd = function (index, numberOfItemsBeforeAd) {
298
+ var rightItems = _this.props.rightItems;
299
+
300
+ var i = ((index + 1) / numberOfItemsBeforeAd - 1) % rightItems.length;
301
+ return React__default.createElement(
302
+ Col,
303
+ { md: 12, style: { display: 'flex', flex: '1 0 auto' } },
304
+ rightItems[i].component
305
+ );
306
+ }, _this.renderManualPagination = function () {
307
+ var currentPage = _this.state.currentPage;
308
+
309
+ return React__default.createElement(
310
+ 'div',
311
+ { className: 'd-flex justify-content-between' },
312
+ currentPage && currentPage > 1 && React__default.createElement(
313
+ 'a',
314
+ { href: '?page=' + (currentPage - 1) },
315
+ '<< Previous'
316
+ ),
317
+ React__default.createElement(
318
+ 'a',
319
+ { href: '?page=' + (currentPage + 1) },
320
+ 'Next >>'
321
+ )
322
+ );
323
+ }, _temp), possibleConstructorReturn(_this, _ret);
324
+ }
325
+
326
+ createClass(DeckContent, [{
327
+ key: 'componentDidUpdate',
328
+ value: function componentDidUpdate(prevProps, prevState) {
329
+ if (this.state.dataKeptToCompareNewDatarecord !== this.props.dataRecord) {
330
+ // eslint-disable-next-line react/no-did-update-set-state
331
+ this.setState({
332
+ data: this.props.dataRecord,
333
+ dataKeptToCompareNewDatarecord: this.props.dataRecord,
334
+ per: this.props.params ? this.props.params.to : 2,
335
+ page: 1,
336
+ from: this.props.params ? this.props.params.from : 0,
337
+ to: this.props.params ? this.props.params.to : 2,
338
+ total_pages: null,
339
+ scrolling: true,
340
+ query: this.props.query
341
+ });
342
+ }
343
+ }
344
+ }, {
345
+ key: 'componentDidMount',
346
+ value: function componentDidMount() {
347
+ // this.loadData();
348
+ }
349
+ }, {
350
+ key: 'render',
351
+ value: function render() {
352
+ var _this2 = this;
353
+
354
+ var _props = this.props,
355
+ columns = _props.columns,
356
+ variant = _props.variant,
357
+ autoScroll = _props.autoScroll,
358
+ page = _props.page;
359
+
360
+
361
+ return React__default.createElement(
362
+ 'div',
363
+ { className: 'contentDeck' },
364
+ autoScroll ? React__default.createElement(
365
+ React__default.Fragment,
366
+ null,
367
+ React__default.createElement(
368
+ InfiniteScroll,
369
+ { dataLength: this.state.data.length, next: this.loadMore, hasMore: this.state.scrolling, scrollThreshold: 0.9 },
370
+ React__default.createElement(
371
+ Container,
372
+ null,
373
+ this.cardLoader(page, columns, variant)
374
+ )
375
+ ),
376
+ React__default.createElement(
377
+ 'noscript',
378
+ null,
379
+ this.renderManualPagination()
380
+ )
381
+ ) : React__default.createElement(
382
+ React__default.Fragment,
383
+ null,
384
+ React__default.createElement(
385
+ Container,
386
+ null,
387
+ this.cardLoader(page, columns, variant)
388
+ ),
389
+ React__default.createElement(
390
+ 'div',
391
+ { style: { padding: '0px 10px' } },
392
+ this.state.scrolling ? React__default.createElement(
393
+ 'button',
394
+ {
395
+ style: { margin: 'auto', width: '100%' },
396
+ onClick: function onClick(e) {
397
+ _this2.loadMore();
398
+ } },
399
+ 'Load More'
400
+ ) : React__default.createElement(
401
+ 'p',
402
+ { style: { textAlign: 'center' } },
403
+ React__default.createElement(
404
+ 'b',
405
+ null,
406
+ 'End of data'
407
+ )
408
+ )
409
+ ),
410
+ React__default.createElement(
411
+ 'noscript',
412
+ null,
413
+ this.renderManualPagination()
414
+ )
415
+ )
416
+ );
417
+ }
418
+ }]);
419
+ return DeckContent;
420
+ }(React__default.Component);
421
+
422
+ var ContentCard = withRouter(DeckContent);
423
+
424
+ export default ContentCard;