@uppy/angular 0.7.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +1 -1
  2. package/ng-package.json +7 -0
  3. package/package.json +13 -23
  4. package/src/lib/components/dashboard/dashboard-demo.component.ts +14 -0
  5. package/src/lib/components/dashboard/dashboard.component.spec.ts +24 -0
  6. package/src/lib/components/dashboard/dashboard.component.ts +52 -0
  7. package/src/lib/components/dashboard/dashboard.stories.ts +15 -0
  8. package/src/lib/components/dashboard-modal/dashboard-modal-demo.component.ts +17 -0
  9. package/src/lib/components/dashboard-modal/dashboard-modal.component.spec.ts +24 -0
  10. package/src/lib/components/dashboard-modal/dashboard-modal.component.ts +66 -0
  11. package/src/lib/components/dashboard-modal/dashboard-modal.stories.ts +15 -0
  12. package/src/lib/components/drag-drop/drag-drop-demo.component.ts +14 -0
  13. package/src/lib/components/drag-drop/drag-drop.component.spec.ts +24 -0
  14. package/src/lib/components/drag-drop/drag-drop.component.ts +52 -0
  15. package/src/lib/components/drag-drop/drag-drop.stories.ts +15 -0
  16. package/src/lib/components/progress-bar/progress-bar-demo.component.ts +100 -0
  17. package/src/lib/components/progress-bar/progress-bar.component.spec.ts +24 -0
  18. package/src/lib/components/progress-bar/progress-bar.component.ts +52 -0
  19. package/src/lib/components/progress-bar/progress-bar.stories.ts +17 -0
  20. package/src/lib/components/status-bar/status-bar-demo.component.ts +30 -0
  21. package/src/lib/components/status-bar/status-bar.component.spec.ts +24 -0
  22. package/src/lib/components/status-bar/status-bar.component.ts +52 -0
  23. package/src/lib/components/status-bar/status-bar.stories.ts +15 -0
  24. package/src/lib/utils/wrapper.ts +58 -0
  25. package/src/public-api.ts +9 -0
  26. package/tsconfig.lib.json +12 -0
  27. package/tsconfig.lib.prod.json +10 -0
  28. package/tsconfig.spec.json +9 -0
  29. package/esm2022/lib/components/dashboard/dashboard.component.mjs +0 -37
  30. package/esm2022/lib/components/dashboard/dashboard.module.mjs +0 -17
  31. package/esm2022/lib/components/dashboard-modal/dashboard-modal.component.mjs +0 -53
  32. package/esm2022/lib/components/dashboard-modal/dashboard-modal.module.mjs +0 -17
  33. package/esm2022/lib/components/drag-drop/drag-drop.component.mjs +0 -37
  34. package/esm2022/lib/components/drag-drop/drag-drop.module.mjs +0 -17
  35. package/esm2022/lib/components/progress-bar/progress-bar.component.mjs +0 -37
  36. package/esm2022/lib/components/progress-bar/progress-bar.module.mjs +0 -17
  37. package/esm2022/lib/components/status-bar/status-bar.component.mjs +0 -37
  38. package/esm2022/lib/components/status-bar/status-bar.module.mjs +0 -17
  39. package/esm2022/lib/utils/wrapper.mjs +0 -31
  40. package/esm2022/public-api.mjs +0 -14
  41. package/esm2022/uppy-angular.mjs +0 -5
  42. package/fesm2022/uppy-angular.mjs +0 -295
  43. package/fesm2022/uppy-angular.mjs.map +0 -1
  44. package/index.d.ts +0 -5
  45. package/lib/components/dashboard/dashboard.component.d.ts +0 -17
  46. package/lib/components/dashboard/dashboard.module.d.ts +0 -9
  47. package/lib/components/dashboard-modal/dashboard-modal.component.d.ts +0 -19
  48. package/lib/components/dashboard-modal/dashboard-modal.module.d.ts +0 -9
  49. package/lib/components/drag-drop/drag-drop.component.d.ts +0 -17
  50. package/lib/components/drag-drop/drag-drop.module.d.ts +0 -9
  51. package/lib/components/progress-bar/progress-bar.component.d.ts +0 -17
  52. package/lib/components/progress-bar/progress-bar.module.d.ts +0 -9
  53. package/lib/components/status-bar/status-bar.component.d.ts +0 -17
  54. package/lib/components/status-bar/status-bar.module.d.ts +0 -9
  55. package/lib/utils/wrapper.d.ts +0 -16
  56. package/public-api.d.ts +0 -10
package/README.md CHANGED
@@ -20,7 +20,7 @@ Uppy is being developed by the folks at [Transloadit](https://transloadit.com),
20
20
  $ npm install @uppy/angular --save
21
21
  ```
22
22
 
23
- Alternatively, you can also use this plugin in a pre-built bundle from Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions.
23
+ Alternatively, you can also use this plugin in a pre-built bundle from Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions.
24
24
 
25
25
  ## Documentation
26
26
 
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../../dist/uppy/angular",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@uppy/angular",
3
3
  "description": "Angular component wrappers around Uppy's official UI plugins.",
4
- "version": "0.7.0",
4
+ "version": "0.8.1",
5
5
  "license": "MIT",
6
6
  "homepage": "https://uppy.io",
7
7
  "keywords": [
@@ -18,31 +18,21 @@
18
18
  "type": "git",
19
19
  "url": "git+https://github.com/transloadit/uppy.git"
20
20
  },
21
+ "scripts": {
22
+ "prepublishOnly": "rm -fr * && cp -r ../../../dist/uppy/angular .."
23
+ },
21
24
  "dependencies": {
22
25
  "tslib": "^2.0.0"
23
26
  },
24
27
  "peerDependencies": {
25
- "@angular/common": "^17.0.0 || ^18.0.0",
26
- "@angular/core": "^17.0.0 || ^18.0.0",
27
- "@uppy/core": "^4.0.0",
28
- "@uppy/dashboard": "^4.0.0",
29
- "@uppy/drag-drop": "^4.0.0",
30
- "@uppy/progress-bar": "^4.0.0",
31
- "@uppy/status-bar": "^4.0.0",
32
- "@uppy/utils": "^6.0.0"
28
+ "@angular/common": "^17.0.0 || ^18.0.0 || ^19.0.0",
29
+ "@angular/core": "^17.0.0 || ^18.0.0 || ^19.0.0",
30
+ "@uppy/core": "^4.5.1",
31
+ "@uppy/dashboard": "^4.4.1",
32
+ "@uppy/drag-drop": "^4.2.1",
33
+ "@uppy/progress-bar": "^4.3.1",
34
+ "@uppy/status-bar": "^4.2.1",
35
+ "@uppy/utils": "^6.2.1"
33
36
  },
34
- "sideEffects": false,
35
- "module": "fesm2022/uppy-angular.mjs",
36
- "typings": "index.d.ts",
37
- "exports": {
38
- "./package.json": {
39
- "default": "./package.json"
40
- },
41
- ".": {
42
- "types": "./index.d.ts",
43
- "esm2022": "./esm2022/uppy-angular.mjs",
44
- "esm": "./esm2022/uppy-angular.mjs",
45
- "default": "./fesm2022/uppy-angular.mjs"
46
- }
47
- }
37
+ "sideEffects": false
48
38
  }
@@ -0,0 +1,14 @@
1
+ import { ChangeDetectionStrategy, Component } from "@angular/core";
2
+ import { Uppy } from "@uppy/core";
3
+ import type * as Dashboard from "@uppy/dashboard";
4
+ import type { Body, Meta } from "@uppy/utils/lib/UppyFile";
5
+
6
+ @Component({
7
+ selector: "uppy-dashboard-demo",
8
+ template: `<uppy-dashboard [uppy]="uppy" [props]="props"></uppy-dashboard>`,
9
+ changeDetection: ChangeDetectionStrategy.OnPush,
10
+ })
11
+ export class DashboardDemoComponent<M extends Meta, B extends Body> {
12
+ uppy: Uppy<M, B> = new Uppy({ debug: true, autoProceed: true });
13
+ props?: Dashboard.DashboardOptions<M, B>;
14
+ }
@@ -0,0 +1,24 @@
1
+ import { async, type ComponentFixture, TestBed } from "@angular/core/testing";
2
+
3
+ import { DashboardComponent } from "./dashboard.component";
4
+
5
+ describe("DashboardComponent", () => {
6
+ let component: DashboardComponent;
7
+ let fixture: ComponentFixture<DashboardComponent>;
8
+
9
+ beforeEach(async(() => {
10
+ TestBed.configureTestingModule({
11
+ declarations: [DashboardComponent],
12
+ }).compileComponents();
13
+ }));
14
+
15
+ beforeEach(() => {
16
+ fixture = TestBed.createComponent(DashboardComponent);
17
+ component = fixture.componentInstance;
18
+ fixture.detectChanges();
19
+ });
20
+
21
+ it("should create", () => {
22
+ expect(component).toBeTruthy();
23
+ });
24
+ });
@@ -0,0 +1,52 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ Component,
4
+ ElementRef,
5
+ Input,
6
+ inject,
7
+ type OnChanges,
8
+ type OnDestroy,
9
+ type SimpleChanges,
10
+ } from "@angular/core";
11
+ import { Uppy } from "@uppy/core";
12
+ import type { DashboardOptions } from "@uppy/dashboard";
13
+ import Dashboard from "@uppy/dashboard";
14
+ import type { Body, Meta } from "@uppy/utils/lib/UppyFile";
15
+ import { UppyAngularWrapper } from "../../utils/wrapper";
16
+
17
+ @Component({
18
+ selector: "uppy-dashboard",
19
+ template: "",
20
+ changeDetection: ChangeDetectionStrategy.OnPush,
21
+ })
22
+ export class DashboardComponent<M extends Meta, B extends Body>
23
+ extends UppyAngularWrapper<M, B, DashboardOptions<M, B>>
24
+ implements OnDestroy, OnChanges
25
+ {
26
+ el = inject(ElementRef);
27
+
28
+ @Input() uppy: Uppy<M, B> = new Uppy();
29
+ @Input() props: DashboardOptions<M, B> = {};
30
+
31
+ /** Inserted by Angular inject() migration for backwards compatibility */
32
+ constructor(...args: unknown[]);
33
+
34
+ constructor() {
35
+ super();
36
+ }
37
+
38
+ ngOnInit() {
39
+ this.onMount(
40
+ { id: "angular:Dashboard", inline: true, target: this.el.nativeElement },
41
+ Dashboard,
42
+ );
43
+ }
44
+
45
+ ngOnChanges(changes: SimpleChanges): void {
46
+ this.handleChanges(changes, Dashboard);
47
+ }
48
+
49
+ ngOnDestroy(): void {
50
+ this.uninstall();
51
+ }
52
+ }
@@ -0,0 +1,15 @@
1
+ import { moduleMetadata } from "@storybook/angular";
2
+ import { DashboardDemoComponent } from "./dashboard-demo.component";
3
+
4
+ export default {
5
+ title: "Dashboard",
6
+ decorators: [
7
+ moduleMetadata({
8
+ declarations: [DashboardDemoComponent],
9
+ }),
10
+ ],
11
+ };
12
+
13
+ export const Default = () => ({
14
+ component: DashboardDemoComponent,
15
+ });
@@ -0,0 +1,17 @@
1
+ import { ChangeDetectionStrategy, Component } from "@angular/core";
2
+ import { Uppy } from "@uppy/core";
3
+ import type * as Dashboard from "@uppy/dashboard";
4
+ import type { Body, Meta } from "@uppy/utils/lib/UppyFile";
5
+
6
+ @Component({
7
+ selector: "uppy-dashboard-demo",
8
+ template: `<uppy-dashboard-modal
9
+ [uppy]="uppy"
10
+ [props]="props"
11
+ ></uppy-dashboard-modal>`,
12
+ changeDetection: ChangeDetectionStrategy.OnPush,
13
+ })
14
+ export class DashboardModalDemoComponent<M extends Meta, B extends Body> {
15
+ uppy: Uppy<M, B> = new Uppy({ debug: true, autoProceed: true });
16
+ props?: Dashboard.DashboardOptions<M, B>;
17
+ }
@@ -0,0 +1,24 @@
1
+ import { async, type ComponentFixture, TestBed } from "@angular/core/testing";
2
+
3
+ import { DashboardModalComponent } from "./dashboard-modal.component";
4
+
5
+ describe("DashboardComponent", () => {
6
+ let component: DashboardModalComponent;
7
+ let fixture: ComponentFixture<DashboardModalComponent>;
8
+
9
+ beforeEach(async(() => {
10
+ TestBed.configureTestingModule({
11
+ declarations: [DashboardModalComponent],
12
+ }).compileComponents();
13
+ }));
14
+
15
+ beforeEach(() => {
16
+ fixture = TestBed.createComponent(DashboardModalComponent);
17
+ component = fixture.componentInstance;
18
+ fixture.detectChanges();
19
+ });
20
+
21
+ it("should create", () => {
22
+ expect(component).toBeTruthy();
23
+ });
24
+ });
@@ -0,0 +1,66 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ Component,
4
+ ElementRef,
5
+ Input,
6
+ inject,
7
+ type OnChanges,
8
+ type OnDestroy,
9
+ type SimpleChanges,
10
+ } from "@angular/core";
11
+ import { Uppy } from "@uppy/core";
12
+ import type { DashboardOptions } from "@uppy/dashboard";
13
+ import Dashboard from "@uppy/dashboard";
14
+ import type { Body, Meta } from "@uppy/utils/lib/UppyFile";
15
+ import { UppyAngularWrapper } from "../../utils/wrapper";
16
+
17
+ @Component({
18
+ selector: "uppy-dashboard-modal",
19
+ template: "",
20
+ changeDetection: ChangeDetectionStrategy.OnPush,
21
+ })
22
+ export class DashboardModalComponent<M extends Meta, B extends Body>
23
+ extends UppyAngularWrapper<M, B, DashboardOptions<M, B>, Dashboard<M, B>>
24
+ implements OnDestroy, OnChanges
25
+ {
26
+ el = inject(ElementRef);
27
+
28
+ @Input() uppy: Uppy<M, B> = new Uppy();
29
+ @Input() props: DashboardOptions<M, B> = {};
30
+ @Input() open: boolean = false;
31
+
32
+ /** Inserted by Angular inject() migration for backwards compatibility */
33
+ constructor(...args: unknown[]);
34
+
35
+ constructor() {
36
+ super();
37
+ }
38
+
39
+ ngOnInit() {
40
+ this.onMount(
41
+ {
42
+ id: "angular:DashboardModal",
43
+ inline: false,
44
+ target: this.el.nativeElement,
45
+ },
46
+ Dashboard,
47
+ );
48
+ }
49
+
50
+ ngOnChanges(changes: SimpleChanges): void {
51
+ this.handleChanges(changes, Dashboard);
52
+ // Handle dashboard-modal specific changes
53
+ if (changes["open"] && this.open !== changes["open"].previousValue) {
54
+ if (this.open && !changes["open"].previousValue) {
55
+ this.plugin!.openModal();
56
+ }
57
+ if (!this.open && changes["open"].previousValue) {
58
+ this.plugin!.closeModal();
59
+ }
60
+ }
61
+ }
62
+
63
+ ngOnDestroy(): void {
64
+ this.uninstall();
65
+ }
66
+ }
@@ -0,0 +1,15 @@
1
+ import { moduleMetadata } from "@storybook/angular";
2
+ import { DashboardModalDemoComponent } from "./dashboard-modal-demo.component";
3
+
4
+ export default {
5
+ title: "Dashboard",
6
+ decorators: [
7
+ moduleMetadata({
8
+ declarations: [DashboardModalDemoComponent],
9
+ }),
10
+ ],
11
+ };
12
+
13
+ export const Default = () => ({
14
+ component: DashboardModalDemoComponent,
15
+ });
@@ -0,0 +1,14 @@
1
+ import { ChangeDetectionStrategy, Component } from "@angular/core";
2
+ import { Uppy } from "@uppy/core";
3
+ import type * as DragDrop from "@uppy/drag-drop";
4
+ import type { Body, Meta } from "@uppy/utils/lib/UppyFile";
5
+
6
+ @Component({
7
+ selector: "uppy-drag-drop-demo",
8
+ template: ` <uppy-drag-drop [uppy]="uppy" [props]="props"></uppy-drag-drop> `,
9
+ changeDetection: ChangeDetectionStrategy.OnPush,
10
+ })
11
+ export class DragDropDemoComponent<M extends Meta, B extends Body> {
12
+ uppy: Uppy<M, B> = new Uppy({ debug: true, autoProceed: true });
13
+ props: DragDrop.DragDropOptions = {};
14
+ }
@@ -0,0 +1,24 @@
1
+ import { async, type ComponentFixture, TestBed } from "@angular/core/testing";
2
+
3
+ import { DragDropComponent } from "./drag-drop.component";
4
+
5
+ describe("DragDropComponent", () => {
6
+ let component: DragDropComponent;
7
+ let fixture: ComponentFixture<DragDropComponent>;
8
+
9
+ beforeEach(async(() => {
10
+ TestBed.configureTestingModule({
11
+ declarations: [DragDropComponent],
12
+ }).compileComponents();
13
+ }));
14
+
15
+ beforeEach(() => {
16
+ fixture = TestBed.createComponent(DragDropComponent);
17
+ component = fixture.componentInstance;
18
+ fixture.detectChanges();
19
+ });
20
+
21
+ it("should create", () => {
22
+ expect(component).toBeTruthy();
23
+ });
24
+ });
@@ -0,0 +1,52 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ Component,
4
+ ElementRef,
5
+ Input,
6
+ inject,
7
+ type OnChanges,
8
+ type OnDestroy,
9
+ type SimpleChanges,
10
+ } from "@angular/core";
11
+ import { Uppy } from "@uppy/core";
12
+ import type { DragDropOptions } from "@uppy/drag-drop";
13
+ import DragDrop from "@uppy/drag-drop";
14
+ import type { Body, Meta } from "@uppy/utils/lib/UppyFile";
15
+ import { UppyAngularWrapper } from "../../utils/wrapper";
16
+
17
+ @Component({
18
+ selector: "uppy-drag-drop",
19
+ template: "",
20
+ changeDetection: ChangeDetectionStrategy.OnPush,
21
+ })
22
+ export class DragDropComponent<M extends Meta, B extends Body>
23
+ extends UppyAngularWrapper<M, B, DragDropOptions>
24
+ implements OnDestroy, OnChanges
25
+ {
26
+ el = inject(ElementRef);
27
+
28
+ @Input() uppy: Uppy<M, B> = new Uppy();
29
+ @Input() props: DragDropOptions = {};
30
+
31
+ /** Inserted by Angular inject() migration for backwards compatibility */
32
+ constructor(...args: unknown[]);
33
+
34
+ constructor() {
35
+ super();
36
+ }
37
+
38
+ ngOnInit() {
39
+ this.onMount(
40
+ { id: "angular:DragDrop", target: this.el.nativeElement },
41
+ DragDrop,
42
+ );
43
+ }
44
+
45
+ ngOnChanges(changes: SimpleChanges): void {
46
+ this.handleChanges(changes, DragDrop);
47
+ }
48
+
49
+ ngOnDestroy(): void {
50
+ this.uninstall();
51
+ }
52
+ }
@@ -0,0 +1,15 @@
1
+ import { moduleMetadata } from "@storybook/angular";
2
+ import { DragDropDemoComponent } from "./drag-drop-demo.component";
3
+
4
+ export default {
5
+ title: "Drag Drop",
6
+ decorators: [
7
+ moduleMetadata({
8
+ declarations: [DragDropDemoComponent],
9
+ }),
10
+ ],
11
+ };
12
+
13
+ export const Default = () => ({
14
+ component: DragDropDemoComponent,
15
+ });
@@ -0,0 +1,100 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ ChangeDetectorRef,
4
+ Component,
5
+ inject,
6
+ type OnInit,
7
+ } from "@angular/core";
8
+ import { Uppy } from "@uppy/core";
9
+ import type { ProgressBarOptions } from "@uppy/progress-bar";
10
+ import Tus from "@uppy/tus";
11
+ import type { Body, Meta } from "@uppy/utils/lib/UppyFile";
12
+
13
+ @Component({
14
+ selector: "uppy-progress-bar-demo",
15
+ template: `
16
+ <section class="example-one">
17
+ <h5>autoProceed is on</h5>
18
+
19
+ <!-- Target DOM node #1 -->
20
+ <uppy-drag-drop [uppy]="uppyOne"></uppy-drag-drop>
21
+
22
+ <!-- Progress bar #1 -->
23
+ <uppy-progress-bar [uppy]="uppyOne" [props]="props"></uppy-progress-bar>
24
+
25
+ <!-- Uploaded files list #1 -->
26
+ <div class="uploaded-files" *ngIf="fileListOne?.length">
27
+ <h5>Uploaded files:</h5>
28
+ <ol>
29
+ <li *ngFor="let item of fileListOne">
30
+ <a [href]="item.url" target="_blank"> {{ item.fileName }}</a>
31
+ </li>
32
+ </ol>
33
+ </div>
34
+ </section>
35
+
36
+ <section class="example-two">
37
+ <h5>autoProceed is off</h5>
38
+
39
+ <!-- Target DOM node #1 -->
40
+ <uppy-drag-drop [uppy]="uppyTwo"></uppy-drag-drop>
41
+
42
+ <!-- Progress bar #1 -->
43
+ <uppy-progress-bar [uppy]="uppyTwo" [props]="props"></uppy-progress-bar>
44
+
45
+ <button (click)="upload()" class="upload-button">Upload</button>
46
+
47
+ <!-- Uploaded files list #2 -->
48
+ <div class="uploaded-files" *ngIf="fileListTwo?.length">
49
+ <h5>Uploaded files:</h5>
50
+ <ol>
51
+ <li *ngFor="let item of fileListTwo">
52
+ <a [href]="item.url" target="_blank"> {{ item.fileName }}</a>
53
+ </li>
54
+ </ol>
55
+ </div>
56
+ </section>
57
+ `,
58
+ changeDetection: ChangeDetectionStrategy.OnPush,
59
+ })
60
+ export class ProgressBarDemoComponent<M extends Meta, B extends Body>
61
+ implements OnInit
62
+ {
63
+ private cdr = inject(ChangeDetectorRef);
64
+
65
+ uppyOne!: Uppy<M, B>;
66
+ uppyTwo!: Uppy<M, B>;
67
+ fileListOne: { url: string; fileName: string }[] = [];
68
+ fileListTwo: { url: string; fileName: string }[] = [];
69
+ props: ProgressBarOptions = {
70
+ hideAfterFinish: false,
71
+ };
72
+
73
+ upload(): void {
74
+ this.uppyTwo.upload();
75
+ }
76
+
77
+ /** Inserted by Angular inject() migration for backwards compatibility */
78
+ constructor(...args: unknown[]);
79
+
80
+ constructor() {}
81
+
82
+ updateFileList =
83
+ (target: string) =>
84
+ (file, response): void => {
85
+ this[target] = [
86
+ ...this[target],
87
+ { url: response.uploadURL, fileName: file.name },
88
+ ];
89
+ this.cdr.markForCheck();
90
+ };
91
+
92
+ ngOnInit(): void {
93
+ this.uppyOne = new Uppy<M, B>({ debug: true, autoProceed: true })
94
+ .use(Tus, { endpoint: "https://master.tus.io/files/" })
95
+ .on("upload-success", this.updateFileList("fileListOne"));
96
+ this.uppyTwo = new Uppy<M, B>({ debug: true, autoProceed: false })
97
+ .use(Tus, { endpoint: "https://master.tus.io/files/" })
98
+ .on("upload-success", this.updateFileList("fileListTwo"));
99
+ }
100
+ }
@@ -0,0 +1,24 @@
1
+ import { async, type ComponentFixture, TestBed } from "@angular/core/testing";
2
+
3
+ import { ProgressBarComponent } from "./progress-bar.component";
4
+
5
+ describe("ProgressBarComponent", () => {
6
+ let component: ProgressBarComponent;
7
+ let fixture: ComponentFixture<ProgressBarComponent>;
8
+
9
+ beforeEach(async(() => {
10
+ TestBed.configureTestingModule({
11
+ declarations: [ProgressBarComponent],
12
+ }).compileComponents();
13
+ }));
14
+
15
+ beforeEach(() => {
16
+ fixture = TestBed.createComponent(ProgressBarComponent);
17
+ component = fixture.componentInstance;
18
+ fixture.detectChanges();
19
+ });
20
+
21
+ it("should create", () => {
22
+ expect(component).toBeTruthy();
23
+ });
24
+ });
@@ -0,0 +1,52 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ Component,
4
+ ElementRef,
5
+ Input,
6
+ inject,
7
+ type OnChanges,
8
+ type OnDestroy,
9
+ type SimpleChanges,
10
+ } from "@angular/core";
11
+ import { Uppy } from "@uppy/core";
12
+ import type { ProgressBarOptions } from "@uppy/progress-bar";
13
+ import ProgressBar from "@uppy/progress-bar";
14
+ import type { Body, Meta } from "@uppy/utils/lib/UppyFile";
15
+ import { UppyAngularWrapper } from "../../utils/wrapper";
16
+
17
+ @Component({
18
+ selector: "uppy-progress-bar",
19
+ template: "",
20
+ changeDetection: ChangeDetectionStrategy.OnPush,
21
+ })
22
+ export class ProgressBarComponent<M extends Meta, B extends Body>
23
+ extends UppyAngularWrapper<M, B, ProgressBarOptions>
24
+ implements OnDestroy, OnChanges
25
+ {
26
+ el = inject(ElementRef);
27
+
28
+ @Input() uppy: Uppy<M, B> = new Uppy();
29
+ @Input() props: ProgressBarOptions = {};
30
+
31
+ /** Inserted by Angular inject() migration for backwards compatibility */
32
+ constructor(...args: unknown[]);
33
+
34
+ constructor() {
35
+ super();
36
+ }
37
+
38
+ ngOnInit() {
39
+ this.onMount(
40
+ { id: "angular:ProgressBar", target: this.el.nativeElement },
41
+ ProgressBar,
42
+ );
43
+ }
44
+
45
+ ngOnChanges(changes: SimpleChanges): void {
46
+ this.handleChanges(changes, ProgressBar);
47
+ }
48
+
49
+ ngOnDestroy(): void {
50
+ this.uninstall();
51
+ }
52
+ }
@@ -0,0 +1,17 @@
1
+ import { CommonModule } from "@angular/common";
2
+ import { moduleMetadata } from "@storybook/angular";
3
+ import { ProgressBarDemoComponent } from "./progress-bar-demo.component";
4
+
5
+ export default {
6
+ title: "Progress Bar",
7
+ decorators: [
8
+ moduleMetadata({
9
+ imports: [CommonModule],
10
+ declarations: [ProgressBarDemoComponent],
11
+ }),
12
+ ],
13
+ };
14
+
15
+ export const Default = () => ({
16
+ component: ProgressBarDemoComponent,
17
+ });
@@ -0,0 +1,30 @@
1
+ import { ChangeDetectionStrategy, Component, type OnInit } from "@angular/core";
2
+ import { Uppy } from "@uppy/core";
3
+ import FileInput from "@uppy/file-input";
4
+ import type * as StatusBar from "@uppy/status-bar";
5
+ import Tus from "@uppy/tus";
6
+ import type { Body, Meta } from "@uppy/utils/lib/UppyFile";
7
+
8
+ @Component({
9
+ selector: "uppy-status-bar-demo",
10
+ template: `
11
+ <div class="UppyInput"></div>
12
+ <uppy-status-bar [uppy]="uppy" [props]="props"></uppy-status-bar>
13
+ `,
14
+ changeDetection: ChangeDetectionStrategy.OnPush,
15
+ })
16
+ export class StatusBarDemoComponent<M extends Meta, B extends Body>
17
+ implements OnInit
18
+ {
19
+ uppy: Uppy<M, B> = new Uppy({ debug: true, autoProceed: true });
20
+ props: StatusBar.StatusBarOptions = {
21
+ hideUploadButton: true,
22
+ hideAfterFinish: false,
23
+ };
24
+
25
+ ngOnInit(): void {
26
+ this.uppy
27
+ .use(FileInput, { target: ".UppyInput", pretty: false })
28
+ .use(Tus, { endpoint: "https://master.tus.io/files/" });
29
+ }
30
+ }
@@ -0,0 +1,24 @@
1
+ import { async, type ComponentFixture, TestBed } from "@angular/core/testing";
2
+
3
+ import { StatusBarComponent } from "./status-bar.component";
4
+
5
+ describe("StatusBarComponent", () => {
6
+ let component: StatusBarComponent;
7
+ let fixture: ComponentFixture<StatusBarComponent>;
8
+
9
+ beforeEach(async(() => {
10
+ TestBed.configureTestingModule({
11
+ declarations: [StatusBarComponent],
12
+ }).compileComponents();
13
+ }));
14
+
15
+ beforeEach(() => {
16
+ fixture = TestBed.createComponent(StatusBarComponent);
17
+ component = fixture.componentInstance;
18
+ fixture.detectChanges();
19
+ });
20
+
21
+ it("should create", () => {
22
+ expect(component).toBeTruthy();
23
+ });
24
+ });