-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
625 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
8 changes: 8 additions & 0 deletions
8
...ib/components/record-form/form-field/form-field-license/form-field-license.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<gn-ui-dropdown-selector | ||
[title]="label" | ||
[showTitle]="false" | ||
[choices]="choices" | ||
[selected]="selected" | ||
(selectValue)="onSelectValue($event)" | ||
> | ||
</gn-ui-dropdown-selector> |
39 changes: 39 additions & 0 deletions
39
...components/record-form/form-field/form-field-license/form-field-license.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing' | ||
|
||
import { FormFieldLicenseComponent } from './form-field-license.component' | ||
import { FormControl } from '@angular/forms' | ||
import { TranslateModule } from '@ngx-translate/core' | ||
|
||
describe('FormFieldLicenseComponent', () => { | ||
let component: FormFieldLicenseComponent | ||
let fixture: ComponentFixture<FormFieldLicenseComponent> | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [FormFieldLicenseComponent, TranslateModule.forRoot()], | ||
}).compileComponents() | ||
|
||
fixture = TestBed.createComponent(FormFieldLicenseComponent) | ||
component = fixture.componentInstance | ||
const control = new FormControl() | ||
control.setValue([{ text: 'cc-by' }]) | ||
component.control = control | ||
component.label = 'License' | ||
fixture.detectChanges() | ||
}) | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy() | ||
}) | ||
describe('#selected', () => { | ||
it('should get the selected value', () => { | ||
expect(component.selected).toBe('cc-by') | ||
}) | ||
}) | ||
describe('#onSelectValue', () => { | ||
it('should set the selected value', () => { | ||
component.onSelectValue('cc-by-sa') | ||
expect(component.control.value).toEqual([{ text: 'cc-by-sa' }]) | ||
}) | ||
}) | ||
}) |
64 changes: 64 additions & 0 deletions
64
.../lib/components/record-form/form-field/form-field-license/form-field-license.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core' | ||
import { FormControl } from '@angular/forms' | ||
import { marker } from '@biesbjerg/ngx-translate-extract-marker' | ||
import { DropdownSelectorComponent } from '@geonetwork-ui/ui/inputs' | ||
|
||
@Component({ | ||
selector: 'gn-ui-form-field-license', | ||
templateUrl: './form-field-license.component.html', | ||
styleUrls: ['./form-field-license.component.css'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
standalone: true, | ||
imports: [DropdownSelectorComponent], | ||
}) | ||
export class FormFieldLicenseComponent { | ||
@Input() control!: FormControl | ||
@Input() label: string | ||
|
||
get selected() { | ||
return this.control.value[0]?.text | ||
} | ||
|
||
onSelectValue(value: unknown) { | ||
this.control.setValue([{ text: value }]) | ||
} | ||
|
||
choices = [ | ||
{ | ||
value: 'cc-by', | ||
label: marker('editor.record.form.license.cc-by'), | ||
}, | ||
{ | ||
value: 'cc-by-sa', | ||
label: marker('editor.record.form.license.cc-by-sa'), | ||
}, | ||
{ | ||
value: 'cc-zero', | ||
label: marker('editor.record.form.license.cc-zero'), | ||
}, | ||
{ | ||
value: 'etalab', | ||
label: marker('editor.record.form.license.etalab'), | ||
}, | ||
{ | ||
value: 'etalab-v2', | ||
label: marker('editor.record.form.license.etalab-v2'), | ||
}, | ||
{ | ||
value: 'odbl', | ||
label: marker('editor.record.form.license.odbl'), | ||
}, | ||
{ | ||
value: 'odc-by', | ||
label: marker('editor.record.form.license.odc-by'), | ||
}, | ||
{ | ||
value: 'pddl', | ||
label: marker('editor.record.form.license.pddl'), | ||
}, | ||
{ | ||
value: 'unknown', | ||
label: marker('editor.record.form.license.unknown'), | ||
}, | ||
] | ||
} |
Empty file.
4 changes: 4 additions & 0 deletions
4
...rd-form/form-field/form-field-resource-updated/form-field-resource-updated.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
25 changes: 25 additions & 0 deletions
25
...form/form-field/form-field-resource-updated/form-field-resource-updated.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
}) | ||
}) |
15 changes: 15 additions & 0 deletions
15
...cord-form/form-field/form-field-resource-updated/form-field-resource-updated.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.