From 52fefeccef2e4112d9198c4dc1eabb27400fc360 Mon Sep 17 00:00:00 2001 From: yuangongji Date: Mon, 15 Jun 2020 16:55:43 +0800 Subject: [PATCH] Release 2.6.0 --- dist/angular-file-upload.js | 699 +++++++++++++++------------- dist/angular-file-upload.js.map | 2 +- dist/angular-file-upload.min.js | 4 +- dist/angular-file-upload.min.js.map | 2 +- package.json | 2 +- 5 files changed, 391 insertions(+), 318 deletions(-) diff --git a/dist/angular-file-upload.js b/dist/angular-file-upload.js index 21cf8a7..27f0b28 100644 --- a/dist/angular-file-upload.js +++ b/dist/angular-file-upload.js @@ -1,5 +1,5 @@ /* - angular-file-upload v2.5.0 + angular-file-upload v2.6.0 https://github.com/nervgh/angular-file-upload */ @@ -57,7 +57,7 @@ return /******/ (function(modules) { // webpackBootstrap /************************************************************************/ /******/ ([ /* 0 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -126,17 +126,15 @@ return /******/ (function(modules) { // webpackBootstrap FileUploader.Pipeline = Pipeline; }]); -/***/ }, +/***/ }), /* 1 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { - module.exports = { - "name": "angularFileUpload" - }; + module.exports = {"name":"angularFileUpload"} -/***/ }, +/***/ }), /* 2 */ -/***/ function(module, exports) { +/***/ (function(module, exports) { 'use strict'; @@ -159,9 +157,9 @@ return /******/ (function(modules) { // webpackBootstrap disableMultipart: false }; -/***/ }, +/***/ }), /* 3 */ -/***/ function(module, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -181,20 +179,20 @@ return /******/ (function(modules) { // webpackBootstrap function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - var _angular = angular; - var bind = _angular.bind; - var copy = _angular.copy; - var extend = _angular.extend; - var forEach = _angular.forEach; - var isObject = _angular.isObject; - var isNumber = _angular.isNumber; - var isDefined = _angular.isDefined; - var isArray = _angular.isArray; - var isUndefined = _angular.isUndefined; - var element = _angular.element; + var _angular = angular, + bind = _angular.bind, + copy = _angular.copy, + extend = _angular.extend, + forEach = _angular.forEach, + isObject = _angular.isObject, + isNumber = _angular.isNumber, + isDefined = _angular.isDefined, + isArray = _angular.isArray, + isUndefined = _angular.isUndefined, + element = _angular.element; function __identity(fileUploaderOptions, $rootScope, $http, $window, $timeout, FileLikeObject, FileItem, Pipeline) { - var File = $window.File; - var FormData = $window.FormData; + var File = $window.File, + FormData = $window.FormData; var FileUploader = function () { /********************** @@ -205,7 +203,6 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Object} [options] * @constructor */ - function FileUploader(options) { _classCallCheck(this, FileUploader); @@ -250,10 +247,9 @@ return /******/ (function(modules) { // webpackBootstrap var onThrown = function onThrown(err) { var originalFilter = err.pipe.originalFilter; - var _err$args = _slicedToArray(err.args, 2); - - var fileLikeObject = _err$args[0]; - var options = _err$args[1]; + var _err$args = _slicedToArray(err.args, 2), + fileLikeObject = _err$args[0], + options = _err$args[1]; _this._onWhenAddingFileFailed(fileLikeObject, originalFilter, options); next(); @@ -347,14 +343,12 @@ return /******/ (function(modules) { // webpackBootstrap // It will call this._onCancelItem() & this._onCompleteItem() asynchronously item[prop].abort(); } else { - (function () { - var dummy = [undefined, 0, {}]; - var onNextTick = function onNextTick() { - _this2._onCancelItem.apply(_this2, [item].concat(dummy)); - _this2._onCompleteItem.apply(_this2, [item].concat(dummy)); - }; - $timeout(onNextTick); // Trigger callbacks asynchronously (setImmediate emulation) - })(); + var dummy = [undefined, 0, {}]; + var onNextTick = function onNextTick() { + _this2._onCancelItem.apply(_this2, [item].concat(dummy)); + _this2._onCompleteItem.apply(_this2, [item].concat(dummy)); + }; + $timeout(onNextTick); // Trigger callbacks asynchronously (setImmediate emulation) } }; /** @@ -549,6 +543,13 @@ return /******/ (function(modules) { // webpackBootstrap FileUploader.prototype.onCompleteItem = function onCompleteItem(item, response, status, headers) {}; + /** + * Callback + * @param {FileItem} item + */ + + + FileUploader.prototype.onTimeoutItem = function onTimeoutItem(item) {}; /** * Callback */ @@ -769,6 +770,15 @@ return /******/ (function(modules) { // webpackBootstrap _this5._onCompleteItem(item, response, xhr.status, headers); }; + xhr.timeout = item.timeout || 0; + + xhr.ontimeout = function (e) { + var headers = _this5._parseHeaders(xhr.getAllResponseHeaders()); + var response = "Request Timeout."; + _this5._onTimeoutItem(item); + _this5._onCompleteItem(item, response, 408, headers); + }; + xhr.open(item.method, item.url, true); xhr.withCredentials = item.withCredentials; @@ -793,6 +803,10 @@ return /******/ (function(modules) { // webpackBootstrap var iframe = element('