json-rules-filter 1.0.16 → 1.0.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-rules-filter",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "para crear reglas avanzadas de filtrado sobre datasets JSON de forma dinámica y visual.",
5
5
  "main": "src/jquery.jsonRulesFilter.js",
6
6
  "scripts": {
@@ -156,6 +156,13 @@
156
156
  </div>
157
157
  </div>`;
158
158
  this.$contenedor.append(template);
159
+ },
160
+
161
+ // Event delegation and listeners
162
+ bindEvents: function () {
163
+ const self = this;
164
+
165
+ //Dropdown events
159
166
  const $dropdown = this.$contenedor.find('.dropdown-toggle');
160
167
 
161
168
  if (this.settings.bsVersion === 4) {
@@ -172,21 +179,20 @@
172
179
  }
173
180
  });
174
181
 
182
+ //Dropdown
175
183
  $dropdown.on('click', function (e) {
184
+ e.preventDefault();
176
185
  e.stopPropagation();
186
+ const $conatiner_dropdown = $(this).parent().find('.dropdown-rules-columns');
187
+ $(this).dropdown($conatiner_dropdown.hasClass('show') ? "hide" : "show");
177
188
  });
178
-
179
189
  }
180
- },
181
-
182
- // Event delegation and listeners
183
- bindEvents: function () {
184
- const self = this;
185
190
 
186
191
  // Add new rule row
187
192
  this.$contenedor.find(".dropdown-rules-item").on("click", function (e) {
188
193
  e.preventDefault();
189
194
  self.addRuleRow($(this).data("column-type"), $(this).data("column-data"), $(this).data("column-name"));
195
+ $dropdown.dropdown("hide");
190
196
  });
191
197
 
192
198
  // Clear all rules
@@ -258,6 +264,7 @@
258
264
 
259
265
  $select.select2({
260
266
  width: '100%',
267
+ dropdownParent: this.$contenedor, // Parent render
261
268
  escapeMarkup: function (markup) { return markup; }, // Allow HTML rendering in badges
262
269
  templateSelection: render,
263
270
  templateResult: render,