Browse Source

Merge branch 'master' of ssh://code.fineres.com:7999/~dailer/fineui

es6
dailer 3 years ago
parent
commit
e523049541
  1. 2
      package.json
  2. 4
      src/base/layer/layer.popup.js
  3. 23
      src/core/platform/web/config.js
  4. 18
      src/core/wrapper/layout.js
  5. 38
      src/core/wrapper/layout/sticky/sticky.horizontal.js
  6. 38
      src/core/wrapper/layout/sticky/sticky.vertical.js

2
package.json

@ -1,6 +1,6 @@
{
"name": "fineui",
"version": "2.0.20220217101535",
"version": "2.0.20220217230329",
"description": "fineui",
"main": "dist/fineui.min.js",
"types": "dist/lib/index.d.ts",

4
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,

23
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()) {

18
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) {

38
src/core/wrapper/layout/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);

38
src/core/wrapper/layout/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);
Loading…
Cancel
Save