Skip to content

Commit

Permalink
ng 9 package published (#76)
Browse files Browse the repository at this point in the history
Co-authored-by: Faisal Ansari <[email protected]>
  • Loading branch information
kzrfaisal and faisal-hearth authored May 24, 2020
1 parent 8828843 commit 3ef87f9
Show file tree
Hide file tree
Showing 60 changed files with 13,301 additions and 9,445 deletions.
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Editor configuration, see http://editorconfig.org
# Editor configuration, see https://editorconfig.org
root = true

[*]
Expand All @@ -8,6 +8,9 @@ indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out

# dependencies
/node_modules

# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json

# IDEs and editors
/.idea
.project
Expand All @@ -23,6 +29,7 @@
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# misc
/.sass-cache
Expand Down
7 changes: 0 additions & 7 deletions Future Updates.txt

This file was deleted.

21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

173 changes: 165 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Angular file uploader is an Angular 2/4/5/6/7/8 file uploader module with Real-Time Progress Bar, Angular Universal Compatibility and multiple themes which includes Drag and Drop and much more.

Angular file uploader supports angular versions 2.x - 9.x and comes with Real-Time Progress Bar, Responsive design, Angular Universal Compatibility and multiple themes which includes Drag and Drop and much more.

### Demo
<https://kzrfaisal.github.io/#/afu>
Expand Down Expand Up @@ -71,8 +72,9 @@ npm i angular-file-uploader
dragNDropBox: 'Drag N Drop',
attachPinBtn: 'Attach Files...',
afterUploadMsg_success: 'Successfully Uploaded !',
afterUploadMsg_error: 'Upload Failed !'
};
afterUploadMsg_error: 'Upload Failed !',
sizeLimit: 'Size Limit'
}
};
```

Expand Down Expand Up @@ -127,9 +129,9 @@ You have seen that by using 'resetUpload' property, you can reset the module eas
to reset the module hassle-free anytime.
### Styling:
###### Following classes are available for customisation :
###### *Include them in your global css class (src/styles.css)*
###### *Use '!important' if something doesn't works*
##### Following classes are available for customisation :
##### *Include them in your global css class (src/styles.css)*
##### *Use '!important' if something doesn't works*
- .afu-select-btn {}
- .afu-reset-btn {}
- .afu-upload-btn {}
Expand All @@ -142,13 +144,15 @@ You have seen that by using 'resetUpload' property, you can reset the module eas
- .afu-upload-status {}
- .afu-attach-pin {}

##### Points to note:
#### Points to note:
- Files are uploaded in FormData format.

### Coming Soon:
- More themes.
- More customization options.

---
#### For Versions < 6.x : [Click Here !](https://github.com/kzrfaisal/angular-file-uploader#for-versions--6x-)
---
---
#### For Versions < 5.x : [Click Here !](https://github.com/kzrfaisal/angular-file-uploader#for-versions--5x-)
---
Expand All @@ -158,6 +162,159 @@ You have seen that by using 'resetUpload' property, you can reset the module eas
#### For Versions < 2.x : [Click Here !](https://github.com/kzrfaisal/angular-file-uploader#for-versions--2x-)
---
---
#### For Versions < 6.x :
Angular file uploader is an Angular 2/4/5/6 file uploader module with Real-Time Progress Bar, Angular Universal Compatibility and multiple themes which includes Drag and Drop and much more.

### Demo
<https://kzrfaisal.github.io/#/afu>
### Install
```
npm i angular-file-uploader
```
### Usage
- Bootstrap.min.css is required.
Include
```html
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
```
in your index.html.
- Import AngularFileUploaderModule inside your app.module.ts
```javascript
import { AngularFileUploaderModule } from "angular-file-uploader";
```
```javascript
@NgModule({
imports: [
...,
AngularFileUploaderModule,
...
]
})
```
##### Example-1 ( with minimal configuration )
```html
<angular-file-uploader
[config]="afuConfig">
</angular-file-uploader>
```
```javascript
afuConfig = {
uploadAPI: {
url:"https://example-file-upload-api"
}
};
```
##### Example-2 ( with all available configuration )
```html
<angular-file-uploader
[config]="afuConfig"
[resetUpload]=resetVar
(ApiResponse)="DocUpload($event)">
</angular-file-uploader>
```
```javascript
afuConfig = {
multiple: false,
formatsAllowed: ".jpg,.png",
maxSize: "1",
uploadAPI: {
url:"https://example-file-upload-api",
method:"POST",
headers: {
"Content-Type" : "text/plain;charset=UTF-8",
"Authorization" : `Bearer ${token}`
}
},
theme: "dragNDrop",
hideProgressBar: true,
hideResetBtn: true,
hideSelectBtn: true,
replaceTexts: {
selectFileBtn: 'Select Files',
resetBtn: 'Reset',
uploadBtn: 'Upload',
dragNDropBox: 'Drag N Drop',
attachPinBtn: 'Attach Files...',
afterUploadMsg_success: 'Successfully Uploaded !',
afterUploadMsg_error: 'Upload Failed !'
};
};
```

| **Properties** | **Description** | **Default Value** |
|----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|
| config : object | It's a javascript object. Use this to add custom constraints to the module. All available key-value pairs are given in example 2.For detailed decription refer the table below. | {} |
| ApiResponse:EventEmitter | It will return the response it gets back from the uploadAPI. Assign one custom function ,for example " DocUpload($event) " here, where " $event " will contain the response from the api. | |
| resetUpload : boolean | Give it's value as " true " whenever you want to clear the list of uploads being displayed. It's better to assign one boolean variable ('resetVar' here)to it and then change that variable's value. Remember to change 'resetVar' value 'true' to 'false' after every reset. | false |


| **[config]** | **Description** | **Default Value** |
|----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------|
| multiple : boolean | Set it as " true " for uploading multiple files at a time and as " false " for single file at a time. | false |
| formatsAllowed : string | Specify the formats of file you want to upload. | '.jpg,.png,.pdf,.docx, .txt,.gif,.jpeg'|
| maxSize : number | Maximum size limit for files in MB. | 20 MB |
| uploadAPI.url : string | Complete api url to which you want to upload. | undefined |
| uploadAPI.method : string | HTTP method to use for upload. | POST |
| uploadAPI.headers : {} | Provide headers you need here. | {} |
| theme : string | Specify the theme name you want to apply. Available Themes: ' dragNDrop ', ' attachPin ' | If no theme or wrong theme is specified, default theme will be used instead.|
| hideProgressBar:boolean | Set it as " true " to hide the Progress bar. | false |
| hideResetBtn:boolean | Set it as " true " to hide the 'Reset' Button. | false |
| hideSelectBtn:boolean | Set it as " true " to hide the 'Select File' Button. | false |
| replaceTexts:object | Replace default texts with your own custom texts. | refer to example-2|

---
##### A Better Way to reset the module
You have seen that by using 'resetUpload' property, you can reset the module easily, however if you need to reset more than one time, there's a better way of doing that( bcoz in 'resetUpload' property, you have to make it as false in order to use it again):-
###### Example-3
```html
<angular-file-uploader #fileUpload1
[config]="afuConfig"
[resetUpload]=resetVar
(ApiResponse)="DocUpload($event)">
</angular-file-uploader>
```
- Assign one local reference variable (here 'fileUpload1') to the component.
- Now use this local reference variable in your xyz.component.ts file.
```javascript
@ViewChild('fileUpload1')
private fileUpload1: AngularFileUploaderComponent;
```
- Remember to import ViewChild and AngularFileUploaderComponent properly in your component.
```javascript
import { ViewChild } from '@angular/core';
import { AngularFileUploaderComponent } from "angular-file-uploader";
```
- That's it.....all done, now just use
```javascript
this.fileUpload1.resetFileUpload();
```
to reset the module hassle-free anytime.

### Styling:
###### Following classes are available for customisation :
###### *Include them in your global css class (src/styles.css)*
###### *Use '!important' if something doesn't works*
- .afu-select-btn {}
- .afu-reset-btn {}
- .afu-upload-btn {}
- .afu-dragndrop-box {}
- .afu-dragndrop-text {}
- .afu-constraints-info {}
- .afu-valid-file {}
- .afu-invalid-file {}
- .afu-progress-bar {}
- .afu-upload-status {}
- .afu-attach-pin {}
##### Points to note:
- Files are uploaded in FormData format.
### Coming Soon:
- More themes.
- More customization options.
---
---
#### For Versions < 5.x :
Angular file uploader is an Angular 2/4/5/6 file uploader module with Real-Time Progress Bar, Angular Universal Compatibility and multiple themes which includes Drag and Drop and much more.
Expand Down
Loading

0 comments on commit 3ef87f9

Please sign in to comment.