0.1.1 • Published 2 months ago

ng-dd-file v0.1.1

Weekly downloads
-
License
-
Repository
github
Last release
2 months ago

NgDdFile

Drag and Drop File for Angular

Getting started

Step 1: Install ng-dd-file

NPM

npm install --save ng-dd-file

YARN

yarn add ng-dd-file

Step 2: Import the NgDdFileModule

import { NgDdFileModule } from 'ng-dd-file';

@NgModule({
  declarations: [...],
  imports: [NgDdFileModule],
  bootstrap: [...]
})
export class AppModule {}

Usage

In template use ng-dd-file component with your options

<ng-dd-file 
    [btnClass]="{ file: 'text-red' }"
    [filesList]="filesList" 
    [labels]="{ text: 'Arraste e solte os arquivos', btn: 'SELECIONE O ARQUIVO' }"
    [maxFiles]="3"
    [maxFileSize]="200"
    [maxTotalSize]="300"
    [multiple]="true"
    typeFileAccept="*"

    (fileError)="fileError($event)"
    (fileRemove)="fileRemove($event)" 
    (filesAdd)="filesAdd($event)" 
></ng-dd-file>

API

Inputs

InputTypeDefaultDescription
btnClass{ file: string, remove: string }-Custom class for input:file and button:remove
filesListany[]-List of files
labels{ text: string, btn: string }{ text: 'Arraste e solte os arquivos', btn: 'SELECIONE O ARQUIVO' }Text and button labels
maxFilesnumber-Maximum files allowed
maxFileSizenumber (kB)-Maximum size of each file
maxTotalSizenumber (kB)-Maximum size of all file
multiplebooleanfalseAllowed to add more than one file
typeFileAcceptstring*Same as HTML attribute: accept

Outputs

OutputDescription
(fileError)Fired when [maxFileSize] or [maxTotalSize]
(fileRemove)Fired when button:remove is clicked
(filesAdd)Fired when File is add

Custom styles

If your custom class doesn't work, use the /deep/ selector

/deep/ .text-red { color: red; }
0.1.1

2 months ago

0.1.0

8 months ago

0.0.9

8 months ago

0.0.8

9 months ago

0.0.7

9 months ago

0.0.6

9 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago