From 5295c6fc6d89897a8e7bb968cd710732eb47f6d1 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Thu, 4 Jan 2024 16:00:26 +0000 Subject: [PATCH] Property Editor: Number - set numeric value This was setting the value as a `string`, which would cause issues when used in certain scenarios, e.g. MNTP min/max configuration, the value would assumed to be numeric, but it'd be a string, so conditions like `max === 1` would be false, as it'd be `"1"` instead. Ensuring the value is a `number` before the "property-value-change" event is sent appears to resolve this issue. --- .../uis/number/property-editor-ui-number.element.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/number/property-editor-ui-number.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/number/property-editor-ui-number.element.ts index b7c369276c..548c303821 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/number/property-editor-ui-number.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/number/property-editor-ui-number.element.ts @@ -6,8 +6,8 @@ import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/ @customElement('umb-property-editor-ui-number') export class UmbPropertyEditorUINumberElement extends UmbLitElement implements UmbPropertyEditorUiElement { - @property() - value = ''; + @property({ type: Number }) + value: undefined | number = undefined; @state() private _max?: number; @@ -26,7 +26,7 @@ export class UmbPropertyEditorUINumberElement extends UmbLitElement implements U } private onInput(e: InputEvent) { - this.value = (e.target as HTMLInputElement).value; + this.value = Number((e.target as HTMLInputElement).value); this.dispatchEvent(new CustomEvent('property-value-change')); }