mirror of
https://github.com/maputnik/editor.git
synced 2026-07-31 10:17:26 +00:00
Update style-spec package to 26.1 (#2005)
## Launch Checklist Update style-spec package to version 26.1 This should solve a problem related to expression validation. - [x] Briefly describe the changes in this PR. - [x] Link to related issues.
This commit is contained in:
@@ -2,7 +2,10 @@ import { InputDynamicArray, type InputDynamicArrayProps } from "./InputDynamicAr
|
||||
import { Fieldset } from "./Fieldset";
|
||||
|
||||
type FieldDynamicArrayProps = InputDynamicArrayProps & {
|
||||
name?: string
|
||||
name?: string;
|
||||
fieldSpec?: {
|
||||
value?: string;
|
||||
}
|
||||
};
|
||||
|
||||
export const FieldDynamicArray: React.FC<FieldDynamicArrayProps> = (props) => {
|
||||
|
||||
@@ -74,20 +74,20 @@ function getLayoutForType(type: LayerSpecification["type"], t: TFunction): Maput
|
||||
return getLayoutForSymbolType(t);
|
||||
}
|
||||
const groups: MaputnikLayoutGroup[] = [];
|
||||
if (Object.keys(v8["paint_" + type]).length > 0) {
|
||||
if (Object.keys(v8["paint_" + type as keyof typeof v8]).length > 0) {
|
||||
groups.push({
|
||||
title: t("Paint properties"),
|
||||
id: "Paint_properties",
|
||||
type: "properties",
|
||||
fields: Object.keys(v8["paint_" + type]),
|
||||
fields: Object.keys(v8["paint_" + type as keyof typeof v8]),
|
||||
});
|
||||
}
|
||||
if (Object.keys(v8["layout_" + type]).length > 0) {
|
||||
if (Object.keys(v8["layout_" + type as keyof typeof v8]).length > 0) {
|
||||
groups.push({
|
||||
title: t("Layout properties"),
|
||||
id: "Layout_properties",
|
||||
type: "properties",
|
||||
fields: Object.keys(v8["layout_" + type])
|
||||
fields: Object.keys(v8["layout_" + type as keyof typeof v8])
|
||||
});
|
||||
}
|
||||
return groups;
|
||||
|
||||
@@ -119,7 +119,7 @@ function createMaplibreExpressionLinter(spec?: StylePropertySpecification) {
|
||||
const text = view.state.doc.toString();
|
||||
const parsedJson = JSON.parse(text);
|
||||
const ast = jsonToAst(text);
|
||||
const out = expression.createExpression(parsedJson, spec);
|
||||
const out = expression.createExpression(parsedJson, "expression", spec);
|
||||
if (out?.result !== "error") {
|
||||
return [];
|
||||
}
|
||||
|
||||
+2
-2
@@ -5,14 +5,14 @@ import { type LayerSpecification } from "maplibre-gl";
|
||||
export function changeType(layer: LayerSpecification, newType: string): LayerSpecification {
|
||||
const changedPaintProps: LayerSpecification["paint"] = { ...layer.paint };
|
||||
Object.keys(changedPaintProps).forEach(propertyName => {
|
||||
if(!(propertyName in latest["paint_" + newType])) {
|
||||
if(!(propertyName in ((latest["paint_" + newType as keyof typeof latest]) as string[]))) {
|
||||
delete changedPaintProps[propertyName as keyof LayerSpecification["paint"]];
|
||||
}
|
||||
});
|
||||
|
||||
const changedLayoutProps: LayerSpecification["layout"] = { ...layer.layout };
|
||||
Object.keys(changedLayoutProps).forEach(propertyName => {
|
||||
if(!(propertyName in latest["layout_" + newType])) {
|
||||
if(!(propertyName in ((latest["layout_" + newType as keyof typeof latest]) as string[]))) {
|
||||
delete changedLayoutProps[propertyName as keyof LayerSpecification["layout"]];
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user