@eox/layercontrol 1.2.1 → 1.3.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/dist/eox-layercontrol.js +292 -288
- package/dist/eox-layercontrol.umd.cjs +34 -34
- package/package.json +1 -1
- package/src/components/layer-legend.js +3 -1
- package/src/helpers/get-legend-config.js +6 -6
- package/src/helpers/get-start-vals.js +9 -1
- package/types/layercontrol/src/components/layer-legend.d.ts.map +1 -1
- package/types/layercontrol/src/helpers/get-start-vals.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -75,7 +75,9 @@ export class EOxLayerControlLayerLegend extends LitElement {
|
|
|
75
75
|
* @see {@link https://clhenrick.github.io/color-legend-element/}
|
|
76
76
|
**/
|
|
77
77
|
set layerLegend(value) {
|
|
78
|
-
if (
|
|
78
|
+
if (!value) {
|
|
79
|
+
this.#layerLegend = null;
|
|
80
|
+
} else if (Array.isArray(value)) {
|
|
79
81
|
this.#layerLegend = value.map((config, idx) => ({
|
|
80
82
|
id: (this.layer?.get("id") ?? "") + idx,
|
|
81
83
|
...config,
|
|
@@ -36,17 +36,17 @@ const getLegendConfig = (legendConfig, data) => {
|
|
|
36
36
|
const propName = legend.boundTo.key;
|
|
37
37
|
const expectedToMatch = legend.boundTo.value;
|
|
38
38
|
|
|
39
|
-
// if the property
|
|
40
|
-
return
|
|
39
|
+
// only show the legend if the property exists and matches the expected value
|
|
40
|
+
return propName in flatData && flatData[propName] == expectedToMatch;
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
//
|
|
43
|
+
// If no legends are active, return null
|
|
44
44
|
if (!activeLegends.length) {
|
|
45
|
-
activeLegends =
|
|
45
|
+
activeLegends = null;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
return /** @type {import("../components/layer-legend").LegendConfig[]} */ (
|
|
49
|
-
activeLegends
|
|
48
|
+
return /** @type {import("../components/layer-legend").LegendConfig[] | null} */ (
|
|
49
|
+
activeLegends?.map((activeLegend) => {
|
|
50
50
|
delete activeLegend.boundTo;
|
|
51
51
|
if (!("domainProperties" in activeLegend) || "domain" in activeLegend) {
|
|
52
52
|
return activeLegend;
|
|
@@ -55,9 +55,17 @@ export function getStartVals(layer, layerConfig) {
|
|
|
55
55
|
// Extract query parameters from tile URL
|
|
56
56
|
// @ts-expect-error TODO
|
|
57
57
|
const url = new URL(layer.getSource().getTileUrlFunction()([0, 0, 0]));
|
|
58
|
+
const removeProperties =
|
|
59
|
+
layerConfig.schema?.options?.removeProperties ?? [];
|
|
60
|
+
// Remove unwanted properties from query parameters
|
|
61
|
+
removeProperties.forEach((prop) => url.searchParams.delete(prop));
|
|
58
62
|
|
|
59
63
|
// Retrieve startVals based on schema and query parameters
|
|
60
|
-
nestedValues =
|
|
64
|
+
nestedValues = {};
|
|
65
|
+
for (const [key, value] of url.searchParams.entries()) {
|
|
66
|
+
const allValues = url.searchParams.getAll(key);
|
|
67
|
+
nestedValues[key] = allValues.length > 1 ? allValues : value;
|
|
68
|
+
}
|
|
61
69
|
} else return null;
|
|
62
70
|
|
|
63
71
|
const startVals = getNestedStartVals(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layer-legend.d.ts","sourceRoot":"","sources":["../../../../src/components/layer-legend.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;IAcI;AAEJ;;;;;GAKG;AACH;IAEE;;;;;;;;;;;;;MAKE;IAKA;;;;OAIG;IACH,kBAAqB;IAErB;;;;OAIG;IACH,kBAAqB;IAErB;;;;;OAKG;IACH,OAHU,OAAO,UAAU,EAAE,KAAK,CAGjB;IAcnB;;;;QAII;IACJ,uBAHW,YAAY,GAAG,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"layer-legend.d.ts","sourceRoot":"","sources":["../../../../src/components/layer-legend.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;IAcI;AAEJ;;;;;GAKG;AACH;IAEE;;;;;;;;;;;;;MAKE;IAKA;;;;OAIG;I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a,CAAC,GAC5E,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"get-start-vals.d.ts","sourceRoot":"","sources":["../../../../src/helpers/get-start-vals.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,2CAJW;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,gBACpB;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAC,GAClB,MAAM,CAuBlB;AAED;;;;;;GAMG;AACH,oCAJW,OAAO,UAAU,EAAE,KAAK,eACxB,OAAO,4BAA4B,EAAE,0BAA0B,CAAC,aAAa,CAAC,GAC5E,MAAM,GAAG,IAAI,CAyCzB"}
|