@progress/kendo-angular-upload 8.0.2-dev.202203071504 → 9.0.0-dev.202204131914
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/bundles/kendo-angular-upload.umd.js +5 -0
- package/{dist/es2015/common → common}/action-buttons-layout.d.ts +0 -0
- package/{dist/es2015/common → common}/util.d.ts +0 -0
- package/{dist/es2015/common → common}/validation-util.d.ts +0 -0
- package/{dist/es2015/dropzone-base.d.ts → dropzone-base.d.ts} +4 -1
- package/{dist/es2015/dropzone-external.directive.d.ts → dropzone-external.directive.d.ts} +4 -1
- package/{dist/es2015/dropzone-internal.directive.d.ts → dropzone-internal.directive.d.ts} +3 -0
- package/{dist/es2015/dropzone.component.d.ts → dropzone.component.d.ts} +5 -2
- package/{dist/es2015/dropzone.service.d.ts → dropzone.service.d.ts} +3 -0
- package/{dist/es2015 → esm2015}/common/action-buttons-layout.js +1 -0
- package/{dist/es2015 → esm2015}/common/util.js +1 -7
- package/{dist/es2015 → esm2015}/common/validation-util.js +0 -4
- package/{dist/es2015 → esm2015}/dropzone-base.js +18 -16
- package/{dist/es2015 → esm2015}/dropzone-external.directive.js +29 -35
- package/{dist/es2015 → esm2015}/dropzone-internal.directive.js +25 -37
- package/esm2015/dropzone.component.js +112 -0
- package/{dist/es2015 → esm2015}/dropzone.service.js +8 -7
- package/{dist/es2015 → esm2015}/events/cancel-event.js +1 -0
- package/{dist/es2015 → esm2015}/events/clear-event.js +1 -0
- package/{dist/es2015 → esm2015}/events/error-event.js +1 -0
- package/{dist/es2015 → esm2015}/events/pause-event.js +1 -0
- package/{dist/es2015 → esm2015}/events/preventable-event.js +0 -0
- package/{dist/es2015 → esm2015}/events/remove-event.js +1 -0
- package/{dist/es2015 → esm2015}/events/resume-event.js +1 -0
- package/{dist/es2015 → esm2015}/events/select-event.js +1 -0
- package/{dist/es2015 → esm2015}/events/success-event.js +1 -0
- package/{dist/es2015 → esm2015}/events/upload-event.js +1 -0
- package/{dist/es2015 → esm2015}/events/upload-progress-event.js +1 -0
- package/{dist/es → esm2015}/events.js +0 -0
- package/esm2015/file-select.directive.js +100 -0
- package/{dist/es2015 → esm2015}/fileselect.component.js +160 -132
- package/esm2015/fileselect.module.js +35 -0
- package/{dist/es/types/chunk-info.js → esm2015/kendo-angular-upload.js} +4 -0
- package/esm2015/localization/custom-messages.component.js +50 -0
- package/esm2015/localization/localized-messages.directive.js +40 -0
- package/esm2015/localization/messages.js +59 -0
- package/{dist/es → esm2015}/main.js +0 -0
- package/{dist/es2015 → esm2015}/navigation.service.js +9 -9
- package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
- package/{dist/es2015 → esm2015}/rendering/file-list-item-action-button.component.js +70 -28
- package/{dist/es2015 → esm2015}/rendering/file-list-item-base.js +9 -0
- package/esm2015/rendering/file-list-item.js +107 -0
- package/esm2015/rendering/file-list-multiple-items.component.js +172 -0
- package/esm2015/rendering/file-list-single-item.component.js +154 -0
- package/esm2015/rendering/file-list.component.js +145 -0
- package/esm2015/rendering/upload-action-buttons.component.js +136 -0
- package/esm2015/rendering/upload-status-total.component.js +60 -0
- package/{dist/es2015 → esm2015}/shared.module.js +45 -18
- package/esm2015/templates/file-info-template.directive.js +22 -0
- package/esm2015/templates/file-template.directive.js +22 -0
- package/esm2015/templates/template-context.directive.js +34 -0
- package/{dist/es2015 → esm2015}/types/async-settings.js +1 -0
- package/{dist/es2015 → esm2015}/types/chunk-info.js +1 -0
- package/{dist/es2015 → esm2015}/types/chunk-map.js +0 -0
- package/{dist/es → esm2015}/types/chunk-metadata.js +1 -0
- package/{dist/es → esm2015}/types/chunk-settings.js +1 -0
- package/{dist/es → esm2015}/types/direction.js +1 -0
- package/{dist/es2015 → esm2015}/types/file-groups.js +3 -5
- package/{dist/es → esm2015}/types/file-info.js +1 -0
- package/{dist/es2015 → esm2015}/types/file-map.js +0 -0
- package/{dist/es → esm2015}/types/file-restrictions.js +1 -0
- package/{dist/es → esm2015}/types/file-state.js +0 -0
- package/{dist/es → esm2015}/types/operation-type.js +1 -0
- package/{dist/es → esm2015}/types.js +0 -0
- package/{dist/es2015 → esm2015}/upload.component.js +262 -243
- package/esm2015/upload.module.js +43 -0
- package/{dist/es2015 → esm2015}/upload.service.js +10 -9
- package/{dist/es2015 → esm2015}/uploads.module.js +17 -12
- package/{dist/es2015/events → events}/cancel-event.d.ts +4 -0
- package/{dist/es2015/events → events}/clear-event.d.ts +1 -0
- package/{dist/es2015/events → events}/error-event.d.ts +10 -0
- package/{dist/es2015/events → events}/pause-event.d.ts +4 -0
- package/{dist/es2015/events → events}/preventable-event.d.ts +0 -0
- package/{dist/es2015/events → events}/remove-event.d.ts +9 -2
- package/{dist/es2015/events → events}/resume-event.d.ts +4 -0
- package/{dist/es2015/events → events}/select-event.d.ts +4 -0
- package/{dist/es2015/events → events}/success-event.d.ts +10 -0
- package/{dist/es2015/events → events}/upload-event.d.ts +9 -2
- package/{dist/es2015/events → events}/upload-progress-event.d.ts +7 -0
- package/{dist/es2015/events.d.ts → events.d.ts} +0 -0
- package/{dist/fesm2015/index.js → fesm2015/kendo-angular-upload.js} +2192 -2010
- package/{dist/es2015/file-select.directive.d.ts → file-select.directive.d.ts} +7 -4
- package/{dist/es2015/fileselect.component.d.ts → fileselect.component.d.ts} +14 -6
- package/fileselect.module.d.ts +20 -0
- package/{dist/es/common/action-buttons-layout.js → kendo-angular-upload.d.ts} +5 -0
- package/{dist/es2015/localization → localization}/custom-messages.component.d.ts +4 -1
- package/{dist/es2015/localization → localization}/localized-messages.directive.d.ts +3 -0
- package/{dist/es2015/localization → localization}/messages.d.ts +3 -0
- package/{dist/es2015/main.d.ts → main.d.ts} +0 -0
- package/{dist/es2015/navigation.service.d.ts → navigation.service.d.ts} +7 -3
- package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
- package/package.json +36 -104
- package/{dist/es2015/rendering → rendering}/file-list-item-action-button.component.d.ts +11 -8
- package/{dist/es2015/rendering → rendering}/file-list-item-base.d.ts +3 -0
- package/{dist/es2015/rendering → rendering}/file-list-item.d.ts +10 -7
- package/{dist/es2015/rendering → rendering}/file-list-multiple-items.component.d.ts +7 -4
- package/{dist/es2015/rendering → rendering}/file-list-single-item.component.d.ts +9 -6
- package/{dist/es2015/rendering → rendering}/file-list.component.d.ts +3 -0
- package/{dist/es2015/rendering → rendering}/upload-action-buttons.component.d.ts +7 -4
- package/{dist/es2015/rendering → rendering}/upload-status-total.component.d.ts +3 -0
- package/schematics/ngAdd/index.js +5 -2
- package/schematics/ngAdd/index.js.map +1 -1
- package/shared.module.d.ts +36 -0
- package/{dist/es2015/templates → templates}/file-info-template.directive.d.ts +3 -0
- package/{dist/es2015/templates → templates}/file-template.directive.d.ts +3 -0
- package/{dist/es2015/templates → templates}/template-context.directive.d.ts +4 -1
- package/{dist/es2015/types → types}/async-settings.d.ts +0 -0
- package/{dist/es2015/types → types}/chunk-info.d.ts +0 -0
- package/{dist/es2015/types → types}/chunk-map.d.ts +0 -0
- package/{dist/es2015/types → types}/chunk-metadata.d.ts +0 -0
- package/{dist/es2015/types → types}/chunk-settings.d.ts +0 -0
- package/{dist/es2015/types → types}/direction.d.ts +0 -0
- package/{dist/es2015/types → types}/file-groups.d.ts +0 -0
- package/{dist/es2015/types → types}/file-info.d.ts +0 -0
- package/{dist/es2015/types → types}/file-map.d.ts +5 -5
- package/{dist/es2015/types → types}/file-restrictions.d.ts +0 -0
- package/{dist/es2015/types → types}/file-state.d.ts +0 -0
- package/{dist/es2015/types → types}/operation-type.d.ts +0 -0
- package/{dist/es2015/types.d.ts → types.d.ts} +0 -0
- package/{dist/es2015/upload.component.d.ts → upload.component.d.ts} +42 -21
- package/upload.module.d.ts +22 -0
- package/{dist/es2015/upload.service.d.ts → upload.service.d.ts} +4 -1
- package/{dist/es2015/uploads.module.d.ts → uploads.module.d.ts} +6 -0
- package/dist/cdn/js/kendo-angular-upload.js +0 -20
- package/dist/cdn/main.js +0 -5
- package/dist/es/common/util.js +0 -234
- package/dist/es/common/validation-util.js +0 -64
- package/dist/es/dropzone-base.js +0 -66
- package/dist/es/dropzone-external.directive.js +0 -98
- package/dist/es/dropzone-internal.directive.js +0 -110
- package/dist/es/dropzone.component.js +0 -99
- package/dist/es/dropzone.service.js +0 -33
- package/dist/es/events/cancel-event.js +0 -41
- package/dist/es/events/clear-event.js +0 -43
- package/dist/es/events/error-event.js +0 -45
- package/dist/es/events/pause-event.js +0 -42
- package/dist/es/events/preventable-event.js +0 -29
- package/dist/es/events/remove-event.js +0 -47
- package/dist/es/events/resume-event.js +0 -42
- package/dist/es/events/select-event.js +0 -45
- package/dist/es/events/success-event.js +0 -49
- package/dist/es/events/upload-event.js +0 -47
- package/dist/es/events/upload-progress-event.js +0 -42
- package/dist/es/file-select.directive.js +0 -141
- package/dist/es/fileselect.component.js +0 -484
- package/dist/es/fileselect.module.js +0 -30
- package/dist/es/index.js +0 -21
- package/dist/es/localization/custom-messages.component.js +0 -53
- package/dist/es/localization/localized-messages.directive.js +0 -35
- package/dist/es/localization/messages.js +0 -102
- package/dist/es/navigation.service.js +0 -166
- package/dist/es/package-metadata.js +0 -15
- package/dist/es/rendering/file-list-item-action-button.component.js +0 -169
- package/dist/es/rendering/file-list-item-base.js +0 -41
- package/dist/es/rendering/file-list-item.js +0 -165
- package/dist/es/rendering/file-list-multiple-items.component.js +0 -107
- package/dist/es/rendering/file-list-single-item.component.js +0 -112
- package/dist/es/rendering/file-list.component.js +0 -98
- package/dist/es/rendering/upload-action-buttons.component.js +0 -149
- package/dist/es/rendering/upload-status-total.component.js +0 -42
- package/dist/es/shared.module.js +0 -68
- package/dist/es/templates/file-info-template.directive.js +0 -22
- package/dist/es/templates/file-template.directive.js +0 -22
- package/dist/es/templates/template-context.directive.js +0 -40
- package/dist/es/types/async-settings.js +0 -4
- package/dist/es/types/chunk-map.js +0 -36
- package/dist/es/types/file-groups.js +0 -45
- package/dist/es/types/file-map.js +0 -170
- package/dist/es/upload.component.js +0 -967
- package/dist/es/upload.module.js +0 -34
- package/dist/es/upload.service.js +0 -448
- package/dist/es/uploads.module.js +0 -47
- package/dist/es2015/dropzone.component.js +0 -100
- package/dist/es2015/events.js +0 -14
- package/dist/es2015/file-select.directive.js +0 -123
- package/dist/es2015/fileselect.module.d.ts +0 -9
- package/dist/es2015/fileselect.module.js +0 -27
- package/dist/es2015/index.d.ts +0 -21
- package/dist/es2015/index.js +0 -21
- package/dist/es2015/index.metadata.json +0 -1
- package/dist/es2015/localization/custom-messages.component.js +0 -45
- package/dist/es2015/localization/localized-messages.directive.js +0 -35
- package/dist/es2015/localization/messages.js +0 -96
- package/dist/es2015/main.js +0 -24
- package/dist/es2015/rendering/file-list-item.js +0 -136
- package/dist/es2015/rendering/file-list-multiple-items.component.js +0 -128
- package/dist/es2015/rendering/file-list-single-item.component.js +0 -117
- package/dist/es2015/rendering/file-list.component.js +0 -123
- package/dist/es2015/rendering/upload-action-buttons.component.js +0 -141
- package/dist/es2015/rendering/upload-status-total.component.js +0 -51
- package/dist/es2015/shared.module.d.ts +0 -17
- package/dist/es2015/templates/file-info-template.directive.js +0 -21
- package/dist/es2015/templates/file-template.directive.js +0 -21
- package/dist/es2015/templates/template-context.directive.js +0 -35
- package/dist/es2015/types/chunk-metadata.js +0 -4
- package/dist/es2015/types/chunk-settings.js +0 -4
- package/dist/es2015/types/direction.js +0 -4
- package/dist/es2015/types/file-info.js +0 -4
- package/dist/es2015/types/file-restrictions.js +0 -4
- package/dist/es2015/types/file-state.js +0 -34
- package/dist/es2015/types/operation-type.js +0 -4
- package/dist/es2015/types.js +0 -5
- package/dist/es2015/upload.module.d.ts +0 -9
- package/dist/es2015/upload.module.js +0 -31
- package/dist/fesm5/index.js +0 -4653
- package/dist/npm/common/action-buttons-layout.js +0 -6
- package/dist/npm/common/util.js +0 -240
- package/dist/npm/common/validation-util.js +0 -68
- package/dist/npm/dropzone-base.js +0 -68
- package/dist/npm/dropzone-external.directive.js +0 -100
- package/dist/npm/dropzone-internal.directive.js +0 -112
- package/dist/npm/dropzone.component.js +0 -101
- package/dist/npm/dropzone.service.js +0 -35
- package/dist/npm/events/cancel-event.js +0 -43
- package/dist/npm/events/clear-event.js +0 -45
- package/dist/npm/events/error-event.js +0 -47
- package/dist/npm/events/pause-event.js +0 -44
- package/dist/npm/events/preventable-event.js +0 -31
- package/dist/npm/events/remove-event.js +0 -49
- package/dist/npm/events/resume-event.js +0 -44
- package/dist/npm/events/select-event.js +0 -47
- package/dist/npm/events/success-event.js +0 -51
- package/dist/npm/events/upload-event.js +0 -49
- package/dist/npm/events/upload-progress-event.js +0 -44
- package/dist/npm/events.js +0 -26
- package/dist/npm/file-select.directive.js +0 -143
- package/dist/npm/fileselect.component.js +0 -486
- package/dist/npm/fileselect.module.js +0 -32
- package/dist/npm/index.js +0 -39
- package/dist/npm/localization/custom-messages.component.js +0 -55
- package/dist/npm/localization/localized-messages.directive.js +0 -37
- package/dist/npm/localization/messages.js +0 -104
- package/dist/npm/main.js +0 -45
- package/dist/npm/navigation.service.js +0 -168
- package/dist/npm/package-metadata.js +0 -17
- package/dist/npm/rendering/file-list-item-action-button.component.js +0 -171
- package/dist/npm/rendering/file-list-item-base.js +0 -43
- package/dist/npm/rendering/file-list-item.js +0 -167
- package/dist/npm/rendering/file-list-multiple-items.component.js +0 -109
- package/dist/npm/rendering/file-list-single-item.component.js +0 -114
- package/dist/npm/rendering/file-list.component.js +0 -100
- package/dist/npm/rendering/upload-action-buttons.component.js +0 -151
- package/dist/npm/rendering/upload-status-total.component.js +0 -44
- package/dist/npm/shared.module.js +0 -70
- package/dist/npm/templates/file-info-template.directive.js +0 -24
- package/dist/npm/templates/file-template.directive.js +0 -24
- package/dist/npm/templates/template-context.directive.js +0 -42
- package/dist/npm/types/async-settings.js +0 -6
- package/dist/npm/types/chunk-info.js +0 -6
- package/dist/npm/types/chunk-map.js +0 -38
- package/dist/npm/types/chunk-metadata.js +0 -6
- package/dist/npm/types/chunk-settings.js +0 -6
- package/dist/npm/types/direction.js +0 -6
- package/dist/npm/types/file-groups.js +0 -47
- package/dist/npm/types/file-info.js +0 -6
- package/dist/npm/types/file-map.js +0 -172
- package/dist/npm/types/file-restrictions.js +0 -6
- package/dist/npm/types/file-state.js +0 -36
- package/dist/npm/types/operation-type.js +0 -6
- package/dist/npm/types.js +0 -8
- package/dist/npm/upload.component.js +0 -969
- package/dist/npm/upload.module.js +0 -36
- package/dist/npm/upload.service.js +0 -450
- package/dist/npm/uploads.module.js +0 -49
- package/dist/systemjs/kendo-angular-upload.js +0 -5
package/dist/fesm5/index.js
DELETED
|
@@ -1,4653 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { __extends, __decorate, __metadata } from 'tslib';
|
|
6
|
-
import { Injectable, EventEmitter, Directive, TemplateRef, forwardRef, Input, ContentChild, ViewChild, ElementRef, Output, HostBinding, HostListener, Component, NgZone, Renderer2, ChangeDetectorRef, ViewChildren, QueryList, ViewContainerRef, isDevMode, NgModule } from '@angular/core';
|
|
7
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
8
|
-
import { LocalizationService, L10N_PREFIX, ComponentMessages } from '@progress/kendo-angular-l10n';
|
|
9
|
-
import { guid, Keys, isDocumentAvailable, KendoInput, isChanged } from '@progress/kendo-angular-common';
|
|
10
|
-
import { fromEvent, merge } from 'rxjs';
|
|
11
|
-
import { filter } from 'rxjs/operators';
|
|
12
|
-
import { validatePackage } from '@progress/kendo-licensing';
|
|
13
|
-
import { HttpRequest, HttpEventType, HttpResponse, HttpHeaders, HttpClient } from '@angular/common/http';
|
|
14
|
-
import { CommonModule } from '@angular/common';
|
|
15
|
-
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @hidden
|
|
19
|
-
*/
|
|
20
|
-
var packageMetadata = {
|
|
21
|
-
name: '@progress/kendo-angular-upload',
|
|
22
|
-
productName: 'Kendo UI for Angular',
|
|
23
|
-
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
24
|
-
publishDate: 1646665416,
|
|
25
|
-
version: '',
|
|
26
|
-
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Lists the possible states of a file.
|
|
31
|
-
*/
|
|
32
|
-
var FileState;
|
|
33
|
-
(function (FileState) {
|
|
34
|
-
/**
|
|
35
|
-
* The file upload process has failed.
|
|
36
|
-
*/
|
|
37
|
-
FileState[FileState["Failed"] = 0] = "Failed";
|
|
38
|
-
/**
|
|
39
|
-
* An initially selected fake file without a set state.
|
|
40
|
-
*/
|
|
41
|
-
FileState[FileState["Initial"] = 1] = "Initial";
|
|
42
|
-
/**
|
|
43
|
-
* The file is selected.
|
|
44
|
-
*/
|
|
45
|
-
FileState[FileState["Selected"] = 2] = "Selected";
|
|
46
|
-
/**
|
|
47
|
-
* The file is successfully uploaded.
|
|
48
|
-
*/
|
|
49
|
-
FileState[FileState["Uploaded"] = 3] = "Uploaded";
|
|
50
|
-
/**
|
|
51
|
-
* The file is in the process of uploading.
|
|
52
|
-
*/
|
|
53
|
-
FileState[FileState["Uploading"] = 4] = "Uploading";
|
|
54
|
-
/**
|
|
55
|
-
* The file upload process has been paused.
|
|
56
|
-
*/
|
|
57
|
-
FileState[FileState["Paused"] = 5] = "Paused";
|
|
58
|
-
})(FileState || (FileState = {}));
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @hidden
|
|
62
|
-
*/
|
|
63
|
-
var FileMap = /** @class */ (function () {
|
|
64
|
-
function FileMap() {
|
|
65
|
-
this._files = {};
|
|
66
|
-
}
|
|
67
|
-
FileMap.prototype.add = function (file) {
|
|
68
|
-
var uid = file.uid;
|
|
69
|
-
if (this.has(uid)) {
|
|
70
|
-
if (file.validationErrors && file.validationErrors.length > 0) {
|
|
71
|
-
this._files[uid].unshift(file);
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
this._files[uid].push(file);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
this._files[uid] = [file];
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
FileMap.prototype.remove = function (uid) {
|
|
82
|
-
if (this.has(uid)) {
|
|
83
|
-
this._files[uid] = null;
|
|
84
|
-
delete this._files[uid];
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
FileMap.prototype.clear = function () {
|
|
88
|
-
var allFiles = this._files;
|
|
89
|
-
for (var uid in allFiles) {
|
|
90
|
-
if (allFiles.hasOwnProperty(uid)) {
|
|
91
|
-
for (var _i = 0, _a = allFiles[uid]; _i < _a.length; _i++) {
|
|
92
|
-
var file = _a[_i];
|
|
93
|
-
if (file.httpSubscription) {
|
|
94
|
-
file.httpSubscription.unsubscribe();
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
allFiles[uid] = null;
|
|
98
|
-
delete allFiles[uid];
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
FileMap.prototype.has = function (uid) {
|
|
103
|
-
return uid in this._files;
|
|
104
|
-
};
|
|
105
|
-
FileMap.prototype.get = function (uid) {
|
|
106
|
-
return this._files[uid];
|
|
107
|
-
};
|
|
108
|
-
FileMap.prototype.setFilesState = function (files, state$$1) {
|
|
109
|
-
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
|
|
110
|
-
var file = files_1[_i];
|
|
111
|
-
this.setFilesStateByUid(file.uid, state$$1);
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
FileMap.prototype.setFilesStateByUid = function (uid, state$$1) {
|
|
115
|
-
this.get(uid).forEach(function (f) {
|
|
116
|
-
f.state = state$$1;
|
|
117
|
-
});
|
|
118
|
-
};
|
|
119
|
-
Object.defineProperty(FileMap.prototype, "count", {
|
|
120
|
-
get: function () {
|
|
121
|
-
return Object.getOwnPropertyNames(this._files).length;
|
|
122
|
-
},
|
|
123
|
-
enumerable: true,
|
|
124
|
-
configurable: true
|
|
125
|
-
});
|
|
126
|
-
Object.defineProperty(FileMap.prototype, "files", {
|
|
127
|
-
get: function () {
|
|
128
|
-
var initial = this._files;
|
|
129
|
-
var transformed = [];
|
|
130
|
-
for (var uid in initial) {
|
|
131
|
-
if (initial.hasOwnProperty(uid)) {
|
|
132
|
-
transformed.push(initial[uid]);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return transformed;
|
|
136
|
-
},
|
|
137
|
-
enumerable: true,
|
|
138
|
-
configurable: true
|
|
139
|
-
});
|
|
140
|
-
Object.defineProperty(FileMap.prototype, "filesFlat", {
|
|
141
|
-
get: function () {
|
|
142
|
-
var initial = this._files;
|
|
143
|
-
var transformed = [];
|
|
144
|
-
for (var uid in initial) {
|
|
145
|
-
if (initial.hasOwnProperty(uid)) {
|
|
146
|
-
var current = initial[uid];
|
|
147
|
-
current.forEach(function (file) {
|
|
148
|
-
transformed.push(file);
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return transformed;
|
|
153
|
-
},
|
|
154
|
-
enumerable: true,
|
|
155
|
-
configurable: true
|
|
156
|
-
});
|
|
157
|
-
Object.defineProperty(FileMap.prototype, "filesToUpload", {
|
|
158
|
-
get: function () {
|
|
159
|
-
var files = this._files;
|
|
160
|
-
var notUploaded = [];
|
|
161
|
-
for (var uid in files) {
|
|
162
|
-
if (files.hasOwnProperty(uid)) {
|
|
163
|
-
var currentFiles = files[uid];
|
|
164
|
-
var currentFilesValid = true;
|
|
165
|
-
for (var _i = 0, currentFiles_1 = currentFiles; _i < currentFiles_1.length; _i++) {
|
|
166
|
-
var file = currentFiles_1[_i];
|
|
167
|
-
if (file.state !== FileState.Selected || (file.validationErrors && file.validationErrors.length > 0)) {
|
|
168
|
-
currentFilesValid = false;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
if (currentFilesValid) {
|
|
172
|
-
notUploaded.push(currentFiles);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return notUploaded;
|
|
177
|
-
},
|
|
178
|
-
enumerable: true,
|
|
179
|
-
configurable: true
|
|
180
|
-
});
|
|
181
|
-
Object.defineProperty(FileMap.prototype, "firstFileToUpload", {
|
|
182
|
-
get: function () {
|
|
183
|
-
var files = this._files;
|
|
184
|
-
for (var uid in files) {
|
|
185
|
-
if (files.hasOwnProperty(uid)) {
|
|
186
|
-
var currentFiles = files[uid];
|
|
187
|
-
var currentFilesValid = true;
|
|
188
|
-
for (var _i = 0, currentFiles_2 = currentFiles; _i < currentFiles_2.length; _i++) {
|
|
189
|
-
var file = currentFiles_2[_i];
|
|
190
|
-
if (file.state !== FileState.Selected || (file.validationErrors && file.validationErrors.length > 0)) {
|
|
191
|
-
currentFilesValid = false;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
if (currentFilesValid) {
|
|
195
|
-
return currentFiles;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
return null;
|
|
200
|
-
},
|
|
201
|
-
enumerable: true,
|
|
202
|
-
configurable: true
|
|
203
|
-
});
|
|
204
|
-
FileMap.prototype.getFilesWithState = function (state$$1) {
|
|
205
|
-
return this.filesFlat.filter(function (file) { return file.state === state$$1; });
|
|
206
|
-
};
|
|
207
|
-
FileMap.prototype.hasFileWithState = function (fileStates) {
|
|
208
|
-
var files = this._files;
|
|
209
|
-
for (var uid in files) {
|
|
210
|
-
if (files.hasOwnProperty(uid)) {
|
|
211
|
-
var currentFiles = files[uid];
|
|
212
|
-
for (var _i = 0, currentFiles_3 = currentFiles; _i < currentFiles_3.length; _i++) {
|
|
213
|
-
var file = currentFiles_3[_i];
|
|
214
|
-
if (fileStates.indexOf(file.state) >= 0) {
|
|
215
|
-
return true;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
return false;
|
|
221
|
-
};
|
|
222
|
-
return FileMap;
|
|
223
|
-
}());
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Arguments for the `cancel` event. The `cancel` event fires when
|
|
227
|
-
* the user cancels the process of uploading a file or a batch of files.
|
|
228
|
-
*
|
|
229
|
-
* ```ts-no-run
|
|
230
|
-
* @Component({
|
|
231
|
-
* selector: 'my-upload',
|
|
232
|
-
* template: `
|
|
233
|
-
* <p>Click the <span class='k-icon k-i-cancel'></span> icon during upload to trigger the event</p>
|
|
234
|
-
* <kendo-upload
|
|
235
|
-
* [saveUrl]="uploadSaveUrl"
|
|
236
|
-
* [removeUrl]="uploadRemoveUrl"
|
|
237
|
-
* (cancel)="cancelEventHandler($event)">
|
|
238
|
-
* </kendo-upload>
|
|
239
|
-
* `
|
|
240
|
-
* })
|
|
241
|
-
* export class UploadComponent {
|
|
242
|
-
* uploadSaveUrl = 'saveUrl'; // should represent an actual API endpoint
|
|
243
|
-
* uploadRemoveUrl = 'removeUrl'; // should represent an actual API endpoint
|
|
244
|
-
*
|
|
245
|
-
* cancelEventHandler(e: CancelEvent) {
|
|
246
|
-
* console.log('Canceling file upload', e.files);
|
|
247
|
-
* }
|
|
248
|
-
* }
|
|
249
|
-
* ```
|
|
250
|
-
*/
|
|
251
|
-
var CancelEvent = /** @class */ (function () {
|
|
252
|
-
/**
|
|
253
|
-
* Constructs the event arguments for the `cancel` event.
|
|
254
|
-
* @param files - The list of the files that were going to be uploaded.
|
|
255
|
-
*/
|
|
256
|
-
function CancelEvent(files) {
|
|
257
|
-
this.files = files;
|
|
258
|
-
}
|
|
259
|
-
return CancelEvent;
|
|
260
|
-
}());
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* @hidden
|
|
264
|
-
*/
|
|
265
|
-
var PreventableEvent = /** @class */ (function () {
|
|
266
|
-
function PreventableEvent() {
|
|
267
|
-
this.prevented = false;
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Prevents the default action for a specified event.
|
|
271
|
-
* In this way, the source component suppresses the built-in behavior that follows the event.
|
|
272
|
-
*/
|
|
273
|
-
PreventableEvent.prototype.preventDefault = function () {
|
|
274
|
-
this.prevented = true;
|
|
275
|
-
};
|
|
276
|
-
/**
|
|
277
|
-
* If the event is prevented by any of its subscribers, returns `true`.
|
|
278
|
-
*
|
|
279
|
-
* @returns `true` if the default action was prevented. Otherwise, returns `false`.
|
|
280
|
-
*/
|
|
281
|
-
PreventableEvent.prototype.isDefaultPrevented = function () {
|
|
282
|
-
return this.prevented;
|
|
283
|
-
};
|
|
284
|
-
return PreventableEvent;
|
|
285
|
-
}());
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Arguments for the `clear` event. The `clear` event fires when
|
|
289
|
-
* the **Clear** button is clicked. At this point, the selected files are about to be cleared.
|
|
290
|
-
*
|
|
291
|
-
* ```ts-no-run
|
|
292
|
-
* @Component({
|
|
293
|
-
* selector: 'my-upload',
|
|
294
|
-
* template: `
|
|
295
|
-
* <kendo-upload
|
|
296
|
-
* [autoUpload]="false"
|
|
297
|
-
* [saveUrl]="uploadSaveUrl"
|
|
298
|
-
* [removeUrl]="uploadRemoveUrl"
|
|
299
|
-
* (clear)="clearEventHandler($event)">
|
|
300
|
-
* </kendo-upload>
|
|
301
|
-
* `
|
|
302
|
-
* })
|
|
303
|
-
* export class UploadComponent {
|
|
304
|
-
* uploadSaveUrl = 'saveUrl'; // should represent an actual API endpoint
|
|
305
|
-
* uploadRemoveUrl = 'removeUrl'; // should represent an actual API endpoint
|
|
306
|
-
*
|
|
307
|
-
* clearEventHandler(e: ClearEvent) {
|
|
308
|
-
* console.log('Clearing the file upload');
|
|
309
|
-
* }
|
|
310
|
-
* }
|
|
311
|
-
* ```
|
|
312
|
-
*/
|
|
313
|
-
var ClearEvent = /** @class */ (function (_super) {
|
|
314
|
-
__extends(ClearEvent, _super);
|
|
315
|
-
/**
|
|
316
|
-
* Constructs the event arguments for the `clear` event.
|
|
317
|
-
*/
|
|
318
|
-
function ClearEvent() {
|
|
319
|
-
return _super.call(this) || this;
|
|
320
|
-
}
|
|
321
|
-
return ClearEvent;
|
|
322
|
-
}(PreventableEvent));
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Arguments for the `error` event. The `error` event fires when
|
|
326
|
-
* an `upload` or `remove` operation fails.
|
|
327
|
-
*
|
|
328
|
-
* ```ts-no-run
|
|
329
|
-
* @Component({
|
|
330
|
-
* selector: 'my-upload',
|
|
331
|
-
* template: `
|
|
332
|
-
* <kendo-upload
|
|
333
|
-
* [saveUrl]="uploadSaveUrl"
|
|
334
|
-
* [removeUrl]="uploadRemoveUrl"
|
|
335
|
-
* (error)="errorEventHandler($event)">
|
|
336
|
-
* </kendo-upload>
|
|
337
|
-
* `
|
|
338
|
-
* })
|
|
339
|
-
* export class UploadComponent {
|
|
340
|
-
* uploadSaveUrl = 'saveUrl'; // should represent an actual API endpoint
|
|
341
|
-
* uploadRemoveUrl = 'removeUrl'; // should represent an actual API endpoint
|
|
342
|
-
*
|
|
343
|
-
* errorEventHandler(e: ErrorEvent) {
|
|
344
|
-
* console.log('An error occurred');
|
|
345
|
-
* }
|
|
346
|
-
* }
|
|
347
|
-
* ```
|
|
348
|
-
*/
|
|
349
|
-
var ErrorEvent = /** @class */ (function () {
|
|
350
|
-
/**
|
|
351
|
-
* Constructs the event arguments for the `error` event.
|
|
352
|
-
*
|
|
353
|
-
* @param files - The list of the files that failed to be uploaded or removed.
|
|
354
|
-
* @param operation - The operation type (`upload` or `remove`).
|
|
355
|
-
* @param response - The response object returned by the server.
|
|
356
|
-
*/
|
|
357
|
-
function ErrorEvent(files, operation, response) {
|
|
358
|
-
this.files = files;
|
|
359
|
-
this.operation = operation;
|
|
360
|
-
this.response = response;
|
|
361
|
-
}
|
|
362
|
-
return ErrorEvent;
|
|
363
|
-
}());
|
|
364
|
-
|
|
365
|
-
/**
|
|
366
|
-
* Arguments for the `pause` event. The `pause` event fires when the user
|
|
367
|
-
* pauses a file that is currently uploading.
|
|
368
|
-
*
|
|
369
|
-
* ```ts-no-run
|
|
370
|
-
* @Component({
|
|
371
|
-
* selector: 'my-upload',
|
|
372
|
-
* template: `
|
|
373
|
-
* <kendo-upload
|
|
374
|
-
* [chunkable]="true"
|
|
375
|
-
* [saveUrl]="uploadSaveUrl"
|
|
376
|
-
* [removeUrl]="uploadRemoveUrl"
|
|
377
|
-
* (pause)="pauseEventHandler($event)">
|
|
378
|
-
* </kendo-upload>
|
|
379
|
-
* `
|
|
380
|
-
* })
|
|
381
|
-
* export class UploadComponent {
|
|
382
|
-
* uploadSaveUrl = 'saveUrl'; // should represent an actual API endpoint
|
|
383
|
-
* uploadRemoveUrl = 'removeUrl'; // should represent an actual API endpoint
|
|
384
|
-
*
|
|
385
|
-
* pauseEventHandler(ev: PauseEvent) {
|
|
386
|
-
* console.log('File paused');
|
|
387
|
-
* }
|
|
388
|
-
* }
|
|
389
|
-
* ```
|
|
390
|
-
*
|
|
391
|
-
*/
|
|
392
|
-
var PauseEvent = /** @class */ (function () {
|
|
393
|
-
/**
|
|
394
|
-
* Constructs the event arguments for the `pause` event.
|
|
395
|
-
* @param file - The file that is going to be paused.
|
|
396
|
-
*/
|
|
397
|
-
function PauseEvent(file) {
|
|
398
|
-
this.file = file;
|
|
399
|
-
}
|
|
400
|
-
return PauseEvent;
|
|
401
|
-
}());
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Arguments for the `remove` event. The `remove` event fires when an uploaded
|
|
405
|
-
* or selected file is about to be removed. If you cancel the event, the removal is prevented.
|
|
406
|
-
*
|
|
407
|
-
* ```ts-no-run
|
|
408
|
-
* @Component({
|
|
409
|
-
* selector: 'my-upload',
|
|
410
|
-
* template: `
|
|
411
|
-
* <kendo-upload
|
|
412
|
-
* [saveUrl]="uploadSaveUrl"
|
|
413
|
-
* [removeUrl]="uploadRemoveUrl"
|
|
414
|
-
* (remove)="removeEventHandler($event)">
|
|
415
|
-
* </kendo-upload>
|
|
416
|
-
* `
|
|
417
|
-
* })
|
|
418
|
-
* export class UploadComponent {
|
|
419
|
-
* uploadSaveUrl = 'saveUrl'; // should represent an actual API endpoint
|
|
420
|
-
* uploadRemoveUrl = 'removeUrl'; // should represent an actual API endpoint
|
|
421
|
-
*
|
|
422
|
-
* removeEventHandler(e: RemoveEvent) {
|
|
423
|
-
* console.log('Removing a file');
|
|
424
|
-
* }
|
|
425
|
-
* }
|
|
426
|
-
* ```
|
|
427
|
-
*/
|
|
428
|
-
var RemoveEvent = /** @class */ (function (_super) {
|
|
429
|
-
__extends(RemoveEvent, _super);
|
|
430
|
-
/**
|
|
431
|
-
* Constructs the event arguments for the `remove` event.
|
|
432
|
-
* @param files - The list of the files that will be removed.
|
|
433
|
-
* @param headers - The headers of the request.
|
|
434
|
-
*/
|
|
435
|
-
function RemoveEvent(files, headers) {
|
|
436
|
-
var _this = _super.call(this) || this;
|
|
437
|
-
_this.files = files;
|
|
438
|
-
_this.headers = headers;
|
|
439
|
-
return _this;
|
|
440
|
-
}
|
|
441
|
-
return RemoveEvent;
|
|
442
|
-
}(PreventableEvent));
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
* Arguments for the `resume` event. The `resume` event fires when the user
|
|
446
|
-
* resumes the upload of a file that has been previously paused.
|
|
447
|
-
*
|
|
448
|
-
* ```ts-no-run
|
|
449
|
-
* @Component({
|
|
450
|
-
* selector: 'my-upload',
|
|
451
|
-
* template: `
|
|
452
|
-
* <kendo-upload
|
|
453
|
-
* [chunkable]="true"
|
|
454
|
-
* [saveUrl]="uploadSaveUrl"
|
|
455
|
-
* [removeUrl]="uploadRemoveUrl"
|
|
456
|
-
* (resume)="resumeEventHandler($event)">
|
|
457
|
-
* </kendo-upload>
|
|
458
|
-
* `
|
|
459
|
-
* })
|
|
460
|
-
* export class UploadComponent {
|
|
461
|
-
* uploadSaveUrl = 'saveUrl'; // should represent an actual API endpoint
|
|
462
|
-
* uploadRemoveUrl = 'removeUrl'; // should represent an actual API endpoint
|
|
463
|
-
*
|
|
464
|
-
* resumeEventHandler(ev: ResumeEvent) {
|
|
465
|
-
* console.log('File resumed');
|
|
466
|
-
* }
|
|
467
|
-
* }
|
|
468
|
-
* ```
|
|
469
|
-
*
|
|
470
|
-
*/
|
|
471
|
-
var ResumeEvent = /** @class */ (function () {
|
|
472
|
-
/**
|
|
473
|
-
* Constructs the event arguments for the `resume` event.
|
|
474
|
-
* @param file - The file that is going to be resumed.
|
|
475
|
-
*/
|
|
476
|
-
function ResumeEvent(file) {
|
|
477
|
-
this.file = file;
|
|
478
|
-
}
|
|
479
|
-
return ResumeEvent;
|
|
480
|
-
}());
|
|
481
|
-
|
|
482
|
-
/**
|
|
483
|
-
* Arguments for the `select` event. The `select` event fires when the user
|
|
484
|
-
* selects a file or multiple files for upload. If you cancel the event, the selection is prevented.
|
|
485
|
-
*
|
|
486
|
-
* ```ts-no-run
|
|
487
|
-
* @Component({
|
|
488
|
-
* selector: 'my-upload',
|
|
489
|
-
* template: `
|
|
490
|
-
* <kendo-upload
|
|
491
|
-
* [saveUrl]="uploadSaveUrl"
|
|
492
|
-
* [removeUrl]="uploadRemoveUrl"
|
|
493
|
-
* (select)="selectEventHandler($event)">
|
|
494
|
-
* </kendo-upload>
|
|
495
|
-
* `
|
|
496
|
-
* })
|
|
497
|
-
* export class UploadComponent {
|
|
498
|
-
* uploadSaveUrl = 'saveUrl'; // should represent an actual API endpoint
|
|
499
|
-
* uploadRemoveUrl = 'removeUrl'; // should represent an actual API endpoint
|
|
500
|
-
*
|
|
501
|
-
* selectEventHandler(e: SelectEvent) {
|
|
502
|
-
* console.log('File selected');
|
|
503
|
-
* }
|
|
504
|
-
* }
|
|
505
|
-
* ```
|
|
506
|
-
*/
|
|
507
|
-
var SelectEvent = /** @class */ (function (_super) {
|
|
508
|
-
__extends(SelectEvent, _super);
|
|
509
|
-
/**
|
|
510
|
-
* Constructs the event arguments for the `select` event.
|
|
511
|
-
* @param files - The list of the selected files.
|
|
512
|
-
*/
|
|
513
|
-
function SelectEvent(files) {
|
|
514
|
-
var _this = _super.call(this) || this;
|
|
515
|
-
_this.files = files;
|
|
516
|
-
return _this;
|
|
517
|
-
}
|
|
518
|
-
return SelectEvent;
|
|
519
|
-
}(PreventableEvent));
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* Arguments for the `success` event. The `success` event fires when
|
|
523
|
-
* the selected files are successfully uploaded or removed.
|
|
524
|
-
*
|
|
525
|
-
* ```ts-no-run
|
|
526
|
-
* @Component({
|
|
527
|
-
* selector: 'my-upload',
|
|
528
|
-
* template: `
|
|
529
|
-
* <kendo-upload
|
|
530
|
-
* [saveUrl]="uploadSaveUrl"
|
|
531
|
-
* [removeUrl]="uploadRemoveUrl"
|
|
532
|
-
* (success)="successEventHandler($event)">
|
|
533
|
-
* </kendo-upload>
|
|
534
|
-
* `
|
|
535
|
-
* })
|
|
536
|
-
* export class UploadComponent {
|
|
537
|
-
* uploadSaveUrl = 'saveUrl'; // should represent an actual API endpoint
|
|
538
|
-
* uploadRemoveUrl = 'removeUrl'; // should represent an actual API endpoint
|
|
539
|
-
*
|
|
540
|
-
* successEventHandler(e: SuccessEvent) {
|
|
541
|
-
* console.log('The ' + e.operation + ' was successful!');
|
|
542
|
-
* }
|
|
543
|
-
* }
|
|
544
|
-
* ```
|
|
545
|
-
*/
|
|
546
|
-
var SuccessEvent = /** @class */ (function (_super) {
|
|
547
|
-
__extends(SuccessEvent, _super);
|
|
548
|
-
/**
|
|
549
|
-
* Constructs the event arguments for the `success` event.
|
|
550
|
-
* @param files - The list of the files that were uploaded or removed.
|
|
551
|
-
* @param operation - The operation type (`upload` or `remove`).
|
|
552
|
-
* @param response - The response object returned by the server.
|
|
553
|
-
*/
|
|
554
|
-
function SuccessEvent(files, operation, response) {
|
|
555
|
-
var _this = _super.call(this) || this;
|
|
556
|
-
_this.files = files;
|
|
557
|
-
_this.operation = operation;
|
|
558
|
-
_this.response = response;
|
|
559
|
-
return _this;
|
|
560
|
-
}
|
|
561
|
-
return SuccessEvent;
|
|
562
|
-
}(PreventableEvent));
|
|
563
|
-
|
|
564
|
-
/**
|
|
565
|
-
* Arguments for the `upload` event. The `upload` event fires when one or more files are about
|
|
566
|
-
* to be uploaded. If you cancel the event, the upload is prevented. You can add headers to the request.
|
|
567
|
-
*
|
|
568
|
-
* ```ts-no-run
|
|
569
|
-
* @Component({
|
|
570
|
-
* selector: 'my-upload',
|
|
571
|
-
* template: `
|
|
572
|
-
* <kendo-upload
|
|
573
|
-
* [saveUrl]="uploadSaveUrl"
|
|
574
|
-
* [removeUrl]="uploadRemoveUrl"
|
|
575
|
-
* (upload)="uploadEventHandler($event)">
|
|
576
|
-
* </kendo-upload>
|
|
577
|
-
* `
|
|
578
|
-
* })
|
|
579
|
-
* export class UploadComponent {
|
|
580
|
-
* uploadSaveUrl = 'saveUrl'; // should represent an actual API endpoint
|
|
581
|
-
* uploadRemoveUrl = 'removeUrl'; // should represent an actual API endpoint
|
|
582
|
-
*
|
|
583
|
-
* uploadEventHandler(e: UploadEvent) {
|
|
584
|
-
* e.headers = e.headers.append('X-Foo', 'Bar');
|
|
585
|
-
* }
|
|
586
|
-
* }
|
|
587
|
-
* ```
|
|
588
|
-
*/
|
|
589
|
-
var UploadEvent = /** @class */ (function (_super) {
|
|
590
|
-
__extends(UploadEvent, _super);
|
|
591
|
-
/**
|
|
592
|
-
* Constructs the event arguments for the `upload` event.
|
|
593
|
-
* @param files - The list of the files that will be uploaded.
|
|
594
|
-
* @param headers - The headers of the request.
|
|
595
|
-
*/
|
|
596
|
-
function UploadEvent(files, headers) {
|
|
597
|
-
var _this = _super.call(this) || this;
|
|
598
|
-
_this.files = files;
|
|
599
|
-
_this.headers = headers;
|
|
600
|
-
return _this;
|
|
601
|
-
}
|
|
602
|
-
return UploadEvent;
|
|
603
|
-
}(PreventableEvent));
|
|
604
|
-
|
|
605
|
-
/**
|
|
606
|
-
* Arguments for the `uploadprogress` event. The `uploadprogress` event
|
|
607
|
-
* fires when the files are in the process of uploading.
|
|
608
|
-
*
|
|
609
|
-
* ```ts-no-run
|
|
610
|
-
* @Component({
|
|
611
|
-
* selector: 'my-upload',
|
|
612
|
-
* template: `
|
|
613
|
-
* <kendo-upload
|
|
614
|
-
* [saveUrl]="uploadSaveUrl"
|
|
615
|
-
* [removeUrl]="uploadRemoveUrl"
|
|
616
|
-
* (uploadProgress)="uploadProgressEventHandler($event)">
|
|
617
|
-
* </kendo-upload>
|
|
618
|
-
* `
|
|
619
|
-
* })
|
|
620
|
-
* export class UploadComponent {
|
|
621
|
-
* uploadSaveUrl = 'saveUrl'; // should represent an actual API endpoint
|
|
622
|
-
* uploadRemoveUrl = 'removeUrl'; // should represent an actual API endpoint
|
|
623
|
-
*
|
|
624
|
-
* uploadProgressEventHandler(e: UploadProgressEvent) {
|
|
625
|
-
* console.log(e.files[0].name + ' is ' + e.percentComplete + ' uploaded');
|
|
626
|
-
* }
|
|
627
|
-
* }
|
|
628
|
-
* ```
|
|
629
|
-
*/
|
|
630
|
-
var UploadProgressEvent = /** @class */ (function () {
|
|
631
|
-
/**
|
|
632
|
-
* Constructs the event arguments for the `uploadprogress` event.
|
|
633
|
-
* @param files - The list of files that are being uploaded.
|
|
634
|
-
* @param percentComplete - The portion that has been uploaded.
|
|
635
|
-
*/
|
|
636
|
-
function UploadProgressEvent(files, percentComplete) {
|
|
637
|
-
this.files = files;
|
|
638
|
-
this.percentComplete = percentComplete;
|
|
639
|
-
}
|
|
640
|
-
return UploadProgressEvent;
|
|
641
|
-
}());
|
|
642
|
-
|
|
643
|
-
var ɵ0 = [
|
|
644
|
-
".xlr", ".xls", ".xlsx"
|
|
645
|
-
];
|
|
646
|
-
/**
|
|
647
|
-
* @hidden
|
|
648
|
-
*/
|
|
649
|
-
var fileGroupMap = {
|
|
650
|
-
audio: [
|
|
651
|
-
".aif", ".iff", ".m3u", ".m4a", ".mid", ".mp3", ".mpa", ".wav", ".wma", ".ogg", ".wav", ".wma", ".wpl"
|
|
652
|
-
],
|
|
653
|
-
video: [
|
|
654
|
-
".3g2", ".3gp", ".avi", ".asf", ".flv", ".m4u", ".rm", ".h264", ".m4v", ".mkv", ".mov", ".mp4", ".mpg", ".rm", ".swf", ".vob", ".wmv"
|
|
655
|
-
],
|
|
656
|
-
image: [
|
|
657
|
-
".ai", ".dds", ".heic", ".jpe", "jfif", ".jif", ".jp2", ".jps", ".eps", ".bmp", ".gif", ".jpeg", ".jpg", ".png", ".ps", ".psd", ".svg", ".svgz", ".tif", ".tiff"
|
|
658
|
-
],
|
|
659
|
-
txt: [
|
|
660
|
-
".doc", ".docx", ".log", ".pages", ".tex", ".wpd", ".wps", ".odt", ".rtf", ".text", ".txt", ".wks"
|
|
661
|
-
],
|
|
662
|
-
presentation: [
|
|
663
|
-
".key", ".odp", ".pps", ".ppt", ".pptx"
|
|
664
|
-
],
|
|
665
|
-
data: ɵ0,
|
|
666
|
-
programming: [
|
|
667
|
-
".tmp", ".bak", ".msi", ".cab", ".cpl", ".cur", ".dll", ".dmp", ".drv", ".icns", ".ico", ".link", ".sys", ".cfg",
|
|
668
|
-
".ini", ".asp", ".aspx", ".cer", ".csr", ".css", ".dcr", ".htm", ".html", ".js", ".php", ".rss", ".xhtml"
|
|
669
|
-
],
|
|
670
|
-
pdf: [
|
|
671
|
-
".pdf"
|
|
672
|
-
],
|
|
673
|
-
config: [
|
|
674
|
-
".apk", ".app", ".bat", ".cgi", ".com", ".exe", ".gadget", ".jar", ".wsf"
|
|
675
|
-
],
|
|
676
|
-
zip: [
|
|
677
|
-
".7z", ".cbr", ".gz", ".sitx", ".arj", ".deb", ".pkg", ".rar", ".rpm", ".tar.gz", ".z", ".zip", ".zipx"
|
|
678
|
-
],
|
|
679
|
-
discImage: [
|
|
680
|
-
".dmg", ".iso", ".toast", ".vcd", ".bin", ".cue", ".mdf"
|
|
681
|
-
]
|
|
682
|
-
};
|
|
683
|
-
|
|
684
|
-
/* tslint:disable: no-bitwise */
|
|
685
|
-
/**
|
|
686
|
-
* @hidden
|
|
687
|
-
*/
|
|
688
|
-
var getTotalFilesSizeMessage = function (files) {
|
|
689
|
-
var totalSize = 0;
|
|
690
|
-
var i;
|
|
691
|
-
if (typeof files[0].size === "number") {
|
|
692
|
-
for (i = 0; i < files.length; i++) {
|
|
693
|
-
if (files[i].size) {
|
|
694
|
-
totalSize += files[i].size;
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
else {
|
|
699
|
-
return "";
|
|
700
|
-
}
|
|
701
|
-
totalSize /= 1024;
|
|
702
|
-
if (totalSize < 1024) {
|
|
703
|
-
return totalSize.toFixed(2) + " KB";
|
|
704
|
-
}
|
|
705
|
-
else {
|
|
706
|
-
return (totalSize / 1024).toFixed(2) + " MB";
|
|
707
|
-
}
|
|
708
|
-
};
|
|
709
|
-
var stripPath = function (name) {
|
|
710
|
-
var slashIndex = name.lastIndexOf("\\");
|
|
711
|
-
return (slashIndex !== -1) ? name.substr(slashIndex + 1) : name;
|
|
712
|
-
};
|
|
713
|
-
var getFileExtension = function (fileName) {
|
|
714
|
-
var rFileExtension = /\.([^\.]+)$/;
|
|
715
|
-
var matches = fileName.match(rFileExtension);
|
|
716
|
-
return matches ? matches[0] : "";
|
|
717
|
-
};
|
|
718
|
-
/**
|
|
719
|
-
* @hidden
|
|
720
|
-
*/
|
|
721
|
-
var validateInitialFileInfo = function (file) {
|
|
722
|
-
if (file instanceof Object && file.hasOwnProperty("name")) {
|
|
723
|
-
return true;
|
|
724
|
-
}
|
|
725
|
-
return false;
|
|
726
|
-
};
|
|
727
|
-
/**
|
|
728
|
-
* @hidden
|
|
729
|
-
*/
|
|
730
|
-
var validateInitialFileSelectFile = function (file) {
|
|
731
|
-
if (file instanceof File || validateInitialFileInfo(file)) {
|
|
732
|
-
return true;
|
|
733
|
-
}
|
|
734
|
-
return false;
|
|
735
|
-
};
|
|
736
|
-
/**
|
|
737
|
-
* @hidden
|
|
738
|
-
*/
|
|
739
|
-
var getInitialFileInfo = function (fakeFile) {
|
|
740
|
-
fakeFile.extension = fakeFile.extension || getFileExtension(fakeFile.name);
|
|
741
|
-
fakeFile.name = fakeFile.name;
|
|
742
|
-
fakeFile.size = fakeFile.size || 0;
|
|
743
|
-
if (!fakeFile.hasOwnProperty("state")) {
|
|
744
|
-
fakeFile.state = FileState.Initial;
|
|
745
|
-
}
|
|
746
|
-
if (!fakeFile.hasOwnProperty("uid")) {
|
|
747
|
-
fakeFile.uid = guid();
|
|
748
|
-
}
|
|
749
|
-
return fakeFile;
|
|
750
|
-
};
|
|
751
|
-
/**
|
|
752
|
-
* @hidden
|
|
753
|
-
*/
|
|
754
|
-
var convertFileToFileInfo = function (file) {
|
|
755
|
-
var fileInfo = getFileInfo(file);
|
|
756
|
-
fileInfo.uid = guid();
|
|
757
|
-
// Used to differentiate initial FileInfo objects and actual Files
|
|
758
|
-
fileInfo.state = FileState.Selected;
|
|
759
|
-
return fileInfo;
|
|
760
|
-
};
|
|
761
|
-
var getFileInfo = function (rawFile) {
|
|
762
|
-
var fileName = rawFile.name;
|
|
763
|
-
var fileSize = rawFile.size;
|
|
764
|
-
return {
|
|
765
|
-
extension: getFileExtension(fileName),
|
|
766
|
-
name: fileName,
|
|
767
|
-
rawFile: rawFile,
|
|
768
|
-
size: fileSize,
|
|
769
|
-
state: FileState.Selected
|
|
770
|
-
};
|
|
771
|
-
};
|
|
772
|
-
/**
|
|
773
|
-
* @hidden
|
|
774
|
-
*/
|
|
775
|
-
var getAllFileInfo = function (rawFiles) {
|
|
776
|
-
var allFileInfo = new Array();
|
|
777
|
-
var i;
|
|
778
|
-
for (i = 0; i < rawFiles.length; i++) {
|
|
779
|
-
allFileInfo.push(getFileInfo(rawFiles[i]));
|
|
780
|
-
}
|
|
781
|
-
return allFileInfo;
|
|
782
|
-
};
|
|
783
|
-
/**
|
|
784
|
-
* @hidden
|
|
785
|
-
*/
|
|
786
|
-
var fileHasValidationErrors = function (file) {
|
|
787
|
-
if (file.validationErrors && file.validationErrors.length > 0) {
|
|
788
|
-
return true;
|
|
789
|
-
}
|
|
790
|
-
return false;
|
|
791
|
-
};
|
|
792
|
-
/**
|
|
793
|
-
* @hidden
|
|
794
|
-
*/
|
|
795
|
-
var filesHaveValidationErrors = function (files) {
|
|
796
|
-
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
|
|
797
|
-
var file = files_1[_i];
|
|
798
|
-
if (fileHasValidationErrors(file)) {
|
|
799
|
-
return true;
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
return false;
|
|
803
|
-
};
|
|
804
|
-
/**
|
|
805
|
-
* @hidden
|
|
806
|
-
*/
|
|
807
|
-
var inputFiles = function (input) {
|
|
808
|
-
if (input.files) {
|
|
809
|
-
return getAllFileInfo(input.files);
|
|
810
|
-
}
|
|
811
|
-
else {
|
|
812
|
-
//Required for testing
|
|
813
|
-
var fileNames = input.value.split("|").map(function (file, index) {
|
|
814
|
-
var fileName = file.trim();
|
|
815
|
-
return {
|
|
816
|
-
extension: getFileExtension(fileName),
|
|
817
|
-
name: stripPath(fileName),
|
|
818
|
-
rawFile: null,
|
|
819
|
-
size: (index + 1) * 1000,
|
|
820
|
-
state: FileState.Selected
|
|
821
|
-
};
|
|
822
|
-
});
|
|
823
|
-
return fileNames;
|
|
824
|
-
}
|
|
825
|
-
};
|
|
826
|
-
/**
|
|
827
|
-
* @hidden
|
|
828
|
-
*/
|
|
829
|
-
var assignGuidToFiles = function (files, isUnique) {
|
|
830
|
-
var uid = guid();
|
|
831
|
-
return files.map(function (file) {
|
|
832
|
-
file.uid = isUnique ? guid() : uid;
|
|
833
|
-
return file;
|
|
834
|
-
});
|
|
835
|
-
};
|
|
836
|
-
var focusableRegex = /^(?:a|input|select|textarea|button|object)$/i;
|
|
837
|
-
/**
|
|
838
|
-
* @hidden
|
|
839
|
-
*/
|
|
840
|
-
var IGNORE_TARGET_CLASSES = 'k-icon k-select k-input k-multiselect-wrap';
|
|
841
|
-
/**
|
|
842
|
-
* @hidden
|
|
843
|
-
*/
|
|
844
|
-
var UPLOAD_CLASSES = 'k-upload-button k-clear-selected k-upload-selected k-upload-action';
|
|
845
|
-
var isVisible = function (element) {
|
|
846
|
-
var rect = element.getBoundingClientRect();
|
|
847
|
-
return !!(rect.width && rect.height) && window.getComputedStyle(element).visibility !== 'hidden';
|
|
848
|
-
};
|
|
849
|
-
var toClassList = function (classNames) { return String(classNames).trim().split(' '); };
|
|
850
|
-
/**
|
|
851
|
-
* @hidden
|
|
852
|
-
*/
|
|
853
|
-
var hasClasses = function (element, classNames) {
|
|
854
|
-
var namesList = toClassList(classNames);
|
|
855
|
-
return Boolean(toClassList(element.className).find(function (className) { return namesList.indexOf(className) >= 0; }));
|
|
856
|
-
};
|
|
857
|
-
/**
|
|
858
|
-
* @hidden
|
|
859
|
-
*/
|
|
860
|
-
var isFocusable = function (element, checkVisibility) {
|
|
861
|
-
if (checkVisibility === void 0) { checkVisibility = true; }
|
|
862
|
-
if (element.tagName) {
|
|
863
|
-
var tagName = element.tagName.toLowerCase();
|
|
864
|
-
var tabIndex = element.getAttribute('tabIndex');
|
|
865
|
-
var validTabIndex = tabIndex !== null && !isNaN(tabIndex) && tabIndex > -1;
|
|
866
|
-
var focusable = false;
|
|
867
|
-
if (focusableRegex.test(tagName)) {
|
|
868
|
-
focusable = !element.disabled;
|
|
869
|
-
}
|
|
870
|
-
else {
|
|
871
|
-
focusable = validTabIndex;
|
|
872
|
-
}
|
|
873
|
-
return focusable && (!checkVisibility || isVisible(element));
|
|
874
|
-
}
|
|
875
|
-
return false;
|
|
876
|
-
};
|
|
877
|
-
/**
|
|
878
|
-
* @hidden
|
|
879
|
-
*/
|
|
880
|
-
var getFileGroupCssClass = function (fileExtension) {
|
|
881
|
-
var initial = 'k-i-file';
|
|
882
|
-
for (var group in fileGroupMap) {
|
|
883
|
-
if (fileGroupMap[group].indexOf(fileExtension) >= 0) {
|
|
884
|
-
return initial + "-" + group;
|
|
885
|
-
}
|
|
886
|
-
}
|
|
887
|
-
return initial;
|
|
888
|
-
};
|
|
889
|
-
/**
|
|
890
|
-
* @hidden
|
|
891
|
-
*/
|
|
892
|
-
var isPresent = function (value) { return value !== null && value !== undefined; };
|
|
893
|
-
|
|
894
|
-
/**
|
|
895
|
-
* @hidden
|
|
896
|
-
*/
|
|
897
|
-
var ChunkMap = /** @class */ (function () {
|
|
898
|
-
function ChunkMap() {
|
|
899
|
-
this._files = {};
|
|
900
|
-
}
|
|
901
|
-
ChunkMap.prototype.add = function (uid, totalChunks) {
|
|
902
|
-
var initialChunkInfo = {
|
|
903
|
-
index: 0,
|
|
904
|
-
position: 0,
|
|
905
|
-
retries: 0,
|
|
906
|
-
totalChunks: totalChunks
|
|
907
|
-
};
|
|
908
|
-
this._files[uid] = initialChunkInfo;
|
|
909
|
-
return initialChunkInfo;
|
|
910
|
-
};
|
|
911
|
-
ChunkMap.prototype.remove = function (uid) {
|
|
912
|
-
if (this.has(uid)) {
|
|
913
|
-
this._files[uid] = null;
|
|
914
|
-
delete this._files[uid];
|
|
915
|
-
}
|
|
916
|
-
};
|
|
917
|
-
ChunkMap.prototype.has = function (uid) {
|
|
918
|
-
return uid in this._files;
|
|
919
|
-
};
|
|
920
|
-
ChunkMap.prototype.get = function (uid) {
|
|
921
|
-
return this._files[uid];
|
|
922
|
-
};
|
|
923
|
-
return ChunkMap;
|
|
924
|
-
}());
|
|
925
|
-
|
|
926
|
-
/**
|
|
927
|
-
* @hidden
|
|
928
|
-
*/
|
|
929
|
-
var UploadService = /** @class */ (function () {
|
|
930
|
-
function UploadService(http) {
|
|
931
|
-
this.http = http;
|
|
932
|
-
this.cancelEvent = new EventEmitter();
|
|
933
|
-
this.clearEvent = new EventEmitter();
|
|
934
|
-
this.completeEvent = new EventEmitter();
|
|
935
|
-
this.errorEvent = new EventEmitter();
|
|
936
|
-
this.pauseEvent = new EventEmitter();
|
|
937
|
-
this.removeEvent = new EventEmitter();
|
|
938
|
-
this.resumeEvent = new EventEmitter();
|
|
939
|
-
this.selectEvent = new EventEmitter();
|
|
940
|
-
this.successEvent = new EventEmitter();
|
|
941
|
-
this.uploadEvent = new EventEmitter();
|
|
942
|
-
this.uploadProgressEvent = new EventEmitter();
|
|
943
|
-
/**
|
|
944
|
-
* Required for the `ControlValueAccessor` integration
|
|
945
|
-
*/
|
|
946
|
-
this.changeEvent = new EventEmitter();
|
|
947
|
-
/**
|
|
948
|
-
* Default async settings
|
|
949
|
-
*/
|
|
950
|
-
this.async = {
|
|
951
|
-
autoUpload: true,
|
|
952
|
-
batch: false,
|
|
953
|
-
chunk: false,
|
|
954
|
-
concurrent: true,
|
|
955
|
-
removeField: "fileNames",
|
|
956
|
-
removeHeaders: new HttpHeaders(),
|
|
957
|
-
removeMethod: "POST",
|
|
958
|
-
removeUrl: "",
|
|
959
|
-
responseType: "json",
|
|
960
|
-
saveField: "files",
|
|
961
|
-
saveHeaders: new HttpHeaders(),
|
|
962
|
-
saveMethod: "POST",
|
|
963
|
-
saveUrl: "",
|
|
964
|
-
withCredentials: true
|
|
965
|
-
};
|
|
966
|
-
/**
|
|
967
|
-
* Default chunk settings
|
|
968
|
-
*/
|
|
969
|
-
this.chunk = {
|
|
970
|
-
autoRetryAfter: 100,
|
|
971
|
-
size: 1024 * 1024,
|
|
972
|
-
maxAutoRetries: 1,
|
|
973
|
-
resumable: true
|
|
974
|
-
};
|
|
975
|
-
this.component = 'Upload';
|
|
976
|
-
this.chunkMap = new ChunkMap();
|
|
977
|
-
this.fileList = new FileMap();
|
|
978
|
-
}
|
|
979
|
-
Object.defineProperty(UploadService.prototype, "files", {
|
|
980
|
-
get: function () {
|
|
981
|
-
return this.fileList;
|
|
982
|
-
},
|
|
983
|
-
enumerable: true,
|
|
984
|
-
configurable: true
|
|
985
|
-
});
|
|
986
|
-
UploadService.prototype.setChunkSettings = function (settings) {
|
|
987
|
-
if (settings !== false) {
|
|
988
|
-
this.async.chunk = true;
|
|
989
|
-
if (typeof settings === "object") {
|
|
990
|
-
this.chunk = Object.assign({}, this.chunk, settings);
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
};
|
|
994
|
-
UploadService.prototype.onChange = function () {
|
|
995
|
-
var files = this.fileList.filesFlat.filter(function (file) {
|
|
996
|
-
return file.state === FileState.Initial ||
|
|
997
|
-
file.state === FileState.Uploaded;
|
|
998
|
-
});
|
|
999
|
-
this.changeEvent.emit(files.length > 0 ? files : null);
|
|
1000
|
-
};
|
|
1001
|
-
UploadService.prototype.addFiles = function (files) {
|
|
1002
|
-
var selectEventArgs = new SelectEvent(files);
|
|
1003
|
-
this.selectEvent.emit(selectEventArgs);
|
|
1004
|
-
if (!selectEventArgs.isDefaultPrevented()) {
|
|
1005
|
-
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
|
|
1006
|
-
var file = files_1[_i];
|
|
1007
|
-
this.fileList.add(file);
|
|
1008
|
-
}
|
|
1009
|
-
if (this.async.autoUpload) {
|
|
1010
|
-
this.uploadFiles();
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
if (this.component === 'FileSelect') {
|
|
1014
|
-
var flatFiles = this.fileList.filesFlat;
|
|
1015
|
-
this.changeEvent.emit(flatFiles.length > 0 ? flatFiles : null);
|
|
1016
|
-
}
|
|
1017
|
-
};
|
|
1018
|
-
UploadService.prototype.addInitialFiles = function (initialFiles) {
|
|
1019
|
-
var _this = this;
|
|
1020
|
-
this.fileList.clear();
|
|
1021
|
-
initialFiles.forEach(function (file) {
|
|
1022
|
-
var fakeFile = getInitialFileInfo(file);
|
|
1023
|
-
_this.fileList.add(fakeFile);
|
|
1024
|
-
});
|
|
1025
|
-
};
|
|
1026
|
-
UploadService.prototype.addInitialFileSelectFiles = function (initialFiles) {
|
|
1027
|
-
var _this = this;
|
|
1028
|
-
this.fileList.clear();
|
|
1029
|
-
initialFiles.forEach(function (file) {
|
|
1030
|
-
if (file instanceof File) {
|
|
1031
|
-
_this.fileList.add(convertFileToFileInfo(file));
|
|
1032
|
-
}
|
|
1033
|
-
else {
|
|
1034
|
-
_this.fileList.add(getInitialFileInfo(file));
|
|
1035
|
-
}
|
|
1036
|
-
});
|
|
1037
|
-
};
|
|
1038
|
-
UploadService.prototype.resumeFile = function (uid) {
|
|
1039
|
-
var fileToResume = this.fileList.get(uid);
|
|
1040
|
-
this.resumeEvent.emit(new ResumeEvent(fileToResume[0]));
|
|
1041
|
-
this.fileList.setFilesStateByUid(uid, FileState.Uploading);
|
|
1042
|
-
this._uploadFiles([fileToResume]);
|
|
1043
|
-
};
|
|
1044
|
-
UploadService.prototype.pauseFile = function (uid) {
|
|
1045
|
-
var pausedFile = this.fileList.get(uid)[0];
|
|
1046
|
-
this.pauseEvent.emit(new PauseEvent(pausedFile));
|
|
1047
|
-
this.fileList.setFilesStateByUid(uid, FileState.Paused);
|
|
1048
|
-
};
|
|
1049
|
-
UploadService.prototype.removeFiles = function (uid) {
|
|
1050
|
-
var removedFiles = this.fileList.get(uid);
|
|
1051
|
-
// Clone the Headers so that the default ones are not overridden
|
|
1052
|
-
var removeEventArgs = new RemoveEvent(removedFiles, this.cloneRequestHeaders(this.async.removeHeaders));
|
|
1053
|
-
this.removeEvent.emit(removeEventArgs);
|
|
1054
|
-
if (!removeEventArgs.isDefaultPrevented()) {
|
|
1055
|
-
if (this.component === 'Upload' &&
|
|
1056
|
-
(removedFiles[0].state === FileState.Uploaded ||
|
|
1057
|
-
removedFiles[0].state === FileState.Initial)) {
|
|
1058
|
-
this.performRemove(removedFiles, removeEventArgs);
|
|
1059
|
-
}
|
|
1060
|
-
else {
|
|
1061
|
-
this.fileList.remove(uid);
|
|
1062
|
-
if (this.component === 'FileSelect') {
|
|
1063
|
-
var flatFiles = this.fileList.filesFlat;
|
|
1064
|
-
this.changeEvent.emit(flatFiles.length > 0 ? flatFiles : null);
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
};
|
|
1069
|
-
UploadService.prototype.cancelFiles = function (uid) {
|
|
1070
|
-
var canceledFiles = this.fileList.get(uid);
|
|
1071
|
-
var cancelEventArgs = new CancelEvent(canceledFiles);
|
|
1072
|
-
this.cancelEvent.emit(cancelEventArgs);
|
|
1073
|
-
for (var _i = 0, canceledFiles_1 = canceledFiles; _i < canceledFiles_1.length; _i++) {
|
|
1074
|
-
var file = canceledFiles_1[_i];
|
|
1075
|
-
if (file.httpSubscription) {
|
|
1076
|
-
file.httpSubscription.unsubscribe();
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
this.fileList.remove(uid);
|
|
1080
|
-
this.checkAllComplete();
|
|
1081
|
-
};
|
|
1082
|
-
UploadService.prototype.clearFiles = function () {
|
|
1083
|
-
var clearEventArgs = new ClearEvent();
|
|
1084
|
-
this.clearEvent.emit(clearEventArgs);
|
|
1085
|
-
if (!clearEventArgs.isDefaultPrevented()) {
|
|
1086
|
-
var triggerChange = this.fileList.hasFileWithState([
|
|
1087
|
-
FileState.Initial,
|
|
1088
|
-
FileState.Uploaded
|
|
1089
|
-
]);
|
|
1090
|
-
this.fileList.clear();
|
|
1091
|
-
if (triggerChange) {
|
|
1092
|
-
this.onChange();
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
};
|
|
1096
|
-
UploadService.prototype.uploadFiles = function () {
|
|
1097
|
-
var filesToUpload = [];
|
|
1098
|
-
if (this.async.concurrent) {
|
|
1099
|
-
filesToUpload = this.fileList.filesToUpload;
|
|
1100
|
-
}
|
|
1101
|
-
if (!this.async.concurrent && !this.fileList.hasFileWithState([FileState.Uploading])) {
|
|
1102
|
-
filesToUpload = this.fileList.firstFileToUpload ? [this.fileList.firstFileToUpload] : [];
|
|
1103
|
-
}
|
|
1104
|
-
if (filesToUpload && filesToUpload.length > 0) {
|
|
1105
|
-
this._uploadFiles(filesToUpload);
|
|
1106
|
-
}
|
|
1107
|
-
};
|
|
1108
|
-
UploadService.prototype.retryFiles = function (uid) {
|
|
1109
|
-
var filesToRetry = [this.fileList.get(uid)];
|
|
1110
|
-
if (filesToRetry) {
|
|
1111
|
-
this._uploadFiles(filesToRetry);
|
|
1112
|
-
}
|
|
1113
|
-
};
|
|
1114
|
-
UploadService.prototype._uploadFiles = function (allFiles) {
|
|
1115
|
-
var _loop_1 = function (filesToUpload) {
|
|
1116
|
-
if (filesToUpload[0].state === FileState.Paused) {
|
|
1117
|
-
return { value: void 0 };
|
|
1118
|
-
}
|
|
1119
|
-
// Clone the Headers so that the default ones are not overridden
|
|
1120
|
-
var uploadEventArgs = new UploadEvent(filesToUpload, this_1.cloneRequestHeaders(this_1.async.saveHeaders));
|
|
1121
|
-
this_1.uploadEvent.emit(uploadEventArgs);
|
|
1122
|
-
if (!uploadEventArgs.isDefaultPrevented()) {
|
|
1123
|
-
this_1.fileList.setFilesState(filesToUpload, FileState.Uploading);
|
|
1124
|
-
var httpSubcription_1 = this_1.performUpload(filesToUpload, uploadEventArgs);
|
|
1125
|
-
filesToUpload.forEach(function (file) {
|
|
1126
|
-
file.httpSubscription = httpSubcription_1;
|
|
1127
|
-
});
|
|
1128
|
-
}
|
|
1129
|
-
else {
|
|
1130
|
-
this_1.fileList.remove(filesToUpload[0].uid);
|
|
1131
|
-
}
|
|
1132
|
-
};
|
|
1133
|
-
var this_1 = this;
|
|
1134
|
-
for (var _i = 0, allFiles_1 = allFiles; _i < allFiles_1.length; _i++) {
|
|
1135
|
-
var filesToUpload = allFiles_1[_i];
|
|
1136
|
-
var state_1 = _loop_1(filesToUpload);
|
|
1137
|
-
if (typeof state_1 === "object")
|
|
1138
|
-
return state_1.value;
|
|
1139
|
-
}
|
|
1140
|
-
};
|
|
1141
|
-
UploadService.prototype.performRemove = function (files, removeEventArgs) {
|
|
1142
|
-
var _this = this;
|
|
1143
|
-
var async = this.async;
|
|
1144
|
-
var fileNames = files.map(function (file) {
|
|
1145
|
-
return file.name;
|
|
1146
|
-
});
|
|
1147
|
-
var formData = this.populateRemoveFormData(fileNames, removeEventArgs.data);
|
|
1148
|
-
var options = this.populateRequestOptions(removeEventArgs.headers);
|
|
1149
|
-
var removeRequest = new HttpRequest(async.removeMethod, async.removeUrl, formData, options);
|
|
1150
|
-
this.http.request(removeRequest)
|
|
1151
|
-
.subscribe(function (success) {
|
|
1152
|
-
_this.onSuccess(success, files, "remove");
|
|
1153
|
-
}, function (error) {
|
|
1154
|
-
_this.onError(error, files, "remove");
|
|
1155
|
-
});
|
|
1156
|
-
};
|
|
1157
|
-
UploadService.prototype.performUpload = function (files, uploadEventArgs) {
|
|
1158
|
-
var _this = this;
|
|
1159
|
-
var async = this.async;
|
|
1160
|
-
var formData = this.populateUploadFormData(files, uploadEventArgs.data);
|
|
1161
|
-
var options = this.populateRequestOptions(uploadEventArgs.headers);
|
|
1162
|
-
var uploadRequest = new HttpRequest(async.saveMethod, async.saveUrl, formData, options);
|
|
1163
|
-
var httpSubscription = this.http.request(uploadRequest)
|
|
1164
|
-
.subscribe(function (event) {
|
|
1165
|
-
if (event.type === HttpEventType.UploadProgress && !_this.async.chunk) {
|
|
1166
|
-
_this.onProgress(event, files);
|
|
1167
|
-
}
|
|
1168
|
-
else if (event instanceof HttpResponse) {
|
|
1169
|
-
_this.onSuccess(event, files, "upload");
|
|
1170
|
-
_this.checkAllComplete();
|
|
1171
|
-
}
|
|
1172
|
-
}, function (error) {
|
|
1173
|
-
_this.onError(error, files, "upload");
|
|
1174
|
-
_this.checkAllComplete();
|
|
1175
|
-
});
|
|
1176
|
-
return httpSubscription;
|
|
1177
|
-
};
|
|
1178
|
-
UploadService.prototype.onSuccess = function (successResponse, files, operation) {
|
|
1179
|
-
if (operation === "upload" && this.async.chunk) {
|
|
1180
|
-
this.onChunkProgress(files);
|
|
1181
|
-
if (this.isChunkUploadComplete(files[0].uid)) {
|
|
1182
|
-
this.removeChunkInfo(files[0].uid);
|
|
1183
|
-
}
|
|
1184
|
-
else {
|
|
1185
|
-
this.updateChunkInfo(files[0].uid);
|
|
1186
|
-
this._uploadFiles([files]);
|
|
1187
|
-
return;
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
var successArgs = new SuccessEvent(files, operation, successResponse);
|
|
1191
|
-
this.successEvent.emit(successArgs);
|
|
1192
|
-
if (operation === "upload") {
|
|
1193
|
-
this.fileList.setFilesState(files, successArgs.isDefaultPrevented() ? FileState.Failed : FileState.Uploaded);
|
|
1194
|
-
}
|
|
1195
|
-
else {
|
|
1196
|
-
if (!successArgs.isDefaultPrevented()) {
|
|
1197
|
-
this.fileList.remove(files[0].uid);
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
if (!successArgs.isDefaultPrevented()) {
|
|
1201
|
-
this.onChange();
|
|
1202
|
-
}
|
|
1203
|
-
};
|
|
1204
|
-
UploadService.prototype.onError = function (errorResponse, files, operation) {
|
|
1205
|
-
var _this = this;
|
|
1206
|
-
if (operation === "upload" && this.async.chunk) {
|
|
1207
|
-
var maxRetries = this.chunk.maxAutoRetries;
|
|
1208
|
-
var chunkInfo = this.chunkMap.get(files[0].uid);
|
|
1209
|
-
if (chunkInfo.retries < maxRetries) {
|
|
1210
|
-
chunkInfo.retries += 1;
|
|
1211
|
-
setTimeout(function () {
|
|
1212
|
-
_this.retryFiles(files[0].uid);
|
|
1213
|
-
}, this.chunk.autoRetryAfter);
|
|
1214
|
-
return;
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
var errorArgs = new ErrorEvent(files, operation, errorResponse);
|
|
1218
|
-
this.errorEvent.emit(errorArgs);
|
|
1219
|
-
if (operation === "upload") {
|
|
1220
|
-
this.fileList.setFilesState(files, FileState.Failed);
|
|
1221
|
-
}
|
|
1222
|
-
};
|
|
1223
|
-
UploadService.prototype.onProgress = function (event, files) {
|
|
1224
|
-
var percentComplete = Math.round(100 * event.loaded / event.total);
|
|
1225
|
-
var progressArgs = new UploadProgressEvent(files, percentComplete < 100 ? percentComplete : 100);
|
|
1226
|
-
this.uploadProgressEvent.emit(progressArgs);
|
|
1227
|
-
};
|
|
1228
|
-
UploadService.prototype.onChunkProgress = function (files) {
|
|
1229
|
-
var chunkInfo = this.chunkMap.get(files[0].uid);
|
|
1230
|
-
var percentComplete = 0;
|
|
1231
|
-
if (chunkInfo) {
|
|
1232
|
-
if (chunkInfo.index === chunkInfo.totalChunks - 1) {
|
|
1233
|
-
percentComplete = 100;
|
|
1234
|
-
}
|
|
1235
|
-
else {
|
|
1236
|
-
percentComplete = Math.round(((chunkInfo.index + 1) / chunkInfo.totalChunks) * 100);
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
var progressArgs = new UploadProgressEvent(files, percentComplete < 100 ? percentComplete : 100);
|
|
1240
|
-
this.uploadProgressEvent.emit(progressArgs);
|
|
1241
|
-
};
|
|
1242
|
-
UploadService.prototype.checkAllComplete = function () {
|
|
1243
|
-
if (!this.fileList.hasFileWithState([
|
|
1244
|
-
FileState.Uploading,
|
|
1245
|
-
FileState.Paused
|
|
1246
|
-
]) && this.areAllSelectedFilesHandled()) {
|
|
1247
|
-
this.completeEvent.emit();
|
|
1248
|
-
}
|
|
1249
|
-
else if (this.shouldUploadNextFile()) {
|
|
1250
|
-
this.uploadFiles();
|
|
1251
|
-
}
|
|
1252
|
-
};
|
|
1253
|
-
UploadService.prototype.shouldUploadNextFile = function () {
|
|
1254
|
-
return !this.async.concurrent &&
|
|
1255
|
-
this.fileList.hasFileWithState([FileState.Selected]) &&
|
|
1256
|
-
!this.fileList.hasFileWithState([FileState.Uploading]);
|
|
1257
|
-
};
|
|
1258
|
-
UploadService.prototype.areAllSelectedFilesHandled = function () {
|
|
1259
|
-
var validSelectedFiles = this.fileList.getFilesWithState(FileState.Selected).filter(function (file) { return !file.validationErrors; });
|
|
1260
|
-
return validSelectedFiles.length === 0;
|
|
1261
|
-
};
|
|
1262
|
-
UploadService.prototype.cloneRequestHeaders = function (headers) {
|
|
1263
|
-
var cloned = {};
|
|
1264
|
-
if (headers) {
|
|
1265
|
-
headers.keys().forEach(function (key) {
|
|
1266
|
-
cloned[key] = headers.get(key);
|
|
1267
|
-
});
|
|
1268
|
-
}
|
|
1269
|
-
return new HttpHeaders(cloned);
|
|
1270
|
-
};
|
|
1271
|
-
UploadService.prototype.populateRequestOptions = function (headers) {
|
|
1272
|
-
return {
|
|
1273
|
-
headers: headers,
|
|
1274
|
-
reportProgress: true,
|
|
1275
|
-
responseType: this.async.responseType,
|
|
1276
|
-
withCredentials: this.async.withCredentials
|
|
1277
|
-
};
|
|
1278
|
-
};
|
|
1279
|
-
UploadService.prototype.populateUploadFormData = function (files, clientData) {
|
|
1280
|
-
var saveField = this.async.saveField;
|
|
1281
|
-
var data = new FormData();
|
|
1282
|
-
this.populateClientFormData(data, clientData);
|
|
1283
|
-
if (this.async.chunk) {
|
|
1284
|
-
data.append(saveField, this.getNextChunk(files[0]));
|
|
1285
|
-
data.append("metadata", this.getChunkMetadata(files[0]));
|
|
1286
|
-
}
|
|
1287
|
-
else {
|
|
1288
|
-
for (var _i = 0, files_2 = files; _i < files_2.length; _i++) {
|
|
1289
|
-
var file = files_2[_i];
|
|
1290
|
-
data.append(saveField, file.rawFile);
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
return data;
|
|
1294
|
-
};
|
|
1295
|
-
UploadService.prototype.populateRemoveFormData = function (fileNames, clientData) {
|
|
1296
|
-
var data = new FormData();
|
|
1297
|
-
this.populateClientFormData(data, clientData);
|
|
1298
|
-
for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) {
|
|
1299
|
-
var fileName = fileNames_1[_i];
|
|
1300
|
-
data.append(this.async.removeField, fileName);
|
|
1301
|
-
}
|
|
1302
|
-
return data;
|
|
1303
|
-
};
|
|
1304
|
-
UploadService.prototype.populateClientFormData = function (data, clientData) {
|
|
1305
|
-
for (var key in clientData) {
|
|
1306
|
-
if (clientData.hasOwnProperty(key)) {
|
|
1307
|
-
data.append(key, clientData[key]);
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
};
|
|
1311
|
-
/* Chunking Helper Methods Section */
|
|
1312
|
-
UploadService.prototype.getNextChunk = function (file) {
|
|
1313
|
-
var info = this.getChunkInfo(file);
|
|
1314
|
-
var newPosition = info.position + this.chunk.size;
|
|
1315
|
-
return file.rawFile.slice(info.position, newPosition);
|
|
1316
|
-
};
|
|
1317
|
-
UploadService.prototype.getChunkInfo = function (file) {
|
|
1318
|
-
var chunkInfo = this.chunkMap.get(file.uid);
|
|
1319
|
-
if (!chunkInfo) {
|
|
1320
|
-
var totalChunks = Math.ceil(file.size / this.chunk.size);
|
|
1321
|
-
chunkInfo = this.chunkMap.add(file.uid, totalChunks);
|
|
1322
|
-
}
|
|
1323
|
-
return chunkInfo;
|
|
1324
|
-
};
|
|
1325
|
-
UploadService.prototype.updateChunkInfo = function (uid) {
|
|
1326
|
-
var chunkInfo = this.chunkMap.get(uid);
|
|
1327
|
-
if (chunkInfo.index < chunkInfo.totalChunks - 1) {
|
|
1328
|
-
chunkInfo.index += 1;
|
|
1329
|
-
chunkInfo.position += this.chunk.size;
|
|
1330
|
-
chunkInfo.retries = 0;
|
|
1331
|
-
}
|
|
1332
|
-
};
|
|
1333
|
-
UploadService.prototype.removeChunkInfo = function (uid) {
|
|
1334
|
-
this.chunkMap.remove(uid);
|
|
1335
|
-
};
|
|
1336
|
-
UploadService.prototype.getChunkMetadata = function (file) {
|
|
1337
|
-
var chunkInfo = this.chunkMap.get(file.uid);
|
|
1338
|
-
var chunkMetadata = {
|
|
1339
|
-
chunkIndex: chunkInfo.index,
|
|
1340
|
-
contentType: file.rawFile.type,
|
|
1341
|
-
fileName: file.name,
|
|
1342
|
-
fileSize: file.size,
|
|
1343
|
-
fileUid: file.uid,
|
|
1344
|
-
totalChunks: chunkInfo.totalChunks
|
|
1345
|
-
};
|
|
1346
|
-
return JSON.stringify(chunkMetadata);
|
|
1347
|
-
};
|
|
1348
|
-
UploadService.prototype.isChunkUploadComplete = function (uid) {
|
|
1349
|
-
var chunkInfo = this.chunkMap.get(uid);
|
|
1350
|
-
if (chunkInfo) {
|
|
1351
|
-
return chunkInfo.index + 1 === chunkInfo.totalChunks;
|
|
1352
|
-
}
|
|
1353
|
-
return false;
|
|
1354
|
-
};
|
|
1355
|
-
UploadService = __decorate([
|
|
1356
|
-
Injectable(),
|
|
1357
|
-
__metadata("design:paramtypes", [HttpClient])
|
|
1358
|
-
], UploadService);
|
|
1359
|
-
return UploadService;
|
|
1360
|
-
}());
|
|
1361
|
-
|
|
1362
|
-
/**
|
|
1363
|
-
* @hidden
|
|
1364
|
-
*/
|
|
1365
|
-
var NavigationService = /** @class */ (function () {
|
|
1366
|
-
function NavigationService(uploadService) {
|
|
1367
|
-
this.uploadService = uploadService;
|
|
1368
|
-
this.onActionButtonAction = new EventEmitter();
|
|
1369
|
-
this.onActionButtonFocus = new EventEmitter();
|
|
1370
|
-
this.onFileAction = new EventEmitter();
|
|
1371
|
-
this.onFileFocus = new EventEmitter();
|
|
1372
|
-
this.onTab = new EventEmitter();
|
|
1373
|
-
this.onWrapperFocus = new EventEmitter();
|
|
1374
|
-
this.onSelectButtonFocus = new EventEmitter();
|
|
1375
|
-
this.actionButtonsVisible = false;
|
|
1376
|
-
this.focused = false;
|
|
1377
|
-
this._focusedIndex = -1;
|
|
1378
|
-
}
|
|
1379
|
-
NavigationService.prototype.action = function (event) {
|
|
1380
|
-
var key = event.keyCode;
|
|
1381
|
-
return this.keyBindings[key];
|
|
1382
|
-
};
|
|
1383
|
-
NavigationService.prototype.process = function (event) {
|
|
1384
|
-
var handler = this.action(event);
|
|
1385
|
-
if (handler) {
|
|
1386
|
-
handler(event.shiftKey);
|
|
1387
|
-
}
|
|
1388
|
-
};
|
|
1389
|
-
NavigationService.prototype.computeKeys = function (direction) {
|
|
1390
|
-
var _this = this;
|
|
1391
|
-
var _a;
|
|
1392
|
-
this.keyBindings = (_a = {},
|
|
1393
|
-
_a[Keys.Enter] = function () { return _this.handleEnter(); },
|
|
1394
|
-
_a[Keys.Escape] = function () { return _this.handleEscape(); },
|
|
1395
|
-
_a[Keys.Delete] = function () { return _this.handleDelete(); },
|
|
1396
|
-
_a[Keys.Tab] = function (shifted) { return _this.handleTab(shifted); },
|
|
1397
|
-
_a[Keys.ArrowUp] = function () { return _this.handleUp(); },
|
|
1398
|
-
_a[Keys.ArrowDown] = function () { return _this.handleDown(); },
|
|
1399
|
-
_a[this.invertKeys(direction, Keys.ArrowLeft, Keys.ArrowRight)] = function () { return _this.handleLeft(); },
|
|
1400
|
-
_a[this.invertKeys(direction, Keys.ArrowRight, Keys.ArrowLeft)] = function () { return _this.handleRight(); },
|
|
1401
|
-
_a);
|
|
1402
|
-
};
|
|
1403
|
-
NavigationService.prototype.invertKeys = function (direction, original, inverted) {
|
|
1404
|
-
return direction === 'rtl' ? inverted : original;
|
|
1405
|
-
};
|
|
1406
|
-
NavigationService.prototype.focusSelectButton = function () {
|
|
1407
|
-
this.focused = true;
|
|
1408
|
-
this._focusedIndex = -1;
|
|
1409
|
-
this.onSelectButtonFocus.emit();
|
|
1410
|
-
};
|
|
1411
|
-
NavigationService.prototype.handleEnter = function () {
|
|
1412
|
-
if (this.lastIndex >= 0) {
|
|
1413
|
-
if (this.focusedIndex <= this.lastFileIndex) {
|
|
1414
|
-
this.onFileAction.emit(Keys.Enter);
|
|
1415
|
-
return;
|
|
1416
|
-
}
|
|
1417
|
-
if (this.actionButtonsVisible && this.focusedIndex <= this.lastIndex) {
|
|
1418
|
-
this.onActionButtonAction.emit(this.focusedIndex < this.lastIndex ? "clear" : "upload");
|
|
1419
|
-
}
|
|
1420
|
-
}
|
|
1421
|
-
};
|
|
1422
|
-
NavigationService.prototype.handleDelete = function () {
|
|
1423
|
-
if (this.focusedIndex >= 0 && this.focusedIndex <= this.lastFileIndex) {
|
|
1424
|
-
this.onFileAction.emit(Keys.Delete);
|
|
1425
|
-
}
|
|
1426
|
-
};
|
|
1427
|
-
NavigationService.prototype.handleEscape = function () {
|
|
1428
|
-
if (this.focusedIndex >= 0 && this.focusedIndex <= this.lastFileIndex) {
|
|
1429
|
-
this.onFileAction.emit(Keys.Escape);
|
|
1430
|
-
}
|
|
1431
|
-
};
|
|
1432
|
-
NavigationService.prototype.handleLeft = function () {
|
|
1433
|
-
if (this.actionButtonsVisible && this.focusedIndex === this.lastIndex) {
|
|
1434
|
-
this.focusedIndex -= 1;
|
|
1435
|
-
this.onActionButtonFocus.emit("clear");
|
|
1436
|
-
}
|
|
1437
|
-
};
|
|
1438
|
-
NavigationService.prototype.handleRight = function () {
|
|
1439
|
-
if (this.actionButtonsVisible && this.focusedIndex === this.lastIndex - 1) {
|
|
1440
|
-
this.focusedIndex += 1;
|
|
1441
|
-
this.onActionButtonFocus.emit("upload");
|
|
1442
|
-
}
|
|
1443
|
-
};
|
|
1444
|
-
NavigationService.prototype.handleTab = function (shifted) {
|
|
1445
|
-
if (this.focusedIndex >= 0 && shifted) {
|
|
1446
|
-
this.focusedIndex = -1;
|
|
1447
|
-
return;
|
|
1448
|
-
}
|
|
1449
|
-
this.onTab.emit();
|
|
1450
|
-
};
|
|
1451
|
-
NavigationService.prototype.handleDown = function () {
|
|
1452
|
-
if (this.lastIndex >= 0 && this.focusedIndex < this.lastIndex) {
|
|
1453
|
-
if (this.focusedIndex < this.lastFileIndex) {
|
|
1454
|
-
this.focusedIndex += 1;
|
|
1455
|
-
this.onFileFocus.emit(this.focusedIndex);
|
|
1456
|
-
return;
|
|
1457
|
-
}
|
|
1458
|
-
if (this.actionButtonsVisible && this.focusedIndex === this.lastFileIndex) {
|
|
1459
|
-
this.focusedIndex += 1;
|
|
1460
|
-
this.onActionButtonFocus.emit("clear");
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
};
|
|
1464
|
-
NavigationService.prototype.handleUp = function () {
|
|
1465
|
-
if (this.lastIndex >= 0 && this.focusedIndex > -1) {
|
|
1466
|
-
this.focusedIndex -= 1;
|
|
1467
|
-
if (this.focusedIndex === -1) {
|
|
1468
|
-
this.onSelectButtonFocus.emit();
|
|
1469
|
-
return;
|
|
1470
|
-
}
|
|
1471
|
-
if (this.focusedIndex <= this.lastFileIndex) {
|
|
1472
|
-
this.onFileFocus.emit(this.focusedIndex);
|
|
1473
|
-
return;
|
|
1474
|
-
}
|
|
1475
|
-
if (this.actionButtonsVisible && this.focusedIndex <= this.lastIndex) {
|
|
1476
|
-
this.focusedIndex = this.lastFileIndex;
|
|
1477
|
-
this.onFileFocus.emit(this.focusedIndex);
|
|
1478
|
-
}
|
|
1479
|
-
}
|
|
1480
|
-
};
|
|
1481
|
-
Object.defineProperty(NavigationService.prototype, "focusedIndex", {
|
|
1482
|
-
get: function () {
|
|
1483
|
-
return this._focusedIndex;
|
|
1484
|
-
},
|
|
1485
|
-
set: function (index) {
|
|
1486
|
-
if (!this.focused) {
|
|
1487
|
-
this.onWrapperFocus.emit();
|
|
1488
|
-
}
|
|
1489
|
-
this._focusedIndex = index;
|
|
1490
|
-
this.focused = true;
|
|
1491
|
-
if (this._focusedIndex >= 0 && this._focusedIndex <= this.lastFileIndex) {
|
|
1492
|
-
this.onFileFocus.emit(index);
|
|
1493
|
-
}
|
|
1494
|
-
},
|
|
1495
|
-
enumerable: true,
|
|
1496
|
-
configurable: true
|
|
1497
|
-
});
|
|
1498
|
-
Object.defineProperty(NavigationService.prototype, "lastFileIndex", {
|
|
1499
|
-
get: function () {
|
|
1500
|
-
return this.actionButtonsVisible ? this.lastIndex - 2 : this.lastIndex;
|
|
1501
|
-
},
|
|
1502
|
-
enumerable: true,
|
|
1503
|
-
configurable: true
|
|
1504
|
-
});
|
|
1505
|
-
Object.defineProperty(NavigationService.prototype, "lastIndex", {
|
|
1506
|
-
get: function () {
|
|
1507
|
-
var fileCount = this.uploadService.files.count;
|
|
1508
|
-
return this.actionButtonsVisible ? fileCount + 1 : fileCount - 1;
|
|
1509
|
-
},
|
|
1510
|
-
enumerable: true,
|
|
1511
|
-
configurable: true
|
|
1512
|
-
});
|
|
1513
|
-
NavigationService = __decorate([
|
|
1514
|
-
Injectable(),
|
|
1515
|
-
__metadata("design:paramtypes", [UploadService])
|
|
1516
|
-
], NavigationService);
|
|
1517
|
-
return NavigationService;
|
|
1518
|
-
}());
|
|
1519
|
-
|
|
1520
|
-
/**
|
|
1521
|
-
* Used to customize the rendering of the files in the list ([see example]({% slug templates_upload %}#toc-file-template)).
|
|
1522
|
-
*/
|
|
1523
|
-
var FileTemplateDirective = /** @class */ (function () {
|
|
1524
|
-
function FileTemplateDirective(templateRef) {
|
|
1525
|
-
this.templateRef = templateRef;
|
|
1526
|
-
}
|
|
1527
|
-
FileTemplateDirective = __decorate([
|
|
1528
|
-
Directive({
|
|
1529
|
-
selector: '[kendoUploadFileTemplate], [kendoFileSelectFileTemplate]' // tslint:disable-line:directive-selector-prefix
|
|
1530
|
-
}),
|
|
1531
|
-
__metadata("design:paramtypes", [TemplateRef])
|
|
1532
|
-
], FileTemplateDirective);
|
|
1533
|
-
return FileTemplateDirective;
|
|
1534
|
-
}());
|
|
1535
|
-
|
|
1536
|
-
var components = {};
|
|
1537
|
-
/**
|
|
1538
|
-
* @hidden
|
|
1539
|
-
*/
|
|
1540
|
-
var DropZoneService = /** @class */ (function () {
|
|
1541
|
-
function DropZoneService() {
|
|
1542
|
-
}
|
|
1543
|
-
DropZoneService.prototype.addComponent = function (component, zoneId) {
|
|
1544
|
-
if (this.has(zoneId)) {
|
|
1545
|
-
components[zoneId].push(component);
|
|
1546
|
-
}
|
|
1547
|
-
else {
|
|
1548
|
-
components[zoneId] = [component];
|
|
1549
|
-
}
|
|
1550
|
-
};
|
|
1551
|
-
DropZoneService.prototype.getComponents = function (zoneId) {
|
|
1552
|
-
return components[zoneId];
|
|
1553
|
-
};
|
|
1554
|
-
DropZoneService.prototype.has = function (id) {
|
|
1555
|
-
return id in components;
|
|
1556
|
-
};
|
|
1557
|
-
DropZoneService = __decorate([
|
|
1558
|
-
Injectable()
|
|
1559
|
-
], DropZoneService);
|
|
1560
|
-
return DropZoneService;
|
|
1561
|
-
}());
|
|
1562
|
-
|
|
1563
|
-
/**
|
|
1564
|
-
* Used to customize the rendering of the file info section in the list. All other elements of the default template, such as file icon, action buttons, upload progress etc. will be preserved in place. ([see example]({% slug templates_upload %}#toc-file-info-template)).
|
|
1565
|
-
*/
|
|
1566
|
-
var FileInfoTemplateDirective = /** @class */ (function () {
|
|
1567
|
-
function FileInfoTemplateDirective(templateRef) {
|
|
1568
|
-
this.templateRef = templateRef;
|
|
1569
|
-
}
|
|
1570
|
-
FileInfoTemplateDirective = __decorate([
|
|
1571
|
-
Directive({
|
|
1572
|
-
selector: '[kendoUploadFileInfoTemplate], [kendoFileSelectFileInfoTemplate]'
|
|
1573
|
-
}),
|
|
1574
|
-
__metadata("design:paramtypes", [TemplateRef])
|
|
1575
|
-
], FileInfoTemplateDirective);
|
|
1576
|
-
return FileInfoTemplateDirective;
|
|
1577
|
-
}());
|
|
1578
|
-
|
|
1579
|
-
/**
|
|
1580
|
-
* @hidden
|
|
1581
|
-
*/
|
|
1582
|
-
var FILESELECT_VALUE_ACCESSOR = {
|
|
1583
|
-
multi: true,
|
|
1584
|
-
provide: NG_VALUE_ACCESSOR,
|
|
1585
|
-
useExisting: forwardRef(function () { return FileSelectComponent; }) // tslint:disable-line:no-forward-ref
|
|
1586
|
-
};
|
|
1587
|
-
var FileSelectComponent = /** @class */ (function () {
|
|
1588
|
-
function FileSelectComponent(uploadService, localization, navigation, dropZoneService, ngZone, renderer, cdr, wrapper) {
|
|
1589
|
-
var _this = this;
|
|
1590
|
-
this.uploadService = uploadService;
|
|
1591
|
-
this.localization = localization;
|
|
1592
|
-
this.navigation = navigation;
|
|
1593
|
-
this.dropZoneService = dropZoneService;
|
|
1594
|
-
this.ngZone = ngZone;
|
|
1595
|
-
this.renderer = renderer;
|
|
1596
|
-
this.cdr = cdr;
|
|
1597
|
-
/**
|
|
1598
|
-
* Disables the FileSelect.
|
|
1599
|
-
* The default value is `false`.
|
|
1600
|
-
*/
|
|
1601
|
-
this.disabled = false;
|
|
1602
|
-
/**
|
|
1603
|
-
* Enables the selection of multiple files
|
|
1604
|
-
* ([see example]({% slug fileprocessing_upload %}#toc-upload-of-sinlge-or-multiple-files)).
|
|
1605
|
-
* If set to `false`, only one file can be selected at a time.
|
|
1606
|
-
*/
|
|
1607
|
-
this.multiple = true;
|
|
1608
|
-
/**
|
|
1609
|
-
* Toggles the visibility of the file list.
|
|
1610
|
-
*/
|
|
1611
|
-
this.showFileList = true;
|
|
1612
|
-
/**
|
|
1613
|
-
* Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the FileSelect.
|
|
1614
|
-
*/
|
|
1615
|
-
this.tabindex = 0;
|
|
1616
|
-
/**
|
|
1617
|
-
* @hidden
|
|
1618
|
-
*/
|
|
1619
|
-
this.focusableId = "k-" + guid();
|
|
1620
|
-
/**
|
|
1621
|
-
* Fires when the user navigates outside the component.
|
|
1622
|
-
*/
|
|
1623
|
-
this.onBlur = new EventEmitter();
|
|
1624
|
-
/**
|
|
1625
|
-
* Fires when the component is focused.
|
|
1626
|
-
*/
|
|
1627
|
-
this.onFocus = new EventEmitter();
|
|
1628
|
-
/**
|
|
1629
|
-
* Fires when files are selected. If prevented, the selected files will not be added to the list.
|
|
1630
|
-
*/
|
|
1631
|
-
this.select = new EventEmitter();
|
|
1632
|
-
/**
|
|
1633
|
-
* Fires when a file is about to be removed. If prevented, the file will remain in the list.
|
|
1634
|
-
*/
|
|
1635
|
-
this.remove = new EventEmitter();
|
|
1636
|
-
/**
|
|
1637
|
-
* Fires when the value of the component has changed as a result of a successful `select` or `remove` operation.
|
|
1638
|
-
*/
|
|
1639
|
-
this.valueChange = new EventEmitter();
|
|
1640
|
-
this.hostDefaultClasses = true;
|
|
1641
|
-
/**
|
|
1642
|
-
* @hidden
|
|
1643
|
-
*/
|
|
1644
|
-
this._restrictions = {
|
|
1645
|
-
allowedExtensions: [],
|
|
1646
|
-
maxFileSize: 0,
|
|
1647
|
-
minFileSize: 0
|
|
1648
|
-
};
|
|
1649
|
-
this.onTouchedCallback = function (_) { };
|
|
1650
|
-
this.onChangeCallback = function (_) { };
|
|
1651
|
-
validatePackage(packageMetadata);
|
|
1652
|
-
this.wrapper = wrapper.nativeElement;
|
|
1653
|
-
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
1654
|
-
this.navigation.computeKeys(this.direction);
|
|
1655
|
-
this.fileList = this.uploadService.files;
|
|
1656
|
-
this.localizationChangeSubscription = localization.changes.subscribe(function (_a) {
|
|
1657
|
-
var rtl = _a.rtl;
|
|
1658
|
-
_this.direction = rtl ? 'rtl' : 'ltr';
|
|
1659
|
-
_this.navigation.computeKeys(_this.direction);
|
|
1660
|
-
});
|
|
1661
|
-
this.subscribeBlur();
|
|
1662
|
-
this.subscribeFocus();
|
|
1663
|
-
this.attachEventHandlers();
|
|
1664
|
-
this.setDefaultSettings();
|
|
1665
|
-
}
|
|
1666
|
-
FileSelectComponent_1 = FileSelectComponent;
|
|
1667
|
-
Object.defineProperty(FileSelectComponent.prototype, "name", {
|
|
1668
|
-
get: function () {
|
|
1669
|
-
return this.uploadService.async.saveField;
|
|
1670
|
-
},
|
|
1671
|
-
/**
|
|
1672
|
-
* Sets the `name` attribute of the `input` element of the FileSelect.
|
|
1673
|
-
*/
|
|
1674
|
-
set: function (name) {
|
|
1675
|
-
this.uploadService.async.saveField = name;
|
|
1676
|
-
},
|
|
1677
|
-
enumerable: true,
|
|
1678
|
-
configurable: true
|
|
1679
|
-
});
|
|
1680
|
-
Object.defineProperty(FileSelectComponent.prototype, "restrictions", {
|
|
1681
|
-
get: function () {
|
|
1682
|
-
return this._restrictions;
|
|
1683
|
-
},
|
|
1684
|
-
/**
|
|
1685
|
-
* Sets the restrictions for selected files.
|
|
1686
|
-
*/
|
|
1687
|
-
set: function (restrictions) {
|
|
1688
|
-
var parsedRestrictions = Object.assign({}, this._restrictions, restrictions);
|
|
1689
|
-
this._restrictions = parsedRestrictions;
|
|
1690
|
-
},
|
|
1691
|
-
enumerable: true,
|
|
1692
|
-
configurable: true
|
|
1693
|
-
});
|
|
1694
|
-
Object.defineProperty(FileSelectComponent.prototype, "hostDisabledClass", {
|
|
1695
|
-
get: function () {
|
|
1696
|
-
return this.disabled;
|
|
1697
|
-
},
|
|
1698
|
-
enumerable: true,
|
|
1699
|
-
configurable: true
|
|
1700
|
-
});
|
|
1701
|
-
Object.defineProperty(FileSelectComponent.prototype, "dir", {
|
|
1702
|
-
get: function () {
|
|
1703
|
-
return this.direction;
|
|
1704
|
-
},
|
|
1705
|
-
enumerable: true,
|
|
1706
|
-
configurable: true
|
|
1707
|
-
});
|
|
1708
|
-
FileSelectComponent.prototype.ngOnInit = function () {
|
|
1709
|
-
this.renderer.removeAttribute(this.wrapper, "tabindex");
|
|
1710
|
-
if (this.zoneId) {
|
|
1711
|
-
this.dropZoneService.addComponent(this, this.zoneId);
|
|
1712
|
-
}
|
|
1713
|
-
};
|
|
1714
|
-
/**
|
|
1715
|
-
* @hidden
|
|
1716
|
-
*/
|
|
1717
|
-
FileSelectComponent.prototype.textFor = function (key) {
|
|
1718
|
-
return this.localization.get(key);
|
|
1719
|
-
};
|
|
1720
|
-
/**
|
|
1721
|
-
* Focuses the underlying input element.
|
|
1722
|
-
*/
|
|
1723
|
-
FileSelectComponent.prototype.focus = function () {
|
|
1724
|
-
var _this = this;
|
|
1725
|
-
setTimeout(function () {
|
|
1726
|
-
_this.fileSelectButton.nativeElement.focus();
|
|
1727
|
-
});
|
|
1728
|
-
};
|
|
1729
|
-
FileSelectComponent.prototype.ngOnDestroy = function () {
|
|
1730
|
-
this.fileList.clear();
|
|
1731
|
-
if (this.blurSubscription) {
|
|
1732
|
-
this.blurSubscription.unsubscribe();
|
|
1733
|
-
}
|
|
1734
|
-
if (this.wrapperFocusSubscription) {
|
|
1735
|
-
this.wrapperFocusSubscription.unsubscribe();
|
|
1736
|
-
}
|
|
1737
|
-
if (this.selectButtonFocusSubscription) {
|
|
1738
|
-
this.selectButtonFocusSubscription.unsubscribe();
|
|
1739
|
-
}
|
|
1740
|
-
if (this.localizationChangeSubscription) {
|
|
1741
|
-
this.localizationChangeSubscription.unsubscribe();
|
|
1742
|
-
}
|
|
1743
|
-
if (this.subs) {
|
|
1744
|
-
this.subs.unsubscribe();
|
|
1745
|
-
}
|
|
1746
|
-
};
|
|
1747
|
-
/**
|
|
1748
|
-
* @hidden
|
|
1749
|
-
*/
|
|
1750
|
-
FileSelectComponent.prototype.handleKeydown = function (event) {
|
|
1751
|
-
if (this.disabled) {
|
|
1752
|
-
return;
|
|
1753
|
-
}
|
|
1754
|
-
if ((event.keyCode === Keys.Enter || event.keyCode === Keys.Space) &&
|
|
1755
|
-
event.target === this.fileSelectButton.nativeElement) {
|
|
1756
|
-
event.preventDefault();
|
|
1757
|
-
this.fileSelect.nativeElement.click();
|
|
1758
|
-
return;
|
|
1759
|
-
}
|
|
1760
|
-
if (hasClasses(event.target, UPLOAD_CLASSES) ||
|
|
1761
|
-
(!isFocusable(event.target) && !hasClasses(event.target, IGNORE_TARGET_CLASSES))) {
|
|
1762
|
-
this.navigation.process(event);
|
|
1763
|
-
}
|
|
1764
|
-
};
|
|
1765
|
-
/**
|
|
1766
|
-
* @hidden
|
|
1767
|
-
*/
|
|
1768
|
-
FileSelectComponent.prototype.writeValue = function (newValue) {
|
|
1769
|
-
var isValid = true;
|
|
1770
|
-
if (newValue instanceof Array) {
|
|
1771
|
-
newValue.forEach(function (file) {
|
|
1772
|
-
if (!validateInitialFileSelectFile(file)) {
|
|
1773
|
-
isValid = false;
|
|
1774
|
-
}
|
|
1775
|
-
});
|
|
1776
|
-
if (isValid) {
|
|
1777
|
-
this.uploadService.addInitialFileSelectFiles(newValue);
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
if (newValue === null) {
|
|
1781
|
-
this.fileList.clear();
|
|
1782
|
-
}
|
|
1783
|
-
this.cdr.markForCheck();
|
|
1784
|
-
};
|
|
1785
|
-
/**
|
|
1786
|
-
* @hidden
|
|
1787
|
-
*/
|
|
1788
|
-
FileSelectComponent.prototype.registerOnChange = function (fn) {
|
|
1789
|
-
this.onChangeCallback = fn;
|
|
1790
|
-
};
|
|
1791
|
-
/**
|
|
1792
|
-
* @hidden
|
|
1793
|
-
*/
|
|
1794
|
-
FileSelectComponent.prototype.registerOnTouched = function (fn) {
|
|
1795
|
-
this.onTouchedCallback = fn;
|
|
1796
|
-
};
|
|
1797
|
-
/**
|
|
1798
|
-
* @hidden
|
|
1799
|
-
*/
|
|
1800
|
-
FileSelectComponent.prototype.setDisabledState = function (isDisabled) {
|
|
1801
|
-
this.disabled = isDisabled;
|
|
1802
|
-
};
|
|
1803
|
-
/**
|
|
1804
|
-
* Removes specific file from the file list.
|
|
1805
|
-
*/
|
|
1806
|
-
FileSelectComponent.prototype.removeFileByUid = function (uid) {
|
|
1807
|
-
this.uploadService.removeFiles(uid);
|
|
1808
|
-
};
|
|
1809
|
-
/**
|
|
1810
|
-
* Visually clears all files from the UI.
|
|
1811
|
-
*/
|
|
1812
|
-
FileSelectComponent.prototype.clearFiles = function () {
|
|
1813
|
-
this.uploadService.clearFiles();
|
|
1814
|
-
};
|
|
1815
|
-
/**
|
|
1816
|
-
* @hidden
|
|
1817
|
-
* Used to determine if the component is empty.
|
|
1818
|
-
*/
|
|
1819
|
-
FileSelectComponent.prototype.isEmpty = function () {
|
|
1820
|
-
return false;
|
|
1821
|
-
};
|
|
1822
|
-
/**
|
|
1823
|
-
* @hidden
|
|
1824
|
-
* Used by the external dropzone to add files to the FileSelect
|
|
1825
|
-
*/
|
|
1826
|
-
FileSelectComponent.prototype.addFiles = function (files) {
|
|
1827
|
-
this.uploadService.addFiles(files);
|
|
1828
|
-
};
|
|
1829
|
-
Object.defineProperty(FileSelectComponent.prototype, "selectButtonTabIndex", {
|
|
1830
|
-
/**
|
|
1831
|
-
* @hidden
|
|
1832
|
-
*/
|
|
1833
|
-
get: function () {
|
|
1834
|
-
return this.disabled ? undefined : this.tabindex;
|
|
1835
|
-
},
|
|
1836
|
-
enumerable: true,
|
|
1837
|
-
configurable: true
|
|
1838
|
-
});
|
|
1839
|
-
/**
|
|
1840
|
-
* @hidden
|
|
1841
|
-
*/
|
|
1842
|
-
FileSelectComponent.prototype.onFileSelectButtonFocus = function (_event) {
|
|
1843
|
-
this.renderer.addClass(this.fileSelectButton.nativeElement, 'k-focus');
|
|
1844
|
-
if (!this.navigation.focused) {
|
|
1845
|
-
this.navigation.focusedIndex = -1;
|
|
1846
|
-
}
|
|
1847
|
-
};
|
|
1848
|
-
/**
|
|
1849
|
-
* @hidden
|
|
1850
|
-
*/
|
|
1851
|
-
FileSelectComponent.prototype.onFileSelectButtonBlur = function (_event) {
|
|
1852
|
-
this.renderer.removeClass(this.fileSelectButton.nativeElement, 'k-focus');
|
|
1853
|
-
};
|
|
1854
|
-
FileSelectComponent.prototype.subscribeBlur = function () {
|
|
1855
|
-
var _this = this;
|
|
1856
|
-
if (!isDocumentAvailable()) {
|
|
1857
|
-
return;
|
|
1858
|
-
}
|
|
1859
|
-
this.ngZone.runOutsideAngular(function () {
|
|
1860
|
-
_this.documentClick = fromEvent(document, 'click').pipe(filter(function (event) {
|
|
1861
|
-
return !(_this.wrapper !== event.target && _this.wrapper.contains(event.target));
|
|
1862
|
-
}));
|
|
1863
|
-
_this.blurSubscription = merge(_this.documentClick, _this.navigation.onTab).subscribe(function () {
|
|
1864
|
-
if (_this.navigation.focused) {
|
|
1865
|
-
_this.ngZone.run(function () {
|
|
1866
|
-
_this.navigation.focused = false;
|
|
1867
|
-
_this.onTouchedCallback();
|
|
1868
|
-
_this.onBlur.emit();
|
|
1869
|
-
});
|
|
1870
|
-
}
|
|
1871
|
-
});
|
|
1872
|
-
});
|
|
1873
|
-
};
|
|
1874
|
-
FileSelectComponent.prototype.subscribeFocus = function () {
|
|
1875
|
-
var _this = this;
|
|
1876
|
-
this.wrapperFocusSubscription = this.navigation.onWrapperFocus.subscribe(function () {
|
|
1877
|
-
_this.onFocus.emit();
|
|
1878
|
-
});
|
|
1879
|
-
this.selectButtonFocusSubscription = this.navigation.onSelectButtonFocus.subscribe(function () {
|
|
1880
|
-
_this.fileSelectButton.nativeElement.focus();
|
|
1881
|
-
});
|
|
1882
|
-
};
|
|
1883
|
-
FileSelectComponent.prototype.attachEventHandlers = function () {
|
|
1884
|
-
var _this = this;
|
|
1885
|
-
this.subs = this.uploadService.changeEvent.subscribe(function (files) {
|
|
1886
|
-
var model = [];
|
|
1887
|
-
if (files !== null) {
|
|
1888
|
-
files.forEach(function (file) {
|
|
1889
|
-
if (file.state === FileState.Initial) {
|
|
1890
|
-
model.push(file);
|
|
1891
|
-
}
|
|
1892
|
-
if (file.state === FileState.Selected && file.rawFile && !file.validationErrors) {
|
|
1893
|
-
model.push(file.rawFile);
|
|
1894
|
-
}
|
|
1895
|
-
});
|
|
1896
|
-
}
|
|
1897
|
-
if (model.length === 0) {
|
|
1898
|
-
model = null;
|
|
1899
|
-
}
|
|
1900
|
-
_this.onChangeCallback(model);
|
|
1901
|
-
_this.valueChange.emit(model);
|
|
1902
|
-
});
|
|
1903
|
-
this.subs.add(this.uploadService.removeEvent.subscribe(function (args) {
|
|
1904
|
-
_this.remove.emit(args);
|
|
1905
|
-
}));
|
|
1906
|
-
this.subs.add(this.uploadService.selectEvent.subscribe(function (args) {
|
|
1907
|
-
_this.select.emit(args);
|
|
1908
|
-
}));
|
|
1909
|
-
};
|
|
1910
|
-
FileSelectComponent.prototype.setDefaultSettings = function () {
|
|
1911
|
-
this.uploadService.async.autoUpload = false;
|
|
1912
|
-
this.uploadService.component = 'FileSelect';
|
|
1913
|
-
};
|
|
1914
|
-
var FileSelectComponent_1;
|
|
1915
|
-
__decorate([
|
|
1916
|
-
Input(),
|
|
1917
|
-
__metadata("design:type", String)
|
|
1918
|
-
], FileSelectComponent.prototype, "accept", void 0);
|
|
1919
|
-
__decorate([
|
|
1920
|
-
Input(),
|
|
1921
|
-
__metadata("design:type", Boolean)
|
|
1922
|
-
], FileSelectComponent.prototype, "disabled", void 0);
|
|
1923
|
-
__decorate([
|
|
1924
|
-
Input(),
|
|
1925
|
-
__metadata("design:type", Boolean)
|
|
1926
|
-
], FileSelectComponent.prototype, "multiple", void 0);
|
|
1927
|
-
__decorate([
|
|
1928
|
-
Input(),
|
|
1929
|
-
__metadata("design:type", String),
|
|
1930
|
-
__metadata("design:paramtypes", [String])
|
|
1931
|
-
], FileSelectComponent.prototype, "name", null);
|
|
1932
|
-
__decorate([
|
|
1933
|
-
Input(),
|
|
1934
|
-
__metadata("design:type", Boolean)
|
|
1935
|
-
], FileSelectComponent.prototype, "showFileList", void 0);
|
|
1936
|
-
__decorate([
|
|
1937
|
-
Input(),
|
|
1938
|
-
__metadata("design:type", Number)
|
|
1939
|
-
], FileSelectComponent.prototype, "tabindex", void 0);
|
|
1940
|
-
__decorate([
|
|
1941
|
-
Input(),
|
|
1942
|
-
__metadata("design:type", Object),
|
|
1943
|
-
__metadata("design:paramtypes", [Object])
|
|
1944
|
-
], FileSelectComponent.prototype, "restrictions", null);
|
|
1945
|
-
__decorate([
|
|
1946
|
-
Input(),
|
|
1947
|
-
__metadata("design:type", String)
|
|
1948
|
-
], FileSelectComponent.prototype, "zoneId", void 0);
|
|
1949
|
-
__decorate([
|
|
1950
|
-
Input(),
|
|
1951
|
-
__metadata("design:type", String)
|
|
1952
|
-
], FileSelectComponent.prototype, "focusableId", void 0);
|
|
1953
|
-
__decorate([
|
|
1954
|
-
ContentChild(FileTemplateDirective, { static: false }),
|
|
1955
|
-
__metadata("design:type", FileTemplateDirective)
|
|
1956
|
-
], FileSelectComponent.prototype, "fileTemplate", void 0);
|
|
1957
|
-
__decorate([
|
|
1958
|
-
ContentChild(FileInfoTemplateDirective, { static: false }),
|
|
1959
|
-
__metadata("design:type", FileInfoTemplateDirective)
|
|
1960
|
-
], FileSelectComponent.prototype, "fileInfoTemplate", void 0);
|
|
1961
|
-
__decorate([
|
|
1962
|
-
ViewChild('fileSelect', { static: true }),
|
|
1963
|
-
__metadata("design:type", ElementRef)
|
|
1964
|
-
], FileSelectComponent.prototype, "fileSelect", void 0);
|
|
1965
|
-
__decorate([
|
|
1966
|
-
ViewChild('fileSelectButton', { static: true }),
|
|
1967
|
-
__metadata("design:type", ElementRef)
|
|
1968
|
-
], FileSelectComponent.prototype, "fileSelectButton", void 0);
|
|
1969
|
-
__decorate([
|
|
1970
|
-
Output('blur'),
|
|
1971
|
-
__metadata("design:type", EventEmitter)
|
|
1972
|
-
], FileSelectComponent.prototype, "onBlur", void 0);
|
|
1973
|
-
__decorate([
|
|
1974
|
-
Output('focus'),
|
|
1975
|
-
__metadata("design:type", EventEmitter)
|
|
1976
|
-
], FileSelectComponent.prototype, "onFocus", void 0);
|
|
1977
|
-
__decorate([
|
|
1978
|
-
Output(),
|
|
1979
|
-
__metadata("design:type", EventEmitter)
|
|
1980
|
-
], FileSelectComponent.prototype, "select", void 0);
|
|
1981
|
-
__decorate([
|
|
1982
|
-
Output(),
|
|
1983
|
-
__metadata("design:type", EventEmitter)
|
|
1984
|
-
], FileSelectComponent.prototype, "remove", void 0);
|
|
1985
|
-
__decorate([
|
|
1986
|
-
Output(),
|
|
1987
|
-
__metadata("design:type", EventEmitter)
|
|
1988
|
-
], FileSelectComponent.prototype, "valueChange", void 0);
|
|
1989
|
-
__decorate([
|
|
1990
|
-
HostBinding('class.k-widget'),
|
|
1991
|
-
HostBinding('class.k-upload'),
|
|
1992
|
-
__metadata("design:type", Boolean)
|
|
1993
|
-
], FileSelectComponent.prototype, "hostDefaultClasses", void 0);
|
|
1994
|
-
__decorate([
|
|
1995
|
-
HostBinding('class.k-disabled'),
|
|
1996
|
-
__metadata("design:type", Boolean),
|
|
1997
|
-
__metadata("design:paramtypes", [])
|
|
1998
|
-
], FileSelectComponent.prototype, "hostDisabledClass", null);
|
|
1999
|
-
__decorate([
|
|
2000
|
-
HostBinding('attr.dir'),
|
|
2001
|
-
__metadata("design:type", String),
|
|
2002
|
-
__metadata("design:paramtypes", [])
|
|
2003
|
-
], FileSelectComponent.prototype, "dir", null);
|
|
2004
|
-
__decorate([
|
|
2005
|
-
HostListener('keydown', ['$event']),
|
|
2006
|
-
__metadata("design:type", Function),
|
|
2007
|
-
__metadata("design:paramtypes", [Object]),
|
|
2008
|
-
__metadata("design:returntype", void 0)
|
|
2009
|
-
], FileSelectComponent.prototype, "handleKeydown", null);
|
|
2010
|
-
FileSelectComponent = FileSelectComponent_1 = __decorate([
|
|
2011
|
-
Component({
|
|
2012
|
-
exportAs: 'kendoFileSelect',
|
|
2013
|
-
providers: [
|
|
2014
|
-
LocalizationService,
|
|
2015
|
-
NavigationService,
|
|
2016
|
-
UploadService,
|
|
2017
|
-
DropZoneService,
|
|
2018
|
-
FILESELECT_VALUE_ACCESSOR,
|
|
2019
|
-
{
|
|
2020
|
-
provide: L10N_PREFIX,
|
|
2021
|
-
useValue: 'kendo.fileselect'
|
|
2022
|
-
},
|
|
2023
|
-
{
|
|
2024
|
-
provide: KendoInput,
|
|
2025
|
-
useExisting: forwardRef(function () { return FileSelectComponent_1; })
|
|
2026
|
-
}
|
|
2027
|
-
],
|
|
2028
|
-
selector: 'kendo-fileselect',
|
|
2029
|
-
template: "\n <ng-container kendoFileSelectLocalizedMessages\n i18n-dropFilesHere=\"kendo.fileselect.dropFilesHere|The drop zone hint\"\n dropFilesHere=\"Drop files here to select\"\n\n i18n-invalidFileExtension=\"kendo.fileselect.invalidFileExtension|The text for the invalid allowed extensions restriction message\"\n invalidFileExtension=\"File type not allowed.\"\n\n i18n-invalidMaxFileSize=\"kendo.fileselect.invalidMaxFileSize|The text for the invalid max file size restriction message\"\n invalidMaxFileSize=\"File size too large.\"\n\n i18n-invalidMinFileSize=\"kendo.fileselect.invalidMinFileSize|The text for the invalid min file size restriction message\"\n invalidMinFileSize=\"File size too small.\"\n\n i18n-remove=\"kendo.fileselect.remove|The text for the Remove button\"\n remove=\"Remove\"\n\n i18n-select=\"kendo.fileselect.select|The text for the Select button\"\n select=\"Select files...\"\n >\n </ng-container>\n <div kendoFileSelectInternalDropZone\n [restrictions]=\"restrictions\"\n [multiple]=\"multiple\"\n [disabled]=\"disabled\">\n <div role=\"button\" #fileSelectButton\n [id]=\"focusableId\"\n [attr.aria-label]=\"textFor('select')\"\n [attr.tabindex]=\"selectButtonTabIndex\"\n (focus)=\"onFileSelectButtonFocus($event)\"\n (blur)=\"onFileSelectButtonBlur($event)\"\n class=\"k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-upload-button\">\n <input #fileSelect kendoFileSelect\n [attr.accept]=\"accept ? accept : null\"\n [dir]=\"direction\"\n [restrictions]=\"restrictions\"\n [multiple]=\"multiple\"\n [disabled]=\"disabled\" />\n <span>{{textFor('select')}}</span>\n </div>\n <div class=\"k-dropzone-hint\">{{textFor('dropFilesHere')}}</div>\n </div>\n <ul kendo-upload-file-list\n class=\"k-upload-files k-reset\"\n *ngIf=\"showFileList && fileList.count > 0\"\n [disabled]=\"disabled\"\n [fileList]=\"fileList.files\"\n [fileTemplate]=\"fileTemplate\"\n [fileInfoTemplate]=\"fileInfoTemplate\">\n </ul>\n "
|
|
2030
|
-
}),
|
|
2031
|
-
__metadata("design:paramtypes", [UploadService,
|
|
2032
|
-
LocalizationService,
|
|
2033
|
-
NavigationService,
|
|
2034
|
-
DropZoneService,
|
|
2035
|
-
NgZone,
|
|
2036
|
-
Renderer2,
|
|
2037
|
-
ChangeDetectorRef,
|
|
2038
|
-
ElementRef])
|
|
2039
|
-
], FileSelectComponent);
|
|
2040
|
-
return FileSelectComponent;
|
|
2041
|
-
}());
|
|
2042
|
-
|
|
2043
|
-
/**
|
|
2044
|
-
* @hidden
|
|
2045
|
-
*/
|
|
2046
|
-
var Messages = /** @class */ (function (_super) {
|
|
2047
|
-
__extends(Messages, _super);
|
|
2048
|
-
function Messages() {
|
|
2049
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
2050
|
-
}
|
|
2051
|
-
__decorate([
|
|
2052
|
-
Input(),
|
|
2053
|
-
__metadata("design:type", String)
|
|
2054
|
-
], Messages.prototype, "cancel", void 0);
|
|
2055
|
-
__decorate([
|
|
2056
|
-
Input(),
|
|
2057
|
-
__metadata("design:type", String)
|
|
2058
|
-
], Messages.prototype, "clearSelectedFiles", void 0);
|
|
2059
|
-
__decorate([
|
|
2060
|
-
Input(),
|
|
2061
|
-
__metadata("design:type", String)
|
|
2062
|
-
], Messages.prototype, "dropFilesHere", void 0);
|
|
2063
|
-
__decorate([
|
|
2064
|
-
Input(),
|
|
2065
|
-
__metadata("design:type", String)
|
|
2066
|
-
], Messages.prototype, "externalDropFilesHere", void 0);
|
|
2067
|
-
__decorate([
|
|
2068
|
-
Input(),
|
|
2069
|
-
__metadata("design:type", String)
|
|
2070
|
-
], Messages.prototype, "filesBatchStatus", void 0);
|
|
2071
|
-
__decorate([
|
|
2072
|
-
Input(),
|
|
2073
|
-
__metadata("design:type", String)
|
|
2074
|
-
], Messages.prototype, "filesBatchStatusFailed", void 0);
|
|
2075
|
-
__decorate([
|
|
2076
|
-
Input(),
|
|
2077
|
-
__metadata("design:type", String)
|
|
2078
|
-
], Messages.prototype, "filesBatchStatusUploaded", void 0);
|
|
2079
|
-
__decorate([
|
|
2080
|
-
Input(),
|
|
2081
|
-
__metadata("design:type", String)
|
|
2082
|
-
], Messages.prototype, "fileStatusFailed", void 0);
|
|
2083
|
-
__decorate([
|
|
2084
|
-
Input(),
|
|
2085
|
-
__metadata("design:type", String)
|
|
2086
|
-
], Messages.prototype, "fileStatusUploaded", void 0);
|
|
2087
|
-
__decorate([
|
|
2088
|
-
Input(),
|
|
2089
|
-
__metadata("design:type", String)
|
|
2090
|
-
], Messages.prototype, "headerStatusPaused", void 0);
|
|
2091
|
-
__decorate([
|
|
2092
|
-
Input(),
|
|
2093
|
-
__metadata("design:type", String)
|
|
2094
|
-
], Messages.prototype, "headerStatusUploaded", void 0);
|
|
2095
|
-
__decorate([
|
|
2096
|
-
Input(),
|
|
2097
|
-
__metadata("design:type", String)
|
|
2098
|
-
], Messages.prototype, "headerStatusUploading", void 0);
|
|
2099
|
-
__decorate([
|
|
2100
|
-
Input(),
|
|
2101
|
-
__metadata("design:type", String)
|
|
2102
|
-
], Messages.prototype, "invalidFileExtension", void 0);
|
|
2103
|
-
__decorate([
|
|
2104
|
-
Input(),
|
|
2105
|
-
__metadata("design:type", String)
|
|
2106
|
-
], Messages.prototype, "invalidMaxFileSize", void 0);
|
|
2107
|
-
__decorate([
|
|
2108
|
-
Input(),
|
|
2109
|
-
__metadata("design:type", String)
|
|
2110
|
-
], Messages.prototype, "invalidMinFileSize", void 0);
|
|
2111
|
-
__decorate([
|
|
2112
|
-
Input(),
|
|
2113
|
-
__metadata("design:type", String)
|
|
2114
|
-
], Messages.prototype, "pause", void 0);
|
|
2115
|
-
__decorate([
|
|
2116
|
-
Input(),
|
|
2117
|
-
__metadata("design:type", String)
|
|
2118
|
-
], Messages.prototype, "remove", void 0);
|
|
2119
|
-
__decorate([
|
|
2120
|
-
Input(),
|
|
2121
|
-
__metadata("design:type", String)
|
|
2122
|
-
], Messages.prototype, "resume", void 0);
|
|
2123
|
-
__decorate([
|
|
2124
|
-
Input(),
|
|
2125
|
-
__metadata("design:type", String)
|
|
2126
|
-
], Messages.prototype, "retry", void 0);
|
|
2127
|
-
__decorate([
|
|
2128
|
-
Input(),
|
|
2129
|
-
__metadata("design:type", String)
|
|
2130
|
-
], Messages.prototype, "select", void 0);
|
|
2131
|
-
__decorate([
|
|
2132
|
-
Input(),
|
|
2133
|
-
__metadata("design:type", String)
|
|
2134
|
-
], Messages.prototype, "uploadSelectedFiles", void 0);
|
|
2135
|
-
return Messages;
|
|
2136
|
-
}(ComponentMessages));
|
|
2137
|
-
|
|
2138
|
-
/**
|
|
2139
|
-
* Custom component messages override default component messages ([more information and example]({% slug globalization_upload %})).
|
|
2140
|
-
*
|
|
2141
|
-
* @example
|
|
2142
|
-
* ```html-no-run
|
|
2143
|
-
* <kendo-fileselect>
|
|
2144
|
-
* <kendo-fileselect-messages
|
|
2145
|
-
* dropFilesHere="Drop your file here"
|
|
2146
|
-
* select="Upload file">
|
|
2147
|
-
* </kendo-fileselect-messages>
|
|
2148
|
-
* </kendo-fileselect>
|
|
2149
|
-
* ```
|
|
2150
|
-
*/
|
|
2151
|
-
var CustomMessagesComponent = /** @class */ (function (_super) {
|
|
2152
|
-
__extends(CustomMessagesComponent, _super);
|
|
2153
|
-
function CustomMessagesComponent(service) {
|
|
2154
|
-
var _this = _super.call(this) || this;
|
|
2155
|
-
_this.service = service;
|
|
2156
|
-
return _this;
|
|
2157
|
-
}
|
|
2158
|
-
CustomMessagesComponent_1 = CustomMessagesComponent;
|
|
2159
|
-
Object.defineProperty(CustomMessagesComponent.prototype, "override", {
|
|
2160
|
-
get: function () {
|
|
2161
|
-
return true;
|
|
2162
|
-
},
|
|
2163
|
-
enumerable: true,
|
|
2164
|
-
configurable: true
|
|
2165
|
-
});
|
|
2166
|
-
var CustomMessagesComponent_1;
|
|
2167
|
-
CustomMessagesComponent = CustomMessagesComponent_1 = __decorate([
|
|
2168
|
-
Component({
|
|
2169
|
-
providers: [
|
|
2170
|
-
{
|
|
2171
|
-
provide: Messages,
|
|
2172
|
-
useExisting: forwardRef(function () { return CustomMessagesComponent_1; }) // tslint:disable-line:no-forward-ref
|
|
2173
|
-
}
|
|
2174
|
-
],
|
|
2175
|
-
selector: 'kendo-upload-messages, kendo-fileselect-messages, kendo-uploaddropzone-messages',
|
|
2176
|
-
template: ""
|
|
2177
|
-
}),
|
|
2178
|
-
__metadata("design:paramtypes", [LocalizationService])
|
|
2179
|
-
], CustomMessagesComponent);
|
|
2180
|
-
return CustomMessagesComponent;
|
|
2181
|
-
}(Messages));
|
|
2182
|
-
|
|
2183
|
-
/**
|
|
2184
|
-
* @hidden
|
|
2185
|
-
*/
|
|
2186
|
-
var INVALIDMAXFILESIZE = "invalidMaxFileSize";
|
|
2187
|
-
/**
|
|
2188
|
-
* @hidden
|
|
2189
|
-
*/
|
|
2190
|
-
var INVALIDMINFILESIZE = "invalidMinFileSize";
|
|
2191
|
-
/**
|
|
2192
|
-
* @hidden
|
|
2193
|
-
*/
|
|
2194
|
-
var INVALIDFILEEXTENSION = "invalidFileExtension";
|
|
2195
|
-
var validateFileExtension = function (file, allowedExtensions) {
|
|
2196
|
-
if (allowedExtensions.length > 0) {
|
|
2197
|
-
if (allowedExtensions.indexOf(file.extension.toLowerCase()) < 0) {
|
|
2198
|
-
file.validationErrors = file.validationErrors || [];
|
|
2199
|
-
if (file.validationErrors.indexOf(INVALIDFILEEXTENSION) < 0) {
|
|
2200
|
-
file.validationErrors.push(INVALIDFILEEXTENSION);
|
|
2201
|
-
}
|
|
2202
|
-
}
|
|
2203
|
-
}
|
|
2204
|
-
};
|
|
2205
|
-
var validateFileSize = function (file, minFileSize, maxFileSize) {
|
|
2206
|
-
if (minFileSize !== 0 && file.size < minFileSize) {
|
|
2207
|
-
file.validationErrors = file.validationErrors || [];
|
|
2208
|
-
if (file.validationErrors.indexOf(INVALIDMINFILESIZE) < 0) {
|
|
2209
|
-
file.validationErrors.push(INVALIDMINFILESIZE);
|
|
2210
|
-
}
|
|
2211
|
-
}
|
|
2212
|
-
if (maxFileSize !== 0 && file.size > maxFileSize) {
|
|
2213
|
-
file.validationErrors = file.validationErrors || [];
|
|
2214
|
-
if (file.validationErrors.indexOf(INVALIDMAXFILESIZE) < 0) {
|
|
2215
|
-
file.validationErrors.push(INVALIDMAXFILESIZE);
|
|
2216
|
-
}
|
|
2217
|
-
}
|
|
2218
|
-
};
|
|
2219
|
-
var parseAllowedExtensions = function (extensions) {
|
|
2220
|
-
var allowedExtensions = extensions.map(function (ext) {
|
|
2221
|
-
var parsedExt = (ext.substring(0, 1) === ".") ? ext : ("." + ext);
|
|
2222
|
-
return parsedExt.toLowerCase();
|
|
2223
|
-
});
|
|
2224
|
-
return allowedExtensions;
|
|
2225
|
-
};
|
|
2226
|
-
/**
|
|
2227
|
-
* @hidden
|
|
2228
|
-
*/
|
|
2229
|
-
var validateFiles = function (files, restrictionInfo) {
|
|
2230
|
-
var allowedExtensions = parseAllowedExtensions(restrictionInfo.allowedExtensions);
|
|
2231
|
-
var maxFileSize = restrictionInfo.maxFileSize;
|
|
2232
|
-
var minFileSize = restrictionInfo.minFileSize;
|
|
2233
|
-
var i;
|
|
2234
|
-
for (i = 0; i < files.length; i++) {
|
|
2235
|
-
validateFileExtension(files[i], allowedExtensions);
|
|
2236
|
-
validateFileSize(files[i], minFileSize, maxFileSize);
|
|
2237
|
-
}
|
|
2238
|
-
};
|
|
2239
|
-
|
|
2240
|
-
/**
|
|
2241
|
-
* @hidden
|
|
2242
|
-
*/
|
|
2243
|
-
var DropZoneBase = /** @class */ (function () {
|
|
2244
|
-
function DropZoneBase(element, renderer, hoverClass) {
|
|
2245
|
-
this.element = element;
|
|
2246
|
-
this.renderer = renderer;
|
|
2247
|
-
this.hideIntervalElement = null;
|
|
2248
|
-
this.hoverClass = hoverClass;
|
|
2249
|
-
}
|
|
2250
|
-
/**
|
|
2251
|
-
* @hidden
|
|
2252
|
-
*/
|
|
2253
|
-
DropZoneBase.prototype.onElementDragEnterListener = function () {
|
|
2254
|
-
var _this = this;
|
|
2255
|
-
this.addClass(this.hoverClass);
|
|
2256
|
-
this.lastDragElement = new Date();
|
|
2257
|
-
if (!this.hideIntervalElement) {
|
|
2258
|
-
this.hideIntervalElement = setInterval(function () {
|
|
2259
|
-
if (_this.calculateTimeDiff(_this.lastDragElement) < 100) {
|
|
2260
|
-
return;
|
|
2261
|
-
}
|
|
2262
|
-
_this.removeClass(_this.hoverClass);
|
|
2263
|
-
clearInterval(_this.hideIntervalElement);
|
|
2264
|
-
_this.hideIntervalElement = null;
|
|
2265
|
-
}, 100);
|
|
2266
|
-
}
|
|
2267
|
-
return false;
|
|
2268
|
-
};
|
|
2269
|
-
/**
|
|
2270
|
-
* @hidden
|
|
2271
|
-
*/
|
|
2272
|
-
DropZoneBase.prototype.onElementDragOverListener = function () {
|
|
2273
|
-
this.lastDragElement = new Date();
|
|
2274
|
-
return false;
|
|
2275
|
-
};
|
|
2276
|
-
DropZoneBase.prototype.calculateTimeDiff = function (prevEvent) {
|
|
2277
|
-
return new Date().getTime() - prevEvent.getTime();
|
|
2278
|
-
};
|
|
2279
|
-
DropZoneBase.prototype.addClass = function (className) {
|
|
2280
|
-
this.renderer.addClass(this.element.nativeElement, className);
|
|
2281
|
-
};
|
|
2282
|
-
DropZoneBase.prototype.removeClass = function (className) {
|
|
2283
|
-
this.renderer.removeClass(this.element.nativeElement, className);
|
|
2284
|
-
};
|
|
2285
|
-
__decorate([
|
|
2286
|
-
HostListener('dragenter'),
|
|
2287
|
-
__metadata("design:type", Function),
|
|
2288
|
-
__metadata("design:paramtypes", []),
|
|
2289
|
-
__metadata("design:returntype", Boolean)
|
|
2290
|
-
], DropZoneBase.prototype, "onElementDragEnterListener", null);
|
|
2291
|
-
__decorate([
|
|
2292
|
-
HostListener('dragover'),
|
|
2293
|
-
__metadata("design:type", Function),
|
|
2294
|
-
__metadata("design:paramtypes", []),
|
|
2295
|
-
__metadata("design:returntype", Boolean)
|
|
2296
|
-
], DropZoneBase.prototype, "onElementDragOverListener", null);
|
|
2297
|
-
return DropZoneBase;
|
|
2298
|
-
}());
|
|
2299
|
-
|
|
2300
|
-
/**
|
|
2301
|
-
* @hidden
|
|
2302
|
-
*/
|
|
2303
|
-
var DropZoneInternalDirective = /** @class */ (function (_super) {
|
|
2304
|
-
__extends(DropZoneInternalDirective, _super);
|
|
2305
|
-
function DropZoneInternalDirective(element, renderer, ngZone, uploadService) {
|
|
2306
|
-
var _this = _super.call(this, element, renderer, 'k-dropzone-hover') || this;
|
|
2307
|
-
_this.ngZone = ngZone;
|
|
2308
|
-
_this.uploadService = uploadService;
|
|
2309
|
-
_this.initialClassName = true;
|
|
2310
|
-
_this.hideIntervalDocument = null;
|
|
2311
|
-
_this.activeClass = 'k-dropzone-active';
|
|
2312
|
-
_this.ngZone.runOutsideAngular(function () {
|
|
2313
|
-
_this.unsubscribeDocumentDragEnter = _this.renderer.listen('document', 'dragenter', function () { return _this.onDocumentDragEnter(); });
|
|
2314
|
-
_this.unsubscribeDocumentDragOver = _this.renderer.listen('document', 'dragover', function () { return _this.onDocumentDragOver(); });
|
|
2315
|
-
});
|
|
2316
|
-
return _this;
|
|
2317
|
-
}
|
|
2318
|
-
DropZoneInternalDirective.prototype.ngOnDestroy = function () {
|
|
2319
|
-
var _this = this;
|
|
2320
|
-
this.ngZone.runOutsideAngular(function () {
|
|
2321
|
-
if (_this.unsubscribeDocumentDragEnter) {
|
|
2322
|
-
_this.unsubscribeDocumentDragEnter();
|
|
2323
|
-
}
|
|
2324
|
-
if (_this.unsubscribeDocumentDragOver) {
|
|
2325
|
-
_this.unsubscribeDocumentDragOver();
|
|
2326
|
-
}
|
|
2327
|
-
});
|
|
2328
|
-
};
|
|
2329
|
-
DropZoneInternalDirective.prototype.onDocumentDragEnter = function () {
|
|
2330
|
-
var _this = this;
|
|
2331
|
-
this.addClass(this.activeClass);
|
|
2332
|
-
this.lastDragDocument = new Date();
|
|
2333
|
-
if (!this.hideIntervalDocument) {
|
|
2334
|
-
this.hideIntervalDocument = setInterval(function () {
|
|
2335
|
-
if (_this.calculateTimeDiff(_this.lastDragDocument) < 100) {
|
|
2336
|
-
return;
|
|
2337
|
-
}
|
|
2338
|
-
_this.removeClass(_this.activeClass);
|
|
2339
|
-
clearInterval(_this.hideIntervalDocument);
|
|
2340
|
-
_this.hideIntervalDocument = null;
|
|
2341
|
-
}, 100);
|
|
2342
|
-
}
|
|
2343
|
-
return false;
|
|
2344
|
-
};
|
|
2345
|
-
/**
|
|
2346
|
-
* @hidden
|
|
2347
|
-
*/
|
|
2348
|
-
DropZoneInternalDirective.prototype.onDocumentDragOver = function () {
|
|
2349
|
-
this.lastDragDocument = new Date();
|
|
2350
|
-
return false;
|
|
2351
|
-
};
|
|
2352
|
-
DropZoneInternalDirective.prototype.onDropListener = function (event) {
|
|
2353
|
-
var droppedFiles = event.dataTransfer.files;
|
|
2354
|
-
if (droppedFiles.length > 0 && !this.disabled) {
|
|
2355
|
-
var files = getAllFileInfo(droppedFiles);
|
|
2356
|
-
files = assignGuidToFiles(files, !this.uploadService.async.batch);
|
|
2357
|
-
if (!this.multiple) {
|
|
2358
|
-
files.splice(1, files.length - 1);
|
|
2359
|
-
this.uploadService.clearFiles();
|
|
2360
|
-
}
|
|
2361
|
-
validateFiles(files, this.restrictions);
|
|
2362
|
-
this.uploadService.addFiles(files);
|
|
2363
|
-
}
|
|
2364
|
-
return false;
|
|
2365
|
-
};
|
|
2366
|
-
__decorate([
|
|
2367
|
-
Input(),
|
|
2368
|
-
__metadata("design:type", Boolean)
|
|
2369
|
-
], DropZoneInternalDirective.prototype, "disabled", void 0);
|
|
2370
|
-
__decorate([
|
|
2371
|
-
Input(),
|
|
2372
|
-
__metadata("design:type", Boolean)
|
|
2373
|
-
], DropZoneInternalDirective.prototype, "multiple", void 0);
|
|
2374
|
-
__decorate([
|
|
2375
|
-
Input(),
|
|
2376
|
-
__metadata("design:type", Object)
|
|
2377
|
-
], DropZoneInternalDirective.prototype, "restrictions", void 0);
|
|
2378
|
-
__decorate([
|
|
2379
|
-
HostBinding('class.k-dropzone'),
|
|
2380
|
-
__metadata("design:type", Boolean)
|
|
2381
|
-
], DropZoneInternalDirective.prototype, "initialClassName", void 0);
|
|
2382
|
-
__decorate([
|
|
2383
|
-
HostListener('drop', ['$event']),
|
|
2384
|
-
__metadata("design:type", Function),
|
|
2385
|
-
__metadata("design:paramtypes", [Object]),
|
|
2386
|
-
__metadata("design:returntype", Boolean)
|
|
2387
|
-
], DropZoneInternalDirective.prototype, "onDropListener", null);
|
|
2388
|
-
DropZoneInternalDirective = __decorate([
|
|
2389
|
-
Directive({
|
|
2390
|
-
selector: "\n [kendoUploadInternalDropZone],\n [kendoFileSelectInternalDropZone]\n "
|
|
2391
|
-
}),
|
|
2392
|
-
__metadata("design:paramtypes", [ElementRef,
|
|
2393
|
-
Renderer2,
|
|
2394
|
-
NgZone,
|
|
2395
|
-
UploadService])
|
|
2396
|
-
], DropZoneInternalDirective);
|
|
2397
|
-
return DropZoneInternalDirective;
|
|
2398
|
-
}(DropZoneBase));
|
|
2399
|
-
|
|
2400
|
-
/**
|
|
2401
|
-
* @hidden
|
|
2402
|
-
*/
|
|
2403
|
-
var FileListItemDirective = /** @class */ (function () {
|
|
2404
|
-
function FileListItemDirective(el, navigationService, uploadService) {
|
|
2405
|
-
this.navigationService = navigationService;
|
|
2406
|
-
this.uploadService = uploadService;
|
|
2407
|
-
this.fileClass = true;
|
|
2408
|
-
this.focused = false;
|
|
2409
|
-
this.element = el;
|
|
2410
|
-
}
|
|
2411
|
-
FileListItemDirective.prototype.focus = function () {
|
|
2412
|
-
this.element.nativeElement.focus();
|
|
2413
|
-
};
|
|
2414
|
-
Object.defineProperty(FileListItemDirective.prototype, "uidAttribute", {
|
|
2415
|
-
get: function () {
|
|
2416
|
-
return this.files[0].uid;
|
|
2417
|
-
},
|
|
2418
|
-
enumerable: true,
|
|
2419
|
-
configurable: true
|
|
2420
|
-
});
|
|
2421
|
-
Object.defineProperty(FileListItemDirective.prototype, "tabIndex", {
|
|
2422
|
-
get: function () {
|
|
2423
|
-
return "-1";
|
|
2424
|
-
},
|
|
2425
|
-
enumerable: true,
|
|
2426
|
-
configurable: true
|
|
2427
|
-
});
|
|
2428
|
-
Object.defineProperty(FileListItemDirective.prototype, "kFileError", {
|
|
2429
|
-
get: function () {
|
|
2430
|
-
return this.files[0].state === FileState.Failed;
|
|
2431
|
-
},
|
|
2432
|
-
enumerable: true,
|
|
2433
|
-
configurable: true
|
|
2434
|
-
});
|
|
2435
|
-
Object.defineProperty(FileListItemDirective.prototype, "kFileInvalid", {
|
|
2436
|
-
get: function () {
|
|
2437
|
-
return filesHaveValidationErrors(this.files);
|
|
2438
|
-
},
|
|
2439
|
-
enumerable: true,
|
|
2440
|
-
configurable: true
|
|
2441
|
-
});
|
|
2442
|
-
Object.defineProperty(FileListItemDirective.prototype, "kFileProgress", {
|
|
2443
|
-
get: function () {
|
|
2444
|
-
return this.files[0].state === FileState.Uploading ||
|
|
2445
|
-
this.files[0].state === FileState.Paused;
|
|
2446
|
-
},
|
|
2447
|
-
enumerable: true,
|
|
2448
|
-
configurable: true
|
|
2449
|
-
});
|
|
2450
|
-
Object.defineProperty(FileListItemDirective.prototype, "kFileSuccess", {
|
|
2451
|
-
get: function () {
|
|
2452
|
-
if (this.uploadService.component === 'Upload') {
|
|
2453
|
-
return this.files[0].state === FileState.Uploaded ||
|
|
2454
|
-
this.files[0].state === FileState.Initial;
|
|
2455
|
-
}
|
|
2456
|
-
return false;
|
|
2457
|
-
},
|
|
2458
|
-
enumerable: true,
|
|
2459
|
-
configurable: true
|
|
2460
|
-
});
|
|
2461
|
-
Object.defineProperty(FileListItemDirective.prototype, "kStateFocused", {
|
|
2462
|
-
get: function () {
|
|
2463
|
-
return this.focused;
|
|
2464
|
-
},
|
|
2465
|
-
enumerable: true,
|
|
2466
|
-
configurable: true
|
|
2467
|
-
});
|
|
2468
|
-
FileListItemDirective.prototype.onFocus = function () {
|
|
2469
|
-
this.focused = true;
|
|
2470
|
-
};
|
|
2471
|
-
FileListItemDirective.prototype.onBlur = function () {
|
|
2472
|
-
this.focused = false;
|
|
2473
|
-
};
|
|
2474
|
-
FileListItemDirective.prototype.onClick = function (event) {
|
|
2475
|
-
if (!isFocusable(event.target) && !hasClasses(event.target, IGNORE_TARGET_CLASSES)) {
|
|
2476
|
-
this.navigationService.focusedIndex = this.index;
|
|
2477
|
-
}
|
|
2478
|
-
};
|
|
2479
|
-
__decorate([
|
|
2480
|
-
Input(),
|
|
2481
|
-
__metadata("design:type", Array)
|
|
2482
|
-
], FileListItemDirective.prototype, "files", void 0);
|
|
2483
|
-
__decorate([
|
|
2484
|
-
Input(),
|
|
2485
|
-
__metadata("design:type", Number)
|
|
2486
|
-
], FileListItemDirective.prototype, "index", void 0);
|
|
2487
|
-
__decorate([
|
|
2488
|
-
HostBinding('class.k-file'),
|
|
2489
|
-
__metadata("design:type", Boolean)
|
|
2490
|
-
], FileListItemDirective.prototype, "fileClass", void 0);
|
|
2491
|
-
__decorate([
|
|
2492
|
-
HostBinding('attr.data-uid'),
|
|
2493
|
-
__metadata("design:type", String),
|
|
2494
|
-
__metadata("design:paramtypes", [])
|
|
2495
|
-
], FileListItemDirective.prototype, "uidAttribute", null);
|
|
2496
|
-
__decorate([
|
|
2497
|
-
HostBinding('attr.tabIndex'),
|
|
2498
|
-
__metadata("design:type", String),
|
|
2499
|
-
__metadata("design:paramtypes", [])
|
|
2500
|
-
], FileListItemDirective.prototype, "tabIndex", null);
|
|
2501
|
-
__decorate([
|
|
2502
|
-
HostBinding('class.k-file-error'),
|
|
2503
|
-
__metadata("design:type", Boolean),
|
|
2504
|
-
__metadata("design:paramtypes", [])
|
|
2505
|
-
], FileListItemDirective.prototype, "kFileError", null);
|
|
2506
|
-
__decorate([
|
|
2507
|
-
HostBinding('class.k-file-invalid'),
|
|
2508
|
-
__metadata("design:type", Boolean),
|
|
2509
|
-
__metadata("design:paramtypes", [])
|
|
2510
|
-
], FileListItemDirective.prototype, "kFileInvalid", null);
|
|
2511
|
-
__decorate([
|
|
2512
|
-
HostBinding('class.k-file-progress'),
|
|
2513
|
-
__metadata("design:type", Boolean),
|
|
2514
|
-
__metadata("design:paramtypes", [])
|
|
2515
|
-
], FileListItemDirective.prototype, "kFileProgress", null);
|
|
2516
|
-
__decorate([
|
|
2517
|
-
HostBinding('class.k-file-success'),
|
|
2518
|
-
__metadata("design:type", Boolean),
|
|
2519
|
-
__metadata("design:paramtypes", [])
|
|
2520
|
-
], FileListItemDirective.prototype, "kFileSuccess", null);
|
|
2521
|
-
__decorate([
|
|
2522
|
-
HostBinding('class.k-state-focused'),
|
|
2523
|
-
__metadata("design:type", Boolean),
|
|
2524
|
-
__metadata("design:paramtypes", [])
|
|
2525
|
-
], FileListItemDirective.prototype, "kStateFocused", null);
|
|
2526
|
-
__decorate([
|
|
2527
|
-
HostListener("focus"),
|
|
2528
|
-
__metadata("design:type", Function),
|
|
2529
|
-
__metadata("design:paramtypes", []),
|
|
2530
|
-
__metadata("design:returntype", void 0)
|
|
2531
|
-
], FileListItemDirective.prototype, "onFocus", null);
|
|
2532
|
-
__decorate([
|
|
2533
|
-
HostListener("blur"),
|
|
2534
|
-
__metadata("design:type", Function),
|
|
2535
|
-
__metadata("design:paramtypes", []),
|
|
2536
|
-
__metadata("design:returntype", void 0)
|
|
2537
|
-
], FileListItemDirective.prototype, "onBlur", null);
|
|
2538
|
-
__decorate([
|
|
2539
|
-
HostListener('click', ['$event']),
|
|
2540
|
-
__metadata("design:type", Function),
|
|
2541
|
-
__metadata("design:paramtypes", [Object]),
|
|
2542
|
-
__metadata("design:returntype", void 0)
|
|
2543
|
-
], FileListItemDirective.prototype, "onClick", null);
|
|
2544
|
-
FileListItemDirective = __decorate([
|
|
2545
|
-
Directive({
|
|
2546
|
-
selector: '[kendoUploadFileListItem]'
|
|
2547
|
-
}),
|
|
2548
|
-
__metadata("design:paramtypes", [ElementRef,
|
|
2549
|
-
NavigationService,
|
|
2550
|
-
UploadService])
|
|
2551
|
-
], FileListItemDirective);
|
|
2552
|
-
return FileListItemDirective;
|
|
2553
|
-
}());
|
|
2554
|
-
|
|
2555
|
-
/**
|
|
2556
|
-
* @hidden
|
|
2557
|
-
*/
|
|
2558
|
-
var FileListComponent = /** @class */ (function () {
|
|
2559
|
-
function FileListComponent(uploadService, navigation) {
|
|
2560
|
-
this.uploadService = uploadService;
|
|
2561
|
-
this.navigation = navigation;
|
|
2562
|
-
this.onItemFocus();
|
|
2563
|
-
this.onItemAction();
|
|
2564
|
-
}
|
|
2565
|
-
FileListComponent.prototype.onItemFocus = function () {
|
|
2566
|
-
var _this = this;
|
|
2567
|
-
this.focusSubscription = this.navigation.onFileFocus.subscribe(function (index) {
|
|
2568
|
-
_this.fileListItems.toArray()[index].focus();
|
|
2569
|
-
});
|
|
2570
|
-
};
|
|
2571
|
-
FileListComponent.prototype.onItemAction = function () {
|
|
2572
|
-
var _this = this;
|
|
2573
|
-
this.actionSubscription = this.navigation.onFileAction.subscribe(function (key) {
|
|
2574
|
-
_this.itemActionHandler(key);
|
|
2575
|
-
});
|
|
2576
|
-
};
|
|
2577
|
-
FileListComponent.prototype.itemActionHandler = function (key) {
|
|
2578
|
-
var index = this.navigation.focusedIndex;
|
|
2579
|
-
var item = this.fileListItems.toArray()[index];
|
|
2580
|
-
var uid = item.uidAttribute;
|
|
2581
|
-
var files = this.uploadService.files.get(uid);
|
|
2582
|
-
if (key === Keys.Escape && files[0].state === FileState.Uploading) {
|
|
2583
|
-
this.uploadService.cancelFiles(uid);
|
|
2584
|
-
this.navigation.focusSelectButton();
|
|
2585
|
-
return;
|
|
2586
|
-
}
|
|
2587
|
-
if (key === Keys.Enter && files[0].state === FileState.Failed) {
|
|
2588
|
-
this.uploadService.retryFiles(uid);
|
|
2589
|
-
return;
|
|
2590
|
-
}
|
|
2591
|
-
if (key === Keys.Delete) {
|
|
2592
|
-
if (files[0].state === FileState.Uploading) {
|
|
2593
|
-
this.uploadService.cancelFiles(uid);
|
|
2594
|
-
}
|
|
2595
|
-
else if (this.hasDelete(item)) {
|
|
2596
|
-
this.uploadService.removeFiles(uid);
|
|
2597
|
-
}
|
|
2598
|
-
this.navigation.focusSelectButton();
|
|
2599
|
-
}
|
|
2600
|
-
};
|
|
2601
|
-
FileListComponent.prototype.hasDelete = function (item) {
|
|
2602
|
-
return item.element.nativeElement.getElementsByClassName('k-delete').length > 0;
|
|
2603
|
-
};
|
|
2604
|
-
FileListComponent.prototype.ngOnDestroy = function () {
|
|
2605
|
-
this.focusSubscription.unsubscribe();
|
|
2606
|
-
this.actionSubscription.unsubscribe();
|
|
2607
|
-
};
|
|
2608
|
-
__decorate([
|
|
2609
|
-
Input(),
|
|
2610
|
-
__metadata("design:type", Boolean)
|
|
2611
|
-
], FileListComponent.prototype, "disabled", void 0);
|
|
2612
|
-
__decorate([
|
|
2613
|
-
Input(),
|
|
2614
|
-
__metadata("design:type", Array)
|
|
2615
|
-
], FileListComponent.prototype, "fileList", void 0);
|
|
2616
|
-
__decorate([
|
|
2617
|
-
Input(),
|
|
2618
|
-
__metadata("design:type", FileTemplateDirective)
|
|
2619
|
-
], FileListComponent.prototype, "fileTemplate", void 0);
|
|
2620
|
-
__decorate([
|
|
2621
|
-
Input(),
|
|
2622
|
-
__metadata("design:type", FileInfoTemplateDirective)
|
|
2623
|
-
], FileListComponent.prototype, "fileInfoTemplate", void 0);
|
|
2624
|
-
__decorate([
|
|
2625
|
-
ViewChildren(FileListItemDirective),
|
|
2626
|
-
__metadata("design:type", QueryList)
|
|
2627
|
-
], FileListComponent.prototype, "fileListItems", void 0);
|
|
2628
|
-
FileListComponent = __decorate([
|
|
2629
|
-
Component({
|
|
2630
|
-
selector: '[kendo-upload-file-list]',
|
|
2631
|
-
template: "\n <ng-template ngFor\n [ngForOf]=\"fileList\"\n let-files\n let-index=\"index\">\n <li kendoUploadFileListItem [files]='files' [index]='index'>\n <kendo-upload-file-list-single-item\n class='k-file-single'\n *ngIf='files.length === 1 && !fileTemplate'\n [disabled]='disabled'\n [file]='files[0]'\n [fileInfoTemplate]=\"fileInfoTemplate\">\n </kendo-upload-file-list-single-item>\n <kendo-upload-file-list-multiple-items\n class='k-file-multiple'\n *ngIf='files.length > 1 && !fileTemplate'\n [disabled]='disabled'\n [files]='files'\n [fileInfoTemplate]=\"fileInfoTemplate\">\n </kendo-upload-file-list-multiple-items>\n <ng-template *ngIf=\"fileTemplate\"\n [templateContext]=\"{\n templateRef: fileTemplate.templateRef,\n state: files[0].state,\n $implicit: files\n }\"></ng-template>\n </li>\n </ng-template>\n "
|
|
2632
|
-
}),
|
|
2633
|
-
__metadata("design:paramtypes", [UploadService,
|
|
2634
|
-
NavigationService])
|
|
2635
|
-
], FileListComponent);
|
|
2636
|
-
return FileListComponent;
|
|
2637
|
-
}());
|
|
2638
|
-
|
|
2639
|
-
/**
|
|
2640
|
-
* @hidden
|
|
2641
|
-
*/
|
|
2642
|
-
var FileListItemActionButtonComponent = /** @class */ (function () {
|
|
2643
|
-
function FileListItemActionButtonComponent(uploadService, localization, navigation) {
|
|
2644
|
-
this.uploadService = uploadService;
|
|
2645
|
-
this.localization = localization;
|
|
2646
|
-
this.navigation = navigation;
|
|
2647
|
-
this.actionFocused = false;
|
|
2648
|
-
this.retryFocused = false;
|
|
2649
|
-
this.pauseResumeFocused = false;
|
|
2650
|
-
}
|
|
2651
|
-
FileListItemActionButtonComponent.prototype.onFocus = function (type) {
|
|
2652
|
-
if (type === 'action') {
|
|
2653
|
-
this.actionFocused = true;
|
|
2654
|
-
}
|
|
2655
|
-
if (type === 'retry') {
|
|
2656
|
-
this.retryFocused = true;
|
|
2657
|
-
}
|
|
2658
|
-
if (type === 'pauseResume') {
|
|
2659
|
-
this.pauseResumeFocused = true;
|
|
2660
|
-
}
|
|
2661
|
-
};
|
|
2662
|
-
FileListItemActionButtonComponent.prototype.onBlur = function (type) {
|
|
2663
|
-
if (type === 'retry') {
|
|
2664
|
-
this.retryFocused = false;
|
|
2665
|
-
}
|
|
2666
|
-
if (type === 'action') {
|
|
2667
|
-
this.actionFocused = false;
|
|
2668
|
-
}
|
|
2669
|
-
if (type === 'pauseResume') {
|
|
2670
|
-
this.pauseResumeFocused = false;
|
|
2671
|
-
}
|
|
2672
|
-
};
|
|
2673
|
-
FileListItemActionButtonComponent.prototype.onRetryClick = function () {
|
|
2674
|
-
if (this.disabled) {
|
|
2675
|
-
return;
|
|
2676
|
-
}
|
|
2677
|
-
this.uploadService.retryFiles(this.file.uid);
|
|
2678
|
-
};
|
|
2679
|
-
FileListItemActionButtonComponent.prototype.onRemoveCancelClick = function (event) {
|
|
2680
|
-
if (this.disabled) {
|
|
2681
|
-
return;
|
|
2682
|
-
}
|
|
2683
|
-
event.stopImmediatePropagation();
|
|
2684
|
-
var uid = this.file.uid;
|
|
2685
|
-
if (this.file.state === FileState.Uploading) {
|
|
2686
|
-
this.uploadService.cancelFiles(uid);
|
|
2687
|
-
}
|
|
2688
|
-
else {
|
|
2689
|
-
this.uploadService.removeFiles(uid);
|
|
2690
|
-
}
|
|
2691
|
-
this.navigation.focusSelectButton();
|
|
2692
|
-
};
|
|
2693
|
-
FileListItemActionButtonComponent.prototype.onPauseResumeClick = function () {
|
|
2694
|
-
if (this.disabled) {
|
|
2695
|
-
return;
|
|
2696
|
-
}
|
|
2697
|
-
var uid = this.file.uid;
|
|
2698
|
-
if (this.file.state === FileState.Paused) {
|
|
2699
|
-
this.uploadService.resumeFile(uid);
|
|
2700
|
-
}
|
|
2701
|
-
else {
|
|
2702
|
-
this.uploadService.pauseFile(uid);
|
|
2703
|
-
}
|
|
2704
|
-
};
|
|
2705
|
-
Object.defineProperty(FileListItemActionButtonComponent.prototype, "actionButtonTitle", {
|
|
2706
|
-
get: function () {
|
|
2707
|
-
if (this.file.state === FileState.Uploading) {
|
|
2708
|
-
return this.localization.get('cancel');
|
|
2709
|
-
}
|
|
2710
|
-
return this.localization.get('remove');
|
|
2711
|
-
},
|
|
2712
|
-
enumerable: true,
|
|
2713
|
-
configurable: true
|
|
2714
|
-
});
|
|
2715
|
-
Object.defineProperty(FileListItemActionButtonComponent.prototype, "retryButtonTitle", {
|
|
2716
|
-
get: function () {
|
|
2717
|
-
return this.localization.get('retry');
|
|
2718
|
-
},
|
|
2719
|
-
enumerable: true,
|
|
2720
|
-
configurable: true
|
|
2721
|
-
});
|
|
2722
|
-
Object.defineProperty(FileListItemActionButtonComponent.prototype, "pauseResumeButtonTitle", {
|
|
2723
|
-
get: function () {
|
|
2724
|
-
if (this.file.state === FileState.Uploading) {
|
|
2725
|
-
return this.localization.get('pause');
|
|
2726
|
-
}
|
|
2727
|
-
return this.localization.get('resume');
|
|
2728
|
-
},
|
|
2729
|
-
enumerable: true,
|
|
2730
|
-
configurable: true
|
|
2731
|
-
});
|
|
2732
|
-
Object.defineProperty(FileListItemActionButtonComponent.prototype, "isUploading", {
|
|
2733
|
-
get: function () {
|
|
2734
|
-
return this.file.state === FileState.Uploading;
|
|
2735
|
-
},
|
|
2736
|
-
enumerable: true,
|
|
2737
|
-
configurable: true
|
|
2738
|
-
});
|
|
2739
|
-
Object.defineProperty(FileListItemActionButtonComponent.prototype, "isFailed", {
|
|
2740
|
-
get: function () {
|
|
2741
|
-
return this.file.state === FileState.Failed;
|
|
2742
|
-
},
|
|
2743
|
-
enumerable: true,
|
|
2744
|
-
configurable: true
|
|
2745
|
-
});
|
|
2746
|
-
Object.defineProperty(FileListItemActionButtonComponent.prototype, "isPaused", {
|
|
2747
|
-
get: function () {
|
|
2748
|
-
return this.file.state === FileState.Paused;
|
|
2749
|
-
},
|
|
2750
|
-
enumerable: true,
|
|
2751
|
-
configurable: true
|
|
2752
|
-
});
|
|
2753
|
-
Object.defineProperty(FileListItemActionButtonComponent.prototype, "isResumable", {
|
|
2754
|
-
get: function () {
|
|
2755
|
-
var service = this.uploadService;
|
|
2756
|
-
var isResumable = service.async.chunk && service.chunk.resumable;
|
|
2757
|
-
var isUploading = (this.file.state === FileState.Paused) || (this.file.state === FileState.Uploading);
|
|
2758
|
-
return isResumable && isUploading;
|
|
2759
|
-
},
|
|
2760
|
-
enumerable: true,
|
|
2761
|
-
configurable: true
|
|
2762
|
-
});
|
|
2763
|
-
Object.defineProperty(FileListItemActionButtonComponent.prototype, "isActionButtonVisible", {
|
|
2764
|
-
get: function () {
|
|
2765
|
-
if ((this.file.state === FileState.Uploaded || this.file.state === FileState.Initial) &&
|
|
2766
|
-
!this.uploadService.async.removeUrl && this.uploadService.component === 'Upload') {
|
|
2767
|
-
return false;
|
|
2768
|
-
}
|
|
2769
|
-
return true;
|
|
2770
|
-
},
|
|
2771
|
-
enumerable: true,
|
|
2772
|
-
configurable: true
|
|
2773
|
-
});
|
|
2774
|
-
__decorate([
|
|
2775
|
-
Input(),
|
|
2776
|
-
__metadata("design:type", Object)
|
|
2777
|
-
], FileListItemActionButtonComponent.prototype, "file", void 0);
|
|
2778
|
-
__decorate([
|
|
2779
|
-
Input(),
|
|
2780
|
-
__metadata("design:type", Boolean)
|
|
2781
|
-
], FileListItemActionButtonComponent.prototype, "disabled", void 0);
|
|
2782
|
-
__decorate([
|
|
2783
|
-
Input(),
|
|
2784
|
-
__metadata("design:type", Number)
|
|
2785
|
-
], FileListItemActionButtonComponent.prototype, "progress", void 0);
|
|
2786
|
-
FileListItemActionButtonComponent = __decorate([
|
|
2787
|
-
Component({
|
|
2788
|
-
selector: 'kendo-upload-file-list-item-action-button',
|
|
2789
|
-
template: "\n <strong class=\"k-upload-status\">\n <span class=\"k-upload-pct\" *ngIf=\"isUploading || isPaused\">{{progress}}%</span>\n\n <button type=\"button\" *ngIf=\"isFailed\" class=\"k-button k-icon-button k-button-md k-rounded-md k-button-flat k-button-flat-base k-upload-action\"\n [ngClass]=\"{ 'k-focus': this.retryFocused }\"\n [attr.tabIndex]=\"-1\"\n (focus)=\"onFocus('retry')\"\n (blur)=\"onBlur('retry')\"\n (click)=\"onRetryClick()\">\n <span class=\"k-icon k-button-icon k-retry k-i-refresh-sm\"\n [attr.aria-label]=\"retryButtonTitle\"\n [attr.title]=\"retryButtonTitle\">\n </span>\n </button>\n\n <button *ngIf=\"isResumable\" type=\"button\" class=\"k-button k-icon-button k-button-md k-rounded-md k-button-flat k-button-flat-base k-upload-action\"\n [ngClass]=\"{ 'k-focus': this.pauseResumeFocused }\"\n [attr.tabIndex]=\"-1\"\n (focus)=\"onFocus('pauseResume')\"\n (blur)=\"onBlur('pauseResume')\"\n (click)=\"onPauseResumeClick()\">\n <span class=\"k-icon k-button-icon\"\n [ngClass]=\"{\n 'k-i-play-sm': isPaused,\n 'k-i-pause-sm': !isPaused\n }\"\n [attr.aria-label]='pauseResumeButtonTitle'\n [attr.title]='pauseResumeButtonTitle'>\n </span>\n </button>\n\n <button type=\"button\" *ngIf=\"isActionButtonVisible\" class=\"k-button k-icon-button k-button-md k-rounded-md k-button-flat k-button-flat-base k-upload-action\"\n [ngClass]=\"{ 'k-focus': this.actionFocused }\"\n [attr.tabIndex]=\"-1\"\n (focus)=\"onFocus('action')\"\n (blur)=\"onBlur('action')\"\n (click)=\"onRemoveCancelClick($event)\">\n <span class=\"k-icon k-button-icon\"\n [ngClass]=\"{\n 'k-i-cancel': isUploading,\n 'k-delete k-i-x': !isUploading\n }\"\n [attr.aria-label]='actionButtonTitle'\n [attr.title]='actionButtonTitle'>\n </span>\n </button>\n </strong>\n "
|
|
2790
|
-
}),
|
|
2791
|
-
__metadata("design:paramtypes", [UploadService,
|
|
2792
|
-
LocalizationService,
|
|
2793
|
-
NavigationService])
|
|
2794
|
-
], FileListItemActionButtonComponent);
|
|
2795
|
-
return FileListItemActionButtonComponent;
|
|
2796
|
-
}());
|
|
2797
|
-
|
|
2798
|
-
/**
|
|
2799
|
-
* @hidden
|
|
2800
|
-
*/
|
|
2801
|
-
var FileListItemBase = /** @class */ (function () {
|
|
2802
|
-
function FileListItemBase(uploadService) {
|
|
2803
|
-
this.uploadService = uploadService;
|
|
2804
|
-
this.progressComplete = 0;
|
|
2805
|
-
}
|
|
2806
|
-
FileListItemBase.prototype.subscribeUploadProgress = function (uploadProgressHandler) {
|
|
2807
|
-
this.uploadProgressSubscription = this.uploadService.uploadProgressEvent.subscribe(uploadProgressHandler);
|
|
2808
|
-
};
|
|
2809
|
-
FileListItemBase.prototype.fileHasValidationErrors = function (file) {
|
|
2810
|
-
return fileHasValidationErrors(file);
|
|
2811
|
-
};
|
|
2812
|
-
FileListItemBase.prototype.filesHaveValidationErrors = function (files) {
|
|
2813
|
-
return filesHaveValidationErrors(files);
|
|
2814
|
-
};
|
|
2815
|
-
FileListItemBase.prototype.ngOnDestroy = function () {
|
|
2816
|
-
this.uploadProgressSubscription.unsubscribe();
|
|
2817
|
-
};
|
|
2818
|
-
FileListItemBase.prototype.getFileValidationMessage = function (file) {
|
|
2819
|
-
var validationMessage;
|
|
2820
|
-
if (file.validationErrors && file.validationErrors.length > 0) {
|
|
2821
|
-
validationMessage = this.localization.get(file.validationErrors[0]);
|
|
2822
|
-
}
|
|
2823
|
-
return validationMessage;
|
|
2824
|
-
};
|
|
2825
|
-
FileListItemBase.prototype.getTotalFilesSizeMessage = function (files) {
|
|
2826
|
-
return getTotalFilesSizeMessage(files);
|
|
2827
|
-
};
|
|
2828
|
-
FileListItemBase.prototype.textFor = function (key) {
|
|
2829
|
-
return this.localization.get(key);
|
|
2830
|
-
};
|
|
2831
|
-
return FileListItemBase;
|
|
2832
|
-
}());
|
|
2833
|
-
|
|
2834
|
-
/**
|
|
2835
|
-
* @hidden
|
|
2836
|
-
*/
|
|
2837
|
-
var FileListMultipleItemsComponent = /** @class */ (function (_super) {
|
|
2838
|
-
__extends(FileListMultipleItemsComponent, _super);
|
|
2839
|
-
function FileListMultipleItemsComponent(localization, uploadService) {
|
|
2840
|
-
var _this = _super.call(this, uploadService) || this;
|
|
2841
|
-
_this.localization = localization;
|
|
2842
|
-
_this.subscribeUploadProgress(function (args) {
|
|
2843
|
-
if (args.files[0].uid === _this.files[0].uid) {
|
|
2844
|
-
_this.progressComplete = args.percentComplete;
|
|
2845
|
-
}
|
|
2846
|
-
});
|
|
2847
|
-
return _this;
|
|
2848
|
-
}
|
|
2849
|
-
Object.defineProperty(FileListMultipleItemsComponent.prototype, "showProgress", {
|
|
2850
|
-
get: function () {
|
|
2851
|
-
var showProgress = this.files[0].state === FileState.Uploading || this.files[0].state === FileState.Paused;
|
|
2852
|
-
return showProgress ? 'active' : 'inactive';
|
|
2853
|
-
},
|
|
2854
|
-
enumerable: true,
|
|
2855
|
-
configurable: true
|
|
2856
|
-
});
|
|
2857
|
-
FileListMultipleItemsComponent.prototype.ngOnInit = function () {
|
|
2858
|
-
this.filesHaveErrors = _super.prototype.filesHaveValidationErrors.call(this, this.files);
|
|
2859
|
-
};
|
|
2860
|
-
FileListMultipleItemsComponent.prototype.fileStatusText = function (file) {
|
|
2861
|
-
var errors = file.validationErrors;
|
|
2862
|
-
if (!isPresent(errors)) {
|
|
2863
|
-
return this.getTotalFilesSizeMessage([file]);
|
|
2864
|
-
}
|
|
2865
|
-
return this.getFileValidationMessage(file);
|
|
2866
|
-
};
|
|
2867
|
-
Object.defineProperty(FileListMultipleItemsComponent.prototype, "batchStatusText", {
|
|
2868
|
-
get: function () {
|
|
2869
|
-
var state$$1 = this.files[0].state;
|
|
2870
|
-
var fileCount = this.files.length;
|
|
2871
|
-
if (state$$1 === FileState.Uploaded) {
|
|
2872
|
-
return fileCount + " " + this.textFor('filesBatchStatusUploaded');
|
|
2873
|
-
}
|
|
2874
|
-
if (state$$1 === FileState.Failed) {
|
|
2875
|
-
return fileCount + " " + this.textFor('filesBatchStatusFailed');
|
|
2876
|
-
}
|
|
2877
|
-
return fileCount + " " + this.textFor('filesBatchStatus');
|
|
2878
|
-
},
|
|
2879
|
-
enumerable: true,
|
|
2880
|
-
configurable: true
|
|
2881
|
-
});
|
|
2882
|
-
Object.defineProperty(FileListMultipleItemsComponent.prototype, "isUploadSuccessful", {
|
|
2883
|
-
get: function () {
|
|
2884
|
-
return this.files[0].state === FileState.Uploaded;
|
|
2885
|
-
},
|
|
2886
|
-
enumerable: true,
|
|
2887
|
-
configurable: true
|
|
2888
|
-
});
|
|
2889
|
-
Object.defineProperty(FileListMultipleItemsComponent.prototype, "isUploadFailed", {
|
|
2890
|
-
get: function () {
|
|
2891
|
-
return this.files[0].state === FileState.Failed;
|
|
2892
|
-
},
|
|
2893
|
-
enumerable: true,
|
|
2894
|
-
configurable: true
|
|
2895
|
-
});
|
|
2896
|
-
__decorate([
|
|
2897
|
-
Input(),
|
|
2898
|
-
__metadata("design:type", Boolean)
|
|
2899
|
-
], FileListMultipleItemsComponent.prototype, "disabled", void 0);
|
|
2900
|
-
__decorate([
|
|
2901
|
-
Input(),
|
|
2902
|
-
__metadata("design:type", Array)
|
|
2903
|
-
], FileListMultipleItemsComponent.prototype, "files", void 0);
|
|
2904
|
-
__decorate([
|
|
2905
|
-
Input(),
|
|
2906
|
-
__metadata("design:type", FileInfoTemplateDirective)
|
|
2907
|
-
], FileListMultipleItemsComponent.prototype, "fileInfoTemplate", void 0);
|
|
2908
|
-
FileListMultipleItemsComponent = __decorate([
|
|
2909
|
-
Component({
|
|
2910
|
-
animations: [
|
|
2911
|
-
trigger('progressState', [
|
|
2912
|
-
state('active', style({ opacity: 1 })),
|
|
2913
|
-
state('inactive', style({ opacity: 0 })),
|
|
2914
|
-
transition('void => active', style({ opacity: 0 })),
|
|
2915
|
-
transition('inactive => active', style({ opacity: 1 })),
|
|
2916
|
-
transition('active => inactive', animate('1s 2s ease-out'))
|
|
2917
|
-
])
|
|
2918
|
-
],
|
|
2919
|
-
selector: 'kendo-upload-file-list-multiple-items',
|
|
2920
|
-
template: "\n <div class=\"k-progressbar\" [@progressState]=\"showProgress\">\n <span class=\"k-progress\" [style.width]=\"progressComplete + '%'\"></span>\n </div>\n <span class=\"k-multiple-files-group-wrapper\">\n <span class=\"k-file-group k-icon k-i-copy\"></span>\n </span>\n <span class=\"k-multiple-files-wrapper\">\n <ng-container *ngIf=\"!fileInfoTemplate\">\n <span *ngFor=\"let file of files\" class=\"k-file-name-size-wrapper\">\n <span [title]=\"file.name\" class=\"k-file-name\">\n {{file.name}}\n </span>\n <span [ngClass]=\"{\n 'k-text-error': file.validationErrors,\n 'k-file-validation-message': file.validationErrors,\n 'k-file-size': !file.validationErrors\n }\"\n >{{fileStatusText(file)}}</span>\n </span>\n <span class=\"k-file-information\"\n [ngClass]=\"{\n 'k-text-success': isUploadSuccessful,\n 'k-text-error': isUploadFailed\n }\"\n >{{batchStatusText}}</span>\n </ng-container>\n <ng-template *ngIf=\"fileInfoTemplate\"\n [templateContext]=\"{\n templateRef: fileInfoTemplate.templateRef,\n state: files[0].state,\n $implicit: files\n }\">\n </ng-template>\n </span>\n <kendo-upload-file-list-item-action-button\n [file]='files[0]'\n [disabled]='disabled'\n [progress]='progressComplete'>\n </kendo-upload-file-list-item-action-button>\n "
|
|
2921
|
-
}),
|
|
2922
|
-
__metadata("design:paramtypes", [LocalizationService,
|
|
2923
|
-
UploadService])
|
|
2924
|
-
], FileListMultipleItemsComponent);
|
|
2925
|
-
return FileListMultipleItemsComponent;
|
|
2926
|
-
}(FileListItemBase));
|
|
2927
|
-
|
|
2928
|
-
/**
|
|
2929
|
-
* @hidden
|
|
2930
|
-
*/
|
|
2931
|
-
var FileListSingleItemComponent = /** @class */ (function (_super) {
|
|
2932
|
-
__extends(FileListSingleItemComponent, _super);
|
|
2933
|
-
function FileListSingleItemComponent(localization, uploadService) {
|
|
2934
|
-
var _this = _super.call(this, uploadService) || this;
|
|
2935
|
-
_this.localization = localization;
|
|
2936
|
-
_this.subscribeUploadProgress(function (args) {
|
|
2937
|
-
if (args.files[0].uid === _this.file.uid) {
|
|
2938
|
-
_this.progressComplete = args.percentComplete;
|
|
2939
|
-
}
|
|
2940
|
-
});
|
|
2941
|
-
return _this;
|
|
2942
|
-
}
|
|
2943
|
-
Object.defineProperty(FileListSingleItemComponent.prototype, "fileStatusText", {
|
|
2944
|
-
get: function () {
|
|
2945
|
-
var errors = this.file.validationErrors;
|
|
2946
|
-
if (this.file.state === FileState.Uploaded) {
|
|
2947
|
-
return "" + this.textFor('fileStatusUploaded');
|
|
2948
|
-
}
|
|
2949
|
-
if (this.file.state === FileState.Failed) {
|
|
2950
|
-
return "" + this.textFor('fileStatusFailed');
|
|
2951
|
-
}
|
|
2952
|
-
if (!isPresent(errors)) {
|
|
2953
|
-
return this.getTotalFilesSizeMessage([this.file]);
|
|
2954
|
-
}
|
|
2955
|
-
return this.getFileValidationMessage(this.file);
|
|
2956
|
-
},
|
|
2957
|
-
enumerable: true,
|
|
2958
|
-
configurable: true
|
|
2959
|
-
});
|
|
2960
|
-
Object.defineProperty(FileListSingleItemComponent.prototype, "showProgress", {
|
|
2961
|
-
get: function () {
|
|
2962
|
-
var showProgress = this.file.state === FileState.Uploading || this.file.state === FileState.Paused;
|
|
2963
|
-
return showProgress ? 'active' : 'inactive';
|
|
2964
|
-
},
|
|
2965
|
-
enumerable: true,
|
|
2966
|
-
configurable: true
|
|
2967
|
-
});
|
|
2968
|
-
Object.defineProperty(FileListSingleItemComponent.prototype, "fileGroupClass", {
|
|
2969
|
-
get: function () {
|
|
2970
|
-
return getFileGroupCssClass(this.file.extension ? this.file.extension : '');
|
|
2971
|
-
},
|
|
2972
|
-
enumerable: true,
|
|
2973
|
-
configurable: true
|
|
2974
|
-
});
|
|
2975
|
-
Object.defineProperty(FileListSingleItemComponent.prototype, "isUploadSuccessful", {
|
|
2976
|
-
get: function () {
|
|
2977
|
-
return this.file.state === FileState.Uploaded;
|
|
2978
|
-
},
|
|
2979
|
-
enumerable: true,
|
|
2980
|
-
configurable: true
|
|
2981
|
-
});
|
|
2982
|
-
Object.defineProperty(FileListSingleItemComponent.prototype, "isUploadFailed", {
|
|
2983
|
-
get: function () {
|
|
2984
|
-
return this.file.state === FileState.Failed;
|
|
2985
|
-
},
|
|
2986
|
-
enumerable: true,
|
|
2987
|
-
configurable: true
|
|
2988
|
-
});
|
|
2989
|
-
Object.defineProperty(FileListSingleItemComponent.prototype, "isNotYetUploaded", {
|
|
2990
|
-
get: function () {
|
|
2991
|
-
return !this.isUploadFailed && !this.isUploadSuccessful;
|
|
2992
|
-
},
|
|
2993
|
-
enumerable: true,
|
|
2994
|
-
configurable: true
|
|
2995
|
-
});
|
|
2996
|
-
__decorate([
|
|
2997
|
-
Input(),
|
|
2998
|
-
__metadata("design:type", Boolean)
|
|
2999
|
-
], FileListSingleItemComponent.prototype, "disabled", void 0);
|
|
3000
|
-
__decorate([
|
|
3001
|
-
Input(),
|
|
3002
|
-
__metadata("design:type", Object)
|
|
3003
|
-
], FileListSingleItemComponent.prototype, "file", void 0);
|
|
3004
|
-
__decorate([
|
|
3005
|
-
Input(),
|
|
3006
|
-
__metadata("design:type", FileInfoTemplateDirective)
|
|
3007
|
-
], FileListSingleItemComponent.prototype, "fileInfoTemplate", void 0);
|
|
3008
|
-
FileListSingleItemComponent = __decorate([
|
|
3009
|
-
Component({
|
|
3010
|
-
animations: [
|
|
3011
|
-
trigger('progressState', [
|
|
3012
|
-
state('active', style({ opacity: 1 })),
|
|
3013
|
-
state('inactive', style({ opacity: 0 })),
|
|
3014
|
-
transition('void => active', style({ opacity: 0 })),
|
|
3015
|
-
transition('inactive => active', style({ opacity: 1 })),
|
|
3016
|
-
transition('active => inactive', animate('1s 2s ease-out'))
|
|
3017
|
-
])
|
|
3018
|
-
],
|
|
3019
|
-
selector: 'kendo-upload-file-list-single-item',
|
|
3020
|
-
template: "\n <div class=\"k-progressbar\" [@progressState]=\"showProgress\">\n <span class=\"k-progress\" [style.width]=\"progressComplete + '%'\"></span>\n </div>\n <span class=\"k-file-group-wrapper\">\n <span class=\"k-file-group k-icon\" [ngClass]=\"fileGroupClass\"></span>\n </span>\n <span class=\"k-file-name-size-wrapper\">\n <ng-container *ngIf=\"!fileInfoTemplate\">\n <span class=\"k-file-name\" [title]=\"file.name\">{{ file.name }}</span>\n <span [ngClass]=\"{\n 'k-file-validation-message': file.validationErrors,\n 'k-file-size': !file.validationErrors && isNotYetUploaded,\n 'k-text-success': isUploadSuccessful,\n 'k-text-error': file.validationErrors || isUploadFailed,\n 'k-file-information': isUploadSuccessful || isUploadFailed\n }\"\n >{{fileStatusText}}</span>\n </ng-container>\n <ng-template *ngIf=\"fileInfoTemplate\"\n [templateContext]=\"{\n templateRef: fileInfoTemplate.templateRef,\n state: file.state,\n $implicit: [file]\n }\">\n </ng-template>\n </span>\n <kendo-upload-file-list-item-action-button\n [file]='file'\n [disabled]='disabled'\n [progress]='progressComplete'>\n </kendo-upload-file-list-item-action-button>\n "
|
|
3021
|
-
}),
|
|
3022
|
-
__metadata("design:paramtypes", [LocalizationService, UploadService])
|
|
3023
|
-
], FileListSingleItemComponent);
|
|
3024
|
-
return FileListSingleItemComponent;
|
|
3025
|
-
}(FileListItemBase));
|
|
3026
|
-
|
|
3027
|
-
/**
|
|
3028
|
-
* @hidden
|
|
3029
|
-
*/
|
|
3030
|
-
var FileSelectDirective = /** @class */ (function () {
|
|
3031
|
-
function FileSelectDirective(uploadService, navigation, el) {
|
|
3032
|
-
this.uploadService = uploadService;
|
|
3033
|
-
this.navigation = navigation;
|
|
3034
|
-
this.type = "file";
|
|
3035
|
-
this.autocomplete = "off";
|
|
3036
|
-
this.tabIndex = -1;
|
|
3037
|
-
this.element = el;
|
|
3038
|
-
}
|
|
3039
|
-
Object.defineProperty(FileSelectDirective.prototype, "nameAttribute", {
|
|
3040
|
-
get: function () {
|
|
3041
|
-
return this.uploadService.async.saveField;
|
|
3042
|
-
},
|
|
3043
|
-
enumerable: true,
|
|
3044
|
-
configurable: true
|
|
3045
|
-
});
|
|
3046
|
-
Object.defineProperty(FileSelectDirective.prototype, "multipleAttribute", {
|
|
3047
|
-
get: function () {
|
|
3048
|
-
return this.multiple ? "multiple" : null;
|
|
3049
|
-
},
|
|
3050
|
-
enumerable: true,
|
|
3051
|
-
configurable: true
|
|
3052
|
-
});
|
|
3053
|
-
Object.defineProperty(FileSelectDirective.prototype, "dirAttribute", {
|
|
3054
|
-
get: function () {
|
|
3055
|
-
return this.dir;
|
|
3056
|
-
},
|
|
3057
|
-
enumerable: true,
|
|
3058
|
-
configurable: true
|
|
3059
|
-
});
|
|
3060
|
-
Object.defineProperty(FileSelectDirective.prototype, "disabledAttribute", {
|
|
3061
|
-
get: function () {
|
|
3062
|
-
return this.disabled ? "true" : null;
|
|
3063
|
-
},
|
|
3064
|
-
enumerable: true,
|
|
3065
|
-
configurable: true
|
|
3066
|
-
});
|
|
3067
|
-
FileSelectDirective.prototype.onInputChange = function (event) {
|
|
3068
|
-
var _this = this;
|
|
3069
|
-
var ua = navigator.userAgent;
|
|
3070
|
-
var webkit = /(webkit)[ \/]([\w.]+)/i;
|
|
3071
|
-
var ie = /(windows)[ \/]([\w.]+)/i;
|
|
3072
|
-
var selectedFiles = inputFiles(event.target);
|
|
3073
|
-
selectedFiles = assignGuidToFiles(selectedFiles, !this.uploadService.async.batch);
|
|
3074
|
-
validateFiles(selectedFiles, this.restrictions);
|
|
3075
|
-
if (!this.multiple) {
|
|
3076
|
-
this.uploadService.clearFiles();
|
|
3077
|
-
}
|
|
3078
|
-
this.uploadService.addFiles(selectedFiles);
|
|
3079
|
-
/*
|
|
3080
|
-
Chrome, IE, Edge and Safari do not trigger a `change` event
|
|
3081
|
-
when a file with the same name is selected a number of consecutive times.
|
|
3082
|
-
As a workaround, clear the input value after handling the file.
|
|
3083
|
-
*/
|
|
3084
|
-
var native = this.element.nativeElement;
|
|
3085
|
-
if (ua.match(webkit) || ua.match(ie)) {
|
|
3086
|
-
native.type = "";
|
|
3087
|
-
native.type = "file";
|
|
3088
|
-
}
|
|
3089
|
-
setTimeout(function () {
|
|
3090
|
-
_this.navigation.focusedIndex = -1;
|
|
3091
|
-
});
|
|
3092
|
-
};
|
|
3093
|
-
__decorate([
|
|
3094
|
-
Input(),
|
|
3095
|
-
__metadata("design:type", String)
|
|
3096
|
-
], FileSelectDirective.prototype, "dir", void 0);
|
|
3097
|
-
__decorate([
|
|
3098
|
-
Input(),
|
|
3099
|
-
__metadata("design:type", Boolean)
|
|
3100
|
-
], FileSelectDirective.prototype, "disabled", void 0);
|
|
3101
|
-
__decorate([
|
|
3102
|
-
Input(),
|
|
3103
|
-
__metadata("design:type", Boolean)
|
|
3104
|
-
], FileSelectDirective.prototype, "multiple", void 0);
|
|
3105
|
-
__decorate([
|
|
3106
|
-
Input(),
|
|
3107
|
-
__metadata("design:type", Object)
|
|
3108
|
-
], FileSelectDirective.prototype, "restrictions", void 0);
|
|
3109
|
-
__decorate([
|
|
3110
|
-
HostBinding("attr.type"),
|
|
3111
|
-
__metadata("design:type", String)
|
|
3112
|
-
], FileSelectDirective.prototype, "type", void 0);
|
|
3113
|
-
__decorate([
|
|
3114
|
-
HostBinding("attr.autocomplete"),
|
|
3115
|
-
__metadata("design:type", String)
|
|
3116
|
-
], FileSelectDirective.prototype, "autocomplete", void 0);
|
|
3117
|
-
__decorate([
|
|
3118
|
-
HostBinding("attr.tabindex"),
|
|
3119
|
-
__metadata("design:type", Number)
|
|
3120
|
-
], FileSelectDirective.prototype, "tabIndex", void 0);
|
|
3121
|
-
__decorate([
|
|
3122
|
-
HostBinding("attr.name"),
|
|
3123
|
-
__metadata("design:type", String),
|
|
3124
|
-
__metadata("design:paramtypes", [])
|
|
3125
|
-
], FileSelectDirective.prototype, "nameAttribute", null);
|
|
3126
|
-
__decorate([
|
|
3127
|
-
HostBinding("attr.multiple"),
|
|
3128
|
-
__metadata("design:type", String),
|
|
3129
|
-
__metadata("design:paramtypes", [])
|
|
3130
|
-
], FileSelectDirective.prototype, "multipleAttribute", null);
|
|
3131
|
-
__decorate([
|
|
3132
|
-
HostBinding("attr.dir"),
|
|
3133
|
-
__metadata("design:type", String),
|
|
3134
|
-
__metadata("design:paramtypes", [])
|
|
3135
|
-
], FileSelectDirective.prototype, "dirAttribute", null);
|
|
3136
|
-
__decorate([
|
|
3137
|
-
HostBinding("attr.disabled"),
|
|
3138
|
-
__metadata("design:type", String),
|
|
3139
|
-
__metadata("design:paramtypes", [])
|
|
3140
|
-
], FileSelectDirective.prototype, "disabledAttribute", null);
|
|
3141
|
-
__decorate([
|
|
3142
|
-
HostListener("change", ["$event"]),
|
|
3143
|
-
__metadata("design:type", Function),
|
|
3144
|
-
__metadata("design:paramtypes", [Object]),
|
|
3145
|
-
__metadata("design:returntype", void 0)
|
|
3146
|
-
], FileSelectDirective.prototype, "onInputChange", null);
|
|
3147
|
-
FileSelectDirective = __decorate([
|
|
3148
|
-
Directive({
|
|
3149
|
-
selector: '[kendoFileSelect]'
|
|
3150
|
-
}),
|
|
3151
|
-
__metadata("design:paramtypes", [UploadService,
|
|
3152
|
-
NavigationService,
|
|
3153
|
-
ElementRef])
|
|
3154
|
-
], FileSelectDirective);
|
|
3155
|
-
return FileSelectDirective;
|
|
3156
|
-
}());
|
|
3157
|
-
|
|
3158
|
-
/**
|
|
3159
|
-
* @hidden
|
|
3160
|
-
*/
|
|
3161
|
-
var LocalizedMessagesDirective = /** @class */ (function (_super) {
|
|
3162
|
-
__extends(LocalizedMessagesDirective, _super);
|
|
3163
|
-
function LocalizedMessagesDirective(service) {
|
|
3164
|
-
var _this = _super.call(this) || this;
|
|
3165
|
-
_this.service = service;
|
|
3166
|
-
return _this;
|
|
3167
|
-
}
|
|
3168
|
-
LocalizedMessagesDirective_1 = LocalizedMessagesDirective;
|
|
3169
|
-
var LocalizedMessagesDirective_1;
|
|
3170
|
-
LocalizedMessagesDirective = LocalizedMessagesDirective_1 = __decorate([
|
|
3171
|
-
Directive({
|
|
3172
|
-
providers: [
|
|
3173
|
-
{
|
|
3174
|
-
provide: Messages,
|
|
3175
|
-
useExisting: forwardRef(function () { return LocalizedMessagesDirective_1; }) // tslint:disable-line:no-forward-ref
|
|
3176
|
-
}
|
|
3177
|
-
],
|
|
3178
|
-
selector: "\n [kendoUploadLocalizedMessages],\n [kendoFileSelectLocalizedMessages],\n [kendoUploadDropZoneLocalizedMessages]\n "
|
|
3179
|
-
}),
|
|
3180
|
-
__metadata("design:paramtypes", [LocalizationService])
|
|
3181
|
-
], LocalizedMessagesDirective);
|
|
3182
|
-
return LocalizedMessagesDirective;
|
|
3183
|
-
}(Messages));
|
|
3184
|
-
|
|
3185
|
-
/**
|
|
3186
|
-
* @hidden
|
|
3187
|
-
*/
|
|
3188
|
-
var TemplateContextDirective = /** @class */ (function () {
|
|
3189
|
-
function TemplateContextDirective(viewContainerRef) {
|
|
3190
|
-
this.viewContainerRef = viewContainerRef;
|
|
3191
|
-
}
|
|
3192
|
-
Object.defineProperty(TemplateContextDirective.prototype, "templateContext", {
|
|
3193
|
-
set: function (context) {
|
|
3194
|
-
if (this.insertedViewRef) {
|
|
3195
|
-
this.viewContainerRef.remove(this.viewContainerRef.indexOf(this.insertedViewRef));
|
|
3196
|
-
this.insertedViewRef = undefined;
|
|
3197
|
-
}
|
|
3198
|
-
if (context.templateRef) {
|
|
3199
|
-
this.insertedViewRef = this.viewContainerRef.createEmbeddedView(context.templateRef, context);
|
|
3200
|
-
}
|
|
3201
|
-
},
|
|
3202
|
-
enumerable: true,
|
|
3203
|
-
configurable: true
|
|
3204
|
-
});
|
|
3205
|
-
__decorate([
|
|
3206
|
-
Input(),
|
|
3207
|
-
__metadata("design:type", Object),
|
|
3208
|
-
__metadata("design:paramtypes", [Object])
|
|
3209
|
-
], TemplateContextDirective.prototype, "templateContext", null);
|
|
3210
|
-
TemplateContextDirective = __decorate([
|
|
3211
|
-
Directive({
|
|
3212
|
-
selector: '[templateContext]' // tslint:disable-line:directive-selector
|
|
3213
|
-
}),
|
|
3214
|
-
__metadata("design:paramtypes", [ViewContainerRef])
|
|
3215
|
-
], TemplateContextDirective);
|
|
3216
|
-
return TemplateContextDirective;
|
|
3217
|
-
}());
|
|
3218
|
-
|
|
3219
|
-
/* tslint:disable: no-use-before-declare */
|
|
3220
|
-
/**
|
|
3221
|
-
* @hidden
|
|
3222
|
-
*/
|
|
3223
|
-
var UPLOAD_VALUE_ACCESSOR = {
|
|
3224
|
-
multi: true,
|
|
3225
|
-
provide: NG_VALUE_ACCESSOR,
|
|
3226
|
-
useExisting: forwardRef(function () { return UploadComponent; }) // tslint:disable-line:no-forward-ref
|
|
3227
|
-
};
|
|
3228
|
-
/**
|
|
3229
|
-
* Represents the [Kendo UI Upload component for Angular]({% slug overview_upload %}).
|
|
3230
|
-
*/
|
|
3231
|
-
var UploadComponent = /** @class */ (function () {
|
|
3232
|
-
function UploadComponent(uploadService, localization, navigation, dropZoneService, _ngZone, renderer, cdr, wrapper) {
|
|
3233
|
-
var _this = this;
|
|
3234
|
-
this.uploadService = uploadService;
|
|
3235
|
-
this.localization = localization;
|
|
3236
|
-
this.navigation = navigation;
|
|
3237
|
-
this.dropZoneService = dropZoneService;
|
|
3238
|
-
this._ngZone = _ngZone;
|
|
3239
|
-
this.renderer = renderer;
|
|
3240
|
-
this.cdr = cdr;
|
|
3241
|
-
/**
|
|
3242
|
-
* Enables the chunk functionality of the Upload.
|
|
3243
|
-
*
|
|
3244
|
-
* The default value is `false`.
|
|
3245
|
-
*/
|
|
3246
|
-
this.chunkable = false;
|
|
3247
|
-
/**
|
|
3248
|
-
* Enables the selection of multiple files
|
|
3249
|
-
* ([see example]({% slug fileprocessing_upload %}#toc-upload-of-sinlge-or-multiple-files)).
|
|
3250
|
-
* If set to `false`, only one file can be selected at a time.
|
|
3251
|
-
*/
|
|
3252
|
-
this.multiple = true;
|
|
3253
|
-
/**
|
|
3254
|
-
* Disables the Upload ([see example]({% slug disabledstate_upload %})).
|
|
3255
|
-
* The default value is `false`.
|
|
3256
|
-
*/
|
|
3257
|
-
this.disabled = false;
|
|
3258
|
-
/**
|
|
3259
|
-
* Toggles the visibility of the file list.
|
|
3260
|
-
*/
|
|
3261
|
-
this.showFileList = true;
|
|
3262
|
-
/**
|
|
3263
|
-
* Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
|
|
3264
|
-
*/
|
|
3265
|
-
this.tabindex = 0;
|
|
3266
|
-
/**
|
|
3267
|
-
* @hidden
|
|
3268
|
-
*/
|
|
3269
|
-
this.focusableId = "k-" + guid();
|
|
3270
|
-
/**
|
|
3271
|
-
* Specifies the possible layout of the action buttons.
|
|
3272
|
-
*/
|
|
3273
|
-
this.actionsLayout = 'end';
|
|
3274
|
-
/**
|
|
3275
|
-
* Fires when the user navigates outside the component.
|
|
3276
|
-
*/
|
|
3277
|
-
this.onBlur = new EventEmitter();
|
|
3278
|
-
/**
|
|
3279
|
-
* Fires when the upload is canceled while in progress.
|
|
3280
|
-
*/
|
|
3281
|
-
this.cancel = new EventEmitter();
|
|
3282
|
-
/**
|
|
3283
|
-
* Fires when the file list is about to be cleared. If prevented, the files will not be cleared.
|
|
3284
|
-
*/
|
|
3285
|
-
this.clear = new EventEmitter();
|
|
3286
|
-
/**
|
|
3287
|
-
* Fires when all active uploads are completed either successfully or with errors.
|
|
3288
|
-
*/
|
|
3289
|
-
this.complete = new EventEmitter();
|
|
3290
|
-
/**
|
|
3291
|
-
* Fires when an `upload` or `remove` operation has failed.
|
|
3292
|
-
*/
|
|
3293
|
-
this.error = new EventEmitter();
|
|
3294
|
-
/**
|
|
3295
|
-
* Fires when the component is focused.
|
|
3296
|
-
*/
|
|
3297
|
-
this.onFocus = new EventEmitter();
|
|
3298
|
-
/**
|
|
3299
|
-
* Fires when the upload of a file has been paused.
|
|
3300
|
-
*/
|
|
3301
|
-
this.pause = new EventEmitter();
|
|
3302
|
-
/**
|
|
3303
|
-
* Fires when an uploaded file is about to be removed. If prevented, the files will remain in the list.
|
|
3304
|
-
*/
|
|
3305
|
-
this.remove = new EventEmitter();
|
|
3306
|
-
/**
|
|
3307
|
-
* Fires when the upload of a file has been resumed.
|
|
3308
|
-
*/
|
|
3309
|
-
this.resume = new EventEmitter();
|
|
3310
|
-
/**
|
|
3311
|
-
* Fires when files are selected. If prevented, the selected files will not be added to the list.
|
|
3312
|
-
*/
|
|
3313
|
-
this.select = new EventEmitter();
|
|
3314
|
-
/**
|
|
3315
|
-
* Fires when an `upload` or `remove` operation is successfully completed.
|
|
3316
|
-
*/
|
|
3317
|
-
this.success = new EventEmitter();
|
|
3318
|
-
/**
|
|
3319
|
-
* Fires when one or more files are about to be uploaded. If prevented, the files will neither be uploaded, nor added to the file list.
|
|
3320
|
-
*/
|
|
3321
|
-
this.upload = new EventEmitter();
|
|
3322
|
-
/**
|
|
3323
|
-
* Fires when one or more files are being uploaded.
|
|
3324
|
-
*/
|
|
3325
|
-
this.uploadProgress = new EventEmitter();
|
|
3326
|
-
/**
|
|
3327
|
-
* Fires when the value of the component has changed as a result of a successful `upload`, `remove` or `clear` operation.
|
|
3328
|
-
*/
|
|
3329
|
-
this.valueChange = new EventEmitter();
|
|
3330
|
-
this.hostDefaultClasses = true;
|
|
3331
|
-
/**
|
|
3332
|
-
* @hidden
|
|
3333
|
-
*/
|
|
3334
|
-
this._restrictions = {
|
|
3335
|
-
allowedExtensions: [],
|
|
3336
|
-
maxFileSize: 0,
|
|
3337
|
-
minFileSize: 0
|
|
3338
|
-
};
|
|
3339
|
-
this.onTouchedCallback = function (_) { };
|
|
3340
|
-
this.onChangeCallback = function (_) { };
|
|
3341
|
-
validatePackage(packageMetadata);
|
|
3342
|
-
this.fileList = this.uploadService.files;
|
|
3343
|
-
this.localizationChangeSubscription = localization.changes.subscribe(function (_a) {
|
|
3344
|
-
var rtl = _a.rtl;
|
|
3345
|
-
_this.direction = rtl ? 'rtl' : 'ltr';
|
|
3346
|
-
_this.navigation.computeKeys(_this.direction);
|
|
3347
|
-
});
|
|
3348
|
-
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
3349
|
-
this.navigation.computeKeys(this.direction);
|
|
3350
|
-
this.wrapper = wrapper.nativeElement;
|
|
3351
|
-
this.subscribeBlur();
|
|
3352
|
-
this.subscribeFocus();
|
|
3353
|
-
this.attachEventHandlers();
|
|
3354
|
-
}
|
|
3355
|
-
UploadComponent_1 = UploadComponent;
|
|
3356
|
-
Object.defineProperty(UploadComponent.prototype, "autoUpload", {
|
|
3357
|
-
get: function () {
|
|
3358
|
-
return this.uploadService.async.autoUpload;
|
|
3359
|
-
},
|
|
3360
|
-
/**
|
|
3361
|
-
* By default, the selected files are immediately uploaded
|
|
3362
|
-
* ([see example]({% slug fileprocessing_upload %}#toc-automatic-upload-of-files)).
|
|
3363
|
-
* To change this behavior, set `autoUpload` to `false`.
|
|
3364
|
-
*/
|
|
3365
|
-
set: function (autoUpload) {
|
|
3366
|
-
this.uploadService.async.autoUpload = autoUpload;
|
|
3367
|
-
},
|
|
3368
|
-
enumerable: true,
|
|
3369
|
-
configurable: true
|
|
3370
|
-
});
|
|
3371
|
-
Object.defineProperty(UploadComponent.prototype, "batch", {
|
|
3372
|
-
get: function () {
|
|
3373
|
-
return this.uploadService.async.batch;
|
|
3374
|
-
},
|
|
3375
|
-
/**
|
|
3376
|
-
* When enabled, all files in the selection are uploaded in one request
|
|
3377
|
-
* ([see example]({% slug fileprocessing_upload %}#toc-upload-of-batches-of-files)).
|
|
3378
|
-
* Any files that are selected one after the other are uploaded in separate requests.
|
|
3379
|
-
*/
|
|
3380
|
-
set: function (batch) {
|
|
3381
|
-
this.uploadService.async.batch = batch;
|
|
3382
|
-
},
|
|
3383
|
-
enumerable: true,
|
|
3384
|
-
configurable: true
|
|
3385
|
-
});
|
|
3386
|
-
Object.defineProperty(UploadComponent.prototype, "withCredentials", {
|
|
3387
|
-
get: function () {
|
|
3388
|
-
return this.uploadService.async.withCredentials;
|
|
3389
|
-
},
|
|
3390
|
-
/**
|
|
3391
|
-
* Configures whether credentials (cookies, headers) will be sent for cross-site requests
|
|
3392
|
-
* ([see example]({% slug credentials_upload %}#toc-attaching-credentials-to-requests)).
|
|
3393
|
-
* The default values is `true`. Setting `withCredentials` has no effect on same-site requests.
|
|
3394
|
-
* To add credentials to the request, use the `saveHeaders` or `removeHeaders` property,
|
|
3395
|
-
* or the [`upload`]({% slug api_upload_uploadevent %}) event.
|
|
3396
|
-
*/
|
|
3397
|
-
set: function (withCredentials) {
|
|
3398
|
-
this.uploadService.async.withCredentials = withCredentials;
|
|
3399
|
-
},
|
|
3400
|
-
enumerable: true,
|
|
3401
|
-
configurable: true
|
|
3402
|
-
});
|
|
3403
|
-
Object.defineProperty(UploadComponent.prototype, "saveField", {
|
|
3404
|
-
get: function () {
|
|
3405
|
-
return this.uploadService.async.saveField;
|
|
3406
|
-
},
|
|
3407
|
-
/**
|
|
3408
|
-
* Sets the [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) key which contains the files submitted to `saveUrl`.
|
|
3409
|
-
* The default value is `files`.
|
|
3410
|
-
*/
|
|
3411
|
-
set: function (saveField) {
|
|
3412
|
-
this.uploadService.async.saveField = saveField;
|
|
3413
|
-
},
|
|
3414
|
-
enumerable: true,
|
|
3415
|
-
configurable: true
|
|
3416
|
-
});
|
|
3417
|
-
Object.defineProperty(UploadComponent.prototype, "saveHeaders", {
|
|
3418
|
-
get: function () {
|
|
3419
|
-
return this.uploadService.async.saveHeaders;
|
|
3420
|
-
},
|
|
3421
|
-
/**
|
|
3422
|
-
* Configures the [`HttpHeaders`](https://angular.io/api/common/http/HttpHeaders)
|
|
3423
|
-
* that are attached to each upload request.
|
|
3424
|
-
*/
|
|
3425
|
-
set: function (saveHeaders) {
|
|
3426
|
-
this.uploadService.async.saveHeaders = saveHeaders;
|
|
3427
|
-
},
|
|
3428
|
-
enumerable: true,
|
|
3429
|
-
configurable: true
|
|
3430
|
-
});
|
|
3431
|
-
Object.defineProperty(UploadComponent.prototype, "saveMethod", {
|
|
3432
|
-
get: function () {
|
|
3433
|
-
return this.uploadService.async.saveMethod;
|
|
3434
|
-
},
|
|
3435
|
-
/**
|
|
3436
|
-
* Sets the [`RequestMethod`](https://angular.io/api/http/RequestMethod) of the upload request.
|
|
3437
|
-
* The default value is `POST`.
|
|
3438
|
-
*/
|
|
3439
|
-
set: function (saveMethod) {
|
|
3440
|
-
this.uploadService.async.saveMethod = saveMethod;
|
|
3441
|
-
},
|
|
3442
|
-
enumerable: true,
|
|
3443
|
-
configurable: true
|
|
3444
|
-
});
|
|
3445
|
-
Object.defineProperty(UploadComponent.prototype, "saveUrl", {
|
|
3446
|
-
get: function () {
|
|
3447
|
-
return this.uploadService.async.saveUrl;
|
|
3448
|
-
},
|
|
3449
|
-
/**
|
|
3450
|
-
* Sets the URL of the endpoint for the upload request.
|
|
3451
|
-
* The request [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) key is named after the `saveField` property.
|
|
3452
|
-
* It contains the list of files to be uploaded.
|
|
3453
|
-
*/
|
|
3454
|
-
set: function (saveUrl) {
|
|
3455
|
-
this.uploadService.async.saveUrl = saveUrl;
|
|
3456
|
-
},
|
|
3457
|
-
enumerable: true,
|
|
3458
|
-
configurable: true
|
|
3459
|
-
});
|
|
3460
|
-
Object.defineProperty(UploadComponent.prototype, "responseType", {
|
|
3461
|
-
get: function () {
|
|
3462
|
-
return this.uploadService.async.responseType;
|
|
3463
|
-
},
|
|
3464
|
-
/**
|
|
3465
|
-
* Sets the expected [`response type`](https://angular.io/api/common/http/HttpRequest#responseType) of the server.
|
|
3466
|
-
* It is used to parse the response appropriately.
|
|
3467
|
-
* The default value is `json`.
|
|
3468
|
-
*/
|
|
3469
|
-
set: function (responseType) {
|
|
3470
|
-
this.uploadService.async.responseType = responseType;
|
|
3471
|
-
},
|
|
3472
|
-
enumerable: true,
|
|
3473
|
-
configurable: true
|
|
3474
|
-
});
|
|
3475
|
-
Object.defineProperty(UploadComponent.prototype, "removeField", {
|
|
3476
|
-
get: function () { return this.uploadService.async.removeField; },
|
|
3477
|
-
/**
|
|
3478
|
-
* Sets the [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) key
|
|
3479
|
-
* which contains the list of file names that are submitted to `removeUrl`.
|
|
3480
|
-
* The default value is `fileNames`.
|
|
3481
|
-
*/
|
|
3482
|
-
set: function (removeField) { this.uploadService.async.removeField = removeField; },
|
|
3483
|
-
enumerable: true,
|
|
3484
|
-
configurable: true
|
|
3485
|
-
});
|
|
3486
|
-
Object.defineProperty(UploadComponent.prototype, "removeHeaders", {
|
|
3487
|
-
get: function () {
|
|
3488
|
-
return this.uploadService.async.removeHeaders;
|
|
3489
|
-
},
|
|
3490
|
-
/**
|
|
3491
|
-
* Configures the [`HttpHeaders`](https://angular.io/api/common/http/HttpHeaders)
|
|
3492
|
-
* that are attached to each `remove` request.
|
|
3493
|
-
*/
|
|
3494
|
-
set: function (removeHeaders) {
|
|
3495
|
-
this.uploadService.async.removeHeaders = removeHeaders;
|
|
3496
|
-
},
|
|
3497
|
-
enumerable: true,
|
|
3498
|
-
configurable: true
|
|
3499
|
-
});
|
|
3500
|
-
Object.defineProperty(UploadComponent.prototype, "removeMethod", {
|
|
3501
|
-
get: function () {
|
|
3502
|
-
return this.uploadService.async.removeMethod;
|
|
3503
|
-
},
|
|
3504
|
-
/**
|
|
3505
|
-
* Sets the [`RequestMethod`](https://angular.io/api/http/RequestMethod) of the `remove` request.
|
|
3506
|
-
* The default value is `POST`.
|
|
3507
|
-
*/
|
|
3508
|
-
set: function (removeMethod) {
|
|
3509
|
-
this.uploadService.async.removeMethod = removeMethod;
|
|
3510
|
-
},
|
|
3511
|
-
enumerable: true,
|
|
3512
|
-
configurable: true
|
|
3513
|
-
});
|
|
3514
|
-
Object.defineProperty(UploadComponent.prototype, "removeUrl", {
|
|
3515
|
-
get: function () {
|
|
3516
|
-
return this.uploadService.async.removeUrl;
|
|
3517
|
-
},
|
|
3518
|
-
/**
|
|
3519
|
-
* Sets the URL of the endpoint for the `remove` request.
|
|
3520
|
-
* The [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) request key is named after the `removeField` property.
|
|
3521
|
-
* It contains the list of file names which will be removed.
|
|
3522
|
-
*/
|
|
3523
|
-
set: function (removeUrl) {
|
|
3524
|
-
this.uploadService.async.removeUrl = removeUrl;
|
|
3525
|
-
},
|
|
3526
|
-
enumerable: true,
|
|
3527
|
-
configurable: true
|
|
3528
|
-
});
|
|
3529
|
-
Object.defineProperty(UploadComponent.prototype, "concurrent", {
|
|
3530
|
-
get: function () {
|
|
3531
|
-
return this.uploadService.async.concurrent;
|
|
3532
|
-
},
|
|
3533
|
-
/**
|
|
3534
|
-
* Specifies if the selected files are uploaded simultaneously or one by one.
|
|
3535
|
-
*
|
|
3536
|
-
* The default value is `true`.
|
|
3537
|
-
*/
|
|
3538
|
-
set: function (concurrent) {
|
|
3539
|
-
this.uploadService.async.concurrent = concurrent;
|
|
3540
|
-
},
|
|
3541
|
-
enumerable: true,
|
|
3542
|
-
configurable: true
|
|
3543
|
-
});
|
|
3544
|
-
Object.defineProperty(UploadComponent.prototype, "tabIndex", {
|
|
3545
|
-
get: function () {
|
|
3546
|
-
return this.tabindex;
|
|
3547
|
-
},
|
|
3548
|
-
/**
|
|
3549
|
-
* @hidden
|
|
3550
|
-
*/
|
|
3551
|
-
set: function (tabIndex) {
|
|
3552
|
-
this.tabindex = tabIndex;
|
|
3553
|
-
},
|
|
3554
|
-
enumerable: true,
|
|
3555
|
-
configurable: true
|
|
3556
|
-
});
|
|
3557
|
-
Object.defineProperty(UploadComponent.prototype, "restrictions", {
|
|
3558
|
-
get: function () {
|
|
3559
|
-
return this._restrictions;
|
|
3560
|
-
},
|
|
3561
|
-
/**
|
|
3562
|
-
* Sets the restrictions for selected files ([see example]({% slug api_upload_filerestrictions %})).
|
|
3563
|
-
*/
|
|
3564
|
-
set: function (restrictions) {
|
|
3565
|
-
var parsedRestrictions = Object.assign({}, this._restrictions, restrictions);
|
|
3566
|
-
this._restrictions = parsedRestrictions;
|
|
3567
|
-
},
|
|
3568
|
-
enumerable: true,
|
|
3569
|
-
configurable: true
|
|
3570
|
-
});
|
|
3571
|
-
Object.defineProperty(UploadComponent.prototype, "hostDisabledClass", {
|
|
3572
|
-
get: function () {
|
|
3573
|
-
return this.disabled;
|
|
3574
|
-
},
|
|
3575
|
-
enumerable: true,
|
|
3576
|
-
configurable: true
|
|
3577
|
-
});
|
|
3578
|
-
Object.defineProperty(UploadComponent.prototype, "dir", {
|
|
3579
|
-
get: function () {
|
|
3580
|
-
return this.direction;
|
|
3581
|
-
},
|
|
3582
|
-
enumerable: true,
|
|
3583
|
-
configurable: true
|
|
3584
|
-
});
|
|
3585
|
-
UploadComponent.prototype.ngOnInit = function () {
|
|
3586
|
-
this.verifySettings();
|
|
3587
|
-
this.renderer.removeAttribute(this.wrapper, "tabindex");
|
|
3588
|
-
this.uploadService.setChunkSettings(this.chunkable);
|
|
3589
|
-
if (this.zoneId) {
|
|
3590
|
-
this.dropZoneService.addComponent(this, this.zoneId);
|
|
3591
|
-
}
|
|
3592
|
-
};
|
|
3593
|
-
UploadComponent.prototype.ngOnChanges = function (changes) {
|
|
3594
|
-
if (isChanged("chunkable", changes)) {
|
|
3595
|
-
var newChunkable = changes.chunkable.currentValue;
|
|
3596
|
-
if (typeof newChunkable === 'boolean') {
|
|
3597
|
-
this.uploadService.async.chunk = newChunkable;
|
|
3598
|
-
}
|
|
3599
|
-
if (typeof newChunkable === "object" && newChunkable !== null) {
|
|
3600
|
-
this.uploadService.async.chunk = true;
|
|
3601
|
-
this.uploadService.chunk = Object.assign({}, this.uploadService.chunk, newChunkable);
|
|
3602
|
-
}
|
|
3603
|
-
}
|
|
3604
|
-
};
|
|
3605
|
-
UploadComponent.prototype.ngOnDestroy = function () {
|
|
3606
|
-
this.fileList.clear();
|
|
3607
|
-
if (this.blurSubscription) {
|
|
3608
|
-
this.blurSubscription.unsubscribe();
|
|
3609
|
-
}
|
|
3610
|
-
if (this.wrapperFocusSubscription) {
|
|
3611
|
-
this.wrapperFocusSubscription.unsubscribe();
|
|
3612
|
-
}
|
|
3613
|
-
if (this.selectButtonFocusSubscription) {
|
|
3614
|
-
this.selectButtonFocusSubscription.unsubscribe();
|
|
3615
|
-
}
|
|
3616
|
-
if (this.localizationChangeSubscription) {
|
|
3617
|
-
this.localizationChangeSubscription.unsubscribe();
|
|
3618
|
-
}
|
|
3619
|
-
if (this.subs) {
|
|
3620
|
-
this.subs.unsubscribe();
|
|
3621
|
-
}
|
|
3622
|
-
};
|
|
3623
|
-
/**
|
|
3624
|
-
* @hidden
|
|
3625
|
-
*/
|
|
3626
|
-
UploadComponent.prototype.handleKeydown = function (event) {
|
|
3627
|
-
if (this.disabled) {
|
|
3628
|
-
return;
|
|
3629
|
-
}
|
|
3630
|
-
if ((event.keyCode === Keys.Enter || event.keyCode === Keys.Space) &&
|
|
3631
|
-
event.target === this.fileSelectButton.nativeElement) {
|
|
3632
|
-
event.preventDefault();
|
|
3633
|
-
this.fileSelect.nativeElement.click();
|
|
3634
|
-
return;
|
|
3635
|
-
}
|
|
3636
|
-
if (hasClasses(event.target, UPLOAD_CLASSES) ||
|
|
3637
|
-
(!isFocusable(event.target) && !hasClasses(event.target, IGNORE_TARGET_CLASSES))) {
|
|
3638
|
-
this.navigation.process(event);
|
|
3639
|
-
}
|
|
3640
|
-
};
|
|
3641
|
-
/**
|
|
3642
|
-
* @hidden
|
|
3643
|
-
*/
|
|
3644
|
-
UploadComponent.prototype.writeValue = function (newValue) {
|
|
3645
|
-
var isValid = true;
|
|
3646
|
-
if (newValue instanceof Array) {
|
|
3647
|
-
newValue.forEach(function (file) {
|
|
3648
|
-
if (!validateInitialFileInfo(file)) {
|
|
3649
|
-
isValid = false;
|
|
3650
|
-
}
|
|
3651
|
-
});
|
|
3652
|
-
if (isValid) {
|
|
3653
|
-
this.uploadService.addInitialFiles(newValue);
|
|
3654
|
-
}
|
|
3655
|
-
}
|
|
3656
|
-
if (newValue === null) {
|
|
3657
|
-
this.fileList.clear();
|
|
3658
|
-
}
|
|
3659
|
-
this.cdr.markForCheck();
|
|
3660
|
-
};
|
|
3661
|
-
/**
|
|
3662
|
-
* @hidden
|
|
3663
|
-
*/
|
|
3664
|
-
UploadComponent.prototype.registerOnChange = function (fn) {
|
|
3665
|
-
this.onChangeCallback = fn;
|
|
3666
|
-
};
|
|
3667
|
-
/**
|
|
3668
|
-
* @hidden
|
|
3669
|
-
*/
|
|
3670
|
-
UploadComponent.prototype.registerOnTouched = function (fn) {
|
|
3671
|
-
this.onTouchedCallback = fn;
|
|
3672
|
-
};
|
|
3673
|
-
/**
|
|
3674
|
-
* @hidden
|
|
3675
|
-
*/
|
|
3676
|
-
UploadComponent.prototype.setDisabledState = function (isDisabled) {
|
|
3677
|
-
this.disabled = isDisabled;
|
|
3678
|
-
};
|
|
3679
|
-
Object.defineProperty(UploadComponent.prototype, "selectButtonTabIndex", {
|
|
3680
|
-
/**
|
|
3681
|
-
* @hidden
|
|
3682
|
-
*/
|
|
3683
|
-
get: function () {
|
|
3684
|
-
return this.disabled ? undefined : this.tabIndex;
|
|
3685
|
-
},
|
|
3686
|
-
enumerable: true,
|
|
3687
|
-
configurable: true
|
|
3688
|
-
});
|
|
3689
|
-
/**
|
|
3690
|
-
* @hidden
|
|
3691
|
-
*/
|
|
3692
|
-
UploadComponent.prototype.onFileSelectButtonFocus = function (_event) {
|
|
3693
|
-
this.renderer.addClass(this.fileSelectButton.nativeElement, 'k-focus');
|
|
3694
|
-
if (!this.navigation.focused) {
|
|
3695
|
-
this.navigation.focusedIndex = -1;
|
|
3696
|
-
}
|
|
3697
|
-
};
|
|
3698
|
-
/**
|
|
3699
|
-
* @hidden
|
|
3700
|
-
*/
|
|
3701
|
-
UploadComponent.prototype.onFileSelectButtonBlur = function (_event) {
|
|
3702
|
-
this.renderer.removeClass(this.fileSelectButton.nativeElement, 'k-focus');
|
|
3703
|
-
};
|
|
3704
|
-
Object.defineProperty(UploadComponent.prototype, "showActionButtons", {
|
|
3705
|
-
/**
|
|
3706
|
-
* @hidden
|
|
3707
|
-
*/
|
|
3708
|
-
get: function () {
|
|
3709
|
-
var areVisible = false;
|
|
3710
|
-
if (!this.autoUpload) {
|
|
3711
|
-
var hasFilesToUpload = this.fileList.filesToUpload.length > 0;
|
|
3712
|
-
var uploadingFiles = this.fileList.hasFileWithState([FileState.Uploading]);
|
|
3713
|
-
if (this.concurrent && hasFilesToUpload) {
|
|
3714
|
-
areVisible = true;
|
|
3715
|
-
}
|
|
3716
|
-
if (!this.concurrent && hasFilesToUpload && !uploadingFiles) {
|
|
3717
|
-
areVisible = true;
|
|
3718
|
-
}
|
|
3719
|
-
}
|
|
3720
|
-
this.navigation.actionButtonsVisible = areVisible;
|
|
3721
|
-
return areVisible;
|
|
3722
|
-
},
|
|
3723
|
-
enumerable: true,
|
|
3724
|
-
configurable: true
|
|
3725
|
-
});
|
|
3726
|
-
Object.defineProperty(UploadComponent.prototype, "showTotalStatus", {
|
|
3727
|
-
/**
|
|
3728
|
-
* @hidden
|
|
3729
|
-
*/
|
|
3730
|
-
get: function () {
|
|
3731
|
-
var states = [
|
|
3732
|
-
FileState.Uploaded,
|
|
3733
|
-
FileState.Uploading,
|
|
3734
|
-
FileState.Failed,
|
|
3735
|
-
FileState.Paused
|
|
3736
|
-
];
|
|
3737
|
-
if (this.fileList.hasFileWithState(states)) {
|
|
3738
|
-
return true;
|
|
3739
|
-
}
|
|
3740
|
-
return false;
|
|
3741
|
-
},
|
|
3742
|
-
enumerable: true,
|
|
3743
|
-
configurable: true
|
|
3744
|
-
});
|
|
3745
|
-
/**
|
|
3746
|
-
* @hidden
|
|
3747
|
-
*/
|
|
3748
|
-
UploadComponent.prototype.textFor = function (key) {
|
|
3749
|
-
return this.localization.get(key);
|
|
3750
|
-
};
|
|
3751
|
-
/**
|
|
3752
|
-
* Focuses the underlying input element.
|
|
3753
|
-
*/
|
|
3754
|
-
UploadComponent.prototype.focus = function () {
|
|
3755
|
-
var _this = this;
|
|
3756
|
-
setTimeout(function () {
|
|
3757
|
-
_this.fileSelectButton.nativeElement.focus();
|
|
3758
|
-
});
|
|
3759
|
-
};
|
|
3760
|
-
/**
|
|
3761
|
-
* @hidden
|
|
3762
|
-
* @deprecated
|
|
3763
|
-
*/
|
|
3764
|
-
UploadComponent.prototype.focusComponent = function () {
|
|
3765
|
-
this.focus();
|
|
3766
|
-
};
|
|
3767
|
-
/**
|
|
3768
|
-
* Blurs the Upload if it was previously focused.
|
|
3769
|
-
*/
|
|
3770
|
-
UploadComponent.prototype.blur = function () {
|
|
3771
|
-
if (this.navigation.focused) {
|
|
3772
|
-
this.navigation.focused = false;
|
|
3773
|
-
document.activeElement.blur();
|
|
3774
|
-
this.onBlur.emit();
|
|
3775
|
-
}
|
|
3776
|
-
};
|
|
3777
|
-
/**
|
|
3778
|
-
* @hidden
|
|
3779
|
-
* @deprecated
|
|
3780
|
-
*/
|
|
3781
|
-
UploadComponent.prototype.blurComponent = function () {
|
|
3782
|
-
this.blur();
|
|
3783
|
-
};
|
|
3784
|
-
/**
|
|
3785
|
-
* Pauses the upload process of a file that is currently uploading.
|
|
3786
|
-
* The `pauseFileByUid` method requires the `chunkable` option of the Upload to be enabled.
|
|
3787
|
-
*
|
|
3788
|
-
* @param uid - The `uid` of the file that will be paused.
|
|
3789
|
-
*/
|
|
3790
|
-
UploadComponent.prototype.pauseFileByUid = function (uid) {
|
|
3791
|
-
this.uploadService.pauseFile(uid);
|
|
3792
|
-
};
|
|
3793
|
-
/**
|
|
3794
|
-
* Resumes the upload process for a file that has been previously paused.
|
|
3795
|
-
* The `resumeFileByUid` method requires the `chunkable` option of the Upload to be enabled.
|
|
3796
|
-
*
|
|
3797
|
-
* @param uid - The `uid` of the file that will be resumed.
|
|
3798
|
-
*/
|
|
3799
|
-
UploadComponent.prototype.resumeFileByUid = function (uid) {
|
|
3800
|
-
this.uploadService.resumeFile(uid);
|
|
3801
|
-
};
|
|
3802
|
-
/**
|
|
3803
|
-
* Triggers the removal of a file or a batch of files.
|
|
3804
|
-
* @param uid - The `uid` of the file or a batch of files that will be removed.
|
|
3805
|
-
*/
|
|
3806
|
-
UploadComponent.prototype.removeFilesByUid = function (uid) {
|
|
3807
|
-
this.uploadService.removeFiles(uid);
|
|
3808
|
-
};
|
|
3809
|
-
/**
|
|
3810
|
-
* Triggers another upload attempt of an unsuccessfully uploaded file or a batch of files.
|
|
3811
|
-
* @param uid - The `uid` of the file or a batch of files to be retried.
|
|
3812
|
-
*/
|
|
3813
|
-
UploadComponent.prototype.retryUploadByUid = function (uid) {
|
|
3814
|
-
this.uploadService.retryFiles(uid);
|
|
3815
|
-
};
|
|
3816
|
-
/**
|
|
3817
|
-
* Cancels the upload of a file or a batch of files.
|
|
3818
|
-
* @param uid - The `uid` of the file or a batch of files that will be canceled.
|
|
3819
|
-
*/
|
|
3820
|
-
UploadComponent.prototype.cancelUploadByUid = function (uid) {
|
|
3821
|
-
this.uploadService.cancelFiles(uid);
|
|
3822
|
-
};
|
|
3823
|
-
/**
|
|
3824
|
-
* Uploads the currently selected files which pass the set restrictions.
|
|
3825
|
-
*/
|
|
3826
|
-
UploadComponent.prototype.uploadFiles = function () {
|
|
3827
|
-
if (this.fileList.filesToUpload.length) {
|
|
3828
|
-
this.uploadService.uploadFiles();
|
|
3829
|
-
}
|
|
3830
|
-
};
|
|
3831
|
-
/**
|
|
3832
|
-
* Visually clears all files from the UI without issuing requests to the remove handler.
|
|
3833
|
-
*/
|
|
3834
|
-
UploadComponent.prototype.clearFiles = function () {
|
|
3835
|
-
this.uploadService.clearFiles();
|
|
3836
|
-
};
|
|
3837
|
-
/**
|
|
3838
|
-
* @hidden
|
|
3839
|
-
* Used by the external dropzone to add files to the Upload
|
|
3840
|
-
*/
|
|
3841
|
-
UploadComponent.prototype.addFiles = function (files) {
|
|
3842
|
-
this.uploadService.addFiles(files);
|
|
3843
|
-
};
|
|
3844
|
-
/**
|
|
3845
|
-
* @hidden
|
|
3846
|
-
* Used to determine if the component is empty.
|
|
3847
|
-
*/
|
|
3848
|
-
UploadComponent.prototype.isEmpty = function () {
|
|
3849
|
-
return false;
|
|
3850
|
-
};
|
|
3851
|
-
UploadComponent.prototype.verifySettings = function () {
|
|
3852
|
-
if (isDevMode()) {
|
|
3853
|
-
if (this.batch && this.chunkable !== false) {
|
|
3854
|
-
throw new Error('The file chunking functionality requires the batch setting to be disabled.');
|
|
3855
|
-
}
|
|
3856
|
-
}
|
|
3857
|
-
};
|
|
3858
|
-
UploadComponent.prototype.subscribeBlur = function () {
|
|
3859
|
-
var _this = this;
|
|
3860
|
-
if (!isDocumentAvailable()) {
|
|
3861
|
-
return;
|
|
3862
|
-
}
|
|
3863
|
-
this._ngZone.runOutsideAngular(function () {
|
|
3864
|
-
_this.documentClick = fromEvent(document, 'click').pipe(filter(function (event) {
|
|
3865
|
-
return !(_this.wrapper !== event.target && _this.wrapper.contains(event.target));
|
|
3866
|
-
}));
|
|
3867
|
-
_this.blurSubscription = merge(_this.documentClick, _this.navigation.onTab).subscribe(function () {
|
|
3868
|
-
if (_this.navigation.focused) {
|
|
3869
|
-
_this._ngZone.run(function () {
|
|
3870
|
-
_this.navigation.focused = false;
|
|
3871
|
-
_this.onTouchedCallback();
|
|
3872
|
-
_this.onBlur.emit();
|
|
3873
|
-
});
|
|
3874
|
-
}
|
|
3875
|
-
});
|
|
3876
|
-
});
|
|
3877
|
-
};
|
|
3878
|
-
UploadComponent.prototype.subscribeFocus = function () {
|
|
3879
|
-
var _this = this;
|
|
3880
|
-
this.wrapperFocusSubscription = this.navigation.onWrapperFocus.subscribe(function () {
|
|
3881
|
-
_this.onFocus.emit();
|
|
3882
|
-
});
|
|
3883
|
-
this.selectButtonFocusSubscription = this.navigation.onSelectButtonFocus.subscribe(function () {
|
|
3884
|
-
_this.fileSelectButton.nativeElement.focus();
|
|
3885
|
-
});
|
|
3886
|
-
};
|
|
3887
|
-
UploadComponent.prototype.attachEventHandlers = function () {
|
|
3888
|
-
var _this = this;
|
|
3889
|
-
this.subs = this.uploadService.cancelEvent.subscribe(function (args) {
|
|
3890
|
-
_this.cancel.emit(args);
|
|
3891
|
-
});
|
|
3892
|
-
this.subs.add(this.uploadService.changeEvent.subscribe(function (files) {
|
|
3893
|
-
_this.onChangeCallback(files);
|
|
3894
|
-
_this.valueChange.emit(files);
|
|
3895
|
-
}));
|
|
3896
|
-
this.subs.add(this.uploadService.clearEvent.subscribe(function (args) {
|
|
3897
|
-
_this.clear.emit(args);
|
|
3898
|
-
}));
|
|
3899
|
-
this.subs.add(this.uploadService.completeEvent.subscribe(function () {
|
|
3900
|
-
_this.complete.emit();
|
|
3901
|
-
}));
|
|
3902
|
-
this.subs.add(this.uploadService.errorEvent.subscribe(function (args) {
|
|
3903
|
-
_this.error.emit(args);
|
|
3904
|
-
}));
|
|
3905
|
-
this.subs.add(this.uploadService.pauseEvent.subscribe(function (args) {
|
|
3906
|
-
_this.pause.emit(args);
|
|
3907
|
-
}));
|
|
3908
|
-
this.subs.add(this.uploadService.removeEvent.subscribe(function (args) {
|
|
3909
|
-
_this.remove.emit(args);
|
|
3910
|
-
}));
|
|
3911
|
-
this.subs.add(this.uploadService.resumeEvent.subscribe(function (args) {
|
|
3912
|
-
_this.resume.emit(args);
|
|
3913
|
-
}));
|
|
3914
|
-
this.subs.add(this.uploadService.selectEvent.subscribe(function (args) {
|
|
3915
|
-
_this.select.emit(args);
|
|
3916
|
-
}));
|
|
3917
|
-
this.subs.add(this.uploadService.successEvent.subscribe(function (args) {
|
|
3918
|
-
_this.success.emit(args);
|
|
3919
|
-
}));
|
|
3920
|
-
this.subs.add(this.uploadService.uploadEvent.subscribe(function (args) {
|
|
3921
|
-
_this.upload.emit(args);
|
|
3922
|
-
}));
|
|
3923
|
-
this.subs.add(this.uploadService.uploadProgressEvent.subscribe(function (args) {
|
|
3924
|
-
_this.uploadProgress.emit(args);
|
|
3925
|
-
}));
|
|
3926
|
-
};
|
|
3927
|
-
var UploadComponent_1;
|
|
3928
|
-
__decorate([
|
|
3929
|
-
Input(),
|
|
3930
|
-
__metadata("design:type", Boolean),
|
|
3931
|
-
__metadata("design:paramtypes", [Boolean])
|
|
3932
|
-
], UploadComponent.prototype, "autoUpload", null);
|
|
3933
|
-
__decorate([
|
|
3934
|
-
Input(),
|
|
3935
|
-
__metadata("design:type", Boolean),
|
|
3936
|
-
__metadata("design:paramtypes", [Boolean])
|
|
3937
|
-
], UploadComponent.prototype, "batch", null);
|
|
3938
|
-
__decorate([
|
|
3939
|
-
Input(),
|
|
3940
|
-
__metadata("design:type", Boolean),
|
|
3941
|
-
__metadata("design:paramtypes", [Boolean])
|
|
3942
|
-
], UploadComponent.prototype, "withCredentials", null);
|
|
3943
|
-
__decorate([
|
|
3944
|
-
Input(),
|
|
3945
|
-
__metadata("design:type", String),
|
|
3946
|
-
__metadata("design:paramtypes", [String])
|
|
3947
|
-
], UploadComponent.prototype, "saveField", null);
|
|
3948
|
-
__decorate([
|
|
3949
|
-
Input(),
|
|
3950
|
-
__metadata("design:type", HttpHeaders),
|
|
3951
|
-
__metadata("design:paramtypes", [HttpHeaders])
|
|
3952
|
-
], UploadComponent.prototype, "saveHeaders", null);
|
|
3953
|
-
__decorate([
|
|
3954
|
-
Input(),
|
|
3955
|
-
__metadata("design:type", String),
|
|
3956
|
-
__metadata("design:paramtypes", [String])
|
|
3957
|
-
], UploadComponent.prototype, "saveMethod", null);
|
|
3958
|
-
__decorate([
|
|
3959
|
-
Input(),
|
|
3960
|
-
__metadata("design:type", String),
|
|
3961
|
-
__metadata("design:paramtypes", [String])
|
|
3962
|
-
], UploadComponent.prototype, "saveUrl", null);
|
|
3963
|
-
__decorate([
|
|
3964
|
-
Input(),
|
|
3965
|
-
__metadata("design:type", String),
|
|
3966
|
-
__metadata("design:paramtypes", [String])
|
|
3967
|
-
], UploadComponent.prototype, "responseType", null);
|
|
3968
|
-
__decorate([
|
|
3969
|
-
Input(),
|
|
3970
|
-
__metadata("design:type", String),
|
|
3971
|
-
__metadata("design:paramtypes", [String])
|
|
3972
|
-
], UploadComponent.prototype, "removeField", null);
|
|
3973
|
-
__decorate([
|
|
3974
|
-
Input(),
|
|
3975
|
-
__metadata("design:type", HttpHeaders),
|
|
3976
|
-
__metadata("design:paramtypes", [HttpHeaders])
|
|
3977
|
-
], UploadComponent.prototype, "removeHeaders", null);
|
|
3978
|
-
__decorate([
|
|
3979
|
-
Input(),
|
|
3980
|
-
__metadata("design:type", String),
|
|
3981
|
-
__metadata("design:paramtypes", [String])
|
|
3982
|
-
], UploadComponent.prototype, "removeMethod", null);
|
|
3983
|
-
__decorate([
|
|
3984
|
-
Input(),
|
|
3985
|
-
__metadata("design:type", String),
|
|
3986
|
-
__metadata("design:paramtypes", [String])
|
|
3987
|
-
], UploadComponent.prototype, "removeUrl", null);
|
|
3988
|
-
__decorate([
|
|
3989
|
-
Input(),
|
|
3990
|
-
__metadata("design:type", Object)
|
|
3991
|
-
], UploadComponent.prototype, "chunkable", void 0);
|
|
3992
|
-
__decorate([
|
|
3993
|
-
Input(),
|
|
3994
|
-
__metadata("design:type", Boolean),
|
|
3995
|
-
__metadata("design:paramtypes", [Boolean])
|
|
3996
|
-
], UploadComponent.prototype, "concurrent", null);
|
|
3997
|
-
__decorate([
|
|
3998
|
-
Input(),
|
|
3999
|
-
__metadata("design:type", Boolean)
|
|
4000
|
-
], UploadComponent.prototype, "multiple", void 0);
|
|
4001
|
-
__decorate([
|
|
4002
|
-
Input(),
|
|
4003
|
-
__metadata("design:type", Boolean)
|
|
4004
|
-
], UploadComponent.prototype, "disabled", void 0);
|
|
4005
|
-
__decorate([
|
|
4006
|
-
Input(),
|
|
4007
|
-
__metadata("design:type", Boolean)
|
|
4008
|
-
], UploadComponent.prototype, "showFileList", void 0);
|
|
4009
|
-
__decorate([
|
|
4010
|
-
Input(),
|
|
4011
|
-
__metadata("design:type", Number)
|
|
4012
|
-
], UploadComponent.prototype, "tabindex", void 0);
|
|
4013
|
-
__decorate([
|
|
4014
|
-
Input(),
|
|
4015
|
-
__metadata("design:type", String)
|
|
4016
|
-
], UploadComponent.prototype, "zoneId", void 0);
|
|
4017
|
-
__decorate([
|
|
4018
|
-
Input('tabIndex'),
|
|
4019
|
-
__metadata("design:type", Number),
|
|
4020
|
-
__metadata("design:paramtypes", [Number])
|
|
4021
|
-
], UploadComponent.prototype, "tabIndex", null);
|
|
4022
|
-
__decorate([
|
|
4023
|
-
Input(),
|
|
4024
|
-
__metadata("design:type", String)
|
|
4025
|
-
], UploadComponent.prototype, "accept", void 0);
|
|
4026
|
-
__decorate([
|
|
4027
|
-
Input(),
|
|
4028
|
-
__metadata("design:type", Object),
|
|
4029
|
-
__metadata("design:paramtypes", [Object])
|
|
4030
|
-
], UploadComponent.prototype, "restrictions", null);
|
|
4031
|
-
__decorate([
|
|
4032
|
-
Input(),
|
|
4033
|
-
__metadata("design:type", String)
|
|
4034
|
-
], UploadComponent.prototype, "focusableId", void 0);
|
|
4035
|
-
__decorate([
|
|
4036
|
-
Input(),
|
|
4037
|
-
__metadata("design:type", String)
|
|
4038
|
-
], UploadComponent.prototype, "actionsLayout", void 0);
|
|
4039
|
-
__decorate([
|
|
4040
|
-
ContentChild(FileTemplateDirective, { static: false }),
|
|
4041
|
-
__metadata("design:type", FileTemplateDirective)
|
|
4042
|
-
], UploadComponent.prototype, "fileTemplate", void 0);
|
|
4043
|
-
__decorate([
|
|
4044
|
-
ContentChild(FileInfoTemplateDirective, { static: false }),
|
|
4045
|
-
__metadata("design:type", FileInfoTemplateDirective)
|
|
4046
|
-
], UploadComponent.prototype, "fileInfoTemplate", void 0);
|
|
4047
|
-
__decorate([
|
|
4048
|
-
ViewChild('fileSelect', { static: true }),
|
|
4049
|
-
__metadata("design:type", ElementRef)
|
|
4050
|
-
], UploadComponent.prototype, "fileSelect", void 0);
|
|
4051
|
-
__decorate([
|
|
4052
|
-
ViewChild('fileSelectButton', { static: true }),
|
|
4053
|
-
__metadata("design:type", ElementRef)
|
|
4054
|
-
], UploadComponent.prototype, "fileSelectButton", void 0);
|
|
4055
|
-
__decorate([
|
|
4056
|
-
Output('blur'),
|
|
4057
|
-
__metadata("design:type", EventEmitter)
|
|
4058
|
-
], UploadComponent.prototype, "onBlur", void 0);
|
|
4059
|
-
__decorate([
|
|
4060
|
-
Output(),
|
|
4061
|
-
__metadata("design:type", EventEmitter)
|
|
4062
|
-
], UploadComponent.prototype, "cancel", void 0);
|
|
4063
|
-
__decorate([
|
|
4064
|
-
Output(),
|
|
4065
|
-
__metadata("design:type", EventEmitter)
|
|
4066
|
-
], UploadComponent.prototype, "clear", void 0);
|
|
4067
|
-
__decorate([
|
|
4068
|
-
Output(),
|
|
4069
|
-
__metadata("design:type", EventEmitter)
|
|
4070
|
-
], UploadComponent.prototype, "complete", void 0);
|
|
4071
|
-
__decorate([
|
|
4072
|
-
Output(),
|
|
4073
|
-
__metadata("design:type", EventEmitter)
|
|
4074
|
-
], UploadComponent.prototype, "error", void 0);
|
|
4075
|
-
__decorate([
|
|
4076
|
-
Output('focus'),
|
|
4077
|
-
__metadata("design:type", EventEmitter)
|
|
4078
|
-
], UploadComponent.prototype, "onFocus", void 0);
|
|
4079
|
-
__decorate([
|
|
4080
|
-
Output(),
|
|
4081
|
-
__metadata("design:type", EventEmitter)
|
|
4082
|
-
], UploadComponent.prototype, "pause", void 0);
|
|
4083
|
-
__decorate([
|
|
4084
|
-
Output(),
|
|
4085
|
-
__metadata("design:type", EventEmitter)
|
|
4086
|
-
], UploadComponent.prototype, "remove", void 0);
|
|
4087
|
-
__decorate([
|
|
4088
|
-
Output(),
|
|
4089
|
-
__metadata("design:type", EventEmitter)
|
|
4090
|
-
], UploadComponent.prototype, "resume", void 0);
|
|
4091
|
-
__decorate([
|
|
4092
|
-
Output(),
|
|
4093
|
-
__metadata("design:type", EventEmitter)
|
|
4094
|
-
], UploadComponent.prototype, "select", void 0);
|
|
4095
|
-
__decorate([
|
|
4096
|
-
Output(),
|
|
4097
|
-
__metadata("design:type", EventEmitter)
|
|
4098
|
-
], UploadComponent.prototype, "success", void 0);
|
|
4099
|
-
__decorate([
|
|
4100
|
-
Output(),
|
|
4101
|
-
__metadata("design:type", EventEmitter)
|
|
4102
|
-
], UploadComponent.prototype, "upload", void 0);
|
|
4103
|
-
__decorate([
|
|
4104
|
-
Output(),
|
|
4105
|
-
__metadata("design:type", EventEmitter)
|
|
4106
|
-
], UploadComponent.prototype, "uploadProgress", void 0);
|
|
4107
|
-
__decorate([
|
|
4108
|
-
Output(),
|
|
4109
|
-
__metadata("design:type", EventEmitter)
|
|
4110
|
-
], UploadComponent.prototype, "valueChange", void 0);
|
|
4111
|
-
__decorate([
|
|
4112
|
-
HostBinding('class.k-widget'),
|
|
4113
|
-
HostBinding('class.k-upload'),
|
|
4114
|
-
__metadata("design:type", Boolean)
|
|
4115
|
-
], UploadComponent.prototype, "hostDefaultClasses", void 0);
|
|
4116
|
-
__decorate([
|
|
4117
|
-
HostBinding('class.k-disabled'),
|
|
4118
|
-
__metadata("design:type", Boolean),
|
|
4119
|
-
__metadata("design:paramtypes", [])
|
|
4120
|
-
], UploadComponent.prototype, "hostDisabledClass", null);
|
|
4121
|
-
__decorate([
|
|
4122
|
-
HostBinding('attr.dir'),
|
|
4123
|
-
__metadata("design:type", String),
|
|
4124
|
-
__metadata("design:paramtypes", [])
|
|
4125
|
-
], UploadComponent.prototype, "dir", null);
|
|
4126
|
-
__decorate([
|
|
4127
|
-
HostListener('keydown', ['$event']),
|
|
4128
|
-
__metadata("design:type", Function),
|
|
4129
|
-
__metadata("design:paramtypes", [Object]),
|
|
4130
|
-
__metadata("design:returntype", void 0)
|
|
4131
|
-
], UploadComponent.prototype, "handleKeydown", null);
|
|
4132
|
-
UploadComponent = UploadComponent_1 = __decorate([
|
|
4133
|
-
Component({
|
|
4134
|
-
exportAs: 'kendoUpload',
|
|
4135
|
-
providers: [
|
|
4136
|
-
LocalizationService,
|
|
4137
|
-
NavigationService,
|
|
4138
|
-
UploadService,
|
|
4139
|
-
DropZoneService,
|
|
4140
|
-
UPLOAD_VALUE_ACCESSOR,
|
|
4141
|
-
{
|
|
4142
|
-
provide: L10N_PREFIX,
|
|
4143
|
-
useValue: 'kendo.upload'
|
|
4144
|
-
},
|
|
4145
|
-
{
|
|
4146
|
-
provide: KendoInput,
|
|
4147
|
-
useExisting: forwardRef(function () { return UploadComponent_1; })
|
|
4148
|
-
}
|
|
4149
|
-
],
|
|
4150
|
-
selector: 'kendo-upload',
|
|
4151
|
-
template: "\n <ng-container kendoUploadLocalizedMessages\n i18n-cancel=\"kendo.upload.cancel|The text for the Cancel button\"\n cancel=\"Cancel\"\n\n i18n-clearSelectedFiles=\"kendo.upload.clearSelectedFiles|The text for the Clear button\"\n clearSelectedFiles=\"Clear\"\n\n i18n-dropFilesHere=\"kendo.upload.dropFilesHere|The drop zone hint\"\n dropFilesHere=\"Drop files here to upload\"\n\n i18n-filesBatchStatus=\"kendo.upload.filesBatchStatus|The status message for a batch of files\"\n filesBatchStatus=\"files\"\n\n i18n-filesBatchStatusFailed=\"kendo.upload.filesBatchStatusFailed|The status message for a batch of files after failed upload\"\n filesBatchStatusFailed=\"files failed to upload.\"\n\n i18n-filesBatchStatusUploaded=\"kendo.upload.filesBatchStatusUploaded|The status message for a batch of files after successful upload\"\n filesBatchStatusUploaded=\"files successfully uploaded.\"\n\n i18n-fileStatusFailed=\"kendo.upload.fileStatusFailed|The file status message after failed upload\"\n fileStatusFailed=\"File failed to upload.\"\n\n i18n-fileStatusUploaded=\"kendo.upload.fileStatusUploaded|The file status message after successful upload\"\n fileStatusUploaded=\"File successfully uploaded.\"\n\n i18n-headerStatusPaused=\"kendo.upload.headerStatusPaused|The header status message when the file upload is paused\"\n headerStatusPaused=\"Paused\"\n\n i18n-headerStatusUploaded=\"kendo.upload.headerStatusUploaded|The header status message after file upload completion\"\n headerStatusUploaded=\"Done\"\n\n i18n-headerStatusUploading=\"kendo.upload.headerStatusUploading|The header status message during file upload\"\n headerStatusUploading=\"Uploading...\"\n\n i18n-invalidFileExtension=\"kendo.upload.invalidFileExtension|The text for the invalid allowed extensions restriction message\"\n invalidFileExtension=\"File type not allowed.\"\n\n i18n-invalidMaxFileSize=\"kendo.upload.invalidMaxFileSize|The text for the invalid max file size restriction message\"\n invalidMaxFileSize=\"File size too large.\"\n\n i18n-invalidMinFileSize=\"kendo.upload.invalidMinFileSize|The text for the invalid min file size restriction message\"\n invalidMinFileSize=\"File size too small.\"\n\n i18n-pause=\"kendo.upload.pause|The text for the Pause button\"\n pause=\"Pause\"\n\n i18n-remove=\"kendo.upload.remove|The text for the Remove button\"\n remove=\"Remove\"\n\n i18n-resume=\"kendo.upload.resume|The text for the Resume button\"\n resume=\"Resume\"\n\n i18n-retry=\"kendo.upload.retry|The text for the Retry button\"\n retry=\"Retry\"\n\n i18n-select=\"kendo.upload.select|The text for the Select button\"\n select=\"Select files...\"\n\n i18n-uploadSelectedFiles=\"kendo.upload.uploadSelectedFiles|The text for the Upload files button\"\n uploadSelectedFiles=\"Upload\"\n >\n </ng-container>\n <div kendoUploadInternalDropZone\n [restrictions]=\"restrictions\"\n [multiple]=\"multiple\"\n [disabled]=\"disabled\">\n <div role=\"button\" #fileSelectButton\n [id]=\"focusableId\"\n [attr.aria-label]=\"textFor('select')\"\n [attr.tabindex]=\"selectButtonTabIndex\"\n (focus)=\"onFileSelectButtonFocus($event)\"\n (blur)=\"onFileSelectButtonBlur($event)\"\n class=\"k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-upload-button\">\n <input #fileSelect kendoFileSelect\n [attr.accept]=\"accept ? accept : null\"\n [attr.aria-hidden]=\"true\"\n [dir]=\"direction\"\n [restrictions]=\"restrictions\"\n [multiple]=\"multiple\"\n [disabled]=\"disabled\" />\n <span>{{textFor('select')}}</span>\n </div>\n <kendo-upload-status-total *ngIf=\"showTotalStatus\"\n class=\"k-upload-status k-upload-status-total\"\n [fileList]=\"fileList\">\n </kendo-upload-status-total>\n <div class=\"k-dropzone-hint\">{{textFor('dropFilesHere')}}</div>\n </div>\n <ul kendo-upload-file-list *ngIf=\"showFileList && fileList.count > 0\"\n class=\"k-upload-files k-reset\"\n [disabled]=\"disabled\"\n [fileList]=\"fileList.files\"\n [fileTemplate]=\"fileTemplate\"\n [fileInfoTemplate]=\"fileInfoTemplate\">\n </ul>\n <kendo-upload-action-buttons\n *ngIf=\"showActionButtons\"\n [disabled]=\"disabled\"\n [actionsLayout]=\"actionsLayout\">\n </kendo-upload-action-buttons>\n "
|
|
4152
|
-
}),
|
|
4153
|
-
__metadata("design:paramtypes", [UploadService,
|
|
4154
|
-
LocalizationService,
|
|
4155
|
-
NavigationService,
|
|
4156
|
-
DropZoneService,
|
|
4157
|
-
NgZone,
|
|
4158
|
-
Renderer2,
|
|
4159
|
-
ChangeDetectorRef,
|
|
4160
|
-
ElementRef])
|
|
4161
|
-
], UploadComponent);
|
|
4162
|
-
return UploadComponent;
|
|
4163
|
-
}());
|
|
4164
|
-
|
|
4165
|
-
var UploadDropZoneDirective = /** @class */ (function () {
|
|
4166
|
-
function UploadDropZoneDirective(dropZoneService) {
|
|
4167
|
-
this.dropZoneService = dropZoneService;
|
|
4168
|
-
}
|
|
4169
|
-
/**
|
|
4170
|
-
* @hidden
|
|
4171
|
-
*/
|
|
4172
|
-
UploadDropZoneDirective.prototype.onElementDragEnter = function () {
|
|
4173
|
-
return false;
|
|
4174
|
-
};
|
|
4175
|
-
/**
|
|
4176
|
-
* @hidden
|
|
4177
|
-
*/
|
|
4178
|
-
UploadDropZoneDirective.prototype.onElementDragOver = function () {
|
|
4179
|
-
return false;
|
|
4180
|
-
};
|
|
4181
|
-
/**
|
|
4182
|
-
* @hidden
|
|
4183
|
-
*/
|
|
4184
|
-
UploadDropZoneDirective.prototype.onDropListener = function (event) {
|
|
4185
|
-
var components = this.componentInstance;
|
|
4186
|
-
if (!isPresent(components)) {
|
|
4187
|
-
return;
|
|
4188
|
-
}
|
|
4189
|
-
components.forEach(function (component) {
|
|
4190
|
-
var droppedFiles = event.dataTransfer.files;
|
|
4191
|
-
if (droppedFiles.length > 0 && !component.disabled) {
|
|
4192
|
-
var files = getAllFileInfo(droppedFiles);
|
|
4193
|
-
if (component instanceof UploadComponent) {
|
|
4194
|
-
files = assignGuidToFiles(files, !component.batch);
|
|
4195
|
-
}
|
|
4196
|
-
else {
|
|
4197
|
-
files = assignGuidToFiles(files, true);
|
|
4198
|
-
}
|
|
4199
|
-
if (!component.multiple) {
|
|
4200
|
-
files.splice(1, files.length - 1);
|
|
4201
|
-
component.clearFiles();
|
|
4202
|
-
}
|
|
4203
|
-
validateFiles(files, component.restrictions);
|
|
4204
|
-
component.addFiles(files);
|
|
4205
|
-
}
|
|
4206
|
-
});
|
|
4207
|
-
return false;
|
|
4208
|
-
};
|
|
4209
|
-
Object.defineProperty(UploadDropZoneDirective.prototype, "componentInstance", {
|
|
4210
|
-
/**
|
|
4211
|
-
* @hidden
|
|
4212
|
-
*/
|
|
4213
|
-
get: function () {
|
|
4214
|
-
return this.dropZoneService.getComponents(this.zoneId);
|
|
4215
|
-
},
|
|
4216
|
-
enumerable: true,
|
|
4217
|
-
configurable: true
|
|
4218
|
-
});
|
|
4219
|
-
__decorate([
|
|
4220
|
-
Input('kendoUploadDropZone'),
|
|
4221
|
-
__metadata("design:type", String)
|
|
4222
|
-
], UploadDropZoneDirective.prototype, "zoneId", void 0);
|
|
4223
|
-
__decorate([
|
|
4224
|
-
HostListener('dragenter'),
|
|
4225
|
-
__metadata("design:type", Function),
|
|
4226
|
-
__metadata("design:paramtypes", []),
|
|
4227
|
-
__metadata("design:returntype", Boolean)
|
|
4228
|
-
], UploadDropZoneDirective.prototype, "onElementDragEnter", null);
|
|
4229
|
-
__decorate([
|
|
4230
|
-
HostListener('dragover'),
|
|
4231
|
-
__metadata("design:type", Function),
|
|
4232
|
-
__metadata("design:paramtypes", []),
|
|
4233
|
-
__metadata("design:returntype", Boolean)
|
|
4234
|
-
], UploadDropZoneDirective.prototype, "onElementDragOver", null);
|
|
4235
|
-
__decorate([
|
|
4236
|
-
HostListener('drop', ['$event']),
|
|
4237
|
-
__metadata("design:type", Function),
|
|
4238
|
-
__metadata("design:paramtypes", [Object]),
|
|
4239
|
-
__metadata("design:returntype", Boolean)
|
|
4240
|
-
], UploadDropZoneDirective.prototype, "onDropListener", null);
|
|
4241
|
-
UploadDropZoneDirective = __decorate([
|
|
4242
|
-
Directive({
|
|
4243
|
-
providers: [
|
|
4244
|
-
DropZoneService
|
|
4245
|
-
],
|
|
4246
|
-
selector: '[kendoUploadDropZone], [kendoFileSelectDropZone]'
|
|
4247
|
-
}),
|
|
4248
|
-
__metadata("design:paramtypes", [DropZoneService])
|
|
4249
|
-
], UploadDropZoneDirective);
|
|
4250
|
-
return UploadDropZoneDirective;
|
|
4251
|
-
}());
|
|
4252
|
-
|
|
4253
|
-
/* tslint:disable: no-use-before-declare */
|
|
4254
|
-
/**
|
|
4255
|
-
* Represents the [Kendo UI UploadDropZone component for Angular]({% slug overview_upload %}).
|
|
4256
|
-
*/
|
|
4257
|
-
var UploadDropZoneComponent = /** @class */ (function (_super) {
|
|
4258
|
-
__extends(UploadDropZoneComponent, _super);
|
|
4259
|
-
function UploadDropZoneComponent(element, renderer, localization) {
|
|
4260
|
-
var _this = _super.call(this, element, renderer, 'k-external-dropzone-hover') || this;
|
|
4261
|
-
_this.localization = localization;
|
|
4262
|
-
_this.hostClass = true;
|
|
4263
|
-
_this.localizationChangeSubscription = _this.localization.changes.subscribe(function (_a) {
|
|
4264
|
-
var rtl = _a.rtl;
|
|
4265
|
-
_this.direction = rtl ? 'rtl' : 'ltr';
|
|
4266
|
-
});
|
|
4267
|
-
return _this;
|
|
4268
|
-
}
|
|
4269
|
-
Object.defineProperty(UploadDropZoneComponent.prototype, "dirAttribute", {
|
|
4270
|
-
get: function () {
|
|
4271
|
-
return this.direction;
|
|
4272
|
-
},
|
|
4273
|
-
enumerable: true,
|
|
4274
|
-
configurable: true
|
|
4275
|
-
});
|
|
4276
|
-
/**
|
|
4277
|
-
* @hidden
|
|
4278
|
-
*/
|
|
4279
|
-
UploadDropZoneComponent.prototype.textFor = function (key) {
|
|
4280
|
-
return this.localization.get(key);
|
|
4281
|
-
};
|
|
4282
|
-
Object.defineProperty(UploadDropZoneComponent.prototype, "iconClasses", {
|
|
4283
|
-
/**
|
|
4284
|
-
* @hidden
|
|
4285
|
-
*/
|
|
4286
|
-
get: function () {
|
|
4287
|
-
if (this.icon) {
|
|
4288
|
-
return "k-icon k-i-" + this.icon;
|
|
4289
|
-
}
|
|
4290
|
-
if (this.iconClass) {
|
|
4291
|
-
return "" + this.iconClass;
|
|
4292
|
-
}
|
|
4293
|
-
return 'k-icon k-i-upload';
|
|
4294
|
-
},
|
|
4295
|
-
enumerable: true,
|
|
4296
|
-
configurable: true
|
|
4297
|
-
});
|
|
4298
|
-
UploadDropZoneComponent.prototype.ngOnDestroy = function () {
|
|
4299
|
-
if (this.localizationChangeSubscription) {
|
|
4300
|
-
this.localizationChangeSubscription.unsubscribe();
|
|
4301
|
-
}
|
|
4302
|
-
};
|
|
4303
|
-
__decorate([
|
|
4304
|
-
HostBinding('class.k-external-dropzone'),
|
|
4305
|
-
__metadata("design:type", Boolean)
|
|
4306
|
-
], UploadDropZoneComponent.prototype, "hostClass", void 0);
|
|
4307
|
-
__decorate([
|
|
4308
|
-
HostBinding('attr.dir'),
|
|
4309
|
-
__metadata("design:type", String),
|
|
4310
|
-
__metadata("design:paramtypes", [])
|
|
4311
|
-
], UploadDropZoneComponent.prototype, "dirAttribute", null);
|
|
4312
|
-
__decorate([
|
|
4313
|
-
Input(),
|
|
4314
|
-
__metadata("design:type", String)
|
|
4315
|
-
], UploadDropZoneComponent.prototype, "zoneId", void 0);
|
|
4316
|
-
__decorate([
|
|
4317
|
-
Input(),
|
|
4318
|
-
__metadata("design:type", String)
|
|
4319
|
-
], UploadDropZoneComponent.prototype, "icon", void 0);
|
|
4320
|
-
__decorate([
|
|
4321
|
-
Input(),
|
|
4322
|
-
__metadata("design:type", String)
|
|
4323
|
-
], UploadDropZoneComponent.prototype, "iconClass", void 0);
|
|
4324
|
-
UploadDropZoneComponent = __decorate([
|
|
4325
|
-
Component({
|
|
4326
|
-
exportAs: 'kendoUploadDropZone',
|
|
4327
|
-
providers: [
|
|
4328
|
-
LocalizationService,
|
|
4329
|
-
{
|
|
4330
|
-
provide: L10N_PREFIX,
|
|
4331
|
-
useValue: 'kendo.uploaddropzone'
|
|
4332
|
-
}
|
|
4333
|
-
],
|
|
4334
|
-
selector: 'kendo-uploaddropzone',
|
|
4335
|
-
template: "\n <ng-container kendoUploadDropZoneLocalizedMessages\n i18n-externalDropFilesHere='kendo.uploaddropzone.externalDropFilesHere|Sets the external drop-zone hint'\n externalDropFilesHere='Drag and drop files here to upload'\n >\n </ng-container>\n <div class='k-dropzone-inner' [kendoUploadDropZone]=\"zoneId\">\n <span [ngClass]=\"iconClasses\"></span>\n <span class=\"k-dropzone-hint\">{{ textFor('externalDropFilesHere') }}</span>\n <span class=\"k-dropzone-note\">\n <ng-content></ng-content>\n </span>\n </div>\n "
|
|
4336
|
-
}),
|
|
4337
|
-
__metadata("design:paramtypes", [ElementRef,
|
|
4338
|
-
Renderer2,
|
|
4339
|
-
LocalizationService])
|
|
4340
|
-
], UploadDropZoneComponent);
|
|
4341
|
-
return UploadDropZoneComponent;
|
|
4342
|
-
}(DropZoneBase));
|
|
4343
|
-
|
|
4344
|
-
/**
|
|
4345
|
-
* @hidden
|
|
4346
|
-
*/
|
|
4347
|
-
var SHARED_DECLARATIONS = [
|
|
4348
|
-
DropZoneInternalDirective,
|
|
4349
|
-
FileListComponent,
|
|
4350
|
-
FileListItemDirective,
|
|
4351
|
-
FileListItemActionButtonComponent,
|
|
4352
|
-
FileListMultipleItemsComponent,
|
|
4353
|
-
FileListSingleItemComponent,
|
|
4354
|
-
FileSelectDirective,
|
|
4355
|
-
LocalizedMessagesDirective,
|
|
4356
|
-
TemplateContextDirective
|
|
4357
|
-
];
|
|
4358
|
-
/**
|
|
4359
|
-
* @hidden
|
|
4360
|
-
*/
|
|
4361
|
-
var PUBLIC_DIRECTIVES = [
|
|
4362
|
-
FileTemplateDirective,
|
|
4363
|
-
FileInfoTemplateDirective,
|
|
4364
|
-
CustomMessagesComponent,
|
|
4365
|
-
UploadDropZoneDirective,
|
|
4366
|
-
UploadDropZoneComponent
|
|
4367
|
-
];
|
|
4368
|
-
/**
|
|
4369
|
-
* @hidden
|
|
4370
|
-
*/
|
|
4371
|
-
var SharedModule = /** @class */ (function () {
|
|
4372
|
-
function SharedModule() {
|
|
4373
|
-
}
|
|
4374
|
-
SharedModule = __decorate([
|
|
4375
|
-
NgModule({
|
|
4376
|
-
declarations: [
|
|
4377
|
-
PUBLIC_DIRECTIVES,
|
|
4378
|
-
SHARED_DECLARATIONS
|
|
4379
|
-
],
|
|
4380
|
-
exports: [
|
|
4381
|
-
PUBLIC_DIRECTIVES,
|
|
4382
|
-
SHARED_DECLARATIONS,
|
|
4383
|
-
CommonModule
|
|
4384
|
-
],
|
|
4385
|
-
imports: [CommonModule]
|
|
4386
|
-
})
|
|
4387
|
-
], SharedModule);
|
|
4388
|
-
return SharedModule;
|
|
4389
|
-
}());
|
|
4390
|
-
|
|
4391
|
-
var FILESELECT_DECLARATIONS = [
|
|
4392
|
-
FileSelectComponent
|
|
4393
|
-
];
|
|
4394
|
-
/**
|
|
4395
|
-
* Represents the [NgModule](https://angular.io/api/core/NgModule) definition for the FileSelect component.
|
|
4396
|
-
*/
|
|
4397
|
-
var FileSelectModule = /** @class */ (function () {
|
|
4398
|
-
function FileSelectModule() {
|
|
4399
|
-
}
|
|
4400
|
-
FileSelectModule = __decorate([
|
|
4401
|
-
NgModule({
|
|
4402
|
-
declarations: [FILESELECT_DECLARATIONS],
|
|
4403
|
-
exports: [
|
|
4404
|
-
PUBLIC_DIRECTIVES,
|
|
4405
|
-
FILESELECT_DECLARATIONS
|
|
4406
|
-
],
|
|
4407
|
-
imports: [SharedModule]
|
|
4408
|
-
})
|
|
4409
|
-
], FileSelectModule);
|
|
4410
|
-
return FileSelectModule;
|
|
4411
|
-
}());
|
|
4412
|
-
|
|
4413
|
-
/**
|
|
4414
|
-
* @hidden
|
|
4415
|
-
*/
|
|
4416
|
-
var UploadActionButtonsComponent = /** @class */ (function () {
|
|
4417
|
-
function UploadActionButtonsComponent(uploadService, localization, navigation) {
|
|
4418
|
-
this.uploadService = uploadService;
|
|
4419
|
-
this.localization = localization;
|
|
4420
|
-
this.navigation = navigation;
|
|
4421
|
-
this.hostDefaultClass = true;
|
|
4422
|
-
this.onAction();
|
|
4423
|
-
this.onFocus();
|
|
4424
|
-
}
|
|
4425
|
-
Object.defineProperty(UploadActionButtonsComponent.prototype, "actionButtonsEndClassName", {
|
|
4426
|
-
get: function () {
|
|
4427
|
-
return this.actionsLayout === 'end';
|
|
4428
|
-
},
|
|
4429
|
-
enumerable: true,
|
|
4430
|
-
configurable: true
|
|
4431
|
-
});
|
|
4432
|
-
Object.defineProperty(UploadActionButtonsComponent.prototype, "actionButtonsStretchedClassName", {
|
|
4433
|
-
get: function () {
|
|
4434
|
-
return this.actionsLayout === 'stretched';
|
|
4435
|
-
},
|
|
4436
|
-
enumerable: true,
|
|
4437
|
-
configurable: true
|
|
4438
|
-
});
|
|
4439
|
-
Object.defineProperty(UploadActionButtonsComponent.prototype, "actionButtonsStartClassName", {
|
|
4440
|
-
get: function () {
|
|
4441
|
-
return this.actionsLayout === 'start';
|
|
4442
|
-
},
|
|
4443
|
-
enumerable: true,
|
|
4444
|
-
configurable: true
|
|
4445
|
-
});
|
|
4446
|
-
Object.defineProperty(UploadActionButtonsComponent.prototype, "actionButtonsCenterClassName", {
|
|
4447
|
-
get: function () {
|
|
4448
|
-
return this.actionsLayout === 'center';
|
|
4449
|
-
},
|
|
4450
|
-
enumerable: true,
|
|
4451
|
-
configurable: true
|
|
4452
|
-
});
|
|
4453
|
-
UploadActionButtonsComponent.prototype.onAction = function () {
|
|
4454
|
-
var _this = this;
|
|
4455
|
-
this.actionSubscription = this.navigation.onActionButtonAction.subscribe(function (button) {
|
|
4456
|
-
if (button === "clear") {
|
|
4457
|
-
_this.clearFiles();
|
|
4458
|
-
}
|
|
4459
|
-
else {
|
|
4460
|
-
_this.performUpload();
|
|
4461
|
-
}
|
|
4462
|
-
});
|
|
4463
|
-
};
|
|
4464
|
-
UploadActionButtonsComponent.prototype.onFocus = function () {
|
|
4465
|
-
var _this = this;
|
|
4466
|
-
this.focusSubscription = this.navigation.onActionButtonFocus.subscribe(function (button) {
|
|
4467
|
-
_this.focusButton(button);
|
|
4468
|
-
});
|
|
4469
|
-
};
|
|
4470
|
-
UploadActionButtonsComponent.prototype.focusButton = function (button) {
|
|
4471
|
-
var el = (button === "clear") ? this.clearButton : this.uploadButton;
|
|
4472
|
-
el.nativeElement.focus();
|
|
4473
|
-
};
|
|
4474
|
-
UploadActionButtonsComponent.prototype.ngOnDestroy = function () {
|
|
4475
|
-
this.actionSubscription.unsubscribe();
|
|
4476
|
-
this.focusSubscription.unsubscribe();
|
|
4477
|
-
};
|
|
4478
|
-
UploadActionButtonsComponent.prototype.onUploadButtonClick = function (event) {
|
|
4479
|
-
event.stopImmediatePropagation();
|
|
4480
|
-
this.performUpload();
|
|
4481
|
-
};
|
|
4482
|
-
UploadActionButtonsComponent.prototype.performUpload = function () {
|
|
4483
|
-
if (!this.disabled) {
|
|
4484
|
-
this.uploadService.uploadFiles();
|
|
4485
|
-
this.navigation.focusSelectButton();
|
|
4486
|
-
}
|
|
4487
|
-
};
|
|
4488
|
-
UploadActionButtonsComponent.prototype.onClearButtonClick = function (event) {
|
|
4489
|
-
event.stopImmediatePropagation();
|
|
4490
|
-
this.clearFiles();
|
|
4491
|
-
};
|
|
4492
|
-
UploadActionButtonsComponent.prototype.clearFiles = function () {
|
|
4493
|
-
if (!this.disabled) {
|
|
4494
|
-
this.uploadService.clearFiles();
|
|
4495
|
-
this.navigation.focusSelectButton();
|
|
4496
|
-
}
|
|
4497
|
-
};
|
|
4498
|
-
UploadActionButtonsComponent.prototype.textFor = function (key) {
|
|
4499
|
-
return this.localization.get(key);
|
|
4500
|
-
};
|
|
4501
|
-
__decorate([
|
|
4502
|
-
Input(),
|
|
4503
|
-
__metadata("design:type", Boolean)
|
|
4504
|
-
], UploadActionButtonsComponent.prototype, "disabled", void 0);
|
|
4505
|
-
__decorate([
|
|
4506
|
-
Input(),
|
|
4507
|
-
__metadata("design:type", String)
|
|
4508
|
-
], UploadActionButtonsComponent.prototype, "actionsLayout", void 0);
|
|
4509
|
-
__decorate([
|
|
4510
|
-
ViewChild('clearButton', { static: true }),
|
|
4511
|
-
__metadata("design:type", ElementRef)
|
|
4512
|
-
], UploadActionButtonsComponent.prototype, "clearButton", void 0);
|
|
4513
|
-
__decorate([
|
|
4514
|
-
ViewChild('uploadButton', { static: true }),
|
|
4515
|
-
__metadata("design:type", ElementRef)
|
|
4516
|
-
], UploadActionButtonsComponent.prototype, "uploadButton", void 0);
|
|
4517
|
-
__decorate([
|
|
4518
|
-
HostBinding('class.k-actions'),
|
|
4519
|
-
__metadata("design:type", Boolean)
|
|
4520
|
-
], UploadActionButtonsComponent.prototype, "hostDefaultClass", void 0);
|
|
4521
|
-
__decorate([
|
|
4522
|
-
HostBinding('class.k-actions-end'),
|
|
4523
|
-
__metadata("design:type", Boolean),
|
|
4524
|
-
__metadata("design:paramtypes", [])
|
|
4525
|
-
], UploadActionButtonsComponent.prototype, "actionButtonsEndClassName", null);
|
|
4526
|
-
__decorate([
|
|
4527
|
-
HostBinding('class.k-actions-stretched'),
|
|
4528
|
-
__metadata("design:type", Boolean),
|
|
4529
|
-
__metadata("design:paramtypes", [])
|
|
4530
|
-
], UploadActionButtonsComponent.prototype, "actionButtonsStretchedClassName", null);
|
|
4531
|
-
__decorate([
|
|
4532
|
-
HostBinding('class.k-actions-start'),
|
|
4533
|
-
__metadata("design:type", Boolean),
|
|
4534
|
-
__metadata("design:paramtypes", [])
|
|
4535
|
-
], UploadActionButtonsComponent.prototype, "actionButtonsStartClassName", null);
|
|
4536
|
-
__decorate([
|
|
4537
|
-
HostBinding('class.k-actions-center'),
|
|
4538
|
-
__metadata("design:type", Boolean),
|
|
4539
|
-
__metadata("design:paramtypes", [])
|
|
4540
|
-
], UploadActionButtonsComponent.prototype, "actionButtonsCenterClassName", null);
|
|
4541
|
-
UploadActionButtonsComponent = __decorate([
|
|
4542
|
-
Component({
|
|
4543
|
-
selector: 'kendo-upload-action-buttons',
|
|
4544
|
-
template: "\n <button #clearButton type=\"button\" class=\"k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-clear-selected\"\n [attr.tabIndex]=\"-1\"\n (click)=\"onClearButtonClick($event)\">\n {{textFor('clearSelectedFiles')}}\n </button>\n <button #uploadButton type=\"button\" class=\"k-button k-button-md k-rounded-md k-button-solid k-button-solid-primary k-upload-selected\"\n [attr.tabIndex]=\"-1\"\n (click)=\"onUploadButtonClick($event)\">\n {{textFor('uploadSelectedFiles')}}\n </button>\n "
|
|
4545
|
-
}),
|
|
4546
|
-
__metadata("design:paramtypes", [UploadService,
|
|
4547
|
-
LocalizationService,
|
|
4548
|
-
NavigationService])
|
|
4549
|
-
], UploadActionButtonsComponent);
|
|
4550
|
-
return UploadActionButtonsComponent;
|
|
4551
|
-
}());
|
|
4552
|
-
|
|
4553
|
-
/**
|
|
4554
|
-
* @hidden
|
|
4555
|
-
*/
|
|
4556
|
-
var UploadStatusTotalComponent = /** @class */ (function () {
|
|
4557
|
-
function UploadStatusTotalComponent(localization) {
|
|
4558
|
-
this.localization = localization;
|
|
4559
|
-
}
|
|
4560
|
-
UploadStatusTotalComponent.prototype.ngDoCheck = function () {
|
|
4561
|
-
this.isPaused = this.fileList.hasFileWithState([FileState.Paused]);
|
|
4562
|
-
this.isFailed = this.fileList.hasFileWithState([FileState.Failed]);
|
|
4563
|
-
this.isUploading = this.fileList.hasFileWithState([FileState.Uploading]);
|
|
4564
|
-
if (this.isPaused && !this.isUploading) {
|
|
4565
|
-
this.statusText = this.localization.get('headerStatusPaused');
|
|
4566
|
-
}
|
|
4567
|
-
else {
|
|
4568
|
-
this.statusText = this.isUploading ? this.localization.get('headerStatusUploading')
|
|
4569
|
-
: this.localization.get('headerStatusUploaded');
|
|
4570
|
-
}
|
|
4571
|
-
};
|
|
4572
|
-
__decorate([
|
|
4573
|
-
Input(),
|
|
4574
|
-
__metadata("design:type", FileMap)
|
|
4575
|
-
], UploadStatusTotalComponent.prototype, "fileList", void 0);
|
|
4576
|
-
UploadStatusTotalComponent = __decorate([
|
|
4577
|
-
Component({
|
|
4578
|
-
selector: 'kendo-upload-status-total',
|
|
4579
|
-
template: "\n <span class=\"k-icon\"\n [ngClass]=\"{\n 'k-i-checkmark': !this.isUploading && !this.isFailed,\n 'k-i-exception': !this.isUploading && this.isFailed,\n 'k-i-upload': this.isUploading,\n 'k-i-pause-sm': this.isPaused\n }\">\n </span>\n {{statusText}}\n "
|
|
4580
|
-
}),
|
|
4581
|
-
__metadata("design:paramtypes", [LocalizationService])
|
|
4582
|
-
], UploadStatusTotalComponent);
|
|
4583
|
-
return UploadStatusTotalComponent;
|
|
4584
|
-
}());
|
|
4585
|
-
|
|
4586
|
-
var UPLOAD_DECLARATIONS = [
|
|
4587
|
-
UploadComponent,
|
|
4588
|
-
UploadActionButtonsComponent,
|
|
4589
|
-
UploadStatusTotalComponent
|
|
4590
|
-
];
|
|
4591
|
-
/**
|
|
4592
|
-
* Represents the [NgModule](https://angular.io/api/core/NgModule) definition for the Upload component.
|
|
4593
|
-
*/
|
|
4594
|
-
var UploadModule = /** @class */ (function () {
|
|
4595
|
-
function UploadModule() {
|
|
4596
|
-
}
|
|
4597
|
-
UploadModule = __decorate([
|
|
4598
|
-
NgModule({
|
|
4599
|
-
declarations: [UPLOAD_DECLARATIONS],
|
|
4600
|
-
exports: [
|
|
4601
|
-
PUBLIC_DIRECTIVES,
|
|
4602
|
-
UPLOAD_DECLARATIONS
|
|
4603
|
-
],
|
|
4604
|
-
imports: [SharedModule]
|
|
4605
|
-
})
|
|
4606
|
-
], UploadModule);
|
|
4607
|
-
return UploadModule;
|
|
4608
|
-
}());
|
|
4609
|
-
|
|
4610
|
-
/**
|
|
4611
|
-
* Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
|
|
4612
|
-
* definition for the Uploads components.
|
|
4613
|
-
*
|
|
4614
|
-
* @example
|
|
4615
|
-
*
|
|
4616
|
-
* ```ts-no-run
|
|
4617
|
-
* import { UploadsModule } from '@progress/kendo-angular-upload';
|
|
4618
|
-
*
|
|
4619
|
-
* import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
4620
|
-
* import { NgModule } from '@angular/core';
|
|
4621
|
-
*
|
|
4622
|
-
* import { AppComponent } from './app.component';
|
|
4623
|
-
*
|
|
4624
|
-
* _@NgModule({
|
|
4625
|
-
* declarations: [AppComponent],
|
|
4626
|
-
* imports: [BrowserModule, UploadsModule],
|
|
4627
|
-
* bootstrap: [AppComponent]
|
|
4628
|
-
* })
|
|
4629
|
-
* export class AppModule {}
|
|
4630
|
-
*
|
|
4631
|
-
* platformBrowserDynamic().bootstrapModule(AppModule);
|
|
4632
|
-
*
|
|
4633
|
-
* ```
|
|
4634
|
-
*/
|
|
4635
|
-
var UploadsModule = /** @class */ (function () {
|
|
4636
|
-
function UploadsModule() {
|
|
4637
|
-
}
|
|
4638
|
-
UploadsModule = __decorate([
|
|
4639
|
-
NgModule({
|
|
4640
|
-
exports: [
|
|
4641
|
-
FileSelectModule,
|
|
4642
|
-
UploadModule
|
|
4643
|
-
]
|
|
4644
|
-
})
|
|
4645
|
-
], UploadsModule);
|
|
4646
|
-
return UploadsModule;
|
|
4647
|
-
}());
|
|
4648
|
-
|
|
4649
|
-
/**
|
|
4650
|
-
* Generated bundle index. Do not edit.
|
|
4651
|
-
*/
|
|
4652
|
-
|
|
4653
|
-
export { DropZoneBase, DropZoneInternalDirective, DropZoneService, PreventableEvent, FILESELECT_VALUE_ACCESSOR, LocalizedMessagesDirective, Messages, NavigationService, FileListItemDirective, FileListItemBase, PUBLIC_DIRECTIVES, SHARED_DECLARATIONS, SharedModule, UPLOAD_VALUE_ACCESSOR, UploadService, FileSelectModule, UploadModule, UploadsModule, UploadComponent, FileSelectComponent, UploadDropZoneComponent, FileSelectDirective, FileListComponent, FileListSingleItemComponent, FileListItemActionButtonComponent, FileListMultipleItemsComponent, FileTemplateDirective, FileInfoTemplateDirective, TemplateContextDirective, UploadStatusTotalComponent, UploadActionButtonsComponent, UploadDropZoneDirective, CustomMessagesComponent, CancelEvent, ClearEvent, ErrorEvent, PauseEvent, RemoveEvent, ResumeEvent, SelectEvent, SuccessEvent, UploadEvent, UploadProgressEvent, FileState };
|