From 9ea65567ca81e47db5dc26b95d4c4811340cd469 Mon Sep 17 00:00:00 2001 From: zsmj Date: Wed, 11 Jan 2023 16:02:39 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-14066=20feat:=20case/tree=E5=92=8Ccase/z?= =?UTF-8?q?tree?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/single/bar/bar.loading.js | 32 +++++++++---------- src/base/single/index.js | 1 + src/case/tree/tree.level.js | 31 +++++++++++++----- src/case/tree/treeexpander/tree.expander.js | 6 ++-- .../tree/treeexpander/tree.expander.popup.js | 4 +-- src/case/ztree/treerender.page.service.js | 7 ++-- src/case/ztree/treeview.js | 14 ++++---- src/core/wrapper/index.js | 2 +- 8 files changed, 57 insertions(+), 40 deletions(-) diff --git a/src/base/single/bar/bar.loading.js b/src/base/single/bar/bar.loading.js index f8bd97970..a4ab85a46 100644 --- a/src/base/single/bar/bar.loading.js +++ b/src/base/single/bar/bar.loading.js @@ -1,12 +1,8 @@ -import { shortcut, emptyFn } from "../../../core" -/** - * guy - * 加载条 - * @type {*|void|Object} - */ -@shortcut() -class LoadingBar extends BI.Single { +import { shortcut, emptyFn } from "@/core"; +import { Single } from "../0.single"; +@shortcut() +class LoadingBar extends Single { static xtype = "bi.loading_bar"; _defaultConfig() { @@ -14,10 +10,10 @@ class LoadingBar extends BI.Single { return { ...conf, - baseCls: (conf.baseCls || "") + " bi-loading-bar bi-tips", + baseCls: `${conf.baseCls || ""} bi-loading-bar bi-tips`, height: 30, handler: emptyFn, - } + }; } render() { @@ -49,13 +45,15 @@ class LoadingBar extends BI.Single { this.cardLayout = BI.createWidget({ type: "bi.card", element: this, - items: [{ - el: loaded, - cardName: "loaded", - }, { - el: loading, - cardName: "loading", - }], + items: [ + { + el: loaded, + cardName: "loaded", + }, { + el: loading, + cardName: "loading", + } + ], }); this.invisible(); } diff --git a/src/base/single/index.js b/src/base/single/index.js index 4ace50599..1d0bf1a61 100644 --- a/src/base/single/index.js +++ b/src/base/single/index.js @@ -9,6 +9,7 @@ export { Link } from "./link/link"; export { Instruction } from "./instruction/instruction"; export { Img } from "./img/img"; export { Trigger } from "./trigger/trigger"; +export { LoadingBar } from "./bar/bar.loading"; export * from "./tip"; export * from "./label"; export * from "./input"; diff --git a/src/case/tree/tree.level.js b/src/case/tree/tree.level.js index bd522ce3a..23a2c4473 100644 --- a/src/case/tree/tree.level.js +++ b/src/case/tree/tree.level.js @@ -1,4 +1,19 @@ -import { shortcut, Widget, extend, isKey, each, UUID, defaults, isNotEmptyArray, Tree, createWidget } from "@/core"; +import { + shortcut, + Widget, + extend, + isKey, + each, + UUID, + defaults, + isNotEmptyArray, + Tree, + createWidget, + VerticalLayout +} from "@/core"; +import { ButtonTree, CustomTree } from "@/base"; +import { TreeExpander } from "./treeexpander/tree.expander"; +import { BasicTreeItem, BasicTreeNode } from "@/case"; @shortcut() export class LevelTree extends Widget { @@ -36,13 +51,13 @@ export class LevelTree extends Widget { } extend.pNode = pNode; if (node.isParent === true || node.parent === true || isNotEmptyArray(node.children)) { - extend.type = "bi.tree_node"; + extend.type = BasicTreeNode.xtype; extend.selectable = false; defaults(node, extend); self._formatItems(node.children, layer + 1, node); } else { - extend.type = "bi.tree_item"; + extend.type = BasicTreeItem.xtype; defaults(node, extend); } }); @@ -63,26 +78,26 @@ export class LevelTree extends Widget { this.empty(); this._assertId(nodes); this.tree = createWidget({ - type: "bi.custom_tree", + type: CustomTree.xtype, element: this, expander: extend({ - type: "bi.tree_expander", + type: TreeExpander.xtype, el: {}, isDefaultInit: false, selectable: false, popup: { - type: "bi.custom_tree", + type: CustomTree.xtype, }, }, o.expander), items: this._formatItems(Tree.transformToTreeFormat(nodes), 0), value: o.value, el: extend({ - type: "bi.button_tree", + type: ButtonTree.xtype, chooseType: 0, layouts: [ { - type: "bi.vertical", + type: VerticalLayout.xtype, } ], }, o.el), diff --git a/src/case/tree/treeexpander/tree.expander.js b/src/case/tree/treeexpander/tree.expander.js index c9e8185f5..32f35a081 100644 --- a/src/case/tree/treeexpander/tree.expander.js +++ b/src/case/tree/treeexpander/tree.expander.js @@ -1,4 +1,6 @@ import { contains, Controller, createWidget, isArray, shortcut, Widget } from "@/core"; +import { Expander } from "@/base"; +import { TreeExpanderPopup } from "./tree.expander.popup"; @shortcut() export class TreeExpander extends Widget { @@ -25,7 +27,7 @@ export class TreeExpander extends Widget { }); return { - type: "bi.expander", + type: Expander.xtype, ref(_ref) { self.expander = _ref; }, @@ -33,7 +35,7 @@ export class TreeExpander extends Widget { el: this.trigger, isDefaultInit: o.isDefaultInit, popup: { - type: "bi.tree_expander.popup", + type: TreeExpanderPopup.xtype, layer: o.layer || o.el.layer, isLastNode: o.isLastNode || o.el.isLastNode, isFirstNode: o.isFirstNode || o.el.isFirstNode, diff --git a/src/case/tree/treeexpander/tree.expander.popup.js b/src/case/tree/treeexpander/tree.expander.popup.js index ac12b708c..d00c790f7 100644 --- a/src/case/tree/treeexpander/tree.expander.popup.js +++ b/src/case/tree/treeexpander/tree.expander.popup.js @@ -1,4 +1,4 @@ -import { Controller, createWidget, pixFormat, shortcut, Widget } from "@/core"; +import { Controller, createWidget, pixFormat, shortcut, VerticalLayout, Widget } from "@/core"; @shortcut() export class TreeExpanderPopup extends Widget { @@ -34,7 +34,7 @@ export class TreeExpanderPopup extends Widget { } return { - type: "bi.vertical", + type: VerticalLayout.xtype, cls: (showLine && !isLastNode) ? (BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "line solid" : "line") : "", scrolly: null, items: [ diff --git a/src/case/ztree/treerender.page.service.js b/src/case/ztree/treerender.page.service.js index 5bb8be327..56112c217 100644 --- a/src/case/ztree/treerender.page.service.js +++ b/src/case/ztree/treerender.page.service.js @@ -5,14 +5,15 @@ * 提供节点分页加载方式 */ -import { createWidget, debounce, has, OB, size, each } from "@/core"; +import { createWidget, debounce, has, OB, size, each, VerticalLayout } from "@/core"; +import { LoadingBar } from "@/base"; export class TreeRenderPageService extends OB { nodeLists = {}; _getLoadingBar(tId) { const tip = createWidget({ - type: "bi.loading_bar", + type: LoadingBar.xtype, height: 25, handler: () => { this.refreshNodes(tId); @@ -39,7 +40,7 @@ export class TreeRenderPageService extends OB { this.nodeLists[tId].loadWidget = tip; } createWidget({ - type: "bi.vertical", + type: VerticalLayout.xtype, element: o.subNodeListGetter(tId), items: [tip], }); diff --git a/src/case/ztree/treeview.js b/src/case/ztree/treeview.js index a58fd4709..33ee57363 100644 --- a/src/case/ztree/treeview.js +++ b/src/case/ztree/treeview.js @@ -10,9 +10,9 @@ import { jsonEncode, delay, each, replaceAll, isUndefined, isNotEmptyArray, deepClone, map, Tree, - isNull, shortcut + isNull, shortcut, VerticalLayout, Layout, DefaultLayout } from "@/core"; -import { Msg, Pane } from "@/base"; +import { Msg, Pane, LoadingBar, Text } from "@/base"; @shortcut() export class TreeView extends Pane { @@ -43,12 +43,12 @@ export class TreeView extends Pane { this._createTree(); this.tip = createWidget({ - type: "bi.loading_bar", + type: LoadingBar.xtype, invisible: true, handler: () => this._loadMore(), }); createWidget({ - type: "bi.vertical", + type: VerticalLayout.xtype, scrollable: true, scrolly: false, element: this, @@ -68,11 +68,11 @@ export class TreeView extends Pane { this.tree.destroy(); } this.tree = createWidget({ - type: "bi.layout", + type: Layout.xtype, element: ``, }); createWidget({ - type: "bi.default", + type: DefaultLayout.xtype, element: this, items: [this.tree], }); @@ -386,7 +386,7 @@ export class TreeView extends Pane { root: true, keyword: o.paras.keyword, }, newNode, { - type: "bi.text", + type: Text.xtype, text: replaceAll(newNode.text, "\n", " "), })); const fragment = BI.Widget._renderEngine.createElement("
"); diff --git a/src/core/wrapper/index.js b/src/core/wrapper/index.js index c32c3e3bf..0e7310cd2 100644 --- a/src/core/wrapper/index.js +++ b/src/core/wrapper/index.js @@ -1,2 +1,2 @@ -export { Layout } from "./layout"; +export { Layout } from "./layout.js"; export * from "./layout/index";