@geogirafe/lib-geoportal 1.3.0-dev.3046054236 → 1.3.0-dev.3060317043

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 (111) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +3 -2
  3. package/api/apigeogirafeapp.js +3 -1
  4. package/assets/i18n/de.json +34 -3
  5. package/assets/i18n/en.json +33 -2
  6. package/assets/i18n/fr.json +35 -4
  7. package/assets/i18n/it.json +37 -6
  8. package/assets/icons/edit.svg +1 -1
  9. package/assets/icons/lock.svg +1 -0
  10. package/assets/icons/streetview-marker-mapillary.svg +1 -0
  11. package/components/cross-section/cross-section-settings/component.js +1 -1
  12. package/components/edit/component.d.ts +52 -36
  13. package/components/edit/component.js +340 -292
  14. package/components/edit/editcomponentstate.d.ts +1 -0
  15. package/components/edit/editcomponentstate.js +1 -0
  16. package/components/edit/editform/component.d.ts +34 -4
  17. package/components/edit/editform/component.js +224 -37
  18. package/components/edit/editform/style.css +51 -16
  19. package/components/edit/geometryedithelper.d.ts +47 -0
  20. package/components/edit/geometryedithelper.js +324 -0
  21. package/components/edit/style.css +71 -28
  22. package/components/layout/component.d.ts +5 -0
  23. package/components/main.d.ts +1 -1
  24. package/components/main.js +1 -1
  25. package/components/map-grid/component.d.ts +4 -0
  26. package/components/map-grid/component.js +6 -0
  27. package/components/print/component.d.ts +1 -1
  28. package/components/streetview/component.d.ts +9 -2
  29. package/components/streetview/component.js +20 -8
  30. package/components/streetview/google.js +1 -1
  31. package/components/streetview/mapillary.d.ts +8 -0
  32. package/components/streetview/mapillary.js +20 -0
  33. package/components/streetview/style.css +16 -0
  34. package/components/streetview/tools/googleprovider.js +9 -2
  35. package/components/streetview/tools/mapillaryprovider.d.ts +70 -0
  36. package/components/streetview/tools/mapillaryprovider.js +150 -0
  37. package/components/treeview/tools/treeviewelement.d.ts +1 -0
  38. package/components/treeview/tools/treeviewelement.js +22 -0
  39. package/components/treeview/treeviewitem/component.js +7 -1
  40. package/models/gmf.d.ts +18 -2
  41. package/models/gmf.js +3 -1
  42. package/models/layers/editablelayer.d.ts +7 -0
  43. package/models/layers/editablelayer.js +7 -0
  44. package/models/layers/layerwms.d.ts +1 -2
  45. package/models/layers/layerwms.js +4 -8
  46. package/models/main.d.ts +9 -4
  47. package/models/main.js +6 -2
  48. package/models/oapiflayer.d.ts +25 -0
  49. package/models/oapiflayer.js +36 -0
  50. package/models/oapiftypes.d.ts +71 -0
  51. package/models/oapiftypes.js +29 -0
  52. package/models/serverogc.d.ts +5 -3
  53. package/models/serverogc.js +19 -6
  54. package/models/serverogcapi.d.ts +2 -0
  55. package/models/serverogcapi.js +2 -0
  56. package/models/serverogcapifeatures.d.ts +5 -62
  57. package/models/serverogcapifeatures.js +8 -4
  58. package/package.json +1 -1
  59. package/templates/iframe.html +1 -0
  60. package/templates/index.html +2 -0
  61. package/templates/mobile.html +1 -0
  62. package/templates/public/about.json +1 -1
  63. package/tools/app/geogirafeapp-mobile.js +2 -0
  64. package/tools/app/geogirafeapp.js +4 -2
  65. package/tools/configuration/girafeconfig.js +1 -8
  66. package/tools/configuration/streetviewconfig.d.ts +12 -1
  67. package/tools/configuration/streetviewconfig.js +26 -4
  68. package/tools/drawing/olDrawing.js +2 -22
  69. package/tools/drawing/shapeConstraints.d.ts +2 -1
  70. package/tools/drawing/shapeConstraints.js +18 -2
  71. package/tools/main.d.ts +9 -7
  72. package/tools/main.js +8 -6
  73. package/tools/ogcapi/ogcapiclient.d.ts +7 -3
  74. package/tools/ogcapi/ogcapiclient.js +49 -4
  75. package/tools/ogcapi/ogcapiconformance.d.ts +2 -2
  76. package/tools/ogcapi/ogcapiconformance.js +7 -13
  77. package/tools/ogcapi/ogcapifeaturesclient.d.ts +65 -30
  78. package/tools/ogcapi/ogcapifeaturesclient.js +265 -139
  79. package/tools/ogcapi/ogcapifeaturesclientgeorama.d.ts +0 -5
  80. package/tools/ogcapi/ogcapifeaturesclientgeorama.js +0 -11
  81. package/tools/ogcapi/ogcapifeaturesclientqgis.d.ts +8 -0
  82. package/tools/ogcapi/ogcapifeaturesclientqgis.js +13 -0
  83. package/tools/ogcapi/ogcapifeaturesmanager.d.ts +61 -8
  84. package/tools/ogcapi/ogcapifeaturesmanager.js +179 -30
  85. package/tools/ogcapi/ogcapifeaturesschema.d.ts +31 -13
  86. package/tools/ogcapi/ogcapifeaturesschema.js +69 -39
  87. package/tools/ogcapi/ogcapifeaturesschemaproperty.d.ts +44 -0
  88. package/tools/ogcapi/ogcapifeaturesschemaproperty.js +137 -0
  89. package/tools/ogcapi/ogcapifeaturesschemavalidator.d.ts +22 -0
  90. package/tools/ogcapi/ogcapifeaturesschemavalidator.js +121 -0
  91. package/tools/state/layout.d.ts +5 -0
  92. package/tools/state/layout.js +2 -1
  93. package/tools/state/state.d.ts +6 -0
  94. package/tools/state/state.js +4 -0
  95. package/tools/state/streetview.d.ts +1 -1
  96. package/tools/state/streetview.js +1 -1
  97. package/tools/themes/themesmanager.d.ts +10 -3
  98. package/tools/themes/themesmanager.js +29 -9
  99. package/tools/time/layertimeformatter.d.ts +0 -5
  100. package/tools/time/layertimeformatter.js +10 -19
  101. package/tools/utils/dateutils.d.ts +40 -0
  102. package/tools/utils/dateutils.js +111 -0
  103. package/tools/utils/utils.d.ts +4 -0
  104. package/tools/utils/utils.js +12 -0
  105. package/tools/wfs/wfsmanager.js +3 -0
  106. package/tools/wms/wmsclient.d.ts +1 -0
  107. package/tools/wms/wmsclient.js +4 -0
  108. package/tools/ogcapi/demolayers.d.ts +0 -1
  109. package/tools/ogcapi/demolayers.js +0 -99
  110. package/tools/ogcapi/ogcapifeaturesclientgmf.d.ts +0 -13
  111. package/tools/ogcapi/ogcapifeaturesclientgmf.js +0 -30
@@ -0,0 +1,111 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ const TIMEZONE_REGEX = /(Z|[+-]\d{2}(?::?\d{2})?)$/i;
3
+ export default class DateUtils {
4
+ /**
5
+ * Validates if a string represents a valid date or datetime.
6
+ * The string can be formatted as an ISO / SQL timestamp or as a date string 'YYYY-MM-DD'.
7
+ */
8
+ static normalizeDateTimeString(dateString) {
9
+ if (!dateString || typeof dateString !== 'string' || dateString.trim() === '') {
10
+ return null;
11
+ }
12
+ const cleanedValue = dateString.trim().replace(' ', 'T');
13
+ return Number.isNaN(Date.parse(cleanedValue)) ? null : cleanedValue;
14
+ }
15
+ /**
16
+ * Formats a given Date instance into a 'YYYY-MM-DD' date string.
17
+ */
18
+ static formatAsDate(date) {
19
+ return date.toISOString().split('T')[0];
20
+ }
21
+ /**
22
+ * Converts an ISO / SQL timestamp, or a date string into a 'YYYY-MM-DD' date string.
23
+ */
24
+ static dateTimeStringToDate(dateString) {
25
+ const cleanValue = this.normalizeDateTimeString(dateString);
26
+ return cleanValue ? cleanValue.split('T')[0] : null;
27
+ }
28
+ /**
29
+ * Check if a string is a timestamp with timezone information, e.g. `2026-10-29T15:30:00+02:00` or `2026-10-29T15:30:00Z`.
30
+ */
31
+ static isTimeZoneAware(dateString) {
32
+ const cleanedValue = this.normalizeDateTimeString(dateString);
33
+ return cleanedValue ? !!this.extractTimezone(cleanedValue) : false;
34
+ }
35
+ /**
36
+ * Extract the timezone information from a timestamp.
37
+ */
38
+ static extractTimezone(normalizedDateString) {
39
+ const timePart = normalizedDateString.split('T')[1] ?? null;
40
+ if (timePart) {
41
+ // Only analyse the second part of the timestamp
42
+ const match = timePart.match(TIMEZONE_REGEX);
43
+ return match?.length ? match[0] : null;
44
+ }
45
+ return null;
46
+ }
47
+ /**
48
+ * Converts an ISO or SQL timestamp string into a local date time value compatible with HTML datetime-local inputs.
49
+ * Strips trailing timezone indicators (e.g. 'Z', '+02:00').
50
+ */
51
+ static fromApiToLocalDateTime(dateString, precision) {
52
+ const cleanValue = this.normalizeDateTimeString(dateString);
53
+ if (!cleanValue) {
54
+ return null;
55
+ }
56
+ if (this.isTimeZoneAware(cleanValue)) {
57
+ const date = new Date(cleanValue);
58
+ // Adjust time by local timezone offset (offset is in minutes; negative for timezones ahead of UTC)
59
+ const localTime = new Date(date.getTime() - date.getTimezoneOffset() * 60_000);
60
+ // Build a timestamp based on requested precision
61
+ return this.formatLocalTimestampString(localTime.toISOString(), precision);
62
+ }
63
+ // DateTime without time zone information - use as-is but format to fit precision demand
64
+ return this.formatLocalTimestampString(cleanValue, precision);
65
+ }
66
+ /**
67
+ * Converts a datetime-local input value into an API-ready ISO timestamp string.
68
+ * Checks the timezone format of the previous value to decide if a conversion to UTC time is necessary.
69
+ * For new values (no previous value), defaults to UTC time with timezone indicator 'Z'.
70
+ */
71
+ static fromLocalToApiDateTime(localDateString, previousValue) {
72
+ const cleanValue = this.normalizeDateTimeString(localDateString);
73
+ if (!cleanValue) {
74
+ return null;
75
+ }
76
+ const cleanPreviousValue = this.normalizeDateTimeString(previousValue);
77
+ if (!previousValue || this.isTimeZoneAware(cleanPreviousValue)) {
78
+ // Return a UTC timestamp
79
+ return new Date(cleanValue).toISOString();
80
+ }
81
+ // Return a naive datetime without timezone
82
+ return cleanValue;
83
+ }
84
+ /**
85
+ * Removes the timezone information from the ISO timestamp string and optionally forces a precision.
86
+ */
87
+ static formatLocalTimestampString(isoTimestamp, precision) {
88
+ const timezone = this.extractTimezone(isoTimestamp) ?? '';
89
+ const timestampWithoutTimezone = isoTimestamp.replace(timezone, '');
90
+ const [datePart, timePart] = timestampWithoutTimezone.split('T');
91
+ if (!precision || !timePart) {
92
+ return timestampWithoutTimezone;
93
+ }
94
+ const timeParts = timePart.split(/[:.]/);
95
+ const hours = (timeParts[0] ?? '00').padStart(2, '0');
96
+ const minutes = (timeParts[1] ?? '00').padStart(2, '0');
97
+ const seconds = (timeParts[2] ?? '00').padStart(2, '0');
98
+ const rawMillis = timeParts[3] ?? '000';
99
+ const milliseconds = rawMillis.padEnd(3, '0').slice(0, 3);
100
+ switch (precision) {
101
+ case 'minutes':
102
+ return `${datePart}T${hours}:${minutes}`;
103
+ case 'seconds':
104
+ return `${datePart}T${hours}:${minutes}:${seconds}`;
105
+ case 'milliseconds':
106
+ return `${datePart}T${hours}:${minutes}:${seconds}.${milliseconds}`;
107
+ default:
108
+ return timestampWithoutTimezone;
109
+ }
110
+ }
111
+ }
@@ -50,6 +50,10 @@ export declare const rgbStrToRgbaArray: (rgbaStr: string) => [number, number, nu
50
50
  * @returns an array of rgba values: R, G, B [0-255] and alpha [0-1]. Or null if the color isn't in a valid format.
51
51
  */
52
52
  export declare const colorToRgbaArray: (color: string) => [number, number, number, number] | null;
53
+ /**
54
+ * Transform an array of rgb(a) values to a rgb(a) string.
55
+ */
56
+ export declare const rgbaArrayToString: (color: number[]) => string | null;
53
57
  /**
54
58
  * Check whether the provided text is a matching the correct email form
55
59
  */
@@ -114,6 +114,18 @@ export const colorToRgbaArray = (color) => {
114
114
  rgbaColor ??= rgbStrToRgbaArray(color);
115
115
  return rgbaColor;
116
116
  };
117
+ /**
118
+ * Transform an array of rgb(a) values to a rgb(a) string.
119
+ */
120
+ export const rgbaArrayToString = (color) => {
121
+ if (color.length === 4) {
122
+ return `rgba(${color.join(',')})`;
123
+ }
124
+ if (color.length === 3) {
125
+ return `rgb(${color.join(',')})`;
126
+ }
127
+ return null;
128
+ };
117
129
  /**
118
130
  * Check whether the provided text is a matching the correct email form
119
131
  */
@@ -112,6 +112,9 @@ export default class WfsManager extends VendorSpecificOgcServerManager {
112
112
  */
113
113
  async commonAttributesByLayer(layer, includeGeometryColumn = false) {
114
114
  const serverWfs = await this.getServerWfs(layer);
115
+ if (!layer.queryLayers) {
116
+ return [];
117
+ }
115
118
  const queryLayers = layer.queryLayers.split(',');
116
119
  const attributesByQueryLayer = [];
117
120
  for (const queryLayer of queryLayers) {
@@ -82,6 +82,7 @@ export default abstract class WmsClient {
82
82
  * This is expected to be immediate.
83
83
  */
84
84
  prepareSwipe(layerWms: LayerWms): void;
85
+ refreshLayer(layerWms: LayerWms): void;
85
86
  /**
86
87
  * Refresh the Z-Index of every layer on the map.
87
88
  */
@@ -107,6 +107,10 @@ export default class WmsClient {
107
107
  prepareSwipe(layerWms) {
108
108
  this.updateLayerDirect([layerWms]);
109
109
  }
110
+ refreshLayer(layerWms) {
111
+ const olLayer = this.getOLayer(layerWms);
112
+ olLayer?.getSource()?.refresh();
113
+ }
110
114
  /**
111
115
  * Refresh the Z-Index of every layer on the map.
112
116
  */
@@ -1 +0,0 @@
1
- export declare const DEMO_LAYERS: Record<string, any>;
@@ -1,99 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- // POC demo variables
3
- import ServerOgc from '../../models/serverogc.js';
4
- const SITN_SERVER = new ServerOgc('gmf', {
5
- url: 'https://sitn.ne.ch/mapserv_proxy/qgisserver/ogcapi',
6
- wfsSupport: false,
7
- urlWfs: '',
8
- oapifSupport: true,
9
- urlOapif: 'https://sitn.ne.ch/mapserv_proxy/qgisserver/ogcapi',
10
- // @ts-expect-error Defining a new type of server here to be able to catch some miss-configuration
11
- // of the GMF demo server, see ogcapifeaturesclientgmf.ts
12
- type: 'gmf',
13
- imageType: ''
14
- });
15
- export const DEMO_LAYERS = {
16
- GEORAMA: {
17
- url: 'https://demo.georama.io/features/api',
18
- displayName: 'Georama Rivers',
19
- // To allow for changing collectionIds (uuids) while developing georama,
20
- // we use an interim solution and identify the collection by title.
21
- collectionId: null,
22
- collectionTitle: 'Flüsse',
23
- geometryType: 'MultiLineString',
24
- serverType: 'georama',
25
- server: new ServerOgc('GEORAMA', {
26
- url: 'https://demo.georama.io/features/api',
27
- wfsSupport: false,
28
- urlWfs: '',
29
- oapifSupport: true,
30
- urlOapif: 'https://demo.georama.io/features/api',
31
- type: 'georama',
32
- imageType: ''
33
- })
34
- },
35
- GMF: {
36
- url: 'https://geomapfish-demo-2-9.camptocamp.com/mapserv_proxy/QGIS_Server/wfs3',
37
- displayName: 'GeoMapFish Points',
38
- collectionId: 'points',
39
- collectionTitle: null,
40
- geometryType: 'Point',
41
- serverType: 'gmf',
42
- server: new ServerOgc('gmf', {
43
- url: 'https://geomapfish-demo-2-9.camptocamp.com/mapserv_proxy/QGIS_Server/wfs3',
44
- wfsSupport: false,
45
- urlWfs: '',
46
- oapifSupport: true,
47
- urlOapif: 'https://geomapfish-demo-2-9.camptocamp.com/mapserv_proxy/QGIS_Server/wfs3',
48
- // @ts-expect-error Defining a new type of server here to be able to catch some miss-configuration
49
- // of the GMF demo server, see ogcapifeaturesclientgmf.ts
50
- type: 'gmf',
51
- imageType: ''
52
- })
53
- },
54
- SITN_Point: {
55
- url: 'https://sitn.ne.ch/mapserv_proxy/qgisserver/ogcapi',
56
- displayName: 'SITN point',
57
- collectionId: 'demo01_edit_point',
58
- collectionTitle: null,
59
- geometryType: 'Point',
60
- serverType: 'gmf',
61
- server: SITN_SERVER
62
- },
63
- SITN_LineString: {
64
- url: 'https://sitn.ne.ch/mapserv_proxy/qgisserver/ogcapi',
65
- displayName: 'SITN line',
66
- collectionId: 'demo02_edit_line',
67
- collectionTitle: null,
68
- geometryType: 'LineString',
69
- serverType: 'gmf',
70
- server: SITN_SERVER
71
- },
72
- SITN_Polygon: {
73
- url: 'https://sitn.ne.ch/mapserv_proxy/qgisserver/ogcapi',
74
- displayName: 'SITN polygon',
75
- collectionId: 'demo03_edit_polygon',
76
- collectionTitle: null,
77
- geometryType: 'Polygon',
78
- serverType: 'gmf',
79
- server: SITN_SERVER
80
- },
81
- SITN_MultiLineString: {
82
- url: 'https://sitn.ne.ch/mapserv_proxy/qgisserver/ogcapi',
83
- displayName: 'SITN multiline',
84
- collectionId: 'demo04_edit_multiline',
85
- collectionTitle: null,
86
- geometryType: 'MultiLineString',
87
- serverType: 'gmf',
88
- server: SITN_SERVER
89
- },
90
- SITN_MultiPolygon: {
91
- url: 'https://sitn.ne.ch/mapserv_proxy/qgisserver/ogcapi',
92
- displayName: 'SITN multipolygon',
93
- collectionId: 'demo05_edit_multipolygon',
94
- collectionTitle: null,
95
- geometryType: 'MultiPolygon',
96
- serverType: 'gmf',
97
- server: SITN_SERVER
98
- }
99
- };
@@ -1,13 +0,0 @@
1
- import OgcApiFeaturesClient from './ogcapifeaturesclient.js';
2
- import ServerOgc from '../../models/serverogc.js';
3
- import { OapifSchemaResponse } from '../../models/serverogcapifeatures.js';
4
- import IGirafeContext from '../context/icontext.js';
5
- import { OgcApiClientOptions } from './ogcapiclient.js';
6
- export default class OgcApiFeaturesClientGmf extends OgcApiFeaturesClient {
7
- constructor(serverConfig: ServerOgc, opt: OgcApiClientOptions, context: IGirafeContext);
8
- /**
9
- * POC overwrite: The demo server does not support schema requests. We therefore create a very simple schema based on
10
- * the first item of the collection.
11
- */
12
- getSchema(collectionId: string): Promise<OapifSchemaResponse>;
13
- }
@@ -1,30 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- import OgcApiFeaturesClient from './ogcapifeaturesclient.js';
3
- export default class OgcApiFeaturesClientGmf extends OgcApiFeaturesClient {
4
- constructor(serverConfig, opt, context) {
5
- super(serverConfig, opt, context);
6
- }
7
- /**
8
- * POC overwrite: The demo server does not support schema requests. We therefore create a very simple schema based on
9
- * the first item of the collection.
10
- */
11
- async getSchema(collectionId) {
12
- const items = await this.getItems(collectionId, undefined, undefined, 1);
13
- const item = items[0];
14
- const properties = Object.fromEntries(Object.entries(item.getProperties()).map(([key, value]) => [key, { type: typeof value }]));
15
- // Add geometry information
16
- properties['geometry'] = {
17
- 'format': `geometry-${item.getGeometry().getType().toLowerCase()}`,
18
- 'x-ogc-role': 'primary-geometry'
19
- };
20
- // mark fid or id as primary key
21
- ['fid', 'id'].forEach((key) => {
22
- if (properties[key]) {
23
- properties[key]['x-ogc-role'] = 'id';
24
- }
25
- });
26
- return {
27
- properties: properties
28
- };
29
- }
30
- }