@bi8/am-dyn-form
Version:
ng update @angular/cli yarn add @angular/cli
173 lines (172 loc) • 5.73 kB
TypeScript
import { Subject, Observable, OperatorFunction } from 'rxjs';
export interface ObservableFn<A, T> {
(param?: A): Observable<T>;
}
export declare enum NotificationType {
init = "init",
busy = "busy",
idle = "idle",
paramFunc = "paramFunc",
inputNext = "inputNext",
inputComplete = "inputComplete",
inputError = "inputError",
outputFuncError = "outputFuncError",
outputNext = "outputNext",
outputError = "outputError",
outputComplete = "outputComplete",
close = "close",
enable = "enable",
disable = "disable"
}
export interface ChannelNotification {
type: NotificationType;
name?: string;
data?: any;
error?: any;
}
export interface NotificationFn {
(input: ChannelNotification): any;
}
export interface ParameterFn<A, T> {
(input: A): T;
}
export declare class Channel<A extends any, T extends any> {
private fn;
private closed;
private input;
private output;
private enabled;
private inputBusy;
private outputBusy;
private name;
private notifications;
private debug;
private paramFn;
private notificationFn;
constructor(fn: ObservableFn<A, T>, options?: {
input?: Subject<A>;
output?: Subject<T>;
enabled?: boolean;
name?: string;
debug?: boolean;
paramFn?: ParameterFn<any, any>;
notificationFn?: NotificationFn;
});
isBusy(): boolean;
isInputBusy(): boolean;
isOutputBusy(): boolean;
next(value?: A): Channel<A, T>;
emit(value: T): void;
observe(value?: A, ...ops: OperatorFunction<any, any>[]): Observable<T>;
link(observer: Observable<A>, ...ops: OperatorFunction<any, any>[]): void;
pipe(observer: Observable<T>, ...ops: OperatorFunction<any, any>[]): void;
asObservable(): Observable<T>;
observeNotifications(): Observable<ChannelNotification>;
protected emitNotification(notification: ChannelNotification): void;
enable(): Channel<A, T>;
disable(): Channel<A, T>;
close(): void;
}
export declare class ChannelSwitch {
private channels;
constructor(...channels: {
key: any;
channel: Channel<any, any>;
}[]);
set(key: any, channel: Channel<any, any>): Channel<any, any>;
get(key: any): Channel<any, any>;
isBusy(key: any): boolean;
isInputBusy(key: any): boolean;
isOutputBusy(key: any): boolean;
next(key: any, value?: any): Channel<any, any>;
emit(key: any, value: any): false | void;
observe(key: any, value?: any, ...ops: OperatorFunction<any, any>[]): Observable<any>;
link(key: any, observer: Observable<any>, ...ops: OperatorFunction<any, any>[]): void;
pipe(key: any, observer: Observable<any>, ...ops: OperatorFunction<any, any>[]): void;
asObservable(key: any): Observable<any>;
observeNotifications(key: any): Observable<ChannelNotification>;
enable(key: any): Channel<any, any>;
disable(key: any): Channel<any, any>;
close(key: any): void;
}
export interface DSObservableFn {
(value?: any): Observable<any>;
}
export interface DSOperator {
operator: OperatorFunction<any, any>;
id: any;
}
export interface IObserveOptions {
behave: boolean;
}
export interface DSInputOptions {
}
export interface DSOutputOptions {
behave: boolean;
}
export interface DSInputEvent {
id: any;
options?: DSInputOptions;
value?: any;
}
export interface DSEvent {
input: DSInputEvent;
output: any;
}
export declare class DSPipe {
private ds;
private key;
private obs;
private ops;
private enabled;
private sub;
constructor(ds: IObservableDS, key: any, obs: Observable<any>, ops: OperatorFunction<any, any>[], enabled?: boolean);
isConnected(): boolean;
connect(): void;
disconnect(): void;
setOperators(...ops: OperatorFunction<any, any>[]): void;
enable(): void;
disable(): void;
}
export interface IObservableDS {
connect(): void;
isConnected(): boolean;
addObservable(key: any, os: DSObservableFn | Observable<any>, options?: IObserveOptions): void;
next(key: any, value: any, options?: DSInputOptions): void;
observe(key: any, value?: any, options?: DSOutputOptions): Observable<any>;
disconnect(): void;
addPipe(obs: Observable<any>, key: any, ...operators: OperatorFunction<any, any>[]): DSPipe;
asObservable(): Observable<any>;
destroy(): any;
clearPipes(...pipes: DSPipe[]): any;
clearAllPipes(): any;
getPipes(): DSPipe[];
}
export declare class ObservableDS implements IObservableDS {
private connected;
private fnMap;
private subjectMap;
private input$;
private inputSub;
private events$;
private pipes;
constructor(options?: {
autoconnect?: boolean;
key?: any;
obs?: DSObservableFn | Observable<any>;
});
isConnected(): boolean;
connect(): void;
protected relay(event: DSInputEvent, obs: Observable<any>, subject: Subject<any>): void;
protected emit(event: DSEvent): void;
asObservable(): Observable<any>;
disconnect(): void;
next(key: any, value: any, options?: DSInputOptions): void;
addPipe(obs: Observable<any>, key: any, ...operators: OperatorFunction<any, any>[]): DSPipe;
clearPipes(...pipes: DSPipe[]): void;
clearAllPipes(): void;
getPipes(): DSPipe[];
addObservable(key: any, obs: DSObservableFn | Observable<any>, options?: IObserveOptions): void;
observe(key: any, value?: any, options?: DSOutputOptions): Observable<any>;
destroy(): void;
}