@progress/kendo-angular-upload 9.0.4-dev.202211170816 → 11.0.0-develop.79

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