@osimatic/helpers-js 1.0.3 → 1.0.6

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/array.js CHANGED
@@ -81,4 +81,6 @@ function renameKeysByCallback(obj, callback) {
81
81
  }),
82
82
  {}
83
83
  );
84
- }
84
+ }
85
+
86
+ module.exports = { getValuesByKeyInArrayOfArrays, renameKeys, renameKeysByCallback };
package/index.js CHANGED
@@ -1,26 +1,35 @@
1
- const { HTTPRequest, Cookie, UrlAndQueryString } = require('./network.js');
2
- const { IBAN } = require('./bank.js');
3
- const { AudioMedia } = require('./media.js');
4
- const { PersonName, Email, TelephoneNumber } = require('./contact_details.js');
5
- const { CountDown } = require('./count_down.js');
6
- const { DataTable } = require('./data_table.js');
7
- const { DateTime, TimestampUnix, SqlDate, SqlTime, SqlDateTime, InputPeriod } = require('./date_time.js');
8
- const { DetailsSubArray } = require('./details_sub_array.js');
9
- const { Duration } = require('./duration.js');
10
- const { File, CSV, Img } = require('./file.js');
11
- const { FlashMessage } = require('./flash_message.js');
12
- const { FormHelper } = require('./form_helper.js');
13
- const { GoogleMap } = require('./google_maps.js');
14
- const { ImportFromCsv } = require('./import_from_csv.js');
15
- const { JwtToken, JwtSession } = require('./jwt.js');
16
- const { ListBox } = require('./list_box.js');
17
- const { COUNTRIES_LIST, Country, PostalAddress, Location } = require('./location.js');
18
- const { SocialNetwork } = require('./social_network.js');
1
+ //A noter : les réécritures de prototypes définies dans certains fichiers n'ont pas besoin d'être exportés depuis le module en question (exemple Array / Object dans array.js).
2
+ //Il faut uniquement appeler require() (sans récupérer le retour) et ajouter la/les classe(s) concernée(s) dans l'export ci-dessous (l'appel de require() applique l'extension).
3
+
4
+ const { HTTPRequest, Cookie, UrlAndQueryString } = require('./network');
5
+ const { IBAN } = require('./bank');
6
+ const { AudioMedia } = require('./media');
7
+ const { PersonName, Email, TelephoneNumber } = require('./contact_details');
8
+ const { CountDown } = require('./count_down');
9
+ const { DataTable } = require('./data_table');
10
+ const { DateTime, TimestampUnix, SqlDate, SqlTime, SqlDateTime, InputPeriod } = require('./date_time');
11
+ const { DetailsSubArray } = require('./details_sub_array');
12
+ const { Duration } = require('./duration');
13
+ const { File, CSV, Img } = require('./file');
14
+ const { FlashMessage } = require('./flash_message');
15
+ const { FormHelper } = require('./form_helper');
16
+ const { GoogleMap } = require('./google_maps');
17
+ const { ImportFromCsv } = require('./import_from_csv');
18
+ const { JwtToken, JwtSession } = require('./jwt');
19
+ const { ListBox } = require('./list_box');
20
+ const { COUNTRIES_LIST, Country, PostalAddress, Location } = require('./location');
21
+ const { SocialNetwork } = require('./social_network');
22
+ const { getValuesByKeyInArrayOfArrays, renameKeys, renameKeysByCallback } = require('./array');
23
+ const { NumberValue } = require('./number');
24
+ const { selectionnerContenuNode, copierTexte } = require('./string');
25
+ const { addBookmark, sleep, refresh } = require('./util');
26
+ const { chr, ord, trim, empty } = require('./php.min');
27
+ const { Pagination, activateTab } = require('./paging');
19
28
 
20
29
  module.exports = {
21
30
  HTTPRequest, Cookie, UrlAndQueryString, IBAN, AudioMedia, PersonName, Email, TelephoneNumber, CountDown, DataTable,
22
31
  DateTime, TimestampUnix, SqlDate, SqlTime, SqlDateTime, InputPeriod, DetailsSubArray, Duration, File, CSV, Img,
23
- FlashMessage, FormHelper, GoogleMap, ImportFromCsv, JwtToken, JwtSession, ListBox, Country, PostalAddress, Location,
24
- SocialNetwork,
25
- COUNTRIES_LIST
32
+ FlashMessage, FormHelper, GoogleMap, ImportFromCsv, JwtToken, JwtSession, ListBox, COUNTRIES_LIST, Country, PostalAddress,
33
+ Location, SocialNetwork, Array, Object, getValuesByKeyInArrayOfArrays, renameKeys, renameKeysByCallback, Number, NumberValue,
34
+ String, selectionnerContenuNode, copierTexte, addBookmark, sleep, refresh, chr, ord, trim, empty, Pagination, activateTab
26
35
  };
package/network.js CHANGED
@@ -1,13 +1,5 @@
1
1
 
2
2
  class HTTPRequest {
3
- static getHttpHeaders() {
4
- if (!JwtSession.isAnonymous()) { //on ne définit pas ce header si on ne trouve pas d'access_token
5
- httpHeaders['Authorization'] = 'Bearer ' + JwtSession.getToken();
6
- }
7
-
8
- return httpHeaders;
9
- }
10
-
11
3
  static async get(url, data, successCallback, errorCallback) {
12
4
  if (data == null) {
13
5
  data = '';
@@ -56,7 +48,7 @@ class HTTPRequest {
56
48
  $.ajax({
57
49
  type: 'GET',
58
50
  url: url + (!url.includes('?') ? '?' : '') + data,
59
- headers: HTTPRequest.getHttpHeaders(),
51
+ headers: httpHeaders,
60
52
  dataType: 'json',
61
53
  cache: false,
62
54
  success: (data) => successCallback(data),
@@ -124,7 +116,7 @@ class HTTPRequest {
124
116
  $.ajax({
125
117
  type: 'GET',
126
118
  url: url + (!url.includes('?') ? '?' : '') + data,
127
- headers: HTTPRequest.getHttpHeaders(),
119
+ headers: httpHeaders,
128
120
  cache: false,
129
121
  xhrFields: {
130
122
  responseType: 'blob'
@@ -191,7 +183,7 @@ class HTTPRequest {
191
183
  $.ajax({
192
184
  type: 'POST',
193
185
  url: url,
194
- headers: HTTPRequest.getHttpHeaders(),
186
+ headers: httpHeaders,
195
187
  dataType: 'json', // 22/09/2020 : à voir si cette ligne pose pb (utilisé pour requete import et peut être d'autres
196
188
  data: formData,
197
189
  cache: false,
@@ -548,5 +540,3 @@ class UrlAndQueryString {
548
540
  }
549
541
 
550
542
  }
551
-
552
- module.exports = { HTTPRequest, Cookie, UrlAndQueryString };
package/number.js CHANGED
@@ -88,3 +88,5 @@ Number.prototype.formatAsPercent = function(locale, minimumFractionDigits) {
88
88
  minimumFractionDigits = (typeof minimumFractionDigits != 'undefined'?minimumFractionDigits:0);
89
89
  return new Intl.NumberFormat(locale, {style: 'percent', minimumFractionDigits:minimumFractionDigits}).format(this);
90
90
  };
91
+
92
+ module.exports = { NumberValue };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osimatic/helpers-js",
3
- "version": "1.0.3",
3
+ "version": "1.0.6",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/paging.js CHANGED
@@ -118,6 +118,8 @@ function activateTab(a) {
118
118
  tabContent.find(a.attr('href')).addClass('active').addClass('show');
119
119
  }
120
120
 
121
+ module.exports = { Pagination, activateTab };
122
+
121
123
  // deprecated
122
124
  function paginationAsList(nbResultatsTotal, nbResultatsParPage, urlPage, nomParamPage) {
123
125
  var currentUrl = urlPage || window.location.href;
package/php.min.js CHANGED
@@ -1,4 +1,6 @@
1
1
  function chr(codePt){if(codePt>65535){codePt-=65536;return String.fromCharCode(55296+(codePt>>10),56320+(codePt&1023))}return String.fromCharCode(codePt)}
2
2
  function ord(string){var str=string+"",code=str.charCodeAt(0);if(55296<=code&&code<=56319){var hi=code;if(str.length===1){return code}var low=str.charCodeAt(1);return((hi-55296)*1024)+(low-56320)+65536}if(56320<=code&&code<=57343){return code}return code}
3
3
  function trim(str){return str.replace(/^\s+/g,"").replace(/\s+$/g,"")}
4
- function empty(mixed_var){var key;if(mixed_var===""||mixed_var===0||mixed_var==="0"||mixed_var===null||mixed_var===false||typeof mixed_var==="undefined"){return true}if(typeof mixed_var=="object"){for(key in mixed_var){return false}return true}return false}
4
+ function empty(mixed_var){var key;if(mixed_var===""||mixed_var===0||mixed_var==="0"||mixed_var===null||mixed_var===false||typeof mixed_var==="undefined"){return true}if(typeof mixed_var=="object"){for(key in mixed_var){return false}return true}return false}
5
+
6
+ module.exports = { chr, ord, trim, empty };
package/string.js CHANGED
@@ -116,3 +116,5 @@ if (!String.format) {
116
116
  return format.replace(/{(\d+)}/g, (match, number) => (typeof args[number] != 'undefined' ? args[number] : match));
117
117
  };
118
118
  }
119
+
120
+ module.exports = { selectionnerContenuNode, copierTexte };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/util.js CHANGED
@@ -20,4 +20,6 @@ function refresh() {
20
20
  // console.log('Refresh page');
21
21
  // history.go(0);
22
22
  window.location.reload(true);
23
- }
23
+ }
24
+
25
+ module.exports = { addBookmark, sleep, refresh };