zsmj 2 years ago
parent
commit
aa3d0eb035
  1. 17
      src/case/button/node/treenode.js
  2. 12
      src/case/button/treeitem/treeitem.js

17
src/case/button/node/treenode.js

@ -1,13 +1,14 @@
import { NodeButton } from "../../../base/single/button/button.node";
import { shortcut, extend } from "../../../core";
import { Label, NodeButton } from "@/base";
import { shortcut, extend, VerticalAdaptLayout } from "@/core";
import { TreeNodeSwitcher } from "@/case";
@shortcut()
export class BasicTreeNode extends NodeButton {
static xtype = "bi.tree_node";
_defaultConfig(props) {
const conf = super._defaultConfig.apply(this, arguments);
return extend(conf, {
baseCls: `${conf.baseCls || ""} bi-tree-node ${props.selectable ? "bi-list-item-active" : "bi-list-item"}`,
id: "",
@ -27,7 +28,7 @@ export class BasicTreeNode extends NodeButton {
const o = this.options;
const checkbox = {
type: "bi.tree_node_switcher",
type: TreeNodeSwitcher.xtype,
ref: _ref => {
this.switcher = _ref;
},
@ -39,7 +40,7 @@ export class BasicTreeNode extends NodeButton {
layer: o.layer,
...o.switcherIcon,
stopPropagation: o.selectable,
mounted () {
mounted() {
this.setEnable(true);
},
listeners: [
@ -55,7 +56,7 @@ export class BasicTreeNode extends NodeButton {
};
return {
type: "bi.vertical_adapt",
type: VerticalAdaptLayout.xtype,
columnSize: [o.iconWrapperWidth || o.height, "fill"],
items: [
{
@ -63,7 +64,7 @@ export class BasicTreeNode extends NodeButton {
lgap: o.layer * BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2, // 偏移公式为每一层的偏移量为节点高度的一半
}, {
el: {
type: "bi.label",
type: Label.xtype,
ref: _ref => {
this.text = _ref;
},

12
src/case/button/treeitem/treeitem.js

@ -1,5 +1,5 @@
import { NodeButton } from "../../../base/single/button/button.node";
import { shortcut, extend } from "../../../core";
import { shortcut, extend, VerticalAdaptLayout, Layout } from "@/core";
import { NodeButton, Label } from "@/base";
@shortcut()
export class BasicTreeItem extends NodeButton {
@ -7,7 +7,7 @@ export class BasicTreeItem extends NodeButton {
_defaultConfig() {
const conf = super._defaultConfig(...arguments);
return extend(conf, {
baseCls: `${conf.baseCls || ""} bi-tree-item bi-list-item-active`,
id: "",
@ -23,12 +23,12 @@ export class BasicTreeItem extends NodeButton {
const o = this.options;
return {
type: "bi.vertical_adapt",
type: VerticalAdaptLayout.xtype,
columnSize: ["", "fill"],
items: [
{
el: {
type: "bi.layout",
type: Layout.xtype,
height: o.height,
width: o.height,
cls: this.getLineCls(),
@ -37,7 +37,7 @@ export class BasicTreeItem extends NodeButton {
},
{
el: {
type: "bi.label",
type: Label.xtype,
ref: _ref => {
this.text = _ref;
},

Loading…
Cancel
Save