From ed5b2f6fc30b579bd359d7ba8b86745f9399392f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Wed, 21 Aug 2024 11:57:07 +0200 Subject: [PATCH] do not lowercase --- .../property-editor-ui-block-list.element.ts | 2 ++ ...-workspace-view-edit-properties.element.ts | 5 ++-- .../context/validation-messages.manager.ts | 23 +++++++++++-------- 3 files changed, 18 insertions(+), 12 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 45ffa9c275..9e263cf849 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 @@ -133,6 +133,8 @@ export class UmbPropertyEditorUIBlockListElement constructor() { super(); + //this.#validationContext.messages.debug('block list'); + this.consumeContext(UMB_PROPERTY_CONTEXT, (context) => { this.observe( context.dataPath, diff --git a/src/Umbraco.Web.UI.Client/src/packages/block/block/workspace/views/edit/block-workspace-view-edit-properties.element.ts b/src/Umbraco.Web.UI.Client/src/packages/block/block/workspace/views/edit/block-workspace-view-edit-properties.element.ts index 295ee4073e..307e9f0978 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/block/block/workspace/views/edit/block-workspace-view-edit-properties.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/block/block/workspace/views/edit/block-workspace-view-edit-properties.element.ts @@ -4,7 +4,7 @@ import { css, html, customElement, property, state, repeat } from '@umbraco-cms/ import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import type { UmbContentTypeModel, UmbPropertyTypeModel } from '@umbraco-cms/backoffice/content-type'; import { UmbContentTypePropertyStructureHelper } from '@umbraco-cms/backoffice/content-type'; -import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; +import { UmbLitElement, umbDestroyOnDisconnect } from '@umbraco-cms/backoffice/lit-element'; @customElement('umb-block-workspace-view-edit-properties') export class UmbBlockWorkspaceViewEditPropertiesElement extends UmbLitElement { @@ -70,7 +70,8 @@ export class UmbBlockWorkspaceViewEditPropertiesElement extends UmbLitElement { html` `, + .property=${property} + ${umbDestroyOnDisconnect()}>`, ); } diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/validation/context/validation-messages.manager.ts b/src/Umbraco.Web.UI.Client/src/packages/core/validation/context/validation-messages.manager.ts index 6104c31dc8..7c6fc6c1b2 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/validation/context/validation-messages.manager.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/validation/context/validation-messages.manager.ts @@ -15,16 +15,16 @@ export class UmbValidationMessagesManager { #messages = new UmbArrayState([], (x) => x.key); messages = this.#messages.asObservable(); - /*constructor() { - this.#messages.asObservable().subscribe((x) => console.log('all messages:', x)); - }*/ + debug(logName: string) { + this.#messages.asObservable().subscribe((x) => console.log(logName, x, this.#translators)); + } getHasAnyMessages(): boolean { return this.#messages.getValue().length !== 0; } messagesOfPathAndDescendant(path: string): Observable> { - path = path.toLowerCase(); + //path = path.toLowerCase(); // Find messages that starts with the given path, if the path is longer then require a dot or [ as the next character. using a more performant way than Regex: return this.#messages.asObservablePart((msgs) => msgs.filter( @@ -36,13 +36,13 @@ export class UmbValidationMessagesManager { } messagesOfTypeAndPath(type: UmbValidationMessageType, path: string): Observable> { - path = path.toLowerCase(); + //path = path.toLowerCase(); // Find messages that matches the given type and path. return this.#messages.asObservablePart((msgs) => msgs.filter((x) => x.type === type && x.path === path)); } hasMessagesOfPathAndDescendant(path: string): Observable { - path = path.toLowerCase(); + //path = path.toLowerCase(); return this.#messages.asObservablePart((msgs) => // Find messages that starts with the given path, if the path is longer then require a dot or [ as the next character. Using a more performant way than Regex: [NL] msgs.some( @@ -53,7 +53,7 @@ export class UmbValidationMessagesManager { ); } getHasMessagesOfPathAndDescendant(path: string): boolean { - path = path.toLowerCase(); + //path = path.toLowerCase(); return this.#messages .getValue() .some( @@ -64,7 +64,8 @@ export class UmbValidationMessagesManager { } addMessage(type: UmbValidationMessageType, path: string, body: string, key: string = UmbId.new()): void { - path = this.#translatePath(path.toLowerCase()) ?? path.toLowerCase(); + //path = this.#translatePath(path.toLowerCase()) ?? path.toLowerCase(); + path = this.#translatePath(path) ?? path; // check if there is an existing message with the same path and type, and append the new messages: [NL] if (this.#messages.getValue().find((x) => x.type === type && x.path === path && x.body === body)) { return; @@ -73,7 +74,8 @@ export class UmbValidationMessagesManager { } addMessages(type: UmbValidationMessageType, path: string, bodies: Array): void { - path = this.#translatePath(path.toLowerCase()) ?? path.toLowerCase(); + //path = this.#translatePath(path.toLowerCase()) ?? path.toLowerCase(); + path = this.#translatePath(path) ?? path; // filter out existing messages with the same path and type, and append the new messages: [NL] const existingMessages = this.#messages.getValue(); const newBodies = bodies.filter( @@ -86,7 +88,7 @@ export class UmbValidationMessagesManager { this.#messages.removeOne(key); } removeMessagesByTypeAndPath(type: UmbValidationMessageType, path: string): void { - path = path.toLowerCase(); + //path = path.toLowerCase(); this.#messages.filter((x) => !(x.type === type && x.path === path)); } removeMessagesByType(type: UmbValidationMessageType): void { @@ -94,6 +96,7 @@ export class UmbValidationMessagesManager { } #translatePath(path: string): string | undefined { + //path = path.toLowerCase(); for (const translator of this.#translators) { const newPath = translator.translate(path); // If not undefined or false, then it was a valid translation: [NL]