Browse Source

Pull request #3366: KERNEL-14066 feat: case/tree和case/ztree

Merge in VISUAL/fineui from ~DAILER/fineui:es6 to es6

* commit 'b7807ec3b4ef5f413485c3aa220139e0f68ac2de':
  KERNEL-14066 feat: case/tree和case/ztree
es6
Dailer-刘荣歆 2 years ago
parent
commit
554222709a
  1. 32
      src/base/single/bar/bar.loading.js
  2. 1
      src/base/single/index.js
  3. 31
      src/case/tree/tree.level.js
  4. 6
      src/case/tree/treeexpander/tree.expander.js
  5. 4
      src/case/tree/treeexpander/tree.expander.popup.js
  6. 7
      src/case/ztree/treerender.page.service.js
  7. 14
      src/case/ztree/treeview.js
  8. 2
      src/core/wrapper/index.js

32
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();
}

1
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";

31
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),

6
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,

4
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: [

7
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],
});

14
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: `<ul id='${this.id}' class='ztree${BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? " solid'" : "'"}></ul>`,
});
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("<div>");

2
src/core/wrapper/index.js

@ -1,2 +1,2 @@
export { Layout } from "./layout";
export { Layout } from "./layout.js";
export * from "./layout/index";

Loading…
Cancel
Save