new View_A(parent, propsopt)
Base view component extending Component_A. Manages activation state, identification, icon, content, and child component mapping.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
parent | HTMLElement | The parent DOM element to which this view will attach. | ||
props | TComponents. | <optional> | {} | Initial properties for the view. |
- Source
const view = new TComponents.View_A(document.body, {
name: 'My View',
icon: 'view-icon',
content: 'This is the view content',
children: [new TComponents.Component_A()]
});Extends
Members
children :Array.<TComponents.Component_A>
List of child components in the view. The obtained value should be treated as a read-only property and should not be used for manipulation.
- Array.<TComponents.Component_A>
- Source
icon :string
Set the view's icon.
- string
- Source
const view = new TComponents.View_A(document.body, {
name: 'My View',
icon: 'view-icon',
content: 'This is the view content',
children: [new TComponents.Component_A()]
});
view.icon = 'new-icon';Methods
appendChild(t, nameopt) → {void}
Appends a new child (component or HTMLElement) to the container.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
t | TComponents. | The child instance to append. Can be a TComponent or a DOM element. | ||
name | string | <optional> | '' | Optional identifier for the child. If omitted and |
- Source
- Type:
- void
const view = new TComponents.View_A(null, {});
const child = new TComponents.Button(null, {});
view.appendChild(child, 'test');(protected) defaultProps() → {TComponents.ViewProps}
Default property values for the view. Overrides parent defaults; not including inherited props.
- Overrides
- Source
- Type:
- TComponents.
ViewProps
mapComponents() → {TComponents.ViewChildProps|object}
Map and return child components when the view is active. Iterates over child prop and returns Tcomponents or global instances.
- Source
Mapped child components by key.
- Type:
- TComponents.
ViewChildProps |object
(async) onInit() → {Promise.<void>}
Lifecycle method called when the component is initialized. Override to perform async setup logic.
- Overrides
- Source
- Type:
- Promise.<void>
onRender() → {void}
Lifecycle method called when rendering the component. Override to implement custom render behavior.
- Overrides
- Source
- Type:
- void
removeChild(value) → {void}
Removes a previously added child from the internal _newChildren registry.
| Name | Type | Description |
|---|---|---|
value | TComponents. | The child instance to remove. Must match the reference used in |
- Source
- Type:
- void
const view = new TComponents.View_A(null, {});
const child = new TComponents.Button(null, {});
view.appendChild(child, 'test');
view.removeChild(child);(static) createViewProps() → {TComponents.ViewProps}
Creates a default set of properties for a new view.
- Source
A fresh view props object.
- Type:
- TComponents.
ViewProps