@kalisio/kdk 2.1.3 → 2.1.5

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.
@@ -1,4 +1,5 @@
1
1
  import _ from 'lodash'
2
+ import Cesium from 'cesium/Source/Cesium.js'
2
3
  import { utils as kdkCoreUtils } from '../../../core/client/index.js'
3
4
 
4
5
  export const CesiumStyleMappings = {
@@ -112,6 +112,16 @@ export const context = {
112
112
  const activeLayers = _.values(this.layers).filter(sift({ isVisible: true, scope: { $nin: ['system'] }, _id: { $exists: true } })).map(layer => layer.name)
113
113
  // When retrieved from query parameters if a single layer is provided we don't have an array
114
114
  let targetLayers = _.isArray(targetParameters.layers) ? targetParameters.layers : [targetParameters.layers]
115
+ // Manage backward compatibility: translation key prefix can be omitted and/or name given in kebab case on built-in layers
116
+ targetLayers = targetLayers.map(name => {
117
+ if (this.hasLayer(name)) return name
118
+ // If name is not found try with prefixed and uppercase version
119
+ if (!_.startsWith(name, 'Layers.')) {
120
+ if (!_.startsWith(name, 'layers-')) name = 'layers-' + name
121
+ name = _.replace(_.replace(_.upperCase(name), / /g, '_'), 'LAYERS_', 'Layers.')
122
+ }
123
+ return name
124
+ })
115
125
  targetLayers = targetLayers.filter((name) => this.hasLayer(name))
116
126
  if (_.isEmpty(targetLayers)) return
117
127
  // List of layers to be (de)activated
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kalisio/kdk",
3
3
  "description": "Kalisio Development Kit",
4
- "version": "2.1.3",
4
+ "version": "2.1.5",
5
5
  "homepage": "https://github.com/kalisio/kdk",
6
6
  "type": "module",
7
7
  "keywords": [