Browse Source

Merge pull request #206016 in DEC/fineui from final/11.0 to persist/11.0

* commit '4422255f1af59a86f118fbb2d3a0e16568f4f2a1': (186 commits)
  REPORT-84106 fix: sticky bug
  REPORT-84106 fix: sticky bug
  REPORT-83708 同步release修改
  无JIRA fix: 图标写反了
  BI-115904 fix: 【来源内测BUG】展开下拉树子节点,会出现重复数据 同步
  Pull request #3195: KERNEL-13158: context跳过popup
  REPORT-83685 fix: BI.parseDateTime方法对%l:%M:%S %p这种格式的日期解析出错(后面带%p 这种的都是同类型的报错)
  REPORT-83685 fix: BI.parseDateTime方法对%l:%M:%S %p这种格式的日期解析出错(后面带%p 这种的都是同类型的报错)
  BI-115750 组件左侧维度栏,一滚动,就会白屏
  auto upgrade version to 2.0.20221101100519
  auto upgrade version to 2.0.20221031221611
  REPORT-82014 fix:补齐AFTER_HIDEVIEW事件
  auto upgrade version to 2.0.20221031190602
  auto upgrade version to 2.0.20221031135635
  BI-115201 fix: 【6.0.3.3】下拉树下拉后不选择任何内容,前端多发一个data请求
  BI-115201 fix: 【6.0.3.3】下拉树下拉后不选择任何内容,前端多发一个data请求
  auto upgrade version to 2.0.20221031101438
  auto upgrade version to 2.0.20221031095439
  bugfix
  auto upgrade version to 2.0.20221028191610
  ...
research/test
superman 2 years ago
parent
commit
de89b1e1d6
  1. 67
      _mobile/date.i18n.cn.js
  2. 4
      demo/js/config/widget.js
  3. 12
      demo/js/widget/multitree/demo.multi_tree_combo.js
  4. 2
      demo/less/face.less
  5. 11
      demo/less/main.less
  6. 2
      demo/less/north.less
  7. 4
      dist/fix/fix.compact.js
  8. 99
      examples/ThemeProvider.html
  9. 59
      examples/useContext.html
  10. 12
      examples/响应式布局.html
  11. 2
      package.json
  12. 3
      plugins/webpack-fui-worker-plugin/worker-loader.js
  13. 55
      src/base/collection/collection.js
  14. 11
      src/base/combination/group.button.js
  15. 16
      src/base/combination/navigation.js
  16. 15
      src/base/combination/tab.js
  17. 20
      src/base/context.js
  18. 57
      src/base/grid/grid.js
  19. 16
      src/base/layer/layer.popup.js
  20. 8
      src/base/list/listview.js
  21. 14
      src/base/list/virtualgrouplist.js
  22. 17
      src/base/list/virtuallist.js
  23. 19
      src/base/single/0.single.js
  24. 14
      src/base/single/1.text.js
  25. 31
      src/base/single/button/button.basic.js
  26. 2
      src/base/single/button/buttons/button.icon.js
  27. 18
      src/base/single/button/buttons/button.js
  28. 1
      src/base/single/button/buttons/button.text.js
  29. 1
      src/base/single/button/listitem/blankiconicontextitem.js
  30. 1
      src/base/single/button/listitem/blankicontexticonitem.js
  31. 1
      src/base/single/button/listitem/blankicontextitem.js
  32. 1
      src/base/single/button/listitem/icontexticonitem.js
  33. 1
      src/base/single/button/listitem/icontextitem.js
  34. 1
      src/base/single/button/listitem/texticonitem.js
  35. 1
      src/base/single/button/listitem/textitem.js
  36. 1
      src/base/single/button/node/icontexticonnode.js
  37. 1
      src/base/single/button/node/icontextnode.js
  38. 1
      src/base/single/button/node/texticonnode.js
  39. 1
      src/base/single/button/node/textnode.js
  40. 5
      src/base/single/editor/editor.js
  41. 15
      src/base/single/html/html.js
  42. 76
      src/base/single/instruction/instruction.js
  43. 8
      src/base/single/label/abstract.label.js
  44. 2
      src/base/single/label/icon.label.js
  45. 4
      src/base/single/tip/tip.toast.js
  46. 2
      src/base/single/tip/tip.tooltip.js
  47. 6
      src/case/button/node/siwtcher.tree.node.js
  48. 6
      src/case/button/treeitem/treeitem.js
  49. 4
      src/case/calendar/calendar.date.item.js
  50. 4
      src/case/calendar/calendar.js
  51. 4
      src/case/colorchooser/colorchooser.js
  52. 6
      src/case/combo/icontextvaluecombo/combo.icontextvalue.js
  53. 11
      src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js
  54. 6
      src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js
  55. 6
      src/case/combo/textvaluecombo/combo.textvalue.js
  56. 24
      src/case/editor/editor.shelter.js
  57. 24
      src/case/editor/editor.sign.js
  58. 24
      src/case/editor/editor.state.js
  59. 44
      src/case/layer/panel.js
  60. 2
      src/case/linearsegment/button.linear.segment.js
  61. 2
      src/case/list/list.select.js
  62. 3
      src/case/segment/button.segment.js
  63. 2
      src/case/segment/segment.js
  64. 4
      src/case/tree/treeexpander/tree.expander.popup.js
  65. 8
      src/case/trigger/trigger.editor.js
  66. 20
      src/case/trigger/trigger.icon.text.js
  67. 5
      src/case/trigger/trigger.text.js
  68. 3
      src/case/trigger/trigger.text.select.small.js
  69. 2
      src/case/trigger/trigger.text.small.js
  70. 5
      src/case/ztree/1.asynctree.js
  71. 6
      src/component/treevaluechooser/combo.treevaluechooser.js
  72. 10
      src/core/2.base.js
  73. 33
      src/core/3.ob.js
  74. 62
      src/core/4.widget.js
  75. 22
      src/core/5.inject.js
  76. 66
      src/core/constant/date.i18n.js
  77. 26
      src/core/constant/var.js
  78. 5
      src/core/controller/controller.popover.js
  79. 5
      src/core/controller/controller.tooltips.js
  80. 4
      src/core/func/alias.js
  81. 73
      src/core/func/date.js
  82. 677
      src/core/platform/web/detectElementResize.js
  83. 4
      src/core/utils/events/mousemovetracker.js
  84. 10
      src/core/wrapper/layout.js
  85. 8
      src/core/wrapper/layout/layout.flow.js
  86. 8
      src/core/wrapper/layout/layout.inline.js
  87. 4
      src/core/wrapper/layout/layout.tape.js
  88. 2
      src/core/wrapper/layout/responsive/responsive.flex.horizontal.js
  89. 28
      src/core/wrapper/layout/sticky/sticky.horizontal.js
  90. 28
      src/core/wrapper/layout/sticky/sticky.vertical.js
  91. 3
      src/less/base/combo/combo.less
  92. 11
      src/less/base/single/button/button.half.less
  93. 7
      src/less/base/single/editor/editor.textarea.less
  94. 13
      src/less/base/single/input/checkbox.less
  95. 13
      src/less/base/single/input/radio.less
  96. 31
      src/less/base/single/instruction.less
  97. 10
      src/less/base/single/tip/tip.bubble.less
  98. 296
      src/less/base/tree/ztree.less
  99. 90
      src/less/case/tree/tree.item.less
  100. 28
      src/less/core/utils/common.less
  101. Some files were not shown because too many files have changed in this diff Show More

67
_mobile/date.i18n.cn.js

@ -1,67 +0,0 @@
/**
* Created by astronaut007 on 2018/8/8
*/
// 牵扯到国际化这些常量在页面加载后再生效
// full day names
BI.Date = BI.Date || {};
BI.Date._DN = ["星期日",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六",
"星期日"];
// short day names
BI.Date._SDN = ["日",
"一",
"二",
"三",
"四",
"五",
"六",
"日"];
// Monday first, etc.
BI.Date._FD = 1;
// full month namesdat
BI.Date._MN = [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月"];
// short month names
BI.Date._SMN = [0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11];
BI.Date._QN = ["", "第1季度",
"第2季度",
"第3季度",
"第4季度"];
/** Adds the number of days array to the Date object. */
BI.Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// 实际上无论周几作为一周的第一天,周初周末都是在-6-0间做偏移,用一个数组就可以
BI.Date._OFFSET = [0, -1, -2, -3, -4, -5, -6];

4
demo/js/config/widget.js

@ -192,7 +192,7 @@ Demo.WIDGET_CONFIG = [{
value: "demo.number_interval"
}, {
id: 420,
text: "滚动sliders",
text: "数值滑块sliders",
value: "demo.slider"
}, {
pId: 4,
@ -202,4 +202,4 @@ Demo.WIDGET_CONFIG = [{
pId: 414,
text: "bi.collapse",
value: "demo.collapse"
}];
}];

12
demo/js/widget/multitree/demo.multi_tree_combo.js

@ -38,7 +38,15 @@ Demo.MultiTreeCombo = BI.inherit(BI.Widget, {
width: 300,
value: {
"根目录": {}
}
},
listeners: [
{
eventName: "EVENT_CONFIRM",
action: function () {
console.log("EVENT_CONFIRM", this.getValue());
}
}
]
}, {
type: "bi.button",
text: "getValue",
@ -52,4 +60,4 @@ Demo.MultiTreeCombo = BI.inherit(BI.Widget, {
}
});
BI.shortcut("demo.multi_tree_combo", Demo.MultiTreeCombo);
BI.shortcut("demo.multi_tree_combo", Demo.MultiTreeCombo);

2
demo/less/face.less

@ -3,7 +3,7 @@
.demo-face {
.face-config {
.config-label {
font-size: 14px;
font-size: 1.4rem;
}
.config-item {
}

11
demo/less/main.less

@ -63,6 +63,7 @@ body {
right: 0;
top: 0;
bottom: 0;
font-size: 1.2rem;
}
.bi-theme-dark body {
@ -83,9 +84,7 @@ body {
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
background: #3f8ce8;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
border-radius: 2rem;
overflow: hidden;
overflow-x: hidden;
overflow-y: hidden;
@ -99,7 +98,5 @@ body {
}
.bi-progress-bar-bar {
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
}
border-radius: 2rem;
}

2
demo/less/north.less

@ -6,7 +6,7 @@
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: @color-bi-text;
background-color: #367fa9;
font-size: 20px;
font-size: 2rem;
font-weight: 300;
}
}

4
dist/fix/fix.compact.js vendored

@ -78,7 +78,7 @@
}, options);
};
function findStore (widget) {
BI.Widget.findStore = function findStore (widget) {
if (target != null) {
return target;
}
@ -110,7 +110,7 @@
return true;
}
if (this._store) {
var store = findStore(this.options.context || this._parent || this.options.element || this._context);
var store = BI.Widget.findStore(this.options.context || this._parent || this.options.element || this._context);
if (store) {
pushTarget(store);
needPop = true;

99
examples/ThemeProvider.html

@ -0,0 +1,99 @@
<html>
<head>
<meta charset="utf-8">
<title></title>
<!-- <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.min.css"/>
<script src="../dist/2.0/fineui.js"></script> -->
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css"/>
<!-- <script src="http://fanruan.design/fineui/2.0/fineui.min.js"></script>-->
<script src="http://localhost:9001/fineui.js"></script>
</head>
<body>
<div id="wrapper"></div>
<script>
var Model = BI.inherit(BI.Model, {
state: function () {
return {
theme: "light"
};
},
childContext: ["theme"],
actions: {
toggle: function () {
this.model.theme = this.model.theme === "light" ? "dark" : "light";
}
}
});
BI.model("demo.model", Model);
var Child = BI.inherit(BI.Widget, {
render: function () {
var label;
return {
type: "bi.context",
context: "theme",
watch: function (newValue, oldValue) {
label.setText(newValue);
},
items: [(context) => {
return {
type: "bi.label",
height: 30,
ref: function (_ref) {
label = _ref;
},
text: context.model.theme
}
}]
};
}
});
BI.shortcut("demo.child", Child);
var Widget = BI.inherit(BI.Widget, {
props: {
baseCls: "my-parent"
},
_store: function () {
return BI.Models.getModel("demo.model");
},
setup: function () {
var child;
var store = BI.useStore();
return function () {
return {
type: "bi.vertical",
vgap: 20,
items: [{
type: "demo.child",
ref: function (_ref) {
child = _ref;
}
}, {
type: "bi.button",
text: "改变主题",
handler: function () {
store.toggle();
}
}]
};
};
}
});
BI.shortcut("demo.parent", Widget);
BI.createWidget({
type: "bi.absolute",
items: [{
el: {
type: "demo.parent"
},
top: 100,
left: 100
}],
element: "#wrapper"
});
</script>
</body>
</html>

59
examples/useContext.html

@ -5,8 +5,15 @@
<!-- <link rel="stylesheet" type="text/css" href="../dist/2.0/fineui.min.css"/>
<script src="../dist/2.0/fineui.js"></script> -->
<link rel="stylesheet" type="text/css" href="http://fanruan.design/fineui/2.0/fineui.min.css"/>
<script src="http://fanruan.design/fineui/2.0/fineui.min.js"></script>
<!-- <script src="http://fanruan.design/fineui/2.0/fineui.min.js"></script>-->
<script src="http://localhost:9001/fineui.js"></script>
</head>
<style>
.my-parent {
--css-scale: 1;
font-size: calc(var(--css-scale) * 14px);
}
</style>
<body>
<div id="wrapper"></div>
<script>
@ -14,7 +21,8 @@
var Model = BI.inherit(BI.Model, {
state: function () {
return {
expand: false
expand: false,
cssScale: 2.0
};
},
childContext: ["text"],
@ -33,6 +41,36 @@
});
BI.model("demo.model", Model);
var oldFormat = BI.pixFormat;
BI.pixFormat = function (pix, border) {
var context = BI.useContext("cssScale");
if (!context) {
return oldFormat.apply(this, arguments);
}
if (!BI.isNumber(pix)) {
return pix;
}
if (border > 0) {
return "calc(var(--css-scale) * " + pix + "px" + " - " + border + "px"+")";
}
return "calc(var(--css-scale) * " + pix + "px)";
};
var oldPix = BI.toPix;
BI.toPix = function (pix, border) {
var context = BI.useContext("cssScale");
if (!context) {
return oldPix.apply(this, arguments);
}
if (!BI.isNumber(pix)) {
return pix;
}
if (border > 0) {
return "calc(var(--css-scale) * " + pix + "px" + " - " + border + "px"+")";
}
return "calc(var(--css-scale) * " + pix + "px)";
};
var Child = BI.inherit(BI.Widget, {
render: function () {
var label;
@ -45,6 +83,7 @@
// });
return {
type: "bi.label",
height: 30,
ref: function (_ref) {
label = _ref;
},
@ -60,6 +99,9 @@
BI.shortcut("demo.child", Child);
var Widget = BI.inherit(BI.Widget, {
props: {
baseCls: "my-parent"
},
_store: function () {
return BI.Models.getModel("demo.model");
},
@ -67,6 +109,7 @@
var child;
var store = BI.useStore();
return function () {
this.element[0].style.setProperty('--css-scale', store.model.cssScale);
return {
type: "bi.vertical",
vgap: 20,
@ -75,6 +118,18 @@
ref: function (_ref) {
child = _ref;
}
}, {
type: "bi.dynamic_date_combo",
supportDynamic: false,
width: 200,
value: {
type: 1,
value: {
year: 2012,
month: 3,
day: 15
}
}
}]
};
};

12
examples/响应式布局.html

@ -53,13 +53,13 @@
box-shadow: 0 2px 5px rgb(0 0 0 / 16%), 0 2px 10px rgb(0 0 0 / 12%);
}
.nav-logo {
background-image: url(https://qn.wangchuan.cc/pullrequest-logo.svg);
background-image: url(http://qn.wangchuan.cc/pullrequest-logo.svg);
background-repeat: no-repeat;
background-position: 50%;
background-size: contain;
}
.image {
background-image: url(https://qn.wangchuan.cc/hero-graphic.png);
background-image: url(http://qn.wangchuan.cc/hero-graphic.png);
background-repeat: no-repeat;
background-size: contain;
}
@ -79,7 +79,7 @@
border: 1px solid #4aa4e0;
}
.wave {
background-image: url(https://qn.wangchuan.cc/wave.png);
background-image: url(http://qn.wangchuan.cc/wave.png);
background-size: cover;
background-repeat: repeat-x;
}
@ -205,7 +205,7 @@
maxWidth: "100%",
maxHeight: "100%",
},
src: "https://qn.wangchuan.cc/hero-graphic.png",
src: "http://qn.wangchuan.cc/hero-graphic.png",
width: "auto",
height: "auto",
},
@ -318,7 +318,7 @@
maxWidth: "100%",
maxHeight: "100%",
},
src: "https://qn.wangchuan.cc/velocity.png",
src: "http://qn.wangchuan.cc/velocity.png",
width: "auto",
height: "auto",
},
@ -358,7 +358,7 @@
maxWidth: "100%",
maxHeight: "100%",
},
src: "https://qn.wangchuan.cc/secure.png",
src: "http://qn.wangchuan.cc/secure.png",
width: "auto",
height: "auto",
},

2
package.json

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

3
plugins/webpack-fui-worker-plugin/worker-loader.js

@ -116,8 +116,9 @@ function loader() {
// 插入代码的转译和压缩由主构建配置的 babel/ts loader 处理, 不需要 worker-worker 来处理
// 添加 @ts-nocheck 避免 ts-check 报错
// 修复export const 下 const不会被转译的问题
// safari浏览器下blob需指定type
`// @ts-nocheck
export default window.URL.createObjectURL(new Blob([${JSON.stringify(compilation.assets[entry].source())}]));
export default window.URL.createObjectURL(new Blob([${JSON.stringify(compilation.assets[entry].source())}], { type: 'text/javascript' }));
`
)
: callback(

55
src/base/collection/collection.js

@ -187,20 +187,11 @@ BI.CollectionView = BI.inherit(BI.Widget, {
var index = this.renderedKeys[datum.index] && this.renderedKeys[datum.index][1];
var child;
if (index >= 0) {
// if (datum.width !== this.renderedCells[index]._width) {
// this.renderedCells[index]._width = datum.width;
this.renderedCells[index].el.setWidth(datum.width);
// }
// if (datum.height !== this.renderedCells[index]._height) {
// this.renderedCells[index]._height = datum.height;
this.renderedCells[index].el.setHeight(datum.height);
// }
// if (this.renderedCells[index]._left !== datum.x) {
this.renderedCells[index].el.element.css("left", datum.x / BI.pixRatio + BI.pixUnit);
// }
// if (this.renderedCells[index]._top !== datum.y) {
this.renderedCells[index].el.element.css("top", datum.y / BI.pixRatio + BI.pixUnit);
// }
// 这里只使用px
this.renderedCells[index].el.element.css("left", datum.x + "px");
this.renderedCells[index].el.element.css("top", datum.y + "px");
renderedCells.push(child = this.renderedCells[index]);
} else {
var item = o.itemFormatter(o.items[datum.index], datum.index);
@ -215,8 +206,8 @@ BI.CollectionView = BI.inherit(BI.Widget, {
}));
renderedCells.push({
el: child,
left: datum.x,
top: datum.y,
left: datum.x + "px",
top: datum.y + "px",
_left: datum.x,
_top: datum.y,
// _width: datum.width,
@ -289,12 +280,44 @@ BI.CollectionView = BI.inherit(BI.Widget, {
}
},
_isOverflowX: function () {
var o = this.options;
// 兼容一下
var scrollable = o.scrollable, scrollx = o.scrollx;
if (o.overflowX === false) {
return false;
}
if (scrollx) {
return true;
}
if (scrollable === true || scrollable === "xy" || scrollable === "x") {
return true;
}
return false;
},
_isOverflowY: function () {
var o = this.options;
// 兼容一下
var scrollable = o.scrollable, scrolly = o.scrolly;
if (o.overflowX === false) {
return false;
}
if (scrolly) {
return true;
}
if (scrollable === true || scrollable === "xy" || scrollable === "y") {
return true;
}
return false;
},
_getMaxScrollLeft: function () {
return Math.max(0, this._width - this.options.width + (this.options.overflowX ? BI.DOM.getScrollWidth() : 0));
return Math.max(0, this._width - this.options.width + (this._isOverflowX() ? BI.DOM.getScrollWidth() : 0));
},
_getMaxScrollTop: function () {
return Math.max(0, this._height - this.options.height + (this.options.overflowY ? BI.DOM.getScrollWidth() : 0));
return Math.max(0, this._height - this.options.height + (this._isOverflowY() ? BI.DOM.getScrollWidth() : 0));
},
_populate: function (items) {

11
src/base/combination/group.button.js

@ -42,9 +42,14 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
},
_createBtns: function (items) {
return BI.createWidgets(BI.createItems(items, {
type: "bi.text_button",
}), this);
var btns;
BI.Widget.execWithContext(this, function () {
btns = BI.createWidgets(BI.createItems(items, {
type: "bi.text_button",
}));
});
return btns;
},
_btnsCreator: function (items) {

16
src/base/combination/navigation.js

@ -43,10 +43,10 @@ BI.Navigation = BI.inherit(BI.Widget, {
return self.showIndex + v;
},
cardCreator: function (v) {
var card = o.cardCreator(v);
self.cardMap[v] = card;
return card;
BI.Widget.execWithContext(self, function () {
self.cardMap[v] = o.cardCreator(v);
});
return self.cardMap[v];
},
afterCardCreated: BI.bind(this.afterCardCreated, this),
afterCardShow: BI.bind(this.afterCardShow, this),
@ -103,10 +103,12 @@ BI.Navigation = BI.inherit(BI.Widget, {
},
_assertCard: function (v) {
var self = this, o = this.options;
if (!this.layout.isCardExisted(v)) {
var card = this.options.cardCreator(v);
this.cardMap[v] = card;
this.layout.addCardByName(v, card);
BI.Widget.execWithContext(self, function () {
self.cardMap[v] = o.cardCreator(v);
});
this.layout.addCardByName(v, this.cardMap[v]);
this.afterCardCreated(v);
}
},

15
src/base/combination/tab.js

@ -43,10 +43,11 @@ BI.Tab = BI.inherit(BI.Widget, {
eventObj: this.tab,
cardLayout: this.layout,
cardCreator: function (v) {
var card = o.cardCreator.apply(self, arguments);
self.cardMap[v] = card;
BI.Widget.execWithContext(self, function () {
self.cardMap[v] = o.cardCreator(v);
});
return card;
return self.cardMap[v];
},
afterCardShow: function (v) {
self._deleteOtherCards(v);
@ -71,10 +72,12 @@ BI.Tab = BI.inherit(BI.Widget, {
},
_assertCard: function (v) {
var self = this, o = this.options;
if (!this.layout.isCardExisted(v)) {
var card = this.options.cardCreator(v);
this.cardMap[v] = card;
this.layout.addCardByName(v, card);
BI.Widget.execWithContext(this, function () {
self.cardMap[v] = o.cardCreator(v);
});
this.layout.addCardByName(v, this.cardMap[v]);
}
},

20
src/base/context.js

@ -15,31 +15,33 @@ BI.Context = BI.inherit(BI.Widget, {
render: function () {
var self = this, o = this.options;
this.context = BI.createWidget(o.items[0] || o.el, {
if (o.context) {
this.context = BI.useContext(o.context);
}
this.widget = BI.createWidget((o.items[0] || o.el)(this.context), {
element: this,
});
this.context.on(BI.Controller.EVENT_CHANGE, function () {
this.widget.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
},
created: function () {
__initWatch: function () {
BI.Context.superclass.__initWatch.call(this);
var o = this.options;
if (o.context) {
BI.watch(o.context, o.watch);
}
BI.watch(this.context, o.context, o.watch);
},
setValue: function (v) {
this.context.setValue(v);
this.widget.setValue(v);
},
getValue: function () {
return this.context.getValue();
return this.widget.getValue();
},
populate: function () {
this.context.populate.apply(this, arguments);
this.widget.populate.apply(this, arguments);
},
});
BI.shortcut("bi.context", BI.Context);

57
src/base/grid/grid.js

@ -96,7 +96,7 @@ BI.GridView = BI.inherit(BI.Widget, {
this.element.scrollLeft(o.scrollLeft);
}
},
destroyed: function () {
BI.each(this.renderedCells, function(i, cell) {
cell.el._destroy();
@ -185,20 +185,11 @@ BI.GridView = BI.inherit(BI.Widget, {
var index = this.renderedKeys[key] && this.renderedKeys[key][2];
var child;
if (index >= 0) {
// if (columnDatum.size !== this.renderedCells[index]._width) {
// this.renderedCells[index]._width = columnDatum.size;
this.renderedCells[index].el.setWidth(columnDatum.size);
// }
// if (rowDatum.size !== this.renderedCells[index]._height) {
// this.renderedCells[index]._height = rowDatum.size;
this.renderedCells[index].el.setHeight(rowDatum.size);
// }
// if (this.renderedCells[index]._left !== columnDatum.offset + horizontalOffsetAdjustment) {
this.renderedCells[index].el.element.css("left", (columnDatum.offset + horizontalOffsetAdjustment) / BI.pixRatio + BI.pixUnit);
// }
// if (this.renderedCells[index]._top !== rowDatum.offset + verticalOffsetAdjustment) {
this.renderedCells[index].el.element.css("top", (rowDatum.offset + verticalOffsetAdjustment) / BI.pixRatio + BI.pixUnit);
// }
// 这里只使用px
this.renderedCells[index].el.element.css("left", columnDatum.offset + horizontalOffsetAdjustment + "px");
this.renderedCells[index].el.element.css("top", rowDatum.offset + verticalOffsetAdjustment + "px");
child = this.renderedCells[index].el;
renderedCells.push(this.renderedCells[index]);
} else {
@ -216,8 +207,8 @@ BI.GridView = BI.inherit(BI.Widget, {
}), this);
renderedCells.push({
el: child,
left: columnDatum.offset + horizontalOffsetAdjustment,
top: rowDatum.offset + verticalOffsetAdjustment,
left: columnDatum.offset + horizontalOffsetAdjustment + "px",
top: rowDatum.offset + verticalOffsetAdjustment + "px",
_left: columnDatum.offset + horizontalOffsetAdjustment,
_top: rowDatum.offset + verticalOffsetAdjustment,
// _width: columnDatum.size,
@ -271,12 +262,44 @@ BI.GridView = BI.inherit(BI.Widget, {
}
},
_isOverflowX: function () {
var o = this.options;
// 兼容一下
var scrollable = o.scrollable, scrollx = o.scrollx;
if (o.overflowX === false) {
return false;
}
if (scrollx) {
return true;
}
if (scrollable === true || scrollable === "xy" || scrollable === "x") {
return true;
}
return false;
},
_isOverflowY: function () {
var o = this.options;
// 兼容一下
var scrollable = o.scrollable, scrolly = o.scrolly;
if (o.overflowX === false) {
return false;
}
if (scrolly) {
return true;
}
if (scrollable === true || scrollable === "xy" || scrollable === "y") {
return true;
}
return false;
},
_getMaxScrollLeft: function () {
return Math.max(0, this._getContainerWidth() - this.options.width + (this.options.overflowX ? BI.DOM.getScrollWidth() : 0));
return Math.max(0, this._getContainerWidth() - this.options.width + (this._isOverflowX() ? BI.DOM.getScrollWidth() : 0));
},
_getMaxScrollTop: function () {
return Math.max(0, this._getContainerHeight() - this.options.height + (this.options.overflowY ? BI.DOM.getScrollWidth() : 0));
return Math.max(0, this._getContainerHeight() - this.options.height + (this._isOverflowY() ? BI.DOM.getScrollWidth() : 0));
},
_getContainerWidth: function () {

16
src/base/layer/layer.popup.js

@ -60,8 +60,8 @@ BI.PopupView = BI.inherit(BI.Widget, {
}
this.element.css({
"z-index": BI.zIndex_popup,
"min-width": BI.isNumeric(o.minWidth) ? (o.minWidth / BI.pixRatio + BI.pixUnit) : o.minWidth,
"max-width": BI.isNumeric(o.maxWidth) ? (o.maxWidth / BI.pixRatio + BI.pixUnit) : o.maxWidth,
"min-width": BI.pixFormat(o.minWidth),
"max-width": BI.pixFormat(o.maxWidth),
}).bind({ click: fn });
this.element.bind("mousewheel", fn);
@ -135,11 +135,11 @@ BI.PopupView = BI.inherit(BI.Widget, {
var o = this.options;
this.button_group = BI.createWidget(o.el, { type: "bi.button_group", value: o.value });
this.button_group.element.css({
"min-height": BI.isNumeric(o.minHeight) ? (o.minHeight / BI.pixRatio + BI.pixUnit) : o.minHeight,
"padding-top": o.innerVgap / BI.pixRatio + BI.pixUnit,
"padding-bottom": o.innerVgap / BI.pixRatio + BI.pixUnit,
"padding-left": o.innerHgap / BI.pixRatio + BI.pixUnit,
"padding-right": o.innerHgap / BI.pixRatio + BI.pixUnit,
"min-height": BI.pixFormat(o.minHeight),
"padding-top": BI.pixFormat(o.innerVgap),
"padding-bottom": BI.pixFormat(o.innerVgap),
"padding-left": BI.pixFormat(o.innerHgap),
"padding-right": BI.pixFormat(o.innerHgap),
});
return this.button_group;
@ -411,7 +411,7 @@ BI.PopupView = BI.inherit(BI.Widget, {
toolHeight = ((this.tool && this.tool.attr("height")) || 24) * ((this.tool && this.tool.isVisible()) ? 1 : 0);
var resetHeight = h - tbHeight - tabHeight - toolHeight - 2 * this.options.innerVgap;
this.view.resetHeight ? this.view.resetHeight(resetHeight) :
this.view.element.css({ "max-height": resetHeight / BI.pixRatio + BI.pixUnit });
this.view.element.css({ "max-height": BI.pixFormat(resetHeight) });
},
setValue: function (selectedValues) {

8
src/base/list/listview.js

@ -100,6 +100,11 @@ BI.ListView = BI.inherit(BI.Widget, {
},
_calculateBlocksToRender: function () {
// BI-115750 不可见状态下依赖元素实际尺寸构造的线段树会分段错误,所以不进行后续计算和线段树的初始化。
// 这样从不可见状态变为可见状态能够重新触发线段树初始化
if (!this.element.is(":visible")) {
return;
}
this._renderMoreIf();
},
@ -131,7 +136,8 @@ BI.ListView = BI.inherit(BI.Widget, {
this._populate(items);
},
destroyed: function () {
beforeDestroy: function () {
BI.ResizeDetector.removeResizeListener(this);
this.restore();
},
});

14
src/base/list/virtualgrouplist.js

@ -110,6 +110,11 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
},
_calculateBlocksToRender: function () {
// BI-115750 不可见状态下依赖元素实际尺寸构造的线段树会分段错误,所以不进行后续计算和线段树的初始化。
// 这样从不可见状态变为可见状态能够重新触发线段树初始化
if (!this.element.is(":visible")) {
return;
}
var o = this.options;
this._isAutoHeight() && this._renderMoreIf();
var height = this.element.height();
@ -119,7 +124,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
var end = this.tree.leastUpperBound(minContentHeightTo);
var items = [];
var topHeight = this.tree.sumTo(Math.max(-1, start - 1));
this.topBlank.setHeight(topHeight);
this.topBlank.setHeight(topHeight + "px");
if (this._isAutoHeight()) {
for (var i = (start < 0 ? 0 : start); i <= end && i <= this.renderedIndex; i++) {
var index = i * o.blockSize;
@ -127,7 +132,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
items.push(o.items[j]);
}
}
this.bottomBlank.setHeight(this.tree.sumTo(this.renderedIndex) - this.tree.sumTo(Math.min(end, this.renderedIndex)));
this.bottomBlank.setHeight(this.tree.sumTo(this.renderedIndex) - this.tree.sumTo(Math.min(end, this.renderedIndex)) + "px");
this.container.populate(items.map(function (item, i) {
return o.itemFormatter(item, (start < 0 ? 0 : start) * o.blockSize + i);
}));
@ -183,6 +188,11 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
populate: function (items) {
this._populate(items);
},
beforeDestroy: function () {
BI.ResizeDetector.removeResizeListener(this);
this.restore();
}
});
BI.shortcut("bi.virtual_group_list", BI.VirtualGroupList);

17
src/base/list/virtuallist.js

@ -93,6 +93,11 @@ BI.VirtualList = BI.inherit(BI.Widget, {
_calculateBlocksToRender: function () {
var o = this.options;
// BI-115750 不可见状态下依赖元素实际尺寸构造的线段树会分段错误,所以不进行后续计算和线段树的初始化。
// 这样从不可见状态变为可见状态能够重新触发线段树初始化
if (!this.element.is(":visible")) {
return;
}
this._renderMoreIf();
var height = this.element.height();
var minContentHeightFrom = o.scrollTop - o.overscanHeight;
@ -148,8 +153,8 @@ BI.VirtualList = BI.inherit(BI.Widget, {
}
this.container.element.prepend(firstFragment);
this.container.element.append(lastFragment);
this.topBlank.setHeight(this.tree.sumTo(Math.max(-1, start - 1)));
this.bottomBlank.setHeight(this.tree.sumTo(this.renderedIndex) - this.tree.sumTo(Math.min(end, this.renderedIndex)));
this.topBlank.setHeight(this.tree.sumTo(Math.max(-1, start - 1)) + "px");
this.bottomBlank.setHeight(this.tree.sumTo(this.renderedIndex) - this.tree.sumTo(Math.min(end, this.renderedIndex)) + "px");
BI.each(needMount, function (i, child) {
child && child._mount();
});
@ -203,10 +208,10 @@ BI.VirtualList = BI.inherit(BI.Widget, {
this._populate(items);
},
destroyed: function () {
this.cache = {};
this.renderedIndex = -1;
},
beforeDestroy: function () {
BI.ResizeDetector.removeResizeListener(this);
this.restore();
}
});
BI.shortcut("bi.virtual_list", BI.VirtualList);

19
src/base/single/0.single.js

@ -67,6 +67,10 @@ BI.Single = BI.inherit(BI.Widget, {
self.setValue(newValue);
}) : o.value;
BI.Single.superclass._init.apply(this, arguments);
},
_mounted: function () {
var o = this.options;
if (o.enableHover || BI.isKey(o.title) || BI.isKey(o.warningTitle)
|| BI.isFunction(o.title) || BI.isFunction(o.warningTitle)) {
this.enableHover({
@ -91,7 +95,7 @@ BI.Single = BI.inherit(BI.Widget, {
opt || (opt = {});
var self = this;
if (!this._hoverBinded) {
this.element.on("mouseenter.title" + this.getName(), function (e) {
this.element.unbind("mouseenter.title").on("mouseenter.title", function (e) {
self._e = e;
if (self.getTipType() === "warning" || (BI.isKey(self.getWarningTitle()) && !self.isEnabled())) {
delayingTooltips = self.getName();
@ -109,7 +113,7 @@ BI.Single = BI.inherit(BI.Widget, {
}, 500);
}
});
this.element.on("mousemove.title" + this.getName(), function (e) {
this.element.unbind("mousemove.title").on("mousemove.title", function (e) {
self._e = e;
if (BI.isNotNull(self.showTimeout)) {
clearTimeout(self.showTimeout);
@ -138,7 +142,7 @@ BI.Single = BI.inherit(BI.Widget, {
}
}, 500);
});
this.element.on("mouseleave.title" + this.getName(), function (e) {
this.element.unbind("mouseleave.title").on("mouseleave.title", function (e) {
self._e = null;
self._clearTimeOut();
self._hideTooltip();
@ -151,9 +155,9 @@ BI.Single = BI.inherit(BI.Widget, {
// 取消hover事件
this._clearTimeOut();
this._hideTooltip();
this.element.unbind("mouseenter.title" + this.getName())
.unbind("mousemove.title" + this.getName())
.unbind("mouseleave.title" + this.getName());
this.element.unbind("mouseenter.title")
.unbind("mousemove.title")
.unbind("mouseleave.title");
this._hoverBinded = false;
},
@ -217,8 +221,7 @@ BI.Single = BI.inherit(BI.Widget, {
return this.options.value;
},
__d: function () {
BI.Single.superclass.__d.call(this);
_destroyed: function () {
if (BI.isNotNull(this.showTimeout)) {
clearTimeout(this.showTimeout);
this.showTimeout = null;

14
src/base/single/1.text.js

@ -26,32 +26,32 @@
var self = this, o = this.options;
if (o.hgap + o.lgap > 0) {
this.element.css({
"padding-left": (o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit,
"padding-left": BI.pixFormat(o.hgap + o.lgap),
});
}
if (o.hgap + o.rgap > 0) {
this.element.css({
"padding-right": (o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit,
"padding-right": BI.pixFormat(o.hgap + o.rgap),
});
}
if (o.vgap + o.tgap > 0) {
this.element.css({
"padding-top": (o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit,
"padding-top": BI.pixFormat(o.vgap + o.tgap),
});
}
if (o.vgap + o.bgap > 0) {
this.element.css({
"padding-bottom": (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit,
"padding-bottom": BI.pixFormat(o.vgap + o.bgap),
});
}
if (BI.isWidthOrHeight(o.height)) {
this.element.css({ lineHeight: BI.isNumber(o.height) ? (o.height / BI.pixRatio + BI.pixUnit) : o.height });
this.element.css({ lineHeight: BI.pixFormat(o.height) });
}
if (BI.isWidthOrHeight(o.lineHeight)) {
this.element.css({ lineHeight: BI.isNumber(o.lineHeight) ? (o.lineHeight / BI.pixRatio + BI.pixUnit) : o.lineHeight });
this.element.css({ lineHeight: BI.pixFormat(o.lineHeight) });
}
if (BI.isWidthOrHeight(o.maxWidth)) {
this.element.css({ maxWidth: BI.isNumber(o.maxWidth) ? (o.maxWidth / BI.pixRatio + BI.pixUnit) : o.maxWidth });
this.element.css({ maxWidth: BI.pixFormat(o.maxWidth) });
}
this.element.css({
textAlign: o.textAlign,

31
src/base/single/button/button.basic.js

@ -184,7 +184,7 @@ BI.BasicButton = BI.inherit(BI.Single, {
var mouseDown = false;
var interval;
hand.mousedown(function (e) {
BI.Widget._renderEngine.createElement(document).bind("mouseup." + self.getName(), function (e) {
BI.Widget._renderEngine.createElement(document).bind("mouseup." + self.getName(), function () {
interval && clearInterval(interval);
interval = null;
mouseDown = false;
@ -193,13 +193,14 @@ BI.BasicButton = BI.inherit(BI.Single, {
if (mouseDown === true) {
return;
}
if (!self.isEnabled() || (self.isOnce() && self.isSelected())) {
if (!self.isEnabled() || !self.isValid()) {
return;
}
if (self.isOnce() && self.isSelected()) {
return;
}
interval = setInterval(function () {
if (self.isEnabled()) {
self.doClick();
}
clk(e)
}, 180);
mouseDown = true;
ev(e);
@ -239,7 +240,10 @@ BI.BasicButton = BI.inherit(BI.Single, {
function clk(e) {
ev(e);
if (!self.isEnabled() || (self.isOnce() && self.isSelected())) {
if (!self.isEnabled() || !self.isValid()) {
return;
}
if (self.isOnce() && self.isSelected()) {
return;
}
if (BI.isKey(o.bubble) || BI.isFunction(o.bubble)) {
@ -335,16 +339,17 @@ BI.BasicButton = BI.inherit(BI.Single, {
},
_doClick: function (e) {
if (this.isValid()) {
var isIntercepted = this.beforeClick(e);
// 如果事件已经被消费掉了,就不再触发点击事件
if (isIntercepted) {
return;
}
if (!this.isEnabled() || !this.isValid()) {
return;
}
var isIntercepted = this.beforeClick(e);
// 如果事件已经被消费掉了,就不再触发点击事件
if (isIntercepted) {
return;
}
this._trigger(e);
if (this.isValid()) {
if (this.isEnabled() && this.isValid()) {
this.doClick(e);
}
},

2
src/base/single/button/buttons/button.icon.js

@ -31,7 +31,7 @@ BI.IconButton = BI.inherit(BI.BasicButton, {
height: o.iconHeight,
});
if (BI.isNumber(o.height) && o.height > 0 && BI.isNull(o.iconWidth) && BI.isNull(o.iconHeight)) {
this.element.css("lineHeight", o.height / BI.pixRatio + BI.pixUnit);
this.element.css("lineHeight", BI.pixFormat(o.height));
BI.createWidget({
type: "bi.default",
element: this,

18
src/base/single/button/buttons/button.js

@ -73,13 +73,13 @@
// 由于button默认情况下有个边框,所以要主动算行高
var lineHeight, textHeight = o.textHeight;
var hasBorder = false
if (BI.isNumber(o.height)) {
if (!isVertical(o.iconPosition)) {
if (o.clear || o.block || o.light) {
lineHeight = o.height;
} else {
lineHeight = o.height - 2;
if (!(o.clear && o.block && o.light)) {
hasBorder = true;
}
lineHeight = o.height;
} else {
lineHeight = textHeight;
}
@ -98,8 +98,8 @@
type: "bi.icon_label",
cls: o.loading ? loadingCls : (o.iconCls || o.icon),
width: this._const.iconWidth,
height: lineHeight,
lineHeight: lineHeight,
height: BI.toPix(lineHeight, hasBorder ? 2 : 0),
lineHeight: BI.toPix(lineHeight, hasBorder ? 2 : 0),
// 不设置,自定义按钮无法居中
iconWidth: o.iconWidth,
iconHeight: o.iconHeight,
@ -120,8 +120,8 @@
whiteSpace: o.whiteSpace,
textAlign: o.textAlign,
textWidth: textWidth,
textHeight: textHeight,
height: lineHeight,
textHeight: BI.toPix(textHeight, hasBorder ? 2 : 0),
height: BI.toPix(lineHeight, hasBorder ? 2 : 0),
value: o.value,
title: null,
});
@ -163,7 +163,7 @@
});
if (o.minWidth > 0) {
this.element.css({ "min-width": o.minWidth / BI.pixRatio + BI.pixUnit });
this.element.css({ "min-width": BI.pixFormat(o.minWidth) });
}
},

1
src/base/single/button/buttons/button.text.js

@ -42,7 +42,6 @@ BI.TextButton = BI.inherit(BI.BasicButton, {
value: o.value,
py: o.py,
keyword: o.keyword,
title: null,
});
},

1
src/base/single/button/listitem/blankiconicontextitem.js

@ -62,7 +62,6 @@ BI.BlankIconIconTextItem = BI.inherit(BI.BasicButton, {
value: o.value,
keyword: o.keyword,
height: o.height,
title: null,
},
}],
};

1
src/base/single/button/listitem/blankicontexticonitem.js

@ -56,7 +56,6 @@ BI.BlankIconTextIconItem = BI.inherit(BI.BasicButton, {
value: o.value,
keyword: o.keyword,
height: o.height,
title: null,
},
}, {
type: "bi.icon_label",

1
src/base/single/button/listitem/blankicontextitem.js

@ -55,7 +55,6 @@ BI.BlankIconTextItem = BI.inherit(BI.BasicButton, {
value: o.value,
keyword: o.keyword,
height: o.height,
title: null,
},
}],
};

1
src/base/single/button/listitem/icontexticonitem.js

@ -52,7 +52,6 @@ BI.IconTextIconItem = BI.inherit(BI.BasicButton, {
value: o.value,
keyword: o.keyword,
height: o.height,
title: null,
},
}, {
type: "bi.icon_label",

1
src/base/single/button/listitem/icontextitem.js

@ -53,7 +53,6 @@ BI.IconTextItem = BI.inherit(BI.BasicButton, {
value: o.value,
keyword: o.keyword,
height: o.height,
title: null,
},
}],
};

1
src/base/single/button/listitem/texticonitem.js

@ -46,7 +46,6 @@ BI.TextIconItem = BI.inherit(BI.BasicButton, {
value: o.value,
keyword: o.keyword,
height: o.height,
title: null,
},
}, {
type: "bi.icon_label",

1
src/base/single/button/listitem/textitem.js

@ -39,7 +39,6 @@ BI.TextItem = BI.inherit(BI.BasicButton, {
value: o.value,
keyword: o.keyword,
py: o.py,
title: null,
});
},

1
src/base/single/button/node/icontexticonnode.js

@ -50,7 +50,6 @@ BI.IconTextIconNode = BI.inherit(BI.NodeButton, {
value: o.value,
keyword: o.keyword,
height: o.height,
title: null,
},
}, {
type: "bi.icon_label",

1
src/base/single/button/node/icontextnode.js

@ -50,7 +50,6 @@ BI.IconTextNode = BI.inherit(BI.NodeButton, {
value: o.value,
keyword: o.keyword,
height: o.height,
title: null,
},
}],
};

1
src/base/single/button/node/texticonnode.js

@ -42,7 +42,6 @@ BI.TextIconNode = BI.inherit(BI.NodeButton, {
value: o.value,
keyword: o.keyword,
height: o.height,
title: null,
},
}, {
type: "bi.icon_label",

1
src/base/single/button/node/textnode.js

@ -38,7 +38,6 @@ BI.TextNode = BI.inherit(BI.NodeButton, {
value: o.value,
keyword: o.keyword,
py: o.py,
title: null,
});
},

5
src/base/single/editor/editor.js

@ -344,6 +344,11 @@ BI.Editor = BI.inherit(BI.Single, {
return this.editor.isValid();
},
setValid: function (b) {
this.editor.setValid(b);
this._checkError();
},
destroyed: function () {
BI.Bubbles.remove(this.getName());
},

15
src/base/single/html/html.js

@ -25,33 +25,36 @@ BI.Html = BI.inherit(BI.Single, {
var self = this, o = this.options;
if (o.hgap + o.lgap > 0) {
this.element.css({
"padding-left": (o.hgap + o.lgap) / BI.pixRatio + BI.pixUnit,
"padding-left": BI.pixFormat(o.hgap + o.lgap),
});
}
if (o.hgap + o.rgap > 0) {
this.element.css({
"padding-right": (o.hgap + o.rgap) / BI.pixRatio + BI.pixUnit,
"padding-right": BI.pixFormat(o.hgap + o.rgap),
});
}
if (o.vgap + o.tgap > 0) {
this.element.css({
"padding-top": (o.vgap + o.tgap) / BI.pixRatio + BI.pixUnit,
"padding-top": BI.pixFormat(o.vgap + o.tgap),
});
}
if (o.vgap + o.bgap > 0) {
this.element.css({
"padding-bottom": (o.vgap + o.bgap) / BI.pixRatio + BI.pixUnit,
"padding-bottom": BI.pixFormat(o.vgap + o.bgap),
});
}
if (BI.isNumber(o.height)) {
this.element.css({ lineHeight: o.height / BI.pixRatio + BI.pixUnit });
this.element.css({ lineHeight: BI.pixFormat(o.height) });
}
if (BI.isNumber(o.lineHeight)) {
this.element.css({ lineHeight: o.lineHeight / BI.pixRatio + BI.pixUnit });
this.element.css({ lineHeight: BI.pixFormat(o.lineHeight) });
}
if (BI.isWidthOrHeight(o.maxWidth)) {
this.element.css({ maxWidth: o.maxWidth });
}
if (BI.isNumber(o.maxWidth)) {
this.element.css({ maxWidth: BI.pixFormat(o.maxWidth) })
}
this.element.css({
textAlign: o.textAlign,
whiteSpace: o.whiteSpace,

76
src/base/single/instruction/instruction.js

@ -0,0 +1,76 @@
BI.Instruction = BI.inherit(BI.Widget, {
_defaultConfig: function () {
var conf = BI.Link.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-instruction",
height: 20,
level: "error",
textAlign: "left",
whiteSpace: "nowrap",
hgap: 5
});
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.label",
ref: function (_ref) {
self.text = _ref;
},
cls: "instruction-" + o.level,
textAlign: o.textAlign,
whiteSpace: o.whiteSpace,
textHeight: o.height,
height: o.height,
hgap: o.hgap,
rgap: o.rgap,
lgap: o.lgap,
vgap: o.vgap,
text: o.text,
keyword: o.keyword,
value: o.value,
py: o.py
};
},
doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments);
},
unRedMark: function () {
this.text.unRedMark.apply(this.text, arguments);
},
doHighLight: function () {
this.text.doHighLight.apply(this.text, arguments);
},
unHighLight: function () {
this.text.unHighLight.apply(this.text, arguments);
},
setText: function (v) {
this.options.text = v;
this.text.setText(v);
},
getText: function () {
return this.options.text;
},
setStyle: function (css) {
this.text.setStyle(css);
},
setValue: function (v) {
this.text.setValue(v);
},
getValue: function () {
this.text.getValue();
}
});
BI.shortcut("bi.instruction", BI.Instruction);

8
src/base/single/label/abstract.label.js

@ -109,7 +109,7 @@
}
if (BI.isNumber(o.height) && o.height > 0) { // 1.4
this.element.css({
"line-height": o.height / BI.pixRatio + BI.pixUnit,
"line-height": BI.pixFormat(o.height),
});
json.textAlign = o.textAlign;
delete json.maxWidth;
@ -183,7 +183,7 @@
}
if (BI.isNumber(o.height) && o.height > 0) { // 1.8
this.element.css({
"line-height": o.height / BI.pixRatio + BI.pixUnit,
"line-height": BI.pixFormat(o.height),
});
json.textAlign = o.textAlign;
delete json.maxWidth;
@ -263,7 +263,7 @@
if (BI.isNumber(o.height) && o.height > 0) { // 2.3
if (o.whiteSpace !== "normal") {
this.element.css({
"line-height": (o.height - (o.vgap * 2)) / BI.pixRatio + BI.pixUnit,
"line-height": BI.pixFormat(o.height - (o.vgap * 2)),
});
}
delete json.maxWidth;
@ -325,7 +325,7 @@
if (BI.isNumber(o.height) && o.height > 0) {
if (o.whiteSpace !== "normal") {
this.element.css({
"line-height": (o.height - (o.vgap * 2)) / BI.pixRatio + BI.pixUnit,
"line-height": BI.pixFormat(o.height - (o.vgap * 2)),
});
}
delete json.maxWidth;

2
src/base/single/label/icon.label.js

@ -29,7 +29,7 @@ BI.IconLabel = BI.inherit(BI.Single, {
height: o.iconHeight,
});
if (BI.isNumber(o.height) && o.height > 0 && BI.isNull(o.iconWidth) && BI.isNull(o.iconHeight)) {
this.element.css("lineHeight", (o.lineHeight || o.height) / BI.pixRatio + BI.pixUnit);
this.element.css("lineHeight", BI.pixFormat(o.lineHeight || o.height));
BI.createWidget({
type: "bi.default",
element: this,

4
src/base/single/tip/tip.toast.js

@ -30,8 +30,8 @@ BI.Toast = BI.inherit(BI.Tip, {
render: function () {
var self = this, o = this.options, c = this._const;
this.element.css({
minWidth: (o.closable ? c.closableMinWidth : c.minWidth) / BI.pixRatio + BI.pixUnit,
maxWidth: (o.closable ? c.closableMaxWidth : c.maxWidth) / BI.pixRatio + BI.pixUnit,
minWidth: BI.pixFormat(o.closable ? c.closableMinWidth : c.minWidth),
maxWidth: BI.pixFormat(o.closable ? c.closableMaxWidth : c.maxWidth),
});
this.element.addClass("toast-" + o.level);
function fn(e) {

2
src/base/single/tip/tip.tooltip.js

@ -73,7 +73,7 @@ BI.Tooltip = BI.inherit(BI.Tip, {
},
setWidth: function (width) {
this.element.width(width - 2 * this._const.hgap);
this.element.width(BI.pixFormat(width - 2 * this._const.hgap));
},
setText: function (text) {

6
src/case/button/node/siwtcher.tree.node.js

@ -29,13 +29,13 @@ BI.TreeNodeSwitcher = BI.inherit(BI.NodeButton, {
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? ["tree-solid-collapse-icon-type1", "tree-solid-expand-icon-type1"] : ["tree-collapse-icon-type1", "tree-expand-icon-type1"];
} else if (options.layer === 0 && options.isFirstNode) {
// 第一层,并且是第一个节点
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? ["tree-solid-collapse-icon-type2", "tree-solid-expand-icon-type2"] : ["tree-collapse-icon-type2", "tree-expand-icon-type2"];
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? ["tree-solid-collapse-icon-type1", "tree-solid-expand-icon-type1"] : ["tree-collapse-icon-type2", "tree-expand-icon-type2"];
} else if (options.isLastNode) {
// 最后一个节点
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? ["tree-solid-collapse-icon-type4", "tree-solid-expand-icon-type4"] : ["tree-collapse-icon-type4", "tree-expand-icon-type4"];
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? ["tree-solid-collapse-icon-type1", "tree-solid-expand-icon-type1"] : ["tree-collapse-icon-type4", "tree-expand-icon-type4"];
} else {
// 其他情况
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? ["tree-solid-collapse-icon-type3", "tree-solid-expand-icon-type3"] : ["tree-collapse-icon-type3", "tree-expand-icon-type3"];
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? ["tree-solid-collapse-icon-type1", "tree-solid-expand-icon-type1"] : ["tree-collapse-icon-type3", "tree-expand-icon-type3"];
}
},

6
src/case/button/treeitem/treeitem.js

@ -57,11 +57,11 @@ BI.BasicTreeItem = BI.inherit(BI.NodeButton, {
if (options.layer === 0 && options.isFirstNode && options.isLastNode) {
return "";
} else if (options.layer === 0 && options.isFirstNode) {
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "first-solid-line-conn-background" : "first-line-conn-background";
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-first-solid-line-conn-background" : "first-line-conn-background";
} else if (options.isLastNode) {
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "last-solid-line-conn-background" : "last-line-conn-background";
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-last-solid-line-conn-background" : "last-line-conn-background";
} else {
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "mid-solid-line-conn-background" : "mid-line-conn-background";
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-mid-solid-line-conn-background" : "mid-line-conn-background";
}
},

4
src/case/calendar/calendar.date.item.js

@ -4,8 +4,9 @@
BI.CalendarDateItem = BI.inherit(BI.BasicButton, {
props: function() {
return {
baseCls: "bi-calendar-date-item",
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT + 8,
}
}
},
render: function () {
@ -17,7 +18,6 @@ BI.CalendarDateItem = BI.inherit(BI.BasicButton, {
type: "bi.text_item",
cls: "bi-border-radius bi-list-item-select",
textAlign: "center",
whiteSpace: "normal",
text: o.text,
value: o.value,
ref: function () {

4
src/case/calendar/calendar.js

@ -120,7 +120,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
_getWeekLabel: function () {
return BI.map(BI.range(0, 7), function (idx, v) {
return BI.Date._SDN[(v + BI.StartOfWeek) % 7];
return BI.getShortDayName((v + BI.StartOfWeek) % 7);
});
},
@ -158,8 +158,6 @@ BI.Calendar = BI.inherit(BI.Widget, {
var month = td.lastMonth ? o.month - 1 : (td.nextMonth ? o.month + 1 : o.month);
return BI.extend(td, {
type: "bi.calendar_date_item",
textAlign: "center",
whiteSpace: "normal",
once: false,
forceSelected: true,
value: o.year + "-" + month + "-" + td.text,

4
src/case/colorchooser/colorchooser.js

@ -36,8 +36,8 @@ BI.ColorChooser = BI.inherit(BI.Widget, {
self.trigger = _ref;
},
value: o.value,
width: o.el.type ? o.width : o.width - 2,
height: o.el.type ? o.height : o.height - 2
width: o.el.type ? o.width : BI.toPix(o.width, 2),
height: o.el.type ? o.height : BI.toPix(o.height, 2)
}, o.el),
popup: () => ({
el: BI.extend({

6
src/case/combo/icontextvaluecombo/combo.icontextvalue.js

@ -15,8 +15,6 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, {
_init: function () {
var self = this, o = this.options;
BI.isNumeric(o.width) && (o.width -= 2);
BI.isNumeric(o.height) && (o.height -= 2);
o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) {
self.setValue(newValue);
}) : o.value;
@ -28,7 +26,7 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, {
type: "bi.select_icon_text_trigger",
cls: "icon-text-value-trigger",
items: o.items,
height: o.height,
height: BI.toPix(o.height, 2),
text: o.text,
iconCls: o.iconCls,
value: o.value,
@ -56,6 +54,8 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, {
});
this.textIconCombo = BI.createWidget({
type: "bi.combo",
height: BI.toPix(o.height, 2),
width: BI.toPix(o.width, 2),
element: this,
container: o.container,
direction: o.direction,

11
src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js

@ -23,16 +23,13 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
self.populate(newValue);
}) : o.items;
var height = BI.isNumeric(o.height) ? (o.height - (o.simple ? 1 : 2)) : o.height;
var width = BI.isNumeric(o.width) ? (o.width - 2) : o.width;
return {
type: "bi.combo",
cls: (o.simple ? "bi-border-bottom" : "bi-border bi-border-radius") + " bi-focus-shadow",
container: o.container,
adjustLength: 2,
height: height,
width: width,
height: BI.toPix(o.height, o.simple ? 1 : 2),
width: BI.toPix(o.width, 2),
ref: function () {
self.combo = this;
},
@ -44,7 +41,7 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
self.trigger = this;
},
items: o.items,
height: height,
height: BI.toPix(o.height, o.simple ? 1 : 2),
text: o.text,
defaultText: o.defaultText,
value: o.value,
@ -94,6 +91,7 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
eventName: BI.Combo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.trigger.stopEditing();
self.fireEvent(BI.SearchTextValueCombo.EVENT_AFTER_HIDEVIEW);
}
}, {
eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW,
@ -151,4 +149,5 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
});
BI.SearchTextValueCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.SearchTextValueCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.SearchTextValueCombo.EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW"
BI.shortcut("bi.search_text_value_combo", BI.SearchTextValueCombo);

6
src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js

@ -16,8 +16,6 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, {
_init: function () {
var self = this, o = this.options;
BI.isNumeric(o.width) && (o.width -= 2);
BI.isNumeric(o.height) && (o.height -= 2);
o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) {
self.setValue(newValue);
}) : o.value;
@ -29,7 +27,7 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, {
type: "bi.select_text_trigger",
cls: "text-value-trigger",
items: o.items,
height: o.height,
height: BI.toPix(o.height, 2),
text: o.text,
value: o.value
});
@ -52,6 +50,8 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, {
container: o.container,
direction: o.direction,
element: this,
width: BI.toPix(o.width, 2),
height: BI.toPix(o.height, 2),
adjustLength: 2,
el: this.trigger,
popup: {

6
src/case/combo/textvaluecombo/combo.textvalue.js

@ -22,8 +22,6 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
_init: function () {
var self = this, o = this.options;
BI.isNumeric(o.width) && (o.width -= (o.simple ? 0 : 2));
BI.isNumeric(o.height) && (o.height -= (o.simple ? 1 : 2));
o.value = BI.isFunction(o.value) ? this.__watch(o.value, function (context, newValue) {
self.setValue(newValue);
}) : o.value;
@ -57,7 +55,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
ref: ref => this.trigger = ref,
cls: "text-value-trigger",
items: o.items,
height: o.height,
height: BI.toPix(o.height, o.simple ? 1 : 2),
text: o.text,
value: o.value,
title,
@ -118,6 +116,8 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
return {
type: "bi.combo",
height: BI.toPix(o.height, 2),
width: BI.toPix(o.width, 2),
ref: ref => this.combo = ref,
container: o.container,
direction: o.direction,

24
src/case/editor/editor.shelter.js

@ -58,17 +58,6 @@ BI.ShelterEditor = BI.inherit(BI.Widget, {
height: o.height,
hgap: o.hgap + 2
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.text,
left: 0,
right: 0,
top: 0,
bottom: 0
}]
});
this.text.on(BI.Controller.EVENT_CHANGE, function () {
arguments[2] = self;
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -134,10 +123,17 @@ BI.ShelterEditor = BI.inherit(BI.Widget, {
self.fireEvent(BI.ShelterEditor.EVENT_EMPTY, arguments);
});
BI.createWidget({
type: "bi.vertical",
scrolly: false,
type: "bi.absolute",
element: this,
items: [this.editor]
items: [
{
el: this.text,
inset: 0,
}, {
el: this.editor,
inset: 0,
}
]
});
this._showHint();
self._checkText();

24
src/case/editor/editor.sign.js

@ -68,17 +68,6 @@ BI.SignEditor = BI.inherit(BI.Widget, {
self.fireEvent(BI.SignEditor.EVENT_CLICK_LABEL);
});
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.text,
left: 0,
right: 0,
top: 0,
bottom: 0
}]
});
this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
@ -137,10 +126,17 @@ BI.SignEditor = BI.inherit(BI.Widget, {
self.fireEvent(BI.SignEditor.EVENT_EMPTY, arguments);
});
BI.createWidget({
type: "bi.vertical",
scrolly: false,
type: "bi.absolute",
element: this,
items: [this.editor]
items: [
{
el: this.text,
inset: 0,
}, {
el: this.editor,
inset: 0,
}
]
});
this._showHint();
self._checkText();

24
src/case/editor/editor.state.js

@ -77,17 +77,6 @@ BI.StateEditor = BI.inherit(BI.Widget, {
self.fireEvent(BI.StateEditor.EVENT_CLICK_LABEL);
});
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.text,
left: 0,
right: 0,
top: 0,
bottom: 0
}]
});
this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
@ -143,10 +132,17 @@ BI.StateEditor = BI.inherit(BI.Widget, {
self.fireEvent(BI.StateEditor.EVENT_EMPTY, arguments);
});
BI.createWidget({
type: "bi.vertical",
scrolly: false,
type: "bi.absolute",
element: this,
items: [this.editor]
items: [
{
el: this.text,
inset: 0,
}, {
el: this.editor,
inset: 0,
}
]
});
this._showHint();
if (BI.isNotNull(o.text)) {

44
src/case/layer/panel.js

@ -11,22 +11,18 @@ BI.Panel = BI.inherit(BI.Widget, {
titleHeight: 30,
titleButtons: [],
el: {},
logic: {
dynamic: false
}
// logic: {
// dynamic: false
// }
});
},
_init: function () {
BI.Panel.superclass._init.apply(this, arguments);
var o = this.options;
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, {
items: BI.LogicFactory.createLogicItemsByDirection("top", this._createTitle()
, this.options.el)
}))));
render: function () {
return {
type: "bi.vertical_fill",
rowSize: ["", "fill"],
items: [this._createTitle(), this.options.el]
};
},
_createTitle: function () {
@ -56,18 +52,18 @@ BI.Panel = BI.inherit(BI.Widget, {
});
return {
el: {
type: "bi.left_right_vertical_adapt",
cls: "panel-title bi-header-background bi-border-bottom",
height: o.titleHeight - 1,
items: {
left: [this.text],
right: [this.button_group]
},
lhgap: 10,
rhgap: 10
// el: {
type: "bi.left_right_vertical_adapt",
cls: "panel-title bi-header-background bi-border-bottom",
height: BI.toPix(o.titleHeight, 1),
items: {
left: [this.text],
right: [this.button_group]
},
height: o.titleHeight - 1
lhgap: 10,
rhgap: 10
// },
// height: BI.toPix(o.titleHeight, 1)
};
},

2
src/case/linearsegment/button.linear.segment.js

@ -15,7 +15,7 @@ BI.LinearSegmentButton = BI.inherit(BI.BasicButton, {
type: "bi.label",
text: o.text,
height: o.height,
textHeight: o.height - 2,
textHeight: BI.toPix(o.height, 2),
value: o.value,
hgap: o.hgap,
ref: function () {

2
src/case/list/list.select.js

@ -192,7 +192,7 @@ BI.SelectList = BI.inherit(BI.Widget, {
resetHeight: function (h) {
var toolHeight = ( this.toolbar.element.outerHeight() || 25) * ( this.toolbar.isVisible() ? 1 : 0);
this.list.resetHeight ? this.list.resetHeight(h - toolHeight) :
this.list.element.css({"max-height": (h - toolHeight) / BI.pixRatio + BI.pixUnit});
this.list.element.css({"max-height": BI.pixFormat(h - toolHeight)});
},
setNotSelectedValue: function () {

3
src/case/segment/button.segment.js

@ -20,9 +20,6 @@ BI.SegmentButton = BI.inherit(BI.BasicButton, {
_init: function () {
BI.SegmentButton.superclass._init.apply(this, arguments);
var opts = this.options, self = this;
// if (BI.isNumber(opts.height) && BI.isNull(opts.lineHeight)) {
// this.element.css({lineHeight : (opts.height - 2) + 'px'});
// }
this.text = BI.createWidget({
type: "bi.label",
element: this,

2
src/case/segment/segment.js

@ -22,7 +22,7 @@ BI.Segment = BI.inherit(BI.Widget, {
value: o.value,
items: BI.createItems(o.items, {
type: "bi.segment_button",
height: o.height - 2,
height: BI.toPix(o.height, 2),
whiteSpace: o.whiteSpace
}),
layout: [

4
src/case/tree/treeexpander/tree.expander.popup.js

@ -25,8 +25,8 @@
});
if (o.showLine) {
this.popupView.element.css("margin-left", -offset * (o.layer + 1));
this.element.css("margin-left", offset * (o.layer + 1));
this.popupView.element.css("margin-left", BI.pixFormat(-offset * (o.layer + 1)));
this.element.css("margin-left", BI.pixFormat(offset * (o.layer + 1)));
}
return {

8
src/case/trigger/trigger.editor.js

@ -20,12 +20,11 @@ BI.EditorTrigger = BI.inherit(BI.Trigger, {
},
_init: function () {
this.options.height -= 2;
BI.EditorTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options, c = this._const;
this.editor = BI.createWidget({
type: "bi.sign_editor",
height: o.height,
height: BI.toPix(o.height, 2),
value: o.value,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
@ -58,6 +57,7 @@ BI.EditorTrigger = BI.inherit(BI.Trigger, {
BI.createWidget({
element: this,
type: "bi.horizontal_fill",
height: BI.toPix(o.height, 2),
items: [
{
el: this.editor,
@ -65,9 +65,9 @@ BI.EditorTrigger = BI.inherit(BI.Trigger, {
}, {
el: {
type: "bi.trigger_icon_button",
width: o.triggerWidth || o.height
width: o.triggerWidth || BI.toPix(o.height, 2)
},
width: o.triggerWidth || o.height
width: ""
}
]
});

20
src/case/trigger/trigger.icon.text.js

@ -42,7 +42,7 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
BI.createWidget({
element: this,
type: "bi.horizontal_fill",
columnSize: [BI.isEmptyString(o.iconCls) ? 0 : (o.iconWrapperWidth || o.height), "fill", o.triggerWidth || o.height],
columnSize: ["", "fill", ""],
ref: function (_ref) {
self.wrapper = _ref;
},
@ -50,7 +50,9 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
el: {
type: "bi.icon_change_button",
cls: "icon-combo-trigger-icon",
width: o.triggerWidth || o.height,
iconCls: o.iconCls,
invisible: !o.iconCls,
ref: function (_ref) {
self.icon = _ref;
},
@ -74,21 +76,7 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
setIcon: function (iconCls) {
var o = this.options;
this.icon.setIcon(iconCls);
var iconItem = this.wrapper.attr("items")[0];
var textItem = this.wrapper.attr("items")[1];
if (BI.isNull(iconCls) || BI.isEmptyString(iconCls)) {
if (iconItem.width !== 0) {
iconItem.width = 0;
textItem.lgap = 5;
this.wrapper.resize();
}
} else {
if (iconItem.width !== (o.iconWrapperWidth || o.height)) {
iconItem.width = (o.iconWrapperWidth || o.height);
textItem.lgap = 0;
this.wrapper.resize();
}
}
this.icon.setVisible(!!iconCls);
},
setTextCls: function (cls) {

5
src/case/trigger/trigger.text.js

@ -60,7 +60,7 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
return ({
type: "bi.horizontal_fill",
columnSize: ["fill", o.triggerWidth || o.height],
columnSize: ["fill", ""],
items: [
{
el: label,
@ -68,6 +68,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
}, {
el: o.allowClear ? {
type: "bi.vertical_adapt",
width: o.triggerWidth || o.height,
height: o.height,
horizontalAlign: "left",
scrollable: false,
items: [
@ -80,7 +82,6 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
cls: "close-h-font " + (o.allowClear ? "clear-button" : ""),
stopPropagation: true,
width: o.triggerWidth || o.height,
height: o.height,
invisible: !BI.isNotEmptyString(o.text),
handler: function () {
self.fireEvent(BI.TextTrigger.EVENT_CLEAR);

3
src/case/trigger/trigger.text.select.small.js

@ -14,14 +14,13 @@ BI.SmallSelectTextTrigger = BI.inherit(BI.Trigger, {
},
_init: function () {
this.options.height -= 2;
BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({
type: "bi.small_text_trigger",
element: this,
height: o.height,
height: BI.toPix(o.height, 2),
text: obj.text,
cls: obj.cls,
textHgap: o.textHgap,

2
src/case/trigger/trigger.text.small.js

@ -43,7 +43,7 @@ BI.SmallTextTrigger = BI.inherit(BI.Trigger, {
width: "fill"
}, {
el: this.trigerButton,
width: o.triggerWidth || o.height
width: ""
}
]
});

5
src/case/ztree/1.asynctree.js

@ -1,6 +1,6 @@
/**
* guy
* 步树
* 步树
* @class BI.AsyncTree
* @extends BI.TreeView
*/
@ -194,7 +194,8 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
// 展开节点会将halfCheck置为false以开启自动计算半选, 所以第一次展开节点的时候需要在置为false之前获取配置
var checkState = treeNode.getCheckStatus();
if (!treeNode.children) {
if (!treeNode.children && !treeNode.requested) {
treeNode.requested = true;
setTimeout(function () {
getNodes({
times: 1,

6
src/component/treevaluechooser/combo.treevaluechooser.js

@ -73,6 +73,11 @@ BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, {
action: function () {
self.fireEvent(BI.TreeValueChooserCombo.EVENT_BEFORE_POPUPVIEW);
}
}, {
eventName: BI.MultiTreeCombo.EVENT_AFTER_HIDEVIEW,
action: function () {
self.fireEvent(BI.TreeValueChooserCombo.EVENT_AFTER_HIDEVIEW);
}
}]
});
},
@ -128,4 +133,5 @@ BI.TreeValueChooserCombo.EVENT_BLUR = "EVENT_BLUR";
BI.TreeValueChooserCombo.EVENT_STOP = "EVENT_STOP";
BI.TreeValueChooserCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM";
BI.TreeValueChooserCombo.EVENT_SEARCHING = "EVENT_SEARCHING";
BI.TreeValueChooserCombo.EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW";
BI.shortcut("bi.tree_value_chooser_combo", BI.TreeValueChooserCombo);

10
src/core/2.base.js

@ -389,7 +389,7 @@
}
for (var i = 0, len = array.length; i < len; i++) {
if (BI.isArray(array[i])) {
res.push(arguments.callee(array[i], value));
res.push(BI.makeArrayByArray(array[i], value));
} else {
res.push(BI.deepClone(value));
}
@ -486,7 +486,7 @@
if (typeof w === "number") {
return w >= 0;
} else if (typeof w === "string") {
return /^\d{1,3}(\.\d)?%$/.test(w) || w === "auto" || /^\d+px$/.test(w) || /^calc/.test(w);
return /^\d{1,3}(\.\d)?%$/.test(w) || w === "auto" || /^\d+(\.\d+)?px$/.test(w) || /^calc/.test(w);
}
},
@ -987,7 +987,7 @@
* @param DD
* @param minDate '1900-01-01'
* @param maxDate '2099-12-31'
* @returns {Array} 若无效返回无效状态
* @returns {Array} 若无效返回无效状态,数组第一位为无效属性,第二位缺省为超下限,1为超上限
*/
checkDateVoid: function (YY, MM, DD, minDate, maxDate) {
var back = [];
@ -1079,7 +1079,7 @@
case "%b":
case "%B":
for (j = 0; j < 12; ++j) {
if (BI.Date._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) {
if (BI.getMonthName(j).substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) {
m = j;
break;
}
@ -1144,7 +1144,7 @@
if (a[i].search(/[a-zA-Z]+/) != -1) {
var t = -1;
for (j = 0; j < 12; ++j) {
if (BI.Date._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) {
if (BI.getMonthName(j).substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) {
t = j;
break;
}

33
src/core/3.ob.js

@ -33,7 +33,9 @@
};
BI._.extend(OB.prototype, {
props: {},
init: null,
destroyed: null,
_constructor: function (config) {
@ -71,6 +73,12 @@
self.on(eventName, lis);
return;
}
if (BI._.isArray(lis)) {
BI._.each(lis, function (l) {
self.on(eventName, l);
});
return;
}
(lis.target ? lis.target : self)[lis.once ? "once" : "on"](lis.eventName, BI._.bind(lis.action, self));
});
delete this.options.listeners;
@ -79,23 +87,25 @@
// 获得一个当前对象的引用
_initRef: function () {
if (this.options.__ref) {
this.options.__ref.call(this, this);
var o = this.options;
if (o.__ref) {
BI.isFunction(o.__ref) ? o.__ref.call(this, this) : o.__ref.current = this;
}
if (this.options.ref) {
this.options.ref.call(this, this);
if (o.ref) {
BI.isFunction(o.ref) ? o.ref.call(this, this) : o.ref.current = this;
}
},
//释放当前对象
_purgeRef: function () {
if (this.options.__ref) {
this.options.__ref.call(null, null);
this.options.__ref = null;
var o = this.options;
if (o.__ref) {
BI.isFunction(o.__ref) ? o.__ref.call(null, null) : o.__ref.current = null;
o.__ref = null;
}
if (this.options.ref) {
this.options.ref.call(null, null);
this.options.ref = null;
if (o.ref) {
BI.isFunction(o.ref) ? o.ref.call(null, null) : o.ref.current = null;
o.ref = null;
}
},
@ -138,6 +148,7 @@
};
this.on(eventName, proxy);
},
/**
* 解除观察者绑定的指定事件
* @param {String} eventName 要解除绑定事件的名字
@ -162,6 +173,7 @@
}
}
},
/**
* 清除观察者的所有事件绑定
*/
@ -169,6 +181,7 @@
/* alex:清空events*/
this.events = {};
},
/**
* 触发绑定过的事件
*

62
src/core/4.widget.js

@ -97,6 +97,8 @@
beforeMount: null,
mounted: null,
// 不想重写mounted时用
_mounted: null,
shouldUpdate: null,
@ -109,11 +111,11 @@
beforeDestroy: null,
destroyed: null,
// 不想重写destroyed时用
_destroyed: null,
_init: function () {
BI.Widget.superclass._init.apply(this, arguments);
this._initElementWidth();
this._initElementHeight();
this._initVisual();
this._initState();
this._initRender();
@ -199,6 +201,8 @@
_initCurrent: function () {
var self = this, o = this.options;
this._initElementWidth();
this._initElementHeight();
if (o._baseCls || o.baseCls || o.extraCls) {
this.element.addClass((o._baseCls || "") + " " + (o.baseCls || "") + " " + (o.extraCls || ""));
}
@ -285,14 +289,14 @@
_initElementWidth: function () {
var o = this.options;
if (BI.isWidthOrHeight(o.width)) {
this.element.css("width", BI.isNumber(o.width) ? o.width / BI.pixRatio + BI.pixUnit : o.width);
this.element.css("width", BI.pixFormat(o.width));
}
},
_initElementHeight: function () {
var o = this.options;
if (BI.isWidthOrHeight(o.height)) {
this.element.css("height", BI.isNumber(o.height) ? o.height / BI.pixRatio + BI.pixUnit : o.height);
this.element.css("height", BI.pixFormat(o.height));
}
},
@ -304,7 +308,7 @@
}) : o.invisible;
if (invisible) {
// 用display属性做显示和隐藏,否则jquery会在显示时将display设为block会覆盖掉display:flex属性
this.element.css("display", "none");
this.__setElementVisible(false);
}
}
},
@ -429,6 +433,7 @@
child.__afterMount && child.__afterMount(lifeHook, predicate);
}
if (lifeHook !== false && !this.__async) {
callLifeHook(this, "_mounted");
callLifeHook(this, "mounted");
this.fireEvent(BI.Events.MOUNT);
}
@ -508,13 +513,17 @@
}
},
__setElementVisible: function (visible) {
this.element.css("display", visible ? "" : "none");
},
_innerSetVisible: function (visible) {
var self = this, o = this.options;
var lastVisible = !o.invisible;
this._setVisible(visible);
if (visible === true) {
// 用this.element.show()会把display属性改成block
this.element.css("display", "");
this.__setElementVisible(true);
this._mount();
if (o.animation && !lastVisible) {
this.element.removeClass(o.animation + "-leave").removeClass(o.animation + "-leave-active").addClass(o.animation + "-enter");
@ -547,10 +556,10 @@
}
this._animationDuring = setTimeout(function () {
self.element.removeClass(o.animation + "-leave").removeClass(o.animation + "-leave-active");
self.element.css("display", "none");
self.__setElementVisible(false);
}, o.animationDuring);
} else {
this.element.css("display", "none");
this.__setElementVisible(false);
}
}
},
@ -736,6 +745,7 @@
this.__d();
this._parent = null;
this._isMounted = false;
callLifeHook(this, "_destroyed");
callLifeHook(this, "destroyed");
this.destroyed = null;
this._isDestroyed = true;
@ -847,6 +857,17 @@
BI.Widget.context = context = contextStack.pop();
};
BI.Widget.execWithContext = function (context, execFunc) {
BI.Widget.pushContext(context);
try {
execFunc();
} catch (e) {
throw e;
} finally {
BI.Widget.popContext();
}
};
function pushTarget(_current) {
if (current) currentStack.push(current);
BI.Widget.current = current = _current;
@ -892,18 +913,29 @@
};
BI.useContext = function (inject) {
if (BI.Model.target) {
var p = BI.Model.target;
// 通过组件找最近的store
var vm = BI.Widget.findStore(BI.Widget.current || BI.Widget.context);
if (vm) {
if (inject) {
while (p) {
if (p.$$context && inject in p.$$context) {
return p;
if (vm.$$computed && inject in vm.$$computed) {
return vm;
}
if (vm.$$state && inject in vm.$$state) {
return vm;
}
if (vm.$$model && inject in vm.$$model) {
return vm;
}
while (vm) {
if (vm.$$context && inject in vm.$$context) {
return vm;
}
p = p._parent;
vm = vm._parent;
}
return null;
}
}
return BI.Model.target;
return vm;
};
BI.watch = function (vm, watch, handler) {

22
src/core/5.inject.js

@ -449,7 +449,7 @@
} else if (item.el && (item.el.type || options.type)) {
el = BI.extend({}, options, item.el);
}
if (el) {
var elType = (el.type && el.type.xtype) || el.type;
runConfigFunction(elType);
@ -471,12 +471,20 @@
var wType = (w.type && w.type.xtype) || w.type;
if (wType === elType) {
if (BI.Plugin.hasObject(elType)) {
w.listeners = (w.listeners || []).concat([{
eventName: BI.Events.MOUNT,
action: function () {
BI.Plugin.getObject(elType, this);
}
}]);
if (!w.listeners || BI.isArray(w.listeners)) {
w.listeners = (w.listeners || []).concat([{
eventName: BI.Events.MOUNT,
action: function () {
BI.Plugin.getObject(elType, this);
}
}]);
} else {
w.listeners[BI.Events.MOUNT] = [
function () {
BI.Plugin.getObject(elType, this);
}
].concat(w.listeners[BI.Events.MOUNT] || []);
}
}
return createWidget(w, context, lazy);
}

66
src/core/constant/date.i18n.js

@ -1,66 +0,0 @@
BI.prepares.push(function () {
BI.Date = BI.Date || {};
// 牵扯到国际化这些常量在页面加载后再生效
// full day names
BI.Date._DN = [BI.i18nText("BI-Basic_Sunday"),
BI.i18nText("BI-Basic_Monday"),
BI.i18nText("BI-Basic_Tuesday"),
BI.i18nText("BI-Basic_Wednesday"),
BI.i18nText("BI-Basic_Thursday"),
BI.i18nText("BI-Basic_Friday"),
BI.i18nText("BI-Basic_Saturday"),
BI.i18nText("BI-Basic_Sunday")];
// short day names
BI.Date._SDN = [BI.i18nText("BI-Basic_Simple_Sunday"),
BI.i18nText("BI-Basic_Simple_Monday"),
BI.i18nText("BI-Basic_Simple_Tuesday"),
BI.i18nText("BI-Basic_Simple_Wednesday"),
BI.i18nText("BI-Basic_Simple_Thursday"),
BI.i18nText("BI-Basic_Simple_Friday"),
BI.i18nText("BI-Basic_Simple_Saturday"),
BI.i18nText("BI-Basic_Simple_Sunday")];
// Monday first, etc.
BI.Date._FD = 1;
// full month namesdat
BI.Date._MN = [
BI.i18nText("BI-Basic_January"),
BI.i18nText("BI-Basic_February"),
BI.i18nText("BI-Basic_March"),
BI.i18nText("BI-Basic_April"),
BI.i18nText("BI-Basic_May"),
BI.i18nText("BI-Basic_June"),
BI.i18nText("BI-Basic_July"),
BI.i18nText("BI-Basic_August"),
BI.i18nText("BI-Basic_September"),
BI.i18nText("BI-Basic_October"),
BI.i18nText("BI-Basic_November"),
BI.i18nText("BI-Basic_December")];
// short month names
BI.Date._SMN = [0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11];
BI.Date._QN = ["", BI.i18nText("BI-Quarter_1"),
BI.i18nText("BI-Quarter_2"),
BI.i18nText("BI-Quarter_3"),
BI.i18nText("BI-Quarter_4")];
/** Adds the number of days array to the Date object. */
BI.Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// 实际上无论周几作为一周的第一天,周初周末都是在-6-0间做偏移,用一个数组就可以
BI.Date._OFFSET = [0, -1, -2, -3, -4, -5, -6];
});

26
src/core/constant/var.js

@ -15,6 +15,32 @@ BI._.extend(BI, {
emptyStr: "",
pixUnit: "px",
pixRatio: 1,
// 一定返回最终的单位
pixFormat: function (pix, border) {
if (!BI.isNumber(pix)) {
return pix;
}
if (BI.pixUnit === "px") {
return (pix / BI.pixRatio - (border || 0)) + BI.pixUnit;
}
var length = pix / BI.pixRatio + BI.pixUnit;
if (border > 0) {
return `calc(${length} - ${border + "px"})`;
}
return length;
},
toPix: function (pix, border) {
if (!BI.isNumber(pix)) {
return pix;
}
if (BI.pixUnit === "px") {
return pix - (border || 0) * BI.pixRatio;
}
if (border > 0) {
return `calc(${pix / BI.pixRatio + BI.pixUnit} - ${border + "px"})`;
}
return pix;
},
emptyFn: function () {
},
empty: null,

5
src/core/controller/controller.popover.js

@ -59,8 +59,9 @@ BI.PopoverController = BI.inherit(BI.Controller, {
top = 0;
}
popover.element.css({
left: left / BI.pixRatio + BI.pixUnit,
top: top / BI.pixRatio + BI.pixUnit
// 这里直接用px就可以
left: left + "px",
top: top + "px"
});
}
return this;

5
src/core/controller/controller.tooltips.js

@ -71,8 +71,9 @@ BI.TooltipsController = BI.inherit(BI.Controller, {
!opt.belowMouse && (y = Math.max(y, top));
}
tooltip.element.css({
left: x < 0 ? 0 : x / BI.pixRatio + BI.pixUnit,
top: y < 0 ? 0 : y / BI.pixRatio + BI.pixUnit
// 这里直接用px就可以
left: x < 0 ? 0 : x + "px",
top: y < 0 ? 0 : y + "px"
});
tooltip.element.hover(function () {
self.remove(name);

4
src/core/func/alias.js

@ -804,7 +804,7 @@
var str = jfmt.str, len = jfmt.len, ch = jfmt["char"];
switch (ch) {
case "E": // 星期
str = BI.Date._DN[date.getDay()];
str = BI.getFullDayName(date.getDay());
break;
case "y": // 年
if (len <= 3) {
@ -815,7 +815,7 @@
break;
case "M": // 月
if (len > 2) {
str = BI.Date._MN[date.getMonth()];
str = BI.getMonthName(date.getMonth());
} else if (len < 2) {
str = date.getMonth() + 1;
} else {

73
src/core/func/date.js

@ -6,6 +6,29 @@ BI.Date.HOUR = 60 * BI.Date.MINUTE;
BI.Date.DAY = 24 * BI.Date.HOUR;
BI.Date.WEEK = 7 * BI.Date.DAY;
// Monday first, etc.
BI.Date._FD = 1;
// short month names
BI.Date._SMN = [0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11];
/** Adds the number of days array to the Date object. */
BI.Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// 实际上无论周几作为一周的第一天,周初周末都是在-6-0间做偏移,用一个数组就可以
BI.Date._OFFSET = [0, -1, -2, -3, -4, -5, -6];
BI._.extend(BI, {
/**
* 获取时区
@ -136,6 +159,50 @@ BI._.extend(BI, {
return BI.getOffsetDate(date, BI.Date._OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)] + 6);
},
getFullDayName: function (index) {
return [BI.i18nText("BI-Basic_Sunday"),
BI.i18nText("BI-Basic_Monday"),
BI.i18nText("BI-Basic_Tuesday"),
BI.i18nText("BI-Basic_Wednesday"),
BI.i18nText("BI-Basic_Thursday"),
BI.i18nText("BI-Basic_Friday"),
BI.i18nText("BI-Basic_Saturday"),
BI.i18nText("BI-Basic_Sunday")][index];
},
getShortDayName: function (index) {
return [BI.i18nText("BI-Basic_Simple_Sunday"),
BI.i18nText("BI-Basic_Simple_Monday"),
BI.i18nText("BI-Basic_Simple_Tuesday"),
BI.i18nText("BI-Basic_Simple_Wednesday"),
BI.i18nText("BI-Basic_Simple_Thursday"),
BI.i18nText("BI-Basic_Simple_Friday"),
BI.i18nText("BI-Basic_Simple_Saturday"),
BI.i18nText("BI-Basic_Simple_Sunday")][index];
},
getMonthName: function (index) {
return [BI.i18nText("BI-Basic_January"),
BI.i18nText("BI-Basic_February"),
BI.i18nText("BI-Basic_March"),
BI.i18nText("BI-Basic_April"),
BI.i18nText("BI-Basic_May"),
BI.i18nText("BI-Basic_June"),
BI.i18nText("BI-Basic_July"),
BI.i18nText("BI-Basic_August"),
BI.i18nText("BI-Basic_September"),
BI.i18nText("BI-Basic_October"),
BI.i18nText("BI-Basic_November"),
BI.i18nText("BI-Basic_December")][index]
},
getQuarterName: function (index) {
return ["", BI.i18nText("BI-Quarter_1"),
BI.i18nText("BI-Quarter_2"),
BI.i18nText("BI-Quarter_3"),
BI.i18nText("BI-Quarter_4")][index];
},
// 格式化打印日期
print: function (date, str) {
var m = date.getMonth();
@ -158,10 +225,10 @@ BI._.extend(BI, {
}
var min = date.getMinutes();
var sec = date.getSeconds();
s["%a"] = BI.Date._SDN[w]; // abbreviated weekday name [FIXME: I18N]
s["%A"] = BI.Date._DN[w]; // full weekday name
s["%a"] = BI.getShortDayName(w); // abbreviated weekday name [FIXME: I18N]
s["%A"] = BI.getFullDayName(w); // full weekday name
s["%b"] = BI.Date._SMN[m]; // abbreviated month name [FIXME: I18N]
s["%B"] = BI.Date._MN[m]; // full month name
s["%B"] = BI.getMonthName(m); // full month name
// FIXME: %c : preferred date and time representation for the current locale
s["%C"] = 1 + Math.floor(y / 100); // the century number
s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31)

677
src/core/platform/web/detectElementResize.js

@ -1,122 +1,559 @@
/**
* Detect Element Resize.
* Forked in order to guard against unsafe 'window' and 'document' references.
*
* https://github.com/sdecima/javascript-detect-element-resize
* Sebastian Decima
*
* version: 0.5.3
* A minimal library which polyfills the ResizeObserver API and is entirely based on the latest Draft Specification.
* https://github.com/juggle/resize-observer
* version: 3.4.0
**/
!(function () {
var attachEvent = _global.document && _global.document.attachEvent,
stylesCreated = false;
if (_global.document && !attachEvent) {
var requestFrame = (function () {
var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame ||
function (fn) { return _global.setTimeout(fn, 20); };
return function (fn) { return raf(fn); };
})();
var cancelFrame = (function () {
var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame ||
_global.clearTimeout;
return function (id) { return cancel(id); };
})();
var resetTriggers = function (element) {
var triggers = element.__resizeTriggers__,
expand = triggers.firstElementChild,
contract = triggers.lastElementChild,
expandChild = expand.firstElementChild;
contract.scrollLeft = contract.scrollWidth;
contract.scrollTop = contract.scrollHeight;
expandChild.style.width = expand.offsetWidth + 1 + "px";
expandChild.style.height = expand.offsetHeight + 1 + "px";
expand.scrollLeft = expand.scrollWidth;
expand.scrollTop = expand.scrollHeight;
};
var checkTriggers = function (element) {
return element.offsetWidth !== element.__resizeLast__.width ||
element.offsetHeight !== element.__resizeLast__.height;
};
var scrollListener = function (e) {
var element = this;
resetTriggers(this);
if (this.__resizeRAF__) cancelFrame(this.__resizeRAF__);
this.__resizeRAF__ = requestFrame(function () {
if (checkTriggers(element)) {
element.__resizeLast__.width = element.offsetWidth;
element.__resizeLast__.height = element.offsetHeight;
element.__resizeListeners__.forEach(function (fn) {
fn.call(element, e);
});
}
var ResizeObserverPolyfill = (function (exports) {
'use strict';
var resizeObservers = [];
var hasActiveObservations = function () {
return resizeObservers.some(function (ro) {
return ro.activeTargets.length > 0;
});
};
var hasSkippedObservations = function () {
return resizeObservers.some(function (ro) {
return ro.skippedTargets.length > 0;
});
};
var msg = 'ResizeObserver loop completed with undelivered notifications.';
var deliverResizeLoopError = function () {
var event;
if (typeof ErrorEvent === 'function') {
event = new ErrorEvent('error', {
message: msg
});
} else {
event = document.createEvent('Event');
event.initEvent('error', false, false);
event.message = msg;
}
window.dispatchEvent(event);
};
var ResizeObserverBoxOptions;
(function (ResizeObserverBoxOptions) {
ResizeObserverBoxOptions["BORDER_BOX"] = "border-box";
ResizeObserverBoxOptions["CONTENT_BOX"] = "content-box";
ResizeObserverBoxOptions["DEVICE_PIXEL_CONTENT_BOX"] = "device-pixel-content-box";
})(ResizeObserverBoxOptions || (ResizeObserverBoxOptions = {}));
var freeze = function (obj) {
return Object.freeze(obj);
};
var ResizeObserverSize = (function () {
function ResizeObserverSize(inlineSize, blockSize) {
this.inlineSize = inlineSize;
this.blockSize = blockSize;
freeze(this);
}
return ResizeObserverSize;
}());
var DOMRectReadOnly = (function () {
function DOMRectReadOnly(x, y, width, height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.top = this.y;
this.left = this.x;
this.bottom = this.top + this.height;
this.right = this.left + this.width;
return freeze(this);
}
DOMRectReadOnly.prototype.toJSON = function () {
var _a = this, x = _a.x, y = _a.y, top = _a.top, right = _a.right, bottom = _a.bottom, left = _a.left,
width = _a.width, height = _a.height;
return { x: x, y: y, top: top, right: right, bottom: bottom, left: left, width: width, height: height };
};
DOMRectReadOnly.fromRect = function (rectangle) {
return new DOMRectReadOnly(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
};
return DOMRectReadOnly;
}());
/* Detect CSS Animations support to detect element display/re-attach */
var animation = false,
animationstring = "animation",
keyframeprefix = "",
animationstartevent = "animationstart",
domPrefixes = "Webkit Moz O ms".split(" "),
startEvents = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "),
pfx = "";
{
var elm = document.createElement("fakeelement");
if (elm.style.animationName !== undefined) {
animation = true;
}
if (animation === false) {
for (var i = 0; i < domPrefixes.length; i++) {
if (elm.style[domPrefixes[i] + "AnimationName"] !== undefined) {
pfx = domPrefixes[i];
animationstring = pfx + "Animation";
keyframeprefix = "-" + pfx.toLowerCase() + "-";
animationstartevent = startEvents[i];
animation = true;
break;
}
var isSVG = function (target) {
return target instanceof SVGElement && 'getBBox' in target;
};
var isHidden = function (target) {
if (isSVG(target)) {
var _a = target.getBBox(), width = _a.width, height = _a.height;
return !width && !height;
}
var _b = target, offsetWidth = _b.offsetWidth, offsetHeight = _b.offsetHeight;
return !(offsetWidth || offsetHeight || target.getClientRects().length);
};
var isElement = function (obj) {
var _a;
if (obj instanceof Element) {
return true;
}
var scope = (_a = obj === null || obj === void 0 ? void 0 : obj.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView;
return !!(scope && obj instanceof scope.Element);
};
var isReplacedElement = function (target) {
switch (target.tagName) {
case 'INPUT':
if (target.type !== 'image') {
break;
}
case 'VIDEO':
case 'AUDIO':
case 'EMBED':
case 'OBJECT':
case 'CANVAS':
case 'IFRAME':
case 'IMG':
return true;
}
return false;
};
var global = typeof window !== 'undefined' ? window : {};
var cache = new WeakMap();
var scrollRegexp = /auto|scroll/;
var verticalRegexp = /^tb|vertical/;
var IE = (/msie|trident/i).test(global.navigator && global.navigator.userAgent);
var parseDimension = function (pixel) {
return parseFloat(pixel || '0');
};
var size = function (inlineSize, blockSize, switchSizes) {
if (inlineSize === void 0) {
inlineSize = 0;
}
if (blockSize === void 0) {
blockSize = 0;
}
if (switchSizes === void 0) {
switchSizes = false;
}
return new ResizeObserverSize((switchSizes ? blockSize : inlineSize) || 0, (switchSizes ? inlineSize : blockSize) || 0);
};
var zeroBoxes = freeze({
devicePixelContentBoxSize: size(),
borderBoxSize: size(),
contentBoxSize: size(),
contentRect: new DOMRectReadOnly(0, 0, 0, 0)
});
var calculateBoxSizes = function (target, forceRecalculation) {
if (forceRecalculation === void 0) {
forceRecalculation = false;
}
if (cache.has(target) && !forceRecalculation) {
return cache.get(target);
}
if (isHidden(target)) {
cache.set(target, zeroBoxes);
return zeroBoxes;
}
var cs = getComputedStyle(target);
var svg = isSVG(target) && target.ownerSVGElement && target.getBBox();
var removePadding = !IE && cs.boxSizing === 'border-box';
var switchSizes = verticalRegexp.test(cs.writingMode || '');
var canScrollVertically = !svg && scrollRegexp.test(cs.overflowY || '');
var canScrollHorizontally = !svg && scrollRegexp.test(cs.overflowX || '');
var paddingTop = svg ? 0 : parseDimension(cs.paddingTop);
var paddingRight = svg ? 0 : parseDimension(cs.paddingRight);
var paddingBottom = svg ? 0 : parseDimension(cs.paddingBottom);
var paddingLeft = svg ? 0 : parseDimension(cs.paddingLeft);
var borderTop = svg ? 0 : parseDimension(cs.borderTopWidth);
var borderRight = svg ? 0 : parseDimension(cs.borderRightWidth);
var borderBottom = svg ? 0 : parseDimension(cs.borderBottomWidth);
var borderLeft = svg ? 0 : parseDimension(cs.borderLeftWidth);
var horizontalPadding = paddingLeft + paddingRight;
var verticalPadding = paddingTop + paddingBottom;
var horizontalBorderArea = borderLeft + borderRight;
var verticalBorderArea = borderTop + borderBottom;
var horizontalScrollbarThickness = !canScrollHorizontally ? 0 : target.offsetHeight - verticalBorderArea - target.clientHeight;
var verticalScrollbarThickness = !canScrollVertically ? 0 : target.offsetWidth - horizontalBorderArea - target.clientWidth;
var widthReduction = removePadding ? horizontalPadding + horizontalBorderArea : 0;
var heightReduction = removePadding ? verticalPadding + verticalBorderArea : 0;
var contentWidth = svg ? svg.width : parseDimension(cs.width) - widthReduction - verticalScrollbarThickness;
var contentHeight = svg ? svg.height : parseDimension(cs.height) - heightReduction - horizontalScrollbarThickness;
var borderBoxWidth = contentWidth + horizontalPadding + verticalScrollbarThickness + horizontalBorderArea;
var borderBoxHeight = contentHeight + verticalPadding + horizontalScrollbarThickness + verticalBorderArea;
var boxes = freeze({
devicePixelContentBoxSize: size(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes),
borderBoxSize: size(borderBoxWidth, borderBoxHeight, switchSizes),
contentBoxSize: size(contentWidth, contentHeight, switchSizes),
contentRect: new DOMRectReadOnly(paddingLeft, paddingTop, contentWidth, contentHeight)
});
cache.set(target, boxes);
return boxes;
};
var calculateBoxSize = function (target, observedBox, forceRecalculation) {
var _a = calculateBoxSizes(target, forceRecalculation), borderBoxSize = _a.borderBoxSize,
contentBoxSize = _a.contentBoxSize, devicePixelContentBoxSize = _a.devicePixelContentBoxSize;
switch (observedBox) {
case ResizeObserverBoxOptions.DEVICE_PIXEL_CONTENT_BOX:
return devicePixelContentBoxSize;
case ResizeObserverBoxOptions.BORDER_BOX:
return borderBoxSize;
default:
return contentBoxSize;
}
};
var ResizeObserverEntry = (function () {
function ResizeObserverEntry(target) {
var boxes = calculateBoxSizes(target);
this.target = target;
this.contentRect = boxes.contentRect;
this.borderBoxSize = freeze([boxes.borderBoxSize]);
this.contentBoxSize = freeze([boxes.contentBoxSize]);
this.devicePixelContentBoxSize = freeze([boxes.devicePixelContentBoxSize]);
}
return ResizeObserverEntry;
}());
var calculateDepthForNode = function (node) {
if (isHidden(node)) {
return Infinity;
}
var depth = 0;
var parent = node.parentNode;
while (parent) {
depth += 1;
parent = parent.parentNode;
}
return depth;
};
var broadcastActiveObservations = function () {
var shallowestDepth = Infinity;
var callbacks = [];
resizeObservers.forEach(function processObserver(ro) {
if (ro.activeTargets.length === 0) {
return;
}
var entries = [];
ro.activeTargets.forEach(function processTarget(ot) {
var entry = new ResizeObserverEntry(ot.target);
var targetDepth = calculateDepthForNode(ot.target);
entries.push(entry);
ot.lastReportedSize = calculateBoxSize(ot.target, ot.observedBox);
if (targetDepth < shallowestDepth) {
shallowestDepth = targetDepth;
}
});
callbacks.push(function resizeObserverCallback() {
ro.callback.call(ro.observer, entries, ro.observer);
});
ro.activeTargets.splice(0, ro.activeTargets.length);
});
for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {
var callback = callbacks_1[_i];
callback();
}
return shallowestDepth;
};
var gatherActiveObservationsAtDepth = function (depth) {
resizeObservers.forEach(function processObserver(ro) {
ro.activeTargets.splice(0, ro.activeTargets.length);
ro.skippedTargets.splice(0, ro.skippedTargets.length);
ro.observationTargets.forEach(function processTarget(ot) {
if (ot.isActive()) {
if (calculateDepthForNode(ot.target) > depth) {
ro.activeTargets.push(ot);
} else {
ro.skippedTargets.push(ot);
}
}
});
});
};
var process = function () {
var depth = 0;
gatherActiveObservationsAtDepth(depth);
while (hasActiveObservations()) {
depth = broadcastActiveObservations();
gatherActiveObservationsAtDepth(depth);
}
if (hasSkippedObservations()) {
deliverResizeLoopError();
}
return depth > 0;
};
var trigger;
var callbacks = [];
var notify = function () {
return callbacks.splice(0).forEach(function (cb) {
return cb();
});
};
var queueMicroTask = function (callback) {
if (!trigger) {
var toggle_1 = 0;
var el_1 = document.createTextNode('');
var config = { characterData: true };
new MutationObserver(function () {
return notify();
}).observe(el_1, config);
trigger = function () {
el_1.textContent = "".concat(toggle_1 ? toggle_1-- : toggle_1++);
};
}
callbacks.push(callback);
trigger();
};
var queueResizeObserver = function (cb) {
queueMicroTask(function ResizeObserver() {
requestAnimationFrame(cb);
});
};
var watching = 0;
var isWatching = function () {
return !!watching;
};
var CATCH_PERIOD = 250;
var observerConfig = { attributes: true, characterData: true, childList: true, subtree: true };
var events = ['resize', 'load', 'transitionend', 'animationend', 'animationstart', 'animationiteration', 'keyup', 'keydown', 'mouseup', 'mousedown', 'mouseover', 'mouseout', 'blur', 'focus'];
var time = function (timeout) {
if (timeout === void 0) {
timeout = 0;
}
return Date.now() + timeout;
};
var scheduled = false;
var Scheduler = (function () {
function Scheduler() {
var _this = this;
this.stopped = true;
this.listener = function () {
return _this.schedule();
};
}
var animationName = "resizeanim";
var animationKeyframes = "@" + keyframeprefix + "keyframes " + animationName + " { from { opacity: 0; } to { opacity: 0; } } ";
var animationStyle = keyframeprefix + "animation: 1ms " + animationName + "; ";
}
Scheduler.prototype.run = function (timeout) {
var _this = this;
if (timeout === void 0) {
timeout = CATCH_PERIOD;
}
if (scheduled) {
return;
}
scheduled = true;
var until = time(timeout);
queueResizeObserver(function () {
var elementsHaveResized = false;
try {
elementsHaveResized = process();
} finally {
scheduled = false;
timeout = until - time();
if (!isWatching()) {
return;
}
if (elementsHaveResized) {
_this.run(1000);
} else if (timeout > 0) {
_this.run(timeout);
} else {
_this.start();
}
}
});
};
Scheduler.prototype.schedule = function () {
this.stop();
this.run();
};
Scheduler.prototype.observe = function () {
var _this = this;
var cb = function () {
return _this.observer && _this.observer.observe(document.body, observerConfig);
};
document.body ? cb() : global.addEventListener('DOMContentLoaded', cb);
};
Scheduler.prototype.start = function () {
var _this = this;
if (this.stopped) {
this.stopped = false;
this.observer = new MutationObserver(this.listener);
this.observe();
events.forEach(function (name) {
return global.addEventListener(name, _this.listener, true);
});
}
};
Scheduler.prototype.stop = function () {
var _this = this;
if (!this.stopped) {
this.observer && this.observer.disconnect();
events.forEach(function (name) {
return global.removeEventListener(name, _this.listener, true);
});
this.stopped = true;
}
};
return Scheduler;
}());
var scheduler = new Scheduler();
var updateCount = function (n) {
!watching && n > 0 && scheduler.start();
watching += n;
!watching && scheduler.stop();
};
var createStyles = function () {
if (!stylesCreated) {
// opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
var css = (animationKeyframes ? animationKeyframes : "") +
".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " +
".resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }",
head = document.head || document.getElementsByTagName("head")[0],
style = document.createElement("style");
var skipNotifyOnElement = function (target) {
return !isSVG(target) && !isReplacedElement(target) && getComputedStyle(target).display === 'inline';
};
var ResizeObservation = (function () {
function ResizeObservation(target, observedBox) {
this.target = target;
this.observedBox = observedBox || ResizeObserverBoxOptions.CONTENT_BOX;
this.lastReportedSize = {
inlineSize: -1, blockSize: -1
};
}
style.type = "text/css";
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
ResizeObservation.prototype.isActive = function () {
var size = calculateBoxSize(this.target, this.observedBox, true);
if (skipNotifyOnElement(this.target)) {
this.lastReportedSize = size;
}
if (this.lastReportedSize.inlineSize !== size.inlineSize || this.lastReportedSize.blockSize !== size.blockSize) {
return true;
}
return false;
};
return ResizeObservation;
}());
var ResizeObserverDetail = (function () {
function ResizeObserverDetail(resizeObserver, callback) {
this.activeTargets = [];
this.skippedTargets = [];
this.observationTargets = [];
this.observer = resizeObserver;
this.callback = callback;
}
head.appendChild(style);
stylesCreated = true;
return ResizeObserverDetail;
}());
var observerMap = new WeakMap();
var getObservationIndex = function (observationTargets, target) {
for (var i = 0; i < observationTargets.length; i += 1) {
if (observationTargets[i].target === target) {
return i;
}
}
return -1;
};
var ResizeObserverController = (function () {
function ResizeObserverController() {
}
ResizeObserverController.connect = function (resizeObserver, callback) {
var detail = new ResizeObserverDetail(resizeObserver, callback);
observerMap.set(resizeObserver, detail);
};
ResizeObserverController.observe = function (resizeObserver, target, options) {
var detail = observerMap.get(resizeObserver);
var firstObservation = detail.observationTargets.length === 0;
if (getObservationIndex(detail.observationTargets, target) < 0) {
firstObservation && resizeObservers.push(detail);
detail.observationTargets.push(new ResizeObservation(target, options && options.box));
updateCount(1);
scheduler.schedule();
}
};
ResizeObserverController.unobserve = function (resizeObserver, target) {
var detail = observerMap.get(resizeObserver);
var index = getObservationIndex(detail.observationTargets, target);
var lastObservation = detail.observationTargets.length === 1;
if (index >= 0) {
lastObservation && resizeObservers.splice(resizeObservers.indexOf(detail), 1);
detail.observationTargets.splice(index, 1);
updateCount(-1);
}
};
ResizeObserverController.disconnect = function (resizeObserver) {
var _this = this;
var detail = observerMap.get(resizeObserver);
detail.observationTargets.slice().forEach(function (ot) {
return _this.unobserve(resizeObserver, ot.target);
});
detail.activeTargets.splice(0, detail.activeTargets.length);
};
return ResizeObserverController;
}());
var ResizeObserver = (function () {
function ResizeObserver(callback) {
if (arguments.length === 0) {
throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
}
if (typeof callback !== 'function') {
throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");
}
ResizeObserverController.connect(this, callback);
}
ResizeObserver.prototype.observe = function (target, options) {
if (arguments.length === 0) {
throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");
}
if (!isElement(target)) {
throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");
}
ResizeObserverController.observe(this, target, options);
};
ResizeObserver.prototype.unobserve = function (target) {
if (arguments.length === 0) {
throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");
}
if (!isElement(target)) {
throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");
}
ResizeObserverController.unobserve(this, target);
};
ResizeObserver.prototype.disconnect = function () {
ResizeObserverController.disconnect(this);
};
ResizeObserver.toString = function () {
return 'function ResizeObserver () { [polyfill code] }';
};
return ResizeObserver;
}());
exports.ResizeObserver = ResizeObserver;
exports.ResizeObserverEntry = ResizeObserverEntry;
exports.ResizeObserverSize = ResizeObserverSize;
Object.defineProperty(exports, '__esModule', { value: true });
return exports;
})({});
var ResizeObserver = window.ResizeObserver || ResizeObserverPolyfill.ResizeObserver;
!(function () {
var addResizeListener = function (element, fn) {
if (window.ResizeObserver) {
if (ResizeObserver) {
if (!element.__resizeObserver__) {
var resizeObserver = new window.ResizeObserver(function () {
var resizeObserver = new ResizeObserver(function () {
element.__resizeListeners__.forEach(function (listener) {
listener();
BI.$(element).is(":visible") && listener();
});
});
resizeObserver.observe(element);
@ -126,47 +563,24 @@
element.__resizeListeners__ = [];
}
element.__resizeListeners__.push(fn);
} else if (attachEvent) {
element.attachEvent("onresize", fn);
BI.nextTick(fn);
} else {
if (!element.__resizeTriggers__) {
if (getComputedStyle(element).position === "static") element.style.position = "relative";
createStyles();
element.__resizeLast__ = {};
element.__resizeListeners__ = [];
(element.__resizeTriggers__ = document.createElement("div")).className = "resize-triggers";
element.__resizeTriggers__.innerHTML = "<div class=\"expand-trigger\"><div></div></div>" +
"<div class=\"contract-trigger\"></div>";
element.appendChild(element.__resizeTriggers__);
resetTriggers(element);
element.addEventListener("scroll", scrollListener, true);
/* Listen for a css animation to detect element display/re-attach */
animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) {
if (e.animationName === animationName) {resetTriggers(element);}
});
}
element.__resizeListeners__.push(fn);
}
};
var removeResizeListener = function (element, fn) {
if (window.ResizeObserver) {
if (ResizeObserver) {
if (BI.isNull(fn)) {
element.__resizeListeners__ = [];
element.__resizeObserver__ && element.__resizeObserver__.unobserve(element);
element.__resizeObserver__ = null;
return;
}
var index = element.__resizeListeners__.indexOf(fn);
if (index >= 0) {
element.__resizeListeners__.splice(index, 1);
if (!element.__resizeListeners__.length) {
element.__resizeObserver__ && element.__resizeObserver__.unobserve(element);
element.__resizeObserver__ = null;
}
}
} else if (attachEvent) {
element.detachEvent("onresize", fn);
} else {
element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
if (!element.__resizeListeners__.length) {
element.removeEventListener("scroll", scrollListener);
element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__);
}
}
};
@ -176,8 +590,7 @@
return function () {
removeResizeListener(widget.element[0], fn);
};
},
removeResizeListener: function (widget, fn) {
}, removeResizeListener: function (widget, fn) {
removeResizeListener(widget.element[0], fn);
}
};

4
src/core/utils/events/mousemovetracker.js

@ -44,7 +44,7 @@
this._x = event.clientX;
this._y = event.clientY;
}
event.preventDefault ? event.preventDefault() : (event.returnValue = false);
// event.preventDefault ? event.preventDefault() : (event.returnValue = false);
},
releaseMouseMoves: function () {
@ -104,4 +104,4 @@
this._onMoveEnd();
}
};
})();
})();

10
src/core/wrapper/layout.js

@ -42,16 +42,16 @@ BI.Layout = BI.inherit(BI.Widget, {
_init4Margin: function () {
if (this.options.top) {
this.element.css("top", BI.isNumber(this.options.top) ? this.options.top / BI.pixRatio + BI.pixUnit : this.options.top);
this.element.css("top", BI.pixFormat(this.options.top));
}
if (this.options.left) {
this.element.css("left", BI.isNumber(this.options.left) ? this.options.left / BI.pixRatio + BI.pixUnit : this.options.left);
this.element.css("left", BI.pixFormat(this.options.left));
}
if (this.options.bottom) {
this.element.css("bottom", BI.isNumber(this.options.bottom) ? this.options.bottom / BI.pixRatio + BI.pixUnit : this.options.bottom);
this.element.css("bottom", BI.pixFormat(this.options.bottom));
}
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.pixFormat(this.options.right));
}
},
@ -289,7 +289,7 @@ BI.Layout = BI.inherit(BI.Widget, {
},
_optimiseGap: function (gap) {
return (gap > 0 && gap < 1) ? (gap * 100).toFixed(1) + "%" : gap / BI.pixRatio + BI.pixUnit;
return (gap > 0 && gap < 1) ? (gap * 100).toFixed(1) + "%" : BI.pixFormat(gap);
},
_optimiseItemLgap: function (item) {

8
src/core/wrapper/layout/layout.flow.js

@ -137,16 +137,16 @@ BI.FloatRightLayout = BI.inherit(BI.Layout, {
var w = BI.FloatRightLayout.superclass._addElement.apply(this, arguments);
w.element.css({position: "relative", float: "right"});
if (BI.isNotNull(item.left)) {
w.element.css({left: BI.isNumber(item.left) ? item.left / BI.pixRatio + BI.pixUnit : item.left});
w.element.css({left: BI.pixFormat(item.left)});
}
if (BI.isNotNull(item.right)) {
w.element.css({right: BI.isNumber(item.right) ? item.right / BI.pixRatio + BI.pixUnit : item.right});
w.element.css({right: BI.pixFormat(item.right)});
}
if (BI.isNotNull(item.top)) {
w.element.css({top: BI.isNumber(item.top) ? item.top / BI.pixRatio + BI.pixUnit : item.top});
w.element.css({top: BI.pixFormat(item.top)});
}
if (BI.isNotNull(item.bottom)) {
w.element.css({bottom: BI.isNumber(item.bottom) ? item.bottom / BI.pixRatio + BI.pixUnit : item.bottom});
w.element.css({bottom: BI.pixFormat(item.bottom)});
}
if (o.vgap + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item) !== 0) {
var top = o.vgap / 2 + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item);

8
src/core/wrapper/layout/layout.inline.js

@ -47,7 +47,7 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
}
}
if (columnSize > 0) {
w.element.width(columnSize < 1 ? ((columnSize * 100).toFixed(1) + "%") : (columnSize / BI.pixRatio + BI.pixUnit));
w.element.width(columnSize < 1 ? ((columnSize * 100).toFixed(1) + "%") : BI.pixFormat(columnSize));
}
w.element.css({
position: "relative",
@ -69,8 +69,8 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
gap += o.hgap + o.lgap + o.rgap + this._optimiseItemLgap(o.items[k]) + this._optimiseItemRgap(o.items[k]) + this._optimiseItemHgap(o.items[k]);
length += cz;
}
length = length > 0 && length < 1 ? (length * 100).toFixed(1) + "%" : length / BI.pixRatio + BI.pixUnit;
gap = gap > 0 && gap < 1 ? (gap * 100).toFixed(1) + "%" : gap / BI.pixRatio + BI.pixUnit;
length = length > 0 && length < 1 ? (length * 100).toFixed(1) + "%" : BI.pixFormat(length);
gap = gap > 0 && gap < 1 ? (gap * 100).toFixed(1) + "%" : BI.pixFormat(gap);
if (columnSize === "fill") {
w.element.css("min-width", "calc((100% - " + length + " - " + gap + ")" + (fillCount > 1 ? "/" + fillCount : "") + ")");
}
@ -86,7 +86,7 @@ BI.InlineLayout = BI.inherit(BI.Layout, {
if (o.verticalAlign === BI.VerticalAlign.Stretch && BI.isNull(item.height)) {
var top = o.innerVgap + o.vgap + o.tgap + this._optimiseItemTgap(item) + this._optimiseItemVgap(item),
bottom = o.innerVgap + o.vgap + o.bgap + this._optimiseItemBgap(item) + this._optimiseItemVgap(item);
var gap = (top + bottom) > 0 && (top + bottom) < 1 ? ((top + bottom) * 100).toFixed(1) + "%" : (top + bottom) / BI.pixRatio + BI.pixUnit;
var gap = (top + bottom) > 0 && (top + bottom) < 1 ? ((top + bottom) * 100).toFixed(1) + "%" : BI.pixFormat(top + bottom);
w.element.css("height", "calc(100% - " + gap + ")");
}
return w;

4
src/core/wrapper/layout/layout.tape.js

@ -92,7 +92,7 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
left: self._optimiseGap(left[i] + self._optimiseItemLgap(item) + self._optimiseItemHgap(item) + o.hgap + o.lgap)
});
if (columnSize === "" || columnSize === "fill") {
if (BI.isNull(columnSize) || columnSize === "" || columnSize === "fill") {
return true;
}
});
@ -110,7 +110,7 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
right: self._optimiseGap(right[i] + self._optimiseItemRgap(item) + self._optimiseItemHgap(item) + o.hgap + o.rgap)
});
if (columnSize === "" || columnSize === "fill") {
if (BI.isNull(columnSize) || columnSize === "" || columnSize === "fill") {
return true;
}
});

2
src/core/wrapper/layout/responsive/responsive.flex.horizontal.js

@ -51,7 +51,7 @@ BI.ResponsiveFlexHorizontalLayout = BI.inherit(BI.FlexHorizontalLayout, {
},
destroyed: function () {
this.unResize();
this.unResize?.();
}
});
BI.shortcut("bi.responsive_flex_horizontal", BI.ResponsiveFlexHorizontalLayout);

28
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, 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: ""

28
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, 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: ""

3
src/less/base/combo/combo.less

@ -12,9 +12,6 @@
}
&.bi-combo-popup {
display: block !important;
visibility: visible !important;
& > .bi-trigger {
& .bi-trigger-icon-button {
& .x-icon {

11
src/less/base/single/button/button.half.less

@ -6,10 +6,13 @@
&:after {
position: absolute;
left: 2px;
top: 2px;
width: 8px;
height: 8px;
.border-radius(2px);
display: table;
left: 50%;
top: 50%;
width: 70%;
height: 70%;
.transform(translate(-50%, -50%));
background-color: @color-bi-background-half-button-content;
content: '';
}

7
src/less/base/single/editor/editor.textarea.less

@ -6,10 +6,11 @@
white-space: pre-wrap;
word-break: break-all;
font-size: @font-size-12;
font-size: calc(var(--css-scale, 1) * @font-size-12);
line-height: 21px;
& {
border: none;
}
line-height: calc(var(--css-scale, 1) * 21px);
border: none;
}
& .textarea-watermark{
max-height: 100%;

13
src/less/base/single/input/checkbox.less

@ -6,20 +6,21 @@
border: 1px solid @color-bi-border-checkbox;
.box-sizing(border-box);
.transition(all .1s);
&:after {
position: absolute;
display: table;
// 百分比会出现像素误差
top: 6px;
left: 2px;
top: 45%;
left: 18%;
border: 2px solid transparent;
border: calc(var(--css-scale, 1) * 2px) solid transparent;
border-top: 0;
border-left: 0;
width: 6px;
height: 9px;
width: 50%;
height: 75%;
.box-sizing(border-box);
.transform(rotate(45deg) scale(1) translate(-50%, -50%));
@transition: all .1s cubic-bezier(.71,-.46,.88,.6),opacity .1s;
@transition: all .1s cubic-bezier(.71, -.46, .88, .6), opacity .1s;
.transition(@transition);
content: '';
}

13
src/less/base/single/input/radio.less

@ -2,13 +2,15 @@
.bi-radio {
& .radio-content, &.radio-content {
.border-radius(8px);
.border-radius(50%);
border: 1px solid @color-bi-border-radio;
.box-sizing(border-box);
.transition(all .1s);
&:after {
content: "";
}
&.hover, &:hover {
border-color: @color-bi-border-hover-active-radio;
}
@ -18,16 +20,15 @@
border-color: @color-bi-border-hover-active-radio;
background-color: @color-bi-background-active-radio;
&:after {
width: 8px;
height: 8px;
display: table;
width: 50%;
height: 50%;
position: absolute;
top: 50%;
left: 50%;
.border-radius(4px);
.border-radius(50%);
background-color: @color-bi-background-active-radio-content;
.transform(translate(-50%, -50%));
@transition: all .1s cubic-bezier(.71,-.46,.88,.6),opacity .1s;
@transition: all .1s cubic-bezier(.71, -.46, .88, .6), opacity .1s;
.transition(@transition);
}
}

31
src/less/base/single/instruction.less

@ -0,0 +1,31 @@
@import "../../index.less";
.bi-instruction {
.border-radius(2px);
&.instruction-error{
background: @color-bi-background-bubble-error;
color: @color-bi-text-failure;
}
&.instruction-common{
background: @color-bi-background-bubble-normal;
color: @color-bi-text-highlight;
}
&.instruction-success{
background: @color-bi-background-bubble-success;
color: @color-bi-text-success;
}
&.instruction-warning{
background: @color-bi-background-bubble-warning;
color: @color-bi-text-redmark;
}
}
.bi-theme-dark {
.bi-instruction.instruction-error {
background: @color-bi-background-bubble-error-theme-dark;
}
}

10
src/less/base/single/tip/tip.bubble.less

@ -9,10 +9,6 @@
color: @color-bi-text-failure;
}
.bi-theme-dark &.bubble-error {
background: @color-bi-background-bubble-error-theme-dark;
}
&.bubble-common{
background: @color-bi-background-bubble-normal;
color: @color-bi-text-highlight;
@ -28,3 +24,9 @@
color: @color-bi-text-redmark;
}
}
.bi-theme-dark {
.bi-bubble.bubble-error {
background: @color-bi-background-bubble-error-theme-dark;
}
}

296
src/less/base/tree/ztree.less

@ -1,5 +1,10 @@
@import "../../index.less";
.use-scale(@property, @pix) {
@{property} : @pix; //不支持css变量的浏览器
@{property} : calc(var(--css-scale, 1) * @pix);
}
.ztree * {
padding: 0;
margin: 0;
@ -27,7 +32,7 @@
.ztree.solid li ul {
margin: 0;
padding: 0 0 0 24px
.use-scale(padding-left, 24px);
}
// 此处不用2倍图,改用css画虚线
@ -50,7 +55,7 @@
&:before {
border-left: 1px solid @border-color-dark-gray-line;
height: 100%;
left: 14px;
.use-scale(left, 14px);
margin-top: 0;
}
}
@ -67,6 +72,27 @@
border-left: 1px solid @border-color-dark-gray-line-theme-dark;
}
}
&.bi-checkbox {
border: 1px solid @color-bi-border-checkbox-theme-dark;
&.active {
background-color: @color-bi-background-active-checkbox-theme-dark;
border-color: @color-bi-border-hover-active-checkbox-theme-dark;
}
&.disabled {
background-color: @color-bi-background-disabled-checkbox-theme-dark;
&.active {
border-color: @color-bi-border-disabled-checkbox-theme-dark;
}
}
}
&.bi-half-button {
border: 1px solid @color-bi-border-hover-active-checkbox-theme-dark;
}
}
.ztree li a {
@ -92,35 +118,8 @@
}
.ztree.solid li a {
height: 30px;
}
.ztree li a.curSelectedNode {
}
.ztree li a.curSelectedNode_Edit {
padding-top: 0px;
background-color: #FFE6B0;
color: black;
height: 16px;
border: 1px #FFB951 solid;
opacity: 0.8;
}
.ztree li a.tmpTargetNode_inner {
padding-top: 0px;
background-color: #316AC5;
color: white;
height: 16px;
border: 1px #316AC5 solid;
opacity: 0.8;
filter: alpha(opacity=80)
}
.ztree li a.tmpTargetNode_prev {
}
.ztree li a.tmpTargetNode_next {
//height: 30px;
.use-scale(height, 30px);
}
.ztree li a input.rename {
@ -142,7 +141,8 @@
}
.ztree.solid li span {
line-height: 30px;
//line-height: 30px;
.use-scale(line-height, 30px);
}
.ztree li span.icon {
@ -162,10 +162,6 @@
vertical-align: middle;
border: 0 none;
cursor: pointer;
outline: none;
background-color: transparent;
background-repeat: no-repeat;
background-attachment: scroll;
}
.ztree li span.button.chk {
@ -194,57 +190,100 @@
}
}
.ztree li span.button.chk {
.ztree.solid li span.button.roots_docu {
background: none;
position: relative;
width: 14px;
height: 14px;
margin: 0 3px 0 0;
cursor: auto
}
.ztree li span.button.chk.checkbox_false_disable {
background-position: 0 -56px
}
&:before {
position: absolute;
bottom: 0;
left: -1px;
width: 50%;
height: 50%;
border-right: 1px solid @border-color-dark-gray-line;
content: '';
}
.ztree li span.button.chk.checkbox_true_disable {
background-position: -14px -56px
&:after {
position: absolute;
top: 0;
right: 0;
height: 50%;
width: 50%;
border-bottom: 1px solid @border-color-dark-gray-line;
content: '';
}
}
.ztree li span.button.chk.radio_false_full {
background-position: -28px 0
}
.ztree.solid li span.button.center_docu {
background: none;
position: relative;
.ztree li span.button.chk.radio_false_full_focus {
background-position: -28px -14px
}
&:before {
position: absolute;
top: 0;
left: -1px;
width: 50%;
height: 100%;
border-right: 1px solid @border-color-dark-gray-line;
content: '';
}
.ztree li span.button.chk.radio_false_part {
background-position: -28px -28px
&:after {
position: absolute;
top: 0;
right: 0;
height: 50%;
width: 50%;
border-bottom: 1px solid @border-color-dark-gray-line;
content: '';
}
}
.ztree li span.button.chk.radio_false_part_focus {
background-position: -28px -42px
}
.ztree.solid li span.button.bottom_docu {
background: none;
position: relative;
.ztree li span.button.chk.radio_false_disable {
background-position: -28px -56px
}
&:before {
position: absolute;
top: 0;
left: -1px;
width: 50%;
height: 50%;
border-right: 1px solid @border-color-dark-gray-line;
content: '';
}
.ztree li span.button.chk.radio_true_full {
background-position: -42px 0
&:after {
position: absolute;
top: 0;
right: 1px;
height: 50%;
width: 50%;
border-bottom: 1px solid @border-color-dark-gray-line;
content: '';
}
}
.ztree li span.button.chk.radio_true_full_focus {
background-position: -42px -14px;
}
.bi-theme-dark {
.ztree.solid li span.button.center_docu, .ztree.solid li span.button.bottom_docu {
&:before {
border-right: 1px solid @border-color-dark-gray-line-theme-dark;
}
.ztree li span.button.chk.radio_true_part {
background-position: -42px -28px
&:after {
border-bottom: 1px solid @border-color-dark-gray-line-theme-dark;
}
}
}
.ztree li span.button.chk.radio_true_part_focus {
background-position: -42px -42px
.ztree li span.button.chk {
position: relative;
.use-scale(width, 14px);
.use-scale(height, 14px);
margin: 0 3px 0 0;
cursor: auto
}
.ztree li span.button.chk.checkbox_true_full {
@ -271,73 +310,16 @@
}
}
.ztree li span.button.chk.radio_true_disable {
background-position: -42px -56px
}
.ztree li span.button.switch {
width: 24px;
height: 24px
}
.ztree.solid li span.button.switch {
width: 30px;
height: 30px
}
.ztree li span.button.switch.noline_open {
width: 0;
}
.ztree li span.button.switch.noline_close {
width: 0;
}
.ztree li span.button.noline_open {
background-position: -92px -72px
}
.ztree li span.button.noline_close {
background-position: -74px -72px
}
.ztree li span.button.root_docu {
background: none;
}
.ztree li span.button.noline_docu {
background: none;
width: 0;
}
.ztree li span.button.ico_open {
margin-right: 2px;
background-position: -110px -16px;
vertical-align: top;
}
.ztree li span.button.ico_close {
margin-right: 2px;
background-position: -110px 0;
vertical-align: top;
}
.ztree li span.button.ico_docu {
margin-right: 2px;
background-position: -110px -32px;
vertical-align: top;
}
.ztree li span.button.edit {
margin-right: 2px;
background-position: -110px -48px;
vertical-align: top;
}
.ztree li span.button.remove {
margin-right: 2px;
background-position: -110px -64px;
vertical-align: top;
.use-scale(width, 30px);
.use-scale(height, 30px);
//width: 30px;
//height: 30px;
}
.ztree li span.button.ico_loading {
@ -345,53 +327,3 @@
margin-right: 2px;
vertical-align: top;
}
ul.tmpTargetzTree {
background-color: #FFE6B0;
opacity: 0.8;
filter: alpha(opacity=80)
}
span.tmpzTreeMove_arrow {
width: 16px;
height: 16px;
display: inline-block;
padding: 0;
margin: 2px 0 0 1px;
border: 0 none;
position: absolute;
background-color: transparent;
background-repeat: no-repeat;
background-attachment: scroll;
background-position: -110px -80px;
}
ul.ztree.zTreeDragUL {
margin: 0;
padding: 0;
position: absolute;
width: auto;
height: auto;
overflow: hidden;
background-color: #cfcfcf;
border: 1px #00B83F dotted;
opacity: 0.8;
filter: alpha(opacity=80)
}
.zTreeMask {
z-index: 10000;
background-color: #cfcfcf;
opacity: 0.0;
filter: alpha(opacity=0);
position: absolute
}
/* level style*/
/*.ztree li span.button.level0 {
display:none;
}
.ztree li ul.level0 {
padding:0;
background:none;
}*/

90
src/less/case/tree/tree.item.less

@ -0,0 +1,90 @@
@import "../../index.less";
.tree-first-solid-line-conn-background {
&:before {
position: absolute;
bottom: 0;
left: -1px;
width: 50%;
height: 50%;
border-right: 1px solid @border-color-dark-gray-line;
content: '';
}
&:after {
position: absolute;
top: 0;
right: 0;
height: 50%;
width: 50%;
border-bottom: 1px solid @border-color-dark-gray-line;
content: '';
}
}
.tree-mid-solid-line-conn-background {
&:before {
position: absolute;
top: 0;
left: -1px;
width: 50%;
height: 100%;
border-right: 1px solid @border-color-dark-gray-line;
content: '';
}
&:after {
position: absolute;
top: 0;
right: 0;
height: 50%;
width: 50%;
border-bottom: 1px solid @border-color-dark-gray-line;
content: '';
}
}
.tree-last-solid-line-conn-background {
&:before {
position: absolute;
top: 0;
left: -1px;
width: 50%;
height: 50%;
border-right: 1px solid @border-color-dark-gray-line;
content: '';
}
&:after {
position: absolute;
top: 0;
right: 1px;
height: 50%;
width: 50%;
border-bottom: 1px solid @border-color-dark-gray-line;
content: '';
}
}
.bi-theme-dark {
.tree-first-solid-line-conn-background, .tree-mid-solid-line-conn-background {
&:before {
border-right: 1px solid @border-color-dark-gray-line-theme-dark;
}
&:after {
border-bottom: 1px solid @border-color-dark-gray-line-theme-dark;
}
}
.tree-last-solid-line-conn-background {
&:before {
border-right: 1px solid @border-color-dark-gray-line-theme-dark;
}
&:after {
border-bottom: 1px solid @border-color-dark-gray-line-theme-dark;
}
}
}

28
src/less/core/utils/common.less

@ -74,9 +74,10 @@
border-color: @color-bi-border-highlight;
}
// ie下不支持focus-within, 和上面写在一起会导致ie下:hover不生效
&:focus-within{
&:focus-within {
border-color: @color-bi-border-highlight;
}
&.disabled {
&:hover {
border-color: @border-color-line;
@ -84,6 +85,14 @@
}
}
.base-disabled {
.bi-focus-shadow {
&:hover {
border-color: @border-color-line;
}
}
}
.bi-theme-dark {
.bi-focus-shadow {
&.disabled {
@ -94,6 +103,16 @@
}
}
.bi-theme-dark {
.base-disabled {
.bi-focus-shadow {
&:hover {
border-color: @border-color-line-theme-dark;
}
}
}
}
.clearfix {
.clearfix();
}
@ -102,6 +121,7 @@
.bi-background {
background-color: @color-bi-background-normal;
color: @color-bi-text-background;
& .bi-input {
color: @color-bi-text-background;
}
@ -570,7 +590,7 @@
// hover-visible的原子化形式
.bi-hover-visible-container {
&:where(:not(&:hover)) .bi-hover-visible-item {
&:where(:not(&:hover)) .bi-hover-visible-item:not(.bi-combo-popup) {
display: none;
}
@ -591,11 +611,11 @@
// }
//}
& .bi-hover-visible-item {
& .bi-hover-visible-item:not(.bi-combo-popup) {
visibility: hidden;
}
&:hover .bi-hover-visible-item {
&:hover .bi-hover-visible-item:not(.bi-combo-popup) {
visibility: visible;
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save