import { OnInit, ViewContainerRef, OnDestroy } from "@angular/core"; /** * 方便的定义一个渲染器视图的插槽 */ export declare class JigsawRendererHost { viewContainerRef: ViewContainerRef; constructor(viewContainerRef: ViewContainerRef); } export declare class JigsawCommonModule { } export interface IDynamicInstantiatable { initData: any; } /** * Jigsaw所有的组件都实现这个接口 */ export interface IJigsawComponent { /** * @internal */ basicClass: string; width: string; height: string; maxHeight: string; } /** * 一般来说,应用无需关注此类 */ export declare abstract class AbstractJigsawViewBase implements OnInit, OnDestroy { private _timerCache; /** * Angular的`OnInit`钩子是否已经执行过,是则为true,否则为false。 * 方便子类判断当前组件的状态。 * */ protected initialized: boolean; /** * 延迟一会再执行一些逻辑,用法和`setTimeout`一模一样,差别在于更加安全,当组件被销毁了后, * `setTimeout`里已经设置的逻辑依然会被执行,这在某些特定情况下会造成意外,从而造成组件出错。 * 使用本方法启动的异步逻辑在组件销毁之后,不再被执行。 * */ protected callLater(handler: Function): any; protected callLater(handler: Function, timeout: number): any; protected callLater(handler: Function, context: any): any; protected callLater(handler: Function, context: any, timeout: number): any; /** * 终止`callLater`所发起的异步任务,用法与`clearTimeout`非常类似,但是更加安全, * 可以顺便将`callLater`所缓存的定时器序号删除。 * */ protected clearCallLater(handle: number): void; ngOnInit(): void; ngOnDestroy(): void; /** * 安全的调用一个函数,并返回该函数的返回值。如果该函数执行失败,可以在控制台给出实际的堆栈以协助排查问题 * * @param context 执行函数的上下文 */ safeInvokeCallback(context: any, callback: Function, args?: any[]): any; /** * 参考 `isDefined` * * @param value */ isUndefined(value: any): boolean; /** * 可靠的判断一个值是否有效,输入 `""` 和 `0` 均返回true,只有`null`或者`undefined`才会返回false * * @param value 待测验的值 */ isDefined(value: any): boolean; /** * * @param element * @param selector 支持'.className' '#id' '[attr]' 'tagName' */ getParentNodeBySelector(element: HTMLElement, selector: string): HTMLElement; /** * 把一个值转为px或% * @param value * @returns string */ getCssValue(value: string | number): string; } /** * 一般来说,应用无需关注此类 */ export declare abstract class AbstractJigsawComponent extends AbstractJigsawViewBase implements IJigsawComponent { /** * @internal */ basicClass: string; protected _width: string; protected _height: string; protected _maxHeight: string; width: string; height: string; maxHeight: string; } export interface IJigsawFormControl { valid: boolean; }