2021-08-20 23:52:22 +02:00
|
|
|
/**
|
|
|
|
* EGroupware eTemplate2 - Textbox widget (WebComponent)
|
|
|
|
*
|
|
|
|
* @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-26 17:20:41 +02:00
|
|
|
import {css, html} from "../../../../node_modules/@lion/core/index.js"
|
|
|
|
import {LionTextarea} from "../../../../node_modules/@lion/textarea/index.js"
|
2021-08-25 23:35:06 +02:00
|
|
|
import {Et2InputWidget} from "../Et2InputWidget/Et2InputWidget";
|
|
|
|
import {Et2Widget} from "../Et2Widget/Et2Widget";
|
2021-08-20 23:52:22 +02:00
|
|
|
|
|
|
|
|
2021-08-26 20:59:13 +02:00
|
|
|
export class Et2Textarea extends Et2InputWidget(LionTextarea)
|
2021-08-20 23:52:22 +02:00
|
|
|
{
|
|
|
|
static get styles()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
...super.styles,
|
|
|
|
css`
|
|
|
|
:host {
|
2021-08-21 00:11:59 +02:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2021-08-20 23:52:22 +02:00
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
`,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
static get properties()
|
|
|
|
{
|
|
|
|
return {
|
|
|
|
...super.properties,
|
|
|
|
/**
|
|
|
|
* Specify the width of the text area.
|
|
|
|
* If not set, it will expand to fill the space available.
|
|
|
|
*/
|
|
|
|
width: {type: String, reflect: true},
|
|
|
|
/**
|
|
|
|
* Specify the height of the text area.
|
|
|
|
* If not set, it will expand to fill the space available.
|
|
|
|
*/
|
|
|
|
height: {type: String, reflect: true},
|
|
|
|
onkeypress: Function,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
constructor()
|
|
|
|
{
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
connectedCallback()
|
|
|
|
{
|
|
|
|
super.connectedCallback();
|
|
|
|
}
|
|
|
|
|
|
|
|
set width(value)
|
|
|
|
{
|
|
|
|
if(this._inputNode)
|
|
|
|
{
|
|
|
|
this._inputNode.style.width = value;
|
|
|
|
}
|
|
|
|
this.resizeTextarea();
|
|
|
|
}
|
|
|
|
|
|
|
|
set height(value)
|
|
|
|
{
|
|
|
|
if(this._inputNode)
|
|
|
|
{
|
|
|
|
this._inputNode.style.height = value;
|
|
|
|
}
|
|
|
|
this.resizeTextarea();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
customElements.define("et2-textarea", Et2Textarea);
|