Some more fixes for historylog widget

- Fix options in proper format could be interpreted as sub-widgets
- Fix numeric values
This commit is contained in:
nathan 2022-12-07 15:04:22 -07:00
parent 12151139ff
commit c26732a913
2 changed files with 7 additions and 2 deletions

View File

@ -229,6 +229,10 @@ export function cleanSelectOptions(options : SelectOption[] | string[] | object)
for(let key in <any>options) for(let key in <any>options)
{ {
let option : any = options[key]; let option : any = options[key];
if(typeof option === 'number')
{
option = "" + option;
}
if(typeof option === 'string') if(typeof option === 'string')
{ {
option = {label: option}; option = {label: option};
@ -237,7 +241,7 @@ export function cleanSelectOptions(options : SelectOption[] | string[] | object)
{ {
option = {label: key + ""}; option = {label: key + ""};
} }
option.value = option.value??key.trim(); // link_search prefixes keys with one space option.value = option.value ?? key.trim(); // link_search prefixes keys with one space
fixed_options.push(option); fixed_options.push(option);
} }
} }

View File

@ -420,7 +420,8 @@ export class et2_historylog extends et2_valueWidget implements et2_IDataProvider
{ {
// Require widget to be a widget, to avoid invalid widgets // Require widget to be a widget, to avoid invalid widgets
// (and template, which is a widget and an infolog todo status) // (and template, which is a widget and an infolog todo status)
if(et2_registry[field[j]] && ['template'].indexOf(field[j]) < 0 || customElements.get(field[j]) || typeof field[j] == "object") if(et2_registry[field[j]] && ['template'].indexOf(field[j]) < 0 || customElements.get(field[j]) ||
typeof field[j] == "object" && typeof field[j].value == "undefined")
{ {
need_box = true; need_box = true;
break; break;