From 94fc4e6e5d8f7b9d2efa17a80fe68d32df0dd608 Mon Sep 17 00:00:00 2001 From: zsmj Date: Mon, 24 Oct 2022 11:36:55 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-13199=20feat:=20sticky=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=90=8C=E6=97=B6=E5=90=B8=E9=A1=B6=E5=92=8C?= =?UTF-8?q?=E5=90=B8=E5=BA=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/sticky/sticky.horizontal.js | 28 +++++++++++++++---- .../wrapper/layout/sticky/sticky.vertical.js | 28 +++++++++++++++---- 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/src/core/wrapper/layout/sticky/sticky.horizontal.js b/src/core/wrapper/layout/sticky/sticky.horizontal.js index a59dd6edf..afdf955aa 100644 --- a/src/core/wrapper/layout/sticky/sticky.horizontal.js +++ b/src/core/wrapper/layout/sticky/sticky.horizontal.js @@ -21,13 +21,29 @@ BI.HorizontalStickyLayout = BI.inherit(BI.FlexHorizontalLayout, { } } 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 : "" + var fillIndex; + BI.count(0, o.items.length - 1, index => { + if (BI.isNotNull(fillIndex)) { + return; + } + if ((o.columnSize[index] === "fill" || o.items[index].width === "fill")) { + fillIndex = index; + } }); + + if (fillIndex > i) { + w.element.css({ + position: "sticky", + zIndex: 1, + left: 0, + }); + } else { + w.element.css({ + position: "sticky", + zIndex: 1, + right: 0 + }); + } } else { w.element.css({ overflow: "" diff --git a/src/core/wrapper/layout/sticky/sticky.vertical.js b/src/core/wrapper/layout/sticky/sticky.vertical.js index 970d84eef..beb0e9d43 100644 --- a/src/core/wrapper/layout/sticky/sticky.vertical.js +++ b/src/core/wrapper/layout/sticky/sticky.vertical.js @@ -21,13 +21,29 @@ BI.VerticalStickyLayout = BI.inherit(BI.FlexVerticalLayout, { } } 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 : "" + var fillIndex; + BI.count(0, o.items.length - 1, index => { + if (BI.isNotNull(fillIndex)) { + return; + } + if ((o.rowSize[index] === "fill" || o.items[index].height === "fill")) { + fillIndex = index; + } }); + + if (fillIndex > i) { + w.element.css({ + position: "sticky", + zIndex: 1, + top: 0, + }); + } else { + w.element.css({ + position: "sticky", + zIndex: 1, + bottom: 0 + }); + } } else { w.element.css({ overflow: ""