vgapp 0.9.4 → 0.9.5
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.
|
@@ -31,6 +31,8 @@ class VGFilesBase extends BaseModule {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
this.template = '<li data-file="" class="file"><div class="file-image"></div><div class="file-info"></div><div class="file-remove"></div></li>';
|
|
34
|
+
this._onNativeInputChange = (e) => this.change(e?.target);
|
|
35
|
+
|
|
34
36
|
this._init();
|
|
35
37
|
}
|
|
36
38
|
|
|
@@ -506,7 +508,8 @@ class VGFilesBase extends BaseModule {
|
|
|
506
508
|
|
|
507
509
|
_addEventListener() {
|
|
508
510
|
Selectors.findAll('[data-vg-toggle="files"]', this._element).forEach(el => {
|
|
509
|
-
el.
|
|
511
|
+
el.removeEventListener('change', this._onNativeInputChange);
|
|
512
|
+
el.addEventListener('change', this._onNativeInputChange);
|
|
510
513
|
});
|
|
511
514
|
}
|
|
512
515
|
|
|
@@ -182,12 +182,18 @@ class VGFiles extends VGFilesBase {
|
|
|
182
182
|
|
|
183
183
|
_addEventListenerExtended() {
|
|
184
184
|
Selectors.findAll(SELECTOR_DATA_TOGGLE, this._element).forEach(el => {
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
if (this._onNativeInputChange) {
|
|
186
|
+
el.removeEventListener('change', this._onNativeInputChange);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
el.addEventListener('change', (e) => this._handleChange(e));
|
|
187
190
|
});
|
|
188
191
|
}
|
|
189
192
|
|
|
190
193
|
_handleChange(e) {
|
|
194
|
+
const input = e?.target;
|
|
195
|
+
this.change(input);
|
|
196
|
+
|
|
191
197
|
if (this._params.ajax) this.uploadAll(this._files);
|
|
192
198
|
|
|
193
199
|
const payload = { files: this._files, input: e?.target || e?.src || '' };
|