Skip to content

Commit

Permalink
fix(multiple): remove some circular deps in reports modules
Browse files Browse the repository at this point in the history
Circular deps in reports module, both in material and ionic packages, that prevented the partial ivy compilation
  • Loading branch information
trik committed Jun 22, 2021
1 parent a0fc21b commit 9864187
Show file tree
Hide file tree
Showing 16 changed files with 169 additions and 367 deletions.
42 changes: 0 additions & 42 deletions src/ionic/reports/column-widget.ts

This file was deleted.

54 changes: 0 additions & 54 deletions src/ionic/reports/default-widgets.ts

This file was deleted.

52 changes: 0 additions & 52 deletions src/ionic/reports/layout-widget.ts

This file was deleted.

4 changes: 0 additions & 4 deletions src/ionic/reports/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@
*/

export * from './chart-widget';
export * from './column-widget';
export * from './default-widgets';
export * from './formula-widget';
export * from './image-container-widget';
export * from './image-widget';
export * from './layout-widget';
export * from './map-widget';
export * from './page-break-widget';
export * from './report';
export * from './reports-module';
export * from './table-widget';
export * from './text-widget';
export * from './widget';
export * from './widget-service';
9 changes: 6 additions & 3 deletions src/ionic/reports/reports-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,20 @@ import {NgModule} from '@angular/core';
import {TranslateModule} from '@ngx-translate/core';

import {AjfChartWidgetComponent} from './chart-widget';
import {AjfColumnWidgetComponent} from './column-widget';
import {AjfFormulaWidgetComponent} from './formula-widget';
import {AjfImageContainerWidgetComponent} from './image-container-widget';
import {AjfImageWidgetComponent} from './image-widget';
import {AjfLayoutWidgetComponent} from './layout-widget';
import {AjfMapWidgetComponent} from './map-widget';
import {AjfPageBreakWidgetComponent} from './page-break-widget';
import {AjfReportRenderer} from './report';
import {AjfTableWidgetComponent} from './table-widget';
import {AjfTextWidgetComponent} from './text-widget';
import {AjfReportWidget} from './widget';
import {
AjfColumnWidgetComponent,
AjfLayoutWidgetComponent,
AjfReportWidget,
AjfWidgetService,
} from './widget';

@NgModule({
imports: [
Expand Down
33 changes: 0 additions & 33 deletions src/ionic/reports/widget-service.ts

This file was deleted.

79 changes: 77 additions & 2 deletions src/ionic/reports/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,59 @@
*
*/

import {AjfReportWidget as CoreComponent, AjfWidgetComponentsMap} from '@ajf/core/reports';
import {
AjfBaseWidgetComponent,
AjfColumnWidgetInstance,
AjfLayoutWidgetInstance,
AjfReportWidget as CoreComponent,
AjfWidgetComponentsMap,
AjfWidgetService as CoreService,
AjfWidgetType as wt,
} from '@ajf/core/reports';
import {
AfterContentChecked,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ComponentFactoryResolver,
ElementRef,
Injectable,
Renderer2,
ViewEncapsulation,
} from '@angular/core';
import {BehaviorSubject, Observable} from 'rxjs';

import {AjfChartWidgetComponent} from './chart-widget';
import {AjfFormulaWidgetComponent} from './formula-widget';
import {AjfImageContainerWidgetComponent} from './image-container-widget';
import {AjfImageWidgetComponent} from './image-widget';
import {AjfMapWidgetComponent} from './map-widget';
import {AjfPageBreakWidgetComponent} from './page-break-widget';
import {AjfTableWidgetComponent} from './table-widget';
import {AjfTextWidgetComponent} from './text-widget';

const defaultWidgetsFactory = (): AjfWidgetComponentsMap => {
const defaultWidgets = {} as AjfWidgetComponentsMap;
defaultWidgets[wt.Layout] = {component: AjfLayoutWidgetComponent};
defaultWidgets[wt.PageBreak] = {component: AjfPageBreakWidgetComponent};
defaultWidgets[wt.Image] = {component: AjfImageWidgetComponent};
defaultWidgets[wt.Text] = {component: AjfTextWidgetComponent};
defaultWidgets[wt.Chart] = {component: AjfChartWidgetComponent};
defaultWidgets[wt.Table] = {component: AjfTableWidgetComponent};
defaultWidgets[wt.DynamicTable] = {component: AjfTableWidgetComponent};
defaultWidgets[wt.Map] = {component: AjfMapWidgetComponent};
defaultWidgets[wt.Column] = {component: AjfColumnWidgetComponent};
defaultWidgets[wt.Formula] = {component: AjfFormulaWidgetComponent};
defaultWidgets[wt.ImageContainer] = {component: AjfImageContainerWidgetComponent};
return defaultWidgets;
};

import {AjfWidgetService} from './widget-service';
@Injectable({providedIn: 'root'})
export class AjfWidgetService extends CoreService {
constructor() {
super(defaultWidgetsFactory());
}
}

@Component({
selector: 'ajf-widget',
Expand All @@ -46,3 +89,35 @@ export class AjfReportWidget extends CoreComponent {
this.widgetsMap = widgetService.componentsMap;
}
}

@Component({
templateUrl: 'column-widget.html',
styleUrls: ['column-widget.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
})
export class AjfColumnWidgetComponent extends AjfBaseWidgetComponent<AjfColumnWidgetInstance> {
constructor(cdr: ChangeDetectorRef, el: ElementRef) {
super(cdr, el);
}
}

@Component({
templateUrl: 'layout-widget.html',
styleUrls: ['layout-widget.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
})
export class AjfLayoutWidgetComponent extends
AjfBaseWidgetComponent<AjfLayoutWidgetInstance> implements AfterContentChecked {
private _allcolumnsRendered$: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
readonly allcolumnsRendered$: Observable<boolean> =
this._allcolumnsRendered$ as Observable<boolean>;

constructor(cdr: ChangeDetectorRef, el: ElementRef) {
super(cdr, el);
}
ngAfterContentChecked(): void {
this._allcolumnsRendered$.next(true);
}
}
42 changes: 0 additions & 42 deletions src/material/reports/column-widget.ts

This file was deleted.

0 comments on commit 9864187

Please sign in to comment.