Skip to content

Commit 04918ec

Browse files
Luuk1983Luuk Peters
andauthored
Slider property editor: Fix for preset value handling of enableRange (#20772)
Fix config value access in UmbSliderPropertyValuePreset Updated the `UmbSliderPropertyValuePreset` class to ensure the `.value` property is accessed for configuration items. This change improves the accuracy of retrieving `enableRange`, `min`, `max`, and `step` values, addressing potential bugs in value processing. Co-authored-by: Luuk Peters <Luuk.Peters@proudnerds.com>
1 parent aae316e commit 04918ec

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Umbraco.Web.UI.Client/src/packages/property-editors/slider/slider-property-value-preset.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ export class UmbSliderPropertyValuePreset
66
implements UmbPropertyValuePreset<UmbSliderPropertyEditorUiValue, UmbPropertyEditorConfig>
77
{
88
async processValue(value: undefined | UmbSliderPropertyEditorUiValue, config: UmbPropertyEditorConfig) {
9-
const enableRange = Boolean(config.find((x) => x.alias === 'enableRange') ?? false);
9+
const enableRange = Boolean(config.find((x) => x.alias === 'enableRange')?.value ?? false);
1010

1111
/*
12-
const min = Number(config.find((x) => x.alias === 'minVal') ?? 0);
13-
const max = Number(config.find((x) => x.alias === 'maxVal') ?? 100);
12+
const min = Number(config.find((x) => x.alias === 'minVal')?.value ?? 0);
13+
const max = Number(config.find((x) => x.alias === 'maxVal')?.value ?? 100);
1414
const minVerified = isNaN(min) ? undefined : min;
1515
const maxVerified = isNaN(max) ? undefined : max;
1616
*/
1717

18-
const step = (config.find((x) => x.alias === 'step') as number | undefined) ?? 0;
18+
const step = Number(config.find((x) => x.alias === 'step')?.value ?? 0);
1919
const stepVerified = step > 0 ? step : 1;
2020

2121
const initValueMin = Number(config.find((x) => x.alias === 'initVal1')?.value) || 0;

0 commit comments

Comments
 (0)