JSDocs for Validation Context

This commit is contained in:
Niels Lyngsø
2025-04-21 20:24:17 +02:00
parent f69f257d12
commit 74a9b8aae7

View File

@@ -33,12 +33,13 @@ export class UmbValidationController extends UmbControllerBase implements UmbVal
/**
* @param path
* @deprecated Use extension type 'propertyValidationPathTranslator' instead. Will be removed in v.17
* @returns {any} - Returns the translation data for the given path.
*/
translationDataOf(path: string): any {
return this.#translationData.asObservablePart((data) => GetValueByJsonPath(data, path));
}
/**
* @param data
* @param {any} data - The translation data to set.
* @deprecated Use extension type 'propertyValidationPathTranslator' instead. Will be removed in v.17
*/
setTranslationData(data: any): void {
@@ -46,6 +47,7 @@ export class UmbValidationController extends UmbControllerBase implements UmbVal
}
/**
* @deprecated Use extension type 'propertyValidationPathTranslator' instead. Will be removed in v.17
* @returns {any} - Returns the translation data for the given path.
*/
getTranslationData(): any {
new UmbDeprecation({
@@ -116,7 +118,7 @@ export class UmbValidationController extends UmbControllerBase implements UmbVal
/**
* Remove a path translator from this validation context.
* @param translator
* @param {UmbValidationMessageTranslator} translator - The translator to remove.
*/
async removeTranslator(translator: UmbValidationMessageTranslator) {
// Because this may have been destroyed at this point. and because we do not know if a context has been destroyed, then we allow this call, but let it soft-fail if messages does not exists. [NL]
@@ -127,7 +129,7 @@ export class UmbValidationController extends UmbControllerBase implements UmbVal
/**
* Provide this validation context to a specific controller host.
* This can be used to Host a validation context in a Workspace, but provide it on a certain scope, like a specific Workspace View.
* @param controllerHost {UmbClassInterface}
* @param {UmbClassInterface} controllerHost - The controller host to provide this validation context to.
*/
provideAt(controllerHost: UmbClassInterface): void {
if (this.#currentProvideHost === controllerHost) return;
@@ -155,12 +157,12 @@ export class UmbValidationController extends UmbControllerBase implements UmbVal
/**
* Define a specific data path for this validation context.
* This will turn this validation context into a sub-context of the parent validation context.
* This will make this context inherit the messages from the parent validation context.
* And thereby make this context inherit the messages from the parent validation context.
* @see {@link report} Call `report()` to propagate changes to the parent context.
* @see {@link autoReport} Call `autoReport()` to continuously synchronize changes to the parent context.
*
* messages and data will be localizes accordingly to the given data path.
* @param dataPath {string} - The data path to bind this validation context to.
* messages and data will be scoped accordingly to the given data path.
* @param {string} dataPath - The data path to bind this validation context to.
* @example
* ```ts
* const validationContext = new UmbValidationContext(this);