UNPKG

@neocomplexx/ngx-neo-directives

Version:

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.0.5.

102 lines (101 loc) 3.08 kB
import { OnInit, OnDestroy, ElementRef, InjectionToken, Renderer2 } from '@angular/core'; import { Observable, BehaviorSubject } from 'rxjs'; export declare const COMMAND_CONFIG: InjectionToken<string>; export declare const COMMAND_DEFAULT_CONFIG: CommandOptions; /** * * ### Example with options * ```html * <button [command]='saveCmd' [commandOptions]='{executingCssClass: 'in-progress'}'>Save</button> * ``` */ export declare class CommandDirective implements OnInit, OnDestroy { private renderer; private element; command: ICommand; commandOptions: CommandOptions; commandCanExecute: boolean; commandValue: any; stopPropagation: boolean; commandNextFocus: any; setEnabled: boolean; private canExecute$$; private isExecuting$$; private config; private ownDisabledState; private commandDisabledChanged; constructor(renderer: Renderer2, element: ElementRef); ngOnInit(): void; executeCommand(): void; ngOnDestroy(): void; private isMobileOperatingSystem; } export interface CommandOptions { /** * Css Class which gets added/removed on the Command element's host while Command isExecuting$. * */ executingCssClass: string; } export interface ICommand { executingParam: any; /** * Determines whether the command is currently executing. */ isExecuting: boolean; isExecuting$?: Observable<boolean>; /** * Determines whether the command can execute or not. */ canExecute: boolean; canExecute$?: Observable<boolean>; /** * Execute function to invoke. */ execute(value?: any): void; /** * Execute function to invoke and return a result in Promise. */ executeWithResult(value?: any): Promise<any>; /** * Disposes all resources held by subscriptions. */ destroy(): void; verifyCommandExecutionPipe(): any; setNextFocus(element: any): any; setEnabledValue(enable: boolean): any; } /** * Command object used to encapsulate information which is needed to perform an action. */ export declare class Command implements ICommand { private executeParam; private isAsync?; private delay?; isExecuting: boolean; isExecuting$: BehaviorSubject<boolean>; canExecute: boolean; canExecute$: Observable<boolean>; private executionPipe$; private isExecuting$$; private canExecute$$; private executionPipe$$; private elementNextFocus; result: Promise<any>; asyncAction: (any: any) => any; resultAsyncAction: any; executingParam: any; private delaySubscribe; private setEnabled; /** * Creates an instance of Command. */ constructor(executeParam: (any?: any) => any, canExecute$?: Observable<boolean>, isAsync?: boolean, delay?: number); verifyCommandExecutionPipe(): void; execute(value?: any): void; executeWithResult(value?: any): Promise<any>; destroy(): void; private buildExecutionPipe; setNextFocus(element: any): void; setEnabledValue(enabled: any): void; }