@mjhls/mjh-framework 1.0.1090 → 1.0.1092
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/cjs/PublicationLanding.js +14 -8
- package/dist/cjs/View.js +61 -14
- package/dist/esm/PublicationLanding.js +14 -8
- package/dist/esm/View.js +61 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# mjh-framework v. 1.0.
|
|
1
|
+
# mjh-framework v. 1.0.1092
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/mjh-framework) [](https://standardjs.com)
|
|
4
4
|
|
|
@@ -411,22 +411,26 @@ Publication.getInitialProps = async (ctx) => {
|
|
|
411
411
|
export default Publication
|
|
412
412
|
*/
|
|
413
413
|
|
|
414
|
-
var generateContentPlacements = function generateContentPlacements(issues) {
|
|
414
|
+
var generateContentPlacements = function generateContentPlacements(issues, ignoreFilterIDs) {
|
|
415
415
|
var contentPlacements = [];
|
|
416
416
|
issues && issues.length > 0 && issues.forEach(function (issue) {
|
|
417
417
|
if (issue.taxonomyMapping && issue.taxonomyMapping.length > 0) {
|
|
418
418
|
issue.taxonomyMapping && issue.taxonomyMapping.forEach(function (tm) {
|
|
419
|
-
if (
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
419
|
+
if (tm) {
|
|
420
|
+
if (ignoreFilterIDs.indexOf(tm._id) < 0) {
|
|
421
|
+
if (!contentPlacements.find(function (cp) {
|
|
422
|
+
return cp.identifier === tm.identifier;
|
|
423
|
+
}) && tm) {
|
|
424
|
+
contentPlacements.push({ _id: tm._id, name: tm.name, identifier: tm.identifier });
|
|
425
|
+
}
|
|
426
|
+
}
|
|
423
427
|
}
|
|
424
428
|
});
|
|
425
429
|
}
|
|
426
430
|
});
|
|
427
431
|
return contentPlacements;
|
|
428
432
|
};
|
|
429
|
-
|
|
433
|
+
// Pass an array of IDs to ignoreFilterIDs if you need to ignore certain Taxonomies
|
|
430
434
|
var PublicationLanding = function PublicationLanding(props) {
|
|
431
435
|
var publication = props.publication,
|
|
432
436
|
_props$year = props.year,
|
|
@@ -435,13 +439,15 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
435
439
|
props.pdf;
|
|
436
440
|
var _props$contentPlaceme = props.contentPlacement,
|
|
437
441
|
contentPlacement = _props$contentPlaceme === undefined ? '' : _props$contentPlaceme,
|
|
438
|
-
client = props.client
|
|
442
|
+
client = props.client,
|
|
443
|
+
_props$ignoreFilterID = props.ignoreFilterIDs,
|
|
444
|
+
ignoreFilterIDs = _props$ignoreFilterID === undefined ? [] : _props$ignoreFilterID;
|
|
439
445
|
|
|
440
446
|
var router = Router.useRouter();
|
|
441
447
|
var years = [].concat(toConsumableArray._toConsumableArray(new _Set(publication.issues.map(function (issue) {
|
|
442
448
|
return issue.year;
|
|
443
449
|
})))).sort().reverse();
|
|
444
|
-
var contentPlacements = generateContentPlacements(publication.issues);
|
|
450
|
+
var contentPlacements = generateContentPlacements(publication.issues, ignoreFilterIDs);
|
|
445
451
|
|
|
446
452
|
var _useState = React.useState(publication.issues),
|
|
447
453
|
_useState2 = slicedToArray._slicedToArray(_useState, 2),
|
package/dist/cjs/View.js
CHANGED
|
@@ -97,21 +97,32 @@ var getDocumentGroupUrl = function getDocumentGroupUrl(docGroup) {
|
|
|
97
97
|
return null;
|
|
98
98
|
}
|
|
99
99
|
var url = void 0;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
try {
|
|
101
|
+
if (docGroup.path && docGroup.path.includes('/') && (!docGroup.parent || !docGroup.parent.parent)) {
|
|
102
|
+
return '/' + docGroup.path;
|
|
103
|
+
}
|
|
104
|
+
} catch (e) {
|
|
105
|
+
console.log(e.message);
|
|
103
106
|
}
|
|
104
107
|
// Checking if Parent has Parent
|
|
105
|
-
|
|
106
|
-
if (docGroup.path.includes(docGroup.parent.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
try {
|
|
109
|
+
if (docGroup.path && docGroup.path.includes('/') && docGroup.parent && docGroup.parent.parent) {
|
|
110
|
+
if (docGroup.path.includes(docGroup.parent.identifier.current)) {
|
|
111
|
+
return '/' + docGroup.parent.parent.identifier.current + '/' + docGroup.path;
|
|
112
|
+
} else {
|
|
113
|
+
return '/' + docGroup.parent.parent.identifier.current + '/' + docGroup.parent.identifier.current + '/' + docGroup.path;
|
|
114
|
+
}
|
|
110
115
|
}
|
|
116
|
+
} catch (e) {
|
|
117
|
+
console.log(e.message);
|
|
111
118
|
}
|
|
112
119
|
|
|
113
|
-
|
|
114
|
-
|
|
120
|
+
try {
|
|
121
|
+
if (docGroup.parent && docGroup.parent.identifier && docGroup.parent.parent && docGroup.parent.parent.identifier && docGroup.parent.identifier.current.includes('/') && docGroup.parent.identifier.current.split('/')[0] === docGroup.parent.parent.identifier.current) {
|
|
122
|
+
return '/' + docGroup.parent.identifier.current + '/' + docGroup.path;
|
|
123
|
+
}
|
|
124
|
+
} catch (e) {
|
|
125
|
+
console.log(e.message);
|
|
115
126
|
}
|
|
116
127
|
|
|
117
128
|
if (docGroup.parent) {
|
|
@@ -1274,8 +1285,39 @@ var Article = React__default["default"].memo(React.forwardRef(function (props, r
|
|
|
1274
1285
|
return null;
|
|
1275
1286
|
}
|
|
1276
1287
|
|
|
1277
|
-
|
|
1278
|
-
|
|
1288
|
+
// let doc_url = cpModificationRequired
|
|
1289
|
+
// ? getDocumentGroupUrl(documentGroup)
|
|
1290
|
+
// : documentGroup.ancestor
|
|
1291
|
+
// ? documentGroup.parent && !documentGroup.path.includes('/')
|
|
1292
|
+
// ? `/${documentGroup.ancestor}/${documentGroup.parent.identifier.current}/${documentGroup.path}` : `/${documentGroup.ancestor}/${documentGroup.path}` : documentGroup.parent
|
|
1293
|
+
// ? !documentGroup.path.includes('/')
|
|
1294
|
+
// ? `/${documentGroup.parent.identifier.current}/${documentGroup.path}` : `/${documentGroup.path}` : `/${documentGroup.path}`
|
|
1295
|
+
|
|
1296
|
+
var docUrl = '/' + documentGroup.path;
|
|
1297
|
+
|
|
1298
|
+
if (cpModificationRequired) {
|
|
1299
|
+
docUrl = getDocumentGroupUrl(documentGroup);
|
|
1300
|
+
} else {
|
|
1301
|
+
try {
|
|
1302
|
+
if (documentGroup.ancestor) {
|
|
1303
|
+
if (documentGroup.parent && documentGroup.path.findIndex('/') < 0) {
|
|
1304
|
+
docUrl = '/' + documentGroup.ancestor + '/' + documentGroup.parent.identifier.current + '/' + documentGroup.path;
|
|
1305
|
+
} else {
|
|
1306
|
+
docUrl = '/' + documentGroup.ancestor + '/' + documentGroup.path;
|
|
1307
|
+
}
|
|
1308
|
+
} else if (documentGroup.parent) {
|
|
1309
|
+
if (documentGroup.path.findIndex('/') < 0) {
|
|
1310
|
+
docUrl = '/' + documentGroup.parent.identifier.current + '/' + documentGroup.path;
|
|
1311
|
+
} else {
|
|
1312
|
+
docUrl = '/' + documentGroup.path;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
} catch (e) {
|
|
1316
|
+
console.log(e.message);
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
var href = '' + docUrl;
|
|
1279
1321
|
relatedLinks = [].concat(toConsumableArray._toConsumableArray(relatedLinks), [{ label: documentGroup.name, href: href }]);
|
|
1280
1322
|
// if (documentGroup.parent) {
|
|
1281
1323
|
// relatedLinks = [
|
|
@@ -1299,12 +1341,17 @@ var Article = React__default["default"].memo(React.forwardRef(function (props, r
|
|
|
1299
1341
|
if (cp.excludeRelatedContents) {
|
|
1300
1342
|
return null;
|
|
1301
1343
|
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1344
|
+
var cp_url = '' + cp.path;
|
|
1345
|
+
try {
|
|
1346
|
+
cp_url = cpModificationRequired ? getTargeting.getContentPlacementUrl(cp) : cp.ancestor ? cp.parent && cp.path.indexOf('/') < 0 ? cp.ancestor + '/' + cp.parent + '/' + cp.path : !cp.path.indexOf(cp.ancestor) < 0 ? cp.ancestor + '/' + cp.path : '' + cp.path : cp.parent ? !cp.path.indexOf('/') < 0 ? cp.parent + '/' + cp.path : '' + cp.path : '' + cp.path;
|
|
1347
|
+
} catch (e) {
|
|
1348
|
+
console.log(e.message);
|
|
1349
|
+
}
|
|
1304
1350
|
var href = '/' + cp_url;
|
|
1305
1351
|
relatedLinks = [].concat(toConsumableArray._toConsumableArray(relatedLinks), [{ label: cp.name, href: href }]);
|
|
1306
1352
|
});
|
|
1307
1353
|
}
|
|
1354
|
+
|
|
1308
1355
|
if (issueGroup && issueGroup.name && issueGroup.identifier && issueGroup.identifier.current && issueGroup.parent && issueGroup.parent.identifier && issueGroup.parent.identifier.current) {
|
|
1309
1356
|
var _props$Settings$issue = props.Settings.issueMapping,
|
|
1310
1357
|
issueMapping = _props$Settings$issue === undefined ? '/publications' : _props$Settings$issue;
|
|
@@ -401,22 +401,26 @@ Publication.getInitialProps = async (ctx) => {
|
|
|
401
401
|
export default Publication
|
|
402
402
|
*/
|
|
403
403
|
|
|
404
|
-
var generateContentPlacements = function generateContentPlacements(issues) {
|
|
404
|
+
var generateContentPlacements = function generateContentPlacements(issues, ignoreFilterIDs) {
|
|
405
405
|
var contentPlacements = [];
|
|
406
406
|
issues && issues.length > 0 && issues.forEach(function (issue) {
|
|
407
407
|
if (issue.taxonomyMapping && issue.taxonomyMapping.length > 0) {
|
|
408
408
|
issue.taxonomyMapping && issue.taxonomyMapping.forEach(function (tm) {
|
|
409
|
-
if (
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
409
|
+
if (tm) {
|
|
410
|
+
if (ignoreFilterIDs.indexOf(tm._id) < 0) {
|
|
411
|
+
if (!contentPlacements.find(function (cp) {
|
|
412
|
+
return cp.identifier === tm.identifier;
|
|
413
|
+
}) && tm) {
|
|
414
|
+
contentPlacements.push({ _id: tm._id, name: tm.name, identifier: tm.identifier });
|
|
415
|
+
}
|
|
416
|
+
}
|
|
413
417
|
}
|
|
414
418
|
});
|
|
415
419
|
}
|
|
416
420
|
});
|
|
417
421
|
return contentPlacements;
|
|
418
422
|
};
|
|
419
|
-
|
|
423
|
+
// Pass an array of IDs to ignoreFilterIDs if you need to ignore certain Taxonomies
|
|
420
424
|
var PublicationLanding = function PublicationLanding(props) {
|
|
421
425
|
var publication = props.publication,
|
|
422
426
|
_props$year = props.year,
|
|
@@ -425,13 +429,15 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
425
429
|
props.pdf;
|
|
426
430
|
var _props$contentPlaceme = props.contentPlacement,
|
|
427
431
|
contentPlacement = _props$contentPlaceme === undefined ? '' : _props$contentPlaceme,
|
|
428
|
-
client = props.client
|
|
432
|
+
client = props.client,
|
|
433
|
+
_props$ignoreFilterID = props.ignoreFilterIDs,
|
|
434
|
+
ignoreFilterIDs = _props$ignoreFilterID === undefined ? [] : _props$ignoreFilterID;
|
|
429
435
|
|
|
430
436
|
var router = useRouter();
|
|
431
437
|
var years = [].concat(_toConsumableArray(new _Set(publication.issues.map(function (issue) {
|
|
432
438
|
return issue.year;
|
|
433
439
|
})))).sort().reverse();
|
|
434
|
-
var contentPlacements = generateContentPlacements(publication.issues);
|
|
440
|
+
var contentPlacements = generateContentPlacements(publication.issues, ignoreFilterIDs);
|
|
435
441
|
|
|
436
442
|
var _useState = useState(publication.issues),
|
|
437
443
|
_useState2 = _slicedToArray(_useState, 2),
|
package/dist/esm/View.js
CHANGED
|
@@ -87,21 +87,32 @@ var getDocumentGroupUrl = function getDocumentGroupUrl(docGroup) {
|
|
|
87
87
|
return null;
|
|
88
88
|
}
|
|
89
89
|
var url = void 0;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
try {
|
|
91
|
+
if (docGroup.path && docGroup.path.includes('/') && (!docGroup.parent || !docGroup.parent.parent)) {
|
|
92
|
+
return '/' + docGroup.path;
|
|
93
|
+
}
|
|
94
|
+
} catch (e) {
|
|
95
|
+
console.log(e.message);
|
|
93
96
|
}
|
|
94
97
|
// Checking if Parent has Parent
|
|
95
|
-
|
|
96
|
-
if (docGroup.path.includes(docGroup.parent.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
try {
|
|
99
|
+
if (docGroup.path && docGroup.path.includes('/') && docGroup.parent && docGroup.parent.parent) {
|
|
100
|
+
if (docGroup.path.includes(docGroup.parent.identifier.current)) {
|
|
101
|
+
return '/' + docGroup.parent.parent.identifier.current + '/' + docGroup.path;
|
|
102
|
+
} else {
|
|
103
|
+
return '/' + docGroup.parent.parent.identifier.current + '/' + docGroup.parent.identifier.current + '/' + docGroup.path;
|
|
104
|
+
}
|
|
100
105
|
}
|
|
106
|
+
} catch (e) {
|
|
107
|
+
console.log(e.message);
|
|
101
108
|
}
|
|
102
109
|
|
|
103
|
-
|
|
104
|
-
|
|
110
|
+
try {
|
|
111
|
+
if (docGroup.parent && docGroup.parent.identifier && docGroup.parent.parent && docGroup.parent.parent.identifier && docGroup.parent.identifier.current.includes('/') && docGroup.parent.identifier.current.split('/')[0] === docGroup.parent.parent.identifier.current) {
|
|
112
|
+
return '/' + docGroup.parent.identifier.current + '/' + docGroup.path;
|
|
113
|
+
}
|
|
114
|
+
} catch (e) {
|
|
115
|
+
console.log(e.message);
|
|
105
116
|
}
|
|
106
117
|
|
|
107
118
|
if (docGroup.parent) {
|
|
@@ -1264,8 +1275,39 @@ var Article = React__default.memo(forwardRef(function (props, ref) {
|
|
|
1264
1275
|
return null;
|
|
1265
1276
|
}
|
|
1266
1277
|
|
|
1267
|
-
|
|
1268
|
-
|
|
1278
|
+
// let doc_url = cpModificationRequired
|
|
1279
|
+
// ? getDocumentGroupUrl(documentGroup)
|
|
1280
|
+
// : documentGroup.ancestor
|
|
1281
|
+
// ? documentGroup.parent && !documentGroup.path.includes('/')
|
|
1282
|
+
// ? `/${documentGroup.ancestor}/${documentGroup.parent.identifier.current}/${documentGroup.path}` : `/${documentGroup.ancestor}/${documentGroup.path}` : documentGroup.parent
|
|
1283
|
+
// ? !documentGroup.path.includes('/')
|
|
1284
|
+
// ? `/${documentGroup.parent.identifier.current}/${documentGroup.path}` : `/${documentGroup.path}` : `/${documentGroup.path}`
|
|
1285
|
+
|
|
1286
|
+
var docUrl = '/' + documentGroup.path;
|
|
1287
|
+
|
|
1288
|
+
if (cpModificationRequired) {
|
|
1289
|
+
docUrl = getDocumentGroupUrl(documentGroup);
|
|
1290
|
+
} else {
|
|
1291
|
+
try {
|
|
1292
|
+
if (documentGroup.ancestor) {
|
|
1293
|
+
if (documentGroup.parent && documentGroup.path.findIndex('/') < 0) {
|
|
1294
|
+
docUrl = '/' + documentGroup.ancestor + '/' + documentGroup.parent.identifier.current + '/' + documentGroup.path;
|
|
1295
|
+
} else {
|
|
1296
|
+
docUrl = '/' + documentGroup.ancestor + '/' + documentGroup.path;
|
|
1297
|
+
}
|
|
1298
|
+
} else if (documentGroup.parent) {
|
|
1299
|
+
if (documentGroup.path.findIndex('/') < 0) {
|
|
1300
|
+
docUrl = '/' + documentGroup.parent.identifier.current + '/' + documentGroup.path;
|
|
1301
|
+
} else {
|
|
1302
|
+
docUrl = '/' + documentGroup.path;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
} catch (e) {
|
|
1306
|
+
console.log(e.message);
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
var href = '' + docUrl;
|
|
1269
1311
|
relatedLinks = [].concat(_toConsumableArray(relatedLinks), [{ label: documentGroup.name, href: href }]);
|
|
1270
1312
|
// if (documentGroup.parent) {
|
|
1271
1313
|
// relatedLinks = [
|
|
@@ -1289,12 +1331,17 @@ var Article = React__default.memo(forwardRef(function (props, ref) {
|
|
|
1289
1331
|
if (cp.excludeRelatedContents) {
|
|
1290
1332
|
return null;
|
|
1291
1333
|
}
|
|
1292
|
-
|
|
1293
|
-
|
|
1334
|
+
var cp_url = '' + cp.path;
|
|
1335
|
+
try {
|
|
1336
|
+
cp_url = cpModificationRequired ? getContentPlacementUrl(cp) : cp.ancestor ? cp.parent && cp.path.indexOf('/') < 0 ? cp.ancestor + '/' + cp.parent + '/' + cp.path : !cp.path.indexOf(cp.ancestor) < 0 ? cp.ancestor + '/' + cp.path : '' + cp.path : cp.parent ? !cp.path.indexOf('/') < 0 ? cp.parent + '/' + cp.path : '' + cp.path : '' + cp.path;
|
|
1337
|
+
} catch (e) {
|
|
1338
|
+
console.log(e.message);
|
|
1339
|
+
}
|
|
1294
1340
|
var href = '/' + cp_url;
|
|
1295
1341
|
relatedLinks = [].concat(_toConsumableArray(relatedLinks), [{ label: cp.name, href: href }]);
|
|
1296
1342
|
});
|
|
1297
1343
|
}
|
|
1344
|
+
|
|
1298
1345
|
if (issueGroup && issueGroup.name && issueGroup.identifier && issueGroup.identifier.current && issueGroup.parent && issueGroup.parent.identifier && issueGroup.parent.identifier.current) {
|
|
1299
1346
|
var _props$Settings$issue = props.Settings.issueMapping,
|
|
1300
1347
|
issueMapping = _props$Settings$issue === undefined ? '/publications' : _props$Settings$issue;
|