geonetwork-ui 2.11.0-dev.0559cfd9d → 2.11.0-dev.05fe30eee
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/geonetwork-ui.mjs +373 -181
- package/fesm2022/geonetwork-ui.mjs.map +1 -1
- package/index.d.ts +74 -10
- package/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +78 -1
- package/src/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts +11 -0
- package/src/libs/common/domain/src/lib/model/record/flags.model.ts +1 -0
- package/src/libs/common/domain/src/lib/model/record/index.ts +1 -0
- package/src/libs/common/domain/src/lib/platform.service.interface.ts +1 -0
- package/src/libs/common/domain/src/lib/repository/records-repository.interface.ts +19 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-constraints/form-field-constraints.component.ts +3 -5
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts/form-field-contacts.component.ts +2 -2
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-record-flags/form-field-record-flag-component.css +0 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-record-flags/form-field-record-flag-component.html +18 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-record-flags/form-field-record-flag-component.ts +86 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +100 -88
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts +11 -4
- package/src/libs/feature/editor/src/lib/components/record-form/record-form.component.ts +18 -4
- package/src/libs/feature/editor/src/lib/expressions.ts +67 -0
- package/src/libs/feature/editor/src/lib/fields.config.ts +13 -0
- package/src/libs/feature/editor/src/lib/models/editor-config.model.ts +10 -4
- package/src/libs/util/app-config/src/index.ts +1 -0
- package/src/libs/util/app-config/src/lib/app-config.ts +338 -284
- package/src/libs/util/app-config/src/lib/model.ts +17 -0
- package/src/libs/util/app-config/src/lib/parse-utils.ts +8 -4
- package/translations/de.json +4 -0
- package/translations/en.json +4 -0
- package/translations/es.json +4 -0
- package/translations/fr.json +4 -0
- package/translations/it.json +4 -0
- package/translations/nl.json +4 -0
- package/translations/pt.json +4 -0
- package/translations/sk.json +4 -0
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
DatasetFeatureCatalog,
|
|
12
12
|
LanguageCode,
|
|
13
13
|
LinkedRecord,
|
|
14
|
+
RecordFlag,
|
|
14
15
|
} from '../model/record'
|
|
15
16
|
|
|
16
17
|
export abstract class RecordsRepositoryInterface {
|
|
@@ -106,4 +107,22 @@ export abstract class RecordsRepositoryInterface {
|
|
|
106
107
|
): Observable<{ user: string; date: Date }>
|
|
107
108
|
abstract getRecordPublicationStatus(uuid: string): Observable<boolean>
|
|
108
109
|
abstract getApplicationLanguages(): Observable<LanguageCode[]>
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Sets a given flag on a record. Flags are not part of the metadata document, which is why they are
|
|
113
|
+
* not part of the Record model.
|
|
114
|
+
*/
|
|
115
|
+
abstract setRecordFlag(
|
|
116
|
+
uniqueIdentifier: string,
|
|
117
|
+
flagName: RecordFlag,
|
|
118
|
+
value: boolean
|
|
119
|
+
): Observable<void>
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Checks whether a given flag is enabled for a record.
|
|
123
|
+
*/
|
|
124
|
+
abstract getRecordFlag(
|
|
125
|
+
uniqueIdentifier: string,
|
|
126
|
+
flagName: RecordFlag
|
|
127
|
+
): Observable<boolean>
|
|
109
128
|
}
|
|
@@ -9,10 +9,7 @@ import {
|
|
|
9
9
|
|
|
10
10
|
import { SortableListComponent } from '../../../../../../../../../libs/ui/layout/src'
|
|
11
11
|
import { ConstraintCardComponent } from '../../../constraint-card/constraint-card.component'
|
|
12
|
-
import {
|
|
13
|
-
CatalogRecordKeys,
|
|
14
|
-
Constraint,
|
|
15
|
-
} from '../../../../../../../../../libs/common/domain/src/lib/model/record'
|
|
12
|
+
import { Constraint } from '../../../../../../../../../libs/common/domain/src/lib/model/record'
|
|
16
13
|
import { ButtonComponent } from '../../../../../../../../../libs/ui/inputs/src'
|
|
17
14
|
import { marker } from '@biesbjerg/ngx-translate-extract-marker'
|
|
18
15
|
import { TranslatePipe } from '@ngx-translate/core'
|
|
@@ -22,6 +19,7 @@ import {
|
|
|
22
19
|
provideNgIconsConfig,
|
|
23
20
|
} from '@ng-icons/core'
|
|
24
21
|
import { iconoirPlus } from '@ng-icons/iconoir'
|
|
22
|
+
import { FormFieldModel } from '../../../../models'
|
|
25
23
|
|
|
26
24
|
marker('editor.record.form.constraint.add.legalConstraints')
|
|
27
25
|
marker('editor.record.form.constraint.add.securityConstraints')
|
|
@@ -53,7 +51,7 @@ marker('editor.record.form.constraint.header.otherConstraints')
|
|
|
53
51
|
export class FormFieldConstraintsComponent implements OnInit {
|
|
54
52
|
@Input() label: string
|
|
55
53
|
@Input() value: Constraint[]
|
|
56
|
-
@Input() constraintType:
|
|
54
|
+
@Input() constraintType: FormFieldModel
|
|
57
55
|
@Output() valueChange = new EventEmitter<Constraint[]>()
|
|
58
56
|
|
|
59
57
|
constraintsHeader = ''
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
} from '../../../../../../../../../libs/util/shared/src'
|
|
37
37
|
import { map } from 'rxjs/operators'
|
|
38
38
|
import { SortableListComponent } from '../../../../../../../../../libs/ui/layout/src'
|
|
39
|
-
import {
|
|
39
|
+
import { FormFieldModelSpecifier } from '../../../../models/editor-config.model'
|
|
40
40
|
|
|
41
41
|
@Component({
|
|
42
42
|
selector: 'gn-ui-form-field-contacts',
|
|
@@ -59,7 +59,7 @@ export class FormFieldContactsComponent implements OnDestroy, OnChanges {
|
|
|
59
59
|
private changeDetectorRef = inject(ChangeDetectorRef)
|
|
60
60
|
|
|
61
61
|
@Input() value: Individual[]
|
|
62
|
-
@Input() modelSpecifier:
|
|
62
|
+
@Input() modelSpecifier: FormFieldModelSpecifier
|
|
63
63
|
@Output() valueChange: EventEmitter<Individual[]> = new EventEmitter()
|
|
64
64
|
|
|
65
65
|
contacts: Individual[] = []
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<div class="flex-1 flex justify-between items-center">
|
|
2
|
+
<gn-ui-check-toggle
|
|
3
|
+
[label]="labelKey() | translate"
|
|
4
|
+
[value]="initialValue$ | async"
|
|
5
|
+
(toggled)="onToggle($event)"
|
|
6
|
+
[attr.data-cy]="'record-flag-toggle-' + flagName()"
|
|
7
|
+
></gn-ui-check-toggle>
|
|
8
|
+
|
|
9
|
+
@if (hintKey()) {
|
|
10
|
+
<ng-icon
|
|
11
|
+
name="matHelpOutline"
|
|
12
|
+
size="16"
|
|
13
|
+
class="m-2"
|
|
14
|
+
[matTooltip]="hintKey() | translate"
|
|
15
|
+
matTooltipPosition="above"
|
|
16
|
+
></ng-icon>
|
|
17
|
+
}
|
|
18
|
+
</div>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
inject,
|
|
5
|
+
input,
|
|
6
|
+
} from '@angular/core'
|
|
7
|
+
import { AsyncPipe } from '@angular/common'
|
|
8
|
+
import { CheckToggleComponent } from '../../../../../../../../../libs/ui/inputs/src'
|
|
9
|
+
import { EditorFacade } from '../../../../+state/editor.facade'
|
|
10
|
+
import { TranslatePipe, TranslateService } from '@ngx-translate/core'
|
|
11
|
+
import { RecordFlag } from '../../../../../../../../../libs/common/domain/src/lib/model'
|
|
12
|
+
import { RecordsRepositoryInterface } from '../../../../../../../../../libs/common/domain/src/lib/repository/records-repository.interface'
|
|
13
|
+
import { toSignal } from '@angular/core/rxjs-interop'
|
|
14
|
+
import { filter } from 'rxjs'
|
|
15
|
+
import { NgIcon, provideIcons } from '@ng-icons/core'
|
|
16
|
+
import { MatTooltip } from '@angular/material/tooltip'
|
|
17
|
+
import { map, switchMap } from 'rxjs/operators'
|
|
18
|
+
import { matHelpOutline } from '@ng-icons/material-icons/outline'
|
|
19
|
+
import { NotificationsService } from '../../../../../../../../../libs/feature/notifications/src'
|
|
20
|
+
|
|
21
|
+
@Component({
|
|
22
|
+
selector: 'gn-ui-form-field-record-flag',
|
|
23
|
+
standalone: true,
|
|
24
|
+
imports: [AsyncPipe, CheckToggleComponent, TranslatePipe, NgIcon, MatTooltip],
|
|
25
|
+
viewProviders: [
|
|
26
|
+
provideIcons({
|
|
27
|
+
matHelpOutline,
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
templateUrl: './form-field-record-flag-component.html',
|
|
31
|
+
styleUrls: ['./form-field-record-flag-component.css'],
|
|
32
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
33
|
+
})
|
|
34
|
+
export class FormFieldRecordFlagComponent {
|
|
35
|
+
flagName = input<RecordFlag>()
|
|
36
|
+
labelKey = input<string>()
|
|
37
|
+
hintKey = input<string>()
|
|
38
|
+
|
|
39
|
+
private editorFacade = inject(EditorFacade)
|
|
40
|
+
private repository = inject(RecordsRepositoryInterface)
|
|
41
|
+
private notificationsService = inject(NotificationsService)
|
|
42
|
+
private translateService = inject(TranslateService)
|
|
43
|
+
|
|
44
|
+
private record = toSignal(this.editorFacade.record$)
|
|
45
|
+
|
|
46
|
+
recordKind = toSignal(
|
|
47
|
+
this.editorFacade.record$.pipe(map((record) => record.kind))
|
|
48
|
+
)
|
|
49
|
+
initialValue$ = this.editorFacade.record$.pipe(
|
|
50
|
+
filter((record) => !!record),
|
|
51
|
+
switchMap((record) =>
|
|
52
|
+
this.repository.getRecordFlag(record.uniqueIdentifier, this.flagName())
|
|
53
|
+
)
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
onToggle(enabled: boolean) {
|
|
57
|
+
if (this.record() === null) {
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
this.repository
|
|
61
|
+
.setRecordFlag(this.record().uniqueIdentifier, this.flagName(), enabled)
|
|
62
|
+
.subscribe({
|
|
63
|
+
next: () => {
|
|
64
|
+
// do nothing
|
|
65
|
+
},
|
|
66
|
+
error: (error) => {
|
|
67
|
+
this.notificationsService.showNotification(
|
|
68
|
+
{
|
|
69
|
+
type: 'error',
|
|
70
|
+
title: this.translateService.instant(
|
|
71
|
+
'editor.record.flag.saveError.title'
|
|
72
|
+
),
|
|
73
|
+
text: `${this.translateService.instant(
|
|
74
|
+
'editor.record.flag.saveError.body',
|
|
75
|
+
{
|
|
76
|
+
recordKind: this.recordKind(),
|
|
77
|
+
}
|
|
78
|
+
)} ${error.message}`,
|
|
79
|
+
},
|
|
80
|
+
undefined,
|
|
81
|
+
error
|
|
82
|
+
)
|
|
83
|
+
},
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
}
|
package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html
CHANGED
|
@@ -7,23 +7,22 @@
|
|
|
7
7
|
></gn-ui-form-field-open-data>
|
|
8
8
|
</ng-container> -->
|
|
9
9
|
<div class="flex flex-col h-full">
|
|
10
|
-
|
|
10
|
+
@if (withoutWrapper) {
|
|
11
11
|
<ng-container *ngTemplateOutlet="fieldContent"></ng-container>
|
|
12
|
-
|
|
13
|
-
<ng-template #withGenericWrapper>
|
|
12
|
+
} @else {
|
|
14
13
|
<gn-ui-form-field-wrapper
|
|
15
14
|
[label]="config.labelKey! | translate: { recordKind }"
|
|
16
15
|
[hint]="config.hintKey! | translate: { recordKind }"
|
|
17
16
|
>
|
|
18
17
|
<ng-container *ngTemplateOutlet="fieldContent"></ng-container>
|
|
19
18
|
</gn-ui-form-field-wrapper>
|
|
20
|
-
|
|
19
|
+
}
|
|
21
20
|
</div>
|
|
22
21
|
|
|
23
22
|
<ng-template #fieldContent>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<div class="flex flex-row flex-start items-center gap-3
|
|
23
|
+
@switch (model) {
|
|
24
|
+
@case ('title') {
|
|
25
|
+
<div class="flex flex-row flex-start items-center gap-3">
|
|
27
26
|
<textarea
|
|
28
27
|
#titleInput
|
|
29
28
|
cdkTextareaAutosize
|
|
@@ -45,158 +44,171 @@
|
|
|
45
44
|
class="m-2 cursor-pointer"
|
|
46
45
|
(click)="focusTitleInput()"
|
|
47
46
|
></ng-icon>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
@if (config.hintKey) {
|
|
48
|
+
<ng-icon
|
|
49
|
+
name="matHelpOutline"
|
|
50
|
+
size="16"
|
|
51
|
+
class="m-2"
|
|
52
|
+
[matTooltip]="config.hintKey! | translate: { recordKind }"
|
|
53
|
+
matTooltipPosition="above"
|
|
54
|
+
></ng-icon>
|
|
55
|
+
}
|
|
56
56
|
</div>
|
|
57
57
|
</div>
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
}
|
|
59
|
+
@case ('abstract') {
|
|
60
60
|
<gn-ui-form-field-rich
|
|
61
61
|
[label]="config.labelKey! | translate: { recordKind }"
|
|
62
62
|
[hint]="config.hintKey! | translate: { recordKind }"
|
|
63
63
|
[value]="valueAsString"
|
|
64
64
|
(valueChange)="valueChange.emit($event)"
|
|
65
65
|
></gn-ui-form-field-rich>
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
}
|
|
67
|
+
@case ('overviews') {
|
|
68
68
|
<gn-ui-form-field-overviews
|
|
69
69
|
[metadataUuid]="uniqueIdentifier"
|
|
70
70
|
[recordKind]="recordKind"
|
|
71
71
|
[value]="valueAsOverviews"
|
|
72
72
|
(valueChange)="valueChange.emit($event)"
|
|
73
73
|
></gn-ui-form-field-overviews>
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
}
|
|
75
|
+
@case ('resourceIdentifiers') {
|
|
76
76
|
<gn-ui-form-field-simple
|
|
77
77
|
[type]="'text'"
|
|
78
78
|
[value]="valueAsResourceIdentifierCode"
|
|
79
79
|
(valueChange)="handleResourceIdentifierChange($event)"
|
|
80
80
|
></gn-ui-form-field-simple>
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
}
|
|
82
|
+
@case ('resourceCreated') {
|
|
83
83
|
<gn-ui-form-field-date
|
|
84
84
|
[value]="valueAsDate"
|
|
85
85
|
(valueChange)="valueChange.emit($event)"
|
|
86
86
|
></gn-ui-form-field-date>
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
}
|
|
88
|
+
@case ('resourceUpdated') {
|
|
89
89
|
<gn-ui-form-field-date
|
|
90
90
|
[value]="valueAsDate"
|
|
91
91
|
(valueChange)="valueChange.emit($event)"
|
|
92
92
|
></gn-ui-form-field-date>
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
}
|
|
94
|
+
@case ('updateFrequency') {
|
|
95
95
|
<gn-ui-form-field-update-frequency
|
|
96
96
|
[value]="valueAsUpdateFrequency"
|
|
97
97
|
(valueChange)="valueChange.emit($event)"
|
|
98
98
|
[recordKind]="recordKind"
|
|
99
99
|
></gn-ui-form-field-update-frequency>
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
}
|
|
101
|
+
@case ('associatedRecords') {
|
|
102
102
|
<gn-ui-form-field-associated-records
|
|
103
103
|
[value]="valueAsAssociatedRecords"
|
|
104
104
|
(valueChange)="valueChange.emit($event)"
|
|
105
105
|
></gn-ui-form-field-associated-records>
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
}
|
|
107
|
+
@case ('temporalExtents') {
|
|
108
108
|
<gn-ui-form-field-temporal-extents
|
|
109
109
|
[value]="valueAsTemporalExtents"
|
|
110
110
|
(valueChange)="valueChange.emit($event)"
|
|
111
111
|
></gn-ui-form-field-temporal-extents>
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
}
|
|
113
|
+
@case ('spatialExtents') {
|
|
114
114
|
<gn-ui-form-field-spatial-extent></gn-ui-form-field-spatial-extent>
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
}
|
|
116
|
+
@case ('keywords') {
|
|
117
117
|
<gn-ui-form-field-keywords
|
|
118
118
|
[value]="valueAsKeywords"
|
|
119
119
|
(valueChange)="valueChange.emit($event)"
|
|
120
120
|
></gn-ui-form-field-keywords>
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
}
|
|
122
|
+
@case ('topics') {
|
|
123
123
|
<gn-ui-form-field-topics
|
|
124
124
|
[value]="valueAsTopics"
|
|
125
125
|
(valueChange)="valueChange.emit($event)"
|
|
126
126
|
></gn-ui-form-field-topics>
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
}
|
|
128
|
+
@case ('licenses') {
|
|
129
129
|
<gn-ui-form-field-license
|
|
130
130
|
[label]="config.labelKey! | translate: { recordKind }"
|
|
131
131
|
[recordLicences]="valueAsConstraints"
|
|
132
132
|
(recordLicencesChange)="valueChange.emit($event)"
|
|
133
133
|
></gn-ui-form-field-license>
|
|
134
|
-
|
|
134
|
+
}
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
136
|
+
<!-- TODO: merge these cases together when migrated to angular 21 -->
|
|
137
|
+
@case ('legalConstraints') {
|
|
138
|
+
<gn-ui-form-field-constraints
|
|
139
|
+
[label]="config.labelKey"
|
|
140
|
+
[value]="valueAsConstraints"
|
|
141
|
+
[constraintType]="model"
|
|
142
|
+
(valueChange)="valueChange.emit($event)"
|
|
143
|
+
></gn-ui-form-field-constraints>
|
|
144
|
+
}
|
|
145
|
+
@case ('securityConstraints') {
|
|
146
|
+
<gn-ui-form-field-constraints
|
|
147
|
+
[label]="config.labelKey"
|
|
148
|
+
[value]="valueAsConstraints"
|
|
149
|
+
[constraintType]="model"
|
|
150
|
+
(valueChange)="valueChange.emit($event)"
|
|
151
|
+
></gn-ui-form-field-constraints>
|
|
152
|
+
}
|
|
153
|
+
@case ('otherConstraints') {
|
|
146
154
|
<gn-ui-form-field-constraints
|
|
147
155
|
[label]="config.labelKey"
|
|
148
156
|
[value]="valueAsConstraints"
|
|
149
157
|
[constraintType]="model"
|
|
150
158
|
(valueChange)="valueChange.emit($event)"
|
|
151
|
-
></gn-ui-form-field-constraints
|
|
152
|
-
|
|
159
|
+
></gn-ui-form-field-constraints>
|
|
160
|
+
}
|
|
153
161
|
|
|
154
|
-
|
|
162
|
+
@case ('contactsForResource') {
|
|
155
163
|
<gn-ui-form-field-contacts-for-resource
|
|
156
164
|
[value]="valueAsIndividuals"
|
|
157
165
|
(valueChange)="valueChange.emit($event)"
|
|
158
166
|
></gn-ui-form-field-contacts-for-resource>
|
|
159
|
-
|
|
160
|
-
|
|
167
|
+
}
|
|
168
|
+
@case ('contacts') {
|
|
161
169
|
<gn-ui-form-field-contacts
|
|
162
170
|
[value]="valueAsIndividuals"
|
|
163
171
|
[modelSpecifier]="modelSpecifier"
|
|
164
172
|
(valueChange)="valueChange.emit($event)"
|
|
165
173
|
></gn-ui-form-field-contacts>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
174
|
+
}
|
|
175
|
+
@case ('onlineResources') {
|
|
176
|
+
@if (modelSpecifier === 'onlineResourceType:!link') {
|
|
177
|
+
<gn-ui-form-field-online-resources
|
|
178
|
+
[metadataUuid]="uniqueIdentifier"
|
|
179
|
+
[value]="valueAsOnlineResources"
|
|
180
|
+
(valueChange)="valueChange.emit($event)"
|
|
181
|
+
></gn-ui-form-field-online-resources>
|
|
182
|
+
} @else if (modelSpecifier === 'onlineResourceType:link') {
|
|
183
|
+
<gn-ui-form-field-online-link-resources
|
|
184
|
+
[metadataUuid]="uniqueIdentifier"
|
|
185
|
+
[value]="valueAsOnlineResources"
|
|
186
|
+
(valueChange)="valueChange.emit($event)"
|
|
187
|
+
></gn-ui-form-field-online-link-resources>
|
|
188
|
+
} @else if (modelSpecifier === 'onlineResourceType:singleLink') {
|
|
189
|
+
<gn-ui-form-field-online-single-link-resource
|
|
190
|
+
[value]="valueAsOnlineResources"
|
|
191
|
+
(valueChange)="valueChange.emit($event)"
|
|
192
|
+
></gn-ui-form-field-online-single-link-resource>
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
@case ('flags') {
|
|
196
|
+
<gn-ui-form-field-record-flag
|
|
197
|
+
[flagName]="recordFlag"
|
|
198
|
+
[labelKey]="config.labelKey"
|
|
199
|
+
[hintKey]="config.hintKey"
|
|
200
|
+
></gn-ui-form-field-record-flag>
|
|
201
|
+
}
|
|
202
|
+
}
|
|
191
203
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
204
|
+
@if (!model) {
|
|
205
|
+
@switch (componentName) {
|
|
206
|
+
@case ('form-field-constraints-shortcuts') {
|
|
195
207
|
<gn-ui-form-field-constraints-shortcuts></gn-ui-form-field-constraints-shortcuts>
|
|
196
|
-
|
|
197
|
-
|
|
208
|
+
}
|
|
209
|
+
@case ('form-field-spatial-toggle') {
|
|
198
210
|
<gn-ui-form-field-spatial-toggle></gn-ui-form-field-spatial-toggle>
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
202
214
|
</ng-template>
|
package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts
CHANGED
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
import { MatTooltipModule } from '@angular/material/tooltip'
|
|
13
13
|
import {
|
|
14
14
|
AssociatedRecord,
|
|
15
|
-
CatalogRecordKeys,
|
|
16
15
|
Constraint,
|
|
17
16
|
DatasetTemporalExtent,
|
|
18
17
|
GraphicOverview,
|
|
19
18
|
Individual,
|
|
20
19
|
Keyword,
|
|
21
20
|
OnlineResource,
|
|
21
|
+
RecordFlag,
|
|
22
22
|
RecordKind,
|
|
23
23
|
UpdateFrequency,
|
|
24
24
|
} from '../../../../../../../../libs/common/domain/src/lib/model/record'
|
|
@@ -36,9 +36,10 @@ import {
|
|
|
36
36
|
FormFieldTemporalExtentsComponent,
|
|
37
37
|
} from '.'
|
|
38
38
|
import {
|
|
39
|
-
FieldModelSpecifier,
|
|
40
39
|
FormFieldComponentName,
|
|
41
40
|
FormFieldConfig,
|
|
41
|
+
FormFieldModel,
|
|
42
|
+
FormFieldModelSpecifier,
|
|
42
43
|
} from '../../../models'
|
|
43
44
|
import { FormFieldAssociatedRecordsComponent } from './form-field-associated-records/form-field-associated-records.component'
|
|
44
45
|
import { FormFieldContactsForResourceComponent } from './form-field-contacts-for-resource/form-field-contacts-for-resource.component'
|
|
@@ -57,6 +58,7 @@ import { FormFieldConstraintsComponent } from './form-field-constraints/form-fie
|
|
|
57
58
|
import { TextFieldModule } from '@angular/cdk/text-field'
|
|
58
59
|
import { FormFieldSpatialToggleComponent } from './form-field-spatial-toggle/form-field-spatial-toggle.component'
|
|
59
60
|
import { FormFieldTopicsComponent } from './form-field-topics/form-field-topics.component'
|
|
61
|
+
import { FormFieldRecordFlagComponent } from './form-field-record-flags/form-field-record-flag-component'
|
|
60
62
|
|
|
61
63
|
@Component({
|
|
62
64
|
selector: 'gn-ui-form-field',
|
|
@@ -90,6 +92,7 @@ import { FormFieldTopicsComponent } from './form-field-topics/form-field-topics.
|
|
|
90
92
|
FormFieldTopicsComponent,
|
|
91
93
|
TextFieldModule,
|
|
92
94
|
NgIconComponent,
|
|
95
|
+
FormFieldRecordFlagComponent,
|
|
93
96
|
],
|
|
94
97
|
providers: [provideIcons({ matEditOutline, matHelpOutline })],
|
|
95
98
|
hostDirectives: [FieldFocusDirective],
|
|
@@ -97,8 +100,8 @@ import { FormFieldTopicsComponent } from './form-field-topics/form-field-topics.
|
|
|
97
100
|
export class FormFieldComponent {
|
|
98
101
|
@Input() uniqueIdentifier: string
|
|
99
102
|
@Input() recordKind: RecordKind
|
|
100
|
-
@Input() model:
|
|
101
|
-
@Input() modelSpecifier:
|
|
103
|
+
@Input() model: FormFieldModel
|
|
104
|
+
@Input() modelSpecifier: FormFieldModelSpecifier
|
|
102
105
|
@Input() componentName: FormFieldComponentName
|
|
103
106
|
|
|
104
107
|
@Input() config: FormFieldConfig
|
|
@@ -126,6 +129,7 @@ export class FormFieldComponent {
|
|
|
126
129
|
this.model === 'legalConstraints' ||
|
|
127
130
|
this.model === 'securityConstraints' ||
|
|
128
131
|
this.model === 'otherConstraints' ||
|
|
132
|
+
this.model === 'flags' ||
|
|
129
133
|
this.componentName === 'form-field-constraints-shortcuts'
|
|
130
134
|
)
|
|
131
135
|
}
|
|
@@ -172,6 +176,9 @@ export class FormFieldComponent {
|
|
|
172
176
|
}>
|
|
173
177
|
return identifiers?.[0]?.code || ''
|
|
174
178
|
}
|
|
179
|
+
get recordFlag() {
|
|
180
|
+
return this.modelSpecifier?.replace(/^flags:/, '') as RecordFlag
|
|
181
|
+
}
|
|
175
182
|
|
|
176
183
|
handleResourceIdentifierChange(code: string) {
|
|
177
184
|
const identifiers = this.value as Array<{
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
viewChildren,
|
|
12
12
|
} from '@angular/core'
|
|
13
13
|
import { EditorFacade } from '../../+state/editor.facade'
|
|
14
|
-
import { EditorFieldValue } from '../../models'
|
|
14
|
+
import { EditorFieldValue, FormFieldModel } from '../../models'
|
|
15
15
|
import { FieldFocusDirective, FormFieldComponent } from './form-field'
|
|
16
16
|
import { TranslateDirective } from '@ngx-translate/core'
|
|
17
17
|
import {
|
|
@@ -24,6 +24,7 @@ import { switchMap } from 'rxjs/operators'
|
|
|
24
24
|
import { toSignal } from '@angular/core/rxjs-interop'
|
|
25
25
|
import { evaluate, isExpression } from '../../expressions'
|
|
26
26
|
import { NotificationsService } from '../../../../../../../libs/feature/notifications/src'
|
|
27
|
+
import { PlatformServiceInterface } from '../../../../../../../libs/common/domain/src/lib/platform.service.interface'
|
|
27
28
|
|
|
28
29
|
@Component({
|
|
29
30
|
selector: 'gn-ui-record-form',
|
|
@@ -41,6 +42,7 @@ import { NotificationsService } from '../../../../../../../libs/feature/notifica
|
|
|
41
42
|
export class RecordFormComponent implements OnInit, OnDestroy {
|
|
42
43
|
facade = inject(EditorFacade)
|
|
43
44
|
notifications = inject(NotificationsService)
|
|
45
|
+
platform = inject(PlatformServiceInterface)
|
|
44
46
|
subscription = new Subscription()
|
|
45
47
|
|
|
46
48
|
recordUniqueIdentifier$ = this.facade.record$.pipe(
|
|
@@ -90,8 +92,8 @@ export class RecordFormComponent implements OnInit, OnDestroy {
|
|
|
90
92
|
this.subscription.unsubscribe()
|
|
91
93
|
}
|
|
92
94
|
|
|
93
|
-
handleFieldValueChange(model:
|
|
94
|
-
if (!model) {
|
|
95
|
+
handleFieldValueChange(model: FormFieldModel, newValue: EditorFieldValue) {
|
|
96
|
+
if (!model || model === 'flags') {
|
|
95
97
|
return
|
|
96
98
|
}
|
|
97
99
|
this.facade.updateRecordField(model, newValue)
|
|
@@ -122,6 +124,8 @@ export class RecordFormComponent implements OnInit, OnDestroy {
|
|
|
122
124
|
}
|
|
123
125
|
|
|
124
126
|
private recordSignal = toSignal(this.facade.record$, { requireSync: true })
|
|
127
|
+
private userSignal = toSignal(this.platform.getMe())
|
|
128
|
+
private isAdminSignal = toSignal(this.platform.isAdministrator())
|
|
125
129
|
private expressionCache = new Map<string, Signal<EditorFieldValue>>()
|
|
126
130
|
|
|
127
131
|
// only compiles the expression into an evaluator the first time;
|
|
@@ -149,7 +153,17 @@ ${errors.map((err) => `> ${err}`).join('\n')}`)
|
|
|
149
153
|
}
|
|
150
154
|
this.expressionCache.set(
|
|
151
155
|
expression,
|
|
152
|
-
computed(() =>
|
|
156
|
+
computed(() =>
|
|
157
|
+
evaluator({
|
|
158
|
+
globals: {
|
|
159
|
+
record: this.recordSignal(),
|
|
160
|
+
user: {
|
|
161
|
+
...this.userSignal(),
|
|
162
|
+
isAdmin: this.isAdminSignal(),
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
})
|
|
166
|
+
)
|
|
153
167
|
)
|
|
154
168
|
return this.expressionCache.get(expression)
|
|
155
169
|
}
|