@opendata-ai/openchart-engine 8.7.0 → 8.8.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/index.d.ts +1 -1
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -437,7 +437,7 @@ interface NormalizedBarListSpec {
|
|
|
437
437
|
|
|
438
438
|
interface NormalizedGeoMapSpec {
|
|
439
439
|
type: 'map';
|
|
440
|
-
geo: Required<Omit<GeoMapGeo, 'projection'>> & {
|
|
440
|
+
geo: Required<Omit<GeoMapGeo, 'projection' | 'zoom'>> & {
|
|
441
441
|
projection?: GeoMapProjection;
|
|
442
442
|
};
|
|
443
443
|
data: Record<string, unknown>[];
|
package/dist/index.js
CHANGED
|
@@ -9108,6 +9108,35 @@ function validateTileMapSpec(spec, errors) {
|
|
|
9108
9108
|
});
|
|
9109
9109
|
}
|
|
9110
9110
|
}
|
|
9111
|
+
function validateGeoMapZoom(zoom, errors) {
|
|
9112
|
+
if (zoom === void 0 || typeof zoom === "boolean") return;
|
|
9113
|
+
if (typeof zoom !== "object" || zoom === null || Array.isArray(zoom)) {
|
|
9114
|
+
errors.push({
|
|
9115
|
+
message: "Spec error: geo.zoom must be a boolean or an object { maxZoom?, controls? }",
|
|
9116
|
+
path: "geo.zoom",
|
|
9117
|
+
code: "INVALID_TYPE",
|
|
9118
|
+
suggestion: "Use zoom: true, or zoom: { maxZoom: 8, controls: true }"
|
|
9119
|
+
});
|
|
9120
|
+
return;
|
|
9121
|
+
}
|
|
9122
|
+
const cfg = zoom;
|
|
9123
|
+
if (cfg.maxZoom !== void 0 && (typeof cfg.maxZoom !== "number" || !Number.isFinite(cfg.maxZoom) || cfg.maxZoom < 1)) {
|
|
9124
|
+
errors.push({
|
|
9125
|
+
message: "Spec error: geo.zoom.maxZoom must be a number >= 1",
|
|
9126
|
+
path: "geo.zoom.maxZoom",
|
|
9127
|
+
code: "INVALID_VALUE",
|
|
9128
|
+
suggestion: "maxZoom is a multiple of the full map, e.g. maxZoom: 8. The default is 12."
|
|
9129
|
+
});
|
|
9130
|
+
}
|
|
9131
|
+
if (cfg.controls !== void 0 && typeof cfg.controls !== "boolean") {
|
|
9132
|
+
errors.push({
|
|
9133
|
+
message: "Spec error: geo.zoom.controls must be a boolean",
|
|
9134
|
+
path: "geo.zoom.controls",
|
|
9135
|
+
code: "INVALID_TYPE",
|
|
9136
|
+
suggestion: "Use controls: false to hide the zoom buttons"
|
|
9137
|
+
});
|
|
9138
|
+
}
|
|
9139
|
+
}
|
|
9111
9140
|
function validateGeoMapSpec(spec, errors) {
|
|
9112
9141
|
if (!spec.geo || typeof spec.geo !== "object") {
|
|
9113
9142
|
errors.push({
|
|
@@ -9228,6 +9257,7 @@ function validateGeoMapSpec(spec, errors) {
|
|
|
9228
9257
|
});
|
|
9229
9258
|
}
|
|
9230
9259
|
}
|
|
9260
|
+
validateGeoMapZoom(geo.zoom, errors);
|
|
9231
9261
|
const encoding = spec.encoding;
|
|
9232
9262
|
const hasPoints = spec.points && typeof spec.points === "object" && !Array.isArray(spec.points);
|
|
9233
9263
|
const specData = spec.data;
|