TComponents. Page

new Page(parent, propsopt)

Page component that extends the base Component_A class. This component handles the layout and rendering of a page. This class focuses on the specific properties of the Page component. Since it inherits from Accessor_A, all basic properties (e.g., height, width) are available but documented in the Accessor_A part.

Parameters:
NameTypeAttributesDefaultDescription
parentHTMLElement

The parent HTML element that will contain the Page component.

propsTComponents.PageProps<optional>
{}

The properties to initialize the Page component.

Example
const page = new TComponents.Page(document.body,{
  position: 'absolute',
  zIndex: 1000,
  width: 200,
  height: 150,
  backgroundColor: 'blue',
})

// Render the component.
page.render();

Extends

Members

properties :TComponents.PageProps

Sets the properties of the Page component. Note that changing this property will not cause the component to refresh directly.

Example
const page = new TComponents.Page(document.body,{
  position: 'absolute',
  zIndex: 1000,
  width: 200,
  height: 150,
  backgroundColor: 'blue',
})

// Render the component.
page.render();

page.properties = {backgroundColor: 'red'};

Methods

appendChild(t)

Appends a child component to the Page.

Parameters:
NameTypeDescription
tTComponents.Component_A

The child component to be appended.

Example
const page = new TComponents.Page(document.body,{
  position: 'absolute',
  zIndex: 1000,
  width: 200,
  height: 150,
  backgroundColor: 'blue',
})

// Render the component.
page.render();

// Create a button
const button = new TComponents.Button(null, {text: 'Click me'});

page.appendChild(button);

(protected) defaultProps() → {TComponents.PageProps}

Returns the default values of class properties (excluding parent properties).

Returns:
Type: 
TComponents.PageProps

getCssText() → {string}

Generates the CSS text for the Page component based on its properties.

Returns:

The CSS text for the Page component.

Type: 
string

mapComponents() → {object}

Maps the child components of the Page.

Returns:
Type: 
object

markup() → {string}

Generates the HTML markup for the Page component.

Returns:

The HTML markup for the Page component.

Type: 
string

onInit() → {void}

Initializes the Page component. This method is called during the component's initialization phase.

Throws:

Throws an error if initializing fails.

Type
Error
Returns:
Type: 
void

onRender() → {void}

Renders the Page component. This method is responsible for cleaning up events and updating the DOM.

Throws:

Throws an error if rendering fails.

Type
Error
Returns:
Type: 
void

removeChild(t)

Removes a child component from the Page.

Parameters:
NameTypeDescription
tTComponents.Component_A

The child component to be removed.

Example
const page = new TComponents.Page(document.body,{ ... });

// Remove the button.
page.removeChild(button)