@fto-consult/expo-ui 8.73.0 → 8.73.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "8.73.0",
3
+ "version": "8.73.1",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "react-native-paper-doc": "https://github.com/callstack/react-native-paper/tree/main/docs/docs/guides",
6
6
  "scripts": {
@@ -70,7 +70,7 @@
70
70
  "dependencies": {
71
71
  "@emotion/react": "^11.11.1",
72
72
  "@faker-js/faker": "^8.0.2",
73
- "@fto-consult/common": "^4.44.3",
73
+ "@fto-consult/common": "^4.45.0",
74
74
  "apexcharts": "^3.48.0",
75
75
  "file-saver": "^2.0.5",
76
76
  "google-libphonenumber": "^3.2.34",
@@ -59,7 +59,6 @@ const BottomSheetComponent = React.forwardRef((props,ref)=> {
59
59
  modalProps,
60
60
  titleProps : _titleProps,
61
61
  withScrollView,
62
- bindResizeEvent,
63
62
  scrollViewProps : _scrollViewProps,
64
63
  actionTitle,
65
64
  elevation:customElevation,
@@ -228,12 +227,8 @@ const BottomSheetComponent = React.forwardRef((props,ref)=> {
228
227
 
229
228
  React.setRef(ref,{close:closeModal,open})
230
229
  React.useEffect(()=>{
231
- if(bindResizeEvent && false){
232
- APP.on(APP.EVENTS.RESIZE_PAGE,closeModal);
233
- }
234
230
  return ()=>{
235
231
  removeListeners();
236
- APP.off(APP.EVENTS.RESIZE_PAGE,closeModal);
237
232
  React.setRef(ref,null);
238
233
  }
239
234
  },[]);
@@ -326,7 +321,6 @@ BottomSheetComponent.propTypes = {
326
321
 
327
322
  BottomSheetComponent.defaultProps = {
328
323
  withScrollView : PropTypes.bool,
329
- bindResizeEvent : PropTypes.bool,
330
324
  animationType: isNativeMobile ? "slide" : "fade",//Background animation ("none", "fade", "slide")
331
325
  height:undefined,//Height of Bottom Sheet
332
326
  minClosingHeight: 0,//Minimum height of Bottom Sheet before close
@@ -21,8 +21,8 @@ import BackToTop from "$ecomponents/BackToTop";
21
21
  import FiltersAccordionComponent from "./Filters";
22
22
  import RenderType from "../RenderType";
23
23
  import { flatMode} from "$ecomponents/TextField";
24
- //import List from "$ecomponents/Table/List";
25
- import List from "$ecomponents/List/FlashList";
24
+ import List from "$ecomponents/Table/List";
25
+ //import List from "$ecomponents/List/FlashList";
26
26
  import theme,{Colors} from "$theme";
27
27
  import {styles as rStyles} from "../utils";
28
28
  import Avatar from "$ecomponents/Avatar";
@@ -0,0 +1,6 @@
1
+ export default function(){
2
+ return null;
3
+ }
4
+
5
+ export const open = ()=>{
6
+ };
@@ -1,178 +1,21 @@
1
- /**@see : https://github.com/pipwerks/PDFObject#readme */
2
- let {Dialog} = require("$ecomponents/Dialog")
3
- let Icon = require("$ecomponents/Icon")
4
- require("./styles.css")
5
- let PDFObject = require("pdfobject")
6
- let {MenuButton} = require("$ui")
7
- let isMSE = //checkEdge ? false :
8
- window.navigator && typeof window.navigator.msSaveOrOpenBlob == "function" ? true : false;
9
- class PDFViewer extends APP.Component {
10
- constructor(props){
11
- super(props);
12
- APP.extend(this._events,{
13
- resize : this.resetPos.bind(this)
14
- })
15
- this.autobind();
16
- }
1
+ import React from "$react";
2
+ import DialogProvider from "$ecomponents/Dialog/Provider";
17
3
 
18
- componentDidMount(){
19
- super.componentDidMount();
20
- this.updatePdfContent();
21
- window.addEventListener('resize',this._events.resize, true)
22
- this.resetPos();
23
- }
24
- resetPos (){
25
- if(!this._isMounted()) return;
26
- let pdfWrap = document.getElementById(this.pdfViewerWrapperDomId);
27
- if(isDOMElement(pdfWrap)){
28
- let parent = pdfWrap.parentNode;
29
- let mP = pdfWrap.closest(".dialog.md-dialog-container");
30
- if(isDOMElement(parent) && isDOMElement(mP)){
31
- let maxHeight = mezr.height(parent);
32
- let maxH2 = mezr.height(mP);
33
- let min = Math.min(maxHeight,maxH2);
34
- if(min == 0){
35
- min = "100%";
36
- } else min = min+"px";
37
- pdfWrap.style.height = min;
38
- }
39
- }
40
- }
4
+ let dialogRef = null;
41
5
 
42
- componentDidUpdate(){
43
- super.componentDidUpdate();
44
- if(this.dialogRef && this.dialogRef.open){
45
- this.dialogRef.open();
46
- }
47
- this.updatePdfContent()
48
- this.resetPos();
49
- }
50
- componentWillUnmount(){
51
- super.componentWillUnmount();
52
- this.dialogRef = undefined;
53
- window.removeEventListener('resize',this._events.resize, true)
54
- this.clearEvents();
55
- }
56
- viewCapacitor (){
57
- let f = window.PreviewAnyFile || (cordova && cordova.plugins.PreviewAnyFile);
58
- if(f && f.preview){
59
- f = f.preview;
60
- let {file} = this.props;
61
- APP.FILE.getCapacitorPDFromDataURL({content:file,fileName:this.props.fileName,success:({path})=>{
62
- if(isFunction(f)){
63
- f(
64
- path,
65
- function(win){},
66
- function(err){
67
- console.log(err," pdf viewer in cap android ios")
68
- }
69
- )
70
- }
71
- }})
72
- }
73
- }
74
- updatePdfContent(){
75
- let file = this.props.file;
76
- if (isMSE) {
77
- let b64 = dataURLToBase64(file);
78
- if(b64){
79
- var byteCharacters = atob(b64);
80
- var byteNumbers = new Array(byteCharacters.length);
81
- for (var i = 0; i < byteCharacters.length; i++) {
82
- byteNumbers[i] = byteCharacters.charCodeAt(i);
83
- }
84
- var byteArray = new Uint8Array(byteNumbers);
85
- var blob = new Blob([byteArray], {
86
- type: 'application/pdf'
87
- });
88
- return window.navigator.msSaveOrOpenBlob(blob, defaultStr(this.props.title,'données-impr')+".pdf");
89
- }
90
- return null;
91
- }
92
- if(isElectron()){
93
- return ELECTRON.PRINTER.preview({
94
- content:this.props.file,
95
- fileName : this.props.fileName,
96
- fileExtension : 'pdf',
97
- });
98
- }
99
- if(isCapacitor(true)){
100
- return this.viewCapacitor();
101
- }
102
- let dom = document.getElementById(this.pdfViewerWrapperDomId);
103
- if(isDOMElement(dom)){
104
- try {
105
- this.pdfInstance = PDFObject.embed(file,dom);
106
- } catch (e){
107
- console.log(e,' error on loading pdf file')
108
- }
109
- }
110
- }
111
- UNSAFE_componentWillReceiveProps(nexProps,prevProps){
112
- if(nexProps.file && nexProps.file != this.state.file){
113
- this._pageNumber = 1;
114
- }
115
- }
116
- onPrint (args){
117
- console.log(args,' was printed');
118
- }
119
- getPrintSettings(){
120
- return defaultObj(this.props.printProps,this.props.printOptions);
121
- }
122
- render (){
123
- if(isMSE || isElectron() || isCapacitor(true)) return null;
124
- let {file,dialogProps,title,onPrint,printProps,printOptions,fileName,...rest} = this.props;
125
- dialogProps = defaultObj(dialogProps);
126
- dialogProps.contentProps = defaultObj(dialogProps.contentProps)
127
- dialogProps.contentProps.id = defaultStr(dialogProps.contentProps.id,this.dialogWrapperParentId,uniqid('dialog-content-wrp-par'))
128
- this.dialogWrapperParentId = dialogProps.contentProps.id;
129
- dialogProps.contentProps.className = classNames(dialogProps.contentProps.className,'no-padding pdf-viewer-dialog-content')
130
- dialogProps.className = classNames(dialogProps.className,'pdf-viewer-dialog')
131
- dialogProps.title = defaultStr(dialogProps.title,title)
132
- rest = defaultObj(rest)
133
- let {actions} = dialogProps;
134
- let acts = []
135
- let mIts = []
136
- if(mIts.length > 0){
137
- acts.push(
138
- <MenuButton
139
- menuItems = {mIts}
140
- flat
141
- id = {uniqid("view-page-id-butt")}
142
- >
143
- {<Icon name="material-more_vert" title={"pages"}/>}
144
- </MenuButton>
145
- )
146
- }
147
- Object.map(actions,(a,i)=>{
148
- if(!a) return;
149
- acts.push(a);
150
- })
151
- this.pdfViewerWrapperDomId = defaultStr(this.pdfViewerWrapperDomId,uniqid("pdf-viewer-wrapper-id"))
152
- return (
153
- <Dialog
154
- key = {_uniqid("dialog-pdf-viewer-key-id")}
155
- {...dialogProps}
156
- ref = {(el)=>{
157
- if(el){
158
- this.dialogRef = el;
159
- }
160
- }}
161
- fullPage
162
- visible
163
- actions = {acts}
164
- >
165
- <div className="pdf-viewer-wrapper w100 h100" id={this.pdfViewerWrapperDomId}></div>
166
- </Dialog>
167
- );
168
- }
6
+ export default function WebPDFReader(){
7
+ dialogRef = React.useRef(null);
8
+ return <>
9
+ <DialogProvider
10
+ ref = {dialogRef}
11
+ responsive = {false}
12
+ />
13
+ </>
169
14
  }
170
15
 
171
- module.exports = PDFViewer;
172
- PDFViewer.PDFObject = PDFObject;
173
-
174
- PDFViewer.propTypes = {
175
- ...Document.propTypes,
176
- /*** méthode appelée lorsque le document est imprimé */
177
- onPrint : PropTypes.func,
16
+ export const open = (props)=>{
17
+ if(!dialogRef || !dialogRef?.current) return;
18
+ DialogProvider.open({
19
+ ...props,
20
+ },dialogRef.current);
178
21
  }
@@ -0,0 +1,178 @@
1
+ /**@see : https://github.com/pipwerks/PDFObject#readme */
2
+ let {Dialog} = require("$ecomponents/Dialog")
3
+ let Icon = require("$ecomponents/Icon")
4
+ require("./styles.css")
5
+ let PDFObject = require("pdfobject")
6
+ let {MenuButton} = require("$ui")
7
+ let isMSE = //checkEdge ? false :
8
+ window.navigator && typeof window.navigator.msSaveOrOpenBlob == "function" ? true : false;
9
+ class PDFViewer extends APP.Component {
10
+ constructor(props){
11
+ super(props);
12
+ APP.extend(this._events,{
13
+ resize : this.resetPos.bind(this)
14
+ })
15
+ this.autobind();
16
+ }
17
+
18
+ componentDidMount(){
19
+ super.componentDidMount();
20
+ this.updatePdfContent();
21
+ window.addEventListener('resize',this._events.resize, true)
22
+ this.resetPos();
23
+ }
24
+ resetPos (){
25
+ if(!this._isMounted()) return;
26
+ let pdfWrap = document.getElementById(this.pdfViewerWrapperDomId);
27
+ if(isDOMElement(pdfWrap)){
28
+ let parent = pdfWrap.parentNode;
29
+ let mP = pdfWrap.closest(".dialog.md-dialog-container");
30
+ if(isDOMElement(parent) && isDOMElement(mP)){
31
+ let maxHeight = mezr.height(parent);
32
+ let maxH2 = mezr.height(mP);
33
+ let min = Math.min(maxHeight,maxH2);
34
+ if(min == 0){
35
+ min = "100%";
36
+ } else min = min+"px";
37
+ pdfWrap.style.height = min;
38
+ }
39
+ }
40
+ }
41
+
42
+ componentDidUpdate(){
43
+ super.componentDidUpdate();
44
+ if(this.dialogRef && this.dialogRef.open){
45
+ this.dialogRef.open();
46
+ }
47
+ this.updatePdfContent()
48
+ this.resetPos();
49
+ }
50
+ componentWillUnmount(){
51
+ super.componentWillUnmount();
52
+ this.dialogRef = undefined;
53
+ window.removeEventListener('resize',this._events.resize, true)
54
+ this.clearEvents();
55
+ }
56
+ viewCapacitor (){
57
+ let f = window.PreviewAnyFile || (cordova && cordova.plugins.PreviewAnyFile);
58
+ if(f && f.preview){
59
+ f = f.preview;
60
+ let {file} = this.props;
61
+ APP.FILE.getCapacitorPDFromDataURL({content:file,fileName:this.props.fileName,success:({path})=>{
62
+ if(isFunction(f)){
63
+ f(
64
+ path,
65
+ function(win){},
66
+ function(err){
67
+ console.log(err," pdf viewer in cap android ios")
68
+ }
69
+ )
70
+ }
71
+ }})
72
+ }
73
+ }
74
+ updatePdfContent(){
75
+ let file = this.props.file;
76
+ if (isMSE) {
77
+ let b64 = dataURLToBase64(file);
78
+ if(b64){
79
+ var byteCharacters = atob(b64);
80
+ var byteNumbers = new Array(byteCharacters.length);
81
+ for (var i = 0; i < byteCharacters.length; i++) {
82
+ byteNumbers[i] = byteCharacters.charCodeAt(i);
83
+ }
84
+ var byteArray = new Uint8Array(byteNumbers);
85
+ var blob = new Blob([byteArray], {
86
+ type: 'application/pdf'
87
+ });
88
+ return window.navigator.msSaveOrOpenBlob(blob, defaultStr(this.props.title,'données-impr')+".pdf");
89
+ }
90
+ return null;
91
+ }
92
+ if(isElectron()){
93
+ return ELECTRON.PRINTER.preview({
94
+ content:this.props.file,
95
+ fileName : this.props.fileName,
96
+ fileExtension : 'pdf',
97
+ });
98
+ }
99
+ if(isCapacitor(true)){
100
+ return this.viewCapacitor();
101
+ }
102
+ let dom = document.getElementById(this.pdfViewerWrapperDomId);
103
+ if(isDOMElement(dom)){
104
+ try {
105
+ this.pdfInstance = PDFObject.embed(file,dom);
106
+ } catch (e){
107
+ console.log(e,' error on loading pdf file')
108
+ }
109
+ }
110
+ }
111
+ UNSAFE_componentWillReceiveProps(nexProps,prevProps){
112
+ if(nexProps.file && nexProps.file != this.state.file){
113
+ this._pageNumber = 1;
114
+ }
115
+ }
116
+ onPrint (args){
117
+ console.log(args,' was printed');
118
+ }
119
+ getPrintSettings(){
120
+ return defaultObj(this.props.printProps,this.props.printOptions);
121
+ }
122
+ render (){
123
+ if(isMSE || isElectron() || isCapacitor(true)) return null;
124
+ let {file,dialogProps,title,onPrint,printProps,printOptions,fileName,...rest} = this.props;
125
+ dialogProps = defaultObj(dialogProps);
126
+ dialogProps.contentProps = defaultObj(dialogProps.contentProps)
127
+ dialogProps.contentProps.id = defaultStr(dialogProps.contentProps.id,this.dialogWrapperParentId,uniqid('dialog-content-wrp-par'))
128
+ this.dialogWrapperParentId = dialogProps.contentProps.id;
129
+ dialogProps.contentProps.className = classNames(dialogProps.contentProps.className,'no-padding pdf-viewer-dialog-content')
130
+ dialogProps.className = classNames(dialogProps.className,'pdf-viewer-dialog')
131
+ dialogProps.title = defaultStr(dialogProps.title,title)
132
+ rest = defaultObj(rest)
133
+ let {actions} = dialogProps;
134
+ let acts = []
135
+ let mIts = []
136
+ if(mIts.length > 0){
137
+ acts.push(
138
+ <MenuButton
139
+ menuItems = {mIts}
140
+ flat
141
+ id = {uniqid("view-page-id-butt")}
142
+ >
143
+ {<Icon name="material-more_vert" title={"pages"}/>}
144
+ </MenuButton>
145
+ )
146
+ }
147
+ Object.map(actions,(a,i)=>{
148
+ if(!a) return;
149
+ acts.push(a);
150
+ })
151
+ this.pdfViewerWrapperDomId = defaultStr(this.pdfViewerWrapperDomId,uniqid("pdf-viewer-wrapper-id"))
152
+ return (
153
+ <Dialog
154
+ key = {_uniqid("dialog-pdf-viewer-key-id")}
155
+ {...dialogProps}
156
+ ref = {(el)=>{
157
+ if(el){
158
+ this.dialogRef = el;
159
+ }
160
+ }}
161
+ fullPage
162
+ visible
163
+ actions = {acts}
164
+ >
165
+ <div className="pdf-viewer-wrapper w100 h100" id={this.pdfViewerWrapperDomId}></div>
166
+ </Dialog>
167
+ );
168
+ }
169
+ }
170
+
171
+ module.exports = PDFViewer;
172
+ PDFViewer.PDFObject = PDFObject;
173
+
174
+ PDFViewer.propTypes = {
175
+ ...Document.propTypes,
176
+ /*** méthode appelée lorsque le document est imprimé */
177
+ onPrint : PropTypes.func,
178
+ }
@@ -0,0 +1,20 @@
1
+ import React from "$react";
2
+ import View from "$ecomponents/View";
3
+ export default function PdfViewerWeb(){
4
+ return <View testID="RN_PDF_WEBVIEW_COMPONENT">
5
+ <div id="viewerContainer">
6
+ <div id="viewer" class="pdfViewer"></div>
7
+ </div>
8
+ <div id="loadingBar">
9
+ <div class="progress"></div>
10
+ <div class="glimmer"></div>
11
+ </div>
12
+ <footer>
13
+ <button class="toolbarButton pageUp" title="Previous Page" id="previous"></button>
14
+ <button class="toolbarButton pageDown" title="Next Page" id="next"></button>
15
+ <input type="number" id="pageNumber" class="toolbarField pageNumber" value="1" size="4" min="1"/>
16
+ <button class="toolbarButton zoomOut" title="Zoom Out" id="zoomOut"></button>
17
+ <button class="toolbarButton zoomIn" title="Zoom In" id="zoomIn"></button>
18
+ </footer>
19
+ </View>
20
+ }
@@ -0,0 +1,334 @@
1
+ const pdfjsLib = require("pdfjs-dist/build/pdf.min.mjs");
2
+
3
+ const MAX_CANVAS_PIXELS = 0; // CSS-only zooming.
4
+ const TEXT_LAYER_MODE = 0; // DISABLE
5
+ const MAX_IMAGE_SIZE = 1024 * 1024;
6
+ const CMAP_URL = "../../node_modules/pdfjs-dist/cmaps/";
7
+ const CMAP_PACKED = true;
8
+ pdfjsLib.GlobalWorkerOptions.workerSrc = "../../../node_modules/pdfjs-dist/build/pdf.worker.mjs";
9
+ const DEFAULT_SCALE_DELTA = 1.1;
10
+ const MIN_SCALE = 0.25;
11
+ const MAX_SCALE = 10.0;
12
+ const DEFAULT_SCALE_VALUE = "auto";
13
+
14
+ const PDFViewerApplication = {
15
+ pdfLoadingTask: null,
16
+ pdfDocument: null,
17
+ pdfViewer: null,
18
+ pdfHistory: null,
19
+ pdfLinkService: null,
20
+ eventBus: null,
21
+
22
+ /**
23
+ * Opens PDF document specified by URL.
24
+ * @returns {Promise} - Returns the promise, which is resolved when document
25
+ * is opened.
26
+ */
27
+ open(params) {
28
+ if (this.pdfLoadingTask) {
29
+ // We need to destroy already opened document
30
+ return this.close().then(
31
+ function () {
32
+ // ... and repeat the open() call.
33
+ return this.open(params);
34
+ }.bind(this)
35
+ );
36
+ }
37
+ const url = params.url;
38
+ const self = this;
39
+ this.setTitleUsingUrl(url);
40
+
41
+ // Loading document.
42
+ const loadingTask = pdfjsLib.getDocument({
43
+ url,
44
+ maxImageSize: MAX_IMAGE_SIZE,
45
+ cMapUrl: CMAP_URL,
46
+ cMapPacked: CMAP_PACKED,
47
+ });
48
+ this.pdfLoadingTask = loadingTask;
49
+
50
+ loadingTask.onProgress = function (progressData) {
51
+ self.progress(progressData.loaded / progressData.total);
52
+ };
53
+
54
+ return loadingTask.promise.then(
55
+ function (pdfDocument) {
56
+ // Document loaded, specifying document for the viewer.
57
+ self.pdfDocument = pdfDocument;
58
+ self.pdfViewer.setDocument(pdfDocument);
59
+ self.pdfLinkService.setDocument(pdfDocument);
60
+ self.pdfHistory.initialize({
61
+ fingerprint: pdfDocument.fingerprints[0],
62
+ });
63
+
64
+ self.loadingBar.hide();
65
+ self.setTitleUsingMetadata(pdfDocument);
66
+ },
67
+ function (reason) {
68
+ let key = "pdfjs-loading-error";
69
+ if (reason instanceof pdfjsLib.InvalidPDFException) {
70
+ key = "pdfjs-invalid-file-error";
71
+ } else if (reason instanceof pdfjsLib.MissingPDFException) {
72
+ key = "pdfjs-missing-file-error";
73
+ } else if (reason instanceof pdfjsLib.UnexpectedResponseException) {
74
+ key = "pdfjs-unexpected-response-error";
75
+ }
76
+ self.l10n.get(key).then(msg => {
77
+ self.error(msg, { message: reason?.message });
78
+ });
79
+ self.loadingBar.hide();
80
+ }
81
+ );
82
+ },
83
+
84
+ /**
85
+ * Closes opened PDF document.
86
+ * @returns {Promise} - Returns the promise, which is resolved when all
87
+ * destruction is completed.
88
+ */
89
+ close() {
90
+ if (!this.pdfLoadingTask) {
91
+ return Promise.resolve();
92
+ }
93
+
94
+ const promise = this.pdfLoadingTask.destroy();
95
+ this.pdfLoadingTask = null;
96
+
97
+ if (this.pdfDocument) {
98
+ this.pdfDocument = null;
99
+
100
+ this.pdfViewer.setDocument(null);
101
+ this.pdfLinkService.setDocument(null, null);
102
+
103
+ if (this.pdfHistory) {
104
+ this.pdfHistory.reset();
105
+ }
106
+ }
107
+ return promise;
108
+ },
109
+
110
+ get loadingBar() {
111
+ const bar = document.getElementById("loadingBar");
112
+ return pdfjsLib.shadow(
113
+ this,
114
+ "loadingBar",
115
+ new pdfjsViewer.ProgressBar(bar)
116
+ );
117
+ },
118
+
119
+ setTitleUsingUrl: function pdfViewSetTitleUsingUrl(url) {
120
+ this.url = url;
121
+ let title = pdfjsLib.getFilenameFromUrl(url) || url;
122
+ try {
123
+ title = decodeURIComponent(title);
124
+ } catch {
125
+ // decodeURIComponent may throw URIError,
126
+ // fall back to using the unprocessed url in that case
127
+ }
128
+ this.setTitle(title);
129
+ },
130
+
131
+ setTitleUsingMetadata(pdfDocument) {
132
+ const self = this;
133
+ pdfDocument.getMetadata().then(function (data) {
134
+ const info = data.info,
135
+ metadata = data.metadata;
136
+ self.documentInfo = info;
137
+ self.metadata = metadata;
138
+
139
+ // Provides some basic debug information
140
+ console.log(
141
+ "PDF " +
142
+ pdfDocument.fingerprints[0] +
143
+ " [" +
144
+ info.PDFFormatVersion +
145
+ " " +
146
+ (info.Producer || "-").trim() +
147
+ " / " +
148
+ (info.Creator || "-").trim() +
149
+ "]" +
150
+ " (PDF.js: " +
151
+ (pdfjsLib.version || "-") +
152
+ ")"
153
+ );
154
+
155
+ let pdfTitle;
156
+ if (metadata && metadata.has("dc:title")) {
157
+ const title = metadata.get("dc:title");
158
+ // Ghostscript sometimes returns 'Untitled', so prevent setting the
159
+ // title to 'Untitled.
160
+ if (title !== "Untitled") {
161
+ pdfTitle = title;
162
+ }
163
+ }
164
+
165
+ if (!pdfTitle && info && info.Title) {
166
+ pdfTitle = info.Title;
167
+ }
168
+
169
+ if (pdfTitle) {
170
+ self.setTitle(pdfTitle + " - " + document.title);
171
+ }
172
+ });
173
+ },
174
+
175
+ setTitle: function pdfViewSetTitle(title) {
176
+ document.title = title;
177
+ document.getElementById("title").textContent = title;
178
+ },
179
+
180
+ error: function pdfViewError(message, moreInfo) {
181
+ const moreInfoText = [
182
+ `PDF.js v${pdfjsLib.version || "?"} (build: ${pdfjsLib.build || "?"})`,
183
+ ];
184
+ if (moreInfo) {
185
+ moreInfoText.push(`Message: ${moreInfo.message}`);
186
+
187
+ if (moreInfo.stack) {
188
+ moreInfoText.push(`Stack: ${moreInfo.stack}`);
189
+ } else {
190
+ if (moreInfo.filename) {
191
+ moreInfoText.push(`File: ${moreInfo.filename}`);
192
+ }
193
+ if (moreInfo.lineNumber) {
194
+ moreInfoText.push(`Line: ${moreInfo.lineNumber}`);
195
+ }
196
+ }
197
+ }
198
+
199
+ console.error(`${message}\n\n${moreInfoText.join("\n")}`);
200
+ },
201
+
202
+ progress: function pdfViewProgress(level) {
203
+ const percent = Math.round(level * 100);
204
+ // Updating the bar if value increases.
205
+ if (percent > this.loadingBar.percent || isNaN(percent)) {
206
+ this.loadingBar.percent = percent;
207
+ }
208
+ },
209
+
210
+ get pagesCount() {
211
+ return this.pdfDocument.numPages;
212
+ },
213
+
214
+ get page() {
215
+ return this.pdfViewer.currentPageNumber;
216
+ },
217
+
218
+ set page(val) {
219
+ this.pdfViewer.currentPageNumber = val;
220
+ },
221
+
222
+ zoomIn: function pdfViewZoomIn(ticks) {
223
+ let newScale = this.pdfViewer.currentScale;
224
+ do {
225
+ newScale = (newScale * DEFAULT_SCALE_DELTA).toFixed(2);
226
+ newScale = Math.ceil(newScale * 10) / 10;
227
+ newScale = Math.min(MAX_SCALE, newScale);
228
+ } while (--ticks && newScale < MAX_SCALE);
229
+ this.pdfViewer.currentScaleValue = newScale;
230
+ },
231
+
232
+ zoomOut: function pdfViewZoomOut(ticks) {
233
+ let newScale = this.pdfViewer.currentScale;
234
+ do {
235
+ newScale = (newScale / DEFAULT_SCALE_DELTA).toFixed(2);
236
+ newScale = Math.floor(newScale * 10) / 10;
237
+ newScale = Math.max(MIN_SCALE, newScale);
238
+ } while (--ticks && newScale > MIN_SCALE);
239
+ this.pdfViewer.currentScaleValue = newScale;
240
+ },
241
+
242
+ initUI: function pdfViewInitUI() {
243
+ const eventBus = new pdfjsViewer.EventBus();
244
+ this.eventBus = eventBus;
245
+
246
+ const linkService = new pdfjsViewer.PDFLinkService({
247
+ eventBus,
248
+ });
249
+ this.pdfLinkService = linkService;
250
+
251
+ this.l10n = new pdfjsViewer.GenericL10n();
252
+
253
+ const container = document.getElementById("viewerContainer");
254
+ const pdfViewer = new pdfjsViewer.PDFViewer({
255
+ container,
256
+ eventBus,
257
+ linkService,
258
+ l10n: this.l10n,
259
+ maxCanvasPixels: MAX_CANVAS_PIXELS,
260
+ textLayerMode: TEXT_LAYER_MODE,
261
+ });
262
+ this.pdfViewer = pdfViewer;
263
+ linkService.setViewer(pdfViewer);
264
+
265
+ this.pdfHistory = new pdfjsViewer.PDFHistory({
266
+ eventBus,
267
+ linkService,
268
+ });
269
+ linkService.setHistory(this.pdfHistory);
270
+
271
+ document.getElementById("previous").addEventListener("click", function () {
272
+ PDFViewerApplication.page--;
273
+ });
274
+
275
+ document.getElementById("next").addEventListener("click", function () {
276
+ PDFViewerApplication.page++;
277
+ });
278
+
279
+ document.getElementById("zoomIn").addEventListener("click", function () {
280
+ PDFViewerApplication.zoomIn();
281
+ });
282
+
283
+ document.getElementById("zoomOut").addEventListener("click", function () {
284
+ PDFViewerApplication.zoomOut();
285
+ });
286
+
287
+ document
288
+ .getElementById("pageNumber")
289
+ .addEventListener("click", function () {
290
+ this.select();
291
+ });
292
+
293
+ document
294
+ .getElementById("pageNumber")
295
+ .addEventListener("change", function () {
296
+ PDFViewerApplication.page = this.value | 0;
297
+
298
+ // Ensure that the page number input displays the correct value,
299
+ // even if the value entered by the user was invalid
300
+ // (e.g. a floating point number).
301
+ if (this.value !== PDFViewerApplication.page.toString()) {
302
+ this.value = PDFViewerApplication.page;
303
+ }
304
+ });
305
+
306
+ eventBus.on("pagesinit", function () {
307
+ // We can use pdfViewer now, e.g. let's change default scale.
308
+ pdfViewer.currentScaleValue = DEFAULT_SCALE_VALUE;
309
+ });
310
+
311
+ eventBus.on(
312
+ "pagechanging",
313
+ function (evt) {
314
+ const page = evt.pageNumber;
315
+ const numPages = PDFViewerApplication.pagesCount;
316
+
317
+ document.getElementById("pageNumber").value = page;
318
+ document.getElementById("previous").disabled = page <= 1;
319
+ document.getElementById("next").disabled = page >= numPages;
320
+ },
321
+ true
322
+ );
323
+ },
324
+ };
325
+
326
+ window.PDFViewerApplication = PDFViewerApplication;
327
+
328
+ document.addEventListener(
329
+ "DOMContentLoaded",
330
+ function () {
331
+ PDFViewerApplication.initUI();
332
+ },
333
+ true
334
+ );
@@ -1,46 +1,72 @@
1
1
  module.exports = {
2
2
  "@fto-consult/expo-ui": {
3
- "name": "@fto-consult/expo-ui",
4
- "version": "8.72.0",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/borispipo/expo-ui.git"
8
- },
9
- "homepage": "https://github.com/borispipo/expo-ui#readme"
3
+ "version": "8.73.0",
4
+ "url": "https://github.com/borispipo/expo-ui#readme",
5
+ "license": "ISC"
10
6
  },
11
7
  "@babel/plugin-proposal-export-namespace-from": {
12
8
  "version": "7.18.9",
13
9
  "url": "https://babel.dev/docs/en/next/babel-plugin-proposal-export-namespace-from",
14
10
  "license": "MIT"
15
11
  },
16
- "@emotion/react": {
17
- "version": "11.11.4",
18
- "url": "https://github.com/emotion-js/emotion/tree/main/packages/react",
12
+ "@emotion/native": {
13
+ "version": "11.11.0",
14
+ "url": "https://emotion.sh",
15
+ "license": "MIT"
16
+ },
17
+ "@expo/html-elements": {
18
+ "version": "0.5.1",
19
+ "url": "https://github.com/expo/expo/tree/main/packages/html-elements",
19
20
  "license": "MIT"
20
21
  },
21
22
  "@expo/metro-config": {
22
- "version": "0.17.6",
23
+ "version": "0.17.7",
23
24
  "url": "https://github.com/expo/expo.git",
24
25
  "license": "MIT"
25
26
  },
27
+ "@expo/vector-icons": {
28
+ "version": "14.0.0",
29
+ "url": "https://expo.github.io/vector-icons",
30
+ "license": "MIT"
31
+ },
26
32
  "@expo/webpack-config": {
27
33
  "version": "19.0.1",
28
34
  "url": "https://github.com/expo/expo-webpack-integrations/tree/main/packages/webpack-config#readme",
29
35
  "license": "MIT"
30
36
  },
31
- "@faker-js/faker": {
32
- "version": "8.4.1",
33
- "url": "https://github.com/faker-js/faker.git",
37
+ "@pchmn/expo-material3-theme": {
38
+ "version": "1.3.2",
39
+ "url": "https://github.com/pchmn/expo-material3-theme#readme",
34
40
  "license": "MIT"
35
41
  },
36
- "@fto-consult/common": {
37
- "version": "4.43.4",
38
- "url": "https://github.com/borispipo/common#readme",
39
- "license": "ISC"
42
+ "@react-native-community/netinfo": {
43
+ "version": "11.1.0",
44
+ "url": "https://github.com/react-native-netinfo/react-native-netinfo#readme",
45
+ "license": "MIT"
46
+ },
47
+ "@react-native/assets-registry": {
48
+ "version": "0.72.0",
49
+ "url": "git@github.com:facebook/react-native.git",
50
+ "license": "MIT"
51
+ },
52
+ "@react-navigation/native": {
53
+ "version": "6.1.17",
54
+ "url": "https://reactnavigation.org",
55
+ "license": "MIT"
56
+ },
57
+ "@react-navigation/native-stack": {
58
+ "version": "6.9.26",
59
+ "url": "https://github.com/software-mansion/react-native-screens#readme",
60
+ "license": "MIT"
61
+ },
62
+ "@react-navigation/stack": {
63
+ "version": "6.3.29",
64
+ "url": "https://reactnavigation.org/docs/stack-navigator/",
65
+ "license": "MIT"
40
66
  },
41
- "apexcharts": {
42
- "version": "3.48.0",
43
- "url": "https://apexcharts.com",
67
+ "@shopify/flash-list": {
68
+ "version": "1.6.3",
69
+ "url": "https://shopify.github.io/flash-list/",
44
70
  "license": "MIT"
45
71
  },
46
72
  "babel-plugin-inline-dotenv": {
@@ -58,48 +84,74 @@ module.exports = {
58
84
  "url": "https://github.com/crypto-browserify/crypto-browserify",
59
85
  "license": "MIT"
60
86
  },
61
- "file-saver": {
62
- "version": "2.0.5",
63
- "url": "https://github.com/eligrey/FileSaver.js#readme",
87
+ "expo": {
88
+ "version": "50.0.17",
89
+ "url": "https://github.com/expo/expo/tree/main/packages/expo",
64
90
  "license": "MIT"
65
91
  },
66
- "google-libphonenumber": {
67
- "version": "3.2.34",
68
- "url": "https://ruimarinho.github.io/google-libphonenumber/",
69
- "license": "(MIT AND Apache-2.0)"
92
+ "expo-camera": {
93
+ "version": "14.1.3",
94
+ "url": "https://docs.expo.dev/versions/latest/sdk/camera/",
95
+ "license": "MIT"
96
+ },
97
+ "expo-clipboard": {
98
+ "version": "5.0.1",
99
+ "url": "https://docs.expo.dev/versions/latest/sdk/clipboard",
100
+ "license": "MIT"
101
+ },
102
+ "expo-document-picker": {
103
+ "version": "11.10.1",
104
+ "url": "https://docs.expo.dev/versions/latest/sdk/document-picker/",
105
+ "license": "MIT"
106
+ },
107
+ "expo-font": {
108
+ "version": "11.10.3",
109
+ "url": "https://docs.expo.dev/versions/latest/sdk/font/",
110
+ "license": "MIT"
111
+ },
112
+ "expo-image-picker": {
113
+ "version": "14.7.1",
114
+ "url": "https://docs.expo.dev/versions/latest/sdk/imagepicker/",
115
+ "license": "MIT"
116
+ },
117
+ "expo-intent-launcher": {
118
+ "version": "10.11.0",
119
+ "url": "https://docs.expo.dev/versions/latest/sdk/intent-launcher/",
120
+ "license": "MIT"
70
121
  },
71
- "html2canvas": {
72
- "version": "1.4.1",
73
- "url": "https://html2canvas.hertzen.com",
122
+ "expo-linking": {
123
+ "version": "6.2.2",
124
+ "url": "https://docs.expo.dev/versions/latest/sdk/linking",
74
125
  "license": "MIT"
75
126
  },
76
- "htmlparser2-without-node-native": {
77
- "version": "3.9.2",
78
- "url": "git://github.com/fb55/htmlparser2.git",
127
+ "expo-sharing": {
128
+ "version": "11.10.0",
129
+ "url": "https://docs.expo.dev/versions/latest/sdk/sharing/",
79
130
  "license": "MIT"
80
131
  },
81
- "is-plain-obj": {
82
- "version": "4.1.0",
132
+ "expo-sqlite": {
133
+ "version": "13.4.0",
134
+ "url": "https://docs.expo.dev/versions/latest/sdk/sqlite/",
83
135
  "license": "MIT"
84
136
  },
85
- "jsbarcode": {
86
- "version": "3.11.6",
87
- "url": "https://github.com/lindell/JsBarcode#readme",
137
+ "expo-status-bar": {
138
+ "version": "1.11.1",
139
+ "url": "https://docs.expo.dev/versions/latest/sdk/status-bar/",
88
140
  "license": "MIT"
89
141
  },
90
- "prop-types": {
91
- "version": "15.8.1",
92
- "url": "https://facebook.github.io/react/",
142
+ "expo-system-ui": {
143
+ "version": "2.9.4",
144
+ "url": "https://docs.expo.dev/versions/latest/sdk/system-ui",
93
145
  "license": "MIT"
94
146
  },
95
- "react-content-loader": {
96
- "version": "6.2.1",
97
- "url": "https://github.com/danilowoz/react-content-loader",
147
+ "expo-web-browser": {
148
+ "version": "12.8.2",
149
+ "url": "https://docs.expo.dev/versions/latest/sdk/webbrowser/",
98
150
  "license": "MIT"
99
151
  },
100
- "react-dom": {
101
- "version": "18.2.0",
102
- "url": "https://reactjs.org/",
152
+ "react-native": {
153
+ "version": "0.73.6",
154
+ "url": "https://reactnative.dev/",
103
155
  "license": "MIT"
104
156
  },
105
157
  "react-native-big-list": {
@@ -107,44 +159,45 @@ module.exports = {
107
159
  "url": "https://marcocesarato.github.io/react-native-big-list-docs/",
108
160
  "license": "GPL-3.0-or-later"
109
161
  },
110
- "react-native-iphone-x-helper": {
111
- "version": "1.3.1",
112
- "url": "https://github.com/ptelad/react-native-iphone-x-helper#readme",
162
+ "react-native-blob-util": {
163
+ "version": "0.18.6",
164
+ "url": "https://github.com/RonRadtke/react-native-blob-util",
113
165
  "license": "MIT"
114
166
  },
115
- "react-native-mime-types": {
116
- "version": "2.5.0",
167
+ "react-native-gesture-handler": {
168
+ "version": "2.14.1",
169
+ "url": "https://github.com/software-mansion/react-native-gesture-handler#readme",
117
170
  "license": "MIT"
118
171
  },
119
- "react-native-paper": {
120
- "version": "5.12.3",
121
- "url": "https://callstack.github.io/react-native-paper",
172
+ "react-native-reanimated": {
173
+ "version": "3.6.2",
174
+ "url": "https://github.com/software-mansion/react-native-reanimated#readme",
122
175
  "license": "MIT"
123
176
  },
124
- "react-native-paper-dates": {
125
- "version": "0.22.7",
126
- "url": "https://github.com/web-ridge/react-native-paper-dates#readme",
177
+ "react-native-safe-area-context": {
178
+ "version": "4.8.2",
179
+ "url": "https://github.com/th3rdwave/react-native-safe-area-context#readme",
127
180
  "license": "MIT"
128
181
  },
129
- "react-native-web": {
130
- "version": "0.19.10",
131
- "url": "git://github.com/necolas/react-native-web.git",
182
+ "react-native-screens": {
183
+ "version": "3.29.0",
184
+ "url": "https://github.com/software-mansion/react-native-screens#readme",
132
185
  "license": "MIT"
133
186
  },
134
- "react-virtuoso": {
135
- "version": "4.7.9",
136
- "url": "https://virtuoso.dev/",
187
+ "react-native-svg": {
188
+ "version": "14.1.0",
189
+ "url": "https://github.com/react-native-community/react-native-svg",
137
190
  "license": "MIT"
138
191
  },
139
- "readable-stream": {
140
- "version": "4.5.2",
141
- "url": "https://github.com/nodejs/readable-stream",
192
+ "react-native-view-shot": {
193
+ "version": "3.8.0",
194
+ "url": "https://github.com/gre/react-native-view-shot",
142
195
  "license": "MIT"
143
196
  },
144
- "sanitize-filename": {
145
- "version": "1.6.3",
146
- "url": "git@github.com:parshap/node-sanitize-filename.git",
147
- "license": "WTFPL OR ISC"
197
+ "react-native-webview": {
198
+ "version": "13.6.4",
199
+ "url": "https://github.com/react-native-webview/react-native-webview#readme",
200
+ "license": "MIT"
148
201
  },
149
202
  "sharp-cli": {
150
203
  "version": "2.1.1",
@@ -156,19 +209,9 @@ module.exports = {
156
209
  "url": "https://github.com/browserify/stream-browserify",
157
210
  "license": "MIT"
158
211
  },
159
- "tippy.js": {
160
- "version": "6.3.7",
161
- "url": "https://atomiks.github.io/tippyjs/",
162
- "license": "MIT"
163
- },
164
212
  "vm": {
165
213
  "version": "0.1.0",
166
214
  "url": "https://github.com/DiegoRBaquero/node-vm#readme",
167
215
  "license": "MIT"
168
- },
169
- "xlsx": {
170
- "version": "0.18.5",
171
- "url": "https://sheetjs.com/",
172
- "license": "Apache-2.0"
173
216
  }
174
217
  };