2021-08-10 23:02:52 +02:00
|
|
|
/**
|
|
|
|
* EGroupware eTemplate2 - Box widget
|
|
|
|
*
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
|
|
* @package etemplate
|
|
|
|
* @subpackage api
|
|
|
|
* @link https://www.egroupware.org
|
|
|
|
* @author Nathan Gray
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2021-08-24 22:52:09 +02:00
|
|
|
import {css, html, LitElement} from "../../../../node_modules/@lion/core/index.js";
|
2021-08-25 23:35:06 +02:00
|
|
|
import {Et2Widget} from "../Et2Widget/Et2Widget";
|
2021-08-10 23:02:52 +02:00
|
|
|
|
|
|
|
export class Et2Box extends Et2Widget(LitElement)
|
|
|
|
{
|
2021-08-13 23:26:18 +02:00
|
|
|
static get styles()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
css`
|
2021-08-10 23:02:52 +02:00
|
|
|
:host {
|
2021-08-13 23:26:18 +02:00
|
|
|
display: block;
|
|
|
|
width: 100%;
|
2021-08-10 23:02:52 +02:00
|
|
|
}
|
|
|
|
:host > div {
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: nowrap;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: stretch;
|
|
|
|
}
|
|
|
|
::slotted(*) {
|
|
|
|
/* CSS for child elements */
|
|
|
|
}`,
|
2021-08-13 23:26:18 +02:00
|
|
|
];
|
|
|
|
}
|
2021-08-10 23:02:52 +02:00
|
|
|
|
2021-08-13 23:26:18 +02:00
|
|
|
render()
|
|
|
|
{
|
|
|
|
return html`
|
2021-08-10 23:02:52 +02:00
|
|
|
<div class="et2_box" ${this.id ? html`id="${this.id}"` : ''}>
|
|
|
|
<slot><p>Empty box</p></slot>
|
|
|
|
</div> `;
|
2021-08-13 23:26:18 +02:00
|
|
|
}
|
2021-08-10 23:02:52 +02:00
|
|
|
|
2021-08-19 01:41:23 +02:00
|
|
|
set_label(new_label)
|
|
|
|
{
|
|
|
|
// Boxes don't have labels
|
|
|
|
}
|
|
|
|
|
|
|
|
_createNamespace() : boolean
|
2021-08-13 23:26:18 +02:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2021-08-10 23:02:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
customElements.define("et2-box", Et2Box);
|
|
|
|
|
|
|
|
export class Et2HBox extends Et2Box
|
|
|
|
{
|
2021-08-13 23:26:18 +02:00
|
|
|
static get styles()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
...super.styles,
|
|
|
|
css`
|
2021-08-10 23:02:52 +02:00
|
|
|
:host > div {
|
|
|
|
flex-direction: row;
|
|
|
|
}`
|
2021-08-13 23:26:18 +02:00
|
|
|
];
|
|
|
|
}
|
2021-08-10 23:02:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
customElements.define("et2-hbox", Et2HBox);
|
|
|
|
|
|
|
|
export class Et2VBox extends Et2Box
|
|
|
|
{
|
2021-08-13 23:26:18 +02:00
|
|
|
static get styles()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
...super.styles,
|
|
|
|
css`
|
2021-08-10 23:02:52 +02:00
|
|
|
:host > div {
|
|
|
|
flex-direction: column;
|
|
|
|
}`
|
2021-08-13 23:26:18 +02:00
|
|
|
];
|
|
|
|
}
|
2021-08-10 23:02:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
customElements.define("et2-vbox", Et2VBox);
|