@osimatic/helpers-js 1.0.32 → 1.0.33
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/changelog.txt +3 -1
- package/form_helper.js +31 -0
- package/index.js +2 -4
- package/location.js +3 -3
- package/package.json +1 -1
- package/todos/button_loader.js +0 -50
package/changelog.txt
CHANGED
|
@@ -37,4 +37,6 @@ let httpHeaders = {...} -> HTTPRequest.setHeader(key, value);
|
|
|
37
37
|
remplacer l'utilisation des variables httpHeaders / _httpHeaders par HTTPRequest.getHeaders()
|
|
38
38
|
|
|
39
39
|
FlashMessage.displayRequestFailure(status, exception, modal) -> FlashMessage.displayError(labelErrorOccured, modal)
|
|
40
|
-
FormHelper.logRequestFailure(status, exception) -> HTTPRequest.logJqueryRequestFailure(jqxhr, status, exception) (le log de l'erreur est devenu inutile car fait de base dans la classe HTTPRequest)
|
|
40
|
+
FormHelper.logRequestFailure(status, exception) -> HTTPRequest.logJqueryRequestFailure(jqxhr, status, exception) (le log de l'erreur est devenu inutile car fait de base dans la classe HTTPRequest)
|
|
41
|
+
|
|
42
|
+
Location.checkCoordinates(...) -> GeographicCoordinates.check(...) (car Location est déjà défini en javascript natif)
|
package/form_helper.js
CHANGED
|
@@ -255,6 +255,37 @@ class FormHelper {
|
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
|
|
258
|
+
static buttonLoader(button, action) {
|
|
259
|
+
button = $(button);
|
|
260
|
+
if (action === 'start' || action === 'loading') {
|
|
261
|
+
if (button.attr('disabled')) {
|
|
262
|
+
return self;
|
|
263
|
+
}
|
|
264
|
+
button.attr('disabled', true);
|
|
265
|
+
button.attr('data-btn-text', button.html());
|
|
266
|
+
//let text = '<span class="spinner"><i class=\'fa fa-circle-notch fa-spin\'></i></span>Traitement en cours…';
|
|
267
|
+
let text = '<i class=\'fa fa-circle-notch fa-spin\'></i> Traitement en cours…';
|
|
268
|
+
if (button.data('load-text') != undefined && button.data('load-text') != null && button.data('load-text') != '') {
|
|
269
|
+
text = button.data('load-text');
|
|
270
|
+
}
|
|
271
|
+
if (button.data('loading-text') != undefined && button.data('loading-text') != null && button.data('loading-text') != '') {
|
|
272
|
+
text = button.data('loading-text');
|
|
273
|
+
}
|
|
274
|
+
button.html(text);
|
|
275
|
+
button.addClass('disabled');
|
|
276
|
+
}
|
|
277
|
+
if (action === 'stop' || action === 'reset') {
|
|
278
|
+
button.html(button.attr('data-btn-text'));
|
|
279
|
+
button.removeClass('disabled');
|
|
280
|
+
button.attr('disabled', false);
|
|
281
|
+
//button.removeAttr("disabled");
|
|
282
|
+
}
|
|
283
|
+
return button;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
258
289
|
|
|
259
290
|
/** @deprecated **/
|
|
260
291
|
static logRequestFailure(status, exception) {
|
package/index.js
CHANGED
|
@@ -15,7 +15,7 @@ const { DateTime, TimestampUnix, SqlDate, SqlTime, SqlDateTime } = require('./da
|
|
|
15
15
|
const { Duration } = require('./duration');
|
|
16
16
|
const { File, CSV, Img } = require('./file');
|
|
17
17
|
const { FormHelper } = require('./form_helper');
|
|
18
|
-
const { Country, PostalAddress,
|
|
18
|
+
const { Country, PostalAddress, GeographicCoordinates } = require('./location');
|
|
19
19
|
const { SocialNetwork } = require('./social_network');
|
|
20
20
|
const { sleep, refresh } = require('./util');
|
|
21
21
|
const { chr, ord, trim, empty } = require('./php.min');
|
|
@@ -40,11 +40,9 @@ const { GoogleRecaptcha } = require('./google_recaptcha');
|
|
|
40
40
|
const { GoogleMap } = require('./google_maps');
|
|
41
41
|
const { OpenStreetMap } = require('./open_street_map');
|
|
42
42
|
|
|
43
|
-
// deprecated
|
|
44
|
-
|
|
45
43
|
module.exports = {
|
|
46
44
|
Array, Object, Number, String,
|
|
47
|
-
HTTPRequest, Cookie, UrlAndQueryString, IBAN, BankCard, AudioMedia, UserMedia, PersonName, Email, TelephoneNumber, DateTime, TimestampUnix, SqlDate, SqlTime, SqlDateTime, Duration, File, CSV, Img, FormHelper, Country, PostalAddress,
|
|
45
|
+
HTTPRequest, Cookie, UrlAndQueryString, IBAN, BankCard, AudioMedia, UserMedia, PersonName, Email, TelephoneNumber, DateTime, TimestampUnix, SqlDate, SqlTime, SqlDateTime, Duration, File, CSV, Img, FormHelper, Country, PostalAddress, GeographicCoordinates, SocialNetwork,
|
|
48
46
|
DataTable, Pagination, Navigation, DetailsSubArray, SelectAll, MultipleActionInTable, FormDate, InputPeriod, ShoppingCart, FlashMessage, CountDown, ImportFromCsv, JwtToken, JwtSession, ListBox,
|
|
49
47
|
sleep, refresh, chr, ord, trim, empty,
|
|
50
48
|
GoogleCharts, GoogleRecaptcha, GoogleMap, OpenStreetMap
|
package/location.js
CHANGED
|
@@ -394,10 +394,10 @@ class PostalAddress {
|
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
|
|
397
|
-
class
|
|
398
|
-
static
|
|
397
|
+
class GeographicCoordinates {
|
|
398
|
+
static check(str) {
|
|
399
399
|
return /^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/.test(str);
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
|
|
403
|
-
module.exports = { Country, PostalAddress,
|
|
403
|
+
module.exports = { Country, PostalAddress, GeographicCoordinates };
|
package/package.json
CHANGED
package/todos/button_loader.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// Loading button plugin (removed from BS4)
|
|
3
|
-
(function($) {
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
$.fn.extend({
|
|
7
|
-
/*
|
|
8
|
-
button: function (action) {
|
|
9
|
-
console.log(action);
|
|
10
|
-
if (action === 'loading' && this.data('loading-text')) {
|
|
11
|
-
console.log('loading');
|
|
12
|
-
this.data('original-text', this.html()).html(this.data('loading-text')).prop('disabled', true);
|
|
13
|
-
}
|
|
14
|
-
if (action === 'reset' && this.data('original-text')) {
|
|
15
|
-
console.log('reset');
|
|
16
|
-
this.html(this.data('original-text')).prop('disabled', false);
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
buttonLoader: function (action) {
|
|
22
|
-
//console.log(action);
|
|
23
|
-
var self = $(this);
|
|
24
|
-
if (action === 'start' || action === 'loading') {
|
|
25
|
-
if ($(self).attr('disabled')) {
|
|
26
|
-
return self;
|
|
27
|
-
}
|
|
28
|
-
$(self).attr('disabled', true);
|
|
29
|
-
$(self).attr('data-btn-text', $(self).html());
|
|
30
|
-
//let text = '<span class="spinner"><i class=\'fa fa-circle-notch fa-spin\'></i></span>Traitement en cours…';
|
|
31
|
-
let text = '<i class=\'fa fa-circle-notch fa-spin\'></i> Traitement en cours…';
|
|
32
|
-
if ($(self).data('load-text') != undefined && $(self).data('load-text') != null && $(self).data('load-text') != '') {
|
|
33
|
-
text = $(self).data('load-text');
|
|
34
|
-
}
|
|
35
|
-
if ($(self).data('loading-text') != undefined && $(self).data('loading-text') != null && $(self).data('loading-text') != '') {
|
|
36
|
-
text = $(self).data('loading-text');
|
|
37
|
-
}
|
|
38
|
-
$(self).html(text);
|
|
39
|
-
$(self).addClass('disabled');
|
|
40
|
-
}
|
|
41
|
-
if (action === 'stop' || action === 'reset') {
|
|
42
|
-
$(self).html($(self).attr('data-btn-text'));
|
|
43
|
-
$(self).removeClass('disabled');
|
|
44
|
-
$(self).attr('disabled', false);
|
|
45
|
-
//$(self).removeAttr("disabled");
|
|
46
|
-
}
|
|
47
|
-
return self;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}(jQuery));
|