- Index
- »
- xeto
- »
- SpecChoice
type
SpecChoice
@Js
const mixin SpecChoice
Choice APIs for a specific choice spec via LibNamespace.choice
.
methods
isMaybe |
Return if the choice slot allows zero selections |
---|---|
isMultiChoice |
Return if the choice slot allows multiple selections |
selection |
Return single choice selection considering validation rules. |
selections |
Return all choice selections the given instance implements. |
spec |
Spec for this choice - might be slot or choice type |
type |
Choice type for the spec |
Slot Details
isMaybe
abstract Bool isMaybe()
Return if the choice slot allows zero selections
isMultiChoice
abstract Bool isMultiChoice()
Return if the choice slot allows multiple selections
selection
selections
abstract Spec[] selections(Dict instance, Bool checked := true)
Return all choice selections the given instance implements.
- one selection => return list of one
- zero selections + isMaybe is true => return empty list
- zero selections + isMaybe is false + checked is false => return empty list
- zero selections + isMaybe is false + checked is true => raise exception
- multiple selections + isMultiChoice is false + checked is false => return all
- multiple selections + isMultiChoice is false + checked is true => raise exception
- multiple selections + isMultiChoice is true + checked is true => return all
spec
abstract Spec spec()
Spec for this choice - might be slot or choice type
type
abstract Spec type()
Choice type for the spec