diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ValidationEditor/ValidationDrawer.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ValidationEditor/ValidationDrawer.svelte index e24a779b62..64938fe75b 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ValidationEditor/ValidationDrawer.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/ValidationEditor/ValidationDrawer.svelte @@ -9,13 +9,13 @@ Body, Input, DatePicker, - Multiselect, } from "@budibase/bbui" import { currentAsset, selectedComponent } from "builderStore" import { findClosestMatchingComponent } from "builderStore/storeUtils" import { getSchemaForDatasource } from "builderStore/dataBinding" import DrawerBindableInput from "components/common/bindings/DrawerBindableInput.svelte" import { generate } from "shortid" + import Multiselect from "../../../../../../../bbui/src/Form/Core/Multiselect.svelte" export let rules = [] export let bindings = [] @@ -58,14 +58,22 @@ label: "Must not match regex", value: "notRegex", }, - Contains: { + ContainsRowID: { label: "Must contain row ID", value: "contains", }, - NotContains: { + NotContainsRowID: { label: "Must not contain row ID", value: "notContains", }, + Contains: { + label: "Must contain one of", + value: "contains", + }, + NotContains: { + label: "Must not contain one of", + value: "notContains", + }, } const ConstraintMap = { ["string"]: [ @@ -98,8 +106,8 @@ ["attachment"]: [Constraints.Required], ["link"]: [ Constraints.Required, - Constraints.Contains, - Constraints.NotContains, + Constraints.ContainsRowID, + Constraints.NotContainsRowID, Constraints.MinLength, Constraints.MaxLength, ], @@ -107,6 +115,8 @@ Constraints.Required, Constraints.MinLength, Constraints.MaxLength, + Constraints.Contains, + Constraints.NotContains, ], } @@ -195,6 +205,7 @@ valueType: "Binding", type: fieldType, id: generate(), + value: fieldType == "array" ? [] : null, }, ] } @@ -280,7 +291,7 @@ disabled={rule.constraint === "required"} on:change={e => (rule.value = e.detail)} /> - {:else if ["maxLength", "minLength", "regex", "notRegex", "contains", "notContains"].includes(rule.constraint)} + {:else if ["maxLength", "minLength", "regex", "notRegex", "containsRowID", "notContainsRowID"].includes(rule.constraint)} {:else} - {#if ["string", "number", "options", "longform", "array"].includes(rule.type)} + {#if ["string", "number", "options", "longform"].includes(rule.type)} + {:else if rule.type === "array" && ["contains", "notContains"].includes(rule.constraint)} + x} + getOptionValue={x => x} + on:change={e => (rule.value = e.detail)} + bind:value={rule.value} + /> {:else if rule.type === "boolean"}