@open-formulieren/formio-builder
Version:
An opinionated Formio webform builder for Open Forms
40 lines (39 loc) • 1.27 kB
JavaScript
import { TILE_LAYER_RD as n } from "@open-formulieren/leaflet-tools/lib/tiles.js";
import { z as e } from "zod";
import { buildCommonSchema as s } from "../validation.js";
const m = (t) => e.object({
defaultZoom: e.number().int().lte(n.maxZoom).gte(n.minZoom).optional(),
// The initialCenter coordinates are limited to the WGS84 bounds for the Netherlands
// https://epsg.io/28992
initialCenter: e.object({
lat: e.number().gte(50.5).lte(54).optional(),
lng: e.number().gte(3).lte(7.5).optional()
}).superRefine((o, l) => {
const a = o.lat == null && o.lng == null, i = o.lat != null && o.lng != null;
if (a || i)
return;
const u = o.lat == null ? "lat" : "lng";
l.addIssue({
code: e.ZodIssueCode.custom,
message: t.formatMessage({
id: "R/XadM",
defaultMessage: [{
type: 0,
value: "You need to configure both longitude and latitude."
}]
}),
path: [u]
});
}).optional()
}), d = (t) => e.object({
useConfigDefaultMapSettings: e.literal(!0),
defaultZoom: e.undefined().or(e.null()),
initialCenter: e.undefined()
}).or(e.object({
useConfigDefaultMapSettings: e.literal(!1)
}).and(m(t))), c = ({
intl: t
}) => s(t).and(d(t));
export {
c as default
};