Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit db02d4f

Browse files
authored
feat(package): individual module imports for modal components (#409)
This will allow future components to be imported individually without having to install an unused, optional dependency. Deprecations - ModalModule: Use About ModalModule
1 parent 662e08a commit db02d4f

16 files changed

+49
-28
lines changed

src/app/modal/about-modal-config.ts renamed to src/app/modal/about-modal/about-modal-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* A config containing properties for About Modal
2+
* A config containing properties for about modal
33
*/
44
export class AboutModalConfig {
55
/**

src/app/modal/about-modal-event.ts renamed to src/app/modal/about-modal/about-modal-event.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/**
2-
* An object containing events for pagination events
2+
* An object containing events for about modal events
33
*/
4-
54
export class AboutModalEvent {
65
/**
76
* Flag indicating Modal is open
File renamed without changes.

src/app/modal/about-modal.component.spec.ts renamed to src/app/modal/about-modal/about-modal.component.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
TestBed } from '@angular/core/testing';
55
import { By } from '@angular/platform-browser';
66
import { FormsModule } from '@angular/forms';
7+
78
import { ModalModule } from 'ngx-bootstrap';
89

910
import { AboutModalComponent } from './about-modal.component';
File renamed without changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { CommonModule } from '@angular/common';
2+
import { NgModule } from '@angular/core';
3+
4+
import { AboutModalComponent } from './about-modal.component';
5+
6+
@NgModule({
7+
imports: [
8+
CommonModule
9+
],
10+
declarations: [AboutModalComponent],
11+
exports: [AboutModalComponent]
12+
})
13+
export class AboutModalModule {}

src/app/modal/example/about-modal-example.component.html renamed to src/app/modal/about-modal/example/about-modal-example.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ <h4>About Modal Component Example</h4>
77
<div class="col-sm-12">
88
<button (click)="openModal(aboutTemplate)" class="btn btn-default">Launch About Modal</button>
99
<ng-template #aboutTemplate>
10-
<pfng-about-modal [config]="aboutConfig"
10+
<pfng-about-modal [config]="aboutConfig"
1111
(onCancel)="closeModal($event)">
1212
<div>
1313
Custom Content
@@ -28,10 +28,10 @@ <h4>Code</h4>
2828
<iframe class="demoframe" src="docs/classes/aboutmodalcomponent.html"></iframe>
2929
</tab>
3030
<tab heading="html">
31-
<include-content src="src/app/modal/example/about-modal-example.component.html"></include-content>
31+
<include-content src="src/app/modal/about-modal/example/about-modal-example.component.html"></include-content>
3232
</tab>
3333
<tab heading="typescript">
34-
<include-content src="src/app/modal/example/about-modal-example.component.ts"></include-content>
34+
<include-content src="src/app/modal/about-modal/example/about-modal-example.component.ts"></include-content>
3535
</tab>
3636
</tabset>
3737
</div>

src/app/modal/example/about-modal-example.component.ts renamed to src/app/modal/about-modal/example/about-modal-example.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {
22
Component,
33
OnInit,
44
TemplateRef,
5-
ViewChild,
65
ViewEncapsulation
76
} from '@angular/core';
87

@@ -18,7 +17,6 @@ import { AboutModalEvent } from '../about-modal-event';
1817
templateUrl: './about-modal-example.component.html'
1918
})
2019
export class AboutModalExampleComponent implements OnInit {
21-
2220
aboutConfig: AboutModalConfig;
2321
modalRef: BsModalRef;
2422

src/app/modal/example/about-modal-example.module.ts renamed to src/app/modal/about-modal/example/about-modal-example.module.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ import { ModalModule as BSModalModule } from 'ngx-bootstrap/modal';
55
import { TabsetConfig, TabsModule } from 'ngx-bootstrap/tabs';
66

77
import { AboutModalExampleComponent } from './about-modal-example.component';
8-
import { DemoComponentsModule } from '../../../demo/components/demo-components.module';
9-
import { ModalModule } from '../modal.module';
8+
import { DemoComponentsModule } from '../../../../demo/components/demo-components.module';
9+
import { AboutModalModule } from '../about-modal.module';
1010

1111
@NgModule({
1212
declarations: [
1313
AboutModalExampleComponent
1414
],
1515
imports: [
16+
AboutModalModule,
1617
CommonModule,
1718
DemoComponentsModule,
1819
BSModalModule.forRoot(),
19-
TabsModule.forRoot(),
20-
ModalModule
20+
TabsModule.forRoot()
2121
],
2222
providers: [TabsetConfig]
2323
})

src/app/modal/about-modal/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export { AboutModalConfig } from './about-modal-config';
2+
export { AboutModalComponent } from './about-modal.component';
3+
export { AboutModalEvent } from './about-modal-event';
4+
export { AboutModalModule } from './about-modal.module';

0 commit comments

Comments
 (0)