Layout - ArrayTableFinalizer
Layout.ArrayTableFinalizerDefine a UI Table from a
Stream within a LayoutBuilder.Type parameters
| Name | Type |
|---|---|
Inputs | extends Record = Record |
T | extends ArrayType = ArrayType |
Fields | extends Record = Record |
Layout
boolean
▸ boolean(name, def):
ArrayTableFinalizer<Inputs, T, Fields & { [K in string]: ColumnType }>
Create a
BooleanType column in the TableBuilder within a LayoutBuilder.Type parameters
| Name | Type |
|---|---|
Name | extends string |
V | extends BooleanType |
Parameters
| Name | Type | Description |
|---|---|---|
name | Name extends keyof Fields ? never : Name | the display name for the column |
def | (fields: ArrayToFields) => Variable | the definition of the column |
Returns
ArrayTableFinalizer<Inputs, T, Fields & { [K in string]: ColumnType }>
Example
// use a ArrayType stream
const stream = Stream(
"My Stream",
ArrayType(
StructType({
string: StringType,
date: DateTimeType,
})
)
);
// create a table in a layout
const layout = new LayoutBuilder("My Layout")
.table("My Table", builder => builder
.fromStream(stream)
.boolean("Boolean", fields => fields.boolean)
)
.toTemplate()
columns
▸ columns(def?):
ArrayTableFinalizer<Inputs, T, Fields & { [K in string | number | symbol]: ColumnType } | { [K in string | number | symbol]: ColumnType }>
Create multiple value columns in the
TableBuilder within a LayoutBuilder.Type parameters
| Name | Type |
|---|---|
S | extends Record<string, (fields: ArrayToFields) => Variable> |
Parameters
| Name | Type |
|---|---|
def? | S |
Returns
ArrayTableFinalizer<Inputs, T, Fields & { [K in string | number | symbol]: ColumnType } | { [K in string | number | symbol]: ColumnType }>
Example
// use a DictType stream
const stream = Stream(
"My Stream",
ArrayType(
StructType({
string: StringType,
date: DateTimeType,
float: FloatType,
integer: IntegerType,
boolean: BooleanType,
struct: Nullable(StructType({
string: Nullable(StringType),
date: DateTimeType,
float: FloatType,
integer: Nullable(IntegerType),
boolean: Nullable(BooleanType),
array: Nullable(ArrayType(FloatType)),
struct: Nullable(
StructType({
string: Nullable(StringType),
date: DateTimeType,
float: FloatType,
integer: Nullable(IntegerType),
boolean: Nullable(BooleanType),
})),
})),
})
)
);
// create a table with all columns
const layout = new LayoutBuilder("My Layout")
.table("My Table", builder => builder
.fromStream(stream)
.columns()
)
.toTemplate()
// create a table with some columns
const layout2 = new LayoutBuilder("My Layout")
.table("My Table", builder => builder
.fromStream(stream)
.columns({
"Date": (fields) => fields.date,
"Integer": (fields) => fields.integer,
"Float": (fields) => fields.float,
"String": (fields) => fields.string,
"Boolean": (fields) => fields.boolean,
"Array": (fields) => fields.array,
"Struct": (fields) => fields.struct
})
)
.toTemplate()
date
▸ date(name, def):
ArrayTableFinalizer<Inputs, T, Fields & { [K in string]: ColumnType }>
Create a
DateTimeType column in the TableBuilder within a LayoutBuilder.Type parameters
| Name | Type |
|---|---|
Name | extends string |
V | extends DateTimeType |
Parameters
| Name | Type | Description |
|---|---|---|
name | Name extends keyof Fields ? never : Name | the display name for the column |
def | (fields: ArrayToFields) => Variable | the definition of the column |
Returns
ArrayTableFinalizer<Inputs, T, Fields & { [K in string]: ColumnType }>
Example
// use a ArrayType stream
const stream = Stream(
"My Stream",
ArrayType(
StructType({
string: StringType,
date: DateTimeType,
})
)
);
// create a table in a layout
const layout = new LayoutBuilder("My Layout")
.table("My Table", builder => builder
.fromStream(stream)
.date("Date", fields => fields.date)
)
.toTemplate()
float
▸ float(name, def):
ArrayTableFinalizer<Inputs, T, Fields & { [K in string]: ColumnType }>
Create a
FloatType column in the TableBuilder within a LayoutBuilder.Type parameters
| Name | Type |
|---|---|
Name | extends string |
V | extends FloatType |
Parameters
| Name | Type | Description |
|---|---|---|
name | Name extends keyof Fields ? never : Name | the display name for the column |
def | (fields: ArrayToFields) => Variable | the definition of the column |
Returns
ArrayTableFinalizer<Inputs, T, Fields & { [K in string]: ColumnType }>
Example
// use a ArrayType stream
const stream = Stream(
"My Stream",
ArrayType(
StructType({
string: StringType,
date: DateTimeType,
})
)
);
// create a table in a layout
const layout = new LayoutBuilder("My Layout")
.table("My Table", builder => builder
.fromStream(stream)
.float("Float", fields => fields.float)
)
.toTemplate()
integer
▸ integer(name, def):
ArrayTableFinalizer<Inputs, T, Fields & { [K in string]: ColumnType }>
Create a
IntegerType column in the TableBuilder within a LayoutBuilder.Type parameters
| Name | Type |
|---|---|
Name | extends string |
V | extends IntegerType |
Parameters
| Name | Type | Description |
|---|---|---|
name | Name extends keyof Fields ? never : Name | the display name for the column |
def | (fields: ArrayToFields) => Variable | the definition of the column |
Returns
ArrayTableFinalizer<Inputs, T, Fields & { [K in string]: ColumnType }>
Example
// use a ArrayType stream
const stream = Stream(
"My Stream",
ArrayType(
StructType({
string: StringType,
date: DateTimeType,
})
)
);
// create a table in a layout
const layout = new LayoutBuilder("My Layout")
.table("My Table", builder => builder
.fromStream(stream)
.integer("Integer", fields => fields.integer)
)
.toTemplate()
set
▸ set(name, def):
ArrayTableFinalizer<Inputs, T, Fields & { [K in string]: ColumnType }>
Create a
SetType column in the TableBuilder within a LayoutBuilder.Type parameters
| Name | Type |
|---|---|
Name | extends string |
V | extends SetType |
Parameters
| Name | Type | Description |
|---|---|---|
name | Name extends keyof Fields ? never : Name | the display name for the column * |
def | (fields: ArrayToFields) => Variable | the definition of the column |
Returns
ArrayTableFinalizer<Inputs, T, Fields & { [K in string]: ColumnType }>
Example
// use a ArrayType stream
const stream = Stream(
"My Stream",
ArrayType(
StructType({
string: StringType,
set: SetType(StringType),
})
)
);
// create a table in a layout
const layout = new LayoutBuilder("My Layout")
.table("My Table", builder => builder
.fromStream(stream)
.set("Set", fields => fields.set)
)
.toTemplate()
showKey
▸ showKey(label):
ArrayTableFinalizer<Inputs, T, Fields & { [K in string]: ColumnType }>
Define if the
Stream key should be visible in the TableBuilder within a LayoutBuilder.Type parameters
| Name | Type |
|---|---|
Name | extends string |
Parameters
| Name | Type |
|---|---|
label | Name |
Returns
ArrayTableFinalizer<Inputs, T, Fields & { [K in string]: ColumnType }>
Example
// use a ArrayType stream
const stream = Stream(
"My Stream",
ArrayType(
StructType({
string: StringType,
date: DateTimeType,
})
)
);
// create a table in a layout
const layout = new LayoutBuilder("My Layout")
.table("My Table", builder => builder
.fromStream(stream)
.date("Date", fields => fields.date)
.string("String", fields => fields.string)
.showKey("Key")
)
.toTemplate()
string
▸ string(name, def):
ArrayTableFinalizer<Inputs, T, Fields & { [K in string]: ColumnType }>
Create a
StringType column in the TableBuilder within a LayoutBuilder.Type parameters
| Name | Type |
|---|---|
Name | extends string |
V | extends StringType |
Parameters
| Name | Type | Description |
|---|---|---|
name | Name extends keyof Fields ? never : Name | the display name for the column |
def | (fields: ArrayToFields) => Variable | the definition of the column |
Returns
ArrayTableFinalizer<Inputs, T, Fields & { [K in string]: ColumnType }>
Example
// use a ArrayType stream
const stream = Stream(
"My Stream",
ArrayType(
StructType({
string: StringType,
date: DateTimeType,
})
)
);
// create a table in a layout
const layout = new LayoutBuilder("My Layout")
.table("My Table", builder => builder
.fromStream(stream)
.string("String", fields => fields.string)
)
.toTemplate()