Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/code-examples/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@
<ul>
<li><a routerLink="modals/confirm">Confirm</a></li>
<li><a routerLink="modals/modal">Modal</a></li>
<li><a routerLink="modals/inline-help">Modal (inline-help)</a></li>
</ul>
</li>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<sky-modal>
<sky-modal-header>
Modal title
<sky-help-inline class="sky-control-help"></sky-help-inline>
</sky-modal-header>
<sky-modal-content></sky-modal-content>
<sky-modal-footer>
<button
class="sky-btn sky-btn-primary sky-margin-inline-sm"
type="button"
(click)="instance.save()"
>
Save
</button>
<button
class="sky-btn sky-btn-link"
type="button"
(click)="instance.close()"
>
Close
</button>
</sky-modal-footer>
</sky-modal>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Component } from '@angular/core';
import { SkyModalInstance } from '@skyux/modals';

@Component({
selector: 'app-modal-demo-modal',
templateUrl: './modal-demo-modal.component.html',
})
export class ModalDemoModalComponent {
constructor(public instance: SkyModalInstance) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<button
class="sky-btn sky-btn-default"
type="button"
(click)="onOpenModalClick()"
>
Open modal with inline help
</button>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Component } from '@angular/core';
import { SkyModalConfiguration, SkyModalService } from '@skyux/modals';

import { ModalDemoModalComponent } from './modal-demo-modal.component';

@Component({
selector: 'app-modal-demo',
templateUrl: './modal-demo.component.html',
})
export class ModalDemoComponent {
public modalSize = 'medium';

#modalSvc: SkyModalService;

constructor(modalSvc: SkyModalService) {
this.#modalSvc = modalSvc;
}

public onOpenModalClick(): void {
const options: SkyModalConfiguration = {
size: this.modalSize,
};

this.#modalSvc.open(ModalDemoModalComponent, options);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SkyIdModule } from '@skyux/core';
import { SkyInputBoxModule } from '@skyux/forms';
import { SkyHelpInlineModule } from '@skyux/indicators';
import { SkyModalModule } from '@skyux/modals';

import { ModalDemoModalComponent } from './modal-demo-modal.component';
import { ModalDemoComponent } from './modal-demo.component';

@NgModule({
imports: [
CommonModule,
FormsModule,
SkyIdModule,
SkyInputBoxModule,
SkyModalModule,
SkyHelpInlineModule,
],
declarations: [ModalDemoComponent, ModalDemoModalComponent],
exports: [ModalDemoComponent],
})
export class ModalDemoModule {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { SkyModalService } from '@skyux/modals';
import { SkyModalConfiguration, SkyModalService } from '@skyux/modals';

import { ModalDemoModalComponent } from './modal-demo-modal.component';

Expand All @@ -19,12 +19,11 @@ export class ModalDemoComponent {
}

public onOpenModalClick(): void {
const modalInstanceType: any = ModalDemoModalComponent;
const options: any = {
const options: SkyModalConfiguration = {
helpKey: this.helpKey,
size: this.modalSize,
};

this.#modalSvc.open(modalInstanceType, options);
this.#modalSvc.open(ModalDemoModalComponent, options);
}
}
4 changes: 4 additions & 0 deletions apps/code-examples/src/app/features/modals.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ import { RouterModule, Routes } from '@angular/router';

import { ConfirmDemoComponent as ConfirmConfirmDemoComponent } from '../code-examples/modals/confirm/confirm-demo.component';
import { ConfirmDemoModule as ConfirmConfirmDemoModule } from '../code-examples/modals/confirm/confirm-demo.module';
import { ModalDemoComponent as ModalInlineHelpDemoComponent } from '../code-examples/modals/inline-help/modal-demo.component';
import { ModalDemoModule as ModalInlineHelpModule } from '../code-examples/modals/inline-help/modal-demo.module';
import { ModalDemoComponent as ModalModalDemoComponent } from '../code-examples/modals/modal/modal-demo.component';
import { ModalDemoModule as ModalModalDemoModule } from '../code-examples/modals/modal/modal-demo.module';

const routes: Routes = [
{ path: 'confirm', component: ConfirmConfirmDemoComponent },
{ path: 'modal', component: ModalModalDemoComponent },
{ path: 'inline-help', component: ModalInlineHelpDemoComponent },
];

@NgModule({
Expand All @@ -22,6 +25,7 @@ export class ModalsFeatureRoutingModule {}
ConfirmConfirmDemoModule,
ModalModalDemoModule,
ModalsFeatureRoutingModule,
ModalInlineHelpModule,
],
})
export class ModalsFeatureModule {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<sky-modal>
<sky-modal-header> Title </sky-modal-header>
<sky-modal-header>
Title
<sky-help-inline
*ngIf="showHelp"
class="sky-control-help"
></sky-help-inline>
</sky-modal-header>
<sky-modal-content>
<label for="unsaved-work-checkbox">
Is there unsaved work?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
templateUrl: './modal-close-confirm.component.html',
})
export class ModalCloseConfirmComponent {
public showHelp = false;
public hasUnsavedWork = true;
public confirmationConfig = true;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<sky-modal>
<sky-modal-header>
{{ title }}
<sky-help-inline
*ngIf="showHelp"
class="sky-control-help"
></sky-help-inline>
</sky-modal-header>
<sky-modal-content>
<div>Content A</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ import { SkyModalService } from '@skyux/modals';
providers: [SkyModalService],
})
export class ModalDemoComponent {
public showHelp = false;
public title = 'Hello world';
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<sky-modal>
<sky-modal-header>
{{ title }}
<sky-help-inline
*ngIf="showHelp"
class="sky-control-help"
></sky-help-inline>
</sky-modal-header>
<sky-modal-content>
<sky-input-box class="sky-margin-stacked-lg">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { SkyModalInstance, SkyModalService } from '@skyux/modals';
})
export class ModalFormDemoComponent {
public title = 'Modal form with scroll';
public showHelp = false;

constructor(public instance: SkyModalInstance) {}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<sky-modal>
<sky-modal-header>
{{ title }}
<sky-help-inline
*ngIf="showHelp"
class="sky-control-help"
></sky-help-inline>
</sky-modal-header>
<sky-modal-content> Content for Full Screen </sky-modal-content>
<sky-modal-footer> Footer </sky-modal-footer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ import { SkyModalService } from '@skyux/modals';
providers: [SkyModalService],
})
export class ModalFullPageDemoComponent {
public showHelp = false;
public title = 'Hello world';
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<sky-modal>
<sky-modal-header>
{{ title }}
<sky-help-inline
*ngIf="showHelp"
class="sky-control-help"
></sky-help-inline>
</sky-modal-header>
<sky-modal-content> Content A </sky-modal-content>
<sky-modal-footer> Footer </sky-modal-footer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ import { SkyModalService } from '@skyux/modals';
providers: [SkyModalService],
})
export class ModalLargeDemoComponent {
public showHelp = false;
public title = 'Hello world';
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<sky-modal [tiledBody]="true">
<sky-modal-header>
{{ title }}
<sky-help-inline
*ngIf="showHelp"
class="sky-control-help"
></sky-help-inline>
</sky-modal-header>
<sky-modal-content>
<sky-tile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ import { SkyModalService } from '@skyux/modals';
providers: [SkyModalService],
})
export class ModalTiledDemoComponent {
public showHelp = false;
public title = 'Hello world';
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<div>
<label>
<input type="checkbox" [(ngModel)]="showHelp" />
Show inline help
</label>
</div>

<div>
<button class="sky-btn sky-btn-primary" type="button" (click)="openModal()">
Open modal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { ModalTiledDemoComponent } from './modal-tiled-demo.component';
styleUrls: ['./modal-visual.component.scss'],
})
export class ModalVisualComponent {
public showHelp = false;
public buttonsHidden: boolean;

constructor(private modal: SkyModalService) {}
Expand Down Expand Up @@ -127,6 +128,8 @@ export class ModalVisualComponent {
this.showButtons();
});

instance.componentInstance.showHelp = this.showHelp;

return instance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SkyInputBoxModule } from '@skyux/forms';
import { SkyHelpInlineModule } from '@skyux/indicators';
import { SkyModalModule } from '@skyux/modals';
import { SkyTilesModule } from '@skyux/tiles';

Expand Down Expand Up @@ -35,6 +36,7 @@ import { ModalVisualComponent } from './modal-visual.component';
SkyTilesModule,
SkyModalModule,
ModalVisualRoutingModule,
SkyHelpInlineModule,
],
})
export class ModalVisualModule {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterTestingModule } from '@angular/router/testing';
import { MutationObserverService } from '@skyux/core';
import { SkyThemeService } from '@skyux/theme';

import { SkyModalModule } from '../modal.module';

import { ModalMockMutationObserverService } from './mock-modal-mutation-observer';
import { ModalMockThemeService } from './mock-theme.service';
import { ModalAutofocusTestComponent } from './modal-autofocus.component.fixture';
import { ModalFooterTestComponent } from './modal-footer.component.fixture';
Expand Down Expand Up @@ -34,10 +32,6 @@ import { ModalTestComponent } from './modal.component.fixture';
provide: SkyThemeService,
useClass: ModalMockThemeService,
},
{
provide: MutationObserverService,
useClass: ModalMockMutationObserverService,
},
],
})
export class SkyModalFixturesModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
[skyThemeClass]="{
'sky-font-display-3': 'modern'
}"
skyTrim
>
<ng-content></ng-content>
</h1>
<span class="sky-control-help-container" skyTrim
><ng-content select=".sky-control-help"></ng-content
></span>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
h1 {
margin: 0;
line-height: 1.2;
display: inline;
}

@include sky-theme-modern-dark {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { SkyModalBeforeCloseHandler } from './modal-before-close-handler';
import { SkyModalComponentAdapterService } from './modal-component-adapter.service';
import { SkyModalHostService } from './modal-host.service';
import { SkyModalInstance } from './modal-instance';
import { SkyModalScrollShadowDirective } from './modal-scroll-shadow.directive';
import { SkyModalService } from './modal.service';

describe('Modal component', () => {
Expand Down Expand Up @@ -106,10 +107,6 @@ describe('Modal component', () => {
return TestBed.inject(Router);
}

function getMockMutationObserverService(): ModalMockMutationObserverService {
return TestBed.inject<any>(MutationObserverService);
}

function openModal<T>(modalType: T, config?: Record<string, any>) {
const modalInstance = getModalService().open(modalType, config);

Expand Down Expand Up @@ -901,8 +898,21 @@ describe('Modal component', () => {
}

beforeEach(() => {
const modalMockMutationObserverService =
new ModalMockMutationObserverService();

TestBed.overrideDirective(SkyModalScrollShadowDirective, {
add: {
providers: [
{
provide: MutationObserverService,
useValue: modalMockMutationObserverService,
},
],
},
});
mutationObserverCreateSpy = spyOn(
getMockMutationObserverService(),
modalMockMutationObserverService,
'create'
).and.callThrough();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export interface SkyModalConfigurationInterface {
tiledBody?: boolean;

/**
* @deprecated To display a help button in the modal header, include a help button element, such as `sky-help-inline`, in the `sky-modal-header` element and a `sky-control-help` CSS class on that help button element
* Specifies a `helpKey` string. This property displays
* the <i class="fa fa-question-circle" aria-hidden="true"></i> button in the modal header.
* When users click this button, the `helpOpened` event broadcasts the `helpKey` parameter.
Expand Down
Loading