@anemona/aif-message 0.0.2
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 +63 -0
- package/fesm2022/anemona-aif-message.mjs +1 -0
- package/package.json +24 -0
- package/types/anemona-aif-message.d.ts +42 -0
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# AifMessage
|
|
2
|
+
|
|
3
|
+
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 21.1.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
ng generate component component-name
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
ng generate --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Building
|
|
20
|
+
|
|
21
|
+
To build the library, run:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
ng build aif-message
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
28
|
+
|
|
29
|
+
### Publishing the Library
|
|
30
|
+
|
|
31
|
+
Once the project is built, you can publish your library by following these steps:
|
|
32
|
+
|
|
33
|
+
1. Navigate to the `dist` directory:
|
|
34
|
+
```bash
|
|
35
|
+
cd dist/aif-message
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
2. Run the `npm publish` command to publish your library to the npm registry:
|
|
39
|
+
```bash
|
|
40
|
+
npm publish
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Running unit tests
|
|
44
|
+
|
|
45
|
+
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
ng test
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Running end-to-end tests
|
|
52
|
+
|
|
53
|
+
For end-to-end (e2e) testing, run:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
ng e2e
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
60
|
+
|
|
61
|
+
## Additional Resources
|
|
62
|
+
|
|
63
|
+
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import Swal from"sweetalert2";import{lang}from"@anemona/aif-core";function fireMsg(t){return t.target=document.querySelector("dialog[open]")||document.body,t.customClass={container:"!z-[100000] !pointer-events-auto"},Swal.fire(t)}function msg_confirm(t={}){return fireMsg({icon:t.icon||"info",title:t.title||null,text:t.text||lang(["form","alert.confirm.message"]),showCancelButton:!0,confirmButtonColor:t.confirmButtonColor||"red",cancelButtonColor:t.cancelButtonColor||"green",confirmButtonText:t.confirmButtonText||lang(["form","btn.ok"]),cancelButtonText:t.cancelButtonText||lang(["form","btn.cancel"])})}function msg_submit_invalid(t={}){fireMsg({icon:t.icon||"warning",title:t.title||lang(["alert","invalid.title"]),text:t.test||lang(["alert","invalid.message"]),confirmButtonColor:t.confirmButtonColor||"orange",confirmButtonText:t.confirmButtonText||lang(["form","btn.ok"])})}function msg_submit_empty(t={}){fireMsg({icon:t.icon||"warning",title:t.title||lang(["alert","empty.title"]),text:t.test||lang(["alert","empty.message"]),confirmButtonColor:t.confirmButtonColor||"orange",confirmButtonText:t.confirmButtonText||lang(["form","btn.ok"])})}function msg_submit_wait(t={}){return fireMsg({title:t.title||lang(["alert","wait.title"]),icon:t.icon||"info",text:t.text||lang(["alert","wait.message"]),allowOutsideClick:t.allowOutsideClick,showConfirmButton:t.showConfirmButton,willOpen:()=>{}}),function(){Swal.close()}}function msg_submit_success(t={}){return fireMsg({icon:t.icon||"success",title:t.title||lang(["alert","submit.success.title"]),text:t.text||lang(["alert","submit.success.message"]),confirmButtonColor:t.confirmButtonColor||"green",confirmButtonText:t.confirmButtonText||lang(["form","btn.ok"])})}function msg_success(t={}){return fireMsg({icon:t.icon||"success",title:t.title||lang(["alert","success.title"]),text:t.message||lang(["alert","success.message"]),confirmButtonColor:t.confirm?.color||"green",confirmButtonText:t.confirm?.text||lang(["form","btn.ok"]),allowOutsideClick:void 0===t.allowOutsideClick||t.allowOutsideClick})}function msg_submit_fail(t={}){fireMsg({icon:t.icon||"warning",title:t.title||lang(["alert","submit.fail.title"]),text:t.text||lang(["alert","submit.fail.message"]),confirmButtonColor:t.confirmButtonColor||"orange",confirmButtonText:t.confirmButtonText||lang(["form","btn.ok"])})}function msg_error_connection(t={}){fireMsg({icon:t.icon||"error",title:t.title||lang(["alert","error.connection.title"]),text:t.text||lang(["alert","error.connection.message"]),confirmButtonColor:t.confirmButtonColor||"red",confirmButtonText:t.confirmButtonText||lang(["form","btn.ok"])})}function msg_input(t={}){return fireMsg({title:t.title||lang(["alert","input.title"]),text:t.text||lang(["alert","input.message"]),input:t.input||"text",showCancelButton:t.showCancelButton||!1,confirmButtonText:t.confirmButtonText||lang(["form","btn.ok"]),allowOutsideClick:t.allowOutsideClick||!1,willOpen:t.willOpen||null})}function msg_session_expired(t={}){return msg_input({title:t.title||lang(["alert","session.expired.title"]),text:t.text||t.message||lang(["alert","session.expired.message"]),input:"password",confirmButtonText:lang(["form","btn.ok"]),allowOutsideClick:!1})}function msg_lean_message(t={}){return new Promise((e,n)=>{t.message?msg_confirm({title:t.title||lang(["alert","clean.title"]),text:t.message||lang(["alert","clean.message"]),icon:t.icon||"warning",confirmButtonText:t.confirm?.text||lang(["form","btn.clean.confirm"]),confirmButtonColor:t.confirm?.color||"red",cancelButtonText:t.cancel?.text||lang(["form","btn.clean.cancel"]),cancelButtonColor:t.cancel?.color||"green"}).then(t=>{e(!!t.isConfirmed)}):e(!0)})}function msg_cancel_message(t={}){return new Promise((e,n)=>{t.message?msg_confirm({title:t.title||lang(["alert","cancel.title"]),text:t.message||lang(["alert","cancel.message"]),icon:t.icon||"warning",confirmButtonText:t.confirm?.text||lang(["form","btn.ok"]),confirmButtonColor:t.confirm?.color||"red",cancelButtonText:t.cancel?.text||lang(["form","btn.cancel"]),cancelButtonColor:t.cancel?.color||"green"}).then(t=>{e(!!t.isConfirmed)}):e(!0)})}function msg_confirm_message(t={}){return new Promise((e,n)=>{t.message?msg_confirm({icon:t.icon||"warning",title:t.title,text:t.message,confirmButtonText:t.confirm?.text||null,cancelButtonText:t.cancel?.text||null}).then(t=>{e(!!t.isConfirmed)}):e(!0)})}function msg_save_message(t={}){return new Promise((e,n)=>{const o=t.save||{};o.title&&o.message?msg_success({title:o.title,message:o.message}).then(()=>{e(!0)}):e(!0)})}function msg_error_message(t={}){return new Promise((e,n)=>{const o=t.error||{};o.title&&o.message&&msg_submit_fail({title:o.title,text:o.message}),e(!0)})}function msg_warning(t,e){msg_success({title:t,message:e,icon:"warning",confirm:{text:lang(["form","btn.ok"]),color:"orange"}})}function msg_info(t,e){msg_success({title:t,message:e,icon:"info",confirm:{text:lang(["form","btn.ok"]),color:"blue"}})}function msg_error(t,e,n={}){msg_success({title:t,message:e,icon:"error",confirm:{text:n?.text||lang(["form","btn.ok"]),color:n?.color||"red"}})}const msg={submit_invalid:msg_submit_invalid,submit_empty:msg_submit_empty,submit_wait:msg_submit_wait,submit_success:msg_submit_success,submit_fail:msg_submit_fail,error_connection:msg_error_connection,error_message:msg_error_message,session_expired:msg_session_expired,confirm_message:msg_confirm_message,save_message:msg_save_message,cancel_message:msg_cancel_message,clear_message:msg_lean_message,input:msg_input,confirm:msg_confirm,success:msg_success,warning:msg_warning,info:msg_info,error:msg_error};export{msg,msg_cancel_message,msg_confirm,msg_confirm_message,msg_error,msg_error_connection,msg_error_message,msg_info,msg_input,msg_lean_message,msg_save_message,msg_session_expired,msg_submit_empty,msg_submit_fail,msg_submit_invalid,msg_submit_success,msg_submit_wait,msg_success,msg_warning};
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@anemona/aif-message",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^21.1.0",
|
|
6
|
+
"@angular/core": "^21.1.0",
|
|
7
|
+
"@anemona/aif-core": "^0.0.1"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"tslib": "^2.3.0"
|
|
11
|
+
},
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"module": "fesm2022/anemona-aif-message.mjs",
|
|
14
|
+
"typings": "types/anemona-aif-message.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
"./package.json": {
|
|
17
|
+
"default": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./types/anemona-aif-message.d.ts",
|
|
21
|
+
"default": "./fesm2022/anemona-aif-message.mjs"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as sweetalert2 from 'sweetalert2';
|
|
2
|
+
|
|
3
|
+
declare function msg_confirm(rd?: any): Promise<sweetalert2.SweetAlertResult<any>>;
|
|
4
|
+
declare function msg_submit_invalid(rd?: any): void;
|
|
5
|
+
declare function msg_submit_empty(rd?: any): void;
|
|
6
|
+
declare function msg_submit_wait(rd?: any): () => void;
|
|
7
|
+
declare function msg_submit_success(rd?: any): Promise<sweetalert2.SweetAlertResult<any>>;
|
|
8
|
+
declare function msg_success(rd?: any): Promise<sweetalert2.SweetAlertResult<any>>;
|
|
9
|
+
declare function msg_submit_fail(rd?: any): void;
|
|
10
|
+
declare function msg_error_connection(rd?: any): void;
|
|
11
|
+
declare function msg_input(rd?: any): Promise<sweetalert2.SweetAlertResult<any>>;
|
|
12
|
+
declare function msg_session_expired(rd?: any): Promise<sweetalert2.SweetAlertResult<any>>;
|
|
13
|
+
declare function msg_lean_message(clear?: any): Promise<any>;
|
|
14
|
+
declare function msg_cancel_message(cancel?: any): Promise<any>;
|
|
15
|
+
declare function msg_confirm_message(_confirm?: any): Promise<any>;
|
|
16
|
+
declare function msg_save_message(buttons?: any): Promise<any>;
|
|
17
|
+
declare function msg_error_message(message?: any): Promise<any>;
|
|
18
|
+
declare function msg_warning(title: string, message: string): void;
|
|
19
|
+
declare function msg_info(title: string, message: string): void;
|
|
20
|
+
declare function msg_error(title: string, message: string, confirm?: any): void;
|
|
21
|
+
declare const msg: {
|
|
22
|
+
submit_invalid: typeof msg_submit_invalid;
|
|
23
|
+
submit_empty: typeof msg_submit_empty;
|
|
24
|
+
submit_wait: typeof msg_submit_wait;
|
|
25
|
+
submit_success: typeof msg_submit_success;
|
|
26
|
+
submit_fail: typeof msg_submit_fail;
|
|
27
|
+
error_connection: typeof msg_error_connection;
|
|
28
|
+
error_message: typeof msg_error_message;
|
|
29
|
+
session_expired: typeof msg_session_expired;
|
|
30
|
+
confirm_message: typeof msg_confirm_message;
|
|
31
|
+
save_message: typeof msg_save_message;
|
|
32
|
+
cancel_message: typeof msg_cancel_message;
|
|
33
|
+
clear_message: typeof msg_lean_message;
|
|
34
|
+
input: typeof msg_input;
|
|
35
|
+
confirm: typeof msg_confirm;
|
|
36
|
+
success: typeof msg_success;
|
|
37
|
+
warning: typeof msg_warning;
|
|
38
|
+
info: typeof msg_info;
|
|
39
|
+
error: typeof msg_error;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { msg, msg_cancel_message, msg_confirm, msg_confirm_message, msg_error, msg_error_connection, msg_error_message, msg_info, msg_input, msg_lean_message, msg_save_message, msg_session_expired, msg_submit_empty, msg_submit_fail, msg_submit_invalid, msg_submit_success, msg_submit_wait, msg_success, msg_warning };
|