geonetwork-ui 2.6.0-dev.87d6e6c1b → 2.6.0-dev.913451557
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/dcat-ap/dcat-ap.converter.mjs +11 -2
- package/esm2022/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.mjs +14 -6
- package/esm2022/libs/api/metadata-converter/src/lib/iso19139/write-parts.mjs +2 -2
- package/esm2022/libs/api/metadata-converter/src/lib/translate-utils.mjs +17 -0
- package/esm2022/libs/api/repository/src/lib/gn4/gn4-repository.mjs +1 -1
- package/esm2022/libs/common/domain/src/lib/repository/records-repository.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 +13 -7
- package/esm2022/libs/feature/editor/src/lib/+state/editor.facade.mjs +4 -1
- package/esm2022/libs/feature/editor/src/lib/+state/editor.reducer.mjs +5 -1
- package/esm2022/libs/feature/editor/src/lib/components/multilingual-panel/multilingual-panel.component.mjs +7 -6
- package/esm2022/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.mjs +8 -5
- package/esm2022/libs/feature/search/src/lib/results-list/results-list.container.component.mjs +1 -1
- package/esm2022/libs/ui/elements/src/lib/confirmation-dialog/confirmation-dialog.component.mjs +5 -3
- package/esm2022/libs/ui/inputs/src/lib/star-toggle/star-toggle.component.mjs +7 -3
- package/esm2022/libs/ui/search/src/lib/results-table/results-table.component.mjs +8 -4
- package/esm2022/libs/util/i18n/src/lib/language-codes.mjs +3 -3
- package/esm2022/libs/util/shared/src/index.mjs +2 -1
- package/esm2022/libs/util/shared/src/lib/record.util.mjs +56 -0
- package/esm2022/translations/de.json +1 -0
- package/esm2022/translations/en.json +2 -1
- package/esm2022/translations/es.json +1 -0
- package/esm2022/translations/fr.json +6 -5
- package/esm2022/translations/it.json +1 -0
- package/esm2022/translations/nl.json +1 -0
- package/esm2022/translations/pt.json +1 -0
- package/esm2022/translations/sk.json +1 -0
- package/fesm2022/geonetwork-ui.mjs +162 -40
- package/fesm2022/geonetwork-ui.mjs.map +1 -1
- package/libs/api/metadata-converter/src/lib/dcat-ap/dcat-ap.converter.d.ts.map +1 -1
- package/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.d.ts.map +1 -1
- package/libs/api/metadata-converter/src/lib/iso19139/write-parts.d.ts.map +1 -1
- package/libs/api/metadata-converter/src/lib/translate-utils.d.ts +2 -0
- package/libs/api/metadata-converter/src/lib/translate-utils.d.ts.map +1 -0
- package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts +2 -2
- package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts.map +1 -1
- package/libs/common/domain/src/lib/repository/records-repository.interface.d.ts +2 -2
- package/libs/common/domain/src/lib/repository/records-repository.interface.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/+state/editor.actions.d.ts +8 -1
- 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 +10 -12
- 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 +2 -1
- package/libs/feature/editor/src/lib/+state/editor.facade.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/+state/editor.reducer.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/multilingual-panel/multilingual-panel.component.d.ts.map +1 -1
- package/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.d.ts +2 -1
- package/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.d.ts.map +1 -1
- package/libs/ui/elements/src/lib/confirmation-dialog/confirmation-dialog.component.d.ts +2 -0
- package/libs/ui/elements/src/lib/confirmation-dialog/confirmation-dialog.component.d.ts.map +1 -1
- package/libs/ui/inputs/src/lib/star-toggle/star-toggle.component.d.ts +2 -1
- package/libs/ui/inputs/src/lib/star-toggle/star-toggle.component.d.ts.map +1 -1
- package/libs/ui/search/src/lib/results-table/results-table.component.d.ts.map +1 -1
- package/libs/util/shared/src/index.d.ts +1 -0
- package/libs/util/shared/src/index.d.ts.map +1 -1
- package/libs/util/shared/src/lib/record.util.d.ts +3 -0
- package/libs/util/shared/src/lib/record.util.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/libs/api/metadata-converter/src/lib/dcat-ap/dcat-ap.converter.ts +10 -1
- package/src/libs/api/metadata-converter/src/lib/fixtures/metadata-for-i18n.records.ts +4196 -0
- package/src/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.ts +14 -8
- package/src/libs/api/metadata-converter/src/lib/iso19139/write-parts.ts +2 -1
- package/src/libs/api/metadata-converter/src/lib/translate-utils.ts +17 -0
- package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +2 -1
- package/src/libs/common/domain/src/lib/repository/records-repository.interface.ts +6 -2
- package/src/libs/common/fixtures/src/lib/records.fixtures.ts +52 -0
- package/src/libs/feature/editor/src/lib/+state/editor.actions.ts +9 -1
- package/src/libs/feature/editor/src/lib/+state/editor.effects.ts +23 -12
- package/src/libs/feature/editor/src/lib/+state/editor.facade.ts +13 -1
- package/src/libs/feature/editor/src/lib/+state/editor.reducer.ts +9 -1
- package/src/libs/feature/editor/src/lib/components/multilingual-panel/multilingual-panel.component.ts +9 -8
- package/src/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.html +1 -0
- package/src/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.ts +2 -1
- package/src/libs/ui/elements/src/lib/confirmation-dialog/confirmation-dialog.component.html +6 -2
- package/src/libs/ui/elements/src/lib/confirmation-dialog/confirmation-dialog.component.ts +5 -1
- package/src/libs/ui/inputs/src/lib/star-toggle/star-toggle.component.css +0 -1
- package/src/libs/ui/inputs/src/lib/star-toggle/star-toggle.component.html +5 -1
- package/src/libs/ui/inputs/src/lib/star-toggle/star-toggle.component.ts +3 -1
- package/src/libs/ui/search/src/lib/results-table/results-table.component.html +0 -2
- package/src/libs/ui/search/src/lib/results-table/results-table.component.ts +6 -3
- package/src/libs/util/i18n/src/lib/language-codes.ts +2 -2
- package/src/libs/util/shared/src/index.ts +1 -0
- package/src/libs/util/shared/src/lib/record.util.ts +114 -0
- package/translations/de.json +1 -0
- package/translations/en.json +2 -1
- package/translations/es.json +1 -0
- package/translations/fr.json +6 -5
- package/translations/it.json +1 -0
- package/translations/nl.json +1 -0
- package/translations/pt.json +1 -0
- package/translations/sk.json +1 -0
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
import { XmlElement } from '@rgrove/parse-xml'
|
|
12
12
|
import { BaseConverter } from '../base.converter'
|
|
13
13
|
import { isEqual } from '../convert-utils'
|
|
14
|
+
import { isFieldTranslatable } from '../translate-utils'
|
|
14
15
|
import {
|
|
15
16
|
createDocument,
|
|
16
17
|
createElement,
|
|
@@ -160,7 +161,7 @@ export class Iso19139Converter extends BaseConverter<string> {
|
|
|
160
161
|
// TODO
|
|
161
162
|
extras: () => undefined,
|
|
162
163
|
landingPage: () => undefined,
|
|
163
|
-
translations: () => undefined,
|
|
164
|
+
translations: () => undefined, // NB. translations are handled in properties
|
|
164
165
|
}
|
|
165
166
|
|
|
166
167
|
protected beforeDocumentCreation(rootElement: XmlElement) {
|
|
@@ -189,6 +190,7 @@ export class Iso19139Converter extends BaseConverter<string> {
|
|
|
189
190
|
}
|
|
190
191
|
}
|
|
191
192
|
}
|
|
193
|
+
|
|
192
194
|
fixLanguages(record)
|
|
193
195
|
record.keywords.map(fixLanguages)
|
|
194
196
|
record.onlineResources.map(fixLanguages)
|
|
@@ -275,7 +277,6 @@ export class Iso19139Converter extends BaseConverter<string> {
|
|
|
275
277
|
async readRecord(document: string): Promise<CatalogRecord> {
|
|
276
278
|
const doc = parseXmlString(document)
|
|
277
279
|
const rootEl = getRootElement(doc)
|
|
278
|
-
|
|
279
280
|
const tr: RecordTranslations = {}
|
|
280
281
|
const kind = this.readers['kind'](rootEl, tr) as RecordKind
|
|
281
282
|
|
|
@@ -326,15 +327,19 @@ export class Iso19139Converter extends BaseConverter<string> {
|
|
|
326
327
|
let rootEl: XmlElement
|
|
327
328
|
let fieldChanged: (name: string) => boolean
|
|
328
329
|
if (reference) {
|
|
330
|
+
// eslint-disable-next-line prefer-const
|
|
331
|
+
let languagesChanged: boolean
|
|
329
332
|
const originalDoc = parseXmlString(reference)
|
|
330
333
|
const originalRecord = await this.readRecord(reference)
|
|
331
334
|
rootEl = getRootElement(originalDoc)
|
|
332
335
|
|
|
333
336
|
fieldChanged = (name: string) => {
|
|
334
337
|
return originalRecord !== null
|
|
335
|
-
? !isEqual(record[name], originalRecord[name])
|
|
338
|
+
? !isEqual(record[name], originalRecord[name]) ||
|
|
339
|
+
(languagesChanged && isFieldTranslatable(name))
|
|
336
340
|
: true
|
|
337
341
|
}
|
|
342
|
+
languagesChanged = fieldChanged('otherLanguages')
|
|
338
343
|
} else {
|
|
339
344
|
rootEl = createElement('gmd:MD_Metadata')()
|
|
340
345
|
fieldChanged = () => true
|
|
@@ -357,9 +362,10 @@ export class Iso19139Converter extends BaseConverter<string> {
|
|
|
357
362
|
this.writers['recordCreated'](record, rootEl)
|
|
358
363
|
fieldChanged('recordPublished') &&
|
|
359
364
|
this.writers['recordPublished'](record, rootEl)
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
fieldChanged('abstract')
|
|
365
|
+
;(fieldChanged('title') || fieldChanged('translations')) &&
|
|
366
|
+
this.writers['title'](record, rootEl)
|
|
367
|
+
;(fieldChanged('abstract') || fieldChanged('translations')) &&
|
|
368
|
+
this.writers['abstract'](record, rootEl)
|
|
363
369
|
|
|
364
370
|
fieldChanged('resourceCreated') &&
|
|
365
371
|
this.writers['resourceCreated'](record, rootEl)
|
|
@@ -396,9 +402,9 @@ export class Iso19139Converter extends BaseConverter<string> {
|
|
|
396
402
|
this.writers['temporalExtents'](record, rootEl)
|
|
397
403
|
fieldChanged('spatialExtents') &&
|
|
398
404
|
this.writers['spatialExtents'](record, rootEl)
|
|
399
|
-
fieldChanged('lineage')
|
|
405
|
+
;(fieldChanged('lineage') || fieldChanged('translations')) &&
|
|
406
|
+
this.writers['lineage'](record, rootEl)
|
|
400
407
|
}
|
|
401
|
-
|
|
402
408
|
fieldChanged('otherLanguages') &&
|
|
403
409
|
this.writers['otherLanguages'](record, rootEl)
|
|
404
410
|
|
|
@@ -62,7 +62,8 @@ function writeLocalizedElement(
|
|
|
62
62
|
translations: FieldTranslation,
|
|
63
63
|
defaultLanguage: LanguageCode
|
|
64
64
|
): ChainableFunction<XmlElement, XmlElement> {
|
|
65
|
-
if (!translations)
|
|
65
|
+
if (!translations)
|
|
66
|
+
return pipe(writeFn, removeChildrenByName('gmd:PT_FreeText')) // If no translations, remove existing if any
|
|
66
67
|
function createLocalized(lang: LanguageCode, translation: string) {
|
|
67
68
|
return pipe(
|
|
68
69
|
createNestedElement('gmd:textGroup', 'gmd:LocalisedCharacterString'),
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const TRANSLATABLE_GN4_FIELDS = [
|
|
2
|
+
'abstract',
|
|
3
|
+
'constraint',
|
|
4
|
+
'keywords',
|
|
5
|
+
'lineage',
|
|
6
|
+
'onlineResources',
|
|
7
|
+
'spatialExtents',
|
|
8
|
+
'title',
|
|
9
|
+
// TODO, also add these fields in writers
|
|
10
|
+
// 'contact',
|
|
11
|
+
// 'pointOfContact'
|
|
12
|
+
// 'extent'
|
|
13
|
+
] as const
|
|
14
|
+
|
|
15
|
+
export function isFieldTranslatable(fieldName: string) {
|
|
16
|
+
return (TRANSLATABLE_GN4_FIELDS as unknown as string[]).includes(fieldName)
|
|
17
|
+
}
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
CatalogRecord,
|
|
17
17
|
DatasetFeatureCatalog,
|
|
18
18
|
DatasetFeatureType,
|
|
19
|
+
LanguageCode,
|
|
19
20
|
} from '../../../../../../libs/common/domain/src/lib/model/record'
|
|
20
21
|
import {
|
|
21
22
|
Aggregations,
|
|
@@ -555,7 +556,7 @@ export class Gn4Repository implements RecordsRepositoryInterface {
|
|
|
555
556
|
)
|
|
556
557
|
}
|
|
557
558
|
|
|
558
|
-
getApplicationLanguages(): Observable<
|
|
559
|
+
getApplicationLanguages(): Observable<LanguageCode[]> {
|
|
559
560
|
return this.gn4LanguagesApi
|
|
560
561
|
.getApplicationLanguages()
|
|
561
562
|
.pipe(
|
|
@@ -6,7 +6,11 @@ import {
|
|
|
6
6
|
SearchParams,
|
|
7
7
|
SearchResults,
|
|
8
8
|
} from '../model/search'
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
CatalogRecord,
|
|
11
|
+
DatasetFeatureCatalog,
|
|
12
|
+
LanguageCode,
|
|
13
|
+
} from '../model/record'
|
|
10
14
|
|
|
11
15
|
export abstract class RecordsRepositoryInterface {
|
|
12
16
|
abstract search(params: SearchParams): Observable<SearchResults>
|
|
@@ -100,5 +104,5 @@ export abstract class RecordsRepositoryInterface {
|
|
|
100
104
|
localRecord: CatalogRecord
|
|
101
105
|
): Observable<{ user: string; date: Date }>
|
|
102
106
|
abstract getRecordPublicationStatus(uuid: string): Observable<boolean>
|
|
103
|
-
abstract getApplicationLanguages(): Observable<
|
|
107
|
+
abstract getApplicationLanguages(): Observable<LanguageCode[]>
|
|
104
108
|
}
|
|
@@ -970,3 +970,55 @@ export const SAMPLE_RECORD = {
|
|
|
970
970
|
...SAMPLE_PLACE_KEYWORDS_FROM_XML,
|
|
971
971
|
],
|
|
972
972
|
}
|
|
973
|
+
|
|
974
|
+
export const multilingualDatasetFixture: () => DatasetRecord = () => ({
|
|
975
|
+
kind: 'dataset',
|
|
976
|
+
defaultLanguage: 'en',
|
|
977
|
+
otherLanguages: ['fr', 'de'],
|
|
978
|
+
title: 'English Title',
|
|
979
|
+
abstract: 'English Abstract',
|
|
980
|
+
lineage: 'English Lineage',
|
|
981
|
+
translations: {
|
|
982
|
+
title: { fr: 'Titre Français', de: 'Titel DE' },
|
|
983
|
+
abstract: { fr: 'Résumé Français', de: 'Beschreibung DE' },
|
|
984
|
+
lineage: { fr: 'Généalogie Français', de: 'Lineage DE' },
|
|
985
|
+
},
|
|
986
|
+
keywords: [
|
|
987
|
+
{
|
|
988
|
+
label: 'Keyword EN',
|
|
989
|
+
description: 'Keyword Desc EN',
|
|
990
|
+
type: 'theme',
|
|
991
|
+
translations: {
|
|
992
|
+
label: { fr: 'Mot-clé FR', de: 'Schlusselwort DE' },
|
|
993
|
+
description: { fr: 'Description FR', de: 'Schlusselwort DE' },
|
|
994
|
+
},
|
|
995
|
+
},
|
|
996
|
+
],
|
|
997
|
+
onlineResources: [],
|
|
998
|
+
licenses: [],
|
|
999
|
+
legalConstraints: [],
|
|
1000
|
+
securityConstraints: [],
|
|
1001
|
+
otherConstraints: [],
|
|
1002
|
+
contacts: [],
|
|
1003
|
+
contactsForResource: [],
|
|
1004
|
+
ownerOrganization: {
|
|
1005
|
+
name: 'Org EN',
|
|
1006
|
+
translations: {
|
|
1007
|
+
name: { fr: 'Org FR', de: 'Org DE' },
|
|
1008
|
+
},
|
|
1009
|
+
},
|
|
1010
|
+
spatialExtents: [
|
|
1011
|
+
{
|
|
1012
|
+
description: 'Extent EN',
|
|
1013
|
+
translations: {
|
|
1014
|
+
description: { fr: 'Étendue FR', de: 'Bereich DE' },
|
|
1015
|
+
},
|
|
1016
|
+
},
|
|
1017
|
+
],
|
|
1018
|
+
temporalExtents: [],
|
|
1019
|
+
status: 'ongoing',
|
|
1020
|
+
uniqueIdentifier: 'ABCD-EFGH',
|
|
1021
|
+
overviews: [],
|
|
1022
|
+
topics: [],
|
|
1023
|
+
recordUpdated: null,
|
|
1024
|
+
})
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { createAction, props } from '@ngrx/store'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
CatalogRecord,
|
|
4
|
+
LanguageCode,
|
|
5
|
+
} from '../../../../../../libs/common/domain/src/lib/model/record'
|
|
3
6
|
import { SaveRecordError } from './editor.models'
|
|
4
7
|
import { EditorFieldIdentification } from '../models'
|
|
5
8
|
|
|
@@ -16,6 +19,11 @@ export const updateRecordField = createAction(
|
|
|
16
19
|
props<{ field: string; value: unknown }>()
|
|
17
20
|
)
|
|
18
21
|
|
|
22
|
+
export const updateRecordLanguages = createAction(
|
|
23
|
+
'[Editor] Update record languages',
|
|
24
|
+
props<{ defaultLanguage: LanguageCode; otherLanguages: LanguageCode[] }>()
|
|
25
|
+
)
|
|
26
|
+
|
|
19
27
|
export const markRecordAsChanged = createAction(
|
|
20
28
|
'[Editor] Mark record as changed'
|
|
21
29
|
)
|
|
@@ -4,7 +4,7 @@ import { debounceTime, EMPTY, filter, of, withLatestFrom } from 'rxjs'
|
|
|
4
4
|
import { catchError, map, switchMap } from 'rxjs/operators'
|
|
5
5
|
import * as EditorActions from './editor.actions'
|
|
6
6
|
import { EditorService } from '../services/editor.service'
|
|
7
|
-
import { Store } from '@ngrx/store'
|
|
7
|
+
import { Action, Store } from '@ngrx/store'
|
|
8
8
|
import {
|
|
9
9
|
selectEditorConfig,
|
|
10
10
|
selectRecord,
|
|
@@ -31,15 +31,20 @@ export class EditorEffects {
|
|
|
31
31
|
),
|
|
32
32
|
switchMap(([, record, recordSource, fieldsConfig]) =>
|
|
33
33
|
this.editorService.saveRecord(record, recordSource, fieldsConfig).pipe(
|
|
34
|
-
switchMap(([
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
switchMap(([savedRecord, savedRecordSource]) => {
|
|
35
|
+
const actions: Action[] = [EditorActions.saveRecordSuccess()]
|
|
36
|
+
|
|
37
|
+
if (!record?.uniqueIdentifier) {
|
|
38
|
+
actions.push(
|
|
39
|
+
EditorActions.openRecord({
|
|
40
|
+
record: savedRecord,
|
|
41
|
+
recordSource: savedRecordSource,
|
|
42
|
+
})
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return of(...actions)
|
|
47
|
+
}),
|
|
43
48
|
catchError((error) =>
|
|
44
49
|
of(
|
|
45
50
|
EditorActions.saveRecordFailure({
|
|
@@ -78,14 +83,20 @@ export class EditorEffects {
|
|
|
78
83
|
|
|
79
84
|
markAsChanged$ = createEffect(() =>
|
|
80
85
|
this.actions$.pipe(
|
|
81
|
-
ofType(
|
|
86
|
+
ofType(
|
|
87
|
+
EditorActions.updateRecordField,
|
|
88
|
+
EditorActions.updateRecordLanguages
|
|
89
|
+
),
|
|
82
90
|
map(() => EditorActions.markRecordAsChanged())
|
|
83
91
|
)
|
|
84
92
|
)
|
|
85
93
|
|
|
86
94
|
saveRecordDraft$ = createEffect(() =>
|
|
87
95
|
this.actions$.pipe(
|
|
88
|
-
ofType(
|
|
96
|
+
ofType(
|
|
97
|
+
EditorActions.updateRecordField,
|
|
98
|
+
EditorActions.updateRecordLanguages
|
|
99
|
+
),
|
|
89
100
|
debounceTime(1000),
|
|
90
101
|
withLatestFrom(
|
|
91
102
|
this.store.select(selectRecord),
|
|
@@ -2,7 +2,10 @@ import { inject, Injectable } from '@angular/core'
|
|
|
2
2
|
import { select, Store } from '@ngrx/store'
|
|
3
3
|
import * as EditorActions from './editor.actions'
|
|
4
4
|
import * as EditorSelectors from './editor.selectors'
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
CatalogRecord,
|
|
7
|
+
LanguageCode,
|
|
8
|
+
} from '../../../../../../libs/common/domain/src/lib/model/record'
|
|
6
9
|
import { filter } from 'rxjs'
|
|
7
10
|
import { Actions, ofType } from '@ngrx/effects'
|
|
8
11
|
import { EditorFieldIdentification } from '../models'
|
|
@@ -57,6 +60,15 @@ export class EditorFacade {
|
|
|
57
60
|
this.store.dispatch(EditorActions.updateRecordField({ field, value }))
|
|
58
61
|
}
|
|
59
62
|
|
|
63
|
+
updateRecordLanguages(
|
|
64
|
+
defaultLanguage: LanguageCode,
|
|
65
|
+
otherLanguages: LanguageCode[]
|
|
66
|
+
) {
|
|
67
|
+
this.store.dispatch(
|
|
68
|
+
EditorActions.updateRecordLanguages({ defaultLanguage, otherLanguages })
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
60
72
|
setCurrentPage(page: number) {
|
|
61
73
|
this.store.dispatch(EditorActions.setCurrentPage({ page }))
|
|
62
74
|
}
|
|
@@ -4,6 +4,7 @@ import { CatalogRecord } from '../../../../../../libs/common/domain/src/lib/mode
|
|
|
4
4
|
import { SaveRecordError } from './editor.models'
|
|
5
5
|
import { EditorConfig } from '../models'
|
|
6
6
|
import { DEFAULT_CONFIGURATION } from '../fields.config'
|
|
7
|
+
import { updateLanguages } from '../../../../../../libs/util/shared/src'
|
|
7
8
|
|
|
8
9
|
export const EDITOR_FEATURE_KEY = 'editor'
|
|
9
10
|
|
|
@@ -116,7 +117,14 @@ const reducer = createReducer(
|
|
|
116
117
|
on(EditorActions.canEditRecord, (state, { canEditRecord }) => ({
|
|
117
118
|
...state,
|
|
118
119
|
canEditRecord: canEditRecord,
|
|
119
|
-
}))
|
|
120
|
+
})),
|
|
121
|
+
on(
|
|
122
|
+
EditorActions.updateRecordLanguages,
|
|
123
|
+
(state, { defaultLanguage, otherLanguages }) => ({
|
|
124
|
+
...state,
|
|
125
|
+
record: updateLanguages(state.record, defaultLanguage, otherLanguages),
|
|
126
|
+
})
|
|
127
|
+
)
|
|
120
128
|
)
|
|
121
129
|
|
|
122
130
|
export function editorReducer(state: EditorState | undefined, action: Action) {
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
Component,
|
|
4
4
|
ElementRef,
|
|
5
5
|
Input,
|
|
6
|
+
OnChanges,
|
|
6
7
|
OnDestroy,
|
|
7
8
|
QueryList,
|
|
8
9
|
ViewChildren,
|
|
@@ -194,11 +195,11 @@ export class MultilingualPanelComponent implements OnDestroy {
|
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
updateTranslations() {
|
|
197
|
-
this.
|
|
198
|
-
|
|
199
|
-
this.selectedLanguages.filter((lang) => lang !== this.formLanguage)
|
|
198
|
+
const newLanguageSelection = this.selectedLanguages.filter(
|
|
199
|
+
(lang) => lang !== this.formLanguage
|
|
200
200
|
)
|
|
201
|
-
this.
|
|
201
|
+
this.facade.updateRecordLanguages(this.formLanguage, newLanguageSelection)
|
|
202
|
+
this.recordLanguages = newLanguageSelection
|
|
202
203
|
this.editTranslations = false
|
|
203
204
|
}
|
|
204
205
|
|
|
@@ -208,9 +209,8 @@ export class MultilingualPanelComponent implements OnDestroy {
|
|
|
208
209
|
|
|
209
210
|
switchDefaultLang(lang: string) {
|
|
210
211
|
this.formLanguage = lang
|
|
211
|
-
this.facade.
|
|
212
|
-
|
|
213
|
-
'otherLanguages',
|
|
212
|
+
this.facade.updateRecordLanguages(
|
|
213
|
+
lang,
|
|
214
214
|
this.selectedLanguages.filter((lang) => lang !== this.formLanguage)
|
|
215
215
|
)
|
|
216
216
|
this.closeActionMenu()
|
|
@@ -231,6 +231,7 @@ export class MultilingualPanelComponent implements OnDestroy {
|
|
|
231
231
|
cancelText: this.translateService.instant(
|
|
232
232
|
'editor.record.multilingual.confirmation.cancelText'
|
|
233
233
|
),
|
|
234
|
+
focusCancel: true,
|
|
234
235
|
},
|
|
235
236
|
restoreFocus: true,
|
|
236
237
|
})
|
|
@@ -244,7 +245,7 @@ export class MultilingualPanelComponent implements OnDestroy {
|
|
|
244
245
|
}
|
|
245
246
|
this.updateTranslations()
|
|
246
247
|
} else {
|
|
247
|
-
this.facade.
|
|
248
|
+
this.facade.updateRecordLanguages(this.formLanguage, [])
|
|
248
249
|
this.isMultilingual = false
|
|
249
250
|
this.selectedLanguages = []
|
|
250
251
|
}
|
|
@@ -33,6 +33,7 @@ import { CommonModule } from '@angular/common'
|
|
|
33
33
|
imports: [CommonModule, StarToggleComponent],
|
|
34
34
|
})
|
|
35
35
|
export class FavoriteStarComponent implements AfterViewInit, OnDestroy {
|
|
36
|
+
@Input() displayLabel? = false
|
|
36
37
|
@Input() displayCount? = true
|
|
37
38
|
@Input() set record(value) {
|
|
38
39
|
this.record_ = value
|
|
@@ -87,7 +88,7 @@ export class FavoriteStarComponent implements AfterViewInit, OnDestroy {
|
|
|
87
88
|
content: loginMessage,
|
|
88
89
|
allowHTML: true,
|
|
89
90
|
interactive: true,
|
|
90
|
-
zIndex:
|
|
91
|
+
zIndex: 60,
|
|
91
92
|
maxWidth: 250,
|
|
92
93
|
})
|
|
93
94
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
<h1 mat-dialog-title>{{ data.title }}</h1>
|
|
2
2
|
<div mat-dialog-content>{{ data.message }}</div>
|
|
3
3
|
<div mat-dialog-actions>
|
|
4
|
-
<gn-ui-button
|
|
4
|
+
<gn-ui-button
|
|
5
|
+
[attr.cdkFocusInitial]="focusCancel"
|
|
6
|
+
(buttonClick)="onCancel()"
|
|
7
|
+
>{{ data.cancelText }}</gn-ui-button
|
|
8
|
+
>
|
|
5
9
|
<gn-ui-button
|
|
6
10
|
(buttonClick)="onConfirm()"
|
|
7
|
-
cdkFocusInitial
|
|
11
|
+
[attr.cdkFocusInitial]="!focusCancel"
|
|
8
12
|
class="ml-2"
|
|
9
13
|
data-cy="confirm-button"
|
|
10
14
|
>{{ data.confirmText }}</gn-ui-button
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import { ButtonComponent } from '../../../../../../libs/ui/inputs/src'
|
|
8
8
|
|
|
9
9
|
export interface ConfirmationDialogData {
|
|
10
|
+
focusCancel: string
|
|
10
11
|
title: string
|
|
11
12
|
message: string
|
|
12
13
|
confirmText: string
|
|
@@ -22,10 +23,13 @@ export interface ConfirmationDialogData {
|
|
|
22
23
|
imports: [MatDialogModule, ButtonComponent],
|
|
23
24
|
})
|
|
24
25
|
export class ConfirmationDialogComponent {
|
|
26
|
+
focusCancel = null
|
|
25
27
|
constructor(
|
|
26
28
|
public dialogRef: MatDialogRef<ConfirmationDialogComponent>,
|
|
27
29
|
@Inject(MAT_DIALOG_DATA) public data: ConfirmationDialogData
|
|
28
|
-
) {
|
|
30
|
+
) {
|
|
31
|
+
this.focusCancel = data.focusCancel ? true : null
|
|
32
|
+
}
|
|
29
33
|
|
|
30
34
|
onConfirm() {
|
|
31
35
|
this.dialogRef.close(true)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<div class="inline-block relative align-middle">
|
|
1
|
+
<div class="inline-block relative align-middle cursor-pointer">
|
|
2
2
|
<gn-ui-button
|
|
3
3
|
[type]="'outline'"
|
|
4
4
|
[disabled]="disabled"
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
}"
|
|
11
11
|
>
|
|
12
12
|
<ng-icon [name]="toggled ? 'matStar' : 'matStarBorder'"></ng-icon>
|
|
13
|
+
<span *ngIf="displayLabel" class="mx-2 text-[16px] content-center" translate
|
|
14
|
+
>favorite.starToggle.label</span
|
|
15
|
+
>
|
|
13
16
|
</gn-ui-button>
|
|
14
17
|
<svg
|
|
15
18
|
#starOverlay
|
|
@@ -17,6 +20,7 @@
|
|
|
17
20
|
width="40px"
|
|
18
21
|
height="40px"
|
|
19
22
|
viewBox="-15 -15 30 30"
|
|
23
|
+
[style]="displayLabel ? 'left: 16px' : 'left: 50%'"
|
|
20
24
|
>
|
|
21
25
|
<g>
|
|
22
26
|
<path d="M 0,13.229167 V 0" />
|
|
@@ -12,6 +12,7 @@ import { NgIcon, provideIcons } from '@ng-icons/core'
|
|
|
12
12
|
import { CommonModule } from '@angular/common'
|
|
13
13
|
import { matStar, matStarBorder } from '@ng-icons/material-icons/baseline'
|
|
14
14
|
import { ButtonComponent } from '../button/button.component'
|
|
15
|
+
import { TranslateDirective } from '@ngx-translate/core'
|
|
15
16
|
|
|
16
17
|
@Component({
|
|
17
18
|
selector: 'gn-ui-star-toggle',
|
|
@@ -19,12 +20,13 @@ import { ButtonComponent } from '../button/button.component'
|
|
|
19
20
|
styleUrls: ['./star-toggle.component.css'],
|
|
20
21
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
21
22
|
standalone: true,
|
|
22
|
-
imports: [CommonModule, NgIcon, ButtonComponent],
|
|
23
|
+
imports: [CommonModule, NgIcon, ButtonComponent, TranslateDirective],
|
|
23
24
|
viewProviders: [provideIcons({ matStar, matStarBorder })],
|
|
24
25
|
})
|
|
25
26
|
export class StarToggleComponent {
|
|
26
27
|
@Input() toggled!: boolean
|
|
27
28
|
@Input() disabled = false
|
|
29
|
+
@Input() displayLabel = false
|
|
28
30
|
@Output() newValue = new EventEmitter<boolean>()
|
|
29
31
|
@ViewChild('starOverlay') overlay: ElementRef
|
|
30
32
|
|
|
@@ -146,14 +146,12 @@
|
|
|
146
146
|
<ng-template #header> </ng-template>
|
|
147
147
|
<ng-template #cell let-item>
|
|
148
148
|
<div class="flex justify-end items-center gap-4 w-full">
|
|
149
|
-
<!-- IS MULTILINGUAL -->
|
|
150
149
|
<ng-icon
|
|
151
150
|
*ngIf="isMultilingual(item)"
|
|
152
151
|
data-cy="multilingual-indicator"
|
|
153
152
|
name="iconoirTranslate"
|
|
154
153
|
[attr.title]="getTxtHoverMultilingual(item)"
|
|
155
154
|
></ng-icon>
|
|
156
|
-
<!-- MORE ACTIONS MENU BUTTON -->
|
|
157
155
|
<gn-ui-button
|
|
158
156
|
cdkOverlayOrigin
|
|
159
157
|
#actionMenuButton
|
|
@@ -241,10 +241,13 @@ export class ResultsTableComponent {
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
getTxtHoverMultilingual(record: CatalogRecord) {
|
|
244
|
+
const languages = [
|
|
245
|
+
...[record.defaultLanguage],
|
|
246
|
+
...record.otherLanguages,
|
|
247
|
+
].sort((a, b) => a.localeCompare(b))
|
|
248
|
+
|
|
244
249
|
return this.translateService.instant('dashboard.records.isMultilingual', {
|
|
245
|
-
languages:
|
|
246
|
-
', '
|
|
247
|
-
),
|
|
250
|
+
languages: languages.join(', '),
|
|
248
251
|
})
|
|
249
252
|
}
|
|
250
253
|
}
|
|
@@ -68,11 +68,11 @@ export const LANG_2_TO_3_MAPPER = Object.entries(LANG_3_TO_2_MAPPER).reduce(
|
|
|
68
68
|
)
|
|
69
69
|
|
|
70
70
|
export function getLang3FromLang2(lang2: string): string {
|
|
71
|
-
return LANG_2_TO_3_MAPPER[lang2] ??
|
|
71
|
+
return LANG_2_TO_3_MAPPER[lang2] ?? lang2
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
export function getLang2FromLang3(lang3: string): string {
|
|
75
|
-
return LANG_3_TO_2_MAPPER[lang3] ??
|
|
75
|
+
return LANG_3_TO_2_MAPPER[lang3] ?? lang3
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
export function getLocalizedIndexKey(lang2: string): string {
|