windy 6 years ago
parent
commit
8f1251b269
  1. 453
      dist/bundle.ie.js
  2. 60
      dist/bundle.ie.min.js
  3. 453
      dist/bundle.js
  4. 60
      dist/bundle.min.js
  5. 453
      dist/core.js
  6. 453
      dist/fineui.ie.js
  7. 60
      dist/fineui.ie.min.js
  8. 453
      dist/fineui.js
  9. 60
      dist/fineui.min.js
  10. 453
      dist/fineui_without_jquery_polyfill.js
  11. 2
      dist/utils.min.js
  12. 98
      src/core/wrapper/layout/adapt/adapt.center.js
  13. 140
      src/core/wrapper/layout/adapt/adapt.leftrightvertical.js
  14. 101
      src/core/wrapper/layout/adapt/adapt.vertical.js

453
dist/bundle.ie.js vendored

@ -30415,6 +30415,7 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
return BI.extend(BI.CenterAdaptLayout.superclass.props.apply(this, arguments), { return BI.extend(BI.CenterAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-center-adapt-layout", baseCls: "bi-center-adapt-layout",
columnSize: [], columnSize: [],
scrollx: false,
hgap: 0, hgap: 0,
vgap: 0, vgap: 0,
lgap: 0, lgap: 0,
@ -30424,92 +30425,33 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.CenterAdaptLayout.superclass.render.apply(this, arguments); BI.CenterAdaptLayout.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.Middle,
height: "100%", horizontalAlign: BI.HorizontalAlign.Center,
"white-space": "nowrap", columnSize: o.columnSize,
"border-spacing": "0px", scrollx: o.scrollx,
border: "none", items: o.items,
"border-collapse": "separate" ref: function (_ref) {
}); self.layout = _ref;
this.$tr = BI.Widget._renderEngine.createElement("<tr>"); },
this.$tr.appendTo(this.$table); hgap: o.hgap,
this.populate(this.options.items); vgap: o.vgap,
}, lgap: o.lgap,
rgap: o.rgap,
_addElement: function (i, item) { tgap: o.tgap,
var o = this.options; bgap: o.bgap
var td; };
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]});
if (i === 0) {
td.element.addClass("first-element");
}
td.element.css({
position: "relative",
height: "100%",
"vertical-align": "middle",
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("center_adapt布局不需要resize"); // console.log("center_adapt布局不需要resize");
}, },
_getWrapper: function () {
return this.$tr;
},
populate: function (items) { populate: function (items) {
BI.CenterAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.center_adapt", BI.CenterAdaptLayout);/** BI.shortcut("bi.center_adapt", BI.CenterAdaptLayout);/**
@ -30641,8 +30583,40 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.LeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.LeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); var layoutArray = [];
if ("left" in o.items) {
layoutArray.push({
type: "bi.left",
items: [{
el: {
type: "bi.vertical_adapt",
height: "100%",
items: o.items.left,
hgap: o.lhgap,
lgap: o.llgap,
rgap: o.lrgap
}
}]
});
}
if ("right" in o.items) {
layoutArray.push({
type: "bi.right",
items: [{
el: {
type: "bi.vertical_adapt",
height: "100%",
items: o.items.right,
hgap: o.rhgap,
lgap: o.rlgap,
rgap: o.rrgap
}
}]
});
}
return layoutArray;
}, },
resize: function () { resize: function () {
@ -30654,40 +30628,6 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
if ("left" in items) {
var left = BI.createWidget({
type: "bi.vertical_adapt",
items: items.left,
hgap: o.lhgap,
lgap: o.llgap,
rgap: o.lrgap
});
left.element.css("height", "100%");
BI.createWidget({
type: "bi.left",
element: this,
items: [left]
});
}
if ("right" in items) {
var right = BI.createWidget({
type: "bi.vertical_adapt",
items: items.right,
hgap: o.rhgap,
lgap: o.rlgap,
rgap: o.rrgap
});
right.element.css("height", "100%");
BI.createWidget({
type: "bi.right",
element: this,
items: [right]
});
}
},
populate: function (items) { populate: function (items) {
BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments); BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount(); this._mount();
@ -30707,8 +30647,22 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.LeftVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.LeftVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); return {
type: "bi.left",
ref: function (_ref) {
self.layout = _ref;
},
items: [{
type: "bi.vertical_adapt",
height: "100%",
items: o.items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
}]
};
}, },
resize: function () { resize: function () {
@ -30720,26 +30674,8 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
var left = BI.createWidget({
type: "bi.vertical_adapt",
items: items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
});
left.element.css("height", "100%");
BI.createWidget({
type: "bi.left",
element: this,
items: [left]
});
},
populate: function (items) { populate: function (items) {
BI.LeftVerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.left_vertical_adapt", BI.LeftVerticalAdaptLayout); BI.shortcut("bi.left_vertical_adapt", BI.LeftVerticalAdaptLayout);
@ -30755,8 +30691,22 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.RightVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.RightVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); return {
type: "bi.right",
ref: function (_ref) {
self.layout = _ref;
},
items: [{
type: "bi.vertical_adapt",
height: "100%",
items: o.items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
}]
};
}, },
resize: function () { resize: function () {
@ -30768,63 +30718,45 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
var right = BI.createWidget({
type: "bi.vertical_adapt",
items: items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
});
right.element.css("height", "100%");
BI.createWidget({
type: "bi.right",
element: this,
items: [right]
});
},
populate: function (items) { populate: function (items) {
BI.RightVerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.right_vertical_adapt", BI.RightVerticalAdaptLayout);/** BI.shortcut("bi.right_vertical_adapt", BI.RightVerticalAdaptLayout);/**
* 垂直方向居中容器 * 使用display:table和display:table-cell实现的horizontal布局
* @class BI.VerticalAdaptLayout * @class BI.TableAdaptLayout
* @extends BI.Layout * @extends BI.Layout
*/ */
BI.VerticalAdaptLayout = BI.inherit(BI.Layout, { BI.TableAdaptLayout = BI.inherit(BI.Layout, {
props: { props: function () {
baseCls: "bi-vertical-adapt-layout", return BI.extend(BI.TableAdaptLayout.superclass.props.apply(this, arguments), {
columnSize: [], baseCls: "bi-table-center-adapt-layout",
horizontalAlign: BI.HorizontalAlign.Left, columnSize: [],
hgap: 0, verticalAlign: BI.VerticalAlign.Top,
vgap: 0, horizontalAlign: BI.HorizontalAlign.Left,
lgap: 0, hgap: 0,
rgap: 0, vgap: 0,
tgap: 0, lgap: 0,
bgap: 0 rgap: 0,
tgap: 0,
bgap: 0
});
}, },
render: function () { render: function () {
BI.VerticalAdaptLayout.superclass.render.apply(this, arguments);
var o = this.options; var o = this.options;
this.$table = BI.Widget._renderEngine.createElement("<table>").attr({cellspacing: 0, cellpadding: 0}).css({ BI.TableAdaptLayout.superclass.render.apply(this, arguments);
this.$table = BI.Widget._renderEngine.createElement("<div>").css({
position: "relative", position: "relative",
width: o.horizontalAlign === BI.HorizontalAlign.Stretch ? "100%" : "auto", display: "table",
height: "100%", height: o.verticalAlign === BI.VerticalAlign.Middle ? "100%" : "auto",
"white-space": "nowrap", width: o.horizontalAlign === BI.HorizontalAlign.Center ? "100%" : "auto",
"border-spacing": "0px", "white-space": "nowrap"
border: "none",
"border-collapse": "separate"
}); });
this.$tr = BI.Widget._renderEngine.createElement("<tr>");
this.$tr.appendTo(this.$table);
this.populate(this.options.items); this.populate(this.options.items);
}, },
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var td; var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
@ -30833,28 +30765,25 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
tagName: "td", width: width,
attributes: {
width: width
},
items: [w] items: [w]
}); });
this.addWidget(this._getChildName(i), td); this.addWidget(this._getChildName(i), td);
} else { } else {
td = this.getWidgetByName(this._getChildName(i)); td = this.getWidgetByName(this._getChildName(i));
td.element.attr("width", width); td.element.width(width);
} }
td.element.css({"max-width": o.columnSize[i] + "px"});
if (i === 0) { if (i === 0) {
td.element.addClass("first-element"); td.element.addClass("first-element");
} }
td.element.css({ td.element.css({
position: "relative", position: "relative",
height: "100%", display: "table-cell",
"vertical-align": "middle", "vertical-align": "middle",
margin: "0", margin: "0",
padding: "0", padding: "0",
border: "none" height: "100%"
}); });
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
@ -30863,7 +30792,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": (i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0) +"px" "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) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
@ -30880,12 +30809,57 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
}, },
appendFragment: function (frag) { appendFragment: function (frag) {
this.$tr.append(frag); this.$table.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}, },
_getWrapper: function () { resize: function () {
return this.$tr; // console.log("center_adapt布局不需要resize");
},
populate: function (items) {
BI.TableAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut("bi.table_adapt", BI.TableAdaptLayout);/**
* 垂直方向居中容器
* @class BI.VerticalAdaptLayout
* @extends BI.Layout
*/
BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
props: {
baseCls: "bi-vertical-adapt-layout",
columnSize: [],
scrollx: false,
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
},
render: function () {
var self = this, o = this.options;
BI.VerticalAdaptLayout.superclass.render.apply(this, arguments);
return {
type: "bi.horizontal",
verticalAlign: BI.VerticalAlign.Middle,
horizontalAlign: BI.HorizontalAlign.Left,
columnSize: o.columnSize,
items: o.items,
scrollx: o.scrollx,
ref: function (_ref) {
self.layout = _ref;
},
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
};
}, },
resize: function () { resize: function () {
@ -30893,8 +30867,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
}, },
populate: function (items) { populate: function (items) {
BI.VerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.vertical_adapt", BI.VerticalAdaptLayout);/** BI.shortcut("bi.vertical_adapt", BI.VerticalAdaptLayout);/**
@ -31262,106 +31235,6 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
} }
}); });
BI.shortcut("bi.inline_vertical_adapt", BI.InlineVerticalAdaptLayout);/** BI.shortcut("bi.inline_vertical_adapt", BI.InlineVerticalAdaptLayout);/**
* 使用display:table和display:table-cell实现的horizontal布局
* @class BI.TableAdaptLayout
* @extends BI.Layout
*/
BI.TableAdaptLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.TableAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-table-center-adapt-layout",
columnSize: [],
verticalAlign: BI.VerticalAlign.Top,
horizontalAlign: BI.HorizontalAlign.Left,
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
});
},
render: function () {
var o = this.options;
BI.TableAdaptLayout.superclass.render.apply(this, arguments);
this.$table = BI.Widget._renderEngine.createElement("<div>").css({
position: "relative",
display: "table",
height: o.verticalAlign === BI.VerticalAlign.Middle ? "100%" : "auto",
width: o.horizontalAlign === BI.HorizontalAlign.Center ? "100%" : "auto",
"white-space": "nowrap"
});
this.populate(this.options.items);
},
_addElement: function (i, item) {
var o = this.options;
var td;
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",
width: width,
items: [w]
});
this.addWidget(this._getChildName(i), td);
} else {
td = this.getWidgetByName(this._getChildName(i));
td.element.width(width);
}
td.element.css({"max-width": o.columnSize[i] + "px"});
if (i === 0) {
td.element.addClass("first-element");
}
td.element.css({
position: "relative",
display: "table-cell",
"vertical-align": "middle",
margin: "0",
padding: "0",
height: "100%"
});
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.$table.append(frag);
this.element.append(this.$table);
},
resize: function () {
// console.log("center_adapt布局不需要resize");
},
populate: function (items) {
BI.TableAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut("bi.table_adapt", BI.TableAdaptLayout);/**
*自适应水平和垂直方向都居中容器 *自适应水平和垂直方向都居中容器
* Created by GUY on 2016/12/2. * Created by GUY on 2016/12/2.
* *

60
dist/bundle.ie.min.js vendored

File diff suppressed because one or more lines are too long

453
dist/bundle.js vendored

@ -30415,6 +30415,7 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
return BI.extend(BI.CenterAdaptLayout.superclass.props.apply(this, arguments), { return BI.extend(BI.CenterAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-center-adapt-layout", baseCls: "bi-center-adapt-layout",
columnSize: [], columnSize: [],
scrollx: false,
hgap: 0, hgap: 0,
vgap: 0, vgap: 0,
lgap: 0, lgap: 0,
@ -30424,92 +30425,33 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.CenterAdaptLayout.superclass.render.apply(this, arguments); BI.CenterAdaptLayout.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.Middle,
height: "100%", horizontalAlign: BI.HorizontalAlign.Center,
"white-space": "nowrap", columnSize: o.columnSize,
"border-spacing": "0px", scrollx: o.scrollx,
border: "none", items: o.items,
"border-collapse": "separate" ref: function (_ref) {
}); self.layout = _ref;
this.$tr = BI.Widget._renderEngine.createElement("<tr>"); },
this.$tr.appendTo(this.$table); hgap: o.hgap,
this.populate(this.options.items); vgap: o.vgap,
}, lgap: o.lgap,
rgap: o.rgap,
_addElement: function (i, item) { tgap: o.tgap,
var o = this.options; bgap: o.bgap
var td; };
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]});
if (i === 0) {
td.element.addClass("first-element");
}
td.element.css({
position: "relative",
height: "100%",
"vertical-align": "middle",
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("center_adapt布局不需要resize"); // console.log("center_adapt布局不需要resize");
}, },
_getWrapper: function () {
return this.$tr;
},
populate: function (items) { populate: function (items) {
BI.CenterAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.center_adapt", BI.CenterAdaptLayout);/** BI.shortcut("bi.center_adapt", BI.CenterAdaptLayout);/**
@ -30641,8 +30583,40 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.LeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.LeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); var layoutArray = [];
if ("left" in o.items) {
layoutArray.push({
type: "bi.left",
items: [{
el: {
type: "bi.vertical_adapt",
height: "100%",
items: o.items.left,
hgap: o.lhgap,
lgap: o.llgap,
rgap: o.lrgap
}
}]
});
}
if ("right" in o.items) {
layoutArray.push({
type: "bi.right",
items: [{
el: {
type: "bi.vertical_adapt",
height: "100%",
items: o.items.right,
hgap: o.rhgap,
lgap: o.rlgap,
rgap: o.rrgap
}
}]
});
}
return layoutArray;
}, },
resize: function () { resize: function () {
@ -30654,40 +30628,6 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
if ("left" in items) {
var left = BI.createWidget({
type: "bi.vertical_adapt",
items: items.left,
hgap: o.lhgap,
lgap: o.llgap,
rgap: o.lrgap
});
left.element.css("height", "100%");
BI.createWidget({
type: "bi.left",
element: this,
items: [left]
});
}
if ("right" in items) {
var right = BI.createWidget({
type: "bi.vertical_adapt",
items: items.right,
hgap: o.rhgap,
lgap: o.rlgap,
rgap: o.rrgap
});
right.element.css("height", "100%");
BI.createWidget({
type: "bi.right",
element: this,
items: [right]
});
}
},
populate: function (items) { populate: function (items) {
BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments); BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount(); this._mount();
@ -30707,8 +30647,22 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.LeftVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.LeftVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); return {
type: "bi.left",
ref: function (_ref) {
self.layout = _ref;
},
items: [{
type: "bi.vertical_adapt",
height: "100%",
items: o.items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
}]
};
}, },
resize: function () { resize: function () {
@ -30720,26 +30674,8 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
var left = BI.createWidget({
type: "bi.vertical_adapt",
items: items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
});
left.element.css("height", "100%");
BI.createWidget({
type: "bi.left",
element: this,
items: [left]
});
},
populate: function (items) { populate: function (items) {
BI.LeftVerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.left_vertical_adapt", BI.LeftVerticalAdaptLayout); BI.shortcut("bi.left_vertical_adapt", BI.LeftVerticalAdaptLayout);
@ -30755,8 +30691,22 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.RightVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.RightVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); return {
type: "bi.right",
ref: function (_ref) {
self.layout = _ref;
},
items: [{
type: "bi.vertical_adapt",
height: "100%",
items: o.items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
}]
};
}, },
resize: function () { resize: function () {
@ -30768,63 +30718,45 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
var right = BI.createWidget({
type: "bi.vertical_adapt",
items: items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
});
right.element.css("height", "100%");
BI.createWidget({
type: "bi.right",
element: this,
items: [right]
});
},
populate: function (items) { populate: function (items) {
BI.RightVerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.right_vertical_adapt", BI.RightVerticalAdaptLayout);/** BI.shortcut("bi.right_vertical_adapt", BI.RightVerticalAdaptLayout);/**
* 垂直方向居中容器 * 使用display:table和display:table-cell实现的horizontal布局
* @class BI.VerticalAdaptLayout * @class BI.TableAdaptLayout
* @extends BI.Layout * @extends BI.Layout
*/ */
BI.VerticalAdaptLayout = BI.inherit(BI.Layout, { BI.TableAdaptLayout = BI.inherit(BI.Layout, {
props: { props: function () {
baseCls: "bi-vertical-adapt-layout", return BI.extend(BI.TableAdaptLayout.superclass.props.apply(this, arguments), {
columnSize: [], baseCls: "bi-table-center-adapt-layout",
horizontalAlign: BI.HorizontalAlign.Left, columnSize: [],
hgap: 0, verticalAlign: BI.VerticalAlign.Top,
vgap: 0, horizontalAlign: BI.HorizontalAlign.Left,
lgap: 0, hgap: 0,
rgap: 0, vgap: 0,
tgap: 0, lgap: 0,
bgap: 0 rgap: 0,
tgap: 0,
bgap: 0
});
}, },
render: function () { render: function () {
BI.VerticalAdaptLayout.superclass.render.apply(this, arguments);
var o = this.options; var o = this.options;
this.$table = BI.Widget._renderEngine.createElement("<table>").attr({cellspacing: 0, cellpadding: 0}).css({ BI.TableAdaptLayout.superclass.render.apply(this, arguments);
this.$table = BI.Widget._renderEngine.createElement("<div>").css({
position: "relative", position: "relative",
width: o.horizontalAlign === BI.HorizontalAlign.Stretch ? "100%" : "auto", display: "table",
height: "100%", height: o.verticalAlign === BI.VerticalAlign.Middle ? "100%" : "auto",
"white-space": "nowrap", width: o.horizontalAlign === BI.HorizontalAlign.Center ? "100%" : "auto",
"border-spacing": "0px", "white-space": "nowrap"
border: "none",
"border-collapse": "separate"
}); });
this.$tr = BI.Widget._renderEngine.createElement("<tr>");
this.$tr.appendTo(this.$table);
this.populate(this.options.items); this.populate(this.options.items);
}, },
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var td; var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
@ -30833,28 +30765,25 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
tagName: "td", width: width,
attributes: {
width: width
},
items: [w] items: [w]
}); });
this.addWidget(this._getChildName(i), td); this.addWidget(this._getChildName(i), td);
} else { } else {
td = this.getWidgetByName(this._getChildName(i)); td = this.getWidgetByName(this._getChildName(i));
td.element.attr("width", width); td.element.width(width);
} }
td.element.css({"max-width": o.columnSize[i] + "px"});
if (i === 0) { if (i === 0) {
td.element.addClass("first-element"); td.element.addClass("first-element");
} }
td.element.css({ td.element.css({
position: "relative", position: "relative",
height: "100%", display: "table-cell",
"vertical-align": "middle", "vertical-align": "middle",
margin: "0", margin: "0",
padding: "0", padding: "0",
border: "none" height: "100%"
}); });
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
@ -30863,7 +30792,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": (i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0) +"px" "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) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
@ -30880,12 +30809,57 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
}, },
appendFragment: function (frag) { appendFragment: function (frag) {
this.$tr.append(frag); this.$table.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}, },
_getWrapper: function () { resize: function () {
return this.$tr; // console.log("center_adapt布局不需要resize");
},
populate: function (items) {
BI.TableAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut("bi.table_adapt", BI.TableAdaptLayout);/**
* 垂直方向居中容器
* @class BI.VerticalAdaptLayout
* @extends BI.Layout
*/
BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
props: {
baseCls: "bi-vertical-adapt-layout",
columnSize: [],
scrollx: false,
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
},
render: function () {
var self = this, o = this.options;
BI.VerticalAdaptLayout.superclass.render.apply(this, arguments);
return {
type: "bi.horizontal",
verticalAlign: BI.VerticalAlign.Middle,
horizontalAlign: BI.HorizontalAlign.Left,
columnSize: o.columnSize,
items: o.items,
scrollx: o.scrollx,
ref: function (_ref) {
self.layout = _ref;
},
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
};
}, },
resize: function () { resize: function () {
@ -30893,8 +30867,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
}, },
populate: function (items) { populate: function (items) {
BI.VerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.vertical_adapt", BI.VerticalAdaptLayout);/** BI.shortcut("bi.vertical_adapt", BI.VerticalAdaptLayout);/**
@ -31262,106 +31235,6 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
} }
}); });
BI.shortcut("bi.inline_vertical_adapt", BI.InlineVerticalAdaptLayout);/** BI.shortcut("bi.inline_vertical_adapt", BI.InlineVerticalAdaptLayout);/**
* 使用display:table和display:table-cell实现的horizontal布局
* @class BI.TableAdaptLayout
* @extends BI.Layout
*/
BI.TableAdaptLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.TableAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-table-center-adapt-layout",
columnSize: [],
verticalAlign: BI.VerticalAlign.Top,
horizontalAlign: BI.HorizontalAlign.Left,
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
});
},
render: function () {
var o = this.options;
BI.TableAdaptLayout.superclass.render.apply(this, arguments);
this.$table = BI.Widget._renderEngine.createElement("<div>").css({
position: "relative",
display: "table",
height: o.verticalAlign === BI.VerticalAlign.Middle ? "100%" : "auto",
width: o.horizontalAlign === BI.HorizontalAlign.Center ? "100%" : "auto",
"white-space": "nowrap"
});
this.populate(this.options.items);
},
_addElement: function (i, item) {
var o = this.options;
var td;
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",
width: width,
items: [w]
});
this.addWidget(this._getChildName(i), td);
} else {
td = this.getWidgetByName(this._getChildName(i));
td.element.width(width);
}
td.element.css({"max-width": o.columnSize[i] + "px"});
if (i === 0) {
td.element.addClass("first-element");
}
td.element.css({
position: "relative",
display: "table-cell",
"vertical-align": "middle",
margin: "0",
padding: "0",
height: "100%"
});
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.$table.append(frag);
this.element.append(this.$table);
},
resize: function () {
// console.log("center_adapt布局不需要resize");
},
populate: function (items) {
BI.TableAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut("bi.table_adapt", BI.TableAdaptLayout);/**
*自适应水平和垂直方向都居中容器 *自适应水平和垂直方向都居中容器
* Created by GUY on 2016/12/2. * Created by GUY on 2016/12/2.
* *

60
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

453
dist/core.js vendored

@ -30415,6 +30415,7 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
return BI.extend(BI.CenterAdaptLayout.superclass.props.apply(this, arguments), { return BI.extend(BI.CenterAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-center-adapt-layout", baseCls: "bi-center-adapt-layout",
columnSize: [], columnSize: [],
scrollx: false,
hgap: 0, hgap: 0,
vgap: 0, vgap: 0,
lgap: 0, lgap: 0,
@ -30424,92 +30425,33 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.CenterAdaptLayout.superclass.render.apply(this, arguments); BI.CenterAdaptLayout.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.Middle,
height: "100%", horizontalAlign: BI.HorizontalAlign.Center,
"white-space": "nowrap", columnSize: o.columnSize,
"border-spacing": "0px", scrollx: o.scrollx,
border: "none", items: o.items,
"border-collapse": "separate" ref: function (_ref) {
}); self.layout = _ref;
this.$tr = BI.Widget._renderEngine.createElement("<tr>"); },
this.$tr.appendTo(this.$table); hgap: o.hgap,
this.populate(this.options.items); vgap: o.vgap,
}, lgap: o.lgap,
rgap: o.rgap,
_addElement: function (i, item) { tgap: o.tgap,
var o = this.options; bgap: o.bgap
var td; };
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]});
if (i === 0) {
td.element.addClass("first-element");
}
td.element.css({
position: "relative",
height: "100%",
"vertical-align": "middle",
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("center_adapt布局不需要resize"); // console.log("center_adapt布局不需要resize");
}, },
_getWrapper: function () {
return this.$tr;
},
populate: function (items) { populate: function (items) {
BI.CenterAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.center_adapt", BI.CenterAdaptLayout);/** BI.shortcut("bi.center_adapt", BI.CenterAdaptLayout);/**
@ -30641,8 +30583,40 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.LeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.LeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); var layoutArray = [];
if ("left" in o.items) {
layoutArray.push({
type: "bi.left",
items: [{
el: {
type: "bi.vertical_adapt",
height: "100%",
items: o.items.left,
hgap: o.lhgap,
lgap: o.llgap,
rgap: o.lrgap
}
}]
});
}
if ("right" in o.items) {
layoutArray.push({
type: "bi.right",
items: [{
el: {
type: "bi.vertical_adapt",
height: "100%",
items: o.items.right,
hgap: o.rhgap,
lgap: o.rlgap,
rgap: o.rrgap
}
}]
});
}
return layoutArray;
}, },
resize: function () { resize: function () {
@ -30654,40 +30628,6 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
if ("left" in items) {
var left = BI.createWidget({
type: "bi.vertical_adapt",
items: items.left,
hgap: o.lhgap,
lgap: o.llgap,
rgap: o.lrgap
});
left.element.css("height", "100%");
BI.createWidget({
type: "bi.left",
element: this,
items: [left]
});
}
if ("right" in items) {
var right = BI.createWidget({
type: "bi.vertical_adapt",
items: items.right,
hgap: o.rhgap,
lgap: o.rlgap,
rgap: o.rrgap
});
right.element.css("height", "100%");
BI.createWidget({
type: "bi.right",
element: this,
items: [right]
});
}
},
populate: function (items) { populate: function (items) {
BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments); BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount(); this._mount();
@ -30707,8 +30647,22 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.LeftVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.LeftVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); return {
type: "bi.left",
ref: function (_ref) {
self.layout = _ref;
},
items: [{
type: "bi.vertical_adapt",
height: "100%",
items: o.items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
}]
};
}, },
resize: function () { resize: function () {
@ -30720,26 +30674,8 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
var left = BI.createWidget({
type: "bi.vertical_adapt",
items: items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
});
left.element.css("height", "100%");
BI.createWidget({
type: "bi.left",
element: this,
items: [left]
});
},
populate: function (items) { populate: function (items) {
BI.LeftVerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.left_vertical_adapt", BI.LeftVerticalAdaptLayout); BI.shortcut("bi.left_vertical_adapt", BI.LeftVerticalAdaptLayout);
@ -30755,8 +30691,22 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.RightVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.RightVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); return {
type: "bi.right",
ref: function (_ref) {
self.layout = _ref;
},
items: [{
type: "bi.vertical_adapt",
height: "100%",
items: o.items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
}]
};
}, },
resize: function () { resize: function () {
@ -30768,63 +30718,45 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
var right = BI.createWidget({
type: "bi.vertical_adapt",
items: items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
});
right.element.css("height", "100%");
BI.createWidget({
type: "bi.right",
element: this,
items: [right]
});
},
populate: function (items) { populate: function (items) {
BI.RightVerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.right_vertical_adapt", BI.RightVerticalAdaptLayout);/** BI.shortcut("bi.right_vertical_adapt", BI.RightVerticalAdaptLayout);/**
* 垂直方向居中容器 * 使用display:table和display:table-cell实现的horizontal布局
* @class BI.VerticalAdaptLayout * @class BI.TableAdaptLayout
* @extends BI.Layout * @extends BI.Layout
*/ */
BI.VerticalAdaptLayout = BI.inherit(BI.Layout, { BI.TableAdaptLayout = BI.inherit(BI.Layout, {
props: { props: function () {
baseCls: "bi-vertical-adapt-layout", return BI.extend(BI.TableAdaptLayout.superclass.props.apply(this, arguments), {
columnSize: [], baseCls: "bi-table-center-adapt-layout",
horizontalAlign: BI.HorizontalAlign.Left, columnSize: [],
hgap: 0, verticalAlign: BI.VerticalAlign.Top,
vgap: 0, horizontalAlign: BI.HorizontalAlign.Left,
lgap: 0, hgap: 0,
rgap: 0, vgap: 0,
tgap: 0, lgap: 0,
bgap: 0 rgap: 0,
tgap: 0,
bgap: 0
});
}, },
render: function () { render: function () {
BI.VerticalAdaptLayout.superclass.render.apply(this, arguments);
var o = this.options; var o = this.options;
this.$table = BI.Widget._renderEngine.createElement("<table>").attr({cellspacing: 0, cellpadding: 0}).css({ BI.TableAdaptLayout.superclass.render.apply(this, arguments);
this.$table = BI.Widget._renderEngine.createElement("<div>").css({
position: "relative", position: "relative",
width: o.horizontalAlign === BI.HorizontalAlign.Stretch ? "100%" : "auto", display: "table",
height: "100%", height: o.verticalAlign === BI.VerticalAlign.Middle ? "100%" : "auto",
"white-space": "nowrap", width: o.horizontalAlign === BI.HorizontalAlign.Center ? "100%" : "auto",
"border-spacing": "0px", "white-space": "nowrap"
border: "none",
"border-collapse": "separate"
}); });
this.$tr = BI.Widget._renderEngine.createElement("<tr>");
this.$tr.appendTo(this.$table);
this.populate(this.options.items); this.populate(this.options.items);
}, },
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var td; var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
@ -30833,28 +30765,25 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
tagName: "td", width: width,
attributes: {
width: width
},
items: [w] items: [w]
}); });
this.addWidget(this._getChildName(i), td); this.addWidget(this._getChildName(i), td);
} else { } else {
td = this.getWidgetByName(this._getChildName(i)); td = this.getWidgetByName(this._getChildName(i));
td.element.attr("width", width); td.element.width(width);
} }
td.element.css({"max-width": o.columnSize[i] + "px"});
if (i === 0) { if (i === 0) {
td.element.addClass("first-element"); td.element.addClass("first-element");
} }
td.element.css({ td.element.css({
position: "relative", position: "relative",
height: "100%", display: "table-cell",
"vertical-align": "middle", "vertical-align": "middle",
margin: "0", margin: "0",
padding: "0", padding: "0",
border: "none" height: "100%"
}); });
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
@ -30863,7 +30792,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": (i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0) +"px" "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) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
@ -30880,12 +30809,57 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
}, },
appendFragment: function (frag) { appendFragment: function (frag) {
this.$tr.append(frag); this.$table.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}, },
_getWrapper: function () { resize: function () {
return this.$tr; // console.log("center_adapt布局不需要resize");
},
populate: function (items) {
BI.TableAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut("bi.table_adapt", BI.TableAdaptLayout);/**
* 垂直方向居中容器
* @class BI.VerticalAdaptLayout
* @extends BI.Layout
*/
BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
props: {
baseCls: "bi-vertical-adapt-layout",
columnSize: [],
scrollx: false,
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
},
render: function () {
var self = this, o = this.options;
BI.VerticalAdaptLayout.superclass.render.apply(this, arguments);
return {
type: "bi.horizontal",
verticalAlign: BI.VerticalAlign.Middle,
horizontalAlign: BI.HorizontalAlign.Left,
columnSize: o.columnSize,
items: o.items,
scrollx: o.scrollx,
ref: function (_ref) {
self.layout = _ref;
},
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
};
}, },
resize: function () { resize: function () {
@ -30893,8 +30867,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
}, },
populate: function (items) { populate: function (items) {
BI.VerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.vertical_adapt", BI.VerticalAdaptLayout);/** BI.shortcut("bi.vertical_adapt", BI.VerticalAdaptLayout);/**
@ -31262,106 +31235,6 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
} }
}); });
BI.shortcut("bi.inline_vertical_adapt", BI.InlineVerticalAdaptLayout);/** BI.shortcut("bi.inline_vertical_adapt", BI.InlineVerticalAdaptLayout);/**
* 使用display:table和display:table-cell实现的horizontal布局
* @class BI.TableAdaptLayout
* @extends BI.Layout
*/
BI.TableAdaptLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.TableAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-table-center-adapt-layout",
columnSize: [],
verticalAlign: BI.VerticalAlign.Top,
horizontalAlign: BI.HorizontalAlign.Left,
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
});
},
render: function () {
var o = this.options;
BI.TableAdaptLayout.superclass.render.apply(this, arguments);
this.$table = BI.Widget._renderEngine.createElement("<div>").css({
position: "relative",
display: "table",
height: o.verticalAlign === BI.VerticalAlign.Middle ? "100%" : "auto",
width: o.horizontalAlign === BI.HorizontalAlign.Center ? "100%" : "auto",
"white-space": "nowrap"
});
this.populate(this.options.items);
},
_addElement: function (i, item) {
var o = this.options;
var td;
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",
width: width,
items: [w]
});
this.addWidget(this._getChildName(i), td);
} else {
td = this.getWidgetByName(this._getChildName(i));
td.element.width(width);
}
td.element.css({"max-width": o.columnSize[i] + "px"});
if (i === 0) {
td.element.addClass("first-element");
}
td.element.css({
position: "relative",
display: "table-cell",
"vertical-align": "middle",
margin: "0",
padding: "0",
height: "100%"
});
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.$table.append(frag);
this.element.append(this.$table);
},
resize: function () {
// console.log("center_adapt布局不需要resize");
},
populate: function (items) {
BI.TableAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut("bi.table_adapt", BI.TableAdaptLayout);/**
*自适应水平和垂直方向都居中容器 *自适应水平和垂直方向都居中容器
* Created by GUY on 2016/12/2. * Created by GUY on 2016/12/2.
* *

453
dist/fineui.ie.js vendored

@ -30657,6 +30657,7 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
return BI.extend(BI.CenterAdaptLayout.superclass.props.apply(this, arguments), { return BI.extend(BI.CenterAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-center-adapt-layout", baseCls: "bi-center-adapt-layout",
columnSize: [], columnSize: [],
scrollx: false,
hgap: 0, hgap: 0,
vgap: 0, vgap: 0,
lgap: 0, lgap: 0,
@ -30666,92 +30667,33 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.CenterAdaptLayout.superclass.render.apply(this, arguments); BI.CenterAdaptLayout.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.Middle,
height: "100%", horizontalAlign: BI.HorizontalAlign.Center,
"white-space": "nowrap", columnSize: o.columnSize,
"border-spacing": "0px", scrollx: o.scrollx,
border: "none", items: o.items,
"border-collapse": "separate" ref: function (_ref) {
}); self.layout = _ref;
this.$tr = BI.Widget._renderEngine.createElement("<tr>"); },
this.$tr.appendTo(this.$table); hgap: o.hgap,
this.populate(this.options.items); vgap: o.vgap,
}, lgap: o.lgap,
rgap: o.rgap,
_addElement: function (i, item) { tgap: o.tgap,
var o = this.options; bgap: o.bgap
var td; };
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]});
if (i === 0) {
td.element.addClass("first-element");
}
td.element.css({
position: "relative",
height: "100%",
"vertical-align": "middle",
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("center_adapt布局不需要resize"); // console.log("center_adapt布局不需要resize");
}, },
_getWrapper: function () {
return this.$tr;
},
populate: function (items) { populate: function (items) {
BI.CenterAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.center_adapt", BI.CenterAdaptLayout);/** BI.shortcut("bi.center_adapt", BI.CenterAdaptLayout);/**
@ -30883,8 +30825,40 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.LeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.LeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); var layoutArray = [];
if ("left" in o.items) {
layoutArray.push({
type: "bi.left",
items: [{
el: {
type: "bi.vertical_adapt",
height: "100%",
items: o.items.left,
hgap: o.lhgap,
lgap: o.llgap,
rgap: o.lrgap
}
}]
});
}
if ("right" in o.items) {
layoutArray.push({
type: "bi.right",
items: [{
el: {
type: "bi.vertical_adapt",
height: "100%",
items: o.items.right,
hgap: o.rhgap,
lgap: o.rlgap,
rgap: o.rrgap
}
}]
});
}
return layoutArray;
}, },
resize: function () { resize: function () {
@ -30896,40 +30870,6 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
if ("left" in items) {
var left = BI.createWidget({
type: "bi.vertical_adapt",
items: items.left,
hgap: o.lhgap,
lgap: o.llgap,
rgap: o.lrgap
});
left.element.css("height", "100%");
BI.createWidget({
type: "bi.left",
element: this,
items: [left]
});
}
if ("right" in items) {
var right = BI.createWidget({
type: "bi.vertical_adapt",
items: items.right,
hgap: o.rhgap,
lgap: o.rlgap,
rgap: o.rrgap
});
right.element.css("height", "100%");
BI.createWidget({
type: "bi.right",
element: this,
items: [right]
});
}
},
populate: function (items) { populate: function (items) {
BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments); BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount(); this._mount();
@ -30949,8 +30889,22 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.LeftVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.LeftVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); return {
type: "bi.left",
ref: function (_ref) {
self.layout = _ref;
},
items: [{
type: "bi.vertical_adapt",
height: "100%",
items: o.items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
}]
};
}, },
resize: function () { resize: function () {
@ -30962,26 +30916,8 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
var left = BI.createWidget({
type: "bi.vertical_adapt",
items: items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
});
left.element.css("height", "100%");
BI.createWidget({
type: "bi.left",
element: this,
items: [left]
});
},
populate: function (items) { populate: function (items) {
BI.LeftVerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.left_vertical_adapt", BI.LeftVerticalAdaptLayout); BI.shortcut("bi.left_vertical_adapt", BI.LeftVerticalAdaptLayout);
@ -30997,8 +30933,22 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.RightVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.RightVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); return {
type: "bi.right",
ref: function (_ref) {
self.layout = _ref;
},
items: [{
type: "bi.vertical_adapt",
height: "100%",
items: o.items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
}]
};
}, },
resize: function () { resize: function () {
@ -31010,63 +30960,45 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
var right = BI.createWidget({
type: "bi.vertical_adapt",
items: items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
});
right.element.css("height", "100%");
BI.createWidget({
type: "bi.right",
element: this,
items: [right]
});
},
populate: function (items) { populate: function (items) {
BI.RightVerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.right_vertical_adapt", BI.RightVerticalAdaptLayout);/** BI.shortcut("bi.right_vertical_adapt", BI.RightVerticalAdaptLayout);/**
* 垂直方向居中容器 * 使用display:table和display:table-cell实现的horizontal布局
* @class BI.VerticalAdaptLayout * @class BI.TableAdaptLayout
* @extends BI.Layout * @extends BI.Layout
*/ */
BI.VerticalAdaptLayout = BI.inherit(BI.Layout, { BI.TableAdaptLayout = BI.inherit(BI.Layout, {
props: { props: function () {
baseCls: "bi-vertical-adapt-layout", return BI.extend(BI.TableAdaptLayout.superclass.props.apply(this, arguments), {
columnSize: [], baseCls: "bi-table-center-adapt-layout",
horizontalAlign: BI.HorizontalAlign.Left, columnSize: [],
hgap: 0, verticalAlign: BI.VerticalAlign.Top,
vgap: 0, horizontalAlign: BI.HorizontalAlign.Left,
lgap: 0, hgap: 0,
rgap: 0, vgap: 0,
tgap: 0, lgap: 0,
bgap: 0 rgap: 0,
tgap: 0,
bgap: 0
});
}, },
render: function () { render: function () {
BI.VerticalAdaptLayout.superclass.render.apply(this, arguments);
var o = this.options; var o = this.options;
this.$table = BI.Widget._renderEngine.createElement("<table>").attr({cellspacing: 0, cellpadding: 0}).css({ BI.TableAdaptLayout.superclass.render.apply(this, arguments);
this.$table = BI.Widget._renderEngine.createElement("<div>").css({
position: "relative", position: "relative",
width: o.horizontalAlign === BI.HorizontalAlign.Stretch ? "100%" : "auto", display: "table",
height: "100%", height: o.verticalAlign === BI.VerticalAlign.Middle ? "100%" : "auto",
"white-space": "nowrap", width: o.horizontalAlign === BI.HorizontalAlign.Center ? "100%" : "auto",
"border-spacing": "0px", "white-space": "nowrap"
border: "none",
"border-collapse": "separate"
}); });
this.$tr = BI.Widget._renderEngine.createElement("<tr>");
this.$tr.appendTo(this.$table);
this.populate(this.options.items); this.populate(this.options.items);
}, },
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var td; var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
@ -31075,28 +31007,25 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
tagName: "td", width: width,
attributes: {
width: width
},
items: [w] items: [w]
}); });
this.addWidget(this._getChildName(i), td); this.addWidget(this._getChildName(i), td);
} else { } else {
td = this.getWidgetByName(this._getChildName(i)); td = this.getWidgetByName(this._getChildName(i));
td.element.attr("width", width); td.element.width(width);
} }
td.element.css({"max-width": o.columnSize[i] + "px"});
if (i === 0) { if (i === 0) {
td.element.addClass("first-element"); td.element.addClass("first-element");
} }
td.element.css({ td.element.css({
position: "relative", position: "relative",
height: "100%", display: "table-cell",
"vertical-align": "middle", "vertical-align": "middle",
margin: "0", margin: "0",
padding: "0", padding: "0",
border: "none" height: "100%"
}); });
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
@ -31105,7 +31034,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": (i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0) +"px" "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) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
@ -31122,12 +31051,57 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
}, },
appendFragment: function (frag) { appendFragment: function (frag) {
this.$tr.append(frag); this.$table.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}, },
_getWrapper: function () { resize: function () {
return this.$tr; // console.log("center_adapt布局不需要resize");
},
populate: function (items) {
BI.TableAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut("bi.table_adapt", BI.TableAdaptLayout);/**
* 垂直方向居中容器
* @class BI.VerticalAdaptLayout
* @extends BI.Layout
*/
BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
props: {
baseCls: "bi-vertical-adapt-layout",
columnSize: [],
scrollx: false,
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
},
render: function () {
var self = this, o = this.options;
BI.VerticalAdaptLayout.superclass.render.apply(this, arguments);
return {
type: "bi.horizontal",
verticalAlign: BI.VerticalAlign.Middle,
horizontalAlign: BI.HorizontalAlign.Left,
columnSize: o.columnSize,
items: o.items,
scrollx: o.scrollx,
ref: function (_ref) {
self.layout = _ref;
},
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
};
}, },
resize: function () { resize: function () {
@ -31135,8 +31109,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
}, },
populate: function (items) { populate: function (items) {
BI.VerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.vertical_adapt", BI.VerticalAdaptLayout);/** BI.shortcut("bi.vertical_adapt", BI.VerticalAdaptLayout);/**
@ -31504,106 +31477,6 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
} }
}); });
BI.shortcut("bi.inline_vertical_adapt", BI.InlineVerticalAdaptLayout);/** BI.shortcut("bi.inline_vertical_adapt", BI.InlineVerticalAdaptLayout);/**
* 使用display:table和display:table-cell实现的horizontal布局
* @class BI.TableAdaptLayout
* @extends BI.Layout
*/
BI.TableAdaptLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.TableAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-table-center-adapt-layout",
columnSize: [],
verticalAlign: BI.VerticalAlign.Top,
horizontalAlign: BI.HorizontalAlign.Left,
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
});
},
render: function () {
var o = this.options;
BI.TableAdaptLayout.superclass.render.apply(this, arguments);
this.$table = BI.Widget._renderEngine.createElement("<div>").css({
position: "relative",
display: "table",
height: o.verticalAlign === BI.VerticalAlign.Middle ? "100%" : "auto",
width: o.horizontalAlign === BI.HorizontalAlign.Center ? "100%" : "auto",
"white-space": "nowrap"
});
this.populate(this.options.items);
},
_addElement: function (i, item) {
var o = this.options;
var td;
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",
width: width,
items: [w]
});
this.addWidget(this._getChildName(i), td);
} else {
td = this.getWidgetByName(this._getChildName(i));
td.element.width(width);
}
td.element.css({"max-width": o.columnSize[i] + "px"});
if (i === 0) {
td.element.addClass("first-element");
}
td.element.css({
position: "relative",
display: "table-cell",
"vertical-align": "middle",
margin: "0",
padding: "0",
height: "100%"
});
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.$table.append(frag);
this.element.append(this.$table);
},
resize: function () {
// console.log("center_adapt布局不需要resize");
},
populate: function (items) {
BI.TableAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut("bi.table_adapt", BI.TableAdaptLayout);/**
*自适应水平和垂直方向都居中容器 *自适应水平和垂直方向都居中容器
* Created by GUY on 2016/12/2. * Created by GUY on 2016/12/2.
* *

60
dist/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

453
dist/fineui.js vendored

@ -30657,6 +30657,7 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
return BI.extend(BI.CenterAdaptLayout.superclass.props.apply(this, arguments), { return BI.extend(BI.CenterAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-center-adapt-layout", baseCls: "bi-center-adapt-layout",
columnSize: [], columnSize: [],
scrollx: false,
hgap: 0, hgap: 0,
vgap: 0, vgap: 0,
lgap: 0, lgap: 0,
@ -30666,92 +30667,33 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.CenterAdaptLayout.superclass.render.apply(this, arguments); BI.CenterAdaptLayout.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.Middle,
height: "100%", horizontalAlign: BI.HorizontalAlign.Center,
"white-space": "nowrap", columnSize: o.columnSize,
"border-spacing": "0px", scrollx: o.scrollx,
border: "none", items: o.items,
"border-collapse": "separate" ref: function (_ref) {
}); self.layout = _ref;
this.$tr = BI.Widget._renderEngine.createElement("<tr>"); },
this.$tr.appendTo(this.$table); hgap: o.hgap,
this.populate(this.options.items); vgap: o.vgap,
}, lgap: o.lgap,
rgap: o.rgap,
_addElement: function (i, item) { tgap: o.tgap,
var o = this.options; bgap: o.bgap
var td; };
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]});
if (i === 0) {
td.element.addClass("first-element");
}
td.element.css({
position: "relative",
height: "100%",
"vertical-align": "middle",
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("center_adapt布局不需要resize"); // console.log("center_adapt布局不需要resize");
}, },
_getWrapper: function () {
return this.$tr;
},
populate: function (items) { populate: function (items) {
BI.CenterAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.center_adapt", BI.CenterAdaptLayout);/** BI.shortcut("bi.center_adapt", BI.CenterAdaptLayout);/**
@ -30883,8 +30825,40 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.LeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.LeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); var layoutArray = [];
if ("left" in o.items) {
layoutArray.push({
type: "bi.left",
items: [{
el: {
type: "bi.vertical_adapt",
height: "100%",
items: o.items.left,
hgap: o.lhgap,
lgap: o.llgap,
rgap: o.lrgap
}
}]
});
}
if ("right" in o.items) {
layoutArray.push({
type: "bi.right",
items: [{
el: {
type: "bi.vertical_adapt",
height: "100%",
items: o.items.right,
hgap: o.rhgap,
lgap: o.rlgap,
rgap: o.rrgap
}
}]
});
}
return layoutArray;
}, },
resize: function () { resize: function () {
@ -30896,40 +30870,6 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
if ("left" in items) {
var left = BI.createWidget({
type: "bi.vertical_adapt",
items: items.left,
hgap: o.lhgap,
lgap: o.llgap,
rgap: o.lrgap
});
left.element.css("height", "100%");
BI.createWidget({
type: "bi.left",
element: this,
items: [left]
});
}
if ("right" in items) {
var right = BI.createWidget({
type: "bi.vertical_adapt",
items: items.right,
hgap: o.rhgap,
lgap: o.rlgap,
rgap: o.rrgap
});
right.element.css("height", "100%");
BI.createWidget({
type: "bi.right",
element: this,
items: [right]
});
}
},
populate: function (items) { populate: function (items) {
BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments); BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount(); this._mount();
@ -30949,8 +30889,22 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.LeftVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.LeftVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); return {
type: "bi.left",
ref: function (_ref) {
self.layout = _ref;
},
items: [{
type: "bi.vertical_adapt",
height: "100%",
items: o.items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
}]
};
}, },
resize: function () { resize: function () {
@ -30962,26 +30916,8 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
var left = BI.createWidget({
type: "bi.vertical_adapt",
items: items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
});
left.element.css("height", "100%");
BI.createWidget({
type: "bi.left",
element: this,
items: [left]
});
},
populate: function (items) { populate: function (items) {
BI.LeftVerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.left_vertical_adapt", BI.LeftVerticalAdaptLayout); BI.shortcut("bi.left_vertical_adapt", BI.LeftVerticalAdaptLayout);
@ -30997,8 +30933,22 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.RightVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.RightVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); return {
type: "bi.right",
ref: function (_ref) {
self.layout = _ref;
},
items: [{
type: "bi.vertical_adapt",
height: "100%",
items: o.items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
}]
};
}, },
resize: function () { resize: function () {
@ -31010,63 +30960,45 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
var right = BI.createWidget({
type: "bi.vertical_adapt",
items: items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
});
right.element.css("height", "100%");
BI.createWidget({
type: "bi.right",
element: this,
items: [right]
});
},
populate: function (items) { populate: function (items) {
BI.RightVerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.right_vertical_adapt", BI.RightVerticalAdaptLayout);/** BI.shortcut("bi.right_vertical_adapt", BI.RightVerticalAdaptLayout);/**
* 垂直方向居中容器 * 使用display:table和display:table-cell实现的horizontal布局
* @class BI.VerticalAdaptLayout * @class BI.TableAdaptLayout
* @extends BI.Layout * @extends BI.Layout
*/ */
BI.VerticalAdaptLayout = BI.inherit(BI.Layout, { BI.TableAdaptLayout = BI.inherit(BI.Layout, {
props: { props: function () {
baseCls: "bi-vertical-adapt-layout", return BI.extend(BI.TableAdaptLayout.superclass.props.apply(this, arguments), {
columnSize: [], baseCls: "bi-table-center-adapt-layout",
horizontalAlign: BI.HorizontalAlign.Left, columnSize: [],
hgap: 0, verticalAlign: BI.VerticalAlign.Top,
vgap: 0, horizontalAlign: BI.HorizontalAlign.Left,
lgap: 0, hgap: 0,
rgap: 0, vgap: 0,
tgap: 0, lgap: 0,
bgap: 0 rgap: 0,
tgap: 0,
bgap: 0
});
}, },
render: function () { render: function () {
BI.VerticalAdaptLayout.superclass.render.apply(this, arguments);
var o = this.options; var o = this.options;
this.$table = BI.Widget._renderEngine.createElement("<table>").attr({cellspacing: 0, cellpadding: 0}).css({ BI.TableAdaptLayout.superclass.render.apply(this, arguments);
this.$table = BI.Widget._renderEngine.createElement("<div>").css({
position: "relative", position: "relative",
width: o.horizontalAlign === BI.HorizontalAlign.Stretch ? "100%" : "auto", display: "table",
height: "100%", height: o.verticalAlign === BI.VerticalAlign.Middle ? "100%" : "auto",
"white-space": "nowrap", width: o.horizontalAlign === BI.HorizontalAlign.Center ? "100%" : "auto",
"border-spacing": "0px", "white-space": "nowrap"
border: "none",
"border-collapse": "separate"
}); });
this.$tr = BI.Widget._renderEngine.createElement("<tr>");
this.$tr.appendTo(this.$table);
this.populate(this.options.items); this.populate(this.options.items);
}, },
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var td; var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
@ -31075,28 +31007,25 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
tagName: "td", width: width,
attributes: {
width: width
},
items: [w] items: [w]
}); });
this.addWidget(this._getChildName(i), td); this.addWidget(this._getChildName(i), td);
} else { } else {
td = this.getWidgetByName(this._getChildName(i)); td = this.getWidgetByName(this._getChildName(i));
td.element.attr("width", width); td.element.width(width);
} }
td.element.css({"max-width": o.columnSize[i] + "px"});
if (i === 0) { if (i === 0) {
td.element.addClass("first-element"); td.element.addClass("first-element");
} }
td.element.css({ td.element.css({
position: "relative", position: "relative",
height: "100%", display: "table-cell",
"vertical-align": "middle", "vertical-align": "middle",
margin: "0", margin: "0",
padding: "0", padding: "0",
border: "none" height: "100%"
}); });
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
@ -31105,7 +31034,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": (i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0) +"px" "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) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
@ -31122,12 +31051,57 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
}, },
appendFragment: function (frag) { appendFragment: function (frag) {
this.$tr.append(frag); this.$table.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}, },
_getWrapper: function () { resize: function () {
return this.$tr; // console.log("center_adapt布局不需要resize");
},
populate: function (items) {
BI.TableAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut("bi.table_adapt", BI.TableAdaptLayout);/**
* 垂直方向居中容器
* @class BI.VerticalAdaptLayout
* @extends BI.Layout
*/
BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
props: {
baseCls: "bi-vertical-adapt-layout",
columnSize: [],
scrollx: false,
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
},
render: function () {
var self = this, o = this.options;
BI.VerticalAdaptLayout.superclass.render.apply(this, arguments);
return {
type: "bi.horizontal",
verticalAlign: BI.VerticalAlign.Middle,
horizontalAlign: BI.HorizontalAlign.Left,
columnSize: o.columnSize,
items: o.items,
scrollx: o.scrollx,
ref: function (_ref) {
self.layout = _ref;
},
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
};
}, },
resize: function () { resize: function () {
@ -31135,8 +31109,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
}, },
populate: function (items) { populate: function (items) {
BI.VerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.vertical_adapt", BI.VerticalAdaptLayout);/** BI.shortcut("bi.vertical_adapt", BI.VerticalAdaptLayout);/**
@ -31504,106 +31477,6 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
} }
}); });
BI.shortcut("bi.inline_vertical_adapt", BI.InlineVerticalAdaptLayout);/** BI.shortcut("bi.inline_vertical_adapt", BI.InlineVerticalAdaptLayout);/**
* 使用display:table和display:table-cell实现的horizontal布局
* @class BI.TableAdaptLayout
* @extends BI.Layout
*/
BI.TableAdaptLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.TableAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-table-center-adapt-layout",
columnSize: [],
verticalAlign: BI.VerticalAlign.Top,
horizontalAlign: BI.HorizontalAlign.Left,
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
});
},
render: function () {
var o = this.options;
BI.TableAdaptLayout.superclass.render.apply(this, arguments);
this.$table = BI.Widget._renderEngine.createElement("<div>").css({
position: "relative",
display: "table",
height: o.verticalAlign === BI.VerticalAlign.Middle ? "100%" : "auto",
width: o.horizontalAlign === BI.HorizontalAlign.Center ? "100%" : "auto",
"white-space": "nowrap"
});
this.populate(this.options.items);
},
_addElement: function (i, item) {
var o = this.options;
var td;
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",
width: width,
items: [w]
});
this.addWidget(this._getChildName(i), td);
} else {
td = this.getWidgetByName(this._getChildName(i));
td.element.width(width);
}
td.element.css({"max-width": o.columnSize[i] + "px"});
if (i === 0) {
td.element.addClass("first-element");
}
td.element.css({
position: "relative",
display: "table-cell",
"vertical-align": "middle",
margin: "0",
padding: "0",
height: "100%"
});
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.$table.append(frag);
this.element.append(this.$table);
},
resize: function () {
// console.log("center_adapt布局不需要resize");
},
populate: function (items) {
BI.TableAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut("bi.table_adapt", BI.TableAdaptLayout);/**
*自适应水平和垂直方向都居中容器 *自适应水平和垂直方向都居中容器
* Created by GUY on 2016/12/2. * Created by GUY on 2016/12/2.
* *

60
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

453
dist/fineui_without_jquery_polyfill.js vendored

@ -19426,6 +19426,7 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
return BI.extend(BI.CenterAdaptLayout.superclass.props.apply(this, arguments), { return BI.extend(BI.CenterAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-center-adapt-layout", baseCls: "bi-center-adapt-layout",
columnSize: [], columnSize: [],
scrollx: false,
hgap: 0, hgap: 0,
vgap: 0, vgap: 0,
lgap: 0, lgap: 0,
@ -19435,92 +19436,33 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.CenterAdaptLayout.superclass.render.apply(this, arguments); BI.CenterAdaptLayout.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.Middle,
height: "100%", horizontalAlign: BI.HorizontalAlign.Center,
"white-space": "nowrap", columnSize: o.columnSize,
"border-spacing": "0px", scrollx: o.scrollx,
border: "none", items: o.items,
"border-collapse": "separate" ref: function (_ref) {
}); self.layout = _ref;
this.$tr = BI.Widget._renderEngine.createElement("<tr>"); },
this.$tr.appendTo(this.$table); hgap: o.hgap,
this.populate(this.options.items); vgap: o.vgap,
}, lgap: o.lgap,
rgap: o.rgap,
_addElement: function (i, item) { tgap: o.tgap,
var o = this.options; bgap: o.bgap
var td; };
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]});
if (i === 0) {
td.element.addClass("first-element");
}
td.element.css({
position: "relative",
height: "100%",
"vertical-align": "middle",
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("center_adapt布局不需要resize"); // console.log("center_adapt布局不需要resize");
}, },
_getWrapper: function () {
return this.$tr;
},
populate: function (items) { populate: function (items) {
BI.CenterAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.center_adapt", BI.CenterAdaptLayout);/** BI.shortcut("bi.center_adapt", BI.CenterAdaptLayout);/**
@ -19652,8 +19594,40 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.LeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.LeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); var layoutArray = [];
if ("left" in o.items) {
layoutArray.push({
type: "bi.left",
items: [{
el: {
type: "bi.vertical_adapt",
height: "100%",
items: o.items.left,
hgap: o.lhgap,
lgap: o.llgap,
rgap: o.lrgap
}
}]
});
}
if ("right" in o.items) {
layoutArray.push({
type: "bi.right",
items: [{
el: {
type: "bi.vertical_adapt",
height: "100%",
items: o.items.right,
hgap: o.rhgap,
lgap: o.rlgap,
rgap: o.rrgap
}
}]
});
}
return layoutArray;
}, },
resize: function () { resize: function () {
@ -19665,40 +19639,6 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
if ("left" in items) {
var left = BI.createWidget({
type: "bi.vertical_adapt",
items: items.left,
hgap: o.lhgap,
lgap: o.llgap,
rgap: o.lrgap
});
left.element.css("height", "100%");
BI.createWidget({
type: "bi.left",
element: this,
items: [left]
});
}
if ("right" in items) {
var right = BI.createWidget({
type: "bi.vertical_adapt",
items: items.right,
hgap: o.rhgap,
lgap: o.rlgap,
rgap: o.rrgap
});
right.element.css("height", "100%");
BI.createWidget({
type: "bi.right",
element: this,
items: [right]
});
}
},
populate: function (items) { populate: function (items) {
BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments); BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount(); this._mount();
@ -19718,8 +19658,22 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.LeftVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.LeftVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); return {
type: "bi.left",
ref: function (_ref) {
self.layout = _ref;
},
items: [{
type: "bi.vertical_adapt",
height: "100%",
items: o.items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
}]
};
}, },
resize: function () { resize: function () {
@ -19731,26 +19685,8 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
var left = BI.createWidget({
type: "bi.vertical_adapt",
items: items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
});
left.element.css("height", "100%");
BI.createWidget({
type: "bi.left",
element: this,
items: [left]
});
},
populate: function (items) { populate: function (items) {
BI.LeftVerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.left_vertical_adapt", BI.LeftVerticalAdaptLayout); BI.shortcut("bi.left_vertical_adapt", BI.LeftVerticalAdaptLayout);
@ -19766,8 +19702,22 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.RightVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.RightVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); return {
type: "bi.right",
ref: function (_ref) {
self.layout = _ref;
},
items: [{
type: "bi.vertical_adapt",
height: "100%",
items: o.items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
}]
};
}, },
resize: function () { resize: function () {
@ -19779,63 +19729,45 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
var right = BI.createWidget({
type: "bi.vertical_adapt",
items: items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
});
right.element.css("height", "100%");
BI.createWidget({
type: "bi.right",
element: this,
items: [right]
});
},
populate: function (items) { populate: function (items) {
BI.RightVerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.right_vertical_adapt", BI.RightVerticalAdaptLayout);/** BI.shortcut("bi.right_vertical_adapt", BI.RightVerticalAdaptLayout);/**
* 垂直方向居中容器 * 使用display:table和display:table-cell实现的horizontal布局
* @class BI.VerticalAdaptLayout * @class BI.TableAdaptLayout
* @extends BI.Layout * @extends BI.Layout
*/ */
BI.VerticalAdaptLayout = BI.inherit(BI.Layout, { BI.TableAdaptLayout = BI.inherit(BI.Layout, {
props: { props: function () {
baseCls: "bi-vertical-adapt-layout", return BI.extend(BI.TableAdaptLayout.superclass.props.apply(this, arguments), {
columnSize: [], baseCls: "bi-table-center-adapt-layout",
horizontalAlign: BI.HorizontalAlign.Left, columnSize: [],
hgap: 0, verticalAlign: BI.VerticalAlign.Top,
vgap: 0, horizontalAlign: BI.HorizontalAlign.Left,
lgap: 0, hgap: 0,
rgap: 0, vgap: 0,
tgap: 0, lgap: 0,
bgap: 0 rgap: 0,
tgap: 0,
bgap: 0
});
}, },
render: function () { render: function () {
BI.VerticalAdaptLayout.superclass.render.apply(this, arguments);
var o = this.options; var o = this.options;
this.$table = BI.Widget._renderEngine.createElement("<table>").attr({cellspacing: 0, cellpadding: 0}).css({ BI.TableAdaptLayout.superclass.render.apply(this, arguments);
this.$table = BI.Widget._renderEngine.createElement("<div>").css({
position: "relative", position: "relative",
width: o.horizontalAlign === BI.HorizontalAlign.Stretch ? "100%" : "auto", display: "table",
height: "100%", height: o.verticalAlign === BI.VerticalAlign.Middle ? "100%" : "auto",
"white-space": "nowrap", width: o.horizontalAlign === BI.HorizontalAlign.Center ? "100%" : "auto",
"border-spacing": "0px", "white-space": "nowrap"
border: "none",
"border-collapse": "separate"
}); });
this.$tr = BI.Widget._renderEngine.createElement("<tr>");
this.$tr.appendTo(this.$table);
this.populate(this.options.items); this.populate(this.options.items);
}, },
_addElement: function (i, item) { _addElement: function (i, item) {
var o = this.options; var o = this.options;
var td; var td;
var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i];
@ -19844,28 +19776,25 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"}); w.element.css({position: "relative", top: "0", left: "0", margin: "0px auto"});
td = BI.createWidget({ td = BI.createWidget({
type: "bi.default", type: "bi.default",
tagName: "td", width: width,
attributes: {
width: width
},
items: [w] items: [w]
}); });
this.addWidget(this._getChildName(i), td); this.addWidget(this._getChildName(i), td);
} else { } else {
td = this.getWidgetByName(this._getChildName(i)); td = this.getWidgetByName(this._getChildName(i));
td.element.attr("width", width); td.element.width(width);
} }
td.element.css({"max-width": o.columnSize[i] + "px"});
if (i === 0) { if (i === 0) {
td.element.addClass("first-element"); td.element.addClass("first-element");
} }
td.element.css({ td.element.css({
position: "relative", position: "relative",
height: "100%", display: "table-cell",
"vertical-align": "middle", "vertical-align": "middle",
margin: "0", margin: "0",
padding: "0", padding: "0",
border: "none" height: "100%"
}); });
if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) { if (o.vgap + o.tgap + (item.tgap || 0) + (item.vgap || 0) !== 0) {
w.element.css({ w.element.css({
@ -19874,7 +19803,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
} }
if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) { if (o.hgap + o.lgap + (item.lgap || 0) + (item.hgap || 0) !== 0) {
w.element.css({ w.element.css({
"margin-left": (i === 0 ? o.hgap : 0) + o.lgap + (item.lgap || 0) + (item.hgap || 0) +"px" "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) { if (o.hgap + o.rgap + (item.rgap || 0) + (item.hgap || 0) !== 0) {
@ -19891,12 +19820,57 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
}, },
appendFragment: function (frag) { appendFragment: function (frag) {
this.$tr.append(frag); this.$table.append(frag);
this.element.append(this.$table); this.element.append(this.$table);
}, },
_getWrapper: function () { resize: function () {
return this.$tr; // console.log("center_adapt布局不需要resize");
},
populate: function (items) {
BI.TableAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut("bi.table_adapt", BI.TableAdaptLayout);/**
* 垂直方向居中容器
* @class BI.VerticalAdaptLayout
* @extends BI.Layout
*/
BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
props: {
baseCls: "bi-vertical-adapt-layout",
columnSize: [],
scrollx: false,
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
},
render: function () {
var self = this, o = this.options;
BI.VerticalAdaptLayout.superclass.render.apply(this, arguments);
return {
type: "bi.horizontal",
verticalAlign: BI.VerticalAlign.Middle,
horizontalAlign: BI.HorizontalAlign.Left,
columnSize: o.columnSize,
items: o.items,
scrollx: o.scrollx,
ref: function (_ref) {
self.layout = _ref;
},
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
};
}, },
resize: function () { resize: function () {
@ -19904,8 +19878,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
}, },
populate: function (items) { populate: function (items) {
BI.VerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.vertical_adapt", BI.VerticalAdaptLayout);/** BI.shortcut("bi.vertical_adapt", BI.VerticalAdaptLayout);/**
@ -20273,106 +20246,6 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
} }
}); });
BI.shortcut("bi.inline_vertical_adapt", BI.InlineVerticalAdaptLayout);/** BI.shortcut("bi.inline_vertical_adapt", BI.InlineVerticalAdaptLayout);/**
* 使用display:table和display:table-cell实现的horizontal布局
* @class BI.TableAdaptLayout
* @extends BI.Layout
*/
BI.TableAdaptLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.TableAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-table-center-adapt-layout",
columnSize: [],
verticalAlign: BI.VerticalAlign.Top,
horizontalAlign: BI.HorizontalAlign.Left,
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
});
},
render: function () {
var o = this.options;
BI.TableAdaptLayout.superclass.render.apply(this, arguments);
this.$table = BI.Widget._renderEngine.createElement("<div>").css({
position: "relative",
display: "table",
height: o.verticalAlign === BI.VerticalAlign.Middle ? "100%" : "auto",
width: o.horizontalAlign === BI.HorizontalAlign.Center ? "100%" : "auto",
"white-space": "nowrap"
});
this.populate(this.options.items);
},
_addElement: function (i, item) {
var o = this.options;
var td;
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",
width: width,
items: [w]
});
this.addWidget(this._getChildName(i), td);
} else {
td = this.getWidgetByName(this._getChildName(i));
td.element.width(width);
}
td.element.css({"max-width": o.columnSize[i] + "px"});
if (i === 0) {
td.element.addClass("first-element");
}
td.element.css({
position: "relative",
display: "table-cell",
"vertical-align": "middle",
margin: "0",
padding: "0",
height: "100%"
});
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.$table.append(frag);
this.element.append(this.$table);
},
resize: function () {
// console.log("center_adapt布局不需要resize");
},
populate: function (items) {
BI.TableAdaptLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut("bi.table_adapt", BI.TableAdaptLayout);/**
*自适应水平和垂直方向都居中容器 *自适应水平和垂直方向都居中容器
* Created by GUY on 2016/12/2. * Created by GUY on 2016/12/2.
* *

2
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

98
src/core/wrapper/layout/adapt/adapt.center.js

@ -8,6 +8,7 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
return BI.extend(BI.CenterAdaptLayout.superclass.props.apply(this, arguments), { return BI.extend(BI.CenterAdaptLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-center-adapt-layout", baseCls: "bi-center-adapt-layout",
columnSize: [], columnSize: [],
scrollx: false,
hgap: 0, hgap: 0,
vgap: 0, vgap: 0,
lgap: 0, lgap: 0,
@ -17,92 +18,33 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.CenterAdaptLayout.superclass.render.apply(this, arguments); BI.CenterAdaptLayout.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.Middle,
height: "100%", horizontalAlign: BI.HorizontalAlign.Center,
"white-space": "nowrap", columnSize: o.columnSize,
"border-spacing": "0px", scrollx: o.scrollx,
border: "none", items: o.items,
"border-collapse": "separate" ref: function (_ref) {
}); self.layout = _ref;
this.$tr = BI.Widget._renderEngine.createElement("<tr>"); },
this.$tr.appendTo(this.$table); hgap: o.hgap,
this.populate(this.options.items); vgap: o.vgap,
}, lgap: o.lgap,
rgap: o.rgap,
_addElement: function (i, item) { tgap: o.tgap,
var o = this.options; bgap: o.bgap
var td; };
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]});
if (i === 0) {
td.element.addClass("first-element");
}
td.element.css({
position: "relative",
height: "100%",
"vertical-align": "middle",
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("center_adapt布局不需要resize"); // console.log("center_adapt布局不需要resize");
}, },
_getWrapper: function () {
return this.$tr;
},
populate: function (items) { populate: function (items) {
BI.CenterAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.center_adapt", BI.CenterAdaptLayout); BI.shortcut("bi.center_adapt", BI.CenterAdaptLayout);

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

@ -21,8 +21,40 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.LeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.LeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); var layoutArray = [];
if ("left" in o.items) {
layoutArray.push({
type: "bi.left",
items: [{
el: {
type: "bi.vertical_adapt",
height: "100%",
items: o.items.left,
hgap: o.lhgap,
lgap: o.llgap,
rgap: o.lrgap
}
}]
});
}
if ("right" in o.items) {
layoutArray.push({
type: "bi.right",
items: [{
el: {
type: "bi.vertical_adapt",
height: "100%",
items: o.items.right,
hgap: o.rhgap,
lgap: o.rlgap,
rgap: o.rrgap
}
}]
});
}
return layoutArray;
}, },
resize: function () { resize: function () {
@ -34,40 +66,6 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
if ("left" in items) {
var left = BI.createWidget({
type: "bi.vertical_adapt",
items: items.left,
hgap: o.lhgap,
lgap: o.llgap,
rgap: o.lrgap
});
left.element.css("height", "100%");
BI.createWidget({
type: "bi.left",
element: this,
items: [left]
});
}
if ("right" in items) {
var right = BI.createWidget({
type: "bi.vertical_adapt",
items: items.right,
hgap: o.rhgap,
lgap: o.rlgap,
rgap: o.rrgap
});
right.element.css("height", "100%");
BI.createWidget({
type: "bi.right",
element: this,
items: [right]
});
}
},
populate: function (items) { populate: function (items) {
BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments); BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments);
this._mount(); this._mount();
@ -87,8 +85,22 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.LeftVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.LeftVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); return {
type: "bi.left",
ref: function (_ref) {
self.layout = _ref;
},
items: [{
type: "bi.vertical_adapt",
height: "100%",
items: o.items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
}]
};
}, },
resize: function () { resize: function () {
@ -100,26 +112,8 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
var left = BI.createWidget({
type: "bi.vertical_adapt",
items: items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
});
left.element.css("height", "100%");
BI.createWidget({
type: "bi.left",
element: this,
items: [left]
});
},
populate: function (items) { populate: function (items) {
BI.LeftVerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.left_vertical_adapt", BI.LeftVerticalAdaptLayout); BI.shortcut("bi.left_vertical_adapt", BI.LeftVerticalAdaptLayout);
@ -135,8 +129,22 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
}); });
}, },
render: function () { render: function () {
var o = this.options, self = this;
BI.RightVerticalAdaptLayout.superclass.render.apply(this, arguments); BI.RightVerticalAdaptLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); return {
type: "bi.right",
ref: function (_ref) {
self.layout = _ref;
},
items: [{
type: "bi.vertical_adapt",
height: "100%",
items: o.items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
}]
};
}, },
resize: function () { resize: function () {
@ -148,26 +156,8 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
throw new Error("cannot be added"); throw new Error("cannot be added");
}, },
stroke: function (items) {
var o = this.options;
var right = BI.createWidget({
type: "bi.vertical_adapt",
items: items,
lgap: o.lgap,
hgap: o.hgap,
rgap: o.rgap
});
right.element.css("height", "100%");
BI.createWidget({
type: "bi.right",
element: this,
items: [right]
});
},
populate: function (items) { populate: function (items) {
BI.RightVerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.right_vertical_adapt", BI.RightVerticalAdaptLayout); BI.shortcut("bi.right_vertical_adapt", BI.RightVerticalAdaptLayout);

101
src/core/wrapper/layout/adapt/adapt.vertical.js

@ -7,7 +7,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
props: { props: {
baseCls: "bi-vertical-adapt-layout", baseCls: "bi-vertical-adapt-layout",
columnSize: [], columnSize: [],
horizontalAlign: BI.HorizontalAlign.Left, scrollx: false,
hgap: 0, hgap: 0,
vgap: 0, vgap: 0,
lgap: 0, lgap: 0,
@ -15,85 +15,27 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
tgap: 0, tgap: 0,
bgap: 0 bgap: 0
}, },
render: function () { render: function () {
var self = this, o = this.options;
BI.VerticalAdaptLayout.superclass.render.apply(this, arguments); BI.VerticalAdaptLayout.superclass.render.apply(this, arguments);
var o = this.options; return {
this.$table = BI.Widget._renderEngine.createElement("<table>").attr({cellspacing: 0, cellpadding: 0}).css({ type: "bi.horizontal",
position: "relative", verticalAlign: BI.VerticalAlign.Middle,
width: o.horizontalAlign === BI.HorizontalAlign.Stretch ? "100%" : "auto", horizontalAlign: BI.HorizontalAlign.Left,
height: "100%", columnSize: o.columnSize,
"white-space": "nowrap", items: o.items,
"border-spacing": "0px", scrollx: o.scrollx,
border: "none", ref: function (_ref) {
"border-collapse": "separate" self.layout = _ref;
}); },
this.$tr = BI.Widget._renderEngine.createElement("<tr>"); hgap: o.hgap,
this.$tr.appendTo(this.$table); vgap: o.vgap,
this.populate(this.options.items); lgap: o.lgap,
}, rgap: o.rgap,
tgap: o.tgap,
_addElement: function (i, item) { bgap: o.bgap
var o = this.options; };
var td;
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);
}
if (i === 0) {
td.element.addClass("first-element");
}
td.element.css({
position: "relative",
height: "100%",
"vertical-align": "middle",
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);
},
_getWrapper: function () {
return this.$tr;
}, },
resize: function () { resize: function () {
@ -101,8 +43,7 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
}, },
populate: function (items) { populate: function (items) {
BI.VerticalAdaptLayout.superclass.populate.apply(this, arguments); this.layout.populate.apply(this, arguments);
this._mount();
} }
}); });
BI.shortcut("bi.vertical_adapt", BI.VerticalAdaptLayout); BI.shortcut("bi.vertical_adapt", BI.VerticalAdaptLayout);
Loading…
Cancel
Save