@solar-angular/ui-ionic 19.0.4
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.
- package/README.md +7 -0
- package/fesm2022/solar-angular-ui-ionic.mjs +103 -0
- package/fesm2022/solar-angular-ui-ionic.mjs.map +1 -0
- package/index.d.ts +1 -0
- package/overlay.controller.d.ts +21 -0
- package/package.json +26 -0
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, Injectable } from '@angular/core';
|
|
3
|
+
import { LoadingController, ToastController, AlertController, ActionSheetController } from '@ionic/angular/standalone';
|
|
4
|
+
import { finalize } from 'rxjs';
|
|
5
|
+
|
|
6
|
+
class OverlayController {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.loadingCtrl = inject(LoadingController);
|
|
9
|
+
this.toastCtrl = inject(ToastController);
|
|
10
|
+
this.alertCtrl = inject(AlertController);
|
|
11
|
+
this.actionSheetCtrl = inject(ActionSheetController);
|
|
12
|
+
this.toast = {
|
|
13
|
+
info: async (message) => {
|
|
14
|
+
const toast = await this.toastCtrl.create({
|
|
15
|
+
message,
|
|
16
|
+
color: 'dark',
|
|
17
|
+
icon: 'information-outline',
|
|
18
|
+
translucent: true
|
|
19
|
+
});
|
|
20
|
+
await toast.present();
|
|
21
|
+
return toast;
|
|
22
|
+
},
|
|
23
|
+
success: async (message) => {
|
|
24
|
+
const toast = await this.toastCtrl.create({
|
|
25
|
+
message,
|
|
26
|
+
color: 'dark',
|
|
27
|
+
icon: 'checkmark-outline',
|
|
28
|
+
translucent: true
|
|
29
|
+
});
|
|
30
|
+
await toast.present();
|
|
31
|
+
return toast;
|
|
32
|
+
},
|
|
33
|
+
warning: async (message) => {
|
|
34
|
+
const toast = await this.toastCtrl.create({
|
|
35
|
+
message,
|
|
36
|
+
color: 'dark',
|
|
37
|
+
icon: 'alert-outline',
|
|
38
|
+
translucent: true
|
|
39
|
+
});
|
|
40
|
+
await toast.present();
|
|
41
|
+
return toast;
|
|
42
|
+
},
|
|
43
|
+
error: async (message) => {
|
|
44
|
+
const toast = await this.toastCtrl.create({
|
|
45
|
+
message,
|
|
46
|
+
color: 'dark',
|
|
47
|
+
icon: 'close-outline',
|
|
48
|
+
translucent: true
|
|
49
|
+
});
|
|
50
|
+
await toast.present();
|
|
51
|
+
return toast;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async alert(header, message, options) {
|
|
56
|
+
const alert = await this.alertCtrl.create({
|
|
57
|
+
header,
|
|
58
|
+
message,
|
|
59
|
+
translucent: true,
|
|
60
|
+
...options
|
|
61
|
+
});
|
|
62
|
+
await alert.present();
|
|
63
|
+
return alert;
|
|
64
|
+
}
|
|
65
|
+
async actionSheet(header, options) {
|
|
66
|
+
const actionSheet = await this.actionSheetCtrl.create({
|
|
67
|
+
header,
|
|
68
|
+
translucent: true,
|
|
69
|
+
...options
|
|
70
|
+
});
|
|
71
|
+
await actionSheet.present();
|
|
72
|
+
return actionSheet;
|
|
73
|
+
}
|
|
74
|
+
async loading(message = '正在加载') {
|
|
75
|
+
const loading = await this.loadingCtrl.create({
|
|
76
|
+
message,
|
|
77
|
+
cssClass: 'ion-loading'
|
|
78
|
+
});
|
|
79
|
+
await loading.present();
|
|
80
|
+
return loading;
|
|
81
|
+
}
|
|
82
|
+
withLoading(message) {
|
|
83
|
+
return (observable) => {
|
|
84
|
+
const loading = this.loading(message);
|
|
85
|
+
return observable.pipe(finalize(async () => (await loading).dismiss()));
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OverlayController, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
89
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OverlayController, providedIn: 'root' }); }
|
|
90
|
+
}
|
|
91
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OverlayController, decorators: [{
|
|
92
|
+
type: Injectable,
|
|
93
|
+
args: [{
|
|
94
|
+
providedIn: 'root'
|
|
95
|
+
}]
|
|
96
|
+
}] });
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Generated bundle index. Do not edit.
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
export { OverlayController };
|
|
103
|
+
//# sourceMappingURL=solar-angular-ui-ionic.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solar-angular-ui-ionic.mjs","sources":["../../../packages/ui-ionic/src/overlay.controller.ts","../../../packages/ui-ionic/src/solar-angular-ui-ionic.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { ActionSheetController, ActionSheetOptions, AlertController, AlertOptions, LoadingController, ToastController } from '@ionic/angular/standalone';\nimport { finalize, Observable } from 'rxjs';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class OverlayController {\n private readonly loadingCtrl = inject(LoadingController);\n private readonly toastCtrl = inject(ToastController);\n private readonly alertCtrl = inject(AlertController);\n private readonly actionSheetCtrl = inject(ActionSheetController);\n\n readonly toast = {\n info: async (message: string) => {\n const toast = await this.toastCtrl.create({\n message,\n color: 'dark',\n icon: 'information-outline',\n translucent: true\n });\n await toast.present();\n return toast;\n },\n success: async (message: string) => {\n const toast = await this.toastCtrl.create({\n message,\n color: 'dark',\n icon: 'checkmark-outline',\n translucent: true\n });\n await toast.present();\n return toast;\n },\n warning: async (message: string) => {\n const toast = await this.toastCtrl.create({\n message,\n color: 'dark',\n icon: 'alert-outline',\n translucent: true\n });\n await toast.present();\n return toast;\n },\n error: async (message: string) => {\n const toast = await this.toastCtrl.create({\n message,\n color: 'dark',\n icon: 'close-outline',\n translucent: true\n });\n await toast.present();\n return toast;\n }\n };\n\n async alert(header: string, message: string, options: AlertOptions) {\n const alert = await this.alertCtrl.create({\n header,\n message,\n translucent: true,\n ...options\n });\n await alert.present();\n return alert;\n }\n\n async actionSheet(header: string, options: ActionSheetOptions) {\n const actionSheet = await this.actionSheetCtrl.create({\n header,\n translucent: true,\n ...options\n });\n await actionSheet.present();\n return actionSheet;\n }\n\n async loading(message: string = '正在加载') {\n const loading = await this.loadingCtrl.create({\n message,\n cssClass: 'ion-loading'\n });\n await loading.present();\n return loading;\n }\n\n withLoading<T>(message?: string) {\n return (observable: Observable<T>) => {\n const loading = this.loading(message);\n return observable.pipe(\n finalize(async () => (await loading).dismiss())\n );\n };\n }\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAOa,iBAAiB,CAAA;AAH9B,IAAA,WAAA,GAAA;AAImB,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,iBAAiB,CAAC;AACvC,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,eAAe,CAAC;AACnC,QAAA,IAAA,CAAA,SAAS,GAAG,MAAM,CAAC,eAAe,CAAC;AACnC,QAAA,IAAA,CAAA,eAAe,GAAG,MAAM,CAAC,qBAAqB,CAAC;AAEvD,QAAA,IAAA,CAAA,KAAK,GAAG;AACf,YAAA,IAAI,EAAE,OAAO,OAAe,KAAI;gBAC9B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;oBACxC,OAAO;AACP,oBAAA,KAAK,EAAE,MAAM;AACb,oBAAA,IAAI,EAAE,qBAAqB;AAC3B,oBAAA,WAAW,EAAE;AACd,iBAAA,CAAC;AACF,gBAAA,MAAM,KAAK,CAAC,OAAO,EAAE;AACrB,gBAAA,OAAO,KAAK;aACb;AACD,YAAA,OAAO,EAAE,OAAO,OAAe,KAAI;gBACjC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;oBACxC,OAAO;AACP,oBAAA,KAAK,EAAE,MAAM;A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A,CAAC;AACF,QAAA,MAAM,WAAW,CAAC,OAAO,EAAE;AAC3B,QAAA,OAAO,WAAW;;AAGpB,IAAA,MAAM,OAAO,CAAC,OAAA,GAAkB,MAAM,EAAA;QACpC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;YAC5C,OAAO;AACP,YAAA,QAAQ,EAAE;AACX,SAAA,CAAC;AACF,QAAA,MAAM,OAAO,CAAC,OAAO,EAAE;AACvB,QAAA,OAAO,OAAO;;AAGhB,IAAA,WAAW,CAAI,OAAgB,EAAA;QAC7B,OAAO,CAAC,UAAyB,KAAI;YACnC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;AACrC,YAAA,OAAO,UAAU,CAAC,IAAI,CACpB,QAAQ,CAAC,YAAY,CAAC,MAAM,OAAO,EAAE,OAAO,EAAE,CAAC,CAChD;AACH,SAAC;;+GArFQ,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAjB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,cAFhB,MAAM,EAAA,CAAA,CAAA;;4FAEP,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAH7B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE;AACb,iBAAA;;;ACND;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './overlay.controller';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ActionSheetOptions, AlertOptions } from '@ionic/angular/standalone';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class OverlayController {
|
|
5
|
+
private readonly loadingCtrl;
|
|
6
|
+
private readonly toastCtrl;
|
|
7
|
+
private readonly alertCtrl;
|
|
8
|
+
private readonly actionSheetCtrl;
|
|
9
|
+
readonly toast: {
|
|
10
|
+
info: (message: string) => Promise<HTMLIonToastElement>;
|
|
11
|
+
success: (message: string) => Promise<HTMLIonToastElement>;
|
|
12
|
+
warning: (message: string) => Promise<HTMLIonToastElement>;
|
|
13
|
+
error: (message: string) => Promise<HTMLIonToastElement>;
|
|
14
|
+
};
|
|
15
|
+
alert(header: string, message: string, options: AlertOptions): Promise<HTMLIonAlertElement>;
|
|
16
|
+
actionSheet(header: string, options: ActionSheetOptions): Promise<HTMLIonActionSheetElement>;
|
|
17
|
+
loading(message?: string): Promise<HTMLIonLoadingElement>;
|
|
18
|
+
withLoading<T>(message?: string): (observable: Observable<T>) => Observable<T>;
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<OverlayController, never>;
|
|
20
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<OverlayController>;
|
|
21
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@solar-angular/ui-ionic",
|
|
3
|
+
"version": "19.0.4",
|
|
4
|
+
"sideEffects": false,
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"peerDependencies": {
|
|
9
|
+
"@angular/core": ">=19.0.0",
|
|
10
|
+
"@ionic/angular": ">=7.0.0"
|
|
11
|
+
},
|
|
12
|
+
"module": "fesm2022/solar-angular-ui-ionic.mjs",
|
|
13
|
+
"typings": "index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": {
|
|
16
|
+
"default": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./index.d.ts",
|
|
20
|
+
"default": "./fesm2022/solar-angular-ui-ionic.mjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"tslib": "^2.3.0"
|
|
25
|
+
}
|
|
26
|
+
}
|