Skip to content

Screen

For each Screen, Lowgile generates a Screen definition. You reach it as This.$Screens.<ScreenName> to build the Screen’s URL, open it as a dialog, or pass it to Sys.Screen functions such as navigateToScreen().

Availability: Everywhere

This.$Screens.<ScreenName> is the Screen definition. Screens are grouped under the $Screens namespace: This.<ScreenName> does not work.

A Screen definition has the type ScreenDefinition<P, I, O>, built from the Screen’s variables:

  • P: the path parameters, the Screen variables that are passed in the URL.
  • I: the inputs, the Screen variables passed when the Screen is opened from code.
  • O: the Screen’s outputs, by name.

This.$Screens exists on both sides. On the server, the Screen itself can’t be shown: component is undefined and openAsDialog() throws an error.

getFullUrl(params: P): string

Returns the absolute URL that opens the Screen, with params as URL query parameters. The URL starts with the instance’s public URL (System.$Config.Environment.publicUrl). A Screen of another Module is addressed by its qualified name <ModuleId>.<ScreenName>.

ParameterTypeDescription
paramsPValues for the Screen’s path parameters. Pass {} if it has none. Parameters whose value is undefined or null are left out.

Returns: string · Availability: Everywhere

openAsDialog<X extends keyof O>(inputData: P & I, outputName: X, options?: ScreenDialogOptions): Promise<O[X]>

Opens the Screen in a dialog and waits until it closes. The dialog closes when the Screen emits the output outputName, and the returned promise resolves with that output’s value.

ParameterTypeDescription
inputDataP & IValues for the Screen’s path parameters and inputs.
outputNameXThe output that closes the dialog and whose value is returned.
optionsScreenDialogOptionsOptional. Size, position and behaviour of the dialog.

ScreenDialogOptions fields

FieldTypeRequiredDescription
disableClosebooleanOptionalIf true, the End user can’t close the dialog with the Escape key or by clicking outside it.
hasBackdropbooleanOptionalWhether a backdrop covers the page behind the dialog.
heightstringOptionalThe dialog’s height, as a CSS value such as '400px'.
widthstringOptionalThe dialog’s width, as a CSS value.
maxHeightstring | numberOptionalThe maximum height. A number is in pixels.
minHeightstring | numberOptionalThe minimum height. A number is in pixels.
maxWidthstring | numberOptionalThe maximum width. A number is in pixels.
minWidthstring | numberOptionalThe minimum width. A number is in pixels.
panelClassstring | string[]OptionalCSS classes to add to the dialog’s container.
position{ top?: string; bottom?: string; left?: string; right?: string }OptionalThe dialog’s position on the page, as CSS values.
const confirmed = await This.$Screens.ConfirmOrder.openAsDialog({ orderId: order.id }, 'confirmed', { width: '600px' })

Returns: Promise<O[X]> · Availability: Client

Note

If the End user closes the dialog without the Screen emitting outputName, for example with the Escape key, the promise resolves with undefined.

moduleId: string

The ID of the Module the Screen belongs to.

Type: string · Availability: Everywhere

boId: string

The Screen’s name.

Type: string · Availability: Everywhere

component: Class

The Angular component class that renders the Screen.

Type: Class · Availability: Client

Note

On the server, component is undefined, although it is declared in server-side code too.

interface ScreenDefinition<P, I, O extends Record<string, any> = Record<string, any>> {
moduleId: string
boId: string
component: Class
getFullUrl(params: P): string
openAsDialog<X extends keyof O>(inputData: P & I, outputName: X, options?: ScreenDialogOptions): Promise<O[X]>
}

The type of every entry of This.$Screens. Sys.Screen functions take a ScreenDefinition as their Screen parameter.

Availability: Everywhere