import type { ValidationTriggerSelector } from './ValidationTriggerSelector'; import type { INotifySetChanged } from '../../collections'; import { ValidationTrigger } from './ValidationTrigger'; /** * Represents the set item validation trigger configuration. * @template TItem The type of items the set contains. */ export interface ISetItemValidationTriggerConfig { /** * Gets the set containing the items that may trigger validation. */ readonly set: INotifySetChanged & Iterable; /** * 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 set item validation trigger. Instead of triggering a validation only when the set 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 TItem The type of items the set contains. */ export declare class SetItemValidationTrigger extends ValidationTrigger & Iterable> { private readonly _validationTriggerSelector; private readonly _shouldTriggerValidation; private readonly _itemValidationTriggersByItem; private readonly _setChangedEventHandler; private static _defaultShouldTriggerValidation; /** * Initializes a new instance of the {@linkcode SetItemValidationTrigger} class. * @param config The validation trigger config. */ constructor(config: ISetItemValidationTriggerConfig); /** * Subscribes to set and item changes. */ protected subscribeToTarget(): void; /** * Unsubscribes from set and item changes. */ protected unsubscribeFromTarget(): void; private _addItemValidationTriggers; }