|
|
@ -1,23 +1,46 @@ |
|
|
|
!(function () { |
|
|
|
!(function () { |
|
|
|
|
|
|
|
var DEFAULT_CONFIG = { |
|
|
|
|
|
|
|
"bi.vertical_adapt": { |
|
|
|
|
|
|
|
verticalAlign: BI.VerticalAlign.Middle |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
"swing.vertical_adapt": { |
|
|
|
|
|
|
|
verticalAlign: BI.VerticalAlign.Middle |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
"bi.horizontal_adapt": { |
|
|
|
|
|
|
|
horizontalAlign: BI.HorizontalAlign.Center |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
"swing.horizontal_adapt": { |
|
|
|
|
|
|
|
horizontalAlign: BI.HorizontalAlign.Center |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
"bi.center_adapt": { |
|
|
|
|
|
|
|
verticalAlign: BI.VerticalAlign.Middle, |
|
|
|
|
|
|
|
horizontalAlign: BI.HorizontalAlign.Center |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
"swing.center_adapt": { |
|
|
|
|
|
|
|
verticalAlign: BI.VerticalAlign.Middle, |
|
|
|
|
|
|
|
horizontalAlign: BI.HorizontalAlign.Center |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
var Service = BI.inherit(BI.OB, { |
|
|
|
var Service = BI.inherit(BI.OB, { |
|
|
|
layout: function (element, o) { |
|
|
|
layout: function (element, o) { |
|
|
|
if (o.verticalAlign === BI.VerticalAlign.Middle) { |
|
|
|
var config = BI.extend({}, DEFAULT_CONFIG[o.type], o); |
|
|
|
if (o.horizontalAlign === BI.HorizontalAlign.Center) { |
|
|
|
if (config.verticalAlign === BI.VerticalAlign.Middle) { |
|
|
|
|
|
|
|
if (config.horizontalAlign === BI.HorizontalAlign.Center) { |
|
|
|
element.layout("center_adapt"); |
|
|
|
element.layout("center_adapt"); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
element.layout("vertical_adapt"); |
|
|
|
element.layout("vertical_adapt"); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (o.horizontalAlign === BI.HorizontalAlign.Center) { |
|
|
|
if (config.horizontalAlign === BI.HorizontalAlign.Center) { |
|
|
|
element.layout("horizontal_adapt"); |
|
|
|
element.layout("horizontal_adapt"); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (o.type === "swing.vertical" || o.type === "bi.vertical") { |
|
|
|
if (config.type === "swing.vertical" || config.type === "bi.vertical") { |
|
|
|
element.layout("vertical"); |
|
|
|
element.layout("vertical"); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (o.type === "swing.horizontal" || o.type === "bi.horizontal") { |
|
|
|
if (config.type === "swing.horizontal" || config.type === "bi.horizontal") { |
|
|
|
element.layout("horizontal"); |
|
|
|
element.layout("horizontal"); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|