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 May 2, 2024
1 parent d797a6c commit d803315
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 1 deletion.
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 @@ -51,6 +51,11 @@
[label]="config.labelKey | translate"
></gn-ui-form-field-license>
</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 @@ -18,6 +18,7 @@ import { FormFieldArrayComponent } from './form-field-array/form-field-array.com
import { FormFieldFileComponent } from './form-field-file/form-field-file.component'
import { FormFieldLicenseComponent } from './form-field-license/form-field-license.component'
import { FormFieldObjectComponent } from './form-field-object/form-field-object.component'
import { FormFieldResourceUpdatedComponent } from './form-field-resource-updated/form-field-resource-updated.component'
import { FormFieldRichComponent } from './form-field-rich/form-field-rich.component'
import { FormFieldSimpleComponent } from './form-field-simple/form-field-simple.component'
import { FormFieldSpatialExtentComponent } from './form-field-spatial-extent/form-field-spatial-extent.component'
Expand All @@ -37,14 +38,15 @@ import { FormFieldConfig } from './form-field.model'
MatIconModule,
MatTooltipModule,
FormFieldWrapperComponent,
FormFieldLicenseComponent,
FormFieldResourceUpdatedComponent,
FormFieldSimpleComponent,
FormFieldRichComponent,
FormFieldObjectComponent,
FormFieldSpatialExtentComponent,
FormFieldTemporalExtentComponent,
FormFieldFileComponent,
FormFieldArrayComponent,
FormFieldLicenseComponent,
TranslateModule,
],
})
Expand Down Expand Up @@ -125,6 +127,9 @@ export class FormFieldComponent {
get isLicenses() {
return this.model === 'licenses'
}
get isResourceUpdated() {
return this.model === 'resourceUpdated'
}

get withoutWrapper() {
return this.model === 'title' || this.model === 'abstract'
Expand Down

0 comments on commit d803315

Please sign in to comment.