import { AfterContentInit, ChangeDetectorRef, OnDestroy, TemplateRef } from '@angular/core'; import { InfoCardItemValueContext } from './info-card-item-value.directive'; import * as i0 from "@angular/core"; /** * Represents a regular key/label/value entry displayed in the info card. * @template T - The type of the value associated with this item */ export interface InfoCardEntryItem { /** Unique identifier for the item, used for tracking and template mapping */ key: string; /** Display label for the item */ label: string; /** Optional helper text shown in an info tooltip next to the label */ info?: string; /** The value to be displayed, can be of any type */ value: T; /** Whether to render a button that copies the item value */ copyable?: boolean; } /** * Represents a grouped info card entry rendered side by side. * @template T - The type of the value associated with each grouped item */ export interface InfoCardGroupItem { /** Flag indicating this entry is a group of items. */ group: true; /** Regular entries rendered inside the group. */ items: InfoCardEntryItem[]; } /** * Represents a divider rendered between info card entries. */ export interface InfoCardDividerItem { divider: true; } /** * Represents a single item displayed in the info card. * An item can be a regular entry, a group of entries, or a divider. * @template T - The type of the value associated with this item */ export type InfoCardItem = InfoCardEntryItem | InfoCardGroupItem | InfoCardDividerItem; export type InfoCardVariant = 'horizontal' | 'vertical'; /** * InfoCardComponent - A reusable component for displaying key-value information in a card layout. * * This component provides a flexible way to display structured information with support for: * - Custom templates for specific item values via content projection * - Empty value fallbacks * - Dynamic template updates * - OnPush change detection for optimal performance * * @example * ```html * * * {{value}} * * * ``` */ export declare class InfoCardComponent implements AfterContentInit, OnDestroy { private readonly cdr; private static readonly COPIED_TOOLTIP_DURATION_MS; /** Optional title displayed at the top of the card */ title?: string; /** Optional Material icon name to display before the title */ titleIcon?: string; /** Array of items to display in the card, each containing a key, label, and value */ items: InfoCardItem[]; /** Controls whether entries are rendered horizontally or vertically */ variant: InfoCardVariant; /** Fallback text to display when a value is empty or invalid. Defaults to '-' */ emptyFallback: string; /** A boolean variable indicating the loading state */ isLoading: boolean; /** Collection of custom value templates projected via content children */ private readonly itemValueTemplates?; /** Map storing custom templates keyed by item key for quick lookup */ private templateMap; /** Subscription to handle dynamic changes in projected templates */ private templateChangesSubscription?; /** Current item key showing the copied tooltip state */ private copiedItemKey; /** Timeout id used to reset copied tooltip state */ private copiedTooltipTimeoutId?; constructor(cdr: ChangeDetectorRef); /** * Lifecycle hook called after content initialization. * Builds the initial template map and subscribes to template changes. */ ngAfterContentInit(): void; /** * Lifecycle hook called before component destruction. * Cleans up subscriptions to prevent memory leaks. */ ngOnDestroy(): void; /** * TrackBy function for ngFor optimization. * @param index - The index of the item in the list * @param item - The info card item * @returns The unique key for regular entries, or an index-based key for grouped and divider entries */ trackByKey: (index: number, item: InfoCardItem) => string; /** * TrackBy function for grouped entry items. * @param index - The index of the grouped item * @param item - The grouped entry item * @returns The unique key for grouped entry item */ trackByGroupItemKey: (_index: number, item: InfoCardEntryItem) => string; /** * Type guard that checks whether the given item is a divider. * @param item - The info card item to check * @returns True if the item represents a divider */ isDivider(item: InfoCardItem): item is Extract; /** * Type guard that checks whether the given item is a group entry. * @param item - The info card item to check * @returns True if the item represents a group */ isGroup(item: InfoCardItem): item is InfoCardGroupItem; /** * Type guard that checks whether the given item is a regular entry. * @param item - The info card item to check * @returns True if the item represents a regular entry */ isEntry(item: InfoCardItem): item is InfoCardEntryItem; /** * Retrieves the custom template for a specific item, if one exists. * @param item - The info card item to get the template for * @returns The custom template reference or null if no custom template exists */ getTemplate(item: InfoCardItem): TemplateRef | null; /** * Creates the template context for rendering custom item values. * @param item - The info card item * @returns Context object containing the value and item reference */ getContext(item: InfoCardEntryItem): InfoCardItemValueContext; /** * Checks if a value is considered non-empty and should be displayed. * @param value - The value to check * @returns True if the value should be displayed, false if it should show the fallback */ hasValue(value: unknown): boolean; /** * Determines whether a copy button should be displayed for an item. * @param item - The item to evaluate * @returns True when the item is copyable and has a non-empty value */ shouldShowCopyButton(item: InfoCardItem): boolean; /** * Determines whether an entry should display the info tooltip icon. * @param item - The entry item to evaluate * @returns True when the item has a non-empty info message */ shouldShowInfoTooltip(item: InfoCardEntryItem): boolean; /** * Returns the tooltip label for a copy button. * @param item - The item associated with the copy button * @returns The tooltip text */ getCopyTooltipMessage(item: InfoCardItem): string; /** * Copies an item value to the clipboard and updates tooltip feedback state. * @param item - The item whose value should be copied */ copyItemValue(item: InfoCardItem): void; /** * Rebuilds the template map from the current set of projected templates. * Called during initialization and whenever the projected templates change. * @private */ private rebuildTemplateMap; /** * Copies plain text to clipboard with fallback when Clipboard API is unavailable. * @param value - Text value to copy */ private copyText; /** * Updates copied tooltip state and resets it after a short delay. * @param itemKey - Item key currently marked as copied */ private setCopiedItemKey; /** * Clears the copied tooltip timeout when active. */ private clearCopiedTooltipTimeout; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; static ngAcceptInputType_isLoading: unknown; }