Browse Source

Pull request #2063: wuJIRA任务 横向填充布局的降级方案

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

* commit 'effd2da9d1d603a53f37ba2f76fa9e6995aed00a':
  横向填充布局的降级方案
es6
guy 3 years ago
parent
commit
52a4a3bfd3
  1. 2
      src/core/platform/web/config.js
  2. 0
      src/core/wrapper/layout/fill/fill.vertical.js
  3. 78
      src/core/wrapper/layout/fill/float.fill.horizontal.js
  4. 3
      src/core/wrapper/layout/layout.inline.js
  5. 5
      src/less/core/wrapper/fill.horizontal.less

2
src/core/platform/web/config.js

@ -98,7 +98,7 @@ BI.prepares.push(function () {
scrollx: false
}, ob, {type: "bi.flex_horizontal"});
}
return BI.extend({}, ob, {type: "bi.htape"});
return BI.extend({}, ob, {type: "bi.horizontal_float_fill"});
});
BI.Plugin.configWidget("bi.vertical_fill", function (ob) {
if (isSupportFlex()) {

0
src/core/wrapper/layout/fill/vertical.fill.js → src/core/wrapper/layout/fill/fill.vertical.js

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

@ -0,0 +1,78 @@
BI.FloatHorizontalFillLayout = BI.inherit(BI.Layout, {
props: function () {
return BI.extend(BI.FloatHorizontalFillLayout.superclass.props.apply(this, arguments), {
baseCls: "bi-h-float-fill",
verticalAlign: BI.VerticalAlign.Top,
hgap: 0,
vgap: 0,
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0,
columnSize: [],
items: []
});
},
render: function () {
BI.FloatHorizontalFillLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items);
},
resize: function () {
// console.log("填充布局不需要resize");
},
addItem: function (item) {
// do nothing
throw new Error("不能添加子组件");
},
stroke: function (items) {
var self = this, o = this.options;
items = BI.compact(items);
var rank = 0;
BI.any(items, function (i, item) {
if (BI.isEmptyObject(item)) {
return true;
}
var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width;
if (columnSize === "fill") {
return true;
}
var w = BI._lazyCreateWidget(item);
self.addWidget(self._getChildName(rank++), w);
w.element.addClass("h-float-fill-item");
w.element.css({
float: "left"
});
});
BI.backAny(items, function (i, item) {
if (BI.isEmptyObject(item)) {
return true;
}
var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width;
if (columnSize === "fill") {
return true;
}
var w = BI._lazyCreateWidget(item);
self.addWidget(self._getChildName(rank++), w);
w.element.addClass("h-float-fill-item");
w.element.css({
float: "right"
});
});
BI.each(items, function (i, item) {
var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width;
if (columnSize === "fill") {
var w = BI._lazyCreateWidget(item);
self.addWidget(self._getChildName(rank++), w);
w.element.addClass("h-float-fill-item");
}
});
},
populate: function (items) {
BI.FloatHorizontalFillLayout.superclass.populate.apply(this, arguments);
this._mount();
}
});
BI.shortcut("bi.horizontal_float_fill", BI.FloatHorizontalFillLayout);

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

@ -20,7 +20,8 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
lgap: 0,
rgap: 0,
tgap: 0,
bgap: 0
bgap: 0,
items: []
});
},

5
src/less/core/wrapper/fill.horizontal.less

@ -0,0 +1,5 @@
.bi-h-float-fill {
.h-float-fill-item {
height: 100%;
}
}
Loading…
Cancel
Save