build: Use prettier for typescript
Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
@@ -8,9 +8,8 @@ describe('CompletionDialogComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CompletionDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CompletionDialogComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -11,8 +11,8 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
styleUrls: ['./completion-dialog.component.scss']
|
||||
})
|
||||
export class CompletionDialogComponent {
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<CompletionDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<CompletionDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ConfigurationWizardComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ConfigurationWizardComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ConfigurationWizardComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -11,12 +11,12 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
styleUrls: ['./configuration-wizard.component.scss']
|
||||
})
|
||||
export class ConfigurationWizardComponent {
|
||||
|
||||
show: number;
|
||||
/**
|
||||
* @param {MatDialogRef<ConfigurationWizardComponent>} dialogRef MatDialogRef<ConfigurationWizardComponent>.
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<ConfigurationWizardComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ConfigurationWizardComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {}
|
||||
}
|
||||
|
||||
@@ -23,25 +23,24 @@ import { SharedModule } from '../shared/shared.module';
|
||||
* Configuration Wizard Module
|
||||
*/
|
||||
@NgModule({
|
||||
declarations: [
|
||||
PopoverComponent,
|
||||
PopoverCloseDirective,
|
||||
PopoverArrowDirective,
|
||||
ConfigurationWizardComponent,
|
||||
ContinueSetupDialogComponent,
|
||||
NextStepDialogComponent,
|
||||
CompletionDialogComponent
|
||||
],
|
||||
imports: [
|
||||
SharedModule,
|
||||
CommonModule,
|
||||
OverlayModule,
|
||||
PortalModule,
|
||||
MatDialogModule
|
||||
],
|
||||
exports: [
|
||||
PopoverCloseDirective
|
||||
]
|
||||
declarations: [
|
||||
PopoverComponent,
|
||||
PopoverCloseDirective,
|
||||
PopoverArrowDirective,
|
||||
ConfigurationWizardComponent,
|
||||
ContinueSetupDialogComponent,
|
||||
NextStepDialogComponent,
|
||||
CompletionDialogComponent
|
||||
],
|
||||
imports: [
|
||||
SharedModule,
|
||||
CommonModule,
|
||||
OverlayModule,
|
||||
PortalModule,
|
||||
MatDialogModule
|
||||
],
|
||||
exports: [
|
||||
PopoverCloseDirective
|
||||
]
|
||||
})
|
||||
|
||||
export class ConfigurationWizardModule { }
|
||||
export class ConfigurationWizardModule {}
|
||||
|
||||
@@ -7,9 +7,7 @@ import { Injectable } from '@angular/core';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
||||
export class ConfigurationWizardService {
|
||||
|
||||
/**
|
||||
* Home Tour
|
||||
*/
|
||||
@@ -196,13 +194,12 @@ export class ConfigurationWizardService {
|
||||
/*To show popover on manage reports*/
|
||||
showManageReports = false;
|
||||
|
||||
constructor() { }
|
||||
constructor() {}
|
||||
|
||||
/**
|
||||
* Set all variables to false.
|
||||
*/
|
||||
closeConfigWizard(): void {
|
||||
|
||||
this.showToolbar = false;
|
||||
this.showToolbarAdmin = false;
|
||||
this.showSideNav = false;
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('ContinueSetupDialogComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ContinueSetupDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ContinueSetupDialogComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+4
-4
@@ -11,16 +11,16 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
styleUrls: ['./continue-setup-dialog.component.scss']
|
||||
})
|
||||
export class ContinueSetupDialogComponent {
|
||||
|
||||
/* Current Step Name*/
|
||||
stepName: number;
|
||||
|
||||
/**
|
||||
* @param {MatDialogRef<ContinueSetupDialogComponent>} dialogRef MatDialogRef<ContinueSetupDialogComponent>.
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<ContinueSetupDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ContinueSetupDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {
|
||||
this.stepName = data.stepName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('NextStepDialogComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ NextStepDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [NextStepDialogComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -11,7 +11,6 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
styleUrls: ['./next-step-dialog.component.scss']
|
||||
})
|
||||
export class NextStepDialogComponent {
|
||||
|
||||
/* Step Percentage */
|
||||
stepPercentage: number;
|
||||
/* Next Step Name */
|
||||
@@ -22,11 +21,12 @@ export class NextStepDialogComponent {
|
||||
/**
|
||||
* @param {MatDialogRef<NextStepDialogComponent>} dialogRef MatDialogRef<NextStepDialogComponent>.
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<NextStepDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||
this.stepPercentage = data.stepPercentage;
|
||||
this.nextStepName = data.nextStepName;
|
||||
this.previousStepName = data.previousStepName;
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<NextStepDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {
|
||||
this.stepPercentage = data.stepPercentage;
|
||||
this.nextStepName = data.nextStepName;
|
||||
this.previousStepName = data.previousStepName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,11 +37,13 @@ export class PopoverArrowDirective implements OnDestroy {
|
||||
* @param {PopoverRef} popoverRef PopoverRef.
|
||||
* @param {ChangeDetectorRef} cd ChangeDetectorRef
|
||||
*/
|
||||
constructor(private popoverRef: PopoverRef,
|
||||
private cd: ChangeDetectorRef) {
|
||||
constructor(
|
||||
private popoverRef: PopoverRef,
|
||||
private cd: ChangeDetectorRef
|
||||
) {
|
||||
this.arrowSize = popoverRef.config.arrowSize;
|
||||
|
||||
this.subscription = popoverRef.positionChanges().subscribe(p => {
|
||||
this.subscription = popoverRef.positionChanges().subscribe((p) => {
|
||||
const { offsetX, offsetY } = p.connectionPair;
|
||||
|
||||
this.offsetTop = offsetY >= 0 ? offsetY * -1 : null;
|
||||
|
||||
@@ -16,9 +16,7 @@ export class PopoverCloseDirective<T = any> {
|
||||
/**
|
||||
* @param {PopoverRef<T>} popoverRef PopoverRef<T>.
|
||||
*/
|
||||
constructor(
|
||||
@Optional() private popoverRef: PopoverRef<T>
|
||||
) {}
|
||||
constructor(@Optional() private popoverRef: PopoverRef<T>) {}
|
||||
|
||||
@HostListener('click') onClick(): void {
|
||||
if (!this.popoverRef) {
|
||||
|
||||
@@ -19,25 +19,28 @@ export class PopoverRef<T = any> {
|
||||
* @param {FlexibleConnectedPositionStrategy} positionStrategy FlexibleConnectedPositionStrategy.
|
||||
* @param {PopoverConfig} config PopoverConfig.
|
||||
*/
|
||||
constructor(private overlayRef: OverlayRef,
|
||||
private positionStrategy: FlexibleConnectedPositionStrategy,
|
||||
public config: PopoverConfig) {
|
||||
constructor(
|
||||
private overlayRef: OverlayRef,
|
||||
private positionStrategy: FlexibleConnectedPositionStrategy,
|
||||
public config: PopoverConfig
|
||||
) {
|
||||
if (!config.disableClose) {
|
||||
this.overlayRef.backdropClick().subscribe(() => {
|
||||
// this.close();
|
||||
});
|
||||
|
||||
this.overlayRef.keydownEvents().pipe(
|
||||
filter(event => event.key === 'Escape')
|
||||
).subscribe(() => {
|
||||
// this.close();
|
||||
});
|
||||
this.overlayRef
|
||||
.keydownEvents()
|
||||
.pipe(filter((event) => event.key === 'Escape'))
|
||||
.subscribe(() => {
|
||||
// this.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Close popover
|
||||
*/
|
||||
/**
|
||||
* Close popover
|
||||
*/
|
||||
close(dialogResult?: T): void {
|
||||
this.afterClosedSubject.next(dialogResult);
|
||||
this.afterClosedSubject.complete();
|
||||
@@ -45,9 +48,9 @@ export class PopoverRef<T = any> {
|
||||
this.overlayRef.dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<T>}
|
||||
*/
|
||||
/**
|
||||
* @returns {Observable<T>}
|
||||
*/
|
||||
afterClosed(): Observable<T> {
|
||||
return this.afterClosedSubject.asObservable();
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('PopoverComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ PopoverComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [PopoverComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
/* Angular Imports */
|
||||
import { ComponentType, Overlay, OriginConnectionPosition, OverlayConnectionPosition, ConnectionPositionPair } from '@angular/cdk/overlay';
|
||||
import {
|
||||
ComponentType,
|
||||
Overlay,
|
||||
OriginConnectionPosition,
|
||||
OverlayConnectionPosition,
|
||||
ConnectionPositionPair
|
||||
} from '@angular/cdk/overlay';
|
||||
import { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
|
||||
import { Injectable, InjectionToken, Injector, TemplateRef, ElementRef } from '@angular/core';
|
||||
|
||||
@@ -33,7 +39,10 @@ export class PopoverService {
|
||||
* @param {Injector} injector Injector.
|
||||
* @param {overlay} overlay Overlay.
|
||||
*/
|
||||
constructor(private overlay: Overlay, private injector: Injector) { }
|
||||
constructor(
|
||||
private overlay: Overlay,
|
||||
private injector: Injector
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Opens the popover at target element
|
||||
@@ -42,10 +51,13 @@ export class PopoverService {
|
||||
* @param {string} position String.
|
||||
* @param {Partial<PopoverConfig> = {}} config Partial<PopoverConfig> = {}.
|
||||
*/
|
||||
open<D = any>(componentOrTemplate: ComponentType<any> | TemplateRef<any>,
|
||||
target: ElementRef | HTMLElement, position: string,
|
||||
backdrop: boolean,
|
||||
config: Partial<PopoverConfig> = {}): PopoverRef<D> {
|
||||
open<D = any>(
|
||||
componentOrTemplate: ComponentType<any> | TemplateRef<any>,
|
||||
target: ElementRef | HTMLElement,
|
||||
position: string,
|
||||
backdrop: boolean,
|
||||
config: Partial<PopoverConfig> = {}
|
||||
): PopoverRef<D> {
|
||||
const popoverConfig: PopoverConfig = Object.assign({}, defaultConfig, config);
|
||||
|
||||
const arrowSize = popoverConfig.arrowSize;
|
||||
@@ -55,14 +67,17 @@ export class PopoverService {
|
||||
let positions: ConnectionPositionPair[];
|
||||
// preferred positions, in order of priority
|
||||
if (position === 'bottom') {
|
||||
positions = [
|
||||
positions = [
|
||||
// bottom center
|
||||
{
|
||||
overlayX: 'center',
|
||||
overlayY: 'top',
|
||||
originX: 'center',
|
||||
originY: 'bottom',
|
||||
panelClass: ['top', 'center'],
|
||||
panelClass: [
|
||||
'top',
|
||||
'center'
|
||||
],
|
||||
offsetY: panelOffset
|
||||
},
|
||||
// bottom left
|
||||
@@ -71,7 +86,10 @@ export class PopoverService {
|
||||
overlayY: 'top',
|
||||
originX: 'center',
|
||||
originY: 'bottom',
|
||||
panelClass: ['top', 'left'],
|
||||
panelClass: [
|
||||
'top',
|
||||
'left'
|
||||
],
|
||||
offsetX: -1 * arrowOffset,
|
||||
offsetY: panelOffset
|
||||
},
|
||||
@@ -81,7 +99,10 @@ export class PopoverService {
|
||||
overlayY: 'top',
|
||||
originX: 'center',
|
||||
originY: 'bottom',
|
||||
panelClass: ['top', 'right'],
|
||||
panelClass: [
|
||||
'top',
|
||||
'right'
|
||||
],
|
||||
offsetX: arrowOffset,
|
||||
offsetY: panelOffset
|
||||
}
|
||||
@@ -94,7 +115,10 @@ export class PopoverService {
|
||||
overlayY: 'bottom',
|
||||
originX: 'center',
|
||||
originY: 'top',
|
||||
panelClass: ['bottom', 'center'],
|
||||
panelClass: [
|
||||
'bottom',
|
||||
'center'
|
||||
],
|
||||
offsetY: -1 * panelOffset
|
||||
},
|
||||
// top left
|
||||
@@ -103,7 +127,10 @@ export class PopoverService {
|
||||
overlayY: 'bottom',
|
||||
originX: 'center',
|
||||
originY: 'top',
|
||||
panelClass: ['bottom', 'left'],
|
||||
panelClass: [
|
||||
'bottom',
|
||||
'left'
|
||||
],
|
||||
offsetX: -1 * arrowOffset,
|
||||
offsetY: -1 * panelOffset
|
||||
},
|
||||
@@ -113,7 +140,10 @@ export class PopoverService {
|
||||
overlayY: 'bottom',
|
||||
originX: 'center',
|
||||
originY: 'top',
|
||||
panelClass: ['bottom', 'right'],
|
||||
panelClass: [
|
||||
'bottom',
|
||||
'right'
|
||||
],
|
||||
offsetX: arrowOffset,
|
||||
offsetY: -1 * panelOffset
|
||||
}
|
||||
@@ -122,27 +152,33 @@ export class PopoverService {
|
||||
positions = [
|
||||
// right
|
||||
{
|
||||
originX : 'end',
|
||||
originY : 'center',
|
||||
originX: 'end',
|
||||
originY: 'center',
|
||||
overlayX: 'start',
|
||||
overlayY: 'center',
|
||||
panelClass: ['center', 'left'],
|
||||
panelClass: [
|
||||
'center',
|
||||
'left'
|
||||
],
|
||||
offsetX: 0.5 * arrowOffset,
|
||||
offsetY: -1 * panelOffset
|
||||
},
|
||||
}
|
||||
];
|
||||
} else if (position === 'left') {
|
||||
positions = [
|
||||
// left
|
||||
{
|
||||
originX : 'start',
|
||||
originY : 'center',
|
||||
originX: 'start',
|
||||
originY: 'center',
|
||||
overlayX: 'end',
|
||||
overlayY: 'center',
|
||||
panelClass: ['center', 'right'],
|
||||
panelClass: [
|
||||
'center',
|
||||
'right'
|
||||
],
|
||||
offsetX: -0.5 * arrowOffset,
|
||||
offsetY: -1 * panelOffset
|
||||
},
|
||||
}
|
||||
];
|
||||
}
|
||||
if (backdrop === true) {
|
||||
@@ -151,11 +187,11 @@ export class PopoverService {
|
||||
showbackdrop = false;
|
||||
}
|
||||
const positionStrategy = this.overlay
|
||||
.position()
|
||||
.flexibleConnectedTo(target)
|
||||
.withPush(false)
|
||||
.withFlexibleDimensions(false)
|
||||
.withPositions(positions);
|
||||
.position()
|
||||
.flexibleConnectedTo(target)
|
||||
.withPush(false)
|
||||
.withFlexibleDimensions(false)
|
||||
.withPositions(positions);
|
||||
|
||||
const overlayRef = this.overlay.create({
|
||||
hasBackdrop: showbackdrop,
|
||||
@@ -167,34 +203,31 @@ export class PopoverService {
|
||||
|
||||
const popoverRef = new PopoverRef(overlayRef, positionStrategy, popoverConfig);
|
||||
|
||||
const popover = overlayRef.attach(new ComponentPortal(
|
||||
PopoverComponent,
|
||||
null,
|
||||
Injector.create({
|
||||
parent: this.injector,
|
||||
providers: [
|
||||
{ provide: PopoverRef, useValue: popoverRef }
|
||||
]
|
||||
})
|
||||
// new PortalInjector(
|
||||
// this.injector,
|
||||
// new WeakMap<any, any>([
|
||||
// [PopoverRef, popoverRef]
|
||||
// ])
|
||||
// )
|
||||
)).instance;
|
||||
const popover = overlayRef.attach(
|
||||
new ComponentPortal(
|
||||
PopoverComponent,
|
||||
null,
|
||||
Injector.create({
|
||||
parent: this.injector,
|
||||
providers: [
|
||||
{ provide: PopoverRef, useValue: popoverRef }]
|
||||
})
|
||||
// new PortalInjector(
|
||||
// this.injector,
|
||||
// new WeakMap<any, any>([
|
||||
// [PopoverRef, popoverRef]
|
||||
// ])
|
||||
// )
|
||||
)
|
||||
).instance;
|
||||
|
||||
if (componentOrTemplate instanceof TemplateRef) {
|
||||
// rendering a provided template dynamically
|
||||
popover.attachTemplatePortal(
|
||||
new TemplatePortal(
|
||||
componentOrTemplate,
|
||||
null,
|
||||
{
|
||||
$implicit: config.data,
|
||||
popover: popoverRef
|
||||
}
|
||||
)
|
||||
new TemplatePortal(componentOrTemplate, null, {
|
||||
$implicit: config.data,
|
||||
popover: popoverRef
|
||||
})
|
||||
);
|
||||
} else {
|
||||
// rendering a provided component dynamically
|
||||
@@ -206,7 +239,7 @@ export class PopoverService {
|
||||
parent: this.injector,
|
||||
providers: [
|
||||
{ provide: POPOVER_DATA, useValue: config.data },
|
||||
{ provide: PopoverRef, useValue: popoverRef },
|
||||
{ provide: PopoverRef, useValue: popoverRef }
|
||||
]
|
||||
})
|
||||
// new PortalInjector(
|
||||
@@ -218,7 +251,6 @@ export class PopoverService {
|
||||
// )
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
return popoverRef;
|
||||
|
||||
Reference in New Issue
Block a user