From 9e6b75ed4a6c7a6ec16066da899921e95a991aa3 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 27 Aug 2021 11:02:01 +0800 Subject: [PATCH 1/2] update --- src/core/platform/web/config.js | 14 +--- .../wrapper/layout/float/float.horizontal.js | 72 ++++++++++++++++++- 2 files changed, 71 insertions(+), 15 deletions(-) diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index c7b45fb00..ccfd4fe8a 100644 --- a/src/core/platform/web/config.js +++ b/src/core/platform/web/config.js @@ -113,19 +113,7 @@ BI.prepares.push(function () { if (ob.items && ob.items.length <= 1) { return BI.extend({}, ob, {type: "bi.inline_horizontal_adapt"}); } - return BI.extend({}, ob, { - type: "bi.inline_horizontal_adapt", - vgap: 0, - tgap: 0, - bgap: 0, - items: [{ - type: "bi.vertical", - vgap: ob.vgap, - tgap: ob.tgap, - bgap: ob.bgap, - items: ob.items - }] - }); + return ob; }); BI.Plugin.configWidget("bi.horizontal_fill", function (ob) { diff --git a/src/core/wrapper/layout/float/float.horizontal.js b/src/core/wrapper/layout/float/float.horizontal.js index 5121080d7..c70dbf60f 100644 --- a/src/core/wrapper/layout/float/float.horizontal.js +++ b/src/core/wrapper/layout/float/float.horizontal.js @@ -1,6 +1,74 @@ /** * 浮动的水平居中布局 */ -BI.FloatHorizontalLayout = function () { -}; +BI.FloatHorizontalLayout = BI.inherit(BI.Layout, { + + props: function () { + return BI.extend(BI.InlineHorizontalAdaptLayout.superclass.props.apply(this, arguments), { + baseCls: "bi-h-fl", + horizontalAlign: BI.HorizontalAlign.Center, + verticalAlign: BI.VerticalAlign.Top, + rowSize: [], + hgap: 0, + vgap: 0, + lgap: 0, + rgap: 0, + tgap: 0, + bgap: 0 + }); + }, + + render: function () { + var self = this, o = this.options; + if (o.verticalAlign === BI.VerticalAlign.Top){ + return { + type: "bi.vertical", + ref: function (_ref) { + self.layout = _ref; + }, + items: this._formatItems(o.items), + vgap: o.vgap, + tgap: o.tgap, + bgap: o.bgap + }; + } + return { + type: "bi.inline", + items: [{ + type: "bi.vertical", + ref: function (_ref) { + self.layout = _ref; + }, + items: this._formatItems(o.items), + vgap: o.vgap, + tgap: o.tgap, + bgap: o.bgap + }], + horizontalAlign: o.horizontalAlign, + verticalAlign: o.verticalAlign + }; + }, + + _formatItems: function (items) { + var o = this.options; + return BI.map(items, function (i, item) { + return { + type: "bi.inline_horizontal_adapt", + horizontalAlign: o.horizontalAlign, + items: [item], + hgap: o.hgap, + lgap: o.lgap, + rgap: o.rgap + } + }); + }, + + resize: function () { + this.layout.stroke(this._formatItems(this.options.items)); + }, + + populate: function (items) { + this.layout.populate(this._formatItems(items)); + } +}); BI.shortcut("bi.horizontal_float", BI.FloatHorizontalLayout); From 5461ce76baabf1a42813d3757d59aa12dae36c33 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 27 Aug 2021 11:39:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wrapper/layout/float/float.horizontal.js | 136 ++++++++++-------- 1 file changed, 73 insertions(+), 63 deletions(-) diff --git a/src/core/wrapper/layout/float/float.horizontal.js b/src/core/wrapper/layout/float/float.horizontal.js index c70dbf60f..110b4494f 100644 --- a/src/core/wrapper/layout/float/float.horizontal.js +++ b/src/core/wrapper/layout/float/float.horizontal.js @@ -3,72 +3,82 @@ */ BI.FloatHorizontalLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.InlineHorizontalAdaptLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-h-fl", - horizontalAlign: BI.HorizontalAlign.Center, - verticalAlign: BI.VerticalAlign.Top, - rowSize: [], - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, + props: function () { + return BI.extend(BI.InlineHorizontalAdaptLayout.superclass.props.apply(this, arguments), { + baseCls: "bi-h-fl", + horizontalAlign: BI.HorizontalAlign.Center, + verticalAlign: BI.VerticalAlign.Top, + rowSize: [], + hgap: 0, + vgap: 0, + lgap: 0, + rgap: 0, + tgap: 0, + bgap: 0 + }); + }, - render: function () { - var self = this, o = this.options; - if (o.verticalAlign === BI.VerticalAlign.Top){ - return { - type: "bi.vertical", - ref: function (_ref) { - self.layout = _ref; - }, - items: this._formatItems(o.items), - vgap: o.vgap, - tgap: o.tgap, - bgap: o.bgap - }; - } - return { - type: "bi.inline", - items: [{ - type: "bi.vertical", - ref: function (_ref) { - self.layout = _ref; - }, - items: this._formatItems(o.items), - vgap: o.vgap, - tgap: o.tgap, - bgap: o.bgap - }], - horizontalAlign: o.horizontalAlign, - verticalAlign: o.verticalAlign - }; - }, + render: function () { + var self = this, o = this.options; + if (o.verticalAlign === BI.VerticalAlign.Top) { + return { + type: "bi.vertical", + ref: function (_ref) { + self.layout = _ref; + }, + items: this._formatItems(o.items), + vgap: o.vgap, + tgap: o.tgap, + bgap: o.bgap, + scrollx: o.scrollx, + scrolly: o.scrolly, + scrollable: o.scrollable + }; + } + return { + type: "bi.inline", + items: [{ + el: { + type: "bi.vertical", + ref: function (_ref) { + self.layout = _ref; + }, + items: this._formatItems(o.items), + vgap: o.vgap, + tgap: o.tgap, + bgap: o.bgap + } + }], + horizontalAlign: o.horizontalAlign, + verticalAlign: o.verticalAlign, + scrollx: o.scrollx, + scrolly: o.scrolly, + scrollable: o.scrollable + }; + }, - _formatItems: function (items) { - var o = this.options; - return BI.map(items, function (i, item) { - return { - type: "bi.inline_horizontal_adapt", - horizontalAlign: o.horizontalAlign, - items: [item], - hgap: o.hgap, - lgap: o.lgap, - rgap: o.rgap - } - }); - }, + _formatItems: function (items) { + var o = this.options; + return BI.map(items, function (i, item) { + return { + el: { + type: "bi.inline_horizontal_adapt", + horizontalAlign: o.horizontalAlign, + items: [item], + hgap: o.hgap, + lgap: o.lgap, + rgap: o.rgap + } + }; + }); + }, - resize: function () { - this.layout.stroke(this._formatItems(this.options.items)); - }, + resize: function () { + this.layout.stroke(this._formatItems(this.options.items)); + }, - populate: function (items) { - this.layout.populate(this._formatItems(items)); - } + populate: function (items) { + this.layout.populate(this._formatItems(items)); + } }); BI.shortcut("bi.horizontal_float", BI.FloatHorizontalLayout);