@osimatic/helpers-js 1.0.73 → 1.0.76
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/form_helper.js +13 -6
- package/import_from_csv.js +5 -5
- package/media.js +7 -8
- package/package.json +1 -1
package/form_helper.js
CHANGED
|
@@ -22,6 +22,12 @@ class FormHelper {
|
|
|
22
22
|
return form.find('select[name="'+selectName+'"] option:not([disabled])').length;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
static reset(form) {
|
|
26
|
+
form.find('[name]').each((idx, el) => $(el).val(''));
|
|
27
|
+
FormHelper.hideFormErrors(form);
|
|
28
|
+
return form;
|
|
29
|
+
}
|
|
30
|
+
|
|
25
31
|
static getFormData(form) {
|
|
26
32
|
// var formElement = document.getElementById("myFormElement");
|
|
27
33
|
return new FormData(form[0]);
|
|
@@ -200,11 +206,12 @@ class FormHelper {
|
|
|
200
206
|
static displayFormErrors(form, btnSubmit, errors, errorWrapperDiv) {
|
|
201
207
|
this.displayFormErrorsFromText(form, this.getFormErrorText(errors), errorWrapperDiv);
|
|
202
208
|
if (btnSubmit != null) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
209
|
+
FormHelper.buttonLoader(btnSubmit, 'reset');
|
|
210
|
+
//if (btnSubmit.buttonLoader != null) {
|
|
211
|
+
// btnSubmit.buttonLoader('reset');
|
|
212
|
+
//} else {
|
|
213
|
+
// btnSubmit.attr('disabled', false).button('reset');
|
|
214
|
+
//}
|
|
208
215
|
}
|
|
209
216
|
}
|
|
210
217
|
|
|
@@ -311,7 +318,7 @@ class EditValue {
|
|
|
311
318
|
|
|
312
319
|
let button = $('<button type="submit" class="btn btn-success ms-2" data-loading-text="<i class=\'fa fa-circle-notch fa-spin\'></i>" style="vertical-align: baseline;"><i class="fas fa-check"></i></button>');
|
|
313
320
|
button.click(function (e) {
|
|
314
|
-
parent.find('button')
|
|
321
|
+
FormHelper.buttonLoader(parent.find('button'), 'loading');
|
|
315
322
|
let newValue = parent.find('input').val();
|
|
316
323
|
onSubmitCallback(newValue, parent,
|
|
317
324
|
(isSuccess, valueFormatCallback) => {
|
package/import_from_csv.js
CHANGED
|
@@ -24,7 +24,7 @@ class ImportFromCsv {
|
|
|
24
24
|
|
|
25
25
|
formUpload.find('button[type="submit"]').click(function(event) {
|
|
26
26
|
event.preventDefault();
|
|
27
|
-
$(this)
|
|
27
|
+
FormHelper.buttonLoader($(this), 'loading');
|
|
28
28
|
formUpload.find('div.errors').addClass('hide');
|
|
29
29
|
|
|
30
30
|
let isFileParsed = false;
|
|
@@ -69,7 +69,7 @@ class ImportFromCsv {
|
|
|
69
69
|
if (!isFileParsed) {
|
|
70
70
|
formUpload.find('div.errors').html(errorMessageFileEmpty).removeClass('hide');
|
|
71
71
|
}
|
|
72
|
-
formUpload.find('button[type="submit"]')
|
|
72
|
+
FormHelper.buttonLoader(formUpload.find('button[type="submit"]'), 'reset');
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
75
|
event.preventDefault();
|
|
@@ -77,7 +77,7 @@ class ImportFromCsv {
|
|
|
77
77
|
|
|
78
78
|
formMatching.find('button[type="submit"]').click(function (event) {
|
|
79
79
|
event.preventDefault();
|
|
80
|
-
$(this)
|
|
80
|
+
FormHelper.buttonLoader($(this), 'loading');
|
|
81
81
|
formMatching.find('div.errors').addClass('hide').empty();
|
|
82
82
|
divResult.find('table tr').removeClass('danger');
|
|
83
83
|
|
|
@@ -86,7 +86,7 @@ class ImportFromCsv {
|
|
|
86
86
|
|
|
87
87
|
if ($.isEmptyObject(tabLink)) {
|
|
88
88
|
formMatching.find('div.errors').html(errorMessageImportSelectColumns).removeClass('hide');
|
|
89
|
-
$(this)
|
|
89
|
+
FormHelper.buttonLoader($(this), 'reset');
|
|
90
90
|
return false;
|
|
91
91
|
}
|
|
92
92
|
|
|
@@ -103,7 +103,7 @@ class ImportFromCsv {
|
|
|
103
103
|
else {
|
|
104
104
|
formMatching.find('div.errors').html(ImportFromCsv.getErrorsHtmlOfImportData(json, divResult)).removeClass('hide');
|
|
105
105
|
}
|
|
106
|
-
formMatching.find('button[type="submit"]')
|
|
106
|
+
FormHelper.buttonLoader(formMatching.find('button[type="submit"]'), 'reset');
|
|
107
107
|
}
|
|
108
108
|
);
|
|
109
109
|
});
|
package/media.js
CHANGED
|
@@ -15,14 +15,13 @@ class AudioMedia {
|
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
div.find('.play_asynchronously_link').off('click').click(function () {
|
|
18
|
-
if ($(this)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} else {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
18
|
+
//if (FormHelper.buttonLoader($(this), 'loading') != null) {
|
|
19
|
+
let button = FormHelper.buttonLoader($(this), 'loading');
|
|
20
|
+
AudioMedia.playAudioUrl($(this).data('url'), () => FormHelper.buttonLoader(button, 'reset'));
|
|
21
|
+
//} else {
|
|
22
|
+
// let button = $(this).attr('disabled', true).button('loading');
|
|
23
|
+
// AudioMedia.playAudioUrl($(this).data('url'), () => button.attr('disabled', false).button('reset'));
|
|
24
|
+
//}
|
|
26
25
|
return false;
|
|
27
26
|
});
|
|
28
27
|
|