Explorar o código

Updates to release v5.2.2 fix #1708 fix #1709 fix #1710

Kartik Visweswaran %!s(int64=3) %!d(string=hai) anos
pai
achega
dd1fb405a1

+ 9 - 1
CHANGE.md

@@ -1,11 +1,19 @@
 Change Log: `bootstrap-fileinput`
 =================================
 
+## version 5.2.2
+
+**Date**: _under development_
+
+- (enh #1710): Correct isEmpty helper.
+- (bug #1709): Corrections to image resizing.
+- (bug #1708): Corrections to reselection/upload of image file deleted earlier.
+
 ## version 5.2.1
 
 **Date**: 19-May-2021
 
-- (enh #1705): Enhance reset of file caption title.
+- (enh #1706): Enhance reset of file caption title.
 - (enh #1705): Corrections to image resizing.
 - (enh #1704): Enhance and fix CDN to use jsDelivr.
 

+ 2 - 2
README.md

@@ -1,13 +1,13 @@
 <h1 align="center">
     <a href="http://plugins.krajee.com" title="Krajee Plugins" target="_blank">
-        <img src="http://kartik-v.github.io/bootstrap-fileinput-samples/samples/krajee-logo-b.png" alt="Krajee Logo"/>
+        <img src="https://kartik-v.github.io/bootstrap-fileinput-samples/samples/krajee-logo-b.png" alt="Krajee Logo"/>
     </a>
     <br>
     bootstrap-fileinput
     <hr>
     <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DTP3NZQ6G2AYU"
        title="Donate via Paypal" target="_blank">
-        <img src="http://kartik-v.github.io/bootstrap-fileinput-samples/samples/donate.png" alt="Donate"/>
+        <img src="https://kartik-v.github.io/bootstrap-fileinput-samples/samples/donate.png" alt="Donate"/>
     </a>
 </h1>
 

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
     "name": "bootstrap-fileinput",
-    "version": "5.2.1",
+    "version": "5.2.2",
     "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.1
+ * bootstrap-fileinput v5.2.2
  * 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.1
+ * bootstrap-fileinput v5.2.2
  * 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.1
+ * bootstrap-fileinput v5.2.2
  * 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.1
+ * bootstrap-fileinput v5.2.2
  * http://plugins.krajee.com/file-input
  *
  * Krajee default styling for bootstrap-fileinput.

+ 1 - 1
examples/index-bs3.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<!-- release v5.2.1, copyright 2014 - 2021 Kartik Visweswaran -->
+<!-- release v5.2.2, copyright 2014 - 2021 Kartik Visweswaran -->
 <!--suppress JSUnresolvedLibraryURL -->
 <html lang="en">
 <head>

+ 1 - 1
examples/index-bs4.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<!-- release v5.2.1, copyright 2014 - 2021 Kartik Visweswaran -->
+<!-- release v5.2.2, copyright 2014 - 2021 Kartik Visweswaran -->
 <!--suppress JSUnresolvedLibraryURL -->
 <html lang="en">
 <head>

+ 1 - 1
examples/index-bs5.html

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<!-- release v5.2.1, copyright 2014 - 2021 Kartik Visweswaran -->
+<!-- release v5.2.2, copyright 2014 - 2021 Kartik Visweswaran -->
 <!--suppress JSUnresolvedLibraryURL -->
 <html lang="en">
 <head>

+ 28 - 21
js/fileinput.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.1
+ * bootstrap-fileinput v5.2.2
  * http://plugins.krajee.com/file-input
  *
  * Author: Kartik Visweswaran
@@ -248,12 +248,26 @@
             return typeof v === 'function';
         },
         isEmpty: function (value, trim) {
-            return value === undefined || value === null || (!$h.isFunction(
-                value) && (value.length === 0 || (trim && $.trim(value) === '')));
+            if (value === undefined || value === null || value === '') {
+                return true;
+            }
+            if ($h.isString(value) && trim) {
+                return $.trim(value) === '';
+            }
+            if ($h.isArray(value)) {
+                return value.length === 0;
+            }
+            if ($.isPlainObject(value) && $.isEmptyObject(value)) {
+                return true
+            }
+            return false;
         },
         isArray: function (a) {
             return Array.isArray(a) || Object.prototype.toString.call(a) === '[object Array]';
         },
+        isString: function (a) {
+            return Object.prototype.toString.call(a) === '[object String]';
+        },
         ifSet: function (needle, haystack, def) {
             def = def || '';
             return (haystack && typeof haystack === 'object' && needle in haystack) ? haystack[needle] : def;
@@ -1111,13 +1125,15 @@
                 },
                 remove: function ($thumb) {
                     var id = self._getThumbFileId($thumb);
-                    if (id) {
-                        self.fileManager.removeFile(id);
-                    }
+                    self.fileManager.removeFile(id);
                 },
                 removeFile: function (id) {
-                    delete self.fileManager.stack[id];
-                    delete self.fileManager.loadedImages[id];
+                    var fm = self.fileManager;
+                    if (!id) {
+                        return;
+                    }
+                    delete fm.stack[id];
+                    delete fm.loadedImages[id];
                 },
                 move: function (idFrom, idTo) {
                     var result = {}, stack = self.fileManager.stack;
@@ -3032,9 +3048,7 @@
             self._setZoomContent($frame);
             $modal.data({backdrop: false});
             //$modal.data('fileinputPluginId', self.$element.attr('id'));
-            console.log('KV--1');
             $modal.modal('show');
-            console.log('KV--2');
             self._initZoomButtons();
         },
         _zoomPreview: function ($btn) {
@@ -3482,6 +3496,7 @@
                         }
                         self.$caption.attr('title', '');
                         $thumb.fadeOut('slow', function () {
+                            var fm = self.fileManager;
                             $thumb.remove();
                             if (!self.getFrames().length) {
                                 self.reset();
@@ -3907,7 +3922,7 @@
             self._initZoomButton();
             self.getFrames(' .kv-file-remove').each(function () {
                 var $el = $(this), $frame = $el.closest($h.FRAMES), hasError, id = $frame.attr('id'),
-                    ind = $frame.attr('data-fileindex'), status;
+                    ind = $frame.attr('data-fileindex'), status, fm = self.fileManager;
                 self._handler($el, 'click', function () {
                     status = self._raise('filepreremove', [id, ind]);
                     if (status === false || !self._validateMinCount()) {
@@ -4202,8 +4217,8 @@
             }
             var self = this, fname = $h.getFileName(file), ftype = fileInfo.type, caption = fileInfo.name,
                 cat = self._parseFileType(ftype, fname), content, $preview = self.$preview, fsize = file.size || 0,
-                iData = cat === 'image' ? theFile.target.result : data,
-                fileId = self.fileManager.getId(file), previewId = self._getThumbId(fileId);
+                iData = cat === 'image' ? theFile.target.result : data, fm = self.fileManager,
+                fileId = fm.getId(file), previewId = self._getThumbId(fileId);
             /** @namespace window.DOMPurify */
             content = self._generatePreviewTemplate(cat, iData, fname, ftype, previewId, fileId, false, fsize);
             self._clearDefaultPreview();
@@ -4597,14 +4612,6 @@
                 self._validateAllImages();
             }).one('error', function () {
                 self._raise('fileimageloaderror', [previewId]);
-            }).each(function () {
-                if (this.complete) {
-                    $(this).trigger('load');
-                } else {
-                    if (this.error) {
-                        $(this).trigger('error');
-                    }
-                }
             });
         },
         _validateAllImages: function () {

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 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.1</version>
+    <version>5.2.2</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.1",
+    "version": "5.2.2",
     "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.1
+ * bootstrap-fileinput v5.2.2
  * 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.1
+ * bootstrap-fileinput v5.2.2
  * http://plugins.krajee.com/file-input
  *
  * Krajee default styling for bootstrap-fileinput.

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

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.1
+ * bootstrap-fileinput v5.2.2
  * 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-fas/theme.scss

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.1
+ * bootstrap-fileinput v5.2.2
  * 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/theme.scss

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.1
+ * bootstrap-fileinput v5.2.2
  * 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-fa/theme.css

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.1
+ * bootstrap-fileinput v5.2.2
  * 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-fa/theme.js

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

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

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.1
+ * bootstrap-fileinput v5.2.2
  * 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-fa/theme.min.js

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

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

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.1
+ * bootstrap-fileinput v5.2.2
  * 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-fas/theme.js

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

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

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.1
+ * bootstrap-fileinput v5.2.2
  * 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-fas/theme.min.js

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

+ 1 - 1
themes/explorer/theme.css

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.1
+ * bootstrap-fileinput v5.2.2
  * 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.1
+ * bootstrap-fileinput v5.2.2
  * 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.1
+ * bootstrap-fileinput v5.2.2
  * 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.1
+ * bootstrap-fileinput v5.2.2
  * http://plugins.krajee.com/file-input
  *
  * Krajee Explorer theme configuration for bootstrap-fileinput. Load this theme file after loading `fileinput.js`.

+ 1 - 1
themes/fa/theme.js

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

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

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

+ 1 - 1
themes/fas/theme.js

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

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

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

+ 1 - 1
themes/gly/theme.js

@@ -1,5 +1,5 @@
 /*!
- * bootstrap-fileinput v5.2.1
+ * bootstrap-fileinput v5.2.2
  * 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.1
+ * bootstrap-fileinput v5.2.2
  * http://plugins.krajee.com/file-input
  *
  * Glyphicon (default) theme configuration for bootstrap-fileinput.

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio