Browse Source

Pull request #2100: 无JIRA任务 inline布局可以用在virtualgroup中

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit '3038599fb8ff154de7d81f0f8660cb1ad3071f97':
  整理代码
  整理代码
  整理代码
  inline布局可以用在virtualgroup中
es6
guy 3 years ago
parent
commit
dacc65ebc4
  1. 14
      src/core/wrapper/layout/adapt/adapt.leftrightvertical.js
  2. 24
      src/core/wrapper/layout/adapt/adapt.table.js
  3. 2
      src/core/wrapper/layout/fill/float.fill.horizontal.js
  4. 2
      src/core/wrapper/layout/layout.inline.js

14
src/core/wrapper/layout/adapt/adapt.leftrightvertical.js

@ -80,16 +80,6 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
this.right.stroke(this.options.items.right); this.right.stroke(this.options.items.right);
}, },
update: function (opt) {
this.left.update({
items: opt.items.left
});
this.right.update({
items: opt.items.right
});
return true;
},
addItem: function () { addItem: function () {
// do nothing // do nothing
throw new Error("不能添加子组件"); throw new Error("不能添加子组件");
@ -143,10 +133,6 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
this.layout.resize(); this.layout.resize();
}, },
update: function (opt) {
return this.layout.update(opt);
},
addItem: function () { addItem: function () {
// do nothing // do nothing
throw new Error("不能添加子组件"); throw new Error("不能添加子组件");

24
src/core/wrapper/layout/adapt/adapt.table.js

@ -24,23 +24,15 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, {
this.$table = BI.Widget._renderEngine.createElement("<div>").css({ this.$table = BI.Widget._renderEngine.createElement("<div>").css({
position: "relative", position: "relative",
display: "table", display: "table",
width: (o.horizontalAlign === BI.HorizontalAlign.Center || o.horizontalAlign === BI.HorizontalAlign.Stretch) ? "100%" : "auto", width: (o.horizontalAlign === BI.HorizontalAlign.Center || o.horizontalAlign === BI.HorizontalAlign.Stretch || this._hasFill()) ? "100%" : "auto",
height: (o.verticalAlign !== BI.VerticalAlign.Top) ? "100%" : "auto", height: (o.verticalAlign !== BI.VerticalAlign.Top) ? "100%" : "auto",
"white-space": "nowrap" "white-space": "nowrap"
}); });
this.populate(this.options.items); this.populate(this.options.items);
}, },
_addElement: function (i, item) { _hasFill: function () {
var o = this.options; var o = this.options;
var td, width = "";
var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width;
if (columnSize > 0) {
width = columnSize < 1 ?
((columnSize * 100).toFixed(1) + "%")
: (columnSize + (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap);
}
function hasFill() {
if (o.columnSize.length > 0) { if (o.columnSize.length > 0) {
return o.columnSize.indexOf("fill") >= 0; return o.columnSize.indexOf("fill") >= 0;
} }
@ -49,8 +41,18 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, {
return true; return true;
} }
}); });
},
_addElement: function (i, item) {
var o = this.options;
var td, width = "";
var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width;
if (columnSize > 0) {
width = columnSize < 1 ?
((columnSize * 100).toFixed(1) + "%")
: (columnSize + (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap);
} }
if ((BI.isNull(columnSize) || columnSize === "") && hasFill()) { if ((BI.isNull(columnSize) || columnSize === "") && this._hasFill()) {
width = 2; width = 2;
} }
if (!this.hasWidget(this._getChildName(i))) { if (!this.hasWidget(this._getChildName(i))) {

2
src/core/wrapper/layout/fill/float.fill.horizontal.js

@ -76,7 +76,7 @@ BI.FloatHorizontalFillLayout = BI.inherit(BI.Layout, {
} }
var top = o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0), var top = o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0),
bottom = o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0); bottom = o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0);
if (BI.isNull(item.height)) { if (o.verticalAlign === BI.VerticalAlign.Stretch && BI.isNull(item.height)) {
w.element.css({ w.element.css({
height: "calc(100% - " + ((top + bottom) / BI.pixRatio + BI.pixUnit) + ")" height: "calc(100% - " + ((top + bottom) / BI.pixRatio + BI.pixUnit) + ")"
}); });

2
src/core/wrapper/layout/layout.inline.js

@ -77,7 +77,7 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
} }
} }
this._handleGap(w, item, i); this._handleGap(w, item, i);
if (o.verticalAlign === BI.VerticalAlign.Stretch) { if (o.verticalAlign === BI.VerticalAlign.Stretch && BI.isNull(item.height)) {
var top = o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0), var top = o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0),
bottom = o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0); bottom = o.vgap + o.bgap + (item.bgap || 0) + (item.vgap || 0);
w.element.css("height", "calc(100% - " + ((top + bottom) / BI.pixRatio + BI.pixUnit) + ")"); w.element.css("height", "calc(100% - " + ((top + bottom) / BI.pixRatio + BI.pixUnit) + ")");

Loading…
Cancel
Save