@masterportal/masterportalapi 2.48.0 → 2.49.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,39 @@
3
3
 
4
4
  The [Semantic Versioning](https://semver.org/spec/v2.0.0.html) is used.
5
5
 
6
+ ## Unreleased - in development
7
+
8
+ ### __Breaking Changes__
9
+
10
+ ### Added
11
+
12
+ ### Changed
13
+
14
+ ### Deprecated
15
+
16
+ ### Removed
17
+
18
+ ### Fixed
19
+
20
+ ---
21
+
22
+ ## 2.49.0 - 2025-04-294
23
+
24
+ ### Added
25
+ - Add new parameters polygonStrokeDash, polygonStrokeDashOffset in styleObject of drawInteraction.
26
+
27
+ ### Changed
28
+ - The following packages have been updated:
29
+ - dependencies:
30
+ - ol-mapbox-style: 12.4.0 to 12.5.0
31
+
32
+ ### Fixed
33
+ - wms: Fix passing layerParams from layerBuilder.
34
+ - wms-time: layers that are updated daily don't run into errors due to late promise-resolving anymore.
35
+ - Issue #1386: handle label creation if values are empty.
36
+
37
+ ---
38
+
6
39
  ## 2.48.0 - 2025-04-01
7
40
 
8
41
  ### Fixed
package/babel.config.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "presets": [],
2
+ "presets": [],
3
3
  "plugins": [
4
4
  "@babel/plugin-transform-modules-commonjs"
5
5
  ]
package/jest.config.js CHANGED
@@ -6,7 +6,7 @@ module.exports = {
6
6
  /** ol prints errors without HTMLCanvasElement being available in test environment */
7
7
  "setupFiles": ["jest-canvas-mock"],
8
8
  /** node_modules are usually ignored by babel-jest, but ol is published in ES6 */
9
- "transformIgnorePatterns": ["/node_modules/(?!(ol|olcs|ol-mapbox-style|geotiff|quick-lru|color-space|color-rgba|color-parse|color-name|rbush|quickselect|earcut|pbf)/).*/"],
9
+ "transformIgnorePatterns": ["/node_modules/(?!(ol|olcs|ol-mapbox-style|mapbox-to-css-font|geotiff|quick-lru|color-space|color-rgba|color-parse|color-name|rbush|quickselect|earcut|pbf)/).*/"],
10
10
  /** only consider files in src/ for coverage */
11
11
  "collectCoverageFrom": ["src/**/*.js"],
12
12
  /** coverage reporters */
@@ -14,7 +14,8 @@ module.exports = {
14
14
  /** mapping svg to string representation since jest can't handle svg and mapping olcs paths*/
15
15
  "moduleNameMapper": {
16
16
  "marker.svg": "<rootDir>/public/stringMarker.js",
17
- "olcs/lib/olcs/(.*)$": "<rootDir>/node_modules/olcs/lib/olcs/$1"
17
+ "olcs/lib/olcs/(.*)$": "<rootDir>/node_modules/olcs/lib/olcs/$1",
18
+ "ol-mapbox-style$": "<rootDir>/node_modules/ol-mapbox-style/src/$1"
18
19
  },
19
20
  "testEnvironment": "jsdom",
20
21
  "setupFilesAfterEnv": ["./jest.setup.js"],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@masterportal/masterportalapi",
3
3
  "author": "Implementierungspartnerschaft Masterportal <info@masterportal.org> (https://www.masterportal.org)",
4
- "version": "2.48.0",
4
+ "version": "2.49.0",
5
5
  "license": "MIT",
6
6
  "description": "Basic functions of the Masterportal as api",
7
7
  "repository": {
@@ -22,7 +22,7 @@
22
22
  "core-js": "^3.33.1",
23
23
  "dayjs": "^1.11.10",
24
24
  "ol": "^10.4.0",
25
- "ol-mapbox-style": "12.4.0",
25
+ "ol-mapbox-style": "12.5.0",
26
26
  "olcs": "^2.22.1",
27
27
  "proj4": "^2.10.0",
28
28
  "xml2js": "^0.6.2"
@@ -4,11 +4,11 @@ import VectorTileSource from "ol/source/VectorTile";
4
4
  import OpenLayersTileGrid from "ol/tilegrid/TileGrid";
5
5
  import {extentFromProjection} from "ol/tilegrid";
6
6
  import * as webgl from "../renderer/webgl";
7
-
8
- import {stylefunction, apply} from "ol-mapbox-style";
7
+ import {apply, stylefunction} from "ol-mapbox-style";
9
8
 
10
9
  import defaults from "../defaults";
11
10
 
11
+
12
12
  const OL_DEFAULT_VECTOR_TILE_GRID_CRS = "EPSG:3857";
13
13
 
14
14
  /**
package/src/layer/wms.js CHANGED
@@ -112,6 +112,14 @@ export function createLayerSource (rawLayer, options) {
112
112
  projection = rawLayer.crs ? getProjection(rawLayer.crs) : undefined;
113
113
  let tileGrid = null;
114
114
 
115
+
116
+ // Fix for daily updated WMS-Time Layer, which use 'current' as the default value of the time-Extent in their getCapabilities
117
+ // The promise isn't resolved quickly enough for the continued work with the layer.
118
+ // Its resolved value would be the current date, so it is hardcoded here.
119
+ if (rawLayer.TIME && rawLayer.TIME.toString() === "[object Promise]") {
120
+ params.TIME = new Date().toISOString();
121
+ }
122
+
115
123
  if (rawLayer.singleTile) {
116
124
  return new ImageWMS({
117
125
  url: rawLayer.url,
@@ -154,13 +162,15 @@ export function createLayerSource (rawLayer, options) {
154
162
  * @param {function} [rawLayer.olAttribution] - optional function that takes a module:ol/Map~FrameState and returns a string or an array of strings representing source attributions
155
163
  * @param {string|number} [rawLayer.tilesize] - optional needed to create the tileGrid
156
164
  * @param {string|"anonymous"} [rawLayer.crossOrigin] - optional needed for CORS requests of image data, to enable canvas export
157
- * @param {object} layerParams - additional layer params
165
+ * @param {object} [optionalParams] - optional params
166
+ * @param {object} [optionalParams.layerParams] - additional layer params
167
+ * @param {options} [optionalParams.options] - additional options
158
168
  * @param {object} options - optional resolutions and origin to create the TileGrid
159
169
  * @param {Array} [options.resolutions] - optional resolutions to create the TileGrid, must be in descending order
160
170
  * @param {Array} [options.origin] - optional origin to create the TileGrid
161
171
  * @returns {ol.Layer} Layer that can be added to map.
162
172
  */
163
- export function createLayer (rawLayer, layerParams = {}, options) {
173
+ export function createLayer (rawLayer = {}, {layerParams = {}, options = {}} = {}) {
164
174
  const source = createLayerSource(rawLayer, options),
165
175
  Layer = rawLayer.singleTile ? ImageLayer : TileLayer;
166
176
 
@@ -169,6 +169,8 @@ function setStyleObject (currentLayout, outerCircle = false) {
169
169
  lineStrokeWidth: currentLayout.strokeWidth,
170
170
  polygonFillColor: fillColorRgba,
171
171
  polygonStrokeColor: currentLayout.strokeColor,
172
+ polygonStrokeDash: currentLayout.polygonDash,
173
+ polygonStrokeDashOffset: currentLayout.polygonStrokeDashOffset,
172
174
  polygonStrokeWidth: currentLayout.strokeWidth
173
175
  }
174
176
  }
@@ -120,7 +120,7 @@ class TextStyle extends StyleClass {
120
120
  const feature = this.feature,
121
121
  featureProperties = feature.getProperties(),
122
122
  textSuffix = this.attributes.textSuffix;
123
- let text = mapAttributes(featureProperties, this.attributes.labelField, false);
123
+ let text = mapAttributes(featureProperties, this.attributes.labelField, false) ?? "";
124
124
 
125
125
  if (textSuffix !== "") {
126
126
  text = text + " " + textSuffix;
@@ -250,7 +250,7 @@ describe("wms.js", function () {
250
250
  name: "name",
251
251
  layers: "layer1, layer2"
252
252
  },
253
- layer = wms.createLayer({singleTile: false, tilesize: "10", extent: [10, 20, 11, 22]}, layerParams, options);
253
+ layer = wms.createLayer({singleTile: false, tilesize: "10", extent: [10, 20, 11, 22]}, {layerParams, options});
254
254
 
255
255
  expect(layer).toBeInstanceOf(TileLayer);
256
256
  expect(layer.get("name")).toEqual("name");
@@ -266,7 +266,7 @@ describe("wms.js", function () {
266
266
  name: "name",
267
267
  layers: "layer1, layer2"
268
268
  },
269
- layer = wms.createLayer({singleTile: true}, layerParams);
269
+ layer = wms.createLayer({singleTile: true}, {layerParams});
270
270
 
271
271
  expect(layer).toBeInstanceOf(ImageLayer);
272
272
  expect(layer.get("name")).toEqual("name");
@@ -86,7 +86,8 @@ describe("src/maps/interactions/drawInteraction.js", () => {
86
86
  fillColor: [55, 126, 184],
87
87
  fillTransparency: 0,
88
88
  strokeColor: [0, 0, 0],
89
- strokeWidth: 1
89
+ strokeWidth: 1,
90
+ polygonDash: [4]
90
91
  };
91
92
 
92
93
  drawInteractions.setStyleObject(currentLayout);
@@ -124,6 +125,8 @@ describe("src/maps/interactions/drawInteraction.js", () => {
124
125
  0,
125
126
  0
126
127
  ],
128
+ polygonStrokeDash: [4],
129
+ polygonStrokeDashOffset: undefined,
127
130
  polygonStrokeWidth: 1
128
131
  }
129
132
  }