Browse Source

整理代码

es6
guy 3 years ago
parent
commit
23fdfc7ce2
  1. 4
      src/core/wrapper/layout/adapt/absolute.horizontal.js
  2. 4
      src/core/wrapper/layout/adapt/absolute.leftrightvertical.js
  3. 4
      src/core/wrapper/layout/adapt/absolute.vertical.js
  4. 4
      src/core/wrapper/layout/adapt/adapt.center.js
  5. 4
      src/core/wrapper/layout/adapt/adapt.leftrightvertical.js
  6. 4
      src/core/wrapper/layout/adapt/adapt.vertical.js
  7. 4
      src/core/wrapper/layout/adapt/inline.center.js
  8. 4
      src/core/wrapper/layout/adapt/inline.horizontal.js
  9. 4
      src/core/wrapper/layout/adapt/inline.vertical.js
  10. 4
      src/core/wrapper/layout/flex/flex.center.js
  11. 4
      src/core/wrapper/layout/flex/flex.horizontal.center.js
  12. 17
      src/core/wrapper/layout/flex/flex.leftrightvertical.center.js
  13. 4
      src/core/wrapper/layout/flex/flex.vertical.center.js
  14. 4
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.center.js
  15. 4
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.center.js
  16. 4
      src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.center.js
  17. 4
      src/core/wrapper/layout/float/float.absolute.horizontal.js
  18. 21
      src/core/wrapper/layout/float/float.absolute.leftrightvertical.js
  19. 4
      src/core/wrapper/layout/float/float.absolute.vertical.js
  20. 1
      src/core/wrapper/layout/layout.grid.js
  21. 4
      src/core/wrapper/layout/middle/middle.center.js
  22. 4
      src/core/wrapper/layout/middle/middle.float.center.js
  23. 4
      src/core/wrapper/layout/middle/middle.horizontal.js
  24. 4
      src/core/wrapper/layout/middle/middle.vertical.js

4
src/core/wrapper/layout/adapt/absolute.horizontal.js

@ -45,10 +45,6 @@ BI.AbsoluteHorizontalLayout = BI.inherit(BI.Layout, {
this.layout.resize();
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate.apply(this, arguments);
}

4
src/core/wrapper/layout/adapt/absolute.leftrightvertical.js

@ -135,10 +135,6 @@ BI.AbsoluteRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
this.layout.stroke([{}].concat(this.options.items))
},
update: function (opt) {
return this.layout.update(opt);
},
addItem: function () {
// do nothing
throw new Error("不能添加子组件");

4
src/core/wrapper/layout/adapt/absolute.vertical.js

@ -45,10 +45,6 @@ BI.AbsoluteVerticalLayout = BI.inherit(BI.Layout, {
this.layout.resize();
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate.apply(this, arguments);
}

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

@ -46,10 +46,6 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, {
this.layout.resize();
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate.apply(this, arguments);
}

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

@ -199,10 +199,6 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, {
this.layout.resize();
},
update: function (opt) {
return this.layout.update(opt);
},
addItem: function () {
// do nothing
throw new Error("不能添加子组件");

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

@ -46,10 +46,6 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, {
this.layout.resize();
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate.apply(this, arguments);
}

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

@ -48,10 +48,6 @@ BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, {
this.layout.resize();
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate.apply(this.layout, arguments);
}

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

@ -48,10 +48,6 @@ BI.InlineHorizontalAdaptLayout = BI.inherit(BI.Layout, {
this.layout.resize();
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate.apply(this.layout, arguments);
}

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

@ -48,10 +48,6 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, {
this.layout.resize();
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate.apply(this.layout, arguments);
}

4
src/core/wrapper/layout/flex/flex.center.js

@ -45,10 +45,6 @@ BI.FlexCenterLayout = BI.inherit(BI.Layout, {
this.layout.resize();
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate(items);
}

4
src/core/wrapper/layout/flex/flex.horizontal.center.js

@ -46,10 +46,6 @@ BI.FlexHorizontalCenter = BI.inherit(BI.Layout, {
this.layout.resize();
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate(items);
}

17
src/core/wrapper/layout/flex/flex.leftrightvertical.center.js

@ -25,17 +25,17 @@ BI.FlexLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
ref: function (_ref) {
self.layout = _ref;
},
items: this._formatItems(),
items: this._formatItems(o.items),
scrollx: o.scrollx,
scrolly: o.scrolly,
scrollable: o.scrollable
};
},
_formatItems: function () {
_formatItems: function (items) {
var o = this.options;
var leftItems = o.items.left || [];
var rightItems = o.items.right || [];
var leftItems = items.left || [];
var rightItems = items.right || [];
leftItems = BI.map(leftItems, function (i, item) {
var json = {
el: BI.stripEL(item)
@ -72,11 +72,7 @@ BI.FlexLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
resize: function () {
this.layout.stroke(this._formatItems());
},
update: function (opt) {
return this.layout.update(opt);
this.layout.stroke(this._formatItems(this.options.items));
},
addItem: function () {
@ -85,8 +81,7 @@ BI.FlexLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
populate: function (items) {
this.options.items = items;
this.layout.populate(this._formatItems());
this.layout.populate(this._formatItems(items));
}
});
BI.shortcut("bi.flex_left_right_vertical_adapt", BI.FlexLeftRightVerticalAdaptLayout);

4
src/core/wrapper/layout/flex/flex.vertical.center.js

@ -47,10 +47,6 @@ BI.FlexVerticalCenter = BI.inherit(BI.Layout, {
this.layout.resize();
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate(items);
}

4
src/core/wrapper/layout/flex/wrapper/flex.wrapper.center.js

@ -48,10 +48,6 @@ BI.FlexWrapperCenterLayout = BI.inherit(BI.Layout, {
this.layout.resize();
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate(items);
}

4
src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.center.js

@ -48,10 +48,6 @@ BI.FlexWrapperHorizontalCenter = BI.inherit(BI.Layout, {
this.layout.resize();
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate(items);
}

4
src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.center.js

@ -48,10 +48,6 @@ BI.FlexWrapperVerticalCenter = BI.inherit(BI.Layout, {
this.layout.resize();
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate(items);
}

4
src/core/wrapper/layout/float/float.absolute.horizontal.js

@ -60,10 +60,6 @@ BI.FloatAbsoluteHorizontalLayout = BI.inherit(BI.Layout, {
this.layout.stroke(this._formatItems(this.options.items));
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate(this._formatItems(items));
}

21
src/core/wrapper/layout/float/float.absolute.leftrightvertical.js

@ -27,7 +27,7 @@ BI.FloatAbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
self.layout = _ref;
},
verticalAlign: o.verticalAlign,
items: this._formatItems(),
items: this._formatItems(o.items),
vgap: "50%",
scrollx: o.scrollx,
scrolly: o.scrolly,
@ -35,10 +35,10 @@ BI.FloatAbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
};
},
_formatItems: function () {
_formatItems: function (items) {
var o = this.options;
var leftItems = o.items.left || [];
var rightItems = o.items.right || [];
var leftItems = items.left || [];
var rightItems = items.right || [];
leftItems = BI.map(leftItems, function (i, item) {
var el = BI.stripEL(item);
if (o.verticalAlign === BI.VerticalAlign.Middle) {
@ -97,11 +97,7 @@ BI.FloatAbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
resize: function () {
this.layout.stroke(this._formatItems());
},
update: function (opt) {
return this.layout.update(opt);
this.layout.stroke(this._formatItems(this.options.items));
},
addItem: function () {
@ -110,8 +106,7 @@ BI.FloatAbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
},
populate: function (items) {
this.options.items = items;
this.layout.populate(this._formatItems());
this.layout.populate(this._formatItems(items));
}
});
BI.shortcut("bi.absolute_left_right_vertical_float", BI.FloatAbsoluteLeftRightVerticalAdaptLayout);
@ -169,10 +164,6 @@ BI.FloatAbsoluteRightVerticalAdaptLayout = BI.inherit(BI.Layout, {
this.layout.stroke([{}].concat(this._formatItems(this.options.items)));
},
update: function (opt) {
return this.layout.update(opt);
},
addItem: function () {
// do nothing
throw new Error("不能添加子组件");

4
src/core/wrapper/layout/float/float.absolute.vertical.js

@ -60,10 +60,6 @@ BI.FloatAbsoluteVerticalLayout = BI.inherit(BI.Layout, {
this.layout.stroke(this._formatItems(this.options.items));
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate(this._formatItems(items));
}

1
src/core/wrapper/layout/layout.grid.js

@ -19,6 +19,7 @@ BI.GridLayout = BI.inherit(BI.Layout, {
},
addItem: function () {
// do nothing
throw new Error("不能添加子组件");
},

4
src/core/wrapper/layout/middle/middle.center.js

@ -65,10 +65,6 @@ BI.CenterLayout = BI.inherit(BI.Layout, {
throw new Error("不能添加子组件");
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate.apply(this.layout, arguments);
}

4
src/core/wrapper/layout/middle/middle.float.center.js

@ -64,10 +64,6 @@ BI.FloatCenterLayout = BI.inherit(BI.Layout, {
throw new Error("不能添加子组件");
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate.apply(this.layout, arguments);
}

4
src/core/wrapper/layout/middle/middle.horizontal.js

@ -63,10 +63,6 @@ BI.HorizontalCenterLayout = BI.inherit(BI.Layout, {
throw new Error("不能添加子组件");
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate.apply(this.layout, arguments);
}

4
src/core/wrapper/layout/middle/middle.vertical.js

@ -64,10 +64,6 @@ BI.VerticalCenterLayout = BI.inherit(BI.Layout, {
throw new Error("不能添加子组件");
},
update: function (opt) {
return this.layout.update(opt);
},
populate: function (items) {
this.layout.populate.apply(this.layout, arguments);
}

Loading…
Cancel
Save