From c26732a9137e97f12b152de7fefb7679beac1e5c Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 7 Dec 2022 15:04:22 -0700 Subject: [PATCH] Some more fixes for historylog widget - Fix options in proper format could be interpreted as sub-widgets - Fix numeric values --- api/js/etemplate/Et2Select/FindSelectOptions.ts | 6 +++++- api/js/etemplate/et2_widget_historylog.ts | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/Et2Select/FindSelectOptions.ts b/api/js/etemplate/Et2Select/FindSelectOptions.ts index 82d04a429c..977f8ddaf5 100644 --- a/api/js/etemplate/Et2Select/FindSelectOptions.ts +++ b/api/js/etemplate/Et2Select/FindSelectOptions.ts @@ -229,6 +229,10 @@ export function cleanSelectOptions(options : SelectOption[] | string[] | object) for(let key in options) { let option : any = options[key]; + if(typeof option === 'number') + { + option = "" + option; + } if(typeof option === 'string') { option = {label: option}; @@ -237,7 +241,7 @@ export function cleanSelectOptions(options : SelectOption[] | string[] | object) { 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); } } diff --git a/api/js/etemplate/et2_widget_historylog.ts b/api/js/etemplate/et2_widget_historylog.ts index cdcb92fea3..10f7e05f91 100644 --- a/api/js/etemplate/et2_widget_historylog.ts +++ b/api/js/etemplate/et2_widget_historylog.ts @@ -420,7 +420,8 @@ export class et2_historylog extends et2_valueWidget implements et2_IDataProvider { // Require widget to be a widget, to avoid invalid widgets // (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; break;