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.

193 lines
5.3 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,
4 years ago
ltgap: 0,
lbgap: 0,
lvgap: 0,
8 years ago
rlgap: 0,
rrgap: 0,
4 years ago
rhgap: 0,
rtgap: 0,
rbgap: 0,
rvgap: 0
8 years ago
});
},
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",
4 years ago
ref: function (_ref) {
self.left = _ref;
},
7 years ago
height: "100%",
items: o.items.left,
hgap: o.lhgap,
lgap: o.llgap,
4 years ago
rgap: o.lrgap,
tgap: o.ltgap,
bgap: o.lbgap,
vgap: o.lvgap
7 years ago
}
}]
});
}
if ("right" in o.items) {
layoutArray.push({
type: "bi.right",
items: [{
el: {
type: "bi.vertical_adapt",
4 years ago
ref: function (_ref) {
self.right = _ref;
},
7 years ago
height: "100%",
items: o.items.right,
hgap: o.rhgap,
lgap: o.rlgap,
4 years ago
rgap: o.rrgap,
tgap: o.rtgap,
bgap: o.rbgap,
vgap: o.rvgap
7 years ago
}
}]
});
}
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) {
4 years ago
this.left.populate(items.left);
this.right.populate(items.right);
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,
4 years ago
hgap: 0,
tgap: 0,
bgap: 0,
vgap: 0
8 years ago
});
},
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 {
4 years ago
type: "bi.vertical_adapt",
7 years ago
ref: function (_ref) {
self.layout = _ref;
},
4 years ago
items: o.items,
hgap: o.hgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
4 years ago
vgap: o.vgap,
scrollx: o.scrollx,
scrolly: o.scrolly,
scrollable: o.scrollable
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,
4 years ago
hgap: 0,
tgap: 0,
bgap: 0,
vgap: 0
8 years ago
});
},
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 {
4 years ago
type: "bi.vertical_adapt",
7 years ago
ref: function (_ref) {
self.layout = _ref;
},
4 years ago
horizontalAlign: BI.HorizontalAlign.Right,
4 years ago
items: o.items,
4 years ago
hgap: o.hgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
4 years ago
vgap: o.vgap,
scrollx: o.scrollx,
scrolly: o.scrolly,
scrollable: o.scrollable
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) {
4 years ago
this.layout.populate(items);
8 years ago
}
});
4 years ago
BI.shortcut("bi.right_vertical_adapt", BI.RightVerticalAdaptLayout);