new DroppablePlaceholder_A(parentopt, propsopt)
DroppablePlaceholder_A is a component that represents a droppable placeholder in the TComponents framework. It allows for the insertion of child components and manages their layout and styling.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
parent | HTMLElement | <optional> | null | The parent element to which this component will be attached. |
props | TComponents. | <optional> | {} | The properties for the droppable placeholder component. |
const droppablePlaceholder = new TComponents.DroppablePlaceholder_A(document.body, {
position: 'absolute',
width: 200,
height: 100,
zIndex: 1000,
border: '1px dashed #787878',
borderRadius: 4,
backgroundColor: 'rgba(245,245,245,0.3)',
});
droppablePlaceholder.render();Extends
Members
contentRoot :HTMLElement|null
Returns the native content root element of the layout placeholder component. The obtained value should be treated as a read-only property and should not be used for manipulation.
- HTMLElement |
null
const droppablePlaceholder = new TComponents.DroppablePlaceholder_A(document.body, {
position: 'absolute',
width: 200,
height: 100,
zIndex: 1000,
border: '1px dashed #787878',
borderRadius: 4,
backgroundColor: 'rgba(245,245,245,0.3)',
});
await droppablePlaceholder.render();
// Get the content root element
const contentRoot = droppablePlaceholder.contentRoot;enabled :boolean
Updates the enabled state of the layout placeholder component.
- boolean
- Overrides
const droppablePlaceholder = new TComponents.DroppablePlaceholder_A(document.body, {
position: 'absolute',
width: 200,
height: 100,
zIndex: 1000,
border: '1px dashed #787878',
borderRadius: 4,
backgroundColor: 'rgba(245,245,245,0.3)',
});
await droppablePlaceholder.render();
// Disable the droppable placeholder
droppablePlaceholder.enabled = false;Methods
appendChild(t, name) → {void}
Appends a child component or element to the current component.
| Name | Type | Description |
|---|---|---|
t | TComponents. | The child component or element to append. |
name | string | The name to associate with the child component. |
- Type:
- void
const droppablePlaceholder = new TComponents.DroppablePlaceholder_A(document.body, {
position: 'absolute',
width: 200,
height: 100,
zIndex: 1000,
border: '1px dashed #787878',
borderRadius: 4,
backgroundColor: 'rgba(245,245,245,0.3)',
});
await droppablePlaceholder.render();
// Append a new button component
const button = new TComponents.Button(null, { text: 'Click Me' });
droppablePlaceholder.appendChild(button, 'myButton');concatChildren(tArray, update) → {void}
Concatenates an array of child elements to the existing children. Note that this function should ideally be executed before component initialization.
| Name | Type | Description |
|---|---|---|
tArray | Array.<any> | The array of child elements to concatenate. |
update | boolean | Whether to update the component props after concatenation. |
- Type:
- void
const droppablePlaceholder = new TComponents.DroppablePlaceholder_A(document.body, {
position: 'absolute',
width: 200,
height: 100,
zIndex: 1000,
border: '1px dashed #787878',
borderRadius: 4,
backgroundColor: 'rgba(245,245,245,0.3)',
});
// Concatenate new children before rendering
droppablePlaceholder.concatChildren([new TComponents.Button(null, {})], true);
await droppablePlaceholder.render();concatContent(tArray, update) → {void}
Concatenates an array of content elements to the existing content children. Note that this function should ideally be executed before component initialization.
| Name | Type | Description |
|---|---|---|
tArray | Array.<any> | The array of content elements to concatenate. |
update | boolean | Whether to update the component props after concatenation. |
- Type:
- void
const droppablePlaceholder = new TComponents.DroppablePlaceholder_A(document.body, {
position: 'absolute',
width: 200,
height: 100,
zIndex: 1000,
border: '1px dashed #787878',
borderRadius: 4,
backgroundColor: 'rgba(245,245,245,0.3)',
});
// Concatenate new content before rendering
droppablePlaceholder.concatContent([document.createElement('div')], true);
await droppablePlaceholder.render();defaultProps() → {TComponents.DroppablePlaceholderProps}
Returns class properties default values.
- Overrides
Default property values.
mapComponents() → {object}
Returns an object containing the components mapped to their identifiers.
An object containing the components mapped to their identifiers.
- Type:
- object
markup() → {string}
Returns the HTML markup for the component.
- Overrides
The HTML markup for the component.
- Type:
- string
onInit() → {void}
Initializes the component by clearing the direct children and populating them from the props.
- Overrides
If initialization fails.
- Type
- Error
- Type:
- void
onRender() → {void}
Renders the component by setting up the container and attaching direct and slotted children. This method is called after the component has been initialized and its properties have been set.
- Overrides
If rendering fails.
- Type
- Error
- Type:
- void
removeChild(t) → {void}
Removes a child component or element from the current component.
| Name | Type | Description |
|---|---|---|
t | string | | The child component or element to remove, identified by its name or reference. |
- Type:
- void
const droppablePlaceholder = new TComponents.DroppablePlaceholder_A(document.body, {
position: 'absolute',
width: 200,
height: 100,
zIndex: 1000,
border: '1px dashed #787878',
borderRadius: 4,
backgroundColor: 'rgba(245,245,245,0.3)',
});
await droppablePlaceholder.render();
// Remove a child component
droppablePlaceholder.removeChild('myButton');(static) loadCssClassFromString(css) → {void}
Add css properties to the component
| Name | Type | Description |
|---|---|---|
css | string | The css string to be loaded into style tag |
- Type:
- void
TComponents.DroppablePlaceholder_A.loadCssClassFromString(`.tc-droppable-placeholder-a { background-color: red; }`);