@ddiazr/modal-generic 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 ADDED
@@ -0,0 +1,79 @@
1
+ # Generic Modal
2
+
3
+ Modal dinamico Angular 21+
4
+
5
+ ## Instalación
6
+
7
+ ```bash
8
+ npm install @ddiazr/modal-generic
9
+ ```
10
+
11
+ ## Peer Dependencies
12
+
13
+ ```bash
14
+ npm i bootstrap @fortawesome/fontawesome-free
15
+ ```
16
+
17
+ ## Campos
18
+
19
+ | Propiedad | Tipo | Obligatorio | Descripción |
20
+ | ------------ | --------- | ----------- | -------------------------------------------------------------------- |
21
+ | `textTitle` | `string` | ❌ No | Campo para darle un titulo al modal |
22
+ | `modalSize` | `string` | ❌ No | Por defecto lg pero le puedes mandar sm,md,xl |
23
+ | `showFooter` | `boolean` | ❌ No | Muestra el footer por si quieres agregar algo en el footer del modal |
24
+
25
+ ## Uso básico
26
+
27
+ ```typescript
28
+ import { ModalGeneric } from '@ddiazr/modal-generic';
29
+
30
+ @Component({
31
+ imports: [ModalGeneric],
32
+ template: `
33
+ @if (showModal()) {
34
+ <mdl-modal-generic
35
+ textTitle="Mi titulo"
36
+ [showFooter]="false"
37
+ modalSize="md"
38
+ >
39
+ <ng-container buttonclose>
40
+ <button type="button" class="btn-close py-0" (click)="showModal.set(false)"></button>
41
+ </ng-container>
42
+
43
+ <ng-container body>
44
+ INCRUSTA TU HTML QUE NECESITES
45
+ </ng-container>
46
+
47
+ <ng-container footer>
48
+ INCRUSTA TU HTML QUE NECESITES SI ES SHOWFOOTER VA TRUE
49
+ </ng-container>
50
+ </mdl-modal-generic>
51
+ }
52
+ `,
53
+ })
54
+ export class AppComponent {
55
+ showModal signal<boolean>(false)
56
+
57
+ }
58
+ ```
59
+
60
+ ## Configuración de estilos
61
+
62
+ En tu `angular.json`:
63
+
64
+ ```json
65
+ "styles": [
66
+ "node_modules/bootstrap/dist/css/bootstrap.min.css",
67
+ "node_modules/@fortawesome/fontawesome-free/css/all.min.css"
68
+ ]
69
+ ```
70
+
71
+ ## Licencia
72
+
73
+ MIT
74
+
75
+ # Source files
76
+
77
+ src/
78
+ _.ts
79
+ !_.d.ts
@@ -0,0 +1,50 @@
1
+ import * as i0 from '@angular/core';
2
+ import { input, inject, ViewChild, Component } from '@angular/core';
3
+ import { CommonModule } from '@angular/common';
4
+ import { NgbModal, NgbModalConfig } from '@ng-bootstrap/ng-bootstrap';
5
+
6
+ class ModalGeneric {
7
+ textTitle = input('', ...(ngDevMode ? [{ debugName: "textTitle" }] : []));
8
+ modalSize = input('lg', ...(ngDevMode ? [{ debugName: "modalSize" }] : []));
9
+ showFooter = input(true, ...(ngDevMode ? [{ debugName: "showFooter" }] : []));
10
+ FullScreen = input(false, ...(ngDevMode ? [{ debugName: "FullScreen" }] : []));
11
+ modal;
12
+ modalService = inject(NgbModal);
13
+ config = inject(NgbModalConfig);
14
+ contentTemplate;
15
+ constructor() {
16
+ this.config.backdrop = 'static';
17
+ this.config.keyboard = false;
18
+ }
19
+ ngAfterViewInit() {
20
+ this.modal = this.modalService.open(this.contentTemplate, {
21
+ size: this.modalSize(),
22
+ fullscreen: this.FullScreen(),
23
+ });
24
+ }
25
+ ngOnDestroy() {
26
+ if (this.modal) {
27
+ this.modal.close(); // Cierra el modal
28
+ }
29
+ }
30
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ModalGeneric, deps: [], target: i0.ɵɵFactoryTarget.Component });
31
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.2", type: ModalGeneric, isStandalone: true, selector: "mdl-modal-generic", inputs: { textTitle: { classPropertyName: "textTitle", publicName: "textTitle", isSignal: true, isRequired: false, transformFunction: null }, modalSize: { classPropertyName: "modalSize", publicName: "modalSize", isSignal: true, isRequired: false, transformFunction: null }, showFooter: { classPropertyName: "showFooter", publicName: "showFooter", isSignal: true, isRequired: false, transformFunction: null }, FullScreen: { classPropertyName: "FullScreen", publicName: "FullScreen", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "contentTemplate", first: true, predicate: ["content"], descendants: true }], ngImport: i0, template: "<ng-template #content let-modal>\r\n <div class=\"modal-content\">\r\n <div class=\"modal-header\">\r\n <h1 class=\"modal-title fs-5\" id=\"xlModalLabel\">{{ textTitle() }}</h1>\r\n <ng-content select=\"[buttonclose]\"></ng-content>\r\n </div>\r\n <div class=\"modal-body dark-modal\">\r\n <ng-content select=\"[body]\"></ng-content>\r\n </div>\r\n @if (showFooter()) {\r\n <div class=\"modal-footer\">\r\n <ng-content select=\"[footer]\"></ng-content>\r\n </div>\r\n }\r\n </div>\r\n</ng-template>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
32
+ }
33
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ModalGeneric, decorators: [{
34
+ type: Component,
35
+ args: [{ selector: 'mdl-modal-generic', imports: [CommonModule], template: "<ng-template #content let-modal>\r\n <div class=\"modal-content\">\r\n <div class=\"modal-header\">\r\n <h1 class=\"modal-title fs-5\" id=\"xlModalLabel\">{{ textTitle() }}</h1>\r\n <ng-content select=\"[buttonclose]\"></ng-content>\r\n </div>\r\n <div class=\"modal-body dark-modal\">\r\n <ng-content select=\"[body]\"></ng-content>\r\n </div>\r\n @if (showFooter()) {\r\n <div class=\"modal-footer\">\r\n <ng-content select=\"[footer]\"></ng-content>\r\n </div>\r\n }\r\n </div>\r\n</ng-template>\r\n" }]
36
+ }], ctorParameters: () => [], propDecorators: { textTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "textTitle", required: false }] }], modalSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "modalSize", required: false }] }], showFooter: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFooter", required: false }] }], FullScreen: [{ type: i0.Input, args: [{ isSignal: true, alias: "FullScreen", required: false }] }], contentTemplate: [{
37
+ type: ViewChild,
38
+ args: ['content']
39
+ }] } });
40
+
41
+ /*
42
+ * Public API Surface of modal-generic
43
+ */
44
+
45
+ /**
46
+ * Generated bundle index. Do not edit.
47
+ */
48
+
49
+ export { ModalGeneric };
50
+ //# sourceMappingURL=ddiazr-modal-generic.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ddiazr-modal-generic.mjs","sources":["../../../projects/modal-generic/src/lib/modal-generic.ts","../../../projects/modal-generic/src/lib/modal-generic.html","../../../projects/modal-generic/src/public-api.ts","../../../projects/modal-generic/src/ddiazr-modal-generic.ts"],"sourcesContent":["import {\r\n Component,\r\n ViewChild,\r\n TemplateRef,\r\n inject,\r\n input,\r\n} from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { NgbModal, NgbModalRef, NgbModalConfig } from '@ng-bootstrap/ng-bootstrap';\r\n@Component({\r\n selector: 'mdl-modal-generic',\r\n imports: [CommonModule],\r\n templateUrl: './modal-generic.html',\r\n styles: ``,\r\n})\r\nexport class ModalGeneric {\r\n textTitle = input<string>('');\r\n modalSize = input<string>('lg');\r\n showFooter = input<boolean>(true);\r\n FullScreen = input<boolean>(false);\r\n\r\n modal?: NgbModalRef;\r\n\r\n modalService = inject(NgbModal);\r\n config = inject(NgbModalConfig);\r\n @ViewChild('content') contentTemplate!: TemplateRef<any>;\r\n constructor() {\r\n this.config.backdrop = 'static';\r\n this.config.keyboard = false;\r\n }\r\n\r\n ngAfterViewInit(): void {\r\n this.modal = this.modalService.open(this.contentTemplate, {\r\n size: this.modalSize(),\r\n fullscreen: this.FullScreen(),\r\n });\r\n }\r\n\r\n ngOnDestroy(): void {\r\n if (this.modal) {\r\n this.modal.close(); // Cierra el modal\r\n }\r\n }\r\n}\r\n","<ng-template #content let-modal>\r\n <div class=\"modal-content\">\r\n <div class=\"modal-header\">\r\n <h1 class=\"modal-title fs-5\" id=\"xlModalLabel\">{{ textTitle() }}</h1>\r\n <ng-content select=\"[buttonclose]\"></ng-content>\r\n </div>\r\n <div class=\"modal-body dark-modal\">\r\n <ng-content select=\"[body]\"></ng-content>\r\n </div>\r\n @if (showFooter()) {\r\n <div class=\"modal-footer\">\r\n <ng-content select=\"[footer]\"></ng-content>\r\n </div>\r\n }\r\n </div>\r\n</ng-template>\r\n","/*\r\n * Public API Surface of modal-generic\r\n */\r\n\r\nexport * from './lib/modal-generic';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAea,YAAY,CAAA;AACvB,IAAA,SAAS,GAAG,KAAK,CAAS,EAAE,qDAAC;AAC7B,IAAA,SAAS,GAAG,KAAK,CAAS,IAAI,qDAAC;AAC/B,IAAA,UAAU,GAAG,KAAK,CAAU,IAAI,sDAAC;AACjC,IAAA,UAAU,GAAG,KAAK,CAAU,KAAK,sDAAC;AAElC,IAAA,KAAK;AAEL,IAAA,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC/B,IAAA,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC;AACT,IAAA,eAAe;AACrC,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,QAAQ;AAC/B,QAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,KAAK;IAC9B;IAEA,eAAe,GAAA;AACb,QAAA,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;AACxD,YAAA,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE;AACtB,YAAA,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE;AAC9B,SAAA,CAAC;IACJ;IAEA,WAAW,GAAA;AACT,QAAA,IAAI,IAAI,CAAC,KAAK,EAAE;AACd,YAAA,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACrB;IACF;uGA3BW,YAAY,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,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EG;;;;"}
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@ddiazr/modal-generic",
3
+ "version": "0.0.1",
4
+ "description": "Modal generico donde puedes agregar header, body o footer a tu gusto",
5
+ "author": {
6
+ "name": "Dany Díaz",
7
+ "email": "danylen1@hotmail.com"
8
+ },
9
+ "license": "MIT",
10
+ "peerDependencies": {
11
+ "@angular/common": "^21.1.0",
12
+ "@angular/core": "^21.1.0",
13
+ "@ng-bootstrap/ng-bootstrap": "^18.0.0",
14
+ "bootstrap": "^5.3.8",
15
+ "@fortawesome/fontawesome-free": "^7.1.0"
16
+ },
17
+ "dependencies": {
18
+ "tslib": "^2.3.0"
19
+ },
20
+ "sideEffects": false,
21
+ "module": "fesm2022/ddiazr-modal-generic.mjs",
22
+ "typings": "types/ddiazr-modal-generic.d.ts",
23
+ "exports": {
24
+ "./package.json": {
25
+ "default": "./package.json"
26
+ },
27
+ ".": {
28
+ "types": "./types/ddiazr-modal-generic.d.ts",
29
+ "default": "./fesm2022/ddiazr-modal-generic.mjs"
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,21 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { TemplateRef } from '@angular/core';
3
+ import { NgbModalRef, NgbModal, NgbModalConfig } from '@ng-bootstrap/ng-bootstrap';
4
+
5
+ declare class ModalGeneric {
6
+ textTitle: _angular_core.InputSignal<string>;
7
+ modalSize: _angular_core.InputSignal<string>;
8
+ showFooter: _angular_core.InputSignal<boolean>;
9
+ FullScreen: _angular_core.InputSignal<boolean>;
10
+ modal?: NgbModalRef;
11
+ modalService: NgbModal;
12
+ config: NgbModalConfig;
13
+ contentTemplate: TemplateRef<any>;
14
+ constructor();
15
+ ngAfterViewInit(): void;
16
+ ngOnDestroy(): void;
17
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ModalGeneric, never>;
18
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ModalGeneric, "mdl-modal-generic", never, { "textTitle": { "alias": "textTitle"; "required": false; "isSignal": true; }; "modalSize": { "alias": "modalSize"; "required": false; "isSignal": true; }; "showFooter": { "alias": "showFooter"; "required": false; "isSignal": true; }; "FullScreen": { "alias": "FullScreen"; "required": false; "isSignal": true; }; }, {}, never, ["[buttonclose]", "[body]", "[footer]"], true, never>;
19
+ }
20
+
21
+ export { ModalGeneric };