/** * The name → {@link ValidatorFactory} lookup the validation engine compiles * through. * * @packageDocumentation */ import type { ValidatorFactory } from '../types/validation.types'; /** * Lookup table of validation rule factories, keyed by the name a column declares * the rule under. * * Built-in rules register themselves through exactly the same call a * user-defined one would, so there is no special-casing between the two: * `registry.register('iban', (config) => …)` makes * `validation: { iban: true }` work on any column, indistinguishable from * `min` at every downstream point. That openness is the reason * `ColumnValidation` carries an index signature — the interface cannot enumerate * rules an application has not written yet. * * ### Registration is open at any time * `register()` is callable before or after the grid has rendered. Because the * engine memoises compiled rule sets per column, though, registering a rule an * existing column already declares takes effect only after * {@link ValidationEngine.invalidate} — which is why * {@link ValidationEngine.registerValidator} exists and should be preferred over * reaching for this class directly. * * ### Unknown names are not errors * A column may declare a rule this registry has never heard of. The engine * ignores it rather than throwing: the key may belong to a plugin that has not * loaded yet, or to a foreign tool reading the same column definitions, and * neither is a reason to fail a user's edit. * * Follows the shape of `BuiltInRendererRegistry` and `IconRegistry`; method * names match them (`remove`, not `unregister`). */ export declare class ValidatorRegistry { private readonly factories; /** * @param factories - Rules to seed the registry with. Defaults to every rule * Photon Grid ships; pass your own record to opt out of the rest. */ constructor(factories?: Readonly>); /** * Adds a rule factory, replacing any existing one with the same name. * * Last-in wins, deliberately: it is what lets an application override a * built-in — a stricter house `email`, say — without the grid needing an * override mechanism of its own. */ register(name: string, factory: ValidatorFactory): void; /** Registers several rules, in the record's key order — later duplicates win. */ registerAll(factories: Readonly>): void; /** The factory registered under `name`, or `undefined`. */ get(name: string): ValidatorFactory | undefined; has(name: string): boolean; /** * Removes a rule. Columns declaring it fall back to being unvalidated on that * key rather than failing — see the class note on unknown names. */ remove(name: string): void; /** Registered names, in registration order. */ names(): string[]; /** A copy of the registry, so callers cannot mutate it by holding the map. */ getAll(): Map; clear(): void; } //# sourceMappingURL=validator-registry.d.ts.map