mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-21 15:33:23 +01:00
Et2SwitchIcon & Et2ButtonToggle fixes
- use font-size for sizing - expose control as part for styling - let server-side treat as checkbox
This commit is contained in:
parent
42c869c70f
commit
e239f092e4
@ -24,7 +24,9 @@ export class Et2ButtonToggle extends Et2SwitchIcon
|
||||
}
|
||||
|
||||
sl-switch {
|
||||
--width: var(--height);
|
||||
font-size: inherit;
|
||||
--width: 1em;
|
||||
--height: 1em;
|
||||
}
|
||||
|
||||
sl-switch:not([checked]) slot[name="off"] {
|
||||
|
@ -16,6 +16,9 @@ import {SlSwitch} from "@shoelace-style/shoelace";
|
||||
* @cssproperty --height - The height of the switch.
|
||||
* @cssproperty --width - The width of the switch.
|
||||
* @cssproperty --indicator-color - The color of the selected image
|
||||
*
|
||||
* @csspart form-control-label The label's wrapper
|
||||
* @csspart control The control's wrapper
|
||||
*/
|
||||
@customElement("et2-switch-icon")
|
||||
export class Et2SwitchIcon extends Et2InputWidget(LitElement)
|
||||
@ -95,7 +98,14 @@ export class Et2SwitchIcon extends Et2InputWidget(LitElement)
|
||||
|
||||
set value(new_value : string | boolean)
|
||||
{
|
||||
this.switch.checked = !!new_value;
|
||||
if(this.switch)
|
||||
{
|
||||
this.switch.checked = !!new_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.updateComplete.then(() => this.value = new_value);
|
||||
}
|
||||
}
|
||||
|
||||
get value()
|
||||
@ -111,6 +121,7 @@ export class Et2SwitchIcon extends Et2InputWidget(LitElement)
|
||||
class="form-control__label">${this.label}
|
||||
</span>` : nothing}
|
||||
<span
|
||||
part="control"
|
||||
class=${classMap({
|
||||
"label": true,
|
||||
"on": this.checked,
|
||||
|
@ -132,4 +132,5 @@ class Checkbox extends Etemplate\Widget
|
||||
}
|
||||
|
||||
Etemplate\Widget::registerWidget(__NAMESPACE__ . '\\Checkbox', array('et2-checkbox', 'et2-radio', 'et2-switch',
|
||||
'et2-switch-icon', 'et2-button-toggle',
|
||||
'checkbox', 'radio'));
|
Loading…
Reference in New Issue
Block a user