geonetwork-ui 2.4.0-dev.e7ff1d25 → 2.4.0-dev.e97caaf2
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/esm2022/libs/api/metadata-converter/src/lib/gn4/types/keywords.model.mjs +1 -1
- package/esm2022/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.mjs +4 -2
- package/esm2022/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.mjs +11 -1
- package/esm2022/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.mjs +11 -1
- package/esm2022/libs/common/domain/src/lib/model/record/metadata.model.mjs +1 -1
- package/esm2022/libs/common/domain/src/lib/model/user/user.model.mjs +1 -1
- package/esm2022/libs/common/domain/src/lib/platform.service.interface.mjs +1 -1
- package/esm2022/libs/feature/editor/src/lib/+state/editor.actions.mjs +2 -1
- package/esm2022/libs/feature/editor/src/lib/+state/editor.effects.mjs +6 -1
- package/esm2022/libs/feature/editor/src/lib/+state/editor.facade.mjs +4 -1
- package/esm2022/libs/feature/editor/src/lib/components/contact-card/contact-card.component.mjs +3 -3
- package/esm2022/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.mjs +78 -0
- package/esm2022/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.mjs +44 -79
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts-for-resource/form-field-contacts-for-resource.component.mjs +35 -41
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.mjs +19 -41
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.mjs +10 -8
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-map-container/form-field-map-container.component.mjs +101 -0
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-open-data/form-field-open-data.component.mjs +22 -25
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.mjs +14 -7
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.mjs +10 -6
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.mjs +11 -11
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-simple/form-field-simple.component.mjs +9 -8
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.mjs +111 -5
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-temporal-extents/form-field-temporal-extents.component.mjs +49 -53
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.mjs +16 -14
- package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.mjs +34 -64
- package/esm2022/libs/feature/editor/src/lib/components/record-form/record-form.component.mjs +5 -3
- package/esm2022/libs/feature/editor/src/lib/fields.config.mjs +8 -2
- package/esm2022/libs/feature/editor/src/lib/services/editor.service.mjs +5 -1
- package/esm2022/libs/ui/elements/src/lib/sortable-list/sortable-list.component.mjs +3 -11
- package/esm2022/libs/ui/inputs/src/index.mjs +2 -1
- package/esm2022/libs/ui/inputs/src/lib/editable-label/editable-label.directive.mjs +26 -24
- package/esm2022/libs/ui/inputs/src/lib/switch-toggle/switch-toggle.component.mjs +32 -0
- package/esm2022/libs/ui/map/src/lib/ui-map.module.mjs +3 -3
- package/esm2022/translations/de.json +12 -0
- package/esm2022/translations/en.json +12 -0
- package/esm2022/translations/es.json +12 -0
- package/esm2022/translations/fr.json +14 -2
- package/esm2022/translations/it.json +12 -0
- package/esm2022/translations/nl.json +12 -0
- package/esm2022/translations/pt.json +12 -0
- package/fesm2022/geonetwork-ui.mjs +846 -521
- package/fesm2022/geonetwork-ui.mjs.map +1 -1
- package/libs/api/metadata-converter/src/lib/gn4/types/keywords.model.d.ts +2 -6
- package/libs/api/metadata-converter/src/lib/gn4/types/keywords.model.d.ts.map +1 -1
- package/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.d.ts.map +1 -1
- package/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.d.ts.map +1 -1
- package/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.d.ts +1 -0
- package/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.d.ts.map +1 -1
- package/libs/common/domain/src/lib/model/record/metadata.model.d.ts +1 -0
- package/libs/common/domain/src/lib/model/record/metadata.model.d.ts.map +1 -1
- package/libs/common/domain/src/lib/model/user/user.model.d.ts +1 -1
- package/libs/common/domain/src/lib/model/user/user.model.d.ts.map +1 -1
- package/libs/common/domain/src/lib/platform.service.interface.d.ts +1 -0
- package/libs/common/domain/src/lib/platform.service.interface.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/+state/editor.actions.d.ts +1 -0
- package/libs/feature/editor/src/lib/+state/editor.actions.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/+state/editor.effects.d.ts +5 -0
- package/libs/feature/editor/src/lib/+state/editor.effects.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/+state/editor.facade.d.ts +1 -0
- package/libs/feature/editor/src/lib/+state/editor.facade.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.d.ts +32 -0
- package/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.d.ts.map +1 -0
- package/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.d.ts +13 -13
- package/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts-for-resource/form-field-contacts-for-resource.component.d.ts +10 -13
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts-for-resource/form-field-contacts-for-resource.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.d.ts +8 -19
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.d.ts +6 -4
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-map-container/form-field-map-container.component.d.ts +22 -0
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-map-container/form-field-map-container.component.d.ts.map +1 -0
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-open-data/form-field-open-data.component.d.ts +10 -12
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-open-data/form-field-open-data.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.d.ts +5 -3
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.d.ts +4 -3
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.d.ts +4 -4
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-simple/form-field-simple.component.d.ts +4 -3
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-simple/form-field-simple.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.d.ts +23 -0
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-temporal-extents/form-field-temporal-extents.component.d.ts +15 -17
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-temporal-extents/form-field-temporal-extents.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.d.ts +5 -5
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.d.ts +15 -27
- package/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/record-form.component.d.ts +3 -2
- package/libs/feature/editor/src/lib/components/record-form/record-form.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/fields.config.d.ts +1 -0
- package/libs/feature/editor/src/lib/fields.config.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/services/editor.service.d.ts +1 -0
- package/libs/feature/editor/src/lib/services/editor.service.d.ts.map +1 -1
- package/libs/ui/elements/src/lib/sortable-list/sortable-list.component.d.ts +1 -6
- package/libs/ui/elements/src/lib/sortable-list/sortable-list.component.d.ts.map +1 -1
- package/libs/ui/inputs/src/index.d.ts +1 -0
- package/libs/ui/inputs/src/index.d.ts.map +1 -1
- package/libs/ui/inputs/src/lib/editable-label/editable-label.directive.d.ts +5 -3
- package/libs/ui/inputs/src/lib/editable-label/editable-label.directive.d.ts.map +1 -1
- package/libs/ui/inputs/src/lib/switch-toggle/switch-toggle.component.d.ts +17 -0
- package/libs/ui/inputs/src/lib/switch-toggle/switch-toggle.component.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/libs/api/metadata-converter/src/lib/fixtures/generic.records.ts +6 -1
- package/src/libs/api/metadata-converter/src/lib/gn4/types/keywords.model.ts +2 -6
- package/src/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.ts +3 -1
- package/src/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.ts +12 -1
- package/src/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts +43 -12
- package/src/libs/common/domain/src/lib/model/record/metadata.model.ts +1 -0
- package/src/libs/common/domain/src/lib/model/user/user.model.ts +1 -1
- package/src/libs/common/domain/src/lib/platform.service.interface.ts +4 -0
- package/src/libs/common/fixtures/src/lib/organisations.fixture.ts +10 -0
- package/src/libs/feature/editor/src/lib/+state/editor.actions.ts +2 -0
- package/src/libs/feature/editor/src/lib/+state/editor.effects.ts +15 -0
- package/src/libs/feature/editor/src/lib/+state/editor.facade.ts +4 -0
- package/src/libs/feature/editor/src/lib/components/contact-card/contact-card.component.html +4 -2
- package/src/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.css +0 -0
- package/src/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.html +26 -0
- package/src/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.ts +89 -0
- package/src/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.html +1 -1
- package/src/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.ts +46 -94
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts-for-resource/form-field-contacts-for-resource.component.ts +63 -85
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.html +7 -17
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.ts +18 -51
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.ts +13 -5
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-map-container/form-field-map-container.component.css +0 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-map-container/form-field-map-container.component.html +4 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-map-container/form-field-map-container.component.ts +128 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-open-data/form-field-open-data.component.html +1 -1
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-open-data/form-field-open-data.component.ts +18 -29
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.html +1 -1
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.ts +16 -5
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.html +2 -2
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.ts +9 -3
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.html +2 -2
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.ts +13 -7
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-simple/form-field-simple.component.html +5 -3
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-simple/form-field-simple.component.ts +11 -4
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.html +15 -1
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.ts +156 -1
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-temporal-extents/form-field-temporal-extents.component.html +9 -2
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-temporal-extents/form-field-temporal-extents.component.ts +59 -71
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.ts +17 -15
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +99 -81
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts +37 -66
- package/src/libs/feature/editor/src/lib/components/record-form/record-form.component.html +1 -0
- package/src/libs/feature/editor/src/lib/components/record-form/record-form.component.ts +7 -2
- package/src/libs/feature/editor/src/lib/fields.config.ts +8 -1
- package/src/libs/feature/editor/src/lib/services/editor.service.ts +7 -0
- package/src/libs/ui/elements/src/lib/sortable-list/sortable-list.component.html +0 -9
- package/src/libs/ui/elements/src/lib/sortable-list/sortable-list.component.ts +0 -4
- package/src/libs/ui/inputs/src/index.ts +1 -0
- package/src/libs/ui/inputs/src/lib/editable-label/editable-label.directive.ts +40 -26
- package/src/libs/ui/map/src/lib/ui-map.module.ts +1 -1
- package/translations/de.json +12 -0
- package/translations/en.json +12 -0
- package/translations/es.json +12 -0
- package/translations/fr.json +14 -2
- package/translations/it.json +12 -0
- package/translations/nl.json +12 -0
- package/translations/pt.json +12 -0
- package/translations/sk.json +12 -0
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
></gn-ui-thumbnail>
|
|
8
8
|
<div class="flex flex-col w-full">
|
|
9
9
|
<div class="flex flex-row justify-between">
|
|
10
|
-
<span
|
|
10
|
+
<span
|
|
11
|
+
class="flex flex-wrap font-bold w-full"
|
|
12
|
+
data-test="contactCardName"
|
|
11
13
|
>{{ contact.firstName }} {{ contact.lastName }}</span
|
|
12
14
|
>
|
|
13
15
|
</div>
|
|
14
|
-
<div>{{ contact.email }}</div>
|
|
16
|
+
<div data-test="contactCardEmail">{{ contact.email }}</div>
|
|
15
17
|
</div>
|
|
16
18
|
</div>
|
|
17
19
|
<gn-ui-button
|
package/src/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.css
ADDED
|
File without changes
|
package/src/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.html
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<div class="flex flex-col gap-3">
|
|
2
|
+
<gn-ui-autocomplete
|
|
3
|
+
[placeholder]="placeholder"
|
|
4
|
+
[displayWithFn]="displayWithFn"
|
|
5
|
+
[action]="autoCompleteAction"
|
|
6
|
+
(itemSelected)="handleItemSelection($event)"
|
|
7
|
+
[preventCompleteOnSelection]="true"
|
|
8
|
+
[minCharacterCount]="0"
|
|
9
|
+
[allowSubmit]="false"
|
|
10
|
+
></gn-ui-autocomplete>
|
|
11
|
+
<div class="flex gap-2 flex-wrap">
|
|
12
|
+
<gn-ui-badge
|
|
13
|
+
*ngFor="let keyword of keywords"
|
|
14
|
+
[removable]="true"
|
|
15
|
+
(badgeRemoveClicked)="removeKeyword(keyword)"
|
|
16
|
+
>{{ keyword.label }}
|
|
17
|
+
|
|
18
|
+
<mat-icon
|
|
19
|
+
*ngIf="isPlaceWithoutExtent(keyword)"
|
|
20
|
+
[title]="'editor.form.placeKeywordWithoutExtent' | translate"
|
|
21
|
+
class="material-symbols-outlined"
|
|
22
|
+
>warning</mat-icon
|
|
23
|
+
>
|
|
24
|
+
</gn-ui-badge>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
package/src/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common'
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
EventEmitter,
|
|
6
|
+
Input,
|
|
7
|
+
Output,
|
|
8
|
+
} from '@angular/core'
|
|
9
|
+
import { PlatformServiceInterface } from '../../../../../../../libs/common/domain/src/lib/platform.service.interface'
|
|
10
|
+
import {
|
|
11
|
+
AutocompleteComponent,
|
|
12
|
+
DropdownSelectorComponent,
|
|
13
|
+
UiInputsModule,
|
|
14
|
+
} from '../../../../../../../libs/ui/inputs/src'
|
|
15
|
+
import { UiWidgetsModule } from '../../../../../../../libs/ui/widgets/src'
|
|
16
|
+
import { map } from 'rxjs'
|
|
17
|
+
import { Keyword } from '../../../../../../../libs/common/domain/src/lib/model/record'
|
|
18
|
+
import { KeywordType } from '../../../../../../../libs/common/domain/src/lib/model/thesaurus'
|
|
19
|
+
import { MatIconModule } from '@angular/material/icon'
|
|
20
|
+
import { TranslateModule } from '@ngx-translate/core'
|
|
21
|
+
|
|
22
|
+
type AutocompleteItem = { title: string; value: Keyword }
|
|
23
|
+
|
|
24
|
+
@Component({
|
|
25
|
+
selector: 'gn-ui-generic-keywords',
|
|
26
|
+
templateUrl: './generic-keywords.component.html',
|
|
27
|
+
styleUrls: ['./generic-keywords.component.css'],
|
|
28
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
29
|
+
standalone: true,
|
|
30
|
+
imports: [
|
|
31
|
+
DropdownSelectorComponent,
|
|
32
|
+
UiInputsModule,
|
|
33
|
+
CommonModule,
|
|
34
|
+
UiWidgetsModule,
|
|
35
|
+
AutocompleteComponent,
|
|
36
|
+
MatIconModule,
|
|
37
|
+
TranslateModule,
|
|
38
|
+
],
|
|
39
|
+
})
|
|
40
|
+
export class GenericKeywordsComponent {
|
|
41
|
+
@Input() keywords: Keyword[]
|
|
42
|
+
@Input() keywordTypes: KeywordType[]
|
|
43
|
+
@Input() placeholder: string
|
|
44
|
+
@Output() changedKeywords: EventEmitter<Keyword[]> = new EventEmitter()
|
|
45
|
+
@Output() addedKeyword: EventEmitter<Keyword> = new EventEmitter()
|
|
46
|
+
@Output() deletedKeyword: EventEmitter<Keyword> = new EventEmitter()
|
|
47
|
+
|
|
48
|
+
displayWithFn = (item: AutocompleteItem) => {
|
|
49
|
+
return `${item.title} (${item.value.thesaurus?.name})`
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
autoCompleteAction = (query: string) => {
|
|
53
|
+
return this.platformService.searchKeywords(query, this.keywordTypes).pipe(
|
|
54
|
+
map((keywords) =>
|
|
55
|
+
keywords.map((keyword) => {
|
|
56
|
+
return { title: keyword.label, value: keyword }
|
|
57
|
+
})
|
|
58
|
+
)
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
constructor(private platformService: PlatformServiceInterface) {}
|
|
63
|
+
|
|
64
|
+
handleItemSelection(item: AutocompleteItem) {
|
|
65
|
+
this.addKeyword(item.value)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
addKeyword(keyword: Keyword) {
|
|
69
|
+
const duplicatedKeyword = this.keywords.find(
|
|
70
|
+
(k) => k.label === keyword.label
|
|
71
|
+
)
|
|
72
|
+
if (!duplicatedKeyword) {
|
|
73
|
+
this.keywords = [...this.keywords, keyword]
|
|
74
|
+
this.changedKeywords.emit(this.keywords)
|
|
75
|
+
this.addedKeyword.emit(keyword)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
removeKeyword(keyword: Keyword) {
|
|
80
|
+
this.keywords = this.keywords.filter((k) => k.label !== keyword.label)
|
|
81
|
+
this.changedKeywords.emit(this.keywords)
|
|
82
|
+
this.deletedKeyword.emit(keyword)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
isPlaceWithoutExtent(keyword: Keyword): boolean {
|
|
86
|
+
if (keyword.type !== 'place') return false
|
|
87
|
+
return !keyword.bbox
|
|
88
|
+
}
|
|
89
|
+
}
|
package/src/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.ts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common'
|
|
1
2
|
import {
|
|
2
3
|
ChangeDetectionStrategy,
|
|
3
|
-
ChangeDetectorRef,
|
|
4
4
|
Component,
|
|
5
5
|
EventEmitter,
|
|
6
6
|
Input,
|
|
7
|
-
OnChanges,
|
|
8
|
-
OnInit,
|
|
9
7
|
Output,
|
|
10
|
-
SimpleChanges,
|
|
11
8
|
} from '@angular/core'
|
|
12
|
-
import {
|
|
9
|
+
import { GraphicOverview } from '../../../../../../../libs/common/domain/src/lib/model/record'
|
|
13
10
|
import { RecordsApiService } from '../../../../../../../libs/data-access/gn4/src'
|
|
11
|
+
import { NotificationsService } from '../../../../../../../libs/feature/notifications/src'
|
|
14
12
|
import { UiInputsModule } from '../../../../../../../libs/ui/inputs/src'
|
|
15
|
-
import {
|
|
16
|
-
import { GraphicOverview } from '../../../../../../../libs/common/domain/src/lib/model/record'
|
|
13
|
+
import { TranslateService } from '@ngx-translate/core'
|
|
17
14
|
|
|
18
15
|
@Component({
|
|
19
16
|
selector: 'gn-ui-overview-upload',
|
|
@@ -23,56 +20,54 @@ import { GraphicOverview } from '../../../../../../../libs/common/domain/src/lib
|
|
|
23
20
|
styleUrls: ['./overview-upload.component.css'],
|
|
24
21
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
25
22
|
})
|
|
26
|
-
export class OverviewUploadComponent
|
|
23
|
+
export class OverviewUploadComponent {
|
|
27
24
|
@Input() metadataUuid: string
|
|
28
|
-
|
|
25
|
+
_overview: GraphicOverview | null
|
|
26
|
+
@Input()
|
|
27
|
+
set overview(value: GraphicOverview | null) {
|
|
28
|
+
this._overview = value
|
|
29
|
+
if (this._overview) {
|
|
30
|
+
this.recordsApiService.getAllResources(this.metadataUuid).subscribe({
|
|
31
|
+
next: (resources) => {
|
|
32
|
+
const resource = resources.find(
|
|
33
|
+
(r) => r.url === this._overview.url.toString()
|
|
34
|
+
)
|
|
35
|
+
if (resource) {
|
|
36
|
+
this.resourceFileName = resource.filename
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
error: this.errorHandle,
|
|
40
|
+
})
|
|
41
|
+
this.resourceUrl = this._overview.url.toString()
|
|
42
|
+
this.altText = this._overview.description
|
|
43
|
+
} else {
|
|
44
|
+
this.resourceUrl = ''
|
|
45
|
+
this.resourceFileName = ''
|
|
46
|
+
this.altText = ''
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
29
50
|
@Output() overviewChange = new EventEmitter<GraphicOverview | null>()
|
|
30
|
-
@Output() altTextChange: EventEmitter<string> = new EventEmitter()
|
|
31
51
|
|
|
32
|
-
resourceAltText: string
|
|
33
|
-
resourceFileName: string
|
|
34
52
|
resourceUrl: string
|
|
53
|
+
resourceFileName: string
|
|
54
|
+
altText: string
|
|
35
55
|
|
|
36
56
|
constructor(
|
|
37
57
|
private recordsApiService: RecordsApiService,
|
|
38
|
-
private
|
|
58
|
+
private notificationsService: NotificationsService,
|
|
59
|
+
private translateService: TranslateService
|
|
39
60
|
) {}
|
|
40
61
|
|
|
41
|
-
ngOnInit(): void {
|
|
42
|
-
this.recordsApiService.getAllResources(this.metadataUuid).subscribe({
|
|
43
|
-
next: (resources) => {
|
|
44
|
-
if (resources && resources.length > 0) {
|
|
45
|
-
this.resourceUrl = resources[0].url
|
|
46
|
-
this.resourceFileName = resources[0].filename
|
|
47
|
-
if (!this.resourceAltText) {
|
|
48
|
-
this.resourceAltText = this.resourceFileName
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
this.resourceUrl = ''
|
|
52
|
-
this.resourceAltText = ''
|
|
53
|
-
this.resourceFileName = ''
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
this.cd.markForCheck()
|
|
57
|
-
},
|
|
58
|
-
error: this.errorHandle,
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
|
|
62
62
|
handleFileChange(file: File) {
|
|
63
63
|
this.recordsApiService
|
|
64
64
|
.putResource(this.metadataUuid, file, 'public')
|
|
65
65
|
.subscribe({
|
|
66
66
|
next: (resource) => {
|
|
67
|
-
this.resourceUrl = resource.url
|
|
68
|
-
this.resourceAltText = resource.filename
|
|
69
|
-
|
|
70
67
|
this.overviewChange.emit({
|
|
71
68
|
url: new URL(resource.url),
|
|
72
69
|
description: resource.filename,
|
|
73
70
|
})
|
|
74
|
-
|
|
75
|
-
this.cd.markForCheck()
|
|
76
71
|
},
|
|
77
72
|
error: this.errorHandle,
|
|
78
73
|
})
|
|
@@ -83,79 +78,36 @@ export class OverviewUploadComponent implements OnInit, OnChanges {
|
|
|
83
78
|
.putResourceFromURL(this.metadataUuid, url, 'public')
|
|
84
79
|
.subscribe({
|
|
85
80
|
next: (resource) => {
|
|
86
|
-
this.resourceUrl = resource.url
|
|
87
|
-
this.resourceAltText = resource.filename
|
|
88
|
-
|
|
89
81
|
this.overviewChange.emit({
|
|
90
82
|
url: new URL(resource.url),
|
|
91
83
|
description: resource.filename,
|
|
92
84
|
})
|
|
93
|
-
|
|
94
|
-
this.cd.markForCheck()
|
|
95
85
|
},
|
|
96
86
|
error: this.errorHandle,
|
|
97
87
|
})
|
|
98
88
|
}
|
|
99
89
|
|
|
100
90
|
handleAltTextChange(newAltText: string) {
|
|
101
|
-
this.resourceAltText = newAltText
|
|
102
|
-
|
|
103
91
|
this.overviewChange.emit({
|
|
104
92
|
url: new URL(this.resourceUrl),
|
|
105
|
-
description:
|
|
93
|
+
description: newAltText,
|
|
106
94
|
})
|
|
107
|
-
|
|
108
|
-
this.cd.markForCheck()
|
|
109
95
|
}
|
|
110
96
|
|
|
111
97
|
handleDelete() {
|
|
112
|
-
//this.formControl.markAsDirty()
|
|
113
|
-
this.recordsApiService
|
|
114
|
-
.delResource(this.metadataUuid, this.resourceFileName)
|
|
115
|
-
.subscribe({
|
|
116
|
-
next: () => {
|
|
117
|
-
this.resourceAltText = ''
|
|
118
|
-
this.resourceUrl = ''
|
|
119
|
-
|
|
120
|
-
this.overviewChange.emit(null)
|
|
121
|
-
|
|
122
|
-
this.cd.markForCheck()
|
|
123
|
-
},
|
|
124
|
-
error: this.errorHandle,
|
|
125
|
-
})
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
private errorHandle = (error: never) => {
|
|
129
|
-
console.error(error)
|
|
130
|
-
|
|
131
|
-
this.resourceUrl = ''
|
|
132
|
-
this.resourceAltText = ''
|
|
133
|
-
this.resourceFileName = ''
|
|
134
|
-
|
|
135
98
|
this.overviewChange.emit(null)
|
|
136
|
-
|
|
137
|
-
this.cd.markForCheck()
|
|
138
99
|
}
|
|
139
100
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
overview = overviewChanges.currentValue.value[0] as GraphicOverview
|
|
152
|
-
} else {
|
|
153
|
-
return
|
|
154
|
-
}
|
|
155
|
-
if (overview.description) {
|
|
156
|
-
this.resourceAltText = overview.description
|
|
157
|
-
this.cd.markForCheck()
|
|
158
|
-
}
|
|
159
|
-
}
|
|
101
|
+
private errorHandle = (error) => {
|
|
102
|
+
this.notificationsService.showNotification({
|
|
103
|
+
type: 'error',
|
|
104
|
+
title: this.translateService.instant('editor.record.resourceError.title'),
|
|
105
|
+
text: `${this.translateService.instant(
|
|
106
|
+
'editor.record.resourceError.body'
|
|
107
|
+
)} ${error.message}`,
|
|
108
|
+
closeMessage: this.translateService.instant(
|
|
109
|
+
'editor.record.resourceError.closeMessage'
|
|
110
|
+
),
|
|
111
|
+
})
|
|
160
112
|
}
|
|
161
113
|
}
|
|
@@ -3,42 +3,42 @@ import {
|
|
|
3
3
|
ChangeDetectionStrategy,
|
|
4
4
|
ChangeDetectorRef,
|
|
5
5
|
Component,
|
|
6
|
+
EventEmitter,
|
|
6
7
|
Input,
|
|
7
|
-
|
|
8
|
+
OnChanges,
|
|
8
9
|
OnInit,
|
|
10
|
+
Output,
|
|
9
11
|
} from '@angular/core'
|
|
10
|
-
import { FormControl } from '@angular/forms'
|
|
11
|
-
import {
|
|
12
|
-
AutocompleteComponent,
|
|
13
|
-
DropdownSelectorComponent,
|
|
14
|
-
UiInputsModule,
|
|
15
|
-
} from '../../../../../../../../../libs/ui/inputs/src'
|
|
16
|
-
import { UiWidgetsModule } from '../../../../../../../../../libs/ui/widgets/src'
|
|
17
12
|
import {
|
|
18
13
|
Individual,
|
|
19
14
|
Organization,
|
|
20
15
|
Role,
|
|
21
16
|
RoleLabels,
|
|
22
17
|
} from '../../../../../../../../../libs/common/domain/src/lib/model/record'
|
|
18
|
+
import { UserModel } from '../../../../../../../../../libs/common/domain/src/lib/model/user'
|
|
19
|
+
import { OrganizationsServiceInterface } from '../../../../../../../../../libs/common/domain/src/lib/organizations.service.interface'
|
|
20
|
+
import { PlatformServiceInterface } from '../../../../../../../../../libs/common/domain/src/lib/platform.service.interface'
|
|
21
|
+
import {
|
|
22
|
+
DynamicElement,
|
|
23
|
+
SortableListComponent,
|
|
24
|
+
} from '../../../../../../../../../libs/ui/elements/src'
|
|
25
|
+
import {
|
|
26
|
+
AutocompleteComponent,
|
|
27
|
+
DropdownSelectorComponent,
|
|
28
|
+
UiInputsModule,
|
|
29
|
+
} from '../../../../../../../../../libs/ui/inputs/src'
|
|
30
|
+
import { UiWidgetsModule } from '../../../../../../../../../libs/ui/widgets/src'
|
|
31
|
+
import { createFuzzyFilter } from '../../../../../../../../../libs/util/shared/src'
|
|
23
32
|
import { TranslateModule } from '@ngx-translate/core'
|
|
24
33
|
import {
|
|
25
34
|
debounceTime,
|
|
26
35
|
distinctUntilChanged,
|
|
27
36
|
firstValueFrom,
|
|
28
37
|
Observable,
|
|
29
|
-
Subscription,
|
|
30
38
|
switchMap,
|
|
31
39
|
} from 'rxjs'
|
|
32
|
-
import { UserModel } from '../../../../../../../../../libs/common/domain/src/lib/model/user'
|
|
33
|
-
import { PlatformServiceInterface } from '../../../../../../../../../libs/common/domain/src/lib/platform.service.interface'
|
|
34
|
-
import { OrganizationsServiceInterface } from '../../../../../../../../../libs/common/domain/src/lib/organizations.service.interface'
|
|
35
|
-
import { ContactCardComponent } from '../../../contact-card/contact-card.component'
|
|
36
|
-
import {
|
|
37
|
-
DynamicElement,
|
|
38
|
-
SortableListComponent,
|
|
39
|
-
} from '../../../../../../../../../libs/ui/elements/src'
|
|
40
|
-
import { createFuzzyFilter } from '../../../../../../../../../libs/util/shared/src'
|
|
41
40
|
import { map } from 'rxjs/operators'
|
|
41
|
+
import { ContactCardComponent } from '../../../contact-card/contact-card.component'
|
|
42
42
|
|
|
43
43
|
@Component({
|
|
44
44
|
selector: 'gn-ui-form-field-contacts-for-resource',
|
|
@@ -58,13 +58,10 @@ import { map } from 'rxjs/operators'
|
|
|
58
58
|
],
|
|
59
59
|
})
|
|
60
60
|
export class FormFieldContactsForResourceComponent
|
|
61
|
-
implements
|
|
61
|
+
implements OnChanges, OnInit
|
|
62
62
|
{
|
|
63
|
-
@Input()
|
|
64
|
-
|
|
65
|
-
subscription: Subscription = new Subscription()
|
|
66
|
-
|
|
67
|
-
allUsers$: Observable<UserModel[]>
|
|
63
|
+
@Input() value: Individual[]
|
|
64
|
+
@Output() valueChange: EventEmitter<Individual[]> = new EventEmitter()
|
|
68
65
|
|
|
69
66
|
contactsForRessourceByRole: Map<Role, Individual[]> = new Map()
|
|
70
67
|
|
|
@@ -84,10 +81,13 @@ export class FormFieldContactsForResourceComponent
|
|
|
84
81
|
|
|
85
82
|
constructor(
|
|
86
83
|
private platformServiceInterface: PlatformServiceInterface,
|
|
87
|
-
private organizationsServiceInterface: OrganizationsServiceInterface
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
84
|
+
private organizationsServiceInterface: OrganizationsServiceInterface
|
|
85
|
+
) {}
|
|
86
|
+
|
|
87
|
+
ngOnChanges() {
|
|
88
|
+
this.updateContactsForRessource()
|
|
89
|
+
this.manageRoleSectionsToDisplay(this.value)
|
|
90
|
+
this.filterRolesToPick()
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
async ngOnInit(): Promise<void> {
|
|
@@ -97,20 +97,8 @@ export class FormFieldContactsForResourceComponent
|
|
|
97
97
|
).map((organization) => [organization.name, organization])
|
|
98
98
|
)
|
|
99
99
|
this.updateContactsForRessource()
|
|
100
|
-
this.manageRoleSectionsToDisplay(this.
|
|
100
|
+
this.manageRoleSectionsToDisplay(this.value)
|
|
101
101
|
this.filterRolesToPick()
|
|
102
|
-
|
|
103
|
-
this.changeDetectorRef.markForCheck()
|
|
104
|
-
|
|
105
|
-
this.subscription.add(
|
|
106
|
-
this.control.valueChanges.subscribe((contactsForResource) => {
|
|
107
|
-
this.updateContactsForRessource()
|
|
108
|
-
this.manageRoleSectionsToDisplay(contactsForResource)
|
|
109
|
-
this.filterRolesToPick()
|
|
110
|
-
|
|
111
|
-
this.changeDetectorRef.markForCheck()
|
|
112
|
-
})
|
|
113
|
-
)
|
|
114
102
|
}
|
|
115
103
|
|
|
116
104
|
addRoleToDisplay(roleToAdd: string) {
|
|
@@ -125,31 +113,28 @@ export class FormFieldContactsForResourceComponent
|
|
|
125
113
|
}
|
|
126
114
|
|
|
127
115
|
updateContactsForRessource() {
|
|
128
|
-
this.contactsForRessourceByRole = this.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
acc.get(contact.role).push(updatedContact)
|
|
146
|
-
|
|
147
|
-
return acc
|
|
148
|
-
},
|
|
149
|
-
new Map<Role, Individual[]>()
|
|
150
|
-
)
|
|
116
|
+
this.contactsForRessourceByRole = this.value.reduce((acc, contact) => {
|
|
117
|
+
const completeOrganization = this.allOrganizations.get(
|
|
118
|
+
contact.organization.name
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
const updatedContact = {
|
|
122
|
+
...contact,
|
|
123
|
+
organization:
|
|
124
|
+
completeOrganization ??
|
|
125
|
+
({ name: contact.organization.name } as Organization),
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (!acc.has(contact.role)) {
|
|
129
|
+
acc.set(contact.role, [])
|
|
130
|
+
}
|
|
151
131
|
|
|
152
|
-
|
|
132
|
+
acc.get(contact.role).push(updatedContact)
|
|
133
|
+
|
|
134
|
+
return acc
|
|
135
|
+
}, new Map<Role, Individual[]>())
|
|
136
|
+
|
|
137
|
+
this.contactsAsDynElemByRole = this.value.reduce((acc, contact) => {
|
|
153
138
|
const completeOrganization = this.allOrganizations.get(
|
|
154
139
|
contact.organization.name
|
|
155
140
|
)
|
|
@@ -177,8 +162,6 @@ export class FormFieldContactsForResourceComponent
|
|
|
177
162
|
|
|
178
163
|
return acc
|
|
179
164
|
}, new Map<Role, DynamicElement[]>())
|
|
180
|
-
|
|
181
|
-
this.changeDetectorRef.markForCheck()
|
|
182
165
|
}
|
|
183
166
|
|
|
184
167
|
manageRoleSectionsToDisplay(contactsForResource: Individual[]) {
|
|
@@ -194,10 +177,8 @@ export class FormFieldContactsForResourceComponent
|
|
|
194
177
|
}
|
|
195
178
|
|
|
196
179
|
removeContact(index: number) {
|
|
197
|
-
const newContactsforRessource = this.
|
|
198
|
-
|
|
199
|
-
)
|
|
200
|
-
this.control.setValue(newContactsforRessource)
|
|
180
|
+
const newContactsforRessource = this.value.filter((_, i) => i !== index)
|
|
181
|
+
this.valueChange.emit(newContactsforRessource)
|
|
201
182
|
}
|
|
202
183
|
|
|
203
184
|
handleContactsChanged(event: DynamicElement[]) {
|
|
@@ -213,7 +194,7 @@ export class FormFieldContactsForResourceComponent
|
|
|
213
194
|
this.contactsForRessourceByRole.values()
|
|
214
195
|
).flat()
|
|
215
196
|
|
|
216
|
-
this.
|
|
197
|
+
this.valueChange.emit(newControlValue)
|
|
217
198
|
}
|
|
218
199
|
|
|
219
200
|
protected roleToLabel(role: string): string {
|
|
@@ -233,7 +214,7 @@ export class FormFieldContactsForResourceComponent
|
|
|
233
214
|
*/
|
|
234
215
|
autoCompleteAction = (query: string) => {
|
|
235
216
|
const fuzzyFilter = createFuzzyFilter(query)
|
|
236
|
-
return this.
|
|
217
|
+
return this.platformServiceInterface.getUsers().pipe(
|
|
237
218
|
switchMap((users) => [
|
|
238
219
|
users.filter((user) => fuzzyFilter(user.username)),
|
|
239
220
|
]),
|
|
@@ -246,26 +227,23 @@ export class FormFieldContactsForResourceComponent
|
|
|
246
227
|
/**
|
|
247
228
|
* gn-ui-autocomplete
|
|
248
229
|
*/
|
|
249
|
-
addContact(contact:
|
|
230
|
+
addContact(contact: unknown, role: string) {
|
|
231
|
+
const newContact = contact as UserModel
|
|
250
232
|
const newContactsForRessource = {
|
|
251
|
-
firstName:
|
|
252
|
-
lastName:
|
|
233
|
+
firstName: newContact.name ?? '',
|
|
234
|
+
lastName: newContact.surname ?? '',
|
|
253
235
|
organization:
|
|
254
|
-
this.allOrganizations.get(
|
|
255
|
-
({ name:
|
|
256
|
-
email:
|
|
236
|
+
this.allOrganizations.get(newContact.organisation) ??
|
|
237
|
+
({ name: newContact.organisation } as Organization),
|
|
238
|
+
email: newContact.email ?? '',
|
|
257
239
|
role,
|
|
258
240
|
address: '',
|
|
259
241
|
phone: '',
|
|
260
242
|
position: '',
|
|
261
243
|
} as Individual
|
|
262
244
|
|
|
263
|
-
const newControlValue = [...this.
|
|
264
|
-
|
|
265
|
-
this.control.setValue(newControlValue)
|
|
266
|
-
}
|
|
245
|
+
const newControlValue = [...this.value, newContactsForRessource]
|
|
267
246
|
|
|
268
|
-
|
|
269
|
-
this.subscription.unsubscribe()
|
|
247
|
+
this.valueChange.emit(newControlValue)
|
|
270
248
|
}
|
|
271
249
|
}
|
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
<div class="flex flex-col gap-3">
|
|
2
|
-
<gn-ui-
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[allowSubmit]="false"
|
|
10
|
-
></gn-ui-autocomplete>
|
|
11
|
-
<div class="flex gap-2 flex-wrap">
|
|
12
|
-
<gn-ui-badge
|
|
13
|
-
*ngFor="let keyword of control.value; let index = index"
|
|
14
|
-
[removable]="true"
|
|
15
|
-
(badgeRemoveClicked)="removeKeyword(index)"
|
|
16
|
-
>{{ keyword.label }}</gn-ui-badge
|
|
17
|
-
>
|
|
18
|
-
</div>
|
|
2
|
+
<gn-ui-generic-keywords
|
|
3
|
+
[keywords]="value"
|
|
4
|
+
[keywordTypes]="keywordTypes"
|
|
5
|
+
[placeholder]="placeholder | translate"
|
|
6
|
+
(changedKeywords)="handleKeywordsChange($event)"
|
|
7
|
+
>
|
|
8
|
+
</gn-ui-generic-keywords>
|
|
19
9
|
</div>
|