import * as _angular_core from '@angular/core'; import { Signal } from '@angular/core'; import { DmsObject, YuvUser, LockState } from '@yuuvis/client-core'; import { Severity } from '@yuuvis/material/badge'; type BadgeSeverity = Severity; interface BadgeContext { currentUser?: YuvUser; lockState?: LockState; } interface BadgeRule { field: string; op: 'isSet' | 'equals' | 'tagPresent'; value?: unknown; } interface Badge { id: string; labelKey: string; descriptionKey?: string; icon: string; svgIcon?: boolean; severity?: BadgeSeverity; priority?: number; /** * Marks this badge as a context-specific variant of another badge id. * The parent badge id alone is configured (e.g. in tile-config); the * registry implicitly evaluates variants whenever their parent is in * the id filter. Variants are hidden from selection UIs. */ variantOf?: string; applies?: (dmsObject: DmsObject, ctx: BadgeContext) => boolean; rule?: BadgeRule; } declare class BadgeChipComponent { #private; badge: _angular_core.InputSignal; showLabel: _angular_core.InputSignal; readonly tooltip: _angular_core.Signal; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } declare class BadgeSelectComponent { #private; selectedBadgeIds: _angular_core.InputSignal; bucket: _angular_core.InputSignal; badgeSelect: _angular_core.OutputEmitterRef; readonly badges: Signal; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Badge shown when an object is locked by another user. */ declare const LOCK_BADGE: Badge; /** * Badge shown when an object is locked by the current user. */ declare const LOCK_SELF_BADGE: Badge; /** * Badge definition for DMS objects that are subject to a destruction retention policy. * * This badge is displayed when a DMS object has the `DESTRUCTION_RETENTION` secondary object type * assigned and an active or ongoing retention period. It helps users identify objects that are * legally or organizationally protected from deletion during their retention period. * * **Applies when:** * - The object includes the `SystemSOT.DESTRUCTION_RETENTION` secondary object type. * - A retention start date (`RetentionField.RETENTION_START`) is present. * - The retention period has started (start date is in the past), or an end date is set and * still lies in the future. * * @remarks * - `severity` is set to `'danger'` to visually emphasize the retention constraint. * - `priority` is `20`, which controls the display order relative to other badges. */ declare const RETENTION_BADGE: Badge; declare class BadgeRegistryService { #private; /** * Registers one or multiple badges in the registry. * * If a badge with the same id already exists in the same scope, it is replaced. * Otherwise, the badge is added to the scope. * * @param badges An array of badges to register. * @param bucket Optional bucket id (typically an APP_ID). If omitted, badges are * registered globally and visible to every consumer. If provided, * badges are scoped to that bucket and only visible when consumers * query with the matching bucket. * * @see {@link Badge} */ registerBadges(badges: Badge[], bucket?: string): void; /** * Registers the default badges into the registry. * * Initializes three built-in badge types: * - LOCK_BADGE: Indicates objects locked by other users * - LOCK_SELF_BADGE: Indicates objects locked by the current user * - RETENTION_BADGE: Indicates objects under retention hold * * @param bucket Optional bucket id. If omitted, defaults are registered globally. * * @see {@link Badge} */ registerDefaultBadges(bucket?: string): void; /** * Unregisters one or multiple badges from the registry by id. * * Operates only on the specified scope: omitting `bucket` removes from the global * scope only, providing `bucket` removes from that bucket only. * * @param id A single badge id or an array of badge ids to remove. * @param bucket Optional bucket id. */ unregister(id: string | string[], bucket?: string): void; /** * Returns a registered badge by id. * * Looks first in the given bucket (if any), then in the global scope. * * @param id The badge id. * @param bucket Optional bucket id. * @returns The matching badge, or undefined if no badge is registered with that id. */ get(id: string, bucket?: string): Badge | undefined; /** * Returns all registered badges across the global scope and every bucket. * * Bucket entries override globals with the same id; remaining duplicates between * buckets keep the first occurrence. Useful for tests and debug inspection. */ all(): Badge[]; /** * Returns a reactive list of badges visible in the given scope. * * The returned signal recomputes whenever the registry changes. The list contains * the global badges merged with the named bucket's badges (bucket entries override * globals with the same id), sorted by ascending priority. At equal priority, * globals come first, then bucket-local badges. * * @param bucket Optional bucket id. */ getBadgesForBucket(bucket?: string): Signal; /** * Resolves all active badges for a given object in the given scope. * * The visible scope is `main ∪ bucket`. Variants only resolve when their parent id * is present in the visible scope. If `idFilter` is provided, only badges whose id * (or whose variant's parent id) is in the filter are considered. The resulting * list is sorted by ascending priority. * * @param dmsObject The object to evaluate badges against. * @param options Optional bucket and id filter. */ getActiveBadges(dmsObject: DmsObject, options?: { bucket?: string; idFilter?: string[]; }): Badge[]; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } declare class TileBadgesComponent { #private; dmsObject: _angular_core.InputSignal; badgeIds: _angular_core.InputSignal; bucket: _angular_core.InputSignal; readonly activeBadges: _angular_core.Signal; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } /** * Evaluates a single badge rule against a given DMS object. * * Supported operations: * - `isSet`: returns `true` when the field value is not `undefined`, `null`, or an empty string. * - `equals`: returns `true` when the field value strictly equals `rule.value`. * - `tagPresent`: returns `true` when the configured tags field contains a tag whose first element equals `rule.value`. * * @param rule Badge rule definition to evaluate. * @param dmsObject Source object containing field data. * @returns `true` if the rule matches; otherwise `false`. */ declare function evaluateRule(rule: BadgeRule, dmsObject: DmsObject): boolean; export { BadgeChipComponent, BadgeRegistryService, BadgeSelectComponent, LOCK_BADGE, LOCK_SELF_BADGE, RETENTION_BADGE, TileBadgesComponent, evaluateRule }; export type { Badge, BadgeContext, BadgeRule, BadgeSeverity };