mat-helper 0.0.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.
- package/README.md +63 -0
- package/fesm2022/mat-helper.mjs +56 -0
- package/fesm2022/mat-helper.mjs.map +1 -0
- package/index.d.ts +26 -0
- package/package.json +23 -0
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# MatHelper
|
|
2
|
+
|
|
3
|
+
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.3.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 mat-helper
|
|
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/mat-helper
|
|
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,56 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, Component } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/material/dialog';
|
|
4
|
+
import { MAT_DIALOG_DATA, MatDialogActions, MatDialogContent, MatDialog } from '@angular/material/dialog';
|
|
5
|
+
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
6
|
+
import { MatButton } from '@angular/material/button';
|
|
7
|
+
|
|
8
|
+
class Alert {
|
|
9
|
+
dialogRef;
|
|
10
|
+
data = inject(MAT_DIALOG_DATA);
|
|
11
|
+
constructor(dialogRef) {
|
|
12
|
+
this.dialogRef = dialogRef;
|
|
13
|
+
}
|
|
14
|
+
close() {
|
|
15
|
+
this.dialogRef.close();
|
|
16
|
+
}
|
|
17
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: Alert, deps: [{ token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
18
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.2", type: Alert, isStandalone: true, selector: "lib-alert", ngImport: i0, template: "<mat-dialog-content>\r\n <div style=\"white-space: pre-line\">{{ data.message }}</div>\r\n</mat-dialog-content>\r\n<mat-dialog-actions>\r\n <button mat-button (click)=\"close()\">OK</button>\r\n</mat-dialog-actions>\r\n", styles: [""], dependencies: [{ kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }] });
|
|
19
|
+
}
|
|
20
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: Alert, decorators: [{
|
|
21
|
+
type: Component,
|
|
22
|
+
args: [{ selector: 'lib-alert', imports: [MatDialogActions, MatDialogContent, MatButton], template: "<mat-dialog-content>\r\n <div style=\"white-space: pre-line\">{{ data.message }}</div>\r\n</mat-dialog-content>\r\n<mat-dialog-actions>\r\n <button mat-button (click)=\"close()\">OK</button>\r\n</mat-dialog-actions>\r\n" }]
|
|
23
|
+
}], ctorParameters: () => [{ type: i1.MatDialogRef }] });
|
|
24
|
+
|
|
25
|
+
class MatHelper {
|
|
26
|
+
snackBar = inject(MatSnackBar);
|
|
27
|
+
dialog = inject(MatDialog);
|
|
28
|
+
async presentAlert(text, onDidDismiss) {
|
|
29
|
+
const dialogRef = this.dialog.open(Alert, {
|
|
30
|
+
minWidth: '300px',
|
|
31
|
+
data: { message: text },
|
|
32
|
+
});
|
|
33
|
+
if (onDidDismiss) {
|
|
34
|
+
dialogRef.afterClosed().subscribe(() => {
|
|
35
|
+
onDidDismiss();
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: MatHelper, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
40
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.2", type: MatHelper, isStandalone: true, selector: "lib-mat-helper", ngImport: i0, template: ` <p>mat-helper works!</p> `, isInline: true, styles: [""] });
|
|
41
|
+
}
|
|
42
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: MatHelper, decorators: [{
|
|
43
|
+
type: Component,
|
|
44
|
+
args: [{ selector: 'lib-mat-helper', imports: [], template: ` <p>mat-helper works!</p> ` }]
|
|
45
|
+
}] });
|
|
46
|
+
|
|
47
|
+
/*
|
|
48
|
+
* Public API Surface of mat-helper
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Generated bundle index. Do not edit.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
export { Alert, MatHelper };
|
|
56
|
+
//# sourceMappingURL=mat-helper.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mat-helper.mjs","sources":["../../../projects/mat-helper/src/lib/components/alert/alert.ts","../../../projects/mat-helper/src/lib/components/alert/alert.html","../../../projects/mat-helper/src/lib/mat-helper.ts","../../../projects/mat-helper/src/public-api.ts","../../../projects/mat-helper/src/mat-helper.ts"],"sourcesContent":["import { Component, inject } from '@angular/core';\r\nimport { MatButton } from '@angular/material/button';\r\nimport {\r\n MAT_DIALOG_DATA,\r\n MatDialogActions,\r\n MatDialogContent,\r\n MatDialogRef,\r\n} from '@angular/material/dialog';\r\n\r\nexport interface AlertInput {\r\n message: string;\r\n}\r\n\r\n@Component({\r\n selector: 'lib-alert',\r\n imports: [MatDialogActions, MatDialogContent, MatButton],\r\n templateUrl: './alert.html',\r\n styleUrl: './alert.css',\r\n})\r\nexport class Alert {\r\n readonly data = inject<AlertInput>(MAT_DIALOG_DATA);\r\n constructor(private dialogRef: MatDialogRef<Alert>) {}\r\n close(): void {\r\n this.dialogRef.close();\r\n }\r\n}\r\n","<mat-dialog-content>\r\n <div style=\"white-space: pre-line\">{{ data.message }}</div>\r\n</mat-dialog-content>\r\n<mat-dialog-actions>\r\n <button mat-button (click)=\"close()\">OK</button>\r\n</mat-dialog-actions>\r\n","import { Component, inject } from '@angular/core';\r\nimport { MatDialog } from '@angular/material/dialog';\r\nimport { MatSnackBar } from '@angular/material/snack-bar';\r\nimport { Alert, AlertInput } from './components/alert/alert';\r\n\r\n@Component({\r\n selector: 'lib-mat-helper',\r\n imports: [],\r\n template: ` <p>mat-helper works!</p> `,\r\n styles: ``,\r\n})\r\nexport class MatHelper {\r\n public snackBar = inject(MatSnackBar);\r\n public dialog = inject(MatDialog);\r\n async presentAlert(text: string, onDidDismiss?: () => void) {\r\n const dialogRef = this.dialog.open(Alert, {\r\n minWidth: '300px',\r\n data: { message: text } as AlertInput,\r\n });\r\n\r\n if (onDidDismiss) {\r\n dialogRef.afterClosed().subscribe(() => {\r\n onDidDismiss();\r\n });\r\n }\r\n }\r\n}\r\n","/*\r\n * Public API Surface of mat-helper\r\n */\r\n\r\nexport * from './lib/mat-helper';\r\n\r\nexport * from './lib/components/alert/alert';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MAmBa,KAAK,CAAA;AAEI,IAAA,SAAA;AADX,IAAA,IAAI,GAAG,MAAM,CAAa,eAAe,CAAC;AACnD,IAAA,WAAA,CAAoB,SAA8B,EAAA;QAA9B,IAAA,CAAA,SAAS,GAAT,SAAS;IAAwB;IACrD,KAAK,GAAA;AACH,QAAA,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;IACxB;uGALW,KAAK,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,YAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAL,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KA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A,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,SAAS,0EAHV,CAAA,0BAAA,CAA4B,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FAG3B,SAAS,EAAA,UAAA,EAAA,CAAA;kBANrB,SAAS;+BACE,gBAAgB,EAAA,OAAA,EACjB,EAAE,EAAA,QAAA,EACD,CAAA,0BAAA,CAA4B,EAAA;;;ACRxC;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
|
|
2
|
+
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
|
|
5
|
+
declare class MatHelper {
|
|
6
|
+
snackBar: MatSnackBar;
|
|
7
|
+
dialog: MatDialog;
|
|
8
|
+
presentAlert(text: string, onDidDismiss?: () => void): Promise<void>;
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MatHelper, never>;
|
|
10
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MatHelper, "lib-mat-helper", never, {}, {}, never, never, true, never>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface AlertInput {
|
|
14
|
+
message: string;
|
|
15
|
+
}
|
|
16
|
+
declare class Alert {
|
|
17
|
+
private dialogRef;
|
|
18
|
+
readonly data: AlertInput;
|
|
19
|
+
constructor(dialogRef: MatDialogRef<Alert>);
|
|
20
|
+
close(): void;
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Alert, never>;
|
|
22
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Alert, "lib-alert", never, {}, {}, never, never, true, never>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { Alert, MatHelper };
|
|
26
|
+
export type { AlertInput };
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mat-helper",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^20.3.0",
|
|
6
|
+
"@angular/core": "^20.3.0"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"tslib": "^2.3.0"
|
|
10
|
+
},
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"module": "fesm2022/mat-helper.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/mat-helper.mjs"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|