mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-20 01:48:01 +02:00
Icon improvements:
- If Et2ButtonIcon image does not resolve to a egw image, treat it as a Shoelace icon name - Add egw images as an icon library for Shoelace eg: <sl-icon library="egw" name="5_day_view"/>
This commit is contained in:
parent
ffb8354728
commit
0775fd1a4e
@ -28,11 +28,15 @@ export class Et2ButtonIcon extends ButtonMixin(Et2InputWidget(SlIconButton))
|
|||||||
{
|
{
|
||||||
this.src = this.egw().image(new_image);
|
this.src = this.egw().image(new_image);
|
||||||
}
|
}
|
||||||
|
if(new_image && !this.src)
|
||||||
|
{
|
||||||
|
this.name = new_image;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get image()
|
get image()
|
||||||
{
|
{
|
||||||
return this.src;
|
return this.src || this.name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,13 +4,21 @@ import {css} from "lit";
|
|||||||
import {registerIconLibrary} from '@shoelace-style/shoelace/dist/utilities/icon-library.js';
|
import {registerIconLibrary} from '@shoelace-style/shoelace/dist/utilities/icon-library.js';
|
||||||
import {egw} from "../../jsapi/egw_global";
|
import {egw} from "../../jsapi/egw_global";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This makes sure the built-in icons can be found
|
* Here is the common overrides and customisations for Shoelace
|
||||||
*/
|
*/
|
||||||
registerIconLibrary('default', {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register egw images as an icon library
|
||||||
|
* @example <sl-icon library="egw" name="infolog/navbar"/>
|
||||||
|
* @example <sl-icon library="egw" name="5_day_view"/>
|
||||||
|
*/
|
||||||
|
registerIconLibrary('egw', {
|
||||||
resolver: name =>
|
resolver: name =>
|
||||||
{
|
{
|
||||||
return typeof egw !== "undefined" ? `${egw.webserverUrl}/node_modules/@shoelace-style/shoelace/dist/assets/icons/${name}.svg` : ''
|
return typeof egw !== "undefined" ? (egw.image(name) || '') : ''
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user