carbon-components-angular
Version:
Next generation components
151 lines (147 loc) • 4.93 kB
TypeScript
/**
*
* carbon-angular v0.0.0 | file-uploader.component.d.ts
*
* Copyright 2014, 2024 IBM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { EventEmitter, TemplateRef } from "@angular/core";
import { ControlValueAccessor } from "@angular/forms";
import { I18n } from "carbon-components-angular/i18n";
import { FileItem } from "./file-item.interface";
import * as i0 from "@angular/core";
/**
* Get started with importing the module:
*
* ```typescript
* import { FileUploaderModule } from 'carbon-components-angular';
* ```
*
* [See demo](../../?path=/story/components-file-uploader--basic)
*/
export declare class FileUploader implements ControlValueAccessor {
protected i18n: I18n;
/**
* Counter used to create unique ids for file-uploader components
*/
static fileUploaderCount: number;
/**
* Accessible text for the button that opens the upload window.
*
* Defaults to the `FILE_UPLOADER.OPEN` value from the i18n service
*/
buttonText: any;
/**
* Type set for button
*/
buttonType: "primary" | "secondary" | "tertiary" | "ghost" | "danger";
/**
* Text set to the title
*/
title: string;
/**
* Text set to the description
*/
description: string;
/**
* Specify the types of files that the input should be able to receive
*/
accept: any[];
/**
* Set to `false` to tell the component to only accept a single file on upload.
*
* Defaults to `true`. Accepts multiple files.
*/
multiple: boolean;
/**
* Set to `true` for a loading file uploader.
*/
skeleton: boolean;
/**
* Sets the size of the button.
*/
size: "sm" | "md" | "lg";
/**
* Sets the size of the file items
*/
fileItemSize: "sm" | "md" | "lg";
/**
* Set to `true` to enable drag and drop.
*/
drop: boolean;
/**
* Sets the text shown in drag and drop box.
*/
dropText: string | TemplateRef<any>;
/**
* Provides a unique id for the underlying `<input>` node
*/
fileUploaderId: string;
/**
* Maintains a reference to the view DOM element of the underlying <input> node
*/
fileInput: any;
/**
* The list of files that have been submitted to be uploaded
*/
files: Set<FileItem>;
/**
* Set to `true` to disable upload button
*/
disabled: boolean;
filesChange: EventEmitter<any>;
/**
* Controls the state of the drag and drop file container
*/
dragOver: boolean;
protected onTouchedCallback: () => void;
protected onChangeCallback: (_: Set<FileItem>) => void;
constructor(i18n: I18n);
/**
* Specifies the property to be used as the return value to `ngModel` and reactive forms.
* Updates `this.files`.
*/
get value(): Set<FileItem>;
set value(v: Set<FileItem>);
onBlur(): void;
get fileList(): unknown[];
/**
* Propagates the injected `value`.
*/
writeValue(value: Set<FileItem>): void;
createFileItem(file: any): FileItem;
onFilesAdded(): void;
onDragOver(event: any): void;
onDragLeave(event: any): void;
onDrop(event: any): void;
removeFile(fileItem: any): void;
isTemplate(value: any): boolean;
/**
* Registers the injected function to control the touch use of the `FileUploader`.
*/
registerOnTouched(fn: any): void;
/**
* Sets a method in order to propagate changes back to the form.
*/
registerOnChange(fn: any): void;
/**
* `ControlValueAccessor` method to programmatically disable the checkbox.
*
* ex: `this.formGroup.get("myFileUploader").disable();`
*
* @param isDisabled `true` to disable the file uploader
*/
setDisabledState(isDisabled: boolean): void;
static ɵfac: i0.ɵɵFactoryDeclaration<FileUploader, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<FileUploader, "cds-file-uploader, ibm-file-uploader", never, { "buttonText": "buttonText"; "buttonType": "buttonType"; "title": "title"; "description": "description"; "accept": "accept"; "multiple": "multiple"; "skeleton": "skeleton"; "size": "size"; "fileItemSize": "fileItemSize"; "drop": "drop"; "dropText": "dropText"; "fileUploaderId": "fileUploaderId"; "files": "files"; "disabled": "disabled"; }, { "filesChange": "filesChange"; }, never, never, false>;
}