Browse Source

Merge pull request #696 in VISUAL/fineui from ~DAILER/fineui:master to master

* commit '9d1692eec5be60f4d052c77ba5aafdf620300f77':
  build
  BI-32529  fineui树控件去掉多余的线
  BI-32529  fineui树控件去掉多余的线
  float_center_adapt 用inline_center_adapt 替换
es6
guy 6 years ago
parent
commit
9a88aec9b3
  1. 23
      demo/js/widget/tree/demo.multilayer_single_level_tree.js
  2. 666
      dist/bundle.js
  3. 68
      dist/bundle.min.js
  4. 47
      dist/case.js
  5. 114
      dist/core.js
  6. 23
      dist/demo.js
  7. 666
      dist/fineui.js
  8. 68
      dist/fineui.min.js
  9. 505
      dist/widget.js
  10. 4
      src/case/button/treeitem/item.first.treeleaf.js
  11. 4
      src/case/button/treeitem/item.last.treeleaf.js
  12. 2
      src/case/button/treeitem/item.mid.treeleaf.js
  13. 4
      src/case/checkbox/check.last.treenode.js
  14. 33
      src/case/tree/tree.level.js
  15. 2
      src/core/platform/web/config.js
  16. 20
      src/core/wrapper/layout/adapt/inline.center.js
  17. 34
      src/widget/multilayerselecttree/multilayerselecttree.leveltree.js
  18. 13
      src/widget/multilayerselecttree/node/node.first.plus.js
  19. 13
      src/widget/multilayerselecttree/node/node.last.plus.js
  20. 13
      src/widget/multilayerselecttree/node/node.mid.plus.js
  21. 104
      src/widget/multilayerselecttree/node/node.plus.js
  22. 34
      src/widget/multilayersingletree/multilayersingletree.leveltree.js
  23. 14
      src/widget/multilayersingletree/node/node.first.plus.js
  24. 13
      src/widget/multilayersingletree/node/node.last.plus.js
  25. 13
      src/widget/multilayersingletree/node/node.mid.plus.js
  26. 96
      src/widget/multilayersingletree/node/node.plus.js
  27. 14
      src/widget/multilayersingletree/treeitem/item.first.treeleaf.js
  28. 13
      src/widget/multilayersingletree/treeitem/item.last.treeleaf.js
  29. 13
      src/widget/multilayersingletree/treeitem/item.mid.treeleaf.js
  30. 86
      src/widget/selecttree/nodes/node.plus.js
  31. 35
      src/widget/selecttree/selecttree.popup.js

23
demo/js/widget/tree/demo.multilayer_single_level_tree.js

@ -44,7 +44,28 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
mounted: function () {
this.tree.populate(BI.deepClone(Demo.CONSTANTS.TREE));
var tree = [
// {id: -2, pId: 0, value: "根目录1", text: "根目录1"},
{id: -1, pId: 0, value: "根目录", text: "根目录"},
{id: 1, pId: -1, value: "第一级目录1", text: "第一级目录1"},
{id: 11, pId: 1, value: "第二级文件1", text: "第二级文件1"},
{id: 12, pId: 1, value: "第二级目录2", text: "第二级目录2"},
{id: 121, pId: 12, value: "第三级目录1", text: "第三级目录1"},
{id: 122, pId: 12, value: "第三级文件1", text: "第三级文件1"},
{id: 1211, pId: 121, value: "第四级目录1", text: "第四级目录1"},
{id: 2, pId: -1, value: "第一级目录2", text: "第一级目录2"},
{id: 21, pId: 2, value: "第二级目录3", text: "第二级目录3"},
{id: 22, pId: 2, value: "第二级文件2", text: "第二级文件2"},
{id: 211, pId: 21, value: "第三级目录2", text: "第三级目录2"},
{id: 212, pId: 21, value: "第三级文件2", text: "第三级文件2"},
{id: 2111, pId: 211, value: "第四级文件1", text: "第四级文件1"},
{id: 3, pId: -1, value: "第一级目录3", text: "第一级目录3"},
{id: 31, pId: 3, value: "第二级文件2", text: "第二级文件2"},
{id: 33, pId: 3, value: "第二级目录3", text: "第二级目录1"},
{id: 32, pId: 3, value: "第二级文件3", text: "第二级文件3"},
{id: 331, pId: 33, value: "第三级文件1", text: "第三级文件1"}
];
this.tree.populate(tree);
}
});

666
dist/bundle.js vendored

@ -19012,7 +19012,7 @@ BI.prepares.push(function () {
}
return BI.extend(ob, {type: "bi.flex_center"});
}
return ob;
return BI.extend(ob, {type: "bi.inline_center_adapt"});
});
});/**
* Detect Element Resize.
@ -30359,6 +30359,98 @@ BI.AbsoluteVerticalLayout = BI.inherit(BI.Layout, {
}
});
BI.shortcut("bi.absolute_vertical_adapt", BI.AbsoluteVerticalLayout);/**
* 内联布局
* @class BI.InlineCenterAdaptLayout
* @extends BI.Layout
*
* @cfg {JSON} options 配置属性
* @cfg {Number} [hgap=0] 水平间隙
* @cfg {Number} [vgap=0] 垂直间隙
*/
BI.InlineVaerticalAdaptLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.InlineLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-inline-center-adapt-layout",
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
});
},
render: function () {
BI.InlineVaerticalAdaptLayout.superclass.render.apply(this, arguments);
this.element.css({
whiteSpace: "nowrap",
"text-align": "left"
});
this.populate(this.options.items);
},
_addElement: function (i, item, length) {
var o = this.options;
if (!this.hasWidget(this.getName() + i)) {
var t = BI.createWidget(item);
this.addWidget(this.getName() + i, t);
} else {
var t = this.getWidgetByName(this.getName() + i);
}
t.element.css({
position: "relative",
display: "inline-block",
"vertical-align": "middle",
"*display": "inline",
"*zoom": 1
});
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
t.element.css({
"margin-top": (o.vgap || 0) + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px"
});
}
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
t.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) + "px"
});
}
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
t.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) + "px"
});
}
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
t.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px"
});
}
return t;
},
resize: function () {
this.stroke(this.options.items);
},
addItem: function (item) {
throw new Error("不能添加元素");
},
stroke: function (items) {
var self = this;
BI.each(items, function (i, item) {
if (item) {
self._addElement(i, item, items.length);
}
});
},
populate: function (items) {
BI.InlineVaerticalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut("bi.vertical_inline_adapt", BI.InlineVaerticalAdaptLayout);/**
* 自适应水平和垂直方向都居中容器
* @class BI.CenterAdaptLayout
* @extends BI.Layout
@ -31080,33 +31172,21 @@ BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, {
render: function () {
BI.InlineCenterAdaptLayout.superclass.render.apply(this, arguments);
this.element.css({
whiteSpace: "nowrap"
whiteSpace: "nowrap",
textAlign: "center"
});
this.populate(this.options.items);
},
_addElement: function (i, item, length) {
var o = this.options;
if (!this.hasWidget(this.getName() + i)) {
var t = BI.createWidget(item);
t.element.css({
position: "relative"
});
var w = BI.createWidget({
type: "bi.horizontal_auto",
items: [t]
});
this.addWidget(this.getName() + i, w);
} else {
var w = this.getWidgetByName(this.getName() + i);
}
var w = BI.InlineVerticalAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({
position: "relative",
display: "inline-block",
"vertical-align": "middle",
"*display": "inline",
"*zoom": 1,
"min-width": 100 / length + "%"
"*zoom": 1
});
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({
@ -49900,7 +49980,7 @@ BI.FirstTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 12,
el: {
type: "bi.layout",
cls: "base-line-conn-background",
cls: (o.pNode && o.pNode.isLastNode) ? "" : "base-line-conn-background",
width: 12,
height: o.height
}
@ -49908,7 +49988,7 @@ BI.FirstTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 24,
el: {
type: "bi.layout",
cls: "mid-line-conn-background",
cls: "first-line-conn-background",
width: 24,
height: o.height
}
@ -50091,7 +50171,7 @@ BI.LastTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 12,
el: {
type: "bi.layout",
cls: "base-line-conn-background",
cls: (o.pNode && o.pNode.isLastNode) ? "" : "base-line-conn-background",
width: 12,
height: o.height
}
@ -50099,7 +50179,7 @@ BI.LastTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 24,
el: {
type: "bi.layout",
cls: "mid-line-conn-background",
cls: "last-line-conn-background",
width: 24,
height: o.height
}
@ -50195,7 +50275,7 @@ BI.MidTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 12,
el: {
type: "bi.layout",
cls: "base-line-conn-background",
cls: (o.pNode && o.pNode.isLastNode) ? "" : "base-line-conn-background",
width: 12,
height: o.height
}
@ -50906,9 +50986,9 @@ BI.LastTreeNodeCheckbox = BI.inherit(BI.IconButton, {
setSelected: function (v) {
BI.LastTreeNodeCheckbox.superclass.setSelected.apply(this, arguments);
if (v === true) {
this.element.addClass("tree-expand-icon-type3");
this.element.addClass("tree-expand-icon-type4");
} else {
this.element.removeClass("tree-expand-icon-type3");
this.element.removeClass("tree-expand-icon-type4");
}
}
});
@ -57812,34 +57892,35 @@ BI.LevelTree = BI.inherit(BI.Widget, {
this.initTree(this.options.items);
},
_formatItems: function (nodes, layer) {
_formatItems: function (nodes, layer, pNode) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {layer: layer};
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
extend.pNode = pNode;
if (node.isParent === true || BI.isNotEmptyArray(node.children)) {
switch (i) {
case 0 :
extend.type = "bi.first_plus_group_node";
break;
case nodes.length - 1 :
extend.type = "bi.last_plus_group_node";
break;
default :
extend.type = "bi.mid_plus_group_node";
break;
if (i === nodes.length - 1) {
extend.type = "bi.last_plus_group_node";
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.first_plus_group_node"
}
if (i === 0 && i === nodes.length - 1) { // 根
extend.type = "bi.plus_group_node";
}
BI.defaults(node, extend);
self._formatItems(node.children, layer + 1);
self._formatItems(node.children, layer + 1, node);
} else {
switch (i) {
case nodes.length - 1:
extend.type = "bi.last_tree_leaf_item";
break;
default :
extend.type = "bi.mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.first_tree_leaf_item"
}
if (i === nodes.length - 1) {
extend.type = "bi.last_tree_leaf_item";
}
BI.defaults(node, extend);
}
@ -65326,7 +65407,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
this.initTree(this.options.items);
},
_formatItems: function (nodes, layer) {
_formatItems: function (nodes, layer, pNode) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {};
@ -65334,28 +65415,28 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
extend.pNode = pNode;
if (node.isParent === true || BI.isNotEmptyArray(node.children)) {
switch (i) {
case 0 :
extend.type = "bi.multilayer_select_tree_first_plus_group_node";
break;
case nodes.length - 1 :
extend.type = "bi.multilayer_select_tree_last_plus_group_node";
break;
default :
extend.type = "bi.multilayer_select_tree_mid_plus_group_node";
break;
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_select_tree_last_plus_group_node";
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_select_tree_first_plus_group_node"
}
if (i === 0 && i === nodes.length - 1 && !pNode) { // 根
extend.type = "bi.multilayer_select_tree_plus_group_node";
}
BI.defaults(node, extend);
self._formatItems(node.children, layer + 1);
self._formatItems(node.children, layer + 1, node);
} else {
switch (i) {
case nodes.length - 1:
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
break;
default :
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"
}
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
}
BI.defaults(node, extend);
}
@ -65552,11 +65633,20 @@ BI.MultiLayerSelectTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -65646,11 +65736,20 @@ BI.MultiLayerSelectTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -65736,11 +65835,20 @@ BI.MultiLayerSelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -65783,6 +65891,109 @@ BI.MultiLayerSelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
});
BI.shortcut("bi.multilayer_select_tree_mid_plus_group_node", BI.MultiLayerSelectTreeMidPlusGroupNode);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
* @class BI.MultiLayerSelectTreePlusGroupNode
* @extends BI.NodeButton
*/
BI.MultiLayerSelectTreePlusGroupNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
var conf = BI.MultiLayerSelectTreePlusGroupNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
extraCls: "bi-multilayer-select-tree-first-plus-group-node bi-list-item-active",
layer: 0, // 第几层级
id: "",
pId: "",
readonly: true,
open: false,
height: 24
});
},
_init: function () {
BI.MultiLayerSelectTreePlusGroupNode.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.node = BI.createWidget({
type: "bi.select_tree_plus_group_node",
cls: "bi-list-item-none",
stopPropagation: true,
logic: {
dynamic: true
},
id: o.id,
pId: o.pId,
open: o.open,
height: o.height,
hgap: o.hgap,
text: o.text,
value: o.value,
py: o.py
});
this.node.on(BI.Controller.EVENT_CHANGE, function (type) {
self.setSelected(self.isSelected());
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
});
items.push(this.node);
BI.createWidget({
type: "bi.td",
element: this,
columnSize: BI.makeArray(o.layer, 12),
items: [items]
});
},
isOnce: function () {
return true;
},
doRedMark: function () {
this.node.doRedMark.apply(this.node, arguments);
},
unRedMark: function () {
this.node.unRedMark.apply(this.node, arguments);
},
isSelected: function () {
return this.node.isSelected();
},
setSelected: function (b) {
BI.MultiLayerSelectTreePlusGroupNode.superclass.setSelected.apply(this, arguments);
this.node.setSelected(b);
},
doClick: function () {
BI.NodeButton.superclass.doClick.apply(this, arguments);
this.node.setSelected(this.isSelected());
},
setOpened: function (v) {
BI.MultiLayerSelectTreePlusGroupNode.superclass.setOpened.apply(this, arguments);
this.node.setOpened(v);
}
});
BI.shortcut("bi.multilayer_select_tree_plus_group_node", BI.MultiLayerSelectTreePlusGroupNode);/**
* 多层级下拉单选树
* Created by GUY on 2016/1/26.
*
@ -65887,7 +66098,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
this.initTree(this.options.items);
},
_formatItems: function (nodes, layer) {
_formatItems: function (nodes, layer, pNode) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {};
@ -65895,28 +66106,28 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
extend.pNode = pNode;
if (node.isParent === true || BI.isNotEmptyArray(node.children)) {
switch (i) {
case 0 :
extend.type = "bi.multilayer_single_tree_first_plus_group_node";
break;
case nodes.length - 1 :
extend.type = "bi.multilayer_single_tree_last_plus_group_node";
break;
default :
extend.type = "bi.multilayer_single_tree_mid_plus_group_node";
break;
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_plus_group_node";
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_plus_group_node";
}
if (i === 0 && i === nodes.length - 1 && !pNode) { // 根
extend.type = "bi.multilayer_single_tree_plus_group_node";
}
BI.defaults(node, extend);
self._formatItems(node.children, layer + 1);
self._formatItems(node.children, layer + 1, node);
} else {
switch (i) {
case nodes.length - 1:
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
break;
default :
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"
}
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
}
BI.defaults(node, extend);
}
@ -66106,6 +66317,7 @@ BI.MultiLayerSingleTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, {
id: o.id,
pId: o.pId,
open: o.open,
isLastNode: o.isLastNode,
height: o.height,
hgap: o.hgap,
text: o.text,
@ -66120,11 +66332,20 @@ BI.MultiLayerSingleTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -66204,11 +66425,20 @@ BI.MultiLayerSingleTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -66288,11 +66518,20 @@ BI.MultiLayerSingleTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -66328,6 +66567,101 @@ BI.MultiLayerSingleTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
});
BI.shortcut("bi.multilayer_single_tree_mid_plus_group_node", BI.MultiLayerSingleTreeMidPlusGroupNode);/**
*@desc 根节点,既是第一个又是最后一个
*@author dailer
*@date 2018/09/16
*/
BI.MultiLayerSingleTreePlusGroupNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
var conf = BI.MultiLayerSingleTreePlusGroupNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
extraCls: "bi-multilayer-single-tree-plus-group-node bi-list-item",
layer: 0, // 第几层级
id: "",
pId: "",
open: false,
height: 24
});
},
_init: function () {
BI.MultiLayerSingleTreePlusGroupNode.superclass._init.apply(this, arguments);
var self = this, o = this.options;
if (o.isLastNode && !o.pNode) {
}
this.node = BI.createWidget({
type: "bi.plus_group_node",
cls: "bi-list-item-none",
logic: {
dynamic: true
},
id: o.id,
pId: o.pId,
open: o.open,
isLastNode: o.isLastNode,
height: o.height,
hgap: o.hgap,
text: o.text,
value: o.value,
py: o.py,
keyword: o.keyword
});
this.node.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {// 本身实现click功能
return;
}
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
});
items.push(this.node);
BI.createWidget({
type: "bi.td",
element: this,
columnSize: BI.makeArray(o.layer, 12),
items: [items]
});
},
doRedMark: function () {
this.node.doRedMark.apply(this.node, arguments);
},
unRedMark: function () {
this.node.unRedMark.apply(this.node, arguments);
},
doClick: function () {
BI.MultiLayerSingleTreePlusGroupNode.superclass.doClick.apply(this, arguments);
this.node.setSelected(this.isSelected());
},
setOpened: function (v) {
BI.MultiLayerSingleTreePlusGroupNode.superclass.setOpened.apply(this, arguments);
if (BI.isNotNull(this.node)) {
this.node.setOpened(v);
}
}
});
BI.shortcut("bi.multilayer_single_tree_plus_group_node", BI.MultiLayerSingleTreePlusGroupNode);/**
*
* Created by GUY on 2016/1/27.
* @class BI.MultiLayerSingleTreeFirstTreeLeafItem
@ -66371,11 +66705,21 @@ BI.MultiLayerSingleTreeFirstTreeLeafItem = BI.inherit(BI.BasicButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -66460,11 +66804,20 @@ BI.MultiLayerSingleTreeLastTreeLeafItem = BI.inherit(BI.BasicButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -66549,11 +66902,20 @@ BI.MultiLayerSingleTreeMidTreeLeafItem = BI.inherit(BI.BasicButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -74078,6 +74440,91 @@ BI.SelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
});
BI.shortcut("bi.select_tree_mid_plus_group_node", BI.SelectTreeMidPlusGroupNode);/**
* 加号表示的组节点
* Created by GUY on 2015/9/6.
* @class BI.SelectTreePlusGroupNode
* @extends BI.NodeButton
*/
BI.SelectTreePlusGroupNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
var conf = BI.SelectTreePlusGroupNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-select-tree-plus-group-node bi-list-item-active",
logic: {
dynamic: false
},
id: "",
pId: "",
readonly: true,
open: false,
height: 24
});
},
_init: function () {
BI.SelectTreePlusGroupNode.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.checkbox = BI.createWidget({
type: "bi.tree_node_checkbox",
stopPropagation: true
});
this.text = BI.createWidget({
type: "bi.label",
textAlign: "left",
whiteSpace: "nowrap",
textHeight: o.height,
height: o.height,
hgap: o.hgap,
text: o.text,
value: o.value,
keyword: o.keyword,
py: o.py
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
if (this.isSelected()) {
self.triggerExpand();
} else {
self.triggerCollapse();
}
}
});
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {
width: 24,
el: this.checkbox
}, this.text);
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic(type, BI.extend(o.logic, {
items: items
}))));
},
isOnce: function () {
return true;
},
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
},
doClick: function () {
BI.NodeButton.superclass.doClick.apply(this, arguments);
},
setOpened: function (v) {
BI.SelectTreePlusGroupNode.superclass.setOpened.apply(this, arguments);
if (BI.isNotNull(this.checkbox)) {
this.checkbox.setSelected(v);
}
}
});
BI.shortcut("bi.select_tree_plus_group_node", BI.SelectTreePlusGroupNode);/**
* @class BI.SelectTreeCombo
* @extends BI.Widget
*/
@ -74239,32 +74686,33 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
});
},
_formatItems: function (nodes, layer) {
_formatItems: function (nodes, layer, pNode) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {layer: layer};
node.id = node.id || BI.UUID();
extend.pNode = pNode;
if (node.isParent === true || BI.isNotEmptyArray(node.children)) {
switch (i) {
case 0 :
extend.type = "bi.select_tree_first_plus_group_node";
break;
case nodes.length - 1 :
extend.type = "bi.select_tree_last_plus_group_node";
break;
default :
extend.type = "bi.select_tree_mid_plus_group_node";
break;
if (i === nodes.length - 1) {
extend.type = "bi.select_tree_last_plus_group_node";
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.select_tree_first_plus_group_node"
}
if (i === 0 && i === nodes.length - 1) { // 根
extend.type = "bi.select_tree_plus_group_node";
}
BI.defaults(node, extend);
self._formatItems(node.children);
self._formatItems(node.children, layer + 1, node);
} else {
switch (i) {
case nodes.length - 1:
extend.type = "bi.last_tree_leaf_item";
break;
default :
extend.type = "bi.mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.first_tree_leaf_item"
}
if (i === nodes.length - 1) {
extend.type = "bi.last_tree_leaf_item";
}
BI.defaults(node, extend);
}
@ -74283,7 +74731,7 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.select_tree_expander",
isDefaultInit: true
},
items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)),
items: this._formatItems(BI.Tree.transformToTreeFormat(o.items), 0),
value: o.value,
chooseType: BI.Selection.Single
});

68
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

47
dist/case.js vendored

@ -1069,7 +1069,7 @@ BI.FirstTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 12,
el: {
type: "bi.layout",
cls: "base-line-conn-background",
cls: (o.pNode && o.pNode.isLastNode) ? "" : "base-line-conn-background",
width: 12,
height: o.height
}
@ -1077,7 +1077,7 @@ BI.FirstTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 24,
el: {
type: "bi.layout",
cls: "mid-line-conn-background",
cls: "first-line-conn-background",
width: 24,
height: o.height
}
@ -1260,7 +1260,7 @@ BI.LastTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 12,
el: {
type: "bi.layout",
cls: "base-line-conn-background",
cls: (o.pNode && o.pNode.isLastNode) ? "" : "base-line-conn-background",
width: 12,
height: o.height
}
@ -1268,7 +1268,7 @@ BI.LastTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 24,
el: {
type: "bi.layout",
cls: "mid-line-conn-background",
cls: "last-line-conn-background",
width: 24,
height: o.height
}
@ -1364,7 +1364,7 @@ BI.MidTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 12,
el: {
type: "bi.layout",
cls: "base-line-conn-background",
cls: (o.pNode && o.pNode.isLastNode) ? "" : "base-line-conn-background",
width: 12,
height: o.height
}
@ -2075,9 +2075,9 @@ BI.LastTreeNodeCheckbox = BI.inherit(BI.IconButton, {
setSelected: function (v) {
BI.LastTreeNodeCheckbox.superclass.setSelected.apply(this, arguments);
if (v === true) {
this.element.addClass("tree-expand-icon-type3");
this.element.addClass("tree-expand-icon-type4");
} else {
this.element.removeClass("tree-expand-icon-type3");
this.element.removeClass("tree-expand-icon-type4");
}
}
});
@ -8981,34 +8981,35 @@ BI.LevelTree = BI.inherit(BI.Widget, {
this.initTree(this.options.items);
},
_formatItems: function (nodes, layer) {
_formatItems: function (nodes, layer, pNode) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {layer: layer};
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
extend.pNode = pNode;
if (node.isParent === true || BI.isNotEmptyArray(node.children)) {
switch (i) {
case 0 :
extend.type = "bi.first_plus_group_node";
break;
case nodes.length - 1 :
extend.type = "bi.last_plus_group_node";
break;
default :
extend.type = "bi.mid_plus_group_node";
break;
if (i === nodes.length - 1) {
extend.type = "bi.last_plus_group_node";
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.first_plus_group_node"
}
if (i === 0 && i === nodes.length - 1) { // 根
extend.type = "bi.plus_group_node";
}
BI.defaults(node, extend);
self._formatItems(node.children, layer + 1);
self._formatItems(node.children, layer + 1, node);
} else {
switch (i) {
case nodes.length - 1:
extend.type = "bi.last_tree_leaf_item";
break;
default :
extend.type = "bi.mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.first_tree_leaf_item"
}
if (i === nodes.length - 1) {
extend.type = "bi.last_tree_leaf_item";
}
BI.defaults(node, extend);
}

114
dist/core.js vendored

@ -19012,7 +19012,7 @@ BI.prepares.push(function () {
}
return BI.extend(ob, {type: "bi.flex_center"});
}
return ob;
return BI.extend(ob, {type: "bi.inline_center_adapt"});
});
});/**
* Detect Element Resize.
@ -30359,6 +30359,98 @@ BI.AbsoluteVerticalLayout = BI.inherit(BI.Layout, {
}
});
BI.shortcut("bi.absolute_vertical_adapt", BI.AbsoluteVerticalLayout);/**
* 内联布局
* @class BI.InlineCenterAdaptLayout
* @extends BI.Layout
*
* @cfg {JSON} options 配置属性
* @cfg {Number} [hgap=0] 水平间隙
* @cfg {Number} [vgap=0] 垂直间隙
*/
BI.InlineVaerticalAdaptLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.InlineLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-inline-center-adapt-layout",
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
});
},
render: function () {
BI.InlineVaerticalAdaptLayout.superclass.render.apply(this, arguments);
this.element.css({
whiteSpace: "nowrap",
"text-align": "left"
});
this.populate(this.options.items);
},
_addElement: function (i, item, length) {
var o = this.options;
if (!this.hasWidget(this.getName() + i)) {
var t = BI.createWidget(item);
this.addWidget(this.getName() + i, t);
} else {
var t = this.getWidgetByName(this.getName() + i);
}
t.element.css({
position: "relative",
display: "inline-block",
"vertical-align": "middle",
"*display": "inline",
"*zoom": 1
});
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
t.element.css({
"margin-top": (o.vgap || 0) + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px"
});
}
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
t.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) + "px"
});
}
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
t.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) + "px"
});
}
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
t.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px"
});
}
return t;
},
resize: function () {
this.stroke(this.options.items);
},
addItem: function (item) {
throw new Error("不能添加元素");
},
stroke: function (items) {
var self = this;
BI.each(items, function (i, item) {
if (item) {
self._addElement(i, item, items.length);
}
});
},
populate: function (items) {
BI.InlineVaerticalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut("bi.vertical_inline_adapt", BI.InlineVaerticalAdaptLayout);/**
* 自适应水平和垂直方向都居中容器
* @class BI.CenterAdaptLayout
* @extends BI.Layout
@ -31080,33 +31172,21 @@ BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, {
render: function () {
BI.InlineCenterAdaptLayout.superclass.render.apply(this, arguments);
this.element.css({
whiteSpace: "nowrap"
whiteSpace: "nowrap",
textAlign: "center"
});
this.populate(this.options.items);
},
_addElement: function (i, item, length) {
var o = this.options;
if (!this.hasWidget(this.getName() + i)) {
var t = BI.createWidget(item);
t.element.css({
position: "relative"
});
var w = BI.createWidget({
type: "bi.horizontal_auto",
items: [t]
});
this.addWidget(this.getName() + i, w);
} else {
var w = this.getWidgetByName(this.getName() + i);
}
var w = BI.InlineVerticalAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({
position: "relative",
display: "inline-block",
"vertical-align": "middle",
"*display": "inline",
"*zoom": 1,
"min-width": 100 / length + "%"
"*zoom": 1
});
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({

23
dist/demo.js vendored

@ -11435,7 +11435,28 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
},
mounted: function () {
this.tree.populate(BI.deepClone(Demo.CONSTANTS.TREE));
var tree = [
// {id: -2, pId: 0, value: "根目录1", text: "根目录1"},
{id: -1, pId: 0, value: "根目录", text: "根目录"},
{id: 1, pId: -1, value: "第一级目录1", text: "第一级目录1"},
{id: 11, pId: 1, value: "第二级文件1", text: "第二级文件1"},
{id: 12, pId: 1, value: "第二级目录2", text: "第二级目录2"},
{id: 121, pId: 12, value: "第三级目录1", text: "第三级目录1"},
{id: 122, pId: 12, value: "第三级文件1", text: "第三级文件1"},
{id: 1211, pId: 121, value: "第四级目录1", text: "第四级目录1"},
{id: 2, pId: -1, value: "第一级目录2", text: "第一级目录2"},
{id: 21, pId: 2, value: "第二级目录3", text: "第二级目录3"},
{id: 22, pId: 2, value: "第二级文件2", text: "第二级文件2"},
{id: 211, pId: 21, value: "第三级目录2", text: "第三级目录2"},
{id: 212, pId: 21, value: "第三级文件2", text: "第三级文件2"},
{id: 2111, pId: 211, value: "第四级文件1", text: "第四级文件1"},
{id: 3, pId: -1, value: "第一级目录3", text: "第一级目录3"},
{id: 31, pId: 3, value: "第二级文件2", text: "第二级文件2"},
{id: 33, pId: 3, value: "第二级目录3", text: "第二级目录1"},
{id: 32, pId: 3, value: "第二级文件3", text: "第二级文件3"},
{id: 331, pId: 33, value: "第三级文件1", text: "第三级文件1"}
];
this.tree.populate(tree);
}
});

666
dist/fineui.js vendored

@ -19254,7 +19254,7 @@ BI.prepares.push(function () {
}
return BI.extend(ob, {type: "bi.flex_center"});
}
return ob;
return BI.extend(ob, {type: "bi.inline_center_adapt"});
});
});/**
* Detect Element Resize.
@ -30601,6 +30601,98 @@ BI.AbsoluteVerticalLayout = BI.inherit(BI.Layout, {
}
});
BI.shortcut("bi.absolute_vertical_adapt", BI.AbsoluteVerticalLayout);/**
* 内联布局
* @class BI.InlineCenterAdaptLayout
* @extends BI.Layout
*
* @cfg {JSON} options 配置属性
* @cfg {Number} [hgap=0] 水平间隙
* @cfg {Number} [vgap=0] 垂直间隙
*/
BI.InlineVaerticalAdaptLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.InlineLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-inline-center-adapt-layout",
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
});
},
render: function () {
BI.InlineVaerticalAdaptLayout.superclass.render.apply(this, arguments);
this.element.css({
whiteSpace: "nowrap",
"text-align": "left"
});
this.populate(this.options.items);
},
_addElement: function (i, item, length) {
var o = this.options;
if (!this.hasWidget(this.getName() + i)) {
var t = BI.createWidget(item);
this.addWidget(this.getName() + i, t);
} else {
var t = this.getWidgetByName(this.getName() + i);
}
t.element.css({
position: "relative",
display: "inline-block",
"vertical-align": "middle",
"*display": "inline",
"*zoom": 1
});
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
t.element.css({
"margin-top": (o.vgap || 0) + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px"
});
}
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
t.element.css({
"margin-left": o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) + "px"
});
}
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
t.element.css({
"margin-right": o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) + "px"
});
}
if (o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) !== 0) {
t.element.css({
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px"
});
}
return t;
},
resize: function () {
this.stroke(this.options.items);
},
addItem: function (item) {
throw new Error("不能添加元素");
},
stroke: function (items) {
var self = this;
BI.each(items, function (i, item) {
if (item) {
self._addElement(i, item, items.length);
}
});
},
populate: function (items) {
BI.InlineVaerticalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut("bi.vertical_inline_adapt", BI.InlineVaerticalAdaptLayout);/**
* 自适应水平和垂直方向都居中容器
* @class BI.CenterAdaptLayout
* @extends BI.Layout
@ -31322,33 +31414,21 @@ BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, {
render: function () {
BI.InlineCenterAdaptLayout.superclass.render.apply(this, arguments);
this.element.css({
whiteSpace: "nowrap"
whiteSpace: "nowrap",
textAlign: "center"
});
this.populate(this.options.items);
},
_addElement: function (i, item, length) {
var o = this.options;
if (!this.hasWidget(this.getName() + i)) {
var t = BI.createWidget(item);
t.element.css({
position: "relative"
});
var w = BI.createWidget({
type: "bi.horizontal_auto",
items: [t]
});
this.addWidget(this.getName() + i, w);
} else {
var w = this.getWidgetByName(this.getName() + i);
}
var w = BI.InlineVerticalAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({
position: "relative",
display: "inline-block",
"vertical-align": "middle",
"*display": "inline",
"*zoom": 1,
"min-width": 100 / length + "%"
"*zoom": 1
});
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({
@ -50142,7 +50222,7 @@ BI.FirstTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 12,
el: {
type: "bi.layout",
cls: "base-line-conn-background",
cls: (o.pNode && o.pNode.isLastNode) ? "" : "base-line-conn-background",
width: 12,
height: o.height
}
@ -50150,7 +50230,7 @@ BI.FirstTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 24,
el: {
type: "bi.layout",
cls: "mid-line-conn-background",
cls: "first-line-conn-background",
width: 24,
height: o.height
}
@ -50333,7 +50413,7 @@ BI.LastTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 12,
el: {
type: "bi.layout",
cls: "base-line-conn-background",
cls: (o.pNode && o.pNode.isLastNode) ? "" : "base-line-conn-background",
width: 12,
height: o.height
}
@ -50341,7 +50421,7 @@ BI.LastTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 24,
el: {
type: "bi.layout",
cls: "mid-line-conn-background",
cls: "last-line-conn-background",
width: 24,
height: o.height
}
@ -50437,7 +50517,7 @@ BI.MidTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 12,
el: {
type: "bi.layout",
cls: "base-line-conn-background",
cls: (o.pNode && o.pNode.isLastNode) ? "" : "base-line-conn-background",
width: 12,
height: o.height
}
@ -51148,9 +51228,9 @@ BI.LastTreeNodeCheckbox = BI.inherit(BI.IconButton, {
setSelected: function (v) {
BI.LastTreeNodeCheckbox.superclass.setSelected.apply(this, arguments);
if (v === true) {
this.element.addClass("tree-expand-icon-type3");
this.element.addClass("tree-expand-icon-type4");
} else {
this.element.removeClass("tree-expand-icon-type3");
this.element.removeClass("tree-expand-icon-type4");
}
}
});
@ -58054,34 +58134,35 @@ BI.LevelTree = BI.inherit(BI.Widget, {
this.initTree(this.options.items);
},
_formatItems: function (nodes, layer) {
_formatItems: function (nodes, layer, pNode) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {layer: layer};
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
extend.pNode = pNode;
if (node.isParent === true || BI.isNotEmptyArray(node.children)) {
switch (i) {
case 0 :
extend.type = "bi.first_plus_group_node";
break;
case nodes.length - 1 :
extend.type = "bi.last_plus_group_node";
break;
default :
extend.type = "bi.mid_plus_group_node";
break;
if (i === nodes.length - 1) {
extend.type = "bi.last_plus_group_node";
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.first_plus_group_node"
}
if (i === 0 && i === nodes.length - 1) { // 根
extend.type = "bi.plus_group_node";
}
BI.defaults(node, extend);
self._formatItems(node.children, layer + 1);
self._formatItems(node.children, layer + 1, node);
} else {
switch (i) {
case nodes.length - 1:
extend.type = "bi.last_tree_leaf_item";
break;
default :
extend.type = "bi.mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.first_tree_leaf_item"
}
if (i === nodes.length - 1) {
extend.type = "bi.last_tree_leaf_item";
}
BI.defaults(node, extend);
}
@ -65568,7 +65649,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
this.initTree(this.options.items);
},
_formatItems: function (nodes, layer) {
_formatItems: function (nodes, layer, pNode) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {};
@ -65576,28 +65657,28 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
extend.pNode = pNode;
if (node.isParent === true || BI.isNotEmptyArray(node.children)) {
switch (i) {
case 0 :
extend.type = "bi.multilayer_select_tree_first_plus_group_node";
break;
case nodes.length - 1 :
extend.type = "bi.multilayer_select_tree_last_plus_group_node";
break;
default :
extend.type = "bi.multilayer_select_tree_mid_plus_group_node";
break;
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_select_tree_last_plus_group_node";
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_select_tree_first_plus_group_node"
}
if (i === 0 && i === nodes.length - 1 && !pNode) { // 根
extend.type = "bi.multilayer_select_tree_plus_group_node";
}
BI.defaults(node, extend);
self._formatItems(node.children, layer + 1);
self._formatItems(node.children, layer + 1, node);
} else {
switch (i) {
case nodes.length - 1:
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
break;
default :
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"
}
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
}
BI.defaults(node, extend);
}
@ -65794,11 +65875,20 @@ BI.MultiLayerSelectTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -65888,11 +65978,20 @@ BI.MultiLayerSelectTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -65978,11 +66077,20 @@ BI.MultiLayerSelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -66025,6 +66133,109 @@ BI.MultiLayerSelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
});
BI.shortcut("bi.multilayer_select_tree_mid_plus_group_node", BI.MultiLayerSelectTreeMidPlusGroupNode);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
* @class BI.MultiLayerSelectTreePlusGroupNode
* @extends BI.NodeButton
*/
BI.MultiLayerSelectTreePlusGroupNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
var conf = BI.MultiLayerSelectTreePlusGroupNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
extraCls: "bi-multilayer-select-tree-first-plus-group-node bi-list-item-active",
layer: 0, // 第几层级
id: "",
pId: "",
readonly: true,
open: false,
height: 24
});
},
_init: function () {
BI.MultiLayerSelectTreePlusGroupNode.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.node = BI.createWidget({
type: "bi.select_tree_plus_group_node",
cls: "bi-list-item-none",
stopPropagation: true,
logic: {
dynamic: true
},
id: o.id,
pId: o.pId,
open: o.open,
height: o.height,
hgap: o.hgap,
text: o.text,
value: o.value,
py: o.py
});
this.node.on(BI.Controller.EVENT_CHANGE, function (type) {
self.setSelected(self.isSelected());
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
});
items.push(this.node);
BI.createWidget({
type: "bi.td",
element: this,
columnSize: BI.makeArray(o.layer, 12),
items: [items]
});
},
isOnce: function () {
return true;
},
doRedMark: function () {
this.node.doRedMark.apply(this.node, arguments);
},
unRedMark: function () {
this.node.unRedMark.apply(this.node, arguments);
},
isSelected: function () {
return this.node.isSelected();
},
setSelected: function (b) {
BI.MultiLayerSelectTreePlusGroupNode.superclass.setSelected.apply(this, arguments);
this.node.setSelected(b);
},
doClick: function () {
BI.NodeButton.superclass.doClick.apply(this, arguments);
this.node.setSelected(this.isSelected());
},
setOpened: function (v) {
BI.MultiLayerSelectTreePlusGroupNode.superclass.setOpened.apply(this, arguments);
this.node.setOpened(v);
}
});
BI.shortcut("bi.multilayer_select_tree_plus_group_node", BI.MultiLayerSelectTreePlusGroupNode);/**
* 多层级下拉单选树
* Created by GUY on 2016/1/26.
*
@ -66129,7 +66340,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
this.initTree(this.options.items);
},
_formatItems: function (nodes, layer) {
_formatItems: function (nodes, layer, pNode) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {};
@ -66137,28 +66348,28 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
extend.pNode = pNode;
if (node.isParent === true || BI.isNotEmptyArray(node.children)) {
switch (i) {
case 0 :
extend.type = "bi.multilayer_single_tree_first_plus_group_node";
break;
case nodes.length - 1 :
extend.type = "bi.multilayer_single_tree_last_plus_group_node";
break;
default :
extend.type = "bi.multilayer_single_tree_mid_plus_group_node";
break;
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_plus_group_node";
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_plus_group_node";
}
if (i === 0 && i === nodes.length - 1 && !pNode) { // 根
extend.type = "bi.multilayer_single_tree_plus_group_node";
}
BI.defaults(node, extend);
self._formatItems(node.children, layer + 1);
self._formatItems(node.children, layer + 1, node);
} else {
switch (i) {
case nodes.length - 1:
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
break;
default :
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"
}
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
}
BI.defaults(node, extend);
}
@ -66348,6 +66559,7 @@ BI.MultiLayerSingleTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, {
id: o.id,
pId: o.pId,
open: o.open,
isLastNode: o.isLastNode,
height: o.height,
hgap: o.hgap,
text: o.text,
@ -66362,11 +66574,20 @@ BI.MultiLayerSingleTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -66446,11 +66667,20 @@ BI.MultiLayerSingleTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -66530,11 +66760,20 @@ BI.MultiLayerSingleTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -66570,6 +66809,101 @@ BI.MultiLayerSingleTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
});
BI.shortcut("bi.multilayer_single_tree_mid_plus_group_node", BI.MultiLayerSingleTreeMidPlusGroupNode);/**
*@desc 根节点,既是第一个又是最后一个
*@author dailer
*@date 2018/09/16
*/
BI.MultiLayerSingleTreePlusGroupNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
var conf = BI.MultiLayerSingleTreePlusGroupNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
extraCls: "bi-multilayer-single-tree-plus-group-node bi-list-item",
layer: 0, // 第几层级
id: "",
pId: "",
open: false,
height: 24
});
},
_init: function () {
BI.MultiLayerSingleTreePlusGroupNode.superclass._init.apply(this, arguments);
var self = this, o = this.options;
if (o.isLastNode && !o.pNode) {
}
this.node = BI.createWidget({
type: "bi.plus_group_node",
cls: "bi-list-item-none",
logic: {
dynamic: true
},
id: o.id,
pId: o.pId,
open: o.open,
isLastNode: o.isLastNode,
height: o.height,
hgap: o.hgap,
text: o.text,
value: o.value,
py: o.py,
keyword: o.keyword
});
this.node.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {// 本身实现click功能
return;
}
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
});
items.push(this.node);
BI.createWidget({
type: "bi.td",
element: this,
columnSize: BI.makeArray(o.layer, 12),
items: [items]
});
},
doRedMark: function () {
this.node.doRedMark.apply(this.node, arguments);
},
unRedMark: function () {
this.node.unRedMark.apply(this.node, arguments);
},
doClick: function () {
BI.MultiLayerSingleTreePlusGroupNode.superclass.doClick.apply(this, arguments);
this.node.setSelected(this.isSelected());
},
setOpened: function (v) {
BI.MultiLayerSingleTreePlusGroupNode.superclass.setOpened.apply(this, arguments);
if (BI.isNotNull(this.node)) {
this.node.setOpened(v);
}
}
});
BI.shortcut("bi.multilayer_single_tree_plus_group_node", BI.MultiLayerSingleTreePlusGroupNode);/**
*
* Created by GUY on 2016/1/27.
* @class BI.MultiLayerSingleTreeFirstTreeLeafItem
@ -66613,11 +66947,21 @@ BI.MultiLayerSingleTreeFirstTreeLeafItem = BI.inherit(BI.BasicButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -66702,11 +67046,20 @@ BI.MultiLayerSingleTreeLastTreeLeafItem = BI.inherit(BI.BasicButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -66791,11 +67144,20 @@ BI.MultiLayerSingleTreeMidTreeLeafItem = BI.inherit(BI.BasicButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -74320,6 +74682,91 @@ BI.SelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
});
BI.shortcut("bi.select_tree_mid_plus_group_node", BI.SelectTreeMidPlusGroupNode);/**
* 加号表示的组节点
* Created by GUY on 2015/9/6.
* @class BI.SelectTreePlusGroupNode
* @extends BI.NodeButton
*/
BI.SelectTreePlusGroupNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
var conf = BI.SelectTreePlusGroupNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-select-tree-plus-group-node bi-list-item-active",
logic: {
dynamic: false
},
id: "",
pId: "",
readonly: true,
open: false,
height: 24
});
},
_init: function () {
BI.SelectTreePlusGroupNode.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.checkbox = BI.createWidget({
type: "bi.tree_node_checkbox",
stopPropagation: true
});
this.text = BI.createWidget({
type: "bi.label",
textAlign: "left",
whiteSpace: "nowrap",
textHeight: o.height,
height: o.height,
hgap: o.hgap,
text: o.text,
value: o.value,
keyword: o.keyword,
py: o.py
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
if (this.isSelected()) {
self.triggerExpand();
} else {
self.triggerCollapse();
}
}
});
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {
width: 24,
el: this.checkbox
}, this.text);
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic(type, BI.extend(o.logic, {
items: items
}))));
},
isOnce: function () {
return true;
},
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
},
doClick: function () {
BI.NodeButton.superclass.doClick.apply(this, arguments);
},
setOpened: function (v) {
BI.SelectTreePlusGroupNode.superclass.setOpened.apply(this, arguments);
if (BI.isNotNull(this.checkbox)) {
this.checkbox.setSelected(v);
}
}
});
BI.shortcut("bi.select_tree_plus_group_node", BI.SelectTreePlusGroupNode);/**
* @class BI.SelectTreeCombo
* @extends BI.Widget
*/
@ -74481,32 +74928,33 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
});
},
_formatItems: function (nodes, layer) {
_formatItems: function (nodes, layer, pNode) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {layer: layer};
node.id = node.id || BI.UUID();
extend.pNode = pNode;
if (node.isParent === true || BI.isNotEmptyArray(node.children)) {
switch (i) {
case 0 :
extend.type = "bi.select_tree_first_plus_group_node";
break;
case nodes.length - 1 :
extend.type = "bi.select_tree_last_plus_group_node";
break;
default :
extend.type = "bi.select_tree_mid_plus_group_node";
break;
if (i === nodes.length - 1) {
extend.type = "bi.select_tree_last_plus_group_node";
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.select_tree_first_plus_group_node"
}
if (i === 0 && i === nodes.length - 1) { // 根
extend.type = "bi.select_tree_plus_group_node";
}
BI.defaults(node, extend);
self._formatItems(node.children);
self._formatItems(node.children, layer + 1, node);
} else {
switch (i) {
case nodes.length - 1:
extend.type = "bi.last_tree_leaf_item";
break;
default :
extend.type = "bi.mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.first_tree_leaf_item"
}
if (i === nodes.length - 1) {
extend.type = "bi.last_tree_leaf_item";
}
BI.defaults(node, extend);
}
@ -74525,7 +74973,7 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.select_tree_expander",
isDefaultInit: true
},
items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)),
items: this._formatItems(BI.Tree.transformToTreeFormat(o.items), 0),
value: o.value,
chooseType: BI.Selection.Single
});

68
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

505
dist/widget.js vendored

@ -6704,7 +6704,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
this.initTree(this.options.items);
},
_formatItems: function (nodes, layer) {
_formatItems: function (nodes, layer, pNode) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {};
@ -6712,28 +6712,28 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
extend.pNode = pNode;
if (node.isParent === true || BI.isNotEmptyArray(node.children)) {
switch (i) {
case 0 :
extend.type = "bi.multilayer_select_tree_first_plus_group_node";
break;
case nodes.length - 1 :
extend.type = "bi.multilayer_select_tree_last_plus_group_node";
break;
default :
extend.type = "bi.multilayer_select_tree_mid_plus_group_node";
break;
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_select_tree_last_plus_group_node";
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_select_tree_first_plus_group_node"
}
if (i === 0 && i === nodes.length - 1 && !pNode) { // 根
extend.type = "bi.multilayer_select_tree_plus_group_node";
}
BI.defaults(node, extend);
self._formatItems(node.children, layer + 1);
self._formatItems(node.children, layer + 1, node);
} else {
switch (i) {
case nodes.length - 1:
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
break;
default :
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"
}
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
}
BI.defaults(node, extend);
}
@ -6930,11 +6930,20 @@ BI.MultiLayerSelectTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -7024,11 +7033,20 @@ BI.MultiLayerSelectTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -7114,11 +7132,20 @@ BI.MultiLayerSelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -7161,6 +7188,109 @@ BI.MultiLayerSelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
});
BI.shortcut("bi.multilayer_select_tree_mid_plus_group_node", BI.MultiLayerSelectTreeMidPlusGroupNode);/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
* @class BI.MultiLayerSelectTreePlusGroupNode
* @extends BI.NodeButton
*/
BI.MultiLayerSelectTreePlusGroupNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
var conf = BI.MultiLayerSelectTreePlusGroupNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
extraCls: "bi-multilayer-select-tree-first-plus-group-node bi-list-item-active",
layer: 0, // 第几层级
id: "",
pId: "",
readonly: true,
open: false,
height: 24
});
},
_init: function () {
BI.MultiLayerSelectTreePlusGroupNode.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.node = BI.createWidget({
type: "bi.select_tree_plus_group_node",
cls: "bi-list-item-none",
stopPropagation: true,
logic: {
dynamic: true
},
id: o.id,
pId: o.pId,
open: o.open,
height: o.height,
hgap: o.hgap,
text: o.text,
value: o.value,
py: o.py
});
this.node.on(BI.Controller.EVENT_CHANGE, function (type) {
self.setSelected(self.isSelected());
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
});
items.push(this.node);
BI.createWidget({
type: "bi.td",
element: this,
columnSize: BI.makeArray(o.layer, 12),
items: [items]
});
},
isOnce: function () {
return true;
},
doRedMark: function () {
this.node.doRedMark.apply(this.node, arguments);
},
unRedMark: function () {
this.node.unRedMark.apply(this.node, arguments);
},
isSelected: function () {
return this.node.isSelected();
},
setSelected: function (b) {
BI.MultiLayerSelectTreePlusGroupNode.superclass.setSelected.apply(this, arguments);
this.node.setSelected(b);
},
doClick: function () {
BI.NodeButton.superclass.doClick.apply(this, arguments);
this.node.setSelected(this.isSelected());
},
setOpened: function (v) {
BI.MultiLayerSelectTreePlusGroupNode.superclass.setOpened.apply(this, arguments);
this.node.setOpened(v);
}
});
BI.shortcut("bi.multilayer_select_tree_plus_group_node", BI.MultiLayerSelectTreePlusGroupNode);/**
* 多层级下拉单选树
* Created by GUY on 2016/1/26.
*
@ -7265,7 +7395,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
this.initTree(this.options.items);
},
_formatItems: function (nodes, layer) {
_formatItems: function (nodes, layer, pNode) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {};
@ -7273,28 +7403,28 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
extend.pNode = pNode;
if (node.isParent === true || BI.isNotEmptyArray(node.children)) {
switch (i) {
case 0 :
extend.type = "bi.multilayer_single_tree_first_plus_group_node";
break;
case nodes.length - 1 :
extend.type = "bi.multilayer_single_tree_last_plus_group_node";
break;
default :
extend.type = "bi.multilayer_single_tree_mid_plus_group_node";
break;
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_plus_group_node";
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_plus_group_node";
}
if (i === 0 && i === nodes.length - 1 && !pNode) { // 根
extend.type = "bi.multilayer_single_tree_plus_group_node";
}
BI.defaults(node, extend);
self._formatItems(node.children, layer + 1);
self._formatItems(node.children, layer + 1, node);
} else {
switch (i) {
case nodes.length - 1:
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
break;
default :
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"
}
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
}
BI.defaults(node, extend);
}
@ -7484,6 +7614,7 @@ BI.MultiLayerSingleTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, {
id: o.id,
pId: o.pId,
open: o.open,
isLastNode: o.isLastNode,
height: o.height,
hgap: o.hgap,
text: o.text,
@ -7498,11 +7629,20 @@ BI.MultiLayerSingleTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -7582,11 +7722,20 @@ BI.MultiLayerSingleTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -7666,11 +7815,20 @@ BI.MultiLayerSingleTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -7706,6 +7864,101 @@ BI.MultiLayerSingleTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
});
BI.shortcut("bi.multilayer_single_tree_mid_plus_group_node", BI.MultiLayerSingleTreeMidPlusGroupNode);/**
*@desc 根节点,既是第一个又是最后一个
*@author dailer
*@date 2018/09/16
*/
BI.MultiLayerSingleTreePlusGroupNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
var conf = BI.MultiLayerSingleTreePlusGroupNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
extraCls: "bi-multilayer-single-tree-plus-group-node bi-list-item",
layer: 0, // 第几层级
id: "",
pId: "",
open: false,
height: 24
});
},
_init: function () {
BI.MultiLayerSingleTreePlusGroupNode.superclass._init.apply(this, arguments);
var self = this, o = this.options;
if (o.isLastNode && !o.pNode) {
}
this.node = BI.createWidget({
type: "bi.plus_group_node",
cls: "bi-list-item-none",
logic: {
dynamic: true
},
id: o.id,
pId: o.pId,
open: o.open,
isLastNode: o.isLastNode,
height: o.height,
hgap: o.hgap,
text: o.text,
value: o.value,
py: o.py,
keyword: o.keyword
});
this.node.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {// 本身实现click功能
return;
}
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
});
items.push(this.node);
BI.createWidget({
type: "bi.td",
element: this,
columnSize: BI.makeArray(o.layer, 12),
items: [items]
});
},
doRedMark: function () {
this.node.doRedMark.apply(this.node, arguments);
},
unRedMark: function () {
this.node.unRedMark.apply(this.node, arguments);
},
doClick: function () {
BI.MultiLayerSingleTreePlusGroupNode.superclass.doClick.apply(this, arguments);
this.node.setSelected(this.isSelected());
},
setOpened: function (v) {
BI.MultiLayerSingleTreePlusGroupNode.superclass.setOpened.apply(this, arguments);
if (BI.isNotNull(this.node)) {
this.node.setOpened(v);
}
}
});
BI.shortcut("bi.multilayer_single_tree_plus_group_node", BI.MultiLayerSingleTreePlusGroupNode);/**
*
* Created by GUY on 2016/1/27.
* @class BI.MultiLayerSingleTreeFirstTreeLeafItem
@ -7749,11 +8002,21 @@ BI.MultiLayerSingleTreeFirstTreeLeafItem = BI.inherit(BI.BasicButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -7838,11 +8101,20 @@ BI.MultiLayerSingleTreeLastTreeLeafItem = BI.inherit(BI.BasicButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -7927,11 +8199,20 @@ BI.MultiLayerSingleTreeMidTreeLeafItem = BI.inherit(BI.BasicButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
@ -15456,6 +15737,91 @@ BI.SelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
});
BI.shortcut("bi.select_tree_mid_plus_group_node", BI.SelectTreeMidPlusGroupNode);/**
* 加号表示的组节点
* Created by GUY on 2015/9/6.
* @class BI.SelectTreePlusGroupNode
* @extends BI.NodeButton
*/
BI.SelectTreePlusGroupNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
var conf = BI.SelectTreePlusGroupNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-select-tree-plus-group-node bi-list-item-active",
logic: {
dynamic: false
},
id: "",
pId: "",
readonly: true,
open: false,
height: 24
});
},
_init: function () {
BI.SelectTreePlusGroupNode.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.checkbox = BI.createWidget({
type: "bi.tree_node_checkbox",
stopPropagation: true
});
this.text = BI.createWidget({
type: "bi.label",
textAlign: "left",
whiteSpace: "nowrap",
textHeight: o.height,
height: o.height,
hgap: o.hgap,
text: o.text,
value: o.value,
keyword: o.keyword,
py: o.py
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
if (this.isSelected()) {
self.triggerExpand();
} else {
self.triggerCollapse();
}
}
});
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {
width: 24,
el: this.checkbox
}, this.text);
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic(type, BI.extend(o.logic, {
items: items
}))));
},
isOnce: function () {
return true;
},
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
},
doClick: function () {
BI.NodeButton.superclass.doClick.apply(this, arguments);
},
setOpened: function (v) {
BI.SelectTreePlusGroupNode.superclass.setOpened.apply(this, arguments);
if (BI.isNotNull(this.checkbox)) {
this.checkbox.setSelected(v);
}
}
});
BI.shortcut("bi.select_tree_plus_group_node", BI.SelectTreePlusGroupNode);/**
* @class BI.SelectTreeCombo
* @extends BI.Widget
*/
@ -15617,32 +15983,33 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
});
},
_formatItems: function (nodes, layer) {
_formatItems: function (nodes, layer, pNode) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {layer: layer};
node.id = node.id || BI.UUID();
extend.pNode = pNode;
if (node.isParent === true || BI.isNotEmptyArray(node.children)) {
switch (i) {
case 0 :
extend.type = "bi.select_tree_first_plus_group_node";
break;
case nodes.length - 1 :
extend.type = "bi.select_tree_last_plus_group_node";
break;
default :
extend.type = "bi.select_tree_mid_plus_group_node";
break;
if (i === nodes.length - 1) {
extend.type = "bi.select_tree_last_plus_group_node";
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.select_tree_first_plus_group_node"
}
if (i === 0 && i === nodes.length - 1) { // 根
extend.type = "bi.select_tree_plus_group_node";
}
BI.defaults(node, extend);
self._formatItems(node.children);
self._formatItems(node.children, layer + 1, node);
} else {
switch (i) {
case nodes.length - 1:
extend.type = "bi.last_tree_leaf_item";
break;
default :
extend.type = "bi.mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.first_tree_leaf_item"
}
if (i === nodes.length - 1) {
extend.type = "bi.last_tree_leaf_item";
}
BI.defaults(node, extend);
}
@ -15661,7 +16028,7 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.select_tree_expander",
isDefaultInit: true
},
items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)),
items: this._formatItems(BI.Tree.transformToTreeFormat(o.items), 0),
value: o.value,
chooseType: BI.Selection.Single
});

4
src/case/button/treeitem/item.first.treeleaf.js

@ -45,7 +45,7 @@ BI.FirstTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 12,
el: {
type: "bi.layout",
cls: "base-line-conn-background",
cls: (o.pNode && o.pNode.isLastNode) ? "" : "base-line-conn-background",
width: 12,
height: o.height
}
@ -53,7 +53,7 @@ BI.FirstTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 24,
el: {
type: "bi.layout",
cls: "mid-line-conn-background",
cls: "first-line-conn-background",
width: 24,
height: o.height
}

4
src/case/button/treeitem/item.last.treeleaf.js

@ -45,7 +45,7 @@ BI.LastTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 12,
el: {
type: "bi.layout",
cls: "base-line-conn-background",
cls: (o.pNode && o.pNode.isLastNode) ? "" : "base-line-conn-background",
width: 12,
height: o.height
}
@ -53,7 +53,7 @@ BI.LastTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 24,
el: {
type: "bi.layout",
cls: "mid-line-conn-background",
cls: "last-line-conn-background",
width: 24,
height: o.height
}

2
src/case/button/treeitem/item.mid.treeleaf.js

@ -45,7 +45,7 @@ BI.MidTreeLeafItem = BI.inherit(BI.BasicButton, {
width: 12,
el: {
type: "bi.layout",
cls: "base-line-conn-background",
cls: (o.pNode && o.pNode.isLastNode) ? "" : "base-line-conn-background",
width: 12,
height: o.height
}

4
src/case/checkbox/check.last.treenode.js

@ -18,9 +18,9 @@ BI.LastTreeNodeCheckbox = BI.inherit(BI.IconButton, {
setSelected: function (v) {
BI.LastTreeNodeCheckbox.superclass.setSelected.apply(this, arguments);
if (v === true) {
this.element.addClass("tree-expand-icon-type3");
this.element.addClass("tree-expand-icon-type4");
} else {
this.element.removeClass("tree-expand-icon-type3");
this.element.removeClass("tree-expand-icon-type4");
}
}
});

33
src/case/tree/tree.level.js

@ -23,34 +23,35 @@ BI.LevelTree = BI.inherit(BI.Widget, {
this.initTree(this.options.items);
},
_formatItems: function (nodes, layer) {
_formatItems: function (nodes, layer, pNode) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {layer: layer};
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
extend.pNode = pNode;
if (node.isParent === true || BI.isNotEmptyArray(node.children)) {
switch (i) {
case 0 :
extend.type = "bi.first_plus_group_node";
break;
case nodes.length - 1 :
extend.type = "bi.last_plus_group_node";
break;
default :
extend.type = "bi.mid_plus_group_node";
break;
if (i === nodes.length - 1) {
extend.type = "bi.last_plus_group_node";
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.first_plus_group_node"
}
if (i === 0 && i === nodes.length - 1) { // 根
extend.type = "bi.plus_group_node";
}
BI.defaults(node, extend);
self._formatItems(node.children, layer + 1);
self._formatItems(node.children, layer + 1, node);
} else {
switch (i) {
case nodes.length - 1:
extend.type = "bi.last_tree_leaf_item";
break;
default :
extend.type = "bi.mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.first_tree_leaf_item"
}
if (i === nodes.length - 1) {
extend.type = "bi.last_tree_leaf_item";
}
BI.defaults(node, extend);
}

2
src/core/platform/web/config.js

@ -45,6 +45,6 @@ BI.prepares.push(function () {
}
return BI.extend(ob, {type: "bi.flex_center"});
}
return ob;
return BI.extend(ob, {type: "bi.inline_center_adapt"});
});
});

20
src/core/wrapper/layout/adapt/inline.center.js

@ -24,33 +24,21 @@ BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, {
render: function () {
BI.InlineCenterAdaptLayout.superclass.render.apply(this, arguments);
this.element.css({
whiteSpace: "nowrap"
whiteSpace: "nowrap",
textAlign: "center"
});
this.populate(this.options.items);
},
_addElement: function (i, item, length) {
var o = this.options;
if (!this.hasWidget(this.getName() + i)) {
var t = BI.createWidget(item);
t.element.css({
position: "relative"
});
var w = BI.createWidget({
type: "bi.horizontal_auto",
items: [t]
});
this.addWidget(this.getName() + i, w);
} else {
var w = this.getWidgetByName(this.getName() + i);
}
var w = BI.InlineVerticalAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({
position: "relative",
display: "inline-block",
"vertical-align": "middle",
"*display": "inline",
"*zoom": 1,
"min-width": 100 / length + "%"
"*zoom": 1
});
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({

34
src/widget/multilayerselecttree/multilayerselecttree.leveltree.js

@ -21,7 +21,7 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
this.initTree(this.options.items);
},
_formatItems: function (nodes, layer) {
_formatItems: function (nodes, layer, pNode) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {};
@ -29,28 +29,28 @@ BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, {
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
extend.pNode = pNode;
if (node.isParent === true || BI.isNotEmptyArray(node.children)) {
switch (i) {
case 0 :
extend.type = "bi.multilayer_select_tree_first_plus_group_node";
break;
case nodes.length - 1 :
extend.type = "bi.multilayer_select_tree_last_plus_group_node";
break;
default :
extend.type = "bi.multilayer_select_tree_mid_plus_group_node";
break;
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_select_tree_last_plus_group_node";
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_select_tree_first_plus_group_node"
}
if (i === 0 && i === nodes.length - 1 && !pNode) { // 根
extend.type = "bi.multilayer_select_tree_plus_group_node";
}
BI.defaults(node, extend);
self._formatItems(node.children, layer + 1);
self._formatItems(node.children, layer + 1, node);
} else {
switch (i) {
case nodes.length - 1:
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
break;
default :
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"
}
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
}
BI.defaults(node, extend);
}

13
src/widget/multilayerselecttree/node/node.first.plus.js

@ -42,11 +42,20 @@ BI.MultiLayerSelectTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});

13
src/widget/multilayerselecttree/node/node.last.plus.js

@ -42,11 +42,20 @@ BI.MultiLayerSelectTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});

13
src/widget/multilayerselecttree/node/node.mid.plus.js

@ -42,11 +42,20 @@ BI.MultiLayerSelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});

104
src/widget/multilayerselecttree/node/node.plus.js

@ -0,0 +1,104 @@
/**
* 加号表示的组节点
*
* Created by GUY on 2016/1/27.
* @class BI.MultiLayerSelectTreePlusGroupNode
* @extends BI.NodeButton
*/
BI.MultiLayerSelectTreePlusGroupNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
var conf = BI.MultiLayerSelectTreePlusGroupNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
extraCls: "bi-multilayer-select-tree-first-plus-group-node bi-list-item-active",
layer: 0, // 第几层级
id: "",
pId: "",
readonly: true,
open: false,
height: 24
});
},
_init: function () {
BI.MultiLayerSelectTreePlusGroupNode.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.node = BI.createWidget({
type: "bi.select_tree_plus_group_node",
cls: "bi-list-item-none",
stopPropagation: true,
logic: {
dynamic: true
},
id: o.id,
pId: o.pId,
open: o.open,
height: o.height,
hgap: o.hgap,
text: o.text,
value: o.value,
py: o.py
});
this.node.on(BI.Controller.EVENT_CHANGE, function (type) {
self.setSelected(self.isSelected());
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
});
items.push(this.node);
BI.createWidget({
type: "bi.td",
element: this,
columnSize: BI.makeArray(o.layer, 12),
items: [items]
});
},
isOnce: function () {
return true;
},
doRedMark: function () {
this.node.doRedMark.apply(this.node, arguments);
},
unRedMark: function () {
this.node.unRedMark.apply(this.node, arguments);
},
isSelected: function () {
return this.node.isSelected();
},
setSelected: function (b) {
BI.MultiLayerSelectTreePlusGroupNode.superclass.setSelected.apply(this, arguments);
this.node.setSelected(b);
},
doClick: function () {
BI.NodeButton.superclass.doClick.apply(this, arguments);
this.node.setSelected(this.isSelected());
},
setOpened: function (v) {
BI.MultiLayerSelectTreePlusGroupNode.superclass.setOpened.apply(this, arguments);
this.node.setOpened(v);
}
});
BI.shortcut("bi.multilayer_select_tree_plus_group_node", BI.MultiLayerSelectTreePlusGroupNode);

34
src/widget/multilayersingletree/multilayersingletree.leveltree.js

@ -21,7 +21,7 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
this.initTree(this.options.items);
},
_formatItems: function (nodes, layer) {
_formatItems: function (nodes, layer, pNode) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {};
@ -29,28 +29,28 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
if (!BI.isKey(node.id)) {
node.id = BI.UUID();
}
extend.pNode = pNode;
if (node.isParent === true || BI.isNotEmptyArray(node.children)) {
switch (i) {
case 0 :
extend.type = "bi.multilayer_single_tree_first_plus_group_node";
break;
case nodes.length - 1 :
extend.type = "bi.multilayer_single_tree_last_plus_group_node";
break;
default :
extend.type = "bi.multilayer_single_tree_mid_plus_group_node";
break;
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_plus_group_node";
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_plus_group_node";
}
if (i === 0 && i === nodes.length - 1 && !pNode) { // 根
extend.type = "bi.multilayer_single_tree_plus_group_node";
}
BI.defaults(node, extend);
self._formatItems(node.children, layer + 1);
self._formatItems(node.children, layer + 1, node);
} else {
switch (i) {
case nodes.length - 1:
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
break;
default :
extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.multilayer_single_tree_first_tree_leaf_item"
}
if (i === nodes.length - 1) {
extend.type = "bi.multilayer_single_tree_last_tree_leaf_item";
}
BI.defaults(node, extend);
}

14
src/widget/multilayersingletree/node/node.first.plus.js

@ -29,6 +29,7 @@ BI.MultiLayerSingleTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, {
id: o.id,
pId: o.pId,
open: o.open,
isLastNode: o.isLastNode,
height: o.height,
hgap: o.hgap,
text: o.text,
@ -43,11 +44,20 @@ BI.MultiLayerSingleTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});

13
src/widget/multilayersingletree/node/node.last.plus.js

@ -43,11 +43,20 @@ BI.MultiLayerSingleTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});

13
src/widget/multilayersingletree/node/node.mid.plus.js

@ -43,11 +43,20 @@ BI.MultiLayerSingleTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});

96
src/widget/multilayersingletree/node/node.plus.js

@ -0,0 +1,96 @@
/**
*@desc 根节点,既是第一个又是最后一个
*@author dailer
*@date 2018/09/16
*/
BI.MultiLayerSingleTreePlusGroupNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
var conf = BI.MultiLayerSingleTreePlusGroupNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
extraCls: "bi-multilayer-single-tree-plus-group-node bi-list-item",
layer: 0, // 第几层级
id: "",
pId: "",
open: false,
height: 24
});
},
_init: function () {
BI.MultiLayerSingleTreePlusGroupNode.superclass._init.apply(this, arguments);
var self = this, o = this.options;
if (o.isLastNode && !o.pNode) {
}
this.node = BI.createWidget({
type: "bi.plus_group_node",
cls: "bi-list-item-none",
logic: {
dynamic: true
},
id: o.id,
pId: o.pId,
open: o.open,
isLastNode: o.isLastNode,
height: o.height,
hgap: o.hgap,
text: o.text,
value: o.value,
py: o.py,
keyword: o.keyword
});
this.node.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {// 本身实现click功能
return;
}
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});
});
items.push(this.node);
BI.createWidget({
type: "bi.td",
element: this,
columnSize: BI.makeArray(o.layer, 12),
items: [items]
});
},
doRedMark: function () {
this.node.doRedMark.apply(this.node, arguments);
},
unRedMark: function () {
this.node.unRedMark.apply(this.node, arguments);
},
doClick: function () {
BI.MultiLayerSingleTreePlusGroupNode.superclass.doClick.apply(this, arguments);
this.node.setSelected(this.isSelected());
},
setOpened: function (v) {
BI.MultiLayerSingleTreePlusGroupNode.superclass.setOpened.apply(this, arguments);
if (BI.isNotNull(this.node)) {
this.node.setOpened(v);
}
}
});
BI.shortcut("bi.multilayer_single_tree_plus_group_node", BI.MultiLayerSingleTreePlusGroupNode);

14
src/widget/multilayersingletree/treeitem/item.first.treeleaf.js

@ -42,11 +42,21 @@ BI.MultiLayerSingleTreeFirstTreeLeafItem = BI.inherit(BI.BasicButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});

13
src/widget/multilayersingletree/treeitem/item.last.treeleaf.js

@ -42,11 +42,20 @@ BI.MultiLayerSingleTreeLastTreeLeafItem = BI.inherit(BI.BasicButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});

13
src/widget/multilayersingletree/treeitem/item.mid.treeleaf.js

@ -42,11 +42,20 @@ BI.MultiLayerSingleTreeMidTreeLeafItem = BI.inherit(BI.BasicButton, {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
var needBlankLayers = [];
var pNode = o.pNode;
while (pNode) {
if (pNode.isLastNode) {
needBlankLayers.push(pNode.layer)
}
pNode = pNode.pNode;
}
var items = [];
BI.count(0, o.layer, function () {
BI.count(0, o.layer, function (index) {
items.push({
type: "bi.layout",
cls: "base-line-conn-background",
cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
width: 12,
height: o.height
});

86
src/widget/selecttree/nodes/node.plus.js

@ -0,0 +1,86 @@
/**
* 加号表示的组节点
* Created by GUY on 2015/9/6.
* @class BI.SelectTreePlusGroupNode
* @extends BI.NodeButton
*/
BI.SelectTreePlusGroupNode = BI.inherit(BI.NodeButton, {
_defaultConfig: function () {
var conf = BI.SelectTreePlusGroupNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-select-tree-plus-group-node bi-list-item-active",
logic: {
dynamic: false
},
id: "",
pId: "",
readonly: true,
open: false,
height: 24
});
},
_init: function () {
BI.SelectTreePlusGroupNode.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.checkbox = BI.createWidget({
type: "bi.tree_node_checkbox",
stopPropagation: true
});
this.text = BI.createWidget({
type: "bi.label",
textAlign: "left",
whiteSpace: "nowrap",
textHeight: o.height,
height: o.height,
hgap: o.hgap,
text: o.text,
value: o.value,
keyword: o.keyword,
py: o.py
});
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
if (this.isSelected()) {
self.triggerExpand();
} else {
self.triggerCollapse();
}
}
});
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {
width: 24,
el: this.checkbox
}, this.text);
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic(type, BI.extend(o.logic, {
items: items
}))));
},
isOnce: function () {
return true;
},
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
},
doClick: function () {
BI.NodeButton.superclass.doClick.apply(this, arguments);
},
setOpened: function (v) {
BI.SelectTreePlusGroupNode.superclass.setOpened.apply(this, arguments);
if (BI.isNotNull(this.checkbox)) {
this.checkbox.setSelected(v);
}
}
});
BI.shortcut("bi.select_tree_plus_group_node", BI.SelectTreePlusGroupNode);

35
src/widget/selecttree/selecttree.popup.js

@ -14,32 +14,33 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
});
},
_formatItems: function (nodes, layer) {
_formatItems: function (nodes, layer, pNode) {
var self = this;
BI.each(nodes, function (i, node) {
var extend = {layer: layer};
node.id = node.id || BI.UUID();
extend.pNode = pNode;
if (node.isParent === true || BI.isNotEmptyArray(node.children)) {
switch (i) {
case 0 :
extend.type = "bi.select_tree_first_plus_group_node";
break;
case nodes.length - 1 :
extend.type = "bi.select_tree_last_plus_group_node";
break;
default :
extend.type = "bi.select_tree_mid_plus_group_node";
break;
if (i === nodes.length - 1) {
extend.type = "bi.select_tree_last_plus_group_node";
extend.isLastNode = true;
}
if (i === 0 && !pNode) {
extend.type = "bi.select_tree_first_plus_group_node"
}
if (i === 0 && i === nodes.length - 1) { // 根
extend.type = "bi.select_tree_plus_group_node";
}
BI.defaults(node, extend);
self._formatItems(node.children);
self._formatItems(node.children, layer + 1, node);
} else {
switch (i) {
case nodes.length - 1:
extend.type = "bi.last_tree_leaf_item";
break;
default :
extend.type = "bi.mid_tree_leaf_item";
if (i === 0 && !pNode) {
extend.type = "bi.first_tree_leaf_item"
}
if (i === nodes.length - 1) {
extend.type = "bi.last_tree_leaf_item";
}
BI.defaults(node, extend);
}
@ -58,7 +59,7 @@ BI.SelectTreePopup = BI.inherit(BI.Pane, {
type: "bi.select_tree_expander",
isDefaultInit: true
},
items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)),
items: this._formatItems(BI.Tree.transformToTreeFormat(o.items), 0),
value: o.value,
chooseType: BI.Selection.Single
});

Loading…
Cancel
Save