@mjhls/mjh-framework 1.0.885 → 1.0.886

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 (32) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/ContentCardPaginated.js +414 -0
  3. package/dist/cjs/DeckQueuePaginated.js +345 -0
  4. package/dist/cjs/GridContent.js +44 -157
  5. package/dist/cjs/GridContentPaginated.js +704 -0
  6. package/dist/cjs/ImageSlider-b96720eb.js +2813 -0
  7. package/dist/cjs/MasterDeckPaginated.js +446 -0
  8. package/dist/cjs/MediaSeriesCard-8b4efd28.js +9505 -0
  9. package/dist/cjs/MediaSeriesLanding.js +20 -9502
  10. package/dist/cjs/MediaSeriesLandingPaginated.js +524 -0
  11. package/dist/cjs/Pagination-8f2038bf.js +53 -0
  12. package/dist/cjs/PartnerDetailListing.js +12 -2807
  13. package/dist/cjs/PartnerDetailListingPaginated.js +314 -0
  14. package/dist/cjs/PublicationFeature-5ccf9b13.js +130 -0
  15. package/dist/cjs/QueueDeckExpandedPaginated.js +1378 -0
  16. package/dist/cjs/index.js +2 -0
  17. package/dist/esm/ContentCardPaginated.js +403 -0
  18. package/dist/esm/DeckQueuePaginated.js +334 -0
  19. package/dist/esm/GridContent.js +2 -114
  20. package/dist/esm/GridContentPaginated.js +693 -0
  21. package/dist/esm/ImageSlider-de7846ea.js +2804 -0
  22. package/dist/esm/MasterDeckPaginated.js +438 -0
  23. package/dist/esm/MediaSeriesCard-51ebf1c0.js +9495 -0
  24. package/dist/esm/MediaSeriesLanding.js +16 -9496
  25. package/dist/esm/MediaSeriesLandingPaginated.js +517 -0
  26. package/dist/esm/Pagination-c0db7ca1.js +46 -0
  27. package/dist/esm/PartnerDetailListing.js +13 -2807
  28. package/dist/esm/PartnerDetailListingPaginated.js +308 -0
  29. package/dist/esm/PublicationFeature-d88e76b9.js +121 -0
  30. package/dist/esm/QueueDeckExpandedPaginated.js +1372 -0
  31. package/dist/esm/index.js +2 -0
  32. package/package.json +2 -1
@@ -0,0 +1,334 @@
1
+ import { _ as _JSON$stringify } from './stringify-2b084bee.js';
2
+ import { a as _asyncToGenerator, r as regenerator } from './asyncToGenerator-5ef104a7.js';
3
+ import { _ as _extends } from './extends-6d8e3924.js';
4
+ import { _ as _inherits, a as _classCallCheck, b as _possibleConstructorReturn, c as _Object$getPrototypeOf, d as _createClass } from './inherits-a6ba2ec4.js';
5
+ import React__default from 'react';
6
+ import { l as lib_3 } from './index-f0fc23eb.js';
7
+ import Container from 'react-bootstrap/Container';
8
+ import Row from 'react-bootstrap/Row';
9
+ import Col from 'react-bootstrap/Col';
10
+ import Card from 'react-bootstrap/Card';
11
+ import Spinner from 'react-bootstrap/Spinner';
12
+ import { m as moment } from './moment-bc12cb97.js';
13
+ import { withRouter } from 'next/router';
14
+ import { L as LazyLoad } from './index-755f2cc2.js';
15
+ import { g as get_1 } from './get-3c308da4.js';
16
+ import { m as main_43 } from './main-1894c974.js';
17
+ import urlFor from './urlFor.js';
18
+ import { c as clean_html_1 } from './entities-6d9154b4.js';
19
+ import { P as Pagination } from './Pagination-c0db7ca1.js';
20
+ import './_commonjsHelpers-0c4b6f40.js';
21
+ import './core.get-iterator-method-ea258bb1.js';
22
+ import './web.dom.iterable-ab4dea5c.js';
23
+ import './_library-528f1934.js';
24
+ import './_iter-detect-98db3b07.js';
25
+ import './_object-pie-133f504a.js';
26
+ import './_object-sap-7cee6f84.js';
27
+ import './define-property-5f1bda73.js';
28
+ import './typeof-e9fc0c5d.js';
29
+ import './_is-array-8d21b9e3.js';
30
+ import './events-6c3a7a63.js';
31
+ import 'prop-types';
32
+ import 'react-dom';
33
+ import './isSymbol-a7e9aafe.js';
34
+ import './eq-bdcbf886.js';
35
+ import './slicedToArray-6ebcbfea.js';
36
+ import './index-3f5c03b2.js';
37
+ import 'react-paginate';
38
+
39
+ var DeckQueue = function (_React$Component) {
40
+ _inherits(DeckQueue, _React$Component);
41
+
42
+ function DeckQueue() {
43
+ var _ref,
44
+ _this2 = this;
45
+
46
+ var _temp, _this, _ret;
47
+
48
+ _classCallCheck(this, DeckQueue);
49
+
50
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
51
+ args[_key] = arguments[_key];
52
+ }
53
+
54
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = DeckQueue.__proto__ || _Object$getPrototypeOf(DeckQueue)).call.apply(_ref, [this].concat(args))), _this), _this.page = _this.props.page, _this.data = _this.props.dataRecord, _this.client = _this.props.client, _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.imageHeight = _this.props.imageHeight ? _this.props.imageHeight : 270, _this.state = {
55
+ data: _this.data,
56
+ prevData: _this.data,
57
+ currentPage: _this.props.currentPage || 1,
58
+ isDataLoading: false,
59
+ itemsPerPage: _this.props.params ? _this.props.params.to - _this.props.params.from : 2
60
+ }, _this.renderCardImage = function (row) {
61
+ if (row.thumbnail && row.thumbnail.asset) {
62
+ var url = urlFor({
63
+ client: _this.client,
64
+ source: row.thumbnail,
65
+ imageHeight: _this.imageHeight || null,
66
+ imageWidth: _this.props.imageWidth || null,
67
+ imageFit: _this.props.imageFit || null
68
+ });
69
+ return url;
70
+ } else {
71
+ return _this.defaultImage;
72
+ }
73
+ }, _this.seoPagination = function (pageNumber) {
74
+ var _this$props = _this.props,
75
+ pageview = _this$props.pageview,
76
+ router = _this$props.router;
77
+
78
+ var path = router.asPath;
79
+ var qrIndex = path.indexOf('?');
80
+ var pathname = router.pathname;
81
+ var queryString = '';
82
+ if (qrIndex > 0) {
83
+ path = path.substring(1, qrIndex);
84
+ var partialQS = router.asPath.substring(qrIndex + 1);
85
+ var partialQSArr = partialQS.split('&');
86
+ // exclude page=xxx from query string
87
+ partialQSArr.map(function (item) {
88
+ var itemArr = item.split('=');
89
+ var key = itemArr[0];
90
+ var val = itemArr[1];
91
+ if (key !== 'page') queryString += (queryString.length === 0 ? '' : '&') + key + '=' + val;
92
+ });
93
+ }
94
+ if (queryString.length > 0) path += '?' + queryString;
95
+ pageNumber = parseInt(pageNumber);
96
+ if (path[0] !== '/') path = '/' + path;
97
+ var newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
98
+ if (pageview) pageview(newPath);
99
+ router.push(pathname, newPath, {
100
+ shallow: true
101
+ });
102
+ }, _this.renderMobileAd = function (index, numberOfItemsBeforeAd) {
103
+ var rightItems = _this.props.rightItems;
104
+
105
+ var i = ((index + 1) / numberOfItemsBeforeAd - 1) % rightItems.length;
106
+ return React__default.createElement(
107
+ 'div',
108
+ { style: { display: 'flex', flex: '1 0 auto' } },
109
+ rightItems[i].component
110
+ );
111
+ }, _this.handlePageChange = function () {
112
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(selectedPage) {
113
+ var itemsPerPage, _this$props2, query, params, client, seoPaginate, start, newParams, newData;
114
+
115
+ return regenerator.wrap(function _callee$(_context) {
116
+ while (1) {
117
+ switch (_context.prev = _context.next) {
118
+ case 0:
119
+ itemsPerPage = _this.state.itemsPerPage;
120
+ _this$props2 = _this.props, query = _this$props2.query, params = _this$props2.params, client = _this$props2.client, seoPaginate = _this$props2.seoPaginate;
121
+
122
+ _this.setState({ isDataLoading: true, currentPage: selectedPage });
123
+ seoPaginate && _this.seoPagination(selectedPage);
124
+ lib_3.refresh();
125
+ document.body.scrollTop = 0;
126
+ document.documentElement.scrollTop = 0;
127
+ start = (selectedPage - 1) * itemsPerPage;
128
+ newParams = _extends({}, params, {
129
+ from: start,
130
+ to: start + itemsPerPage
131
+ });
132
+ _context.prev = 9;
133
+ _context.next = 12;
134
+ return client.fetch(query, newParams);
135
+
136
+ case 12:
137
+ newData = _context.sent;
138
+
139
+ if (_this.pointer && _this.pointerArray) newData = newData[_this.pointerArray][_this.pointer];
140
+ if (newData && newData.length > 0) {
141
+ _this.setState({ isDataLoading: false, data: newData });
142
+ }
143
+ _context.next = 20;
144
+ break;
145
+
146
+ case 17:
147
+ _context.prev = 17;
148
+ _context.t0 = _context['catch'](9);
149
+
150
+ console.error(_context.t0);
151
+
152
+ case 20:
153
+ case 'end':
154
+ return _context.stop();
155
+ }
156
+ }
157
+ }, _callee, _this2, [[9, 17]]);
158
+ }));
159
+
160
+ return function (_x) {
161
+ return _ref2.apply(this, arguments);
162
+ };
163
+ }(), _temp), _possibleConstructorReturn(_this, _ret);
164
+ }
165
+
166
+ _createClass(DeckQueue, [{
167
+ key: 'componentDidUpdate',
168
+ value: function componentDidUpdate(prevProps, prevState) {
169
+ if (_JSON$stringify(this.state.prevData) !== _JSON$stringify(prevState.prevData) && this.props.seoPaginate) {
170
+ this.seoPagination(this.state.currentPage);
171
+ }
172
+ }
173
+ }, {
174
+ key: 'cardLoader',
175
+ value: function cardLoader(_ref3) {
176
+ var _this3 = this;
177
+
178
+ var columns = _ref3.columns,
179
+ variant = _ref3.variant;
180
+
181
+ var mode = variant && variant === 'right' ? 'row-reverse' : 'row';
182
+ var lgVar = Math.floor(12 / columns);
183
+ var numberOfItemsBeforeAd = 6;
184
+
185
+ return React__default.createElement(
186
+ Row,
187
+ null,
188
+ this.state.data && this.state.data.map(function (row, index) {
189
+ // const thumbnailURL = get(row, 'thumbnail.asset.url', this.props.defaultImage)
190
+
191
+ return React__default.createElement(
192
+ React__default.Fragment,
193
+ { key: index },
194
+ React__default.createElement(
195
+ Col,
196
+ { md: 12, lg: lgVar, style: { display: 'flex', flex: '1 0 auto' } },
197
+ React__default.createElement(
198
+ Card,
199
+ { className: 'queue-card', style: { borderTop: '1px solid #EEE' } },
200
+ React__default.createElement(
201
+ Row,
202
+ { style: { flexDirection: mode } },
203
+ (row.thumbnail && row.thumbnail.asset || _this3.props.defaultImage) && React__default.createElement(
204
+ Col,
205
+ { md: 12, lg: 4 },
206
+ React__default.createElement(
207
+ 'a',
208
+ { href: _this3.page + '/' + get_1(row, 'url.current') },
209
+ React__default.createElement(
210
+ LazyLoad,
211
+ { height: _this3.props.imageHeight },
212
+ React__default.createElement(Card.Img, { variant: 'top', src: _this3.renderCardImage(row), alt: row.thumbnail && row.thumbnail.asset ? row.thumbnail.asset.originalFilename : '' })
213
+ )
214
+ )
215
+ ),
216
+ React__default.createElement(
217
+ Col,
218
+ null,
219
+ React__default.createElement(
220
+ Card.Body,
221
+ { style: { padding: '20px' } },
222
+ row.title && React__default.createElement(
223
+ Card.Title,
224
+ null,
225
+ React__default.createElement(
226
+ 'a',
227
+ { href: _this3.page + '/' + get_1(row, 'url.current') },
228
+ row.title
229
+ )
230
+ ),
231
+ _this3.props.showPublished && row.published && React__default.createElement(
232
+ Card.Subtitle,
233
+ null,
234
+ moment(row.published).format('MMMM DD, YYYY')
235
+ ),
236
+ _this3.props.showRecent && row.recent && row.recent.title && React__default.createElement(
237
+ Card.Subtitle,
238
+ null,
239
+ 'Recent : ',
240
+ React__default.createElement(
241
+ 'a',
242
+ { href: 'view/' + row.recent.url.current },
243
+ row.recent.title
244
+ )
245
+ ),
246
+ row.summary && React__default.createElement(
247
+ Card.Text,
248
+ null,
249
+ React__default.createElement(
250
+ 'a',
251
+ { href: _this3.page + '/' + get_1(row, 'url.current') },
252
+ clean_html_1(row.summary)
253
+ )
254
+ )
255
+ )
256
+ )
257
+ )
258
+ )
259
+ ),
260
+ main_43 && _this3.props.rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && _this3.renderMobileAd(index, numberOfItemsBeforeAd)
261
+ );
262
+ })
263
+ );
264
+ }
265
+ }, {
266
+ key: 'render',
267
+ value: function render() {
268
+ var _props = this.props,
269
+ columns = _props.columns,
270
+ variant = _props.variant,
271
+ totalDataCount = _props.totalDataCount;
272
+ var _state = this.state,
273
+ data = _state.data,
274
+ isDataLoading = _state.isDataLoading,
275
+ itemsPerPage = _state.itemsPerPage,
276
+ currentPage = _state.currentPage;
277
+
278
+ return React__default.createElement(
279
+ 'div',
280
+ { className: 'contentDeck' },
281
+ isDataLoading ? React__default.createElement(
282
+ 'div',
283
+ { className: 'd-flex justify-content-center', style: { marginTop: '100px' } },
284
+ React__default.createElement(
285
+ Spinner,
286
+ { animation: 'border', role: 'status' },
287
+ React__default.createElement(
288
+ 'span',
289
+ { className: 'sr-only' },
290
+ 'Loading...'
291
+ )
292
+ )
293
+ ) : data && data.length > 0 ? React__default.createElement(
294
+ Container,
295
+ null,
296
+ this.cardLoader({ columns: columns, variant: variant }),
297
+ React__default.createElement(
298
+ 'div',
299
+ { className: 'pagination-wrapper' },
300
+ React__default.createElement(Pagination, {
301
+ pageCount: Math.ceil(totalDataCount / itemsPerPage),
302
+ pageRangeDisplayed: main_43 ? 3 : 9,
303
+ currentPage: currentPage,
304
+ onPageChange: this.handlePageChange
305
+ }),
306
+ React__default.createElement(
307
+ 'style',
308
+ { jsx: 'true' },
309
+ '\n .pagination-wrapper {\n margin: 3rem 0;\n }\n @media only screen and (max-width: 768px) {\n .pagination-wrapper {\n margin-bottom: 6rem;\n }\n }\n '
310
+ )
311
+ )
312
+ ) : null
313
+ );
314
+ }
315
+ }], [{
316
+ key: 'getDerivedStateFromProps',
317
+ value: function getDerivedStateFromProps(props, state) {
318
+ if (_JSON$stringify(props.dataRecord) !== _JSON$stringify(state.prevData)) {
319
+ return {
320
+ data: props.dataRecord,
321
+ prevData: props.dataRecord,
322
+ currentPage: props.currentPage
323
+ };
324
+ }
325
+ return null;
326
+ }
327
+ }]);
328
+
329
+ return DeckQueue;
330
+ }(React__default.Component);
331
+
332
+ var QueuePaginated = withRouter(DeckQueue);
333
+
334
+ export default QueuePaginated;
@@ -23,7 +23,7 @@ import urlFor from './urlFor.js';
23
23
  import { m as main_43 } from './main-1894c974.js';
24
24
  import './AD.js';
25
25
  import { A as AuthorComponent } from './AuthorComponent-11adff02.js';
26
- import Button from 'react-bootstrap/Button';
26
+ import { P as PublicationFeature } from './PublicationFeature-d88e76b9.js';
27
27
  import './_commonjsHelpers-0c4b6f40.js';
28
28
  import './core.get-iterator-method-ea258bb1.js';
29
29
  import './_iter-detect-98db3b07.js';
@@ -47,119 +47,7 @@ import './isSymbol-a7e9aafe.js';
47
47
  import './eq-bdcbf886.js';
48
48
  import './toNumber-5aeba6e7.js';
49
49
  import './index-3f5c03b2.js';
50
-
51
- var PublicationFeature = function PublicationFeature(_ref) {
52
- var data = _ref.data,
53
- _ref$issueMapping = _ref.issueMapping,
54
- issueMapping = _ref$issueMapping === undefined ? '/publications' : _ref$issueMapping,
55
- defaultImage = _ref.defaultImage,
56
- client = _ref.client;
57
-
58
- var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
59
- var _data$parent = data.parent;
60
- _data$parent = _data$parent === undefined ? {} : _data$parent;
61
- var _data$parent$identifi = _data$parent.identifier;
62
- _data$parent$identifi = _data$parent$identifi === undefined ? {} : _data$parent$identifi;
63
- var parentSlug = _data$parent$identifi.current,
64
- _data$identifier = data.identifier;
65
- _data$identifier = _data$identifier === undefined ? {} : _data$identifier;
66
- var childSlug = _data$identifier.current,
67
- name = data.name,
68
- articles = data.articles,
69
- month = data.month,
70
- year = data.year,
71
- thumbnail = data.thumbnail;
72
-
73
- if (name && articles && articles.length > 0) {
74
- return React__default.createElement(
75
- 'div',
76
- { className: 'publication-feature-container border rounded p-2' },
77
- React__default.createElement(
78
- Row,
79
- null,
80
- React__default.createElement(
81
- Col,
82
- { xs: 12 },
83
- React__default.createElement(
84
- 'h4',
85
- null,
86
- name,
87
- month && year && React__default.createElement(
88
- 'span',
89
- null,
90
- ' ',
91
- '| ',
92
- months[parseInt(month, 10)],
93
- ' ',
94
- year
95
- )
96
- )
97
- ),
98
- React__default.createElement(
99
- Col,
100
- { xs: 12, sm: 4 },
101
- React__default.createElement(
102
- LazyLoad,
103
- { once: true },
104
- React__default.createElement('img', { className: 'w-100 mb-2', src: thumbnail && thumbnail.asset && client ? urlFor({ client: client, source: thumbnail.asset }) : defaultImage, alt: name || '' })
105
- )
106
- ),
107
- React__default.createElement(
108
- Col,
109
- { xs: 12, sm: 8 },
110
- React__default.createElement(
111
- Row,
112
- null,
113
- articles.map(function (article) {
114
- return React__default.createElement(
115
- Col,
116
- { key: article._id, xs: 12, sm: 6 },
117
- article.issueSection && article.issueSection.name && React__default.createElement(
118
- 'h6',
119
- { className: 'text-primary m-0 p-0 text-uppercase font-weight-bold' },
120
- article.issueSection.name
121
- ),
122
- article.title && React__default.createElement(
123
- React__default.Fragment,
124
- null,
125
- article.url && article.url.current ? React__default.createElement(
126
- 'a',
127
- { href: '/view/' + article.url.current },
128
- React__default.createElement(
129
- 'h6',
130
- { className: 'text-break' },
131
- article.title
132
- )
133
- ) : React__default.createElement(
134
- 'h6',
135
- { className: 'text-break' },
136
- article.title
137
- )
138
- )
139
- );
140
- })
141
- )
142
- ),
143
- issueMapping && parentSlug && childSlug && React__default.createElement(
144
- Col,
145
- { xs: 12 },
146
- React__default.createElement(
147
- Button,
148
- { href: issueMapping + '/' + parentSlug + '/' + childSlug, className: 'float-right', variant: 'outline-primary' },
149
- 'More Articles ',
150
- '>>'
151
- )
152
- )
153
- ),
154
- React__default.createElement(
155
- 'style',
156
- { jsx: 'true' },
157
- '\n .row {\n margin-top: -15px;\n margin-left: -15px;\n margin-right: 0;\n }\n .row > * {\n padding-top: 15px;\n padding-left: 15px;\n padding-right: 0;\n }\n '
158
- )
159
- );
160
- }
161
- return null;
162
- };
50
+ import 'react-bootstrap/Button';
163
51
 
164
52
  var GridContent = function (_React$Component) {
165
53
  _inherits(GridContent, _React$Component);