@progress/kendo-angular-upload 8.0.2 → 9.0.0-next.202203141352

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 +113 -0
  17. package/{dist/es2015 → esm2015}/dropzone.service.js +8 -7
  18. package/{dist/es2015 → esm2015}/events/cancel-event.js +0 -0
  19. package/{dist/es2015 → esm2015}/events/clear-event.js +0 -0
  20. package/{dist/es2015 → esm2015}/events/error-event.js +0 -0
  21. package/{dist/es2015 → esm2015}/events/pause-event.js +0 -0
  22. package/{dist/es2015 → esm2015}/events/preventable-event.js +0 -0
  23. package/{dist/es2015 → esm2015}/events/remove-event.js +0 -0
  24. package/{dist/es2015 → esm2015}/events/resume-event.js +0 -0
  25. package/{dist/es2015 → esm2015}/events/select-event.js +0 -0
  26. package/{dist/es2015 → esm2015}/events/success-event.js +0 -0
  27. package/{dist/es2015 → esm2015}/events/upload-event.js +0 -0
  28. package/{dist/es2015 → esm2015}/events/upload-progress-event.js +0 -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 +263 -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 +0 -0
  70. package/{dist/es2015/events → events}/clear-event.d.ts +0 -0
  71. package/{dist/es2015/events → events}/error-event.d.ts +0 -0
  72. package/{dist/es2015/events → events}/pause-event.d.ts +0 -0
  73. package/{dist/es2015/events → events}/preventable-event.d.ts +0 -0
  74. package/{dist/es2015/events → events}/remove-event.d.ts +0 -0
  75. package/{dist/es2015/events → events}/resume-event.d.ts +0 -0
  76. package/{dist/es2015/events → events}/select-event.d.ts +0 -0
  77. package/{dist/es2015/events → events}/success-event.d.ts +0 -0
  78. package/{dist/es2015/events → events}/upload-event.d.ts +0 -0
  79. package/{dist/es2015/events → events}/upload-progress-event.d.ts +0 -0
  80. package/{dist/es2015/events.d.ts → events.d.ts} +0 -0
  81. package/{dist/fesm2015/index.js → fesm2015/kendo-angular-upload.js} +2184 -2011
  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: 1646671545,
27
+ publishDate: 1647265856,
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;
@@ -592,9 +595,6 @@ class UploadProgressEvent {
592
595
  }
593
596
  }
594
597
 
595
- const ɵ0 = [
596
- ".xlr", ".xls", ".xlsx"
597
- ];
598
598
  /**
599
599
  * @hidden
600
600
  */
@@ -614,7 +614,9 @@ const fileGroupMap = {
614
614
  presentation: [
615
615
  ".key", ".odp", ".pps", ".ppt", ".pptx"
616
616
  ],
617
- data: ɵ0,
617
+ data: [
618
+ ".xlr", ".xls", ".xlsx"
619
+ ],
618
620
  programming: [
619
621
  ".tmp", ".bak", ".msi", ".cab", ".cpl", ".cur", ".dll", ".dmp", ".drv", ".icns", ".ico", ".link", ".sys", ".cfg",
620
622
  ".ini", ".asp", ".aspx", ".cer", ".csr", ".css", ".dcr", ".htm", ".html", ".js", ".php", ".rss", ".xhtml"
@@ -633,7 +635,7 @@ const fileGroupMap = {
633
635
  ]
634
636
  };
635
637
 
636
- /* tslint:disable: no-bitwise */
638
+ /* eslint-disable no-bitwise */
637
639
  /**
638
640
  * @hidden
639
641
  */
@@ -784,6 +786,18 @@ const assignGuidToFiles = (files, isUnique) => {
784
786
  return file;
785
787
  });
786
788
  };
789
+ /**
790
+ * @hidden
791
+ */
792
+ const supportsFormData = () => {
793
+ return typeof (FormData) !== "undefined";
794
+ };
795
+ /**
796
+ * @hidden
797
+ */
798
+ const userAgent = () => {
799
+ return navigator.userAgent;
800
+ };
787
801
  const focusableRegex = /^(?:a|input|select|textarea|button|object)$/i;
788
802
  /**
789
803
  * @hidden
@@ -875,7 +889,7 @@ class ChunkMap {
875
889
  /**
876
890
  * @hidden
877
891
  */
878
- let UploadService = class UploadService {
892
+ class UploadService {
879
893
  constructor(http) {
880
894
  this.http = http;
881
895
  this.cancelEvent = new EventEmitter();
@@ -1281,16 +1295,17 @@ let UploadService = class UploadService {
1281
1295
  }
1282
1296
  return false;
1283
1297
  }
1284
- };
1285
- UploadService = __decorate([
1286
- Injectable(),
1287
- __metadata("design:paramtypes", [HttpClient])
1288
- ], UploadService);
1298
+ }
1299
+ UploadService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
1300
+ UploadService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadService });
1301
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadService, decorators: [{
1302
+ type: Injectable
1303
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }]; } });
1289
1304
 
1290
1305
  /**
1291
1306
  * @hidden
1292
1307
  */
1293
- let NavigationService = class NavigationService {
1308
+ class NavigationService {
1294
1309
  constructor(uploadService) {
1295
1310
  this.uploadService = uploadService;
1296
1311
  this.onActionButtonAction = new EventEmitter();
@@ -1424,32 +1439,35 @@ let NavigationService = class NavigationService {
1424
1439
  const fileCount = this.uploadService.files.count;
1425
1440
  return this.actionButtonsVisible ? fileCount + 1 : fileCount - 1;
1426
1441
  }
1427
- };
1428
- NavigationService = __decorate([
1429
- Injectable(),
1430
- __metadata("design:paramtypes", [UploadService])
1431
- ], NavigationService);
1442
+ }
1443
+ NavigationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: NavigationService, deps: [{ token: UploadService }], target: i0.ɵɵFactoryTarget.Injectable });
1444
+ NavigationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: NavigationService });
1445
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: NavigationService, decorators: [{
1446
+ type: Injectable
1447
+ }], ctorParameters: function () { return [{ type: UploadService }]; } });
1432
1448
 
1433
1449
  /**
1434
1450
  * Used to customize the rendering of the files in the list ([see example]({% slug templates_upload %}#toc-file-template)).
1435
1451
  */
1436
- let FileTemplateDirective = class FileTemplateDirective {
1452
+ class FileTemplateDirective {
1437
1453
  constructor(templateRef) {
1438
1454
  this.templateRef = templateRef;
1439
1455
  }
1440
- };
1441
- FileTemplateDirective = __decorate([
1442
- Directive({
1443
- selector: '[kendoUploadFileTemplate], [kendoFileSelectFileTemplate]' // tslint:disable-line:directive-selector-prefix
1444
- }),
1445
- __metadata("design:paramtypes", [TemplateRef])
1446
- ], FileTemplateDirective);
1456
+ }
1457
+ FileTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
1458
+ FileTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FileTemplateDirective, selector: "[kendoUploadFileTemplate], [kendoFileSelectFileTemplate]", ngImport: i0 });
1459
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileTemplateDirective, decorators: [{
1460
+ type: Directive,
1461
+ args: [{
1462
+ selector: '[kendoUploadFileTemplate], [kendoFileSelectFileTemplate]' // eslint-disable-line directive-selector-prefix
1463
+ }]
1464
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
1447
1465
 
1448
1466
  let components = {};
1449
1467
  /**
1450
1468
  * @hidden
1451
1469
  */
1452
- let DropZoneService = class DropZoneService {
1470
+ class DropZoneService {
1453
1471
  addComponent(component, zoneId) {
1454
1472
  if (this.has(zoneId)) {
1455
1473
  components[zoneId].push(component);
@@ -1464,982 +1482,716 @@ let DropZoneService = class DropZoneService {
1464
1482
  has(id) {
1465
1483
  return id in components;
1466
1484
  }
1467
- };
1468
- DropZoneService = __decorate([
1469
- Injectable()
1470
- ], DropZoneService);
1485
+ }
1486
+ DropZoneService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropZoneService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1487
+ DropZoneService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropZoneService });
1488
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropZoneService, decorators: [{
1489
+ type: Injectable
1490
+ }] });
1471
1491
 
1472
1492
  /**
1473
1493
  * 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
1494
  */
1475
- let FileInfoTemplateDirective = class FileInfoTemplateDirective {
1495
+ class FileInfoTemplateDirective {
1476
1496
  constructor(templateRef) {
1477
1497
  this.templateRef = templateRef;
1478
1498
  }
1479
- };
1480
- FileInfoTemplateDirective = __decorate([
1481
- Directive({
1482
- selector: '[kendoUploadFileInfoTemplate], [kendoFileSelectFileInfoTemplate]'
1483
- }),
1484
- __metadata("design:paramtypes", [TemplateRef])
1485
- ], FileInfoTemplateDirective);
1499
+ }
1500
+ FileInfoTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileInfoTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
1501
+ FileInfoTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FileInfoTemplateDirective, selector: "[kendoUploadFileInfoTemplate], [kendoFileSelectFileInfoTemplate]", ngImport: i0 });
1502
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileInfoTemplateDirective, decorators: [{
1503
+ type: Directive,
1504
+ args: [{
1505
+ selector: '[kendoUploadFileInfoTemplate], [kendoFileSelectFileInfoTemplate]'
1506
+ }]
1507
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
1486
1508
 
1487
- var FileSelectComponent_1;
1488
1509
  /**
1489
1510
  * @hidden
1490
1511
  */
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) {
1512
+ class FileListItemDirective {
1513
+ constructor(el, navigationService, uploadService) {
1514
+ this.navigationService = navigationService;
1498
1515
  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();
1516
+ this.fileClass = true;
1517
+ this.focused = false;
1518
+ this.element = el;
1572
1519
  }
1573
- /**
1574
- * Sets the `name` attribute of the `input` element of the FileSelect.
1575
- */
1576
- set name(name) {
1577
- this.uploadService.async.saveField = name;
1520
+ focus() {
1521
+ this.element.nativeElement.focus();
1578
1522
  }
1579
- get name() {
1580
- return this.uploadService.async.saveField;
1523
+ get uidAttribute() {
1524
+ return this.files[0].uid;
1581
1525
  }
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;
1526
+ get tabIndex() {
1527
+ return "-1";
1588
1528
  }
1589
- get restrictions() {
1590
- return this._restrictions;
1529
+ get kFileError() {
1530
+ return this.files[0].state === FileState.Failed;
1591
1531
  }
1592
- get hostDisabledClass() {
1593
- return this.disabled;
1532
+ get kFileInvalid() {
1533
+ return filesHaveValidationErrors(this.files);
1594
1534
  }
1595
- get dir() {
1596
- return this.direction;
1535
+ get kFileProgress() {
1536
+ return this.files[0].state === FileState.Uploading ||
1537
+ this.files[0].state === FileState.Paused;
1597
1538
  }
1598
- ngOnInit() {
1599
- this.renderer.removeAttribute(this.wrapper, "tabindex");
1600
- if (this.zoneId) {
1601
- this.dropZoneService.addComponent(this, this.zoneId);
1539
+ get kFileSuccess() {
1540
+ if (this.uploadService.component === 'Upload') {
1541
+ return this.files[0].state === FileState.Uploaded ||
1542
+ this.files[0].state === FileState.Initial;
1602
1543
  }
1544
+ return false;
1545
+ }
1546
+ get kStateFocused() {
1547
+ return this.focused;
1548
+ }
1549
+ onFocus() {
1550
+ this.focused = true;
1551
+ }
1552
+ onBlur() {
1553
+ this.focused = false;
1554
+ }
1555
+ onClick(event) {
1556
+ if (!isFocusable(event.target) && !hasClasses(event.target, IGNORE_TARGET_CLASSES)) {
1557
+ this.navigationService.focusedIndex = this.index;
1558
+ }
1559
+ }
1560
+ }
1561
+ 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 });
1562
+ 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 });
1563
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListItemDirective, decorators: [{
1564
+ type: Directive,
1565
+ args: [{
1566
+ selector: '[kendoUploadFileListItem]'
1567
+ }]
1568
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: NavigationService }, { type: UploadService }]; }, propDecorators: { files: [{
1569
+ type: Input
1570
+ }], index: [{
1571
+ type: Input
1572
+ }], fileClass: [{
1573
+ type: HostBinding,
1574
+ args: ['class.k-file']
1575
+ }], uidAttribute: [{
1576
+ type: HostBinding,
1577
+ args: ['attr.data-uid']
1578
+ }], tabIndex: [{
1579
+ type: HostBinding,
1580
+ args: ['attr.tabIndex']
1581
+ }], kFileError: [{
1582
+ type: HostBinding,
1583
+ args: ['class.k-file-error']
1584
+ }], kFileInvalid: [{
1585
+ type: HostBinding,
1586
+ args: ['class.k-file-invalid']
1587
+ }], kFileProgress: [{
1588
+ type: HostBinding,
1589
+ args: ['class.k-file-progress']
1590
+ }], kFileSuccess: [{
1591
+ type: HostBinding,
1592
+ args: ['class.k-file-success']
1593
+ }], kStateFocused: [{
1594
+ type: HostBinding,
1595
+ args: ['class.k-state-focused']
1596
+ }], onFocus: [{
1597
+ type: HostListener,
1598
+ args: ["focus"]
1599
+ }], onBlur: [{
1600
+ type: HostListener,
1601
+ args: ["blur"]
1602
+ }], onClick: [{
1603
+ type: HostListener,
1604
+ args: ['click', ['$event']]
1605
+ }] } });
1606
+
1607
+ /**
1608
+ * @hidden
1609
+ */
1610
+ class FileListItemBase {
1611
+ constructor(uploadService) {
1612
+ this.uploadService = uploadService;
1613
+ this.progressComplete = 0;
1614
+ }
1615
+ subscribeUploadProgress(uploadProgressHandler) {
1616
+ this.uploadProgressSubscription = this.uploadService.uploadProgressEvent.subscribe(uploadProgressHandler);
1617
+ }
1618
+ fileHasValidationErrors(file) {
1619
+ return fileHasValidationErrors(file);
1620
+ }
1621
+ filesHaveValidationErrors(files) {
1622
+ return filesHaveValidationErrors(files);
1623
+ }
1624
+ ngOnDestroy() {
1625
+ this.uploadProgressSubscription.unsubscribe();
1626
+ }
1627
+ getFileValidationMessage(file) {
1628
+ let validationMessage;
1629
+ if (file.validationErrors && file.validationErrors.length > 0) {
1630
+ validationMessage = this.localization.get(file.validationErrors[0]);
1631
+ }
1632
+ return validationMessage;
1633
+ }
1634
+ getTotalFilesSizeMessage(files) {
1635
+ return getTotalFilesSizeMessage(files);
1603
1636
  }
1604
- /**
1605
- * @hidden
1606
- */
1607
1637
  textFor(key) {
1608
1638
  return this.localization.get(key);
1609
1639
  }
1610
- /**
1611
- * Focuses the underlying input element.
1612
- */
1613
- focus() {
1614
- setTimeout(() => {
1615
- this.fileSelectButton.nativeElement.focus();
1616
- });
1640
+ }
1641
+ FileListItemBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListItemBase, deps: [{ token: UploadService }], target: i0.ɵɵFactoryTarget.Component });
1642
+ FileListItemBase.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FileListItemBase, selector: "ng-component", ngImport: i0, template: '', isInline: true });
1643
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListItemBase, decorators: [{
1644
+ type: Component,
1645
+ args: [{ template: '' }]
1646
+ }], ctorParameters: function () { return [{ type: UploadService }]; } });
1647
+
1648
+ /**
1649
+ * @hidden
1650
+ */
1651
+ class FileListItemActionButtonComponent {
1652
+ constructor(uploadService, localization, navigation) {
1653
+ this.uploadService = uploadService;
1654
+ this.localization = localization;
1655
+ this.navigation = navigation;
1656
+ this.actionFocused = false;
1657
+ this.retryFocused = false;
1658
+ this.pauseResumeFocused = false;
1617
1659
  }
1618
- ngOnDestroy() {
1619
- this.fileList.clear();
1620
- if (this.blurSubscription) {
1621
- this.blurSubscription.unsubscribe();
1660
+ onFocus(type) {
1661
+ if (type === 'action') {
1662
+ this.actionFocused = true;
1622
1663
  }
1623
- if (this.wrapperFocusSubscription) {
1624
- this.wrapperFocusSubscription.unsubscribe();
1664
+ if (type === 'retry') {
1665
+ this.retryFocused = true;
1625
1666
  }
1626
- if (this.selectButtonFocusSubscription) {
1627
- this.selectButtonFocusSubscription.unsubscribe();
1667
+ if (type === 'pauseResume') {
1668
+ this.pauseResumeFocused = true;
1628
1669
  }
1629
- if (this.localizationChangeSubscription) {
1630
- this.localizationChangeSubscription.unsubscribe();
1670
+ }
1671
+ onBlur(type) {
1672
+ if (type === 'retry') {
1673
+ this.retryFocused = false;
1631
1674
  }
1632
- if (this.subs) {
1633
- this.subs.unsubscribe();
1675
+ if (type === 'action') {
1676
+ this.actionFocused = false;
1677
+ }
1678
+ if (type === 'pauseResume') {
1679
+ this.pauseResumeFocused = false;
1634
1680
  }
1635
1681
  }
1636
- /**
1637
- * @hidden
1638
- */
1639
- handleKeydown(event) {
1682
+ onRetryClick() {
1640
1683
  if (this.disabled) {
1641
1684
  return;
1642
1685
  }
1643
- if ((event.keyCode === Keys.Enter || event.keyCode === Keys.Space) &&
1644
- event.target === this.fileSelectButton.nativeElement) {
1645
- event.preventDefault();
1646
- this.fileSelect.nativeElement.click();
1686
+ this.uploadService.retryFiles(this.file.uid);
1687
+ }
1688
+ onRemoveCancelClick(event) {
1689
+ if (this.disabled) {
1647
1690
  return;
1648
1691
  }
1649
- if (hasClasses(event.target, UPLOAD_CLASSES) ||
1650
- (!isFocusable(event.target) && !hasClasses(event.target, IGNORE_TARGET_CLASSES))) {
1651
- this.navigation.process(event);
1692
+ event.stopImmediatePropagation();
1693
+ const uid = this.file.uid;
1694
+ if (this.file.state === FileState.Uploading) {
1695
+ this.uploadService.cancelFiles(uid);
1696
+ }
1697
+ else {
1698
+ this.uploadService.removeFiles(uid);
1652
1699
  }
1700
+ this.navigation.focusSelectButton();
1653
1701
  }
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
- }
1702
+ onPauseResumeClick() {
1703
+ if (this.disabled) {
1704
+ return;
1668
1705
  }
1669
- if (newValue === null) {
1670
- this.fileList.clear();
1706
+ const uid = this.file.uid;
1707
+ if (this.file.state === FileState.Paused) {
1708
+ this.uploadService.resumeFile(uid);
1709
+ }
1710
+ else {
1711
+ this.uploadService.pauseFile(uid);
1671
1712
  }
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
1713
  }
1711
- /**
1712
- * @hidden
1713
- * Used by the external dropzone to add files to the FileSelect
1714
- */
1715
- addFiles(files) {
1716
- this.uploadService.addFiles(files);
1714
+ get actionButtonTitle() {
1715
+ if (this.file.state === FileState.Uploading) {
1716
+ return this.localization.get('cancel');
1717
+ }
1718
+ return this.localization.get('remove');
1717
1719
  }
1718
- /**
1719
- * @hidden
1720
- */
1721
- get selectButtonTabIndex() {
1722
- return this.disabled ? undefined : this.tabindex;
1720
+ get retryButtonTitle() {
1721
+ return this.localization.get('retry');
1723
1722
  }
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;
1723
+ get pauseResumeButtonTitle() {
1724
+ if (this.file.state === FileState.Uploading) {
1725
+ return this.localization.get('pause');
1731
1726
  }
1727
+ return this.localization.get('resume');
1732
1728
  }
1733
- /**
1734
- * @hidden
1735
- */
1736
- onFileSelectButtonBlur(_event) {
1737
- this.renderer.removeClass(this.fileSelectButton.nativeElement, 'k-focus');
1729
+ get isUploading() {
1730
+ return this.file.state === FileState.Uploading;
1738
1731
  }
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
- });
1732
+ get isFailed() {
1733
+ return this.file.state === FileState.Failed;
1757
1734
  }
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
- });
1735
+ get isPaused() {
1736
+ return this.file.state === FileState.Paused;
1765
1737
  }
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
- }));
1738
+ get isResumable() {
1739
+ const service = this.uploadService;
1740
+ const isResumable = service.async.chunk && service.chunk.resumable;
1741
+ const isUploading = (this.file.state === FileState.Paused) || (this.file.state === FileState.Uploading);
1742
+ return isResumable && isUploading;
1791
1743
  }
1792
- setDefaultSettings() {
1793
- this.uploadService.async.autoUpload = false;
1794
- this.uploadService.component = 'FileSelect';
1744
+ get isActionButtonVisible() {
1745
+ if ((this.file.state === FileState.Uploaded || this.file.state === FileState.Initial) &&
1746
+ !this.uploadService.async.removeUrl && this.uploadService.component === 'Upload') {
1747
+ return false;
1748
+ }
1749
+ return true;
1795
1750
  }
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"
1751
+ }
1752
+ 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 });
1753
+ 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: `
1754
+ <strong class="k-upload-status">
1755
+ <span class="k-upload-pct" *ngIf="isUploading || isPaused">{{progress}}%</span>
1915
1756
 
1916
- i18n-invalidFileExtension="kendo.fileselect.invalidFileExtension|The text for the invalid allowed extensions restriction message"
1917
- invalidFileExtension="File type not allowed."
1757
+ <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"
1758
+ [ngClass]="{ 'k-focus': this.retryFocused }"
1759
+ [attr.tabIndex]="-1"
1760
+ (focus)="onFocus('retry')"
1761
+ (blur)="onBlur('retry')"
1762
+ (click)="onRetryClick()">
1763
+ <span class="k-icon k-button-icon k-retry k-i-refresh-sm"
1764
+ [attr.aria-label]="retryButtonTitle"
1765
+ [attr.title]="retryButtonTitle">
1766
+ </span>
1767
+ </button>
1918
1768
 
1919
- i18n-invalidMaxFileSize="kendo.fileselect.invalidMaxFileSize|The text for the invalid max file size restriction message"
1920
- invalidMaxFileSize="File size too large."
1769
+ <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"
1770
+ [ngClass]="{ 'k-focus': this.pauseResumeFocused }"
1771
+ [attr.tabIndex]="-1"
1772
+ (focus)="onFocus('pauseResume')"
1773
+ (blur)="onBlur('pauseResume')"
1774
+ (click)="onPauseResumeClick()">
1775
+ <span class="k-icon k-button-icon"
1776
+ [ngClass]="{
1777
+ 'k-i-play-sm': isPaused,
1778
+ 'k-i-pause-sm': !isPaused
1779
+ }"
1780
+ [attr.aria-label]='pauseResumeButtonTitle'
1781
+ [attr.title]='pauseResumeButtonTitle'>
1782
+ </span>
1783
+ </button>
1921
1784
 
1922
- i18n-invalidMinFileSize="kendo.fileselect.invalidMinFileSize|The text for the invalid min file size restriction message"
1923
- invalidMinFileSize="File size too small."
1785
+ <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"
1786
+ [ngClass]="{ 'k-focus': this.actionFocused }"
1787
+ [attr.tabIndex]="-1"
1788
+ (focus)="onFocus('action')"
1789
+ (blur)="onBlur('action')"
1790
+ (click)="onRemoveCancelClick($event)">
1791
+ <span class="k-icon k-button-icon"
1792
+ [ngClass]="{
1793
+ 'k-i-cancel': isUploading,
1794
+ 'k-delete k-i-x': !isUploading
1795
+ }"
1796
+ [attr.aria-label]='actionButtonTitle'
1797
+ [attr.title]='actionButtonTitle'>
1798
+ </span>
1799
+ </button>
1800
+ </strong>
1801
+ `, isInline: true, directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
1802
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListItemActionButtonComponent, decorators: [{
1803
+ type: Component,
1804
+ args: [{
1805
+ selector: 'kendo-upload-file-list-item-action-button',
1806
+ template: `
1807
+ <strong class="k-upload-status">
1808
+ <span class="k-upload-pct" *ngIf="isUploading || isPaused">{{progress}}%</span>
1924
1809
 
1925
- i18n-remove="kendo.fileselect.remove|The text for the Remove button"
1926
- remove="Remove"
1810
+ <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"
1811
+ [ngClass]="{ 'k-focus': this.retryFocused }"
1812
+ [attr.tabIndex]="-1"
1813
+ (focus)="onFocus('retry')"
1814
+ (blur)="onBlur('retry')"
1815
+ (click)="onRetryClick()">
1816
+ <span class="k-icon k-button-icon k-retry k-i-refresh-sm"
1817
+ [attr.aria-label]="retryButtonTitle"
1818
+ [attr.title]="retryButtonTitle">
1819
+ </span>
1820
+ </button>
1927
1821
 
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>
1822
+ <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"
1823
+ [ngClass]="{ 'k-focus': this.pauseResumeFocused }"
1824
+ [attr.tabIndex]="-1"
1825
+ (focus)="onFocus('pauseResume')"
1826
+ (blur)="onBlur('pauseResume')"
1827
+ (click)="onPauseResumeClick()">
1828
+ <span class="k-icon k-button-icon"
1829
+ [ngClass]="{
1830
+ 'k-i-play-sm': isPaused,
1831
+ 'k-i-pause-sm': !isPaused
1832
+ }"
1833
+ [attr.aria-label]='pauseResumeButtonTitle'
1834
+ [attr.title]='pauseResumeButtonTitle'>
1835
+ </span>
1836
+ </button>
1837
+
1838
+ <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"
1839
+ [ngClass]="{ 'k-focus': this.actionFocused }"
1840
+ [attr.tabIndex]="-1"
1841
+ (focus)="onFocus('action')"
1842
+ (blur)="onBlur('action')"
1843
+ (click)="onRemoveCancelClick($event)">
1844
+ <span class="k-icon k-button-icon"
1845
+ [ngClass]="{
1846
+ 'k-i-cancel': isUploading,
1847
+ 'k-delete k-i-x': !isUploading
1848
+ }"
1849
+ [attr.aria-label]='actionButtonTitle'
1850
+ [attr.title]='actionButtonTitle'>
1851
+ </span>
1852
+ </button>
1853
+ </strong>
1961
1854
  `
1962
- }),
1963
- __metadata("design:paramtypes", [UploadService,
1964
- LocalizationService,
1965
- NavigationService,
1966
- DropZoneService,
1967
- NgZone,
1968
- Renderer2,
1969
- ChangeDetectorRef,
1970
- ElementRef])
1971
- ], FileSelectComponent);
1855
+ }]
1856
+ }], ctorParameters: function () { return [{ type: UploadService }, { type: i1$1.LocalizationService }, { type: NavigationService }]; }, propDecorators: { file: [{
1857
+ type: Input
1858
+ }], disabled: [{
1859
+ type: Input
1860
+ }], progress: [{
1861
+ type: Input
1862
+ }] } });
1972
1863
 
1973
1864
  /**
1974
1865
  * @hidden
1975
1866
  */
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);
2062
-
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;
1867
+ class TemplateContextDirective {
1868
+ constructor(viewContainerRef) {
1869
+ this.viewContainerRef = viewContainerRef;
2081
1870
  }
2082
- get override() {
2083
- return true;
1871
+ set templateContext(context) {
1872
+ if (this.insertedViewRef) {
1873
+ this.viewContainerRef.remove(this.viewContainerRef.indexOf(this.insertedViewRef));
1874
+ this.insertedViewRef = undefined;
1875
+ }
1876
+ if (context.templateRef) {
1877
+ this.insertedViewRef = this.viewContainerRef.createEmbeddedView(context.templateRef, context);
1878
+ }
2084
1879
  }
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);
1880
+ }
1881
+ TemplateContextDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TemplateContextDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
1882
+ TemplateContextDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: TemplateContextDirective, selector: "[templateContext]", inputs: { templateContext: "templateContext" }, ngImport: i0 });
1883
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TemplateContextDirective, decorators: [{
1884
+ type: Directive,
1885
+ args: [{
1886
+ selector: '[templateContext]' // eslint-disable-line directive-selector
1887
+ }]
1888
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; }, propDecorators: { templateContext: [{
1889
+ type: Input
1890
+ }] } });
2099
1891
 
2100
1892
  /**
2101
1893
  * @hidden
2102
1894
  */
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);
1895
+ class FileListSingleItemComponent extends FileListItemBase {
1896
+ constructor(localization, uploadService) {
1897
+ super(uploadService);
1898
+ this.localization = localization;
1899
+ this.subscribeUploadProgress((args) => {
1900
+ if (args.files[0].uid === this.file.uid) {
1901
+ this.progressComplete = args.percentComplete;
2118
1902
  }
2119
- }
1903
+ });
2120
1904
  }
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);
1905
+ get fileStatusText() {
1906
+ const errors = this.file.validationErrors;
1907
+ if (this.file.state === FileState.Uploaded) {
1908
+ return `${this.textFor('fileStatusUploaded')}`;
2127
1909
  }
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);
1910
+ if (this.file.state === FileState.Failed) {
1911
+ return `${this.textFor('fileStatusFailed')}`;
2133
1912
  }
2134
- }
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
- };
2156
-
2157
- /**
2158
- * @hidden
2159
- */
2160
- class DropZoneBase {
2161
- constructor(element, renderer, hoverClass) {
2162
- this.element = element;
2163
- this.renderer = renderer;
2164
- this.hideIntervalElement = null;
2165
- this.hoverClass = hoverClass;
2166
- }
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);
1913
+ if (!isPresent(errors)) {
1914
+ return this.getTotalFilesSizeMessage([this.file]);
2182
1915
  }
2183
- return false;
2184
- }
2185
- /**
2186
- * @hidden
2187
- */
2188
- onElementDragOverListener() {
2189
- this.lastDragElement = new Date();
2190
- return false;
2191
- }
2192
- calculateTimeDiff(prevEvent) {
2193
- return new Date().getTime() - prevEvent.getTime();
2194
- }
2195
- addClass(className) {
2196
- this.renderer.addClass(this.element.nativeElement, className);
1916
+ return this.getFileValidationMessage(this.file);
2197
1917
  }
2198
- removeClass(className) {
2199
- this.renderer.removeClass(this.element.nativeElement, className);
1918
+ get showProgress() {
1919
+ const showProgress = this.file.state === FileState.Uploading || this.file.state === FileState.Paused;
1920
+ return showProgress ? 'active' : 'inactive';
2200
1921
  }
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
- });
1922
+ get fileGroupClass() {
1923
+ return getFileGroupCssClass(this.file.extension ? this.file.extension : '');
2230
1924
  }
2231
- ngOnDestroy() {
2232
- this.ngZone.runOutsideAngular(() => {
2233
- if (this.unsubscribeDocumentDragEnter) {
2234
- this.unsubscribeDocumentDragEnter();
2235
- }
2236
- if (this.unsubscribeDocumentDragOver) {
2237
- this.unsubscribeDocumentDragOver();
2238
- }
2239
- });
1925
+ get isUploadSuccessful() {
1926
+ return this.file.state === FileState.Uploaded;
2240
1927
  }
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;
1928
+ get isUploadFailed() {
1929
+ return this.file.state === FileState.Failed;
2255
1930
  }
2256
- /**
2257
- * @hidden
2258
- */
2259
- onDocumentDragOver() {
2260
- this.lastDragDocument = new Date();
2261
- return false;
1931
+ get isNotYetUploaded() {
1932
+ return !this.isUploadFailed && !this.isUploadSuccessful;
2262
1933
  }
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]
1934
+ }
1935
+ 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 });
1936
+ 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: `
1937
+ <div class="k-progressbar" [@progressState]="showProgress">
1938
+ <span class="k-progress" [style.width]="progressComplete + '%'"></span>
1939
+ </div>
1940
+ <span class="k-file-group-wrapper">
1941
+ <span class="k-file-group k-icon" [ngClass]="fileGroupClass"></span>
1942
+ </span>
1943
+ <span class="k-file-name-size-wrapper">
1944
+ <ng-container *ngIf="!fileInfoTemplate">
1945
+ <span class="k-file-name" [title]="file.name">{{ file.name }}</span>
1946
+ <span [ngClass]="{
1947
+ 'k-file-validation-message': file.validationErrors,
1948
+ 'k-file-size': !file.validationErrors && isNotYetUploaded,
1949
+ 'k-text-success': isUploadSuccessful,
1950
+ 'k-text-error': file.validationErrors || isUploadFailed,
1951
+ 'k-file-information': isUploadSuccessful || isUploadFailed
1952
+ }"
1953
+ >{{fileStatusText}}</span>
1954
+ </ng-container>
1955
+ <ng-template *ngIf="fileInfoTemplate"
1956
+ [templateContext]="{
1957
+ templateRef: fileInfoTemplate.templateRef,
1958
+ state: file.state,
1959
+ $implicit: [file]
1960
+ }">
1961
+ </ng-template>
1962
+ </span>
1963
+ <kendo-upload-file-list-item-action-button
1964
+ [file]='file'
1965
+ [disabled]='disabled'
1966
+ [progress]='progressComplete'>
1967
+ </kendo-upload-file-list-item-action-button>
1968
+ `, 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: [
1969
+ trigger('progressState', [
1970
+ state('active', style({ opacity: 1 })),
1971
+ state('inactive', style({ opacity: 0 })),
1972
+ transition('void => active', style({ opacity: 0 })),
1973
+ transition('inactive => active', style({ opacity: 1 })),
1974
+ transition('active => inactive', animate('1s 2s ease-out'))
1975
+ ])
1976
+ ] });
1977
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListSingleItemComponent, decorators: [{
1978
+ type: Component,
1979
+ args: [{
1980
+ animations: [
1981
+ trigger('progressState', [
1982
+ state('active', style({ opacity: 1 })),
1983
+ state('inactive', style({ opacity: 0 })),
1984
+ transition('void => active', style({ opacity: 0 })),
1985
+ transition('inactive => active', style({ opacity: 1 })),
1986
+ transition('active => inactive', animate('1s 2s ease-out'))
1987
+ ])
1988
+ ],
1989
+ selector: 'kendo-upload-file-list-single-item',
1990
+ template: `
1991
+ <div class="k-progressbar" [@progressState]="showProgress">
1992
+ <span class="k-progress" [style.width]="progressComplete + '%'"></span>
1993
+ </div>
1994
+ <span class="k-file-group-wrapper">
1995
+ <span class="k-file-group k-icon" [ngClass]="fileGroupClass"></span>
1996
+ </span>
1997
+ <span class="k-file-name-size-wrapper">
1998
+ <ng-container *ngIf="!fileInfoTemplate">
1999
+ <span class="k-file-name" [title]="file.name">{{ file.name }}</span>
2000
+ <span [ngClass]="{
2001
+ 'k-file-validation-message': file.validationErrors,
2002
+ 'k-file-size': !file.validationErrors && isNotYetUploaded,
2003
+ 'k-text-success': isUploadSuccessful,
2004
+ 'k-text-error': file.validationErrors || isUploadFailed,
2005
+ 'k-file-information': isUploadSuccessful || isUploadFailed
2006
+ }"
2007
+ >{{fileStatusText}}</span>
2008
+ </ng-container>
2009
+ <ng-template *ngIf="fileInfoTemplate"
2010
+ [templateContext]="{
2011
+ templateRef: fileInfoTemplate.templateRef,
2012
+ state: file.state,
2013
+ $implicit: [file]
2014
+ }">
2015
+ </ng-template>
2016
+ </span>
2017
+ <kendo-upload-file-list-item-action-button
2018
+ [file]='file'
2019
+ [disabled]='disabled'
2020
+ [progress]='progressComplete'>
2021
+ </kendo-upload-file-list-item-action-button>
2305
2022
  `
2306
- }),
2307
- __metadata("design:paramtypes", [ElementRef,
2308
- Renderer2,
2309
- NgZone,
2310
- UploadService])
2311
- ], DropZoneInternalDirective);
2023
+ }]
2024
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: UploadService }]; }, propDecorators: { disabled: [{
2025
+ type: Input
2026
+ }], file: [{
2027
+ type: Input
2028
+ }], fileInfoTemplate: [{
2029
+ type: Input
2030
+ }] } });
2312
2031
 
2313
2032
  /**
2314
2033
  * @hidden
2315
2034
  */
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;
2035
+ class FileListMultipleItemsComponent extends FileListItemBase {
2036
+ constructor(localization, uploadService) {
2037
+ super(uploadService);
2038
+ this.localization = localization;
2039
+ this.subscribeUploadProgress((args) => {
2040
+ if (args.files[0].uid === this.files[0].uid) {
2041
+ this.progressComplete = args.percentComplete;
2042
+ }
2043
+ });
2335
2044
  }
2336
- get kFileInvalid() {
2337
- return filesHaveValidationErrors(this.files);
2045
+ get showProgress() {
2046
+ const showProgress = this.files[0].state === FileState.Uploading || this.files[0].state === FileState.Paused;
2047
+ return showProgress ? 'active' : 'inactive';
2338
2048
  }
2339
- get kFileProgress() {
2340
- return this.files[0].state === FileState.Uploading ||
2341
- this.files[0].state === FileState.Paused;
2049
+ ngOnInit() {
2050
+ this.filesHaveErrors = super.filesHaveValidationErrors(this.files);
2342
2051
  }
2343
- get kFileSuccess() {
2344
- if (this.uploadService.component === 'Upload') {
2345
- return this.files[0].state === FileState.Uploaded ||
2346
- this.files[0].state === FileState.Initial;
2052
+ fileStatusText(file) {
2053
+ const errors = file.validationErrors;
2054
+ if (!isPresent(errors)) {
2055
+ return this.getTotalFilesSizeMessage([file]);
2347
2056
  }
2348
- return false;
2349
- }
2350
- get kStateFocused() {
2351
- return this.focused;
2057
+ return this.getFileValidationMessage(file);
2352
2058
  }
2353
- onFocus() {
2354
- this.focused = true;
2059
+ get batchStatusText() {
2060
+ const state = this.files[0].state;
2061
+ const fileCount = this.files.length;
2062
+ if (state === FileState.Uploaded) {
2063
+ return `${fileCount} ${this.textFor('filesBatchStatusUploaded')}`;
2064
+ }
2065
+ if (state === FileState.Failed) {
2066
+ return `${fileCount} ${this.textFor('filesBatchStatusFailed')}`;
2067
+ }
2068
+ return `${fileCount} ${this.textFor('filesBatchStatus')}`;
2355
2069
  }
2356
- onBlur() {
2357
- this.focused = false;
2070
+ get isUploadSuccessful() {
2071
+ return this.files[0].state === FileState.Uploaded;
2358
2072
  }
2359
- onClick(event) {
2360
- if (!isFocusable(event.target) && !hasClasses(event.target, IGNORE_TARGET_CLASSES)) {
2361
- this.navigationService.focusedIndex = this.index;
2362
- }
2073
+ get isUploadFailed() {
2074
+ return this.files[0].state === FileState.Failed;
2363
2075
  }
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);
2076
+ }
2077
+ 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 });
2078
+ 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: `
2079
+ <div class="k-progressbar" [@progressState]="showProgress">
2080
+ <span class="k-progress" [style.width]="progressComplete + '%'"></span>
2081
+ </div>
2082
+ <span class="k-multiple-files-group-wrapper">
2083
+ <span class="k-file-group k-icon k-i-copy"></span>
2084
+ </span>
2085
+ <span class="k-multiple-files-wrapper">
2086
+ <ng-container *ngIf="!fileInfoTemplate">
2087
+ <span *ngFor="let file of files" class="k-file-name-size-wrapper">
2088
+ <span [title]="file.name" class="k-file-name">
2089
+ {{file.name}}
2090
+ </span>
2091
+ <span [ngClass]="{
2092
+ 'k-text-error': file.validationErrors,
2093
+ 'k-file-validation-message': file.validationErrors,
2094
+ 'k-file-size': !file.validationErrors
2095
+ }"
2096
+ >{{fileStatusText(file)}}</span>
2097
+ </span>
2098
+ <span class="k-file-information"
2099
+ [ngClass]="{
2100
+ 'k-text-success': isUploadSuccessful,
2101
+ 'k-text-error': isUploadFailed
2102
+ }"
2103
+ >{{batchStatusText}}</span>
2104
+ </ng-container>
2105
+ <ng-template *ngIf="fileInfoTemplate"
2106
+ [templateContext]="{
2107
+ templateRef: fileInfoTemplate.templateRef,
2108
+ state: files[0].state,
2109
+ $implicit: files
2110
+ }">
2111
+ </ng-template>
2112
+ </span>
2113
+ <kendo-upload-file-list-item-action-button
2114
+ [file]='files[0]'
2115
+ [disabled]='disabled'
2116
+ [progress]='progressComplete'>
2117
+ </kendo-upload-file-list-item-action-button>
2118
+ `, 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: [
2119
+ trigger('progressState', [
2120
+ state('active', style({ opacity: 1 })),
2121
+ state('inactive', style({ opacity: 0 })),
2122
+ transition('void => active', style({ opacity: 0 })),
2123
+ transition('inactive => active', style({ opacity: 1 })),
2124
+ transition('active => inactive', animate('1s 2s ease-out'))
2125
+ ])
2126
+ ] });
2127
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListMultipleItemsComponent, decorators: [{
2128
+ type: Component,
2129
+ args: [{
2130
+ animations: [
2131
+ trigger('progressState', [
2132
+ state('active', style({ opacity: 1 })),
2133
+ state('inactive', style({ opacity: 0 })),
2134
+ transition('void => active', style({ opacity: 0 })),
2135
+ transition('inactive => active', style({ opacity: 1 })),
2136
+ transition('active => inactive', animate('1s 2s ease-out'))
2137
+ ])
2138
+ ],
2139
+ selector: 'kendo-upload-file-list-multiple-items',
2140
+ template: `
2141
+ <div class="k-progressbar" [@progressState]="showProgress">
2142
+ <span class="k-progress" [style.width]="progressComplete + '%'"></span>
2143
+ </div>
2144
+ <span class="k-multiple-files-group-wrapper">
2145
+ <span class="k-file-group k-icon k-i-copy"></span>
2146
+ </span>
2147
+ <span class="k-multiple-files-wrapper">
2148
+ <ng-container *ngIf="!fileInfoTemplate">
2149
+ <span *ngFor="let file of files" class="k-file-name-size-wrapper">
2150
+ <span [title]="file.name" class="k-file-name">
2151
+ {{file.name}}
2152
+ </span>
2153
+ <span [ngClass]="{
2154
+ 'k-text-error': file.validationErrors,
2155
+ 'k-file-validation-message': file.validationErrors,
2156
+ 'k-file-size': !file.validationErrors
2157
+ }"
2158
+ >{{fileStatusText(file)}}</span>
2159
+ </span>
2160
+ <span class="k-file-information"
2161
+ [ngClass]="{
2162
+ 'k-text-success': isUploadSuccessful,
2163
+ 'k-text-error': isUploadFailed
2164
+ }"
2165
+ >{{batchStatusText}}</span>
2166
+ </ng-container>
2167
+ <ng-template *ngIf="fileInfoTemplate"
2168
+ [templateContext]="{
2169
+ templateRef: fileInfoTemplate.templateRef,
2170
+ state: files[0].state,
2171
+ $implicit: files
2172
+ }">
2173
+ </ng-template>
2174
+ </span>
2175
+ <kendo-upload-file-list-item-action-button
2176
+ [file]='files[0]'
2177
+ [disabled]='disabled'
2178
+ [progress]='progressComplete'>
2179
+ </kendo-upload-file-list-item-action-button>
2180
+ `
2181
+ }]
2182
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }, { type: UploadService }]; }, propDecorators: { disabled: [{
2183
+ type: Input
2184
+ }], files: [{
2185
+ type: Input
2186
+ }], fileInfoTemplate: [{
2187
+ type: Input
2188
+ }] } });
2438
2189
 
2190
+ /* eslint-disable @angular-eslint/component-selector */
2439
2191
  /**
2440
2192
  * @hidden
2441
2193
  */
2442
- let FileListComponent = class FileListComponent {
2194
+ class FileListComponent {
2443
2195
  constructor(uploadService, navigation) {
2444
2196
  this.uploadService = uploadService;
2445
2197
  this.navigation = navigation;
@@ -2487,31 +2239,9 @@ let FileListComponent = class FileListComponent {
2487
2239
  this.focusSubscription.unsubscribe();
2488
2240
  this.actionSubscription.unsubscribe();
2489
2241
  }
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: `
2242
+ }
2243
+ 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 });
2244
+ 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
2245
  <ng-template ngFor
2516
2246
  [ngForOf]="fileList"
2517
2247
  let-files
@@ -2539,623 +2269,1177 @@ FileListComponent = __decorate([
2539
2269
  }"></ng-template>
2540
2270
  </li>
2541
2271
  </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
- }
2570
- }
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;
2580
- }
2272
+ `, 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"] }] });
2273
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileListComponent, decorators: [{
2274
+ type: Component,
2275
+ args: [{
2276
+ selector: '[kendo-upload-file-list]',
2277
+ template: `
2278
+ <ng-template ngFor
2279
+ [ngForOf]="fileList"
2280
+ let-files
2281
+ let-index="index">
2282
+ <li kendoUploadFileListItem [files]='files' [index]='index'>
2283
+ <kendo-upload-file-list-single-item
2284
+ class='k-file-single'
2285
+ *ngIf='files.length === 1 && !fileTemplate'
2286
+ [disabled]='disabled'
2287
+ [file]='files[0]'
2288
+ [fileInfoTemplate]="fileInfoTemplate">
2289
+ </kendo-upload-file-list-single-item>
2290
+ <kendo-upload-file-list-multiple-items
2291
+ class='k-file-multiple'
2292
+ *ngIf='files.length > 1 && !fileTemplate'
2293
+ [disabled]='disabled'
2294
+ [files]='files'
2295
+ [fileInfoTemplate]="fileInfoTemplate">
2296
+ </kendo-upload-file-list-multiple-items>
2297
+ <ng-template *ngIf="fileTemplate"
2298
+ [templateContext]="{
2299
+ templateRef: fileTemplate.templateRef,
2300
+ state: files[0].state,
2301
+ $implicit: files
2302
+ }"></ng-template>
2303
+ </li>
2304
+ </ng-template>
2305
+ `
2306
+ }]
2307
+ }], ctorParameters: function () { return [{ type: UploadService }, { type: NavigationService }]; }, propDecorators: { disabled: [{
2308
+ type: Input
2309
+ }], fileList: [{
2310
+ type: Input
2311
+ }], fileTemplate: [{
2312
+ type: Input
2313
+ }], fileInfoTemplate: [{
2314
+ type: Input
2315
+ }], fileListItems: [{
2316
+ type: ViewChildren,
2317
+ args: [FileListItemDirective]
2318
+ }] } });
2319
+
2320
+ /**
2321
+ * @hidden
2322
+ */
2323
+ class Messages extends ComponentMessages {
2324
+ }
2325
+ Messages.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Messages, deps: null, target: i0.ɵɵFactoryTarget.Directive });
2326
+ 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 });
2327
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: Messages, decorators: [{
2328
+ type: Directive
2329
+ }], propDecorators: { cancel: [{
2330
+ type: Input
2331
+ }], clearSelectedFiles: [{
2332
+ type: Input
2333
+ }], dropFilesHere: [{
2334
+ type: Input
2335
+ }], externalDropFilesHere: [{
2336
+ type: Input
2337
+ }], filesBatchStatus: [{
2338
+ type: Input
2339
+ }], filesBatchStatusFailed: [{
2340
+ type: Input
2341
+ }], filesBatchStatusUploaded: [{
2342
+ type: Input
2343
+ }], fileStatusFailed: [{
2344
+ type: Input
2345
+ }], fileStatusUploaded: [{
2346
+ type: Input
2347
+ }], headerStatusPaused: [{
2348
+ type: Input
2349
+ }], headerStatusUploaded: [{
2350
+ type: Input
2351
+ }], headerStatusUploading: [{
2352
+ type: Input
2353
+ }], invalidFileExtension: [{
2354
+ type: Input
2355
+ }], invalidMaxFileSize: [{
2356
+ type: Input
2357
+ }], invalidMinFileSize: [{
2358
+ type: Input
2359
+ }], pause: [{
2360
+ type: Input
2361
+ }], remove: [{
2362
+ type: Input
2363
+ }], resume: [{
2364
+ type: Input
2365
+ }], retry: [{
2366
+ type: Input
2367
+ }], select: [{
2368
+ type: Input
2369
+ }], uploadSelectedFiles: [{
2370
+ type: Input
2371
+ }] } });
2372
+
2373
+ /**
2374
+ * @hidden
2375
+ */
2376
+ class LocalizedMessagesDirective extends Messages {
2377
+ constructor(service) {
2378
+ super();
2379
+ this.service = service;
2581
2380
  }
2582
- onRetryClick() {
2583
- if (this.disabled) {
2584
- return;
2381
+ }
2382
+ 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 });
2383
+ LocalizedMessagesDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: LocalizedMessagesDirective, selector: "\n [kendoUploadLocalizedMessages],\n [kendoFileSelectLocalizedMessages],\n [kendoUploadDropZoneLocalizedMessages]\n ", providers: [
2384
+ {
2385
+ provide: Messages,
2386
+ useExisting: forwardRef(() => LocalizedMessagesDirective) // eslint-disable-line no-forward-ref
2387
+ }
2388
+ ], usesInheritance: true, ngImport: i0 });
2389
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LocalizedMessagesDirective, decorators: [{
2390
+ type: Directive,
2391
+ args: [{
2392
+ providers: [
2393
+ {
2394
+ provide: Messages,
2395
+ useExisting: forwardRef(() => LocalizedMessagesDirective) // eslint-disable-line no-forward-ref
2396
+ }
2397
+ ],
2398
+ selector: `
2399
+ [kendoUploadLocalizedMessages],
2400
+ [kendoFileSelectLocalizedMessages],
2401
+ [kendoUploadDropZoneLocalizedMessages]
2402
+ `
2403
+ }]
2404
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
2405
+
2406
+ /**
2407
+ * @hidden
2408
+ */
2409
+ const INVALIDMAXFILESIZE = "invalidMaxFileSize";
2410
+ /**
2411
+ * @hidden
2412
+ */
2413
+ const INVALIDMINFILESIZE = "invalidMinFileSize";
2414
+ /**
2415
+ * @hidden
2416
+ */
2417
+ const INVALIDFILEEXTENSION = "invalidFileExtension";
2418
+ const validateFileExtension = (file, allowedExtensions) => {
2419
+ if (allowedExtensions.length > 0) {
2420
+ if (allowedExtensions.indexOf(file.extension.toLowerCase()) < 0) {
2421
+ file.validationErrors = file.validationErrors || [];
2422
+ if (file.validationErrors.indexOf(INVALIDFILEEXTENSION) < 0) {
2423
+ file.validationErrors.push(INVALIDFILEEXTENSION);
2424
+ }
2585
2425
  }
2586
- this.uploadService.retryFiles(this.file.uid);
2587
2426
  }
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);
2427
+ };
2428
+ const validateFileSize = (file, minFileSize, maxFileSize) => {
2429
+ if (minFileSize !== 0 && file.size < minFileSize) {
2430
+ file.validationErrors = file.validationErrors || [];
2431
+ if (file.validationErrors.indexOf(INVALIDMINFILESIZE) < 0) {
2432
+ file.validationErrors.push(INVALIDMINFILESIZE);
2599
2433
  }
2600
- this.navigation.focusSelectButton();
2601
2434
  }
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);
2435
+ if (maxFileSize !== 0 && file.size > maxFileSize) {
2436
+ file.validationErrors = file.validationErrors || [];
2437
+ if (file.validationErrors.indexOf(INVALIDMAXFILESIZE) < 0) {
2438
+ file.validationErrors.push(INVALIDMAXFILESIZE);
2612
2439
  }
2613
2440
  }
2614
- get actionButtonTitle() {
2615
- if (this.file.state === FileState.Uploading) {
2616
- return this.localization.get('cancel');
2617
- }
2618
- return this.localization.get('remove');
2441
+ };
2442
+ const parseAllowedExtensions = (extensions) => {
2443
+ const allowedExtensions = extensions.map((ext) => {
2444
+ var parsedExt = (ext.substring(0, 1) === ".") ? ext : ("." + ext);
2445
+ return parsedExt.toLowerCase();
2446
+ });
2447
+ return allowedExtensions;
2448
+ };
2449
+ /**
2450
+ * @hidden
2451
+ */
2452
+ const validateFiles = (files, restrictionInfo) => {
2453
+ const allowedExtensions = parseAllowedExtensions(restrictionInfo.allowedExtensions);
2454
+ const maxFileSize = restrictionInfo.maxFileSize;
2455
+ const minFileSize = restrictionInfo.minFileSize;
2456
+ let i;
2457
+ for (i = 0; i < files.length; i++) {
2458
+ validateFileExtension(files[i], allowedExtensions);
2459
+ validateFileSize(files[i], minFileSize, maxFileSize);
2619
2460
  }
2620
- get retryButtonTitle() {
2621
- return this.localization.get('retry');
2461
+ };
2462
+
2463
+ /**
2464
+ * @hidden
2465
+ */
2466
+ class DropZoneBase {
2467
+ constructor(element, renderer, cssClass) {
2468
+ this.element = element;
2469
+ this.renderer = renderer;
2470
+ this.hideIntervalElement = null;
2471
+ this.hoverClass = cssClass;
2622
2472
  }
2623
- get pauseResumeButtonTitle() {
2624
- if (this.file.state === FileState.Uploading) {
2625
- return this.localization.get('pause');
2473
+ /**
2474
+ * @hidden
2475
+ */
2476
+ onElementDragEnterListener() {
2477
+ this.addClass(this.hoverClass);
2478
+ this.lastDragElement = new Date();
2479
+ if (!this.hideIntervalElement) {
2480
+ this.hideIntervalElement = setInterval(() => {
2481
+ if (this.calculateTimeDiff(this.lastDragElement) < 100) {
2482
+ return;
2483
+ }
2484
+ this.removeClass(this.hoverClass);
2485
+ clearInterval(this.hideIntervalElement);
2486
+ this.hideIntervalElement = null;
2487
+ }, 100);
2626
2488
  }
2627
- return this.localization.get('resume');
2628
- }
2629
- get isUploading() {
2630
- return this.file.state === FileState.Uploading;
2489
+ return false;
2631
2490
  }
2632
- get isFailed() {
2633
- return this.file.state === FileState.Failed;
2491
+ /**
2492
+ * @hidden
2493
+ */
2494
+ onElementDragOverListener() {
2495
+ this.lastDragElement = new Date();
2496
+ return false;
2634
2497
  }
2635
- get isPaused() {
2636
- return this.file.state === FileState.Paused;
2498
+ calculateTimeDiff(prevEvent) {
2499
+ return new Date().getTime() - prevEvent.getTime();
2637
2500
  }
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;
2501
+ addClass(className) {
2502
+ this.renderer.addClass(this.element.nativeElement, className);
2643
2503
  }
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;
2648
- }
2649
- return true;
2504
+ removeClass(className) {
2505
+ this.renderer.removeClass(this.element.nativeElement, className);
2650
2506
  }
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>
2715
- `
2716
- }),
2717
- __metadata("design:paramtypes", [UploadService,
2718
- LocalizationService,
2719
- NavigationService])
2720
- ], FileListItemActionButtonComponent);
2507
+ }
2508
+ 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 });
2509
+ DropZoneBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: DropZoneBase, host: { listeners: { "dragenter": "onElementDragEnterListener()", "dragover": "onElementDragOverListener()" } }, ngImport: i0 });
2510
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropZoneBase, decorators: [{
2511
+ type: Directive
2512
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
2513
+ type: Inject,
2514
+ args: ['hoverClass']
2515
+ }] }]; }, propDecorators: { onElementDragEnterListener: [{
2516
+ type: HostListener,
2517
+ args: ['dragenter']
2518
+ }], onElementDragOverListener: [{
2519
+ type: HostListener,
2520
+ args: ['dragover']
2521
+ }] } });
2721
2522
 
2722
2523
  /**
2723
2524
  * @hidden
2724
2525
  */
2725
- class FileListItemBase {
2726
- constructor(uploadService) {
2526
+ class DropZoneInternalDirective extends DropZoneBase {
2527
+ constructor(element, renderer, ngZone, uploadService) {
2528
+ super(element, renderer, 'k-dropzone-hover');
2529
+ this.ngZone = ngZone;
2727
2530
  this.uploadService = uploadService;
2728
- this.progressComplete = 0;
2729
- }
2730
- subscribeUploadProgress(uploadProgressHandler) {
2731
- this.uploadProgressSubscription = this.uploadService.uploadProgressEvent.subscribe(uploadProgressHandler);
2531
+ this.initialClassName = true;
2532
+ this.hideIntervalDocument = null;
2533
+ this.activeClass = 'k-dropzone-active';
2534
+ this.ngZone.runOutsideAngular(() => {
2535
+ this.unsubscribeDocumentDragEnter = this.renderer.listen('document', 'dragenter', () => this.onDocumentDragEnter());
2536
+ this.unsubscribeDocumentDragOver = this.renderer.listen('document', 'dragover', () => this.onDocumentDragOver());
2537
+ });
2732
2538
  }
2733
- fileHasValidationErrors(file) {
2734
- return fileHasValidationErrors(file);
2539
+ ngOnDestroy() {
2540
+ this.ngZone.runOutsideAngular(() => {
2541
+ if (this.unsubscribeDocumentDragEnter) {
2542
+ this.unsubscribeDocumentDragEnter();
2543
+ }
2544
+ if (this.unsubscribeDocumentDragOver) {
2545
+ this.unsubscribeDocumentDragOver();
2546
+ }
2547
+ });
2735
2548
  }
2736
- filesHaveValidationErrors(files) {
2737
- return filesHaveValidationErrors(files);
2549
+ onDocumentDragEnter() {
2550
+ this.addClass(this.activeClass);
2551
+ this.lastDragDocument = new Date();
2552
+ if (!this.hideIntervalDocument) {
2553
+ this.hideIntervalDocument = setInterval(() => {
2554
+ if (this.calculateTimeDiff(this.lastDragDocument) < 100) {
2555
+ return;
2556
+ }
2557
+ this.removeClass(this.activeClass);
2558
+ clearInterval(this.hideIntervalDocument);
2559
+ this.hideIntervalDocument = null;
2560
+ }, 100);
2561
+ }
2562
+ return false;
2738
2563
  }
2739
- ngOnDestroy() {
2740
- this.uploadProgressSubscription.unsubscribe();
2564
+ /**
2565
+ * @hidden
2566
+ */
2567
+ onDocumentDragOver() {
2568
+ this.lastDragDocument = new Date();
2569
+ return false;
2741
2570
  }
2742
- getFileValidationMessage(file) {
2743
- let validationMessage;
2744
- if (file.validationErrors && file.validationErrors.length > 0) {
2745
- validationMessage = this.localization.get(file.validationErrors[0]);
2571
+ onDropListener(event) {
2572
+ let droppedFiles = event.dataTransfer.files;
2573
+ if (droppedFiles.length > 0 && !this.disabled) {
2574
+ let files = getAllFileInfo(droppedFiles);
2575
+ files = assignGuidToFiles(files, !this.uploadService.async.batch);
2576
+ if (!this.multiple) {
2577
+ files.splice(1, files.length - 1);
2578
+ this.uploadService.clearFiles();
2579
+ }
2580
+ validateFiles(files, this.restrictions);
2581
+ this.uploadService.addFiles(files);
2746
2582
  }
2747
- return validationMessage;
2583
+ return false;
2748
2584
  }
2749
- getTotalFilesSizeMessage(files) {
2750
- return getTotalFilesSizeMessage(files);
2585
+ }
2586
+ 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 });
2587
+ 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 });
2588
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DropZoneInternalDirective, decorators: [{
2589
+ type: Directive,
2590
+ args: [{
2591
+ selector: `
2592
+ [kendoUploadInternalDropZone],
2593
+ [kendoFileSelectInternalDropZone]
2594
+ `
2595
+ }]
2596
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: UploadService }]; }, propDecorators: { disabled: [{
2597
+ type: Input
2598
+ }], multiple: [{
2599
+ type: Input
2600
+ }], restrictions: [{
2601
+ type: Input
2602
+ }], initialClassName: [{
2603
+ type: HostBinding,
2604
+ args: ['class.k-dropzone']
2605
+ }], onDropListener: [{
2606
+ type: HostListener,
2607
+ args: ['drop', ['$event']]
2608
+ }] } });
2609
+
2610
+ /**
2611
+ * @hidden
2612
+ */
2613
+ class FileSelectDirective {
2614
+ constructor(uploadService, navigation, el) {
2615
+ this.uploadService = uploadService;
2616
+ this.navigation = navigation;
2617
+ this.type = "file";
2618
+ this.autocomplete = "off";
2619
+ this.tabIndex = -1;
2620
+ this.element = el;
2751
2621
  }
2752
- textFor(key) {
2753
- return this.localization.get(key);
2622
+ get nameAttribute() {
2623
+ return this.uploadService.async.saveField;
2624
+ }
2625
+ get multipleAttribute() {
2626
+ return this.multiple ? "multiple" : null;
2627
+ }
2628
+ get dirAttribute() {
2629
+ return this.dir;
2630
+ }
2631
+ get disabledAttribute() {
2632
+ return this.disabled ? "true" : null;
2633
+ }
2634
+ onInputChange(event) {
2635
+ const ua = navigator.userAgent;
2636
+ const webkit = /(webkit)[ \/]([\w.]+)/i;
2637
+ const ie = /(windows)[ \/]([\w.]+)/i;
2638
+ let selectedFiles = inputFiles(event.target);
2639
+ selectedFiles = assignGuidToFiles(selectedFiles, !this.uploadService.async.batch);
2640
+ validateFiles(selectedFiles, this.restrictions);
2641
+ if (!this.multiple) {
2642
+ this.uploadService.clearFiles();
2643
+ }
2644
+ this.uploadService.addFiles(selectedFiles);
2645
+ /*
2646
+ Chrome, IE, Edge and Safari do not trigger a `change` event
2647
+ when a file with the same name is selected a number of consecutive times.
2648
+ As a workaround, clear the input value after handling the file.
2649
+ */
2650
+ const native = this.element.nativeElement;
2651
+ if (ua.match(webkit) || ua.match(ie)) {
2652
+ native.type = "";
2653
+ native.type = "file";
2654
+ }
2655
+ setTimeout(() => {
2656
+ this.navigation.focusedIndex = -1;
2657
+ });
2754
2658
  }
2755
2659
  }
2660
+ 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 });
2661
+ 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 });
2662
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileSelectDirective, decorators: [{
2663
+ type: Directive,
2664
+ args: [{
2665
+ selector: '[kendoFileSelect]'
2666
+ }]
2667
+ }], ctorParameters: function () { return [{ type: UploadService }, { type: NavigationService }, { type: i0.ElementRef }]; }, propDecorators: { dir: [{
2668
+ type: Input
2669
+ }], disabled: [{
2670
+ type: Input
2671
+ }], multiple: [{
2672
+ type: Input
2673
+ }], restrictions: [{
2674
+ type: Input
2675
+ }], type: [{
2676
+ type: HostBinding,
2677
+ args: ["attr.type"]
2678
+ }], autocomplete: [{
2679
+ type: HostBinding,
2680
+ args: ["attr.autocomplete"]
2681
+ }], tabIndex: [{
2682
+ type: HostBinding,
2683
+ args: ["attr.tabindex"]
2684
+ }], nameAttribute: [{
2685
+ type: HostBinding,
2686
+ args: ["attr.name"]
2687
+ }], multipleAttribute: [{
2688
+ type: HostBinding,
2689
+ args: ["attr.multiple"]
2690
+ }], dirAttribute: [{
2691
+ type: HostBinding,
2692
+ args: ["attr.dir"]
2693
+ }], disabledAttribute: [{
2694
+ type: HostBinding,
2695
+ args: ["attr.disabled"]
2696
+ }], onInputChange: [{
2697
+ type: HostListener,
2698
+ args: ["change", ["$event"]]
2699
+ }] } });
2756
2700
 
2757
2701
  /**
2758
2702
  * @hidden
2759
2703
  */
2760
- let FileListMultipleItemsComponent = class FileListMultipleItemsComponent extends FileListItemBase {
2761
- constructor(localization, uploadService) {
2762
- super(uploadService);
2704
+ const FILESELECT_VALUE_ACCESSOR = {
2705
+ multi: true,
2706
+ provide: NG_VALUE_ACCESSOR,
2707
+ useExisting: forwardRef(() => FileSelectComponent)
2708
+ };
2709
+ class FileSelectComponent {
2710
+ constructor(uploadService, localization, navigation, dropZoneService, ngZone, renderer, cdr, wrapper) {
2711
+ this.uploadService = uploadService;
2763
2712
  this.localization = localization;
2764
- this.subscribeUploadProgress((args) => {
2765
- if (args.files[0].uid === this.files[0].uid) {
2766
- this.progressComplete = args.percentComplete;
2767
- }
2713
+ this.navigation = navigation;
2714
+ this.dropZoneService = dropZoneService;
2715
+ this.ngZone = ngZone;
2716
+ this.renderer = renderer;
2717
+ this.cdr = cdr;
2718
+ /**
2719
+ * Disables the FileSelect.
2720
+ * The default value is `false`.
2721
+ */
2722
+ this.disabled = false;
2723
+ /**
2724
+ * Enables the selection of multiple files
2725
+ * ([see example]({% slug fileprocessing_upload %}#toc-upload-of-sinlge-or-multiple-files)).
2726
+ * If set to `false`, only one file can be selected at a time.
2727
+ */
2728
+ this.multiple = true;
2729
+ /**
2730
+ * Toggles the visibility of the file list.
2731
+ */
2732
+ this.showFileList = true;
2733
+ /**
2734
+ * Specifies the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the FileSelect.
2735
+ */
2736
+ this.tabindex = 0;
2737
+ /**
2738
+ * @hidden
2739
+ */
2740
+ this.focusableId = `k-${guid()}`;
2741
+ /**
2742
+ * Fires when the user navigates outside the component.
2743
+ */
2744
+ this.onBlur = new EventEmitter();
2745
+ /**
2746
+ * Fires when the component is focused.
2747
+ */
2748
+ this.onFocus = new EventEmitter();
2749
+ /**
2750
+ * Fires when files are selected. If prevented, the selected files will not be added to the list.
2751
+ */
2752
+ this.select = new EventEmitter();
2753
+ /**
2754
+ * Fires when a file is about to be removed. If prevented, the file will remain in the list.
2755
+ */
2756
+ this.remove = new EventEmitter();
2757
+ /**
2758
+ * Fires when the value of the component has changed as a result of a successful `select` or `remove` operation.
2759
+ */
2760
+ this.valueChange = new EventEmitter();
2761
+ this.hostDefaultClasses = true;
2762
+ /**
2763
+ * @hidden
2764
+ */
2765
+ this._restrictions = {
2766
+ allowedExtensions: [],
2767
+ maxFileSize: 0,
2768
+ minFileSize: 0
2769
+ };
2770
+ this.onTouchedCallback = (_) => { };
2771
+ this.onChangeCallback = (_) => { };
2772
+ validatePackage(packageMetadata);
2773
+ this.wrapper = wrapper.nativeElement;
2774
+ this.direction = localization.rtl ? 'rtl' : 'ltr';
2775
+ this.navigation.computeKeys(this.direction);
2776
+ this.fileList = this.uploadService.files;
2777
+ this.localizationChangeSubscription = localization.changes.subscribe(({ rtl }) => {
2778
+ this.direction = rtl ? 'rtl' : 'ltr';
2779
+ this.navigation.computeKeys(this.direction);
2768
2780
  });
2781
+ this.subscribeBlur();
2782
+ this.subscribeFocus();
2783
+ this.attachEventHandlers();
2784
+ this.setDefaultSettings();
2769
2785
  }
2770
- get showProgress() {
2771
- const showProgress = this.files[0].state === FileState.Uploading || this.files[0].state === FileState.Paused;
2772
- return showProgress ? 'active' : 'inactive';
2786
+ /**
2787
+ * Sets the `name` attribute of the `input` element of the FileSelect.
2788
+ */
2789
+ set name(name) {
2790
+ this.uploadService.async.saveField = name;
2773
2791
  }
2774
- ngOnInit() {
2775
- this.filesHaveErrors = super.filesHaveValidationErrors(this.files);
2792
+ get name() {
2793
+ return this.uploadService.async.saveField;
2776
2794
  }
2777
- fileStatusText(file) {
2778
- const errors = file.validationErrors;
2779
- if (!isPresent(errors)) {
2780
- return this.getTotalFilesSizeMessage([file]);
2781
- }
2782
- return this.getFileValidationMessage(file);
2795
+ /**
2796
+ * Sets the restrictions for selected files.
2797
+ */
2798
+ set restrictions(restrictions) {
2799
+ let parsedRestrictions = Object.assign({}, this._restrictions, restrictions);
2800
+ this._restrictions = parsedRestrictions;
2783
2801
  }
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')}`;
2802
+ get restrictions() {
2803
+ return this._restrictions;
2804
+ }
2805
+ get hostDisabledClass() {
2806
+ return this.disabled;
2807
+ }
2808
+ get dir() {
2809
+ return this.direction;
2810
+ }
2811
+ ngOnInit() {
2812
+ this.renderer.removeAttribute(this.wrapper, "tabindex");
2813
+ if (this.zoneId) {
2814
+ this.dropZoneService.addComponent(this, this.zoneId);
2792
2815
  }
2793
- return `${fileCount} ${this.textFor('filesBatchStatus')}`;
2794
2816
  }
2795
- get isUploadSuccessful() {
2796
- return this.files[0].state === FileState.Uploaded;
2817
+ /**
2818
+ * @hidden
2819
+ */
2820
+ textFor(key) {
2821
+ return this.localization.get(key);
2797
2822
  }
2798
- get isUploadFailed() {
2799
- return this.files[0].state === FileState.Failed;
2823
+ /**
2824
+ * Focuses the underlying input element.
2825
+ */
2826
+ focus() {
2827
+ setTimeout(() => {
2828
+ this.fileSelectButton.nativeElement.focus();
2829
+ });
2800
2830
  }
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>
2831
+ ngOnDestroy() {
2832
+ this.fileList.clear();
2833
+ if (this.blurSubscription) {
2834
+ this.blurSubscription.unsubscribe();
2835
+ }
2836
+ if (this.wrapperFocusSubscription) {
2837
+ this.wrapperFocusSubscription.unsubscribe();
2838
+ }
2839
+ if (this.selectButtonFocusSubscription) {
2840
+ this.selectButtonFocusSubscription.unsubscribe();
2841
+ }
2842
+ if (this.localizationChangeSubscription) {
2843
+ this.localizationChangeSubscription.unsubscribe();
2844
+ }
2845
+ if (this.subs) {
2846
+ this.subs.unsubscribe();
2847
+ }
2848
+ }
2849
+ /**
2850
+ * @hidden
2851
+ */
2852
+ handleKeydown(event) {
2853
+ if (this.disabled) {
2854
+ return;
2855
+ }
2856
+ if ((event.keyCode === Keys.Enter || event.keyCode === Keys.Space) &&
2857
+ event.target === this.fileSelectButton.nativeElement) {
2858
+ event.preventDefault();
2859
+ this.fileSelect.nativeElement.click();
2860
+ return;
2861
+ }
2862
+ if (hasClasses(event.target, UPLOAD_CLASSES) ||
2863
+ (!isFocusable(event.target) && !hasClasses(event.target, IGNORE_TARGET_CLASSES))) {
2864
+ this.navigation.process(event);
2865
+ }
2866
+ }
2867
+ /**
2868
+ * @hidden
2869
+ */
2870
+ writeValue(newValue) {
2871
+ let isValid = true;
2872
+ if (newValue instanceof Array) {
2873
+ newValue.forEach((file) => {
2874
+ if (!validateInitialFileSelectFile(file)) {
2875
+ isValid = false;
2876
+ }
2877
+ });
2878
+ if (isValid) {
2879
+ this.uploadService.addInitialFileSelectFiles(newValue);
2880
+ }
2881
+ }
2882
+ if (newValue === null) {
2883
+ this.fileList.clear();
2884
+ }
2885
+ this.cdr.markForCheck();
2886
+ }
2887
+ /**
2888
+ * @hidden
2889
+ */
2890
+ registerOnChange(fn) {
2891
+ this.onChangeCallback = fn;
2892
+ }
2893
+ /**
2894
+ * @hidden
2895
+ */
2896
+ registerOnTouched(fn) {
2897
+ this.onTouchedCallback = fn;
2898
+ }
2899
+ /**
2900
+ * @hidden
2901
+ */
2902
+ setDisabledState(isDisabled) {
2903
+ this.disabled = isDisabled;
2904
+ }
2905
+ /**
2906
+ * Removes specific file from the file list.
2907
+ */
2908
+ removeFileByUid(uid) {
2909
+ this.uploadService.removeFiles(uid);
2910
+ }
2911
+ /**
2912
+ * Visually clears all files from the UI.
2913
+ */
2914
+ clearFiles() {
2915
+ this.uploadService.clearFiles();
2916
+ }
2917
+ /**
2918
+ * @hidden
2919
+ * Used to determine if the component is empty.
2920
+ */
2921
+ isEmpty() {
2922
+ return false;
2923
+ }
2924
+ /**
2925
+ * @hidden
2926
+ * Used by the external dropzone to add files to the FileSelect
2927
+ */
2928
+ addFiles(files) {
2929
+ this.uploadService.addFiles(files);
2930
+ }
2931
+ /**
2932
+ * @hidden
2933
+ */
2934
+ get selectButtonTabIndex() {
2935
+ return this.disabled ? undefined : this.tabindex;
2936
+ }
2937
+ /**
2938
+ * @hidden
2939
+ */
2940
+ onFileSelectButtonFocus(_event) {
2941
+ this.renderer.addClass(this.fileSelectButton.nativeElement, 'k-focus');
2942
+ if (!this.navigation.focused) {
2943
+ this.navigation.focusedIndex = -1;
2944
+ }
2945
+ }
2946
+ /**
2947
+ * @hidden
2948
+ */
2949
+ onFileSelectButtonBlur(_event) {
2950
+ this.renderer.removeClass(this.fileSelectButton.nativeElement, 'k-focus');
2951
+ }
2952
+ subscribeBlur() {
2953
+ if (!isDocumentAvailable()) {
2954
+ return;
2955
+ }
2956
+ this.ngZone.runOutsideAngular(() => {
2957
+ this.documentClick = fromEvent(document, 'click').pipe(filter((event) => {
2958
+ return !(this.wrapper !== event.target && this.wrapper.contains(event.target));
2959
+ }));
2960
+ this.blurSubscription = merge(this.documentClick, this.navigation.onTab).subscribe(() => {
2961
+ if (this.navigation.focused) {
2962
+ this.ngZone.run(() => {
2963
+ this.navigation.focused = false;
2964
+ this.onTouchedCallback();
2965
+ this.onBlur.emit();
2966
+ });
2967
+ }
2968
+ });
2969
+ });
2970
+ }
2971
+ subscribeFocus() {
2972
+ this.wrapperFocusSubscription = this.navigation.onWrapperFocus.subscribe(() => {
2973
+ this.onFocus.emit();
2974
+ });
2975
+ this.selectButtonFocusSubscription = this.navigation.onSelectButtonFocus.subscribe(() => {
2976
+ this.fileSelectButton.nativeElement.focus();
2977
+ });
2978
+ }
2979
+ attachEventHandlers() {
2980
+ this.subs = this.uploadService.changeEvent.subscribe((files) => {
2981
+ let model = [];
2982
+ if (files !== null) {
2983
+ files.forEach((file) => {
2984
+ if (file.state === FileState.Initial) {
2985
+ model.push(file);
2986
+ }
2987
+ if (file.state === FileState.Selected && file.rawFile && !file.validationErrors) {
2988
+ model.push(file.rawFile);
2989
+ }
2990
+ });
2991
+ }
2992
+ if (model.length === 0) {
2993
+ model = null;
2994
+ }
2995
+ this.onChangeCallback(model);
2996
+ this.valueChange.emit(model);
2997
+ });
2998
+ this.subs.add(this.uploadService.removeEvent.subscribe((args) => {
2999
+ this.remove.emit(args);
3000
+ }));
3001
+ this.subs.add(this.uploadService.selectEvent.subscribe((args) => {
3002
+ this.select.emit(args);
3003
+ }));
3004
+ }
3005
+ setDefaultSettings() {
3006
+ this.uploadService.async.autoUpload = false;
3007
+ this.uploadService.component = 'FileSelect';
3008
+ }
3009
+ }
3010
+ 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 });
3011
+ 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: [
3012
+ LocalizationService,
3013
+ NavigationService,
3014
+ UploadService,
3015
+ DropZoneService,
3016
+ FILESELECT_VALUE_ACCESSOR,
3017
+ {
3018
+ provide: L10N_PREFIX,
3019
+ useValue: 'kendo.fileselect'
3020
+ },
3021
+ {
3022
+ provide: KendoInput,
3023
+ useExisting: forwardRef(() => FileSelectComponent)
3024
+ }
3025
+ ], 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: `
3026
+ <ng-container kendoFileSelectLocalizedMessages
3027
+ i18n-dropFilesHere="kendo.fileselect.dropFilesHere|The drop zone hint"
3028
+ dropFilesHere="Drop files here to select"
3029
+
3030
+ i18n-invalidFileExtension="kendo.fileselect.invalidFileExtension|The text for the invalid allowed extensions restriction message"
3031
+ invalidFileExtension="File type not allowed."
3032
+
3033
+ i18n-invalidMaxFileSize="kendo.fileselect.invalidMaxFileSize|The text for the invalid max file size restriction message"
3034
+ invalidMaxFileSize="File size too large."
3035
+
3036
+ i18n-invalidMinFileSize="kendo.fileselect.invalidMinFileSize|The text for the invalid min file size restriction message"
3037
+ invalidMinFileSize="File size too small."
3038
+
3039
+ i18n-remove="kendo.fileselect.remove|The text for the Remove button"
3040
+ remove="Remove"
3041
+
3042
+ i18n-select="kendo.fileselect.select|The text for the Select button"
3043
+ select="Select files..."
3044
+ >
2852
3045
  </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>
3046
+ <div kendoFileSelectInternalDropZone
3047
+ [restrictions]="restrictions"
3048
+ [multiple]="multiple"
3049
+ [disabled]="disabled">
3050
+ <div role="button" #fileSelectButton
3051
+ [id]="focusableId"
3052
+ [attr.aria-label]="textFor('select')"
3053
+ [attr.tabindex]="selectButtonTabIndex"
3054
+ (focus)="onFileSelectButtonFocus($event)"
3055
+ (blur)="onFileSelectButtonBlur($event)"
3056
+ class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-upload-button">
3057
+ <input #fileSelect kendoFileSelect
3058
+ [attr.accept]="accept ? accept : null"
3059
+ [dir]="direction"
3060
+ [restrictions]="restrictions"
3061
+ [multiple]="multiple"
3062
+ [disabled]="disabled" />
3063
+ <span>{{textFor('select')}}</span>
3064
+ </div>
3065
+ <div class="k-dropzone-hint">{{textFor('dropFilesHere')}}</div>
3066
+ </div>
3067
+ <ul kendo-upload-file-list
3068
+ class="k-upload-files k-reset"
3069
+ *ngIf="showFileList && fileList.count > 0"
3070
+ [disabled]="disabled"
3071
+ [fileList]="fileList.files"
3072
+ [fileTemplate]="fileTemplate"
3073
+ [fileInfoTemplate]="fileInfoTemplate">
3074
+ </ul>
3075
+ `, 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"] }] });
3076
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileSelectComponent, decorators: [{
3077
+ type: Component,
3078
+ args: [{
3079
+ exportAs: 'kendoFileSelect',
3080
+ providers: [
3081
+ LocalizationService,
3082
+ NavigationService,
3083
+ UploadService,
3084
+ DropZoneService,
3085
+ FILESELECT_VALUE_ACCESSOR,
3086
+ {
3087
+ provide: L10N_PREFIX,
3088
+ useValue: 'kendo.fileselect'
3089
+ },
3090
+ {
3091
+ provide: KendoInput,
3092
+ useExisting: forwardRef(() => FileSelectComponent)
3093
+ }
3094
+ ],
3095
+ selector: 'kendo-fileselect',
3096
+ template: `
3097
+ <ng-container kendoFileSelectLocalizedMessages
3098
+ i18n-dropFilesHere="kendo.fileselect.dropFilesHere|The drop zone hint"
3099
+ dropFilesHere="Drop files here to select"
3100
+
3101
+ i18n-invalidFileExtension="kendo.fileselect.invalidFileExtension|The text for the invalid allowed extensions restriction message"
3102
+ invalidFileExtension="File type not allowed."
3103
+
3104
+ i18n-invalidMaxFileSize="kendo.fileselect.invalidMaxFileSize|The text for the invalid max file size restriction message"
3105
+ invalidMaxFileSize="File size too large."
3106
+
3107
+ i18n-invalidMinFileSize="kendo.fileselect.invalidMinFileSize|The text for the invalid min file size restriction message"
3108
+ invalidMinFileSize="File size too small."
3109
+
3110
+ i18n-remove="kendo.fileselect.remove|The text for the Remove button"
3111
+ remove="Remove"
3112
+
3113
+ i18n-select="kendo.fileselect.select|The text for the Select button"
3114
+ select="Select files..."
3115
+ >
3116
+ </ng-container>
3117
+ <div kendoFileSelectInternalDropZone
3118
+ [restrictions]="restrictions"
3119
+ [multiple]="multiple"
3120
+ [disabled]="disabled">
3121
+ <div role="button" #fileSelectButton
3122
+ [id]="focusableId"
3123
+ [attr.aria-label]="textFor('select')"
3124
+ [attr.tabindex]="selectButtonTabIndex"
3125
+ (focus)="onFileSelectButtonFocus($event)"
3126
+ (blur)="onFileSelectButtonBlur($event)"
3127
+ class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-upload-button">
3128
+ <input #fileSelect kendoFileSelect
3129
+ [attr.accept]="accept ? accept : null"
3130
+ [dir]="direction"
3131
+ [restrictions]="restrictions"
3132
+ [multiple]="multiple"
3133
+ [disabled]="disabled" />
3134
+ <span>{{textFor('select')}}</span>
3135
+ </div>
3136
+ <div class="k-dropzone-hint">{{textFor('dropFilesHere')}}</div>
3137
+ </div>
3138
+ <ul kendo-upload-file-list
3139
+ class="k-upload-files k-reset"
3140
+ *ngIf="showFileList && fileList.count > 0"
3141
+ [disabled]="disabled"
3142
+ [fileList]="fileList.files"
3143
+ [fileTemplate]="fileTemplate"
3144
+ [fileInfoTemplate]="fileInfoTemplate">
3145
+ </ul>
2866
3146
  `
2867
- }),
2868
- __metadata("design:paramtypes", [LocalizationService,
2869
- UploadService])
2870
- ], FileListMultipleItemsComponent);
3147
+ }]
3148
+ }], 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: [{
3149
+ type: Input
3150
+ }], disabled: [{
3151
+ type: Input
3152
+ }], multiple: [{
3153
+ type: Input
3154
+ }], name: [{
3155
+ type: Input
3156
+ }], showFileList: [{
3157
+ type: Input
3158
+ }], tabindex: [{
3159
+ type: Input
3160
+ }], restrictions: [{
3161
+ type: Input
3162
+ }], zoneId: [{
3163
+ type: Input
3164
+ }], focusableId: [{
3165
+ type: Input
3166
+ }], fileTemplate: [{
3167
+ type: ContentChild,
3168
+ args: [FileTemplateDirective, { static: false }]
3169
+ }], fileInfoTemplate: [{
3170
+ type: ContentChild,
3171
+ args: [FileInfoTemplateDirective, { static: false }]
3172
+ }], fileSelect: [{
3173
+ type: ViewChild,
3174
+ args: ['fileSelect', { static: true }]
3175
+ }], fileSelectButton: [{
3176
+ type: ViewChild,
3177
+ args: ['fileSelectButton', { static: true }]
3178
+ }], onBlur: [{
3179
+ type: Output,
3180
+ args: ['blur']
3181
+ }], onFocus: [{
3182
+ type: Output,
3183
+ args: ['focus']
3184
+ }], select: [{
3185
+ type: Output
3186
+ }], remove: [{
3187
+ type: Output
3188
+ }], valueChange: [{
3189
+ type: Output
3190
+ }], hostDefaultClasses: [{
3191
+ type: HostBinding,
3192
+ args: ['class.k-widget']
3193
+ }, {
3194
+ type: HostBinding,
3195
+ args: ['class.k-upload']
3196
+ }], hostDisabledClass: [{
3197
+ type: HostBinding,
3198
+ args: ['class.k-disabled']
3199
+ }], dir: [{
3200
+ type: HostBinding,
3201
+ args: ['attr.dir']
3202
+ }], handleKeydown: [{
3203
+ type: HostListener,
3204
+ args: ['keydown', ['$event']]
3205
+ }] } });
3206
+
3207
+ /**
3208
+ * Custom component messages override default component messages ([more information and example]({% slug globalization_upload %})).
3209
+ *
3210
+ * @example
3211
+ * ```html-no-run
3212
+ * <kendo-fileselect>
3213
+ * <kendo-fileselect-messages
3214
+ * dropFilesHere="Drop your file here"
3215
+ * select="Upload file">
3216
+ * </kendo-fileselect-messages>
3217
+ * </kendo-fileselect>
3218
+ * ```
3219
+ */
3220
+ class CustomMessagesComponent extends Messages {
3221
+ constructor(service) {
3222
+ super();
3223
+ this.service = service;
3224
+ }
3225
+ get override() {
3226
+ return true;
3227
+ }
3228
+ }
3229
+ 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 });
3230
+ 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: [
3231
+ {
3232
+ provide: Messages,
3233
+ useExisting: forwardRef(() => CustomMessagesComponent) // eslint-disable-line no-forward-ref
3234
+ }
3235
+ ], usesInheritance: true, ngImport: i0, template: ``, isInline: true });
3236
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CustomMessagesComponent, decorators: [{
3237
+ type: Component,
3238
+ args: [{
3239
+ providers: [
3240
+ {
3241
+ provide: Messages,
3242
+ useExisting: forwardRef(() => CustomMessagesComponent) // eslint-disable-line no-forward-ref
3243
+ }
3244
+ ],
3245
+ selector: 'kendo-upload-messages, kendo-fileselect-messages, kendo-uploaddropzone-messages',
3246
+ template: ``
3247
+ }]
3248
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; } });
2871
3249
 
2872
3250
  /**
2873
3251
  * @hidden
2874
3252
  */
2875
- let FileListSingleItemComponent = class FileListSingleItemComponent extends FileListItemBase {
2876
- constructor(localization, uploadService) {
2877
- super(uploadService);
3253
+ class UploadStatusTotalComponent {
3254
+ constructor(localization) {
2878
3255
  this.localization = localization;
2879
- this.subscribeUploadProgress((args) => {
2880
- if (args.files[0].uid === this.file.uid) {
2881
- this.progressComplete = args.percentComplete;
2882
- }
2883
- });
2884
3256
  }
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')}`;
3257
+ ngDoCheck() {
3258
+ this.isPaused = this.fileList.hasFileWithState([FileState.Paused]);
3259
+ this.isFailed = this.fileList.hasFileWithState([FileState.Failed]);
3260
+ this.isUploading = this.fileList.hasFileWithState([FileState.Uploading]);
3261
+ if (this.isPaused && !this.isUploading) {
3262
+ this.statusText = this.localization.get('headerStatusPaused');
2892
3263
  }
2893
- if (!isPresent(errors)) {
2894
- return this.getTotalFilesSizeMessage([this.file]);
3264
+ else {
3265
+ this.statusText = this.isUploading ? this.localization.get('headerStatusUploading')
3266
+ : this.localization.get('headerStatusUploaded');
2895
3267
  }
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
3268
  }
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]
3269
+ }
3270
+ 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 });
3271
+ 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: `
3272
+ <span class="k-icon"
3273
+ [ngClass]="{
3274
+ 'k-i-checkmark': !this.isUploading && !this.isFailed,
3275
+ 'k-i-exception': !this.isUploading && this.isFailed,
3276
+ 'k-i-upload': this.isUploading,
3277
+ 'k-i-pause-sm': this.isPaused
2963
3278
  }">
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>
3279
+ </span>
3280
+ {{statusText}}
3281
+ `, isInline: true, directives: [{ type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
3282
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadStatusTotalComponent, decorators: [{
3283
+ type: Component,
3284
+ args: [{
3285
+ selector: 'kendo-upload-status-total',
3286
+ template: `
3287
+ <span class="k-icon"
3288
+ [ngClass]="{
3289
+ 'k-i-checkmark': !this.isUploading && !this.isFailed,
3290
+ 'k-i-exception': !this.isUploading && this.isFailed,
3291
+ 'k-i-upload': this.isUploading,
3292
+ 'k-i-pause-sm': this.isPaused
3293
+ }">
3294
+ </span>
3295
+ {{statusText}}
2971
3296
  `
2972
- }),
2973
- __metadata("design:paramtypes", [LocalizationService, UploadService])
2974
- ], FileListSingleItemComponent);
3297
+ }]
3298
+ }], ctorParameters: function () { return [{ type: i1$1.LocalizationService }]; }, propDecorators: { fileList: [{
3299
+ type: Input
3300
+ }] } });
2975
3301
 
2976
3302
  /**
2977
3303
  * @hidden
2978
3304
  */
2979
- let FileSelectDirective = class FileSelectDirective {
2980
- constructor(uploadService, navigation, el) {
3305
+ class UploadActionButtonsComponent {
3306
+ constructor(uploadService, localization, navigation) {
2981
3307
  this.uploadService = uploadService;
3308
+ this.localization = localization;
2982
3309
  this.navigation = navigation;
2983
- this.type = "file";
2984
- this.autocomplete = "off";
2985
- this.tabIndex = -1;
2986
- this.element = el;
3310
+ this.hostDefaultClass = true;
3311
+ this.onAction();
3312
+ this.onFocus();
2987
3313
  }
2988
- get nameAttribute() {
2989
- return this.uploadService.async.saveField;
3314
+ get actionButtonsEndClassName() {
3315
+ return this.actionsLayout === 'end';
2990
3316
  }
2991
- get multipleAttribute() {
2992
- return this.multiple ? "multiple" : null;
3317
+ get actionButtonsStretchedClassName() {
3318
+ return this.actionsLayout === 'stretched';
2993
3319
  }
2994
- get dirAttribute() {
2995
- return this.dir;
3320
+ get actionButtonsStartClassName() {
3321
+ return this.actionsLayout === 'start';
2996
3322
  }
2997
- get disabledAttribute() {
2998
- return this.disabled ? "true" : null;
3323
+ get actionButtonsCenterClassName() {
3324
+ return this.actionsLayout === 'center';
2999
3325
  }
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;
3326
+ onAction() {
3327
+ this.actionSubscription = this.navigation.onActionButtonAction.subscribe((button) => {
3328
+ if (button === "clear") {
3329
+ this.clearFiles();
3330
+ }
3331
+ else {
3332
+ this.performUpload();
3333
+ }
3023
3334
  });
3024
3335
  }
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;
3336
+ onFocus() {
3337
+ this.focusSubscription = this.navigation.onActionButtonFocus.subscribe((button) => {
3338
+ this.focusButton(button);
3339
+ });
3097
3340
  }
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;
3341
+ focusButton(button) {
3342
+ const el = (button === "clear") ? this.clearButton : this.uploadButton;
3343
+ el.nativeElement.focus();
3122
3344
  }
3123
- set templateContext(context) {
3124
- if (this.insertedViewRef) {
3125
- this.viewContainerRef.remove(this.viewContainerRef.indexOf(this.insertedViewRef));
3126
- this.insertedViewRef = undefined;
3345
+ ngOnDestroy() {
3346
+ this.actionSubscription.unsubscribe();
3347
+ this.focusSubscription.unsubscribe();
3348
+ }
3349
+ onUploadButtonClick(event) {
3350
+ event.stopImmediatePropagation();
3351
+ this.performUpload();
3352
+ }
3353
+ performUpload() {
3354
+ if (!this.disabled) {
3355
+ this.uploadService.uploadFiles();
3356
+ this.navigation.focusSelectButton();
3127
3357
  }
3128
- if (context.templateRef) {
3129
- this.insertedViewRef = this.viewContainerRef.createEmbeddedView(context.templateRef, context);
3358
+ }
3359
+ onClearButtonClick(event) {
3360
+ event.stopImmediatePropagation();
3361
+ this.clearFiles();
3362
+ }
3363
+ clearFiles() {
3364
+ if (!this.disabled) {
3365
+ this.uploadService.clearFiles();
3366
+ this.navigation.focusSelectButton();
3130
3367
  }
3131
3368
  }
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);
3369
+ textFor(key) {
3370
+ return this.localization.get(key);
3371
+ }
3372
+ }
3373
+ 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 });
3374
+ 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: `
3375
+ <button #clearButton type="button" class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-clear-selected"
3376
+ [attr.tabIndex]="-1"
3377
+ (click)="onClearButtonClick($event)">
3378
+ {{textFor('clearSelectedFiles')}}
3379
+ </button>
3380
+ <button #uploadButton type="button" class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-primary k-upload-selected"
3381
+ [attr.tabIndex]="-1"
3382
+ (click)="onUploadButtonClick($event)">
3383
+ {{textFor('uploadSelectedFiles')}}
3384
+ </button>
3385
+ `, isInline: true });
3386
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadActionButtonsComponent, decorators: [{
3387
+ type: Component,
3388
+ args: [{
3389
+ selector: 'kendo-upload-action-buttons',
3390
+ template: `
3391
+ <button #clearButton type="button" class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-clear-selected"
3392
+ [attr.tabIndex]="-1"
3393
+ (click)="onClearButtonClick($event)">
3394
+ {{textFor('clearSelectedFiles')}}
3395
+ </button>
3396
+ <button #uploadButton type="button" class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-primary k-upload-selected"
3397
+ [attr.tabIndex]="-1"
3398
+ (click)="onUploadButtonClick($event)">
3399
+ {{textFor('uploadSelectedFiles')}}
3400
+ </button>
3401
+ `
3402
+ }]
3403
+ }], ctorParameters: function () { return [{ type: UploadService }, { type: i1$1.LocalizationService }, { type: NavigationService }]; }, propDecorators: { disabled: [{
3404
+ type: Input
3405
+ }], actionsLayout: [{
3406
+ type: Input
3407
+ }], clearButton: [{
3408
+ type: ViewChild,
3409
+ args: ['clearButton', { static: true }]
3410
+ }], uploadButton: [{
3411
+ type: ViewChild,
3412
+ args: ['uploadButton', { static: true }]
3413
+ }], hostDefaultClass: [{
3414
+ type: HostBinding,
3415
+ args: ['class.k-actions']
3416
+ }], actionButtonsEndClassName: [{
3417
+ type: HostBinding,
3418
+ args: ['class.k-actions-end']
3419
+ }], actionButtonsStretchedClassName: [{
3420
+ type: HostBinding,
3421
+ args: ['class.k-actions-stretched']
3422
+ }], actionButtonsStartClassName: [{
3423
+ type: HostBinding,
3424
+ args: ['class.k-actions-start']
3425
+ }], actionButtonsCenterClassName: [{
3426
+ type: HostBinding,
3427
+ args: ['class.k-actions-center']
3428
+ }] } });
3144
3429
 
3145
- var UploadComponent_1;
3146
- /* tslint:disable: no-use-before-declare */
3430
+ /* eslint-disable no-use-before-declare */
3147
3431
  /**
3148
3432
  * @hidden
3149
3433
  */
3150
3434
  const UPLOAD_VALUE_ACCESSOR = {
3151
3435
  multi: true,
3152
3436
  provide: NG_VALUE_ACCESSOR,
3153
- useExisting: forwardRef(() => UploadComponent) // tslint:disable-line:no-forward-ref
3437
+ useExisting: forwardRef(() => UploadComponent) // eslint-disable-line no-forward-ref
3154
3438
  };
3155
3439
  /**
3156
3440
  * Represents the [Kendo UI Upload component for Angular]({% slug overview_upload %}).
3157
3441
  */
3158
- let UploadComponent = UploadComponent_1 = class UploadComponent {
3442
+ class UploadComponent {
3159
3443
  constructor(uploadService, localization, navigation, dropZoneService, _ngZone, renderer, cdr, wrapper) {
3160
3444
  this.uploadService = uploadService;
3161
3445
  this.localization = localization;
@@ -3764,231 +4048,145 @@ let UploadComponent = UploadComponent_1 = class UploadComponent {
3764
4048
  this.uploadProgress.emit(args);
3765
4049
  }));
3766
4050
  }
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: `
4051
+ }
4052
+ 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 });
4053
+ 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: [
4054
+ LocalizationService,
4055
+ NavigationService,
4056
+ UploadService,
4057
+ DropZoneService,
4058
+ UPLOAD_VALUE_ACCESSOR,
4059
+ {
4060
+ provide: L10N_PREFIX,
4061
+ useValue: 'kendo.upload'
4062
+ },
4063
+ {
4064
+ provide: KendoInput,
4065
+ useExisting: forwardRef(() => UploadComponent)
4066
+ }
4067
+ ], 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: `
4068
+ <ng-container kendoUploadLocalizedMessages
4069
+ i18n-cancel="kendo.upload.cancel|The text for the Cancel button"
4070
+ cancel="Cancel"
4071
+
4072
+ i18n-clearSelectedFiles="kendo.upload.clearSelectedFiles|The text for the Clear button"
4073
+ clearSelectedFiles="Clear"
4074
+
4075
+ i18n-dropFilesHere="kendo.upload.dropFilesHere|The drop zone hint"
4076
+ dropFilesHere="Drop files here to upload"
4077
+
4078
+ i18n-filesBatchStatus="kendo.upload.filesBatchStatus|The status message for a batch of files"
4079
+ filesBatchStatus="files"
4080
+
4081
+ i18n-filesBatchStatusFailed="kendo.upload.filesBatchStatusFailed|The status message for a batch of files after failed upload"
4082
+ filesBatchStatusFailed="files failed to upload."
4083
+
4084
+ i18n-filesBatchStatusUploaded="kendo.upload.filesBatchStatusUploaded|The status message for a batch of files after successful upload"
4085
+ filesBatchStatusUploaded="files successfully uploaded."
4086
+
4087
+ i18n-fileStatusFailed="kendo.upload.fileStatusFailed|The file status message after failed upload"
4088
+ fileStatusFailed="File failed to upload."
4089
+
4090
+ i18n-fileStatusUploaded="kendo.upload.fileStatusUploaded|The file status message after successful upload"
4091
+ fileStatusUploaded="File successfully uploaded."
4092
+
4093
+ i18n-headerStatusPaused="kendo.upload.headerStatusPaused|The header status message when the file upload is paused"
4094
+ headerStatusPaused="Paused"
4095
+
4096
+ i18n-headerStatusUploaded="kendo.upload.headerStatusUploaded|The header status message after file upload completion"
4097
+ headerStatusUploaded="Done"
4098
+
4099
+ i18n-headerStatusUploading="kendo.upload.headerStatusUploading|The header status message during file upload"
4100
+ headerStatusUploading="Uploading..."
4101
+
4102
+ i18n-invalidFileExtension="kendo.upload.invalidFileExtension|The text for the invalid allowed extensions restriction message"
4103
+ invalidFileExtension="File type not allowed."
4104
+
4105
+ i18n-invalidMaxFileSize="kendo.upload.invalidMaxFileSize|The text for the invalid max file size restriction message"
4106
+ invalidMaxFileSize="File size too large."
4107
+
4108
+ i18n-invalidMinFileSize="kendo.upload.invalidMinFileSize|The text for the invalid min file size restriction message"
4109
+ invalidMinFileSize="File size too small."
4110
+
4111
+ i18n-pause="kendo.upload.pause|The text for the Pause button"
4112
+ pause="Pause"
4113
+
4114
+ i18n-remove="kendo.upload.remove|The text for the Remove button"
4115
+ remove="Remove"
4116
+
4117
+ i18n-resume="kendo.upload.resume|The text for the Resume button"
4118
+ resume="Resume"
4119
+
4120
+ i18n-retry="kendo.upload.retry|The text for the Retry button"
4121
+ retry="Retry"
4122
+
4123
+ i18n-select="kendo.upload.select|The text for the Select button"
4124
+ select="Select files..."
4125
+
4126
+ i18n-uploadSelectedFiles="kendo.upload.uploadSelectedFiles|The text for the Upload files button"
4127
+ uploadSelectedFiles="Upload"
4128
+ >
4129
+ </ng-container>
4130
+ <div kendoUploadInternalDropZone
4131
+ [restrictions]="restrictions"
4132
+ [multiple]="multiple"
4133
+ [disabled]="disabled">
4134
+ <div role="button" #fileSelectButton
4135
+ [id]="focusableId"
4136
+ [attr.aria-label]="textFor('select')"
4137
+ [attr.tabindex]="selectButtonTabIndex"
4138
+ (focus)="onFileSelectButtonFocus($event)"
4139
+ (blur)="onFileSelectButtonBlur($event)"
4140
+ class="k-button k-button-md k-rounded-md k-button-solid k-button-solid-base k-upload-button">
4141
+ <input #fileSelect kendoFileSelect
4142
+ [attr.accept]="accept ? accept : null"
4143
+ [attr.aria-hidden]="true"
4144
+ [dir]="direction"
4145
+ [restrictions]="restrictions"
4146
+ [multiple]="multiple"
4147
+ [disabled]="disabled" />
4148
+ <span>{{textFor('select')}}</span>
4149
+ </div>
4150
+ <kendo-upload-status-total *ngIf="showTotalStatus"
4151
+ class="k-upload-status k-upload-status-total"
4152
+ [fileList]="fileList">
4153
+ </kendo-upload-status-total>
4154
+ <div class="k-dropzone-hint">{{textFor('dropFilesHere')}}</div>
4155
+ </div>
4156
+ <ul kendo-upload-file-list *ngIf="showFileList && fileList.count > 0"
4157
+ class="k-upload-files k-reset"
4158
+ [disabled]="disabled"
4159
+ [fileList]="fileList.files"
4160
+ [fileTemplate]="fileTemplate"
4161
+ [fileInfoTemplate]="fileInfoTemplate">
4162
+ </ul>
4163
+ <kendo-upload-action-buttons
4164
+ *ngIf="showActionButtons"
4165
+ [disabled]="disabled"
4166
+ [actionsLayout]="actionsLayout">
4167
+ </kendo-upload-action-buttons>
4168
+ `, 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"] }] });
4169
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadComponent, decorators: [{
4170
+ type: Component,
4171
+ args: [{
4172
+ exportAs: 'kendoUpload',
4173
+ providers: [
4174
+ LocalizationService,
4175
+ NavigationService,
4176
+ UploadService,
4177
+ DropZoneService,
4178
+ UPLOAD_VALUE_ACCESSOR,
4179
+ {
4180
+ provide: L10N_PREFIX,
4181
+ useValue: 'kendo.upload'
4182
+ },
4183
+ {
4184
+ provide: KendoInput,
4185
+ useExisting: forwardRef(() => UploadComponent)
4186
+ }
4187
+ ],
4188
+ selector: 'kendo-upload',
4189
+ template: `
3992
4190
  <ng-container kendoUploadLocalizedMessages
3993
4191
  i18n-cancel="kendo.upload.cancel|The text for the Cancel button"
3994
4192
  cancel="Cancel"
@@ -4090,18 +4288,116 @@ UploadComponent = UploadComponent_1 = __decorate([
4090
4288
  [actionsLayout]="actionsLayout">
4091
4289
  </kendo-upload-action-buttons>
4092
4290
  `
4093
- }),
4094
- __metadata("design:paramtypes", [UploadService,
4095
- LocalizationService,
4096
- NavigationService,
4097
- DropZoneService,
4098
- NgZone,
4099
- Renderer2,
4100
- ChangeDetectorRef,
4101
- ElementRef])
4102
- ], UploadComponent);
4291
+ }]
4292
+ }], 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: [{
4293
+ type: Input
4294
+ }], batch: [{
4295
+ type: Input
4296
+ }], withCredentials: [{
4297
+ type: Input
4298
+ }], saveField: [{
4299
+ type: Input
4300
+ }], saveHeaders: [{
4301
+ type: Input
4302
+ }], saveMethod: [{
4303
+ type: Input
4304
+ }], saveUrl: [{
4305
+ type: Input
4306
+ }], responseType: [{
4307
+ type: Input
4308
+ }], removeField: [{
4309
+ type: Input
4310
+ }], removeHeaders: [{
4311
+ type: Input
4312
+ }], removeMethod: [{
4313
+ type: Input
4314
+ }], removeUrl: [{
4315
+ type: Input
4316
+ }], chunkable: [{
4317
+ type: Input
4318
+ }], concurrent: [{
4319
+ type: Input
4320
+ }], multiple: [{
4321
+ type: Input
4322
+ }], disabled: [{
4323
+ type: Input
4324
+ }], showFileList: [{
4325
+ type: Input
4326
+ }], tabindex: [{
4327
+ type: Input
4328
+ }], zoneId: [{
4329
+ type: Input
4330
+ }], tabIndex: [{
4331
+ type: Input,
4332
+ args: ['tabIndex']
4333
+ }], accept: [{
4334
+ type: Input
4335
+ }], restrictions: [{
4336
+ type: Input
4337
+ }], focusableId: [{
4338
+ type: Input
4339
+ }], actionsLayout: [{
4340
+ type: Input
4341
+ }], fileTemplate: [{
4342
+ type: ContentChild,
4343
+ args: [FileTemplateDirective, { static: false }]
4344
+ }], fileInfoTemplate: [{
4345
+ type: ContentChild,
4346
+ args: [FileInfoTemplateDirective, { static: false }]
4347
+ }], fileSelect: [{
4348
+ type: ViewChild,
4349
+ args: ['fileSelect', { static: true }]
4350
+ }], fileSelectButton: [{
4351
+ type: ViewChild,
4352
+ args: ['fileSelectButton', { static: true }]
4353
+ }], onBlur: [{
4354
+ type: Output,
4355
+ args: ['blur']
4356
+ }], cancel: [{
4357
+ type: Output
4358
+ }], clear: [{
4359
+ type: Output
4360
+ }], complete: [{
4361
+ type: Output
4362
+ }], error: [{
4363
+ type: Output
4364
+ }], onFocus: [{
4365
+ type: Output,
4366
+ args: ['focus']
4367
+ }], pause: [{
4368
+ type: Output
4369
+ }], remove: [{
4370
+ type: Output
4371
+ }], resume: [{
4372
+ type: Output
4373
+ }], select: [{
4374
+ type: Output
4375
+ }], success: [{
4376
+ type: Output
4377
+ }], upload: [{
4378
+ type: Output
4379
+ }], uploadProgress: [{
4380
+ type: Output
4381
+ }], valueChange: [{
4382
+ type: Output
4383
+ }], hostDefaultClasses: [{
4384
+ type: HostBinding,
4385
+ args: ['class.k-widget']
4386
+ }, {
4387
+ type: HostBinding,
4388
+ args: ['class.k-upload']
4389
+ }], hostDisabledClass: [{
4390
+ type: HostBinding,
4391
+ args: ['class.k-disabled']
4392
+ }], dir: [{
4393
+ type: HostBinding,
4394
+ args: ['attr.dir']
4395
+ }], handleKeydown: [{
4396
+ type: HostListener,
4397
+ args: ['keydown', ['$event']]
4398
+ }] } });
4103
4399
 
4104
- let UploadDropZoneDirective = class UploadDropZoneDirective {
4400
+ class UploadDropZoneDirective {
4105
4401
  constructor(dropZoneService) {
4106
4402
  this.dropZoneService = dropZoneService;
4107
4403
  }
@@ -4151,44 +4447,38 @@ let UploadDropZoneDirective = class UploadDropZoneDirective {
4151
4447
  get componentInstance() {
4152
4448
  return this.dropZoneService.getComponents(this.zoneId);
4153
4449
  }
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);
4450
+ }
4451
+ UploadDropZoneDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadDropZoneDirective, deps: [{ token: DropZoneService }], target: i0.ɵɵFactoryTarget.Directive });
4452
+ 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: [
4453
+ DropZoneService
4454
+ ], ngImport: i0 });
4455
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadDropZoneDirective, decorators: [{
4456
+ type: Directive,
4457
+ args: [{
4458
+ providers: [
4459
+ DropZoneService
4460
+ ],
4461
+ selector: '[kendoUploadDropZone], [kendoFileSelectDropZone]'
4462
+ }]
4463
+ }], ctorParameters: function () { return [{ type: DropZoneService }]; }, propDecorators: { zoneId: [{
4464
+ type: Input,
4465
+ args: ['kendoUploadDropZone']
4466
+ }], onElementDragEnter: [{
4467
+ type: HostListener,
4468
+ args: ['dragenter']
4469
+ }], onElementDragOver: [{
4470
+ type: HostListener,
4471
+ args: ['dragover']
4472
+ }], onDropListener: [{
4473
+ type: HostListener,
4474
+ args: ['drop', ['$event']]
4475
+ }] } });
4186
4476
 
4187
- /* tslint:disable: no-use-before-declare */
4477
+ /* eslint-disable no-use-before-declare */
4188
4478
  /**
4189
4479
  * Represents the [Kendo UI UploadDropZone component for Angular]({% slug overview_upload %}).
4190
4480
  */
4191
- let UploadDropZoneComponent = class UploadDropZoneComponent extends DropZoneBase {
4481
+ class UploadDropZoneComponent extends DropZoneBase {
4192
4482
  constructor(element, renderer, localization) {
4193
4483
  super(element, renderer, 'k-external-dropzone-hover');
4194
4484
  this.localization = localization;
@@ -4223,40 +4513,41 @@ let UploadDropZoneComponent = class UploadDropZoneComponent extends DropZoneBase
4223
4513
  this.localizationChangeSubscription.unsubscribe();
4224
4514
  }
4225
4515
  }
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: `
4516
+ }
4517
+ 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 });
4518
+ 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: [
4519
+ LocalizationService,
4520
+ {
4521
+ provide: L10N_PREFIX,
4522
+ useValue: 'kendo.uploaddropzone'
4523
+ }
4524
+ ], exportAs: ["kendoUploadDropZone"], usesInheritance: true, ngImport: i0, template: `
4525
+ <ng-container kendoUploadDropZoneLocalizedMessages
4526
+ i18n-externalDropFilesHere='kendo.uploaddropzone.externalDropFilesHere|Sets the external drop-zone hint'
4527
+ externalDropFilesHere='Drag and drop files here to upload'
4528
+ >
4529
+ </ng-container>
4530
+ <div class='k-dropzone-inner' [kendoUploadDropZone]="zoneId">
4531
+ <span [ngClass]="iconClasses"></span>
4532
+ <span class="k-dropzone-hint">{{ textFor('externalDropFilesHere') }}</span>
4533
+ <span class="k-dropzone-note">
4534
+ <ng-content></ng-content>
4535
+ </span>
4536
+ </div>
4537
+ `, 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"] }] });
4538
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadDropZoneComponent, decorators: [{
4539
+ type: Component,
4540
+ args: [{
4541
+ exportAs: 'kendoUploadDropZone',
4542
+ providers: [
4543
+ LocalizationService,
4544
+ {
4545
+ provide: L10N_PREFIX,
4546
+ useValue: 'kendo.uploaddropzone'
4547
+ }
4548
+ ],
4549
+ selector: 'kendo-uploaddropzone',
4550
+ template: `
4260
4551
  <ng-container kendoUploadDropZoneLocalizedMessages
4261
4552
  i18n-externalDropFilesHere='kendo.uploaddropzone.externalDropFilesHere|Sets the external drop-zone hint'
4262
4553
  externalDropFilesHere='Drag and drop files here to upload'
@@ -4270,11 +4561,20 @@ UploadDropZoneComponent = __decorate([
4270
4561
  </span>
4271
4562
  </div>
4272
4563
  `
4273
- }),
4274
- __metadata("design:paramtypes", [ElementRef,
4275
- Renderer2,
4276
- LocalizationService])
4277
- ], UploadDropZoneComponent);
4564
+ }]
4565
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1$1.LocalizationService }]; }, propDecorators: { hostClass: [{
4566
+ type: HostBinding,
4567
+ args: ['class.k-external-dropzone']
4568
+ }], dirAttribute: [{
4569
+ type: HostBinding,
4570
+ args: ['attr.dir']
4571
+ }], zoneId: [{
4572
+ type: Input
4573
+ }], icon: [{
4574
+ type: Input
4575
+ }], iconClass: [{
4576
+ type: Input
4577
+ }] } });
4278
4578
 
4279
4579
  /**
4280
4580
  * @hidden
@@ -4303,22 +4603,50 @@ const PUBLIC_DIRECTIVES = [
4303
4603
  /**
4304
4604
  * @hidden
4305
4605
  */
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);
4606
+ class SharedModule {
4607
+ }
4608
+ SharedModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SharedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4609
+ SharedModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SharedModule, declarations: [FileTemplateDirective,
4610
+ FileInfoTemplateDirective,
4611
+ CustomMessagesComponent,
4612
+ UploadDropZoneDirective,
4613
+ UploadDropZoneComponent, DropZoneInternalDirective,
4614
+ FileListComponent,
4615
+ FileListItemDirective,
4616
+ FileListItemActionButtonComponent,
4617
+ FileListMultipleItemsComponent,
4618
+ FileListSingleItemComponent,
4619
+ FileSelectDirective,
4620
+ LocalizedMessagesDirective,
4621
+ TemplateContextDirective], imports: [CommonModule], exports: [FileTemplateDirective,
4622
+ FileInfoTemplateDirective,
4623
+ CustomMessagesComponent,
4624
+ UploadDropZoneDirective,
4625
+ UploadDropZoneComponent, DropZoneInternalDirective,
4626
+ FileListComponent,
4627
+ FileListItemDirective,
4628
+ FileListItemActionButtonComponent,
4629
+ FileListMultipleItemsComponent,
4630
+ FileListSingleItemComponent,
4631
+ FileSelectDirective,
4632
+ LocalizedMessagesDirective,
4633
+ TemplateContextDirective, CommonModule] });
4634
+ SharedModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SharedModule, imports: [[CommonModule], CommonModule] });
4635
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SharedModule, decorators: [{
4636
+ type: NgModule,
4637
+ args: [{
4638
+ declarations: [
4639
+ PUBLIC_DIRECTIVES,
4640
+ SHARED_DECLARATIONS
4641
+ ],
4642
+ exports: [
4643
+ PUBLIC_DIRECTIVES,
4644
+ SHARED_DECLARATIONS,
4645
+ CommonModule
4646
+ ],
4647
+ imports: [CommonModule]
4648
+ }]
4649
+ }] });
4322
4650
 
4323
4651
  const FILESELECT_DECLARATIONS = [
4324
4652
  FileSelectComponent
@@ -4326,192 +4654,22 @@ const FILESELECT_DECLARATIONS = [
4326
4654
  /**
4327
4655
  * Represents the [NgModule](https://angular.io/api/core/NgModule) definition for the FileSelect component.
4328
4656
  */
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);
4657
+ class FileSelectModule {
4658
+ }
4659
+ FileSelectModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4660
+ 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] });
4661
+ FileSelectModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileSelectModule, imports: [[SharedModule]] });
4662
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FileSelectModule, decorators: [{
4663
+ type: NgModule,
4664
+ args: [{
4665
+ declarations: [FILESELECT_DECLARATIONS],
4666
+ exports: [
4667
+ PUBLIC_DIRECTIVES,
4668
+ FILESELECT_DECLARATIONS
4669
+ ],
4670
+ imports: [SharedModule]
4671
+ }]
4672
+ }] });
4515
4673
 
4516
4674
  const UPLOAD_DECLARATIONS = [
4517
4675
  UploadComponent,
@@ -4521,18 +4679,26 @@ const UPLOAD_DECLARATIONS = [
4521
4679
  /**
4522
4680
  * Represents the [NgModule](https://angular.io/api/core/NgModule) definition for the Upload component.
4523
4681
  */
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);
4682
+ class UploadModule {
4683
+ }
4684
+ UploadModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4685
+ UploadModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadModule, declarations: [UploadComponent,
4686
+ UploadActionButtonsComponent,
4687
+ UploadStatusTotalComponent], imports: [SharedModule], exports: [FileTemplateDirective, FileInfoTemplateDirective, CustomMessagesComponent, UploadDropZoneDirective, UploadDropZoneComponent, UploadComponent,
4688
+ UploadActionButtonsComponent,
4689
+ UploadStatusTotalComponent] });
4690
+ UploadModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadModule, imports: [[SharedModule]] });
4691
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadModule, decorators: [{
4692
+ type: NgModule,
4693
+ args: [{
4694
+ declarations: [UPLOAD_DECLARATIONS],
4695
+ exports: [
4696
+ PUBLIC_DIRECTIVES,
4697
+ UPLOAD_DECLARATIONS
4698
+ ],
4699
+ imports: [SharedModule]
4700
+ }]
4701
+ }] });
4536
4702
 
4537
4703
  /**
4538
4704
  * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
@@ -4559,19 +4725,26 @@ UploadModule = __decorate([
4559
4725
  *
4560
4726
  * ```
4561
4727
  */
4562
- let UploadsModule = class UploadsModule {
4563
- };
4564
- UploadsModule = __decorate([
4565
- NgModule({
4566
- exports: [
4567
- FileSelectModule,
4568
- UploadModule
4569
- ]
4570
- })
4571
- ], UploadsModule);
4728
+ class UploadsModule {
4729
+ }
4730
+ UploadsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4731
+ UploadsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadsModule, exports: [FileSelectModule,
4732
+ UploadModule] });
4733
+ UploadsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadsModule, imports: [FileSelectModule,
4734
+ UploadModule] });
4735
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: UploadsModule, decorators: [{
4736
+ type: NgModule,
4737
+ args: [{
4738
+ exports: [
4739
+ FileSelectModule,
4740
+ UploadModule
4741
+ ]
4742
+ }]
4743
+ }] });
4572
4744
 
4573
4745
  /**
4574
4746
  * Generated bundle index. Do not edit.
4575
4747
  */
4576
4748
 
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 };
4749
+ 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 };
4750
+