import { KbqFileUploadModule } from '@koobiq/components/file-upload';

KbqDropzoneContent

componentСкопировать ссылку на KbqDropzoneContent
@Component({ selector: 'kbq-dropzone-content' })
class KbqDropzoneContent {}

KbqFileLoader

componentСкопировать ссылку на KbqFileLoader

Loader component to trigger Browser API.

@Component({ selector: '[kbqFileLoader]', exportAs: 'kbqFileLoader' })
class KbqFileLoader {
readonly disabled = input<boolean>(false);
readonly multiple = input<boolean | null>(null);
readonly accept = input<string | null>(null);
readonly for = input<string | null>(null);
readonly onlyDirectory = input<boolean | null>(null);
readonly describedBy = input<string | null>(null);
readonly invalid = input<boolean>(false);
readonly fileChange = output<Event>();
readonly input: Signal<ElementRef<HTMLInputElement>>;
}
disabledinputСкопировать ссылку на disabledboolean

Whether file input selectable or not

multipleinputСкопировать ссылку на multipleboolean | null

Selection mode for file input

acceptinputСкопировать ссылку на acceptstring | null

File type specifiers

forinputСкопировать ссылку на forstring | null

id for file input

onlyDirectoryinputСкопировать ссылку на onlyDirectoryboolean | null

Reflects webkitdirectory attribute, which indicates that elements can only select directories instead of files. See HTMLInputElement: webkitdirectory property.

describedByinputСкопировать ссылку на describedBystring | null

Ids of the elements describing the file input, written to its aria-describedby.

invalidinputСкопировать ссылку на invalidboolean

Whether the file input holds a value the form rejects, reported through aria-invalid.

fileChangeoutputСкопировать ссылку на fileChangeEvent

Event fires when file selected in file-picker.

inputСкопировать ссылку на inputSignal<ElementRef<HTMLInputElement>>

Underlying file input element

KbqFileUploadEmptyState

componentСкопировать ссылку на KbqFileUploadEmptyState

Component that displays an empty state for file upload areas.

@Component({ selector: 'kbq-file-upload-empty-state' })
class KbqFileUploadEmptyState extends KbqEmptyState {
readonly title = input<string>();
readonly caption = input<string | TemplateRef<unknown>>();
readonly size = input<KbqDefaultSizes>('big');
readonly errorColor = input<boolean>(false);
readonly alignTop = input<boolean>(false);
}
titleinputСкопировать ссылку на titlestring

Title text to display below the upload icon

captioninputСкопировать ссылку на captionstring | TemplateRef<unknown>

Caption text or template to display below the title

sizeinputСкопировать ссылку на sizeKbqDefaultSizes

Same input as KbqEmptyState.size, redeclared only to default to big instead of normal. It used to be a super()-time assignment, which an input() cannot take.

errorColorinputСкопировать ссылку на errorColorboolean

Whether the title, the text and the projected icon render in the error color. Defaults to false.

alignTopinputСкопировать ссылку на alignTopboolean

Whether the content sits at the top of the host instead of its center. Defaults to false.

KbqMultipleFileUploadComponent

componentСкопировать ссылку на KbqMultipleFileUploadComponent
@Component({ selector: 'kbq-multiple-file-upload,kbq-file-upload[multiple]' })
class KbqMultipleFileUploadComponent extends KbqFileUploadBase implements ControlValueAccessor {
readonly progressMode = input<ProgressSpinnerMode>('determinate');
readonly accept = input<string[]>();
readonly size = input<'compact' | 'default'>('default');
readonly inputId = input<string>(
`kbq-multiple-file-upload-${nextMultipleFileUploadUniqueId++}`
);
errorStateMatcher = input<ErrorStateMatcher | undefined>();
files = model<KbqFileItem[] | undefined>();
readonly allowed = input<KbqFileUploadAllowedTypeValues>(
KbqFileUploadAllowedType.File
);
readonly fullScreenDropZone = input<KbqDropzoneData | boolean>();
readonly addStrategy = input<KbqFileUploadAddStrategyValues>(
KbqFileUploadAddStrategy.Concat
);
readonly filesAdded = output<KbqFileItem[]>();
readonly fileRemoved = output<[ KbqFileItem, number ]>();
readonly rejected = output<File[]>();
errorState: boolean;
readonly localeConfiguration: Signal<KbqFileUploadLocaleConfiguration>;
}
progressModeinputСкопировать ссылку на progressModeProgressSpinnerMode

A value responsible for progress spinner type. Loading logic depends on selected mode

acceptinputСкопировать ссылку на acceptstring[]

Array of file type specifiers

inputIdinputСкопировать ссылку на inputIdstring

custom ID for the file input element.

errorStateMatcherinputСкопировать ссылку на errorStateMatcherErrorStateMatcher | undefined

An object used to control the error state of the component.

filesmodelСкопировать ссылку на filesKbqFileItem[] | undefined

The selected files.

Writing it is the model→view direction, same as writeValue(): it fills the list and tells nobody. cvaOnChange and (filesChange) belong to the paths a user drives — see onFileAdded() and deleteFile() — so a [files] binding cannot make the form look edited.

allowedinputСкопировать ссылку на allowedKbqFileUploadAllowedTypeValues

Determines which kind of items the upload component can accept. Defaults to 'file'.

fullScreenDropZoneinputСкопировать ссылку на fullScreenDropZoneKbqDropzoneData | boolean

Controls whether to display fullscreen dropzone. Provide configuration object to enable, or undefined to disable.

addStrategyinputСкопировать ссылку на addStrategyKbqFileUploadAddStrategyValues

Controls how newly selected/dropped files are merged into the existing list. concat accumulates files across interactions, skipping files that duplicate ones already present. replace discards the previous selection, mirroring native input file multiple behavior. Defaults to 'concat'.

localeOverridesinputСкопировать ссылку на localeOverridesKbqPartialLocaleData | undefined

Localized strings for this element and its subtree, keyed by locale section. Every key is optional at every depth.

idinputСкопировать ссылку на idstring | null

id for file input

disabledinputСкопировать ссылку на disabledboolean | null

Whether file input selectable or not

filesAddedoutputСкопировать ссылку на filesAddedKbqFileItem[]

Emits an event containing a chunk of files added to the file list. Useful when handling added files, skipping filtering file list.

fileRemovedoutputСкопировать ссылку на fileRemoved[ KbqFileItem, number ]

Emits an event containing a tuple of file and file's index when removed from the file list. Useful when handle removed files, skipping filtering file list.

rejectedoutputСкопировать ссылку на rejectedFile[]

Emits the files a selection or a drop discarded — with the default concat strategy, the ones that duplicate a file already in the list. accept is not part of this: it only filters the OS dialog.

itemRemovedoutputСкопировать ссылку на itemRemoved[T, number]

Emits an event containing a tuple of file and file's index when removed from the file list. Useful when handle removed files, skipping filtering file list.

itemsAddedoutputСкопировать ссылку на itemsAddedT[]

Emits array of items that were added to the list.

errorStateСкопировать ссылку на errorStateboolean

Tracks whether the component is in an error state based on the control, parent form, and errorStateMatcher, triggering visual updates and state changes if needed.

localeConfigurationСкопировать ссылку на localeConfigurationSignal<KbqFileUploadLocaleConfiguration>

Localized labels of both upload flavours, following the active locale.

KbqSingleFileUploadComponent

componentСкопировать ссылку на KbqSingleFileUploadComponent
@Component({
selector: 'kbq-single-file-upload,kbq-file-upload:not([multiple])'
})
class KbqSingleFileUploadComponent extends KbqFileUploadBase implements ControlValueAccessor {
readonly progressMode = input<ProgressSpinnerMode>('determinate');
readonly accept = input<string[]>();
readonly inputId = input<string>(
`kbq-single-file-upload-${nextSingleFileUploadUniqueId++}`
);
errorStateMatcher = input<ErrorStateMatcher | undefined>();
file = model<KbqFileItem | null | undefined>();
readonly showFileSize = input<boolean>(true);
readonly allowed = input<KbqFileUploadAllowedTypeValues>(
KbqFileUploadAllowedType.File
);
readonly fullScreenDropZone = input<KbqDropzoneData | boolean>();
readonly rejected = output<File[]>();
errorState: boolean;
readonly localeConfiguration: Signal<KbqFileUploadLocaleConfiguration>;
}
progressModeinputСкопировать ссылку на progressModeProgressSpinnerMode

A value responsible for progress spinner type. Loading logic depends on selected mode

acceptinputСкопировать ссылку на acceptstring[]

Array of file type specifiers

errorStateMatcherinputСкопировать ссылку на errorStateMatcherErrorStateMatcher | undefined

An object used to control the error state of the component.

filemodelСкопировать ссылку на fileKbqFileItem | null | undefined

The selected file, or null.

Writing it is the model→view direction, same as writeValue(): it fills the list and tells nobody. cvaOnChange and (fileChange) belong to the paths a user drives — see addFile() and deleteItem() — so a [file] binding cannot make the form look edited.

showFileSizeinputСкопировать ссылку на showFileSizeboolean

Controls whether to display the file size information. Defaults to true.

allowedinputСкопировать ссылку на allowedKbqFileUploadAllowedTypeValues

Determines which kind of items the upload component can accept. Defaults to 'file'.

fullScreenDropZoneinputСкопировать ссылку на fullScreenDropZoneKbqDropzoneData | boolean

Controls whether to display fullscreen dropzone. Provide configuration object to enable, or undefined to disable.

localeOverridesinputСкопировать ссылку на localeOverridesKbqPartialLocaleData | undefined

Localized strings for this element and its subtree, keyed by locale section. Every key is optional at every depth.

idinputСкопировать ссылку на idstring | null

id for file input

disabledinputСкопировать ссылку на disabledboolean | null

Whether file input selectable or not

rejectedoutputСкопировать ссылку на rejectedFile[]

Emits the files a selection or a drop discarded: everything past the first one, since the component holds a single file. accept is not part of this — it only filters the OS dialog.

errorStateСкопировать ссылку на errorStateboolean

Tracks whether the component is in an error state based on the control, parent form, and errorStateMatcher, triggering visual updates and state changes if needed.

localeConfigurationСкопировать ссылку на localeConfigurationSignal<KbqFileUploadLocaleConfiguration>

Localized labels of both upload flavours, following the active locale.

KbqDrop

directiveСкопировать ссылку на KbqDrop
@Directive()
class KbqDrop {
readonly disabled = model<boolean>(false);
readonly filesDropped = output<KbqFile[]>();
}
disabledmodelСкопировать ссылку на disabledboolean

Controls whether drag-and-drop functionality is enabled. When true, all drag events are filtered out and ignored.

filesDroppedoutputСкопировать ссылку на filesDroppedKbqFile[]

Emits an event when file items were dropped.

KbqFileDropDirective

directiveСкопировать ссылку на KbqFileDropDirective
@Directive({ selector: '[kbqFileDrop]', exportAs: 'kbqFileDrop' })
class KbqFileDropDirective extends KbqDrop {
readonly disabled = model<boolean>(false);
readonly filesDropped = output<KbqFile[]>();
onDragEnter(event: DragEvent): void;
}
disabledmodelСкопировать ссылку на disabledboolean

Controls whether drag-and-drop functionality is enabled. When true, all drag events are filtered out and ignored.

filesDroppedoutputСкопировать ссылку на filesDroppedKbqFile[]

Emits an event when file items were dropped.

KbqFileList

directiveСкопировать ссылку на KbqFileList

Responsible for list update (add/remove)

@Directive({ selector: '[kbqFileList]', exportAs: 'kbqFileList' })
class KbqFileList<T> {
readonly list = model<T[]>([]);
readonly itemRemoved = output<[T, number]>();
readonly itemsAdded = output<T[]>();
add(item: T): void;
addArray(items: T[]): void;
replace(items: T[]): void;
remove(item: T): T[];
removeAt(index: number): T[];
}
listmodelСкопировать ссылку на listT[]

Current list of items.

itemRemovedoutputСкопировать ссылку на itemRemoved[T, number]

Emits an event containing a tuple of file and file's index when removed from the file list. Useful when handle removed files, skipping filtering file list.

itemsAddedoutputСкопировать ссылку на itemsAddedT[]

Emits array of items that were added to the list.

add()Скопировать ссылку на add()void

Adds a single item to the list and emits event

addArray()Скопировать ссылку на addArray()void

Adds multiple items to the list and emits event

replace()Скопировать ссылку на replace()void

Replaces the current list with the specified items and emits event.

remove()Скопировать ссылку на remove()T[]

Removes the first occurrence of the specified item. Returns removed items and emits event.

removeAt()Скопировать ссылку на removeAt()T[]

Removes item at specified index. Returns removed items and emits event. An index outside the list removes nothing, emits nothing and leaves the list untouched.

KbqFileUploadContext

directiveСкопировать ссылку на KbqFileUploadContext

File upload context.

@Directive({
selector: '[kbqFileUploadContext]',
exportAs: 'kbqFileUploadContext'
})
class KbqFileUploadContext {
readonly id = input<string | null>(null);
readonly disabled = model<boolean | null>(null);
readonly multiple = input<boolean | null>(null);
readonly accept = input<string | null>(null);
readonly onlyDirectory = input<boolean | null>(null);
}
idinputСкопировать ссылку на idstring | null

id for file input

disabledmodelСкопировать ссылку на disabledboolean | null

Whether file input selectable or not

multipleinputСкопировать ссылку на multipleboolean | null

Selection mode for file input

acceptinputСкопировать ссылку на acceptstring | null

File type specifiers

onlyDirectoryinputСкопировать ссылку на onlyDirectoryboolean | null

Reflects webkitdirectory attribute, which indicates that elements can only select directories instead of files.

KbqLocalDropzone

directiveСкопировать ссылку на KbqLocalDropzone

Directive that turns an element into a local drag-and-drop zone.

Displays an overlay over the host element on drag enter, handles drag events, and emits dropped files to a connected file upload component.

@Directive({ selector: '[kbqLocalDropzone]', exportAs: 'kbqLocalDropzone' })
class KbqLocalDropzone extends KbqDrop {
readonly connectedTo = input<KbqSingleFileUploadComponent | KbqMultipleFileUploadComponent>(
undefined,
{ alias: 'kbqConnectedTo' }
);
readonly disabled = model<boolean>(false);
readonly filesDropped = output<KbqFile[]>();
open(config?: KbqDropzoneData): void;
close(): void;
}
disabledmodelСкопировать ссылку на disabledboolean

Controls whether drag-and-drop functionality is enabled. When true, all drag events are filtered out and ignored.

filesDroppedoutputСкопировать ссылку на filesDroppedKbqFile[]

Emits an event when file items were dropped.

open()Скопировать ссылку на open()void

Opens the dropzone overlay positioned over the host element.

close()Скопировать ссылку на close()void

Closes and disposes the overlay.

KbqFullScreenDropzoneService

serviceСкопировать ссылку на KbqFullScreenDropzoneService

Service that provides full-screen drag-and-drop overlay functionality.

@Injectable({ providedIn: 'root' })
class KbqFullScreenDropzoneService extends KbqDrop {
readonly disabled = model<boolean>(false);
readonly filesDropped = output<KbqFile[]>();
init(config?: KbqDropzoneData): void;
stop(): void;
open(config?: KbqDropzoneData): void;
close(): void;
}
disabledСкопировать ссылку на disabledboolean

Controls whether drag-and-drop functionality is enabled. When true, all drag events are filtered out and ignored.

filesDroppedСкопировать ссылку на filesDroppedKbqFile[]

Emits an event when file items were dropped.

init()Скопировать ссылку на init()void

Initializes drag-and-drop event listeners on the document body.

Parameters
config?KbqDropzoneData

Dropzone configuration

stop()Скопировать ссылку на stop()void

Stops all drag-and-drop event listeners and cleans up subscriptions.

open()Скопировать ссылку на open()void

Opens the dropzone overlay.

Parameters
config?KbqDropzoneData

Dropzone configuration

close()Скопировать ссылку на close()void

Closes and disposes the overlay.

KbqDropzoneData

typeСкопировать ссылку на KbqDropzoneData

Dropzone overlay content configuration.

type KbqDropzoneData = Partial<{
caption: string;
size: KbqDefaultSizes;
title: string;
autoCapture: boolean;
}>;
captionoptionalСкопировать ссылку на captionstring

Optional caption text displayed below the title.

sizeoptionalСкопировать ссылку на sizeKbqDefaultSizes

Visual size of the dropzone empty state content.

titleoptionalСкопировать ссылку на titlestring

Title text displayed in the dropzone; falls back to localized default.

autoCaptureoptionalСкопировать ссылку на autoCaptureboolean

Whether focus should be automatically captured when the overlay opens.

KbqFile

interfaceСкопировать ссылку на KbqFile
interface KbqFile extends File {
fullPath: string;
readonly lastModified: number;
readonly name: string;
readonly webkitRelativePath: string;
readonly size: number;
readonly type: string;
arrayBuffer(): Promise<ArrayBuffer>;
bytes(): Promise<Uint8Array<ArrayBuffer>>;
slice(start?: number, end?: number, contentType?: string): Blob;
stream(): ReadableStream<Uint8Array<ArrayBuffer>>;
text(): Promise<string>;
}
lastModifiedСкопировать ссылку на lastModifiednumber

The lastModified read-only property of the File interface provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight).

MDN Reference

nameСкопировать ссылку на namestring

The name read-only property of the File interface returns the name of the file represented by a File object.

MDN Reference

webkitRelativePathСкопировать ссылку на webkitRelativePathstring

The webkitRelativePath read-only property of the File interface contains a string which specifies the file's path relative to the directory selected by the user in an input element with its webkitdirectory attribute set.

MDN Reference

sizeСкопировать ссылку на sizenumber

The size read-only property of the Blob interface returns the size of the Blob or File in bytes.

MDN Reference

typeСкопировать ссылку на typestring

The type read-only property of the Blob interface returns the MIME type of the file.

MDN Reference

arrayBuffer()Скопировать ссылку на arrayBuffer()Promise<ArrayBuffer>

The arrayBuffer() method of the Blob interface returns a Promise that resolves with the contents of the blob as binary data contained in an ArrayBuffer.

MDN Reference

bytes()Скопировать ссылку на bytes()Promise<Uint8Array<ArrayBuffer>>

The bytes() method of the Blob interface returns a Promise that resolves with a Uint8Array containing the contents of the blob as an array of bytes.

MDN Reference

slice()Скопировать ссылку на slice()Blob

The slice() method of the Blob interface creates and returns a new Blob object which contains data from a subset of the blob on which it's called.

MDN Reference

stream()Скопировать ссылку на stream()ReadableStream<Uint8Array<ArrayBuffer>>

The stream() method of the Blob interface returns a ReadableStream which upon reading returns the data contained within the Blob.

MDN Reference

text()Скопировать ссылку на text()Promise<string>

The text() method of the string containing the contents of the blob, interpreted as UTF-8.

MDN Reference

KbqFileItem

interfaceСкопировать ссылку на KbqFileItem
interface KbqFileItem {
file: File;
hasError?: boolean;
loading?: BehaviorSubject<boolean>;
progress?: BehaviorSubject<number>;
}

KbqFileUploadAddStrategyValues

typeСкопировать ссылку на KbqFileUploadAddStrategyValues

Allowed add strategies for the upload component.

type KbqFileUploadAddStrategyValues = KbqEnumValues<KbqFileUploadAddStrategy>;

KbqFileUploadAllowedTypeValues

typeСкопировать ссылку на KbqFileUploadAllowedTypeValues

Allowed upload modes for the upload component.

type KbqFileUploadAllowedTypeValues = KbqEnumValues<KbqFileUploadAllowedType>;

KbqFileUploadAddStrategy

enumСкопировать ссылку на KbqFileUploadAddStrategy

Strategy for merging newly selected/dropped files into the existing file list.

enum KbqFileUploadAddStrategy {
Concat = 'concat',
Replace = 'replace'
}
ConcatСкопировать ссылку на Concat'concat'

Accumulates files across interactions, skipping files that duplicate ones already present.

ReplaceСкопировать ссылку на Replace'replace'

Discards the previous selection, mirroring native <input multiple> behavior.

KbqFileUploadAllowedType

enumСкопировать ссылку на KbqFileUploadAllowedType

Upload modes enum.

enum KbqFileUploadAllowedType {
File = 'file',
Folder = 'folder',
Mixed = 'mixed'
}

KBQ_DROPZONE_DATA

constСкопировать ссылку на KBQ_DROPZONE_DATA

Injection token that can be used to access the data that was passed in to a modal.

const KBQ_DROPZONE_DATA: InjectionToken<KbqDropzoneData>;

KBQ_FILE_UPLOAD_LOCALE_CONFIGURATION

constСкопировать ссылку на KBQ_FILE_UPLOAD_LOCALE_CONFIGURATION

Localization configuration provider for the labels the file upload components render themselves.

const KBQ_FILE_UPLOAD_LOCALE_CONFIGURATION: InjectionToken<KbqFileUploadLocaleConfiguration>;

KBQ_MULTIPLE_FILE_UPLOAD_DEFAULT_CONFIGURATION

constСкопировать ссылку на KBQ_MULTIPLE_FILE_UPLOAD_DEFAULT_CONFIGURATION
const KBQ_MULTIPLE_FILE_UPLOAD_DEFAULT_CONFIGURATION: KbqMultipleFileUploadLocaleConfiguration;

KBQ_SINGLE_FILE_UPLOAD_DEFAULT_CONFIGURATION

constСкопировать ссылку на KBQ_SINGLE_FILE_UPLOAD_DEFAULT_CONFIGURATION
const KBQ_SINGLE_FILE_UPLOAD_DEFAULT_CONFIGURATION: KbqFileUploadLocaleConfiguration['single'];

kbqFileUploadLocaleConfigurationProvider

constСкопировать ссылку на kbqFileUploadLocaleConfigurationProvider

Utility provider of KBQ_FILE_UPLOAD_LOCALE_CONFIGURATION. Only the labels you pass are overridden; the rest keep following the active locale.

const kbqFileUploadLocaleConfigurationProvider: (
configuration: KbqDeepPartial<KbqFileUploadLocaleConfiguration>
) => Provider;
Предложения по улучшению
Если вы нашли ошибку или хотите доработать статью, создайте запрос на GitHub.