new LayoutInfobox(parent, propsopt)
LayoutInfobox is a component that displays a title and content in a box This class focuses on the specific properties of the LayoutInfobox component. Since it inherits from Accessor_A, all basic properties (e.g., height, width) are available but documented in the Accessor_A part.
| Name | Type | Attributes | Description |
|---|---|---|---|
parent | HTMLElement | HTMLE element that is going to be the parent of the component | |
props | TComponents. | <optional> | Props for the layout infobox component |
- Source
const layoutInfoboxInstance = new TComponents.LayoutInfobox(document.body, {
position: 'absolute',
zIndex: 1000,
title: 'Infobox Title'
});
// Render the component.
await layoutInfoboxInstance.render();Extends
Members
contentRoot :HTMLElement
Gets the content container instance. The obtained value should be treated as a read-only property and should not be used for manipulation.
- HTMLElement
- Source
const layoutInfoboxInstance = new TComponents.LayoutInfobox(document.body, {
position: 'absolute',
zIndex: 1000,
title: 'Infobox Title'
});
// Render the component.
await layoutInfoboxInstance.render();
const contentContainer = layoutInfoboxInstance.contentRoot;
console.log(contentContainer);title :string
Sets the title of the infobox.
- string
- Source
const layoutInfoboxInstance = new TComponents.LayoutInfobox(document.body, {
position: 'absolute',
zIndex: 1000,
title: 'Infobox Title'
});
// Render the component.
await layoutInfoboxInstance.render();
layoutInfoboxInstance.title = 'New Infobox Title';useBorder :boolean
Sets the border usage state.
- boolean
- Source
const layoutInfoboxInstance = new TComponents.LayoutInfobox(document.body, {
position: 'absolute',
zIndex: 1000,
title: 'Infobox Title'
});
// Render the component.
await layoutInfoboxInstance.render();
layoutInfoboxInstance.useBorder = false;useTitle :boolean
Sets the title usage state.
- boolean
- Source
const layoutInfoboxInstance = new TComponents.LayoutInfobox(document.body, {
position: 'absolute',
zIndex: 1000,
title: 'Infobox Title'
});
// Render the component.
await layoutInfoboxInstance.render();
layoutInfoboxInstance.useTitle = false;Methods
appendChild(t, name) → {void}
Appends a child component to the current component. If the child is a TComponent, it will be rendered and attached to the content root.
| Name | Type | Description |
|---|---|---|
t | TComponents. | The child component instance to be added. |
name | string | The name of the child component to be appended. |
- Source
If the
tparameter is not a valid object.- Type
- Error
- Type:
- void
const layoutInfoboxInstance = new TComponents.LayoutInfobox(document.body, {
position: 'absolute',
zIndex: 1000,
title: 'Infobox Title'
});
// Render the component.
await layoutInfoboxInstance.render();
// Create a button component.
const childComponent = new TComponents.Button(null, {});
layoutInfoboxInstance.appendChild(childComponent, 'childComponentName');createEmptyContainer(props) → {TComponents.Container_A}
Creates an empty container.
| Name | Type | Description |
|---|---|---|
props | any | Properties for the container. |
- Deprecated
- This API is going to be deprecated and is not recommended for future use.
- Source
The created container.
- Type:
- TComponents.
Container_A
const layoutInfoboxInstance = new TComponents.LayoutInfobox(document.body, {
position: 'absolute',
zIndex: 1000,
title: 'Infobox Title'
});
// Render the component.
await layoutInfoboxInstance.render();
const emptyContainer = layoutInfoboxInstance.createEmptyContainer({
children: ['child1-uuid-xxxxx']
});
console.log(emptyContainer);(protected) defaultProps() → {TComponents.LayoutInfoboxProps}
Returns the default values of class properties (excluding parent properties).
- Overrides
- Source
getContentStyle() → {string}
Gets the CSS text for the content style.
- Source
The CSS text for the content style.
- Type:
- string
const layoutInfoboxInstance = new TComponents.LayoutInfobox(document.body, {
position: 'absolute',
zIndex: 1000,
title: 'Infobox Title'
});
// Render the component.
await layoutInfoboxInstance.render();
const contentStyle = layoutInfoboxInstance.getContentStyle();getTitleLayoutStyle() → {string}
Gets the CSS text for the title layout style.
- Source
The CSS text for the title layout style.
- Type:
- string
const layoutInfoboxInstance = new TComponents.LayoutInfobox(document.body, {
position: 'absolute',
zIndex: 1000,
title: 'Infobox Title'
});
// Render the component.
await layoutInfoboxInstance.render();
const titleLayoutStyle = layoutInfoboxInstance.getTitleLayoutStyle();getTitleStyle() → {string}
Gets the CSS text for the title style.
- Source
The CSS text for the title style.
- Type:
- string
const layoutInfoboxInstance = new TComponents.LayoutInfobox(document.body, {
position: 'absolute',
zIndex: 1000,
title: 'Infobox Title'
});
// Render the component.
await layoutInfoboxInstance.render();
const titleStyle = layoutInfoboxInstance.getTitleStyle();getWrapperStyle() → {string}
Gets the CSS text for the wrapper style.
- Source
The CSS text for the wrapper style.
- Type:
- string
const layoutInfoboxInstance = new TComponents.LayoutInfobox(document.body, {
position: 'absolute',
zIndex: 1000,
title: 'Infobox Title'
});
// Render the component.
await layoutInfoboxInstance.render();
const wrapperStyle = layoutInfoboxInstance.getWrapperStyle();
console.log(wrapperStyle);mapComponents() → {object}
Maps the components.
- Source
The mapped components.
- Type:
- object
markup() → {string}
Generates the markup for the component.
- Overrides
- Source
The HTML markup for the component.
- Type:
- string
onInit() → {void}
Initializes the layoutInfobox
- Overrides
- Source
- Type:
- void
onRender() → {void}
Handles rendering of the component.
- Overrides
- Source
Throws an error if rendering fails.
- Type
- Error
- Type:
- void
(protected) processContent(props) → {TComponents.Container_A}
Build and return a TComponent.Container_A mounted under the infobox content area.
| Name | Type | Description |
|---|---|---|
props | TComponents. | Properties for the container. |
- Source
The created container.
- Type:
- TComponents.
Container_A
removeChild(t) → {void}
Removes a child component from the current component. It can remove the child either by name (if t is a string) or by component instance (if t is an object with a compId). After removing the child, the method updates the child property by calling mapComponents() and triggers a re-render of the component.
| Name | Type | Description |
|---|---|---|
t | string | | The child component to remove. It can be either:
|
- Source
If the
tparameter is neither a string nor an object with acompId.- Type
- Error
- Type:
- void
layoutInfoboxInstance.removeChild('childComponent'); // Removes by name
layoutInfoboxInstance.removeChild(someChildInstance); // Removes by component instance(static) loadCssClassFromString(css)
Add css properties to the component
| Name | Type | Description |
|---|---|---|
css | string | The css string to be loaded into style tag |
- Source
TComponents.LayoutInfobox.loadCssClassFromString(`
.tc-layout-infobox {
height: 100%;
width: 100%;
}`
);