geonetwork-ui 2.4.0-dev.e7ff1d25 → 2.4.0-dev.e97caaf2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/esm2022/libs/api/metadata-converter/src/lib/gn4/types/keywords.model.mjs +1 -1
  2. package/esm2022/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.mjs +4 -2
  3. package/esm2022/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.mjs +11 -1
  4. package/esm2022/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.mjs +11 -1
  5. package/esm2022/libs/common/domain/src/lib/model/record/metadata.model.mjs +1 -1
  6. package/esm2022/libs/common/domain/src/lib/model/user/user.model.mjs +1 -1
  7. package/esm2022/libs/common/domain/src/lib/platform.service.interface.mjs +1 -1
  8. package/esm2022/libs/feature/editor/src/lib/+state/editor.actions.mjs +2 -1
  9. package/esm2022/libs/feature/editor/src/lib/+state/editor.effects.mjs +6 -1
  10. package/esm2022/libs/feature/editor/src/lib/+state/editor.facade.mjs +4 -1
  11. package/esm2022/libs/feature/editor/src/lib/components/contact-card/contact-card.component.mjs +3 -3
  12. package/esm2022/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.mjs +78 -0
  13. package/esm2022/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.mjs +44 -79
  14. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts-for-resource/form-field-contacts-for-resource.component.mjs +35 -41
  15. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.mjs +19 -41
  16. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.mjs +10 -8
  17. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-map-container/form-field-map-container.component.mjs +101 -0
  18. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-open-data/form-field-open-data.component.mjs +22 -25
  19. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.mjs +14 -7
  20. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.mjs +10 -6
  21. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.mjs +11 -11
  22. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-simple/form-field-simple.component.mjs +9 -8
  23. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.mjs +111 -5
  24. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-temporal-extents/form-field-temporal-extents.component.mjs +49 -53
  25. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.mjs +16 -14
  26. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.mjs +34 -64
  27. package/esm2022/libs/feature/editor/src/lib/components/record-form/record-form.component.mjs +5 -3
  28. package/esm2022/libs/feature/editor/src/lib/fields.config.mjs +8 -2
  29. package/esm2022/libs/feature/editor/src/lib/services/editor.service.mjs +5 -1
  30. package/esm2022/libs/ui/elements/src/lib/sortable-list/sortable-list.component.mjs +3 -11
  31. package/esm2022/libs/ui/inputs/src/index.mjs +2 -1
  32. package/esm2022/libs/ui/inputs/src/lib/editable-label/editable-label.directive.mjs +26 -24
  33. package/esm2022/libs/ui/inputs/src/lib/switch-toggle/switch-toggle.component.mjs +32 -0
  34. package/esm2022/libs/ui/map/src/lib/ui-map.module.mjs +3 -3
  35. package/esm2022/translations/de.json +12 -0
  36. package/esm2022/translations/en.json +12 -0
  37. package/esm2022/translations/es.json +12 -0
  38. package/esm2022/translations/fr.json +14 -2
  39. package/esm2022/translations/it.json +12 -0
  40. package/esm2022/translations/nl.json +12 -0
  41. package/esm2022/translations/pt.json +12 -0
  42. package/fesm2022/geonetwork-ui.mjs +846 -521
  43. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  44. package/libs/api/metadata-converter/src/lib/gn4/types/keywords.model.d.ts +2 -6
  45. package/libs/api/metadata-converter/src/lib/gn4/types/keywords.model.d.ts.map +1 -1
  46. package/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.d.ts.map +1 -1
  47. package/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.d.ts.map +1 -1
  48. package/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.d.ts +1 -0
  49. package/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.d.ts.map +1 -1
  50. package/libs/common/domain/src/lib/model/record/metadata.model.d.ts +1 -0
  51. package/libs/common/domain/src/lib/model/record/metadata.model.d.ts.map +1 -1
  52. package/libs/common/domain/src/lib/model/user/user.model.d.ts +1 -1
  53. package/libs/common/domain/src/lib/model/user/user.model.d.ts.map +1 -1
  54. package/libs/common/domain/src/lib/platform.service.interface.d.ts +1 -0
  55. package/libs/common/domain/src/lib/platform.service.interface.d.ts.map +1 -1
  56. package/libs/feature/editor/src/lib/+state/editor.actions.d.ts +1 -0
  57. package/libs/feature/editor/src/lib/+state/editor.actions.d.ts.map +1 -1
  58. package/libs/feature/editor/src/lib/+state/editor.effects.d.ts +5 -0
  59. package/libs/feature/editor/src/lib/+state/editor.effects.d.ts.map +1 -1
  60. package/libs/feature/editor/src/lib/+state/editor.facade.d.ts +1 -0
  61. package/libs/feature/editor/src/lib/+state/editor.facade.d.ts.map +1 -1
  62. package/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.d.ts +32 -0
  63. package/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.d.ts.map +1 -0
  64. package/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.d.ts +13 -13
  65. package/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.d.ts.map +1 -1
  66. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts-for-resource/form-field-contacts-for-resource.component.d.ts +10 -13
  67. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts-for-resource/form-field-contacts-for-resource.component.d.ts.map +1 -1
  68. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.d.ts +8 -19
  69. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.d.ts.map +1 -1
  70. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.d.ts +6 -4
  71. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.d.ts.map +1 -1
  72. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-map-container/form-field-map-container.component.d.ts +22 -0
  73. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-map-container/form-field-map-container.component.d.ts.map +1 -0
  74. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-open-data/form-field-open-data.component.d.ts +10 -12
  75. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-open-data/form-field-open-data.component.d.ts.map +1 -1
  76. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.d.ts +5 -3
  77. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.d.ts.map +1 -1
  78. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.d.ts +4 -3
  79. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.d.ts.map +1 -1
  80. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.d.ts +4 -4
  81. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.d.ts.map +1 -1
  82. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-simple/form-field-simple.component.d.ts +4 -3
  83. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-simple/form-field-simple.component.d.ts.map +1 -1
  84. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.d.ts +23 -0
  85. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.d.ts.map +1 -1
  86. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-temporal-extents/form-field-temporal-extents.component.d.ts +15 -17
  87. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-temporal-extents/form-field-temporal-extents.component.d.ts.map +1 -1
  88. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.d.ts +5 -5
  89. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.d.ts.map +1 -1
  90. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.d.ts +15 -27
  91. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.d.ts.map +1 -1
  92. package/libs/feature/editor/src/lib/components/record-form/record-form.component.d.ts +3 -2
  93. package/libs/feature/editor/src/lib/components/record-form/record-form.component.d.ts.map +1 -1
  94. package/libs/feature/editor/src/lib/fields.config.d.ts +1 -0
  95. package/libs/feature/editor/src/lib/fields.config.d.ts.map +1 -1
  96. package/libs/feature/editor/src/lib/services/editor.service.d.ts +1 -0
  97. package/libs/feature/editor/src/lib/services/editor.service.d.ts.map +1 -1
  98. package/libs/ui/elements/src/lib/sortable-list/sortable-list.component.d.ts +1 -6
  99. package/libs/ui/elements/src/lib/sortable-list/sortable-list.component.d.ts.map +1 -1
  100. package/libs/ui/inputs/src/index.d.ts +1 -0
  101. package/libs/ui/inputs/src/index.d.ts.map +1 -1
  102. package/libs/ui/inputs/src/lib/editable-label/editable-label.directive.d.ts +5 -3
  103. package/libs/ui/inputs/src/lib/editable-label/editable-label.directive.d.ts.map +1 -1
  104. package/libs/ui/inputs/src/lib/switch-toggle/switch-toggle.component.d.ts +17 -0
  105. package/libs/ui/inputs/src/lib/switch-toggle/switch-toggle.component.d.ts.map +1 -0
  106. package/package.json +1 -1
  107. package/src/libs/api/metadata-converter/src/lib/fixtures/generic.records.ts +6 -1
  108. package/src/libs/api/metadata-converter/src/lib/gn4/types/keywords.model.ts +2 -6
  109. package/src/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.ts +3 -1
  110. package/src/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.ts +12 -1
  111. package/src/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts +43 -12
  112. package/src/libs/common/domain/src/lib/model/record/metadata.model.ts +1 -0
  113. package/src/libs/common/domain/src/lib/model/user/user.model.ts +1 -1
  114. package/src/libs/common/domain/src/lib/platform.service.interface.ts +4 -0
  115. package/src/libs/common/fixtures/src/lib/organisations.fixture.ts +10 -0
  116. package/src/libs/feature/editor/src/lib/+state/editor.actions.ts +2 -0
  117. package/src/libs/feature/editor/src/lib/+state/editor.effects.ts +15 -0
  118. package/src/libs/feature/editor/src/lib/+state/editor.facade.ts +4 -0
  119. package/src/libs/feature/editor/src/lib/components/contact-card/contact-card.component.html +4 -2
  120. package/src/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.css +0 -0
  121. package/src/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.html +26 -0
  122. package/src/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.ts +89 -0
  123. package/src/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.html +1 -1
  124. package/src/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.ts +46 -94
  125. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts-for-resource/form-field-contacts-for-resource.component.ts +63 -85
  126. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.html +7 -17
  127. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.ts +18 -51
  128. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.ts +13 -5
  129. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-map-container/form-field-map-container.component.css +0 -0
  130. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-map-container/form-field-map-container.component.html +4 -0
  131. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-map-container/form-field-map-container.component.ts +128 -0
  132. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-open-data/form-field-open-data.component.html +1 -1
  133. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-open-data/form-field-open-data.component.ts +18 -29
  134. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.html +1 -1
  135. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.ts +16 -5
  136. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.html +2 -2
  137. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.ts +9 -3
  138. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.html +2 -2
  139. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.ts +13 -7
  140. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-simple/form-field-simple.component.html +5 -3
  141. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-simple/form-field-simple.component.ts +11 -4
  142. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.html +15 -1
  143. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.ts +156 -1
  144. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-temporal-extents/form-field-temporal-extents.component.html +9 -2
  145. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-temporal-extents/form-field-temporal-extents.component.ts +59 -71
  146. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.ts +17 -15
  147. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +99 -81
  148. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts +37 -66
  149. package/src/libs/feature/editor/src/lib/components/record-form/record-form.component.html +1 -0
  150. package/src/libs/feature/editor/src/lib/components/record-form/record-form.component.ts +7 -2
  151. package/src/libs/feature/editor/src/lib/fields.config.ts +8 -1
  152. package/src/libs/feature/editor/src/lib/services/editor.service.ts +7 -0
  153. package/src/libs/ui/elements/src/lib/sortable-list/sortable-list.component.html +0 -9
  154. package/src/libs/ui/elements/src/lib/sortable-list/sortable-list.component.ts +0 -4
  155. package/src/libs/ui/inputs/src/index.ts +1 -0
  156. package/src/libs/ui/inputs/src/lib/editable-label/editable-label.directive.ts +40 -26
  157. package/src/libs/ui/map/src/lib/ui-map.module.ts +1 -1
  158. package/translations/de.json +12 -0
  159. package/translations/en.json +12 -0
  160. package/translations/es.json +12 -0
  161. package/translations/fr.json +14 -2
  162. package/translations/it.json +12 -0
  163. package/translations/nl.json +12 -0
  164. package/translations/pt.json +12 -0
  165. package/translations/sk.json +12 -0
@@ -1,17 +1,21 @@
1
1
  import { CommonModule } from '@angular/common'
2
- import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
3
- import { FormControl } from '@angular/forms'
4
- import { PlatformServiceInterface } from '../../../../../../../../../libs/common/domain/src/lib/platform.service.interface'
2
+ import {
3
+ ChangeDetectionStrategy,
4
+ Component,
5
+ EventEmitter,
6
+ Input,
7
+ Output,
8
+ } from '@angular/core'
5
9
  import {
6
10
  AutocompleteComponent,
7
11
  DropdownSelectorComponent,
8
12
  UiInputsModule,
9
13
  } from '../../../../../../../../../libs/ui/inputs/src'
10
14
  import { UiWidgetsModule } from '../../../../../../../../../libs/ui/widgets/src'
11
- import { map } from 'rxjs'
12
15
  import { Keyword } from '../../../../../../../../../libs/common/domain/src/lib/model/record'
13
-
14
- type AutocompleteItem = { title: string; value: Keyword }
16
+ import { GenericKeywordsComponent } from '../../../generic-keywords/generic-keywords.component'
17
+ import { TranslateModule } from '@ngx-translate/core'
18
+ import { KeywordType } from '../../../../../../../../../libs/common/domain/src/lib/model/thesaurus'
15
19
 
16
20
  @Component({
17
21
  selector: 'gn-ui-form-field-keywords',
@@ -25,55 +29,18 @@ type AutocompleteItem = { title: string; value: Keyword }
25
29
  CommonModule,
26
30
  UiWidgetsModule,
27
31
  AutocompleteComponent,
32
+ GenericKeywordsComponent,
33
+ TranslateModule,
28
34
  ],
29
35
  })
30
36
  export class FormFieldKeywordsComponent {
31
- @Input() control: FormControl<Keyword[]>
32
-
33
- displayWithFn = (item: AutocompleteItem) => {
34
- return `${item.title} (${item.value.thesaurus?.name})`
35
- }
36
-
37
- autoCompleteAction = (query: string) => {
38
- return this.platformService
39
- .searchKeywords(query, ['temporal', 'theme', 'other'])
40
- .pipe(
41
- map((keywords) =>
42
- keywords.map((keyword) => {
43
- return { title: keyword.label, value: keyword }
44
- })
45
- )
46
- )
47
- }
48
-
49
- constructor(private platformService: PlatformServiceInterface) {}
50
-
51
- handleItemSelection(item: AutocompleteItem) {
52
- this.addKeyword(item.value)
53
- }
54
-
55
- addKeyword(keyword: Keyword) {
56
- const addedKeywords = [...this.control.value, keyword]
57
-
58
- // remove duplicates from keyword
59
- const filteredKeywords = addedKeywords.filter((value, index, self) => {
60
- return (
61
- index ===
62
- self.findIndex(
63
- (t) =>
64
- t?.label === value?.label &&
65
- t?.thesaurus?.id === value?.thesaurus?.id &&
66
- t?.type === value?.type
67
- )
68
- )
69
- })
70
-
71
- this.control.setValue(filteredKeywords)
72
- }
37
+ @Input() value: Keyword[]
38
+ @Output() valueChange: EventEmitter<Keyword[]> = new EventEmitter()
73
39
 
74
- removeKeyword(index: number) {
75
- const removeKeywords = this.control.value.filter((_, i) => i !== index)
40
+ keywordTypes = ['temporal', 'theme', 'other'] as KeywordType[]
41
+ placeholder = 'editor.form.keywords.placeholder'
76
42
 
77
- this.control.setValue(removeKeywords)
43
+ handleKeywordsChange(keywords: Keyword[]) {
44
+ this.valueChange.emit(keywords)
78
45
  }
79
46
  }
@@ -1,6 +1,12 @@
1
- import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
2
- import { FormControl } from '@angular/forms'
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ Component,
4
+ EventEmitter,
5
+ Input,
6
+ Output,
7
+ } from '@angular/core'
3
8
  import { marker } from '@biesbjerg/ngx-translate-extract-marker'
9
+ import { Constraint } from '../../../../../../../../../libs/common/domain/src/lib/model/record'
4
10
  import { DropdownSelectorComponent } from '../../../../../../../../../libs/ui/inputs/src'
5
11
 
6
12
  @Component({
@@ -12,15 +18,17 @@ import { DropdownSelectorComponent } from '../../../../../../../../../libs/ui/in
12
18
  imports: [DropdownSelectorComponent],
13
19
  })
14
20
  export class FormFieldLicenseComponent {
15
- @Input() control!: FormControl
16
21
  @Input() label: string
22
+ @Input() value: Array<Constraint>
23
+
24
+ @Output() valueChange: EventEmitter<Array<Constraint>> = new EventEmitter()
17
25
 
18
26
  get selected() {
19
- return this.control.value[0]?.text
27
+ return this.value[0]?.text
20
28
  }
21
29
 
22
30
  onSelectValue(value: unknown) {
23
- this.control.setValue([{ text: value }])
31
+ this.valueChange.emit([{ text: value as string }])
24
32
  }
25
33
 
26
34
  choices = [
@@ -0,0 +1,4 @@
1
+ <gn-ui-map-context
2
+ [context]="mapContext$ | async"
3
+ [mapConfig]="mapConfig"
4
+ ></gn-ui-map-context>
@@ -0,0 +1,128 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ Component,
4
+ Input,
5
+ OnChanges,
6
+ } from '@angular/core'
7
+ import { CommonModule } from '@angular/common'
8
+ import { catchError, from, map, Observable, of, switchMap } from 'rxjs'
9
+ import {
10
+ DEFAULT_BASELAYER_CONTEXT,
11
+ FeatureMapModule,
12
+ MapContextLayerTypeEnum,
13
+ MapContextModel,
14
+ MapFacade,
15
+ MapStyleService,
16
+ MapUtilsService,
17
+ } from '../../../../../../../../../libs/feature/map/src'
18
+ import { Fill, Stroke, Style } from 'ol/style'
19
+ import { getOptionalMapConfig, MapConfig } from '../../../../../../../../../libs/util/app-config/src'
20
+ import { Geometry } from 'geojson'
21
+ import { GeoJSONFeatureCollection } from 'ol/format/GeoJSON'
22
+ import { DatasetSpatialExtent } from '../../../../../../../../../libs/common/domain/src/lib/model/record'
23
+ import { Polygon } from 'ol/geom'
24
+ import GeoJSON from 'ol/format/GeoJSON'
25
+
26
+ @Component({
27
+ selector: 'gn-ui-form-field-map-container',
28
+ standalone: true,
29
+ imports: [CommonModule, FeatureMapModule],
30
+ templateUrl: './form-field-map-container.component.html',
31
+ styleUrls: ['./form-field-map-container.component.css'],
32
+ changeDetection: ChangeDetectionStrategy.OnPush,
33
+ })
34
+ export class FormFieldMapContainerComponent implements OnChanges {
35
+ @Input() spatialExtents: DatasetSpatialExtent[]
36
+
37
+ error = ''
38
+ mapContext$: Observable<MapContextModel> = this.mapFacade.layers$.pipe(
39
+ switchMap((layers) =>
40
+ from(this.mapUtils.getLayerExtent(layers[0])).pipe(
41
+ catchError(() => {
42
+ this.error = 'The layer has no extent'
43
+ return of(undefined)
44
+ }),
45
+ map((extent) => {
46
+ return {
47
+ layers: [DEFAULT_BASELAYER_CONTEXT, ...layers],
48
+ view: {
49
+ extent: extent,
50
+ },
51
+ } as MapContextModel
52
+ })
53
+ )
54
+ )
55
+ )
56
+
57
+ mapConfig: MapConfig = getOptionalMapConfig()
58
+
59
+ constructor(
60
+ private mapFacade: MapFacade,
61
+ private mapUtils: MapUtilsService,
62
+ private styleService: MapStyleService
63
+ ) {
64
+ const fill = new Fill({
65
+ color: 'transparent',
66
+ })
67
+ const stroke = new Stroke({
68
+ color: 'black',
69
+ width: 2,
70
+ })
71
+ const styles = [
72
+ new Style({
73
+ fill: fill,
74
+ stroke: stroke,
75
+ }),
76
+ ]
77
+ this.styleService.styles.default = this.styleService.createStyleFunction({
78
+ ...this.styleService.createGeometryStyles({ color: 'black' }),
79
+ polygon: styles,
80
+ })
81
+ }
82
+
83
+ ngOnChanges(): void {
84
+ this.mapFacade.removeLayer(0)
85
+
86
+ if (this.spatialExtents) {
87
+ const featureCollection: GeoJSONFeatureCollection = {
88
+ type: 'FeatureCollection',
89
+ features: [],
90
+ }
91
+
92
+ this.spatialExtents.forEach((extent) => {
93
+ if (extent.geometry) {
94
+ featureCollection.features.push({
95
+ type: 'Feature',
96
+ properties: {},
97
+ geometry: extent.geometry,
98
+ })
99
+ } else if (extent.bbox?.length >= 0) {
100
+ featureCollection.features.push({
101
+ type: 'Feature',
102
+ properties: {},
103
+ geometry: this.bboxCoordsToGeometry(extent.bbox),
104
+ })
105
+ }
106
+ })
107
+ this.mapFacade.addLayer({
108
+ type: MapContextLayerTypeEnum.GEOJSON,
109
+ data: featureCollection,
110
+ title: 'Spatial extents',
111
+ })
112
+ }
113
+ }
114
+ bboxCoordsToGeometry(bbox: [number, number, number, number]): Geometry {
115
+ const geometry = new Polygon([
116
+ [
117
+ [bbox[0], bbox[1]],
118
+ [bbox[0], bbox[3]],
119
+ [bbox[2], bbox[3]],
120
+ [bbox[2], bbox[1]],
121
+ [bbox[0], bbox[1]],
122
+ ],
123
+ ])
124
+
125
+ const geoJSONGeom = new GeoJSON().writeGeometryObject(geometry)
126
+ return geoJSONGeom
127
+ }
128
+ }
@@ -1,6 +1,6 @@
1
1
  <gn-ui-check-toggle
2
2
  [label]="'editor.record.form.classification.opendata' | translate"
3
- [value]="value"
3
+ [value]="openData"
4
4
  (toggled)="onOpenDataToggled($event)"
5
5
  data-cy="openDataToggle"
6
6
  ></gn-ui-check-toggle>
@@ -4,15 +4,12 @@ import {
4
4
  EventEmitter,
5
5
  Input,
6
6
  OnChanges,
7
- OnInit,
8
7
  Output,
9
- SimpleChanges,
10
8
  } from '@angular/core'
11
- import { FormControl } from '@angular/forms'
9
+ import { Constraint } from '../../../../../../../../../libs/common/domain/src/lib/model/record'
12
10
  import { CheckToggleComponent } from '../../../../../../../../../libs/ui/inputs/src'
13
11
  import { TranslateModule } from '@ngx-translate/core'
14
12
  import { OPEN_DATA_LICENSES } from './../../../../fields.config'
15
- import { Subscription } from 'rxjs'
16
13
 
17
14
  @Component({
18
15
  selector: 'gn-ui-form-field-open-data',
@@ -22,38 +19,30 @@ import { Subscription } from 'rxjs'
22
19
  imports: [CheckToggleComponent, TranslateModule],
23
20
  changeDetection: ChangeDetectionStrategy.OnPush,
24
21
  })
25
- export class FormFieldOpenDataComponent implements OnInit {
26
- @Input() control: FormControl
27
- value = false
28
- @Output() visibilityChange = new EventEmitter<boolean>()
29
- subscription: Subscription
22
+ export class FormFieldOpenDataComponent implements OnChanges {
23
+ @Input() value: Array<Constraint>
24
+ @Output() valueChange = new EventEmitter<Array<Constraint>>()
25
+ @Output() openDataChange = new EventEmitter<boolean>()
26
+
27
+ openData = false
30
28
 
31
29
  get config() {
32
30
  return OPEN_DATA_LICENSES
33
31
  }
34
32
 
35
- ngOnInit() {
36
- this.initToggle()
37
- this.subscription = new Subscription()
38
-
39
- this.subscription.add(
40
- this.control.valueChanges.subscribe((value) => {
41
- this.value = this.config.includes(value[0].text)
42
- this.visibilityChange.emit(this.value)
43
- })
44
- )
45
- }
46
-
47
- initToggle() {
48
- this.value = this.config.includes(this.control.value[0].text)
49
- this.visibilityChange.emit(this.value)
33
+ ngOnChanges() {
34
+ if (this.value && this.value.length > 0) {
35
+ this.openData = this.config.includes(this.value[0].text)
36
+ } else {
37
+ this.openData = false
38
+ }
39
+ this.openDataChange.emit(this.openData)
50
40
  }
51
41
 
52
- onOpenDataToggled(boolean) {
53
- if (boolean) {
54
- this.control.setValue([{ text: this.config[0] }])
42
+ onOpenDataToggled(openData: boolean) {
43
+ this.openDataChange.emit(openData)
44
+ if (openData) {
45
+ this.valueChange.emit([{ text: this.config[0] }])
55
46
  }
56
- this.value = !this.value
57
- this.visibilityChange.emit(boolean)
58
47
  }
59
48
  }
@@ -1,5 +1,5 @@
1
1
  <gn-ui-overview-upload
2
2
  [metadataUuid]="metadataUuid"
3
- [formControl]="control"
3
+ [overview]="firstOverview"
4
4
  (overviewChange)="handleOverviewChange($event)"
5
5
  ></gn-ui-overview-upload>
@@ -1,8 +1,13 @@
1
1
  import { CommonModule } from '@angular/common'
2
- import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
3
- import { OverviewUploadComponent } from '../../../overview-upload/overview-upload.component'
4
- import { FormControl } from '@angular/forms'
2
+ import {
3
+ ChangeDetectionStrategy,
4
+ Component,
5
+ EventEmitter,
6
+ Input,
7
+ Output,
8
+ } from '@angular/core'
5
9
  import { GraphicOverview } from '../../../../../../../../../libs/common/domain/src/lib/model/record'
10
+ import { OverviewUploadComponent } from '../../../overview-upload/overview-upload.component'
6
11
 
7
12
  @Component({
8
13
  selector: 'gn-ui-form-field-overviews',
@@ -14,9 +19,15 @@ import { GraphicOverview } from '../../../../../../../../../libs/common/domain/s
14
19
  })
15
20
  export class FormFieldOverviewsComponent {
16
21
  @Input() metadataUuid: string
17
- @Input() control!: FormControl
22
+ @Input() value: Array<GraphicOverview>
23
+ @Output() valueChange: EventEmitter<Array<GraphicOverview>> =
24
+ new EventEmitter()
25
+
26
+ get firstOverview() {
27
+ return this.value[0]
28
+ }
18
29
 
19
30
  handleOverviewChange(overView: GraphicOverview | null) {
20
- this.control.setValue(overView ? [overView] : [])
31
+ this.valueChange.emit(overView ? [overView] : [])
21
32
  }
22
33
  }
@@ -1,4 +1,4 @@
1
1
  <gn-ui-date-picker
2
- [date]="control.value"
3
- (dateChange)="control.setValue($event)"
2
+ [date]="value"
3
+ (dateChange)="valueChange.emit($event)"
4
4
  ></gn-ui-date-picker>
@@ -1,5 +1,10 @@
1
- import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
2
- import { FormControl } from '@angular/forms'
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ Component,
4
+ EventEmitter,
5
+ Input,
6
+ Output,
7
+ } from '@angular/core'
3
8
  import { DatePickerComponent } from '../../../../../../../../../libs/ui/inputs/src'
4
9
 
5
10
  @Component({
@@ -11,5 +16,6 @@ import { DatePickerComponent } from '../../../../../../../../../libs/ui/inputs/s
11
16
  imports: [DatePickerComponent],
12
17
  })
13
18
  export class FormFieldResourceUpdatedComponent {
14
- @Input() control!: FormControl
19
+ @Input() value: Date
20
+ @Output() valueChange: EventEmitter<Date> = new EventEmitter()
15
21
  }
@@ -14,7 +14,7 @@
14
14
  [preview]="preview"
15
15
  [helperText]="helperText"
16
16
  [placeholder]="placeholder"
17
- [textContent]="control.value"
18
- (textContentChanged)="handleTextContentChanged($event)"
17
+ [textContent]="value"
18
+ (textContentChanged)="valueChange.emit($event)"
19
19
  ></gn-ui-markdown-editor>
20
20
  </gn-ui-form-field-wrapper>
@@ -1,6 +1,14 @@
1
1
  import { CommonModule } from '@angular/common'
2
- import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
3
- import { FormControl, ReactiveFormsModule } from '@angular/forms'
2
+ import {
3
+ ChangeDetectionStrategy,
4
+ ChangeDetectorRef,
5
+ Component,
6
+ EventEmitter,
7
+ Input,
8
+ OnInit,
9
+ Output,
10
+ } from '@angular/core'
11
+ import { ReactiveFormsModule } from '@angular/forms'
4
12
  import { MarkdownEditorComponent } from '../../../../../../../../../libs/ui/elements/src'
5
13
  import { ButtonComponent } from '../../../../../../../../../libs/ui/inputs/src'
6
14
  import { FormFieldWrapperComponent } from '../../../../../../../../../libs/ui/layout/src'
@@ -20,11 +28,13 @@ import { FormFieldWrapperComponent } from '../../../../../../../../../libs/ui/la
20
28
  ],
21
29
  })
22
30
  export class FormFieldRichComponent {
23
- @Input() control!: FormControl
24
31
  @Input() label: string
25
32
  @Input() hint: string
26
33
  @Input() helperText: string
27
34
  @Input() placeholder = 'Votre texte ici' //TODO: translate
35
+ @Input() value: string
36
+
37
+ @Output() valueChange: EventEmitter<string> = new EventEmitter()
28
38
 
29
39
  preview = false
30
40
 
@@ -37,8 +47,4 @@ export class FormFieldRichComponent {
37
47
  togglePreview() {
38
48
  this.preview = !this.preview
39
49
  }
40
-
41
- handleTextContentChanged(textContent: string) {
42
- this.control.setValue(textContent)
43
- }
44
50
  }
@@ -2,8 +2,9 @@
2
2
  *ngIf="!isSelect"
3
3
  [type]="inputType"
4
4
  [readonly]="readonly"
5
- [formControl]="control"
6
5
  [placeholder]="placeholder"
6
+ [value]="value"
7
+ (valueChange)="valueChange.emit($event)"
7
8
  class="border rounded-md p-3 w-full bg-white transition-colors"
8
9
  [ngClass]="{
9
10
  'border-pink-500': invalid,
@@ -13,7 +14,8 @@
13
14
  />
14
15
  <select
15
16
  *ngIf="isSelect"
16
- [formControl]="control"
17
+ [value]="value"
18
+ (valueChange)="valueChange.emit($event)"
17
19
  class="border rounded-md p-3 w-full bg-white transition-colors"
18
20
  [ngClass]="{
19
21
  'border-pink-500': invalid,
@@ -21,7 +23,7 @@
21
23
  'text-gray-600': readonly
22
24
  }"
23
25
  >
24
- <option *ngFor="let option of options" [ngValue]="option.value">
26
+ <option *ngFor="let option of options" [value]="option.value">
25
27
  {{ option.label }}
26
28
  </option>
27
29
  </select>
@@ -1,6 +1,11 @@
1
1
  import { CommonModule } from '@angular/common'
2
- import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
3
- import { FormControl, ReactiveFormsModule } from '@angular/forms'
2
+ import {
3
+ ChangeDetectionStrategy,
4
+ Component,
5
+ EventEmitter,
6
+ Input,
7
+ Output,
8
+ } from '@angular/core'
4
9
 
5
10
  @Component({
6
11
  selector: 'gn-ui-form-field-simple',
@@ -8,15 +13,17 @@ import { FormControl, ReactiveFormsModule } from '@angular/forms'
8
13
  styleUrls: ['./form-field-simple.component.css'],
9
14
  changeDetection: ChangeDetectionStrategy.OnPush,
10
15
  standalone: true,
11
- imports: [CommonModule, ReactiveFormsModule],
16
+ imports: [CommonModule],
12
17
  })
13
18
  export class FormFieldSimpleComponent {
14
19
  @Input() type: 'date' | 'url' | 'text' | 'number' | 'list' | 'toggle'
15
- @Input() control!: FormControl
16
20
  @Input() readonly = false
17
21
  @Input() invalid = false
18
22
  @Input() placeholder = ''
19
23
  @Input() options?: { label: string; value: unknown }[]
24
+ @Input() value: unknown
25
+
26
+ @Output() valueChange: EventEmitter<unknown> = new EventEmitter()
20
27
 
21
28
  get inputType() {
22
29
  switch (this.type) {
@@ -1 +1,15 @@
1
- <p>form-field-spatial-extent works!</p>
1
+ <div class="flex flex-col gap-3">
2
+ <gn-ui-generic-keywords
3
+ [placeholder]="'Search for place keywords'"
4
+ [keywords]="shownKeywords$ | async"
5
+ [keywordTypes]="['place']"
6
+ (deletedKeyword)="handleKeywordDelete($event)"
7
+ (addedKeyword)="handleKeywordAdd($event)"
8
+ >
9
+ </gn-ui-generic-keywords>
10
+ </div>
11
+ <div class="w-full h-96">
12
+ <gn-ui-form-field-map-container
13
+ [spatialExtents]="spatialExtents$ | async"
14
+ ></gn-ui-form-field-map-container>
15
+ </div>