geonetwork-ui 2.4.2-dev.ff0aab388 → 2.5.0-dev.6d78023ff

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 (185) hide show
  1. package/esm2022/libs/api/metadata-converter/src/lib/iso19139/read-parts.mjs +2 -3
  2. package/esm2022/libs/api/metadata-converter/src/lib/iso19139/write-parts.mjs +4 -1
  3. package/esm2022/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.mjs +17 -5
  4. package/esm2022/libs/api/repository/src/lib/gn4/gn4-repository.mjs +2 -2
  5. package/esm2022/libs/common/domain/src/lib/model/record/metadata.model.mjs +1 -1
  6. package/esm2022/libs/feature/dataviz/src/lib/geo-table-view/geo-table-view.component.mjs +18 -16
  7. package/esm2022/libs/feature/dataviz/src/lib/service/data.service.mjs +4 -14
  8. package/esm2022/libs/feature/dataviz/src/lib/table-view/table-view.component.mjs +12 -17
  9. package/esm2022/libs/feature/editor/src/lib/components/contact-card/contact-card.component.mjs +3 -3
  10. package/esm2022/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.mjs +3 -3
  11. package/esm2022/libs/feature/editor/src/lib/components/import-record/import-record.component.mjs +3 -4
  12. package/esm2022/libs/feature/editor/src/lib/components/online-resource-card/online-resource-card.component.mjs +3 -3
  13. package/esm2022/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.mjs +31 -40
  14. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts/form-field-contacts.component.mjs +3 -3
  15. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts-for-resource/form-field-contacts-for-resource.component.mjs +3 -3
  16. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.mjs +3 -3
  17. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.mjs +8 -9
  18. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.mjs +5 -25
  19. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.mjs +5 -4
  20. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.mjs +3 -3
  21. package/esm2022/libs/feature/editor/src/lib/components/wizard-summarize/wizard-summarize.component.mjs +11 -11
  22. package/esm2022/libs/feature/editor/src/lib/fields.config.mjs +10 -2
  23. package/esm2022/libs/feature/record/src/lib/data-view/data-view.component.mjs +6 -3
  24. package/esm2022/libs/feature/record/src/lib/data-view-share/data-view-share.component.mjs +3 -3
  25. package/esm2022/libs/feature/record/src/lib/feature-record.module.mjs +6 -7
  26. package/esm2022/libs/feature/record/src/lib/map-view/map-view.component.mjs +6 -3
  27. package/esm2022/libs/ui/dataviz/src/index.mjs +3 -3
  28. package/esm2022/libs/ui/dataviz/src/lib/data-table/custom.mat.paginator.intl.mjs +51 -0
  29. package/esm2022/libs/ui/dataviz/src/lib/data-table/data-table.component.mjs +133 -0
  30. package/esm2022/libs/ui/dataviz/src/lib/data-table/data-table.data.source.mjs +24 -0
  31. package/esm2022/libs/ui/dataviz/src/lib/data-table/data-table.fixtures.mjs +82 -0
  32. package/esm2022/libs/ui/elements/src/lib/metadata-info/metadata-info.component.mjs +18 -10
  33. package/esm2022/libs/ui/search/src/lib/record-preview-feed/record-preview-feed.component.mjs +3 -1
  34. package/esm2022/libs/ui/search/src/lib/results-table/results-table.component.mjs +15 -13
  35. package/esm2022/libs/util/data-fetcher/src/index.mjs +3 -1
  36. package/esm2022/libs/util/data-fetcher/src/lib/data-fetcher.mjs +5 -1
  37. package/esm2022/libs/util/data-fetcher/src/lib/headers.mjs +3 -2
  38. package/esm2022/libs/util/data-fetcher/src/lib/model.mjs +8 -3
  39. package/esm2022/libs/util/data-fetcher/src/lib/readers/wfs.mjs +97 -0
  40. package/esm2022/libs/util/data-fetcher/src/lib/utils.mjs +3 -3
  41. package/esm2022/libs/util/shared/src/lib/services/date.service.mjs +41 -0
  42. package/esm2022/libs/util/shared/src/lib/services/index.mjs +2 -1
  43. package/esm2022/libs/util/shared/src/lib/utils/temporal-extent-union.mjs +4 -4
  44. package/esm2022/translations/de.json +20 -5
  45. package/esm2022/translations/en.json +29 -14
  46. package/esm2022/translations/es.json +20 -5
  47. package/esm2022/translations/fr.json +30 -15
  48. package/esm2022/translations/it.json +39 -26
  49. package/esm2022/translations/nl.json +20 -5
  50. package/esm2022/translations/pt.json +20 -5
  51. package/fesm2022/geonetwork-ui.mjs +942 -534
  52. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  53. package/libs/api/metadata-converter/src/lib/iso19139/read-parts.d.ts.map +1 -1
  54. package/libs/api/metadata-converter/src/lib/iso19139/write-parts.d.ts.map +1 -1
  55. package/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.d.ts +2 -1
  56. package/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.d.ts.map +1 -1
  57. package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts.map +1 -1
  58. package/libs/feature/dataviz/src/lib/geo-table-view/geo-table-view.component.d.ts +7 -9
  59. package/libs/feature/dataviz/src/lib/geo-table-view/geo-table-view.component.d.ts.map +1 -1
  60. package/libs/feature/dataviz/src/lib/service/data.service.d.ts.map +1 -1
  61. package/libs/feature/dataviz/src/lib/table-view/table-view.component.d.ts +3 -6
  62. package/libs/feature/dataviz/src/lib/table-view/table-view.component.d.ts.map +1 -1
  63. package/libs/feature/editor/src/lib/components/import-record/import-record.component.d.ts +0 -1
  64. package/libs/feature/editor/src/lib/components/import-record/import-record.component.d.ts.map +1 -1
  65. package/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.d.ts +7 -14
  66. package/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.d.ts.map +1 -1
  67. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.d.ts +2 -2
  68. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.d.ts.map +1 -1
  69. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.d.ts +1 -6
  70. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.d.ts.map +1 -1
  71. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.d.ts.map +1 -1
  72. package/libs/feature/editor/src/lib/components/wizard-summarize/wizard-summarize.component.d.ts +3 -3
  73. package/libs/feature/editor/src/lib/components/wizard-summarize/wizard-summarize.component.d.ts.map +1 -1
  74. package/libs/feature/editor/src/lib/fields.config.d.ts.map +1 -1
  75. package/libs/feature/record/src/lib/data-view/data-view.component.d.ts +2 -1
  76. package/libs/feature/record/src/lib/data-view/data-view.component.d.ts.map +1 -1
  77. package/libs/feature/record/src/lib/feature-record.module.d.ts +2 -2
  78. package/libs/feature/record/src/lib/feature-record.module.d.ts.map +1 -1
  79. package/libs/feature/record/src/lib/map-view/map-view.component.d.ts +2 -1
  80. package/libs/feature/record/src/lib/map-view/map-view.component.d.ts.map +1 -1
  81. package/libs/ui/dataviz/src/index.d.ts +2 -2
  82. package/libs/ui/dataviz/src/index.d.ts.map +1 -1
  83. package/libs/ui/dataviz/src/lib/data-table/custom.mat.paginator.intl.d.ts +14 -0
  84. package/libs/ui/dataviz/src/lib/data-table/custom.mat.paginator.intl.d.ts.map +1 -0
  85. package/libs/ui/dataviz/src/lib/data-table/data-table.component.d.ts +45 -0
  86. package/libs/ui/dataviz/src/lib/data-table/data-table.component.d.ts.map +1 -0
  87. package/libs/ui/dataviz/src/lib/data-table/data-table.data.source.d.ts +12 -0
  88. package/libs/ui/dataviz/src/lib/data-table/data-table.data.source.d.ts.map +1 -0
  89. package/libs/ui/dataviz/src/lib/data-table/data-table.fixtures.d.ts +10 -0
  90. package/libs/ui/dataviz/src/lib/data-table/data-table.fixtures.d.ts.map +1 -0
  91. package/libs/ui/elements/src/lib/metadata-info/metadata-info.component.d.ts +5 -0
  92. package/libs/ui/elements/src/lib/metadata-info/metadata-info.component.d.ts.map +1 -1
  93. package/libs/ui/search/src/lib/record-preview-feed/record-preview-feed.component.d.ts.map +1 -1
  94. package/libs/ui/search/src/lib/results-table/results-table.component.d.ts +3 -2
  95. package/libs/ui/search/src/lib/results-table/results-table.component.d.ts.map +1 -1
  96. package/libs/util/data-fetcher/src/index.d.ts +3 -1
  97. package/libs/util/data-fetcher/src/index.d.ts.map +1 -1
  98. package/libs/util/data-fetcher/src/lib/data-fetcher.d.ts +3 -2
  99. package/libs/util/data-fetcher/src/lib/data-fetcher.d.ts.map +1 -1
  100. package/libs/util/data-fetcher/src/lib/headers.d.ts.map +1 -1
  101. package/libs/util/data-fetcher/src/lib/model.d.ts +2 -2
  102. package/libs/util/data-fetcher/src/lib/model.d.ts.map +1 -1
  103. package/libs/util/data-fetcher/src/lib/readers/wfs.d.ts +21 -0
  104. package/libs/util/data-fetcher/src/lib/readers/wfs.d.ts.map +1 -0
  105. package/libs/util/shared/src/lib/services/date.service.d.ts +13 -0
  106. package/libs/util/shared/src/lib/services/date.service.d.ts.map +1 -0
  107. package/libs/util/shared/src/lib/services/index.d.ts +1 -0
  108. package/libs/util/shared/src/lib/services/index.d.ts.map +1 -1
  109. package/libs/util/shared/src/lib/utils/temporal-extent-union.d.ts +2 -1
  110. package/libs/util/shared/src/lib/utils/temporal-extent-union.d.ts.map +1 -1
  111. package/package.json +1 -1
  112. package/src/libs/api/metadata-converter/src/lib/fixtures/geocat-ch.records.ts +1 -0
  113. package/src/libs/api/metadata-converter/src/lib/iso19139/read-parts.ts +1 -2
  114. package/src/libs/api/metadata-converter/src/lib/iso19139/write-parts.ts +3 -0
  115. package/src/libs/api/repository/src/lib/gn4/elasticsearch/elasticsearch.service.ts +19 -5
  116. package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +1 -5
  117. package/src/libs/common/domain/src/lib/model/record/metadata.model.ts +1 -1
  118. package/src/libs/feature/dataviz/src/lib/geo-table-view/geo-table-view.component.html +3 -3
  119. package/src/libs/feature/dataviz/src/lib/geo-table-view/geo-table-view.component.ts +17 -15
  120. package/src/libs/feature/dataviz/src/lib/service/data.service.ts +4 -14
  121. package/src/libs/feature/dataviz/src/lib/table-view/table-view.component.html +4 -3
  122. package/src/libs/feature/dataviz/src/lib/table-view/table-view.component.ts +9 -18
  123. package/src/libs/feature/editor/src/lib/components/contact-card/contact-card.component.html +1 -1
  124. package/src/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.html +1 -1
  125. package/src/libs/feature/editor/src/lib/components/import-record/import-record.component.html +4 -1
  126. package/src/libs/feature/editor/src/lib/components/import-record/import-record.component.ts +0 -4
  127. package/src/libs/feature/editor/src/lib/components/online-resource-card/online-resource-card.component.ts +2 -2
  128. package/src/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.html +8 -8
  129. package/src/libs/feature/editor/src/lib/components/online-service-resource-input/online-service-resource-input.component.ts +32 -45
  130. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts/form-field-contacts.component.html +1 -1
  131. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-contacts-for-resource/form-field-contacts-for-resource.component.html +3 -1
  132. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.html +1 -1
  133. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.html +0 -1
  134. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.ts +6 -6
  135. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.html +24 -17
  136. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.ts +2 -27
  137. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.html +1 -1
  138. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.ts +2 -1
  139. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.html +1 -1
  140. package/src/libs/feature/editor/src/lib/components/wizard-summarize/wizard-summarize.component.ts +3 -4
  141. package/src/libs/feature/editor/src/lib/fields.config.ts +9 -1
  142. package/src/libs/feature/record/src/lib/data-view/data-view.component.html +2 -1
  143. package/src/libs/feature/record/src/lib/data-view/data-view.component.ts +1 -0
  144. package/src/libs/feature/record/src/lib/data-view-share/data-view-share.component.html +1 -1
  145. package/src/libs/feature/record/src/lib/feature-record.module.ts +6 -4
  146. package/src/libs/feature/record/src/lib/map-view/map-view.component.html +1 -0
  147. package/src/libs/feature/record/src/lib/map-view/map-view.component.ts +1 -0
  148. package/src/libs/ui/dataviz/src/index.ts +2 -2
  149. package/src/libs/ui/dataviz/src/lib/data-table/custom.mat.paginator.intl.ts +52 -0
  150. package/src/libs/ui/dataviz/src/lib/{table/table.component.css → data-table/data-table.component.css} +4 -0
  151. package/src/libs/ui/dataviz/src/lib/data-table/data-table.component.html +67 -0
  152. package/src/libs/ui/dataviz/src/lib/data-table/data-table.component.ts +173 -0
  153. package/src/libs/ui/dataviz/src/lib/data-table/data-table.data.source.ts +33 -0
  154. package/src/libs/ui/dataviz/src/lib/data-table/data-table.fixtures.ts +84 -0
  155. package/src/libs/ui/elements/src/lib/metadata-info/metadata-info.component.html +3 -3
  156. package/src/libs/ui/elements/src/lib/metadata-info/metadata-info.component.ts +12 -2
  157. package/src/libs/ui/search/src/lib/record-preview-feed/record-preview-feed.component.ts +3 -0
  158. package/src/libs/ui/search/src/lib/results-table/results-table.component.html +1 -1
  159. package/src/libs/ui/search/src/lib/results-table/results-table.component.ts +4 -2
  160. package/src/libs/util/data-fetcher/src/index.ts +3 -0
  161. package/src/libs/util/data-fetcher/src/lib/data-fetcher.ts +9 -1
  162. package/src/libs/util/data-fetcher/src/lib/headers.ts +4 -3
  163. package/src/libs/util/data-fetcher/src/lib/model.ts +7 -2
  164. package/src/libs/util/data-fetcher/src/lib/readers/wfs.ts +134 -0
  165. package/src/libs/util/data-fetcher/src/lib/utils.ts +2 -2
  166. package/src/libs/util/shared/src/lib/services/date.service.ts +45 -0
  167. package/src/libs/util/shared/src/lib/services/index.ts +1 -0
  168. package/src/libs/util/shared/src/lib/utils/temporal-extent-union.ts +6 -3
  169. package/translations/de.json +20 -5
  170. package/translations/en.json +29 -14
  171. package/translations/es.json +20 -5
  172. package/translations/fr.json +30 -15
  173. package/translations/it.json +39 -26
  174. package/translations/nl.json +20 -5
  175. package/translations/pt.json +20 -5
  176. package/translations/sk.json +21 -6
  177. package/esm2022/libs/ui/dataviz/src/lib/table/table.component.mjs +0 -61
  178. package/esm2022/libs/ui/dataviz/src/lib/table/table.fixtures.mjs +0 -40
  179. package/libs/ui/dataviz/src/lib/table/table.component.d.ts +0 -29
  180. package/libs/ui/dataviz/src/lib/table/table.component.d.ts.map +0 -1
  181. package/libs/ui/dataviz/src/lib/table/table.fixtures.d.ts +0 -11
  182. package/libs/ui/dataviz/src/lib/table/table.fixtures.d.ts.map +0 -1
  183. package/src/libs/ui/dataviz/src/lib/table/table.component.html +0 -40
  184. package/src/libs/ui/dataviz/src/lib/table/table.component.ts +0 -80
  185. package/src/libs/ui/dataviz/src/lib/table/table.fixtures.ts +0 -40
@@ -0,0 +1,52 @@
1
+ import { Injectable } from '@angular/core'
2
+ import { MatPaginatorIntl } from '@angular/material/paginator'
3
+ import { TranslateService } from '@ngx-translate/core'
4
+ import { Subject } from 'rxjs'
5
+
6
+ @Injectable()
7
+ export class CustomMatPaginatorIntl extends MatPaginatorIntl {
8
+ override changes = new Subject<void>()
9
+
10
+ constructor(private translate: TranslateService) {
11
+ super()
12
+ this.setLabels()
13
+ this.translate.onLangChange.subscribe(() => {
14
+ this.setLabels()
15
+ this.changes.next()
16
+ })
17
+ }
18
+
19
+ setLabels() {
20
+ this.itemsPerPageLabel = this.translate.instant(
21
+ 'table.paginator.itemsPerPage'
22
+ )
23
+ this.nextPageLabel = this.translate.instant('table.paginator.nextPage')
24
+ this.previousPageLabel = this.translate.instant(
25
+ 'table.paginator.previousPage'
26
+ )
27
+ this.firstPageLabel = this.translate.instant('table.paginator.firstPage')
28
+ this.lastPageLabel = this.translate.instant('table.paginator.lastPage')
29
+ this.getRangeLabel = this.getRangeLabelIntl
30
+ this.changes.next()
31
+ }
32
+
33
+ getRangeLabelIntl(page: number, pageSize: number, length: number): string {
34
+ if (length === 0 || pageSize === 0) {
35
+ return this.translate.instant('table.paginator.rangeLabel', {
36
+ startIndex: 0,
37
+ endIndex: 0,
38
+ length,
39
+ })
40
+ }
41
+ const startIndex = page * pageSize
42
+ const endIndex =
43
+ startIndex < length
44
+ ? Math.min(startIndex + pageSize, length)
45
+ : startIndex + pageSize
46
+ return this.translate.instant('table.paginator.rangeLabel', {
47
+ startIndex: startIndex + 1,
48
+ endIndex,
49
+ length,
50
+ })
51
+ }
52
+ }
@@ -30,3 +30,7 @@ tr {
30
30
  .active .mat-mdc-cell {
31
31
  color: var(--color-primary);
32
32
  }
33
+
34
+ .mat-mdc-paginator {
35
+ background: none;
36
+ }
@@ -0,0 +1,67 @@
1
+ <div class="flex flex-col border border-gray-300 rounded-lg bg-white h-full">
2
+ <div class="flex-1 overflow-y-hidden overflow-x-auto rounded-lg relative">
3
+ <table
4
+ mat-table
5
+ [dataSource]="dataSource"
6
+ matSort
7
+ (matSortChange)="setSort($event)"
8
+ [matSortDisableClear]="true"
9
+ *ngrxLet="properties$ as properties"
10
+ >
11
+ <ng-container *ngFor="let prop of properties" [matColumnDef]="prop">
12
+ <th
13
+ mat-header-cell
14
+ *matHeaderCellDef
15
+ mat-sort-header
16
+ class="text-sm text-black bg-white"
17
+ >
18
+ {{ prop }}
19
+ </th>
20
+ <td
21
+ mat-cell
22
+ *matCellDef="let element"
23
+ class="whitespace-nowrap pr-1 truncate"
24
+ >
25
+ {{ element[prop] }}
26
+ </td>
27
+ </ng-container>
28
+
29
+ <tr mat-header-row *matHeaderRowDef="properties; sticky: true"></tr>
30
+ <tr
31
+ [id]="getRowEltId(row.id)"
32
+ mat-row
33
+ *matRowDef="let row; columns: properties"
34
+ (click)="selected.emit(row)"
35
+ [class.active]="row.id === activeId"
36
+ ></tr>
37
+ </table>
38
+ <gn-ui-loading-mask
39
+ *ngIf="loading$ | async"
40
+ class="sticky inset-0"
41
+ [message]="'table.loading.data' | translate"
42
+ ></gn-ui-loading-mask>
43
+ <gn-ui-popup-alert
44
+ *ngIf="error"
45
+ type="warning"
46
+ icon="matErrorOutlineOutline"
47
+ class="absolute m-2 inset-0 z-[100]"
48
+ >
49
+ <span translate>{{ error }}</span>
50
+ </gn-ui-popup-alert>
51
+ </div>
52
+ <div class="flex justify-between items-center overflow-hidden">
53
+ <div class="text-gray-900 px-4 py-2 text-sm">
54
+ <span class="count font-extrabold text-primary">{{ count }}</span
55
+ >&nbsp;<span translate>table.object.count</span>.
56
+ </div>
57
+
58
+ <mat-paginator
59
+ class="my-[-16px]"
60
+ (page)="setPagination()"
61
+ [length]="count"
62
+ [pageSize]="10"
63
+ [showFirstLastButtons]="true"
64
+ [hidePageSize]="true"
65
+ ></mat-paginator>
66
+ </div>
67
+ </div>
@@ -0,0 +1,173 @@
1
+ import { ScrollingModule } from '@angular/cdk/scrolling'
2
+ import {
3
+ AfterViewInit,
4
+ ChangeDetectionStrategy,
5
+ ChangeDetectorRef,
6
+ Component,
7
+ ElementRef,
8
+ EventEmitter,
9
+ Input,
10
+ OnChanges,
11
+ OnInit,
12
+ Output,
13
+ ViewChild,
14
+ } from '@angular/core'
15
+ import { MatSort, MatSortModule } from '@angular/material/sort'
16
+ import { MatTableModule } from '@angular/material/table'
17
+ import { TranslateModule, TranslateService } from '@ngx-translate/core'
18
+ import { DataTableDataSource } from './data-table.data.source'
19
+ import { BaseReader, FetchError } from '../../../../../../libs/util/data-fetcher/src'
20
+ import {
21
+ MatPaginator,
22
+ MatPaginatorIntl,
23
+ MatPaginatorModule,
24
+ } from '@angular/material/paginator'
25
+ import { CustomMatPaginatorIntl } from './custom.mat.paginator.intl'
26
+ import { CommonModule } from '@angular/common'
27
+ import { BehaviorSubject, filter, firstValueFrom } from 'rxjs'
28
+ import {
29
+ LoadingMaskComponent,
30
+ PopupAlertComponent,
31
+ } from '../../../../../../libs/ui/widgets/src'
32
+ import { LetDirective } from '@ngrx/component'
33
+
34
+ const rowIdPrefix = 'table-item-'
35
+
36
+ export type TableItemId = string | number
37
+ type TableItemType = string | number | Date
38
+
39
+ export interface TableItemModel {
40
+ id: TableItemId
41
+ [key: string]: TableItemType
42
+ }
43
+
44
+ @Component({
45
+ standalone: true,
46
+ imports: [
47
+ MatTableModule,
48
+ MatSortModule,
49
+ MatPaginatorModule,
50
+ ScrollingModule,
51
+ TranslateModule,
52
+ CommonModule,
53
+ LoadingMaskComponent,
54
+ PopupAlertComponent,
55
+ LetDirective,
56
+ ],
57
+ providers: [{ provide: MatPaginatorIntl, useClass: CustomMatPaginatorIntl }],
58
+ selector: 'gn-ui-data-table',
59
+ templateUrl: './data-table.component.html',
60
+ styleUrls: ['./data-table.component.css'],
61
+ changeDetection: ChangeDetectionStrategy.OnPush,
62
+ })
63
+ export class DataTableComponent implements OnInit, AfterViewInit, OnChanges {
64
+ @Input() set dataset(value: BaseReader) {
65
+ this.properties$.next(null)
66
+ this.dataset_ = value
67
+ this.dataset_.load()
68
+ this.dataset_.properties.then((properties) =>
69
+ this.properties$.next(properties.map((p) => p.name))
70
+ )
71
+ this.dataset_.info.then((info) => (this.count = info.itemsCount))
72
+ }
73
+ @Input() activeId: TableItemId
74
+ @Output() selected = new EventEmitter<any>()
75
+
76
+ @ViewChild(MatSort) sort: MatSort
77
+ @ViewChild(MatPaginator) paginator: MatPaginator
78
+
79
+ dataset_: BaseReader
80
+ properties$ = new BehaviorSubject<string[]>(null)
81
+ dataSource: DataTableDataSource
82
+ headerHeight: number
83
+ count: number
84
+ loading$ = new BehaviorSubject<boolean>(false)
85
+ error = null
86
+
87
+ constructor(
88
+ private eltRef: ElementRef,
89
+ private cdr: ChangeDetectorRef,
90
+ private translateService: TranslateService
91
+ ) {}
92
+
93
+ ngOnInit() {
94
+ this.dataSource = new DataTableDataSource()
95
+ }
96
+
97
+ ngAfterViewInit() {
98
+ this.headerHeight =
99
+ this.eltRef.nativeElement.querySelector('thead').offsetHeight
100
+ this.setPagination()
101
+ this.cdr.detectChanges()
102
+ }
103
+
104
+ ngOnChanges() {
105
+ this.setPagination()
106
+ }
107
+
108
+ setSort(sort: MatSort) {
109
+ if (!this.dataset_) return
110
+ if (!sort.active) {
111
+ this.dataset_.orderBy()
112
+ } else {
113
+ this.dataset_.orderBy([sort.direction || 'asc', sort.active])
114
+ }
115
+ this.readData()
116
+ }
117
+
118
+ setPagination() {
119
+ if (!this.paginator) return
120
+ if (!this.dataset_) return
121
+ this.dataset_.limit(
122
+ this.paginator.pageIndex * this.paginator.pageSize,
123
+ this.paginator.pageSize
124
+ )
125
+ this.readData()
126
+ }
127
+
128
+ async readData() {
129
+ this.loading$.next(true)
130
+ // wait for properties to be read
131
+ const properties = await firstValueFrom(
132
+ this.properties$.pipe(filter((p) => !!p))
133
+ )
134
+ const propsWithoutGeom = properties.filter(
135
+ (p) => !p.toLowerCase().startsWith('geom')
136
+ )
137
+ this.dataset_.select(...propsWithoutGeom)
138
+ try {
139
+ await this.dataSource.showData(this.dataset_.read())
140
+ this.error = null
141
+ } catch (error) {
142
+ this.handleError(error as FetchError | Error)
143
+ }
144
+ this.loading$.next(false)
145
+ }
146
+
147
+ scrollToItem(itemId: TableItemId): void {
148
+ const row = this.eltRef.nativeElement.querySelector(
149
+ `#${this.getRowEltId(itemId)}`
150
+ )
151
+ this.eltRef.nativeElement.scrollTop = row.offsetTop - this.headerHeight
152
+ }
153
+
154
+ public getRowEltId(id: TableItemId): string {
155
+ return rowIdPrefix + id
156
+ }
157
+
158
+ handleError(error: FetchError | Error) {
159
+ this.dataSource.clearData()
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 {
169
+ this.error = this.translateService.instant(error.message)
170
+ console.warn(error.stack || error)
171
+ }
172
+ }
173
+ }
@@ -0,0 +1,33 @@
1
+ import { DataSource } from '@angular/cdk/collections'
2
+ import { BehaviorSubject, Observable } from 'rxjs'
3
+ import { DataItem } from '../../../../../../libs/util/data-fetcher/src'
4
+ import { map } from 'rxjs/operators'
5
+ import { TableItemModel } from './data-table.component'
6
+
7
+ export class DataTableDataSource implements DataSource<TableItemModel> {
8
+ private dataItems$ = new BehaviorSubject<DataItem[]>([])
9
+
10
+ connect(): Observable<TableItemModel[]> {
11
+ return this.dataItems$.asObservable().pipe(
12
+ map((items) =>
13
+ items.map((item) => ({
14
+ id: item.id,
15
+ ...item.properties,
16
+ }))
17
+ )
18
+ )
19
+ }
20
+
21
+ disconnect(): void {
22
+ this.dataItems$.complete()
23
+ }
24
+
25
+ async showData(itemsPromise: Promise<DataItem[]>) {
26
+ const items = await itemsPromise
27
+ this.dataItems$.next(items)
28
+ }
29
+
30
+ clearData() {
31
+ this.dataItems$.next([])
32
+ }
33
+ }
@@ -0,0 +1,84 @@
1
+ import { DataItem, PropertyInfo } from '../../../../../../libs/util/data-fetcher/src'
2
+
3
+ export const tableItemsFixture = {
4
+ items: [
5
+ {
6
+ type: 'Feature',
7
+ geometry: null,
8
+ properties: {
9
+ id: '0001',
10
+ firstName: 'John',
11
+ lastName: 'Lennon',
12
+ },
13
+ },
14
+ {
15
+ type: 'Feature',
16
+ geometry: null,
17
+ properties: {
18
+ id: '0002',
19
+ firstName: 'Ozzy',
20
+ lastName: 'Osbourne',
21
+ },
22
+ },
23
+ {
24
+ type: 'Feature',
25
+ geometry: null,
26
+ properties: {
27
+ id: '0003',
28
+ firstName: 'Claude',
29
+ lastName: 'François',
30
+ },
31
+ },
32
+ ] as DataItem[],
33
+ properties: [
34
+ { name: 'id', label: 'id', type: 'string' },
35
+ { name: 'firstName', label: 'Firstname', type: 'string' },
36
+ { name: 'lastName', label: 'Lastname', type: 'string' },
37
+ ] as PropertyInfo[],
38
+ }
39
+
40
+ export const someHabTableItemFixture = {
41
+ items: [
42
+ {
43
+ type: 'Feature',
44
+ geometry: null,
45
+ properties: {
46
+ id: '1',
47
+ name: 'France',
48
+ pop: 50500000,
49
+ },
50
+ },
51
+ {
52
+ type: 'Feature',
53
+ geometry: null,
54
+ properties: {
55
+ id: '2',
56
+ name: 'Italy',
57
+ pop: 155878789655,
58
+ },
59
+ },
60
+ {
61
+ type: 'Feature',
62
+ geometry: null,
63
+ properties: {
64
+ id: '3',
65
+ name: 'UK',
66
+ pop: 31522456,
67
+ },
68
+ },
69
+ {
70
+ type: 'Feature',
71
+ geometry: null,
72
+ properties: {
73
+ id: '4',
74
+ name: 'US',
75
+ pop: 3215448888,
76
+ },
77
+ },
78
+ ] as DataItem[],
79
+ properties: [
80
+ { name: 'id', label: 'ID', type: 'string' },
81
+ { name: 'name', label: 'Name', type: 'string' },
82
+ { name: 'pop', label: 'Population', type: 'number' },
83
+ ] as PropertyInfo[],
84
+ }
@@ -163,13 +163,13 @@
163
163
  <div *ngIf="metadata.resourceCreated">
164
164
  <p class="text-sm" translate>record.metadata.creation</p>
165
165
  <p class="text-primary font-medium mt-1">
166
- {{ metadata.resourceCreated.toLocaleDateString() }}
166
+ {{ formatDate(metadata.resourceCreated) }}
167
167
  </p>
168
168
  </div>
169
169
  <div *ngIf="metadata.resourcePublished">
170
170
  <p class="text-sm" translate>record.metadata.publication</p>
171
171
  <p class="text-primary font-medium mt-1">
172
- {{ metadata.resourcePublished.toLocaleDateString() }}
172
+ {{ formatDate(metadata.resourcePublished) }}
173
173
  </p>
174
174
  </div>
175
175
  <div *ngIf="updateFrequency">
@@ -233,7 +233,7 @@
233
233
  <div *ngIf="metadata.recordUpdated">
234
234
  <p class="text-sm" translate>record.metadata.updatedOn</p>
235
235
  <p class="text-primary font-medium">
236
- {{ metadata.recordUpdated && metadata.recordUpdated.toLocaleString() }}
236
+ {{ metadata.recordUpdated && formatDateTime(metadata.recordUpdated) }}
237
237
  </p>
238
238
  </div>
239
239
  <div *ngIf="metadata.landingPage">
@@ -9,7 +9,7 @@ import {
9
9
  DatasetRecord,
10
10
  Keyword,
11
11
  } from '../../../../../../libs/common/domain/src/lib/model/record'
12
- import { getTemporalRangeUnion } from '../../../../../../libs/util/shared/src'
12
+ import { DateService, getTemporalRangeUnion } from '../../../../../../libs/util/shared/src'
13
13
  import { MarkdownParserComponent } from '../markdown-parser/markdown-parser.component'
14
14
  import {
15
15
  ExpandablePanelComponent,
@@ -60,6 +60,8 @@ export class MetadataInfoComponent {
60
60
  @Output() keyword = new EventEmitter<Keyword>()
61
61
  updatedTimes: number
62
62
 
63
+ constructor(private dateService: DateService) {}
64
+
63
65
  get hasUsage() {
64
66
  return (
65
67
  this.metadata.extras?.isOpenData === true ||
@@ -121,7 +123,7 @@ export class MetadataInfoComponent {
121
123
 
122
124
  get temporalExtent(): { start: string; end: string } {
123
125
  const temporalExtents = this.metadata.temporalExtents
124
- return getTemporalRangeUnion(temporalExtents)
126
+ return getTemporalRangeUnion(temporalExtents, this.dateService)
125
127
  }
126
128
 
127
129
  get shownOrganization() {
@@ -139,4 +141,12 @@ export class MetadataInfoComponent {
139
141
  onKeywordClick(keyword: Keyword) {
140
142
  this.keyword.emit(keyword)
141
143
  }
144
+
145
+ formatDate(date: Date): string {
146
+ return this.dateService.formatDate(date)
147
+ }
148
+
149
+ formatDateTime(date: Date): string {
150
+ return this.dateService.formatDateTime(date)
151
+ }
142
152
  }
@@ -2,6 +2,9 @@ import { ChangeDetectionStrategy, Component, ElementRef } from '@angular/core'
2
2
  import { RecordPreviewComponent } from '../record-preview/record-preview.component'
3
3
  import { TranslateService } from '@ngx-translate/core'
4
4
  import Duration from 'duration-relativetimeformat'
5
+ import { marker } from '@biesbjerg/ngx-translate-extract-marker'
6
+
7
+ marker('record.was.created.time')
5
8
 
6
9
  @Component({
7
10
  selector: 'gn-ui-record-preview-feed',
@@ -85,7 +85,7 @@
85
85
 
86
86
  <!-- OWNER COLUMN -->
87
87
  <gn-ui-interactive-table-column
88
- [width]="'9rem'"
88
+ [width]="'12rem'"
89
89
  [sortable]="true"
90
90
  [activeSort]="isSortedBy('recordOwner')"
91
91
  (sortChange)="setSortBy('recordOwner', $event)"
@@ -21,6 +21,7 @@ import {
21
21
  InteractiveTableComponent,
22
22
  } from '../../../../../../libs/ui/layout/src'
23
23
  import {
24
+ DateService,
24
25
  FileFormat,
25
26
  formatUserInfo,
26
27
  getBadgeColor,
@@ -86,7 +87,8 @@ export class ResultsTableComponent {
86
87
  constructor(
87
88
  private overlay: Overlay,
88
89
  private viewContainerRef: ViewContainerRef,
89
- private cdr: ChangeDetectorRef
90
+ private cdr: ChangeDetectorRef,
91
+ private dateService: DateService
90
92
  ) {}
91
93
 
92
94
  openActionMenu(item, template) {
@@ -139,7 +141,7 @@ export class ResultsTableComponent {
139
141
  }
140
142
 
141
143
  dateToString(date: Date): string {
142
- return date?.toLocaleDateString(undefined, {
144
+ return this.dateService.formatDate(date, {
143
145
  year: 'numeric',
144
146
  month: 'long',
145
147
  day: 'numeric',
@@ -5,6 +5,9 @@ export {
5
5
  DataItem,
6
6
  FetchError,
7
7
  FieldAggregation,
8
+ PropertyInfo,
8
9
  } from './lib/model'
9
10
  export { getJsonDataItemsProxy } from './lib/utils'
10
11
  export { BaseReader } from './lib/readers/base'
12
+ export { BaseFileReader } from './lib/readers/base-file'
13
+ export { GeojsonReader } from './lib/readers/geojson'
@@ -8,11 +8,16 @@ import { inferDatasetType } from './utils'
8
8
  import { BaseReader } from './readers/base'
9
9
  import { GmlReader } from './readers/gml'
10
10
  import { WfsVersion } from '@camptocamp/ogc-client'
11
+ import { WfsReader } from './readers/wfs'
11
12
 
12
13
  export async function openDataset(
13
14
  url: string,
14
15
  typeHint?: SupportedType,
15
- options?: { namespace: string; wfsVersion: WfsVersion }
16
+ options?: {
17
+ namespace?: string
18
+ wfsVersion?: WfsVersion
19
+ wfsFeatureType?: string
20
+ }
16
21
  ): Promise<BaseReader> {
17
22
  const fileType = await inferDatasetType(url, typeHint)
18
23
  let reader: BaseReader
@@ -33,6 +38,9 @@ export async function openDataset(
33
38
  case 'gml':
34
39
  reader = new GmlReader(url, options.namespace, options.wfsVersion)
35
40
  break
41
+ case 'wfs':
42
+ reader = await WfsReader.createReader(url, options.wfsFeatureType)
43
+ break
36
44
  }
37
45
  reader.load()
38
46
  return reader
@@ -5,9 +5,10 @@ export function parseHeaders(httpHeaders: Headers): DatasetHeaders {
5
5
  if (httpHeaders.has('Content-Type')) {
6
6
  result.mimeType = httpHeaders.get('Content-Type').split(';')[0]
7
7
  const supported =
8
- SupportedTypes.filter(
9
- (type) => AllMimeTypes[type].indexOf(result.mimeType as never) > -1
10
- )[0] || null
8
+ SupportedTypes.filter((type) => type !== 'wfs') // Ignore wfs type as it is not a file type
9
+ .filter(
10
+ (type) => AllMimeTypes[type].indexOf(result.mimeType as never) > -1
11
+ )[0] || null
11
12
  if (supported !== null) result.supportedType = supported
12
13
  }
13
14
  if (httpHeaders.has('Content-Length')) {
@@ -13,8 +13,12 @@ export class FetchError {
13
13
  ) {
14
14
  this.message = `An error happened in the data fetcher, type: ${type}, info: ${info}`
15
15
  }
16
- static http(code: number) {
17
- return new FetchError('http', '', code)
16
+ static http(code: number, body?: string) {
17
+ const info = body
18
+ ? `Error ${code}
19
+ ${body}`
20
+ : `${code}`
21
+ return new FetchError('http', info, code)
18
22
  }
19
23
  static corsOrNetwork(message: string) {
20
24
  return new FetchError('network', message, 0)
@@ -60,6 +64,7 @@ export const SupportedTypes = [
60
64
  'geojson',
61
65
  'excel',
62
66
  'gml',
67
+ 'wfs',
63
68
  ] as const
64
69
  export type SupportedType = (typeof SupportedTypes)[number]
65
70