ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
16 lines (14 loc) • 27.7 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/keycodes"),require("@angular/common/http"),require("@angular/core"),require("ng-zorro-antd/core/logger"),require("rxjs"),require("rxjs/operators"),require("@angular/animations"),require("@angular/cdk/platform"),require("@angular/common"),require("ng-zorro-antd/core/util"),require("ng-zorro-antd/i18n"),require("@angular/forms"),require("ng-zorro-antd/icon"),require("ng-zorro-antd/progress"),require("ng-zorro-antd/tooltip")):"function"==typeof define&&define.amd?define("ng-zorro-antd/upload",["exports","@angular/cdk/keycodes","@angular/common/http","@angular/core","ng-zorro-antd/core/logger","rxjs","rxjs/operators","@angular/animations","@angular/cdk/platform","@angular/common","ng-zorro-antd/core/util","ng-zorro-antd/i18n","@angular/forms","ng-zorro-antd/icon","ng-zorro-antd/progress","ng-zorro-antd/tooltip"],t):t(((e=e||self)["ng-zorro-antd"]=e["ng-zorro-antd"]||{},e["ng-zorro-antd"].upload={}),e.ng.cdk.keycodes,e.ng.common.http,e.ng.core,e["ng-zorro-antd"].core.logger,e.rxjs,e.rxjs.operators,e.ng.animations,e.ng.cdk.platform,e.ng.common,e["ng-zorro-antd"].core.util,e["ng-zorro-antd"].i18n,e.ng.forms,e["ng-zorro-antd"].icon,e["ng-zorro-antd"].progress,e["ng-zorro-antd"].tooltip)}(this,(function(e,t,n,i,o,r,a,l,s,p,c,u,d,f,g,h){"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.
***************************************************************************** */var m=function(){return(m=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function y(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a}function v(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function z(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function w(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}var b=function(){function e(e){if(this.http=e,this.reqs={},this.destroy=!1,!e)throw new Error("Not found 'HttpClient', You can import 'HttpClientModule' in your root module.")}return e.prototype.onClick=function(){!this.options.disabled&&this.options.openFileDialogOnClick&&this.file.nativeElement.click()},e.prototype.onKeyDown=function(e){this.options.disabled||"Enter"!==e.key&&e.keyCode!==t.ENTER||this.onClick()},e.prototype.onFileDrop=function(e){var t=this;if(this.options.disabled||"dragover"===e.type)e.preventDefault();else{if(this.options.directory)this.traverseFileTree(e.dataTransfer.items);else{var n=Array.prototype.slice.call(e.dataTransfer.files).filter((function(e){return t.attrAccept(e,t.options.accept)}));n.length&&this.uploadFiles(n)}e.preventDefault()}},e.prototype.onChange=function(e){if(!this.options.disabled){var t=e.target;this.uploadFiles(t.files),t.value=""}},e.prototype.traverseFileTree=function(e){var t,n,i=this,o=function(e,t){if(e.isFile)e.file((function(e){i.attrAccept(e,i.options.accept)&&i.uploadFiles([e])}));else if(e.isDirectory){e.createReader().readEntries((function(n){var i,r;try{for(var a=z(n),l=a.next();!l.done;l=a.next()){var s=l.value;o(s,""+t+e.name+"/")}}catch(e){i={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}}))}};try{for(var r=z(e),a=r.next();!a.done;a=r.next()){var l=a.value;o(l.webkitGetAsEntry(),"")}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},e.prototype.attrAccept=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(","),i=""+e.name,o=""+e.type,r=o.replace(/\/.*$/,"");return n.some((function(e){var t=e.trim();return"."===t.charAt(0)?-1!==i.toLowerCase().indexOf(t.toLowerCase(),i.toLowerCase().length-t.toLowerCase().length):/\/\*$/.test(t)?r===t.replace(/\/.*$/,""):o===t}))}return!0},e.prototype.attachUid=function(e){return e.uid||(e.uid=Math.random().toString(36).substring(2)),e},e.prototype.uploadFiles=function(e){var t=this,n=r.of(Array.prototype.slice.call(e));this.options.filters&&this.options.filters.forEach((function(e){n=n.pipe(a.switchMap((function(t){var n=e.fn(t);return n instanceof r.Observable?n:r.of(n)})))})),n.subscribe((function(e){e.forEach((function(n){t.attachUid(n),t.upload(n,e)}))}),(function(e){o.warn("Unhandled upload filter error",e)}))},e.prototype.upload=function(e,t){var n=this;if(!this.options.beforeUpload)return this.post(e);var i=this.options.beforeUpload(e,t);if(i instanceof r.Observable)i.subscribe((function(t){var i=Object.prototype.toString.call(t);"[object File]"===i||"[object Blob]"===i?(n.attachUid(t),n.post(t)):"boolean"==typeof t&&!1!==t&&n.post(e)}),(function(e){o.warn("Unhandled upload beforeUpload error",e)}));else if(!1!==i)return this.post(e)},e.prototype.post=function(e){var t=this;if(!this.destroy){var n=r.of(e),i=this.options,l=e.uid,s=i.action,p=i.data,c=i.headers,u=i.transformFile,d={action:"string"==typeof s?s:"",name:i.name,headers:c,file:e,postFile:e,data:p,withCredentials:i.withCredentials,onProgress:i.onProgress?function(t){i.onProgress(t,e)}:void 0,onSuccess:function(n,o){t.clean(l),i.onSuccess(n,e,o)},onError:function(n){t.clean(l),i.onError(n,e)}};if("function"==typeof s){var f=s(e);f instanceof r.Observable?n=n.pipe(a.switchMap((function(){return f})),a.map((function(t){return d.action=t,e}))):d.action=f}if("function"==typeof u){var g=u(e);n=n.pipe(a.switchMap((function(){return g instanceof r.Observable?g:r.of(g)})))}if("function"==typeof p){var h=p(e);h instanceof r.Observable?n=n.pipe(a.switchMap((function(){return h})),a.map((function(t){return d.data=t,e}))):d.data=h}if("function"==typeof c){var m=c(e);m instanceof r.Observable?n=n.pipe(a.switchMap((function(){return m})),a.map((function(t){return d.headers=t,e}))):d.headers=m}n.subscribe((function(n){d.postFile=n;var a=(i.customRequest||t.xhr).call(t,d);a instanceof r.Subscription||o.warn("Must return Subscription type in '[nzCustomRequest]' property"),t.reqs[l]=a,i.onStart(e)}))}},e.prototype.xhr=function(e){var t=this,i=new FormData;e.data&&Object.keys(e.data).map((function(t){i.append(t,e.data[t])})),i.append(e.name,e.postFile),e.headers||(e.headers={}),null!==e.headers["X-Requested-With"]?e.headers["X-Requested-With"]="XMLHttpRequest":delete e.headers["X-Requested-With"];var o=new n.HttpRequest("POST",e.action,i,{reportProgress:!0,withCredentials:e.withCredentials,headers:new n.HttpHeaders(e.headers)});return this.http.request(o).subscribe((function(t){t.type===n.HttpEventType.UploadProgress?(t.total>0&&(t.percent=t.loaded/t.total*100),e.onProgress(t,e.file)):t instanceof n.HttpResponse&&e.onSuccess(t.body,e.file,t)}),(function(n){t.abort(e.file),e.onError(n,e.file)}))},e.prototype.clean=function(e){var t=this.reqs[e];t instanceof r.Subscription&&t.unsubscribe(),delete this.reqs[e]},e.prototype.abort=function(e){var t=this;e?this.clean(e&&e.uid):Object.keys(this.reqs).forEach((function(e){return t.clean(e)}))},e.prototype.ngOnDestroy=function(){this.destroy=!0,this.abort()},e.decorators=[{type:i.Component,args:[{selector:"[nz-upload-btn]",exportAs:"nzUploadBtn",template:'<input\n type="file"\n #file\n (change)="onChange($event)"\n [attr.accept]="options.accept"\n [attr.directory]="options.directory ? \'directory\' : null"\n [attr.webkitdirectory]="options.directory ? \'webkitdirectory\' : null"\n [multiple]="options.multiple"\n style="display: none;"\n/>\n<ng-content></ng-content>\n',host:{"[attr.tabindex]":'"0"',"[attr.role]":'"button"',"[class.ant-upload]":"true","[class.ant-upload-disabled]":"options.disabled","(click)":"onClick()","(keydown)":"onKeyDown($event)","(drop)":"onFileDrop($event)","(dragover)":"onFileDrop($event)"},preserveWhitespaces:!1,encapsulation:i.ViewEncapsulation.None}]}],e.ctorParameters=function(){return[{type:n.HttpClient,decorators:[{type:i.Optional}]}]},e.propDecorators={file:[{type:i.ViewChild,args:["file",{static:!1}]}],options:[{type:i.Input}]},e}();var I=function(e){return!!e&&0===e.indexOf("image/")};var C=function(){function e(e,t,n,i){this.cdr=e,this.doc=t,this.ngZone=n,this.platform=i,this.locale={}}return Object.defineProperty(e.prototype,"showPic",{get:function(){return"picture"===this.listType||"picture-card"===this.listType},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"items",{set:function(e){this.list=e},enumerable:!0,configurable:!0}),e.prototype.genErr=function(e){return e.response&&"string"==typeof e.response?e.response:e.error&&e.error.statusText||this.locale.uploadError},e.prototype.extname=function(e){var t=e.split("/"),n=t[t.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(n)||[""])[0]},e.prototype.isImageUrl=function(e){if(I(e.type))return!0;var t=e.thumbUrl||e.url||"";if(!t)return!1;var n=this.extname(t);return!(!/^data:image\//.test(t)&&!/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg)$/i.test(n))||!/^data:/.test(t)&&!n},e.prototype.getIconType=function(e){return this.showPic?e.isUploading||!e.thumbUrl&&!e.url?"uploading":"thumbnail":""},e.prototype.previewImage=function(e){var t=this;return new Promise((function(n){I(e.type)?t.ngZone.runOutsideAngular((function(){var i=t.doc.createElement("canvas");i.width=200,i.height=200,i.style.cssText="position: fixed; left: 0; top: 0; width: 200px; height: 200px; z-index: 9999; display: none;",t.doc.body.appendChild(i);var o=i.getContext("2d"),r=new Image;r.onload=function(){var e=r.width,a=r.height,l=200,s=200,p=0,c=0;e<a?c=-((s=a*(200/e))-l)/2:p=-((l=e*(200/a))-s)/2;try{o.drawImage(r,p,c,l,s)}catch(e){}var u=i.toDataURL();t.doc.body.removeChild(i),n(u)},r.src=window.URL.createObjectURL(e)})):n("")}))},e.prototype.genThumb=function(){var e=this;if(this.platform.isBrowser){var t=window;this.showPic&&"undefined"!=typeof document&&void 0!==t&&t.FileReader&&t.File&&this.list.filter((function(e){return e.originFileObj instanceof File&&void 0===e.thumbUrl})).forEach((function(t){t.thumbUrl="",(e.previewFile?e.previewFile(t).toPromise():e.previewImage(t.originFileObj)).then((function(n){t.thumbUrl=n,e.detectChanges()}))}))}},e.prototype.listItemNameCls=function(e){var t,n=[this.showDownload(e),this.icons.showRemoveIcon].filter((function(e){return e})).length;return(t={})["ant-upload-list-item-name"]=!0,t["ant-upload-list-item-name-icon-count-"+n]=!0,t},e.prototype.showDownload=function(e){return!(!this.icons.showDownloadIcon||"done"!==e.status)},e.prototype.fixData=function(){var e=this;this.list.forEach((function(t){t.message=e.genErr(t),t.linkProps="string"==typeof t.linkProps?JSON.parse(t.linkProps):t.linkProps,t.isImageUrl=e.isImageUrl(t),t.iconType=e.getIconType(t),t.isUploading="uploading"===t.status,t.listItemNameCls=e.listItemNameCls(t),t.showDownload=e.showDownload(t)}))},e.prototype.handlePreview=function(e,t){if(this.onPreview)return t.preventDefault(),this.onPreview(e)},e.prototype.handleRemove=function(e,t){t.preventDefault(),this.onRemove&&this.onRemove(e)},e.prototype.handleDownload=function(e){"function"==typeof this.onDownload?this.onDownload(e):e.url&&window.open(e.url)},e.prototype.detectChanges=function(){this.fixData(),this.cdr.detectChanges()},e.prototype.ngOnChanges=function(){this.fixData(),this.genThumb()},e.decorators=[{type:i.Component,args:[{selector:"nz-upload-list",exportAs:"nzUploadList",template:'<div\n *ngFor="let file of list"\n class="ant-upload-list-item ant-upload-list-item-{{\n file.status\n }} ant-upload-list-item-list-type-{{ listType }}"\n [attr.data-key]="file.key"\n @itemState\n nz-tooltip\n [nzTooltipTitle]="file.status === \'error\' ? file.message : null"\n>\n <ng-template #icon>\n <ng-container [ngSwitch]="file.iconType">\n <div\n *ngSwitchCase="\'uploading\'"\n class="ant-upload-list-item-thumbnail"\n [class.ant-upload-list-item-file]="!file.isUploading"\n >\n <ng-template\n [ngTemplateOutlet]="iconNode"\n [ngTemplateOutletContext]="{ $implicit: file }"\n ></ng-template>\n </div>\n <a\n *ngSwitchCase="\'thumbnail\'"\n class="ant-upload-list-item-thumbnail"\n [class.ant-upload-list-item-file]="!file.isImageUrl"\n target="_blank"\n rel="noopener noreferrer"\n [href]="file.url || file.thumbUrl"\n (click)="handlePreview(file, $event)"\n >\n <img\n *ngIf="file.isImageUrl; else noImageThumbTpl"\n class="ant-upload-list-item-image"\n [src]="file.thumbUrl || file.url"\n [attr.alt]="file.name"\n />\n </a>\n <span *ngSwitchDefault class="ant-upload-text-icon">\n <ng-template\n [ngTemplateOutlet]="iconNode"\n [ngTemplateOutletContext]="{ $implicit: file }"\n ></ng-template>\n </span>\n </ng-container>\n <ng-template #noImageThumbTpl>\n <ng-template\n [ngTemplateOutlet]="iconNode"\n [ngTemplateOutletContext]="{ $implicit: file }"\n ></ng-template>\n </ng-template>\n </ng-template>\n <ng-template #iconNode let-file>\n <ng-container *ngIf="!iconRender; else iconRender">\n <ng-container [ngSwitch]="listType">\n <ng-container *ngSwitchCase="\'picture\'">\n <ng-container *ngIf="file.isUploading; else iconNodeFileIcon">\n <i nz-icon nzType="loading"></i>\n </ng-container>\n </ng-container>\n <ng-container *ngSwitchCase="\'picture-card\'">\n <ng-container *ngIf="file.isUploading; else iconNodeFileIcon">{{\n locale.uploading\n }}</ng-container>\n </ng-container>\n <i *ngSwitchDefault nz-icon [nzType]="file.isUploading ? \'loading\' : \'paper-clip\'"></i>\n </ng-container>\n </ng-container>\n <ng-template #iconNodeFileIcon>\n <i nz-icon [nzType]="file.isImageUrl ? \'picture\' : \'file\'" nzTheme="twotone"></i>\n </ng-template>\n </ng-template>\n <ng-template #downloadOrDelete>\n <span\n *ngIf="listType !== \'picture-card\'"\n class="ant-upload-list-item-card-actions {{ listType === \'picture\' ? \'picture\' : \'\' }}"\n >\n <a *ngIf="file.showDownload" title="{{ locale.downloadFile }}">\n <ng-template [ngTemplateOutlet]="downloadIcon"></ng-template>\n </a>\n <a *ngIf="icons.showRemoveIcon" title="{{ locale.removeFile }}">\n <ng-template [ngTemplateOutlet]="removeIcon"></ng-template>\n </a>\n </span>\n </ng-template>\n <ng-template #preview>\n <a\n *ngIf="file.url"\n target="_blank"\n rel="noopener noreferrer"\n [ngClass]="file.listItemNameCls"\n title="{{ file.name }}"\n [href]="file.url"\n [attr.download]="file.linkProps && file.linkProps.download"\n (click)="handlePreview(file, $event)"\n >{{ file.name }}</a\n >\n <span\n *ngIf="!file.url"\n [ngClass]="file.listItemNameCls"\n title="{{ file.name }}"\n (click)="handlePreview(file, $event)"\n >{{ file.name }}</span\n >\n <ng-template [ngTemplateOutlet]="downloadOrDelete"></ng-template>\n </ng-template>\n <ng-template #removeIcon>\n <i\n *ngIf="icons.showRemoveIcon"\n (click)="handleRemove(file, $event)"\n nz-icon\n nzType="delete"\n title="{{ locale.removeFile }}"\n ></i>\n </ng-template>\n <ng-template #downloadIcon>\n <i\n *ngIf="file.showDownload"\n (click)="handleDownload(file)"\n nz-icon\n nzType="download"\n title="{{ locale.downloadFile }}"\n ></i>\n </ng-template>\n <div class="ant-upload-list-item-info">\n <span>\n <ng-template [ngTemplateOutlet]="icon"></ng-template>\n <ng-template [ngTemplateOutlet]="preview"></ng-template>\n </span>\n </div>\n <span\n *ngIf="listType === \'picture-card\' && !file.isUploading"\n class="ant-upload-list-item-actions"\n >\n <a\n *ngIf="icons.showPreviewIcon"\n [href]="file.url || file.thumbUrl"\n target="_blank"\n rel="noopener noreferrer"\n title="{{ locale.previewFile }}"\n [ngStyle]="!(file.url || file.thumbUrl) && { opacity: 0.5, \'pointer-events\': \'none\' }"\n (click)="handlePreview(file, $event)"\n >\n <i nz-icon nzType="eye"></i>\n </a>\n <ng-template [ngTemplateOutlet]="downloadIcon"></ng-template>\n <ng-template [ngTemplateOutlet]="removeIcon"></ng-template>\n </span>\n <div *ngIf="file.isUploading" class="ant-upload-list-item-progress">\n <nz-progress\n [nzPercent]="file.percent"\n nzType="line"\n [nzShowInfo]="false"\n [nzStrokeWidth]="2"\n ></nz-progress>\n </div>\n</div>\n',animations:[l.trigger("itemState",[l.transition(":enter",[l.style({height:"0",width:"0",opacity:0}),l.animate(150,l.style({height:"*",width:"*",opacity:1}))]),l.transition(":leave",[l.animate(150,l.style({height:"0",width:"0",opacity:0}))])])],host:{"[class.ant-upload-list]":"true","[class.ant-upload-list-text]":"listType === 'text'","[class.ant-upload-list-picture]":"listType === 'picture'","[class.ant-upload-list-picture-card]":"listType === 'picture-card'"},preserveWhitespaces:!1,encapsulation:i.ViewEncapsulation.None,changeDetection:i.ChangeDetectionStrategy.OnPush}]}],e.ctorParameters=function(){return[{type:i.ChangeDetectorRef},{type:void 0,decorators:[{type:i.Inject,args:[p.DOCUMENT]}]},{type:i.NgZone},{type:s.Platform}]},e.propDecorators={locale:[{type:i.Input}],listType:[{type:i.Input}],items:[{type:i.Input}],icons:[{type:i.Input}],onPreview:[{type:i.Input}],onRemove:[{type:i.Input}],onDownload:[{type:i.Input}],previewFile:[{type:i.Input}],iconRender:[{type:i.Input}]},e}();var O=function(){function e(e,t){var n=this;this.cdr=e,this.i18n=t,this.locale={},this.nzType="select",this.nzLimit=0,this.nzSize=0,this.nzDirectory=!1,this.nzOpenFileDialogOnClick=!0,this.nzFilter=[],this.nzFileList=[],this.nzDisabled=!1,this.nzListType="text",this.nzMultiple=!1,this.nzName="file",this._showUploadList=!0,this.nzShowButton=!0,this.nzWithCredentials=!1,this.nzChange=new i.EventEmitter,this.nzFileListChange=new i.EventEmitter,this.onStart=function(e){n.nzFileList||(n.nzFileList=[]);var t=n.fileToObject(e);t.status="uploading",n.nzFileList=n.nzFileList.concat(t),n.nzFileListChange.emit(n.nzFileList),n.nzChange.emit({file:t,fileList:n.nzFileList,type:"start"}),n.detectChangesList()},this.onProgress=function(e,t){var i=n.nzFileList,o=n.getFileItem(t,i);o.percent=e.percent,n.nzChange.emit({event:e,file:m({},o),fileList:n.nzFileList,type:"progress"}),n.detectChangesList()},this.onSuccess=function(e,t){var i=n.nzFileList,o=n.getFileItem(t,i);o.status="done",o.response=e,n.nzChange.emit({file:m({},o),fileList:i,type:"success"}),n.detectChangesList()},this.onError=function(e,t){var i=n.nzFileList,o=n.getFileItem(t,i);o.error=e,o.status="error",n.nzChange.emit({file:m({},o),fileList:i,type:"error"}),n.detectChangesList()},this.onRemove=function(e){n.uploadComp.abort(e),e.status="removed";var t="function"==typeof n.nzRemove?n.nzRemove(e):null==n.nzRemove||n.nzRemove;(t instanceof r.Observable?t:r.of(t)).pipe(a.filter((function(e){return e}))).subscribe((function(){n.nzFileList=n.removeFileItem(e,n.nzFileList),n.nzChange.emit({file:e,fileList:n.nzFileList,type:"removed"}),n.nzFileListChange.emit(n.nzFileList),n.cdr.detectChanges()}))},this.prefixCls="ant-upload",this.classList=[]}return Object.defineProperty(e.prototype,"nzShowUploadList",{get:function(){return this._showUploadList},set:function(e){this._showUploadList="boolean"==typeof e?c.toBoolean(e):e},enumerable:!0,configurable:!0}),e.prototype.zipOptions=function(){var e=this;"boolean"==typeof this.nzShowUploadList&&this.nzShowUploadList&&(this.nzShowUploadList={showPreviewIcon:!0,showRemoveIcon:!0,showDownloadIcon:!0});var t=this.nzFilter.slice();if(this.nzMultiple&&this.nzLimit>0&&-1===t.findIndex((function(e){return"limit"===e.name}))&&t.push({name:"limit",fn:function(t){return t.slice(-e.nzLimit)}}),this.nzSize>0&&-1===t.findIndex((function(e){return"size"===e.name}))&&t.push({name:"size",fn:function(t){return t.filter((function(t){return t.size/1024<=e.nzSize}))}}),this.nzFileType&&this.nzFileType.length>0&&-1===t.findIndex((function(e){return"type"===e.name}))){var n=this.nzFileType.split(",");t.push({name:"type",fn:function(e){return e.filter((function(e){return~n.indexOf(e.type)}))}})}return this._btnOptions={disabled:this.nzDisabled,accept:this.nzAccept,action:this.nzAction,directory:this.nzDirectory,openFileDialogOnClick:this.nzOpenFileDialogOnClick,beforeUpload:this.nzBeforeUpload,customRequest:this.nzCustomRequest,data:this.nzData,headers:this.nzHeaders,name:this.nzName,multiple:this.nzMultiple,withCredentials:this.nzWithCredentials,filters:t,transformFile:this.nzTransformFile,onStart:this.onStart,onProgress:this.onProgress,onSuccess:this.onSuccess,onError:this.onError},this},e.prototype.fileToObject=function(e){return{lastModified:e.lastModified,lastModifiedDate:e.lastModifiedDate,name:e.filename||e.name,size:e.size,type:e.type,uid:e.uid,response:e.response,error:e.error,percent:0,originFileObj:e}},e.prototype.getFileItem=function(e,t){return t.filter((function(t){return t.uid===e.uid}))[0]},e.prototype.removeFileItem=function(e,t){return t.filter((function(t){return t.uid!==e.uid}))},e.prototype.fileDrop=function(e){e.type!==this.dragState&&(this.dragState=e.type,this.setClassMap())},e.prototype.detectChangesList=function(){this.cdr.detectChanges(),this.listComp.detectChanges()},e.prototype.setClassMap=function(){var e=[];"drag"===this.nzType?(this.nzFileList.some((function(e){return"uploading"===e.status}))&&e.push(this.prefixCls+"-drag-uploading"),"dragover"===this.dragState&&e.push(this.prefixCls+"-drag-hover")):e=[this.prefixCls+"-select-"+this.nzListType],this.classList=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(w(arguments[t]));return e}([this.prefixCls,this.prefixCls+"-"+this.nzType],e,[this.nzDisabled&&this.prefixCls+"-disabled"||""]).filter((function(e){return!!e})),this.cdr.detectChanges()},e.prototype.ngOnInit=function(){var e=this;this.i18n$=this.i18n.localeChange.subscribe((function(){e.locale=e.i18n.getLocaleData("Upload"),e.detectChangesList()}))},e.prototype.ngOnChanges=function(){this.zipOptions().setClassMap()},e.prototype.ngOnDestroy=function(){this.i18n$.unsubscribe()},e.decorators=[{type:i.Component,args:[{selector:"nz-upload",exportAs:"nzUpload",template:'<ng-template #list>\n <nz-upload-list\n #listComp\n [style.display]="nzShowUploadList ? \'\' : \'none\'"\n [locale]="locale"\n [listType]="nzListType"\n [items]="nzFileList || []"\n [icons]="nzShowUploadList"\n [iconRender]="nzIconRender"\n [previewFile]="nzPreviewFile"\n [onPreview]="nzPreview"\n [onRemove]="onRemove"\n [onDownload]="nzDownload"\n ></nz-upload-list>\n</ng-template>\n<ng-template #con><ng-content></ng-content></ng-template>\n<ng-template #btn>\n <div [ngClass]="classList" [style.display]="nzShowButton ? \'\' : \'none\'">\n <div nz-upload-btn #uploadComp [options]="_btnOptions">\n <ng-template [ngTemplateOutlet]="con"></ng-template>\n </div>\n </div>\n</ng-template>\n<ng-container *ngIf="nzType === \'drag\'; else select">\n <div\n [ngClass]="classList"\n (drop)="fileDrop($event)"\n (dragover)="fileDrop($event)"\n (dragleave)="fileDrop($event)"\n >\n <div nz-upload-btn #uploadComp [options]="_btnOptions" class="ant-upload-btn">\n <div class="ant-upload-drag-container">\n <ng-template [ngTemplateOutlet]="con"></ng-template>\n </div>\n </div>\n </div>\n <ng-template [ngTemplateOutlet]="list"></ng-template>\n</ng-container>\n<ng-template #select>\n <ng-container *ngIf="nzListType === \'picture-card\'; else pic">\n <ng-template [ngTemplateOutlet]="list"></ng-template>\n <ng-template [ngTemplateOutlet]="btn"></ng-template>\n </ng-container>\n</ng-template>\n<ng-template #pic>\n <ng-template [ngTemplateOutlet]="btn"></ng-template>\n <ng-template [ngTemplateOutlet]="list"></ng-template>\n</ng-template>\n',preserveWhitespaces:!1,encapsulation:i.ViewEncapsulation.None,changeDetection:i.ChangeDetectionStrategy.OnPush,host:{"[class.ant-upload-picture-card-wrapper]":'nzListType === "picture-card"'}}]}],e.ctorParameters=function(){return[{type:i.ChangeDetectorRef},{type:u.NzI18nService}]},e.propDecorators={uploadComp:[{type:i.ViewChild,args:["uploadComp",{static:!1}]}],listComp:[{type:i.ViewChild,args:["listComp",{static:!1}]}],nzType:[{type:i.Input}],nzLimit:[{type:i.Input}],nzSize:[{type:i.Input}],nzFileType:[{type:i.Input}],nzAccept:[{type:i.Input}],nzAction:[{type:i.Input}],nzDirectory:[{type:i.Input}],nzOpenFileDialogOnClick:[{type:i.Input}],nzBeforeUpload:[{type:i.Input}],nzCustomRequest:[{type:i.Input}],nzData:[{type:i.Input}],nzFilter:[{type:i.Input}],nzFileList:[{type:i.Input}],nzDisabled:[{type:i.Input}],nzHeaders:[{type:i.Input}],nzListType:[{type:i.Input}],nzMultiple:[{type:i.Input}],nzName:[{type:i.Input}],nzShowUploadList:[{type:i.Input}],nzShowButton:[{type:i.Input}],nzWithCredentials:[{type:i.Input}],nzRemove:[{type:i.Input}],nzPreview:[{type:i.Input}],nzPreviewFile:[{type:i.Input}],nzTransformFile:[{type:i.Input}],nzDownload:[{type:i.Input}],nzIconRender:[{type:i.Input}],nzChange:[{type:i.Output}],nzFileListChange:[{type:i.Output}]},y([c.InputNumber(),v("design:type",Object)],e.prototype,"nzLimit",void 0),y([c.InputNumber(),v("design:type",Object)],e.prototype,"nzSize",void 0),y([c.InputBoolean(),v("design:type",Object)],e.prototype,"nzDirectory",void 0),y([c.InputBoolean(),v("design:type",Object)],e.prototype,"nzOpenFileDialogOnClick",void 0),y([c.InputBoolean(),v("design:type",Object)],e.prototype,"nzDisabled",void 0),y([c.InputBoolean(),v("design:type",Object)],e.prototype,"nzMultiple",void 0),y([c.InputBoolean(),v("design:type",Object)],e.prototype,"nzShowButton",void 0),y([c.InputBoolean(),v("design:type",Object)],e.prototype,"nzWithCredentials",void 0),e}();var T=function(){function e(){}return e.decorators=[{type:i.NgModule,args:[{imports:[p.CommonModule,d.FormsModule,s.PlatformModule,h.NzToolTipModule,g.NzProgressModule,u.NzI18nModule,f.NzIconModule],declarations:[O,b,C],exports:[O]}]}],e}();e.NzUploadBtnComponent=b,e.NzUploadComponent=O,e.NzUploadListComponent=C,e.NzUploadModule=T,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ng-zorro-antd-upload.umd.min.js.map