geonetwork-ui 2.4.0 → 2.4.1-dev.1d2ade24e

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 (181) hide show
  1. package/esm2022/libs/api/metadata-converter/src/lib/gn4/gn4.converter.mjs +4 -3
  2. package/esm2022/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.mjs +5 -2
  3. package/esm2022/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.mjs +1 -1
  4. package/esm2022/libs/api/metadata-converter/src/lib/iso19139/utils/update-frequency.mapper.mjs +6 -62
  5. package/esm2022/libs/api/metadata-converter/src/lib/iso19139/write-parts.mjs +19 -1
  6. package/esm2022/libs/api/repository/src/lib/gn4/gn4-repository.mjs +27 -16
  7. package/esm2022/libs/common/domain/src/lib/model/record/metadata.model.mjs +27 -1
  8. package/esm2022/libs/common/domain/src/lib/repository/records-repository.interface.mjs +1 -1
  9. package/esm2022/libs/data-access/gn4/src/openapi/api/records.api.service.mjs +7 -1
  10. package/esm2022/libs/feature/editor/src/lib/+state/editor.actions.mjs +3 -1
  11. package/esm2022/libs/feature/editor/src/lib/+state/editor.effects.mjs +18 -14
  12. package/esm2022/libs/feature/editor/src/lib/+state/editor.facade.mjs +15 -5
  13. package/esm2022/libs/feature/editor/src/lib/+state/editor.reducer.mjs +10 -4
  14. package/esm2022/libs/feature/editor/src/lib/+state/editor.selectors.mjs +6 -5
  15. package/esm2022/libs/feature/editor/src/lib/components/constraint-card/constraint-card.component.mjs +3 -3
  16. package/esm2022/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.mjs +3 -3
  17. package/esm2022/libs/feature/editor/src/lib/components/import-record/import-record.component.mjs +2 -2
  18. package/esm2022/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.mjs +118 -12
  19. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.mjs +36 -23
  20. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.mjs +7 -12
  21. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.mjs +17 -12
  22. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.mjs +7 -13
  23. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.mjs +3 -3
  24. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.mjs +36 -60
  25. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.mjs +3 -3
  26. package/esm2022/libs/feature/editor/src/lib/components/record-form/record-form.component.mjs +3 -3
  27. package/esm2022/libs/feature/editor/src/lib/fields.config.mjs +11 -15
  28. package/esm2022/libs/feature/editor/src/lib/services/editor.service.mjs +9 -5
  29. package/esm2022/libs/feature/search/src/lib/results-table/results-table-container.component.mjs +3 -4
  30. package/esm2022/libs/ui/dataviz/src/lib/figure/figure.component.mjs +3 -3
  31. package/esm2022/libs/ui/elements/src/index.mjs +3 -2
  32. package/esm2022/libs/ui/elements/src/lib/image-input/image-input.component.mjs +213 -0
  33. package/esm2022/libs/ui/elements/src/lib/ui-elements.module.mjs +19 -13
  34. package/esm2022/libs/ui/inputs/src/index.mjs +5 -6
  35. package/esm2022/libs/ui/inputs/src/lib/button/button.component.mjs +2 -1
  36. package/esm2022/libs/ui/inputs/src/lib/file-input/file-input.component.mjs +5 -5
  37. package/esm2022/libs/ui/inputs/src/lib/ui-inputs.module.mjs +19 -25
  38. package/esm2022/libs/ui/inputs/src/lib/url-input/url-input.component.mjs +11 -6
  39. package/esm2022/libs/ui/layout/src/lib/interactive-table/interactive-table.component.mjs +9 -4
  40. package/esm2022/libs/ui/search/src/lib/results-table/results-table.component.mjs +10 -10
  41. package/esm2022/libs/util/shared/src/lib/links/link-utils.mjs +37 -1
  42. package/esm2022/translations/de.json +53 -17
  43. package/esm2022/translations/en.json +33 -16
  44. package/esm2022/translations/es.json +51 -15
  45. package/esm2022/translations/fr.json +37 -20
  46. package/esm2022/translations/it.json +266 -228
  47. package/esm2022/translations/nl.json +51 -15
  48. package/esm2022/translations/pt.json +51 -15
  49. package/fesm2022/geonetwork-ui.mjs +1805 -1420
  50. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  51. package/libs/api/metadata-converter/src/lib/gn4/gn4.converter.d.ts.map +1 -1
  52. package/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.d.ts.map +1 -1
  53. package/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.d.ts +1 -0
  54. package/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.d.ts.map +1 -1
  55. package/libs/api/metadata-converter/src/lib/iso19139/utils/update-frequency.mapper.d.ts.map +1 -1
  56. package/libs/api/metadata-converter/src/lib/iso19139/write-parts.d.ts.map +1 -1
  57. package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts +4 -3
  58. package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts.map +1 -1
  59. package/libs/common/domain/src/lib/model/record/metadata.model.d.ts +2 -1
  60. package/libs/common/domain/src/lib/model/record/metadata.model.d.ts.map +1 -1
  61. package/libs/common/domain/src/lib/repository/records-repository.interface.d.ts +4 -3
  62. package/libs/common/domain/src/lib/repository/records-repository.interface.d.ts.map +1 -1
  63. package/libs/data-access/gn4/src/openapi/api/records.api.service.d.ts +3 -0
  64. package/libs/data-access/gn4/src/openapi/api/records.api.service.d.ts.map +1 -1
  65. package/libs/feature/editor/src/lib/+state/editor.actions.d.ts +10 -2
  66. package/libs/feature/editor/src/lib/+state/editor.actions.d.ts.map +1 -1
  67. package/libs/feature/editor/src/lib/+state/editor.effects.d.ts +6 -2
  68. package/libs/feature/editor/src/lib/+state/editor.effects.d.ts.map +1 -1
  69. package/libs/feature/editor/src/lib/+state/editor.facade.d.ts +5 -2
  70. package/libs/feature/editor/src/lib/+state/editor.facade.d.ts.map +1 -1
  71. package/libs/feature/editor/src/lib/+state/editor.reducer.d.ts +2 -1
  72. package/libs/feature/editor/src/lib/+state/editor.reducer.d.ts.map +1 -1
  73. package/libs/feature/editor/src/lib/+state/editor.selectors.d.ts +2 -1
  74. package/libs/feature/editor/src/lib/+state/editor.selectors.d.ts.map +1 -1
  75. package/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.d.ts +52 -4
  76. package/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.d.ts.map +1 -1
  77. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.d.ts +4 -4
  78. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.d.ts.map +1 -1
  79. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.d.ts +1 -4
  80. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.d.ts.map +1 -1
  81. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.d.ts +6 -5
  82. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.d.ts.map +1 -1
  83. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.d.ts +1 -4
  84. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.d.ts.map +1 -1
  85. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.d.ts +1 -1
  86. 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
  87. package/libs/feature/editor/src/lib/fields.config.d.ts.map +1 -1
  88. package/libs/feature/editor/src/lib/services/editor.service.d.ts +1 -1
  89. package/libs/feature/editor/src/lib/services/editor.service.d.ts.map +1 -1
  90. package/libs/feature/search/src/lib/results-table/results-table-container.component.d.ts +0 -1
  91. package/libs/feature/search/src/lib/results-table/results-table-container.component.d.ts.map +1 -1
  92. package/libs/ui/elements/src/index.d.ts +2 -1
  93. package/libs/ui/elements/src/index.d.ts.map +1 -1
  94. package/libs/ui/elements/src/lib/image-input/image-input.component.d.ts.map +1 -0
  95. package/libs/ui/elements/src/lib/record-api-form/record-api-form.component.d.ts +1 -1
  96. package/libs/ui/elements/src/lib/ui-elements.module.d.ts +2 -1
  97. package/libs/ui/elements/src/lib/ui-elements.module.d.ts.map +1 -1
  98. package/libs/ui/inputs/src/index.d.ts +4 -5
  99. package/libs/ui/inputs/src/index.d.ts.map +1 -1
  100. package/libs/ui/inputs/src/lib/button/button.component.d.ts +1 -1
  101. package/libs/ui/inputs/src/lib/button/button.component.d.ts.map +1 -1
  102. package/libs/ui/inputs/src/lib/file-input/file-input.component.d.ts +1 -1
  103. package/libs/ui/inputs/src/lib/file-input/file-input.component.d.ts.map +1 -1
  104. package/libs/ui/inputs/src/lib/ui-inputs.module.d.ts +6 -7
  105. package/libs/ui/inputs/src/lib/ui-inputs.module.d.ts.map +1 -1
  106. package/libs/ui/inputs/src/lib/url-input/url-input.component.d.ts +5 -4
  107. package/libs/ui/inputs/src/lib/url-input/url-input.component.d.ts.map +1 -1
  108. package/libs/ui/layout/src/lib/interactive-table/interactive-table.component.d.ts +2 -1
  109. package/libs/ui/layout/src/lib/interactive-table/interactive-table.component.d.ts.map +1 -1
  110. package/libs/ui/search/src/lib/results-table/results-table.component.d.ts +3 -3
  111. package/libs/ui/search/src/lib/results-table/results-table.component.d.ts.map +1 -1
  112. package/libs/util/shared/src/lib/links/link-utils.d.ts +2 -1
  113. package/libs/util/shared/src/lib/links/link-utils.d.ts.map +1 -1
  114. package/package.json +1 -1
  115. package/src/libs/api/metadata-converter/src/lib/gn4/gn4.converter.ts +4 -3
  116. package/src/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.ts +8 -1
  117. package/src/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.ts +1 -0
  118. package/src/libs/api/metadata-converter/src/lib/iso19139/utils/update-frequency.mapper.ts +9 -62
  119. package/src/libs/api/metadata-converter/src/lib/iso19139/write-parts.ts +18 -0
  120. package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +53 -27
  121. package/src/libs/common/domain/src/lib/model/record/metadata.model.ts +29 -7
  122. package/src/libs/common/domain/src/lib/repository/records-repository.interface.ts +5 -4
  123. package/src/libs/common/fixtures/src/lib/elasticsearch/full-response.fixtures.ts +2 -2
  124. package/src/libs/common/fixtures/src/lib/elasticsearch/search-responses.fixtures.ts +16 -16
  125. package/src/libs/common/fixtures/src/lib/records.fixtures.ts +163 -0
  126. package/src/libs/data-access/gn4/src/openapi/api/records.api.service.ts +24 -4
  127. package/src/libs/feature/editor/src/lib/+state/editor.actions.ts +10 -1
  128. package/src/libs/feature/editor/src/lib/+state/editor.effects.ts +57 -31
  129. package/src/libs/feature/editor/src/lib/+state/editor.facade.ts +15 -9
  130. package/src/libs/feature/editor/src/lib/+state/editor.reducer.ts +18 -12
  131. package/src/libs/feature/editor/src/lib/+state/editor.selectors.ts +13 -8
  132. package/src/libs/feature/editor/src/lib/components/constraint-card/constraint-card.component.html +1 -1
  133. package/src/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.html +1 -1
  134. package/src/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.html +63 -6
  135. package/src/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.ts +145 -4
  136. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.html +1 -1
  137. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.ts +31 -19
  138. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.html +1 -10
  139. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.ts +1 -7
  140. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.html +12 -25
  141. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.ts +15 -10
  142. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.html +0 -9
  143. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.ts +3 -9
  144. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.html +6 -6
  145. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.ts +46 -74
  146. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +6 -3
  147. package/src/libs/feature/editor/src/lib/components/record-form/record-form.component.html +3 -6
  148. package/src/libs/feature/editor/src/lib/fields.config.ts +10 -14
  149. package/src/libs/feature/editor/src/lib/services/editor.service.ts +18 -16
  150. package/src/libs/feature/search/src/lib/results-table/results-table-container.component.html +0 -1
  151. package/src/libs/feature/search/src/lib/results-table/results-table-container.component.ts +0 -3
  152. package/src/libs/ui/dataviz/src/lib/figure/figure.component.html +1 -0
  153. package/src/libs/ui/elements/src/index.ts +2 -1
  154. package/src/libs/ui/{inputs → elements}/src/lib/image-input/image-input.component.html +4 -19
  155. package/src/libs/ui/{inputs → elements}/src/lib/image-input/image-input.component.ts +13 -9
  156. package/src/libs/ui/elements/src/lib/ui-elements.module.ts +13 -10
  157. package/src/libs/ui/inputs/src/index.ts +4 -5
  158. package/src/libs/ui/inputs/src/lib/button/button.component.ts +2 -1
  159. package/src/libs/ui/inputs/src/lib/file-input/file-input.component.ts +1 -1
  160. package/src/libs/ui/inputs/src/lib/ui-inputs.module.ts +22 -25
  161. package/src/libs/ui/inputs/src/lib/url-input/url-input.component.html +5 -3
  162. package/src/libs/ui/inputs/src/lib/url-input/url-input.component.ts +10 -2
  163. package/src/libs/ui/layout/src/lib/interactive-table/interactive-table.component.html +12 -1
  164. package/src/libs/ui/layout/src/lib/interactive-table/interactive-table.component.ts +4 -6
  165. package/src/libs/ui/search/src/lib/results-table/results-table.component.html +23 -6
  166. package/src/libs/ui/search/src/lib/results-table/results-table.component.ts +6 -6
  167. package/src/libs/util/shared/src/lib/links/link-utils.ts +48 -1
  168. package/tailwind.base.config.js +2 -0
  169. package/translations/de.json +53 -17
  170. package/translations/en.json +33 -16
  171. package/translations/es.json +51 -15
  172. package/translations/fr.json +37 -20
  173. package/translations/it.json +266 -228
  174. package/translations/nl.json +51 -15
  175. package/translations/pt.json +51 -15
  176. package/translations/sk.json +51 -15
  177. package/esm2022/libs/ui/inputs/src/lib/image-input/image-input.component.mjs +0 -214
  178. package/libs/ui/inputs/src/lib/image-input/image-input.component.d.ts.map +0 -1
  179. package/src/libs/api/metadata-converter/src/lib/dcat-ap/utils/update-frequency.mapper.ts +0 -67
  180. /package/libs/ui/{inputs → elements}/src/lib/image-input/image-input.component.d.ts +0 -0
  181. /package/src/libs/ui/{inputs → elements}/src/lib/image-input/image-input.component.css +0 -0
@@ -1,9 +1,13 @@
1
1
  import { CommonModule } from '@angular/common'
2
2
  import {
3
3
  ChangeDetectionStrategy,
4
+ ChangeDetectorRef,
4
5
  Component,
6
+ EventEmitter,
5
7
  Input,
6
8
  OnChanges,
9
+ OnInit,
10
+ Output,
7
11
  } from '@angular/core'
8
12
  import { FormsModule } from '@angular/forms'
9
13
  import { MatRadioModule } from '@angular/material/radio'
@@ -13,8 +17,28 @@ import {
13
17
  DatasetServiceDistribution,
14
18
  ServiceProtocol,
15
19
  } from '../../../../../../../libs/common/domain/src/lib/model/record'
16
- import { TextInputComponent } from '../../../../../../../libs/ui/inputs/src'
20
+ import {
21
+ AutocompleteComponent,
22
+ ButtonComponent,
23
+ TextInputComponent,
24
+ UrlInputComponent,
25
+ } from '../../../../../../../libs/ui/inputs/src'
17
26
  import { TranslateModule } from '@ngx-translate/core'
27
+ import {
28
+ NgIconComponent,
29
+ provideIcons,
30
+ provideNgIconsConfig,
31
+ } from '@ng-icons/core'
32
+ import { iconoirCloudUpload } from '@ng-icons/iconoir'
33
+ import { createFuzzyFilter, getLayers } from '../../../../../../../libs/util/shared/src'
34
+ import {
35
+ BehaviorSubject,
36
+ debounceTime,
37
+ distinctUntilChanged,
38
+ map,
39
+ Observable,
40
+ switchMap,
41
+ } from 'rxjs'
18
42
 
19
43
  @Component({
20
44
  selector: 'gn-ui-online-service-resource-input',
@@ -23,20 +47,41 @@ import { TranslateModule } from '@ngx-translate/core'
23
47
  changeDetection: ChangeDetectionStrategy.OnPush,
24
48
  standalone: true,
25
49
  imports: [
50
+ AutocompleteComponent,
51
+ ButtonComponent,
26
52
  CommonModule,
53
+ FormsModule,
27
54
  MatTooltipModule,
28
55
  MatRadioModule,
29
- FormsModule,
56
+ NgIconComponent,
30
57
  TextInputComponent,
31
58
  TranslateModule,
59
+ UrlInputComponent,
60
+ ],
61
+ providers: [
62
+ provideIcons({ iconoirCloudUpload }),
63
+ provideNgIconsConfig({
64
+ size: '1.5em',
65
+ }),
32
66
  ],
33
67
  })
34
- export class OnlineServiceResourceInputComponent implements OnChanges {
35
- @Input() service: Omit<DatasetServiceDistribution, 'url'>
68
+ export class OnlineServiceResourceInputComponent implements OnChanges, OnInit {
69
+ @Input() service: DatasetServiceDistribution
36
70
  @Input() protocolHint?: string
37
71
  @Input() disabled? = false
72
+ @Input() modifyMode? = false
73
+ @Output() urlChange: EventEmitter<string> = new EventEmitter()
74
+ @Output() identifierSubmit: EventEmitter<{
75
+ url: string
76
+ identifier: string
77
+ }> = new EventEmitter()
38
78
 
79
+ errorMessage = false
39
80
  selectedProtocol: ServiceProtocol
81
+ url = ''
82
+ layersSubject = new BehaviorSubject<{ name: string; title: string }[]>([])
83
+ layers$: Observable<{ name: string; title: string }[]> =
84
+ this.layersSubject.asObservable()
40
85
 
41
86
  protocolOptions: {
42
87
  label: string
@@ -72,10 +117,106 @@ export class OnlineServiceResourceInputComponent implements OnChanges {
72
117
  },
73
118
  ]
74
119
 
120
+ constructor(private cdr: ChangeDetectorRef) {}
121
+
122
+ get activeLayerSuggestion() {
123
+ return !['wps', 'GPFDL', 'esriRest', 'other'].includes(
124
+ this.service.accessServiceProtocol
125
+ )
126
+ }
127
+
75
128
  ngOnChanges() {
76
129
  this.selectedProtocol =
77
130
  this.protocolOptions.find(
78
131
  (option) => option.value === this.service.accessServiceProtocol
79
132
  )?.value ?? 'other'
80
133
  }
134
+
135
+ ngOnInit() {
136
+ if (this.service.url) {
137
+ this.url = this.service.url.toString()
138
+ }
139
+ }
140
+
141
+ handleUrlValueChange(url: string) {
142
+ this.url = url
143
+ this.service.url = url ? new URL(url) : undefined
144
+ this.resetLayersSuggestion()
145
+ this.urlChange.emit(this.url)
146
+ }
147
+
148
+ async handleUploadClick(url: string) {
149
+ this.url = url
150
+
151
+ try {
152
+ const layers = await getLayers(url, this.service.accessServiceProtocol)
153
+
154
+ if (layers.length === 0) {
155
+ throw new Error('No layers found')
156
+ }
157
+
158
+ this.layersSubject.next([...layers])
159
+ } catch (e) {
160
+ this.errorMessage = true
161
+ this.layersSubject.next([])
162
+ }
163
+
164
+ this.cdr.detectChanges()
165
+ }
166
+
167
+ resetAllFormFields() {
168
+ this.url = ''
169
+ this.service.url = null
170
+ this.resetLayersSuggestion()
171
+ }
172
+
173
+ resetLayersSuggestion() {
174
+ this.errorMessage = false
175
+ this.layersSubject.next([])
176
+ this.service.identifierInService = null
177
+ }
178
+
179
+ submitIdentifier(identifier: string) {
180
+ if (!identifier) return
181
+ this.identifierSubmit.emit({ url: this.url, identifier })
182
+ this.service.identifierInService = null
183
+ }
184
+
185
+ getIdentifierPlaceholder(): string {
186
+ const baseKey =
187
+ 'editor.record.form.field.onlineResource.edit.identifier.placeholder'
188
+ return this.service.accessServiceProtocol === 'wps'
189
+ ? `${baseKey}.wps`
190
+ : baseKey
191
+ }
192
+
193
+ /**
194
+ * gn-ui-autocomplete
195
+ */
196
+ displayWithFn(item: { name: string; title: string }) {
197
+ return item.title
198
+ ? `${item.title} ${item.name ? `(${item.name})` : ''}`
199
+ : item.name
200
+ }
201
+
202
+ /**
203
+ * gn-ui-autocomplete
204
+ */
205
+ autoCompleteAction = (query: string) => {
206
+ const fuzzyFilter = createFuzzyFilter(query)
207
+ return this.layers$.pipe(
208
+ switchMap((layers) => [
209
+ layers.filter((layer) => fuzzyFilter(layer.name)),
210
+ ]),
211
+ debounceTime(100),
212
+ distinctUntilChanged()
213
+ )
214
+ }
215
+
216
+ /**
217
+ * gn-ui-autocomplete
218
+ */
219
+ handleSelectValue(val: { name: string; title: string }) {
220
+ this.service.identifierInService = val.name
221
+ }
81
222
  }
@@ -2,7 +2,7 @@
2
2
  <gn-ui-dropdown-selector
3
3
  [title]="label"
4
4
  [showTitle]="false"
5
- [choices]="licenceOptions"
5
+ [choices]="choices"
6
6
  [selected]="selectedLicence"
7
7
  (selectValue)="handleLicenceSelection($event)"
8
8
  [extraBtnClass]="'input-as-button gn-ui-text-input'"
@@ -26,35 +26,47 @@ type Licence = {
26
26
  })
27
27
  export class FormFieldLicenseComponent implements OnInit {
28
28
  @Input() label: string
29
- @Input() recordConstraints: Constraint[] = []
30
- @Output() recordConstraintsChange: EventEmitter<Constraint[]> =
29
+ @Input() recordLicences: Constraint[] = []
30
+ @Output() recordLicencesChange: EventEmitter<Constraint[]> =
31
31
  new EventEmitter()
32
32
 
33
+ choices: Licence[] = AVAILABLE_LICENSES.map((license) => ({
34
+ label: marker(`editor.record.form.license.${license}`),
35
+ value: license,
36
+ }))
37
+
33
38
  selectedLicence: string
34
39
 
35
40
  ngOnInit(): void {
36
- // get the licence from the record constraints if it is one of the open data licence list
37
- this.selectedLicence = this.recordConstraints.find((constraint) => {
38
- return this.licenceOptions.find((licence) => {
39
- return licence.value === constraint.text
40
- })
41
- })?.text
42
- // otherwise pre-select the first licence option
43
- if (this.selectedLicence === undefined) {
44
- this.selectedLicence = this.licenceOptions[0].value // cannot select 'etalab' as default as this would toggle the OpenData Toggle
45
- this.recordConstraintsChange.emit([{ text: this.selectedLicence }])
41
+ if (this.recordLicences.length === 0) {
42
+ this.selectedLicence = 'unknown'
43
+ } else {
44
+ this.selectedLicence = this.recordLicences.find((constraint) => {
45
+ return this.choices.find((licence) => {
46
+ return licence.value === constraint.text
47
+ })
48
+ })?.text
46
49
  }
47
- }
48
50
 
49
- get licenceOptions(): Licence[] {
50
- return AVAILABLE_LICENSES.map((license) => ({
51
- label: marker(`editor.record.form.license.${license}`),
52
- value: license,
53
- }))
51
+ if (this.selectedLicence === undefined) {
52
+ this.choices = [
53
+ {
54
+ value: this.recordLicences[0].text,
55
+ label: this.recordLicences[0].text,
56
+ },
57
+ ...this.choices,
58
+ ]
59
+ this.selectedLicence = this.recordLicences[0].text
60
+ }
54
61
  }
55
62
 
56
63
  handleLicenceSelection(licenceValue: string) {
57
64
  this.selectedLicence = licenceValue
58
- this.recordConstraintsChange.emit([{ text: licenceValue }])
65
+ if (licenceValue === 'unknown') {
66
+ this.recordLicencesChange.emit([])
67
+ return
68
+ } else {
69
+ this.recordLicencesChange.emit([{ text: licenceValue }])
70
+ }
59
71
  }
60
72
  }
@@ -5,7 +5,6 @@
5
5
  (uploadCancel)="handleUploadCancel()"
6
6
  [uploadProgress]="uploadProgress"
7
7
  (urlChange)="handleUrlChange($event)"
8
- [disabled]="disabled$ | async"
9
8
  ></gn-ui-file-input>
10
9
  <div class="h-[8px]"></div>
11
10
  <gn-ui-sortable-list
@@ -42,17 +41,9 @@
42
41
  class="w-full"
43
42
  [disabled]="true"
44
43
  [value]="onlineResource.url"
45
- [showUploadButton]="false"
46
44
  [disabled]="disabled$ | async"
45
+ [showValidateButton]="false"
47
46
  ></gn-ui-url-input>
48
47
  </div>
49
48
  </ng-template>
50
- <div
51
- *ngIf="disabled$ | async"
52
- class="p-4 text-sm border border-primary bg-primary-lightest rounded-lg"
53
- translate
54
- data-test="disabled-message"
55
- >
56
- editor.record.form.field.draft.only.disabled
57
- </div>
58
49
  </div>
@@ -30,7 +30,6 @@ import { PlatformServiceInterface } from '../../../../../../../../../libs/common
30
30
  import { map, Subscription } from 'rxjs'
31
31
  import { MatDialog } from '@angular/material/dialog'
32
32
  import { MAX_UPLOAD_SIZE_MB } from '../../../../fields.config'
33
- import { EditorFacade } from '../../../../+state/editor.facade'
34
33
 
35
34
  @Component({
36
35
  selector: 'gn-ui-form-field-online-link-resources',
@@ -69,17 +68,12 @@ export class FormFieldOnlineLinkResourcesComponent {
69
68
 
70
69
  protected MAX_UPLOAD_SIZE_MB = MAX_UPLOAD_SIZE_MB
71
70
 
72
- disabled$ = this.editorFacade.alreadySavedOnce$.pipe(
73
- map((alreadySavedOnce) => !alreadySavedOnce)
74
- )
75
-
76
71
  constructor(
77
72
  private notificationsService: NotificationsService,
78
73
  private translateService: TranslateService,
79
74
  private platformService: PlatformServiceInterface,
80
75
  private cd: ChangeDetectorRef,
81
- private dialog: MatDialog,
82
- private editorFacade: EditorFacade
76
+ private dialog: MatDialog
83
77
  ) {}
84
78
 
85
79
  handleFileChange(file: File) {
@@ -4,7 +4,6 @@
4
4
  (selectedValue)="onSelectedTypeChange($event.value)"
5
5
  extraClasses="grow text-sm"
6
6
  data-cy="online-resources-type"
7
- [disabled]="disabled$ | async"
8
7
  ></gn-ui-switch-toggle>
9
8
  <div class="h-[8px]"></div>
10
9
  <gn-ui-file-input
@@ -14,7 +13,6 @@
14
13
  (uploadCancel)="handleUploadCancel()"
15
14
  [uploadProgress]="uploadProgress"
16
15
  (urlChange)="handleDownloadUrlChange($event)"
17
- [disabled]="disabled$ | async"
18
16
  ></gn-ui-file-input>
19
17
  <div
20
18
  *ngIf="selectedType === 'service'"
@@ -23,13 +21,8 @@
23
21
  <gn-ui-online-service-resource-input
24
22
  [service]="newService"
25
23
  [disabled]="disabled$ | async"
24
+ (identifierSubmit)="handleIdentifierSubmit($event)"
26
25
  ></gn-ui-online-service-resource-input>
27
- <span class="w-full border-b border-gray-300"></span>
28
- <gn-ui-url-input
29
- class="w-full"
30
- (uploadClick)="handleServiceUrlChange($event)"
31
- [disabled]="disabled$ | async"
32
- ></gn-ui-url-input>
33
26
  </div>
34
27
  <div class="h-[8px]"></div>
35
28
  <gn-ui-sortable-list
@@ -61,28 +54,22 @@
61
54
  [(value)]="onlineResource.description"
62
55
  ></gn-ui-text-area>
63
56
  </div>
64
- <ng-container *ngIf="onlineResource.type === 'service'">
57
+ <ng-container *ngIf="onlineResource.type === 'service'; else urlInput">
65
58
  <span class="w-full border-b border-gray-300"></span>
66
59
  <gn-ui-online-service-resource-input
67
60
  [service]="onlineResource"
68
- [disabled]="disabled$ | async"
61
+ [modifyMode]="true"
69
62
  ></gn-ui-online-service-resource-input>
70
63
  </ng-container>
71
- <span class="w-full border-b border-gray-300"></span>
72
- <gn-ui-url-input
73
- class="w-full"
74
- [disabled]="true"
75
- [value]="onlineResource.url"
76
- [showUploadButton]="false"
77
- ></gn-ui-url-input>
64
+ <ng-template #urlInput>
65
+ <span class="w-full border-b border-gray-300"></span>
66
+ <gn-ui-url-input
67
+ class="w-full"
68
+ [disabled]="true"
69
+ [value]="onlineResource.url"
70
+ [showValidateButton]="false"
71
+ ></gn-ui-url-input>
72
+ </ng-template>
78
73
  </div>
79
74
  </ng-template>
80
- <div
81
- *ngIf="disabled$ | async"
82
- class="p-4 text-sm border border-primary bg-primary-lightest rounded-lg"
83
- translate
84
- data-test="disabled-message"
85
- >
86
- editor.record.form.field.draft.only.disabled
87
- </div>
88
75
  </div>
@@ -32,11 +32,10 @@ import {
32
32
  SortableListComponent,
33
33
  } from '../../../../../../../../../libs/ui/layout/src'
34
34
  import { TranslateModule, TranslateService } from '@ngx-translate/core'
35
- import { map, Subscription } from 'rxjs'
35
+ import { Subscription } from 'rxjs'
36
36
  import { MAX_UPLOAD_SIZE_MB } from '../../../../fields.config'
37
37
  import { OnlineResourceCardComponent } from '../../../online-resource-card/online-resource-card.component'
38
38
  import { OnlineServiceResourceInputComponent } from '../../../online-service-resource-input/online-service-resource-input.component'
39
- import { EditorFacade } from '../../../../+state/editor.facade'
40
39
 
41
40
  type OnlineNotLinkResource =
42
41
  | DatasetDownloadDistribution
@@ -93,25 +92,21 @@ export class FormFieldOnlineResourcesComponent {
93
92
  notLinkResources: OnlineNotLinkResource[] = []
94
93
  uploadProgress = undefined
95
94
  uploadSubscription: Subscription = null
96
- newService = {
95
+ newService = <DatasetServiceDistribution>{
97
96
  type: 'service',
98
97
  accessServiceProtocol: 'ogcFeatures',
99
98
  identifierInService: '',
100
- } as Omit<DatasetServiceDistribution, 'url'>
99
+ url: undefined,
100
+ }
101
101
 
102
102
  protected MAX_UPLOAD_SIZE_MB = MAX_UPLOAD_SIZE_MB
103
103
 
104
- disabled$ = this.editorFacade.alreadySavedOnce$.pipe(
105
- map((alreadySavedOnce) => !alreadySavedOnce)
106
- )
107
-
108
104
  constructor(
109
105
  private notificationsService: NotificationsService,
110
106
  private translateService: TranslateService,
111
107
  private platformService: PlatformServiceInterface,
112
108
  private cd: ChangeDetectorRef,
113
- private dialog: MatDialog,
114
- private editorFacade: EditorFacade
109
+ private dialog: MatDialog
115
110
  ) {}
116
111
 
117
112
  onSelectedTypeChange(selectedType: unknown) {
@@ -174,6 +169,16 @@ export class FormFieldOnlineResourcesComponent {
174
169
  ])
175
170
  }
176
171
 
172
+ handleIdentifierSubmit(payload: { url: string; identifier: string }) {
173
+ this.valueChange.emit([
174
+ ...this.allResources,
175
+ {
176
+ ...this.newService,
177
+ url: new URL(payload.url),
178
+ },
179
+ ])
180
+ }
181
+
177
182
  handleServiceModify(
178
183
  oldService: DatasetServiceDistribution,
179
184
  newService: DatasetServiceDistribution
@@ -9,14 +9,5 @@
9
9
  (delete)="handleDelete()"
10
10
  [uploadProgress]="uploadProgress"
11
11
  (uploadCancel)="handleUploadCancel()"
12
- [disabled]="disabled$ | async"
13
12
  ></gn-ui-image-input>
14
- <div
15
- *ngIf="disabled$ | async"
16
- class="p-4 text-sm border border-primary bg-primary-lightest rounded-lg"
17
- translate
18
- data-test="disabled-message"
19
- >
20
- editor.record.form.field.draft.only.disabled
21
- </div>
22
13
  </div>
@@ -8,13 +8,12 @@ import {
8
8
  Output,
9
9
  } from '@angular/core'
10
10
  import { GraphicOverview } from '../../../../../../../../../libs/common/domain/src/lib/model/record'
11
- import { ImageInputComponent } from '../../../../../../../../../libs/ui/inputs/src'
11
+ import { ImageInputComponent } from '../../../../../../../../../libs/ui/elements/src'
12
12
  import { PlatformServiceInterface } from '../../../../../../../../../libs/common/domain/src/lib/platform.service.interface'
13
13
  import { NotificationsService } from '../../../../../../../../../libs/feature/notifications/src'
14
14
  import { TranslateModule, TranslateService } from '@ngx-translate/core'
15
- import { map, Subscription } from 'rxjs'
15
+ import { Subscription } from 'rxjs'
16
16
  import { MAX_UPLOAD_SIZE_MB } from '../../../../fields.config'
17
- import { EditorFacade } from '../../../../+state/editor.facade'
18
17
 
19
18
  @Component({
20
19
  selector: 'gn-ui-form-field-overviews',
@@ -30,10 +29,6 @@ export class FormFieldOverviewsComponent {
30
29
  @Output() valueChange: EventEmitter<Array<GraphicOverview>> =
31
30
  new EventEmitter()
32
31
 
33
- disabled$ = this.editorFacade.alreadySavedOnce$.pipe(
34
- map((alreadySavedOnce) => !alreadySavedOnce)
35
- )
36
-
37
32
  uploadProgress = undefined
38
33
  uploadSubscription: Subscription = null
39
34
 
@@ -52,8 +47,7 @@ export class FormFieldOverviewsComponent {
52
47
  private platformService: PlatformServiceInterface,
53
48
  private notificationsService: NotificationsService,
54
49
  private translateService: TranslateService,
55
- private cd: ChangeDetectorRef,
56
- private editorFacade: EditorFacade
50
+ private cd: ChangeDetectorRef
57
51
  ) {}
58
52
 
59
53
  handleFileChange(file: File) {
@@ -1,4 +1,4 @@
1
- <div class="flex flex-col gap-8">
1
+ <div class="flex flex-col gap-3">
2
2
  <gn-ui-generic-keywords
3
3
  [placeholder]="'Search for place keywords'"
4
4
  [keywords]="shownKeywords$ | async"
@@ -7,9 +7,9 @@
7
7
  (addedKeyword)="handleKeywordAdd($event)"
8
8
  >
9
9
  </gn-ui-generic-keywords>
10
- </div>
11
- <div class="w-full h-96 mt-2">
12
- <gn-ui-form-field-map-container
13
- [spatialExtents]="spatialExtents$ | async"
14
- ></gn-ui-form-field-map-container>
10
+ <div class="w-full h-96 mt-2">
11
+ <gn-ui-form-field-map-container
12
+ [spatialExtents]="spatialExtents$ | async"
13
+ ></gn-ui-form-field-map-container>
14
+ </div>
15
15
  </div>