Browse Source

Pull request #211827: 无JIRA任务 同步final

Merge in DEC/fineui from ~WINDY/fineui:final/11.0 to final/11.0

* commit '582b614704babbb91ab3a201c131c9e03771cc50': (57 commits)
  Revert "BI-118262 fix: 树过滤组件搜索过滤不生效"
  KERNEL-11877 fix: firefox 下bounds计算错误问题
  BI-118262 fix: 树过滤组件搜索过滤不生效
  无 jira 任务 refactor: 类型补充
  KERNEL-11877 feat: 修复bug
  REPORT-84736 feat: 多门户首页切换-平台前端开发
  auto upgrade version to 2.0.20221210193709
  KERNEL-11877 feat: direction:bottom和direction:top空间不够时的调整逻辑
  KERNEL-11877 feat: container支持函数, 修复错误
  auto upgrade version to 2.0.20221209162625
  BI-118670 fix: 修复传参
  auto upgrade version to 2.0.20221209142506
  auto upgrade version to 2.0.20221209120344
  BI-118434  fix: 临时解决一下belowMouse
  BI-118474 style: 图标更新
  auto upgrade version to 2.0.20221208185443
  auto upgrade version to 2.0.20221208183344
  auto upgrade version to 2.0.20221208181750
  KERNEL-11877 feat: container支持函数, 修复错误
  demo
  ...
master
windy-许昊 2 years ago
parent
commit
698c8f224f
  1. 5
      demo/js/base/button/demo.button.js
  2. 53
      demo/js/case/combo/demo.text_value_combo.js
  3. 6
      demo/js/west.js
  4. BIN
      dist/font/iconfont.eot
  5. 24
      dist/font/iconfont.svg
  6. BIN
      dist/font/iconfont.ttf
  7. BIN
      dist/font/iconfont.woff
  8. BIN
      dist/font/iconfont.woff2
  9. 2
      package.json
  10. 21
      src/base/combination/bubble.js
  11. 50
      src/base/combination/combo.js
  12. 18
      src/base/single/button/buttons/button.js
  13. 63
      src/base/single/editor/editor.js
  14. 1
      src/case/combo/bubblecombo/combo.bubble.js
  15. 4
      src/case/combo/textvaluecombo/combo.textvalue.js
  16. 187
      src/case/combo/textvaluecombo/popup.textvalue.js
  17. 6
      src/case/editor/editor.clear.js
  18. 1
      src/case/editor/editor.defaulttext.js
  19. 3
      src/case/editor/editor.shelter.js
  20. 3
      src/case/editor/editor.sign.js
  21. 3
      src/case/editor/editor.state.js
  22. 19
      src/case/editor/editor.state.simple.js
  23. 10
      src/case/linearsegment/linear.segment.js
  24. 9
      src/case/segment/segment.js
  25. 157
      src/core/platform/web/dom.js
  26. 9
      src/core/platform/web/function.js
  27. 2
      src/less/core/utils/motion/zoom.less
  28. 2
      src/less/widget/multiselect/trigger/button.checkselected.less
  29. 4
      src/less/widget/multitree/trigger/multi.tree.button.checkselected.less
  30. 5
      src/widget/downlist/combo.downlist.js
  31. 3
      src/widget/editor/editor.search.js
  32. 3
      src/widget/editor/editor.text.js
  33. 2
      typescript/base/single/button/button.basic.ts
  34. 7
      typescript/case/combo/combo.textvalue.ts
  35. 13
      typescript/case/combo/popup.textvalue.ts
  36. 12
      typescript/component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo.ts
  37. 8
      typescript/core/base.ts
  38. 4
      typescript/core/plugin.ts
  39. 419
      typescript/core/widget.ts
  40. 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", type: "bi.button",
text: "小于最小宽度的按钮", text: "小于最小宽度的按钮",
width: 50, width: 50,
}, {
type: "bi.button",
text: "一个文字超级超级长的 button, 他比按钮宽度还长。",
textWidth: 500,
width: 100,
}]; }];
return { return {

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

@ -8,19 +8,21 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
render: function () { render: function () {
var combo1, combo2; var combo1, combo2;
var items = [{ var items = [
text: "MVC-1", {
iconCls: "date-font", text: "MVC-1",
value: 1 iconCls: "date-font",
}, { value: 1
text: "MVC-2", }, {
iconCls: "search-font", text: "MVC-2",
value: 2 iconCls: "search-font",
}, { value: 2
text: "MVC-3", }, {
iconCls: "pull-right-font", text: "MVC-3",
value: 3 iconCls: "pull-right-font",
}]; value: 3
}
];
// 创建下拉框各种场景用例 // 创建下拉框各种场景用例
return { return {
@ -195,6 +197,31 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
allowClear: true, allowClear: true,
defaultText: "请选择", defaultText: "请选择",
chooseType: BI.Selection.Multi, 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: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: BI.TextValueCombo.EVENT_CHANGE,

6
demo/js/west.js

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

BIN
dist/font/iconfont.eot vendored

Binary file not shown.

24
dist/font/iconfont.svg vendored

@ -14,6 +14,30 @@
/> />
<missing-glyph /> <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-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" /> <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", "name": "fineui",
"version": "2.0.20221121190600", "version": "2.0.20221210193709",
"description": "fineui", "description": "fineui",
"main": "dist/fineui_without_conflict.min.js", "main": "dist/fineui_without_conflict.min.js",
"types": "dist/lib/index.d.ts", "types": "dist/lib/index.d.ts",

21
src/base/combination/bubble.js

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

50
src/base/combination/combo.js

@ -38,6 +38,7 @@
adjustLength: 0, // 调整的距离 adjustLength: 0, // 调整的距离
adjustXOffset: 0, adjustXOffset: 0,
adjustYOffset: 0, adjustYOffset: 0,
supportCSSTransform: false,
hideChecker: BI.emptyFn, hideChecker: BI.emptyFn,
offsetStyle: "left", // left,right,center offsetStyle: "left", // left,right,center
el: {}, el: {},
@ -161,7 +162,7 @@
this._assertPopupViewRender(); this._assertPopupViewRender();
this.fireEvent(BI.Combo.EVENT_BEFORE_POPUPVIEW); this.fireEvent(BI.Combo.EVENT_BEFORE_POPUPVIEW);
// popupVisible是为了获取其宽高, 放到可视范围之外以防止在IE下闪一下 // popupVisible是为了获取其宽高, 放到可视范围之外以防止在IE下闪一下
this.popupView.css({ left: -999999999, top: -99999999 }); this.popupView.css({ left: -99999, top: -99999 });
this.popupView.visible(); this.popupView.visible();
BI.each(needHideWhenAnotherComboOpen, function (i, combo) { BI.each(needHideWhenAnotherComboOpen, function (i, combo) {
if (i !== self.getName()) { if (i !== self.getName()) {
@ -195,6 +196,7 @@
this.popupView.visible(); this.popupView.visible();
var combo = (o.belowMouse && BI.isNotNull(e)) ? { var combo = (o.belowMouse && BI.isNotNull(e)) ? {
element: { element: {
0: e.target,
offset: function () { offset: function () {
return { return {
left: e.pageX, left: e.pageX,
@ -218,46 +220,47 @@
}, },
}, },
} : this.combo; } : this.combo;
var positionRelativeElement = BI.DOM.getPositionRelativeContainingBlock(BI.isNull(o.container) ? this.element[0] : BI.Widget._renderEngine.createElement(BI.isFunction(o.container) ? o.container() : o.container)[0]);
switch (o.direction) { switch (o.direction) {
case "bottom": case "bottom":
case "bottom,right": 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; break;
case "top": case "top":
case "top,right": 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; break;
case "left": case "left":
case "left,bottom": 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; break;
case "right": case "right":
case "right,bottom": 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; break;
case "top,left": 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; break;
case "bottom,left": 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; break;
case "left,top": 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; break;
case "right,top": 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; break;
case "right,innerRight": 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; break;
case "right,innerLeft": 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; break;
case "innerRight": 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; break;
case "innerLeft": 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; break;
case "top,custom": case "top,custom":
case "custom,top": case "custom,top":
@ -287,9 +290,6 @@
break; break;
} }
if ("adaptHeight" in p) {
this.resetListHeight(p.adaptHeight);
}
var width = this.combo.element.outerWidth(); var width = this.combo.element.outerWidth();
var height = this.combo.element.outerHeight(); var height = this.combo.element.outerHeight();
this.popupView.setDirection && this.popupView.setDirection(p.dir, { this.popupView.setDirection && this.popupView.setDirection(p.dir, {
@ -300,6 +300,24 @@
adjustYOffset: o.adjustYOffset, adjustYOffset: o.adjustYOffset,
offset: this.combo.element.offset(), 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 = p.top / scaleY);
p.left && (p.left = p.left / scaleX);
p.adaptHeight && (p.adaptHeight = p.adaptHeight / scaleY);
}
if ("adaptHeight" in p) {
this.resetListHeight(p.adaptHeight);
}
if ("left" in p) { if ("left" in p) {
this.popupView.element.css({ this.popupView.element.css({
left: p.left, left: p.left,

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

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

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

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

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

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

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

@ -16,7 +16,8 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
el: {}, el: {},
allowClear: false, allowClear: false,
status: "success", // success | warning | error, 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, ref: ref => this.popup = ref,
chooseType: o.chooseType, chooseType: o.chooseType,
items: o.items, items: o.items,
allowSelectAll: o.allowSelectAll,
listeners: [ listeners: [
{ {
eventName: BI.TextValueComboPopup.EVENT_CHANGE, 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 () { _defaultConfig: function () {
return BI.extend(BI.TextValueComboPopup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.TextValueComboPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-text-icon-popup", 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; var o = this.options, self = this;
if (o.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_MULTI) { if (o.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_MULTI) {
return { return {
type: "bi.vertical", type: "bi.vertical",
vgap: 5, vgap: 5,
items: [{ items: [
type: "bi.button_group", {
ref: (_ref) => { type: "bi.button_group",
this.popup = _ref; ref: (_ref) => {
}, this.popup = _ref;
items: this._formatItems(o.items), },
chooseType: o.chooseType, items: this._formatItems(o.items),
layouts: [{ chooseType: o.chooseType,
type: "bi.vertical" layouts: [
}], {
value: o.value, type: "bi.vertical"
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);
} }
} ],
}] 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 { return {
type: "bi.vertical", type: "bi.vertical",
verticalAlign: BI.VerticalAlign.Stretch, verticalAlign: BI.VerticalAlign.Stretch,
rowSize: ["fill", ""], items: o.allowSelectAll ? [
items: [{ {
type: "bi.select_list", type: "bi.select_list",
logic: { logic: {
dynamic: true, dynamic: true,
innerVgap: 5, innerVgap: 5,
rowSize: ["", "fill"], rowSize: ["", "fill"],
verticalAlign: BI.VerticalAlign.Stretch verticalAlign: BI.VerticalAlign.Stretch
}, },
ref: (_ref) => { ref: (_ref) => {
this.popup = _ref; this.popup = _ref;
}, },
el: {
el: { el: {
chooseType: o.chooseType el: {
} chooseType: o.chooseType,
}, }
items: this._formatItems(o.items), },
value: { items: this._formatItems(o.items),
type: BI.ButtonGroup.CHOOSE_TYPE_MULTI, value: {
value: o.value type: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
}, value: o.value
listeners: [{ },
eventName: BI.SelectList.EVENT_CHANGE, height: "fill",
action: function (val) { listeners: [
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val); {
} 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);
}
}, { }, {
type: "bi.text_button", type: "bi.center",
text: BI.i18nText("BI-Basic_OK"), cls: "list-view-toolbar bi-high-light bi-split-top",
handler: function () { height: 24,
self.fireEvent(BI.TextValueComboPopup.EVENT_CONFIRM); items: BI.createItems([
} {
}], { type: "bi.text_button",
once: false, text: BI.i18nText("BI-Basic_Clears"),
shadow: true, handler: function () {
isShadowShowingOnSelected: true 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(); return this.popup.getValue();
} }
var val = this.popup.getValue(); var val = this.popup.getValue();
if (!this.options.allowSelectAll) {
return val;
}
if (val.type === BI.ButtonGroup.CHOOSE_TYPE_MULTI) { if (val.type === BI.ButtonGroup.CHOOSE_TYPE_MULTI) {
return val.value; return val.value;
} else { } else {
@ -128,6 +171,10 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
if (this.options.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_MULTI) { if (this.options.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_MULTI) {
return this.popup.setValue(v); return this.popup.setValue(v);
} }
if (!this.options.allowSelectAll) {
this.popup.setValue(v);
return;
}
this.popup.setValue({ this.popup.setValue({
type: BI.ButtonGroup.CHOOSE_TYPE_MULTI, type: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
value: v value: v

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

@ -31,7 +31,8 @@ BI.ClearEditor = BI.inherit(BI.Widget, {
errorText: o.errorText, errorText: o.errorText,
validationChecker: o.validationChecker, validationChecker: o.validationChecker,
quitChecker: o.quitChecker, quitChecker: o.quitChecker,
value: o.value value: o.value,
autoTrim: o.autoTrim,
}); });
this.clear = BI.createWidget({ this.clear = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
@ -54,7 +55,8 @@ BI.ClearEditor = BI.inherit(BI.Widget, {
{ {
el: this.clear, el: this.clear,
width: 24 width: 24
}] }
]
}); });
this.editor.on(BI.Controller.EVENT_CHANGE, function () { this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); 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, watermark: o.watermark,
errorText: o.errorText, errorText: o.errorText,
invisible: true, invisible: true,
autoTrim: o.autoTrim,
}); });
var showText = BI.isFunction(o.text) ? o.text() : o.text; 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, quitChecker: o.quitChecker,
allowBlank: o.allowBlank, allowBlank: o.allowBlank,
watermark: o.watermark, watermark: o.watermark,
errorText: o.errorText errorText: o.errorText,
autoTrim: o.autoTrim,
}); });
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",

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

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

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

@ -45,7 +45,8 @@ BI.StateEditor = BI.inherit(BI.Widget, {
quitChecker: o.quitChecker, quitChecker: o.quitChecker,
allowBlank: o.allowBlank, allowBlank: o.allowBlank,
watermark: o.watermark, watermark: o.watermark,
errorText: o.errorText errorText: o.errorText,
autoTrim: o.autoTrim,
}); });
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.text_button", 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, quitChecker: o.quitChecker,
allowBlank: o.allowBlank, allowBlank: o.allowBlank,
watermark: o.watermark, watermark: o.watermark,
errorText: o.errorText errorText: o.errorText,
autoTrim: o.autoTrim,
}); });
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
@ -68,13 +69,15 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
BI.createWidget({ BI.createWidget({
type: "bi.absolute", type: "bi.absolute",
element: this, element: this,
items: [{ items: [
el: this.text, {
left: 0, el: this.text,
right: 0, left: 0,
top: 0, right: 0,
bottom: 0 top: 0,
}] bottom: 0
}
]
}); });
this.editor.on(BI.Controller.EVENT_CHANGE, function () { this.editor.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); 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 () { getValue: function () {
return this.buttonGroup.getValue(); 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); 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 () { getValue: function () {
return this.buttonGroup.getValue(); 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.Segment.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.segment", BI.Segment); BI.shortcut("bi.segment", BI.Segment);

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

@ -56,7 +56,7 @@
preloadImages: function (srcArray, onload) { preloadImages: function (srcArray, onload) {
var count = 0, images = []; var count = 0, images = [];
function complete () { function complete() {
count++; count++;
if (count >= srcArray.length) { if (count >= srcArray.length) {
onload(); onload();
@ -151,9 +151,15 @@
BI.extend(BI.DOM, { 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 { 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 el = combo.element;
var elRect = el[0].getBoundingClientRect();
var containerRect = container ? container.getBoundingClientRect() : { left: 0 };
return { 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 { 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 el = combo.element;
var elRect = el[0].getBoundingClientRect();
var containerRect = container ? container.getBoundingClientRect() : { top: 0 };
return { 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) { isRightSpaceEnough: function (combo, popup, extraWidth) {
var viewBounds = popup.element.bounds(), var viewBounds = popup.element[0].getBoundingClientRect(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); viewportBounds = document.documentElement.getBoundingClientRect();
return BI.DOM.getRightPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width; return BI.DOM.getRightPosition(combo, popup, extraWidth).left + viewBounds.width <= viewportBounds.width;
}, },
isInnerRightSpaceEnough: function (combo, popup, extraWidth) { isInnerRightSpaceEnough: function (combo, popup, extraWidth) {
@ -215,9 +233,9 @@
}, },
isBottomSpaceEnough: function (combo, popup, extraHeight) { isBottomSpaceEnough: function (combo, popup, extraHeight) {
var viewBounds = popup.element.bounds(), var viewBounds = popup.element[0].getBoundingClientRect(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); viewportBounds = document.documentElement.getBoundingClientRect();
return BI.DOM.getBottomPosition(combo, popup, extraHeight).top + viewBounds.height <= windowBounds.height; return BI.DOM.getBottomPosition(combo, popup, extraHeight).top + viewBounds.height <= viewportBounds.height;
}, },
isRightSpaceLarger: function (combo) { isRightSpaceLarger: function (combo) {
@ -230,18 +248,19 @@
return windowBounds.height - combo.element.offset().top - combo.element.bounds().height >= combo.element.offset().top; return windowBounds.height - combo.element.offset().top - combo.element.bounds().height >= combo.element.offset().top;
}, },
_getLeftAlignPosition: function (combo, popup, extraWidth) { _getLeftAlignPosition: function (combo, popup, extraWidth, container) {
var viewBounds = popup.element.bounds(), var viewBounds = popup.element.bounds(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); windowBounds = BI.Widget._renderEngine.createElement("body").bounds();
var left = combo.element.offset().left + extraWidth; var left = combo.element.offset().left - (container ? container.getBoundingClientRect().left : 0) + extraWidth;
if (left + viewBounds.width > windowBounds.width) { if (left + viewBounds.width > windowBounds.width) {
left = windowBounds.width - viewBounds.width; left = windowBounds.width - viewBounds.width;
} }
return left; return left;
}, },
getLeftAlignPosition: function (combo, popup, extraWidth) { getLeftAlignPosition: function (combo, popup, extraWidth, container) {
var left = this._getLeftAlignPosition(combo, popup, extraWidth); var left = this._getLeftAlignPosition(combo, popup, extraWidth, container);
var dir = ""; var dir = "";
// 如果放不下,优先使用RightAlign, 如果RightAlign也放不下, 再使用left=0 // 如果放不下,优先使用RightAlign, 如果RightAlign也放不下, 再使用left=0
if (left < 0) { if (left < 0) {
@ -297,24 +316,26 @@
}; };
}, },
getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight, container) {
var comboOffset = combo.element.offset(); var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), var comboBounds = combo.element[0].getBoundingClientRect(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); popupBounds = popup.element[0].getBoundingClientRect(),
viewportBounds = document.documentElement.getBoundingClientRect(),
containerBounds = container ? container.getBoundingClientRect() : { top: 0 };
var top, adaptHeight, dir; var top, adaptHeight, dir;
if (BI.DOM.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { if (BI.DOM.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
top = comboOffset.top + extraHeight; top = comboOffset.top - containerBounds.top + extraHeight;
} else if (needAdaptHeight) { } else if (needAdaptHeight) {
top = comboOffset.top + extraHeight; top = comboBounds.top - containerBounds.top + extraHeight;
adaptHeight = windowBounds.height - top; adaptHeight = viewportBounds.height - comboBounds.top;
} else if (BI.DOM.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { } 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"; dir = "top";
} else { } else {
top = windowBounds.height - popupBounds.height; top = viewportBounds.height - popupBounds.height;
if (top < extraHeight) { if (top < extraHeight) {
adaptHeight = windowBounds.height - extraHeight; adaptHeight = viewportBounds.height - extraHeight;
} }
} }
if (top < extraHeight) { if (top < extraHeight) {
@ -353,19 +374,21 @@
}; };
}, },
getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight, container) {
var comboOffset = combo.element.offset(); var comboOffset = combo.element.offset();
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), var comboBounds = combo.element[0].getBoundingClientRect(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); popupBounds = popup.element[0].getBoundingClientRect(),
windowBounds = BI.Widget._renderEngine.createElement("body").bounds(),
containerBounds = container ? container.getBoundingClientRect() : { top: 0 };
var top, adaptHeight, dir; var top, adaptHeight, dir;
if (BI.DOM.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { if (BI.DOM.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
top = comboOffset.top + comboBounds.height - popupBounds.height - extraHeight; top = comboOffset.top + comboBounds.height - containerBounds.top - popupBounds.height;
} else if (needAdaptHeight) { } else if (needAdaptHeight) {
top = 0; top = 0 - containerBounds.top;
adaptHeight = comboOffset.top + comboBounds.height - extraHeight; adaptHeight = comboBounds.top + comboBounds.height - extraHeight;
} else if (BI.DOM.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { } else if (BI.DOM.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
// 上方空间不足且不允许调整高度的情况下,优先使用下对齐 // 上方空间不足且不允许调整高度的情况下,优先使用下对齐
top = comboOffset.top + extraHeight; top = comboOffset.top - containerBounds.top + extraHeight;
dir = "bottom"; dir = "bottom";
} else { } else {
top = 0; top = 0;
@ -373,7 +396,7 @@
adaptHeight = windowBounds.height - extraHeight; adaptHeight = windowBounds.height - extraHeight;
} }
} }
if (top < 0) { if (top + containerBounds.top < 0) {
top = 0; top = 0;
} }
return adaptHeight ? { return adaptHeight ? {
@ -446,7 +469,7 @@
}; };
}, },
getComboPositionByDirections: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions) { getComboPositionByDirections: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions, container) {
extraWidth || (extraWidth = 0); extraWidth || (extraWidth = 0);
extraHeight || (extraHeight = 0); extraHeight || (extraHeight = 0);
var i, direct; var i, direct;
@ -483,11 +506,11 @@
if (!isNeedAdaptHeight) { if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? 0 : extraHeight; var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? 0 : extraHeight;
if (BI.DOM.isLeftSpaceEnough(combo, popup, tW)) { 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") { if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight); pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight, container);
} else { } else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight); pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight, container);
} }
pos.dir = "left," + pos.dir; pos.dir = "left," + pos.dir;
if (tbFirst) { if (tbFirst) {
@ -503,11 +526,11 @@
if (!isNeedAdaptHeight) { if (!isNeedAdaptHeight) {
var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? extraWidth : extraHeight; var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? extraWidth : extraHeight;
if (BI.DOM.isRightSpaceEnough(combo, popup, tW)) { 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") { if (topBottom[0] === "bottom") {
pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight); pos = BI.DOM.getTopAlignPosition(combo, popup, tH, needAdaptHeight, container);
} else { } else {
pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight); pos = BI.DOM.getBottomAlignPosition(combo, popup, tH, needAdaptHeight, container);
} }
pos.dir = "right," + pos.dir; pos.dir = "right," + pos.dir;
if (tbFirst) { if (tbFirst) {
@ -522,11 +545,11 @@
case "top": case "top":
var tW = lrFirst ? extraHeight : extraWidth, tH = lrFirst ? extraWidth : extraHeight; var tW = lrFirst ? extraHeight : extraWidth, tH = lrFirst ? extraWidth : extraHeight;
if (BI.DOM.isTopSpaceEnough(combo, popup, tH)) { 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") { if (leftRight[0] === "right") {
pos = BI.DOM.getLeftAlignPosition(combo, popup, tW, needAdaptHeight); pos = BI.DOM.getLeftAlignPosition(combo, popup, tW, container);
} else { } else {
pos = BI.DOM.getRightAlignPosition(combo, popup, tW); pos = BI.DOM.getRightAlignPosition(combo, popup, tW, container);
} }
pos.dir = "top," + pos.dir; pos.dir = "top," + pos.dir;
if (lrFirst) { if (lrFirst) {
@ -543,11 +566,11 @@
case "bottom": case "bottom":
var tW = lrFirst ? extraHeight : extraWidth, tH = lrFirst ? extraWidth : extraHeight; var tW = lrFirst ? extraHeight : extraWidth, tH = lrFirst ? extraWidth : extraHeight;
if (BI.DOM.isBottomSpaceEnough(combo, popup, tH)) { 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") { if (leftRight[0] === "right") {
pos = BI.DOM.getLeftAlignPosition(combo, popup, tW, needAdaptHeight); pos = BI.DOM.getLeftAlignPosition(combo, popup, tW, container);
} else { } else {
pos = BI.DOM.getRightAlignPosition(combo, popup, tW); pos = BI.DOM.getRightAlignPosition(combo, popup, tW, container);
} }
pos.dir = "bottom," + pos.dir; pos.dir = "bottom," + pos.dir;
if (lrFirst) { if (lrFirst) {
@ -635,7 +658,7 @@
firstDir = "top"; firstDir = "top";
} }
if (leftRight[0] === "right") { if (leftRight[0] === "right") {
pos = BI.DOM.getLeftAlignPosition(combo, popup, extraWidth, needAdaptHeight); pos = BI.DOM.getLeftAlignPosition(combo, popup, extraWidth);
pos.top = top; pos.top = top;
pos.dir = firstDir + "," + pos.dir; pos.dir = firstDir + "," + pos.dir;
return pos; return pos;
@ -648,13 +671,13 @@
}, },
getComboPosition: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions, offsetStyle) { getComboPosition: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions, offsetStyle, positionRelativeElement) {
extraWidth || (extraWidth = 0); extraWidth || (extraWidth = 0);
extraHeight || (extraHeight = 0); extraHeight || (extraHeight = 0);
var bodyHeight = BI.Widget._renderEngine.createElement("body").bounds().height - extraHeight; var bodyHeight = BI.Widget._renderEngine.createElement("body").bounds().height - extraHeight;
var maxHeight = Math.min(popup.attr("maxHeight") || bodyHeight, bodyHeight); var maxHeight = Math.min(popup.attr("maxHeight") || bodyHeight, bodyHeight);
popup.resetHeight && popup.resetHeight(maxHeight); 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) { switch (offsetStyle) {
case "center": case "center":
if (position.change) { if (position.change) {
@ -676,9 +699,35 @@
break; break;
} }
if (needAdaptHeight === true) { if (needAdaptHeight === true) {
popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight)); popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top + (positionRelativeElement ? positionRelativeElement.getBoundingClientRect().top : 0), maxHeight));
} }
return position; 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);
},
}); });
})(); })();

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

@ -137,5 +137,14 @@ BI._.extend(BI, {
return version[1] * 1; return version[1] * 1;
} }
return 0; return 0;
},
getMinimumFontSize: function () {
const el = document.createElement('div');
el.style.fontSize = "0px";
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); .make-motion(@className, @keyframeName, @duration);
.@{className}-enter, .@{className}-enter,
.@{className}-appear { .@{className}-appear {
transform: scale(0); // need this by yiminghe //transform: scale(0); // need this by yiminghe, but dailer did not need this
opacity: 0; opacity: 0;
animation-timing-function: @ease-out-circ; 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 { .bi-multi-select-check-selected-button {
z-index: 1; z-index: 1;
.border-radius(50%); .border-radius(99999px);
&:active { &:active {
color: @color-bi-text-highlight; color: @color-bi-text-highlight;

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

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

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

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

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

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

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

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

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

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

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

@ -5,5 +5,10 @@ export declare class TextValueCombo extends Widget {
static EVENT_CHANGE: string; 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"; import { Widget } from "../../core/widget";
export interface _AllValueMultiTextValueCombo extends _Widget {
getValue<T>(): T[];
populate(items: any): void;
}
export interface _AllValueMultiTextValueComboStatic {
EVENT_CONFIRM: string;
}
export declare class AllValueMultiTextValueCombo extends Widget { export declare class AllValueMultiTextValueCombo extends Widget {
static xtype: string; static xtype: string;

8
typescript/core/base.ts

@ -1,4 +1,4 @@
import { _Widget } from "./widget"; import { Widget } from "./widget";
export interface _base { export interface _base {
assert: (v: any, is: Function) => Boolean; assert: (v: any, is: Function) => Boolean;
@ -7,7 +7,7 @@ export interface _base {
UUID: () => string; UUID: () => string;
isWidget: (widget: any) => widget is _Widget; isWidget: (widget: any) => widget is Widget;
createWidgets: (items: any, options: any, context: any) => any; createWidgets: (items: any, options: any, context: any) => any;
@ -38,7 +38,9 @@ export interface _base {
size: (collection: any) => number; 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[]; 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 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 export type _config = (widgetFunction: configWidgetFn | configWidgetFn[], objectFunction: configObjectFn | configObjectFn[]) => void

419
typescript/core/widget.ts

@ -1,401 +1,5 @@
import { OB, _OB } from "./ob"; 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 { interface RenderEngine {
// TODO: 完成jquery文件夹后把这块改了 // TODO: 完成jquery文件夹后把这块改了
/** /**
@ -411,13 +15,17 @@ interface RenderEngine {
} }
export declare class Widget extends OB { export declare class Widget extends OB {
//
/** /**
* *
* @param engine * @param engine
*/ */
static registerRenderEngine(engine: RenderEngine): void; static registerRenderEngine(engine: RenderEngine): void;
/**
*
*/
static _renderEngine: RenderEngine;
/** /**
* loading的锁 * loading的锁
*/ */
@ -441,7 +49,7 @@ export declare class Widget extends OB {
/** /**
* *
*/ */
_parent: _Widget | null; _parent: Widget | null;
// TODO: 完成jquery文件夹后把这块改了 // TODO: 完成jquery文件夹后把这块改了
/** /**
* dom的类jQuery对象 * dom的类jQuery对象
@ -458,7 +66,7 @@ export declare class Widget extends OB {
* *
*/ */
_children: { _children: {
[key: string]: _Widget; [key: string]: Widget;
}; };
/** /**
@ -476,11 +84,6 @@ export declare class Widget extends OB {
*/ */
_manualSetValid: boolean; _manualSetValid: boolean;
/**
*
*/
_renderEngine: RenderEngine;
_store(): void; _store(): void;
// 生命周期函数 // 生命周期函数
@ -671,19 +274,19 @@ export declare class Widget extends OB {
/** /**
* *
*/ */
addWidget(widget: _Widget): _Widget; addWidget(widget: Widget): Widget;
addWidget(_name: any, _widget: _Widget): _Widget; addWidget(_name: any, _widget: Widget): Widget;
/** /**
* wigetname获取子元素实例 * wigetname获取子元素实例
*/ */
getWidgetByName(_name: string): _Widget | undefined; getWidgetByName(_name: string): Widget | undefined;
/** /**
* *
* @param nameOrWidget widgetName或widget实例 * @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 { MultiSelectItem } from "./case/button/item.multiselect";
import { BubbleCombo } from "./case/combo/bubblecombo/combo.bubble"; import { BubbleCombo } from "./case/combo/bubblecombo/combo.bubble";
import { TextValueCombo } from "./case/combo/combo.textvalue"; import { TextValueCombo } from "./case/combo/combo.textvalue";
import { TextValueComboPopup } from "./case/combo/popup.textvalue";
import { SmallTextValueCombo } from "./case/combo/combo.textvaluesmall"; import { SmallTextValueCombo } from "./case/combo/combo.textvaluesmall";
import { SearchTextValueCombo } from "./case/combo/searchtextvaluecombo/combo.searchtextvalue"; import { SearchTextValueCombo } from "./case/combo/searchtextvaluecombo/combo.searchtextvalue";
import { SignEditor } from "./case/editor/editor.sign"; 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; ButtonGroup: typeof ButtonGroup;
Combo: typeof Combo; Combo: typeof Combo;
TextValueCombo: typeof TextValueCombo; TextValueCombo: typeof TextValueCombo;
TextValueComboPopup: typeof TextValueComboPopup;
SmallTextValueCombo: typeof SmallTextValueCombo; SmallTextValueCombo: typeof SmallTextValueCombo;
BubbleCombo: typeof BubbleCombo; BubbleCombo: typeof BubbleCombo;
AllValueMultiTextValueCombo: typeof AllValueMultiTextValueCombo; AllValueMultiTextValueCombo: typeof AllValueMultiTextValueCombo;
@ -464,6 +466,7 @@ export {
MultiSelectBar, MultiSelectBar,
SelectList, SelectList,
TextValueCombo, TextValueCombo,
TextValueComboPopup,
SmallTextValueCombo, SmallTextValueCombo,
Editor, Editor,
IconLabel, IconLabel,

Loading…
Cancel
Save