@grafit/era-dependencies 1.0.0
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.
- package/package.json +7 -0
- package/vendor/fonts/FontAwesome.otf +0 -0
- package/vendor/fonts/fontawesome-webfont.eot +0 -0
- package/vendor/fonts/fontawesome-webfont.svg +685 -0
- package/vendor/fonts/fontawesome-webfont.ttf +0 -0
- package/vendor/fonts/fontawesome-webfont.woff +0 -0
- package/vendor/fonts/fontawesome-webfont.woff2 +0 -0
- package/vendor/fonts/glyphicons-halflings-regular.eot +0 -0
- package/vendor/fonts/glyphicons-halflings-regular.svg +288 -0
- package/vendor/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/vendor/fonts/glyphicons-halflings-regular.woff +0 -0
- package/vendor/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/vendor/scripts/angular/angular-cookies.js +322 -0
- package/vendor/scripts/angular/angular-file-upload.js +2087 -0
- package/vendor/scripts/angular/angular-filter.js +2287 -0
- package/vendor/scripts/angular/angular-locale_ru-ru.js +143 -0
- package/vendor/scripts/angular/angular-route.js +1069 -0
- package/vendor/scripts/angular/angular-sanitize.js +738 -0
- package/vendor/scripts/angular/angular-ui-router-0.2.18.js +4539 -0
- package/vendor/scripts/angular/angular.js +31768 -0
- package/vendor/scripts/angular/datetimepicker.js +578 -0
- package/vendor/scripts/angular/datetimepicker.templates.js +30 -0
- package/vendor/scripts/angular/mask.min.js +7 -0
- package/vendor/scripts/angular/ng-table.js +1518 -0
- package/vendor/scripts/angular/select.js +2356 -0
- package/vendor/scripts/angular/ui-bootstrap-tpls-2.1.3.js +7536 -0
- package/vendor/scripts/angular/uploader.js +3 -0
- package/vendor/scripts/bootbox.js +985 -0
- package/vendor/scripts/bootstrap.js +2377 -0
- package/vendor/scripts/es6-shim.js +3837 -0
- package/vendor/scripts/highchart/highcharts-more.src.js +3165 -0
- package/vendor/scripts/highchart/highstock.src.js +32008 -0
- package/vendor/scripts/highchart/modules/boost.src.js +2721 -0
- package/vendor/scripts/highchart/modules/exporting.src.js +951 -0
- package/vendor/scripts/jquery/jquery.js +11008 -0
- package/vendor/scripts/jquery.datetimepicker.full.js +2911 -0
- package/vendor/scripts/keycloak.js +2382 -0
- package/vendor/scripts/lodash.js +16733 -0
- package/vendor/scripts/moment-with-locales.js +12251 -0
- package/vendor/scripts/moment.js +4234 -0
- package/vendor/scripts/old/datepicker-ru.js +38 -0
- package/vendor/scripts/old/jquery-ui-1.11.1.js +16375 -0
- package/vendor/scripts/old/jquery.form.js +1278 -0
- package/vendor/scripts/perfect-scrollbar.js +1549 -0
- package/vendor/scripts/pickmeup/pickmeup-locales.js +11 -0
- package/vendor/scripts/pickmeup/pickmeup.js +1383 -0
- package/vendor/scripts/quill.js +9676 -0
- package/vendor/scripts/socket.io.min.js +3 -0
- package/vendor/scripts/textAngular/angular-spectrum-colorpicker.min.js +2 -0
- package/vendor/scripts/textAngular/spectrum.min.js +1 -0
- package/vendor/scripts/textAngular/textAngular-dropdownToggle.js +38 -0
- package/vendor/scripts/textAngular/textAngular-rangy.min.js +478 -0
- package/vendor/scripts/textAngular/textAngular-sanitize.min.js +322 -0
- package/vendor/scripts/textAngular/textAngular.min.js +1481 -0
- package/vendor/scripts/textAngular/textAngularSetup.js +1013 -0
- package/vendor/styles/bootstrap-theme.css +587 -0
- package/vendor/styles/bootstrap-theme.css.map +1 -0
- package/vendor/styles/bootstrap-theme.min.css +6 -0
- package/vendor/styles/bootstrap-theme.min.css.map +1 -0
- package/vendor/styles/bootstrap.css +6757 -0
- package/vendor/styles/bootstrap.css.map +1 -0
- package/vendor/styles/bootstrap.min.css +6 -0
- package/vendor/styles/bootstrap.min.css.map +1 -0
- package/vendor/styles/datetimepicker.css +115 -0
- package/vendor/styles/font-awesome.css +2199 -0
- package/vendor/styles/jquery.datetimepicker.min.css +1 -0
- package/vendor/styles/ng-table.css +136 -0
- package/vendor/styles/normalize.css +424 -0
- package/vendor/styles/perfect-scrollbar.css +165 -0
- package/vendor/styles/pickmeup.css +137 -0
- package/vendor/styles/spectrum.min.css +1 -0
- package/vendor/styles/textAngular.css +193 -0
|
@@ -0,0 +1,2087 @@
|
|
|
1
|
+
/*
|
|
2
|
+
angular-file-upload v2.5.0
|
|
3
|
+
https://github.com/nervgh/angular-file-upload
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
7
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
8
|
+
module.exports = factory();
|
|
9
|
+
else if(typeof define === 'function' && define.amd)
|
|
10
|
+
define([], factory);
|
|
11
|
+
else if(typeof exports === 'object')
|
|
12
|
+
exports["angular-file-upload"] = factory();
|
|
13
|
+
else
|
|
14
|
+
root["angular-file-upload"] = factory();
|
|
15
|
+
})(this, function() {
|
|
16
|
+
return /******/ (function(modules) { // webpackBootstrap
|
|
17
|
+
/******/ // The module cache
|
|
18
|
+
/******/ var installedModules = {};
|
|
19
|
+
/******/
|
|
20
|
+
/******/ // The require function
|
|
21
|
+
/******/ function __webpack_require__(moduleId) {
|
|
22
|
+
/******/
|
|
23
|
+
/******/ // Check if module is in cache
|
|
24
|
+
/******/ if(installedModules[moduleId])
|
|
25
|
+
/******/ return installedModules[moduleId].exports;
|
|
26
|
+
/******/
|
|
27
|
+
/******/ // Create a new module (and put it into the cache)
|
|
28
|
+
/******/ var module = installedModules[moduleId] = {
|
|
29
|
+
/******/ exports: {},
|
|
30
|
+
/******/ id: moduleId,
|
|
31
|
+
/******/ loaded: false
|
|
32
|
+
/******/ };
|
|
33
|
+
/******/
|
|
34
|
+
/******/ // Execute the module function
|
|
35
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
36
|
+
/******/
|
|
37
|
+
/******/ // Flag the module as loaded
|
|
38
|
+
/******/ module.loaded = true;
|
|
39
|
+
/******/
|
|
40
|
+
/******/ // Return the exports of the module
|
|
41
|
+
/******/ return module.exports;
|
|
42
|
+
/******/ }
|
|
43
|
+
/******/
|
|
44
|
+
/******/
|
|
45
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
46
|
+
/******/ __webpack_require__.m = modules;
|
|
47
|
+
/******/
|
|
48
|
+
/******/ // expose the module cache
|
|
49
|
+
/******/ __webpack_require__.c = installedModules;
|
|
50
|
+
/******/
|
|
51
|
+
/******/ // __webpack_public_path__
|
|
52
|
+
/******/ __webpack_require__.p = "";
|
|
53
|
+
/******/
|
|
54
|
+
/******/ // Load entry module and return exports
|
|
55
|
+
/******/ return __webpack_require__(0);
|
|
56
|
+
/******/ })
|
|
57
|
+
/************************************************************************/
|
|
58
|
+
/******/ ([
|
|
59
|
+
/* 0 */
|
|
60
|
+
/***/ function(module, exports, __webpack_require__) {
|
|
61
|
+
|
|
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) {
|
|
119
|
+
// only for compatibility
|
|
120
|
+
FileUploader.FileLikeObject = FileLikeObject;
|
|
121
|
+
FileUploader.FileItem = FileItem;
|
|
122
|
+
FileUploader.FileDirective = FileDirective;
|
|
123
|
+
FileUploader.FileSelect = FileSelect;
|
|
124
|
+
FileUploader.FileDrop = FileDrop;
|
|
125
|
+
FileUploader.FileOver = FileOver;
|
|
126
|
+
FileUploader.Pipeline = Pipeline;
|
|
127
|
+
}]);
|
|
128
|
+
|
|
129
|
+
/***/ },
|
|
130
|
+
/* 1 */
|
|
131
|
+
/***/ function(module, exports) {
|
|
132
|
+
|
|
133
|
+
module.exports = {
|
|
134
|
+
"name": "angularFileUpload"
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/***/ },
|
|
138
|
+
/* 2 */
|
|
139
|
+
/***/ function(module, exports) {
|
|
140
|
+
|
|
141
|
+
'use strict';
|
|
142
|
+
|
|
143
|
+
Object.defineProperty(exports, "__esModule", {
|
|
144
|
+
value: true
|
|
145
|
+
});
|
|
146
|
+
exports.default = {
|
|
147
|
+
url: '/',
|
|
148
|
+
alias: 'file',
|
|
149
|
+
headers: {},
|
|
150
|
+
queue: [],
|
|
151
|
+
progress: 0,
|
|
152
|
+
autoUpload: false,
|
|
153
|
+
removeAfterUpload: false,
|
|
154
|
+
method: 'POST',
|
|
155
|
+
filters: [],
|
|
156
|
+
formData: [],
|
|
157
|
+
queueLimit: Number.MAX_VALUE,
|
|
158
|
+
withCredentials: false,
|
|
159
|
+
disableMultipart: false
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
/***/ },
|
|
163
|
+
/* 3 */
|
|
164
|
+
/***/ function(module, exports, __webpack_require__) {
|
|
165
|
+
|
|
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) {
|
|
196
|
+
var File = $window.File;
|
|
197
|
+
var FormData = $window.FormData;
|
|
198
|
+
|
|
199
|
+
var FileUploader = function () {
|
|
200
|
+
/**********************
|
|
201
|
+
* PUBLIC
|
|
202
|
+
**********************/
|
|
203
|
+
/**
|
|
204
|
+
* Creates an instance of FileUploader
|
|
205
|
+
* @param {Object} [options]
|
|
206
|
+
* @constructor
|
|
207
|
+
*/
|
|
208
|
+
|
|
209
|
+
function FileUploader(options) {
|
|
210
|
+
_classCallCheck(this, FileUploader);
|
|
211
|
+
|
|
212
|
+
var settings = copy(fileUploaderOptions);
|
|
213
|
+
|
|
214
|
+
extend(this, settings, options, {
|
|
215
|
+
isUploading: false,
|
|
216
|
+
_nextIndex: 0,
|
|
217
|
+
_directives: { select: [], drop: [], over: [] }
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
// add default filters
|
|
221
|
+
this.filters.unshift({ name: 'queueLimit', fn: this._queueLimitFilter });
|
|
222
|
+
this.filters.unshift({ name: 'folder', fn: this._folderFilter });
|
|
223
|
+
}
|
|
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));
|
|
355
|
+
};
|
|
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;
|
|
693
|
+
}
|
|
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);
|
|
732
|
+
});
|
|
733
|
+
});
|
|
734
|
+
|
|
735
|
+
sendable.append(item.alias, item._file, item.file.name);
|
|
736
|
+
} else {
|
|
737
|
+
sendable = item._file;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
if (typeof item._file.size != 'number') {
|
|
741
|
+
throw new TypeError('The file specified is no longer valid');
|
|
742
|
+
}
|
|
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
|
+
|
|
1039
|
+
return FileUploader;
|
|
1040
|
+
}();
|
|
1041
|
+
|
|
1042
|
+
/**********************
|
|
1043
|
+
* PUBLIC
|
|
1044
|
+
**********************/
|
|
1045
|
+
/**
|
|
1046
|
+
* Checks a support the html5 uploader
|
|
1047
|
+
* @returns {Boolean}
|
|
1048
|
+
* @readonly
|
|
1049
|
+
*/
|
|
1050
|
+
|
|
1051
|
+
|
|
1052
|
+
FileUploader.prototype.isHTML5 = !!(File && FormData);
|
|
1053
|
+
/**********************
|
|
1054
|
+
* STATIC
|
|
1055
|
+
**********************/
|
|
1056
|
+
/**
|
|
1057
|
+
* @borrows FileUploader.prototype.isHTML5
|
|
1058
|
+
*/
|
|
1059
|
+
FileUploader.isHTML5 = FileUploader.prototype.isHTML5;
|
|
1060
|
+
|
|
1061
|
+
return FileUploader;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
__identity.$inject = ['fileUploaderOptions', '$rootScope', '$http', '$window', '$timeout', 'FileLikeObject', 'FileItem', 'Pipeline'];
|
|
1065
|
+
|
|
1066
|
+
/***/ },
|
|
1067
|
+
/* 4 */
|
|
1068
|
+
/***/ function(module, exports, __webpack_require__) {
|
|
1069
|
+
|
|
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 () {
|
|
1092
|
+
/**
|
|
1093
|
+
* Creates an instance of FileLikeObject
|
|
1094
|
+
* @param {File|HTMLInputElement|Object} fileOrInput
|
|
1095
|
+
* @constructor
|
|
1096
|
+
*/
|
|
1097
|
+
|
|
1098
|
+
function FileLikeObject(fileOrInput) {
|
|
1099
|
+
_classCallCheck(this, FileLikeObject);
|
|
1100
|
+
|
|
1101
|
+
var isInput = isElement(fileOrInput);
|
|
1102
|
+
var fakePathOrObject = isInput ? fileOrInput.value : fileOrInput;
|
|
1103
|
+
var postfix = isString(fakePathOrObject) ? 'FakePath' : 'Object';
|
|
1104
|
+
var method = '_createFrom' + postfix;
|
|
1105
|
+
this[method](fakePathOrObject);
|
|
1106
|
+
}
|
|
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
|
+
|
|
1134
|
+
return FileLikeObject;
|
|
1135
|
+
}();
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
/***/ },
|
|
1139
|
+
/* 5 */
|
|
1140
|
+
/***/ function(module, exports, __webpack_require__) {
|
|
1141
|
+
|
|
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 () {
|
|
1165
|
+
/**
|
|
1166
|
+
* Creates an instance of FileItem
|
|
1167
|
+
* @param {FileUploader} uploader
|
|
1168
|
+
* @param {File|HTMLInputElement|Object} some
|
|
1169
|
+
* @param {Object} options
|
|
1170
|
+
* @constructor
|
|
1171
|
+
*/
|
|
1172
|
+
|
|
1173
|
+
function FileItem(uploader, some, options) {
|
|
1174
|
+
_classCallCheck(this, FileItem);
|
|
1175
|
+
|
|
1176
|
+
var isInput = isElement(some);
|
|
1177
|
+
var input = isInput ? element(some) : null;
|
|
1178
|
+
var file = !isInput ? some : null;
|
|
1179
|
+
|
|
1180
|
+
extend(this, {
|
|
1181
|
+
url: uploader.url,
|
|
1182
|
+
alias: uploader.alias,
|
|
1183
|
+
headers: copy(uploader.headers),
|
|
1184
|
+
formData: copy(uploader.formData),
|
|
1185
|
+
removeAfterUpload: uploader.removeAfterUpload,
|
|
1186
|
+
withCredentials: uploader.withCredentials,
|
|
1187
|
+
disableMultipart: uploader.disableMultipart,
|
|
1188
|
+
method: uploader.method
|
|
1189
|
+
}, options, {
|
|
1190
|
+
uploader: uploader,
|
|
1191
|
+
file: new FileLikeObject(some),
|
|
1192
|
+
isReady: false,
|
|
1193
|
+
isUploading: false,
|
|
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
|
+
var message = e.name + ':' + e.message;
|
|
1219
|
+
this.uploader._onCompleteItem(this, message, e.code, []);
|
|
1220
|
+
this.uploader._onErrorItem(this, message, e.code, []);
|
|
1221
|
+
}
|
|
1222
|
+
};
|
|
1223
|
+
/**
|
|
1224
|
+
* Cancels uploading of FileItem
|
|
1225
|
+
*/
|
|
1226
|
+
|
|
1227
|
+
|
|
1228
|
+
FileItem.prototype.cancel = function cancel() {
|
|
1229
|
+
this.uploader.cancelItem(this);
|
|
1230
|
+
};
|
|
1231
|
+
/**
|
|
1232
|
+
* Removes a FileItem
|
|
1233
|
+
*/
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
FileItem.prototype.remove = function remove() {
|
|
1237
|
+
this.uploader.removeFromQueue(this);
|
|
1238
|
+
};
|
|
1239
|
+
/**
|
|
1240
|
+
* Callback
|
|
1241
|
+
* @private
|
|
1242
|
+
*/
|
|
1243
|
+
|
|
1244
|
+
|
|
1245
|
+
FileItem.prototype.onBeforeUpload = function onBeforeUpload() {};
|
|
1246
|
+
/**
|
|
1247
|
+
* Callback
|
|
1248
|
+
* @param {Number} progress
|
|
1249
|
+
* @private
|
|
1250
|
+
*/
|
|
1251
|
+
|
|
1252
|
+
|
|
1253
|
+
FileItem.prototype.onProgress = function onProgress(progress) {};
|
|
1254
|
+
/**
|
|
1255
|
+
* Callback
|
|
1256
|
+
* @param {*} response
|
|
1257
|
+
* @param {Number} status
|
|
1258
|
+
* @param {Object} headers
|
|
1259
|
+
*/
|
|
1260
|
+
|
|
1261
|
+
|
|
1262
|
+
FileItem.prototype.onSuccess = function onSuccess(response, status, headers) {};
|
|
1263
|
+
/**
|
|
1264
|
+
* Callback
|
|
1265
|
+
* @param {*} response
|
|
1266
|
+
* @param {Number} status
|
|
1267
|
+
* @param {Object} headers
|
|
1268
|
+
*/
|
|
1269
|
+
|
|
1270
|
+
|
|
1271
|
+
FileItem.prototype.onError = function onError(response, status, headers) {};
|
|
1272
|
+
/**
|
|
1273
|
+
* Callback
|
|
1274
|
+
* @param {*} response
|
|
1275
|
+
* @param {Number} status
|
|
1276
|
+
* @param {Object} headers
|
|
1277
|
+
*/
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
FileItem.prototype.onCancel = function onCancel(response, status, headers) {};
|
|
1281
|
+
/**
|
|
1282
|
+
* Callback
|
|
1283
|
+
* @param {*} response
|
|
1284
|
+
* @param {Number} status
|
|
1285
|
+
* @param {Object} headers
|
|
1286
|
+
*/
|
|
1287
|
+
|
|
1288
|
+
|
|
1289
|
+
FileItem.prototype.onComplete = function onComplete(response, status, headers) {};
|
|
1290
|
+
/**********************
|
|
1291
|
+
* PRIVATE
|
|
1292
|
+
**********************/
|
|
1293
|
+
/**
|
|
1294
|
+
* Inner callback
|
|
1295
|
+
*/
|
|
1296
|
+
|
|
1297
|
+
|
|
1298
|
+
FileItem.prototype._onBeforeUpload = function _onBeforeUpload() {
|
|
1299
|
+
this.isReady = true;
|
|
1300
|
+
this.isUploading = false;
|
|
1301
|
+
this.isUploaded = false;
|
|
1302
|
+
this.isSuccess = false;
|
|
1303
|
+
this.isCancel = false;
|
|
1304
|
+
this.isError = false;
|
|
1305
|
+
this.progress = 0;
|
|
1306
|
+
this.onBeforeUpload();
|
|
1307
|
+
};
|
|
1308
|
+
/**
|
|
1309
|
+
* Inner callback
|
|
1310
|
+
* @param {Number} progress
|
|
1311
|
+
* @private
|
|
1312
|
+
*/
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
FileItem.prototype._onProgress = function _onProgress(progress) {
|
|
1316
|
+
this.progress = progress;
|
|
1317
|
+
this.onProgress(progress);
|
|
1318
|
+
};
|
|
1319
|
+
/**
|
|
1320
|
+
* Inner callback
|
|
1321
|
+
* @param {*} response
|
|
1322
|
+
* @param {Number} status
|
|
1323
|
+
* @param {Object} headers
|
|
1324
|
+
* @private
|
|
1325
|
+
*/
|
|
1326
|
+
|
|
1327
|
+
|
|
1328
|
+
FileItem.prototype._onSuccess = function _onSuccess(response, status, headers) {
|
|
1329
|
+
this.isReady = false;
|
|
1330
|
+
this.isUploading = false;
|
|
1331
|
+
this.isUploaded = true;
|
|
1332
|
+
this.isSuccess = true;
|
|
1333
|
+
this.isCancel = false;
|
|
1334
|
+
this.isError = false;
|
|
1335
|
+
this.progress = 100;
|
|
1336
|
+
this.index = null;
|
|
1337
|
+
this.onSuccess(response, status, headers);
|
|
1338
|
+
};
|
|
1339
|
+
/**
|
|
1340
|
+
* Inner callback
|
|
1341
|
+
* @param {*} response
|
|
1342
|
+
* @param {Number} status
|
|
1343
|
+
* @param {Object} headers
|
|
1344
|
+
* @private
|
|
1345
|
+
*/
|
|
1346
|
+
|
|
1347
|
+
|
|
1348
|
+
FileItem.prototype._onError = function _onError(response, status, headers) {
|
|
1349
|
+
this.isReady = false;
|
|
1350
|
+
this.isUploading = false;
|
|
1351
|
+
this.isUploaded = true;
|
|
1352
|
+
this.isSuccess = false;
|
|
1353
|
+
this.isCancel = false;
|
|
1354
|
+
this.isError = true;
|
|
1355
|
+
this.progress = 0;
|
|
1356
|
+
this.index = null;
|
|
1357
|
+
this.onError(response, status, headers);
|
|
1358
|
+
};
|
|
1359
|
+
/**
|
|
1360
|
+
* Inner callback
|
|
1361
|
+
* @param {*} response
|
|
1362
|
+
* @param {Number} status
|
|
1363
|
+
* @param {Object} headers
|
|
1364
|
+
* @private
|
|
1365
|
+
*/
|
|
1366
|
+
|
|
1367
|
+
|
|
1368
|
+
FileItem.prototype._onCancel = function _onCancel(response, status, headers) {
|
|
1369
|
+
this.isReady = false;
|
|
1370
|
+
this.isUploading = false;
|
|
1371
|
+
this.isUploaded = false;
|
|
1372
|
+
this.isSuccess = false;
|
|
1373
|
+
this.isCancel = true;
|
|
1374
|
+
this.isError = false;
|
|
1375
|
+
this.progress = 0;
|
|
1376
|
+
this.index = null;
|
|
1377
|
+
this.onCancel(response, status, headers);
|
|
1378
|
+
};
|
|
1379
|
+
/**
|
|
1380
|
+
* Inner callback
|
|
1381
|
+
* @param {*} response
|
|
1382
|
+
* @param {Number} status
|
|
1383
|
+
* @param {Object} headers
|
|
1384
|
+
* @private
|
|
1385
|
+
*/
|
|
1386
|
+
|
|
1387
|
+
|
|
1388
|
+
FileItem.prototype._onComplete = function _onComplete(response, status, headers) {
|
|
1389
|
+
this.onComplete(response, status, headers);
|
|
1390
|
+
if (this.removeAfterUpload) this.remove();
|
|
1391
|
+
};
|
|
1392
|
+
/**
|
|
1393
|
+
* Destroys a FileItem
|
|
1394
|
+
*/
|
|
1395
|
+
|
|
1396
|
+
|
|
1397
|
+
FileItem.prototype._destroy = function _destroy() {
|
|
1398
|
+
if (this._input) this._input.remove();
|
|
1399
|
+
if (this._form) this._form.remove();
|
|
1400
|
+
delete this._form;
|
|
1401
|
+
delete this._input;
|
|
1402
|
+
};
|
|
1403
|
+
/**
|
|
1404
|
+
* Prepares to uploading
|
|
1405
|
+
* @private
|
|
1406
|
+
*/
|
|
1407
|
+
|
|
1408
|
+
|
|
1409
|
+
FileItem.prototype._prepareToUploading = function _prepareToUploading() {
|
|
1410
|
+
this.index = this.index || ++this.uploader._nextIndex;
|
|
1411
|
+
this.isReady = true;
|
|
1412
|
+
};
|
|
1413
|
+
/**
|
|
1414
|
+
* Replaces input element on his clone
|
|
1415
|
+
* @param {JQLite|jQuery} input
|
|
1416
|
+
* @private
|
|
1417
|
+
*/
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
FileItem.prototype._replaceNode = function _replaceNode(input) {
|
|
1421
|
+
var clone = $compile(input.clone())(input.scope());
|
|
1422
|
+
clone.prop('value', null); // FF fix
|
|
1423
|
+
input.css('display', 'none');
|
|
1424
|
+
input.after(clone); // remove jquery dependency
|
|
1425
|
+
};
|
|
1426
|
+
|
|
1427
|
+
return FileItem;
|
|
1428
|
+
}();
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
__identity.$inject = ['$compile', 'FileLikeObject'];
|
|
1432
|
+
|
|
1433
|
+
/***/ },
|
|
1434
|
+
/* 6 */
|
|
1435
|
+
/***/ function(module, exports, __webpack_require__) {
|
|
1436
|
+
|
|
1437
|
+
'use strict';
|
|
1438
|
+
|
|
1439
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1440
|
+
value: true
|
|
1441
|
+
});
|
|
1442
|
+
exports.default = __identity;
|
|
1443
|
+
|
|
1444
|
+
var _config = __webpack_require__(1);
|
|
1445
|
+
|
|
1446
|
+
var _config2 = _interopRequireDefault(_config);
|
|
1447
|
+
|
|
1448
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1449
|
+
|
|
1450
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1451
|
+
|
|
1452
|
+
var _angular = angular;
|
|
1453
|
+
var extend = _angular.extend;
|
|
1454
|
+
function __identity() {
|
|
1455
|
+
var FileDirective = function () {
|
|
1456
|
+
/**
|
|
1457
|
+
* Creates instance of {FileDirective} object
|
|
1458
|
+
* @param {Object} options
|
|
1459
|
+
* @param {Object} options.uploader
|
|
1460
|
+
* @param {HTMLElement} options.element
|
|
1461
|
+
* @param {Object} options.events
|
|
1462
|
+
* @param {String} options.prop
|
|
1463
|
+
* @constructor
|
|
1464
|
+
*/
|
|
1465
|
+
|
|
1466
|
+
function FileDirective(options) {
|
|
1467
|
+
_classCallCheck(this, FileDirective);
|
|
1468
|
+
|
|
1469
|
+
extend(this, options);
|
|
1470
|
+
this.uploader._directives[this.prop].push(this);
|
|
1471
|
+
this._saveLinks();
|
|
1472
|
+
this.bind();
|
|
1473
|
+
}
|
|
1474
|
+
/**
|
|
1475
|
+
* Binds events handles
|
|
1476
|
+
*/
|
|
1477
|
+
|
|
1478
|
+
|
|
1479
|
+
FileDirective.prototype.bind = function bind() {
|
|
1480
|
+
for (var key in this.events) {
|
|
1481
|
+
var prop = this.events[key];
|
|
1482
|
+
this.element.bind(key, this[prop]);
|
|
1483
|
+
}
|
|
1484
|
+
};
|
|
1485
|
+
/**
|
|
1486
|
+
* Unbinds events handles
|
|
1487
|
+
*/
|
|
1488
|
+
|
|
1489
|
+
|
|
1490
|
+
FileDirective.prototype.unbind = function unbind() {
|
|
1491
|
+
for (var key in this.events) {
|
|
1492
|
+
this.element.unbind(key, this.events[key]);
|
|
1493
|
+
}
|
|
1494
|
+
};
|
|
1495
|
+
/**
|
|
1496
|
+
* Destroys directive
|
|
1497
|
+
*/
|
|
1498
|
+
|
|
1499
|
+
|
|
1500
|
+
FileDirective.prototype.destroy = function destroy() {
|
|
1501
|
+
var index = this.uploader._directives[this.prop].indexOf(this);
|
|
1502
|
+
this.uploader._directives[this.prop].splice(index, 1);
|
|
1503
|
+
this.unbind();
|
|
1504
|
+
// this.element = null;
|
|
1505
|
+
};
|
|
1506
|
+
/**
|
|
1507
|
+
* Saves links to functions
|
|
1508
|
+
* @private
|
|
1509
|
+
*/
|
|
1510
|
+
|
|
1511
|
+
|
|
1512
|
+
FileDirective.prototype._saveLinks = function _saveLinks() {
|
|
1513
|
+
for (var key in this.events) {
|
|
1514
|
+
var prop = this.events[key];
|
|
1515
|
+
this[prop] = this[prop].bind(this);
|
|
1516
|
+
}
|
|
1517
|
+
};
|
|
1518
|
+
|
|
1519
|
+
return FileDirective;
|
|
1520
|
+
}();
|
|
1521
|
+
|
|
1522
|
+
/**
|
|
1523
|
+
* Map of events
|
|
1524
|
+
* @type {Object}
|
|
1525
|
+
*/
|
|
1526
|
+
|
|
1527
|
+
|
|
1528
|
+
FileDirective.prototype.events = {};
|
|
1529
|
+
|
|
1530
|
+
return FileDirective;
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
/***/ },
|
|
1534
|
+
/* 7 */
|
|
1535
|
+
/***/ function(module, exports, __webpack_require__) {
|
|
1536
|
+
|
|
1537
|
+
'use strict';
|
|
1538
|
+
|
|
1539
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1540
|
+
value: true
|
|
1541
|
+
});
|
|
1542
|
+
exports.default = __identity;
|
|
1543
|
+
|
|
1544
|
+
var _config = __webpack_require__(1);
|
|
1545
|
+
|
|
1546
|
+
var _config2 = _interopRequireDefault(_config);
|
|
1547
|
+
|
|
1548
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1549
|
+
|
|
1550
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1551
|
+
|
|
1552
|
+
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; }
|
|
1553
|
+
|
|
1554
|
+
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; }
|
|
1555
|
+
|
|
1556
|
+
var _angular = angular;
|
|
1557
|
+
var extend = _angular.extend;
|
|
1558
|
+
function __identity($compile, FileDirective) {
|
|
1559
|
+
|
|
1560
|
+
return function (_FileDirective) {
|
|
1561
|
+
_inherits(FileSelect, _FileDirective);
|
|
1562
|
+
|
|
1563
|
+
/**
|
|
1564
|
+
* Creates instance of {FileSelect} object
|
|
1565
|
+
* @param {Object} options
|
|
1566
|
+
* @constructor
|
|
1567
|
+
*/
|
|
1568
|
+
|
|
1569
|
+
function FileSelect(options) {
|
|
1570
|
+
_classCallCheck(this, FileSelect);
|
|
1571
|
+
|
|
1572
|
+
var extendedOptions = extend(options, {
|
|
1573
|
+
// Map of events
|
|
1574
|
+
events: {
|
|
1575
|
+
$destroy: 'destroy',
|
|
1576
|
+
change: 'onChange'
|
|
1577
|
+
},
|
|
1578
|
+
// Name of property inside uploader._directive object
|
|
1579
|
+
prop: 'select'
|
|
1580
|
+
});
|
|
1581
|
+
|
|
1582
|
+
var _this = _possibleConstructorReturn(this, _FileDirective.call(this, extendedOptions));
|
|
1583
|
+
|
|
1584
|
+
if (!_this.uploader.isHTML5) {
|
|
1585
|
+
_this.element.removeAttr('multiple');
|
|
1586
|
+
}
|
|
1587
|
+
_this.element.prop('value', null); // FF fix
|
|
1588
|
+
return _this;
|
|
1589
|
+
}
|
|
1590
|
+
/**
|
|
1591
|
+
* Returns options
|
|
1592
|
+
* @return {Object|undefined}
|
|
1593
|
+
*/
|
|
1594
|
+
|
|
1595
|
+
|
|
1596
|
+
FileSelect.prototype.getOptions = function getOptions() {};
|
|
1597
|
+
/**
|
|
1598
|
+
* Returns filters
|
|
1599
|
+
* @return {Array<Function>|String|undefined}
|
|
1600
|
+
*/
|
|
1601
|
+
|
|
1602
|
+
|
|
1603
|
+
FileSelect.prototype.getFilters = function getFilters() {};
|
|
1604
|
+
/**
|
|
1605
|
+
* If returns "true" then HTMLInputElement will be cleared
|
|
1606
|
+
* @returns {Boolean}
|
|
1607
|
+
*/
|
|
1608
|
+
|
|
1609
|
+
|
|
1610
|
+
FileSelect.prototype.isEmptyAfterSelection = function isEmptyAfterSelection() {
|
|
1611
|
+
return !!this.element.attr('multiple');
|
|
1612
|
+
};
|
|
1613
|
+
/**
|
|
1614
|
+
* Event handler
|
|
1615
|
+
*/
|
|
1616
|
+
|
|
1617
|
+
|
|
1618
|
+
FileSelect.prototype.onChange = function onChange() {
|
|
1619
|
+
var files = this.uploader.isHTML5 ? this.element[0].files : this.element[0];
|
|
1620
|
+
var options = this.getOptions();
|
|
1621
|
+
var filters = this.getFilters();
|
|
1622
|
+
|
|
1623
|
+
if (!this.uploader.isHTML5) this.destroy();
|
|
1624
|
+
this.uploader.addToQueue(files, options, filters);
|
|
1625
|
+
if (this.isEmptyAfterSelection()) {
|
|
1626
|
+
this.element.prop('value', null);
|
|
1627
|
+
this.element.replaceWith($compile(this.element.clone())(this.scope)); // IE fix
|
|
1628
|
+
}
|
|
1629
|
+
};
|
|
1630
|
+
|
|
1631
|
+
return FileSelect;
|
|
1632
|
+
}(FileDirective);
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
__identity.$inject = ['$compile', 'FileDirective'];
|
|
1636
|
+
|
|
1637
|
+
/***/ },
|
|
1638
|
+
/* 8 */
|
|
1639
|
+
/***/ function(module, exports) {
|
|
1640
|
+
|
|
1641
|
+
'use strict';
|
|
1642
|
+
|
|
1643
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1644
|
+
value: true
|
|
1645
|
+
});
|
|
1646
|
+
exports.default = __identity;
|
|
1647
|
+
|
|
1648
|
+
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); } }
|
|
1649
|
+
|
|
1650
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1651
|
+
|
|
1652
|
+
var _angular = angular;
|
|
1653
|
+
var bind = _angular.bind;
|
|
1654
|
+
var isUndefined = _angular.isUndefined;
|
|
1655
|
+
function __identity($q) {
|
|
1656
|
+
|
|
1657
|
+
return function () {
|
|
1658
|
+
/**
|
|
1659
|
+
* @param {Array<Function>} pipes
|
|
1660
|
+
*/
|
|
1661
|
+
|
|
1662
|
+
function Pipeline() {
|
|
1663
|
+
var pipes = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
|
|
1664
|
+
|
|
1665
|
+
_classCallCheck(this, Pipeline);
|
|
1666
|
+
|
|
1667
|
+
this.pipes = pipes;
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1670
|
+
Pipeline.prototype.next = function next(args) {
|
|
1671
|
+
var pipe = this.pipes.shift();
|
|
1672
|
+
if (isUndefined(pipe)) {
|
|
1673
|
+
this.onSuccessful.apply(this, _toConsumableArray(args));
|
|
1674
|
+
return;
|
|
1675
|
+
}
|
|
1676
|
+
var err = new Error('The filter has not passed');
|
|
1677
|
+
err.pipe = pipe;
|
|
1678
|
+
err.args = args;
|
|
1679
|
+
if (pipe.isAsync) {
|
|
1680
|
+
var deferred = $q.defer();
|
|
1681
|
+
var onFulfilled = bind(this, this.next, args);
|
|
1682
|
+
var onRejected = bind(this, this.onThrown, err);
|
|
1683
|
+
deferred.promise.then(onFulfilled, onRejected);
|
|
1684
|
+
pipe.apply(undefined, _toConsumableArray(args).concat([deferred]));
|
|
1685
|
+
} else {
|
|
1686
|
+
var isDone = Boolean(pipe.apply(undefined, _toConsumableArray(args)));
|
|
1687
|
+
if (isDone) {
|
|
1688
|
+
this.next(args);
|
|
1689
|
+
} else {
|
|
1690
|
+
this.onThrown(err);
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
};
|
|
1694
|
+
|
|
1695
|
+
Pipeline.prototype.exec = function exec() {
|
|
1696
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
1697
|
+
args[_key] = arguments[_key];
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
this.next(args);
|
|
1701
|
+
};
|
|
1702
|
+
|
|
1703
|
+
Pipeline.prototype.onThrown = function onThrown(err) {};
|
|
1704
|
+
|
|
1705
|
+
Pipeline.prototype.onSuccessful = function onSuccessful() {};
|
|
1706
|
+
|
|
1707
|
+
return Pipeline;
|
|
1708
|
+
}();
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
__identity.$inject = ['$q'];
|
|
1712
|
+
|
|
1713
|
+
/***/ },
|
|
1714
|
+
/* 9 */
|
|
1715
|
+
/***/ function(module, exports, __webpack_require__) {
|
|
1716
|
+
|
|
1717
|
+
'use strict';
|
|
1718
|
+
|
|
1719
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1720
|
+
value: true
|
|
1721
|
+
});
|
|
1722
|
+
exports.default = __identity;
|
|
1723
|
+
|
|
1724
|
+
var _config = __webpack_require__(1);
|
|
1725
|
+
|
|
1726
|
+
var _config2 = _interopRequireDefault(_config);
|
|
1727
|
+
|
|
1728
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1729
|
+
|
|
1730
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1731
|
+
|
|
1732
|
+
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; }
|
|
1733
|
+
|
|
1734
|
+
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; }
|
|
1735
|
+
|
|
1736
|
+
var _angular = angular;
|
|
1737
|
+
var extend = _angular.extend;
|
|
1738
|
+
var forEach = _angular.forEach;
|
|
1739
|
+
function __identity(FileDirective) {
|
|
1740
|
+
|
|
1741
|
+
return function (_FileDirective) {
|
|
1742
|
+
_inherits(FileDrop, _FileDirective);
|
|
1743
|
+
|
|
1744
|
+
/**
|
|
1745
|
+
* Creates instance of {FileDrop} object
|
|
1746
|
+
* @param {Object} options
|
|
1747
|
+
* @constructor
|
|
1748
|
+
*/
|
|
1749
|
+
|
|
1750
|
+
function FileDrop(options) {
|
|
1751
|
+
_classCallCheck(this, FileDrop);
|
|
1752
|
+
|
|
1753
|
+
var extendedOptions = extend(options, {
|
|
1754
|
+
// Map of events
|
|
1755
|
+
events: {
|
|
1756
|
+
$destroy: 'destroy',
|
|
1757
|
+
drop: 'onDrop',
|
|
1758
|
+
dragover: 'onDragOver',
|
|
1759
|
+
dragleave: 'onDragLeave'
|
|
1760
|
+
},
|
|
1761
|
+
// Name of property inside uploader._directive object
|
|
1762
|
+
prop: 'drop'
|
|
1763
|
+
});
|
|
1764
|
+
|
|
1765
|
+
return _possibleConstructorReturn(this, _FileDirective.call(this, extendedOptions));
|
|
1766
|
+
}
|
|
1767
|
+
/**
|
|
1768
|
+
* Returns options
|
|
1769
|
+
* @return {Object|undefined}
|
|
1770
|
+
*/
|
|
1771
|
+
|
|
1772
|
+
|
|
1773
|
+
FileDrop.prototype.getOptions = function getOptions() {};
|
|
1774
|
+
/**
|
|
1775
|
+
* Returns filters
|
|
1776
|
+
* @return {Array<Function>|String|undefined}
|
|
1777
|
+
*/
|
|
1778
|
+
|
|
1779
|
+
|
|
1780
|
+
FileDrop.prototype.getFilters = function getFilters() {};
|
|
1781
|
+
/**
|
|
1782
|
+
* Event handler
|
|
1783
|
+
*/
|
|
1784
|
+
|
|
1785
|
+
|
|
1786
|
+
FileDrop.prototype.onDrop = function onDrop(event) {
|
|
1787
|
+
var transfer = this._getTransfer(event);
|
|
1788
|
+
if (!transfer) return;
|
|
1789
|
+
var options = this.getOptions();
|
|
1790
|
+
var filters = this.getFilters();
|
|
1791
|
+
this._preventAndStop(event);
|
|
1792
|
+
forEach(this.uploader._directives.over, this._removeOverClass, this);
|
|
1793
|
+
this.uploader.addToQueue(transfer.files, options, filters);
|
|
1794
|
+
};
|
|
1795
|
+
/**
|
|
1796
|
+
* Event handler
|
|
1797
|
+
*/
|
|
1798
|
+
|
|
1799
|
+
|
|
1800
|
+
FileDrop.prototype.onDragOver = function onDragOver(event) {
|
|
1801
|
+
var transfer = this._getTransfer(event);
|
|
1802
|
+
if (!this._haveFiles(transfer.types)) return;
|
|
1803
|
+
transfer.dropEffect = 'copy';
|
|
1804
|
+
this._preventAndStop(event);
|
|
1805
|
+
forEach(this.uploader._directives.over, this._addOverClass, this);
|
|
1806
|
+
};
|
|
1807
|
+
/**
|
|
1808
|
+
* Event handler
|
|
1809
|
+
*/
|
|
1810
|
+
|
|
1811
|
+
|
|
1812
|
+
FileDrop.prototype.onDragLeave = function onDragLeave(event) {
|
|
1813
|
+
if (event.currentTarget === this.element[0]) return;
|
|
1814
|
+
this._preventAndStop(event);
|
|
1815
|
+
forEach(this.uploader._directives.over, this._removeOverClass, this);
|
|
1816
|
+
};
|
|
1817
|
+
/**
|
|
1818
|
+
* Helper
|
|
1819
|
+
*/
|
|
1820
|
+
|
|
1821
|
+
|
|
1822
|
+
FileDrop.prototype._getTransfer = function _getTransfer(event) {
|
|
1823
|
+
return event.dataTransfer ? event.dataTransfer : event.originalEvent.dataTransfer; // jQuery fix;
|
|
1824
|
+
};
|
|
1825
|
+
/**
|
|
1826
|
+
* Helper
|
|
1827
|
+
*/
|
|
1828
|
+
|
|
1829
|
+
|
|
1830
|
+
FileDrop.prototype._preventAndStop = function _preventAndStop(event) {
|
|
1831
|
+
event.preventDefault();
|
|
1832
|
+
event.stopPropagation();
|
|
1833
|
+
};
|
|
1834
|
+
/**
|
|
1835
|
+
* Returns "true" if types contains files
|
|
1836
|
+
* @param {Object} types
|
|
1837
|
+
*/
|
|
1838
|
+
|
|
1839
|
+
|
|
1840
|
+
FileDrop.prototype._haveFiles = function _haveFiles(types) {
|
|
1841
|
+
if (!types) return false;
|
|
1842
|
+
if (types.indexOf) {
|
|
1843
|
+
return types.indexOf('Files') !== -1;
|
|
1844
|
+
} else if (types.contains) {
|
|
1845
|
+
return types.contains('Files');
|
|
1846
|
+
} else {
|
|
1847
|
+
return false;
|
|
1848
|
+
}
|
|
1849
|
+
};
|
|
1850
|
+
/**
|
|
1851
|
+
* Callback
|
|
1852
|
+
*/
|
|
1853
|
+
|
|
1854
|
+
|
|
1855
|
+
FileDrop.prototype._addOverClass = function _addOverClass(item) {
|
|
1856
|
+
item.addOverClass();
|
|
1857
|
+
};
|
|
1858
|
+
/**
|
|
1859
|
+
* Callback
|
|
1860
|
+
*/
|
|
1861
|
+
|
|
1862
|
+
|
|
1863
|
+
FileDrop.prototype._removeOverClass = function _removeOverClass(item) {
|
|
1864
|
+
item.removeOverClass();
|
|
1865
|
+
};
|
|
1866
|
+
|
|
1867
|
+
return FileDrop;
|
|
1868
|
+
}(FileDirective);
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
__identity.$inject = ['FileDirective'];
|
|
1872
|
+
|
|
1873
|
+
/***/ },
|
|
1874
|
+
/* 10 */
|
|
1875
|
+
/***/ function(module, exports, __webpack_require__) {
|
|
1876
|
+
|
|
1877
|
+
'use strict';
|
|
1878
|
+
|
|
1879
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1880
|
+
value: true
|
|
1881
|
+
});
|
|
1882
|
+
exports.default = __identity;
|
|
1883
|
+
|
|
1884
|
+
var _config = __webpack_require__(1);
|
|
1885
|
+
|
|
1886
|
+
var _config2 = _interopRequireDefault(_config);
|
|
1887
|
+
|
|
1888
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1889
|
+
|
|
1890
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1891
|
+
|
|
1892
|
+
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; }
|
|
1893
|
+
|
|
1894
|
+
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; }
|
|
1895
|
+
|
|
1896
|
+
var _angular = angular;
|
|
1897
|
+
var extend = _angular.extend;
|
|
1898
|
+
function __identity(FileDirective) {
|
|
1899
|
+
|
|
1900
|
+
return function (_FileDirective) {
|
|
1901
|
+
_inherits(FileOver, _FileDirective);
|
|
1902
|
+
|
|
1903
|
+
/**
|
|
1904
|
+
* Creates instance of {FileDrop} object
|
|
1905
|
+
* @param {Object} options
|
|
1906
|
+
* @constructor
|
|
1907
|
+
*/
|
|
1908
|
+
|
|
1909
|
+
function FileOver(options) {
|
|
1910
|
+
_classCallCheck(this, FileOver);
|
|
1911
|
+
|
|
1912
|
+
var extendedOptions = extend(options, {
|
|
1913
|
+
// Map of events
|
|
1914
|
+
events: {
|
|
1915
|
+
$destroy: 'destroy'
|
|
1916
|
+
},
|
|
1917
|
+
// Name of property inside uploader._directive object
|
|
1918
|
+
prop: 'over',
|
|
1919
|
+
// Over class
|
|
1920
|
+
overClass: 'nv-file-over'
|
|
1921
|
+
});
|
|
1922
|
+
|
|
1923
|
+
return _possibleConstructorReturn(this, _FileDirective.call(this, extendedOptions));
|
|
1924
|
+
}
|
|
1925
|
+
/**
|
|
1926
|
+
* Adds over class
|
|
1927
|
+
*/
|
|
1928
|
+
|
|
1929
|
+
|
|
1930
|
+
FileOver.prototype.addOverClass = function addOverClass() {
|
|
1931
|
+
this.element.addClass(this.getOverClass());
|
|
1932
|
+
};
|
|
1933
|
+
/**
|
|
1934
|
+
* Removes over class
|
|
1935
|
+
*/
|
|
1936
|
+
|
|
1937
|
+
|
|
1938
|
+
FileOver.prototype.removeOverClass = function removeOverClass() {
|
|
1939
|
+
this.element.removeClass(this.getOverClass());
|
|
1940
|
+
};
|
|
1941
|
+
/**
|
|
1942
|
+
* Returns over class
|
|
1943
|
+
* @returns {String}
|
|
1944
|
+
*/
|
|
1945
|
+
|
|
1946
|
+
|
|
1947
|
+
FileOver.prototype.getOverClass = function getOverClass() {
|
|
1948
|
+
return this.overClass;
|
|
1949
|
+
};
|
|
1950
|
+
|
|
1951
|
+
return FileOver;
|
|
1952
|
+
}(FileDirective);
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
__identity.$inject = ['FileDirective'];
|
|
1956
|
+
|
|
1957
|
+
/***/ },
|
|
1958
|
+
/* 11 */
|
|
1959
|
+
/***/ function(module, exports, __webpack_require__) {
|
|
1960
|
+
|
|
1961
|
+
'use strict';
|
|
1962
|
+
|
|
1963
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1964
|
+
value: true
|
|
1965
|
+
});
|
|
1966
|
+
exports.default = __identity;
|
|
1967
|
+
|
|
1968
|
+
var _config = __webpack_require__(1);
|
|
1969
|
+
|
|
1970
|
+
var _config2 = _interopRequireDefault(_config);
|
|
1971
|
+
|
|
1972
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1973
|
+
|
|
1974
|
+
function __identity($parse, FileUploader, FileSelect) {
|
|
1975
|
+
|
|
1976
|
+
return {
|
|
1977
|
+
link: function link(scope, element, attributes) {
|
|
1978
|
+
var uploader = scope.$eval(attributes.uploader);
|
|
1979
|
+
|
|
1980
|
+
if (!(uploader instanceof FileUploader)) {
|
|
1981
|
+
throw new TypeError('"Uploader" must be an instance of FileUploader');
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
var object = new FileSelect({
|
|
1985
|
+
uploader: uploader,
|
|
1986
|
+
element: element,
|
|
1987
|
+
scope: scope
|
|
1988
|
+
});
|
|
1989
|
+
|
|
1990
|
+
object.getOptions = $parse(attributes.options).bind(object, scope);
|
|
1991
|
+
object.getFilters = function () {
|
|
1992
|
+
return attributes.filters;
|
|
1993
|
+
};
|
|
1994
|
+
}
|
|
1995
|
+
};
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
__identity.$inject = ['$parse', 'FileUploader', 'FileSelect'];
|
|
1999
|
+
|
|
2000
|
+
/***/ },
|
|
2001
|
+
/* 12 */
|
|
2002
|
+
/***/ function(module, exports, __webpack_require__) {
|
|
2003
|
+
|
|
2004
|
+
'use strict';
|
|
2005
|
+
|
|
2006
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2007
|
+
value: true
|
|
2008
|
+
});
|
|
2009
|
+
exports.default = __identity;
|
|
2010
|
+
|
|
2011
|
+
var _config = __webpack_require__(1);
|
|
2012
|
+
|
|
2013
|
+
var _config2 = _interopRequireDefault(_config);
|
|
2014
|
+
|
|
2015
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2016
|
+
|
|
2017
|
+
function __identity($parse, FileUploader, FileDrop) {
|
|
2018
|
+
|
|
2019
|
+
return {
|
|
2020
|
+
link: function link(scope, element, attributes) {
|
|
2021
|
+
var uploader = scope.$eval(attributes.uploader);
|
|
2022
|
+
|
|
2023
|
+
if (!(uploader instanceof FileUploader)) {
|
|
2024
|
+
throw new TypeError('"Uploader" must be an instance of FileUploader');
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
if (!uploader.isHTML5) return;
|
|
2028
|
+
|
|
2029
|
+
var object = new FileDrop({
|
|
2030
|
+
uploader: uploader,
|
|
2031
|
+
element: element
|
|
2032
|
+
});
|
|
2033
|
+
|
|
2034
|
+
object.getOptions = $parse(attributes.options).bind(object, scope);
|
|
2035
|
+
object.getFilters = function () {
|
|
2036
|
+
return attributes.filters;
|
|
2037
|
+
};
|
|
2038
|
+
}
|
|
2039
|
+
};
|
|
2040
|
+
}
|
|
2041
|
+
|
|
2042
|
+
__identity.$inject = ['$parse', 'FileUploader', 'FileDrop'];
|
|
2043
|
+
|
|
2044
|
+
/***/ },
|
|
2045
|
+
/* 13 */
|
|
2046
|
+
/***/ function(module, exports, __webpack_require__) {
|
|
2047
|
+
|
|
2048
|
+
'use strict';
|
|
2049
|
+
|
|
2050
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2051
|
+
value: true
|
|
2052
|
+
});
|
|
2053
|
+
exports.default = __identity;
|
|
2054
|
+
|
|
2055
|
+
var _config = __webpack_require__(1);
|
|
2056
|
+
|
|
2057
|
+
var _config2 = _interopRequireDefault(_config);
|
|
2058
|
+
|
|
2059
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2060
|
+
|
|
2061
|
+
function __identity(FileUploader, FileOver) {
|
|
2062
|
+
|
|
2063
|
+
return {
|
|
2064
|
+
link: function link(scope, element, attributes) {
|
|
2065
|
+
var uploader = scope.$eval(attributes.uploader);
|
|
2066
|
+
|
|
2067
|
+
if (!(uploader instanceof FileUploader)) {
|
|
2068
|
+
throw new TypeError('"Uploader" must be an instance of FileUploader');
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
var object = new FileOver({
|
|
2072
|
+
uploader: uploader,
|
|
2073
|
+
element: element
|
|
2074
|
+
});
|
|
2075
|
+
|
|
2076
|
+
object.getOverClass = function () {
|
|
2077
|
+
return attributes.overClass || object.overClass;
|
|
2078
|
+
};
|
|
2079
|
+
}
|
|
2080
|
+
};
|
|
2081
|
+
}
|
|
2082
|
+
|
|
2083
|
+
__identity.$inject = ['FileUploader', 'FileOver'];
|
|
2084
|
+
|
|
2085
|
+
/***/ }
|
|
2086
|
+
/******/ ])
|
|
2087
|
+
});
|