aefis-core-ui 3.1.0 → 4.0.0-rc1
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/index.modern.js +56 -17
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -17714,10 +17714,12 @@ const VIEWER_ASSETS_BASE_ROUTE = process.env.NODE_ENV === "development" ? "/asse
|
|
|
17714
17714
|
// See `server/app.js` where this route is defined.
|
|
17715
17715
|
|
|
17716
17716
|
const PrizmDocViewer = props => {
|
|
17717
|
+
const [readyToScroll, setReadyToScroll] = useState(false);
|
|
17717
17718
|
const [preRequisitesReady, setPreRequisitesReady] = useState(false);
|
|
17718
17719
|
const [viewerConstructed, setViewerConstructed] = useState(false);
|
|
17719
17720
|
const [preReqError, setPreReqError] = useState(null);
|
|
17720
17721
|
const containerRef = useRef(null);
|
|
17722
|
+
const [viewerControl, setViewerControl] = useState(null);
|
|
17721
17723
|
const PAS_PROXY_BASE_ROUTE = props.documentPreviewServer + "/pas-proxy";
|
|
17722
17724
|
|
|
17723
17725
|
// Ensure required JS and CSS are loaded.
|
|
@@ -17725,14 +17727,15 @@ const PrizmDocViewer = props => {
|
|
|
17725
17727
|
(async () => {
|
|
17726
17728
|
try {
|
|
17727
17729
|
// These resources can be safely loaded in parallel.
|
|
17728
|
-
const promiseArray = [injectScript(`${VIEWER_ASSETS_BASE_ROUTE}/js/viewercontrol.js`), injectScript(`${VIEWER_ASSETS_BASE_ROUTE}/js/viewerCustomizations.js`),
|
|
17729
|
-
//injectScript(`${VIEWER_ASSETS_BASE_ROUTE}/js/jquery-3.6.0.min.js`),
|
|
17730
|
-
injectScript(`${VIEWER_ASSETS_BASE_ROUTE}/js/underscore.min.js`), injectCss(`${VIEWER_ASSETS_BASE_ROUTE}/css/viewer.css`)
|
|
17730
|
+
const promiseArray = [injectScript(`${VIEWER_ASSETS_BASE_ROUTE}/js/viewercontrol.js`), injectScript(`${VIEWER_ASSETS_BASE_ROUTE}/js/viewerCustomizations.js`), injectScript(`${VIEWER_ASSETS_BASE_ROUTE}/js/underscore.min.js`), injectCss(`${VIEWER_ASSETS_BASE_ROUTE}/css/viewer.css`)
|
|
17731
17731
|
//injectCss(`${VIEWER_ASSETS_BASE_ROUTE}/css/normalize.min.css`)
|
|
17732
17732
|
];
|
|
17733
17733
|
|
|
17734
17734
|
if (props.includeJquery) {
|
|
17735
|
-
promiseArray.push(
|
|
17735
|
+
promiseArray.push(
|
|
17736
|
+
// INFO: this was previous one for older version of prizmdoc
|
|
17737
|
+
//injectScript(`${VIEWER_ASSETS_BASE_ROUTE}/js/jquery-3.6.0.min.js`),
|
|
17738
|
+
injectScript(`${VIEWER_ASSETS_BASE_ROUTE}/js/jquery-3.7.1.min.js`));
|
|
17736
17739
|
}
|
|
17737
17740
|
await Promise.all(promiseArray);
|
|
17738
17741
|
// These resources must be loaded last, and in this order.
|
|
@@ -17740,6 +17743,7 @@ const PrizmDocViewer = props => {
|
|
|
17740
17743
|
await injectScript(`${VIEWER_ASSETS_BASE_ROUTE}/js/viewer.js`);
|
|
17741
17744
|
setPreRequisitesReady(true);
|
|
17742
17745
|
} catch (err) {
|
|
17746
|
+
onError == null ? void 0 : onError(err);
|
|
17743
17747
|
setPreReqError(err);
|
|
17744
17748
|
}
|
|
17745
17749
|
})();
|
|
@@ -17792,17 +17796,43 @@ const PrizmDocViewer = props => {
|
|
|
17792
17796
|
}]
|
|
17793
17797
|
}
|
|
17794
17798
|
}, props.prizmDocViewerSettings));
|
|
17795
|
-
|
|
17796
|
-
|
|
17797
|
-
|
|
17798
|
-
|
|
17799
|
-
|
|
17800
|
-
container.viewerControl
|
|
17799
|
+
container.viewerControl.on(window.PCCViewer.EventType.PageCountReady, () => {
|
|
17800
|
+
setViewerControl(container.viewerControl);
|
|
17801
|
+
setReadyToScroll(true);
|
|
17802
|
+
});
|
|
17803
|
+
container.viewerControl.on(window.PCCViewer.EventType.ViewerReady, () => {
|
|
17804
|
+
setViewerControl(container.viewerControl);
|
|
17805
|
+
if (typeof props.onViewerReady === "function") {
|
|
17801
17806
|
props.onViewerReady(container.viewerControl);
|
|
17802
|
-
}
|
|
17803
|
-
}
|
|
17807
|
+
}
|
|
17808
|
+
});
|
|
17809
|
+
setViewerConstructed(true);
|
|
17804
17810
|
}
|
|
17805
17811
|
}, [preRequisitesReady, props.viewingSessionId, viewerConstructed, props.onViewerReady]);
|
|
17812
|
+
useEffect(() => {
|
|
17813
|
+
if (readyToScroll && viewerControl != undefined && props.pageNumberToScroll !== undefined) {
|
|
17814
|
+
try {
|
|
17815
|
+
viewerControl.setPageNumber(props.pageNumberToScroll);
|
|
17816
|
+
} catch (e) {
|
|
17817
|
+
props.onError == null ? void 0 : props.onError(e);
|
|
17818
|
+
console.error("Error scrolling to page", e);
|
|
17819
|
+
}
|
|
17820
|
+
|
|
17821
|
+
// INFO: below API allows you to scroll to specific position on the page
|
|
17822
|
+
// .scrollToAsync({
|
|
17823
|
+
// pageNumber: props.pageNumberToScroll,
|
|
17824
|
+
// x: 500,
|
|
17825
|
+
// y: 500
|
|
17826
|
+
// })
|
|
17827
|
+
// .then(
|
|
17828
|
+
// function onFulfilled() {},
|
|
17829
|
+
// function onRejected(e) {
|
|
17830
|
+
// console.error("Error scrolling to page", e);
|
|
17831
|
+
// }
|
|
17832
|
+
// );
|
|
17833
|
+
}
|
|
17834
|
+
}, [readyToScroll, viewerControl, props.pageNumberToScroll]);
|
|
17835
|
+
|
|
17806
17836
|
// Render the div tag which will be converted into the viewer.
|
|
17807
17837
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
17808
17838
|
children: [!preReqError && /*#__PURE__*/jsx("div", {
|
|
@@ -17847,7 +17877,9 @@ PrizmDocViewer.propTypes = {
|
|
|
17847
17877
|
documentPreviewServer: PropTypes.string,
|
|
17848
17878
|
includeJquery: PropTypes.bool,
|
|
17849
17879
|
uiElementsOptions: PropTypes.object,
|
|
17850
|
-
prizmDocViewerSettings: PropTypes.object
|
|
17880
|
+
prizmDocViewerSettings: PropTypes.object,
|
|
17881
|
+
pageNumberToScroll: PropTypes.number,
|
|
17882
|
+
onError: PropTypes.func
|
|
17851
17883
|
// options: PropTypes.shape({
|
|
17852
17884
|
// /** Show or hide the Annotate Tab. */
|
|
17853
17885
|
// annotateTab: PropTypes.bool,
|
|
@@ -17918,7 +17950,8 @@ const DocViewer = ({
|
|
|
17918
17950
|
prizmDocViewerUiElementOptions: _prizmDocViewerUiElementOptions = {},
|
|
17919
17951
|
prizmDocViewerSettings: _prizmDocViewerSettings = {},
|
|
17920
17952
|
onRequest,
|
|
17921
|
-
onError
|
|
17953
|
+
onError,
|
|
17954
|
+
pageNumberToScroll
|
|
17922
17955
|
}) => {
|
|
17923
17956
|
const isControlled = openProp !== undefined;
|
|
17924
17957
|
const [controlledOpen, setControlledOpen] = useState(true);
|
|
@@ -17969,7 +18002,9 @@ const DocViewer = ({
|
|
|
17969
18002
|
documentPreviewServer: documentPreviewServer,
|
|
17970
18003
|
includeJquery: _includeJquery,
|
|
17971
18004
|
uiElementsOptions: _prizmDocViewerUiElementOptions,
|
|
17972
|
-
prizmDocViewerSettings: _prizmDocViewerSettings
|
|
18005
|
+
prizmDocViewerSettings: _prizmDocViewerSettings,
|
|
18006
|
+
pageNumberToScroll: pageNumberToScroll
|
|
18007
|
+
|
|
17973
18008
|
// TODO: handle ready view here
|
|
17974
18009
|
// onViewerReady={setViewerControl}
|
|
17975
18010
|
})
|
|
@@ -17993,7 +18028,9 @@ const DocViewer = ({
|
|
|
17993
18028
|
},
|
|
17994
18029
|
includeJquery: _includeJquery,
|
|
17995
18030
|
uiElementsOptions: _prizmDocViewerUiElementOptions,
|
|
17996
|
-
prizmDocViewerSettings: _prizmDocViewerSettings
|
|
18031
|
+
prizmDocViewerSettings: _prizmDocViewerSettings,
|
|
18032
|
+
pageNumberToScroll: pageNumberToScroll,
|
|
18033
|
+
onError: onError
|
|
17997
18034
|
// TODO: handle ready view here
|
|
17998
18035
|
// onViewerReady={setViewerControl}
|
|
17999
18036
|
})
|
|
@@ -18035,7 +18072,9 @@ DocViewer.propTypes = {
|
|
|
18035
18072
|
/** Function to be called on error */
|
|
18036
18073
|
onError: PropTypes.func,
|
|
18037
18074
|
/** Function to be called on request */
|
|
18038
|
-
onRequest: PropTypes.func
|
|
18075
|
+
onRequest: PropTypes.func,
|
|
18076
|
+
/** Page number to scroll to */
|
|
18077
|
+
pageNumberToScroll: PropTypes.number
|
|
18039
18078
|
};
|
|
18040
18079
|
|
|
18041
18080
|
const styles = {
|