Skip to content

Commit

Permalink
feat(editor): support resourceUpdated field in record form
Browse files Browse the repository at this point in the history
  • Loading branch information
LHBruneton-C2C committed Apr 26, 2024
1 parent 235007f commit 1c8e1ef
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.16.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<gn-ui-date-picker
[date]="control.value"
(dateChange)="control.setValue($event)"
></gn-ui-date-picker>
Original file line number Diff line number Diff line change
@@ -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<FormFieldResourceUpdatedComponent>

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()
})
})
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
</span>
</div>
</ng-container>
<ng-container *ngIf="isResourceUpdated">
<gn-ui-form-field-resource-updated
[control]="formControl"
></gn-ui-form-field-resource-updated>
</ng-container>
<ng-container *ngIf="isSimpleField">
<gn-ui-form-field-simple
[type]="simpleType"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { FormFieldSimpleComponent } from './form-field-simple/form-field-simple.
import { FormFieldSpatialExtentComponent } from './form-field-spatial-extent/form-field-spatial-extent.component'
import { FormFieldTemporalExtentComponent } from './form-field-temporal-extent/form-field-temporal-extent.component'
import { FormFieldConfig } from './form-field.model'
import { FormFieldResourceUpdatedComponent } from './form-field-resource-updated/form-field-resource-updated.component'

@Component({
selector: 'gn-ui-form-field',
Expand All @@ -34,6 +35,7 @@ import { FormFieldConfig } from './form-field.model'
EditableLabelDirective,
MatIconModule,
MatTooltipModule,
FormFieldResourceUpdatedComponent,
FormFieldSimpleComponent,
FormFieldRichComponent,
FormFieldObjectComponent,
Expand Down Expand Up @@ -118,4 +120,7 @@ export class FormFieldComponent {
get isAbstract() {
return this.model === 'abstract'
}
get isResourceUpdated() {
return this.model === 'resourceUpdated'
}
}

0 comments on commit 1c8e1ef

Please sign in to comment.