Browse Source

Merge pull request #204404 in DEC/fineui from bugfix/11.0 to release/11.0

* commit '770dcc66defb9c30db150100f4bc4ff7d58b24d0': (121 commits)
  auto upgrade version to 2.0.20221024153423
  update
  auto upgrade version to 2.0.20221024105424
  auto upgrade version to 2.0.20221024101340
  无JIRA fix: 修复tape布局 NaN的场景
  auto upgrade version to 2.0.20221023144426
  update
  ThemeProvider
  Revert "无JIRA fix: _initElementHeight和_initElementWidth方法修复"
  无JIRA fix: 文本过滤组件
  auto upgrade version to 2.0.20221023105429
  反了
  auto upgrade version to 2.0.20221022222430
  bugfix
  bugfix
  toPix 和 pixFormat
  无JIRA fix: _initElementHeight和_initElementWidth方法修复
  auto upgrade version to 2.0.20221022202435
  auto upgrade version to 2.0.20221022183431
  增加toPix方法
  ...
research/test
superman 2 years ago
parent
commit
3a795f4d72
  1. 67
      _mobile/date.i18n.cn.js
  2. 2
      demo/less/face.less
  3. 11
      demo/less/main.less
  4. 2
      demo/less/north.less
  5. 4
      dist/fix/fix.compact.js
  6. 99
      examples/ThemeProvider.html
  7. 59
      examples/useContext.html
  8. 12
      examples/响应式布局.html
  9. 2
      package.json
  10. 19
      src/base/collection/collection.js
  11. 7
      src/base/combination/group.button.js
  12. 5
      src/base/combination/navigation.js
  13. 2
      src/base/combination/tab.js
  14. 20
      src/base/context.js
  15. 19
      src/base/grid/grid.js
  16. 16
      src/base/layer/layer.popup.js
  17. 3
      src/base/list/listview.js
  18. 9
      src/base/list/virtualgrouplist.js
  19. 12
      src/base/list/virtuallist.js
  20. 19
      src/base/single/0.single.js
  21. 14
      src/base/single/1.text.js
  22. 2
      src/base/single/button/buttons/button.icon.js
  23. 18
      src/base/single/button/buttons/button.js
  24. 1
      src/base/single/button/buttons/button.text.js
  25. 1
      src/base/single/button/listitem/blankiconicontextitem.js
  26. 1
      src/base/single/button/listitem/blankicontexticonitem.js
  27. 1
      src/base/single/button/listitem/blankicontextitem.js
  28. 1
      src/base/single/button/listitem/icontexticonitem.js
  29. 1
      src/base/single/button/listitem/icontextitem.js
  30. 1
      src/base/single/button/listitem/texticonitem.js
  31. 1
      src/base/single/button/listitem/textitem.js
  32. 1
      src/base/single/button/node/icontexticonnode.js
  33. 1
      src/base/single/button/node/icontextnode.js
  34. 1
      src/base/single/button/node/texticonnode.js
  35. 1
      src/base/single/button/node/textnode.js
  36. 5
      src/base/single/editor/editor.js
  37. 15
      src/base/single/html/html.js
  38. 8
      src/base/single/label/abstract.label.js
  39. 2
      src/base/single/label/icon.label.js
  40. 4
      src/base/single/tip/tip.toast.js
  41. 2
      src/base/single/tip/tip.tooltip.js
  42. 6
      src/case/button/node/siwtcher.tree.node.js
  43. 6
      src/case/button/treeitem/treeitem.js
  44. 4
      src/case/calendar/calendar.date.item.js
  45. 4
      src/case/calendar/calendar.js
  46. 4
      src/case/colorchooser/colorchooser.js
  47. 6
      src/case/combo/icontextvaluecombo/combo.icontextvalue.js
  48. 9
      src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js
  49. 6
      src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js
  50. 6
      src/case/combo/textvaluecombo/combo.textvalue.js
  51. 24
      src/case/editor/editor.shelter.js
  52. 24
      src/case/editor/editor.sign.js
  53. 24
      src/case/editor/editor.state.js
  54. 4
      src/case/layer/panel.js
  55. 2
      src/case/linearsegment/button.linear.segment.js
  56. 2
      src/case/list/list.select.js
  57. 3
      src/case/segment/button.segment.js
  58. 2
      src/case/segment/segment.js
  59. 4
      src/case/tree/treeexpander/tree.expander.popup.js
  60. 8
      src/case/trigger/trigger.editor.js
  61. 20
      src/case/trigger/trigger.icon.text.js
  62. 5
      src/case/trigger/trigger.text.js
  63. 3
      src/case/trigger/trigger.text.select.small.js
  64. 2
      src/case/trigger/trigger.text.small.js
  65. 4
      src/core/2.base.js
  66. 33
      src/core/3.ob.js
  67. 61
      src/core/4.widget.js
  68. 22
      src/core/5.inject.js
  69. 66
      src/core/constant/date.i18n.js
  70. 26
      src/core/constant/var.js
  71. 5
      src/core/controller/controller.popover.js
  72. 5
      src/core/controller/controller.tooltips.js
  73. 2
      src/core/func/alias.js
  74. 73
      src/core/func/date.js
  75. 675
      src/core/platform/web/detectElementResize.js
  76. 10
      src/core/wrapper/layout.js
  77. 8
      src/core/wrapper/layout/layout.flow.js
  78. 8
      src/core/wrapper/layout/layout.inline.js
  79. 4
      src/core/wrapper/layout/layout.tape.js
  80. 2
      src/core/wrapper/layout/responsive/responsive.flex.horizontal.js
  81. 3
      src/less/base/combo/combo.less
  82. 7
      src/less/base/single/editor/editor.textarea.less
  83. 21
      src/less/base/tree/ztree.less
  84. 67
      src/less/case/tree/tree.item.less
  85. 6
      src/less/core/utils/common.less
  86. 6
      src/less/core/wrapper/inline.less
  87. 18
      src/less/core/wrapper/inline.old.less
  88. 49
      src/less/widget/singleslider/slider/widget.slider.less
  89. 3
      src/less/widget/year/popup.year.less
  90. 6
      src/widget/date/calendar/popup.month.js
  91. 10
      src/widget/dynamicdate/dynamicdate.combo.js
  92. 2
      src/widget/dynamicdate/dynamicdate.param.item.js
  93. 6
      src/widget/dynamicdate/dynamicdate.popup.js
  94. 3
      src/widget/dynamicdate/dynamicdate.trigger.js
  95. 8
      src/widget/dynamicdatetime/dynamicdatetime.combo.js
  96. 6
      src/widget/dynamicdatetime/dynamicdatetime.popup.js
  97. 42
      src/widget/dynamicdatetime/dynamicdatetime.trigger.js
  98. 4
      src/widget/editor/editor.search.js
  99. 12
      src/widget/editor/editor.text.js
  100. 149
      src/widget/intervalslider/intervalslider.js
  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];

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.20221024153423",
"description": "fineui",
"main": "dist/fineui_without_conflict.min.js",
"types": "dist/lib/index.d.ts",

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

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

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

5
src/base/combination/navigation.js

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

2
src/base/combination/tab.js

@ -72,7 +72,9 @@ BI.Tab = BI.inherit(BI.Widget, {
_assertCard: function (v) {
if (!this.layout.isCardExisted(v)) {
BI.Widget.pushContext(this);
var card = this.options.cardCreator(v);
BI.Widget.popContext();
this.cardMap[v] = card;
this.layout.addCardByName(v, card);
}

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);

19
src/base/grid/grid.js

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

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

3
src/base/list/listview.js

@ -131,7 +131,8 @@ BI.ListView = BI.inherit(BI.Widget, {
this._populate(items);
},
destroyed: function () {
beforeDestroy: function () {
BI.ResizeDetector.removeResizeListener(this);
this.restore();
},
});

9
src/base/list/virtualgrouplist.js

@ -119,7 +119,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 +127,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 +183,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);

12
src/base/list/virtuallist.js

@ -148,8 +148,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 +203,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,

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,

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-type3", "tree-expand-icon-type3"];
} 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-type4", "tree-expand-icon-type4"];
}
},

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,

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

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

4
src/case/layer/panel.js

@ -59,7 +59,7 @@ BI.Panel = BI.inherit(BI.Widget, {
el: {
type: "bi.left_right_vertical_adapt",
cls: "panel-title bi-header-background bi-border-bottom",
height: o.titleHeight - 1,
height: BI.toPix(o.titleHeight, 1),
items: {
left: [this.text],
right: [this.button_group]
@ -67,7 +67,7 @@ BI.Panel = BI.inherit(BI.Widget, {
lhgap: 10,
rhgap: 10
},
height: o.titleHeight - 1
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: ""
}
]
});

4
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));
}
@ -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 = [];

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 = {};
},
/**
* 触发绑定过的事件
*

61
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;
@ -892,18 +902,39 @@
};
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.execWithContext = function (_context, fn) {
BI.Widget.pushContext(_context);
try {
fn();
} catch (e) {
// nothing
}
BI.Widget.popContext();
};
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);

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

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)

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

@ -1,120 +1,557 @@
/**
* 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();
});
@ -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);
}
};

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);

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 {

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%;

21
src/less/base/tree/ztree.less

@ -67,6 +67,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 {

67
src/less/case/tree/tree.item.less

@ -0,0 +1,67 @@
@import "../../index.less";
.tree-first-solid-line-conn-background, .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;
}
}
}

6
src/less/core/utils/common.less

@ -570,7 +570,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 +591,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;
}
}

6
src/less/core/wrapper/inline.less

@ -15,10 +15,4 @@
display: inline-block !important;
}
}
& > .bi-combo {
&.bi-combo-popup {
display: inline-block !important;
}
}
}

18
src/less/core/wrapper/inline.old.less

@ -14,12 +14,6 @@
display: inline-block !important;
}
}
& > .bi-combo {
&.bi-combo-popup {
display: inline-block !important;
}
}
}
.bi-inline-horizontal-adapt-layout {
@ -38,12 +32,6 @@
display: inline-block !important;
}
}
& > .bi-combo {
&.bi-combo-popup {
display: inline-block !important;
}
}
}
.bi-inline-vertical-adapt-layout {
@ -62,10 +50,4 @@
display: inline-block !important;
}
}
& > .bi-combo {
&.bi-combo-popup {
display: inline-block !important;
}
}
}

49
src/less/widget/singleslider/slider/widget.slider.less

@ -1,41 +1,31 @@
@import "../../../index.less";
.bi-single-slider-button {
& .slider-button {
cursor: ew-resize;
border-width: 2px;
border-style: solid;
.border-radius(8px);
background-color: @color-bi-background-slider-button;
height: 8px;
width: 8px;
top: 8px;
left: -6px;
transform: translateX(-50%);
cursor: ew-resize;
border-width: 2px;
border-style: solid;
.border-radius(50%);
background-color: @color-bi-background-slider-button;
&:hover, &.hover {
background-color: @color-bi-background-hover-slider-button;
transform: scale(1.2) translateX(-50%);
.box-shadow(0 2px 4px 1px, rgba(0, 35, 11, 20%));
}
&.disabled {
border-color: @color-bi-border-disabled-slider-button;
&:hover, &.hover {
.border-radius(10px);
background-color: @color-bi-background-hover-slider-button;
width: 12px;
height: 12px;
top: 6px;
left: -8px;
.box-shadow(0 2px 4px 1px,rgba(0, 35, 11, 20%));
}
&.disabled {
border-color: @color-bi-border-disabled-slider-button;
&:hover, &.hover {
background-color: @color-bi-background-hover-disabled-slider-button;
width: 12px;
height: 12px;
top: 6px;
left: -8px;
}
background-color: @color-bi-background-hover-disabled-slider-button;
}
}
}
.bi-theme-dark {
.bi-single-slider-button {
& .slider-button {
background-color: @color-bi-background-slider-button;
&:hover, &.hover {
background-color: @color-bi-background-hover-slider-button-theme-dark;
@ -45,6 +35,5 @@
background-color: @color-bi-background-hover-disabled-slider-button-theme-dark;
}
}
}
}
}
}

3
src/less/widget/year/popup.year.less

@ -2,7 +2,6 @@
.bi-year-popup {
& .year-popup-navigation {
line-height: 30px;
& > .center-element {
border-left: 1px solid @color-bi-border-year-popup;
}
@ -26,4 +25,4 @@
}
}
}
}
}

6
src/widget/date/calendar/popup.month.js

@ -49,6 +49,7 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
},
_getItems: function(m) {
BI.Widget.pushContext(this);
// 纵向排列月
var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = [];
@ -67,7 +68,7 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
whiteSpace: "nowrap",
once: false,
forceSelected: true,
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT - 1,
height: BI.toPix(BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, 1),
width: 30,
value: td,
text: td,
@ -75,6 +76,7 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
};
});
});
BI.Widget.popContext();
return items;
},
@ -94,4 +96,4 @@ BI.MonthPopup = BI.inherit(BI.Widget, {
}
});
BI.MonthPopup.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.month_popup", BI.MonthPopup);
BI.shortcut("bi.month_popup", BI.MonthPopup);

10
src/widget/dynamicdate/dynamicdate.combo.js

@ -50,13 +50,13 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
el: {
type: "bi.horizontal_fill",
columnSize: [this.constants.iconWidth, "fill"],
height: opts.height - border,
height: BI.toPix(opts.height, border),
items: [{
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: opts.height - border,
height: opts.height - border,
width: BI.toPix(opts.height, border),
height: BI.toPix(opts.height, border),
ref: function () {
self.changeIcon = this;
}
@ -69,8 +69,8 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
format: opts.format,
allowEdit: opts.allowEdit,
watermark: opts.watermark,
iconWidth: opts.height - border,
height: opts.height - border,
iconWidth: BI.toPix(opts.height, border),
height: BI.toPix(opts.height, border),
value: opts.value,
ref: function () {
self.trigger = this;

2
src/widget/dynamicdate/dynamicdate.param.item.js

@ -21,7 +21,7 @@ BI.DynamicDateParamItem = BI.inherit(BI.Widget, {
el: {
type: "bi.sign_editor",
cls: "bi-border bi-focus-shadow bi-border-radius",
height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT - 2,
height: BI.toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 2),
validationChecker: function (v) {
return BI.isNaturalNumber(v);
},

6
src/widget/dynamicdate/dynamicdate.popup.js

@ -26,7 +26,7 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
cls: "bi-high-light bi-split-top",
shadow: true,
text: BI.i18nText("BI-Basic_Clear"),
textHeight: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT - 1,
textHeight: BI.toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1),
listeners: [{
eventName: BI.TextButton.EVENT_CHANGE,
action: function () {
@ -37,7 +37,7 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "bi-split-left bi-split-right bi-high-light bi-split-top",
shadow: true,
textHeight: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT - 1,
textHeight: BI.toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1),
text: BI.i18nText("BI-Multi_Date_Today"),
disabled: this._checkTodayValid(),
ref: function () {
@ -52,7 +52,7 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
}, {
type: "bi.text_button",
cls: "bi-high-light bi-split-top",
textHeight: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT - 1,
textHeight: BI.toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1),
shadow: true,
text: BI.i18nText("BI-Basic_OK"),
listeners: [{

3
src/widget/dynamicdate/dynamicdate.trigger.js

@ -152,6 +152,9 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
_getTitle: function () {
var storeValue = this.storeValue || {};
if (BI.isEmptyObject(storeValue)) {
return this.options.watermark;
}
var type = storeValue.type || BI.DynamicDateCombo.Static;
var value = storeValue.value;
switch (type) {

8
src/widget/dynamicdatetime/dynamicdatetime.combo.js

@ -8,7 +8,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
},
props: {
baseCls: "bi-dynamic-date-combo",
baseCls: "bi-dynamic-date--time-combo",
height: 24,
minDate: "1900-01-01",
maxDate: "2099-12-31",
@ -50,13 +50,13 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
el: {
type: "bi.horizontal_fill",
columnSize: [this.constants.iconWidth, "fill"],
height: opts.height - border,
height: BI.toPix(opts.height, border),
items: [{
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: this.constants.iconWidth,
height: opts.height - border,
height: BI.toPix(opts.height, border),
ref: function () {
self.changeIcon = this;
}
@ -70,7 +70,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
watermark: opts.watermark,
format: opts.format,
iconWidth: this.constants.iconWidth,
height: opts.height - border,
height: BI.toPix(opts.height, border),
value: opts.value,
ref: function () {
self.trigger = this;

6
src/widget/dynamicdatetime/dynamicdatetime.popup.js

@ -25,7 +25,7 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
items: [[{
type: "bi.text_button",
cls: "bi-high-light bi-split-top",
textHeight: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT - 1,
textHeight: BI.toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1),
shadow: true,
text: BI.i18nText("BI-Basic_Clear"),
listeners: [{
@ -37,7 +37,7 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
}, {
type: "bi.text_button",
cls: "bi-split-left bi-split-right bi-high-light bi-split-top",
textHeight: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT - 1,
textHeight: BI.toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1),
shadow: true,
text: BI.i18nText("BI-Multi_Date_Today"),
disabled: this._checkTodayValid(),
@ -53,7 +53,7 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
}, {
type: "bi.text_button",
cls: "bi-high-light bi-split-top",
textHeight: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT - 1,
textHeight: BI.toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1),
shadow: true,
text: BI.i18nText("BI-Basic_OK"),
listeners: [{

42
src/widget/dynamicdatetime/dynamicdatetime.trigger.js

@ -9,7 +9,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
iconWidth: 24
},
props: {
props: () => ({
extraCls: "bi-date-time-trigger",
min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期
@ -17,8 +17,8 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
iconWidth: 24,
format: "", // 显示的日期格式化方式
allowEdit: true, // 是否允许编辑
watermark: ""
},
watermark: BI.i18nText("BI-Basic_Unrestricted"),
}),
_init: function () {
BI.DynamicDateTimeTrigger.superclass._init.apply(this, arguments);
@ -44,7 +44,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
hgap: c.hgap,
vgap: c.vgap,
allowBlank: true,
watermark: BI.isKey(o.watermark) ? o.watermark : BI.i18nText("BI-Basic_Unrestricted"),
watermark: o.watermark,
errorText: function (v) {
var str = "";
if (!BI.isKey(o.format)) {
@ -149,7 +149,11 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
},
_getTitle: function () {
var o = this.options;
var storeValue = this.storeValue || {};
if (BI.isEmptyObject(storeValue)) {
return o.watermark;
}
var type = storeValue.type || BI.DynamicDateCombo.Static;
var value = storeValue.value;
switch (type) {
@ -197,7 +201,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
// 这边不能直接用\d+去切日期, 因为format格式可能是20190607这样的没有分割符的 = =
// 先看一下是否是合法的, 如果合法就变成标准格式的走原来的流程, 不合法不关心
var date = BI.parseDateTime(v, this._getFormatString());
if(BI.print(date, this._getFormatString()) === v) {
if (BI.print(date, this._getFormatString()) === v) {
v = BI.print(date, c.compareFormat);
result = [0, 1, 2];
}
@ -214,7 +218,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
BI.isNumeric(v) && v.length === 1 && (suffixArray[idx] = "0" + v);
});
// hh:mm
if(suffixArray.length === 2 && !hasSecond) {
if (suffixArray.length === 2 && !hasSecond) {
suffixArray.push("00");
}
var suffixString = suffixArray.join(":");
@ -283,42 +287,42 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
_getText: function (obj) {
var value = "";
var endText = "";
if(BI.isNotNull(obj.year)) {
if(BI.parseInt(obj.year) !== 0) {
if (BI.isNotNull(obj.year)) {
if (BI.parseInt(obj.year) !== 0) {
value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Year"), obj.position);
}
if(BI.isNotNull(obj.quarter)) {
if(BI.parseInt(obj.quarter) !== 0) {
if (BI.isNotNull(obj.quarter)) {
if (BI.parseInt(obj.quarter) !== 0) {
value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Single_Quarter"), obj.position);
}
if(BI.isNotNull(obj.month)) {
if(BI.parseInt(obj.month) !== 0) {
if (BI.isNotNull(obj.month)) {
if (BI.parseInt(obj.month) !== 0) {
value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Month") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Month"), obj.position);
}
if(BI.isNotNull(obj.week)) {
if(BI.parseInt(obj.week) !== 0) {
if (BI.isNotNull(obj.week)) {
if (BI.parseInt(obj.week) !== 0) {
value += Math.abs(obj.week) + BI.i18nText("BI-Basic_Week") + (obj.week < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Week"), obj.position);
}
if(BI.isNotNull(obj.day)) {
if(BI.parseInt(obj.day) !== 0) {
if (BI.isNotNull(obj.day)) {
if (BI.parseInt(obj.day) !== 0) {
value += Math.abs(obj.day) + BI.i18nText("BI-Basic_Day") + (obj.day < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
}
endText = BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : "";
}
if(BI.isNotNull(obj.workDay) && BI.parseInt(obj.workDay) !== 0) {
if (BI.isNotNull(obj.workDay) && BI.parseInt(obj.workDay) !== 0) {
value += Math.abs(obj.workDay) + BI.i18nText("BI-Basic_Work_Day") + (obj.workDay < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
}
return value + endText;
return value + endText;
function getPositionText (baseText, position) {
function getPositionText(baseText, position) {
switch (position) {
case BI.DynamicDateCard.OFFSET.BEGIN:
return baseText + BI.i18nText("BI-Basic_Begin_Start");

4
src/widget/editor/editor.search.js

@ -15,13 +15,12 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
});
},
_init: function () {
this.options.height -= this.options.simple ? 1 : 2;
BI.SearchEditor.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.editor = BI.createWidget(o.el, {
type: "bi.editor",
simple: o.simple,
height: o.height,
height: BI.toPix(o.height, o.simple ? 1 : 2),
watermark: o.watermark,
allowBlank: true,
hgap: 1,
@ -45,6 +44,7 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
});
BI.createWidget({
element: this,
height: BI.toPix(o.height, o.simple ? 1 : 2),
type: "bi.htape",
items: [
{

12
src/widget/editor/editor.text.js

@ -26,15 +26,11 @@ BI.TextEditor = BI.inherit(BI.Widget, {
render: function () {
var self = this, o = this.options;
var border = o.simple ? 1 : 2;
if (BI.isNumber(o.height)) {
this.element.css({ height: o.height - border });
}
if (BI.isNumber(o.width)) {
this.element.css({ width: o.width - border });
}
this.editor = BI.createWidget({
type: "bi.editor",
element: this,
width: BI.toPix(o.width, border),
height: BI.toPix(o.height, border),
simple: o.simple,
hgap: o.hgap,
vgap: o.vgap,
@ -142,6 +138,10 @@ BI.TextEditor = BI.inherit(BI.Widget, {
return this.editor.isValid();
},
setValid: function (b) {
this.editor.setValid(b);
},
setValue: function (v) {
this.editor.setValue(v);
},

149
src/widget/intervalslider/intervalslider.js

@ -60,8 +60,8 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
cls: "slider-editor-button",
text: this.options.unit,
allowBlank: false,
width: c.EDITOR_WIDTH - 2,
height: c.EDITOR_HEIGHT - 2,
width: BI.toPix(c.EDITOR_WIDTH, 2),
height: BI.toPix(c.EDITOR_HEIGHT, 2),
validationChecker: function (v) {
return self._checkValidation(v);
}
@ -88,8 +88,8 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
cls: "slider-editor-button",
text: this.options.unit,
allowBlank: false,
width: c.EDITOR_WIDTH - 2,
height: c.EDITOR_HEIGHT - 2,
width: BI.toPix(c.EDITOR_WIDTH, 2),
height: BI.toPix(c.EDITOR_HEIGHT, 2),
validationChecker: function (v) {
return self._checkValidation(v);
}
@ -122,28 +122,29 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
this._setVisible(false);
return {
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.vertical",
items: [{
type: "bi.absolute",
items: [{
el: this.track,
width: "100%",
height: c.TRACK_HEIGHT
}]
}],
hgap: 7,
height: c.TRACK_HEIGHT
},
top: 23,
left: 0,
width: "100%"
},
type: "bi.vertical_fill",
rowSize: [30, 30],
items: [
this._createLabelWrapper(),
this._createSliderWrapper()
{
type: "bi.absolute",
items: [
{
el: {
type: "bi.horizontal",
horizontalAlign: "stretch",
verticalAlign: "middle",
columnSize: ["fill"],
items: [{
el: this.track,
}],
hgap: 10,
},
inset: 0
},
this._createSliderWrapper(),
]
}
]
};
},
@ -225,14 +226,14 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
items: [{
el: this.labelOne,
top: 0,
left: "0%"
left: 0,
}]
}, {
type: "bi.absolute",
items: [{
el: this.labelTwo,
top: 0,
left: "100%"
right: 0,
}]
}],
rgap: c.EDITOR_R_GAP,
@ -248,58 +249,62 @@ BI.IntervalSlider = BI.inherit(BI.Single, {
var c = this._constant;
return {
el: {
type: "bi.vertical",
items: [{
type: "bi.absolute",
items: [{
el: this.sliderOne,
top: 0,
left: "0%"
}]
}, {
type: "bi.absolute",
items: [{
el: this.sliderTwo,
top: 0,
left: "100%"
}]
}],
hgap: c.SLIDER_WIDTH_HALF,
height: c.SLIDER_HEIGHT
type: "bi.horizontal",
horizontalAlign: "stretch",
verticalAlign: "middle",
items: [
{
type: "bi.absolute",
height: 12,
width: "fill",
items: [
{
el: this.sliderOne,
top: 1,
bottom: 0,
left: 0
}, {
el: this.sliderTwo,
top: 1,
bottom: 0,
left: "100%"
}
],
}
],
hgap: 10,
},
top: 20,
left: 0,
width: "100%"
inset: 0
};
},
_createTrackWrapper: function () {
return BI.createWidget({
type: "bi.absolute",
items: [{
el: {
type: "bi.vertical",
type: "bi.horizontal",
cls: "track-wrapper",
horizontalAlign: "stretch",
verticalAlign: "middle",
columnSize: ["fill"],
scrollx: false,
items: [
{
type: "bi.absolute",
height: 6,
items: [{
type: "bi.absolute",
items: [{
el: this.grayTrack,
top: 0,
left: 0,
width: "100%"
}, {
el: this.blueTrack,
top: 0,
left: 0,
width: "0%"
}]
}],
hgap: 8,
height: 8
},
top: 8,
left: 0,
width: "100%"
}]
el: this.grayTrack,
top: 0,
left: 0,
bottom: 0,
width: "100%"
}, {
el: this.blueTrack,
top: 0,
left: 0,
bottom: 0,
width: "0%"
}]
}
],
});
},

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

Loading…
Cancel
Save