Browse Source

Fix #1123: Correct error container close button click behavior for various scenarios

Kartik Visweswaran 7 years ago
parent
commit
933a87afbb
3 changed files with 11 additions and 4 deletions
  1. 2 0
      CHANGE.md
  2. 9 4
      js/fileinput.js
  3. 0 0
      js/fileinput.min.js

+ 2 - 0
CHANGE.md

@@ -5,6 +5,8 @@ Change Log: `bootstrap-fileinput`
 
 
 **Date:** Work in progress
 **Date:** Work in progress
 
 
+- (bug #1123): Correct error container close button click behavior for various scenarios.
+- (enh #1121): Update Spanish Translations.
 - (enh #1119): Enhance close button icon markup as per BS4 norms.
 - (enh #1119): Enhance close button icon markup as per BS4 norms.
 - (enh #1118): Better file action button style.
 - (enh #1118): Better file action button style.
 - (bug #1117): Reset `ajaxAborted` status more correctly before upload.
 - (bug #1117): Reset `ajaxAborted` status more correctly before upload.

+ 9 - 4
js/fileinput.js

@@ -583,8 +583,7 @@
             self.$previewContainer = $h.getElement(options, 'elPreviewContainer', $cont.find('.file-preview'));
             self.$previewContainer = $h.getElement(options, 'elPreviewContainer', $cont.find('.file-preview'));
             self.$preview = $h.getElement(options, 'elPreviewImage', $cont.find('.file-preview-thumbnails'));
             self.$preview = $h.getElement(options, 'elPreviewImage', $cont.find('.file-preview-thumbnails'));
             self.$previewStatus = $h.getElement(options, 'elPreviewStatus', $cont.find('.file-preview-status'));
             self.$previewStatus = $h.getElement(options, 'elPreviewStatus', $cont.find('.file-preview-status'));
-            self.$errorContainer = $h.getElement(options, 'elErrorContainer',
-                self.$previewContainer.find('.kv-fileinput-error'));
+            self.$errorContainer = $h.getElement(options, 'elErrorContainer', self.$previewContainer.find('.kv-fileinput-error'));
             self._validateDisabled();
             self._validateDisabled();
             if (!$h.isEmpty(self.msgErrorClass)) {
             if (!$h.isEmpty(self.msgErrorClass)) {
                 $h.addCss(self.$errorContainer, self.msgErrorClass);
                 $h.addCss(self.$errorContainer, self.msgErrorClass);
@@ -1138,7 +1137,12 @@
             if (msg && $error.length) {
             if (msg && $error.length) {
                 $error.html(self.errorCloseButton + msg);
                 $error.html(self.errorCloseButton + msg);
                 self._handler($error.find('.kv-error-close'), 'click', function () {
                 self._handler($error.find('.kv-error-close'), 'click', function () {
-                    $error.fadeOut('slow');
+                    setTimeout(function() {
+                        if (self.showPreview && !self.getFrames().length) {
+                            self.clear();
+                        }
+                        $error.fadeOut('slow');                    
+                    }, 10);
                 });
                 });
             }
             }
         },
         },
@@ -1375,7 +1379,8 @@
             $zone.attr('tabindex', -1);
             $zone.attr('tabindex', -1);
             self._handler($zone, 'click', function (e) {
             self._handler($zone, 'click', function (e) {
                 var $tar = $(e.target);
                 var $tar = $(e.target);
-                if (!$tar.parents('.file-preview-thumbnails').length || $tar.parents('.file-default-preview').length) {
+                if (!$zone.find('.kv-fileinput-error:visible').length && 
+                    (!$tar.parents('.file-preview-thumbnails').length || $tar.parents('.file-default-preview').length)) {
                     self.$element.trigger('click');
                     self.$element.trigger('click');
                     $zone.blur();
                     $zone.blur();
                 }
                 }

File diff suppressed because it is too large
+ 0 - 0
js/fileinput.min.js


Some files were not shown because too many files changed in this diff