UNPKG

@progress/kendo-angular-upload

Version:

Kendo UI Angular Upload Component

77 lines (76 loc) 2.6 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { HttpHeaders } from '@angular/common/http'; import { FileInfo } from '../types'; import { PreventableEvent } from './preventable-event'; /** * Arguments for the `upload` event. The `upload` event fires when one or more files are about * to be uploaded. If you cancel the event, the upload is prevented. You can add headers to the request. * * ```ts-no-run * @Component({ * selector: 'my-upload', * template: ` * <kendo-upload * [saveUrl]="uploadSaveUrl" * [removeUrl]="uploadRemoveUrl" * (upload)="uploadEventHandler($event)"> * </kendo-upload> * ` * }) * export class UploadComponent { * uploadSaveUrl = 'saveUrl'; // should represent an actual API endpoint * uploadRemoveUrl = 'removeUrl'; // should represent an actual API endpoint * * uploadEventHandler(e: UploadEvent) { * e.headers = e.headers.append('X-Foo', 'Bar'); * } * } * ``` */ export declare class UploadEvent extends PreventableEvent { /** * The optional object that is sent to the `upload` handler in the form of key/value pair. * * ```ts-no-run * @Component({ * selector: 'my-upload', * template: ` * <kendo-upload * [saveUrl]="uploadSaveUrl" * [removeUrl]="uploadRemoveUrl" * (upload)="uploadEventHandler($event)"> * </kendo-upload> * ` * }) * export class UploadComponent { * uploadSaveUrl = 'saveUrl'; // should represent an actual API endpoint * uploadRemoveUrl = 'removeUrl'; // should represent an actual API endpoint * * uploadEventHandler(e: UploadEvent) { * e.data = { * description: 'File description' * }; * } * } * ``` */ data: Object; /** * The list of the files that will be uploaded. */ files: Array<FileInfo>; /** * The headers of the request. */ headers: HttpHeaders; /** * @hidden * Constructs the event arguments for the `upload` event. * @param files - The list of the files that will be uploaded. * @param headers - The headers of the request. */ constructor(files: Array<FileInfo>, headers: HttpHeaders); }