@progress/kendo-angular-upload 8.0.0-dev.202201111351 → 9.0.0-next.202202241540

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 (268) hide show
  1. package/LICENSE.md +1 -1
  2. package/NOTICE.txt +119 -79
  3. package/README.md +1 -1
  4. package/bundles/kendo-angular-upload.umd.js +5 -0
  5. package/{dist/es2015/common → common}/action-buttons-layout.d.ts +0 -0
  6. package/{dist/es2015/common → common}/util.d.ts +0 -0
  7. package/{dist/es2015/common → common}/validation-util.d.ts +0 -0
  8. package/{dist/es2015/dropzone-base.d.ts → dropzone-base.d.ts} +4 -1
  9. package/{dist/es2015/dropzone-external.directive.d.ts → dropzone-external.directive.d.ts} +4 -1
  10. package/{dist/es2015/dropzone-internal.directive.d.ts → dropzone-internal.directive.d.ts} +3 -0
  11. package/{dist/es2015/dropzone.component.d.ts → dropzone.component.d.ts} +5 -2
  12. package/{dist/es2015/dropzone.service.d.ts → dropzone.service.d.ts} +3 -0
  13. package/{dist/es2015 → esm2015}/common/action-buttons-layout.js +1 -0
  14. package/{dist/es2015 → esm2015}/common/util.js +1 -7
  15. package/{dist/es2015 → esm2015}/common/validation-util.js +0 -4
  16. package/{dist/es2015 → esm2015}/dropzone-base.js +18 -16
  17. package/{dist/es2015 → esm2015}/dropzone-external.directive.js +29 -35
  18. package/{dist/es2015 → esm2015}/dropzone-internal.directive.js +25 -37
  19. package/esm2015/dropzone.component.js +113 -0
  20. package/{dist/es2015 → esm2015}/dropzone.service.js +8 -7
  21. package/{dist/es2015 → esm2015}/events/cancel-event.js +0 -0
  22. package/{dist/es2015 → esm2015}/events/clear-event.js +0 -0
  23. package/{dist/es2015 → esm2015}/events/error-event.js +0 -0
  24. package/{dist/es2015 → esm2015}/events/pause-event.js +0 -0
  25. package/{dist/es2015 → esm2015}/events/preventable-event.js +0 -0
  26. package/{dist/es2015 → esm2015}/events/remove-event.js +0 -0
  27. package/{dist/es2015 → esm2015}/events/resume-event.js +0 -0
  28. package/{dist/es2015 → esm2015}/events/select-event.js +0 -0
  29. package/{dist/es2015 → esm2015}/events/success-event.js +0 -0
  30. package/{dist/es2015 → esm2015}/events/upload-event.js +0 -0
  31. package/{dist/es2015 → esm2015}/events/upload-progress-event.js +0 -0
  32. package/{dist/es → esm2015}/events.js +0 -0
  33. package/esm2015/file-select.directive.js +100 -0
  34. package/{dist/es2015 → esm2015}/fileselect.component.js +160 -132
  35. package/esm2015/fileselect.module.js +35 -0
  36. package/{dist/es/types/chunk-info.js → esm2015/kendo-angular-upload.js} +4 -0
  37. package/esm2015/localization/custom-messages.component.js +50 -0
  38. package/esm2015/localization/localized-messages.directive.js +40 -0
  39. package/esm2015/localization/messages.js +59 -0
  40. package/{dist/es → esm2015}/main.js +0 -0
  41. package/{dist/es2015 → esm2015}/navigation.service.js +9 -9
  42. package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
  43. package/{dist/es2015 → esm2015}/rendering/file-list-item-action-button.component.js +70 -28
  44. package/{dist/es2015 → esm2015}/rendering/file-list-item-base.js +9 -0
  45. package/esm2015/rendering/file-list-item.js +107 -0
  46. package/esm2015/rendering/file-list-multiple-items.component.js +172 -0
  47. package/esm2015/rendering/file-list-single-item.component.js +154 -0
  48. package/esm2015/rendering/file-list.component.js +145 -0
  49. package/esm2015/rendering/upload-action-buttons.component.js +136 -0
  50. package/esm2015/rendering/upload-status-total.component.js +60 -0
  51. package/{dist/es2015 → esm2015}/shared.module.js +45 -18
  52. package/esm2015/templates/file-info-template.directive.js +22 -0
  53. package/esm2015/templates/file-template.directive.js +22 -0
  54. package/esm2015/templates/template-context.directive.js +33 -0
  55. package/{dist/es2015 → esm2015}/types/async-settings.js +1 -0
  56. package/{dist/es2015 → esm2015}/types/chunk-info.js +1 -0
  57. package/{dist/es2015 → esm2015}/types/chunk-map.js +0 -0
  58. package/{dist/es → esm2015}/types/chunk-metadata.js +1 -0
  59. package/{dist/es → esm2015}/types/chunk-settings.js +1 -0
  60. package/{dist/es → esm2015}/types/direction.js +1 -0
  61. package/{dist/es2015 → esm2015}/types/file-groups.js +3 -5
  62. package/{dist/es → esm2015}/types/file-info.js +1 -0
  63. package/{dist/es2015 → esm2015}/types/file-map.js +0 -0
  64. package/{dist/es → esm2015}/types/file-restrictions.js +1 -0
  65. package/{dist/es → esm2015}/types/file-state.js +0 -0
  66. package/{dist/es → esm2015}/types/operation-type.js +1 -0
  67. package/{dist/es → esm2015}/types.js +0 -0
  68. package/{dist/es2015 → esm2015}/upload.component.js +263 -243
  69. package/esm2015/upload.module.js +43 -0
  70. package/{dist/es2015 → esm2015}/upload.service.js +10 -9
  71. package/{dist/es2015 → esm2015}/uploads.module.js +17 -12
  72. package/{dist/es2015/events → events}/cancel-event.d.ts +0 -0
  73. package/{dist/es2015/events → events}/clear-event.d.ts +0 -0
  74. package/{dist/es2015/events → events}/error-event.d.ts +0 -0
  75. package/{dist/es2015/events → events}/pause-event.d.ts +0 -0
  76. package/{dist/es2015/events → events}/preventable-event.d.ts +0 -0
  77. package/{dist/es2015/events → events}/remove-event.d.ts +0 -0
  78. package/{dist/es2015/events → events}/resume-event.d.ts +0 -0
  79. package/{dist/es2015/events → events}/select-event.d.ts +0 -0
  80. package/{dist/es2015/events → events}/success-event.d.ts +0 -0
  81. package/{dist/es2015/events → events}/upload-event.d.ts +0 -0
  82. package/{dist/es2015/events → events}/upload-progress-event.d.ts +0 -0
  83. package/{dist/es2015/events.d.ts → events.d.ts} +0 -0
  84. package/{dist/fesm2015/index.js → fesm2015/kendo-angular-upload.js} +2184 -2011
  85. package/{dist/es2015/file-select.directive.d.ts → file-select.directive.d.ts} +7 -4
  86. package/{dist/es2015/fileselect.component.d.ts → fileselect.component.d.ts} +14 -6
  87. package/fileselect.module.d.ts +20 -0
  88. package/{dist/es/common/action-buttons-layout.js → kendo-angular-upload.d.ts} +5 -0
  89. package/{dist/es2015/localization → localization}/custom-messages.component.d.ts +4 -1
  90. package/{dist/es2015/localization → localization}/localized-messages.directive.d.ts +3 -0
  91. package/{dist/es2015/localization → localization}/messages.d.ts +3 -0
  92. package/{dist/es2015/main.d.ts → main.d.ts} +0 -0
  93. package/{dist/es2015/navigation.service.d.ts → navigation.service.d.ts} +7 -3
  94. package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
  95. package/package.json +35 -103
  96. package/{dist/es2015/rendering → rendering}/file-list-item-action-button.component.d.ts +11 -8
  97. package/{dist/es2015/rendering → rendering}/file-list-item-base.d.ts +3 -0
  98. package/{dist/es2015/rendering → rendering}/file-list-item.d.ts +10 -7
  99. package/{dist/es2015/rendering → rendering}/file-list-multiple-items.component.d.ts +7 -4
  100. package/{dist/es2015/rendering → rendering}/file-list-single-item.component.d.ts +9 -6
  101. package/{dist/es2015/rendering → rendering}/file-list.component.d.ts +3 -0
  102. package/{dist/es2015/rendering → rendering}/upload-action-buttons.component.d.ts +7 -4
  103. package/{dist/es2015/rendering → rendering}/upload-status-total.component.d.ts +3 -0
  104. package/schematics/ngAdd/index.js +5 -2
  105. package/schematics/ngAdd/index.js.map +1 -1
  106. package/shared.module.d.ts +36 -0
  107. package/{dist/es2015/templates → templates}/file-info-template.directive.d.ts +3 -0
  108. package/{dist/es2015/templates → templates}/file-template.directive.d.ts +3 -0
  109. package/{dist/es2015/templates → templates}/template-context.directive.d.ts +4 -1
  110. package/{dist/es2015/types → types}/async-settings.d.ts +0 -0
  111. package/{dist/es2015/types → types}/chunk-info.d.ts +0 -0
  112. package/{dist/es2015/types → types}/chunk-map.d.ts +0 -0
  113. package/{dist/es2015/types → types}/chunk-metadata.d.ts +0 -0
  114. package/{dist/es2015/types → types}/chunk-settings.d.ts +0 -0
  115. package/{dist/es2015/types → types}/direction.d.ts +0 -0
  116. package/{dist/es2015/types → types}/file-groups.d.ts +0 -0
  117. package/{dist/es2015/types → types}/file-info.d.ts +0 -0
  118. package/{dist/es2015/types → types}/file-map.d.ts +5 -5
  119. package/{dist/es2015/types → types}/file-restrictions.d.ts +0 -0
  120. package/{dist/es2015/types → types}/file-state.d.ts +0 -0
  121. package/{dist/es2015/types → types}/operation-type.d.ts +0 -0
  122. package/{dist/es2015/types.d.ts → types.d.ts} +0 -0
  123. package/{dist/es2015/upload.component.d.ts → upload.component.d.ts} +42 -21
  124. package/upload.module.d.ts +22 -0
  125. package/{dist/es2015/upload.service.d.ts → upload.service.d.ts} +4 -1
  126. package/{dist/es2015/uploads.module.d.ts → uploads.module.d.ts} +6 -0
  127. package/dist/cdn/js/kendo-angular-upload.js +0 -20
  128. package/dist/cdn/main.js +0 -5
  129. package/dist/es/common/util.js +0 -234
  130. package/dist/es/common/validation-util.js +0 -64
  131. package/dist/es/dropzone-base.js +0 -66
  132. package/dist/es/dropzone-external.directive.js +0 -98
  133. package/dist/es/dropzone-internal.directive.js +0 -110
  134. package/dist/es/dropzone.component.js +0 -99
  135. package/dist/es/dropzone.service.js +0 -33
  136. package/dist/es/events/cancel-event.js +0 -41
  137. package/dist/es/events/clear-event.js +0 -43
  138. package/dist/es/events/error-event.js +0 -45
  139. package/dist/es/events/pause-event.js +0 -42
  140. package/dist/es/events/preventable-event.js +0 -29
  141. package/dist/es/events/remove-event.js +0 -47
  142. package/dist/es/events/resume-event.js +0 -42
  143. package/dist/es/events/select-event.js +0 -45
  144. package/dist/es/events/success-event.js +0 -49
  145. package/dist/es/events/upload-event.js +0 -47
  146. package/dist/es/events/upload-progress-event.js +0 -42
  147. package/dist/es/file-select.directive.js +0 -141
  148. package/dist/es/fileselect.component.js +0 -484
  149. package/dist/es/fileselect.module.js +0 -30
  150. package/dist/es/index.js +0 -21
  151. package/dist/es/localization/custom-messages.component.js +0 -53
  152. package/dist/es/localization/localized-messages.directive.js +0 -35
  153. package/dist/es/localization/messages.js +0 -102
  154. package/dist/es/navigation.service.js +0 -166
  155. package/dist/es/package-metadata.js +0 -15
  156. package/dist/es/rendering/file-list-item-action-button.component.js +0 -169
  157. package/dist/es/rendering/file-list-item-base.js +0 -41
  158. package/dist/es/rendering/file-list-item.js +0 -165
  159. package/dist/es/rendering/file-list-multiple-items.component.js +0 -107
  160. package/dist/es/rendering/file-list-single-item.component.js +0 -112
  161. package/dist/es/rendering/file-list.component.js +0 -98
  162. package/dist/es/rendering/upload-action-buttons.component.js +0 -149
  163. package/dist/es/rendering/upload-status-total.component.js +0 -42
  164. package/dist/es/shared.module.js +0 -68
  165. package/dist/es/templates/file-info-template.directive.js +0 -22
  166. package/dist/es/templates/file-template.directive.js +0 -22
  167. package/dist/es/templates/template-context.directive.js +0 -40
  168. package/dist/es/types/async-settings.js +0 -4
  169. package/dist/es/types/chunk-map.js +0 -36
  170. package/dist/es/types/file-groups.js +0 -45
  171. package/dist/es/types/file-map.js +0 -170
  172. package/dist/es/upload.component.js +0 -967
  173. package/dist/es/upload.module.js +0 -34
  174. package/dist/es/upload.service.js +0 -448
  175. package/dist/es/uploads.module.js +0 -47
  176. package/dist/es2015/dropzone.component.js +0 -100
  177. package/dist/es2015/events.js +0 -14
  178. package/dist/es2015/file-select.directive.js +0 -123
  179. package/dist/es2015/fileselect.module.d.ts +0 -9
  180. package/dist/es2015/fileselect.module.js +0 -27
  181. package/dist/es2015/index.d.ts +0 -21
  182. package/dist/es2015/index.js +0 -21
  183. package/dist/es2015/index.metadata.json +0 -1
  184. package/dist/es2015/localization/custom-messages.component.js +0 -45
  185. package/dist/es2015/localization/localized-messages.directive.js +0 -35
  186. package/dist/es2015/localization/messages.js +0 -96
  187. package/dist/es2015/main.js +0 -24
  188. package/dist/es2015/rendering/file-list-item.js +0 -136
  189. package/dist/es2015/rendering/file-list-multiple-items.component.js +0 -128
  190. package/dist/es2015/rendering/file-list-single-item.component.js +0 -117
  191. package/dist/es2015/rendering/file-list.component.js +0 -123
  192. package/dist/es2015/rendering/upload-action-buttons.component.js +0 -141
  193. package/dist/es2015/rendering/upload-status-total.component.js +0 -51
  194. package/dist/es2015/shared.module.d.ts +0 -17
  195. package/dist/es2015/templates/file-info-template.directive.js +0 -21
  196. package/dist/es2015/templates/file-template.directive.js +0 -21
  197. package/dist/es2015/templates/template-context.directive.js +0 -35
  198. package/dist/es2015/types/chunk-metadata.js +0 -4
  199. package/dist/es2015/types/chunk-settings.js +0 -4
  200. package/dist/es2015/types/direction.js +0 -4
  201. package/dist/es2015/types/file-info.js +0 -4
  202. package/dist/es2015/types/file-restrictions.js +0 -4
  203. package/dist/es2015/types/file-state.js +0 -34
  204. package/dist/es2015/types/operation-type.js +0 -4
  205. package/dist/es2015/types.js +0 -5
  206. package/dist/es2015/upload.module.d.ts +0 -9
  207. package/dist/es2015/upload.module.js +0 -31
  208. package/dist/fesm5/index.js +0 -4653
  209. package/dist/npm/common/action-buttons-layout.js +0 -6
  210. package/dist/npm/common/util.js +0 -240
  211. package/dist/npm/common/validation-util.js +0 -68
  212. package/dist/npm/dropzone-base.js +0 -68
  213. package/dist/npm/dropzone-external.directive.js +0 -100
  214. package/dist/npm/dropzone-internal.directive.js +0 -112
  215. package/dist/npm/dropzone.component.js +0 -101
  216. package/dist/npm/dropzone.service.js +0 -35
  217. package/dist/npm/events/cancel-event.js +0 -43
  218. package/dist/npm/events/clear-event.js +0 -45
  219. package/dist/npm/events/error-event.js +0 -47
  220. package/dist/npm/events/pause-event.js +0 -44
  221. package/dist/npm/events/preventable-event.js +0 -31
  222. package/dist/npm/events/remove-event.js +0 -49
  223. package/dist/npm/events/resume-event.js +0 -44
  224. package/dist/npm/events/select-event.js +0 -47
  225. package/dist/npm/events/success-event.js +0 -51
  226. package/dist/npm/events/upload-event.js +0 -49
  227. package/dist/npm/events/upload-progress-event.js +0 -44
  228. package/dist/npm/events.js +0 -26
  229. package/dist/npm/file-select.directive.js +0 -143
  230. package/dist/npm/fileselect.component.js +0 -486
  231. package/dist/npm/fileselect.module.js +0 -32
  232. package/dist/npm/index.js +0 -39
  233. package/dist/npm/localization/custom-messages.component.js +0 -55
  234. package/dist/npm/localization/localized-messages.directive.js +0 -37
  235. package/dist/npm/localization/messages.js +0 -104
  236. package/dist/npm/main.js +0 -45
  237. package/dist/npm/navigation.service.js +0 -168
  238. package/dist/npm/package-metadata.js +0 -17
  239. package/dist/npm/rendering/file-list-item-action-button.component.js +0 -171
  240. package/dist/npm/rendering/file-list-item-base.js +0 -43
  241. package/dist/npm/rendering/file-list-item.js +0 -167
  242. package/dist/npm/rendering/file-list-multiple-items.component.js +0 -109
  243. package/dist/npm/rendering/file-list-single-item.component.js +0 -114
  244. package/dist/npm/rendering/file-list.component.js +0 -100
  245. package/dist/npm/rendering/upload-action-buttons.component.js +0 -151
  246. package/dist/npm/rendering/upload-status-total.component.js +0 -44
  247. package/dist/npm/shared.module.js +0 -70
  248. package/dist/npm/templates/file-info-template.directive.js +0 -24
  249. package/dist/npm/templates/file-template.directive.js +0 -24
  250. package/dist/npm/templates/template-context.directive.js +0 -42
  251. package/dist/npm/types/async-settings.js +0 -6
  252. package/dist/npm/types/chunk-info.js +0 -6
  253. package/dist/npm/types/chunk-map.js +0 -38
  254. package/dist/npm/types/chunk-metadata.js +0 -6
  255. package/dist/npm/types/chunk-settings.js +0 -6
  256. package/dist/npm/types/direction.js +0 -6
  257. package/dist/npm/types/file-groups.js +0 -47
  258. package/dist/npm/types/file-info.js +0 -6
  259. package/dist/npm/types/file-map.js +0 -172
  260. package/dist/npm/types/file-restrictions.js +0 -6
  261. package/dist/npm/types/file-state.js +0 -36
  262. package/dist/npm/types/operation-type.js +0 -6
  263. package/dist/npm/types.js +0 -8
  264. package/dist/npm/upload.component.js +0 -969
  265. package/dist/npm/upload.module.js +0 -36
  266. package/dist/npm/upload.service.js +0 -450
  267. package/dist/npm/uploads.module.js +0 -49
  268. package/dist/systemjs/kendo-angular-upload.js +0 -5
@@ -1,6 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,240 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- /* tslint:disable: no-bitwise */
8
- var types_1 = require("../types");
9
- var kendo_angular_common_1 = require("@progress/kendo-angular-common");
10
- var file_groups_1 = require("../types/file-groups");
11
- /**
12
- * @hidden
13
- */
14
- exports.getTotalFilesSizeMessage = function (files) {
15
- var totalSize = 0;
16
- var i;
17
- if (typeof files[0].size === "number") {
18
- for (i = 0; i < files.length; i++) {
19
- if (files[i].size) {
20
- totalSize += files[i].size;
21
- }
22
- }
23
- }
24
- else {
25
- return "";
26
- }
27
- totalSize /= 1024;
28
- if (totalSize < 1024) {
29
- return totalSize.toFixed(2) + " KB";
30
- }
31
- else {
32
- return (totalSize / 1024).toFixed(2) + " MB";
33
- }
34
- };
35
- var stripPath = function (name) {
36
- var slashIndex = name.lastIndexOf("\\");
37
- return (slashIndex !== -1) ? name.substr(slashIndex + 1) : name;
38
- };
39
- var ɵ0 = stripPath;
40
- exports.ɵ0 = ɵ0;
41
- var getFileExtension = function (fileName) {
42
- var rFileExtension = /\.([^\.]+)$/;
43
- var matches = fileName.match(rFileExtension);
44
- return matches ? matches[0] : "";
45
- };
46
- var ɵ1 = getFileExtension;
47
- exports.ɵ1 = ɵ1;
48
- /**
49
- * @hidden
50
- */
51
- exports.validateInitialFileInfo = function (file) {
52
- if (file instanceof Object && file.hasOwnProperty("name")) {
53
- return true;
54
- }
55
- return false;
56
- };
57
- /**
58
- * @hidden
59
- */
60
- exports.validateInitialFileSelectFile = function (file) {
61
- if (file instanceof File || exports.validateInitialFileInfo(file)) {
62
- return true;
63
- }
64
- return false;
65
- };
66
- /**
67
- * @hidden
68
- */
69
- exports.getInitialFileInfo = function (fakeFile) {
70
- fakeFile.extension = fakeFile.extension || getFileExtension(fakeFile.name);
71
- fakeFile.name = fakeFile.name;
72
- fakeFile.size = fakeFile.size || 0;
73
- if (!fakeFile.hasOwnProperty("state")) {
74
- fakeFile.state = types_1.FileState.Initial;
75
- }
76
- if (!fakeFile.hasOwnProperty("uid")) {
77
- fakeFile.uid = kendo_angular_common_1.guid();
78
- }
79
- return fakeFile;
80
- };
81
- /**
82
- * @hidden
83
- */
84
- exports.convertFileToFileInfo = function (file) {
85
- var fileInfo = getFileInfo(file);
86
- fileInfo.uid = kendo_angular_common_1.guid();
87
- // Used to differentiate initial FileInfo objects and actual Files
88
- fileInfo.state = types_1.FileState.Selected;
89
- return fileInfo;
90
- };
91
- var getFileInfo = function (rawFile) {
92
- var fileName = rawFile.name;
93
- var fileSize = rawFile.size;
94
- return {
95
- extension: getFileExtension(fileName),
96
- name: fileName,
97
- rawFile: rawFile,
98
- size: fileSize,
99
- state: types_1.FileState.Selected
100
- };
101
- };
102
- var ɵ2 = getFileInfo;
103
- exports.ɵ2 = ɵ2;
104
- /**
105
- * @hidden
106
- */
107
- exports.getAllFileInfo = function (rawFiles) {
108
- var allFileInfo = new Array();
109
- var i;
110
- for (i = 0; i < rawFiles.length; i++) {
111
- allFileInfo.push(getFileInfo(rawFiles[i]));
112
- }
113
- return allFileInfo;
114
- };
115
- /**
116
- * @hidden
117
- */
118
- exports.fileHasValidationErrors = function (file) {
119
- if (file.validationErrors && file.validationErrors.length > 0) {
120
- return true;
121
- }
122
- return false;
123
- };
124
- /**
125
- * @hidden
126
- */
127
- exports.filesHaveValidationErrors = function (files) {
128
- for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
129
- var file = files_1[_i];
130
- if (exports.fileHasValidationErrors(file)) {
131
- return true;
132
- }
133
- }
134
- return false;
135
- };
136
- /**
137
- * @hidden
138
- */
139
- exports.inputFiles = function (input) {
140
- if (input.files) {
141
- return exports.getAllFileInfo(input.files);
142
- }
143
- else {
144
- //Required for testing
145
- var fileNames = input.value.split("|").map(function (file, index) {
146
- var fileName = file.trim();
147
- return {
148
- extension: getFileExtension(fileName),
149
- name: stripPath(fileName),
150
- rawFile: null,
151
- size: (index + 1) * 1000,
152
- state: types_1.FileState.Selected
153
- };
154
- });
155
- return fileNames;
156
- }
157
- };
158
- /**
159
- * @hidden
160
- */
161
- exports.assignGuidToFiles = function (files, isUnique) {
162
- var uid = kendo_angular_common_1.guid();
163
- return files.map(function (file) {
164
- file.uid = isUnique ? kendo_angular_common_1.guid() : uid;
165
- return file;
166
- });
167
- };
168
- /**
169
- * @hidden
170
- */
171
- exports.supportsFormData = function () {
172
- return typeof (FormData) !== "undefined";
173
- };
174
- /**
175
- * @hidden
176
- */
177
- exports.userAgent = function () {
178
- return navigator.userAgent;
179
- };
180
- var focusableRegex = /^(?:a|input|select|textarea|button|object)$/i;
181
- /**
182
- * @hidden
183
- */
184
- exports.IGNORE_TARGET_CLASSES = 'k-icon k-select k-input k-multiselect-wrap';
185
- /**
186
- * @hidden
187
- */
188
- exports.UPLOAD_CLASSES = 'k-upload-button k-clear-selected k-upload-selected k-upload-action';
189
- var isVisible = function (element) {
190
- var rect = element.getBoundingClientRect();
191
- return !!(rect.width && rect.height) && window.getComputedStyle(element).visibility !== 'hidden';
192
- };
193
- var ɵ3 = isVisible;
194
- exports.ɵ3 = ɵ3;
195
- var toClassList = function (classNames) { return String(classNames).trim().split(' '); };
196
- var ɵ4 = toClassList;
197
- exports.ɵ4 = ɵ4;
198
- /**
199
- * @hidden
200
- */
201
- exports.hasClasses = function (element, classNames) {
202
- var namesList = toClassList(classNames);
203
- return Boolean(toClassList(element.className).find(function (className) { return namesList.indexOf(className) >= 0; }));
204
- };
205
- /**
206
- * @hidden
207
- */
208
- exports.isFocusable = function (element, checkVisibility) {
209
- if (checkVisibility === void 0) { checkVisibility = true; }
210
- if (element.tagName) {
211
- var tagName = element.tagName.toLowerCase();
212
- var tabIndex = element.getAttribute('tabIndex');
213
- var validTabIndex = tabIndex !== null && !isNaN(tabIndex) && tabIndex > -1;
214
- var focusable = false;
215
- if (focusableRegex.test(tagName)) {
216
- focusable = !element.disabled;
217
- }
218
- else {
219
- focusable = validTabIndex;
220
- }
221
- return focusable && (!checkVisibility || isVisible(element));
222
- }
223
- return false;
224
- };
225
- /**
226
- * @hidden
227
- */
228
- exports.getFileGroupCssClass = function (fileExtension) {
229
- var initial = 'k-i-file';
230
- for (var group in file_groups_1.fileGroupMap) {
231
- if (file_groups_1.fileGroupMap[group].indexOf(fileExtension) >= 0) {
232
- return initial + "-" + group;
233
- }
234
- }
235
- return initial;
236
- };
237
- /**
238
- * @hidden
239
- */
240
- exports.isPresent = function (value) { return value !== null && value !== undefined; };
@@ -1,68 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- /**
8
- * @hidden
9
- */
10
- exports.INVALIDMAXFILESIZE = "invalidMaxFileSize";
11
- /**
12
- * @hidden
13
- */
14
- exports.INVALIDMINFILESIZE = "invalidMinFileSize";
15
- /**
16
- * @hidden
17
- */
18
- exports.INVALIDFILEEXTENSION = "invalidFileExtension";
19
- var validateFileExtension = function (file, allowedExtensions) {
20
- if (allowedExtensions.length > 0) {
21
- if (allowedExtensions.indexOf(file.extension.toLowerCase()) < 0) {
22
- file.validationErrors = file.validationErrors || [];
23
- if (file.validationErrors.indexOf(exports.INVALIDFILEEXTENSION) < 0) {
24
- file.validationErrors.push(exports.INVALIDFILEEXTENSION);
25
- }
26
- }
27
- }
28
- };
29
- var ɵ0 = validateFileExtension;
30
- exports.ɵ0 = ɵ0;
31
- var validateFileSize = function (file, minFileSize, maxFileSize) {
32
- if (minFileSize !== 0 && file.size < minFileSize) {
33
- file.validationErrors = file.validationErrors || [];
34
- if (file.validationErrors.indexOf(exports.INVALIDMINFILESIZE) < 0) {
35
- file.validationErrors.push(exports.INVALIDMINFILESIZE);
36
- }
37
- }
38
- if (maxFileSize !== 0 && file.size > maxFileSize) {
39
- file.validationErrors = file.validationErrors || [];
40
- if (file.validationErrors.indexOf(exports.INVALIDMAXFILESIZE) < 0) {
41
- file.validationErrors.push(exports.INVALIDMAXFILESIZE);
42
- }
43
- }
44
- };
45
- var ɵ1 = validateFileSize;
46
- exports.ɵ1 = ɵ1;
47
- var parseAllowedExtensions = function (extensions) {
48
- var allowedExtensions = extensions.map(function (ext) {
49
- var parsedExt = (ext.substring(0, 1) === ".") ? ext : ("." + ext);
50
- return parsedExt.toLowerCase();
51
- });
52
- return allowedExtensions;
53
- };
54
- var ɵ2 = parseAllowedExtensions;
55
- exports.ɵ2 = ɵ2;
56
- /**
57
- * @hidden
58
- */
59
- exports.validateFiles = function (files, restrictionInfo) {
60
- var allowedExtensions = parseAllowedExtensions(restrictionInfo.allowedExtensions);
61
- var maxFileSize = restrictionInfo.maxFileSize;
62
- var minFileSize = restrictionInfo.minFileSize;
63
- var i;
64
- for (i = 0; i < files.length; i++) {
65
- validateFileExtension(files[i], allowedExtensions);
66
- validateFileSize(files[i], minFileSize, maxFileSize);
67
- }
68
- };
@@ -1,68 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- var tslib_1 = require("tslib");
8
- var core_1 = require("@angular/core");
9
- /**
10
- * @hidden
11
- */
12
- var DropZoneBase = /** @class */ (function () {
13
- function DropZoneBase(element, renderer, hoverClass) {
14
- this.element = element;
15
- this.renderer = renderer;
16
- this.hideIntervalElement = null;
17
- this.hoverClass = hoverClass;
18
- }
19
- /**
20
- * @hidden
21
- */
22
- DropZoneBase.prototype.onElementDragEnterListener = function () {
23
- var _this = this;
24
- this.addClass(this.hoverClass);
25
- this.lastDragElement = new Date();
26
- if (!this.hideIntervalElement) {
27
- this.hideIntervalElement = setInterval(function () {
28
- if (_this.calculateTimeDiff(_this.lastDragElement) < 100) {
29
- return;
30
- }
31
- _this.removeClass(_this.hoverClass);
32
- clearInterval(_this.hideIntervalElement);
33
- _this.hideIntervalElement = null;
34
- }, 100);
35
- }
36
- return false;
37
- };
38
- /**
39
- * @hidden
40
- */
41
- DropZoneBase.prototype.onElementDragOverListener = function () {
42
- this.lastDragElement = new Date();
43
- return false;
44
- };
45
- DropZoneBase.prototype.calculateTimeDiff = function (prevEvent) {
46
- return new Date().getTime() - prevEvent.getTime();
47
- };
48
- DropZoneBase.prototype.addClass = function (className) {
49
- this.renderer.addClass(this.element.nativeElement, className);
50
- };
51
- DropZoneBase.prototype.removeClass = function (className) {
52
- this.renderer.removeClass(this.element.nativeElement, className);
53
- };
54
- tslib_1.__decorate([
55
- core_1.HostListener('dragenter'),
56
- tslib_1.__metadata("design:type", Function),
57
- tslib_1.__metadata("design:paramtypes", []),
58
- tslib_1.__metadata("design:returntype", Boolean)
59
- ], DropZoneBase.prototype, "onElementDragEnterListener", null);
60
- tslib_1.__decorate([
61
- core_1.HostListener('dragover'),
62
- tslib_1.__metadata("design:type", Function),
63
- tslib_1.__metadata("design:paramtypes", []),
64
- tslib_1.__metadata("design:returntype", Boolean)
65
- ], DropZoneBase.prototype, "onElementDragOverListener", null);
66
- return DropZoneBase;
67
- }());
68
- exports.DropZoneBase = DropZoneBase;
@@ -1,100 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- var tslib_1 = require("tslib");
8
- var core_1 = require("@angular/core");
9
- var util_1 = require("./common/util");
10
- var validation_util_1 = require("./common/validation-util");
11
- var dropzone_service_1 = require("./dropzone.service");
12
- var upload_component_1 = require("./upload.component");
13
- var UploadDropZoneDirective = /** @class */ (function () {
14
- function UploadDropZoneDirective(dropZoneService) {
15
- this.dropZoneService = dropZoneService;
16
- }
17
- /**
18
- * @hidden
19
- */
20
- UploadDropZoneDirective.prototype.onElementDragEnter = function () {
21
- return false;
22
- };
23
- /**
24
- * @hidden
25
- */
26
- UploadDropZoneDirective.prototype.onElementDragOver = function () {
27
- return false;
28
- };
29
- /**
30
- * @hidden
31
- */
32
- UploadDropZoneDirective.prototype.onDropListener = function (event) {
33
- var components = this.componentInstance;
34
- if (!util_1.isPresent(components)) {
35
- return;
36
- }
37
- components.forEach(function (component) {
38
- var droppedFiles = event.dataTransfer.files;
39
- if (droppedFiles.length > 0 && !component.disabled) {
40
- var files = util_1.getAllFileInfo(droppedFiles);
41
- if (component instanceof upload_component_1.UploadComponent) {
42
- files = util_1.assignGuidToFiles(files, !component.batch);
43
- }
44
- else {
45
- files = util_1.assignGuidToFiles(files, true);
46
- }
47
- if (!component.multiple) {
48
- files.splice(1, files.length - 1);
49
- component.clearFiles();
50
- }
51
- validation_util_1.validateFiles(files, component.restrictions);
52
- component.addFiles(files);
53
- }
54
- });
55
- return false;
56
- };
57
- Object.defineProperty(UploadDropZoneDirective.prototype, "componentInstance", {
58
- /**
59
- * @hidden
60
- */
61
- get: function () {
62
- return this.dropZoneService.getComponents(this.zoneId);
63
- },
64
- enumerable: true,
65
- configurable: true
66
- });
67
- tslib_1.__decorate([
68
- core_1.Input('kendoUploadDropZone'),
69
- tslib_1.__metadata("design:type", String)
70
- ], UploadDropZoneDirective.prototype, "zoneId", void 0);
71
- tslib_1.__decorate([
72
- core_1.HostListener('dragenter'),
73
- tslib_1.__metadata("design:type", Function),
74
- tslib_1.__metadata("design:paramtypes", []),
75
- tslib_1.__metadata("design:returntype", Boolean)
76
- ], UploadDropZoneDirective.prototype, "onElementDragEnter", null);
77
- tslib_1.__decorate([
78
- core_1.HostListener('dragover'),
79
- tslib_1.__metadata("design:type", Function),
80
- tslib_1.__metadata("design:paramtypes", []),
81
- tslib_1.__metadata("design:returntype", Boolean)
82
- ], UploadDropZoneDirective.prototype, "onElementDragOver", null);
83
- tslib_1.__decorate([
84
- core_1.HostListener('drop', ['$event']),
85
- tslib_1.__metadata("design:type", Function),
86
- tslib_1.__metadata("design:paramtypes", [Object]),
87
- tslib_1.__metadata("design:returntype", Boolean)
88
- ], UploadDropZoneDirective.prototype, "onDropListener", null);
89
- UploadDropZoneDirective = tslib_1.__decorate([
90
- core_1.Directive({
91
- providers: [
92
- dropzone_service_1.DropZoneService
93
- ],
94
- selector: '[kendoUploadDropZone], [kendoFileSelectDropZone]'
95
- }),
96
- tslib_1.__metadata("design:paramtypes", [dropzone_service_1.DropZoneService])
97
- ], UploadDropZoneDirective);
98
- return UploadDropZoneDirective;
99
- }());
100
- exports.UploadDropZoneDirective = UploadDropZoneDirective;
@@ -1,112 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- "use strict";
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- var tslib_1 = require("tslib");
8
- var core_1 = require("@angular/core");
9
- var util_1 = require("./common/util");
10
- var validation_util_1 = require("./common/validation-util");
11
- var dropzone_base_1 = require("./dropzone-base");
12
- var upload_service_1 = require("./upload.service");
13
- /**
14
- * @hidden
15
- */
16
- var DropZoneInternalDirective = /** @class */ (function (_super) {
17
- tslib_1.__extends(DropZoneInternalDirective, _super);
18
- function DropZoneInternalDirective(element, renderer, ngZone, uploadService) {
19
- var _this = _super.call(this, element, renderer, 'k-dropzone-hover') || this;
20
- _this.ngZone = ngZone;
21
- _this.uploadService = uploadService;
22
- _this.initialClassName = true;
23
- _this.hideIntervalDocument = null;
24
- _this.activeClass = 'k-dropzone-active';
25
- _this.ngZone.runOutsideAngular(function () {
26
- _this.unsubscribeDocumentDragEnter = _this.renderer.listen('document', 'dragenter', function () { return _this.onDocumentDragEnter(); });
27
- _this.unsubscribeDocumentDragOver = _this.renderer.listen('document', 'dragover', function () { return _this.onDocumentDragOver(); });
28
- });
29
- return _this;
30
- }
31
- DropZoneInternalDirective.prototype.ngOnDestroy = function () {
32
- var _this = this;
33
- this.ngZone.runOutsideAngular(function () {
34
- if (_this.unsubscribeDocumentDragEnter) {
35
- _this.unsubscribeDocumentDragEnter();
36
- }
37
- if (_this.unsubscribeDocumentDragOver) {
38
- _this.unsubscribeDocumentDragOver();
39
- }
40
- });
41
- };
42
- DropZoneInternalDirective.prototype.onDocumentDragEnter = function () {
43
- var _this = this;
44
- this.addClass(this.activeClass);
45
- this.lastDragDocument = new Date();
46
- if (!this.hideIntervalDocument) {
47
- this.hideIntervalDocument = setInterval(function () {
48
- if (_this.calculateTimeDiff(_this.lastDragDocument) < 100) {
49
- return;
50
- }
51
- _this.removeClass(_this.activeClass);
52
- clearInterval(_this.hideIntervalDocument);
53
- _this.hideIntervalDocument = null;
54
- }, 100);
55
- }
56
- return false;
57
- };
58
- /**
59
- * @hidden
60
- */
61
- DropZoneInternalDirective.prototype.onDocumentDragOver = function () {
62
- this.lastDragDocument = new Date();
63
- return false;
64
- };
65
- DropZoneInternalDirective.prototype.onDropListener = function (event) {
66
- var droppedFiles = event.dataTransfer.files;
67
- if (droppedFiles.length > 0 && !this.disabled) {
68
- var files = util_1.getAllFileInfo(droppedFiles);
69
- files = util_1.assignGuidToFiles(files, !this.uploadService.async.batch);
70
- if (!this.multiple) {
71
- files.splice(1, files.length - 1);
72
- this.uploadService.clearFiles();
73
- }
74
- validation_util_1.validateFiles(files, this.restrictions);
75
- this.uploadService.addFiles(files);
76
- }
77
- return false;
78
- };
79
- tslib_1.__decorate([
80
- core_1.Input(),
81
- tslib_1.__metadata("design:type", Boolean)
82
- ], DropZoneInternalDirective.prototype, "disabled", void 0);
83
- tslib_1.__decorate([
84
- core_1.Input(),
85
- tslib_1.__metadata("design:type", Boolean)
86
- ], DropZoneInternalDirective.prototype, "multiple", void 0);
87
- tslib_1.__decorate([
88
- core_1.Input(),
89
- tslib_1.__metadata("design:type", Object)
90
- ], DropZoneInternalDirective.prototype, "restrictions", void 0);
91
- tslib_1.__decorate([
92
- core_1.HostBinding('class.k-dropzone'),
93
- tslib_1.__metadata("design:type", Boolean)
94
- ], DropZoneInternalDirective.prototype, "initialClassName", void 0);
95
- tslib_1.__decorate([
96
- core_1.HostListener('drop', ['$event']),
97
- tslib_1.__metadata("design:type", Function),
98
- tslib_1.__metadata("design:paramtypes", [Object]),
99
- tslib_1.__metadata("design:returntype", Boolean)
100
- ], DropZoneInternalDirective.prototype, "onDropListener", null);
101
- DropZoneInternalDirective = tslib_1.__decorate([
102
- core_1.Directive({
103
- selector: "\n [kendoUploadInternalDropZone],\n [kendoFileSelectInternalDropZone]\n "
104
- }),
105
- tslib_1.__metadata("design:paramtypes", [core_1.ElementRef,
106
- core_1.Renderer2,
107
- core_1.NgZone,
108
- upload_service_1.UploadService])
109
- ], DropZoneInternalDirective);
110
- return DropZoneInternalDirective;
111
- }(dropzone_base_1.DropZoneBase));
112
- exports.DropZoneInternalDirective = DropZoneInternalDirective;