@osimatic/helpers-js 1.1.22 → 1.1.24
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 +10 -4
- package/package.json +1 -1
- package/select_all.js +21 -17
package/form_helper.js
CHANGED
|
@@ -101,20 +101,26 @@ class FormHelper {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
static setOnInputChange(input, callback, doneTypingInterval) {
|
|
104
|
-
//setup before functions
|
|
105
|
-
let typingTimer;
|
|
104
|
+
// setup before functions
|
|
105
|
+
let typingTimer; // timer identifier
|
|
106
106
|
doneTypingInterval = typeof doneTypingInterval != 'undefined' && null !== doneTypingInterval ? doneTypingInterval : 700; // time in ms
|
|
107
107
|
|
|
108
|
-
//on keyup, start the countdown
|
|
108
|
+
// on keyup, start the countdown
|
|
109
109
|
input.on('keyup', function () {
|
|
110
110
|
clearTimeout(typingTimer);
|
|
111
111
|
typingTimer = setTimeout(callback, doneTypingInterval);
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
-
//on keydown, clear the countdown
|
|
114
|
+
// on keydown, clear the countdown
|
|
115
115
|
input.on('keydown', function () {
|
|
116
116
|
clearTimeout(typingTimer);
|
|
117
117
|
});
|
|
118
|
+
|
|
119
|
+
// on focusout, clear the countdown and call callback
|
|
120
|
+
input.on('focusout', function () {
|
|
121
|
+
clearTimeout(typingTimer);
|
|
122
|
+
callback();
|
|
123
|
+
});
|
|
118
124
|
}
|
|
119
125
|
|
|
120
126
|
// ------------------------------------------------------------
|
package/package.json
CHANGED
package/select_all.js
CHANGED
|
@@ -77,25 +77,29 @@ class SelectAll {
|
|
|
77
77
|
|
|
78
78
|
// Dans un div
|
|
79
79
|
|
|
80
|
-
static initDiv(
|
|
81
|
-
|
|
82
|
-
let
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
allCheckbox.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
80
|
+
static initDiv(contentDiv) {
|
|
81
|
+
contentDiv.find('input.check_all').each(function(idx, inputCheckAll) {
|
|
82
|
+
let div = $(inputCheckAll).closest('div.checkbox_with_check_all');
|
|
83
|
+
|
|
84
|
+
$(inputCheckAll).off('click').click(function() {
|
|
85
|
+
let div = $(this).closest('div.checkbox_with_check_all');
|
|
86
|
+
let allCheckbox = div.find('input[type="checkbox"]:not(.check_all)');
|
|
87
|
+
let allCheckboxChecked = div.find('input[type="checkbox"]:not(.check_all):checked');
|
|
88
|
+
if (allCheckbox.length === allCheckboxChecked.length) {
|
|
89
|
+
allCheckbox.prop('checked', false);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
allCheckbox.prop('checked', true);
|
|
93
|
+
}
|
|
94
|
+
SelectAll.updateDiv(div);
|
|
95
|
+
//SelectAll.updateFormGroup(rootDiv.closest('.form-group'));
|
|
96
|
+
});
|
|
94
97
|
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
div.find('div.checkbox, div.form-check').find('input[type="checkbox"]').change(function() {
|
|
99
|
+
SelectAll.updateDiv($(this).closest('div.checkbox_with_check_all'));
|
|
100
|
+
});
|
|
101
|
+
SelectAll.updateDiv(div);
|
|
97
102
|
});
|
|
98
|
-
SelectAll.updateDiv(div);
|
|
99
103
|
}
|
|
100
104
|
|
|
101
105
|
static updateDiv(div) {
|