Skip to content

Commit

Permalink
feat(core): EditDescriptionOnly field to display additional text in f…
Browse files Browse the repository at this point in the history
…orms (#1945)

Co-authored-by: Simon <simon@aam-digital.com>
  • Loading branch information
sleidig and TheSlimvReal authored Jul 31, 2023
1 parent 656af2d commit 87a1c4d
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/app/core/config/config-fix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,10 @@ export const defaultJsonConfig = {
"config": {
"cols": [
["health_bloodGroup"],
["health_lastDentalCheckup"]
[
{ "id": "_description_health", "edit": "EditDescriptionOnly", "label": $localize`:description section:Health checkups are to be done regularly, at least every 6 months according to the program guidelines.`},
"health_lastDentalCheckup"
]
]
}
},
Expand Down
19 changes: 13 additions & 6 deletions src/app/core/core-components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const coreComponents: ComponentTuple[] = [
"Form",
() =>
import("./entity-components/entity-details/form/form.component").then(
(c) => c.FormComponent
(c) => c.FormComponent,
),
],
[
Expand Down Expand Up @@ -113,6 +113,13 @@ export const coreComponents: ComponentTuple[] = [
"./entity-components/entity-utils/dynamic-form-components/edit-number/edit-number.component"
).then((c) => c.EditNumberComponent),
],
[
"EditDescriptionOnly",
() =>
import(
"./entity-components/entity-utils/dynamic-form-components/edit-description-only/edit-description-only.component"
).then((c) => c.EditDescriptionOnlyComponent),
],
[
"DisplayCheckmark",
() =>
Expand Down Expand Up @@ -173,21 +180,21 @@ export const coreComponents: ComponentTuple[] = [
"UserSecurity",
() =>
import("./user/user-security/user-security.component").then(
(c) => c.UserSecurityComponent
(c) => c.UserSecurityComponent,
),
],
[
"Dashboard",
() =>
import("./dashboard/dashboard/dashboard.component").then(
(c) => c.DashboardComponent
(c) => c.DashboardComponent,
),
],
[
"EntityList",
() =>
import("./entity-components/entity-list/entity-list.component").then(
(c) => c.EntityListComponent
(c) => c.EntityListComponent,
),
],
[
Expand All @@ -205,14 +212,14 @@ export const coreComponents: ComponentTuple[] = [
"ConfigImport",
() =>
import("./config-setup/config-import/config-import.component").then(
(c) => c.ConfigImportComponent
(c) => c.ConfigImportComponent,
),
],
[
"MarkdownPage",
() =>
import("./markdown-page/markdown-page/markdown-page.component").then(
(c) => c.MarkdownPageComponent
(c) => c.MarkdownPageComponent,
),
],
[
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { EditDescriptionOnlyComponent } from "./edit-description-only.component";

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

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [EditDescriptionOnlyComponent],
}).compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(EditDescriptionOnlyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it("should create", () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Component, Input } from "@angular/core";
import { DynamicComponent } from "../../../../view/dynamic-components/dynamic-component.decorator";
import { FormFieldConfig } from "../../../entity-form/entity-form/FormConfig";

@DynamicComponent("EditDescriptionOnly")
@Component({
selector: "app-edit-description-only",
template: "{{formFieldConfig?.label}}",
standalone: true,
})
export class EditDescriptionOnlyComponent {
@Input() formFieldConfig: FormFieldConfig;
}

0 comments on commit 87a1c4d

Please sign in to comment.