mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 01:43:47 +01:00
Re-add feature where readonly URL widget with label uses the label as link text
This commit is contained in:
parent
fdd2d50fce
commit
e2cbbe9358
@ -8,10 +8,8 @@
|
||||
*/
|
||||
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
import {IsEmail} from "../Validators/IsEmail";
|
||||
import {Et2Description} from "../Et2Description/Et2Description";
|
||||
import {Et2UrlEmail} from "./Et2UrlEmail";
|
||||
import {css} from "@lion/core";
|
||||
import {css, TemplateResult} from "@lion/core";
|
||||
import {Et2Url} from "./Et2Url";
|
||||
|
||||
/**
|
||||
@ -37,7 +35,7 @@ export class Et2UrlReadonly extends Et2Description
|
||||
{
|
||||
attrs.onclick = () =>
|
||||
{
|
||||
if (this.value)
|
||||
if(this.value)
|
||||
{
|
||||
Et2Url.action(this.value);
|
||||
}
|
||||
@ -45,6 +43,22 @@ export class Et2UrlReadonly extends Et2Description
|
||||
}
|
||||
super.transformAttributes(attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override parent render so we can have the special case where label is used as link text
|
||||
*
|
||||
* @returns {TemplateResult<1>}
|
||||
* @protected
|
||||
*/
|
||||
protected render() : TemplateResult
|
||||
{
|
||||
if(this.label && !this.href && this.value)
|
||||
{
|
||||
// We have label & value, use label as link text
|
||||
return this.wrapLink(this.value, this.label);
|
||||
}
|
||||
return super.render();
|
||||
}
|
||||
}
|
||||
// @ts-ignore TypeScript is not recognizing that this is a LitElement
|
||||
customElements.define("et2-url_ro", Et2UrlReadonly);
|
@ -151,20 +151,17 @@ const Et2WidgetMixin = <T extends Constructor>(superClass : T) =>
|
||||
*/
|
||||
statustext: {
|
||||
type: String,
|
||||
reflect: true,
|
||||
translate: true
|
||||
reflect: true
|
||||
},
|
||||
|
||||
/**
|
||||
* The label of the widget
|
||||
* This is usually displayed in some way. It's also important for accessability.
|
||||
* This is defined in the parent somewhere, and re-defining it causes labels to disappear
|
||||
*
|
||||
label: {
|
||||
type: String,
|
||||
translate: true
|
||||
},
|
||||
*/
|
||||
label: {
|
||||
type: String
|
||||
},
|
||||
|
||||
onclick: {
|
||||
type: Function
|
||||
|
Loading…
Reference in New Issue
Block a user