@osimatic/helpers-js 1.5.38 → 1.5.40

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.
@@ -14,11 +14,11 @@ class MultipleActionInTable {
14
14
  return;
15
15
  }
16
16
 
17
- const theadTr = table.querySelector('thead tr');
17
+ const theadTr = table.querySelector(':scope > thead > tr');
18
18
  if (theadTr && !theadTr.querySelector('th[data-key="select"]')) {
19
19
  theadTr.insertAdjacentHTML('afterbegin', '<th class="' + cellSelector + '" data-key="select"></th>');
20
20
  }
21
- table.querySelectorAll('tbody tr:not(.no_items)').forEach(tr => {
21
+ table.querySelectorAll(':scope > tbody > tr:not(.no_items)').forEach(tr => {
22
22
  if (!tr.querySelector('td.select')) {
23
23
  tr.insertAdjacentHTML('afterbegin', '<td class="select"><input type="checkbox" class="action_multiple_checkbox" name="' + tr.dataset.action_multiple_input_name + '" value="' + tr.dataset.action_multiple_item_id + '"></td>');
24
24
  }
@@ -102,6 +102,7 @@ class MultipleActionInTable {
102
102
  }
103
103
 
104
104
  static getDivBtn(table) {
105
+ const isJquery = typeof jQuery !== 'undefined' && table instanceof jQuery;
105
106
  table = toEl(table);
106
107
  if (!table) {
107
108
  return null;
@@ -109,11 +110,11 @@ class MultipleActionInTable {
109
110
  const divTableResponsive = table.parentElement;
110
111
  let divBtn = divTableResponsive.nextElementSibling;
111
112
  if (divBtn && divBtn.classList.contains('action_multiple_buttons')) {
112
- return divBtn;
113
+ return isJquery ? jQuery(divBtn) : divBtn;
113
114
  }
114
115
  divBtn = divTableResponsive.parentElement?.parentElement?.parentElement?.nextElementSibling;
115
116
  if (divBtn && divBtn.classList.contains('action_multiple_buttons')) {
116
- return divBtn;
117
+ return isJquery ? jQuery(divBtn) : divBtn;
117
118
  }
118
119
  return null;
119
120
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osimatic/helpers-js",
3
- "version": "1.5.38",
3
+ "version": "1.5.40",
4
4
  "main": "main.js",
5
5
  "scripts": {
6
6
  "test": "jest",