diff --git a/api/js/etemplate/Et2Template/Et2Template.md b/api/js/etemplate/Et2Template/Et2Template.md new file mode 100644 index 0000000000..0caebbbc14 --- /dev/null +++ b/api/js/etemplate/Et2Template/Et2Template.md @@ -0,0 +1,11 @@ +The template displays a loader while it is loading the file, and is replaced with the actual content once all widgets +are ready. + +```html:preview + + +``` diff --git a/api/js/etemplate/Et2Template/Et2Template.styles.ts b/api/js/etemplate/Et2Template/Et2Template.styles.ts new file mode 100644 index 0000000000..0768eed56b --- /dev/null +++ b/api/js/etemplate/Et2Template/Et2Template.styles.ts @@ -0,0 +1,26 @@ +import {css} from 'lit'; + +export default css` + :host { + display: block; + position: relative; + height: 100%; + } + + .template--loading { + position: absolute; + width: 100%; + height: 100%; + min-height: 5rem; + display: flex; + justify-content: center; + align-items: center; + + background-color: var(--sl-panel-background-color); + color: var(--application-color, var(--primary-color)); + + z-index: var(--sl-z-index-dialog); + + font-size: 5rem; + } +`; \ No newline at end of file diff --git a/api/js/etemplate/Et2Template/Et2Template.ts b/api/js/etemplate/Et2Template/Et2Template.ts new file mode 100644 index 0000000000..1ecd182711 --- /dev/null +++ b/api/js/etemplate/Et2Template/Et2Template.ts @@ -0,0 +1,512 @@ +/** + * EGroupware eTemplate2 - Email WebComponent + * + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @package api + * @link https://www.egroupware.org + * @author Nathan Gray + */ +import {html, LitElement, nothing} from "lit"; +import {Et2Widget} from "../Et2Widget/Et2Widget"; +import shoelace from "../Styles/shoelace"; +import styles from "./Et2Template.styles"; +import {property} from "lit/decorators/property.js"; +import {customElement} from "lit/decorators/custom-element.js"; +import {etemplate2} from "../etemplate2"; +import {et2_loadXMLFromURL} from "../et2_core_xml"; +import {Et2InputWidgetInterface} from "../Et2InputWidget/Et2InputWidget"; +import {egw, IegwAppLocal} from "../../jsapi/egw_global"; +import {until} from "lit/directives/until.js"; +import {classMap} from "lit/directives/class-map.js"; +import {et2_arrayMgr} from "../et2_core_arrayMgr"; + +// @ts-ignore +/** + * @summary Load & populate a template (.xet file) + * + * + * @event load - Emitted when all elements are loaded + * + * @csspart template - Wrapper around template content + * + * @cssproperty [--height=5] - The maximum height of the widget, to limit size when you have a lot of addresses. Set by rows property, when set. + */ +@customElement("et2-template") +export class Et2Template extends Et2Widget(LitElement) +{ + + static get styles() + { + return [ + shoelace, + super.styles, + styles + ]; + } + + /** + * Name / ID of template with optional cache-buster ('?'+filemtime of template on server) + * Template can be ..