Browse Source

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

es6
Claire 3 years ago
parent
commit
b85bbc93b0
  1. 2
      package.json
  2. 2
      src/base/layer/layer.popover.js
  3. 4
      src/base/layer/layer.popup.js
  4. 11
      src/case/ztree/0.treeview.js
  5. 23
      src/core/platform/web/config.js
  6. 18
      src/core/wrapper/layout.js
  7. 38
      src/core/wrapper/layout/sticky/sticky.horizontal.js
  8. 38
      src/core/wrapper/layout/sticky/sticky.vertical.js

2
package.json

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

2
src/base/layer/layer.popover.js

@ -75,6 +75,8 @@ BI.Popover = BI.inherit(BI.Widget, {
title: o.header, title: o.header,
textAlign: "left" textAlign: "left"
}, },
top: 0,
bottom: 0,
left: BI.SIZE_CONSANTS.H_GAP_SIZE, left: BI.SIZE_CONSANTS.H_GAP_SIZE,
right: o.closable ? 0 : BI.SIZE_CONSANTS.H_GAP_SIZE right: o.closable ? 0 : BI.SIZE_CONSANTS.H_GAP_SIZE
}] }]

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) right: BI.clamp(((middle ? popupWidth : position.width) + adjustXOffset) / 2 - 6, minRight, maxRight)
}; };
wrapperStyle = { wrapperStyle = {
bottom: o.bgap + o.vgap, top: o.bgap + o.vgap,
left: "", left: "",
right: 0, right: 0,
top: "", bottom: "",
}; };
placeholderStyle = { placeholderStyle = {
left: 0, left: 0,

11
src/case/ztree/0.treeview.js

@ -357,15 +357,20 @@ BI.TreeView = BI.inherit(BI.Pane, {
if (BI.isNull(n.title)) { if (BI.isNull(n.title)) {
n.title = n.text; n.title = n.text;
} }
if (n.disabled) {
n.title = n.warningTitle || n.title;
}
var text = BI.createWidget(BI.extend({ var text = BI.createWidget(BI.extend({
type: "bi.text",
cls: "tree-node-text", cls: "tree-node-text",
css: { css: {
display: "inline" display: "inline"
}, },
whiteSpace: "nowrap", whiteSpace: "nowrap",
root: true root: true,
}, n)); keyword: o.paras.keyword
}, n, {
type: "bi.text"
}));
var fragment = BI.Widget._renderEngine.createElement("<div>"); var fragment = BI.Widget._renderEngine.createElement("<div>");
fragment.append(text.element[0]); fragment.append(text.element[0]);
n.text = fragment.html(); n.text = fragment.html();

23
src/core/platform/web/config.js

@ -12,6 +12,19 @@ BI.prepares.push(function () {
} }
return _isSupportFlex; 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) { BI.Plugin.configWidget("bi.horizontal", function (ob) {
var supportFlex = isSupportFlex(); var supportFlex = isSupportFlex();
// // 在横向自适应场景下我们需要使用table的自适应撑出滚动条的特性(flex处理不了这种情况) // // 在横向自适应场景下我们需要使用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) { BI.Plugin.configWidget("bi.left_right_vertical_adapt", function (ob) {
if (isSupportFlex()) { if (isSupportFlex()) {

18
src/core/wrapper/layout.js

@ -55,6 +55,20 @@ BI.Layout = BI.inherit(BI.Widget, {
if (this.options.right) { if (this.options.right) {
this.element.css("right", BI.isNumber(this.options.right) ? this.options.right / BI.pixRatio + BI.pixUnit : 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 () { _init4Scroll: function () {
@ -272,8 +286,8 @@ BI.Layout = BI.inherit(BI.Widget, {
"margin-top": "", "margin-top": "",
"margin-bottom": "", "margin-bottom": "",
"margin-left": "", "margin-left": "",
"margin-right": "", "margin-right": ""
}) });
}, },
_optimiseGap: function (gap) { _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