From bfd2d35e131e6686964816beb232e60e5e1530e9 Mon Sep 17 00:00:00 2001 From: Lan Nguyen Thuy Date: Wed, 8 Jan 2025 17:13:59 +0700 Subject: [PATCH 1/2] Block list amount valivation message --- .../property-editor-ui-block-list.element.ts | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts index d608e3c373..4ed8afbd35 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts @@ -244,14 +244,26 @@ export class UmbPropertyEditorUIBlockListElement this.addValidator( 'rangeUnderflow', - () => '#validation_entriesShort', + () => { + return this.localize.term( + 'validation_entriesShort', + this._limitMin, + (this._limitMin?? 0) - this.#entriesContext.getLength() + ); + }, () => !!this._limitMin && this.#entriesContext.getLength() < this._limitMin, ); - + this.addValidator( - 'rangeOverflow', - () => '#validation_entriesExceed', - () => !!this._limitMax && this.#entriesContext.getLength() > this._limitMax, + 'rangeOverflow', + () => { + return this.localize.term( + 'validation_entriesExceed', + this._limitMax, + this.#entriesContext.getLength() + ); + }, + () => !!this._limitMax && this.#entriesContext.getLength() > this._limitMax, ); this.observe(this.#entriesContext.layoutEntries, (layouts) => { From 77c064af89cbe0c73974cdf98e797e164867620c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Wed, 8 Jan 2025 16:02:36 +0100 Subject: [PATCH 2/2] prettier update --- .../property-editor-ui-block-list.element.ts | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts index 4ed8afbd35..06d3e28bd1 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts @@ -244,26 +244,19 @@ export class UmbPropertyEditorUIBlockListElement this.addValidator( 'rangeUnderflow', - () => { - return this.localize.term( + () => + this.localize.term( 'validation_entriesShort', this._limitMin, - (this._limitMin?? 0) - this.#entriesContext.getLength() - ); - }, + (this._limitMin ?? 0) - this.#entriesContext.getLength(), + ), () => !!this._limitMin && this.#entriesContext.getLength() < this._limitMin, ); - + this.addValidator( - 'rangeOverflow', - () => { - return this.localize.term( - 'validation_entriesExceed', - this._limitMax, - this.#entriesContext.getLength() - ); - }, - () => !!this._limitMax && this.#entriesContext.getLength() > this._limitMax, + 'rangeOverflow', + () => this.localize.term('validation_entriesExceed', this._limitMax, this.#entriesContext.getLength()), + () => !!this._limitMax && this.#entriesContext.getLength() > this._limitMax, ); this.observe(this.#entriesContext.layoutEntries, (layouts) => {