@progress/kendo-angular-upload 21.4.1 → 22.0.0-develop.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/base.d.ts +1 -1
- package/dropzone-base.d.ts +1 -1
- package/fesm2022/progress-kendo-angular-upload.mjs +89 -89
- package/localization/messages.d.ts +1 -1
- package/package.json +13 -21
- package/rendering/file-list-item-base.d.ts +1 -1
- package/schematics/ngAdd/index.js +3 -3
- package/esm2022/common/action-buttons-layout.mjs +0 -5
- package/esm2022/common/base.mjs +0 -280
- package/esm2022/common/fileselect-settings.mjs +0 -5
- package/esm2022/common/util.mjs +0 -253
- package/esm2022/common/validation-util.mjs +0 -60
- package/esm2022/directives.mjs +0 -89
- package/esm2022/dropzone-base.mjs +0 -69
- package/esm2022/dropzone-external.directive.mjs +0 -111
- package/esm2022/dropzone-internal.directive.mjs +0 -109
- package/esm2022/dropzone.component.mjs +0 -169
- package/esm2022/dropzone.service.mjs +0 -37
- package/esm2022/events/cancel-event.mjs +0 -35
- package/esm2022/events/clear-event.mjs +0 -29
- package/esm2022/events/error-event.mjs +0 -48
- package/esm2022/events/pause-event.mjs +0 -38
- package/esm2022/events/preventable-event.mjs +0 -25
- package/esm2022/events/remove-event.mjs +0 -49
- package/esm2022/events/resume-event.mjs +0 -38
- package/esm2022/events/select-event.mjs +0 -37
- package/esm2022/events/success-event.mjs +0 -49
- package/esm2022/events/upload-event.mjs +0 -49
- package/esm2022/events/upload-progress-event.mjs +0 -41
- package/esm2022/events.mjs +0 -14
- package/esm2022/file-select.directive.mjs +0 -136
- package/esm2022/fileselect.component.mjs +0 -452
- package/esm2022/fileselect.module.mjs +0 -41
- package/esm2022/index.mjs +0 -31
- package/esm2022/localization/custom-messages.component.mjs +0 -70
- package/esm2022/localization/localized-messages.directive.mjs +0 -43
- package/esm2022/localization/messages.mjs +0 -185
- package/esm2022/navigation.service.mjs +0 -151
- package/esm2022/package-metadata.mjs +0 -16
- package/esm2022/progress-kendo-angular-upload.mjs +0 -8
- package/esm2022/rendering/file-list-item-action-button.component.mjs +0 -230
- package/esm2022/rendering/file-list-item-base.mjs +0 -52
- package/esm2022/rendering/file-list-item.mjs +0 -115
- package/esm2022/rendering/file-list-multiple-items.component.mjs +0 -201
- package/esm2022/rendering/file-list-single-item.component.mjs +0 -181
- package/esm2022/rendering/file-list.component.mjs +0 -189
- package/esm2022/rendering/upload-action-buttons.component.mjs +0 -126
- package/esm2022/rendering/upload-status-total.component.mjs +0 -97
- package/esm2022/templates/file-info-template.directive.mjs +0 -39
- package/esm2022/templates/file-template.directive.mjs +0 -39
- package/esm2022/types/async-settings.mjs +0 -5
- package/esm2022/types/chunk-info.mjs +0 -5
- package/esm2022/types/chunk-map.mjs +0 -35
- package/esm2022/types/chunk-metadata.mjs +0 -5
- package/esm2022/types/chunk-settings.mjs +0 -5
- package/esm2022/types/direction.mjs +0 -5
- package/esm2022/types/file-groups.mjs +0 -60
- package/esm2022/types/file-info.mjs +0 -5
- package/esm2022/types/file-map.mjs +0 -144
- package/esm2022/types/file-restrictions.mjs +0 -5
- package/esm2022/types/file-state.mjs +0 -34
- package/esm2022/types/operation-type.mjs +0 -5
- package/esm2022/types.mjs +0 -6
- package/esm2022/upload.component.mjs +0 -901
- package/esm2022/upload.module.mjs +0 -43
- package/esm2022/upload.service.mjs +0 -431
- package/esm2022/uploads.module.mjs +0 -66
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Directive, ElementRef, HostBinding, HostListener, Input } from '@angular/core';
|
|
6
|
-
import { FileState } from '../types';
|
|
7
|
-
import { NavigationService } from '../navigation.service';
|
|
8
|
-
import { filesHaveValidationErrors, hasClasses, IGNORE_TARGET_CLASSES, isFocusable } from '../common/util';
|
|
9
|
-
import { UploadService } from '../upload.service';
|
|
10
|
-
import * as i0 from "@angular/core";
|
|
11
|
-
import * as i1 from "../navigation.service";
|
|
12
|
-
import * as i2 from "../upload.service";
|
|
13
|
-
/**
|
|
14
|
-
* @hidden
|
|
15
|
-
*/
|
|
16
|
-
export class FileListItemDirective {
|
|
17
|
-
navigationService;
|
|
18
|
-
uploadService;
|
|
19
|
-
files;
|
|
20
|
-
index;
|
|
21
|
-
fileClass = true;
|
|
22
|
-
focused = false;
|
|
23
|
-
element;
|
|
24
|
-
constructor(el, navigationService, uploadService) {
|
|
25
|
-
this.navigationService = navigationService;
|
|
26
|
-
this.uploadService = uploadService;
|
|
27
|
-
this.element = el;
|
|
28
|
-
}
|
|
29
|
-
focus() {
|
|
30
|
-
this.element.nativeElement.focus();
|
|
31
|
-
}
|
|
32
|
-
get uidAttribute() {
|
|
33
|
-
return this.files[0].uid;
|
|
34
|
-
}
|
|
35
|
-
get tabIndex() {
|
|
36
|
-
return this.navigationService.focusedFileIndex === this.index ? '0' : '-1';
|
|
37
|
-
}
|
|
38
|
-
get kFileError() {
|
|
39
|
-
return this.files[0].state === FileState.Failed;
|
|
40
|
-
}
|
|
41
|
-
get kFileInvalid() {
|
|
42
|
-
return filesHaveValidationErrors(this.files);
|
|
43
|
-
}
|
|
44
|
-
get kFileProgress() {
|
|
45
|
-
return this.files[0].state === FileState.Uploading ||
|
|
46
|
-
this.files[0].state === FileState.Paused;
|
|
47
|
-
}
|
|
48
|
-
get kFileSuccess() {
|
|
49
|
-
if (this.uploadService.component === 'Upload') {
|
|
50
|
-
return this.files[0].state === FileState.Uploaded ||
|
|
51
|
-
this.files[0].state === FileState.Initial;
|
|
52
|
-
}
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
get kStateFocused() {
|
|
56
|
-
return this.focused;
|
|
57
|
-
}
|
|
58
|
-
onFocus() {
|
|
59
|
-
this.focused = true;
|
|
60
|
-
}
|
|
61
|
-
onBlur() {
|
|
62
|
-
this.focused = false;
|
|
63
|
-
}
|
|
64
|
-
onClick(event) {
|
|
65
|
-
if ((!isFocusable(event.target) && !hasClasses(event.target, IGNORE_TARGET_CLASSES)) || !!event.target.closest('.k-upload-action')) {
|
|
66
|
-
this.navigationService.focusedIndex = this.navigationService.focusedFileIndex = this.index;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FileListItemDirective, deps: [{ token: i0.ElementRef }, { token: i1.NavigationService }, { token: i2.UploadService }], target: i0.ɵɵFactoryTarget.Directive });
|
|
70
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: FileListItemDirective, isStandalone: true, selector: "[kendoUploadFileListItem]", inputs: { files: "files", index: "index" }, host: { listeners: { "focus": "onFocus()", "blur": "onBlur()", "click": "onClick($event)" }, properties: { "class.k-file": "this.fileClass", "attr.data-uid": "this.uidAttribute", "attr.tabIndex": "this.tabIndex", "class.k-file-error": "this.kFileError", "class.k-file-invalid": "this.kFileInvalid", "class.k-file-progress": "this.kFileProgress", "class.k-file-success": "this.kFileSuccess", "class.k-focus": "this.kStateFocused" } }, ngImport: i0 });
|
|
71
|
-
}
|
|
72
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FileListItemDirective, decorators: [{
|
|
73
|
-
type: Directive,
|
|
74
|
-
args: [{
|
|
75
|
-
selector: '[kendoUploadFileListItem]',
|
|
76
|
-
standalone: true
|
|
77
|
-
}]
|
|
78
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.NavigationService }, { type: i2.UploadService }], propDecorators: { files: [{
|
|
79
|
-
type: Input
|
|
80
|
-
}], index: [{
|
|
81
|
-
type: Input
|
|
82
|
-
}], fileClass: [{
|
|
83
|
-
type: HostBinding,
|
|
84
|
-
args: ['class.k-file']
|
|
85
|
-
}], uidAttribute: [{
|
|
86
|
-
type: HostBinding,
|
|
87
|
-
args: ['attr.data-uid']
|
|
88
|
-
}], tabIndex: [{
|
|
89
|
-
type: HostBinding,
|
|
90
|
-
args: ['attr.tabIndex']
|
|
91
|
-
}], kFileError: [{
|
|
92
|
-
type: HostBinding,
|
|
93
|
-
args: ['class.k-file-error']
|
|
94
|
-
}], kFileInvalid: [{
|
|
95
|
-
type: HostBinding,
|
|
96
|
-
args: ['class.k-file-invalid']
|
|
97
|
-
}], kFileProgress: [{
|
|
98
|
-
type: HostBinding,
|
|
99
|
-
args: ['class.k-file-progress']
|
|
100
|
-
}], kFileSuccess: [{
|
|
101
|
-
type: HostBinding,
|
|
102
|
-
args: ['class.k-file-success']
|
|
103
|
-
}], kStateFocused: [{
|
|
104
|
-
type: HostBinding,
|
|
105
|
-
args: ['class.k-focus']
|
|
106
|
-
}], onFocus: [{
|
|
107
|
-
type: HostListener,
|
|
108
|
-
args: ['focus']
|
|
109
|
-
}], onBlur: [{
|
|
110
|
-
type: HostListener,
|
|
111
|
-
args: ['blur']
|
|
112
|
-
}], onClick: [{
|
|
113
|
-
type: HostListener,
|
|
114
|
-
args: ['click', ['$event']]
|
|
115
|
-
}] } });
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Input, Component } from '@angular/core';
|
|
6
|
-
import { FileState } from '../types';
|
|
7
|
-
import { FileListItemBase } from './file-list-item-base';
|
|
8
|
-
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
9
|
-
import { UploadService } from '../upload.service';
|
|
10
|
-
import { isPresent } from '../common/util';
|
|
11
|
-
import { FileInfoTemplateDirective } from '../templates/file-info-template.directive';
|
|
12
|
-
import { animate, state, style, transition, trigger } from '@angular/animations';
|
|
13
|
-
import { copyIcon } from '@progress/kendo-svg-icons';
|
|
14
|
-
import { FileListItemActionButtonComponent } from './file-list-item-action-button.component';
|
|
15
|
-
import { NgClass, NgTemplateOutlet } from '@angular/common';
|
|
16
|
-
import { IconWrapperComponent } from '@progress/kendo-angular-icons';
|
|
17
|
-
import { ProgressBarComponent } from '@progress/kendo-angular-progressbar';
|
|
18
|
-
import * as i0 from "@angular/core";
|
|
19
|
-
import * as i1 from "@progress/kendo-angular-l10n";
|
|
20
|
-
import * as i2 from "../upload.service";
|
|
21
|
-
/**
|
|
22
|
-
* @hidden
|
|
23
|
-
*/
|
|
24
|
-
export class FileListMultipleItemsComponent extends FileListItemBase {
|
|
25
|
-
localization;
|
|
26
|
-
disabled;
|
|
27
|
-
files;
|
|
28
|
-
fileInfoTemplate;
|
|
29
|
-
filesHaveErrors;
|
|
30
|
-
copySVGIcon = copyIcon;
|
|
31
|
-
constructor(localization, uploadService) {
|
|
32
|
-
super(uploadService);
|
|
33
|
-
this.localization = localization;
|
|
34
|
-
this.subscribeUploadProgress((args) => {
|
|
35
|
-
if (args.files[0].uid === this.files[0].uid) {
|
|
36
|
-
this.progressComplete = args.percentComplete;
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
get showProgress() {
|
|
41
|
-
const showProgress = this.files[0].state === FileState.Uploading || this.files[0].state === FileState.Paused;
|
|
42
|
-
return showProgress ? 'active' : 'inactive';
|
|
43
|
-
}
|
|
44
|
-
ngOnInit() {
|
|
45
|
-
this.filesHaveErrors = super.filesHaveValidationErrors(this.files);
|
|
46
|
-
}
|
|
47
|
-
fileStatusText(file) {
|
|
48
|
-
const errors = file.validationErrors;
|
|
49
|
-
if (!isPresent(errors)) {
|
|
50
|
-
return this.getTotalFilesSizeMessage([file]);
|
|
51
|
-
}
|
|
52
|
-
return this.getFileValidationMessage(file);
|
|
53
|
-
}
|
|
54
|
-
get batchStatusText() {
|
|
55
|
-
const state = this.files[0].state;
|
|
56
|
-
const fileCount = this.files.length;
|
|
57
|
-
if (state === FileState.Uploaded) {
|
|
58
|
-
return `${fileCount} ${this.textFor('filesBatchStatusUploaded')}`;
|
|
59
|
-
}
|
|
60
|
-
if (state === FileState.Failed) {
|
|
61
|
-
return `${fileCount} ${this.textFor('filesBatchStatusFailed')}`;
|
|
62
|
-
}
|
|
63
|
-
return `${fileCount} ${this.textFor('filesBatchStatus')}`;
|
|
64
|
-
}
|
|
65
|
-
get isUploadSuccessful() {
|
|
66
|
-
return this.files[0].state === FileState.Uploaded;
|
|
67
|
-
}
|
|
68
|
-
get isUploadFailed() {
|
|
69
|
-
return this.files[0].state === FileState.Failed;
|
|
70
|
-
}
|
|
71
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FileListMultipleItemsComponent, deps: [{ token: i1.LocalizationService }, { token: i2.UploadService }], target: i0.ɵɵFactoryTarget.Component });
|
|
72
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: FileListMultipleItemsComponent, isStandalone: true, selector: "kendo-upload-file-list-multiple-items", inputs: { disabled: "disabled", files: "files", fileInfoTemplate: "fileInfoTemplate" }, usesInheritance: true, ngImport: i0, template: `
|
|
73
|
-
<kendo-progressbar
|
|
74
|
-
[@progressState]="showProgress"
|
|
75
|
-
[value]="progressComplete"
|
|
76
|
-
[label]="{ visible: false }"
|
|
77
|
-
>
|
|
78
|
-
</kendo-progressbar>
|
|
79
|
-
<span class="k-file-icon-wrapper">
|
|
80
|
-
<kendo-icon-wrapper
|
|
81
|
-
name="copy"
|
|
82
|
-
size="xxlarge"
|
|
83
|
-
[svgIcon]="copySVGIcon"
|
|
84
|
-
innerCssClass="k-file-icon"
|
|
85
|
-
>
|
|
86
|
-
</kendo-icon-wrapper>
|
|
87
|
-
</span>
|
|
88
|
-
<span class="k-multiple-files-wrapper">
|
|
89
|
-
@if (!fileInfoTemplate) {
|
|
90
|
-
@for (file of files; track file) {
|
|
91
|
-
<span class="k-file-info">
|
|
92
|
-
<span [title]="file.name" class="k-file-name">
|
|
93
|
-
{{file.name}}
|
|
94
|
-
</span>
|
|
95
|
-
<span [attr.aria-live]="'polite'" [ngClass]="{
|
|
96
|
-
'k-file-validation-message': file.validationErrors,
|
|
97
|
-
'k-file-size': !file.validationErrors
|
|
98
|
-
}"
|
|
99
|
-
>{{fileStatusText(file)}}</span>
|
|
100
|
-
</span>
|
|
101
|
-
}
|
|
102
|
-
<span class="k-file-summary"
|
|
103
|
-
>{{batchStatusText}}</span>
|
|
104
|
-
}
|
|
105
|
-
@if (fileInfoTemplate) {
|
|
106
|
-
<ng-container
|
|
107
|
-
[ngTemplateOutlet]="fileInfoTemplate.templateRef"
|
|
108
|
-
[ngTemplateOutletContext]="{
|
|
109
|
-
templateRef: fileInfoTemplate.templateRef,
|
|
110
|
-
state: files[0].state,
|
|
111
|
-
$implicit: files
|
|
112
|
-
}"></ng-container>
|
|
113
|
-
}
|
|
114
|
-
</span>
|
|
115
|
-
<kendo-upload-file-list-item-action-button
|
|
116
|
-
[file]='files[0]'
|
|
117
|
-
[disabled]='disabled'
|
|
118
|
-
[progress]='progressComplete'>
|
|
119
|
-
</kendo-upload-file-list-item-action-button>
|
|
120
|
-
`, isInline: true, dependencies: [{ kind: "component", type: ProgressBarComponent, selector: "kendo-progressbar", inputs: ["label", "progressCssStyle", "progressCssClass", "emptyCssStyle", "emptyCssClass", "animation"], outputs: ["animationEnd"], exportAs: ["kendoProgressBar"] }, { kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: FileListItemActionButtonComponent, selector: "kendo-upload-file-list-item-action-button", inputs: ["file", "disabled", "progress"] }], animations: [
|
|
121
|
-
trigger('progressState', [
|
|
122
|
-
state('active', style({ opacity: 1 })),
|
|
123
|
-
state('inactive', style({ opacity: 0 })),
|
|
124
|
-
transition('void => active', style({ opacity: 0 })),
|
|
125
|
-
transition('inactive => active', style({ opacity: 1 })),
|
|
126
|
-
transition('active => inactive', animate('1s 2s ease-out'))
|
|
127
|
-
])
|
|
128
|
-
] });
|
|
129
|
-
}
|
|
130
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FileListMultipleItemsComponent, decorators: [{
|
|
131
|
-
type: Component,
|
|
132
|
-
args: [{
|
|
133
|
-
animations: [
|
|
134
|
-
trigger('progressState', [
|
|
135
|
-
state('active', style({ opacity: 1 })),
|
|
136
|
-
state('inactive', style({ opacity: 0 })),
|
|
137
|
-
transition('void => active', style({ opacity: 0 })),
|
|
138
|
-
transition('inactive => active', style({ opacity: 1 })),
|
|
139
|
-
transition('active => inactive', animate('1s 2s ease-out'))
|
|
140
|
-
])
|
|
141
|
-
],
|
|
142
|
-
selector: 'kendo-upload-file-list-multiple-items',
|
|
143
|
-
template: `
|
|
144
|
-
<kendo-progressbar
|
|
145
|
-
[@progressState]="showProgress"
|
|
146
|
-
[value]="progressComplete"
|
|
147
|
-
[label]="{ visible: false }"
|
|
148
|
-
>
|
|
149
|
-
</kendo-progressbar>
|
|
150
|
-
<span class="k-file-icon-wrapper">
|
|
151
|
-
<kendo-icon-wrapper
|
|
152
|
-
name="copy"
|
|
153
|
-
size="xxlarge"
|
|
154
|
-
[svgIcon]="copySVGIcon"
|
|
155
|
-
innerCssClass="k-file-icon"
|
|
156
|
-
>
|
|
157
|
-
</kendo-icon-wrapper>
|
|
158
|
-
</span>
|
|
159
|
-
<span class="k-multiple-files-wrapper">
|
|
160
|
-
@if (!fileInfoTemplate) {
|
|
161
|
-
@for (file of files; track file) {
|
|
162
|
-
<span class="k-file-info">
|
|
163
|
-
<span [title]="file.name" class="k-file-name">
|
|
164
|
-
{{file.name}}
|
|
165
|
-
</span>
|
|
166
|
-
<span [attr.aria-live]="'polite'" [ngClass]="{
|
|
167
|
-
'k-file-validation-message': file.validationErrors,
|
|
168
|
-
'k-file-size': !file.validationErrors
|
|
169
|
-
}"
|
|
170
|
-
>{{fileStatusText(file)}}</span>
|
|
171
|
-
</span>
|
|
172
|
-
}
|
|
173
|
-
<span class="k-file-summary"
|
|
174
|
-
>{{batchStatusText}}</span>
|
|
175
|
-
}
|
|
176
|
-
@if (fileInfoTemplate) {
|
|
177
|
-
<ng-container
|
|
178
|
-
[ngTemplateOutlet]="fileInfoTemplate.templateRef"
|
|
179
|
-
[ngTemplateOutletContext]="{
|
|
180
|
-
templateRef: fileInfoTemplate.templateRef,
|
|
181
|
-
state: files[0].state,
|
|
182
|
-
$implicit: files
|
|
183
|
-
}"></ng-container>
|
|
184
|
-
}
|
|
185
|
-
</span>
|
|
186
|
-
<kendo-upload-file-list-item-action-button
|
|
187
|
-
[file]='files[0]'
|
|
188
|
-
[disabled]='disabled'
|
|
189
|
-
[progress]='progressComplete'>
|
|
190
|
-
</kendo-upload-file-list-item-action-button>
|
|
191
|
-
`,
|
|
192
|
-
standalone: true,
|
|
193
|
-
imports: [ProgressBarComponent, IconWrapperComponent, NgClass, NgTemplateOutlet, FileListItemActionButtonComponent]
|
|
194
|
-
}]
|
|
195
|
-
}], ctorParameters: () => [{ type: i1.LocalizationService }, { type: i2.UploadService }], propDecorators: { disabled: [{
|
|
196
|
-
type: Input
|
|
197
|
-
}], files: [{
|
|
198
|
-
type: Input
|
|
199
|
-
}], fileInfoTemplate: [{
|
|
200
|
-
type: Input
|
|
201
|
-
}] } });
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Input, Component } from '@angular/core';
|
|
6
|
-
import { FileState } from '../types';
|
|
7
|
-
import { FileListItemBase } from './file-list-item-base';
|
|
8
|
-
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
9
|
-
import { UploadService } from '../upload.service';
|
|
10
|
-
import { fileGroupClass, isPresent, fileSVGGroupIcon } from '../common/util';
|
|
11
|
-
import { FileInfoTemplateDirective } from '../templates/file-info-template.directive';
|
|
12
|
-
import { animate, state, style, transition, trigger } from '@angular/animations';
|
|
13
|
-
import { FileListItemActionButtonComponent } from './file-list-item-action-button.component';
|
|
14
|
-
import { NgClass, NgTemplateOutlet } from '@angular/common';
|
|
15
|
-
import { IconWrapperComponent } from '@progress/kendo-angular-icons';
|
|
16
|
-
import { ProgressBarComponent } from '@progress/kendo-angular-progressbar';
|
|
17
|
-
import * as i0 from "@angular/core";
|
|
18
|
-
import * as i1 from "@progress/kendo-angular-l10n";
|
|
19
|
-
import * as i2 from "../upload.service";
|
|
20
|
-
/**
|
|
21
|
-
* @hidden
|
|
22
|
-
*/
|
|
23
|
-
export class FileListSingleItemComponent extends FileListItemBase {
|
|
24
|
-
localization;
|
|
25
|
-
disabled;
|
|
26
|
-
file;
|
|
27
|
-
fileInfoTemplate;
|
|
28
|
-
constructor(localization, uploadService) {
|
|
29
|
-
super(uploadService);
|
|
30
|
-
this.localization = localization;
|
|
31
|
-
this.subscribeUploadProgress((args) => {
|
|
32
|
-
if (args.files[0].uid === this.file.uid) {
|
|
33
|
-
this.progressComplete = args.percentComplete;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
get fileStatusText() {
|
|
38
|
-
const errors = this.file.validationErrors;
|
|
39
|
-
if (this.file.state === FileState.Uploaded) {
|
|
40
|
-
return `${this.textFor('fileStatusUploaded')}`;
|
|
41
|
-
}
|
|
42
|
-
if (this.file.state === FileState.Failed) {
|
|
43
|
-
return `${this.textFor('fileStatusFailed')}`;
|
|
44
|
-
}
|
|
45
|
-
if (!isPresent(errors)) {
|
|
46
|
-
return this.getTotalFilesSizeMessage([this.file]);
|
|
47
|
-
}
|
|
48
|
-
return this.getFileValidationMessage(this.file);
|
|
49
|
-
}
|
|
50
|
-
get showProgress() {
|
|
51
|
-
const showProgress = this.file.state === FileState.Uploading || this.file.state === FileState.Paused;
|
|
52
|
-
return showProgress ? 'active' : 'inactive';
|
|
53
|
-
}
|
|
54
|
-
get fileGroupClass() {
|
|
55
|
-
return fileGroupClass(this.file.extension);
|
|
56
|
-
}
|
|
57
|
-
get fileSVGGroupIcon() {
|
|
58
|
-
return fileSVGGroupIcon(this.file.extension);
|
|
59
|
-
}
|
|
60
|
-
get isUploadSuccessful() {
|
|
61
|
-
return this.file.state === FileState.Uploaded;
|
|
62
|
-
}
|
|
63
|
-
get isUploadFailed() {
|
|
64
|
-
return this.file.state === FileState.Failed;
|
|
65
|
-
}
|
|
66
|
-
get isNotYetUploaded() {
|
|
67
|
-
return !this.isUploadFailed && !this.isUploadSuccessful;
|
|
68
|
-
}
|
|
69
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FileListSingleItemComponent, deps: [{ token: i1.LocalizationService }, { token: i2.UploadService }], target: i0.ɵɵFactoryTarget.Component });
|
|
70
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: FileListSingleItemComponent, isStandalone: true, selector: "kendo-upload-file-list-single-item", inputs: { disabled: "disabled", file: "file", fileInfoTemplate: "fileInfoTemplate" }, usesInheritance: true, ngImport: i0, template: `
|
|
71
|
-
<kendo-progressbar
|
|
72
|
-
[@progressState]="showProgress"
|
|
73
|
-
[value]="progressComplete"
|
|
74
|
-
[label]="{ visible: false }"
|
|
75
|
-
>
|
|
76
|
-
</kendo-progressbar>
|
|
77
|
-
<span class="k-file-icon-wrapper">
|
|
78
|
-
<kendo-icon-wrapper
|
|
79
|
-
size="xxlarge"
|
|
80
|
-
[name]="fileGroupClass"
|
|
81
|
-
[svgIcon]="fileSVGGroupIcon"
|
|
82
|
-
innerCssClass="k-file-icon"
|
|
83
|
-
>
|
|
84
|
-
</kendo-icon-wrapper>
|
|
85
|
-
</span>
|
|
86
|
-
<span class="k-file-info">
|
|
87
|
-
@if (!fileInfoTemplate) {
|
|
88
|
-
<span class="k-file-name" [title]="file.name">{{ file.name }}</span>
|
|
89
|
-
<span [attr.aria-live]="'polite'" [ngClass]="{
|
|
90
|
-
'k-file-validation-message': file.validationErrors,
|
|
91
|
-
'k-file-size': !file.validationErrors && isNotYetUploaded,
|
|
92
|
-
'k-file-summary': isUploadSuccessful || isUploadFailed
|
|
93
|
-
}"
|
|
94
|
-
>{{fileStatusText}}</span>
|
|
95
|
-
}
|
|
96
|
-
@if (fileInfoTemplate) {
|
|
97
|
-
<ng-container [ngTemplateOutlet]="fileInfoTemplate.templateRef" [ngTemplateOutletContext]="{
|
|
98
|
-
templateRef: fileInfoTemplate.templateRef,
|
|
99
|
-
state: file.state,
|
|
100
|
-
$implicit: [file]
|
|
101
|
-
}"></ng-container>
|
|
102
|
-
}
|
|
103
|
-
</span>
|
|
104
|
-
<kendo-upload-file-list-item-action-button
|
|
105
|
-
[file]='file'
|
|
106
|
-
[disabled]='disabled'
|
|
107
|
-
[progress]='progressComplete'>
|
|
108
|
-
</kendo-upload-file-list-item-action-button>
|
|
109
|
-
`, isInline: true, dependencies: [{ kind: "component", type: ProgressBarComponent, selector: "kendo-progressbar", inputs: ["label", "progressCssStyle", "progressCssClass", "emptyCssStyle", "emptyCssClass", "animation"], outputs: ["animationEnd"], exportAs: ["kendoProgressBar"] }, { kind: "component", type: IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass", "size"], exportAs: ["kendoIconWrapper"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: FileListItemActionButtonComponent, selector: "kendo-upload-file-list-item-action-button", inputs: ["file", "disabled", "progress"] }], animations: [
|
|
110
|
-
trigger('progressState', [
|
|
111
|
-
state('active', style({ opacity: 1 })),
|
|
112
|
-
state('inactive', style({ opacity: 0 })),
|
|
113
|
-
transition('void => active', style({ opacity: 0 })),
|
|
114
|
-
transition('inactive => active', style({ opacity: 1 })),
|
|
115
|
-
transition('active => inactive', animate('1s 2s ease-out'))
|
|
116
|
-
])
|
|
117
|
-
] });
|
|
118
|
-
}
|
|
119
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FileListSingleItemComponent, decorators: [{
|
|
120
|
-
type: Component,
|
|
121
|
-
args: [{
|
|
122
|
-
animations: [
|
|
123
|
-
trigger('progressState', [
|
|
124
|
-
state('active', style({ opacity: 1 })),
|
|
125
|
-
state('inactive', style({ opacity: 0 })),
|
|
126
|
-
transition('void => active', style({ opacity: 0 })),
|
|
127
|
-
transition('inactive => active', style({ opacity: 1 })),
|
|
128
|
-
transition('active => inactive', animate('1s 2s ease-out'))
|
|
129
|
-
])
|
|
130
|
-
],
|
|
131
|
-
selector: 'kendo-upload-file-list-single-item',
|
|
132
|
-
template: `
|
|
133
|
-
<kendo-progressbar
|
|
134
|
-
[@progressState]="showProgress"
|
|
135
|
-
[value]="progressComplete"
|
|
136
|
-
[label]="{ visible: false }"
|
|
137
|
-
>
|
|
138
|
-
</kendo-progressbar>
|
|
139
|
-
<span class="k-file-icon-wrapper">
|
|
140
|
-
<kendo-icon-wrapper
|
|
141
|
-
size="xxlarge"
|
|
142
|
-
[name]="fileGroupClass"
|
|
143
|
-
[svgIcon]="fileSVGGroupIcon"
|
|
144
|
-
innerCssClass="k-file-icon"
|
|
145
|
-
>
|
|
146
|
-
</kendo-icon-wrapper>
|
|
147
|
-
</span>
|
|
148
|
-
<span class="k-file-info">
|
|
149
|
-
@if (!fileInfoTemplate) {
|
|
150
|
-
<span class="k-file-name" [title]="file.name">{{ file.name }}</span>
|
|
151
|
-
<span [attr.aria-live]="'polite'" [ngClass]="{
|
|
152
|
-
'k-file-validation-message': file.validationErrors,
|
|
153
|
-
'k-file-size': !file.validationErrors && isNotYetUploaded,
|
|
154
|
-
'k-file-summary': isUploadSuccessful || isUploadFailed
|
|
155
|
-
}"
|
|
156
|
-
>{{fileStatusText}}</span>
|
|
157
|
-
}
|
|
158
|
-
@if (fileInfoTemplate) {
|
|
159
|
-
<ng-container [ngTemplateOutlet]="fileInfoTemplate.templateRef" [ngTemplateOutletContext]="{
|
|
160
|
-
templateRef: fileInfoTemplate.templateRef,
|
|
161
|
-
state: file.state,
|
|
162
|
-
$implicit: [file]
|
|
163
|
-
}"></ng-container>
|
|
164
|
-
}
|
|
165
|
-
</span>
|
|
166
|
-
<kendo-upload-file-list-item-action-button
|
|
167
|
-
[file]='file'
|
|
168
|
-
[disabled]='disabled'
|
|
169
|
-
[progress]='progressComplete'>
|
|
170
|
-
</kendo-upload-file-list-item-action-button>
|
|
171
|
-
`,
|
|
172
|
-
standalone: true,
|
|
173
|
-
imports: [ProgressBarComponent, IconWrapperComponent, NgClass, NgTemplateOutlet, FileListItemActionButtonComponent]
|
|
174
|
-
}]
|
|
175
|
-
}], ctorParameters: () => [{ type: i1.LocalizationService }, { type: i2.UploadService }], propDecorators: { disabled: [{
|
|
176
|
-
type: Input
|
|
177
|
-
}], file: [{
|
|
178
|
-
type: Input
|
|
179
|
-
}], fileInfoTemplate: [{
|
|
180
|
-
type: Input
|
|
181
|
-
}] } });
|