@mjhls/mjh-framework 1.0.1065-pdfGating → 1.0.1065-pdfGating-v2
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/dist/cjs/PublicationLanding.js +19 -24
- package/dist/esm/PublicationLanding.js +19 -24
- package/package.json +1 -1
|
@@ -767,9 +767,9 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
767
767
|
|
|
768
768
|
case 37:
|
|
769
769
|
setSendingData(false);
|
|
770
|
-
SetIsValidated(false)
|
|
770
|
+
//SetIsValidated(false)
|
|
771
771
|
|
|
772
|
-
case
|
|
772
|
+
case 38:
|
|
773
773
|
case 'end':
|
|
774
774
|
return _context.stop();
|
|
775
775
|
}
|
|
@@ -792,29 +792,29 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
792
792
|
overLaysClosed = _useState30[0],
|
|
793
793
|
setOverLaysClosed = _useState30[1];
|
|
794
794
|
|
|
795
|
-
var
|
|
795
|
+
var prevKey = React.useRef();
|
|
796
|
+
|
|
797
|
+
var closeAllOverlays = function closeAllOverlays(targetKey, event) {
|
|
796
798
|
for (var key in show) {
|
|
797
|
-
|
|
798
|
-
closeOverLay(key);
|
|
799
|
-
}
|
|
799
|
+
closeOverLay(key);
|
|
800
800
|
}
|
|
801
801
|
if (targetKey) {
|
|
802
802
|
setCurrentKey(targetKey);
|
|
803
803
|
setOverLaysClosed(true);
|
|
804
|
+
setOverlayTarget(event.target);
|
|
804
805
|
}
|
|
805
806
|
};
|
|
806
807
|
|
|
807
808
|
React.useEffect(function () {
|
|
808
|
-
|
|
809
|
-
console.log(overLaysClosed);
|
|
810
|
-
if (overLaysClosed) {
|
|
809
|
+
if (overLaysClosed === true && prevKey.current !== currentKey) {
|
|
811
810
|
window.setTimeout(function () {
|
|
812
|
-
console.dir(
|
|
811
|
+
console.dir(overlayTarget);
|
|
813
812
|
var updatedValue = defineProperty._defineProperty({}, currentKey, true);
|
|
814
813
|
setShow(function (show) {
|
|
815
814
|
return _extends._extends({}, show, updatedValue);
|
|
816
815
|
});
|
|
817
816
|
setOverLaysClosed(false);
|
|
817
|
+
prevKey.current = currentKey;
|
|
818
818
|
if (show[currentKey] !== true) {
|
|
819
819
|
try {
|
|
820
820
|
document.getElementById('download_' + currentKey).disabled = true;
|
|
@@ -822,29 +822,24 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
822
822
|
console.log(e.message);
|
|
823
823
|
}
|
|
824
824
|
}
|
|
825
|
-
},
|
|
825
|
+
}, 500);
|
|
826
826
|
}
|
|
827
|
-
}, [currentKey, overLaysClosed,
|
|
827
|
+
}, [currentKey, overLaysClosed, overlayTarget]);
|
|
828
828
|
|
|
829
829
|
var handleOverLayOpen = function handleOverLayOpen(event) {
|
|
830
|
-
closeAllOverlays(event.target.dataset.key);
|
|
831
|
-
setOverlayTarget(event.target);
|
|
830
|
+
closeAllOverlays(event.target.dataset.key, event);
|
|
832
831
|
};
|
|
833
832
|
|
|
834
833
|
function closeOverLay(key) {
|
|
834
|
+
prevKey.current = '-1';
|
|
835
835
|
var updatedValue = {};
|
|
836
|
-
updatedValue =
|
|
836
|
+
updatedValue = defineProperty._defineProperty({}, key, false);
|
|
837
837
|
document.getElementById('download_' + key).disabled = false;
|
|
838
838
|
setShow(function (show) {
|
|
839
839
|
return _extends._extends({}, show, updatedValue);
|
|
840
840
|
});
|
|
841
841
|
}
|
|
842
842
|
|
|
843
|
-
React.useEffect(function () {
|
|
844
|
-
console.dir(overlayTarget);
|
|
845
|
-
console.dir(show);
|
|
846
|
-
}, [overlayTarget, show]);
|
|
847
|
-
|
|
848
843
|
return React__default["default"].createElement(
|
|
849
844
|
'div',
|
|
850
845
|
{ id: 'publicationLanding' },
|
|
@@ -1000,7 +995,7 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
1000
995
|
'div',
|
|
1001
996
|
{
|
|
1002
997
|
onClick: function onClick(e) {
|
|
1003
|
-
return
|
|
998
|
+
return closeAllOverlays();
|
|
1004
999
|
},
|
|
1005
1000
|
style: { cursor: 'pointer', display: 'flex', flexDirection: 'row', justifyContent: 'flex-end', width: '100%', marginBottom: '-15px' } },
|
|
1006
1001
|
React__default["default"].createElement(
|
|
@@ -1124,7 +1119,7 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
1124
1119
|
id: 'download_' + key,
|
|
1125
1120
|
rel: 'noopener',
|
|
1126
1121
|
onClick: function onClick(e) {
|
|
1127
|
-
return handleOverLayOpen(e);
|
|
1122
|
+
return isValidated ? window.open(urlForFile.urlForFile(issue.pdf, baseUrl), '_blank') : handleOverLayOpen(e);
|
|
1128
1123
|
},
|
|
1129
1124
|
ref: DL_PDF,
|
|
1130
1125
|
'data-key': key,
|
|
@@ -1224,7 +1219,7 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
1224
1219
|
'div',
|
|
1225
1220
|
{
|
|
1226
1221
|
onClick: function onClick(e) {
|
|
1227
|
-
return
|
|
1222
|
+
return closeAllOverlays();
|
|
1228
1223
|
},
|
|
1229
1224
|
style: { cursor: 'pointer', display: 'flex', flexDirection: 'row', justifyContent: 'flex-end', width: '100%', marginBottom: '-15px' } },
|
|
1230
1225
|
React__default["default"].createElement(
|
|
@@ -1348,7 +1343,7 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
1348
1343
|
id: 'download_' + key,
|
|
1349
1344
|
rel: 'noopener',
|
|
1350
1345
|
onClick: function onClick(e) {
|
|
1351
|
-
return handleOverLayOpen(e);
|
|
1346
|
+
return isValidated ? window.open(urlForFile.urlForFile(issue.pdf, baseUrl), '_blank') : handleOverLayOpen(e);
|
|
1352
1347
|
},
|
|
1353
1348
|
ref: DL_PDF,
|
|
1354
1349
|
'data-key': key,
|
|
@@ -753,9 +753,9 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
753
753
|
|
|
754
754
|
case 37:
|
|
755
755
|
setSendingData(false);
|
|
756
|
-
SetIsValidated(false)
|
|
756
|
+
//SetIsValidated(false)
|
|
757
757
|
|
|
758
|
-
case
|
|
758
|
+
case 38:
|
|
759
759
|
case 'end':
|
|
760
760
|
return _context.stop();
|
|
761
761
|
}
|
|
@@ -778,29 +778,29 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
778
778
|
overLaysClosed = _useState30[0],
|
|
779
779
|
setOverLaysClosed = _useState30[1];
|
|
780
780
|
|
|
781
|
-
var
|
|
781
|
+
var prevKey = useRef();
|
|
782
|
+
|
|
783
|
+
var closeAllOverlays = function closeAllOverlays(targetKey, event) {
|
|
782
784
|
for (var key in show) {
|
|
783
|
-
|
|
784
|
-
closeOverLay(key);
|
|
785
|
-
}
|
|
785
|
+
closeOverLay(key);
|
|
786
786
|
}
|
|
787
787
|
if (targetKey) {
|
|
788
788
|
setCurrentKey(targetKey);
|
|
789
789
|
setOverLaysClosed(true);
|
|
790
|
+
setOverlayTarget(event.target);
|
|
790
791
|
}
|
|
791
792
|
};
|
|
792
793
|
|
|
793
794
|
useEffect(function () {
|
|
794
|
-
|
|
795
|
-
console.log(overLaysClosed);
|
|
796
|
-
if (overLaysClosed) {
|
|
795
|
+
if (overLaysClosed === true && prevKey.current !== currentKey) {
|
|
797
796
|
window.setTimeout(function () {
|
|
798
|
-
console.dir(
|
|
797
|
+
console.dir(overlayTarget);
|
|
799
798
|
var updatedValue = _defineProperty({}, currentKey, true);
|
|
800
799
|
setShow(function (show) {
|
|
801
800
|
return _extends({}, show, updatedValue);
|
|
802
801
|
});
|
|
803
802
|
setOverLaysClosed(false);
|
|
803
|
+
prevKey.current = currentKey;
|
|
804
804
|
if (show[currentKey] !== true) {
|
|
805
805
|
try {
|
|
806
806
|
document.getElementById('download_' + currentKey).disabled = true;
|
|
@@ -808,29 +808,24 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
808
808
|
console.log(e.message);
|
|
809
809
|
}
|
|
810
810
|
}
|
|
811
|
-
},
|
|
811
|
+
}, 500);
|
|
812
812
|
}
|
|
813
|
-
}, [currentKey, overLaysClosed,
|
|
813
|
+
}, [currentKey, overLaysClosed, overlayTarget]);
|
|
814
814
|
|
|
815
815
|
var handleOverLayOpen = function handleOverLayOpen(event) {
|
|
816
|
-
closeAllOverlays(event.target.dataset.key);
|
|
817
|
-
setOverlayTarget(event.target);
|
|
816
|
+
closeAllOverlays(event.target.dataset.key, event);
|
|
818
817
|
};
|
|
819
818
|
|
|
820
819
|
function closeOverLay(key) {
|
|
820
|
+
prevKey.current = '-1';
|
|
821
821
|
var updatedValue = {};
|
|
822
|
-
updatedValue =
|
|
822
|
+
updatedValue = _defineProperty({}, key, false);
|
|
823
823
|
document.getElementById('download_' + key).disabled = false;
|
|
824
824
|
setShow(function (show) {
|
|
825
825
|
return _extends({}, show, updatedValue);
|
|
826
826
|
});
|
|
827
827
|
}
|
|
828
828
|
|
|
829
|
-
useEffect(function () {
|
|
830
|
-
console.dir(overlayTarget);
|
|
831
|
-
console.dir(show);
|
|
832
|
-
}, [overlayTarget, show]);
|
|
833
|
-
|
|
834
829
|
return React__default.createElement(
|
|
835
830
|
'div',
|
|
836
831
|
{ id: 'publicationLanding' },
|
|
@@ -986,7 +981,7 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
986
981
|
'div',
|
|
987
982
|
{
|
|
988
983
|
onClick: function onClick(e) {
|
|
989
|
-
return
|
|
984
|
+
return closeAllOverlays();
|
|
990
985
|
},
|
|
991
986
|
style: { cursor: 'pointer', display: 'flex', flexDirection: 'row', justifyContent: 'flex-end', width: '100%', marginBottom: '-15px' } },
|
|
992
987
|
React__default.createElement(
|
|
@@ -1110,7 +1105,7 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
1110
1105
|
id: 'download_' + key,
|
|
1111
1106
|
rel: 'noopener',
|
|
1112
1107
|
onClick: function onClick(e) {
|
|
1113
|
-
return handleOverLayOpen(e);
|
|
1108
|
+
return isValidated ? window.open(urlForFile(issue.pdf, baseUrl), '_blank') : handleOverLayOpen(e);
|
|
1114
1109
|
},
|
|
1115
1110
|
ref: DL_PDF,
|
|
1116
1111
|
'data-key': key,
|
|
@@ -1210,7 +1205,7 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
1210
1205
|
'div',
|
|
1211
1206
|
{
|
|
1212
1207
|
onClick: function onClick(e) {
|
|
1213
|
-
return
|
|
1208
|
+
return closeAllOverlays();
|
|
1214
1209
|
},
|
|
1215
1210
|
style: { cursor: 'pointer', display: 'flex', flexDirection: 'row', justifyContent: 'flex-end', width: '100%', marginBottom: '-15px' } },
|
|
1216
1211
|
React__default.createElement(
|
|
@@ -1334,7 +1329,7 @@ var PublicationLanding = function PublicationLanding(props) {
|
|
|
1334
1329
|
id: 'download_' + key,
|
|
1335
1330
|
rel: 'noopener',
|
|
1336
1331
|
onClick: function onClick(e) {
|
|
1337
|
-
return handleOverLayOpen(e);
|
|
1332
|
+
return isValidated ? window.open(urlForFile(issue.pdf, baseUrl), '_blank') : handleOverLayOpen(e);
|
|
1338
1333
|
},
|
|
1339
1334
|
ref: DL_PDF,
|
|
1340
1335
|
'data-key': key,
|