Docs: Get avatar widget in list, remove Et2 prefix from widget names

This commit is contained in:
nathan 2023-09-27 14:29:19 -06:00
parent db99c1bb2c
commit 2b66ca8ba6
4 changed files with 9 additions and 8 deletions

View File

@ -10,7 +10,6 @@
import {Et2Widget} from "../Et2Widget/Et2Widget";
import {css} from "lit";
import {SlotMixin} from "@lion/core";
import {SlAvatar} from "@shoelace-style/shoelace";
import {et2_IDetachedDOM} from "../et2_core_interfaces";
import {egw} from "../../jsapi/egw_global";
@ -19,7 +18,7 @@ import {Et2Dialog} from "../Et2Dialog/Et2Dialog";
import "../../../../vendor/bower-asset/cropper/dist/cropper.min.js";
import {cropperStyles} from "./cropperStyles";
export class Et2Avatar extends Et2Widget(SlotMixin(SlAvatar)) implements et2_IDetachedDOM
export class Et2Avatar extends Et2Widget(SlAvatar) implements et2_IDetachedDOM
{
private _contactId;
private _delBtn: HTMLElement;
@ -435,7 +434,8 @@ export class Et2Avatar extends Et2Widget(SlotMixin(SlAvatar)) implements et2_IDe
}
}
}
customElements.define("et2-avatar", Et2Avatar as any);
customElements.define("et2-avatar", Et2Avatar);
// make et2_avatar publicly available as we need to call it from templates
{
window['et2_avatar'] = Et2Avatar;

View File

@ -126,4 +126,5 @@ export class Et2LAvatar extends Et2Avatar
return {background: bg, initials: text};
}
}
customElements.define("et2-lavatar", Et2LAvatar as any);
customElements.define("et2-lavatar", Et2LAvatar);

View File

@ -25,7 +25,7 @@
{% for component in meta.components %}
<li>
{% if component.tagName %}
<a href="/components/{{ component.tagName | removeSlPrefix }}">
<a href="/components/{{ component.tagName }}">
{{ component.name | classNameToComponentName }}
</a>
{% else %}

View File

@ -130,7 +130,7 @@ module.exports = function (eleventyConfig)
eleventyConfig.addFilter('classNameToComponentName', className =>
{
let name = capitalCase(className.replace(/^Sl/, ''));
let name = capitalCase(className.replace(/^Et2/, ''));
if (name === 'Qr Code')
{
name = 'QR Code';
@ -138,9 +138,9 @@ module.exports = function (eleventyConfig)
return name;
});
eleventyConfig.addFilter('removeSlPrefix', tagName =>
eleventyConfig.addFilter('removeEt2Prefix', tagName =>
{
return tagName.replace(/^sl-/, '');
return tagName.replace(/^et2-/, '');
});
//