diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/property/property/property.context.ts b/src/Umbraco.Web.UI.Client/src/packages/core/property/property/property.context.ts index 0c121c7299..c217bacb0f 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/property/property/property.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/property/property/property.context.ts @@ -43,9 +43,13 @@ export class UmbPropertyContext extends UmbContextBase(undefined); public readonly validation = this.#validation.asObservable(); + public readonly validationMandatory = this.#validation.asObservablePart((x) => x?.mandatory); public readonly validationMandatoryMessage = this.#validation.asObservablePart((x) => x?.mandatoryMessage); + #dataPath = new UmbStringState(undefined); + public readonly dataPath = this.#dataPath.asObservable(); + #editor = new UmbBasicState(undefined); public readonly editor = this.#editor.asObservable(); @@ -206,6 +210,13 @@ export class UmbPropertyContext extends UmbContextBase { this._invalid = invalid; }); } public get dataPath(): string | undefined { - return this.#dataPath; + return this.#propertyContext.getDataPath(); } - #dataPath?: string; @state() private _variantDifference?: string; @@ -319,13 +318,14 @@ export class UmbPropertyElement extends UmbLitElement { ); if ('checkValidity' in this._element) { - this.#controlValidator = new UmbFormControlValidator(this, this._element as any, this.#dataPath); + const dataPath = this.dataPath; + this.#controlValidator = new UmbFormControlValidator(this, this._element as any, dataPath); // We trust blindly that the dataPath is available at this stage. [NL] - if (this.#dataPath) { + if (dataPath) { this.#validationMessageBinder = new UmbBindServerValidationToFormControl( this, this._element as any, - this.#dataPath, + dataPath, ); this.#validationMessageBinder.value = this.#propertyContext.getValue(); }