From a83dc4dbf10cc556ebdcc369c44bb241f67dfaec Mon Sep 17 00:00:00 2001 From: leekelleher Date: Thu, 4 Jul 2024 16:57:40 +0100 Subject: [PATCH] MNTP: Adds min/max validation messages --- .../property-editor-ui-content-picker.element.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/src/packages/property-editors/content-picker/property-editor-ui-content-picker.element.ts b/src/Umbraco.Web.UI.Client/src/packages/property-editors/content-picker/property-editor-ui-content-picker.element.ts index f4fc21f7d1..c40a756769 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/property-editors/content-picker/property-editor-ui-content-picker.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/property-editors/content-picker/property-editor-ui-content-picker.element.ts @@ -43,9 +43,15 @@ export class UmbPropertyEditorUIContentPickerElement @state() _min = 0; + @state() + _minMessage = ''; + @state() _max = Infinity; + @state() + _maxMessage = ''; + @state() _allowedContentTypeUniques?: string | null; @@ -83,6 +89,14 @@ export class UmbPropertyEditorUIContentPickerElement this._allowedContentTypeUniques = config.getValueByAlias('filter'); this._showOpenButton = config.getValueByAlias('showOpenButton'); + + this._minMessage = `${this.localize.term('validation_minCount')} ${this._min} ${this.localize.term('validation_items')}`; + this._maxMessage = `${this.localize.term('validation_maxCount')} ${this._max} ${this.localize.term('validation_itemsSelected')}`; + + // NOTE: Run validation immediately, to notify if the value is outside of min/max range. [LK] + if (this._min > 0 || this._max < Infinity) { + this.checkValidity(); + } } #parseInt(value: unknown, fallback: number): number {