Options
All
  • Public
  • Public/Protected
  • All
Menu

@zeachco/declarative-forms

Index

Type aliases

DecorateFunction<T>: (context: DeclarativeFormContext<T>) => void

Type parameters

Type declaration

DecoratorKeys: typeof slotNames[number]
DecoratorPropsGetter<T>: SpecialProps<T> | ((node: SchemaNode) => SpecialProps<T>)

Used to defines Props (or a function returning Props) for a function without the usual schema node props and it's children. That way we can only focus on the special Props without knowing about the library's internals

Type parameters

  • T: Noop

FormatterFn: (value: any, type: string, node: SchemaNode) => any

Type declaration

    • Parameters

      Returns any

GenericExcludedComponentProps: "onChange" | "value"

Usual excluded props in custom components,

NodeChildrenMap: ObjectMap<SchemaNode>
NodeKind: string
NodeValue: any
ReactComponent: any
SchemaNodeDecoratorSafeAttributes: Pick<SchemaNode, "type" | "name" | "depth" | "isList" | "isVariant" | "schema" | "path" | "pathShort" | "pathVariant" | "attributes" | "required" | "parentNode" | "getNodeByPath" | "decorator" | "context" | "isValid">

Using a subset of SchemaNode since decoration happens only at the construction of the schema and dynamic values don't retrigger decorators for performance and dependency reasons.

SchemaValidator<T>: BaseSchemaValidator & T

Type parameters

  • T: ObjectMap = ObjectMap

SpecialProps<T, E>: Omit<GetProps<T>, keyof NodeProps | E>

Used to defines properties of a function without the usual schema node props This is usefull to know what properties are expected from a library consumer point of view

Type parameters

TranslatorFn: (node: SchemaNode, args?: TranslatorArgs) => string

Type declaration

ValidatorFn<T>: (val: NodeValue, options: SchemaValidator<T>, node: SchemaNode) => ValidationError | null

Type parameters

  • T: ObjectMap = any

Type declaration

Functions

  • defaultTypeFormater(val: any, type: string, _node: SchemaNode<any>): any
  • Function representing the schema validator with {name: "Format", ...} options use that interface

    interface FormatValidatorOptions {
    // Valid javascript regex pattern without the surounding slashes ie: "[a-z]"
    format?: string;
    // normal RegExp flag
    flags?: string;
    }

    example of schema

    {
    "name": "Format",
    "format": "0x[a-f]{8}",
    "flags": "gim"
    }

    Parameters

    Returns ValidationError | null

  • Ask yourself if you really should check for this this is a utility for the consumer code to understand which repository is being used to render forms. As there was many clone versions, all with similar structures some utilities were polymorphic dealing with the slight API discrepancies using that function

    Type parameters

    • T = unknown

    Parameters

    • node: any

    Returns node is SchemaNode<T>

  • Function representing the schema validator with {name: "Length", ...}

    If a value is defined, it tests the content's length based on an optional minimum and/or optional maximum

    Parameters

    Returns ValidationError | null

  • renderNode(node: SchemaNode<any>, uid?: string): ReactNode[]
  • toJS<T>(source: T, options?: any): T
  • Basically, a deep clone, so that no reactive property will exist anymore.

    Type parameters

    • T

    Parameters

    • source: T
    • Optional options: any

    Returns T

  • useNode<T, C>(node: SchemaNode<T>, __namedParameters?: Features): { errorMessage: string; errors: ValidationError[]; exists: boolean; focused: boolean; invalidChildren: string[]; isValid: boolean; onChange: (val: T) => ValidationError[]; remoteErrors: undefined | ContextErrors; serverErrors: ValidationError[]; setInitialValue: (value: any) => void; sharedContext: C; value: T }

Generated using TypeDoc