Support custom validation rules for ejected block fields (#12799)
This commit is contained in:
parent
87be623057
commit
af51a167a3
|
@ -88,7 +88,7 @@
|
|||
<BlockComponent
|
||||
type="form"
|
||||
bind:id={formId}
|
||||
props={{ dataSource, disableValidation: true }}
|
||||
props={{ dataSource, disableSchemaValidation: true }}
|
||||
>
|
||||
{#if title || enrichedSearchColumns?.length || showTitleButton}
|
||||
<BlockComponent
|
||||
|
|
|
@ -147,7 +147,7 @@
|
|||
bind:id={formId}
|
||||
props={{
|
||||
dataSource,
|
||||
disableValidation: true,
|
||||
disableSchemaValidation: true,
|
||||
editAutoColumns: true,
|
||||
size,
|
||||
}}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
// Not exposed as a builder setting. Used internally to disable validation
|
||||
// for fields rendered in things like search blocks.
|
||||
export let disableValidation = false
|
||||
export let disableSchemaValidation = false
|
||||
|
||||
// Not exposed as a builder setting. Used internally to allow searching on
|
||||
// auto columns.
|
||||
|
@ -103,7 +103,7 @@
|
|||
{schema}
|
||||
{table}
|
||||
{initialValues}
|
||||
{disableValidation}
|
||||
{disableSchemaValidation}
|
||||
{editAutoColumns}
|
||||
{currentStep}
|
||||
>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
export let size
|
||||
export let schema
|
||||
export let table
|
||||
export let disableValidation = false
|
||||
export let disableSchemaValidation = false
|
||||
export let editAutoColumns = false
|
||||
|
||||
// We export this store so that when we remount the inner form we can still
|
||||
|
@ -156,12 +156,11 @@
|
|||
if (!field) {
|
||||
return
|
||||
}
|
||||
|
||||
// Create validation function based on field schema
|
||||
const schemaConstraints = schema?.[field]?.constraints
|
||||
const validator = disableValidation
|
||||
const schemaConstraints = disableSchemaValidation
|
||||
? null
|
||||
: createValidatorFromConstraints(
|
||||
: schema?.[field]?.constraints
|
||||
const validator = createValidatorFromConstraints(
|
||||
schemaConstraints,
|
||||
validationRules,
|
||||
field,
|
||||
|
@ -332,10 +331,10 @@
|
|||
const { value, error } = fieldState
|
||||
|
||||
// Create new validator
|
||||
const schemaConstraints = schema?.[field]?.constraints
|
||||
const validator = disableValidation
|
||||
const schemaConstraints = disableSchemaValidation
|
||||
? null
|
||||
: createValidatorFromConstraints(
|
||||
: schema?.[field]?.constraints
|
||||
const validator = createValidatorFromConstraints(
|
||||
schemaConstraints,
|
||||
validationRules,
|
||||
field,
|
||||
|
|
Loading…
Reference in New Issue