UNPKG

angular-material-datatransfer-lib

Version:

A HTML5 datatransfer UI for handling upload and download of multiple simultaneous files.

1,149 lines (1,115 loc) 225 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/material'), require('@angular/forms'), require('resumablejs'), require('crypto-browserify'), require('file-saver'), require('@angular/platform-browser'), require('@angular/platform-browser/animations'), require('@angular/flex-layout')) : typeof define === 'function' && define.amd ? define('angular-material-datatransfer-lib', ['exports', '@angular/core', '@angular/material', '@angular/forms', 'resumablejs', 'crypto-browserify', 'file-saver', '@angular/platform-browser', '@angular/platform-browser/animations', '@angular/flex-layout'], factory) : (global = global || self, factory(global['angular-material-datatransfer-lib'] = {}, global.ng.core, global.ng.material, global.ng.forms, global.Resumable, global.cryptoBrowserify, global.fileSaver, global.ng.platformBrowser, global.ng.platformBrowser.animations, global.ng['flex-layout'])); }(this, (function (exports, core, material, forms, Resumable, cryptoBrowserify, fileSaver, platformBrowser, animations, flexLayout) { 'use strict'; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __exportStar(m, exports) { for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } function __values(o) { var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; if (m) return m.call(o); return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result.default = mod; return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } /** * @fileoverview added by tsickle * Generated from: lib/enums/custom-event-type.enum.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @enum {number} */ var CustomEventType = { UNKNOWN: 0, // This event can be used to bootstrap the app module. An IAppConfig can be passed as detail payload. CREATE: 1, // This event can be used to trigger an item download. The filename, url and size can be passed as detail payload. DOWNLOAD_ITEM: 2, // This event can be used to update the app configuration. An IAppConfig can be passed as detail payload. UPDATE_CONFIG: 3, // Indicates that the app has been initialized. INIT: 4, // Indicates that the overall upload has been completed. UPLOAD_COMPLETED: 5, // Indicates that the overall download has been completed. DOWNLOAD_COMPLETED: 6, // Indicates that an item has been added. It will be passed a IDatatransferItem as detail payload. ITEM_ADDED: 7, // Indicates that an item has been removed. It will be passed a IDatatransferItem as detail payload. ITEM_REMOVED: 8, // Indicates that an item has been completed. ITEM_COMPLETED: 9, // Indicates that all items have been cleared. ITEMS_CLEARED: 10, }; CustomEventType[CustomEventType.UNKNOWN] = 'UNKNOWN'; CustomEventType[CustomEventType.CREATE] = 'CREATE'; CustomEventType[CustomEventType.DOWNLOAD_ITEM] = 'DOWNLOAD_ITEM'; CustomEventType[CustomEventType.UPDATE_CONFIG] = 'UPDATE_CONFIG'; CustomEventType[CustomEventType.INIT] = 'INIT'; CustomEventType[CustomEventType.UPLOAD_COMPLETED] = 'UPLOAD_COMPLETED'; CustomEventType[CustomEventType.DOWNLOAD_COMPLETED] = 'DOWNLOAD_COMPLETED'; CustomEventType[CustomEventType.ITEM_ADDED] = 'ITEM_ADDED'; CustomEventType[CustomEventType.ITEM_REMOVED] = 'ITEM_REMOVED'; CustomEventType[CustomEventType.ITEM_COMPLETED] = 'ITEM_COMPLETED'; CustomEventType[CustomEventType.ITEMS_CLEARED] = 'ITEMS_CLEARED'; // tslint:disable-next-line: no-namespace var CustomEventTypeExtensions; (function (CustomEventTypeExtensions) { /** @type {?} */ var CUSTOM_EVENT_TYPE_NS = 'github:niklr/angular-material-datatransfer.'; /** @type {?} */ var CUSTOM_EVENT_TYPE_UNKNOWN = CUSTOM_EVENT_TYPE_NS + 'unknown'; /** @type {?} */ var CUSTOM_EVENT_TYPE_CREATE = CUSTOM_EVENT_TYPE_NS + 'create'; /** @type {?} */ var CUSTOM_EVENT_TYPE_DOWNLOAD_ITEM = CUSTOM_EVENT_TYPE_NS + 'download-item'; /** @type {?} */ var CUSTOM_EVENT_TYPE_UPDATE_CONFIG = CUSTOM_EVENT_TYPE_NS + 'update-config'; /** @type {?} */ var CUSTOM_EVENT_TYPE_INIT = CUSTOM_EVENT_TYPE_NS + 'init'; /** @type {?} */ var CUSTOM_EVENT_TYPE_UPLOAD_COMPLETED = CUSTOM_EVENT_TYPE_NS + 'upload-completed'; /** @type {?} */ var CUSTOM_EVENT_TYPE_DOWNLOAD_COMPLETED = CUSTOM_EVENT_TYPE_NS + 'download-completed'; /** @type {?} */ var CUSTOM_EVENT_TYPE_ITEM_ADDED = CUSTOM_EVENT_TYPE_NS + 'item-added'; /** @type {?} */ var CUSTOM_EVENT_TYPE_ITEM_REMOVED = CUSTOM_EVENT_TYPE_NS + 'item-removed'; /** @type {?} */ var CUSTOM_EVENT_TYPE_ITEM_COMPLETED = CUSTOM_EVENT_TYPE_NS + 'item-completed'; /** @type {?} */ var CUSTOM_EVENT_TYPE_ITEMS_CLEARED = CUSTOM_EVENT_TYPE_NS + 'items-cleared'; /** * @param {?} type * @return {?} */ function toString(type) { switch (type) { case CustomEventType.CREATE: return CUSTOM_EVENT_TYPE_CREATE; case CustomEventType.DOWNLOAD_ITEM: return CUSTOM_EVENT_TYPE_DOWNLOAD_ITEM; case CustomEventType.UPDATE_CONFIG: return CUSTOM_EVENT_TYPE_UPDATE_CONFIG; case CustomEventType.INIT: return CUSTOM_EVENT_TYPE_INIT; case CustomEventType.UPLOAD_COMPLETED: return CUSTOM_EVENT_TYPE_UPLOAD_COMPLETED; case CustomEventType.DOWNLOAD_COMPLETED: return CUSTOM_EVENT_TYPE_DOWNLOAD_COMPLETED; case CustomEventType.ITEM_ADDED: return CUSTOM_EVENT_TYPE_ITEM_ADDED; case CustomEventType.ITEM_REMOVED: return CUSTOM_EVENT_TYPE_ITEM_REMOVED; case CustomEventType.ITEM_COMPLETED: return CUSTOM_EVENT_TYPE_ITEM_COMPLETED; case CustomEventType.ITEMS_CLEARED: return CUSTOM_EVENT_TYPE_ITEMS_CLEARED; default: return CUSTOM_EVENT_TYPE_UNKNOWN; } } CustomEventTypeExtensions.toString = toString; /** * @param {?} type * @return {?} */ function toEnum(type) { switch (type) { case CUSTOM_EVENT_TYPE_CREATE: return CustomEventType.CREATE; case CUSTOM_EVENT_TYPE_DOWNLOAD_ITEM: return CustomEventType.DOWNLOAD_ITEM; case CUSTOM_EVENT_TYPE_UPDATE_CONFIG: return CustomEventType.UPDATE_CONFIG; case CUSTOM_EVENT_TYPE_INIT: return CustomEventType.INIT; case CUSTOM_EVENT_TYPE_UPLOAD_COMPLETED: return CustomEventType.UPLOAD_COMPLETED; case CUSTOM_EVENT_TYPE_DOWNLOAD_COMPLETED: return CustomEventType.DOWNLOAD_COMPLETED; case CUSTOM_EVENT_TYPE_ITEM_ADDED: return CustomEventType.ITEM_ADDED; case CUSTOM_EVENT_TYPE_ITEM_REMOVED: return CustomEventType.ITEM_REMOVED; case CUSTOM_EVENT_TYPE_ITEM_COMPLETED: return CustomEventType.ITEM_COMPLETED; case CUSTOM_EVENT_TYPE_ITEMS_CLEARED: return CustomEventType.ITEMS_CLEARED; default: return CustomEventType.UNKNOWN; } } CustomEventTypeExtensions.toEnum = toEnum; })(CustomEventTypeExtensions || (CustomEventTypeExtensions = {})); /** * @fileoverview added by tsickle * Generated from: lib/directives/host.directive.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var HostDirective = /** @class */ (function () { function HostDirective(viewContainerRef) { this.viewContainerRef = viewContainerRef; } HostDirective.decorators = [ { type: core.Directive, args: [{ // tslint:disable-next-line: directive-selector selector: '[amd-host]', },] } ]; /** @nocollapse */ HostDirective.ctorParameters = function () { return [ { type: core.ViewContainerRef } ]; }; return HostDirective; }()); if (false) { /** @type {?} */ HostDirective.prototype.viewContainerRef; } /** * @fileoverview added by tsickle * Generated from: lib/models/app-config.model.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var CoreAppConfig = /** @class */ (function () { function CoreAppConfig() { this.showUploadDropzone = true; this.uploadBrowseElementId = undefined; this.uploadDropElementId = undefined; this.paginationRppOptions = [5, 10, 25]; this.simultaneousDownloads = 2; this.downloadMethod = 'GET'; this.downloadHeaders = {}; this.downloadWithCredentials = false; this.downloadXhrTimeout = 0; this.preprocessHashEnabled = false; this.preprocessHashChecked = true; this.preprocessHashTarget = 'https://httpbin.org'; this.preprocessHashMethod = 'GET'; this.preprocessHashParameterName = 'hash'; this.preprocessHashFileNameParameterName = 'filename'; this.preprocessHashFunctionName = 'sha1'; this.preprocessHashEncodingName = 'hex'; this.preprocessHashInputEncodingName = 'latin1'; this.preprocessHashTooltipContent = 'The preprocess option checks if the file is already on the system before uploading.'; this.parseMessageCallback = (/** * @param {?} message * @return {?} */ function (message) { return message; }); this.getTarget = (/** * @param {?} request * @param {?} params * @return {?} */ function (request, params) { /** @type {?} */ var target; if (request === 'preprocessHash' && this.preprocessHashChecked) { target = this.preprocessHashTarget; } if (typeof target === 'function') { return target(params); } if (target) { /** @type {?} */ var separator = target.indexOf('?') < 0 ? '?' : '&'; /** @type {?} */ var joinedParams = params.join('&'); return target + separator + joinedParams; } else { return; } }); } return CoreAppConfig; }()); if (false) { /** @type {?} */ CoreAppConfig.prototype.showUploadDropzone; /** @type {?} */ CoreAppConfig.prototype.uploadBrowseElementId; /** @type {?} */ CoreAppConfig.prototype.uploadDropElementId; /** @type {?} */ CoreAppConfig.prototype.paginationRppOptions; /** @type {?} */ CoreAppConfig.prototype.simultaneousDownloads; /** @type {?} */ CoreAppConfig.prototype.downloadMethod; /** @type {?} */ CoreAppConfig.prototype.downloadHeaders; /** @type {?} */ CoreAppConfig.prototype.downloadWithCredentials; /** @type {?} */ CoreAppConfig.prototype.downloadXhrTimeout; /** @type {?} */ CoreAppConfig.prototype.preprocessHashEnabled; /** @type {?} */ CoreAppConfig.prototype.preprocessHashChecked; /** @type {?} */ CoreAppConfig.prototype.preprocessHashTarget; /** @type {?} */ CoreAppConfig.prototype.preprocessHashMethod; /** @type {?} */ CoreAppConfig.prototype.preprocessHashParameterName; /** @type {?} */ CoreAppConfig.prototype.preprocessHashFileNameParameterName; /** @type {?} */ CoreAppConfig.prototype.preprocessHashFunctionName; /** @type {?} */ CoreAppConfig.prototype.preprocessHashEncodingName; /** @type {?} */ CoreAppConfig.prototype.preprocessHashInputEncodingName; /** @type {?} */ CoreAppConfig.prototype.preprocessHashTooltipContent; /** @type {?} */ CoreAppConfig.prototype.parseMessageCallback; /** @type {?} */ CoreAppConfig.prototype.getTarget; } var ResumableJsAppConfig = /** @class */ (function () { function ResumableJsAppConfig() { this.chunkSize = 1 * 1024 * 1024; this.forceChunkSize = false; this.simultaneousUploads = 3; this.fileParameterName = 'file'; this.chunkNumberParameterName = 'resumableChunkNumber'; this.chunkSizeParameterName = 'resumableChunkSize'; this.currentChunkSizeParameterName = 'resumableCurrentChunkSize'; this.totalSizeParameterName = 'resumableTotalSize'; this.typeParameterName = 'resumableType'; this.identifierParameterName = 'resumableIdentifier'; this.fileNameParameterName = 'resumableFilename'; this.relativePathParameterName = 'resumableRelativePath'; this.totalChunksParameterName = 'resumableTotalChunks'; this.throttleProgressCallbacks = 0.5; this.query = {}; this.headers = {}; this.preprocess = null; this.preprocessFile = null; this.method = 'multipart'; this.uploadMethod = 'POST'; this.testMethod = 'GET'; this.target = 'https://httpbin.org'; this.testTarget = null; this.parameterNamespace = ''; this.testChunks = true; this.generateUniqueIdentifier = null; this.getTarget = null; this.maxChunkRetries = 100; this.chunkRetryInterval = undefined; this.permanentErrors = [400, 404, 405, 415, 501]; this.maxFiles = undefined; this.withCredentials = false; this.xhrTimeout = 0; this.clearInput = true; this.chunkFormat = 'blob'; this.minFileSize = 1; this.maxFileSize = undefined; this.fileType = []; this.maxFilesErrorCallback = (/** * @param {?} files * @param {?} errorCount * @return {?} */ function (files, errorCount) { alert('Please upload no more than ' + this.maxFiles + ' file' + (this.maxFiles === 1 ? '' : 's') + ' at a time.'); }); this.minFileSizeErrorCallback = (/** * @param {?} file * @param {?} errorCount * @return {?} */ function (file, errorCount) { alert(file.fileName || file.name + ' is too small; please upload files larger than ' + this.minFileSize + '.'); }); this.maxFileSizeErrorCallback = (/** * @param {?} file * @param {?} errorCount * @return {?} */ function (file, errorCount) { alert(file.fileName || file.name + ' is too large; please upload files less than ' + this.maxFileSize + '.'); }); this.fileTypeErrorCallback = (/** * @param {?} file * @param {?} errorCount * @return {?} */ function (file, errorCount) { alert(file.fileName || file.name + ' has type not allowed; please upload files of type ' + this.fileType + '.'); }); } return ResumableJsAppConfig; }()); if (false) { /** @type {?} */ ResumableJsAppConfig.prototype.chunkSize; /** @type {?} */ ResumableJsAppConfig.prototype.forceChunkSize; /** @type {?} */ ResumableJsAppConfig.prototype.simultaneousUploads; /** @type {?} */ ResumableJsAppConfig.prototype.fileParameterName; /** @type {?} */ ResumableJsAppConfig.prototype.chunkNumberParameterName; /** @type {?} */ ResumableJsAppConfig.prototype.chunkSizeParameterName; /** @type {?} */ ResumableJsAppConfig.prototype.currentChunkSizeParameterName; /** @type {?} */ ResumableJsAppConfig.prototype.totalSizeParameterName; /** @type {?} */ ResumableJsAppConfig.prototype.typeParameterName; /** @type {?} */ ResumableJsAppConfig.prototype.identifierParameterName; /** @type {?} */ ResumableJsAppConfig.prototype.fileNameParameterName; /** @type {?} */ ResumableJsAppConfig.prototype.relativePathParameterName; /** @type {?} */ ResumableJsAppConfig.prototype.totalChunksParameterName; /** @type {?} */ ResumableJsAppConfig.prototype.throttleProgressCallbacks; /** @type {?} */ ResumableJsAppConfig.prototype.query; /** @type {?} */ ResumableJsAppConfig.prototype.headers; /** @type {?} */ ResumableJsAppConfig.prototype.preprocess; /** @type {?} */ ResumableJsAppConfig.prototype.preprocessFile; /** @type {?} */ ResumableJsAppConfig.prototype.method; /** @type {?} */ ResumableJsAppConfig.prototype.uploadMethod; /** @type {?} */ ResumableJsAppConfig.prototype.testMethod; /** @type {?} */ ResumableJsAppConfig.prototype.prioritizeFirstAndLastChunk; /** @type {?} */ ResumableJsAppConfig.prototype.target; /** @type {?} */ ResumableJsAppConfig.prototype.testTarget; /** @type {?} */ ResumableJsAppConfig.prototype.parameterNamespace; /** @type {?} */ ResumableJsAppConfig.prototype.testChunks; /** @type {?} */ ResumableJsAppConfig.prototype.generateUniqueIdentifier; /** @type {?} */ ResumableJsAppConfig.prototype.getTarget; /** @type {?} */ ResumableJsAppConfig.prototype.maxChunkRetries; /** @type {?} */ ResumableJsAppConfig.prototype.chunkRetryInterval; /** @type {?} */ ResumableJsAppConfig.prototype.permanentErrors; /** @type {?} */ ResumableJsAppConfig.prototype.maxFiles; /** @type {?} */ ResumableJsAppConfig.prototype.withCredentials; /** @type {?} */ ResumableJsAppConfig.prototype.xhrTimeout; /** @type {?} */ ResumableJsAppConfig.prototype.clearInput; /** @type {?} */ ResumableJsAppConfig.prototype.chunkFormat; /** @type {?} */ ResumableJsAppConfig.prototype.minFileSize; /** @type {?} */ ResumableJsAppConfig.prototype.maxFileSize; /** @type {?} */ ResumableJsAppConfig.prototype.fileType; /** @type {?} */ ResumableJsAppConfig.prototype.maxFilesErrorCallback; /** @type {?} */ ResumableJsAppConfig.prototype.minFileSizeErrorCallback; /** @type {?} */ ResumableJsAppConfig.prototype.maxFileSizeErrorCallback; /** @type {?} */ ResumableJsAppConfig.prototype.fileTypeErrorCallback; } /** * @record */ function IAppConfig() { } if (false) { /** @type {?} */ IAppConfig.prototype.production; /** @type {?} */ IAppConfig.prototype.core; /** @type {?} */ IAppConfig.prototype.resumablejs; } var AppConfig = /** @class */ (function () { function AppConfig() { this.production = true; this.core = new CoreAppConfig(); this.resumablejs = new ResumableJsAppConfig(); } return AppConfig; }()); if (false) { /** @type {?} */ AppConfig.prototype.production; /** @type {?} */ AppConfig.prototype.core; /** @type {?} */ AppConfig.prototype.resumablejs; } /** * @fileoverview added by tsickle * Generated from: lib/services/config.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ConfigService = /** @class */ (function () { function ConfigService() { } /** * @param {?} config * @return {?} */ ConfigService.prototype.load = /** * @param {?} config * @return {?} */ function (config) { if (!!config) { ConfigService.settings.production = config.production; if (!!config.core) { Object.keys(config.core).forEach((/** * @param {?} propertyName * @return {?} */ function (propertyName) { if (typeof config.core[propertyName] !== 'undefined') { ConfigService.settings.core[propertyName] = config.core[propertyName]; } })); } if (!!config.resumablejs) { Object.keys(config.resumablejs).forEach((/** * @param {?} propertyName * @return {?} */ function (propertyName) { if (typeof config.resumablejs[propertyName] !== 'undefined') { ConfigService.settings.resumablejs[propertyName] = config.resumablejs[propertyName]; } })); } } }; ConfigService.settings = new AppConfig(); ConfigService.decorators = [ { type: core.Injectable } ]; /** @nocollapse */ ConfigService.ctorParameters = function () { return []; }; return ConfigService; }()); if (false) { /** @type {?} */ ConfigService.settings; } /** * @fileoverview added by tsickle * Generated from: lib/enums/transfer-status.enum.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @enum {number} */ var TransferStatus = { Ready: 0, Queued: 1, Preprocessing: 2, Uploading: 3, Downloading: 4, Finished: 5, Failed: 6, }; TransferStatus[TransferStatus.Ready] = 'Ready'; TransferStatus[TransferStatus.Queued] = 'Queued'; TransferStatus[TransferStatus.Preprocessing] = 'Preprocessing'; TransferStatus[TransferStatus.Uploading] = 'Uploading'; TransferStatus[TransferStatus.Downloading] = 'Downloading'; TransferStatus[TransferStatus.Finished] = 'Finished'; TransferStatus[TransferStatus.Failed] = 'Failed'; /** * @fileoverview added by tsickle * Generated from: lib/enums/transfer-type.enum.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @enum {number} */ var TransferType = { Upload: 0, Download: 1, }; TransferType[TransferType.Upload] = 'Upload'; TransferType[TransferType.Download] = 'Download'; /** * @fileoverview added by tsickle * Generated from: lib/components/browse-dialog.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var BrowseDialogComponent = /** @class */ (function () { function BrowseDialogComponent(dialogRef, data) { this.dialogRef = dialogRef; this.data = data; this.datatransferFacade = (/** @type {?} */ (this.data.datatransferFacade)); } /** * @return {?} */ BrowseDialogComponent.prototype.ngAfterViewInit = /** * @return {?} */ function () { this.datatransferFacade.assignUploadBrowse(document.getElementById('amd-browse-files')); this.datatransferFacade.assignUploadBrowse(document.getElementById('amd-browse-folder'), true); }; /** * @return {?} */ BrowseDialogComponent.prototype.close = /** * @return {?} */ function () { this.dialogRef.close(); }; /** * @return {?} */ BrowseDialogComponent.prototype.onNoClick = /** * @return {?} */ function () { this.close(); }; BrowseDialogComponent.decorators = [ { type: core.Component, args: [{ // tslint:disable-next-line:component-selector selector: 'amd-browse-dialog', template: "<mat-dialog-content>Select specific files or a folder</mat-dialog-content>\r\n<mat-dialog-actions>\r\n <button mat-raised-button id=\"amd-browse-files\" (click)=\"close()\" tabindex=\"1\">\r\n <mat-icon>insert_drive_file</mat-icon> Files</button>\r\n <button mat-raised-button id=\"amd-browse-folder\" (click)=\"close()\" tabindex=\"2\">\r\n <mat-icon>folder_open</mat-icon> Folder</button>\r\n</mat-dialog-actions>" }] } ]; /** @nocollapse */ BrowseDialogComponent.ctorParameters = function () { return [ { type: material.MatDialogRef }, { type: undefined, decorators: [{ type: core.Inject, args: [material.MAT_DIALOG_DATA,] }] } ]; }; return BrowseDialogComponent; }()); if (false) { /** @type {?} */ BrowseDialogComponent.prototype.datatransferFacade; /** @type {?} */ BrowseDialogComponent.prototype.dialogRef; /** @type {?} */ BrowseDialogComponent.prototype.data; } /** * @fileoverview added by tsickle * Generated from: lib/components/edit-dialog.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var EditDialogComponent = /** @class */ (function () { function EditDialogComponent(dialogRef, data) { this.dialogRef = dialogRef; this.data = data; this.datatransferFacade = (/** @type {?} */ (this.data.datatransferFacade)); this.mode = this.data.mode; this.item = (/** @type {?} */ (this.data.item)); this.itemPath = this.item.path; this.itemName = this.item.name; this.editFormControl = new forms.FormControl('', []); } /** * @return {?} */ EditDialogComponent.prototype.ngAfterViewInit = /** * @return {?} */ function () { }; /** * @return {?} */ EditDialogComponent.prototype.close = /** * @return {?} */ function () { this.dialogRef.close(); }; /** * @return {?} */ EditDialogComponent.prototype.onNoClick = /** * @return {?} */ function () { this.close(); }; /** * @return {?} */ EditDialogComponent.prototype.editPath = /** * @return {?} */ function () { try { this.datatransferFacade.editPath(this.item, this.item.path, this.itemPath); this.close(); } catch (error) { this.errorMessage = error; } }; /** * @return {?} */ EditDialogComponent.prototype.editFilename = /** * @return {?} */ function () { try { this.datatransferFacade.editFilename(this.item, this.itemName); this.close(); } catch (error) { this.errorMessage = error; } }; EditDialogComponent.decorators = [ { type: core.Component, args: [{ // tslint:disable-next-line:component-selector selector: 'amd-edit-dialog', template: "<div *ngIf=\"mode === 'edit-path'\">\r\n <mat-dialog-content>\r\n <p>Enter a new path:</p>\r\n <form>\r\n <mat-form-field>\r\n <input matInput autocomplete=\"off\" tabindex=\"1\" [value]=\"itemPath\"\r\n (input)=\"itemPath = $event.target.value; errorMessage = undefined;\" [formControl]=\"editFormControl\">\r\n </mat-form-field>\r\n <mat-error *ngIf=\"errorMessage\">\r\n {{errorMessage}}\r\n </mat-error>\r\n </form>\r\n </mat-dialog-content>\r\n <mat-dialog-actions>\r\n <button mat-raised-button (click)=\"editPath()\" tabindex=\"2\">Ok</button>\r\n <button mat-raised-button (click)=\"close()\" tabindex=\"-1\">Cancel</button>\r\n </mat-dialog-actions>\r\n</div>\r\n<div *ngIf=\"mode === 'edit-filename'\">\r\n <mat-dialog-content>\r\n <p>Enter a new filename:</p>\r\n <form>\r\n <mat-form-field>\r\n <input matInput autocomplete=\"off\" tabindex=\"1\" [value]=\"itemName\"\r\n (input)=\"itemName = $event.target.value; errorMessage = undefined;\" [formControl]=\"editFormControl\">\r\n </mat-form-field>\r\n <mat-error *ngIf=\"errorMessage\">\r\n {{errorMessage}}\r\n </mat-error>\r\n </form>\r\n </mat-dialog-content>\r\n <mat-dialog-actions>\r\n <button mat-raised-button (click)=\"editFilename()\" tabindex=\"2\">Ok</button>\r\n <button mat-raised-button (click)=\"close()\" tabindex=\"-1\">Cancel</button>\r\n </mat-dialog-actions>\r\n</div>" }] } ]; /** @nocollapse */ EditDialogComponent.ctorParameters = function () { return [ { type: material.MatDialogRef }, { type: undefined, decorators: [{ type: core.Inject, args: [material.MAT_DIALOG_DATA,] }] } ]; }; return EditDialogComponent; }()); if (false) { /** @type {?} */ EditDialogComponent.prototype.datatransferFacade; /** @type {?} */ EditDialogComponent.prototype.mode; /** @type {?} */ EditDialogComponent.prototype.item; /** @type {?} */ EditDialogComponent.prototype.itemPath; /** @type {?} */ EditDialogComponent.prototype.itemName; /** @type {?} */ EditDialogComponent.prototype.errorMessage; /** @type {?} */ EditDialogComponent.prototype.editFormControl; /** @type {?} */ EditDialogComponent.prototype.dialogRef; /** @type {?} */ EditDialogComponent.prototype.data; } /** * @fileoverview added by tsickle * Generated from: lib/facades/datatransfer.facade.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var DatatransferFacade = /** @class */ (function () { function DatatransferFacade(logger, zone, store, dateUtil, paginationService, exportService, uploader, downloader, dialog) { this.logger = logger; this.zone = zone; this.store = store; this.dateUtil = dateUtil; this.paginationService = paginationService; this.exportService = exportService; this.uploader = uploader; this.downloader = downloader; this.dialog = dialog; // Interval in milliseconds to calculate progress: this.progressInterval = 200; // Interval in milliseconds to calculate bitrate: this.bitrateInterval = 1000; this.uploadProgress = this.store.uploadProgress; this.downloadProgress = this.store.downloadProgress; this.init(this.uploader, this.uploadProgress); this.init(this.downloader, this.downloadProgress); } /** * @private * @param {?} datatransfer * @param {?} progressContainer * @return {?} */ DatatransferFacade.prototype.init = /** * @private * @param {?} datatransfer * @param {?} progressContainer * @return {?} */ function (datatransfer, progressContainer) { datatransfer.on('itemAdded', (/** * @param {?} item * @return {?} */ function (item) { /** @type {?} */ var that = (/** @type {?} */ (this)); that.zone.run((/** * @return {?} */ function () { that.addItem(item); })); }).bind(this)); datatransfer.on('zoneUpdated', (/** * @param {?} item * @param {?} status * @param {?=} message * @return {?} */ function (item, status, message) { /** @type {?} */ var that = (/** @type {?} */ (this)); that.zone.run((/** * @return {?} */ function () { // console.log(that.uploader.isWorking()); })); }).bind(this)); datatransfer.on('itemStatusChanged', (/** * @param {?} item * @param {?} status * @param {?=} message * @return {?} */ function (item, status, message) { /** @type {?} */ var that = (/** @type {?} */ (this)); that.zone.run((/** * @return {?} */ function () { that.changeItemStatus(item, status, message); })); }).bind(this)); datatransfer.on('itemProgressUpdated', (/** * @param {?} item * @param {?} progress * @return {?} */ function (item, progress) { /** @type {?} */ var that = (/** @type {?} */ (this)); that.zone.run((/** * @return {?} */ function () { that.updateItemProgress(item, progress); })); }).bind(this)); datatransfer.on('overallProgressUpdated', (/** * @param {?} transferType * @param {?} progress * @return {?} */ function (transferType, progress) { /** @type {?} */ var that = (/** @type {?} */ (this)); that.zone.run((/** * @return {?} */ function () { that.updateOverallProgress(progressContainer, transferType, progress); })); }).bind(this)); datatransfer.on('overallSizeUpdated', (/** * @param {?} size * @return {?} */ function (size) { /** @type {?} */ var that = (/** @type {?} */ (this)); that.zone.run((/** * @return {?} */ function () { that.updateOverallSize(progressContainer, size); })); }).bind(this)); }; /** * @param {?} element * @param {?=} isDirectory * @return {?} */ DatatransferFacade.prototype.assignUploadBrowse = /** * @param {?} element * @param {?=} isDirectory * @return {?} */ function (element, isDirectory) { if (isDirectory === void 0) { isDirectory = false; } this.uploader.assignBrowse(element, isDirectory); }; /** * @param {?} element * @return {?} */ DatatransferFacade.prototype.assignUploadDrop = /** * @param {?} element * @return {?} */ function (element) { this.uploader.assignDrop(element); }; /** * @return {?} */ DatatransferFacade.prototype.openBrowseDialog = /** * @return {?} */ function () { /** @type {?} */ var dialogRef = this.dialog.open(BrowseDialogComponent, { data: { datatransferFacade: this } }); }; /** * @param {?} item * @return {?} */ DatatransferFacade.prototype.openEditPathDialog = /** * @param {?} item * @return {?} */ function (item) { /** @type {?} */ var dialogRef = this.dialog.open(EditDialogComponent, { data: { datatransferFacade: this, mode: 'edit-path', item: item } }); }; /** * @param {?} item * @return {?} */ DatatransferFacade.prototype.openEditFilenameDialog = /** * @param {?} item * @return {?} */ function (item) { /** @type {?} */ var dialogRef = this.dialog.open(EditDialogComponent, { data: { datatransferFacade: this, mode: 'edit-filename', item: item } }); }; /** * @param {?} checked * @return {?} */ DatatransferFacade.prototype.toggleVisible = /** * @param {?} checked * @return {?} */ function (checked) { this.paginationService.paginatedItems.forEach((/** * @param {?} item * @param {?} index * @return {?} */ function (item, index) { item.isSelected = checked; })); }; /** * @return {?} */ DatatransferFacade.prototype.startAll = /** * @return {?} */ function () { var _this = this;