fineui是帆软报表和BI产品线所使用的前端框架。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

170 lines
4.7 KiB

8 years ago
/**
* 左右分离垂直方向居中容器
* items:{
left: [{el:{type:"bi.button"}}],
right:[{el:{type:"bi.button"}}]
}
* @class BI.LeftRightVerticalAdaptLayout
* @extends BI.Layout
*/
BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
8 years ago
props: function () {
return BI.extend(BI.LeftRightVerticalAdaptLayout.superclass.props.apply(this, arguments), {
4 years ago
baseCls: "bi-lr-v-a",
8 years ago
items: {},
llgap: 0,
lrgap: 0,
lhgap: 0,
rlgap: 0,
rrgap: 0,
rhgap: 0
});
},
8 years ago
render: function () {
7 years ago
var o = this.options, self = this;
8 years ago
BI.LeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments);
7 years ago
var layoutArray = [];
if ("left" in o.items) {
layoutArray.push({
type: "bi.left",
items: [{
el: {
type: "bi.vertical_adapt",
height: "100%",
items: o.items.left,
hgap: o.lhgap,
lgap: o.llgap,
rgap: o.lrgap
}
}]
});
}
if ("right" in o.items) {
layoutArray.push({
type: "bi.right",
items: [{
el: {
type: "bi.vertical_adapt",
height: "100%",
items: o.items.right,
textAlign: "right",
7 years ago
hgap: o.rhgap,
lgap: o.rlgap,
rgap: o.rrgap
}
}]
});
}
return layoutArray;
8 years ago
},
resize: function () {
// console.log("left_right_vertical_adapt布局不需要resize");
},
addItem: function () {
7 years ago
// do nothing
throw new Error("cannot be added");
8 years ago
},
populate: function (items) {
BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments);
8 years ago
this._mount();
8 years ago
}
});
7 years ago
BI.shortcut("bi.left_right_vertical_adapt", BI.LeftRightVerticalAdaptLayout);
8 years ago
BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
8 years ago
props: function () {
return BI.extend(BI.LeftRightVerticalAdaptLayout.superclass.props.apply(this, arguments), {
4 years ago
baseCls: "bi-l-v-a",
8 years ago
items: [],
lgap: 0,
rgap: 0,
hgap: 0
});
},
8 years ago
render: function () {
7 years ago
var o = this.options, self = this;
8 years ago
BI.LeftVerticalAdaptLayout.superclass.render.apply(this, arguments);
7 years ago
return {
type: "bi.left",
ref: function (_ref) {
self.layout = _ref;
},
items: [{
el: {
type: "bi.vertical_adapt",
height: "100%",
items: o.items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
}
7 years ago
}]
};
8 years ago
},
resize: function () {
8 years ago
// console.log("left_vertical_adapt布局不需要resize");
8 years ago
},
addItem: function () {
7 years ago
// do nothing
throw new Error("cannot be added");
8 years ago
},
8 years ago
populate: function (items) {
7 years ago
this.layout.populate.apply(this, arguments);
8 years ago
}
});
7 years ago
BI.shortcut("bi.left_vertical_adapt", BI.LeftVerticalAdaptLayout);
8 years ago
BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
8 years ago
props: function () {
return BI.extend(BI.RightVerticalAdaptLayout.superclass.props.apply(this, arguments), {
4 years ago
baseCls: "bi-r-v-a",
8 years ago
items: [],
lgap: 0,
rgap: 0,
hgap: 0
});
},
8 years ago
render: function () {
7 years ago
var o = this.options, self = this;
8 years ago
BI.RightVerticalAdaptLayout.superclass.render.apply(this, arguments);
7 years ago
return {
type: "bi.right",
ref: function (_ref) {
self.layout = _ref;
},
items: [{
el: {
type: "bi.vertical_adapt",
height: "100%",
textAlign: "right",
items: o.items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
}
7 years ago
}]
};
8 years ago
},
resize: function () {
8 years ago
8 years ago
},
addItem: function () {
7 years ago
// do nothing
throw new Error("cannot be added");
8 years ago
},
8 years ago
populate: function (items) {
7 years ago
this.layout.populate.apply(this, arguments);
8 years ago
}
});
4 years ago
BI.shortcut("bi.right_vertical_adapt", BI.RightVerticalAdaptLayout);