@osimatic/helpers-js 1.5.2 → 1.5.3
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/count_down.js +46 -48
- package/date_time.js +0 -1
- package/details_sub_array.js +22 -11
- package/flash_message.js +10 -6
- package/form_date.js +144 -153
- package/import_from_csv.js +34 -5
- package/multi_files_input.js +2 -1
- package/multiple_action_in_table.js +11 -7
- package/package.json +1 -1
- package/tests/count_down.test.js +131 -352
- package/tests/details_sub_array.test.js +11 -28
- package/tests/flash_message.test.js +21 -153
- package/tests/form_date.test.js +287 -961
- package/tests/import_from_csv.test.js +53 -11
- package/tests/multi_files_input.test.js +14 -16
- package/tests/multiple_action_in_table.test.js +0 -9
- package/tests/open_street_map.test.js +15 -23
|
@@ -4,7 +4,7 @@ class MultipleActionInTable {
|
|
|
4
4
|
// Ajoute les colonnes select (thead th + tbody td) dans le DOM.
|
|
5
5
|
// Idempotent : sans effet si les colonnes existent déjà.
|
|
6
6
|
// Doit être appelé AVANT l'initialisation DataTable.
|
|
7
|
-
static initCols(table,
|
|
7
|
+
static initCols(table, cellSelector = 'select') {
|
|
8
8
|
if (!table.hasClass('table-action_multiple')) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
@@ -13,7 +13,7 @@ class MultipleActionInTable {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
if (table.find('thead tr th[data-key="select"]').length === 0) {
|
|
16
|
-
table.find('thead tr').prepend($('<th class="' +
|
|
16
|
+
table.find('thead tr').prepend($('<th class="' + cellSelector + '" data-key="select"></th>'));
|
|
17
17
|
}
|
|
18
18
|
table.find('tbody tr:not(.no_items)').each(function(idx, tr) {
|
|
19
19
|
if ($(tr).find('td.select').length === 0) {
|
|
@@ -24,7 +24,9 @@ class MultipleActionInTable {
|
|
|
24
24
|
|
|
25
25
|
// Initialise les colonnes (via initCols) puis branche les event handlers.
|
|
26
26
|
// Peut être appelé après l'initialisation DataTable.
|
|
27
|
-
static init(table,
|
|
27
|
+
static init(table, options = {}) {
|
|
28
|
+
const { cellSelector = 'select', imgArrow = '' } = options;
|
|
29
|
+
|
|
28
30
|
if (!table.hasClass('table-action_multiple')) {
|
|
29
31
|
return;
|
|
30
32
|
}
|
|
@@ -34,10 +36,10 @@ class MultipleActionInTable {
|
|
|
34
36
|
return;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
MultipleActionInTable.initCols(table,
|
|
39
|
+
MultipleActionInTable.initCols(table, cellSelector);
|
|
38
40
|
|
|
39
41
|
if (!divBtn.hasClass('action_multiple_buttons_initialized')) {
|
|
40
|
-
divBtn.prepend($('<img src="'+
|
|
42
|
+
divBtn.prepend($('<img src="'+imgArrow+'" alt="" /> '));
|
|
41
43
|
divBtn.append($('<br/><br/>'));
|
|
42
44
|
divBtn.addClass('action_multiple_buttons_initialized');
|
|
43
45
|
}
|
|
@@ -132,7 +134,9 @@ class MultipleActionInTable {
|
|
|
132
134
|
|
|
133
135
|
class MultipleActionInDivList {
|
|
134
136
|
// init checkbox
|
|
135
|
-
static init(contentDiv) {
|
|
137
|
+
static init(contentDiv, options = {}) {
|
|
138
|
+
const { imgArrow = '' } = options;
|
|
139
|
+
|
|
136
140
|
let buttonsDiv = MultipleActionInDivList.getButtonsDiv(contentDiv);
|
|
137
141
|
if (buttonsDiv == null) {
|
|
138
142
|
return;
|
|
@@ -146,7 +150,7 @@ class MultipleActionInDivList {
|
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
if (!buttonsDiv.data('action_multiple_buttons_initialized')) {
|
|
149
|
-
buttonsDiv.prepend($('<img src="'+
|
|
153
|
+
buttonsDiv.prepend($('<img src="'+imgArrow+'" alt="" /> '));
|
|
150
154
|
buttonsDiv.append($('<br/><br/>'));
|
|
151
155
|
buttonsDiv.data('action_multiple_buttons_initialized', 1);
|
|
152
156
|
}
|