Skip to main content

Layout - CalendarFinalizer

Layout.CalendarFinalizer

Define a UI Calendar from a

Stream within a LayoutBuilder.

Type parameters

NameType
Inputsextends Record = Record
Textends DictType = DictType

Layout

events

events(def):

CalendarFinalizer

Create an event in the

CalendarBuilder within a LayoutBuilder.

Parameters

NameTypeDescription
def(fields: TypeToFields, inputs: Inputs) => EastFunction<CalendarEventType | ArrayType | DictType>A function that takes an East Function describing the a CalendarEventType, or ArrayType or DictType containing one or more CalendarEventTypes The following properties are defined for a CalendarEventType:

Returns

CalendarFinalizer

Example

  // use a DictType stream
const stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
events: ArrayType(
StructType({
start: DateTimeType,
end: DateTimeType,
label: StringType,
})
)
event: StructType({
start: DateTimeType,
end: DateTimeType,
label: StringType,
})
})
)
);

// create a table in a layout
const layout = new LayoutBuilder("My Layout")
.calendar("calendar", builder =>
builder
.fromStream(stream)
.calendar()
.events((fields, inputs) => fields.events)
.events((fields, inputs) => fields.event)
)
.toTemplate()

input

input(config):

CalendarFinalizer<Inputs & { [K in string]: Variable }, T>

Add an additional named input

Stream to the Visual.

Type parameters

NameType
Nameextends string
Iextends EastType

Parameters

NameTypeDescription
configObjectthe input stream and the resulting variable name
config.nameName extends "input" | keyof Inputs ? never : NameThe name of the input. *
config.streamStreamThe Stream to input. *

Returns

CalendarFinalizer<Inputs & { [K in string]: Variable }, T>

a new

LayoutBuilder

Example

  // 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")
.table("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()