Form class
đ Descriptionâ
The Form
class defines a form for the Tripetto builder. It is derived from the Components.Card
class. You can use any of the following form controls (or make your own control with the Control
or DataControl
abstract classes):
Button
Checkbox
ColorPicker
DateTime
Dropdown
Email
Group
HTML
Notification
Numeric
Radiobutton
Spacer
Static
Text
đ constructor
â
Creates a new Form
instance.
Signatureâ
constructor(properties: IFormProperties): Form
Parametersâ
Name | Type | Optional | Description |
---|---|---|---|
properties | IFormProperties | No | Specifies the form properties. |
Return valueâ
Returns a reference to the new Form
instance.
đ Staticsâ
đˇī¸ style
â
Contains the global default style for the form.
Typeâ
đī¸ Fieldsâ
đˇī¸ count
â
Retrieves the number of controls in the form.
Typeâ
number
đˇī¸ feature
â
Sets or retrieves a reference to the feature.
Typeâ
Feature
| undefined
đˇī¸ hasFocus
â
Retrieves if the form has focus.
Typeâ
boolean
đˇī¸ isActivated
â
Retrieves if the form is activated.
Typeâ
boolean
đˇī¸ isAwaiting
â
Retrieves if the form validation is awaiting.
Typeâ
boolean
đˇī¸ isDisabled
â
Sets or retrieves if the form is disabled.
Typeâ
boolean
đˇī¸ isFailed
â
Retrieves if the form validation has failed.
Typeâ
boolean
đˇī¸ isInvalid
â
Retrieves if the form validation is invalid.
Typeâ
boolean
đˇī¸ isObservable
â
Retrieves if the form is observable.
Typeâ
boolean
đˇī¸ isPassed
â
Retrieves if the form validation has passed.
Typeâ
boolean
đˇī¸ isVisible
â
Sets or retrieves if the form is visible.
Typeâ
boolean
đˇī¸ title
â
Sets or retrieves the title of the form.
Typeâ
string
đˇī¸ validation
â
Retrieves the validation state of the form.
Typeâ
"unknown" | "fail" | "invalid" | "pass" | "await"
âļī¸ Methodsâ
đ§ control
â
Retrieves the control at the specified index.
Signatureâ
control(index: number): Control | undefined
Parametersâ
Name | Type | Optional | Description |
---|---|---|---|
index | number | No | Specifies the control index where the first control in the form has index 0 . |
Return valueâ
Returns the Control
instance or undefined
if the control is not found.
đ§ controlWithReference
â
Retrieves the control with the specified reference.
Signatureâ
controlWithReference(reference: string): Control | undefined
Parametersâ
Name | Type | Optional | Description |
---|---|---|---|
reference | string | No | Specifies the control reference. |
Return valueâ
Returns the Control
instance or undefined
if the control is not found.
đ§ deactivate
â
Deactivates the form.
Signatureâ
deactivate(): this
Return valueâ
Returns a reference to the Form
instance to allow chaining.
đ§ each
â
Iterates through all controls in a form.
Signatureâ
each(fn: (control: Control) => void): void
Parametersâ
Name | Type | Optional | Description |
---|---|---|---|
fn | (control: Control ) => void | No | Contains the function which is invoked for each control. |
đ§ focus
â
Sets focus to the first or last control in the form.
Signatureâ
focus(to?: "first" | "last"): boolean
Parametersâ
Name | Type | Optional | Description |
---|---|---|---|
to | "first" | "last" | Yes | Specifies if the focus is set to the first or last control (default is first ). |
Return valueâ
Returns true
if a control captured focus.
đ§ focusTo
â
Sets the focus to the previous or next control.
Signatureâ
focusTo(to: "previous" | "next"): boolean
Parametersâ
Name | Type | Optional | Description |
---|---|---|---|
to | "previous" | "next" | No | Specifies if the focus is set to the previous or next control. |
Return valueâ
Returns true
if the focus is shifted.
đ§ hide
â
Hides the form.
Signatureâ
hide(): this
Return valueâ
Returns a reference to the Form
instance to allow chaining.
đ§ scrollIntoView
â
Scrolls the form into view.
Signatureâ
scrollIntoView(): this
Return valueâ
Returns a reference to the Form
instance to allow chaining.
đ§ show
â
Shows the form.
Signatureâ
show(): this
Return valueâ
Returns a reference to the Form
instance to allow chaining.
đ§ validate
â
Validates the form.
Form validation is performed automatically. You only need to call this method to force a validation cycle.
Signatureâ
validate(): this
Return valueâ
Returns a reference to the Form
instance to allow chaining.
đ§ visible
â
Shows or hides the form.
Signatureâ
visible(visible: boolean, scrollIntoView?: boolean): this
Parametersâ
Name | Type | Optional | Description |
---|---|---|---|
visible | boolean | No | Specifies if the form is visible. |
scrollIntoView | boolean | Yes | Specifies if the form should scroll into view. |
Return valueâ
Returns a reference to the Form
instance to allow chaining.
âī¸ Interfacesâ
đ IFormProperties
â
Describes the interface for declaring the form properties.
Type declarationâ
interface IFormProperties { controls: (Control | Group)[]; title?: string;Optional markdown?: boolean | IMarkdownOptions;Optional disabled?: boolean;Optional mode?: "normal" | "compact" | "both";Optional }
đˇī¸ controls
â
Specifies the controls for the form.
Typeâ
đˇī¸ disabled
â
Specifies if the form is disabled.
Typeâ
boolean
đˇī¸ markdown
â
Specifies if markdown is supported in the form title.
Typeâ
boolean | IMarkdownOptions
đˇī¸ mode
â
Specifies the supported modes for the form (default is both
).
Typeâ
"normal" | "compact" | "both"
đˇī¸ title
â
Specifies the form title.
Typeâ
string
đ IFormStyle
â
Describes the interface for the form styles.
Type declarationâ
interface IFormStyle {
/* Form appearance. */
appearance?: IStyles;
/* Form title. */
title?: IStyles;
/* Form disabled. */
disabled?: IStyles;
/* Form locked. */
locked?: IStyles;
/* Form required. */
required?: IStyles;
/* Form focus. */
focus?: IStyles;
/* Form validation passed. */
passed?: IStyles;
/* Form validation failed. */
failed?: IStyles;
/* Form validation awaiting. */
awaiting?: IStyles;
/* Form normal mode. */
normal?: IStyles;
/* Form Compact mode. */
compact?: IStyles;
/* Contains the number of indent pixels per level. */
indentation?: number;
/* Fused form. */
fused?: {
/* Fused form appearance. */
appearance?: IStyles;
/* Fused form title. */
title?: IStyles;
};
/* Control styles. */
controls?: {
[control: string]: IControlStyle;
};
}