geonetwork-ui 2.8.0-dev.cba2fd2eb → 2.8.0-dev.e46888fcc
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/esm2022/libs/api/repository/src/lib/gn4/elasticsearch/constant.mjs +1 -2
- package/esm2022/libs/feature/dataviz/src/index.mjs +1 -2
- package/esm2022/libs/feature/dataviz/src/lib/service/data.service.mjs +9 -2
- package/esm2022/libs/feature/editor/src/lib/components/multilingual-panel/multilingual-panel.component.mjs +3 -3
- package/esm2022/libs/feature/record/src/index.mjs +2 -1
- package/esm2022/libs/feature/record/src/lib/stac-view/stac-view.component.mjs +138 -0
- package/esm2022/libs/feature/search/src/lib/constants.mjs +1 -2
- package/esm2022/libs/ui/elements/src/index.mjs +2 -1
- package/esm2022/libs/ui/elements/src/lib/downloads-list/downloads-list.component.mjs +1 -1
- package/esm2022/libs/ui/elements/src/lib/metadata-info/metadata-info.component.mjs +5 -9
- package/esm2022/libs/ui/elements/src/lib/stac-items-result-grid/stac-items-result-grid.component.mjs +18 -0
- package/esm2022/libs/ui/elements/src/lib/user-feedback-item/user-feedback-item.component.mjs +5 -5
- package/esm2022/libs/ui/inputs/src/index.mjs +2 -1
- package/esm2022/libs/ui/inputs/src/lib/date-picker/date-picker.component.mjs +21 -7
- package/esm2022/libs/ui/inputs/src/lib/date-range-inputs/date-range-inputs.component.mjs +35 -0
- package/esm2022/libs/ui/layout/src/lib/paginable.interface.mjs +1 -1
- package/esm2022/libs/ui/layout/src/lib/previous-next-buttons/previous-next-buttons.component.mjs +13 -5
- package/esm2022/libs/util/i18n/src/lib/date-locales.mjs +33 -0
- package/esm2022/libs/util/shared/src/index.mjs +2 -1
- package/esm2022/libs/util/shared/src/lib/humanize-date.directive.mjs +33 -0
- package/esm2022/libs/util/shared/src/lib/services/date.service.mjs +19 -2
- package/esm2022/translations/de.json +9 -7
- package/esm2022/translations/en.json +9 -7
- package/esm2022/translations/es.json +5 -3
- package/esm2022/translations/fr.json +9 -7
- package/esm2022/translations/it.json +9 -7
- package/esm2022/translations/nl.json +5 -3
- package/esm2022/translations/pt.json +5 -3
- package/esm2022/translations/sk.json +6 -4
- package/fesm2022/geonetwork-ui-date-locales-MYnkDJ5h.mjs +35 -0
- package/fesm2022/geonetwork-ui-date-locales-MYnkDJ5h.mjs.map +1 -0
- package/fesm2022/geonetwork-ui.mjs +337 -193
- package/fesm2022/geonetwork-ui.mjs.map +1 -1
- package/libs/api/repository/src/lib/gn4/elasticsearch/constant.d.ts.map +1 -1
- package/libs/feature/dataviz/src/index.d.ts +0 -1
- package/libs/feature/dataviz/src/index.d.ts.map +1 -1
- package/libs/feature/dataviz/src/lib/service/data.service.d.ts +2 -1
- package/libs/feature/dataviz/src/lib/service/data.service.d.ts.map +1 -1
- package/libs/feature/record/src/index.d.ts +1 -0
- package/libs/feature/record/src/index.d.ts.map +1 -1
- package/libs/feature/record/src/lib/stac-view/stac-view.component.d.ts +35 -0
- package/libs/feature/record/src/lib/stac-view/stac-view.component.d.ts.map +1 -0
- package/libs/feature/search/src/lib/constants.d.ts.map +1 -1
- package/libs/ui/elements/src/index.d.ts +1 -0
- package/libs/ui/elements/src/index.d.ts.map +1 -1
- package/libs/ui/elements/src/lib/metadata-info/metadata-info.component.d.ts +0 -2
- package/libs/ui/elements/src/lib/metadata-info/metadata-info.component.d.ts.map +1 -1
- package/libs/ui/elements/src/lib/stac-items-result-grid/stac-items-result-grid.component.d.ts +8 -0
- package/libs/ui/elements/src/lib/stac-items-result-grid/stac-items-result-grid.component.d.ts.map +1 -0
- package/libs/ui/inputs/src/index.d.ts +1 -0
- package/libs/ui/inputs/src/index.d.ts.map +1 -1
- package/libs/ui/inputs/src/lib/date-picker/date-picker.component.d.ts +5 -0
- package/libs/ui/inputs/src/lib/date-picker/date-picker.component.d.ts.map +1 -1
- package/libs/ui/inputs/src/lib/date-range-inputs/date-range-inputs.component.d.ts +12 -0
- package/libs/ui/inputs/src/lib/date-range-inputs/date-range-inputs.component.d.ts.map +1 -0
- package/libs/ui/layout/src/lib/paginable.interface.d.ts +3 -3
- package/libs/ui/layout/src/lib/paginable.interface.d.ts.map +1 -1
- package/libs/ui/layout/src/lib/previous-next-buttons/previous-next-buttons.component.d.ts +2 -1
- package/libs/ui/layout/src/lib/previous-next-buttons/previous-next-buttons.component.d.ts.map +1 -1
- package/libs/util/i18n/src/lib/date-locales.d.ts +5 -0
- package/libs/util/i18n/src/lib/date-locales.d.ts.map +1 -0
- package/libs/util/shared/src/index.d.ts +1 -0
- package/libs/util/shared/src/index.d.ts.map +1 -1
- package/libs/util/shared/src/lib/humanize-date.directive.d.ts +15 -0
- package/libs/util/shared/src/lib/humanize-date.directive.d.ts.map +1 -0
- package/libs/util/shared/src/lib/services/date.service.d.ts +4 -0
- package/libs/util/shared/src/lib/services/date.service.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/libs/api/repository/src/lib/gn4/elasticsearch/constant.ts +0 -1
- package/src/libs/feature/dataviz/src/index.ts +0 -1
- package/src/libs/feature/dataviz/src/lib/service/data.service.ts +14 -0
- package/src/libs/feature/editor/src/lib/components/multilingual-panel/multilingual-panel.component.html +1 -0
- package/src/libs/feature/record/src/index.ts +1 -0
- package/src/libs/feature/record/src/lib/stac-view/stac-view.component.css +3 -0
- package/src/libs/feature/record/src/lib/stac-view/stac-view.component.html +68 -0
- package/src/libs/feature/record/src/lib/stac-view/stac-view.component.ts +190 -0
- package/src/libs/feature/search/src/lib/constants.ts +0 -1
- package/src/libs/ui/elements/src/index.ts +1 -0
- package/src/libs/ui/elements/src/lib/metadata-info/metadata-info.component.html +16 -12
- package/src/libs/ui/elements/src/lib/metadata-info/metadata-info.component.ts +2 -9
- package/src/libs/ui/elements/src/lib/stac-items-result-grid/stac-items-result-grid.component.html +13 -0
- package/src/libs/ui/elements/src/lib/stac-items-result-grid/stac-items-result-grid.component.ts +15 -0
- package/src/libs/ui/elements/src/lib/user-feedback-item/user-feedback-item.component.html +1 -1
- package/src/libs/ui/elements/src/lib/user-feedback-item/user-feedback-item.component.ts +2 -2
- package/src/libs/ui/inputs/src/index.ts +1 -0
- package/src/libs/ui/inputs/src/lib/date-picker/date-picker.component.ts +17 -1
- package/src/libs/ui/inputs/src/lib/date-range-inputs/date-range-inputs.component.css +0 -0
- package/src/libs/ui/inputs/src/lib/date-range-inputs/date-range-inputs.component.html +15 -0
- package/src/libs/ui/inputs/src/lib/date-range-inputs/date-range-inputs.component.ts +41 -0
- package/src/libs/ui/layout/src/lib/paginable.interface.ts +3 -3
- package/src/libs/ui/layout/src/lib/previous-next-buttons/previous-next-buttons.component.html +12 -6
- package/src/libs/ui/layout/src/lib/previous-next-buttons/previous-next-buttons.component.ts +4 -1
- package/src/libs/util/i18n/src/lib/date-locales.ts +63 -0
- package/src/libs/util/shared/src/index.ts +1 -0
- package/src/libs/util/shared/src/lib/humanize-date.directive.ts +35 -0
- package/src/libs/util/shared/src/lib/services/date.service.ts +27 -1
- package/translations/de.json +9 -7
- package/translations/en.json +9 -7
- package/translations/es.json +5 -3
- package/translations/fr.json +9 -7
- package/translations/it.json +9 -7
- package/translations/nl.json +5 -3
- package/translations/pt.json +5 -3
- package/translations/sk.json +6 -4
- package/esm2022/libs/feature/dataviz/src/lib/stac-view/stac-view.component.mjs +0 -51
- package/esm2022/libs/ui/elements/src/lib/user-feedback-item/time-since.pipe.mjs +0 -59
- package/libs/feature/dataviz/src/lib/stac-view/stac-view.component.d.ts +0 -16
- package/libs/feature/dataviz/src/lib/stac-view/stac-view.component.d.ts.map +0 -1
- package/libs/ui/elements/src/lib/user-feedback-item/time-since.pipe.d.ts +0 -11
- package/libs/ui/elements/src/lib/user-feedback-item/time-since.pipe.d.ts.map +0 -1
- package/src/libs/feature/dataviz/src/lib/stac-view/stac-view.component.html +0 -40
- package/src/libs/feature/dataviz/src/lib/stac-view/stac-view.component.ts +0 -62
- package/src/libs/ui/elements/src/lib/user-feedback-item/time-since.pipe.ts +0 -54
- /package/src/libs/{feature/dataviz/src/lib/stac-view/stac-view.component.css → ui/elements/src/lib/stac-items-result-grid/stac-items-result-grid.component.css} +0 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common'
|
|
2
|
+
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'
|
|
3
|
+
import {
|
|
4
|
+
DatasetRecord,
|
|
5
|
+
DatasetTemporalExtent,
|
|
6
|
+
} from '../../../../../../libs/common/domain/src/lib/model/record'
|
|
7
|
+
import { StacItemsResultGridComponent } from '../../../../../../libs/ui/elements/src'
|
|
8
|
+
import {
|
|
9
|
+
ButtonComponent,
|
|
10
|
+
DateRangeInputsComponent,
|
|
11
|
+
} from '../../../../../../libs/ui/inputs/src'
|
|
12
|
+
import { NgIconComponent, provideIcons } from '@ng-icons/core'
|
|
13
|
+
import { matDeleteOutline } from '@ng-icons/material-icons/outline'
|
|
14
|
+
import { TranslateDirective, TranslateService } from '@ngx-translate/core'
|
|
15
|
+
import { DataService } from '../../../../../../libs/feature/dataviz/src'
|
|
16
|
+
import {
|
|
17
|
+
BehaviorSubject,
|
|
18
|
+
catchError,
|
|
19
|
+
combineLatest,
|
|
20
|
+
debounceTime,
|
|
21
|
+
from,
|
|
22
|
+
map,
|
|
23
|
+
Observable,
|
|
24
|
+
of,
|
|
25
|
+
switchMap,
|
|
26
|
+
take,
|
|
27
|
+
tap,
|
|
28
|
+
} from 'rxjs'
|
|
29
|
+
import { GetCollectionItemsOptions, StacItem } from '@camptocamp/ogc-client'
|
|
30
|
+
import { MdViewFacade } from '../state'
|
|
31
|
+
import { PreviousNextButtonsComponent } from '../../../../../../libs/ui/layout/src'
|
|
32
|
+
import { FetchError } from '../../../../../../libs/util/data-fetcher/src'
|
|
33
|
+
import { PopupAlertComponent } from '../../../../../../libs/ui/widgets/src'
|
|
34
|
+
|
|
35
|
+
const STAC_ITEMS_PER_PAGE = 12
|
|
36
|
+
const DEBOUNCE_TIME_MS = 500
|
|
37
|
+
|
|
38
|
+
@Component({
|
|
39
|
+
selector: 'gn-ui-stac-view',
|
|
40
|
+
templateUrl: './stac-view.component.html',
|
|
41
|
+
styleUrls: ['./stac-view.component.css'],
|
|
42
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
43
|
+
standalone: true,
|
|
44
|
+
imports: [
|
|
45
|
+
CommonModule,
|
|
46
|
+
NgIconComponent,
|
|
47
|
+
TranslateDirective,
|
|
48
|
+
StacItemsResultGridComponent,
|
|
49
|
+
DateRangeInputsComponent,
|
|
50
|
+
PreviousNextButtonsComponent,
|
|
51
|
+
PopupAlertComponent,
|
|
52
|
+
ButtonComponent,
|
|
53
|
+
],
|
|
54
|
+
viewProviders: [provideIcons({ matDeleteOutline })],
|
|
55
|
+
})
|
|
56
|
+
export class StacViewComponent implements OnInit {
|
|
57
|
+
isFilterModified = false
|
|
58
|
+
error = null
|
|
59
|
+
|
|
60
|
+
initialTemporalExtent: DatasetTemporalExtent | null = null
|
|
61
|
+
currentTemporalExtent$ = new BehaviorSubject<DatasetTemporalExtent | null>(
|
|
62
|
+
null
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
initialPageUrl: string
|
|
66
|
+
previousPageUrl: string
|
|
67
|
+
nextPageUrl: string
|
|
68
|
+
currentPageUrl$ = new BehaviorSubject<string | null>(null)
|
|
69
|
+
|
|
70
|
+
items$: Observable<StacItem[]> = combineLatest([
|
|
71
|
+
this.currentPageUrl$,
|
|
72
|
+
this.currentTemporalExtent$,
|
|
73
|
+
]).pipe(
|
|
74
|
+
debounceTime(DEBOUNCE_TIME_MS),
|
|
75
|
+
switchMap(([currentPageUrl, temporalExtent]) => {
|
|
76
|
+
this.error = null
|
|
77
|
+
const options: GetCollectionItemsOptions = {
|
|
78
|
+
limit: STAC_ITEMS_PER_PAGE,
|
|
79
|
+
}
|
|
80
|
+
if (temporalExtent && (temporalExtent.start || temporalExtent.end)) {
|
|
81
|
+
options.datetime = {
|
|
82
|
+
...(temporalExtent.start && { start: temporalExtent.start }),
|
|
83
|
+
...(temporalExtent.end && { end: temporalExtent.end }),
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return from(
|
|
87
|
+
this.dataService.getItemsFromStacApi(currentPageUrl, options)
|
|
88
|
+
).pipe(
|
|
89
|
+
tap((stacDocument) => {
|
|
90
|
+
this.previousPageUrl =
|
|
91
|
+
stacDocument.links.find((link) => link.rel === 'previous')?.href ||
|
|
92
|
+
null
|
|
93
|
+
this.nextPageUrl =
|
|
94
|
+
stacDocument.links.find((link) => link.rel === 'next')?.href || null
|
|
95
|
+
}),
|
|
96
|
+
map((stacDocument) => stacDocument.features),
|
|
97
|
+
catchError((err) => {
|
|
98
|
+
this.handleError(err)
|
|
99
|
+
return of([])
|
|
100
|
+
})
|
|
101
|
+
)
|
|
102
|
+
})
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
constructor(
|
|
106
|
+
private dataService: DataService,
|
|
107
|
+
private metadataViewFacade: MdViewFacade,
|
|
108
|
+
private translateService: TranslateService
|
|
109
|
+
) {}
|
|
110
|
+
|
|
111
|
+
ngOnInit() {
|
|
112
|
+
this.metadataViewFacade.metadata$
|
|
113
|
+
.pipe(
|
|
114
|
+
take(1),
|
|
115
|
+
map((metadata) => {
|
|
116
|
+
const temporalExtents =
|
|
117
|
+
metadata?.kind === 'dataset'
|
|
118
|
+
? (metadata as DatasetRecord).temporalExtents
|
|
119
|
+
: []
|
|
120
|
+
|
|
121
|
+
return temporalExtents.length > 0
|
|
122
|
+
? temporalExtents[0]
|
|
123
|
+
: ({
|
|
124
|
+
start: null,
|
|
125
|
+
end: null,
|
|
126
|
+
} as DatasetTemporalExtent)
|
|
127
|
+
})
|
|
128
|
+
)
|
|
129
|
+
.subscribe((extent) => {
|
|
130
|
+
this.initialTemporalExtent = extent
|
|
131
|
+
this.currentTemporalExtent$.next(extent)
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
this.metadataViewFacade.stacLinks$
|
|
135
|
+
.pipe(
|
|
136
|
+
take(1),
|
|
137
|
+
map((links) => (links && links.length > 0 ? links[0] : null))
|
|
138
|
+
)
|
|
139
|
+
.subscribe((link) => {
|
|
140
|
+
if (link) {
|
|
141
|
+
this.initialPageUrl = link.url.href
|
|
142
|
+
this.currentPageUrl$.next(link.url.href)
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
onTemporalExtentChange(extent: DatasetTemporalExtent | null) {
|
|
148
|
+
this.currentTemporalExtent$.next(extent)
|
|
149
|
+
// make sure to use url without pagination token when temporal filter changes
|
|
150
|
+
this.currentPageUrl$.next(this.initialPageUrl)
|
|
151
|
+
this.isFilterModified = true
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
onResetFilters() {
|
|
155
|
+
this.currentTemporalExtent$.next(this.initialTemporalExtent)
|
|
156
|
+
this.isFilterModified = false
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
handleError(error: FetchError | Error | string) {
|
|
160
|
+
if (error instanceof FetchError) {
|
|
161
|
+
this.error = this.translateService.instant(
|
|
162
|
+
`dataset.error.${error.type}`,
|
|
163
|
+
{
|
|
164
|
+
info: error.info,
|
|
165
|
+
}
|
|
166
|
+
)
|
|
167
|
+
console.warn(error.message)
|
|
168
|
+
} else if (error instanceof Error) {
|
|
169
|
+
this.error = this.translateService.instant(error.message)
|
|
170
|
+
console.warn(error.stack || error)
|
|
171
|
+
} else {
|
|
172
|
+
this.error = this.translateService.instant(error)
|
|
173
|
+
console.warn(error)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Paginable API
|
|
178
|
+
get isFirstPage() {
|
|
179
|
+
return this.previousPageUrl == null
|
|
180
|
+
}
|
|
181
|
+
get isLastPage() {
|
|
182
|
+
return this.nextPageUrl == null
|
|
183
|
+
}
|
|
184
|
+
goToNextPage() {
|
|
185
|
+
this.currentPageUrl$.next(this.nextPageUrl)
|
|
186
|
+
}
|
|
187
|
+
goToPrevPage() {
|
|
188
|
+
this.currentPageUrl$.next(this.previousPageUrl)
|
|
189
|
+
}
|
|
190
|
+
}
|
|
@@ -27,3 +27,4 @@ export * from './lib/application-banner/application-banner.component'
|
|
|
27
27
|
export * from './lib/internal-link-card/internal-link-card.component'
|
|
28
28
|
export * from './lib/service-capabilities/service-capabilities.component'
|
|
29
29
|
export * from './lib/record-feature-catalog/feature-catalog-list/feature-catalog-list.component'
|
|
30
|
+
export * from './lib/stac-items-result-grid/stac-items-result-grid.component'
|
|
@@ -186,27 +186,30 @@
|
|
|
186
186
|
data-test="details-panel-resource-created"
|
|
187
187
|
>
|
|
188
188
|
<p class="text-sm" translate>record.metadata.creation</p>
|
|
189
|
-
<p
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
<p
|
|
190
|
+
class="text-primary font-medium mt-1 resource-created"
|
|
191
|
+
[gnUiHumanizeDate]="metadata.resourceCreated"
|
|
192
|
+
></p>
|
|
192
193
|
</div>
|
|
193
194
|
<div
|
|
194
195
|
*ngIf="metadata.resourcePublished"
|
|
195
196
|
data-test="details-panel-resource-published"
|
|
196
197
|
>
|
|
197
198
|
<p class="text-sm" translate>record.metadata.publication</p>
|
|
198
|
-
<p
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
<p
|
|
200
|
+
class="text-primary font-medium mt-1 resource-published"
|
|
201
|
+
[gnUiHumanizeDate]="metadata.resourcePublished"
|
|
202
|
+
></p>
|
|
201
203
|
</div>
|
|
202
204
|
<div
|
|
203
205
|
*ngIf="metadata.resourceUpdated"
|
|
204
206
|
data-test="details-panel-resource-updated"
|
|
205
207
|
>
|
|
206
208
|
<p class="text-sm" translate>record.metadata.update</p>
|
|
207
|
-
<p
|
|
208
|
-
|
|
209
|
-
|
|
209
|
+
<p
|
|
210
|
+
class="text-primary font-medium mt-1 resource-updated"
|
|
211
|
+
[gnUiHumanizeDate]="metadata.resourceUpdated"
|
|
212
|
+
></p>
|
|
210
213
|
</div>
|
|
211
214
|
<div
|
|
212
215
|
*ngIf="metadata.kind === 'dataset' && metadata.updateFrequency"
|
|
@@ -294,9 +297,10 @@
|
|
|
294
297
|
<div class="flex flex-col gap-4 mr-4 py-5 rounded text-gray-700">
|
|
295
298
|
<div *ngIf="metadata.recordUpdated">
|
|
296
299
|
<p class="text-sm" translate>record.metadata.updatedOn</p>
|
|
297
|
-
<p
|
|
298
|
-
|
|
299
|
-
|
|
300
|
+
<p
|
|
301
|
+
class="text-primary font-medium"
|
|
302
|
+
[gnUiHumanizeDate]="metadata.recordUpdated"
|
|
303
|
+
></p>
|
|
300
304
|
</div>
|
|
301
305
|
<div *ngIf="metadata.landingPage">
|
|
302
306
|
<p class="text-sm" translate>record.metadata.sheet</p>
|
|
@@ -26,7 +26,7 @@ import { matOpenInNew } from '@ng-icons/material-icons/baseline'
|
|
|
26
26
|
import { matMailOutline } from '@ng-icons/material-icons/outline'
|
|
27
27
|
import { ThumbnailComponent } from '../thumbnail/thumbnail.component'
|
|
28
28
|
import { GnUiLinkifyDirective } from './linkify.directive'
|
|
29
|
-
|
|
29
|
+
import { GnUiHumanizeDateDirective } from '../../../../../../libs/util/shared/src'
|
|
30
30
|
import { CommonModule } from '@angular/common'
|
|
31
31
|
import { SpatialExtentComponent } from '../../../../../../libs/ui/map/src'
|
|
32
32
|
|
|
@@ -49,6 +49,7 @@ import { SpatialExtentComponent } from '../../../../../../libs/ui/map/src'
|
|
|
49
49
|
CopyTextButtonComponent,
|
|
50
50
|
NgIcon,
|
|
51
51
|
GnUiLinkifyDirective,
|
|
52
|
+
GnUiHumanizeDateDirective,
|
|
52
53
|
SpatialExtentComponent,
|
|
53
54
|
],
|
|
54
55
|
viewProviders: [
|
|
@@ -146,12 +147,4 @@ export class MetadataInfoComponent {
|
|
|
146
147
|
onKeywordClick(keyword: Keyword) {
|
|
147
148
|
this.keyword.emit(keyword)
|
|
148
149
|
}
|
|
149
|
-
|
|
150
|
-
formatDate(date: Date): string {
|
|
151
|
-
return this.dateService.formatDate(date)
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
formatDateTime(date: Date): string {
|
|
155
|
-
return this.dateService.formatDateTime(date)
|
|
156
|
-
}
|
|
157
150
|
}
|
package/src/libs/ui/elements/src/lib/stac-items-result-grid/stac-items-result-grid.component.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-[10px]">
|
|
2
|
+
<div *ngFor="let item of items">
|
|
3
|
+
<div
|
|
4
|
+
data-cy="stac-item-card"
|
|
5
|
+
class="h-[173px] flex flex-col justify-between gap-4 bg-white rounded-lg border border-gray-300 px-5 py-3 mx-auto"
|
|
6
|
+
>
|
|
7
|
+
<h2 class="text-xl text-black line-clamp-4 break-words">
|
|
8
|
+
{{ item.id }}
|
|
9
|
+
</h2>
|
|
10
|
+
<p class="truncate">{{ item.properties.datetime }}</p>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
package/src/libs/ui/elements/src/lib/stac-items-result-grid/stac-items-result-grid.component.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common'
|
|
2
|
+
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
|
|
3
|
+
import { StacItem } from '@camptocamp/ogc-client'
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'gn-ui-stac-items-result-grid',
|
|
7
|
+
standalone: true,
|
|
8
|
+
imports: [CommonModule],
|
|
9
|
+
templateUrl: './stac-items-result-grid.component.html',
|
|
10
|
+
styleUrl: './stac-items-result-grid.component.css',
|
|
11
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
12
|
+
})
|
|
13
|
+
export class StacItemsResultGridComponent {
|
|
14
|
+
@Input() items: StacItem[] = []
|
|
15
|
+
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
</div>
|
|
14
14
|
<div class="p-4 flex flex-col">
|
|
15
15
|
<span>{{ userFeedbackParent.authorName }}</span>
|
|
16
|
-
<span
|
|
16
|
+
<span [gnUiHumanizeDate]="userFeedbackParent.date"></span>
|
|
17
17
|
</div>
|
|
18
18
|
</div>
|
|
19
19
|
<div data-cy="commentText" class="mt-4 whitespace-pre-line">
|
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
UserFeedbackViewModel,
|
|
12
12
|
} from '../../../../../../libs/common/domain/src/lib/model/record'
|
|
13
13
|
import { UserModel } from '../../../../../../libs/common/domain/src/lib/model/user'
|
|
14
|
-
import { TimeSincePipe } from './time-since.pipe'
|
|
15
14
|
import { CommonModule } from '@angular/common'
|
|
16
15
|
import { ButtonComponent, TextAreaComponent } from '../../../../../../libs/ui/inputs/src'
|
|
17
16
|
import { TranslatePipe } from '@ngx-translate/core'
|
|
18
17
|
import { SpinningLoaderComponent } from '../../../../../../libs/ui/widgets/src'
|
|
19
18
|
import { NgIcon, provideIcons } from '@ng-icons/core'
|
|
20
19
|
import { matSendOutline } from '@ng-icons/material-icons/outline'
|
|
20
|
+
import { GnUiHumanizeDateDirective } from '../../../../../../libs/util/shared/src'
|
|
21
21
|
|
|
22
22
|
@Component({
|
|
23
23
|
selector: 'gn-ui-user-feedback-item',
|
|
@@ -27,11 +27,11 @@ import { matSendOutline } from '@ng-icons/material-icons/outline'
|
|
|
27
27
|
standalone: true,
|
|
28
28
|
imports: [
|
|
29
29
|
CommonModule,
|
|
30
|
-
TimeSincePipe,
|
|
31
30
|
TextAreaComponent,
|
|
32
31
|
TranslatePipe,
|
|
33
32
|
ButtonComponent,
|
|
34
33
|
SpinningLoaderComponent,
|
|
34
|
+
GnUiHumanizeDateDirective,
|
|
35
35
|
NgIcon,
|
|
36
36
|
],
|
|
37
37
|
viewProviders: [
|
|
@@ -24,3 +24,4 @@ export * from './lib/text-input/text-input.component'
|
|
|
24
24
|
export * from './lib/url-input/url-input.component'
|
|
25
25
|
export * from './lib/viewport-intersector/viewport-intersector.component'
|
|
26
26
|
export * from './lib/search-feature-catalog/search-feature-catalog.component'
|
|
27
|
+
export * from './lib/date-range-inputs/date-range-inputs.component'
|
|
@@ -5,7 +5,11 @@ import {
|
|
|
5
5
|
Input,
|
|
6
6
|
Output,
|
|
7
7
|
} from '@angular/core'
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
DateAdapter,
|
|
10
|
+
MAT_DATE_LOCALE,
|
|
11
|
+
MatNativeDateModule,
|
|
12
|
+
} from '@angular/material/core'
|
|
9
13
|
import { MatDatepickerModule } from '@angular/material/datepicker'
|
|
10
14
|
import { ButtonComponent } from '../button/button.component'
|
|
11
15
|
import {
|
|
@@ -14,6 +18,7 @@ import {
|
|
|
14
18
|
provideNgIconsConfig,
|
|
15
19
|
} from '@ng-icons/core'
|
|
16
20
|
import { iconoirCalendar } from '@ng-icons/iconoir'
|
|
21
|
+
import { TranslateService } from '@ngx-translate/core'
|
|
17
22
|
|
|
18
23
|
@Component({
|
|
19
24
|
selector: 'gn-ui-date-picker',
|
|
@@ -32,9 +37,20 @@ import { iconoirCalendar } from '@ng-icons/iconoir'
|
|
|
32
37
|
provideNgIconsConfig({
|
|
33
38
|
size: '1.5rem',
|
|
34
39
|
}),
|
|
40
|
+
{
|
|
41
|
+
provide: MAT_DATE_LOCALE,
|
|
42
|
+
useFactory: (locale: string) => locale,
|
|
43
|
+
},
|
|
35
44
|
],
|
|
36
45
|
})
|
|
37
46
|
export class DatePickerComponent {
|
|
38
47
|
@Input() date: Date
|
|
39
48
|
@Output() dateChange = new EventEmitter<Date>()
|
|
49
|
+
|
|
50
|
+
constructor(
|
|
51
|
+
private dateAdapter: DateAdapter<Date>,
|
|
52
|
+
private translate: TranslateService
|
|
53
|
+
) {
|
|
54
|
+
this.dateAdapter.setLocale(this.translate.currentLang)
|
|
55
|
+
}
|
|
40
56
|
}
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<div class="m-8">
|
|
2
|
+
<p class="mb-4" translate>daterange.filter.period</p>
|
|
3
|
+
<p translate>daterange.filter.from</p>
|
|
4
|
+
<gn-ui-date-picker
|
|
5
|
+
id="start-date-picker"
|
|
6
|
+
[date]="temporalExtent?.start"
|
|
7
|
+
(dateChange)="onStartDateChange($event)"
|
|
8
|
+
></gn-ui-date-picker>
|
|
9
|
+
<p class="mt-4" translate>daterange.filter.to</p>
|
|
10
|
+
<gn-ui-date-picker
|
|
11
|
+
id="end-date-picker"
|
|
12
|
+
[date]="temporalExtent?.end"
|
|
13
|
+
(dateChange)="onEndDateChange($event)"
|
|
14
|
+
></gn-ui-date-picker>
|
|
15
|
+
</div>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
EventEmitter,
|
|
5
|
+
Input,
|
|
6
|
+
Output,
|
|
7
|
+
} from '@angular/core'
|
|
8
|
+
import { DatePickerComponent } from '../date-picker/date-picker.component'
|
|
9
|
+
import { DatasetTemporalExtent } from '../../../../../../libs/common/domain/src/lib/model/record/metadata.model'
|
|
10
|
+
import { TranslateDirective } from '@ngx-translate/core'
|
|
11
|
+
import { CommonModule } from '@angular/common'
|
|
12
|
+
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'gn-ui-date-range-inputs',
|
|
15
|
+
standalone: true,
|
|
16
|
+
imports: [CommonModule, TranslateDirective, DatePickerComponent],
|
|
17
|
+
templateUrl: './date-range-inputs.component.html',
|
|
18
|
+
styleUrl: './date-range-inputs.component.css',
|
|
19
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
20
|
+
})
|
|
21
|
+
export class DateRangeInputsComponent {
|
|
22
|
+
@Input() temporalExtent: DatasetTemporalExtent | null
|
|
23
|
+
@Output() temporalExtentChange =
|
|
24
|
+
new EventEmitter<DatasetTemporalExtent | null>()
|
|
25
|
+
|
|
26
|
+
onStartDateChange(date: Date) {
|
|
27
|
+
this.temporalExtent = {
|
|
28
|
+
...this.temporalExtent,
|
|
29
|
+
start: date,
|
|
30
|
+
}
|
|
31
|
+
this.temporalExtentChange.emit(this.temporalExtent)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
onEndDateChange(date: Date) {
|
|
35
|
+
this.temporalExtent = {
|
|
36
|
+
...this.temporalExtent,
|
|
37
|
+
end: date,
|
|
38
|
+
}
|
|
39
|
+
this.temporalExtentChange.emit(this.temporalExtent)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
export interface Paginable {
|
|
7
7
|
isFirstPage: boolean
|
|
8
8
|
isLastPage: boolean
|
|
9
|
-
pagesCount
|
|
10
|
-
currentPage
|
|
11
|
-
goToPage(index: number): void
|
|
9
|
+
pagesCount?: number
|
|
10
|
+
currentPage?: number
|
|
11
|
+
goToPage?(index: number): void
|
|
12
12
|
goToNextPage(): void
|
|
13
13
|
goToPrevPage(): void
|
|
14
14
|
}
|
package/src/libs/ui/layout/src/lib/previous-next-buttons/previous-next-buttons.component.html
CHANGED
|
@@ -3,28 +3,34 @@
|
|
|
3
3
|
data-test="previousButton"
|
|
4
4
|
type="light"
|
|
5
5
|
[extraClass]="
|
|
6
|
-
'w-10 h-8 px-2 py-1 rounded-lg ' +
|
|
6
|
+
'w-auto min-w-10 h-8 px-2 py-1 rounded-lg ' +
|
|
7
7
|
(!listComponent.isFirstPage
|
|
8
|
-
? 'border border-gray-300'
|
|
9
|
-
: 'border border-gray-100')
|
|
8
|
+
? 'border border-gray-300 text-main'
|
|
9
|
+
: 'border border-gray-100 text-gray-300')
|
|
10
10
|
"
|
|
11
11
|
[disabled]="listComponent.isFirstPage"
|
|
12
12
|
(buttonClick)="listComponent.goToPrevPage()"
|
|
13
13
|
>
|
|
14
14
|
<ng-icon name="matArrowBackIos"></ng-icon>
|
|
15
|
+
<span *ngIf="displayLabels" class="ml-2" translate
|
|
16
|
+
>pagination.previousPage</span
|
|
17
|
+
>
|
|
15
18
|
</gn-ui-button>
|
|
16
19
|
<gn-ui-button
|
|
17
20
|
data-test="nextButton"
|
|
18
21
|
type="light"
|
|
19
22
|
[extraClass]="
|
|
20
|
-
'w-10 h-8 px-2 py-1 rounded-lg ' +
|
|
23
|
+
'w-auto min-w-10 h-8 px-2 py-1 rounded-lg ' +
|
|
21
24
|
(!listComponent.isLastPage
|
|
22
|
-
? 'border border-gray-300'
|
|
23
|
-
: 'border border-gray-100')
|
|
25
|
+
? 'border border-gray-300 text-main'
|
|
26
|
+
: 'border border-gray-100 text-gray-300')
|
|
24
27
|
"
|
|
25
28
|
[disabled]="listComponent.isLastPage"
|
|
26
29
|
(buttonClick)="listComponent.goToNextPage()"
|
|
27
30
|
>
|
|
31
|
+
<span *ngIf="displayLabels" class="mr-2" translate
|
|
32
|
+
>pagination.nextPage</span
|
|
33
|
+
>
|
|
28
34
|
<ng-icon name="matArrowForwardIos"></ng-icon>
|
|
29
35
|
</gn-ui-button>
|
|
30
36
|
</div>
|
|
@@ -10,13 +10,15 @@ import {
|
|
|
10
10
|
} from '@ng-icons/material-icons/baseline'
|
|
11
11
|
import { Paginable } from '../paginable.interface'
|
|
12
12
|
import { ButtonComponent } from '../../../../../../libs/ui/inputs/src'
|
|
13
|
+
import { CommonModule } from '@angular/common'
|
|
14
|
+
import { TranslateDirective } from '@ngx-translate/core'
|
|
13
15
|
|
|
14
16
|
@Component({
|
|
15
17
|
selector: 'gn-ui-previous-next-buttons',
|
|
16
18
|
templateUrl: './previous-next-buttons.component.html',
|
|
17
19
|
styleUrls: ['./previous-next-buttons.component.css'],
|
|
18
20
|
standalone: true,
|
|
19
|
-
imports: [ButtonComponent, NgIconComponent],
|
|
21
|
+
imports: [CommonModule, ButtonComponent, NgIconComponent, TranslateDirective],
|
|
20
22
|
providers: [
|
|
21
23
|
provideIcons({ matArrowBackIos, matArrowForwardIos }),
|
|
22
24
|
provideNgIconsConfig({
|
|
@@ -26,4 +28,5 @@ import { ButtonComponent } from '../../../../../../libs/ui/inputs/src'
|
|
|
26
28
|
})
|
|
27
29
|
export class PreviousNextButtonsComponent {
|
|
28
30
|
@Input() listComponent: Paginable
|
|
31
|
+
@Input() displayLabels = false
|
|
29
32
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { LanguageCode2 } from './language-codes'
|
|
2
|
+
import {
|
|
3
|
+
ar,
|
|
4
|
+
az,
|
|
5
|
+
ca,
|
|
6
|
+
cs,
|
|
7
|
+
cy,
|
|
8
|
+
da,
|
|
9
|
+
de,
|
|
10
|
+
enUS,
|
|
11
|
+
es,
|
|
12
|
+
fi,
|
|
13
|
+
fr,
|
|
14
|
+
hy,
|
|
15
|
+
is,
|
|
16
|
+
it,
|
|
17
|
+
ka,
|
|
18
|
+
ko,
|
|
19
|
+
Locale,
|
|
20
|
+
nl,
|
|
21
|
+
nn,
|
|
22
|
+
pl,
|
|
23
|
+
pt,
|
|
24
|
+
ru,
|
|
25
|
+
sk,
|
|
26
|
+
sv,
|
|
27
|
+
tr,
|
|
28
|
+
uk,
|
|
29
|
+
zhCN,
|
|
30
|
+
} from 'date-fns/locale'
|
|
31
|
+
|
|
32
|
+
// all 2-char language codes should be listed here
|
|
33
|
+
const locales: Record<LanguageCode2, Locale> = {
|
|
34
|
+
en: enUS,
|
|
35
|
+
nl: nl,
|
|
36
|
+
fr: fr,
|
|
37
|
+
de: de,
|
|
38
|
+
ko: ko,
|
|
39
|
+
es: es,
|
|
40
|
+
cs: cs,
|
|
41
|
+
ca: ca,
|
|
42
|
+
fi: fi,
|
|
43
|
+
is: is,
|
|
44
|
+
it: it,
|
|
45
|
+
pt: pt,
|
|
46
|
+
ru: ru,
|
|
47
|
+
zh: zhCN,
|
|
48
|
+
sk: sk,
|
|
49
|
+
ar: ar,
|
|
50
|
+
da: da,
|
|
51
|
+
no: nn,
|
|
52
|
+
pl: pl,
|
|
53
|
+
sv: sv,
|
|
54
|
+
tr: tr,
|
|
55
|
+
hy: hy,
|
|
56
|
+
az: az,
|
|
57
|
+
ka: ka,
|
|
58
|
+
uk: uk,
|
|
59
|
+
cy: cy,
|
|
60
|
+
rm: enUS, // locale is unavailable
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default locales
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Renderer2, Directive, ElementRef, Input, OnInit } from '@angular/core'
|
|
2
|
+
import { DateService } from './services/date.service'
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
selector: '[gnUiHumanizeDate]',
|
|
6
|
+
standalone: true,
|
|
7
|
+
})
|
|
8
|
+
export class GnUiHumanizeDateDirective implements OnInit {
|
|
9
|
+
@Input() gnUiHumanizeDate: Date | string
|
|
10
|
+
|
|
11
|
+
constructor(
|
|
12
|
+
private dateService: DateService,
|
|
13
|
+
private el: ElementRef,
|
|
14
|
+
private renderer: Renderer2
|
|
15
|
+
) {}
|
|
16
|
+
|
|
17
|
+
async ngOnInit() {
|
|
18
|
+
await this.updateElement()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
private async updateElement(): Promise<void> {
|
|
22
|
+
const dateValue = this.gnUiHumanizeDate
|
|
23
|
+
|
|
24
|
+
const fullDateTime = this.dateService.formatDateTime(dateValue)
|
|
25
|
+
const relativeDate =
|
|
26
|
+
await this.dateService.formatRelativeDateTime(dateValue)
|
|
27
|
+
|
|
28
|
+
this.renderer.setAttribute(this.el.nativeElement, 'title', fullDateTime)
|
|
29
|
+
this.renderer.setProperty(
|
|
30
|
+
this.el.nativeElement,
|
|
31
|
+
'textContent',
|
|
32
|
+
relativeDate
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
}
|