Skip to main content

Layout - ArrayTableFinalizer

Layout.ArrayTableFinalizer

Define a UI Table from a

Stream within a LayoutBuilder.

Type parameters

NameType
Inputsextends Record = Record
Textends ArrayType = ArrayType
Fieldsextends 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

NameType
Nameextends string
Vextends BooleanType

Parameters

NameTypeDescription
nameName extends keyof Fields ? never : Namethe display name for the column
def(fields: ArrayToFields) => Variablethe 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

NameType
Sextends Record<string, (fields: ArrayToFields) => Variable>

Parameters

NameType
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

NameType
Nameextends string
Vextends DateTimeType

Parameters

NameTypeDescription
nameName extends keyof Fields ? never : Namethe display name for the column
def(fields: ArrayToFields) => Variablethe 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

NameType
Nameextends string
Vextends FloatType

Parameters

NameTypeDescription
nameName extends keyof Fields ? never : Namethe display name for the column
def(fields: ArrayToFields) => Variablethe 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

NameType
Nameextends string
Vextends IntegerType

Parameters

NameTypeDescription
nameName extends keyof Fields ? never : Namethe display name for the column
def(fields: ArrayToFields) => Variablethe 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

NameType
Nameextends string
Vextends SetType

Parameters

NameTypeDescription
nameName extends keyof Fields ? never : Namethe display name for the column *
def(fields: ArrayToFields) => Variablethe 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

NameType
Nameextends string

Parameters

NameType
labelName

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

NameType
Nameextends string
Vextends StringType

Parameters

NameTypeDescription
nameName extends keyof Fields ? never : Namethe display name for the column
def(fields: ArrayToFields) => Variablethe 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()