geonetwork-ui 2.10.0-dev.5f1c6f718 → 2.10.0-dev.6fa5006eb
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 +9 -1
- package/fesm2022/geonetwork-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-single-link-resource/form-field-online-single-link-resource.component.css +0 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-single-link-resource/form-field-online-single-link-resource.component.html +5 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-single-link-resource/form-field-online-single-link-resource.component.ts +89 -0
- package/translations/de.json +1 -0
- package/translations/en.json +1 -0
- package/translations/es.json +1 -0
- package/translations/fr.json +1 -0
- package/translations/it.json +1 -0
- package/translations/nl.json +1 -0
- package/translations/pt.json +1 -0
- package/translations/sk.json +1 -0
package/package.json
CHANGED
|
File without changes
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
EventEmitter,
|
|
5
|
+
Input,
|
|
6
|
+
Output,
|
|
7
|
+
inject,
|
|
8
|
+
} from '@angular/core'
|
|
9
|
+
import { marker } from '@biesbjerg/ngx-translate-extract-marker'
|
|
10
|
+
import {
|
|
11
|
+
OnlineLinkResource,
|
|
12
|
+
OnlineResource,
|
|
13
|
+
} from '../../../../../../../../../libs/common/domain/src/lib/model/record'
|
|
14
|
+
import { NotificationsService } from '../../../../../../../../../libs/feature/notifications/src'
|
|
15
|
+
import { UrlInputComponent } from '../../../../../../../../../libs/ui/inputs/src'
|
|
16
|
+
import { TranslateService } from '@ngx-translate/core'
|
|
17
|
+
|
|
18
|
+
marker('editor.record.form.field.onlineLinkageResource.defaultName')
|
|
19
|
+
|
|
20
|
+
@Component({
|
|
21
|
+
selector: 'gn-ui-form-field-online-single-link-resource',
|
|
22
|
+
templateUrl: './form-field-online-single-link-resource.component.html',
|
|
23
|
+
styleUrls: ['./form-field-online-single-link-resource.component.css'],
|
|
24
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
25
|
+
standalone: true,
|
|
26
|
+
imports: [UrlInputComponent],
|
|
27
|
+
})
|
|
28
|
+
export class FormFieldOnlineSingleLinkResourceComponent {
|
|
29
|
+
private notificationsService = inject(NotificationsService)
|
|
30
|
+
private translateService = inject(TranslateService)
|
|
31
|
+
|
|
32
|
+
@Input() set value(onlineResources: Array<OnlineResource>) {
|
|
33
|
+
this.allResources = onlineResources ?? []
|
|
34
|
+
const firstResource = this.allResources[0]
|
|
35
|
+
this.displayUrl = firstResource?.url?.toString() ?? ''
|
|
36
|
+
}
|
|
37
|
+
@Output() valueChange: EventEmitter<Array<OnlineResource>> =
|
|
38
|
+
new EventEmitter()
|
|
39
|
+
|
|
40
|
+
private allResources: OnlineResource[] = []
|
|
41
|
+
displayUrl = ''
|
|
42
|
+
|
|
43
|
+
handleUrlChange(url: string | null) {
|
|
44
|
+
if (!url) return
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
const parsedUrl = new URL(url)
|
|
48
|
+
|
|
49
|
+
if (this.allResources.length === 0) {
|
|
50
|
+
const defaultName = this.translateService.instant(
|
|
51
|
+
'editor.record.form.field.onlineLinkageResource.defaultName'
|
|
52
|
+
)
|
|
53
|
+
const newResource: OnlineLinkResource = {
|
|
54
|
+
type: 'link',
|
|
55
|
+
url: parsedUrl,
|
|
56
|
+
name: defaultName,
|
|
57
|
+
}
|
|
58
|
+
this.valueChange.emit([newResource])
|
|
59
|
+
} else {
|
|
60
|
+
const updatedFirst: OnlineResource = {
|
|
61
|
+
...this.allResources[0],
|
|
62
|
+
url: parsedUrl,
|
|
63
|
+
}
|
|
64
|
+
this.valueChange.emit([updatedFirst, ...this.allResources.slice(1)])
|
|
65
|
+
}
|
|
66
|
+
} catch (error) {
|
|
67
|
+
this.handleError(error as Error)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private handleError(error: Error) {
|
|
72
|
+
this.notificationsService.showNotification(
|
|
73
|
+
{
|
|
74
|
+
type: 'error',
|
|
75
|
+
title: this.translateService.instant(
|
|
76
|
+
'editor.record.onlineResourceError.title'
|
|
77
|
+
),
|
|
78
|
+
text: `${this.translateService.instant(
|
|
79
|
+
'editor.record.onlineResourceError.body'
|
|
80
|
+
)} ${error.message}`,
|
|
81
|
+
closeMessage: this.translateService.instant(
|
|
82
|
+
'editor.record.onlineResourceError.closeMessage'
|
|
83
|
+
),
|
|
84
|
+
},
|
|
85
|
+
undefined,
|
|
86
|
+
error
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
}
|
package/translations/de.json
CHANGED
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
"editor.record.form.field.legalConstraints": "Rechtliche Einschränkung",
|
|
160
160
|
"editor.record.form.field.license": "Lizenz",
|
|
161
161
|
"editor.record.form.field.onlineLinkResources": "Beigefügte Ressourcen",
|
|
162
|
+
"editor.record.form.field.onlineLinkageResource.defaultName": "Link",
|
|
162
163
|
"editor.record.form.field.onlineResource.cancel": "Abbrechen",
|
|
163
164
|
"editor.record.form.field.onlineResource.confirm": "Bestätigen",
|
|
164
165
|
"editor.record.form.field.onlineResource.dialogTitle": "Vorschau des Datensatzes bearbeiten",
|
package/translations/en.json
CHANGED
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
"editor.record.form.field.legalConstraints": "Legal constraint",
|
|
160
160
|
"editor.record.form.field.license": "License",
|
|
161
161
|
"editor.record.form.field.onlineLinkResources": "Attached resources",
|
|
162
|
+
"editor.record.form.field.onlineLinkageResource.defaultName": "Link",
|
|
162
163
|
"editor.record.form.field.onlineResource.cancel": "Cancel",
|
|
163
164
|
"editor.record.form.field.onlineResource.confirm": "Confirm",
|
|
164
165
|
"editor.record.form.field.onlineResource.dialogTitle": "Modify the dataset preview",
|
package/translations/es.json
CHANGED
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
"editor.record.form.field.legalConstraints": "",
|
|
160
160
|
"editor.record.form.field.license": "",
|
|
161
161
|
"editor.record.form.field.onlineLinkResources": "",
|
|
162
|
+
"editor.record.form.field.onlineLinkageResource.defaultName": "",
|
|
162
163
|
"editor.record.form.field.onlineResource.cancel": "",
|
|
163
164
|
"editor.record.form.field.onlineResource.confirm": "",
|
|
164
165
|
"editor.record.form.field.onlineResource.dialogTitle": "",
|
package/translations/fr.json
CHANGED
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
"editor.record.form.field.legalConstraints": "Contrainte légale",
|
|
160
160
|
"editor.record.form.field.license": "Licence",
|
|
161
161
|
"editor.record.form.field.onlineLinkResources": "Ressources attachées",
|
|
162
|
+
"editor.record.form.field.onlineLinkageResource.defaultName": "Lien",
|
|
162
163
|
"editor.record.form.field.onlineResource.cancel": "Annuler",
|
|
163
164
|
"editor.record.form.field.onlineResource.confirm": "Valider",
|
|
164
165
|
"editor.record.form.field.onlineResource.dialogTitle": "Modifier l'aperçu du jeu de données",
|
package/translations/it.json
CHANGED
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
"editor.record.form.field.legalConstraints": "Vincolo legale",
|
|
160
160
|
"editor.record.form.field.license": "Licenza",
|
|
161
161
|
"editor.record.form.field.onlineLinkResources": "Risorse allegate",
|
|
162
|
+
"editor.record.form.field.onlineLinkageResource.defaultName": "Link",
|
|
162
163
|
"editor.record.form.field.onlineResource.cancel": "Annulla",
|
|
163
164
|
"editor.record.form.field.onlineResource.confirm": "Convalida",
|
|
164
165
|
"editor.record.form.field.onlineResource.dialogTitle": "Modifica anteprima dataset",
|
package/translations/nl.json
CHANGED
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
"editor.record.form.field.legalConstraints": "",
|
|
160
160
|
"editor.record.form.field.license": "",
|
|
161
161
|
"editor.record.form.field.onlineLinkResources": "",
|
|
162
|
+
"editor.record.form.field.onlineLinkageResource.defaultName": "",
|
|
162
163
|
"editor.record.form.field.onlineResource.cancel": "",
|
|
163
164
|
"editor.record.form.field.onlineResource.confirm": "",
|
|
164
165
|
"editor.record.form.field.onlineResource.dialogTitle": "",
|
package/translations/pt.json
CHANGED
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
"editor.record.form.field.legalConstraints": "",
|
|
160
160
|
"editor.record.form.field.license": "",
|
|
161
161
|
"editor.record.form.field.onlineLinkResources": "",
|
|
162
|
+
"editor.record.form.field.onlineLinkageResource.defaultName": "",
|
|
162
163
|
"editor.record.form.field.onlineResource.cancel": "",
|
|
163
164
|
"editor.record.form.field.onlineResource.confirm": "",
|
|
164
165
|
"editor.record.form.field.onlineResource.dialogTitle": "",
|
package/translations/sk.json
CHANGED
|
@@ -159,6 +159,7 @@
|
|
|
159
159
|
"editor.record.form.field.legalConstraints": "",
|
|
160
160
|
"editor.record.form.field.license": "Licencia",
|
|
161
161
|
"editor.record.form.field.onlineLinkResources": "",
|
|
162
|
+
"editor.record.form.field.onlineLinkageResource.defaultName": "",
|
|
162
163
|
"editor.record.form.field.onlineResource.cancel": "",
|
|
163
164
|
"editor.record.form.field.onlineResource.confirm": "",
|
|
164
165
|
"editor.record.form.field.onlineResource.dialogTitle": "",
|