Skip to main content

Card class

๐Ÿ“– Descriptionโ€‹

The Card class is an abstract class for creating feature cards for the Tripetto builder. Feature cards are used to define (groups of) UI elements that control a certain feature. For example, the Forms.Form card is used to define a collection of input controls.


๐Ÿ†• constructorโ€‹

Creates a new Card instance.

Signatureโ€‹

constructor(
modes?: Mode
): Card

Parametersโ€‹

NameTypeOptionalDescription
modesModeYesSpecifies the supported modes for the card (default is Both).

Return valueโ€‹

Returns a reference to the new Card instance.

๐Ÿ—ƒ๏ธ Fieldsโ€‹


๐Ÿท๏ธ contextโ€‹

Retrieves a reference to the card context.

Typeโ€‹

Element | undefined


๐Ÿท๏ธ elementโ€‹

Retrieves a reference to the card element.

Typeโ€‹

Element | undefined


๐Ÿท๏ธ featureโ€‹

Sets or retrieves a reference to the feature.

Typeโ€‹

Feature | undefined


๐Ÿท๏ธ isActivatedโ€‹

Retrieves if the card is activated.

Typeโ€‹

boolean


๐Ÿท๏ธ isAwaitingโ€‹

Retrieves if the card validation is awaiting.

Typeโ€‹

boolean


๐Ÿท๏ธ isDrawnโ€‹

Retrieves if the card is drawn.

Typeโ€‹

boolean


๐Ÿท๏ธ isEmptyโ€‹

Sets or retrieves if the card is empty (has no visible content).

Typeโ€‹

boolean


๐Ÿท๏ธ isFailedโ€‹

Retrieves if the card validation has failed.

Typeโ€‹

boolean


๐Ÿท๏ธ isFirstObservableโ€‹

Retrieves if this card is the first observable card.

Typeโ€‹

boolean


๐Ÿท๏ธ isInitializedโ€‹

Retrieves if the card is initialized.

Typeโ€‹

boolean


๐Ÿท๏ธ isInvalidโ€‹

Retrieves if the card validation is invalid.

Typeโ€‹

boolean


๐Ÿท๏ธ isLastObservableโ€‹

Retrieves if this card is the last observable card.

Typeโ€‹

boolean


๐Ÿท๏ธ isMeasurableโ€‹

Retrieves if the card is measurable.

Typeโ€‹

boolean


๐Ÿท๏ธ isMeasuredโ€‹

Retrieves if the card is measured.

Typeโ€‹

boolean


๐Ÿท๏ธ isModeCompactโ€‹

Retrieves if the compact mode is active.

Typeโ€‹

boolean


๐Ÿท๏ธ isModeNormalโ€‹

Retrieves if the normal mode is active.

Typeโ€‹

boolean


๐Ÿท๏ธ isObservableโ€‹

Retrieves if the card is observable.

Typeโ€‹

boolean


๐Ÿท๏ธ isPassedโ€‹

Retrieves if the card validation has passed.

Typeโ€‹

boolean


๐Ÿท๏ธ isReadyโ€‹

Retrieves if the card is ready.

Typeโ€‹

boolean


๐Ÿท๏ธ isVisibleโ€‹

Sets or retrieves if the card is visible.

Typeโ€‹

boolean


๐Ÿท๏ธ modeโ€‹

Retrieves the mode.

Typeโ€‹

Mode


๐Ÿท๏ธ modesโ€‹

Retrieves the supported modes for the card.

Typeโ€‹

Mode


๐Ÿท๏ธ positionโ€‹

Returns the position of the card.

Typeโ€‹

number


๐Ÿท๏ธ stylesheetโ€‹

Retrieves a reference to the stylesheet.

Typeโ€‹

Stylesheet


๐Ÿท๏ธ tailโ€‹

Returns the tail for the card.

Typeโ€‹

number


๐Ÿท๏ธ validationโ€‹

Retrieves the validation state of the card.

Typeโ€‹

"unknown" | "fail" | "invalid" | "pass" | "await"

โ–ถ๏ธ Methodsโ€‹


๐Ÿ”ง deactivateโ€‹

Deactivates the card.

Signatureโ€‹

deactivate(): this

Return valueโ€‹

Returns a reference to the Card instance to allow chaining.


๐Ÿ”ง destroyโ€‹

Destroys the card.

Signatureโ€‹

destroy(): void

๐Ÿ”ง focusโ€‹

Captures focus to the card.

Signatureโ€‹

focus(to?: "first" | "last"): boolean

Parametersโ€‹

NameTypeOptionalDescription
to"first" | "last"YesSpecifies if the focus is set to the first or last item in the card.

Return valueโ€‹

Returns true if the focus is captured.


๐Ÿ”ง hideโ€‹

Hides the card.

Signatureโ€‹

hide(): this

Return valueโ€‹

Returns a reference to the Card instance to allow chaining.


๐Ÿ”ง initializedโ€‹

Marks the card as initialized.

Signatureโ€‹

initialized(): void

๐Ÿ”ง measureโ€‹

Measures the size of the card.

Signatureโ€‹

measure(size?: number): boolean

Parametersโ€‹

NameTypeOptionalDescription
sizenumberYesSpecifies the size.

Return valueโ€‹

Returns true if the size is changed.


๐Ÿ”ง measuredโ€‹

Card is measured.

Signatureโ€‹

measured(): void

๐Ÿ”ง onActivateโ€‹

Invoked when the card is activated.

Signatureโ€‹

onActivate(): void

๐Ÿ”ง onDeactivateโ€‹

Invoked when the card is deactivated.

Signatureโ€‹

onDeactivate(): void

๐Ÿ”ง onDestroyโ€‹

Invoked when the card is destroyed.

Signatureโ€‹

onDestroy(): void

๐Ÿ”ง onDrawโ€‹

Draws the card.

Signatureโ€‹

onDraw(context: Element): void

Parametersโ€‹

NameTypeOptionalDescription
contextElementNoReference to the element to draw to.

๐Ÿ”ง onHideโ€‹

Invoked when the card is hidden.

Signatureโ€‹

onHide(): void

๐Ÿ”ง onInitโ€‹

Invoked when the card is initialized.

Signatureโ€‹

onInit(): void

Return valueโ€‹

Returns the initialization state. If true is returned this indicates the card is initialized. If you return false the system waits for a call to the Initialized method.


๐Ÿ”ง onMeasureโ€‹

Invoked when the card is measured. A measure correction in pixels can be supplied in the return value.

Signatureโ€‹

onMeasure(): number

Return valueโ€‹

Returns the measure correction for the card.


๐Ÿ”ง onModeโ€‹

Invoked when the mode of the card is changed.

Signatureโ€‹

onMode(): void

๐Ÿ”ง onPopโ€‹

Invoked when a card is popped.

Signatureโ€‹

onPop(): void

๐Ÿ”ง onReadyโ€‹

Invoked when the card is ready.

Signatureโ€‹

onReady(): void

๐Ÿ”ง onRequestAutoFocusโ€‹

Invoked when the card receives an auto-focus request.

Signatureโ€‹

onRequestAutoFocus(): void

Return valueโ€‹

Returns true if the card accepted the auto-focus request.


๐Ÿ”ง onRequestFocusโ€‹

Invoked when the card receives a focus request.

Signatureโ€‹

onRequestFocus(): void

Return valueโ€‹

Returns true if the card accepted the focus request.


๐Ÿ”ง onResizeโ€‹

Invoked when the card layer is resized.

Signatureโ€‹

onResize(): void

๐Ÿ”ง onResizedโ€‹

Invoked when the card itself is resized.

Signatureโ€‹

onResized(): void

๐Ÿ”ง onShowโ€‹

Invoked when the card is shown.

Signatureโ€‹

onShow(): void

๐Ÿ”ง onValidateโ€‹

Invoked when the card needs to be validated.

Signatureโ€‹

onValidate(callback: Callback): "unknown" | "fail" | "invalid" | "pass" | "await" | Callback

Parametersโ€‹

NameTypeOptionalDescription
callbackCallbackNoReference to the callback. Pass this object as return value to enable the asynchronous validation callback.

Return valueโ€‹

Returns the validation state.


๐Ÿ”ง onValidatedโ€‹

Invoked when the card is validated.

Signatureโ€‹

onValidated(): void

๐Ÿ”ง readyโ€‹

Marks the card as ready.

Signatureโ€‹

ready(): void

๐Ÿ”ง resizeโ€‹

Resizes the card.

Signatureโ€‹

resize(): void

๐Ÿ”ง scrollIntoViewโ€‹

Scrolls the card (or an specific element of the card) into view.

Signatureโ€‹

scrollIntoView(element?: Element, onlyWhenInvisible?: boolean): this

Parametersโ€‹

NameTypeOptionalDescription
elementElementYesSpecifies an optional element of the card to scroll into view.
onlyWhenInvisiblebooleanYesSpecifies if the scroll into view is only done when the element is invisible.

Return valueโ€‹

Returns a reference to the Card instance to allow chaining.


๐Ÿ”ง showโ€‹

Shows the card.

Signatureโ€‹

show(): this

Return valueโ€‹

Returns a reference to the Card instance to allow chaining.


๐Ÿ”ง validateโ€‹

Validates the card.

Signatureโ€‹

validate(): this

Return valueโ€‹

Returns a reference to the Card instance to allow chaining.


๐Ÿ”ง visibleโ€‹

Shows or hides the card.

Signatureโ€‹

visible(visible: boolean, scrollIntoView?: boolean): this

Parametersโ€‹

NameTypeOptionalDescription
visiblebooleanNoSpecifies if the card is visible.
scrollIntoViewbooleanYesSpecifies if the card should scroll into view.

Return valueโ€‹

Returns a reference to the Card instance to allow chaining.

๐Ÿ“‡ Enumsโ€‹


๐Ÿ”— Modeโ€‹

Describes the enum for the modes.

Type declarationโ€‹

enum Mode {
/* Card can only be used in normal mode. */
Normal = 1,

/* Card can only be used in compact mode. */
Compact = 2,

/* Card can be used in both modes. */
Both = 3,
}