@open-formulieren/formio-builder
Version:
An opinionated Formio webform builder for Open Forms
17 lines (16 loc) • 778 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const zod_1 = require("zod");
const validation_1 = require("../../registry/validation");
const ibanSchema = zod_1.z.string().optional();
// case for when component.multiple=false
const singleValueSchema = zod_1.z
.object({ multiple: zod_1.z.literal(false) })
.and(zod_1.z.object({ defaultValue: ibanSchema }));
// case for when component.multiple=true
const multipleValueSchema = zod_1.z
.object({ multiple: zod_1.z.literal(true) })
.and(zod_1.z.object({ defaultValue: ibanSchema.array() }));
const defaultValueSchema = singleValueSchema.or(multipleValueSchema);
const schema = ({ intl }) => (0, validation_1.buildCommonSchema)(intl).and(defaultValueSchema);
exports.default = schema;