View as Markdown

API reference

@salmonui/core/validation

12 exported symbols: 1 function, 6 interfaces, 3 types and 2 constants. Each name links its page with the signature, docs and members.

import { … } from '@salmonui/core/validation';

Functions

  • compileValidationRulesCompiles rules into one validator. implicitRequired adds a required check without a rule (primary keys of new rows).

Interfaces

  • ColumnValidation
  • CompiledValidatorOne column's compiled rules.
  • FieldValidatorContextContext of a form field's custom validators (@salmonui/inputs/form Field). It is passed as both the row and the ctx argument, so validate(value, { formData })…
  • FormDataLikeThe read side of FormData (core has no DOM types).
  • ValidationMessagesMessage templates; {0} and {1} are the rule arguments.
  • ValidatorContextContext passed to custom validators; Column is the host's column (the Data Grid passes its compiled column).

Types

  • CustomValidatorCustom validator: returns an error message, or null / undefined / true when the value is valid (false uses the rule message). May return a promise (async valid…
  • FieldValidationRules of a form field: the column vocabulary with the field context.
  • RuleValueA rule argument, or [argument, message] to override the message.

Constants