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