From 1d585de8a87d5bd0cb5d051871c5b607e8ff7292 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 17 Feb 2022 16:45:59 +0800 Subject: [PATCH 01/11] =?UTF-8?q?feature:=20=E5=B8=83=E5=B1=80=E6=94=AF?= =?UTF-8?q?=E6=8C=81padding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/layout.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/core/wrapper/layout.js b/src/core/wrapper/layout.js index 92a836ddf..4c94198ff 100644 --- a/src/core/wrapper/layout.js +++ b/src/core/wrapper/layout.js @@ -55,6 +55,20 @@ BI.Layout = BI.inherit(BI.Widget, { if (this.options.right) { this.element.css("right", BI.isNumber(this.options.right) ? this.options.right / BI.pixRatio + BI.pixUnit : this.options.right); } + if (this.options.padding) { + if (this.options.padding.left) { + this.element.css("padding-left", BI.isNumber(this.options.padding.left) ? this.options.padding.left / BI.pixRatio + BI.pixUnit : this.options.padding.left); + } + if (this.options.padding.right) { + this.element.css("padding-right", BI.isNumber(this.options.padding.right) ? this.options.padding.right / BI.pixRatio + BI.pixUnit : this.options.padding.right); + } + if (this.options.padding.top) { + this.element.css("padding-top", BI.isNumber(this.options.padding.top) ? this.options.padding.top / BI.pixRatio + BI.pixUnit : this.options.padding.top); + } + if (this.options.padding.bottom) { + this.element.css("padding-bottom", BI.isNumber(this.options.padding.bottom) ? this.options.padding.bottom / BI.pixRatio + BI.pixUnit : this.options.padding.bottom); + } + } }, _init4Scroll: function () { @@ -272,8 +286,8 @@ BI.Layout = BI.inherit(BI.Widget, { "margin-top": "", "margin-bottom": "", "margin-left": "", - "margin-right": "", - }) + "margin-right": "" + }); }, _optimiseGap: function (gap) { From d9b3e5fd638e43f1170969825c572dc7c253439a Mon Sep 17 00:00:00 2001 From: data Date: Thu, 17 Feb 2022 17:03:54 +0800 Subject: [PATCH 02/11] auto upgrade version to 2.0.20220217170345 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0b2d61ff9..d859c3d5e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220217101535", + "version": "2.0.20220217170345", "description": "fineui", "main": "dist/fineui.min.js", "types": "dist/lib/index.d.ts", From 8e0447be78b2ac44132a7ef7164f6229fbdcfdeb Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 17 Feb 2022 17:10:27 +0800 Subject: [PATCH 03/11] =?UTF-8?q?bugfix:=20=E5=B0=8F=E4=B8=89=E8=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/layer/layer.popup.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base/layer/layer.popup.js b/src/base/layer/layer.popup.js index 509f011c9..549558d67 100644 --- a/src/base/layer/layer.popup.js +++ b/src/base/layer/layer.popup.js @@ -233,10 +233,10 @@ BI.PopupView = BI.inherit(BI.Widget, { right: BI.clamp(((middle ? popupWidth : position.width) + adjustXOffset) / 2 - 6, minRight, maxRight) }; wrapperStyle = { - bottom: o.bgap + o.vgap, + top: o.bgap + o.vgap, left: "", right: 0, - top: "", + bottom: "", }; placeholderStyle = { left: 0, From 04fe6cfd53a9b2774db044dea86b4080fd7cbc66 Mon Sep 17 00:00:00 2001 From: data Date: Thu, 17 Feb 2022 17:23:01 +0800 Subject: [PATCH 04/11] auto upgrade version to 2.0.20220217172251 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d859c3d5e..f49d226ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220217170345", + "version": "2.0.20220217172251", "description": "fineui", "main": "dist/fineui.min.js", "types": "dist/lib/index.d.ts", From b13fd63687e5618648c8a4af5447ec744c3aae23 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 17 Feb 2022 19:45:52 +0800 Subject: [PATCH 05/11] =?UTF-8?q?feature:=20sticky=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/sticky/sticky.horizontal.js | 38 ++++++++++++++++++++ src/core/wrapper/sticky/sticky.vertical.js | 38 ++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 src/core/wrapper/sticky/sticky.horizontal.js create mode 100644 src/core/wrapper/sticky/sticky.vertical.js diff --git a/src/core/wrapper/sticky/sticky.horizontal.js b/src/core/wrapper/sticky/sticky.horizontal.js new file mode 100644 index 000000000..f178afd6b --- /dev/null +++ b/src/core/wrapper/sticky/sticky.horizontal.js @@ -0,0 +1,38 @@ +/** + * 横向黏性布局 + */ +BI.HorizontalStickyLayout = BI.inherit(BI.FlexHorizontalLayout, { + props: function () { + return BI.extend(BI.HorizontalStickyLayout.superclass.props.apply(this, arguments), { + extraCls: "bi-h-sticky", + horizontalAlign: BI.HorizontalAlign.Stretch, + verticalAlign: BI.VerticalAlign.Stretch + }); + }, + + _addElement: function (i, item) { + var o = this.options; + var w = BI.HorizontalStickyLayout.superclass._addElement.apply(this, arguments); + var columnSize = o.columnSize.length > 0 ? o.columnSize[i] : item.width >= 1 ? null : item.width; + if (o.columnSize.length > 0) { + if (item.width >= 1 && o.columnSize[i] >= 1 && o.columnSize[i] !== item.width) { + columnSize = null; + } + } + if (columnSize !== "fill") { + var firstItemFill = o.columnSize[0] === "fill" || o.items[0].width === "fill"; + w.element.css({ + position: "sticky", + zIndex: 1, + left: firstItemFill ? "" : 0, + right: firstItemFill ? 0 : "" + }); + } else { + w.element.css({ + overflow: "" + }); + } + return w; + } +}); +BI.shortcut("bi.horizontal_sticky", BI.HorizontalStickyLayout); diff --git a/src/core/wrapper/sticky/sticky.vertical.js b/src/core/wrapper/sticky/sticky.vertical.js new file mode 100644 index 000000000..d99b8828e --- /dev/null +++ b/src/core/wrapper/sticky/sticky.vertical.js @@ -0,0 +1,38 @@ +/** + * 纵向黏性布局 + */ +BI.VerticalStickyLayout = BI.inherit(BI.FlexVerticalLayout, { + props: function () { + return BI.extend(BI.VerticalStickyLayout.superclass.props.apply(this, arguments), { + extraCls: "bi-v-sticky", + horizontalAlign: BI.HorizontalAlign.Stretch, + verticalAlign: BI.VerticalAlign.Stretch + }); + }, + + _addElement: function (i, item) { + var o = this.options; + var w = BI.VerticalStickyLayout.superclass._addElement.apply(this, arguments); + var rowSize = o.rowSize.length > 0 ? o.rowSize[i] : item.height >= 1 ? null : item.height; + if (o.rowSize.length > 0) { + if (item.height >= 1 && o.rowSize[i] >= 1 && o.rowSize[i] !== item.height) { + rowSize = null; + } + } + if (rowSize !== "fill") { + var firstItemFill = o.rowSize[0] === "fill" || o.items[0].height === "fill"; + w.element.css({ + position: "sticky", + zIndex: 1, + top: firstItemFill ? "" : 0, + bottom: firstItemFill ? 0 : "" + }); + } else { + w.element.css({ + overflow: "" + }); + } + return w; + } +}); +BI.shortcut("bi.vertical_sticky", BI.VerticalStickyLayout); From 41b19904dd7b5fe6d1aa1eac8bf1ab90e26791f9 Mon Sep 17 00:00:00 2001 From: data Date: Thu, 17 Feb 2022 20:03:41 +0800 Subject: [PATCH 06/11] auto upgrade version to 2.0.20220217200332 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f49d226ce..3e4ce5900 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220217172251", + "version": "2.0.20220217200332", "description": "fineui", "main": "dist/fineui.min.js", "types": "dist/lib/index.d.ts", From ba97797248b20c410b53a4205fb327bbe1952b2b Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 17 Feb 2022 20:08:40 +0800 Subject: [PATCH 07/11] =?UTF-8?q?feature:=20sticky=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/wrapper/{ => layout}/sticky/sticky.horizontal.js | 0 src/core/wrapper/{ => layout}/sticky/sticky.vertical.js | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/core/wrapper/{ => layout}/sticky/sticky.horizontal.js (100%) rename src/core/wrapper/{ => layout}/sticky/sticky.vertical.js (100%) diff --git a/src/core/wrapper/sticky/sticky.horizontal.js b/src/core/wrapper/layout/sticky/sticky.horizontal.js similarity index 100% rename from src/core/wrapper/sticky/sticky.horizontal.js rename to src/core/wrapper/layout/sticky/sticky.horizontal.js diff --git a/src/core/wrapper/sticky/sticky.vertical.js b/src/core/wrapper/layout/sticky/sticky.vertical.js similarity index 100% rename from src/core/wrapper/sticky/sticky.vertical.js rename to src/core/wrapper/layout/sticky/sticky.vertical.js From 8fab7e065b9ae7ad7f2c574cb5f7bc700b5be9d6 Mon Sep 17 00:00:00 2001 From: data Date: Thu, 17 Feb 2022 20:22:33 +0800 Subject: [PATCH 08/11] auto upgrade version to 2.0.20220217202228 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3e4ce5900..3a8c317dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220217200332", + "version": "2.0.20220217202228", "description": "fineui", "main": "dist/fineui.min.js", "types": "dist/lib/index.d.ts", From 715181e8d30cfe29e1e665281d5db9c41e87ec4a Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 17 Feb 2022 22:45:08 +0800 Subject: [PATCH 09/11] =?UTF-8?q?feature:=20sticky=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/platform/web/config.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index 2aedd70c0..5770bcb3b 100644 --- a/src/core/platform/web/config.js +++ b/src/core/platform/web/config.js @@ -12,6 +12,19 @@ BI.prepares.push(function () { } return _isSupportFlex; }; + // 判断浏览器是否支持sticky 属性 + var isSupportSticky = (function () { + var vendorList = ["", "-webkit-", "-ms-", "-moz-", "-o-"], + vendorListLength = vendorList.length, + stickyElement = document.createElement("div"); + for (var i = 0; i < vendorListLength; i++) { + stickyElement.style.position = vendorList[i] + "sticky"; + if (stickyElement.style.position !== "") { + return true; + } + } + return false; + })(); BI.Plugin.configWidget("bi.horizontal", function (ob) { var supportFlex = isSupportFlex(); // // 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况) @@ -150,6 +163,16 @@ BI.prepares.push(function () { }) }); }); + BI.Plugin.configWidget("bi.horizontal_sticky", function (ob) { + if (isSupportSticky) { + return BI.extend({}, ob, {type: "bi.horizontal_fill"}); + } + }); + BI.Plugin.configWidget("bi.vertical_sticky", function (ob) { + if (isSupportSticky) { + return BI.extend({}, ob, {type: "bi.vertical_fill"}); + } + }); BI.Plugin.configWidget("bi.left_right_vertical_adapt", function (ob) { if (isSupportFlex()) { From 760e7c0bc9a05d118a4fc56c20c5638e5db82529 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 17 Feb 2022 22:46:26 +0800 Subject: [PATCH 10/11] =?UTF-8?q?feature:=20sticky=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/platform/web/config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/platform/web/config.js b/src/core/platform/web/config.js index 5770bcb3b..f54b1a3b3 100644 --- a/src/core/platform/web/config.js +++ b/src/core/platform/web/config.js @@ -164,12 +164,12 @@ BI.prepares.push(function () { }); }); BI.Plugin.configWidget("bi.horizontal_sticky", function (ob) { - if (isSupportSticky) { + if (!isSupportSticky) { return BI.extend({}, ob, {type: "bi.horizontal_fill"}); } }); BI.Plugin.configWidget("bi.vertical_sticky", function (ob) { - if (isSupportSticky) { + if (!isSupportSticky) { return BI.extend({}, ob, {type: "bi.vertical_fill"}); } }); From d76c5416238a6ea1a3e5575ddab20197b3004bb7 Mon Sep 17 00:00:00 2001 From: data Date: Thu, 17 Feb 2022 23:03:39 +0800 Subject: [PATCH 11/11] auto upgrade version to 2.0.20220217230329 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3a8c317dd..a727f140b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20220217202228", + "version": "2.0.20220217230329", "description": "fineui", "main": "dist/fineui.min.js", "types": "dist/lib/index.d.ts",