{"version":3,"sources":["../../node_modules/tslib/tslib.es6.js","../../src/app/components/fileupload/fileupload.ts"],"names":["Object","create","__values","o","s","Symbol","iterator","m","i","call","length","next","value","done","TypeError","FileUpload","el","sanitizer","zone","http","cd","config","this","method","invalidFileSizeMessageSummary","invalidFileSizeMessageDetail","invalidFileTypeMessageSummary","invalidFileTypeMessageDetail","invalidFileLimitMessageDetail","invalidFileLimitMessageSummary","previewWidth","chooseIcon","uploadIcon","cancelIcon","showUploadButton","showCancelButton","mode","onBeforeUpload","EventEmitter","onSend","onUpload","onError","onClear","onRemove","onSelect","onProgress","uploadHandler","_files","progress","uploadedFileCount","defineProperty","prototype","files","file","validate","isImage","objectURL","bypassSecurityTrustUrl","window","URL","createObjectURL","push","ngAfterContentInit","_this","templates","forEach","item","getType","fileTemplate","template","contentTemplate","toolbarTemplate","ngAfterViewInit","runOutsideAngular","content","nativeElement","addEventListener","onDragOver","bind","choose","advancedFileInput","click","onFileSelect","event","type","isIE11","duplicateIEEvent","msgs","multiple","dataTransfer","target","isFileSelected","emit","originalEvent","currentFiles","fileLimit","checkFileLimit","hasFiles","auto","isFileLimitExceeded","upload","clearIEInput","clearInputElement","_b","_c","sFile","name","size","document","accept","isFileTypeValid","severity","summary","replace","detail","maxFileSize","formatSize","acceptableTypes","split","map","trim","acceptableTypes_1","acceptableTypes_1_1","isWildcard","getTypeClass","getFileExtension","toLowerCase","fileType","substring","indexOf","pop","test","onImageLoad","img","revokeObjectURL","src","customUpload","markForCheck","uploading","formData_1","FormData","formData","append","url","headers","reportProgress","observe","withCredentials","subscribe","HttpEventType","Sent","Response","clear","UploadProgress","Math","round","error","remove","index","splice","focus","isChooseDisabled","toString","basicFileInput","onDragEnter","e","disabled","stopPropagation","preventDefault","DomHandler","addClass","dragHighlight","onDragLeave","removeClass","onDrop","onFocus","onBlur","bytes","floor","log","parseFloat","pow","toFixed","onBasicUploaderClick","getBlockableElement","children","chooseLabel","getTranslation","TranslationKeys","CHOOSE","uploadLabel","UPLOAD","cancelLabel","CANCEL","ngOnDestroy","removeEventListener","Component","args","selector","changeDetection","ChangeDetectionStrategy","OnPush","encapsulation","ViewEncapsulation","None","ElementRef","DomSanitizer","NgZone","HttpClient","ChangeDetectorRef","PrimeNGConfig","Input","Output","ContentChildren","PrimeTemplate","ViewChild","NgModule","imports","CommonModule","SharedModule","ButtonModule","ProgressBarModule","MessagesModule","RippleModule","exports","declarations"],"mappings":";;;;;;;;;;;;;;oFAyG6BA,OAAOC,gBAYpBC,EAASC,GACrB,IAAIC,EAAsB,mBAAXC,QAAyBA,OAAOC,SAAUC,EAAIH,GAAKD,EAAEC,GAAII,EAAI,EAC5E,GAAID,EAAG,OAAOA,EAAEE,KAAKN,GACrB,GAAIA,GAAyB,iBAAbA,EAAEO,OAAqB,MAAO,CAC1CC,KAAM,WAEF,OADIR,GAAKK,GAAKL,EAAEO,SAAQP,OAAI,GACrB,CAAES,MAAOT,GAAKA,EAAEK,KAAMK,MAAOV,KAG5C,MAAM,IAAIW,UAAUV,EAAI,0BAA4B,mCAqE/BJ,OAAOC,wBCI5B,SAAAc,EAAoBC,EAAuBC,EAAgCC,EAAsBC,EAAyBC,EAA8BC,GAApIC,KAAAN,GAAAA,EAAuBM,KAAAL,UAAAA,EAAgCK,KAAAJ,KAAAA,EAAsBI,KAAAH,KAAAA,EAAyBG,KAAAF,GAAAA,EAA8BE,KAAAD,OAAAA,EA5H/IC,KAAAC,OAAiB,OAcjBD,KAAAE,8BAAwC,2BAExCF,KAAAG,6BAAuC,8BAEvCH,KAAAI,8BAAwC,2BAExCJ,KAAAK,6BAAuC,2BAEvCL,KAAAM,8BAAwC,wBAExCN,KAAAO,+BAAyC,qCAMzCP,KAAAQ,aAAuB,GAQvBR,KAAAS,WAAqB,aAErBT,KAAAU,WAAqB,eAErBV,KAAAW,WAAqB,cAErBX,KAAAY,kBAA4B,EAE5BZ,KAAAa,kBAA4B,EAE5Bb,KAAAc,KAAe,WAQdd,KAAAe,eAAoC,IAAIC,EAAAA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wBAEAA,EAAAA,sBAEAA,EAAAA,wBAEAA,EAAAA,oBAEAA,EAAAA,+BAEAA,EAAAA,2BAEAA,EAAAA,6CAEAA,EAAAA,4CAEAA,EAAAA,6CAEAA,EAAAA,4CAEAA,EAAAA,6CAEAA,EAAAA,8CAEAA,EAAAA,qBAEAA,EAAAA,0BAEAA,EAAAA,4BAEAA,EAAAA,2BAEAA,EAAAA,2BAEAA,EAAAA,2BAEAA,EAAAA,0BAEAA,EAAAA,0BAEAA,EAAAA,0BAEAA,EAAAA,gCAEAA,EAAAA,gCAEAA,EAAAA,oBAEAA,EAAAA,uBAEAA,EAAAA,4BAEAA,EAAAA,yBAEAA,EAAAA,8BAEAC,EAAAA,uBAEAA,EAAAA,yBAEAA,EAAAA,wBAEAA,EAAAA,wBAEAA,EAAAA,yBAEAA,EAAAA,yBAEAA,EAAAA,2BAEAA,EAAAA,8BAEAA,EAAAA,0BAEAC,EAAAA,gBAAehB,KAAA,CAACiB,EAAAA,0CAEhBC,EAAAA,UAASlB,KAAA,CAAC,6CAEVkB,EAAAA,UAASlB,KAAA,CAAC,mCAEVkB,EAAAA,UAASlB,KAAA,CAAC,0BAEVc,EAAAA,eA0ZL,iCALCK,EAAAA,SAAQnB,KAAA,CAAC,CACNoB,QAAS,CAACC,EAAAA,aAAaC,EAAAA,aAAaC,EAAAA,aAAaC,EAAAA,kBAAkBC,EAAAA,eAAeC,EAAAA,cAClFC,QAAS,CAACjN,EAAW4M,EAAAA,aAAaC,EAAAA,aAAaC,EAAAA,kBAAkBC,EAAAA,gBACjEG,aAAc,CAAClN","sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n 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;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n 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); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n 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; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n 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);\r\n 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); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import {NgModule,Component,OnDestroy,Input,Output,EventEmitter,TemplateRef,AfterViewInit,AfterContentInit,\n ContentChildren,QueryList,ViewChild,ElementRef,NgZone,ChangeDetectionStrategy, ViewEncapsulation, ChangeDetectorRef} from '@angular/core';\nimport {CommonModule} from '@angular/common';\nimport {DomSanitizer} from '@angular/platform-browser';\nimport {ButtonModule} from 'primeng/button';\nimport {MessagesModule} from 'primeng/messages';\nimport {ProgressBarModule} from 'primeng/progressbar';\nimport {DomHandler} from 'primeng/dom';\nimport {Message, TranslationKeys} from 'primeng/api';\nimport {PrimeTemplate,SharedModule,PrimeNGConfig} from 'primeng/api';\nimport {BlockableUI} from 'primeng/api';\nimport {RippleModule} from 'primeng/ripple'; \nimport {HttpClient, HttpEvent, HttpEventType, HttpHeaders} from \"@angular/common/http\";\n\n@Component({\n selector: 'p-fileUpload',\n template: `\n
\n
\n \n \n \n {{chooseButtonLabel}}\n \n\n \n \n\n \n
\n
\n \n\n \n\n
\n
\n
\n
\n
{{file.name}}
\n
{{formatSize(file.size)}}
\n
\n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n \n \n \n {{auto ? chooseButtonLabel : hasFiles() ? files[0].name : chooseLabel}}\n \n \n
\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styleUrls: ['./fileupload.css']\n})\nexport class FileUpload implements AfterViewInit,AfterContentInit,OnDestroy,BlockableUI {\n\n @Input() name: string;\n\n @Input() url: string;\n\n @Input() method: string = 'post';\n\n @Input() multiple: boolean;\n\n @Input() accept: string;\n\n @Input() disabled: boolean;\n\n @Input() auto: boolean;\n\n @Input() withCredentials: boolean;\n\n @Input() maxFileSize: number;\n\n @Input() invalidFileSizeMessageSummary: string = '{0}: Invalid file size, ';\n\n @Input() invalidFileSizeMessageDetail: string = 'maximum upload size is {0}.';\n\n @Input() invalidFileTypeMessageSummary: string = '{0}: Invalid file type, ';\n\n @Input() invalidFileTypeMessageDetail: string = 'allowed file types: {0}.';\n\n @Input() invalidFileLimitMessageDetail: string = 'limit is {0} at most.';\n\n @Input() invalidFileLimitMessageSummary: string = 'Maximum number of files exceeded, ';\n\n @Input() style: any;\n\n @Input() styleClass: string;\n\n @Input() previewWidth: number = 50;\n\n @Input() chooseLabel: string;\n\n @Input() uploadLabel: string;\n\n @Input() cancelLabel: string;\n\n @Input() chooseIcon: string = 'pi pi-plus';\n\n @Input() uploadIcon: string = 'pi pi-upload';\n\n @Input() cancelIcon: string = 'pi pi-times';\n\n @Input() showUploadButton: boolean = true;\n\n @Input() showCancelButton: boolean = true;\n\n @Input() mode: string = 'advanced';\n\n @Input() headers: HttpHeaders;\n \n @Input() customUpload: boolean;\n\n @Input() fileLimit: number;\n\n @Output() onBeforeUpload: EventEmitter = new EventEmitter();\n\n @Output() onSend: EventEmitter = new EventEmitter();\n\n @Output() onUpload: EventEmitter = new EventEmitter();\n\n @Output() onError: EventEmitter = new EventEmitter();\n\n @Output() onClear: EventEmitter = new EventEmitter();\n\n @Output() onRemove: EventEmitter = new EventEmitter();\n\n @Output() onSelect: EventEmitter = new EventEmitter();\n\n @Output() onProgress: EventEmitter = new EventEmitter();\n\n @Output() uploadHandler: EventEmitter = new EventEmitter();\n\n @ContentChildren(PrimeTemplate) templates: QueryList;\n\n @ViewChild('advancedfileinput') advancedFileInput: ElementRef;\n\n @ViewChild('basicfileinput') basicFileInput: ElementRef;\n\n @ViewChild('content') content: ElementRef;\n\n @Input() set files(files) {\n this._files = [];\n\n for(let i = 0; i < files.length; i++) {\n let file = files[i];\n\n if (this.validate(file)) {\n if (this.isImage(file)) {\n (file).objectURL = this.sanitizer.bypassSecurityTrustUrl((window.URL.createObjectURL(files[i])));\n }\n\n this._files.push(files[i]);\n }\n }\n }\n\n get files(): File[] {\n return this._files;\n }\n\n public _files: File[] = [];\n\n public progress: number = 0;\n\n public dragHighlight: boolean;\n\n public msgs: Message[];\n\n public fileTemplate: TemplateRef;\n\n public contentTemplate: TemplateRef;\n\n public toolbarTemplate: TemplateRef;\n\n public uploadedFileCount: number = 0;\n\n focus: boolean;\n\n uploading: boolean;\n\n duplicateIEEvent: boolean; // flag to recognize duplicate onchange event for file input\n\n constructor(private el: ElementRef, public sanitizer: DomSanitizer, public zone: NgZone, private http: HttpClient, public cd: ChangeDetectorRef, public config: PrimeNGConfig){}\n\n ngAfterContentInit() {\n this.templates.forEach((item) => {\n switch(item.getType()) {\n case 'file':\n this.fileTemplate = item.template;\n break;\n\n case 'content':\n this.contentTemplate = item.template;\n break;\n\n case 'toolbar':\n this.toolbarTemplate = item.template;\n break;\n\n default:\n this.fileTemplate = item.template;\n break;\n }\n });\n }\n\n ngAfterViewInit() {\n if (this.mode === 'advanced') {\n this.zone.runOutsideAngular(() => {\n if (this.content)\n this.content.nativeElement.addEventListener('dragover', this.onDragOver.bind(this));\n });\n }\n }\n\n choose() {\n this.advancedFileInput.nativeElement.click();\n }\n\n onFileSelect(event) {\n if (event.type !== 'drop' && this.isIE11() && this.duplicateIEEvent) {\n this.duplicateIEEvent = false;\n return;\n }\n\n this.msgs = [];\n if (!this.multiple) {\n this.files = [];\n }\n\n let files = event.dataTransfer ? event.dataTransfer.files : event.target.files;\n for(let i = 0; i < files.length; i++) {\n let file = files[i];\n\n if (!this.isFileSelected(file)){\n if (this.validate(file)) {\n if (this.isImage(file)) {\n file.objectURL = this.sanitizer.bypassSecurityTrustUrl((window.URL.createObjectURL(files[i])));\n }\n\n this.files.push(files[i]);\n }\n }\n }\n\n this.onSelect.emit({originalEvent: event, files: files, currentFiles: this.files});\n\n if (this.fileLimit && this.mode == \"advanced\") {\n this.checkFileLimit();\n }\n\n if (this.hasFiles() && this.auto && (!(this.mode === \"advanced\") || !this.isFileLimitExceeded())) {\n this.upload();\n }\n\n if (event.type !== 'drop' && this.isIE11()) {\n this.clearIEInput();\n } else {\n this.clearInputElement();\n }\n }\n\n isFileSelected(file: File): boolean{\n for(let sFile of this.files){\n if ((sFile.name + sFile.type + sFile.size) === (file.name + file.type+file.size)) {\n return true;\n }\n }\n\n return false;\n }\n\n isIE11() {\n return !!window['MSInputMethodContext'] && !!document['documentMode'];\n }\n\n validate(file: File): boolean {\n if (this.accept && !this.isFileTypeValid(file)) {\n this.msgs.push({\n severity: 'error',\n summary: this.invalidFileTypeMessageSummary.replace('{0}', file.name),\n detail: this.invalidFileTypeMessageDetail.replace('{0}', this.accept)\n });\n return false;\n }\n\n if (this.maxFileSize && file.size > this.maxFileSize) {\n this.msgs.push({\n severity: 'error',\n summary: this.invalidFileSizeMessageSummary.replace('{0}', file.name),\n detail: this.invalidFileSizeMessageDetail.replace('{0}', this.formatSize(this.maxFileSize))\n });\n return false;\n }\n\n return true;\n }\n\n private isFileTypeValid(file: File): boolean {\n let acceptableTypes = this.accept.split(',').map(type => type.trim());\n for(let type of acceptableTypes) {\n let acceptable = this.isWildcard(type) ? this.getTypeClass(file.type) === this.getTypeClass(type)\n : file.type == type || this.getFileExtension(file).toLowerCase() === type.toLowerCase();\n\n if (acceptable) {\n return true;\n }\n }\n\n return false;\n }\n\n getTypeClass(fileType: string): string {\n return fileType.substring(0, fileType.indexOf('/'));\n }\n\n isWildcard(fileType: string): boolean {\n return fileType.indexOf('*') !== -1;\n }\n\n getFileExtension(file: File): string {\n return '.' + file.name.split('.').pop();\n }\n\n isImage(file: File): boolean {\n return /^image\\//.test(file.type);\n }\n\n onImageLoad(img: any) {\n window.URL.revokeObjectURL(img.src);\n }\n\n upload() {\n if (this.customUpload) {\n if (this.fileLimit) {\n this.uploadedFileCount += this.files.length; \n }\n \n this.uploadHandler.emit({\n files: this.files\n });\n\n this.cd.markForCheck();\n }\n else {\n this.uploading = true;\n this.msgs = [];\n let formData = new FormData();\n\n this.onBeforeUpload.emit({\n 'formData': formData\n });\n\n for (let i = 0; i < this.files.length; i++) {\n formData.append(this.name, this.files[i], this.files[i].name);\n }\n\n this.http[this.method](this.url, formData, {\n headers: this.headers, reportProgress: true, observe: 'events', withCredentials: this.withCredentials\n }).subscribe( (event: HttpEvent) => {\n switch (event.type) {\n case HttpEventType.Sent:\n this.onSend.emit({\n originalEvent: event,\n 'formData': formData\n });\n break;\n case HttpEventType.Response:\n this.uploading = false;\n this.progress = 0;\n\n if (event['status'] >= 200 && event['status'] < 300) {\n if (this.fileLimit) {\n this.uploadedFileCount += this.files.length; \n }\n\n this.onUpload.emit({originalEvent: event, files: this.files});\n } else {\n this.onError.emit({files: this.files});\n }\n\n this.clear();\n break;\n case HttpEventType.UploadProgress: {\n if (event['loaded']) {\n this.progress = Math.round((event['loaded'] * 100) / event['total']);\n }\n\n this.onProgress.emit({originalEvent: event, progress: this.progress});\n break;\n }\n }\n\n this.cd.markForCheck();\n },\n error => {\n this.uploading = false;\n this.onError.emit({files: this.files, error: error});\n });\n }\n }\n\n clear() {\n this.files = [];\n this.onClear.emit();\n this.clearInputElement();\n this.cd.markForCheck();\n }\n\n remove(event: Event, index: number) {\n this.clearInputElement();\n this.onRemove.emit({originalEvent: event, file: this.files[index]});\n this.files.splice(index, 1);\n }\n\n isFileLimitExceeded() {\n if (this.fileLimit && this.fileLimit <= this.files.length + this.uploadedFileCount && this.focus) {\n this.focus = false;\n }\n\n return this.fileLimit && this.fileLimit < this.files.length + this.uploadedFileCount;\n }\n\n isChooseDisabled() {\n return this.fileLimit && this.fileLimit <= this.files.length + this.uploadedFileCount;\n }\n\n checkFileLimit() {\n if (this.isFileLimitExceeded()) {\n this.msgs.push({\n severity: 'error',\n summary: this.invalidFileLimitMessageSummary.replace('{0}', this.fileLimit.toString()),\n detail: this.invalidFileLimitMessageDetail.replace('{0}', this.fileLimit.toString())\n });\n }\n }\n\n clearInputElement() {\n if (this.advancedFileInput && this.advancedFileInput.nativeElement) {\n this.advancedFileInput.nativeElement.value = '';\n }\n\n if (this.basicFileInput && this.basicFileInput.nativeElement) {\n this.basicFileInput.nativeElement.value = '';\n }\n }\n\n clearIEInput() {\n if (this.advancedFileInput && this.advancedFileInput.nativeElement) {\n this.duplicateIEEvent = true; //IE11 fix to prevent onFileChange trigger again\n this.advancedFileInput.nativeElement.value = '';\n }\n }\n\n hasFiles(): boolean {\n return this.files && this.files.length > 0;\n }\n\n onDragEnter(e) {\n if (!this.disabled) {\n e.stopPropagation();\n e.preventDefault();\n }\n }\n\n onDragOver(e) {\n if (!this.disabled) {\n DomHandler.addClass(this.content.nativeElement, 'p-fileupload-highlight');\n this.dragHighlight = true;\n e.stopPropagation();\n e.preventDefault();\n }\n }\n\n onDragLeave(event) {\n if (!this.disabled) {\n DomHandler.removeClass(this.content.nativeElement, 'p-fileupload-highlight');\n }\n }\n\n onDrop(event) {\n if (!this.disabled) {\n DomHandler.removeClass(this.content.nativeElement, 'p-fileupload-highlight');\n event.stopPropagation();\n event.preventDefault();\n\n let files = event.dataTransfer ? event.dataTransfer.files : event.target.files;\n let allowDrop = this.multiple||(files && files.length === 1);\n\n if (allowDrop) {\n this.onFileSelect(event);\n }\n }\n }\n\n onFocus() {\n this.focus = true;\n }\n\n onBlur() {\n this.focus = false;\n }\n\n formatSize(bytes) {\n if (bytes == 0) {\n return '0 B';\n }\n let k = 1024,\n dm = 3,\n sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],\n i = Math.floor(Math.log(bytes) / Math.log(k));\n\n return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];\n }\n\n onBasicUploaderClick() {\n if (this.hasFiles())\n this.upload();\n else\n this.basicFileInput.nativeElement.click();\n }\n\n getBlockableElement(): HTMLElement {\n return this.el.nativeElement.children[0];\n }\n\n get chooseButtonLabel(): string {\n return this.chooseLabel || this.config.getTranslation(TranslationKeys.CHOOSE);\n }\n\n get uploadButtonLabel(): string {\n return this.uploadLabel || this.config.getTranslation(TranslationKeys.UPLOAD);\n }\n\n get cancelButtonLabel(): string {\n return this.cancelLabel || this.config.getTranslation(TranslationKeys.CANCEL);\n }\n\n ngOnDestroy() {\n if (this.content && this.content.nativeElement) {\n this.content.nativeElement.removeEventListener('dragover', this.onDragOver);\n }\n }\n}\n\n@NgModule({\n imports: [CommonModule,SharedModule,ButtonModule,ProgressBarModule,MessagesModule,RippleModule],\n exports: [FileUpload,SharedModule,ButtonModule,ProgressBarModule,MessagesModule],\n declarations: [FileUpload]\n})\nexport class FileUploadModule { }\n"]}