From d27b4999c2d50d01d11ba6fcad9e9cd3067af47a Mon Sep 17 00:00:00 2001 From: iapyang Date: Fri, 27 Mar 2020 14:24:03 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=94=B9=E4=B8=BAclass=E5=BD=A2?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typescript/base/combination/combo.ts | 24 ++-- typescript/base/combination/group.button.ts | 21 ++- typescript/base/combination/tab.ts | 8 +- typescript/base/pane.ts | 8 +- typescript/base/single/button/button.basic.ts | 10 +- .../base/single/button/buttons/button.text.ts | 8 +- .../base/single/button/buttons/button.ts | 8 +- .../single/button/listitem/icontextitem.ts | 8 +- typescript/base/single/editor/editor.ts | 42 +++--- typescript/base/single/input/checkbox.ts | 8 +- .../base/single/label/abstract.label.ts | 4 +- typescript/base/single/label/label.ts | 4 +- typescript/base/single/single.ts | 4 +- typescript/base/single/text.ts | 4 +- typescript/base/single/trigger/trigger.ts | 6 +- typescript/case/button/icon/icon.change.ts | 8 +- typescript/case/button/item.multiselect.ts | 8 +- .../case/combo/bubblecombo/combo.bubble.ts | 24 ++-- typescript/case/combo/combo.textvalue.ts | 8 +- typescript/case/editor/editor.sign.ts | 4 +- typescript/case/loading/loading_pane.ts | 4 +- .../allvalue.multitextvalue.combo.ts | 8 +- typescript/core/action/action.show.ts | 6 +- typescript/core/action/action.ts | 10 +- typescript/core/base.ts | 4 +- .../core/behavior/behavior.highlight.ts | 6 +- typescript/core/behavior/behavior.redmark.ts | 6 +- typescript/core/behavior/behavior.ts | 10 +- typescript/core/i18n.ts | 2 +- typescript/core/ob.ts | 4 +- typescript/core/widget.ts | 28 ++-- typescript/core/wrapper/layout.ts | 4 +- typescript/core/wrapper/layout/layout.tape.ts | 6 +- typescript/index.ts | 136 +++++++++--------- 34 files changed, 205 insertions(+), 248 deletions(-) diff --git a/typescript/base/combination/combo.ts b/typescript/base/combination/combo.ts index a9f6d4a3aa..61063b064b 100644 --- a/typescript/base/combination/combo.ts +++ b/typescript/base/combination/combo.ts @@ -1,6 +1,6 @@ -import { _Widget } from "../../core/widget"; +import { Widget } from "../../core/widget"; -export interface _Combo extends _Widget { +export declare class Combo extends Widget { populate(items: any): void; _setEnable(v: boolean): void; @@ -16,16 +16,14 @@ export interface _Combo extends _Widget { getPopupPosition(): any; toggle(): void; -} -export interface _ComboStatic { - EVENT_TRIGGER_CHANGE: string; - EVENT_CHANGE: string; - EVENT_EXPAND: string; - EVENT_COLLAPSE: string; - EVENT_AFTER_INIT: string; - EVENT_BEFORE_POPUPVIEW: string; - EVENT_AFTER_POPUPVIEW: string; - EVENT_BEFORE_HIDEVIEW: string; - EVENT_AFTER_HIDEVIEW: string; + static EVENT_TRIGGER_CHANGE: string; + static EVENT_CHANGE: string; + static EVENT_EXPAND: string; + static EVENT_COLLAPSE: string; + static EVENT_AFTER_INIT: string; + static EVENT_BEFORE_POPUPVIEW: string; + static EVENT_AFTER_POPUPVIEW: string; + static EVENT_BEFORE_HIDEVIEW: string; + static EVENT_AFTER_HIDEVIEW: string; } diff --git a/typescript/base/combination/group.button.ts b/typescript/base/combination/group.button.ts index 639568de06..9308626f84 100644 --- a/typescript/base/combination/group.button.ts +++ b/typescript/base/combination/group.button.ts @@ -1,6 +1,6 @@ -import { _Widget } from "../../core/widget"; +import { Widget } from "../../core/widget"; -export interface _ButtonGroup extends _Widget { +export declare class ButtonGroup extends Widget { prependItems(items: T[]): void; addItems(items: T[]): void; @@ -32,16 +32,11 @@ export interface _ButtonGroup extends _Widget { getNodeByValue(value: any): any; getValue(): T[]; -} - -export interface _ButtonGroupChooseType { - CHOOSE_TYPE_SINGLE: number; - CHOOSE_TYPE_MULTI: number; - CHOOSE_TYPE_ALL: number; - CHOOSE_TYPE_NONE: number; - CHOOSE_TYPE_DEFAULT: number; -} -export interface _ButtonGroupStatic { - EVENT_CHANGE: string; + static CHOOSE_TYPE_SINGLE: number; + static CHOOSE_TYPE_MULTI: number; + static CHOOSE_TYPE_ALL: number; + static CHOOSE_TYPE_NONE: number; + static CHOOSE_TYPE_DEFAULT: number; + static EVENT_CHANGE: string; } diff --git a/typescript/base/combination/tab.ts b/typescript/base/combination/tab.ts index cf3f04203a..6df8368a19 100644 --- a/typescript/base/combination/tab.ts +++ b/typescript/base/combination/tab.ts @@ -1,6 +1,6 @@ -import { _Widget } from "../../core/widget"; +import { Widget } from "../../core/widget"; -export interface _Tab extends _Widget { +export declare class Tab extends Widget { setSelect(v: string | number): void; removeTab(v: string | number): void; @@ -12,8 +12,6 @@ export interface _Tab extends _Widget { getTab(v: string | number): any; populate(): void; -} -export interface _TabStatic { - EVENT_CHANGE: string; + static EVENT_CHANGE: string; } diff --git a/typescript/base/pane.ts b/typescript/base/pane.ts index 75c3fc9f0f..aeb710d8fc 100644 --- a/typescript/base/pane.ts +++ b/typescript/base/pane.ts @@ -1,12 +1,10 @@ -import { _Widget } from "../core/widget"; +import { Widget } from "../core/widget"; -export interface _Pane extends _Widget { +export declare class Pane extends Widget { _assertTip: (..._args: any[]) => void; loading: (..._args: any[]) => void; loaded: (..._args: any[]) => void; check: (..._args: any[]) => void; -} -export interface _PaneStatic { - EVENT_LOADED: string; + static EVENT_LOADED: string; } diff --git a/typescript/base/single/button/button.basic.ts b/typescript/base/single/button/button.basic.ts index 741c82358e..eba3852d28 100644 --- a/typescript/base/single/button/button.basic.ts +++ b/typescript/base/single/button/button.basic.ts @@ -1,6 +1,6 @@ -import { _Single } from "../single"; +import { Single } from "../single"; -export interface _BasicButton extends _Single { +export declare class BasicButton extends Single { _createShadow(): void; bindEvent(): void; @@ -13,7 +13,7 @@ export interface _BasicButton extends _Single { doClick(): void; - handle(): _BasicButton; + handle(): BasicButton; hover(): void; @@ -34,8 +34,6 @@ export interface _BasicButton extends _Single { setText(v: string): void; getText(): string; -} -export interface _BasicButtonStatic { - EVENT_CHANGE: string; + static EVENT_CHANGE: string; } diff --git a/typescript/base/single/button/buttons/button.text.ts b/typescript/base/single/button/buttons/button.text.ts index ffc25fd2fe..737f47b93c 100644 --- a/typescript/base/single/button/buttons/button.text.ts +++ b/typescript/base/single/button/buttons/button.text.ts @@ -1,6 +1,6 @@ -import { _BasicButton } from "../button.basic"; +import { BasicButton } from "../button.basic"; -export interface _TextButton extends _BasicButton { +export declare class TextButton extends BasicButton { setStyle(style: any): void; doRedMark(...args: any[]): void; @@ -10,8 +10,6 @@ export interface _TextButton extends _BasicButton { doHighLight(...args: any[]): void; unHighLight(...args: any[]): void; -} -export interface _TextButtonStatic { - EVENT_CHANGE: string; + static EVENT_CHANGE: string; } diff --git a/typescript/base/single/button/buttons/button.ts b/typescript/base/single/button/buttons/button.ts index 2d4e171f0b..19de3b1343 100644 --- a/typescript/base/single/button/buttons/button.ts +++ b/typescript/base/single/button/buttons/button.ts @@ -1,6 +1,6 @@ -import { _BasicButton } from "../button.basic"; +import { BasicButton } from "../button.basic"; -export interface _Button extends _BasicButton { +export declare class Button extends BasicButton { doRedMark(...args: any[]): void; unRedMark(...args: any[]): void; @@ -8,8 +8,6 @@ export interface _Button extends _BasicButton { doHighLight(...args: any[]): void; unHighLight(...args: any[]): void; -} -export interface _ButtonStatic { - EVENT_CHANGE: string; + static EVENT_CHANGE: string; } diff --git a/typescript/base/single/button/listitem/icontextitem.ts b/typescript/base/single/button/listitem/icontextitem.ts index 80d7d40bd0..e79be37ffa 100644 --- a/typescript/base/single/button/listitem/icontextitem.ts +++ b/typescript/base/single/button/listitem/icontextitem.ts @@ -1,6 +1,6 @@ -import { _BasicButton } from "../button.basic"; +import { BasicButton } from "../button.basic"; -export interface _IconTextItem extends _BasicButton { +export declare class IconTextItem extends BasicButton { doRedMark(...args: any[]): void; unRedMark(...args: any[]): void; @@ -8,8 +8,6 @@ export interface _IconTextItem extends _BasicButton { doHighLight(...args: any[]): void; unHighLight(...args: any[]): void; -} -export interface _IconTextItemStatic { - EVENT_CHANGE: string; + static EVENT_CHANGE: string; } diff --git a/typescript/base/single/editor/editor.ts b/typescript/base/single/editor/editor.ts index 47506acc13..b580990f55 100644 --- a/typescript/base/single/editor/editor.ts +++ b/typescript/base/single/editor/editor.ts @@ -1,6 +1,6 @@ -import { _Single } from "../single"; +import { Single } from "../single"; -export interface _Editor extends _Single { +export declare class Editor extends Single { setErrorText(v: string): void; getErrorText(): string; @@ -32,25 +32,23 @@ export interface _Editor extends _Single { isEditing(): boolean; isValid(): boolean; -} -export interface _EditorStatic { - EVENT_CHANGE: string; - EVENT_FOCUS: string; - EVENT_BLUR: string; - EVENT_CLICK: string; - EVENT_KEY_DOWN: string; - EVENT_SPACE: string; - EVENT_BACKSPACE: string; - EVENT_START: string; - EVENT_PAUSE: string; - EVENT_STOP: string; - EVENT_CONFIRM: string; - EVENT_CHANGE_CONFIRM: string; - EVENT_VALID: string; - EVENT_ERROR: string; - EVENT_ENTER: string; - EVENT_RESTRICT: string; - EVENT_REMOVE: string; - EVENT_EMPTY: string; + static EVENT_CHANGE: string; + static EVENT_FOCUS: string; + static EVENT_BLUR: string; + static EVENT_CLICK: string; + static EVENT_KEY_DOWN: string; + static EVENT_SPACE: string; + static EVENT_BACKSPACE: string; + static EVENT_START: string; + static EVENT_PAUSE: string; + static EVENT_STOP: string; + static EVENT_CONFIRM: string; + static EVENT_CHANGE_CONFIRM: string; + static EVENT_VALID: string; + static EVENT_ERROR: string; + static EVENT_ENTER: string; + static EVENT_RESTRICT: string; + static EVENT_REMOVE: string; + static EVENT_EMPTY: string; } diff --git a/typescript/base/single/input/checkbox.ts b/typescript/base/single/input/checkbox.ts index b1a367b8bb..2245f6f12d 100644 --- a/typescript/base/single/input/checkbox.ts +++ b/typescript/base/single/input/checkbox.ts @@ -1,9 +1,7 @@ -import { _BasicButton } from "../button/button.basic"; +import { BasicButton } from "../button/button.basic"; -export interface _Checkbox extends _BasicButton { +export declare class Checkbox extends BasicButton { _setEnable(enable: boolean): void; -} -export interface _CheckboxStatic { - EVENT_CHANGE: string; + static EVENT_CHANGE: string; } diff --git a/typescript/base/single/label/abstract.label.ts b/typescript/base/single/label/abstract.label.ts index d0a39476c9..228b93d81d 100644 --- a/typescript/base/single/label/abstract.label.ts +++ b/typescript/base/single/label/abstract.label.ts @@ -1,6 +1,6 @@ -import { _Single } from "../single"; +import { Single } from "../single"; -export interface _AbstractLabel extends _Single { +export declare class AbstractLabel extends Single { doRedMark(...args: any[]): void; unRedMark(...args: any[]): void; diff --git a/typescript/base/single/label/label.ts b/typescript/base/single/label/label.ts index 03f5f2e38d..05099d693a 100644 --- a/typescript/base/single/label/label.ts +++ b/typescript/base/single/label/label.ts @@ -1,6 +1,6 @@ -import { _AbstractLabel } from "./abstract.label"; +import { AbstractLabel } from "./abstract.label"; -export interface _Label extends _AbstractLabel { +export declare class Label extends AbstractLabel { doRedMark(...args: any[]): void; unRedMark(...args: any[]): void diff --git a/typescript/base/single/single.ts b/typescript/base/single/single.ts index d9ce67e79e..c47304e8d2 100644 --- a/typescript/base/single/single.ts +++ b/typescript/base/single/single.ts @@ -1,6 +1,6 @@ -import { _Widget } from "../../core/widget"; +import { Widget } from "../../core/widget"; -export interface _Single extends _Widget { +export declare class Single extends Widget { _showToolTip(e: Event, opt?: SingleOpt): void; _hideTooltip(): void; diff --git a/typescript/base/single/text.ts b/typescript/base/single/text.ts index 5763ac7e67..b5bab24754 100644 --- a/typescript/base/single/text.ts +++ b/typescript/base/single/text.ts @@ -1,6 +1,6 @@ -import { _Single } from "./single"; +import { Single } from "./single"; -export interface _Text extends _Single { +export declare class Text extends Single { doRedMark(keyword: string): void; unRedMark(): void; diff --git a/typescript/base/single/trigger/trigger.ts b/typescript/base/single/trigger/trigger.ts index 48f2a055ac..abf3a96dc6 100644 --- a/typescript/base/single/trigger/trigger.ts +++ b/typescript/base/single/trigger/trigger.ts @@ -1,7 +1,7 @@ -import { _Single } from "../single"; +import { Single } from "../single"; -export interface _Trigger extends _Single { +export declare class Trigger extends Single { setKey(..._args: any[]): void; getKey(): string; -} \ No newline at end of file +} diff --git a/typescript/case/button/icon/icon.change.ts b/typescript/case/button/icon/icon.change.ts index 2cb609bcc3..7f136c8b60 100644 --- a/typescript/case/button/icon/icon.change.ts +++ b/typescript/case/button/icon/icon.change.ts @@ -1,13 +1,11 @@ -import { _Single } from "../../../base/single/single"; +import { Single } from "../../../base/single/single"; -export interface _IconChangeButton extends _Single { +export declare class IconChangeButton extends Single { isSelected(): boolean; setSelected(v: boolean): void; setIcon(cls: string): void; -} -export interface _IconChangeButtonStatic { - EVENT_CHANGE: string; + static EVENT_CHANGE: string; } diff --git a/typescript/case/button/item.multiselect.ts b/typescript/case/button/item.multiselect.ts index 8f342dd2e3..63a0019b53 100644 --- a/typescript/case/button/item.multiselect.ts +++ b/typescript/case/button/item.multiselect.ts @@ -1,6 +1,6 @@ -import { _BasicButton } from "../../base/single/button/button.basic"; +import { BasicButton } from "../../base/single/button/button.basic"; -export interface _MultiSelectItem extends _BasicButton { +export declare class MultiSelectItem extends BasicButton { doClick(...args: any[]): void; doRedMark(...args: any[]): void; @@ -8,8 +8,6 @@ export interface _MultiSelectItem extends _BasicButton { unRedMark(...args: any[]): void; setSelected(v: boolean): void; -} -export interface _MultiSelectItemStatic { - EVENT_CHANGE: string; + static EVENT_CHANGE: string; } diff --git a/typescript/case/combo/bubblecombo/combo.bubble.ts b/typescript/case/combo/bubblecombo/combo.bubble.ts index e9afaa7608..a1c2681c9d 100644 --- a/typescript/case/combo/bubblecombo/combo.bubble.ts +++ b/typescript/case/combo/bubblecombo/combo.bubble.ts @@ -1,21 +1,19 @@ -import { _Widget } from "../../../core/widget"; +import { Widget } from "../../../core/widget"; -export interface _BubbleCombo extends _Widget { +export declare class BubbleCombo extends Widget { hideView(): void; showView(): void; isViewVisible(): boolean; -} -export interface _BubbleComboStatic { - EVENT_TRIGGER_CHANGE: string; - EVENT_CHANGE: string; - EVENT_EXPAND: string; - EVENT_COLLAPSE: string; - EVENT_AFTER_INIT: string; - EVENT_BEFORE_POPUPVIEW: string; - EVENT_AFTER_POPUPVIEW: string; - EVENT_BEFORE_HIDEVIEW: string; - EVENT_AFTER_HIDEVIEW: string; + static EVENT_TRIGGER_CHANGE: string; + static EVENT_CHANGE: string; + static EVENT_EXPAND: string; + static EVENT_COLLAPSE: string; + static EVENT_AFTER_INIT: string; + static EVENT_BEFORE_POPUPVIEW: string; + static EVENT_AFTER_POPUPVIEW: string; + static EVENT_BEFORE_HIDEVIEW: string; + static EVENT_AFTER_HIDEVIEW: string; } diff --git a/typescript/case/combo/combo.textvalue.ts b/typescript/case/combo/combo.textvalue.ts index 4b933a6821..b7f9a79ef1 100644 --- a/typescript/case/combo/combo.textvalue.ts +++ b/typescript/case/combo/combo.textvalue.ts @@ -1,9 +1,7 @@ -import { _Widget } from "../../core/widget"; +import { Widget } from "../../core/widget"; -export interface _TextValueCombo extends _Widget { +export declare class TextValueCombo extends Widget { populate(items: any): void; -} -export interface _TextValueComboStatic { - EVENT_CHANGE: string; + static EVENT_CHANGE: string; } diff --git a/typescript/case/editor/editor.sign.ts b/typescript/case/editor/editor.sign.ts index 906941933e..c95009f45e 100644 --- a/typescript/case/editor/editor.sign.ts +++ b/typescript/case/editor/editor.sign.ts @@ -1,6 +1,6 @@ -import { _Widget } from "../../core/widget"; +import { Widget } from "../../core/widget"; -export interface _SignEditor extends _Widget { +export declare class SignEditor extends Widget { setTitle(v: string | Function): void; setWarningTitle(v: string | Function): void; diff --git a/typescript/case/loading/loading_pane.ts b/typescript/case/loading/loading_pane.ts index 35c0d3aa5f..362c8f1b4f 100644 --- a/typescript/case/loading/loading_pane.ts +++ b/typescript/case/loading/loading_pane.ts @@ -1,5 +1,5 @@ -import { _Pane } from "../../base/pane"; +import { Pane } from "../../base/pane"; -export interface _LoadingPane extends _Pane { +export declare class LoadingPane extends Pane { __loaded: (...args: any[]) => void; } diff --git a/typescript/component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo.ts b/typescript/component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo.ts index 18d43e591d..c1aeab7480 100644 --- a/typescript/component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo.ts +++ b/typescript/component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo.ts @@ -1,11 +1,9 @@ -import { _Widget } from "../../core/widget"; +import { Widget } from "../../core/widget"; -export interface _AllValueMultiTextValueCombo extends _Widget { +export declare class AllValueMultiTextValueCombo extends Widget { getValue(): T[]; populate(items: any): void; -} -export interface _AllValueMultiTextValueComboStatic { - EVENT_CONFIRM: string; + static EVENT_CONFIRM: string; } diff --git a/typescript/core/action/action.show.ts b/typescript/core/action/action.show.ts index b14456a8e3..9ea21688f8 100644 --- a/typescript/core/action/action.show.ts +++ b/typescript/core/action/action.show.ts @@ -1,5 +1,5 @@ -import { _Action } from "./action"; +import { Action } from "./action"; -export interface _ShowAction extends _Action { +export declare class ShowAction extends Action { -} \ No newline at end of file +} diff --git a/typescript/core/action/action.ts b/typescript/core/action/action.ts index a7b2989820..c3d439ffa9 100644 --- a/typescript/core/action/action.ts +++ b/typescript/core/action/action.ts @@ -1,11 +1,11 @@ -import { _OB } from "../ob"; +import { OB } from "../ob"; -export interface _Action extends _OB { +export declare class Action extends OB { actionPerformed(src: any, tar: any, callback: Function): void; actionBack(tar: any, src: any, callback: Function): void; } -export interface _ActionFactory { - createAction(key: string, options: any): _Action; -} \ No newline at end of file +export declare class ActionFactory { + createAction(key: string, options: any): Action; +} diff --git a/typescript/core/base.ts b/typescript/core/base.ts index 5902544bde..916ad425b2 100644 --- a/typescript/core/base.ts +++ b/typescript/core/base.ts @@ -1,4 +1,4 @@ -import { _Widget } from "./widget"; +import { Widget } from "./widget"; export interface _base { assert: (v: any, is: Function) => Boolean @@ -7,7 +7,7 @@ export interface _base { UUID: () => string; - isWidget: (widget: any) => widget is _Widget; + isWidget: (widget: any) => widget is Widget; createWidgets: (items: any, options: any, context: any) => any; diff --git a/typescript/core/behavior/behavior.highlight.ts b/typescript/core/behavior/behavior.highlight.ts index 6f9f328994..3e66d9447c 100644 --- a/typescript/core/behavior/behavior.highlight.ts +++ b/typescript/core/behavior/behavior.highlight.ts @@ -1,4 +1,4 @@ -import { _Behavior } from "./behavior"; -export interface _HighlightBehavior extends _Behavior { +import { Behavior } from "./behavior"; +export declare class HighlightBehavior extends Behavior { -} \ No newline at end of file +} diff --git a/typescript/core/behavior/behavior.redmark.ts b/typescript/core/behavior/behavior.redmark.ts index 2bdc3f9559..45d402a5b5 100644 --- a/typescript/core/behavior/behavior.redmark.ts +++ b/typescript/core/behavior/behavior.redmark.ts @@ -1,4 +1,4 @@ -import { _Behavior } from "./behavior"; -export interface _RedMarkBehavior extends _Behavior { +import { Behavior } from "./behavior"; +export declare class RedMarkBehavior extends Behavior { -} \ No newline at end of file +} diff --git a/typescript/core/behavior/behavior.ts b/typescript/core/behavior/behavior.ts index 9af876f036..7c62fd3bd4 100644 --- a/typescript/core/behavior/behavior.ts +++ b/typescript/core/behavior/behavior.ts @@ -1,9 +1,9 @@ -import { _OB } from "../ob"; +import { OB } from "../ob"; -export interface _Behavior extends _OB { +export declare class Behavior extends OB { doBehavior(items: any[]): void; } -export interface _BehaviorFactory { - createBehavior(key: string, options: any): _Behavior; -} \ No newline at end of file +export declare class BehaviorFactory { + createBehavior(key: string, options: any): Behavior; +} diff --git a/typescript/core/i18n.ts b/typescript/core/i18n.ts index 79903578a3..7ab48affe7 100644 --- a/typescript/core/i18n.ts +++ b/typescript/core/i18n.ts @@ -5,4 +5,4 @@ export type _i18nText = (key: string, ..._args: any[]) => string; export type _i18n = { addI18n: _addI18n; i18nText: _i18nText; -} \ No newline at end of file +} diff --git a/typescript/core/ob.ts b/typescript/core/ob.ts index 16ce71024d..3fe1b4ac41 100644 --- a/typescript/core/ob.ts +++ b/typescript/core/ob.ts @@ -1,4 +1,4 @@ -export interface _OB { +export declare class OB { props: Props | ((config: T) => Props & T); options: this["props"]; @@ -40,7 +40,7 @@ interface Props { listeners?: { eventName: string; action: (...args: any[]) => any; - target?: _OB; + target?: typeof OB; once?: boolean; }[]; [key: string]: any; diff --git a/typescript/core/widget.ts b/typescript/core/widget.ts index c2b307bfb4..dd1f1ade83 100644 --- a/typescript/core/widget.ts +++ b/typescript/core/widget.ts @@ -1,14 +1,6 @@ -import { _OB } from "./ob"; +import { OB } from "./ob"; -export interface _WidgetStatic { - /** - * 注册渲染引擎 - * @param engine 引擎 - */ - registerRenderEngine(engine: RenderEngine): void; -} - -export interface _Widget extends _OB { +export declare class Widget extends OB { /** * 出现loading的锁 */ @@ -28,7 +20,7 @@ export interface _Widget extends _OB { /** * 父节点 */ - _parent: _Widget | null; + _parent: Widget | null; // TODO: 完成jquery文件夹后把这块改了 /** * 真实dom的类jQuery对象 @@ -42,7 +34,7 @@ export interface _Widget extends _OB { * 子元素 */ _children: { - [key: string]: _Widget; + [key: string]: Widget; }; /** * 是否已挂载 @@ -246,18 +238,18 @@ export interface _Widget extends _OB { /** * 新增子元素 */ - addWidget(_name: any, _widget: _Widget): _Widget; + addWidget(_name: any, _widget: Widget): Widget; /** * 根据wigetname获取子元素实例 */ - getWidgetByName(_name: string): _Widget | undefined; + getWidgetByName(_name: string): Widget | undefined; /** * 移除子元素 * @param nameOrWidget widgetName或widget实例 */ - removeWidget(nameOrWidget: string | _Widget): void; + removeWidget(nameOrWidget: string | Widget): void; /** * 是否有某个子元素 @@ -376,6 +368,12 @@ export interface _Widget extends _OB { * destory元素 */ destroy(): void; + + /** + * 注册渲染引擎 + * @param engine 引擎 + */ + static registerRenderEngine(engine: RenderEngine): void; } interface RenderEngine { diff --git a/typescript/core/wrapper/layout.ts b/typescript/core/wrapper/layout.ts index c145446bdf..c6ec17d0e0 100644 --- a/typescript/core/wrapper/layout.ts +++ b/typescript/core/wrapper/layout.ts @@ -1,6 +1,6 @@ -import { _Widget } from "../widget"; +import { Widget } from "../widget"; -export interface _Layout extends _Widget { +export declare class Layout extends Widget { addItem(item: any): any; prependItem(item: any): any; diff --git a/typescript/core/wrapper/layout/layout.tape.ts b/typescript/core/wrapper/layout/layout.tape.ts index fbd7c0ed4d..f7c06ebd93 100644 --- a/typescript/core/wrapper/layout/layout.tape.ts +++ b/typescript/core/wrapper/layout/layout.tape.ts @@ -1,6 +1,6 @@ -import { _Layout } from "../layout"; +import { Layout } from "../layout"; -export interface _HTapeLayout extends _Layout { +export declare class HTapeLayout extends Layout { resize(): void; stroke(items: T[]): void; @@ -10,7 +10,7 @@ export interface _HTapeLayout extends _Layout { populate(items?: T[]): void; } -export interface _VTapeLayout extends _Layout { +export declare class VTapeLayout extends Layout { resize(): void; stroke(items: T[]): void; diff --git a/typescript/index.ts b/typescript/index.ts index 7c04aaf23a..883c659d37 100644 --- a/typescript/index.ts +++ b/typescript/index.ts @@ -1,81 +1,73 @@ -import { _Combo, _ComboStatic } from "./base/combination/combo"; -import { _ButtonGroup, _ButtonGroupChooseType, _ButtonGroupStatic } from "./base/combination/group.button"; -import { _Tab, _TabStatic } from "./base/combination/tab"; -import { _Pane, _PaneStatic } from "./base/pane"; -import { _BasicButton, _BasicButtonStatic } from "./base/single/button/button.basic"; -import { _Button, _ButtonStatic } from "./base/single/button/buttons/button"; -import { _TextButton, _TextButtonStatic } from "./base/single/button/buttons/button.text"; -import { _IconTextItem, _IconTextItemStatic } from "./base/single/button/listitem/icontextitem"; -import { _Editor, _EditorStatic } from "./base/single/editor/editor"; -import { _Checkbox, _CheckboxStatic } from "./base/single/input/checkbox"; -import { _AbstractLabel } from "./base/single/label/abstract.label"; -import { _Label } from "./base/single/label/label"; -import { _Single } from "./base/single/single"; -import { _Text } from "./base/single/text"; -import { _Trigger } from "./base/single/trigger/trigger"; -import { _IconChangeButton, _IconChangeButtonStatic } from "./case/button/icon/icon.change"; -import { _MultiSelectItem, _MultiSelectItemStatic } from "./case/button/item.multiselect"; -import { _BubbleCombo, _BubbleComboStatic } from "./case/combo/bubblecombo/combo.bubble"; -import { _TextValueCombo, _TextValueComboStatic } from "./case/combo/combo.textvalue"; -import { _SignEditor, _SignEditorStatic } from "./case/editor/editor.sign"; -import { _LoadingPane } from "./case/loading/loading_pane"; -import { _AllValueMultiTextValueCombo, _AllValueMultiTextValueComboStatic } from "./component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo"; -import { _Action, _ActionFactory } from "./core/action/action"; -import { _ShowAction } from "./core/action/action.show"; import { _base } from "./core/base"; -import { _Behavior, _BehaviorFactory } from "./core/behavior/behavior"; -import { _HighlightBehavior } from "./core/behavior/behavior.highlight"; -import { _RedMarkBehavior } from "./core/behavior/behavior.redmark"; import * as decorator from "./core/decorator/decorator"; import { _func } from "./core/func"; import { _i18n } from "./core/i18n"; -import { _OB } from "./core/ob"; -import { _Widget, _WidgetStatic } from "./core/widget"; -import { _Layout } from "./core/wrapper/layout"; -import { _HTapeLayout, _VTapeLayout } from "./core/wrapper/layout/layout.tape"; - - -type ClassConstructor = T & { - new(config: any): T; - (config: any): T; - readonly prototype: T; -} +import { OB } from "./core/ob"; +import { Widget } from "./core/widget"; +import { Single } from "./base/single/single"; +import { BasicButton } from "./base/single/button/button.basic"; +import { Checkbox } from "./base/single/input/checkbox"; +import { Button } from "./base/single/button/buttons/button"; +import { TextButton } from "./base/single/button/buttons/button.text"; +import { IconChangeButton } from "./case/button/icon/icon.change"; +import { Trigger } from "./base/single/trigger/trigger"; +import { Action, ActionFactory } from "./core/action/action"; +import { ShowAction } from "./core/action/action.show"; +import { Behavior, BehaviorFactory } from "./core/behavior/behavior"; +import { HighlightBehavior } from "./core/behavior/behavior.highlight"; +import { RedMarkBehavior } from "./core/behavior/behavior.redmark"; +import { Pane } from "./base/pane"; +import { LoadingPane } from "./case/loading/loading_pane"; +import { Tab } from "./base/combination/tab"; +import { ButtonGroup } from "./base/combination/group.button"; +import { Combo } from "./base/combination/combo"; +import { TextValueCombo } from "./case/combo/combo.textvalue"; +import { BubbleCombo } from "./case/combo/bubblecombo/combo.bubble"; +import { AllValueMultiTextValueCombo } from "./component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo"; +import { IconTextItem } from "./base/single/button/listitem/icontextitem"; +import { MultiSelectItem } from "./case/button/item.multiselect"; +import { AbstractLabel } from "./base/single/label/abstract.label"; +import { Label } from "./base/single/label/label"; +import { Editor } from "./base/single/editor/editor"; +import { SignEditor } from "./case/editor/editor.sign"; +import { Layout } from "./core/wrapper/layout"; +import { HTapeLayout, VTapeLayout } from "./core/wrapper/layout/layout.tape"; export interface BI extends _func, _i18n, _base { - OB: ClassConstructor<_OB>; - Widget: ClassConstructor<_Widget> & _WidgetStatic; - Single: ClassConstructor<_Single>; - BasicButton: ClassConstructor<_BasicButton> & _BasicButtonStatic; - Checkbox: ClassConstructor<_Checkbox> & _CheckboxStatic; - Button: ClassConstructor<_Button> & _ButtonStatic; - TextButton: ClassConstructor<_TextButton> & _TextButtonStatic; - IconChangeButton: ClassConstructor<_IconChangeButton> & _IconChangeButtonStatic; - Trigger: ClassConstructor<_Trigger>; - Action: ClassConstructor<_Action>; - ActionFactory: ClassConstructor<_ActionFactory>; - ShowAction: ClassConstructor<_ShowAction>; - Behavior: ClassConstructor<_Behavior>; - BehaviorFactory: ClassConstructor<_BehaviorFactory>; - HighlightBehavior: ClassConstructor<_HighlightBehavior>; - RedMarkBehavior: ClassConstructor<_RedMarkBehavior>; - Pane: ClassConstructor<_Pane> & _PaneStatic; - LoadingPane: ClassConstructor<_LoadingPane>; - Tab: ClassConstructor<_Tab> & _TabStatic; - ButtonGroup: ClassConstructor<_ButtonGroup> & _ButtonGroupChooseType & _ButtonGroupStatic; - Combo: ClassConstructor<_Combo> & _ComboStatic; - TextValueCombo: ClassConstructor<_TextValueCombo> & _TextValueComboStatic; - BubbleCombo: ClassConstructor<_BubbleCombo> & _BubbleComboStatic; - AllValueMultiTextValueCombo: ClassConstructor<_AllValueMultiTextValueCombo> & _AllValueMultiTextValueComboStatic; - IconTextItem: ClassConstructor<_IconTextItem> & _IconTextItemStatic; - MultiSelectItem: ClassConstructor<_MultiSelectItem> & _MultiSelectItemStatic; - AbstractLabel: ClassConstructor<_AbstractLabel>; - Label: ClassConstructor<_Label>; - Text: ClassConstructor<_Text>; - Editor: ClassConstructor<_Editor> & _EditorStatic; - SignEditor: ClassConstructor<_SignEditor> & _SignEditorStatic; - Layout: ClassConstructor<_Layout>; - HTapeLayout: ClassConstructor<_HTapeLayout>; - VTapeLayout: ClassConstructor<_VTapeLayout>; + OB: typeof OB; + Widget: typeof Widget; + Single: typeof Single; + BasicButton: typeof BasicButton; + Checkbox: typeof Checkbox; + Button: typeof Button; + TextButton: typeof TextButton; + IconChangeButton: typeof IconChangeButton; + Trigger: typeof Trigger; + Action: typeof Action; + ActionFactory: typeof ActionFactory; + ShowAction: typeof ShowAction; + Behavior: typeof Behavior; + BehaviorFactory: typeof BehaviorFactory; + HighlightBehavior: typeof HighlightBehavior; + RedMarkBehavior: typeof RedMarkBehavior; + Pane: typeof Pane; + LoadingPane: typeof LoadingPane; + Tab: typeof Tab; + ButtonGroup: typeof ButtonGroup; + Combo: typeof Combo; + TextValueCombo: typeof TextValueCombo; + BubbleCombo: typeof BubbleCombo; + AllValueMultiTextValueCombo: typeof AllValueMultiTextValueCombo; + IconTextItem: typeof IconTextItem; + MultiSelectItem: typeof MultiSelectItem; + AbstractLabel: typeof AbstractLabel; + Label: typeof Label; + Text: typeof Text; + Editor: typeof Editor; + SignEditor: typeof SignEditor; + Layout: typeof Layout; + HTapeLayout: typeof HTapeLayout; + VTapeLayout: typeof VTapeLayout; Decorators: typeof decorator; }