Browse Source

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

* commit '4f47710bd22e232edb7f33c2718adc4e74d37b96':
  无JIRA 节点的宽度要随内容撑起来
master
superman 8 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 { Icon, Label, BasicButton } from "@/base";
/**
* @deprecated
*/
@shortcut()
export class IconTreeLeafItem extends BasicButton {
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 { Layout, HorizontalAdaptLayout, shortcut, extend, createWidget, Controller, makeArray, count, Events } from "@/core";
import { BasicButton } from "@/base";
import {
shortcut,
extend,
} from "@/core";
import { BasicTreeItem } from "./treeitem";
/**
* @deprecated
*/
@shortcut()
export class MultiLayerIconTreeLeafItem extends BasicButton {
export class MultiLayerIconTreeLeafItem extends BasicTreeItem {
static xtype = "bi.multilayer_icon_tree_leaf_item";
_defaultConfig() {
@ -14,89 +19,8 @@ export class MultiLayerIconTreeLeafItem extends BasicButton {
iconCls: "",
iconHeight: 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,
iconHeight: null,
iconCls: "",
showLine: true,
indentWidth: null,
});
}
@ -37,14 +39,16 @@ export class BasicTreeItem extends NodeButton {
py,
keyword,
iconCls,
showLine,
indentWidth
} = this.options;
const indent = {
el: {
type: Layout.xtype,
height,
width: height,
cls: this.getLineCls(),
width: indentWidth ?? height,
cls: showLine ? this.getLineCls() : "",
},
lgap: layer * SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2, // 偏移公式为每一层的偏移量为节点高度的一半
width: "",

Loading…
Cancel
Save