import type { ValidationTriggerSelector } from './ValidationTriggerSelector'; import type { INotifyMapChanged } from '../../collections'; import { ValidationTrigger } from './ValidationTrigger'; /** * Represents the map item validation trigger configuration. * @template TKey The type of keys the map contains. * @template TItem The type of items the map contains. */ export interface IMapItemValidationTriggerConfig { /** * Gets the map containing the items that may trigger validation. */ readonly map: INotifyMapChanged & Iterable<[TKey, TItem]>; /** * Gets the selector that provides the individual validation triggers for each item. */ readonly validationTriggerSelector: ValidationTriggerSelector; /** * Optional, a guard method which controls when a validation should be triggered. * @param item The item that changed which may trigger a validation. */ shouldTriggerValidation?(item: TItem): boolean; } /** * Represents a map item validation trigger. Instead of triggering a validation only when the map changes, * a validation may be triggered by any of the contained items when they themselves change. * * This is useful when within the collection there is a field that needs to be unique, * such as a unique name for each item in the collection. * * @template TKey The type of keys the map contains. * @template TItem The type of items the map contains. */ export declare class MapItemValidationTrigger extends ValidationTrigger & Iterable<[TKey, TItem]>> { private readonly _validationTriggerSelector; private readonly _shouldTriggerValidation; private readonly _itemValidationTriggersByItem; private readonly _maChangedEventHandler; private static _defaultShouldTriggerValidation; /** * Initializes a new instance of the {@linkcode MapItemValidationTrigger} class. * @param config The validation trigger config. */ constructor(config: IMapItemValidationTriggerConfig); /** * Subscribes to map and item changes. */ protected subscribeToTarget(): void; /** * Unsubscribes from map and item changes. */ protected unsubscribeFromTarget(): void; private _ensureItemValidationTriggers; }