Browse Source

Merge pull request #1013 in VISUAL/fineui from ~TELLER/fineui:typescript to master

* commit '2e213af2325712e044fcd17aee6448b953a4edb8':
  KERNEL-859 refactor: 成员属性转成员函数
master
Teller 6 years ago
parent
commit
e5ceadc55e
  1. 28
      typescript/core/ob.ts
  2. 106
      typescript/core/widget.ts

28
typescript/core/ob.ts

@ -13,33 +13,33 @@ export interface _OB {
[eventName: string]: Function[]; [eventName: string]: Function[];
}; };
init: Function | null; init?(): void;
destroyed: Function | null; destroyed?(): void;
_defaultConfig: (..._args: any[]) => { [key: string]: any } | {}; _defaultConfig(..._args: any[]): { [key: string]: any } | {};
_init: () => void; _init(): void;
_initListeners: () => void; _initListeners(): void;
_getEvents: () => { [eventName: string]: Function[] }; _getEvents(): { [eventName: string]: Function[] };
on: (eventName: string, fn: Function) => void; on(eventName: string, fn: Function): void;
once: (eventName: string, fn: Function) => void; once(eventName: string, fn: Function): void;
un: (eName: string, fn: Function) => void; un(eName: string, fn: Function): void;
_initRef: () => void; _initRef(): void;
_purgeRef: () => void; _purgeRef(): void;
purgeListeners: () => void; purgeListeners(): void;
fireEvent: (eName: string, ...args: any[]) => boolean; fireEvent(eName: string, ...args: any[]): boolean | null;
destroy: () => void; destroy(): void;
} }
interface Props { interface Props {

106
typescript/core/widget.ts

@ -8,7 +8,7 @@ export interface WidgetConstructor {
* *
* @param engine * @param engine
*/ */
registerRenderEngine: (engine: RenderEngine) => void; registerRenderEngine(engine: RenderEngine): void;
} }
export interface _Widget extends _OB { export interface _Widget extends _OB {
@ -60,7 +60,7 @@ export interface _Widget extends _OB {
*/ */
_renderEngine: RenderEngine; _renderEngine: RenderEngine;
_store: () => any; _store(): any;
model: any; model: any;
@ -68,52 +68,52 @@ export interface _Widget extends _OB {
/** /**
* *
*/ */
beforeInit: Function | null; beforeInit?(cb: Function): void;
/** /**
* *
*/ */
beforeCreate: Function | null; beforeCreate?(): void;
/** /**
* *
*/ */
created: Function | null; created?(): void;
/** /**
* *
*/ */
render: Function | null; render?(): any;
/** /**
* *
*/ */
beforeMount: Function | null; beforeMount?(): void;
/** /**
* *
*/ */
mounted: Function | null; mounted?(): void;
/** /**
* *
*/ */
shouldUpdate: Function | null; shouldUpdate?(): void;
/** /**
* *
*/ */
update: Function; update?(): void;
/** /**
* *
*/ */
beforeDestroy: Function | null; beforeDestroy?(): void;
/** /**
* *
*/ */
destroyed: Function | null; destroyed?(): void;
/** /**
* render函数 * render函数
@ -171,212 +171,212 @@ export interface _Widget extends _OB {
* @param lifeHook * @param lifeHook
* @param predicate widget的回调 * @param predicate widget的回调
*/ */
_mount: (force?: boolean, deep?: boolean, lifeHook?: boolean, predicate?: Function) => boolean; _mount(force?: boolean, deep?: boolean, lifeHook?: boolean, predicate?: Function): boolean;
/** /**
* *
*/ */
_mountChildren: Function | null; _mountChildren?(): void;
/** /**
* *
*/ */
isMounted: () => boolean; isMounted(): boolean;
/** /**
* *
*/ */
setWidth: (w: number) => void; setWidth(w: number): void;
/** /**
* *
*/ */
setHeight: (h: number) => void; setHeight(h: number): void;
/** /**
* *
*/ */
_setEnable: (enable: boolean) => void; _setEnable(enable: boolean): void;
/** /**
* *
*/ */
_setValid: (valid: boolean) => void; _setValid(valid: boolean): void;
/** /**
* *
*/ */
_setVisible: (visible: boolean) => void; _setVisible(visible: boolean): void;
/** /**
* *
*/ */
setEnable: (enable: boolean) => void; setEnable(enable: boolean): void;
/** /**
* *
*/ */
setVisible: (visible: boolean) => void; setVisible(visible: boolean): void;
/** /**
* *
*/ */
setValid: (valid: boolean) => void; setValid(valid: boolean): void;
/** /**
* *
* @param args arguments参数 * @param args arguments参数
*/ */
doBehavior: (...args: any[]) => void; doBehavior(...args: any[]): void;
/** /**
* *
*/ */
getWidth: () => number; getWidth(): number;
/** /**
* *
*/ */
getHeight: () => number; getHeight(): number;
/** /**
* *
*/ */
isValid: () => boolean; isValid(): boolean;
/** /**
* *
*/ */
addWidget: (_name: any, _widget: _Widget) => _Widget; addWidget(_name: any, _widget: _Widget): _Widget;
/** /**
* wigetname获取子元素实例 * wigetname获取子元素实例
*/ */
getWidgetByName: (_name: string) => _Widget; getWidgetByName(_name: string): _Widget;
/** /**
* *
* @param nameOrWidget widgetName或widget实例 * @param nameOrWidget widgetName或widget实例
*/ */
removeWidget: (nameOrWidget: string | _Widget) => void; removeWidget(nameOrWidget: string | _Widget): void;
/** /**
* *
*/ */
hasWidget: (name: string) => boolean; hasWidget(name: string): boolean;
/** /**
* widgetName * widgetName
*/ */
getName: () => string; getName(): string;
/** /**
* tag * tag
* @param tag html tag * @param tag html tag
*/ */
setTag: (tag: string) => void; setTag(tag: string): void;
/** /**
* tag * tag
*/ */
getTag: () => string; getTag(): string;
/** /**
* *
* @param key * @param key
* @param value * @param value
*/ */
attr: (key: string | { [key: string]: any }, value: any) => any; attr(key: string | { [key: string]: any }, value: any): any;
/** /**
* text * text
*/ */
getText: () => string; getText(): string;
/** /**
* text * text
*/ */
setText: () => void; setText(): void;
/** /**
* *
*/ */
getValue: () => any; getValue(): any;
/** /**
* *
*/ */
setValue: (...args: any[]) => void; setValue(...args: any[]): void;
/** /**
* enable * enable
*/ */
isEnabled: () => boolean; isEnabled(): boolean;
/** /**
* *
*/ */
isVisible: () => boolean; isVisible(): boolean;
/** /**
* disable元素 * disable元素
*/ */
disable: ()=> void; disable(): void;
/** /**
* enable元素 * enable元素
*/ */
enable: () => void; enable(): void;
/** /**
* widget合法 * widget合法
*/ */
valid: () => void; valid(): void;
/** /**
* 使 * 使
*/ */
invalid: () => void; invalid(): void;
/** /**
* 使 * 使
*/ */
invisible: () => void; invisible(): void;
/** /**
* *
*/ */
visible: () => void; visible(): void;
/** /**
* *
*/ */
__d: () => void; __d(): void;
/** /**
* *
*/ */
_unMount: () => void; _unMount(): void;
/** /**
* hang元素 * hang元素
*/ */
isolate: () => void; isolate(): void;
/** /**
* *
*/ */
empty: () => void; empty(): void;
/** /**
* destory方法 * destory方法
*/ */
_destroy: () => void; _destroy(): void;
/** /**
* destory元素 * destory元素
*/ */
destroy: () => void; destroy(): void;
} }
interface RenderEngine { interface RenderEngine {

Loading…
Cancel
Save