geonetwork-ui 2.11.0-dev.e7b8ec331 → 2.11.0-dev.fa83d0484
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/geonetwork-ui.mjs +2652 -1670
- package/fesm2022/geonetwork-ui.mjs.map +1 -1
- package/index.d.ts +465 -187
- package/index.d.ts.map +1 -1
- package/package.json +13 -11
- package/src/libs/api/metadata-converter/src/lib/dcat-ap/dcat-ap.converter.ts +2 -0
- package/src/libs/api/metadata-converter/src/lib/fixtures/mel.records.dataset+featurecatalog.ts +395 -0
- package/src/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.ts +78 -21
- package/src/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.ts +19 -0
- package/src/libs/api/metadata-converter/src/lib/iso19115-3/iso19115-3.converter.ts +17 -6
- package/src/libs/api/metadata-converter/src/lib/iso19115-3/read-parts.ts +110 -0
- package/src/libs/api/metadata-converter/src/lib/iso19115-3/write-parts.ts +131 -0
- package/src/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.ts +9 -0
- package/src/libs/api/metadata-converter/src/lib/iso19139/read-parts.ts +2 -1
- package/src/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.ts +160 -54
- package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +123 -51
- package/src/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts +11 -0
- package/src/libs/common/domain/src/lib/model/record/flags.model.ts +1 -0
- package/src/libs/common/domain/src/lib/model/record/index.ts +1 -0
- package/src/libs/common/domain/src/lib/model/record/metadata.model.ts +26 -18
- package/src/libs/common/domain/src/lib/model/search/aggregation.model.ts +2 -0
- package/src/libs/common/domain/src/lib/model/search/filter.model.ts +24 -2
- package/src/libs/common/domain/src/lib/platform.service.interface.ts +1 -0
- package/src/libs/common/domain/src/lib/repository/records-repository.interface.ts +22 -3
- package/src/libs/common/fixtures/src/lib/records.fixtures.ts +42 -62
- package/src/libs/feature/dataviz/src/lib/chart-view/chart-view.component.ts +3 -2
- package/src/libs/feature/dataviz/src/lib/geo-table-view/geo-table-view.component.ts +2 -1
- package/src/libs/feature/dataviz/src/lib/service/data.service.ts +54 -41
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-constraints/form-field-constraints.component.ts +3 -5
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts/form-field-contacts.component.ts +2 -2
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-record-flags/form-field-record-flag-component.html +18 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-record-flags/form-field-record-flag-component.ts +86 -0
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +100 -88
- package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts +11 -4
- package/src/libs/feature/editor/src/lib/components/record-form/record-form.component.ts +18 -4
- package/src/libs/feature/editor/src/lib/expressions.ts +67 -0
- package/src/libs/feature/editor/src/lib/fields.config.ts +13 -0
- package/src/libs/feature/editor/src/lib/models/editor-config.model.ts +10 -4
- package/src/libs/feature/map/src/index.ts +0 -2
- package/src/libs/feature/map/src/lib/add-layer-from-file/add-layer-from-file.component.html +1 -0
- package/src/libs/feature/map/src/lib/feature-map.module.ts +1 -8
- package/src/libs/feature/notifications/src/lib/notifications.service.ts +6 -4
- package/src/libs/feature/notify-reuse/src/lib/notify-reuse-form/notify-reuse-form.component.ts +8 -3
- package/src/libs/feature/record/src/lib/state/mdview.actions.ts +4 -8
- package/src/libs/feature/record/src/lib/state/mdview.effects.ts +10 -17
- package/src/libs/feature/record/src/lib/state/mdview.facade.ts +2 -4
- package/src/libs/feature/record/src/lib/state/mdview.reducer.ts +4 -9
- package/src/libs/feature/record/src/lib/state/mdview.selectors.ts +2 -7
- package/src/libs/feature/router/src/lib/default/state/query-params.utils.ts +1 -1
- package/src/libs/feature/search/src/index.ts +2 -0
- package/src/libs/feature/search/src/lib/filter-dropdown/filter-dropdown.component.html +18 -4
- package/src/libs/feature/search/src/lib/filter-dropdown/filter-dropdown.component.ts +80 -19
- package/src/libs/feature/search/src/lib/geocoding/geocoding.service.ts +105 -0
- package/src/libs/feature/search/src/lib/location-search/location-search.component.html +18 -0
- package/src/libs/feature/search/src/lib/location-search/location-search.component.ts +114 -0
- package/src/libs/feature/search/src/lib/search-filters-summary-item/search-filters-summary-item.component.ts +19 -8
- package/src/libs/feature/search/src/lib/state/reducer.ts +1 -4
- package/src/libs/feature/search/src/lib/utils/service/fields.service.ts +64 -4
- package/src/libs/feature/search/src/lib/utils/service/fields.ts +94 -10
- package/src/libs/ui/dataviz/src/lib/data-table/data-table.component.html +6 -7
- package/src/libs/ui/dataviz/src/lib/data-table/data-table.component.ts +31 -19
- package/src/libs/ui/dataviz/src/lib/data-table/data-table.fixtures.ts +2 -2
- package/src/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.html +3 -3
- package/src/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.ts +2 -2
- package/src/libs/ui/elements/src/lib/service-capabilities/service-capabilities.component.ts +2 -1
- package/src/libs/ui/inputs/src/index.ts +2 -0
- package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.css +0 -4
- package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.html +12 -3
- package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts +11 -3
- package/src/libs/ui/inputs/src/lib/date-adapter.providers.ts +30 -0
- package/src/libs/ui/inputs/src/lib/date-picker/date-picker.component.ts +3 -24
- package/src/libs/ui/inputs/src/lib/date-range-dropdown/date-range-dropdown.component.css +37 -3
- package/src/libs/ui/inputs/src/lib/date-range-dropdown/date-range-dropdown.component.html +135 -16
- package/src/libs/ui/inputs/src/lib/date-range-dropdown/date-range-dropdown.component.ts +166 -29
- package/src/libs/ui/inputs/src/lib/date-range-picker/date-range-picker.component.ts +3 -7
- package/src/libs/ui/inputs/src/lib/drag-and-drop-file-input/drag-and-drop-file-input.component.css +1 -0
- package/src/libs/ui/inputs/src/lib/drag-and-drop-file-input/drag-and-drop-file-input.component.html +20 -7
- package/src/libs/ui/inputs/src/lib/drag-and-drop-file-input/drag-and-drop-file-input.component.ts +46 -5
- package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.component.html +7 -4
- package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.component.ts +12 -9
- package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.model.ts +2 -2
- package/src/libs/ui/inputs/src/lib/search-feature-catalog/search-feature-catalog.component.ts +2 -1
- package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.css +0 -0
- package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.html +117 -0
- package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.ts +244 -0
- package/src/libs/ui/layout/src/lib/block-list/block-list.component.css +1 -0
- package/src/libs/ui/map/src/lib/components/map-container/map-container.component.ts +6 -5
- package/src/libs/util/app-config/src/index.ts +1 -0
- package/src/libs/util/app-config/src/lib/app-config.ts +338 -247
- package/src/libs/util/app-config/src/lib/fixtures.ts +37 -1
- package/src/libs/util/app-config/src/lib/model.ts +42 -1
- package/src/libs/util/app-config/src/lib/parse-utils.ts +8 -4
- package/src/libs/util/data-fetcher/src/lib/data-fetcher.ts +19 -22
- package/src/libs/util/data-fetcher/src/lib/engine/duckdb.ts +185 -0
- package/src/libs/util/data-fetcher/src/lib/engine/results.ts +63 -0
- package/src/libs/util/data-fetcher/src/lib/{sql-utils.ts → engine/sql-utils.ts} +28 -13
- package/src/libs/util/data-fetcher/src/lib/model.ts +2 -1
- package/src/libs/util/data-fetcher/src/lib/readers/base-file.ts +53 -38
- package/src/libs/util/data-fetcher/src/lib/readers/base.ts +11 -0
- package/src/libs/util/data-fetcher/src/lib/readers/csv.ts +9 -47
- package/src/libs/util/data-fetcher/src/lib/readers/excel.ts +27 -27
- package/src/libs/util/data-fetcher/src/lib/readers/geojson.ts +5 -24
- package/src/libs/util/data-fetcher/src/lib/readers/gml.ts +5 -49
- package/src/libs/util/data-fetcher/src/lib/readers/json.ts +5 -23
- package/src/libs/util/data-fetcher/src/lib/readers/wfs.ts +184 -128
- package/src/libs/util/data-fetcher/src/lib/utils.ts +0 -143
- package/src/libs/util/shared/src/index.ts +1 -0
- package/src/libs/util/shared/src/lib/autofocus.directive.ts +26 -0
- package/src/libs/util/shared/src/lib/links/link-utils.ts +19 -10
- package/src/libs/util/shared/src/lib/services/date.service.ts +3 -3
- package/src/libs/util/shared/src/lib/utils/file.ts +15 -0
- package/src/libs/util/shared/src/lib/utils/geojson.ts +45 -10
- package/src/libs/util/shared/src/lib/utils/index.ts +1 -0
- package/tailwind.base.css +5 -0
- package/translations/de.json +29 -4
- package/translations/en.json +28 -3
- package/translations/es.json +27 -2
- package/translations/fr.json +33 -8
- package/translations/it.json +27 -2
- package/translations/nl.json +27 -2
- package/translations/pt.json +27 -2
- package/translations/sk.json +27 -2
- package/src/libs/feature/map/src/lib/geocoding/geocoding.component.html +0 -41
- package/src/libs/feature/map/src/lib/geocoding/geocoding.component.ts +0 -112
- package/src/libs/feature/map/src/lib/geocoding.service.ts +0 -57
- package/src/libs/feature/map/src/lib/style/index.ts +0 -2
- package/src/libs/feature/map/src/lib/style/map-style.fixtures.ts +0 -47
- package/src/libs/feature/map/src/lib/style/map-style.service.ts +0 -108
- package/src/libs/util/data-fetcher/src/lib/readers/base-cache.ts +0 -14
- /package/src/libs/feature/{map/src/lib/geocoding/geocoding.component.css → editor/src/lib/components/record-form/form-field/form-field-record-flags/form-field-record-flag-component.css} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { inject, Injectable } from '@angular/core'
|
|
2
2
|
import { marker } from '@biesbjerg/ngx-translate-extract-marker'
|
|
3
3
|
import {
|
|
4
|
+
GetCollectionItemsOptions,
|
|
4
5
|
OgcApiCollectionInfo,
|
|
5
6
|
OgcApiEndpoint,
|
|
6
7
|
OgcApiRecord,
|
|
7
|
-
WfsEndpoint,
|
|
8
|
-
WfsVersion,
|
|
9
|
-
TmsEndpoint,
|
|
10
8
|
StacEndpoint,
|
|
11
|
-
GetCollectionItemsOptions,
|
|
12
9
|
StacItemsDocument,
|
|
10
|
+
TmsEndpoint,
|
|
11
|
+
WfsEndpoint,
|
|
12
|
+
WfsVersion,
|
|
13
13
|
} from '@camptocamp/ogc-client'
|
|
14
14
|
import {
|
|
15
15
|
BaseReader,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from '../../../../../../libs/util/shared/src'
|
|
27
27
|
import type { FeatureCollection } from 'geojson'
|
|
28
28
|
import { from, Observable, throwError } from 'rxjs'
|
|
29
|
-
import { catchError, map, switchMap
|
|
29
|
+
import { catchError, map, switchMap } from 'rxjs/operators'
|
|
30
30
|
import {
|
|
31
31
|
DatasetOnlineResource,
|
|
32
32
|
DatasetServiceDistribution,
|
|
@@ -209,7 +209,8 @@ export class DataService {
|
|
|
209
209
|
ogcApiLink: DatasetServiceDistribution
|
|
210
210
|
): Promise<DatasetOnlineResource[]> {
|
|
211
211
|
const collectionInfo = await this.getDownloadUrlsFromOgcApi(
|
|
212
|
-
ogcApiLink.url.href
|
|
212
|
+
ogcApiLink.url.href,
|
|
213
|
+
ogcApiLink.name
|
|
213
214
|
)
|
|
214
215
|
|
|
215
216
|
return Object.keys(collectionInfo.bulkDownloadLinks).map((mimeType) => {
|
|
@@ -229,31 +230,41 @@ export class DataService {
|
|
|
229
230
|
})
|
|
230
231
|
}
|
|
231
232
|
|
|
232
|
-
async
|
|
233
|
+
private async getTargetCollectionId(
|
|
234
|
+
endpoint: OgcApiEndpoint,
|
|
235
|
+
collectionId?: string
|
|
236
|
+
): Promise<string | undefined> {
|
|
237
|
+
const collections = await endpoint.featureCollections
|
|
238
|
+
return collections.length === 1 && !collectionId
|
|
239
|
+
? collections[0]
|
|
240
|
+
: collectionId
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
async getDownloadUrlsFromOgcApi(
|
|
244
|
+
url: string,
|
|
245
|
+
collectionId?: string
|
|
246
|
+
): Promise<OgcApiCollectionInfo> {
|
|
233
247
|
const endpoint = new OgcApiEndpoint(url)
|
|
234
|
-
|
|
235
|
-
.
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
.
|
|
239
|
-
|
|
240
|
-
})
|
|
248
|
+
try {
|
|
249
|
+
const id = await this.getTargetCollectionId(endpoint, collectionId)
|
|
250
|
+
return await endpoint.getCollectionInfo(id)
|
|
251
|
+
} catch {
|
|
252
|
+
throw new Error('ogc.unreachable.unknown')
|
|
253
|
+
}
|
|
241
254
|
}
|
|
242
255
|
|
|
243
256
|
async getItemsFromOgcApi(
|
|
244
257
|
url: string,
|
|
258
|
+
collectionId?: string,
|
|
245
259
|
limit?: number
|
|
246
260
|
): Promise<OgcApiRecord[]> {
|
|
247
261
|
const endpoint = new OgcApiEndpoint(url)
|
|
248
|
-
|
|
249
|
-
.
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
.catch(() => {
|
|
255
|
-
throw new Error(`ogc.unreachable.unknown`)
|
|
256
|
-
})
|
|
262
|
+
try {
|
|
263
|
+
const id = await this.getTargetCollectionId(endpoint, collectionId)
|
|
264
|
+
return await endpoint.getCollectionItems(id, limit)
|
|
265
|
+
} catch {
|
|
266
|
+
throw new Error('ogc.unreachable.unknown')
|
|
267
|
+
}
|
|
257
268
|
}
|
|
258
269
|
|
|
259
270
|
async getItemsFromStacApi(
|
|
@@ -347,14 +358,11 @@ export class DataService {
|
|
|
347
358
|
if (link.type === 'service' && link.accessServiceProtocol === 'wfs') {
|
|
348
359
|
const wfsUrlEndpoint = this.proxy.getProxiedUrl(link.url.toString())
|
|
349
360
|
return from(
|
|
350
|
-
openDataset(
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
},
|
|
356
|
-
cacheActive
|
|
357
|
-
)
|
|
361
|
+
openDataset(wfsUrlEndpoint, {
|
|
362
|
+
typeHint: 'wfs',
|
|
363
|
+
wfsFeatureType: link.name,
|
|
364
|
+
enableCache: cacheActive,
|
|
365
|
+
})
|
|
358
366
|
)
|
|
359
367
|
} else if (link.type === 'download') {
|
|
360
368
|
const linkProxifiedUrl = this.proxy.getProxiedUrl(link.url.toString())
|
|
@@ -364,7 +372,10 @@ export class DataService {
|
|
|
364
372
|
? (format as SupportedType)
|
|
365
373
|
: undefined
|
|
366
374
|
return from(
|
|
367
|
-
openDataset(linkProxifiedUrl,
|
|
375
|
+
openDataset(linkProxifiedUrl, {
|
|
376
|
+
typeHint: supportedType,
|
|
377
|
+
enableCache: cacheActive,
|
|
378
|
+
})
|
|
368
379
|
).pipe()
|
|
369
380
|
} else if (
|
|
370
381
|
link.type === 'service' &&
|
|
@@ -374,12 +385,16 @@ export class DataService {
|
|
|
374
385
|
link.url.toString(),
|
|
375
386
|
'geojson'
|
|
376
387
|
)
|
|
377
|
-
return from(
|
|
388
|
+
return from(
|
|
389
|
+
openDataset(url, { typeHint: 'geojson', enableCache: cacheActive })
|
|
390
|
+
).pipe()
|
|
378
391
|
} else if (
|
|
379
392
|
link.type === 'service' &&
|
|
380
393
|
link.accessServiceProtocol === 'ogcFeatures'
|
|
381
394
|
) {
|
|
382
|
-
return from(
|
|
395
|
+
return from(
|
|
396
|
+
this.getDownloadUrlsFromOgcApi(link.url.href, link.name)
|
|
397
|
+
).pipe(
|
|
383
398
|
switchMap((collectionInfo) => {
|
|
384
399
|
const isMimeTypeJson = (mimeType: string): boolean => {
|
|
385
400
|
return mimeType.toLowerCase().indexOf('json') > -1
|
|
@@ -395,12 +410,10 @@ export class DataService {
|
|
|
395
410
|
}
|
|
396
411
|
const urlWithoutLimit = new URL(geojsonUrl)
|
|
397
412
|
urlWithoutLimit.searchParams.delete('limit')
|
|
398
|
-
return openDataset(
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
cacheActive
|
|
403
|
-
)
|
|
413
|
+
return openDataset(urlWithoutLimit.toString(), {
|
|
414
|
+
typeHint: 'geojson',
|
|
415
|
+
enableCache: cacheActive,
|
|
416
|
+
})
|
|
404
417
|
})
|
|
405
418
|
)
|
|
406
419
|
}
|
|
@@ -9,10 +9,7 @@ import {
|
|
|
9
9
|
|
|
10
10
|
import { SortableListComponent } from '../../../../../../../../../libs/ui/layout/src'
|
|
11
11
|
import { ConstraintCardComponent } from '../../../constraint-card/constraint-card.component'
|
|
12
|
-
import {
|
|
13
|
-
CatalogRecordKeys,
|
|
14
|
-
Constraint,
|
|
15
|
-
} from '../../../../../../../../../libs/common/domain/src/lib/model/record'
|
|
12
|
+
import { Constraint } from '../../../../../../../../../libs/common/domain/src/lib/model/record'
|
|
16
13
|
import { ButtonComponent } from '../../../../../../../../../libs/ui/inputs/src'
|
|
17
14
|
import { marker } from '@biesbjerg/ngx-translate-extract-marker'
|
|
18
15
|
import { TranslatePipe } from '@ngx-translate/core'
|
|
@@ -22,6 +19,7 @@ import {
|
|
|
22
19
|
provideNgIconsConfig,
|
|
23
20
|
} from '@ng-icons/core'
|
|
24
21
|
import { iconoirPlus } from '@ng-icons/iconoir'
|
|
22
|
+
import { FormFieldModel } from '../../../../models'
|
|
25
23
|
|
|
26
24
|
marker('editor.record.form.constraint.add.legalConstraints')
|
|
27
25
|
marker('editor.record.form.constraint.add.securityConstraints')
|
|
@@ -53,7 +51,7 @@ marker('editor.record.form.constraint.header.otherConstraints')
|
|
|
53
51
|
export class FormFieldConstraintsComponent implements OnInit {
|
|
54
52
|
@Input() label: string
|
|
55
53
|
@Input() value: Constraint[]
|
|
56
|
-
@Input() constraintType:
|
|
54
|
+
@Input() constraintType: FormFieldModel
|
|
57
55
|
@Output() valueChange = new EventEmitter<Constraint[]>()
|
|
58
56
|
|
|
59
57
|
constraintsHeader = ''
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
} from '../../../../../../../../../libs/util/shared/src'
|
|
37
37
|
import { map } from 'rxjs/operators'
|
|
38
38
|
import { SortableListComponent } from '../../../../../../../../../libs/ui/layout/src'
|
|
39
|
-
import {
|
|
39
|
+
import { FormFieldModelSpecifier } from '../../../../models/editor-config.model'
|
|
40
40
|
|
|
41
41
|
@Component({
|
|
42
42
|
selector: 'gn-ui-form-field-contacts',
|
|
@@ -59,7 +59,7 @@ export class FormFieldContactsComponent implements OnDestroy, OnChanges {
|
|
|
59
59
|
private changeDetectorRef = inject(ChangeDetectorRef)
|
|
60
60
|
|
|
61
61
|
@Input() value: Individual[]
|
|
62
|
-
@Input() modelSpecifier:
|
|
62
|
+
@Input() modelSpecifier: FormFieldModelSpecifier
|
|
63
63
|
@Output() valueChange: EventEmitter<Individual[]> = new EventEmitter()
|
|
64
64
|
|
|
65
65
|
contacts: Individual[] = []
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<div class="flex-1 flex justify-between items-center">
|
|
2
|
+
<gn-ui-check-toggle
|
|
3
|
+
[label]="labelKey() | translate"
|
|
4
|
+
[value]="initialValue$ | async"
|
|
5
|
+
(toggled)="onToggle($event)"
|
|
6
|
+
[attr.data-cy]="'record-flag-toggle-' + flagName()"
|
|
7
|
+
></gn-ui-check-toggle>
|
|
8
|
+
|
|
9
|
+
@if (hintKey()) {
|
|
10
|
+
<ng-icon
|
|
11
|
+
name="matHelpOutline"
|
|
12
|
+
size="16"
|
|
13
|
+
class="m-2"
|
|
14
|
+
[matTooltip]="hintKey() | translate"
|
|
15
|
+
matTooltipPosition="above"
|
|
16
|
+
></ng-icon>
|
|
17
|
+
}
|
|
18
|
+
</div>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
inject,
|
|
5
|
+
input,
|
|
6
|
+
} from '@angular/core'
|
|
7
|
+
import { AsyncPipe } from '@angular/common'
|
|
8
|
+
import { CheckToggleComponent } from '../../../../../../../../../libs/ui/inputs/src'
|
|
9
|
+
import { EditorFacade } from '../../../../+state/editor.facade'
|
|
10
|
+
import { TranslatePipe, TranslateService } from '@ngx-translate/core'
|
|
11
|
+
import { RecordFlag } from '../../../../../../../../../libs/common/domain/src/lib/model'
|
|
12
|
+
import { RecordsRepositoryInterface } from '../../../../../../../../../libs/common/domain/src/lib/repository/records-repository.interface'
|
|
13
|
+
import { toSignal } from '@angular/core/rxjs-interop'
|
|
14
|
+
import { filter } from 'rxjs'
|
|
15
|
+
import { NgIcon, provideIcons } from '@ng-icons/core'
|
|
16
|
+
import { MatTooltip } from '@angular/material/tooltip'
|
|
17
|
+
import { map, switchMap } from 'rxjs/operators'
|
|
18
|
+
import { matHelpOutline } from '@ng-icons/material-icons/outline'
|
|
19
|
+
import { NotificationsService } from '../../../../../../../../../libs/feature/notifications/src'
|
|
20
|
+
|
|
21
|
+
@Component({
|
|
22
|
+
selector: 'gn-ui-form-field-record-flag',
|
|
23
|
+
standalone: true,
|
|
24
|
+
imports: [AsyncPipe, CheckToggleComponent, TranslatePipe, NgIcon, MatTooltip],
|
|
25
|
+
viewProviders: [
|
|
26
|
+
provideIcons({
|
|
27
|
+
matHelpOutline,
|
|
28
|
+
}),
|
|
29
|
+
],
|
|
30
|
+
templateUrl: './form-field-record-flag-component.html',
|
|
31
|
+
styleUrls: ['./form-field-record-flag-component.css'],
|
|
32
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
33
|
+
})
|
|
34
|
+
export class FormFieldRecordFlagComponent {
|
|
35
|
+
flagName = input<RecordFlag>()
|
|
36
|
+
labelKey = input<string>()
|
|
37
|
+
hintKey = input<string>()
|
|
38
|
+
|
|
39
|
+
private editorFacade = inject(EditorFacade)
|
|
40
|
+
private repository = inject(RecordsRepositoryInterface)
|
|
41
|
+
private notificationsService = inject(NotificationsService)
|
|
42
|
+
private translateService = inject(TranslateService)
|
|
43
|
+
|
|
44
|
+
private record = toSignal(this.editorFacade.record$)
|
|
45
|
+
|
|
46
|
+
recordKind = toSignal(
|
|
47
|
+
this.editorFacade.record$.pipe(map((record) => record.kind))
|
|
48
|
+
)
|
|
49
|
+
initialValue$ = this.editorFacade.record$.pipe(
|
|
50
|
+
filter((record) => !!record),
|
|
51
|
+
switchMap((record) =>
|
|
52
|
+
this.repository.getRecordFlag(record.uniqueIdentifier, this.flagName())
|
|
53
|
+
)
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
onToggle(enabled: boolean) {
|
|
57
|
+
if (this.record() === null) {
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
this.repository
|
|
61
|
+
.setRecordFlag(this.record().uniqueIdentifier, this.flagName(), enabled)
|
|
62
|
+
.subscribe({
|
|
63
|
+
next: () => {
|
|
64
|
+
// do nothing
|
|
65
|
+
},
|
|
66
|
+
error: (error) => {
|
|
67
|
+
this.notificationsService.showNotification(
|
|
68
|
+
{
|
|
69
|
+
type: 'error',
|
|
70
|
+
title: this.translateService.instant(
|
|
71
|
+
'editor.record.flag.saveError.title'
|
|
72
|
+
),
|
|
73
|
+
text: `${this.translateService.instant(
|
|
74
|
+
'editor.record.flag.saveError.body',
|
|
75
|
+
{
|
|
76
|
+
recordKind: this.recordKind(),
|
|
77
|
+
}
|
|
78
|
+
)} ${error.message}`,
|
|
79
|
+
},
|
|
80
|
+
undefined,
|
|
81
|
+
error
|
|
82
|
+
)
|
|
83
|
+
},
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
}
|
package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html
CHANGED
|
@@ -7,23 +7,22 @@
|
|
|
7
7
|
></gn-ui-form-field-open-data>
|
|
8
8
|
</ng-container> -->
|
|
9
9
|
<div class="flex flex-col h-full">
|
|
10
|
-
|
|
10
|
+
@if (withoutWrapper) {
|
|
11
11
|
<ng-container *ngTemplateOutlet="fieldContent"></ng-container>
|
|
12
|
-
|
|
13
|
-
<ng-template #withGenericWrapper>
|
|
12
|
+
} @else {
|
|
14
13
|
<gn-ui-form-field-wrapper
|
|
15
14
|
[label]="config.labelKey! | translate: { recordKind }"
|
|
16
15
|
[hint]="config.hintKey! | translate: { recordKind }"
|
|
17
16
|
>
|
|
18
17
|
<ng-container *ngTemplateOutlet="fieldContent"></ng-container>
|
|
19
18
|
</gn-ui-form-field-wrapper>
|
|
20
|
-
|
|
19
|
+
}
|
|
21
20
|
</div>
|
|
22
21
|
|
|
23
22
|
<ng-template #fieldContent>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<div class="flex flex-row flex-start items-center gap-3
|
|
23
|
+
@switch (model) {
|
|
24
|
+
@case ('title') {
|
|
25
|
+
<div class="flex flex-row flex-start items-center gap-3">
|
|
27
26
|
<textarea
|
|
28
27
|
#titleInput
|
|
29
28
|
cdkTextareaAutosize
|
|
@@ -45,158 +44,171 @@
|
|
|
45
44
|
class="m-2 cursor-pointer"
|
|
46
45
|
(click)="focusTitleInput()"
|
|
47
46
|
></ng-icon>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
@if (config.hintKey) {
|
|
48
|
+
<ng-icon
|
|
49
|
+
name="matHelpOutline"
|
|
50
|
+
size="16"
|
|
51
|
+
class="m-2"
|
|
52
|
+
[matTooltip]="config.hintKey! | translate: { recordKind }"
|
|
53
|
+
matTooltipPosition="above"
|
|
54
|
+
></ng-icon>
|
|
55
|
+
}
|
|
56
56
|
</div>
|
|
57
57
|
</div>
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
}
|
|
59
|
+
@case ('abstract') {
|
|
60
60
|
<gn-ui-form-field-rich
|
|
61
61
|
[label]="config.labelKey! | translate: { recordKind }"
|
|
62
62
|
[hint]="config.hintKey! | translate: { recordKind }"
|
|
63
63
|
[value]="valueAsString"
|
|
64
64
|
(valueChange)="valueChange.emit($event)"
|
|
65
65
|
></gn-ui-form-field-rich>
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
}
|
|
67
|
+
@case ('overviews') {
|
|
68
68
|
<gn-ui-form-field-overviews
|
|
69
69
|
[metadataUuid]="uniqueIdentifier"
|
|
70
70
|
[recordKind]="recordKind"
|
|
71
71
|
[value]="valueAsOverviews"
|
|
72
72
|
(valueChange)="valueChange.emit($event)"
|
|
73
73
|
></gn-ui-form-field-overviews>
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
}
|
|
75
|
+
@case ('resourceIdentifiers') {
|
|
76
76
|
<gn-ui-form-field-simple
|
|
77
77
|
[type]="'text'"
|
|
78
78
|
[value]="valueAsResourceIdentifierCode"
|
|
79
79
|
(valueChange)="handleResourceIdentifierChange($event)"
|
|
80
80
|
></gn-ui-form-field-simple>
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
}
|
|
82
|
+
@case ('resourceCreated') {
|
|
83
83
|
<gn-ui-form-field-date
|
|
84
84
|
[value]="valueAsDate"
|
|
85
85
|
(valueChange)="valueChange.emit($event)"
|
|
86
86
|
></gn-ui-form-field-date>
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
}
|
|
88
|
+
@case ('resourceUpdated') {
|
|
89
89
|
<gn-ui-form-field-date
|
|
90
90
|
[value]="valueAsDate"
|
|
91
91
|
(valueChange)="valueChange.emit($event)"
|
|
92
92
|
></gn-ui-form-field-date>
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
}
|
|
94
|
+
@case ('updateFrequency') {
|
|
95
95
|
<gn-ui-form-field-update-frequency
|
|
96
96
|
[value]="valueAsUpdateFrequency"
|
|
97
97
|
(valueChange)="valueChange.emit($event)"
|
|
98
98
|
[recordKind]="recordKind"
|
|
99
99
|
></gn-ui-form-field-update-frequency>
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
}
|
|
101
|
+
@case ('associatedRecords') {
|
|
102
102
|
<gn-ui-form-field-associated-records
|
|
103
103
|
[value]="valueAsAssociatedRecords"
|
|
104
104
|
(valueChange)="valueChange.emit($event)"
|
|
105
105
|
></gn-ui-form-field-associated-records>
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
}
|
|
107
|
+
@case ('temporalExtents') {
|
|
108
108
|
<gn-ui-form-field-temporal-extents
|
|
109
109
|
[value]="valueAsTemporalExtents"
|
|
110
110
|
(valueChange)="valueChange.emit($event)"
|
|
111
111
|
></gn-ui-form-field-temporal-extents>
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
}
|
|
113
|
+
@case ('spatialExtents') {
|
|
114
114
|
<gn-ui-form-field-spatial-extent></gn-ui-form-field-spatial-extent>
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
}
|
|
116
|
+
@case ('keywords') {
|
|
117
117
|
<gn-ui-form-field-keywords
|
|
118
118
|
[value]="valueAsKeywords"
|
|
119
119
|
(valueChange)="valueChange.emit($event)"
|
|
120
120
|
></gn-ui-form-field-keywords>
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
}
|
|
122
|
+
@case ('topics') {
|
|
123
123
|
<gn-ui-form-field-topics
|
|
124
124
|
[value]="valueAsTopics"
|
|
125
125
|
(valueChange)="valueChange.emit($event)"
|
|
126
126
|
></gn-ui-form-field-topics>
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
}
|
|
128
|
+
@case ('licenses') {
|
|
129
129
|
<gn-ui-form-field-license
|
|
130
130
|
[label]="config.labelKey! | translate: { recordKind }"
|
|
131
131
|
[recordLicences]="valueAsConstraints"
|
|
132
132
|
(recordLicencesChange)="valueChange.emit($event)"
|
|
133
133
|
></gn-ui-form-field-license>
|
|
134
|
-
|
|
134
|
+
}
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
136
|
+
<!-- TODO: merge these cases together when migrated to angular 21 -->
|
|
137
|
+
@case ('legalConstraints') {
|
|
138
|
+
<gn-ui-form-field-constraints
|
|
139
|
+
[label]="config.labelKey"
|
|
140
|
+
[value]="valueAsConstraints"
|
|
141
|
+
[constraintType]="model"
|
|
142
|
+
(valueChange)="valueChange.emit($event)"
|
|
143
|
+
></gn-ui-form-field-constraints>
|
|
144
|
+
}
|
|
145
|
+
@case ('securityConstraints') {
|
|
146
|
+
<gn-ui-form-field-constraints
|
|
147
|
+
[label]="config.labelKey"
|
|
148
|
+
[value]="valueAsConstraints"
|
|
149
|
+
[constraintType]="model"
|
|
150
|
+
(valueChange)="valueChange.emit($event)"
|
|
151
|
+
></gn-ui-form-field-constraints>
|
|
152
|
+
}
|
|
153
|
+
@case ('otherConstraints') {
|
|
146
154
|
<gn-ui-form-field-constraints
|
|
147
155
|
[label]="config.labelKey"
|
|
148
156
|
[value]="valueAsConstraints"
|
|
149
157
|
[constraintType]="model"
|
|
150
158
|
(valueChange)="valueChange.emit($event)"
|
|
151
|
-
></gn-ui-form-field-constraints
|
|
152
|
-
|
|
159
|
+
></gn-ui-form-field-constraints>
|
|
160
|
+
}
|
|
153
161
|
|
|
154
|
-
|
|
162
|
+
@case ('contactsForResource') {
|
|
155
163
|
<gn-ui-form-field-contacts-for-resource
|
|
156
164
|
[value]="valueAsIndividuals"
|
|
157
165
|
(valueChange)="valueChange.emit($event)"
|
|
158
166
|
></gn-ui-form-field-contacts-for-resource>
|
|
159
|
-
|
|
160
|
-
|
|
167
|
+
}
|
|
168
|
+
@case ('contacts') {
|
|
161
169
|
<gn-ui-form-field-contacts
|
|
162
170
|
[value]="valueAsIndividuals"
|
|
163
171
|
[modelSpecifier]="modelSpecifier"
|
|
164
172
|
(valueChange)="valueChange.emit($event)"
|
|
165
173
|
></gn-ui-form-field-contacts>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
174
|
+
}
|
|
175
|
+
@case ('onlineResources') {
|
|
176
|
+
@if (modelSpecifier === 'onlineResourceType:!link') {
|
|
177
|
+
<gn-ui-form-field-online-resources
|
|
178
|
+
[metadataUuid]="uniqueIdentifier"
|
|
179
|
+
[value]="valueAsOnlineResources"
|
|
180
|
+
(valueChange)="valueChange.emit($event)"
|
|
181
|
+
></gn-ui-form-field-online-resources>
|
|
182
|
+
} @else if (modelSpecifier === 'onlineResourceType:link') {
|
|
183
|
+
<gn-ui-form-field-online-link-resources
|
|
184
|
+
[metadataUuid]="uniqueIdentifier"
|
|
185
|
+
[value]="valueAsOnlineResources"
|
|
186
|
+
(valueChange)="valueChange.emit($event)"
|
|
187
|
+
></gn-ui-form-field-online-link-resources>
|
|
188
|
+
} @else if (modelSpecifier === 'onlineResourceType:singleLink') {
|
|
189
|
+
<gn-ui-form-field-online-single-link-resource
|
|
190
|
+
[value]="valueAsOnlineResources"
|
|
191
|
+
(valueChange)="valueChange.emit($event)"
|
|
192
|
+
></gn-ui-form-field-online-single-link-resource>
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
@case ('flags') {
|
|
196
|
+
<gn-ui-form-field-record-flag
|
|
197
|
+
[flagName]="recordFlag"
|
|
198
|
+
[labelKey]="config.labelKey"
|
|
199
|
+
[hintKey]="config.hintKey"
|
|
200
|
+
></gn-ui-form-field-record-flag>
|
|
201
|
+
}
|
|
202
|
+
}
|
|
191
203
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
204
|
+
@if (!model) {
|
|
205
|
+
@switch (componentName) {
|
|
206
|
+
@case ('form-field-constraints-shortcuts') {
|
|
195
207
|
<gn-ui-form-field-constraints-shortcuts></gn-ui-form-field-constraints-shortcuts>
|
|
196
|
-
|
|
197
|
-
|
|
208
|
+
}
|
|
209
|
+
@case ('form-field-spatial-toggle') {
|
|
198
210
|
<gn-ui-form-field-spatial-toggle></gn-ui-form-field-spatial-toggle>
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
202
214
|
</ng-template>
|