@progress/kendo-angular-upload 21.4.1-develop.1 → 22.0.0-develop.1
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.
- package/common/base.d.ts +1 -1
- package/dropzone-base.d.ts +1 -1
- package/fesm2022/progress-kendo-angular-upload.mjs +89 -89
- package/localization/messages.d.ts +1 -1
- package/package.json +13 -21
- package/rendering/file-list-item-base.d.ts +1 -1
- package/schematics/ngAdd/index.js +3 -3
- package/esm2022/common/action-buttons-layout.mjs +0 -5
- package/esm2022/common/base.mjs +0 -280
- package/esm2022/common/fileselect-settings.mjs +0 -5
- package/esm2022/common/util.mjs +0 -253
- package/esm2022/common/validation-util.mjs +0 -60
- package/esm2022/directives.mjs +0 -89
- package/esm2022/dropzone-base.mjs +0 -69
- package/esm2022/dropzone-external.directive.mjs +0 -111
- package/esm2022/dropzone-internal.directive.mjs +0 -109
- package/esm2022/dropzone.component.mjs +0 -169
- package/esm2022/dropzone.service.mjs +0 -37
- package/esm2022/events/cancel-event.mjs +0 -35
- package/esm2022/events/clear-event.mjs +0 -29
- package/esm2022/events/error-event.mjs +0 -48
- package/esm2022/events/pause-event.mjs +0 -38
- package/esm2022/events/preventable-event.mjs +0 -25
- package/esm2022/events/remove-event.mjs +0 -49
- package/esm2022/events/resume-event.mjs +0 -38
- package/esm2022/events/select-event.mjs +0 -37
- package/esm2022/events/success-event.mjs +0 -49
- package/esm2022/events/upload-event.mjs +0 -49
- package/esm2022/events/upload-progress-event.mjs +0 -41
- package/esm2022/events.mjs +0 -14
- package/esm2022/file-select.directive.mjs +0 -136
- package/esm2022/fileselect.component.mjs +0 -452
- package/esm2022/fileselect.module.mjs +0 -41
- package/esm2022/index.mjs +0 -31
- package/esm2022/localization/custom-messages.component.mjs +0 -70
- package/esm2022/localization/localized-messages.directive.mjs +0 -43
- package/esm2022/localization/messages.mjs +0 -185
- package/esm2022/navigation.service.mjs +0 -151
- package/esm2022/package-metadata.mjs +0 -16
- package/esm2022/progress-kendo-angular-upload.mjs +0 -8
- package/esm2022/rendering/file-list-item-action-button.component.mjs +0 -230
- package/esm2022/rendering/file-list-item-base.mjs +0 -52
- package/esm2022/rendering/file-list-item.mjs +0 -115
- package/esm2022/rendering/file-list-multiple-items.component.mjs +0 -201
- package/esm2022/rendering/file-list-single-item.component.mjs +0 -181
- package/esm2022/rendering/file-list.component.mjs +0 -189
- package/esm2022/rendering/upload-action-buttons.component.mjs +0 -126
- package/esm2022/rendering/upload-status-total.component.mjs +0 -97
- package/esm2022/templates/file-info-template.directive.mjs +0 -39
- package/esm2022/templates/file-template.directive.mjs +0 -39
- package/esm2022/types/async-settings.mjs +0 -5
- package/esm2022/types/chunk-info.mjs +0 -5
- package/esm2022/types/chunk-map.mjs +0 -35
- package/esm2022/types/chunk-metadata.mjs +0 -5
- package/esm2022/types/chunk-settings.mjs +0 -5
- package/esm2022/types/direction.mjs +0 -5
- package/esm2022/types/file-groups.mjs +0 -60
- package/esm2022/types/file-info.mjs +0 -5
- package/esm2022/types/file-map.mjs +0 -144
- package/esm2022/types/file-restrictions.mjs +0 -5
- package/esm2022/types/file-state.mjs +0 -34
- package/esm2022/types/operation-type.mjs +0 -5
- package/esm2022/types.mjs +0 -6
- package/esm2022/upload.component.mjs +0 -901
- package/esm2022/upload.module.mjs +0 -43
- package/esm2022/upload.service.mjs +0 -431
- package/esm2022/uploads.module.mjs +0 -66
|
@@ -1,48 +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
|
-
* Arguments for the `error` event. The `error` event fires when
|
|
7
|
-
* an `upload` or `remove` operation fails.
|
|
8
|
-
*
|
|
9
|
-
* ```typescript
|
|
10
|
-
* @Component({
|
|
11
|
-
* template: `
|
|
12
|
-
* <kendo-upload (error)="errorEventHandler($event)"></kendo-upload>
|
|
13
|
-
* `
|
|
14
|
-
* })
|
|
15
|
-
* export class UploadComponent {
|
|
16
|
-
* public errorEventHandler(e: ErrorEvent) {
|
|
17
|
-
* console.log('An error occurred');
|
|
18
|
-
* }
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export class ErrorEvent {
|
|
23
|
-
/**
|
|
24
|
-
* The array of files that failed to be uploaded or removed.
|
|
25
|
-
*/
|
|
26
|
-
files;
|
|
27
|
-
/**
|
|
28
|
-
* The operation type that failed (`upload` or `remove`).
|
|
29
|
-
*/
|
|
30
|
-
operation;
|
|
31
|
-
/**
|
|
32
|
-
* The HTTP response returned by the server containing error details.
|
|
33
|
-
*/
|
|
34
|
-
response;
|
|
35
|
-
/**
|
|
36
|
-
* @hidden
|
|
37
|
-
* Constructs the event arguments for the `error` event.
|
|
38
|
-
*
|
|
39
|
-
* @param files - The list of the files that failed to be uploaded or removed.
|
|
40
|
-
* @param operation - The operation type (`upload` or `remove`).
|
|
41
|
-
* @param response - The response object returned by the server.
|
|
42
|
-
*/
|
|
43
|
-
constructor(files, operation, response) {
|
|
44
|
-
this.files = files;
|
|
45
|
-
this.operation = operation;
|
|
46
|
-
this.response = response;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,38 +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
|
-
* Arguments for the `pause` event. The `pause` event fires when
|
|
7
|
-
* you pause a file that is currently uploading.
|
|
8
|
-
*
|
|
9
|
-
* ```typescript
|
|
10
|
-
* @Component({
|
|
11
|
-
* template: `
|
|
12
|
-
* <kendo-upload
|
|
13
|
-
* [chunkable]="true"
|
|
14
|
-
* (pause)="pauseEventHandler($event)">
|
|
15
|
-
* </kendo-upload>
|
|
16
|
-
* `
|
|
17
|
-
* })
|
|
18
|
-
* export class UploadComponent {
|
|
19
|
-
* public pauseEventHandler(ev: PauseEvent) {
|
|
20
|
-
* console.log('File paused');
|
|
21
|
-
* }
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export class PauseEvent {
|
|
26
|
-
/**
|
|
27
|
-
* The file that you paused during the upload process.
|
|
28
|
-
*/
|
|
29
|
-
file;
|
|
30
|
-
/**
|
|
31
|
-
* @hidden
|
|
32
|
-
* Constructs the event arguments for the `pause` event.
|
|
33
|
-
* @param file - The file that is going to be paused.
|
|
34
|
-
*/
|
|
35
|
-
constructor(file) {
|
|
36
|
-
this.file = file;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,25 +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 class PreventableEvent {
|
|
9
|
-
prevented = false;
|
|
10
|
-
/**
|
|
11
|
-
* Prevents the default action for a specified event.
|
|
12
|
-
* In this way, the source component suppresses the built-in behavior that follows the event.
|
|
13
|
-
*/
|
|
14
|
-
preventDefault() {
|
|
15
|
-
this.prevented = true;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* If the event is prevented by any of its subscribers, returns `true`.
|
|
19
|
-
*
|
|
20
|
-
* @returns `true` if the default action was prevented. Otherwise, returns `false`.
|
|
21
|
-
*/
|
|
22
|
-
isDefaultPrevented() {
|
|
23
|
-
return this.prevented;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,49 +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 { PreventableEvent } from './preventable-event';
|
|
6
|
-
/**
|
|
7
|
-
* Arguments for the `remove` event. The `remove` event fires when you are about to remove an uploaded
|
|
8
|
-
* or selected file. You can cancel this event to prevent removal.
|
|
9
|
-
*
|
|
10
|
-
* ```typescript
|
|
11
|
-
* @Component({
|
|
12
|
-
* template: `
|
|
13
|
-
* <kendo-upload (remove)="removeEventHandler($event)"></kendo-upload>
|
|
14
|
-
* `
|
|
15
|
-
* })
|
|
16
|
-
* export class UploadComponent {
|
|
17
|
-
* public removeEventHandler(e: RemoveEvent) {
|
|
18
|
-
* console.log('Removing a file');
|
|
19
|
-
* }
|
|
20
|
-
* }
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export class RemoveEvent extends PreventableEvent {
|
|
24
|
-
/**
|
|
25
|
-
* An optional object that you send to the `remove` handler as key/value pairs.
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
data;
|
|
29
|
-
/**
|
|
30
|
-
* The files that you will remove from the server.
|
|
31
|
-
*/
|
|
32
|
-
files;
|
|
33
|
-
/**
|
|
34
|
-
* The headers of the request.
|
|
35
|
-
* You can use this to add custom headers to the remove request.
|
|
36
|
-
*/
|
|
37
|
-
headers;
|
|
38
|
-
/**
|
|
39
|
-
* @hidden
|
|
40
|
-
* Constructs the event arguments for the `remove` event.
|
|
41
|
-
* @param files - The list of the files that will be removed.
|
|
42
|
-
* @param headers - The headers of the request.
|
|
43
|
-
*/
|
|
44
|
-
constructor(files, headers) {
|
|
45
|
-
super();
|
|
46
|
-
this.files = files;
|
|
47
|
-
this.headers = headers;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,38 +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
|
-
* Arguments for the `resume` event. The `resume` event fires when
|
|
7
|
-
* you resume a previously paused file upload.
|
|
8
|
-
*
|
|
9
|
-
* ```typescript
|
|
10
|
-
* @Component({
|
|
11
|
-
* template: `
|
|
12
|
-
* <kendo-upload
|
|
13
|
-
* [chunkable]="true"
|
|
14
|
-
* (resume)="resumeEventHandler($event)">
|
|
15
|
-
* </kendo-upload>
|
|
16
|
-
* `
|
|
17
|
-
* })
|
|
18
|
-
* export class UploadComponent {
|
|
19
|
-
* public resumeEventHandler(ev: ResumeEvent) {
|
|
20
|
-
* console.log('File resumed');
|
|
21
|
-
* }
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export class ResumeEvent {
|
|
26
|
-
/**
|
|
27
|
-
* The file that you resumed during the upload process.
|
|
28
|
-
*/
|
|
29
|
-
file;
|
|
30
|
-
/**
|
|
31
|
-
* @hidden
|
|
32
|
-
* Constructs the event arguments for the `resume` event.
|
|
33
|
-
* @param file - The file that is going to be resumed.
|
|
34
|
-
*/
|
|
35
|
-
constructor(file) {
|
|
36
|
-
this.file = file;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,37 +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 { PreventableEvent } from './preventable-event';
|
|
6
|
-
/**
|
|
7
|
-
* Arguments for the `select` event. The `select` event fires when
|
|
8
|
-
* a file or multiple files are selected for upload. The event can be canceled to prevent selection.
|
|
9
|
-
*
|
|
10
|
-
* ```typescript
|
|
11
|
-
* @Component({
|
|
12
|
-
* template: `
|
|
13
|
-
* <kendo-upload (select)="selectEventHandler($event)"></kendo-upload>
|
|
14
|
-
* `
|
|
15
|
-
* })
|
|
16
|
-
* export class UploadComponent {
|
|
17
|
-
* public selectEventHandler(e: SelectEvent) {
|
|
18
|
-
* console.log('File selected');
|
|
19
|
-
* }
|
|
20
|
-
* }
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export class SelectEvent extends PreventableEvent {
|
|
24
|
-
/**
|
|
25
|
-
* The files that are selected for upload.
|
|
26
|
-
*/
|
|
27
|
-
files;
|
|
28
|
-
/**
|
|
29
|
-
* @hidden
|
|
30
|
-
* Constructs the event arguments for the `select` event.
|
|
31
|
-
* @param files - The list of the selected files.
|
|
32
|
-
*/
|
|
33
|
-
constructor(files) {
|
|
34
|
-
super();
|
|
35
|
-
this.files = files;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,49 +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 { PreventableEvent } from './preventable-event';
|
|
6
|
-
/**
|
|
7
|
-
* Arguments for the `success` event. The `success` event fires when
|
|
8
|
-
* you successfully upload or remove the selected files.
|
|
9
|
-
*
|
|
10
|
-
* ```typescript
|
|
11
|
-
* @Component({
|
|
12
|
-
* template: `
|
|
13
|
-
* <kendo-upload (success)="successEventHandler($event)"></kendo-upload>
|
|
14
|
-
* `
|
|
15
|
-
* })
|
|
16
|
-
* export class UploadComponent {
|
|
17
|
-
* public successEventHandler(e: SuccessEvent) {
|
|
18
|
-
* console.log('The ' + e.operation + ' was successful!');
|
|
19
|
-
* }
|
|
20
|
-
* }
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export class SuccessEvent extends PreventableEvent {
|
|
24
|
-
/**
|
|
25
|
-
* The files that you successfully uploaded or removed.
|
|
26
|
-
*/
|
|
27
|
-
files;
|
|
28
|
-
/**
|
|
29
|
-
* The operation type that succeeded (`upload` or `remove`).
|
|
30
|
-
*/
|
|
31
|
-
operation;
|
|
32
|
-
/**
|
|
33
|
-
* The HTTP response that the server returns to confirm success.
|
|
34
|
-
*/
|
|
35
|
-
response;
|
|
36
|
-
/**
|
|
37
|
-
* @hidden
|
|
38
|
-
* Constructs the event arguments for the `success` event.
|
|
39
|
-
* @param files - The list of the files that were uploaded or removed.
|
|
40
|
-
* @param operation - The operation type (`upload` or `remove`).
|
|
41
|
-
* @param response - The response object returned by the server.
|
|
42
|
-
*/
|
|
43
|
-
constructor(files, operation, response) {
|
|
44
|
-
super();
|
|
45
|
-
this.files = files;
|
|
46
|
-
this.operation = operation;
|
|
47
|
-
this.response = response;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,49 +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 { PreventableEvent } from './preventable-event';
|
|
6
|
-
/**
|
|
7
|
-
* Arguments for the `upload` event. The `upload` event fires when you are about
|
|
8
|
-
* to upload one or more files. You can cancel this event to prevent upload and add headers to the request.
|
|
9
|
-
*
|
|
10
|
-
* ```typescript
|
|
11
|
-
* @Component({
|
|
12
|
-
* template: `
|
|
13
|
-
* <kendo-upload (upload)="uploadEventHandler($event)"></kendo-upload>
|
|
14
|
-
* `
|
|
15
|
-
* })
|
|
16
|
-
* export class UploadComponent {
|
|
17
|
-
* public uploadEventHandler(e: UploadEvent) {
|
|
18
|
-
* e.headers = e.headers.append('X-Foo', 'Bar');
|
|
19
|
-
* }
|
|
20
|
-
* }
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export class UploadEvent extends PreventableEvent {
|
|
24
|
-
/**
|
|
25
|
-
* The optional object that you send to the `upload` handler as key/value pairs.
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
data;
|
|
29
|
-
/**
|
|
30
|
-
* The files that you will upload to the server.
|
|
31
|
-
*/
|
|
32
|
-
files;
|
|
33
|
-
/**
|
|
34
|
-
* The headers of the request.
|
|
35
|
-
* You can use this to add custom headers to the upload request.
|
|
36
|
-
*/
|
|
37
|
-
headers;
|
|
38
|
-
/**
|
|
39
|
-
* @hidden
|
|
40
|
-
* Constructs the event arguments for the `upload` event.
|
|
41
|
-
* @param files - The list of the files that will be uploaded.
|
|
42
|
-
* @param headers - The headers of the request.
|
|
43
|
-
*/
|
|
44
|
-
constructor(files, headers) {
|
|
45
|
-
super();
|
|
46
|
-
this.files = files;
|
|
47
|
-
this.headers = headers;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,41 +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
|
-
* Arguments for the `uploadprogress` event. The `uploadprogress` event
|
|
7
|
-
* fires when you upload files.
|
|
8
|
-
*
|
|
9
|
-
* ```typescript
|
|
10
|
-
* @Component({
|
|
11
|
-
* template: `
|
|
12
|
-
* <kendo-upload (uploadProgress)="uploadProgressEventHandler($event)"></kendo-upload>
|
|
13
|
-
* `
|
|
14
|
-
* })
|
|
15
|
-
* export class UploadComponent {
|
|
16
|
-
* public uploadProgressEventHandler(e: UploadProgressEvent) {
|
|
17
|
-
* console.log(e.files[0].name + ' is ' + e.percentComplete + ' uploaded');
|
|
18
|
-
* }
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export class UploadProgressEvent {
|
|
23
|
-
/**
|
|
24
|
-
* The files that you are currently uploading.
|
|
25
|
-
*/
|
|
26
|
-
files;
|
|
27
|
-
/**
|
|
28
|
-
* The upload progress as a percentage from 0 to 100.
|
|
29
|
-
*/
|
|
30
|
-
percentComplete;
|
|
31
|
-
/**
|
|
32
|
-
* @hidden
|
|
33
|
-
* Constructs the event arguments for the `uploadprogress` event.
|
|
34
|
-
* @param files - The list of files that are being uploaded.
|
|
35
|
-
* @param percentComplete - The portion that has been uploaded.
|
|
36
|
-
*/
|
|
37
|
-
constructor(files, percentComplete) {
|
|
38
|
-
this.files = files;
|
|
39
|
-
this.percentComplete = percentComplete;
|
|
40
|
-
}
|
|
41
|
-
}
|
package/esm2022/events.mjs
DELETED
|
@@ -1,14 +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 { CancelEvent } from './events/cancel-event';
|
|
6
|
-
export { ClearEvent } from './events/clear-event';
|
|
7
|
-
export { ErrorEvent } from './events/error-event';
|
|
8
|
-
export { PauseEvent } from './events/pause-event';
|
|
9
|
-
export { RemoveEvent } from './events/remove-event';
|
|
10
|
-
export { ResumeEvent } from './events/resume-event';
|
|
11
|
-
export { SelectEvent } from './events/select-event';
|
|
12
|
-
export { SuccessEvent } from './events/success-event';
|
|
13
|
-
export { UploadEvent } from './events/upload-event';
|
|
14
|
-
export { UploadProgressEvent } from './events/upload-progress-event';
|
|
@@ -1,136 +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 { Directive, ElementRef, HostBinding, HostListener, Input } from '@angular/core';
|
|
6
|
-
import { NavigationService } from './navigation.service';
|
|
7
|
-
import { UploadService } from './upload.service';
|
|
8
|
-
import { assignGuidToFiles, inputFiles } from './common/util';
|
|
9
|
-
import { validateFiles } from './common/validation-util';
|
|
10
|
-
import * as i0 from "@angular/core";
|
|
11
|
-
import * as i1 from "./upload.service";
|
|
12
|
-
import * as i2 from "./navigation.service";
|
|
13
|
-
/**
|
|
14
|
-
* @hidden
|
|
15
|
-
*/
|
|
16
|
-
export class FileSelectDirective {
|
|
17
|
-
uploadService;
|
|
18
|
-
navigation;
|
|
19
|
-
dir;
|
|
20
|
-
disabled;
|
|
21
|
-
multiple;
|
|
22
|
-
restrictions;
|
|
23
|
-
accept;
|
|
24
|
-
required;
|
|
25
|
-
type = "file";
|
|
26
|
-
autocomplete = "off";
|
|
27
|
-
tabIndex = -1;
|
|
28
|
-
ariaHidden = true;
|
|
29
|
-
element;
|
|
30
|
-
constructor(uploadService, navigation, el) {
|
|
31
|
-
this.uploadService = uploadService;
|
|
32
|
-
this.navigation = navigation;
|
|
33
|
-
this.element = el;
|
|
34
|
-
}
|
|
35
|
-
classNames = true;
|
|
36
|
-
get nameAttribute() {
|
|
37
|
-
return this.uploadService.async.saveField;
|
|
38
|
-
}
|
|
39
|
-
get multipleAttribute() {
|
|
40
|
-
return this.multiple ? "multiple" : null;
|
|
41
|
-
}
|
|
42
|
-
get dirAttribute() {
|
|
43
|
-
return this.dir;
|
|
44
|
-
}
|
|
45
|
-
get disabledAttribute() {
|
|
46
|
-
return this.disabled ? "true" : null;
|
|
47
|
-
}
|
|
48
|
-
get acceptAttribute() {
|
|
49
|
-
return this.accept ? this.accept : null;
|
|
50
|
-
}
|
|
51
|
-
get requiredAttribute() {
|
|
52
|
-
return this.required ? "" : null;
|
|
53
|
-
}
|
|
54
|
-
onInputChange(event) {
|
|
55
|
-
const ua = navigator.userAgent;
|
|
56
|
-
const webkit = /(webkit)[ \/]([\w.]+)/i;
|
|
57
|
-
const msBrowsers = /(windows)[ \/]([\w.]+)/i;
|
|
58
|
-
let selectedFiles = inputFiles(event.target);
|
|
59
|
-
selectedFiles = assignGuidToFiles(selectedFiles, !this.uploadService.async.batch);
|
|
60
|
-
validateFiles(selectedFiles, this.restrictions);
|
|
61
|
-
if (!this.multiple) {
|
|
62
|
-
this.uploadService.clearFiles();
|
|
63
|
-
}
|
|
64
|
-
this.uploadService.addFiles(selectedFiles);
|
|
65
|
-
/*
|
|
66
|
-
Chrome, IE, Edge and Safari do not trigger a `change` event
|
|
67
|
-
when a file with the same name is selected a number of consecutive times.
|
|
68
|
-
As a workaround, clear the input value after handling the file.
|
|
69
|
-
*/
|
|
70
|
-
const native = this.element.nativeElement;
|
|
71
|
-
if (ua.match(webkit) || ua.match(msBrowsers)) {
|
|
72
|
-
native.type = "";
|
|
73
|
-
native.type = "file";
|
|
74
|
-
}
|
|
75
|
-
setTimeout(() => {
|
|
76
|
-
this.navigation.focusedIndex = -1;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FileSelectDirective, deps: [{ token: i1.UploadService }, { token: i2.NavigationService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
80
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: FileSelectDirective, isStandalone: true, selector: "[kendoFileSelect]", inputs: { dir: "dir", disabled: "disabled", multiple: "multiple", restrictions: "restrictions", accept: "accept", required: "required" }, host: { listeners: { "change": "onInputChange($event)" }, properties: { "attr.type": "this.type", "attr.autocomplete": "this.autocomplete", "attr.tabindex": "this.tabIndex", "attr.aria-hidden": "this.ariaHidden", "class.k-hidden": "this.classNames", "attr.name": "this.nameAttribute", "attr.multiple": "this.multipleAttribute", "attr.dir": "this.dirAttribute", "attr.disabled": "this.disabledAttribute", "attr.accept": "this.acceptAttribute", "attr.required": "this.requiredAttribute" } }, ngImport: i0 });
|
|
81
|
-
}
|
|
82
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: FileSelectDirective, decorators: [{
|
|
83
|
-
type: Directive,
|
|
84
|
-
args: [{
|
|
85
|
-
selector: '[kendoFileSelect]',
|
|
86
|
-
standalone: true
|
|
87
|
-
}]
|
|
88
|
-
}], ctorParameters: () => [{ type: i1.UploadService }, { type: i2.NavigationService }, { type: i0.ElementRef }], propDecorators: { dir: [{
|
|
89
|
-
type: Input
|
|
90
|
-
}], disabled: [{
|
|
91
|
-
type: Input
|
|
92
|
-
}], multiple: [{
|
|
93
|
-
type: Input
|
|
94
|
-
}], restrictions: [{
|
|
95
|
-
type: Input
|
|
96
|
-
}], accept: [{
|
|
97
|
-
type: Input
|
|
98
|
-
}], required: [{
|
|
99
|
-
type: Input
|
|
100
|
-
}], type: [{
|
|
101
|
-
type: HostBinding,
|
|
102
|
-
args: ["attr.type"]
|
|
103
|
-
}], autocomplete: [{
|
|
104
|
-
type: HostBinding,
|
|
105
|
-
args: ["attr.autocomplete"]
|
|
106
|
-
}], tabIndex: [{
|
|
107
|
-
type: HostBinding,
|
|
108
|
-
args: ["attr.tabindex"]
|
|
109
|
-
}], ariaHidden: [{
|
|
110
|
-
type: HostBinding,
|
|
111
|
-
args: ["attr.aria-hidden"]
|
|
112
|
-
}], classNames: [{
|
|
113
|
-
type: HostBinding,
|
|
114
|
-
args: ["class.k-hidden"]
|
|
115
|
-
}], nameAttribute: [{
|
|
116
|
-
type: HostBinding,
|
|
117
|
-
args: ["attr.name"]
|
|
118
|
-
}], multipleAttribute: [{
|
|
119
|
-
type: HostBinding,
|
|
120
|
-
args: ["attr.multiple"]
|
|
121
|
-
}], dirAttribute: [{
|
|
122
|
-
type: HostBinding,
|
|
123
|
-
args: ["attr.dir"]
|
|
124
|
-
}], disabledAttribute: [{
|
|
125
|
-
type: HostBinding,
|
|
126
|
-
args: ["attr.disabled"]
|
|
127
|
-
}], acceptAttribute: [{
|
|
128
|
-
type: HostBinding,
|
|
129
|
-
args: ["attr.accept"]
|
|
130
|
-
}], requiredAttribute: [{
|
|
131
|
-
type: HostBinding,
|
|
132
|
-
args: ["attr.required"]
|
|
133
|
-
}], onInputChange: [{
|
|
134
|
-
type: HostListener,
|
|
135
|
-
args: ["change", ["$event"]]
|
|
136
|
-
}] } });
|