mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
Implement onlyEmail option for UrlEmailReadonly
This commit is contained in:
parent
0d60d3baf4
commit
3ecb093d35
@ -195,16 +195,16 @@ export class Et2EmailTag extends Et2Tag
|
|||||||
if(!this.onlyEmail && Et2EmailTag.email_cache[this.value])
|
if(!this.onlyEmail && Et2EmailTag.email_cache[this.value])
|
||||||
{
|
{
|
||||||
// Append current value as email, data may have work & home email in it
|
// Append current value as email, data may have work & home email in it
|
||||||
content = (Et2EmailTag.email_cache[this.value]?.n_fn || "") + " <" + (this.splitEmail(this.value)?.email || this.value) + ">"
|
content = (Et2EmailTag.email_cache[this.value]?.n_fn || "") + " <" + (Et2EmailTag.splitEmail(this.value)?.email || this.value) + ">"
|
||||||
}
|
}
|
||||||
if (this.onlyEmail)
|
if (this.onlyEmail)
|
||||||
{
|
{
|
||||||
const split = this.splitEmail(content);
|
const split = Et2EmailTag.splitEmail(content);
|
||||||
content = split.email || this.value;
|
content = split.email || this.value;
|
||||||
}
|
}
|
||||||
else if(!this.fullEmail)
|
else if(!this.fullEmail)
|
||||||
{
|
{
|
||||||
const split = this.splitEmail(content);
|
const split = Et2EmailTag.splitEmail(content);
|
||||||
content = split.name || split.email;
|
content = split.name || split.email;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
@ -264,7 +264,7 @@ export class Et2EmailTag extends Et2Tag
|
|||||||
*
|
*
|
||||||
* @return {name:string, email:string}
|
* @return {name:string, email:string}
|
||||||
*/
|
*/
|
||||||
public splitEmail(email_string) : { name : string, email : string }
|
public static splitEmail(email_string) : { name : string, email : string }
|
||||||
{
|
{
|
||||||
let split = {name: "", email: email_string};
|
let split = {name: "", email: email_string};
|
||||||
if(email_string && email_string.indexOf('<') !== -1)
|
if(email_string && email_string.indexOf('<') !== -1)
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
import {IsEmail} from "../Validators/IsEmail";
|
import {IsEmail} from "../Validators/IsEmail";
|
||||||
import {Et2UrlEmail} from "./Et2UrlEmail";
|
import {Et2UrlEmail} from "./Et2UrlEmail";
|
||||||
import {Et2UrlReadonly} from "./Et2UrlReadonly";
|
import {Et2UrlReadonly} from "./Et2UrlReadonly";
|
||||||
|
import {Et2EmailTag} from "../Et2Select/Tag/Et2EmailTag";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @customElement et2-url-email_ro
|
* @customElement et2-url-email_ro
|
||||||
@ -35,6 +36,13 @@ export class Et2UrlEmailReadonly extends Et2UrlReadonly
|
|||||||
contactPlus: {
|
contactPlus: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* set to true to always show just the email
|
||||||
|
* Mutually exclusive with fullEmail!
|
||||||
|
*/
|
||||||
|
onlyEmail: {
|
||||||
|
type: Boolean
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +53,7 @@ export class Et2UrlEmailReadonly extends Et2UrlReadonly
|
|||||||
if (!this.fullEmail && val && val.indexOf('<') !== -1)
|
if (!this.fullEmail && val && val.indexOf('<') !== -1)
|
||||||
{
|
{
|
||||||
const parts = val.split('<');
|
const parts = val.split('<');
|
||||||
if (parts[0])
|
if (parts[0] && !this.onlyEmail)
|
||||||
{
|
{
|
||||||
super.statustext = parts[1].substring(0, parts[1].length-1);
|
super.statustext = parts[1].substring(0, parts[1].length-1);
|
||||||
val = parts[0].trim();
|
val = parts[0].trim();
|
||||||
|
Loading…
Reference in New Issue
Block a user