Browse Source

优化布局

master
guy 4 years ago
parent
commit
3c27983d9e
  1. 2
      src/core/wrapper/layout/adapt/adapt.table.js
  2. 2
      src/core/wrapper/layout/adapt/inline.center.js
  3. 2
      src/core/wrapper/layout/adapt/inline.horizontal.js
  4. 2
      src/core/wrapper/layout/adapt/inline.vertical.js
  5. 2
      src/core/wrapper/layout/flex/flex.horizontal.js
  6. 2
      src/core/wrapper/layout/flex/flex.vertical.js
  7. 2
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js
  8. 2
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js
  9. 2
      src/core/wrapper/layout/layout.horizontal.js
  10. 14
      src/core/wrapper/layout/layout.table.js
  11. 2
      src/core/wrapper/layout/layout.td.js

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

@ -35,7 +35,7 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) {
var o = this.options;
var td;
var width = o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap + o.columnSize[i];
var width = o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap + o.columnSize[i]);
if (!this.hasWidget(this._getChildName(i))) {
var w = BI._lazyCreateWidget(item);
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});

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

@ -38,7 +38,7 @@ BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, {
var o = this.options;
var w = BI.InlineCenterAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({
width: o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit),
width: o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit)),
position: "relative",
"vertical-align": o.verticalAlign
});

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

@ -38,7 +38,7 @@ BI.InlineHorizontalAdaptLayout = BI.inherit(BI.Layout, {
var o = this.options;
var w = BI.InlineHorizontalAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({
width: o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit),
width: o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit)),
position: "relative",
"vertical-align": o.verticalAlign
});

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

@ -38,7 +38,7 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
var o = this.options;
var w = BI.InlineVerticalAdaptLayout.superclass._addElement.apply(this, arguments);
w.element.css({
width: o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit),
width: o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit)),
position: "relative",
"vertical-align": o.verticalAlign
});

2
src/core/wrapper/layout/flex/flex.horizontal.js

@ -42,7 +42,7 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, {
}
}
if (o.columnSize[i] > 0) {
w.element.width(o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit));
w.element.width(o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit)));
}
if (o.columnSize[i] === "fill") {
w.element.addClass("f-f");

2
src/core/wrapper/layout/flex/flex.vertical.js

@ -41,7 +41,7 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, {
}
}
if (o.rowSize[i] > 0) {
w.element.height(o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit));
w.element.height(o.rowSize[i] === "" ? "" : (o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit)));
}
if (o.rowSize[i] === "fill") {
w.element.addClass("f-f");

2
src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js

@ -44,7 +44,7 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, {
}
}
if (o.columnSize[i] > 0) {
w.element.width(o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit));
w.element.width(o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (o.columnSize[i] / BI.pixRatio + BI.pixUnit)));
}
if (o.columnSize[i] === "fill") {
w.element.addClass("f-f");

2
src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js

@ -44,7 +44,7 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, {
}
}
if (o.rowSize[i] > 0) {
w.element.height(o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit));
w.element.height(o.rowSize[i] === "" ? "" : (o.rowSize[i] <= 1 ? ((o.rowSize[i] * 100).toFixed(1) + "%") : (o.rowSize[i] / BI.pixRatio + BI.pixUnit)));
}
if (o.rowSize[i] === "fill") {
w.element.addClass("f-f");

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

@ -39,7 +39,7 @@ BI.HorizontalLayout = BI.inherit(BI.Layout, {
_addElement: function (i, item) {
var o = this.options;
var td;
var width = o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap + o.columnSize[i];
var width = o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap + o.columnSize[i]);
if (!this.hasWidget(this._getChildName(i))) {
var w = BI._lazyCreateWidget(item);
w.element.css({position: "relative", margin: "0px auto"});

14
src/core/wrapper/layout/layout.table.js

@ -9,21 +9,11 @@ BI.TableLayout = BI.inherit(BI.Layout, {
return BI.extend(BI.TableLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-t",
scrolly: true,
columnSize: [200, 200, "fill"],
columnSize: [],
rowSize: 30, // or [30,30,30]
hgap: 0,
vgap: 0,
items: [[
{
el: {text: "label1"}
},
{
el: {text: "label2"}
},
{
el: {text: "label3"}
}
]]
items: []
});
},
render: function () {

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

@ -103,7 +103,7 @@ BI.TdLayout = BI.inherit(BI.Layout, {
first(w, this.rows++, i);
var td = BI._lazyCreateWidget({
type: "bi.default",
width: o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap + o.columnSize[i],
width: o.columnSize[i] === "" ? "" : (o.columnSize[i] <= 1 ? ((o.columnSize[i] * 100).toFixed(1) + "%") : (i === 0 ? o.hgap : 0) + o.hgap + o.lgap + o.rgap + o.columnSize[i]),
tagName: "td",
items: [w]
});

Loading…
Cancel
Save