Skip to content

Commit b718918

Browse files
committed
Release 8.0.0
1 parent 68bf00a commit b718918

File tree

8 files changed

+48
-48
lines changed

8 files changed

+48
-48
lines changed

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ export class AppModule {}
7777

7878
```typescript
7979
import { Component } from "@angular/core";
80-
import { Uploader, UploaderOptions, UploaderResult } from "uploader";
80+
import { Uploader, UploadWidgetConfig, UploadWidgetResult } from "uploader";
8181

8282
@Component({
8383
selector: "app-root",
8484
template: `
8585
<button uploadButton
86-
[uploadComplete]="uploadComplete"
87-
[uploadOptions]="uploadOptions"
86+
[uploadComplete]="onComplete"
87+
[uploadOptions]="options"
8888
[uploader]="uploader">
8989
Upload a file...
9090
</button>
@@ -94,11 +94,11 @@ export class AppComponent {
9494
uploader = new Uploader({
9595
apiKey: "free" // <-- Get production-ready API keys from Upload.io
9696
});
97-
uploadOptions: UploaderOptions = {
97+
options: UploadWidgetConfig = {
9898
multi: false
9999
};
100-
uploadComplete = (files: UploaderResult[]) => {
101-
console.log(files.map(x => x.fileUrl));
100+
onComplete = (files: UploadWidgetResult[]) => {
101+
alert(files.map(x => x.fileUrl).join("\n"));
102102
};
103103
}
104104
```
@@ -150,20 +150,20 @@ The `uploadButton` directive displays a file upload modal on click.
150150
Inputs:
151151

152152
- `uploader` (required): an instance of the [`Uploader` class](https://github.com/upload-io/uploader/blob/main/lib/src/Uploader.tsx).
153-
- `uploadOptions` (optional): an object following the [`UploaderOptions` interface](https://github.com/upload-io/uploader/blob/main/lib/src/UploaderOptions.ts).
153+
- `uploadOptions` (optional): an object following the [`UploadWidgetConfig` interface](https://github.com/upload-io/uploader/blob/main/lib/src/UploadWidgetConfig.ts).
154154
- `uploadComplete` (optional): a callback containing a single parameter — an array of uploaded files.
155155

156156
```typescript
157157
import { Component } from "@angular/core";
158-
import { Uploader, UploaderOptions, UploaderResult } from "uploader";
158+
import { Uploader, UploadWidgetConfig, UploadWidgetResult } from "uploader";
159159

160160
@Component({
161161
selector: "app-root",
162162
template: `
163163
<button uploadButton
164164
[uploader]="uploader"
165-
[uploadOptions]="uploadOptions"
166-
[uploadComplete]="uploadComplete">
165+
[uploadOptions]="options"
166+
[uploadComplete]="onComplete">
167167
Upload a file...
168168
</button>
169169
`
@@ -172,11 +172,11 @@ export class AppComponent {
172172
uploader = new Uploader({
173173
apiKey: "free"
174174
});
175-
uploadOptions: UploaderOptions = {
175+
options: UploadWidgetConfig = {
176176
multi: false
177177
};
178-
uploadComplete = (files: UploaderResult[]) => {
179-
console.log(files.map(x => x.fileUrl));
178+
onComplete = (files: UploadWidgetResult[]) => {
179+
alert(files.map(x => x.fileUrl).join("\n"));
180180
};
181181
}
182182
```
@@ -188,15 +188,15 @@ The `upload-dropzone` component renders an inline drag-and-drop file uploader.
188188
Inputs:
189189

190190
- `uploader` (required): an instance of the [`Uploader` class](https://github.com/upload-io/uploader/blob/main/lib/src/Uploader.tsx).
191-
- `options` (optional): an object following the [`UploaderOptions` interface](https://github.com/upload-io/uploader/blob/main/lib/src/UploaderOptions.ts).
191+
- `options` (optional): an object following the [`UploadWidgetConfig` interface](https://github.com/upload-io/uploader/blob/main/lib/src/UploadWidgetConfig.ts).
192192
- `onComplete` (optional): a callback containing the array of uploaded files as its parameter.
193193
- `onUpdate` (optional): same as above, but called after every file upload or removal.
194194
- `width` (optional): width of the dropzone.
195195
- `height` (optional): height of the dropzone.
196196

197197
```typescript
198198
import { Component } from "@angular/core";
199-
import { Uploader, UploaderOptions, UploaderResult } from "uploader";
199+
import { Uploader, UploadWidgetConfig, UploadWidgetResult } from "uploader";
200200

201201
@Component({
202202
selector: "app-root",
@@ -213,16 +213,16 @@ export class AppComponent {
213213
uploader = new Uploader({
214214
apiKey: "free"
215215
});
216-
options: UploaderOptions = {
216+
options: UploadWidgetConfig = {
217217
multi: false
218218
};
219219
// 'onUpdate' explained:
220220
// - Dropzones are non-terminal by default (i.e. they don't have an
221221
// end state), so we use 'onUpdate' instead of 'onComplete'.
222222
// - To create a terminal dropzone, add a 'onComplete' attribute
223223
// to the component and add the 'showFinishButton: true' option.
224-
onUpdate = (files: UploaderResult[]) => {
225-
console.log(files.map(x => x.fileUrl));
224+
onUpdate = (files: UploadWidgetResult[]) => {
225+
alert(files.map(x => x.fileUrl).join("\n"));
226226
};
227227
width = "600px";
228228
height = "375px";
@@ -231,7 +231,7 @@ export class AppComponent {
231231

232232
## The Result
233233

234-
The callbacks receive a `Array<UploaderResult>`:
234+
The callbacks receive a `Array<UploadWidgetResult>`:
235235

236236
```javascript
237237
{

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"@angular/router": "~13.3.0",
3535
"rxjs": "~7.5.0",
3636
"tslib": "^2.3.0",
37-
"uploader": "^2.6.4",
37+
"uploader": "^3.0.1",
3838
"zone.js": "~0.11.4"
3939
},
4040
"devDependencies": {

projects/angular-uploader/package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

projects/angular-uploader/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"peerDependencies": {
5555
"@angular/common": "^13.3.0",
5656
"@angular/core": "^13.3.0",
57-
"uploader": "^2.6.4"
57+
"uploader": "^3.0.1"
5858
},
5959
"dependencies": {}
6060
}

projects/angular-uploader/src/lib/upload-button.directive.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { Directive, HostListener, Input, OnInit } from "@angular/core";
2-
import { UploaderInterface, UploaderOptions, UploaderResult } from "uploader";
2+
import { UploaderInterface, UploadWidgetConfig, UploadWidgetResult } from "uploader";
33

44
@Directive({
55
selector: "[uploadButton]"
66
})
77
export class UploadButtonDirective implements OnInit {
8-
@Input("uploadOptions") options?: UploaderOptions;
8+
@Input("uploadOptions") options?: UploadWidgetConfig;
99
@Input("uploader") uploader?: UploaderInterface;
10-
@Input("uploadComplete") onComplete?: (files: UploaderResult[]) => void;
10+
@Input("uploadComplete") onComplete?: (files: UploadWidgetResult[]) => void;
1111

1212
@HostListener("click", ["$event"]) onClick(event: any) {
1313
event.preventDefault();

projects/angular-uploader/src/lib/upload-dropzone.component.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AfterViewInit, Component, ElementRef, Input, ViewChild } from "@angular/core";
2-
import { UploaderInterface, UploaderOptions, UploaderResult } from "uploader";
2+
import { UploaderInterface, UploadWidgetConfig, UploadWidgetResult } from "uploader";
33

44
@Component({
55
selector: "upload-dropzone",
@@ -9,17 +9,17 @@ import { UploaderInterface, UploaderOptions, UploaderResult } from "uploader";
99
styles: []
1010
})
1111
export class UploadDropzoneComponent implements AfterViewInit {
12-
@Input("options") options?: UploaderOptions;
12+
@Input("options") options?: UploadWidgetConfig;
1313
@Input("uploader") uploader?: UploaderInterface;
14-
@Input("onComplete") onComplete?: (files: UploaderResult[]) => void;
15-
@Input("onUpdate") onUpdate?: (files: UploaderResult[]) => void;
14+
@Input("onComplete") onComplete?: (files: UploadWidgetResult[]) => void;
15+
@Input("onUpdate") onUpdate?: (files: UploadWidgetResult[]) => void;
1616
@Input("width") width: string = "600px";
1717
@Input("height") height: string = "375px";
1818

1919
@ViewChild("container") container!: ElementRef;
2020

2121
ngAfterViewInit() {
22-
const onUpdateParams: UploaderOptions = this.onUpdate === undefined ? {} : { onUpdate: this.onUpdate };
22+
const onUpdateParams: UploadWidgetConfig = this.onUpdate === undefined ? {} : { onUpdate: this.onUpdate };
2323

2424
this.getUploader()
2525
.open({

projects/sandbox/src/app/app.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component } from "@angular/core";
2-
import { Uploader, UploaderOptions, UploaderResult } from "uploader";
2+
import { Uploader, UploadWidgetConfig, UploadWidgetResult } from "uploader";
33

44
@Component({
55
selector: "app-root",
@@ -21,10 +21,10 @@ import { Uploader, UploaderOptions, UploaderResult } from "uploader";
2121
})
2222
export class AppComponent {
2323
uploader = Uploader({ apiKey: "free" });
24-
uploadComplete = (files: UploaderResult[]) => {
24+
uploadComplete = (files: UploadWidgetResult[]) => {
2525
console.log(files.map(x => x.fileUrl));
2626
};
27-
uploadOptions: UploaderOptions = {
27+
uploadOptions: UploadWidgetConfig = {
2828
multi: false
2929
};
3030
}

0 commit comments

Comments
 (0)