From ef1425e6db83d162ee684b6e52ef9a68ba7d70a4 Mon Sep 17 00:00:00 2001 From: iapyang Date: Thu, 17 Dec 2020 10:21:08 +0800 Subject: [PATCH 1/3] =?UTF-8?q?refactor:=20=E8=A1=A5=E5=85=85=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typescript/base/tree/ztree/treeview.ts | 69 +++++++++++++++++++ typescript/index.ts | 9 +++ .../multilayerselecttree.popup.ts | 13 ++++ .../multilayersingletree.popup.ts | 13 ++++ 4 files changed, 104 insertions(+) create mode 100644 typescript/base/tree/ztree/treeview.ts create mode 100644 typescript/widget/multilayerselecttree/multilayerselecttree.popup.ts create mode 100644 typescript/widget/multilayersingletree/multilayersingletree.popup.ts diff --git a/typescript/base/tree/ztree/treeview.ts b/typescript/base/tree/ztree/treeview.ts new file mode 100644 index 000000000..d35b2149a --- /dev/null +++ b/typescript/base/tree/ztree/treeview.ts @@ -0,0 +1,69 @@ +import { Pane } from "../../pane"; + +export declare class TreeView extends Pane { + static REQ_TYPE_INIT_DATA: 1; + static REQ_TYPE_ADJUST_DATA: 2; + static REQ_TYPE_SELECT_DATA: 3; + static REQ_TYPE_GET_SELECTED_DATA: 4; + + static EVENT_CHANGE: string; + static EVENT_INIT: string; + static EVENT_AFTERINIT: string; + + _createTree(): void; + + _selectTreeNode(treeId: string, treeNode: T): void; + + _configSetting(): {[key: string]: any}; + + _getParentValues(treeNode: T): U; + + _getNodeValue(treeNode: T): U; + + _getHalfSelectedValues(map: TreeValue, node: T): void; + + _getTree(map: TreeValue, values: string[]): TreeValue; + + _addTreeNode(map: TreeValue, values: string[], key: string, value: string): void; + + _buildTree(map: TreeValue, values: string[]): void; + + _getSelectedValues(): TreeValue; + + _dealWidthNodes(nodes: T[]): T[]; + + _loadMore(): void; + + _initTree(setting: {[key: string]: any}): void; + + initTree(node: T, setting: {[key: string]: any}): void; + + start(): void; + + stop(): void; + + stroke(config: {[key: string]: any}): void; + + hasChecked(): boolean; + + checkAll(checked: T[]): void; + + expandAll(flag: boolean): void; + + setValue(value: TreeValue, param: {[key: string]: any}): void; + + setSelectedValue(value: TreeValue): void; + + updateValue(value: TreeValue, param: {[key: string]: any}): void; + + refresh(): void; + + getValue(): TreeValue; + + // @ts-ignore + populate(config: {[key: string]: any}): void; +} + +interface TreeValue { + [key: string]: TreeValue; +} diff --git a/typescript/index.ts b/typescript/index.ts index e82441f3c..c7f9c866b 100644 --- a/typescript/index.ts +++ b/typescript/index.ts @@ -98,6 +98,9 @@ import { ListTreeValueChooserInsertCombo } from "./component/treevaluechooser/co import { TreeValueChooserCombo } from "./component/treevaluechooser/combo.treevaluechooser"; import { TreeValueChooserInsertCombo } from "./component/treevaluechooser/combo.treevaluechooser.insert"; import { Radio } from "./base/single/input/radio/radio"; +import { MultiLayerSelectTreePopup } from "./widget/multilayerselecttree/multilayerselecttree.popup"; +import { MultiLayerSingleTreePopup } from "./widget/multilayersingletree/multilayersingletree.popup"; +import { TreeView } from "./base/tree/ztree/treeview"; type ClassConstructor = T & { @@ -149,6 +152,9 @@ export interface BI extends _func, _i18n, _base, _inject { ListTreeValueChooserInsertCombo: typeof ListTreeValueChooserInsertCombo; TreeValueChooserCombo: typeof TreeValueChooserCombo; TreeValueChooserInsertCombo: typeof TreeValueChooserInsertCombo; + MultiLayerSelectTreePopup: typeof MultiLayerSelectTreePopup; + MultiLayerSingleTreePopup: typeof MultiLayerSingleTreePopup; + TreeView: typeof TreeView; Decorators: typeof decorator; DownListCombo: ClassConstructor<_DownListCombo> & _DownListComboStatic; Iframe: ClassConstructor<_Iframe>; @@ -265,6 +271,9 @@ export { ListTreeValueChooserInsertCombo, TreeValueChooserCombo, TreeValueChooserInsertCombo, + MultiLayerSelectTreePopup, + MultiLayerSingleTreePopup, + TreeView, Combo, IconCombo, DynamicDateCombo, diff --git a/typescript/widget/multilayerselecttree/multilayerselecttree.popup.ts b/typescript/widget/multilayerselecttree/multilayerselecttree.popup.ts new file mode 100644 index 000000000..fe90f90ab --- /dev/null +++ b/typescript/widget/multilayerselecttree/multilayerselecttree.popup.ts @@ -0,0 +1,13 @@ +import { Widget } from "../../core/widget"; + +export declare class MultiLayerSelectTreePopup extends Widget { + static xtype: string; + + static EVENT_CHANGE: string; + + getValue(): T; + + setValue(v: any): void; + + populate(items: T[]): void; +} diff --git a/typescript/widget/multilayersingletree/multilayersingletree.popup.ts b/typescript/widget/multilayersingletree/multilayersingletree.popup.ts new file mode 100644 index 000000000..6402b31f3 --- /dev/null +++ b/typescript/widget/multilayersingletree/multilayersingletree.popup.ts @@ -0,0 +1,13 @@ +import { Widget } from "../../core/widget"; + +export declare class MultiLayerSingleTreePopup extends Widget { + static xtype: string; + + static EVENT_CHANGE: string; + + getValue(): T; + + setValue(v: any): void; + + populate(items: T[]): void; +} From 3ae212bbadc938a591d725eaa637fd8fbff83c17 Mon Sep 17 00:00:00 2001 From: iapyang Date: Thu, 17 Dec 2020 10:58:34 +0800 Subject: [PATCH 2/3] =?UTF-8?q?refactor:=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typescript/base/tree/ztree/treeview.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/typescript/base/tree/ztree/treeview.ts b/typescript/base/tree/ztree/treeview.ts index d35b2149a..aa042e7b8 100644 --- a/typescript/base/tree/ztree/treeview.ts +++ b/typescript/base/tree/ztree/treeview.ts @@ -1,6 +1,7 @@ import { Pane } from "../../pane"; export declare class TreeView extends Pane { + static xtype: string; static REQ_TYPE_INIT_DATA: 1; static REQ_TYPE_ADJUST_DATA: 2; static REQ_TYPE_SELECT_DATA: 3; From 97a3f25c38f02d71470473ffaa086335c095e329 Mon Sep 17 00:00:00 2001 From: iapyang Date: Thu, 17 Dec 2020 13:52:34 +0800 Subject: [PATCH 3/3] =?UTF-8?q?refactor:=20=E8=A1=A5=E5=85=85=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typescript/base/tree/ztree/asynctree.ts | 11 +++++++++++ typescript/base/tree/ztree/list/listasynctree.ts | 5 +++++ typescript/base/tree/ztree/list/listtreeview.ts | 5 +++++ typescript/base/tree/ztree/treeview.ts | 2 +- typescript/index.ts | 9 +++++++++ 5 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 typescript/base/tree/ztree/asynctree.ts create mode 100644 typescript/base/tree/ztree/list/listasynctree.ts create mode 100644 typescript/base/tree/ztree/list/listtreeview.ts diff --git a/typescript/base/tree/ztree/asynctree.ts b/typescript/base/tree/ztree/asynctree.ts new file mode 100644 index 000000000..b0671368e --- /dev/null +++ b/typescript/base/tree/ztree/asynctree.ts @@ -0,0 +1,11 @@ +import { TreeView, TreeValue } from "./treeview"; + +export declare class AsyncTree extends TreeView { + static xtype: string; + + _beforeExpandNode(treeId: string, treeNode: T): void; + + _join(valueA: TreeValue, valueB: TreeValue): TreeValue; + + _getJoinValue(): TreeValue; +} diff --git a/typescript/base/tree/ztree/list/listasynctree.ts b/typescript/base/tree/ztree/list/listasynctree.ts new file mode 100644 index 000000000..047764c05 --- /dev/null +++ b/typescript/base/tree/ztree/list/listasynctree.ts @@ -0,0 +1,5 @@ +import { ListTreeView } from "./listtreeview"; + +export declare class ListAsyncTree extends ListTreeView { + static xtype: string; +} diff --git a/typescript/base/tree/ztree/list/listtreeview.ts b/typescript/base/tree/ztree/list/listtreeview.ts new file mode 100644 index 000000000..3f1668592 --- /dev/null +++ b/typescript/base/tree/ztree/list/listtreeview.ts @@ -0,0 +1,5 @@ +import { TreeView } from "../treeview"; + +export declare class ListTreeView extends TreeView { + static xtype: string; +} diff --git a/typescript/base/tree/ztree/treeview.ts b/typescript/base/tree/ztree/treeview.ts index aa042e7b8..0bdf2ac30 100644 --- a/typescript/base/tree/ztree/treeview.ts +++ b/typescript/base/tree/ztree/treeview.ts @@ -65,6 +65,6 @@ export declare class TreeView extends Pane { populate(config: {[key: string]: any}): void; } -interface TreeValue { +export interface TreeValue { [key: string]: TreeValue; } diff --git a/typescript/index.ts b/typescript/index.ts index f44447268..b768d88e1 100644 --- a/typescript/index.ts +++ b/typescript/index.ts @@ -105,6 +105,9 @@ import { MultiTreePopup } from "./widget/multitree/multi.tree.popup"; import { SingleSelectRadioItem } from "./case/button/item.singleselect.radio"; import { SingleSelectInsertCombo } from "./widget/singleselect/singleselect.insert.combo"; import { SingleSelectCombo } from "./widget/singleselect/singleselect.combo"; +import { ListTreeView } from "./base/tree/ztree/list/listtreeview"; +import { ListAsyncTree } from "./base/tree/ztree/list/listasynctree"; +import { AsyncTree } from "./base/tree/ztree/asynctree"; type ClassConstructor = T & { @@ -159,6 +162,9 @@ export interface BI extends _func, _i18n, _base, _inject { MultiLayerSelectTreePopup: typeof MultiLayerSelectTreePopup; MultiLayerSingleTreePopup: typeof MultiLayerSingleTreePopup; TreeView: typeof TreeView; + ListTreeView: typeof ListTreeView; + ListAsyncTree: typeof ListAsyncTree; + AsyncTree: typeof AsyncTree; Decorators: typeof decorator; DownListCombo: ClassConstructor<_DownListCombo> & _DownListComboStatic; Iframe: ClassConstructor<_Iframe>; @@ -282,6 +288,9 @@ export { MultiLayerSelectTreePopup, MultiLayerSingleTreePopup, TreeView, + ListTreeView, + ListAsyncTree, + AsyncTree, Combo, IconCombo, DynamicDateCombo,