Browse Source

BI-17050 multi_layer_single_tree

es6
windy 7 years ago
parent
commit
34f123a0b9
  1. 16
      demo/js/widget/tree/demo.multilayer_single_level_tree.js
  2. 7
      dist/base.js
  3. 12
      dist/bundle.js
  4. 16
      dist/demo.js
  5. 5
      dist/widget.js
  6. 7
      src/base/tree/customtree.js
  7. 5
      src/widget/multilayersingletree/multilayersingletree.leveltree.js

16
demo/js/widget/tree/demo.multilayer_single_level_tree.js

@ -7,23 +7,23 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
render: function () { render: function () {
var self = this; var self = this;
var tree = BI.createWidget({ this.tree = BI.createWidget({
type: "bi.multilayer_single_level_tree", type: "bi.multilayer_single_level_tree",
items: BI.deepClone(Demo.CONSTANTS.TREE), items: [],
value: "第级文件1" value: "第级文件1"
}); });
return { return {
type: "bi.vtape", type: "bi.vtape",
items: [{ items: [{
el: tree el: this.tree
}, { }, {
el: { el: {
type: "bi.button", type: "bi.button",
height: 25, height: 25,
text: "getValue", text: "getValue",
handler: function () { handler: function () {
BI.Msg.alert("", JSON.stringify(tree.getValue())); BI.Msg.alert("", JSON.stringify(self.tree.getValue()));
} }
}, },
height: 25 height: 25
@ -33,7 +33,7 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
height: 25, height: 25,
text: "setValue (第二级文件1)", text: "setValue (第二级文件1)",
handler: function () { handler: function () {
tree.setValue(["第二级文件1"]); self.tree.setValue(["第二级文件1"]);
} }
}, },
height: 25 height: 25
@ -41,6 +41,10 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
width: 500, width: 500,
hgap: 300 hgap: 300
}; };
},
mounted: function () {
this.tree.populate(BI.deepClone(Demo.CONSTANTS.TREE));
} }
}); });

7
dist/base.js vendored

@ -34238,12 +34238,13 @@ BI.CustomTree = BI.inherit(BI.Widget, {
if (BI.isNotEmptyArray(node.children) || node.isParent === true) { if (BI.isNotEmptyArray(node.children) || node.isParent === true) {
var item = BI.extend({ var item = BI.extend({
type: "bi.expander", type: "bi.expander",
el: {}, el: {
value: node.value
},
popup: {type: "bi.custom_tree"} popup: {type: "bi.custom_tree"}
}, BI.deepClone(o.expander), { }, BI.deepClone(o.expander), {
id: node.id, id: node.id,
pId: node.pId, pId: node.pId
value: node.value
}); });
var el = BI.stripEL(node); var el = BI.stripEL(node);
if (!BI.isWidget(el)) { if (!BI.isWidget(el)) {

12
dist/bundle.js vendored

@ -69724,12 +69724,13 @@ BI.CustomTree = BI.inherit(BI.Widget, {
if (BI.isNotEmptyArray(node.children) || node.isParent === true) { if (BI.isNotEmptyArray(node.children) || node.isParent === true) {
var item = BI.extend({ var item = BI.extend({
type: "bi.expander", type: "bi.expander",
el: {}, el: {
value: node.value
},
popup: {type: "bi.custom_tree"} popup: {type: "bi.custom_tree"}
}, BI.deepClone(o.expander), { }, BI.deepClone(o.expander), {
id: node.id, id: node.id,
pId: node.pId, pId: node.pId
value: node.value
}); });
var el = BI.stripEL(node); var el = BI.stripEL(node);
if (!BI.isWidget(el)) { if (!BI.isWidget(el)) {
@ -97156,7 +97157,10 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
}, },
getValue: function () { getValue: function () {
return BI.uniq(this.tree.getValue()); return BI.filter(BI.uniq(this.tree.getValue()), function (idx, value) {
return BI.isNotNull(value);
});
}, },
getAllLeaves: function () { getAllLeaves: function () {

16
dist/demo.js vendored

@ -14231,23 +14231,23 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
render: function () { render: function () {
var self = this; var self = this;
var tree = BI.createWidget({ this.tree = BI.createWidget({
type: "bi.multilayer_single_level_tree", type: "bi.multilayer_single_level_tree",
items: BI.deepClone(Demo.CONSTANTS.TREE), items: [],
value: "第级文件1" value: "第级文件1"
}); });
return { return {
type: "bi.vtape", type: "bi.vtape",
items: [{ items: [{
el: tree el: this.tree
}, { }, {
el: { el: {
type: "bi.button", type: "bi.button",
height: 25, height: 25,
text: "getValue", text: "getValue",
handler: function () { handler: function () {
BI.Msg.alert("", JSON.stringify(tree.getValue())); BI.Msg.alert("", JSON.stringify(self.tree.getValue()));
} }
}, },
height: 25 height: 25
@ -14257,7 +14257,7 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
height: 25, height: 25,
text: "setValue (第二级文件1)", text: "setValue (第二级文件1)",
handler: function () { handler: function () {
tree.setValue(["第二级文件1"]); self.tree.setValue(["第二级文件1"]);
} }
}, },
height: 25 height: 25
@ -14265,6 +14265,10 @@ Demo.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
width: 500, width: 500,
hgap: 300 hgap: 300
}; };
},
mounted: function () {
this.tree.populate(BI.deepClone(Demo.CONSTANTS.TREE));
} }
}); });

5
dist/widget.js vendored

@ -10485,7 +10485,10 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
}, },
getValue: function () { getValue: function () {
return BI.uniq(this.tree.getValue()); return BI.filter(BI.uniq(this.tree.getValue()), function (idx, value) {
return BI.isNotNull(value);
});
}, },
getAllLeaves: function () { getAllLeaves: function () {

7
src/base/tree/customtree.js

@ -44,12 +44,13 @@ BI.CustomTree = BI.inherit(BI.Widget, {
if (BI.isNotEmptyArray(node.children) || node.isParent === true) { if (BI.isNotEmptyArray(node.children) || node.isParent === true) {
var item = BI.extend({ var item = BI.extend({
type: "bi.expander", type: "bi.expander",
el: {}, el: {
value: node.value
},
popup: {type: "bi.custom_tree"} popup: {type: "bi.custom_tree"}
}, BI.deepClone(o.expander), { }, BI.deepClone(o.expander), {
id: node.id, id: node.id,
pId: node.pId, pId: node.pId
value: node.value
}); });
var el = BI.stripEL(node); var el = BI.stripEL(node);
if (!BI.isWidget(el)) { if (!BI.isWidget(el)) {

5
src/widget/multilayersingletree/multilayersingletree.leveltree.js

@ -112,7 +112,10 @@ BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, {
}, },
getValue: function () { getValue: function () {
return BI.uniq(this.tree.getValue()); return BI.filter(BI.uniq(this.tree.getValue()), function (idx, value) {
return BI.isNotNull(value);
});
}, },
getAllLeaves: function () { getAllLeaves: function () {

Loading…
Cancel
Save