geonetwork-ui 2.6.0-dev.b1563a5e0 → 2.6.0-dev.c49d02679

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.
Files changed (162) hide show
  1. package/esm2022/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.mjs +13 -2
  2. package/esm2022/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.mjs +1 -1
  3. package/esm2022/libs/api/metadata-converter/src/lib/iso19115-3/read-parts.mjs +8 -4
  4. package/esm2022/libs/api/metadata-converter/src/lib/iso19115-3/write-parts.mjs +5 -2
  5. package/esm2022/libs/api/metadata-converter/src/lib/iso19139/read-parts.mjs +3 -3
  6. package/esm2022/libs/api/metadata-converter/src/lib/iso19139/write-parts.mjs +2 -2
  7. package/esm2022/libs/api/repository/src/lib/gn4/elasticsearch/constant.mjs +2 -1
  8. package/esm2022/libs/api/repository/src/lib/gn4/gn4-repository.mjs +53 -14
  9. package/esm2022/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.mjs +7 -1
  10. package/esm2022/libs/api/repository/src/lib/gn4/settings/gn4-settings.service.mjs +2 -1
  11. package/esm2022/libs/common/domain/src/lib/model/record/metadata.model.mjs +1 -1
  12. package/esm2022/libs/common/domain/src/lib/repository/records-repository.interface.mjs +1 -1
  13. package/esm2022/libs/feature/editor/src/lib/components/multilingual-panel/multilingual-panel.component.mjs +266 -11
  14. package/esm2022/libs/feature/map/src/lib/add-layer-from-catalog/add-layer-from-catalog.component.mjs +1 -1
  15. package/esm2022/libs/feature/record/src/lib/map-view/map-view.component.mjs +49 -23
  16. package/esm2022/libs/feature/search/src/lib/constants.mjs +3 -2
  17. package/esm2022/libs/feature/search/src/lib/fuzzy-search/fuzzy-search.component.mjs +5 -3
  18. package/esm2022/libs/feature/search/src/lib/results-table/results-table-container.component.mjs +13 -10
  19. package/esm2022/libs/ui/elements/src/lib/internal-link-card/internal-link-card.component.mjs +19 -34
  20. package/esm2022/libs/ui/elements/src/lib/internal-link-card-contact/internal-link-card-contact.component.mjs +59 -0
  21. package/esm2022/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.mjs +35 -10
  22. package/esm2022/libs/ui/elements/src/lib/metadata-quality-item/metadata-quality-item.component.mjs +5 -1
  23. package/esm2022/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.mjs +50 -29
  24. package/esm2022/libs/ui/elements/src/lib/ui-elements.module.mjs +7 -3
  25. package/esm2022/libs/ui/layout/src/index.mjs +2 -1
  26. package/esm2022/libs/ui/layout/src/lib/cell-popin/cell-popin.component.mjs +110 -0
  27. package/esm2022/libs/ui/layout/src/lib/interactive-table/interactive-table.component.mjs +20 -10
  28. package/esm2022/libs/ui/layout/src/lib/truncated-text/truncated-text.component.mjs +15 -49
  29. package/esm2022/libs/ui/layout/src/lib/ui-layout.module.mjs +2 -2
  30. package/esm2022/libs/ui/search/src/index.mjs +2 -1
  31. package/esm2022/libs/ui/search/src/lib/results-table/action-menu/action-menu.component.mjs +21 -12
  32. package/esm2022/libs/ui/search/src/lib/results-table/results-table.component.mjs +39 -18
  33. package/esm2022/libs/ui/search/src/lib/ui-search.module.mjs +10 -4
  34. package/esm2022/libs/util/i18n/src/lib/i18n.constants.mjs +42 -1
  35. package/esm2022/libs/util/i18n/src/lib/language-codes.mjs +24 -2
  36. package/esm2022/translations/de.json +42 -6
  37. package/esm2022/translations/en.json +42 -6
  38. package/esm2022/translations/es.json +41 -5
  39. package/esm2022/translations/fr.json +42 -6
  40. package/esm2022/translations/it.json +41 -5
  41. package/esm2022/translations/nl.json +41 -5
  42. package/esm2022/translations/pt.json +41 -5
  43. package/fesm2022/geonetwork-ui.mjs +1573 -733
  44. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  45. package/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.d.ts.map +1 -1
  46. package/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.d.ts +0 -1
  47. package/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.d.ts.map +1 -1
  48. package/libs/api/metadata-converter/src/lib/iso19115-3/read-parts.d.ts +1 -0
  49. package/libs/api/metadata-converter/src/lib/iso19115-3/read-parts.d.ts.map +1 -1
  50. package/libs/api/metadata-converter/src/lib/iso19115-3/write-parts.d.ts.map +1 -1
  51. package/libs/api/metadata-converter/src/lib/iso19139/read-parts.d.ts.map +1 -1
  52. package/libs/api/metadata-converter/src/lib/iso19139/write-parts.d.ts.map +1 -1
  53. package/libs/api/repository/src/lib/gn4/elasticsearch/constant.d.ts.map +1 -1
  54. package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts +10 -2
  55. package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts.map +1 -1
  56. package/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.d.ts +2 -0
  57. package/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.d.ts.map +1 -1
  58. package/libs/api/repository/src/lib/gn4/settings/gn4-settings.service.d.ts +1 -0
  59. package/libs/api/repository/src/lib/gn4/settings/gn4-settings.service.d.ts.map +1 -1
  60. package/libs/common/domain/src/lib/model/record/metadata.model.d.ts +20 -17
  61. package/libs/common/domain/src/lib/model/record/metadata.model.d.ts.map +1 -1
  62. package/libs/common/domain/src/lib/repository/records-repository.interface.d.ts +4 -0
  63. package/libs/common/domain/src/lib/repository/records-repository.interface.d.ts.map +1 -1
  64. package/libs/feature/editor/src/lib/components/multilingual-panel/multilingual-panel.component.d.ts +48 -3
  65. package/libs/feature/editor/src/lib/components/multilingual-panel/multilingual-panel.component.d.ts.map +1 -1
  66. package/libs/feature/record/src/lib/map-view/map-view.component.d.ts +13 -5
  67. package/libs/feature/record/src/lib/map-view/map-view.component.d.ts.map +1 -1
  68. package/libs/feature/search/src/lib/constants.d.ts.map +1 -1
  69. package/libs/feature/search/src/lib/fuzzy-search/fuzzy-search.component.d.ts +2 -1
  70. package/libs/feature/search/src/lib/fuzzy-search/fuzzy-search.component.d.ts.map +1 -1
  71. package/libs/feature/search/src/lib/results-table/results-table-container.component.d.ts +6 -5
  72. package/libs/feature/search/src/lib/results-table/results-table-container.component.d.ts.map +1 -1
  73. package/libs/ui/elements/src/lib/internal-link-card/internal-link-card.component.d.ts +3 -6
  74. package/libs/ui/elements/src/lib/internal-link-card/internal-link-card.component.d.ts.map +1 -1
  75. package/libs/ui/elements/src/lib/internal-link-card-contact/internal-link-card-contact.component.d.ts +14 -0
  76. package/libs/ui/elements/src/lib/internal-link-card-contact/internal-link-card-contact.component.d.ts.map +1 -0
  77. package/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.d.ts +3 -0
  78. package/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.d.ts.map +1 -1
  79. package/libs/ui/elements/src/lib/metadata-quality-item/metadata-quality-item.component.d.ts.map +1 -1
  80. package/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.d.ts +20 -9
  81. package/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.d.ts.map +1 -1
  82. package/libs/ui/elements/src/lib/ui-elements.module.d.ts +2 -1
  83. package/libs/ui/elements/src/lib/ui-elements.module.d.ts.map +1 -1
  84. package/libs/ui/layout/src/index.d.ts +1 -0
  85. package/libs/ui/layout/src/index.d.ts.map +1 -1
  86. package/libs/ui/layout/src/lib/cell-popin/cell-popin.component.d.ts +28 -0
  87. package/libs/ui/layout/src/lib/cell-popin/cell-popin.component.d.ts.map +1 -0
  88. package/libs/ui/layout/src/lib/interactive-table/interactive-table.component.d.ts +4 -2
  89. package/libs/ui/layout/src/lib/interactive-table/interactive-table.component.d.ts.map +1 -1
  90. package/libs/ui/layout/src/lib/truncated-text/truncated-text.component.d.ts +5 -10
  91. package/libs/ui/layout/src/lib/truncated-text/truncated-text.component.d.ts.map +1 -1
  92. package/libs/ui/search/src/index.d.ts +1 -0
  93. package/libs/ui/search/src/index.d.ts.map +1 -1
  94. package/libs/ui/search/src/lib/results-table/action-menu/action-menu.component.d.ts +4 -3
  95. package/libs/ui/search/src/lib/results-table/action-menu/action-menu.component.d.ts.map +1 -1
  96. package/libs/ui/search/src/lib/results-table/results-table.component.d.ts +10 -4
  97. package/libs/ui/search/src/lib/results-table/results-table.component.d.ts.map +1 -1
  98. package/libs/ui/search/src/lib/ui-search.module.d.ts +2 -1
  99. package/libs/ui/search/src/lib/ui-search.module.d.ts.map +1 -1
  100. package/libs/util/i18n/src/lib/i18n.constants.d.ts +1 -0
  101. package/libs/util/i18n/src/lib/i18n.constants.d.ts.map +1 -1
  102. package/libs/util/i18n/src/lib/language-codes.d.ts +23 -1
  103. package/libs/util/i18n/src/lib/language-codes.d.ts.map +1 -1
  104. package/package.json +1 -1
  105. package/src/libs/api/metadata-converter/src/lib/fixtures/geocat-ch.records.ts +1 -1
  106. package/src/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.ts +18 -1
  107. package/src/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.ts +0 -1
  108. package/src/libs/api/metadata-converter/src/lib/iso19115-3/read-parts.ts +13 -3
  109. package/src/libs/api/metadata-converter/src/lib/iso19115-3/write-parts.ts +5 -1
  110. package/src/libs/api/metadata-converter/src/lib/iso19139/read-parts.ts +6 -3
  111. package/src/libs/api/metadata-converter/src/lib/iso19139/write-parts.ts +4 -1
  112. package/src/libs/api/repository/src/lib/gn4/elasticsearch/constant.ts +1 -0
  113. package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +70 -13
  114. package/src/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts +11 -0
  115. package/src/libs/api/repository/src/lib/gn4/settings/gn4-settings.service.ts +3 -0
  116. package/src/libs/common/domain/src/lib/model/record/metadata.model.ts +20 -14
  117. package/src/libs/common/domain/src/lib/repository/records-repository.interface.ts +4 -0
  118. package/src/libs/common/fixtures/src/lib/records.fixtures.ts +63 -0
  119. package/src/libs/feature/editor/src/lib/components/multilingual-panel/multilingual-panel.component.html +117 -11
  120. package/src/libs/feature/editor/src/lib/components/multilingual-panel/multilingual-panel.component.ts +316 -6
  121. package/src/libs/feature/record/src/lib/map-view/map-view.component.html +27 -9
  122. package/src/libs/feature/record/src/lib/map-view/map-view.component.ts +84 -27
  123. package/src/libs/feature/search/src/lib/constants.ts +2 -1
  124. package/src/libs/feature/search/src/lib/fuzzy-search/fuzzy-search.component.html +1 -1
  125. package/src/libs/feature/search/src/lib/fuzzy-search/fuzzy-search.component.ts +1 -0
  126. package/src/libs/feature/search/src/lib/results-table/results-table-container.component.html +1 -0
  127. package/src/libs/feature/search/src/lib/results-table/results-table-container.component.ts +13 -3
  128. package/src/libs/ui/elements/src/lib/internal-link-card/internal-link-card.component.html +7 -75
  129. package/src/libs/ui/elements/src/lib/internal-link-card/internal-link-card.component.ts +20 -51
  130. package/src/libs/ui/elements/src/lib/internal-link-card-contact/internal-link-card-contact.component.html +69 -0
  131. package/src/libs/ui/elements/src/lib/internal-link-card-contact/internal-link-card-contact.component.ts +61 -0
  132. package/src/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.ts +48 -9
  133. package/src/libs/ui/elements/src/lib/metadata-quality-item/metadata-quality-item.component.ts +4 -0
  134. package/src/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.html +96 -37
  135. package/src/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.ts +60 -29
  136. package/src/libs/ui/elements/src/lib/ui-elements.module.ts +2 -0
  137. package/src/libs/ui/layout/src/index.ts +1 -0
  138. package/src/libs/ui/layout/src/lib/cell-popin/cell-popin.component.html +40 -0
  139. package/src/libs/ui/layout/src/lib/cell-popin/cell-popin.component.ts +141 -0
  140. package/src/libs/ui/layout/src/lib/interactive-table/interactive-table.component.html +3 -2
  141. package/src/libs/ui/layout/src/lib/interactive-table/interactive-table.component.ts +13 -6
  142. package/src/libs/ui/layout/src/lib/truncated-text/truncated-text.component.html +25 -42
  143. package/src/libs/ui/layout/src/lib/truncated-text/truncated-text.component.ts +10 -49
  144. package/src/libs/ui/layout/src/lib/ui-layout.module.ts +1 -1
  145. package/src/libs/ui/search/src/index.ts +1 -0
  146. package/src/libs/ui/search/src/lib/results-table/action-menu/action-menu.component.html +16 -6
  147. package/src/libs/ui/search/src/lib/results-table/action-menu/action-menu.component.ts +15 -11
  148. package/src/libs/ui/search/src/lib/results-table/results-table.component.css +4 -0
  149. package/src/libs/ui/search/src/lib/results-table/results-table.component.html +31 -27
  150. package/src/libs/ui/search/src/lib/results-table/results-table.component.ts +33 -15
  151. package/src/libs/ui/search/src/lib/ui-search.module.ts +3 -0
  152. package/src/libs/util/i18n/src/lib/i18n.constants.ts +42 -0
  153. package/src/libs/util/i18n/src/lib/language-codes.ts +23 -1
  154. package/tailwind.base.css +1 -1
  155. package/translations/de.json +42 -6
  156. package/translations/en.json +42 -6
  157. package/translations/es.json +41 -5
  158. package/translations/fr.json +42 -6
  159. package/translations/it.json +41 -5
  160. package/translations/nl.json +41 -5
  161. package/translations/pt.json +41 -5
  162. package/translations/sk.json +41 -5
@@ -1,15 +1,325 @@
1
- import { Component } from '@angular/core'
1
+ import {
2
+ ChangeDetectorRef,
3
+ Component,
4
+ ElementRef,
5
+ Input,
6
+ OnDestroy,
7
+ QueryList,
8
+ ViewChildren,
9
+ ViewContainerRef,
10
+ } from '@angular/core'
2
11
  import { CommonModule } from '@angular/common'
3
- import { CheckToggleComponent } from '../../../../../../../libs/ui/inputs/src'
4
- import { TranslateModule } from '@ngx-translate/core'
12
+ import { ButtonComponent, CheckToggleComponent } from '../../../../../../../libs/ui/inputs/src'
13
+ import { TranslateModule, TranslateService } from '@ngx-translate/core'
14
+ import { CatalogRecord } from '../../../../../../../libs/common/domain/src/lib/model/record'
15
+ import {
16
+ NgIconComponent,
17
+ provideIcons,
18
+ provideNgIconsConfig,
19
+ } from '@ng-icons/core'
20
+ import {
21
+ iconoirCheckCircle,
22
+ iconoirCircle,
23
+ iconoirSettings,
24
+ } from '@ng-icons/iconoir'
25
+ import { matMoreHorizOutline } from '@ng-icons/material-icons/outline'
26
+ import { EditorFacade } from '../../+state/editor.facade'
27
+ import { ConfirmationDialogComponent } from '../../../../../../../libs/ui/elements/src'
28
+ import { MatDialog } from '@angular/material/dialog'
29
+ import { RecordsRepositoryInterface } from '../../../../../../../libs/common/domain/src/lib/repository/records-repository.interface'
30
+ import { map, Subscription } from 'rxjs'
31
+ import { Overlay, OverlayRef } from '@angular/cdk/overlay'
32
+ import { TemplatePortal } from '@angular/cdk/portal'
33
+ import { ActionMenuComponent } from '../../../../../../../libs/ui/search/src'
34
+
35
+ const extraFlagMap: { [key: string]: string } = {
36
+ ar: 'arab',
37
+ en: 'gb',
38
+ ko: 'kr',
39
+ cs: 'cz',
40
+ zh: 'cn',
41
+ ca: 'es-ct',
42
+ rm: 'ch',
43
+ da: 'dk',
44
+ sv: 'se',
45
+ cy: 'gb-wls',
46
+ hy: 'am',
47
+ ka: 'ge',
48
+ uk: 'ua',
49
+ }
5
50
 
6
51
  @Component({
7
52
  selector: 'gn-ui-multilingual-panel',
8
53
  standalone: true,
9
- imports: [CommonModule, CheckToggleComponent, TranslateModule],
54
+ imports: [
55
+ CommonModule,
56
+ CheckToggleComponent,
57
+ TranslateModule,
58
+ ButtonComponent,
59
+ NgIconComponent,
60
+ ActionMenuComponent,
61
+ ],
62
+ providers: [
63
+ provideIcons({
64
+ iconoirSettings,
65
+ matMoreHorizOutline,
66
+ iconoirCheckCircle,
67
+ iconoirCircle,
68
+ }),
69
+ provideNgIconsConfig({
70
+ size: '1.25em',
71
+ }),
72
+ ],
10
73
  templateUrl: './multilingual-panel.component.html',
11
74
  styleUrl: './multilingual-panel.component.css',
12
75
  })
13
- export class MultilingualPanelComponent {
14
- translationsEnabled = false
76
+ export class MultilingualPanelComponent implements OnDestroy {
77
+ isMultilingual: boolean
78
+ _record: CatalogRecord
79
+ editTranslations: boolean
80
+ selectedLanguages = []
81
+ recordLanguages = []
82
+ formLanguage = ''
83
+ @Input() set record(value: CatalogRecord) {
84
+ this._record = value
85
+ this.isMultilingual = value.otherLanguages.length > 0
86
+ this.editTranslations = false
87
+ this.recordLanguages = [...value.otherLanguages, value.defaultLanguage]
88
+ this.selectedLanguages = this.recordLanguages
89
+ this.formLanguage = value.defaultLanguage
90
+ }
91
+ @ViewChildren('actionMenuButton', { read: ElementRef })
92
+ actionMenuButtons!: QueryList<ElementRef>
93
+ private overlayRef!: OverlayRef
94
+
95
+ isActionMenuOpen = false
96
+ subscription = new Subscription()
97
+
98
+ supportedLanguages$ = this.recordsRepository
99
+ .getApplicationLanguages()
100
+ .pipe(map((languages) => this.sortLanguages(languages)))
101
+
102
+ constructor(
103
+ public facade: EditorFacade,
104
+ public dialog: MatDialog,
105
+ private translateService: TranslateService,
106
+ private recordsRepository: RecordsRepositoryInterface,
107
+ private overlay: Overlay,
108
+ private viewContainerRef: ViewContainerRef,
109
+ private cdr: ChangeDetectorRef
110
+ ) {}
111
+
112
+ ngOnDestroy() {
113
+ this.subscription.unsubscribe()
114
+ }
115
+
116
+ sortLanguages(languages: string[]) {
117
+ return languages
118
+ .map((lang) => {
119
+ const label = this.translateService.instant('language.' + lang)
120
+ const isTranslated = label !== 'language.' + lang
121
+
122
+ return {
123
+ lang,
124
+ label,
125
+ isTranslated,
126
+ }
127
+ })
128
+ .sort((a, b) => {
129
+ if (a.isTranslated && !b.isTranslated) return -1
130
+ if (!a.isTranslated && b.isTranslated) return 1
131
+
132
+ return a.label.localeCompare(b.label)
133
+ })
134
+ .map((item) => item.lang)
135
+ }
136
+
137
+ toggleLanguageSelection() {
138
+ this.editTranslations = !this.editTranslations
139
+ }
140
+
141
+ getIconClass(lang: string) {
142
+ return extraFlagMap[lang]
143
+ ? `fi fi-${extraFlagMap[lang]} w-4 h-3`
144
+ : `fi fi-${lang} w-4 h-3`
145
+ }
146
+
147
+ switchMultilingual() {
148
+ if (this.isMultilingual && this.selectedLanguages.length > 1) {
149
+ this.confirmDeleteAction()
150
+ } else {
151
+ this.isMultilingual = true
152
+ this.editTranslations = true
153
+ }
154
+ }
155
+
156
+ getExtraClass(lang: string) {
157
+ const baseClass = 'h-[34px] w-full font-bold justify-start hover:bg-white'
158
+ if (this.selectedLanguages.includes(lang)) {
159
+ return `${baseClass} bg-white border border-black`
160
+ }
161
+ return baseClass
162
+ }
163
+
164
+ toggleLanguage(lang: string) {
165
+ if (this.selectedLanguages.includes(lang)) {
166
+ this.removeSelectedLanguage(lang)
167
+ } else {
168
+ this.selectedLanguages.push(lang)
169
+ }
170
+ }
171
+
172
+ removeSelectedLanguage(lang: string) {
173
+ this.selectedLanguages = this.selectedLanguages.filter(
174
+ (language) => language !== lang
175
+ )
176
+ }
177
+
178
+ validateTranslations() {
179
+ const equalLength =
180
+ this.selectedLanguages.length === this.recordLanguages.length
181
+ if (
182
+ this.selectedLanguages.length < this.recordLanguages.length ||
183
+ (equalLength && this.selectedLanguages !== this.recordLanguages)
184
+ ) {
185
+ this.confirmDeleteAction(this.selectedLanguages)
186
+ } else {
187
+ this.updateTranslations()
188
+ }
189
+ }
190
+
191
+ updateTranslations() {
192
+ this.facade.updateRecordField(
193
+ 'otherLanguages',
194
+ this.selectedLanguages.filter((lang) => lang !== this.formLanguage)
195
+ )
196
+ this.recordLanguages = this.selectedLanguages
197
+ this.editTranslations = false
198
+ }
199
+
200
+ switchFormLang(lang) {
201
+ // TO IMPLEMENT FURTHER
202
+ }
203
+
204
+ switchDefaultLang(lang: string) {
205
+ this.formLanguage = lang
206
+ this.facade.updateRecordField('defaultLanguage', lang)
207
+ this.facade.updateRecordField(
208
+ 'otherLanguages',
209
+ this.selectedLanguages.filter((lang) => lang !== this.formLanguage)
210
+ )
211
+ this.closeActionMenu()
212
+ }
213
+
214
+ confirmDeleteAction(lang?: string[] | string) {
215
+ const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
216
+ data: {
217
+ title: this.translateService.instant(
218
+ 'editor.record.multilingual.confirmation.title'
219
+ ),
220
+ message: this.translateService.instant(
221
+ 'editor.record.multilingual.confirmation.message'
222
+ ),
223
+ confirmText: this.translateService.instant(
224
+ 'editor.record.multilingual.confirmation.confirmText'
225
+ ),
226
+ cancelText: this.translateService.instant(
227
+ 'editor.record.multilingual.confirmation.cancelText'
228
+ ),
229
+ },
230
+ restoreFocus: true,
231
+ })
232
+ this.subscription.add(
233
+ dialogRef.afterClosed().subscribe((confirmed) => {
234
+ if (confirmed) {
235
+ if (lang) {
236
+ if (!Array.isArray(lang)) {
237
+ this.removeSelectedLanguage(lang)
238
+ this.closeActionMenu()
239
+ }
240
+ this.updateTranslations()
241
+ } else {
242
+ this.facade.updateRecordField('otherLanguages', [])
243
+ this.isMultilingual = false
244
+ this.selectedLanguages = []
245
+ }
246
+ } else {
247
+ this.isMultilingual = true
248
+ this.selectedLanguages = this.recordLanguages
249
+ }
250
+ this.editTranslations = false
251
+ })
252
+ )
253
+ }
254
+
255
+ isFirstUnsupported(index: number): boolean {
256
+ const langs = this.sortLanguages(this.recordLanguages)
257
+ return (
258
+ langs[index].length === 3 &&
259
+ langs.slice(0, index).every((lang) => lang.length !== 3)
260
+ )
261
+ }
262
+
263
+ isLangSupported(lang: string) {
264
+ return lang.length === 2
265
+ }
266
+
267
+ getToggleTitle(lang: string) {
268
+ if (lang === this._record.defaultLanguage) {
269
+ return this.translateService.instant(
270
+ 'editor.record.form.multilingual.forbidden'
271
+ )
272
+ }
273
+ return ''
274
+ }
275
+
276
+ openActionMenu(item: string, template) {
277
+ this.isActionMenuOpen = true
278
+ const index = this.sortLanguages(this.selectedLanguages).indexOf(item)
279
+ const buttonElement = this.actionMenuButtons.toArray()[index]
280
+
281
+ const positionStrategy = this.overlay
282
+ .position()
283
+ .flexibleConnectedTo(buttonElement)
284
+ .withFlexibleDimensions(true)
285
+ .withPush(true)
286
+ .withPositions([
287
+ {
288
+ originX: 'end',
289
+ originY: 'bottom',
290
+ overlayX: 'end',
291
+ overlayY: 'top',
292
+ },
293
+ {
294
+ originX: 'end',
295
+ originY: 'top',
296
+ overlayX: 'end',
297
+ overlayY: 'bottom',
298
+ },
299
+ ])
300
+
301
+ this.overlayRef = this.overlay.create({
302
+ hasBackdrop: true,
303
+ backdropClass: 'cdk-overlay-transparent-backdrop',
304
+ positionStrategy: positionStrategy,
305
+ scrollStrategy: this.overlay.scrollStrategies.reposition(),
306
+ })
307
+
308
+ const portal = new TemplatePortal(template, this.viewContainerRef)
309
+
310
+ this.overlayRef.attach(portal)
311
+ this.subscription.add(
312
+ this.overlayRef.backdropClick().subscribe(() => {
313
+ this.closeActionMenu()
314
+ })
315
+ )
316
+ }
317
+
318
+ closeActionMenu() {
319
+ if (this.overlayRef) {
320
+ this.isActionMenuOpen = false
321
+ this.overlayRef.dispose()
322
+ this.cdr.markForCheck()
323
+ }
324
+ }
15
325
  }
@@ -1,18 +1,36 @@
1
1
  <div class="w-full h-full flex flex-col gap-[13px]">
2
2
  <div
3
- class="flex py-4 px-5 bg-white border border-color-border rounded-lg mt-6"
3
+ class="flex flex-col md:flex-row gap-4 py-4 px-5 bg-white border border-color-border rounded-lg mt-6"
4
4
  >
5
- <div class="grow min-w-0">
5
+ <gn-ui-dropdown-selector
6
+ *ngIf="displaySource"
7
+ class="w-full md:flex-1 md:min-w-0"
8
+ extraBtnClass="font-sans font-bold"
9
+ [title]="'map.select.layer' | translate"
10
+ [choices]="dropdownChoices$ | async"
11
+ (selectValue)="selectLinkToDisplay($event)"
12
+ ></gn-ui-dropdown-selector>
13
+
14
+ <ng-container *ngIf="(styleLinks$ | async)?.length > 0; else styleDisabled">
6
15
  <gn-ui-dropdown-selector
7
- [ngClass]="{ hidden: !displaySource }"
8
- class="w-full"
16
+ class="w-full md:flex-1 md:min-w-0"
9
17
  extraBtnClass="font-sans font-bold"
10
- [title]="'map.select.layer' | translate"
11
- [choices]="dropdownChoices$ | async"
12
- (selectValue)="selectLinkToDisplay($event)"
18
+ [title]="'map.select.style' | translate"
19
+ [choices]="styleDropdownChoices$ | async"
20
+ (selectValue)="selectStyleToDisplay($event)"
13
21
  ></gn-ui-dropdown-selector>
14
- </div>
15
- <div class="self-end">
22
+ </ng-container>
23
+ <ng-template #styleDisabled>
24
+ <gn-ui-dropdown-selector
25
+ class="w-full md:flex-1 md:min-w-0 text-gray-400"
26
+ extraBtnClass="font-sans font-bold text-gray-400"
27
+ [title]="'map.select.style' | translate"
28
+ [choices]="styleDropdownChoices$ | async"
29
+ [disabled]="true"
30
+ ></gn-ui-dropdown-selector>
31
+ </ng-template>
32
+
33
+ <div class="self-end md:ml-2">
16
34
  <gn-ui-external-viewer-button
17
35
  extraClass="w-[44px] h-[44px]"
18
36
  [link]="selectedLink$ | async"
@@ -29,7 +29,10 @@ import {
29
29
  } from 'rxjs/operators'
30
30
  import { MdViewFacade } from '../state/mdview.facade'
31
31
  import { DataService } from '../../../../../../libs/feature/dataviz/src'
32
- import { DatasetOnlineResource } from '../../../../../../libs/common/domain/src/lib/model/record'
32
+ import {
33
+ DatasetOnlineResource,
34
+ DatasetServiceDistribution,
35
+ } from '../../../../../../libs/common/domain/src/lib/model/record'
33
36
  import {
34
37
  createViewFromLayer,
35
38
  MapContext,
@@ -62,6 +65,7 @@ import { FetchError } from '../../../../../../libs/util/data-fetcher/src'
62
65
  marker('map.dropdown.placeholder')
63
66
  marker('wfs.feature.limit')
64
67
  marker('dataset.error.restrictedAccess')
68
+ marker('map.select.style')
65
69
 
66
70
  @Component({
67
71
  selector: 'gn-ui-map-view',
@@ -96,32 +100,32 @@ export class MapViewComponent implements AfterViewInit {
96
100
  selection: Feature
97
101
  showLegend = true
98
102
  legendExists = false
103
+ loading = false
104
+ error = null
105
+
106
+ selectLinkToDisplay(i: number) {
107
+ this.selectedLinkIndex$.next(i)
108
+ }
109
+
110
+ selectStyleToDisplay(i: number) {
111
+ this.selectedStyleIndex$.next(i)
112
+ }
99
113
 
100
114
  toggleLegend() {
101
115
  this.showLegend = !this.showLegend
102
116
  }
103
-
104
- onLegendStatusChange(status: boolean) {
105
- this.legendExists = status
117
+ onLegendStatusChange(v: boolean) {
118
+ this.legendExists = v
106
119
  }
107
120
 
108
121
  compatibleMapLinks$ = combineLatest([
109
122
  this.mdViewFacade.mapApiLinks$,
110
123
  this.mdViewFacade.geoDataLinksWithGeometry$,
111
124
  ]).pipe(
112
- switchMap(async ([mapApiLinks, geoDataLinksWithGeometry]) => {
113
- // looking for TMS links to process
114
- let processedMapApiLinks = await Promise.all(
115
- mapApiLinks.map((link) => {
116
- if (link.type === 'service' && link.accessServiceProtocol === 'tms') {
117
- return this.dataService.getGeodataLinksFromTms(link)
118
- }
119
- return link
120
- })
121
- )
122
- processedMapApiLinks = processedMapApiLinks.flat()
123
- return [...processedMapApiLinks, ...geoDataLinksWithGeometry]
124
- }),
125
+ map(([mapApiLinks, geoDataLinksWithGeometry]) => [
126
+ ...mapApiLinks,
127
+ ...geoDataLinksWithGeometry,
128
+ ]),
125
129
  shareReplay(1)
126
130
  )
127
131
 
@@ -135,15 +139,73 @@ export class MapViewComponent implements AfterViewInit {
135
139
  : [{ label: 'map.dropdown.placeholder', value: 0 }]
136
140
  )
137
141
  )
138
- selectedLinkIndex$ = new BehaviorSubject(0)
139
142
 
140
- loading = false
141
- error = null
143
+ private selectedLinkIndex$ = new BehaviorSubject(0)
144
+ private selectedStyleIndex$ = new BehaviorSubject(0)
142
145
 
143
- selectedLink$ = combineLatest([
146
+ selectedSourceLink$ = combineLatest([
144
147
  this.compatibleMapLinks$,
145
148
  this.selectedLinkIndex$.pipe(distinctUntilChanged()),
146
- ]).pipe(map(([links, index]) => links[index]))
149
+ ]).pipe(
150
+ map(([links, idx]) => links[idx]),
151
+ shareReplay(1)
152
+ )
153
+
154
+ styleLinks$ = this.selectedSourceLink$.pipe(
155
+ switchMap((src) => {
156
+ if (
157
+ src &&
158
+ src.type === 'service' &&
159
+ src.accessServiceProtocol === 'tms'
160
+ ) {
161
+ return from(
162
+ this.dataService.getGeodataLinksFromTms(
163
+ src as DatasetServiceDistribution,
164
+ false
165
+ )
166
+ ).pipe(
167
+ // We need to check for maplibre-style links because when a TMS service has no styles,
168
+ // getGeodataLinksFromTms returns the original TMS link, which isn't a maplibre-style link
169
+ map(
170
+ (links) =>
171
+ links?.filter(
172
+ (link) =>
173
+ link.type === 'service' &&
174
+ link.accessServiceProtocol === 'maplibre-style'
175
+ ) || []
176
+ )
177
+ )
178
+ }
179
+ return of([])
180
+ }),
181
+ tap(() => this.selectedStyleIndex$.next(0)),
182
+ shareReplay(1)
183
+ )
184
+
185
+ styleDropdownChoices$ = this.styleLinks$.pipe(
186
+ map((links) =>
187
+ links.length
188
+ ? links.map((link, index) => ({
189
+ label: getLinkLabel(link),
190
+ value: index,
191
+ }))
192
+ : [
193
+ {
194
+ label: '\u00A0\u00A0\u00A0\u00A0',
195
+ value: 0,
196
+ },
197
+ ]
198
+ )
199
+ )
200
+
201
+ selectedLink$ = combineLatest([
202
+ this.selectedSourceLink$,
203
+ this.styleLinks$,
204
+ this.selectedStyleIndex$.pipe(distinctUntilChanged()),
205
+ ]).pipe(
206
+ map(([src, styles, styleIdx]) => (styles.length ? styles[styleIdx] : src)),
207
+ shareReplay(1)
208
+ )
147
209
 
148
210
  currentLayers$ = combineLatest([this.selectedLink$, this.excludeWfs$]).pipe(
149
211
  switchMap(([link, excludeWfs]) => {
@@ -296,11 +358,6 @@ export class MapViewComponent implements AfterViewInit {
296
358
  }
297
359
  return throwError(() => 'protocol not supported')
298
360
  }
299
-
300
- selectLinkToDisplay(link: number) {
301
- this.selectedLinkIndex$.next(link)
302
- }
303
-
304
361
  handleError(error: FetchError | Error | string) {
305
362
  if (error instanceof FetchError) {
306
363
  this.error = this.translateService.instant(
@@ -20,9 +20,10 @@ export const FIELDS_SUMMARY: FieldName[] = [
20
20
  'userSavedCount',
21
21
  'cl_topic',
22
22
  'cl_maintenanceAndUpdateFrequency',
23
- 'MD_LegalConstraintsUseLimitationObject',
23
+ 'MD_LegalConstraints*Object',
24
24
  'qualityScore',
25
25
  'allKeywords',
26
+ 'recordLink',
26
27
  ]
27
28
 
28
29
  export const FIELDS_BRIEF: FieldName[] = [
@@ -1,5 +1,5 @@
1
1
  <gn-ui-autocomplete
2
- [placeholder]="'search.field.any.placeholder' | translate"
2
+ [placeholder]="placeholder ?? ('search.field.any.placeholder' | translate)"
3
3
  [displayWithFn]="displayWithFn"
4
4
  [action]="autoCompleteAction"
5
5
  (itemSelected)="handleItemSelection($event)"
@@ -30,6 +30,7 @@ export class FuzzySearchComponent implements OnInit {
30
30
  @Input() autoFocus = false
31
31
  @Input() forceTrackPosition = false
32
32
  @Input() enterButton = false
33
+ @Input() placeholder?: string
33
34
  @Output() itemSelected = new EventEmitter<CatalogRecord>()
34
35
  @Output() inputSubmitted = new EventEmitter<string>()
35
36
  @Output() isSearchActive = new EventEmitter<boolean>()
@@ -7,6 +7,7 @@
7
7
  [canDelete]="canDelete"
8
8
  [canDuplicate]="canDuplicate"
9
9
  [isDuplicating]="isDuplicating"
10
+ [canEdit]="canEdit"
10
11
  (recordClick)="handleRecordClick($event)"
11
12
  (duplicateRecord)="handleDuplicateRecord($event)"
12
13
  (deleteRecord)="handleDeleteRecord($event)"
@@ -12,7 +12,7 @@ import { SearchService } from '../utils/service/search.service'
12
12
  import { RecordsRepositoryInterface } from '../../../../../../libs/common/domain/src/lib/repository/records-repository.interface'
13
13
  import { ResultsTableComponent } from '../../../../../../libs/ui/search/src'
14
14
  import { CommonModule } from '@angular/common'
15
- import { Subscription } from 'rxjs'
15
+ import { Observable, Subscription } from 'rxjs'
16
16
  import { NotificationsService } from '../../../../../../libs/feature/notifications/src'
17
17
  import { TranslateService } from '@ngx-translate/core'
18
18
 
@@ -24,8 +24,6 @@ import { TranslateService } from '@ngx-translate/core'
24
24
  imports: [CommonModule, ResultsTableComponent],
25
25
  })
26
26
  export class ResultsTableContainerComponent implements OnDestroy {
27
- @Input() canDuplicate: (record: CatalogRecord) => boolean = () => true
28
- @Input() canDelete: (record: CatalogRecord) => boolean = () => true
29
27
  @Input() isDuplicating: false
30
28
 
31
29
  @Output() recordClick = new EventEmitter<CatalogRecord>()
@@ -39,6 +37,18 @@ export class ResultsTableContainerComponent implements OnDestroy {
39
37
  hasDraft = (record: CatalogRecord): boolean =>
40
38
  this.recordsRepository.recordHasDraft(record.uniqueIdentifier)
41
39
 
40
+ canDuplicate = (record: CatalogRecord): boolean => {
41
+ return this.recordsRepository.canDuplicate(record)
42
+ }
43
+
44
+ canDelete = (record: CatalogRecord): Observable<boolean> => {
45
+ return this.recordsRepository.canDelete(record)
46
+ }
47
+
48
+ canEdit = (record: CatalogRecord): Observable<boolean> => {
49
+ return this.recordsRepository.canEditIndexedRecord(record)
50
+ }
51
+
42
52
  constructor(
43
53
  protected searchFacade: SearchFacade,
44
54
  private searchService: SearchService,