@progress/kendo-angular-upload 21.4.1 → 22.0.0

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 (67) hide show
  1. package/common/base.d.ts +1 -1
  2. package/dropzone-base.d.ts +1 -1
  3. package/fesm2022/progress-kendo-angular-upload.mjs +89 -89
  4. package/localization/messages.d.ts +1 -1
  5. package/package.json +13 -21
  6. package/rendering/file-list-item-base.d.ts +1 -1
  7. package/schematics/ngAdd/index.js +3 -3
  8. package/esm2022/common/action-buttons-layout.mjs +0 -5
  9. package/esm2022/common/base.mjs +0 -280
  10. package/esm2022/common/fileselect-settings.mjs +0 -5
  11. package/esm2022/common/util.mjs +0 -253
  12. package/esm2022/common/validation-util.mjs +0 -60
  13. package/esm2022/directives.mjs +0 -89
  14. package/esm2022/dropzone-base.mjs +0 -69
  15. package/esm2022/dropzone-external.directive.mjs +0 -111
  16. package/esm2022/dropzone-internal.directive.mjs +0 -109
  17. package/esm2022/dropzone.component.mjs +0 -169
  18. package/esm2022/dropzone.service.mjs +0 -37
  19. package/esm2022/events/cancel-event.mjs +0 -35
  20. package/esm2022/events/clear-event.mjs +0 -29
  21. package/esm2022/events/error-event.mjs +0 -48
  22. package/esm2022/events/pause-event.mjs +0 -38
  23. package/esm2022/events/preventable-event.mjs +0 -25
  24. package/esm2022/events/remove-event.mjs +0 -49
  25. package/esm2022/events/resume-event.mjs +0 -38
  26. package/esm2022/events/select-event.mjs +0 -37
  27. package/esm2022/events/success-event.mjs +0 -49
  28. package/esm2022/events/upload-event.mjs +0 -49
  29. package/esm2022/events/upload-progress-event.mjs +0 -41
  30. package/esm2022/events.mjs +0 -14
  31. package/esm2022/file-select.directive.mjs +0 -136
  32. package/esm2022/fileselect.component.mjs +0 -452
  33. package/esm2022/fileselect.module.mjs +0 -41
  34. package/esm2022/index.mjs +0 -31
  35. package/esm2022/localization/custom-messages.component.mjs +0 -70
  36. package/esm2022/localization/localized-messages.directive.mjs +0 -43
  37. package/esm2022/localization/messages.mjs +0 -185
  38. package/esm2022/navigation.service.mjs +0 -151
  39. package/esm2022/package-metadata.mjs +0 -16
  40. package/esm2022/progress-kendo-angular-upload.mjs +0 -8
  41. package/esm2022/rendering/file-list-item-action-button.component.mjs +0 -230
  42. package/esm2022/rendering/file-list-item-base.mjs +0 -52
  43. package/esm2022/rendering/file-list-item.mjs +0 -115
  44. package/esm2022/rendering/file-list-multiple-items.component.mjs +0 -201
  45. package/esm2022/rendering/file-list-single-item.component.mjs +0 -181
  46. package/esm2022/rendering/file-list.component.mjs +0 -189
  47. package/esm2022/rendering/upload-action-buttons.component.mjs +0 -126
  48. package/esm2022/rendering/upload-status-total.component.mjs +0 -97
  49. package/esm2022/templates/file-info-template.directive.mjs +0 -39
  50. package/esm2022/templates/file-template.directive.mjs +0 -39
  51. package/esm2022/types/async-settings.mjs +0 -5
  52. package/esm2022/types/chunk-info.mjs +0 -5
  53. package/esm2022/types/chunk-map.mjs +0 -35
  54. package/esm2022/types/chunk-metadata.mjs +0 -5
  55. package/esm2022/types/chunk-settings.mjs +0 -5
  56. package/esm2022/types/direction.mjs +0 -5
  57. package/esm2022/types/file-groups.mjs +0 -60
  58. package/esm2022/types/file-info.mjs +0 -5
  59. package/esm2022/types/file-map.mjs +0 -144
  60. package/esm2022/types/file-restrictions.mjs +0 -5
  61. package/esm2022/types/file-state.mjs +0 -34
  62. package/esm2022/types/operation-type.mjs +0 -5
  63. package/esm2022/types.mjs +0 -6
  64. package/esm2022/upload.component.mjs +0 -901
  65. package/esm2022/upload.module.mjs +0 -43
  66. package/esm2022/upload.service.mjs +0 -431
  67. package/esm2022/uploads.module.mjs +0 -66
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@progress/kendo-angular-upload",
3
- "version": "21.4.1",
3
+ "version": "22.0.0",
4
4
  "description": "Kendo UI Angular Upload Component",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "Progress",
@@ -15,31 +15,25 @@
15
15
  "Progress"
16
16
  ],
17
17
  "@progress": {
18
- "friendlyName": "Upload",
19
- "package": {
20
- "productName": "Kendo UI for Angular",
21
- "productCode": "KENDOUIANGULAR",
22
- "publishDate": 1768393077,
23
- "licensingDocsUrl": "https://www.telerik.com/kendo-angular-ui/my-license/"
24
- }
18
+ "friendlyName": "Upload"
25
19
  },
26
20
  "peerDependencies": {
27
- "@angular/animations": "18 - 21",
28
- "@angular/common": "18 - 21",
29
- "@angular/core": "18 - 21",
30
- "@angular/forms": "18 - 21",
31
- "@angular/platform-browser": "18 - 21",
21
+ "@angular/animations": "19 - 21",
22
+ "@angular/common": "19 - 21",
23
+ "@angular/core": "19 - 21",
24
+ "@angular/forms": "19 - 21",
25
+ "@angular/platform-browser": "19 - 21",
32
26
  "@progress/kendo-licensing": "^1.7.0",
33
- "@progress/kendo-angular-common": "21.4.1",
34
- "@progress/kendo-angular-l10n": "21.4.1",
35
- "@progress/kendo-angular-icons": "21.4.1",
36
- "@progress/kendo-angular-buttons": "21.4.1",
37
- "@progress/kendo-angular-progressbar": "21.4.1",
27
+ "@progress/kendo-angular-common": "22.0.0",
28
+ "@progress/kendo-angular-l10n": "22.0.0",
29
+ "@progress/kendo-angular-icons": "22.0.0",
30
+ "@progress/kendo-angular-buttons": "22.0.0",
31
+ "@progress/kendo-angular-progressbar": "22.0.0",
38
32
  "rxjs": "^6.5.3 || ^7.0.0"
39
33
  },
40
34
  "dependencies": {
41
35
  "tslib": "^2.3.1",
42
- "@progress/kendo-angular-schematics": "21.4.1"
36
+ "@progress/kendo-angular-schematics": "22.0.0"
43
37
  },
44
38
  "schematics": "./schematics/collection.json",
45
39
  "module": "fesm2022/progress-kendo-angular-upload.mjs",
@@ -50,8 +44,6 @@
50
44
  },
51
45
  ".": {
52
46
  "types": "./index.d.ts",
53
- "esm2022": "./esm2022/progress-kendo-angular-upload.mjs",
54
- "esm": "./esm2022/progress-kendo-angular-upload.mjs",
55
47
  "default": "./fesm2022/progress-kendo-angular-upload.mjs"
56
48
  }
57
49
  },
@@ -26,5 +26,5 @@ export declare class FileListItemBase implements OnDestroy {
26
26
  getTotalFilesSizeMessage(files: Array<FileInfo>): string;
27
27
  textFor(key: string): string;
28
28
  static ɵfac: i0.ɵɵFactoryDeclaration<FileListItemBase, never>;
29
- static ɵcmp: i0.ɵɵComponentDeclaration<FileListItemBase, "ng-component", never, {}, {}, never, never, false, never>;
29
+ static ɵcmp: i0.ɵɵComponentDeclaration<FileListItemBase, "ng-component", never, {}, {}, never, never, true, never>;
30
30
  }
@@ -15,9 +15,9 @@ function default_1(options) {
15
15
  ], peerDependencies: {
16
16
  // peer dep of the icons
17
17
  '@progress/kendo-svg-icons': '^4.0.0',
18
- '@progress/kendo-angular-buttons': '21.4.1',
19
- '@progress/kendo-angular-progressbar': '21.4.1',
20
- '@progress/kendo-angular-popup': '21.4.1',
18
+ '@progress/kendo-angular-buttons': '22.0.0',
19
+ '@progress/kendo-angular-progressbar': '22.0.0',
20
+ '@progress/kendo-angular-popup': '22.0.0',
21
21
  } });
22
22
  return (0, schematics_1.externalSchematic)('@progress/kendo-angular-schematics', 'ng-add', finalOptions);
23
23
  }
@@ -1,5 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- export {};
@@ -1,280 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- import { ChangeDetectorRef, ContentChild, Directive, ElementRef, EventEmitter, HostBinding, Injector, Input, NgZone, Output, ViewChild } from "@angular/core";
6
- import { guid, isControlRequired } from "@progress/kendo-angular-common";
7
- import { FileTemplateDirective } from "../templates/file-template.directive";
8
- import { FileInfoTemplateDirective } from "../templates/file-info-template.directive";
9
- import { UploadService } from "../upload.service";
10
- import { NgControl } from "@angular/forms";
11
- import { NavigationService } from "../navigation.service";
12
- import * as i0 from "@angular/core";
13
- import * as i1 from "../upload.service";
14
- import * as i2 from "../navigation.service";
15
- /**
16
- * @hidden
17
- */
18
- export class UploadFileSelectBase {
19
- uploadService;
20
- navigation;
21
- cdr;
22
- injector;
23
- zone;
24
- /**
25
- * @hidden
26
- */
27
- fileTemplate;
28
- /**
29
- * @hidden
30
- */
31
- fileInfoTemplate;
32
- /**
33
- * @hidden
34
- */
35
- fileSelectButton;
36
- /**
37
- * Sets the `accept` attribute of the internal `input` element of the component.
38
- */
39
- accept;
40
- /**
41
- * Disables the component.
42
- *
43
- * @default false
44
- */
45
- disabled = false;
46
- /**
47
- * Allows you to select multiple files.
48
- * When you set this to `false`, you can select only one file at a time.
49
- *
50
- * @default true
51
- */
52
- multiple = true;
53
- /**
54
- * Controls the visibility of the file list.
55
- *
56
- * @default true
57
- */
58
- showFileList = true;
59
- /**
60
- * Sets the [`tabindex`](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of the component.
61
- *
62
- * @default 0
63
- */
64
- tabindex = 0;
65
- /**
66
- * Sets the restrictions for selected files.
67
- */
68
- set restrictions(restrictions) {
69
- const parsedRestrictions = Object.assign({}, this.restrictions, restrictions);
70
- this._restrictions = parsedRestrictions;
71
- }
72
- get restrictions() {
73
- return this._restrictions;
74
- }
75
- /**
76
- * Sets the `id` of the external drop zone that you want to associate with the component.
77
- *
78
- */
79
- zoneId;
80
- /**
81
- * @hidden
82
- */
83
- focusableId = `k-${guid()}`;
84
- /**
85
- * @hidden
86
- */
87
- hostDefaultClasses = true;
88
- /**
89
- * @hidden
90
- */
91
- get hostDisabledClass() {
92
- return this.disabled;
93
- }
94
- /**
95
- * Fires when you navigate outside the component.
96
- */
97
- onBlur = new EventEmitter();
98
- /**
99
- * Fires when you focus the component.
100
- */
101
- onFocus = new EventEmitter();
102
- /**
103
- * Fires when you select files. If you prevent this event, the component will not add the selected files to the list.
104
- */
105
- select = new EventEmitter();
106
- /**
107
- * Fires when you are about to remove a file. If you prevent this event, the file will remain in the list.
108
- */
109
- remove = new EventEmitter();
110
- /**
111
- * @hidden
112
- */
113
- _restrictions = {
114
- allowedExtensions: [],
115
- maxFileSize: 0,
116
- minFileSize: 0
117
- };
118
- /**
119
- * @hidden
120
- */
121
- fileList;
122
- constructor(uploadService, navigation, cdr, injector, zone) {
123
- this.uploadService = uploadService;
124
- this.navigation = navigation;
125
- this.cdr = cdr;
126
- this.injector = injector;
127
- this.zone = zone;
128
- this.fileList = this.uploadService.files;
129
- }
130
- /**
131
- * @hidden
132
- */
133
- get formControl() {
134
- const ngControl = this.injector.get(NgControl, null);
135
- return ngControl?.control || null;
136
- }
137
- /**
138
- * @hidden
139
- */
140
- get isControlRequired() {
141
- return isControlRequired(this.formControl);
142
- }
143
- /**
144
- * @hidden
145
- */
146
- get hasFileList() {
147
- const hasFileList = this.showFileList && this.fileList.count > 0;
148
- this.navigation.fileListVisible = hasFileList;
149
- return hasFileList;
150
- }
151
- /**
152
- * @hidden
153
- */
154
- writeValue(newValue, validation, callback) {
155
- let isValid = true;
156
- if (newValue instanceof Array) {
157
- newValue.forEach((file) => {
158
- if (!validation(file)) {
159
- isValid = false;
160
- }
161
- });
162
- if (isValid) {
163
- this.uploadService[callback](newValue);
164
- }
165
- }
166
- if (newValue === null) {
167
- this.fileList.clear();
168
- }
169
- this.cdr.markForCheck();
170
- }
171
- onTouchedCallback = (_) => { };
172
- onChangeCallback = (_) => { };
173
- /**
174
- * @hidden
175
- */
176
- registerOnChange(fn) {
177
- this.onChangeCallback = fn;
178
- }
179
- /**
180
- * @hidden
181
- */
182
- registerOnTouched(fn) {
183
- this.onTouchedCallback = fn;
184
- }
185
- /**
186
- * @hidden
187
- */
188
- setDisabledState(isDisabled) {
189
- this.disabled = isDisabled;
190
- }
191
- /**
192
- * @hidden
193
- */
194
- onFileSelectButtonFocus() {
195
- if (!this.navigation.focused) {
196
- this.navigation.focusedIndex = -1;
197
- }
198
- }
199
- /**
200
- * Focuses the component's **Select files** button.
201
- */
202
- focus() {
203
- this.zone.runOutsideAngular(() => {
204
- setTimeout(() => {
205
- this.fileSelectButton.nativeElement.focus();
206
- this.navigation.focused = true;
207
- });
208
- });
209
- }
210
- /**
211
- * @hidden
212
- * @deprecated
213
- */
214
- focusComponent() {
215
- this.focus();
216
- }
217
- /**
218
- * Blurs the component if you previously focused it.
219
- */
220
- blur() {
221
- if (this.navigation.focused) {
222
- this.navigation.focused = false;
223
- document.activeElement.blur();
224
- }
225
- }
226
- /**
227
- * @hidden
228
- * @deprecated
229
- */
230
- blurComponent() {
231
- this.blur();
232
- }
233
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UploadFileSelectBase, deps: [{ token: i1.UploadService }, { token: i2.NavigationService }, { token: i0.ChangeDetectorRef }, { token: i0.Injector }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
234
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: UploadFileSelectBase, inputs: { accept: "accept", disabled: "disabled", multiple: "multiple", showFileList: "showFileList", tabindex: "tabindex", restrictions: "restrictions", zoneId: "zoneId", focusableId: "focusableId" }, outputs: { onBlur: "blur", onFocus: "focus", select: "select", remove: "remove" }, host: { properties: { "class.k-upload": "this.hostDefaultClasses", "class.k-disabled": "this.hostDisabledClass" } }, queries: [{ propertyName: "fileTemplate", first: true, predicate: FileTemplateDirective, descendants: true }, { propertyName: "fileInfoTemplate", first: true, predicate: FileInfoTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "fileSelectButton", first: true, predicate: ["fileSelectButton"], descendants: true, read: ElementRef, static: true }], ngImport: i0 });
235
- }
236
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: UploadFileSelectBase, decorators: [{
237
- type: Directive,
238
- args: [{}]
239
- }], ctorParameters: () => [{ type: i1.UploadService }, { type: i2.NavigationService }, { type: i0.ChangeDetectorRef }, { type: i0.Injector }, { type: i0.NgZone }], propDecorators: { fileTemplate: [{
240
- type: ContentChild,
241
- args: [FileTemplateDirective]
242
- }], fileInfoTemplate: [{
243
- type: ContentChild,
244
- args: [FileInfoTemplateDirective]
245
- }], fileSelectButton: [{
246
- type: ViewChild,
247
- args: ['fileSelectButton', { static: true, read: ElementRef }]
248
- }], accept: [{
249
- type: Input
250
- }], disabled: [{
251
- type: Input
252
- }], multiple: [{
253
- type: Input
254
- }], showFileList: [{
255
- type: Input
256
- }], tabindex: [{
257
- type: Input
258
- }], restrictions: [{
259
- type: Input
260
- }], zoneId: [{
261
- type: Input
262
- }], focusableId: [{
263
- type: Input
264
- }], hostDefaultClasses: [{
265
- type: HostBinding,
266
- args: ['class.k-upload']
267
- }], hostDisabledClass: [{
268
- type: HostBinding,
269
- args: ['class.k-disabled']
270
- }], onBlur: [{
271
- type: Output,
272
- args: ['blur']
273
- }], onFocus: [{
274
- type: Output,
275
- args: ['focus']
276
- }], select: [{
277
- type: Output
278
- }], remove: [{
279
- type: Output
280
- }] } });
@@ -1,5 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- export {};
@@ -1,253 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /* eslint-disable no-bitwise */
6
- import { FileState } from '../types';
7
- import { guid, isDocumentAvailable } from '@progress/kendo-angular-common';
8
- import { fileGroupMap, fileSVGGroupMap } from '../types/file-groups';
9
- import { fileIcon } from '@progress/kendo-svg-icons';
10
- /**
11
- * Calculates the total size of the files in KB or MB.
12
- */
13
- export const getTotalFilesSizeMessage = (files) => {
14
- let totalSize = 0;
15
- let i;
16
- if (typeof files[0].size === "number") {
17
- for (i = 0; i < files.length; i++) {
18
- if (files[i].size) {
19
- totalSize += files[i].size;
20
- }
21
- }
22
- }
23
- else {
24
- return "";
25
- }
26
- totalSize /= 1024;
27
- if (totalSize < 1024) {
28
- return totalSize.toFixed(2) + " KB";
29
- }
30
- else {
31
- return (totalSize / 1024).toFixed(2) + " MB";
32
- }
33
- };
34
- const stripPath = (name) => {
35
- const slashIndex = name.lastIndexOf("\\");
36
- return (slashIndex !== -1) ? name.substr(slashIndex + 1) : name;
37
- };
38
- const getFileExtension = (fileName) => {
39
- const rFileExtension = /\.([^\.]+)$/;
40
- const matches = fileName.match(rFileExtension);
41
- return matches ? matches[0] : "";
42
- };
43
- /**
44
- * @hidden
45
- */
46
- export const validateInitialFileInfo = (file) => {
47
- if (file instanceof Object && file.hasOwnProperty("name")) {
48
- return true;
49
- }
50
- return false;
51
- };
52
- /**
53
- * @hidden
54
- */
55
- export const validateInitialFileSelectFile = (file) => {
56
- if (file instanceof File || validateInitialFileInfo(file)) {
57
- return true;
58
- }
59
- return false;
60
- };
61
- /**
62
- * @hidden
63
- */
64
- export const getInitialFileInfo = (fakeFile) => {
65
- fakeFile.extension = fakeFile.extension || getFileExtension(fakeFile.name);
66
- fakeFile.name = fakeFile.name; // eslint-disable-line no-self-assign
67
- fakeFile.size = fakeFile.size || 0;
68
- if (!fakeFile.hasOwnProperty("state")) {
69
- fakeFile.state = FileState.Initial;
70
- }
71
- if (!fakeFile.hasOwnProperty("uid")) {
72
- fakeFile.uid = guid();
73
- }
74
- return fakeFile;
75
- };
76
- /**
77
- * @hidden
78
- */
79
- export const convertFileToFileInfo = (file) => {
80
- const fileInfo = getFileInfo(file);
81
- fileInfo.uid = guid();
82
- // Used to differentiate initial FileInfo objects and actual Files
83
- fileInfo.state = FileState.Selected;
84
- return fileInfo;
85
- };
86
- const getFileInfo = (rawFile) => {
87
- const fileName = rawFile.name;
88
- const fileSize = rawFile.size;
89
- return {
90
- extension: getFileExtension(fileName),
91
- name: fileName,
92
- rawFile: rawFile,
93
- size: fileSize,
94
- state: FileState.Selected
95
- };
96
- };
97
- /**
98
- * @hidden
99
- */
100
- export const getAllFileInfo = (rawFiles) => {
101
- const allFileInfo = new Array();
102
- let i;
103
- for (i = 0; i < rawFiles.length; i++) {
104
- allFileInfo.push(getFileInfo(rawFiles[i]));
105
- }
106
- return allFileInfo;
107
- };
108
- /**
109
- * @hidden
110
- */
111
- export const fileHasValidationErrors = (file) => {
112
- if (file.validationErrors && file.validationErrors.length > 0) {
113
- return true;
114
- }
115
- return false;
116
- };
117
- /**
118
- * @hidden
119
- */
120
- export const filesHaveValidationErrors = (files) => {
121
- for (const file of files) {
122
- if (fileHasValidationErrors(file)) {
123
- return true;
124
- }
125
- }
126
- return false;
127
- };
128
- /**
129
- * @hidden
130
- */
131
- export const inputFiles = (input) => {
132
- if (input.files) {
133
- return getAllFileInfo(input.files);
134
- }
135
- else {
136
- //Required for testing
137
- const fileNames = input.value.split("|").map((file, index) => {
138
- const fileName = file.trim();
139
- return {
140
- extension: getFileExtension(fileName),
141
- name: stripPath(fileName),
142
- rawFile: null,
143
- size: (index + 1) * 1000,
144
- state: FileState.Selected
145
- };
146
- });
147
- return fileNames;
148
- }
149
- };
150
- /**
151
- * @hidden
152
- */
153
- export const assignGuidToFiles = (files, isUnique) => {
154
- const uid = guid();
155
- return files.map((file) => {
156
- file.uid = isUnique ? guid() : uid;
157
- return file;
158
- });
159
- };
160
- /**
161
- * @hidden
162
- */
163
- export const supportsFormData = () => {
164
- return typeof (FormData) !== "undefined";
165
- };
166
- /**
167
- * @hidden
168
- */
169
- export const userAgent = () => {
170
- return navigator.userAgent;
171
- };
172
- const focusableRegex = /^(?:a|input|select|textarea|button|object)$/i;
173
- /**
174
- * @hidden
175
- */
176
- export const IGNORE_TARGET_CLASSES = 'k-icon k-select k-input k-multiselect-wrap';
177
- /**
178
- * @hidden
179
- */
180
- export const UPLOAD_CLASSES = 'k-upload-button k-clear-selected k-upload-selected k-upload-action k-file';
181
- const isVisible = (element) => {
182
- if (!isDocumentAvailable()) {
183
- return false;
184
- }
185
- const rect = element.getBoundingClientRect();
186
- return !!(rect.width && rect.height) && window.getComputedStyle(element).visibility !== 'hidden';
187
- };
188
- const toClassList = (classNames) => String(classNames).trim().split(' ');
189
- /**
190
- * @hidden
191
- */
192
- export const hasClasses = (element, classNames) => {
193
- const namesList = toClassList(classNames);
194
- return Boolean(toClassList(element.className).find((className) => namesList.indexOf(className) >= 0));
195
- };
196
- /**
197
- * @hidden
198
- */
199
- export const isFocusable = (element, checkVisibility = true) => {
200
- if (element.tagName) {
201
- const tagName = element.tagName.toLowerCase();
202
- const tabIndex = element.getAttribute('tabIndex');
203
- const validTabIndex = tabIndex !== null && !isNaN(tabIndex) && tabIndex > -1;
204
- let focusable = false;
205
- if (focusableRegex.test(tagName)) {
206
- focusable = !element.disabled;
207
- }
208
- else {
209
- focusable = validTabIndex;
210
- }
211
- return focusable && (!checkVisibility || isVisible(element));
212
- }
213
- return false;
214
- };
215
- /**
216
- * @hidden
217
- */
218
- export const getFileGroupCssClass = (fileExtension) => {
219
- const initial = 'file';
220
- for (const group in fileGroupMap) {
221
- if (fileGroupMap[group].indexOf(fileExtension) >= 0) {
222
- if (group === 'discImage') {
223
- return `${initial}-disc-image`;
224
- }
225
- return `${initial}-${group}`;
226
- }
227
- }
228
- return initial;
229
- };
230
- /**
231
- * @hidden
232
- */
233
- export const isPresent = (value) => value !== null && value !== undefined;
234
- /**
235
- * Matches the file extension with the corresponding SVG icon.
236
- * @returns The SVG icon that corresponds to the file extension.
237
- */
238
- export const fileSVGGroupIcon = (extension) => {
239
- const initial = fileIcon;
240
- if (extension) {
241
- for (const group in fileGroupMap) {
242
- if (fileGroupMap[group].indexOf(extension.toLowerCase()) >= 0) {
243
- return fileSVGGroupMap[group];
244
- }
245
- }
246
- }
247
- return initial;
248
- };
249
- /**
250
- * Matches the file extension with the corresponding CSS class.
251
- * @returns The CSS class name that corresponds to the file extension.
252
- */
253
- export const fileGroupClass = (extension) => getFileGroupCssClass(extension || '');
@@ -1,60 +0,0 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2026 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the project root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- /**
6
- * @hidden
7
- */
8
- export const INVALIDMAXFILESIZE = "invalidMaxFileSize";
9
- /**
10
- * @hidden
11
- */
12
- export const INVALIDMINFILESIZE = "invalidMinFileSize";
13
- /**
14
- * @hidden
15
- */
16
- export const INVALIDFILEEXTENSION = "invalidFileExtension";
17
- const validateFileExtension = (file, allowedExtensions) => {
18
- if (allowedExtensions.length > 0) {
19
- if (allowedExtensions.indexOf(file.extension.toLowerCase()) < 0) {
20
- file.validationErrors = file.validationErrors || [];
21
- if (file.validationErrors.indexOf(INVALIDFILEEXTENSION) < 0) {
22
- file.validationErrors.push(INVALIDFILEEXTENSION);
23
- }
24
- }
25
- }
26
- };
27
- const validateFileSize = (file, minFileSize, maxFileSize) => {
28
- if (minFileSize !== 0 && file.size < minFileSize) {
29
- file.validationErrors = file.validationErrors || [];
30
- if (file.validationErrors.indexOf(INVALIDMINFILESIZE) < 0) {
31
- file.validationErrors.push(INVALIDMINFILESIZE);
32
- }
33
- }
34
- if (maxFileSize !== 0 && file.size > maxFileSize) {
35
- file.validationErrors = file.validationErrors || [];
36
- if (file.validationErrors.indexOf(INVALIDMAXFILESIZE) < 0) {
37
- file.validationErrors.push(INVALIDMAXFILESIZE);
38
- }
39
- }
40
- };
41
- const parseAllowedExtensions = (extensions) => {
42
- const allowedExtensions = extensions.map((ext) => {
43
- const parsedExt = (ext.substring(0, 1) === ".") ? ext : ("." + ext);
44
- return parsedExt.toLowerCase();
45
- });
46
- return allowedExtensions;
47
- };
48
- /**
49
- * @hidden
50
- */
51
- export const validateFiles = (files, restrictionInfo) => {
52
- const allowedExtensions = parseAllowedExtensions(restrictionInfo.allowedExtensions);
53
- const maxFileSize = restrictionInfo.maxFileSize;
54
- const minFileSize = restrictionInfo.minFileSize;
55
- let i;
56
- for (i = 0; i < files.length; i++) {
57
- validateFileExtension(files[i], allowedExtensions);
58
- validateFileSize(files[i], minFileSize, maxFileSize);
59
- }
60
- };