Skip to content

Commit 1149adb

Browse files
committed
MNTP: Adds min/max validation messages
1 parent fcc5cc2 commit 1149adb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,15 @@ export class UmbPropertyEditorUIContentPickerElement
4343
@state()
4444
_min = 0;
4545

46+
@state()
47+
_minMessage = '';
48+
4649
@state()
4750
_max = Infinity;
4851

52+
@state()
53+
_maxMessage = '';
54+
4955
@state()
5056
_allowedContentTypeUniques?: string | null;
5157

@@ -83,6 +89,14 @@ export class UmbPropertyEditorUIContentPickerElement
8389

8490
this._allowedContentTypeUniques = config.getValueByAlias('filter');
8591
this._showOpenButton = config.getValueByAlias('showOpenButton');
92+
93+
this._minMessage = `${this.localize.term('validation_minCount')} ${this._min} ${this.localize.term('validation_items')}`;
94+
this._maxMessage = `${this.localize.term('validation_maxCount')} ${this._max} ${this.localize.term('validation_itemsSelected')}`;
95+
96+
// NOTE: Run validation immediately, to notify if the value is outside of min/max range. [LK]
97+
if (this._min > 0 || this._max < Infinity) {
98+
this.checkValidity();
99+
}
86100
}
87101

88102
#parseInt(value: unknown, fallback: number): number {

0 commit comments

Comments
 (0)