From d803315f132c08ef1b4a5289b38f1e8fd78b20c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laure-H=C3=A9l=C3=A8ne=20Bruneton?= Date: Fri, 26 Apr 2024 10:33:48 +0200 Subject: [PATCH] feat(editor): support resourceUpdated field in record form --- .../form-field-resource-updated.component.css | 0 ...form-field-resource-updated.component.html | 4 +++ ...m-field-resource-updated.component.spec.ts | 25 +++++++++++++++++++ .../form-field-resource-updated.component.ts | 15 +++++++++++ .../form-field/form-field.component.html | 5 ++++ .../form-field/form-field.component.ts | 7 +++++- 6 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.css create mode 100644 libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.html create mode 100644 libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.spec.ts create mode 100644 libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.ts diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.css b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.html b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.html new file mode 100644 index 0000000000..f61dcdbe81 --- /dev/null +++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.html @@ -0,0 +1,4 @@ + diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.spec.ts b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.spec.ts new file mode 100644 index 0000000000..5765cc29d2 --- /dev/null +++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing' +import { FormControl } from '@angular/forms' +import { FormFieldResourceUpdatedComponent } from './form-field-resource-updated.component' + +describe('FormFieldResourceUpdatedComponent', () => { + let component: FormFieldResourceUpdatedComponent + let fixture: ComponentFixture + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [FormFieldResourceUpdatedComponent], + }).compileComponents() + + fixture = TestBed.createComponent(FormFieldResourceUpdatedComponent) + component = fixture.componentInstance + const control = new FormControl() + control.setValue(new Date()) + component.control = control + fixture.detectChanges() + }) + + it('should create', () => { + expect(component).toBeTruthy() + }) +}) diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.ts b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.ts new file mode 100644 index 0000000000..d6a229e4e4 --- /dev/null +++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.ts @@ -0,0 +1,15 @@ +import { ChangeDetectionStrategy, Component, Input } from '@angular/core' +import { FormControl } from '@angular/forms' +import { DatePickerComponent } from '@geonetwork-ui/ui/inputs' + +@Component({ + selector: 'gn-ui-form-field-resource-updated', + templateUrl: './form-field-resource-updated.component.html', + styleUrls: ['./form-field-resource-updated.component.css'], + changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [DatePickerComponent], +}) +export class FormFieldResourceUpdatedComponent { + @Input() control!: FormControl +} diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html b/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html index b5825658b1..e4047c7e3d 100644 --- a/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html @@ -51,6 +51,11 @@ [label]="config.labelKey | translate" > + + +