@progress/kendo-angular-upload 8.0.2 → 9.0.0-dev.202204191139

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 (265) hide show
  1. package/bundles/kendo-angular-upload.umd.js +5 -0
  2. package/{dist/es2015/common → common}/action-buttons-layout.d.ts +0 -0
  3. package/{dist/es2015/common → common}/util.d.ts +0 -0
  4. package/{dist/es2015/common → common}/validation-util.d.ts +0 -0
  5. package/{dist/es2015/dropzone-base.d.ts → dropzone-base.d.ts} +4 -1
  6. package/{dist/es2015/dropzone-external.directive.d.ts → dropzone-external.directive.d.ts} +4 -1
  7. package/{dist/es2015/dropzone-internal.directive.d.ts → dropzone-internal.directive.d.ts} +3 -0
  8. package/{dist/es2015/dropzone.component.d.ts → dropzone.component.d.ts} +5 -2
  9. package/{dist/es2015/dropzone.service.d.ts → dropzone.service.d.ts} +3 -0
  10. package/{dist/es2015 → esm2015}/common/action-buttons-layout.js +1 -0
  11. package/{dist/es2015 → esm2015}/common/util.js +1 -7
  12. package/{dist/es2015 → esm2015}/common/validation-util.js +0 -4
  13. package/{dist/es2015 → esm2015}/dropzone-base.js +18 -16
  14. package/{dist/es2015 → esm2015}/dropzone-external.directive.js +29 -35
  15. package/{dist/es2015 → esm2015}/dropzone-internal.directive.js +25 -37
  16. package/esm2015/dropzone.component.js +112 -0
  17. package/{dist/es2015 → esm2015}/dropzone.service.js +8 -7
  18. package/{dist/es2015 → esm2015}/events/cancel-event.js +1 -0
  19. package/{dist/es2015 → esm2015}/events/clear-event.js +1 -0
  20. package/{dist/es2015 → esm2015}/events/error-event.js +1 -0
  21. package/{dist/es2015 → esm2015}/events/pause-event.js +1 -0
  22. package/{dist/es2015 → esm2015}/events/preventable-event.js +0 -0
  23. package/{dist/es2015 → esm2015}/events/remove-event.js +1 -0
  24. package/{dist/es2015 → esm2015}/events/resume-event.js +1 -0
  25. package/{dist/es2015 → esm2015}/events/select-event.js +1 -0
  26. package/{dist/es2015 → esm2015}/events/success-event.js +1 -0
  27. package/{dist/es2015 → esm2015}/events/upload-event.js +1 -0
  28. package/{dist/es2015 → esm2015}/events/upload-progress-event.js +1 -0
  29. package/{dist/es → esm2015}/events.js +0 -0
  30. package/esm2015/file-select.directive.js +100 -0
  31. package/{dist/es2015 → esm2015}/fileselect.component.js +160 -132
  32. package/esm2015/fileselect.module.js +35 -0
  33. package/{dist/es/types/chunk-info.js → esm2015/kendo-angular-upload.js} +4 -0
  34. package/esm2015/localization/custom-messages.component.js +50 -0
  35. package/esm2015/localization/localized-messages.directive.js +40 -0
  36. package/esm2015/localization/messages.js +59 -0
  37. package/{dist/es → esm2015}/main.js +0 -0
  38. package/{dist/es2015 → esm2015}/navigation.service.js +9 -9
  39. package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
  40. package/{dist/es2015 → esm2015}/rendering/file-list-item-action-button.component.js +70 -28
  41. package/{dist/es2015 → esm2015}/rendering/file-list-item-base.js +9 -0
  42. package/esm2015/rendering/file-list-item.js +107 -0
  43. package/esm2015/rendering/file-list-multiple-items.component.js +172 -0
  44. package/esm2015/rendering/file-list-single-item.component.js +154 -0
  45. package/esm2015/rendering/file-list.component.js +145 -0
  46. package/esm2015/rendering/upload-action-buttons.component.js +136 -0
  47. package/esm2015/rendering/upload-status-total.component.js +60 -0
  48. package/{dist/es2015 → esm2015}/shared.module.js +45 -18
  49. package/esm2015/templates/file-info-template.directive.js +22 -0
  50. package/esm2015/templates/file-template.directive.js +22 -0
  51. package/esm2015/templates/template-context.directive.js +34 -0
  52. package/{dist/es2015 → esm2015}/types/async-settings.js +1 -0
  53. package/{dist/es2015 → esm2015}/types/chunk-info.js +1 -0
  54. package/{dist/es2015 → esm2015}/types/chunk-map.js +0 -0
  55. package/{dist/es → esm2015}/types/chunk-metadata.js +1 -0
  56. package/{dist/es → esm2015}/types/chunk-settings.js +1 -0
  57. package/{dist/es → esm2015}/types/direction.js +1 -0
  58. package/{dist/es2015 → esm2015}/types/file-groups.js +3 -5
  59. package/{dist/es → esm2015}/types/file-info.js +1 -0
  60. package/{dist/es2015 → esm2015}/types/file-map.js +0 -0
  61. package/{dist/es → esm2015}/types/file-restrictions.js +1 -0
  62. package/{dist/es → esm2015}/types/file-state.js +0 -0
  63. package/{dist/es → esm2015}/types/operation-type.js +1 -0
  64. package/{dist/es → esm2015}/types.js +0 -0
  65. package/{dist/es2015 → esm2015}/upload.component.js +262 -243
  66. package/esm2015/upload.module.js +43 -0
  67. package/{dist/es2015 → esm2015}/upload.service.js +10 -9
  68. package/{dist/es2015 → esm2015}/uploads.module.js +17 -12
  69. package/{dist/es2015/events → events}/cancel-event.d.ts +4 -0
  70. package/{dist/es2015/events → events}/clear-event.d.ts +1 -0
  71. package/{dist/es2015/events → events}/error-event.d.ts +10 -0
  72. package/{dist/es2015/events → events}/pause-event.d.ts +4 -0
  73. package/{dist/es2015/events → events}/preventable-event.d.ts +0 -0
  74. package/{dist/es2015/events → events}/remove-event.d.ts +9 -2
  75. package/{dist/es2015/events → events}/resume-event.d.ts +4 -0
  76. package/{dist/es2015/events → events}/select-event.d.ts +4 -0
  77. package/{dist/es2015/events → events}/success-event.d.ts +10 -0
  78. package/{dist/es2015/events → events}/upload-event.d.ts +9 -2
  79. package/{dist/es2015/events → events}/upload-progress-event.d.ts +7 -0
  80. package/{dist/es2015/events.d.ts → events.d.ts} +0 -0
  81. package/{dist/fesm2015/index.js → fesm2015/kendo-angular-upload.js} +2192 -2010
  82. package/{dist/es2015/file-select.directive.d.ts → file-select.directive.d.ts} +7 -4
  83. package/{dist/es2015/fileselect.component.d.ts → fileselect.component.d.ts} +14 -6
  84. package/fileselect.module.d.ts +20 -0
  85. package/{dist/es/common/action-buttons-layout.js → kendo-angular-upload.d.ts} +5 -0
  86. package/{dist/es2015/localization → localization}/custom-messages.component.d.ts +4 -1
  87. package/{dist/es2015/localization → localization}/localized-messages.directive.d.ts +3 -0
  88. package/{dist/es2015/localization → localization}/messages.d.ts +3 -0
  89. package/{dist/es2015/main.d.ts → main.d.ts} +0 -0
  90. package/{dist/es2015/navigation.service.d.ts → navigation.service.d.ts} +7 -3
  91. package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
  92. package/package.json +32 -102
  93. package/{dist/es2015/rendering → rendering}/file-list-item-action-button.component.d.ts +11 -8
  94. package/{dist/es2015/rendering → rendering}/file-list-item-base.d.ts +3 -0
  95. package/{dist/es2015/rendering → rendering}/file-list-item.d.ts +10 -7
  96. package/{dist/es2015/rendering → rendering}/file-list-multiple-items.component.d.ts +7 -4
  97. package/{dist/es2015/rendering → rendering}/file-list-single-item.component.d.ts +9 -6
  98. package/{dist/es2015/rendering → rendering}/file-list.component.d.ts +3 -0
  99. package/{dist/es2015/rendering → rendering}/upload-action-buttons.component.d.ts +7 -4
  100. package/{dist/es2015/rendering → rendering}/upload-status-total.component.d.ts +3 -0
  101. package/schematics/ngAdd/index.js +5 -2
  102. package/schematics/ngAdd/index.js.map +1 -1
  103. package/shared.module.d.ts +36 -0
  104. package/{dist/es2015/templates → templates}/file-info-template.directive.d.ts +3 -0
  105. package/{dist/es2015/templates → templates}/file-template.directive.d.ts +3 -0
  106. package/{dist/es2015/templates → templates}/template-context.directive.d.ts +4 -1
  107. package/{dist/es2015/types → types}/async-settings.d.ts +0 -0
  108. package/{dist/es2015/types → types}/chunk-info.d.ts +0 -0
  109. package/{dist/es2015/types → types}/chunk-map.d.ts +0 -0
  110. package/{dist/es2015/types → types}/chunk-metadata.d.ts +0 -0
  111. package/{dist/es2015/types → types}/chunk-settings.d.ts +0 -0
  112. package/{dist/es2015/types → types}/direction.d.ts +0 -0
  113. package/{dist/es2015/types → types}/file-groups.d.ts +0 -0
  114. package/{dist/es2015/types → types}/file-info.d.ts +0 -0
  115. package/{dist/es2015/types → types}/file-map.d.ts +5 -5
  116. package/{dist/es2015/types → types}/file-restrictions.d.ts +0 -0
  117. package/{dist/es2015/types → types}/file-state.d.ts +0 -0
  118. package/{dist/es2015/types → types}/operation-type.d.ts +0 -0
  119. package/{dist/es2015/types.d.ts → types.d.ts} +0 -0
  120. package/{dist/es2015/upload.component.d.ts → upload.component.d.ts} +42 -21
  121. package/upload.module.d.ts +22 -0
  122. package/{dist/es2015/upload.service.d.ts → upload.service.d.ts} +4 -1
  123. package/{dist/es2015/uploads.module.d.ts → uploads.module.d.ts} +6 -0
  124. package/dist/cdn/js/kendo-angular-upload.js +0 -20
  125. package/dist/cdn/main.js +0 -5
  126. package/dist/es/common/util.js +0 -234
  127. package/dist/es/common/validation-util.js +0 -64
  128. package/dist/es/dropzone-base.js +0 -66
  129. package/dist/es/dropzone-external.directive.js +0 -98
  130. package/dist/es/dropzone-internal.directive.js +0 -110
  131. package/dist/es/dropzone.component.js +0 -99
  132. package/dist/es/dropzone.service.js +0 -33
  133. package/dist/es/events/cancel-event.js +0 -41
  134. package/dist/es/events/clear-event.js +0 -43
  135. package/dist/es/events/error-event.js +0 -45
  136. package/dist/es/events/pause-event.js +0 -42
  137. package/dist/es/events/preventable-event.js +0 -29
  138. package/dist/es/events/remove-event.js +0 -47
  139. package/dist/es/events/resume-event.js +0 -42
  140. package/dist/es/events/select-event.js +0 -45
  141. package/dist/es/events/success-event.js +0 -49
  142. package/dist/es/events/upload-event.js +0 -47
  143. package/dist/es/events/upload-progress-event.js +0 -42
  144. package/dist/es/file-select.directive.js +0 -141
  145. package/dist/es/fileselect.component.js +0 -484
  146. package/dist/es/fileselect.module.js +0 -30
  147. package/dist/es/index.js +0 -21
  148. package/dist/es/localization/custom-messages.component.js +0 -53
  149. package/dist/es/localization/localized-messages.directive.js +0 -35
  150. package/dist/es/localization/messages.js +0 -102
  151. package/dist/es/navigation.service.js +0 -166
  152. package/dist/es/package-metadata.js +0 -15
  153. package/dist/es/rendering/file-list-item-action-button.component.js +0 -169
  154. package/dist/es/rendering/file-list-item-base.js +0 -41
  155. package/dist/es/rendering/file-list-item.js +0 -165
  156. package/dist/es/rendering/file-list-multiple-items.component.js +0 -107
  157. package/dist/es/rendering/file-list-single-item.component.js +0 -112
  158. package/dist/es/rendering/file-list.component.js +0 -98
  159. package/dist/es/rendering/upload-action-buttons.component.js +0 -149
  160. package/dist/es/rendering/upload-status-total.component.js +0 -42
  161. package/dist/es/shared.module.js +0 -68
  162. package/dist/es/templates/file-info-template.directive.js +0 -22
  163. package/dist/es/templates/file-template.directive.js +0 -22
  164. package/dist/es/templates/template-context.directive.js +0 -40
  165. package/dist/es/types/async-settings.js +0 -4
  166. package/dist/es/types/chunk-map.js +0 -36
  167. package/dist/es/types/file-groups.js +0 -45
  168. package/dist/es/types/file-map.js +0 -170
  169. package/dist/es/upload.component.js +0 -967
  170. package/dist/es/upload.module.js +0 -34
  171. package/dist/es/upload.service.js +0 -448
  172. package/dist/es/uploads.module.js +0 -47
  173. package/dist/es2015/dropzone.component.js +0 -100
  174. package/dist/es2015/events.js +0 -14
  175. package/dist/es2015/file-select.directive.js +0 -123
  176. package/dist/es2015/fileselect.module.d.ts +0 -9
  177. package/dist/es2015/fileselect.module.js +0 -27
  178. package/dist/es2015/index.d.ts +0 -21
  179. package/dist/es2015/index.js +0 -21
  180. package/dist/es2015/index.metadata.json +0 -1
  181. package/dist/es2015/localization/custom-messages.component.js +0 -45
  182. package/dist/es2015/localization/localized-messages.directive.js +0 -35
  183. package/dist/es2015/localization/messages.js +0 -96
  184. package/dist/es2015/main.js +0 -24
  185. package/dist/es2015/rendering/file-list-item.js +0 -136
  186. package/dist/es2015/rendering/file-list-multiple-items.component.js +0 -128
  187. package/dist/es2015/rendering/file-list-single-item.component.js +0 -117
  188. package/dist/es2015/rendering/file-list.component.js +0 -123
  189. package/dist/es2015/rendering/upload-action-buttons.component.js +0 -141
  190. package/dist/es2015/rendering/upload-status-total.component.js +0 -51
  191. package/dist/es2015/shared.module.d.ts +0 -17
  192. package/dist/es2015/templates/file-info-template.directive.js +0 -21
  193. package/dist/es2015/templates/file-template.directive.js +0 -21
  194. package/dist/es2015/templates/template-context.directive.js +0 -35
  195. package/dist/es2015/types/chunk-metadata.js +0 -4
  196. package/dist/es2015/types/chunk-settings.js +0 -4
  197. package/dist/es2015/types/direction.js +0 -4
  198. package/dist/es2015/types/file-info.js +0 -4
  199. package/dist/es2015/types/file-restrictions.js +0 -4
  200. package/dist/es2015/types/file-state.js +0 -34
  201. package/dist/es2015/types/operation-type.js +0 -4
  202. package/dist/es2015/types.js +0 -5
  203. package/dist/es2015/upload.module.d.ts +0 -9
  204. package/dist/es2015/upload.module.js +0 -31
  205. package/dist/fesm5/index.js +0 -4653
  206. package/dist/npm/common/action-buttons-layout.js +0 -6
  207. package/dist/npm/common/util.js +0 -240
  208. package/dist/npm/common/validation-util.js +0 -68
  209. package/dist/npm/dropzone-base.js +0 -68
  210. package/dist/npm/dropzone-external.directive.js +0 -100
  211. package/dist/npm/dropzone-internal.directive.js +0 -112
  212. package/dist/npm/dropzone.component.js +0 -101
  213. package/dist/npm/dropzone.service.js +0 -35
  214. package/dist/npm/events/cancel-event.js +0 -43
  215. package/dist/npm/events/clear-event.js +0 -45
  216. package/dist/npm/events/error-event.js +0 -47
  217. package/dist/npm/events/pause-event.js +0 -44
  218. package/dist/npm/events/preventable-event.js +0 -31
  219. package/dist/npm/events/remove-event.js +0 -49
  220. package/dist/npm/events/resume-event.js +0 -44
  221. package/dist/npm/events/select-event.js +0 -47
  222. package/dist/npm/events/success-event.js +0 -51
  223. package/dist/npm/events/upload-event.js +0 -49
  224. package/dist/npm/events/upload-progress-event.js +0 -44
  225. package/dist/npm/events.js +0 -26
  226. package/dist/npm/file-select.directive.js +0 -143
  227. package/dist/npm/fileselect.component.js +0 -486
  228. package/dist/npm/fileselect.module.js +0 -32
  229. package/dist/npm/index.js +0 -39
  230. package/dist/npm/localization/custom-messages.component.js +0 -55
  231. package/dist/npm/localization/localized-messages.directive.js +0 -37
  232. package/dist/npm/localization/messages.js +0 -104
  233. package/dist/npm/main.js +0 -45
  234. package/dist/npm/navigation.service.js +0 -168
  235. package/dist/npm/package-metadata.js +0 -17
  236. package/dist/npm/rendering/file-list-item-action-button.component.js +0 -171
  237. package/dist/npm/rendering/file-list-item-base.js +0 -43
  238. package/dist/npm/rendering/file-list-item.js +0 -167
  239. package/dist/npm/rendering/file-list-multiple-items.component.js +0 -109
  240. package/dist/npm/rendering/file-list-single-item.component.js +0 -114
  241. package/dist/npm/rendering/file-list.component.js +0 -100
  242. package/dist/npm/rendering/upload-action-buttons.component.js +0 -151
  243. package/dist/npm/rendering/upload-status-total.component.js +0 -44
  244. package/dist/npm/shared.module.js +0 -70
  245. package/dist/npm/templates/file-info-template.directive.js +0 -24
  246. package/dist/npm/templates/file-template.directive.js +0 -24
  247. package/dist/npm/templates/template-context.directive.js +0 -42
  248. package/dist/npm/types/async-settings.js +0 -6
  249. package/dist/npm/types/chunk-info.js +0 -6
  250. package/dist/npm/types/chunk-map.js +0 -38
  251. package/dist/npm/types/chunk-metadata.js +0 -6
  252. package/dist/npm/types/chunk-settings.js +0 -6
  253. package/dist/npm/types/direction.js +0 -6
  254. package/dist/npm/types/file-groups.js +0 -47
  255. package/dist/npm/types/file-info.js +0 -6
  256. package/dist/npm/types/file-map.js +0 -172
  257. package/dist/npm/types/file-restrictions.js +0 -6
  258. package/dist/npm/types/file-state.js +0 -36
  259. package/dist/npm/types/operation-type.js +0 -6
  260. package/dist/npm/types.js +0 -8
  261. package/dist/npm/upload.component.js +0 -969
  262. package/dist/npm/upload.module.js +0 -36
  263. package/dist/npm/upload.service.js +0 -450
  264. package/dist/npm/uploads.module.js +0 -49
  265. package/dist/systemjs/kendo-angular-upload.js +0 -5
@@ -2,17 +2,20 @@
2
2
  * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { __decorate, __metadata } from 'tslib';
6
- import { EventEmitter, Injectable, Directive, TemplateRef, forwardRef, Input, ContentChild, ViewChild, ElementRef, Output, HostBinding, HostListener, Component, NgZone, Renderer2, ChangeDetectorRef, ViewChildren, QueryList, ViewContainerRef, isDevMode, NgModule } from '@angular/core';
5
+ import * as i0 from '@angular/core';
6
+ import { EventEmitter, Injectable, Directive, Input, HostBinding, HostListener, Component, ViewChildren, forwardRef, Inject, ContentChild, ViewChild, Output, isDevMode, NgModule } from '@angular/core';
7
7
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
8
- import { LocalizationService, L10N_PREFIX, ComponentMessages } from '@progress/kendo-angular-l10n';
8
+ import * as i1$1 from '@progress/kendo-angular-l10n';
9
+ import { ComponentMessages, LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
9
10
  import { guid, Keys, isDocumentAvailable, KendoInput, isChanged } from '@progress/kendo-angular-common';
10
11
  import { fromEvent, merge } from 'rxjs';
11
12
  import { filter } from 'rxjs/operators';
12
13
  import { validatePackage } from '@progress/kendo-licensing';
13
- import { HttpHeaders, HttpRequest, HttpEventType, HttpResponse, HttpClient } from '@angular/common/http';
14
- import { CommonModule } from '@angular/common';
14
+ import * as i1 from '@angular/common/http';
15
+ import { HttpHeaders, HttpRequest, HttpEventType, HttpResponse } from '@angular/common/http';
15
16
  import { trigger, state, style, transition, animate } from '@angular/animations';
17
+ import * as i4 from '@angular/common';
18
+ import { CommonModule } from '@angular/common';
16
19
 
17
20
  /**
18
21
  * @hidden
@@ -21,7 +24,7 @@ const packageMetadata = {
21
24
  name: '@progress/kendo-angular-upload',
22
25
  productName: 'Kendo UI for Angular',
23
26
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
24
- publishDate: 1646671545,
27
+ publishDate: 1650368355,
25
28
  version: '',
26
29
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
27
30
  };
@@ -104,14 +107,14 @@ class FileMap {
104
107
  get(uid) {
105
108
  return this._files[uid];
106
109
  }
107
- setFilesState(files, state$$1) {
110
+ setFilesState(files, state) {
108
111
  for (let file of files) {
109
- this.setFilesStateByUid(file.uid, state$$1);
112
+ this.setFilesStateByUid(file.uid, state);
110
113
  }
111
114
  }
112
- setFilesStateByUid(uid, state$$1) {
115
+ setFilesStateByUid(uid, state) {
113
116
  this.get(uid).forEach((f) => {
114
- f.state = state$$1;
117
+ f.state = state;
115
118
  });
116
119
  }
117
120
  get count() {
@@ -177,8 +180,8 @@ class FileMap {
177
180
  }
178
181
  return null;
179
182
  }
180
- getFilesWithState(state$$1) {
181
- return this.filesFlat.filter(file => file.state === state$$1);
183
+ getFilesWithState(state) {
184
+ return this.filesFlat.filter(file => file.state === state);
182
185
  }
183
186
  hasFileWithState(fileStates) {
184
187
  let files = this._files;
@@ -224,6 +227,7 @@ class FileMap {
224
227
  */
225
228
  class CancelEvent {
226
229
  /**
230
+ * @hidden
227
231
  * Constructs the event arguments for the `cancel` event.
228
232
  * @param files - The list of the files that were going to be uploaded.
229
233
  */
@@ -284,6 +288,7 @@ class PreventableEvent {
284
288
  */
285
289
  class ClearEvent extends PreventableEvent {
286
290
  /**
291
+ * @hidden
287
292
  * Constructs the event arguments for the `clear` event.
288
293
  */
289
294
  constructor() { super(); }
@@ -316,6 +321,7 @@ class ClearEvent extends PreventableEvent {
316
321
  */
317
322
  class ErrorEvent {
318
323
  /**
324
+ * @hidden
319
325
  * Constructs the event arguments for the `error` event.
320
326
  *
321
327
  * @param files - The list of the files that failed to be uploaded or removed.
@@ -358,6 +364,7 @@ class ErrorEvent {
358
364
  */
359
365
  class PauseEvent {
360
366
  /**
367
+ * @hidden
361
368
  * Constructs the event arguments for the `pause` event.
362
369
  * @param file - The file that is going to be paused.
363
370
  */
@@ -393,6 +400,7 @@ class PauseEvent {
393
400
  */
394
401
  class RemoveEvent extends PreventableEvent {
395
402
  /**
403
+ * @hidden
396
404
  * Constructs the event arguments for the `remove` event.
397
405
  * @param files - The list of the files that will be removed.
398
406
  * @param headers - The headers of the request.
@@ -433,6 +441,7 @@ class RemoveEvent extends PreventableEvent {
433
441
  */
434
442
  class ResumeEvent {
435
443
  /**
444
+ * @hidden
436
445
  * Constructs the event arguments for the `resume` event.
437
446
  * @param file - The file that is going to be resumed.
438
447
  */
@@ -468,6 +477,7 @@ class ResumeEvent {
468
477
  */
469
478
  class SelectEvent extends PreventableEvent {
470
479
  /**
480
+ * @hidden
471
481
  * Constructs the event arguments for the `select` event.
472
482
  * @param files - The list of the selected files.
473
483
  */
@@ -504,6 +514,7 @@ class SelectEvent extends PreventableEvent {
504
514
  */
505
515
  class SuccessEvent extends PreventableEvent {
506
516
  /**
517
+ * @hidden
507
518
  * Constructs the event arguments for the `success` event.
508
519
  * @param files - The list of the files that were uploaded or removed.
509
520
  * @param operation - The operation type (`upload` or `remove`).
@@ -544,6 +555,7 @@ class SuccessEvent extends PreventableEvent {
544
555
  */
545
556
  class UploadEvent extends PreventableEvent {
546
557
  /**
558
+ * @hidden
547
559
  * Constructs the event arguments for the `upload` event.
548
560
  * @param files - The list of the files that will be uploaded.
549
561
  * @param headers - The headers of the request.
@@ -582,6 +594,7 @@ class UploadEvent extends PreventableEvent {
582
594
  */
583
595
  class UploadProgressEvent {
584
596
  /**
597
+ * @hidden
585
598
  * Constructs the event arguments for the `uploadprogress` event.
586
599
  * @param files - The list of files that are being uploaded.
587
600
  * @param percentComplete - The portion that has been uploaded.
@@ -592,9 +605,6 @@ class UploadProgressEvent {
592
605
  }
593
606
  }
594
607
 
595
- const ɵ0 = [
596
- ".xlr", ".xls", ".xlsx"
597
- ];
598
608
  /**
599
609
  * @hidden
600
610
  */
@@ -614,7 +624,9 @@ const fileGroupMap = {
614
624
  presentation: [
615
625
  ".key", ".odp", ".pps", ".ppt", ".pptx"
616
626
  ],
617
- data: ɵ0,
627
+ data: [
628
+ ".xlr", ".xls", ".xlsx"
629
+ ],
618
630
  programming: [
619
631
  ".tmp", ".bak", ".msi", ".cab", ".cpl", ".cur", ".dll", ".dmp", ".drv", ".icns", ".ico", ".link", ".sys", ".cfg",
620
632
  ".ini", ".asp", ".aspx", ".cer", ".csr", ".css", ".dcr", ".htm", ".html", ".js", ".php", ".rss", ".xhtml"
@@ -633,7 +645,7 @@ const fileGroupMap = {
633
645
  ]
634
646
  };
635
647
 
636
- /* tslint:disable: no-bitwise */
648
+ /* eslint-disable no-bitwise */
637
649
  /**
638
650
  * @hidden
639
651
  */
@@ -784,6 +796,18 @@ const assignGuidToFiles = (files, isUnique) => {
784
796
  return file;
785
797
  });
786
798
  };
799
+ /**
800
+ * @hidden
801
+ */
802
+ const supportsFormData = () => {
803
+ return typeof (FormData) !== "undefined";
804
+ };
805
+ /**
806
+ * @hidden
807
+ */
808
+ const userAgent = () => {
809
+ return navigator.userAgent;
810
+ };
787
811
  const focusableRegex = /^(?:a|input|select|textarea|button|object)$/i;
788
812
  /**
789
813
  * @hidden
@@ -875,7 +899,7 @@ class ChunkMap {
875
899
  /**
876
900
  * @hidden
877
901
  */
878
- let UploadService = class UploadService {
902
+ class UploadService {
879
903
  constructor(http) {
880
904
  this.http = http;
881
905
  this.cancelEvent = new EventEmitter();
@@ -1281,16 +1305,17 @@ let UploadService = class UploadService {
1281
1305
  }
1282
1306
  return false;
1283
1307
  }
1284
- };
1285
- UploadService = __decorate([
1286
- Injectable(),
1287
- __metadata("design:paramtypes", [HttpClient])
1288
- ], UploadService);
1308
+ }
1309
+ UploadService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1310
+ UploadService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadService });
1311
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadService, decorators: [{
1312
+ type: Injectable
1313
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
1289
1314
 
1290
1315
  /**
1291
1316
  * @hidden
1292
1317
  */
1293
- let NavigationService = class NavigationService {
1318
+ class NavigationService {
1294
1319
  constructor(uploadService) {
1295
1320
  this.uploadService = uploadService;
1296
1321
  this.onActionButtonAction = new EventEmitter();
@@ -1424,32 +1449,35 @@ let NavigationService = class NavigationService {
1424
1449
  const fileCount = this.uploadService.files.count;
1425
1450
  return this.actionButtonsVisible ? fileCount + 1 : fileCount - 1;
1426
1451
  }
1427
- };
1428
- NavigationService = __decorate([
1429
- Injectable(),
1430
- __metadata("design:paramtypes", [UploadService])
1431
- ], NavigationService);
1452
+ }
1453
+ NavigationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: NavigationService, deps: [{ token: UploadService }], target: i0.ɵɵFactoryTarget.Injectable });
1454
+ NavigationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: NavigationService });
1455
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: NavigationService, decorators: [{
1456
+ type: Injectable
1457
+ }], ctorParameters: function () { return [{ type: UploadService }]; } });
1432
1458
 
1433
1459
  /**
1434
1460
  * Used to customize the rendering of the files in the list ([see example]({% slug templates_upload %}#toc-file-template)).
1435
1461
  */
1436
- let FileTemplateDirective = class FileTemplateDirective {
1462
+ class FileTemplateDirective {
1437
1463
  constructor(templateRef) {
1438
1464
  this.templateRef = templateRef;
1439
1465
  }
1440
- };
1441
- FileTemplateDirective = __decorate([
1442
- Directive({
1443
- selector: '[kendoUploadFileTemplate], [kendoFileSelectFileTemplate]' // tslint:disable-line:directive-selector-prefix
1444
- }),
1445
- __metadata("design:paramtypes", [TemplateRef])
1446
- ], FileTemplateDirective);
1466
+ }
1467
+ FileTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
1468
+ FileTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FileTemplateDirective, selector: "[kendoUploadFileTemplate], [kendoFileSelectFileTemplate]", ngImport: i0 });
1469
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileTemplateDirective, decorators: [{
1470
+ type: Directive,
1471
+ args: [{
1472
+ selector: '[kendoUploadFileTemplate], [kendoFileSelectFileTemplate]'
1473
+ }]
1474
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
1447
1475
 
1448
1476
  let components = {};
1449
1477
  /**
1450
1478
  * @hidden
1451
1479
  */
1452
- let DropZoneService = class DropZoneService {
1480
+ class DropZoneService {
1453
1481
  addComponent(component, zoneId) {
1454
1482
  if (this.has(zoneId)) {
1455
1483
  components[zoneId].push(component);
@@ -1464,982 +1492,717 @@ let DropZoneService = class DropZoneService {
1464
1492
  has(id) {
1465
1493
  return id in components;
1466
1494
  }
1467
- };
1468
- DropZoneService = __decorate([
1469
- Injectable()
1470
- ], DropZoneService);
1495
+ }
1496
+ DropZoneService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropZoneService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1497
+ DropZoneService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropZoneService });
1498
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropZoneService, decorators: [{
1499
+ type: Injectable
1500
+ }] });
1471
1501
 
1472
1502
  /**
1473
1503
  * 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)).
1474
1504
  */
1475
- let FileInfoTemplateDirective = class FileInfoTemplateDirective {
1505
+ class FileInfoTemplateDirective {
1476
1506
  constructor(templateRef) {
1477
1507
  this.templateRef = templateRef;
1478
1508
  }
1479
- };
1480
- FileInfoTemplateDirective = __decorate([
1481
- Directive({
1482
- selector: '[kendoUploadFileInfoTemplate], [kendoFileSelectFileInfoTemplate]'
1483
- }),
1484
- __metadata("design:paramtypes", [TemplateRef])
1485
- ], FileInfoTemplateDirective);
1509
+ }
1510
+ FileInfoTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileInfoTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
1511
+ FileInfoTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FileInfoTemplateDirective, selector: "[kendoUploadFileInfoTemplate], [kendoFileSelectFileInfoTemplate]", ngImport: i0 });
1512
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileInfoTemplateDirective, decorators: [{
1513
+ type: Directive,
1514
+ args: [{
1515
+ selector: '[kendoUploadFileInfoTemplate], [kendoFileSelectFileInfoTemplate]'
1516
+ }]
1517
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
1486
1518
 
1487
- var FileSelectComponent_1;
1488
1519
  /**
1489
1520
  * @hidden
1490
1521
  */
1491
- const FILESELECT_VALUE_ACCESSOR = {
1492
- multi: true,
1493
- provide: NG_VALUE_ACCESSOR,
1494
- useExisting: forwardRef(() => FileSelectComponent) // tslint:disable-line:no-forward-ref
1495
- };
1496
- let FileSelectComponent = FileSelectComponent_1 = class FileSelectComponent {
1497
- constructor(uploadService, localization, navigation, dropZoneService, ngZone, renderer, cdr, wrapper) {
1522
+ class FileListItemDirective {
1523
+ constructor(el, navigationService, uploadService) {
1524
+ this.navigationService = navigationService;
1498
1525
  this.uploadService = uploadService;
1499
- this.localization = localization;
1500
- this.navigation = navigation;
1501
- this.dropZoneService = dropZoneService;
1502
- this.ngZone = ngZone;
1503
- this.renderer = renderer;
1504
- this.cdr = cdr;
1505
- /**
1506
- * Disables the FileSelect.
1507
- * The default value is `false`.
1508
- */
1509
- this.disabled = false;
1510
- /**
1511
- * Enables the selection of multiple files
1512
- * ([see example]({% slug fileprocessing_upload %}#toc-upload-of-sinlge-or-multiple-files)).
1513
- * If set to `false`, only one file can be selected at a time.
1514
- */
1515
- this.multiple = true;
1516
- /**
1517
- * Toggles the visibility of the file list.
1518
- */
1519
- this.showFileList = true;
1520
- /**
1521
- * Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the FileSelect.
1522
- */
1523
- this.tabindex = 0;
1524
- /**
1525
- * @hidden
1526
- */
1527
- this.focusableId = `k-${guid()}`;
1528
- /**
1529
- * Fires when the user navigates outside the component.
1530
- */
1531
- this.onBlur = new EventEmitter();
1532
- /**
1533
- * Fires when the component is focused.
1534
- */
1535
- this.onFocus = new EventEmitter();
1536
- /**
1537
- * Fires when files are selected. If prevented, the selected files will not be added to the list.
1538
- */
1539
- this.select = new EventEmitter();
1540
- /**
1541
- * Fires when a file is about to be removed. If prevented, the file will remain in the list.
1542
- */
1543
- this.remove = new EventEmitter();
1544
- /**
1545
- * Fires when the value of the component has changed as a result of a successful `select` or `remove` operation.
1546
- */
1547
- this.valueChange = new EventEmitter();
1548
- this.hostDefaultClasses = true;
1549
- /**
1550
- * @hidden
1551
- */
1552
- this._restrictions = {
1553
- allowedExtensions: [],
1554
- maxFileSize: 0,
1555
- minFileSize: 0
1556
- };
1557
- this.onTouchedCallback = (_) => { };
1558
- this.onChangeCallback = (_) => { };
1559
- validatePackage(packageMetadata);
1560
- this.wrapper = wrapper.nativeElement;
1561
- this.direction = localization.rtl ? 'rtl' : 'ltr';
1562
- this.navigation.computeKeys(this.direction);
1563
- this.fileList = this.uploadService.files;
1564
- this.localizationChangeSubscription = localization.changes.subscribe(({ rtl }) => {
1565
- this.direction = rtl ? 'rtl' : 'ltr';
1566
- this.navigation.computeKeys(this.direction);
1567
- });
1568
- this.subscribeBlur();
1569
- this.subscribeFocus();
1570
- this.attachEventHandlers();
1571
- this.setDefaultSettings();
1526
+ this.fileClass = true;
1527
+ this.focused = false;
1528
+ this.element = el;
1572
1529
  }
1573
- /**
1574
- * Sets the `name` attribute of the `input` element of the FileSelect.
1575
- */
1576
- set name(name) {
1577
- this.uploadService.async.saveField = name;
1530
+ focus() {
1531
+ this.element.nativeElement.focus();
1578
1532
  }
1579
- get name() {
1580
- return this.uploadService.async.saveField;
1533
+ get uidAttribute() {
1534
+ return this.files[0].uid;
1581
1535
  }
1582
- /**
1583
- * Sets the restrictions for selected files.
1584
- */
1585
- set restrictions(restrictions) {
1586
- let parsedRestrictions = Object.assign({}, this._restrictions, restrictions);
1587
- this._restrictions = parsedRestrictions;
1536
+ get tabIndex() {
1537
+ return "-1";
1588
1538
  }
1589
- get restrictions() {
1590
- return this._restrictions;
1539
+ get kFileError() {
1540
+ return this.files[0].state === FileState.Failed;
1591
1541
  }
1592
- get hostDisabledClass() {
1593
- return this.disabled;
1542
+ get kFileInvalid() {
1543
+ return filesHaveValidationErrors(this.files);
1594
1544
  }
1595
- get dir() {
1596
- return this.direction;
1545
+ get kFileProgress() {
1546
+ return this.files[0].state === FileState.Uploading ||
1547
+ this.files[0].state === FileState.Paused;
1597
1548
  }
1598
- ngOnInit() {
1599
- this.renderer.removeAttribute(this.wrapper, "tabindex");
1600
- if (this.zoneId) {
1601
- this.dropZoneService.addComponent(this, this.zoneId);
1549
+ get kFileSuccess() {
1550
+ if (this.uploadService.component === 'Upload') {
1551
+ return this.files[0].state === FileState.Uploaded ||
1552
+ this.files[0].state === FileState.Initial;
1602
1553
  }
1554
+ return false;
1555
+ }
1556
+ get kStateFocused() {
1557
+ return this.focused;
1558
+ }
1559
+ onFocus() {
1560
+ this.focused = true;
1561
+ }
1562
+ onBlur() {
1563
+ this.focused = false;
1564
+ }
1565
+ onClick(event) {
1566
+ if (!isFocusable(event.target) && !hasClasses(event.target, IGNORE_TARGET_CLASSES)) {
1567
+ this.navigationService.focusedIndex = this.index;
1568
+ }
1569
+ }
1570
+ }
1571
+ FileListItemDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListItemDirective, deps: [{ token: i0.ElementRef }, { token: NavigationService }, { token: UploadService }], target: i0.ɵɵFactoryTarget.Directive });
1572
+ FileListItemDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", 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-state-focused": "this.kStateFocused" } }, ngImport: i0 });
1573
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListItemDirective, decorators: [{
1574
+ type: Directive,
1575
+ args: [{
1576
+ selector: '[kendoUploadFileListItem]'
1577
+ }]
1578
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: NavigationService }, { type: UploadService }]; }, propDecorators: { files: [{
1579
+ type: Input
1580
+ }], index: [{
1581
+ type: Input
1582
+ }], fileClass: [{
1583
+ type: HostBinding,
1584
+ args: ['class.k-file']
1585
+ }], uidAttribute: [{
1586
+ type: HostBinding,
1587
+ args: ['attr.data-uid']
1588
+ }], tabIndex: [{
1589
+ type: HostBinding,
1590
+ args: ['attr.tabIndex']
1591
+ }], kFileError: [{
1592
+ type: HostBinding,
1593
+ args: ['class.k-file-error']
1594
+ }], kFileInvalid: [{
1595
+ type: HostBinding,
1596
+ args: ['class.k-file-invalid']
1597
+ }], kFileProgress: [{
1598
+ type: HostBinding,
1599
+ args: ['class.k-file-progress']
1600
+ }], kFileSuccess: [{
1601
+ type: HostBinding,
1602
+ args: ['class.k-file-success']
1603
+ }], kStateFocused: [{
1604
+ type: HostBinding,
1605
+ args: ['class.k-state-focused']
1606
+ }], onFocus: [{
1607
+ type: HostListener,
1608
+ args: ["focus"]
1609
+ }], onBlur: [{
1610
+ type: HostListener,
1611
+ args: ["blur"]
1612
+ }], onClick: [{
1613
+ type: HostListener,
1614
+ args: ['click', ['$event']]
1615
+ }] } });
1616
+
1617
+ /**
1618
+ * @hidden
1619
+ */
1620
+ class FileListItemBase {
1621
+ constructor(uploadService) {
1622
+ this.uploadService = uploadService;
1623
+ this.progressComplete = 0;
1624
+ }
1625
+ subscribeUploadProgress(uploadProgressHandler) {
1626
+ this.uploadProgressSubscription = this.uploadService.uploadProgressEvent.subscribe(uploadProgressHandler);
1627
+ }
1628
+ fileHasValidationErrors(file) {
1629
+ return fileHasValidationErrors(file);
1630
+ }
1631
+ filesHaveValidationErrors(files) {
1632
+ return filesHaveValidationErrors(files);
1633
+ }
1634
+ ngOnDestroy() {
1635
+ this.uploadProgressSubscription.unsubscribe();
1636
+ }
1637
+ getFileValidationMessage(file) {
1638
+ let validationMessage;
1639
+ if (file.validationErrors && file.validationErrors.length > 0) {
1640
+ validationMessage = this.localization.get(file.validationErrors[0]);
1641
+ }
1642
+ return validationMessage;
1643
+ }
1644
+ getTotalFilesSizeMessage(files) {
1645
+ return getTotalFilesSizeMessage(files);
1603
1646
  }
1604
- /**
1605
- * @hidden
1606
- */
1607
1647
  textFor(key) {
1608
1648
  return this.localization.get(key);
1609
1649
  }
1610
- /**
1611
- * Focuses the underlying input element.
1612
- */
1613
- focus() {
1614
- setTimeout(() => {
1615
- this.fileSelectButton.nativeElement.focus();
1616
- });
1650
+ }
1651
+ FileListItemBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListItemBase, deps: [{ token: UploadService }], target: i0.ɵɵFactoryTarget.Component });
1652
+ FileListItemBase.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FileListItemBase, selector: "ng-component", ngImport: i0, template: '', isInline: true });
1653
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListItemBase, decorators: [{
1654
+ type: Component,
1655
+ args: [{ template: '' }]
1656
+ }], ctorParameters: function () { return [{ type: UploadService }]; } });
1657
+
1658
+ /**
1659
+ * @hidden
1660
+ */
1661
+ class FileListItemActionButtonComponent {
1662
+ constructor(uploadService, localization, navigation) {
1663
+ this.uploadService = uploadService;
1664
+ this.localization = localization;
1665
+ this.navigation = navigation;
1666
+ this.actionFocused = false;
1667
+ this.retryFocused = false;
1668
+ this.pauseResumeFocused = false;
1617
1669
  }
1618
- ngOnDestroy() {
1619
- this.fileList.clear();
1620
- if (this.blurSubscription) {
1621
- this.blurSubscription.unsubscribe();
1670
+ onFocus(type) {
1671
+ if (type === 'action') {
1672
+ this.actionFocused = true;
1622
1673
  }
1623
- if (this.wrapperFocusSubscription) {
1624
- this.wrapperFocusSubscription.unsubscribe();
1674
+ if (type === 'retry') {
1675
+ this.retryFocused = true;
1625
1676
  }
1626
- if (this.selectButtonFocusSubscription) {
1627
- this.selectButtonFocusSubscription.unsubscribe();
1677
+ if (type === 'pauseResume') {
1678
+ this.pauseResumeFocused = true;
1628
1679
  }
1629
- if (this.localizationChangeSubscription) {
1630
- this.localizationChangeSubscription.unsubscribe();
1680
+ }
1681
+ onBlur(type) {
1682
+ if (type === 'retry') {
1683
+ this.retryFocused = false;
1631
1684
  }
1632
- if (this.subs) {
1633
- this.subs.unsubscribe();
1685
+ if (type === 'action') {
1686
+ this.actionFocused = false;
1687
+ }
1688
+ if (type === 'pauseResume') {
1689
+ this.pauseResumeFocused = false;
1634
1690
  }
1635
1691
  }
1636
- /**
1637
- * @hidden
1638
- */
1639
- handleKeydown(event) {
1692
+ onRetryClick() {
1640
1693
  if (this.disabled) {
1641
1694
  return;
1642
1695
  }
1643
- if ((event.keyCode === Keys.Enter || event.keyCode === Keys.Space) &&
1644
- event.target === this.fileSelectButton.nativeElement) {
1645
- event.preventDefault();
1646
- this.fileSelect.nativeElement.click();
1696
+ this.uploadService.retryFiles(this.file.uid);
1697
+ }
1698
+ onRemoveCancelClick(event) {
1699
+ if (this.disabled) {
1647
1700
  return;
1648
1701
  }
1649
- if (hasClasses(event.target, UPLOAD_CLASSES) ||
1650
- (!isFocusable(event.target) && !hasClasses(event.target, IGNORE_TARGET_CLASSES))) {
1651
- this.navigation.process(event);
1702
+ event.stopImmediatePropagation();
1703
+ const uid = this.file.uid;
1704
+ if (this.file.state === FileState.Uploading) {
1705
+ this.uploadService.cancelFiles(uid);
1652
1706
  }
1707
+ else {
1708
+ this.uploadService.removeFiles(uid);
1709
+ }
1710
+ this.navigation.focusSelectButton();
1653
1711
  }
1654
- /**
1655
- * @hidden
1656
- */
1657
- writeValue(newValue) {
1658
- let isValid = true;
1659
- if (newValue instanceof Array) {
1660
- newValue.forEach((file) => {
1661
- if (!validateInitialFileSelectFile(file)) {
1662
- isValid = false;
1663
- }
1664
- });
1665
- if (isValid) {
1666
- this.uploadService.addInitialFileSelectFiles(newValue);
1667
- }
1712
+ onPauseResumeClick() {
1713
+ if (this.disabled) {
1714
+ return;
1668
1715
  }
1669
- if (newValue === null) {
1670
- this.fileList.clear();
1716
+ const uid = this.file.uid;
1717
+ if (this.file.state === FileState.Paused) {
1718
+ this.uploadService.resumeFile(uid);
1719
+ }
1720
+ else {
1721
+ this.uploadService.pauseFile(uid);
1671
1722
  }
1672
- this.cdr.markForCheck();
1673
- }
1674
- /**
1675
- * @hidden
1676
- */
1677
- registerOnChange(fn) {
1678
- this.onChangeCallback = fn;
1679
- }
1680
- /**
1681
- * @hidden
1682
- */
1683
- registerOnTouched(fn) {
1684
- this.onTouchedCallback = fn;
1685
- }
1686
- /**
1687
- * @hidden
1688
- */
1689
- setDisabledState(isDisabled) {
1690
- this.disabled = isDisabled;
1691
- }
1692
- /**
1693
- * Removes specific file from the file list.
1694
- */
1695
- removeFileByUid(uid) {
1696
- this.uploadService.removeFiles(uid);
1697
- }
1698
- /**
1699
- * Visually clears all files from the UI.
1700
- */
1701
- clearFiles() {
1702
- this.uploadService.clearFiles();
1703
- }
1704
- /**
1705
- * @hidden
1706
- * Used to determine if the component is empty.
1707
- */
1708
- isEmpty() {
1709
- return false;
1710
1723
  }
1711
- /**
1712
- * @hidden
1713
- * Used by the external dropzone to add files to the FileSelect
1714
- */
1715
- addFiles(files) {
1716
- this.uploadService.addFiles(files);
1724
+ get actionButtonTitle() {
1725
+ if (this.file.state === FileState.Uploading) {
1726
+ return this.localization.get('cancel');
1727
+ }
1728
+ return this.localization.get('remove');
1717
1729
  }
1718
- /**
1719
- * @hidden
1720
- */
1721
- get selectButtonTabIndex() {
1722
- return this.disabled ? undefined : this.tabindex;
1730
+ get retryButtonTitle() {
1731
+ return this.localization.get('retry');
1723
1732
  }
1724
- /**
1725
- * @hidden
1726
- */
1727
- onFileSelectButtonFocus(_event) {
1728
- this.renderer.addClass(this.fileSelectButton.nativeElement, 'k-focus');
1729
- if (!this.navigation.focused) {
1730
- this.navigation.focusedIndex = -1;
1733
+ get pauseResumeButtonTitle() {
1734
+ if (this.file.state === FileState.Uploading) {
1735
+ return this.localization.get('pause');
1731
1736
  }
1737
+ return this.localization.get('resume');
1732
1738
  }
1733
- /**
1734
- * @hidden
1735
- */
1736
- onFileSelectButtonBlur(_event) {
1737
- this.renderer.removeClass(this.fileSelectButton.nativeElement, 'k-focus');
1739
+ get isUploading() {
1740
+ return this.file.state === FileState.Uploading;
1738
1741
  }
1739
- subscribeBlur() {
1740
- if (!isDocumentAvailable()) {
1741
- return;
1742
- }
1743
- this.ngZone.runOutsideAngular(() => {
1744
- this.documentClick = fromEvent(document, 'click').pipe(filter((event) => {
1745
- return !(this.wrapper !== event.target && this.wrapper.contains(event.target));
1746
- }));
1747
- this.blurSubscription = merge(this.documentClick, this.navigation.onTab).subscribe(() => {
1748
- if (this.navigation.focused) {
1749
- this.ngZone.run(() => {
1750
- this.navigation.focused = false;
1751
- this.onTouchedCallback();
1752
- this.onBlur.emit();
1753
- });
1754
- }
1755
- });
1756
- });
1742
+ get isFailed() {
1743
+ return this.file.state === FileState.Failed;
1757
1744
  }
1758
- subscribeFocus() {
1759
- this.wrapperFocusSubscription = this.navigation.onWrapperFocus.subscribe(() => {
1760
- this.onFocus.emit();
1761
- });
1762
- this.selectButtonFocusSubscription = this.navigation.onSelectButtonFocus.subscribe(() => {
1763
- this.fileSelectButton.nativeElement.focus();
1764
- });
1745
+ get isPaused() {
1746
+ return this.file.state === FileState.Paused;
1765
1747
  }
1766
- attachEventHandlers() {
1767
- this.subs = this.uploadService.changeEvent.subscribe((files) => {
1768
- let model = [];
1769
- if (files !== null) {
1770
- files.forEach((file) => {
1771
- if (file.state === FileState.Initial) {
1772
- model.push(file);
1773
- }
1774
- if (file.state === FileState.Selected && file.rawFile && !file.validationErrors) {
1775
- model.push(file.rawFile);
1776
- }
1777
- });
1778
- }
1779
- if (model.length === 0) {
1780
- model = null;
1781
- }
1782
- this.onChangeCallback(model);
1783
- this.valueChange.emit(model);
1784
- });
1785
- this.subs.add(this.uploadService.removeEvent.subscribe((args) => {
1786
- this.remove.emit(args);
1787
- }));
1788
- this.subs.add(this.uploadService.selectEvent.subscribe((args) => {
1789
- this.select.emit(args);
1790
- }));
1748
+ get isResumable() {
1749
+ const service = this.uploadService;
1750
+ const isResumable = service.async.chunk && service.chunk.resumable;
1751
+ const isUploading = (this.file.state === FileState.Paused) || (this.file.state === FileState.Uploading);
1752
+ return isResumable && isUploading;
1791
1753
  }
1792
- setDefaultSettings() {
1793
- this.uploadService.async.autoUpload = false;
1794
- this.uploadService.component = 'FileSelect';
1754
+ get isActionButtonVisible() {
1755
+ if ((this.file.state === FileState.Uploaded || this.file.state === FileState.Initial) &&
1756
+ !this.uploadService.async.removeUrl && this.uploadService.component === 'Upload') {
1757
+ return false;
1758
+ }
1759
+ return true;
1795
1760
  }
1796
- };
1797
- __decorate([
1798
- Input(),
1799
- __metadata("design:type", String)
1800
- ], FileSelectComponent.prototype, "accept", void 0);
1801
- __decorate([
1802
- Input(),
1803
- __metadata("design:type", Boolean)
1804
- ], FileSelectComponent.prototype, "disabled", void 0);
1805
- __decorate([
1806
- Input(),
1807
- __metadata("design:type", Boolean)
1808
- ], FileSelectComponent.prototype, "multiple", void 0);
1809
- __decorate([
1810
- Input(),
1811
- __metadata("design:type", String),
1812
- __metadata("design:paramtypes", [String])
1813
- ], FileSelectComponent.prototype, "name", null);
1814
- __decorate([
1815
- Input(),
1816
- __metadata("design:type", Boolean)
1817
- ], FileSelectComponent.prototype, "showFileList", void 0);
1818
- __decorate([
1819
- Input(),
1820
- __metadata("design:type", Number)
1821
- ], FileSelectComponent.prototype, "tabindex", void 0);
1822
- __decorate([
1823
- Input(),
1824
- __metadata("design:type", Object),
1825
- __metadata("design:paramtypes", [Object])
1826
- ], FileSelectComponent.prototype, "restrictions", null);
1827
- __decorate([
1828
- Input(),
1829
- __metadata("design:type", String)
1830
- ], FileSelectComponent.prototype, "zoneId", void 0);
1831
- __decorate([
1832
- Input(),
1833
- __metadata("design:type", String)
1834
- ], FileSelectComponent.prototype, "focusableId", void 0);
1835
- __decorate([
1836
- ContentChild(FileTemplateDirective, { static: false }),
1837
- __metadata("design:type", FileTemplateDirective)
1838
- ], FileSelectComponent.prototype, "fileTemplate", void 0);
1839
- __decorate([
1840
- ContentChild(FileInfoTemplateDirective, { static: false }),
1841
- __metadata("design:type", FileInfoTemplateDirective)
1842
- ], FileSelectComponent.prototype, "fileInfoTemplate", void 0);
1843
- __decorate([
1844
- ViewChild('fileSelect', { static: true }),
1845
- __metadata("design:type", ElementRef)
1846
- ], FileSelectComponent.prototype, "fileSelect", void 0);
1847
- __decorate([
1848
- ViewChild('fileSelectButton', { static: true }),
1849
- __metadata("design:type", ElementRef)
1850
- ], FileSelectComponent.prototype, "fileSelectButton", void 0);
1851
- __decorate([
1852
- Output('blur'),
1853
- __metadata("design:type", EventEmitter)
1854
- ], FileSelectComponent.prototype, "onBlur", void 0);
1855
- __decorate([
1856
- Output('focus'),
1857
- __metadata("design:type", EventEmitter)
1858
- ], FileSelectComponent.prototype, "onFocus", void 0);
1859
- __decorate([
1860
- Output(),
1861
- __metadata("design:type", EventEmitter)
1862
- ], FileSelectComponent.prototype, "select", void 0);
1863
- __decorate([
1864
- Output(),
1865
- __metadata("design:type", EventEmitter)
1866
- ], FileSelectComponent.prototype, "remove", void 0);
1867
- __decorate([
1868
- Output(),
1869
- __metadata("design:type", EventEmitter)
1870
- ], FileSelectComponent.prototype, "valueChange", void 0);
1871
- __decorate([
1872
- HostBinding('class.k-widget'),
1873
- HostBinding('class.k-upload'),
1874
- __metadata("design:type", Boolean)
1875
- ], FileSelectComponent.prototype, "hostDefaultClasses", void 0);
1876
- __decorate([
1877
- HostBinding('class.k-disabled'),
1878
- __metadata("design:type", Boolean),
1879
- __metadata("design:paramtypes", [])
1880
- ], FileSelectComponent.prototype, "hostDisabledClass", null);
1881
- __decorate([
1882
- HostBinding('attr.dir'),
1883
- __metadata("design:type", String),
1884
- __metadata("design:paramtypes", [])
1885
- ], FileSelectComponent.prototype, "dir", null);
1886
- __decorate([
1887
- HostListener('keydown', ['$event']),
1888
- __metadata("design:type", Function),
1889
- __metadata("design:paramtypes", [Object]),
1890
- __metadata("design:returntype", void 0)
1891
- ], FileSelectComponent.prototype, "handleKeydown", null);
1892
- FileSelectComponent = FileSelectComponent_1 = __decorate([
1893
- Component({
1894
- exportAs: 'kendoFileSelect',
1895
- providers: [
1896
- LocalizationService,
1897
- NavigationService,
1898
- UploadService,
1899
- DropZoneService,
1900
- FILESELECT_VALUE_ACCESSOR,
1901
- {
1902
- provide: L10N_PREFIX,
1903
- useValue: 'kendo.fileselect'
1904
- },
1905
- {
1906
- provide: KendoInput,
1907
- useExisting: forwardRef(() => FileSelectComponent_1)
1908
- }
1909
- ],
1910
- selector: 'kendo-fileselect',
1911
- template: `
1912
- <ng-container kendoFileSelectLocalizedMessages
1913
- i18n-dropFilesHere="kendo.fileselect.dropFilesHere|The drop zone hint"
1914
- dropFilesHere="Drop files here to select"
1915
-
1916
- i18n-invalidFileExtension="kendo.fileselect.invalidFileExtension|The text for the invalid allowed extensions restriction message"
1917
- invalidFileExtension="File type not allowed."
1761
+ }
1762
+ FileListItemActionButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListItemActionButtonComponent, deps: [{ token: UploadService }, { token: i1$1.LocalizationService }, { token: NavigationService }], target: i0.ɵɵFactoryTarget.Component });
1763
+ FileListItemActionButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FileListItemActionButtonComponent, selector: "kendo-upload-file-list-item-action-button", inputs: { file: "file", disabled: "disabled", progress: "progress" }, ngImport: i0, template: `
1764
+ <strong class="k-upload-status">
1765
+ <span class="k-upload-pct" *ngIf="isUploading || isPaused">{{progress}}%</span>
1918
1766
 
1919
- i18n-invalidMaxFileSize="kendo.fileselect.invalidMaxFileSize|The text for the invalid max file size restriction message"
1920
- invalidMaxFileSize="File size too large."
1767
+ <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"
1768
+ [ngClass]="{ 'k-focus': this.retryFocused }"
1769
+ [attr.tabIndex]="-1"
1770
+ (focus)="onFocus('retry')"
1771
+ (blur)="onBlur('retry')"
1772
+ (click)="onRetryClick()">
1773
+ <span class="k-icon k-button-icon k-retry k-i-refresh-sm"
1774
+ [attr.aria-label]="retryButtonTitle"
1775
+ [attr.title]="retryButtonTitle">
1776
+ </span>
1777
+ </button>
1921
1778
 
1922
- i18n-invalidMinFileSize="kendo.fileselect.invalidMinFileSize|The text for the invalid min file size restriction message"
1923
- invalidMinFileSize="File size too small."
1779
+ <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"
1780
+ [ngClass]="{ 'k-focus': this.pauseResumeFocused }"
1781
+ [attr.tabIndex]="-1"
1782
+ (focus)="onFocus('pauseResume')"
1783
+ (blur)="onBlur('pauseResume')"
1784
+ (click)="onPauseResumeClick()">
1785
+ <span class="k-icon k-button-icon"
1786
+ [ngClass]="{
1787
+ 'k-i-play-sm': isPaused,
1788
+ 'k-i-pause-sm': !isPaused
1789
+ }"
1790
+ [attr.aria-label]='pauseResumeButtonTitle'
1791
+ [attr.title]='pauseResumeButtonTitle'>
1792
+ </span>
1793
+ </button>
1924
1794
 
1925
- i18n-remove="kendo.fileselect.remove|The text for the Remove button"
1926
- remove="Remove"
1795
+ <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"
1796
+ [ngClass]="{ 'k-focus': this.actionFocused }"
1797
+ [attr.tabIndex]="-1"
1798
+ (focus)="onFocus('action')"
1799
+ (blur)="onBlur('action')"
1800
+ (click)="onRemoveCancelClick($event)">
1801
+ <span class="k-icon k-button-icon"
1802
+ [ngClass]="{
1803
+ 'k-i-cancel': isUploading,
1804
+ 'k-delete k-i-x': !isUploading
1805
+ }"
1806
+ [attr.aria-label]='actionButtonTitle'
1807
+ [attr.title]='actionButtonTitle'>
1808
+ </span>
1809
+ </button>
1810
+ </strong>
1811
+ `, isInline: true, directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
1812
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListItemActionButtonComponent, decorators: [{
1813
+ type: Component,
1814
+ args: [{
1815
+ selector: 'kendo-upload-file-list-item-action-button',
1816
+ template: `
1817
+ <strong class="k-upload-status">
1818
+ <span class="k-upload-pct" *ngIf="isUploading || isPaused">{{progress}}%</span>
1927
1819
 
1928
- i18n-select="kendo.fileselect.select|The text for the Select button"
1929
- select="Select files..."
1930
- >
1931
- </ng-container>
1932
- <div kendoFileSelectInternalDropZone
1933
- [restrictions]="restrictions"
1934
- [multiple]="multiple"
1935
- [disabled]="disabled">
1936
- <div role="button" #fileSelectButton
1937
- [id]="focusableId"
1938
- [attr.aria-label]="textFor('select')"
1939
- [attr.tabindex]="selectButtonTabIndex"
1940
- (focus)="onFileSelectButtonFocus($event)"
1941
- (blur)="onFileSelectButtonBlur($event)"
1942
- class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-upload-button">
1943
- <input #fileSelect kendoFileSelect
1944
- [attr.accept]="accept ? accept : null"
1945
- [dir]="direction"
1946
- [restrictions]="restrictions"
1947
- [multiple]="multiple"
1948
- [disabled]="disabled" />
1949
- <span>{{textFor('select')}}</span>
1950
- </div>
1951
- <div class="k-dropzone-hint">{{textFor('dropFilesHere')}}</div>
1952
- </div>
1953
- <ul kendo-upload-file-list
1954
- class="k-upload-files k-reset"
1955
- *ngIf="showFileList && fileList.count > 0"
1956
- [disabled]="disabled"
1957
- [fileList]="fileList.files"
1958
- [fileTemplate]="fileTemplate"
1959
- [fileInfoTemplate]="fileInfoTemplate">
1960
- </ul>
1961
- `
1962
- }),
1963
- __metadata("design:paramtypes", [UploadService,
1964
- LocalizationService,
1965
- NavigationService,
1966
- DropZoneService,
1967
- NgZone,
1968
- Renderer2,
1969
- ChangeDetectorRef,
1970
- ElementRef])
1971
- ], FileSelectComponent);
1820
+ <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"
1821
+ [ngClass]="{ 'k-focus': this.retryFocused }"
1822
+ [attr.tabIndex]="-1"
1823
+ (focus)="onFocus('retry')"
1824
+ (blur)="onBlur('retry')"
1825
+ (click)="onRetryClick()">
1826
+ <span class="k-icon k-button-icon k-retry k-i-refresh-sm"
1827
+ [attr.aria-label]="retryButtonTitle"
1828
+ [attr.title]="retryButtonTitle">
1829
+ </span>
1830
+ </button>
1972
1831
 
1973
- /**
1974
- * @hidden
1975
- */
1976
- class Messages extends ComponentMessages {
1977
- }
1978
- __decorate([
1979
- Input(),
1980
- __metadata("design:type", String)
1981
- ], Messages.prototype, "cancel", void 0);
1982
- __decorate([
1983
- Input(),
1984
- __metadata("design:type", String)
1985
- ], Messages.prototype, "clearSelectedFiles", void 0);
1986
- __decorate([
1987
- Input(),
1988
- __metadata("design:type", String)
1989
- ], Messages.prototype, "dropFilesHere", void 0);
1990
- __decorate([
1991
- Input(),
1992
- __metadata("design:type", String)
1993
- ], Messages.prototype, "externalDropFilesHere", void 0);
1994
- __decorate([
1995
- Input(),
1996
- __metadata("design:type", String)
1997
- ], Messages.prototype, "filesBatchStatus", void 0);
1998
- __decorate([
1999
- Input(),
2000
- __metadata("design:type", String)
2001
- ], Messages.prototype, "filesBatchStatusFailed", void 0);
2002
- __decorate([
2003
- Input(),
2004
- __metadata("design:type", String)
2005
- ], Messages.prototype, "filesBatchStatusUploaded", void 0);
2006
- __decorate([
2007
- Input(),
2008
- __metadata("design:type", String)
2009
- ], Messages.prototype, "fileStatusFailed", void 0);
2010
- __decorate([
2011
- Input(),
2012
- __metadata("design:type", String)
2013
- ], Messages.prototype, "fileStatusUploaded", void 0);
2014
- __decorate([
2015
- Input(),
2016
- __metadata("design:type", String)
2017
- ], Messages.prototype, "headerStatusPaused", void 0);
2018
- __decorate([
2019
- Input(),
2020
- __metadata("design:type", String)
2021
- ], Messages.prototype, "headerStatusUploaded", void 0);
2022
- __decorate([
2023
- Input(),
2024
- __metadata("design:type", String)
2025
- ], Messages.prototype, "headerStatusUploading", void 0);
2026
- __decorate([
2027
- Input(),
2028
- __metadata("design:type", String)
2029
- ], Messages.prototype, "invalidFileExtension", void 0);
2030
- __decorate([
2031
- Input(),
2032
- __metadata("design:type", String)
2033
- ], Messages.prototype, "invalidMaxFileSize", void 0);
2034
- __decorate([
2035
- Input(),
2036
- __metadata("design:type", String)
2037
- ], Messages.prototype, "invalidMinFileSize", void 0);
2038
- __decorate([
2039
- Input(),
2040
- __metadata("design:type", String)
2041
- ], Messages.prototype, "pause", void 0);
2042
- __decorate([
2043
- Input(),
2044
- __metadata("design:type", String)
2045
- ], Messages.prototype, "remove", void 0);
2046
- __decorate([
2047
- Input(),
2048
- __metadata("design:type", String)
2049
- ], Messages.prototype, "resume", void 0);
2050
- __decorate([
2051
- Input(),
2052
- __metadata("design:type", String)
2053
- ], Messages.prototype, "retry", void 0);
2054
- __decorate([
2055
- Input(),
2056
- __metadata("design:type", String)
2057
- ], Messages.prototype, "select", void 0);
2058
- __decorate([
2059
- Input(),
2060
- __metadata("design:type", String)
2061
- ], Messages.prototype, "uploadSelectedFiles", void 0);
1832
+ <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"
1833
+ [ngClass]="{ 'k-focus': this.pauseResumeFocused }"
1834
+ [attr.tabIndex]="-1"
1835
+ (focus)="onFocus('pauseResume')"
1836
+ (blur)="onBlur('pauseResume')"
1837
+ (click)="onPauseResumeClick()">
1838
+ <span class="k-icon k-button-icon"
1839
+ [ngClass]="{
1840
+ 'k-i-play-sm': isPaused,
1841
+ 'k-i-pause-sm': !isPaused
1842
+ }"
1843
+ [attr.aria-label]='pauseResumeButtonTitle'
1844
+ [attr.title]='pauseResumeButtonTitle'>
1845
+ </span>
1846
+ </button>
2062
1847
 
2063
- var CustomMessagesComponent_1;
2064
- /**
2065
- * Custom component messages override default component messages ([more information and example]({% slug globalization_upload %})).
2066
- *
2067
- * @example
2068
- * ```html-no-run
2069
- * <kendo-fileselect>
2070
- * <kendo-fileselect-messages
2071
- * dropFilesHere="Drop your file here"
2072
- * select="Upload file">
2073
- * </kendo-fileselect-messages>
2074
- * </kendo-fileselect>
2075
- * ```
2076
- */
2077
- let CustomMessagesComponent = CustomMessagesComponent_1 = class CustomMessagesComponent extends Messages {
2078
- constructor(service) {
2079
- super();
2080
- this.service = service;
2081
- }
2082
- get override() {
2083
- return true;
2084
- }
2085
- };
2086
- CustomMessagesComponent = CustomMessagesComponent_1 = __decorate([
2087
- Component({
2088
- providers: [
2089
- {
2090
- provide: Messages,
2091
- useExisting: forwardRef(() => CustomMessagesComponent_1) // tslint:disable-line:no-forward-ref
2092
- }
2093
- ],
2094
- selector: 'kendo-upload-messages, kendo-fileselect-messages, kendo-uploaddropzone-messages',
2095
- template: ``
2096
- }),
2097
- __metadata("design:paramtypes", [LocalizationService])
2098
- ], CustomMessagesComponent);
1848
+ <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"
1849
+ [ngClass]="{ 'k-focus': this.actionFocused }"
1850
+ [attr.tabIndex]="-1"
1851
+ (focus)="onFocus('action')"
1852
+ (blur)="onBlur('action')"
1853
+ (click)="onRemoveCancelClick($event)">
1854
+ <span class="k-icon k-button-icon"
1855
+ [ngClass]="{
1856
+ 'k-i-cancel': isUploading,
1857
+ 'k-delete k-i-x': !isUploading
1858
+ }"
1859
+ [attr.aria-label]='actionButtonTitle'
1860
+ [attr.title]='actionButtonTitle'>
1861
+ </span>
1862
+ </button>
1863
+ </strong>
1864
+ `
1865
+ }]
1866
+ }], ctorParameters: function () { return [{ type: UploadService }, { type: i1$1.LocalizationService }, { type: NavigationService }]; }, propDecorators: { file: [{
1867
+ type: Input
1868
+ }], disabled: [{
1869
+ type: Input
1870
+ }], progress: [{
1871
+ type: Input
1872
+ }] } });
2099
1873
 
2100
1874
  /**
2101
1875
  * @hidden
2102
1876
  */
2103
- const INVALIDMAXFILESIZE = "invalidMaxFileSize";
2104
- /**
2105
- * @hidden
2106
- */
2107
- const INVALIDMINFILESIZE = "invalidMinFileSize";
2108
- /**
2109
- * @hidden
2110
- */
2111
- const INVALIDFILEEXTENSION = "invalidFileExtension";
2112
- const validateFileExtension = (file, allowedExtensions) => {
2113
- if (allowedExtensions.length > 0) {
2114
- if (allowedExtensions.indexOf(file.extension.toLowerCase()) < 0) {
2115
- file.validationErrors = file.validationErrors || [];
2116
- if (file.validationErrors.indexOf(INVALIDFILEEXTENSION) < 0) {
2117
- file.validationErrors.push(INVALIDFILEEXTENSION);
2118
- }
2119
- }
1877
+ class TemplateContextDirective {
1878
+ constructor(viewContainerRef) {
1879
+ this.viewContainerRef = viewContainerRef;
2120
1880
  }
2121
- };
2122
- const validateFileSize = (file, minFileSize, maxFileSize) => {
2123
- if (minFileSize !== 0 && file.size < minFileSize) {
2124
- file.validationErrors = file.validationErrors || [];
2125
- if (file.validationErrors.indexOf(INVALIDMINFILESIZE) < 0) {
2126
- file.validationErrors.push(INVALIDMINFILESIZE);
1881
+ set templateContext(context) {
1882
+ if (this.insertedViewRef) {
1883
+ this.viewContainerRef.remove(this.viewContainerRef.indexOf(this.insertedViewRef));
1884
+ this.insertedViewRef = undefined;
2127
1885
  }
2128
- }
2129
- if (maxFileSize !== 0 && file.size > maxFileSize) {
2130
- file.validationErrors = file.validationErrors || [];
2131
- if (file.validationErrors.indexOf(INVALIDMAXFILESIZE) < 0) {
2132
- file.validationErrors.push(INVALIDMAXFILESIZE);
1886
+ if (context.templateRef) {
1887
+ this.insertedViewRef = this.viewContainerRef.createEmbeddedView(context.templateRef, context);
2133
1888
  }
2134
1889
  }
2135
- };
2136
- const parseAllowedExtensions = (extensions) => {
2137
- const allowedExtensions = extensions.map((ext) => {
2138
- var parsedExt = (ext.substring(0, 1) === ".") ? ext : ("." + ext);
2139
- return parsedExt.toLowerCase();
2140
- });
2141
- return allowedExtensions;
2142
- };
2143
- /**
2144
- * @hidden
2145
- */
2146
- const validateFiles = (files, restrictionInfo) => {
2147
- const allowedExtensions = parseAllowedExtensions(restrictionInfo.allowedExtensions);
2148
- const maxFileSize = restrictionInfo.maxFileSize;
2149
- const minFileSize = restrictionInfo.minFileSize;
2150
- let i;
2151
- for (i = 0; i < files.length; i++) {
2152
- validateFileExtension(files[i], allowedExtensions);
2153
- validateFileSize(files[i], minFileSize, maxFileSize);
2154
- }
2155
- };
1890
+ }
1891
+ TemplateContextDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TemplateContextDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
1892
+ TemplateContextDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: TemplateContextDirective, selector: "[templateContext]", inputs: { templateContext: "templateContext" }, ngImport: i0 });
1893
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TemplateContextDirective, decorators: [{
1894
+ type: Directive,
1895
+ args: [{
1896
+ // eslint-disable-next-line @angular-eslint/directive-selector
1897
+ selector: '[templateContext]'
1898
+ }]
1899
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { templateContext: [{
1900
+ type: Input
1901
+ }] } });
2156
1902
 
2157
1903
  /**
2158
1904
  * @hidden
2159
1905
  */
2160
- class DropZoneBase {
2161
- constructor(element, renderer, hoverClass) {
2162
- this.element = element;
2163
- this.renderer = renderer;
2164
- this.hideIntervalElement = null;
2165
- this.hoverClass = hoverClass;
1906
+ class FileListSingleItemComponent extends FileListItemBase {
1907
+ constructor(localization, uploadService) {
1908
+ super(uploadService);
1909
+ this.localization = localization;
1910
+ this.subscribeUploadProgress((args) => {
1911
+ if (args.files[0].uid === this.file.uid) {
1912
+ this.progressComplete = args.percentComplete;
1913
+ }
1914
+ });
2166
1915
  }
2167
- /**
2168
- * @hidden
2169
- */
2170
- onElementDragEnterListener() {
2171
- this.addClass(this.hoverClass);
2172
- this.lastDragElement = new Date();
2173
- if (!this.hideIntervalElement) {
2174
- this.hideIntervalElement = setInterval(() => {
2175
- if (this.calculateTimeDiff(this.lastDragElement) < 100) {
2176
- return;
2177
- }
2178
- this.removeClass(this.hoverClass);
2179
- clearInterval(this.hideIntervalElement);
2180
- this.hideIntervalElement = null;
2181
- }, 100);
1916
+ get fileStatusText() {
1917
+ const errors = this.file.validationErrors;
1918
+ if (this.file.state === FileState.Uploaded) {
1919
+ return `${this.textFor('fileStatusUploaded')}`;
2182
1920
  }
2183
- return false;
2184
- }
2185
- /**
2186
- * @hidden
2187
- */
2188
- onElementDragOverListener() {
2189
- this.lastDragElement = new Date();
2190
- return false;
1921
+ if (this.file.state === FileState.Failed) {
1922
+ return `${this.textFor('fileStatusFailed')}`;
1923
+ }
1924
+ if (!isPresent(errors)) {
1925
+ return this.getTotalFilesSizeMessage([this.file]);
1926
+ }
1927
+ return this.getFileValidationMessage(this.file);
2191
1928
  }
2192
- calculateTimeDiff(prevEvent) {
2193
- return new Date().getTime() - prevEvent.getTime();
1929
+ get showProgress() {
1930
+ const showProgress = this.file.state === FileState.Uploading || this.file.state === FileState.Paused;
1931
+ return showProgress ? 'active' : 'inactive';
2194
1932
  }
2195
- addClass(className) {
2196
- this.renderer.addClass(this.element.nativeElement, className);
1933
+ get fileGroupClass() {
1934
+ return getFileGroupCssClass(this.file.extension ? this.file.extension : '');
2197
1935
  }
2198
- removeClass(className) {
2199
- this.renderer.removeClass(this.element.nativeElement, className);
1936
+ get isUploadSuccessful() {
1937
+ return this.file.state === FileState.Uploaded;
2200
1938
  }
2201
- }
2202
- __decorate([
2203
- HostListener('dragenter'),
2204
- __metadata("design:type", Function),
2205
- __metadata("design:paramtypes", []),
2206
- __metadata("design:returntype", Boolean)
2207
- ], DropZoneBase.prototype, "onElementDragEnterListener", null);
2208
- __decorate([
2209
- HostListener('dragover'),
2210
- __metadata("design:type", Function),
2211
- __metadata("design:paramtypes", []),
2212
- __metadata("design:returntype", Boolean)
2213
- ], DropZoneBase.prototype, "onElementDragOverListener", null);
2214
-
2215
- /**
2216
- * @hidden
2217
- */
2218
- let DropZoneInternalDirective = class DropZoneInternalDirective extends DropZoneBase {
2219
- constructor(element, renderer, ngZone, uploadService) {
2220
- super(element, renderer, 'k-dropzone-hover');
2221
- this.ngZone = ngZone;
2222
- this.uploadService = uploadService;
2223
- this.initialClassName = true;
2224
- this.hideIntervalDocument = null;
2225
- this.activeClass = 'k-dropzone-active';
2226
- this.ngZone.runOutsideAngular(() => {
2227
- this.unsubscribeDocumentDragEnter = this.renderer.listen('document', 'dragenter', () => this.onDocumentDragEnter());
2228
- this.unsubscribeDocumentDragOver = this.renderer.listen('document', 'dragover', () => this.onDocumentDragOver());
2229
- });
1939
+ get isUploadFailed() {
1940
+ return this.file.state === FileState.Failed;
2230
1941
  }
2231
- ngOnDestroy() {
2232
- this.ngZone.runOutsideAngular(() => {
2233
- if (this.unsubscribeDocumentDragEnter) {
2234
- this.unsubscribeDocumentDragEnter();
2235
- }
2236
- if (this.unsubscribeDocumentDragOver) {
2237
- this.unsubscribeDocumentDragOver();
2238
- }
2239
- });
1942
+ get isNotYetUploaded() {
1943
+ return !this.isUploadFailed && !this.isUploadSuccessful;
2240
1944
  }
2241
- onDocumentDragEnter() {
2242
- this.addClass(this.activeClass);
2243
- this.lastDragDocument = new Date();
2244
- if (!this.hideIntervalDocument) {
2245
- this.hideIntervalDocument = setInterval(() => {
2246
- if (this.calculateTimeDiff(this.lastDragDocument) < 100) {
2247
- return;
2248
- }
2249
- this.removeClass(this.activeClass);
2250
- clearInterval(this.hideIntervalDocument);
2251
- this.hideIntervalDocument = null;
2252
- }, 100);
2253
- }
2254
- return false;
2255
- }
2256
- /**
2257
- * @hidden
2258
- */
2259
- onDocumentDragOver() {
2260
- this.lastDragDocument = new Date();
2261
- return false;
2262
- }
2263
- onDropListener(event) {
2264
- let droppedFiles = event.dataTransfer.files;
2265
- if (droppedFiles.length > 0 && !this.disabled) {
2266
- let files = getAllFileInfo(droppedFiles);
2267
- files = assignGuidToFiles(files, !this.uploadService.async.batch);
2268
- if (!this.multiple) {
2269
- files.splice(1, files.length - 1);
2270
- this.uploadService.clearFiles();
2271
- }
2272
- validateFiles(files, this.restrictions);
2273
- this.uploadService.addFiles(files);
2274
- }
2275
- return false;
2276
- }
2277
- };
2278
- __decorate([
2279
- Input(),
2280
- __metadata("design:type", Boolean)
2281
- ], DropZoneInternalDirective.prototype, "disabled", void 0);
2282
- __decorate([
2283
- Input(),
2284
- __metadata("design:type", Boolean)
2285
- ], DropZoneInternalDirective.prototype, "multiple", void 0);
2286
- __decorate([
2287
- Input(),
2288
- __metadata("design:type", Object)
2289
- ], DropZoneInternalDirective.prototype, "restrictions", void 0);
2290
- __decorate([
2291
- HostBinding('class.k-dropzone'),
2292
- __metadata("design:type", Boolean)
2293
- ], DropZoneInternalDirective.prototype, "initialClassName", void 0);
2294
- __decorate([
2295
- HostListener('drop', ['$event']),
2296
- __metadata("design:type", Function),
2297
- __metadata("design:paramtypes", [Object]),
2298
- __metadata("design:returntype", Boolean)
2299
- ], DropZoneInternalDirective.prototype, "onDropListener", null);
2300
- DropZoneInternalDirective = __decorate([
2301
- Directive({
2302
- selector: `
2303
- [kendoUploadInternalDropZone],
2304
- [kendoFileSelectInternalDropZone]
1945
+ }
1946
+ FileListSingleItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListSingleItemComponent, deps: [{ token: i1$1.LocalizationService }, { token: UploadService }], target: i0.ɵɵFactoryTarget.Component });
1947
+ FileListSingleItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FileListSingleItemComponent, selector: "kendo-upload-file-list-single-item", inputs: { disabled: "disabled", file: "file", fileInfoTemplate: "fileInfoTemplate" }, usesInheritance: true, ngImport: i0, template: `
1948
+ <div class="k-progressbar" [@progressState]="showProgress">
1949
+ <span class="k-progress" [style.width]="progressComplete + '%'"></span>
1950
+ </div>
1951
+ <span class="k-file-group-wrapper">
1952
+ <span class="k-file-group k-icon" [ngClass]="fileGroupClass"></span>
1953
+ </span>
1954
+ <span class="k-file-name-size-wrapper">
1955
+ <ng-container *ngIf="!fileInfoTemplate">
1956
+ <span class="k-file-name" [title]="file.name">{{ file.name }}</span>
1957
+ <span [ngClass]="{
1958
+ 'k-file-validation-message': file.validationErrors,
1959
+ 'k-file-size': !file.validationErrors && isNotYetUploaded,
1960
+ 'k-text-success': isUploadSuccessful,
1961
+ 'k-text-error': file.validationErrors || isUploadFailed,
1962
+ 'k-file-information': isUploadSuccessful || isUploadFailed
1963
+ }"
1964
+ >{{fileStatusText}}</span>
1965
+ </ng-container>
1966
+ <ng-template *ngIf="fileInfoTemplate"
1967
+ [templateContext]="{
1968
+ templateRef: fileInfoTemplate.templateRef,
1969
+ state: file.state,
1970
+ $implicit: [file]
1971
+ }">
1972
+ </ng-template>
1973
+ </span>
1974
+ <kendo-upload-file-list-item-action-button
1975
+ [file]='file'
1976
+ [disabled]='disabled'
1977
+ [progress]='progressComplete'>
1978
+ </kendo-upload-file-list-item-action-button>
1979
+ `, isInline: true, components: [{ type: FileListItemActionButtonComponent, selector: "kendo-upload-file-list-item-action-button", inputs: ["file", "disabled", "progress"] }], directives: [{ type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: TemplateContextDirective, selector: "[templateContext]", inputs: ["templateContext"] }], animations: [
1980
+ trigger('progressState', [
1981
+ state('active', style({ opacity: 1 })),
1982
+ state('inactive', style({ opacity: 0 })),
1983
+ transition('void => active', style({ opacity: 0 })),
1984
+ transition('inactive => active', style({ opacity: 1 })),
1985
+ transition('active => inactive', animate('1s 2s ease-out'))
1986
+ ])
1987
+ ] });
1988
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListSingleItemComponent, decorators: [{
1989
+ type: Component,
1990
+ args: [{
1991
+ animations: [
1992
+ trigger('progressState', [
1993
+ state('active', style({ opacity: 1 })),
1994
+ state('inactive', style({ opacity: 0 })),
1995
+ transition('void => active', style({ opacity: 0 })),
1996
+ transition('inactive => active', style({ opacity: 1 })),
1997
+ transition('active => inactive', animate('1s 2s ease-out'))
1998
+ ])
1999
+ ],
2000
+ selector: 'kendo-upload-file-list-single-item',
2001
+ template: `
2002
+ <div class="k-progressbar" [@progressState]="showProgress">
2003
+ <span class="k-progress" [style.width]="progressComplete + '%'"></span>
2004
+ </div>
2005
+ <span class="k-file-group-wrapper">
2006
+ <span class="k-file-group k-icon" [ngClass]="fileGroupClass"></span>
2007
+ </span>
2008
+ <span class="k-file-name-size-wrapper">
2009
+ <ng-container *ngIf="!fileInfoTemplate">
2010
+ <span class="k-file-name" [title]="file.name">{{ file.name }}</span>
2011
+ <span [ngClass]="{
2012
+ 'k-file-validation-message': file.validationErrors,
2013
+ 'k-file-size': !file.validationErrors && isNotYetUploaded,
2014
+ 'k-text-success': isUploadSuccessful,
2015
+ 'k-text-error': file.validationErrors || isUploadFailed,
2016
+ 'k-file-information': isUploadSuccessful || isUploadFailed
2017
+ }"
2018
+ >{{fileStatusText}}</span>
2019
+ </ng-container>
2020
+ <ng-template *ngIf="fileInfoTemplate"
2021
+ [templateContext]="{
2022
+ templateRef: fileInfoTemplate.templateRef,
2023
+ state: file.state,
2024
+ $implicit: [file]
2025
+ }">
2026
+ </ng-template>
2027
+ </span>
2028
+ <kendo-upload-file-list-item-action-button
2029
+ [file]='file'
2030
+ [disabled]='disabled'
2031
+ [progress]='progressComplete'>
2032
+ </kendo-upload-file-list-item-action-button>
2305
2033
  `
2306
- }),
2307
- __metadata("design:paramtypes", [ElementRef,
2308
- Renderer2,
2309
- NgZone,
2310
- UploadService])
2311
- ], DropZoneInternalDirective);
2034
+ }]
2035
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: UploadService }]; }, propDecorators: { disabled: [{
2036
+ type: Input
2037
+ }], file: [{
2038
+ type: Input
2039
+ }], fileInfoTemplate: [{
2040
+ type: Input
2041
+ }] } });
2312
2042
 
2313
2043
  /**
2314
2044
  * @hidden
2315
2045
  */
2316
- let FileListItemDirective = class FileListItemDirective {
2317
- constructor(el, navigationService, uploadService) {
2318
- this.navigationService = navigationService;
2319
- this.uploadService = uploadService;
2320
- this.fileClass = true;
2321
- this.focused = false;
2322
- this.element = el;
2323
- }
2324
- focus() {
2325
- this.element.nativeElement.focus();
2326
- }
2327
- get uidAttribute() {
2328
- return this.files[0].uid;
2329
- }
2330
- get tabIndex() {
2331
- return "-1";
2332
- }
2333
- get kFileError() {
2334
- return this.files[0].state === FileState.Failed;
2046
+ class FileListMultipleItemsComponent extends FileListItemBase {
2047
+ constructor(localization, uploadService) {
2048
+ super(uploadService);
2049
+ this.localization = localization;
2050
+ this.subscribeUploadProgress((args) => {
2051
+ if (args.files[0].uid === this.files[0].uid) {
2052
+ this.progressComplete = args.percentComplete;
2053
+ }
2054
+ });
2335
2055
  }
2336
- get kFileInvalid() {
2337
- return filesHaveValidationErrors(this.files);
2056
+ get showProgress() {
2057
+ const showProgress = this.files[0].state === FileState.Uploading || this.files[0].state === FileState.Paused;
2058
+ return showProgress ? 'active' : 'inactive';
2338
2059
  }
2339
- get kFileProgress() {
2340
- return this.files[0].state === FileState.Uploading ||
2341
- this.files[0].state === FileState.Paused;
2060
+ ngOnInit() {
2061
+ this.filesHaveErrors = super.filesHaveValidationErrors(this.files);
2342
2062
  }
2343
- get kFileSuccess() {
2344
- if (this.uploadService.component === 'Upload') {
2345
- return this.files[0].state === FileState.Uploaded ||
2346
- this.files[0].state === FileState.Initial;
2063
+ fileStatusText(file) {
2064
+ const errors = file.validationErrors;
2065
+ if (!isPresent(errors)) {
2066
+ return this.getTotalFilesSizeMessage([file]);
2347
2067
  }
2348
- return false;
2349
- }
2350
- get kStateFocused() {
2351
- return this.focused;
2068
+ return this.getFileValidationMessage(file);
2352
2069
  }
2353
- onFocus() {
2354
- this.focused = true;
2070
+ get batchStatusText() {
2071
+ const state = this.files[0].state;
2072
+ const fileCount = this.files.length;
2073
+ if (state === FileState.Uploaded) {
2074
+ return `${fileCount} ${this.textFor('filesBatchStatusUploaded')}`;
2075
+ }
2076
+ if (state === FileState.Failed) {
2077
+ return `${fileCount} ${this.textFor('filesBatchStatusFailed')}`;
2078
+ }
2079
+ return `${fileCount} ${this.textFor('filesBatchStatus')}`;
2355
2080
  }
2356
- onBlur() {
2357
- this.focused = false;
2081
+ get isUploadSuccessful() {
2082
+ return this.files[0].state === FileState.Uploaded;
2358
2083
  }
2359
- onClick(event) {
2360
- if (!isFocusable(event.target) && !hasClasses(event.target, IGNORE_TARGET_CLASSES)) {
2361
- this.navigationService.focusedIndex = this.index;
2362
- }
2084
+ get isUploadFailed() {
2085
+ return this.files[0].state === FileState.Failed;
2363
2086
  }
2364
- };
2365
- __decorate([
2366
- Input(),
2367
- __metadata("design:type", Array)
2368
- ], FileListItemDirective.prototype, "files", void 0);
2369
- __decorate([
2370
- Input(),
2371
- __metadata("design:type", Number)
2372
- ], FileListItemDirective.prototype, "index", void 0);
2373
- __decorate([
2374
- HostBinding('class.k-file'),
2375
- __metadata("design:type", Boolean)
2376
- ], FileListItemDirective.prototype, "fileClass", void 0);
2377
- __decorate([
2378
- HostBinding('attr.data-uid'),
2379
- __metadata("design:type", String),
2380
- __metadata("design:paramtypes", [])
2381
- ], FileListItemDirective.prototype, "uidAttribute", null);
2382
- __decorate([
2383
- HostBinding('attr.tabIndex'),
2384
- __metadata("design:type", String),
2385
- __metadata("design:paramtypes", [])
2386
- ], FileListItemDirective.prototype, "tabIndex", null);
2387
- __decorate([
2388
- HostBinding('class.k-file-error'),
2389
- __metadata("design:type", Boolean),
2390
- __metadata("design:paramtypes", [])
2391
- ], FileListItemDirective.prototype, "kFileError", null);
2392
- __decorate([
2393
- HostBinding('class.k-file-invalid'),
2394
- __metadata("design:type", Boolean),
2395
- __metadata("design:paramtypes", [])
2396
- ], FileListItemDirective.prototype, "kFileInvalid", null);
2397
- __decorate([
2398
- HostBinding('class.k-file-progress'),
2399
- __metadata("design:type", Boolean),
2400
- __metadata("design:paramtypes", [])
2401
- ], FileListItemDirective.prototype, "kFileProgress", null);
2402
- __decorate([
2403
- HostBinding('class.k-file-success'),
2404
- __metadata("design:type", Boolean),
2405
- __metadata("design:paramtypes", [])
2406
- ], FileListItemDirective.prototype, "kFileSuccess", null);
2407
- __decorate([
2408
- HostBinding('class.k-state-focused'),
2409
- __metadata("design:type", Boolean),
2410
- __metadata("design:paramtypes", [])
2411
- ], FileListItemDirective.prototype, "kStateFocused", null);
2412
- __decorate([
2413
- HostListener("focus"),
2414
- __metadata("design:type", Function),
2415
- __metadata("design:paramtypes", []),
2416
- __metadata("design:returntype", void 0)
2417
- ], FileListItemDirective.prototype, "onFocus", null);
2418
- __decorate([
2419
- HostListener("blur"),
2420
- __metadata("design:type", Function),
2421
- __metadata("design:paramtypes", []),
2422
- __metadata("design:returntype", void 0)
2423
- ], FileListItemDirective.prototype, "onBlur", null);
2424
- __decorate([
2425
- HostListener('click', ['$event']),
2426
- __metadata("design:type", Function),
2427
- __metadata("design:paramtypes", [Object]),
2428
- __metadata("design:returntype", void 0)
2429
- ], FileListItemDirective.prototype, "onClick", null);
2430
- FileListItemDirective = __decorate([
2431
- Directive({
2432
- selector: '[kendoUploadFileListItem]'
2433
- }),
2434
- __metadata("design:paramtypes", [ElementRef,
2435
- NavigationService,
2436
- UploadService])
2437
- ], FileListItemDirective);
2087
+ }
2088
+ FileListMultipleItemsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListMultipleItemsComponent, deps: [{ token: i1$1.LocalizationService }, { token: UploadService }], target: i0.ɵɵFactoryTarget.Component });
2089
+ FileListMultipleItemsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FileListMultipleItemsComponent, selector: "kendo-upload-file-list-multiple-items", inputs: { disabled: "disabled", files: "files", fileInfoTemplate: "fileInfoTemplate" }, usesInheritance: true, ngImport: i0, template: `
2090
+ <div class="k-progressbar" [@progressState]="showProgress">
2091
+ <span class="k-progress" [style.width]="progressComplete + '%'"></span>
2092
+ </div>
2093
+ <span class="k-multiple-files-group-wrapper">
2094
+ <span class="k-file-group k-icon k-i-copy"></span>
2095
+ </span>
2096
+ <span class="k-multiple-files-wrapper">
2097
+ <ng-container *ngIf="!fileInfoTemplate">
2098
+ <span *ngFor="let file of files" class="k-file-name-size-wrapper">
2099
+ <span [title]="file.name" class="k-file-name">
2100
+ {{file.name}}
2101
+ </span>
2102
+ <span [ngClass]="{
2103
+ 'k-text-error': file.validationErrors,
2104
+ 'k-file-validation-message': file.validationErrors,
2105
+ 'k-file-size': !file.validationErrors
2106
+ }"
2107
+ >{{fileStatusText(file)}}</span>
2108
+ </span>
2109
+ <span class="k-file-information"
2110
+ [ngClass]="{
2111
+ 'k-text-success': isUploadSuccessful,
2112
+ 'k-text-error': isUploadFailed
2113
+ }"
2114
+ >{{batchStatusText}}</span>
2115
+ </ng-container>
2116
+ <ng-template *ngIf="fileInfoTemplate"
2117
+ [templateContext]="{
2118
+ templateRef: fileInfoTemplate.templateRef,
2119
+ state: files[0].state,
2120
+ $implicit: files
2121
+ }">
2122
+ </ng-template>
2123
+ </span>
2124
+ <kendo-upload-file-list-item-action-button
2125
+ [file]='files[0]'
2126
+ [disabled]='disabled'
2127
+ [progress]='progressComplete'>
2128
+ </kendo-upload-file-list-item-action-button>
2129
+ `, isInline: true, components: [{ type: FileListItemActionButtonComponent, selector: "kendo-upload-file-list-item-action-button", inputs: ["file", "disabled", "progress"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: TemplateContextDirective, selector: "[templateContext]", inputs: ["templateContext"] }], animations: [
2130
+ trigger('progressState', [
2131
+ state('active', style({ opacity: 1 })),
2132
+ state('inactive', style({ opacity: 0 })),
2133
+ transition('void => active', style({ opacity: 0 })),
2134
+ transition('inactive => active', style({ opacity: 1 })),
2135
+ transition('active => inactive', animate('1s 2s ease-out'))
2136
+ ])
2137
+ ] });
2138
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListMultipleItemsComponent, decorators: [{
2139
+ type: Component,
2140
+ args: [{
2141
+ animations: [
2142
+ trigger('progressState', [
2143
+ state('active', style({ opacity: 1 })),
2144
+ state('inactive', style({ opacity: 0 })),
2145
+ transition('void => active', style({ opacity: 0 })),
2146
+ transition('inactive => active', style({ opacity: 1 })),
2147
+ transition('active => inactive', animate('1s 2s ease-out'))
2148
+ ])
2149
+ ],
2150
+ selector: 'kendo-upload-file-list-multiple-items',
2151
+ template: `
2152
+ <div class="k-progressbar" [@progressState]="showProgress">
2153
+ <span class="k-progress" [style.width]="progressComplete + '%'"></span>
2154
+ </div>
2155
+ <span class="k-multiple-files-group-wrapper">
2156
+ <span class="k-file-group k-icon k-i-copy"></span>
2157
+ </span>
2158
+ <span class="k-multiple-files-wrapper">
2159
+ <ng-container *ngIf="!fileInfoTemplate">
2160
+ <span *ngFor="let file of files" class="k-file-name-size-wrapper">
2161
+ <span [title]="file.name" class="k-file-name">
2162
+ {{file.name}}
2163
+ </span>
2164
+ <span [ngClass]="{
2165
+ 'k-text-error': file.validationErrors,
2166
+ 'k-file-validation-message': file.validationErrors,
2167
+ 'k-file-size': !file.validationErrors
2168
+ }"
2169
+ >{{fileStatusText(file)}}</span>
2170
+ </span>
2171
+ <span class="k-file-information"
2172
+ [ngClass]="{
2173
+ 'k-text-success': isUploadSuccessful,
2174
+ 'k-text-error': isUploadFailed
2175
+ }"
2176
+ >{{batchStatusText}}</span>
2177
+ </ng-container>
2178
+ <ng-template *ngIf="fileInfoTemplate"
2179
+ [templateContext]="{
2180
+ templateRef: fileInfoTemplate.templateRef,
2181
+ state: files[0].state,
2182
+ $implicit: files
2183
+ }">
2184
+ </ng-template>
2185
+ </span>
2186
+ <kendo-upload-file-list-item-action-button
2187
+ [file]='files[0]'
2188
+ [disabled]='disabled'
2189
+ [progress]='progressComplete'>
2190
+ </kendo-upload-file-list-item-action-button>
2191
+ `
2192
+ }]
2193
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: UploadService }]; }, propDecorators: { disabled: [{
2194
+ type: Input
2195
+ }], files: [{
2196
+ type: Input
2197
+ }], fileInfoTemplate: [{
2198
+ type: Input
2199
+ }] } });
2438
2200
 
2201
+ /* eslint-disable @angular-eslint/component-selector */
2439
2202
  /**
2440
2203
  * @hidden
2441
2204
  */
2442
- let FileListComponent = class FileListComponent {
2205
+ class FileListComponent {
2443
2206
  constructor(uploadService, navigation) {
2444
2207
  this.uploadService = uploadService;
2445
2208
  this.navigation = navigation;
@@ -2487,31 +2250,9 @@ let FileListComponent = class FileListComponent {
2487
2250
  this.focusSubscription.unsubscribe();
2488
2251
  this.actionSubscription.unsubscribe();
2489
2252
  }
2490
- };
2491
- __decorate([
2492
- Input(),
2493
- __metadata("design:type", Boolean)
2494
- ], FileListComponent.prototype, "disabled", void 0);
2495
- __decorate([
2496
- Input(),
2497
- __metadata("design:type", Array)
2498
- ], FileListComponent.prototype, "fileList", void 0);
2499
- __decorate([
2500
- Input(),
2501
- __metadata("design:type", FileTemplateDirective)
2502
- ], FileListComponent.prototype, "fileTemplate", void 0);
2503
- __decorate([
2504
- Input(),
2505
- __metadata("design:type", FileInfoTemplateDirective)
2506
- ], FileListComponent.prototype, "fileInfoTemplate", void 0);
2507
- __decorate([
2508
- ViewChildren(FileListItemDirective),
2509
- __metadata("design:type", QueryList)
2510
- ], FileListComponent.prototype, "fileListItems", void 0);
2511
- FileListComponent = __decorate([
2512
- Component({
2513
- selector: '[kendo-upload-file-list]',
2514
- template: `
2253
+ }
2254
+ FileListComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListComponent, deps: [{ token: UploadService }, { token: NavigationService }], target: i0.ɵɵFactoryTarget.Component });
2255
+ FileListComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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: `
2515
2256
  <ng-template ngFor
2516
2257
  [ngForOf]="fileList"
2517
2258
  let-files
@@ -2539,623 +2280,1176 @@ FileListComponent = __decorate([
2539
2280
  }"></ng-template>
2540
2281
  </li>
2541
2282
  </ng-template>
2542
- `
2543
- }),
2544
- __metadata("design:paramtypes", [UploadService,
2545
- NavigationService])
2546
- ], FileListComponent);
2547
-
2548
- /**
2549
- * @hidden
2550
- */
2551
- let FileListItemActionButtonComponent = class FileListItemActionButtonComponent {
2552
- constructor(uploadService, localization, navigation) {
2553
- this.uploadService = uploadService;
2554
- this.localization = localization;
2555
- this.navigation = navigation;
2556
- this.actionFocused = false;
2557
- this.retryFocused = false;
2558
- this.pauseResumeFocused = false;
2559
- }
2560
- onFocus(type) {
2561
- if (type === 'action') {
2562
- this.actionFocused = true;
2563
- }
2564
- if (type === 'retry') {
2565
- this.retryFocused = true;
2566
- }
2567
- if (type === 'pauseResume') {
2568
- this.pauseResumeFocused = true;
2569
- }
2283
+ `, 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: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: FileListItemDirective, selector: "[kendoUploadFileListItem]", inputs: ["files", "index"] }, { type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: TemplateContextDirective, selector: "[templateContext]", inputs: ["templateContext"] }] });
2284
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListComponent, decorators: [{
2285
+ type: Component,
2286
+ args: [{
2287
+ selector: '[kendo-upload-file-list]',
2288
+ template: `
2289
+ <ng-template ngFor
2290
+ [ngForOf]="fileList"
2291
+ let-files
2292
+ let-index="index">
2293
+ <li kendoUploadFileListItem [files]='files' [index]='index'>
2294
+ <kendo-upload-file-list-single-item
2295
+ class='k-file-single'
2296
+ *ngIf='files.length === 1 && !fileTemplate'
2297
+ [disabled]='disabled'
2298
+ [file]='files[0]'
2299
+ [fileInfoTemplate]="fileInfoTemplate">
2300
+ </kendo-upload-file-list-single-item>
2301
+ <kendo-upload-file-list-multiple-items
2302
+ class='k-file-multiple'
2303
+ *ngIf='files.length > 1 && !fileTemplate'
2304
+ [disabled]='disabled'
2305
+ [files]='files'
2306
+ [fileInfoTemplate]="fileInfoTemplate">
2307
+ </kendo-upload-file-list-multiple-items>
2308
+ <ng-template *ngIf="fileTemplate"
2309
+ [templateContext]="{
2310
+ templateRef: fileTemplate.templateRef,
2311
+ state: files[0].state,
2312
+ $implicit: files
2313
+ }"></ng-template>
2314
+ </li>
2315
+ </ng-template>
2316
+ `
2317
+ }]
2318
+ }], ctorParameters: function () { return [{ type: UploadService }, { type: NavigationService }]; }, propDecorators: { disabled: [{
2319
+ type: Input
2320
+ }], fileList: [{
2321
+ type: Input
2322
+ }], fileTemplate: [{
2323
+ type: Input
2324
+ }], fileInfoTemplate: [{
2325
+ type: Input
2326
+ }], fileListItems: [{
2327
+ type: ViewChildren,
2328
+ args: [FileListItemDirective]
2329
+ }] } });
2330
+
2331
+ /**
2332
+ * @hidden
2333
+ */
2334
+ class Messages extends ComponentMessages {
2335
+ }
2336
+ Messages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2337
+ Messages.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", 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 });
2338
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Messages, decorators: [{
2339
+ type: Directive
2340
+ }], propDecorators: { cancel: [{
2341
+ type: Input
2342
+ }], clearSelectedFiles: [{
2343
+ type: Input
2344
+ }], dropFilesHere: [{
2345
+ type: Input
2346
+ }], externalDropFilesHere: [{
2347
+ type: Input
2348
+ }], filesBatchStatus: [{
2349
+ type: Input
2350
+ }], filesBatchStatusFailed: [{
2351
+ type: Input
2352
+ }], filesBatchStatusUploaded: [{
2353
+ type: Input
2354
+ }], fileStatusFailed: [{
2355
+ type: Input
2356
+ }], fileStatusUploaded: [{
2357
+ type: Input
2358
+ }], headerStatusPaused: [{
2359
+ type: Input
2360
+ }], headerStatusUploaded: [{
2361
+ type: Input
2362
+ }], headerStatusUploading: [{
2363
+ type: Input
2364
+ }], invalidFileExtension: [{
2365
+ type: Input
2366
+ }], invalidMaxFileSize: [{
2367
+ type: Input
2368
+ }], invalidMinFileSize: [{
2369
+ type: Input
2370
+ }], pause: [{
2371
+ type: Input
2372
+ }], remove: [{
2373
+ type: Input
2374
+ }], resume: [{
2375
+ type: Input
2376
+ }], retry: [{
2377
+ type: Input
2378
+ }], select: [{
2379
+ type: Input
2380
+ }], uploadSelectedFiles: [{
2381
+ type: Input
2382
+ }] } });
2383
+
2384
+ /**
2385
+ * @hidden
2386
+ */
2387
+ class LocalizedMessagesDirective extends Messages {
2388
+ constructor(service) {
2389
+ super();
2390
+ this.service = service;
2570
2391
  }
2571
- onBlur(type) {
2572
- if (type === 'retry') {
2573
- this.retryFocused = false;
2574
- }
2575
- if (type === 'action') {
2576
- this.actionFocused = false;
2577
- }
2578
- if (type === 'pauseResume') {
2579
- this.pauseResumeFocused = false;
2392
+ }
2393
+ LocalizedMessagesDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LocalizedMessagesDirective, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Directive });
2394
+ LocalizedMessagesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: LocalizedMessagesDirective, selector: "\n [kendoUploadLocalizedMessages],\n [kendoFileSelectLocalizedMessages],\n [kendoUploadDropZoneLocalizedMessages]\n ", providers: [
2395
+ {
2396
+ provide: Messages,
2397
+ useExisting: forwardRef(() => LocalizedMessagesDirective)
2398
+ }
2399
+ ], usesInheritance: true, ngImport: i0 });
2400
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
2401
+ type: Directive,
2402
+ args: [{
2403
+ providers: [
2404
+ {
2405
+ provide: Messages,
2406
+ useExisting: forwardRef(() => LocalizedMessagesDirective)
2407
+ }
2408
+ ],
2409
+ selector: `
2410
+ [kendoUploadLocalizedMessages],
2411
+ [kendoFileSelectLocalizedMessages],
2412
+ [kendoUploadDropZoneLocalizedMessages]
2413
+ `
2414
+ }]
2415
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
2416
+
2417
+ /**
2418
+ * @hidden
2419
+ */
2420
+ const INVALIDMAXFILESIZE = "invalidMaxFileSize";
2421
+ /**
2422
+ * @hidden
2423
+ */
2424
+ const INVALIDMINFILESIZE = "invalidMinFileSize";
2425
+ /**
2426
+ * @hidden
2427
+ */
2428
+ const INVALIDFILEEXTENSION = "invalidFileExtension";
2429
+ const validateFileExtension = (file, allowedExtensions) => {
2430
+ if (allowedExtensions.length > 0) {
2431
+ if (allowedExtensions.indexOf(file.extension.toLowerCase()) < 0) {
2432
+ file.validationErrors = file.validationErrors || [];
2433
+ if (file.validationErrors.indexOf(INVALIDFILEEXTENSION) < 0) {
2434
+ file.validationErrors.push(INVALIDFILEEXTENSION);
2435
+ }
2580
2436
  }
2581
2437
  }
2582
- onRetryClick() {
2583
- if (this.disabled) {
2584
- return;
2438
+ };
2439
+ const validateFileSize = (file, minFileSize, maxFileSize) => {
2440
+ if (minFileSize !== 0 && file.size < minFileSize) {
2441
+ file.validationErrors = file.validationErrors || [];
2442
+ if (file.validationErrors.indexOf(INVALIDMINFILESIZE) < 0) {
2443
+ file.validationErrors.push(INVALIDMINFILESIZE);
2585
2444
  }
2586
- this.uploadService.retryFiles(this.file.uid);
2587
2445
  }
2588
- onRemoveCancelClick(event) {
2589
- if (this.disabled) {
2590
- return;
2591
- }
2592
- event.stopImmediatePropagation();
2593
- const uid = this.file.uid;
2594
- if (this.file.state === FileState.Uploading) {
2595
- this.uploadService.cancelFiles(uid);
2596
- }
2597
- else {
2598
- this.uploadService.removeFiles(uid);
2446
+ if (maxFileSize !== 0 && file.size > maxFileSize) {
2447
+ file.validationErrors = file.validationErrors || [];
2448
+ if (file.validationErrors.indexOf(INVALIDMAXFILESIZE) < 0) {
2449
+ file.validationErrors.push(INVALIDMAXFILESIZE);
2599
2450
  }
2600
- this.navigation.focusSelectButton();
2601
2451
  }
2602
- onPauseResumeClick() {
2603
- if (this.disabled) {
2604
- return;
2605
- }
2606
- const uid = this.file.uid;
2607
- if (this.file.state === FileState.Paused) {
2608
- this.uploadService.resumeFile(uid);
2609
- }
2610
- else {
2611
- this.uploadService.pauseFile(uid);
2612
- }
2452
+ };
2453
+ const parseAllowedExtensions = (extensions) => {
2454
+ const allowedExtensions = extensions.map((ext) => {
2455
+ var parsedExt = (ext.substring(0, 1) === ".") ? ext : ("." + ext);
2456
+ return parsedExt.toLowerCase();
2457
+ });
2458
+ return allowedExtensions;
2459
+ };
2460
+ /**
2461
+ * @hidden
2462
+ */
2463
+ const validateFiles = (files, restrictionInfo) => {
2464
+ const allowedExtensions = parseAllowedExtensions(restrictionInfo.allowedExtensions);
2465
+ const maxFileSize = restrictionInfo.maxFileSize;
2466
+ const minFileSize = restrictionInfo.minFileSize;
2467
+ let i;
2468
+ for (i = 0; i < files.length; i++) {
2469
+ validateFileExtension(files[i], allowedExtensions);
2470
+ validateFileSize(files[i], minFileSize, maxFileSize);
2613
2471
  }
2614
- get actionButtonTitle() {
2615
- if (this.file.state === FileState.Uploading) {
2616
- return this.localization.get('cancel');
2472
+ };
2473
+
2474
+ /**
2475
+ * @hidden
2476
+ */
2477
+ class DropZoneBase {
2478
+ constructor(element, renderer, cssClass) {
2479
+ this.element = element;
2480
+ this.renderer = renderer;
2481
+ this.hideIntervalElement = null;
2482
+ this.hoverClass = cssClass;
2483
+ }
2484
+ /**
2485
+ * @hidden
2486
+ */
2487
+ onElementDragEnterListener() {
2488
+ this.addClass(this.hoverClass);
2489
+ this.lastDragElement = new Date();
2490
+ if (!this.hideIntervalElement) {
2491
+ this.hideIntervalElement = setInterval(() => {
2492
+ if (this.calculateTimeDiff(this.lastDragElement) < 100) {
2493
+ return;
2494
+ }
2495
+ this.removeClass(this.hoverClass);
2496
+ clearInterval(this.hideIntervalElement);
2497
+ this.hideIntervalElement = null;
2498
+ }, 100);
2617
2499
  }
2618
- return this.localization.get('remove');
2500
+ return false;
2619
2501
  }
2620
- get retryButtonTitle() {
2621
- return this.localization.get('retry');
2502
+ /**
2503
+ * @hidden
2504
+ */
2505
+ onElementDragOverListener() {
2506
+ this.lastDragElement = new Date();
2507
+ return false;
2622
2508
  }
2623
- get pauseResumeButtonTitle() {
2624
- if (this.file.state === FileState.Uploading) {
2625
- return this.localization.get('pause');
2626
- }
2627
- return this.localization.get('resume');
2509
+ calculateTimeDiff(prevEvent) {
2510
+ return new Date().getTime() - prevEvent.getTime();
2628
2511
  }
2629
- get isUploading() {
2630
- return this.file.state === FileState.Uploading;
2512
+ addClass(className) {
2513
+ this.renderer.addClass(this.element.nativeElement, className);
2631
2514
  }
2632
- get isFailed() {
2633
- return this.file.state === FileState.Failed;
2515
+ removeClass(className) {
2516
+ this.renderer.removeClass(this.element.nativeElement, className);
2634
2517
  }
2635
- get isPaused() {
2636
- return this.file.state === FileState.Paused;
2518
+ }
2519
+ DropZoneBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropZoneBase, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: 'hoverClass' }], target: i0.ɵɵFactoryTarget.Directive });
2520
+ DropZoneBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DropZoneBase, host: { listeners: { "dragenter": "onElementDragEnterListener()", "dragover": "onElementDragOverListener()" } }, ngImport: i0 });
2521
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropZoneBase, decorators: [{
2522
+ type: Directive
2523
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
2524
+ type: Inject,
2525
+ args: ['hoverClass']
2526
+ }] }]; }, propDecorators: { onElementDragEnterListener: [{
2527
+ type: HostListener,
2528
+ args: ['dragenter']
2529
+ }], onElementDragOverListener: [{
2530
+ type: HostListener,
2531
+ args: ['dragover']
2532
+ }] } });
2533
+
2534
+ /**
2535
+ * @hidden
2536
+ */
2537
+ class DropZoneInternalDirective extends DropZoneBase {
2538
+ constructor(element, renderer, ngZone, uploadService) {
2539
+ super(element, renderer, 'k-dropzone-hover');
2540
+ this.ngZone = ngZone;
2541
+ this.uploadService = uploadService;
2542
+ this.initialClassName = true;
2543
+ this.hideIntervalDocument = null;
2544
+ this.activeClass = 'k-dropzone-active';
2545
+ this.ngZone.runOutsideAngular(() => {
2546
+ this.unsubscribeDocumentDragEnter = this.renderer.listen('document', 'dragenter', () => this.onDocumentDragEnter());
2547
+ this.unsubscribeDocumentDragOver = this.renderer.listen('document', 'dragover', () => this.onDocumentDragOver());
2548
+ });
2637
2549
  }
2638
- get isResumable() {
2639
- const service = this.uploadService;
2640
- const isResumable = service.async.chunk && service.chunk.resumable;
2641
- const isUploading = (this.file.state === FileState.Paused) || (this.file.state === FileState.Uploading);
2642
- return isResumable && isUploading;
2550
+ ngOnDestroy() {
2551
+ this.ngZone.runOutsideAngular(() => {
2552
+ if (this.unsubscribeDocumentDragEnter) {
2553
+ this.unsubscribeDocumentDragEnter();
2554
+ }
2555
+ if (this.unsubscribeDocumentDragOver) {
2556
+ this.unsubscribeDocumentDragOver();
2557
+ }
2558
+ });
2643
2559
  }
2644
- get isActionButtonVisible() {
2645
- if ((this.file.state === FileState.Uploaded || this.file.state === FileState.Initial) &&
2646
- !this.uploadService.async.removeUrl && this.uploadService.component === 'Upload') {
2647
- return false;
2560
+ onDocumentDragEnter() {
2561
+ this.addClass(this.activeClass);
2562
+ this.lastDragDocument = new Date();
2563
+ if (!this.hideIntervalDocument) {
2564
+ this.hideIntervalDocument = setInterval(() => {
2565
+ if (this.calculateTimeDiff(this.lastDragDocument) < 100) {
2566
+ return;
2567
+ }
2568
+ this.removeClass(this.activeClass);
2569
+ clearInterval(this.hideIntervalDocument);
2570
+ this.hideIntervalDocument = null;
2571
+ }, 100);
2648
2572
  }
2649
- return true;
2573
+ return false;
2650
2574
  }
2651
- };
2652
- __decorate([
2653
- Input(),
2654
- __metadata("design:type", Object)
2655
- ], FileListItemActionButtonComponent.prototype, "file", void 0);
2656
- __decorate([
2657
- Input(),
2658
- __metadata("design:type", Boolean)
2659
- ], FileListItemActionButtonComponent.prototype, "disabled", void 0);
2660
- __decorate([
2661
- Input(),
2662
- __metadata("design:type", Number)
2663
- ], FileListItemActionButtonComponent.prototype, "progress", void 0);
2664
- FileListItemActionButtonComponent = __decorate([
2665
- Component({
2666
- selector: 'kendo-upload-file-list-item-action-button',
2667
- template: `
2668
- <strong class="k-upload-status">
2669
- <span class="k-upload-pct" *ngIf="isUploading || isPaused">{{progress}}%</span>
2670
-
2671
- <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"
2672
- [ngClass]="{ 'k-focus': this.retryFocused }"
2673
- [attr.tabIndex]="-1"
2674
- (focus)="onFocus('retry')"
2675
- (blur)="onBlur('retry')"
2676
- (click)="onRetryClick()">
2677
- <span class="k-icon k-button-icon k-retry k-i-refresh-sm"
2678
- [attr.aria-label]="retryButtonTitle"
2679
- [attr.title]="retryButtonTitle">
2680
- </span>
2681
- </button>
2682
-
2683
- <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"
2684
- [ngClass]="{ 'k-focus': this.pauseResumeFocused }"
2685
- [attr.tabIndex]="-1"
2686
- (focus)="onFocus('pauseResume')"
2687
- (blur)="onBlur('pauseResume')"
2688
- (click)="onPauseResumeClick()">
2689
- <span class="k-icon k-button-icon"
2690
- [ngClass]="{
2691
- 'k-i-play-sm': isPaused,
2692
- 'k-i-pause-sm': !isPaused
2693
- }"
2694
- [attr.aria-label]='pauseResumeButtonTitle'
2695
- [attr.title]='pauseResumeButtonTitle'>
2696
- </span>
2697
- </button>
2698
-
2699
- <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"
2700
- [ngClass]="{ 'k-focus': this.actionFocused }"
2701
- [attr.tabIndex]="-1"
2702
- (focus)="onFocus('action')"
2703
- (blur)="onBlur('action')"
2704
- (click)="onRemoveCancelClick($event)">
2705
- <span class="k-icon k-button-icon"
2706
- [ngClass]="{
2707
- 'k-i-cancel': isUploading,
2708
- 'k-delete k-i-x': !isUploading
2709
- }"
2710
- [attr.aria-label]='actionButtonTitle'
2711
- [attr.title]='actionButtonTitle'>
2712
- </span>
2713
- </button>
2714
- </strong>
2575
+ /**
2576
+ * @hidden
2577
+ */
2578
+ onDocumentDragOver() {
2579
+ this.lastDragDocument = new Date();
2580
+ return false;
2581
+ }
2582
+ onDropListener(event) {
2583
+ let droppedFiles = event.dataTransfer.files;
2584
+ if (droppedFiles.length > 0 && !this.disabled) {
2585
+ let files = getAllFileInfo(droppedFiles);
2586
+ files = assignGuidToFiles(files, !this.uploadService.async.batch);
2587
+ if (!this.multiple) {
2588
+ files.splice(1, files.length - 1);
2589
+ this.uploadService.clearFiles();
2590
+ }
2591
+ validateFiles(files, this.restrictions);
2592
+ this.uploadService.addFiles(files);
2593
+ }
2594
+ return false;
2595
+ }
2596
+ }
2597
+ DropZoneInternalDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropZoneInternalDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: UploadService }], target: i0.ɵɵFactoryTarget.Directive });
2598
+ DropZoneInternalDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", 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" } }, usesInheritance: true, ngImport: i0 });
2599
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropZoneInternalDirective, decorators: [{
2600
+ type: Directive,
2601
+ args: [{
2602
+ selector: `
2603
+ [kendoUploadInternalDropZone],
2604
+ [kendoFileSelectInternalDropZone]
2715
2605
  `
2716
- }),
2717
- __metadata("design:paramtypes", [UploadService,
2718
- LocalizationService,
2719
- NavigationService])
2720
- ], FileListItemActionButtonComponent);
2606
+ }]
2607
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: UploadService }]; }, propDecorators: { disabled: [{
2608
+ type: Input
2609
+ }], multiple: [{
2610
+ type: Input
2611
+ }], restrictions: [{
2612
+ type: Input
2613
+ }], initialClassName: [{
2614
+ type: HostBinding,
2615
+ args: ['class.k-dropzone']
2616
+ }], onDropListener: [{
2617
+ type: HostListener,
2618
+ args: ['drop', ['$event']]
2619
+ }] } });
2721
2620
 
2722
2621
  /**
2723
2622
  * @hidden
2724
2623
  */
2725
- class FileListItemBase {
2726
- constructor(uploadService) {
2624
+ class FileSelectDirective {
2625
+ constructor(uploadService, navigation, el) {
2727
2626
  this.uploadService = uploadService;
2728
- this.progressComplete = 0;
2627
+ this.navigation = navigation;
2628
+ this.type = "file";
2629
+ this.autocomplete = "off";
2630
+ this.tabIndex = -1;
2631
+ this.element = el;
2729
2632
  }
2730
- subscribeUploadProgress(uploadProgressHandler) {
2731
- this.uploadProgressSubscription = this.uploadService.uploadProgressEvent.subscribe(uploadProgressHandler);
2633
+ get nameAttribute() {
2634
+ return this.uploadService.async.saveField;
2732
2635
  }
2733
- fileHasValidationErrors(file) {
2734
- return fileHasValidationErrors(file);
2636
+ get multipleAttribute() {
2637
+ return this.multiple ? "multiple" : null;
2735
2638
  }
2736
- filesHaveValidationErrors(files) {
2737
- return filesHaveValidationErrors(files);
2639
+ get dirAttribute() {
2640
+ return this.dir;
2738
2641
  }
2739
- ngOnDestroy() {
2740
- this.uploadProgressSubscription.unsubscribe();
2642
+ get disabledAttribute() {
2643
+ return this.disabled ? "true" : null;
2741
2644
  }
2742
- getFileValidationMessage(file) {
2743
- let validationMessage;
2744
- if (file.validationErrors && file.validationErrors.length > 0) {
2745
- validationMessage = this.localization.get(file.validationErrors[0]);
2645
+ onInputChange(event) {
2646
+ const ua = navigator.userAgent;
2647
+ const webkit = /(webkit)[ \/]([\w.]+)/i;
2648
+ const ie = /(windows)[ \/]([\w.]+)/i;
2649
+ let selectedFiles = inputFiles(event.target);
2650
+ selectedFiles = assignGuidToFiles(selectedFiles, !this.uploadService.async.batch);
2651
+ validateFiles(selectedFiles, this.restrictions);
2652
+ if (!this.multiple) {
2653
+ this.uploadService.clearFiles();
2746
2654
  }
2747
- return validationMessage;
2748
- }
2749
- getTotalFilesSizeMessage(files) {
2750
- return getTotalFilesSizeMessage(files);
2751
- }
2752
- textFor(key) {
2753
- return this.localization.get(key);
2655
+ this.uploadService.addFiles(selectedFiles);
2656
+ /*
2657
+ Chrome, IE, Edge and Safari do not trigger a `change` event
2658
+ when a file with the same name is selected a number of consecutive times.
2659
+ As a workaround, clear the input value after handling the file.
2660
+ */
2661
+ const native = this.element.nativeElement;
2662
+ if (ua.match(webkit) || ua.match(ie)) {
2663
+ native.type = "";
2664
+ native.type = "file";
2665
+ }
2666
+ setTimeout(() => {
2667
+ this.navigation.focusedIndex = -1;
2668
+ });
2754
2669
  }
2755
2670
  }
2671
+ FileSelectDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileSelectDirective, deps: [{ token: UploadService }, { token: NavigationService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
2672
+ FileSelectDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", 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 });
2673
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileSelectDirective, decorators: [{
2674
+ type: Directive,
2675
+ args: [{
2676
+ selector: '[kendoFileSelect]'
2677
+ }]
2678
+ }], ctorParameters: function () { return [{ type: UploadService }, { type: NavigationService }, { type: i0.ElementRef }]; }, propDecorators: { dir: [{
2679
+ type: Input
2680
+ }], disabled: [{
2681
+ type: Input
2682
+ }], multiple: [{
2683
+ type: Input
2684
+ }], restrictions: [{
2685
+ type: Input
2686
+ }], type: [{
2687
+ type: HostBinding,
2688
+ args: ["attr.type"]
2689
+ }], autocomplete: [{
2690
+ type: HostBinding,
2691
+ args: ["attr.autocomplete"]
2692
+ }], tabIndex: [{
2693
+ type: HostBinding,
2694
+ args: ["attr.tabindex"]
2695
+ }], nameAttribute: [{
2696
+ type: HostBinding,
2697
+ args: ["attr.name"]
2698
+ }], multipleAttribute: [{
2699
+ type: HostBinding,
2700
+ args: ["attr.multiple"]
2701
+ }], dirAttribute: [{
2702
+ type: HostBinding,
2703
+ args: ["attr.dir"]
2704
+ }], disabledAttribute: [{
2705
+ type: HostBinding,
2706
+ args: ["attr.disabled"]
2707
+ }], onInputChange: [{
2708
+ type: HostListener,
2709
+ args: ["change", ["$event"]]
2710
+ }] } });
2756
2711
 
2757
2712
  /**
2758
2713
  * @hidden
2759
2714
  */
2760
- let FileListMultipleItemsComponent = class FileListMultipleItemsComponent extends FileListItemBase {
2761
- constructor(localization, uploadService) {
2762
- super(uploadService);
2715
+ const FILESELECT_VALUE_ACCESSOR = {
2716
+ multi: true,
2717
+ provide: NG_VALUE_ACCESSOR,
2718
+ useExisting: forwardRef(() => FileSelectComponent)
2719
+ };
2720
+ class FileSelectComponent {
2721
+ constructor(uploadService, localization, navigation, dropZoneService, ngZone, renderer, cdr, wrapper) {
2722
+ this.uploadService = uploadService;
2763
2723
  this.localization = localization;
2764
- this.subscribeUploadProgress((args) => {
2765
- if (args.files[0].uid === this.files[0].uid) {
2766
- this.progressComplete = args.percentComplete;
2767
- }
2724
+ this.navigation = navigation;
2725
+ this.dropZoneService = dropZoneService;
2726
+ this.ngZone = ngZone;
2727
+ this.renderer = renderer;
2728
+ this.cdr = cdr;
2729
+ /**
2730
+ * Disables the FileSelect.
2731
+ * The default value is `false`.
2732
+ */
2733
+ this.disabled = false;
2734
+ /**
2735
+ * Enables the selection of multiple files
2736
+ * ([see example]({% slug fileprocessing_upload %}#toc-upload-of-sinlge-or-multiple-files)).
2737
+ * If set to `false`, only one file can be selected at a time.
2738
+ */
2739
+ this.multiple = true;
2740
+ /**
2741
+ * Toggles the visibility of the file list.
2742
+ */
2743
+ this.showFileList = true;
2744
+ /**
2745
+ * Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the FileSelect.
2746
+ */
2747
+ this.tabindex = 0;
2748
+ /**
2749
+ * @hidden
2750
+ */
2751
+ this.focusableId = `k-${guid()}`;
2752
+ /**
2753
+ * Fires when the user navigates outside the component.
2754
+ */
2755
+ this.onBlur = new EventEmitter();
2756
+ /**
2757
+ * Fires when the component is focused.
2758
+ */
2759
+ this.onFocus = new EventEmitter();
2760
+ /**
2761
+ * Fires when files are selected. If prevented, the selected files will not be added to the list.
2762
+ */
2763
+ this.select = new EventEmitter();
2764
+ /**
2765
+ * Fires when a file is about to be removed. If prevented, the file will remain in the list.
2766
+ */
2767
+ this.remove = new EventEmitter();
2768
+ /**
2769
+ * Fires when the value of the component has changed as a result of a successful `select` or `remove` operation.
2770
+ */
2771
+ this.valueChange = new EventEmitter();
2772
+ this.hostDefaultClasses = true;
2773
+ /**
2774
+ * @hidden
2775
+ */
2776
+ this._restrictions = {
2777
+ allowedExtensions: [],
2778
+ maxFileSize: 0,
2779
+ minFileSize: 0
2780
+ };
2781
+ this.onTouchedCallback = (_) => { };
2782
+ this.onChangeCallback = (_) => { };
2783
+ validatePackage(packageMetadata);
2784
+ this.wrapper = wrapper.nativeElement;
2785
+ this.direction = localization.rtl ? 'rtl' : 'ltr';
2786
+ this.navigation.computeKeys(this.direction);
2787
+ this.fileList = this.uploadService.files;
2788
+ this.localizationChangeSubscription = localization.changes.subscribe(({ rtl }) => {
2789
+ this.direction = rtl ? 'rtl' : 'ltr';
2790
+ this.navigation.computeKeys(this.direction);
2768
2791
  });
2792
+ this.subscribeBlur();
2793
+ this.subscribeFocus();
2794
+ this.attachEventHandlers();
2795
+ this.setDefaultSettings();
2769
2796
  }
2770
- get showProgress() {
2771
- const showProgress = this.files[0].state === FileState.Uploading || this.files[0].state === FileState.Paused;
2772
- return showProgress ? 'active' : 'inactive';
2797
+ /**
2798
+ * Sets the `name` attribute of the `input` element of the FileSelect.
2799
+ */
2800
+ set name(name) {
2801
+ this.uploadService.async.saveField = name;
2773
2802
  }
2774
- ngOnInit() {
2775
- this.filesHaveErrors = super.filesHaveValidationErrors(this.files);
2803
+ get name() {
2804
+ return this.uploadService.async.saveField;
2776
2805
  }
2777
- fileStatusText(file) {
2778
- const errors = file.validationErrors;
2779
- if (!isPresent(errors)) {
2780
- return this.getTotalFilesSizeMessage([file]);
2781
- }
2782
- return this.getFileValidationMessage(file);
2806
+ /**
2807
+ * Sets the restrictions for selected files.
2808
+ */
2809
+ set restrictions(restrictions) {
2810
+ let parsedRestrictions = Object.assign({}, this._restrictions, restrictions);
2811
+ this._restrictions = parsedRestrictions;
2783
2812
  }
2784
- get batchStatusText() {
2785
- const state$$1 = this.files[0].state;
2786
- const fileCount = this.files.length;
2787
- if (state$$1 === FileState.Uploaded) {
2788
- return `${fileCount} ${this.textFor('filesBatchStatusUploaded')}`;
2789
- }
2790
- if (state$$1 === FileState.Failed) {
2791
- return `${fileCount} ${this.textFor('filesBatchStatusFailed')}`;
2792
- }
2793
- return `${fileCount} ${this.textFor('filesBatchStatus')}`;
2813
+ get restrictions() {
2814
+ return this._restrictions;
2794
2815
  }
2795
- get isUploadSuccessful() {
2796
- return this.files[0].state === FileState.Uploaded;
2816
+ get hostDisabledClass() {
2817
+ return this.disabled;
2797
2818
  }
2798
- get isUploadFailed() {
2799
- return this.files[0].state === FileState.Failed;
2819
+ get dir() {
2820
+ return this.direction;
2800
2821
  }
2801
- };
2802
- __decorate([
2803
- Input(),
2804
- __metadata("design:type", Boolean)
2805
- ], FileListMultipleItemsComponent.prototype, "disabled", void 0);
2806
- __decorate([
2807
- Input(),
2808
- __metadata("design:type", Array)
2809
- ], FileListMultipleItemsComponent.prototype, "files", void 0);
2810
- __decorate([
2811
- Input(),
2812
- __metadata("design:type", FileInfoTemplateDirective)
2813
- ], FileListMultipleItemsComponent.prototype, "fileInfoTemplate", void 0);
2814
- FileListMultipleItemsComponent = __decorate([
2815
- Component({
2816
- animations: [
2817
- trigger('progressState', [
2818
- state('active', style({ opacity: 1 })),
2819
- state('inactive', style({ opacity: 0 })),
2820
- transition('void => active', style({ opacity: 0 })),
2821
- transition('inactive => active', style({ opacity: 1 })),
2822
- transition('active => inactive', animate('1s 2s ease-out'))
2823
- ])
2824
- ],
2825
- selector: 'kendo-upload-file-list-multiple-items',
2826
- template: `
2827
- <div class="k-progressbar" [@progressState]="showProgress">
2828
- <span class="k-progress" [style.width]="progressComplete + '%'"></span>
2829
- </div>
2830
- <span class="k-multiple-files-group-wrapper">
2831
- <span class="k-file-group k-icon k-i-copy"></span>
2832
- </span>
2833
- <span class="k-multiple-files-wrapper">
2834
- <ng-container *ngIf="!fileInfoTemplate">
2835
- <span *ngFor="let file of files" class="k-file-name-size-wrapper">
2836
- <span [title]="file.name" class="k-file-name">
2837
- {{file.name}}
2838
- </span>
2839
- <span [ngClass]="{
2840
- 'k-text-error': file.validationErrors,
2841
- 'k-file-validation-message': file.validationErrors,
2842
- 'k-file-size': !file.validationErrors
2843
- }"
2844
- >{{fileStatusText(file)}}</span>
2845
- </span>
2846
- <span class="k-file-information"
2847
- [ngClass]="{
2848
- 'k-text-success': isUploadSuccessful,
2849
- 'k-text-error': isUploadFailed
2850
- }"
2851
- >{{batchStatusText}}</span>
2822
+ ngOnInit() {
2823
+ this.renderer.removeAttribute(this.wrapper, "tabindex");
2824
+ if (this.zoneId) {
2825
+ this.dropZoneService.addComponent(this, this.zoneId);
2826
+ }
2827
+ }
2828
+ /**
2829
+ * @hidden
2830
+ */
2831
+ textFor(key) {
2832
+ return this.localization.get(key);
2833
+ }
2834
+ /**
2835
+ * Focuses the underlying input element.
2836
+ */
2837
+ focus() {
2838
+ setTimeout(() => {
2839
+ this.fileSelectButton.nativeElement.focus();
2840
+ });
2841
+ }
2842
+ ngOnDestroy() {
2843
+ this.fileList.clear();
2844
+ if (this.blurSubscription) {
2845
+ this.blurSubscription.unsubscribe();
2846
+ }
2847
+ if (this.wrapperFocusSubscription) {
2848
+ this.wrapperFocusSubscription.unsubscribe();
2849
+ }
2850
+ if (this.selectButtonFocusSubscription) {
2851
+ this.selectButtonFocusSubscription.unsubscribe();
2852
+ }
2853
+ if (this.localizationChangeSubscription) {
2854
+ this.localizationChangeSubscription.unsubscribe();
2855
+ }
2856
+ if (this.subs) {
2857
+ this.subs.unsubscribe();
2858
+ }
2859
+ }
2860
+ /**
2861
+ * @hidden
2862
+ */
2863
+ handleKeydown(event) {
2864
+ if (this.disabled) {
2865
+ return;
2866
+ }
2867
+ if ((event.keyCode === Keys.Enter || event.keyCode === Keys.Space) &&
2868
+ event.target === this.fileSelectButton.nativeElement) {
2869
+ event.preventDefault();
2870
+ this.fileSelect.nativeElement.click();
2871
+ return;
2872
+ }
2873
+ if (hasClasses(event.target, UPLOAD_CLASSES) ||
2874
+ (!isFocusable(event.target) && !hasClasses(event.target, IGNORE_TARGET_CLASSES))) {
2875
+ this.navigation.process(event);
2876
+ }
2877
+ }
2878
+ /**
2879
+ * @hidden
2880
+ */
2881
+ writeValue(newValue) {
2882
+ let isValid = true;
2883
+ if (newValue instanceof Array) {
2884
+ newValue.forEach((file) => {
2885
+ if (!validateInitialFileSelectFile(file)) {
2886
+ isValid = false;
2887
+ }
2888
+ });
2889
+ if (isValid) {
2890
+ this.uploadService.addInitialFileSelectFiles(newValue);
2891
+ }
2892
+ }
2893
+ if (newValue === null) {
2894
+ this.fileList.clear();
2895
+ }
2896
+ this.cdr.markForCheck();
2897
+ }
2898
+ /**
2899
+ * @hidden
2900
+ */
2901
+ registerOnChange(fn) {
2902
+ this.onChangeCallback = fn;
2903
+ }
2904
+ /**
2905
+ * @hidden
2906
+ */
2907
+ registerOnTouched(fn) {
2908
+ this.onTouchedCallback = fn;
2909
+ }
2910
+ /**
2911
+ * @hidden
2912
+ */
2913
+ setDisabledState(isDisabled) {
2914
+ this.disabled = isDisabled;
2915
+ }
2916
+ /**
2917
+ * Removes specific file from the file list.
2918
+ */
2919
+ removeFileByUid(uid) {
2920
+ this.uploadService.removeFiles(uid);
2921
+ }
2922
+ /**
2923
+ * Visually clears all files from the UI.
2924
+ */
2925
+ clearFiles() {
2926
+ this.uploadService.clearFiles();
2927
+ }
2928
+ /**
2929
+ * @hidden
2930
+ * Used to determine if the component is empty.
2931
+ */
2932
+ isEmpty() {
2933
+ return false;
2934
+ }
2935
+ /**
2936
+ * @hidden
2937
+ * Used by the external dropzone to add files to the FileSelect
2938
+ */
2939
+ addFiles(files) {
2940
+ this.uploadService.addFiles(files);
2941
+ }
2942
+ /**
2943
+ * @hidden
2944
+ */
2945
+ get selectButtonTabIndex() {
2946
+ return this.disabled ? undefined : this.tabindex;
2947
+ }
2948
+ /**
2949
+ * @hidden
2950
+ */
2951
+ onFileSelectButtonFocus(_event) {
2952
+ this.renderer.addClass(this.fileSelectButton.nativeElement, 'k-focus');
2953
+ if (!this.navigation.focused) {
2954
+ this.navigation.focusedIndex = -1;
2955
+ }
2956
+ }
2957
+ /**
2958
+ * @hidden
2959
+ */
2960
+ onFileSelectButtonBlur(_event) {
2961
+ this.renderer.removeClass(this.fileSelectButton.nativeElement, 'k-focus');
2962
+ }
2963
+ subscribeBlur() {
2964
+ if (!isDocumentAvailable()) {
2965
+ return;
2966
+ }
2967
+ this.ngZone.runOutsideAngular(() => {
2968
+ this.documentClick = fromEvent(document, 'click').pipe(filter((event) => {
2969
+ return !(this.wrapper !== event.target && this.wrapper.contains(event.target));
2970
+ }));
2971
+ this.blurSubscription = merge(this.documentClick, this.navigation.onTab).subscribe(() => {
2972
+ if (this.navigation.focused) {
2973
+ this.ngZone.run(() => {
2974
+ this.navigation.focused = false;
2975
+ this.onTouchedCallback();
2976
+ this.onBlur.emit();
2977
+ });
2978
+ }
2979
+ });
2980
+ });
2981
+ }
2982
+ subscribeFocus() {
2983
+ this.wrapperFocusSubscription = this.navigation.onWrapperFocus.subscribe(() => {
2984
+ this.onFocus.emit();
2985
+ });
2986
+ this.selectButtonFocusSubscription = this.navigation.onSelectButtonFocus.subscribe(() => {
2987
+ this.fileSelectButton.nativeElement.focus();
2988
+ });
2989
+ }
2990
+ attachEventHandlers() {
2991
+ this.subs = this.uploadService.changeEvent.subscribe((files) => {
2992
+ let model = [];
2993
+ if (files !== null) {
2994
+ files.forEach((file) => {
2995
+ if (file.state === FileState.Initial) {
2996
+ model.push(file);
2997
+ }
2998
+ if (file.state === FileState.Selected && file.rawFile && !file.validationErrors) {
2999
+ model.push(file.rawFile);
3000
+ }
3001
+ });
3002
+ }
3003
+ if (model.length === 0) {
3004
+ model = null;
3005
+ }
3006
+ this.onChangeCallback(model);
3007
+ this.valueChange.emit(model);
3008
+ });
3009
+ this.subs.add(this.uploadService.removeEvent.subscribe((args) => {
3010
+ this.remove.emit(args);
3011
+ }));
3012
+ this.subs.add(this.uploadService.selectEvent.subscribe((args) => {
3013
+ this.select.emit(args);
3014
+ }));
3015
+ }
3016
+ setDefaultSettings() {
3017
+ this.uploadService.async.autoUpload = false;
3018
+ this.uploadService.component = 'FileSelect';
3019
+ }
3020
+ }
3021
+ FileSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", 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 });
3022
+ FileSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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: { listeners: { "keydown": "handleKeydown($event)" }, properties: { "class.k-widget": "this.hostDefaultClasses", "class.k-upload": "this.hostDefaultClasses", "class.k-disabled": "this.hostDisabledClass", "attr.dir": "this.dir" } }, providers: [
3023
+ LocalizationService,
3024
+ NavigationService,
3025
+ UploadService,
3026
+ DropZoneService,
3027
+ FILESELECT_VALUE_ACCESSOR,
3028
+ {
3029
+ provide: L10N_PREFIX,
3030
+ useValue: 'kendo.fileselect'
3031
+ },
3032
+ {
3033
+ provide: KendoInput,
3034
+ useExisting: forwardRef(() => FileSelectComponent)
3035
+ }
3036
+ ], queries: [{ propertyName: "fileTemplate", first: true, predicate: FileTemplateDirective, descendants: true }, { propertyName: "fileInfoTemplate", first: true, predicate: FileInfoTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "fileSelect", first: true, predicate: ["fileSelect"], descendants: true, static: true }, { propertyName: "fileSelectButton", first: true, predicate: ["fileSelectButton"], descendants: true, static: true }], exportAs: ["kendoFileSelect"], ngImport: i0, template: `
3037
+ <ng-container kendoFileSelectLocalizedMessages
3038
+ i18n-dropFilesHere="kendo.fileselect.dropFilesHere|The drop zone hint"
3039
+ dropFilesHere="Drop files here to select"
3040
+
3041
+ i18n-invalidFileExtension="kendo.fileselect.invalidFileExtension|The text for the invalid allowed extensions restriction message"
3042
+ invalidFileExtension="File type not allowed."
3043
+
3044
+ i18n-invalidMaxFileSize="kendo.fileselect.invalidMaxFileSize|The text for the invalid max file size restriction message"
3045
+ invalidMaxFileSize="File size too large."
3046
+
3047
+ i18n-invalidMinFileSize="kendo.fileselect.invalidMinFileSize|The text for the invalid min file size restriction message"
3048
+ invalidMinFileSize="File size too small."
3049
+
3050
+ i18n-remove="kendo.fileselect.remove|The text for the Remove button"
3051
+ remove="Remove"
3052
+
3053
+ i18n-select="kendo.fileselect.select|The text for the Select button"
3054
+ select="Select files..."
3055
+ >
2852
3056
  </ng-container>
2853
- <ng-template *ngIf="fileInfoTemplate"
2854
- [templateContext]="{
2855
- templateRef: fileInfoTemplate.templateRef,
2856
- state: files[0].state,
2857
- $implicit: files
2858
- }">
2859
- </ng-template>
2860
- </span>
2861
- <kendo-upload-file-list-item-action-button
2862
- [file]='files[0]'
2863
- [disabled]='disabled'
2864
- [progress]='progressComplete'>
2865
- </kendo-upload-file-list-item-action-button>
3057
+ <div kendoFileSelectInternalDropZone
3058
+ [restrictions]="restrictions"
3059
+ [multiple]="multiple"
3060
+ [disabled]="disabled">
3061
+ <div role="button" #fileSelectButton
3062
+ [id]="focusableId"
3063
+ [attr.aria-label]="textFor('select')"
3064
+ [attr.tabindex]="selectButtonTabIndex"
3065
+ (focus)="onFileSelectButtonFocus($event)"
3066
+ (blur)="onFileSelectButtonBlur($event)"
3067
+ class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-upload-button">
3068
+ <input #fileSelect kendoFileSelect
3069
+ [attr.accept]="accept ? accept : null"
3070
+ [dir]="direction"
3071
+ [restrictions]="restrictions"
3072
+ [multiple]="multiple"
3073
+ [disabled]="disabled" />
3074
+ <span>{{textFor('select')}}</span>
3075
+ </div>
3076
+ <div class="k-dropzone-hint">{{textFor('dropFilesHere')}}</div>
3077
+ </div>
3078
+ <ul kendo-upload-file-list
3079
+ class="k-upload-files k-reset"
3080
+ *ngIf="showFileList && fileList.count > 0"
3081
+ [disabled]="disabled"
3082
+ [fileList]="fileList.files"
3083
+ [fileTemplate]="fileTemplate"
3084
+ [fileInfoTemplate]="fileInfoTemplate">
3085
+ </ul>
3086
+ `, isInline: true, components: [{ 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: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
3087
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileSelectComponent, decorators: [{
3088
+ type: Component,
3089
+ args: [{
3090
+ exportAs: 'kendoFileSelect',
3091
+ providers: [
3092
+ LocalizationService,
3093
+ NavigationService,
3094
+ UploadService,
3095
+ DropZoneService,
3096
+ FILESELECT_VALUE_ACCESSOR,
3097
+ {
3098
+ provide: L10N_PREFIX,
3099
+ useValue: 'kendo.fileselect'
3100
+ },
3101
+ {
3102
+ provide: KendoInput,
3103
+ useExisting: forwardRef(() => FileSelectComponent)
3104
+ }
3105
+ ],
3106
+ selector: 'kendo-fileselect',
3107
+ template: `
3108
+ <ng-container kendoFileSelectLocalizedMessages
3109
+ i18n-dropFilesHere="kendo.fileselect.dropFilesHere|The drop zone hint"
3110
+ dropFilesHere="Drop files here to select"
3111
+
3112
+ i18n-invalidFileExtension="kendo.fileselect.invalidFileExtension|The text for the invalid allowed extensions restriction message"
3113
+ invalidFileExtension="File type not allowed."
3114
+
3115
+ i18n-invalidMaxFileSize="kendo.fileselect.invalidMaxFileSize|The text for the invalid max file size restriction message"
3116
+ invalidMaxFileSize="File size too large."
3117
+
3118
+ i18n-invalidMinFileSize="kendo.fileselect.invalidMinFileSize|The text for the invalid min file size restriction message"
3119
+ invalidMinFileSize="File size too small."
3120
+
3121
+ i18n-remove="kendo.fileselect.remove|The text for the Remove button"
3122
+ remove="Remove"
3123
+
3124
+ i18n-select="kendo.fileselect.select|The text for the Select button"
3125
+ select="Select files..."
3126
+ >
3127
+ </ng-container>
3128
+ <div kendoFileSelectInternalDropZone
3129
+ [restrictions]="restrictions"
3130
+ [multiple]="multiple"
3131
+ [disabled]="disabled">
3132
+ <div role="button" #fileSelectButton
3133
+ [id]="focusableId"
3134
+ [attr.aria-label]="textFor('select')"
3135
+ [attr.tabindex]="selectButtonTabIndex"
3136
+ (focus)="onFileSelectButtonFocus($event)"
3137
+ (blur)="onFileSelectButtonBlur($event)"
3138
+ class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-upload-button">
3139
+ <input #fileSelect kendoFileSelect
3140
+ [attr.accept]="accept ? accept : null"
3141
+ [dir]="direction"
3142
+ [restrictions]="restrictions"
3143
+ [multiple]="multiple"
3144
+ [disabled]="disabled" />
3145
+ <span>{{textFor('select')}}</span>
3146
+ </div>
3147
+ <div class="k-dropzone-hint">{{textFor('dropFilesHere')}}</div>
3148
+ </div>
3149
+ <ul kendo-upload-file-list
3150
+ class="k-upload-files k-reset"
3151
+ *ngIf="showFileList && fileList.count > 0"
3152
+ [disabled]="disabled"
3153
+ [fileList]="fileList.files"
3154
+ [fileTemplate]="fileTemplate"
3155
+ [fileInfoTemplate]="fileInfoTemplate">
3156
+ </ul>
2866
3157
  `
2867
- }),
2868
- __metadata("design:paramtypes", [LocalizationService,
2869
- UploadService])
2870
- ], FileListMultipleItemsComponent);
3158
+ }]
3159
+ }], 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: [{
3160
+ type: Input
3161
+ }], disabled: [{
3162
+ type: Input
3163
+ }], multiple: [{
3164
+ type: Input
3165
+ }], name: [{
3166
+ type: Input
3167
+ }], showFileList: [{
3168
+ type: Input
3169
+ }], tabindex: [{
3170
+ type: Input
3171
+ }], restrictions: [{
3172
+ type: Input
3173
+ }], zoneId: [{
3174
+ type: Input
3175
+ }], focusableId: [{
3176
+ type: Input
3177
+ }], fileTemplate: [{
3178
+ type: ContentChild,
3179
+ args: [FileTemplateDirective, { static: false }]
3180
+ }], fileInfoTemplate: [{
3181
+ type: ContentChild,
3182
+ args: [FileInfoTemplateDirective, { static: false }]
3183
+ }], fileSelect: [{
3184
+ type: ViewChild,
3185
+ args: ['fileSelect', { static: true }]
3186
+ }], fileSelectButton: [{
3187
+ type: ViewChild,
3188
+ args: ['fileSelectButton', { static: true }]
3189
+ }], onBlur: [{
3190
+ type: Output,
3191
+ args: ['blur']
3192
+ }], onFocus: [{
3193
+ type: Output,
3194
+ args: ['focus']
3195
+ }], select: [{
3196
+ type: Output
3197
+ }], remove: [{
3198
+ type: Output
3199
+ }], valueChange: [{
3200
+ type: Output
3201
+ }], hostDefaultClasses: [{
3202
+ type: HostBinding,
3203
+ args: ['class.k-widget']
3204
+ }, {
3205
+ type: HostBinding,
3206
+ args: ['class.k-upload']
3207
+ }], hostDisabledClass: [{
3208
+ type: HostBinding,
3209
+ args: ['class.k-disabled']
3210
+ }], dir: [{
3211
+ type: HostBinding,
3212
+ args: ['attr.dir']
3213
+ }], handleKeydown: [{
3214
+ type: HostListener,
3215
+ args: ['keydown', ['$event']]
3216
+ }] } });
3217
+
3218
+ /**
3219
+ * Custom component messages override default component messages ([more information and example]({% slug globalization_upload %})).
3220
+ *
3221
+ * @example
3222
+ * ```html-no-run
3223
+ * <kendo-fileselect>
3224
+ * <kendo-fileselect-messages
3225
+ * dropFilesHere="Drop your file here"
3226
+ * select="Upload file">
3227
+ * </kendo-fileselect-messages>
3228
+ * </kendo-fileselect>
3229
+ * ```
3230
+ */
3231
+ class CustomMessagesComponent extends Messages {
3232
+ constructor(service) {
3233
+ super();
3234
+ this.service = service;
3235
+ }
3236
+ get override() {
3237
+ return true;
3238
+ }
3239
+ }
3240
+ CustomMessagesComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CustomMessagesComponent, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
3241
+ CustomMessagesComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: CustomMessagesComponent, selector: "kendo-upload-messages, kendo-fileselect-messages, kendo-uploaddropzone-messages", providers: [
3242
+ {
3243
+ provide: Messages,
3244
+ useExisting: forwardRef(() => CustomMessagesComponent)
3245
+ }
3246
+ ], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
3247
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CustomMessagesComponent, decorators: [{
3248
+ type: Component,
3249
+ args: [{
3250
+ providers: [
3251
+ {
3252
+ provide: Messages,
3253
+ useExisting: forwardRef(() => CustomMessagesComponent)
3254
+ }
3255
+ ],
3256
+ selector: 'kendo-upload-messages, kendo-fileselect-messages, kendo-uploaddropzone-messages',
3257
+ template: ``
3258
+ }]
3259
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
2871
3260
 
2872
3261
  /**
2873
3262
  * @hidden
2874
3263
  */
2875
- let FileListSingleItemComponent = class FileListSingleItemComponent extends FileListItemBase {
2876
- constructor(localization, uploadService) {
2877
- super(uploadService);
3264
+ class UploadStatusTotalComponent {
3265
+ constructor(localization) {
2878
3266
  this.localization = localization;
2879
- this.subscribeUploadProgress((args) => {
2880
- if (args.files[0].uid === this.file.uid) {
2881
- this.progressComplete = args.percentComplete;
2882
- }
2883
- });
2884
3267
  }
2885
- get fileStatusText() {
2886
- const errors = this.file.validationErrors;
2887
- if (this.file.state === FileState.Uploaded) {
2888
- return `${this.textFor('fileStatusUploaded')}`;
2889
- }
2890
- if (this.file.state === FileState.Failed) {
2891
- return `${this.textFor('fileStatusFailed')}`;
3268
+ ngDoCheck() {
3269
+ this.isPaused = this.fileList.hasFileWithState([FileState.Paused]);
3270
+ this.isFailed = this.fileList.hasFileWithState([FileState.Failed]);
3271
+ this.isUploading = this.fileList.hasFileWithState([FileState.Uploading]);
3272
+ if (this.isPaused && !this.isUploading) {
3273
+ this.statusText = this.localization.get('headerStatusPaused');
2892
3274
  }
2893
- if (!isPresent(errors)) {
2894
- return this.getTotalFilesSizeMessage([this.file]);
3275
+ else {
3276
+ this.statusText = this.isUploading ? this.localization.get('headerStatusUploading')
3277
+ : this.localization.get('headerStatusUploaded');
2895
3278
  }
2896
- return this.getFileValidationMessage(this.file);
2897
- }
2898
- get showProgress() {
2899
- const showProgress = this.file.state === FileState.Uploading || this.file.state === FileState.Paused;
2900
- return showProgress ? 'active' : 'inactive';
2901
- }
2902
- get fileGroupClass() {
2903
- return getFileGroupCssClass(this.file.extension ? this.file.extension : '');
2904
- }
2905
- get isUploadSuccessful() {
2906
- return this.file.state === FileState.Uploaded;
2907
- }
2908
- get isUploadFailed() {
2909
- return this.file.state === FileState.Failed;
2910
3279
  }
2911
- get isNotYetUploaded() {
2912
- return !this.isUploadFailed && !this.isUploadSuccessful;
2913
- }
2914
- };
2915
- __decorate([
2916
- Input(),
2917
- __metadata("design:type", Boolean)
2918
- ], FileListSingleItemComponent.prototype, "disabled", void 0);
2919
- __decorate([
2920
- Input(),
2921
- __metadata("design:type", Object)
2922
- ], FileListSingleItemComponent.prototype, "file", void 0);
2923
- __decorate([
2924
- Input(),
2925
- __metadata("design:type", FileInfoTemplateDirective)
2926
- ], FileListSingleItemComponent.prototype, "fileInfoTemplate", void 0);
2927
- FileListSingleItemComponent = __decorate([
2928
- Component({
2929
- animations: [
2930
- trigger('progressState', [
2931
- state('active', style({ opacity: 1 })),
2932
- state('inactive', style({ opacity: 0 })),
2933
- transition('void => active', style({ opacity: 0 })),
2934
- transition('inactive => active', style({ opacity: 1 })),
2935
- transition('active => inactive', animate('1s 2s ease-out'))
2936
- ])
2937
- ],
2938
- selector: 'kendo-upload-file-list-single-item',
2939
- template: `
2940
- <div class="k-progressbar" [@progressState]="showProgress">
2941
- <span class="k-progress" [style.width]="progressComplete + '%'"></span>
2942
- </div>
2943
- <span class="k-file-group-wrapper">
2944
- <span class="k-file-group k-icon" [ngClass]="fileGroupClass"></span>
2945
- </span>
2946
- <span class="k-file-name-size-wrapper">
2947
- <ng-container *ngIf="!fileInfoTemplate">
2948
- <span class="k-file-name" [title]="file.name">{{ file.name }}</span>
2949
- <span [ngClass]="{
2950
- 'k-file-validation-message': file.validationErrors,
2951
- 'k-file-size': !file.validationErrors && isNotYetUploaded,
2952
- 'k-text-success': isUploadSuccessful,
2953
- 'k-text-error': file.validationErrors || isUploadFailed,
2954
- 'k-file-information': isUploadSuccessful || isUploadFailed
2955
- }"
2956
- >{{fileStatusText}}</span>
2957
- </ng-container>
2958
- <ng-template *ngIf="fileInfoTemplate"
2959
- [templateContext]="{
2960
- templateRef: fileInfoTemplate.templateRef,
2961
- state: file.state,
2962
- $implicit: [file]
3280
+ }
3281
+ UploadStatusTotalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadStatusTotalComponent, deps: [{ token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
3282
+ UploadStatusTotalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: UploadStatusTotalComponent, selector: "kendo-upload-status-total", inputs: { fileList: "fileList" }, ngImport: i0, template: `
3283
+ <span class="k-icon"
3284
+ [ngClass]="{
3285
+ 'k-i-checkmark': !this.isUploading && !this.isFailed,
3286
+ 'k-i-exception': !this.isUploading && this.isFailed,
3287
+ 'k-i-upload': this.isUploading,
3288
+ 'k-i-pause-sm': this.isPaused
2963
3289
  }">
2964
- </ng-template>
2965
- </span>
2966
- <kendo-upload-file-list-item-action-button
2967
- [file]='file'
2968
- [disabled]='disabled'
2969
- [progress]='progressComplete'>
2970
- </kendo-upload-file-list-item-action-button>
3290
+ </span>
3291
+ {{statusText}}
3292
+ `, isInline: true, directives: [{ type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
3293
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadStatusTotalComponent, decorators: [{
3294
+ type: Component,
3295
+ args: [{
3296
+ selector: 'kendo-upload-status-total',
3297
+ template: `
3298
+ <span class="k-icon"
3299
+ [ngClass]="{
3300
+ 'k-i-checkmark': !this.isUploading && !this.isFailed,
3301
+ 'k-i-exception': !this.isUploading && this.isFailed,
3302
+ 'k-i-upload': this.isUploading,
3303
+ 'k-i-pause-sm': this.isPaused
3304
+ }">
3305
+ </span>
3306
+ {{statusText}}
2971
3307
  `
2972
- }),
2973
- __metadata("design:paramtypes", [LocalizationService, UploadService])
2974
- ], FileListSingleItemComponent);
3308
+ }]
3309
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; }, propDecorators: { fileList: [{
3310
+ type: Input
3311
+ }] } });
2975
3312
 
2976
3313
  /**
2977
3314
  * @hidden
2978
3315
  */
2979
- let FileSelectDirective = class FileSelectDirective {
2980
- constructor(uploadService, navigation, el) {
3316
+ class UploadActionButtonsComponent {
3317
+ constructor(uploadService, localization, navigation) {
2981
3318
  this.uploadService = uploadService;
3319
+ this.localization = localization;
2982
3320
  this.navigation = navigation;
2983
- this.type = "file";
2984
- this.autocomplete = "off";
2985
- this.tabIndex = -1;
2986
- this.element = el;
3321
+ this.hostDefaultClass = true;
3322
+ this.onAction();
3323
+ this.onFocus();
2987
3324
  }
2988
- get nameAttribute() {
2989
- return this.uploadService.async.saveField;
3325
+ get actionButtonsEndClassName() {
3326
+ return this.actionsLayout === 'end';
2990
3327
  }
2991
- get multipleAttribute() {
2992
- return this.multiple ? "multiple" : null;
3328
+ get actionButtonsStretchedClassName() {
3329
+ return this.actionsLayout === 'stretched';
2993
3330
  }
2994
- get dirAttribute() {
2995
- return this.dir;
3331
+ get actionButtonsStartClassName() {
3332
+ return this.actionsLayout === 'start';
2996
3333
  }
2997
- get disabledAttribute() {
2998
- return this.disabled ? "true" : null;
3334
+ get actionButtonsCenterClassName() {
3335
+ return this.actionsLayout === 'center';
2999
3336
  }
3000
- onInputChange(event) {
3001
- const ua = navigator.userAgent;
3002
- const webkit = /(webkit)[ \/]([\w.]+)/i;
3003
- const ie = /(windows)[ \/]([\w.]+)/i;
3004
- let selectedFiles = inputFiles(event.target);
3005
- selectedFiles = assignGuidToFiles(selectedFiles, !this.uploadService.async.batch);
3006
- validateFiles(selectedFiles, this.restrictions);
3007
- if (!this.multiple) {
3008
- this.uploadService.clearFiles();
3009
- }
3010
- this.uploadService.addFiles(selectedFiles);
3011
- /*
3012
- Chrome, IE, Edge and Safari do not trigger a `change` event
3013
- when a file with the same name is selected a number of consecutive times.
3014
- As a workaround, clear the input value after handling the file.
3015
- */
3016
- const native = this.element.nativeElement;
3017
- if (ua.match(webkit) || ua.match(ie)) {
3018
- native.type = "";
3019
- native.type = "file";
3020
- }
3021
- setTimeout(() => {
3022
- this.navigation.focusedIndex = -1;
3337
+ onAction() {
3338
+ this.actionSubscription = this.navigation.onActionButtonAction.subscribe((button) => {
3339
+ if (button === "clear") {
3340
+ this.clearFiles();
3341
+ }
3342
+ else {
3343
+ this.performUpload();
3344
+ }
3023
3345
  });
3024
3346
  }
3025
- };
3026
- __decorate([
3027
- Input(),
3028
- __metadata("design:type", String)
3029
- ], FileSelectDirective.prototype, "dir", void 0);
3030
- __decorate([
3031
- Input(),
3032
- __metadata("design:type", Boolean)
3033
- ], FileSelectDirective.prototype, "disabled", void 0);
3034
- __decorate([
3035
- Input(),
3036
- __metadata("design:type", Boolean)
3037
- ], FileSelectDirective.prototype, "multiple", void 0);
3038
- __decorate([
3039
- Input(),
3040
- __metadata("design:type", Object)
3041
- ], FileSelectDirective.prototype, "restrictions", void 0);
3042
- __decorate([
3043
- HostBinding("attr.type"),
3044
- __metadata("design:type", String)
3045
- ], FileSelectDirective.prototype, "type", void 0);
3046
- __decorate([
3047
- HostBinding("attr.autocomplete"),
3048
- __metadata("design:type", String)
3049
- ], FileSelectDirective.prototype, "autocomplete", void 0);
3050
- __decorate([
3051
- HostBinding("attr.tabindex"),
3052
- __metadata("design:type", Number)
3053
- ], FileSelectDirective.prototype, "tabIndex", void 0);
3054
- __decorate([
3055
- HostBinding("attr.name"),
3056
- __metadata("design:type", String),
3057
- __metadata("design:paramtypes", [])
3058
- ], FileSelectDirective.prototype, "nameAttribute", null);
3059
- __decorate([
3060
- HostBinding("attr.multiple"),
3061
- __metadata("design:type", String),
3062
- __metadata("design:paramtypes", [])
3063
- ], FileSelectDirective.prototype, "multipleAttribute", null);
3064
- __decorate([
3065
- HostBinding("attr.dir"),
3066
- __metadata("design:type", String),
3067
- __metadata("design:paramtypes", [])
3068
- ], FileSelectDirective.prototype, "dirAttribute", null);
3069
- __decorate([
3070
- HostBinding("attr.disabled"),
3071
- __metadata("design:type", String),
3072
- __metadata("design:paramtypes", [])
3073
- ], FileSelectDirective.prototype, "disabledAttribute", null);
3074
- __decorate([
3075
- HostListener("change", ["$event"]),
3076
- __metadata("design:type", Function),
3077
- __metadata("design:paramtypes", [Object]),
3078
- __metadata("design:returntype", void 0)
3079
- ], FileSelectDirective.prototype, "onInputChange", null);
3080
- FileSelectDirective = __decorate([
3081
- Directive({
3082
- selector: '[kendoFileSelect]'
3083
- }),
3084
- __metadata("design:paramtypes", [UploadService,
3085
- NavigationService,
3086
- ElementRef])
3087
- ], FileSelectDirective);
3088
-
3089
- var LocalizedMessagesDirective_1;
3090
- /**
3091
- * @hidden
3092
- */
3093
- let LocalizedMessagesDirective = LocalizedMessagesDirective_1 = class LocalizedMessagesDirective extends Messages {
3094
- constructor(service) {
3095
- super();
3096
- this.service = service;
3347
+ onFocus() {
3348
+ this.focusSubscription = this.navigation.onActionButtonFocus.subscribe((button) => {
3349
+ this.focusButton(button);
3350
+ });
3097
3351
  }
3098
- };
3099
- LocalizedMessagesDirective = LocalizedMessagesDirective_1 = __decorate([
3100
- Directive({
3101
- providers: [
3102
- {
3103
- provide: Messages,
3104
- useExisting: forwardRef(() => LocalizedMessagesDirective_1) // tslint:disable-line:no-forward-ref
3105
- }
3106
- ],
3107
- selector: `
3108
- [kendoUploadLocalizedMessages],
3109
- [kendoFileSelectLocalizedMessages],
3110
- [kendoUploadDropZoneLocalizedMessages]
3111
- `
3112
- }),
3113
- __metadata("design:paramtypes", [LocalizationService])
3114
- ], LocalizedMessagesDirective);
3115
-
3116
- /**
3117
- * @hidden
3118
- */
3119
- let TemplateContextDirective = class TemplateContextDirective {
3120
- constructor(viewContainerRef) {
3121
- this.viewContainerRef = viewContainerRef;
3352
+ focusButton(button) {
3353
+ const el = (button === "clear") ? this.clearButton : this.uploadButton;
3354
+ el.nativeElement.focus();
3122
3355
  }
3123
- set templateContext(context) {
3124
- if (this.insertedViewRef) {
3125
- this.viewContainerRef.remove(this.viewContainerRef.indexOf(this.insertedViewRef));
3126
- this.insertedViewRef = undefined;
3356
+ ngOnDestroy() {
3357
+ this.actionSubscription.unsubscribe();
3358
+ this.focusSubscription.unsubscribe();
3359
+ }
3360
+ onUploadButtonClick(event) {
3361
+ event.stopImmediatePropagation();
3362
+ this.performUpload();
3363
+ }
3364
+ performUpload() {
3365
+ if (!this.disabled) {
3366
+ this.uploadService.uploadFiles();
3367
+ this.navigation.focusSelectButton();
3127
3368
  }
3128
- if (context.templateRef) {
3129
- this.insertedViewRef = this.viewContainerRef.createEmbeddedView(context.templateRef, context);
3369
+ }
3370
+ onClearButtonClick(event) {
3371
+ event.stopImmediatePropagation();
3372
+ this.clearFiles();
3373
+ }
3374
+ clearFiles() {
3375
+ if (!this.disabled) {
3376
+ this.uploadService.clearFiles();
3377
+ this.navigation.focusSelectButton();
3130
3378
  }
3131
3379
  }
3132
- };
3133
- __decorate([
3134
- Input(),
3135
- __metadata("design:type", Object),
3136
- __metadata("design:paramtypes", [Object])
3137
- ], TemplateContextDirective.prototype, "templateContext", null);
3138
- TemplateContextDirective = __decorate([
3139
- Directive({
3140
- selector: '[templateContext]' // tslint:disable-line:directive-selector
3141
- }),
3142
- __metadata("design:paramtypes", [ViewContainerRef])
3143
- ], TemplateContextDirective);
3380
+ textFor(key) {
3381
+ return this.localization.get(key);
3382
+ }
3383
+ }
3384
+ UploadActionButtonsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadActionButtonsComponent, deps: [{ token: UploadService }, { token: i1$1.LocalizationService }, { token: NavigationService }], target: i0.ɵɵFactoryTarget.Component });
3385
+ UploadActionButtonsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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: `
3386
+ <button #clearButton type="button" class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-clear-selected"
3387
+ [attr.tabIndex]="-1"
3388
+ (click)="onClearButtonClick($event)">
3389
+ {{textFor('clearSelectedFiles')}}
3390
+ </button>
3391
+ <button #uploadButton type="button" class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-primary k-upload-selected"
3392
+ [attr.tabIndex]="-1"
3393
+ (click)="onUploadButtonClick($event)">
3394
+ {{textFor('uploadSelectedFiles')}}
3395
+ </button>
3396
+ `, isInline: true });
3397
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadActionButtonsComponent, decorators: [{
3398
+ type: Component,
3399
+ args: [{
3400
+ selector: 'kendo-upload-action-buttons',
3401
+ template: `
3402
+ <button #clearButton type="button" class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-clear-selected"
3403
+ [attr.tabIndex]="-1"
3404
+ (click)="onClearButtonClick($event)">
3405
+ {{textFor('clearSelectedFiles')}}
3406
+ </button>
3407
+ <button #uploadButton type="button" class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-primary k-upload-selected"
3408
+ [attr.tabIndex]="-1"
3409
+ (click)="onUploadButtonClick($event)">
3410
+ {{textFor('uploadSelectedFiles')}}
3411
+ </button>
3412
+ `
3413
+ }]
3414
+ }], ctorParameters: function () { return [{ type: UploadService }, { type: i1$1.LocalizationService }, { type: NavigationService }]; }, propDecorators: { disabled: [{
3415
+ type: Input
3416
+ }], actionsLayout: [{
3417
+ type: Input
3418
+ }], clearButton: [{
3419
+ type: ViewChild,
3420
+ args: ['clearButton', { static: true }]
3421
+ }], uploadButton: [{
3422
+ type: ViewChild,
3423
+ args: ['uploadButton', { static: true }]
3424
+ }], hostDefaultClass: [{
3425
+ type: HostBinding,
3426
+ args: ['class.k-actions']
3427
+ }], actionButtonsEndClassName: [{
3428
+ type: HostBinding,
3429
+ args: ['class.k-actions-end']
3430
+ }], actionButtonsStretchedClassName: [{
3431
+ type: HostBinding,
3432
+ args: ['class.k-actions-stretched']
3433
+ }], actionButtonsStartClassName: [{
3434
+ type: HostBinding,
3435
+ args: ['class.k-actions-start']
3436
+ }], actionButtonsCenterClassName: [{
3437
+ type: HostBinding,
3438
+ args: ['class.k-actions-center']
3439
+ }] } });
3144
3440
 
3145
- var UploadComponent_1;
3146
- /* tslint:disable: no-use-before-declare */
3147
3441
  /**
3148
3442
  * @hidden
3149
3443
  */
3150
3444
  const UPLOAD_VALUE_ACCESSOR = {
3151
3445
  multi: true,
3152
3446
  provide: NG_VALUE_ACCESSOR,
3153
- useExisting: forwardRef(() => UploadComponent) // tslint:disable-line:no-forward-ref
3447
+ useExisting: forwardRef(() => UploadComponent)
3154
3448
  };
3155
3449
  /**
3156
3450
  * Represents the [Kendo UI Upload component for Angular]({% slug overview_upload %}).
3157
3451
  */
3158
- let UploadComponent = UploadComponent_1 = class UploadComponent {
3452
+ class UploadComponent {
3159
3453
  constructor(uploadService, localization, navigation, dropZoneService, _ngZone, renderer, cdr, wrapper) {
3160
3454
  this.uploadService = uploadService;
3161
3455
  this.localization = localization;
@@ -3764,231 +4058,145 @@ let UploadComponent = UploadComponent_1 = class UploadComponent {
3764
4058
  this.uploadProgress.emit(args);
3765
4059
  }));
3766
4060
  }
3767
- };
3768
- __decorate([
3769
- Input(),
3770
- __metadata("design:type", Boolean),
3771
- __metadata("design:paramtypes", [Boolean])
3772
- ], UploadComponent.prototype, "autoUpload", null);
3773
- __decorate([
3774
- Input(),
3775
- __metadata("design:type", Boolean),
3776
- __metadata("design:paramtypes", [Boolean])
3777
- ], UploadComponent.prototype, "batch", null);
3778
- __decorate([
3779
- Input(),
3780
- __metadata("design:type", Boolean),
3781
- __metadata("design:paramtypes", [Boolean])
3782
- ], UploadComponent.prototype, "withCredentials", null);
3783
- __decorate([
3784
- Input(),
3785
- __metadata("design:type", String),
3786
- __metadata("design:paramtypes", [String])
3787
- ], UploadComponent.prototype, "saveField", null);
3788
- __decorate([
3789
- Input(),
3790
- __metadata("design:type", HttpHeaders),
3791
- __metadata("design:paramtypes", [HttpHeaders])
3792
- ], UploadComponent.prototype, "saveHeaders", null);
3793
- __decorate([
3794
- Input(),
3795
- __metadata("design:type", String),
3796
- __metadata("design:paramtypes", [String])
3797
- ], UploadComponent.prototype, "saveMethod", null);
3798
- __decorate([
3799
- Input(),
3800
- __metadata("design:type", String),
3801
- __metadata("design:paramtypes", [String])
3802
- ], UploadComponent.prototype, "saveUrl", null);
3803
- __decorate([
3804
- Input(),
3805
- __metadata("design:type", String),
3806
- __metadata("design:paramtypes", [String])
3807
- ], UploadComponent.prototype, "responseType", null);
3808
- __decorate([
3809
- Input(),
3810
- __metadata("design:type", String),
3811
- __metadata("design:paramtypes", [String])
3812
- ], UploadComponent.prototype, "removeField", null);
3813
- __decorate([
3814
- Input(),
3815
- __metadata("design:type", HttpHeaders),
3816
- __metadata("design:paramtypes", [HttpHeaders])
3817
- ], UploadComponent.prototype, "removeHeaders", null);
3818
- __decorate([
3819
- Input(),
3820
- __metadata("design:type", String),
3821
- __metadata("design:paramtypes", [String])
3822
- ], UploadComponent.prototype, "removeMethod", null);
3823
- __decorate([
3824
- Input(),
3825
- __metadata("design:type", String),
3826
- __metadata("design:paramtypes", [String])
3827
- ], UploadComponent.prototype, "removeUrl", null);
3828
- __decorate([
3829
- Input(),
3830
- __metadata("design:type", Object)
3831
- ], UploadComponent.prototype, "chunkable", void 0);
3832
- __decorate([
3833
- Input(),
3834
- __metadata("design:type", Boolean),
3835
- __metadata("design:paramtypes", [Boolean])
3836
- ], UploadComponent.prototype, "concurrent", null);
3837
- __decorate([
3838
- Input(),
3839
- __metadata("design:type", Boolean)
3840
- ], UploadComponent.prototype, "multiple", void 0);
3841
- __decorate([
3842
- Input(),
3843
- __metadata("design:type", Boolean)
3844
- ], UploadComponent.prototype, "disabled", void 0);
3845
- __decorate([
3846
- Input(),
3847
- __metadata("design:type", Boolean)
3848
- ], UploadComponent.prototype, "showFileList", void 0);
3849
- __decorate([
3850
- Input(),
3851
- __metadata("design:type", Number)
3852
- ], UploadComponent.prototype, "tabindex", void 0);
3853
- __decorate([
3854
- Input(),
3855
- __metadata("design:type", String)
3856
- ], UploadComponent.prototype, "zoneId", void 0);
3857
- __decorate([
3858
- Input('tabIndex'),
3859
- __metadata("design:type", Number),
3860
- __metadata("design:paramtypes", [Number])
3861
- ], UploadComponent.prototype, "tabIndex", null);
3862
- __decorate([
3863
- Input(),
3864
- __metadata("design:type", String)
3865
- ], UploadComponent.prototype, "accept", void 0);
3866
- __decorate([
3867
- Input(),
3868
- __metadata("design:type", Object),
3869
- __metadata("design:paramtypes", [Object])
3870
- ], UploadComponent.prototype, "restrictions", null);
3871
- __decorate([
3872
- Input(),
3873
- __metadata("design:type", String)
3874
- ], UploadComponent.prototype, "focusableId", void 0);
3875
- __decorate([
3876
- Input(),
3877
- __metadata("design:type", String)
3878
- ], UploadComponent.prototype, "actionsLayout", void 0);
3879
- __decorate([
3880
- ContentChild(FileTemplateDirective, { static: false }),
3881
- __metadata("design:type", FileTemplateDirective)
3882
- ], UploadComponent.prototype, "fileTemplate", void 0);
3883
- __decorate([
3884
- ContentChild(FileInfoTemplateDirective, { static: false }),
3885
- __metadata("design:type", FileInfoTemplateDirective)
3886
- ], UploadComponent.prototype, "fileInfoTemplate", void 0);
3887
- __decorate([
3888
- ViewChild('fileSelect', { static: true }),
3889
- __metadata("design:type", ElementRef)
3890
- ], UploadComponent.prototype, "fileSelect", void 0);
3891
- __decorate([
3892
- ViewChild('fileSelectButton', { static: true }),
3893
- __metadata("design:type", ElementRef)
3894
- ], UploadComponent.prototype, "fileSelectButton", void 0);
3895
- __decorate([
3896
- Output('blur'),
3897
- __metadata("design:type", EventEmitter)
3898
- ], UploadComponent.prototype, "onBlur", void 0);
3899
- __decorate([
3900
- Output(),
3901
- __metadata("design:type", EventEmitter)
3902
- ], UploadComponent.prototype, "cancel", void 0);
3903
- __decorate([
3904
- Output(),
3905
- __metadata("design:type", EventEmitter)
3906
- ], UploadComponent.prototype, "clear", void 0);
3907
- __decorate([
3908
- Output(),
3909
- __metadata("design:type", EventEmitter)
3910
- ], UploadComponent.prototype, "complete", void 0);
3911
- __decorate([
3912
- Output(),
3913
- __metadata("design:type", EventEmitter)
3914
- ], UploadComponent.prototype, "error", void 0);
3915
- __decorate([
3916
- Output('focus'),
3917
- __metadata("design:type", EventEmitter)
3918
- ], UploadComponent.prototype, "onFocus", void 0);
3919
- __decorate([
3920
- Output(),
3921
- __metadata("design:type", EventEmitter)
3922
- ], UploadComponent.prototype, "pause", void 0);
3923
- __decorate([
3924
- Output(),
3925
- __metadata("design:type", EventEmitter)
3926
- ], UploadComponent.prototype, "remove", void 0);
3927
- __decorate([
3928
- Output(),
3929
- __metadata("design:type", EventEmitter)
3930
- ], UploadComponent.prototype, "resume", void 0);
3931
- __decorate([
3932
- Output(),
3933
- __metadata("design:type", EventEmitter)
3934
- ], UploadComponent.prototype, "select", void 0);
3935
- __decorate([
3936
- Output(),
3937
- __metadata("design:type", EventEmitter)
3938
- ], UploadComponent.prototype, "success", void 0);
3939
- __decorate([
3940
- Output(),
3941
- __metadata("design:type", EventEmitter)
3942
- ], UploadComponent.prototype, "upload", void 0);
3943
- __decorate([
3944
- Output(),
3945
- __metadata("design:type", EventEmitter)
3946
- ], UploadComponent.prototype, "uploadProgress", void 0);
3947
- __decorate([
3948
- Output(),
3949
- __metadata("design:type", EventEmitter)
3950
- ], UploadComponent.prototype, "valueChange", void 0);
3951
- __decorate([
3952
- HostBinding('class.k-widget'),
3953
- HostBinding('class.k-upload'),
3954
- __metadata("design:type", Boolean)
3955
- ], UploadComponent.prototype, "hostDefaultClasses", void 0);
3956
- __decorate([
3957
- HostBinding('class.k-disabled'),
3958
- __metadata("design:type", Boolean),
3959
- __metadata("design:paramtypes", [])
3960
- ], UploadComponent.prototype, "hostDisabledClass", null);
3961
- __decorate([
3962
- HostBinding('attr.dir'),
3963
- __metadata("design:type", String),
3964
- __metadata("design:paramtypes", [])
3965
- ], UploadComponent.prototype, "dir", null);
3966
- __decorate([
3967
- HostListener('keydown', ['$event']),
3968
- __metadata("design:type", Function),
3969
- __metadata("design:paramtypes", [Object]),
3970
- __metadata("design:returntype", void 0)
3971
- ], UploadComponent.prototype, "handleKeydown", null);
3972
- UploadComponent = UploadComponent_1 = __decorate([
3973
- Component({
3974
- exportAs: 'kendoUpload',
3975
- providers: [
3976
- LocalizationService,
3977
- NavigationService,
3978
- UploadService,
3979
- DropZoneService,
3980
- UPLOAD_VALUE_ACCESSOR,
3981
- {
3982
- provide: L10N_PREFIX,
3983
- useValue: 'kendo.upload'
3984
- },
3985
- {
3986
- provide: KendoInput,
3987
- useExisting: forwardRef(() => UploadComponent_1)
3988
- }
3989
- ],
3990
- selector: 'kendo-upload',
3991
- template: `
4061
+ }
4062
+ UploadComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", 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 });
4063
+ UploadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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: { listeners: { "keydown": "handleKeydown($event)" }, properties: { "class.k-widget": "this.hostDefaultClasses", "class.k-upload": "this.hostDefaultClasses", "class.k-disabled": "this.hostDisabledClass", "attr.dir": "this.dir" } }, providers: [
4064
+ LocalizationService,
4065
+ NavigationService,
4066
+ UploadService,
4067
+ DropZoneService,
4068
+ UPLOAD_VALUE_ACCESSOR,
4069
+ {
4070
+ provide: L10N_PREFIX,
4071
+ useValue: 'kendo.upload'
4072
+ },
4073
+ {
4074
+ provide: KendoInput,
4075
+ useExisting: forwardRef(() => UploadComponent)
4076
+ }
4077
+ ], queries: [{ propertyName: "fileTemplate", first: true, predicate: FileTemplateDirective, descendants: true }, { propertyName: "fileInfoTemplate", first: true, predicate: FileInfoTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "fileSelect", first: true, predicate: ["fileSelect"], descendants: true, static: true }, { propertyName: "fileSelectButton", first: true, predicate: ["fileSelectButton"], descendants: true, static: true }], exportAs: ["kendoUpload"], usesOnChanges: true, ngImport: i0, template: `
4078
+ <ng-container kendoUploadLocalizedMessages
4079
+ i18n-cancel="kendo.upload.cancel|The text for the Cancel button"
4080
+ cancel="Cancel"
4081
+
4082
+ i18n-clearSelectedFiles="kendo.upload.clearSelectedFiles|The text for the Clear button"
4083
+ clearSelectedFiles="Clear"
4084
+
4085
+ i18n-dropFilesHere="kendo.upload.dropFilesHere|The drop zone hint"
4086
+ dropFilesHere="Drop files here to upload"
4087
+
4088
+ i18n-filesBatchStatus="kendo.upload.filesBatchStatus|The status message for a batch of files"
4089
+ filesBatchStatus="files"
4090
+
4091
+ i18n-filesBatchStatusFailed="kendo.upload.filesBatchStatusFailed|The status message for a batch of files after failed upload"
4092
+ filesBatchStatusFailed="files failed to upload."
4093
+
4094
+ i18n-filesBatchStatusUploaded="kendo.upload.filesBatchStatusUploaded|The status message for a batch of files after successful upload"
4095
+ filesBatchStatusUploaded="files successfully uploaded."
4096
+
4097
+ i18n-fileStatusFailed="kendo.upload.fileStatusFailed|The file status message after failed upload"
4098
+ fileStatusFailed="File failed to upload."
4099
+
4100
+ i18n-fileStatusUploaded="kendo.upload.fileStatusUploaded|The file status message after successful upload"
4101
+ fileStatusUploaded="File successfully uploaded."
4102
+
4103
+ i18n-headerStatusPaused="kendo.upload.headerStatusPaused|The header status message when the file upload is paused"
4104
+ headerStatusPaused="Paused"
4105
+
4106
+ i18n-headerStatusUploaded="kendo.upload.headerStatusUploaded|The header status message after file upload completion"
4107
+ headerStatusUploaded="Done"
4108
+
4109
+ i18n-headerStatusUploading="kendo.upload.headerStatusUploading|The header status message during file upload"
4110
+ headerStatusUploading="Uploading..."
4111
+
4112
+ i18n-invalidFileExtension="kendo.upload.invalidFileExtension|The text for the invalid allowed extensions restriction message"
4113
+ invalidFileExtension="File type not allowed."
4114
+
4115
+ i18n-invalidMaxFileSize="kendo.upload.invalidMaxFileSize|The text for the invalid max file size restriction message"
4116
+ invalidMaxFileSize="File size too large."
4117
+
4118
+ i18n-invalidMinFileSize="kendo.upload.invalidMinFileSize|The text for the invalid min file size restriction message"
4119
+ invalidMinFileSize="File size too small."
4120
+
4121
+ i18n-pause="kendo.upload.pause|The text for the Pause button"
4122
+ pause="Pause"
4123
+
4124
+ i18n-remove="kendo.upload.remove|The text for the Remove button"
4125
+ remove="Remove"
4126
+
4127
+ i18n-resume="kendo.upload.resume|The text for the Resume button"
4128
+ resume="Resume"
4129
+
4130
+ i18n-retry="kendo.upload.retry|The text for the Retry button"
4131
+ retry="Retry"
4132
+
4133
+ i18n-select="kendo.upload.select|The text for the Select button"
4134
+ select="Select files..."
4135
+
4136
+ i18n-uploadSelectedFiles="kendo.upload.uploadSelectedFiles|The text for the Upload files button"
4137
+ uploadSelectedFiles="Upload"
4138
+ >
4139
+ </ng-container>
4140
+ <div kendoUploadInternalDropZone
4141
+ [restrictions]="restrictions"
4142
+ [multiple]="multiple"
4143
+ [disabled]="disabled">
4144
+ <div role="button" #fileSelectButton
4145
+ [id]="focusableId"
4146
+ [attr.aria-label]="textFor('select')"
4147
+ [attr.tabindex]="selectButtonTabIndex"
4148
+ (focus)="onFileSelectButtonFocus($event)"
4149
+ (blur)="onFileSelectButtonBlur($event)"
4150
+ class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-upload-button">
4151
+ <input #fileSelect kendoFileSelect
4152
+ [attr.accept]="accept ? accept : null"
4153
+ [attr.aria-hidden]="true"
4154
+ [dir]="direction"
4155
+ [restrictions]="restrictions"
4156
+ [multiple]="multiple"
4157
+ [disabled]="disabled" />
4158
+ <span>{{textFor('select')}}</span>
4159
+ </div>
4160
+ <kendo-upload-status-total *ngIf="showTotalStatus"
4161
+ class="k-upload-status k-upload-status-total"
4162
+ [fileList]="fileList">
4163
+ </kendo-upload-status-total>
4164
+ <div class="k-dropzone-hint">{{textFor('dropFilesHere')}}</div>
4165
+ </div>
4166
+ <ul kendo-upload-file-list *ngIf="showFileList && fileList.count > 0"
4167
+ class="k-upload-files k-reset"
4168
+ [disabled]="disabled"
4169
+ [fileList]="fileList.files"
4170
+ [fileTemplate]="fileTemplate"
4171
+ [fileInfoTemplate]="fileInfoTemplate">
4172
+ </ul>
4173
+ <kendo-upload-action-buttons
4174
+ *ngIf="showActionButtons"
4175
+ [disabled]="disabled"
4176
+ [actionsLayout]="actionsLayout">
4177
+ </kendo-upload-action-buttons>
4178
+ `, isInline: true, components: [{ 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: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
4179
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadComponent, decorators: [{
4180
+ type: Component,
4181
+ args: [{
4182
+ exportAs: 'kendoUpload',
4183
+ providers: [
4184
+ LocalizationService,
4185
+ NavigationService,
4186
+ UploadService,
4187
+ DropZoneService,
4188
+ UPLOAD_VALUE_ACCESSOR,
4189
+ {
4190
+ provide: L10N_PREFIX,
4191
+ useValue: 'kendo.upload'
4192
+ },
4193
+ {
4194
+ provide: KendoInput,
4195
+ useExisting: forwardRef(() => UploadComponent)
4196
+ }
4197
+ ],
4198
+ selector: 'kendo-upload',
4199
+ template: `
3992
4200
  <ng-container kendoUploadLocalizedMessages
3993
4201
  i18n-cancel="kendo.upload.cancel|The text for the Cancel button"
3994
4202
  cancel="Cancel"
@@ -4090,18 +4298,116 @@ UploadComponent = UploadComponent_1 = __decorate([
4090
4298
  [actionsLayout]="actionsLayout">
4091
4299
  </kendo-upload-action-buttons>
4092
4300
  `
4093
- }),
4094
- __metadata("design:paramtypes", [UploadService,
4095
- LocalizationService,
4096
- NavigationService,
4097
- DropZoneService,
4098
- NgZone,
4099
- Renderer2,
4100
- ChangeDetectorRef,
4101
- ElementRef])
4102
- ], UploadComponent);
4301
+ }]
4302
+ }], 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: [{
4303
+ type: Input
4304
+ }], batch: [{
4305
+ type: Input
4306
+ }], withCredentials: [{
4307
+ type: Input
4308
+ }], saveField: [{
4309
+ type: Input
4310
+ }], saveHeaders: [{
4311
+ type: Input
4312
+ }], saveMethod: [{
4313
+ type: Input
4314
+ }], saveUrl: [{
4315
+ type: Input
4316
+ }], responseType: [{
4317
+ type: Input
4318
+ }], removeField: [{
4319
+ type: Input
4320
+ }], removeHeaders: [{
4321
+ type: Input
4322
+ }], removeMethod: [{
4323
+ type: Input
4324
+ }], removeUrl: [{
4325
+ type: Input
4326
+ }], chunkable: [{
4327
+ type: Input
4328
+ }], concurrent: [{
4329
+ type: Input
4330
+ }], multiple: [{
4331
+ type: Input
4332
+ }], disabled: [{
4333
+ type: Input
4334
+ }], showFileList: [{
4335
+ type: Input
4336
+ }], tabindex: [{
4337
+ type: Input
4338
+ }], zoneId: [{
4339
+ type: Input
4340
+ }], tabIndex: [{
4341
+ type: Input,
4342
+ args: ['tabIndex']
4343
+ }], accept: [{
4344
+ type: Input
4345
+ }], restrictions: [{
4346
+ type: Input
4347
+ }], focusableId: [{
4348
+ type: Input
4349
+ }], actionsLayout: [{
4350
+ type: Input
4351
+ }], fileTemplate: [{
4352
+ type: ContentChild,
4353
+ args: [FileTemplateDirective, { static: false }]
4354
+ }], fileInfoTemplate: [{
4355
+ type: ContentChild,
4356
+ args: [FileInfoTemplateDirective, { static: false }]
4357
+ }], fileSelect: [{
4358
+ type: ViewChild,
4359
+ args: ['fileSelect', { static: true }]
4360
+ }], fileSelectButton: [{
4361
+ type: ViewChild,
4362
+ args: ['fileSelectButton', { static: true }]
4363
+ }], onBlur: [{
4364
+ type: Output,
4365
+ args: ['blur']
4366
+ }], cancel: [{
4367
+ type: Output
4368
+ }], clear: [{
4369
+ type: Output
4370
+ }], complete: [{
4371
+ type: Output
4372
+ }], error: [{
4373
+ type: Output
4374
+ }], onFocus: [{
4375
+ type: Output,
4376
+ args: ['focus']
4377
+ }], pause: [{
4378
+ type: Output
4379
+ }], remove: [{
4380
+ type: Output
4381
+ }], resume: [{
4382
+ type: Output
4383
+ }], select: [{
4384
+ type: Output
4385
+ }], success: [{
4386
+ type: Output
4387
+ }], upload: [{
4388
+ type: Output
4389
+ }], uploadProgress: [{
4390
+ type: Output
4391
+ }], valueChange: [{
4392
+ type: Output
4393
+ }], hostDefaultClasses: [{
4394
+ type: HostBinding,
4395
+ args: ['class.k-widget']
4396
+ }, {
4397
+ type: HostBinding,
4398
+ args: ['class.k-upload']
4399
+ }], hostDisabledClass: [{
4400
+ type: HostBinding,
4401
+ args: ['class.k-disabled']
4402
+ }], dir: [{
4403
+ type: HostBinding,
4404
+ args: ['attr.dir']
4405
+ }], handleKeydown: [{
4406
+ type: HostListener,
4407
+ args: ['keydown', ['$event']]
4408
+ }] } });
4103
4409
 
4104
- let UploadDropZoneDirective = class UploadDropZoneDirective {
4410
+ class UploadDropZoneDirective {
4105
4411
  constructor(dropZoneService) {
4106
4412
  this.dropZoneService = dropZoneService;
4107
4413
  }
@@ -4151,44 +4457,37 @@ let UploadDropZoneDirective = class UploadDropZoneDirective {
4151
4457
  get componentInstance() {
4152
4458
  return this.dropZoneService.getComponents(this.zoneId);
4153
4459
  }
4154
- };
4155
- __decorate([
4156
- Input('kendoUploadDropZone'),
4157
- __metadata("design:type", String)
4158
- ], UploadDropZoneDirective.prototype, "zoneId", void 0);
4159
- __decorate([
4160
- HostListener('dragenter'),
4161
- __metadata("design:type", Function),
4162
- __metadata("design:paramtypes", []),
4163
- __metadata("design:returntype", Boolean)
4164
- ], UploadDropZoneDirective.prototype, "onElementDragEnter", null);
4165
- __decorate([
4166
- HostListener('dragover'),
4167
- __metadata("design:type", Function),
4168
- __metadata("design:paramtypes", []),
4169
- __metadata("design:returntype", Boolean)
4170
- ], UploadDropZoneDirective.prototype, "onElementDragOver", null);
4171
- __decorate([
4172
- HostListener('drop', ['$event']),
4173
- __metadata("design:type", Function),
4174
- __metadata("design:paramtypes", [Object]),
4175
- __metadata("design:returntype", Boolean)
4176
- ], UploadDropZoneDirective.prototype, "onDropListener", null);
4177
- UploadDropZoneDirective = __decorate([
4178
- Directive({
4179
- providers: [
4180
- DropZoneService
4181
- ],
4182
- selector: '[kendoUploadDropZone], [kendoFileSelectDropZone]'
4183
- }),
4184
- __metadata("design:paramtypes", [DropZoneService])
4185
- ], UploadDropZoneDirective);
4460
+ }
4461
+ UploadDropZoneDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadDropZoneDirective, deps: [{ token: DropZoneService }], target: i0.ɵɵFactoryTarget.Directive });
4462
+ UploadDropZoneDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: UploadDropZoneDirective, selector: "[kendoUploadDropZone], [kendoFileSelectDropZone]", inputs: { zoneId: ["kendoUploadDropZone", "zoneId"] }, host: { listeners: { "dragenter": "onElementDragEnter()", "dragover": "onElementDragOver()", "drop": "onDropListener($event)" } }, providers: [
4463
+ DropZoneService
4464
+ ], ngImport: i0 });
4465
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadDropZoneDirective, decorators: [{
4466
+ type: Directive,
4467
+ args: [{
4468
+ providers: [
4469
+ DropZoneService
4470
+ ],
4471
+ selector: '[kendoUploadDropZone], [kendoFileSelectDropZone]'
4472
+ }]
4473
+ }], ctorParameters: function () { return [{ type: DropZoneService }]; }, propDecorators: { zoneId: [{
4474
+ type: Input,
4475
+ args: ['kendoUploadDropZone']
4476
+ }], onElementDragEnter: [{
4477
+ type: HostListener,
4478
+ args: ['dragenter']
4479
+ }], onElementDragOver: [{
4480
+ type: HostListener,
4481
+ args: ['dragover']
4482
+ }], onDropListener: [{
4483
+ type: HostListener,
4484
+ args: ['drop', ['$event']]
4485
+ }] } });
4186
4486
 
4187
- /* tslint:disable: no-use-before-declare */
4188
4487
  /**
4189
4488
  * Represents the [Kendo UI UploadDropZone component for Angular]({% slug overview_upload %}).
4190
4489
  */
4191
- let UploadDropZoneComponent = class UploadDropZoneComponent extends DropZoneBase {
4490
+ class UploadDropZoneComponent extends DropZoneBase {
4192
4491
  constructor(element, renderer, localization) {
4193
4492
  super(element, renderer, 'k-external-dropzone-hover');
4194
4493
  this.localization = localization;
@@ -4223,40 +4522,41 @@ let UploadDropZoneComponent = class UploadDropZoneComponent extends DropZoneBase
4223
4522
  this.localizationChangeSubscription.unsubscribe();
4224
4523
  }
4225
4524
  }
4226
- };
4227
- __decorate([
4228
- HostBinding('class.k-external-dropzone'),
4229
- __metadata("design:type", Boolean)
4230
- ], UploadDropZoneComponent.prototype, "hostClass", void 0);
4231
- __decorate([
4232
- HostBinding('attr.dir'),
4233
- __metadata("design:type", String),
4234
- __metadata("design:paramtypes", [])
4235
- ], UploadDropZoneComponent.prototype, "dirAttribute", null);
4236
- __decorate([
4237
- Input(),
4238
- __metadata("design:type", String)
4239
- ], UploadDropZoneComponent.prototype, "zoneId", void 0);
4240
- __decorate([
4241
- Input(),
4242
- __metadata("design:type", String)
4243
- ], UploadDropZoneComponent.prototype, "icon", void 0);
4244
- __decorate([
4245
- Input(),
4246
- __metadata("design:type", String)
4247
- ], UploadDropZoneComponent.prototype, "iconClass", void 0);
4248
- UploadDropZoneComponent = __decorate([
4249
- Component({
4250
- exportAs: 'kendoUploadDropZone',
4251
- providers: [
4252
- LocalizationService,
4253
- {
4254
- provide: L10N_PREFIX,
4255
- useValue: 'kendo.uploaddropzone'
4256
- }
4257
- ],
4258
- selector: 'kendo-uploaddropzone',
4259
- template: `
4525
+ }
4526
+ UploadDropZoneComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadDropZoneComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
4527
+ UploadDropZoneComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", 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: [
4528
+ LocalizationService,
4529
+ {
4530
+ provide: L10N_PREFIX,
4531
+ useValue: 'kendo.uploaddropzone'
4532
+ }
4533
+ ], exportAs: ["kendoUploadDropZone"], usesInheritance: true, ngImport: i0, template: `
4534
+ <ng-container kendoUploadDropZoneLocalizedMessages
4535
+ i18n-externalDropFilesHere='kendo.uploaddropzone.externalDropFilesHere|Sets the external drop-zone hint'
4536
+ externalDropFilesHere='Drag and drop files here to upload'
4537
+ >
4538
+ </ng-container>
4539
+ <div class='k-dropzone-inner' [kendoUploadDropZone]="zoneId">
4540
+ <span [ngClass]="iconClasses"></span>
4541
+ <span class="k-dropzone-hint">{{ textFor('externalDropFilesHere') }}</span>
4542
+ <span class="k-dropzone-note">
4543
+ <ng-content></ng-content>
4544
+ </span>
4545
+ </div>
4546
+ `, isInline: true, directives: [{ type: LocalizedMessagesDirective, selector: "\n [kendoUploadLocalizedMessages],\n [kendoFileSelectLocalizedMessages],\n [kendoUploadDropZoneLocalizedMessages]\n " }, { type: UploadDropZoneDirective, selector: "[kendoUploadDropZone], [kendoFileSelectDropZone]", inputs: ["kendoUploadDropZone"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
4547
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadDropZoneComponent, decorators: [{
4548
+ type: Component,
4549
+ args: [{
4550
+ exportAs: 'kendoUploadDropZone',
4551
+ providers: [
4552
+ LocalizationService,
4553
+ {
4554
+ provide: L10N_PREFIX,
4555
+ useValue: 'kendo.uploaddropzone'
4556
+ }
4557
+ ],
4558
+ selector: 'kendo-uploaddropzone',
4559
+ template: `
4260
4560
  <ng-container kendoUploadDropZoneLocalizedMessages
4261
4561
  i18n-externalDropFilesHere='kendo.uploaddropzone.externalDropFilesHere|Sets the external drop-zone hint'
4262
4562
  externalDropFilesHere='Drag and drop files here to upload'
@@ -4270,11 +4570,20 @@ UploadDropZoneComponent = __decorate([
4270
4570
  </span>
4271
4571
  </div>
4272
4572
  `
4273
- }),
4274
- __metadata("design:paramtypes", [ElementRef,
4275
- Renderer2,
4276
- LocalizationService])
4277
- ], UploadDropZoneComponent);
4573
+ }]
4574
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1$1.LocalizationService }]; }, propDecorators: { hostClass: [{
4575
+ type: HostBinding,
4576
+ args: ['class.k-external-dropzone']
4577
+ }], dirAttribute: [{
4578
+ type: HostBinding,
4579
+ args: ['attr.dir']
4580
+ }], zoneId: [{
4581
+ type: Input
4582
+ }], icon: [{
4583
+ type: Input
4584
+ }], iconClass: [{
4585
+ type: Input
4586
+ }] } });
4278
4587
 
4279
4588
  /**
4280
4589
  * @hidden
@@ -4303,22 +4612,50 @@ const PUBLIC_DIRECTIVES = [
4303
4612
  /**
4304
4613
  * @hidden
4305
4614
  */
4306
- let SharedModule = class SharedModule {
4307
- };
4308
- SharedModule = __decorate([
4309
- NgModule({
4310
- declarations: [
4311
- PUBLIC_DIRECTIVES,
4312
- SHARED_DECLARATIONS
4313
- ],
4314
- exports: [
4315
- PUBLIC_DIRECTIVES,
4316
- SHARED_DECLARATIONS,
4317
- CommonModule
4318
- ],
4319
- imports: [CommonModule]
4320
- })
4321
- ], SharedModule);
4615
+ class SharedModule {
4616
+ }
4617
+ SharedModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SharedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4618
+ SharedModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SharedModule, declarations: [FileTemplateDirective,
4619
+ FileInfoTemplateDirective,
4620
+ CustomMessagesComponent,
4621
+ UploadDropZoneDirective,
4622
+ UploadDropZoneComponent, DropZoneInternalDirective,
4623
+ FileListComponent,
4624
+ FileListItemDirective,
4625
+ FileListItemActionButtonComponent,
4626
+ FileListMultipleItemsComponent,
4627
+ FileListSingleItemComponent,
4628
+ FileSelectDirective,
4629
+ LocalizedMessagesDirective,
4630
+ TemplateContextDirective], imports: [CommonModule], exports: [FileTemplateDirective,
4631
+ FileInfoTemplateDirective,
4632
+ CustomMessagesComponent,
4633
+ UploadDropZoneDirective,
4634
+ UploadDropZoneComponent, DropZoneInternalDirective,
4635
+ FileListComponent,
4636
+ FileListItemDirective,
4637
+ FileListItemActionButtonComponent,
4638
+ FileListMultipleItemsComponent,
4639
+ FileListSingleItemComponent,
4640
+ FileSelectDirective,
4641
+ LocalizedMessagesDirective,
4642
+ TemplateContextDirective, CommonModule] });
4643
+ SharedModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SharedModule, imports: [[CommonModule], CommonModule] });
4644
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SharedModule, decorators: [{
4645
+ type: NgModule,
4646
+ args: [{
4647
+ declarations: [
4648
+ PUBLIC_DIRECTIVES,
4649
+ SHARED_DECLARATIONS
4650
+ ],
4651
+ exports: [
4652
+ PUBLIC_DIRECTIVES,
4653
+ SHARED_DECLARATIONS,
4654
+ CommonModule
4655
+ ],
4656
+ imports: [CommonModule]
4657
+ }]
4658
+ }] });
4322
4659
 
4323
4660
  const FILESELECT_DECLARATIONS = [
4324
4661
  FileSelectComponent
@@ -4326,192 +4663,22 @@ const FILESELECT_DECLARATIONS = [
4326
4663
  /**
4327
4664
  * Represents the [NgModule](https://angular.io/api/core/NgModule) definition for the FileSelect component.
4328
4665
  */
4329
- let FileSelectModule = class FileSelectModule {
4330
- };
4331
- FileSelectModule = __decorate([
4332
- NgModule({
4333
- declarations: [FILESELECT_DECLARATIONS],
4334
- exports: [
4335
- PUBLIC_DIRECTIVES,
4336
- FILESELECT_DECLARATIONS
4337
- ],
4338
- imports: [SharedModule]
4339
- })
4340
- ], FileSelectModule);
4341
-
4342
- /**
4343
- * @hidden
4344
- */
4345
- let UploadActionButtonsComponent = class UploadActionButtonsComponent {
4346
- constructor(uploadService, localization, navigation) {
4347
- this.uploadService = uploadService;
4348
- this.localization = localization;
4349
- this.navigation = navigation;
4350
- this.hostDefaultClass = true;
4351
- this.onAction();
4352
- this.onFocus();
4353
- }
4354
- get actionButtonsEndClassName() {
4355
- return this.actionsLayout === 'end';
4356
- }
4357
- get actionButtonsStretchedClassName() {
4358
- return this.actionsLayout === 'stretched';
4359
- }
4360
- get actionButtonsStartClassName() {
4361
- return this.actionsLayout === 'start';
4362
- }
4363
- get actionButtonsCenterClassName() {
4364
- return this.actionsLayout === 'center';
4365
- }
4366
- onAction() {
4367
- this.actionSubscription = this.navigation.onActionButtonAction.subscribe((button) => {
4368
- if (button === "clear") {
4369
- this.clearFiles();
4370
- }
4371
- else {
4372
- this.performUpload();
4373
- }
4374
- });
4375
- }
4376
- onFocus() {
4377
- this.focusSubscription = this.navigation.onActionButtonFocus.subscribe((button) => {
4378
- this.focusButton(button);
4379
- });
4380
- }
4381
- focusButton(button) {
4382
- const el = (button === "clear") ? this.clearButton : this.uploadButton;
4383
- el.nativeElement.focus();
4384
- }
4385
- ngOnDestroy() {
4386
- this.actionSubscription.unsubscribe();
4387
- this.focusSubscription.unsubscribe();
4388
- }
4389
- onUploadButtonClick(event) {
4390
- event.stopImmediatePropagation();
4391
- this.performUpload();
4392
- }
4393
- performUpload() {
4394
- if (!this.disabled) {
4395
- this.uploadService.uploadFiles();
4396
- this.navigation.focusSelectButton();
4397
- }
4398
- }
4399
- onClearButtonClick(event) {
4400
- event.stopImmediatePropagation();
4401
- this.clearFiles();
4402
- }
4403
- clearFiles() {
4404
- if (!this.disabled) {
4405
- this.uploadService.clearFiles();
4406
- this.navigation.focusSelectButton();
4407
- }
4408
- }
4409
- textFor(key) {
4410
- return this.localization.get(key);
4411
- }
4412
- };
4413
- __decorate([
4414
- Input(),
4415
- __metadata("design:type", Boolean)
4416
- ], UploadActionButtonsComponent.prototype, "disabled", void 0);
4417
- __decorate([
4418
- Input(),
4419
- __metadata("design:type", String)
4420
- ], UploadActionButtonsComponent.prototype, "actionsLayout", void 0);
4421
- __decorate([
4422
- ViewChild('clearButton', { static: true }),
4423
- __metadata("design:type", ElementRef)
4424
- ], UploadActionButtonsComponent.prototype, "clearButton", void 0);
4425
- __decorate([
4426
- ViewChild('uploadButton', { static: true }),
4427
- __metadata("design:type", ElementRef)
4428
- ], UploadActionButtonsComponent.prototype, "uploadButton", void 0);
4429
- __decorate([
4430
- HostBinding('class.k-actions'),
4431
- __metadata("design:type", Boolean)
4432
- ], UploadActionButtonsComponent.prototype, "hostDefaultClass", void 0);
4433
- __decorate([
4434
- HostBinding('class.k-actions-end'),
4435
- __metadata("design:type", Boolean),
4436
- __metadata("design:paramtypes", [])
4437
- ], UploadActionButtonsComponent.prototype, "actionButtonsEndClassName", null);
4438
- __decorate([
4439
- HostBinding('class.k-actions-stretched'),
4440
- __metadata("design:type", Boolean),
4441
- __metadata("design:paramtypes", [])
4442
- ], UploadActionButtonsComponent.prototype, "actionButtonsStretchedClassName", null);
4443
- __decorate([
4444
- HostBinding('class.k-actions-start'),
4445
- __metadata("design:type", Boolean),
4446
- __metadata("design:paramtypes", [])
4447
- ], UploadActionButtonsComponent.prototype, "actionButtonsStartClassName", null);
4448
- __decorate([
4449
- HostBinding('class.k-actions-center'),
4450
- __metadata("design:type", Boolean),
4451
- __metadata("design:paramtypes", [])
4452
- ], UploadActionButtonsComponent.prototype, "actionButtonsCenterClassName", null);
4453
- UploadActionButtonsComponent = __decorate([
4454
- Component({
4455
- selector: 'kendo-upload-action-buttons',
4456
- template: `
4457
- <button #clearButton type="button" class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-clear-selected"
4458
- [attr.tabIndex]="-1"
4459
- (click)="onClearButtonClick($event)">
4460
- {{textFor('clearSelectedFiles')}}
4461
- </button>
4462
- <button #uploadButton type="button" class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-primary k-upload-selected"
4463
- [attr.tabIndex]="-1"
4464
- (click)="onUploadButtonClick($event)">
4465
- {{textFor('uploadSelectedFiles')}}
4466
- </button>
4467
- `
4468
- }),
4469
- __metadata("design:paramtypes", [UploadService,
4470
- LocalizationService,
4471
- NavigationService])
4472
- ], UploadActionButtonsComponent);
4473
-
4474
- /**
4475
- * @hidden
4476
- */
4477
- let UploadStatusTotalComponent = class UploadStatusTotalComponent {
4478
- constructor(localization) {
4479
- this.localization = localization;
4480
- }
4481
- ngDoCheck() {
4482
- this.isPaused = this.fileList.hasFileWithState([FileState.Paused]);
4483
- this.isFailed = this.fileList.hasFileWithState([FileState.Failed]);
4484
- this.isUploading = this.fileList.hasFileWithState([FileState.Uploading]);
4485
- if (this.isPaused && !this.isUploading) {
4486
- this.statusText = this.localization.get('headerStatusPaused');
4487
- }
4488
- else {
4489
- this.statusText = this.isUploading ? this.localization.get('headerStatusUploading')
4490
- : this.localization.get('headerStatusUploaded');
4491
- }
4492
- }
4493
- };
4494
- __decorate([
4495
- Input(),
4496
- __metadata("design:type", FileMap)
4497
- ], UploadStatusTotalComponent.prototype, "fileList", void 0);
4498
- UploadStatusTotalComponent = __decorate([
4499
- Component({
4500
- selector: 'kendo-upload-status-total',
4501
- template: `
4502
- <span class="k-icon"
4503
- [ngClass]="{
4504
- 'k-i-checkmark': !this.isUploading && !this.isFailed,
4505
- 'k-i-exception': !this.isUploading && this.isFailed,
4506
- 'k-i-upload': this.isUploading,
4507
- 'k-i-pause-sm': this.isPaused
4508
- }">
4509
- </span>
4510
- {{statusText}}
4511
- `
4512
- }),
4513
- __metadata("design:paramtypes", [LocalizationService])
4514
- ], UploadStatusTotalComponent);
4666
+ class FileSelectModule {
4667
+ }
4668
+ FileSelectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4669
+ FileSelectModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileSelectModule, declarations: [FileSelectComponent], imports: [SharedModule], exports: [FileTemplateDirective, FileInfoTemplateDirective, CustomMessagesComponent, UploadDropZoneDirective, UploadDropZoneComponent, FileSelectComponent] });
4670
+ FileSelectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileSelectModule, imports: [[SharedModule]] });
4671
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileSelectModule, decorators: [{
4672
+ type: NgModule,
4673
+ args: [{
4674
+ declarations: [FILESELECT_DECLARATIONS],
4675
+ exports: [
4676
+ PUBLIC_DIRECTIVES,
4677
+ FILESELECT_DECLARATIONS
4678
+ ],
4679
+ imports: [SharedModule]
4680
+ }]
4681
+ }] });
4515
4682
 
4516
4683
  const UPLOAD_DECLARATIONS = [
4517
4684
  UploadComponent,
@@ -4521,18 +4688,26 @@ const UPLOAD_DECLARATIONS = [
4521
4688
  /**
4522
4689
  * Represents the [NgModule](https://angular.io/api/core/NgModule) definition for the Upload component.
4523
4690
  */
4524
- let UploadModule = class UploadModule {
4525
- };
4526
- UploadModule = __decorate([
4527
- NgModule({
4528
- declarations: [UPLOAD_DECLARATIONS],
4529
- exports: [
4530
- PUBLIC_DIRECTIVES,
4531
- UPLOAD_DECLARATIONS
4532
- ],
4533
- imports: [SharedModule]
4534
- })
4535
- ], UploadModule);
4691
+ class UploadModule {
4692
+ }
4693
+ UploadModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4694
+ UploadModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadModule, declarations: [UploadComponent,
4695
+ UploadActionButtonsComponent,
4696
+ UploadStatusTotalComponent], imports: [SharedModule], exports: [FileTemplateDirective, FileInfoTemplateDirective, CustomMessagesComponent, UploadDropZoneDirective, UploadDropZoneComponent, UploadComponent,
4697
+ UploadActionButtonsComponent,
4698
+ UploadStatusTotalComponent] });
4699
+ UploadModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadModule, imports: [[SharedModule]] });
4700
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadModule, decorators: [{
4701
+ type: NgModule,
4702
+ args: [{
4703
+ declarations: [UPLOAD_DECLARATIONS],
4704
+ exports: [
4705
+ PUBLIC_DIRECTIVES,
4706
+ UPLOAD_DECLARATIONS
4707
+ ],
4708
+ imports: [SharedModule]
4709
+ }]
4710
+ }] });
4536
4711
 
4537
4712
  /**
4538
4713
  * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
@@ -4559,19 +4734,26 @@ UploadModule = __decorate([
4559
4734
  *
4560
4735
  * ```
4561
4736
  */
4562
- let UploadsModule = class UploadsModule {
4563
- };
4564
- UploadsModule = __decorate([
4565
- NgModule({
4566
- exports: [
4567
- FileSelectModule,
4568
- UploadModule
4569
- ]
4570
- })
4571
- ], UploadsModule);
4737
+ class UploadsModule {
4738
+ }
4739
+ UploadsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4740
+ UploadsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadsModule, exports: [FileSelectModule,
4741
+ UploadModule] });
4742
+ UploadsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadsModule, imports: [FileSelectModule,
4743
+ UploadModule] });
4744
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadsModule, decorators: [{
4745
+ type: NgModule,
4746
+ args: [{
4747
+ exports: [
4748
+ FileSelectModule,
4749
+ UploadModule
4750
+ ]
4751
+ }]
4752
+ }] });
4572
4753
 
4573
4754
  /**
4574
4755
  * Generated bundle index. Do not edit.
4575
4756
  */
4576
4757
 
4577
- export { DropZoneBase, DropZoneInternalDirective, DropZoneService, PreventableEvent, FILESELECT_VALUE_ACCESSOR, LocalizedMessagesDirective, Messages, NavigationService, FileListItemDirective, FileListItemBase, PUBLIC_DIRECTIVES, SHARED_DECLARATIONS, SharedModule, UPLOAD_VALUE_ACCESSOR, UploadService, FileSelectModule, UploadModule, UploadsModule, UploadComponent, FileSelectComponent, UploadDropZoneComponent, FileSelectDirective, FileListComponent, FileListSingleItemComponent, FileListItemActionButtonComponent, FileListMultipleItemsComponent, FileTemplateDirective, FileInfoTemplateDirective, TemplateContextDirective, UploadStatusTotalComponent, UploadActionButtonsComponent, UploadDropZoneDirective, CustomMessagesComponent, CancelEvent, ClearEvent, ErrorEvent, PauseEvent, RemoveEvent, ResumeEvent, SelectEvent, SuccessEvent, UploadEvent, UploadProgressEvent, FileState };
4758
+ export { CancelEvent, ClearEvent, CustomMessagesComponent, ErrorEvent, FileInfoTemplateDirective, FileListComponent, FileListItemActionButtonComponent, FileListMultipleItemsComponent, FileListSingleItemComponent, FileSelectComponent, FileSelectDirective, FileSelectModule, FileState, FileTemplateDirective, PauseEvent, RemoveEvent, ResumeEvent, SelectEvent, SuccessEvent, TemplateContextDirective, UploadActionButtonsComponent, UploadComponent, UploadDropZoneComponent, UploadDropZoneDirective, UploadEvent, UploadModule, UploadProgressEvent, UploadStatusTotalComponent, UploadsModule };
4759
+