mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-27 02:14:45 +01:00
ad82ea8faf
- Added RowLimitedMixin to limit rows - when multiple=true tags take full width by default, but intelligently resize - No longer showing search icon - Move Et2EmailTag add / CRM button to left of remove button
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
// Export the Interface for TypeScript
|
|
import {LitElement} from "@lion/core";
|
|
|
|
type Constructor<T = {}> = new (...args : any[]) => T;
|
|
|
|
/**
|
|
* Mixin to support widgets that have a set number of rows.
|
|
* Whether that's a maximum or a fixed size, implementation is up to the widget.
|
|
* Set rows=0 to clear.
|
|
*
|
|
* To implement in a webcomponent set height or max-height based on the --rows CSS variable:
|
|
* max-height: calc(var(--rows, 5) * 1.3rem);
|
|
* @param {T} superclass
|
|
* @constructor
|
|
*/
|
|
export const RowLimitedMixin = <T extends Constructor<LitElement>>(superclass : T) =>
|
|
{
|
|
class RowLimit extends superclass
|
|
{
|
|
static get properties()
|
|
{
|
|
return {
|
|
...super.properties,
|
|
}
|
|
}
|
|
|
|
set rows(row_count : string | number)
|
|
{
|
|
if(isNaN(Number(row_count)) || !row_count)
|
|
{
|
|
this.style.removeProperty("--rows");
|
|
this.removeAttribute("rows");
|
|
}
|
|
else
|
|
{
|
|
this.style.setProperty("--rows", row_count);
|
|
this.setAttribute("rows", row_count)
|
|
}
|
|
}
|
|
|
|
get rows() : string | number
|
|
{
|
|
return this.style.getPropertyValue("--rows");
|
|
}
|
|
|
|
}
|
|
|
|
return RowLimit;// as unknown as superclass & T;
|
|
} |