Browse Source

Merge branch 'master' of ssh://cloud.finedevelop.com:7999/~windy/fineui

es6
windy 6 years ago
parent
commit
3963322d9a
  1. 6
      changelog.md
  2. 590
      demo/js/base/demo.label.scene.js
  3. 4
      demo/js/config/base.js
  4. 4
      demo/js/config/widget.js
  5. 6
      demo/js/face.js
  6. 47
      demo/js/widget/date/demo.multidate_combo.js
  7. 1
      demo/js/widget/multiselect/demo.multi_select_combo.js
  8. 48
      demo/js/widget/timecombo/demo.timecombo.js
  9. 4
      dist/2.0/fineui.css
  10. 1379
      dist/2.0/fineui.ie.js
  11. 75
      dist/2.0/fineui.ie.min.js
  12. 1379
      dist/2.0/fineui.js
  13. 2
      dist/2.0/fineui.min.css
  14. 75
      dist/2.0/fineui.min.js
  15. 560
      dist/base.js
  16. 4
      dist/bundle.css
  17. 1379
      dist/bundle.ie.js
  18. 75
      dist/bundle.ie.min.js
  19. 1379
      dist/bundle.js
  20. 2
      dist/bundle.min.css
  21. 75
      dist/bundle.min.js
  22. 42
      dist/case.js
  23. 66
      dist/core.js
  24. 700
      dist/demo.js
  25. 4
      dist/fineui.css
  26. 1379
      dist/fineui.ie.js
  27. 75
      dist/fineui.ie.min.js
  28. 1379
      dist/fineui.js
  29. 2
      dist/fineui.min.css
  30. 75
      dist/fineui.min.js
  31. 1377
      dist/fineui_without_jquery_polyfill.js
  32. 25
      dist/utils.js
  33. 6
      dist/utils.min.js
  34. 4
      dist/widget.css
  35. 711
      dist/widget.js
  36. 2
      src/base/single/button/buttons/button.js
  37. 2
      src/base/single/button/buttons/button.text.js
  38. 9
      src/base/single/editor/editor.js
  39. 9
      src/base/single/input/input.js
  40. 250
      src/base/single/label/html.label.js
  41. 254
      src/base/single/label/label.js
  42. 34
      src/base/single/text.js
  43. 4
      src/case/editor/editor.clear.js
  44. 10
      src/case/editor/editor.shelter.js
  45. 10
      src/case/editor/editor.sign.js
  46. 9
      src/case/editor/editor.state.js
  47. 9
      src/case/editor/editor.state.simple.js
  48. 21
      src/core/alias.js
  49. 4
      src/core/func/date.js
  50. 2
      src/core/platform/web/dom.js
  51. 39
      src/core/wrapper/layout.js
  52. 4
      src/css/widget/timecombo/timecombo.css
  53. 8
      src/less/widget/timecombo/timecombo.less
  54. 16
      src/widget/datetime/datetime.combo.js
  55. 2
      src/widget/datetime/datetime.popup.js
  56. 20
      src/widget/dynamicdate/dynamicdate.combo.js
  57. 3
      src/widget/dynamicdate/dynamicdate.popup.js
  58. 127
      src/widget/dynamicdate/dynamicdate.trigger.js
  59. 20
      src/widget/dynamicdatetime/dynamicdatetime.combo.js
  60. 3
      src/widget/dynamicdatetime/dynamicdatetime.popup.js
  61. 134
      src/widget/dynamicdatetime/dynamicdatetime.trigger.js
  62. 10
      src/widget/editor/editor.search.js
  63. 4
      src/widget/editor/editor.text.js
  64. 4
      src/widget/multiselect/multiselect.insert.combo.js
  65. 17
      src/widget/multiselect/multiselect.insert.trigger.js
  66. 17
      src/widget/multiselect/multiselect.trigger.js
  67. 2
      src/widget/multiselect/trigger/editor.multiselect.js
  68. 4
      src/widget/multitree/multi.tree.insert.combo.js
  69. 4
      src/widget/multitree/multi.tree.list.combo.js
  70. 12
      src/widget/numberinterval/numberinterval.js
  71. 24
      src/widget/numberinterval/singleeditor/single.editor.js
  72. 2
      src/widget/singleselect/trigger/editor.singleselect.js
  73. 10
      src/widget/singleslider/button/editor.sign.text.js
  74. 3
      src/widget/time/datetime.popup.js
  75. 74
      src/widget/time/time.combo.js
  76. 157
      src/widget/time/time.trigger.js
  77. 11
      src/widget/timeinterval/dateinterval.js
  78. 11
      src/widget/timeinterval/timeinterval.js
  79. 3
      src/widget/year/popup.year.js
  80. 3
      src/widget/yearmonth/popup.yearmonth.js
  81. 11
      src/widget/yearmonthinterval/yearmonthinterval.js
  82. 3
      src/widget/yearquarter/popup.yearquarter.js

6
changelog.md

@ -1,5 +1,10 @@
# 更新日志
2.0(2019-05)
- editor类控件新增EVENT_CHANGE_CONFIRM事件
- 复选下拉控件和树下拉控件支持trigger是否可编辑
- 时分秒控件支持自定义时间显示格式和是否可编辑
- 日期/时间/日期区间/时间区间支持自定义日期选择范围和是否可编辑
- 日期/时间/日期区间/时间区间支持自定义日期显示格式和是否可编辑
- 增加less函数: 字体资源添加函数addFontRe和字体激活函数activeFont
> @fontList: "dec", "report";
@ -9,7 +14,6 @@
以上即可使用自定义的dec,report字体和fineui的资源字体
2.0(2019-04)
- 新增`bi.multi_tree_list_combo`控件, 此下拉树勾选节点时不会影响父子节点的勾选状态
- 新增`bi.multi_tree_insert_combo`控件, 此下拉树可以插入不存在的新值

590
demo/js/base/demo.label.scene.js

@ -0,0 +1,590 @@
/**
* 整理所有label场景
*/
Demo.LabelScene = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-label"
},
render: function () {
var items = [];
items.push(this.createExpander("1.1.1 文字居中,有宽度和高度,有文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg6",
text: "设置了textWidth,则一定是嵌套结构,因此需要用center_adapt布局容纳一下.为了实现不足一行时文字水平居中,超出一行时左对齐,需要设置maxWidth.",
whiteSpace: "normal",
height: 50,
width: 500,
textWidth: 200,
textAlign: "center"
}));
items.push(this.createExpander("1.1.2 居中,有宽度和高度,有文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg6",
text: "居中,有宽度高度,有文字宽度,whiteSpace为nowrap,maxWidth会限制文字",
whiteSpace: "nowrap",
height: 50,
width: 500,
textWidth: 350,
textAlign: "center"
}));
items.push((this.createExpander("1.2.1 居中,有宽度无高度,有文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg6",
text: "居中,有宽度无高度,有文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
width: 500,
textWidth: 200,
textAlign: "center"
})));
items.push((this.createExpander("1.2.1 居中,有宽度无高度,有文字宽度,whiteSpace为normal,高度被父容器拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg6",
text: "此时虽然没有对label设置高度,但由于使用了center_adapt布局,依然会垂直方向居中",
whiteSpace: "normal",
width: 500,
textWidth: 200,
textAlign: "center"
},
top: 0,
left: 0,
bottom: 0
}
]
})));
items.push((this.createExpander("1.2.2 居中,有宽度无高度,有文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg6",
text: "居中,有宽度无高度,有文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
width: 500,
textWidth: 350,
textAlign: "center"
})));
items.push((this.createExpander("1.3.1 居中,有宽度和高度,无文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg3",
text: "居中,有宽度高度,无文字宽度,whiteSpace为normal,只需用center_adapt布局包一下即可.度,下即可.居中,有宽度,无文字宽度,whiteSpace为normal居中,有宽度,无文字宽度,下即可.居中,有宽度,无文字宽度,whiteSpace为normal居中,有宽度,无文字宽度,下即可.居中,有宽度,无文字宽度,whiteSpace为normal居中,有宽度,无文字宽度,度,无文字宽度,whiteSpace为normal居中,有宽度,无文字宽度,whiteSpace为normal",
width: 500,
whiteSpace: "normal",
textAlign: "center",
height: 50
})));
items.push((this.createExpander("1.3.2 居中,有宽度无高度,无文字宽度,whiteSpace为normal", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg3",
text: "居中,有宽度无高度,无文字宽度,whiteSpace为normal,只需用center_adapt布局包一下即可.度,下即可.居中,有宽度,无文字宽度,whiteSpace为normal居中,有宽度,无文字宽度,下即可.居中,有宽度,无文字宽度,whiteSpace为normal居中,有宽度,无文字宽度,下即可.居中,有宽度,无文字宽度,whiteSpace为normal居中,有宽度,无文字宽度,度,无文字宽度,whiteSpace为normal居中,有宽度,无文字宽度,whiteSpace为normal",
width: 500,
whiteSpace: "normal",
textAlign: "center"
},
top: 0,
left: 0,
bottom: 0
}
]
})));
items.push((this.createExpander("1.4 居中,有宽度和高度,无文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg3",
text: "居中,有宽度500有高度50,无文字宽度,whiteSpace为nowrap,此处无需两层div,设置text即可,然后设置line-height为传入高度即可实现垂直方向居中",
width: 500,
whiteSpace: "nowrap",
textAlign: "center",
height: 50
})));
items.push((this.createExpander("1.5.1 居中,有宽度无高度,无文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg3",
text: "居中,有宽度500无高度,无文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
width: 500,
whiteSpace: "nowrap",
textAlign: "center"
})));
items.push((this.createExpander("1.5.2 居中,有宽度无高度,无文字宽度,whiteSpace为nowrap,高度被父级拉满", {
type: "bi.absolute",
height: 50,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg3",
text: "居中,有宽度500无高度,无文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
width: 500,
whiteSpace: "nowrap",
textAlign: "center"
},
top: 0,
left: 0,
bottom: 0
}
]
})));
items.push((this.createExpander("1.6.1 居中,无宽度无高度,有文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg3",
text: "居中,无宽度,有文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
textWidth: 500,
whiteSpace: "nowrap",
textAlign: "center"
})));
items.push((this.createExpander("1.6.2 居中,无宽度无高度,有文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg3",
text: "居中,无宽度,有文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
textWidth: 500,
whiteSpace: "normal",
textAlign: "center"
})));
items.push((this.createExpander("1.6.3 居中,无宽度无,有文字宽度,whiteSpace为normal,被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg3",
text: "居中,无宽度,有文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
textWidth: 500,
whiteSpace: "normal",
textAlign: "center"
},
left: 0,
right: 0,
top: 0,
bottom: 0
}
]
})));
items.push((this.createExpander("1.7.1 居中,无宽度无高度,无文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg3",
text: "居中,无宽度无高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "center"
})));
items.push((this.createExpander("1.7.2 居中,无宽度无高度,无文字宽度,whiteSpace为normal,被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg3",
text: "居中,无宽度无高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "center"
},
left: 0,
right: 0,
top: 0,
bottom: 0
}
]
})));
items.push((this.createExpander("1.7.3 居中,无宽度有高度,无文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg3",
text: "居中,无宽度有高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
height: 50,
textAlign: "center"
})));
items.push((this.createExpander("1.8 居中,无宽度有高度,无文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg3",
text: "居中,无宽度有高度,无文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
height: 50,
textAlign: "center"
})));
items.push((this.createExpander("1.9 居中,无宽度无高度,无文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg3",
text: "居中,无宽度无高度,无文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "center"
})));
items.push((this.createExpander("1.9.1 居中,无宽度无高度,无文字宽度,whiteSpace为nowrap,高度被父级拉满", {
type: "bi.absolute",
height: 50,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg3",
text: "居中,无宽度无高度,无文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "center"
},
top: 0,
left: 0,
right: 0,
bottom: 0
}
]
})));
items.push((this.createExpander("2.1.1 居左,有宽度有高度,有文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,有宽度有高度,有文字宽度,whiteSpace为normal,为了演示这个是真的是normal的我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left",
textWidth: 300,
height: 50,
width: 500
})));
items.push((this.createExpander("2.1.2 居左,有宽度有高度,有文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,有宽度有高度,有文字宽度,whiteSpace为normal,为了演示这个是真的是normal的我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "left",
textWidth: 300,
height: 50,
width: 500
})));
items.push((this.createExpander("2.2.1 居左,有宽度无高度,有文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,有宽度无高度,有文字宽度,whiteSpace为normal,不设置高度,为了演示这个是真的是normal的我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left",
textWidth: 300,
width: 500
})));
items.push((this.createExpander("2.2.2 居左,有宽度无高度,有文字宽度,whiteSpace为normal,高度被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg2",
text: "居左,有宽度无高度,有文字宽度,whiteSpace为normal,不设置高度,为了演示这个是真的是normal的我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left",
textWidth: 300,
width: 500
},
top: 0,
bottom: 0,
left: 0
}
]
})));
items.push((this.createExpander("2.2.3 居左,有宽度无高度,有文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,有宽度无高度,有文字宽度,whiteSpace为nowrap,不设置高度,为了演示这个是真的是normal的我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "left",
textWidth: 300,
width: 500
})));
items.push((this.createExpander("2.2.4 居左,有宽度无高度,有文字宽度,whiteSpace为nowrap,高度被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg2",
text: "居左,有宽度无高度,有文字宽度,whiteSpace为nowrap,不设置高度,为了演示这个是真的是normal的我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "left",
textWidth: 300,
width: 500
},
top: 0,
bottom: 0,
left: 0
}
]
})));
items.push((this.createExpander("2.3.1 居左,有宽度有高度,无文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,有宽度有高度,无文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "left",
height: 50,
vgap: 5,
width: 500
})));
items.push((this.createExpander("2.3.2 居左,有宽度有高度,无文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,有宽度有高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left",
height: 50,
width: 500
})));
items.push((this.createExpander("2.4.1 居左,有宽度无高度,无文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,有宽度无高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left",
width: 500
})));
items.push((this.createExpander("2.4.2 居左,有宽度无高度,无文字宽度,whiteSpace为normal,高度被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg1",
text: "居左,有宽度无高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left",
width: 500
},
top: 0,
left: 0,
bottom: 0
}
]
})));
items.push((this.createExpander("2.5.1 居左,无宽度无高度,有文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,有文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left",
textWidth: 300
})));
items.push((this.createExpander("2.5.2 居左,无宽度无高度,有文字宽度,whiteSpace为normal,高度被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,有文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left",
textWidth: 300
},
top: 0,
left: 0,
bottom: 0,
right: 0
}
]
})));
items.push((this.createExpander("2.5.3 居左,无宽度无高度,有文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,有文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "left",
textWidth: 300
})));
items.push((this.createExpander("2.5.4 居左,无宽度无高度,有文字宽度,whiteSpace为nowrap,高度被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,有文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "left",
textWidth: 300
},
top: 0,
left: 0,
bottom: 0,
right: 0
}
]
})));
items.push((this.createExpander("2.6.1 居左,无宽度有高度,无文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度有高度,无文字宽度,whiteSpace为nowrap,注意这个是设置了vgap的,为了实现居中,lineHeight要做计算,才能准确的垂直居中",
whiteSpace: "nowrap",
textAlign: "left",
vgap: 10,
height: 50
})));
items.push((this.createExpander("2.6.2 居左,无宽度有高度,无文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度有高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left",
height: 50
})));
items.push((this.createExpander("2.7.1 居左,无宽度无高度,无文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left"
})));
items.push((this.createExpander("2.7.2 居左,无宽度无高度,无文字宽度,whiteSpace为normal,高度被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left"
},
top: 0,
left: 0,
bottom: 0,
right: 0
}
]
})));
items.push((this.createExpander("2.7.3 居左,无宽度无高度,无文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,无文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "left"
})));
items.push((this.createExpander("2.7.4 居左,无宽度无高度,无文字宽度,whiteSpace为nowrap,高度被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,无文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "left"
},
top: 0,
left: 0,
bottom: 0,
right: 0
}
]
})));
items.push((this.createExpander("2.8 居左,无宽度无高度,无文字宽度,whiteSpace为nowrap,高度被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,无文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "left"
},
top: 0,
left: 0,
bottom: 0,
right: 0
}
]
})));
items.push((this.createExpander("2.8.2 居左,无宽度无高度,无文字宽度,whiteSpace为normal,高度被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left"
},
top: 0,
left: 0,
bottom: 0,
right: 0
}
]
})));
return {
type: "bi.vertical",
items: items,
hgap: 300,
vgap: 20
};
},
createExpander: function (text, popup) {
return {
type: "bi.vertical",
items: [
{
type: "bi.label",
cls: "demo-font-weight-bold",
textAlign: "left",
text: text,
height: 30
}, {
el: popup
}
]
};
}
});
BI.shortcut("demo.label_scene", Demo.LabelScene);

4
demo/js/config/base.js

@ -6,6 +6,10 @@ Demo.BASE_CONFIG = [{
pId: 2,
text: "bi.label",
value: "demo.label"
},{
pId: 2,
text: "bi.label_scene",
value: "demo.label_scene"
}, {
pId: 2,
text: "bi.icon_label",

4
demo/js/config/widget.js

@ -170,6 +170,10 @@ Demo.WIDGET_CONFIG = [{
pId: 412,
text: "bi.date_time",
value: "demo.date_time"
}, {
pId: 412,
text: "bi.time_combo",
value: "demo.time_combo"
}, {
pId: 412,
text: "bi.time_interval",

6
demo/js/face.js

@ -79,7 +79,6 @@ Demo.Face = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "bi-list-item-active",
text: "测试激活状态",
forceCenter: true
}
}]
};
@ -101,7 +100,6 @@ Demo.Face = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "bi-list-item-active",
text: "测试选中状态",
forceCenter: true
}
}]
};
@ -144,7 +142,6 @@ Demo.Face = BI.inherit(BI.Widget, {
el: {
type: "bi.text_button",
text: "这个按钮是灰化的",
forceCenter: true,
disabled: true
}
}]
@ -181,7 +178,6 @@ Demo.Face = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "bi-list-item-active",
text: "测试悬浮状态",
forceCenter: true
}
}]
};
@ -203,7 +199,6 @@ Demo.Face = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "bi-list-item-active",
text: "测试激活状态",
forceCenter: true
}
}]
};
@ -225,7 +220,6 @@ Demo.Face = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "bi-list-item-active",
text: "测试选中状态",
forceCenter: true
}
}]
};

47
demo/js/widget/date/demo.multidate_combo.js

@ -20,15 +20,25 @@ Demo.Date = BI.inherit(BI.Widget, {
ref: function () {
self.datecombo = this;
},
width: 300
// value: {
// type: 1,
// value: {
// year: 2018,
// month: 2,
// day: 23
// }
// }
width: 300,
// allowEdit: false,
// format: "%Y-%X-%d", // yyyy-MM-dd
// format: "%Y/%X/%d", // yyyy/MM/dd
// format: "%Y-%x-%e", // yyyy-M-d
// format: "%Y/%x/%e", // yyyy/M/d
// format: "%X/%d/%Y", // MM/dd/yyyy
// format: "%X/%e/%y", // MM/d/yy
// format: "%X.%d.%Y", // MM.dd.yyyy
// format: "%X.%e.%Y", // MM.d.yyyy
// format: "%X-%e-%y", // MM.d.yyyy
value: {
type: 1,
value: {
year: 2018,
month: 2,
day: 23
}
}
}, {
type: "bi.button",
text: "getValue",
@ -42,6 +52,25 @@ Demo.Date = BI.inherit(BI.Widget, {
self.datetimecombo = this;
},
width: 300,
// allowEdit: false,
// format: "%Y-%X-%d %H:%M:%S", // yyyy-MM-dd HH:mm:ss
// format: "%Y/%X/%d %H:%M:%S", // yyyy/MM/dd HH:mm:ss
// format: "%Y-%X-%d %I:%M:%S", // yyyy-MM-dd hh:mm:ss
// format: "%Y/%X/%d %I:%M:%S", // yyyy/MM/dd hh:mm:ss
// format: "%Y-%X-%d %H:%M:%S %p", // yyyy-MM-dd HH:mm:ss a
// format: "Y/%X/%d %H:%M:%S %p", // yyyy/MM/dd HH:mm:ss a
// format: "%Y-%X-%d %I:%M:%S %p", // yyyy-MM-dd hh:mm:ss a
// format: "%Y/%X/%d %I:%M:%S %p", // yyyy/MM/dd hh:mm:ss a
// format: "%X/%d/%Y %I:%M:%S", // MM/dd/yyyy hh:mm:ss
// format: "%X/%d/%Y %H:%M:%S", // MM/dd/yyyy HH:mm:ss
// format: "%X/%d/%Y %I:%M:%S", // MM/dd/yyyy hh:mm:ss a
// format: "%X/%d/%Y %H:%M:%S %p", // MM/dd/yyyy HH:mm:ss a
// format: "%X/%d/%Y %I:%M:%S %p", // MM/dd/yyyy hh:mm:ss a
// format: "%X/%d/%Y %H:%M:%S %p", // MM/dd/yyyy HH:mm:ss a
// format: "%X/%d/%Y %l:%M %p", // MM/dd/yyyy h:mm a
// format: "%X-%d-%Y %k:%M %p", // MM/dd/yyyy H:mm a
// format: "%Y-%x-%e %l:%M", // yyyy-M-d h:mm
// format: "%Y-%x-%e %k:%M", // yyyy-M-d H:mm
value: {
type: 1,
value: {

1
demo/js/widget/multiselect/demo.multi_select_combo.js

@ -10,6 +10,7 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
var self = this;
var widget = BI.createWidget({
type: "bi.multi_select_insert_combo",
// allowEdit: false,
itemsCreator: BI.bind(this._itemsCreator, this),
width: 200,
value: {

48
demo/js/widget/timecombo/demo.timecombo.js

@ -0,0 +1,48 @@
/**
* Created by Dailer on 2017/7/13.
*/
Demo.TimeCombo = BI.inherit(BI.Widget, {
props: {
baseCls: ""
},
render: function () {
var self = this;
return {
type: "bi.horizontal_auto",
items: [{
type: "bi.time_combo",
ref: function (_ref) {
self.timeCombo = _ref;
},
// allowEdit: true,
// format: "%H:%M:%S", // HH:mm:ss
// format: "%I:%M:%S", // hh:mm:ss
// format: "%l:%M:%S", // h:mm:ss
// format: "%k:%M:%S", // H:mm:ss
// format: "%l:%M:%S %p", // h:mm:ss a
// format: "%l:%M", // h:mm
// format: "%k:%M", // H:mm
// format: "%I:%M", // hh:mm
// format: "%H:%M", // HH:mm
// format: "%M:%S", // mm:ss
value: {
hour: 12,
minute: 0,
second: 0
},
width: 300
}, {
type: "bi.button",
text: "getValue",
handler: function () {
BI.Msg.toast(JSON.stringify(self.timeCombo.getValue()));
},
width: 300
}],
vgap: 20
};
}
});
BI.shortcut("demo.time_combo", Demo.TimeCombo);

4
dist/2.0/fineui.css vendored

@ -4442,6 +4442,10 @@ ul.ztree.zTreeDragUL {
-moz-border-radius: 3px;
border-radius: 3px;
}
.bi-time-trigger .show-text {
background-color: rgba(255, 255, 255, 0);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00ffffff,endColorstr=#00ffffff);
}
.bi-date-interval.time-error .bi-input {
color: #ff4949;
}

1379
dist/2.0/fineui.ie.js vendored

File diff suppressed because it is too large Load Diff

75
dist/2.0/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

1379
dist/2.0/fineui.js vendored

File diff suppressed because it is too large Load Diff

2
dist/2.0/fineui.min.css vendored

File diff suppressed because one or more lines are too long

75
dist/2.0/fineui.min.js vendored

File diff suppressed because one or more lines are too long

560
dist/base.js vendored

@ -579,10 +579,14 @@ BI.Text = BI.inherit(BI.Single, {
if (BI.isNumber(o.lineHeight)) {
this.element.css({lineHeight: o.lineHeight + "px"});
}
if (BI.isWidthOrHeight(o.maxWidth)) {
this.element.css({maxWidth: o.maxWidth});
}
this.element.css({
textAlign: o.textAlign,
whiteSpace: o.whiteSpace,
textOverflow: o.whiteSpace === 'nowrap' ? "ellipsis" : "",
textOverflow: o.whiteSpace === "nowrap" ? "ellipsis" : "",
overflow: o.whiteSpace === "nowrap" ? "" : "auto"
});
if (o.handler) {
this.text = BI.createWidget({
@ -600,15 +604,7 @@ BI.Text = BI.inherit(BI.Single, {
} else {
this.text = this;
}
},
_getShowText: function () {
var o = this.options;
return BI.isFunction(o.text) ? o.text() : o.text;
},
mounted: function () {
var o = this.options;
var text = this._getShowText();
if (BI.isKey(text)) {
this.setText(text);
@ -623,6 +619,12 @@ BI.Text = BI.inherit(BI.Single, {
}
},
_getShowText: function () {
var o = this.options;
return BI.isFunction(o.text) ? o.text() : o.text;
},
doRedMark: function (keyword) {
var o = this.options;
// render之后做的doredmark,这个时候虽然标红了,但是之后text mounted执行的时候并没有keyword
@ -657,8 +659,18 @@ BI.Text = BI.inherit(BI.Single, {
setText: function (text) {
BI.Text.superclass.setText.apply(this, arguments);
this.options.text = text;
this.text.element.html(BI.htmlEncode(this._getShowText()));
// 为textContext赋值为undefined时在ie和edge下会真的显示undefined
this.options.text = BI.isNotNull(text) ? text : "";
if (BI.isIE9Below()) {
this.text.element.html(BI.htmlEncode(this._getShowText()));
return;
}
if (/\s/.test(text)) {
this.text.element[0].innerHTML = BI.htmlEncode(this._getShowText());
} else {
// textContent性能更好,并且原生防xss
this.text.element[0].textContent = this._getShowText();
}
}
});
@ -7499,7 +7511,6 @@ BI.Button = BI.inherit(BI.BasicButton, {
ghost: false, // 是否幽灵显示, 即正常状态无背景
textAlign: "center",
whiteSpace: "nowrap",
forceCenter: false,
textWidth: null,
textHeight: null,
hgap: props.clear ? 0 : 10,
@ -7553,7 +7564,6 @@ BI.Button = BI.inherit(BI.BasicButton, {
type: "bi.label",
textAlign: o.textAlign,
whiteSpace: o.whiteSpace,
forceCenter: o.forceCenter,
textWidth: o.textWidth,
textHeight: o.textHeight,
hgap: o.hgap,
@ -7636,7 +7646,6 @@ BI.TextButton = BI.inherit(BI.BasicButton, {
baseCls: (conf.baseCls || "") + " bi-text-button",
textAlign: "center",
whiteSpace: "nowrap",
forceCenter: false,
textWidth: null,
textHeight: null,
hgap: 0,
@ -7657,7 +7666,6 @@ BI.TextButton = BI.inherit(BI.BasicButton, {
whiteSpace: o.whiteSpace,
textWidth: o.textWidth,
textHeight: o.textHeight,
forceCenter: o.forceCenter,
width: o.width,
height: o.height,
hgap: o.hgap,
@ -8881,7 +8889,6 @@ BI.Editor = BI.inherit(BI.Single, {
type: "bi.label",
cls: "bi-water-mark",
text: this.options.watermark,
forceCenter: true,
height: o.height - 2 * (o.vgap + o.tgap),
whiteSpace: "nowrap",
textAlign: "left"
@ -9015,6 +9022,9 @@ BI.Editor = BI.inherit(BI.Single, {
this.editor.on(BI.Input.EVENT_CONFIRM, function () {
self.fireEvent(BI.Editor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Input.EVENT_CHANGE_CONFIRM, function () {
self.fireEvent(BI.Editor.EVENT_CHANGE_CONFIRM, arguments);
});
this.element.click(function (e) {
e.stopPropagation();
return false;
@ -9128,6 +9138,10 @@ BI.Editor = BI.inherit(BI.Single, {
return this.editor.getLastValidValue();
},
getLastChangedValue: function () {
return this.editor.getLastChangedValue();
},
getValue: function () {
if (!this.isValid()) {
return BI.trim(this.editor.getLastValidValue());
@ -9159,6 +9173,7 @@ BI.Editor.EVENT_START = "EVENT_START";
BI.Editor.EVENT_PAUSE = "EVENT_PAUSE";
BI.Editor.EVENT_STOP = "EVENT_STOP";
BI.Editor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.Editor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.Editor.EVENT_VALID = "EVENT_VALID";
BI.Editor.EVENT_ERROR = "EVENT_ERROR";
BI.Editor.EVENT_ENTER = "EVENT_ENTER";
@ -10469,9 +10484,13 @@ BI.Input = BI.inherit(BI.Single, {
self._isEditing = false;
self._start = false;
if (self.isValid()) {
var lastValidValue = self._lastValidValue;
self._lastValidValue = self.getValue();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CONFIRM, self.getValue(), self);
self.fireEvent(BI.Input.EVENT_CONFIRM);
if(self._lastValidValue !== lastValidValue) {
self.fireEvent(BI.Input.EVENT_CHANGE_CONFIRM);
}
}
self.fireEvent(BI.Input.EVENT_BLUR);
}
@ -10621,6 +10640,10 @@ BI.Input = BI.inherit(BI.Single, {
},
getLastValidValue: function () {
return this._lastValidValue;
},
getLastChangedValue: function () {
return this._lastChangedValue;
},
@ -10657,6 +10680,7 @@ BI.Input.EVENT_BACKSPACE = "EVENT_BACKSPACE";
BI.Input.EVENT_START = "EVENT_START";
BI.Input.EVENT_PAUSE = "EVENT_PAUSE";
BI.Input.EVENT_STOP = "EVENT_STOP";
BI.Input.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.Input.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.Input.EVENT_REMOVE = "EVENT_REMOVE";
BI.Input.EVENT_EMPTY = "EVENT_EMPTY";
@ -10769,7 +10793,6 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
baseCls: (conf.baseCls || "") + " bi-label",
textAlign: "center",
whiteSpace: "nowrap", // normal or nowrap
forceCenter: false, // 是否无论如何都要居中, 不考虑超出边界的情况, 在未知宽度和高度时有效
textWidth: null,
textHeight: null,
hgap: 0,
@ -10809,28 +10832,22 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
var json = this._createJson();
if (BI.isNumber(o.width) && o.width > 0) {
if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
if (BI.isNumber(o.height) && o.height > 0) {
var gap = (o.width - o.textWidth) / 2;
json.maxWidth = o.textWidth;
if (BI.isNumber(o.height) && o.height > 0) { // 1.1
BI.createWidget({
type: "bi.adaptive",
type: "bi.center_adapt",
height: o.height,
scrollable: o.whiteSpace === "normal",
element: this,
items: [
{
el: (this.text = BI.createWidget(json)),
left: gap + o.hgap + o.lgap,
right: gap + o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
el: (this.text = BI.createWidget(json))
}
]
});
this.element.css({"line-height": o.height + "px"});
return;
}
json.width = o.textWidth;
BI.createWidget({
BI.createWidget({ // 1.2
type: "bi.center_adapt",
scrollable: o.whiteSpace === "normal",
element: this,
@ -10843,16 +10860,18 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
return;
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.center_adapt",
scrollable: o.whiteSpace === "normal",
BI.extend(json, {
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
bgap: o.bgap
});
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.center_adapt",
scrollable: o.whiteSpace === "normal",
element: this,
items: [this.text]
});
@ -10862,33 +10881,37 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
this.element.css({
"line-height": o.height + "px"
});
BI.createWidget({
type: "bi.absolute",
scrollable: o.whiteSpace === "normal",
this.text = BI.createWidget(BI.extend(json, {
element: this,
items: [{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
}]
});
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
}));
return;
}
json.width = o.width - 2 * o.hgap;
BI.extend(json, {
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
maxWidth: "100%"
});
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.center_adapt",
scrollable: o.whiteSpace === "normal",
element: this,
items: [{
el: (this.text = BI.createWidget(json))
}]
items: [this.text]
});
return;
}
if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
json.width = o.textWidth;
json.maxWidth = o.textWidth;
BI.createWidget({
type: "bi.center_adapt",
scrollable: o.whiteSpace === "normal",
@ -10902,60 +10925,36 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
return;
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.center_adapt",
BI.extend(json, {
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
scrollable: o.whiteSpace === "normal",
bgap: o.bgap
});
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.center_adapt",
scrollable: true,
element: this,
items: [this.text]
});
return;
}
if (BI.isNumber(o.height) && o.height > 0) {
if (BI.isNumber(o.textHeight) && o.textHeight > 0) {
this.element.css({
"line-height": o.height + "px"
});
BI.createWidget({
type: "bi.adaptive",
height: o.height,
scrollable: o.whiteSpace === "normal",
element: this,
items: [{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
}]
});
return;
}
BI.extend(json, {
this.element.css({
"line-height": o.height + "px"
});
this.text = BI.createWidget(BI.extend(json, {
element: this,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
});
this.element.css({
"line-height": o.height + "px"
});
this.text = BI.createWidget(BI.extend(json, {
element: this
}));
BI.createWidget({
type: "bi.layout",
element: this.text,
scrollable: o.whiteSpace === "normal"
});
return;
}
BI.extend(json, {
@ -10966,22 +10965,14 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
tgap: o.tgap,
bgap: o.bgap
});
if (o.forceCenter) {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.center_adapt",
element: this,
items: [this.text]
});
return;
}
this.text = BI.createWidget(BI.extend(json, {
element: this
maxWidth: "100%"
}));
BI.createWidget({
type: "bi.layout",
element: this.text,
scrollable: o.whiteSpace === "normal"
type: "bi.center_adapt",
element: this,
items: [this.text]
});
},
@ -10993,21 +10984,16 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
json.width = o.textWidth;
if (BI.isNumber(o.height) && o.height > 0) {
BI.createWidget({
type: "bi.adaptive",
type: "bi.vertical_adapt",
height: o.height,
scrollable: o.whiteSpace === "normal",
element: this,
items: [
{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
el: (this.text = BI.createWidget(json))
}
]
});
this.element.css({"line-height": o.height + "px"});
return;
}
BI.createWidget({
@ -11026,42 +11012,23 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
}
]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal",
if (BI.isNumber(o.height) && o.height > 0) {
this.text = BI.createWidget(BI.extend(json, {
element: this,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
element: this,
items: [this.text]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (BI.isNumber(o.height) && o.height > 0) {
this.element.css({
"line-height": o.height + "px"
});
BI.createWidget({
type: "bi.absolute",
scrollable: o.whiteSpace === "normal",
element: this,
items: [{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
}]
});
bgap: o.bgap
}));
if (o.whiteSpace !== "normal") {
this.element.css({
"line-height": o.height - (o.vgap * 2) + "px"
});
}
return;
}
json.width = o.width - 2 * o.hgap - o.lgap - o.rgap;
@ -11079,7 +11046,6 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
el: (this.text = BI.createWidget(json))
}]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
@ -11100,66 +11066,23 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
}
]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal",
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
element: this,
items: [this.text]
});
// 父亲有line-height,而当前label是inline-block,那么他的行高一定是父亲的lineHeight,就算text上设置了line-height
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (BI.isNumber(o.height) && o.height > 0) {
if (BI.isNumber(o.textHeight) && o.textHeight > 0) {
if (o.whiteSpace !== "normal") {
this.element.css({
"line-height": o.height + "px"
});
BI.createWidget({
type: "bi.adaptive",
height: o.height,
scrollable: o.whiteSpace === "normal",
element: this,
items: [{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
}]
"line-height": o.height - (o.vgap * 2) + "px"
});
return;
}
BI.extend(json, {
this.text = BI.createWidget(BI.extend(json, {
element: this,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
});
this.element.css({
"line-height": o.height + "px"
});
this.text = BI.createWidget(BI.extend(json, {
element: this
}));
BI.createWidget({
type: "bi.layout",
element: this.text,
scrollable: o.whiteSpace === "normal"
});
return;
}
BI.extend(json, {
@ -11170,23 +11093,14 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
tgap: o.tgap,
bgap: o.bgap
});
if (o.forceCenter) {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.vertical_adapt",
element: this,
items: [this.text]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
this.text = BI.createWidget(BI.extend(json, {
element: this
maxWidth: "100%"
}));
BI.createWidget({
type: "bi.layout",
element: this.text,
scrollable: o.whiteSpace === "normal"
type: "bi.vertical_adapt",
element: this,
items: [this.text]
});
},
@ -11284,7 +11198,6 @@ BI.Label = BI.inherit(BI.Single, {
baseCls: (conf.baseCls || "") + " bi-label",
textAlign: "center",
whiteSpace: "nowrap", // normal or nowrap
forceCenter: false, // 是否无论如何都要居中, 不考虑超出边界的情况, 在未知宽度和高度时有效
textWidth: null,
textHeight: null,
hgap: 0,
@ -11331,29 +11244,22 @@ BI.Label = BI.inherit(BI.Single, {
json.textAlign = "left";
if (BI.isNumber(o.width) && o.width > 0) {
if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
if (BI.isNumber(o.height) && o.height > 0) {
var gap = (o.width - o.textWidth) / 2;
json.maxWidth = o.textWidth;
if (BI.isNumber(o.height) && o.height > 0) { // 1.1
BI.createWidget({
type: "bi.adaptive",
type: "bi.center_adapt",
height: o.height,
scrollable: o.whiteSpace === "normal",
element: this,
items: [
{
el: (this.text = BI.createWidget(json)),
left: gap + o.hgap + o.lgap,
right: gap + o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
el: (this.text = BI.createWidget(json))
}
]
});
this.element.css({"line-height": o.height + "px"});
return;
}
json.width = o.textWidth;
json.textAlign = o.textAlign;
BI.createWidget({
BI.createWidget({ // 1.2
type: "bi.center_adapt",
scrollable: o.whiteSpace === "normal",
element: this,
@ -11365,7 +11271,7 @@ BI.Label = BI.inherit(BI.Single, {
});
return;
}
if (o.whiteSpace == "normal") {
if (o.whiteSpace == "normal") { // 1.3
BI.extend(json, {
hgap: o.hgap,
vgap: o.vgap,
@ -11383,39 +11289,42 @@ BI.Label = BI.inherit(BI.Single, {
});
return;
}
if (BI.isNumber(o.height) && o.height > 0) {
if (BI.isNumber(o.height) && o.height > 0) { // 1.4
this.element.css({
"line-height": o.height + "px"
});
json.textAlign = o.textAlign;
BI.createWidget({
type: "bi.absolute",
scrollable: o.whiteSpace === "normal",
this.text = BI.createWidget(BI.extend(json, {
element: this,
items: [{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
}]
});
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
}));
return;
}
json.width = o.width - 2 * o.hgap;
json.textAlign = o.textAlign;
BI.extend(json, { // 1.5
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
maxWidth: "100%"
});
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.center_adapt",
scrollable: o.whiteSpace === "normal",
element: this,
items: [{
el: (this.text = BI.createWidget(json))
}]
items: [this.text]
});
return;
}
if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
json.width = o.textWidth;
if (BI.isNumber(o.textWidth) && o.textWidth > 0) { // 1.6
json.maxWidth = o.textWidth;
BI.createWidget({
type: "bi.center_adapt",
scrollable: o.whiteSpace === "normal",
@ -11428,7 +11337,7 @@ BI.Label = BI.inherit(BI.Single, {
});
return;
}
if (o.whiteSpace == "normal") {
if (o.whiteSpace == "normal") { // 1.7
BI.extend(json, {
hgap: o.hgap,
vgap: o.vgap,
@ -11440,54 +11349,26 @@ BI.Label = BI.inherit(BI.Single, {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.center_adapt",
scrollable: o.whiteSpace === "normal",
scrollable: true,
element: this,
items: [this.text]
});
return;
}
if (BI.isNumber(o.height) && o.height > 0) {
if (BI.isNumber(o.textHeight) && o.textHeight > 0) {
this.element.css({
"line-height": o.height + "px"
});
json.textAlign = o.textAlign;
BI.createWidget({
type: "bi.adaptive",
height: o.height,
scrollable: o.whiteSpace === "normal",
element: this,
items: [{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
}]
});
return;
}
BI.extend(json, {
if (BI.isNumber(o.height) && o.height > 0) { // 1.8
this.element.css({
"line-height": o.height + "px"
});
json.textAlign = o.textAlign;
this.text = BI.createWidget(BI.extend(json, {
element: this,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
});
this.element.css({
"line-height": o.height + "px"
});
// 能走到这边,说明这个text不需要换行,并且不会做任何布局包装,那么这时候就该是什么align是什么align
json.textAlign = o.textAlign;
this.text = BI.createWidget(BI.extend(json, {
element: this
}));
BI.createWidget({
type: "bi.layout",
element: this.text,
scrollable: o.whiteSpace === "normal"
});
return;
}
BI.extend(json, {
@ -11498,24 +11379,14 @@ BI.Label = BI.inherit(BI.Single, {
tgap: o.tgap,
bgap: o.bgap
});
if (o.forceCenter) {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.center_adapt",
element: this,
items: [this.text]
});
return;
}
// 能走到这边,说明这个text不需要换行,并且不会做任何布局包装,那么这时候就该是什么align是什么align
json.textAlign = o.textAlign;
this.text = BI.createWidget(BI.extend(json, {
element: this
maxWidth: "100%"
}));
BI.createWidget({
type: "bi.layout",
element: this.text,
scrollable: o.whiteSpace === "normal"
type: "bi.center_adapt",
element: this,
items: [this.text]
});
},
@ -11525,26 +11396,21 @@ BI.Label = BI.inherit(BI.Single, {
if (BI.isNumber(o.width) && o.width > 0) {
if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
json.width = o.textWidth;
if (BI.isNumber(o.height) && o.height > 0) {
if (BI.isNumber(o.height) && o.height > 0) { // 2.1
BI.createWidget({
type: "bi.adaptive",
type: "bi.vertical_adapt",
height: o.height,
scrollable: o.whiteSpace === "normal",
element: this,
items: [
{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
el: (this.text = BI.createWidget(json))
}
]
});
this.element.css({"line-height": o.height + "px"});
return;
}
BI.createWidget({
BI.createWidget({ // 2.2
type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal",
hgap: o.hgap,
@ -11560,46 +11426,27 @@ BI.Label = BI.inherit(BI.Single, {
}
]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal",
if (BI.isNumber(o.height) && o.height > 0) { // 2.3
this.text = BI.createWidget(BI.extend(json, {
element: this,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
element: this,
items: [this.text]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (BI.isNumber(o.height) && o.height > 0) {
this.element.css({
"line-height": o.height + "px"
});
BI.createWidget({
type: "bi.absolute",
scrollable: o.whiteSpace === "normal",
element: this,
items: [{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
}]
});
bgap: o.bgap
}));
if (o.whiteSpace !== "normal") {
this.element.css({
"line-height": o.height - (o.vgap * 2) + "px"
});
}
return;
}
json.width = o.width - 2 * o.hgap - o.lgap - o.rgap;
BI.createWidget({
BI.createWidget({ // 2.4
type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal",
hgap: o.hgap,
@ -11613,12 +11460,11 @@ BI.Label = BI.inherit(BI.Single, {
el: (this.text = BI.createWidget(json))
}]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
json.width = o.textWidth;
BI.createWidget({
BI.createWidget({ // 2.5
type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal",
hgap: o.hgap,
@ -11634,66 +11480,23 @@ BI.Label = BI.inherit(BI.Single, {
}
]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal",
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
element: this,
items: [this.text]
});
// 父亲有line-height,而当前label是inline-block,那么他的行高一定是父亲的lineHeight,就算text上设置了line-height
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (BI.isNumber(o.height) && o.height > 0) {
if (BI.isNumber(o.textHeight) && o.textHeight > 0) {
if (o.whiteSpace !== "normal") {
this.element.css({
"line-height": o.height + "px"
"line-height": o.height - (o.vgap * 2) + "px"
});
BI.createWidget({
type: "bi.adaptive",
height: o.height,
scrollable: o.whiteSpace === "normal",
element: this,
items: [{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
}]
});
return;
}
BI.extend(json, {
this.text = BI.createWidget(BI.extend(json, { // 2.6
element: this,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
});
this.element.css({
"line-height": o.height + "px"
});
this.text = BI.createWidget(BI.extend(json, {
element: this
}));
BI.createWidget({
type: "bi.layout",
element: this.text,
scrollable: o.whiteSpace === "normal"
});
return;
}
BI.extend(json, {
@ -11704,23 +11507,14 @@ BI.Label = BI.inherit(BI.Single, {
tgap: o.tgap,
bgap: o.bgap
});
if (o.forceCenter) {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.vertical_adapt",
element: this,
items: [this.text]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
this.text = BI.createWidget(BI.extend(json, {
element: this
maxWidth: "100%"
}));
BI.createWidget({
type: "bi.layout",
element: this.text,
scrollable: o.whiteSpace === "normal"
type: "bi.vertical_adapt",
element: this,
items: [this.text]
});
},

4
dist/bundle.css vendored

@ -4442,6 +4442,10 @@ ul.ztree.zTreeDragUL {
-moz-border-radius: 3px;
border-radius: 3px;
}
.bi-time-trigger .show-text {
background-color: rgba(255, 255, 255, 0);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00ffffff,endColorstr=#00ffffff);
}
.bi-date-interval.time-error .bi-input {
color: #ff4949;
}

1379
dist/bundle.ie.js vendored

File diff suppressed because it is too large Load Diff

75
dist/bundle.ie.min.js vendored

File diff suppressed because one or more lines are too long

1379
dist/bundle.js vendored

File diff suppressed because it is too large Load Diff

2
dist/bundle.min.css vendored

File diff suppressed because one or more lines are too long

75
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

42
dist/case.js vendored

@ -5634,6 +5634,9 @@ BI.ClearEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self.fireEvent(BI.ClearEditor.EVENT_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self.fireEvent(BI.ClearEditor.EVENT_CHANGE_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.ClearEditor.EVENT_START);
});
@ -5698,6 +5701,7 @@ BI.ClearEditor.EVENT_START = "EVENT_START";
BI.ClearEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.ClearEditor.EVENT_STOP = "EVENT_STOP";
BI.ClearEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.ClearEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.ClearEditor.EVENT_VALID = "EVENT_VALID";
BI.ClearEditor.EVENT_ERROR = "EVENT_ERROR";
BI.ClearEditor.EVENT_ENTER = "EVENT_ENTER";
@ -5805,6 +5809,11 @@ BI.ShelterEditor = BI.inherit(BI.Widget, {
self._checkText();
self.fireEvent(BI.ShelterEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self._checkText();
self.fireEvent(BI.ShelterEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.ShelterEditor.EVENT_START, arguments);
});
@ -5923,6 +5932,10 @@ BI.ShelterEditor = BI.inherit(BI.Widget, {
return this.editor.getLastValidValue();
},
getLastChangedValue: function () {
return this.editor.getLastChangedValue();
},
setTextStyle: function (style) {
this.text.setStyle(style);
},
@ -5957,6 +5970,7 @@ BI.ShelterEditor.EVENT_START = "EVENT_START";
BI.ShelterEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.ShelterEditor.EVENT_STOP = "EVENT_STOP";
BI.ShelterEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.ShelterEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.ShelterEditor.EVENT_VALID = "EVENT_VALID";
BI.ShelterEditor.EVENT_ERROR = "EVENT_ERROR";
BI.ShelterEditor.EVENT_ENTER = "EVENT_ENTER";
@ -6068,6 +6082,11 @@ BI.SignEditor = BI.inherit(BI.Widget, {
self._checkText();
self.fireEvent(BI.SignEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self._checkText();
self.fireEvent(BI.SignEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.SignEditor.EVENT_START, arguments);
});
@ -6188,6 +6207,10 @@ BI.SignEditor = BI.inherit(BI.Widget, {
return this.editor.getLastValidValue();
},
getLastChangedValue: function () {
return this.editor.getLastChangedValue();
},
setValue: function (k) {
this.editor.setValue(k);
this._checkText();
@ -6217,6 +6240,7 @@ BI.SignEditor.EVENT_START = "EVENT_START";
BI.SignEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.SignEditor.EVENT_STOP = "EVENT_STOP";
BI.SignEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.SignEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.SignEditor.EVENT_VALID = "EVENT_VALID";
BI.SignEditor.EVENT_ERROR = "EVENT_ERROR";
BI.SignEditor.EVENT_ENTER = "EVENT_ENTER";
@ -6337,6 +6361,10 @@ BI.StateEditor = BI.inherit(BI.Widget, {
self._showHint();
self.fireEvent(BI.StateEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self.fireEvent(BI.StateEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.StateEditor.EVENT_START, arguments);
});
@ -6437,6 +6465,10 @@ BI.StateEditor = BI.inherit(BI.Widget, {
return this.editor.getLastValidValue();
},
getLastChangedValue: function () {
return this.editor.getLastChangedValue();
},
setValue: function (k) {
this.editor.setValue(k);
},
@ -6500,6 +6532,7 @@ BI.StateEditor.EVENT_START = "EVENT_START";
BI.StateEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.StateEditor.EVENT_STOP = "EVENT_STOP";
BI.StateEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.StateEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.StateEditor.EVENT_VALID = "EVENT_VALID";
BI.StateEditor.EVENT_ERROR = "EVENT_ERROR";
BI.StateEditor.EVENT_ENTER = "EVENT_ENTER";
@ -6609,6 +6642,10 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
self._showHint();
self.fireEvent(BI.SimpleStateEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self.fireEvent(BI.SimpleStateEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.SimpleStateEditor.EVENT_START, arguments);
});
@ -6707,6 +6744,10 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
return this.editor.getLastValidValue();
},
getLastChangedValue: function () {
return this.editor.getLastChangedValue();
},
setValue: function (k) {
this.editor.setValue(k);
},
@ -6758,6 +6799,7 @@ BI.SimpleStateEditor.EVENT_START = "EVENT_START";
BI.SimpleStateEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.SimpleStateEditor.EVENT_STOP = "EVENT_STOP";
BI.SimpleStateEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.SimpleStateEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.SimpleStateEditor.EVENT_VALID = "EVENT_VALID";
BI.SimpleStateEditor.EVENT_ERROR = "EVENT_ERROR";
BI.SimpleStateEditor.EVENT_ENTER = "EVENT_ENTER";

66
dist/core.js vendored

@ -15177,9 +15177,22 @@ BI.Layout = BI.inherit(BI.Widget, {
oldEndVnode = oldCh[--oldEndIdx];
newStartVnode = newCh[++newStartIdx];
} else {
var node = addNode(newStartVnode);
insertBefore(node, oldStartVnode);
newStartVnode = newCh[++newStartIdx];
var sameOldVnode = findOldVnode(oldCh, newStartVnode, oldStartIdx, oldEndIdx);
if (BI.isNull(sameOldVnode)) { // 不存在就把新的放到左边
var node = addNode(newStartVnode);
insertBefore(node, oldStartVnode);
newStartVnode = newCh[++newStartIdx];
} else { // 如果新节点在就旧节点区间中存在就复用一下
BI.each(oldCh, function (index, child) {
if (child && sameVnode(child, newStartVnode)) {
updated = self.patchItem(sameOldVnode, newStartVnode, index) || updated;
children[sameOldVnode.key == null ? self._getChildName(index) : sameOldVnode.key] = self._children[self._getChildName(index)];
oldCh[index] = undefined;
insertBefore(sameOldVnode, oldStartVnode);
}
});
newStartVnode = newCh[++newStartIdx];
}
}
}
if (oldStartIdx > oldEndIdx) {
@ -15223,9 +15236,13 @@ BI.Layout = BI.inherit(BI.Widget, {
function removeVnodes (vnodes, startIdx, endIdx) {
for (; startIdx <= endIdx; ++startIdx) {
var node = self._getOptions(vnodes[startIdx]);
var key = node.key == null ? self._getChildName(startIdx) : node.key;
children[key]._destroy();
var ch = vnodes[startIdx];
if (BI.isNotNull(ch)) {
var node = self._getOptions(ch);
var key = node.key == null ? self._getChildName(startIdx) : node.key;
delete self._children[self._getChildName(key)];
children[key]._destroy();
}
}
}
@ -15251,6 +15268,16 @@ BI.Layout = BI.inherit(BI.Widget, {
}
}
function findOldVnode (vnodes, vNode, beginIdx, endIdx) {
var i, found;
for (i = beginIdx; i <= endIdx; ++i) {
if (vnodes[i] && sameVnode(vnodes[i], vNode)) {
found = vnodes[i];
}
}
return found;
}
return updated;
},
@ -15892,21 +15919,16 @@ BI.ShowAction = BI.inherit(BI.Action, {
};
// replace the html special tags
var SPECIAL_TAGS = {
"&": "&amp;",
"\"": "&quot;",
"<": "&lt;",
">": "&gt;",
" ": "&nbsp;"
};
BI.htmlEncode = function (text) {
return BI.isNull(text) ? "" : BI.replaceAll(text + "", "&|\"|<|>|\\s", function (v) {
switch (v) {
case "&":
return "&amp;";
case "\"":
return "&quot;";
case "<":
return "&lt;";
case ">":
return "&gt;";
case " ":
default:
return "&nbsp;";
}
return SPECIAL_TAGS[v] ? SPECIAL_TAGS[v] : "&nbsp;";
});
};
// html decode
@ -18017,8 +18039,8 @@ _.extend(BI, {
s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format)
s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format)
s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366)
s["%k"] = hr; // hour, range 0 to 23 (24h format)
s["%l"] = ir; // hour, range 1 to 12 (12h format)
s["%k"] = hr + ""; // hour, range 0 to 23 (24h format)
s["%l"] = ir + ""; // hour, range 1 to 12 (12h format)
s["%X"] = (m < 9) ? ("0" + (1 + m)) : (1 + m); // month, range 01 to 12
s["%x"] = m + 1; // month, range 1 to 12
s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59
@ -19451,7 +19473,7 @@ BI.prepares.push(function () {
BI.extend(BI.DOM, {
patchProps: function (fromElement, toElement) {
var elemData = BI.Widget._renderEngine._data(fromElement[0]);
var elemData = jQuery._data(fromElement[0]);
var events = elemData.events;
BI.each(events, function (eventKey, event) {
BI.each(event, function (i, handler) {

700
dist/demo.js vendored

@ -495,7 +495,596 @@ BI.shortcut("demo.icon_label", Demo.IconLabel);Demo.Label = BI.inherit(BI.Widget
};
}
});
BI.shortcut("demo.label", Demo.Label);Demo.Message = BI.inherit(BI.Widget, {
BI.shortcut("demo.label", Demo.Label);/**
* 整理所有label场景
*/
Demo.LabelScene = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-label"
},
render: function () {
var items = [];
items.push(this.createExpander("1.1.1 文字居中,有宽度和高度,有文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg6",
text: "设置了textWidth,则一定是嵌套结构,因此需要用center_adapt布局容纳一下.为了实现不足一行时文字水平居中,超出一行时左对齐,需要设置maxWidth.",
whiteSpace: "normal",
height: 50,
width: 500,
textWidth: 200,
textAlign: "center"
}));
items.push(this.createExpander("1.1.2 居中,有宽度和高度,有文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg6",
text: "居中,有宽度高度,有文字宽度,whiteSpace为nowrap,maxWidth会限制文字",
whiteSpace: "nowrap",
height: 50,
width: 500,
textWidth: 350,
textAlign: "center"
}));
items.push((this.createExpander("1.2.1 居中,有宽度无高度,有文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg6",
text: "居中,有宽度无高度,有文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
width: 500,
textWidth: 200,
textAlign: "center"
})));
items.push((this.createExpander("1.2.1 居中,有宽度无高度,有文字宽度,whiteSpace为normal,高度被父容器拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg6",
text: "此时虽然没有对label设置高度,但由于使用了center_adapt布局,依然会垂直方向居中",
whiteSpace: "normal",
width: 500,
textWidth: 200,
textAlign: "center"
},
top: 0,
left: 0,
bottom: 0
}
]
})));
items.push((this.createExpander("1.2.2 居中,有宽度无高度,有文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg6",
text: "居中,有宽度无高度,有文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
width: 500,
textWidth: 350,
textAlign: "center"
})));
items.push((this.createExpander("1.3.1 居中,有宽度和高度,无文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg3",
text: "居中,有宽度高度,无文字宽度,whiteSpace为normal,只需用center_adapt布局包一下即可.度,下即可.居中,有宽度,无文字宽度,whiteSpace为normal居中,有宽度,无文字宽度,下即可.居中,有宽度,无文字宽度,whiteSpace为normal居中,有宽度,无文字宽度,下即可.居中,有宽度,无文字宽度,whiteSpace为normal居中,有宽度,无文字宽度,度,无文字宽度,whiteSpace为normal居中,有宽度,无文字宽度,whiteSpace为normal",
width: 500,
whiteSpace: "normal",
textAlign: "center",
height: 50
})));
items.push((this.createExpander("1.3.2 居中,有宽度无高度,无文字宽度,whiteSpace为normal", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg3",
text: "居中,有宽度无高度,无文字宽度,whiteSpace为normal,只需用center_adapt布局包一下即可.度,下即可.居中,有宽度,无文字宽度,whiteSpace为normal居中,有宽度,无文字宽度,下即可.居中,有宽度,无文字宽度,whiteSpace为normal居中,有宽度,无文字宽度,下即可.居中,有宽度,无文字宽度,whiteSpace为normal居中,有宽度,无文字宽度,度,无文字宽度,whiteSpace为normal居中,有宽度,无文字宽度,whiteSpace为normal",
width: 500,
whiteSpace: "normal",
textAlign: "center"
},
top: 0,
left: 0,
bottom: 0
}
]
})));
items.push((this.createExpander("1.4 居中,有宽度和高度,无文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg3",
text: "居中,有宽度500有高度50,无文字宽度,whiteSpace为nowrap,此处无需两层div,设置text即可,然后设置line-height为传入高度即可实现垂直方向居中",
width: 500,
whiteSpace: "nowrap",
textAlign: "center",
height: 50
})));
items.push((this.createExpander("1.5.1 居中,有宽度无高度,无文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg3",
text: "居中,有宽度500无高度,无文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
width: 500,
whiteSpace: "nowrap",
textAlign: "center"
})));
items.push((this.createExpander("1.5.2 居中,有宽度无高度,无文字宽度,whiteSpace为nowrap,高度被父级拉满", {
type: "bi.absolute",
height: 50,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg3",
text: "居中,有宽度500无高度,无文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
width: 500,
whiteSpace: "nowrap",
textAlign: "center"
},
top: 0,
left: 0,
bottom: 0
}
]
})));
items.push((this.createExpander("1.6.1 居中,无宽度无高度,有文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg3",
text: "居中,无宽度,有文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
textWidth: 500,
whiteSpace: "nowrap",
textAlign: "center"
})));
items.push((this.createExpander("1.6.2 居中,无宽度无高度,有文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg3",
text: "居中,无宽度,有文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
textWidth: 500,
whiteSpace: "normal",
textAlign: "center"
})));
items.push((this.createExpander("1.6.3 居中,无宽度无,有文字宽度,whiteSpace为normal,被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg3",
text: "居中,无宽度,有文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
textWidth: 500,
whiteSpace: "normal",
textAlign: "center"
},
left: 0,
right: 0,
top: 0,
bottom: 0
}
]
})));
items.push((this.createExpander("1.7.1 居中,无宽度无高度,无文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg3",
text: "居中,无宽度无高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "center"
})));
items.push((this.createExpander("1.7.2 居中,无宽度无高度,无文字宽度,whiteSpace为normal,被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg3",
text: "居中,无宽度无高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "center"
},
left: 0,
right: 0,
top: 0,
bottom: 0
}
]
})));
items.push((this.createExpander("1.7.3 居中,无宽度有高度,无文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg3",
text: "居中,无宽度有高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
height: 50,
textAlign: "center"
})));
items.push((this.createExpander("1.8 居中,无宽度有高度,无文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg3",
text: "居中,无宽度有高度,无文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
height: 50,
textAlign: "center"
})));
items.push((this.createExpander("1.9 居中,无宽度无高度,无文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg3",
text: "居中,无宽度无高度,无文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "center"
})));
items.push((this.createExpander("1.9.1 居中,无宽度无高度,无文字宽度,whiteSpace为nowrap,高度被父级拉满", {
type: "bi.absolute",
height: 50,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg3",
text: "居中,无宽度无高度,无文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "center"
},
top: 0,
left: 0,
right: 0,
bottom: 0
}
]
})));
items.push((this.createExpander("2.1.1 居左,有宽度有高度,有文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,有宽度有高度,有文字宽度,whiteSpace为normal,为了演示这个是真的是normal的我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left",
textWidth: 300,
height: 50,
width: 500
})));
items.push((this.createExpander("2.1.2 居左,有宽度有高度,有文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,有宽度有高度,有文字宽度,whiteSpace为normal,为了演示这个是真的是normal的我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "left",
textWidth: 300,
height: 50,
width: 500
})));
items.push((this.createExpander("2.2.1 居左,有宽度无高度,有文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,有宽度无高度,有文字宽度,whiteSpace为normal,不设置高度,为了演示这个是真的是normal的我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left",
textWidth: 300,
width: 500
})));
items.push((this.createExpander("2.2.2 居左,有宽度无高度,有文字宽度,whiteSpace为normal,高度被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg2",
text: "居左,有宽度无高度,有文字宽度,whiteSpace为normal,不设置高度,为了演示这个是真的是normal的我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left",
textWidth: 300,
width: 500
},
top: 0,
bottom: 0,
left: 0
}
]
})));
items.push((this.createExpander("2.2.3 居左,有宽度无高度,有文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,有宽度无高度,有文字宽度,whiteSpace为nowrap,不设置高度,为了演示这个是真的是normal的我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "left",
textWidth: 300,
width: 500
})));
items.push((this.createExpander("2.2.4 居左,有宽度无高度,有文字宽度,whiteSpace为nowrap,高度被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg2",
text: "居左,有宽度无高度,有文字宽度,whiteSpace为nowrap,不设置高度,为了演示这个是真的是normal的我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "left",
textWidth: 300,
width: 500
},
top: 0,
bottom: 0,
left: 0
}
]
})));
items.push((this.createExpander("2.3.1 居左,有宽度有高度,无文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,有宽度有高度,无文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "left",
height: 50,
vgap: 5,
width: 500
})));
items.push((this.createExpander("2.3.2 居左,有宽度有高度,无文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,有宽度有高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left",
height: 50,
width: 500
})));
items.push((this.createExpander("2.4.1 居左,有宽度无高度,无文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,有宽度无高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left",
width: 500
})));
items.push((this.createExpander("2.4.2 居左,有宽度无高度,无文字宽度,whiteSpace为normal,高度被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg1",
text: "居左,有宽度无高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left",
width: 500
},
top: 0,
left: 0,
bottom: 0
}
]
})));
items.push((this.createExpander("2.5.1 居左,无宽度无高度,有文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,有文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left",
textWidth: 300
})));
items.push((this.createExpander("2.5.2 居左,无宽度无高度,有文字宽度,whiteSpace为normal,高度被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,有文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left",
textWidth: 300
},
top: 0,
left: 0,
bottom: 0,
right: 0
}
]
})));
items.push((this.createExpander("2.5.3 居左,无宽度无高度,有文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,有文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "left",
textWidth: 300
})));
items.push((this.createExpander("2.5.4 居左,无宽度无高度,有文字宽度,whiteSpace为nowrap,高度被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,有文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "left",
textWidth: 300
},
top: 0,
left: 0,
bottom: 0,
right: 0
}
]
})));
items.push((this.createExpander("2.6.1 居左,无宽度有高度,无文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度有高度,无文字宽度,whiteSpace为nowrap,注意这个是设置了vgap的,为了实现居中,lineHeight要做计算,才能准确的垂直居中",
whiteSpace: "nowrap",
textAlign: "left",
vgap: 10,
height: 50
})));
items.push((this.createExpander("2.6.2 居左,无宽度有高度,无文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度有高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left",
height: 50
})));
items.push((this.createExpander("2.7.1 居左,无宽度无高度,无文字宽度,whiteSpace为normal", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left"
})));
items.push((this.createExpander("2.7.2 居左,无宽度无高度,无文字宽度,whiteSpace为normal,高度被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left"
},
top: 0,
left: 0,
bottom: 0,
right: 0
}
]
})));
items.push((this.createExpander("2.7.3 居左,无宽度无高度,无文字宽度,whiteSpace为nowrap", {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,无文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "left"
})));
items.push((this.createExpander("2.7.4 居左,无宽度无高度,无文字宽度,whiteSpace为nowrap,高度被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,无文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "left"
},
top: 0,
left: 0,
bottom: 0,
right: 0
}
]
})));
items.push((this.createExpander("2.8 居左,无宽度无高度,无文字宽度,whiteSpace为nowrap,高度被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,无文字宽度,whiteSpace为nowrap,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "nowrap",
textAlign: "left"
},
top: 0,
left: 0,
bottom: 0,
right: 0
}
]
})));
items.push((this.createExpander("2.8.2 居左,无宽度无高度,无文字宽度,whiteSpace为normal,高度被父级拉满", {
type: "bi.absolute",
height: 100,
items: [
{
el: {
type: "bi.label",
cls: "layout-bg2",
text: "居左,无宽度无高度,无文字宽度,whiteSpace为normal,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,我凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数,凑点字数",
whiteSpace: "normal",
textAlign: "left"
},
top: 0,
left: 0,
bottom: 0,
right: 0
}
]
})));
return {
type: "bi.vertical",
items: items,
hgap: 300,
vgap: 20
};
},
createExpander: function (text, popup) {
return {
type: "bi.vertical",
items: [
{
type: "bi.label",
cls: "demo-font-weight-bold",
textAlign: "left",
text: text,
height: 30
}, {
el: popup
}
]
};
}
});
BI.shortcut("demo.label_scene", Demo.LabelScene);Demo.Message = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-bubble"
},
@ -2773,6 +3362,10 @@ BI.shortcut("demo.value_chooser_pane", Demo.ValueChooserPane);Demo.BASE_CONFIG =
pId: 2,
text: "bi.label",
value: "demo.label"
},{
pId: 2,
text: "bi.label_scene",
value: "demo.label_scene"
}, {
pId: 2,
text: "bi.icon_label",
@ -3504,6 +4097,10 @@ Demo.COMPONENT_CONFIG = [{
pId: 412,
text: "bi.date_time",
value: "demo.date_time"
}, {
pId: 412,
text: "bi.time_combo",
value: "demo.time_combo"
}, {
pId: 412,
text: "bi.time_interval",
@ -6607,7 +7204,6 @@ BI.shortcut("demo.searcher_view", Demo.Func);Demo.Face = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "bi-list-item-active",
text: "测试激活状态",
forceCenter: true
}
}]
};
@ -6629,7 +7225,6 @@ BI.shortcut("demo.searcher_view", Demo.Func);Demo.Face = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "bi-list-item-active",
text: "测试选中状态",
forceCenter: true
}
}]
};
@ -6672,7 +7267,6 @@ BI.shortcut("demo.searcher_view", Demo.Func);Demo.Face = BI.inherit(BI.Widget, {
el: {
type: "bi.text_button",
text: "这个按钮是灰化的",
forceCenter: true,
disabled: true
}
}]
@ -6709,7 +7303,6 @@ BI.shortcut("demo.searcher_view", Demo.Func);Demo.Face = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "bi-list-item-active",
text: "测试悬浮状态",
forceCenter: true
}
}]
};
@ -6731,7 +7324,6 @@ BI.shortcut("demo.searcher_view", Demo.Func);Demo.Face = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "bi-list-item-active",
text: "测试激活状态",
forceCenter: true
}
}]
};
@ -6753,7 +7345,6 @@ BI.shortcut("demo.searcher_view", Demo.Func);Demo.Face = BI.inherit(BI.Widget, {
type: "bi.text_button",
cls: "bi-list-item-active",
text: "测试选中状态",
forceCenter: true
}
}]
};
@ -8861,15 +9452,25 @@ Demo.Date = BI.inherit(BI.Widget, {
ref: function () {
self.datecombo = this;
},
width: 300
// value: {
// type: 1,
// value: {
// year: 2018,
// month: 2,
// day: 23
// }
// }
width: 300,
// allowEdit: false,
// format: "%Y-%X-%d", // yyyy-MM-dd
// format: "%Y/%X/%d", // yyyy/MM/dd
// format: "%Y-%x-%e", // yyyy-M-d
// format: "%Y/%x/%e", // yyyy/M/d
// format: "%X/%d/%Y", // MM/dd/yyyy
// format: "%X/%e/%y", // MM/d/yy
// format: "%X.%d.%Y", // MM.dd.yyyy
// format: "%X.%e.%Y", // MM.d.yyyy
// format: "%X-%e-%y", // MM.d.yyyy
value: {
type: 1,
value: {
year: 2018,
month: 2,
day: 23
}
}
}, {
type: "bi.button",
text: "getValue",
@ -8883,6 +9484,25 @@ Demo.Date = BI.inherit(BI.Widget, {
self.datetimecombo = this;
},
width: 300,
// allowEdit: false,
// format: "%Y-%X-%d %H:%M:%S", // yyyy-MM-dd HH:mm:ss
// format: "%Y/%X/%d %H:%M:%S", // yyyy/MM/dd HH:mm:ss
// format: "%Y-%X-%d %I:%M:%S", // yyyy-MM-dd hh:mm:ss
// format: "%Y/%X/%d %I:%M:%S", // yyyy/MM/dd hh:mm:ss
// format: "%Y-%X-%d %H:%M:%S %p", // yyyy-MM-dd HH:mm:ss a
// format: "Y/%X/%d %H:%M:%S %p", // yyyy/MM/dd HH:mm:ss a
// format: "%Y-%X-%d %I:%M:%S %p", // yyyy-MM-dd hh:mm:ss a
// format: "%Y/%X/%d %I:%M:%S %p", // yyyy/MM/dd hh:mm:ss a
// format: "%X/%d/%Y %I:%M:%S", // MM/dd/yyyy hh:mm:ss
// format: "%X/%d/%Y %H:%M:%S", // MM/dd/yyyy HH:mm:ss
// format: "%X/%d/%Y %I:%M:%S", // MM/dd/yyyy hh:mm:ss a
// format: "%X/%d/%Y %H:%M:%S %p", // MM/dd/yyyy HH:mm:ss a
// format: "%X/%d/%Y %I:%M:%S %p", // MM/dd/yyyy hh:mm:ss a
// format: "%X/%d/%Y %H:%M:%S %p", // MM/dd/yyyy HH:mm:ss a
// format: "%X/%d/%Y %l:%M %p", // MM/dd/yyyy h:mm a
// format: "%X-%d-%Y %k:%M %p", // MM/dd/yyyy H:mm a
// format: "%Y-%x-%e %l:%M", // yyyy-M-d h:mm
// format: "%Y-%x-%e %k:%M", // yyyy-M-d H:mm
value: {
type: 1,
value: {
@ -9255,6 +9875,7 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
var self = this;
var widget = BI.createWidget({
type: "bi.multi_select_insert_combo",
// allowEdit: false,
itemsCreator: BI.bind(this._itemsCreator, this),
width: 200,
value: {
@ -10060,6 +10681,53 @@ Demo.Slider = BI.inherit(BI.Widget, {
BI.shortcut("demo.slider", Demo.Slider);/**
* Created by Dailer on 2017/7/13.
*/
Demo.TimeCombo = BI.inherit(BI.Widget, {
props: {
baseCls: ""
},
render: function () {
var self = this;
return {
type: "bi.horizontal_auto",
items: [{
type: "bi.time_combo",
ref: function (_ref) {
self.timeCombo = _ref;
},
// allowEdit: true,
// format: "%H:%M:%S", // HH:mm:ss
// format: "%I:%M:%S", // hh:mm:ss
// format: "%l:%M:%S", // h:mm:ss
// format: "%k:%M:%S", // H:mm:ss
// format: "%l:%M:%S %p", // h:mm:ss a
// format: "%l:%M", // h:mm
// format: "%k:%M", // H:mm
// format: "%I:%M", // hh:mm
// format: "%H:%M", // HH:mm
// format: "%M:%S", // mm:ss
value: {
hour: 12,
minute: 0,
second: 0
},
width: 300
}, {
type: "bi.button",
text: "getValue",
handler: function () {
BI.Msg.toast(JSON.stringify(self.timeCombo.getValue()));
},
width: 300
}],
vgap: 20
};
}
});
BI.shortcut("demo.time_combo", Demo.TimeCombo);/**
* Created by Dailer on 2017/7/13.
*/
Demo.TimeInterval = BI.inherit(BI.Widget, {
props: {
baseCls: ""

4
dist/fineui.css vendored

@ -4442,6 +4442,10 @@ ul.ztree.zTreeDragUL {
-moz-border-radius: 3px;
border-radius: 3px;
}
.bi-time-trigger .show-text {
background-color: rgba(255, 255, 255, 0);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00ffffff,endColorstr=#00ffffff);
}
.bi-date-interval.time-error .bi-input {
color: #ff4949;
}

1379
dist/fineui.ie.js vendored

File diff suppressed because it is too large Load Diff

75
dist/fineui.ie.min.js vendored

File diff suppressed because one or more lines are too long

1379
dist/fineui.js vendored

File diff suppressed because it is too large Load Diff

2
dist/fineui.min.css vendored

File diff suppressed because one or more lines are too long

75
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

1377
dist/fineui_without_jquery_polyfill.js vendored

File diff suppressed because it is too large Load Diff

25
dist/utils.js vendored

@ -10753,8 +10753,8 @@ _.extend(BI, {
s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format)
s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format)
s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366)
s["%k"] = hr; // hour, range 0 to 23 (24h format)
s["%l"] = ir; // hour, range 1 to 12 (12h format)
s["%k"] = hr + ""; // hour, range 0 to 23 (24h format)
s["%l"] = ir + ""; // hour, range 1 to 12 (12h format)
s["%X"] = (m < 9) ? ("0" + (1 + m)) : (1 + m); // month, range 01 to 12
s["%x"] = m + 1; // month, range 1 to 12
s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59
@ -12884,21 +12884,16 @@ if (!_global.BI) {
};
// replace the html special tags
var SPECIAL_TAGS = {
"&": "&amp;",
"\"": "&quot;",
"<": "&lt;",
">": "&gt;",
" ": "&nbsp;"
};
BI.htmlEncode = function (text) {
return BI.isNull(text) ? "" : BI.replaceAll(text + "", "&|\"|<|>|\\s", function (v) {
switch (v) {
case "&":
return "&amp;";
case "\"":
return "&quot;";
case "<":
return "&lt;";
case ">":
return "&gt;";
case " ":
default:
return "&nbsp;";
}
return SPECIAL_TAGS[v] ? SPECIAL_TAGS[v] : "&nbsp;";
});
};
// html decode

6
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

4
dist/widget.css vendored

@ -320,6 +320,10 @@
-moz-border-radius: 3px;
border-radius: 3px;
}
.bi-time-trigger .show-text {
background-color: rgba(255, 255, 255, 0);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00ffffff,endColorstr=#00ffffff);
}
.bi-date-interval.time-error .bi-input {
color: #ff4949;
}

711
dist/widget.js vendored

File diff suppressed because it is too large Load Diff

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

@ -25,7 +25,6 @@ BI.Button = BI.inherit(BI.BasicButton, {
ghost: false, // 是否幽灵显示, 即正常状态无背景
textAlign: "center",
whiteSpace: "nowrap",
forceCenter: false,
textWidth: null,
textHeight: null,
hgap: props.clear ? 0 : 10,
@ -79,7 +78,6 @@ BI.Button = BI.inherit(BI.BasicButton, {
type: "bi.label",
textAlign: o.textAlign,
whiteSpace: o.whiteSpace,
forceCenter: o.forceCenter,
textWidth: o.textWidth,
textHeight: o.textHeight,
hgap: o.hgap,

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

@ -12,7 +12,6 @@ BI.TextButton = BI.inherit(BI.BasicButton, {
baseCls: (conf.baseCls || "") + " bi-text-button",
textAlign: "center",
whiteSpace: "nowrap",
forceCenter: false,
textWidth: null,
textHeight: null,
hgap: 0,
@ -33,7 +32,6 @@ BI.TextButton = BI.inherit(BI.BasicButton, {
whiteSpace: o.whiteSpace,
textWidth: o.textWidth,
textHeight: o.textHeight,
forceCenter: o.forceCenter,
width: o.width,
height: o.height,
hgap: o.hgap,

9
src/base/single/editor/editor.js

@ -51,7 +51,6 @@ BI.Editor = BI.inherit(BI.Single, {
type: "bi.label",
cls: "bi-water-mark",
text: this.options.watermark,
forceCenter: true,
height: o.height - 2 * (o.vgap + o.tgap),
whiteSpace: "nowrap",
textAlign: "left"
@ -185,6 +184,9 @@ BI.Editor = BI.inherit(BI.Single, {
this.editor.on(BI.Input.EVENT_CONFIRM, function () {
self.fireEvent(BI.Editor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Input.EVENT_CHANGE_CONFIRM, function () {
self.fireEvent(BI.Editor.EVENT_CHANGE_CONFIRM, arguments);
});
this.element.click(function (e) {
e.stopPropagation();
return false;
@ -298,6 +300,10 @@ BI.Editor = BI.inherit(BI.Single, {
return this.editor.getLastValidValue();
},
getLastChangedValue: function () {
return this.editor.getLastChangedValue();
},
getValue: function () {
if (!this.isValid()) {
return BI.trim(this.editor.getLastValidValue());
@ -329,6 +335,7 @@ BI.Editor.EVENT_START = "EVENT_START";
BI.Editor.EVENT_PAUSE = "EVENT_PAUSE";
BI.Editor.EVENT_STOP = "EVENT_STOP";
BI.Editor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.Editor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.Editor.EVENT_VALID = "EVENT_VALID";
BI.Editor.EVENT_ERROR = "EVENT_ERROR";
BI.Editor.EVENT_ENTER = "EVENT_ENTER";

9
src/base/single/input/input.js

@ -111,9 +111,13 @@ BI.Input = BI.inherit(BI.Single, {
self._isEditing = false;
self._start = false;
if (self.isValid()) {
var lastValidValue = self._lastValidValue;
self._lastValidValue = self.getValue();
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CONFIRM, self.getValue(), self);
self.fireEvent(BI.Input.EVENT_CONFIRM);
if(self._lastValidValue !== lastValidValue) {
self.fireEvent(BI.Input.EVENT_CHANGE_CONFIRM);
}
}
self.fireEvent(BI.Input.EVENT_BLUR);
}
@ -263,6 +267,10 @@ BI.Input = BI.inherit(BI.Single, {
},
getLastValidValue: function () {
return this._lastValidValue;
},
getLastChangedValue: function () {
return this._lastChangedValue;
},
@ -299,6 +307,7 @@ BI.Input.EVENT_BACKSPACE = "EVENT_BACKSPACE";
BI.Input.EVENT_START = "EVENT_START";
BI.Input.EVENT_PAUSE = "EVENT_PAUSE";
BI.Input.EVENT_STOP = "EVENT_STOP";
BI.Input.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.Input.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.Input.EVENT_REMOVE = "EVENT_REMOVE";
BI.Input.EVENT_EMPTY = "EVENT_EMPTY";

250
src/base/single/label/html.label.js

@ -9,7 +9,6 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
baseCls: (conf.baseCls || "") + " bi-label",
textAlign: "center",
whiteSpace: "nowrap", // normal or nowrap
forceCenter: false, // 是否无论如何都要居中, 不考虑超出边界的情况, 在未知宽度和高度时有效
textWidth: null,
textHeight: null,
hgap: 0,
@ -49,28 +48,22 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
var json = this._createJson();
if (BI.isNumber(o.width) && o.width > 0) {
if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
if (BI.isNumber(o.height) && o.height > 0) {
var gap = (o.width - o.textWidth) / 2;
json.maxWidth = o.textWidth;
if (BI.isNumber(o.height) && o.height > 0) { // 1.1
BI.createWidget({
type: "bi.adaptive",
type: "bi.center_adapt",
height: o.height,
scrollable: o.whiteSpace === "normal",
element: this,
items: [
{
el: (this.text = BI.createWidget(json)),
left: gap + o.hgap + o.lgap,
right: gap + o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
el: (this.text = BI.createWidget(json))
}
]
});
this.element.css({"line-height": o.height + "px"});
return;
}
json.width = o.textWidth;
BI.createWidget({
BI.createWidget({ // 1.2
type: "bi.center_adapt",
scrollable: o.whiteSpace === "normal",
element: this,
@ -83,16 +76,18 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
return;
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.center_adapt",
scrollable: o.whiteSpace === "normal",
BI.extend(json, {
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
bgap: o.bgap
});
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.center_adapt",
scrollable: o.whiteSpace === "normal",
element: this,
items: [this.text]
});
@ -102,33 +97,37 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
this.element.css({
"line-height": o.height + "px"
});
BI.createWidget({
type: "bi.absolute",
scrollable: o.whiteSpace === "normal",
this.text = BI.createWidget(BI.extend(json, {
element: this,
items: [{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
}]
});
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
}));
return;
}
json.width = o.width - 2 * o.hgap;
BI.extend(json, {
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
maxWidth: "100%"
});
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.center_adapt",
scrollable: o.whiteSpace === "normal",
element: this,
items: [{
el: (this.text = BI.createWidget(json))
}]
items: [this.text]
});
return;
}
if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
json.width = o.textWidth;
json.maxWidth = o.textWidth;
BI.createWidget({
type: "bi.center_adapt",
scrollable: o.whiteSpace === "normal",
@ -142,60 +141,36 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
return;
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.center_adapt",
BI.extend(json, {
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
scrollable: o.whiteSpace === "normal",
bgap: o.bgap
});
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.center_adapt",
scrollable: true,
element: this,
items: [this.text]
});
return;
}
if (BI.isNumber(o.height) && o.height > 0) {
if (BI.isNumber(o.textHeight) && o.textHeight > 0) {
this.element.css({
"line-height": o.height + "px"
});
BI.createWidget({
type: "bi.adaptive",
height: o.height,
scrollable: o.whiteSpace === "normal",
element: this,
items: [{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
}]
});
return;
}
BI.extend(json, {
this.element.css({
"line-height": o.height + "px"
});
this.text = BI.createWidget(BI.extend(json, {
element: this,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
});
this.element.css({
"line-height": o.height + "px"
});
this.text = BI.createWidget(BI.extend(json, {
element: this
}));
BI.createWidget({
type: "bi.layout",
element: this.text,
scrollable: o.whiteSpace === "normal"
});
return;
}
BI.extend(json, {
@ -206,22 +181,14 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
tgap: o.tgap,
bgap: o.bgap
});
if (o.forceCenter) {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.center_adapt",
element: this,
items: [this.text]
});
return;
}
this.text = BI.createWidget(BI.extend(json, {
element: this
maxWidth: "100%"
}));
BI.createWidget({
type: "bi.layout",
element: this.text,
scrollable: o.whiteSpace === "normal"
type: "bi.center_adapt",
element: this,
items: [this.text]
});
},
@ -233,21 +200,16 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
json.width = o.textWidth;
if (BI.isNumber(o.height) && o.height > 0) {
BI.createWidget({
type: "bi.adaptive",
type: "bi.vertical_adapt",
height: o.height,
scrollable: o.whiteSpace === "normal",
element: this,
items: [
{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
el: (this.text = BI.createWidget(json))
}
]
});
this.element.css({"line-height": o.height + "px"});
return;
}
BI.createWidget({
@ -266,42 +228,23 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
}
]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal",
if (BI.isNumber(o.height) && o.height > 0) {
this.text = BI.createWidget(BI.extend(json, {
element: this,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
element: this,
items: [this.text]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (BI.isNumber(o.height) && o.height > 0) {
this.element.css({
"line-height": o.height + "px"
});
BI.createWidget({
type: "bi.absolute",
scrollable: o.whiteSpace === "normal",
element: this,
items: [{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
}]
});
bgap: o.bgap
}));
if (o.whiteSpace !== "normal") {
this.element.css({
"line-height": o.height - (o.vgap * 2) + "px"
});
}
return;
}
json.width = o.width - 2 * o.hgap - o.lgap - o.rgap;
@ -319,7 +262,6 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
el: (this.text = BI.createWidget(json))
}]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
@ -340,66 +282,23 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
}
]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal",
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
element: this,
items: [this.text]
});
// 父亲有line-height,而当前label是inline-block,那么他的行高一定是父亲的lineHeight,就算text上设置了line-height
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (BI.isNumber(o.height) && o.height > 0) {
if (BI.isNumber(o.textHeight) && o.textHeight > 0) {
if (o.whiteSpace !== "normal") {
this.element.css({
"line-height": o.height + "px"
"line-height": o.height - (o.vgap * 2) + "px"
});
BI.createWidget({
type: "bi.adaptive",
height: o.height,
scrollable: o.whiteSpace === "normal",
element: this,
items: [{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
}]
});
return;
}
BI.extend(json, {
this.text = BI.createWidget(BI.extend(json, {
element: this,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
});
this.element.css({
"line-height": o.height + "px"
});
this.text = BI.createWidget(BI.extend(json, {
element: this
}));
BI.createWidget({
type: "bi.layout",
element: this.text,
scrollable: o.whiteSpace === "normal"
});
return;
}
BI.extend(json, {
@ -410,23 +309,14 @@ BI.HtmlLabel = BI.inherit(BI.Single, {
tgap: o.tgap,
bgap: o.bgap
});
if (o.forceCenter) {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.vertical_adapt",
element: this,
items: [this.text]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
this.text = BI.createWidget(BI.extend(json, {
element: this
maxWidth: "100%"
}));
BI.createWidget({
type: "bi.layout",
element: this.text,
scrollable: o.whiteSpace === "normal"
type: "bi.vertical_adapt",
element: this,
items: [this.text]
});
},

254
src/base/single/label/label.js

@ -9,7 +9,6 @@ BI.Label = BI.inherit(BI.Single, {
baseCls: (conf.baseCls || "") + " bi-label",
textAlign: "center",
whiteSpace: "nowrap", // normal or nowrap
forceCenter: false, // 是否无论如何都要居中, 不考虑超出边界的情况, 在未知宽度和高度时有效
textWidth: null,
textHeight: null,
hgap: 0,
@ -56,29 +55,22 @@ BI.Label = BI.inherit(BI.Single, {
json.textAlign = "left";
if (BI.isNumber(o.width) && o.width > 0) {
if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
if (BI.isNumber(o.height) && o.height > 0) {
var gap = (o.width - o.textWidth) / 2;
json.maxWidth = o.textWidth;
if (BI.isNumber(o.height) && o.height > 0) { // 1.1
BI.createWidget({
type: "bi.adaptive",
type: "bi.center_adapt",
height: o.height,
scrollable: o.whiteSpace === "normal",
element: this,
items: [
{
el: (this.text = BI.createWidget(json)),
left: gap + o.hgap + o.lgap,
right: gap + o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
el: (this.text = BI.createWidget(json))
}
]
});
this.element.css({"line-height": o.height + "px"});
return;
}
json.width = o.textWidth;
json.textAlign = o.textAlign;
BI.createWidget({
BI.createWidget({ // 1.2
type: "bi.center_adapt",
scrollable: o.whiteSpace === "normal",
element: this,
@ -90,7 +82,7 @@ BI.Label = BI.inherit(BI.Single, {
});
return;
}
if (o.whiteSpace == "normal") {
if (o.whiteSpace == "normal") { // 1.3
BI.extend(json, {
hgap: o.hgap,
vgap: o.vgap,
@ -108,39 +100,42 @@ BI.Label = BI.inherit(BI.Single, {
});
return;
}
if (BI.isNumber(o.height) && o.height > 0) {
if (BI.isNumber(o.height) && o.height > 0) { // 1.4
this.element.css({
"line-height": o.height + "px"
});
json.textAlign = o.textAlign;
BI.createWidget({
type: "bi.absolute",
scrollable: o.whiteSpace === "normal",
this.text = BI.createWidget(BI.extend(json, {
element: this,
items: [{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
}]
});
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
}));
return;
}
json.width = o.width - 2 * o.hgap;
json.textAlign = o.textAlign;
BI.extend(json, { // 1.5
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
maxWidth: "100%"
});
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.center_adapt",
scrollable: o.whiteSpace === "normal",
element: this,
items: [{
el: (this.text = BI.createWidget(json))
}]
items: [this.text]
});
return;
}
if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
json.width = o.textWidth;
if (BI.isNumber(o.textWidth) && o.textWidth > 0) { // 1.6
json.maxWidth = o.textWidth;
BI.createWidget({
type: "bi.center_adapt",
scrollable: o.whiteSpace === "normal",
@ -153,7 +148,7 @@ BI.Label = BI.inherit(BI.Single, {
});
return;
}
if (o.whiteSpace == "normal") {
if (o.whiteSpace == "normal") { // 1.7
BI.extend(json, {
hgap: o.hgap,
vgap: o.vgap,
@ -165,54 +160,26 @@ BI.Label = BI.inherit(BI.Single, {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.center_adapt",
scrollable: o.whiteSpace === "normal",
scrollable: true,
element: this,
items: [this.text]
});
return;
}
if (BI.isNumber(o.height) && o.height > 0) {
if (BI.isNumber(o.textHeight) && o.textHeight > 0) {
this.element.css({
"line-height": o.height + "px"
});
json.textAlign = o.textAlign;
BI.createWidget({
type: "bi.adaptive",
height: o.height,
scrollable: o.whiteSpace === "normal",
element: this,
items: [{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
}]
});
return;
}
BI.extend(json, {
if (BI.isNumber(o.height) && o.height > 0) { // 1.8
this.element.css({
"line-height": o.height + "px"
});
json.textAlign = o.textAlign;
this.text = BI.createWidget(BI.extend(json, {
element: this,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
});
this.element.css({
"line-height": o.height + "px"
});
// 能走到这边,说明这个text不需要换行,并且不会做任何布局包装,那么这时候就该是什么align是什么align
json.textAlign = o.textAlign;
this.text = BI.createWidget(BI.extend(json, {
element: this
}));
BI.createWidget({
type: "bi.layout",
element: this.text,
scrollable: o.whiteSpace === "normal"
});
return;
}
BI.extend(json, {
@ -223,24 +190,14 @@ BI.Label = BI.inherit(BI.Single, {
tgap: o.tgap,
bgap: o.bgap
});
if (o.forceCenter) {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.center_adapt",
element: this,
items: [this.text]
});
return;
}
// 能走到这边,说明这个text不需要换行,并且不会做任何布局包装,那么这时候就该是什么align是什么align
json.textAlign = o.textAlign;
this.text = BI.createWidget(BI.extend(json, {
element: this
maxWidth: "100%"
}));
BI.createWidget({
type: "bi.layout",
element: this.text,
scrollable: o.whiteSpace === "normal"
type: "bi.center_adapt",
element: this,
items: [this.text]
});
},
@ -250,26 +207,21 @@ BI.Label = BI.inherit(BI.Single, {
if (BI.isNumber(o.width) && o.width > 0) {
if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
json.width = o.textWidth;
if (BI.isNumber(o.height) && o.height > 0) {
if (BI.isNumber(o.height) && o.height > 0) { // 2.1
BI.createWidget({
type: "bi.adaptive",
type: "bi.vertical_adapt",
height: o.height,
scrollable: o.whiteSpace === "normal",
element: this,
items: [
{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
el: (this.text = BI.createWidget(json))
}
]
});
this.element.css({"line-height": o.height + "px"});
return;
}
BI.createWidget({
BI.createWidget({ // 2.2
type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal",
hgap: o.hgap,
@ -285,46 +237,27 @@ BI.Label = BI.inherit(BI.Single, {
}
]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal",
if (BI.isNumber(o.height) && o.height > 0) { // 2.3
this.text = BI.createWidget(BI.extend(json, {
element: this,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
element: this,
items: [this.text]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (BI.isNumber(o.height) && o.height > 0) {
this.element.css({
"line-height": o.height + "px"
});
BI.createWidget({
type: "bi.absolute",
scrollable: o.whiteSpace === "normal",
element: this,
items: [{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
}]
});
bgap: o.bgap
}));
if (o.whiteSpace !== "normal") {
this.element.css({
"line-height": o.height - (o.vgap * 2) + "px"
});
}
return;
}
json.width = o.width - 2 * o.hgap - o.lgap - o.rgap;
BI.createWidget({
BI.createWidget({ // 2.4
type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal",
hgap: o.hgap,
@ -338,12 +271,11 @@ BI.Label = BI.inherit(BI.Single, {
el: (this.text = BI.createWidget(json))
}]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (BI.isNumber(o.textWidth) && o.textWidth > 0) {
json.width = o.textWidth;
BI.createWidget({
BI.createWidget({ // 2.5
type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal",
hgap: o.hgap,
@ -359,66 +291,23 @@ BI.Label = BI.inherit(BI.Single, {
}
]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (o.whiteSpace == "normal") {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.vertical_adapt",
scrollable: o.whiteSpace === "normal",
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap,
element: this,
items: [this.text]
});
// 父亲有line-height,而当前label是inline-block,那么他的行高一定是父亲的lineHeight,就算text上设置了line-height
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
if (BI.isNumber(o.height) && o.height > 0) {
if (BI.isNumber(o.textHeight) && o.textHeight > 0) {
if (o.whiteSpace !== "normal") {
this.element.css({
"line-height": o.height + "px"
"line-height": o.height - (o.vgap * 2) + "px"
});
BI.createWidget({
type: "bi.adaptive",
height: o.height,
scrollable: o.whiteSpace === "normal",
element: this,
items: [{
el: (this.text = BI.createWidget(json)),
left: o.hgap + o.lgap,
right: o.hgap + o.rgap,
top: o.vgap + o.tgap,
bottom: o.vgap + o.bgap
}]
});
return;
}
BI.extend(json, {
this.text = BI.createWidget(BI.extend(json, { // 2.6
element: this,
hgap: o.hgap,
vgap: o.vgap,
lgap: o.lgap,
rgap: o.rgap,
tgap: o.tgap,
bgap: o.bgap
});
this.element.css({
"line-height": o.height + "px"
});
this.text = BI.createWidget(BI.extend(json, {
element: this
}));
BI.createWidget({
type: "bi.layout",
element: this.text,
scrollable: o.whiteSpace === "normal"
});
return;
}
BI.extend(json, {
@ -429,23 +318,14 @@ BI.Label = BI.inherit(BI.Single, {
tgap: o.tgap,
bgap: o.bgap
});
if (o.forceCenter) {
this.text = BI.createWidget(json);
BI.createWidget({
type: "bi.vertical_adapt",
element: this,
items: [this.text]
});
o.textHeight && this.element.css({"line-height": o.textHeight + "px"});
return;
}
this.text = BI.createWidget(BI.extend(json, {
element: this
maxWidth: "100%"
}));
BI.createWidget({
type: "bi.layout",
element: this.text,
scrollable: o.whiteSpace === "normal"
type: "bi.vertical_adapt",
element: this,
items: [this.text]
});
},

34
src/base/single/text.js

@ -52,10 +52,14 @@ BI.Text = BI.inherit(BI.Single, {
if (BI.isNumber(o.lineHeight)) {
this.element.css({lineHeight: o.lineHeight + "px"});
}
if (BI.isWidthOrHeight(o.maxWidth)) {
this.element.css({maxWidth: o.maxWidth});
}
this.element.css({
textAlign: o.textAlign,
whiteSpace: o.whiteSpace,
textOverflow: o.whiteSpace === 'nowrap' ? "ellipsis" : "",
textOverflow: o.whiteSpace === "nowrap" ? "ellipsis" : "",
overflow: o.whiteSpace === "nowrap" ? "" : "auto"
});
if (o.handler) {
this.text = BI.createWidget({
@ -73,15 +77,7 @@ BI.Text = BI.inherit(BI.Single, {
} else {
this.text = this;
}
},
_getShowText: function () {
var o = this.options;
return BI.isFunction(o.text) ? o.text() : o.text;
},
mounted: function () {
var o = this.options;
var text = this._getShowText();
if (BI.isKey(text)) {
this.setText(text);
@ -96,6 +92,12 @@ BI.Text = BI.inherit(BI.Single, {
}
},
_getShowText: function () {
var o = this.options;
return BI.isFunction(o.text) ? o.text() : o.text;
},
doRedMark: function (keyword) {
var o = this.options;
// render之后做的doredmark,这个时候虽然标红了,但是之后text mounted执行的时候并没有keyword
@ -130,8 +132,18 @@ BI.Text = BI.inherit(BI.Single, {
setText: function (text) {
BI.Text.superclass.setText.apply(this, arguments);
this.options.text = text;
this.text.element.html(BI.htmlEncode(this._getShowText()));
// 为textContext赋值为undefined时在ie和edge下会真的显示undefined
this.options.text = BI.isNotNull(text) ? text : "";
if (BI.isIE9Below()) {
this.text.element.html(BI.htmlEncode(this._getShowText()));
return;
}
if (/\s/.test(text)) {
this.text.element[0].innerHTML = BI.htmlEncode(this._getShowText());
} else {
// textContent性能更好,并且原生防xss
this.text.element[0].textContent = this._getShowText();
}
}
});

4
src/case/editor/editor.clear.js

@ -101,6 +101,9 @@ BI.ClearEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self.fireEvent(BI.ClearEditor.EVENT_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self.fireEvent(BI.ClearEditor.EVENT_CHANGE_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.ClearEditor.EVENT_START);
});
@ -165,6 +168,7 @@ BI.ClearEditor.EVENT_START = "EVENT_START";
BI.ClearEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.ClearEditor.EVENT_STOP = "EVENT_STOP";
BI.ClearEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.ClearEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.ClearEditor.EVENT_VALID = "EVENT_VALID";
BI.ClearEditor.EVENT_ERROR = "EVENT_ERROR";
BI.ClearEditor.EVENT_ENTER = "EVENT_ENTER";

10
src/case/editor/editor.shelter.js

@ -99,6 +99,11 @@ BI.ShelterEditor = BI.inherit(BI.Widget, {
self._checkText();
self.fireEvent(BI.ShelterEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self._checkText();
self.fireEvent(BI.ShelterEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.ShelterEditor.EVENT_START, arguments);
});
@ -217,6 +222,10 @@ BI.ShelterEditor = BI.inherit(BI.Widget, {
return this.editor.getLastValidValue();
},
getLastChangedValue: function () {
return this.editor.getLastChangedValue();
},
setTextStyle: function (style) {
this.text.setStyle(style);
},
@ -251,6 +260,7 @@ BI.ShelterEditor.EVENT_START = "EVENT_START";
BI.ShelterEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.ShelterEditor.EVENT_STOP = "EVENT_STOP";
BI.ShelterEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.ShelterEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.ShelterEditor.EVENT_VALID = "EVENT_VALID";
BI.ShelterEditor.EVENT_ERROR = "EVENT_ERROR";
BI.ShelterEditor.EVENT_ENTER = "EVENT_ENTER";

10
src/case/editor/editor.sign.js

@ -101,6 +101,11 @@ BI.SignEditor = BI.inherit(BI.Widget, {
self._checkText();
self.fireEvent(BI.SignEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self._checkText();
self.fireEvent(BI.SignEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.SignEditor.EVENT_START, arguments);
});
@ -221,6 +226,10 @@ BI.SignEditor = BI.inherit(BI.Widget, {
return this.editor.getLastValidValue();
},
getLastChangedValue: function () {
return this.editor.getLastChangedValue();
},
setValue: function (k) {
this.editor.setValue(k);
this._checkText();
@ -250,6 +259,7 @@ BI.SignEditor.EVENT_START = "EVENT_START";
BI.SignEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.SignEditor.EVENT_STOP = "EVENT_STOP";
BI.SignEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.SignEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.SignEditor.EVENT_VALID = "EVENT_VALID";
BI.SignEditor.EVENT_ERROR = "EVENT_ERROR";
BI.SignEditor.EVENT_ENTER = "EVENT_ENTER";

9
src/case/editor/editor.state.js

@ -111,6 +111,10 @@ BI.StateEditor = BI.inherit(BI.Widget, {
self._showHint();
self.fireEvent(BI.StateEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self.fireEvent(BI.StateEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.StateEditor.EVENT_START, arguments);
});
@ -211,6 +215,10 @@ BI.StateEditor = BI.inherit(BI.Widget, {
return this.editor.getLastValidValue();
},
getLastChangedValue: function () {
return this.editor.getLastChangedValue();
},
setValue: function (k) {
this.editor.setValue(k);
},
@ -274,6 +282,7 @@ BI.StateEditor.EVENT_START = "EVENT_START";
BI.StateEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.StateEditor.EVENT_STOP = "EVENT_STOP";
BI.StateEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.StateEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.StateEditor.EVENT_VALID = "EVENT_VALID";
BI.StateEditor.EVENT_ERROR = "EVENT_ERROR";
BI.StateEditor.EVENT_ENTER = "EVENT_ENTER";

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

@ -99,6 +99,10 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
self._showHint();
self.fireEvent(BI.SimpleStateEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self.fireEvent(BI.SimpleStateEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.SimpleStateEditor.EVENT_START, arguments);
});
@ -197,6 +201,10 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
return this.editor.getLastValidValue();
},
getLastChangedValue: function () {
return this.editor.getLastChangedValue();
},
setValue: function (k) {
this.editor.setValue(k);
},
@ -248,6 +256,7 @@ BI.SimpleStateEditor.EVENT_START = "EVENT_START";
BI.SimpleStateEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.SimpleStateEditor.EVENT_STOP = "EVENT_STOP";
BI.SimpleStateEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.SimpleStateEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.SimpleStateEditor.EVENT_VALID = "EVENT_VALID";
BI.SimpleStateEditor.EVENT_ERROR = "EVENT_ERROR";
BI.SimpleStateEditor.EVENT_ENTER = "EVENT_ENTER";

21
src/core/alias.js

@ -411,21 +411,16 @@
};
// replace the html special tags
var SPECIAL_TAGS = {
"&": "&amp;",
"\"": "&quot;",
"<": "&lt;",
">": "&gt;",
" ": "&nbsp;"
};
BI.htmlEncode = function (text) {
return BI.isNull(text) ? "" : BI.replaceAll(text + "", "&|\"|<|>|\\s", function (v) {
switch (v) {
case "&":
return "&amp;";
case "\"":
return "&quot;";
case "<":
return "&lt;";
case ">":
return "&gt;";
case " ":
default:
return "&nbsp;";
}
return SPECIAL_TAGS[v] ? SPECIAL_TAGS[v] : "&nbsp;";
});
};
// html decode

4
src/core/func/date.js

@ -171,8 +171,8 @@ _.extend(BI, {
s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format)
s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format)
s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366)
s["%k"] = hr; // hour, range 0 to 23 (24h format)
s["%l"] = ir; // hour, range 1 to 12 (12h format)
s["%k"] = hr + ""; // hour, range 0 to 23 (24h format)
s["%l"] = ir + ""; // hour, range 1 to 12 (12h format)
s["%X"] = (m < 9) ? ("0" + (1 + m)) : (1 + m); // month, range 01 to 12
s["%x"] = m + 1; // month, range 1 to 12
s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59

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

@ -14,7 +14,7 @@
BI.extend(BI.DOM, {
patchProps: function (fromElement, toElement) {
var elemData = BI.Widget._renderEngine._data(fromElement[0]);
var elemData = jQuery._data(fromElement[0]);
var events = elemData.events;
BI.each(events, function (eventKey, event) {
BI.each(event, function (i, handler) {

39
src/core/wrapper/layout.js

@ -421,9 +421,22 @@ BI.Layout = BI.inherit(BI.Widget, {
oldEndVnode = oldCh[--oldEndIdx];
newStartVnode = newCh[++newStartIdx];
} else {
var node = addNode(newStartVnode);
insertBefore(node, oldStartVnode);
newStartVnode = newCh[++newStartIdx];
var sameOldVnode = findOldVnode(oldCh, newStartVnode, oldStartIdx, oldEndIdx);
if (BI.isNull(sameOldVnode)) { // 不存在就把新的放到左边
var node = addNode(newStartVnode);
insertBefore(node, oldStartVnode);
newStartVnode = newCh[++newStartIdx];
} else { // 如果新节点在就旧节点区间中存在就复用一下
BI.each(oldCh, function (index, child) {
if (child && sameVnode(child, newStartVnode)) {
updated = self.patchItem(sameOldVnode, newStartVnode, index) || updated;
children[sameOldVnode.key == null ? self._getChildName(index) : sameOldVnode.key] = self._children[self._getChildName(index)];
oldCh[index] = undefined;
insertBefore(sameOldVnode, oldStartVnode);
}
});
newStartVnode = newCh[++newStartIdx];
}
}
}
if (oldStartIdx > oldEndIdx) {
@ -467,9 +480,13 @@ BI.Layout = BI.inherit(BI.Widget, {
function removeVnodes (vnodes, startIdx, endIdx) {
for (; startIdx <= endIdx; ++startIdx) {
var node = self._getOptions(vnodes[startIdx]);
var key = node.key == null ? self._getChildName(startIdx) : node.key;
children[key]._destroy();
var ch = vnodes[startIdx];
if (BI.isNotNull(ch)) {
var node = self._getOptions(ch);
var key = node.key == null ? self._getChildName(startIdx) : node.key;
delete self._children[self._getChildName(key)];
children[key]._destroy();
}
}
}
@ -495,6 +512,16 @@ BI.Layout = BI.inherit(BI.Widget, {
}
}
function findOldVnode (vnodes, vNode, beginIdx, endIdx) {
var i, found;
for (i = beginIdx; i <= endIdx; ++i) {
if (vnodes[i] && sameVnode(vnodes[i], vNode)) {
found = vnodes[i];
}
}
return found;
}
return updated;
},

4
src/css/widget/timecombo/timecombo.css

@ -0,0 +1,4 @@
.bi-time-trigger .show-text {
background-color: rgba(255, 255, 255, 0);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00ffffff,endColorstr=#00ffffff);
}

8
src/less/widget/timecombo/timecombo.less

@ -0,0 +1,8 @@
@import "../../index";
.bi-time-trigger{
& .show-text {
// ie10一下无背景色会鼠标穿透
.background-color(@background-color-default, 0);
}
}

16
src/widget/datetime/datetime.combo.js

@ -6,15 +6,15 @@ BI.DateTimeCombo = BI.inherit(BI.Single, {
popupHeight: 290,
popupWidth: 270,
comboAdjustHeight: 1,
border: 1,
DATE_MIN_VALUE: "1900-01-01",
DATE_MAX_VALUE: "2099-12-31"
border: 1
},
_defaultConfig: function () {
return BI.extend(BI.DateTimeCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-date-time-combo bi-border bi-border-radius",
width: 200,
height: 24
height: 24,
minDate: "1900-01-01",
maxDate: "2099-12-31"
});
},
_init: function () {
@ -31,16 +31,16 @@ BI.DateTimeCombo = BI.inherit(BI.Single, {
};
this.trigger = BI.createWidget({
type: "bi.date_time_trigger",
min: this.constants.DATE_MIN_VALUE,
max: this.constants.DATE_MAX_VALUE,
min: opts.minDate,
max: opts.maxDate,
value: opts.value
});
this.popup = BI.createWidget({
type: "bi.date_time_popup",
behaviors: opts.behaviors,
min: this.constants.DATE_MIN_VALUE,
max: this.constants.DATE_MAX_VALUE,
min: opts.minDate,
max: opts.maxDate,
value: opts.value
});
self.setValue(this.storeValue);

2
src/widget/datetime/datetime.popup.js

@ -14,7 +14,6 @@ BI.DateTimePopup = BI.inherit(BI.Widget, {
var self = this, opts = this.options;
this.cancelButton = BI.createWidget({
type: "bi.text_button",
forceCenter: true,
cls: "multidate-popup-button bi-border-top bi-border-right",
shadow: true,
text: BI.i18nText("BI-Basic_Cancel")
@ -25,7 +24,6 @@ BI.DateTimePopup = BI.inherit(BI.Widget, {
this.okButton = BI.createWidget({
type: "bi.text_button",
forceCenter: true,
cls: "multidate-popup-button bi-border-top",
shadow: true,
text: BI.i18nText("BI-Basic_OK")

20
src/widget/dynamicdate/dynamicdate.combo.js

@ -3,14 +3,16 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
popupHeight: 259,
popupWidth: 270,
comboAdjustHeight: 1,
border: 1,
DATE_MIN_VALUE: "1900-01-01",
DATE_MAX_VALUE: "2099-12-31"
border: 1
},
props: {
baseCls: "bi-dynamic-date-combo bi-border bi-focus-shadow bi-border-radius",
height: 22
height: 22,
minDate: "1900-01-01",
maxDate: "2099-12-31",
format: "",
allowEdit: true
},
@ -46,8 +48,10 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
isNeedAdjustWidth: false,
el: {
type: "bi.dynamic_date_trigger",
min: this.constants.DATE_MIN_VALUE,
max: this.constants.DATE_MAX_VALUE,
min: opts.minDate,
max: opts.maxDate,
format: opts.format,
allowEdit: opts.allowEdit,
height: opts.height,
value: opts.value,
ref: function () {
@ -128,8 +132,8 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
el: {
type: "bi.dynamic_date_popup",
behaviors: opts.behaviors,
min: this.constants.DATE_MIN_VALUE,
max: this.constants.DATE_MAX_VALUE,
min: opts.minDate,
max: opts.maxDate,
value: opts.value,
ref: function () {
self.popup = this;

3
src/widget/dynamicdate/dynamicdate.popup.js

@ -24,7 +24,6 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
type: "bi.grid",
items: [[{
type: "bi.text_button",
forceCenter: true,
cls: "bi-high-light bi-split-top",
shadow: true,
text: BI.i18nText("BI-Basic_Clear"),
@ -37,7 +36,6 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
}]
}, {
type: "bi.text_button",
forceCenter: true,
cls: "bi-split-left bi-split-right bi-high-light bi-split-top",
shadow: true,
textHeight: c.buttonHeight - 1,
@ -53,7 +51,6 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
}]
}, {
type: "bi.text_button",
forceCenter: true,
cls: "bi-high-light bi-split-top",
textHeight: c.buttonHeight - 1,
shadow: true,

127
src/widget/dynamicdate/dynamicdate.trigger.js

@ -4,14 +4,17 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
vgap: 2,
yearLength: 4,
yearMonthLength: 6,
yearFullMonthLength: 7
yearFullMonthLength: 7,
compareFormat: "%Y-%X-%d"
},
props: {
extraCls: "bi-date-trigger",
min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期
height: 24
height: 24,
format: "", // 显示的日期格式化方式
allowEdit: true // 是否允许编辑
},
_init: function () {
@ -22,9 +25,10 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
type: "bi.sign_editor",
height: o.height,
validationChecker: function (v) {
var date = v.match(/\d+/g);
self._autoAppend(v, date);
return self._dateCheck(v) && BI.checkDateLegal(v) && self._checkVoid({
var formatStr = self._getStandardDateStr(v);
var date = formatStr.match(/\d+/g);
!BI.isKey(o.format) && self._autoAppend(v, date);
return self._dateCheck(formatStr) && BI.checkDateLegal(formatStr) && self._checkVoid({
year: date[0] | 0,
month: date[1] | 0,
day: date[2] | 0
@ -38,30 +42,13 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
allowBlank: true,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
errorText: function () {
if (self.editor.isEditing()) {
return BI.i18nText("BI-Date_Trigger_Error_Text");
var str = "";
if (!BI.isKey(o.format)) {
str = self.editor.isEditing() ? BI.i18nText("BI-Date_Trigger_Error_Text"): BI.i18nText("BI-Year_Trigger_Invalid_Text");
}
return BI.i18nText("BI-Year_Trigger_Invalid_Text");
return str;
},
title: function () {
var storeValue = self.storeValue || {};
var type = storeValue.type || BI.DynamicDateCombo.Static;
var value = storeValue.value;
switch (type) {
case BI.DynamicDateCombo.Dynamic:
var text = self._getText(value);
var date = BI.getDate();
date = BI.DynamicDateHelper.getCalculation(value);
var dateStr = BI.print(date, "%Y-%X-%d");
return BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr);
case BI.DynamicDateCombo.Static:
default:
if (BI.isNull(value) || BI.isNull(value.day)) {
return "";
}
return BI.print(BI.getDate(value.year, (value.month - 1), value.day), "%Y-%X-%d");
}
}
title: BI.bind(this._getTitle, this)
});
this.editor.on(BI.SignEditor.EVENT_KEY_DOWN, function () {
self.fireEvent(BI.DynamicDateTrigger.EVENT_KEY_DOWN);
@ -86,7 +73,8 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
}
if (BI.isNotEmptyString(value) && !BI.isEqual(self.storeTriggerValue, self.getKey())) {
var date = value.split("-");
var formatStr = self._getStandardDateStr(value);
var date = formatStr.match(/\d+/g);
self.storeValue = {
type: BI.DynamicDateCombo.Static,
value: {
@ -119,8 +107,81 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
width: 24
}]
});
!o.allowEdit && BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.text",
title: BI.bind(this._getTitle, this)
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
});
this.setValue(o.value);
},
_getTitle: function () {
var storeValue = this.storeValue || {};
var type = storeValue.type || BI.DynamicDateCombo.Static;
var value = storeValue.value;
switch (type) {
case BI.DynamicDateCombo.Dynamic:
var text = this._getText(value);
var date = BI.getDate();
date = BI.DynamicDateHelper.getCalculation(value);
var dateStr = BI.print(date, this._getFormatString());
return BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr);
case BI.DynamicDateCombo.Static:
default:
if (BI.isNull(value) || BI.isNull(value.day)) {
return "";
}
return BI.print(BI.getDate(value.year, (value.month - 1), value.day), this._getFormatString());
}
},
_getStandardDateStr: function (v) {
var c = this._const;
var result = [0, 1, 2];
var formatArray = this._getFormatString().match(/%./g);
BI.each(formatArray, function (idx, v) {
switch (v) {
case "%Y":
case "%y":
result[0] = idx;
break;
case "%X":
case "%x":
result[1] = idx;
break;
case "%d":
case "%e":
default:
result[2] = idx;
break;
}
});
var dateArray = v.match(/\d+/g);
var newArray = [];
BI.each(dateArray, function (idx) {
newArray[idx] = dateArray[result[idx]];
});
// 这边之所以不直接返回join结果是因为年的格式可能只有2位,所以需要format一下
if(newArray.length === result.length && newArray[0].length === 2) {
return BI.print(BI.parseDateTime(newArray.join("-"), c.compareFormat), c.compareFormat);
}
// 这边format成-20-也没关系, 反正都是不合法的
return newArray.join("-");
},
_getFormatString: function () {
return this.options.format || this._const.compareFormat;
},
_dateCheck: function (date) {
return BI.print(BI.parseDateTime(date, "%Y-%x-%d"), "%Y-%x-%d") === date ||
BI.print(BI.parseDateTime(date, "%Y-%X-%d"), "%Y-%X-%d") === date ||
@ -150,19 +211,19 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
},
_yearCheck: function (v) {
var date = BI.print(BI.parseDateTime(v, "%Y-%X-%d"), "%Y-%X-%d");
var date = BI.print(BI.parseDateTime(v, this._getFormatString()), this._const.compareFormat);
return BI.print(BI.parseDateTime(v, "%Y"), "%Y") === v && date >= this.options.min && date <= this.options.max;
},
_monthCheck: function (v) {
var date = BI.parseDateTime(v, "%Y-%X-%d");
var dateStr = BI.print(date, "%Y-%X-%d");
var date = BI.parseDateTime(v, this._getFormatString());
var dateStr = BI.print(date, this._const.compareFormat);
return (date.getMonth() >= 0 && (BI.print(BI.parseDateTime(v, "%Y-%X"), "%Y-%X") === v ||
BI.print(BI.parseDateTime(v, "%Y-%x"), "%Y-%x") === v)) && dateStr >= this.options.min && dateStr <= this.options.max;
},
_setInnerValue: function (date) {
var dateStr = BI.print(date, "%Y-%X-%d");
var dateStr = BI.print(date, this._getFormatString());
this.editor.setState(dateStr);
this.editor.setValue(dateStr);
},
@ -238,7 +299,7 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
this.editor.setState("");
this.editor.setValue("");
} else {
var dateStr = BI.print(BI.getDate(value.year, (value.month - 1), value.day), "%Y-%X-%d");
var dateStr = BI.print(BI.getDate(value.year, (value.month - 1), value.day), this._getFormatString());
this.editor.setState(dateStr);
this.editor.setValue(dateStr);
}

20
src/widget/dynamicdatetime/dynamicdatetime.combo.js

@ -3,14 +3,16 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
popupHeight: 259,
popupWidth: 270,
comboAdjustHeight: 1,
border: 1,
DATE_MIN_VALUE: "1900-01-01",
DATE_MAX_VALUE: "2099-12-31"
border: 1
},
props: {
baseCls: "bi-dynamic-date-combo bi-border bi-focus-shadow",
height: 22
height: 22,
minDate: "1900-01-01",
maxDate: "2099-12-31",
format: "",
allowEdit: true
},
@ -46,8 +48,10 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
isNeedAdjustWidth: false,
el: {
type: "bi.dynamic_date_time_trigger",
min: this.constants.DATE_MIN_VALUE,
max: this.constants.DATE_MAX_VALUE,
min: opts.minDate,
max: opts.maxDate,
allowEdit: opts.allowEdit,
format: opts.format,
height: opts.height,
value: opts.value,
ref: function () {
@ -128,8 +132,8 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
el: {
type: "bi.dynamic_date_time_popup",
behaviors: opts.behaviors,
min: this.constants.DATE_MIN_VALUE,
max: this.constants.DATE_MAX_VALUE,
min: opts.minDate,
max: opts.maxDate,
value: opts.value,
ref: function () {
self.popup = this;

3
src/widget/dynamicdatetime/dynamicdatetime.popup.js

@ -24,7 +24,6 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
type: "bi.grid",
items: [[{
type: "bi.text_button",
forceCenter: true,
cls: "bi-high-light bi-split-top",
textHeight: c.buttonHeight - 1,
shadow: true,
@ -37,7 +36,6 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
}]
}, {
type: "bi.text_button",
forceCenter: true,
cls: "bi-split-left bi-split-right bi-high-light bi-split-top",
textHeight: c.buttonHeight - 1,
shadow: true,
@ -53,7 +51,6 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, {
}]
}, {
type: "bi.text_button",
forceCenter: true,
cls: "bi-high-light bi-split-top",
textHeight: c.buttonHeight - 1,
shadow: true,

134
src/widget/dynamicdatetime/dynamicdatetime.trigger.js

@ -4,14 +4,17 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
vgap: 2,
yearLength: 4,
yearMonthLength: 6,
yearFullMonthLength: 7
yearFullMonthLength: 7,
compareFormat: "%Y-%X-%d %H:%M:%S"
},
props: {
extraCls: "bi-date-time-trigger",
min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期
height: 24
height: 24,
format: "", // 显示的日期格式化方式
allowEdit: true // 是否允许编辑
},
_init: function () {
@ -22,9 +25,10 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
type: "bi.sign_editor",
height: o.height,
validationChecker: function (v) {
var date = v.match(/\d+/g);
self._autoAppend(v, date);
return self._dateCheck(v) && BI.checkDateLegal(v) && self._checkVoid({
var formatStr = self._getStandardDateStr(v);
var date = formatStr.match(/\d+/g);
!BI.isKey(o.format) && self._autoAppend(v, date);
return self._dateCheck(formatStr) && BI.checkDateLegal(formatStr) && self._checkVoid({
year: date[0] | 0,
month: date[1] | 0,
day: date[2] | 0
@ -38,30 +42,13 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
allowBlank: true,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
errorText: function () {
if (self.editor.isEditing()) {
return BI.i18nText("BI-Basic_Date_Time_Error_Text");
var str = "";
if (!BI.isKey(o.format)) {
str = self.editor.isEditing() ? BI.i18nText("BI-Basic_Date_Time_Error_Text") : BI.i18nText("BI-Year_Trigger_Invalid_Text");
}
return BI.i18nText("BI-Year_Trigger_Invalid_Text");
return str;
},
title: function () {
var storeValue = self.storeValue || {};
var type = storeValue.type || BI.DynamicDateCombo.Static;
var value = storeValue.value;
switch (type) {
case BI.DynamicDateCombo.Dynamic:
var text = self._getText(value);
var date = BI.DynamicDateHelper.getCalculation(value);
var dateStr = BI.print(date, "%Y-%x-%e %H:%M:%S");
return BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr);
case BI.DynamicDateCombo.Static:
default:
if (BI.isNull(value) || BI.isNull(value.day)) {
return "";
}
return BI.print(BI.getDate(value.year, (value.month - 1), value.day, value.hour || 0, value.minute || 0,
value.second || 0), "%Y-%X-%d %H:%M:%S");
}
}
title: BI.bind(this._getTitle, this)
});
this.editor.on(BI.SignEditor.EVENT_KEY_DOWN, function () {
self.fireEvent(BI.DynamicDateTimeTrigger.EVENT_KEY_DOWN);
@ -86,7 +73,8 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
}
if (BI.isNotEmptyString(value) && !BI.isEqual(self.storeTriggerValue, self.getKey())) {
var date = value.split(/-|\s|:/);
var formatStr = self._getStandardDateStr(value);
var date = formatStr.match(/\d+/g);
self.storeValue = {
type: BI.DynamicDateCombo.Static,
value: {
@ -117,8 +105,94 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
width: 24
}]
});
!o.allowEdit && BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.text",
title: BI.bind(this._getTitle, this)
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
});
this.setValue(o.value);
},
_getTitle: function () {
var storeValue = this.storeValue || {};
var type = storeValue.type || BI.DynamicDateCombo.Static;
var value = storeValue.value;
switch (type) {
case BI.DynamicDateCombo.Dynamic:
var text = this._getText(value);
var date = BI.DynamicDateHelper.getCalculation(value);
var dateStr = BI.print(date, this._getFormatString());
return BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr);
case BI.DynamicDateCombo.Static:
default:
if (BI.isNull(value) || BI.isNull(value.day)) {
return "";
}
return BI.print(BI.getDate(value.year, (value.month - 1), value.day, value.hour || 0, value.minute || 0,
value.second || 0), this._getFormatString());
}
},
_getStandardDateStr: function (v) {
var result = [];
var hasSecond = false;
var formatArray = this._getFormatString().match(/%./g);
BI.each(formatArray, function (idx, v) {
switch (v) {
case "%Y":
case "%y":
result[0] = idx;
break;
case "%X":
case "%x":
result[1] = idx;
break;
case "%d":
case "%e":
result[2] = idx;
break;
case "%S":
hasSecond = true;
break;
default:
break;
}
});
var dateArray = v.match(/\d+/g);
var newArray = [];
// 处理乱序的年月日
BI.each(dateArray.slice(0, 3), function (idx) {
newArray[idx] = dateArray[result[idx]];
});
// 拼接时分秒和pm
var suffixArray = dateArray.slice(3);
// hh:mm
if(suffixArray.length === 2 && !hasSecond) {
suffixArray.push("00");
}
var suffixString = suffixArray.join(":");
var dateString = newArray.slice(0, 3).join("-");
if (BI.isNotEmptyString(suffixString)) {
dateString += " " + suffixString;
}
return dateString;
},
_getFormatString: function () {
return this.options.format || this._const.compareFormat;
},
_dateCheck: function (date) {
return BI.print(BI.parseDateTime(date, "%Y-%x-%d %H:%M:%S"), "%Y-%x-%d %H:%M:%S") === date ||
BI.print(BI.parseDateTime(date, "%Y-%X-%d %H:%M:%S"), "%Y-%X-%d %H:%M:%S") === date ||
@ -165,7 +239,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
},
_setInnerValue: function (date) {
var dateStr = BI.print(date, "%Y-%X-%e %H:%M:%S");
var dateStr = BI.print(date, this._getFormatString());
this.editor.setState(dateStr);
this.editor.setValue(dateStr);
},
@ -242,7 +316,7 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
this.editor.setValue("");
} else {
var dateStr = BI.print(BI.getDate(value.year, (value.month - 1), value.day, value.hour || 0, value.minute || 0,
value.second || 0), "%Y-%X-%d %H:%M:%S");
value.second || 0), this._getFormatString());
this.editor.setState(dateStr);
this.editor.setValue(dateStr);
}

10
src/widget/editor/editor.search.js

@ -109,6 +109,9 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self.fireEvent(BI.SearchEditor.EVENT_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self.fireEvent(BI.SearchEditor.EVENT_CHANGE_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_START, function () {
self.fireEvent(BI.SearchEditor.EVENT_START);
});
@ -146,7 +149,7 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
},
getKeywords: function () {
var val = this.editor.getLastValidValue();
var val = this.editor.getLastChangedValue();
var keywords = val.match(/[\S]+/g);
if (BI.isEndWithBlank(val)) {
return keywords.concat([" "]);
@ -158,6 +161,10 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
return this.editor.getLastValidValue();
},
getLastChangedValue: function () {
return this.editor.getLastChangedValue();
},
setValue: function (v) {
this.editor.setValue(v);
if (BI.isKey(v)) {
@ -186,6 +193,7 @@ BI.SearchEditor.EVENT_START = "EVENT_START";
BI.SearchEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.SearchEditor.EVENT_STOP = "EVENT_STOP";
BI.SearchEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.SearchEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.SearchEditor.EVENT_VALID = "EVENT_VALID";
BI.SearchEditor.EVENT_ERROR = "EVENT_ERROR";
BI.SearchEditor.EVENT_ENTER = "EVENT_ENTER";

4
src/widget/editor/editor.text.js

@ -83,6 +83,9 @@ BI.TextEditor = BI.inherit(BI.Widget, {
this.editor.on(BI.Editor.EVENT_CONFIRM, function () {
self.fireEvent(BI.TextEditor.EVENT_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self.fireEvent(BI.TextEditor.EVENT_CHANGE_CONFIRM);
});
this.editor.on(BI.Editor.EVENT_REMOVE, function (v) {
self.fireEvent(BI.TextEditor.EVENT_REMOVE);
});
@ -155,6 +158,7 @@ BI.TextEditor.EVENT_START = "EVENT_START";
BI.TextEditor.EVENT_PAUSE = "EVENT_PAUSE";
BI.TextEditor.EVENT_STOP = "EVENT_STOP";
BI.TextEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.TextEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.TextEditor.EVENT_VALID = "EVENT_VALID";
BI.TextEditor.EVENT_ERROR = "EVENT_ERROR";
BI.TextEditor.EVENT_ENTER = "EVENT_ENTER";

4
src/widget/multiselect/multiselect.insert.combo.js

@ -13,7 +13,8 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
height: 24,
attributes: {
tabIndex: 0
}
},
allowEdit: true
});
},
@ -32,6 +33,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({
type: "bi.multi_select_insert_trigger",
allowEdit: o.allowEdit,
height: o.height,
text: o.text,
// adapter: this.popup,

17
src/widget/multiselect/multiselect.insert.trigger.js

@ -22,7 +22,8 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
switcher: {},
adapter: null,
masker: {}
masker: {},
allowEdit: true
});
},
@ -102,6 +103,20 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
}]
});
!o.allowEdit && BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
wrapper.attr("items")[1].width = (b === true ? self.numberCounter.element.outerWidth() + 8 : 0);

17
src/widget/multiselect/multiselect.trigger.js

@ -22,7 +22,8 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
switcher: {},
adapter: null,
masker: {}
masker: {},
allowEdit: true
});
},
@ -99,6 +100,20 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
}]
});
!o.allowEdit && BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.layout"
},
left: 0,
right: 24,
top: 0,
bottom: 0
}]
});
this.numberCounter.on(BI.Events.VIEW, function (b) {
BI.nextTick(function () {// 自动调整宽度
wrapper.attr("items")[1].width = (b === true ? self.numberCounter.element.outerWidth() + 8 : 0);

2
src/widget/multiselect/trigger/editor.multiselect.js

@ -70,7 +70,7 @@ BI.MultiSelectEditor = BI.inherit(BI.Widget, {
},
getKeywords: function () {
var val = this.editor.getLastValidValue();
var val = this.editor.getLastChangedValue();
var keywords = val.match(/[\S]+/g);
if (BI.isEndWithBlank(val)) {
return keywords.concat([" "]);

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

@ -20,7 +20,8 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
baseCls: "bi-multi-tree-insert-combo",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24
height: 24,
allowEdit: true
});
},
@ -36,6 +37,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
allowEdit: o.allowEdit,
height: o.height,
valueFormatter: o.valueFormatter,
// adapter: this.popup,

4
src/widget/multitree/multi.tree.list.combo.js

@ -20,7 +20,8 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
baseCls: "bi-multi-tree-list-combo",
itemsCreator: BI.emptyFn,
valueFormatter: BI.emptyFn,
height: 24
height: 24,
allowEdit: true
});
},
@ -36,6 +37,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
this.trigger = BI.createWidget({
type: "bi.multi_select_trigger",
allowEdit: o.allowEdit,
height: o.height,
valueFormatter: o.valueFormatter,
// adapter: this.popup,

12
src/widget/numberinterval/numberinterval.js

@ -307,7 +307,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
_setFocusEvent: function (w) {
var self = this, c = this.constants;
w.on(BI.Editor.EVENT_FOCUS, function () {
w.on(BI.NumberIntervalSingleEidtor.EVENT_FOCUS, function () {
self._setTitle("");
switch (self._checkValidation()) {
case c.typeError:
@ -336,7 +336,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
},
_setBlurEvent: function (w) {
var c = this.constants, self = this;
w.on(BI.Editor.EVENT_BLUR, function () {
w.on(BI.NumberIntervalSingleEidtor.EVENT_BLUR, function () {
BI.Bubbles.hide(c.typeError);
BI.Bubbles.hide(c.numberError);
BI.Bubbles.hide(c.signalError);
@ -358,7 +358,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
_setErrorEvent: function (w) {
var c = this.constants, self = this;
w.on(BI.Editor.EVENT_ERROR, function () {
w.on(BI.NumberIntervalSingleEidtor.EVENT_ERROR, function () {
self._checkValidation();
BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, {
offsetStyle: "left",
@ -371,7 +371,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
_setValidEvent: function (w) {
var self = this, c = this.constants;
w.on(BI.Editor.EVENT_VALID, function () {
w.on(BI.NumberIntervalSingleEidtor.EVENT_VALID, function () {
switch (self._checkValidation()) {
case c.numberError:
BI.Bubbles.show(c.numberError, BI.i18nText("BI-Numerical_Interval_Number_Value"), self, {
@ -396,7 +396,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
_setEditorValueChangedEvent: function (w) {
var self = this, c = this.constants;
w.on(BI.Editor.EVENT_CHANGE, function () {
w.on(BI.NumberIntervalSingleEidtor.EVENT_CHANGE, function () {
switch (self._checkValidation()) {
case c.typeError:
BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, {
@ -421,7 +421,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
}
self.fireEvent(BI.NumberInterval.EVENT_CHANGE);
});
w.on(BI.Editor.EVENT_CONFIRM, function () {
w.on(BI.NumberIntervalSingleEidtor.EVENT_CONFIRM, function () {
self.fireEvent(BI.NumberInterval.EVENT_CONFIRM);
});
},

24
src/widget/numberinterval/singleeditor/single.editor.js

@ -25,32 +25,37 @@ BI.NumberIntervalSingleEidtor = BI.inherit(BI.Single, {
listeners: [{
eventName: BI.Editor.EVENT_ERROR,
action: function () {
self.fireEvent(BI.Editor.EVENT_ERROR, arguments);
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_ERROR, arguments);
}
}, {
eventName: BI.Editor.EVENT_FOCUS,
action: function () {
self.fireEvent(BI.Editor.EVENT_FOCUS, arguments);
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_FOCUS, arguments);
}
}, {
eventName: BI.Editor.EVENT_BLUR,
action: function () {
self.fireEvent(BI.Editor.EVENT_BLUR, arguments);
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_BLUR, arguments);
}
}, {
eventName: BI.Editor.EVENT_VALID,
action: function () {
self.fireEvent(BI.Editor.EVENT_VALID, arguments);
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_VALID, arguments);
}
}, {
eventName: BI.Editor.EVENT_CHANGE,
action: function () {
self.fireEvent(BI.Editor.EVENT_CHANGE, arguments);
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_CHANGE, arguments);
}
}, {
eventName: BI.Editor.EVENT_CONFIRM,
action: function () {
self.fireEvent(BI.Editor.EVENT_CONFIRM, arguments);
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_CONFIRM, arguments);
}
}, {
eventName: BI.Editor.EVENT_CHANGE_CONFIRM,
action: function () {
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_CHANGE_CONFIRM, arguments);
}
}]
}]
@ -74,4 +79,11 @@ BI.NumberIntervalSingleEidtor = BI.inherit(BI.Single, {
}
});
BI.NumberIntervalSingleEidtor.EVENT_FOCUS = "EVENT_FOCUS";
BI.NumberIntervalSingleEidtor.EVENT_BLUR = "EVENT_BLUR";
BI.NumberIntervalSingleEidtor.EVENT_ERROR = "EVENT_ERROR";
BI.NumberIntervalSingleEidtor.EVENT_VALID = "EVENT_VALID";
BI.NumberIntervalSingleEidtor.EVENT_CHANGE = "EVENT_CHANGE";
BI.NumberIntervalSingleEidtor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.NumberIntervalSingleEidtor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.number_interval_single_editor", BI.NumberIntervalSingleEidtor);

2
src/widget/singleselect/trigger/editor.singleselect.js

@ -64,7 +64,7 @@ BI.SingleSelectEditor = BI.inherit(BI.Widget, {
},
getKeywords: function () {
var val = this.editor.getLastValidValue();
var val = this.editor.getLastChangedValue();
var keywords = val.match(/[\S]+/g);
if (BI.isEndWithBlank(val)) {
return keywords.concat([" "]);

10
src/widget/singleslider/button/editor.sign.text.js

@ -63,6 +63,11 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
self._checkText();
self.fireEvent(BI.SignTextEditor.EVENT_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () {
self._showHint();
self._checkText();
self.fireEvent(BI.SignTextEditor.EVENT_CHANGE_CONFIRM, arguments);
});
this.editor.on(BI.Editor.EVENT_ERROR, function () {
self._checkText();
});
@ -162,6 +167,10 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
return this.editor.getLastValidValue();
},
getLastChangedValue: function () {
return this.editor.getLastChangedValue();
},
setValue: function (v) {
this.editor.setValue(v);
this._checkText();
@ -183,6 +192,7 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
}
});
BI.SignTextEditor.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.SignTextEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM";
BI.SignTextEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL";
BI.shortcut("bi.sign_text_editor", BI.SignTextEditor);

3
src/widget/time/datetime.popup.js

@ -28,7 +28,6 @@
type: "bi.grid",
items: [[{
type: "bi.text_button",
forceCenter: true,
cls: "bi-high-light bi-split-top",
shadow: true,
text: BI.i18nText("BI-Basic_Clears"),
@ -40,7 +39,6 @@
}]
}, {
type: "bi.text_button",
forceCenter: true,
cls: "bi-split-left bi-split-right bi-high-light bi-split-top",
shadow: true,
text: BI.i18nText("BI-Basic_Now"),
@ -52,7 +50,6 @@
}]
}, {
type: "bi.text_button",
forceCenter: true,
cls: "bi-high-light bi-split-top",
shadow: true,
text: BI.i18nText("BI-Basic_OK"),

74
src/widget/time/time.combo.js

@ -15,12 +15,14 @@
props: {
baseCls: "bi-time-combo bi-border bi-border-radius",
width: 78,
height: 22
height: 22,
format: "",
allowEdit: false
},
render: function () {
var self = this, opts = this.options;
this.storeTriggerValue = "";
this.storeValue = opts.value;
var popup = {
@ -63,10 +65,74 @@
isNeedAdjustWidth: false,
el: {
type: "bi.time_trigger",
allowEdit: opts.allowEdit,
format: opts.format,
value: opts.value,
ref: function (_ref) {
self.trigger = _ref;
}
},
listeners: [{
eventName: "EVENT_KEY_DOWN",
action: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
}
}
}, {
eventName: "EVENT_STOP",
action: function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
}
}, {
eventName: "EVENT_FOCUS",
action: function () {
self.storeTriggerValue = self.trigger.getKey();
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
self.fireEvent("EVENT_FOCUS");
}
}, {
eventName: "EVENT_ERROR",
action: function () {
var date = BI.getDate();
self.storeValue = {
hour: date.getHours(),
minute: date.getMinutes(),
second: date.getSeconds()
};
self.fireEvent("EVENT_ERROR");
}
}, {
eventName: "EVENT_VALID",
action: function () {
self.fireEvent("EVENT_VALID");
}
}, {
eventName: "EVENT_CHANGE",
action: function () {
self.fireEvent("EVENT_CHANGE");
}
}, {
eventName: "EVENT_CONFIRM",
action: function () {
if (self.combo.isViewVisible()) {
return;
}
var dateStore = self.storeTriggerValue;
var dateObj = self.trigger.getKey();
if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) {
self.storeValue = self.trigger.getValue();
self.setValue(self.trigger.getValue());
} else if (BI.isEmptyString(dateObj)) {
self.storeValue = null;
self.trigger.setValue();
}
self.fireEvent("EVENT_CONFIRM");
}
}]
},
adjustLength: this.constants.comboAdjustHeight,
popup: {
@ -90,7 +156,7 @@
},
top: 0,
left: 0,
right: 0,
right: 22,
bottom: 0
}, {
el: {

157
src/widget/time/time.trigger.js

@ -1,41 +1,164 @@
!(function () {
BI.TimeTrigger = BI.inherit(BI.Trigger, {
_const: {
COMPARE_FORMAT: "%H:%M:%S",
COMPLETE_COMPARE_FORMAT: "%Y-%M-%d %H:%M:%S",
FORMAT_ARRAY: [
"%H:%M:%S", // HH:mm:ss
"%I:%M:%S", // hh:mm:ss
"%l:%M:%S", // h:mm:ss
"%k:%M:%S", // H:mm:ss
"%l:%M:%S %p", // h:mm:ss a
"%l:%M:%S %P", // h:mm:ss a
"%l:%M", // h:mm
"%k:%M", // H:mm
"%I:%M", // hh:mm
"%H:%M", // HH:mm
"%M:%S" // mm:ss
],
DEFAULT_DATE_STRING: "2000-01-01"
},
props: {
extraCls: "bi-time-trigger",
height: 22,
width: 80,
value: {}
value: {},
format: "",
allowEdit: false
},
render: function () {
var self = this, o = this.options;
this.storeTriggerValue = "";
this.storeValue = o.value;
return {
type: "bi.htape",
type: "bi.absolute",
items: [{
el: {
type: "bi.label",
title: function () {
return self.text.getText();
},
textAlign: "left",
type: "bi.sign_editor",
height: o.height,
width: o.width,
text: this._formatValue(o.value),
validationChecker: function (v) {
return self._dateCheck(v);
},
quitChecker: function () {
return false;
},
ref: function (_ref) {
self.text = _ref;
}
self.editor = _ref;
},
value: this._formatValue(o.value),
hgap: 4,
allowBlank: true,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
title: BI.bind(this._getTitle, this),
listeners: [{
eventName: "EVENT_KEY_DOWN",
action: function () {
self.fireEvent("EVENT_KEY_DOWN");
}
}, {
eventName: "EVENT_FOCUS",
action: function () {
self.storeTriggerValue = self.getKey();
self.fireEvent("EVENT_FOCUS");
}
}, {
eventName: "EVENT_STOP",
action: function () {
self.fireEvent("EVENT_STOP");
}
}, {
eventName: "EVENT_VALID",
action: function () {
self.fireEvent("EVENT_VALID");
}
}, {
eventName: "EVENT_ERROR",
action: function () {
self.fireEvent("EVENT_ERROR");
}
}, {
eventName: "EVENT_CONFIRM",
action: function () {
var value = self.editor.getValue();
if (BI.isNotNull(value)) {
self.editor.setState(value);
}
if (BI.isNotEmptyString(value) && !BI.isEqual(self.storeTriggerValue, self.getKey())) {
var date = value.match(/\d+/g);
self.storeValue = {
hour: date[0] | 0,
minute: date[1] | 0,
second: date[2] | 0
};
}
self.fireEvent("EVENT_CONFIRM");
}
}, {
eventName: "EVENT_START",
action: function () {
self.fireEvent("EVENT_START");
}
}, {
eventName: "EVENT_CHANGE",
action: function () {
self.fireEvent("EVENT_CHANGE");
}
}]
},
hgap: 4
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: {
type: "bi.text",
invisible: o.allowEdit,
cls: "show-text",
title: BI.bind(this._getTitle, this),
hgap: 4
},
left: 0,
right: 0,
top: 0,
bottom: 0
}]
};
},
setValue: function (v) {
this.text.setText(this._formatValue(v));
_dateCheck: function (date) {
var c = this._const;
return BI.any(c.FORMAT_ARRAY, function (idx, format) {
return BI.print(BI.parseDateTime(c.DEFAULT_DATE_STRING + " " + date, c.COMPLETE_COMPARE_FORMAT), format) === date;
});
},
_getTitle: function () {
var storeValue = this.storeValue || {};
var date = BI.getDate();
return BI.print(BI.getDate(date.getFullYear(), 0, 1, storeValue.hour, storeValue.minute, storeValue.second), this._getFormatString());
},
_getFormatString: function () {
return this.options.format || this._const.COMPARE_FORMAT;
},
_formatValue: function (v) {
var now = BI.getDate();
return BI.isNotEmptyObject(v) ? BI.print(BI.getDate(now.getFullYear(), now.getMonth(), now.getDay(), v.hour, v.minute, v.second), "%H:%M:%S") : BI.i18nText("BI-Basic_Unrestricted");
return BI.isNotEmptyObject(v) ? BI.print(BI.getDate(now.getFullYear(), now.getMonth(), now.getDay(), v.hour, v.minute, v.second), this._getFormatString()) : BI.i18nText("BI-Basic_Unrestricted");
},
getKey: function () {
return this.editor.getValue();
},
setValue: function (v) {
this.storeValue = v;
this.editor.setValue(this._formatValue(v));
},
getValue: function () {
return this.storeValue;
}
});

11
src/widget/timeinterval/dateinterval.js

@ -7,14 +7,14 @@ BI.DateInterval = BI.inherit(BI.Single, {
width: 24,
lgap: 15,
offset: 0,
timeErrorCls: "time-error",
DATE_MIN_VALUE: "1900-01-01",
DATE_MAX_VALUE: "2099-12-31"
timeErrorCls: "time-error"
},
_defaultConfig: function () {
var conf = BI.DateInterval.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
extraCls: "bi-date-interval"
extraCls: "bi-date-interval",
minDate: "1900-01-01",
maxDate: "2099-12-31"
});
},
_init: function () {
@ -136,7 +136,8 @@ BI.DateInterval = BI.inherit(BI.Single, {
BI.print(BI.parseDateTime(date, "%Y-%X-%e"), "%Y-%X-%e") === date;
},
_checkVoid: function (obj) {
return !BI.checkDateVoid(obj.year, obj.month, obj.day, this.constants.DATE_MIN_VALUE, this.constants.DATE_MAX_VALUE)[0];
var o = this.options;
return !BI.checkDateVoid(obj.year, obj.month, obj.day, o.minDate, o.maxDate)[0];
},
_check: function (smallDate, bigDate) {
var smallObj = smallDate.match(/\d+/g), bigObj = bigDate.match(/\d+/g);

11
src/widget/timeinterval/timeinterval.js

@ -7,14 +7,14 @@ BI.TimeInterval = BI.inherit(BI.Single, {
width: 24,
lgap: 15,
offset: 0,
timeErrorCls: "time-error",
DATE_MIN_VALUE: "1900-01-01",
DATE_MAX_VALUE: "2099-12-31"
timeErrorCls: "time-error"
},
_defaultConfig: function () {
var conf = BI.TimeInterval.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, {
extraCls: "bi-time-interval"
extraCls: "bi-time-interval",
minDate: "1900-01-01",
maxDate: "2099-12-31"
});
},
_init: function () {
@ -136,7 +136,8 @@ BI.TimeInterval = BI.inherit(BI.Single, {
BI.print(BI.parseDateTime(date, "%Y-%X-%e %H:%M:%S"), "%Y-%X-%e %H:%M:%S") === date;
},
_checkVoid: function (obj) {
return !BI.checkDateVoid(obj.year, obj.month, obj.day, this.constants.DATE_MIN_VALUE, this.constants.DATE_MAX_VALUE)[0];
var o = this.options;
return !BI.checkDateVoid(obj.year, obj.month, obj.day, o.minDate, o.maxDate)[0];
},
_check: function (smallDate, bigDate) {
var smallObj = smallDate.match(/\d+/g), bigObj = bigDate.match(/\d+/g);

3
src/widget/year/popup.year.js

@ -32,7 +32,6 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, {
type: "bi.grid",
items: [[{
type: "bi.text_button",
forceCenter: true,
cls: "bi-split-top bi-high-light",
textHeight: c.buttonHeight - 1,
shadow: true,
@ -45,7 +44,6 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, {
}]
}, {
type: "bi.text_button",
forceCenter: true,
textHeight: c.buttonHeight - 1,
cls: "bi-split-left bi-split-right bi-high-light bi-split-top",
shadow: true,
@ -61,7 +59,6 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, {
}]
}, {
type: "bi.text_button",
forceCenter: true,
cls: "bi-split-top bi-high-light",
textHeight: c.buttonHeight - 1,
shadow: true,

3
src/widget/yearmonth/popup.yearmonth.js

@ -32,7 +32,6 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, {
type: "bi.grid",
items: [[{
type: "bi.text_button",
forceCenter: true,
cls: "bi-split-top bi-high-light",
textHeight: c.buttonHeight - 1,
shadow: true,
@ -45,7 +44,6 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, {
}]
}, {
type: "bi.text_button",
forceCenter: true,
cls: "bi-split-left bi-split-right bi-high-light bi-split-top",
textHeight: c.buttonHeight - 1,
shadow: true,
@ -61,7 +59,6 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, {
}]
}, {
type: "bi.text_button",
forceCenter: true,
cls: "bi-split-top bi-high-light",
textHeight: c.buttonHeight - 1,
shadow: true,

11
src/widget/yearmonthinterval/yearmonthinterval.js

@ -4,13 +4,13 @@ BI.YearMonthInterval = BI.inherit(BI.Single, {
width: 25,
lgap: 15,
offset: -15,
timeErrorCls: "time-error",
DATE_MIN_VALUE: "1900-01-01",
DATE_MAX_VALUE: "2099-12-31"
timeErrorCls: "time-error"
},
props: {
extraCls: "bi-year-month-interval"
extraCls: "bi-year-month-interval",
minDate: "1900-01-01",
maxDate: "2099-12-31"
},
_init: function () {
@ -117,7 +117,8 @@ BI.YearMonthInterval = BI.inherit(BI.Single, {
// 判是否在最大最小之间
_checkVoid: function (obj) {
return !BI.checkDateVoid(obj.year, obj.month, 1, this.constants.DATE_MIN_VALUE, this.constants.DATE_MAX_VALUE)[0];
var o = this.options;
return !BI.checkDateVoid(obj.year, obj.month, 1, o.minDate, o.maxDate)[0];
},
// 判格式合法

3
src/widget/yearquarter/popup.yearquarter.js

@ -25,7 +25,6 @@ BI.DynamicYearQuarterPopup = BI.inherit(BI.Widget, {
type: "bi.grid",
items: [[{
type: "bi.text_button",
forceCenter: true,
cls: "bi-split-top bi-high-light",
shadow: true,
textHeight: c.buttonHeight - 1,
@ -38,7 +37,6 @@ BI.DynamicYearQuarterPopup = BI.inherit(BI.Widget, {
}]
}, {
type: "bi.text_button",
forceCenter: true,
cls: "bi-split-left bi-split-right bi-high-light bi-split-top",
textHeight: c.buttonHeight - 1,
shadow: true,
@ -54,7 +52,6 @@ BI.DynamicYearQuarterPopup = BI.inherit(BI.Widget, {
}]
}, {
type: "bi.text_button",
forceCenter: true,
cls: "bi-split-top bi-high-light",
shadow: true,
textHeight: c.buttonHeight - 1,

Loading…
Cancel
Save