Skip to content

Commit

Permalink
Merge pull request #2486 from IDEMSInternational/revert-2485-chore/pl…
Browse files Browse the repository at this point in the history
…h-components-folder

Revert "chore: move plh-specific components to plh components folder"
  • Loading branch information
jfmcquade authored Oct 28, 2024
2 parents bd7a9d0 + 7efa4dc commit 68ec49d
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 46 deletions.
16 changes: 4 additions & 12 deletions packages/components/plh/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,12 @@ import { NgModule, Type } from "@angular/core";
import type { ITemplateRowProps } from "src/app/shared/components/template/models";
import { CommonModule } from "@angular/common";
import { IonicModule } from "@ionic/angular";
import { TemplatePipesModule } from "src/app/shared/components/template/pipes";
import { LottieModule } from "ngx-lottie";
import { PlhParentPointCounterComponent } from "./parent-point-counter/parent-point-counter.component";
import { PlhParentPointBoxComponent } from "./parent-point-box/parent-point-box.component";

@NgModule({
imports: [CommonModule, IonicModule, TemplatePipesModule, LottieModule],
exports: [PlhParentPointCounterComponent, PlhParentPointBoxComponent],
declarations: [PlhParentPointCounterComponent, PlhParentPointBoxComponent],
providers: [],
imports: [CommonModule, IonicModule],
exports: [],
declarations: [],
})
export class PlhComponentsModule {}

export const PLH_COMPONENT_MAPPING: Record<string, Type<ITemplateRowProps>> = {
parent_point_counter: PlhParentPointCounterComponent,
parent_point_box: PlhParentPointBoxComponent,
};
export const PLH_COMPONENT_MAPPING: Record<string, Type<ITemplateRowProps>> = {};
2 changes: 2 additions & 0 deletions packages/data-models/flowTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ export namespace FlowTypes {
| "nested_properties"
| "number_selector"
| "odk_form"
| "parent_point_box"
| "parent_point_counter"
| "pdf"
| "progress_path"
| "qr_code"
Expand Down
8 changes: 6 additions & 2 deletions src/app/shared/components/template/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ import { TmplLottieAnimation } from "./lottie-animation";
import { TmplNavigationBarComponent } from "./navigation-bar/navigation-bar.component";
import { TmplNumberComponent } from "./number-selector/number-selector.component";
import { TmplOdkFormComponent } from "./odk-form/odk-form.component";
import { TmplParentPointBoxComponent } from "./points-item/points-item.component";
import { TmplParentPointCounterComponent } from "./parent-point-counter/parent-point-counter.component";
import { TmplPdfComponent } from "./pdf/pdf.component";
import { TmplProgressPathComponent } from "./progress-path/progress-path.component";
import { TmplQRCodeComponent } from "./qr-code/qr-code.component";
Expand All @@ -63,7 +65,6 @@ import { TmplVideoComponent } from "./video";
import { WorkshopsComponent } from "./layout/workshops_accordion";
import { TmplTextBubbleComponent } from "./text-bubble/text-bubble.component";
import { DEMO_COMPONENT_MAPPING } from "packages/components/demo";
import { PLH_COMPONENT_MAPPING } from "packages/components/plh";

/** All components should be exported as a single array for easy module import */
export const TEMPLATE_COMPONENTS = [
Expand Down Expand Up @@ -102,6 +103,8 @@ export const TEMPLATE_COMPONENTS = [
TmplNavigationBarComponent,
TmplNumberComponent,
TmplOdkFormComponent,
TmplParentPointBoxComponent,
TmplParentPointCounterComponent,
TmplPdfComponent,
TmplProgressPathComponent,
TmplQRCodeComponent,
Expand Down Expand Up @@ -160,6 +163,8 @@ const CORE_COMPONENT_MAPPING: Record<FlowTypes.TemplateRowType, Type<ITemplateRo
nested_properties: null as any,
number_selector: TmplNumberComponent,
odk_form: TmplOdkFormComponent,
parent_point_box: TmplParentPointBoxComponent,
parent_point_counter: TmplParentPointCounterComponent,
pdf: TmplPdfComponent,
progress_path: TmplProgressPathComponent,
qr_code: TmplQRCodeComponent,
Expand Down Expand Up @@ -194,5 +199,4 @@ const CORE_COMPONENT_MAPPING: Record<FlowTypes.TemplateRowType, Type<ITemplateRo
export const TEMPLATE_COMPONENT_MAPPING = {
...CORE_COMPONENT_MAPPING,
...DEMO_COMPONENT_MAPPING,
...PLH_COMPONENT_MAPPING,
};
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Component, OnChanges, OnInit } from "@angular/core";
import { getNumberParamFromTemplateRow, getStringParamFromTemplateRow } from "src/app/shared/utils";
import { TemplateBaseComponent } from "src/app/shared/components/template/components/base";
import { TemplateBaseComponent } from "../base";

@Component({
selector: "plh-parent-point-counter",
templateUrl: "./parent-point-counter.component.html",
styleUrls: ["./parent-point-counter.component.scss"],
})
export class PlhParentPointCounterComponent
export class TmplParentPointCounterComponent
extends TemplateBaseComponent
implements OnInit, OnChanges
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { async, ComponentFixture, TestBed } from "@angular/core/testing";
import { IonicModule } from "@ionic/angular";

import { PlhParentPointBoxComponent } from "./parent-point-box.component";
import { TmplParentPointBoxComponent } from "./points-item.component";

describe("TmplParentPointBoxComponent", () => {
let component: PlhParentPointBoxComponent;
let fixture: ComponentFixture<PlhParentPointBoxComponent>;
let component: TmplParentPointBoxComponent;
let fixture: ComponentFixture<TmplParentPointBoxComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [PlhParentPointBoxComponent],
declarations: [TmplParentPointBoxComponent],
imports: [IonicModule.forRoot()],
}).compileComponents();

fixture = TestBed.createComponent(PlhParentPointBoxComponent);
fixture = TestBed.createComponent(TmplParentPointBoxComponent);
component = fixture.componentInstance;
fixture.detectChanges();
}));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from "@angular/core";
import { TemplateBaseComponent } from "src/app/shared/components/template/components/base";
import { FlowTypes, ITemplateRowProps } from "src/app/shared/components/template/models";
import {
getBooleanParamFromTemplateRow,
getStringParamFromTemplateRow,
} from "src/app/shared/utils";
Component,
ElementRef,
HostBinding,
HostListener,
Input,
OnInit,
ViewChild,
} from "@angular/core";
import { TemplateBaseComponent } from "../base";
import { FlowTypes, ITemplateRowProps } from "../../models";
import { getBooleanParamFromTemplateRow, getStringParamFromTemplateRow } from "../../../../utils";
import { AnimationOptions } from "ngx-lottie";
import { TemplateAssetService } from "src/app/shared/components/template/services/template-asset.service";
import { TemplateAssetService } from "../../services/template-asset.service";

@Component({
selector: "plh-parent-point-box",
templateUrl: "./parent-point-box.component.html",
styleUrls: ["./parent-point-box.component.scss"],
selector: "plh-points-item",
templateUrl: "./points-item.component.html",
styleUrls: ["./points-item.component.scss"],
})
export class PlhParentPointBoxComponent
// TODO - why does the class name not match the file name??
export class TmplParentPointBoxComponent
extends TemplateBaseComponent
implements ITemplateRowProps, OnInit
{
Expand Down
12 changes: 1 addition & 11 deletions src/app/shared/components/template/pipes/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { NgModule } from "@angular/core";
import { CommonModule } from "@angular/common";

import { FilterDisplayComponentPipe } from "./filter-display-component.pipe";
import { LatexPipe } from "./latex.pipe";
import { MarkdownPipe } from "./markdown.pipe";
Expand All @@ -10,7 +7,7 @@ import { StyleListPipe } from "./styleList.pipe";
import { TranslatePipe } from "./translate.pipe";
import { QRCodePipe } from "./qr-code.pipe";

const TEMPLATE_PIPES = [
export const TEMPLATE_PIPES = [
FilterDisplayComponentPipe,
MarkdownPipe,
PLHAssetPipe,
Expand All @@ -20,10 +17,3 @@ const TEMPLATE_PIPES = [
LatexPipe,
QRCodePipe,
];

@NgModule({
declarations: [...TEMPLATE_PIPES],
exports: [...TEMPLATE_PIPES],
imports: [CommonModule],
})
export class TemplatePipesModule {}
9 changes: 6 additions & 3 deletions src/app/shared/components/template/template.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import { SharedPipesModule } from "../../pipes";
import { TooltipDirective } from "../common/directives/tooltip.directive";
import { TemplateContainerComponent } from "./template-container.component";
import { TEMPLATE_COMPONENTS } from "./components";
import { TEMPLATE_PIPES } from "./pipes";
import { TmplCompHostDirective, TemplateComponent } from "./template-component";

import { appendStyleSvgDirective } from "./directives/shadowStyleSvg.directive";
import { createCustomElement } from "@angular/elements";
import { TemplatePipesModule } from "./pipes";
import { PLHAssetPipe } from "./pipes/plh-asset.pipe";

@NgModule({
imports: [
Expand All @@ -30,17 +31,19 @@ import { TemplatePipesModule } from "./pipes";
RouterModule,
SwiperModule,
NgxExtendedPdfViewerModule,
TemplatePipesModule,
],
exports: [...TEMPLATE_COMPONENTS, TemplateContainerComponent],
exports: [...TEMPLATE_COMPONENTS, ...TEMPLATE_PIPES, TemplateContainerComponent],
declarations: [
TmplCompHostDirective,
TemplateComponent,
TooltipDirective,
...TEMPLATE_COMPONENTS,
...TEMPLATE_PIPES,
TemplateContainerComponent,
appendStyleSvgDirective,
],
// Pipes that are used in component ts files should be declared here
providers: [PLHAssetPipe],
})
export class TemplateComponentsModule {
// Create a custom element for the template container
Expand Down

0 comments on commit 68ec49d

Please sign in to comment.