@fto-consult/expo-ui 3.6.1 → 4.0.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/appConfig.txt +4 -1
- package/babel.config.alias.js +11 -1
- package/bin/index.js +23 -17
- package/electron/app/desktopCapturer.js +123 -0
- package/electron/app/email.js +55 -0
- package/electron/app/file.js +501 -0
- package/electron/app/index.html +32 -0
- package/electron/app/index.js +19 -0
- package/electron/app/instance.js +46 -0
- package/electron/app/printer.js +52 -0
- package/electron/{src/config.js → config.js} +0 -0
- package/electron/{copyDir.js → copy.js} +6 -4
- package/electron/createDir.js +19 -3
- package/electron/createDirSync.js +31 -0
- package/electron/exec.js +1 -1
- package/electron/index.js +40 -12
- package/electron/package.app.json +44 -0
- package/{bin → electron}/parseArgs.js +5 -2
- package/electron/{src/pload.js → pload.js} +31 -18
- package/electron/postMessage.js +19 -0
- package/electron/preload.js +333 -0
- package/electron/{src/session.js → session.js} +0 -0
- package/package.json +6 -4
- package/readMe.md +16 -7
- package/src/components/Datagrid/Common/Common.js +11 -11
- package/src/components/Datagrid/Table/index.js +0 -1
- package/src/components/Table/index.js +2 -6
- package/src/index.js +62 -18
- package/electron/src/preload.js +0 -396
package/appConfig.txt
CHANGED
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
/*** le nombre maximal de courbes qu'on peut afficher sur le même graphe***/
|
|
10
10
|
maxSupportedChartSeries {number}
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
///fonction de rappel appelée avant d'exit l'application, doit retourner une promesse que lorsque résolue, exit l'application
|
|
13
|
+
beforeExit : ()=><Promise>
|
|
14
|
+
|
|
12
15
|
/***les fonctions d'aggregations du datagrid**/
|
|
13
16
|
datagridAggregatorFunctions : {objectOf({code:{string},label:{string},eval:{function}})|| arrayOf({code:{string},label:{string},eval:{function}})}
|
|
14
17
|
/**l'ensemble des selectors à appliquer au champs de type hashtag, permettant de faire des liens vers d'autres tables**/
|
package/babel.config.alias.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const path = require("path");
|
|
2
2
|
const fs = require("fs");
|
|
3
|
+
const writeFile = require("./electron/writeFile");
|
|
3
4
|
module.exports = (opts)=>{
|
|
4
5
|
const dir = path.resolve(__dirname);
|
|
5
6
|
const base = opts.base || process.cwd();
|
|
@@ -115,13 +116,18 @@ module.exports = (opts)=>{
|
|
|
115
116
|
outputPath
|
|
116
117
|
});
|
|
117
118
|
const $assets = r.$assets;
|
|
119
|
+
const $electron = path.resolve(dir,"electron");
|
|
118
120
|
const electronPaths = {
|
|
119
121
|
...r,
|
|
120
122
|
sourceCode : r.$src,
|
|
121
123
|
assets : $assets,
|
|
122
124
|
images : r.$images,
|
|
123
125
|
projectRoot : base,//la racine au projet
|
|
126
|
+
electron : $electron,//le chemin racine electron
|
|
124
127
|
};
|
|
128
|
+
//le chemin ver le repertoire electron
|
|
129
|
+
r.$eelectron = r["$e-electron"] = $electron;
|
|
130
|
+
r.$electron = r.$electron || r.$eelectron;
|
|
125
131
|
const electronAssetsPath = path.resolve(dir,"electron","assets");
|
|
126
132
|
if($assets){
|
|
127
133
|
const l1 = path.resolve($assets,"logo.png"), l2 = path.resolve($assets,"logo.png");
|
|
@@ -132,7 +138,11 @@ module.exports = (opts)=>{
|
|
|
132
138
|
electronPaths.logo = logoPath;
|
|
133
139
|
}
|
|
134
140
|
}
|
|
141
|
+
const jsonPath = path.resolve(base,'package.json');
|
|
142
|
+
if(fs.existsSync(jsonPath)){
|
|
143
|
+
require("./electron/copy")(jsonPath,path.resolve(dir,"electron","package.app.json"));
|
|
144
|
+
}
|
|
135
145
|
///on sauvegarde les chemins des fichiers utiles, qui seront utilisées par la variable electron plus tard
|
|
136
|
-
|
|
146
|
+
writeFile(path.resolve(dir,"electron","paths.json"),JSON.stringify(electronPaths));
|
|
137
147
|
return r;
|
|
138
148
|
}
|
package/bin/index.js
CHANGED
|
@@ -13,11 +13,10 @@ const fs = require("fs");
|
|
|
13
13
|
const dir = path.resolve(__dirname);
|
|
14
14
|
const electronDir = path.resolve(dir, "..","electron");
|
|
15
15
|
const exec = require("../electron/exec");
|
|
16
|
-
const args = process.argv.slice(2);
|
|
17
16
|
let projectRoot = process.cwd();
|
|
18
17
|
const createDir = require("../electron/createDir");
|
|
19
|
-
const copyDir = require("../electron/
|
|
20
|
-
const parsedArgs = require("
|
|
18
|
+
const copyDir = require("../electron/copy");
|
|
19
|
+
const parsedArgs = require("../electron/parseArgs")(null,supportedScript);
|
|
21
20
|
if(!parsedArgs.script || !(parsedArgs.script in supportedScript)){
|
|
22
21
|
console.error ("Erreur : script invalide, vous devez spécifier script figurant parmi les script : ["+Object.keys(supportedScript).join(", ")+"]");
|
|
23
22
|
process.exit();
|
|
@@ -29,6 +28,7 @@ let cmd = null;
|
|
|
29
28
|
* cmde : [cmd] start electron config=[path-to-config-relative-to-project-dir]
|
|
30
29
|
* splash=[path-to-splashcreen-relative-to-project-root]
|
|
31
30
|
* output-dir|out = [path-to-output-dir-relative-to-root-project]
|
|
31
|
+
* url = [url-to-start-electron-to]
|
|
32
32
|
* */
|
|
33
33
|
if(parsedArgs.electron){
|
|
34
34
|
const pathsJSON = path.resolve(electronDir,"paths.json");
|
|
@@ -54,17 +54,32 @@ if(parsedArgs.electron){
|
|
|
54
54
|
const buildOutDir = path.resolve(electronDir,"dist");
|
|
55
55
|
const indexFile = path.resolve(buildOutDir,"index.html");
|
|
56
56
|
const webBuildDir = path.resolve(projectRoot,"web-build");
|
|
57
|
+
const url = parsedArgs.url && parsedArgs.url.trim() || "";
|
|
58
|
+
const start = x=>{
|
|
59
|
+
return new Promise((resolve,reject)=>{
|
|
60
|
+
cmd = "electron "+electronDir+" url="+url;
|
|
61
|
+
exec({
|
|
62
|
+
cmd,
|
|
63
|
+
projectRoot : electronDir,
|
|
64
|
+
}).finally(()=>{
|
|
65
|
+
console.log("ant to exit");
|
|
66
|
+
})
|
|
67
|
+
typeof (resolve) =='function' && setTimeout(resolve,1000);
|
|
68
|
+
})
|
|
69
|
+
};
|
|
70
|
+
if(url){
|
|
71
|
+
return start().then(process.exit);
|
|
72
|
+
}
|
|
57
73
|
const promise = new Promise((resolve,reject)=>{
|
|
58
|
-
|
|
74
|
+
const next = ()=>{
|
|
59
75
|
if(fs.existsSync(webBuildDir)){
|
|
60
76
|
return copyDir(webBuildDir,buildOutDir).catch(reject).then(resolve);
|
|
61
77
|
} else {
|
|
62
|
-
reject("
|
|
78
|
+
reject("dossier web-build exporté par electron innexistant!!");
|
|
63
79
|
}
|
|
64
80
|
}
|
|
65
|
-
if(parsedArgs.compile || !fs.existsSync(path.resolve(webBuildDir,"index.html"))){
|
|
81
|
+
if(!url && (parsedArgs.compile || !fs.existsSync(path.resolve(webBuildDir,"index.html")))){
|
|
66
82
|
cmd = "npx expo export:web";
|
|
67
|
-
console.log("******************** exporting app : "+cmd);
|
|
68
83
|
return exec({cmd,projectRoot}).then(next).catch(reject);
|
|
69
84
|
}
|
|
70
85
|
next();
|
|
@@ -75,16 +90,7 @@ if(parsedArgs.electron){
|
|
|
75
90
|
}
|
|
76
91
|
switch(script){
|
|
77
92
|
case "start":
|
|
78
|
-
|
|
79
|
-
return new Promise((resolve,reject)=>{
|
|
80
|
-
exec({
|
|
81
|
-
cmd,
|
|
82
|
-
projectRoot : electronDir,
|
|
83
|
-
}).finally(()=>{
|
|
84
|
-
console.log("ant to exit");
|
|
85
|
-
})
|
|
86
|
-
setTimeout(resolve,1000)
|
|
87
|
-
})
|
|
93
|
+
return start();
|
|
88
94
|
break;
|
|
89
95
|
case "build":
|
|
90
96
|
break;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
module.exports = (ELECTRON)=>{
|
|
2
|
+
let ProgressBar = require("./ProgressBar")
|
|
3
|
+
let progressBarCounter = 0;
|
|
4
|
+
function getUserMedia(constraints) {
|
|
5
|
+
let check = typeof constraints === "boolean"? true : false;
|
|
6
|
+
if(check){
|
|
7
|
+
constraints = {};
|
|
8
|
+
}
|
|
9
|
+
// if Promise-based API is available, use it
|
|
10
|
+
if (isObj(navigator.mediaDevices)) {
|
|
11
|
+
if(check === true) return true;
|
|
12
|
+
return navigator.mediaDevices.getUserMedia(constraints);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// otherwise try falling back to old, possibly prefixed API...
|
|
16
|
+
var legacyApi = navigator.getUserMedia || navigator.webkitGetUserMedia ||
|
|
17
|
+
navigator.mozGetUserMedia || navigator.msGetUserMedia;
|
|
18
|
+
if(check === true){
|
|
19
|
+
return legacyApi ? true : false;
|
|
20
|
+
}
|
|
21
|
+
if (legacyApi) {
|
|
22
|
+
return new Promise(function (resolve, reject) {
|
|
23
|
+
legacyApi.bind(navigator)(constraints, resolve, reject);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return Promise.reject({status:false,msg:"user media not available"})
|
|
27
|
+
}
|
|
28
|
+
const { desktopCapturer,ipcRenderer } = require('electron')
|
|
29
|
+
let SECRET_KEY = require("../app.config").id;
|
|
30
|
+
ipcRenderer.on("click-on-system-tray-menu-item",(event,opts)=>{
|
|
31
|
+
opts = defaultObj(opts);
|
|
32
|
+
switch(opts.action){
|
|
33
|
+
case "pauseRecording":
|
|
34
|
+
return pauseRecording();
|
|
35
|
+
case "stopRecording":
|
|
36
|
+
return stopRecording();
|
|
37
|
+
case "resumeRecording" :
|
|
38
|
+
return resumeRecording();
|
|
39
|
+
}
|
|
40
|
+
}),
|
|
41
|
+
updateSystemTray = ()=>{
|
|
42
|
+
let {isPaused,isRecording} = APP.desktopCapturer.getRecordingStatus();
|
|
43
|
+
/*ipcRenderer.send("update-system-tray",{
|
|
44
|
+
tooltip : isRecording? ("La capture vidéo est en cours d'enregistrement"):(isPaused? "La capture vidéo est en pause":"La capture vidéo est inactive"),
|
|
45
|
+
contextMenu : isRecording || isPaused? JSON.stringify([
|
|
46
|
+
{ label: isRecording? 'Mettre en pause':'Relancer la capture vidéo',action:isRecording?'pauseRecording':'resumeRecording'},
|
|
47
|
+
{ label: 'Arréter la capture vidéo',action:'stopRecording'}
|
|
48
|
+
]): null
|
|
49
|
+
});*/
|
|
50
|
+
if(!APP.COMPANY.showPreloaderOnScreenCapture){
|
|
51
|
+
if(progressBarCounter !== 0){
|
|
52
|
+
progressBarCounter = 0;
|
|
53
|
+
ProgressBar.set(0);
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
if((isPaused || !isRecording)){
|
|
58
|
+
progressBarCounter = 0;
|
|
59
|
+
} else if(isRecording){
|
|
60
|
+
progressBarCounter+=2;
|
|
61
|
+
} else progressBarCounter = 0;
|
|
62
|
+
ProgressBar.set(progressBarCounter);
|
|
63
|
+
}
|
|
64
|
+
async function getUserMediaAsync(constraints) {
|
|
65
|
+
try {
|
|
66
|
+
const stream = await getUserMedia(constraints);
|
|
67
|
+
return stream;
|
|
68
|
+
} catch (e) {
|
|
69
|
+
console.error('navigator.getUserMedia error:', e);
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
function startRecording(opts) {
|
|
74
|
+
opts = defaultObj(opts)
|
|
75
|
+
var title = document.title;
|
|
76
|
+
document.title = SECRET_KEY;
|
|
77
|
+
opts.video = defaultObj(opts.video);
|
|
78
|
+
let audio = isBool(opts.audio) && !opts.audio ? false : defaultObj(opts.audio);
|
|
79
|
+
let handleStream = defaultFunc(opts.handleStream), handleUserMediaError = defaultFunc(opts.handleUserMediaError)
|
|
80
|
+
let video = {
|
|
81
|
+
...opts.video,
|
|
82
|
+
mandatory: {
|
|
83
|
+
...defaultObj(opts.video.mandatory),
|
|
84
|
+
chromeMediaSource: 'desktop',
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return desktopCapturer.getSources({ types: ['window', 'screen'] }).then(function(sources) {
|
|
88
|
+
for (let i = 0; i < sources.length; i++) {
|
|
89
|
+
let src = sources[i];
|
|
90
|
+
if (src.name === SECRET_KEY) {
|
|
91
|
+
document.title = title;
|
|
92
|
+
video.mandatory.chromeMediaSourceId = src.id;
|
|
93
|
+
if(audio){
|
|
94
|
+
(async() => {
|
|
95
|
+
const audioStream = await getUserMediaAsync(APP.desktopCapturer.getAudioConstraint())
|
|
96
|
+
const videoStream = await getUserMediaAsync({audio:false,video})
|
|
97
|
+
if(audioStream && videoStream){
|
|
98
|
+
const combinedStream = new MediaStream([...videoStream.getVideoTracks(), ...audioStream.getAudioTracks()])
|
|
99
|
+
handleStream(combinedStream)
|
|
100
|
+
}
|
|
101
|
+
})();
|
|
102
|
+
} else {
|
|
103
|
+
getUserMedia({audio:false,video}).then(handleStream).catch(handleUserMediaError);
|
|
104
|
+
}
|
|
105
|
+
return {sources,currentSource:src,isRecording:true};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return {sources,isRecording:false};
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if(!isObj(ELECTRON.desktopCapturer)){
|
|
113
|
+
Object.defineProperties(ELECTRON,{
|
|
114
|
+
desktopCapturer : {
|
|
115
|
+
value : {
|
|
116
|
+
updateSystemTray,
|
|
117
|
+
startRecording,
|
|
118
|
+
}
|
|
119
|
+
,override:false,writable:false
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const nodemailer = require("nodemailer");
|
|
2
|
+
let Email = {}
|
|
3
|
+
let getEmailSettings = x => defaultObj(APP.getRemoteInfos().get("smtp"));
|
|
4
|
+
let isAvailable = ()=>{
|
|
5
|
+
if(!window.APP || typeof window.APP == "undefined") return false;
|
|
6
|
+
let infos = getEmailSettings();
|
|
7
|
+
let isR = infos.host && infos.port && infos.password && isNonNullString(infos.user)? true : false;
|
|
8
|
+
if(!isR){
|
|
9
|
+
APP.getRemoteInfos().check();
|
|
10
|
+
}
|
|
11
|
+
return isR;
|
|
12
|
+
}
|
|
13
|
+
let notAllowedMsg = 'Impossible d\'envoyer un mail car cette fonction n\'est pas disponible pour cette installation du logiciel';
|
|
14
|
+
Object.defineProperties(Email,{
|
|
15
|
+
send : {
|
|
16
|
+
value : (opts)=>{
|
|
17
|
+
if(!isAvailable()) return Promise.reject({msg:notAllowedMsg})
|
|
18
|
+
let emailSettings =getEmailSettings();
|
|
19
|
+
opts = defaultObj(opts);
|
|
20
|
+
opts.auth = {
|
|
21
|
+
user: emailSettings.user, // generated ethereal user
|
|
22
|
+
pass: defaultStr(emailSettings.pass,emailSettings.password), // generated ethereal password
|
|
23
|
+
}
|
|
24
|
+
if(!opts.from || !isValidEmail(opts.from)){
|
|
25
|
+
opts.from = defaultStr(emailSettings.email,APP.getDevMail());
|
|
26
|
+
}
|
|
27
|
+
if(Array.isArray(opts.to)){
|
|
28
|
+
opts.to = opts.to.join(",");
|
|
29
|
+
}
|
|
30
|
+
let transporter = nodemailer.createTransport({
|
|
31
|
+
...emailSettings,
|
|
32
|
+
auth: {
|
|
33
|
+
user: emailSettings.user, // generated ethereal user
|
|
34
|
+
pass: defaultStr(emailSettings.pass,emailSettings.password), // generated ethereal password
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
showPreloader(defaultStr(opts.preloader,"envoie de l'email en cours..."))
|
|
38
|
+
return new Promise((resolve,reject)=>{
|
|
39
|
+
transporter.sendMail(opts, function(err, reply) {
|
|
40
|
+
hidePreloader();
|
|
41
|
+
if(err){
|
|
42
|
+
console.log(err," error sending email")
|
|
43
|
+
//APP.require("$notify").error(err);
|
|
44
|
+
reject(err);
|
|
45
|
+
} else resolve(reply);
|
|
46
|
+
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
nodemailer : {value : nodemailer},
|
|
52
|
+
isAvailable : {value : isAvailable},
|
|
53
|
+
notAllowedMsg : {value : notAllowedMsg}
|
|
54
|
+
})
|
|
55
|
+
module.exports = Email;
|