@uppy/angular 0.9.1 → 1.0.0

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 (35) hide show
  1. package/fesm2022/uppy-angular.mjs +128 -0
  2. package/fesm2022/uppy-angular.mjs.map +1 -0
  3. package/index.d.ts +5 -0
  4. package/lib/components/dashboard/dashboard.component.d.ts +18 -0
  5. package/lib/components/dashboard-modal/dashboard-modal.component.d.ts +20 -0
  6. package/lib/utils/wrapper.d.ts +14 -0
  7. package/package.json +16 -11
  8. package/public-api.d.ts +2 -0
  9. package/CHANGELOG.md +0 -24
  10. package/ng-package.json +0 -7
  11. package/src/lib/components/dashboard/dashboard-demo.component.ts +0 -17
  12. package/src/lib/components/dashboard/dashboard.component.spec.ts +0 -24
  13. package/src/lib/components/dashboard/dashboard.component.ts +0 -53
  14. package/src/lib/components/dashboard/dashboard.stories.ts +0 -15
  15. package/src/lib/components/dashboard-modal/dashboard-modal-demo.component.ts +0 -21
  16. package/src/lib/components/dashboard-modal/dashboard-modal.component.spec.ts +0 -24
  17. package/src/lib/components/dashboard-modal/dashboard-modal.component.ts +0 -67
  18. package/src/lib/components/dashboard-modal/dashboard-modal.stories.ts +0 -15
  19. package/src/lib/components/drag-drop/drag-drop-demo.component.ts +0 -18
  20. package/src/lib/components/drag-drop/drag-drop.component.spec.ts +0 -24
  21. package/src/lib/components/drag-drop/drag-drop.component.ts +0 -53
  22. package/src/lib/components/drag-drop/drag-drop.stories.ts +0 -15
  23. package/src/lib/components/progress-bar/progress-bar-demo.component.ts +0 -105
  24. package/src/lib/components/progress-bar/progress-bar.component.spec.ts +0 -24
  25. package/src/lib/components/progress-bar/progress-bar.component.ts +0 -53
  26. package/src/lib/components/progress-bar/progress-bar.stories.ts +0 -17
  27. package/src/lib/components/status-bar/status-bar-demo.component.ts +0 -33
  28. package/src/lib/components/status-bar/status-bar.component.spec.ts +0 -24
  29. package/src/lib/components/status-bar/status-bar.component.ts +0 -53
  30. package/src/lib/components/status-bar/status-bar.stories.ts +0 -15
  31. package/src/lib/utils/wrapper.ts +0 -58
  32. package/src/public-api.ts +0 -9
  33. package/tsconfig.lib.json +0 -12
  34. package/tsconfig.lib.prod.json +0 -10
  35. package/tsconfig.spec.json +0 -9
@@ -0,0 +1,128 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ElementRef, Input, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { Uppy } from '@uppy/core';
4
+ import Dashboard from '@uppy/dashboard';
5
+
6
+ class UppyAngularWrapper {
7
+ onMount(defaultOptions, plugin) {
8
+ this.options = {
9
+ ...defaultOptions,
10
+ ...this.props,
11
+ };
12
+ this.uppy.use(plugin, this.options);
13
+ this.plugin = this.uppy.getPlugin(this.options.id);
14
+ }
15
+ handleChanges(changes, plugin) {
16
+ // Without the last part of this conditional, it tries to uninstall before the plugin is mounted
17
+ if (changes["uppy"] &&
18
+ this.uppy !== changes["uppy"].previousValue &&
19
+ changes["uppy"].previousValue !== undefined) {
20
+ this.uninstall(changes["uppy"].previousValue);
21
+ // @ts-expect-error The options correspond to the plugin, I swear
22
+ this.uppy.use(plugin, this.options);
23
+ }
24
+ this.options = { ...this.options, ...this.props };
25
+ this.plugin = this.uppy.getPlugin(this.options.id);
26
+ if (changes["props"] &&
27
+ this.props !== changes["props"].previousValue &&
28
+ changes["props"].previousValue !== undefined) {
29
+ this.plugin.setOptions({ ...this.options });
30
+ }
31
+ }
32
+ uninstall(uppy = this.uppy) {
33
+ uppy.removePlugin(this.plugin);
34
+ }
35
+ }
36
+
37
+ class DashboardComponent extends UppyAngularWrapper {
38
+ constructor() {
39
+ super();
40
+ this.el = inject(ElementRef);
41
+ this.uppy = new Uppy();
42
+ this.props = {};
43
+ }
44
+ ngOnInit() {
45
+ this.onMount({ id: "angular:Dashboard", inline: true, target: this.el.nativeElement }, Dashboard);
46
+ }
47
+ ngOnChanges(changes) {
48
+ this.handleChanges(changes, Dashboard);
49
+ }
50
+ ngOnDestroy() {
51
+ this.uninstall();
52
+ }
53
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DashboardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
54
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: DashboardComponent, isStandalone: true, selector: "uppy-dashboard", inputs: { uppy: "uppy", props: "props" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "", isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
55
+ }
56
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DashboardComponent, decorators: [{
57
+ type: Component,
58
+ args: [{
59
+ selector: "uppy-dashboard",
60
+ template: "",
61
+ changeDetection: ChangeDetectionStrategy.OnPush,
62
+ standalone: true,
63
+ }]
64
+ }], ctorParameters: () => [], propDecorators: { uppy: [{
65
+ type: Input
66
+ }], props: [{
67
+ type: Input
68
+ }] } });
69
+
70
+ class DashboardModalComponent extends UppyAngularWrapper {
71
+ constructor() {
72
+ super();
73
+ this.el = inject(ElementRef);
74
+ this.uppy = new Uppy();
75
+ this.props = {};
76
+ this.open = false;
77
+ }
78
+ ngOnInit() {
79
+ this.onMount({
80
+ id: "angular:DashboardModal",
81
+ inline: false,
82
+ target: this.el.nativeElement,
83
+ }, Dashboard);
84
+ }
85
+ ngOnChanges(changes) {
86
+ this.handleChanges(changes, Dashboard);
87
+ // Handle dashboard-modal specific changes
88
+ if (changes["open"] && this.open !== changes["open"].previousValue) {
89
+ if (this.open && !changes["open"].previousValue) {
90
+ this.plugin.openModal();
91
+ }
92
+ if (!this.open && changes["open"].previousValue) {
93
+ this.plugin.closeModal();
94
+ }
95
+ }
96
+ }
97
+ ngOnDestroy() {
98
+ this.uninstall();
99
+ }
100
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DashboardModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
101
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: DashboardModalComponent, isStandalone: true, selector: "uppy-dashboard-modal", inputs: { uppy: "uppy", props: "props", open: "open" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "", isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
102
+ }
103
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DashboardModalComponent, decorators: [{
104
+ type: Component,
105
+ args: [{
106
+ selector: "uppy-dashboard-modal",
107
+ template: "",
108
+ changeDetection: ChangeDetectionStrategy.OnPush,
109
+ standalone: true,
110
+ }]
111
+ }], ctorParameters: () => [], propDecorators: { uppy: [{
112
+ type: Input
113
+ }], props: [{
114
+ type: Input
115
+ }], open: [{
116
+ type: Input
117
+ }] } });
118
+
119
+ /*
120
+ * Public API Surface of @uppy/angular
121
+ */
122
+
123
+ /**
124
+ * Generated bundle index. Do not edit.
125
+ */
126
+
127
+ export { DashboardComponent, DashboardModalComponent };
128
+ //# sourceMappingURL=uppy-angular.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uppy-angular.mjs","sources":["../../../../projects/uppy/angular/src/lib/utils/wrapper.ts","../../../../projects/uppy/angular/src/lib/components/dashboard/dashboard.component.ts","../../../../projects/uppy/angular/src/lib/components/dashboard-modal/dashboard-modal.component.ts","../../../../projects/uppy/angular/src/public-api.ts","../../../../projects/uppy/angular/src/uppy-angular.ts"],"sourcesContent":["import type { ElementRef, SimpleChanges } from \"@angular/core\";\nimport type { UIPlugin, UIPluginOptions, Uppy } from \"@uppy/core\";\nimport type { DashboardOptions } from \"@uppy/dashboard\";\nimport type { Body, Meta } from \"@uppy/utils\";\n\nexport abstract class UppyAngularWrapper<\n\tM extends Meta,\n\tB extends Body,\n\tOpts extends UIPluginOptions,\n\tPluginType extends UIPlugin<Opts, M, B> = UIPlugin<Opts, M, B>,\n> {\n\tabstract props: DashboardOptions<M, B>;\n\tabstract el: ElementRef;\n\tabstract uppy: Uppy<M, B>;\n\tprivate options: any;\n\tplugin: PluginType | undefined;\n\n\tonMount(\n\t\tdefaultOptions: Partial<Opts>,\n\t\tplugin: new (uppy: any, opts?: Opts) => UIPlugin<Opts, M, B>,\n\t) {\n\t\tthis.options = {\n\t\t\t...defaultOptions,\n\t\t\t...this.props,\n\t\t};\n\n\t\tthis.uppy.use(plugin, this.options);\n\t\tthis.plugin = this.uppy.getPlugin(this.options.id) as PluginType;\n\t}\n\n\thandleChanges(changes: SimpleChanges, plugin: any): void {\n\t\t// Without the last part of this conditional, it tries to uninstall before the plugin is mounted\n\t\tif (\n\t\t\tchanges[\"uppy\"] &&\n\t\t\tthis.uppy !== changes[\"uppy\"].previousValue &&\n\t\t\tchanges[\"uppy\"].previousValue !== undefined\n\t\t) {\n\t\t\tthis.uninstall(changes[\"uppy\"].previousValue);\n\t\t\t// @ts-expect-error The options correspond to the plugin, I swear\n\t\t\tthis.uppy.use(plugin, this.options);\n\t\t}\n\t\tthis.options = { ...this.options, ...this.props };\n\t\tthis.plugin = this.uppy.getPlugin(this.options.id) as PluginType;\n\t\tif (\n\t\t\tchanges[\"props\"] &&\n\t\t\tthis.props !== changes[\"props\"].previousValue &&\n\t\t\tchanges[\"props\"].previousValue !== undefined\n\t\t) {\n\t\t\tthis.plugin.setOptions({ ...this.options });\n\t\t}\n\t}\n\n\tuninstall(uppy = this.uppy): void {\n\t\tuppy.removePlugin(this.plugin!);\n\t}\n}\n","import {\n\tChangeDetectionStrategy,\n\tComponent,\n\tElementRef,\n\tInput,\n\tinject,\n\ttype OnChanges,\n\ttype OnDestroy,\n\ttype SimpleChanges,\n} from \"@angular/core\";\nimport { Uppy } from \"@uppy/core\";\nimport type { DashboardOptions } from \"@uppy/dashboard\";\nimport Dashboard from \"@uppy/dashboard\";\nimport type { Body, Meta } from \"@uppy/utils\";\nimport { UppyAngularWrapper } from \"../../utils/wrapper\";\n\n@Component({\n\tselector: \"uppy-dashboard\",\n\ttemplate: \"\",\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\tstandalone: true,\n})\nexport class DashboardComponent<M extends Meta, B extends Body>\n\textends UppyAngularWrapper<M, B, DashboardOptions<M, B>>\n\timplements OnDestroy, OnChanges\n{\n\tel = inject(ElementRef);\n\n\t@Input() uppy: Uppy<M, B> = new Uppy();\n\t@Input() props: DashboardOptions<M, B> = {};\n\n\t/** Inserted by Angular inject() migration for backwards compatibility */\n\tconstructor(...args: unknown[]);\n\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\tngOnInit() {\n\t\tthis.onMount(\n\t\t\t{ id: \"angular:Dashboard\", inline: true, target: this.el.nativeElement },\n\t\t\tDashboard,\n\t\t);\n\t}\n\n\tngOnChanges(changes: SimpleChanges): void {\n\t\tthis.handleChanges(changes, Dashboard);\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis.uninstall();\n\t}\n}\n","import {\n\tChangeDetectionStrategy,\n\tComponent,\n\tElementRef,\n\tInput,\n\tinject,\n\ttype OnChanges,\n\ttype OnDestroy,\n\ttype SimpleChanges,\n} from \"@angular/core\";\nimport { Uppy } from \"@uppy/core\";\nimport type { DashboardOptions } from \"@uppy/dashboard\";\nimport Dashboard from \"@uppy/dashboard\";\nimport type { Body, Meta } from \"@uppy/utils\";\nimport { UppyAngularWrapper } from \"../../utils/wrapper\";\n\n@Component({\n\tselector: \"uppy-dashboard-modal\",\n\ttemplate: \"\",\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\tstandalone: true,\n})\nexport class DashboardModalComponent<M extends Meta, B extends Body>\n\textends UppyAngularWrapper<M, B, DashboardOptions<M, B>, Dashboard<M, B>>\n\timplements OnDestroy, OnChanges\n{\n\tel = inject(ElementRef);\n\n\t@Input() uppy: Uppy<M, B> = new Uppy();\n\t@Input() props: DashboardOptions<M, B> = {};\n\t@Input() open: boolean = false;\n\n\t/** Inserted by Angular inject() migration for backwards compatibility */\n\tconstructor(...args: unknown[]);\n\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\tngOnInit() {\n\t\tthis.onMount(\n\t\t\t{\n\t\t\t\tid: \"angular:DashboardModal\",\n\t\t\t\tinline: false,\n\t\t\t\ttarget: this.el.nativeElement,\n\t\t\t},\n\t\t\tDashboard,\n\t\t);\n\t}\n\n\tngOnChanges(changes: SimpleChanges): void {\n\t\tthis.handleChanges(changes, Dashboard);\n\t\t// Handle dashboard-modal specific changes\n\t\tif (changes[\"open\"] && this.open !== changes[\"open\"].previousValue) {\n\t\t\tif (this.open && !changes[\"open\"].previousValue) {\n\t\t\t\tthis.plugin!.openModal();\n\t\t\t}\n\t\t\tif (!this.open && changes[\"open\"].previousValue) {\n\t\t\t\tthis.plugin!.closeModal();\n\t\t\t}\n\t\t}\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis.uninstall();\n\t}\n}\n","/*\n * Public API Surface of @uppy/angular\n */\n\nexport { DashboardComponent } from './lib/components/dashboard/dashboard.component'\nexport { DashboardModalComponent } from './lib/components/dashboard-modal/dashboard-modal.component'\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAKsB,kBAAkB,CAAA;IAYvC,OAAO,CACN,cAA6B,EAC7B,MAA4D,EAAA;QAE5D,IAAI,CAAC,OAAO,GAAG;AACd,YAAA,GAAG,cAAc;YACjB,GAAG,IAAI,CAAC,KAAK;SACb;QAED,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC;AACnC,QAAA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAe;;IAGjE,aAAa,CAAC,OAAsB,EAAE,MAAW,EAAA;;QAEhD,IACC,OAAO,CAAC,MAAM,CAAC;YACf,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,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BAAZ;gBACQ,KAAK,EAAA,CAAA;sBAAb;gBACQ,IAAI,EAAA,CAAA;sBAAZ;;;AC9BF;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@uppy/angular" />
5
+ export * from './public-api';
@@ -0,0 +1,18 @@
1
+ import { ElementRef, type OnChanges, type OnDestroy, type SimpleChanges } from "@angular/core";
2
+ import { Uppy } from "@uppy/core";
3
+ import type { DashboardOptions } from "@uppy/dashboard";
4
+ import type { Body, Meta } from "@uppy/utils";
5
+ import { UppyAngularWrapper } from "../../utils/wrapper";
6
+ import * as i0 from "@angular/core";
7
+ export declare class DashboardComponent<M extends Meta, B extends Body> extends UppyAngularWrapper<M, B, DashboardOptions<M, B>> implements OnDestroy, OnChanges {
8
+ el: ElementRef<any>;
9
+ uppy: Uppy<M, B>;
10
+ props: DashboardOptions<M, B>;
11
+ /** Inserted by Angular inject() migration for backwards compatibility */
12
+ constructor(...args: unknown[]);
13
+ ngOnInit(): void;
14
+ ngOnChanges(changes: SimpleChanges): void;
15
+ ngOnDestroy(): void;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<DashboardComponent<any, any>, never>;
17
+ static ɵcmp: i0.ɵɵComponentDeclaration<DashboardComponent<any, any>, "uppy-dashboard", never, { "uppy": { "alias": "uppy"; "required": false; }; "props": { "alias": "props"; "required": false; }; }, {}, never, never, true, never>;
18
+ }
@@ -0,0 +1,20 @@
1
+ import { ElementRef, type OnChanges, type OnDestroy, type SimpleChanges } from "@angular/core";
2
+ import { Uppy } from "@uppy/core";
3
+ import type { DashboardOptions } from "@uppy/dashboard";
4
+ import Dashboard from "@uppy/dashboard";
5
+ import type { Body, Meta } from "@uppy/utils";
6
+ import { UppyAngularWrapper } from "../../utils/wrapper";
7
+ import * as i0 from "@angular/core";
8
+ export declare class DashboardModalComponent<M extends Meta, B extends Body> extends UppyAngularWrapper<M, B, DashboardOptions<M, B>, Dashboard<M, B>> implements OnDestroy, OnChanges {
9
+ el: ElementRef<any>;
10
+ uppy: Uppy<M, B>;
11
+ props: DashboardOptions<M, B>;
12
+ open: boolean;
13
+ /** Inserted by Angular inject() migration for backwards compatibility */
14
+ constructor(...args: unknown[]);
15
+ ngOnInit(): void;
16
+ ngOnChanges(changes: SimpleChanges): void;
17
+ ngOnDestroy(): void;
18
+ static ɵfac: i0.ɵɵFactoryDeclaration<DashboardModalComponent<any, any>, never>;
19
+ static ɵcmp: i0.ɵɵComponentDeclaration<DashboardModalComponent<any, any>, "uppy-dashboard-modal", never, { "uppy": { "alias": "uppy"; "required": false; }; "props": { "alias": "props"; "required": false; }; "open": { "alias": "open"; "required": false; }; }, {}, never, never, true, never>;
20
+ }
@@ -0,0 +1,14 @@
1
+ import type { ElementRef, SimpleChanges } from "@angular/core";
2
+ import type { UIPlugin, UIPluginOptions, Uppy } from "@uppy/core";
3
+ import type { DashboardOptions } from "@uppy/dashboard";
4
+ import type { Body, Meta } from "@uppy/utils";
5
+ export declare abstract class UppyAngularWrapper<M extends Meta, B extends Body, Opts extends UIPluginOptions, PluginType extends UIPlugin<Opts, M, B> = UIPlugin<Opts, M, B>> {
6
+ abstract props: DashboardOptions<M, B>;
7
+ abstract el: ElementRef;
8
+ abstract uppy: Uppy<M, B>;
9
+ private options;
10
+ plugin: PluginType | undefined;
11
+ onMount(defaultOptions: Partial<Opts>, plugin: new (uppy: any, opts?: Opts) => UIPlugin<Opts, M, B>): void;
12
+ handleChanges(changes: SimpleChanges, plugin: any): void;
13
+ uninstall(uppy?: Uppy<M, B>): void;
14
+ }
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.9.1",
4
+ "version": "1.0.0",
5
5
  "license": "MIT",
6
6
  "homepage": "https://uppy.io",
7
7
  "keywords": [
@@ -18,21 +18,26 @@
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
- },
24
21
  "dependencies": {
25
22
  "tslib": "^2.0.0"
26
23
  },
27
24
  "peerDependencies": {
28
25
  "@angular/common": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
29
26
  "@angular/core": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0",
30
- "@uppy/core": "^4.5.2",
31
- "@uppy/dashboard": "^4.4.2",
32
- "@uppy/drag-drop": "^4.2.2",
33
- "@uppy/progress-bar": "^4.3.2",
34
- "@uppy/status-bar": "^4.2.2",
35
- "@uppy/utils": "^6.2.2"
27
+ "@uppy/core": "^5.0.0",
28
+ "@uppy/dashboard": "^5.0.0",
29
+ "@uppy/utils": "^7.0.0"
36
30
  },
37
- "sideEffects": false
31
+ "sideEffects": false,
32
+ "module": "fesm2022/uppy-angular.mjs",
33
+ "typings": "index.d.ts",
34
+ "exports": {
35
+ "./package.json": {
36
+ "default": "./package.json"
37
+ },
38
+ ".": {
39
+ "types": "./index.d.ts",
40
+ "default": "./fesm2022/uppy-angular.mjs"
41
+ }
42
+ }
38
43
  }
@@ -0,0 +1,2 @@
1
+ export { DashboardComponent } from './lib/components/dashboard/dashboard.component';
2
+ export { DashboardModalComponent } from './lib/components/dashboard-modal/dashboard-modal.component';
package/CHANGELOG.md DELETED
@@ -1,24 +0,0 @@
1
- # @uppy/angular
2
-
3
- ## 0.9.1
4
-
5
- ### Patch Changes
6
-
7
- - 7eec173: Remove "files" array from package.json
8
-
9
- ## 0.9.0
10
-
11
- ### Minor Changes
12
-
13
- - 8b8ab01: Declare components as standalone & support 20.x
14
-
15
- ### Patch Changes
16
-
17
- - 1b1a9e3: Define "files" in package.json
18
- - Updated dependencies [1b1a9e3]
19
- - @uppy/progress-bar@4.3.2
20
- - @uppy/status-bar@4.2.2
21
- - @uppy/dashboard@4.4.2
22
- - @uppy/drag-drop@4.2.2
23
- - @uppy/utils@6.2.2
24
- - @uppy/core@4.5.2
package/ng-package.json DELETED
@@ -1,7 +0,0 @@
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
- }
@@ -1,17 +0,0 @@
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
- import { DashboardComponent } from "./dashboard.component";
6
-
7
- @Component({
8
- selector: "uppy-dashboard-demo",
9
- template: `<uppy-dashboard [uppy]="uppy" [props]="props"></uppy-dashboard>`,
10
- changeDetection: ChangeDetectionStrategy.OnPush,
11
- standalone: true,
12
- imports: [DashboardComponent],
13
- })
14
- export class DashboardDemoComponent<M extends Meta, B extends Body> {
15
- uppy: Uppy<M, B> = new Uppy({ debug: true, autoProceed: true });
16
- props: Dashboard.DashboardOptions<M, B> = {};
17
- }
@@ -1,24 +0,0 @@
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
- });
@@ -1,53 +0,0 @@
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
- standalone: true,
22
- })
23
- export class DashboardComponent<M extends Meta, B extends Body>
24
- extends UppyAngularWrapper<M, B, DashboardOptions<M, B>>
25
- implements OnDestroy, OnChanges
26
- {
27
- el = inject(ElementRef);
28
-
29
- @Input() uppy: Uppy<M, B> = new Uppy();
30
- @Input() props: DashboardOptions<M, B> = {};
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
- { id: "angular:Dashboard", inline: true, target: this.el.nativeElement },
42
- Dashboard,
43
- );
44
- }
45
-
46
- ngOnChanges(changes: SimpleChanges): void {
47
- this.handleChanges(changes, Dashboard);
48
- }
49
-
50
- ngOnDestroy(): void {
51
- this.uninstall();
52
- }
53
- }
@@ -1,15 +0,0 @@
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
- });
@@ -1,21 +0,0 @@
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
- import { DashboardModalComponent } from "./dashboard-modal.component";
6
-
7
-
8
- @Component({
9
- selector: "uppy-dashboard-demo",
10
- template: `<uppy-dashboard-modal
11
- [uppy]="uppy"
12
- [props]="props"
13
- ></uppy-dashboard-modal>`,
14
- changeDetection: ChangeDetectionStrategy.OnPush,
15
- standalone: true,
16
- imports: [DashboardModalComponent],
17
- })
18
- export class DashboardModalDemoComponent<M extends Meta, B extends Body> {
19
- uppy: Uppy<M, B> = new Uppy({ debug: true, autoProceed: true });
20
- props: Dashboard.DashboardOptions<M, B> = {};
21
- }
@@ -1,24 +0,0 @@
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
- });
@@ -1,67 +0,0 @@
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
- standalone: true,
22
- })
23
- export class DashboardModalComponent<M extends Meta, B extends Body>
24
- extends UppyAngularWrapper<M, B, DashboardOptions<M, B>, Dashboard<M, B>>
25
- implements OnDestroy, OnChanges
26
- {
27
- el = inject(ElementRef);
28
-
29
- @Input() uppy: Uppy<M, B> = new Uppy();
30
- @Input() props: DashboardOptions<M, B> = {};
31
- @Input() open: boolean = false;
32
-
33
- /** Inserted by Angular inject() migration for backwards compatibility */
34
- constructor(...args: unknown[]);
35
-
36
- constructor() {
37
- super();
38
- }
39
-
40
- ngOnInit() {
41
- this.onMount(
42
- {
43
- id: "angular:DashboardModal",
44
- inline: false,
45
- target: this.el.nativeElement,
46
- },
47
- Dashboard,
48
- );
49
- }
50
-
51
- ngOnChanges(changes: SimpleChanges): void {
52
- this.handleChanges(changes, Dashboard);
53
- // Handle dashboard-modal specific changes
54
- if (changes["open"] && this.open !== changes["open"].previousValue) {
55
- if (this.open && !changes["open"].previousValue) {
56
- this.plugin!.openModal();
57
- }
58
- if (!this.open && changes["open"].previousValue) {
59
- this.plugin!.closeModal();
60
- }
61
- }
62
- }
63
-
64
- ngOnDestroy(): void {
65
- this.uninstall();
66
- }
67
- }
@@ -1,15 +0,0 @@
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
- });
@@ -1,18 +0,0 @@
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
- import { DragDropComponent } from "./drag-drop.component";
6
-
7
-
8
- @Component({
9
- selector: "uppy-drag-drop-demo",
10
- template: ` <uppy-drag-drop [uppy]="uppy" [props]="props"></uppy-drag-drop> `,
11
- changeDetection: ChangeDetectionStrategy.OnPush,
12
- standalone: true,
13
- imports: [DragDropComponent],
14
- })
15
- export class DragDropDemoComponent<M extends Meta, B extends Body> {
16
- uppy: Uppy<M, B> = new Uppy({ debug: true, autoProceed: true });
17
- props: DragDrop.DragDropOptions = {};
18
- }
@@ -1,24 +0,0 @@
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
- });
@@ -1,53 +0,0 @@
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
- standalone: true,
22
- })
23
- export class DragDropComponent<M extends Meta, B extends Body>
24
- extends UppyAngularWrapper<M, B, DragDropOptions>
25
- implements OnDestroy, OnChanges
26
- {
27
- el = inject(ElementRef);
28
-
29
- @Input() uppy: Uppy<M, B> = new Uppy();
30
- @Input() props: DragDropOptions = {};
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
- { id: "angular:DragDrop", target: this.el.nativeElement },
42
- DragDrop,
43
- );
44
- }
45
-
46
- ngOnChanges(changes: SimpleChanges): void {
47
- this.handleChanges(changes, DragDrop);
48
- }
49
-
50
- ngOnDestroy(): void {
51
- this.uninstall();
52
- }
53
- }
@@ -1,15 +0,0 @@
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
- });
@@ -1,105 +0,0 @@
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
- import { ProgressBarComponent } from "./progress-bar.component";
13
- import { DragDropComponent } from "../drag-drop/drag-drop.component";
14
- import { CommonModule } from "@angular/common";
15
-
16
- @Component({
17
- selector: "uppy-progress-bar-demo",
18
- template: `
19
- <section class="example-one">
20
- <h5>autoProceed is on</h5>
21
-
22
- <!-- Target DOM node #1 -->
23
- <uppy-drag-drop [uppy]="uppyOne"></uppy-drag-drop>
24
-
25
- <!-- Progress bar #1 -->
26
- <uppy-progress-bar [uppy]="uppyOne" [props]="props"></uppy-progress-bar>
27
-
28
- <!-- Uploaded files list #1 -->
29
- <div class="uploaded-files" *ngIf="fileListOne?.length">
30
- <h5>Uploaded files:</h5>
31
- <ol>
32
- <li *ngFor="let item of fileListOne">
33
- <a [href]="item.url" target="_blank"> {{ item.fileName }}</a>
34
- </li>
35
- </ol>
36
- </div>
37
- </section>
38
-
39
- <section class="example-two">
40
- <h5>autoProceed is off</h5>
41
-
42
- <!-- Target DOM node #1 -->
43
- <uppy-drag-drop [uppy]="uppyTwo"></uppy-drag-drop>
44
-
45
- <!-- Progress bar #1 -->
46
- <uppy-progress-bar [uppy]="uppyTwo" [props]="props"></uppy-progress-bar>
47
-
48
- <button (click)="upload()" class="upload-button">Upload</button>
49
-
50
- <!-- Uploaded files list #2 -->
51
- <div class="uploaded-files" *ngIf="fileListTwo?.length">
52
- <h5>Uploaded files:</h5>
53
- <ol>
54
- <li *ngFor="let item of fileListTwo">
55
- <a [href]="item.url" target="_blank"> {{ item.fileName }}</a>
56
- </li>
57
- </ol>
58
- </div>
59
- </section>
60
- `,
61
- changeDetection: ChangeDetectionStrategy.OnPush,
62
- standalone: true,
63
- imports: [ProgressBarComponent, DragDropComponent, CommonModule],
64
- })
65
- export class ProgressBarDemoComponent<M extends Meta, B extends Body>
66
- implements OnInit
67
- {
68
- private cdr = inject(ChangeDetectorRef);
69
-
70
- uppyOne!: Uppy<M, B>;
71
- uppyTwo!: Uppy<M, B>;
72
- fileListOne: { url: string; fileName: string }[] = [];
73
- fileListTwo: { url: string; fileName: string }[] = [];
74
- props: ProgressBarOptions = {
75
- hideAfterFinish: false,
76
- };
77
-
78
- upload(): void {
79
- this.uppyTwo.upload();
80
- }
81
-
82
- /** Inserted by Angular inject() migration for backwards compatibility */
83
- constructor(...args: unknown[]);
84
-
85
- constructor() {}
86
-
87
- updateFileList =
88
- (target: string) =>
89
- (file: any, response: any): void => {
90
- (this as any)[target] = [
91
- ...(this as any)[target],
92
- { url: response.uploadURL, fileName: file.name },
93
- ];
94
- this.cdr.markForCheck();
95
- };
96
-
97
- ngOnInit(): void {
98
- this.uppyOne = new Uppy<M, B>({ debug: true, autoProceed: true })
99
- .use(Tus, { endpoint: "https://master.tus.io/files/" })
100
- .on("upload-success", this.updateFileList("fileListOne"));
101
- this.uppyTwo = new Uppy<M, B>({ debug: true, autoProceed: false })
102
- .use(Tus, { endpoint: "https://master.tus.io/files/" })
103
- .on("upload-success", this.updateFileList("fileListTwo"));
104
- }
105
- }
@@ -1,24 +0,0 @@
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
- });
@@ -1,53 +0,0 @@
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
- standalone: true,
22
- })
23
- export class ProgressBarComponent<M extends Meta, B extends Body>
24
- extends UppyAngularWrapper<M, B, ProgressBarOptions>
25
- implements OnDestroy, OnChanges
26
- {
27
- el = inject(ElementRef);
28
-
29
- @Input() uppy: Uppy<M, B> = new Uppy();
30
- @Input() props: ProgressBarOptions = {};
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
- { id: "angular:ProgressBar", target: this.el.nativeElement },
42
- ProgressBar,
43
- );
44
- }
45
-
46
- ngOnChanges(changes: SimpleChanges): void {
47
- this.handleChanges(changes, ProgressBar);
48
- }
49
-
50
- ngOnDestroy(): void {
51
- this.uninstall();
52
- }
53
- }
@@ -1,17 +0,0 @@
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
- });
@@ -1,33 +0,0 @@
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
- import { StatusBarComponent } from "./status-bar.component";
8
-
9
- @Component({
10
- selector: "uppy-status-bar-demo",
11
- template: `
12
- <div class="UppyInput"></div>
13
- <uppy-status-bar [uppy]="uppy" [props]="props"></uppy-status-bar>
14
- `,
15
- changeDetection: ChangeDetectionStrategy.OnPush,
16
- standalone: true,
17
- imports: [StatusBarComponent],
18
- })
19
- export class StatusBarDemoComponent<M extends Meta, B extends Body>
20
- implements OnInit
21
- {
22
- uppy: Uppy<M, B> = new Uppy({ debug: true, autoProceed: true });
23
- props: StatusBar.StatusBarOptions = {
24
- hideUploadButton: true,
25
- hideAfterFinish: false,
26
- };
27
-
28
- ngOnInit(): void {
29
- this.uppy
30
- .use(FileInput, { target: ".UppyInput", pretty: false })
31
- .use(Tus, { endpoint: "https://master.tus.io/files/" });
32
- }
33
- }
@@ -1,24 +0,0 @@
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
- });
@@ -1,53 +0,0 @@
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 { StatusBarOptions } from "@uppy/status-bar";
13
- import StatusBar from "@uppy/status-bar";
14
- import type { Body, Meta } from "@uppy/utils/lib/UppyFile";
15
- import { UppyAngularWrapper } from "../../utils/wrapper";
16
-
17
- @Component({
18
- selector: "uppy-status-bar",
19
- template: "",
20
- changeDetection: ChangeDetectionStrategy.OnPush,
21
- standalone: true,
22
- })
23
- export class StatusBarComponent<M extends Meta, B extends Body>
24
- extends UppyAngularWrapper<M, B, StatusBarOptions>
25
- implements OnDestroy, OnChanges
26
- {
27
- el = inject(ElementRef);
28
-
29
- @Input() uppy: Uppy<M, B> = new Uppy();
30
- @Input() props: StatusBarOptions = {};
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
- { id: "angular:StatusBar", target: this.el.nativeElement },
42
- StatusBar,
43
- );
44
- }
45
-
46
- ngOnChanges(changes: SimpleChanges): void {
47
- this.handleChanges(changes, StatusBar);
48
- }
49
-
50
- ngOnDestroy(): void {
51
- this.uninstall();
52
- }
53
- }
@@ -1,15 +0,0 @@
1
- import { moduleMetadata } from "@storybook/angular";
2
- import { StatusBarDemoComponent } from "./status-bar-demo.component";
3
-
4
- export default {
5
- title: "Status Bar",
6
- decorators: [
7
- moduleMetadata({
8
- declarations: [StatusBarDemoComponent],
9
- }),
10
- ],
11
- };
12
-
13
- export const Default = () => ({
14
- component: StatusBarDemoComponent,
15
- });
@@ -1,58 +0,0 @@
1
- import type { ElementRef, SimpleChanges } from "@angular/core";
2
- import type { UIPlugin, UIPluginOptions, Uppy } from "@uppy/core";
3
- import type { DragDropOptions } from "@uppy/drag-drop";
4
- import type { ProgressBarOptions } from "@uppy/progress-bar";
5
- import type { StatusBarOptions } from "@uppy/status-bar";
6
- import type { Body, Meta } from "@uppy/utils/lib/UppyFile";
7
-
8
- export abstract class UppyAngularWrapper<
9
- M extends Meta,
10
- B extends Body,
11
- Opts extends UIPluginOptions,
12
- PluginType extends UIPlugin<Opts, M, B> = UIPlugin<Opts, M, B>,
13
- > {
14
- abstract props: DragDropOptions | StatusBarOptions | ProgressBarOptions;
15
- abstract el: ElementRef;
16
- abstract uppy: Uppy<M, B>;
17
- private options: any;
18
- plugin: PluginType | undefined;
19
-
20
- onMount(
21
- defaultOptions: Partial<Opts>,
22
- plugin: new (uppy: any, opts?: Opts) => UIPlugin<Opts, M, B>,
23
- ) {
24
- this.options = {
25
- ...defaultOptions,
26
- ...this.props,
27
- };
28
-
29
- this.uppy.use(plugin, this.options);
30
- this.plugin = this.uppy.getPlugin(this.options.id) as PluginType;
31
- }
32
-
33
- handleChanges(changes: SimpleChanges, plugin: any): void {
34
- // Without the last part of this conditional, it tries to uninstall before the plugin is mounted
35
- if (
36
- changes["uppy"] &&
37
- this.uppy !== changes["uppy"].previousValue &&
38
- changes["uppy"].previousValue !== undefined
39
- ) {
40
- this.uninstall(changes["uppy"].previousValue);
41
- // @ts-expect-error The options correspond to the plugin, I swear
42
- this.uppy.use(plugin, this.options);
43
- }
44
- this.options = { ...this.options, ...this.props };
45
- this.plugin = this.uppy.getPlugin(this.options.id) as PluginType;
46
- if (
47
- changes["props"] &&
48
- this.props !== changes["props"].previousValue &&
49
- changes["props"].previousValue !== undefined
50
- ) {
51
- this.plugin.setOptions({ ...this.options });
52
- }
53
- }
54
-
55
- uninstall(uppy = this.uppy): void {
56
- uppy.removePlugin(this.plugin!);
57
- }
58
- }
package/src/public-api.ts DELETED
@@ -1,9 +0,0 @@
1
- /*
2
- * Public API Surface of @uppy/angular
3
- */
4
-
5
- export { DashboardComponent } from './lib/components/dashboard/dashboard.component'
6
- export { DashboardModalComponent } from './lib/components/dashboard-modal/dashboard-modal.component'
7
- export { DragDropComponent } from './lib/components/drag-drop/drag-drop.component'
8
- export { ProgressBarComponent } from './lib/components/progress-bar/progress-bar.component'
9
- export { StatusBarComponent } from './lib/components/status-bar/status-bar.component'
package/tsconfig.lib.json DELETED
@@ -1,12 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "../../../tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "../../../out-tsc/lib",
6
- "declaration": true,
7
- "declarationMap": true,
8
- "inlineSources": true,
9
- "types": []
10
- },
11
- "exclude": ["**/*.spec.ts"]
12
- }
@@ -1,10 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "./tsconfig.lib.json",
4
- "compilerOptions": {
5
- "declarationMap": false
6
- },
7
- "angularCompilerOptions": {
8
- "compilationMode": "partial"
9
- }
10
- }
@@ -1,9 +0,0 @@
1
- /* To learn more about this file see: https://angular.io/config/tsconfig. */
2
- {
3
- "extends": "../../../tsconfig.json",
4
- "compilerOptions": {
5
- "outDir": "../../../out-tsc/spec",
6
- "types": ["jasmine"]
7
- },
8
- "include": ["**/*.spec.ts", "**/*.d.ts"]
9
- }