adt-js-components 1.8.0 → 1.8.2

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": "adt-js-components",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "description": "JavaScript components for Nette framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -4,12 +4,13 @@ async function run(options) {
4
4
  if ($el.is('button, input[type="button"], input[type="submit"]')) {
5
5
  $el.on('click', sendNetteAjax);
6
6
  } else if ($el.is('input:not([type="button"]):not([type="submit"]), select, textarea')) {
7
- $el.on('change', sendNetteAjax);
7
+ $el.on('input', sendNetteAjax);
8
8
  }
9
9
  }
10
10
 
11
11
  function sendNetteAjax(e) {
12
- $(document).find('[name="' + $(e.currentTarget).attr('data-adt-redraw-snippet') + '"]').netteAjax(e);
12
+ const $el = $(e.currentTarget);
13
+ $el.closest('form').find('[name="' + $el.attr('data-adt-redraw-snippet') + '"]').netteAjax(e);
13
14
  }
14
15
 
15
16
  const observer = new MutationObserver(mutations => {
@@ -2,7 +2,7 @@ async function run(options) {
2
2
  function applyEventHandlers(el) {
3
3
  $(el).formReplicator({
4
4
  template: $.parseHTML($(el).attr('data-adt-replicator')),
5
- addStaticButton: $(el).find('[data-adt-replicator-add]'),
5
+ addStaticButton: $(el).find('[data-adt-replicator-add]').not($(el).find('[data-adt-replicator] [data-adt-replicator-add]')),
6
6
  addStaticButtonShowAlways: true,
7
7
  });
8
8
  }