mat-helper 0.0.1 → 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/fesm2022/mat-helper.mjs +13 -0
- package/fesm2022/mat-helper.mjs.map +1 -1
- package/index.d.ts +3 -1
- package/package.json +1 -1
package/fesm2022/mat-helper.mjs
CHANGED
|
@@ -36,6 +36,19 @@ class MatHelper {
|
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
scrollToTarget(elementRef) {
|
|
40
|
+
if (elementRef) {
|
|
41
|
+
const nativeElement = elementRef.nativeElement;
|
|
42
|
+
nativeElement.scrollIntoView({
|
|
43
|
+
behavior: 'smooth',
|
|
44
|
+
block: 'start',
|
|
45
|
+
});
|
|
46
|
+
// console.log('Scrolling to target element...');
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
console.error('Target element reference not found.');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
39
52
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.2", ngImport: i0, type: MatHelper, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
40
53
|
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
54
|
}
|
|
@@ -1 +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,KAAK,qECnBlB,+NAMA,EAAA,MAAA,EAAA,CAAA,EAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDSY,gBAAgB,EAAA,QAAA,EAAA,8DAAA,EAAA,MAAA,EAAA,CAAA,OAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,gBAAgB,yGAAE,SAAS,EAAA,QAAA,EAAA,iOAAA,EAAA,MAAA,EAAA,CAAA,WAAA,CAAA,EAAA,QAAA,EAAA,CAAA,WAAA,EAAA,WAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FAI5C,KAAK,EAAA,UAAA,EAAA,CAAA;kBANjB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,WAAW,WACZ,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,SAAS,CAAC,EAAA,QAAA,EAAA,+NAAA,EAAA;;;MEJ7C,SAAS,CAAA;AACb,IAAA,QAAQ,GAAG,MAAM,CAAC,WAAW,CAAC;AAC9B,IAAA,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC;
|
|
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, ElementRef, 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\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 scrollToTarget(elementRef: ElementRef): void {\r\n if (elementRef) {\r\n const nativeElement = elementRef.nativeElement;\r\n\r\n nativeElement.scrollIntoView({\r\n behavior: 'smooth',\r\n block: 'start',\r\n });\r\n // console.log('Scrolling to target element...');\r\n } else {\r\n console.error('Target element reference not found.');\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,KAAK,qECnBlB,+NAMA,EAAA,MAAA,EAAA,CAAA,EAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDSY,gBAAgB,EAAA,QAAA,EAAA,8DAAA,EAAA,MAAA,EAAA,CAAA,OAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,gBAAgB,yGAAE,SAAS,EAAA,QAAA,EAAA,iOAAA,EAAA,MAAA,EAAA,CAAA,WAAA,CAAA,EAAA,QAAA,EAAA,CAAA,WAAA,EAAA,WAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FAI5C,KAAK,EAAA,UAAA,EAAA,CAAA;kBANjB,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,WAAW,WACZ,CA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AAA;kBANrB,SAAS;+BACE,gBAAgB,EAAA,OAAA,EACjB,EAAE,EAAA,QAAA,EACD,CAAA,0BAAA,CAA4B,EAAA;;;ACRxC;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { ElementRef } from '@angular/core';
|
|
1
3
|
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
|
|
2
4
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
3
|
-
import * as i0 from '@angular/core';
|
|
4
5
|
|
|
5
6
|
declare class MatHelper {
|
|
6
7
|
snackBar: MatSnackBar;
|
|
7
8
|
dialog: MatDialog;
|
|
8
9
|
presentAlert(text: string, onDidDismiss?: () => void): Promise<void>;
|
|
10
|
+
scrollToTarget(elementRef: ElementRef): void;
|
|
9
11
|
static ɵfac: i0.ɵɵFactoryDeclaration<MatHelper, never>;
|
|
10
12
|
static ɵcmp: i0.ɵɵComponentDeclaration<MatHelper, "lib-mat-helper", never, {}, {}, never, never, true, never>;
|
|
11
13
|
}
|