@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.
@@ -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, cellCssClass = 'select') {
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="' + cellCssClass + '" data-key="select"></th>'));
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, cellCssClass = 'select') {
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, cellCssClass);
39
+ MultipleActionInTable.initCols(table, cellSelector);
38
40
 
39
41
  if (!divBtn.hasClass('action_multiple_buttons_initialized')) {
40
- divBtn.prepend($('<img src="'+ROOT_PATH+DOSSIER_IMAGES+'arrow_ltr.png" alt="" /> &nbsp;'));
42
+ divBtn.prepend($('<img src="'+imgArrow+'" alt="" /> &nbsp;'));
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="'+ROOT_PATH+DOSSIER_IMAGES+'arrow_ltr.png" alt="" /> &nbsp;'));
153
+ buttonsDiv.prepend($('<img src="'+imgArrow+'" alt="" /> &nbsp;'));
150
154
  buttonsDiv.append($('<br/><br/>'));
151
155
  buttonsDiv.data('action_multiple_buttons_initialized', 1);
152
156
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osimatic/helpers-js",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "main": "main.js",
5
5
  "scripts": {
6
6
  "test": "jest",