Browse Source

KERNEL-13199 feat: sticky布局支持同时吸顶和吸底

es6
zsmj 2 years ago
parent
commit
94fc4e6e5d
  1. 22
      src/core/wrapper/layout/sticky/sticky.horizontal.js
  2. 22
      src/core/wrapper/layout/sticky/sticky.vertical.js

22
src/core/wrapper/layout/sticky/sticky.horizontal.js

@ -21,13 +21,29 @@ BI.HorizontalStickyLayout = BI.inherit(BI.FlexHorizontalLayout, {
} }
} }
if (columnSize !== "fill") { if (columnSize !== "fill") {
var firstItemFill = o.columnSize[0] === "fill" || o.items[0].width === "fill"; 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({ w.element.css({
position: "sticky", position: "sticky",
zIndex: 1, zIndex: 1,
left: firstItemFill ? "" : 0, right: 0
right: firstItemFill ? 0 : ""
}); });
}
} else { } else {
w.element.css({ w.element.css({
overflow: "" overflow: ""

22
src/core/wrapper/layout/sticky/sticky.vertical.js

@ -21,13 +21,29 @@ BI.VerticalStickyLayout = BI.inherit(BI.FlexVerticalLayout, {
} }
} }
if (rowSize !== "fill") { if (rowSize !== "fill") {
var firstItemFill = o.rowSize[0] === "fill" || o.items[0].height === "fill"; 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({ w.element.css({
position: "sticky", position: "sticky",
zIndex: 1, zIndex: 1,
top: firstItemFill ? "" : 0, bottom: 0
bottom: firstItemFill ? 0 : ""
}); });
}
} else { } else {
w.element.css({ w.element.css({
overflow: "" overflow: ""

Loading…
Cancel
Save