Browse Source

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

* commit '9093689c7fbf448238a71326dfb21a0846f946d3': (90 commits)
  BI-119128 fix: 【自适应迭代发散】小屏编辑,高度适应+自定义(1366*449),直接预览,文本控件下拉选项偏离
  BI-119112 fix:editor弹出errorbubble位置修改
  Revert "BI-119112 fix:editor可以自定义error bubble位置"
  BI-119112 fix:editor可以自定义error bubble位置
  BI-119217 fix: 【6.0.6冒烟】等比自适应-高清屏-宽度自适应预览,下拉树查看已选展示异常
  REPORT-87371 fix: 【BI6.0】【目录管理-管理首页】添加首页时模板类型的下拉框为空
  REPORT-87371 fix: 【BI6.0】【目录管理-管理首页】添加首页时模板类型的下拉框为空
  auto upgrade version to 2.0.20221218194544
  auto upgrade version to 2.0.20221216170431
  BI-118262 fix: 树过滤组件搜索过滤不生效
  BI-117667 fix: 【6.0.5冒烟】数值下拉选择多个选项,查看已选点击加载更多展示重复数据
  auto upgrade version to 2.0.20221216114354
  KERNEL-13893 feat: 颜色选择器默认色板候选调整
  auto upgrade version to 2.0.20221216100516
  auto upgrade version to 2.0.20221215221629
  auto upgrade version to 2.0.20221215220552
  BI-119055 fix: needadaptive的下拉计算NaN
  无JRIA fix: 再检查一遍输入框圆角问题
  auto upgrade version to 2.0.20221215171537
  BI-118849 fix: combo在屏幕边缘,左右位置不够之后的位置调整逻辑
  ...
research/test
superman 2 years ago
parent
commit
6083ab3b1b
  1. 5
      demo/js/base/button/demo.button.js
  2. 53
      demo/js/case/combo/demo.text_value_combo.js
  3. 8
      demo/js/west.js
  4. 3
      demo/js/widget/numbereditor/demo.number_editor.js
  5. BIN
      dist/font/iconfont.eot
  6. 24
      dist/font/iconfont.svg
  7. BIN
      dist/font/iconfont.ttf
  8. BIN
      dist/font/iconfont.woff
  9. BIN
      dist/font/iconfont.woff2
  10. 2
      package.json
  11. 21
      src/base/combination/bubble.js
  12. 84
      src/base/combination/combo.js
  13. 18
      src/base/single/button/buttons/button.js
  14. 63
      src/base/single/editor/editor.js
  15. 38
      src/case/colorchooser/colorpicker/button/button.colorshow.js
  16. 261
      src/case/colorchooser/colorpicker/colorpicker.hex.js
  17. 274
      src/case/colorchooser/colorpicker/editor.colorpicker.hex.js
  18. 170
      src/case/colorchooser/colorpicker/editor.colorpicker.hex.simple.js
  19. 96
      src/case/colorchooser/colorpicker/editor.colorpicker.js
  20. 64
      src/case/colorchooser/colorpicker/editor.colorpicker.simple.js
  21. 1
      src/case/combo/bubblecombo/combo.bubble.js
  22. 4
      src/case/combo/textvaluecombo/combo.textvalue.js
  23. 187
      src/case/combo/textvaluecombo/popup.textvalue.js
  24. 6
      src/case/editor/editor.clear.js
  25. 1
      src/case/editor/editor.defaulttext.js
  26. 3
      src/case/editor/editor.shelter.js
  27. 3
      src/case/editor/editor.sign.js
  28. 3
      src/case/editor/editor.state.js
  29. 19
      src/case/editor/editor.state.simple.js
  30. 10
      src/case/linearsegment/linear.segment.js
  31. 9
      src/case/segment/segment.js
  32. 8
      src/case/ztree/parttree.js
  33. 12
      src/core/controller/controller.bubbles.js
  34. 61
      src/core/controller/controller.layer.js
  35. 3474
      src/core/controller/popper.js
  36. 328
      src/core/platform/web/dom.js
  37. 10
      src/core/platform/web/function.js
  38. 2
      src/less/core/utils/motion/zoom.less
  39. 2
      src/less/widget/multiselect/trigger/button.checkselected.less
  40. 6
      src/less/widget/multitree/trigger/multi.tree.button.checkselected.less
  41. 5
      src/widget/downlist/combo.downlist.js
  42. 3
      src/widget/editor/editor.search.js
  43. 3
      src/widget/editor/editor.text.js
  44. 21
      src/widget/multiselect/check/multiselect.display.js
  45. 124
      src/widget/multitree/multi.tree.combo.js
  46. 143
      src/widget/multitree/multi.tree.insert.combo.js
  47. 108
      src/widget/multitree/trigger/multi.tree.search.insert.pane.js
  48. 30
      src/widget/multitree/trigger/multi.tree.search.pane.js
  49. 31
      src/widget/multitree/trigger/searcher.multi.tree.js
  50. 48
      src/widget/numbereditor/number.editor.js
  51. 2
      typescript/base/single/button/button.basic.ts
  52. 7
      typescript/case/combo/combo.textvalue.ts
  53. 13
      typescript/case/combo/popup.textvalue.ts
  54. 12
      typescript/component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo.ts
  55. 8
      typescript/core/base.ts
  56. 4
      typescript/core/plugin.ts
  57. 419
      typescript/core/widget.ts
  58. 3
      typescript/index.ts

5
demo/js/base/button/demo.button.js

@ -385,6 +385,11 @@ Demo.Button = BI.inherit(BI.Widget, {
type: "bi.button",
text: "小于最小宽度的按钮",
width: 50,
}, {
type: "bi.button",
text: "一个文字超级超级长的 button, 他比按钮宽度还长。",
textWidth: 500,
width: 100,
}];
return {

53
demo/js/case/combo/demo.text_value_combo.js

@ -8,19 +8,21 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
render: function () {
var combo1, combo2;
var items = [{
text: "MVC-1",
iconCls: "date-font",
value: 1
}, {
text: "MVC-2",
iconCls: "search-font",
value: 2
}, {
text: "MVC-3",
iconCls: "pull-right-font",
value: 3
}];
var items = [
{
text: "MVC-1",
iconCls: "date-font",
value: 1
}, {
text: "MVC-2",
iconCls: "search-font",
value: 2
}, {
text: "MVC-3",
iconCls: "pull-right-font",
value: 3
}
];
// 创建下拉框各种场景用例
return {
@ -195,6 +197,31 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
allowClear: true,
defaultText: "请选择",
chooseType: BI.Selection.Multi,
value: [1],
// allowSelectAll: false,
listeners: [
{
eventName: BI.TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
}
}
]
}
]
}),
this.createCombo("支持复选,不要全选功能", {
type: "bi.vertical",
items: [
{
type: "bi.text_value_combo",
width: 300,
items: items,
allowClear: true,
defaultText: "请选择",
chooseType: BI.Selection.Multi,
value: [1],
allowSelectAll: false,
listeners: [
{
eventName: BI.TextValueCombo.EVENT_CHANGE,

8
demo/js/west.js

@ -9,6 +9,10 @@ Demo.West = BI.inherit(BI.Widget, {
render: function () {
var self = this;
var selectedId = BI.Router.$router.currentRoute.params?.componentId;
return {
type: "bi.vtape",
items: [{
@ -60,7 +64,7 @@ Demo.West = BI.inherit(BI.Widget, {
self.fireEvent(Demo.West.EVENT_VALUE_CHANGE, v);
}
}],
value: Demo.showIndex,
value: selectedId || Demo.showIndex,
items: Demo.CONFIG,
ref: function (ref) {
self.tree = ref;
@ -70,4 +74,4 @@ Demo.West = BI.inherit(BI.Widget, {
}
});
Demo.West.EVENT_VALUE_CHANGE = "EVENT_VALUE_CHANGE";
BI.shortcut("demo.west", Demo.West);
BI.shortcut("demo.west", Demo.West);

3
demo/js/widget/numbereditor/demo.number_editor.js

@ -14,7 +14,8 @@ Demo.FileManager = BI.inherit(BI.Widget, {
},
height: 24,
width: 150,
errorText: "hahah"
errorText: "hahah",
watermark: "每个人都是自己健康的第一责任人",
});
editor1.on(BI.NumberEditor.EVENT_CHANGE, function () {
if (BI.parseFloat(this.getValue()) < 1) {

BIN
dist/font/iconfont.eot vendored

Binary file not shown.

24
dist/font/iconfont.svg vendored

@ -14,6 +14,30 @@
/>
<missing-glyph />
<glyph glyph-name="qitaziduanleixing" unicode="&#59860;" d="M168 704a8 8 0 0 1-8-8v-64a8 8 0 0 1 8-8h688a8 8 0 0 1 8 8V696a8 8 0 0 1-8 8H168z m-8-288a8 8 0 0 0 8 8h688a8 8 0 0 0 8-8v-64a8 8 0 0 0-8-8H168a8 8 0 0 0-8 8v64z m0-280a8 8 0 0 0 8 8h688a8 8 0 0 0 8-8v-64a8 8 0 0 0-8-8H168a8 8 0 0 0-8 8v64z" horiz-adv-x="1024" />
<glyph glyph-name="ziyuankongzhi" unicode="&#59859;" d="M450.328 754.728A16.008 16.008 0 0 1 438.46 760H128a16 16 0 0 1-16-16v-720a16 16 0 0 1 16-16h766.952a16 16 0 0 1 16 16V615.88a16 16 0 0 1-16 16H800.48l-71.752 75.168A16 16 0 0 1 717.152 712h-228.196l-38.628 42.728z m-273.76-67.136h244.58l116.408-123.936h308.828V318h-105.62a8.008 8.008 0 0 0-6.544 3.396l-121.548 172.728a8 8 0 0 1-13.056 0.04l-159.992-224.36a8 8 0 0 0-13.172 0.208l-93.216 139.824a8 8 0 0 1-12.676 0.828l-78.688-89.932a8 8 0 0 0-6.024-2.732h-59.28V687.592z m0-433.592h88.32a8 8 0 0 1 6.024 2.732l42.768 48.88a8 8 0 0 0 12.676-0.832l98.324-147.484a8 8 0 0 1 13.168-0.208l161.42 226.36a8 8 0 0 0 13.056-0.04l88.676-126.012a8 8 0 0 1 6.544-3.396h138.84v-173.592H176.564V254z" horiz-adv-x="1024" />
<glyph glyph-name="yiping" unicode="&#59858;" d="M506.036 553.656a8.008 8.008 0 0 0 9.724 1.24c1.404-0.332 2.74-1.04 3.836-2.14l175.696-175.692a8 8 0 0 0 0-11.312l-33.944-33.944a8 8 0 0 0-11.312 0l-137.668 137.668-136.772-136.768a8 8 0 0 0-11.312 0l-33.94 33.94a8 8 0 0 0 0 11.316l175.692 175.692zM912 768a16 16 0 0 1-16 16H128a16 16 0 0 1-16-16v-624a16 16 0 0 1 16-16h352v-80H324a8 8 0 0 1-8-8v-48a8 8 0 0 1 8-8h372a8 8 0 0 1 8 8v48a8 8 0 0 1-8 8h-152v80h352a16 16 0 0 1 16 16V768z m-72-56v-512H184V712h656z" horiz-adv-x="1024" />
<glyph glyph-name="hangzhuanlie" unicode="&#59851;" d="M152 648h188V744H152v-96z m260 0h200V744h-200v-96z m460 0V744h-188v-96h188zM80 800a16 16 0 0 0 16 16h832a16 16 0 0 0 16-16v-208a16 16 0 0 0-16-16H96a16 16 0 0 0-16 16V800z m0-312a16 16 0 0 0 16 16h316a16 16 0 0 0 16-16v-520a16 16 0 0 0-16-16H96a16 16 0 0 0-16 16V488z m438-400.952H656c68.484 0 124 55.516 124 124v147.28l-49.088-49.092a8 8 0 0 0-11.316 0l-33.94 33.944a8 8 0 0 0 0 11.312l120.82 120.82a16 16 0 0 0 22.628 0l120.82-120.82a8 8 0 0 0 0-11.312l-33.944-33.944a8 8 0 0 0-11.312 0L852 361.904v-150.856c0-108.248-87.752-196-196-196h-138a8 8 0 0 0-8 8v56a8 8 0 0 0 8 8z" horiz-adv-x="1024" />
<glyph glyph-name="liezhuanhang" unicode="&#59857;" d="M80 800a16 16 0 0 0 16 16h832a16 16 0 0 0 16-16v-208a16 16 0 0 0-16-16H96a16 16 0 0 0-16 16V800z m72-368h200v-92H152v92z m0-244v80h200v-80H152z m0-72h200v-92H152v92zM96 504a16 16 0 0 1-16-16v-520a16 16 0 0 1 16-16h312a16 16 0 0 1 16 16V488a16 16 0 0 1-16 16H96z m419.312-429.088l23.632-23.632c0.748-1.392 1.892-2.536 3.28-3.28l93.908-93.908a8 8 0 0 1 11.312 0l33.944 33.944a8 8 0 0 1 0 11.312l-47.708 47.708H684c108.248 0 196 87.752 196 196v244.952a8 8 0 0 1-8 8h-56a8 8 0 0 1-8-8v-244.952c0-68.484-55.516-124-124-124h-56.664l54.052 54.048a8 8 0 0 1 0 11.312l-33.944 33.944a8 8 0 0 1-11.312 0l-120.82-120.82a16 16 0 0 1 0-22.628z" horiz-adv-x="1024" />
<glyph glyph-name="a-jiantoumian" unicode="&#59853;" d="M711.111111 636.131556a28.444444 28.444444 0 0 0 18.204445-6.542223l268.515555-223.744a28.444444 28.444444 0 0 0 0-43.690666l-268.515555-223.744a28.444444 28.444444 0 0 0-46.648889 21.902222L682.609778 344.177778H96.711111a39.822222 39.822222 0 0 0 0 79.644444H682.666667V607.687111a28.444444 28.444444 0 0 0 28.444444 28.444445z" horiz-adv-x="1024" />
<glyph glyph-name="tingzhi" unicode="&#59854;" d="M320 832a64 64 0 0 0 64-64v-768a64 64 0 0 0-64-64H192a64 64 0 0 0-64 64V768a64 64 0 0 0 64 64h128z m512 0a64 64 0 0 0 64-64v-768a64 64 0 0 0-64-64h-128a64 64 0 0 0-64 64V768a64 64 0 0 0 64 64h128zM307.2 755.2H204.8v-742.4h102.4V755.2z m512 0h-102.4v-742.4h102.4V755.2z" horiz-adv-x="1024" />
<glyph glyph-name="zhongqi" unicode="&#59855;" d="M512 807.168c111.744 0 213.248-44.096 288-115.84v51.84a32 32 0 1 0 64 0v-160a31.872 31.872 0 0 0-32-32h-159.872a32 32 0 1 0 0 64h111.36a352 352 0 1 1 52.608-361.536h0.128a32 32 0 1 0 57.92-27.008A416.128 416.128 0 0 0 96 391.168a416 416 0 0 0 416 416zM447.04 531.648a12.8 12.8 0 0 0 7.552-2.496l184.96-134.784a12.8 12.8 0 0 0 0-20.736l-184.96-134.784a12.8 12.8 0 0 0-20.352 10.304V518.848c0 7.04 5.76 12.8 12.8 12.8z" horiz-adv-x="1024" />
<glyph glyph-name="qidong" unicode="&#59856;" d="M892.48 432.704l-552.192 386.56a70.4 70.4 0 0 1-110.784-57.664v-773.12a70.4 70.4 0 0 1 110.72-57.6l552.256 386.56a70.4 70.4 0 0 1 0 115.264z m-51.456-57.6l-534.72-374.272V749.312L840.96 375.04z" horiz-adv-x="1024" />
<glyph glyph-name="yunweizujian" unicode="&#61899;" d="M768 832a64 64 0 0 0 64-64v-192a64 64 0 0 0-64-64H544v-96.384l288 0.064a96 96 0 0 0 95.552-86.72l0.448-9.216V256h32a64 64 0 0 0 64-64v-192a64 64 0 0 0-64-64h-128a64 64 0 0 0-64 64v192a64 64 0 0 0 64 64h32v63.68a32 32 0 0 1-26.24 31.488L832 351.67999999999995l-288-0.064V256h64a64 64 0 0 0 64-64v-192a64 64 0 0 0-64-64h-192a64 64 0 0 0-64 64v192a64 64 0 0 0 64 64h64V351.616L192 351.48800000000006a32.064 32.064 0 0 1-31.488-26.24l-0.512-5.76V256H192a64 64 0 0 0 64-64v-192a64 64 0 0 0-64-64H64a64 64 0 0 0-64 64v192a64 64 0 0 0 64 64h32v63.488c0 49.856 38.08 90.88 86.72 95.552L192 415.488l288 0.128V512H256a64 64 0 0 0-64 64V768a64 64 0 0 0 64 64h512zM192 192h-32v-0.32h-64V192H64v-192h128v192z m416 0h-192v-192h192v192z m352 0h-128v-192h128v192z m-192 576H256v-192h512V768zM352 704a32 32 0 1 0 0-64 32 32 0 0 0 0 64z m320 0a32 32 0 1 0 0-64h-192a32 32 0 0 0 0 64h192z" horiz-adv-x="1024" />
<glyph glyph-name="jiankangzhenduan" unicode="&#59852;" d="M800-1.472a32 32 0 1 0 0-64h-576a32 32 0 0 0 0 64h576z m96 768a64 64 0 0 0 64-64v-576a64 64 0 0 0-64-64H128a64 64 0 0 0-64 64v576a64 64 0 0 0 64 64h768z m0-64H128v-576h768v576zM431.744 621.12a32 32 0 0 0 57.28-5.76l105.024-284.608 28.096 67.392 2.56 4.864a32 32 0 0 0 26.944 14.848h116.8l5.76-0.512a32 32 0 0 0 26.24-31.488l-0.512-5.76a32 32 0 0 0-31.488-26.24h-95.424l-51.2-122.88-2.752-5.312a32 32 0 0 0-56.768 6.528l-103.68 280.512-53.568-142.336-2.432-5.12a32 32 0 0 0-27.52-15.616H256.384l-5.76 0.512a32 32 0 0 0-26.24 31.488l0.512 5.76a32 32 0 0 0 31.488 26.24h96.512l76.16 201.984z" horiz-adv-x="1024" />
<glyph glyph-name="Greenplumtouxiang" unicode="&#59850;" d="M511.36 564.608c-99.392 0-179.968-78.944-179.968-176.32 0-66.24 24.16-116.352 76.16-144.576 13.216-7.2 29.28-1.92 37.92 10.432l59.264 84.608a331.36 331.36 0 0 0 53.632 59.616l79.68 69.44c11.584 10.112 15.04 27.2 5.664 39.36-32.672 42.56-81.664 57.44-132.352 57.44zM512-128c282.784 0 512 229.216 512 512S794.784 896 512 896 0 666.784 0 384s229.216-512 512-512z m0 874.88c111.392 0 216.96-52.8 285.056-138.56 27.744-34.944 17.408-84.192-15.744-114.016L611.84 342.08c-16.8-15.104-32-31.872-45.44-50.048l-137.696-187.072c-26.4-35.84-74.336-50.944-111.84-26.944A362.592 362.592 0 0 0 149.12 384C149.12 584.416 311.584 746.88 512 746.88z" horiz-adv-x="1024" />
<glyph glyph-name="a-leixingshujubiaozhilianoffyifabuon" unicode="&#59848;" d="M56 864a16 16 0 0 1-16-16v-808a16 16 0 0 1 16-16h455.232a282.52 282.52 0 0 0-12.972 56H96V808h496v-148a16 16 0 0 1 16-16h160v-244.248a285.964 285.964 0 0 0 56-3.14V653.28a16 16 0 0 1-4.796 11.424l-198.536 194.72A16.004 16.004 0 0 1 609.464 864H56zM493.596 355.344L613.432 500l49.284-40.828-134.672-162.568-3.988-5.168a32 32 0 0 0-44.88-5.796l-112.196 86.536-117.696-140.556L200 272.448l131.816 157.6 4.672 6.06a32 32 0 0 0 44.88 5.796l112.228-86.56zM1020 116c0-132.548-107.452-240-240-240s-240 107.452-240 240 107.452 240 240 240 240-107.452 240-240z m-104.296 116.508c1.464 4.444-2.752 8.66-7.196 7.196l-284.596-93.912a5.696 5.696 0 0 1-2.24-9.436l72.14-72.14 91.08 44.436-44.436-91.08 71.9-71.9c3-3 8.108-1.788 9.436 2.244l93.912 284.592z" horiz-adv-x="1024" />
<glyph glyph-name="a-leixingshujubiaozhilianonyifabuon" unicode="&#59849;" d="M40 848a16 16 0 0 0 16 16h553.464c4.188 0 8.212-1.64 11.204-4.576l198.536-194.72A16 16 0 0 0 824 653.28v-256.668a285.964 285.964 0 0 1-56 3.14V644h-160a16 16 0 0 0-16 16V808H96v-728h402.26a282.52 282.52 0 0 1 12.972-56H56a16 16 0 0 0-16 16V848zM176 216h338.104a282.16 282.16 0 0 1-15.844-64H176a8 8 0 0 0-8 8v48a8 8 0 0 0 8 8zM613.432 580l-119.836-144.656-112.224 86.56a32 32 0 0 1-44.884-5.796l-4.672-6.06L200 352.448l49.284-40.828 117.696 140.556 112.196-86.536a32 32 0 0 1 44.88 5.796l3.988 5.168 134.672 162.568L613.432 580zM1020 116c0-132.548-107.452-240-240-240s-240 107.452-240 240 107.452 240 240 240 240-107.452 240-240z m-104.296 116.508c1.464 4.444-2.752 8.66-7.196 7.196l-284.596-93.912a5.696 5.696 0 0 1-2.24-9.436l72.14-72.14 91.08 44.436-44.436-91.08 71.9-71.9c3-3 8.108-1.788 9.436 2.244l93.912 284.592z" horiz-adv-x="1024" />

Before

Width:  |  Height:  |  Size: 812 KiB

After

Width:  |  Height:  |  Size: 819 KiB

BIN
dist/font/iconfont.ttf vendored

Binary file not shown.

BIN
dist/font/iconfont.woff vendored

Binary file not shown.

BIN
dist/font/iconfont.woff2 vendored

Binary file not shown.

2
package.json

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

21
src/base/combination/bubble.js

@ -106,7 +106,8 @@
_initPullDownAction: function () {
var self = this, o = this.options;
var evs = (this.options.trigger || "").split(",");
function st (e) {
function st(e) {
if (o.stopEvent) {
e.stopEvent();
}
@ -268,7 +269,7 @@
BI.createWidget({
type: "bi.vertical",
scrolly: false,
element: this.options.container || this,
element: BI.isFunction(this.options.container) ? this.options.container() : (this.options.container || this),
items: [
{ el: this.popupView }
],
@ -344,14 +345,16 @@
if (this.popper) {
this.popper.destroy();
}
var modifiers = [{
name: "offset",
options: {
offset: function () {
return [o.adjustXOffset, (o.showArrow ? 12 : 0) + (o.adjustYOffset + o.adjustLength)];
var modifiers = [
{
name: "offset",
options: {
offset: function () {
return [o.adjustXOffset, (o.showArrow ? 12 : 0) + (o.adjustYOffset + o.adjustLength)];
},
},
},
}];
}
];
if (this.options.showArrow) {
modifiers.push({
name: "arrow",

84
src/base/combination/combo.js

@ -38,8 +38,9 @@
adjustLength: 0, // 调整的距离
adjustXOffset: 0,
adjustYOffset: 0,
supportCSSTransform: true,
hideChecker: BI.emptyFn,
offsetStyle: "left", // left,right,center
offsetStyle: "", // "",center,middle
el: {},
popup: {},
comboClass: "bi-combo-popup",
@ -161,7 +162,7 @@
this._assertPopupViewRender();
this.fireEvent(BI.Combo.EVENT_BEFORE_POPUPVIEW);
// popupVisible是为了获取其宽高, 放到可视范围之外以防止在IE下闪一下
this.popupView.css({ left: -999999999, top: -99999999 });
this.popupView.css({ left: -99999, top: -99999 });
this.popupView.visible();
BI.each(needHideWhenAnotherComboOpen, function (i, combo) {
if (i !== self.getName()) {
@ -195,69 +196,73 @@
this.popupView.visible();
var combo = (o.belowMouse && BI.isNotNull(e)) ? {
element: {
0: BI.extend({}, e.target, {
getBoundingClientRect: function () {
return {
left: e.pageX,
top: e.pageY,
width: 0,
height: 0,
};
}
}),
offset: function () {
return {
left: e.pageX,
top: e.pageY,
};
},
bounds: function () {
// offset为其相对于父定位元素的偏移
return {
x: e.offsetX,
y: e.offsetY,
width: 0,
height: 24,
};
},
outerWidth: function () {
return 0;
},
outerHeight: function () {
return 24;
},
},
} : this.combo;
var positionRelativeElement = BI.DOM.getPositionRelativeContainingBlock(
BI.isNull(o.container)
? this.element[0]
: BI.isWidget(o.container)
? o.container.element[0]
: BI.Widget._renderEngine.createElement(BI.isFunction(o.container) ? o.container() : o.container)[0]
);
switch (o.direction) {
case "bottom":
case "bottom,right":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["bottom", "top", "right", "left"], o.offsetStyle);
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["bottom", "top", "right", "left"], o.offsetStyle, positionRelativeElement);
break;
case "top":
case "top,right":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["top", "bottom", "right", "left"], o.offsetStyle);
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["top", "bottom", "right", "left"], o.offsetStyle, positionRelativeElement);
break;
case "left":
case "left,bottom":
p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["left", "right", "bottom", "top"], o.offsetStyle);
p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["left", "right", "bottom", "top"], o.offsetStyle, positionRelativeElement);
break;
case "right":
case "right,bottom":
p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "bottom", "top"], o.offsetStyle);
p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "bottom", "top"], o.offsetStyle, positionRelativeElement);
break;
case "top,left":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["top", "bottom", "left", "right"], o.offsetStyle);
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["top", "bottom", "left", "right"], o.offsetStyle, positionRelativeElement);
break;
case "bottom,left":
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["bottom", "top", "left", "right"], o.offsetStyle);
p = BI.DOM.getComboPosition(combo, this.popupView, o.adjustXOffset, (o.adjustYOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.isNeedAdjustHeight, ["bottom", "top", "left", "right"], o.offsetStyle, positionRelativeElement);
break;
case "left,top":
p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["left", "right", "top", "bottom"], o.offsetStyle);
p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["left", "right", "top", "bottom"], o.offsetStyle, positionRelativeElement);
break;
case "right,top":
p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "top", "bottom"], o.offsetStyle);
p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "top", "bottom"], o.offsetStyle, positionRelativeElement);
break;
case "right,innerRight":
p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerRight", "innerLeft", "bottom", "top"], o.offsetStyle);
p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerRight", "innerLeft", "bottom", "top"], o.offsetStyle, positionRelativeElement);
break;
case "right,innerLeft":
p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerLeft", "innerRight", "bottom", "top"], o.offsetStyle);
p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["right", "left", "innerLeft", "innerRight", "bottom", "top"], o.offsetStyle, positionRelativeElement);
break;
case "innerRight":
p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["innerRight", "innerLeft", "right", "left", "bottom", "top"], o.offsetStyle);
p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["innerRight", "innerLeft", "right", "left", "bottom", "top"], o.offsetStyle, positionRelativeElement);
break;
case "innerLeft":
p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["innerLeft", "innerRight", "left", "right", "bottom", "top"], o.offsetStyle);
p = BI.DOM.getComboPosition(combo, this.popupView, (o.adjustXOffset + o.adjustLength) + (o.showArrow ? this._const.TRIANGLE_LENGTH : 0), o.adjustYOffset, o.isNeedAdjustHeight, ["innerLeft", "innerRight", "left", "right", "bottom", "top"], o.offsetStyle, positionRelativeElement);
break;
case "top,custom":
case "custom,top":
@ -287,9 +292,6 @@
break;
}
if ("adaptHeight" in p) {
this.resetListHeight(p.adaptHeight);
}
var width = this.combo.element.outerWidth();
var height = this.combo.element.outerHeight();
this.popupView.setDirection && this.popupView.setDirection(p.dir, {
@ -300,6 +302,24 @@
adjustYOffset: o.adjustYOffset,
offset: this.combo.element.offset(),
});
if (o.supportCSSTransform) {
var positonedRect = positionRelativeElement.getBoundingClientRect();
var scaleX = positonedRect.width / positionRelativeElement.offsetWidth;
var scaleY = positonedRect.height / positionRelativeElement.offsetHeight;
p.top && (p.top = Math.round(p.top / scaleY + positionRelativeElement.scrollTop));
p.left && (p.left = Math.round(p.left / scaleX + positionRelativeElement.scrollLeft));
p.adaptHeight && (p.adaptHeight = Math.round(p.adaptHeight / scaleY));
}
if ("adaptHeight" in p) {
this.resetListHeight(p.adaptHeight);
}
if ("left" in p) {
this.popupView.element.css({
left: p.left,

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

@ -81,7 +81,7 @@
},
hgap: o.hgap,
vgap: o.vgap,
items: self.generateItems()
items: self.generateItems(),
});
// 如果 options 对应的属性为 true 则给元素添加 class
@ -102,7 +102,7 @@
// 由于button默认情况下有个边框,所以要主动算行高
var lineHeight, textHeight = o.textHeight;
var hasBorder = false
var hasBorder = false;
if (BI.isNumber(o.height)) {
if (!isVertical(o.iconPosition)) {
if (!(o.clear && o.block && o.light)) {
@ -121,12 +121,12 @@
var iconInvisible = !(o.loading || o.iconCls || o.icon || defaultRenderIcon);
var textWidth = o.textWidth;
if (BI.isNull(o.textWidth)) {
textWidth = (o.minWidth > 0 && o.width < o.minWidth) ? o.minWidth : o.width;
textWidth -= (o.hgap * 2 + o.iconGap)
textWidth -= iconInvisible || isVertical(o.iconPosition) ? 0 : this._const.iconWidth
}
var maxTextWidth = Math.max(o.minWidth, o.width);
maxTextWidth -= (o.hgap * 2 + o.iconGap);
// 减去图标水平占位宽度
maxTextWidth -= iconInvisible || isVertical(o.iconPosition) ? 0 : this._const.iconWidth;
var textWidth = BI.isNull(o.textWidth) ? maxTextWidth : Math.min(o.textWidth, maxTextWidth);
this.text = BI.createWidget({
type: "bi.label",
text: o.text,
@ -140,7 +140,7 @@
});
if (iconInvisible) {
return [this.text]
return [this.text];
}
this._iconRendered = true;

63
src/base/single/editor/editor.js

@ -23,6 +23,7 @@ BI.Editor = BI.inherit(BI.Single, {
allowBlank: false,
watermark: "",
errorText: "",
autoTrim: true,
});
},
@ -49,25 +50,29 @@ BI.Editor = BI.inherit(BI.Single, {
margin: "0",
});
var items = [{
el: {
type: "bi.absolute",
ref: function (_ref) {
self.contentWrapper = _ref;
var items = [
{
el: {
type: "bi.absolute",
ref: function (_ref) {
self.contentWrapper = _ref;
},
items: [
{
el: this.editor,
left: 0,
right: 0,
top: 0,
bottom: 0,
}
],
},
items: [{
el: this.editor,
left: 0,
right: 0,
top: 0,
bottom: 0,
}],
},
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap,
}];
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap,
}
];
BI.createWidget({
type: "bi.absolute",
@ -248,13 +253,15 @@ BI.Editor = BI.inherit(BI.Single, {
BI.createWidget({
type: "bi.absolute",
element: this.contentWrapper,
items: [{
el: this.watermark,
left: 0,
right: 0,
top: 0,
bottom: 0,
}],
items: [
{
el: this.watermark,
left: 0,
right: 0,
top: 0,
bottom: 0,
}
],
});
}
this.watermark.setText(v);
@ -265,7 +272,7 @@ BI.Editor = BI.inherit(BI.Single, {
var o = this.options;
var errorText = o.errorText;
if (BI.isFunction(errorText)) {
errorText = errorText(BI.trim(this.editor.getValue()));
errorText = errorText(o.autoTrim ? BI.trim(this.editor.getValue()) : this.editor.getValue());
}
if (!this.disabledError && BI.isKey(errorText)) {
BI.Bubbles[b ? "show" : "hide"](this.getName(), errorText, this, {
@ -330,10 +337,10 @@ BI.Editor = BI.inherit(BI.Single, {
getValue: function () {
if (!this.isValid()) {
return BI.trim(this.editor.getLastValidValue());
return this.options.autoTrim ? BI.trim(this.editor.getLastValidValue()) : this.editor.getLastValidValue();
}
return BI.trim(this.editor.getValue());
return this.options.autoTrim ? BI.trim(this.editor.getValue()) : this.editor.getValue();
},
isEditing: function () {

38
src/case/colorchooser/colorpicker/button/button.colorshow.js

@ -6,30 +6,32 @@
BI.ColorChooserShowButton = BI.inherit(BI.BasicButton, {
props: {
baseCls: 'bi-color-chooser-show-button bi-border bi-list-item-effect',
baseCls: 'bi-color-chooser-show-button bi-border bi-list-item-effect bi-border-radius',
},
render: function () {
var self = this, o = this.options;
return {
type: 'bi.htape',
items: [{
el: {
type: "bi.icon_label",
ref: function (_ref) {
self.icon = _ref;
items: [
{
el: {
type: "bi.icon_label",
ref: function (_ref) {
self.icon = _ref;
},
iconWidth: 16,
iconHeight: 16,
},
iconWidth: 16,
iconHeight: 16,
},
hgap: 20,
width: 16,
}, {
type: 'bi.label',
textAlign: 'left',
text: o.text,
}]
}
hgap: 20,
width: 16,
}, {
type: 'bi.label',
textAlign: 'left',
text: o.text,
}
]
};
},
doClick: function () {
@ -40,4 +42,4 @@ BI.ColorChooserShowButton = BI.inherit(BI.BasicButton, {
},
});
BI.ColorChooserShowButton.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.color_picker_show_button", BI.ColorChooserShowButton);
BI.shortcut("bi.color_picker_show_button", BI.ColorChooserShowButton);

261
src/case/colorchooser/colorpicker/colorpicker.hex.js

@ -11,118 +11,173 @@ BI.HexColorPicker = BI.inherit(BI.Widget, {
},
_items: [
[{
value: "#808080"
}, {
value: "#ffffff"
}, {
value: "#ffebe5"
}, {
value: "#ffddba"
}, {
value: "#ffeebb"
}, {
value: "#d4e9bf"
}, {
value: "#c7e1e1"
}, {
value: "#bfe3f0"
}, {
value: "#ccd6eb"
}],
[{
value: "#616161"
}, {
value: "#f2f2f2"
}, {
value: "#ffd6cc"
}, {
value: "#ffb87a"
}, {
value: "#ffdf91"
}, {
value: "#b7d2b6"
}, {
value: "#a3d2c9"
}, {
value: "#8ab6d6"
}, {
value: "#bcbce0"
}],
[{
value: "#404040"
}, {
value: "#dedede"
}, {
value: "#ffab9b"
}, {
value: "#eb8a3a"
}, {
value: "#ffc947"
}, {
value: "#8aa964"
}, {
value: "#5eaaa0"
}, {
value: "#2978b5"
}, {
value: "#8f8faa"
}],
[{
value: "#202020"
}, {
value: "#bfbfbf"
}, {
value: "#df7461"
}, {
value: "#cf7536"
}, {
value: "#e6b63b"
}, {
value: "#5b8a72"
}, {
value: "#3b9aa3"
}, {
value: "#336291"
}, {
value: "#58568f"
}],
[{
value: "#000000"
}, {
value: "#a1a1a1"
}, {
value: "#b55140"
}, {
value: "#a6713c"
}, {
value: "#ad975f"
}, {
value: "#5f7d6e"
}, {
value: "#3b7480"
}, {
value: "#425d78"
}, {
value: "#62608a"
}]
[
{
"value": "#999999"
},
{
"value": "#FFFFFF"
},
{
"value": "#FFE5E5"
},
{
"value": "#FFF1E5"
},
{
"value": "#FFF9E5"
},
{
"value": "#E9F5E9"
},
{
"value": "#EAEEFF"
},
{
"value": "#EFEBF7"
},
{
"value": "#FCE8EF"
}
],
[
{
"value": "#737373"
},
{
"value": "#F2F2F2"
},
{
"value": "#FFA6A6"
},
{
"value": "#FFD0A6"
},
{
"value": "#FFEDA6"
},
{
"value": "#B3DCB2"
},
{
"value": "#B9C6FF"
},
{
"value": "#CABAE6"
},
{
"value": "#F8B1C9"
}
],
[
{
"value": "#4C4C4C"
},
{
"value": "#D9D9D9"
},
{
"value": "#FF5959"
},
{
"value": "#FFA759"
},
{
"value": "#FFDD59"
},
{
"value": "#7EBE70"
},
{
"value": "#7B95FF"
},
{
"value": "#9C7FD0"
},
{
"value": "#F06D99"
}
],
[
{
"value": "#262626"
},
{
"value": "#BFBFBF"
},
{
"value": "#FF0000"
},
{
"value": "#FF7800"
},
{
"value": "#FFCB00"
},
{
"value": "#259B23"
},
{
"value": "#355CFF"
},
{
"value": "#673AB7"
},
{
"value": "#E91E63"
}
],
[
{
"value": "#000000"
},
{
"value": "#A6A6A6"
},
{
"value": "#A80000"
},
{
"value": "#B65600"
},
{
"value": "#CEB000"
},
{
"value": "#0E550C"
},
{
"value": "#09269C"
},
{
"value": "#3A1A73"
},
{
"value": "#B30072"
}
]
],
render: function () {
var self = this, o = this.options;
return {
type: "bi.button_group",
items: this._digest(o.items || this._items),
layouts: [{
type: "bi.grid",
}],
layouts: [
{
type: "bi.grid",
}
],
value: o.value,
listeners: [{
eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.HexColorPicker.EVENT_CHANGE, arguments);
listeners: [
{
eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.HexColorPicker.EVENT_CHANGE, arguments);
}
}
}],
],
ref: function (_ref) {
self.colors = _ref;
}

274
src/case/colorchooser/colorpicker/editor.colorpicker.hex.js

@ -21,7 +21,7 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
render: function () {
var self = this, o = this.options, c = this.constants;
this.storeValue = {};
var RGB = BI.createItems([{text: "R"}, {text: "G"}, {text: "B"}], {
var RGB = BI.createItems([{ text: "R" }, { text: "G" }, { text: "B" }], {
type: "bi.label",
cls: "color-picker-editor-label",
height: 20
@ -33,146 +33,162 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
var Ws = BI.map(BI.range(0, 3), function () {
return {
type: "bi.small_text_editor",
cls: "color-picker-editor-input",
cls: "color-picker-editor-input bi-border-radius",
validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
value: 255,
width: c.RGB_WIDTH,
height: 24,
listeners: [{
eventName: BI.TextEditor.EVENT_CHANGE,
action: function () {
self._checkEditors();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
listeners: [
{
eventName: BI.TextEditor.EVENT_CHANGE,
action: function () {
self._checkEditors();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}
}
}]
]
};
});
return {
type: "bi.absolute",
items: [{
el: {
type: "bi.vertical",
tgap: 10,
items: [{
type: 'bi.vertical_adapt',
columnSize: ["fill", 'fill'],
height: 24,
items: [{
type: "bi.color_picker_show_button",
cls: "trans-color-icon",
height: 22,
title: BI.i18nText("BI-Transparent_Color"),
text: BI.i18nText("BI-Transparent_Color"),
listeners: [{
eventName: BI.ColorChooserShowButton.EVENT_CHANGE,
action: function () {
self.setValue("transparent");
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}],
ref: function (_ref) {
self.transparent = _ref;
}
}, {
el: {
type: "bi.color_picker_show_button",
cls: "auto-color-icon",
height: 22,
title: BI.i18nText("BI-Basic_Auto"),
text: BI.i18nText("BI-Basic_Auto"),
listeners: [{
eventName: BI.ColorChooserShowButton.EVENT_CHANGE,
action: function () {
self.setValue("");
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}],
ref: function (_ref) {
self.none = _ref;
}
},
lgap: 10,
}]
}, {
el: {
type: "bi.vertical_adapt",
columnSize: [22, 10, 'fill', 12, c.RGB_WIDTH, 12, c.RGB_WIDTH, 12, c.RGB_WIDTH],
rgap: 5,
items: [{
el: {
type: "bi.layout",
cls: "color-picker-editor-display bi-card bi-border",
height: 22,
width: 22,
ref: function (_ref) {
self.colorShow = _ref;
}
},
width: 18
}, {
type: "bi.label",
text: "#",
width: 10
}, {
type: "bi.small_text_editor",
ref: function (_ref) {
self.hexEditor = _ref;
},
cls: "color-picker-editor-input",
validationChecker: this._hexChecker,
allowBlank: true,
errorText: BI.i18nText("BI-Color_Picker_Error_Text_Hex"),
width: c.HEX_WIDTH,
items: [
{
el: {
type: "bi.vertical",
tgap: 10,
items: [
{
type: 'bi.vertical_adapt',
columnSize: ["fill", 'fill'],
height: 24,
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self._checkHexEditor();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
items: [
{
type: "bi.color_picker_show_button",
cls: "trans-color-icon",
height: 22,
title: BI.i18nText("BI-Transparent_Color"),
text: BI.i18nText("BI-Transparent_Color"),
listeners: [
{
eventName: BI.ColorChooserShowButton.EVENT_CHANGE,
action: function () {
self.setValue("transparent");
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}
],
ref: function (_ref) {
self.transparent = _ref;
}
}, {
el: {
type: "bi.color_picker_show_button",
cls: "auto-color-icon",
height: 22,
title: BI.i18nText("BI-Basic_Auto"),
text: BI.i18nText("BI-Basic_Auto"),
listeners: [
{
eventName: BI.ColorChooserShowButton.EVENT_CHANGE,
action: function () {
self.setValue("");
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}
],
ref: function (_ref) {
self.none = _ref;
}
},
lgap: 10,
}
}]
}, RGB[0], {
el: BI.extend(Ws[0], {
ref: function (_ref) {
self.R = _ref
}
}),
width: c.RGB_WIDTH
}, RGB[1], {
el: BI.extend(Ws[1], {
ref: function (_ref) {
self.G = _ref
}
}),
width: c.RGB_WIDTH
}, RGB[2], {
el: BI.extend(Ws[2], {
ref: function (_ref) {
self.B = _ref
}
}),
rgap: -5,
width: c.RGB_WIDTH
}]
}
}]
},
left: 0,
right: 0,
top: 0,
bottom: 0
}]
]
}, {
el: {
type: "bi.vertical_adapt",
columnSize: [22, 10, 'fill', 12, c.RGB_WIDTH, 12, c.RGB_WIDTH, 12, c.RGB_WIDTH],
rgap: 5,
items: [
{
el: {
type: "bi.layout",
cls: "color-picker-editor-display bi-card bi-border",
height: 22,
width: 22,
ref: function (_ref) {
self.colorShow = _ref;
}
},
width: 18
}, {
type: "bi.label",
text: "#",
width: 10
}, {
type: "bi.small_text_editor",
ref: function (_ref) {
self.hexEditor = _ref;
},
cls: "color-picker-editor-input bi-border-radius",
validationChecker: this._hexChecker,
allowBlank: true,
errorText: BI.i18nText("BI-Color_Picker_Error_Text_Hex"),
width: c.HEX_WIDTH,
height: 24,
listeners: [
{
eventName: "EVENT_CHANGE",
action: function () {
self._checkHexEditor();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}
}
]
}, RGB[0], {
el: BI.extend(Ws[0], {
ref: function (_ref) {
self.R = _ref;
}
}),
width: c.RGB_WIDTH
}, RGB[1], {
el: BI.extend(Ws[1], {
ref: function (_ref) {
self.G = _ref;
}
}),
width: c.RGB_WIDTH
}, RGB[2], {
el: BI.extend(Ws[2], {
ref: function (_ref) {
self.B = _ref;
}
}),
rgap: -5,
width: c.RGB_WIDTH
}
]
}
}
]
},
left: 0,
right: 0,
top: 0,
bottom: 0
}
]
};
},
@ -181,13 +197,13 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
},
_checkEditors: function () {
if(BI.isEmptyString(this.R.getValue())) {
if (BI.isEmptyString(this.R.getValue())) {
this.R.setValue(0);
}
if(BI.isEmptyString(this.G.getValue())) {
if (BI.isEmptyString(this.G.getValue())) {
this.G.setValue(0);
}
if(BI.isEmptyString(this.B.getValue())) {
if (BI.isEmptyString(this.B.getValue())) {
this.B.setValue(0);
}
this.storeValue = {
@ -223,7 +239,7 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, {
} else if (color === "transparent") {
this.colorShow.element.css("background-color", "").removeClass("auto-color-square-normal-background").addClass("trans-color-background");
} else {
this.colorShow.element.css({"background-color": color}).removeClass("auto-color-square-normal-background").removeClass("trans-color-background");
this.colorShow.element.css({ "background-color": color }).removeClass("auto-color-square-normal-background").removeClass("trans-color-background");
}
},

170
src/case/colorchooser/colorpicker/editor.colorpicker.hex.simple.js

@ -19,7 +19,7 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, {
render: function () {
var self = this, o = this.options, c = this.constants;
var RGB = BI.createItems([{text: "R"}, {text: "G"}, {text: "B"}], {
var RGB = BI.createItems([{ text: "R" }, { text: "G" }, { text: "B" }], {
type: "bi.label",
cls: "color-picker-editor-label",
height: 20
@ -31,97 +31,105 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, {
var Ws = BI.map(BI.range(0, 3), function () {
return {
type: "bi.small_text_editor",
cls: "color-picker-editor-input",
cls: "color-picker-editor-input bi-border-radius",
validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
value: 255,
width: c.RGB_WIDTH,
height: 24,
listeners: [{
eventName: BI.TextEditor.EVENT_CHANGE,
action: function () {
self._checkEditors();
if (self.R.isValid() && self.G.isValid() && self.B.isValid()) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.SimpleColorPickerEditor.EVENT_CHANGE);
listeners: [
{
eventName: BI.TextEditor.EVENT_CHANGE,
action: function () {
self._checkEditors();
if (self.R.isValid() && self.G.isValid() && self.B.isValid()) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.SimpleColorPickerEditor.EVENT_CHANGE);
}
}
}
}]
}
]
};
});
return {
type: "bi.vertical",
tgap: 10,
items: [{
el: {
type: "bi.vertical_adapt",
rgap: 5,
columnSize: [22, 10, 'fill', 12, c.RGB_WIDTH, 12, c.RGB_WIDTH, 12, c.RGB_WIDTH],
items: [{
el: {
type: "bi.layout",
cls: "color-picker-editor-display bi-card bi-border",
height: 22,
width: 22,
ref: function (_ref) {
self.colorShow = _ref;
}
},
width: 18,
}, {
type: "bi.label",
text: "#",
width: 10
}, {
type: "bi.small_text_editor",
ref: function (_ref) {
self.hexEditor = _ref;
},
cls: "color-picker-editor-input",
validationChecker: this._hexChecker,
allowBlank: true,
errorText: BI.i18nText("BI-Color_Picker_Error_Text_Hex"),
width: c.HEX_WIDTH,
height: 24,
listeners: [{
eventName: "EVENT_CHANGE",
action: function () {
self._checkHexEditor();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}
}]
}, RGB[0], {
el: BI.extend(Ws[0], {
ref: function (_ref) {
self.R = _ref
}
}),
width: c.RGB_WIDTH
}, RGB[1], {
el: BI.extend(Ws[1], {
ref: function (_ref) {
self.G = _ref
items: [
{
el: {
type: "bi.vertical_adapt",
rgap: 5,
columnSize: [22, 10, 'fill', 12, c.RGB_WIDTH, 12, c.RGB_WIDTH, 12, c.RGB_WIDTH],
items: [
{
el: {
type: "bi.layout",
cls: "color-picker-editor-display bi-card bi-border",
height: 22,
width: 22,
ref: function (_ref) {
self.colorShow = _ref;
}
},
width: 18,
}, {
type: "bi.label",
text: "#",
width: 10
}, {
type: "bi.small_text_editor",
ref: function (_ref) {
self.hexEditor = _ref;
},
cls: "color-picker-editor-input bi-border-radius",
validationChecker: this._hexChecker,
allowBlank: true,
errorText: BI.i18nText("BI-Color_Picker_Error_Text_Hex"),
width: c.HEX_WIDTH,
height: 24,
listeners: [
{
eventName: "EVENT_CHANGE",
action: function () {
self._checkHexEditor();
if (checker(self.storeValue.r) && checker(self.storeValue.g) && checker(self.storeValue.b)) {
self.colorShow.element.css("background-color", self.getValue());
self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE);
}
}
}
]
}, RGB[0], {
el: BI.extend(Ws[0], {
ref: function (_ref) {
self.R = _ref;
}
}),
width: c.RGB_WIDTH
}, RGB[1], {
el: BI.extend(Ws[1], {
ref: function (_ref) {
self.G = _ref;
}
}),
width: c.RGB_WIDTH
}, RGB[2], {
el: BI.extend(Ws[2], {
ref: function (_ref) {
self.B = _ref;
}
}),
rgap: -5,
width: c.RGB_WIDTH
}
}),
width: c.RGB_WIDTH
}, RGB[2], {
el: BI.extend(Ws[2], {
ref: function (_ref) {
self.B = _ref
}
}),
rgap: -5,
width: c.RGB_WIDTH
}]
]
}
}
}]
]
}
};
},
_hexChecker: function (v) {
@ -129,13 +137,13 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, {
},
_checkEditors: function () {
if(BI.isEmptyString(this.R.getValue())) {
if (BI.isEmptyString(this.R.getValue())) {
this.R.setValue(0);
}
if(BI.isEmptyString(this.G.getValue())) {
if (BI.isEmptyString(this.G.getValue())) {
this.G.setValue(0);
}
if(BI.isEmptyString(this.B.getValue())) {
if (BI.isEmptyString(this.B.getValue())) {
this.B.setValue(0);
}
this.hexEditor.setValue(this.getValue().slice(this.constants.HEX_PREFIX_POSITION));
@ -157,7 +165,7 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, {
},
setValue: function (color) {
this.colorShow.element.css({"background-color": color});
this.colorShow.element.css({ "background-color": color });
var json = BI.DOM.rgb2json(BI.DOM.hex2rgb(color));
this.R.setValue(BI.isNull(json.r) ? "" : json.r);
this.G.setValue(BI.isNull(json.g) ? "" : json.g);
@ -174,4 +182,4 @@ BI.SimpleHexColorPickerEditor = BI.inherit(BI.Widget, {
}
});
BI.SimpleHexColorPickerEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.simple_hex_color_picker_editor", BI.SimpleHexColorPickerEditor);
BI.shortcut("bi.simple_hex_color_picker_editor", BI.SimpleHexColorPickerEditor);

96
src/case/colorchooser/colorpicker/editor.colorpicker.js

@ -29,7 +29,7 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
height: 16,
width: 16
});
var RGB = BI.createWidgets(BI.createItems([{text: "R"}, {text: "G"}, {text: "B"}], {
var RGB = BI.createWidgets(BI.createItems([{ text: "R" }, { text: "G" }, { text: "B" }], {
type: "bi.label",
cls: "color-picker-editor-label",
width: 20,
@ -41,7 +41,7 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
};
var Ws = BI.createWidgets([{}, {}, {}], {
type: "bi.small_text_editor",
cls: "color-picker-editor-input",
cls: "color-picker-editor-input bi-border-radius",
validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
@ -95,56 +95,60 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.vertical_adapt",
items: [{
el: this.colorShow,
width: 16
}, {
el: RGB[0],
width: 20
}, {
el: this.R,
width: c.RGB_WIDTH
}, {
el: RGB[1],
width: 20
}, {
el: this.G,
width: c.RGB_WIDTH
}, {
el: RGB[2],
width: 20
}, {
el: this.B,
width: c.RGB_WIDTH
}, {
el: this.transparent,
width: 16,
lgap: 5
}, {
el: this.none,
width: 16,
lgap: 5
}]
},
left: 10,
right: 10,
top: 0,
bottom: 0
}]
items: [
{
el: {
type: "bi.vertical_adapt",
items: [
{
el: this.colorShow,
width: 16
}, {
el: RGB[0],
width: 20
}, {
el: this.R,
width: c.RGB_WIDTH
}, {
el: RGB[1],
width: 20
}, {
el: this.G,
width: c.RGB_WIDTH
}, {
el: RGB[2],
width: 20
}, {
el: this.B,
width: c.RGB_WIDTH
}, {
el: this.transparent,
width: 16,
lgap: 5
}, {
el: this.none,
width: 16,
lgap: 5
}
]
},
left: 10,
right: 10,
top: 0,
bottom: 0
}
]
});
},
_checkEditors: function () {
if(BI.isEmptyString(this.R.getValue())) {
if (BI.isEmptyString(this.R.getValue())) {
this.R.setValue(0);
}
if(BI.isEmptyString(this.G.getValue())) {
if (BI.isEmptyString(this.G.getValue())) {
this.G.setValue(0);
}
if(BI.isEmptyString(this.B.getValue())) {
if (BI.isEmptyString(this.B.getValue())) {
this.B.setValue(0);
}
this.storeValue = {
@ -164,7 +168,7 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
} else if (color === "transparent") {
this.colorShow.element.css("background-color", "").removeClass("auto-color-normal-background").addClass("trans-color-background");
} else {
this.colorShow.element.css({"background-color": color}).removeClass("auto-color-normal-background").removeClass("trans-color-background");
this.colorShow.element.css({ "background-color": color }).removeClass("auto-color-normal-background").removeClass("trans-color-background");
}
},
@ -223,4 +227,4 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, {
}
});
BI.ColorPickerEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.color_picker_editor", BI.ColorPickerEditor);
BI.shortcut("bi.color_picker_editor", BI.ColorPickerEditor);

64
src/case/colorchooser/colorpicker/editor.colorpicker.simple.js

@ -28,7 +28,7 @@ BI.SimpleColorPickerEditor = BI.inherit(BI.Widget, {
height: 16,
width: 16
});
var RGB = BI.createWidgets(BI.createItems([{text: "R"}, {text: "G"}, {text: "B"}], {
var RGB = BI.createWidgets(BI.createItems([{ text: "R" }, { text: "G" }, { text: "B" }], {
type: "bi.label",
cls: "color-picker-editor-label",
width: 20,
@ -40,7 +40,7 @@ BI.SimpleColorPickerEditor = BI.inherit(BI.Widget, {
};
var Ws = BI.createWidgets([{}, {}, {}], {
type: "bi.small_text_editor",
cls: "color-picker-editor-input",
cls: "color-picker-editor-input bi-border-radius",
validationChecker: checker,
errorText: BI.i18nText("BI-Color_Picker_Error_Text"),
allowBlank: true,
@ -64,47 +64,49 @@ BI.SimpleColorPickerEditor = BI.inherit(BI.Widget, {
BI.createWidget({
type: "bi.vertical_adapt",
element: this,
items: [{
el: this.colorShow,
width: 16,
lgap: 20,
rgap: 15
}, {
el: RGB[0],
width: 20
}, {
el: this.R,
width: c.RGB_WIDTH
}, {
el: RGB[1],
width: 20
}, {
el: this.G,
width: c.RGB_WIDTH
}, {
el: RGB[2],
width: 20
}, {
el: this.B,
width: c.RGB_WIDTH
}]
items: [
{
el: this.colorShow,
width: 16,
lgap: 20,
rgap: 15
}, {
el: RGB[0],
width: 20
}, {
el: this.R,
width: c.RGB_WIDTH
}, {
el: RGB[1],
width: 20
}, {
el: this.G,
width: c.RGB_WIDTH
}, {
el: RGB[2],
width: 20
}, {
el: this.B,
width: c.RGB_WIDTH
}
]
});
},
_checkEditors: function () {
if(BI.isEmptyString(this.R.getValue())) {
if (BI.isEmptyString(this.R.getValue())) {
this.R.setValue(0);
}
if(BI.isEmptyString(this.G.getValue())) {
if (BI.isEmptyString(this.G.getValue())) {
this.G.setValue(0);
}
if(BI.isEmptyString(this.B.getValue())) {
if (BI.isEmptyString(this.B.getValue())) {
this.B.setValue(0);
}
},
setValue: function (color) {
this.colorShow.element.css({"background-color": color});
this.colorShow.element.css({ "background-color": color });
var json = BI.DOM.rgb2json(BI.DOM.hex2rgb(color));
this.R.setValue(BI.isNull(json.r) ? "" : json.r);
this.G.setValue(BI.isNull(json.g) ? "" : json.g);
@ -120,4 +122,4 @@ BI.SimpleColorPickerEditor = BI.inherit(BI.Widget, {
}
});
BI.SimpleColorPickerEditor.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.simple_color_picker_editor", BI.SimpleColorPickerEditor);
BI.shortcut("bi.simple_color_picker_editor", BI.SimpleColorPickerEditor);

1
src/case/combo/bubblecombo/combo.bubble.js

@ -53,6 +53,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
offsetStyle: o.offsetStyle,
showArrow: true,
comboClass: o.comboClass,
supportCSSTransform: o.supportCSSTransform,
el: o.el,
popup: () => BI.extend({
type: "bi.bubble_popup_view",

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

@ -16,7 +16,8 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
el: {},
allowClear: false,
status: "success", // success | warning | error,
title: null
title: null,
allowSelectAll: true,
});
},
@ -78,6 +79,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
ref: ref => this.popup = ref,
chooseType: o.chooseType,
items: o.items,
allowSelectAll: o.allowSelectAll,
listeners: [
{
eventName: BI.TextValueComboPopup.EVENT_CHANGE,

187
src/case/combo/textvaluecombo/popup.textvalue.js

@ -2,92 +2,132 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
_defaultConfig: function () {
return BI.extend(BI.TextValueComboPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-text-icon-popup",
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
allowSelectAll: true,
});
},
render () {
render() {
var o = this.options, self = this;
if (o.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_MULTI) {
return {
type: "bi.vertical",
vgap: 5,
items: [{
type: "bi.button_group",
ref: (_ref) => {
this.popup = _ref;
},
items: this._formatItems(o.items),
chooseType: o.chooseType,
layouts: [{
type: "bi.vertical"
}],
value: o.value,
listeners: [{
eventName: BI.Controller.EVENT_CHANGE,
action: function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val, obj);
items: [
{
type: "bi.button_group",
ref: (_ref) => {
this.popup = _ref;
},
items: this._formatItems(o.items),
chooseType: o.chooseType,
layouts: [
{
type: "bi.vertical"
}
}
}]
}]
],
value: o.value,
listeners: [
{
eventName: BI.Controller.EVENT_CHANGE,
action: function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val, obj);
}
}
}
]
}
]
};
}
return {
type: "bi.vertical",
verticalAlign: BI.VerticalAlign.Stretch,
rowSize: ["fill", ""],
items: [{
type: "bi.select_list",
logic: {
dynamic: true,
innerVgap: 5,
rowSize: ["", "fill"],
verticalAlign: BI.VerticalAlign.Stretch
},
ref: (_ref) => {
this.popup = _ref;
},
el: {
items: o.allowSelectAll ? [
{
type: "bi.select_list",
logic: {
dynamic: true,
innerVgap: 5,
rowSize: ["", "fill"],
verticalAlign: BI.VerticalAlign.Stretch
},
ref: (_ref) => {
this.popup = _ref;
},
el: {
chooseType: o.chooseType
}
},
items: this._formatItems(o.items),
value: {
type: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
value: o.value
},
listeners: [{
eventName: BI.SelectList.EVENT_CHANGE,
action: function (val) {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val);
}
}]
}, {
type: "bi.center",
cls: "list-view-toolbar bi-high-light bi-split-top",
height: 24,
items: BI.createItems([{
type: "bi.text_button",
text: BI.i18nText("BI-Basic_Clears"),
handler: function () {
self.fireEvent(BI.TextValueComboPopup.EVENT_CLEAR);
}
el: {
chooseType: o.chooseType,
}
},
items: this._formatItems(o.items),
value: {
type: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
value: o.value
},
height: "fill",
listeners: [
{
eventName: BI.SelectList.EVENT_CHANGE,
action: function (val) {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val);
}
}
]
}, {
type: "bi.text_button",
text: BI.i18nText("BI-Basic_OK"),
handler: function () {
self.fireEvent(BI.TextValueComboPopup.EVENT_CONFIRM);
}
}], {
once: false,
shadow: true,
isShadowShowingOnSelected: true
})
}]
type: "bi.center",
cls: "list-view-toolbar bi-high-light bi-split-top",
height: 24,
items: BI.createItems([
{
type: "bi.text_button",
text: BI.i18nText("BI-Basic_Clears"),
handler: function () {
self.fireEvent(BI.TextValueComboPopup.EVENT_CLEAR);
}
}, {
type: "bi.text_button",
text: BI.i18nText("BI-Basic_OK"),
handler: function () {
self.fireEvent(BI.TextValueComboPopup.EVENT_CONFIRM);
}
}
], {
once: false,
shadow: true,
isShadowShowingOnSelected: true
})
}
] : [
{
type: "bi.list_pane",
logic: {
dynamic: true,
innerVgap: 5,
rowSize: ["", "fill"],
verticalAlign: BI.VerticalAlign.Stretch
},
ref: (_ref) => {
this.popup = _ref;
},
el: {
chooseType: o.chooseType,
},
items: this._formatItems(o.items),
value: o.value,
height: "fill",
listeners: [
{
eventName: BI.ListPane.EVENT_CHANGE,
action: function (val) {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val);
}
}
]
}
],
};
},
@ -117,6 +157,9 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
return this.popup.getValue();
}
var val = this.popup.getValue();
if (!this.options.allowSelectAll) {
return val;
}
if (val.type === BI.ButtonGroup.CHOOSE_TYPE_MULTI) {
return val.value;
} else {
@ -128,6 +171,10 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
if (this.options.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_MULTI) {
return this.popup.setValue(v);
}
if (!this.options.allowSelectAll) {
this.popup.setValue(v);
return;
}
this.popup.setValue({
type: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
value: v

6
src/case/editor/editor.clear.js

@ -31,7 +31,8 @@ BI.ClearEditor = BI.inherit(BI.Widget, {
errorText: o.errorText,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
value: o.value
value: o.value,
autoTrim: o.autoTrim,
});
this.clear = BI.createWidget({
type: "bi.icon_button",
@ -54,7 +55,8 @@ BI.ClearEditor = BI.inherit(BI.Widget, {
{
el: this.clear,
width: 24
}]
}
]
});
this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);

1
src/case/editor/editor.defaulttext.js

@ -45,6 +45,7 @@ BI.DefaultTextEditor = BI.inherit(BI.Widget, {
watermark: o.watermark,
errorText: o.errorText,
invisible: true,
autoTrim: o.autoTrim,
});
var showText = BI.isFunction(o.text) ? o.text() : o.text;

3
src/case/editor/editor.shelter.js

@ -46,7 +46,8 @@ BI.ShelterEditor = BI.inherit(BI.Widget, {
quitChecker: o.quitChecker,
allowBlank: o.allowBlank,
watermark: o.watermark,
errorText: o.errorText
errorText: o.errorText,
autoTrim: o.autoTrim,
});
this.text = BI.createWidget({
type: "bi.text_button",

3
src/case/editor/editor.sign.js

@ -46,7 +46,8 @@ BI.SignEditor = BI.inherit(BI.Widget, {
quitChecker: o.quitChecker,
allowBlank: o.allowBlank,
watermark: o.watermark,
errorText: o.errorText
errorText: o.errorText,
autoTrim: o.autoTrim,
});
this.text = BI.createWidget({
type: "bi.text_button",

3
src/case/editor/editor.state.js

@ -45,7 +45,8 @@ BI.StateEditor = BI.inherit(BI.Widget, {
quitChecker: o.quitChecker,
allowBlank: o.allowBlank,
watermark: o.watermark,
errorText: o.errorText
errorText: o.errorText,
autoTrim: o.autoTrim,
});
this.text = BI.createWidget({
type: "bi.text_button",

19
src/case/editor/editor.state.simple.js

@ -45,7 +45,8 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
quitChecker: o.quitChecker,
allowBlank: o.allowBlank,
watermark: o.watermark,
errorText: o.errorText
errorText: o.errorText,
autoTrim: o.autoTrim,
});
this.text = BI.createWidget({
type: "bi.text_button",
@ -68,13 +69,15 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.text,
left: 0,
right: 0,
top: 0,
bottom: 0
}]
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);

10
src/case/linearsegment/linear.segment.js

@ -47,6 +47,14 @@ BI.LinearSegment = BI.inherit(BI.Widget, {
getValue: function () {
return this.buttonGroup.getValue();
}
},
populate: function (buttons) {
var o = this.options;
this.buttonGroup.populate([BI.createItems(buttons, {
type: "bi.linear_segment_button",
height: o.height
})])
},
});
BI.shortcut("bi.linear_segment", BI.LinearSegment);

9
src/case/segment/segment.js

@ -58,6 +58,15 @@ BI.Segment = BI.inherit(BI.Widget, {
getValue: function () {
return this.buttonGroup.getValue();
},
populate: function (buttons) {
var o = this.options;
this.buttonGroup.populate([BI.createItems(buttons, {
type: "bi.segment_button",
height: BI.toPix(o.height, 2),
whiteSpace: o.whiteSpace,
})]);
},
});
BI.Segment.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.segment", BI.Segment);

8
src/case/ztree/parttree.js

@ -37,6 +37,7 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
var self = this, o = this.options;
var parentValues = BI.deepClone(treeNode.parentValues || self._getParentValues(treeNode));
var name = this._getNodeValue(treeNode);
this.fireEvent(BI.PartTree.EVENT_CLICK_TREE_NODE);
if (treeNode.checked === true) {
this.options.paras.selectedValues = this._getUnionValue();
// this._buildTree(self.options.paras.selectedValues, BI.concat(parentValues, name));
@ -80,7 +81,7 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
var rootNoots = this.nodes.getNodes();
track(rootNoots);
function track (nodes) {
function track(nodes) {
BI.each(nodes, function (i, node) {
var checkState = node.getCheckStatus();
if (checkState.checked === false) {
@ -135,7 +136,7 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
self.fireEvent(BI.Events.AFTERINIT);
};
function callback (nodes) {
function callback(nodes) {
if (self._stop === true) {
return;
}
@ -171,7 +172,7 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
track([], valueA, valueB);
track([], valueB, valueA);
function track (parent, node, compare) {
function track(parent, node, compare) {
BI.each(node, function (n, item) {
if (BI.isNull(compare[n])) {
self._addTreeNode(map, parent, n, item);
@ -197,4 +198,5 @@ BI.PartTree = BI.inherit(BI.AsyncTree, {
}
});
BI.PartTree.EVENT_CLICK_TREE_NODE = "EVENT_CLICK_TREE_NODE";
BI.shortcut("bi.part_tree", BI.PartTree);

12
src/core/controller/controller.bubbles.js

@ -45,9 +45,11 @@ BI.BubblesController = BI.inherit(BI.Controller, {
BI.createWidget({
type: "bi.default",
element: container,
items: [{
el: bubble
}]
items: [
{
el: bubble
}
]
});
if (this.storePoppers[name]) {
this.storePoppers[name].destroy();
@ -65,6 +67,10 @@ BI.BubblesController = BI.inherit(BI.Controller, {
options: {
offset: [adjustXOffset, adjustYOffset]
}
},
{
name: "preventOverflow",
enabled: false
}
]
});

61
src/core/controller/controller.layer.js

@ -63,41 +63,54 @@ BI.LayerController = BI.inherit(BI.Controller, {
var layout = BI.createWidget({
type: "bi.absolute",
invisible: true,
items: [{
el: widget,
left: 0,
right: 0,
top: 0,
bottom: 0
}]
items: [
{
el: widget,
left: 0,
right: 0,
top: 0,
bottom: 0
}
]
}, context);
BI.createWidget({
type: "bi.absolute",
element: op.container || this.options.render,
items: [{
el: layout,
left: offset.left || 0,
right: offset.right || 0,
top: offset.top || 0,
bottom: offset.bottom || 0
}]
items: [
{
el: layout,
left: offset.left || 0,
right: offset.right || 0,
top: offset.top || 0,
bottom: offset.bottom || 0
}
]
});
if (w) {
layout.element.addClass("bi-popup-view");
layout.element.css({
left: w.offset().left + (offset.left || 0),
top: w.offset().top + (offset.top || 0),
width: offset.width || (w.outerWidth() - (offset.left || 0) - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.top || 0) - (offset.bottom || 0)) || ""
});
layout.element.on("__resize__", function () {
w.is(":visible") &&
layout.element.css({
function getComputedPosition() {
var css = {
left: w.offset().left + (offset.left || 0),
top: w.offset().top + (offset.top || 0),
width: offset.width || (w.outerWidth() - (offset.left || 0) - (offset.right || 0)) || "",
height: offset.height || (w.outerHeight() - (offset.top || 0) - (offset.bottom || 0)) || ""
});
};
const { top, left, scaleY, scaleX } = BI.DOM.getPositionRelativeContainingBlockRect(layout.element[0]);
css.top = (css.top - top) / scaleY;
css.left = (css.left - left) / scaleX;
return css;
}
layout.element.css(getComputedPosition());
layout.element.on("__resize__", function () {
w.is(":visible") &&
layout.element.css(getComputedPosition());
});
}
this.add(name, widget, layout);

3474
src/core/controller/popper.js

File diff suppressed because it is too large Load Diff

328
src/core/platform/web/dom.js

@ -56,7 +56,7 @@
preloadImages: function (srcArray, onload) {
var count = 0, images = [];
function complete () {
function complete() {
count++;
if (count >= srcArray.length) {
onload();
@ -151,9 +151,15 @@
BI.extend(BI.DOM, {
getLeftPosition: function (combo, popup, extraWidth) {
getLeftPosition: function (combo, popup, extraWidth, container) {
var el = combo.element;
var popupEl = popup.element;
var elRect = el[0].getBoundingClientRect();
var popupElRect = popupEl[0].getBoundingClientRect();
var containerRect = container ? container.getBoundingClientRect() : { left: 0 };
return {
left: combo.element.offset().left - popup.element.outerWidth() - (extraWidth || 0)
left: elRect.left - containerRect.left - popupElRect.width - (extraWidth || 0)
};
},
@ -163,10 +169,13 @@
};
},
getRightPosition: function (combo, popup, extraWidth) {
getRightPosition: function (combo, popup, extraWidth, container) {
var el = combo.element;
var elRect = el[0].getBoundingClientRect();
var containerRect = container ? container.getBoundingClientRect() : { left: 0 };
return {
left: el.offset().left + el.outerWidth() + (extraWidth || 0)
left: elRect.left + elRect.width - containerRect.left + (extraWidth || 0)
};
},
@ -177,16 +186,25 @@
};
},
getTopPosition: function (combo, popup, extraHeight) {
getTopPosition: function (combo, popup, extraHeight, container) {
var el = combo.element;
var popupEl = popup.element;
var elRect = el[0].getBoundingClientRect();
var popupElRect = popupEl[0].getBoundingClientRect();
var containerRect = container ? container.getBoundingClientRect() : { top: 0 };
return {
top: combo.element.offset().top - popup.element.outerHeight() - (extraHeight || 0)
top: elRect.top - containerRect.top - popupElRect.height - (extraHeight || 0)
};
},
getBottomPosition: function (combo, popup, extraHeight) {
getBottomPosition: function (combo, popup, extraHeight, container) {
var el = combo.element;
var elRect = el[0].getBoundingClientRect();
var containerRect = container ? container.getBoundingClientRect() : { top: 0 };
return {
top: el.offset().top + el.outerHeight() + (extraHeight || 0)
top: elRect.top - containerRect.top + elRect.height + (extraHeight || 0)
};
},
@ -201,9 +219,9 @@
},
isRightSpaceEnough: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return BI.DOM.getRightPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width;
var viewBounds = popup.element[0].getBoundingClientRect(),
viewportBounds = document.documentElement.getBoundingClientRect();
return BI.DOM.getRightPosition(combo, popup, extraWidth).left + viewBounds.width <= viewportBounds.width;
},
isInnerRightSpaceEnough: function (combo, popup, extraWidth) {
@ -215,41 +233,47 @@
},
isBottomSpaceEnough: function (combo, popup, extraHeight) {
var viewBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return BI.DOM.getBottomPosition(combo, popup, extraHeight).top + viewBounds.height <= windowBounds.height;
var viewBounds = popup.element[0].getBoundingClientRect(),
viewportBounds = document.documentElement.getBoundingClientRect();
return BI.DOM.getBottomPosition(combo, popup, extraHeight).top + viewBounds.height <= viewportBounds.height;
},
isRightSpaceLarger: function (combo) {
var windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return windowBounds.width - combo.element.offset().left - combo.element.bounds().width >= combo.element.offset().left;
var comboBounds = combo.element[0].getBoundingClientRect(),
viewportBounds = document.documentElement.getBoundingClientRect();
return viewportBounds.width - comboBounds.right >= comboBounds.left;
},
isBottomSpaceLarger: function (combo) {
var windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
return windowBounds.height - combo.element.offset().top - combo.element.bounds().height >= combo.element.offset().top;
var comboBounds = combo.element[0].getBoundingClientRect(),
viewportBounds = document.documentElement.getBoundingClientRect();
return viewportBounds.height - comboBounds.bottom >= comboBounds.top;
},
_getLeftAlignPosition: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
var left = combo.element.offset().left + extraWidth;
if (left + viewBounds.width > windowBounds.width) {
left = windowBounds.width - viewBounds.width;
_getLeftAlignPosition: function (combo, popup, extraWidth, container) {
var comboRect = combo.element[0].getBoundingClientRect(),
popupRect = popup.element[0].getBoundingClientRect(),
viewportRect = document.documentElement.getBoundingClientRect(),
containerRect = container ? container.getBoundingClientRect() : { left: 0 };
var left = comboRect.left - containerRect.left + extraWidth;
if (comboRect.left + popupRect.width > viewportRect.width) {
left = viewportRect.width - popupRect.width - containerRect.left;
}
return left;
},
getLeftAlignPosition: function (combo, popup, extraWidth) {
var left = this._getLeftAlignPosition(combo, popup, extraWidth);
getLeftAlignPosition: function (combo, popup, extraWidth, container) {
var left = this._getLeftAlignPosition(combo, popup, extraWidth, container);
var dir = "";
// 如果放不下,优先使用RightAlign, 如果RightAlign也放不下, 再使用left=0
if (left < 0) {
var containerRect = container ? container.getBoundingClientRect() : { left: 0 };
if (left + containerRect.left < 0) {
left = this._getRightAlignPosition(combo, popup, extraWidth);
dir = "left";
}
if (left < 0) {
left = 0;
if (left + containerRect.left < 0) {
left = 0 - containerRect.left;
}
return {
left: left,
@ -257,26 +281,28 @@
};
},
getLeftAdaptPosition: function (combo, popup, extraWidth) {
if (BI.DOM.isLeftSpaceEnough(combo, popup, extraWidth)) {
return BI.DOM.getLeftPosition(combo, popup, extraWidth);
getLeftAdaptPosition: function (combo, popup, extraWidth, container) {
if (BI.DOM.isLeftSpaceEnough(combo, popup, extraWidth, container)) {
return BI.DOM.getLeftPosition(combo, popup, extraWidth, container);
}
return {
left: 0
};
},
_getRightAlignPosition: function (combo, popup, extraWidth) {
var comboBounds = combo.element.bounds(), viewBounds = popup.element.bounds();
return combo.element.offset().left + comboBounds.width - viewBounds.width - extraWidth;
_getRightAlignPosition: function (combo, popup, extraWidth, container) {
var comboBounds = combo.element[0].getBoundingClientRect(),
viewBounds = popup.element[0].getBoundingClientRect(),
containerRect = container ? container.getBoundingClientRect() : { left: 0 };
return comboBounds.left + comboBounds.width - viewBounds.width - extraWidth - containerRect.left;
},
getRightAlignPosition: function (combo, popup, extraWidth) {
var left = this._getRightAlignPosition(combo, popup, extraWidth);
getRightAlignPosition: function (combo, popup, extraWidth, container) {
var left = this._getRightAlignPosition(combo, popup, extraWidth, container);
var dir = "";
// 如果放不下,优先使用LeftAlign, 如果LeftAlign也放不下, 再使用left=0
if (left < 0) {
left = this._getLeftAlignPosition(combo, popup, extraWidth);
left = this._getLeftAlignPosition(combo, popup, extraWidth, container);
dir = "right";
}
if (left < 0) {
@ -288,33 +314,34 @@
};
},
getRightAdaptPosition: function (combo, popup, extraWidth) {
if (BI.DOM.isRightSpaceEnough(combo, popup, extraWidth)) {
return BI.DOM.getRightPosition(combo, popup, extraWidth);
getRightAdaptPosition: function (combo, popup, extraWidth, container) {
if (BI.DOM.isRightSpaceEnough(combo, popup, extraWidth, container)) {
return BI.DOM.getRightPosition(combo, popup, extraWidth, container);
}
return {
left: BI.Widget._renderEngine.createElement("body").bounds().width - popup.element.bounds().width
left: document.documentElement.getBoundingClientRect().width - popup.element[0].getBoundingClientRect().width - container.getBoundingClientRect().left
};
},
getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) {
var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight, container) {
var comboBounds = combo.element[0].getBoundingClientRect(),
popupBounds = popup.element[0].getBoundingClientRect(),
viewportBounds = document.documentElement.getBoundingClientRect(),
containerBounds = container ? container.getBoundingClientRect() : { top: 0 };
var top, adaptHeight, dir;
if (BI.DOM.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
top = comboOffset.top + extraHeight;
top = comboBounds.top - containerBounds.top + extraHeight;
} else if (needAdaptHeight) {
top = comboOffset.top + extraHeight;
adaptHeight = windowBounds.height - top;
top = comboBounds.top - containerBounds.top + extraHeight;
adaptHeight = viewportBounds.height - comboBounds.top;
} else if (BI.DOM.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
// 下方空间不足且不允许调整高度的情况下,优先使用上对齐
top = comboOffset.top + comboBounds.height - popupBounds.height - extraHeight;
top = comboBounds.top + comboBounds.height - popupBounds.height - containerBounds.top - extraHeight;
dir = "top";
} else {
top = windowBounds.height - popupBounds.height;
top = viewportBounds.height - popupBounds.height;
if (top < extraHeight) {
adaptHeight = windowBounds.height - extraHeight;
adaptHeight = viewportBounds.height - extraHeight;
}
}
if (top < extraHeight) {
@ -330,42 +357,45 @@
};
},
getTopAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) {
var popupBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
getTopAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight, positionRelativeElement) {
var comboBounds = combo.element[0].getBoundingClientRect(),
popupBounds = popup.element[0].getBoundingClientRect(),
positionRelativeElementRect = positionRelativeElement.getBoundingClientRect(),
viewportBounds = document.documentElement.getBoundingClientRect();
if (BI.DOM.isTopSpaceEnough(combo, popup, extraHeight)) {
return BI.DOM.getTopPosition(combo, popup, extraHeight);
}
if (needAdaptHeight) {
return {
top: 0,
adaptHeight: combo.element.offset().top - extraHeight
top: 0 - positionRelativeElementRect.top,
adaptHeight: comboBounds.top - extraHeight
};
}
if (popupBounds.height + extraHeight > windowBounds.height) {
if (popupBounds.height + extraHeight > viewportBounds.height) {
return {
top: 0,
adaptHeight: windowBounds.height - extraHeight
top: 0 - positionRelativeElementRect.top,
adaptHeight: viewportBounds.height - extraHeight
};
}
return {
top: 0
top: 0 - positionRelativeElementRect.top
};
},
getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) {
var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight, container) {
var comboBounds = combo.element[0].getBoundingClientRect(),
popupBounds = popup.element[0].getBoundingClientRect(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds(),
containerBounds = container ? container.getBoundingClientRect() : { top: 0 };
var top, adaptHeight, dir;
if (BI.DOM.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
top = comboOffset.top + comboBounds.height - popupBounds.height - extraHeight;
top = comboBounds.top + comboBounds.height - containerBounds.top - popupBounds.height;
} else if (needAdaptHeight) {
top = 0;
adaptHeight = comboOffset.top + comboBounds.height - extraHeight;
top = 0 - containerBounds.top;
adaptHeight = comboBounds.top + comboBounds.height - extraHeight;
} else if (BI.DOM.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
// 上方空间不足且不允许调整高度的情况下,优先使用下对齐
top = comboOffset.top + extraHeight;
top = comboBounds.top - containerBounds.top + extraHeight;
dir = "bottom";
} else {
top = 0;
@ -373,7 +403,7 @@
adaptHeight = windowBounds.height - extraHeight;
}
}
if (top < 0) {
if (top + containerBounds.top < 0) {
top = 0;
}
return adaptHeight ? {
@ -386,41 +416,43 @@
};
},
getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) {
var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight, positionRelativeElement) {
var comboBounds = combo.element[0].getBoundingClientRect(),
popupBounds = popup.element[0].getBoundingClientRect(),
viewportBounds = document.documentElement.getBoundingClientRect(),
positionRelativeElementRect = positionRelativeElement.getBoundingClientRect();
if (BI.DOM.isBottomSpaceEnough(combo, popup, extraHeight)) {
return BI.DOM.getBottomPosition(combo, popup, extraHeight);
return BI.DOM.getBottomPosition(combo, popup, extraHeight, positionRelativeElement);
}
if (needAdaptHeight) {
return {
top: comboOffset.top + comboBounds.height + extraHeight,
adaptHeight: windowBounds.height - comboOffset.top - comboBounds.height - extraHeight
top: comboBounds.top + comboBounds.height + extraHeight - positionRelativeElementRect.top,
adaptHeight: viewportBounds.height - comboBounds.top - comboBounds.height - extraHeight
};
}
if (popupBounds.height + extraHeight > windowBounds.height) {
if (popupBounds.height + extraHeight > viewportBounds.height) {
return {
top: extraHeight,
adaptHeight: windowBounds.height - extraHeight
top: extraHeight - positionRelativeElementRect.top,
adaptHeight: viewportBounds.height - extraHeight
};
}
return {
top: windowBounds.height - popupBounds.height - extraHeight
top: viewportBounds.height - popupBounds.height - extraHeight - positionRelativeElementRect.top
};
},
getCenterAdaptPosition: function (combo, popup) {
var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
getCenterAdaptPosition: function (combo, popup, positionRelativeElement) {
var comboRect = combo.element[0].getBoundingClientRect(),
popupRect = popup.element[0].getBoundingClientRect(),
positionRelativeElementRect = positionRelativeElement.getBoundingClientRect(),
viewportBounds = document.documentElement.getBoundingClientRect();
var left;
if (comboOffset.left + comboBounds.width / 2 + popupBounds.width / 2 > windowBounds.width) {
left = windowBounds.width - popupBounds.width;
if (comboRect.left + comboRect.width / 2 + popupRect.width / 2 > viewportBounds.width) {
left = viewportBounds.width - comboRect.width - positionRelativeElementRect.left;
} else {
left = comboOffset.left + comboBounds.width / 2 - popupBounds.width / 2;
left = comboRect.left + (comboRect.width - popupRect.width) / 2 - positionRelativeElementRect.left;
}
if (left < 0) {
if (left + positionRelativeElementRect.left < 0) {
left = 0;
}
return {
@ -428,17 +460,19 @@
};
},
getMiddleAdaptPosition: function (combo, popup) {
var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
getMiddleAdaptPosition: function (combo, popup, positionRelativeElement) {
var comboRect = combo.element[0].getBoundingClientRect(),
popupRect = popup.element[0].getBoundingClientRect(),
positionRelativeElementRect = positionRelativeElement.getBoundingClientRect(),
viewportBounds = document.documentElement.getBoundingClientRect();
var top;
if (comboOffset.top + comboBounds.height / 2 + popupBounds.height / 2 > windowBounds.height) {
top = windowBounds.height - popupBounds.height;
if (comboRect.top + comboRect.height / 2 + popupRect.height / 2 > viewportBounds.height) {
top = viewportBounds.height - popupRect.height - positionRelativeElementRect.top;
} else {
top = comboOffset.top + comboBounds.height / 2 - popupBounds.height / 2;
top = comboRect.top + (comboRect.height - popupRect.height) / 2 - positionRelativeElementRect.top;
}
if (top < 0) {
if (top + positionRelativeElementRect.top < 0) {
top = 0;
}
return {
@ -446,7 +480,7 @@
};
},
getComboPositionByDirections: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions) {
getComboPositionByDirections: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions, container) {
extraWidth || (extraWidth = 0);
extraHeight || (extraHeight = 0);
var i, direct;
@ -483,11 +517,11 @@
if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? 0 : extraHeight;
if (BI.DOM.isLeftSpaceEnough(combo, popup, tW)) {
left = BI.DOM.getLeftPosition(combo, popup, tW).left;
left = BI.DOM.getLeftPosition(combo, popup, tW, container).left;
if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight);
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight, container);
} else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight);
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight, container);
}
pos.dir = "left," + pos.dir;
if (tbFirst) {
@ -503,11 +537,11 @@
if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? extraWidth : extraHeight;
if (BI.DOM.isRightSpaceEnough(combo, popup, tW)) {
left = BI.DOM.getRightPosition(combo, popup, tW).left;
left = BI.DOM.getRightPosition(combo, popup, tW, container).left;
if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight);
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight, container);
} else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight);
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight, container);
}
pos.dir = "right," + pos.dir;
if (tbFirst) {
@ -522,11 +556,11 @@
case "top":
var tW = lrFirst ? extraHeight : extraWidth, tH = lrFirst ? extraWidth : extraHeight;
if (BI.DOM.isTopSpaceEnough(combo, popup, tH)) {
top = BI.DOM.getTopPosition(combo, popup, tH).top;
top = BI.DOM.getTopPosition(combo, popup, tH, container).top;
if (leftRight[0] === "right") {
pos = BI.DOM.getLeftAlignPosition(combo, popup, tW, needAdaptHeight);
pos = BI.DOM.getLeftAlignPosition(combo, popup, tW, container);
} else {
pos = BI.DOM.getRightAlignPosition(combo, popup, tW);
pos = BI.DOM.getRightAlignPosition(combo, popup, tW, container);
}
pos.dir = "top," + pos.dir;
if (lrFirst) {
@ -543,11 +577,11 @@
case "bottom":
var tW = lrFirst ? extraHeight : extraWidth, tH = lrFirst ? extraWidth : extraHeight;
if (BI.DOM.isBottomSpaceEnough(combo, popup, tH)) {
top = BI.DOM.getBottomPosition(combo, popup, tH).top;
top = BI.DOM.getBottomPosition(combo, popup, tH, container).top;
if (leftRight[0] === "right") {
pos = BI.DOM.getLeftAlignPosition(combo, popup, tW, needAdaptHeight);
pos = BI.DOM.getLeftAlignPosition(combo, popup, tW, container);
} else {
pos = BI.DOM.getRightAlignPosition(combo, popup, tW);
pos = BI.DOM.getRightAlignPosition(combo, popup, tW, container);
}
pos.dir = "bottom," + pos.dir;
if (lrFirst) {
@ -610,10 +644,10 @@
case "left":
case "right":
if (BI.DOM.isRightSpaceLarger(combo)) {
left = BI.DOM.getRightAdaptPosition(combo, popup, extraWidth).left;
left = BI.DOM.getRightAdaptPosition(combo, popup, extraWidth, container).left;
firstDir = "right";
} else {
left = BI.DOM.getLeftAdaptPosition(combo, popup, extraWidth).left;
left = BI.DOM.getLeftAdaptPosition(combo, popup, extraWidth, container).left;
firstDir = "left";
}
if (topBottom[0] === "bottom") {
@ -628,19 +662,19 @@
return pos;
default :
if (BI.DOM.isBottomSpaceLarger(combo)) {
top = BI.DOM.getBottomAdaptPosition(combo, popup, extraHeight, needAdaptHeight).top;
top = BI.DOM.getBottomAdaptPosition(combo, popup, extraHeight, needAdaptHeight, container).top;
firstDir = "bottom";
} else {
top = BI.DOM.getTopAdaptPosition(combo, popup, extraHeight, needAdaptHeight).top;
top = BI.DOM.getTopAdaptPosition(combo, popup, extraHeight, needAdaptHeight, container).top;
firstDir = "top";
}
if (leftRight[0] === "right") {
pos = BI.DOM.getLeftAlignPosition(combo, popup, extraWidth, needAdaptHeight);
pos = BI.DOM.getLeftAlignPosition(combo, popup, extraWidth, container);
pos.top = top;
pos.dir = firstDir + "," + pos.dir;
return pos;
}
pos = BI.DOM.getRightAlignPosition(combo, popup, extraWidth);
pos = BI.DOM.getRightAlignPosition(combo, popup, extraWidth, container);
pos.top = top;
pos.dir = firstDir + "," + pos.dir;
return pos;
@ -648,37 +682,77 @@
},
getComboPosition: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions, offsetStyle) {
getComboPosition: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions, offsetStyle, positionRelativeElement) {
extraWidth || (extraWidth = 0);
extraHeight || (extraHeight = 0);
var bodyHeight = BI.Widget._renderEngine.createElement("body").bounds().height - extraHeight;
var maxHeight = Math.min(popup.attr("maxHeight") || bodyHeight, bodyHeight);
var viewportBounds = document.documentElement.getBoundingClientRect();
var maxHeight = Math.min(popup.attr("maxHeight") || viewportBounds.height, viewportBounds.height);
popup.resetHeight && popup.resetHeight(maxHeight);
var position = BI.DOM.getComboPositionByDirections(combo, popup, extraWidth, extraHeight, needAdaptHeight, directions || ["bottom", "top", "right", "left"]);
var position = BI.DOM.getComboPositionByDirections(combo, popup, extraWidth, extraHeight, needAdaptHeight, directions || ["bottom", "top", "right", "left"], positionRelativeElement);
switch (offsetStyle) {
case "center":
if (position.change) {
var p = BI.DOM.getMiddleAdaptPosition(combo, popup);
var p = BI.DOM.getMiddleAdaptPosition(combo, popup, positionRelativeElement);
position.top = p.top;
} else {
var p = BI.DOM.getCenterAdaptPosition(combo, popup);
var p = BI.DOM.getCenterAdaptPosition(combo, popup, positionRelativeElement);
position.left = p.left;
}
break;
case "middle":
if (position.change) {
var p = BI.DOM.getCenterAdaptPosition(combo, popup);
var p = BI.DOM.getCenterAdaptPosition(combo, popup, positionRelativeElement);
position.left = p.left;
} else {
var p = BI.DOM.getMiddleAdaptPosition(combo, popup);
var p = BI.DOM.getMiddleAdaptPosition(combo, popup, positionRelativeElement);
position.top = p.top;
}
break;
}
if (needAdaptHeight === true) {
popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight));
popup.resetHeight && popup.resetHeight(Math.min(viewportBounds.height - position.top + (positionRelativeElement ? positionRelativeElement.getBoundingClientRect().top : 0), maxHeight));
}
return position;
}
},
/**
* 获取position:fixed相对定位的元素
*/
getPositionRelativeContainingBlock: function (element) {
if (['html', 'body', '#document'].indexOf((element.nodeName || '').toLowerCase()) >= 0) {
// $FlowFixMe[incompatible-return]: assume body is always available
return element.ownerDocument.body;
}
function isExcept(node) {
var _computedStyle = getComputedStyle(node);
var transform = _computedStyle.transform;
var perspective = _computedStyle.perspective;
var filter = _computedStyle.filter;
var willChange = _computedStyle["will-change"];
return [transform, perspective, filter].some(value => value !== 'none') || (willChange === "transform");
}
if (isExcept(element)) {
return element;
}
return BI.DOM.getPositionRelativeContainingBlock(element.parentNode);
},
/**
* 获取position:fixed相对定位的元素的clientRect
*/
getPositionRelativeContainingBlockRect: function (element) {
var positionRelativeElement = BI.DOM.getPositionRelativeContainingBlock(element);
var rect = positionRelativeElement.getBoundingClientRect();
return {
...rect.toJSON(),
scaleX: rect.width / positionRelativeElement.offsetWidth,
scaleY: rect.height / positionRelativeElement.offsetHeight
};
},
});
})();

10
src/core/platform/web/function.js

@ -137,5 +137,15 @@ BI._.extend(BI, {
return version[1] * 1;
}
return 0;
},
getMinimumFontSize: function () {
// not work for firefox
const el = document.createElement('div');
el.style.fontSize = "1px";
document.body.appendChild(el);
const size = getComputedStyle(el).fontSize;
el.remove();
return parseInt(size);
}
});

2
src/less/core/utils/motion/zoom.less

@ -4,7 +4,7 @@
.make-motion(@className, @keyframeName, @duration);
.@{className}-enter,
.@{className}-appear {
transform: scale(0); // need this by yiminghe
//transform: scale(0); // need this by yiminghe, but dailer did not need this
opacity: 0;
animation-timing-function: @ease-out-circ;

2
src/less/widget/multiselect/trigger/button.checkselected.less

@ -2,7 +2,7 @@
.bi-multi-select-check-selected-button {
z-index: 1;
.border-radius(50%);
.border-radius(99999px);
&:active {
color: @color-bi-text-highlight;

6
src/less/widget/multitree/trigger/multi.tree.button.checkselected.less

@ -6,11 +6,11 @@
z-index: 1;
}
.trigger-check-text {
.border-radius(8px);
.border-radius(calc(var(--css-scale, 1) * 8px));
.border-radius(99999px);
z-index: 1;
&:active {
background-color: @color-bi-background-multi-select-trigger-check-selected;
}
}
}
}

5
src/widget/downlist/combo.downlist.js

@ -44,7 +44,8 @@
popup: {},
minWidth: 140,
maxHeight: 1000,
destroyWhenHide: false
destroyWhenHide: false,
isDefaultInit: true,
});
},
@ -57,7 +58,7 @@
type: "bi.combo",
trigger: o.trigger,
isNeedAdjustWidth: false,
isDefaultInit: true,
isDefaultInit: o.isDefaultInit,
container: o.container,
adjustLength: o.adjustLength,
direction: o.direction,

3
src/widget/editor/editor.search.js

@ -27,7 +27,8 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
errorText: o.errorText,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
value: o.value
value: o.value,
autoTrim: o.autoTrim,
});
this.clear = BI.createWidget({
type: "bi.icon_button",

3
src/widget/editor/editor.text.js

@ -47,7 +47,8 @@ BI.TextEditor = BI.inherit(BI.Widget, {
watermark: o.watermark,
errorText: o.errorText,
inputType: o.inputType,
autocomplete: o.autocomplete
autocomplete: o.autocomplete,
autoTrim: o.autoTrim,
});
this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);

21
src/widget/multiselect/check/multiselect.display.js

@ -40,10 +40,12 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, {
},
items: this._createItems(opts.items),
chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
layouts: [{
type: "bi.vertical",
lgap: 10
}]
layouts: [
{
type: "bi.vertical",
lgap: 10
}
]
},
itemsCreator: function (options, callback) {
if (options.times === 1) {
@ -53,10 +55,7 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, {
if (cacheItems.length > 0) {
var renderedItems = cacheItems.slice(0, 100);
cacheItems = cacheItems.slice(100);
self.hasNext = true;
if (cacheItems.length === 0) {
self.hasNext = false;
}
self.hasNext = cacheItems.length > 0;
callback(self._createItems(renderedItems));
return;
}
@ -65,8 +64,8 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, {
self.hasNext = !!ob.hasNext;
var firstItemsCount = 100 + ob.items.length % 100;
if (ob.items.length > 100) {
cacheItems = ob.items.slice(100 + ob.items.length % 100);
self.hasNext = true;
cacheItems = ob.items.slice(firstItemsCount);
self.hasNext = (firstItemsCount === ob.items.length) ? false : true;
}
callback(self._createItems(ob.items.slice(0, firstItemsCount)));
});
@ -104,4 +103,4 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, {
}
});
BI.shortcut("bi.display_selected_list", BI.DisplaySelectedList);
BI.shortcut("bi.display_selected_list", BI.DisplaySelectedList);

124
src/widget/multitree/multi.tree.combo.js

@ -42,7 +42,15 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
},
searcher: {
type: "bi.multi_tree_searcher",
itemsCreator: o.itemsCreator
itemsCreator: o.itemsCreator,
listeners: [
{
eventName: BI.MultiTreeSearcher.EVENT_CLICK_TREE_NODE,
action: function () {
self._dataChange = true;
}
}
],
},
value: { value: o.value || {} }
});
@ -61,43 +69,45 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
listeners: [{
eventName: BI.MultiTreePopup.EVENT_AFTERINIT,
action: function () {
self.numberCounter.adjustView();
isInit = true;
if (want2showCounter === true) {
showCounter();
listeners: [
{
eventName: BI.MultiTreePopup.EVENT_AFTERINIT,
action: function () {
self.numberCounter.adjustView();
isInit = true;
if (want2showCounter === true) {
showCounter();
}
}
}, {
eventName: BI.MultiTreePopup.EVENT_CHANGE,
action: function () {
change = true;
var val = {
type: BI.Selection.Multi,
value: this.hasChecked() ? this.getValue() : {}
};
self.trigger.getSearcher().setState(val);
self.numberCounter.setButtonChecked(val);
self.storeValue = { value: self.combo.getValue() };
self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM, self.combo.getValue());
self._dataChange = true;
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
action: function () {
self.combo.hideView();
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
action: function () {
clear = true;
self._dataChange = true;
self.setValue();
self._defaultState();
}
}
}, {
eventName: BI.MultiTreePopup.EVENT_CHANGE,
action: function () {
change = true;
var val = {
type: BI.Selection.Multi,
value: this.hasChecked() ? this.getValue() : {}
};
self.trigger.getSearcher().setState(val);
self.numberCounter.setButtonChecked(val);
self.storeValue = { value: self.combo.getValue() };
self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM, self.combo.getValue());
self._dataChange = true;
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
action: function () {
self.combo.hideView();
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
action: function () {
clear = true;
self._dataChange = true;
self.setValue();
self._defaultState();
}
}],
],
itemsCreator: o.itemsCreator,
onLoaded: function () {
BI.nextTick(function () {
@ -293,26 +303,28 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.vertical_adapt",
items: [this.numberCounter]
},
right: o.height,
top: 0,
bottom: 0
}]
items: [
{
el: this.combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.vertical_adapt",
items: [this.numberCounter]
},
right: o.height,
top: 0,
bottom: 0
}
]
});
},

143
src/widget/multitree/multi.tree.insert.combo.js

@ -47,18 +47,25 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
itemsCreator: o.itemsCreator,
popup: {
type: "bi.multi_tree_search_insert_pane",
listeners: [{
eventName: BI.MultiTreeSearchInsertPane.EVENT_ADD_ITEM,
action: function () {
self.storeValue.value[self.trigger.getSearcher().getKeyword()] = {};
self._assertShowValue();
// setValue以更新paras.value, 之后从search popup中拿到的就能有add的值了
self.combo.setValue(self.storeValue);
self.numberCounter.setValue(self.storeValue);
self._stopEditing();
self._dataChange = true;
listeners: [
{
eventName: BI.MultiTreeSearchInsertPane.EVENT_ADD_ITEM,
action: function () {
self.storeValue.value[self.trigger.getSearcher().getKeyword()] = {};
self._assertShowValue();
// setValue以更新paras.value, 之后从search popup中拿到的就能有add的值了
self.combo.setValue(self.storeValue);
self.numberCounter.setValue(self.storeValue);
self._stopEditing();
self._dataChange = true;
}
}, {
eventName: BI.MultiTreeSearchInsertPane.EVENT_CLICK_TREE_NODE,
action: function () {
self._dataChange = true;
}
}
}]
]
}
},
value: { value: o.value || {} }
@ -79,43 +86,45 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
self.trigger.setAdapter(this);
self.numberCounter.setAdapter(this);
},
listeners: [{
eventName: BI.MultiTreePopup.EVENT_AFTERINIT,
action: function () {
self.numberCounter.adjustView();
isInit = true;
if (want2showCounter === true) {
showCounter();
listeners: [
{
eventName: BI.MultiTreePopup.EVENT_AFTERINIT,
action: function () {
self.numberCounter.adjustView();
isInit = true;
if (want2showCounter === true) {
showCounter();
}
}
}, {
eventName: BI.MultiTreePopup.EVENT_CHANGE,
action: function () {
change = true;
var val = {
type: BI.Selection.Multi,
value: this.hasChecked() ? this.getValue() : {}
};
self.trigger.getSearcher().setState(val);
self.numberCounter.setButtonChecked(val);
self.storeValue = { value: self.combo.getValue() };
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.getValue());
self._dataChange = true;
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
action: function () {
self.combo.hideView();
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
action: function () {
clear = true;
self._dataChange = true;
self.setValue();
self._defaultState();
}
}
}, {
eventName: BI.MultiTreePopup.EVENT_CHANGE,
action: function () {
change = true;
var val = {
type: BI.Selection.Multi,
value: this.hasChecked() ? this.getValue() : {}
};
self.trigger.getSearcher().setState(val);
self.numberCounter.setButtonChecked(val);
self.storeValue = { value: self.combo.getValue() };
self.fireEvent(BI.MultiTreeInsertCombo.EVENT_CLICK_ITEM, self.getValue());
self._dataChange = true;
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM,
action: function () {
self.combo.hideView();
}
}, {
eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR,
action: function () {
clear = true;
self._dataChange = true;
self.setValue();
self._defaultState();
}
}],
],
itemsCreator: o.itemsCreator,
onLoaded: function () {
BI.nextTick(function () {
@ -303,26 +312,28 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.vertical_adapt",
items: [this.numberCounter]
},
right: o.height,
top: 0,
height: o.height,
}]
items: [
{
el: this.combo,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.vertical_adapt",
items: [this.numberCounter]
},
right: o.height,
top: 0,
height: o.height,
}
]
});
},

108
src/widget/multitree/trigger/multi.tree.search.insert.pane.js

@ -25,55 +25,64 @@ BI.MultiTreeSearchInsertPane = BI.inherit(BI.Widget, {
return {
type: "bi.absolute",
items: [{
el: {
type: "bi.text_button",
invisible: true,
ref: function (_ref) {
self.addTip = _ref;
},
text: BI.i18nText("BI-Basic_Click_To_Add_Text", ""),
height: this.constants.height,
cls: "bi-high-light",
handler: function () {
self.fireEvent(BI.MultiTreeSearchInsertPane.EVENT_ADD_ITEM, opts.keywordGetter());
}
},
top: 5,
left: 0,
right: 0
}, {
el: BI.extend({
type: "bi.part_tree",
tipText: BI.i18nText("BI-No_Select"),
itemsCreator: function (op, callback) {
op.keyword = opts.keywordGetter();
opts.itemsCreator(op, function (res) {
callback(res);
self.setKeyword(opts.keywordGetter(), res.items);
});
},
ref: function (_ref) {
self.partTree = _ref;
},
value: opts.value,
listeners: [{
eventName: BI.Controller.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
items: [
{
el: {
type: "bi.text_button",
invisible: true,
ref: function (_ref) {
self.addTip = _ref;
},
text: BI.i18nText("BI-Basic_Click_To_Add_Text", ""),
height: this.constants.height,
cls: "bi-high-light",
handler: function () {
self.fireEvent(BI.MultiTreeSearchInsertPane.EVENT_ADD_ITEM, opts.keywordGetter());
}
}, {
eventName: BI.TreeView.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiTreeSearchInsertPane.EVENT_CHANGE);
}
}]
}, opts.el),
left: 0,
top: 0,
bottom: 0,
right: 0
}]
},
top: 5,
left: 0,
right: 0
}, {
el: BI.extend({
type: "bi.part_tree",
tipText: BI.i18nText("BI-No_Select"),
itemsCreator: function (op, callback) {
op.keyword = opts.keywordGetter();
opts.itemsCreator(op, function (res) {
callback(res);
self.setKeyword(opts.keywordGetter(), res.items);
});
},
ref: function (_ref) {
self.partTree = _ref;
},
value: opts.value,
listeners: [
{
eventName: BI.Controller.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
}
}, {
eventName: BI.TreeView.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiTreeSearchInsertPane.EVENT_CHANGE);
}
}, {
eventName: BI.PartTree.EVENT_CLICK_TREE_NODE,
action: function () {
self.fireEvent(BI.MultiTreeSearchInsertPane.EVENT_CLICK_TREE_NODE);
}
}
]
}, opts.el),
left: 0,
top: 0,
bottom: 0,
right: 0
}
]
};
},
@ -115,5 +124,6 @@ BI.MultiTreeSearchInsertPane.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiTreeSearchInsertPane.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM";
BI.MultiTreeSearchInsertPane.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR";
BI.MultiTreeSearchInsertPane.EVENT_ADD_ITEM = "EVENT_ADD_ITEM";
BI.MultiTreeSearchInsertPane.EVENT_CLICK_TREE_NODE = "EVENT_CLICK_TREE_NODE";
BI.shortcut("bi.multi_tree_search_insert_pane", BI.MultiTreeSearchInsertPane);
BI.shortcut("bi.multi_tree_search_insert_pane", BI.MultiTreeSearchInsertPane);

30
src/widget/multitree/trigger/multi.tree.search.pane.js

@ -25,17 +25,24 @@ BI.MultiTreeSearchPane = BI.inherit(BI.Pane, {
opts.itemsCreator(op, callback);
},
value: opts.value,
listeners: [{
eventName: BI.Controller.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
listeners: [
{
eventName: BI.Controller.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
}
}, {
eventName: BI.TreeView.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiTreeSearchPane.EVENT_CHANGE);
}
}, {
eventName: BI.PartTree.EVENT_CLICK_TREE_NODE,
action: function () {
self.fireEvent(BI.MultiTreeSearchPane.EVENT_CLICK_TREE_NODE);
}
}
}, {
eventName: BI.TreeView.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.MultiTreeSearchPane.EVENT_CHANGE);
}
}],
],
ref: function (_ref) {
self.partTree = _ref;
}
@ -72,5 +79,6 @@ BI.MultiTreeSearchPane.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiTreeSearchPane.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM";
BI.MultiTreeSearchPane.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR";
BI.MultiTreeSearchPane.EVENT_CLICK_TREE_NODE = "EVENT_CLICK_TREE_NODE";
BI.shortcut("bi.multi_tree_search_pane", BI.MultiTreeSearchPane);
BI.shortcut("bi.multi_tree_search_pane", BI.MultiTreeSearchPane);

31
src/widget/multitree/trigger/searcher.multi.tree.js

@ -33,17 +33,19 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
defaultText: o.defaultText,
height: o.height
},
listeners: [{
eventName: BI.MultiSelectEditor.EVENT_FOCUS,
action: function () {
self.fireEvent(BI.MultiSelectSearcher.EVENT_FOCUS);
listeners: [
{
eventName: BI.MultiSelectEditor.EVENT_FOCUS,
action: function () {
self.fireEvent(BI.MultiSelectSearcher.EVENT_FOCUS);
}
}, {
eventName: BI.MultiSelectEditor.EVENT_BLUR,
action: function () {
self.fireEvent(BI.MultiSelectSearcher.EVENT_BLUR);
}
}
}, {
eventName: BI.MultiSelectEditor.EVENT_BLUR,
action: function () {
self.fireEvent(BI.MultiSelectSearcher.EVENT_BLUR);
}
}]
]
});
this.searcher = BI.createWidget({
@ -67,6 +69,14 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, {
op.keyword = self.editor.getValue();
o.itemsCreator(op, callback);
},
listeners: [
{
eventName: BI.MultiTreeSearchPane.EVENT_CLICK_TREE_NODE,
action: function () {
self.fireEvent(BI.MultiTreeSearcher.EVENT_CLICK_TREE_NODE, arguments);
}
}
],
value: o.value
}, o.popup),
@ -206,4 +216,5 @@ BI.MultiTreeSearcher.EVENT_CHANGE = "EVENT_CHANGE";
BI.MultiTreeSearcher.EVENT_START = "EVENT_START";
BI.MultiTreeSearcher.EVENT_STOP = "EVENT_STOP";
BI.MultiTreeSearcher.EVENT_PAUSE = "EVENT_PAUSE";
BI.MultiTreeSearcher.EVENT_CLICK_TREE_NODE = "EVENT_CLICK_TREE_NODE";
BI.shortcut("bi.multi_tree_searcher", BI.MultiTreeSearcher);

48
src/widget/numbereditor/number.editor.js

@ -18,7 +18,8 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
errorText: "",
step: 1,
min: BI.MIN,
max: BI.MAX
max: BI.MAX,
watermark: "",
});
},
@ -30,6 +31,7 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
height: BI.toPix(o.height, 2),
simple: o.simple,
allowBlank: o.allowBlank,
watermark: o.watermark,
value: o.valueFormatter(o.value),
validationChecker: function (v) {
// 不设置validationChecker就自动检测
@ -89,23 +91,27 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
type: "bi.htape",
height: BI.toPix(o.height, 2),
element: this,
items: [this.editor, {
el: {
type: "bi.grid",
columns: 1,
rows: 2,
items: [{
column: 0,
row: 0,
el: this.topBtn
}, {
column: 0,
row: 1,
el: this.bottomBtn
}]
},
width: 23
}]
items: [
this.editor, {
el: {
type: "bi.grid",
columns: 1,
rows: 2,
items: [
{
column: 0,
row: 0,
el: this.topBtn
}, {
column: 0,
row: 1,
el: this.bottomBtn
}
]
},
width: 23
}
]
});
},
@ -117,13 +123,13 @@ BI.NumberEditor = BI.inherit(BI.Widget, {
return this.editor.isEditing();
},
_checkValueInRange: function(v) {
_checkValueInRange: function (v) {
var o = this.options;
return !!(BI.isNumeric(v) && BI.parseFloat(v) >= o.min && BI.parseFloat(v) <= o.max);
},
_checkAdjustDisabled: function(v) {
if(this.options.validationChecker === BI.emptyFn) {
_checkAdjustDisabled: function (v) {
if (this.options.validationChecker === BI.emptyFn) {
this.bottomBtn.setEnable(BI.parseFloat(v) > this.options.min);
this.topBtn.setEnable(BI.parseFloat(v) < this.options.max);
}

2
typescript/base/single/button/button.basic.ts

@ -38,7 +38,7 @@ export declare class BasicButton extends Single {
trigger?: string | null;
handler?: Function;
bubble?: Function | null | string;
text?: string;
text?: string | ((context: any) => string);
el?: Obj;
} & Single["props"];

7
typescript/case/combo/combo.textvalue.ts

@ -5,5 +5,10 @@ export declare class TextValueCombo extends Widget {
static EVENT_CHANGE: string;
populate(items: any): void;
clear(): void;
setText(text: string): void;
setValue(value: any): void;
setStatus(status: "success" | "warning" | "error"): void;
getValue(): any[];
populate(items: any[]): void;
}

13
typescript/case/combo/popup.textvalue.ts

@ -0,0 +1,13 @@
import { Pane } from "../../base/pane";
export declare class TextValueComboPopup extends Pane {
static xtype: string;
static EVENT_CHANGE: string;
static EVENT_CLEAR: string;
static EVENT_CONFIRM: string;
populate(items: any[]): void;
getValue(): any;
setValue(value: any): void;
}

12
typescript/component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo.ts

@ -1,14 +1,4 @@
import { Widget, _Widget } from "../../core/widget";
export interface _AllValueMultiTextValueCombo extends _Widget {
getValue<T>(): T[];
populate(items: any): void;
}
export interface _AllValueMultiTextValueComboStatic {
EVENT_CONFIRM: string;
}
import { Widget } from "../../core/widget";
export declare class AllValueMultiTextValueCombo extends Widget {
static xtype: string;

8
typescript/core/base.ts

@ -1,4 +1,4 @@
import { _Widget } from "./widget";
import { Widget } from "./widget";
export interface _base {
assert: (v: any, is: Function) => Boolean;
@ -7,7 +7,7 @@ export interface _base {
UUID: () => string;
isWidget: (widget: any) => widget is _Widget;
isWidget: (widget: any) => widget is Widget;
createWidgets: (items: any, options: any, context: any) => any;
@ -38,7 +38,9 @@ export interface _base {
size: (collection: any) => number;
each: <T>(collection: T[] | object | string, callback?: ((index: number, value: T) => void) | object | string, thisArg?: any) => any;
each<T>(collection: ArrayLike<T>, iteratee?: (index: number, value: T) => void, thisArg?: any): ArrayLike<T>;
each<T extends object, K extends keyof T>(collection: T, iteratee?: (index: K, value: T[K]) => void, thisArg?: any): T;
each<T>(collection: T, iteratee?: any, thisArg?: any): T;
map: <T, U>(collection: T[] | object | string | null | undefined, callback?: ((index: number, value: T) => U) | object | string, thisArg?: any) => U[];

4
typescript/core/plugin.ts

@ -1,7 +1,7 @@
import { _Widget } from "./widget";
import { Widget } from "./widget";
type configWidgetFn = (type: string, options: Obj) => void
type configObjectFn = (type: string, widget: _Widget) => void
type configObjectFn = (type: string, widget: Widget) => void
export type _config = (widgetFunction: configWidgetFn | configWidgetFn[], objectFunction: configObjectFn | configObjectFn[]) => void

419
typescript/core/widget.ts

@ -1,401 +1,5 @@
import { OB, _OB } from "./ob";
export interface _WidgetStatic {
/**
*
* @param engine
*/
registerRenderEngine(engine: RenderEngine): void;
}
export interface _Widget extends _OB {
/**
* loading的锁
*/
__asking: boolean;
/**
*
*/
__async: boolean;
/**
* widget类标识符
*/
widgetName: string | null;
/**
*
*/
_isRoot: boolean;
/**
*
*/
_parent: _Widget | null;
// TODO: 完成jquery文件夹后把这块改了
/**
* dom的类jQuery对象
*/
element: {
width(): number;
height(): number;
width(width: number | string): _Widget["element"];
height(height: number | string): _Widget["element"];
[key: string]: any;
};
/**
*
*/
_children: {
[key: string]: _Widget;
};
/**
*
*/
_isMounted: boolean;
/**
* enable
*/
_manualSetEnable: boolean;
/**
* valid
*/
_manualSetValid: boolean;
/**
*
*/
_renderEngine: RenderEngine;
_store(): void;
// 生命周期函数
/**
*
*/
beforeInit?(cb: Function): void;
/**
*
*/
beforeCreate?(): void;
/**
*
*/
created?(): void;
/**
*
*/
render?(): any;
/**
*
*/
beforeMount?(): void;
/**
*
*/
mounted?(): void;
/**
*
*/
shouldUpdate?(...args: any[]): void;
/**
*
*/
update?(...args: any[]): void;
/**
*
*/
beforeDestroy?(): void;
/**
*
*/
destroyed?(): void;
/**
* render函数
*/
_initRender: () => void;
/**
* render函数
*/
_render: () => void;
/**
*
*/
_initRoot: () => void;
/**
*
*/
_initElementWidth: () => void;
/**
*
*/
_initElementHeight: () => void;
/**
*
*/
_initVisual: () => void;
/**
*
*/
_initEffects: () => void;
/**
* mounted锁
*/
_initState: () => void;
/**
* dom
*/
_initElement: () => void;
/**
*
*/
_setParent: () => void;
/**
* @param force
* @param deep force处理
* @param lifeHook
* @param predicate widget的回调
*/
_mount(force?: boolean, deep?: boolean, lifeHook?: boolean, predicate?: Function): boolean;
/**
*
*/
_mountChildren?(): void;
/**
*
*/
isMounted(): boolean;
/**
*
*/
setWidth(w: number): void;
/**
*
*/
setHeight(h: number): void;
/**
*
*/
_setEnable(enable: boolean): void;
/**
*
*/
_setValid(valid: boolean): void;
/**
*
*/
_setVisible(visible: boolean): void;
/**
*
*/
setEnable(enable: boolean): void;
/**
*
*/
setVisible(visible: boolean): void;
/**
*
*/
setValid(valid: boolean): void;
/**
*
* @param args arguments参数
*/
doBehavior(...args: any[]): void;
/**
*
*/
getWidth(): number;
/**
*
*/
getHeight(): number;
/**
*
*/
isValid(): boolean;
/**
*
*/
addWidget(_name: any, _widget: _Widget): _Widget;
/**
* wigetname获取子元素实例
*/
getWidgetByName(_name: string): _Widget | undefined;
/**
*
* @param nameOrWidget widgetName或widget实例
*/
removeWidget(nameOrWidget: string | _Widget): void;
/**
*
*/
hasWidget(name: string): boolean;
/**
* widgetName
*/
getName(): string;
/**
* tag
* @param tag html tag
*/
setTag(tag: string): void;
/**
* tag
*/
getTag(): string;
/**
*
* @param key
* @param value
*/
attr(key: string | { [key: string]: any }, value?: any): any;
/**
* text
*/
getText(): string;
/**
* text
*/
setText(text: string): void;
/**
*
*/
getValue(): any;
/**
*
*/
setValue(...args: any[]): void;
/**
* enable
*/
isEnabled(): boolean;
/**
*
*/
isVisible(): boolean;
/**
* disable元素
*/
disable(): void;
/**
* enable元素
*/
enable(): void;
/**
* widget合法
*/
valid(): void;
/**
* 使
*/
invalid(): void;
/**
* 使
*/
invisible(..._args: any[]): void;
/**
*
*/
visible(..._args: any[]): void;
/**
*
*/
__d(): void;
/**
*
*/
_unMount(): void;
/**
* hang元素
*/
isolate(): void;
/**
*
*/
empty(): void;
/**
*
*/
reset(): void;
/**
* destory方法
*/
_destroy(): void;
/**
* destory元素
*/
destroy(): void;
}
interface RenderEngine {
// TODO: 完成jquery文件夹后把这块改了
/**
@ -411,13 +15,17 @@ interface RenderEngine {
}
export declare class Widget extends OB {
//
/**
*
* @param engine
*/
static registerRenderEngine(engine: RenderEngine): void;
/**
*
*/
static _renderEngine: RenderEngine;
/**
* loading的锁
*/
@ -441,7 +49,7 @@ export declare class Widget extends OB {
/**
*
*/
_parent: _Widget | null;
_parent: Widget | null;
// TODO: 完成jquery文件夹后把这块改了
/**
* dom的类jQuery对象
@ -458,7 +66,7 @@ export declare class Widget extends OB {
*
*/
_children: {
[key: string]: _Widget;
[key: string]: Widget;
};
/**
@ -476,11 +84,6 @@ export declare class Widget extends OB {
*/
_manualSetValid: boolean;
/**
*
*/
_renderEngine: RenderEngine;
_store(): void;
// 生命周期函数
@ -671,19 +274,19 @@ export declare class Widget extends OB {
/**
*
*/
addWidget(widget: _Widget): _Widget;
addWidget(_name: any, _widget: _Widget): _Widget;
addWidget(widget: Widget): Widget;
addWidget(_name: any, _widget: Widget): Widget;
/**
* wigetname获取子元素实例
*/
getWidgetByName(_name: string): _Widget | undefined;
getWidgetByName(_name: string): Widget | undefined;
/**
*
* @param nameOrWidget widgetName或widget实例
*/
removeWidget(nameOrWidget: string | _Widget): void;
removeWidget(nameOrWidget: string | Widget): void;
/**
*

3
typescript/index.ts

@ -20,6 +20,7 @@ import { IconChangeButton } from "./case/button/icon/icon.change";
import { MultiSelectItem } from "./case/button/item.multiselect";
import { BubbleCombo } from "./case/combo/bubblecombo/combo.bubble";
import { TextValueCombo } from "./case/combo/combo.textvalue";
import { TextValueComboPopup } from "./case/combo/popup.textvalue";
import { SmallTextValueCombo } from "./case/combo/combo.textvaluesmall";
import { SearchTextValueCombo } from "./case/combo/searchtextvaluecombo/combo.searchtextvalue";
import { SignEditor } from "./case/editor/editor.sign";
@ -226,6 +227,7 @@ export interface BI extends _func, _i18n, _base, _inject, _var, _web, _utils {
ButtonGroup: typeof ButtonGroup;
Combo: typeof Combo;
TextValueCombo: typeof TextValueCombo;
TextValueComboPopup: typeof TextValueComboPopup;
SmallTextValueCombo: typeof SmallTextValueCombo;
BubbleCombo: typeof BubbleCombo;
AllValueMultiTextValueCombo: typeof AllValueMultiTextValueCombo;
@ -464,6 +466,7 @@ export {
MultiSelectBar,
SelectList,
TextValueCombo,
TextValueComboPopup,
SmallTextValueCombo,
Editor,
IconLabel,

Loading…
Cancel
Save