From 6e0fd5a8d8e8b0143f779602f1353e018ade044b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Mon, 15 Apr 2024 22:14:22 +0200 Subject: [PATCH] clean up --- .../property-layout/property-layout.element.ts | 10 ---------- .../core/property/property/property.element.ts | 11 ++++------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/property/property-layout/property-layout.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/property/property-layout/property-layout.element.ts index 2b28c03dba..cdc2c5fc07 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/property/property-layout/property-layout.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/property/property-layout/property-layout.element.ts @@ -56,16 +56,6 @@ export class UmbPropertyLayoutElement extends LitElement { @property({ type: Boolean, reflect: true }) public invalid?: boolean; - /** - * @description Describe why the property is invalid. - * @type {boolean} - * @attr - * @default undefined - */ - @property({ type: String, attribute: 'invalid-message' }) - public invalidMessage?: string; - // TODO: put the invalidMessage in some hover tooltip or something. [NL] - render() { // TODO: Only show alias on label if user has access to DocumentType within settings: return html` diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/property/property/property.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/property/property/property.element.ts index c3d3cb72b3..e6397911a7 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/property/property/property.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/property/property/property.element.ts @@ -109,10 +109,8 @@ export class UmbPropertyElement extends UmbLitElement { @property({ type: String, attribute: false }) public set dataPath(dataPath: string | undefined) { this.#dataPath = dataPath; - new UmbObserveValidationStateController(this, dataPath, (feedback) => { - // TODO: Join in a pretty way, and localized way(how to join one or more items varies depending on the language. [NL] - // TODO: Also wrap in a general localized message, like "Contains these errors: ..."; [NL] - this._validationMessage = feedback.length > 0 ? feedback.map((x) => x.message).join(', ') : undefined; + new UmbObserveValidationStateController(this, dataPath, (invalid) => { + this._invalid = invalid; }); } public get dataPath(): string | undefined { @@ -127,7 +125,7 @@ export class UmbPropertyElement extends UmbLitElement { private _element?: ManifestPropertyEditorUi['ELEMENT_TYPE']; @state() - private _validationMessage?: string; + private _invalid?: boolean; @state() private _alias?: string; @@ -278,8 +276,7 @@ export class UmbPropertyElement extends UmbLitElement { alias="${ifDefined(this._alias)}" label="${ifDefined(this._label)}" description="${ifDefined(this._description)}" - ?invalid=${this._validationMessage !== undefined} - .invalidMessage=${this._validationMessage}> + ?invalid=${this._invalid}> ${this._renderPropertyActionMenu()} ${this._variantDifference ? html`${this._variantDifference}`