Form

dev.cheleb.scalamigen.Form
See theForm companion trait
object Form extends AutoDerivation[Form]

Attributes

Companion
trait
Graph
Supertypes
trait AutoDerivation[Form]
trait Derivation[Form]
trait SealedTraitDerivation
trait CommonDerivation[Form]
class Object
trait Matchable
class Any
Show all
Self type
Form.type

Members list

Type members

Classlikes

object given_Form_String extends Form[String]

Form for to a string, aka without validation.

Form for to a string, aka without validation.

Attributes

Supertypes
trait Form[String]
class Object
trait Matchable
class Any
Self type

Types

type Typeclass[T] = Form[T]

Value members

Concrete methods

def getSubtypeLabel[T](sub: Subtype[Typeclass, T, _]): String
def join[A](caseClass: CaseClass[Typeclass, A]): Form[A]

Must be implemented by the user of Magnolia to construct a typeclass for case class T using the provided type info. E.g. if we are deriving Show[T] typeclasses, and T is a case class Foo(...), we need to constuct Show[Foo].

Must be implemented by the user of Magnolia to construct a typeclass for case class T using the provided type info. E.g. if we are deriving Show[T] typeclasses, and T is a case class Foo(...), we need to constuct Show[Foo].

This method is called 'join' because typically it will join together the typeclasses for all the parameters of the case class, into a single typeclass for the case class itself. The field CaseClass.params can provide useful information for doing this.

Value parameters

caseClass

information about the case class T, its parameters, and their typeclasses

Attributes

def renderVar[A](v: Var[A], syncParent: () => Unit)(using WidgetFactory, EventBus[(String, ValidationEvent)])(using fa: Form[A]): ReactiveHtmlElement[HTMLElement]

Render a variable with a form.

Render a variable with a form.

Type parameters

A

the type of the variable

Value parameters

fa

the form for the variable, either given or derived by magnolia <3

factory

the widget factory

syncParent

a function to sync the parent state

v

the variable to render

Attributes

def renderVar[A](path: List[Symbol], v: Var[A], syncParent: () => Unit)(using WidgetFactory, EventBus[(String, ValidationEvent)])(using fa: Form[A]): ReactiveHtmlElement[HTMLElement]
def split[A](sealedTrait: SealedTrait[Form, A]): Form[A]

This must be implemented by the user of Magnolia to construct a Typeclass for 'T', where 'T' is a Sealed Trait or Scala 3 Enum, using the provided type info. E.g. if we are deriving 'Show[T]' typeclasses, and T is an enum 'Suit' (eg with values Diamonds, Clubs, etc), we need to constuct 'Show[Suit]'.

This must be implemented by the user of Magnolia to construct a Typeclass for 'T', where 'T' is a Sealed Trait or Scala 3 Enum, using the provided type info. E.g. if we are deriving 'Show[T]' typeclasses, and T is an enum 'Suit' (eg with values Diamonds, Clubs, etc), we need to constuct 'Show[Suit]'.

This method is called 'split' because it will ''split'' the different possible types of the SealedTrait, and handle each one to finally produce a typeclass capable of handling any possible subtype of the trait.

A useful function for implementing this method is SealedTrait#choose, which can take a value instance and provide information on the specific subtype of the sealedTrait which that value is.

Attributes

Inherited methods

inline def `getParams__`[T, Labels <: Tuple, Params <: Tuple](annotations: Map[String, List[Any]], inheritedAnnotations: Map[String, List[Any]], typeAnnotations: Map[String, List[Any]], repeated: Map[String, Boolean], defaults: Map[String, Option[() => Any]], idx: Int): List[Param[Typeclass, T]]

Attributes

Inherited from:
CommonDerivation
inline override protected def deriveSubtype[s](m: Of[s]): Form[s]

Attributes

Definition Classes
Derivation -> SealedTraitDerivation
Inherited from:
Derivation
inline def derived[A](using Of[A]): Form[A]

Attributes

Inherited from:
Derivation
inline def derivedMirror[A](using mirror: Of[A]): Form[A]

Attributes

Inherited from:
Derivation
inline def derivedMirrorProduct[A](product: ProductOf[A]): Form[A]

Attributes

Inherited from:
CommonDerivation
inline def derivedMirrorSum[A](sum: SumOf[A]): Form[A]

Attributes

Inherited from:
Derivation
inline def getParams[T, Labels <: Tuple, Params <: Tuple](annotations: Map[String, List[Any]], typeAnnotations: Map[String, List[Any]], repeated: Map[String, Boolean], idx: Int): List[Param[Typeclass, T]]

Attributes

Inherited from:
CommonDerivation
inline def getParams_[T, Labels <: Tuple, Params <: Tuple](annotations: Map[String, List[Any]], inheritedAnnotations: Map[String, List[Any]], typeAnnotations: Map[String, List[Any]], repeated: Map[String, Boolean], idx: Int): List[Param[Typeclass, T]]

Attributes

Inherited from:
CommonDerivation
inline protected def sealedTraitFromMirror[A](m: SumOf[A]): SealedTrait[Typeclass, A]

Attributes

Inherited from:
SealedTraitDerivation
transparent inline def subtypes[T, SubtypeTuple <: Tuple](m: SumOf[T], idx: Int): List[Subtype[Typeclass, T, _]]

Attributes

Inherited from:
Derivation
transparent inline protected def subtypesFromMirror[A, SubtypeTuple <: Tuple](m: SumOf[A], idx: Int): List[Subtype[Typeclass, A, _]]

Attributes

Inherited from:
SealedTraitDerivation

Givens

Givens

given eitherOf[L, R](using lf: Form[L], rf: Form[R], ld: Defaultable[L], rd: Defaultable[R]): Form[Either[L, R]]

Form for a either of L or R

Form for a either of L or R

Value parameters

ld

the default value for a L

lf

the left form for a L, given or derived by magnolia

rd

the default value for a R

rf

the right form for a R, given or derived by magnolia

Attributes

given given_Form_BigDecimal: Form[BigDecimal]

Form for a BigDecimal.

Form for a BigDecimal.

Attributes

given given_Form_BigInt: Form[BigInt]

Form for a BigInt.

Form for a BigInt.

Attributes

given given_Form_Boolean: Form[Boolean]

Form for a Boolean.

Form for a Boolean.

Basically a checkbox.

Attributes

given given_Form_Double: Form[Double]

Form for an Double.

Form for an Double.

Attributes

given given_Form_Float: Form[Float]

Form for an Float.

Form for an Float.

Attributes

given given_Form_Int: Form[Int]

Form for an Int.

Form for an Int.

Attributes

given given_Form_IronType[T, C](using validator: IronTypeValidator[T, C], widgetFactory: WidgetFactory): Form[IronType[T, C]]

Form for an Iron type. This is a form for a type that can be validated with an Iron type.

Form for an Iron type. This is a form for a type that can be validated with an Iron type.

Type parameters

C

the type of the Iron type contraint

T

the base type of the Iron type

Value parameters

default

the default value for the Iron type

validator

the Iron type validator

widgetFactory

the widget factory

Attributes

given given_Form_LocalDate: Form[LocalDate]

Form for a LocalDate

Form for a LocalDate

Render a date picker. // FIXME should be able to set the format

Attributes

given given_Form_Long: Form[Long]

Form for an Long.

Form for an Long.

Attributes

given given_Form_Nothing: Form[Nothing]

Form for a Nothing, not sure it is still really needed :-/

Form for a Nothing, not sure it is still really needed :-/

Attributes

Form for to a string, aka without validation.

Form for to a string, aka without validation.

Attributes

given listOfA[A, K](using fa: Form[A], idOf: A => K): Form[List[A]]

Form for a List[A]

Form for a List[A]

Value parameters

fa

the form for A

idOf

a function to get the id of an A, important for the split function.

Attributes

given optionOfA[A](using fa: Form[A], d: Defaultable[A]): Form[Option[A]]

Form for an Option[A]

Form for an Option[A]

Render with clear button if the value is Some, else render with a set new value button.

Value parameters

d

the default value for A

fa

the form for A

Attributes

Inherited givens

inline given autoDerived[A](using Of[A]): Form[A]

Attributes

Inherited from:
AutoDerivation