diff --git a/lerna.json b/lerna.json
index d191854fac..b0003be838 100644
--- a/lerna.json
+++ b/lerna.json
@@ -1,5 +1,5 @@
{
- "version": "2.22.1",
+ "version": "2.22.2",
"npmClient": "yarn",
"packages": [
"packages/*",
diff --git a/packages/bbui/src/Form/Core/Dropzone.svelte b/packages/bbui/src/Form/Core/Dropzone.svelte
index 2bd95df516..3d803c0961 100644
--- a/packages/bbui/src/Form/Core/Dropzone.svelte
+++ b/packages/bbui/src/Form/Core/Dropzone.svelte
@@ -197,7 +197,9 @@
>
-
+ {#if maximum !== 1}
+
+ {/if}
{:else if value?.length}
{#each value as file}
diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte
index 46c6f5b58e..f6a4f29a06 100644
--- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte
+++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte
@@ -470,7 +470,7 @@
newError.name = `Column name already in use.`
}
- if (fieldInfo.type === "auto" && !fieldInfo.subtype) {
+ if (fieldInfo.type === FieldType.AUTO && !fieldInfo.subtype) {
newError.subtype = `Auto Column requires a type`
}
@@ -531,18 +531,18 @@
}}
/>
- {#if editableColumn.type === "string"}
+ {#if editableColumn.type === FieldType.STRING}
@@ -560,12 +560,12 @@
text="Enable rich text support (markdown)"
/>
- {:else if editableColumn.type === "array"}
+ {:else if editableColumn.type === FieldType.ARRAY}
- {:else if editableColumn.type === "datetime" && !editableColumn.autocolumn}
+ {:else if editableColumn.type === FieldType.DATETIME && !editableColumn.autocolumn}
@@ -604,7 +604,7 @@
{/if}
- {:else if editableColumn.type === "number" && !editableColumn.autocolumn}
+ {:else if editableColumn.type === FieldType.NUMBER && !editableColumn.autocolumn}
@@ -629,7 +629,7 @@
/>
- {:else if editableColumn.type === "link"}
+ {:else if editableColumn.type === FieldType.LINK}
+ {:else if editableColumn.type === FieldType.ATTACHMENT}
+
{
+ if (!e.detail) {
+ editableColumn.constraints ??= { length: {} }
+ editableColumn.constraints.length ??= {}
+ editableColumn.constraints.length.maximum = 1
+ editableColumn.constraints.length.message =
+ "cannot contain multiple files"
+ } else {
+ delete editableColumn.constraints?.length?.maximum
+ delete editableColumn.constraints?.length?.message
+ }
+ }}
+ thin
+ text="Allow multiple"
+ />
{/if}
{#if editableColumn.type === AUTO_TYPE || editableColumn.autocolumn}
diff --git a/packages/client/src/components/app/blocks/form/InnerFormBlock.svelte b/packages/client/src/components/app/blocks/form/InnerFormBlock.svelte
index 24d4cfa14c..b0733f3f4b 100644
--- a/packages/client/src/components/app/blocks/form/InnerFormBlock.svelte
+++ b/packages/client/src/components/app/blocks/form/InnerFormBlock.svelte
@@ -2,6 +2,7 @@
import BlockComponent from "components/BlockComponent.svelte"
import Placeholder from "components/app/Placeholder.svelte"
import { getContext } from "svelte"
+ import FormBlockComponent from "../FormBlockComponent.svelte"
export let dataSource
export let actionType
@@ -14,49 +15,11 @@
export let buttonPosition = "bottom"
export let schema
- const FieldTypeToComponentMap = {
- string: "stringfield",
- number: "numberfield",
- bigint: "bigintfield",
- options: "optionsfield",
- array: "multifieldselect",
- boolean: "booleanfield",
- longform: "longformfield",
- datetime: "datetimefield",
- attachment: "attachmentfield",
- link: "relationshipfield",
- json: "jsonfield",
- barcodeqr: "codescanner",
- bb_reference: "bbreferencefield",
- }
const context = getContext("context")
let formId
$: renderHeader = buttons || title
-
- const getComponentForField = field => {
- const fieldSchemaName = field.field || field.name
- if (!fieldSchemaName || !schema?.[fieldSchemaName]) {
- return null
- }
- const type = schema[fieldSchemaName].type
- return FieldTypeToComponentMap[type]
- }
-
- const getPropsForField = field => {
- let fieldProps = field._component
- ? {
- ...field,
- }
- : {
- field: field.name,
- label: field.name,
- placeholder: field.name,
- _instanceName: field.name,
- }
- return fieldProps
- }
{#if fields?.length}
@@ -132,15 +95,7 @@
{#each fields as field, idx}
- {#if getComponentForField(field) && field.active}
-
- {/if}
+
{/each}
diff --git a/packages/frontend-core/src/components/grid/cells/AttachmentCell.svelte b/packages/frontend-core/src/components/grid/cells/AttachmentCell.svelte
index e6c9e53c75..a1f5c4f2aa 100644
--- a/packages/frontend-core/src/components/grid/cells/AttachmentCell.svelte
+++ b/packages/frontend-core/src/components/grid/cells/AttachmentCell.svelte
@@ -9,6 +9,7 @@
export let api
export let invertX = false
export let invertY = false
+ export let schema
const { API, notifications } = getContext("grid")
const imageExtensions = ["png", "tiff", "gif", "raw", "jpg", "jpeg"]
@@ -97,6 +98,7 @@
{value}
compact
on:change={e => onChange(e.detail)}
+ maximum={schema.constraints?.length?.maximum}
{processFiles}
{deleteAttachments}
{handleFileTooLarge}