@progress/kendo-angular-upload 8.0.3-dev.202203090930 → 9.0.0-next.202203230841

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 +33 -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} +2191 -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 +34 -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: 1646818140,
27
+ publishDate: 1648024815,
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,716 @@ 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
+ selector: '[templateContext]'
1897
+ }]
1898
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { templateContext: [{
1899
+ type: Input
1900
+ }] } });
2156
1901
 
2157
1902
  /**
2158
1903
  * @hidden
2159
1904
  */
2160
- class DropZoneBase {
2161
- constructor(element, renderer, hoverClass) {
2162
- this.element = element;
2163
- this.renderer = renderer;
2164
- this.hideIntervalElement = null;
2165
- this.hoverClass = hoverClass;
1905
+ class FileListSingleItemComponent extends FileListItemBase {
1906
+ constructor(localization, uploadService) {
1907
+ super(uploadService);
1908
+ this.localization = localization;
1909
+ this.subscribeUploadProgress((args) => {
1910
+ if (args.files[0].uid === this.file.uid) {
1911
+ this.progressComplete = args.percentComplete;
1912
+ }
1913
+ });
2166
1914
  }
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);
1915
+ get fileStatusText() {
1916
+ const errors = this.file.validationErrors;
1917
+ if (this.file.state === FileState.Uploaded) {
1918
+ return `${this.textFor('fileStatusUploaded')}`;
2182
1919
  }
2183
- return false;
2184
- }
2185
- /**
2186
- * @hidden
2187
- */
2188
- onElementDragOverListener() {
2189
- this.lastDragElement = new Date();
2190
- return false;
1920
+ if (this.file.state === FileState.Failed) {
1921
+ return `${this.textFor('fileStatusFailed')}`;
1922
+ }
1923
+ if (!isPresent(errors)) {
1924
+ return this.getTotalFilesSizeMessage([this.file]);
1925
+ }
1926
+ return this.getFileValidationMessage(this.file);
2191
1927
  }
2192
- calculateTimeDiff(prevEvent) {
2193
- return new Date().getTime() - prevEvent.getTime();
1928
+ get showProgress() {
1929
+ const showProgress = this.file.state === FileState.Uploading || this.file.state === FileState.Paused;
1930
+ return showProgress ? 'active' : 'inactive';
2194
1931
  }
2195
- addClass(className) {
2196
- this.renderer.addClass(this.element.nativeElement, className);
1932
+ get fileGroupClass() {
1933
+ return getFileGroupCssClass(this.file.extension ? this.file.extension : '');
2197
1934
  }
2198
- removeClass(className) {
2199
- this.renderer.removeClass(this.element.nativeElement, className);
1935
+ get isUploadSuccessful() {
1936
+ return this.file.state === FileState.Uploaded;
2200
1937
  }
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
- });
1938
+ get isUploadFailed() {
1939
+ return this.file.state === FileState.Failed;
2230
1940
  }
2231
- ngOnDestroy() {
2232
- this.ngZone.runOutsideAngular(() => {
2233
- if (this.unsubscribeDocumentDragEnter) {
2234
- this.unsubscribeDocumentDragEnter();
2235
- }
2236
- if (this.unsubscribeDocumentDragOver) {
2237
- this.unsubscribeDocumentDragOver();
2238
- }
2239
- });
1941
+ get isNotYetUploaded() {
1942
+ return !this.isUploadFailed && !this.isUploadSuccessful;
2240
1943
  }
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]
1944
+ }
1945
+ 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 });
1946
+ 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: `
1947
+ <div class="k-progressbar" [@progressState]="showProgress">
1948
+ <span class="k-progress" [style.width]="progressComplete + '%'"></span>
1949
+ </div>
1950
+ <span class="k-file-group-wrapper">
1951
+ <span class="k-file-group k-icon" [ngClass]="fileGroupClass"></span>
1952
+ </span>
1953
+ <span class="k-file-name-size-wrapper">
1954
+ <ng-container *ngIf="!fileInfoTemplate">
1955
+ <span class="k-file-name" [title]="file.name">{{ file.name }}</span>
1956
+ <span [ngClass]="{
1957
+ 'k-file-validation-message': file.validationErrors,
1958
+ 'k-file-size': !file.validationErrors && isNotYetUploaded,
1959
+ 'k-text-success': isUploadSuccessful,
1960
+ 'k-text-error': file.validationErrors || isUploadFailed,
1961
+ 'k-file-information': isUploadSuccessful || isUploadFailed
1962
+ }"
1963
+ >{{fileStatusText}}</span>
1964
+ </ng-container>
1965
+ <ng-template *ngIf="fileInfoTemplate"
1966
+ [templateContext]="{
1967
+ templateRef: fileInfoTemplate.templateRef,
1968
+ state: file.state,
1969
+ $implicit: [file]
1970
+ }">
1971
+ </ng-template>
1972
+ </span>
1973
+ <kendo-upload-file-list-item-action-button
1974
+ [file]='file'
1975
+ [disabled]='disabled'
1976
+ [progress]='progressComplete'>
1977
+ </kendo-upload-file-list-item-action-button>
1978
+ `, 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: [
1979
+ trigger('progressState', [
1980
+ state('active', style({ opacity: 1 })),
1981
+ state('inactive', style({ opacity: 0 })),
1982
+ transition('void => active', style({ opacity: 0 })),
1983
+ transition('inactive => active', style({ opacity: 1 })),
1984
+ transition('active => inactive', animate('1s 2s ease-out'))
1985
+ ])
1986
+ ] });
1987
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListSingleItemComponent, decorators: [{
1988
+ type: Component,
1989
+ args: [{
1990
+ animations: [
1991
+ trigger('progressState', [
1992
+ state('active', style({ opacity: 1 })),
1993
+ state('inactive', style({ opacity: 0 })),
1994
+ transition('void => active', style({ opacity: 0 })),
1995
+ transition('inactive => active', style({ opacity: 1 })),
1996
+ transition('active => inactive', animate('1s 2s ease-out'))
1997
+ ])
1998
+ ],
1999
+ selector: 'kendo-upload-file-list-single-item',
2000
+ template: `
2001
+ <div class="k-progressbar" [@progressState]="showProgress">
2002
+ <span class="k-progress" [style.width]="progressComplete + '%'"></span>
2003
+ </div>
2004
+ <span class="k-file-group-wrapper">
2005
+ <span class="k-file-group k-icon" [ngClass]="fileGroupClass"></span>
2006
+ </span>
2007
+ <span class="k-file-name-size-wrapper">
2008
+ <ng-container *ngIf="!fileInfoTemplate">
2009
+ <span class="k-file-name" [title]="file.name">{{ file.name }}</span>
2010
+ <span [ngClass]="{
2011
+ 'k-file-validation-message': file.validationErrors,
2012
+ 'k-file-size': !file.validationErrors && isNotYetUploaded,
2013
+ 'k-text-success': isUploadSuccessful,
2014
+ 'k-text-error': file.validationErrors || isUploadFailed,
2015
+ 'k-file-information': isUploadSuccessful || isUploadFailed
2016
+ }"
2017
+ >{{fileStatusText}}</span>
2018
+ </ng-container>
2019
+ <ng-template *ngIf="fileInfoTemplate"
2020
+ [templateContext]="{
2021
+ templateRef: fileInfoTemplate.templateRef,
2022
+ state: file.state,
2023
+ $implicit: [file]
2024
+ }">
2025
+ </ng-template>
2026
+ </span>
2027
+ <kendo-upload-file-list-item-action-button
2028
+ [file]='file'
2029
+ [disabled]='disabled'
2030
+ [progress]='progressComplete'>
2031
+ </kendo-upload-file-list-item-action-button>
2305
2032
  `
2306
- }),
2307
- __metadata("design:paramtypes", [ElementRef,
2308
- Renderer2,
2309
- NgZone,
2310
- UploadService])
2311
- ], DropZoneInternalDirective);
2033
+ }]
2034
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: UploadService }]; }, propDecorators: { disabled: [{
2035
+ type: Input
2036
+ }], file: [{
2037
+ type: Input
2038
+ }], fileInfoTemplate: [{
2039
+ type: Input
2040
+ }] } });
2312
2041
 
2313
2042
  /**
2314
2043
  * @hidden
2315
2044
  */
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;
2045
+ class FileListMultipleItemsComponent extends FileListItemBase {
2046
+ constructor(localization, uploadService) {
2047
+ super(uploadService);
2048
+ this.localization = localization;
2049
+ this.subscribeUploadProgress((args) => {
2050
+ if (args.files[0].uid === this.files[0].uid) {
2051
+ this.progressComplete = args.percentComplete;
2052
+ }
2053
+ });
2335
2054
  }
2336
- get kFileInvalid() {
2337
- return filesHaveValidationErrors(this.files);
2055
+ get showProgress() {
2056
+ const showProgress = this.files[0].state === FileState.Uploading || this.files[0].state === FileState.Paused;
2057
+ return showProgress ? 'active' : 'inactive';
2338
2058
  }
2339
- get kFileProgress() {
2340
- return this.files[0].state === FileState.Uploading ||
2341
- this.files[0].state === FileState.Paused;
2059
+ ngOnInit() {
2060
+ this.filesHaveErrors = super.filesHaveValidationErrors(this.files);
2342
2061
  }
2343
- get kFileSuccess() {
2344
- if (this.uploadService.component === 'Upload') {
2345
- return this.files[0].state === FileState.Uploaded ||
2346
- this.files[0].state === FileState.Initial;
2062
+ fileStatusText(file) {
2063
+ const errors = file.validationErrors;
2064
+ if (!isPresent(errors)) {
2065
+ return this.getTotalFilesSizeMessage([file]);
2347
2066
  }
2348
- return false;
2349
- }
2350
- get kStateFocused() {
2351
- return this.focused;
2067
+ return this.getFileValidationMessage(file);
2352
2068
  }
2353
- onFocus() {
2354
- this.focused = true;
2069
+ get batchStatusText() {
2070
+ const state = this.files[0].state;
2071
+ const fileCount = this.files.length;
2072
+ if (state === FileState.Uploaded) {
2073
+ return `${fileCount} ${this.textFor('filesBatchStatusUploaded')}`;
2074
+ }
2075
+ if (state === FileState.Failed) {
2076
+ return `${fileCount} ${this.textFor('filesBatchStatusFailed')}`;
2077
+ }
2078
+ return `${fileCount} ${this.textFor('filesBatchStatus')}`;
2355
2079
  }
2356
- onBlur() {
2357
- this.focused = false;
2080
+ get isUploadSuccessful() {
2081
+ return this.files[0].state === FileState.Uploaded;
2358
2082
  }
2359
- onClick(event) {
2360
- if (!isFocusable(event.target) && !hasClasses(event.target, IGNORE_TARGET_CLASSES)) {
2361
- this.navigationService.focusedIndex = this.index;
2362
- }
2083
+ get isUploadFailed() {
2084
+ return this.files[0].state === FileState.Failed;
2363
2085
  }
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);
2086
+ }
2087
+ 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 });
2088
+ 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: `
2089
+ <div class="k-progressbar" [@progressState]="showProgress">
2090
+ <span class="k-progress" [style.width]="progressComplete + '%'"></span>
2091
+ </div>
2092
+ <span class="k-multiple-files-group-wrapper">
2093
+ <span class="k-file-group k-icon k-i-copy"></span>
2094
+ </span>
2095
+ <span class="k-multiple-files-wrapper">
2096
+ <ng-container *ngIf="!fileInfoTemplate">
2097
+ <span *ngFor="let file of files" class="k-file-name-size-wrapper">
2098
+ <span [title]="file.name" class="k-file-name">
2099
+ {{file.name}}
2100
+ </span>
2101
+ <span [ngClass]="{
2102
+ 'k-text-error': file.validationErrors,
2103
+ 'k-file-validation-message': file.validationErrors,
2104
+ 'k-file-size': !file.validationErrors
2105
+ }"
2106
+ >{{fileStatusText(file)}}</span>
2107
+ </span>
2108
+ <span class="k-file-information"
2109
+ [ngClass]="{
2110
+ 'k-text-success': isUploadSuccessful,
2111
+ 'k-text-error': isUploadFailed
2112
+ }"
2113
+ >{{batchStatusText}}</span>
2114
+ </ng-container>
2115
+ <ng-template *ngIf="fileInfoTemplate"
2116
+ [templateContext]="{
2117
+ templateRef: fileInfoTemplate.templateRef,
2118
+ state: files[0].state,
2119
+ $implicit: files
2120
+ }">
2121
+ </ng-template>
2122
+ </span>
2123
+ <kendo-upload-file-list-item-action-button
2124
+ [file]='files[0]'
2125
+ [disabled]='disabled'
2126
+ [progress]='progressComplete'>
2127
+ </kendo-upload-file-list-item-action-button>
2128
+ `, 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: [
2129
+ trigger('progressState', [
2130
+ state('active', style({ opacity: 1 })),
2131
+ state('inactive', style({ opacity: 0 })),
2132
+ transition('void => active', style({ opacity: 0 })),
2133
+ transition('inactive => active', style({ opacity: 1 })),
2134
+ transition('active => inactive', animate('1s 2s ease-out'))
2135
+ ])
2136
+ ] });
2137
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListMultipleItemsComponent, decorators: [{
2138
+ type: Component,
2139
+ args: [{
2140
+ animations: [
2141
+ trigger('progressState', [
2142
+ state('active', style({ opacity: 1 })),
2143
+ state('inactive', style({ opacity: 0 })),
2144
+ transition('void => active', style({ opacity: 0 })),
2145
+ transition('inactive => active', style({ opacity: 1 })),
2146
+ transition('active => inactive', animate('1s 2s ease-out'))
2147
+ ])
2148
+ ],
2149
+ selector: 'kendo-upload-file-list-multiple-items',
2150
+ template: `
2151
+ <div class="k-progressbar" [@progressState]="showProgress">
2152
+ <span class="k-progress" [style.width]="progressComplete + '%'"></span>
2153
+ </div>
2154
+ <span class="k-multiple-files-group-wrapper">
2155
+ <span class="k-file-group k-icon k-i-copy"></span>
2156
+ </span>
2157
+ <span class="k-multiple-files-wrapper">
2158
+ <ng-container *ngIf="!fileInfoTemplate">
2159
+ <span *ngFor="let file of files" class="k-file-name-size-wrapper">
2160
+ <span [title]="file.name" class="k-file-name">
2161
+ {{file.name}}
2162
+ </span>
2163
+ <span [ngClass]="{
2164
+ 'k-text-error': file.validationErrors,
2165
+ 'k-file-validation-message': file.validationErrors,
2166
+ 'k-file-size': !file.validationErrors
2167
+ }"
2168
+ >{{fileStatusText(file)}}</span>
2169
+ </span>
2170
+ <span class="k-file-information"
2171
+ [ngClass]="{
2172
+ 'k-text-success': isUploadSuccessful,
2173
+ 'k-text-error': isUploadFailed
2174
+ }"
2175
+ >{{batchStatusText}}</span>
2176
+ </ng-container>
2177
+ <ng-template *ngIf="fileInfoTemplate"
2178
+ [templateContext]="{
2179
+ templateRef: fileInfoTemplate.templateRef,
2180
+ state: files[0].state,
2181
+ $implicit: files
2182
+ }">
2183
+ </ng-template>
2184
+ </span>
2185
+ <kendo-upload-file-list-item-action-button
2186
+ [file]='files[0]'
2187
+ [disabled]='disabled'
2188
+ [progress]='progressComplete'>
2189
+ </kendo-upload-file-list-item-action-button>
2190
+ `
2191
+ }]
2192
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: UploadService }]; }, propDecorators: { disabled: [{
2193
+ type: Input
2194
+ }], files: [{
2195
+ type: Input
2196
+ }], fileInfoTemplate: [{
2197
+ type: Input
2198
+ }] } });
2438
2199
 
2200
+ /* eslint-disable @angular-eslint/component-selector */
2439
2201
  /**
2440
2202
  * @hidden
2441
2203
  */
2442
- let FileListComponent = class FileListComponent {
2204
+ class FileListComponent {
2443
2205
  constructor(uploadService, navigation) {
2444
2206
  this.uploadService = uploadService;
2445
2207
  this.navigation = navigation;
@@ -2487,31 +2249,9 @@ let FileListComponent = class FileListComponent {
2487
2249
  this.focusSubscription.unsubscribe();
2488
2250
  this.actionSubscription.unsubscribe();
2489
2251
  }
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: `
2252
+ }
2253
+ 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 });
2254
+ 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
2255
  <ng-template ngFor
2516
2256
  [ngForOf]="fileList"
2517
2257
  let-files
@@ -2539,623 +2279,1176 @@ FileListComponent = __decorate([
2539
2279
  }"></ng-template>
2540
2280
  </li>
2541
2281
  </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
- }
2282
+ `, 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"] }] });
2283
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListComponent, decorators: [{
2284
+ type: Component,
2285
+ args: [{
2286
+ selector: '[kendo-upload-file-list]',
2287
+ template: `
2288
+ <ng-template ngFor
2289
+ [ngForOf]="fileList"
2290
+ let-files
2291
+ let-index="index">
2292
+ <li kendoUploadFileListItem [files]='files' [index]='index'>
2293
+ <kendo-upload-file-list-single-item
2294
+ class='k-file-single'
2295
+ *ngIf='files.length === 1 && !fileTemplate'
2296
+ [disabled]='disabled'
2297
+ [file]='files[0]'
2298
+ [fileInfoTemplate]="fileInfoTemplate">
2299
+ </kendo-upload-file-list-single-item>
2300
+ <kendo-upload-file-list-multiple-items
2301
+ class='k-file-multiple'
2302
+ *ngIf='files.length > 1 && !fileTemplate'
2303
+ [disabled]='disabled'
2304
+ [files]='files'
2305
+ [fileInfoTemplate]="fileInfoTemplate">
2306
+ </kendo-upload-file-list-multiple-items>
2307
+ <ng-template *ngIf="fileTemplate"
2308
+ [templateContext]="{
2309
+ templateRef: fileTemplate.templateRef,
2310
+ state: files[0].state,
2311
+ $implicit: files
2312
+ }"></ng-template>
2313
+ </li>
2314
+ </ng-template>
2315
+ `
2316
+ }]
2317
+ }], ctorParameters: function () { return [{ type: UploadService }, { type: NavigationService }]; }, propDecorators: { disabled: [{
2318
+ type: Input
2319
+ }], fileList: [{
2320
+ type: Input
2321
+ }], fileTemplate: [{
2322
+ type: Input
2323
+ }], fileInfoTemplate: [{
2324
+ type: Input
2325
+ }], fileListItems: [{
2326
+ type: ViewChildren,
2327
+ args: [FileListItemDirective]
2328
+ }] } });
2329
+
2330
+ /**
2331
+ * @hidden
2332
+ */
2333
+ class Messages extends ComponentMessages {
2334
+ }
2335
+ Messages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2336
+ 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 });
2337
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Messages, decorators: [{
2338
+ type: Directive
2339
+ }], propDecorators: { cancel: [{
2340
+ type: Input
2341
+ }], clearSelectedFiles: [{
2342
+ type: Input
2343
+ }], dropFilesHere: [{
2344
+ type: Input
2345
+ }], externalDropFilesHere: [{
2346
+ type: Input
2347
+ }], filesBatchStatus: [{
2348
+ type: Input
2349
+ }], filesBatchStatusFailed: [{
2350
+ type: Input
2351
+ }], filesBatchStatusUploaded: [{
2352
+ type: Input
2353
+ }], fileStatusFailed: [{
2354
+ type: Input
2355
+ }], fileStatusUploaded: [{
2356
+ type: Input
2357
+ }], headerStatusPaused: [{
2358
+ type: Input
2359
+ }], headerStatusUploaded: [{
2360
+ type: Input
2361
+ }], headerStatusUploading: [{
2362
+ type: Input
2363
+ }], invalidFileExtension: [{
2364
+ type: Input
2365
+ }], invalidMaxFileSize: [{
2366
+ type: Input
2367
+ }], invalidMinFileSize: [{
2368
+ type: Input
2369
+ }], pause: [{
2370
+ type: Input
2371
+ }], remove: [{
2372
+ type: Input
2373
+ }], resume: [{
2374
+ type: Input
2375
+ }], retry: [{
2376
+ type: Input
2377
+ }], select: [{
2378
+ type: Input
2379
+ }], uploadSelectedFiles: [{
2380
+ type: Input
2381
+ }] } });
2382
+
2383
+ /**
2384
+ * @hidden
2385
+ */
2386
+ class LocalizedMessagesDirective extends Messages {
2387
+ constructor(service) {
2388
+ super();
2389
+ this.service = service;
2570
2390
  }
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;
2391
+ }
2392
+ 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 });
2393
+ LocalizedMessagesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: LocalizedMessagesDirective, selector: "\n [kendoUploadLocalizedMessages],\n [kendoFileSelectLocalizedMessages],\n [kendoUploadDropZoneLocalizedMessages]\n ", providers: [
2394
+ {
2395
+ provide: Messages,
2396
+ useExisting: forwardRef(() => LocalizedMessagesDirective)
2397
+ }
2398
+ ], usesInheritance: true, ngImport: i0 });
2399
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
2400
+ type: Directive,
2401
+ args: [{
2402
+ providers: [
2403
+ {
2404
+ provide: Messages,
2405
+ useExisting: forwardRef(() => LocalizedMessagesDirective)
2406
+ }
2407
+ ],
2408
+ selector: `
2409
+ [kendoUploadLocalizedMessages],
2410
+ [kendoFileSelectLocalizedMessages],
2411
+ [kendoUploadDropZoneLocalizedMessages]
2412
+ `
2413
+ }]
2414
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
2415
+
2416
+ /**
2417
+ * @hidden
2418
+ */
2419
+ const INVALIDMAXFILESIZE = "invalidMaxFileSize";
2420
+ /**
2421
+ * @hidden
2422
+ */
2423
+ const INVALIDMINFILESIZE = "invalidMinFileSize";
2424
+ /**
2425
+ * @hidden
2426
+ */
2427
+ const INVALIDFILEEXTENSION = "invalidFileExtension";
2428
+ const validateFileExtension = (file, allowedExtensions) => {
2429
+ if (allowedExtensions.length > 0) {
2430
+ if (allowedExtensions.indexOf(file.extension.toLowerCase()) < 0) {
2431
+ file.validationErrors = file.validationErrors || [];
2432
+ if (file.validationErrors.indexOf(INVALIDFILEEXTENSION) < 0) {
2433
+ file.validationErrors.push(INVALIDFILEEXTENSION);
2434
+ }
2580
2435
  }
2581
2436
  }
2582
- onRetryClick() {
2583
- if (this.disabled) {
2584
- return;
2437
+ };
2438
+ const validateFileSize = (file, minFileSize, maxFileSize) => {
2439
+ if (minFileSize !== 0 && file.size < minFileSize) {
2440
+ file.validationErrors = file.validationErrors || [];
2441
+ if (file.validationErrors.indexOf(INVALIDMINFILESIZE) < 0) {
2442
+ file.validationErrors.push(INVALIDMINFILESIZE);
2585
2443
  }
2586
- this.uploadService.retryFiles(this.file.uid);
2587
2444
  }
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);
2445
+ if (maxFileSize !== 0 && file.size > maxFileSize) {
2446
+ file.validationErrors = file.validationErrors || [];
2447
+ if (file.validationErrors.indexOf(INVALIDMAXFILESIZE) < 0) {
2448
+ file.validationErrors.push(INVALIDMAXFILESIZE);
2599
2449
  }
2600
- this.navigation.focusSelectButton();
2601
2450
  }
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
- }
2451
+ };
2452
+ const parseAllowedExtensions = (extensions) => {
2453
+ const allowedExtensions = extensions.map((ext) => {
2454
+ var parsedExt = (ext.substring(0, 1) === ".") ? ext : ("." + ext);
2455
+ return parsedExt.toLowerCase();
2456
+ });
2457
+ return allowedExtensions;
2458
+ };
2459
+ /**
2460
+ * @hidden
2461
+ */
2462
+ const validateFiles = (files, restrictionInfo) => {
2463
+ const allowedExtensions = parseAllowedExtensions(restrictionInfo.allowedExtensions);
2464
+ const maxFileSize = restrictionInfo.maxFileSize;
2465
+ const minFileSize = restrictionInfo.minFileSize;
2466
+ let i;
2467
+ for (i = 0; i < files.length; i++) {
2468
+ validateFileExtension(files[i], allowedExtensions);
2469
+ validateFileSize(files[i], minFileSize, maxFileSize);
2613
2470
  }
2614
- get actionButtonTitle() {
2615
- if (this.file.state === FileState.Uploading) {
2616
- return this.localization.get('cancel');
2471
+ };
2472
+
2473
+ /**
2474
+ * @hidden
2475
+ */
2476
+ class DropZoneBase {
2477
+ constructor(element, renderer, cssClass) {
2478
+ this.element = element;
2479
+ this.renderer = renderer;
2480
+ this.hideIntervalElement = null;
2481
+ this.hoverClass = cssClass;
2482
+ }
2483
+ /**
2484
+ * @hidden
2485
+ */
2486
+ onElementDragEnterListener() {
2487
+ this.addClass(this.hoverClass);
2488
+ this.lastDragElement = new Date();
2489
+ if (!this.hideIntervalElement) {
2490
+ this.hideIntervalElement = setInterval(() => {
2491
+ if (this.calculateTimeDiff(this.lastDragElement) < 100) {
2492
+ return;
2493
+ }
2494
+ this.removeClass(this.hoverClass);
2495
+ clearInterval(this.hideIntervalElement);
2496
+ this.hideIntervalElement = null;
2497
+ }, 100);
2617
2498
  }
2618
- return this.localization.get('remove');
2499
+ return false;
2619
2500
  }
2620
- get retryButtonTitle() {
2621
- return this.localization.get('retry');
2501
+ /**
2502
+ * @hidden
2503
+ */
2504
+ onElementDragOverListener() {
2505
+ this.lastDragElement = new Date();
2506
+ return false;
2622
2507
  }
2623
- get pauseResumeButtonTitle() {
2624
- if (this.file.state === FileState.Uploading) {
2625
- return this.localization.get('pause');
2626
- }
2627
- return this.localization.get('resume');
2508
+ calculateTimeDiff(prevEvent) {
2509
+ return new Date().getTime() - prevEvent.getTime();
2628
2510
  }
2629
- get isUploading() {
2630
- return this.file.state === FileState.Uploading;
2511
+ addClass(className) {
2512
+ this.renderer.addClass(this.element.nativeElement, className);
2631
2513
  }
2632
- get isFailed() {
2633
- return this.file.state === FileState.Failed;
2514
+ removeClass(className) {
2515
+ this.renderer.removeClass(this.element.nativeElement, className);
2634
2516
  }
2635
- get isPaused() {
2636
- return this.file.state === FileState.Paused;
2517
+ }
2518
+ 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 });
2519
+ DropZoneBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DropZoneBase, host: { listeners: { "dragenter": "onElementDragEnterListener()", "dragover": "onElementDragOverListener()" } }, ngImport: i0 });
2520
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropZoneBase, decorators: [{
2521
+ type: Directive
2522
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
2523
+ type: Inject,
2524
+ args: ['hoverClass']
2525
+ }] }]; }, propDecorators: { onElementDragEnterListener: [{
2526
+ type: HostListener,
2527
+ args: ['dragenter']
2528
+ }], onElementDragOverListener: [{
2529
+ type: HostListener,
2530
+ args: ['dragover']
2531
+ }] } });
2532
+
2533
+ /**
2534
+ * @hidden
2535
+ */
2536
+ class DropZoneInternalDirective extends DropZoneBase {
2537
+ constructor(element, renderer, ngZone, uploadService) {
2538
+ super(element, renderer, 'k-dropzone-hover');
2539
+ this.ngZone = ngZone;
2540
+ this.uploadService = uploadService;
2541
+ this.initialClassName = true;
2542
+ this.hideIntervalDocument = null;
2543
+ this.activeClass = 'k-dropzone-active';
2544
+ this.ngZone.runOutsideAngular(() => {
2545
+ this.unsubscribeDocumentDragEnter = this.renderer.listen('document', 'dragenter', () => this.onDocumentDragEnter());
2546
+ this.unsubscribeDocumentDragOver = this.renderer.listen('document', 'dragover', () => this.onDocumentDragOver());
2547
+ });
2637
2548
  }
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;
2549
+ ngOnDestroy() {
2550
+ this.ngZone.runOutsideAngular(() => {
2551
+ if (this.unsubscribeDocumentDragEnter) {
2552
+ this.unsubscribeDocumentDragEnter();
2553
+ }
2554
+ if (this.unsubscribeDocumentDragOver) {
2555
+ this.unsubscribeDocumentDragOver();
2556
+ }
2557
+ });
2643
2558
  }
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;
2559
+ onDocumentDragEnter() {
2560
+ this.addClass(this.activeClass);
2561
+ this.lastDragDocument = new Date();
2562
+ if (!this.hideIntervalDocument) {
2563
+ this.hideIntervalDocument = setInterval(() => {
2564
+ if (this.calculateTimeDiff(this.lastDragDocument) < 100) {
2565
+ return;
2566
+ }
2567
+ this.removeClass(this.activeClass);
2568
+ clearInterval(this.hideIntervalDocument);
2569
+ this.hideIntervalDocument = null;
2570
+ }, 100);
2648
2571
  }
2649
- return true;
2572
+ return false;
2650
2573
  }
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>
2574
+ /**
2575
+ * @hidden
2576
+ */
2577
+ onDocumentDragOver() {
2578
+ this.lastDragDocument = new Date();
2579
+ return false;
2580
+ }
2581
+ onDropListener(event) {
2582
+ let droppedFiles = event.dataTransfer.files;
2583
+ if (droppedFiles.length > 0 && !this.disabled) {
2584
+ let files = getAllFileInfo(droppedFiles);
2585
+ files = assignGuidToFiles(files, !this.uploadService.async.batch);
2586
+ if (!this.multiple) {
2587
+ files.splice(1, files.length - 1);
2588
+ this.uploadService.clearFiles();
2589
+ }
2590
+ validateFiles(files, this.restrictions);
2591
+ this.uploadService.addFiles(files);
2592
+ }
2593
+ return false;
2594
+ }
2595
+ }
2596
+ 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 });
2597
+ 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 });
2598
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropZoneInternalDirective, decorators: [{
2599
+ type: Directive,
2600
+ args: [{
2601
+ selector: `
2602
+ [kendoUploadInternalDropZone],
2603
+ [kendoFileSelectInternalDropZone]
2715
2604
  `
2716
- }),
2717
- __metadata("design:paramtypes", [UploadService,
2718
- LocalizationService,
2719
- NavigationService])
2720
- ], FileListItemActionButtonComponent);
2605
+ }]
2606
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: UploadService }]; }, propDecorators: { disabled: [{
2607
+ type: Input
2608
+ }], multiple: [{
2609
+ type: Input
2610
+ }], restrictions: [{
2611
+ type: Input
2612
+ }], initialClassName: [{
2613
+ type: HostBinding,
2614
+ args: ['class.k-dropzone']
2615
+ }], onDropListener: [{
2616
+ type: HostListener,
2617
+ args: ['drop', ['$event']]
2618
+ }] } });
2721
2619
 
2722
2620
  /**
2723
2621
  * @hidden
2724
2622
  */
2725
- class FileListItemBase {
2726
- constructor(uploadService) {
2623
+ class FileSelectDirective {
2624
+ constructor(uploadService, navigation, el) {
2727
2625
  this.uploadService = uploadService;
2728
- this.progressComplete = 0;
2626
+ this.navigation = navigation;
2627
+ this.type = "file";
2628
+ this.autocomplete = "off";
2629
+ this.tabIndex = -1;
2630
+ this.element = el;
2729
2631
  }
2730
- subscribeUploadProgress(uploadProgressHandler) {
2731
- this.uploadProgressSubscription = this.uploadService.uploadProgressEvent.subscribe(uploadProgressHandler);
2632
+ get nameAttribute() {
2633
+ return this.uploadService.async.saveField;
2732
2634
  }
2733
- fileHasValidationErrors(file) {
2734
- return fileHasValidationErrors(file);
2635
+ get multipleAttribute() {
2636
+ return this.multiple ? "multiple" : null;
2735
2637
  }
2736
- filesHaveValidationErrors(files) {
2737
- return filesHaveValidationErrors(files);
2638
+ get dirAttribute() {
2639
+ return this.dir;
2738
2640
  }
2739
- ngOnDestroy() {
2740
- this.uploadProgressSubscription.unsubscribe();
2641
+ get disabledAttribute() {
2642
+ return this.disabled ? "true" : null;
2741
2643
  }
2742
- getFileValidationMessage(file) {
2743
- let validationMessage;
2744
- if (file.validationErrors && file.validationErrors.length > 0) {
2745
- validationMessage = this.localization.get(file.validationErrors[0]);
2644
+ onInputChange(event) {
2645
+ const ua = navigator.userAgent;
2646
+ const webkit = /(webkit)[ \/]([\w.]+)/i;
2647
+ const ie = /(windows)[ \/]([\w.]+)/i;
2648
+ let selectedFiles = inputFiles(event.target);
2649
+ selectedFiles = assignGuidToFiles(selectedFiles, !this.uploadService.async.batch);
2650
+ validateFiles(selectedFiles, this.restrictions);
2651
+ if (!this.multiple) {
2652
+ this.uploadService.clearFiles();
2746
2653
  }
2747
- return validationMessage;
2748
- }
2749
- getTotalFilesSizeMessage(files) {
2750
- return getTotalFilesSizeMessage(files);
2751
- }
2752
- textFor(key) {
2753
- return this.localization.get(key);
2654
+ this.uploadService.addFiles(selectedFiles);
2655
+ /*
2656
+ Chrome, IE, Edge and Safari do not trigger a `change` event
2657
+ when a file with the same name is selected a number of consecutive times.
2658
+ As a workaround, clear the input value after handling the file.
2659
+ */
2660
+ const native = this.element.nativeElement;
2661
+ if (ua.match(webkit) || ua.match(ie)) {
2662
+ native.type = "";
2663
+ native.type = "file";
2664
+ }
2665
+ setTimeout(() => {
2666
+ this.navigation.focusedIndex = -1;
2667
+ });
2754
2668
  }
2755
2669
  }
2670
+ 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 });
2671
+ 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 });
2672
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileSelectDirective, decorators: [{
2673
+ type: Directive,
2674
+ args: [{
2675
+ selector: '[kendoFileSelect]'
2676
+ }]
2677
+ }], ctorParameters: function () { return [{ type: UploadService }, { type: NavigationService }, { type: i0.ElementRef }]; }, propDecorators: { dir: [{
2678
+ type: Input
2679
+ }], disabled: [{
2680
+ type: Input
2681
+ }], multiple: [{
2682
+ type: Input
2683
+ }], restrictions: [{
2684
+ type: Input
2685
+ }], type: [{
2686
+ type: HostBinding,
2687
+ args: ["attr.type"]
2688
+ }], autocomplete: [{
2689
+ type: HostBinding,
2690
+ args: ["attr.autocomplete"]
2691
+ }], tabIndex: [{
2692
+ type: HostBinding,
2693
+ args: ["attr.tabindex"]
2694
+ }], nameAttribute: [{
2695
+ type: HostBinding,
2696
+ args: ["attr.name"]
2697
+ }], multipleAttribute: [{
2698
+ type: HostBinding,
2699
+ args: ["attr.multiple"]
2700
+ }], dirAttribute: [{
2701
+ type: HostBinding,
2702
+ args: ["attr.dir"]
2703
+ }], disabledAttribute: [{
2704
+ type: HostBinding,
2705
+ args: ["attr.disabled"]
2706
+ }], onInputChange: [{
2707
+ type: HostListener,
2708
+ args: ["change", ["$event"]]
2709
+ }] } });
2756
2710
 
2757
2711
  /**
2758
2712
  * @hidden
2759
2713
  */
2760
- let FileListMultipleItemsComponent = class FileListMultipleItemsComponent extends FileListItemBase {
2761
- constructor(localization, uploadService) {
2762
- super(uploadService);
2714
+ const FILESELECT_VALUE_ACCESSOR = {
2715
+ multi: true,
2716
+ provide: NG_VALUE_ACCESSOR,
2717
+ useExisting: forwardRef(() => FileSelectComponent)
2718
+ };
2719
+ class FileSelectComponent {
2720
+ constructor(uploadService, localization, navigation, dropZoneService, ngZone, renderer, cdr, wrapper) {
2721
+ this.uploadService = uploadService;
2763
2722
  this.localization = localization;
2764
- this.subscribeUploadProgress((args) => {
2765
- if (args.files[0].uid === this.files[0].uid) {
2766
- this.progressComplete = args.percentComplete;
2767
- }
2723
+ this.navigation = navigation;
2724
+ this.dropZoneService = dropZoneService;
2725
+ this.ngZone = ngZone;
2726
+ this.renderer = renderer;
2727
+ this.cdr = cdr;
2728
+ /**
2729
+ * Disables the FileSelect.
2730
+ * The default value is `false`.
2731
+ */
2732
+ this.disabled = false;
2733
+ /**
2734
+ * Enables the selection of multiple files
2735
+ * ([see example]({% slug fileprocessing_upload %}#toc-upload-of-sinlge-or-multiple-files)).
2736
+ * If set to `false`, only one file can be selected at a time.
2737
+ */
2738
+ this.multiple = true;
2739
+ /**
2740
+ * Toggles the visibility of the file list.
2741
+ */
2742
+ this.showFileList = true;
2743
+ /**
2744
+ * Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the FileSelect.
2745
+ */
2746
+ this.tabindex = 0;
2747
+ /**
2748
+ * @hidden
2749
+ */
2750
+ this.focusableId = `k-${guid()}`;
2751
+ /**
2752
+ * Fires when the user navigates outside the component.
2753
+ */
2754
+ this.onBlur = new EventEmitter();
2755
+ /**
2756
+ * Fires when the component is focused.
2757
+ */
2758
+ this.onFocus = new EventEmitter();
2759
+ /**
2760
+ * Fires when files are selected. If prevented, the selected files will not be added to the list.
2761
+ */
2762
+ this.select = new EventEmitter();
2763
+ /**
2764
+ * Fires when a file is about to be removed. If prevented, the file will remain in the list.
2765
+ */
2766
+ this.remove = new EventEmitter();
2767
+ /**
2768
+ * Fires when the value of the component has changed as a result of a successful `select` or `remove` operation.
2769
+ */
2770
+ this.valueChange = new EventEmitter();
2771
+ this.hostDefaultClasses = true;
2772
+ /**
2773
+ * @hidden
2774
+ */
2775
+ this._restrictions = {
2776
+ allowedExtensions: [],
2777
+ maxFileSize: 0,
2778
+ minFileSize: 0
2779
+ };
2780
+ this.onTouchedCallback = (_) => { };
2781
+ this.onChangeCallback = (_) => { };
2782
+ validatePackage(packageMetadata);
2783
+ this.wrapper = wrapper.nativeElement;
2784
+ this.direction = localization.rtl ? 'rtl' : 'ltr';
2785
+ this.navigation.computeKeys(this.direction);
2786
+ this.fileList = this.uploadService.files;
2787
+ this.localizationChangeSubscription = localization.changes.subscribe(({ rtl }) => {
2788
+ this.direction = rtl ? 'rtl' : 'ltr';
2789
+ this.navigation.computeKeys(this.direction);
2768
2790
  });
2791
+ this.subscribeBlur();
2792
+ this.subscribeFocus();
2793
+ this.attachEventHandlers();
2794
+ this.setDefaultSettings();
2769
2795
  }
2770
- get showProgress() {
2771
- const showProgress = this.files[0].state === FileState.Uploading || this.files[0].state === FileState.Paused;
2772
- return showProgress ? 'active' : 'inactive';
2796
+ /**
2797
+ * Sets the `name` attribute of the `input` element of the FileSelect.
2798
+ */
2799
+ set name(name) {
2800
+ this.uploadService.async.saveField = name;
2773
2801
  }
2774
- ngOnInit() {
2775
- this.filesHaveErrors = super.filesHaveValidationErrors(this.files);
2802
+ get name() {
2803
+ return this.uploadService.async.saveField;
2776
2804
  }
2777
- fileStatusText(file) {
2778
- const errors = file.validationErrors;
2779
- if (!isPresent(errors)) {
2780
- return this.getTotalFilesSizeMessage([file]);
2781
- }
2782
- return this.getFileValidationMessage(file);
2805
+ /**
2806
+ * Sets the restrictions for selected files.
2807
+ */
2808
+ set restrictions(restrictions) {
2809
+ let parsedRestrictions = Object.assign({}, this._restrictions, restrictions);
2810
+ this._restrictions = parsedRestrictions;
2783
2811
  }
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')}`;
2812
+ get restrictions() {
2813
+ return this._restrictions;
2794
2814
  }
2795
- get isUploadSuccessful() {
2796
- return this.files[0].state === FileState.Uploaded;
2815
+ get hostDisabledClass() {
2816
+ return this.disabled;
2797
2817
  }
2798
- get isUploadFailed() {
2799
- return this.files[0].state === FileState.Failed;
2818
+ get dir() {
2819
+ return this.direction;
2800
2820
  }
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>
2821
+ ngOnInit() {
2822
+ this.renderer.removeAttribute(this.wrapper, "tabindex");
2823
+ if (this.zoneId) {
2824
+ this.dropZoneService.addComponent(this, this.zoneId);
2825
+ }
2826
+ }
2827
+ /**
2828
+ * @hidden
2829
+ */
2830
+ textFor(key) {
2831
+ return this.localization.get(key);
2832
+ }
2833
+ /**
2834
+ * Focuses the underlying input element.
2835
+ */
2836
+ focus() {
2837
+ setTimeout(() => {
2838
+ this.fileSelectButton.nativeElement.focus();
2839
+ });
2840
+ }
2841
+ ngOnDestroy() {
2842
+ this.fileList.clear();
2843
+ if (this.blurSubscription) {
2844
+ this.blurSubscription.unsubscribe();
2845
+ }
2846
+ if (this.wrapperFocusSubscription) {
2847
+ this.wrapperFocusSubscription.unsubscribe();
2848
+ }
2849
+ if (this.selectButtonFocusSubscription) {
2850
+ this.selectButtonFocusSubscription.unsubscribe();
2851
+ }
2852
+ if (this.localizationChangeSubscription) {
2853
+ this.localizationChangeSubscription.unsubscribe();
2854
+ }
2855
+ if (this.subs) {
2856
+ this.subs.unsubscribe();
2857
+ }
2858
+ }
2859
+ /**
2860
+ * @hidden
2861
+ */
2862
+ handleKeydown(event) {
2863
+ if (this.disabled) {
2864
+ return;
2865
+ }
2866
+ if ((event.keyCode === Keys.Enter || event.keyCode === Keys.Space) &&
2867
+ event.target === this.fileSelectButton.nativeElement) {
2868
+ event.preventDefault();
2869
+ this.fileSelect.nativeElement.click();
2870
+ return;
2871
+ }
2872
+ if (hasClasses(event.target, UPLOAD_CLASSES) ||
2873
+ (!isFocusable(event.target) && !hasClasses(event.target, IGNORE_TARGET_CLASSES))) {
2874
+ this.navigation.process(event);
2875
+ }
2876
+ }
2877
+ /**
2878
+ * @hidden
2879
+ */
2880
+ writeValue(newValue) {
2881
+ let isValid = true;
2882
+ if (newValue instanceof Array) {
2883
+ newValue.forEach((file) => {
2884
+ if (!validateInitialFileSelectFile(file)) {
2885
+ isValid = false;
2886
+ }
2887
+ });
2888
+ if (isValid) {
2889
+ this.uploadService.addInitialFileSelectFiles(newValue);
2890
+ }
2891
+ }
2892
+ if (newValue === null) {
2893
+ this.fileList.clear();
2894
+ }
2895
+ this.cdr.markForCheck();
2896
+ }
2897
+ /**
2898
+ * @hidden
2899
+ */
2900
+ registerOnChange(fn) {
2901
+ this.onChangeCallback = fn;
2902
+ }
2903
+ /**
2904
+ * @hidden
2905
+ */
2906
+ registerOnTouched(fn) {
2907
+ this.onTouchedCallback = fn;
2908
+ }
2909
+ /**
2910
+ * @hidden
2911
+ */
2912
+ setDisabledState(isDisabled) {
2913
+ this.disabled = isDisabled;
2914
+ }
2915
+ /**
2916
+ * Removes specific file from the file list.
2917
+ */
2918
+ removeFileByUid(uid) {
2919
+ this.uploadService.removeFiles(uid);
2920
+ }
2921
+ /**
2922
+ * Visually clears all files from the UI.
2923
+ */
2924
+ clearFiles() {
2925
+ this.uploadService.clearFiles();
2926
+ }
2927
+ /**
2928
+ * @hidden
2929
+ * Used to determine if the component is empty.
2930
+ */
2931
+ isEmpty() {
2932
+ return false;
2933
+ }
2934
+ /**
2935
+ * @hidden
2936
+ * Used by the external dropzone to add files to the FileSelect
2937
+ */
2938
+ addFiles(files) {
2939
+ this.uploadService.addFiles(files);
2940
+ }
2941
+ /**
2942
+ * @hidden
2943
+ */
2944
+ get selectButtonTabIndex() {
2945
+ return this.disabled ? undefined : this.tabindex;
2946
+ }
2947
+ /**
2948
+ * @hidden
2949
+ */
2950
+ onFileSelectButtonFocus(_event) {
2951
+ this.renderer.addClass(this.fileSelectButton.nativeElement, 'k-focus');
2952
+ if (!this.navigation.focused) {
2953
+ this.navigation.focusedIndex = -1;
2954
+ }
2955
+ }
2956
+ /**
2957
+ * @hidden
2958
+ */
2959
+ onFileSelectButtonBlur(_event) {
2960
+ this.renderer.removeClass(this.fileSelectButton.nativeElement, 'k-focus');
2961
+ }
2962
+ subscribeBlur() {
2963
+ if (!isDocumentAvailable()) {
2964
+ return;
2965
+ }
2966
+ this.ngZone.runOutsideAngular(() => {
2967
+ this.documentClick = fromEvent(document, 'click').pipe(filter((event) => {
2968
+ return !(this.wrapper !== event.target && this.wrapper.contains(event.target));
2969
+ }));
2970
+ this.blurSubscription = merge(this.documentClick, this.navigation.onTab).subscribe(() => {
2971
+ if (this.navigation.focused) {
2972
+ this.ngZone.run(() => {
2973
+ this.navigation.focused = false;
2974
+ this.onTouchedCallback();
2975
+ this.onBlur.emit();
2976
+ });
2977
+ }
2978
+ });
2979
+ });
2980
+ }
2981
+ subscribeFocus() {
2982
+ this.wrapperFocusSubscription = this.navigation.onWrapperFocus.subscribe(() => {
2983
+ this.onFocus.emit();
2984
+ });
2985
+ this.selectButtonFocusSubscription = this.navigation.onSelectButtonFocus.subscribe(() => {
2986
+ this.fileSelectButton.nativeElement.focus();
2987
+ });
2988
+ }
2989
+ attachEventHandlers() {
2990
+ this.subs = this.uploadService.changeEvent.subscribe((files) => {
2991
+ let model = [];
2992
+ if (files !== null) {
2993
+ files.forEach((file) => {
2994
+ if (file.state === FileState.Initial) {
2995
+ model.push(file);
2996
+ }
2997
+ if (file.state === FileState.Selected && file.rawFile && !file.validationErrors) {
2998
+ model.push(file.rawFile);
2999
+ }
3000
+ });
3001
+ }
3002
+ if (model.length === 0) {
3003
+ model = null;
3004
+ }
3005
+ this.onChangeCallback(model);
3006
+ this.valueChange.emit(model);
3007
+ });
3008
+ this.subs.add(this.uploadService.removeEvent.subscribe((args) => {
3009
+ this.remove.emit(args);
3010
+ }));
3011
+ this.subs.add(this.uploadService.selectEvent.subscribe((args) => {
3012
+ this.select.emit(args);
3013
+ }));
3014
+ }
3015
+ setDefaultSettings() {
3016
+ this.uploadService.async.autoUpload = false;
3017
+ this.uploadService.component = 'FileSelect';
3018
+ }
3019
+ }
3020
+ 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 });
3021
+ 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: [
3022
+ LocalizationService,
3023
+ NavigationService,
3024
+ UploadService,
3025
+ DropZoneService,
3026
+ FILESELECT_VALUE_ACCESSOR,
3027
+ {
3028
+ provide: L10N_PREFIX,
3029
+ useValue: 'kendo.fileselect'
3030
+ },
3031
+ {
3032
+ provide: KendoInput,
3033
+ useExisting: forwardRef(() => FileSelectComponent)
3034
+ }
3035
+ ], 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: `
3036
+ <ng-container kendoFileSelectLocalizedMessages
3037
+ i18n-dropFilesHere="kendo.fileselect.dropFilesHere|The drop zone hint"
3038
+ dropFilesHere="Drop files here to select"
3039
+
3040
+ i18n-invalidFileExtension="kendo.fileselect.invalidFileExtension|The text for the invalid allowed extensions restriction message"
3041
+ invalidFileExtension="File type not allowed."
3042
+
3043
+ i18n-invalidMaxFileSize="kendo.fileselect.invalidMaxFileSize|The text for the invalid max file size restriction message"
3044
+ invalidMaxFileSize="File size too large."
3045
+
3046
+ i18n-invalidMinFileSize="kendo.fileselect.invalidMinFileSize|The text for the invalid min file size restriction message"
3047
+ invalidMinFileSize="File size too small."
3048
+
3049
+ i18n-remove="kendo.fileselect.remove|The text for the Remove button"
3050
+ remove="Remove"
3051
+
3052
+ i18n-select="kendo.fileselect.select|The text for the Select button"
3053
+ select="Select files..."
3054
+ >
2852
3055
  </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>
3056
+ <div kendoFileSelectInternalDropZone
3057
+ [restrictions]="restrictions"
3058
+ [multiple]="multiple"
3059
+ [disabled]="disabled">
3060
+ <div role="button" #fileSelectButton
3061
+ [id]="focusableId"
3062
+ [attr.aria-label]="textFor('select')"
3063
+ [attr.tabindex]="selectButtonTabIndex"
3064
+ (focus)="onFileSelectButtonFocus($event)"
3065
+ (blur)="onFileSelectButtonBlur($event)"
3066
+ class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-upload-button">
3067
+ <input #fileSelect kendoFileSelect
3068
+ [attr.accept]="accept ? accept : null"
3069
+ [dir]="direction"
3070
+ [restrictions]="restrictions"
3071
+ [multiple]="multiple"
3072
+ [disabled]="disabled" />
3073
+ <span>{{textFor('select')}}</span>
3074
+ </div>
3075
+ <div class="k-dropzone-hint">{{textFor('dropFilesHere')}}</div>
3076
+ </div>
3077
+ <ul kendo-upload-file-list
3078
+ class="k-upload-files k-reset"
3079
+ *ngIf="showFileList && fileList.count > 0"
3080
+ [disabled]="disabled"
3081
+ [fileList]="fileList.files"
3082
+ [fileTemplate]="fileTemplate"
3083
+ [fileInfoTemplate]="fileInfoTemplate">
3084
+ </ul>
3085
+ `, 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"] }] });
3086
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileSelectComponent, decorators: [{
3087
+ type: Component,
3088
+ args: [{
3089
+ exportAs: 'kendoFileSelect',
3090
+ providers: [
3091
+ LocalizationService,
3092
+ NavigationService,
3093
+ UploadService,
3094
+ DropZoneService,
3095
+ FILESELECT_VALUE_ACCESSOR,
3096
+ {
3097
+ provide: L10N_PREFIX,
3098
+ useValue: 'kendo.fileselect'
3099
+ },
3100
+ {
3101
+ provide: KendoInput,
3102
+ useExisting: forwardRef(() => FileSelectComponent)
3103
+ }
3104
+ ],
3105
+ selector: 'kendo-fileselect',
3106
+ template: `
3107
+ <ng-container kendoFileSelectLocalizedMessages
3108
+ i18n-dropFilesHere="kendo.fileselect.dropFilesHere|The drop zone hint"
3109
+ dropFilesHere="Drop files here to select"
3110
+
3111
+ i18n-invalidFileExtension="kendo.fileselect.invalidFileExtension|The text for the invalid allowed extensions restriction message"
3112
+ invalidFileExtension="File type not allowed."
3113
+
3114
+ i18n-invalidMaxFileSize="kendo.fileselect.invalidMaxFileSize|The text for the invalid max file size restriction message"
3115
+ invalidMaxFileSize="File size too large."
3116
+
3117
+ i18n-invalidMinFileSize="kendo.fileselect.invalidMinFileSize|The text for the invalid min file size restriction message"
3118
+ invalidMinFileSize="File size too small."
3119
+
3120
+ i18n-remove="kendo.fileselect.remove|The text for the Remove button"
3121
+ remove="Remove"
3122
+
3123
+ i18n-select="kendo.fileselect.select|The text for the Select button"
3124
+ select="Select files..."
3125
+ >
3126
+ </ng-container>
3127
+ <div kendoFileSelectInternalDropZone
3128
+ [restrictions]="restrictions"
3129
+ [multiple]="multiple"
3130
+ [disabled]="disabled">
3131
+ <div role="button" #fileSelectButton
3132
+ [id]="focusableId"
3133
+ [attr.aria-label]="textFor('select')"
3134
+ [attr.tabindex]="selectButtonTabIndex"
3135
+ (focus)="onFileSelectButtonFocus($event)"
3136
+ (blur)="onFileSelectButtonBlur($event)"
3137
+ class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-upload-button">
3138
+ <input #fileSelect kendoFileSelect
3139
+ [attr.accept]="accept ? accept : null"
3140
+ [dir]="direction"
3141
+ [restrictions]="restrictions"
3142
+ [multiple]="multiple"
3143
+ [disabled]="disabled" />
3144
+ <span>{{textFor('select')}}</span>
3145
+ </div>
3146
+ <div class="k-dropzone-hint">{{textFor('dropFilesHere')}}</div>
3147
+ </div>
3148
+ <ul kendo-upload-file-list
3149
+ class="k-upload-files k-reset"
3150
+ *ngIf="showFileList && fileList.count > 0"
3151
+ [disabled]="disabled"
3152
+ [fileList]="fileList.files"
3153
+ [fileTemplate]="fileTemplate"
3154
+ [fileInfoTemplate]="fileInfoTemplate">
3155
+ </ul>
2866
3156
  `
2867
- }),
2868
- __metadata("design:paramtypes", [LocalizationService,
2869
- UploadService])
2870
- ], FileListMultipleItemsComponent);
3157
+ }]
3158
+ }], 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: [{
3159
+ type: Input
3160
+ }], disabled: [{
3161
+ type: Input
3162
+ }], multiple: [{
3163
+ type: Input
3164
+ }], name: [{
3165
+ type: Input
3166
+ }], showFileList: [{
3167
+ type: Input
3168
+ }], tabindex: [{
3169
+ type: Input
3170
+ }], restrictions: [{
3171
+ type: Input
3172
+ }], zoneId: [{
3173
+ type: Input
3174
+ }], focusableId: [{
3175
+ type: Input
3176
+ }], fileTemplate: [{
3177
+ type: ContentChild,
3178
+ args: [FileTemplateDirective, { static: false }]
3179
+ }], fileInfoTemplate: [{
3180
+ type: ContentChild,
3181
+ args: [FileInfoTemplateDirective, { static: false }]
3182
+ }], fileSelect: [{
3183
+ type: ViewChild,
3184
+ args: ['fileSelect', { static: true }]
3185
+ }], fileSelectButton: [{
3186
+ type: ViewChild,
3187
+ args: ['fileSelectButton', { static: true }]
3188
+ }], onBlur: [{
3189
+ type: Output,
3190
+ args: ['blur']
3191
+ }], onFocus: [{
3192
+ type: Output,
3193
+ args: ['focus']
3194
+ }], select: [{
3195
+ type: Output
3196
+ }], remove: [{
3197
+ type: Output
3198
+ }], valueChange: [{
3199
+ type: Output
3200
+ }], hostDefaultClasses: [{
3201
+ type: HostBinding,
3202
+ args: ['class.k-widget']
3203
+ }, {
3204
+ type: HostBinding,
3205
+ args: ['class.k-upload']
3206
+ }], hostDisabledClass: [{
3207
+ type: HostBinding,
3208
+ args: ['class.k-disabled']
3209
+ }], dir: [{
3210
+ type: HostBinding,
3211
+ args: ['attr.dir']
3212
+ }], handleKeydown: [{
3213
+ type: HostListener,
3214
+ args: ['keydown', ['$event']]
3215
+ }] } });
3216
+
3217
+ /**
3218
+ * Custom component messages override default component messages ([more information and example]({% slug globalization_upload %})).
3219
+ *
3220
+ * @example
3221
+ * ```html-no-run
3222
+ * <kendo-fileselect>
3223
+ * <kendo-fileselect-messages
3224
+ * dropFilesHere="Drop your file here"
3225
+ * select="Upload file">
3226
+ * </kendo-fileselect-messages>
3227
+ * </kendo-fileselect>
3228
+ * ```
3229
+ */
3230
+ class CustomMessagesComponent extends Messages {
3231
+ constructor(service) {
3232
+ super();
3233
+ this.service = service;
3234
+ }
3235
+ get override() {
3236
+ return true;
3237
+ }
3238
+ }
3239
+ 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 });
3240
+ 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: [
3241
+ {
3242
+ provide: Messages,
3243
+ useExisting: forwardRef(() => CustomMessagesComponent)
3244
+ }
3245
+ ], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
3246
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CustomMessagesComponent, decorators: [{
3247
+ type: Component,
3248
+ args: [{
3249
+ providers: [
3250
+ {
3251
+ provide: Messages,
3252
+ useExisting: forwardRef(() => CustomMessagesComponent)
3253
+ }
3254
+ ],
3255
+ selector: 'kendo-upload-messages, kendo-fileselect-messages, kendo-uploaddropzone-messages',
3256
+ template: ``
3257
+ }]
3258
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
2871
3259
 
2872
3260
  /**
2873
3261
  * @hidden
2874
3262
  */
2875
- let FileListSingleItemComponent = class FileListSingleItemComponent extends FileListItemBase {
2876
- constructor(localization, uploadService) {
2877
- super(uploadService);
3263
+ class UploadStatusTotalComponent {
3264
+ constructor(localization) {
2878
3265
  this.localization = localization;
2879
- this.subscribeUploadProgress((args) => {
2880
- if (args.files[0].uid === this.file.uid) {
2881
- this.progressComplete = args.percentComplete;
2882
- }
2883
- });
2884
3266
  }
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')}`;
3267
+ ngDoCheck() {
3268
+ this.isPaused = this.fileList.hasFileWithState([FileState.Paused]);
3269
+ this.isFailed = this.fileList.hasFileWithState([FileState.Failed]);
3270
+ this.isUploading = this.fileList.hasFileWithState([FileState.Uploading]);
3271
+ if (this.isPaused && !this.isUploading) {
3272
+ this.statusText = this.localization.get('headerStatusPaused');
2892
3273
  }
2893
- if (!isPresent(errors)) {
2894
- return this.getTotalFilesSizeMessage([this.file]);
3274
+ else {
3275
+ this.statusText = this.isUploading ? this.localization.get('headerStatusUploading')
3276
+ : this.localization.get('headerStatusUploaded');
2895
3277
  }
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
3278
  }
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]
3279
+ }
3280
+ 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 });
3281
+ 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: `
3282
+ <span class="k-icon"
3283
+ [ngClass]="{
3284
+ 'k-i-checkmark': !this.isUploading && !this.isFailed,
3285
+ 'k-i-exception': !this.isUploading && this.isFailed,
3286
+ 'k-i-upload': this.isUploading,
3287
+ 'k-i-pause-sm': this.isPaused
2963
3288
  }">
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>
3289
+ </span>
3290
+ {{statusText}}
3291
+ `, isInline: true, directives: [{ type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
3292
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadStatusTotalComponent, decorators: [{
3293
+ type: Component,
3294
+ args: [{
3295
+ selector: 'kendo-upload-status-total',
3296
+ template: `
3297
+ <span class="k-icon"
3298
+ [ngClass]="{
3299
+ 'k-i-checkmark': !this.isUploading && !this.isFailed,
3300
+ 'k-i-exception': !this.isUploading && this.isFailed,
3301
+ 'k-i-upload': this.isUploading,
3302
+ 'k-i-pause-sm': this.isPaused
3303
+ }">
3304
+ </span>
3305
+ {{statusText}}
2971
3306
  `
2972
- }),
2973
- __metadata("design:paramtypes", [LocalizationService, UploadService])
2974
- ], FileListSingleItemComponent);
3307
+ }]
3308
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; }, propDecorators: { fileList: [{
3309
+ type: Input
3310
+ }] } });
2975
3311
 
2976
3312
  /**
2977
3313
  * @hidden
2978
3314
  */
2979
- let FileSelectDirective = class FileSelectDirective {
2980
- constructor(uploadService, navigation, el) {
3315
+ class UploadActionButtonsComponent {
3316
+ constructor(uploadService, localization, navigation) {
2981
3317
  this.uploadService = uploadService;
3318
+ this.localization = localization;
2982
3319
  this.navigation = navigation;
2983
- this.type = "file";
2984
- this.autocomplete = "off";
2985
- this.tabIndex = -1;
2986
- this.element = el;
3320
+ this.hostDefaultClass = true;
3321
+ this.onAction();
3322
+ this.onFocus();
2987
3323
  }
2988
- get nameAttribute() {
2989
- return this.uploadService.async.saveField;
3324
+ get actionButtonsEndClassName() {
3325
+ return this.actionsLayout === 'end';
2990
3326
  }
2991
- get multipleAttribute() {
2992
- return this.multiple ? "multiple" : null;
3327
+ get actionButtonsStretchedClassName() {
3328
+ return this.actionsLayout === 'stretched';
2993
3329
  }
2994
- get dirAttribute() {
2995
- return this.dir;
3330
+ get actionButtonsStartClassName() {
3331
+ return this.actionsLayout === 'start';
2996
3332
  }
2997
- get disabledAttribute() {
2998
- return this.disabled ? "true" : null;
3333
+ get actionButtonsCenterClassName() {
3334
+ return this.actionsLayout === 'center';
2999
3335
  }
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;
3336
+ onAction() {
3337
+ this.actionSubscription = this.navigation.onActionButtonAction.subscribe((button) => {
3338
+ if (button === "clear") {
3339
+ this.clearFiles();
3340
+ }
3341
+ else {
3342
+ this.performUpload();
3343
+ }
3023
3344
  });
3024
3345
  }
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;
3346
+ onFocus() {
3347
+ this.focusSubscription = this.navigation.onActionButtonFocus.subscribe((button) => {
3348
+ this.focusButton(button);
3349
+ });
3097
3350
  }
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;
3351
+ focusButton(button) {
3352
+ const el = (button === "clear") ? this.clearButton : this.uploadButton;
3353
+ el.nativeElement.focus();
3122
3354
  }
3123
- set templateContext(context) {
3124
- if (this.insertedViewRef) {
3125
- this.viewContainerRef.remove(this.viewContainerRef.indexOf(this.insertedViewRef));
3126
- this.insertedViewRef = undefined;
3355
+ ngOnDestroy() {
3356
+ this.actionSubscription.unsubscribe();
3357
+ this.focusSubscription.unsubscribe();
3358
+ }
3359
+ onUploadButtonClick(event) {
3360
+ event.stopImmediatePropagation();
3361
+ this.performUpload();
3362
+ }
3363
+ performUpload() {
3364
+ if (!this.disabled) {
3365
+ this.uploadService.uploadFiles();
3366
+ this.navigation.focusSelectButton();
3127
3367
  }
3128
- if (context.templateRef) {
3129
- this.insertedViewRef = this.viewContainerRef.createEmbeddedView(context.templateRef, context);
3368
+ }
3369
+ onClearButtonClick(event) {
3370
+ event.stopImmediatePropagation();
3371
+ this.clearFiles();
3372
+ }
3373
+ clearFiles() {
3374
+ if (!this.disabled) {
3375
+ this.uploadService.clearFiles();
3376
+ this.navigation.focusSelectButton();
3130
3377
  }
3131
3378
  }
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);
3379
+ textFor(key) {
3380
+ return this.localization.get(key);
3381
+ }
3382
+ }
3383
+ 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 });
3384
+ 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: `
3385
+ <button #clearButton type="button" class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-clear-selected"
3386
+ [attr.tabIndex]="-1"
3387
+ (click)="onClearButtonClick($event)">
3388
+ {{textFor('clearSelectedFiles')}}
3389
+ </button>
3390
+ <button #uploadButton type="button" class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-primary k-upload-selected"
3391
+ [attr.tabIndex]="-1"
3392
+ (click)="onUploadButtonClick($event)">
3393
+ {{textFor('uploadSelectedFiles')}}
3394
+ </button>
3395
+ `, isInline: true });
3396
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadActionButtonsComponent, decorators: [{
3397
+ type: Component,
3398
+ args: [{
3399
+ selector: 'kendo-upload-action-buttons',
3400
+ template: `
3401
+ <button #clearButton type="button" class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-clear-selected"
3402
+ [attr.tabIndex]="-1"
3403
+ (click)="onClearButtonClick($event)">
3404
+ {{textFor('clearSelectedFiles')}}
3405
+ </button>
3406
+ <button #uploadButton type="button" class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-primary k-upload-selected"
3407
+ [attr.tabIndex]="-1"
3408
+ (click)="onUploadButtonClick($event)">
3409
+ {{textFor('uploadSelectedFiles')}}
3410
+ </button>
3411
+ `
3412
+ }]
3413
+ }], ctorParameters: function () { return [{ type: UploadService }, { type: i1$1.LocalizationService }, { type: NavigationService }]; }, propDecorators: { disabled: [{
3414
+ type: Input
3415
+ }], actionsLayout: [{
3416
+ type: Input
3417
+ }], clearButton: [{
3418
+ type: ViewChild,
3419
+ args: ['clearButton', { static: true }]
3420
+ }], uploadButton: [{
3421
+ type: ViewChild,
3422
+ args: ['uploadButton', { static: true }]
3423
+ }], hostDefaultClass: [{
3424
+ type: HostBinding,
3425
+ args: ['class.k-actions']
3426
+ }], actionButtonsEndClassName: [{
3427
+ type: HostBinding,
3428
+ args: ['class.k-actions-end']
3429
+ }], actionButtonsStretchedClassName: [{
3430
+ type: HostBinding,
3431
+ args: ['class.k-actions-stretched']
3432
+ }], actionButtonsStartClassName: [{
3433
+ type: HostBinding,
3434
+ args: ['class.k-actions-start']
3435
+ }], actionButtonsCenterClassName: [{
3436
+ type: HostBinding,
3437
+ args: ['class.k-actions-center']
3438
+ }] } });
3144
3439
 
3145
- var UploadComponent_1;
3146
- /* tslint:disable: no-use-before-declare */
3147
3440
  /**
3148
3441
  * @hidden
3149
3442
  */
3150
3443
  const UPLOAD_VALUE_ACCESSOR = {
3151
3444
  multi: true,
3152
3445
  provide: NG_VALUE_ACCESSOR,
3153
- useExisting: forwardRef(() => UploadComponent) // tslint:disable-line:no-forward-ref
3446
+ useExisting: forwardRef(() => UploadComponent)
3154
3447
  };
3155
3448
  /**
3156
3449
  * Represents the [Kendo UI Upload component for Angular]({% slug overview_upload %}).
3157
3450
  */
3158
- let UploadComponent = UploadComponent_1 = class UploadComponent {
3451
+ class UploadComponent {
3159
3452
  constructor(uploadService, localization, navigation, dropZoneService, _ngZone, renderer, cdr, wrapper) {
3160
3453
  this.uploadService = uploadService;
3161
3454
  this.localization = localization;
@@ -3764,231 +4057,145 @@ let UploadComponent = UploadComponent_1 = class UploadComponent {
3764
4057
  this.uploadProgress.emit(args);
3765
4058
  }));
3766
4059
  }
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: `
4060
+ }
4061
+ 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 });
4062
+ 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: [
4063
+ LocalizationService,
4064
+ NavigationService,
4065
+ UploadService,
4066
+ DropZoneService,
4067
+ UPLOAD_VALUE_ACCESSOR,
4068
+ {
4069
+ provide: L10N_PREFIX,
4070
+ useValue: 'kendo.upload'
4071
+ },
4072
+ {
4073
+ provide: KendoInput,
4074
+ useExisting: forwardRef(() => UploadComponent)
4075
+ }
4076
+ ], 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: `
4077
+ <ng-container kendoUploadLocalizedMessages
4078
+ i18n-cancel="kendo.upload.cancel|The text for the Cancel button"
4079
+ cancel="Cancel"
4080
+
4081
+ i18n-clearSelectedFiles="kendo.upload.clearSelectedFiles|The text for the Clear button"
4082
+ clearSelectedFiles="Clear"
4083
+
4084
+ i18n-dropFilesHere="kendo.upload.dropFilesHere|The drop zone hint"
4085
+ dropFilesHere="Drop files here to upload"
4086
+
4087
+ i18n-filesBatchStatus="kendo.upload.filesBatchStatus|The status message for a batch of files"
4088
+ filesBatchStatus="files"
4089
+
4090
+ i18n-filesBatchStatusFailed="kendo.upload.filesBatchStatusFailed|The status message for a batch of files after failed upload"
4091
+ filesBatchStatusFailed="files failed to upload."
4092
+
4093
+ i18n-filesBatchStatusUploaded="kendo.upload.filesBatchStatusUploaded|The status message for a batch of files after successful upload"
4094
+ filesBatchStatusUploaded="files successfully uploaded."
4095
+
4096
+ i18n-fileStatusFailed="kendo.upload.fileStatusFailed|The file status message after failed upload"
4097
+ fileStatusFailed="File failed to upload."
4098
+
4099
+ i18n-fileStatusUploaded="kendo.upload.fileStatusUploaded|The file status message after successful upload"
4100
+ fileStatusUploaded="File successfully uploaded."
4101
+
4102
+ i18n-headerStatusPaused="kendo.upload.headerStatusPaused|The header status message when the file upload is paused"
4103
+ headerStatusPaused="Paused"
4104
+
4105
+ i18n-headerStatusUploaded="kendo.upload.headerStatusUploaded|The header status message after file upload completion"
4106
+ headerStatusUploaded="Done"
4107
+
4108
+ i18n-headerStatusUploading="kendo.upload.headerStatusUploading|The header status message during file upload"
4109
+ headerStatusUploading="Uploading..."
4110
+
4111
+ i18n-invalidFileExtension="kendo.upload.invalidFileExtension|The text for the invalid allowed extensions restriction message"
4112
+ invalidFileExtension="File type not allowed."
4113
+
4114
+ i18n-invalidMaxFileSize="kendo.upload.invalidMaxFileSize|The text for the invalid max file size restriction message"
4115
+ invalidMaxFileSize="File size too large."
4116
+
4117
+ i18n-invalidMinFileSize="kendo.upload.invalidMinFileSize|The text for the invalid min file size restriction message"
4118
+ invalidMinFileSize="File size too small."
4119
+
4120
+ i18n-pause="kendo.upload.pause|The text for the Pause button"
4121
+ pause="Pause"
4122
+
4123
+ i18n-remove="kendo.upload.remove|The text for the Remove button"
4124
+ remove="Remove"
4125
+
4126
+ i18n-resume="kendo.upload.resume|The text for the Resume button"
4127
+ resume="Resume"
4128
+
4129
+ i18n-retry="kendo.upload.retry|The text for the Retry button"
4130
+ retry="Retry"
4131
+
4132
+ i18n-select="kendo.upload.select|The text for the Select button"
4133
+ select="Select files..."
4134
+
4135
+ i18n-uploadSelectedFiles="kendo.upload.uploadSelectedFiles|The text for the Upload files button"
4136
+ uploadSelectedFiles="Upload"
4137
+ >
4138
+ </ng-container>
4139
+ <div kendoUploadInternalDropZone
4140
+ [restrictions]="restrictions"
4141
+ [multiple]="multiple"
4142
+ [disabled]="disabled">
4143
+ <div role="button" #fileSelectButton
4144
+ [id]="focusableId"
4145
+ [attr.aria-label]="textFor('select')"
4146
+ [attr.tabindex]="selectButtonTabIndex"
4147
+ (focus)="onFileSelectButtonFocus($event)"
4148
+ (blur)="onFileSelectButtonBlur($event)"
4149
+ class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-upload-button">
4150
+ <input #fileSelect kendoFileSelect
4151
+ [attr.accept]="accept ? accept : null"
4152
+ [attr.aria-hidden]="true"
4153
+ [dir]="direction"
4154
+ [restrictions]="restrictions"
4155
+ [multiple]="multiple"
4156
+ [disabled]="disabled" />
4157
+ <span>{{textFor('select')}}</span>
4158
+ </div>
4159
+ <kendo-upload-status-total *ngIf="showTotalStatus"
4160
+ class="k-upload-status k-upload-status-total"
4161
+ [fileList]="fileList">
4162
+ </kendo-upload-status-total>
4163
+ <div class="k-dropzone-hint">{{textFor('dropFilesHere')}}</div>
4164
+ </div>
4165
+ <ul kendo-upload-file-list *ngIf="showFileList && fileList.count > 0"
4166
+ class="k-upload-files k-reset"
4167
+ [disabled]="disabled"
4168
+ [fileList]="fileList.files"
4169
+ [fileTemplate]="fileTemplate"
4170
+ [fileInfoTemplate]="fileInfoTemplate">
4171
+ </ul>
4172
+ <kendo-upload-action-buttons
4173
+ *ngIf="showActionButtons"
4174
+ [disabled]="disabled"
4175
+ [actionsLayout]="actionsLayout">
4176
+ </kendo-upload-action-buttons>
4177
+ `, 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"] }] });
4178
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadComponent, decorators: [{
4179
+ type: Component,
4180
+ args: [{
4181
+ exportAs: 'kendoUpload',
4182
+ providers: [
4183
+ LocalizationService,
4184
+ NavigationService,
4185
+ UploadService,
4186
+ DropZoneService,
4187
+ UPLOAD_VALUE_ACCESSOR,
4188
+ {
4189
+ provide: L10N_PREFIX,
4190
+ useValue: 'kendo.upload'
4191
+ },
4192
+ {
4193
+ provide: KendoInput,
4194
+ useExisting: forwardRef(() => UploadComponent)
4195
+ }
4196
+ ],
4197
+ selector: 'kendo-upload',
4198
+ template: `
3992
4199
  <ng-container kendoUploadLocalizedMessages
3993
4200
  i18n-cancel="kendo.upload.cancel|The text for the Cancel button"
3994
4201
  cancel="Cancel"
@@ -4090,18 +4297,116 @@ UploadComponent = UploadComponent_1 = __decorate([
4090
4297
  [actionsLayout]="actionsLayout">
4091
4298
  </kendo-upload-action-buttons>
4092
4299
  `
4093
- }),
4094
- __metadata("design:paramtypes", [UploadService,
4095
- LocalizationService,
4096
- NavigationService,
4097
- DropZoneService,
4098
- NgZone,
4099
- Renderer2,
4100
- ChangeDetectorRef,
4101
- ElementRef])
4102
- ], UploadComponent);
4300
+ }]
4301
+ }], 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: [{
4302
+ type: Input
4303
+ }], batch: [{
4304
+ type: Input
4305
+ }], withCredentials: [{
4306
+ type: Input
4307
+ }], saveField: [{
4308
+ type: Input
4309
+ }], saveHeaders: [{
4310
+ type: Input
4311
+ }], saveMethod: [{
4312
+ type: Input
4313
+ }], saveUrl: [{
4314
+ type: Input
4315
+ }], responseType: [{
4316
+ type: Input
4317
+ }], removeField: [{
4318
+ type: Input
4319
+ }], removeHeaders: [{
4320
+ type: Input
4321
+ }], removeMethod: [{
4322
+ type: Input
4323
+ }], removeUrl: [{
4324
+ type: Input
4325
+ }], chunkable: [{
4326
+ type: Input
4327
+ }], concurrent: [{
4328
+ type: Input
4329
+ }], multiple: [{
4330
+ type: Input
4331
+ }], disabled: [{
4332
+ type: Input
4333
+ }], showFileList: [{
4334
+ type: Input
4335
+ }], tabindex: [{
4336
+ type: Input
4337
+ }], zoneId: [{
4338
+ type: Input
4339
+ }], tabIndex: [{
4340
+ type: Input,
4341
+ args: ['tabIndex']
4342
+ }], accept: [{
4343
+ type: Input
4344
+ }], restrictions: [{
4345
+ type: Input
4346
+ }], focusableId: [{
4347
+ type: Input
4348
+ }], actionsLayout: [{
4349
+ type: Input
4350
+ }], fileTemplate: [{
4351
+ type: ContentChild,
4352
+ args: [FileTemplateDirective, { static: false }]
4353
+ }], fileInfoTemplate: [{
4354
+ type: ContentChild,
4355
+ args: [FileInfoTemplateDirective, { static: false }]
4356
+ }], fileSelect: [{
4357
+ type: ViewChild,
4358
+ args: ['fileSelect', { static: true }]
4359
+ }], fileSelectButton: [{
4360
+ type: ViewChild,
4361
+ args: ['fileSelectButton', { static: true }]
4362
+ }], onBlur: [{
4363
+ type: Output,
4364
+ args: ['blur']
4365
+ }], cancel: [{
4366
+ type: Output
4367
+ }], clear: [{
4368
+ type: Output
4369
+ }], complete: [{
4370
+ type: Output
4371
+ }], error: [{
4372
+ type: Output
4373
+ }], onFocus: [{
4374
+ type: Output,
4375
+ args: ['focus']
4376
+ }], pause: [{
4377
+ type: Output
4378
+ }], remove: [{
4379
+ type: Output
4380
+ }], resume: [{
4381
+ type: Output
4382
+ }], select: [{
4383
+ type: Output
4384
+ }], success: [{
4385
+ type: Output
4386
+ }], upload: [{
4387
+ type: Output
4388
+ }], uploadProgress: [{
4389
+ type: Output
4390
+ }], valueChange: [{
4391
+ type: Output
4392
+ }], hostDefaultClasses: [{
4393
+ type: HostBinding,
4394
+ args: ['class.k-widget']
4395
+ }, {
4396
+ type: HostBinding,
4397
+ args: ['class.k-upload']
4398
+ }], hostDisabledClass: [{
4399
+ type: HostBinding,
4400
+ args: ['class.k-disabled']
4401
+ }], dir: [{
4402
+ type: HostBinding,
4403
+ args: ['attr.dir']
4404
+ }], handleKeydown: [{
4405
+ type: HostListener,
4406
+ args: ['keydown', ['$event']]
4407
+ }] } });
4103
4408
 
4104
- let UploadDropZoneDirective = class UploadDropZoneDirective {
4409
+ class UploadDropZoneDirective {
4105
4410
  constructor(dropZoneService) {
4106
4411
  this.dropZoneService = dropZoneService;
4107
4412
  }
@@ -4151,44 +4456,37 @@ let UploadDropZoneDirective = class UploadDropZoneDirective {
4151
4456
  get componentInstance() {
4152
4457
  return this.dropZoneService.getComponents(this.zoneId);
4153
4458
  }
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);
4459
+ }
4460
+ UploadDropZoneDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadDropZoneDirective, deps: [{ token: DropZoneService }], target: i0.ɵɵFactoryTarget.Directive });
4461
+ 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: [
4462
+ DropZoneService
4463
+ ], ngImport: i0 });
4464
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadDropZoneDirective, decorators: [{
4465
+ type: Directive,
4466
+ args: [{
4467
+ providers: [
4468
+ DropZoneService
4469
+ ],
4470
+ selector: '[kendoUploadDropZone], [kendoFileSelectDropZone]'
4471
+ }]
4472
+ }], ctorParameters: function () { return [{ type: DropZoneService }]; }, propDecorators: { zoneId: [{
4473
+ type: Input,
4474
+ args: ['kendoUploadDropZone']
4475
+ }], onElementDragEnter: [{
4476
+ type: HostListener,
4477
+ args: ['dragenter']
4478
+ }], onElementDragOver: [{
4479
+ type: HostListener,
4480
+ args: ['dragover']
4481
+ }], onDropListener: [{
4482
+ type: HostListener,
4483
+ args: ['drop', ['$event']]
4484
+ }] } });
4186
4485
 
4187
- /* tslint:disable: no-use-before-declare */
4188
4486
  /**
4189
4487
  * Represents the [Kendo UI UploadDropZone component for Angular]({% slug overview_upload %}).
4190
4488
  */
4191
- let UploadDropZoneComponent = class UploadDropZoneComponent extends DropZoneBase {
4489
+ class UploadDropZoneComponent extends DropZoneBase {
4192
4490
  constructor(element, renderer, localization) {
4193
4491
  super(element, renderer, 'k-external-dropzone-hover');
4194
4492
  this.localization = localization;
@@ -4223,40 +4521,41 @@ let UploadDropZoneComponent = class UploadDropZoneComponent extends DropZoneBase
4223
4521
  this.localizationChangeSubscription.unsubscribe();
4224
4522
  }
4225
4523
  }
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: `
4524
+ }
4525
+ 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 });
4526
+ 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: [
4527
+ LocalizationService,
4528
+ {
4529
+ provide: L10N_PREFIX,
4530
+ useValue: 'kendo.uploaddropzone'
4531
+ }
4532
+ ], exportAs: ["kendoUploadDropZone"], usesInheritance: true, ngImport: i0, template: `
4533
+ <ng-container kendoUploadDropZoneLocalizedMessages
4534
+ i18n-externalDropFilesHere='kendo.uploaddropzone.externalDropFilesHere|Sets the external drop-zone hint'
4535
+ externalDropFilesHere='Drag and drop files here to upload'
4536
+ >
4537
+ </ng-container>
4538
+ <div class='k-dropzone-inner' [kendoUploadDropZone]="zoneId">
4539
+ <span [ngClass]="iconClasses"></span>
4540
+ <span class="k-dropzone-hint">{{ textFor('externalDropFilesHere') }}</span>
4541
+ <span class="k-dropzone-note">
4542
+ <ng-content></ng-content>
4543
+ </span>
4544
+ </div>
4545
+ `, 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"] }] });
4546
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadDropZoneComponent, decorators: [{
4547
+ type: Component,
4548
+ args: [{
4549
+ exportAs: 'kendoUploadDropZone',
4550
+ providers: [
4551
+ LocalizationService,
4552
+ {
4553
+ provide: L10N_PREFIX,
4554
+ useValue: 'kendo.uploaddropzone'
4555
+ }
4556
+ ],
4557
+ selector: 'kendo-uploaddropzone',
4558
+ template: `
4260
4559
  <ng-container kendoUploadDropZoneLocalizedMessages
4261
4560
  i18n-externalDropFilesHere='kendo.uploaddropzone.externalDropFilesHere|Sets the external drop-zone hint'
4262
4561
  externalDropFilesHere='Drag and drop files here to upload'
@@ -4270,11 +4569,20 @@ UploadDropZoneComponent = __decorate([
4270
4569
  </span>
4271
4570
  </div>
4272
4571
  `
4273
- }),
4274
- __metadata("design:paramtypes", [ElementRef,
4275
- Renderer2,
4276
- LocalizationService])
4277
- ], UploadDropZoneComponent);
4572
+ }]
4573
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1$1.LocalizationService }]; }, propDecorators: { hostClass: [{
4574
+ type: HostBinding,
4575
+ args: ['class.k-external-dropzone']
4576
+ }], dirAttribute: [{
4577
+ type: HostBinding,
4578
+ args: ['attr.dir']
4579
+ }], zoneId: [{
4580
+ type: Input
4581
+ }], icon: [{
4582
+ type: Input
4583
+ }], iconClass: [{
4584
+ type: Input
4585
+ }] } });
4278
4586
 
4279
4587
  /**
4280
4588
  * @hidden
@@ -4303,22 +4611,50 @@ const PUBLIC_DIRECTIVES = [
4303
4611
  /**
4304
4612
  * @hidden
4305
4613
  */
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);
4614
+ class SharedModule {
4615
+ }
4616
+ SharedModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SharedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4617
+ SharedModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SharedModule, declarations: [FileTemplateDirective,
4618
+ FileInfoTemplateDirective,
4619
+ CustomMessagesComponent,
4620
+ UploadDropZoneDirective,
4621
+ UploadDropZoneComponent, DropZoneInternalDirective,
4622
+ FileListComponent,
4623
+ FileListItemDirective,
4624
+ FileListItemActionButtonComponent,
4625
+ FileListMultipleItemsComponent,
4626
+ FileListSingleItemComponent,
4627
+ FileSelectDirective,
4628
+ LocalizedMessagesDirective,
4629
+ TemplateContextDirective], imports: [CommonModule], exports: [FileTemplateDirective,
4630
+ FileInfoTemplateDirective,
4631
+ CustomMessagesComponent,
4632
+ UploadDropZoneDirective,
4633
+ UploadDropZoneComponent, DropZoneInternalDirective,
4634
+ FileListComponent,
4635
+ FileListItemDirective,
4636
+ FileListItemActionButtonComponent,
4637
+ FileListMultipleItemsComponent,
4638
+ FileListSingleItemComponent,
4639
+ FileSelectDirective,
4640
+ LocalizedMessagesDirective,
4641
+ TemplateContextDirective, CommonModule] });
4642
+ SharedModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SharedModule, imports: [[CommonModule], CommonModule] });
4643
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SharedModule, decorators: [{
4644
+ type: NgModule,
4645
+ args: [{
4646
+ declarations: [
4647
+ PUBLIC_DIRECTIVES,
4648
+ SHARED_DECLARATIONS
4649
+ ],
4650
+ exports: [
4651
+ PUBLIC_DIRECTIVES,
4652
+ SHARED_DECLARATIONS,
4653
+ CommonModule
4654
+ ],
4655
+ imports: [CommonModule]
4656
+ }]
4657
+ }] });
4322
4658
 
4323
4659
  const FILESELECT_DECLARATIONS = [
4324
4660
  FileSelectComponent
@@ -4326,192 +4662,22 @@ const FILESELECT_DECLARATIONS = [
4326
4662
  /**
4327
4663
  * Represents the [NgModule](https://angular.io/api/core/NgModule) definition for the FileSelect component.
4328
4664
  */
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);
4665
+ class FileSelectModule {
4666
+ }
4667
+ FileSelectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4668
+ 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] });
4669
+ FileSelectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileSelectModule, imports: [[SharedModule]] });
4670
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileSelectModule, decorators: [{
4671
+ type: NgModule,
4672
+ args: [{
4673
+ declarations: [FILESELECT_DECLARATIONS],
4674
+ exports: [
4675
+ PUBLIC_DIRECTIVES,
4676
+ FILESELECT_DECLARATIONS
4677
+ ],
4678
+ imports: [SharedModule]
4679
+ }]
4680
+ }] });
4515
4681
 
4516
4682
  const UPLOAD_DECLARATIONS = [
4517
4683
  UploadComponent,
@@ -4521,18 +4687,26 @@ const UPLOAD_DECLARATIONS = [
4521
4687
  /**
4522
4688
  * Represents the [NgModule](https://angular.io/api/core/NgModule) definition for the Upload component.
4523
4689
  */
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);
4690
+ class UploadModule {
4691
+ }
4692
+ UploadModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4693
+ UploadModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadModule, declarations: [UploadComponent,
4694
+ UploadActionButtonsComponent,
4695
+ UploadStatusTotalComponent], imports: [SharedModule], exports: [FileTemplateDirective, FileInfoTemplateDirective, CustomMessagesComponent, UploadDropZoneDirective, UploadDropZoneComponent, UploadComponent,
4696
+ UploadActionButtonsComponent,
4697
+ UploadStatusTotalComponent] });
4698
+ UploadModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadModule, imports: [[SharedModule]] });
4699
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadModule, decorators: [{
4700
+ type: NgModule,
4701
+ args: [{
4702
+ declarations: [UPLOAD_DECLARATIONS],
4703
+ exports: [
4704
+ PUBLIC_DIRECTIVES,
4705
+ UPLOAD_DECLARATIONS
4706
+ ],
4707
+ imports: [SharedModule]
4708
+ }]
4709
+ }] });
4536
4710
 
4537
4711
  /**
4538
4712
  * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
@@ -4559,19 +4733,26 @@ UploadModule = __decorate([
4559
4733
  *
4560
4734
  * ```
4561
4735
  */
4562
- let UploadsModule = class UploadsModule {
4563
- };
4564
- UploadsModule = __decorate([
4565
- NgModule({
4566
- exports: [
4567
- FileSelectModule,
4568
- UploadModule
4569
- ]
4570
- })
4571
- ], UploadsModule);
4736
+ class UploadsModule {
4737
+ }
4738
+ UploadsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4739
+ UploadsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadsModule, exports: [FileSelectModule,
4740
+ UploadModule] });
4741
+ UploadsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadsModule, imports: [FileSelectModule,
4742
+ UploadModule] });
4743
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadsModule, decorators: [{
4744
+ type: NgModule,
4745
+ args: [{
4746
+ exports: [
4747
+ FileSelectModule,
4748
+ UploadModule
4749
+ ]
4750
+ }]
4751
+ }] });
4572
4752
 
4573
4753
  /**
4574
4754
  * Generated bundle index. Do not edit.
4575
4755
  */
4576
4756
 
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 };
4757
+ 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 };
4758
+