Layout - FormFinalizer
Layout.FormFinalizerDefine a UI Form from a
Stream within a LayoutBuilder.Remarks
A Form is editable when defined from a writable
Stream, such as produced by a SourceBuilderType parameters
| Name | Type |
|---|---|
Inputs | extends Record = Record |
T | extends StructType = StructType |
Fields | extends Record = Record |
Layout
array
▸ array(name, value, def, config?):
FormFinalizer<Inputs, T, Fields & { [K in string]: InputType }>
Define a
ArrayType input in a FormBuilder within a LayoutBuilder.Type parameters
| Name | Type |
|---|---|
Name | extends string |
F | extends (fields: StructToFields) => Variable<ArrayType> |
Parameters
| Name | Type | Description |
|---|---|---|
name | Name extends keyof Fields ? never : Name | the display name for the field |
value | F | - |
def | (builder: FieldFinalizer<ReturnType["type"]["value"], Inputs, >) => FieldFinalizer<ReturnType["type"]["value"], Inputs, Record> | the definition of the field |
config? | Object | - |
config.hidden_detail? | boolean | - |
config.readonly? | boolean | (fields: StructToFields, inputs: Inputs) => EastFunction | - |
Returns
FormFinalizer<Inputs, T, Fields & { [K in string]: InputType }>
Example
// use a DictType stream
const stream = Stream(
"My Stream",
StructType({
array: ArrayType(StructType({
string: StringType
})),
})
);
// create a form in a layout
const layout = new LayoutBuilder("My Layout")
.table("My Table", builder => builder
.fromStream(stream)
.array("Array", fields => fields.array, builder =>
builder.string("String", fields => fields.string)
)
)
.toTemplate()
boolean
▸ boolean(name, def):
FormFinalizer<Inputs, T, Fields & { [K in string]: InputType }>
Define a
BooleanType input in a FormBuilder within a LayoutBuilder.Type parameters
| Name | Type |
|---|---|
Name | extends string |
Parameters
| Name | Type | Description |
|---|---|---|
name | Name extends keyof Fields ? never : Name | the display name for the form label |
def | Omit<{ background?: string | (fields: StructToFields) => EastFunction ; color?: string | (fields: StructToFields) => EastFunction ; display?: (fields: StructToFields, inputs: Inputs) => EastFunction ; hidden?: boolean ; hidden_detail?: boolean ; readonly?: boolean | (fields: StructToFields, inputs: Inputs) => EastFunction ; target?: boolean | (fields: StructToFields, inputs: Inputs) => EastFunction ; target_display?: (fields: StructToFields, inputs: Inputs) => EastFunction ; tooltip?: ValueTypeOf | (fields: StructToFields) => EastFunction ; value: (fields: StructToFields) => Variable }, "hidden"> | the definition of the form input |
Returns
FormFinalizer<Inputs, T, Fields & { [K in string]: InputType }>
Example
// use a StructType stream
const stream = Stream(
"My Stream",
StructType({
boolean: BooleanType,
}),
);
// create a form in a layout
const layout = new LayoutBuilder("My Layout")
.form("My Form", builder => builder
.fromStream(stream)
.boolean("Boolean", fields => fields.boolean)
)
.toTemplate()
date
▸ date(name, def):
FormFinalizer<Inputs, T, Fields & { [K in string]: InputType }>
Define a
DateTimeType input in a FormBuilder within a LayoutBuilder.Type parameters
| Name | Type |
|---|---|
Name | extends string |
Parameters
| Name | Type | Description |
|---|---|---|
name | Name extends keyof Fields ? never : Name | the display name for the form label |
def | Omit<{ background?: string | (fields: StructToFields) => EastFunction ; color?: string | (fields: StructToFields) => EastFunction ; display?: (fields: StructToFields, inputs: Inputs) => EastFunction ; hidden?: boolean ; hidden_detail?: boolean ; max?: Date | (fields: StructToFields, inputs: Inputs) => EastFunction ; min?: Date | (fields: StructToFields, inputs: Inputs) => EastFunction ; readonly?: boolean | (fields: StructToFields, inputs: Inputs) => EastFunction ; target?: Date | (fields: StructToFields, inputs: Inputs) => EastFunction ; target_display?: (fields: StructToFields, inputs: Inputs) => EastFunction ; tooltip?: ValueTypeOf | (fields: StructToFields) => EastFunction ; value: (fields: StructToFields) => Variable }, "hidden"> | the definition of the form input |
Returns
FormFinalizer<Inputs, T, Fields & { [K in string]: InputType }>
Example
// use a StructType stream
const stream = Stream(
"My Stream",
StructType({
date: DateTimeType,
}),
);
// create a form in a layout
const layout = new LayoutBuilder("My Layout")
.form("My Form", builder => builder
.fromStream(stream)
.date("Date", fields => fields.date)
)
.toTemplate()
dict
▸ dict(name, value, def, config?):
FormFinalizer<Inputs, T, Fields & { [K in string]: InputType }>
Define a
DictType input in a FormBuilder within a LayoutBuilder.Type parameters
| Name | Type |
|---|---|
Name | extends string |
F | extends (fields: StructToFields) => Variable<DictType> |
Parameters
| Name | Type | Description |
|---|---|---|
name | Name extends keyof Fields ? never : Name | the display name for the field |
value | F | - |
def | (builder: FieldFinalizer<ReturnType["type"]["value"]["value"], Inputs, >) => FieldFinalizer<ReturnType["type"]["value"]["value"], Inputs, Record> | the definition of the field |
config? | Object | - |
config.hidden_detail? | boolean | - |
config.readonly? | boolean | (fields: StructToFields, inputs: Inputs) => EastFunction | - |
Returns
FormFinalizer<Inputs, T, Fields & { [K in string]: InputType }>
Example
// use a DictType stream
const stream = Stream(
"My Stream",
StructType({
dict: DictType(
StringType,
StructType({
string: StringType
})
),
})
);
// create a form in a layout
const layout = new LayoutBuilder("My Layout")
.table("My Table", builder => builder
.fromStream(stream)
.dict("Array", fields => fields.dict, builder =>
builder.string("String", fields => fields.string)
)
)
.toTemplate()
disableUpdate
▸ disableUpdate():
FormFinalizer
Disable row update for the
TableBuilder within a LayoutBuilder.Returns
FormFinalizer
Remarks
only valid if the input stream is writable
Example
// use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
string: StringType,
date: DateTimeType,
})
)
);
// create a table in a layout
const layout = new LayoutBuilder("My Layout")
.form("My Table", builder => builder
.fromStream(stream)
.date("Date", fields => fields.date)
.string("String", fields => fields.string)
.disableUpdate()
)
.toTemplate()
float
▸ float(name, def):
FormFinalizer<Inputs, T, Fields & { [K in string]: InputType }>
Define a
FloatType input in a FormBuilder within a LayoutBuilder.Type parameters
| Name | Type |
|---|---|
Name | extends string |
Parameters
| Name | Type | Description |
|---|---|---|
name | Name extends keyof Fields ? never : Name | the display name for the form label |
def | Omit<{ background?: string | (fields: StructToFields) => EastFunction ; color?: string | (fields: StructToFields) => EastFunction ; display?: (fields: StructToFields, inputs: Inputs) => EastFunction ; hidden?: boolean ; hidden_detail?: boolean ; max?: number | (fields: StructToFields, inputs: Inputs) => EastFunction ; min?: number | (fields: StructToFields, inputs: Inputs) => EastFunction ; readonly?: boolean | (fields: StructToFields, inputs: Inputs) => EastFunction ; target?: number | (fields: StructToFields, inputs: Inputs) => EastFunction ; target_display?: (fields: StructToFields, inputs: Inputs) => EastFunction ; tooltip?: ValueTypeOf | (fields: StructToFields) => EastFunction ; value: (fields: StructToFields) => Variable }, "hidden"> | the definition of the form input |
Returns
FormFinalizer<Inputs, T, Fields & { [K in string]: InputType }>
Example
// use a StructType stream
const stream = Stream(
"My Stream",
StructType({
float: FloatType,
}),
);
// create a form in a layout
const layout = new LayoutBuilder("My Layout")
.form("My Form", builder => builder
.fromStream(stream)
.float("Float", fields => fields.float)
)
.toTemplate()
input
▸ input(config):
FormFinalizer<Inputs & { [K in string]: Variable }, T, Fields>
Add an additional named input
Stream to the Visual.Type parameters
| Name | Type |
|---|---|
Name | extends string |
I | extends EastType |
Parameters
| Name | Type | Description |
|---|---|---|
config | Object | the input stream and the resulting variable name |
config.name | Name extends "input" | keyof Inputs ? never : Name | The name of the input. * |
config.stream | Stream | The Stream to input. * |
Returns
FormFinalizer<Inputs & { [K in string]: Variable }, T, Fields>
a new
LayoutBuilderExample
// use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
string: StringType,
date: DateTimeType,
})
)
);
const value = Stream("Value", StringType);
// create a table in a layout
const layout = new LayoutBuilder("My Layout")
.form("My Table", builder => builder
.fromStream(stream)
.date("Date", fields => fields.date)
.input({ name: "value", stream: value })
.string("String", {
value: fields => fields.string,
target: (_fields, inputs) => inputs.value
)
)
.toTemplate()
integer
▸ integer(name, def):
FormFinalizer<Inputs, T, Fields & { [K in string]: InputType }>
Define a
IntegerType input in a FormBuilder within a LayoutBuilder.Type parameters
| Name | Type |
|---|---|
Name | extends string |
Parameters
| Name | Type | Description |
|---|---|---|
name | Name extends keyof Fields ? never : Name | the display name for the form label |
def | Omit<{ background?: string | (fields: StructToFields) => EastFunction ; color?: string | (fields: StructToFields) => EastFunction ; display?: (fields: StructToFields, inputs: Inputs) => EastFunction ; hidden?: boolean ; hidden_detail?: boolean ; max?: bigint | (fields: StructToFields, inputs: Inputs) => EastFunction ; min?: bigint | (fields: StructToFields, inputs: Inputs) => EastFunction ; readonly?: boolean | (fields: StructToFields, inputs: Inputs) => EastFunction ; target?: bigint | (fields: StructToFields, inputs: Inputs) => EastFunction ; target_display?: (fields: StructToFields, inputs: Inputs) => EastFunction ; tooltip?: ValueTypeOf | (fields: StructToFields) => EastFunction ; value: (fields: StructToFields) => Variable }, "hidden"> | the definition of the form input |
Returns
FormFinalizer<Inputs, T, Fields & { [K in string]: InputType }>
Example
// use a StructType stream
const stream = Stream(
"My Stream",
StructType({
integer: IntegerType,
}),
);
// create a form in a layout
const layout = new LayoutBuilder("My Layout")
.form("My Form", builder => builder
.fromStream(stream)
.integer("Integer", fields => fields.integer)
)
.toTemplate()
set
▸ set(name, def):
FormFinalizer<Inputs, T, Fields & { [K in string]: InputType }>
Define a
StringType input in a FormBuilder within a LayoutBuilder.Type parameters
| Name | Type |
|---|---|
Name | extends string |
Parameters
| Name | Type | Description |
|---|---|---|
name | Name extends keyof Fields ? never : Name | the display name for the form label |
def | Omit<{ background?: string | (fields: StructToFields) => EastFunction ; color?: string | (fields: StructToFields) => EastFunction ; display?: (fields: StructToFields, inputs: Inputs) => EastFunction ; hidden?: boolean ; hidden_detail?: boolean ; range?: Set | Map<string, Set> | (fields: StructToFields, inputs: Inputs) => EastFunction<SetType> | EastFunction<DictType<StringType, SetType>> ; readonly?: boolean | (fields: StructToFields, inputs: Inputs) => EastFunction ; target?: Set | (fields: StructToFields, inputs: Inputs) => EastFunction ; target_display?: (fields: StructToFields, inputs: Inputs) => EastFunction ; tooltip?: ValueTypeOf<PrimitiveType | SetType> | (fields: StructToFields) => EastFunction<PrimitiveType | SetType> ; value: (fields: StructToFields) => Variable }, "hidden"> | the definition of the form input |
Returns
FormFinalizer<Inputs, T, Fields & { [K in string]: InputType }>
Example
// use a StructType stream
const stream = Stream(
"My Stream",
StructType({
set: SetType(StringType),
}),
);
// create a form in a layout
const layout = new LayoutBuilder("My Layout")
.form("My Form", builder => builder
.fromStream(stream)
.set("Set", fields => fields.set)
)
.toTemplate()
string
▸ string(name, def):
FormFinalizer<Inputs, T, Fields & { [K in string]: InputType }>
Define a
StringType input in a FormBuilder within a LayoutBuilder.Type parameters
| Name | Type |
|---|---|
Name | extends string |
Parameters
| Name | Type | Description |
|---|---|---|
name | Name extends keyof Fields ? never : Name | the display name for the form label |
def | Omit<{ background?: string | (fields: StructToFields) => EastFunction ; color?: string | (fields: StructToFields) => EastFunction ; display?: (fields: StructToFields, inputs: Inputs) => EastFunction ; hidden?: boolean ; hidden_detail?: boolean ; range?: Set | Map<string, Set> | (fields: StructToFields, inputs: Inputs) => EastFunction<SetType> | EastFunction<DictType<StringType, SetType>> ; readonly?: boolean | (fields: StructToFields, inputs: Inputs) => EastFunction ; target?: string | (fields: StructToFields, inputs: Inputs) => EastFunction ; target_display?: (fields: StructToFields, inputs: Inputs) => EastFunction ; tooltip?: ValueTypeOf | (fields: StructToFields) => EastFunction ; value: (fields: StructToFields) => Variable }, "hidden"> | the definition of the form input |
Returns
FormFinalizer<Inputs, T, Fields & { [K in string]: InputType }>
Example
// use a StructType stream
const stream = Stream(
"My Stream",
StructType({
string: StringType,
}),
);
// create a form in a layout
const layout = new LayoutBuilder("My Layout")
.form("My Form", builder => builder
.fromStream(stream)
.string("String", fields => fields.string)
)
.toTemplate()