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

Loading…
Cancel
Save