Skip to content

Commit fcc5cc2

Browse files
committed
MNTP: Adds parseInt helper for min/max config values
1 parent f607a22 commit fcc5cc2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/packages/property-editors/content-picker/property-editor-ui-content-picker.element.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,18 @@ export class UmbPropertyEditorUIContentPickerElement
7878
this.#dynamicRoot = startNode.dynamicRoot;
7979
}
8080

81-
this._min = Number(config.getValueByAlias('minNumber')) || 0;
82-
this._max = Number(config.getValueByAlias('maxNumber')) || Infinity;
81+
this._min = this.#parseInt(config.getValueByAlias('minNumber'), 0);
82+
this._max = this.#parseInt(config.getValueByAlias('maxNumber'), Infinity);
8383

8484
this._allowedContentTypeUniques = config.getValueByAlias('filter');
8585
this._showOpenButton = config.getValueByAlias('showOpenButton');
8686
}
8787

88+
#parseInt(value: unknown, fallback: number): number {
89+
const num = Number(value);
90+
return !isNaN(num) && num > 0 ? num : fallback;
91+
}
92+
8893
override firstUpdated() {
8994
this.addFormControlElement(this.shadowRoot!.querySelector('umb-input-content')!);
9095
this.#setPickerRootUnique();

0 commit comments

Comments
 (0)