validation translators ctrl alias
This commit is contained in:
@@ -4,9 +4,11 @@ import {
|
||||
UmbDataPathPropertyValueQuery,
|
||||
} from '@umbraco-cms/backoffice/validation';
|
||||
|
||||
const ctrlAlias = Symbol();
|
||||
|
||||
export class UmbBlockElementValuesDataValidationPathTranslator extends UmbAbstractArrayValidationPathTranslator {
|
||||
constructor(host: UmbControllerHost) {
|
||||
super(host, '$.values[', UmbDataPathPropertyValueQuery);
|
||||
super(host, '$.values[', UmbDataPathPropertyValueQuery, ctrlAlias);
|
||||
}
|
||||
|
||||
getDataFromIndex(index: number) {
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
import { UmbValidationPathTranslatorBase } from './validation-path-translator-base.controller.js';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import type { UmbControllerAlias, UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
|
||||
export abstract class UmbAbstractArrayValidationPathTranslator extends UmbValidationPathTranslatorBase {
|
||||
#initialPathToMatch: string;
|
||||
#queryMethod: (data: unknown) => string;
|
||||
|
||||
constructor(host: UmbControllerHost, initialPathToMatch: string, queryMethod: (data: any) => string) {
|
||||
super(host);
|
||||
constructor(
|
||||
host: UmbControllerHost,
|
||||
initialPathToMatch: string,
|
||||
queryMethod: (data: any) => string,
|
||||
ctrlAlias?: UmbControllerAlias,
|
||||
) {
|
||||
super(host, ctrlAlias);
|
||||
|
||||
this.#initialPathToMatch = initialPathToMatch;
|
||||
this.#queryMethod = queryMethod;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { UMB_VALIDATION_CONTEXT } from '../index.js';
|
||||
import type { UmbValidationMessageTranslator } from './validation-message-path-translator.interface.js';
|
||||
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import type { UmbControllerAlias, UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
|
||||
|
||||
export abstract class UmbValidationPathTranslatorBase
|
||||
@@ -10,8 +10,8 @@ export abstract class UmbValidationPathTranslatorBase
|
||||
//
|
||||
protected _context?: typeof UMB_VALIDATION_CONTEXT.TYPE;
|
||||
|
||||
constructor(host: UmbControllerHost) {
|
||||
super(host);
|
||||
constructor(host: UmbControllerHost, ctrlAlias?: UmbControllerAlias) {
|
||||
super(host, ctrlAlias);
|
||||
|
||||
this.consumeContext(UMB_VALIDATION_CONTEXT, (context) => {
|
||||
this._context?.removeTranslator(this);
|
||||
|
||||
Reference in New Issue
Block a user