fix only_app attribute not taking into account when setting value, which is in that case just an id

This commit is contained in:
ralf 2022-06-22 15:29:21 +02:00
parent 7f877082d2
commit 673e0b859c

View File

@ -301,7 +301,7 @@ export class Et2LinkEntry extends Et2InputWidget(FormControlMixin(ValidateMixin(
set value(val : LinkInfo | string | number)
{
let value : LinkInfo = {app: "", id: ""};
let value : LinkInfo = {app: this.only_app, id: ""};
if(typeof val === 'string' && val.length > 0)
{
@ -309,9 +309,16 @@ export class Et2LinkEntry extends Et2InputWidget(FormControlMixin(ValidateMixin(
{
val = val.replace(",", ":");
}
const vals = val.split(':');
value.app = vals[0];
value.id = vals[1];
if (val.indexOf(':') > 0)
{
const vals = val.split(':');
value.app = vals[0];
value.id = vals[1];
}
else
{
value.id = val;
}
}
else if(typeof val === "number" && val)
{
@ -361,4 +368,4 @@ export class Et2LinkEntryReadonly extends Et2Link
}
customElements.define("et2-link-entry_ro", Et2LinkEntryReadonly);
customElements.define("et2-link-entry_ro", Et2LinkEntryReadonly);