@osimatic/helpers-js 1.0.90 → 1.0.92
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/google_charts.js +16 -15
- package/http_client.js +2 -2
- package/index.js +1 -1
- package/package.json +1 -1
- package/visitor.js +56 -1
package/google_charts.js
CHANGED
|
@@ -13,7 +13,7 @@ class GoogleCharts {
|
|
|
13
13
|
// on supprime du tableau la liste des graphiques dont l'id div n'a pas été trouvé (le graphique ne pourra pas être généré)
|
|
14
14
|
chartsList = chartsList.filter(chartData => typeof chartData.div_id != 'undefined' && $('#'+chartData.div_id).length);
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
let nbChartsCompleted = 0;
|
|
17
17
|
chartsList.forEach(chartData => {
|
|
18
18
|
//console.log(chartData);
|
|
19
19
|
GoogleCharts.draw(
|
|
@@ -41,17 +41,18 @@ class GoogleCharts {
|
|
|
41
41
|
|
|
42
42
|
static draw(div, typeGraph, titre, libelleAbs, tabDataAbsParam, listeLibelleOrd, listeTabDataOrd, tabColor, formatData, height, width, onComplete) {
|
|
43
43
|
if (typeof div == 'undefined' || !div.length) {
|
|
44
|
+
console.error('div not found');
|
|
44
45
|
return;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
height = height || null;
|
|
48
49
|
width = width || null;
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
let htmlDomDiv = div[0];
|
|
51
52
|
|
|
52
|
-
|
|
53
|
+
let afficherLibelleOrd = false;
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
let isStacked = false;
|
|
55
56
|
if (typeGraph === 'stacked_bar_chart') {
|
|
56
57
|
typeGraph = 'bar_chart';
|
|
57
58
|
isStacked = true;
|
|
@@ -65,7 +66,7 @@ class GoogleCharts {
|
|
|
65
66
|
isStacked = true;
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
|
|
69
|
+
let isDualChart = false;
|
|
69
70
|
if (typeGraph === 'dual_column_chart') {
|
|
70
71
|
typeGraph = 'column_chart';
|
|
71
72
|
isDualChart = true;
|
|
@@ -75,7 +76,7 @@ class GoogleCharts {
|
|
|
75
76
|
isDualChart = true;
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
|
|
79
|
+
let data = null;
|
|
79
80
|
if (typeGraph === 'pie_chart') {
|
|
80
81
|
//data = google.visualization.arrayToDataTable(tabDataAbsParam);
|
|
81
82
|
|
|
@@ -83,7 +84,7 @@ class GoogleCharts {
|
|
|
83
84
|
data.addColumn('string', libelleAbs);
|
|
84
85
|
data.addColumn('number', '');
|
|
85
86
|
|
|
86
|
-
|
|
87
|
+
let numRow = 0;
|
|
87
88
|
$.each(tabDataAbsParam, function(idx, value) {
|
|
88
89
|
data.addRows(1);
|
|
89
90
|
data.setCell(numRow, 0, idx);
|
|
@@ -100,8 +101,8 @@ class GoogleCharts {
|
|
|
100
101
|
});
|
|
101
102
|
|
|
102
103
|
// Remplissage des données
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
let nbCells = 0;
|
|
105
|
+
let numRow = 0;
|
|
105
106
|
$.each(tabDataAbsParam, function(idx, dataAbs) {
|
|
106
107
|
// dataOrd = tabDataOrd[idx];
|
|
107
108
|
// data.addRow([dataAbs, dataOrd]);
|
|
@@ -109,7 +110,7 @@ class GoogleCharts {
|
|
|
109
110
|
|
|
110
111
|
data.setCell(numRow, 0, dataAbs);
|
|
111
112
|
|
|
112
|
-
|
|
113
|
+
let numCell = 1;
|
|
113
114
|
$.each(listeTabDataOrd, function(idx2, tabDataOrd) {
|
|
114
115
|
data.setCell(numRow, numCell, tabDataOrd[idx]);
|
|
115
116
|
//data.setCell(numRow, numCell, Math.round(tabDataOrd[idx], 2));
|
|
@@ -126,7 +127,7 @@ class GoogleCharts {
|
|
|
126
127
|
// console.log('drawGraph : '+div+' ; type : '+typeGraph);
|
|
127
128
|
|
|
128
129
|
// Options générales
|
|
129
|
-
|
|
130
|
+
let options = {
|
|
130
131
|
colors: tabColor,
|
|
131
132
|
fontName: 'Trebuchet MS',
|
|
132
133
|
fontSize: 12,
|
|
@@ -221,7 +222,7 @@ class GoogleCharts {
|
|
|
221
222
|
// console.log(idx);
|
|
222
223
|
if (idx <= 1) {
|
|
223
224
|
// key = 'series_'+idx;
|
|
224
|
-
|
|
225
|
+
let key = idx;
|
|
225
226
|
// options.series[idx] = {axis: key, targetAxisIndex: key};
|
|
226
227
|
options.series[idx] = {axis: key, targetAxisIndex: idx};
|
|
227
228
|
if (typeGraph === 'column_chart') {
|
|
@@ -278,7 +279,7 @@ class GoogleCharts {
|
|
|
278
279
|
// console.log(options);
|
|
279
280
|
|
|
280
281
|
// Création du graphique
|
|
281
|
-
|
|
282
|
+
let chart = null;
|
|
282
283
|
if (typeGraph === 'column_chart') {
|
|
283
284
|
// chart = new google.visualization.ColumnChart(htmlDomDiv);
|
|
284
285
|
chart = new google.charts.Bar(htmlDomDiv);
|
|
@@ -301,7 +302,7 @@ class GoogleCharts {
|
|
|
301
302
|
div.removeClass('loading');
|
|
302
303
|
|
|
303
304
|
if (chart === null) {
|
|
304
|
-
console.
|
|
305
|
+
console.error('error during creating chart');
|
|
305
306
|
div.addClass('graphique_error');
|
|
306
307
|
htmlDomDiv.innerHTML = 'Une erreur s\'est produite lors du chargement du graphique.';
|
|
307
308
|
return;
|
|
@@ -317,7 +318,7 @@ class GoogleCharts {
|
|
|
317
318
|
tabPaneDiv = div.closest('.tab-pane');
|
|
318
319
|
}
|
|
319
320
|
|
|
320
|
-
|
|
321
|
+
let hasClassActive = tabPaneDiv.hasClass('active');
|
|
321
322
|
if (!hasClassActive) {
|
|
322
323
|
tabPaneDiv.addClass('active');
|
|
323
324
|
}
|
package/http_client.js
CHANGED
|
@@ -271,7 +271,7 @@ class HTTPClient {
|
|
|
271
271
|
HTTPClient.refreshTokenStarted = true;
|
|
272
272
|
|
|
273
273
|
if (typeof HTTPClient.refreshTokenCallback == 'function') {
|
|
274
|
-
console.
|
|
274
|
+
console.log('HTTPClient.refreshToken : Appel callback HTTPClient.refreshTokenCallback');
|
|
275
275
|
HTTPClient.refreshTokenCallback(onRefreshTokenComplete);
|
|
276
276
|
return;
|
|
277
277
|
}
|
|
@@ -281,7 +281,7 @@ class HTTPClient {
|
|
|
281
281
|
return;
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
console.
|
|
284
|
+
console.log('HTTPClient.refreshToken : Appel HTTP vers HTTPClient.refreshTokenUrl');
|
|
285
285
|
let payload = new FormData();
|
|
286
286
|
payload.append('refresh_token', JwtSession.getRefreshToken());
|
|
287
287
|
|
package/index.js
CHANGED
|
@@ -23,7 +23,7 @@ const { sleep, refresh } = require('./util');
|
|
|
23
23
|
const { chr, ord, trim, empty } = require('./php.min');
|
|
24
24
|
|
|
25
25
|
// exports plugins "maison"
|
|
26
|
-
const { Browser } = require('./visitor');
|
|
26
|
+
const { Browser, UserAgent } = require('./visitor');
|
|
27
27
|
const { DataTable } = require('./data_table');
|
|
28
28
|
const { Pagination, Navigation } = require('./paging');
|
|
29
29
|
const { DetailsSubArray } = require('./details_sub_array');
|
package/package.json
CHANGED
package/visitor.js
CHANGED
|
@@ -19,4 +19,59 @@ class Browser {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
class UserAgent {
|
|
23
|
+
static getOsDisplay(osName) {
|
|
24
|
+
let str = '';
|
|
25
|
+
if (osName === 'Windows') {
|
|
26
|
+
str += '<i class="fab fa-windows"></i>';
|
|
27
|
+
}
|
|
28
|
+
if (osName === 'Linux') {
|
|
29
|
+
str += '<i class="fab fa-linux"></i>';
|
|
30
|
+
}
|
|
31
|
+
if (osName === 'macOS' || osName === 'iOS') {
|
|
32
|
+
str += '<i class="fab fa-apple"></i>';
|
|
33
|
+
}
|
|
34
|
+
if (osName === 'Android') {
|
|
35
|
+
str += '<i class="fab fa-android"></i>';
|
|
36
|
+
}
|
|
37
|
+
str += ' '+osName;
|
|
38
|
+
return str.trim();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static getBrowserDisplay(browserName) {
|
|
42
|
+
let str = '';
|
|
43
|
+
if (browserName === 'Chrome') {
|
|
44
|
+
str += '<i class="fab fa-chrome"></i>';
|
|
45
|
+
}
|
|
46
|
+
if (browserName === 'Firefox') {
|
|
47
|
+
str += '<i class="fab fa-firefox"></i>';
|
|
48
|
+
}
|
|
49
|
+
if (browserName === 'Edge') {
|
|
50
|
+
str += '<i class="fab fa-edge"></i>';
|
|
51
|
+
}
|
|
52
|
+
if (browserName === 'Safari') {
|
|
53
|
+
str += '<i class="fab fa-safari"></i>';
|
|
54
|
+
}
|
|
55
|
+
if (browserName === 'Opera') {
|
|
56
|
+
str += '<i class="fab fa-opera"></i>';
|
|
57
|
+
}
|
|
58
|
+
str += ' '+browserName;
|
|
59
|
+
return str.trim();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static getDeviceDisplay(device) {
|
|
63
|
+
let str = '';
|
|
64
|
+
if (device['type'] === 'desktop') {
|
|
65
|
+
str += '<i class="fas fa-desktop"></i> Ordinateur';
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
if (device['is_mobile']) {
|
|
69
|
+
str += '<i class="fas fa-mobile-alt"></i> '+(null == device['manufacturer'] && null == device['model'] ? 'Mobile' : '');
|
|
70
|
+
}
|
|
71
|
+
str += device['manufacturer']+' '+device['model'];
|
|
72
|
+
}
|
|
73
|
+
return str.trim();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
module.exports = { Browser, UserAgent };
|