Browse Source

Updates to release v5.5.0 fixes #1791 fixes #1795 fixes #1796

Kartik Visweswaran 2 years ago
parent
commit
9527bb0858
46 changed files with 179 additions and 80 deletions
  1. 7 4
      CHANGE.md
  2. 13 11
      README.md
  3. 1 1
      bower.json
  4. 1 1
      css/fileinput-rtl.css
  5. 1 1
      css/fileinput-rtl.min.css
  6. 1 1
      css/fileinput.css
  7. 1 1
      css/fileinput.min.css
  8. 29 1
      examples/index-bs3.html
  9. 29 1
      examples/index-bs4.html
  10. 42 13
      examples/index-bs5.html
  11. 19 10
      js/fileinput.js
  12. 1 1
      js/fileinput.min.js
  13. 1 1
      nuget/Package.nuspec
  14. 1 1
      package.json
  15. 1 1
      scss/fileinput-rtl.scss
  16. 1 1
      scss/fileinput.scss
  17. 1 1
      scss/themes/explorer-fa4/theme.scss
  18. 1 1
      scss/themes/explorer-fa5/theme.scss
  19. 1 1
      scss/themes/explorer-fa6/theme.scss
  20. 1 1
      scss/themes/explorer/theme.scss
  21. 1 1
      themes/bs5/theme.js
  22. 1 1
      themes/bs5/theme.min.js
  23. 1 1
      themes/explorer-fa4/theme.css
  24. 1 1
      themes/explorer-fa4/theme.js
  25. 1 1
      themes/explorer-fa4/theme.min.css
  26. 1 1
      themes/explorer-fa4/theme.min.js
  27. 1 1
      themes/explorer-fa5/theme.css
  28. 1 1
      themes/explorer-fa5/theme.js
  29. 1 1
      themes/explorer-fa5/theme.min.css
  30. 1 1
      themes/explorer-fa5/theme.min.js
  31. 1 1
      themes/explorer-fa6/theme.css
  32. 1 1
      themes/explorer-fa6/theme.js
  33. 1 1
      themes/explorer-fa6/theme.min.css
  34. 1 1
      themes/explorer-fa6/theme.min.js
  35. 1 1
      themes/explorer/theme.css
  36. 1 1
      themes/explorer/theme.js
  37. 1 1
      themes/explorer/theme.min.css
  38. 1 1
      themes/explorer/theme.min.js
  39. 1 1
      themes/fa4/theme.js
  40. 1 1
      themes/fa4/theme.min.js
  41. 1 1
      themes/fa5/theme.js
  42. 1 1
      themes/fa5/theme.min.js
  43. 1 1
      themes/fa6/theme.js
  44. 1 1
      themes/fa6/theme.min.js
  45. 1 1
      themes/gly/theme.js
  46. 1 1
      themes/gly/theme.min.js

+ 7 - 4
CHANGE.md

@@ -1,7 +1,9 @@
 Change Log: `bootstrap-fileinput`
 =================================
 
-## version 5.2.9
+## version 5.5.0
+
+**Major Release: BC Breaking**
 
 **Date**: 19-Jun-2022
 
@@ -17,12 +19,13 @@ Change Log: `bootstrap-fileinput`
    - Load the following new plugin files before fileinput.min.js
 ```html
 <!-- buffer.min.js and filetype.min.js are necessary in the order listed for advanced mime type parsing and more correct
-     preview. This is a feature available since v5.2.9 and is needed if you want to ensure file mime type is parsed 
+     preview. This is a feature available since v5.5.0 and is needed if you want to ensure file mime type is parsed 
      correctly even if the local file's extension is named incorrectly. This will ensure more correct preview of the
      selected file (note: this will involve a small processing overhead in scanning of file contents locally). -->
-<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.2.9/js/plugins/buffer.min.js" type="text/javascript"></script>
-<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.2.9/js/plugins/filetype.min.js" type="text/javascript"></script>
+<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.0/js/plugins/buffer.min.js" type="text/javascript"></script>
+<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.0/js/plugins/filetype.min.js" type="text/javascript"></script>
 ```   
+- (enh #1791): Enhance preview update automatically when `addToStack` is called.
 - (enh #1785): Image rotation button action feature in thumbnail and zoom.
   - New property `rotatableFileExtensions` defaults to ['jpg', 'jpeg', 'png', 'gif'], 
   - New properties in `fileActionSettings` (`rotateIcon`, `rotateTitle`, `rotateClass`)

+ 13 - 11
README.md

@@ -92,41 +92,43 @@ Step 1: Load the following assets on your page in the order mentioned.
 <!-- link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css" crossorigin="anonymous" -->
 
 <!-- the fileinput plugin styling CSS file -->
-<link href="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.2.9/css/fileinput.min.css" media="all" rel="stylesheet" type="text/css" />
+<link href="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.0/css/fileinput.min.css" media="all" rel="stylesheet" type="text/css" />
 
 <!-- if using RTL (Right-To-Left) orientation, load the RTL CSS file after fileinput.css by uncommenting below -->
-<!-- link href="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.2.9/css/fileinput-rtl.min.css" media="all" rel="stylesheet" type="text/css" /-->
+<!-- link href="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.0/css/fileinput-rtl.min.css" media="all" rel="stylesheet" type="text/css" /-->
 
 <!-- the jQuery Library -->
 <script src="https://code.jquery.com/jquery-3.6.0.min.js" crossorigin="anonymous"></script>
 
 <!-- buffer.min.js and filetype.min.js are necessary in the order listed for advanced mime type parsing and more correct
-     preview. This is a feature available since v5.2.9 and is needed if you want to ensure file mime type is parsed 
+     preview. This is a feature available since v5.5.0 and is needed if you want to ensure file mime type is parsed 
      correctly even if the local file's extension is named incorrectly. This will ensure more correct preview of the
-     selected file (note: this will involve a small processing overhead in scanning of file contents locally). -->
-<script src="https://cdn.jsdelivr.net/gh/kartik-v/[email protected]/js/plugins/buffer.min.js" type="text/javascript"></script>
-<script src="https://cdn.jsdelivr.net/gh/kartik-v/[email protected]/js/plugins/filetype.min.js" type="text/javascript"></script>
+     selected file (note: this will involve a small processing overhead in scanning of file contents locally). If you 
+     do not load these scripts then the mime type parsing will largely be derived using the extension in the filename
+     and some basic file content parsing signatures. -->
+<script src="https://cdn.jsdelivr.net/gh/kartik-v/[email protected]/js/plugins/buffer.min.js" type="text/javascript"></script>
+<script src="https://cdn.jsdelivr.net/gh/kartik-v/[email protected]/js/plugins/filetype.min.js" type="text/javascript"></script>
 
 <!-- piexif.min.js is needed for auto orienting image files OR when restoring exif data in resized images and when you
     wish to resize images before upload. This must be loaded before fileinput.min.js -->
-<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.2.9/js/plugins/piexif.min.js" type="text/javascript"></script>
+<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.0/js/plugins/piexif.min.js" type="text/javascript"></script>
 
 <!-- sortable.min.js is only needed if you wish to sort / rearrange files in initial preview. 
     This must be loaded before fileinput.min.js -->
-<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.2.9/js/plugins/sortable.min.js" type="text/javascript"></script>
+<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.0/js/plugins/sortable.min.js" type="text/javascript"></script>
 
 <!-- bootstrap.bundle.min.js below is needed if you wish to zoom and preview file content in a detail modal
     dialog. bootstrap 5.x or 4.x is supported. You can also use the bootstrap js 3.3.x versions. -->
 <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
 
 <!-- the main fileinput plugin script JS file -->
-<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.2.9/js/fileinput.min.js"></script>
+<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.0/js/fileinput.min.js"></script>
 
 <!-- following theme script is needed to use the Font Awesome 5.x theme (`fas`). Uncomment if needed. -->
-<!-- script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.2.9/themes/fas/theme.min.js"></script -->
+<!-- script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.0/themes/fas/theme.min.js"></script -->
 
 <!-- optionally if you need translation for your language then include the locale file as mentioned below (replace LANG.js with your language locale) -->
-<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.2.9/js/locales/LANG.js"></script>
+<script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.0/js/locales/LANG.js"></script>
 ```
 With v5.2.1, the plugin is able to automatically detect the bootstrap library version and deliver the relevant bootstrap specific functionality (if you have loaded the bootstrap.min.js before fileinput.min.js). In case of any issues - you can explicitly set the bootstrap version by setting the following variable before the plugin initialization script.
 

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "bootstrap-fileinput",
-  "version": "5.2.9",
+  "version": "5.5.0",
   "homepage": "https://github.com/kartik-v/bootstrap-fileinput",
   "authors": [
     "Kartik Visweswaran <[email protected]>"

+ 1 - 1
css/fileinput-rtl.css

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee RTL (Right To Left) default styling for bootstrap-fileinput.

+ 1 - 1
css/fileinput-rtl.min.css

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee RTL (Right To Left) default styling for bootstrap-fileinput.

+ 1 - 1
css/fileinput.css

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee default styling for bootstrap-fileinput.

+ 1 - 1
css/fileinput.min.css

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee default styling for bootstrap-fileinput.

+ 29 - 1
examples/index-bs3.html

@@ -1,5 +1,5 @@
 <!--
-* bootstrap-fileinput v5.2.9
+* bootstrap-fileinput v5.5.0
 * http://plugins.krajee.com/file-input
 *
 * Author: Kartik Visweswaran
@@ -21,6 +21,8 @@
     <link href="../themes/explorer-fa5/theme.css" media="all" rel="stylesheet" type="text/css"/>
     <script src="https://code.jquery.com/jquery-3.6.0.min.js" crossorigin="anonymous"></script>
     <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" crossorigin="anonymous"></script>
+    <script src="../js/plugins/buffer.min.js" type="text/javascript"></script>
+    <script src="../js/plugins/filetype.min.js" type="text/javascript"></script>
     <script src="../js/plugins/piexif.js" type="text/javascript"></script>
     <script src="../js/plugins/sortable.js" type="text/javascript"></script>
     <script src="../js/fileinput.js" type="text/javascript"></script>
@@ -142,6 +144,13 @@
             </div>
     </form>
     <hr>
+    <h4>Test <code>addToStack</code></h4>
+    <label>Select file below which will automatically be added to the plugin preview later</label>
+    <div class="input-group mb-3">
+        <input type="file" class="form-control" id="inp-add-1">
+    </div>
+    <hr>
+    <input type="file" id="inp-add-2" name="inp-add-2" multiple>
     <br>
 </div>
 </body>
@@ -252,6 +261,25 @@
          alert('i = ' + index + ', id = ' + previewId + ', file = ' + file.name);
          });
          */
+        $('#inp-add-1').on('change', function() {
+            var $plugin = $('#inp-add-2').data('fileinput');
+            $plugin.addToStack($(this)[0].files[0])
+        });
+        $('#inp-add-2').fileinput({
+            uploadUrl: '#',
+            //uploadUrl: 'http://localhost/plugins/test-upload',
+            initialPreviewAsData: true,
+            initialPreview: [
+                "https://dummyimage.com/640x360/a0f.png&text=Transport+1",
+                "https://dummyimage.com/640x360/3a8.png&text=Transport+2",
+                "https://dummyimage.com/640x360/6ff.png&text=Transport+3"
+            ],
+            initialPreviewConfig: [
+                {caption: "transport-1.jpg", size: 329892, width: "120px", url: "{$url}", key: 1, zoomData: 'https://dummyimage.com/1920x1080/a0f.png&text=Transport+1', description: '<h5>NUMBER 1</h5> The first choice for transport. This is the future.'},
+                {caption: "transport-2.jpg", size: 872378, width: "120px", url: "{$url}", key: 2, zoomData: 'https://dummyimage.com/1920x1080/3a8.png&text=Transport+2', description: '<h5>NUMBER 2</h5> The second choice for transport. This is the future.'},
+                {caption: "transport-3.jpg", size: 632762, width: "120px", url: "{$url}", key: 3, zoomData: 'https://dummyimage.com/1920x1080/6ff.png&text=Transport+3', description: '<h5>NUMBER 3</h5> The third choice for transport. This is the future.'}
+            ]
+        });
     });
 </script>
 </html>

+ 29 - 1
examples/index-bs4.html

@@ -1,5 +1,5 @@
 <!--
-* bootstrap-fileinput v5.2.9
+* bootstrap-fileinput v5.5.0
 * http://plugins.krajee.com/file-input
 *
 * Author: Kartik Visweswaran
@@ -21,6 +21,8 @@
     <link href="../themes/explorer-fa5/theme.css" media="all" rel="stylesheet" type="text/css"/>
     <script src="https://code.jquery.com/jquery-3.6.0.min.js" crossorigin="anonymous"></script>
     <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
+    <script src="../js/plugins/buffer.min.js" type="text/javascript"></script>
+    <script src="../js/plugins/filetype.min.js" type="text/javascript"></script>
     <script src="../js/plugins/piexif.js" type="text/javascript"></script>
     <script src="../js/plugins/sortable.js" type="text/javascript"></script>
     <script src="../js/fileinput.js" type="text/javascript"></script>
@@ -139,6 +141,13 @@
             </div>
     </form>
     <hr>
+    <h4>Test <code>addToStack</code></h4>
+    <label>Select file below which will automatically be added to the plugin preview later</label>
+    <div class="input-group mb-3">
+        <input type="file" class="form-control" id="inp-add-1">
+    </div>
+    <hr>
+    <input type="file" id="inp-add-2" name="inp-add-2" multiple>
     <br>
 </div>
 </body>
@@ -249,6 +258,25 @@
          alert('i = ' + index + ', id = ' + previewId + ', file = ' + file.name);
          });
          */
+        $('#inp-add-1').on('change', function() {
+            var $plugin = $('#inp-add-2').data('fileinput');
+            $plugin.addToStack($(this)[0].files[0])
+        });
+        $('#inp-add-2').fileinput({
+            uploadUrl: '#',
+            //uploadUrl: 'http://localhost/plugins/test-upload',
+            initialPreviewAsData: true,
+            initialPreview: [
+                "https://dummyimage.com/640x360/a0f.png&text=Transport+1",
+                "https://dummyimage.com/640x360/3a8.png&text=Transport+2",
+                "https://dummyimage.com/640x360/6ff.png&text=Transport+3"
+            ],
+            initialPreviewConfig: [
+                {caption: "transport-1.jpg", size: 329892, width: "120px", url: "{$url}", key: 1, zoomData: 'https://dummyimage.com/1920x1080/a0f.png&text=Transport+1', description: '<h5>NUMBER 1</h5> The first choice for transport. This is the future.'},
+                {caption: "transport-2.jpg", size: 872378, width: "120px", url: "{$url}", key: 2, zoomData: 'https://dummyimage.com/1920x1080/3a8.png&text=Transport+2', description: '<h5>NUMBER 2</h5> The second choice for transport. This is the future.'},
+                {caption: "transport-3.jpg", size: 632762, width: "120px", url: "{$url}", key: 3, zoomData: 'https://dummyimage.com/1920x1080/6ff.png&text=Transport+3', description: '<h5>NUMBER 3</h5> The third choice for transport. This is the future.'}
+            ]
+        });
     });
 </script>
 </html>

+ 42 - 13
examples/index-bs5.html

@@ -1,5 +1,5 @@
 <!--
-* bootstrap-fileinput v5.2.9
+* bootstrap-fileinput v5.5.0
 * http://plugins.krajee.com/file-input
 *
 * Author: Kartik Visweswaran
@@ -14,18 +14,20 @@
     <meta charset="UTF-8"/>
     <title>Krajee JQuery Plugins - Bootstrap 5.x - &copy; Kartik</title>
     
-    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" crossorigin="anonymous">
+    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected].3/dist/css/bootstrap.min.css" crossorigin="anonymous">
     <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css" crossorigin="anonymous">
     <link href="../css/fileinput.css" media="all" rel="stylesheet" type="text/css"/>
     <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css" crossorigin="anonymous">
     <link href="../themes/explorer-fa5/theme.css" media="all" rel="stylesheet" type="text/css"/>
     <script src="https://code.jquery.com/jquery-3.6.0.min.js" crossorigin="anonymous"></script>
+    <script src="../js/plugins/buffer.min.js" type="text/javascript"></script>
+    <script src="../js/plugins/filetype.min.js" type="text/javascript"></script>
     <script src="../js/plugins/piexif.js" type="text/javascript"></script>
     <script src="../js/plugins/sortable.js" type="text/javascript"></script>
 </head>
 <body>
 <div class="container my-4">
-    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
+    <script src="https://cdn.jsdelivr.net/npm/[email protected].3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
     <script src="../js/fileinput.js" type="text/javascript"></script>
     <script src="../js/locales/fr.js" type="text/javascript"></script>
     <script src="../js/locales/es.js" type="text/javascript"></script>
@@ -33,10 +35,11 @@
     <script src="../themes/explorer-fa5/theme.js" type="text/javascript"></script>
     <h1>Bootstrap File Input Examples
         <small><a href="https://github.com/kartik-v/bootstrap-fileinput-samples"><i
-                class="glyphicon glyphicon-download"></i> Download Sample Files</a></small>
+                class="fas fa-download"></i> Download Sample Files</a></small>
     </h1>
     <h4>Bootstrap Version: <script>document.write($.fn.fileinputBsVersion);</script></h4>
     <hr>
+
     <form enctype="multipart/form-data">
         <div class="file-loading">
             <input id="kv-explorer" type="file" multiple>
@@ -139,6 +142,13 @@
             </div>
     </form>
     <hr>
+    <h4>Test <code>addToStack</code></h4>
+    <label>Select file below which will automatically be added to the plugin preview later</label>
+    <div class="input-group mb-3">
+        <input type="file" class="form-control" id="inp-add-1">
+    </div>
+    <hr>
+    <input type="file" id="inp-add-2" name="inp-add-2" multiple>
     <br>
 </div>
 </body>
@@ -185,14 +195,14 @@
         initialPreviewAsData: true,
         //uploadUrl: 'http://localhost/plugins/test-upload',
         initialPreview: [
-            "http://lorempixel.com/640/360/transport/1",
-            "http://lorempixel.com/640/360/transport/2",
-            "http://lorempixel.com/640/360/transport/3"
+            "https://dummyimage.com/640x360/a0f.png&text=Transport+1",
+            "https://dummyimage.com/640x360/3a8.png&text=Transport+2",
+            "https://dummyimage.com/640x360/6ff.png&text=Transport+3"
         ],
         initialPreviewConfig: [
-            {caption: "transport-1.jpg", size: 329892, width: "120px", url: "{$url}", key: 1, zoomData: 'http://lorempixel.com/1920/1080/transport/1', description: '<h5>NUMBER 1</h5> The first choice for transport. This is the future.'},
-            {caption: "transport-2.jpg", size: 872378, width: "120px", url: "{$url}", key: 2, zoomData: 'http://lorempixel.com/1920/1080/transport/2', description: '<h5>NUMBER 2</h5> The second choice for transport. This is the future.'},
-            {caption: "transport-3.jpg", size: 632762, width: "120px", url: "{$url}", key: 3, zoomData: 'http://lorempixel.com/1920/1080/transport/3', description: '<h5>NUMBER 3</h5> The third choice for transport. This is the future.'}
+            {caption: "transport-1.jpg", size: 329892, width: "120px", url: "{$url}", key: 1, zoomData: 'https://dummyimage.com/1920x1080/a0f.png&text=Transport+1', description: '<h5>NUMBER 1</h5> The first choice for transport. This is the future.'},
+            {caption: "transport-2.jpg", size: 872378, width: "120px", url: "{$url}", key: 2, zoomData: 'https://dummyimage.com/1920x1080/3a8.png&text=Transport+2', description: '<h5>NUMBER 2</h5> The second choice for transport. This is the future.'},
+            {caption: "transport-3.jpg", size: 632762, width: "120px", url: "{$url}", key: 3, zoomData: 'https://dummyimage.com/1920x1080/6ff.png&text=Transport+3', description: '<h5>NUMBER 3</h5> The third choice for transport. This is the future.'}
         ]
     }).on('filebatchpreupload', function(e, data) {
         return {
@@ -236,9 +246,9 @@
             overwriteInitial: false,
             initialPreviewAsData: true,
             initialPreview: [
-                "http://lorempixel.com/1920/1080/nature/1",
-                "http://lorempixel.com/1920/1080/nature/2",
-                "http://lorempixel.com/1920/1080/nature/3"
+                "https://dummyimage.com/1920x1080/1aa.png&text=Nature+1",
+                "https://dummyimage.com/1920x1080/2ef.png&text=Nature+2",
+                "https://dummyimage.com/1920x1080/3f0.png&text=Nature+3"
             ],
             initialPreviewConfig: [
                 {caption: "nature-1.jpg", size: 329892, width: "120px", url: "{$url}", key: 1},
@@ -251,6 +261,25 @@
          alert('i = ' + index + ', id = ' + previewId + ', file = ' + file.name);
          });
          */
+        $('#inp-add-1').on('change', function() {
+            var $plugin = $('#inp-add-2').data('fileinput');
+            $plugin.addToStack($(this)[0].files[0])
+        });
+        $('#inp-add-2').fileinput({
+           uploadUrl: '#',
+            //uploadUrl: 'http://localhost/plugins/test-upload',
+            initialPreviewAsData: true,
+            initialPreview: [
+                "https://dummyimage.com/640x360/a0f.png&text=Transport+1",
+                "https://dummyimage.com/640x360/3a8.png&text=Transport+2",
+                "https://dummyimage.com/640x360/6ff.png&text=Transport+3"
+            ],
+            initialPreviewConfig: [
+                {caption: "transport-1.jpg", size: 329892, width: "120px", url: "{$url}", key: 1, zoomData: 'https://dummyimage.com/1920x1080/a0f.png&text=Transport+1', description: '<h5>NUMBER 1</h5> The first choice for transport. This is the future.'},
+                {caption: "transport-2.jpg", size: 872378, width: "120px", url: "{$url}", key: 2, zoomData: 'https://dummyimage.com/1920x1080/3a8.png&text=Transport+2', description: '<h5>NUMBER 2</h5> The second choice for transport. This is the future.'},
+                {caption: "transport-3.jpg", size: 632762, width: "120px", url: "{$url}", key: 3, zoomData: 'https://dummyimage.com/1920x1080/6ff.png&text=Transport+3', description: '<h5>NUMBER 3</h5> The third choice for transport. This is the future.'}
+            ]
+        });
     });
 </script>
 </html>

+ 19 - 10
js/fileinput.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Author: Kartik Visweswaran
@@ -3241,7 +3241,7 @@
             }
             if (self.isAjaxUpload) {
                 if (self.fileManager.count() > 0) {
-                    files = $.extend(true, {}, self.getFileList());
+                    files = $.extend(true, [], self.getFileList());
                     self.fileManager.clear();
                     self._clearFileInput();
                 } else {
@@ -3252,7 +3252,6 @@
             }
             if (files && files.length) {
                 self.readFiles(files);
-                self._setFileDropZoneTitle();
             }
         },
         _clearObjects: function ($el) {
@@ -4313,10 +4312,10 @@
             if (typeof func === 'function') {
                 out = func(size);
             } else {
+                if (!sizeUnits) {
+                    sizeUnits = self.sizeUnits;
+                }
                 if (size > 0) {
-                    if (!sizeUnits) {
-                        sizeUnits = self.sizeUnits;
-                    }
                     while (sizeHuman >= factor) {
                         sizeHuman /= factor;
                         ++i;
@@ -4330,6 +4329,7 @@
                 if (newSize == sizeHuman) {
                     newSize = sizeHuman;
                 }
+                console.log('size ', size);
                 out = newSize + ' ' + sizeUnits[i];
             }
             return skipTemplate ? out : self._getLayoutTemplate('size').replace('{sizeText}', out);
@@ -5462,7 +5462,11 @@
             return !skipPreview && (allowedTypes || allowedMimes || allowedExts);
         },
         addToStack: function (file, id) {
-            this.fileManager.add(file, id);
+            var self = this;
+            self.stackIsUpdating = true;
+            self.fileManager.add(file, id);
+            self._refreshPreview();
+            self.stackIsUpdating = false;
         },
         clearFileStack: function () {
             var self = this;
@@ -5633,6 +5637,9 @@
                     setTimeout(function () {
                         $status.html(msg);
                         self._updateFileDetails(numFiles);
+                        if (self.getFilesCount(true) > 0 && self.getFrames(':visible')) {
+                            self.$dropZone.find('.'+ self.dropZoneTitleClass).remove();
+                        }
                         readFile(i + 1);
                     }, self.processDelay);
                     if (self._raise('fileloaded', [file, previewId, id, i, reader]) && self.isAjaxUpload) {
@@ -5673,9 +5680,11 @@
                     var p2 = {id: previewId, index: i, fileId: fileId, file: file, files: files};
                     msg = self.msgDuplicateFile.setTokens({name: caption, size: sizeHuman});
                     if (self.isAjaxUpload) {
-                        self.duplicateErrors.push(msg);
-                        self.isDuplicateError = true;
-                        self._raise('fileduplicateerror', [file, fileId, caption, sizeHuman, previewId, i]);
+                        if (!self.stackIsUpdating) {
+                            self.duplicateErrors.push(msg);
+                            self.isDuplicateError = true;
+                            self._raise('fileduplicateerror', [file, fileId, caption, sizeHuman, previewId, i]);
+                        }
                         readFile(i + 1);
                         self._updateFileDetails(numFiles);
                     } else {

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


+ 1 - 1
nuget/Package.nuspec

@@ -3,7 +3,7 @@
   <metadata>
     <id>bootstrap-fileinput</id>
 	<title>bootstrap-fileinput</title>
-    <version>5.2.9</version>
+    <version>5.5.0</version>
     <authors>Kartik Visweswaran</authors>
     <owners>Kartik Visweswaran</owners>
     <licenseUrl>https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md</licenseUrl>

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "bootstrap-fileinput",
-  "version": "5.2.9",
+  "version": "5.5.0",
   "homepage": "https://github.com/kartik-v/bootstrap-fileinput",
   "authors": [
     "Kartik Visweswaran <[email protected]>"

+ 1 - 1
scss/fileinput-rtl.scss

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee RTL (Right To Left) default styling for bootstrap-fileinput.

+ 1 - 1
scss/fileinput.scss

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee default styling for bootstrap-fileinput.

+ 1 - 1
scss/themes/explorer-fa4/theme.scss

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer Font Awesome 4.x theme style for bootstrap-fileinput. Load this theme file after loading

+ 1 - 1
scss/themes/explorer-fa5/theme.scss

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer Font Awesome 5.x theme style for bootstrap-fileinput. Load this theme file after loading

+ 1 - 1
scss/themes/explorer-fa6/theme.scss

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer Font Awesome 6.x theme style for bootstrap-fileinput. Load this theme file after loading

+ 1 - 1
scss/themes/explorer/theme.scss

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer theme style for bootstrap-fileinput. Load this theme file after loading `fileinput.css`.

+ 1 - 1
themes/bs5/theme.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Bootstrap 5.x icon theme configuration for bootstrap-fileinput. Requires bootstrap 5.x icons CSS to be loaded.

+ 1 - 1
themes/bs5/theme.min.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Bootstrap 5.x icon theme configuration for bootstrap-fileinput. Requires bootstrap 5.x icons CSS to be loaded.

+ 1 - 1
themes/explorer-fa4/theme.css

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer Font Awesome 5.x theme style for bootstrap-fileinput. Load this theme file after loading

+ 1 - 1
themes/explorer-fa4/theme.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer Font Awesome theme configuration for bootstrap-fileinput. 

+ 1 - 1
themes/explorer-fa4/theme.min.css

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer Font Awesome 5.x theme style for bootstrap-fileinput. Load this theme file after loading

+ 1 - 1
themes/explorer-fa4/theme.min.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer Font Awesome theme configuration for bootstrap-fileinput.

+ 1 - 1
themes/explorer-fa5/theme.css

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer Font Awesome 5.x theme style for bootstrap-fileinput. Load this theme file after loading

+ 1 - 1
themes/explorer-fa5/theme.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer Font Awesome 5.x theme configuration for bootstrap-fileinput.

+ 1 - 1
themes/explorer-fa5/theme.min.css

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer Font Awesome 5.x theme style for bootstrap-fileinput. Load this theme file after loading

+ 1 - 1
themes/explorer-fa5/theme.min.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer Font Awesome 5.x theme configuration for bootstrap-fileinput.

+ 1 - 1
themes/explorer-fa6/theme.css

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer Font Awesome 5.x theme style for bootstrap-fileinput. Load this theme file after loading

+ 1 - 1
themes/explorer-fa6/theme.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer Font Awesome 6.x theme configuration for bootstrap-fileinput.

+ 1 - 1
themes/explorer-fa6/theme.min.css

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer Font Awesome 5.x theme style for bootstrap-fileinput. Load this theme file after loading

+ 1 - 1
themes/explorer-fa6/theme.min.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer Font Awesome 6.x theme configuration for bootstrap-fileinput.

+ 1 - 1
themes/explorer/theme.css

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer theme style for bootstrap-fileinput. Load this theme file after loading `fileinput.css`.

+ 1 - 1
themes/explorer/theme.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer theme configuration for bootstrap-fileinput. Load this theme file after loading `fileinput.js`.

+ 1 - 1
themes/explorer/theme.min.css

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer theme style for bootstrap-fileinput. Load this theme file after loading `fileinput.css`.

+ 1 - 1
themes/explorer/theme.min.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer theme configuration for bootstrap-fileinput. Load this theme file after loading `fileinput.js`.

+ 1 - 1
themes/fa4/theme.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Font Awesome 4.x icon theme configuration for bootstrap-fileinput. Requires font awesome 4.x assets to be loaded.

+ 1 - 1
themes/fa4/theme.min.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Font Awesome 4.x icon theme configuration for bootstrap-fileinput. Requires font awesome assets to be loaded.

+ 1 - 1
themes/fa5/theme.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Font Awesome 5.x icon theme configuration for bootstrap-fileinput. Requires font awesome 5 assets to be loaded.

+ 1 - 1
themes/fa5/theme.min.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Font Awesome 5.x icon theme configuration for bootstrap-fileinput. Requires font awesome 5 assets to be loaded.

+ 1 - 1
themes/fa6/theme.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Font Awesome 6.x icon theme configuration for bootstrap-fileinput. Requires font awesome 6 assets to be loaded.

+ 1 - 1
themes/fa6/theme.min.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Font Awesome 6 icon theme configuration for bootstrap-fileinput. Requires font awesome 6 assets to be loaded.

+ 1 - 1
themes/gly/theme.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Glyphicon (default) theme configuration for bootstrap-fileinput.

+ 1 - 1
themes/gly/theme.min.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.9
+ * bootstrap-fileinput v5.5.0
  * http://plugins.krajee.com/file-input
  *
  * Glyphicon (default) theme configuration for bootstrap-fileinput.

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