geonetwork-ui 2.6.0-dev.9d3ad45e2 → 2.6.0-dev.a0bd52a21

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 (183) hide show
  1. package/esm2022/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.mjs +39 -4
  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/elasticsearch/elasticsearch.service.mjs +3 -3
  9. package/esm2022/libs/api/repository/src/lib/gn4/gn4-repository.mjs +75 -15
  10. package/esm2022/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.mjs +7 -1
  11. package/esm2022/libs/api/repository/src/lib/gn4/settings/gn4-settings.service.mjs +2 -1
  12. package/esm2022/libs/common/domain/src/lib/model/record/metadata.model.mjs +1 -1
  13. package/esm2022/libs/common/domain/src/lib/repository/records-repository.interface.mjs +1 -1
  14. package/esm2022/libs/feature/editor/src/lib/components/multilingual-panel/multilingual-panel.component.mjs +266 -11
  15. package/esm2022/libs/feature/map/src/lib/add-layer-from-catalog/add-layer-from-catalog.component.mjs +1 -1
  16. package/esm2022/libs/feature/record/src/lib/state/mdview.actions.mjs +3 -1
  17. package/esm2022/libs/feature/record/src/lib/state/mdview.effects.mjs +7 -1
  18. package/esm2022/libs/feature/record/src/lib/state/mdview.facade.mjs +3 -1
  19. package/esm2022/libs/feature/record/src/lib/state/mdview.reducer.mjs +7 -1
  20. package/esm2022/libs/feature/record/src/lib/state/mdview.selectors.mjs +3 -1
  21. package/esm2022/libs/feature/search/src/lib/constants.mjs +3 -2
  22. package/esm2022/libs/feature/search/src/lib/fuzzy-search/fuzzy-search.component.mjs +5 -3
  23. package/esm2022/libs/feature/search/src/lib/results-table/results-table-container.component.mjs +13 -10
  24. package/esm2022/libs/ui/elements/src/lib/internal-link-card/internal-link-card.component.mjs +19 -34
  25. package/esm2022/libs/ui/elements/src/lib/internal-link-card-contact/internal-link-card-contact.component.mjs +59 -0
  26. package/esm2022/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.mjs +35 -10
  27. package/esm2022/libs/ui/elements/src/lib/metadata-quality-item/metadata-quality-item.component.mjs +5 -1
  28. package/esm2022/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.mjs +50 -29
  29. package/esm2022/libs/ui/elements/src/lib/ui-elements.module.mjs +7 -3
  30. package/esm2022/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.mjs +3 -3
  31. package/esm2022/libs/ui/layout/src/index.mjs +2 -1
  32. package/esm2022/libs/ui/layout/src/lib/cell-popin/cell-popin.component.mjs +110 -0
  33. package/esm2022/libs/ui/layout/src/lib/interactive-table/interactive-table.component.mjs +20 -10
  34. package/esm2022/libs/ui/layout/src/lib/truncated-text/truncated-text.component.mjs +15 -49
  35. package/esm2022/libs/ui/layout/src/lib/ui-layout.module.mjs +2 -2
  36. package/esm2022/libs/ui/search/src/index.mjs +2 -1
  37. package/esm2022/libs/ui/search/src/lib/results-table/action-menu/action-menu.component.mjs +21 -12
  38. package/esm2022/libs/ui/search/src/lib/results-table/results-table.component.mjs +39 -18
  39. package/esm2022/libs/ui/search/src/lib/ui-search.module.mjs +10 -4
  40. package/esm2022/libs/util/i18n/src/lib/i18n.constants.mjs +42 -1
  41. package/esm2022/libs/util/i18n/src/lib/language-codes.mjs +24 -2
  42. package/esm2022/translations/de.json +41 -6
  43. package/esm2022/translations/en.json +41 -6
  44. package/esm2022/translations/es.json +40 -5
  45. package/esm2022/translations/fr.json +41 -6
  46. package/esm2022/translations/it.json +40 -5
  47. package/esm2022/translations/nl.json +40 -5
  48. package/esm2022/translations/pt.json +40 -5
  49. package/fesm2022/geonetwork-ui.mjs +1591 -719
  50. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  51. package/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.d.ts.map +1 -1
  52. package/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.d.ts +0 -1
  53. package/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.d.ts.map +1 -1
  54. package/libs/api/metadata-converter/src/lib/iso19115-3/read-parts.d.ts +1 -0
  55. package/libs/api/metadata-converter/src/lib/iso19115-3/read-parts.d.ts.map +1 -1
  56. package/libs/api/metadata-converter/src/lib/iso19115-3/write-parts.d.ts.map +1 -1
  57. package/libs/api/metadata-converter/src/lib/iso19139/read-parts.d.ts.map +1 -1
  58. package/libs/api/metadata-converter/src/lib/iso19139/write-parts.d.ts.map +1 -1
  59. package/libs/api/repository/src/lib/gn4/elasticsearch/constant.d.ts.map +1 -1
  60. package/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.d.ts +1 -1
  61. package/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.d.ts.map +1 -1
  62. package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts +13 -2
  63. package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts.map +1 -1
  64. package/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.d.ts +2 -0
  65. package/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.d.ts.map +1 -1
  66. package/libs/api/repository/src/lib/gn4/settings/gn4-settings.service.d.ts +1 -0
  67. package/libs/api/repository/src/lib/gn4/settings/gn4-settings.service.d.ts.map +1 -1
  68. package/libs/common/domain/src/lib/model/record/metadata.model.d.ts +20 -17
  69. package/libs/common/domain/src/lib/model/record/metadata.model.d.ts.map +1 -1
  70. package/libs/common/domain/src/lib/repository/records-repository.interface.d.ts +6 -0
  71. package/libs/common/domain/src/lib/repository/records-repository.interface.d.ts.map +1 -1
  72. package/libs/feature/editor/src/lib/components/multilingual-panel/multilingual-panel.component.d.ts +48 -3
  73. package/libs/feature/editor/src/lib/components/multilingual-panel/multilingual-panel.component.d.ts.map +1 -1
  74. package/libs/feature/record/src/lib/state/mdview.actions.d.ts +10 -0
  75. package/libs/feature/record/src/lib/state/mdview.actions.d.ts.map +1 -1
  76. package/libs/feature/record/src/lib/state/mdview.effects.d.ts +6 -0
  77. package/libs/feature/record/src/lib/state/mdview.effects.d.ts.map +1 -1
  78. package/libs/feature/record/src/lib/state/mdview.facade.d.ts +2 -0
  79. package/libs/feature/record/src/lib/state/mdview.facade.d.ts.map +1 -1
  80. package/libs/feature/record/src/lib/state/mdview.reducer.d.ts +2 -0
  81. package/libs/feature/record/src/lib/state/mdview.reducer.d.ts.map +1 -1
  82. package/libs/feature/record/src/lib/state/mdview.selectors.d.ts +2 -0
  83. package/libs/feature/record/src/lib/state/mdview.selectors.d.ts.map +1 -1
  84. package/libs/feature/search/src/lib/constants.d.ts.map +1 -1
  85. package/libs/feature/search/src/lib/fuzzy-search/fuzzy-search.component.d.ts +2 -1
  86. package/libs/feature/search/src/lib/fuzzy-search/fuzzy-search.component.d.ts.map +1 -1
  87. package/libs/feature/search/src/lib/results-table/results-table-container.component.d.ts +6 -5
  88. package/libs/feature/search/src/lib/results-table/results-table-container.component.d.ts.map +1 -1
  89. package/libs/ui/elements/src/lib/internal-link-card/internal-link-card.component.d.ts +3 -6
  90. package/libs/ui/elements/src/lib/internal-link-card/internal-link-card.component.d.ts.map +1 -1
  91. package/libs/ui/elements/src/lib/internal-link-card-contact/internal-link-card-contact.component.d.ts +14 -0
  92. package/libs/ui/elements/src/lib/internal-link-card-contact/internal-link-card-contact.component.d.ts.map +1 -0
  93. package/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.d.ts +3 -0
  94. package/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.d.ts.map +1 -1
  95. package/libs/ui/elements/src/lib/metadata-quality-item/metadata-quality-item.component.d.ts.map +1 -1
  96. package/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.d.ts +20 -9
  97. package/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.d.ts.map +1 -1
  98. package/libs/ui/elements/src/lib/ui-elements.module.d.ts +2 -1
  99. package/libs/ui/elements/src/lib/ui-elements.module.d.ts.map +1 -1
  100. package/libs/ui/layout/src/index.d.ts +1 -0
  101. package/libs/ui/layout/src/index.d.ts.map +1 -1
  102. package/libs/ui/layout/src/lib/cell-popin/cell-popin.component.d.ts +28 -0
  103. package/libs/ui/layout/src/lib/cell-popin/cell-popin.component.d.ts.map +1 -0
  104. package/libs/ui/layout/src/lib/interactive-table/interactive-table.component.d.ts +4 -2
  105. package/libs/ui/layout/src/lib/interactive-table/interactive-table.component.d.ts.map +1 -1
  106. package/libs/ui/layout/src/lib/truncated-text/truncated-text.component.d.ts +5 -10
  107. package/libs/ui/layout/src/lib/truncated-text/truncated-text.component.d.ts.map +1 -1
  108. package/libs/ui/search/src/index.d.ts +1 -0
  109. package/libs/ui/search/src/index.d.ts.map +1 -1
  110. package/libs/ui/search/src/lib/results-table/action-menu/action-menu.component.d.ts +4 -3
  111. package/libs/ui/search/src/lib/results-table/action-menu/action-menu.component.d.ts.map +1 -1
  112. package/libs/ui/search/src/lib/results-table/results-table.component.d.ts +10 -4
  113. package/libs/ui/search/src/lib/results-table/results-table.component.d.ts.map +1 -1
  114. package/libs/ui/search/src/lib/ui-search.module.d.ts +2 -1
  115. package/libs/ui/search/src/lib/ui-search.module.d.ts.map +1 -1
  116. package/libs/util/i18n/src/lib/i18n.constants.d.ts +1 -0
  117. package/libs/util/i18n/src/lib/i18n.constants.d.ts.map +1 -1
  118. package/libs/util/i18n/src/lib/language-codes.d.ts +23 -1
  119. package/libs/util/i18n/src/lib/language-codes.d.ts.map +1 -1
  120. package/package.json +1 -1
  121. package/src/libs/api/metadata-converter/src/lib/fixtures/geocat-ch.records.ts +1 -1
  122. package/src/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.ts +61 -4
  123. package/src/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.ts +0 -1
  124. package/src/libs/api/metadata-converter/src/lib/iso19115-3/read-parts.ts +13 -3
  125. package/src/libs/api/metadata-converter/src/lib/iso19115-3/write-parts.ts +5 -1
  126. package/src/libs/api/metadata-converter/src/lib/iso19139/read-parts.ts +6 -3
  127. package/src/libs/api/metadata-converter/src/lib/iso19139/write-parts.ts +4 -1
  128. package/src/libs/api/repository/src/lib/gn4/elasticsearch/constant.ts +1 -0
  129. package/src/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.ts +2 -2
  130. package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +111 -15
  131. package/src/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts +11 -0
  132. package/src/libs/api/repository/src/lib/gn4/settings/gn4-settings.service.ts +3 -0
  133. package/src/libs/common/domain/src/lib/model/record/metadata.model.ts +20 -14
  134. package/src/libs/common/domain/src/lib/repository/records-repository.interface.ts +6 -0
  135. package/src/libs/common/fixtures/src/lib/records.fixtures.ts +63 -0
  136. package/src/libs/feature/editor/src/lib/components/multilingual-panel/multilingual-panel.component.html +117 -11
  137. package/src/libs/feature/editor/src/lib/components/multilingual-panel/multilingual-panel.component.ts +316 -6
  138. package/src/libs/feature/record/src/lib/state/mdview.actions.ts +10 -0
  139. package/src/libs/feature/record/src/lib/state/mdview.effects.ts +22 -0
  140. package/src/libs/feature/record/src/lib/state/mdview.facade.ts +4 -0
  141. package/src/libs/feature/record/src/lib/state/mdview.reducer.ts +12 -0
  142. package/src/libs/feature/record/src/lib/state/mdview.selectors.ts +9 -0
  143. package/src/libs/feature/search/src/lib/constants.ts +2 -1
  144. package/src/libs/feature/search/src/lib/fuzzy-search/fuzzy-search.component.html +1 -1
  145. package/src/libs/feature/search/src/lib/fuzzy-search/fuzzy-search.component.ts +1 -0
  146. package/src/libs/feature/search/src/lib/results-table/results-table-container.component.html +1 -0
  147. package/src/libs/feature/search/src/lib/results-table/results-table-container.component.ts +13 -3
  148. package/src/libs/ui/elements/src/lib/internal-link-card/internal-link-card.component.html +7 -75
  149. package/src/libs/ui/elements/src/lib/internal-link-card/internal-link-card.component.ts +20 -51
  150. package/src/libs/ui/elements/src/lib/internal-link-card-contact/internal-link-card-contact.component.html +69 -0
  151. package/src/libs/ui/elements/src/lib/internal-link-card-contact/internal-link-card-contact.component.ts +61 -0
  152. package/src/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.ts +48 -9
  153. package/src/libs/ui/elements/src/lib/metadata-quality-item/metadata-quality-item.component.ts +4 -0
  154. package/src/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.html +96 -37
  155. package/src/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.ts +60 -29
  156. package/src/libs/ui/elements/src/lib/ui-elements.module.ts +2 -0
  157. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.html +1 -1
  158. package/src/libs/ui/layout/src/index.ts +1 -0
  159. package/src/libs/ui/layout/src/lib/cell-popin/cell-popin.component.html +40 -0
  160. package/src/libs/ui/layout/src/lib/cell-popin/cell-popin.component.ts +141 -0
  161. package/src/libs/ui/layout/src/lib/interactive-table/interactive-table.component.html +3 -2
  162. package/src/libs/ui/layout/src/lib/interactive-table/interactive-table.component.ts +13 -6
  163. package/src/libs/ui/layout/src/lib/truncated-text/truncated-text.component.html +25 -42
  164. package/src/libs/ui/layout/src/lib/truncated-text/truncated-text.component.ts +10 -49
  165. package/src/libs/ui/layout/src/lib/ui-layout.module.ts +1 -1
  166. package/src/libs/ui/search/src/index.ts +1 -0
  167. package/src/libs/ui/search/src/lib/results-table/action-menu/action-menu.component.html +16 -6
  168. package/src/libs/ui/search/src/lib/results-table/action-menu/action-menu.component.ts +15 -11
  169. package/src/libs/ui/search/src/lib/results-table/results-table.component.css +4 -0
  170. package/src/libs/ui/search/src/lib/results-table/results-table.component.html +31 -27
  171. package/src/libs/ui/search/src/lib/results-table/results-table.component.ts +33 -15
  172. package/src/libs/ui/search/src/lib/ui-search.module.ts +3 -0
  173. package/src/libs/util/i18n/src/lib/i18n.constants.ts +42 -0
  174. package/src/libs/util/i18n/src/lib/language-codes.ts +23 -1
  175. package/tailwind.base.css +1 -1
  176. package/translations/de.json +41 -6
  177. package/translations/en.json +41 -6
  178. package/translations/es.json +40 -5
  179. package/translations/fr.json +41 -6
  180. package/translations/it.json +40 -5
  181. package/translations/nl.json +40 -5
  182. package/translations/pt.json +40 -5
  183. package/translations/sk.json +40 -5
@@ -1,14 +1,120 @@
1
1
  <div
2
- class="flex flex-col h-full w-[302px] bg-neutral-100 border-l border-gray-300 py-9 px-3 gap-8"
2
+ class="flex flex-col h-full w-[302px] bg-neutral-100 border-l border-gray-300 py-8 px-3 gap-6 overflow-auto"
3
3
  >
4
- <span class="text-3xl font-title text-black/80 px-2" translate
5
- >editor.record.form.multilingual.title</span
6
- >
7
- <gn-ui-check-toggle
8
- class="p-2"
9
- [label]="'editor.record.form.multilingual.enable' | translate"
10
- [color]="'primary'"
11
- [value]="translationsEnabled"
12
- (toggled)="translationsEnabled = $event"
13
- ></gn-ui-check-toggle>
4
+ <div class="flex flex-row px-2 justify-between">
5
+ <span class="text-3xl font-title text-black/80" translate
6
+ >editor.record.form.multilingual.title</span
7
+ >
8
+ <button
9
+ [title]="'editor.record.form.multilingual.open' | translate"
10
+ (click)="toggleLanguageSelection()"
11
+ *ngIf="isMultilingual"
12
+ data-test="activateSelection"
13
+ >
14
+ <ng-icon class="mt-1" name="iconoirSettings"></ng-icon>
15
+ </button>
16
+ </div>
17
+ <div class="flex flex-col gap-2" *ngIf="editTranslations || !isMultilingual">
18
+ <gn-ui-check-toggle
19
+ class="p-2"
20
+ [label]="'editor.record.form.multilingual.enable' | translate"
21
+ [color]="'primary'"
22
+ [(value)]="isMultilingual"
23
+ (toggled)="switchMultilingual($event)"
24
+ ></gn-ui-check-toggle>
25
+ <div *ngIf="isMultilingual" class="flex flex-col gap-2">
26
+ <div class="flex flex-row justify-between border-t border-gray-300 p-3">
27
+ <span class="mt-2 text-sm text-gray-600" translate
28
+ >editor.record.form.multilingual.activate</span
29
+ >
30
+ <gn-ui-button
31
+ extraClass="w-16 h-8 font-bold"
32
+ type="gray"
33
+ (buttonClick)="validateTranslations()"
34
+ data-test="validateSelection"
35
+ >{{ 'editor.record.form.multilingual.validate' | translate }}
36
+ </gn-ui-button>
37
+ </div>
38
+ <ng-container *ngIf="supportedLanguages$ | async as languages">
39
+ <div
40
+ class="flex flex-col gap-2 w-full px-2"
41
+ data-test="langAvailable"
42
+ *ngFor="let lang of languages"
43
+ >
44
+ <gn-ui-button
45
+ [extraClass]="getExtraClass(lang)"
46
+ type="gray"
47
+ (buttonClick)="toggleLanguage(lang)"
48
+ [disabled]="lang === _record.defaultLanguage"
49
+ [title]="getToggleTitle(lang)"
50
+ >
51
+ <span [class]="getIconClass(lang)"></span>
52
+ <span class="ml-2">{{ 'language.' + lang | translate }}</span>
53
+ </gn-ui-button>
54
+ </div>
55
+ </ng-container>
56
+ </div>
57
+ </div>
58
+ <div *ngIf="!editTranslations && isMultilingual" class="flex flex-col gap-2">
59
+ <gn-ui-button
60
+ *ngFor="let recordLang of sortLanguages(recordLanguages); let i = index"
61
+ extraClass="flex flex-row justify-between bg-white border border-white rounded mb-1 h-[34px] w-full"
62
+ [ngClass]="{
63
+ 'mt-8': isFirstUnsupported(i),
64
+ '': true,
65
+ }"
66
+ (buttonClick)="switchFormLang(recordLang)"
67
+ type="outline"
68
+ data-test="langSwitch"
69
+ >
70
+ <div class="flex flex-row gap-2 items-center">
71
+ <ng-icon
72
+ *ngIf="recordLang === formLanguage"
73
+ class="text-primary mt-1"
74
+ name="iconoirCheckCircle"
75
+ ></ng-icon>
76
+ <ng-icon
77
+ *ngIf="recordLang !== formLanguage"
78
+ class="text-gray-800 mt-1"
79
+ name="iconoirCircle"
80
+ ></ng-icon>
81
+ <span
82
+ *ngIf="recordLang.length === 2"
83
+ [class]="getIconClass(recordLang) + 'mt-1'"
84
+ ></span>
85
+ <span [ngClass]="recordLang === formLanguage ? 'text-black' : ''">{{
86
+ isLangSupported(recordLang)
87
+ ? ('language.' + recordLang | translate)
88
+ : recordLang.toUpperCase()
89
+ }}</span>
90
+ </div>
91
+ <div class="flex flex-row gap-2 items-center">
92
+ <span
93
+ *ngIf="recordLang === formLanguage"
94
+ class="text-xs text-base"
95
+ translate
96
+ >editor.record.form.multilingual.default</span
97
+ >
98
+ <button
99
+ (click)="
100
+ openActionMenu(recordLang, template); $event.stopPropagation()
101
+ "
102
+ cdkOverlayOrigin
103
+ #actionMenuButton
104
+ >
105
+ <ng-icon class="pb-5" name="matMoreHorizOutline"></ng-icon>
106
+ </button>
107
+ <ng-template #template>
108
+ <gn-ui-action-menu
109
+ [canDelete]="recordLang !== _record.defaultLanguage"
110
+ page="record"
111
+ (delete)="confirmDeleteAction(recordLang)"
112
+ (closeActionMenu)="closeActionMenu()"
113
+ (switch)="switchDefaultLang(recordLang)"
114
+ >
115
+ </gn-ui-action-menu>
116
+ </ng-template>
117
+ </div>
118
+ </gn-ui-button>
119
+ </div>
14
120
  </div>
@@ -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
  }
@@ -54,6 +54,16 @@ export const setRelated = createAction(
54
54
  props<{ related: CatalogRecord[] }>()
55
55
  )
56
56
 
57
+ export const setSources = createAction(
58
+ '[Metadata view] Set sources',
59
+ props<{ sources: CatalogRecord[] }>()
60
+ )
61
+
62
+ export const setSourceOf = createAction(
63
+ '[Metadata view] Set has sources',
64
+ props<{ sourceOf: CatalogRecord[] }>()
65
+ )
66
+
57
67
  /*
58
68
  ChartConfig actions
59
69
  */
@@ -68,6 +68,28 @@ export class MdViewEffects {
68
68
  )
69
69
  )
70
70
 
71
+ loadSources$ = createEffect(() =>
72
+ this.actions$.pipe(
73
+ ofType(MdViewActions.loadFullMetadataSuccess),
74
+ switchMap(({ full }) => this.recordsRepository.getSources(full)),
75
+ map((sources) => {
76
+ return MdViewActions.setSources({ sources })
77
+ }),
78
+ catchError(() => of(MdViewActions.setSources({ sources: null })))
79
+ )
80
+ )
81
+
82
+ loadSourceOf$ = createEffect(() =>
83
+ this.actions$.pipe(
84
+ ofType(MdViewActions.loadFullMetadataSuccess),
85
+ switchMap(({ full }) => this.recordsRepository.getSourceOf(full)),
86
+ map((sourceOf) => {
87
+ return MdViewActions.setSourceOf({ sourceOf })
88
+ }),
89
+ catchError(() => of(MdViewActions.setSourceOf({ sourceOf: null })))
90
+ )
91
+ )
92
+
71
93
  /*
72
94
  UserFeedback effects
73
95
  */
@@ -76,6 +76,10 @@ export class MdViewFacade {
76
76
 
77
77
  related$ = this.store.pipe(select(MdViewSelectors.getRelated))
78
78
 
79
+ sources$ = this.store.pipe(select(MdViewSelectors.getSources))
80
+
81
+ sourceOf$ = this.store.pipe(select(MdViewSelectors.getSourceOf))
82
+
79
83
  chartConfig$ = this.store.pipe(select(MdViewSelectors.getChartConfig))
80
84
 
81
85
  allLinks$ = this.metadata$.pipe(
@@ -14,6 +14,8 @@ export interface MetadataViewState {
14
14
  error: { notFound?: boolean; otherError?: string } | null
15
15
  metadata?: Partial<CatalogRecord>
16
16
  related?: CatalogRecord[]
17
+ sources?: CatalogRecord[]
18
+ sourceOf?: CatalogRecord[]
17
19
  userFeedbacks?: UserFeedback[]
18
20
  allUserFeedbacksLoading: boolean
19
21
  addUserFeedbackLoading: boolean
@@ -75,6 +77,16 @@ const metadataViewReducer = createReducer(
75
77
  related,
76
78
  })),
77
79
 
80
+ on(MetadataViewActions.setSources, (state, { sources }) => ({
81
+ ...state,
82
+ sources,
83
+ })),
84
+
85
+ on(MetadataViewActions.setSourceOf, (state, { sourceOf }) => ({
86
+ ...state,
87
+ sourceOf,
88
+ })),
89
+
78
90
  /*
79
91
  ChartConfig reducers
80
92
  */
@@ -41,6 +41,15 @@ export const getRelated = createSelector(
41
41
  (state: MetadataViewState) => state.related
42
42
  )
43
43
 
44
+ export const getSources = createSelector(
45
+ getMdViewState,
46
+ (state: MetadataViewState) => state.sources
47
+ )
48
+
49
+ export const getSourceOf = createSelector(
50
+ getMdViewState,
51
+ (state: MetadataViewState) => state.sourceOf
52
+ )
44
53
  /*
45
54
  Metadata selectors
46
55
  */
@@ -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,