|
|
@ -19023,7 +19023,19 @@ BI.prepares.push(function () { |
|
|
|
return _isSupprtFlex; |
|
|
|
return _isSupprtFlex; |
|
|
|
}; |
|
|
|
}; |
|
|
|
BI.Plugin.registerWidget("bi.horizontal", function (ob) { |
|
|
|
BI.Plugin.registerWidget("bi.horizontal", function (ob) { |
|
|
|
if (!BI.isIE() && isSupportFlex() && ob.items && ob.items.length <= 1) { |
|
|
|
// center_adapt
|
|
|
|
|
|
|
|
if (ob.verticalAlign === BI.VerticalAlign.Middle && ob.horizontalAlign === BI.HorizontalAlign.Center) { |
|
|
|
|
|
|
|
return ob; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// vertical_adapt
|
|
|
|
|
|
|
|
if (ob.verticalAlign === BI.VerticalAlign.Middle && ob.horizontalAlign === BI.HorizontalAlign.Left) { |
|
|
|
|
|
|
|
return ob; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// horizontal_adapt
|
|
|
|
|
|
|
|
if (ob.verticalAlign === BI.VerticalAlign.Top && ob.horizontalAlign === BI.HorizontalAlign.Center) { |
|
|
|
|
|
|
|
return ob; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!BI.isIE() && isSupportFlex()) { |
|
|
|
return BI.extend(ob, {type: "bi.flex_horizontal"}); |
|
|
|
return BI.extend(ob, {type: "bi.flex_horizontal"}); |
|
|
|
} |
|
|
|
} |
|
|
|
return ob; |
|
|
|
return ob; |
|
|
@ -19050,6 +19062,12 @@ BI.prepares.push(function () { |
|
|
|
} |
|
|
|
} |
|
|
|
return ob; |
|
|
|
return ob; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
BI.Plugin.registerWidget("bi.horizontal_adapt", function (ob) { |
|
|
|
|
|
|
|
if (ob.items && ob.items.length <= 1) { |
|
|
|
|
|
|
|
return BI.extend(ob, {type: "bi.horizontal_auto"}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return ob; |
|
|
|
|
|
|
|
}); |
|
|
|
BI.Plugin.registerWidget("bi.float_center_adapt", function (ob) { |
|
|
|
BI.Plugin.registerWidget("bi.float_center_adapt", function (ob) { |
|
|
|
if (!BI.isIE() && isSupportFlex()) { |
|
|
|
if (!BI.isIE() && isSupportFlex()) { |
|
|
|
// 有滚动条的情况下需要用到flex_wrapper_center布局
|
|
|
|
// 有滚动条的情况下需要用到flex_wrapper_center布局
|
|
|
@ -30465,6 +30483,7 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, { |
|
|
|
baseCls: "bi-horizontal-adapt-layout", |
|
|
|
baseCls: "bi-horizontal-adapt-layout", |
|
|
|
verticalAlign: BI.VerticalAlign.Top, |
|
|
|
verticalAlign: BI.VerticalAlign.Top, |
|
|
|
columnSize: [], |
|
|
|
columnSize: [], |
|
|
|
|
|
|
|
scrollx: false, |
|
|
|
hgap: 0, |
|
|
|
hgap: 0, |
|
|
|
vgap: 0, |
|
|
|
vgap: 0, |
|
|
|
lgap: 0, |
|
|
|
lgap: 0, |
|
|
@ -30474,90 +30493,33 @@ BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
render: function () { |
|
|
|
render: function () { |
|
|
|
|
|
|
|
var self = this, o = this.options; |
|
|
|
BI.HorizontalAdaptLayout.superclass.render.apply(this, arguments); |
|
|
|
BI.HorizontalAdaptLayout.superclass.render.apply(this, arguments); |
|
|
|
this.$table = BI.Widget._renderEngine.createElement("<table>").attr({cellspacing: 0, cellpadding: 0}).css({ |
|
|
|
return { |
|
|
|
position: "relative", |
|
|
|
type: "bi.horizontal", |
|
|
|
width: "100%", |
|
|
|
verticalAlign: BI.VerticalAlign.Top, |
|
|
|
"white-space": "nowrap", |
|
|
|
horizontalAlign: BI.HorizontalAlign.Center, |
|
|
|
"border-spacing": "0px", |
|
|
|
columnSize: o.columnSize, |
|
|
|
border: "none", |
|
|
|
items: o.items, |
|
|
|
"border-collapse": "separate" |
|
|
|
scrollx: o.scrollx, |
|
|
|
}); |
|
|
|
ref: function (_ref) { |
|
|
|
this.$tr = BI.Widget._renderEngine.createElement("<tr>"); |
|
|
|
self.layout = _ref; |
|
|
|
this.$tr.appendTo(this.$table); |
|
|
|
}, |
|
|
|
this.populate(this.options.items); |
|
|
|
hgap: o.hgap, |
|
|
|
}, |
|
|
|
vgap: o.vgap, |
|
|
|
|
|
|
|
lgap: o.lgap, |
|
|
|
_addElement: function (i, item) { |
|
|
|
rgap: o.rgap, |
|
|
|
var o = this.options; |
|
|
|
tgap: o.tgap, |
|
|
|
var td; |
|
|
|
bgap: o.bgap |
|
|
|
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; |
|
|
|
}; |
|
|
|
if (!this.hasWidget(this._getChildName(i))) { |
|
|
|
|
|
|
|
var w = BI.createWidget(item); |
|
|
|
|
|
|
|
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); |
|
|
|
|
|
|
|
td = BI.createWidget({ |
|
|
|
|
|
|
|
type: "bi.default", |
|
|
|
|
|
|
|
tagName: "td", |
|
|
|
|
|
|
|
attributes: { |
|
|
|
|
|
|
|
width: width |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
items: [w] |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.addWidget(this._getChildName(i), td); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
td = this.getWidgetByName(this._getChildName(i)); |
|
|
|
|
|
|
|
td.element.attr("width", width); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
td.element.css({"max-width": o.columnSize[i] + "px"}); |
|
|
|
|
|
|
|
if (i === 0) { |
|
|
|
|
|
|
|
td.element.addClass("first-element"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
td.element.css({ |
|
|
|
|
|
|
|
position: "relative", |
|
|
|
|
|
|
|
"vertical-align": o.verticalAlign, |
|
|
|
|
|
|
|
margin: "0", |
|
|
|
|
|
|
|
padding: "0", |
|
|
|
|
|
|
|
border: "none" |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { |
|
|
|
|
|
|
|
w.element.css({ |
|
|
|
|
|
|
|
"margin-top": o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) + "px" |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { |
|
|
|
|
|
|
|
w.element.css({ |
|
|
|
|
|
|
|
"margin-left": (i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0) +"px" |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) { |
|
|
|
|
|
|
|
w.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) { |
|
|
|
|
|
|
|
w.element.css({ |
|
|
|
|
|
|
|
"margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0) + "px" |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return td; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
appendFragment: function (frag) { |
|
|
|
|
|
|
|
this.$tr.append(frag); |
|
|
|
|
|
|
|
this.element.append(this.$table); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
resize: function () { |
|
|
|
resize: function () { |
|
|
|
// console.log("horizontal_adapt布局不需要resize");
|
|
|
|
// console.log("horizontal_adapt布局不需要resize");
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_getWrapper: function () { |
|
|
|
|
|
|
|
return this.$tr; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
populate: function (items) { |
|
|
|
populate: function (items) { |
|
|
|
BI.HorizontalAdaptLayout.superclass.populate.apply(this, arguments); |
|
|
|
this.layout.populate.apply(this, arguments); |
|
|
|
this._mount(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
BI.shortcut("bi.horizontal_adapt", BI.HorizontalAdaptLayout);/** |
|
|
|
BI.shortcut("bi.horizontal_adapt", BI.HorizontalAdaptLayout);/** |
|
|
|