From 47f72375afef13df57d57b2193e15cc014e14f67 Mon Sep 17 00:00:00 2001 From: jkuehner Date: Wed, 30 Oct 2024 23:55:51 +0100 Subject: [PATCH] fixes --- src/PropertyGrid.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/PropertyGrid.ts b/src/PropertyGrid.ts index ed4e83a..645e63e 100644 --- a/src/PropertyGrid.ts +++ b/src/PropertyGrid.ts @@ -266,10 +266,10 @@ export class PropertyGrid extends BaseCustomWebComponentConstructorAppend { const pInfo = node.data.property; const ctl = await this.getEditorForType(pInfo, currentValue, pPath, e); if (ctl) { - if (pInfo.defaultValue && (ctl as HTMLInputElement).value == '' && !pInfo.nullable) { - (ctl as HTMLInputElement).placeholder = pInfo.defaultValue; - } else if (pInfo.defaultValue && (ctl as HTMLSelectElement).value == '' && !pInfo.nullable) { - (ctl as HTMLSelectElement).value = pInfo.defaultValue; + if (pInfo.defaultValue && ctl instanceof HTMLInputElement && ctl.value == '' && !pInfo.nullable) { + ctl.placeholder = pInfo.defaultValue; + } else if (pInfo.defaultValue && ctl instanceof HTMLSelectElement && ctl.value == '' && !pInfo.nullable) { + ctl.value = pInfo.defaultValue; } ctl.style.flexGrow = '1'; ctl.style.width = '100%';