angularjs-file-upload-rails 2.2.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 17f7752e748b20c72779c900f146721bd76fac0e
4
- data.tar.gz: 1aa3fac0585665efa8512687bf12279e1d09f8f0
3
+ metadata.gz: 102d43f3e7aa540203d281869b3cc1ecb3849fcb
4
+ data.tar.gz: f5a75c88a7acb97333186448cc3162147804f6d1
5
5
  SHA512:
6
- metadata.gz: 2df46552ecddcef4060b0ac1675f375c46ce9b8ca78b9c2318c88611e158376225accea377b01b72c241ba0472d84665052fb6479fb1866dfac874ab902fec90
7
- data.tar.gz: 38029528f2b86ba26bc283d385d4a7e5ece30c58859ed582cfeb72be2504ba5ba43a28992f3a086339e51f3f856d27b9e9ab7721ae370ade6f505834e42a8daf
6
+ metadata.gz: 564cbda51a4d9470dd66dec38a3deab6e0da80f0ab7c532107f74b360236f020574c08307acdb79d2556272daf68c87d0a5e0e7557c72d0e02c15848c4f2d09b
7
+ data.tar.gz: bfaea54de8ed0941fe33b49fc2e281b529a4cb9b57e59d7c8dc56ddda68d5379a67a892a2ff97026cf7d3448969078bd1c9eeda8329f3236b051b255ac4db4b3
data/README.md CHANGED
@@ -9,7 +9,7 @@ A gem that uses [angular-file-upload](https://github.com/nervgh/angular-file-upl
9
9
  Add this line to your application's Gemfile:
10
10
 
11
11
  ```ruby
12
- gem 'angularjs-file-upload-rails', '~> 2.2.0'
12
+ gem 'angularjs-file-upload-rails', '~> 2.4.1'
13
13
  ```
14
14
 
15
15
  And then execute:
@@ -42,9 +42,9 @@ read more about the options in [angular-file-upload-wiki](https://github.com/ner
42
42
  \* *assuming that you have setup an ```angularjs``` correctly in your rails app
43
43
 
44
44
  ```ruby
45
- gem 'angularjs-file-upload-rails', '~> 2.2.0'
45
+ gem 'angularjs-file-upload-rails', '~> 2.4.1'
46
46
  gem 'carrierwave'
47
- gem 'rails', '4.1.5'
47
+ gem 'rails', '4.2.5.1'
48
48
  ```
49
49
 
50
50
  Setup your carrierwave gem as discribed in the [carrierwave-readme](https://github.com/carrierwaveuploader/carrierwave)
@@ -1,5 +1,5 @@
1
1
  /*
2
- angular-file-upload v2.2.0
2
+ angular-file-upload v2.4.0
3
3
  https://github.com/nervgh/angular-file-upload
4
4
  */
5
5
 
@@ -59,35 +59,63 @@ return /******/ (function(modules) { // webpackBootstrap
59
59
  /* 0 */
60
60
  /***/ function(module, exports, __webpack_require__) {
61
61
 
62
- "use strict";
63
-
64
- var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
65
-
66
- var CONFIG = _interopRequire(__webpack_require__(1));
67
-
68
- var options = _interopRequire(__webpack_require__(2));
69
-
70
- var serviceFileUploader = _interopRequire(__webpack_require__(3));
71
-
72
- var serviceFileLikeObject = _interopRequire(__webpack_require__(4));
73
-
74
- var serviceFileItem = _interopRequire(__webpack_require__(5));
75
-
76
- var serviceFileDirective = _interopRequire(__webpack_require__(6));
77
-
78
- var serviceFileSelect = _interopRequire(__webpack_require__(7));
79
-
80
- var serviceFileDrop = _interopRequire(__webpack_require__(8));
81
-
82
- var serviceFileOver = _interopRequire(__webpack_require__(9));
83
-
84
- var directiveFileSelect = _interopRequire(__webpack_require__(10));
85
-
86
- var directiveFileDrop = _interopRequire(__webpack_require__(11));
87
-
88
- var directiveFileOver = _interopRequire(__webpack_require__(12));
89
-
90
- angular.module(CONFIG.name, []).value("fileUploaderOptions", options).factory("FileUploader", serviceFileUploader).factory("FileLikeObject", serviceFileLikeObject).factory("FileItem", serviceFileItem).factory("FileDirective", serviceFileDirective).factory("FileSelect", serviceFileSelect).factory("FileDrop", serviceFileDrop).factory("FileOver", serviceFileOver).directive("nvFileSelect", directiveFileSelect).directive("nvFileDrop", directiveFileDrop).directive("nvFileOver", directiveFileOver).run(["FileUploader", "FileLikeObject", "FileItem", "FileDirective", "FileSelect", "FileDrop", "FileOver", function (FileUploader, FileLikeObject, FileItem, FileDirective, FileSelect, FileDrop, FileOver) {
62
+ 'use strict';
63
+
64
+ var _config = __webpack_require__(1);
65
+
66
+ var _config2 = _interopRequireDefault(_config);
67
+
68
+ var _options = __webpack_require__(2);
69
+
70
+ var _options2 = _interopRequireDefault(_options);
71
+
72
+ var _FileUploader = __webpack_require__(3);
73
+
74
+ var _FileUploader2 = _interopRequireDefault(_FileUploader);
75
+
76
+ var _FileLikeObject = __webpack_require__(4);
77
+
78
+ var _FileLikeObject2 = _interopRequireDefault(_FileLikeObject);
79
+
80
+ var _FileItem = __webpack_require__(5);
81
+
82
+ var _FileItem2 = _interopRequireDefault(_FileItem);
83
+
84
+ var _FileDirective = __webpack_require__(6);
85
+
86
+ var _FileDirective2 = _interopRequireDefault(_FileDirective);
87
+
88
+ var _FileSelect = __webpack_require__(7);
89
+
90
+ var _FileSelect2 = _interopRequireDefault(_FileSelect);
91
+
92
+ var _Pipeline = __webpack_require__(8);
93
+
94
+ var _Pipeline2 = _interopRequireDefault(_Pipeline);
95
+
96
+ var _FileDrop = __webpack_require__(9);
97
+
98
+ var _FileDrop2 = _interopRequireDefault(_FileDrop);
99
+
100
+ var _FileOver = __webpack_require__(10);
101
+
102
+ var _FileOver2 = _interopRequireDefault(_FileOver);
103
+
104
+ var _FileSelect3 = __webpack_require__(11);
105
+
106
+ var _FileSelect4 = _interopRequireDefault(_FileSelect3);
107
+
108
+ var _FileDrop3 = __webpack_require__(12);
109
+
110
+ var _FileDrop4 = _interopRequireDefault(_FileDrop3);
111
+
112
+ var _FileOver3 = __webpack_require__(13);
113
+
114
+ var _FileOver4 = _interopRequireDefault(_FileOver3);
115
+
116
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
117
+
118
+ angular.module(_config2.default.name, []).value('fileUploaderOptions', _options2.default).factory('FileUploader', _FileUploader2.default).factory('FileLikeObject', _FileLikeObject2.default).factory('FileItem', _FileItem2.default).factory('FileDirective', _FileDirective2.default).factory('FileSelect', _FileSelect2.default).factory('FileDrop', _FileDrop2.default).factory('FileOver', _FileOver2.default).factory('Pipeline', _Pipeline2.default).directive('nvFileSelect', _FileSelect4.default).directive('nvFileDrop', _FileDrop4.default).directive('nvFileOver', _FileOver4.default).run(['FileUploader', 'FileLikeObject', 'FileItem', 'FileDirective', 'FileSelect', 'FileDrop', 'FileOver', 'Pipeline', function (FileUploader, FileLikeObject, FileItem, FileDirective, FileSelect, FileDrop, FileOver, Pipeline) {
91
119
  // only for compatibility
92
120
  FileUploader.FileLikeObject = FileLikeObject;
93
121
  FileUploader.FileItem = FileItem;
@@ -95,6 +123,7 @@ return /******/ (function(modules) { // webpackBootstrap
95
123
  FileUploader.FileSelect = FileSelect;
96
124
  FileUploader.FileDrop = FileDrop;
97
125
  FileUploader.FileOver = FileOver;
126
+ FileUploader.Pipeline = Pipeline;
98
127
  }]);
99
128
 
100
129
  /***/ },
@@ -109,51 +138,65 @@ return /******/ (function(modules) { // webpackBootstrap
109
138
  /* 2 */
110
139
  /***/ function(module, exports) {
111
140
 
112
- "use strict";
113
-
114
- module.exports = {
115
- url: "/",
116
- alias: "file",
141
+ 'use strict';
142
+
143
+ Object.defineProperty(exports, "__esModule", {
144
+ value: true
145
+ });
146
+ exports.default = {
147
+ url: '/',
148
+ alias: 'file',
117
149
  headers: {},
118
150
  queue: [],
119
151
  progress: 0,
120
152
  autoUpload: false,
121
153
  removeAfterUpload: false,
122
- method: "POST",
154
+ method: 'POST',
123
155
  filters: [],
124
156
  formData: [],
125
157
  queueLimit: Number.MAX_VALUE,
126
- withCredentials: false
158
+ withCredentials: false,
159
+ disableMultipart: false
127
160
  };
128
161
 
129
162
  /***/ },
130
163
  /* 3 */
131
164
  /***/ function(module, exports, __webpack_require__) {
132
165
 
133
- "use strict";
134
-
135
- var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
136
-
137
- var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
138
-
139
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
140
-
141
- var CONFIG = _interopRequire(__webpack_require__(1));
142
-
143
- var copy = angular.copy;
144
- var extend = angular.extend;
145
- var forEach = angular.forEach;
146
- var isObject = angular.isObject;
147
- var isNumber = angular.isNumber;
148
- var isDefined = angular.isDefined;
149
- var isArray = angular.isArray;
150
- var element = angular.element;
151
-
152
- module.exports = function (fileUploaderOptions, $rootScope, $http, $window, FileLikeObject, FileItem) {
166
+ 'use strict';
167
+
168
+ Object.defineProperty(exports, "__esModule", {
169
+ value: true
170
+ });
171
+
172
+ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
173
+
174
+ exports.default = __identity;
175
+
176
+ var _config = __webpack_require__(1);
177
+
178
+ var _config2 = _interopRequireDefault(_config);
179
+
180
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
181
+
182
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
183
+
184
+ var _angular = angular;
185
+ var bind = _angular.bind;
186
+ var copy = _angular.copy;
187
+ var extend = _angular.extend;
188
+ var forEach = _angular.forEach;
189
+ var isObject = _angular.isObject;
190
+ var isNumber = _angular.isNumber;
191
+ var isDefined = _angular.isDefined;
192
+ var isArray = _angular.isArray;
193
+ var isUndefined = _angular.isUndefined;
194
+ var element = _angular.element;
195
+ function __identity(fileUploaderOptions, $rootScope, $http, $window, $timeout, FileLikeObject, FileItem, Pipeline) {
153
196
  var File = $window.File;
154
197
  var FormData = $window.FormData;
155
-
156
- var FileUploader = (function () {
198
+
199
+ var FileUploader = function () {
157
200
  /**********************
158
201
  * PUBLIC
159
202
  **********************/
@@ -162,856 +205,840 @@ return /******/ (function(modules) { // webpackBootstrap
162
205
  * @param {Object} [options]
163
206
  * @constructor
164
207
  */
165
-
208
+
166
209
  function FileUploader(options) {
167
210
  _classCallCheck(this, FileUploader);
168
-
211
+
169
212
  var settings = copy(fileUploaderOptions);
170
-
213
+
171
214
  extend(this, settings, options, {
172
215
  isUploading: false,
173
216
  _nextIndex: 0,
174
- _failFilterIndex: -1,
175
217
  _directives: { select: [], drop: [], over: [] }
176
218
  });
177
-
219
+
178
220
  // add default filters
179
- this.filters.unshift({ name: "queueLimit", fn: this._queueLimitFilter });
180
- this.filters.unshift({ name: "folder", fn: this._folderFilter });
221
+ this.filters.unshift({ name: 'queueLimit', fn: this._queueLimitFilter });
222
+ this.filters.unshift({ name: 'folder', fn: this._folderFilter });
181
223
  }
182
-
183
- _createClass(FileUploader, {
184
- addToQueue: {
185
- /**
186
- * Adds items to the queue
187
- * @param {File|HTMLInputElement|Object|FileList|Array<Object>} files
188
- * @param {Object} [options]
189
- * @param {Array<Function>|String} filters
190
- */
191
-
192
- value: function addToQueue(files, options, filters) {
193
- var _this = this;
194
-
195
- var list = this.isArrayLikeObject(files) ? files : [files];
196
- var arrayOfFilters = this._getFilters(filters);
197
- var count = this.queue.length;
198
- var addedFileItems = [];
199
-
200
- forEach(list, function (some /*{File|HTMLInputElement|Object}*/) {
201
- var temp = new FileLikeObject(some);
202
-
203
- if (_this._isValidFile(temp, arrayOfFilters, options)) {
204
- var fileItem = new FileItem(_this, some, options);
205
- addedFileItems.push(fileItem);
206
- _this.queue.push(fileItem);
207
- _this._onAfterAddingFile(fileItem);
208
- } else {
209
- var filter = arrayOfFilters[_this._failFilterIndex];
210
- _this._onWhenAddingFileFailed(temp, filter, options);
211
- }
212
- });
213
-
214
- if (this.queue.length !== count) {
215
- this._onAfterAddingAll(addedFileItems);
216
- this.progress = this._getTotalProgress();
217
- }
218
-
219
- this._render();
220
- if (this.autoUpload) this.uploadAll();
221
- }
222
- },
223
- removeFromQueue: {
224
- /**
225
- * Remove items from the queue. Remove last: index = -1
226
- * @param {FileItem|Number} value
227
- */
228
-
229
- value: function removeFromQueue(value) {
230
- var index = this.getIndexOfItem(value);
231
- var item = this.queue[index];
232
- if (item.isUploading) item.cancel();
233
- this.queue.splice(index, 1);
234
- item._destroy();
235
- this.progress = this._getTotalProgress();
236
- }
237
- },
238
- clearQueue: {
239
- /**
240
- * Clears the queue
241
- */
242
-
243
- value: function clearQueue() {
244
- while (this.queue.length) {
245
- this.queue[0].remove();
246
- }
247
- this.progress = 0;
248
- }
249
- },
250
- uploadItem: {
251
- /**
252
- * Uploads a item from the queue
253
- * @param {FileItem|Number} value
254
- */
255
-
256
- value: function uploadItem(value) {
257
- var index = this.getIndexOfItem(value);
258
- var item = this.queue[index];
259
- var transport = this.isHTML5 ? "_xhrTransport" : "_iframeTransport";
260
-
261
- item._prepareToUploading();
262
- if (this.isUploading) {
263
- return;
264
- }this.isUploading = true;
265
- this[transport](item);
266
- }
267
- },
268
- cancelItem: {
269
- /**
270
- * Cancels uploading of item from the queue
271
- * @param {FileItem|Number} value
272
- */
273
-
274
- value: function cancelItem(value) {
275
- var index = this.getIndexOfItem(value);
276
- var item = this.queue[index];
277
- var prop = this.isHTML5 ? "_xhr" : "_form";
278
- if (item && item.isUploading) item[prop].abort();
279
- }
280
- },
281
- uploadAll: {
282
- /**
283
- * Uploads all not uploaded items of queue
284
- */
285
-
286
- value: function uploadAll() {
287
- var items = this.getNotUploadedItems().filter(function (item) {
288
- return !item.isUploading;
289
- });
290
- if (!items.length) {
291
- return;
292
- }forEach(items, function (item) {
293
- return item._prepareToUploading();
294
- });
295
- items[0].upload();
296
- }
297
- },
298
- cancelAll: {
299
- /**
300
- * Cancels all uploads
301
- */
302
-
303
- value: function cancelAll() {
304
- var items = this.getNotUploadedItems();
305
- forEach(items, function (item) {
306
- return item.cancel();
307
- });
308
- }
309
- },
310
- isFile: {
311
- /**
312
- * Returns "true" if value an instance of File
313
- * @param {*} value
314
- * @returns {Boolean}
315
- * @private
316
- */
317
-
318
- value: function isFile(value) {
319
- return this.constructor.isFile(value);
320
- }
321
- },
322
- isFileLikeObject: {
323
- /**
324
- * Returns "true" if value an instance of FileLikeObject
325
- * @param {*} value
326
- * @returns {Boolean}
327
- * @private
328
- */
329
-
330
- value: function isFileLikeObject(value) {
331
- return this.constructor.isFileLikeObject(value);
332
- }
333
- },
334
- isArrayLikeObject: {
335
- /**
336
- * Returns "true" if value is array like object
337
- * @param {*} value
338
- * @returns {Boolean}
339
- */
340
-
341
- value: function isArrayLikeObject(value) {
342
- return this.constructor.isArrayLikeObject(value);
343
- }
344
- },
345
- getIndexOfItem: {
346
- /**
347
- * Returns a index of item from the queue
348
- * @param {Item|Number} value
349
- * @returns {Number}
350
- */
351
-
352
- value: function getIndexOfItem(value) {
353
- return isNumber(value) ? value : this.queue.indexOf(value);
354
- }
355
- },
356
- getNotUploadedItems: {
357
- /**
358
- * Returns not uploaded items
359
- * @returns {Array}
360
- */
361
-
362
- value: function getNotUploadedItems() {
363
- return this.queue.filter(function (item) {
364
- return !item.isUploaded;
365
- });
366
- }
367
- },
368
- getReadyItems: {
369
- /**
370
- * Returns items ready for upload
371
- * @returns {Array}
372
- */
373
-
374
- value: function getReadyItems() {
375
- return this.queue.filter(function (item) {
376
- return item.isReady && !item.isUploading;
377
- }).sort(function (item1, item2) {
378
- return item1.index - item2.index;
379
- });
380
- }
381
- },
382
- destroy: {
383
- /**
384
- * Destroys instance of FileUploader
385
- */
386
-
387
- value: function destroy() {
388
- var _this = this;
389
-
390
- forEach(this._directives, function (key) {
391
- forEach(_this._directives[key], function (object) {
392
- object.destroy();
393
- });
394
- });
395
- }
396
- },
397
- onAfterAddingAll: {
398
- /**
399
- * Callback
400
- * @param {Array} fileItems
401
- */
402
-
403
- value: function onAfterAddingAll(fileItems) {}
404
- },
405
- onAfterAddingFile: {
406
- /**
407
- * Callback
408
- * @param {FileItem} fileItem
409
- */
410
-
411
- value: function onAfterAddingFile(fileItem) {}
412
- },
413
- onWhenAddingFileFailed: {
414
- /**
415
- * Callback
416
- * @param {File|Object} item
417
- * @param {Object} filter
418
- * @param {Object} options
419
- */
420
-
421
- value: function onWhenAddingFileFailed(item, filter, options) {}
422
- },
423
- onBeforeUploadItem: {
424
- /**
425
- * Callback
426
- * @param {FileItem} fileItem
427
- */
428
-
429
- value: function onBeforeUploadItem(fileItem) {}
430
- },
431
- onProgressItem: {
432
- /**
433
- * Callback
434
- * @param {FileItem} fileItem
435
- * @param {Number} progress
436
- */
437
-
438
- value: function onProgressItem(fileItem, progress) {}
439
- },
440
- onProgressAll: {
441
- /**
442
- * Callback
443
- * @param {Number} progress
444
- */
445
-
446
- value: function onProgressAll(progress) {}
447
- },
448
- onSuccessItem: {
449
- /**
450
- * Callback
451
- * @param {FileItem} item
452
- * @param {*} response
453
- * @param {Number} status
454
- * @param {Object} headers
455
- */
456
-
457
- value: function onSuccessItem(item, response, status, headers) {}
458
- },
459
- onErrorItem: {
460
- /**
461
- * Callback
462
- * @param {FileItem} item
463
- * @param {*} response
464
- * @param {Number} status
465
- * @param {Object} headers
466
- */
467
-
468
- value: function onErrorItem(item, response, status, headers) {}
469
- },
470
- onCancelItem: {
471
- /**
472
- * Callback
473
- * @param {FileItem} item
474
- * @param {*} response
475
- * @param {Number} status
476
- * @param {Object} headers
477
- */
478
-
479
- value: function onCancelItem(item, response, status, headers) {}
480
- },
481
- onCompleteItem: {
482
- /**
483
- * Callback
484
- * @param {FileItem} item
485
- * @param {*} response
486
- * @param {Number} status
487
- * @param {Object} headers
488
- */
489
-
490
- value: function onCompleteItem(item, response, status, headers) {}
491
- },
492
- onCompleteAll: {
493
- /**
494
- * Callback
495
- */
496
-
497
- value: function onCompleteAll() {}
498
- },
499
- _getTotalProgress: {
500
- /**********************
501
- * PRIVATE
502
- **********************/
503
- /**
504
- * Returns the total progress
505
- * @param {Number} [value]
506
- * @returns {Number}
507
- * @private
508
- */
509
-
510
- value: function _getTotalProgress(value) {
511
- if (this.removeAfterUpload) {
512
- return value || 0;
513
- }var notUploaded = this.getNotUploadedItems().length;
514
- var uploaded = notUploaded ? this.queue.length - notUploaded : this.queue.length;
515
- var ratio = 100 / this.queue.length;
516
- var current = (value || 0) * ratio / 100;
517
-
518
- return Math.round(uploaded * ratio + current);
519
- }
520
- },
521
- _getFilters: {
522
- /**
523
- * Returns array of filters
524
- * @param {Array<Function>|String} filters
525
- * @returns {Array<Function>}
526
- * @private
527
- */
528
-
529
- value: function _getFilters(filters) {
530
- if (!filters) {
531
- return this.filters;
532
- }if (isArray(filters)) {
533
- return filters;
534
- }var names = filters.match(/[^\s,]+/g);
535
- return this.filters.filter(function (filter) {
536
- return names.indexOf(filter.name) !== -1;
537
- });
538
- }
539
- },
540
- _render: {
541
- /**
542
- * Updates html
543
- * @private
544
- */
545
-
546
- value: function _render() {
547
- if (!$rootScope.$$phase) $rootScope.$apply();
548
- }
549
- },
550
- _folderFilter: {
551
- /**
552
- * Returns "true" if item is a file (not folder)
553
- * @param {File|FileLikeObject} item
554
- * @returns {Boolean}
555
- * @private
556
- */
557
-
558
- value: function _folderFilter(item) {
559
- return !!(item.size || item.type);
560
- }
561
- },
562
- _queueLimitFilter: {
563
- /**
564
- * Returns "true" if the limit has not been reached
565
- * @returns {Boolean}
566
- * @private
567
- */
568
-
569
- value: function _queueLimitFilter() {
570
- return this.queue.length < this.queueLimit;
571
- }
572
- },
573
- _isValidFile: {
574
- /**
575
- * Returns "true" if file pass all filters
576
- * @param {File|Object} file
577
- * @param {Array<Function>} filters
578
- * @param {Object} options
579
- * @returns {Boolean}
580
- * @private
581
- */
582
-
583
- value: function _isValidFile(file, filters, options) {
584
- var _this = this;
585
-
586
- this._failFilterIndex = -1;
587
- return !filters.length ? true : filters.every(function (filter) {
588
- _this._failFilterIndex++;
589
- return filter.fn.call(_this, file, options);
590
- });
591
- }
592
- },
593
- _isSuccessCode: {
594
- /**
595
- * Checks whether upload successful
596
- * @param {Number} status
597
- * @returns {Boolean}
598
- * @private
599
- */
600
-
601
- value: function _isSuccessCode(status) {
602
- return status >= 200 && status < 300 || status === 304;
603
- }
604
- },
605
- _transformResponse: {
606
- /**
607
- * Transforms the server response
608
- * @param {*} response
609
- * @param {Object} headers
610
- * @returns {*}
611
- * @private
612
- */
613
-
614
- value: function _transformResponse(response, headers) {
615
- var headersGetter = this._headersGetter(headers);
616
- forEach($http.defaults.transformResponse, function (transformFn) {
617
- response = transformFn(response, headersGetter);
618
- });
619
- return response;
620
- }
621
- },
622
- _parseHeaders: {
623
- /**
624
- * Parsed response headers
625
- * @param headers
626
- * @returns {Object}
627
- * @see https://github.com/angular/angular.js/blob/master/src/ng/http.js
628
- * @private
629
- */
630
-
631
- value: function _parseHeaders(headers) {
632
- var parsed = {},
633
- key,
634
- val,
635
- i;
636
-
637
- if (!headers) {
638
- return parsed;
639
- }forEach(headers.split("\n"), function (line) {
640
- i = line.indexOf(":");
641
- key = line.slice(0, i).trim().toLowerCase();
642
- val = line.slice(i + 1).trim();
643
-
644
- if (key) {
645
- parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
646
- }
647
- });
648
-
649
- return parsed;
650
- }
651
- },
652
- _headersGetter: {
653
- /**
654
- * Returns function that returns headers
655
- * @param {Object} parsedHeaders
656
- * @returns {Function}
657
- * @private
658
- */
659
-
660
- value: function _headersGetter(parsedHeaders) {
661
- return function (name) {
662
- if (name) {
663
- return parsedHeaders[name.toLowerCase()] || null;
664
- }
665
- return parsedHeaders;
666
- };
667
- }
668
- },
669
- _xhrTransport: {
670
- /**
671
- * The XMLHttpRequest transport
672
- * @param {FileItem} item
673
- * @private
674
- */
675
-
676
- value: function _xhrTransport(item) {
677
- var _this = this;
678
-
679
- var xhr = item._xhr = new XMLHttpRequest();
680
- var form = new FormData();
681
-
682
- this._onBeforeUploadItem(item);
683
-
684
- forEach(item.formData, function (obj) {
685
- forEach(obj, function (value, key) {
686
- form.append(key, value);
687
- });
688
- });
689
-
690
- if (typeof item._file.size != "number") {
691
- throw new TypeError("The file specified is no longer valid");
692
- }
693
-
694
- form.append(item.alias, item._file, item.file.name);
695
-
696
- xhr.upload.onprogress = function (event) {
697
- var progress = Math.round(event.lengthComputable ? event.loaded * 100 / event.total : 0);
698
- _this._onProgressItem(item, progress);
699
- };
700
-
701
- xhr.onload = function () {
702
- var headers = _this._parseHeaders(xhr.getAllResponseHeaders());
703
- var response = _this._transformResponse(xhr.response, headers);
704
- var gist = _this._isSuccessCode(xhr.status) ? "Success" : "Error";
705
- var method = "_on" + gist + "Item";
706
- _this[method](item, response, xhr.status, headers);
707
- _this._onCompleteItem(item, response, xhr.status, headers);
708
- };
709
-
710
- xhr.onerror = function () {
711
- var headers = _this._parseHeaders(xhr.getAllResponseHeaders());
712
- var response = _this._transformResponse(xhr.response, headers);
713
- _this._onErrorItem(item, response, xhr.status, headers);
714
- _this._onCompleteItem(item, response, xhr.status, headers);
715
- };
716
-
717
- xhr.onabort = function () {
718
- var headers = _this._parseHeaders(xhr.getAllResponseHeaders());
719
- var response = _this._transformResponse(xhr.response, headers);
720
- _this._onCancelItem(item, response, xhr.status, headers);
721
- _this._onCompleteItem(item, response, xhr.status, headers);
224
+ /**
225
+ * Adds items to the queue
226
+ * @param {File|HTMLInputElement|Object|FileList|Array<Object>} files
227
+ * @param {Object} [options]
228
+ * @param {Array<Function>|String} filters
229
+ */
230
+
231
+
232
+ FileUploader.prototype.addToQueue = function addToQueue(files, options, filters) {
233
+ var _this = this;
234
+
235
+ var incomingQueue = this.isArrayLikeObject(files) ? Array.prototype.slice.call(files) : [files];
236
+ var arrayOfFilters = this._getFilters(filters);
237
+ var count = this.queue.length;
238
+ var addedFileItems = [];
239
+
240
+ var next = function next() {
241
+ var something = incomingQueue.shift();
242
+
243
+ if (isUndefined(something)) {
244
+ return done();
245
+ }
246
+
247
+ var fileLikeObject = _this.isFile(something) ? something : new FileLikeObject(something);
248
+ var pipes = _this._convertFiltersToPipes(arrayOfFilters);
249
+ var pipeline = new Pipeline(pipes);
250
+ var onThrown = function onThrown(err) {
251
+ var originalFilter = err.pipe.originalFilter;
252
+
253
+ var _err$args = _slicedToArray(err.args, 2);
254
+
255
+ var fileLikeObject = _err$args[0];
256
+ var options = _err$args[1];
257
+
258
+ _this._onWhenAddingFileFailed(fileLikeObject, originalFilter, options);
259
+ next();
260
+ };
261
+ var onSuccessful = function onSuccessful(fileLikeObject, options) {
262
+ var fileItem = new FileItem(_this, fileLikeObject, options);
263
+ addedFileItems.push(fileItem);
264
+ _this.queue.push(fileItem);
265
+ _this._onAfterAddingFile(fileItem);
266
+ next();
267
+ };
268
+ pipeline.onThrown = onThrown;
269
+ pipeline.onSuccessful = onSuccessful;
270
+ pipeline.exec(fileLikeObject, options);
271
+ };
272
+
273
+ var done = function done() {
274
+ if (_this.queue.length !== count) {
275
+ _this._onAfterAddingAll(addedFileItems);
276
+ _this.progress = _this._getTotalProgress();
277
+ }
278
+
279
+ _this._render();
280
+ if (_this.autoUpload) _this.uploadAll();
281
+ };
282
+
283
+ next();
284
+ };
285
+ /**
286
+ * Remove items from the queue. Remove last: index = -1
287
+ * @param {FileItem|Number} value
288
+ */
289
+
290
+
291
+ FileUploader.prototype.removeFromQueue = function removeFromQueue(value) {
292
+ var index = this.getIndexOfItem(value);
293
+ var item = this.queue[index];
294
+ if (item.isUploading) item.cancel();
295
+ this.queue.splice(index, 1);
296
+ item._destroy();
297
+ this.progress = this._getTotalProgress();
298
+ };
299
+ /**
300
+ * Clears the queue
301
+ */
302
+
303
+
304
+ FileUploader.prototype.clearQueue = function clearQueue() {
305
+ while (this.queue.length) {
306
+ this.queue[0].remove();
307
+ }
308
+ this.progress = 0;
309
+ };
310
+ /**
311
+ * Uploads a item from the queue
312
+ * @param {FileItem|Number} value
313
+ */
314
+
315
+
316
+ FileUploader.prototype.uploadItem = function uploadItem(value) {
317
+ var index = this.getIndexOfItem(value);
318
+ var item = this.queue[index];
319
+ var transport = this.isHTML5 ? '_xhrTransport' : '_iframeTransport';
320
+
321
+ item._prepareToUploading();
322
+ if (this.isUploading) return;
323
+
324
+ this._onBeforeUploadItem(item);
325
+ if (item.isCancel) return;
326
+
327
+ item.isUploading = true;
328
+ this.isUploading = true;
329
+ this[transport](item);
330
+ this._render();
331
+ };
332
+ /**
333
+ * Cancels uploading of item from the queue
334
+ * @param {FileItem|Number} value
335
+ */
336
+
337
+
338
+ FileUploader.prototype.cancelItem = function cancelItem(value) {
339
+ var _this2 = this;
340
+
341
+ var index = this.getIndexOfItem(value);
342
+ var item = this.queue[index];
343
+ var prop = this.isHTML5 ? '_xhr' : '_form';
344
+ if (!item) return;
345
+ item.isCancel = true;
346
+ if (item.isUploading) {
347
+ // It will call this._onCancelItem() & this._onCompleteItem() asynchronously
348
+ item[prop].abort();
349
+ } else {
350
+ (function () {
351
+ var dummy = [undefined, 0, {}];
352
+ var onNextTick = function onNextTick() {
353
+ _this2._onCancelItem.apply(_this2, [item].concat(dummy));
354
+ _this2._onCompleteItem.apply(_this2, [item].concat(dummy));
722
355
  };
723
-
724
- xhr.open(item.method, item.url, true);
725
-
726
- xhr.withCredentials = item.withCredentials;
727
-
728
- forEach(item.headers, function (value, name) {
729
- xhr.setRequestHeader(name, value);
730
- });
731
-
732
- xhr.send(form);
733
- this._render();
356
+ $timeout(onNextTick); // Trigger callbacks asynchronously (setImmediate emulation)
357
+ })();
358
+ }
359
+ };
360
+ /**
361
+ * Uploads all not uploaded items of queue
362
+ */
363
+
364
+
365
+ FileUploader.prototype.uploadAll = function uploadAll() {
366
+ var items = this.getNotUploadedItems().filter(function (item) {
367
+ return !item.isUploading;
368
+ });
369
+ if (!items.length) return;
370
+
371
+ forEach(items, function (item) {
372
+ return item._prepareToUploading();
373
+ });
374
+ items[0].upload();
375
+ };
376
+ /**
377
+ * Cancels all uploads
378
+ */
379
+
380
+
381
+ FileUploader.prototype.cancelAll = function cancelAll() {
382
+ var items = this.getNotUploadedItems();
383
+ forEach(items, function (item) {
384
+ return item.cancel();
385
+ });
386
+ };
387
+ /**
388
+ * Returns "true" if value an instance of File
389
+ * @param {*} value
390
+ * @returns {Boolean}
391
+ * @private
392
+ */
393
+
394
+
395
+ FileUploader.prototype.isFile = function isFile(value) {
396
+ return this.constructor.isFile(value);
397
+ };
398
+ /**
399
+ * Returns "true" if value an instance of FileLikeObject
400
+ * @param {*} value
401
+ * @returns {Boolean}
402
+ * @private
403
+ */
404
+
405
+
406
+ FileUploader.prototype.isFileLikeObject = function isFileLikeObject(value) {
407
+ return this.constructor.isFileLikeObject(value);
408
+ };
409
+ /**
410
+ * Returns "true" if value is array like object
411
+ * @param {*} value
412
+ * @returns {Boolean}
413
+ */
414
+
415
+
416
+ FileUploader.prototype.isArrayLikeObject = function isArrayLikeObject(value) {
417
+ return this.constructor.isArrayLikeObject(value);
418
+ };
419
+ /**
420
+ * Returns a index of item from the queue
421
+ * @param {Item|Number} value
422
+ * @returns {Number}
423
+ */
424
+
425
+
426
+ FileUploader.prototype.getIndexOfItem = function getIndexOfItem(value) {
427
+ return isNumber(value) ? value : this.queue.indexOf(value);
428
+ };
429
+ /**
430
+ * Returns not uploaded items
431
+ * @returns {Array}
432
+ */
433
+
434
+
435
+ FileUploader.prototype.getNotUploadedItems = function getNotUploadedItems() {
436
+ return this.queue.filter(function (item) {
437
+ return !item.isUploaded;
438
+ });
439
+ };
440
+ /**
441
+ * Returns items ready for upload
442
+ * @returns {Array}
443
+ */
444
+
445
+
446
+ FileUploader.prototype.getReadyItems = function getReadyItems() {
447
+ return this.queue.filter(function (item) {
448
+ return item.isReady && !item.isUploading;
449
+ }).sort(function (item1, item2) {
450
+ return item1.index - item2.index;
451
+ });
452
+ };
453
+ /**
454
+ * Destroys instance of FileUploader
455
+ */
456
+
457
+
458
+ FileUploader.prototype.destroy = function destroy() {
459
+ var _this3 = this;
460
+
461
+ forEach(this._directives, function (key) {
462
+ forEach(_this3._directives[key], function (object) {
463
+ object.destroy();
464
+ });
465
+ });
466
+ };
467
+ /**
468
+ * Callback
469
+ * @param {Array} fileItems
470
+ */
471
+
472
+
473
+ FileUploader.prototype.onAfterAddingAll = function onAfterAddingAll(fileItems) {};
474
+ /**
475
+ * Callback
476
+ * @param {FileItem} fileItem
477
+ */
478
+
479
+
480
+ FileUploader.prototype.onAfterAddingFile = function onAfterAddingFile(fileItem) {};
481
+ /**
482
+ * Callback
483
+ * @param {File|Object} item
484
+ * @param {Object} filter
485
+ * @param {Object} options
486
+ */
487
+
488
+
489
+ FileUploader.prototype.onWhenAddingFileFailed = function onWhenAddingFileFailed(item, filter, options) {};
490
+ /**
491
+ * Callback
492
+ * @param {FileItem} fileItem
493
+ */
494
+
495
+
496
+ FileUploader.prototype.onBeforeUploadItem = function onBeforeUploadItem(fileItem) {};
497
+ /**
498
+ * Callback
499
+ * @param {FileItem} fileItem
500
+ * @param {Number} progress
501
+ */
502
+
503
+
504
+ FileUploader.prototype.onProgressItem = function onProgressItem(fileItem, progress) {};
505
+ /**
506
+ * Callback
507
+ * @param {Number} progress
508
+ */
509
+
510
+
511
+ FileUploader.prototype.onProgressAll = function onProgressAll(progress) {};
512
+ /**
513
+ * Callback
514
+ * @param {FileItem} item
515
+ * @param {*} response
516
+ * @param {Number} status
517
+ * @param {Object} headers
518
+ */
519
+
520
+
521
+ FileUploader.prototype.onSuccessItem = function onSuccessItem(item, response, status, headers) {};
522
+ /**
523
+ * Callback
524
+ * @param {FileItem} item
525
+ * @param {*} response
526
+ * @param {Number} status
527
+ * @param {Object} headers
528
+ */
529
+
530
+
531
+ FileUploader.prototype.onErrorItem = function onErrorItem(item, response, status, headers) {};
532
+ /**
533
+ * Callback
534
+ * @param {FileItem} item
535
+ * @param {*} response
536
+ * @param {Number} status
537
+ * @param {Object} headers
538
+ */
539
+
540
+
541
+ FileUploader.prototype.onCancelItem = function onCancelItem(item, response, status, headers) {};
542
+ /**
543
+ * Callback
544
+ * @param {FileItem} item
545
+ * @param {*} response
546
+ * @param {Number} status
547
+ * @param {Object} headers
548
+ */
549
+
550
+
551
+ FileUploader.prototype.onCompleteItem = function onCompleteItem(item, response, status, headers) {};
552
+ /**
553
+ * Callback
554
+ */
555
+
556
+
557
+ FileUploader.prototype.onCompleteAll = function onCompleteAll() {};
558
+ /**********************
559
+ * PRIVATE
560
+ **********************/
561
+ /**
562
+ * Returns the total progress
563
+ * @param {Number} [value]
564
+ * @returns {Number}
565
+ * @private
566
+ */
567
+
568
+
569
+ FileUploader.prototype._getTotalProgress = function _getTotalProgress(value) {
570
+ if (this.removeAfterUpload) return value || 0;
571
+
572
+ var notUploaded = this.getNotUploadedItems().length;
573
+ var uploaded = notUploaded ? this.queue.length - notUploaded : this.queue.length;
574
+ var ratio = 100 / this.queue.length;
575
+ var current = (value || 0) * ratio / 100;
576
+
577
+ return Math.round(uploaded * ratio + current);
578
+ };
579
+ /**
580
+ * Returns array of filters
581
+ * @param {Array<Function>|String} filters
582
+ * @returns {Array<Function>}
583
+ * @private
584
+ */
585
+
586
+
587
+ FileUploader.prototype._getFilters = function _getFilters(filters) {
588
+ if (!filters) return this.filters;
589
+ if (isArray(filters)) return filters;
590
+ var names = filters.match(/[^\s,]+/g);
591
+ return this.filters.filter(function (filter) {
592
+ return names.indexOf(filter.name) !== -1;
593
+ });
594
+ };
595
+ /**
596
+ * @param {Array<Function>} filters
597
+ * @returns {Array<Function>}
598
+ * @private
599
+ */
600
+
601
+
602
+ FileUploader.prototype._convertFiltersToPipes = function _convertFiltersToPipes(filters) {
603
+ var _this4 = this;
604
+
605
+ return filters.map(function (filter) {
606
+ var fn = bind(_this4, filter.fn);
607
+ fn.isAsync = filter.fn.length === 3;
608
+ fn.originalFilter = filter;
609
+ return fn;
610
+ });
611
+ };
612
+ /**
613
+ * Updates html
614
+ * @private
615
+ */
616
+
617
+
618
+ FileUploader.prototype._render = function _render() {
619
+ if (!$rootScope.$$phase) $rootScope.$apply();
620
+ };
621
+ /**
622
+ * Returns "true" if item is a file (not folder)
623
+ * @param {File|FileLikeObject} item
624
+ * @returns {Boolean}
625
+ * @private
626
+ */
627
+
628
+
629
+ FileUploader.prototype._folderFilter = function _folderFilter(item) {
630
+ return !!(item.size || item.type);
631
+ };
632
+ /**
633
+ * Returns "true" if the limit has not been reached
634
+ * @returns {Boolean}
635
+ * @private
636
+ */
637
+
638
+
639
+ FileUploader.prototype._queueLimitFilter = function _queueLimitFilter() {
640
+ return this.queue.length < this.queueLimit;
641
+ };
642
+ /**
643
+ * Checks whether upload successful
644
+ * @param {Number} status
645
+ * @returns {Boolean}
646
+ * @private
647
+ */
648
+
649
+
650
+ FileUploader.prototype._isSuccessCode = function _isSuccessCode(status) {
651
+ return status >= 200 && status < 300 || status === 304;
652
+ };
653
+ /**
654
+ * Transforms the server response
655
+ * @param {*} response
656
+ * @param {Object} headers
657
+ * @returns {*}
658
+ * @private
659
+ */
660
+
661
+
662
+ FileUploader.prototype._transformResponse = function _transformResponse(response, headers) {
663
+ var headersGetter = this._headersGetter(headers);
664
+ forEach($http.defaults.transformResponse, function (transformFn) {
665
+ response = transformFn(response, headersGetter);
666
+ });
667
+ return response;
668
+ };
669
+ /**
670
+ * Parsed response headers
671
+ * @param headers
672
+ * @returns {Object}
673
+ * @see https://github.com/angular/angular.js/blob/master/src/ng/http.js
674
+ * @private
675
+ */
676
+
677
+
678
+ FileUploader.prototype._parseHeaders = function _parseHeaders(headers) {
679
+ var parsed = {},
680
+ key,
681
+ val,
682
+ i;
683
+
684
+ if (!headers) return parsed;
685
+
686
+ forEach(headers.split('\n'), function (line) {
687
+ i = line.indexOf(':');
688
+ key = line.slice(0, i).trim().toLowerCase();
689
+ val = line.slice(i + 1).trim();
690
+
691
+ if (key) {
692
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
734
693
  }
735
- },
736
- _iframeTransport: {
737
- /**
738
- * The IFrame transport
739
- * @param {FileItem} item
740
- * @private
741
- */
742
-
743
- value: function _iframeTransport(item) {
744
- var _this = this;
745
-
746
- var form = element("<form style=\"display: none;\" />");
747
- var iframe = element("<iframe name=\"iframeTransport" + Date.now() + "\">");
748
- var input = item._input;
749
-
750
- if (item._form) item._form.replaceWith(input); // remove old form
751
- item._form = form; // save link to new form
752
-
753
- this._onBeforeUploadItem(item);
754
-
755
- input.prop("name", item.alias);
756
-
757
- forEach(item.formData, function (obj) {
758
- forEach(obj, function (value, key) {
759
- var element_ = element("<input type=\"hidden\" name=\"" + key + "\" />");
760
- element_.val(value);
761
- form.append(element_);
762
- });
763
- });
764
-
765
- form.prop({
766
- action: item.url,
767
- method: "POST",
768
- target: iframe.prop("name"),
769
- enctype: "multipart/form-data",
770
- encoding: "multipart/form-data" // old IE
771
- });
772
-
773
- iframe.bind("load", function () {
774
- var html = "";
775
- var status = 200;
776
-
777
- try {
778
- // Fix for legacy IE browsers that loads internal error page
779
- // when failed WS response received. In consequence iframe
780
- // content access denied error is thrown becouse trying to
781
- // access cross domain page. When such thing occurs notifying
782
- // with empty response object. See more info at:
783
- // http://stackoverflow.com/questions/151362/access-is-denied-error-on-accessing-iframe-document-object
784
- // Note that if non standard 4xx or 5xx error code returned
785
- // from WS then response content can be accessed without error
786
- // but 'XHR' status becomes 200. In order to avoid confusion
787
- // returning response via same 'success' event handler.
788
-
789
- // fixed angular.contents() for iframes
790
- html = iframe[0].contentDocument.body.innerHTML;
791
- } catch (e) {
792
- // in case we run into the access-is-denied error or we have another error on the server side
793
- // (intentional 500,40... errors), we at least say 'something went wrong' -> 500
794
- status = 500;
795
- }
796
-
797
- var xhr = { response: html, status: status, dummy: true };
798
- var headers = {};
799
- var response = _this._transformResponse(xhr.response, headers);
800
-
801
- _this._onSuccessItem(item, response, xhr.status, headers);
802
- _this._onCompleteItem(item, response, xhr.status, headers);
694
+ });
695
+
696
+ return parsed;
697
+ };
698
+ /**
699
+ * Returns function that returns headers
700
+ * @param {Object} parsedHeaders
701
+ * @returns {Function}
702
+ * @private
703
+ */
704
+
705
+
706
+ FileUploader.prototype._headersGetter = function _headersGetter(parsedHeaders) {
707
+ return function (name) {
708
+ if (name) {
709
+ return parsedHeaders[name.toLowerCase()] || null;
710
+ }
711
+ return parsedHeaders;
712
+ };
713
+ };
714
+ /**
715
+ * The XMLHttpRequest transport
716
+ * @param {FileItem} item
717
+ * @private
718
+ */
719
+
720
+
721
+ FileUploader.prototype._xhrTransport = function _xhrTransport(item) {
722
+ var _this5 = this;
723
+
724
+ var xhr = item._xhr = new XMLHttpRequest();
725
+ var sendable;
726
+
727
+ if (!item.disableMultipart) {
728
+ sendable = new FormData();
729
+ forEach(item.formData, function (obj) {
730
+ forEach(obj, function (value, key) {
731
+ sendable.append(key, value);
803
732
  });
804
-
805
- form.abort = function () {
806
- var xhr = { status: 0, dummy: true };
807
- var headers = {};
808
- var response;
809
-
810
- iframe.unbind("load").prop("src", "javascript:false;");
811
- form.replaceWith(input);
812
-
813
- _this._onCancelItem(item, response, xhr.status, headers);
814
- _this._onCompleteItem(item, response, xhr.status, headers);
815
- };
816
-
817
- input.after(form);
818
- form.append(input).append(iframe);
819
-
820
- form[0].submit();
821
- this._render();
822
- }
823
- },
824
- _onWhenAddingFileFailed: {
825
- /**
826
- * Inner callback
827
- * @param {File|Object} item
828
- * @param {Object} filter
829
- * @param {Object} options
830
- * @private
831
- */
832
-
833
- value: function _onWhenAddingFileFailed(item, filter, options) {
834
- this.onWhenAddingFileFailed(item, filter, options);
835
- }
836
- },
837
- _onAfterAddingFile: {
838
- /**
839
- * Inner callback
840
- * @param {FileItem} item
841
- */
842
-
843
- value: function _onAfterAddingFile(item) {
844
- this.onAfterAddingFile(item);
845
- }
846
- },
847
- _onAfterAddingAll: {
848
- /**
849
- * Inner callback
850
- * @param {Array<FileItem>} items
851
- */
852
-
853
- value: function _onAfterAddingAll(items) {
854
- this.onAfterAddingAll(items);
855
- }
856
- },
857
- _onBeforeUploadItem: {
858
- /**
859
- * Inner callback
860
- * @param {FileItem} item
861
- * @private
862
- */
863
-
864
- value: function _onBeforeUploadItem(item) {
865
- item._onBeforeUpload();
866
- this.onBeforeUploadItem(item);
867
- }
868
- },
869
- _onProgressItem: {
870
- /**
871
- * Inner callback
872
- * @param {FileItem} item
873
- * @param {Number} progress
874
- * @private
875
- */
876
-
877
- value: function _onProgressItem(item, progress) {
878
- var total = this._getTotalProgress(progress);
879
- this.progress = total;
880
- item._onProgress(progress);
881
- this.onProgressItem(item, progress);
882
- this.onProgressAll(total);
883
- this._render();
884
- }
885
- },
886
- _onSuccessItem: {
887
- /**
888
- * Inner callback
889
- * @param {FileItem} item
890
- * @param {*} response
891
- * @param {Number} status
892
- * @param {Object} headers
893
- * @private
894
- */
895
-
896
- value: function _onSuccessItem(item, response, status, headers) {
897
- item._onSuccess(response, status, headers);
898
- this.onSuccessItem(item, response, status, headers);
899
- }
900
- },
901
- _onErrorItem: {
902
- /**
903
- * Inner callback
904
- * @param {FileItem} item
905
- * @param {*} response
906
- * @param {Number} status
907
- * @param {Object} headers
908
- * @private
909
- */
910
-
911
- value: function _onErrorItem(item, response, status, headers) {
912
- item._onError(response, status, headers);
913
- this.onErrorItem(item, response, status, headers);
914
- }
915
- },
916
- _onCancelItem: {
917
- /**
918
- * Inner callback
919
- * @param {FileItem} item
920
- * @param {*} response
921
- * @param {Number} status
922
- * @param {Object} headers
923
- * @private
924
- */
925
-
926
- value: function _onCancelItem(item, response, status, headers) {
927
- item._onCancel(response, status, headers);
928
- this.onCancelItem(item, response, status, headers);
929
- }
930
- },
931
- _onCompleteItem: {
932
- /**
933
- * Inner callback
934
- * @param {FileItem} item
935
- * @param {*} response
936
- * @param {Number} status
937
- * @param {Object} headers
938
- * @private
939
- */
940
-
941
- value: function _onCompleteItem(item, response, status, headers) {
942
- item._onComplete(response, status, headers);
943
- this.onCompleteItem(item, response, status, headers);
944
-
945
- var nextItem = this.getReadyItems()[0];
946
- this.isUploading = false;
947
-
948
- if (isDefined(nextItem)) {
949
- nextItem.upload();
950
- return;
951
- }
952
-
953
- this.onCompleteAll();
954
- this.progress = this._getTotalProgress();
955
- this._render();
956
- }
733
+ });
734
+
735
+ sendable.append(item.alias, item._file, item.file.name);
736
+ } else {
737
+ sendable = item._file;
957
738
  }
958
- }, {
959
- isFile: {
960
- /**********************
961
- * STATIC
962
- **********************/
963
- /**
964
- * Returns "true" if value an instance of File
965
- * @param {*} value
966
- * @returns {Boolean}
967
- * @private
968
- */
969
-
970
- value: function isFile(value) {
971
- return File && value instanceof File;
972
- }
973
- },
974
- isFileLikeObject: {
975
- /**
976
- * Returns "true" if value an instance of FileLikeObject
977
- * @param {*} value
978
- * @returns {Boolean}
979
- * @private
980
- */
981
-
982
- value: function isFileLikeObject(value) {
983
- return value instanceof FileLikeObject;
984
- }
985
- },
986
- isArrayLikeObject: {
987
- /**
988
- * Returns "true" if value is array like object
989
- * @param {*} value
990
- * @returns {Boolean}
991
- */
992
-
993
- value: function isArrayLikeObject(value) {
994
- return isObject(value) && "length" in value;
995
- }
996
- },
997
- inherit: {
998
- /**
999
- * Inherits a target (Class_1) by a source (Class_2)
1000
- * @param {Function} target
1001
- * @param {Function} source
1002
- */
1003
-
1004
- value: function inherit(target, source) {
1005
- target.prototype = Object.create(source.prototype);
1006
- target.prototype.constructor = target;
1007
- target.super_ = source;
1008
- }
739
+
740
+ if (typeof item._file.size != 'number') {
741
+ throw new TypeError('The file specified is no longer valid');
1009
742
  }
1010
- });
1011
-
743
+
744
+ xhr.upload.onprogress = function (event) {
745
+ var progress = Math.round(event.lengthComputable ? event.loaded * 100 / event.total : 0);
746
+ _this5._onProgressItem(item, progress);
747
+ };
748
+
749
+ xhr.onload = function () {
750
+ var headers = _this5._parseHeaders(xhr.getAllResponseHeaders());
751
+ var response = _this5._transformResponse(xhr.response, headers);
752
+ var gist = _this5._isSuccessCode(xhr.status) ? 'Success' : 'Error';
753
+ var method = '_on' + gist + 'Item';
754
+ _this5[method](item, response, xhr.status, headers);
755
+ _this5._onCompleteItem(item, response, xhr.status, headers);
756
+ };
757
+
758
+ xhr.onerror = function () {
759
+ var headers = _this5._parseHeaders(xhr.getAllResponseHeaders());
760
+ var response = _this5._transformResponse(xhr.response, headers);
761
+ _this5._onErrorItem(item, response, xhr.status, headers);
762
+ _this5._onCompleteItem(item, response, xhr.status, headers);
763
+ };
764
+
765
+ xhr.onabort = function () {
766
+ var headers = _this5._parseHeaders(xhr.getAllResponseHeaders());
767
+ var response = _this5._transformResponse(xhr.response, headers);
768
+ _this5._onCancelItem(item, response, xhr.status, headers);
769
+ _this5._onCompleteItem(item, response, xhr.status, headers);
770
+ };
771
+
772
+ xhr.open(item.method, item.url, true);
773
+
774
+ xhr.withCredentials = item.withCredentials;
775
+
776
+ forEach(item.headers, function (value, name) {
777
+ xhr.setRequestHeader(name, value);
778
+ });
779
+
780
+ xhr.send(sendable);
781
+ };
782
+ /**
783
+ * The IFrame transport
784
+ * @param {FileItem} item
785
+ * @private
786
+ */
787
+
788
+
789
+ FileUploader.prototype._iframeTransport = function _iframeTransport(item) {
790
+ var _this6 = this;
791
+
792
+ var form = element('<form style="display: none;" />');
793
+ var iframe = element('<iframe name="iframeTransport' + Date.now() + '">');
794
+ var input = item._input;
795
+
796
+ if (item._form) item._form.replaceWith(input); // remove old form
797
+ item._form = form; // save link to new form
798
+
799
+ input.prop('name', item.alias);
800
+
801
+ forEach(item.formData, function (obj) {
802
+ forEach(obj, function (value, key) {
803
+ var element_ = element('<input type="hidden" name="' + key + '" />');
804
+ element_.val(value);
805
+ form.append(element_);
806
+ });
807
+ });
808
+
809
+ form.prop({
810
+ action: item.url,
811
+ method: 'POST',
812
+ target: iframe.prop('name'),
813
+ enctype: 'multipart/form-data',
814
+ encoding: 'multipart/form-data' // old IE
815
+ });
816
+
817
+ iframe.bind('load', function () {
818
+ var html = '';
819
+ var status = 200;
820
+
821
+ try {
822
+ // Fix for legacy IE browsers that loads internal error page
823
+ // when failed WS response received. In consequence iframe
824
+ // content access denied error is thrown becouse trying to
825
+ // access cross domain page. When such thing occurs notifying
826
+ // with empty response object. See more info at:
827
+ // http://stackoverflow.com/questions/151362/access-is-denied-error-on-accessing-iframe-document-object
828
+ // Note that if non standard 4xx or 5xx error code returned
829
+ // from WS then response content can be accessed without error
830
+ // but 'XHR' status becomes 200. In order to avoid confusion
831
+ // returning response via same 'success' event handler.
832
+
833
+ // fixed angular.contents() for iframes
834
+ html = iframe[0].contentDocument.body.innerHTML;
835
+ } catch (e) {
836
+ // in case we run into the access-is-denied error or we have another error on the server side
837
+ // (intentional 500,40... errors), we at least say 'something went wrong' -> 500
838
+ status = 500;
839
+ }
840
+
841
+ var xhr = { response: html, status: status, dummy: true };
842
+ var headers = {};
843
+ var response = _this6._transformResponse(xhr.response, headers);
844
+
845
+ _this6._onSuccessItem(item, response, xhr.status, headers);
846
+ _this6._onCompleteItem(item, response, xhr.status, headers);
847
+ });
848
+
849
+ form.abort = function () {
850
+ var xhr = { status: 0, dummy: true };
851
+ var headers = {};
852
+ var response;
853
+
854
+ iframe.unbind('load').prop('src', 'javascript:false;');
855
+ form.replaceWith(input);
856
+
857
+ _this6._onCancelItem(item, response, xhr.status, headers);
858
+ _this6._onCompleteItem(item, response, xhr.status, headers);
859
+ };
860
+
861
+ input.after(form);
862
+ form.append(input).append(iframe);
863
+
864
+ form[0].submit();
865
+ };
866
+ /**
867
+ * Inner callback
868
+ * @param {File|Object} item
869
+ * @param {Object} filter
870
+ * @param {Object} options
871
+ * @private
872
+ */
873
+
874
+
875
+ FileUploader.prototype._onWhenAddingFileFailed = function _onWhenAddingFileFailed(item, filter, options) {
876
+ this.onWhenAddingFileFailed(item, filter, options);
877
+ };
878
+ /**
879
+ * Inner callback
880
+ * @param {FileItem} item
881
+ */
882
+
883
+
884
+ FileUploader.prototype._onAfterAddingFile = function _onAfterAddingFile(item) {
885
+ this.onAfterAddingFile(item);
886
+ };
887
+ /**
888
+ * Inner callback
889
+ * @param {Array<FileItem>} items
890
+ */
891
+
892
+
893
+ FileUploader.prototype._onAfterAddingAll = function _onAfterAddingAll(items) {
894
+ this.onAfterAddingAll(items);
895
+ };
896
+ /**
897
+ * Inner callback
898
+ * @param {FileItem} item
899
+ * @private
900
+ */
901
+
902
+
903
+ FileUploader.prototype._onBeforeUploadItem = function _onBeforeUploadItem(item) {
904
+ item._onBeforeUpload();
905
+ this.onBeforeUploadItem(item);
906
+ };
907
+ /**
908
+ * Inner callback
909
+ * @param {FileItem} item
910
+ * @param {Number} progress
911
+ * @private
912
+ */
913
+
914
+
915
+ FileUploader.prototype._onProgressItem = function _onProgressItem(item, progress) {
916
+ var total = this._getTotalProgress(progress);
917
+ this.progress = total;
918
+ item._onProgress(progress);
919
+ this.onProgressItem(item, progress);
920
+ this.onProgressAll(total);
921
+ this._render();
922
+ };
923
+ /**
924
+ * Inner callback
925
+ * @param {FileItem} item
926
+ * @param {*} response
927
+ * @param {Number} status
928
+ * @param {Object} headers
929
+ * @private
930
+ */
931
+
932
+
933
+ FileUploader.prototype._onSuccessItem = function _onSuccessItem(item, response, status, headers) {
934
+ item._onSuccess(response, status, headers);
935
+ this.onSuccessItem(item, response, status, headers);
936
+ };
937
+ /**
938
+ * Inner callback
939
+ * @param {FileItem} item
940
+ * @param {*} response
941
+ * @param {Number} status
942
+ * @param {Object} headers
943
+ * @private
944
+ */
945
+
946
+
947
+ FileUploader.prototype._onErrorItem = function _onErrorItem(item, response, status, headers) {
948
+ item._onError(response, status, headers);
949
+ this.onErrorItem(item, response, status, headers);
950
+ };
951
+ /**
952
+ * Inner callback
953
+ * @param {FileItem} item
954
+ * @param {*} response
955
+ * @param {Number} status
956
+ * @param {Object} headers
957
+ * @private
958
+ */
959
+
960
+
961
+ FileUploader.prototype._onCancelItem = function _onCancelItem(item, response, status, headers) {
962
+ item._onCancel(response, status, headers);
963
+ this.onCancelItem(item, response, status, headers);
964
+ };
965
+ /**
966
+ * Inner callback
967
+ * @param {FileItem} item
968
+ * @param {*} response
969
+ * @param {Number} status
970
+ * @param {Object} headers
971
+ * @private
972
+ */
973
+
974
+
975
+ FileUploader.prototype._onCompleteItem = function _onCompleteItem(item, response, status, headers) {
976
+ item._onComplete(response, status, headers);
977
+ this.onCompleteItem(item, response, status, headers);
978
+
979
+ var nextItem = this.getReadyItems()[0];
980
+ this.isUploading = false;
981
+
982
+ if (isDefined(nextItem)) {
983
+ nextItem.upload();
984
+ return;
985
+ }
986
+
987
+ this.onCompleteAll();
988
+ this.progress = this._getTotalProgress();
989
+ this._render();
990
+ };
991
+ /**********************
992
+ * STATIC
993
+ **********************/
994
+ /**
995
+ * Returns "true" if value an instance of File
996
+ * @param {*} value
997
+ * @returns {Boolean}
998
+ * @private
999
+ */
1000
+
1001
+
1002
+ FileUploader.isFile = function isFile(value) {
1003
+ return File && value instanceof File;
1004
+ };
1005
+ /**
1006
+ * Returns "true" if value an instance of FileLikeObject
1007
+ * @param {*} value
1008
+ * @returns {Boolean}
1009
+ * @private
1010
+ */
1011
+
1012
+
1013
+ FileUploader.isFileLikeObject = function isFileLikeObject(value) {
1014
+ return value instanceof FileLikeObject;
1015
+ };
1016
+ /**
1017
+ * Returns "true" if value is array like object
1018
+ * @param {*} value
1019
+ * @returns {Boolean}
1020
+ */
1021
+
1022
+
1023
+ FileUploader.isArrayLikeObject = function isArrayLikeObject(value) {
1024
+ return isObject(value) && 'length' in value;
1025
+ };
1026
+ /**
1027
+ * Inherits a target (Class_1) by a source (Class_2)
1028
+ * @param {Function} target
1029
+ * @param {Function} source
1030
+ */
1031
+
1032
+
1033
+ FileUploader.inherit = function inherit(target, source) {
1034
+ target.prototype = Object.create(source.prototype);
1035
+ target.prototype.constructor = target;
1036
+ target.super_ = source;
1037
+ };
1038
+
1012
1039
  return FileUploader;
1013
- })();
1014
-
1040
+ }();
1041
+
1015
1042
  /**********************
1016
1043
  * PUBLIC
1017
1044
  **********************/
@@ -1020,6 +1047,8 @@ return /******/ (function(modules) { // webpackBootstrap
1020
1047
  * @returns {Boolean}
1021
1048
  * @readonly
1022
1049
  */
1050
+
1051
+
1023
1052
  FileUploader.prototype.isHTML5 = !!(File && FormData);
1024
1053
  /**********************
1025
1054
  * STATIC
@@ -1028,108 +1057,111 @@ return /******/ (function(modules) { // webpackBootstrap
1028
1057
  * @borrows FileUploader.prototype.isHTML5
1029
1058
  */
1030
1059
  FileUploader.isHTML5 = FileUploader.prototype.isHTML5;
1031
-
1060
+
1032
1061
  return FileUploader;
1033
- };
1034
-
1035
- module.exports.$inject = ["fileUploaderOptions", "$rootScope", "$http", "$window", "FileLikeObject", "FileItem"];
1062
+ }
1063
+
1064
+ __identity.$inject = ['fileUploaderOptions', '$rootScope', '$http', '$window', '$timeout', 'FileLikeObject', 'FileItem', 'Pipeline'];
1036
1065
 
1037
1066
  /***/ },
1038
1067
  /* 4 */
1039
1068
  /***/ function(module, exports, __webpack_require__) {
1040
1069
 
1041
- "use strict";
1042
-
1043
- var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
1044
-
1045
- var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
1046
-
1047
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
1048
-
1049
- var CONFIG = _interopRequire(__webpack_require__(1));
1050
-
1051
- var copy = angular.copy;
1052
- var isElement = angular.isElement;
1053
- var isString = angular.isString;
1054
-
1055
- module.exports = function () {
1056
- var FileLikeObject = (function () {
1070
+ 'use strict';
1071
+
1072
+ Object.defineProperty(exports, "__esModule", {
1073
+ value: true
1074
+ });
1075
+ exports.default = __identity;
1076
+
1077
+ var _config = __webpack_require__(1);
1078
+
1079
+ var _config2 = _interopRequireDefault(_config);
1080
+
1081
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1082
+
1083
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1084
+
1085
+ var _angular = angular;
1086
+ var copy = _angular.copy;
1087
+ var isElement = _angular.isElement;
1088
+ var isString = _angular.isString;
1089
+ function __identity() {
1090
+
1091
+ return function () {
1057
1092
  /**
1058
1093
  * Creates an instance of FileLikeObject
1059
1094
  * @param {File|HTMLInputElement|Object} fileOrInput
1060
1095
  * @constructor
1061
1096
  */
1062
-
1097
+
1063
1098
  function FileLikeObject(fileOrInput) {
1064
1099
  _classCallCheck(this, FileLikeObject);
1065
-
1100
+
1066
1101
  var isInput = isElement(fileOrInput);
1067
1102
  var fakePathOrObject = isInput ? fileOrInput.value : fileOrInput;
1068
- var postfix = isString(fakePathOrObject) ? "FakePath" : "Object";
1069
- var method = "_createFrom" + postfix;
1103
+ var postfix = isString(fakePathOrObject) ? 'FakePath' : 'Object';
1104
+ var method = '_createFrom' + postfix;
1070
1105
  this[method](fakePathOrObject);
1071
1106
  }
1072
-
1073
- _createClass(FileLikeObject, {
1074
- _createFromFakePath: {
1075
- /**
1076
- * Creates file like object from fake path string
1077
- * @param {String} path
1078
- * @private
1079
- */
1080
-
1081
- value: function _createFromFakePath(path) {
1082
- this.lastModifiedDate = null;
1083
- this.size = null;
1084
- this.type = "like/" + path.slice(path.lastIndexOf(".") + 1).toLowerCase();
1085
- this.name = path.slice(path.lastIndexOf("/") + path.lastIndexOf("\\") + 2);
1086
- }
1087
- },
1088
- _createFromObject: {
1089
- /**
1090
- * Creates file like object from object
1091
- * @param {File|FileLikeObject} object
1092
- * @private
1093
- */
1094
-
1095
- value: function _createFromObject(object) {
1096
- this.lastModifiedDate = copy(object.lastModifiedDate);
1097
- this.size = object.size;
1098
- this.type = object.type;
1099
- this.name = object.name;
1100
- }
1101
- }
1102
- });
1103
-
1107
+ /**
1108
+ * Creates file like object from fake path string
1109
+ * @param {String} path
1110
+ * @private
1111
+ */
1112
+
1113
+
1114
+ FileLikeObject.prototype._createFromFakePath = function _createFromFakePath(path) {
1115
+ this.lastModifiedDate = null;
1116
+ this.size = null;
1117
+ this.type = 'like/' + path.slice(path.lastIndexOf('.') + 1).toLowerCase();
1118
+ this.name = path.slice(path.lastIndexOf('/') + path.lastIndexOf('\\') + 2);
1119
+ };
1120
+ /**
1121
+ * Creates file like object from object
1122
+ * @param {File|FileLikeObject} object
1123
+ * @private
1124
+ */
1125
+
1126
+
1127
+ FileLikeObject.prototype._createFromObject = function _createFromObject(object) {
1128
+ this.lastModifiedDate = copy(object.lastModifiedDate);
1129
+ this.size = object.size;
1130
+ this.type = object.type;
1131
+ this.name = object.name;
1132
+ };
1133
+
1104
1134
  return FileLikeObject;
1105
- })();
1106
-
1107
- return FileLikeObject;
1108
- };
1109
-
1110
- module.exports.$inject = [];
1135
+ }();
1136
+ }
1111
1137
 
1112
1138
  /***/ },
1113
1139
  /* 5 */
1114
1140
  /***/ function(module, exports, __webpack_require__) {
1115
1141
 
1116
- "use strict";
1117
-
1118
- var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
1119
-
1120
- var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
1121
-
1122
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
1123
-
1124
- var CONFIG = _interopRequire(__webpack_require__(1));
1125
-
1126
- var copy = angular.copy;
1127
- var extend = angular.extend;
1128
- var element = angular.element;
1129
- var isElement = angular.isElement;
1130
-
1131
- module.exports = function ($compile, FileLikeObject) {
1132
- var FileItem = (function () {
1142
+ 'use strict';
1143
+
1144
+ Object.defineProperty(exports, "__esModule", {
1145
+ value: true
1146
+ });
1147
+ exports.default = __identity;
1148
+
1149
+ var _config = __webpack_require__(1);
1150
+
1151
+ var _config2 = _interopRequireDefault(_config);
1152
+
1153
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1154
+
1155
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1156
+
1157
+ var _angular = angular;
1158
+ var copy = _angular.copy;
1159
+ var extend = _angular.extend;
1160
+ var element = _angular.element;
1161
+ var isElement = _angular.isElement;
1162
+ function __identity($compile, FileLikeObject) {
1163
+
1164
+ return function () {
1133
1165
  /**
1134
1166
  * Creates an instance of FileItem
1135
1167
  * @param {FileUploader} uploader
@@ -1137,14 +1169,14 @@ return /******/ (function(modules) { // webpackBootstrap
1137
1169
  * @param {Object} options
1138
1170
  * @constructor
1139
1171
  */
1140
-
1172
+
1141
1173
  function FileItem(uploader, some, options) {
1142
1174
  _classCallCheck(this, FileItem);
1143
-
1175
+
1144
1176
  var isInput = isElement(some);
1145
1177
  var input = isInput ? element(some) : null;
1146
1178
  var file = !isInput ? some : null;
1147
-
1179
+
1148
1180
  extend(this, {
1149
1181
  url: uploader.url,
1150
1182
  alias: uploader.alias,
@@ -1152,291 +1184,274 @@ return /******/ (function(modules) { // webpackBootstrap
1152
1184
  formData: copy(uploader.formData),
1153
1185
  removeAfterUpload: uploader.removeAfterUpload,
1154
1186
  withCredentials: uploader.withCredentials,
1187
+ disableMultipart: uploader.disableMultipart,
1155
1188
  method: uploader.method
1156
1189
  }, options, {
1157
1190
  uploader: uploader,
1158
1191
  file: new FileLikeObject(some),
1159
1192
  isReady: false,
1160
1193
  isUploading: false,
1161
- isUploaded: false,
1162
- isSuccess: false,
1163
- isCancel: false,
1164
- isError: false,
1165
- progress: 0,
1166
- index: null,
1167
- _file: file,
1168
- _input: input
1169
- });
1170
-
1171
- if (input) this._replaceNode(input);
1172
- }
1173
-
1174
- _createClass(FileItem, {
1175
- upload: {
1176
- /**********************
1177
- * PUBLIC
1178
- **********************/
1179
- /**
1180
- * Uploads a FileItem
1181
- */
1182
-
1183
- value: function upload() {
1184
- try {
1185
- this.uploader.uploadItem(this);
1186
- } catch (e) {
1187
- this.uploader._onCompleteItem(this, "", 0, []);
1188
- this.uploader._onErrorItem(this, "", 0, []);
1189
- }
1190
- }
1191
- },
1192
- cancel: {
1193
- /**
1194
- * Cancels uploading of FileItem
1195
- */
1196
-
1197
- value: function cancel() {
1198
- this.uploader.cancelItem(this);
1199
- }
1200
- },
1201
- remove: {
1202
- /**
1203
- * Removes a FileItem
1204
- */
1205
-
1206
- value: function remove() {
1207
- this.uploader.removeFromQueue(this);
1208
- }
1209
- },
1210
- onBeforeUpload: {
1211
- /**
1212
- * Callback
1213
- * @private
1214
- */
1215
-
1216
- value: function onBeforeUpload() {}
1217
- },
1218
- onProgress: {
1219
- /**
1220
- * Callback
1221
- * @param {Number} progress
1222
- * @private
1223
- */
1224
-
1225
- value: function onProgress(progress) {}
1226
- },
1227
- onSuccess: {
1228
- /**
1229
- * Callback
1230
- * @param {*} response
1231
- * @param {Number} status
1232
- * @param {Object} headers
1233
- */
1234
-
1235
- value: function onSuccess(response, status, headers) {}
1236
- },
1237
- onError: {
1238
- /**
1239
- * Callback
1240
- * @param {*} response
1241
- * @param {Number} status
1242
- * @param {Object} headers
1243
- */
1244
-
1245
- value: function onError(response, status, headers) {}
1246
- },
1247
- onCancel: {
1248
- /**
1249
- * Callback
1250
- * @param {*} response
1251
- * @param {Number} status
1252
- * @param {Object} headers
1253
- */
1254
-
1255
- value: function onCancel(response, status, headers) {}
1256
- },
1257
- onComplete: {
1258
- /**
1259
- * Callback
1260
- * @param {*} response
1261
- * @param {Number} status
1262
- * @param {Object} headers
1263
- */
1264
-
1265
- value: function onComplete(response, status, headers) {}
1266
- },
1267
- _onBeforeUpload: {
1268
- /**********************
1269
- * PRIVATE
1270
- **********************/
1271
- /**
1272
- * Inner callback
1273
- */
1274
-
1275
- value: function _onBeforeUpload() {
1276
- this.isReady = true;
1277
- this.isUploading = true;
1278
- this.isUploaded = false;
1279
- this.isSuccess = false;
1280
- this.isCancel = false;
1281
- this.isError = false;
1282
- this.progress = 0;
1283
- this.onBeforeUpload();
1284
- }
1285
- },
1286
- _onProgress: {
1287
- /**
1288
- * Inner callback
1289
- * @param {Number} progress
1290
- * @private
1291
- */
1292
-
1293
- value: function _onProgress(progress) {
1294
- this.progress = progress;
1295
- this.onProgress(progress);
1296
- }
1297
- },
1298
- _onSuccess: {
1299
- /**
1300
- * Inner callback
1301
- * @param {*} response
1302
- * @param {Number} status
1303
- * @param {Object} headers
1304
- * @private
1305
- */
1306
-
1307
- value: function _onSuccess(response, status, headers) {
1308
- this.isReady = false;
1309
- this.isUploading = false;
1310
- this.isUploaded = true;
1311
- this.isSuccess = true;
1312
- this.isCancel = false;
1313
- this.isError = false;
1314
- this.progress = 100;
1315
- this.index = null;
1316
- this.onSuccess(response, status, headers);
1317
- }
1318
- },
1319
- _onError: {
1320
- /**
1321
- * Inner callback
1322
- * @param {*} response
1323
- * @param {Number} status
1324
- * @param {Object} headers
1325
- * @private
1326
- */
1327
-
1328
- value: function _onError(response, status, headers) {
1329
- this.isReady = false;
1330
- this.isUploading = false;
1331
- this.isUploaded = true;
1332
- this.isSuccess = false;
1333
- this.isCancel = false;
1334
- this.isError = true;
1335
- this.progress = 0;
1336
- this.index = null;
1337
- this.onError(response, status, headers);
1338
- }
1339
- },
1340
- _onCancel: {
1341
- /**
1342
- * Inner callback
1343
- * @param {*} response
1344
- * @param {Number} status
1345
- * @param {Object} headers
1346
- * @private
1347
- */
1348
-
1349
- value: function _onCancel(response, status, headers) {
1350
- this.isReady = false;
1351
- this.isUploading = false;
1352
- this.isUploaded = false;
1353
- this.isSuccess = false;
1354
- this.isCancel = true;
1355
- this.isError = false;
1356
- this.progress = 0;
1357
- this.index = null;
1358
- this.onCancel(response, status, headers);
1359
- }
1360
- },
1361
- _onComplete: {
1362
- /**
1363
- * Inner callback
1364
- * @param {*} response
1365
- * @param {Number} status
1366
- * @param {Object} headers
1367
- * @private
1368
- */
1369
-
1370
- value: function _onComplete(response, status, headers) {
1371
- this.onComplete(response, status, headers);
1372
- if (this.removeAfterUpload) this.remove();
1373
- }
1374
- },
1375
- _destroy: {
1376
- /**
1377
- * Destroys a FileItem
1378
- */
1379
-
1380
- value: function _destroy() {
1381
- if (this._input) this._input.remove();
1382
- if (this._form) this._form.remove();
1383
- delete this._form;
1384
- delete this._input;
1385
- }
1386
- },
1387
- _prepareToUploading: {
1388
- /**
1389
- * Prepares to uploading
1390
- * @private
1391
- */
1392
-
1393
- value: function _prepareToUploading() {
1394
- this.index = this.index || ++this.uploader._nextIndex;
1395
- this.isReady = true;
1396
- }
1397
- },
1398
- _replaceNode: {
1399
- /**
1400
- * Replaces input element on his clone
1401
- * @param {JQLite|jQuery} input
1402
- * @private
1403
- */
1404
-
1405
- value: function _replaceNode(input) {
1406
- var clone = $compile(input.clone())(input.scope());
1407
- clone.prop("value", null); // FF fix
1408
- input.css("display", "none");
1409
- input.after(clone); // remove jquery dependency
1410
- }
1194
+ isUploaded: false,
1195
+ isSuccess: false,
1196
+ isCancel: false,
1197
+ isError: false,
1198
+ progress: 0,
1199
+ index: null,
1200
+ _file: file,
1201
+ _input: input
1202
+ });
1203
+
1204
+ if (input) this._replaceNode(input);
1205
+ }
1206
+ /**********************
1207
+ * PUBLIC
1208
+ **********************/
1209
+ /**
1210
+ * Uploads a FileItem
1211
+ */
1212
+
1213
+
1214
+ FileItem.prototype.upload = function upload() {
1215
+ try {
1216
+ this.uploader.uploadItem(this);
1217
+ } catch (e) {
1218
+ this.uploader._onCompleteItem(this, '', 0, []);
1219
+ this.uploader._onErrorItem(this, '', 0, []);
1411
1220
  }
1412
- });
1413
-
1221
+ };
1222
+ /**
1223
+ * Cancels uploading of FileItem
1224
+ */
1225
+
1226
+
1227
+ FileItem.prototype.cancel = function cancel() {
1228
+ this.uploader.cancelItem(this);
1229
+ };
1230
+ /**
1231
+ * Removes a FileItem
1232
+ */
1233
+
1234
+
1235
+ FileItem.prototype.remove = function remove() {
1236
+ this.uploader.removeFromQueue(this);
1237
+ };
1238
+ /**
1239
+ * Callback
1240
+ * @private
1241
+ */
1242
+
1243
+
1244
+ FileItem.prototype.onBeforeUpload = function onBeforeUpload() {};
1245
+ /**
1246
+ * Callback
1247
+ * @param {Number} progress
1248
+ * @private
1249
+ */
1250
+
1251
+
1252
+ FileItem.prototype.onProgress = function onProgress(progress) {};
1253
+ /**
1254
+ * Callback
1255
+ * @param {*} response
1256
+ * @param {Number} status
1257
+ * @param {Object} headers
1258
+ */
1259
+
1260
+
1261
+ FileItem.prototype.onSuccess = function onSuccess(response, status, headers) {};
1262
+ /**
1263
+ * Callback
1264
+ * @param {*} response
1265
+ * @param {Number} status
1266
+ * @param {Object} headers
1267
+ */
1268
+
1269
+
1270
+ FileItem.prototype.onError = function onError(response, status, headers) {};
1271
+ /**
1272
+ * Callback
1273
+ * @param {*} response
1274
+ * @param {Number} status
1275
+ * @param {Object} headers
1276
+ */
1277
+
1278
+
1279
+ FileItem.prototype.onCancel = function onCancel(response, status, headers) {};
1280
+ /**
1281
+ * Callback
1282
+ * @param {*} response
1283
+ * @param {Number} status
1284
+ * @param {Object} headers
1285
+ */
1286
+
1287
+
1288
+ FileItem.prototype.onComplete = function onComplete(response, status, headers) {};
1289
+ /**********************
1290
+ * PRIVATE
1291
+ **********************/
1292
+ /**
1293
+ * Inner callback
1294
+ */
1295
+
1296
+
1297
+ FileItem.prototype._onBeforeUpload = function _onBeforeUpload() {
1298
+ this.isReady = true;
1299
+ this.isUploading = false;
1300
+ this.isUploaded = false;
1301
+ this.isSuccess = false;
1302
+ this.isCancel = false;
1303
+ this.isError = false;
1304
+ this.progress = 0;
1305
+ this.onBeforeUpload();
1306
+ };
1307
+ /**
1308
+ * Inner callback
1309
+ * @param {Number} progress
1310
+ * @private
1311
+ */
1312
+
1313
+
1314
+ FileItem.prototype._onProgress = function _onProgress(progress) {
1315
+ this.progress = progress;
1316
+ this.onProgress(progress);
1317
+ };
1318
+ /**
1319
+ * Inner callback
1320
+ * @param {*} response
1321
+ * @param {Number} status
1322
+ * @param {Object} headers
1323
+ * @private
1324
+ */
1325
+
1326
+
1327
+ FileItem.prototype._onSuccess = function _onSuccess(response, status, headers) {
1328
+ this.isReady = false;
1329
+ this.isUploading = false;
1330
+ this.isUploaded = true;
1331
+ this.isSuccess = true;
1332
+ this.isCancel = false;
1333
+ this.isError = false;
1334
+ this.progress = 100;
1335
+ this.index = null;
1336
+ this.onSuccess(response, status, headers);
1337
+ };
1338
+ /**
1339
+ * Inner callback
1340
+ * @param {*} response
1341
+ * @param {Number} status
1342
+ * @param {Object} headers
1343
+ * @private
1344
+ */
1345
+
1346
+
1347
+ FileItem.prototype._onError = function _onError(response, status, headers) {
1348
+ this.isReady = false;
1349
+ this.isUploading = false;
1350
+ this.isUploaded = true;
1351
+ this.isSuccess = false;
1352
+ this.isCancel = false;
1353
+ this.isError = true;
1354
+ this.progress = 0;
1355
+ this.index = null;
1356
+ this.onError(response, status, headers);
1357
+ };
1358
+ /**
1359
+ * Inner callback
1360
+ * @param {*} response
1361
+ * @param {Number} status
1362
+ * @param {Object} headers
1363
+ * @private
1364
+ */
1365
+
1366
+
1367
+ FileItem.prototype._onCancel = function _onCancel(response, status, headers) {
1368
+ this.isReady = false;
1369
+ this.isUploading = false;
1370
+ this.isUploaded = false;
1371
+ this.isSuccess = false;
1372
+ this.isCancel = true;
1373
+ this.isError = false;
1374
+ this.progress = 0;
1375
+ this.index = null;
1376
+ this.onCancel(response, status, headers);
1377
+ };
1378
+ /**
1379
+ * Inner callback
1380
+ * @param {*} response
1381
+ * @param {Number} status
1382
+ * @param {Object} headers
1383
+ * @private
1384
+ */
1385
+
1386
+
1387
+ FileItem.prototype._onComplete = function _onComplete(response, status, headers) {
1388
+ this.onComplete(response, status, headers);
1389
+ if (this.removeAfterUpload) this.remove();
1390
+ };
1391
+ /**
1392
+ * Destroys a FileItem
1393
+ */
1394
+
1395
+
1396
+ FileItem.prototype._destroy = function _destroy() {
1397
+ if (this._input) this._input.remove();
1398
+ if (this._form) this._form.remove();
1399
+ delete this._form;
1400
+ delete this._input;
1401
+ };
1402
+ /**
1403
+ * Prepares to uploading
1404
+ * @private
1405
+ */
1406
+
1407
+
1408
+ FileItem.prototype._prepareToUploading = function _prepareToUploading() {
1409
+ this.index = this.index || ++this.uploader._nextIndex;
1410
+ this.isReady = true;
1411
+ };
1412
+ /**
1413
+ * Replaces input element on his clone
1414
+ * @param {JQLite|jQuery} input
1415
+ * @private
1416
+ */
1417
+
1418
+
1419
+ FileItem.prototype._replaceNode = function _replaceNode(input) {
1420
+ var clone = $compile(input.clone())(input.scope());
1421
+ clone.prop('value', null); // FF fix
1422
+ input.css('display', 'none');
1423
+ input.after(clone); // remove jquery dependency
1424
+ };
1425
+
1414
1426
  return FileItem;
1415
- })();
1416
-
1417
- return FileItem;
1418
- };
1419
-
1420
- module.exports.$inject = ["$compile", "FileLikeObject"];
1427
+ }();
1428
+ }
1429
+
1430
+ __identity.$inject = ['$compile', 'FileLikeObject'];
1421
1431
 
1422
1432
  /***/ },
1423
1433
  /* 6 */
1424
1434
  /***/ function(module, exports, __webpack_require__) {
1425
1435
 
1426
- "use strict";
1427
-
1428
- var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
1429
-
1430
- var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
1431
-
1432
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
1433
-
1434
- var CONFIG = _interopRequire(__webpack_require__(1));
1435
-
1436
- var extend = angular.extend;
1437
-
1438
- module.exports = function () {
1439
- var FileDirective = (function () {
1436
+ 'use strict';
1437
+
1438
+ Object.defineProperty(exports, "__esModule", {
1439
+ value: true
1440
+ });
1441
+ exports.default = __identity;
1442
+
1443
+ var _config = __webpack_require__(1);
1444
+
1445
+ var _config2 = _interopRequireDefault(_config);
1446
+
1447
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1448
+
1449
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1450
+
1451
+ var _angular = angular;
1452
+ var extend = _angular.extend;
1453
+ function __identity() {
1454
+ var FileDirective = function () {
1440
1455
  /**
1441
1456
  * Creates instance of {FileDirective} object
1442
1457
  * @param {Object} options
@@ -1446,551 +1461,625 @@ return /******/ (function(modules) { // webpackBootstrap
1446
1461
  * @param {String} options.prop
1447
1462
  * @constructor
1448
1463
  */
1449
-
1464
+
1450
1465
  function FileDirective(options) {
1451
1466
  _classCallCheck(this, FileDirective);
1452
-
1467
+
1453
1468
  extend(this, options);
1454
1469
  this.uploader._directives[this.prop].push(this);
1455
1470
  this._saveLinks();
1456
1471
  this.bind();
1457
1472
  }
1458
-
1459
- _createClass(FileDirective, {
1460
- bind: {
1461
- /**
1462
- * Binds events handles
1463
- */
1464
-
1465
- value: function bind() {
1466
- for (var key in this.events) {
1467
- var prop = this.events[key];
1468
- this.element.bind(key, this[prop]);
1469
- }
1470
- }
1471
- },
1472
- unbind: {
1473
- /**
1474
- * Unbinds events handles
1475
- */
1476
-
1477
- value: function unbind() {
1478
- for (var key in this.events) {
1479
- this.element.unbind(key, this.events[key]);
1480
- }
1481
- }
1482
- },
1483
- destroy: {
1484
- /**
1485
- * Destroys directive
1486
- */
1487
-
1488
- value: function destroy() {
1489
- var index = this.uploader._directives[this.prop].indexOf(this);
1490
- this.uploader._directives[this.prop].splice(index, 1);
1491
- this.unbind();
1492
- // this.element = null;
1493
- }
1494
- },
1495
- _saveLinks: {
1496
- /**
1497
- * Saves links to functions
1498
- * @private
1499
- */
1500
-
1501
- value: function _saveLinks() {
1502
- for (var key in this.events) {
1503
- var prop = this.events[key];
1504
- this[prop] = this[prop].bind(this);
1505
- }
1506
- }
1473
+ /**
1474
+ * Binds events handles
1475
+ */
1476
+
1477
+
1478
+ FileDirective.prototype.bind = function bind() {
1479
+ for (var key in this.events) {
1480
+ var prop = this.events[key];
1481
+ this.element.bind(key, this[prop]);
1507
1482
  }
1508
- });
1509
-
1483
+ };
1484
+ /**
1485
+ * Unbinds events handles
1486
+ */
1487
+
1488
+
1489
+ FileDirective.prototype.unbind = function unbind() {
1490
+ for (var key in this.events) {
1491
+ this.element.unbind(key, this.events[key]);
1492
+ }
1493
+ };
1494
+ /**
1495
+ * Destroys directive
1496
+ */
1497
+
1498
+
1499
+ FileDirective.prototype.destroy = function destroy() {
1500
+ var index = this.uploader._directives[this.prop].indexOf(this);
1501
+ this.uploader._directives[this.prop].splice(index, 1);
1502
+ this.unbind();
1503
+ // this.element = null;
1504
+ };
1505
+ /**
1506
+ * Saves links to functions
1507
+ * @private
1508
+ */
1509
+
1510
+
1511
+ FileDirective.prototype._saveLinks = function _saveLinks() {
1512
+ for (var key in this.events) {
1513
+ var prop = this.events[key];
1514
+ this[prop] = this[prop].bind(this);
1515
+ }
1516
+ };
1517
+
1510
1518
  return FileDirective;
1511
- })();
1512
-
1519
+ }();
1520
+
1513
1521
  /**
1514
1522
  * Map of events
1515
1523
  * @type {Object}
1516
1524
  */
1525
+
1526
+
1517
1527
  FileDirective.prototype.events = {};
1518
-
1528
+
1519
1529
  return FileDirective;
1520
- };
1521
-
1522
- module.exports.$inject = [];
1530
+ }
1523
1531
 
1524
1532
  /***/ },
1525
1533
  /* 7 */
1526
1534
  /***/ function(module, exports, __webpack_require__) {
1527
1535
 
1528
- "use strict";
1529
-
1530
- var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
1531
-
1532
- var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
1533
-
1534
- var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc && desc.writable) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
1535
-
1536
- var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
1537
-
1538
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
1539
-
1540
- var CONFIG = _interopRequire(__webpack_require__(1));
1541
-
1542
- var extend = angular.extend;
1543
-
1544
- module.exports = function (FileDirective) {
1545
- var FileSelect = (function (_FileDirective) {
1536
+ 'use strict';
1537
+
1538
+ Object.defineProperty(exports, "__esModule", {
1539
+ value: true
1540
+ });
1541
+ exports.default = __identity;
1542
+
1543
+ var _config = __webpack_require__(1);
1544
+
1545
+ var _config2 = _interopRequireDefault(_config);
1546
+
1547
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1548
+
1549
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1550
+
1551
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
1552
+
1553
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1554
+
1555
+ var _angular = angular;
1556
+ var extend = _angular.extend;
1557
+ function __identity($compile, FileDirective) {
1558
+
1559
+ return function (_FileDirective) {
1560
+ _inherits(FileSelect, _FileDirective);
1561
+
1546
1562
  /**
1547
1563
  * Creates instance of {FileSelect} object
1548
1564
  * @param {Object} options
1549
1565
  * @constructor
1550
1566
  */
1551
-
1567
+
1552
1568
  function FileSelect(options) {
1553
1569
  _classCallCheck(this, FileSelect);
1554
-
1570
+
1555
1571
  var extendedOptions = extend(options, {
1556
1572
  // Map of events
1557
1573
  events: {
1558
- $destroy: "destroy",
1559
- change: "onChange"
1574
+ $destroy: 'destroy',
1575
+ change: 'onChange'
1560
1576
  },
1561
1577
  // Name of property inside uploader._directive object
1562
- prop: "select"
1578
+ prop: 'select'
1563
1579
  });
1564
-
1565
- _get(Object.getPrototypeOf(FileSelect.prototype), "constructor", this).call(this, extendedOptions);
1566
-
1567
- if (!this.uploader.isHTML5) {
1568
- this.element.removeAttr("multiple");
1580
+
1581
+ var _this = _possibleConstructorReturn(this, _FileDirective.call(this, extendedOptions));
1582
+
1583
+ if (!_this.uploader.isHTML5) {
1584
+ _this.element.removeAttr('multiple');
1569
1585
  }
1570
- this.element.prop("value", null); // FF fix
1586
+ _this.element.prop('value', null); // FF fix
1587
+ return _this;
1571
1588
  }
1572
-
1573
- _inherits(FileSelect, _FileDirective);
1574
-
1575
- _createClass(FileSelect, {
1576
- getOptions: {
1577
- /**
1578
- * Returns options
1579
- * @return {Object|undefined}
1580
- */
1581
-
1582
- value: function getOptions() {}
1583
- },
1584
- getFilters: {
1585
- /**
1586
- * Returns filters
1587
- * @return {Array<Function>|String|undefined}
1588
- */
1589
-
1590
- value: function getFilters() {}
1591
- },
1592
- isEmptyAfterSelection: {
1593
- /**
1594
- * If returns "true" then HTMLInputElement will be cleared
1595
- * @returns {Boolean}
1596
- */
1597
-
1598
- value: function isEmptyAfterSelection() {
1599
- return !!this.element.attr("multiple");
1600
- }
1601
- },
1602
- onChange: {
1603
- /**
1604
- * Event handler
1605
- */
1606
-
1607
- value: function onChange() {
1608
- var files = this.uploader.isHTML5 ? this.element[0].files : this.element[0];
1609
- var options = this.getOptions();
1610
- var filters = this.getFilters();
1611
-
1612
- if (!this.uploader.isHTML5) this.destroy();
1613
- this.uploader.addToQueue(files, options, filters);
1614
- if (this.isEmptyAfterSelection()) {
1615
- this.element.prop("value", null);
1616
- this.element.replaceWith(this.element = this.element.clone(true)); // IE fix
1617
- }
1618
- }
1589
+ /**
1590
+ * Returns options
1591
+ * @return {Object|undefined}
1592
+ */
1593
+
1594
+
1595
+ FileSelect.prototype.getOptions = function getOptions() {};
1596
+ /**
1597
+ * Returns filters
1598
+ * @return {Array<Function>|String|undefined}
1599
+ */
1600
+
1601
+
1602
+ FileSelect.prototype.getFilters = function getFilters() {};
1603
+ /**
1604
+ * If returns "true" then HTMLInputElement will be cleared
1605
+ * @returns {Boolean}
1606
+ */
1607
+
1608
+
1609
+ FileSelect.prototype.isEmptyAfterSelection = function isEmptyAfterSelection() {
1610
+ return !!this.element.attr('multiple');
1611
+ };
1612
+ /**
1613
+ * Event handler
1614
+ */
1615
+
1616
+
1617
+ FileSelect.prototype.onChange = function onChange() {
1618
+ var files = this.uploader.isHTML5 ? this.element[0].files : this.element[0];
1619
+ var options = this.getOptions();
1620
+ var filters = this.getFilters();
1621
+
1622
+ if (!this.uploader.isHTML5) this.destroy();
1623
+ this.uploader.addToQueue(files, options, filters);
1624
+ if (this.isEmptyAfterSelection()) {
1625
+ this.element.prop('value', null);
1626
+ this.element.replaceWith($compile(this.element.clone())(this.scope)); // IE fix
1619
1627
  }
1620
- });
1621
-
1628
+ };
1629
+
1622
1630
  return FileSelect;
1623
- })(FileDirective);
1624
-
1625
- return FileSelect;
1626
- };
1627
-
1628
- module.exports.$inject = ["FileDirective"];
1631
+ }(FileDirective);
1632
+ }
1633
+
1634
+ __identity.$inject = ['$compile', 'FileDirective'];
1629
1635
 
1630
1636
  /***/ },
1631
1637
  /* 8 */
1632
- /***/ function(module, exports, __webpack_require__) {
1633
-
1634
- "use strict";
1635
-
1636
- var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
1637
-
1638
- var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
1639
-
1640
- var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc && desc.writable) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
1641
-
1642
- var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
1643
-
1644
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
1638
+ /***/ function(module, exports) {
1645
1639
 
1646
- var CONFIG = _interopRequire(__webpack_require__(1));
1640
+ 'use strict';
1641
+
1642
+ Object.defineProperty(exports, "__esModule", {
1643
+ value: true
1644
+ });
1645
+ exports.default = __identity;
1646
+
1647
+ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
1648
+
1649
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1650
+
1651
+ var _angular = angular;
1652
+ var bind = _angular.bind;
1653
+ var isUndefined = _angular.isUndefined;
1654
+ function __identity($q) {
1655
+
1656
+ return function () {
1657
+ /**
1658
+ * @param {Array<Function>} pipes
1659
+ */
1660
+
1661
+ function Pipeline() {
1662
+ var pipes = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
1663
+
1664
+ _classCallCheck(this, Pipeline);
1665
+
1666
+ this.pipes = pipes;
1667
+ }
1668
+
1669
+ Pipeline.prototype.next = function next(args) {
1670
+ var pipe = this.pipes.shift();
1671
+ if (isUndefined(pipe)) {
1672
+ this.onSuccessful.apply(this, _toConsumableArray(args));
1673
+ return;
1674
+ }
1675
+ var err = new Error('The filter has not passed');
1676
+ err.pipe = pipe;
1677
+ err.args = args;
1678
+ if (pipe.isAsync) {
1679
+ var deferred = $q.defer();
1680
+ var onFulfilled = bind(this, this.next, args);
1681
+ var onRejected = bind(this, this.onThrown, err);
1682
+ deferred.promise.then(onFulfilled, onRejected);
1683
+ pipe.apply(undefined, _toConsumableArray(args).concat([deferred]));
1684
+ } else {
1685
+ var isDone = Boolean(pipe.apply(undefined, _toConsumableArray(args)));
1686
+ if (isDone) {
1687
+ this.next(args);
1688
+ } else {
1689
+ this.onThrown(err);
1690
+ }
1691
+ }
1692
+ };
1693
+
1694
+ Pipeline.prototype.exec = function exec() {
1695
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
1696
+ args[_key] = arguments[_key];
1697
+ }
1698
+
1699
+ this.next(args);
1700
+ };
1701
+
1702
+ Pipeline.prototype.onThrown = function onThrown(err) {};
1703
+
1704
+ Pipeline.prototype.onSuccessful = function onSuccessful() {};
1705
+
1706
+ return Pipeline;
1707
+ }();
1708
+ }
1709
+
1710
+ __identity.$inject = ['$q'];
1647
1711
 
1648
- var extend = angular.extend;
1649
- var forEach = angular.forEach;
1712
+ /***/ },
1713
+ /* 9 */
1714
+ /***/ function(module, exports, __webpack_require__) {
1650
1715
 
1651
- module.exports = function (FileDirective) {
1652
- var FileDrop = (function (_FileDirective) {
1716
+ 'use strict';
1717
+
1718
+ Object.defineProperty(exports, "__esModule", {
1719
+ value: true
1720
+ });
1721
+ exports.default = __identity;
1722
+
1723
+ var _config = __webpack_require__(1);
1724
+
1725
+ var _config2 = _interopRequireDefault(_config);
1726
+
1727
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1728
+
1729
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1730
+
1731
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
1732
+
1733
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1734
+
1735
+ var _angular = angular;
1736
+ var extend = _angular.extend;
1737
+ var forEach = _angular.forEach;
1738
+ function __identity(FileDirective) {
1739
+
1740
+ return function (_FileDirective) {
1741
+ _inherits(FileDrop, _FileDirective);
1742
+
1653
1743
  /**
1654
1744
  * Creates instance of {FileDrop} object
1655
1745
  * @param {Object} options
1656
1746
  * @constructor
1657
1747
  */
1658
-
1748
+
1659
1749
  function FileDrop(options) {
1660
1750
  _classCallCheck(this, FileDrop);
1661
-
1751
+
1662
1752
  var extendedOptions = extend(options, {
1663
1753
  // Map of events
1664
1754
  events: {
1665
- $destroy: "destroy",
1666
- drop: "onDrop",
1667
- dragover: "onDragOver",
1668
- dragleave: "onDragLeave"
1755
+ $destroy: 'destroy',
1756
+ drop: 'onDrop',
1757
+ dragover: 'onDragOver',
1758
+ dragleave: 'onDragLeave'
1669
1759
  },
1670
1760
  // Name of property inside uploader._directive object
1671
- prop: "drop"
1761
+ prop: 'drop'
1672
1762
  });
1673
-
1674
- _get(Object.getPrototypeOf(FileDrop.prototype), "constructor", this).call(this, extendedOptions);
1763
+
1764
+ return _possibleConstructorReturn(this, _FileDirective.call(this, extendedOptions));
1675
1765
  }
1676
-
1677
- _inherits(FileDrop, _FileDirective);
1678
-
1679
- _createClass(FileDrop, {
1680
- getOptions: {
1681
- /**
1682
- * Returns options
1683
- * @return {Object|undefined}
1684
- */
1685
-
1686
- value: function getOptions() {}
1687
- },
1688
- getFilters: {
1689
- /**
1690
- * Returns filters
1691
- * @return {Array<Function>|String|undefined}
1692
- */
1693
-
1694
- value: function getFilters() {}
1695
- },
1696
- onDrop: {
1697
- /**
1698
- * Event handler
1699
- */
1700
-
1701
- value: function onDrop(event) {
1702
- var transfer = this._getTransfer(event);
1703
- if (!transfer) {
1704
- return;
1705
- }var options = this.getOptions();
1706
- var filters = this.getFilters();
1707
- this._preventAndStop(event);
1708
- forEach(this.uploader._directives.over, this._removeOverClass, this);
1709
- this.uploader.addToQueue(transfer.files, options, filters);
1710
- }
1711
- },
1712
- onDragOver: {
1713
- /**
1714
- * Event handler
1715
- */
1716
-
1717
- value: function onDragOver(event) {
1718
- var transfer = this._getTransfer(event);
1719
- if (!this._haveFiles(transfer.types)) {
1720
- return;
1721
- }transfer.dropEffect = "copy";
1722
- this._preventAndStop(event);
1723
- forEach(this.uploader._directives.over, this._addOverClass, this);
1724
- }
1725
- },
1726
- onDragLeave: {
1727
- /**
1728
- * Event handler
1729
- */
1730
-
1731
- value: function onDragLeave(event) {
1732
- if (event.currentTarget === this.element[0]) {
1733
- return;
1734
- }this._preventAndStop(event);
1735
- forEach(this.uploader._directives.over, this._removeOverClass, this);
1736
- }
1737
- },
1738
- _getTransfer: {
1739
- /**
1740
- * Helper
1741
- */
1742
-
1743
- value: function _getTransfer(event) {
1744
- return event.dataTransfer ? event.dataTransfer : event.originalEvent.dataTransfer; // jQuery fix;
1745
- }
1746
- },
1747
- _preventAndStop: {
1748
- /**
1749
- * Helper
1750
- */
1751
-
1752
- value: function _preventAndStop(event) {
1753
- event.preventDefault();
1754
- event.stopPropagation();
1755
- }
1756
- },
1757
- _haveFiles: {
1758
- /**
1759
- * Returns "true" if types contains files
1760
- * @param {Object} types
1761
- */
1762
-
1763
- value: function _haveFiles(types) {
1764
- if (!types) {
1765
- return false;
1766
- }if (types.indexOf) {
1767
- return types.indexOf("Files") !== -1;
1768
- } else if (types.contains) {
1769
- return types.contains("Files");
1770
- } else {
1771
- return false;
1772
- }
1773
- }
1774
- },
1775
- _addOverClass: {
1776
- /**
1777
- * Callback
1778
- */
1779
-
1780
- value: function _addOverClass(item) {
1781
- item.addOverClass();
1782
- }
1783
- },
1784
- _removeOverClass: {
1785
- /**
1786
- * Callback
1787
- */
1788
-
1789
- value: function _removeOverClass(item) {
1790
- item.removeOverClass();
1791
- }
1766
+ /**
1767
+ * Returns options
1768
+ * @return {Object|undefined}
1769
+ */
1770
+
1771
+
1772
+ FileDrop.prototype.getOptions = function getOptions() {};
1773
+ /**
1774
+ * Returns filters
1775
+ * @return {Array<Function>|String|undefined}
1776
+ */
1777
+
1778
+
1779
+ FileDrop.prototype.getFilters = function getFilters() {};
1780
+ /**
1781
+ * Event handler
1782
+ */
1783
+
1784
+
1785
+ FileDrop.prototype.onDrop = function onDrop(event) {
1786
+ var transfer = this._getTransfer(event);
1787
+ if (!transfer) return;
1788
+ var options = this.getOptions();
1789
+ var filters = this.getFilters();
1790
+ this._preventAndStop(event);
1791
+ forEach(this.uploader._directives.over, this._removeOverClass, this);
1792
+ this.uploader.addToQueue(transfer.files, options, filters);
1793
+ };
1794
+ /**
1795
+ * Event handler
1796
+ */
1797
+
1798
+
1799
+ FileDrop.prototype.onDragOver = function onDragOver(event) {
1800
+ var transfer = this._getTransfer(event);
1801
+ if (!this._haveFiles(transfer.types)) return;
1802
+ transfer.dropEffect = 'copy';
1803
+ this._preventAndStop(event);
1804
+ forEach(this.uploader._directives.over, this._addOverClass, this);
1805
+ };
1806
+ /**
1807
+ * Event handler
1808
+ */
1809
+
1810
+
1811
+ FileDrop.prototype.onDragLeave = function onDragLeave(event) {
1812
+ if (event.currentTarget === this.element[0]) return;
1813
+ this._preventAndStop(event);
1814
+ forEach(this.uploader._directives.over, this._removeOverClass, this);
1815
+ };
1816
+ /**
1817
+ * Helper
1818
+ */
1819
+
1820
+
1821
+ FileDrop.prototype._getTransfer = function _getTransfer(event) {
1822
+ return event.dataTransfer ? event.dataTransfer : event.originalEvent.dataTransfer; // jQuery fix;
1823
+ };
1824
+ /**
1825
+ * Helper
1826
+ */
1827
+
1828
+
1829
+ FileDrop.prototype._preventAndStop = function _preventAndStop(event) {
1830
+ event.preventDefault();
1831
+ event.stopPropagation();
1832
+ };
1833
+ /**
1834
+ * Returns "true" if types contains files
1835
+ * @param {Object} types
1836
+ */
1837
+
1838
+
1839
+ FileDrop.prototype._haveFiles = function _haveFiles(types) {
1840
+ if (!types) return false;
1841
+ if (types.indexOf) {
1842
+ return types.indexOf('Files') !== -1;
1843
+ } else if (types.contains) {
1844
+ return types.contains('Files');
1845
+ } else {
1846
+ return false;
1792
1847
  }
1793
- });
1794
-
1848
+ };
1849
+ /**
1850
+ * Callback
1851
+ */
1852
+
1853
+
1854
+ FileDrop.prototype._addOverClass = function _addOverClass(item) {
1855
+ item.addOverClass();
1856
+ };
1857
+ /**
1858
+ * Callback
1859
+ */
1860
+
1861
+
1862
+ FileDrop.prototype._removeOverClass = function _removeOverClass(item) {
1863
+ item.removeOverClass();
1864
+ };
1865
+
1795
1866
  return FileDrop;
1796
- })(FileDirective);
1797
-
1798
- return FileDrop;
1799
- };
1800
-
1801
- module.exports.$inject = ["FileDirective"];
1867
+ }(FileDirective);
1868
+ }
1869
+
1870
+ __identity.$inject = ['FileDirective'];
1802
1871
 
1803
1872
  /***/ },
1804
- /* 9 */
1873
+ /* 10 */
1805
1874
  /***/ function(module, exports, __webpack_require__) {
1806
1875
 
1807
- "use strict";
1808
-
1809
- var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
1810
-
1811
- var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
1812
-
1813
- var _get = function get(object, property, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc && desc.writable) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
1814
-
1815
- var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };
1816
-
1817
- var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
1818
-
1819
- var CONFIG = _interopRequire(__webpack_require__(1));
1820
-
1821
- var extend = angular.extend;
1822
-
1823
- module.exports = function (FileDirective) {
1824
- var FileOver = (function (_FileDirective) {
1876
+ 'use strict';
1877
+
1878
+ Object.defineProperty(exports, "__esModule", {
1879
+ value: true
1880
+ });
1881
+ exports.default = __identity;
1882
+
1883
+ var _config = __webpack_require__(1);
1884
+
1885
+ var _config2 = _interopRequireDefault(_config);
1886
+
1887
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1888
+
1889
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1890
+
1891
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
1892
+
1893
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1894
+
1895
+ var _angular = angular;
1896
+ var extend = _angular.extend;
1897
+ function __identity(FileDirective) {
1898
+
1899
+ return function (_FileDirective) {
1900
+ _inherits(FileOver, _FileDirective);
1901
+
1825
1902
  /**
1826
1903
  * Creates instance of {FileDrop} object
1827
1904
  * @param {Object} options
1828
1905
  * @constructor
1829
1906
  */
1830
-
1907
+
1831
1908
  function FileOver(options) {
1832
1909
  _classCallCheck(this, FileOver);
1833
-
1910
+
1834
1911
  var extendedOptions = extend(options, {
1835
1912
  // Map of events
1836
1913
  events: {
1837
- $destroy: "destroy"
1914
+ $destroy: 'destroy'
1838
1915
  },
1839
1916
  // Name of property inside uploader._directive object
1840
- prop: "over",
1917
+ prop: 'over',
1841
1918
  // Over class
1842
- overClass: "nv-file-over"
1919
+ overClass: 'nv-file-over'
1843
1920
  });
1844
-
1845
- _get(Object.getPrototypeOf(FileOver.prototype), "constructor", this).call(this, extendedOptions);
1921
+
1922
+ return _possibleConstructorReturn(this, _FileDirective.call(this, extendedOptions));
1846
1923
  }
1847
-
1848
- _inherits(FileOver, _FileDirective);
1849
-
1850
- _createClass(FileOver, {
1851
- addOverClass: {
1852
- /**
1853
- * Adds over class
1854
- */
1855
-
1856
- value: function addOverClass() {
1857
- this.element.addClass(this.getOverClass());
1858
- }
1859
- },
1860
- removeOverClass: {
1861
- /**
1862
- * Removes over class
1863
- */
1864
-
1865
- value: function removeOverClass() {
1866
- this.element.removeClass(this.getOverClass());
1867
- }
1868
- },
1869
- getOverClass: {
1870
- /**
1871
- * Returns over class
1872
- * @returns {String}
1873
- */
1874
-
1875
- value: function getOverClass() {
1876
- return this.overClass;
1877
- }
1878
- }
1879
- });
1880
-
1924
+ /**
1925
+ * Adds over class
1926
+ */
1927
+
1928
+
1929
+ FileOver.prototype.addOverClass = function addOverClass() {
1930
+ this.element.addClass(this.getOverClass());
1931
+ };
1932
+ /**
1933
+ * Removes over class
1934
+ */
1935
+
1936
+
1937
+ FileOver.prototype.removeOverClass = function removeOverClass() {
1938
+ this.element.removeClass(this.getOverClass());
1939
+ };
1940
+ /**
1941
+ * Returns over class
1942
+ * @returns {String}
1943
+ */
1944
+
1945
+
1946
+ FileOver.prototype.getOverClass = function getOverClass() {
1947
+ return this.overClass;
1948
+ };
1949
+
1881
1950
  return FileOver;
1882
- })(FileDirective);
1883
-
1884
- return FileOver;
1885
- };
1886
-
1887
- module.exports.$inject = ["FileDirective"];
1951
+ }(FileDirective);
1952
+ }
1953
+
1954
+ __identity.$inject = ['FileDirective'];
1888
1955
 
1889
1956
  /***/ },
1890
- /* 10 */
1957
+ /* 11 */
1891
1958
  /***/ function(module, exports, __webpack_require__) {
1892
1959
 
1893
- "use strict";
1894
-
1895
- var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
1896
-
1897
- var CONFIG = _interopRequire(__webpack_require__(1));
1898
-
1899
- module.exports = function ($parse, FileUploader, FileSelect) {
1900
-
1960
+ 'use strict';
1961
+
1962
+ Object.defineProperty(exports, "__esModule", {
1963
+ value: true
1964
+ });
1965
+ exports.default = __identity;
1966
+
1967
+ var _config = __webpack_require__(1);
1968
+
1969
+ var _config2 = _interopRequireDefault(_config);
1970
+
1971
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1972
+
1973
+ function __identity($parse, FileUploader, FileSelect) {
1974
+
1901
1975
  return {
1902
- link: function (scope, element, attributes) {
1976
+ link: function link(scope, element, attributes) {
1903
1977
  var uploader = scope.$eval(attributes.uploader);
1904
-
1978
+
1905
1979
  if (!(uploader instanceof FileUploader)) {
1906
- throw new TypeError("\"Uploader\" must be an instance of FileUploader");
1980
+ throw new TypeError('"Uploader" must be an instance of FileUploader');
1907
1981
  }
1908
-
1982
+
1909
1983
  var object = new FileSelect({
1910
1984
  uploader: uploader,
1911
- element: element
1985
+ element: element,
1986
+ scope: scope
1912
1987
  });
1913
-
1988
+
1914
1989
  object.getOptions = $parse(attributes.options).bind(object, scope);
1915
1990
  object.getFilters = function () {
1916
1991
  return attributes.filters;
1917
1992
  };
1918
1993
  }
1919
1994
  };
1920
- };
1921
-
1922
- module.exports.$inject = ["$parse", "FileUploader", "FileSelect"];
1995
+ }
1996
+
1997
+ __identity.$inject = ['$parse', 'FileUploader', 'FileSelect'];
1923
1998
 
1924
1999
  /***/ },
1925
- /* 11 */
2000
+ /* 12 */
1926
2001
  /***/ function(module, exports, __webpack_require__) {
1927
2002
 
1928
- "use strict";
1929
-
1930
- var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
1931
-
1932
- var CONFIG = _interopRequire(__webpack_require__(1));
1933
-
1934
- module.exports = function ($parse, FileUploader, FileDrop) {
1935
-
2003
+ 'use strict';
2004
+
2005
+ Object.defineProperty(exports, "__esModule", {
2006
+ value: true
2007
+ });
2008
+ exports.default = __identity;
2009
+
2010
+ var _config = __webpack_require__(1);
2011
+
2012
+ var _config2 = _interopRequireDefault(_config);
2013
+
2014
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2015
+
2016
+ function __identity($parse, FileUploader, FileDrop) {
2017
+
1936
2018
  return {
1937
- link: function (scope, element, attributes) {
2019
+ link: function link(scope, element, attributes) {
1938
2020
  var uploader = scope.$eval(attributes.uploader);
1939
-
2021
+
1940
2022
  if (!(uploader instanceof FileUploader)) {
1941
- throw new TypeError("\"Uploader\" must be an instance of FileUploader");
2023
+ throw new TypeError('"Uploader" must be an instance of FileUploader');
1942
2024
  }
1943
-
2025
+
1944
2026
  if (!uploader.isHTML5) return;
1945
-
2027
+
1946
2028
  var object = new FileDrop({
1947
2029
  uploader: uploader,
1948
2030
  element: element
1949
2031
  });
1950
-
2032
+
1951
2033
  object.getOptions = $parse(attributes.options).bind(object, scope);
1952
2034
  object.getFilters = function () {
1953
2035
  return attributes.filters;
1954
2036
  };
1955
2037
  }
1956
2038
  };
1957
- };
1958
-
1959
- module.exports.$inject = ["$parse", "FileUploader", "FileDrop"];
2039
+ }
2040
+
2041
+ __identity.$inject = ['$parse', 'FileUploader', 'FileDrop'];
1960
2042
 
1961
2043
  /***/ },
1962
- /* 12 */
2044
+ /* 13 */
1963
2045
  /***/ function(module, exports, __webpack_require__) {
1964
2046
 
1965
- "use strict";
1966
-
1967
- var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
1968
-
1969
- var CONFIG = _interopRequire(__webpack_require__(1));
1970
-
1971
- module.exports = function (FileUploader, FileOver) {
1972
-
2047
+ 'use strict';
2048
+
2049
+ Object.defineProperty(exports, "__esModule", {
2050
+ value: true
2051
+ });
2052
+ exports.default = __identity;
2053
+
2054
+ var _config = __webpack_require__(1);
2055
+
2056
+ var _config2 = _interopRequireDefault(_config);
2057
+
2058
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2059
+
2060
+ function __identity(FileUploader, FileOver) {
2061
+
1973
2062
  return {
1974
- link: function (scope, element, attributes) {
2063
+ link: function link(scope, element, attributes) {
1975
2064
  var uploader = scope.$eval(attributes.uploader);
1976
-
2065
+
1977
2066
  if (!(uploader instanceof FileUploader)) {
1978
- throw new TypeError("\"Uploader\" must be an instance of FileUploader");
2067
+ throw new TypeError('"Uploader" must be an instance of FileUploader');
1979
2068
  }
1980
-
2069
+
1981
2070
  var object = new FileOver({
1982
2071
  uploader: uploader,
1983
2072
  element: element
1984
2073
  });
1985
-
2074
+
1986
2075
  object.getOverClass = function () {
1987
2076
  return attributes.overClass || object.overClass;
1988
2077
  };
1989
2078
  }
1990
2079
  };
1991
- };
1992
-
1993
- module.exports.$inject = ["FileUploader", "FileOver"];
2080
+ }
2081
+
2082
+ __identity.$inject = ['FileUploader', 'FileOver'];
1994
2083
 
1995
2084
  /***/ }
1996
2085
  /******/ ])