Browse Source

KERNEL-6431 fineui描述class化

es6
alan 4 years ago
parent
commit
ed211c2d51
  1. 9
      typescript/base/single/icon/icon.ts
  2. 30
      typescript/base/single/single.ts
  3. 38
      typescript/core/ob.ts
  4. 400
      typescript/core/widget.ts
  5. 12
      typescript/index.ts

9
typescript/base/single/icon/icon.ts

@ -0,0 +1,9 @@
import { Single } from "../single";
export declare class Icon extends Single {
static xtype: string;
_defaultConfig(..._args: any[]): { [key: string]: any } | {};
_init(): void;
}

30
typescript/base/single/single.ts

@ -1,4 +1,4 @@
import { _Widget } from "../../core/widget"; import { Widget, _Widget } from "../../core/widget";
export interface _Single extends _Widget { export interface _Single extends _Widget {
_showToolTip(e: Event, opt?: SingleOpt): void; _showToolTip(e: Event, opt?: SingleOpt): void;
@ -31,3 +31,31 @@ export interface _Single extends _Widget {
interface SingleOpt { interface SingleOpt {
container?: any, belowMouse?: boolean container?: any, belowMouse?: boolean
} }
export declare class Single extends Widget {
_showToolTip(e: Event, opt?: SingleOpt): void;
_hideTooltip(): void;
_clearTimeOut(): void;
enableHover(opt?: SingleOpt): void;
disabledHover(): void;
setTitle(title: string | Function, opt?: SingleOpt): void;
setWarningTitle(title: string, opt?: SingleOpt): void;
setTipType(v: string): void;
getTipType(): string;
isReadOnly(): boolean;
getTitle(): string;
getWarningTitle(): string;
populate(..._args: any[]): void;
}

38
typescript/core/ob.ts

@ -45,3 +45,41 @@ interface Props {
}[]; }[];
[key: string]: any; [key: string]: any;
} }
export declare class OB {
props: Props | (<T>(config: T) => Props & T);
options: this["props"];
events?: {
[eventName: string]: Function[];
};
init?(): void;
destroyed?(): void;
_defaultConfig(..._args: any[]): { [key: string]: any } | {};
_init(): void;
_initListeners(): void;
_getEvents(): { [eventName: string]: Function[] };
on(eventName: string, fn: Function): Function;
once(eventName: string, fn: Function): void;
un(eName: string, fn: Function): void;
_initRef(): void;
_purgeRef(): void;
purgeListeners(): void;
fireEvent(eName: string, ...args: any[]): boolean | null;
destroy(): void;
}

400
typescript/core/widget.ts

@ -1,6 +1,7 @@
import { _OB } from "./ob"; import { OB, _OB } from "./ob";
export interface _WidgetStatic { export interface _WidgetStatic {
/** /**
* *
* @param engine * @param engine
@ -9,22 +10,27 @@ export interface _WidgetStatic {
} }
export interface _Widget extends _OB { export interface _Widget extends _OB {
/** /**
* loading的锁 * loading的锁
*/ */
__asking: boolean; __asking: boolean;
/** /**
* *
*/ */
__async: boolean; __async: boolean;
/** /**
* widget类标识符 * widget类标识符
*/ */
widgetName: string | null; widgetName: string | null;
/** /**
* *
*/ */
_isRoot: boolean; _isRoot: boolean;
/** /**
* *
*/ */
@ -38,24 +44,29 @@ export interface _Widget extends _OB {
height(): number; height(): number;
[key: string]: any; [key: string]: any;
}; };
/** /**
* *
*/ */
_children: { _children: {
[key: string]: _Widget; [key: string]: _Widget;
}; };
/** /**
* *
*/ */
_isMounted: boolean; _isMounted: boolean;
/** /**
* enable * enable
*/ */
_manualSetEnable: boolean; _manualSetEnable: boolean;
/** /**
* valid * valid
*/ */
_manualSetValid: boolean; _manualSetValid: boolean;
/** /**
* *
*/ */
@ -385,8 +396,395 @@ interface RenderEngine {
* @param widget widget对象 * @param widget widget对象
*/ */
createElement: (widget: any) => any; createElement: (widget: any) => any;
/** /**
* DocumentFragment对象 * DocumentFragment对象
*/ */
createFragment: () => DocumentFragment; createFragment: () => DocumentFragment;
} }
export declare class Widget extends OB {
//
/**
*
* @param engine
*/
static registerRenderEngine(engine: RenderEngine): void;
/**
* loading的锁
*/
__asking: boolean;
/**
*
*/
__async: boolean;
/**
* widget类标识符
*/
widgetName: string | null;
/**
*
*/
_isRoot: boolean;
/**
*
*/
_parent: _Widget | null;
// TODO: 完成jquery文件夹后把这块改了
/**
* dom的类jQuery对象
*/
element: {
width(): number;
height(): number;
[key: string]: any;
};
/**
*
*/
_children: {
[key: string]: _Widget;
};
/**
*
*/
_isMounted: boolean;
/**
* enable
*/
_manualSetEnable: boolean;
/**
* valid
*/
_manualSetValid: boolean;
/**
*
*/
_renderEngine: RenderEngine;
_store(): void;
// 生命周期函数
/**
*
*/
beforeInit?(cb: Function): void;
/**
*
*/
beforeCreate?(): void;
/**
*
*/
created?(): void;
/**
*
*/
render?(): any;
/**
*
*/
beforeMount?(): void;
/**
*
*/
mounted?(): void;
/**
*
*/
shouldUpdate?(): void;
/**
*
*/
update?(...args: any[]): void;
/**
*
*/
beforeDestroy?(): void;
/**
*
*/
destroyed?(): void;
/**
* render函数
*/
_initRender: () => void;
/**
* render函数
*/
_render: () => void;
/**
*
*/
_initRoot: () => void;
/**
*
*/
_initElementWidth: () => void;
/**
*
*/
_initElementHeight: () => void;
/**
*
*/
_initVisual: () => void;
/**
*
*/
_initEffects: () => void;
/**
* mounted锁
*/
_initState: () => void;
/**
* dom
*/
_initElement: () => void;
/**
*
*/
_setParent: () => void;
/**
* @param force
* @param deep force处理
* @param lifeHook
* @param predicate widget的回调
*/
_mount(force?: boolean, deep?: boolean, lifeHook?: boolean, predicate?: Function): boolean;
/**
*
*/
_mountChildren?(): void;
/**
*
*/
isMounted(): boolean;
/**
*
*/
setWidth(w: number): void;
/**
*
*/
setHeight(h: number): void;
/**
*
*/
_setEnable(enable: boolean): void;
/**
*
*/
_setValid(valid: boolean): void;
/**
*
*/
_setVisible(visible: boolean): void;
/**
*
*/
setEnable(enable: boolean): void;
/**
*
*/
setVisible(visible: boolean): void;
/**
*
*/
setValid(valid: boolean): void;
/**
*
* @param args arguments参数
*/
doBehavior(...args: any[]): void;
/**
*
*/
getWidth(): number;
/**
*
*/
getHeight(): number;
/**
*
*/
isValid(): boolean;
/**
*
*/
addWidget(_name: any, _widget: _Widget): _Widget;
/**
* wigetname获取子元素实例
*/
getWidgetByName(_name: string): _Widget | undefined;
/**
*
* @param nameOrWidget widgetName或widget实例
*/
removeWidget(nameOrWidget: string | _Widget): void;
/**
*
*/
hasWidget(name: string): boolean;
/**
* widgetName
*/
getName(): string;
/**
* tag
* @param tag html tag
*/
setTag(tag: string): void;
/**
* tag
*/
getTag(): string;
/**
*
* @param key
* @param value
*/
attr(key: string | { [key: string]: any }, value?: any): any;
/**
* text
*/
getText(): string;
/**
* text
*/
setText(text: string): void;
/**
*
*/
getValue(): any;
/**
*
*/
setValue(...args: any[]): void;
/**
* enable
*/
isEnabled(): boolean;
/**
*
*/
isVisible(): boolean;
/**
* disable元素
*/
disable(): void;
/**
* enable元素
*/
enable(): void;
/**
* widget合法
*/
valid(): void;
/**
* 使
*/
invalid(): void;
/**
* 使
*/
invisible(..._args: any[]): void;
/**
*
*/
visible(..._args: any[]): void;
/**
*
*/
__d(): void;
/**
*
*/
_unMount(): void;
/**
* hang元素
*/
isolate(): void;
/**
*
*/
empty(): void;
/**
* destory方法
*/
_destroy(): void;
/**
* destory元素
*/
destroy(): void;
}

12
typescript/index.ts

@ -13,7 +13,7 @@ import { _Checkbox, _CheckboxStatic } from "./base/single/input/checkbox";
import { _Input, _InputStatic } from "./base/single/input/input"; import { _Input, _InputStatic } from "./base/single/input/input";
import { _AbstractLabel } from "./base/single/label/abstract.label"; import { _AbstractLabel } from "./base/single/label/abstract.label";
import { _Label } from "./base/single/label/label"; import { _Label } from "./base/single/label/label";
import { _Single } from "./base/single/single"; import { _Single, Single } from "./base/single/single";
import { _Text } from "./base/single/text"; import { _Text } from "./base/single/text";
import { _Trigger } from "./base/single/trigger/trigger"; import { _Trigger } from "./base/single/trigger/trigger";
import { _IconChangeButton, _IconChangeButtonStatic } from "./case/button/icon/icon.change"; import { _IconChangeButton, _IconChangeButtonStatic } from "./case/button/icon/icon.change";
@ -37,7 +37,7 @@ import { _func } from "./core/func";
import { _i18n } from "./core/i18n"; import { _i18n } from "./core/i18n";
import { _Plugin } from "./core/plugin"; import { _Plugin } from "./core/plugin";
import { _OB } from "./core/ob"; import { _OB } from "./core/ob";
import { _Widget, _WidgetStatic } from "./core/widget"; import { _Widget, _WidgetStatic, Widget } from "./core/widget";
import { _inject } from "./core/inject"; import { _inject } from "./core/inject";
import { _Layout } from "./core/wrapper/layout"; import { _Layout } from "./core/wrapper/layout";
import { _AbsoluteLayout } from "./core/wrapper/layout/layout.absolute"; import { _AbsoluteLayout } from "./core/wrapper/layout/layout.absolute";
@ -45,7 +45,7 @@ import { _HTapeLayout, _VTapeLayout } from "./core/wrapper/layout/layout.tape";
import { _VerticalLayout } from "./core/wrapper/layout/layout.vertical"; import { _VerticalLayout } from "./core/wrapper/layout/layout.vertical";
import { _DefaultLayout } from "./core/wrapper/layout/layout.default"; import { _DefaultLayout } from "./core/wrapper/layout/layout.default";
import { _DownListCombo, _DownListComboStatic } from "./widget/downlist/combo.downlist"; import { _DownListCombo, _DownListComboStatic } from "./widget/downlist/combo.downlist";
import { Icon } from "./base/single/icon/icon";
type ClassConstructor<T extends {}> = T & { type ClassConstructor<T extends {}> = T & {
new(config: any): T; new(config: any): T;
@ -101,8 +101,14 @@ export interface BI extends _func, _i18n, _base, _inject {
DefaultLayout: ClassConstructor<_DefaultLayout>; DefaultLayout: ClassConstructor<_DefaultLayout>;
Input: ClassConstructor<_Input> & _InputStatic; Input: ClassConstructor<_Input> & _InputStatic;
SearchTextValueCombo: ClassConstructor<_SearchTextValueCombo> & _SearchTextValueComboStatic; SearchTextValueCombo: ClassConstructor<_SearchTextValueCombo> & _SearchTextValueComboStatic;
Icon: typeof Icon;
} }
export default { export default {
Decorators: decorator, Decorators: decorator,
}; };
export {
Widget,
Single,
Icon,
};

Loading…
Cancel
Save