Browse Source

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

* commit 'f2ff83f01ce8d7a3ea2fc87331dabe4c740967c6':
  KERNEL-827 feat: widget类
master
Teller 5 years ago
parent
commit
528b4a4dff
  1. 3
      typescript/core/func/date.ts
  2. 5
      typescript/core/func/index.ts
  3. 389
      typescript/core/widget.ts
  4. 4
      typescript/index.ts

3
typescript/core/func/date.ts

@ -88,7 +88,7 @@ export declare type _getWeekEndDate = (date: Date) => Date;
*/
export declare type _print = (date: Date, str: string) => string;
declare type _date = {
export declare type _date = {
getTimezone: _getTimezone;
getMonthDays: _getMonthDays;
getLastDateOfMonth: _getLastDateOfMonth;
@ -105,4 +105,3 @@ declare type _date = {
getWeekEndDate: _getWeekEndDate;
print: _print;
}
export default _date;

5
typescript/core/func/index.ts

@ -2,9 +2,8 @@ import _array from "./array";
import _string from "./string";
import _number from "./number";
import _function from "./function";
import _date, {_Date} from "./date";
import { _Date } from "./date";
interface _func extends _array, _string, _number, _function {
export interface _func extends _array, _string, _number, _function {
Date: _Date;
}
export default _func;

389
typescript/core/widget.ts

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

4
typescript/index.ts

@ -1,8 +1,10 @@
import { _i18n } from "./core/i18n";
import { _OB } from "./core/ob";
import _func from "./core/func";
import { _func } from "./core/func";
import { _Widget } from "./core/widget";
export interface BI extends _func {
i18n: _i18n;
OB: _OB;
Widget: _Widget;
}
Loading…
Cancel
Save