geonetwork-ui 2.11.0-dev.5c2e5295e → 2.11.0-dev.62b98576f

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 (130) hide show
  1. package/fesm2022/geonetwork-ui.mjs +2654 -1669
  2. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  3. package/index.d.ts +465 -187
  4. package/index.d.ts.map +1 -1
  5. package/package.json +13 -11
  6. package/src/libs/api/metadata-converter/src/lib/dcat-ap/dcat-ap.converter.ts +2 -0
  7. package/src/libs/api/metadata-converter/src/lib/fixtures/mel.records.dataset+featurecatalog.ts +395 -0
  8. package/src/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.ts +78 -21
  9. package/src/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.ts +19 -0
  10. package/src/libs/api/metadata-converter/src/lib/iso19115-3/iso19115-3.converter.ts +17 -6
  11. package/src/libs/api/metadata-converter/src/lib/iso19115-3/read-parts.ts +110 -0
  12. package/src/libs/api/metadata-converter/src/lib/iso19115-3/write-parts.ts +131 -0
  13. package/src/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.ts +9 -0
  14. package/src/libs/api/metadata-converter/src/lib/iso19139/read-parts.ts +2 -1
  15. package/src/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.ts +160 -54
  16. package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +119 -51
  17. package/src/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts +11 -0
  18. package/src/libs/common/domain/src/lib/model/record/flags.model.ts +1 -0
  19. package/src/libs/common/domain/src/lib/model/record/index.ts +1 -0
  20. package/src/libs/common/domain/src/lib/model/record/metadata.model.ts +26 -18
  21. package/src/libs/common/domain/src/lib/model/search/aggregation.model.ts +2 -0
  22. package/src/libs/common/domain/src/lib/model/search/filter.model.ts +24 -2
  23. package/src/libs/common/domain/src/lib/platform.service.interface.ts +1 -0
  24. package/src/libs/common/domain/src/lib/repository/records-repository.interface.ts +22 -3
  25. package/src/libs/common/fixtures/src/lib/records.fixtures.ts +42 -62
  26. package/src/libs/feature/dataviz/src/lib/chart-view/chart-view.component.ts +3 -2
  27. package/src/libs/feature/dataviz/src/lib/geo-table-view/geo-table-view.component.ts +2 -1
  28. package/src/libs/feature/dataviz/src/lib/service/data.service.ts +54 -41
  29. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-constraints/form-field-constraints.component.ts +3 -5
  30. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts/form-field-contacts.component.ts +2 -2
  31. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-record-flags/form-field-record-flag-component.html +18 -0
  32. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-record-flags/form-field-record-flag-component.ts +86 -0
  33. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +100 -88
  34. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts +11 -4
  35. package/src/libs/feature/editor/src/lib/components/record-form/record-form.component.ts +18 -4
  36. package/src/libs/feature/editor/src/lib/expressions.ts +67 -0
  37. package/src/libs/feature/editor/src/lib/fields.config.ts +13 -0
  38. package/src/libs/feature/editor/src/lib/models/editor-config.model.ts +10 -4
  39. package/src/libs/feature/map/src/index.ts +0 -2
  40. package/src/libs/feature/map/src/lib/add-layer-from-file/add-layer-from-file.component.html +1 -0
  41. package/src/libs/feature/map/src/lib/feature-map.module.ts +1 -8
  42. package/src/libs/feature/notifications/src/lib/notifications.service.ts +6 -4
  43. package/src/libs/feature/notify-reuse/src/lib/notify-reuse-form/notify-reuse-form.component.ts +8 -3
  44. package/src/libs/feature/record/src/lib/state/mdview.actions.ts +4 -8
  45. package/src/libs/feature/record/src/lib/state/mdview.effects.ts +10 -17
  46. package/src/libs/feature/record/src/lib/state/mdview.facade.ts +2 -4
  47. package/src/libs/feature/record/src/lib/state/mdview.reducer.ts +4 -9
  48. package/src/libs/feature/record/src/lib/state/mdview.selectors.ts +2 -7
  49. package/src/libs/feature/router/src/lib/default/state/query-params.utils.ts +1 -1
  50. package/src/libs/feature/search/src/index.ts +2 -0
  51. package/src/libs/feature/search/src/lib/filter-dropdown/filter-dropdown.component.html +18 -4
  52. package/src/libs/feature/search/src/lib/filter-dropdown/filter-dropdown.component.ts +80 -19
  53. package/src/libs/feature/search/src/lib/geocoding/geocoding.service.ts +105 -0
  54. package/src/libs/feature/search/src/lib/location-search/location-search.component.html +18 -0
  55. package/src/libs/feature/search/src/lib/location-search/location-search.component.ts +114 -0
  56. package/src/libs/feature/search/src/lib/search-filters-summary-item/search-filters-summary-item.component.ts +19 -8
  57. package/src/libs/feature/search/src/lib/state/reducer.ts +1 -4
  58. package/src/libs/feature/search/src/lib/utils/service/fields.service.ts +64 -4
  59. package/src/libs/feature/search/src/lib/utils/service/fields.ts +94 -10
  60. package/src/libs/ui/dataviz/src/lib/data-table/data-table.component.html +6 -7
  61. package/src/libs/ui/dataviz/src/lib/data-table/data-table.component.ts +31 -19
  62. package/src/libs/ui/dataviz/src/lib/data-table/data-table.fixtures.ts +2 -2
  63. package/src/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.html +3 -3
  64. package/src/libs/ui/elements/src/lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component.ts +2 -2
  65. package/src/libs/ui/elements/src/lib/service-capabilities/service-capabilities.component.ts +2 -1
  66. package/src/libs/ui/inputs/src/index.ts +2 -0
  67. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.css +0 -4
  68. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.html +12 -3
  69. package/src/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts +11 -3
  70. package/src/libs/ui/inputs/src/lib/date-adapter.providers.ts +30 -0
  71. package/src/libs/ui/inputs/src/lib/date-picker/date-picker.component.ts +3 -24
  72. package/src/libs/ui/inputs/src/lib/date-range-dropdown/date-range-dropdown.component.css +37 -3
  73. package/src/libs/ui/inputs/src/lib/date-range-dropdown/date-range-dropdown.component.html +135 -16
  74. package/src/libs/ui/inputs/src/lib/date-range-dropdown/date-range-dropdown.component.ts +166 -29
  75. package/src/libs/ui/inputs/src/lib/date-range-picker/date-range-picker.component.ts +3 -7
  76. package/src/libs/ui/inputs/src/lib/drag-and-drop-file-input/drag-and-drop-file-input.component.css +1 -0
  77. package/src/libs/ui/inputs/src/lib/drag-and-drop-file-input/drag-and-drop-file-input.component.html +20 -7
  78. package/src/libs/ui/inputs/src/lib/drag-and-drop-file-input/drag-and-drop-file-input.component.ts +46 -5
  79. package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.component.html +7 -4
  80. package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.component.ts +12 -9
  81. package/src/libs/ui/inputs/src/lib/dropdown-multiselect/dropdown-multiselect.model.ts +2 -2
  82. package/src/libs/ui/inputs/src/lib/search-feature-catalog/search-feature-catalog.component.ts +2 -1
  83. package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.css +0 -0
  84. package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.html +117 -0
  85. package/src/libs/ui/inputs/src/lib/spatial-extent-dropdown/spatial-extent-dropdown.component.ts +244 -0
  86. package/src/libs/ui/layout/src/lib/block-list/block-list.component.css +1 -0
  87. package/src/libs/ui/map/src/lib/components/map-container/map-container.component.ts +6 -5
  88. package/src/libs/util/app-config/src/index.ts +1 -0
  89. package/src/libs/util/app-config/src/lib/app-config.ts +338 -247
  90. package/src/libs/util/app-config/src/lib/fixtures.ts +37 -1
  91. package/src/libs/util/app-config/src/lib/model.ts +42 -1
  92. package/src/libs/util/app-config/src/lib/parse-utils.ts +8 -4
  93. package/src/libs/util/data-fetcher/src/lib/data-fetcher.ts +19 -22
  94. package/src/libs/util/data-fetcher/src/lib/engine/duckdb.ts +185 -0
  95. package/src/libs/util/data-fetcher/src/lib/engine/results.ts +63 -0
  96. package/src/libs/util/data-fetcher/src/lib/{sql-utils.ts → engine/sql-utils.ts} +28 -13
  97. package/src/libs/util/data-fetcher/src/lib/model.ts +2 -1
  98. package/src/libs/util/data-fetcher/src/lib/readers/base-file.ts +53 -38
  99. package/src/libs/util/data-fetcher/src/lib/readers/base.ts +11 -0
  100. package/src/libs/util/data-fetcher/src/lib/readers/csv.ts +9 -47
  101. package/src/libs/util/data-fetcher/src/lib/readers/excel.ts +27 -27
  102. package/src/libs/util/data-fetcher/src/lib/readers/geojson.ts +5 -24
  103. package/src/libs/util/data-fetcher/src/lib/readers/gml.ts +5 -49
  104. package/src/libs/util/data-fetcher/src/lib/readers/json.ts +5 -23
  105. package/src/libs/util/data-fetcher/src/lib/readers/wfs.ts +184 -128
  106. package/src/libs/util/data-fetcher/src/lib/utils.ts +0 -143
  107. package/src/libs/util/shared/src/index.ts +1 -0
  108. package/src/libs/util/shared/src/lib/autofocus.directive.ts +26 -0
  109. package/src/libs/util/shared/src/lib/links/link-utils.ts +19 -10
  110. package/src/libs/util/shared/src/lib/services/date.service.ts +3 -3
  111. package/src/libs/util/shared/src/lib/utils/file.ts +15 -0
  112. package/src/libs/util/shared/src/lib/utils/geojson.ts +45 -10
  113. package/src/libs/util/shared/src/lib/utils/index.ts +1 -0
  114. package/tailwind.base.css +5 -0
  115. package/translations/de.json +30 -5
  116. package/translations/en.json +29 -4
  117. package/translations/es.json +27 -2
  118. package/translations/fr.json +34 -9
  119. package/translations/it.json +28 -3
  120. package/translations/nl.json +27 -2
  121. package/translations/pt.json +27 -2
  122. package/translations/sk.json +28 -3
  123. package/src/libs/feature/map/src/lib/geocoding/geocoding.component.html +0 -41
  124. package/src/libs/feature/map/src/lib/geocoding/geocoding.component.ts +0 -112
  125. package/src/libs/feature/map/src/lib/geocoding.service.ts +0 -57
  126. package/src/libs/feature/map/src/lib/style/index.ts +0 -2
  127. package/src/libs/feature/map/src/lib/style/map-style.fixtures.ts +0 -47
  128. package/src/libs/feature/map/src/lib/style/map-style.service.ts +0 -108
  129. package/src/libs/util/data-fetcher/src/lib/readers/base-cache.ts +0 -14
  130. /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
@@ -20,10 +20,14 @@ import {
20
20
  isDateRange,
21
21
  METADATA_LANGUAGE,
22
22
  } from '../../../../../../../libs/api/repository/src'
23
- import { formatUserInfo } from '../../../../../../../libs/util/shared/src'
23
+ import {
24
+ BoundingBox,
25
+ formatUserInfo,
26
+ isBoundingBox,
27
+ } from '../../../../../../../libs/util/shared/src'
24
28
  import { PossibleResourceTypes } from '../../../../../../../libs/api/metadata-converter/src'
25
29
 
26
- export type FieldType = 'values' | 'dateRange'
30
+ export type FieldType = 'values' | 'dateRange' | 'spatialExtent'
27
31
 
28
32
  export type FieldValue = string | number
29
33
  export interface FieldAvailableValue {
@@ -49,6 +53,15 @@ export class SimpleSearchField implements AbstractSearchField {
49
53
  // FIXME: this is required to register runtime fields; abstract this as well
50
54
  protected esService = this.injector.get(ElasticsearchService)
51
55
 
56
+ private customIdentifier?: string
57
+
58
+ protected get fieldIdentifier(): string {
59
+ return this.customIdentifier ?? this.esFieldName
60
+ }
61
+
62
+ public includeValues: string[] = []
63
+ public excludeValues: string[] = []
64
+
52
65
  constructor(
53
66
  protected esFieldName: string,
54
67
  protected injector: Injector,
@@ -56,13 +69,24 @@ export class SimpleSearchField implements AbstractSearchField {
56
69
  protected orderType: 'key' | 'count' = 'key'
57
70
  ) {}
58
71
 
72
+ public setFieldIdentifier(fieldIdentifier: string) {
73
+ this.customIdentifier = fieldIdentifier
74
+ this.esService.registerFieldAlias(fieldIdentifier, this.esFieldName)
75
+ }
76
+
59
77
  protected getAggregations(): AggregationsParams {
60
78
  return {
61
- [this.esFieldName]: {
79
+ [this.fieldIdentifier]: {
62
80
  type: 'terms',
63
81
  field: this.esFieldName,
64
82
  limit: 1000,
65
83
  sort: [this.order, this.orderType],
84
+ ...(this.includeValues?.length && {
85
+ includeValues: this.includeValues,
86
+ }),
87
+ ...(this.excludeValues?.length && {
88
+ excludeValues: this.excludeValues,
89
+ }),
66
90
  },
67
91
  }
68
92
  }
@@ -75,7 +99,7 @@ export class SimpleSearchField implements AbstractSearchField {
75
99
  return this.repository.aggregate(this.getAggregations()).pipe(
76
100
  map(
77
101
  (response) =>
78
- (response[this.esFieldName] as AggregationBuckets).buckets || []
102
+ (response[this.fieldIdentifier] as AggregationBuckets).buckets || []
79
103
  ),
80
104
  switchMap((buckets: TermBucket[]) => {
81
105
  const bucketPromises = buckets.map(async (bucket) => ({
@@ -93,7 +117,7 @@ export class SimpleSearchField implements AbstractSearchField {
93
117
  // FieldValue[]
94
118
  if (this.getType() === 'values') {
95
119
  return of({
96
- [this.esFieldName]: (values as FieldValue[]).reduce((acc, val) => {
120
+ [this.fieldIdentifier]: (values as FieldValue[]).reduce((acc, val) => {
97
121
  const value = val.toString()
98
122
  if (value !== '') {
99
123
  return { ...acc, [value]: true }
@@ -104,13 +128,13 @@ export class SimpleSearchField implements AbstractSearchField {
104
128
  }
105
129
  // DateRange
106
130
  return of({
107
- [this.esFieldName]: values[0] !== '' ? values[0] : {},
131
+ [this.fieldIdentifier]: values[0] !== '' ? values[0] : {},
108
132
  })
109
133
  }
110
134
  getValuesForFilter(
111
135
  filters: FieldFilters
112
136
  ): Observable<FieldValue[] | FieldValue | DateRange> {
113
- const filter = filters[this.esFieldName]
137
+ const filter = filters[this.fieldIdentifier]
114
138
  if (!filter) return of([])
115
139
  // filter by expression
116
140
  if (typeof filter === 'string') {
@@ -128,6 +152,10 @@ export class SimpleSearchField implements AbstractSearchField {
128
152
  getType(): FieldType {
129
153
  return 'values'
130
154
  }
155
+
156
+ clone(): typeof this {
157
+ return Object.create(this)
158
+ }
131
159
  }
132
160
 
133
161
  export class TranslatedSearchField extends SimpleSearchField {
@@ -171,7 +199,8 @@ export class TranslatedSearchField extends SimpleSearchField {
171
199
  export class MultilingualSearchField extends SimpleSearchField {
172
200
  // we're using a getter in case the token value changes over time
173
201
  private get searchLanguage() {
174
- return this.injector.get(METADATA_LANGUAGE, null)
202
+ const language = this.injector.get(METADATA_LANGUAGE, null)
203
+ return typeof language === 'function' ? language() : language
175
204
  }
176
205
 
177
206
  constructor(
@@ -431,6 +460,61 @@ export class DateRangeSearchField extends SimpleSearchField {
431
460
  }
432
461
  }
433
462
 
463
+ // treats a resource's creation/revision dates as an interval (its min and max), so a record matches
464
+ // when that interval intersects the filter range, not just when a single date falls inside it
465
+ export class ResourceCreationRevisionDateSearchField extends DateRangeSearchField {
466
+ constructor(injector: Injector, order: 'asc' | 'desc' = 'desc') {
467
+ super('resourceCreationRevisionDate', injector, order)
468
+ const dateSourceFields = [
469
+ 'creationDateForResource',
470
+ 'revisionDateForResource',
471
+ ]
472
+ const collectSortedDates = dateSourceFields
473
+ .map(
474
+ (field) => `if (doc.containsKey('${field}')) {
475
+ for (def date : doc['${field}']) { dates.add(date.millis); }
476
+ }`
477
+ )
478
+ .join('\n')
479
+
480
+ this.esService.registerRuntimeField(
481
+ 'resourceCreationRevisionDateMin',
482
+ `def dates = [];
483
+ ${collectSortedDates}
484
+ if (dates.length > 0) { dates.sort(null); emit(dates[0]); }`,
485
+ 'date'
486
+ )
487
+ this.esService.registerRuntimeField(
488
+ 'resourceCreationRevisionDateMax',
489
+ `def dates = [];
490
+ ${collectSortedDates}
491
+ if (dates.length > 0) { dates.sort(null); emit(dates[dates.length - 1]); }`,
492
+ 'date'
493
+ )
494
+ }
495
+ }
496
+
497
+ export class BoundingBoxSearchField extends SimpleSearchField {
498
+ getAvailableValues(): Observable<FieldAvailableValue[]> {
499
+ return of([])
500
+ }
501
+
502
+ getFiltersForValues(values: FieldValue[]): Observable<FieldFilters> {
503
+ return of({
504
+ [this.fieldIdentifier]: values.map(Number) as BoundingBox,
505
+ })
506
+ }
507
+
508
+ getValuesForFilter(filters: FieldFilters): Observable<FieldValue[]> {
509
+ const filter = filters[this.fieldIdentifier]
510
+ return of(isBoundingBox(filter) ? filter : [])
511
+ }
512
+
513
+ getType(): FieldType {
514
+ return 'spatialExtent'
515
+ }
516
+ }
517
+
434
518
  marker('search.filters.availableServices.view')
435
519
  marker('search.filters.availableServices.download')
436
520
 
@@ -540,7 +624,7 @@ export class RecordKindField extends SimpleSearchField {
540
624
 
541
625
  getFiltersForValues(values: FieldValue[]): Observable<FieldFilters | string> {
542
626
  const filters: FieldFilters = {
543
- [this.esFieldName]: values.reduce((acc, value) => {
627
+ [this.fieldIdentifier]: values.reduce((acc, value) => {
544
628
  if (value === '') return { ...acc, [value]: true }
545
629
 
546
630
  const keysToAdd = this.TYPE_MAPPING[value] || [value]
@@ -567,7 +651,7 @@ export class RecordKindField extends SimpleSearchField {
567
651
  }
568
652
 
569
653
  getValuesForFilter(filters: FieldFilters): Observable<FieldValue[]> {
570
- const filter = filters[this.esFieldName]
654
+ const filter = filters[this.fieldIdentifier]
571
655
  if (!filter) return of([])
572
656
 
573
657
  const activeValues = Object.keys(filter).filter((v) => filter[v])
@@ -6,33 +6,32 @@
6
6
  matSort
7
7
  (matSortChange)="setSort($event)"
8
8
  [matSortDisableClear]="true"
9
- *ngrxLet="properties$ as properties"
10
9
  >
11
- @for (attr of _featureAttributes; track attr) {
12
- <ng-container [matColumnDef]="attr.value">
10
+ @for (column of columns; track column) {
11
+ <ng-container [matColumnDef]="column.name">
13
12
  <th
14
13
  mat-header-cell
15
14
  *matHeaderCellDef
16
15
  mat-sort-header
17
16
  class="text-sm text-black bg-white"
18
17
  >
19
- {{ attr.label }}
18
+ {{ column.label }}
20
19
  </th>
21
20
  <td
22
21
  mat-cell
23
22
  *matCellDef="let element"
24
23
  class="whitespace-nowrap pr-1 truncate"
25
24
  >
26
- {{ element[attr.value] }}
25
+ {{ element[column.name] }}
27
26
  </td>
28
27
  </ng-container>
29
28
  }
30
29
 
31
- <tr mat-header-row *matHeaderRowDef="properties; sticky: true"></tr>
30
+ <tr mat-header-row *matHeaderRowDef="columnNames; sticky: true"></tr>
32
31
  <tr
33
32
  [id]="getRowEltId(row.id)"
34
33
  mat-row
35
- *matRowDef="let row; columns: properties"
34
+ *matRowDef="let row; columns: columnNames"
36
35
  (click)="selected.emit(row)"
37
36
  [class.active]="
38
37
  activeId !== undefined && activeId !== null && row.id === activeId
@@ -6,14 +6,14 @@ import {
6
6
  Component,
7
7
  ElementRef,
8
8
  EventEmitter,
9
+ inject,
9
10
  Input,
10
11
  OnChanges,
11
12
  OnInit,
12
13
  Output,
13
14
  ViewChild,
14
- inject,
15
15
  } from '@angular/core'
16
- import { MatSort, MatSortModule } from '@angular/material/sort'
16
+ import { MatSort, MatSortModule, Sort } from '@angular/material/sort'
17
17
  import { MatTableModule } from '@angular/material/table'
18
18
  import {
19
19
  TranslateDirective,
@@ -29,12 +29,11 @@ import {
29
29
  } from '@angular/material/paginator'
30
30
  import { CustomMatPaginatorIntl } from './custom.mat.paginator.intl'
31
31
  import { CommonModule } from '@angular/common'
32
- import { BehaviorSubject, filter, firstValueFrom } from 'rxjs'
32
+ import { BehaviorSubject } from 'rxjs'
33
33
  import {
34
34
  LoadingMaskComponent,
35
35
  PopupAlertComponent,
36
36
  } from '../../../../../../libs/ui/widgets/src'
37
- import { LetDirective } from '@ngrx/component'
38
37
 
39
38
  const rowIdPrefix = 'table-item-'
40
39
 
@@ -46,6 +45,11 @@ export interface TableItemModel {
46
45
  [key: string]: TableItemType
47
46
  }
48
47
 
48
+ interface TableColumn {
49
+ name: string
50
+ label: string
51
+ }
52
+
49
53
  @Component({
50
54
  standalone: true,
51
55
  imports: [
@@ -56,7 +60,6 @@ export interface TableItemModel {
56
60
  CommonModule,
57
61
  LoadingMaskComponent,
58
62
  PopupAlertComponent,
59
- LetDirective,
60
63
  TranslatePipe,
61
64
  TranslateDirective,
62
65
  ],
@@ -71,15 +74,21 @@ export class DataTableComponent implements OnInit, AfterViewInit, OnChanges {
71
74
  private cdr = inject(ChangeDetectorRef)
72
75
  private translateService = inject(TranslateService)
73
76
 
74
- _featureAttributes = []
77
+ columnsFromFeatureCatalog: TableColumn[] = null
75
78
  @Input() set featureAttributes(value: { value: string; label: string }[]) {
76
- this._featureAttributes = value
77
- this.properties$.next(value.map((attr) => attr.value))
79
+ this.columnsFromFeatureCatalog = value.map((attrs) => ({
80
+ name: attrs.value,
81
+ label: attrs.label,
82
+ }))
78
83
  }
84
+ columnsFromDataset: TableColumn[] = []
79
85
  @Input() set dataset(value: BaseReader) {
80
86
  this.dataset_ = value
81
87
  this.dataset_.load()
82
- this.dataset_.info.then((info) => (this.count = info.itemsCount))
88
+ this.dataset_.info.then((info) => {
89
+ this.count = info.itemsCount
90
+ this.cdr.detectChanges()
91
+ })
83
92
  }
84
93
  @Input() activeId: TableItemId
85
94
  @Output() selected = new EventEmitter<any>()
@@ -88,13 +97,19 @@ export class DataTableComponent implements OnInit, AfterViewInit, OnChanges {
88
97
  @ViewChild(MatPaginator) paginator: MatPaginator
89
98
 
90
99
  dataset_: BaseReader
91
- properties$ = new BehaviorSubject<string[]>(null)
92
100
  dataSource: DataTableDataSource
93
101
  headerHeight: number
94
102
  count: number
95
103
  loading$ = new BehaviorSubject<boolean>(false)
96
104
  error = null
97
105
 
106
+ get columns() {
107
+ return this.columnsFromFeatureCatalog ?? this.columnsFromDataset
108
+ }
109
+ get columnNames() {
110
+ return this.columns.map((c) => c.name)
111
+ }
112
+
98
113
  ngOnInit() {
99
114
  this.dataSource = new DataTableDataSource()
100
115
  }
@@ -110,7 +125,7 @@ export class DataTableComponent implements OnInit, AfterViewInit, OnChanges {
110
125
  this.setPagination()
111
126
  }
112
127
 
113
- setSort(sort: MatSort) {
128
+ setSort(sort: Sort) {
114
129
  if (!this.dataset_) return
115
130
  if (!sort.active) {
116
131
  this.dataset_.orderBy()
@@ -132,15 +147,12 @@ export class DataTableComponent implements OnInit, AfterViewInit, OnChanges {
132
147
 
133
148
  async readData() {
134
149
  this.loading$.next(true)
135
- // wait for properties to be read
136
- const properties = await firstValueFrom(
137
- this.properties$.pipe(filter((p) => !!p))
138
- )
139
- const propsWithoutGeom = properties.filter(
140
- (p) => !p.toLowerCase().startsWith('geom')
141
- )
142
- this.dataset_.select(...propsWithoutGeom)
143
150
  try {
151
+ // wait for properties to be read
152
+ if (!this.columnsFromFeatureCatalog) {
153
+ this.columnsFromDataset = await this.dataset_.properties
154
+ }
155
+ this.dataset_.select(...this.columnNames)
144
156
  await this.dataSource.showData(this.dataset_.read())
145
157
  this.error = null
146
158
  } catch (error) {
@@ -25,8 +25,8 @@ export const tableItemsFixture = {
25
25
  geometry: null,
26
26
  properties: {
27
27
  id: '0003',
28
- firstName: 'Claude',
29
- lastName: 'François',
28
+ firstName: 'Lady',
29
+ lastName: 'Gaga',
30
30
  },
31
31
  },
32
32
  ] as DataItem[],
@@ -17,9 +17,9 @@
17
17
  <ng-template #titleTemplate>
18
18
  <div class="px-2">
19
19
  <div class="text-lg font-bold">{{ featureType.name }}</div>
20
- @if (featureType.definition) {
20
+ @if (featureType.description) {
21
21
  <div class="text-sm">
22
- {{ featureType.definition }}
22
+ {{ featureType.description }}
23
23
  </div>
24
24
  }
25
25
  </div>
@@ -87,7 +87,7 @@
87
87
  <ul class="list-disc list-inside mr-4">
88
88
  @for (v of row.values; track v) {
89
89
  <li>
90
- {{ v.label || v.code }}
90
+ {{ v.label || v.value }}
91
91
  </li>
92
92
  }
93
93
  </ul>
@@ -19,7 +19,7 @@ import { iconoirList } from '@ng-icons/iconoir'
19
19
  marker('feature.catalog.attribute.type')
20
20
  marker('feature.catalog.attribute.name')
21
21
  marker('feature.catalog.attribute.code')
22
- marker('feature.catalog.attribute.definition')
22
+ marker('feature.catalog.attribute.description')
23
23
  marker('feature.catalog.attribute.values')
24
24
 
25
25
  interface ColumnDefinition {
@@ -56,7 +56,7 @@ export class FeatureCatalogListComponent {
56
56
  readonly COLUMNS_DEFAULT: ColumnDefinition[] = [
57
57
  { key: 'type', width: '25%' },
58
58
  { key: 'name', width: '40%' },
59
- { key: 'definition', width: 'minmax(0px, 1fr)' },
59
+ { key: 'description', width: 'minmax(0px, 1fr)' },
60
60
  ]
61
61
 
62
62
  readonly COLUMN_VALUES: ColumnDefinition = {
@@ -128,7 +128,8 @@ export class ServiceCapabilitiesComponent implements OnInit {
128
128
  this.loading = true
129
129
  this.availableLayers = await getLayers(
130
130
  this.apiLinks[0].url.href,
131
- this.apiLinks[0].accessServiceProtocol
131
+ this.apiLinks[0].accessServiceProtocol,
132
+ true
132
133
  )
133
134
  this.loading = false
134
135
  this.cdr.detectChanges()
@@ -4,6 +4,7 @@ export * from './lib/button/button.component'
4
4
  export * from './lib/check-toggle/check-toggle.component'
5
5
  export * from './lib/checkbox/checkbox.component'
6
6
  export * from './lib/copy-text-button/copy-text-button.component'
7
+ export * from './lib/date-adapter.providers'
7
8
  export * from './lib/date-picker/date-picker.component'
8
9
  export * from './lib/date-range-dropdown/date-range-dropdown.component'
9
10
  export * from './lib/date-range-picker/date-range-picker.component'
@@ -25,3 +26,4 @@ export * from './lib/url-input/url-input.component'
25
26
  export * from './lib/viewport-intersector/viewport-intersector.component'
26
27
  export * from './lib/search-feature-catalog/search-feature-catalog.component'
27
28
  export * from './lib/date-range-inputs/date-range-inputs.component'
29
+ export * from './lib/spatial-extent-dropdown/spatial-extent-dropdown.component'
@@ -16,10 +16,6 @@ gn-ui-button {
16
16
  --gn-ui-button-padding: 0;
17
17
  font-size: 1em;
18
18
  }
19
- ng-icon.search {
20
- margin-top: 0.6rem;
21
- margin-left: 0.6rem;
22
- }
23
19
  gn-ui-button:last-of-type {
24
20
  --gn-ui-button-rounded: 0 var(--gn-ui-text-input-rounded, 0.25em)
25
21
  var(--gn-ui-text-input-rounded, 0.25em) 0;
@@ -1,9 +1,9 @@
1
1
  <span class="w-full inline-block relative">
2
2
  @if (!allowSubmit) {
3
3
  <div
4
- class="absolute inset-y-[--icon-padding] left-[--icon-padding] w-[--icon-width] pointer-events-none"
4
+ class="absolute inset-y-[--icon-padding] left-[--icon-padding] w-[--icon-width] pointer-events-none flex items-center justify-center"
5
5
  >
6
- <ng-icon name="iconoirSearch" class="text-primary search"></ng-icon>
6
+ <ng-icon name="iconoirSearch" class="text-primary"></ng-icon>
7
7
  </div>
8
8
  }
9
9
  <div class="flex flex-row">
@@ -83,7 +83,16 @@
83
83
  >
84
84
  @for (suggestion of suggestions$ | async; track suggestion) {
85
85
  <mat-option [value]="suggestion" class="p-2 suggestion text-start">
86
- {{ displayWithFnInternal(suggestion) }}
86
+ @if (displayWithTemplate) {
87
+ <ng-container
88
+ *ngTemplateOutlet="
89
+ displayWithTemplate;
90
+ context: { $implicit: suggestion }
91
+ "
92
+ ></ng-container>
93
+ } @else {
94
+ {{ displayWithFnInternal(suggestion) }}
95
+ }
87
96
  </mat-option>
88
97
  }
89
98
  </mat-autocomplete>
@@ -11,6 +11,7 @@ import {
11
11
  OnInit,
12
12
  Output,
13
13
  SimpleChanges,
14
+ TemplateRef,
14
15
  ViewChild,
15
16
  inject,
16
17
  } from '@angular/core'
@@ -97,6 +98,13 @@ export class AutocompleteComponent
97
98
  @ViewChild(MatAutocompleteTrigger) triggerRef: MatAutocompleteTrigger
98
99
  @ViewChild(MatAutocomplete) autocomplete: MatAutocomplete
99
100
  @ViewChild('searchInput') inputRef: ElementRef<HTMLInputElement>
101
+ /**
102
+ * Custom template to render each suggestion. Takes precedence over
103
+ * `displayWithFn` when set.
104
+ */
105
+ @Input() displayWithTemplate?: TemplateRef<{
106
+ $implicit: AutocompleteItem
107
+ }>
100
108
 
101
109
  searching: boolean
102
110
  control = new UntypedFormControl()
@@ -126,13 +134,13 @@ export class AutocompleteComponent
126
134
  getExtraClass(): string {
127
135
  if (this.allowSubmit) {
128
136
  if (this.enterButton) {
129
- return 'border rounded-lg absolute w-8 h-8 right-[calc(var(--icon-width)+var(--icon-padding))] inset-y-[--icon-padding]'
137
+ return 'border rounded-lg absolute w-8 h-8 right-[calc(var(--icon-width)+var(--icon-padding))] top-1/2 -translate-y-1/2'
130
138
  } else {
131
- return 'border rounded-lg absolute w-8 h-8 right-[calc(var(--icon-width)+0.25*var(--icon-width))] inset-y-[calc(0.25*var(--icon-width))]'
139
+ return 'border rounded-lg absolute w-8 h-8 right-[calc(var(--icon-width)+0.25*var(--icon-width))] top-1/2 -translate-y-1/2'
132
140
  }
133
141
  } else {
134
142
  if (!this.enterButton) {
135
- return 'border rounded-lg absolute w-8 h-8 right-2 inset-y-2'
143
+ return 'border rounded-lg absolute w-8 h-8 right-2 top-1/2 -translate-y-1/2'
136
144
  }
137
145
  }
138
146
  return 'border rounded-lg absolute w-8 h-8'
@@ -0,0 +1,30 @@
1
+ import { inject, Provider } from '@angular/core'
2
+ import {
3
+ DateAdapter,
4
+ MAT_DATE_FORMATS,
5
+ MAT_DATE_LOCALE,
6
+ } from '@angular/material/core'
7
+ import {
8
+ DateFnsAdapter,
9
+ MAT_DATE_FNS_FORMATS,
10
+ } from '@angular/material-date-fns-adapter'
11
+ import { enUS } from 'date-fns/locale/en-US'
12
+ import { DateService } from '../../../../../libs/util/shared/src'
13
+
14
+ export function provideLocalizedDateAdapter(): Provider[] {
15
+ return [
16
+ { provide: MAT_DATE_LOCALE, useValue: enUS },
17
+ { provide: MAT_DATE_FORMATS, useValue: MAT_DATE_FNS_FORMATS },
18
+ {
19
+ provide: DateAdapter,
20
+ useFactory: () => {
21
+ const dateService = inject(DateService)
22
+ const adapter = new DateFnsAdapter()
23
+ dateService
24
+ .getDateFnsLocale()
25
+ .then((locale) => adapter.setLocale(locale))
26
+ return adapter
27
+ },
28
+ },
29
+ ]
30
+ }
@@ -2,15 +2,9 @@ import {
2
2
  ChangeDetectionStrategy,
3
3
  Component,
4
4
  EventEmitter,
5
- inject,
6
5
  Input,
7
6
  Output,
8
7
  } from '@angular/core'
9
- import {
10
- DateAdapter,
11
- MAT_DATE_LOCALE,
12
- MatNativeDateModule,
13
- } from '@angular/material/core'
14
8
  import { MatDatepickerModule } from '@angular/material/datepicker'
15
9
  import { ButtonComponent } from '../button/button.component'
16
10
  import {
@@ -19,7 +13,7 @@ import {
19
13
  provideNgIconsConfig,
20
14
  } from '@ng-icons/core'
21
15
  import { iconoirCalendar } from '@ng-icons/iconoir'
22
- import { TranslateService } from '@ngx-translate/core'
16
+ import { provideLocalizedDateAdapter } from '../date-adapter.providers'
23
17
 
24
18
  @Component({
25
19
  selector: 'gn-ui-date-picker',
@@ -27,31 +21,16 @@ import { TranslateService } from '@ngx-translate/core'
27
21
  styleUrls: ['./date-picker.component.css'],
28
22
  changeDetection: ChangeDetectionStrategy.OnPush,
29
23
  standalone: true,
30
- imports: [
31
- MatNativeDateModule,
32
- MatDatepickerModule,
33
- ButtonComponent,
34
- NgIconComponent,
35
- ],
24
+ imports: [MatDatepickerModule, ButtonComponent, NgIconComponent],
36
25
  providers: [
37
26
  provideIcons({ iconoirCalendar }),
38
27
  provideNgIconsConfig({
39
28
  size: '1.5rem',
40
29
  }),
41
- {
42
- provide: MAT_DATE_LOCALE,
43
- useFactory: (locale: string) => locale,
44
- },
30
+ provideLocalizedDateAdapter(),
45
31
  ],
46
32
  })
47
33
  export class DatePickerComponent {
48
- private dateAdapter = inject<DateAdapter<Date>>(DateAdapter)
49
- private translate = inject(TranslateService)
50
-
51
34
  @Input() date: Date
52
35
  @Output() dateChange = new EventEmitter<Date>()
53
-
54
- constructor() {
55
- this.dateAdapter.setLocale(this.translate.getCurrentLang())
56
- }
57
36
  }
@@ -1,5 +1,39 @@
1
- :host {
2
- .mat-date-range-input-container {
3
- display: none;
1
+ mat-calendar {
2
+ width: 100%;
3
+ }
4
+
5
+ .calendar {
6
+ display: grid;
7
+ grid-template-rows: 1fr;
8
+ }
9
+
10
+ .calendar > mat-calendar {
11
+ min-height: 0;
12
+ overflow: hidden;
13
+ }
14
+
15
+ .calendar.expand {
16
+ animation: open 200ms ease-out;
17
+ }
18
+
19
+ .calendar.collapse {
20
+ animation: open 200ms ease-in reverse;
21
+ }
22
+
23
+ @keyframes open {
24
+ from {
25
+ grid-template-rows: 0fr;
26
+ opacity: 0;
27
+ }
28
+ to {
29
+ grid-template-rows: 1fr;
30
+ opacity: 1;
31
+ }
32
+ }
33
+
34
+ @media (prefers-reduced-motion: reduce) {
35
+ .calendar.expand,
36
+ .calendar.collapse {
37
+ animation-duration: 1ms;
4
38
  }
5
39
  }