Browse Source

Merge pull request #275123 in DEC/fineui from master to feature/x

* commit '4f47710bd22e232edb7f33c2718adc4e74d37b96':
  无JIRA 节点的宽度要随内容撑起来
master^2^2
superman 7 months ago
parent
commit
8dbbbd5e2c
  1. 3
      packages/fineui/src/case/button/treeitem/item.icon.treeleaf.js
  2. 100
      packages/fineui/src/case/button/treeitem/item.multilayer.icon.treeleaf.js
  3. 8
      packages/fineui/src/case/button/treeitem/treeitem.js

3
packages/fineui/src/case/button/treeitem/item.icon.treeleaf.js

@ -1,6 +1,9 @@
import { CenterAdaptLayout, shortcut, extend, createWidget, LogicFactory, Direction } from "@/core"; import { CenterAdaptLayout, shortcut, extend, createWidget, LogicFactory, Direction } from "@/core";
import { Icon, Label, BasicButton } from "@/base"; import { Icon, Label, BasicButton } from "@/base";
/**
* @deprecated
*/
@shortcut() @shortcut()
export class IconTreeLeafItem extends BasicButton { export class IconTreeLeafItem extends BasicButton {
static xtype = "bi.icon_tree_leaf_item"; static xtype = "bi.icon_tree_leaf_item";

100
packages/fineui/src/case/button/treeitem/item.multilayer.icon.treeleaf.js

@ -1,9 +1,14 @@
import { IconTreeLeafItem } from "./item.icon.treeleaf"; import {
import { Layout, HorizontalAdaptLayout, shortcut, extend, createWidget, Controller, makeArray, count, Events } from "@/core"; shortcut,
import { BasicButton } from "@/base"; extend,
} from "@/core";
import { BasicTreeItem } from "./treeitem";
/**
* @deprecated
*/
@shortcut() @shortcut()
export class MultiLayerIconTreeLeafItem extends BasicButton { export class MultiLayerIconTreeLeafItem extends BasicTreeItem {
static xtype = "bi.multilayer_icon_tree_leaf_item"; static xtype = "bi.multilayer_icon_tree_leaf_item";
_defaultConfig() { _defaultConfig() {
@ -14,89 +19,8 @@ export class MultiLayerIconTreeLeafItem extends BasicButton {
iconCls: "", iconCls: "",
iconHeight: 16, iconHeight: 16,
iconWidth: 16, iconWidth: 16,
showLine: false,
indentWidth: 0
}); });
} }
_init() {
super._init(...arguments);
const o = this.options;
this.item = createWidget({
type: IconTreeLeafItem.xtype,
cls: "bi-list-item-none",
iconCls: o.iconCls,
id: o.id,
pId: o.pId,
isFront: true,
height: o.height,
hgap: o.hgap,
text: o.text,
value: o.value,
py: o.py,
keyword: o.keyword,
iconWidth: o.iconWidth,
iconHeight: o.iconHeight,
});
this.item.on(Controller.EVENT_CHANGE, (...args) => {
const [type] = args;
if (type === Events.CLICK) {
// 本身实现click功能
return;
}
this.fireEvent(Controller.EVENT_CHANGE, ...args);
});
const items = [];
count(0, o.layer, () => {
items.push({
type: Layout.xtype,
width: 15,
height: o.height,
});
});
items.push(this.item);
createWidget({
type: HorizontalAdaptLayout.xtype,
element: this,
columnSize: makeArray(o.layer, 15),
items,
});
}
doRedMark() {
this.item.doRedMark(...arguments);
}
unRedMark() {
this.item.unRedMark(...arguments);
}
doHighLight() {
this.item.doHighLight(...arguments);
}
unHighLight() {
this.item.unHighLight(...arguments);
}
getId() {
return this.options.id;
}
getPId() {
return this.options.pId;
}
doClick() {
super.doClick(...arguments);
this.item.setSelected(this.isSelected());
}
setSelected(v) {
super.setSelected(...arguments);
this.item.setSelected(v);
}
getValue() {
return this.options.value;
}
} }

8
packages/fineui/src/case/button/treeitem/treeitem.js

@ -20,6 +20,8 @@ export class BasicTreeItem extends NodeButton {
iconWidth: null, iconWidth: null,
iconHeight: null, iconHeight: null,
iconCls: "", iconCls: "",
showLine: true,
indentWidth: null,
}); });
} }
@ -37,14 +39,16 @@ export class BasicTreeItem extends NodeButton {
py, py,
keyword, keyword,
iconCls, iconCls,
showLine,
indentWidth
} = this.options; } = this.options;
const indent = { const indent = {
el: { el: {
type: Layout.xtype, type: Layout.xtype,
height, height,
width: height, width: indentWidth ?? height,
cls: this.getLineCls(), cls: showLine ? this.getLineCls() : "",
}, },
lgap: layer * SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2, // 偏移公式为每一层的偏移量为节点高度的一半 lgap: layer * SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2, // 偏移公式为每一层的偏移量为节点高度的一半
width: "", width: "",

Loading…
Cancel
Save