@progress/kendo-angular-upload
Version:
Kendo UI Angular Upload Component
98 lines (97 loc) • 4.09 kB
JavaScript
/**-----------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the project root for more information
*-------------------------------------------------------------------------------------------*/
import { Component, Input } from '@angular/core';
import { FileMap } from '../types/file-map';
import { FileState } from '../types';
import { LocalizationService } from '@progress/kendo-angular-l10n';
import { checkIcon, exclamationCircleIcon, pauseSmIcon, uploadIcon } from '@progress/kendo-svg-icons';
import { IconWrapperComponent } from '@progress/kendo-angular-icons';
import * as i0 from "@angular/core";
import * as i1 from "@progress/kendo-angular-l10n";
/**
* @hidden
*/
export class UploadStatusTotalComponent {
localization;
fileList;
isFailed;
isPaused;
isUploading;
statusText;
checkmarkIcon = checkIcon;
exceptionSVGIcon = exclamationCircleIcon;
uploadSVGIcon = uploadIcon;
pauseSVGIcon = pauseSmIcon;
constructor(localization) {
this.localization = localization;
}
get iconClass() {
if (!this.isUploading && !this.isFailed) {
return 'checkmark';
}
if (!this.isUploading && this.isFailed) {
return 'exception';
}
if (this.isUploading) {
return 'upload';
}
if (this.isPaused) {
return 'pause-sm';
}
}
get SVGIconClass() {
if (!this.isUploading && !this.isFailed) {
return this.checkmarkIcon;
}
if (!this.isUploading && this.isFailed) {
return this.exceptionSVGIcon;
}
if (this.isUploading) {
return this.uploadSVGIcon;
}
if (this.isPaused) {
return this.pauseSVGIcon;
}
}
ngDoCheck() {
this.isPaused = this.fileList.hasFileWithState([FileState.Paused]);
this.isFailed = this.fileList.hasFileWithState([FileState.Failed]);
this.isUploading = this.fileList.hasFileWithState([FileState.Uploading]);
if (this.isPaused && !this.isUploading) {
this.statusText = this.localization.get('headerStatusPaused');
}
else {
this.statusText = this.isUploading ? this.localization.get('headerStatusUploading')
: this.localization.get('headerStatusUploaded');
}
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UploadStatusTotalComponent, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: UploadStatusTotalComponent, isStandalone: true, selector: "kendo-upload-status-total", inputs: { fileList: "fileList" }, ngImport: i0, template: `
<kendo-icon-wrapper
[name]="iconClass"
[svgIcon]="SVGIconClass"
>
</kendo-icon-wrapper>
{{statusText}}
`, isInline: true, dependencies: [{ kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UploadStatusTotalComponent, decorators: [{
type: Component,
args: [{
selector: 'kendo-upload-status-total',
template: `
<kendo-icon-wrapper
[name]="iconClass"
[svgIcon]="SVGIconClass"
>
</kendo-icon-wrapper>
{{statusText}}
`,
standalone: true,
imports: [IconWrapperComponent]
}]
}], ctorParameters: function () { return [{ type: i1.LocalizationService }]; }, propDecorators: { fileList: [{
type: Input
}] } });