@dbg-riskit/angular-view
Version:
284 lines (268 loc) • 15.5 kB
TypeScript
import * as i0 from '@angular/core';
import { Provider, PipeTransform, Type, NgZone, Signal } from '@angular/core';
import { MatDialogRef, MatDialog } from '@angular/material/dialog';
import { MatColorTheme } from '@dbg-riskit/angular-common';
import { Maybe } from '@dbg-riskit/common';
import { BehaviorSubject, Observable } from 'rxjs';
import { MatSidenav } from '@angular/material/sidenav';
import { UrlTree, RouterLink } from '@angular/router';
declare const RISK_ERROR_SELECTOR = "risk-error";
declare const RISK_GOOD_SELECTOR = "risk-good";
declare const RISK_INFO_SELECTOR = "risk-info";
declare const RISK_MESSAGE_SELECTOR = "risk-message";
declare const RISK_WARN_SELECTOR = "risk-warn";
declare const RISK_INITIAL_LOAD_SELECTOR = "risk-initial-load";
declare const RISK_NO_DATA_SELECTOR = "risk-no-data";
declare const RISK_UPDATE_FAILED_SELECTOR = "risk-update-failed";
declare class RiskMessageComponent {
readonly message: i0.InputSignal<string | undefined>;
readonly initialLoad: i0.Signal<boolean>;
readonly noData: i0.Signal<boolean>;
readonly updateError: i0.Signal<boolean>;
readonly color: i0.Signal<string | null>;
private readonly tagName;
constructor();
static ɵfac: i0.ɵɵFactoryDeclaration<RiskMessageComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<RiskMessageComponent, "risk-error, risk-good, risk-info, risk-message, risk-warn, risk-initial-load, risk-no-data, risk-update-failed", never, { "message": { "alias": "message"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
}
declare class RiskDateFormatter {
private readonly format;
private readonly datePipe;
transform(value: Date): string | null;
static ɵfac: i0.ɵɵFactoryDeclaration<RiskDateFormatter, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<RiskDateFormatter>;
}
declare function provideDateFormatter(format: string): Provider[];
interface RiskLoaderDialogData {
title?: string;
cancel?: () => void;
}
declare class RiskLoaderComponent implements RiskDialogComponent<RiskLoaderDialogData, void> {
private readonly dialogRef;
private readonly data;
get dialogData(): RiskLoaderDialogData;
close(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<RiskLoaderComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<RiskLoaderComponent, "ng-component", never, {}, {}, never, never, true, never>;
}
interface RiskMessageDialogConfig<R> {
dialogType: RiskMessageDialogType;
buttons?: Array<RiskMessageDialogButton<R>>;
title?: string;
message: string;
note?: string;
icon?: string;
}
type RiskMessageDialogType = 'error' | 'warning' | 'info' | 'success' | 'question';
interface RiskMessageDialogButton<R> {
label: string;
value?: R;
primary?: boolean;
}
declare class RiskMessageDialogComponent<R> implements RiskDialogComponent<RiskMessageDialogConfig<R>, R> {
readonly dialogRef: MatDialogRef<RiskMessageDialogComponent<R>, R>;
readonly dialogData: RiskMessageDialogConfig<R>;
readonly customIcon: i0.Signal<string | undefined>;
readonly dialogType: i0.Signal<RiskMessageDialogType>;
readonly buttons: i0.Signal<RiskMessageDialogButton<R>[]>;
readonly color: i0.Signal<MatColorTheme>;
readonly icon: i0.Signal<string>;
close(button: RiskMessageDialogButton<R>): void;
static ɵfac: i0.ɵɵFactoryDeclaration<RiskMessageDialogComponent<any>, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<RiskMessageDialogComponent<any>, "ng-component", never, {}, {}, never, never, true, never>;
}
interface RiskProgressLoaderDialogData {
title?: string;
value?: number;
total?: number;
valueFormatter?: PipeTransform;
cancel?: () => void;
}
declare class RiskProgressLoaderComponent implements RiskDialogComponent<RiskProgressLoaderDialogData, void> {
private readonly dialogRef;
readonly dialogData: RiskProgressLoaderDialogData;
readonly value: i0.WritableSignal<number>;
readonly total: i0.WritableSignal<number | undefined>;
readonly mode: i0.Signal<"indeterminate" | "determinate">;
setValue(v: number): void;
setTotal(v: number | undefined): void;
get valueFormatter(): PipeTransform;
close(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<RiskProgressLoaderComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<RiskProgressLoaderComponent, "ng-component", never, {}, {}, never, never, true, never>;
}
interface RiskDialogConfig<T> {
/** Custom class for the overlay pane. */
readonly panelClass?: string;
/** Whether the dialog has a backdrop. */
readonly hasBackdrop?: boolean;
/** Custom class for the backdrop, */
readonly backdropClass?: string;
/** Whether the user can use escape or clicking outside to close a modal. */
readonly disableClose?: boolean;
readonly data?: T;
}
interface RiskDialogComponent<T, R = unknown> {
readonly dialogData: T;
}
declare class RiskDialogService {
readonly dialog: MatDialog;
showWarnDialog(message: string, note?: string): RiskDialogComponent<RiskMessageDialogConfig<unknown>, unknown>;
showWarnQuestionDialog(destroyCallback: () => void, destructiveButtonLabel: string, message: string, note?: string): RiskDialogComponent<RiskMessageDialogConfig<boolean>, boolean>;
showErrorDialog(message: string, note?: string): RiskDialogComponent<RiskMessageDialogConfig<unknown>, unknown>;
showInfoDialog(message: string, note?: string): RiskDialogComponent<RiskMessageDialogConfig<unknown>, unknown>;
showSuccessDialog(message: string, note?: string): RiskDialogComponent<RiskMessageDialogConfig<unknown>, unknown>;
showQuestionDialog<R>(buttons: Array<RiskMessageDialogButton<R>>, answerCallback: (value?: R) => void, message: string, note?: string): RiskDialogComponent<RiskMessageDialogConfig<R>, R>;
showMessageDialog<R>(config: {
dialogType: RiskMessageDialogType;
buttons?: Array<RiskMessageDialogButton<R>>;
answerCallback?: (value?: R) => void;
config?: RiskDialogConfig<undefined>;
title?: string;
message: string;
note?: string;
icon?: string;
}): RiskDialogComponent<RiskMessageDialogConfig<R>, R>;
showLoaderDialog(title: string): RiskLoaderComponent;
showLoaderDialog(data: RiskLoaderDialogData): RiskLoaderComponent;
showProgressLoaderDialog(title: string): RiskProgressLoaderComponent;
showProgressLoaderDialog(data: RiskProgressLoaderDialogData): RiskProgressLoaderComponent;
showDialog<T extends RiskDialogComponent<D, R>, D, R>(dialogClass: Type<T>): T;
showDialog<T extends RiskDialogComponent<D, R>, D, R>(dialogClass: Type<T>, config?: RiskDialogConfig<D>): T;
showDialog<T extends RiskDialogComponent<D, R>, D, R>(dialogClass: Type<T>, callback?: (result?: R) => void): T;
showDialog<T extends RiskDialogComponent<D, R>, D, R>(dialogClass: Type<T>, config?: RiskDialogConfig<D>, callback?: (result?: R) => void): T;
static ɵfac: i0.ɵɵFactoryDeclaration<RiskDialogService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<RiskDialogService>;
}
declare class RiskPercentPipe implements PipeTransform {
private readonly decimalPipe;
transform(value: Maybe<number | string>, digits?: string): string | undefined;
static ɵfac: i0.ɵɵFactoryDeclaration<RiskPercentPipe, never>;
static ɵpipe: i0.ɵɵPipeDeclaration<RiskPercentPipe, "percent", true>;
}
/**
* Class instances emitted [to observers] for each mql notification
*/
declare class MediaChange {
readonly mediaQuery: string;
constructor(mediaQuery?: string);
}
/**
* MediaMonitor configures listeners to mediaQuery changes and publishes an Observable facade to
* convert mediaQuery change callbacks to subscriber notifications. These notifications will be
* performed within the ng Zone to trigger change detections and component updates.
*
* NOTE: both mediaQuery activations and de-activations are announced in notifications
*/
declare class MatchMedia {
protected readonly ngZone: NgZone;
private readonly logger;
protected readonly _registry: Map<string, MediaQueryList>;
protected readonly _source: BehaviorSubject<MediaChange>;
protected readonly _observable$: Observable<MediaChange>;
constructor();
/**
* For the specified mediaQuery?
*/
isActive(mediaQuery: string): boolean;
/**
* External observers can watch for all (or a specific) mql changes.
* Typically used by the MediaQueryAdaptor; optionally available to components
* who wish to use the MediaMonitor as mediaMonitor$ observable service.
*
* NOTE: if a mediaQuery is not specified, then ALL mediaQuery activations will
* be announced.
*/
observe(mediaQuery?: string): Observable<MediaChange>;
/**
* Based on the BreakPointRegistry provider, register internal listeners for each unique
* mediaQuery. Each listener emits specific MediaChange data to observers
*/
private registerQuery;
/**
* Call window.matchMedia() to build a MediaQueryList; which
* supports 0..n listeners for activation/deactivation
*/
protected _buildMQL(query: string): MediaQueryList;
static ɵfac: i0.ɵɵFactoryDeclaration<MatchMedia, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<MatchMedia>;
}
declare class RiskLayoutVerticalDirective {
static ɵfac: i0.ɵɵFactoryDeclaration<RiskLayoutVerticalDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<RiskLayoutVerticalDirective, "risk-layout-vertical", never, {}, {}, never, never, true, never>;
}
declare class RiskLayoutVerticalTitleDirective {
static ɵfac: i0.ɵɵFactoryDeclaration<RiskLayoutVerticalTitleDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<RiskLayoutVerticalTitleDirective, "risk-layout-vertical-title", never, {}, {}, never, never, true, never>;
}
declare class RiskLayoutVerticalIconDirective {
static ɵfac: i0.ɵɵFactoryDeclaration<RiskLayoutVerticalIconDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<RiskLayoutVerticalIconDirective, "risk-layout-vertical-icon", never, {}, {}, never, never, true, never>;
}
declare class RiskLayoutHorizontalDirective {
static ɵfac: i0.ɵɵFactoryDeclaration<RiskLayoutHorizontalDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<RiskLayoutHorizontalDirective, "risk-layout-horizontal", never, {}, {}, never, never, true, never>;
}
declare class RiskLayoutFooterDirective {
static ɵfac: i0.ɵɵFactoryDeclaration<RiskLayoutFooterDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<RiskLayoutFooterDirective, "risk-layout-footer", never, {}, {}, never, never, true, never>;
}
declare class RiskLayoutComponent {
private readonly authProvider;
private readonly mainLogo;
private readonly matchMedia;
readonly smallScreenMenuVisible: i0.InputSignal<boolean>;
readonly smallScreenWidth: i0.InputSignal<number>;
readonly footerVisible: i0.InputSignal<boolean>;
readonly toolbarBackgroundColor: i0.InputSignal<string | undefined>;
readonly backgroundColor: i0.InputSignal<string | undefined>;
readonly authStatus: Signal<boolean>;
readonly mediaSmall: i0.WritableSignal<boolean>;
constructor();
get logo(): string;
closeSideNav(sidenav: MatSidenav): void;
static ɵfac: i0.ɵɵFactoryDeclaration<RiskLayoutComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<RiskLayoutComponent, "risk-layout", never, { "smallScreenMenuVisible": { "alias": "smallScreenMenuVisible"; "required": false; "isSignal": true; }; "smallScreenWidth": { "alias": "smallScreenWidth"; "required": false; "isSignal": true; }; "footerVisible": { "alias": "footerVisible"; "required": false; "isSignal": true; }; "toolbarBackgroundColor": { "alias": "toolbarBackgroundColor"; "required": false; "isSignal": true; }; "backgroundColor": { "alias": "backgroundColor"; "required": false; "isSignal": true; }; }, {}, never, ["[menu-horizontal], risk-layout-horizontal > *", "[menu-vertical-title], risk-layout-vertical-title > *", "[menu-vertical-icon], risk-layout-vertical-icon > *", "[menu-vertical], risk-layout-vertical > *", "*", "risk-layout-footer > *"], true, never>;
}
declare class RiskFlexComponent {
readonly wrapContent: i0.InputSignal<boolean>;
static ɵfac: i0.ɵɵFactoryDeclaration<RiskFlexComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<RiskFlexComponent, "risk-flex", never, { "wrapContent": { "alias": "wrapContent"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
}
declare class RiskFlexSpacerComponent {
static ɵfac: i0.ɵɵFactoryDeclaration<RiskFlexSpacerComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<RiskFlexSpacerComponent, "risk-flex-spacer", never, {}, {}, never, never, true, never>;
}
declare class RiskSubLinkDirective {
private readonly router;
private readonly route;
readonly riskSubLink: i0.InputSignal<string | unknown[]>;
get urlTree(): UrlTree;
static ɵfac: i0.ɵɵFactoryDeclaration<RiskSubLinkDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<RiskSubLinkDirective, "[riskSubLink]", never, { "riskSubLink": { "alias": "riskSubLink"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
}
declare class RiskLinkActiveDirective {
private readonly router;
private readonly element;
private readonly renderer;
private readonly selfRouterLink;
private readonly selfSubLink;
readonly links: i0.Signal<readonly RouterLink[]>;
readonly subLinks: i0.Signal<readonly RiskSubLinkDirective[]>;
private classes;
private readonly routerNavigated;
readonly menuLinkActive: i0.InputSignal<string | string[]>;
readonly riskLinkActiveOptions: i0.InputSignal<{
exact: boolean;
}>;
readonly isActive: i0.Signal<boolean>;
constructor();
static ɵfac: i0.ɵɵFactoryDeclaration<RiskLinkActiveDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<RiskLinkActiveDirective, "[riskLinkActive]", ["riskLinkActive"], { "menuLinkActive": { "alias": "riskLinkActive"; "required": true; "isSignal": true; }; "riskLinkActiveOptions": { "alias": "riskLinkActiveOptions"; "required": false; "isSignal": true; }; }, {}, ["links", "subLinks"], never, true, never>;
}
declare class RiskToolbarComponent {
static ɵfac: i0.ɵɵFactoryDeclaration<RiskToolbarComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<RiskToolbarComponent, "risk-toolbar", never, {}, {}, never, ["*"], true, never>;
}
export { MatchMedia, MediaChange, RISK_ERROR_SELECTOR, RISK_GOOD_SELECTOR, RISK_INFO_SELECTOR, RISK_INITIAL_LOAD_SELECTOR, RISK_MESSAGE_SELECTOR, RISK_NO_DATA_SELECTOR, RISK_UPDATE_FAILED_SELECTOR, RISK_WARN_SELECTOR, RiskDateFormatter, RiskDialogService, RiskFlexComponent, RiskFlexSpacerComponent, RiskLayoutComponent, RiskLayoutFooterDirective, RiskLayoutHorizontalDirective, RiskLayoutVerticalDirective, RiskLayoutVerticalIconDirective, RiskLayoutVerticalTitleDirective, RiskLinkActiveDirective, RiskLoaderComponent, RiskMessageComponent, RiskMessageDialogComponent, RiskPercentPipe, RiskProgressLoaderComponent, RiskSubLinkDirective, RiskToolbarComponent, provideDateFormatter };
export type { RiskDialogComponent, RiskDialogConfig, RiskLoaderDialogData, RiskMessageDialogButton, RiskMessageDialogConfig, RiskMessageDialogType, RiskProgressLoaderDialogData };