Przeglądaj źródła

Fix #1512: Include parameter to include initial preview files in `getFilesCount` method

Kartik Visweswaran 5 lat temu
rodzic
commit
6bfc90d468
3 zmienionych plików z 6 dodań i 2 usunięć
  1. 1 0
      CHANGE.md
  2. 5 2
      js/fileinput.js
  3. 0 0
      js/fileinput.min.js

+ 1 - 0
CHANGE.md

@@ -9,6 +9,7 @@ Change Log: `bootstrap-fileinput`
     - New event `fileduplicateerror` will be triggered after every duplicate file detected.
     - Duplicate error container can be closed by clicking the `close` icon.
     - New property `fadeDelay` used in fade out / fade in animations of error containers.    
+- (enh #1512): Include parameter to include initial preview files in `getFilesCount` method.
 - (bug #1510): Lock browse button correctly when disable method is called.
 - (bug #1508): Correct file caption after files are uploaded.
 - (bug #1499, #1502): Correct duplicate file check error rendering.

+ 5 - 2
js/fileinput.js

@@ -4770,8 +4770,11 @@
         getFileList: function () {
             return this.fileManager.list();
         },
-        getFilesCount: function () {
+        getFilesCount: function (includeInitial) {
             var self = this, len = self.isAjaxUpload ? self.fileManager.count() : self._inputFileCount();
+            if (includeInitial) {
+                len += self.previewCache.count(true);
+            }
             return self._getFileCount(len);
         },
         readFiles: function (files) {
@@ -4829,7 +4832,7 @@
                             $error.find('ul').append(errors);
                         }
                         $error.fadeIn(self.fadeDelay);
-                        self._handler($error.find('.kv-error-close'), 'click', function() {
+                        self._handler($error.find('.kv-error-close'), 'click', function () {
                             $error.fadeOut(self.fadeDelay);
                         });
                         self.duplicateErrors = [];

Plik diff jest za duży
+ 0 - 0
js/fileinput.min.js


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików